@g4rcez/components 3.0.1 → 3.0.2

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.
Files changed (141) hide show
  1. package/dist/MotionConfigContext-C7MqlSdv.js +2713 -0
  2. package/dist/MotionConfigContext-C7MqlSdv.js.map +1 -0
  3. package/dist/autocomplete-Boida9R7.js +375 -0
  4. package/dist/autocomplete-Boida9R7.js.map +1 -0
  5. package/dist/calendar-BswV66Nx.js +1719 -0
  6. package/dist/calendar-BswV66Nx.js.map +1 -0
  7. package/dist/chevron-down-BBFYYzZq.js +6 -0
  8. package/dist/chevron-down-BBFYYzZq.js.map +1 -0
  9. package/dist/chevron-right-DvXGOiS_.js +6 -0
  10. package/dist/chevron-right-DvXGOiS_.js.map +1 -0
  11. package/dist/circle-check-big-3M5lhTxx.js +9 -0
  12. package/dist/circle-check-big-3M5lhTxx.js.map +1 -0
  13. package/dist/components/core/button.js +76 -0
  14. package/dist/components/core/button.js.map +1 -0
  15. package/dist/components/core/tag.js +67 -0
  16. package/dist/components/core/tag.js.map +1 -0
  17. package/dist/components/display/alert.js +94 -0
  18. package/dist/components/display/alert.js.map +1 -0
  19. package/dist/components/display/calendar.js +15 -0
  20. package/dist/components/display/calendar.js.map +1 -0
  21. package/dist/components/display/card.js +84 -0
  22. package/dist/components/display/card.js.map +1 -0
  23. package/dist/components/display/list.js +93 -0
  24. package/dist/components/display/list.js.map +1 -0
  25. package/dist/components/display/notifications.js +15 -0
  26. package/dist/components/display/notifications.js.map +1 -0
  27. package/dist/components/display/stats.js +16 -0
  28. package/dist/components/display/stats.js.map +1 -0
  29. package/dist/components/display/tabs.js +12 -0
  30. package/dist/components/display/tabs.js.map +1 -0
  31. package/dist/components/display/timeline.js +29 -0
  32. package/dist/components/display/timeline.js.map +1 -0
  33. package/dist/components/floating/dropdown.js +58 -0
  34. package/dist/components/floating/dropdown.js.map +1 -0
  35. package/dist/components/floating/expand.js +41 -0
  36. package/dist/components/floating/expand.js.map +1 -0
  37. package/dist/components/floating/menu.js +177 -0
  38. package/dist/components/floating/menu.js.map +1 -0
  39. package/dist/components/floating/modal.js +297 -0
  40. package/dist/components/floating/modal.js.map +1 -0
  41. package/dist/components/floating/tooltip.js +73 -0
  42. package/dist/components/floating/tooltip.js.map +1 -0
  43. package/dist/components/form/autocomplete.js +16 -0
  44. package/dist/components/form/autocomplete.js.map +1 -0
  45. package/dist/components/form/checkbox.js +44 -0
  46. package/dist/components/form/checkbox.js.map +1 -0
  47. package/dist/components/form/date-picker.js +12 -0
  48. package/dist/components/form/date-picker.js.map +1 -0
  49. package/dist/components/form/file-upload.js +11 -0
  50. package/dist/components/form/file-upload.js.map +1 -0
  51. package/dist/components/form/form.js +8 -0
  52. package/dist/components/form/form.js.map +1 -0
  53. package/dist/components/form/input.js +5 -0
  54. package/dist/components/form/input.js.map +1 -0
  55. package/dist/components/form/radiobox.js +30 -0
  56. package/dist/components/form/radiobox.js.map +1 -0
  57. package/dist/components/form/select.js +106 -0
  58. package/dist/components/form/select.js.map +1 -0
  59. package/dist/components/form/switch.js +65 -0
  60. package/dist/components/form/switch.js.map +1 -0
  61. package/dist/components/form/task-list.js +68 -0
  62. package/dist/components/form/task-list.js.map +1 -0
  63. package/dist/components/form/transfer-list.js +55 -0
  64. package/dist/components/form/transfer-list.js.map +1 -0
  65. package/dist/components/table/table.js +10 -0
  66. package/dist/components/table/table.js.map +1 -0
  67. package/dist/constants-r-AHn273.js +6 -0
  68. package/dist/constants-r-AHn273.js.map +1 -0
  69. package/dist/context-BFXNJVn2.js +161 -0
  70. package/dist/context-BFXNJVn2.js.map +1 -0
  71. package/dist/createLucideIcon-CP-mMPfa.js +76 -0
  72. package/dist/createLucideIcon-CP-mMPfa.js.map +1 -0
  73. package/dist/date-picker-BxPTdZPy.js +1598 -0
  74. package/dist/date-picker-BxPTdZPy.js.map +1 -0
  75. package/dist/dom-Dl8XH0CK.js +2833 -0
  76. package/dist/dom-Dl8XH0CK.js.map +1 -0
  77. package/dist/file-CBCP85VI.js +15 -0
  78. package/dist/file-CBCP85VI.js.map +1 -0
  79. package/dist/file-upload-BB6BdGcE.js +3118 -0
  80. package/dist/file-upload-BB6BdGcE.js.map +1 -0
  81. package/dist/floating-ui.react-DycKASR0.js +3706 -0
  82. package/dist/floating-ui.react-DycKASR0.js.map +1 -0
  83. package/dist/fns-D2eyJKd5.js +33 -0
  84. package/dist/fns-D2eyJKd5.js.map +1 -0
  85. package/dist/index-0YMC-_Lt.js +20 -0
  86. package/dist/index-0YMC-_Lt.js.map +1 -0
  87. package/dist/index-BJ1ayTam.js +126 -0
  88. package/dist/index-BJ1ayTam.js.map +1 -0
  89. package/dist/index-BtlhELJ3.js +3416 -0
  90. package/dist/index-BtlhELJ3.js.map +1 -0
  91. package/dist/index-ChfR6F8d.js +1590 -0
  92. package/dist/index-ChfR6F8d.js.map +1 -0
  93. package/dist/index-DE4shK8D.js +215 -0
  94. package/dist/index-DE4shK8D.js.map +1 -0
  95. package/dist/index-DJSMaZR4.js +35 -0
  96. package/dist/index-DJSMaZR4.js.map +1 -0
  97. package/dist/index-t1qLJTt5.js +351 -0
  98. package/dist/index-t1qLJTt5.js.map +1 -0
  99. package/dist/index.esm-BaIwleSE.js +343 -0
  100. package/dist/index.esm-BaIwleSE.js.map +1 -0
  101. package/dist/index.js +8049 -27
  102. package/dist/index.js.map +1 -1
  103. package/dist/info-N5jWZg2A.js +10 -0
  104. package/dist/info-N5jWZg2A.js.map +1 -0
  105. package/dist/input-CoJoHIhd.js +441 -0
  106. package/dist/input-CoJoHIhd.js.map +1 -0
  107. package/dist/input-field-DTeIrwpK.js +146 -0
  108. package/dist/input-field-DTeIrwpK.js.map +1 -0
  109. package/dist/notifications-NPuFDsBp.js +2550 -0
  110. package/dist/notifications-NPuFDsBp.js.map +1 -0
  111. package/dist/polymorph-B5n9fs_K.js +10 -0
  112. package/dist/polymorph-B5n9fs_K.js.map +1 -0
  113. package/dist/proxy-BZcQiBrp.js +2495 -0
  114. package/dist/proxy-BZcQiBrp.js.map +1 -0
  115. package/dist/skeleton-D75GFBV6.js +10 -0
  116. package/dist/skeleton-D75GFBV6.js.map +1 -0
  117. package/dist/slot-CQW8ZzBb.js +79 -0
  118. package/dist/slot-CQW8ZzBb.js.map +1 -0
  119. package/dist/styles/common.js +29 -0
  120. package/dist/styles/dark.js +214 -0
  121. package/dist/styles/design-tokens.js +98 -0
  122. package/dist/styles/light.js +214 -0
  123. package/dist/styles/theme.js +4 -0
  124. package/dist/styles/theme.types.js +1 -0
  125. package/dist/tabs-ccIA7vMo.js +106 -0
  126. package/dist/tabs-ccIA7vMo.js.map +1 -0
  127. package/dist/triangle-alert-CHMhQ6yd.js +16 -0
  128. package/dist/triangle-alert-CHMhQ6yd.js.map +1 -0
  129. package/dist/use-motion-value-eGwNuWuw.js +14 -0
  130. package/dist/use-motion-value-eGwNuWuw.js.map +1 -0
  131. package/dist/use-stable-ref-CYh-YkID.js +11 -0
  132. package/dist/use-stable-ref-CYh-YkID.js.map +1 -0
  133. package/dist/use-translations-BwLKTrZv.js +10 -0
  134. package/dist/use-translations-BwLKTrZv.js.map +1 -0
  135. package/dist/x-B9bYxG31.js +9 -0
  136. package/dist/x-B9bYxG31.js.map +1 -0
  137. package/package.json +3 -4
  138. package/dist/index.mjs +0 -37108
  139. package/dist/index.mjs.map +0 -1
  140. package/dist/index.umd.js +0 -28
  141. package/dist/index.umd.js.map +0 -1
