@veevarts/design-system 0.1.0 → 0.1.1

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.
@@ -0,0 +1,1521 @@
1
+ import { i as V, a as re, b as Q, c as le, m as T, f as S, e as E, g as he, h as Ut, p as ce, j as k, s as ue, k as de, l as Z, n as Ot, o as P, q as I, r as fe, t as me, u as pe, v as tt, w as Ft, x as W, y as ye, z as ge, F as Nt, A as j, B as ve, L as xe, C as Pe, S as Te, D as Wt, E as De, G as Gt, H as zt, I as $t, J as Ht, K as Ee, M as Se, N as et, O as Ae, P as Le, Q as z, R as C, T as U, U as O, V as st, W as Ve, X as be, Y as Re, Z as w, _ as $, $ as it, a0 as Ce, d as we } from "./index-o78rLePm.js";
2
+ import { a1 as Gs, aN as zs, b3 as $s, ar as Hs, aO as Xs, b4 as Ys, a4 as qs, a5 as Ks, a6 as _s, ao as Zs, ap as Js, ah as Qs, bK as ti, aP as ei, aQ as si, a2 as ii, a3 as ni, aq as oi, am as ai, ag as ri, bf as li, bZ as hi, bR as ci, ai as ui, a8 as di, ay as fi, bg as mi, az as pi, aA as yi, aB as gi, ak as vi, a$ as xi, aC as Pi, aD as Ti, bL as Di, bS as Ei, aT as Si, b8 as Ai, b1 as Li, bi as Vi, aE as bi, ba as Ri, aY as Ci, b6 as wi, bn as ji, bV as Mi, c0 as Bi, bT as ki, aF as Ii, aG as Ui, aH as Oi, aM as Fi, b7 as Ni, b9 as Wi, aa as Gi, bU as zi, c6 as $i, b5 as Hi, bh as Xi, c5 as Yi, bW as qi, bz as Ki, c7 as _i, aR as Zi, bM as Ji, bk as Qi, bN as tn, bO as en, aX as sn, bu as nn, bE as on, aK as an, ab as rn, aU as ln, aV as hn, bj as cn, aL as un, b2 as dn, bv as fn, bm as mn, at as pn, aj as yn, au as gn, aZ as vn, a7 as xn, aW as Pn, a9 as Tn, bb as Dn, b0 as En, av as Sn, aI as An, bw as Ln, bA as Vn, bx as bn, bB as Rn, bD as Cn, by as wn, bC as jn, bF as Mn, b_ as Bn, bX as kn, an as In, aS as Un, bo as On, br as Fn, bl as Nn, c1 as Wn, bp as Gn, bG as zn, aJ as $n, bP as Hn, bQ as Xn, b$ as Yn, bq as qn, a_ as Kn, bd as _n, bc as Zn, be as Jn, bH as Qn, bI as to, bJ as eo, c4 as so, bs as io, bt as no, bY as oo, ac as ao, ad as ro, ae as lo, af as ho, aw as co, c2 as uo, al as fo, c3 as mo, ax as po, as as yo } from "./index-o78rLePm.js";
3
+ import { useContext as nt, Component as je } from "react";
4
+ function Me(t) {
5
+ return t === "x" || t === "y" ? V[t] ? null : (V[t] = !0, () => {
6
+ V[t] = !1;
7
+ }) : V.x || V.y ? null : (V.x = V.y = !0, () => {
8
+ V.x = V.y = !1;
9
+ });
10
+ }
11
+ function Xt(t) {
12
+ return re(t) && "ownerSVGElement" in t;
13
+ }
14
+ function Be(t) {
15
+ return Xt(t) && t.tagName === "svg";
16
+ }
17
+ function M(t, e, i, n) {
18
+ return Q(t, e, le(i), n);
19
+ }
20
+ const Yt = 1e-4, ke = 1 - Yt, Ie = 1 + Yt, qt = 0.01, Ue = 0 - qt, Oe = 0 + qt;
21
+ function D(t) {
22
+ return t.max - t.min;
23
+ }
24
+ function Fe(t, e, i) {
25
+ return Math.abs(t - e) <= i;
26
+ }
27
+ function ot(t, e, i, n = 0.5) {
28
+ t.origin = n, t.originPoint = T(e.min, e.max, t.origin), t.scale = D(i) / D(e), t.translate = T(i.min, i.max, t.origin) - t.originPoint, (t.scale >= ke && t.scale <= Ie || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Ue && t.translate <= Oe || isNaN(t.translate)) && (t.translate = 0);
29
+ }
30
+ function B(t, e, i, n) {
31
+ ot(t.x, e.x, i.x, n ? n.originX : void 0), ot(t.y, e.y, i.y, n ? n.originY : void 0);
32
+ }
33
+ function at(t, e, i) {
34
+ t.min = i.min + e.min, t.max = t.min + D(e);
35
+ }
36
+ function Ne(t, e, i) {
37
+ at(t.x, e.x, i.x), at(t.y, e.y, i.y);
38
+ }
39
+ function rt(t, e, i) {
40
+ t.min = e.min - i.min, t.max = t.min + D(e);
41
+ }
42
+ function G(t, e, i) {
43
+ rt(t.x, e.x, i.x), rt(t.y, e.y, i.y);
44
+ }
45
+ function A(t) {
46
+ return [t("x"), t("y")];
47
+ }
48
+ const Kt = ({ current: t }) => t ? t.ownerDocument.defaultView : null, lt = (t, e) => Math.abs(t - e);
49
+ function We(t, e) {
50
+ const i = lt(t.x, e.x), n = lt(t.y, e.y);
51
+ return Math.sqrt(i ** 2 + n ** 2);
52
+ }
53
+ const ht = /* @__PURE__ */ new Set(["auto", "scroll"]);
54
+ class _t {
55
+ constructor(e, i, { transformPagePoint: n, contextWindow: r = window, dragSnapToOrigin: c = !1, distanceThreshold: s = 3, element: o } = {}) {
56
+ if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.scrollPositions = /* @__PURE__ */ new Map(), this.removeScrollListeners = null, this.onElementScroll = (f) => {
57
+ this.handleScroll(f.target);
58
+ }, this.onWindowScroll = () => {
59
+ this.handleScroll(window);
60
+ }, this.updatePoint = () => {
61
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
62
+ return;
63
+ const f = X(this.lastMoveEventInfo, this.history), m = this.startEvent !== null, x = We(f.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
64
+ if (!m && !x)
65
+ return;
66
+ const { point: p } = f, { timestamp: y } = S;
67
+ this.history.push({ ...p, timestamp: y });
68
+ const { onStart: g, onMove: v } = this.handlers;
69
+ m || (g && g(this.lastMoveEvent, f), this.startEvent = this.lastMoveEvent), v && v(this.lastMoveEvent, f);
70
+ }, this.handlePointerMove = (f, m) => {
71
+ this.lastMoveEvent = f, this.lastMoveEventInfo = H(m, this.transformPagePoint), E.update(this.updatePoint, !0);
72
+ }, this.handlePointerUp = (f, m) => {
73
+ this.end();
74
+ const { onEnd: x, onSessionEnd: p, resumeAnimation: y } = this.handlers;
75
+ if ((this.dragSnapToOrigin || !this.startEvent) && y && y(), !(this.lastMoveEvent && this.lastMoveEventInfo))
76
+ return;
77
+ const g = X(f.type === "pointercancel" ? this.lastMoveEventInfo : H(m, this.transformPagePoint), this.history);
78
+ this.startEvent && x && x(f, g), p && p(f, g);
79
+ }, !he(e))
80
+ return;
81
+ this.dragSnapToOrigin = c, this.handlers = i, this.transformPagePoint = n, this.distanceThreshold = s, this.contextWindow = r || window;
82
+ const a = Ut(e), l = H(a, this.transformPagePoint), { point: h } = l, { timestamp: u } = S;
83
+ this.history = [{ ...h, timestamp: u }];
84
+ const { onSessionStart: d } = i;
85
+ d && d(e, X(l, this.history)), this.removeListeners = ce(M(this.contextWindow, "pointermove", this.handlePointerMove), M(this.contextWindow, "pointerup", this.handlePointerUp), M(this.contextWindow, "pointercancel", this.handlePointerUp)), o && this.startScrollTracking(o);
86
+ }
87
+ /**
88
+ * Start tracking scroll on ancestors and window.
89
+ */
90
+ startScrollTracking(e) {
91
+ let i = e.parentElement;
92
+ for (; i; ) {
93
+ const n = getComputedStyle(i);
94
+ (ht.has(n.overflowX) || ht.has(n.overflowY)) && this.scrollPositions.set(i, {
95
+ x: i.scrollLeft,
96
+ y: i.scrollTop
97
+ }), i = i.parentElement;
98
+ }
99
+ this.scrollPositions.set(window, {
100
+ x: window.scrollX,
101
+ y: window.scrollY
102
+ }), window.addEventListener("scroll", this.onElementScroll, {
103
+ capture: !0,
104
+ passive: !0
105
+ }), window.addEventListener("scroll", this.onWindowScroll, {
106
+ passive: !0
107
+ }), this.removeScrollListeners = () => {
108
+ window.removeEventListener("scroll", this.onElementScroll, {
109
+ capture: !0
110
+ }), window.removeEventListener("scroll", this.onWindowScroll);
111
+ };
112
+ }
113
+ /**
114
+ * Handle scroll compensation during drag.
115
+ *
116
+ * For element scroll: adjusts history origin since pageX/pageY doesn't change.
117
+ * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
118
+ */
119
+ handleScroll(e) {
120
+ const i = this.scrollPositions.get(e);
121
+ if (!i)
122
+ return;
123
+ const n = e === window, r = n ? { x: window.scrollX, y: window.scrollY } : {
124
+ x: e.scrollLeft,
125
+ y: e.scrollTop
126
+ }, c = { x: r.x - i.x, y: r.y - i.y };
127
+ c.x === 0 && c.y === 0 || (n ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += c.x, this.lastMoveEventInfo.point.y += c.y) : this.history.length > 0 && (this.history[0].x -= c.x, this.history[0].y -= c.y), this.scrollPositions.set(e, r), E.update(this.updatePoint, !0));
128
+ }
129
+ updateHandlers(e) {
130
+ this.handlers = e;
131
+ }
132
+ end() {
133
+ this.removeListeners && this.removeListeners(), this.removeScrollListeners && this.removeScrollListeners(), this.scrollPositions.clear(), k(this.updatePoint);
134
+ }
135
+ }
136
+ function H(t, e) {
137
+ return e ? { point: e(t.point) } : t;
138
+ }
139
+ function ct(t, e) {
140
+ return { x: t.x - e.x, y: t.y - e.y };
141
+ }
142
+ function X({ point: t }, e) {
143
+ return {
144
+ point: t,
145
+ delta: ct(t, Zt(e)),
146
+ offset: ct(t, Ge(e)),
147
+ velocity: ze(e, 0.1)
148
+ };
149
+ }
150
+ function Ge(t) {
151
+ return t[0];
152
+ }
153
+ function Zt(t) {
154
+ return t[t.length - 1];
155
+ }
156
+ function ze(t, e) {
157
+ if (t.length < 2)
158
+ return { x: 0, y: 0 };
159
+ let i = t.length - 1, n = null;
160
+ const r = Zt(t);
161
+ for (; i >= 0 && (n = t[i], !(r.timestamp - n.timestamp > ue(e))); )
162
+ i--;
163
+ if (!n)
164
+ return { x: 0, y: 0 };
165
+ const c = de(r.timestamp - n.timestamp);
166
+ if (c === 0)
167
+ return { x: 0, y: 0 };
168
+ const s = {
169
+ x: (r.x - n.x) / c,
170
+ y: (r.y - n.y) / c
171
+ };
172
+ return s.x === 1 / 0 && (s.x = 0), s.y === 1 / 0 && (s.y = 0), s;
173
+ }
174
+ function $e(t, { min: e, max: i }, n) {
175
+ return e !== void 0 && t < e ? t = n ? T(e, t, n.min) : Math.max(t, e) : i !== void 0 && t > i && (t = n ? T(i, t, n.max) : Math.min(t, i)), t;
176
+ }
177
+ function ut(t, e, i) {
178
+ return {
179
+ min: e !== void 0 ? t.min + e : void 0,
180
+ max: i !== void 0 ? t.max + i - (t.max - t.min) : void 0
181
+ };
182
+ }
183
+ function He(t, { top: e, left: i, bottom: n, right: r }) {
184
+ return {
185
+ x: ut(t.x, i, r),
186
+ y: ut(t.y, e, n)
187
+ };
188
+ }
189
+ function dt(t, e) {
190
+ let i = e.min - t.min, n = e.max - t.max;
191
+ return e.max - e.min < t.max - t.min && ([i, n] = [n, i]), { min: i, max: n };
192
+ }
193
+ function Xe(t, e) {
194
+ return {
195
+ x: dt(t.x, e.x),
196
+ y: dt(t.y, e.y)
197
+ };
198
+ }
199
+ function Ye(t, e) {
200
+ let i = 0.5;
201
+ const n = D(t), r = D(e);
202
+ return r > n ? i = Z(e.min, e.max - n, t.min) : n > r && (i = Z(t.min, t.max - r, e.min)), Ot(0, 1, i);
203
+ }
204
+ function qe(t, e) {
205
+ const i = {};
206
+ return e.min !== void 0 && (i.min = e.min - t.min), e.max !== void 0 && (i.max = e.max - t.min), i;
207
+ }
208
+ const J = 0.35;
209
+ function Ke(t = J) {
210
+ return t === !1 ? t = 0 : t === !0 && (t = J), {
211
+ x: ft(t, "left", "right"),
212
+ y: ft(t, "top", "bottom")
213
+ };
214
+ }
215
+ function ft(t, e, i) {
216
+ return {
217
+ min: mt(t, e),
218
+ max: mt(t, i)
219
+ };
220
+ }
221
+ function mt(t, e) {
222
+ return typeof t == "number" ? t : t[e] || 0;
223
+ }
224
+ const _e = /* @__PURE__ */ new WeakMap();
225
+ class Ze {
226
+ constructor(e) {
227
+ this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = P(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
228
+ }
229
+ start(e, { snapToCursor: i = !1, distanceThreshold: n } = {}) {
230
+ const { presenceContext: r } = this.visualElement;
231
+ if (r && r.isPresent === !1)
232
+ return;
233
+ const c = (u) => {
234
+ i ? (this.stopAnimation(), this.snapToCursor(Ut(u).point)) : this.pauseAnimation();
235
+ }, s = (u, d) => {
236
+ this.stopAnimation();
237
+ const { drag: f, dragPropagation: m, onDragStart: x } = this.getProps();
238
+ if (f && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = Me(f), !this.openDragLock))
239
+ return;
240
+ this.latestPointerEvent = u, this.latestPanInfo = d, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), A((y) => {
241
+ let g = this.getAxisMotionValue(y).get() || 0;
242
+ if (W.test(g)) {
243
+ const { projection: v } = this.visualElement;
244
+ if (v && v.layout) {
245
+ const b = v.layout.layoutBox[y];
246
+ b && (g = D(b) * (parseFloat(g) / 100));
247
+ }
248
+ }
249
+ this.originPoint[y] = g;
250
+ }), x && E.postRender(() => x(u, d)), tt(this.visualElement, "transform");
251
+ const { animationState: p } = this.visualElement;
252
+ p && p.setActive("whileDrag", !0);
253
+ }, o = (u, d) => {
254
+ this.latestPointerEvent = u, this.latestPanInfo = d;
255
+ const { dragPropagation: f, dragDirectionLock: m, onDirectionLock: x, onDrag: p } = this.getProps();
256
+ if (!f && !this.openDragLock)
257
+ return;
258
+ const { offset: y } = d;
259
+ if (m && this.currentDirection === null) {
260
+ this.currentDirection = Je(y), this.currentDirection !== null && x && x(this.currentDirection);
261
+ return;
262
+ }
263
+ this.updateAxis("x", d.point, y), this.updateAxis("y", d.point, y), this.visualElement.render(), p && p(u, d);
264
+ }, a = (u, d) => {
265
+ this.latestPointerEvent = u, this.latestPanInfo = d, this.stop(u, d), this.latestPointerEvent = null, this.latestPanInfo = null;
266
+ }, l = () => A((u) => this.getAnimationState(u) === "paused" && this.getAxisMotionValue(u).animation?.play()), { dragSnapToOrigin: h } = this.getProps();
267
+ this.panSession = new _t(e, {
268
+ onSessionStart: c,
269
+ onStart: s,
270
+ onMove: o,
271
+ onSessionEnd: a,
272
+ resumeAnimation: l
273
+ }, {
274
+ transformPagePoint: this.visualElement.getTransformPagePoint(),
275
+ dragSnapToOrigin: h,
276
+ distanceThreshold: n,
277
+ contextWindow: Kt(this.visualElement),
278
+ element: this.visualElement.current
279
+ });
280
+ }
281
+ /**
282
+ * @internal
283
+ */
284
+ stop(e, i) {
285
+ const n = e || this.latestPointerEvent, r = i || this.latestPanInfo, c = this.isDragging;
286
+ if (this.cancel(), !c || !r || !n)
287
+ return;
288
+ const { velocity: s } = r;
289
+ this.startAnimation(s);
290
+ const { onDragEnd: o } = this.getProps();
291
+ o && E.postRender(() => o(n, r));
292
+ }
293
+ /**
294
+ * @internal
295
+ */
296
+ cancel() {
297
+ this.isDragging = !1;
298
+ const { projection: e, animationState: i } = this.visualElement;
299
+ e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
300
+ const { dragPropagation: n } = this.getProps();
301
+ !n && this.openDragLock && (this.openDragLock(), this.openDragLock = null), i && i.setActive("whileDrag", !1);
302
+ }
303
+ updateAxis(e, i, n) {
304
+ const { drag: r } = this.getProps();
305
+ if (!n || !F(e, r, this.currentDirection))
306
+ return;
307
+ const c = this.getAxisMotionValue(e);
308
+ let s = this.originPoint[e] + n[e];
309
+ this.constraints && this.constraints[e] && (s = $e(s, this.constraints[e], this.elastic[e])), c.set(s);
310
+ }
311
+ resolveConstraints() {
312
+ const { dragConstraints: e, dragElastic: i } = this.getProps(), n = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, r = this.constraints;
313
+ e && I(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && n ? this.constraints = He(n.layoutBox, e) : this.constraints = !1, this.elastic = Ke(i), r !== this.constraints && n && this.constraints && !this.hasMutatedConstraints && A((c) => {
314
+ this.constraints !== !1 && this.getAxisMotionValue(c) && (this.constraints[c] = qe(n.layoutBox[c], this.constraints[c]));
315
+ });
316
+ }
317
+ resolveRefConstraints() {
318
+ const { dragConstraints: e, onMeasureDragConstraints: i } = this.getProps();
319
+ if (!e || !I(e))
320
+ return !1;
321
+ const n = e.current;
322
+ ye(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
323
+ const { projection: r } = this.visualElement;
324
+ if (!r || !r.layout)
325
+ return !1;
326
+ const c = fe(n, r.root, this.visualElement.getTransformPagePoint());
327
+ let s = Xe(r.layout.layoutBox, c);
328
+ if (i) {
329
+ const o = i(me(s));
330
+ this.hasMutatedConstraints = !!o, o && (s = pe(o));
331
+ }
332
+ return s;
333
+ }
334
+ startAnimation(e) {
335
+ const { drag: i, dragMomentum: n, dragElastic: r, dragTransition: c, dragSnapToOrigin: s, onDragTransitionEnd: o } = this.getProps(), a = this.constraints || {}, l = A((h) => {
336
+ if (!F(h, i, this.currentDirection))
337
+ return;
338
+ let u = a && a[h] || {};
339
+ s && (u = { min: 0, max: 0 });
340
+ const d = r ? 200 : 1e6, f = r ? 40 : 1e7, m = {
341
+ type: "inertia",
342
+ velocity: n ? e[h] : 0,
343
+ bounceStiffness: d,
344
+ bounceDamping: f,
345
+ timeConstant: 750,
346
+ restDelta: 1,
347
+ restSpeed: 10,
348
+ ...c,
349
+ ...u
350
+ };
351
+ return this.startAxisValueAnimation(h, m);
352
+ });
353
+ return Promise.all(l).then(o);
354
+ }
355
+ startAxisValueAnimation(e, i) {
356
+ const n = this.getAxisMotionValue(e);
357
+ return tt(this.visualElement, e), n.start(Ft(e, n, 0, i, this.visualElement, !1));
358
+ }
359
+ stopAnimation() {
360
+ A((e) => this.getAxisMotionValue(e).stop());
361
+ }
362
+ pauseAnimation() {
363
+ A((e) => this.getAxisMotionValue(e).animation?.pause());
364
+ }
365
+ getAnimationState(e) {
366
+ return this.getAxisMotionValue(e).animation?.state;
367
+ }
368
+ /**
369
+ * Drag works differently depending on which props are provided.
370
+ *
371
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
372
+ * - Otherwise, we apply the delta to the x/y motion values.
373
+ */
374
+ getAxisMotionValue(e) {
375
+ const i = `_drag${e.toUpperCase()}`, n = this.visualElement.getProps(), r = n[i];
376
+ return r || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0);
377
+ }
378
+ snapToCursor(e) {
379
+ A((i) => {
380
+ const { drag: n } = this.getProps();
381
+ if (!F(i, n, this.currentDirection))
382
+ return;
383
+ const { projection: r } = this.visualElement, c = this.getAxisMotionValue(i);
384
+ if (r && r.layout) {
385
+ const { min: s, max: o } = r.layout.layoutBox[i], a = c.get() || 0;
386
+ c.set(e[i] - T(s, o, 0.5) + a);
387
+ }
388
+ });
389
+ }
390
+ /**
391
+ * When the viewport resizes we want to check if the measured constraints
392
+ * have changed and, if so, reposition the element within those new constraints
393
+ * relative to where it was before the resize.
394
+ */
395
+ scalePositionWithinConstraints() {
396
+ if (!this.visualElement.current)
397
+ return;
398
+ const { drag: e, dragConstraints: i } = this.getProps(), { projection: n } = this.visualElement;
399
+ if (!I(i) || !n || !this.constraints)
400
+ return;
401
+ this.stopAnimation();
402
+ const r = { x: 0, y: 0 };
403
+ A((s) => {
404
+ const o = this.getAxisMotionValue(s);
405
+ if (o && this.constraints !== !1) {
406
+ const a = o.get();
407
+ r[s] = Ye({ min: a, max: a }, this.constraints[s]);
408
+ }
409
+ });
410
+ const { transformTemplate: c } = this.visualElement.getProps();
411
+ this.visualElement.current.style.transform = c ? c({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), A((s) => {
412
+ if (!F(s, e, null))
413
+ return;
414
+ const o = this.getAxisMotionValue(s), { min: a, max: l } = this.constraints[s];
415
+ o.set(T(a, l, r[s]));
416
+ });
417
+ }
418
+ addListeners() {
419
+ if (!this.visualElement.current)
420
+ return;
421
+ _e.set(this.visualElement, this);
422
+ const e = this.visualElement.current, i = M(e, "pointerdown", (a) => {
423
+ const { drag: l, dragListener: h = !0 } = this.getProps();
424
+ l && h && !ge(a.target) && this.start(a);
425
+ }), n = () => {
426
+ const { dragConstraints: a } = this.getProps();
427
+ I(a) && a.current && (this.constraints = this.resolveRefConstraints());
428
+ }, { projection: r } = this.visualElement, c = r.addEventListener("measure", n);
429
+ r && !r.layout && (r.root && r.root.updateScroll(), r.updateLayout()), E.read(n);
430
+ const s = Q(window, "resize", () => this.scalePositionWithinConstraints()), o = r.addEventListener("didUpdate", (({ delta: a, hasLayoutChanged: l }) => {
431
+ this.isDragging && l && (A((h) => {
432
+ const u = this.getAxisMotionValue(h);
433
+ u && (this.originPoint[h] += a[h].translate, u.set(u.get() + a[h].translate));
434
+ }), this.visualElement.render());
435
+ }));
436
+ return () => {
437
+ s(), i(), c(), o && o();
438
+ };
439
+ }
440
+ getProps() {
441
+ const e = this.visualElement.getProps(), { drag: i = !1, dragDirectionLock: n = !1, dragPropagation: r = !1, dragConstraints: c = !1, dragElastic: s = J, dragMomentum: o = !0 } = e;
442
+ return {
443
+ ...e,
444
+ drag: i,
445
+ dragDirectionLock: n,
446
+ dragPropagation: r,
447
+ dragConstraints: c,
448
+ dragElastic: s,
449
+ dragMomentum: o
450
+ };
451
+ }
452
+ }
453
+ function F(t, e, i) {
454
+ return (e === !0 || e === t) && (i === null || i === t);
455
+ }
456
+ function Je(t, e = 10) {
457
+ let i = null;
458
+ return Math.abs(t.y) > e ? i = "y" : Math.abs(t.x) > e && (i = "x"), i;
459
+ }
460
+ class Qe extends Nt {
461
+ constructor(e) {
462
+ super(e), this.removeGroupControls = j, this.removeListeners = j, this.controls = new Ze(e);
463
+ }
464
+ mount() {
465
+ const { dragControls: e } = this.node.getProps();
466
+ e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || j;
467
+ }
468
+ update() {
469
+ const { dragControls: e } = this.node.getProps(), { dragControls: i } = this.node.prevProps || {};
470
+ e !== i && (this.removeGroupControls(), e && (this.removeGroupControls = e.subscribe(this.controls)));
471
+ }
472
+ unmount() {
473
+ this.removeGroupControls(), this.removeListeners();
474
+ }
475
+ }
476
+ const pt = (t) => (e, i) => {
477
+ t && E.postRender(() => t(e, i));
478
+ };
479
+ class ts extends Nt {
480
+ constructor() {
481
+ super(...arguments), this.removePointerDownListener = j;
482
+ }
483
+ onPointerDown(e) {
484
+ this.session = new _t(e, this.createPanHandlers(), {
485
+ transformPagePoint: this.node.getTransformPagePoint(),
486
+ contextWindow: Kt(this.node)
487
+ });
488
+ }
489
+ createPanHandlers() {
490
+ const { onPanSessionStart: e, onPanStart: i, onPan: n, onPanEnd: r } = this.node.getProps();
491
+ return {
492
+ onSessionStart: pt(e),
493
+ onStart: pt(i),
494
+ onMove: n,
495
+ onEnd: (c, s) => {
496
+ delete this.session, r && E.postRender(() => r(c, s));
497
+ }
498
+ };
499
+ }
500
+ mount() {
501
+ this.removePointerDownListener = M(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
502
+ }
503
+ update() {
504
+ this.session && this.session.updateHandlers(this.createPanHandlers());
505
+ }
506
+ unmount() {
507
+ this.removePointerDownListener(), this.session && this.session.end();
508
+ }
509
+ }
510
+ const N = {
511
+ /**
512
+ * Global flag as to whether the tree has animated since the last time
513
+ * we resized the window
514
+ */
515
+ hasAnimatedSinceResize: !0,
516
+ /**
517
+ * We set this to true once, on the first update. Any nodes added to the tree beyond that
518
+ * update will be given a `data-projection-id` attribute.
519
+ */
520
+ hasEverUpdated: !1
521
+ };
522
+ let Y = !1;
523
+ class es extends je {
524
+ /**
525
+ * This only mounts projection nodes for components that
526
+ * need measuring, we might want to do it for all components
527
+ * in order to incorporate transforms
528
+ */
529
+ componentDidMount() {
530
+ const { visualElement: e, layoutGroup: i, switchLayoutGroup: n, layoutId: r } = this.props, { projection: c } = e;
531
+ c && (i.group && i.group.add(c), n && n.register && r && n.register(c), Y && c.root.didUpdate(), c.addEventListener("animationComplete", () => {
532
+ this.safeToRemove();
533
+ }), c.setOptions({
534
+ ...c.options,
535
+ onExitComplete: () => this.safeToRemove()
536
+ })), N.hasEverUpdated = !0;
537
+ }
538
+ getSnapshotBeforeUpdate(e) {
539
+ const { layoutDependency: i, visualElement: n, drag: r, isPresent: c } = this.props, { projection: s } = n;
540
+ return s && (s.isPresent = c, Y = !0, r || e.layoutDependency !== i || i === void 0 || e.isPresent !== c ? s.willUpdate() : this.safeToRemove(), e.isPresent !== c && (c ? s.promote() : s.relegate() || E.postRender(() => {
541
+ const o = s.getStack();
542
+ (!o || !o.members.length) && this.safeToRemove();
543
+ }))), null;
544
+ }
545
+ componentDidUpdate() {
546
+ const { projection: e } = this.props.visualElement;
547
+ e && (e.root.didUpdate(), Wt.postRender(() => {
548
+ !e.currentAnimation && e.isLead() && this.safeToRemove();
549
+ }));
550
+ }
551
+ componentWillUnmount() {
552
+ const { visualElement: e, layoutGroup: i, switchLayoutGroup: n } = this.props, { projection: r } = e;
553
+ Y = !0, r && (r.scheduleCheckAfterUnmount(), i && i.group && i.group.remove(r), n && n.deregister && n.deregister(r));
554
+ }
555
+ safeToRemove() {
556
+ const { safeToRemove: e } = this.props;
557
+ e && e();
558
+ }
559
+ render() {
560
+ return null;
561
+ }
562
+ }
563
+ function Jt(t) {
564
+ const [e, i] = ve(), n = nt(xe);
565
+ return Pe.jsx(es, { ...t, layoutGroup: n, switchLayoutGroup: nt(Te), isPresent: e, safeToRemove: i });
566
+ }
567
+ function ss(t, e, i) {
568
+ const n = De(t) ? t : Gt(t);
569
+ return n.start(Ft("", n, e, i)), n.animation;
570
+ }
571
+ const is = (t, e) => t.depth - e.depth;
572
+ class ns {
573
+ constructor() {
574
+ this.children = [], this.isDirty = !1;
575
+ }
576
+ add(e) {
577
+ zt(this.children, e), this.isDirty = !0;
578
+ }
579
+ remove(e) {
580
+ $t(this.children, e), this.isDirty = !0;
581
+ }
582
+ forEach(e) {
583
+ this.isDirty && this.children.sort(is), this.isDirty = !1, this.children.forEach(e);
584
+ }
585
+ }
586
+ function os(t, e) {
587
+ const i = Ht.now(), n = ({ timestamp: r }) => {
588
+ const c = r - i;
589
+ c >= e && (k(n), t(c - e));
590
+ };
591
+ return E.setup(n, !0), () => k(n);
592
+ }
593
+ const Qt = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], as = Qt.length, yt = (t) => typeof t == "string" ? parseFloat(t) : t, gt = (t) => typeof t == "number" || Ee.test(t);
594
+ function rs(t, e, i, n, r, c) {
595
+ r ? (t.opacity = T(0, i.opacity ?? 1, ls(n)), t.opacityExit = T(e.opacity ?? 1, 0, hs(n))) : c && (t.opacity = T(e.opacity ?? 1, i.opacity ?? 1, n));
596
+ for (let s = 0; s < as; s++) {
597
+ const o = `border${Qt[s]}Radius`;
598
+ let a = vt(e, o), l = vt(i, o);
599
+ if (a === void 0 && l === void 0)
600
+ continue;
601
+ a || (a = 0), l || (l = 0), a === 0 || l === 0 || gt(a) === gt(l) ? (t[o] = Math.max(T(yt(a), yt(l), n), 0), (W.test(l) || W.test(a)) && (t[o] += "%")) : t[o] = l;
602
+ }
603
+ (e.rotate || i.rotate) && (t.rotate = T(e.rotate || 0, i.rotate || 0, n));
604
+ }
605
+ function vt(t, e) {
606
+ return t[e] !== void 0 ? t[e] : t.borderRadius;
607
+ }
608
+ const ls = /* @__PURE__ */ te(0, 0.5, Se), hs = /* @__PURE__ */ te(0.5, 0.95, j);
609
+ function te(t, e, i) {
610
+ return (n) => n < t ? 0 : n > e ? 1 : i(Z(t, e, n));
611
+ }
612
+ function xt(t, e) {
613
+ t.min = e.min, t.max = e.max;
614
+ }
615
+ function L(t, e) {
616
+ xt(t.x, e.x), xt(t.y, e.y);
617
+ }
618
+ function Pt(t, e) {
619
+ t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
620
+ }
621
+ function Tt(t, e, i, n, r) {
622
+ return t -= e, t = et(t, 1 / i, n), r !== void 0 && (t = et(t, 1 / r, n)), t;
623
+ }
624
+ function cs(t, e = 0, i = 1, n = 0.5, r, c = t, s = t) {
625
+ if (W.test(e) && (e = parseFloat(e), e = T(s.min, s.max, e / 100) - s.min), typeof e != "number")
626
+ return;
627
+ let o = T(c.min, c.max, n);
628
+ t === c && (o -= e), t.min = Tt(t.min, e, i, o, r), t.max = Tt(t.max, e, i, o, r);
629
+ }
630
+ function Dt(t, e, [i, n, r], c, s) {
631
+ cs(t, e[i], e[n], e[r], e.scale, c, s);
632
+ }
633
+ const us = ["x", "scaleX", "originX"], ds = ["y", "scaleY", "originY"];
634
+ function Et(t, e, i, n) {
635
+ Dt(t.x, e, us, i ? i.x : void 0, n ? n.x : void 0), Dt(t.y, e, ds, i ? i.y : void 0, n ? n.y : void 0);
636
+ }
637
+ function St(t) {
638
+ return t.translate === 0 && t.scale === 1;
639
+ }
640
+ function ee(t) {
641
+ return St(t.x) && St(t.y);
642
+ }
643
+ function At(t, e) {
644
+ return t.min === e.min && t.max === e.max;
645
+ }
646
+ function fs(t, e) {
647
+ return At(t.x, e.x) && At(t.y, e.y);
648
+ }
649
+ function Lt(t, e) {
650
+ return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
651
+ }
652
+ function se(t, e) {
653
+ return Lt(t.x, e.x) && Lt(t.y, e.y);
654
+ }
655
+ function Vt(t) {
656
+ return D(t.x) / D(t.y);
657
+ }
658
+ function bt(t, e) {
659
+ return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
660
+ }
661
+ class ms {
662
+ constructor() {
663
+ this.members = [];
664
+ }
665
+ add(e) {
666
+ zt(this.members, e), e.scheduleRender();
667
+ }
668
+ remove(e) {
669
+ if ($t(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
670
+ const i = this.members[this.members.length - 1];
671
+ i && this.promote(i);
672
+ }
673
+ }
674
+ relegate(e) {
675
+ const i = this.members.findIndex((r) => e === r);
676
+ if (i === 0)
677
+ return !1;
678
+ let n;
679
+ for (let r = i; r >= 0; r--) {
680
+ const c = this.members[r];
681
+ if (c.isPresent !== !1) {
682
+ n = c;
683
+ break;
684
+ }
685
+ }
686
+ return n ? (this.promote(n), !0) : !1;
687
+ }
688
+ promote(e, i) {
689
+ const n = this.lead;
690
+ if (e !== n && (this.prevLead = n, this.lead = e, e.show(), n)) {
691
+ n.instance && n.scheduleRender(), e.scheduleRender(), e.resumeFrom = n, i && (e.resumeFrom.preserveOpacity = !0), n.snapshot && (e.snapshot = n.snapshot, e.snapshot.latestValues = n.animationValues || n.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
692
+ const { crossfade: r } = e.options;
693
+ r === !1 && n.hide();
694
+ }
695
+ }
696
+ exitAnimationComplete() {
697
+ this.members.forEach((e) => {
698
+ const { options: i, resumingFrom: n } = e;
699
+ i.onExitComplete && i.onExitComplete(), n && n.options.onExitComplete && n.options.onExitComplete();
700
+ });
701
+ }
702
+ scheduleRender() {
703
+ this.members.forEach((e) => {
704
+ e.instance && e.scheduleRender(!1);
705
+ });
706
+ }
707
+ /**
708
+ * Clear any leads that have been removed this render to prevent them from being
709
+ * used in future animations and to prevent memory leaks
710
+ */
711
+ removeLeadSnapshot() {
712
+ this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
713
+ }
714
+ }
715
+ function ps(t, e, i) {
716
+ let n = "";
717
+ const r = t.x.translate / e.x, c = t.y.translate / e.y, s = i?.z || 0;
718
+ if ((r || c || s) && (n = `translate3d(${r}px, ${c}px, ${s}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), i) {
719
+ const { transformPerspective: l, rotate: h, rotateX: u, rotateY: d, skewX: f, skewY: m } = i;
720
+ l && (n = `perspective(${l}px) ${n}`), h && (n += `rotate(${h}deg) `), u && (n += `rotateX(${u}deg) `), d && (n += `rotateY(${d}deg) `), f && (n += `skewX(${f}deg) `), m && (n += `skewY(${m}deg) `);
721
+ }
722
+ const o = t.x.scale * e.x, a = t.y.scale * e.y;
723
+ return (o !== 1 || a !== 1) && (n += `scale(${o}, ${a})`), n || "none";
724
+ }
725
+ const q = ["", "X", "Y", "Z"], ys = 1e3;
726
+ let gs = 0;
727
+ function K(t, e, i, n) {
728
+ const { latestValues: r } = e;
729
+ r[t] && (i[t] = r[t], e.setStaticValue(t, 0), n && (n[t] = 0));
730
+ }
731
+ function ie(t) {
732
+ if (t.hasCheckedOptimisedAppear = !0, t.root === t)
733
+ return;
734
+ const { visualElement: e } = t.options;
735
+ if (!e)
736
+ return;
737
+ const i = Ce(e);
738
+ if (window.MotionHasOptimisedAnimation(i, "transform")) {
739
+ const { layout: r, layoutId: c } = t.options;
740
+ window.MotionCancelOptimisedAnimation(i, "transform", E, !(r || c));
741
+ }
742
+ const { parent: n } = t;
743
+ n && !n.hasCheckedOptimisedAppear && ie(n);
744
+ }
745
+ function ne({ attachResizeListener: t, defaultParent: e, measureScroll: i, checkIsScrollRoot: n, resetTransform: r }) {
746
+ return class {
747
+ constructor(s = {}, o = e?.()) {
748
+ this.id = gs++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
749
+ this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
750
+ }, this.updateProjection = () => {
751
+ this.projectionUpdateScheduled = !1, this.nodes.forEach(Ps), this.nodes.forEach(Ss), this.nodes.forEach(As), this.nodes.forEach(Ts);
752
+ }, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = s, this.root = o ? o.root || o : this, this.path = o ? [...o.path, o] : [], this.parent = o, this.depth = o ? o.depth + 1 : 0;
753
+ for (let a = 0; a < this.path.length; a++)
754
+ this.path[a].shouldResetTransform = !0;
755
+ this.root === this && (this.nodes = new ns());
756
+ }
757
+ addEventListener(s, o) {
758
+ return this.eventHandlers.has(s) || this.eventHandlers.set(s, new Ae()), this.eventHandlers.get(s).add(o);
759
+ }
760
+ notifyListeners(s, ...o) {
761
+ const a = this.eventHandlers.get(s);
762
+ a && a.notify(...o);
763
+ }
764
+ hasListeners(s) {
765
+ return this.eventHandlers.has(s);
766
+ }
767
+ /**
768
+ * Lifecycles
769
+ */
770
+ mount(s) {
771
+ if (this.instance)
772
+ return;
773
+ this.isSVG = Xt(s) && !Be(s), this.instance = s;
774
+ const { layoutId: o, layout: a, visualElement: l } = this.options;
775
+ if (l && !l.current && l.mount(s), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (a || o) && (this.isLayoutDirty = !0), t) {
776
+ let h, u = 0;
777
+ const d = () => this.root.updateBlockedByResize = !1;
778
+ E.read(() => {
779
+ u = window.innerWidth;
780
+ }), t(s, () => {
781
+ const f = window.innerWidth;
782
+ f !== u && (u = f, this.root.updateBlockedByResize = !0, h && h(), h = os(d, 250), N.hasAnimatedSinceResize && (N.hasAnimatedSinceResize = !1, this.nodes.forEach(wt)));
783
+ });
784
+ }
785
+ o && this.root.registerSharedNode(o, this), this.options.animate !== !1 && l && (o || a) && this.addEventListener("didUpdate", ({ delta: h, hasLayoutChanged: u, hasRelativeLayoutChanged: d, layout: f }) => {
786
+ if (this.isTreeAnimationBlocked()) {
787
+ this.target = void 0, this.relativeTarget = void 0;
788
+ return;
789
+ }
790
+ const m = this.options.transition || l.getDefaultTransition() || Cs, { onLayoutAnimationStart: x, onLayoutAnimationComplete: p } = l.getProps(), y = !this.targetLayout || !se(this.targetLayout, f), g = !u && d;
791
+ if (this.options.layoutRoot || this.resumeFrom || g || u && (y || !this.currentAnimation)) {
792
+ this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
793
+ const v = {
794
+ ...Le(m, "layout"),
795
+ onPlay: x,
796
+ onComplete: p
797
+ };
798
+ (l.shouldReduceMotion || this.options.layoutRoot) && (v.delay = 0, v.type = !1), this.startAnimation(v), this.setAnimationOrigin(h, g);
799
+ } else
800
+ u || wt(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
801
+ this.targetLayout = f;
802
+ });
803
+ }
804
+ unmount() {
805
+ this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
806
+ const s = this.getStack();
807
+ s && s.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), k(this.updateProjection);
808
+ }
809
+ // only on the root
810
+ blockUpdate() {
811
+ this.updateManuallyBlocked = !0;
812
+ }
813
+ unblockUpdate() {
814
+ this.updateManuallyBlocked = !1;
815
+ }
816
+ isUpdateBlocked() {
817
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
818
+ }
819
+ isTreeAnimationBlocked() {
820
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
821
+ }
822
+ // Note: currently only running on root node
823
+ startUpdate() {
824
+ this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Ls), this.animationId++);
825
+ }
826
+ getTransformTemplate() {
827
+ const { visualElement: s } = this.options;
828
+ return s && s.getProps().transformTemplate;
829
+ }
830
+ willUpdate(s = !0) {
831
+ if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
832
+ this.options.onExitComplete && this.options.onExitComplete();
833
+ return;
834
+ }
835
+ if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && ie(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
836
+ return;
837
+ this.isLayoutDirty = !0;
838
+ for (let h = 0; h < this.path.length; h++) {
839
+ const u = this.path[h];
840
+ u.shouldResetTransform = !0, u.updateScroll("snapshot"), u.options.layoutRoot && u.willUpdate(!1);
841
+ }
842
+ const { layoutId: o, layout: a } = this.options;
843
+ if (o === void 0 && !a)
844
+ return;
845
+ const l = this.getTransformTemplate();
846
+ this.prevTransformTemplateValue = l ? l(this.latestValues, "") : void 0, this.updateSnapshot(), s && this.notifyListeners("willUpdate");
847
+ }
848
+ update() {
849
+ if (this.updateScheduled = !1, this.isUpdateBlocked()) {
850
+ this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Rt);
851
+ return;
852
+ }
853
+ if (this.animationId <= this.animationCommitId) {
854
+ this.nodes.forEach(Ct);
855
+ return;
856
+ }
857
+ this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(Es), this.nodes.forEach(vs), this.nodes.forEach(xs)) : this.nodes.forEach(Ct), this.clearAllSnapshots();
858
+ const o = Ht.now();
859
+ S.delta = Ot(0, 1e3 / 60, o - S.timestamp), S.timestamp = o, S.isProcessing = !0, z.update.process(S), z.preRender.process(S), z.render.process(S), S.isProcessing = !1;
860
+ }
861
+ didUpdate() {
862
+ this.updateScheduled || (this.updateScheduled = !0, Wt.read(this.scheduleUpdate));
863
+ }
864
+ clearAllSnapshots() {
865
+ this.nodes.forEach(Ds), this.sharedNodes.forEach(Vs);
866
+ }
867
+ scheduleUpdateProjection() {
868
+ this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, E.preRender(this.updateProjection, !1, !0));
869
+ }
870
+ scheduleCheckAfterUnmount() {
871
+ E.postRender(() => {
872
+ this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
873
+ });
874
+ }
875
+ /**
876
+ * Update measurements
877
+ */
878
+ updateSnapshot() {
879
+ this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !D(this.snapshot.measuredBox.x) && !D(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
880
+ }
881
+ updateLayout() {
882
+ if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
883
+ return;
884
+ if (this.resumeFrom && !this.resumeFrom.instance)
885
+ for (let a = 0; a < this.path.length; a++)
886
+ this.path[a].updateScroll();
887
+ const s = this.layout;
888
+ this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected = P(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
889
+ const { visualElement: o } = this.options;
890
+ o && o.notify("LayoutMeasure", this.layout.layoutBox, s ? s.layoutBox : void 0);
891
+ }
892
+ updateScroll(s = "measure") {
893
+ let o = !!(this.options.layoutScroll && this.instance);
894
+ if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === s && (o = !1), o && this.instance) {
895
+ const a = n(this.instance);
896
+ this.scroll = {
897
+ animationId: this.root.animationId,
898
+ phase: s,
899
+ isRoot: a,
900
+ offset: i(this.instance),
901
+ wasRoot: this.scroll ? this.scroll.isRoot : a
902
+ };
903
+ }
904
+ }
905
+ resetTransform() {
906
+ if (!r)
907
+ return;
908
+ const s = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, o = this.projectionDelta && !ee(this.projectionDelta), a = this.getTransformTemplate(), l = a ? a(this.latestValues, "") : void 0, h = l !== this.prevTransformTemplateValue;
909
+ s && this.instance && (o || C(this.latestValues) || h) && (r(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender());
910
+ }
911
+ measure(s = !0) {
912
+ const o = this.measurePageBox();
913
+ let a = this.removeElementScroll(o);
914
+ return s && (a = this.removeTransform(a)), ws(a), {
915
+ animationId: this.root.animationId,
916
+ measuredBox: o,
917
+ layoutBox: a,
918
+ latestValues: {},
919
+ source: this.id
920
+ };
921
+ }
922
+ measurePageBox() {
923
+ const { visualElement: s } = this.options;
924
+ if (!s)
925
+ return P();
926
+ const o = s.measureViewportBox();
927
+ if (!(this.scroll?.wasRoot || this.path.some(js))) {
928
+ const { scroll: l } = this.root;
929
+ l && (U(o.x, l.offset.x), U(o.y, l.offset.y));
930
+ }
931
+ return o;
932
+ }
933
+ removeElementScroll(s) {
934
+ const o = P();
935
+ if (L(o, s), this.scroll?.wasRoot)
936
+ return o;
937
+ for (let a = 0; a < this.path.length; a++) {
938
+ const l = this.path[a], { scroll: h, options: u } = l;
939
+ l !== this.root && h && u.layoutScroll && (h.wasRoot && L(o, s), U(o.x, h.offset.x), U(o.y, h.offset.y));
940
+ }
941
+ return o;
942
+ }
943
+ applyTransform(s, o = !1) {
944
+ const a = P();
945
+ L(a, s);
946
+ for (let l = 0; l < this.path.length; l++) {
947
+ const h = this.path[l];
948
+ !o && h.options.layoutScroll && h.scroll && h !== h.root && O(a, {
949
+ x: -h.scroll.offset.x,
950
+ y: -h.scroll.offset.y
951
+ }), C(h.latestValues) && O(a, h.latestValues);
952
+ }
953
+ return C(this.latestValues) && O(a, this.latestValues), a;
954
+ }
955
+ removeTransform(s) {
956
+ const o = P();
957
+ L(o, s);
958
+ for (let a = 0; a < this.path.length; a++) {
959
+ const l = this.path[a];
960
+ if (!l.instance || !C(l.latestValues))
961
+ continue;
962
+ st(l.latestValues) && l.updateSnapshot();
963
+ const h = P(), u = l.measurePageBox();
964
+ L(h, u), Et(o, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, h);
965
+ }
966
+ return C(this.latestValues) && Et(o, this.latestValues), o;
967
+ }
968
+ setTargetDelta(s) {
969
+ this.targetDelta = s, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
970
+ }
971
+ setOptions(s) {
972
+ this.options = {
973
+ ...this.options,
974
+ ...s,
975
+ crossfade: s.crossfade !== void 0 ? s.crossfade : !0
976
+ };
977
+ }
978
+ clearMeasurements() {
979
+ 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;
980
+ }
981
+ forceRelativeParentToResolveTarget() {
982
+ this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== S.timestamp && this.relativeParent.resolveTargetDelta(!0);
983
+ }
984
+ resolveTargetDelta(s = !1) {
985
+ const o = this.getLead();
986
+ this.isProjectionDirty || (this.isProjectionDirty = o.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = o.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = o.isSharedProjectionDirty);
987
+ const a = !!this.resumingFrom || this !== o;
988
+ if (!(s || a && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
989
+ return;
990
+ const { layout: h, layoutId: u } = this.options;
991
+ if (!this.layout || !(h || u))
992
+ return;
993
+ this.resolvedRelativeTargetAt = S.timestamp;
994
+ const d = this.getClosestProjectingParent();
995
+ d && this.linkedParentVersion !== d.layoutVersion && !d.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (d && d.layout ? this.createRelativeTarget(d, this.layout.layoutBox, d.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = P(), this.targetWithTransforms = P()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Ne(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : L(this.target, this.layout.layoutBox), Ve(this.target, this.targetDelta)) : L(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, d && !!d.resumingFrom == !!this.resumingFrom && !d.options.layoutScroll && d.target && this.animationProgress !== 1 ? this.createRelativeTarget(d, this.target, d.target) : this.relativeParent = this.relativeTarget = void 0));
996
+ }
997
+ getClosestProjectingParent() {
998
+ if (!(!this.parent || st(this.parent.latestValues) || be(this.parent.latestValues)))
999
+ return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
1000
+ }
1001
+ isProjecting() {
1002
+ return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
1003
+ }
1004
+ createRelativeTarget(s, o, a) {
1005
+ this.relativeParent = s, this.linkedParentVersion = s.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = P(), this.relativeTargetOrigin = P(), G(this.relativeTargetOrigin, o, a), L(this.relativeTarget, this.relativeTargetOrigin);
1006
+ }
1007
+ removeRelativeTarget() {
1008
+ this.relativeParent = this.relativeTarget = void 0;
1009
+ }
1010
+ calcProjection() {
1011
+ const s = this.getLead(), o = !!this.resumingFrom || this !== s;
1012
+ let a = !0;
1013
+ if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (a = !1), o && (this.isSharedProjectionDirty || this.isTransformDirty) && (a = !1), this.resolvedRelativeTargetAt === S.timestamp && (a = !1), a)
1014
+ return;
1015
+ const { layout: l, layoutId: h } = this.options;
1016
+ if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(l || h))
1017
+ return;
1018
+ L(this.layoutCorrected, this.layout.layoutBox);
1019
+ const u = this.treeScale.x, d = this.treeScale.y;
1020
+ Re(this.layoutCorrected, this.treeScale, this.path, o), s.layout && !s.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (s.target = s.layout.layoutBox, s.targetWithTransforms = P());
1021
+ const { target: f } = s;
1022
+ if (!f) {
1023
+ this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
1024
+ return;
1025
+ }
1026
+ !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (Pt(this.prevProjectionDelta.x, this.projectionDelta.x), Pt(this.prevProjectionDelta.y, this.projectionDelta.y)), B(this.projectionDelta, this.layoutCorrected, f, this.latestValues), (this.treeScale.x !== u || this.treeScale.y !== d || !bt(this.projectionDelta.x, this.prevProjectionDelta.x) || !bt(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", f));
1027
+ }
1028
+ hide() {
1029
+ this.isVisible = !1;
1030
+ }
1031
+ show() {
1032
+ this.isVisible = !0;
1033
+ }
1034
+ scheduleRender(s = !0) {
1035
+ if (this.options.visualElement?.scheduleRender(), s) {
1036
+ const o = this.getStack();
1037
+ o && o.scheduleRender();
1038
+ }
1039
+ this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
1040
+ }
1041
+ createProjectionDeltas() {
1042
+ this.prevProjectionDelta = w(), this.projectionDelta = w(), this.projectionDeltaWithTransform = w();
1043
+ }
1044
+ setAnimationOrigin(s, o = !1) {
1045
+ const a = this.snapshot, l = a ? a.latestValues : {}, h = { ...this.latestValues }, u = w();
1046
+ (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !o;
1047
+ const d = P(), f = a ? a.source : void 0, m = this.layout ? this.layout.source : void 0, x = f !== m, p = this.getStack(), y = !p || p.members.length <= 1, g = !!(x && !y && this.options.crossfade === !0 && !this.path.some(Rs));
1048
+ this.animationProgress = 0;
1049
+ let v;
1050
+ this.mixTargetDelta = (b) => {
1051
+ const R = b / 1e3;
1052
+ jt(u.x, s.x, R), jt(u.y, s.y, R), this.setTargetDelta(u), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (G(d, this.layout.layoutBox, this.relativeParent.layout.layoutBox), bs(this.relativeTarget, this.relativeTargetOrigin, d, R), v && fs(this.relativeTarget, v) && (this.isProjectionDirty = !1), v || (v = P()), L(v, this.relativeTarget)), x && (this.animationValues = h, rs(h, l, this.latestValues, R, g, y)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = R;
1053
+ }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
1054
+ }
1055
+ startAnimation(s) {
1056
+ this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (k(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = E.update(() => {
1057
+ N.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = Gt(0)), this.currentAnimation = ss(this.motionValue, [0, 1e3], {
1058
+ ...s,
1059
+ velocity: 0,
1060
+ isSync: !0,
1061
+ onUpdate: (o) => {
1062
+ this.mixTargetDelta(o), s.onUpdate && s.onUpdate(o);
1063
+ },
1064
+ onStop: () => {
1065
+ },
1066
+ onComplete: () => {
1067
+ s.onComplete && s.onComplete(), this.completeAnimation();
1068
+ }
1069
+ }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
1070
+ });
1071
+ }
1072
+ completeAnimation() {
1073
+ this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
1074
+ const s = this.getStack();
1075
+ s && s.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
1076
+ }
1077
+ finishAnimation() {
1078
+ this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(ys), this.currentAnimation.stop()), this.completeAnimation();
1079
+ }
1080
+ applyTransformsToTarget() {
1081
+ const s = this.getLead();
1082
+ let { targetWithTransforms: o, target: a, layout: l, latestValues: h } = s;
1083
+ if (!(!o || !a || !l)) {
1084
+ if (this !== s && this.layout && l && oe(this.options.animationType, this.layout.layoutBox, l.layoutBox)) {
1085
+ a = this.target || P();
1086
+ const u = D(this.layout.layoutBox.x);
1087
+ a.x.min = s.target.x.min, a.x.max = a.x.min + u;
1088
+ const d = D(this.layout.layoutBox.y);
1089
+ a.y.min = s.target.y.min, a.y.max = a.y.min + d;
1090
+ }
1091
+ L(o, a), O(o, h), B(this.projectionDeltaWithTransform, this.layoutCorrected, o, h);
1092
+ }
1093
+ }
1094
+ registerSharedNode(s, o) {
1095
+ this.sharedNodes.has(s) || this.sharedNodes.set(s, new ms()), this.sharedNodes.get(s).add(o);
1096
+ const l = o.options.initialPromotionConfig;
1097
+ o.promote({
1098
+ transition: l ? l.transition : void 0,
1099
+ preserveFollowOpacity: l && l.shouldPreserveFollowOpacity ? l.shouldPreserveFollowOpacity(o) : void 0
1100
+ });
1101
+ }
1102
+ isLead() {
1103
+ const s = this.getStack();
1104
+ return s ? s.lead === this : !0;
1105
+ }
1106
+ getLead() {
1107
+ const { layoutId: s } = this.options;
1108
+ return s ? this.getStack()?.lead || this : this;
1109
+ }
1110
+ getPrevLead() {
1111
+ const { layoutId: s } = this.options;
1112
+ return s ? this.getStack()?.prevLead : void 0;
1113
+ }
1114
+ getStack() {
1115
+ const { layoutId: s } = this.options;
1116
+ if (s)
1117
+ return this.root.sharedNodes.get(s);
1118
+ }
1119
+ promote({ needsReset: s, transition: o, preserveFollowOpacity: a } = {}) {
1120
+ const l = this.getStack();
1121
+ l && l.promote(this, a), s && (this.projectionDelta = void 0, this.needsReset = !0), o && this.setOptions({ transition: o });
1122
+ }
1123
+ relegate() {
1124
+ const s = this.getStack();
1125
+ return s ? s.relegate(this) : !1;
1126
+ }
1127
+ resetSkewAndRotation() {
1128
+ const { visualElement: s } = this.options;
1129
+ if (!s)
1130
+ return;
1131
+ let o = !1;
1132
+ const { latestValues: a } = s;
1133
+ if ((a.z || a.rotate || a.rotateX || a.rotateY || a.rotateZ || a.skewX || a.skewY) && (o = !0), !o)
1134
+ return;
1135
+ const l = {};
1136
+ a.z && K("z", s, l, this.animationValues);
1137
+ for (let h = 0; h < q.length; h++)
1138
+ K(`rotate${q[h]}`, s, l, this.animationValues), K(`skew${q[h]}`, s, l, this.animationValues);
1139
+ s.render();
1140
+ for (const h in l)
1141
+ s.setStaticValue(h, l[h]), this.animationValues && (this.animationValues[h] = l[h]);
1142
+ s.scheduleRender();
1143
+ }
1144
+ applyProjectionStyles(s, o) {
1145
+ if (!this.instance || this.isSVG)
1146
+ return;
1147
+ if (!this.isVisible) {
1148
+ s.visibility = "hidden";
1149
+ return;
1150
+ }
1151
+ const a = this.getTransformTemplate();
1152
+ if (this.needsReset) {
1153
+ this.needsReset = !1, s.visibility = "", s.opacity = "", s.pointerEvents = $(o?.pointerEvents) || "", s.transform = a ? a(this.latestValues, "") : "none";
1154
+ return;
1155
+ }
1156
+ const l = this.getLead();
1157
+ if (!this.projectionDelta || !this.layout || !l.target) {
1158
+ this.options.layoutId && (s.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, s.pointerEvents = $(o?.pointerEvents) || ""), this.hasProjected && !C(this.latestValues) && (s.transform = a ? a({}, "") : "none", this.hasProjected = !1);
1159
+ return;
1160
+ }
1161
+ s.visibility = "";
1162
+ const h = l.animationValues || l.latestValues;
1163
+ this.applyTransformsToTarget();
1164
+ let u = ps(this.projectionDeltaWithTransform, this.treeScale, h);
1165
+ a && (u = a(h, u)), s.transform = u;
1166
+ const { x: d, y: f } = this.projectionDelta;
1167
+ s.transformOrigin = `${d.origin * 100}% ${f.origin * 100}% 0`, l.animationValues ? s.opacity = l === this ? h.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : h.opacityExit : s.opacity = l === this ? h.opacity !== void 0 ? h.opacity : "" : h.opacityExit !== void 0 ? h.opacityExit : 0;
1168
+ for (const m in it) {
1169
+ if (h[m] === void 0)
1170
+ continue;
1171
+ const { correct: x, applyTo: p, isCSSVariable: y } = it[m], g = u === "none" ? h[m] : x(h[m], l);
1172
+ if (p) {
1173
+ const v = p.length;
1174
+ for (let b = 0; b < v; b++)
1175
+ s[p[b]] = g;
1176
+ } else
1177
+ y ? this.options.visualElement.renderState.vars[m] = g : s[m] = g;
1178
+ }
1179
+ this.options.layoutId && (s.pointerEvents = l === this ? $(o?.pointerEvents) || "" : "none");
1180
+ }
1181
+ clearSnapshot() {
1182
+ this.resumeFrom = this.snapshot = void 0;
1183
+ }
1184
+ // Only run on root
1185
+ resetTree() {
1186
+ this.root.nodes.forEach((s) => s.currentAnimation?.stop()), this.root.nodes.forEach(Rt), this.root.sharedNodes.clear();
1187
+ }
1188
+ };
1189
+ }
1190
+ function vs(t) {
1191
+ t.updateLayout();
1192
+ }
1193
+ function xs(t) {
1194
+ const e = t.resumeFrom?.snapshot || t.snapshot;
1195
+ if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
1196
+ const { layoutBox: i, measuredBox: n } = t.layout, { animationType: r } = t.options, c = e.source !== t.layout.source;
1197
+ r === "size" ? A((h) => {
1198
+ const u = c ? e.measuredBox[h] : e.layoutBox[h], d = D(u);
1199
+ u.min = i[h].min, u.max = u.min + d;
1200
+ }) : oe(r, e.layoutBox, i) && A((h) => {
1201
+ const u = c ? e.measuredBox[h] : e.layoutBox[h], d = D(i[h]);
1202
+ u.max = u.min + d, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[h].max = t.relativeTarget[h].min + d);
1203
+ });
1204
+ const s = w();
1205
+ B(s, i, e.layoutBox);
1206
+ const o = w();
1207
+ c ? B(o, t.applyTransform(n, !0), e.measuredBox) : B(o, i, e.layoutBox);
1208
+ const a = !ee(s);
1209
+ let l = !1;
1210
+ if (!t.resumeFrom) {
1211
+ const h = t.getClosestProjectingParent();
1212
+ if (h && !h.resumeFrom) {
1213
+ const { snapshot: u, layout: d } = h;
1214
+ if (u && d) {
1215
+ const f = P();
1216
+ G(f, e.layoutBox, u.layoutBox);
1217
+ const m = P();
1218
+ G(m, i, d.layoutBox), se(f, m) || (l = !0), h.options.layoutRoot && (t.relativeTarget = m, t.relativeTargetOrigin = f, t.relativeParent = h);
1219
+ }
1220
+ }
1221
+ }
1222
+ t.notifyListeners("didUpdate", {
1223
+ layout: i,
1224
+ snapshot: e,
1225
+ delta: o,
1226
+ layoutDelta: s,
1227
+ hasLayoutChanged: a,
1228
+ hasRelativeLayoutChanged: l
1229
+ });
1230
+ } else if (t.isLead()) {
1231
+ const { onExitComplete: i } = t.options;
1232
+ i && i();
1233
+ }
1234
+ t.options.transition = void 0;
1235
+ }
1236
+ function Ps(t) {
1237
+ t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
1238
+ }
1239
+ function Ts(t) {
1240
+ t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
1241
+ }
1242
+ function Ds(t) {
1243
+ t.clearSnapshot();
1244
+ }
1245
+ function Rt(t) {
1246
+ t.clearMeasurements();
1247
+ }
1248
+ function Ct(t) {
1249
+ t.isLayoutDirty = !1;
1250
+ }
1251
+ function Es(t) {
1252
+ const { visualElement: e } = t.options;
1253
+ e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
1254
+ }
1255
+ function wt(t) {
1256
+ t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
1257
+ }
1258
+ function Ss(t) {
1259
+ t.resolveTargetDelta();
1260
+ }
1261
+ function As(t) {
1262
+ t.calcProjection();
1263
+ }
1264
+ function Ls(t) {
1265
+ t.resetSkewAndRotation();
1266
+ }
1267
+ function Vs(t) {
1268
+ t.removeLeadSnapshot();
1269
+ }
1270
+ function jt(t, e, i) {
1271
+ t.translate = T(e.translate, 0, i), t.scale = T(e.scale, 1, i), t.origin = e.origin, t.originPoint = e.originPoint;
1272
+ }
1273
+ function Mt(t, e, i, n) {
1274
+ t.min = T(e.min, i.min, n), t.max = T(e.max, i.max, n);
1275
+ }
1276
+ function bs(t, e, i, n) {
1277
+ Mt(t.x, e.x, i.x, n), Mt(t.y, e.y, i.y, n);
1278
+ }
1279
+ function Rs(t) {
1280
+ return t.animationValues && t.animationValues.opacityExit !== void 0;
1281
+ }
1282
+ const Cs = {
1283
+ duration: 0.45,
1284
+ ease: [0.4, 0, 0.1, 1]
1285
+ }, Bt = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), kt = Bt("applewebkit/") && !Bt("chrome/") ? Math.round : j;
1286
+ function It(t) {
1287
+ t.min = kt(t.min), t.max = kt(t.max);
1288
+ }
1289
+ function ws(t) {
1290
+ It(t.x), It(t.y);
1291
+ }
1292
+ function oe(t, e, i) {
1293
+ return t === "position" || t === "preserve-aspect" && !Fe(Vt(e), Vt(i), 0.2);
1294
+ }
1295
+ function js(t) {
1296
+ return t !== t.root && t.scroll?.wasRoot;
1297
+ }
1298
+ const Ms = ne({
1299
+ attachResizeListener: (t, e) => Q(t, "resize", e),
1300
+ measureScroll: () => ({
1301
+ x: document.documentElement.scrollLeft || document.body.scrollLeft,
1302
+ y: document.documentElement.scrollTop || document.body.scrollTop
1303
+ }),
1304
+ checkIsScrollRoot: () => !0
1305
+ }), _ = {
1306
+ current: void 0
1307
+ }, ae = ne({
1308
+ measureScroll: (t) => ({
1309
+ x: t.scrollLeft,
1310
+ y: t.scrollTop
1311
+ }),
1312
+ defaultParent: () => {
1313
+ if (!_.current) {
1314
+ const t = new Ms({});
1315
+ t.mount(window), t.setOptions({ layoutScroll: !0 }), _.current = t;
1316
+ }
1317
+ return _.current;
1318
+ },
1319
+ resetTransform: (t, e) => {
1320
+ t.style.transform = e !== void 0 ? e : "none";
1321
+ },
1322
+ checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
1323
+ }), Bs = {
1324
+ pan: {
1325
+ Feature: ts
1326
+ },
1327
+ drag: {
1328
+ Feature: Qe,
1329
+ ProjectionNode: ae,
1330
+ MeasureLayout: Jt
1331
+ }
1332
+ }, ks = {
1333
+ layout: {
1334
+ ProjectionNode: ae,
1335
+ MeasureLayout: Jt
1336
+ }
1337
+ }, Fs = {
1338
+ ...we,
1339
+ ...Bs,
1340
+ ...ks
1341
+ };
1342
+ export {
1343
+ Gs as AnimatePresence,
1344
+ zs as AsyncMotionValueAnimation,
1345
+ $s as DOMKeyframesResolver,
1346
+ Hs as DeprecatedLayoutGroupContext,
1347
+ Xs as JSAnimation,
1348
+ Ys as KeyframeResolver,
1349
+ qs as LayoutGroup,
1350
+ xe as LayoutGroupContext,
1351
+ Ks as LazyMotion,
1352
+ _s as MotionConfig,
1353
+ Zs as MotionConfigContext,
1354
+ Js as MotionContext,
1355
+ Qs as MotionGlobalConfig,
1356
+ ti as MotionValue,
1357
+ ei as NativeAnimation,
1358
+ si as NativeAnimationExtended,
1359
+ ii as PopChild,
1360
+ ni as PresenceChild,
1361
+ oi as PresenceContext,
1362
+ Ae as SubscriptionManager,
1363
+ Te as SwitchLayoutGroupContext,
1364
+ ai as VisualElement,
1365
+ ri as WillChangeMotionValue,
1366
+ li as acceleratedValues,
1367
+ M as addPointerEvent,
1368
+ le as addPointerInfo,
1369
+ zt as addUniqueItem,
1370
+ hi as alpha,
1371
+ ci as analyseComplexValue,
1372
+ ui as animateVisualElement,
1373
+ di as animations,
1374
+ fi as anticipate,
1375
+ mi as applyGeneratorOptions,
1376
+ pi as backIn,
1377
+ yi as backInOut,
1378
+ gi as backOut,
1379
+ vi as buildTransform,
1380
+ xi as calcGeneratorDuration,
1381
+ D as calcLength,
1382
+ k as cancelFrame,
1383
+ Pi as circIn,
1384
+ Ti as circInOut,
1385
+ Se as circOut,
1386
+ Ot as clamp,
1387
+ Di as color,
1388
+ Ei as complex,
1389
+ Si as containsCSSVariable,
1390
+ Ai as convertOffsetToTimes,
1391
+ P as createBox,
1392
+ Li as createGeneratorEasing,
1393
+ Vi as createRenderBatcher,
1394
+ bi as cubicBezier,
1395
+ Ri as cubicBezierAsString,
1396
+ Ci as defaultEasing,
1397
+ wi as defaultOffset,
1398
+ ji as defaultTransformValue,
1399
+ Mi as defaultValueTypes,
1400
+ Bi as degrees,
1401
+ os as delay,
1402
+ ki as dimensionValueTypes,
1403
+ lt as distance,
1404
+ We as distance2D,
1405
+ we as domAnimation,
1406
+ Fs as domMax,
1407
+ Ii as easeIn,
1408
+ Ui as easeInOut,
1409
+ Oi as easeOut,
1410
+ Fi as easingDefinitionToFunction,
1411
+ Ni as fillOffset,
1412
+ Wi as fillWildcards,
1413
+ Gi as filterProps,
1414
+ zi as findDimensionValueType,
1415
+ $i as findValueType,
1416
+ Hi as flushKeyframeResolvers,
1417
+ E as frame,
1418
+ S as frameData,
1419
+ z as frameSteps,
1420
+ Xi as generateLinearEasing,
1421
+ Yi as getAnimatableNone,
1422
+ qi as getDefaultValueType,
1423
+ Ki as getMixer,
1424
+ _i as getValueAsType,
1425
+ Le as getValueTransition,
1426
+ Zi as getVariableValue,
1427
+ Ji as hex,
1428
+ Qi as hover,
1429
+ tn as hsla,
1430
+ en as hslaToRgba,
1431
+ sn as inertia,
1432
+ nn as interpolate,
1433
+ ye as invariant,
1434
+ on as invisibleValues,
1435
+ an as isBezierDefinition,
1436
+ rn as isBrowser,
1437
+ ln as isCSSVariableName,
1438
+ hn as isCSSVariableToken,
1439
+ cn as isDragActive,
1440
+ V as isDragging,
1441
+ un as isEasingArray,
1442
+ ge as isElementKeyboardAccessible,
1443
+ dn as isGenerator,
1444
+ fn as isHTMLElement,
1445
+ De as isMotionValue,
1446
+ mn as isNodeOrChild,
1447
+ pn as isNumericalString,
1448
+ re as isObject,
1449
+ he as isPrimaryPointer,
1450
+ Xt as isSVGElement,
1451
+ Be as isSVGSVGElement,
1452
+ yn as isValidMotionProp,
1453
+ gn as isZeroValueString,
1454
+ vn as keyframes,
1455
+ xn as m,
1456
+ Pn as makeAnimationInstant,
1457
+ Tn as makeUseVisualState,
1458
+ Dn as mapEasingToNativeEasing,
1459
+ En as maxGeneratorDuration,
1460
+ Sn as memo,
1461
+ Wt as microtask,
1462
+ de as millisecondsToSeconds,
1463
+ An as mirrorEasing,
1464
+ Ln as mix,
1465
+ Vn as mixArray,
1466
+ bn as mixColor,
1467
+ Rn as mixComplex,
1468
+ Cn as mixImmediate,
1469
+ wn as mixLinearColor,
1470
+ T as mixNumber,
1471
+ jn as mixObject,
1472
+ Mn as mixVisibility,
1473
+ Gt as motionValue,
1474
+ j as noop,
1475
+ Bn as number,
1476
+ kn as numberValueTypes,
1477
+ In as optimizedAppearDataAttribute,
1478
+ Un as parseCSSVariable,
1479
+ On as parseValueFromTransform,
1480
+ W as percent,
1481
+ ce as pipe,
1482
+ Fn as positionalKeys,
1483
+ Nn as press,
1484
+ Z as progress,
1485
+ Wn as progressPercentage,
1486
+ Ee as px,
1487
+ Gn as readTransformValue,
1488
+ $t as removeItem,
1489
+ zn as resolveElements,
1490
+ $ as resolveMotionValue,
1491
+ $n as reverseEasing,
1492
+ Hn as rgbUnit,
1493
+ Xn as rgba,
1494
+ Yn as scale,
1495
+ ue as secondsToMilliseconds,
1496
+ Me as setDragLock,
1497
+ qn as setStyle,
1498
+ Kn as spring,
1499
+ _n as startWaapiAnimation,
1500
+ Zn as supportedWaapiEasing,
1501
+ Jn as supportsBrowserAnimation,
1502
+ Qn as supportsFlags,
1503
+ to as supportsLinearEasing,
1504
+ eo as supportsScrollTimeline,
1505
+ so as testValueType,
1506
+ Ht as time,
1507
+ io as transformPropOrder,
1508
+ no as transformProps,
1509
+ oo as transformValueTypes,
1510
+ ao as useComposedRefs,
1511
+ ro as useForceUpdate,
1512
+ lo as useIsomorphicLayoutEffect,
1513
+ ve as usePresence,
1514
+ ho as useWillChange,
1515
+ co as velocityPerSecond,
1516
+ uo as vh,
1517
+ fo as visualElementStore,
1518
+ mo as vw,
1519
+ po as warnOnce,
1520
+ yo as warning
1521
+ };