@konstructio/ui 0.1.2-alpha.74 → 0.1.2-alpha.76

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