@@ -0,0 +1,2495 @@
1
+ import { jsx as N, Fragment as $n, jsxs as Xn } from "react/jsx-runtime";
2
+ import * as Pt from "react";
3
+ import { createContext as nt, useLayoutEffect as Yn, useEffect as Wt, useId as Ht, useRef as j, useContext as C, useInsertionEffect as Nt, useMemo as z, useCallback as qe, Children as _n, isValidElement as Kn, useState as Qt, Fragment as Ze, createElement as qn, forwardRef as Zn, Component as Jn } from "react";
4
+ import { G as Z, x as Je, I as Qn, r as Qe, o as tn, J as pt, K as en, L as zt, N as te, O as nn, m as D, P as gt, Q as ee, R as ti, n as jt, T as K, U as ei, W as sn, b as It, X as on, C as A, D as tt, d as Gt, Y as ni, q as ii, Z as si, _ as rn, $ as R, a0 as St, a1 as an, c as E, a2 as $, a3 as ot, a4 as rt, a5 as ne, a6 as oi, a7 as ri, a8 as ai, a9 as Y, y as li, t as ci, aa as ie, ab as ui, M as $t, u as Xt, ac as hi, ad as ln, ae as cn, af as fi, ag as di, ah as mi, ai as pi, aj as gi, ak as yi, al as vi, am as Pi, an as xi, ao as wi, l as un, w as Ti, S as Si, H as Ei, ap as hn, s as se, aq as Di, ar as Ai, as as Ci, at as Li, au as oe, av as Vi } from "./MotionConfigContext-C7MqlSdv.js";
5
+ const Yt = nt({}), fn = typeof window < "u", dn = fn ? Yn : Wt, xt = /* @__PURE__ */ nt(null);
6
+ function mn(t, e, n, i = 0, o = 1) {
7
+ const a = Array.from(t).sort((c, u) => c.sortNodePosition(u)).indexOf(e), s = t.size, r = (s - 1) * i;
8
+ return typeof n == "function" ? n(a, s) : o === 1 ? a * i : r - a * i;
9
+ }
10
+ function Bt(t, e, n = {}) {
11
+ const i = Z(t, e, n.type === "exit" ? t.presenceContext?.custom : void 0);
12
+ let { transition: o = t.getDefaultTransition() || {} } = i || {};
13
+ n.transitionOverride && (o = n.transitionOverride);
14
+ const a = i ? () => Promise.all(Je(t, i, n)) : () => Promise.resolve(), s = t.variantChildren && t.variantChildren.size ? (l = 0) => {
15
+ const { delayChildren: c = 0, staggerChildren: u, staggerDirection: f } = o;
16
+ return Ri(t, e, l, c, u, f, n);
17
+ } : () => Promise.resolve(), { when: r } = o;
18
+ if (r) {
19
+ const [l, c] = r === "beforeChildren" ? [a, s] : [s, a];
20
+ return l().then(() => c());
21
+ } else
22
+ return Promise.all([a(), s(n.delay)]);
23
+ }
24
+ function Ri(t, e, n = 0, i = 0, o = 0, a = 1, s) {
25
+ const r = [];
26
+ for (const l of t.variantChildren)
27
+ l.notify("AnimationStart", e), r.push(Bt(l, e, {
28
+ ...s,
29
+ delay: n + (typeof i == "function" ? 0 : i) + mn(t.variantChildren, l, i, o, a)
30
+ }).then(() => l.notify("AnimationComplete", e)));
31
+ return Promise.all(r);
32
+ }
33
+ function bi(t, e, n = {}) {
34
+ t.notify("AnimationStart", e);
35
+ let i;
36
+ if (Array.isArray(e)) {
37
+ const o = e.map((a) => Bt(t, a, n));
38
+ i = Promise.all(o);
39
+ } else if (typeof e == "string")
40
+ i = Bt(t, e, n);
41
+ else {
42
+ const o = typeof e == "function" ? Z(t, e, n.custom) : e;
43
+ i = Promise.all(Je(t, o, n));
44
+ }
45
+ return i.then(() => {
46
+ t.notify("AnimationComplete", e);
47
+ });
48
+ }
49
+ function Ot(t) {
50
+ return Qn(t) && "offsetHeight" in t;
51
+ }
52
+ const k = {
53
+ x: !1,
54
+ y: !1
55
+ };
56
+ function pn() {
57
+ return k.x || k.y;
58
+ }
59
+ function Mi(t) {
60
+ return t === "x" || t === "y" ? k[t] ? null : (k[t] = !0, () => {
61
+ k[t] = !1;
62
+ }) : k.x || k.y ? null : (k.x = k.y = !0, () => {
63
+ k.x = k.y = !1;
64
+ });
65
+ }
66
+ function gn(t, e) {
67
+ const n = Qe(t), i = new AbortController(), o = {
68
+ passive: !0,
69
+ ...e,
70
+ signal: i.signal
71
+ };
72
+ return [n, o, () => i.abort()];
73
+ }
74
+ function ki(t) {
75
+ return !(t.pointerType === "touch" || pn());
76
+ }
77
+ function ji(t, e, n = {}) {
78
+ const [i, o, a] = gn(t, n);
79
+ return i.forEach((s) => {
80
+ let r = !1, l = !1, c;
81
+ const u = () => {
82
+ s.removeEventListener("pointerleave", m);
83
+ }, f = (g) => {
84
+ c && (c(g), c = void 0), u();
85
+ }, h = (g) => {
86
+ r = !1, window.removeEventListener("pointerup", h), window.removeEventListener("pointercancel", h), l && (l = !1, f(g));
87
+ }, d = () => {
88
+ r = !0, window.addEventListener("pointerup", h, o), window.addEventListener("pointercancel", h, o);
89
+ }, m = (g) => {
90
+ if (g.pointerType !== "touch") {
91
+ if (r) {
92
+ l = !0;
93
+ return;
94
+ }
95
+ f(g);
96
+ }
97
+ }, P = (g) => {
98
+ if (!ki(g))
99
+ return;
100
+ l = !1;
101
+ const p = e(s, g);
102
+ typeof p == "function" && (c = p, s.addEventListener("pointerleave", m, o));
103
+ };
104
+ s.addEventListener("pointerenter", P, o), s.addEventListener("pointerdown", d, o);
105
+ }), a;
106
+ }
107
+ const yn = (t, e) => e ? t === e ? !0 : yn(t, e.parentElement) : !1, _t = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Ii = /* @__PURE__ */ new Set([
108
+ "BUTTON",
109
+ "INPUT",
110
+ "SELECT",
111
+ "TEXTAREA",
112
+ "A"
113
+ ]);
114
+ function Bi(t) {
115
+ return Ii.has(t.tagName) || t.isContentEditable === !0;
116
+ }
117
+ const Oi = /* @__PURE__ */ new Set(["INPUT", "SELECT", "TEXTAREA"]);
118
+ function Fi(t) {
119
+ return Oi.has(t.tagName) || t.isContentEditable === !0;
120
+ }
121
+ const ct = /* @__PURE__ */ new WeakSet();
122
+ function re(t) {
123
+ return (e) => {
124
+ e.key === "Enter" && t(e);
125
+ };
126
+ }
127
+ function Et(t, e) {
128
+ t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
129
+ }
130
+ const Ui = (t, e) => {
131
+ const n = t.currentTarget;
132
+ if (!n)
133
+ return;
134
+ const i = re(() => {
135
+ if (ct.has(n))
136
+ return;
137
+ Et(n, "down");
138
+ const o = re(() => {
139
+ Et(n, "up");
140
+ }), a = () => Et(n, "cancel");
141
+ n.addEventListener("keyup", o, e), n.addEventListener("blur", a, e);
142
+ });
143
+ n.addEventListener("keydown", i, e), n.addEventListener("blur", () => n.removeEventListener("keydown", i), e);
144
+ };
145
+ function ae(t) {
146
+ return _t(t) && !pn();
147
+ }
148
+ const le = /* @__PURE__ */ new WeakSet();
149
+ function Wi(t, e, n = {}) {
150
+ const [i, o, a] = gn(t, n), s = (r) => {
151
+ const l = r.currentTarget;
152
+ if (!ae(r) || le.has(r))
153
+ return;
154
+ ct.add(l), n.stopPropagation && le.add(r);
155
+ const c = e(l, r), u = (d, m) => {
156
+ window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", h), ct.has(l) && ct.delete(l), ae(d) && typeof c == "function" && c(d, { success: m });
157
+ }, f = (d) => {
158
+ u(d, l === window || l === document || n.useGlobalTarget || yn(l, d.target));
159
+ }, h = (d) => {
160
+ u(d, !1);
161
+ };
162
+ window.addEventListener("pointerup", f, o), window.addEventListener("pointercancel", h, o);
163
+ };
164
+ return i.forEach((r) => {
165
+ (n.useGlobalTarget ? window : r).addEventListener("pointerdown", s, o), Ot(r) && (r.addEventListener("focus", (c) => Ui(c, o)), !Bi(r) && !r.hasAttribute("tabindex") && (r.tabIndex = 0));
166
+ }), a;
167
+ }
168
+ const ut = /* @__PURE__ */ new WeakMap();
169
+ let ht;
170
+ const vn = (t, e, n) => (i, o) => o && o[0] ? o[0][t + "Size"] : tn(i) && "getBBox" in i ? i.getBBox()[e] : i[n], Hi = /* @__PURE__ */ vn("inline", "width", "offsetWidth"), Ni = /* @__PURE__ */ vn("block", "height", "offsetHeight");
171
+ function zi({ target: t, borderBoxSize: e }) {
172
+ ut.get(t)?.forEach((n) => {
173
+ n(t, {
174
+ get width() {
175
+ return Hi(t, e);
176
+ },
177
+ get height() {
178
+ return Ni(t, e);
179
+ }
180
+ });
181
+ });
182
+ }
183
+ function Gi(t) {
184
+ t.forEach(zi);
185
+ }
186
+ function $i() {
187
+ typeof ResizeObserver > "u" || (ht = new ResizeObserver(Gi));
188
+ }
189
+ function Xi(t, e) {
190
+ ht || $i();
191
+ const n = Qe(t);
192
+ return n.forEach((i) => {
193
+ let o = ut.get(i);
194
+ o || (o = /* @__PURE__ */ new Set(), ut.set(i, o)), o.add(e), ht?.observe(i);
195
+ }), () => {
196
+ n.forEach((i) => {
197
+ const o = ut.get(i);
198
+ o?.delete(e), o?.size || ht?.unobserve(i);
199
+ });
200
+ };
201
+ }
202
+ const ft = /* @__PURE__ */ new Set();
203
+ let _;
204
+ function Yi() {
205
+ _ = () => {
206
+ const t = {
207
+ get width() {
208
+ return window.innerWidth;
209
+ },
210
+ get height() {
211
+ return window.innerHeight;
212
+ }
213
+ };
214
+ ft.forEach((e) => e(t));
215
+ }, window.addEventListener("resize", _);
216
+ }
217
+ function _i(t) {
218
+ return ft.add(t), _ || Yi(), () => {
219
+ ft.delete(t), !ft.size && typeof _ == "function" && (window.removeEventListener("resize", _), _ = void 0);
220
+ };
221
+ }
222
+ function ce(t, e) {
223
+ return typeof t == "function" ? _i(t) : Xi(t, e);
224
+ }
225
+ class U {
226
+ constructor(e) {
227
+ this.isMounted = !1, this.node = e;
228
+ }
229
+ update() {
230
+ }
231
+ }
232
+ const Ki = en.length;
233
+ function Pn(t) {
234
+ if (!t)
235
+ return;
236
+ if (!t.isControllingVariants) {
237
+ const n = t.parent ? Pn(t.parent) || {} : {};
238
+ return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
239
+ }
240
+ const e = {};
241
+ for (let n = 0; n < Ki; n++) {
242
+ const i = en[n], o = t.props[i];
243
+ (pt(o) || o === !1) && (e[i] = o);
244
+ }
245
+ return e;
246
+ }
247
+ function xn(t, e) {
248
+ if (!Array.isArray(e))
249
+ return !1;
250
+ const n = e.length;
251
+ if (n !== t.length)
252
+ return !1;
253
+ for (let i = 0; i < n; i++)
254
+ if (e[i] !== t[i])
255
+ return !1;
256
+ return !0;
257
+ }
258
+ const qi = [...nn].reverse(), Zi = nn.length;
259
+ function Ji(t) {
260
+ return (e) => Promise.all(e.map(({ animation: n, options: i }) => bi(t, n, i)));
261
+ }
262
+ function Qi(t) {
263
+ let e = Ji(t), n = ue(), i = !0;
264
+ const o = (l) => (c, u) => {
265
+ const f = Z(t, u, l === "exit" ? t.presenceContext?.custom : void 0);
266
+ if (f) {
267
+ const { transition: h, transitionEnd: d, ...m } = f;
268
+ c = { ...c, ...m, ...d };
269
+ }
270
+ return c;
271
+ };
272
+ function a(l) {
273
+ e = l(t);
274
+ }
275
+ function s(l) {
276
+ const { props: c } = t, u = Pn(t.parent) || {}, f = [], h = /* @__PURE__ */ new Set();
277
+ let d = {}, m = 1 / 0;
278
+ for (let g = 0; g < Zi; g++) {
279
+ const p = qi[g], y = n[p], v = c[p] !== void 0 ? c[p] : u[p], x = pt(v), T = p === l ? y.isActive : null;
280
+ T === !1 && (m = g);
281
+ let F = v === u[p] && v !== c[p] && x;
282
+ if (F && i && t.manuallyAnimateOnMount && (F = !1), y.protectedKeys = { ...d }, // If it isn't active and hasn't *just* been set as inactive
283
+ !y.isActive && T === null || // If we didn't and don't have any defined prop for this animation type
284
+ !v && !y.prevProp || // Or if the prop doesn't define an animation
285
+ zt(v) || typeof v == "boolean")
286
+ continue;
287
+ if (p === "exit" && y.isActive && T !== !0) {
288
+ y.prevResolvedValues && (d = {
289
+ ...d,
290
+ ...y.prevResolvedValues
291
+ });
292
+ continue;
293
+ }
294
+ const st = ts(y.prevProp, v);
295
+ let V = st || // If we're making this variant active, we want to always make it active
296
+ p === l && y.isActive && !F && x || // If we removed a higher-priority variant (i is in reverse order)
297
+ g > m && x, w = !1;
298
+ const B = Array.isArray(v) ? v : [v];
299
+ let O = B.reduce(o(p), {});
300
+ T === !1 && (O = {});
301
+ const { prevResolvedValues: q = {} } = y, Tt = {
302
+ ...q,
303
+ ...O
304
+ }, Zt = (S) => {
305
+ V = !0, h.has(S) && (w = !0, h.delete(S)), y.needsAnimating[S] = !0;
306
+ const b = t.getValue(S);
307
+ b && (b.liveStyle = !1);
308
+ };
309
+ for (const S in Tt) {
310
+ const b = O[S], W = q[S];
311
+ if (d.hasOwnProperty(S))
312
+ continue;
313
+ let G = !1;
314
+ te(b) && te(W) ? G = !xn(b, W) : G = b !== W, G ? b != null ? Zt(S) : h.add(S) : b !== void 0 && h.has(S) ? Zt(S) : y.protectedKeys[S] = !0;
315
+ }
316
+ y.prevProp = v, y.prevResolvedValues = O, y.isActive && (d = { ...d, ...O }), i && t.blockInitialAnimation && (V = !1);
317
+ const Jt = F && st;
318
+ V && (!Jt || w) && f.push(...B.map((S) => {
319
+ const b = { type: p };
320
+ if (typeof S == "string" && i && !Jt && t.manuallyAnimateOnMount && t.parent) {
321
+ const { parent: W } = t, G = Z(W, S);
322
+ if (W.enteringChildren && G) {
323
+ const { delayChildren: Gn } = G.transition || {};
324
+ b.delay = mn(W.enteringChildren, t, Gn);
325
+ }
326
+ }
327
+ return {
328
+ animation: S,
329
+ options: b
330
+ };
331
+ }));
332
+ }
333
+ if (h.size) {
334
+ const g = {};
335
+ if (typeof c.initial != "boolean") {
336
+ const p = Z(t, Array.isArray(c.initial) ? c.initial[0] : c.initial);
337
+ p && p.transition && (g.transition = p.transition);
338
+ }
339
+ h.forEach((p) => {
340
+ const y = t.getBaseTarget(p), v = t.getValue(p);
341
+ v && (v.liveStyle = !0), g[p] = y ?? null;
342
+ }), f.push({ animation: g });
343
+ }
344
+ let P = !!f.length;
345
+ return i && (c.initial === !1 || c.initial === c.animate) && !t.manuallyAnimateOnMount && (P = !1), i = !1, P ? e(f) : Promise.resolve();
346
+ }
347
+ function r(l, c) {
348
+ if (n[l].isActive === c)
349
+ return Promise.resolve();
350
+ t.variantChildren?.forEach((f) => f.animationState?.setActive(l, c)), n[l].isActive = c;
351
+ const u = s(l);
352
+ for (const f in n)
353
+ n[f].protectedKeys = {};
354
+ return u;
355
+ }
356
+ return {
357
+ animateChanges: s,
358
+ setActive: r,
359
+ setAnimateFunction: a,
360
+ getState: () => n,
361
+ reset: () => {
362
+ n = ue();
363
+ }
364
+ };
365
+ }
366
+ function ts(t, e) {
367
+ return typeof e == "string" ? e !== t : Array.isArray(e) ? !xn(e, t) : !1;
368
+ }
369
+ function H(t = !1) {
370
+ return {
371
+ isActive: t,
372
+ protectedKeys: {},
373
+ needsAnimating: {},
374
+ prevResolvedValues: {}
375
+ };
376
+ }
377
+ function ue() {
378
+ return {
379
+ animate: H(!0),
380
+ whileInView: H(),
381
+ whileHover: H(),
382
+ whileTap: H(),
383
+ whileDrag: H(),
384
+ whileFocus: H(),
385
+ exit: H()
386
+ };
387
+ }
388
+ function he(t, e) {
389
+ t.min = e.min, t.max = e.max;
390
+ }
391
+ function M(t, e) {
392
+ he(t.x, e.x), he(t.y, e.y);
393
+ }
394
+ function fe(t, e) {
395
+ t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
396
+ }
397
+ const wn = 1e-4, es = 1 - wn, ns = 1 + wn, Tn = 0.01, is = 0 - Tn, ss = 0 + Tn;
398
+ function L(t) {
399
+ return t.max - t.min;
400
+ }
401
+ function os(t, e, n) {
402
+ return Math.abs(t - e) <= n;
403
+ }
404
+ function de(t, e, n, i = 0.5) {
405
+ t.origin = i, t.originPoint = D(e.min, e.max, t.origin), t.scale = L(n) / L(e), t.translate = D(n.min, n.max, t.origin) - t.originPoint, (t.scale >= es && t.scale <= ns || isNaN(t.scale)) && (t.scale = 1), (t.translate >= is && t.translate <= ss || isNaN(t.translate)) && (t.translate = 0);
406
+ }
407
+ function J(t, e, n, i) {
408
+ de(t.x, e.x, n.x, i ? i.originX : void 0), de(t.y, e.y, n.y, i ? i.originY : void 0);
409
+ }
410
+ function me(t, e, n) {
411
+ t.min = n.min + e.min, t.max = t.min + L(e);
412
+ }
413
+ function rs(t, e, n) {
414
+ me(t.x, e.x, n.x), me(t.y, e.y, n.y);
415
+ }
416
+ function pe(t, e, n) {
417
+ t.min = e.min - n.min, t.max = t.min + L(e);
418
+ }
419
+ function yt(t, e, n) {
420
+ pe(t.x, e.x, n.x), pe(t.y, e.y, n.y);
421
+ }
422
+ function ge(t, e, n, i, o) {
423
+ return t -= e, t = ee(t, 1 / n, i), o !== void 0 && (t = ee(t, 1 / o, i)), t;
424
+ }
425
+ function as(t, e = 0, n = 1, i = 0.5, o, a = t, s = t) {
426
+ if (gt.test(e) && (e = parseFloat(e), e = D(s.min, s.max, e / 100) - s.min), typeof e != "number")
427
+ return;
428
+ let r = D(a.min, a.max, i);
429
+ t === a && (r -= e), t.min = ge(t.min, e, n, r, o), t.max = ge(t.max, e, n, r, o);
430
+ }
431
+ function ye(t, e, [n, i, o], a, s) {
432
+ as(t, e[n], e[i], e[o], e.scale, a, s);
433
+ }
434
+ const ls = ["x", "scaleX", "originX"], cs = ["y", "scaleY", "originY"];
435
+ function ve(t, e, n, i) {
436
+ ye(t.x, e, ls, n ? n.x : void 0, i ? i.x : void 0), ye(t.y, e, cs, n ? n.y : void 0, i ? i.y : void 0);
437
+ }
438
+ function Pe(t) {
439
+ return t.translate === 0 && t.scale === 1;
440
+ }
441
+ function Sn(t) {
442
+ return Pe(t.x) && Pe(t.y);
443
+ }
444
+ function xe(t, e) {
445
+ return t.min === e.min && t.max === e.max;
446
+ }
447
+ function us(t, e) {
448
+ return xe(t.x, e.x) && xe(t.y, e.y);
449
+ }
450
+ function we(t, e) {
451
+ return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
452
+ }
453
+ function En(t, e) {
454
+ return we(t.x, e.x) && we(t.y, e.y);
455
+ }
456
+ function Te(t) {
457
+ return L(t.x) / L(t.y);
458
+ }
459
+ function Se(t, e) {
460
+ return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
461
+ }
462
+ function I(t) {
463
+ return [t("x"), t("y")];
464
+ }
465
+ function hs(t, e, n) {
466
+ let i = "";
467
+ const o = t.x.translate / e.x, a = t.y.translate / e.y, s = n?.z || 0;
468
+ if ((o || a || s) && (i = `translate3d(${o}px, ${a}px, ${s}px) `), (e.x !== 1 || e.y !== 1) && (i += `scale(${1 / e.x}, ${1 / e.y}) `), n) {
469
+ const { transformPerspective: c, rotate: u, rotateX: f, rotateY: h, skewX: d, skewY: m } = n;
470
+ c && (i = `perspective(${c}px) ${i}`), u && (i += `rotate(${u}deg) `), f && (i += `rotateX(${f}deg) `), h && (i += `rotateY(${h}deg) `), d && (i += `skewX(${d}deg) `), m && (i += `skewY(${m}deg) `);
471
+ }
472
+ const r = t.x.scale * e.x, l = t.y.scale * e.y;
473
+ return (r !== 1 || l !== 1) && (i += `scale(${r}, ${l})`), i || "none";
474
+ }
475
+ const Dn = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], fs = Dn.length, Ee = (t) => typeof t == "string" ? parseFloat(t) : t, De = (t) => typeof t == "number" || ti.test(t);
476
+ function ds(t, e, n, i, o, a) {
477
+ o ? (t.opacity = D(0, n.opacity ?? 1, ms(i)), t.opacityExit = D(e.opacity ?? 1, 0, ps(i))) : a && (t.opacity = D(e.opacity ?? 1, n.opacity ?? 1, i));
478
+ for (let s = 0; s < fs; s++) {
479
+ const r = `border${Dn[s]}Radius`;
480
+ let l = Ae(e, r), c = Ae(n, r);
481
+ if (l === void 0 && c === void 0)
482
+ continue;
483
+ l || (l = 0), c || (c = 0), l === 0 || c === 0 || De(l) === De(c) ? (t[r] = Math.max(D(Ee(l), Ee(c), i), 0), (gt.test(c) || gt.test(l)) && (t[r] += "%")) : t[r] = c;
484
+ }
485
+ (e.rotate || n.rotate) && (t.rotate = D(e.rotate || 0, n.rotate || 0, i));
486
+ }
487
+ function Ae(t, e) {
488
+ return t[e] !== void 0 ? t[e] : t.borderRadius;
489
+ }
490
+ const ms = /* @__PURE__ */ An(0, 0.5, ei), ps = /* @__PURE__ */ An(0.5, 0.95, K);
491
+ function An(t, e, n) {
492
+ return (i) => i < t ? 0 : i > e ? 1 : n(jt(t, e, i));
493
+ }
494
+ function et(t, e, n, i = { passive: !0 }) {
495
+ return t.addEventListener(e, n, i), () => t.removeEventListener(e, n);
496
+ }
497
+ const gs = (t, e) => t.depth - e.depth;
498
+ class ys {
499
+ constructor() {
500
+ this.children = [], this.isDirty = !1;
501
+ }
502
+ add(e) {
503
+ sn(this.children, e), this.isDirty = !0;
504
+ }
505
+ remove(e) {
506
+ It(this.children, e), this.isDirty = !0;
507
+ }
508
+ forEach(e) {
509
+ this.isDirty && this.children.sort(gs), this.isDirty = !1, this.children.forEach(e);
510
+ }
511
+ }
512
+ function vs(t, e) {
513
+ const n = on.now(), i = ({ timestamp: o }) => {
514
+ const a = o - n;
515
+ a >= e && (tt(i), t(a - e));
516
+ };
517
+ return A.setup(i, !0), () => tt(i);
518
+ }
519
+ function dt(t) {
520
+ return Gt(t) ? t.get() : t;
521
+ }
522
+ class Ps {
523
+ constructor() {
524
+ this.members = [];
525
+ }
526
+ add(e) {
527
+ sn(this.members, e);
528
+ for (let n = this.members.length - 1; n >= 0; n--) {
529
+ const i = this.members[n];
530
+ if (i === e || i === this.lead || i === this.prevLead)
531
+ continue;
532
+ const o = i.instance;
533
+ o && o.isConnected === !1 && i.isPresent !== !1 && !i.snapshot && It(this.members, i);
534
+ }
535
+ e.scheduleRender();
536
+ }
537
+ remove(e) {
538
+ if (It(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
539
+ const n = this.members[this.members.length - 1];
540
+ n && this.promote(n);
541
+ }
542
+ }
543
+ relegate(e) {
544
+ const n = this.members.findIndex((o) => e === o);
545
+ if (n === 0)
546
+ return !1;
547
+ let i;
548
+ for (let o = n; o >= 0; o--) {
549
+ const a = this.members[o], s = a.instance;
550
+ if (a.isPresent !== !1 && (!s || s.isConnected !== !1)) {
551
+ i = a;
552
+ break;
553
+ }
554
+ }
555
+ return i ? (this.promote(i), !0) : !1;
556
+ }
557
+ promote(e, n) {
558
+ const i = this.lead;
559
+ if (e !== i && (this.prevLead = i, this.lead = e, e.show(), i)) {
560
+ i.instance && i.scheduleRender(), e.scheduleRender();
561
+ const o = i.options.layoutDependency, a = e.options.layoutDependency;
562
+ if (!(o !== void 0 && a !== void 0 && o === a)) {
563
+ const l = i.instance;
564
+ l && l.isConnected === !1 && !i.snapshot || (e.resumeFrom = i, n && (e.resumeFrom.preserveOpacity = !0), i.snapshot && (e.snapshot = i.snapshot, e.snapshot.latestValues = i.animationValues || i.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0));
565
+ }
566
+ const { crossfade: r } = e.options;
567
+ r === !1 && i.hide();
568
+ }
569
+ }
570
+ exitAnimationComplete() {
571
+ this.members.forEach((e) => {
572
+ const { options: n, resumingFrom: i } = e;
573
+ n.onExitComplete && n.onExitComplete(), i && i.options.onExitComplete && i.options.onExitComplete();
574
+ });
575
+ }
576
+ scheduleRender() {
577
+ this.members.forEach((e) => {
578
+ e.instance && e.scheduleRender(!1);
579
+ });
580
+ }
581
+ /**
582
+ * Clear any leads that have been removed this render to prevent them from being
583
+ * used in future animations and to prevent memory leaks
584
+ */
585
+ removeLeadSnapshot() {
586
+ this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
587
+ }
588
+ }
589
+ const mt = {
590
+ /**
591
+ * Global flag as to whether the tree has animated since the last time
592
+ * we resized the window
593
+ */
594
+ hasAnimatedSinceResize: !0,
595
+ /**
596
+ * We set this to true once, on the first update. Any nodes added to the tree beyond that
597
+ * update will be given a `data-projection-id` attribute.
598
+ */
599
+ hasEverUpdated: !1
600
+ }, Dt = ["", "X", "Y", "Z"], xs = 1e3;
601
+ let ws = 0;
602
+ function At(t, e, n, i) {
603
+ const { latestValues: o } = e;
604
+ o[t] && (n[t] = o[t], e.setStaticValue(t, 0), i && (i[t] = 0));
605
+ }
606
+ function Cn(t) {
607
+ if (t.hasCheckedOptimisedAppear = !0, t.root === t)
608
+ return;
609
+ const { visualElement: e } = t.options;
610
+ if (!e)
611
+ return;
612
+ const n = ui(e);
613
+ if (window.MotionHasOptimisedAnimation(n, "transform")) {
614
+ const { layout: o, layoutId: a } = t.options;
615
+ window.MotionCancelOptimisedAnimation(n, "transform", A, !(o || a));
616
+ }
617
+ const { parent: i } = t;
618
+ i && !i.hasCheckedOptimisedAppear && Cn(i);
619
+ }
620
+ function Ln({ attachResizeListener: t, defaultParent: e, measureScroll: n, checkIsScrollRoot: i, resetTransform: o }) {
621
+ return class {
622
+ constructor(s = {}, r = e?.()) {
623
+ this.id = ws++, 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 = () => {
624
+ this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
625
+ }, this.updateProjection = () => {
626
+ this.projectionUpdateScheduled = !1, this.nodes.forEach(Es), this.nodes.forEach(Ls), this.nodes.forEach(Vs), this.nodes.forEach(Ds);
627
+ }, 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 = r ? r.root || r : this, this.path = r ? [...r.path, r] : [], this.parent = r, this.depth = r ? r.depth + 1 : 0;
628
+ for (let l = 0; l < this.path.length; l++)
629
+ this.path[l].shouldResetTransform = !0;
630
+ this.root === this && (this.nodes = new ys());
631
+ }
632
+ addEventListener(s, r) {
633
+ return this.eventHandlers.has(s) || this.eventHandlers.set(s, new ni()), this.eventHandlers.get(s).add(r);
634
+ }
635
+ notifyListeners(s, ...r) {
636
+ const l = this.eventHandlers.get(s);
637
+ l && l.notify(...r);
638
+ }
639
+ hasListeners(s) {
640
+ return this.eventHandlers.has(s);
641
+ }
642
+ /**
643
+ * Lifecycles
644
+ */
645
+ mount(s) {
646
+ if (this.instance)
647
+ return;
648
+ this.isSVG = tn(s) && !ii(s), this.instance = s;
649
+ const { layoutId: r, layout: l, visualElement: c } = this.options;
650
+ if (c && !c.current && c.mount(s), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (l || r) && (this.isLayoutDirty = !0), t) {
651
+ let u, f = 0;
652
+ const h = () => this.root.updateBlockedByResize = !1;
653
+ A.read(() => {
654
+ f = window.innerWidth;
655
+ }), t(s, () => {
656
+ const d = window.innerWidth;
657
+ d !== f && (f = d, this.root.updateBlockedByResize = !0, u && u(), u = vs(h, 250), mt.hasAnimatedSinceResize && (mt.hasAnimatedSinceResize = !1, this.nodes.forEach(Ve)));
658
+ });
659
+ }
660
+ r && this.root.registerSharedNode(r, this), this.options.animate !== !1 && c && (r || l) && this.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: f, hasRelativeLayoutChanged: h, layout: d }) => {
661
+ if (this.isTreeAnimationBlocked()) {
662
+ this.target = void 0, this.relativeTarget = void 0;
663
+ return;
664
+ }
665
+ const m = this.options.transition || c.getDefaultTransition() || js, { onLayoutAnimationStart: P, onLayoutAnimationComplete: g } = c.getProps(), p = !this.targetLayout || !En(this.targetLayout, d), y = !f && h;
666
+ if (this.options.layoutRoot || this.resumeFrom || y || f && (p || !this.currentAnimation)) {
667
+ this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
668
+ const v = {
669
+ ...si(m, "layout"),
670
+ onPlay: P,
671
+ onComplete: g
672
+ };
673
+ (c.shouldReduceMotion || this.options.layoutRoot) && (v.delay = 0, v.type = !1), this.startAnimation(v), this.setAnimationOrigin(u, y);
674
+ } else
675
+ f || Ve(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
676
+ this.targetLayout = d;
677
+ });
678
+ }
679
+ unmount() {
680
+ this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
681
+ const s = this.getStack();
682
+ s && s.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), tt(this.updateProjection);
683
+ }
684
+ // only on the root
685
+ blockUpdate() {
686
+ this.updateManuallyBlocked = !0;
687
+ }
688
+ unblockUpdate() {
689
+ this.updateManuallyBlocked = !1;
690
+ }
691
+ isUpdateBlocked() {
692
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
693
+ }
694
+ isTreeAnimationBlocked() {
695
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
696
+ }
697
+ // Note: currently only running on root node
698
+ startUpdate() {
699
+ this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Rs), this.animationId++);
700
+ }
701
+ getTransformTemplate() {
702
+ const { visualElement: s } = this.options;
703
+ return s && s.getProps().transformTemplate;
704
+ }
705
+ willUpdate(s = !0) {
706
+ if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
707
+ this.options.onExitComplete && this.options.onExitComplete();
708
+ return;
709
+ }
710
+ if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Cn(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
711
+ return;
712
+ this.isLayoutDirty = !0;
713
+ for (let u = 0; u < this.path.length; u++) {
714
+ const f = this.path[u];
715
+ f.shouldResetTransform = !0, f.updateScroll("snapshot"), f.options.layoutRoot && f.willUpdate(!1);
716
+ }
717
+ const { layoutId: r, layout: l } = this.options;
718
+ if (r === void 0 && !l)
719
+ return;
720
+ const c = this.getTransformTemplate();
721
+ this.prevTransformTemplateValue = c ? c(this.latestValues, "") : void 0, this.updateSnapshot(), s && this.notifyListeners("willUpdate");
722
+ }
723
+ update() {
724
+ if (this.updateScheduled = !1, this.isUpdateBlocked()) {
725
+ this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Ce);
726
+ return;
727
+ }
728
+ if (this.animationId <= this.animationCommitId) {
729
+ this.nodes.forEach(Le);
730
+ return;
731
+ }
732
+ this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(Cs), this.nodes.forEach(Ts), this.nodes.forEach(Ss)) : this.nodes.forEach(Le), this.clearAllSnapshots();
733
+ const r = on.now();
734
+ R.delta = rn(0, 1e3 / 60, r - R.timestamp), R.timestamp = r, R.isProcessing = !0, St.update.process(R), St.preRender.process(R), St.render.process(R), R.isProcessing = !1;
735
+ }
736
+ didUpdate() {
737
+ this.updateScheduled || (this.updateScheduled = !0, an.read(this.scheduleUpdate));
738
+ }
739
+ clearAllSnapshots() {
740
+ this.nodes.forEach(As), this.sharedNodes.forEach(bs);
741
+ }
742
+ scheduleUpdateProjection() {
743
+ this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, A.preRender(this.updateProjection, !1, !0));
744
+ }
745
+ scheduleCheckAfterUnmount() {
746
+ A.postRender(() => {
747
+ this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
748
+ });
749
+ }
750
+ /**
751
+ * Update measurements
752
+ */
753
+ updateSnapshot() {
754
+ this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !L(this.snapshot.measuredBox.x) && !L(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
755
+ }
756
+ updateLayout() {
757
+ if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
758
+ return;
759
+ if (this.resumeFrom && !this.resumeFrom.instance)
760
+ for (let l = 0; l < this.path.length; l++)
761
+ this.path[l].updateScroll();
762
+ const s = this.layout;
763
+ this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected = E(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
764
+ const { visualElement: r } = this.options;
765
+ r && r.notify("LayoutMeasure", this.layout.layoutBox, s ? s.layoutBox : void 0);
766
+ }
767
+ updateScroll(s = "measure") {
768
+ let r = !!(this.options.layoutScroll && this.instance);
769
+ if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === s && (r = !1), r && this.instance) {
770
+ const l = i(this.instance);
771
+ this.scroll = {
772
+ animationId: this.root.animationId,
773
+ phase: s,
774
+ isRoot: l,
775
+ offset: n(this.instance),
776
+ wasRoot: this.scroll ? this.scroll.isRoot : l
777
+ };
778
+ }
779
+ }
780
+ resetTransform() {
781
+ if (!o)
782
+ return;
783
+ const s = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, r = this.projectionDelta && !Sn(this.projectionDelta), l = this.getTransformTemplate(), c = l ? l(this.latestValues, "") : void 0, u = c !== this.prevTransformTemplateValue;
784
+ s && this.instance && (r || $(this.latestValues) || u) && (o(this.instance, c), this.shouldResetTransform = !1, this.scheduleRender());
785
+ }
786
+ measure(s = !0) {
787
+ const r = this.measurePageBox();
788
+ let l = this.removeElementScroll(r);
789
+ return s && (l = this.removeTransform(l)), Is(l), {
790
+ animationId: this.root.animationId,
791
+ measuredBox: r,
792
+ layoutBox: l,
793
+ latestValues: {},
794
+ source: this.id
795
+ };
796
+ }
797
+ measurePageBox() {
798
+ const { visualElement: s } = this.options;
799
+ if (!s)
800
+ return E();
801
+ const r = s.measureViewportBox();
802
+ if (!(this.scroll?.wasRoot || this.path.some(Bs))) {
803
+ const { scroll: c } = this.root;
804
+ c && (ot(r.x, c.offset.x), ot(r.y, c.offset.y));
805
+ }
806
+ return r;
807
+ }
808
+ removeElementScroll(s) {
809
+ const r = E();
810
+ if (M(r, s), this.scroll?.wasRoot)
811
+ return r;
812
+ for (let l = 0; l < this.path.length; l++) {
813
+ const c = this.path[l], { scroll: u, options: f } = c;
814
+ c !== this.root && u && f.layoutScroll && (u.wasRoot && M(r, s), ot(r.x, u.offset.x), ot(r.y, u.offset.y));
815
+ }
816
+ return r;
817
+ }
818
+ applyTransform(s, r = !1) {
819
+ const l = E();
820
+ M(l, s);
821
+ for (let c = 0; c < this.path.length; c++) {
822
+ const u = this.path[c];
823
+ !r && u.options.layoutScroll && u.scroll && u !== u.root && rt(l, {
824
+ x: -u.scroll.offset.x,
825
+ y: -u.scroll.offset.y
826
+ }), $(u.latestValues) && rt(l, u.latestValues);
827
+ }
828
+ return $(this.latestValues) && rt(l, this.latestValues), l;
829
+ }
830
+ removeTransform(s) {
831
+ const r = E();
832
+ M(r, s);
833
+ for (let l = 0; l < this.path.length; l++) {
834
+ const c = this.path[l];
835
+ if (!c.instance || !$(c.latestValues))
836
+ continue;
837
+ ne(c.latestValues) && c.updateSnapshot();
838
+ const u = E(), f = c.measurePageBox();
839
+ M(u, f), ve(r, c.latestValues, c.snapshot ? c.snapshot.layoutBox : void 0, u);
840
+ }
841
+ return $(this.latestValues) && ve(r, this.latestValues), r;
842
+ }
843
+ setTargetDelta(s) {
844
+ this.targetDelta = s, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
845
+ }
846
+ setOptions(s) {
847
+ this.options = {
848
+ ...this.options,
849
+ ...s,
850
+ crossfade: s.crossfade !== void 0 ? s.crossfade : !0
851
+ };
852
+ }
853
+ clearMeasurements() {
854
+ 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;
855
+ }
856
+ forceRelativeParentToResolveTarget() {
857
+ this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== R.timestamp && this.relativeParent.resolveTargetDelta(!0);
858
+ }
859
+ resolveTargetDelta(s = !1) {
860
+ const r = this.getLead();
861
+ this.isProjectionDirty || (this.isProjectionDirty = r.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = r.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = r.isSharedProjectionDirty);
862
+ const l = !!this.resumingFrom || this !== r;
863
+ if (!(s || l && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
864
+ return;
865
+ const { layout: u, layoutId: f } = this.options;
866
+ if (!this.layout || !(u || f))
867
+ return;
868
+ this.resolvedRelativeTargetAt = R.timestamp;
869
+ const h = this.getClosestProjectingParent();
870
+ h && this.linkedParentVersion !== h.layoutVersion && !h.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (h && h.layout ? this.createRelativeTarget(h, this.layout.layoutBox, h.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = E(), this.targetWithTransforms = E()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), rs(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : M(this.target, this.layout.layoutBox), oi(this.target, this.targetDelta)) : M(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, h && !!h.resumingFrom == !!this.resumingFrom && !h.options.layoutScroll && h.target && this.animationProgress !== 1 ? this.createRelativeTarget(h, this.target, h.target) : this.relativeParent = this.relativeTarget = void 0));
871
+ }
872
+ getClosestProjectingParent() {
873
+ if (!(!this.parent || ne(this.parent.latestValues) || ri(this.parent.latestValues)))
874
+ return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
875
+ }
876
+ isProjecting() {
877
+ return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
878
+ }
879
+ createRelativeTarget(s, r, l) {
880
+ this.relativeParent = s, this.linkedParentVersion = s.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = E(), this.relativeTargetOrigin = E(), yt(this.relativeTargetOrigin, r, l), M(this.relativeTarget, this.relativeTargetOrigin);
881
+ }
882
+ removeRelativeTarget() {
883
+ this.relativeParent = this.relativeTarget = void 0;
884
+ }
885
+ calcProjection() {
886
+ const s = this.getLead(), r = !!this.resumingFrom || this !== s;
887
+ let l = !0;
888
+ if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (l = !1), r && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === R.timestamp && (l = !1), l)
889
+ return;
890
+ const { layout: c, layoutId: u } = this.options;
891
+ if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(c || u))
892
+ return;
893
+ M(this.layoutCorrected, this.layout.layoutBox);
894
+ const f = this.treeScale.x, h = this.treeScale.y;
895
+ ai(this.layoutCorrected, this.treeScale, this.path, r), s.layout && !s.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (s.target = s.layout.layoutBox, s.targetWithTransforms = E());
896
+ const { target: d } = s;
897
+ if (!d) {
898
+ this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
899
+ return;
900
+ }
901
+ !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (fe(this.prevProjectionDelta.x, this.projectionDelta.x), fe(this.prevProjectionDelta.y, this.projectionDelta.y)), J(this.projectionDelta, this.layoutCorrected, d, this.latestValues), (this.treeScale.x !== f || this.treeScale.y !== h || !Se(this.projectionDelta.x, this.prevProjectionDelta.x) || !Se(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", d));
902
+ }
903
+ hide() {
904
+ this.isVisible = !1;
905
+ }
906
+ show() {
907
+ this.isVisible = !0;
908
+ }
909
+ scheduleRender(s = !0) {
910
+ if (this.options.visualElement?.scheduleRender(), s) {
911
+ const r = this.getStack();
912
+ r && r.scheduleRender();
913
+ }
914
+ this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
915
+ }
916
+ createProjectionDeltas() {
917
+ this.prevProjectionDelta = Y(), this.projectionDelta = Y(), this.projectionDeltaWithTransform = Y();
918
+ }
919
+ setAnimationOrigin(s, r = !1) {
920
+ const l = this.snapshot, c = l ? l.latestValues : {}, u = { ...this.latestValues }, f = Y();
921
+ (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !r;
922
+ const h = E(), d = l ? l.source : void 0, m = this.layout ? this.layout.source : void 0, P = d !== m, g = this.getStack(), p = !g || g.members.length <= 1, y = !!(P && !p && this.options.crossfade === !0 && !this.path.some(ks));
923
+ this.animationProgress = 0;
924
+ let v;
925
+ this.mixTargetDelta = (x) => {
926
+ const T = x / 1e3;
927
+ Re(f.x, s.x, T), Re(f.y, s.y, T), this.setTargetDelta(f), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (yt(h, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ms(this.relativeTarget, this.relativeTargetOrigin, h, T), v && us(this.relativeTarget, v) && (this.isProjectionDirty = !1), v || (v = E()), M(v, this.relativeTarget)), P && (this.animationValues = u, ds(u, c, this.latestValues, T, y, p)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = T;
928
+ }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
929
+ }
930
+ startAnimation(s) {
931
+ this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (tt(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = A.update(() => {
932
+ mt.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = li(0)), this.motionValue.jump(0, !1), this.currentAnimation = ci(this.motionValue, [0, 1e3], {
933
+ ...s,
934
+ velocity: 0,
935
+ isSync: !0,
936
+ onUpdate: (r) => {
937
+ this.mixTargetDelta(r), s.onUpdate && s.onUpdate(r);
938
+ },
939
+ onStop: () => {
940
+ },
941
+ onComplete: () => {
942
+ s.onComplete && s.onComplete(), this.completeAnimation();
943
+ }
944
+ }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
945
+ });
946
+ }
947
+ completeAnimation() {
948
+ this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
949
+ const s = this.getStack();
950
+ s && s.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
951
+ }
952
+ finishAnimation() {
953
+ this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(xs), this.currentAnimation.stop()), this.completeAnimation();
954
+ }
955
+ applyTransformsToTarget() {
956
+ const s = this.getLead();
957
+ let { targetWithTransforms: r, target: l, layout: c, latestValues: u } = s;
958
+ if (!(!r || !l || !c)) {
959
+ if (this !== s && this.layout && c && Vn(this.options.animationType, this.layout.layoutBox, c.layoutBox)) {
960
+ l = this.target || E();
961
+ const f = L(this.layout.layoutBox.x);
962
+ l.x.min = s.target.x.min, l.x.max = l.x.min + f;
963
+ const h = L(this.layout.layoutBox.y);
964
+ l.y.min = s.target.y.min, l.y.max = l.y.min + h;
965
+ }
966
+ M(r, l), rt(r, u), J(this.projectionDeltaWithTransform, this.layoutCorrected, r, u);
967
+ }
968
+ }
969
+ registerSharedNode(s, r) {
970
+ this.sharedNodes.has(s) || this.sharedNodes.set(s, new Ps()), this.sharedNodes.get(s).add(r);
971
+ const c = r.options.initialPromotionConfig;
972
+ r.promote({
973
+ transition: c ? c.transition : void 0,
974
+ preserveFollowOpacity: c && c.shouldPreserveFollowOpacity ? c.shouldPreserveFollowOpacity(r) : void 0
975
+ });
976
+ }
977
+ isLead() {
978
+ const s = this.getStack();
979
+ return s ? s.lead === this : !0;
980
+ }
981
+ getLead() {
982
+ const { layoutId: s } = this.options;
983
+ return s ? this.getStack()?.lead || this : this;
984
+ }
985
+ getPrevLead() {
986
+ const { layoutId: s } = this.options;
987
+ return s ? this.getStack()?.prevLead : void 0;
988
+ }
989
+ getStack() {
990
+ const { layoutId: s } = this.options;
991
+ if (s)
992
+ return this.root.sharedNodes.get(s);
993
+ }
994
+ promote({ needsReset: s, transition: r, preserveFollowOpacity: l } = {}) {
995
+ const c = this.getStack();
996
+ c && c.promote(this, l), s && (this.projectionDelta = void 0, this.needsReset = !0), r && this.setOptions({ transition: r });
997
+ }
998
+ relegate() {
999
+ const s = this.getStack();
1000
+ return s ? s.relegate(this) : !1;
1001
+ }
1002
+ resetSkewAndRotation() {
1003
+ const { visualElement: s } = this.options;
1004
+ if (!s)
1005
+ return;
1006
+ let r = !1;
1007
+ const { latestValues: l } = s;
1008
+ if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (r = !0), !r)
1009
+ return;
1010
+ const c = {};
1011
+ l.z && At("z", s, c, this.animationValues);
1012
+ for (let u = 0; u < Dt.length; u++)
1013
+ At(`rotate${Dt[u]}`, s, c, this.animationValues), At(`skew${Dt[u]}`, s, c, this.animationValues);
1014
+ s.render();
1015
+ for (const u in c)
1016
+ s.setStaticValue(u, c[u]), this.animationValues && (this.animationValues[u] = c[u]);
1017
+ s.scheduleRender();
1018
+ }
1019
+ applyProjectionStyles(s, r) {
1020
+ if (!this.instance || this.isSVG)
1021
+ return;
1022
+ if (!this.isVisible) {
1023
+ s.visibility = "hidden";
1024
+ return;
1025
+ }
1026
+ const l = this.getTransformTemplate();
1027
+ if (this.needsReset) {
1028
+ this.needsReset = !1, s.visibility = "", s.opacity = "", s.pointerEvents = dt(r?.pointerEvents) || "", s.transform = l ? l(this.latestValues, "") : "none";
1029
+ return;
1030
+ }
1031
+ const c = this.getLead();
1032
+ if (!this.projectionDelta || !this.layout || !c.target) {
1033
+ this.options.layoutId && (s.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, s.pointerEvents = dt(r?.pointerEvents) || ""), this.hasProjected && !$(this.latestValues) && (s.transform = l ? l({}, "") : "none", this.hasProjected = !1);
1034
+ return;
1035
+ }
1036
+ s.visibility = "";
1037
+ const u = c.animationValues || c.latestValues;
1038
+ this.applyTransformsToTarget();
1039
+ let f = hs(this.projectionDeltaWithTransform, this.treeScale, u);
1040
+ l && (f = l(u, f)), s.transform = f;
1041
+ const { x: h, y: d } = this.projectionDelta;
1042
+ s.transformOrigin = `${h.origin * 100}% ${d.origin * 100}% 0`, c.animationValues ? s.opacity = c === this ? u.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : u.opacityExit : s.opacity = c === this ? u.opacity !== void 0 ? u.opacity : "" : u.opacityExit !== void 0 ? u.opacityExit : 0;
1043
+ for (const m in ie) {
1044
+ if (u[m] === void 0)
1045
+ continue;
1046
+ const { correct: P, applyTo: g, isCSSVariable: p } = ie[m], y = f === "none" ? u[m] : P(u[m], c);
1047
+ if (g) {
1048
+ const v = g.length;
1049
+ for (let x = 0; x < v; x++)
1050
+ s[g[x]] = y;
1051
+ } else
1052
+ p ? this.options.visualElement.renderState.vars[m] = y : s[m] = y;
1053
+ }
1054
+ this.options.layoutId && (s.pointerEvents = c === this ? dt(r?.pointerEvents) || "" : "none");
1055
+ }
1056
+ clearSnapshot() {
1057
+ this.resumeFrom = this.snapshot = void 0;
1058
+ }
1059
+ // Only run on root
1060
+ resetTree() {
1061
+ this.root.nodes.forEach((s) => s.currentAnimation?.stop()), this.root.nodes.forEach(Ce), this.root.sharedNodes.clear();
1062
+ }
1063
+ };
1064
+ }
1065
+ function Ts(t) {
1066
+ t.updateLayout();
1067
+ }
1068
+ function Ss(t) {
1069
+ const e = t.resumeFrom?.snapshot || t.snapshot;
1070
+ if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
1071
+ const { layoutBox: n, measuredBox: i } = t.layout, { animationType: o } = t.options, a = e.source !== t.layout.source;
1072
+ o === "size" ? I((u) => {
1073
+ const f = a ? e.measuredBox[u] : e.layoutBox[u], h = L(f);
1074
+ f.min = n[u].min, f.max = f.min + h;
1075
+ }) : Vn(o, e.layoutBox, n) && I((u) => {
1076
+ const f = a ? e.measuredBox[u] : e.layoutBox[u], h = L(n[u]);
1077
+ f.max = f.min + h, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[u].max = t.relativeTarget[u].min + h);
1078
+ });
1079
+ const s = Y();
1080
+ J(s, n, e.layoutBox);
1081
+ const r = Y();
1082
+ a ? J(r, t.applyTransform(i, !0), e.measuredBox) : J(r, n, e.layoutBox);
1083
+ const l = !Sn(s);
1084
+ let c = !1;
1085
+ if (!t.resumeFrom) {
1086
+ const u = t.getClosestProjectingParent();
1087
+ if (u && !u.resumeFrom) {
1088
+ const { snapshot: f, layout: h } = u;
1089
+ if (f && h) {
1090
+ const d = E();
1091
+ yt(d, e.layoutBox, f.layoutBox);
1092
+ const m = E();
1093
+ yt(m, n, h.layoutBox), En(d, m) || (c = !0), u.options.layoutRoot && (t.relativeTarget = m, t.relativeTargetOrigin = d, t.relativeParent = u);
1094
+ }
1095
+ }
1096
+ }
1097
+ t.notifyListeners("didUpdate", {
1098
+ layout: n,
1099
+ snapshot: e,
1100
+ delta: r,
1101
+ layoutDelta: s,
1102
+ hasLayoutChanged: l,
1103
+ hasRelativeLayoutChanged: c
1104
+ });
1105
+ } else if (t.isLead()) {
1106
+ const { onExitComplete: n } = t.options;
1107
+ n && n();
1108
+ }
1109
+ t.options.transition = void 0;
1110
+ }
1111
+ function Es(t) {
1112
+ 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));
1113
+ }
1114
+ function Ds(t) {
1115
+ t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
1116
+ }
1117
+ function As(t) {
1118
+ t.clearSnapshot();
1119
+ }
1120
+ function Ce(t) {
1121
+ t.clearMeasurements();
1122
+ }
1123
+ function Le(t) {
1124
+ t.isLayoutDirty = !1;
1125
+ }
1126
+ function Cs(t) {
1127
+ const { visualElement: e } = t.options;
1128
+ e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
1129
+ }
1130
+ function Ve(t) {
1131
+ t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
1132
+ }
1133
+ function Ls(t) {
1134
+ t.resolveTargetDelta();
1135
+ }
1136
+ function Vs(t) {
1137
+ t.calcProjection();
1138
+ }
1139
+ function Rs(t) {
1140
+ t.resetSkewAndRotation();
1141
+ }
1142
+ function bs(t) {
1143
+ t.removeLeadSnapshot();
1144
+ }
1145
+ function Re(t, e, n) {
1146
+ t.translate = D(e.translate, 0, n), t.scale = D(e.scale, 1, n), t.origin = e.origin, t.originPoint = e.originPoint;
1147
+ }
1148
+ function be(t, e, n, i) {
1149
+ t.min = D(e.min, n.min, i), t.max = D(e.max, n.max, i);
1150
+ }
1151
+ function Ms(t, e, n, i) {
1152
+ be(t.x, e.x, n.x, i), be(t.y, e.y, n.y, i);
1153
+ }
1154
+ function ks(t) {
1155
+ return t.animationValues && t.animationValues.opacityExit !== void 0;
1156
+ }
1157
+ const js = {
1158
+ duration: 0.45,
1159
+ ease: [0.4, 0, 0.1, 1]
1160
+ }, Me = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), ke = Me("applewebkit/") && !Me("chrome/") ? Math.round : K;
1161
+ function je(t) {
1162
+ t.min = ke(t.min), t.max = ke(t.max);
1163
+ }
1164
+ function Is(t) {
1165
+ je(t.x), je(t.y);
1166
+ }
1167
+ function Vn(t, e, n) {
1168
+ return t === "position" || t === "preserve-aspect" && !os(Te(e), Te(n), 0.2);
1169
+ }
1170
+ function Bs(t) {
1171
+ return t !== t.root && t.scroll?.wasRoot;
1172
+ }
1173
+ const Os = Ln({
1174
+ attachResizeListener: (t, e) => et(t, "resize", e),
1175
+ measureScroll: () => ({
1176
+ x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0,
1177
+ y: document.documentElement.scrollTop || document.body?.scrollTop || 0
1178
+ }),
1179
+ checkIsScrollRoot: () => !0
1180
+ }), Ct = {
1181
+ current: void 0
1182
+ }, Rn = Ln({
1183
+ measureScroll: (t) => ({
1184
+ x: t.scrollLeft,
1185
+ y: t.scrollTop
1186
+ }),
1187
+ defaultParent: () => {
1188
+ if (!Ct.current) {
1189
+ const t = new Os({});
1190
+ t.mount(window), t.setOptions({ layoutScroll: !0 }), Ct.current = t;
1191
+ }
1192
+ return Ct.current;
1193
+ },
1194
+ resetTransform: (t, e) => {
1195
+ t.style.transform = e !== void 0 ? e : "none";
1196
+ },
1197
+ checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
1198
+ });
1199
+ function Ie(t, e) {
1200
+ if (typeof t == "function")
1201
+ return t(e);
1202
+ t != null && (t.current = e);
1203
+ }
1204
+ function Fs(...t) {
1205
+ return (e) => {
1206
+ let n = !1;
1207
+ const i = t.map((o) => {
1208
+ const a = Ie(o, e);
1209
+ return !n && typeof a == "function" && (n = !0), a;
1210
+ });
1211
+ if (n)
1212
+ return () => {
1213
+ for (let o = 0; o < i.length; o++) {
1214
+ const a = i[o];
1215
+ typeof a == "function" ? a() : Ie(t[o], null);
1216
+ }
1217
+ };
1218
+ };
1219
+ }
1220
+ function Us(...t) {
1221
+ return Pt.useCallback(Fs(...t), t);
1222
+ }
1223
+ class Ws extends Pt.Component {
1224
+ getSnapshotBeforeUpdate(e) {
1225
+ const n = this.props.childRef.current;
1226
+ if (n && e.isPresent && !this.props.isPresent && this.props.pop !== !1) {
1227
+ const i = n.offsetParent, o = Ot(i) && i.offsetWidth || 0, a = Ot(i) && i.offsetHeight || 0, s = this.props.sizeRef.current;
1228
+ s.height = n.offsetHeight || 0, s.width = n.offsetWidth || 0, s.top = n.offsetTop, s.left = n.offsetLeft, s.right = o - s.width - s.left, s.bottom = a - s.height - s.top;
1229
+ }
1230
+ return null;
1231
+ }
1232
+ /**
1233
+ * Required with getSnapshotBeforeUpdate to stop React complaining.
1234
+ */
1235
+ componentDidUpdate() {
1236
+ }
1237
+ render() {
1238
+ return this.props.children;
1239
+ }
1240
+ }
1241
+ function Hs({ children: t, isPresent: e, anchorX: n, anchorY: i, root: o, pop: a }) {
1242
+ const s = Ht(), r = j(null), l = j({
1243
+ width: 0,
1244
+ height: 0,
1245
+ top: 0,
1246
+ left: 0,
1247
+ right: 0,
1248
+ bottom: 0
1249
+ }), { nonce: c } = C($t), u = t.props?.ref ?? t?.ref, f = Us(r, u);
1250
+ return Nt(() => {
1251
+ const { width: h, height: d, top: m, left: P, right: g, bottom: p } = l.current;
1252
+ if (e || a === !1 || !r.current || !h || !d)
1253
+ return;
1254
+ const y = n === "left" ? `left: ${P}` : `right: ${g}`, v = i === "bottom" ? `bottom: ${p}` : `top: ${m}`;
1255
+ r.current.dataset.motionPopId = s;
1256
+ const x = document.createElement("style");
1257
+ c && (x.nonce = c);
1258
+ const T = o ?? document.head;
1259
+ return T.appendChild(x), x.sheet && x.sheet.insertRule(`
1260
+ [data-motion-pop-id="${s}"] {
1261
+ position: absolute !important;
1262
+ width: ${h}px !important;
1263
+ height: ${d}px !important;
1264
+ ${y}px !important;
1265
+ ${v}px !important;
1266
+ }
1267
+ `), () => {
1268
+ T.contains(x) && T.removeChild(x);
1269
+ };
1270
+ }, [e]), N(Ws, { isPresent: e, childRef: r, sizeRef: l, pop: a, children: a === !1 ? t : Pt.cloneElement(t, { ref: f }) });
1271
+ }
1272
+ const Ns = ({ children: t, initial: e, isPresent: n, onExitComplete: i, custom: o, presenceAffectsLayout: a, mode: s, anchorX: r, anchorY: l, root: c }) => {
1273
+ const u = Xt(zs), f = Ht();
1274
+ let h = !0, d = z(() => (h = !1, {
1275
+ id: f,
1276
+ initial: e,
1277
+ isPresent: n,
1278
+ custom: o,
1279
+ onExitComplete: (m) => {
1280
+ u.set(m, !0);
1281
+ for (const P of u.values())
1282
+ if (!P)
1283
+ return;
1284
+ i && i();
1285
+ },
1286
+ register: (m) => (u.set(m, !1), () => u.delete(m))
1287
+ }), [n, u, i]);
1288
+ return a && h && (d = { ...d }), z(() => {
1289
+ u.forEach((m, P) => u.set(P, !1));
1290
+ }, [n]), Pt.useEffect(() => {
1291
+ !n && !u.size && i && i();
1292
+ }, [n]), t = N(Hs, { pop: s === "popLayout", isPresent: n, anchorX: r, anchorY: l, root: c, children: t }), N(xt.Provider, { value: d, children: t });
1293
+ };
1294
+ function zs() {
1295
+ return /* @__PURE__ */ new Map();
1296
+ }
1297
+ function bn(t = !0) {
1298
+ const e = C(xt);
1299
+ if (e === null)
1300
+ return [!0, null];
1301
+ const { isPresent: n, onExitComplete: i, register: o } = e, a = Ht();
1302
+ Wt(() => {
1303
+ if (t)
1304
+ return o(a);
1305
+ }, [t]);
1306
+ const s = qe(() => t && i && i(a), [a, i, t]);
1307
+ return !n && i ? [!1, s] : [!0];
1308
+ }
1309
+ const at = (t) => t.key || "";
1310
+ function Be(t) {
1311
+ const e = [];
1312
+ return _n.forEach(t, (n) => {
1313
+ Kn(n) && e.push(n);
1314
+ }), e;
1315
+ }
1316
+ const ir = ({ children: t, custom: e, initial: n = !0, onExitComplete: i, presenceAffectsLayout: o = !0, mode: a = "sync", propagate: s = !1, anchorX: r = "left", anchorY: l = "top", root: c }) => {
1317
+ const [u, f] = bn(s), h = z(() => Be(t), [t]), d = s && !u ? [] : h.map(at), m = j(!0), P = j(h), g = Xt(() => /* @__PURE__ */ new Map()), p = j(/* @__PURE__ */ new Set()), [y, v] = Qt(h), [x, T] = Qt(h);
1318
+ dn(() => {
1319
+ m.current = !1, P.current = h;
1320
+ for (let V = 0; V < x.length; V++) {
1321
+ const w = at(x[V]);
1322
+ d.includes(w) ? (g.delete(w), p.current.delete(w)) : g.get(w) !== !0 && g.set(w, !1);
1323
+ }
1324
+ }, [x, d.length, d.join("-")]);
1325
+ const F = [];
1326
+ if (h !== y) {
1327
+ let V = [...h];
1328
+ for (let w = 0; w < x.length; w++) {
1329
+ const B = x[w], O = at(B);
1330
+ d.includes(O) || (V.splice(w, 0, B), F.push(B));
1331
+ }
1332
+ return a === "wait" && F.length && (V = F), T(Be(V)), v(h), null;
1333
+ }
1334
+ process.env.NODE_ENV !== "production" && a === "wait" && x.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.`);
1335
+ const { forceRender: st } = C(Yt);
1336
+ return N($n, { children: x.map((V) => {
1337
+ const w = at(V), B = s && !u ? !1 : h === x || d.includes(w), O = () => {
1338
+ if (p.current.has(w))
1339
+ return;
1340
+ if (p.current.add(w), g.has(w))
1341
+ g.set(w, !0);
1342
+ else
1343
+ return;
1344
+ let q = !0;
1345
+ g.forEach((Tt) => {
1346
+ Tt || (q = !1);
1347
+ }), q && (st?.(), T(P.current), s && f?.(), i && i());
1348
+ };
1349
+ return N(Ns, { isPresent: B, initial: !m.current || n ? void 0 : !1, custom: e, presenceAffectsLayout: o, mode: a, root: c, onExitComplete: B ? void 0 : O, anchorX: r, anchorY: l, children: V }, w);
1350
+ }) });
1351
+ }, Mn = nt({ strict: !1 }), Oe = {
1352
+ animation: [
1353
+ "animate",
1354
+ "variants",
1355
+ "whileHover",
1356
+ "whileTap",
1357
+ "exit",
1358
+ "whileInView",
1359
+ "whileFocus",
1360
+ "whileDrag"
1361
+ ],
1362
+ exit: ["exit"],
1363
+ drag: ["drag", "dragControls"],
1364
+ focus: ["whileFocus"],
1365
+ hover: ["whileHover", "onHoverStart", "onHoverEnd"],
1366
+ tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
1367
+ pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
1368
+ inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
1369
+ layout: ["layout", "layoutId"]
1370
+ };
1371
+ let Fe = !1;
1372
+ function Gs() {
1373
+ if (Fe)
1374
+ return;
1375
+ const t = {};
1376
+ for (const e in Oe)
1377
+ t[e] = {
1378
+ isEnabled: (n) => Oe[e].some((i) => !!n[i])
1379
+ };
1380
+ ln(t), Fe = !0;
1381
+ }
1382
+ function kn() {
1383
+ return Gs(), hi();
1384
+ }
1385
+ function $s(t) {
1386
+ const e = kn();
1387
+ for (const n in t)
1388
+ e[n] = {
1389
+ ...e[n],
1390
+ ...t[n]
1391
+ };
1392
+ ln(e);
1393
+ }
1394
+ const Xs = /* @__PURE__ */ new Set([
1395
+ "animate",
1396
+ "exit",
1397
+ "variants",
1398
+ "initial",
1399
+ "style",
1400
+ "values",
1401
+ "variants",
1402
+ "transition",
1403
+ "transformTemplate",
1404
+ "custom",
1405
+ "inherit",
1406
+ "onBeforeLayoutMeasure",
1407
+ "onAnimationStart",
1408
+ "onAnimationComplete",
1409
+ "onUpdate",
1410
+ "onDragStart",
1411
+ "onDrag",
1412
+ "onDragEnd",
1413
+ "onMeasureDragConstraints",
1414
+ "onDirectionLock",
1415
+ "onDragTransitionEnd",
1416
+ "_dragX",
1417
+ "_dragY",
1418
+ "onHoverStart",
1419
+ "onHoverEnd",
1420
+ "onViewportEnter",
1421
+ "onViewportLeave",
1422
+ "globalTapTarget",
1423
+ "propagate",
1424
+ "ignoreStrict",
1425
+ "viewport"
1426
+ ]);
1427
+ function vt(t) {
1428
+ return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Xs.has(t);
1429
+ }
1430
+ let jn = (t) => !vt(t);
1431
+ function Ys(t) {
1432
+ typeof t == "function" && (jn = (e) => e.startsWith("on") ? !vt(e) : t(e));
1433
+ }
1434
+ try {
1435
+ Ys(require("@emotion/is-prop-valid").default);
1436
+ } catch {
1437
+ }
1438
+ function _s(t, e, n) {
1439
+ const i = {};
1440
+ for (const o in t)
1441
+ o === "values" && typeof t.values == "object" || (jn(o) || n === !0 && vt(o) || !e && !vt(o) || // If trying to use native HTML drag events, forward drag listeners
1442
+ t.draggable && o.startsWith("onDrag")) && (i[o] = t[o]);
1443
+ return i;
1444
+ }
1445
+ const wt = /* @__PURE__ */ nt({});
1446
+ function Ks(t, e) {
1447
+ if (cn(t)) {
1448
+ const { initial: n, animate: i } = t;
1449
+ return {
1450
+ initial: n === !1 || pt(n) ? n : void 0,
1451
+ animate: pt(i) ? i : void 0
1452
+ };
1453
+ }
1454
+ return t.inherit !== !1 ? e : {};
1455
+ }
1456
+ function qs(t) {
1457
+ const { initial: e, animate: n } = Ks(t, C(wt));
1458
+ return z(() => ({ initial: e, animate: n }), [Ue(e), Ue(n)]);
1459
+ }
1460
+ function Ue(t) {
1461
+ return Array.isArray(t) ? t.join(" ") : t;
1462
+ }
1463
+ const Kt = () => ({
1464
+ style: {},
1465
+ transform: {},
1466
+ transformOrigin: {},
1467
+ vars: {}
1468
+ });
1469
+ function In(t, e, n) {
1470
+ for (const i in e)
1471
+ !Gt(e[i]) && !fi(i, n) && (t[i] = e[i]);
1472
+ }
1473
+ function Zs({ transformTemplate: t }, e) {
1474
+ return z(() => {
1475
+ const n = Kt();
1476
+ return di(n, e, t), Object.assign({}, n.vars, n.style);
1477
+ }, [e]);
1478
+ }
1479
+ function Js(t, e) {
1480
+ const n = t.style || {}, i = {};
1481
+ return In(i, n, t), Object.assign(i, Zs(t, e)), i;
1482
+ }
1483
+ function Qs(t, e) {
1484
+ const n = {}, i = Js(t, e);
1485
+ return t.drag && t.dragListener !== !1 && (n.draggable = !1, i.userSelect = i.WebkitUserSelect = i.WebkitTouchCallout = "none", i.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = i, n;
1486
+ }
1487
+ const Bn = () => ({
1488
+ ...Kt(),
1489
+ attrs: {}
1490
+ });
1491
+ function to(t, e, n, i) {
1492
+ const o = z(() => {
1493
+ const a = Bn();
1494
+ return mi(a, e, pi(i), t.transformTemplate, t.style), {
1495
+ ...a.attrs,
1496
+ style: { ...a.style }
1497
+ };
1498
+ }, [e]);
1499
+ if (t.style) {
1500
+ const a = {};
1501
+ In(a, t.style, t), o.style = { ...a, ...o.style };
1502
+ }
1503
+ return o;
1504
+ }
1505
+ const eo = [
1506
+ "animate",
1507
+ "circle",
1508
+ "defs",
1509
+ "desc",
1510
+ "ellipse",
1511
+ "g",
1512
+ "image",
1513
+ "line",
1514
+ "filter",
1515
+ "marker",
1516
+ "mask",
1517
+ "metadata",
1518
+ "path",
1519
+ "pattern",
1520
+ "polygon",
1521
+ "polyline",
1522
+ "rect",
1523
+ "stop",
1524
+ "switch",
1525
+ "symbol",
1526
+ "svg",
1527
+ "text",
1528
+ "tspan",
1529
+ "use",
1530
+ "view"
1531
+ ];
1532
+ function qt(t) {
1533
+ return (
1534
+ /**
1535
+ * If it's not a string, it's a custom React component. Currently we only support
1536
+ * HTML custom React components.
1537
+ */
1538
+ typeof t != "string" || /**
1539
+ * If it contains a dash, the element is a custom HTML webcomponent.
1540
+ */
1541
+ t.includes("-") ? !1 : (
1542
+ /**
1543
+ * If it's in our list of lowercase SVG tags, it's an SVG component
1544
+ */
1545
+ !!(eo.indexOf(t) > -1 || /**
1546
+ * If it contains a capital letter, it's an SVG component
1547
+ */
1548
+ /[A-Z]/u.test(t))
1549
+ )
1550
+ );
1551
+ }
1552
+ function no(t, e, n, { latestValues: i }, o, a = !1, s) {
1553
+ const l = (s ?? qt(t) ? to : Qs)(e, i, o, t), c = _s(e, typeof t == "string", a), u = t !== Ze ? { ...c, ...l, ref: n } : {}, { children: f } = e, h = z(() => Gt(f) ? f.get() : f, [f]);
1554
+ return qn(t, {
1555
+ ...u,
1556
+ children: h
1557
+ });
1558
+ }
1559
+ function io({ scrapeMotionValuesFromProps: t, createRenderState: e }, n, i, o) {
1560
+ return {
1561
+ latestValues: so(n, i, o, t),
1562
+ renderState: e()
1563
+ };
1564
+ }
1565
+ function so(t, e, n, i) {
1566
+ const o = {}, a = i(t, {});
1567
+ for (const h in a)
1568
+ o[h] = dt(a[h]);
1569
+ let { initial: s, animate: r } = t;
1570
+ const l = cn(t), c = gi(t);
1571
+ e && c && !l && t.inherit !== !1 && (s === void 0 && (s = e.initial), r === void 0 && (r = e.animate));
1572
+ let u = n ? n.initial === !1 : !1;
1573
+ u = u || s === !1;
1574
+ const f = u ? r : s;
1575
+ if (f && typeof f != "boolean" && !zt(f)) {
1576
+ const h = Array.isArray(f) ? f : [f];
1577
+ for (let d = 0; d < h.length; d++) {
1578
+ const m = yi(t, h[d]);
1579
+ if (m) {
1580
+ const { transitionEnd: P, transition: g, ...p } = m;
1581
+ for (const y in p) {
1582
+ let v = p[y];
1583
+ if (Array.isArray(v)) {
1584
+ const x = u ? v.length - 1 : 0;
1585
+ v = v[x];
1586
+ }
1587
+ v !== null && (o[y] = v);
1588
+ }
1589
+ for (const y in P)
1590
+ o[y] = P[y];
1591
+ }
1592
+ }
1593
+ }
1594
+ return o;
1595
+ }
1596
+ const On = (t) => (e, n) => {
1597
+ const i = C(wt), o = C(xt), a = () => io(t, e, i, o);
1598
+ return n ? a() : Xt(a);
1599
+ }, oo = /* @__PURE__ */ On({
1600
+ scrapeMotionValuesFromProps: vi,
1601
+ createRenderState: Kt
1602
+ }), ro = /* @__PURE__ */ On({
1603
+ scrapeMotionValuesFromProps: Pi,
1604
+ createRenderState: Bn
1605
+ }), ao = /* @__PURE__ */ Symbol.for("motionComponentSymbol");
1606
+ function lo(t, e, n) {
1607
+ const i = j(n);
1608
+ Nt(() => {
1609
+ i.current = n;
1610
+ });
1611
+ const o = j(null);
1612
+ return qe((a) => {
1613
+ a && t.onMount?.(a), e && (a ? e.mount(a) : e.unmount());
1614
+ const s = i.current;
1615
+ if (typeof s == "function")
1616
+ if (a) {
1617
+ const r = s(a);
1618
+ typeof r == "function" && (o.current = r);
1619
+ } else o.current ? (o.current(), o.current = null) : s(a);
1620
+ else s && (s.current = a);
1621
+ }, [e]);
1622
+ }
1623
+ const Fn = nt({});
1624
+ function X(t) {
1625
+ return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
1626
+ }
1627
+ function co(t, e, n, i, o, a) {
1628
+ const { visualElement: s } = C(wt), r = C(Mn), l = C(xt), c = C($t), u = c.reducedMotion, f = c.skipAnimations, h = j(null), d = j(!1);
1629
+ i = i || r.renderer, !h.current && i && (h.current = i(t, {
1630
+ visualState: e,
1631
+ parent: s,
1632
+ props: n,
1633
+ presenceContext: l,
1634
+ blockInitialAnimation: l ? l.initial === !1 : !1,
1635
+ reducedMotionConfig: u,
1636
+ skipAnimations: f,
1637
+ isSVG: a
1638
+ }), d.current && h.current && (h.current.manuallyAnimateOnMount = !0));
1639
+ const m = h.current, P = C(Fn);
1640
+ m && !m.projection && o && (m.type === "html" || m.type === "svg") && uo(h.current, n, o, P);
1641
+ const g = j(!1);
1642
+ Nt(() => {
1643
+ m && g.current && m.update(n, l);
1644
+ });
1645
+ const p = n[xi], y = j(!!p && !window.MotionHandoffIsComplete?.(p) && window.MotionHasOptimisedAnimation?.(p));
1646
+ return dn(() => {
1647
+ d.current = !0, m && (g.current = !0, window.MotionIsMounted = !0, m.updateFeatures(), m.scheduleRenderMicrotask(), y.current && m.animationState && m.animationState.animateChanges());
1648
+ }), Wt(() => {
1649
+ m && (!y.current && m.animationState && m.animationState.animateChanges(), y.current && (queueMicrotask(() => {
1650
+ window.MotionHandoffMarkAsComplete?.(p);
1651
+ }), y.current = !1), m.enteringChildren = void 0);
1652
+ }), m;
1653
+ }
1654
+ function uo(t, e, n, i) {
1655
+ const { layoutId: o, layout: a, drag: s, dragConstraints: r, layoutScroll: l, layoutRoot: c, layoutCrossfade: u } = e;
1656
+ t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : Un(t.parent)), t.projection.setOptions({
1657
+ layoutId: o,
1658
+ layout: a,
1659
+ alwaysMeasureLayout: !!s || r && X(r),
1660
+ visualElement: t,
1661
+ /**
1662
+ * TODO: Update options in an effect. This could be tricky as it'll be too late
1663
+ * to update by the time layout animations run.
1664
+ * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
1665
+ * ensuring it gets called if there's no potential layout animations.
1666
+ *
1667
+ */
1668
+ animationType: typeof a == "string" ? a : "both",
1669
+ initialPromotionConfig: i,
1670
+ crossfade: u,
1671
+ layoutScroll: l,
1672
+ layoutRoot: c
1673
+ });
1674
+ }
1675
+ function Un(t) {
1676
+ if (t)
1677
+ return t.options.allowProjection !== !1 ? t.projection : Un(t.parent);
1678
+ }
1679
+ function Lt(t, { forwardMotionProps: e = !1, type: n } = {}, i, o) {
1680
+ i && $s(i);
1681
+ const a = n ? n === "svg" : qt(t), s = a ? ro : oo;
1682
+ function r(c, u) {
1683
+ let f;
1684
+ const h = {
1685
+ ...C($t),
1686
+ ...c,
1687
+ layoutId: ho(c)
1688
+ }, { isStatic: d } = h, m = qs(c), P = s(c, d);
1689
+ if (!d && fn) {
1690
+ fo(h, i);
1691
+ const g = mo(h);
1692
+ f = g.MeasureLayout, m.visualElement = co(t, P, h, o, g.ProjectionNode, a);
1693
+ }
1694
+ return Xn(wt.Provider, { value: m, children: [f && m.visualElement ? N(f, { visualElement: m.visualElement, ...h }) : null, no(t, c, lo(P, m.visualElement, u), P, d, e, a)] });
1695
+ }
1696
+ r.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
1697
+ const l = Zn(r);
1698
+ return l[ao] = t, l;
1699
+ }
1700
+ function ho({ layoutId: t }) {
1701
+ const e = C(Yt).id;
1702
+ return e && t !== void 0 ? e + "-" + t : t;
1703
+ }
1704
+ function fo(t, e) {
1705
+ const n = C(Mn).strict;
1706
+ if (process.env.NODE_ENV !== "production" && e && n) {
1707
+ const i = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
1708
+ t.ignoreStrict ? wi(!1, i, "lazy-strict-mode") : un(!1, i, "lazy-strict-mode");
1709
+ }
1710
+ }
1711
+ function mo(t) {
1712
+ const e = kn(), { drag: n, layout: i } = e;
1713
+ if (!n && !i)
1714
+ return {};
1715
+ const o = { ...n, ...i };
1716
+ return {
1717
+ MeasureLayout: n?.isEnabled(t) || i?.isEnabled(t) ? o.MeasureLayout : void 0,
1718
+ ProjectionNode: o.ProjectionNode
1719
+ };
1720
+ }
1721
+ function po(t, e) {
1722
+ if (typeof Proxy > "u")
1723
+ return Lt;
1724
+ const n = /* @__PURE__ */ new Map(), i = (a, s) => Lt(a, s, t, e), o = (a, s) => (process.env.NODE_ENV !== "production" && Ti(!1, "motion() is deprecated. Use motion.create() instead."), i(a, s));
1725
+ return new Proxy(o, {
1726
+ /**
1727
+ * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
1728
+ * The prop name is passed through as `key` and we can use that to generate a `motion`
1729
+ * DOM component with that name.
1730
+ */
1731
+ get: (a, s) => s === "create" ? i : (n.has(s) || n.set(s, Lt(s, void 0, t, e)), n.get(s))
1732
+ });
1733
+ }
1734
+ const go = (t, e) => e.isSVG ?? qt(t) ? new Si(e) : new Ei(e, {
1735
+ allowProjection: t !== Ze
1736
+ });
1737
+ class yo extends U {
1738
+ /**
1739
+ * We dynamically generate the AnimationState manager as it contains a reference
1740
+ * to the underlying animation library. We only want to load that if we load this,
1741
+ * so people can optionally code split it out using the `m` component.
1742
+ */
1743
+ constructor(e) {
1744
+ super(e), e.animationState || (e.animationState = Qi(e));
1745
+ }
1746
+ updateAnimationControlsSubscription() {
1747
+ const { animate: e } = this.node.getProps();
1748
+ zt(e) && (this.unmountControls = e.subscribe(this.node));
1749
+ }
1750
+ /**
1751
+ * Subscribe any provided AnimationControls to the component's VisualElement
1752
+ */
1753
+ mount() {
1754
+ this.updateAnimationControlsSubscription();
1755
+ }
1756
+ update() {
1757
+ const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
1758
+ e !== n && this.updateAnimationControlsSubscription();
1759
+ }
1760
+ unmount() {
1761
+ this.node.animationState.reset(), this.unmountControls?.();
1762
+ }
1763
+ }
1764
+ let vo = 0;
1765
+ class Po extends U {
1766
+ constructor() {
1767
+ super(...arguments), this.id = vo++;
1768
+ }
1769
+ update() {
1770
+ if (!this.node.presenceContext)
1771
+ return;
1772
+ const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
1773
+ if (!this.node.animationState || e === i)
1774
+ return;
1775
+ const o = this.node.animationState.setActive("exit", !e);
1776
+ n && !e && o.then(() => {
1777
+ n(this.id);
1778
+ });
1779
+ }
1780
+ mount() {
1781
+ const { register: e, onExitComplete: n } = this.node.presenceContext || {};
1782
+ n && n(this.id), e && (this.unmount = e(this.id));
1783
+ }
1784
+ unmount() {
1785
+ }
1786
+ }
1787
+ const xo = {
1788
+ animation: {
1789
+ Feature: yo
1790
+ },
1791
+ exit: {
1792
+ Feature: Po
1793
+ }
1794
+ };
1795
+ function it(t) {
1796
+ return {
1797
+ point: {
1798
+ x: t.pageX,
1799
+ y: t.pageY
1800
+ }
1801
+ };
1802
+ }
1803
+ const wo = (t) => (e) => _t(e) && t(e, it(e));
1804
+ function Q(t, e, n, i) {
1805
+ return et(t, e, wo(n), i);
1806
+ }
1807
+ const Wn = ({ current: t }) => t ? t.ownerDocument.defaultView : null, We = (t, e) => Math.abs(t - e);
1808
+ function To(t, e) {
1809
+ const n = We(t.x, e.x), i = We(t.y, e.y);
1810
+ return Math.sqrt(n ** 2 + i ** 2);
1811
+ }
1812
+ const He = /* @__PURE__ */ new Set(["auto", "scroll"]);
1813
+ class Hn {
1814
+ constructor(e, n, { transformPagePoint: i, contextWindow: o = window, dragSnapToOrigin: a = !1, distanceThreshold: s = 3, element: r } = {}) {
1815
+ 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 = (d) => {
1816
+ this.handleScroll(d.target);
1817
+ }, this.onWindowScroll = () => {
1818
+ this.handleScroll(window);
1819
+ }, this.updatePoint = () => {
1820
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
1821
+ return;
1822
+ const d = Rt(this.lastMoveEventInfo, this.history), m = this.startEvent !== null, P = To(d.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
1823
+ if (!m && !P)
1824
+ return;
1825
+ const { point: g } = d, { timestamp: p } = R;
1826
+ this.history.push({ ...g, timestamp: p });
1827
+ const { onStart: y, onMove: v } = this.handlers;
1828
+ m || (y && y(this.lastMoveEvent, d), this.startEvent = this.lastMoveEvent), v && v(this.lastMoveEvent, d);
1829
+ }, this.handlePointerMove = (d, m) => {
1830
+ this.lastMoveEvent = d, this.lastMoveEventInfo = Vt(m, this.transformPagePoint), A.update(this.updatePoint, !0);
1831
+ }, this.handlePointerUp = (d, m) => {
1832
+ this.end();
1833
+ const { onEnd: P, onSessionEnd: g, resumeAnimation: p } = this.handlers;
1834
+ if ((this.dragSnapToOrigin || !this.startEvent) && p && p(), !(this.lastMoveEvent && this.lastMoveEventInfo))
1835
+ return;
1836
+ const y = Rt(d.type === "pointercancel" ? this.lastMoveEventInfo : Vt(m, this.transformPagePoint), this.history);
1837
+ this.startEvent && P && P(d, y), g && g(d, y);
1838
+ }, !_t(e))
1839
+ return;
1840
+ this.dragSnapToOrigin = a, this.handlers = n, this.transformPagePoint = i, this.distanceThreshold = s, this.contextWindow = o || window;
1841
+ const l = it(e), c = Vt(l, this.transformPagePoint), { point: u } = c, { timestamp: f } = R;
1842
+ this.history = [{ ...u, timestamp: f }];
1843
+ const { onSessionStart: h } = n;
1844
+ h && h(e, Rt(c, this.history)), this.removeListeners = hn(Q(this.contextWindow, "pointermove", this.handlePointerMove), Q(this.contextWindow, "pointerup", this.handlePointerUp), Q(this.contextWindow, "pointercancel", this.handlePointerUp)), r && this.startScrollTracking(r);
1845
+ }
1846
+ /**
1847
+ * Start tracking scroll on ancestors and window.
1848
+ */
1849
+ startScrollTracking(e) {
1850
+ let n = e.parentElement;
1851
+ for (; n; ) {
1852
+ const i = getComputedStyle(n);
1853
+ (He.has(i.overflowX) || He.has(i.overflowY)) && this.scrollPositions.set(n, {
1854
+ x: n.scrollLeft,
1855
+ y: n.scrollTop
1856
+ }), n = n.parentElement;
1857
+ }
1858
+ this.scrollPositions.set(window, {
1859
+ x: window.scrollX,
1860
+ y: window.scrollY
1861
+ }), window.addEventListener("scroll", this.onElementScroll, {
1862
+ capture: !0
1863
+ }), window.addEventListener("scroll", this.onWindowScroll), this.removeScrollListeners = () => {
1864
+ window.removeEventListener("scroll", this.onElementScroll, {
1865
+ capture: !0
1866
+ }), window.removeEventListener("scroll", this.onWindowScroll);
1867
+ };
1868
+ }
1869
+ /**
1870
+ * Handle scroll compensation during drag.
1871
+ *
1872
+ * For element scroll: adjusts history origin since pageX/pageY doesn't change.
1873
+ * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
1874
+ */
1875
+ handleScroll(e) {
1876
+ const n = this.scrollPositions.get(e);
1877
+ if (!n)
1878
+ return;
1879
+ const i = e === window, o = i ? { x: window.scrollX, y: window.scrollY } : {
1880
+ x: e.scrollLeft,
1881
+ y: e.scrollTop
1882
+ }, a = { x: o.x - n.x, y: o.y - n.y };
1883
+ a.x === 0 && a.y === 0 || (i ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += a.x, this.lastMoveEventInfo.point.y += a.y) : this.history.length > 0 && (this.history[0].x -= a.x, this.history[0].y -= a.y), this.scrollPositions.set(e, o), A.update(this.updatePoint, !0));
1884
+ }
1885
+ updateHandlers(e) {
1886
+ this.handlers = e;
1887
+ }
1888
+ end() {
1889
+ this.removeListeners && this.removeListeners(), this.removeScrollListeners && this.removeScrollListeners(), this.scrollPositions.clear(), tt(this.updatePoint);
1890
+ }
1891
+ }
1892
+ function Vt(t, e) {
1893
+ return e ? { point: e(t.point) } : t;
1894
+ }
1895
+ function Ne(t, e) {
1896
+ return { x: t.x - e.x, y: t.y - e.y };
1897
+ }
1898
+ function Rt({ point: t }, e) {
1899
+ return {
1900
+ point: t,
1901
+ delta: Ne(t, Nn(e)),
1902
+ offset: Ne(t, So(e)),
1903
+ velocity: Eo(e, 0.1)
1904
+ };
1905
+ }
1906
+ function So(t) {
1907
+ return t[0];
1908
+ }
1909
+ function Nn(t) {
1910
+ return t[t.length - 1];
1911
+ }
1912
+ function Eo(t, e) {
1913
+ if (t.length < 2)
1914
+ return { x: 0, y: 0 };
1915
+ let n = t.length - 1, i = null;
1916
+ const o = Nn(t);
1917
+ for (; n >= 0 && (i = t[n], !(o.timestamp - i.timestamp > se(e))); )
1918
+ n--;
1919
+ if (!i)
1920
+ return { x: 0, y: 0 };
1921
+ i === t[0] && t.length > 2 && o.timestamp - i.timestamp > se(e) * 2 && (i = t[1]);
1922
+ const a = Di(o.timestamp - i.timestamp);
1923
+ if (a === 0)
1924
+ return { x: 0, y: 0 };
1925
+ const s = {
1926
+ x: (o.x - i.x) / a,
1927
+ y: (o.y - i.y) / a
1928
+ };
1929
+ return s.x === 1 / 0 && (s.x = 0), s.y === 1 / 0 && (s.y = 0), s;
1930
+ }
1931
+ function Do(t, { min: e, max: n }, i) {
1932
+ return e !== void 0 && t < e ? t = i ? D(e, t, i.min) : Math.max(t, e) : n !== void 0 && t > n && (t = i ? D(n, t, i.max) : Math.min(t, n)), t;
1933
+ }
1934
+ function ze(t, e, n) {
1935
+ return {
1936
+ min: e !== void 0 ? t.min + e : void 0,
1937
+ max: n !== void 0 ? t.max + n - (t.max - t.min) : void 0
1938
+ };
1939
+ }
1940
+ function Ao(t, { top: e, left: n, bottom: i, right: o }) {
1941
+ return {
1942
+ x: ze(t.x, n, o),
1943
+ y: ze(t.y, e, i)
1944
+ };
1945
+ }
1946
+ function Ge(t, e) {
1947
+ let n = e.min - t.min, i = e.max - t.max;
1948
+ return e.max - e.min < t.max - t.min && ([n, i] = [i, n]), { min: n, max: i };
1949
+ }
1950
+ function Co(t, e) {
1951
+ return {
1952
+ x: Ge(t.x, e.x),
1953
+ y: Ge(t.y, e.y)
1954
+ };
1955
+ }
1956
+ function Lo(t, e) {
1957
+ let n = 0.5;
1958
+ const i = L(t), o = L(e);
1959
+ return o > i ? n = jt(e.min, e.max - i, t.min) : i > o && (n = jt(t.min, t.max - o, e.min)), rn(0, 1, n);
1960
+ }
1961
+ function Vo(t, e) {
1962
+ const n = {};
1963
+ return e.min !== void 0 && (n.min = e.min - t.min), e.max !== void 0 && (n.max = e.max - t.min), n;
1964
+ }
1965
+ const Ft = 0.35;
1966
+ function Ro(t = Ft) {
1967
+ return t === !1 ? t = 0 : t === !0 && (t = Ft), {
1968
+ x: $e(t, "left", "right"),
1969
+ y: $e(t, "top", "bottom")
1970
+ };
1971
+ }
1972
+ function $e(t, e, n) {
1973
+ return {
1974
+ min: Xe(t, e),
1975
+ max: Xe(t, n)
1976
+ };
1977
+ }
1978
+ function Xe(t, e) {
1979
+ return typeof t == "number" ? t : t[e] || 0;
1980
+ }
1981
+ const bo = /* @__PURE__ */ new WeakMap();
1982
+ class Mo {
1983
+ constructor(e) {
1984
+ this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = E(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
1985
+ }
1986
+ start(e, { snapToCursor: n = !1, distanceThreshold: i } = {}) {
1987
+ const { presenceContext: o } = this.visualElement;
1988
+ if (o && o.isPresent === !1)
1989
+ return;
1990
+ const a = (f) => {
1991
+ n && this.snapToCursor(it(f).point), this.stopAnimation();
1992
+ }, s = (f, h) => {
1993
+ const { drag: d, dragPropagation: m, onDragStart: P } = this.getProps();
1994
+ if (d && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = Mi(d), !this.openDragLock))
1995
+ return;
1996
+ this.latestPointerEvent = f, this.latestPanInfo = h, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), I((p) => {
1997
+ let y = this.getAxisMotionValue(p).get() || 0;
1998
+ if (gt.test(y)) {
1999
+ const { projection: v } = this.visualElement;
2000
+ if (v && v.layout) {
2001
+ const x = v.layout.layoutBox[p];
2002
+ x && (y = L(x) * (parseFloat(y) / 100));
2003
+ }
2004
+ }
2005
+ this.originPoint[p] = y;
2006
+ }), P && A.update(() => P(f, h), !1, !0), oe(this.visualElement, "transform");
2007
+ const { animationState: g } = this.visualElement;
2008
+ g && g.setActive("whileDrag", !0);
2009
+ }, r = (f, h) => {
2010
+ this.latestPointerEvent = f, this.latestPanInfo = h;
2011
+ const { dragPropagation: d, dragDirectionLock: m, onDirectionLock: P, onDrag: g } = this.getProps();
2012
+ if (!d && !this.openDragLock)
2013
+ return;
2014
+ const { offset: p } = h;
2015
+ if (m && this.currentDirection === null) {
2016
+ this.currentDirection = jo(p), this.currentDirection !== null && P && P(this.currentDirection);
2017
+ return;
2018
+ }
2019
+ this.updateAxis("x", h.point, p), this.updateAxis("y", h.point, p), this.visualElement.render(), g && A.update(() => g(f, h), !1, !0);
2020
+ }, l = (f, h) => {
2021
+ this.latestPointerEvent = f, this.latestPanInfo = h, this.stop(f, h), this.latestPointerEvent = null, this.latestPanInfo = null;
2022
+ }, c = () => {
2023
+ const { dragSnapToOrigin: f } = this.getProps();
2024
+ (f || this.constraints) && this.startAnimation({ x: 0, y: 0 });
2025
+ }, { dragSnapToOrigin: u } = this.getProps();
2026
+ this.panSession = new Hn(e, {
2027
+ onSessionStart: a,
2028
+ onStart: s,
2029
+ onMove: r,
2030
+ onSessionEnd: l,
2031
+ resumeAnimation: c
2032
+ }, {
2033
+ transformPagePoint: this.visualElement.getTransformPagePoint(),
2034
+ dragSnapToOrigin: u,
2035
+ distanceThreshold: i,
2036
+ contextWindow: Wn(this.visualElement),
2037
+ element: this.visualElement.current
2038
+ });
2039
+ }
2040
+ /**
2041
+ * @internal
2042
+ */
2043
+ stop(e, n) {
2044
+ const i = e || this.latestPointerEvent, o = n || this.latestPanInfo, a = this.isDragging;
2045
+ if (this.cancel(), !a || !o || !i)
2046
+ return;
2047
+ const { velocity: s } = o;
2048
+ this.startAnimation(s);
2049
+ const { onDragEnd: r } = this.getProps();
2050
+ r && A.postRender(() => r(i, o));
2051
+ }
2052
+ /**
2053
+ * @internal
2054
+ */
2055
+ cancel() {
2056
+ this.isDragging = !1;
2057
+ const { projection: e, animationState: n } = this.visualElement;
2058
+ e && (e.isAnimationBlocked = !1), this.endPanSession();
2059
+ const { dragPropagation: i } = this.getProps();
2060
+ !i && this.openDragLock && (this.openDragLock(), this.openDragLock = null), n && n.setActive("whileDrag", !1);
2061
+ }
2062
+ /**
2063
+ * Clean up the pan session without modifying other drag state.
2064
+ * This is used during unmount to ensure event listeners are removed
2065
+ * without affecting projection animations or drag locks.
2066
+ * @internal
2067
+ */
2068
+ endPanSession() {
2069
+ this.panSession && this.panSession.end(), this.panSession = void 0;
2070
+ }
2071
+ updateAxis(e, n, i) {
2072
+ const { drag: o } = this.getProps();
2073
+ if (!i || !lt(e, o, this.currentDirection))
2074
+ return;
2075
+ const a = this.getAxisMotionValue(e);
2076
+ let s = this.originPoint[e] + i[e];
2077
+ this.constraints && this.constraints[e] && (s = Do(s, this.constraints[e], this.elastic[e])), a.set(s);
2078
+ }
2079
+ resolveConstraints() {
2080
+ const { dragConstraints: e, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, o = this.constraints;
2081
+ e && X(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && i ? this.constraints = Ao(i.layoutBox, e) : this.constraints = !1, this.elastic = Ro(n), o !== this.constraints && !X(e) && i && this.constraints && !this.hasMutatedConstraints && I((a) => {
2082
+ this.constraints !== !1 && this.getAxisMotionValue(a) && (this.constraints[a] = Vo(i.layoutBox[a], this.constraints[a]));
2083
+ });
2084
+ }
2085
+ resolveRefConstraints() {
2086
+ const { dragConstraints: e, onMeasureDragConstraints: n } = this.getProps();
2087
+ if (!e || !X(e))
2088
+ return !1;
2089
+ const i = e.current;
2090
+ un(i !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
2091
+ const { projection: o } = this.visualElement;
2092
+ if (!o || !o.layout)
2093
+ return !1;
2094
+ const a = Ai(i, o.root, this.visualElement.getTransformPagePoint());
2095
+ let s = Co(o.layout.layoutBox, a);
2096
+ if (n) {
2097
+ const r = n(Ci(s));
2098
+ this.hasMutatedConstraints = !!r, r && (s = Li(r));
2099
+ }
2100
+ return s;
2101
+ }
2102
+ startAnimation(e) {
2103
+ const { drag: n, dragMomentum: i, dragElastic: o, dragTransition: a, dragSnapToOrigin: s, onDragTransitionEnd: r } = this.getProps(), l = this.constraints || {}, c = I((u) => {
2104
+ if (!lt(u, n, this.currentDirection))
2105
+ return;
2106
+ let f = l && l[u] || {};
2107
+ s && (f = { min: 0, max: 0 });
2108
+ const h = o ? 200 : 1e6, d = o ? 40 : 1e7, m = {
2109
+ type: "inertia",
2110
+ velocity: i ? e[u] : 0,
2111
+ bounceStiffness: h,
2112
+ bounceDamping: d,
2113
+ timeConstant: 750,
2114
+ restDelta: 1,
2115
+ restSpeed: 10,
2116
+ ...a,
2117
+ ...f
2118
+ };
2119
+ return this.startAxisValueAnimation(u, m);
2120
+ });
2121
+ return Promise.all(c).then(r);
2122
+ }
2123
+ startAxisValueAnimation(e, n) {
2124
+ const i = this.getAxisMotionValue(e);
2125
+ return oe(this.visualElement, e), i.start(Vi(e, i, 0, n, this.visualElement, !1));
2126
+ }
2127
+ stopAnimation() {
2128
+ I((e) => this.getAxisMotionValue(e).stop());
2129
+ }
2130
+ /**
2131
+ * Drag works differently depending on which props are provided.
2132
+ *
2133
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
2134
+ * - Otherwise, we apply the delta to the x/y motion values.
2135
+ */
2136
+ getAxisMotionValue(e) {
2137
+ const n = `_drag${e.toUpperCase()}`, i = this.visualElement.getProps(), o = i[n];
2138
+ return o || this.visualElement.getValue(e, (i.initial ? i.initial[e] : void 0) || 0);
2139
+ }
2140
+ snapToCursor(e) {
2141
+ I((n) => {
2142
+ const { drag: i } = this.getProps();
2143
+ if (!lt(n, i, this.currentDirection))
2144
+ return;
2145
+ const { projection: o } = this.visualElement, a = this.getAxisMotionValue(n);
2146
+ if (o && o.layout) {
2147
+ const { min: s, max: r } = o.layout.layoutBox[n], l = a.get() || 0;
2148
+ a.set(e[n] - D(s, r, 0.5) + l);
2149
+ }
2150
+ });
2151
+ }
2152
+ /**
2153
+ * When the viewport resizes we want to check if the measured constraints
2154
+ * have changed and, if so, reposition the element within those new constraints
2155
+ * relative to where it was before the resize.
2156
+ */
2157
+ scalePositionWithinConstraints() {
2158
+ if (!this.visualElement.current)
2159
+ return;
2160
+ const { drag: e, dragConstraints: n } = this.getProps(), { projection: i } = this.visualElement;
2161
+ if (!X(n) || !i || !this.constraints)
2162
+ return;
2163
+ this.stopAnimation();
2164
+ const o = { x: 0, y: 0 };
2165
+ I((s) => {
2166
+ const r = this.getAxisMotionValue(s);
2167
+ if (r && this.constraints !== !1) {
2168
+ const l = r.get();
2169
+ o[s] = Lo({ min: l, max: l }, this.constraints[s]);
2170
+ }
2171
+ });
2172
+ const { transformTemplate: a } = this.visualElement.getProps();
2173
+ this.visualElement.current.style.transform = a ? a({}, "") : "none", i.root && i.root.updateScroll(), i.updateLayout(), this.constraints = !1, this.resolveConstraints(), I((s) => {
2174
+ if (!lt(s, e, null))
2175
+ return;
2176
+ const r = this.getAxisMotionValue(s), { min: l, max: c } = this.constraints[s];
2177
+ r.set(D(l, c, o[s]));
2178
+ }), this.visualElement.render();
2179
+ }
2180
+ addListeners() {
2181
+ if (!this.visualElement.current)
2182
+ return;
2183
+ bo.set(this.visualElement, this);
2184
+ const e = this.visualElement.current, n = Q(e, "pointerdown", (c) => {
2185
+ const { drag: u, dragListener: f = !0 } = this.getProps(), h = c.target, d = h !== e && Fi(h);
2186
+ u && f && !d && this.start(c);
2187
+ });
2188
+ let i;
2189
+ const o = () => {
2190
+ const { dragConstraints: c } = this.getProps();
2191
+ X(c) && c.current && (this.constraints = this.resolveRefConstraints(), i || (i = ko(e, c.current, () => this.scalePositionWithinConstraints())));
2192
+ }, { projection: a } = this.visualElement, s = a.addEventListener("measure", o);
2193
+ a && !a.layout && (a.root && a.root.updateScroll(), a.updateLayout()), A.read(o);
2194
+ const r = et(window, "resize", () => this.scalePositionWithinConstraints()), l = a.addEventListener("didUpdate", (({ delta: c, hasLayoutChanged: u }) => {
2195
+ this.isDragging && u && (I((f) => {
2196
+ const h = this.getAxisMotionValue(f);
2197
+ h && (this.originPoint[f] += c[f].translate, h.set(h.get() + c[f].translate));
2198
+ }), this.visualElement.render());
2199
+ }));
2200
+ return () => {
2201
+ r(), n(), s(), l && l(), i && i();
2202
+ };
2203
+ }
2204
+ getProps() {
2205
+ const e = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: i = !1, dragPropagation: o = !1, dragConstraints: a = !1, dragElastic: s = Ft, dragMomentum: r = !0 } = e;
2206
+ return {
2207
+ ...e,
2208
+ drag: n,
2209
+ dragDirectionLock: i,
2210
+ dragPropagation: o,
2211
+ dragConstraints: a,
2212
+ dragElastic: s,
2213
+ dragMomentum: r
2214
+ };
2215
+ }
2216
+ }
2217
+ function Ye(t) {
2218
+ let e = !0;
2219
+ return () => {
2220
+ if (e) {
2221
+ e = !1;
2222
+ return;
2223
+ }
2224
+ t();
2225
+ };
2226
+ }
2227
+ function ko(t, e, n) {
2228
+ const i = ce(t, Ye(n)), o = ce(e, Ye(n));
2229
+ return () => {
2230
+ i(), o();
2231
+ };
2232
+ }
2233
+ function lt(t, e, n) {
2234
+ return (e === !0 || e === t) && (n === null || n === t);
2235
+ }
2236
+ function jo(t, e = 10) {
2237
+ let n = null;
2238
+ return Math.abs(t.y) > e ? n = "y" : Math.abs(t.x) > e && (n = "x"), n;
2239
+ }
2240
+ class Io extends U {
2241
+ constructor(e) {
2242
+ super(e), this.removeGroupControls = K, this.removeListeners = K, this.controls = new Mo(e);
2243
+ }
2244
+ mount() {
2245
+ const { dragControls: e } = this.node.getProps();
2246
+ e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || K;
2247
+ }
2248
+ update() {
2249
+ const { dragControls: e } = this.node.getProps(), { dragControls: n } = this.node.prevProps || {};
2250
+ e !== n && (this.removeGroupControls(), e && (this.removeGroupControls = e.subscribe(this.controls)));
2251
+ }
2252
+ unmount() {
2253
+ this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
2254
+ }
2255
+ }
2256
+ const bt = (t) => (e, n) => {
2257
+ t && A.update(() => t(e, n), !1, !0);
2258
+ };
2259
+ class Bo extends U {
2260
+ constructor() {
2261
+ super(...arguments), this.removePointerDownListener = K;
2262
+ }
2263
+ onPointerDown(e) {
2264
+ this.session = new Hn(e, this.createPanHandlers(), {
2265
+ transformPagePoint: this.node.getTransformPagePoint(),
2266
+ contextWindow: Wn(this.node)
2267
+ });
2268
+ }
2269
+ createPanHandlers() {
2270
+ const { onPanSessionStart: e, onPanStart: n, onPan: i, onPanEnd: o } = this.node.getProps();
2271
+ return {
2272
+ onSessionStart: bt(e),
2273
+ onStart: bt(n),
2274
+ onMove: bt(i),
2275
+ onEnd: (a, s) => {
2276
+ delete this.session, o && A.postRender(() => o(a, s));
2277
+ }
2278
+ };
2279
+ }
2280
+ mount() {
2281
+ this.removePointerDownListener = Q(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
2282
+ }
2283
+ update() {
2284
+ this.session && this.session.updateHandlers(this.createPanHandlers());
2285
+ }
2286
+ unmount() {
2287
+ this.removePointerDownListener(), this.session && this.session.end();
2288
+ }
2289
+ }
2290
+ let Mt = !1;
2291
+ class Oo extends Jn {
2292
+ /**
2293
+ * This only mounts projection nodes for components that
2294
+ * need measuring, we might want to do it for all components
2295
+ * in order to incorporate transforms
2296
+ */
2297
+ componentDidMount() {
2298
+ const { visualElement: e, layoutGroup: n, switchLayoutGroup: i, layoutId: o } = this.props, { projection: a } = e;
2299
+ a && (n.group && n.group.add(a), i && i.register && o && i.register(a), Mt && a.root.didUpdate(), a.addEventListener("animationComplete", () => {
2300
+ this.safeToRemove();
2301
+ }), a.setOptions({
2302
+ ...a.options,
2303
+ layoutDependency: this.props.layoutDependency,
2304
+ onExitComplete: () => this.safeToRemove()
2305
+ })), mt.hasEverUpdated = !0;
2306
+ }
2307
+ getSnapshotBeforeUpdate(e) {
2308
+ const { layoutDependency: n, visualElement: i, drag: o, isPresent: a } = this.props, { projection: s } = i;
2309
+ return s && (s.isPresent = a, e.layoutDependency !== n && s.setOptions({
2310
+ ...s.options,
2311
+ layoutDependency: n
2312
+ }), Mt = !0, o || e.layoutDependency !== n || n === void 0 || e.isPresent !== a ? s.willUpdate() : this.safeToRemove(), e.isPresent !== a && (a ? s.promote() : s.relegate() || A.postRender(() => {
2313
+ const r = s.getStack();
2314
+ (!r || !r.members.length) && this.safeToRemove();
2315
+ }))), null;
2316
+ }
2317
+ componentDidUpdate() {
2318
+ const { projection: e } = this.props.visualElement;
2319
+ e && (e.root.didUpdate(), an.postRender(() => {
2320
+ !e.currentAnimation && e.isLead() && this.safeToRemove();
2321
+ }));
2322
+ }
2323
+ componentWillUnmount() {
2324
+ const { visualElement: e, layoutGroup: n, switchLayoutGroup: i } = this.props, { projection: o } = e;
2325
+ Mt = !0, o && (o.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(o), i && i.deregister && i.deregister(o));
2326
+ }
2327
+ safeToRemove() {
2328
+ const { safeToRemove: e } = this.props;
2329
+ e && e();
2330
+ }
2331
+ render() {
2332
+ return null;
2333
+ }
2334
+ }
2335
+ function zn(t) {
2336
+ const [e, n] = bn(), i = C(Yt);
2337
+ return N(Oo, { ...t, layoutGroup: i, switchLayoutGroup: C(Fn), isPresent: e, safeToRemove: n });
2338
+ }
2339
+ const Fo = {
2340
+ pan: {
2341
+ Feature: Bo
2342
+ },
2343
+ drag: {
2344
+ Feature: Io,
2345
+ ProjectionNode: Rn,
2346
+ MeasureLayout: zn
2347
+ }
2348
+ };
2349
+ function _e(t, e, n) {
2350
+ const { props: i } = t;
2351
+ t.animationState && i.whileHover && t.animationState.setActive("whileHover", n === "Start");
2352
+ const o = "onHover" + n, a = i[o];
2353
+ a && A.postRender(() => a(e, it(e)));
2354
+ }
2355
+ class Uo extends U {
2356
+ mount() {
2357
+ const { current: e } = this.node;
2358
+ e && (this.unmount = ji(e, (n, i) => (_e(this.node, i, "Start"), (o) => _e(this.node, o, "End"))));
2359
+ }
2360
+ unmount() {
2361
+ }
2362
+ }
2363
+ class Wo extends U {
2364
+ constructor() {
2365
+ super(...arguments), this.isActive = !1;
2366
+ }
2367
+ onFocus() {
2368
+ let e = !1;
2369
+ try {
2370
+ e = this.node.current.matches(":focus-visible");
2371
+ } catch {
2372
+ e = !0;
2373
+ }
2374
+ !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
2375
+ }
2376
+ onBlur() {
2377
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
2378
+ }
2379
+ mount() {
2380
+ this.unmount = hn(et(this.node.current, "focus", () => this.onFocus()), et(this.node.current, "blur", () => this.onBlur()));
2381
+ }
2382
+ unmount() {
2383
+ }
2384
+ }
2385
+ function Ke(t, e, n) {
2386
+ const { props: i } = t;
2387
+ if (t.current instanceof HTMLButtonElement && t.current.disabled)
2388
+ return;
2389
+ t.animationState && i.whileTap && t.animationState.setActive("whileTap", n === "Start");
2390
+ const o = "onTap" + (n === "End" ? "" : n), a = i[o];
2391
+ a && A.postRender(() => a(e, it(e)));
2392
+ }
2393
+ class Ho extends U {
2394
+ mount() {
2395
+ const { current: e } = this.node;
2396
+ if (!e)
2397
+ return;
2398
+ const { globalTapTarget: n, propagate: i } = this.node.props;
2399
+ this.unmount = Wi(e, (o, a) => (Ke(this.node, a, "Start"), (s, { success: r }) => Ke(this.node, s, r ? "End" : "Cancel")), {
2400
+ useGlobalTarget: n,
2401
+ stopPropagation: i?.tap === !1
2402
+ });
2403
+ }
2404
+ unmount() {
2405
+ }
2406
+ }
2407
+ const Ut = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), No = (t) => {
2408
+ const e = Ut.get(t.target);
2409
+ e && e(t);
2410
+ }, zo = (t) => {
2411
+ t.forEach(No);
2412
+ };
2413
+ function Go({ root: t, ...e }) {
2414
+ const n = t || document;
2415
+ kt.has(n) || kt.set(n, {});
2416
+ const i = kt.get(n), o = JSON.stringify(e);
2417
+ return i[o] || (i[o] = new IntersectionObserver(zo, { root: t, ...e })), i[o];
2418
+ }
2419
+ function $o(t, e, n) {
2420
+ const i = Go(e);
2421
+ return Ut.set(t, n), i.observe(t), () => {
2422
+ Ut.delete(t), i.unobserve(t);
2423
+ };
2424
+ }
2425
+ const Xo = {
2426
+ some: 0,
2427
+ all: 1
2428
+ };
2429
+ class Yo extends U {
2430
+ constructor() {
2431
+ super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
2432
+ }
2433
+ startObserver() {
2434
+ this.unmount();
2435
+ const { viewport: e = {} } = this.node.getProps(), { root: n, margin: i, amount: o = "some", once: a } = e, s = {
2436
+ root: n ? n.current : void 0,
2437
+ rootMargin: i,
2438
+ threshold: typeof o == "number" ? o : Xo[o]
2439
+ }, r = (l) => {
2440
+ const { isIntersecting: c } = l;
2441
+ if (this.isInView === c || (this.isInView = c, a && !c && this.hasEnteredView))
2442
+ return;
2443
+ c && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", c);
2444
+ const { onViewportEnter: u, onViewportLeave: f } = this.node.getProps(), h = c ? u : f;
2445
+ h && h(l);
2446
+ };
2447
+ return $o(this.node.current, s, r);
2448
+ }
2449
+ mount() {
2450
+ this.startObserver();
2451
+ }
2452
+ update() {
2453
+ if (typeof IntersectionObserver > "u")
2454
+ return;
2455
+ const { props: e, prevProps: n } = this.node;
2456
+ ["amount", "margin", "root"].some(_o(e, n)) && this.startObserver();
2457
+ }
2458
+ unmount() {
2459
+ }
2460
+ }
2461
+ function _o({ viewport: t = {} }, { viewport: e = {} } = {}) {
2462
+ return (n) => t[n] !== e[n];
2463
+ }
2464
+ const Ko = {
2465
+ inView: {
2466
+ Feature: Yo
2467
+ },
2468
+ tap: {
2469
+ Feature: Ho
2470
+ },
2471
+ focus: {
2472
+ Feature: Wo
2473
+ },
2474
+ hover: {
2475
+ Feature: Uo
2476
+ }
2477
+ }, qo = {
2478
+ layout: {
2479
+ ProjectionNode: Rn,
2480
+ MeasureLayout: zn
2481
+ }
2482
+ }, Zo = {
2483
+ ...xo,
2484
+ ...Ko,
2485
+ ...Fo,
2486
+ ...qo
2487
+ }, sr = /* @__PURE__ */ po(Zo, go);
2488
+ export {
2489
+ ir as A,
2490
+ Yt as L,
2491
+ Ys as l,
2492
+ sr as m,
2493
+ dn as u
2494
+ };
2495
+ //# sourceMappingURL=proxy-BZcQiBrp.js.map