@altinn/altinn-components 0.24.6 → 0.24.8

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 (268) hide show
  1. package/dist/altinn-ds-overrides.css +9 -14
  2. package/dist/altinn-ds.css +18 -18
  3. package/dist/altinn-theme.css +5 -6
  4. package/dist/assets/ActionHeader.css +1 -1
  5. package/dist/assets/Badge.css +1 -1
  6. package/dist/assets/ButtonBase.css +1 -1
  7. package/dist/assets/DatepickerTable.css +1 -1
  8. package/dist/assets/DialogListItem.css +1 -1
  9. package/dist/assets/DialogSelect.css +1 -1
  10. package/dist/assets/DropdownBase.css +1 -1
  11. package/dist/assets/Icon.css +1 -1
  12. package/dist/assets/LayoutBase.css +1 -1
  13. package/dist/assets/ListItemBase.css +1 -1
  14. package/dist/assets/ListItemHeader.css +1 -1
  15. package/dist/assets/ListItemLabel.css +1 -1
  16. package/dist/assets/ListItemSelect.css +1 -1
  17. package/dist/assets/MenuBase.css +1 -1
  18. package/dist/assets/MenuInputField.css +1 -1
  19. package/dist/assets/MenuItemBase.css +1 -1
  20. package/dist/assets/MetaItemBase.css +1 -1
  21. package/dist/assets/PageMenu.css +1 -1
  22. package/dist/assets/ProgressIcon.css +1 -1
  23. package/dist/assets/SnackbarItem.css +1 -1
  24. package/dist/assets/TimelineBase.css +1 -1
  25. package/dist/components/Badge/Badge.js +6 -6
  26. package/dist/components/Button/ButtonBase.js +14 -14
  27. package/dist/components/Datepicker/DatepickerTable.js +1 -1
  28. package/dist/components/Dialog/DialogActivityLog.js +1 -1
  29. package/dist/components/Dialog/DialogLayout.js +13 -14
  30. package/dist/components/Dialog/DialogList.js +11 -11
  31. package/dist/components/Dialog/DialogListItem.js +68 -68
  32. package/dist/components/Dialog/DialogSeenBy.js +4 -4
  33. package/dist/components/Dialog/DialogSelect.js +9 -9
  34. package/dist/components/Dialog/DialogStatus.js +2 -2
  35. package/dist/components/Dropdown/DropdownBase.js +5 -5
  36. package/dist/components/DsComponents/index.js +17 -16
  37. package/dist/components/Icon/Icon.js +4 -4
  38. package/dist/components/Icon/ProgressIcon.js +7 -7
  39. package/dist/components/Layout/LayoutBase.js +1 -1
  40. package/dist/components/LayoutAction/ActionHeader.js +14 -14
  41. package/dist/components/List/ListItemBase.js +19 -19
  42. package/dist/components/List/ListItemHeader.js +32 -32
  43. package/dist/components/List/ListItemLabel.js +11 -11
  44. package/dist/components/List/ListItemSelect.js +7 -7
  45. package/dist/components/Menu/MenuBase.js +10 -10
  46. package/dist/components/Menu/MenuInputField.js +10 -10
  47. package/dist/components/Menu/MenuItemBase.js +27 -27
  48. package/dist/components/Meta/MetaItemBase.js +19 -19
  49. package/dist/components/Meta/Metadata.js +24 -0
  50. package/dist/components/Meta/index.js +15 -15
  51. package/dist/components/Page/AccordionSection.js +16 -0
  52. package/dist/components/Page/ArticleHeader.js +16 -0
  53. package/dist/components/Page/ContactButtons.js +12 -0
  54. package/dist/components/Page/ContactSection.js +20 -21
  55. package/dist/components/Page/DashboardCard.js +49 -0
  56. package/dist/components/Page/DashboardHeader.js +24 -0
  57. package/dist/components/Page/PageDetails.js +9 -0
  58. package/dist/components/Page/PageMenu.js +6 -6
  59. package/dist/components/Page/index.js +28 -18
  60. package/dist/components/Profile/AccountList.js +12 -0
  61. package/dist/components/Profile/AccountListItem.js +88 -0
  62. package/dist/components/Profile/index.js +6 -0
  63. package/dist/components/Snackbar/SnackbarItem.js +12 -12
  64. package/dist/components/Timeline/TimelineBase.js +19 -19
  65. package/dist/components/index.js +184 -169
  66. package/dist/floating-ui.react-BQwG1HOM.js +2840 -0
  67. package/dist/global.css +3 -2
  68. package/dist/index-C8BS_2GY.js +64 -0
  69. package/dist/index-DcykCrjD.js +115 -0
  70. package/dist/index.js +190 -175
  71. package/dist/padding.css +22 -0
  72. package/dist/tokens/$metadata.json +10 -5
  73. package/dist/tokens/$themes.json +46 -14
  74. package/dist/tokens/README.md +8 -7
  75. package/dist/tokens/alert.css +8 -6
  76. package/dist/tokens/alert.json +18 -14
  77. package/dist/tokens/altinn-ds/color/alert.css +8 -6
  78. package/dist/tokens/altinn-ds/color/article.css +8 -6
  79. package/dist/tokens/altinn-ds/color/company.css +6 -5
  80. package/dist/tokens/altinn-ds/color/danger.css +25 -0
  81. package/dist/tokens/altinn-ds/color/info.css +25 -0
  82. package/dist/tokens/altinn-ds/color/neutral.css +25 -0
  83. package/dist/tokens/altinn-ds/color/person.css +8 -6
  84. package/dist/tokens/altinn-ds/color/success.css +25 -0
  85. package/dist/tokens/altinn-ds/color/warning.css +25 -0
  86. package/dist/tokens/altinn-ds/color-scheme/dark.css +252 -412
  87. package/dist/tokens/altinn-ds/color-scheme/light.css +222 -382
  88. package/dist/tokens/altinn-ds/semantic.css +54 -54
  89. package/dist/tokens/altinn-ds/typography/primary.css +10 -15
  90. package/dist/tokens/altinn-ds/typography/secondary.css +10 -15
  91. package/dist/tokens/altinn-ds.css +682 -987
  92. package/dist/tokens/altinn-ds.json +14 -12
  93. package/dist/tokens/article.css +8 -6
  94. package/dist/tokens/article.json +18 -14
  95. package/dist/tokens/color/alert.css +8 -6
  96. package/dist/tokens/color/article.css +8 -6
  97. package/dist/tokens/color/company.css +6 -5
  98. package/dist/tokens/color/danger.css +25 -0
  99. package/dist/tokens/color/info.css +25 -0
  100. package/dist/tokens/color/neutral.css +25 -0
  101. package/dist/tokens/color/person.css +8 -6
  102. package/dist/tokens/color/success.css +25 -0
  103. package/dist/tokens/color/warning.css +25 -0
  104. package/dist/tokens/color-scheme/dark/altinn-ds.json +100 -80
  105. package/dist/tokens/color-scheme/dark/global.json +99 -141
  106. package/dist/tokens/color-scheme/dark.css +252 -412
  107. package/dist/tokens/color-scheme/light/altinn-ds.json +94 -74
  108. package/dist/tokens/color-scheme/light/global.json +90 -132
  109. package/dist/tokens/color-scheme/light.css +222 -382
  110. package/dist/tokens/color.json +185 -141
  111. package/dist/tokens/colors.d.ts +2 -2
  112. package/dist/tokens/company.css +6 -5
  113. package/dist/tokens/company.json +18 -14
  114. package/dist/tokens/danger.css +25 -0
  115. package/dist/tokens/dark/altinn-ds.json +100 -80
  116. package/dist/tokens/dark/global.json +99 -141
  117. package/dist/tokens/dark.css +252 -412
  118. package/dist/tokens/design-tokens/$metadata.json +10 -5
  119. package/dist/tokens/design-tokens/$themes.json +46 -14
  120. package/dist/tokens/design-tokens/primitives/globals.json +2 -14
  121. package/dist/tokens/design-tokens/primitives/modes/color-scheme/dark/altinn-ds.json +100 -80
  122. package/dist/tokens/design-tokens/primitives/modes/color-scheme/dark/global.json +99 -141
  123. package/dist/tokens/design-tokens/primitives/modes/color-scheme/light/altinn-ds.json +94 -74
  124. package/dist/tokens/design-tokens/primitives/modes/color-scheme/light/global.json +90 -132
  125. package/dist/tokens/design-tokens/primitives/modes/size/global.json +21 -21
  126. package/dist/tokens/design-tokens/primitives/modes/typography/primary/altinn-ds.json +14 -12
  127. package/dist/tokens/design-tokens/primitives/modes/typography/secondary/altinn-ds.json +14 -12
  128. package/dist/tokens/design-tokens/primitives/modes/typography/size/large.json +8 -12
  129. package/dist/tokens/design-tokens/primitives/modes/typography/size/medium.json +8 -12
  130. package/dist/tokens/design-tokens/primitives/modes/typography/size/small.json +8 -12
  131. package/dist/tokens/design-tokens/semantic/color.json +185 -141
  132. package/dist/tokens/design-tokens/semantic/modes/main-color/company.json +18 -14
  133. package/dist/tokens/design-tokens/semantic/modes/main-color/person.json +18 -14
  134. package/dist/tokens/design-tokens/semantic/modes/support-color/alert.json +18 -14
  135. package/dist/tokens/design-tokens/semantic/modes/support-color/article.json +18 -14
  136. package/dist/tokens/design-tokens/semantic/style.json +104 -182
  137. package/dist/tokens/design-tokens/themes/altinn-ds.json +61 -39
  138. package/dist/tokens/design-tokens-build/altinn-ds/color/alert.css +8 -6
  139. package/dist/tokens/design-tokens-build/altinn-ds/color/article.css +8 -6
  140. package/dist/tokens/design-tokens-build/altinn-ds/color/company.css +6 -5
  141. package/dist/tokens/design-tokens-build/altinn-ds/color/danger.css +25 -0
  142. package/dist/tokens/design-tokens-build/altinn-ds/color/info.css +25 -0
  143. package/dist/tokens/design-tokens-build/altinn-ds/color/neutral.css +25 -0
  144. package/dist/tokens/design-tokens-build/altinn-ds/color/person.css +8 -6
  145. package/dist/tokens/design-tokens-build/altinn-ds/color/success.css +25 -0
  146. package/dist/tokens/design-tokens-build/altinn-ds/color/warning.css +25 -0
  147. package/dist/tokens/design-tokens-build/altinn-ds/color-scheme/dark.css +252 -412
  148. package/dist/tokens/design-tokens-build/altinn-ds/color-scheme/light.css +222 -382
  149. package/dist/tokens/design-tokens-build/altinn-ds/semantic.css +54 -54
  150. package/dist/tokens/design-tokens-build/altinn-ds/typography/primary.css +10 -15
  151. package/dist/tokens/design-tokens-build/altinn-ds/typography/secondary.css +10 -15
  152. package/dist/tokens/design-tokens-build/altinn-ds.css +682 -987
  153. package/dist/tokens/design-tokens-build/colors.d.ts +2 -2
  154. package/dist/tokens/global.json +90 -132
  155. package/dist/tokens/globals.json +2 -14
  156. package/dist/tokens/info.css +25 -0
  157. package/dist/tokens/large.json +8 -12
  158. package/dist/tokens/light/altinn-ds.json +94 -74
  159. package/dist/tokens/light/global.json +90 -132
  160. package/dist/tokens/light.css +222 -382
  161. package/dist/tokens/main-color/company.json +18 -14
  162. package/dist/tokens/main-color/person.json +18 -14
  163. package/dist/tokens/medium.json +8 -12
  164. package/dist/tokens/modes/color-scheme/dark/altinn-ds.json +100 -80
  165. package/dist/tokens/modes/color-scheme/dark/global.json +99 -141
  166. package/dist/tokens/modes/color-scheme/light/altinn-ds.json +94 -74
  167. package/dist/tokens/modes/color-scheme/light/global.json +90 -132
  168. package/dist/tokens/modes/main-color/company.json +18 -14
  169. package/dist/tokens/modes/main-color/person.json +18 -14
  170. package/dist/tokens/modes/size/global.json +21 -21
  171. package/dist/tokens/modes/support-color/alert.json +18 -14
  172. package/dist/tokens/modes/support-color/article.json +18 -14
  173. package/dist/tokens/modes/typography/primary/altinn-ds.json +14 -12
  174. package/dist/tokens/modes/typography/secondary/altinn-ds.json +14 -12
  175. package/dist/tokens/modes/typography/size/large.json +8 -12
  176. package/dist/tokens/modes/typography/size/medium.json +8 -12
  177. package/dist/tokens/modes/typography/size/small.json +8 -12
  178. package/dist/tokens/neutral.css +25 -0
  179. package/dist/tokens/person.css +8 -6
  180. package/dist/tokens/person.json +18 -14
  181. package/dist/tokens/primary/altinn-ds.json +14 -12
  182. package/dist/tokens/primary.css +10 -15
  183. package/dist/tokens/primitives/globals.json +2 -14
  184. package/dist/tokens/primitives/modes/color-scheme/dark/altinn-ds.json +100 -80
  185. package/dist/tokens/primitives/modes/color-scheme/dark/global.json +99 -141
  186. package/dist/tokens/primitives/modes/color-scheme/light/altinn-ds.json +94 -74
  187. package/dist/tokens/primitives/modes/color-scheme/light/global.json +90 -132
  188. package/dist/tokens/primitives/modes/size/global.json +21 -21
  189. package/dist/tokens/primitives/modes/typography/primary/altinn-ds.json +14 -12
  190. package/dist/tokens/primitives/modes/typography/secondary/altinn-ds.json +14 -12
  191. package/dist/tokens/primitives/modes/typography/size/large.json +8 -12
  192. package/dist/tokens/primitives/modes/typography/size/medium.json +8 -12
  193. package/dist/tokens/primitives/modes/typography/size/small.json +8 -12
  194. package/dist/tokens/secondary/altinn-ds.json +14 -12
  195. package/dist/tokens/secondary.css +10 -15
  196. package/dist/tokens/semantic/color.json +185 -141
  197. package/dist/tokens/semantic/modes/main-color/company.json +18 -14
  198. package/dist/tokens/semantic/modes/main-color/person.json +18 -14
  199. package/dist/tokens/semantic/modes/support-color/alert.json +18 -14
  200. package/dist/tokens/semantic/modes/support-color/article.json +18 -14
  201. package/dist/tokens/semantic/style.json +104 -182
  202. package/dist/tokens/semantic.css +54 -54
  203. package/dist/tokens/size/global.json +21 -21
  204. package/dist/tokens/size/large.json +8 -12
  205. package/dist/tokens/size/medium.json +8 -12
  206. package/dist/tokens/size/small.json +8 -12
  207. package/dist/tokens/small.json +8 -12
  208. package/dist/tokens/style.json +104 -182
  209. package/dist/tokens/success.css +25 -0
  210. package/dist/tokens/support-color/alert.json +18 -14
  211. package/dist/tokens/support-color/article.json +18 -14
  212. package/dist/tokens/themes/altinn-ds.json +61 -39
  213. package/dist/tokens/typography/primary/altinn-ds.json +14 -12
  214. package/dist/tokens/typography/primary.css +10 -15
  215. package/dist/tokens/typography/secondary/altinn-ds.json +14 -12
  216. package/dist/tokens/typography/secondary.css +10 -15
  217. package/dist/tokens/typography/size/large.json +8 -12
  218. package/dist/tokens/typography/size/medium.json +8 -12
  219. package/dist/tokens/typography/size/small.json +8 -12
  220. package/dist/tokens/warning.css +25 -0
  221. package/dist/types/lib/components/Dialog/DialogList.d.ts +2 -1
  222. package/dist/types/lib/components/Dialog/DialogList.stories.d.ts +2 -1
  223. package/dist/types/lib/components/Menu/Examples.stories.d.ts +17 -0
  224. package/dist/types/lib/components/Meta/MetaItemBase.d.ts +1 -1
  225. package/dist/types/lib/components/Meta/{MetaList.d.ts → Metadata.d.ts} +6 -4
  226. package/dist/types/lib/components/Meta/index.d.ts +1 -1
  227. package/dist/types/lib/components/Page/AccordionSection.d.ts +10 -0
  228. package/dist/types/lib/components/Page/ArticleHeader.d.ts +8 -0
  229. package/dist/types/lib/components/Page/ArticleHeader.stories.d.ts +14 -0
  230. package/dist/types/lib/components/Page/ContactButtons.d.ts +7 -0
  231. package/dist/types/lib/components/Page/ContactSection.d.ts +2 -2
  232. package/dist/types/lib/components/Page/DashboardCard.d.ts +10 -0
  233. package/dist/types/lib/components/Page/DashboardHeader.d.ts +10 -0
  234. package/dist/types/lib/components/Page/PageDetails.d.ts +6 -0
  235. package/dist/types/lib/components/Page/Patterns.stories.d.ts +14 -1
  236. package/dist/types/lib/components/Page/index.d.ts +7 -2
  237. package/dist/types/lib/components/Profile/AccountList.d.ts +5 -0
  238. package/dist/types/lib/components/{Meta/MetaList.stories.d.ts → Profile/AccountList.stories.d.ts} +2 -4
  239. package/dist/types/lib/components/Profile/AccountListItem.d.ts +11 -0
  240. package/dist/types/lib/components/Profile/index.d.ts +2 -0
  241. package/dist/types/lib/components/index.d.ts +1 -0
  242. package/dist/usePagination-B2I-a3Aq.js +1089 -0
  243. package/package.json +3 -1
  244. package/dist/assets/MetaList.css +0 -1
  245. package/dist/companyMenuItems-E0wNQAfZ.js +0 -105
  246. package/dist/components/Meta/MetaList.js +0 -22
  247. package/dist/components/Page/Article.js +0 -6
  248. package/dist/tokens/Figma/components.json +0 -22
  249. package/dist/tokens/accent.css +0 -23
  250. package/dist/tokens/accent.json +0 -66
  251. package/dist/tokens/altinn-ds/builtin-colors.css +0 -87
  252. package/dist/tokens/altinn-ds/color/accent.css +0 -23
  253. package/dist/tokens/builtin-colors.css +0 -87
  254. package/dist/tokens/color/accent.css +0 -23
  255. package/dist/tokens/components.json +0 -22
  256. package/dist/tokens/default.json +0 -175
  257. package/dist/tokens/design-tokens/Figma/components.json +0 -22
  258. package/dist/tokens/design-tokens/primitives/size/default.json +0 -175
  259. package/dist/tokens/design-tokens/semantic/modes/main-color/accent.json +0 -66
  260. package/dist/tokens/design-tokens-build/altinn-ds/builtin-colors.css +0 -87
  261. package/dist/tokens/design-tokens-build/altinn-ds/color/accent.css +0 -23
  262. package/dist/tokens/main-color/accent.json +0 -66
  263. package/dist/tokens/modes/main-color/accent.json +0 -66
  264. package/dist/tokens/primitives/size/default.json +0 -175
  265. package/dist/tokens/semantic/modes/main-color/accent.json +0 -66
  266. package/dist/tokens/size/default.json +0 -175
  267. package/dist/types/lib/components/Page/Article.d.ts +0 -6
  268. package/dist/usePagination-CBMPUKt_.js +0 -4073
@@ -0,0 +1,2840 @@
1
+ import * as m from "react";
2
+ import { useLayoutEffect as bn, useEffect as xn, useRef as Zn } from "react";
3
+ import * as vn from "react-dom";
4
+ function No() {
5
+ for (var e, t = 0, n = "", r = arguments.length; t < r; t++) (e = arguments[t]) && typeof e == "string" && (n += (n && " ") + e);
6
+ return n;
7
+ }
8
+ function xt() {
9
+ return typeof window < "u";
10
+ }
11
+ function Oe(e) {
12
+ return yn(e) ? (e.nodeName || "").toLowerCase() : "#document";
13
+ }
14
+ function ue(e) {
15
+ var t;
16
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
17
+ }
18
+ function he(e) {
19
+ var t;
20
+ return (t = (yn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
21
+ }
22
+ function yn(e) {
23
+ return xt() ? e instanceof Node || e instanceof ue(e).Node : !1;
24
+ }
25
+ function U(e) {
26
+ return xt() ? e instanceof Element || e instanceof ue(e).Element : !1;
27
+ }
28
+ function X(e) {
29
+ return xt() ? e instanceof HTMLElement || e instanceof ue(e).HTMLElement : !1;
30
+ }
31
+ function Ft(e) {
32
+ return !xt() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ue(e).ShadowRoot;
33
+ }
34
+ function Ze(e) {
35
+ const {
36
+ overflow: t,
37
+ overflowX: n,
38
+ overflowY: r,
39
+ display: o
40
+ } = le(e);
41
+ return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o);
42
+ }
43
+ function Jn(e) {
44
+ return ["table", "td", "th"].includes(Oe(e));
45
+ }
46
+ function vt(e) {
47
+ return [":popover-open", ":modal"].some((t) => {
48
+ try {
49
+ return e.matches(t);
50
+ } catch {
51
+ return !1;
52
+ }
53
+ });
54
+ }
55
+ function Wt(e) {
56
+ const t = Bt(), n = U(e) ? le(e) : e;
57
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r));
58
+ }
59
+ function Qn(e) {
60
+ let t = ve(e);
61
+ for (; X(t) && !Ae(t); ) {
62
+ if (Wt(t))
63
+ return t;
64
+ if (vt(t))
65
+ return null;
66
+ t = ve(t);
67
+ }
68
+ return null;
69
+ }
70
+ function Bt() {
71
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
72
+ }
73
+ function Ae(e) {
74
+ return ["html", "body", "#document"].includes(Oe(e));
75
+ }
76
+ function le(e) {
77
+ return ue(e).getComputedStyle(e);
78
+ }
79
+ function yt(e) {
80
+ return U(e) ? {
81
+ scrollLeft: e.scrollLeft,
82
+ scrollTop: e.scrollTop
83
+ } : {
84
+ scrollLeft: e.scrollX,
85
+ scrollTop: e.scrollY
86
+ };
87
+ }
88
+ function ve(e) {
89
+ if (Oe(e) === "html")
90
+ return e;
91
+ const t = (
92
+ // Step into the shadow DOM of the parent of a slotted node.
93
+ e.assignedSlot || // DOM Element detected.
94
+ e.parentNode || // ShadowRoot detected.
95
+ Ft(e) && e.host || // Fallback.
96
+ he(e)
97
+ );
98
+ return Ft(t) ? t.host : t;
99
+ }
100
+ function wn(e) {
101
+ const t = ve(e);
102
+ return Ae(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : X(t) && Ze(t) ? t : wn(t);
103
+ }
104
+ function Te(e, t, n) {
105
+ var r;
106
+ t === void 0 && (t = []), n === void 0 && (n = !0);
107
+ const o = wn(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = ue(o);
108
+ if (i) {
109
+ const u = Pt(s);
110
+ return t.concat(s, s.visualViewport || [], Ze(o) ? o : [], u && n ? Te(u) : []);
111
+ }
112
+ return t.concat(o, Te(o, [], n));
113
+ }
114
+ function Pt(e) {
115
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
116
+ }
117
+ function xe(e) {
118
+ let t = e.activeElement;
119
+ for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
120
+ var n;
121
+ t = t.shadowRoot.activeElement;
122
+ }
123
+ return t;
124
+ }
125
+ function ne(e, t) {
126
+ if (!e || !t)
127
+ return !1;
128
+ const n = t.getRootNode == null ? void 0 : t.getRootNode();
129
+ if (e.contains(t))
130
+ return !0;
131
+ if (n && Ft(n)) {
132
+ let r = t;
133
+ for (; r; ) {
134
+ if (e === r)
135
+ return !0;
136
+ r = r.parentNode || r.host;
137
+ }
138
+ }
139
+ return !1;
140
+ }
141
+ function Rn() {
142
+ const e = navigator.userAgentData;
143
+ return e != null && e.platform ? e.platform : navigator.platform;
144
+ }
145
+ function En() {
146
+ const e = navigator.userAgentData;
147
+ return e && Array.isArray(e.brands) ? e.brands.map((t) => {
148
+ let {
149
+ brand: n,
150
+ version: r
151
+ } = t;
152
+ return n + "/" + r;
153
+ }).join(" ") : navigator.userAgent;
154
+ }
155
+ function In(e) {
156
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : kt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
157
+ }
158
+ function Cn(e) {
159
+ return tr() ? !1 : !kt() && e.width === 0 && e.height === 0 || kt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
160
+ e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
161
+ }
162
+ function Tn() {
163
+ return /apple/i.test(navigator.vendor);
164
+ }
165
+ function kt() {
166
+ const e = /android/i;
167
+ return e.test(Rn()) || e.test(En());
168
+ }
169
+ function er() {
170
+ return Rn().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
171
+ }
172
+ function tr() {
173
+ return En().includes("jsdom/");
174
+ }
175
+ function nr(e) {
176
+ return "nativeEvent" in e;
177
+ }
178
+ function rr(e) {
179
+ return e.matches("html,body");
180
+ }
181
+ function se(e) {
182
+ return (e == null ? void 0 : e.ownerDocument) || document;
183
+ }
184
+ function Et(e, t) {
185
+ if (t == null)
186
+ return !1;
187
+ if ("composedPath" in e)
188
+ return e.composedPath().includes(t);
189
+ const n = e;
190
+ return n.target != null && t.contains(n.target);
191
+ }
192
+ function Fe(e) {
193
+ return "composedPath" in e ? e.composedPath()[0] : e.target;
194
+ }
195
+ const or = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
196
+ function ir(e) {
197
+ return X(e) && e.matches(or);
198
+ }
199
+ function re(e) {
200
+ e.preventDefault(), e.stopPropagation();
201
+ }
202
+ function An(e) {
203
+ return e ? e.getAttribute("role") === "combobox" && ir(e) : !1;
204
+ }
205
+ const Be = Math.min, ce = Math.max, lt = Math.round, Ne = Math.floor, pe = (e) => ({
206
+ x: e,
207
+ y: e
208
+ }), sr = {
209
+ left: "right",
210
+ right: "left",
211
+ bottom: "top",
212
+ top: "bottom"
213
+ }, cr = {
214
+ start: "end",
215
+ end: "start"
216
+ };
217
+ function Gt(e, t, n) {
218
+ return ce(e, Be(t, n));
219
+ }
220
+ function Je(e, t) {
221
+ return typeof e == "function" ? e(t) : e;
222
+ }
223
+ function Se(e) {
224
+ return e.split("-")[0];
225
+ }
226
+ function Qe(e) {
227
+ return e.split("-")[1];
228
+ }
229
+ function Sn(e) {
230
+ return e === "x" ? "y" : "x";
231
+ }
232
+ function On(e) {
233
+ return e === "y" ? "height" : "width";
234
+ }
235
+ function Pe(e) {
236
+ return ["top", "bottom"].includes(Se(e)) ? "y" : "x";
237
+ }
238
+ function Mn(e) {
239
+ return Sn(Pe(e));
240
+ }
241
+ function ur(e, t, n) {
242
+ n === void 0 && (n = !1);
243
+ const r = Qe(e), o = Mn(e), i = On(o);
244
+ let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
245
+ return t.reference[i] > t.floating[i] && (s = at(s)), [s, at(s)];
246
+ }
247
+ function lr(e) {
248
+ const t = at(e);
249
+ return [Lt(e), t, Lt(t)];
250
+ }
251
+ function Lt(e) {
252
+ return e.replace(/start|end/g, (t) => cr[t]);
253
+ }
254
+ function ar(e, t, n) {
255
+ const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
256
+ switch (e) {
257
+ case "top":
258
+ case "bottom":
259
+ return n ? t ? o : r : t ? r : o;
260
+ case "left":
261
+ case "right":
262
+ return t ? i : s;
263
+ default:
264
+ return [];
265
+ }
266
+ }
267
+ function fr(e, t, n, r) {
268
+ const o = Qe(e);
269
+ let i = ar(Se(e), n === "start", r);
270
+ return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(Lt)))), i;
271
+ }
272
+ function at(e) {
273
+ return e.replace(/left|right|bottom|top/g, (t) => sr[t]);
274
+ }
275
+ function dr(e) {
276
+ return {
277
+ top: 0,
278
+ right: 0,
279
+ bottom: 0,
280
+ left: 0,
281
+ ...e
282
+ };
283
+ }
284
+ function mr(e) {
285
+ return typeof e != "number" ? dr(e) : {
286
+ top: e,
287
+ right: e,
288
+ bottom: e,
289
+ left: e
290
+ };
291
+ }
292
+ function ft(e) {
293
+ const {
294
+ x: t,
295
+ y: n,
296
+ width: r,
297
+ height: o
298
+ } = e;
299
+ return {
300
+ width: r,
301
+ height: o,
302
+ top: n,
303
+ left: t,
304
+ right: t + r,
305
+ bottom: n + o,
306
+ x: t,
307
+ y: n
308
+ };
309
+ }
310
+ /*!
311
+ * tabbable 6.2.0
312
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
313
+ */
314
+ var gr = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], dt = /* @__PURE__ */ gr.join(","), Dn = typeof Element > "u", _e = Dn ? function() {
315
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, mt = !Dn && Element.prototype.getRootNode ? function(e) {
316
+ var t;
317
+ return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
318
+ } : function(e) {
319
+ return e == null ? void 0 : e.ownerDocument;
320
+ }, gt = function e(t, n) {
321
+ var r;
322
+ n === void 0 && (n = !0);
323
+ var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), i = o === "" || o === "true", s = i || n && t && e(t.parentNode);
324
+ return s;
325
+ }, pr = function(t) {
326
+ var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
327
+ return r === "" || r === "true";
328
+ }, hr = function(t, n, r) {
329
+ if (gt(t))
330
+ return [];
331
+ var o = Array.prototype.slice.apply(t.querySelectorAll(dt));
332
+ return n && _e.call(t, dt) && o.unshift(t), o = o.filter(r), o;
333
+ }, br = function e(t, n, r) {
334
+ for (var o = [], i = Array.from(t); i.length; ) {
335
+ var s = i.shift();
336
+ if (!gt(s, !1))
337
+ if (s.tagName === "SLOT") {
338
+ var u = s.assignedElements(), l = u.length ? u : s.children, c = e(l, !0, r);
339
+ r.flatten ? o.push.apply(o, c) : o.push({
340
+ scopeParent: s,
341
+ candidates: c
342
+ });
343
+ } else {
344
+ var d = _e.call(s, dt);
345
+ d && r.filter(s) && (n || !t.includes(s)) && o.push(s);
346
+ var a = s.shadowRoot || // check for an undisclosed shadow
347
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(s), p = !gt(a, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
348
+ if (a && p) {
349
+ var f = e(a === !0 ? s.children : a.children, !0, r);
350
+ r.flatten ? o.push.apply(o, f) : o.push({
351
+ scopeParent: s,
352
+ candidates: f
353
+ });
354
+ } else
355
+ i.unshift.apply(i, s.children);
356
+ }
357
+ }
358
+ return o;
359
+ }, Fn = function(t) {
360
+ return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
361
+ }, Pn = function(t) {
362
+ if (!t)
363
+ throw new Error("No node provided");
364
+ return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || pr(t)) && !Fn(t) ? 0 : t.tabIndex;
365
+ }, xr = function(t, n) {
366
+ var r = Pn(t);
367
+ return r < 0 && n && !Fn(t) ? 0 : r;
368
+ }, vr = function(t, n) {
369
+ return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
370
+ }, kn = function(t) {
371
+ return t.tagName === "INPUT";
372
+ }, yr = function(t) {
373
+ return kn(t) && t.type === "hidden";
374
+ }, wr = function(t) {
375
+ var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
376
+ return r.tagName === "SUMMARY";
377
+ });
378
+ return n;
379
+ }, Rr = function(t, n) {
380
+ for (var r = 0; r < t.length; r++)
381
+ if (t[r].checked && t[r].form === n)
382
+ return t[r];
383
+ }, Er = function(t) {
384
+ if (!t.name)
385
+ return !0;
386
+ var n = t.form || mt(t), r = function(u) {
387
+ return n.querySelectorAll('input[type="radio"][name="' + u + '"]');
388
+ }, o;
389
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
390
+ o = r(window.CSS.escape(t.name));
391
+ else
392
+ try {
393
+ o = r(t.name);
394
+ } catch (s) {
395
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", s.message), !1;
396
+ }
397
+ var i = Rr(o, t.form);
398
+ return !i || i === t;
399
+ }, Ir = function(t) {
400
+ return kn(t) && t.type === "radio";
401
+ }, Cr = function(t) {
402
+ return Ir(t) && !Er(t);
403
+ }, Tr = function(t) {
404
+ var n, r = t && mt(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
405
+ if (r && r !== t) {
406
+ var s, u, l;
407
+ for (i = !!((s = o) !== null && s !== void 0 && (u = s.ownerDocument) !== null && u !== void 0 && u.contains(o) || t != null && (l = t.ownerDocument) !== null && l !== void 0 && l.contains(t)); !i && o; ) {
408
+ var c, d, a;
409
+ r = mt(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, i = !!((d = o) !== null && d !== void 0 && (a = d.ownerDocument) !== null && a !== void 0 && a.contains(o));
410
+ }
411
+ }
412
+ return i;
413
+ }, Xt = function(t) {
414
+ var n = t.getBoundingClientRect(), r = n.width, o = n.height;
415
+ return r === 0 && o === 0;
416
+ }, Ar = function(t, n) {
417
+ var r = n.displayCheck, o = n.getShadowRoot;
418
+ if (getComputedStyle(t).visibility === "hidden")
419
+ return !0;
420
+ var i = _e.call(t, "details>summary:first-of-type"), s = i ? t.parentElement : t;
421
+ if (_e.call(s, "details:not([open]) *"))
422
+ return !0;
423
+ if (!r || r === "full" || r === "legacy-full") {
424
+ if (typeof o == "function") {
425
+ for (var u = t; t; ) {
426
+ var l = t.parentElement, c = mt(t);
427
+ if (l && !l.shadowRoot && o(l) === !0)
428
+ return Xt(t);
429
+ t.assignedSlot ? t = t.assignedSlot : !l && c !== t.ownerDocument ? t = c.host : t = l;
430
+ }
431
+ t = u;
432
+ }
433
+ if (Tr(t))
434
+ return !t.getClientRects().length;
435
+ if (r !== "legacy-full")
436
+ return !0;
437
+ } else if (r === "non-zero-area")
438
+ return Xt(t);
439
+ return !1;
440
+ }, Sr = function(t) {
441
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
442
+ for (var n = t.parentElement; n; ) {
443
+ if (n.tagName === "FIELDSET" && n.disabled) {
444
+ for (var r = 0; r < n.children.length; r++) {
445
+ var o = n.children.item(r);
446
+ if (o.tagName === "LEGEND")
447
+ return _e.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
448
+ }
449
+ return !0;
450
+ }
451
+ n = n.parentElement;
452
+ }
453
+ return !1;
454
+ }, Or = function(t, n) {
455
+ return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
456
+ // because we're limited in the type of selectors we can use in JSDom (see related
457
+ // note related to `candidateSelectors`)
458
+ gt(n) || yr(n) || Ar(n, t) || // For a details element with a summary, the summary element gets the focus
459
+ wr(n) || Sr(n));
460
+ }, Nt = function(t, n) {
461
+ return !(Cr(n) || Pn(n) < 0 || !Or(t, n));
462
+ }, Mr = function(t) {
463
+ var n = parseInt(t.getAttribute("tabindex"), 10);
464
+ return !!(isNaN(n) || n >= 0);
465
+ }, Dr = function e(t) {
466
+ var n = [], r = [];
467
+ return t.forEach(function(o, i) {
468
+ var s = !!o.scopeParent, u = s ? o.scopeParent : o, l = xr(u, s), c = s ? e(o.candidates) : u;
469
+ l === 0 ? s ? n.push.apply(n, c) : n.push(u) : r.push({
470
+ documentOrder: i,
471
+ tabIndex: l,
472
+ item: o,
473
+ isScope: s,
474
+ content: c
475
+ });
476
+ }), r.sort(vr).reduce(function(o, i) {
477
+ return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
478
+ }, []).concat(n);
479
+ }, Ge = function(t, n) {
480
+ n = n || {};
481
+ var r;
482
+ return n.getShadowRoot ? r = br([t], n.includeContainer, {
483
+ filter: Nt.bind(null, n),
484
+ flatten: !1,
485
+ getShadowRoot: n.getShadowRoot,
486
+ shadowRootFilter: Mr
487
+ }) : r = hr(t, n.includeContainer, Nt.bind(null, n)), Dr(r);
488
+ }, Fr = function(t, n) {
489
+ if (n = n || {}, !t)
490
+ throw new Error("No node provided");
491
+ return _e.call(t, dt) === !1 ? !1 : Nt(n, t);
492
+ };
493
+ function Zt(e, t, n) {
494
+ let {
495
+ reference: r,
496
+ floating: o
497
+ } = e;
498
+ const i = Pe(t), s = Mn(t), u = On(s), l = Se(t), c = i === "y", d = r.x + r.width / 2 - o.width / 2, a = r.y + r.height / 2 - o.height / 2, p = r[u] / 2 - o[u] / 2;
499
+ let f;
500
+ switch (l) {
501
+ case "top":
502
+ f = {
503
+ x: d,
504
+ y: r.y - o.height
505
+ };
506
+ break;
507
+ case "bottom":
508
+ f = {
509
+ x: d,
510
+ y: r.y + r.height
511
+ };
512
+ break;
513
+ case "right":
514
+ f = {
515
+ x: r.x + r.width,
516
+ y: a
517
+ };
518
+ break;
519
+ case "left":
520
+ f = {
521
+ x: r.x - o.width,
522
+ y: a
523
+ };
524
+ break;
525
+ default:
526
+ f = {
527
+ x: r.x,
528
+ y: r.y
529
+ };
530
+ }
531
+ switch (Qe(t)) {
532
+ case "start":
533
+ f[s] -= p * (n && c ? -1 : 1);
534
+ break;
535
+ case "end":
536
+ f[s] += p * (n && c ? -1 : 1);
537
+ break;
538
+ }
539
+ return f;
540
+ }
541
+ const Pr = async (e, t, n) => {
542
+ const {
543
+ placement: r = "bottom",
544
+ strategy: o = "absolute",
545
+ middleware: i = [],
546
+ platform: s
547
+ } = n, u = i.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(t));
548
+ let c = await s.getElementRects({
549
+ reference: e,
550
+ floating: t,
551
+ strategy: o
552
+ }), {
553
+ x: d,
554
+ y: a
555
+ } = Zt(c, r, l), p = r, f = {}, g = 0;
556
+ for (let h = 0; h < u.length; h++) {
557
+ const {
558
+ name: v,
559
+ fn: x
560
+ } = u[h], {
561
+ x: R,
562
+ y: b,
563
+ data: w,
564
+ reset: D
565
+ } = await x({
566
+ x: d,
567
+ y: a,
568
+ initialPlacement: r,
569
+ placement: p,
570
+ strategy: o,
571
+ middlewareData: f,
572
+ rects: c,
573
+ platform: s,
574
+ elements: {
575
+ reference: e,
576
+ floating: t
577
+ }
578
+ });
579
+ d = R ?? d, a = b ?? a, f = {
580
+ ...f,
581
+ [v]: {
582
+ ...f[v],
583
+ ...w
584
+ }
585
+ }, D && g <= 50 && (g++, typeof D == "object" && (D.placement && (p = D.placement), D.rects && (c = D.rects === !0 ? await s.getElementRects({
586
+ reference: e,
587
+ floating: t,
588
+ strategy: o
589
+ }) : D.rects), {
590
+ x: d,
591
+ y: a
592
+ } = Zt(c, p, l)), h = -1);
593
+ }
594
+ return {
595
+ x: d,
596
+ y: a,
597
+ placement: p,
598
+ strategy: o,
599
+ middlewareData: f
600
+ };
601
+ };
602
+ async function _t(e, t) {
603
+ var n;
604
+ t === void 0 && (t = {});
605
+ const {
606
+ x: r,
607
+ y: o,
608
+ platform: i,
609
+ rects: s,
610
+ elements: u,
611
+ strategy: l
612
+ } = e, {
613
+ boundary: c = "clippingAncestors",
614
+ rootBoundary: d = "viewport",
615
+ elementContext: a = "floating",
616
+ altBoundary: p = !1,
617
+ padding: f = 0
618
+ } = Je(t, e), g = mr(f), v = u[p ? a === "floating" ? "reference" : "floating" : a], x = ft(await i.getClippingRect({
619
+ element: (n = await (i.isElement == null ? void 0 : i.isElement(v))) == null || n ? v : v.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(u.floating)),
620
+ boundary: c,
621
+ rootBoundary: d,
622
+ strategy: l
623
+ })), R = a === "floating" ? {
624
+ x: r,
625
+ y: o,
626
+ width: s.floating.width,
627
+ height: s.floating.height
628
+ } : s.reference, b = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u.floating)), w = await (i.isElement == null ? void 0 : i.isElement(b)) ? await (i.getScale == null ? void 0 : i.getScale(b)) || {
629
+ x: 1,
630
+ y: 1
631
+ } : {
632
+ x: 1,
633
+ y: 1
634
+ }, D = ft(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
635
+ elements: u,
636
+ rect: R,
637
+ offsetParent: b,
638
+ strategy: l
639
+ }) : R);
640
+ return {
641
+ top: (x.top - D.top + g.top) / w.y,
642
+ bottom: (D.bottom - x.bottom + g.bottom) / w.y,
643
+ left: (x.left - D.left + g.left) / w.x,
644
+ right: (D.right - x.right + g.right) / w.x
645
+ };
646
+ }
647
+ const kr = function(e) {
648
+ return e === void 0 && (e = {}), {
649
+ name: "flip",
650
+ options: e,
651
+ async fn(t) {
652
+ var n, r;
653
+ const {
654
+ placement: o,
655
+ middlewareData: i,
656
+ rects: s,
657
+ initialPlacement: u,
658
+ platform: l,
659
+ elements: c
660
+ } = t, {
661
+ mainAxis: d = !0,
662
+ crossAxis: a = !0,
663
+ fallbackPlacements: p,
664
+ fallbackStrategy: f = "bestFit",
665
+ fallbackAxisSideDirection: g = "none",
666
+ flipAlignment: h = !0,
667
+ ...v
668
+ } = Je(e, t);
669
+ if ((n = i.arrow) != null && n.alignmentOffset)
670
+ return {};
671
+ const x = Se(o), R = Pe(u), b = Se(u) === u, w = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), D = p || (b || !h ? [at(u)] : lr(u)), k = g !== "none";
672
+ !p && k && D.push(...fr(u, h, g, w));
673
+ const B = [u, ...D], W = await _t(t, v), Z = [];
674
+ let H = ((r = i.flip) == null ? void 0 : r.overflows) || [];
675
+ if (d && Z.push(W[x]), a) {
676
+ const T = ur(o, s, w);
677
+ Z.push(W[T[0]], W[T[1]]);
678
+ }
679
+ if (H = [...H, {
680
+ placement: o,
681
+ overflows: Z
682
+ }], !Z.every((T) => T <= 0)) {
683
+ var $, C;
684
+ const T = ((($ = i.flip) == null ? void 0 : $.index) || 0) + 1, y = B[T];
685
+ if (y)
686
+ return {
687
+ data: {
688
+ index: T,
689
+ overflows: H
690
+ },
691
+ reset: {
692
+ placement: y
693
+ }
694
+ };
695
+ let O = (C = H.filter((F) => F.overflows[0] <= 0).sort((F, I) => F.overflows[1] - I.overflows[1])[0]) == null ? void 0 : C.placement;
696
+ if (!O)
697
+ switch (f) {
698
+ case "bestFit": {
699
+ var L;
700
+ const F = (L = H.filter((I) => {
701
+ if (k) {
702
+ const E = Pe(I.placement);
703
+ return E === R || // Create a bias to the `y` side axis due to horizontal
704
+ // reading directions favoring greater width.
705
+ E === "y";
706
+ }
707
+ return !0;
708
+ }).map((I) => [I.placement, I.overflows.filter((E) => E > 0).reduce((E, _) => E + _, 0)]).sort((I, E) => I[1] - E[1])[0]) == null ? void 0 : L[0];
709
+ F && (O = F);
710
+ break;
711
+ }
712
+ case "initialPlacement":
713
+ O = u;
714
+ break;
715
+ }
716
+ if (o !== O)
717
+ return {
718
+ reset: {
719
+ placement: O
720
+ }
721
+ };
722
+ }
723
+ return {};
724
+ }
725
+ };
726
+ };
727
+ async function Lr(e, t) {
728
+ const {
729
+ placement: n,
730
+ platform: r,
731
+ elements: o
732
+ } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = Se(n), u = Qe(n), l = Pe(n) === "y", c = ["left", "top"].includes(s) ? -1 : 1, d = i && l ? -1 : 1, a = Je(t, e);
733
+ let {
734
+ mainAxis: p,
735
+ crossAxis: f,
736
+ alignmentAxis: g
737
+ } = typeof a == "number" ? {
738
+ mainAxis: a,
739
+ crossAxis: 0,
740
+ alignmentAxis: null
741
+ } : {
742
+ mainAxis: a.mainAxis || 0,
743
+ crossAxis: a.crossAxis || 0,
744
+ alignmentAxis: a.alignmentAxis
745
+ };
746
+ return u && typeof g == "number" && (f = u === "end" ? g * -1 : g), l ? {
747
+ x: f * d,
748
+ y: p * c
749
+ } : {
750
+ x: p * c,
751
+ y: f * d
752
+ };
753
+ }
754
+ const Nr = function(e) {
755
+ return e === void 0 && (e = 0), {
756
+ name: "offset",
757
+ options: e,
758
+ async fn(t) {
759
+ var n, r;
760
+ const {
761
+ x: o,
762
+ y: i,
763
+ placement: s,
764
+ middlewareData: u
765
+ } = t, l = await Lr(t, e);
766
+ return s === ((n = u.offset) == null ? void 0 : n.placement) && (r = u.arrow) != null && r.alignmentOffset ? {} : {
767
+ x: o + l.x,
768
+ y: i + l.y,
769
+ data: {
770
+ ...l,
771
+ placement: s
772
+ }
773
+ };
774
+ }
775
+ };
776
+ }, Vr = function(e) {
777
+ return e === void 0 && (e = {}), {
778
+ name: "shift",
779
+ options: e,
780
+ async fn(t) {
781
+ const {
782
+ x: n,
783
+ y: r,
784
+ placement: o
785
+ } = t, {
786
+ mainAxis: i = !0,
787
+ crossAxis: s = !1,
788
+ limiter: u = {
789
+ fn: (v) => {
790
+ let {
791
+ x,
792
+ y: R
793
+ } = v;
794
+ return {
795
+ x,
796
+ y: R
797
+ };
798
+ }
799
+ },
800
+ ...l
801
+ } = Je(e, t), c = {
802
+ x: n,
803
+ y: r
804
+ }, d = await _t(t, l), a = Pe(Se(o)), p = Sn(a);
805
+ let f = c[p], g = c[a];
806
+ if (i) {
807
+ const v = p === "y" ? "top" : "left", x = p === "y" ? "bottom" : "right", R = f + d[v], b = f - d[x];
808
+ f = Gt(R, f, b);
809
+ }
810
+ if (s) {
811
+ const v = a === "y" ? "top" : "left", x = a === "y" ? "bottom" : "right", R = g + d[v], b = g - d[x];
812
+ g = Gt(R, g, b);
813
+ }
814
+ const h = u.fn({
815
+ ...t,
816
+ [p]: f,
817
+ [a]: g
818
+ });
819
+ return {
820
+ ...h,
821
+ data: {
822
+ x: h.x - n,
823
+ y: h.y - r,
824
+ enabled: {
825
+ [p]: i,
826
+ [a]: s
827
+ }
828
+ }
829
+ };
830
+ }
831
+ };
832
+ }, Wr = function(e) {
833
+ return e === void 0 && (e = {}), {
834
+ name: "size",
835
+ options: e,
836
+ async fn(t) {
837
+ var n, r;
838
+ const {
839
+ placement: o,
840
+ rects: i,
841
+ platform: s,
842
+ elements: u
843
+ } = t, {
844
+ apply: l = () => {
845
+ },
846
+ ...c
847
+ } = Je(e, t), d = await _t(t, c), a = Se(o), p = Qe(o), f = Pe(o) === "y", {
848
+ width: g,
849
+ height: h
850
+ } = i.floating;
851
+ let v, x;
852
+ a === "top" || a === "bottom" ? (v = a, x = p === (await (s.isRTL == null ? void 0 : s.isRTL(u.floating)) ? "start" : "end") ? "left" : "right") : (x = a, v = p === "end" ? "top" : "bottom");
853
+ const R = h - d.top - d.bottom, b = g - d.left - d.right, w = Be(h - d[v], R), D = Be(g - d[x], b), k = !t.middlewareData.shift;
854
+ let B = w, W = D;
855
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (W = b), (r = t.middlewareData.shift) != null && r.enabled.y && (B = R), k && !p) {
856
+ const H = ce(d.left, 0), $ = ce(d.right, 0), C = ce(d.top, 0), L = ce(d.bottom, 0);
857
+ f ? W = g - 2 * (H !== 0 || $ !== 0 ? H + $ : ce(d.left, d.right)) : B = h - 2 * (C !== 0 || L !== 0 ? C + L : ce(d.top, d.bottom));
858
+ }
859
+ await l({
860
+ ...t,
861
+ availableWidth: W,
862
+ availableHeight: B
863
+ });
864
+ const Z = await s.getDimensions(u.floating);
865
+ return g !== Z.width || h !== Z.height ? {
866
+ reset: {
867
+ rects: !0
868
+ }
869
+ } : {};
870
+ }
871
+ };
872
+ };
873
+ function Ln(e) {
874
+ const t = le(e);
875
+ let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
876
+ const o = X(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, u = lt(n) !== i || lt(r) !== s;
877
+ return u && (n = i, r = s), {
878
+ width: n,
879
+ height: r,
880
+ $: u
881
+ };
882
+ }
883
+ function $t(e) {
884
+ return U(e) ? e : e.contextElement;
885
+ }
886
+ function Ve(e) {
887
+ const t = $t(e);
888
+ if (!X(t))
889
+ return pe(1);
890
+ const n = t.getBoundingClientRect(), {
891
+ width: r,
892
+ height: o,
893
+ $: i
894
+ } = Ln(t);
895
+ let s = (i ? lt(n.width) : n.width) / r, u = (i ? lt(n.height) : n.height) / o;
896
+ return (!s || !Number.isFinite(s)) && (s = 1), (!u || !Number.isFinite(u)) && (u = 1), {
897
+ x: s,
898
+ y: u
899
+ };
900
+ }
901
+ const Br = /* @__PURE__ */ pe(0);
902
+ function Nn(e) {
903
+ const t = ue(e);
904
+ return !Bt() || !t.visualViewport ? Br : {
905
+ x: t.visualViewport.offsetLeft,
906
+ y: t.visualViewport.offsetTop
907
+ };
908
+ }
909
+ function _r(e, t, n) {
910
+ return t === void 0 && (t = !1), !n || t && n !== ue(e) ? !1 : t;
911
+ }
912
+ function ke(e, t, n, r) {
913
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
914
+ const o = e.getBoundingClientRect(), i = $t(e);
915
+ let s = pe(1);
916
+ t && (r ? U(r) && (s = Ve(r)) : s = Ve(e));
917
+ const u = _r(i, n, r) ? Nn(i) : pe(0);
918
+ let l = (o.left + u.x) / s.x, c = (o.top + u.y) / s.y, d = o.width / s.x, a = o.height / s.y;
919
+ if (i) {
920
+ const p = ue(i), f = r && U(r) ? ue(r) : r;
921
+ let g = p, h = Pt(g);
922
+ for (; h && r && f !== g; ) {
923
+ const v = Ve(h), x = h.getBoundingClientRect(), R = le(h), b = x.left + (h.clientLeft + parseFloat(R.paddingLeft)) * v.x, w = x.top + (h.clientTop + parseFloat(R.paddingTop)) * v.y;
924
+ l *= v.x, c *= v.y, d *= v.x, a *= v.y, l += b, c += w, g = ue(h), h = Pt(g);
925
+ }
926
+ }
927
+ return ft({
928
+ width: d,
929
+ height: a,
930
+ x: l,
931
+ y: c
932
+ });
933
+ }
934
+ function Kt(e, t) {
935
+ const n = yt(e).scrollLeft;
936
+ return t ? t.left + n : ke(he(e)).left + n;
937
+ }
938
+ function Vn(e, t, n) {
939
+ n === void 0 && (n = !1);
940
+ const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
941
+ // RTL <body> scrollbar.
942
+ Kt(e, r)
943
+ )), i = r.top + t.scrollTop;
944
+ return {
945
+ x: o,
946
+ y: i
947
+ };
948
+ }
949
+ function $r(e) {
950
+ let {
951
+ elements: t,
952
+ rect: n,
953
+ offsetParent: r,
954
+ strategy: o
955
+ } = e;
956
+ const i = o === "fixed", s = he(r), u = t ? vt(t.floating) : !1;
957
+ if (r === s || u && i)
958
+ return n;
959
+ let l = {
960
+ scrollLeft: 0,
961
+ scrollTop: 0
962
+ }, c = pe(1);
963
+ const d = pe(0), a = X(r);
964
+ if ((a || !a && !i) && ((Oe(r) !== "body" || Ze(s)) && (l = yt(r)), X(r))) {
965
+ const f = ke(r);
966
+ c = Ve(r), d.x = f.x + r.clientLeft, d.y = f.y + r.clientTop;
967
+ }
968
+ const p = s && !a && !i ? Vn(s, l, !0) : pe(0);
969
+ return {
970
+ width: n.width * c.x,
971
+ height: n.height * c.y,
972
+ x: n.x * c.x - l.scrollLeft * c.x + d.x + p.x,
973
+ y: n.y * c.y - l.scrollTop * c.y + d.y + p.y
974
+ };
975
+ }
976
+ function Kr(e) {
977
+ return Array.from(e.getClientRects());
978
+ }
979
+ function Hr(e) {
980
+ const t = he(e), n = yt(e), r = e.ownerDocument.body, o = ce(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = ce(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
981
+ let s = -n.scrollLeft + Kt(e);
982
+ const u = -n.scrollTop;
983
+ return le(r).direction === "rtl" && (s += ce(t.clientWidth, r.clientWidth) - o), {
984
+ width: o,
985
+ height: i,
986
+ x: s,
987
+ y: u
988
+ };
989
+ }
990
+ function zr(e, t) {
991
+ const n = ue(e), r = he(e), o = n.visualViewport;
992
+ let i = r.clientWidth, s = r.clientHeight, u = 0, l = 0;
993
+ if (o) {
994
+ i = o.width, s = o.height;
995
+ const c = Bt();
996
+ (!c || c && t === "fixed") && (u = o.offsetLeft, l = o.offsetTop);
997
+ }
998
+ return {
999
+ width: i,
1000
+ height: s,
1001
+ x: u,
1002
+ y: l
1003
+ };
1004
+ }
1005
+ function qr(e, t) {
1006
+ const n = ke(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = X(e) ? Ve(e) : pe(1), s = e.clientWidth * i.x, u = e.clientHeight * i.y, l = o * i.x, c = r * i.y;
1007
+ return {
1008
+ width: s,
1009
+ height: u,
1010
+ x: l,
1011
+ y: c
1012
+ };
1013
+ }
1014
+ function Jt(e, t, n) {
1015
+ let r;
1016
+ if (t === "viewport")
1017
+ r = zr(e, n);
1018
+ else if (t === "document")
1019
+ r = Hr(he(e));
1020
+ else if (U(t))
1021
+ r = qr(t, n);
1022
+ else {
1023
+ const o = Nn(e);
1024
+ r = {
1025
+ x: t.x - o.x,
1026
+ y: t.y - o.y,
1027
+ width: t.width,
1028
+ height: t.height
1029
+ };
1030
+ }
1031
+ return ft(r);
1032
+ }
1033
+ function Wn(e, t) {
1034
+ const n = ve(e);
1035
+ return n === t || !U(n) || Ae(n) ? !1 : le(n).position === "fixed" || Wn(n, t);
1036
+ }
1037
+ function jr(e, t) {
1038
+ const n = t.get(e);
1039
+ if (n)
1040
+ return n;
1041
+ let r = Te(e, [], !1).filter((u) => U(u) && Oe(u) !== "body"), o = null;
1042
+ const i = le(e).position === "fixed";
1043
+ let s = i ? ve(e) : e;
1044
+ for (; U(s) && !Ae(s); ) {
1045
+ const u = le(s), l = Wt(s);
1046
+ !l && u.position === "fixed" && (o = null), (i ? !l && !o : !l && u.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || Ze(s) && !l && Wn(e, s)) ? r = r.filter((d) => d !== s) : o = u, s = ve(s);
1047
+ }
1048
+ return t.set(e, r), r;
1049
+ }
1050
+ function Ur(e) {
1051
+ let {
1052
+ element: t,
1053
+ boundary: n,
1054
+ rootBoundary: r,
1055
+ strategy: o
1056
+ } = e;
1057
+ const s = [...n === "clippingAncestors" ? vt(t) ? [] : jr(t, this._c) : [].concat(n), r], u = s[0], l = s.reduce((c, d) => {
1058
+ const a = Jt(t, d, o);
1059
+ return c.top = ce(a.top, c.top), c.right = Be(a.right, c.right), c.bottom = Be(a.bottom, c.bottom), c.left = ce(a.left, c.left), c;
1060
+ }, Jt(t, u, o));
1061
+ return {
1062
+ width: l.right - l.left,
1063
+ height: l.bottom - l.top,
1064
+ x: l.left,
1065
+ y: l.top
1066
+ };
1067
+ }
1068
+ function Yr(e) {
1069
+ const {
1070
+ width: t,
1071
+ height: n
1072
+ } = Ln(e);
1073
+ return {
1074
+ width: t,
1075
+ height: n
1076
+ };
1077
+ }
1078
+ function Gr(e, t, n) {
1079
+ const r = X(t), o = he(t), i = n === "fixed", s = ke(e, !0, i, t);
1080
+ let u = {
1081
+ scrollLeft: 0,
1082
+ scrollTop: 0
1083
+ };
1084
+ const l = pe(0);
1085
+ if (r || !r && !i)
1086
+ if ((Oe(t) !== "body" || Ze(o)) && (u = yt(t)), r) {
1087
+ const p = ke(t, !0, i, t);
1088
+ l.x = p.x + t.clientLeft, l.y = p.y + t.clientTop;
1089
+ } else o && (l.x = Kt(o));
1090
+ const c = o && !r && !i ? Vn(o, u) : pe(0), d = s.left + u.scrollLeft - l.x - c.x, a = s.top + u.scrollTop - l.y - c.y;
1091
+ return {
1092
+ x: d,
1093
+ y: a,
1094
+ width: s.width,
1095
+ height: s.height
1096
+ };
1097
+ }
1098
+ function It(e) {
1099
+ return le(e).position === "static";
1100
+ }
1101
+ function Qt(e, t) {
1102
+ if (!X(e) || le(e).position === "fixed")
1103
+ return null;
1104
+ if (t)
1105
+ return t(e);
1106
+ let n = e.offsetParent;
1107
+ return he(e) === n && (n = n.ownerDocument.body), n;
1108
+ }
1109
+ function Bn(e, t) {
1110
+ const n = ue(e);
1111
+ if (vt(e))
1112
+ return n;
1113
+ if (!X(e)) {
1114
+ let o = ve(e);
1115
+ for (; o && !Ae(o); ) {
1116
+ if (U(o) && !It(o))
1117
+ return o;
1118
+ o = ve(o);
1119
+ }
1120
+ return n;
1121
+ }
1122
+ let r = Qt(e, t);
1123
+ for (; r && Jn(r) && It(r); )
1124
+ r = Qt(r, t);
1125
+ return r && Ae(r) && It(r) && !Wt(r) ? n : r || Qn(e) || n;
1126
+ }
1127
+ const Xr = async function(e) {
1128
+ const t = this.getOffsetParent || Bn, n = this.getDimensions, r = await n(e.floating);
1129
+ return {
1130
+ reference: Gr(e.reference, await t(e.floating), e.strategy),
1131
+ floating: {
1132
+ x: 0,
1133
+ y: 0,
1134
+ width: r.width,
1135
+ height: r.height
1136
+ }
1137
+ };
1138
+ };
1139
+ function Zr(e) {
1140
+ return le(e).direction === "rtl";
1141
+ }
1142
+ const Jr = {
1143
+ convertOffsetParentRelativeRectToViewportRelativeRect: $r,
1144
+ getDocumentElement: he,
1145
+ getClippingRect: Ur,
1146
+ getOffsetParent: Bn,
1147
+ getElementRects: Xr,
1148
+ getClientRects: Kr,
1149
+ getDimensions: Yr,
1150
+ getScale: Ve,
1151
+ isElement: U,
1152
+ isRTL: Zr
1153
+ };
1154
+ function _n(e, t) {
1155
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1156
+ }
1157
+ function Qr(e, t) {
1158
+ let n = null, r;
1159
+ const o = he(e);
1160
+ function i() {
1161
+ var u;
1162
+ clearTimeout(r), (u = n) == null || u.disconnect(), n = null;
1163
+ }
1164
+ function s(u, l) {
1165
+ u === void 0 && (u = !1), l === void 0 && (l = 1), i();
1166
+ const c = e.getBoundingClientRect(), {
1167
+ left: d,
1168
+ top: a,
1169
+ width: p,
1170
+ height: f
1171
+ } = c;
1172
+ if (u || t(), !p || !f)
1173
+ return;
1174
+ const g = Ne(a), h = Ne(o.clientWidth - (d + p)), v = Ne(o.clientHeight - (a + f)), x = Ne(d), b = {
1175
+ rootMargin: -g + "px " + -h + "px " + -v + "px " + -x + "px",
1176
+ threshold: ce(0, Be(1, l)) || 1
1177
+ };
1178
+ let w = !0;
1179
+ function D(k) {
1180
+ const B = k[0].intersectionRatio;
1181
+ if (B !== l) {
1182
+ if (!w)
1183
+ return s();
1184
+ B ? s(!1, B) : r = setTimeout(() => {
1185
+ s(!1, 1e-7);
1186
+ }, 1e3);
1187
+ }
1188
+ B === 1 && !_n(c, e.getBoundingClientRect()) && s(), w = !1;
1189
+ }
1190
+ try {
1191
+ n = new IntersectionObserver(D, {
1192
+ ...b,
1193
+ // Handle <iframe>s
1194
+ root: o.ownerDocument
1195
+ });
1196
+ } catch {
1197
+ n = new IntersectionObserver(D, b);
1198
+ }
1199
+ n.observe(e);
1200
+ }
1201
+ return s(!0), i;
1202
+ }
1203
+ function Vo(e, t, n, r) {
1204
+ r === void 0 && (r = {});
1205
+ const {
1206
+ ancestorScroll: o = !0,
1207
+ ancestorResize: i = !0,
1208
+ elementResize: s = typeof ResizeObserver == "function",
1209
+ layoutShift: u = typeof IntersectionObserver == "function",
1210
+ animationFrame: l = !1
1211
+ } = r, c = $t(e), d = o || i ? [...c ? Te(c) : [], ...Te(t)] : [];
1212
+ d.forEach((x) => {
1213
+ o && x.addEventListener("scroll", n, {
1214
+ passive: !0
1215
+ }), i && x.addEventListener("resize", n);
1216
+ });
1217
+ const a = c && u ? Qr(c, n) : null;
1218
+ let p = -1, f = null;
1219
+ s && (f = new ResizeObserver((x) => {
1220
+ let [R] = x;
1221
+ R && R.target === c && f && (f.unobserve(t), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1222
+ var b;
1223
+ (b = f) == null || b.observe(t);
1224
+ })), n();
1225
+ }), c && !l && f.observe(c), f.observe(t));
1226
+ let g, h = l ? ke(e) : null;
1227
+ l && v();
1228
+ function v() {
1229
+ const x = ke(e);
1230
+ h && !_n(h, x) && n(), h = x, g = requestAnimationFrame(v);
1231
+ }
1232
+ return n(), () => {
1233
+ var x;
1234
+ d.forEach((R) => {
1235
+ o && R.removeEventListener("scroll", n), i && R.removeEventListener("resize", n);
1236
+ }), a == null || a(), (x = f) == null || x.disconnect(), f = null, l && cancelAnimationFrame(g);
1237
+ };
1238
+ }
1239
+ const eo = Nr, Wo = Vr, to = kr, no = Wr, ro = (e, t, n) => {
1240
+ const r = /* @__PURE__ */ new Map(), o = {
1241
+ platform: Jr,
1242
+ ...n
1243
+ }, i = {
1244
+ ...o.platform,
1245
+ _c: r
1246
+ };
1247
+ return Pr(e, t, {
1248
+ ...o,
1249
+ platform: i
1250
+ });
1251
+ };
1252
+ var ct = typeof document < "u" ? bn : xn;
1253
+ function pt(e, t) {
1254
+ if (e === t)
1255
+ return !0;
1256
+ if (typeof e != typeof t)
1257
+ return !1;
1258
+ if (typeof e == "function" && e.toString() === t.toString())
1259
+ return !0;
1260
+ let n, r, o;
1261
+ if (e && t && typeof e == "object") {
1262
+ if (Array.isArray(e)) {
1263
+ if (n = e.length, n !== t.length) return !1;
1264
+ for (r = n; r-- !== 0; )
1265
+ if (!pt(e[r], t[r]))
1266
+ return !1;
1267
+ return !0;
1268
+ }
1269
+ if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1270
+ return !1;
1271
+ for (r = n; r-- !== 0; )
1272
+ if (!{}.hasOwnProperty.call(t, o[r]))
1273
+ return !1;
1274
+ for (r = n; r-- !== 0; ) {
1275
+ const i = o[r];
1276
+ if (!(i === "_owner" && e.$$typeof) && !pt(e[i], t[i]))
1277
+ return !1;
1278
+ }
1279
+ return !0;
1280
+ }
1281
+ return e !== e && t !== t;
1282
+ }
1283
+ function $n(e) {
1284
+ return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1285
+ }
1286
+ function en(e, t) {
1287
+ const n = $n(e);
1288
+ return Math.round(t * n) / n;
1289
+ }
1290
+ function Ct(e) {
1291
+ const t = m.useRef(e);
1292
+ return ct(() => {
1293
+ t.current = e;
1294
+ }), t;
1295
+ }
1296
+ function oo(e) {
1297
+ e === void 0 && (e = {});
1298
+ const {
1299
+ placement: t = "bottom",
1300
+ strategy: n = "absolute",
1301
+ middleware: r = [],
1302
+ platform: o,
1303
+ elements: {
1304
+ reference: i,
1305
+ floating: s
1306
+ } = {},
1307
+ transform: u = !0,
1308
+ whileElementsMounted: l,
1309
+ open: c
1310
+ } = e, [d, a] = m.useState({
1311
+ x: 0,
1312
+ y: 0,
1313
+ strategy: n,
1314
+ placement: t,
1315
+ middlewareData: {},
1316
+ isPositioned: !1
1317
+ }), [p, f] = m.useState(r);
1318
+ pt(p, r) || f(r);
1319
+ const [g, h] = m.useState(null), [v, x] = m.useState(null), R = m.useCallback((I) => {
1320
+ I !== k.current && (k.current = I, h(I));
1321
+ }, []), b = m.useCallback((I) => {
1322
+ I !== B.current && (B.current = I, x(I));
1323
+ }, []), w = i || g, D = s || v, k = m.useRef(null), B = m.useRef(null), W = m.useRef(d), Z = l != null, H = Ct(l), $ = Ct(o), C = Ct(c), L = m.useCallback(() => {
1324
+ if (!k.current || !B.current)
1325
+ return;
1326
+ const I = {
1327
+ placement: t,
1328
+ strategy: n,
1329
+ middleware: p
1330
+ };
1331
+ $.current && (I.platform = $.current), ro(k.current, B.current, I).then((E) => {
1332
+ const _ = {
1333
+ ...E,
1334
+ // The floating element's position may be recomputed while it's closed
1335
+ // but still mounted (such as when transitioning out). To ensure
1336
+ // `isPositioned` will be `false` initially on the next open, avoid
1337
+ // setting it to `true` when `open === false` (must be specified).
1338
+ isPositioned: C.current !== !1
1339
+ };
1340
+ T.current && !pt(W.current, _) && (W.current = _, vn.flushSync(() => {
1341
+ a(_);
1342
+ }));
1343
+ });
1344
+ }, [p, t, n, $, C]);
1345
+ ct(() => {
1346
+ c === !1 && W.current.isPositioned && (W.current.isPositioned = !1, a((I) => ({
1347
+ ...I,
1348
+ isPositioned: !1
1349
+ })));
1350
+ }, [c]);
1351
+ const T = m.useRef(!1);
1352
+ ct(() => (T.current = !0, () => {
1353
+ T.current = !1;
1354
+ }), []), ct(() => {
1355
+ if (w && (k.current = w), D && (B.current = D), w && D) {
1356
+ if (H.current)
1357
+ return H.current(w, D, L);
1358
+ L();
1359
+ }
1360
+ }, [w, D, L, H, Z]);
1361
+ const y = m.useMemo(() => ({
1362
+ reference: k,
1363
+ floating: B,
1364
+ setReference: R,
1365
+ setFloating: b
1366
+ }), [R, b]), O = m.useMemo(() => ({
1367
+ reference: w,
1368
+ floating: D
1369
+ }), [w, D]), F = m.useMemo(() => {
1370
+ const I = {
1371
+ position: n,
1372
+ left: 0,
1373
+ top: 0
1374
+ };
1375
+ if (!O.floating)
1376
+ return I;
1377
+ const E = en(O.floating, d.x), _ = en(O.floating, d.y);
1378
+ return u ? {
1379
+ ...I,
1380
+ transform: "translate(" + E + "px, " + _ + "px)",
1381
+ ...$n(O.floating) >= 1.5 && {
1382
+ willChange: "transform"
1383
+ }
1384
+ } : {
1385
+ position: n,
1386
+ left: E,
1387
+ top: _
1388
+ };
1389
+ }, [n, u, O.floating, d.x, d.y]);
1390
+ return m.useMemo(() => ({
1391
+ ...d,
1392
+ update: L,
1393
+ refs: y,
1394
+ elements: O,
1395
+ floatingStyles: F
1396
+ }), [d, L, y, O, F]);
1397
+ }
1398
+ const Bo = (e, t) => ({
1399
+ ...eo(e),
1400
+ options: [e, t]
1401
+ }), _o = (e, t) => ({
1402
+ ...to(e),
1403
+ options: [e, t]
1404
+ }), $o = (e, t) => ({
1405
+ ...no(e),
1406
+ options: [e, t]
1407
+ });
1408
+ function Ko(e) {
1409
+ return m.useMemo(() => e.every((t) => t == null) ? null : (t) => {
1410
+ e.forEach((n) => {
1411
+ typeof n == "function" ? n(t) : n != null && (n.current = t);
1412
+ });
1413
+ }, e);
1414
+ }
1415
+ const Kn = {
1416
+ ...m
1417
+ }, io = Kn.useInsertionEffect, so = io || ((e) => e());
1418
+ function fe(e) {
1419
+ const t = m.useRef(() => {
1420
+ if (process.env.NODE_ENV !== "production")
1421
+ throw new Error("Cannot call an event handler while rendering.");
1422
+ });
1423
+ return so(() => {
1424
+ t.current = e;
1425
+ }), m.useCallback(function() {
1426
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
1427
+ r[o] = arguments[o];
1428
+ return t.current == null ? void 0 : t.current(...r);
1429
+ }, []);
1430
+ }
1431
+ const Ht = "ArrowUp", et = "ArrowDown", $e = "ArrowLeft", ze = "ArrowRight";
1432
+ function ot(e, t, n) {
1433
+ return Math.floor(e / t) !== n;
1434
+ }
1435
+ function Ue(e, t) {
1436
+ return t < 0 || t >= e.current.length;
1437
+ }
1438
+ function Tt(e, t) {
1439
+ return ee(e, {
1440
+ disabledIndices: t
1441
+ });
1442
+ }
1443
+ function tn(e, t) {
1444
+ return ee(e, {
1445
+ decrement: !0,
1446
+ startingIndex: e.current.length,
1447
+ disabledIndices: t
1448
+ });
1449
+ }
1450
+ function ee(e, t) {
1451
+ let {
1452
+ startingIndex: n = -1,
1453
+ decrement: r = !1,
1454
+ disabledIndices: o,
1455
+ amount: i = 1
1456
+ } = t === void 0 ? {} : t;
1457
+ const s = e.current;
1458
+ let u = n;
1459
+ do
1460
+ u += r ? -i : i;
1461
+ while (u >= 0 && u <= s.length - 1 && ut(s, u, o));
1462
+ return u;
1463
+ }
1464
+ function co(e, t) {
1465
+ let {
1466
+ event: n,
1467
+ orientation: r,
1468
+ loop: o,
1469
+ cols: i,
1470
+ disabledIndices: s,
1471
+ minIndex: u,
1472
+ maxIndex: l,
1473
+ prevIndex: c,
1474
+ stopEvent: d = !1
1475
+ } = t, a = c;
1476
+ if (n.key === Ht) {
1477
+ if (d && re(n), c === -1)
1478
+ a = l;
1479
+ else if (a = ee(e, {
1480
+ startingIndex: a,
1481
+ amount: i,
1482
+ decrement: !0,
1483
+ disabledIndices: s
1484
+ }), o && (c - i < u || a < 0)) {
1485
+ const p = c % i, f = l % i, g = l - (f - p);
1486
+ f === p ? a = l : a = f > p ? g : g - i;
1487
+ }
1488
+ Ue(e, a) && (a = c);
1489
+ }
1490
+ if (n.key === et && (d && re(n), c === -1 ? a = u : (a = ee(e, {
1491
+ startingIndex: c,
1492
+ amount: i,
1493
+ disabledIndices: s
1494
+ }), o && c + i > l && (a = ee(e, {
1495
+ startingIndex: c % i - i,
1496
+ amount: i,
1497
+ disabledIndices: s
1498
+ }))), Ue(e, a) && (a = c)), r === "both") {
1499
+ const p = Ne(c / i);
1500
+ n.key === ze && (d && re(n), c % i !== i - 1 ? (a = ee(e, {
1501
+ startingIndex: c,
1502
+ disabledIndices: s
1503
+ }), o && ot(a, i, p) && (a = ee(e, {
1504
+ startingIndex: c - c % i - 1,
1505
+ disabledIndices: s
1506
+ }))) : o && (a = ee(e, {
1507
+ startingIndex: c - c % i - 1,
1508
+ disabledIndices: s
1509
+ })), ot(a, i, p) && (a = c)), n.key === $e && (d && re(n), c % i !== 0 ? (a = ee(e, {
1510
+ startingIndex: c,
1511
+ decrement: !0,
1512
+ disabledIndices: s
1513
+ }), o && ot(a, i, p) && (a = ee(e, {
1514
+ startingIndex: c + (i - c % i),
1515
+ decrement: !0,
1516
+ disabledIndices: s
1517
+ }))) : o && (a = ee(e, {
1518
+ startingIndex: c + (i - c % i),
1519
+ decrement: !0,
1520
+ disabledIndices: s
1521
+ })), ot(a, i, p) && (a = c));
1522
+ const f = Ne(l / i) === p;
1523
+ Ue(e, a) && (o && f ? a = n.key === $e ? l : ee(e, {
1524
+ startingIndex: c - c % i - 1,
1525
+ disabledIndices: s
1526
+ }) : a = c);
1527
+ }
1528
+ return a;
1529
+ }
1530
+ function uo(e, t, n) {
1531
+ const r = [];
1532
+ let o = 0;
1533
+ return e.forEach((i, s) => {
1534
+ let {
1535
+ width: u,
1536
+ height: l
1537
+ } = i;
1538
+ if (u > t && process.env.NODE_ENV !== "production")
1539
+ throw new Error("[Floating UI]: Invalid grid - item width at index " + s + " is greater than grid columns");
1540
+ let c = !1;
1541
+ for (n && (o = 0); !c; ) {
1542
+ const d = [];
1543
+ for (let a = 0; a < u; a++)
1544
+ for (let p = 0; p < l; p++)
1545
+ d.push(o + a + p * t);
1546
+ o % t + u <= t && d.every((a) => r[a] == null) ? (d.forEach((a) => {
1547
+ r[a] = s;
1548
+ }), c = !0) : o++;
1549
+ }
1550
+ }), [...r];
1551
+ }
1552
+ function lo(e, t, n, r, o) {
1553
+ if (e === -1) return -1;
1554
+ const i = n.indexOf(e), s = t[e];
1555
+ switch (o) {
1556
+ case "tl":
1557
+ return i;
1558
+ case "tr":
1559
+ return s ? i + s.width - 1 : i;
1560
+ case "bl":
1561
+ return s ? i + (s.height - 1) * r : i;
1562
+ case "br":
1563
+ return n.lastIndexOf(e);
1564
+ }
1565
+ }
1566
+ function ao(e, t) {
1567
+ return t.flatMap((n, r) => e.includes(n) ? [r] : []);
1568
+ }
1569
+ function ut(e, t, n) {
1570
+ if (n)
1571
+ return n.includes(t);
1572
+ const r = e[t];
1573
+ return r == null || r.hasAttribute("disabled") || r.getAttribute("aria-disabled") === "true";
1574
+ }
1575
+ let nn = 0;
1576
+ function Ie(e, t) {
1577
+ t === void 0 && (t = {});
1578
+ const {
1579
+ preventScroll: n = !1,
1580
+ cancelPrevious: r = !0,
1581
+ sync: o = !1
1582
+ } = t;
1583
+ r && cancelAnimationFrame(nn);
1584
+ const i = () => e == null ? void 0 : e.focus({
1585
+ preventScroll: n
1586
+ });
1587
+ o ? i() : nn = requestAnimationFrame(i);
1588
+ }
1589
+ var G = typeof document < "u" ? bn : xn;
1590
+ function ht() {
1591
+ return ht = Object.assign ? Object.assign.bind() : function(e) {
1592
+ for (var t = 1; t < arguments.length; t++) {
1593
+ var n = arguments[t];
1594
+ for (var r in n)
1595
+ Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
1596
+ }
1597
+ return e;
1598
+ }, ht.apply(this, arguments);
1599
+ }
1600
+ let rn = !1, fo = 0;
1601
+ const on = () => (
1602
+ // Ensure the id is unique with multiple independent versions of Floating UI
1603
+ // on <React 18
1604
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + fo++
1605
+ );
1606
+ function mo() {
1607
+ const [e, t] = m.useState(() => rn ? on() : void 0);
1608
+ return G(() => {
1609
+ e == null && t(on());
1610
+ }, []), m.useEffect(() => {
1611
+ rn = !0;
1612
+ }, []), e;
1613
+ }
1614
+ const go = Kn.useId, zt = go || mo;
1615
+ let Xe;
1616
+ process.env.NODE_ENV !== "production" && (Xe = /* @__PURE__ */ new Set());
1617
+ function At() {
1618
+ for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1619
+ n[r] = arguments[r];
1620
+ const o = "Floating UI: " + n.join(" ");
1621
+ if (!((e = Xe) != null && e.has(o))) {
1622
+ var i;
1623
+ (i = Xe) == null || i.add(o), console.warn(o);
1624
+ }
1625
+ }
1626
+ function po() {
1627
+ for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1628
+ n[r] = arguments[r];
1629
+ const o = "Floating UI: " + n.join(" ");
1630
+ if (!((e = Xe) != null && e.has(o))) {
1631
+ var i;
1632
+ (i = Xe) == null || i.add(o), console.error(o);
1633
+ }
1634
+ }
1635
+ function ho() {
1636
+ const e = /* @__PURE__ */ new Map();
1637
+ return {
1638
+ emit(t, n) {
1639
+ var r;
1640
+ (r = e.get(t)) == null || r.forEach((o) => o(n));
1641
+ },
1642
+ on(t, n) {
1643
+ e.set(t, [...e.get(t) || [], n]);
1644
+ },
1645
+ off(t, n) {
1646
+ var r;
1647
+ e.set(t, ((r = e.get(t)) == null ? void 0 : r.filter((o) => o !== n)) || []);
1648
+ }
1649
+ };
1650
+ }
1651
+ const bo = /* @__PURE__ */ m.createContext(null), xo = /* @__PURE__ */ m.createContext(null), qt = () => {
1652
+ var e;
1653
+ return ((e = m.useContext(bo)) == null ? void 0 : e.id) || null;
1654
+ }, wt = () => m.useContext(xo);
1655
+ function Ke(e) {
1656
+ return "data-floating-ui-" + e;
1657
+ }
1658
+ function Ce(e) {
1659
+ const t = Zn(e);
1660
+ return G(() => {
1661
+ t.current = e;
1662
+ }), t;
1663
+ }
1664
+ function vo(e, t) {
1665
+ var n;
1666
+ let r = [], o = (n = e.find((i) => i.id === t)) == null ? void 0 : n.parentId;
1667
+ for (; o; ) {
1668
+ const i = e.find((s) => s.id === o);
1669
+ o = i == null ? void 0 : i.parentId, i && (r = r.concat(i));
1670
+ }
1671
+ return r;
1672
+ }
1673
+ function We(e, t) {
1674
+ let n = e.filter((o) => {
1675
+ var i;
1676
+ return o.parentId === t && ((i = o.context) == null ? void 0 : i.open);
1677
+ }), r = n;
1678
+ for (; r.length; )
1679
+ r = e.filter((o) => {
1680
+ var i;
1681
+ return (i = r) == null ? void 0 : i.some((s) => {
1682
+ var u;
1683
+ return o.parentId === s.id && ((u = o.context) == null ? void 0 : u.open);
1684
+ });
1685
+ }), n = n.concat(r);
1686
+ return n;
1687
+ }
1688
+ function yo(e, t) {
1689
+ let n, r = -1;
1690
+ function o(i, s) {
1691
+ s > r && (n = i, r = s), We(e, i).forEach((l) => {
1692
+ o(l.id, s + 1);
1693
+ });
1694
+ }
1695
+ return o(t, 0), e.find((i) => i.id === n);
1696
+ }
1697
+ let Le = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakSet(), st = {}, St = 0;
1698
+ const wo = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, Hn = (e) => e && (e.host || Hn(e.parentNode)), Ro = (e, t) => t.map((n) => {
1699
+ if (e.contains(n))
1700
+ return n;
1701
+ const r = Hn(n);
1702
+ return e.contains(r) ? r : null;
1703
+ }).filter((n) => n != null);
1704
+ function Eo(e, t, n, r) {
1705
+ const o = "data-floating-ui-inert", i = r ? "inert" : n ? "aria-hidden" : null, s = Ro(t, e), u = /* @__PURE__ */ new Set(), l = new Set(s), c = [];
1706
+ st[o] || (st[o] = /* @__PURE__ */ new WeakMap());
1707
+ const d = st[o];
1708
+ s.forEach(a), p(t), u.clear();
1709
+ function a(f) {
1710
+ !f || u.has(f) || (u.add(f), f.parentNode && a(f.parentNode));
1711
+ }
1712
+ function p(f) {
1713
+ !f || l.has(f) || [].forEach.call(f.children, (g) => {
1714
+ if (Oe(g) !== "script")
1715
+ if (u.has(g))
1716
+ p(g);
1717
+ else {
1718
+ const h = i ? g.getAttribute(i) : null, v = h !== null && h !== "false", x = (Le.get(g) || 0) + 1, R = (d.get(g) || 0) + 1;
1719
+ Le.set(g, x), d.set(g, R), c.push(g), x === 1 && v && it.add(g), R === 1 && g.setAttribute(o, ""), !v && i && g.setAttribute(i, "true");
1720
+ }
1721
+ });
1722
+ }
1723
+ return St++, () => {
1724
+ c.forEach((f) => {
1725
+ const g = (Le.get(f) || 0) - 1, h = (d.get(f) || 0) - 1;
1726
+ Le.set(f, g), d.set(f, h), g || (!it.has(f) && i && f.removeAttribute(i), it.delete(f)), h || f.removeAttribute(o);
1727
+ }), St--, St || (Le = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakSet(), st = {});
1728
+ };
1729
+ }
1730
+ function sn(e, t, n) {
1731
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1732
+ const r = se(e[0]).body;
1733
+ return Eo(e.concat(Array.from(r.querySelectorAll("[aria-live]"))), r, t, n);
1734
+ }
1735
+ const He = () => ({
1736
+ getShadowRoot: !0,
1737
+ displayCheck: (
1738
+ // JSDOM does not support the `tabbable` library. To solve this we can
1739
+ // check if `ResizeObserver` is a real function (not polyfilled), which
1740
+ // determines if the current environment is JSDOM-like.
1741
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
1742
+ )
1743
+ });
1744
+ function zn(e, t) {
1745
+ const n = Ge(e, He());
1746
+ t === "prev" && n.reverse();
1747
+ const r = n.indexOf(xe(se(e)));
1748
+ return n.slice(r + 1)[0];
1749
+ }
1750
+ function qn() {
1751
+ return zn(document.body, "next");
1752
+ }
1753
+ function jn() {
1754
+ return zn(document.body, "prev");
1755
+ }
1756
+ function Ye(e, t) {
1757
+ const n = t || e.currentTarget, r = e.relatedTarget;
1758
+ return !r || !ne(n, r);
1759
+ }
1760
+ function Io(e) {
1761
+ Ge(e, He()).forEach((n) => {
1762
+ n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
1763
+ });
1764
+ }
1765
+ function cn(e) {
1766
+ e.querySelectorAll("[data-tabindex]").forEach((n) => {
1767
+ const r = n.dataset.tabindex;
1768
+ delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
1769
+ });
1770
+ }
1771
+ function Co(e, t, n) {
1772
+ const r = e.indexOf(t);
1773
+ function o(s) {
1774
+ const u = Ke("focus-guard");
1775
+ let l = r + (s ? 1 : 0), c = e[l];
1776
+ for (; c && (!c.isConnected || c.hasAttribute(u) || ne(n, c)); )
1777
+ s ? l++ : l--, c = e[l];
1778
+ return c;
1779
+ }
1780
+ const i = o(!0);
1781
+ return i || o(!1);
1782
+ }
1783
+ const jt = {
1784
+ border: 0,
1785
+ clip: "rect(0 0 0 0)",
1786
+ height: "1px",
1787
+ margin: "-1px",
1788
+ overflow: "hidden",
1789
+ padding: 0,
1790
+ position: "fixed",
1791
+ whiteSpace: "nowrap",
1792
+ width: "1px",
1793
+ top: 0,
1794
+ left: 0
1795
+ };
1796
+ let To;
1797
+ function un(e) {
1798
+ e.key === "Tab" && (e.target, clearTimeout(To));
1799
+ }
1800
+ const bt = /* @__PURE__ */ m.forwardRef(function(t, n) {
1801
+ const [r, o] = m.useState();
1802
+ G(() => (Tn() && o("button"), document.addEventListener("keydown", un), () => {
1803
+ document.removeEventListener("keydown", un);
1804
+ }), []);
1805
+ const i = {
1806
+ ref: n,
1807
+ tabIndex: 0,
1808
+ // Role is only for VoiceOver
1809
+ role: r,
1810
+ "aria-hidden": r ? void 0 : !0,
1811
+ [Ke("focus-guard")]: "",
1812
+ style: jt
1813
+ };
1814
+ return /* @__PURE__ */ m.createElement("span", ht({}, t, i));
1815
+ }), Un = /* @__PURE__ */ m.createContext(null), ln = /* @__PURE__ */ Ke("portal");
1816
+ function Ao(e) {
1817
+ e === void 0 && (e = {});
1818
+ const {
1819
+ id: t,
1820
+ root: n
1821
+ } = e, r = zt(), o = Yn(), [i, s] = m.useState(null), u = m.useRef(null);
1822
+ return G(() => () => {
1823
+ i == null || i.remove(), queueMicrotask(() => {
1824
+ u.current = null;
1825
+ });
1826
+ }, [i]), G(() => {
1827
+ if (!r || u.current) return;
1828
+ const l = t ? document.getElementById(t) : null;
1829
+ if (!l) return;
1830
+ const c = document.createElement("div");
1831
+ c.id = r, c.setAttribute(ln, ""), l.appendChild(c), u.current = c, s(c);
1832
+ }, [t, r]), G(() => {
1833
+ if (!r || u.current) return;
1834
+ let l = n || (o == null ? void 0 : o.portalNode);
1835
+ l && !U(l) && (l = l.current), l = l || document.body;
1836
+ let c = null;
1837
+ t && (c = document.createElement("div"), c.id = t, l.appendChild(c));
1838
+ const d = document.createElement("div");
1839
+ d.id = r, d.setAttribute(ln, ""), l = c || l, l.appendChild(d), u.current = d, s(d);
1840
+ }, [t, n, r, o]), i;
1841
+ }
1842
+ function Ho(e) {
1843
+ const {
1844
+ children: t,
1845
+ id: n,
1846
+ root: r = null,
1847
+ preserveTabOrder: o = !0
1848
+ } = e, i = Ao({
1849
+ id: n,
1850
+ root: r
1851
+ }), [s, u] = m.useState(null), l = m.useRef(null), c = m.useRef(null), d = m.useRef(null), a = m.useRef(null), p = s == null ? void 0 : s.modal, f = s == null ? void 0 : s.open, g = (
1852
+ // The FocusManager and therefore floating element are currently open/
1853
+ // rendered.
1854
+ !!s && // Guards are only for non-modal focus management.
1855
+ !s.modal && // Don't render if unmount is transitioning.
1856
+ s.open && o && !!(r || i)
1857
+ );
1858
+ return m.useEffect(() => {
1859
+ if (!i || !o || p)
1860
+ return;
1861
+ function h(v) {
1862
+ i && Ye(v) && (v.type === "focusin" ? cn : Io)(i);
1863
+ }
1864
+ return i.addEventListener("focusin", h, !0), i.addEventListener("focusout", h, !0), () => {
1865
+ i.removeEventListener("focusin", h, !0), i.removeEventListener("focusout", h, !0);
1866
+ };
1867
+ }, [i, o, p]), m.useEffect(() => {
1868
+ i && (f || cn(i));
1869
+ }, [f, i]), /* @__PURE__ */ m.createElement(Un.Provider, {
1870
+ value: m.useMemo(() => ({
1871
+ preserveTabOrder: o,
1872
+ beforeOutsideRef: l,
1873
+ afterOutsideRef: c,
1874
+ beforeInsideRef: d,
1875
+ afterInsideRef: a,
1876
+ portalNode: i,
1877
+ setFocusManagerState: u
1878
+ }), [o, i])
1879
+ }, g && i && /* @__PURE__ */ m.createElement(bt, {
1880
+ "data-type": "outside",
1881
+ ref: l,
1882
+ onFocus: (h) => {
1883
+ if (Ye(h, i)) {
1884
+ var v;
1885
+ (v = d.current) == null || v.focus();
1886
+ } else {
1887
+ const x = jn() || (s == null ? void 0 : s.refs.domReference.current);
1888
+ x == null || x.focus();
1889
+ }
1890
+ }
1891
+ }), g && i && /* @__PURE__ */ m.createElement("span", {
1892
+ "aria-owns": i.id,
1893
+ style: jt
1894
+ }), i && /* @__PURE__ */ vn.createPortal(t, i), g && i && /* @__PURE__ */ m.createElement(bt, {
1895
+ "data-type": "outside",
1896
+ ref: c,
1897
+ onFocus: (h) => {
1898
+ if (Ye(h, i)) {
1899
+ var v;
1900
+ (v = a.current) == null || v.focus();
1901
+ } else {
1902
+ const x = qn() || (s == null ? void 0 : s.refs.domReference.current);
1903
+ x == null || x.focus(), s != null && s.closeOnFocusOut && (s == null || s.onOpenChange(!1, h.nativeEvent, "focus-out"));
1904
+ }
1905
+ }
1906
+ }));
1907
+ }
1908
+ const Yn = () => m.useContext(Un), Vt = "data-floating-ui-focusable";
1909
+ function Gn(e) {
1910
+ return e ? e.hasAttribute(Vt) ? e : e.querySelector("[" + Vt + "]") || e : null;
1911
+ }
1912
+ const So = 20;
1913
+ let De = [];
1914
+ function Ot(e) {
1915
+ De = De.filter((n) => n.isConnected);
1916
+ let t = e;
1917
+ if (!(!t || Oe(t) === "body")) {
1918
+ if (!Fr(t, He())) {
1919
+ const n = Ge(t, He())[0];
1920
+ n && (t = n);
1921
+ }
1922
+ De.push(t), De.length > So && (De = De.slice(-20));
1923
+ }
1924
+ }
1925
+ function an() {
1926
+ return De.slice().reverse().find((e) => e.isConnected);
1927
+ }
1928
+ const Oo = /* @__PURE__ */ m.forwardRef(function(t, n) {
1929
+ return /* @__PURE__ */ m.createElement("button", ht({}, t, {
1930
+ type: "button",
1931
+ ref: n,
1932
+ tabIndex: -1,
1933
+ style: jt
1934
+ }));
1935
+ });
1936
+ function zo(e) {
1937
+ const {
1938
+ context: t,
1939
+ children: n,
1940
+ disabled: r = !1,
1941
+ order: o = ["content"],
1942
+ guards: i = !0,
1943
+ initialFocus: s = 0,
1944
+ returnFocus: u = !0,
1945
+ restoreFocus: l = !1,
1946
+ modal: c = !0,
1947
+ visuallyHiddenDismiss: d = !1,
1948
+ closeOnFocusOut: a = !0
1949
+ } = e, {
1950
+ open: p,
1951
+ refs: f,
1952
+ nodeId: g,
1953
+ onOpenChange: h,
1954
+ events: v,
1955
+ dataRef: x,
1956
+ floatingId: R,
1957
+ elements: {
1958
+ domReference: b,
1959
+ floating: w
1960
+ }
1961
+ } = t, D = typeof s == "number" && s < 0, k = An(b) && D, B = wo() ? i : !0, W = Ce(o), Z = Ce(s), H = Ce(u), $ = wt(), C = Yn(), L = m.useRef(null), T = m.useRef(null), y = m.useRef(!1), O = m.useRef(!1), F = m.useRef(-1), I = C != null, E = Gn(w), _ = fe(function(V) {
1962
+ return V === void 0 && (V = E), V ? Ge(V, He()) : [];
1963
+ }), Q = fe((V) => {
1964
+ const M = _(V);
1965
+ return W.current.map((A) => b && A === "reference" ? b : E && A === "floating" ? E : M).filter(Boolean).flat();
1966
+ });
1967
+ m.useEffect(() => {
1968
+ y.current = !1;
1969
+ }, [r]), m.useEffect(() => {
1970
+ if (r || !c) return;
1971
+ function V(A) {
1972
+ if (A.key === "Tab") {
1973
+ ne(E, xe(se(E))) && _().length === 0 && !k && re(A);
1974
+ const P = Q(), q = Fe(A);
1975
+ W.current[0] === "reference" && q === b && (re(A), A.shiftKey ? Ie(P[P.length - 1]) : Ie(P[1])), W.current[1] === "floating" && q === E && A.shiftKey && (re(A), Ie(P[0]));
1976
+ }
1977
+ }
1978
+ const M = se(E);
1979
+ return M.addEventListener("keydown", V), () => {
1980
+ M.removeEventListener("keydown", V);
1981
+ };
1982
+ }, [r, b, E, c, W, k, _, Q]), m.useEffect(() => {
1983
+ if (r || !w) return;
1984
+ function V(M) {
1985
+ const A = Fe(M), q = _().indexOf(A);
1986
+ q !== -1 && (F.current = q);
1987
+ }
1988
+ return w.addEventListener("focusin", V), () => {
1989
+ w.removeEventListener("focusin", V);
1990
+ };
1991
+ }, [r, w, _]), m.useEffect(() => {
1992
+ if (r || !a) return;
1993
+ function V() {
1994
+ O.current = !0, setTimeout(() => {
1995
+ O.current = !1;
1996
+ });
1997
+ }
1998
+ function M(A) {
1999
+ const P = A.relatedTarget;
2000
+ queueMicrotask(() => {
2001
+ const q = !(ne(b, P) || ne(w, P) || ne(P, w) || ne(C == null ? void 0 : C.portalNode, P) || P != null && P.hasAttribute(Ke("focus-guard")) || $ && (We($.nodesRef.current, g).find((J) => {
2002
+ var te, Y;
2003
+ return ne((te = J.context) == null ? void 0 : te.elements.floating, P) || ne((Y = J.context) == null ? void 0 : Y.elements.domReference, P);
2004
+ }) || vo($.nodesRef.current, g).find((J) => {
2005
+ var te, Y;
2006
+ return ((te = J.context) == null ? void 0 : te.elements.floating) === P || ((Y = J.context) == null ? void 0 : Y.elements.domReference) === P;
2007
+ })));
2008
+ if (l && q && xe(se(E)) === se(E).body) {
2009
+ X(E) && E.focus();
2010
+ const J = F.current, te = _(), Y = te[J] || te[te.length - 1] || E;
2011
+ X(Y) && Y.focus();
2012
+ }
2013
+ (k || !c) && P && q && !O.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
2014
+ P !== an() && (y.current = !0, h(!1, A, "focus-out"));
2015
+ });
2016
+ }
2017
+ if (w && X(b))
2018
+ return b.addEventListener("focusout", M), b.addEventListener("pointerdown", V), w.addEventListener("focusout", M), () => {
2019
+ b.removeEventListener("focusout", M), b.removeEventListener("pointerdown", V), w.removeEventListener("focusout", M);
2020
+ };
2021
+ }, [r, b, w, E, c, g, $, C, h, a, l, _, k]), m.useEffect(() => {
2022
+ var V;
2023
+ if (r) return;
2024
+ const M = Array.from((C == null || (V = C.portalNode) == null ? void 0 : V.querySelectorAll("[" + Ke("portal") + "]")) || []);
2025
+ if (w) {
2026
+ const A = [w, ...M, L.current, T.current, W.current.includes("reference") || k ? b : null].filter((q) => q != null), P = c || k ? sn(A, B, !B) : sn(A);
2027
+ return () => {
2028
+ P();
2029
+ };
2030
+ }
2031
+ }, [r, b, w, c, W, C, k, B]), G(() => {
2032
+ if (r || !X(E)) return;
2033
+ const V = se(E), M = xe(V);
2034
+ queueMicrotask(() => {
2035
+ const A = Q(E), P = Z.current, q = (typeof P == "number" ? A[P] : P.current) || E, J = ne(E, M);
2036
+ !D && !J && p && Ie(q, {
2037
+ preventScroll: q === E
2038
+ });
2039
+ });
2040
+ }, [r, p, E, D, Q, Z]), G(() => {
2041
+ if (r || !E) return;
2042
+ let V = !1;
2043
+ const M = se(E), A = xe(M);
2044
+ let q = x.current.openEvent;
2045
+ const J = f.domReference.current;
2046
+ Ot(A);
2047
+ function te(Y) {
2048
+ let {
2049
+ open: Me,
2050
+ reason: ye,
2051
+ event: oe,
2052
+ nested: we
2053
+ } = Y;
2054
+ Me && (q = oe), ye === "escape-key" && f.domReference.current && Ot(f.domReference.current), ye === "hover" && oe.type === "mouseleave" && (y.current = !0), ye === "outside-press" && (we ? (y.current = !1, V = !0) : y.current = !(In(oe) || Cn(oe)));
2055
+ }
2056
+ return v.on("openchange", te), () => {
2057
+ v.off("openchange", te);
2058
+ const Y = xe(M), Me = ne(w, Y) || $ && We($.nodesRef.current, g).some((me) => {
2059
+ var qe;
2060
+ return ne((qe = me.context) == null ? void 0 : qe.elements.floating, Y);
2061
+ });
2062
+ (Me || q && ["click", "mousedown"].includes(q.type)) && f.domReference.current && Ot(f.domReference.current);
2063
+ const oe = J || A, we = Ge(se(oe).body, He());
2064
+ queueMicrotask(() => {
2065
+ let me = an();
2066
+ !me && X(oe) && w && (me = Co(we, oe, w)), // eslint-disable-next-line react-hooks/exhaustive-deps
2067
+ H.current && !y.current && X(me) && // If the focus moved somewhere else after mount, avoid returning focus
2068
+ // since it likely entered a different element which should be
2069
+ // respected: https://github.com/floating-ui/floating-ui/issues/2607
2070
+ (!(me !== Y && Y !== M.body) || Me) && me.focus({
2071
+ preventScroll: V
2072
+ });
2073
+ });
2074
+ };
2075
+ }, [r, w, E, H, x, f, v, $, g]), G(() => {
2076
+ if (!r && C)
2077
+ return C.setFocusManagerState({
2078
+ modal: c,
2079
+ closeOnFocusOut: a,
2080
+ open: p,
2081
+ onOpenChange: h,
2082
+ refs: f
2083
+ }), () => {
2084
+ C.setFocusManagerState(null);
2085
+ };
2086
+ }, [r, C, c, p, h, f, a]), G(() => {
2087
+ if (r || !E || typeof MutationObserver != "function" || D) return;
2088
+ const V = () => {
2089
+ const A = E.getAttribute("tabindex"), P = _(), q = xe(se(w)), J = P.indexOf(q);
2090
+ J !== -1 && (F.current = J), W.current.includes("floating") || q !== f.domReference.current && P.length === 0 ? A !== "0" && E.setAttribute("tabindex", "0") : A !== "-1" && E.setAttribute("tabindex", "-1");
2091
+ };
2092
+ V();
2093
+ const M = new MutationObserver(V);
2094
+ return M.observe(E, {
2095
+ childList: !0,
2096
+ subtree: !0,
2097
+ attributes: !0
2098
+ }), () => {
2099
+ M.disconnect();
2100
+ };
2101
+ }, [r, w, E, f, W, _, D]);
2102
+ function be(V) {
2103
+ return r || !d || !c ? null : /* @__PURE__ */ m.createElement(Oo, {
2104
+ ref: V === "start" ? L : T,
2105
+ onClick: (M) => h(!1, M.nativeEvent)
2106
+ }, typeof d == "string" ? d : "Dismiss");
2107
+ }
2108
+ const de = !r && B && (c ? !k : !0) && (I || c);
2109
+ return /* @__PURE__ */ m.createElement(m.Fragment, null, de && /* @__PURE__ */ m.createElement(bt, {
2110
+ "data-type": "inside",
2111
+ ref: C == null ? void 0 : C.beforeInsideRef,
2112
+ onFocus: (V) => {
2113
+ if (c) {
2114
+ const A = Q();
2115
+ Ie(o[0] === "reference" ? A[0] : A[A.length - 1]);
2116
+ } else if (C != null && C.preserveTabOrder && C.portalNode)
2117
+ if (y.current = !1, Ye(V, C.portalNode)) {
2118
+ const A = qn() || b;
2119
+ A == null || A.focus();
2120
+ } else {
2121
+ var M;
2122
+ (M = C.beforeOutsideRef.current) == null || M.focus();
2123
+ }
2124
+ }
2125
+ }), !k && be("start"), n, be("end"), de && /* @__PURE__ */ m.createElement(bt, {
2126
+ "data-type": "inside",
2127
+ ref: C == null ? void 0 : C.afterInsideRef,
2128
+ onFocus: (V) => {
2129
+ if (c)
2130
+ Ie(Q()[0]);
2131
+ else if (C != null && C.preserveTabOrder && C.portalNode)
2132
+ if (a && (y.current = !0), Ye(V, C.portalNode)) {
2133
+ const A = jn() || b;
2134
+ A == null || A.focus();
2135
+ } else {
2136
+ var M;
2137
+ (M = C.afterOutsideRef.current) == null || M.focus();
2138
+ }
2139
+ }
2140
+ }));
2141
+ }
2142
+ const Mo = {
2143
+ pointerdown: "onPointerDown",
2144
+ mousedown: "onMouseDown",
2145
+ click: "onClick"
2146
+ }, Do = {
2147
+ pointerdown: "onPointerDownCapture",
2148
+ mousedown: "onMouseDownCapture",
2149
+ click: "onClickCapture"
2150
+ }, fn = (e) => {
2151
+ var t, n;
2152
+ return {
2153
+ escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1,
2154
+ outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0
2155
+ };
2156
+ };
2157
+ function qo(e, t) {
2158
+ t === void 0 && (t = {});
2159
+ const {
2160
+ open: n,
2161
+ onOpenChange: r,
2162
+ elements: o,
2163
+ dataRef: i
2164
+ } = e, {
2165
+ enabled: s = !0,
2166
+ escapeKey: u = !0,
2167
+ outsidePress: l = !0,
2168
+ outsidePressEvent: c = "pointerdown",
2169
+ referencePress: d = !1,
2170
+ referencePressEvent: a = "pointerdown",
2171
+ ancestorScroll: p = !1,
2172
+ bubbles: f,
2173
+ capture: g
2174
+ } = t, h = wt(), v = fe(typeof l == "function" ? l : () => !1), x = typeof l == "function" ? v : l, R = m.useRef(!1), b = m.useRef(!1), {
2175
+ escapeKey: w,
2176
+ outsidePress: D
2177
+ } = fn(f), {
2178
+ escapeKey: k,
2179
+ outsidePress: B
2180
+ } = fn(g), W = fe((T) => {
2181
+ var y;
2182
+ if (!n || !s || !u || T.key !== "Escape")
2183
+ return;
2184
+ const O = (y = i.current.floatingContext) == null ? void 0 : y.nodeId, F = h ? We(h.nodesRef.current, O) : [];
2185
+ if (!w && (T.stopPropagation(), F.length > 0)) {
2186
+ let I = !0;
2187
+ if (F.forEach((E) => {
2188
+ var _;
2189
+ if ((_ = E.context) != null && _.open && !E.context.dataRef.current.__escapeKeyBubbles) {
2190
+ I = !1;
2191
+ return;
2192
+ }
2193
+ }), !I)
2194
+ return;
2195
+ }
2196
+ r(!1, nr(T) ? T.nativeEvent : T, "escape-key");
2197
+ }), Z = fe((T) => {
2198
+ var y;
2199
+ const O = () => {
2200
+ var F;
2201
+ W(T), (F = Fe(T)) == null || F.removeEventListener("keydown", O);
2202
+ };
2203
+ (y = Fe(T)) == null || y.addEventListener("keydown", O);
2204
+ }), H = fe((T) => {
2205
+ var y;
2206
+ const O = R.current;
2207
+ R.current = !1;
2208
+ const F = b.current;
2209
+ if (b.current = !1, c === "click" && F || O || typeof x == "function" && !x(T))
2210
+ return;
2211
+ const I = Fe(T), E = "[" + Ke("inert") + "]", _ = se(o.floating).querySelectorAll(E);
2212
+ let Q = U(I) ? I : null;
2213
+ for (; Q && !Ae(Q); ) {
2214
+ const M = ve(Q);
2215
+ if (Ae(M) || !U(M))
2216
+ break;
2217
+ Q = M;
2218
+ }
2219
+ if (_.length && U(I) && !rr(I) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2220
+ !ne(I, o.floating) && // If the target root element contains none of the markers, then the
2221
+ // element was injected after the floating element rendered.
2222
+ Array.from(_).every((M) => !ne(Q, M)))
2223
+ return;
2224
+ if (X(I) && L) {
2225
+ const M = I.clientWidth > 0 && I.scrollWidth > I.clientWidth, A = I.clientHeight > 0 && I.scrollHeight > I.clientHeight;
2226
+ let P = A && T.offsetX > I.clientWidth;
2227
+ if (A && le(I).direction === "rtl" && (P = T.offsetX <= I.offsetWidth - I.clientWidth), P || M && T.offsetY > I.clientHeight)
2228
+ return;
2229
+ }
2230
+ const be = (y = i.current.floatingContext) == null ? void 0 : y.nodeId, de = h && We(h.nodesRef.current, be).some((M) => {
2231
+ var A;
2232
+ return Et(T, (A = M.context) == null ? void 0 : A.elements.floating);
2233
+ });
2234
+ if (Et(T, o.floating) || Et(T, o.domReference) || de)
2235
+ return;
2236
+ const V = h ? We(h.nodesRef.current, be) : [];
2237
+ if (V.length > 0) {
2238
+ let M = !0;
2239
+ if (V.forEach((A) => {
2240
+ var P;
2241
+ if ((P = A.context) != null && P.open && !A.context.dataRef.current.__outsidePressBubbles) {
2242
+ M = !1;
2243
+ return;
2244
+ }
2245
+ }), !M)
2246
+ return;
2247
+ }
2248
+ r(!1, T, "outside-press");
2249
+ }), $ = fe((T) => {
2250
+ var y;
2251
+ const O = () => {
2252
+ var F;
2253
+ H(T), (F = Fe(T)) == null || F.removeEventListener(c, O);
2254
+ };
2255
+ (y = Fe(T)) == null || y.addEventListener(c, O);
2256
+ });
2257
+ m.useEffect(() => {
2258
+ if (!n || !s)
2259
+ return;
2260
+ i.current.__escapeKeyBubbles = w, i.current.__outsidePressBubbles = D;
2261
+ function T(F) {
2262
+ r(!1, F, "ancestor-scroll");
2263
+ }
2264
+ const y = se(o.floating);
2265
+ u && y.addEventListener("keydown", k ? Z : W, k), x && y.addEventListener(c, B ? $ : H, B);
2266
+ let O = [];
2267
+ return p && (U(o.domReference) && (O = Te(o.domReference)), U(o.floating) && (O = O.concat(Te(o.floating))), !U(o.reference) && o.reference && o.reference.contextElement && (O = O.concat(Te(o.reference.contextElement)))), O = O.filter((F) => {
2268
+ var I;
2269
+ return F !== ((I = y.defaultView) == null ? void 0 : I.visualViewport);
2270
+ }), O.forEach((F) => {
2271
+ F.addEventListener("scroll", T, {
2272
+ passive: !0
2273
+ });
2274
+ }), () => {
2275
+ u && y.removeEventListener("keydown", k ? Z : W, k), x && y.removeEventListener(c, B ? $ : H, B), O.forEach((F) => {
2276
+ F.removeEventListener("scroll", T);
2277
+ });
2278
+ };
2279
+ }, [i, o, u, x, c, n, r, p, s, w, D, W, k, Z, H, B, $]), m.useEffect(() => {
2280
+ R.current = !1;
2281
+ }, [x, c]);
2282
+ const C = m.useMemo(() => ({
2283
+ onKeyDown: W,
2284
+ [Mo[a]]: (T) => {
2285
+ d && r(!1, T.nativeEvent, "reference-press");
2286
+ }
2287
+ }), [W, r, d, a]), L = m.useMemo(() => ({
2288
+ onKeyDown: W,
2289
+ onMouseDown() {
2290
+ b.current = !0;
2291
+ },
2292
+ onMouseUp() {
2293
+ b.current = !0;
2294
+ },
2295
+ [Do[c]]: () => {
2296
+ R.current = !0;
2297
+ }
2298
+ }), [W, c]);
2299
+ return m.useMemo(() => s ? {
2300
+ reference: C,
2301
+ floating: L
2302
+ } : {}, [s, C, L]);
2303
+ }
2304
+ function Fo(e) {
2305
+ const {
2306
+ open: t = !1,
2307
+ onOpenChange: n,
2308
+ elements: r
2309
+ } = e, o = zt(), i = m.useRef({}), [s] = m.useState(() => ho()), u = qt() != null;
2310
+ if (process.env.NODE_ENV !== "production") {
2311
+ const f = r.reference;
2312
+ f && !U(f) && po("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2313
+ }
2314
+ const [l, c] = m.useState(r.reference), d = fe((f, g, h) => {
2315
+ i.current.openEvent = f ? g : void 0, s.emit("openchange", {
2316
+ open: f,
2317
+ event: g,
2318
+ reason: h,
2319
+ nested: u
2320
+ }), n == null || n(f, g, h);
2321
+ }), a = m.useMemo(() => ({
2322
+ setPositionReference: c
2323
+ }), []), p = m.useMemo(() => ({
2324
+ reference: l || r.reference || null,
2325
+ floating: r.floating || null,
2326
+ domReference: r.reference
2327
+ }), [l, r.reference, r.floating]);
2328
+ return m.useMemo(() => ({
2329
+ dataRef: i,
2330
+ open: t,
2331
+ onOpenChange: d,
2332
+ elements: p,
2333
+ events: s,
2334
+ floatingId: o,
2335
+ refs: a
2336
+ }), [t, d, p, s, o, a]);
2337
+ }
2338
+ function jo(e) {
2339
+ e === void 0 && (e = {});
2340
+ const {
2341
+ nodeId: t
2342
+ } = e, n = Fo({
2343
+ ...e,
2344
+ elements: {
2345
+ reference: null,
2346
+ floating: null,
2347
+ ...e.elements
2348
+ }
2349
+ }), r = e.rootContext || n, o = r.elements, [i, s] = m.useState(null), [u, l] = m.useState(null), d = (o == null ? void 0 : o.reference) || i, a = m.useRef(null), p = wt();
2350
+ G(() => {
2351
+ d && (a.current = d);
2352
+ }, [d]);
2353
+ const f = oo({
2354
+ ...e,
2355
+ elements: {
2356
+ ...o,
2357
+ ...u && {
2358
+ reference: u
2359
+ }
2360
+ }
2361
+ }), g = m.useCallback((b) => {
2362
+ const w = U(b) ? {
2363
+ getBoundingClientRect: () => b.getBoundingClientRect(),
2364
+ contextElement: b
2365
+ } : b;
2366
+ l(w), f.refs.setReference(w);
2367
+ }, [f.refs]), h = m.useCallback((b) => {
2368
+ (U(b) || b === null) && (a.current = b, s(b)), (U(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2369
+ // `null` to support `positionReference` + an unstable `reference`
2370
+ // callback ref.
2371
+ b !== null && !U(b)) && f.refs.setReference(b);
2372
+ }, [f.refs]), v = m.useMemo(() => ({
2373
+ ...f.refs,
2374
+ setReference: h,
2375
+ setPositionReference: g,
2376
+ domReference: a
2377
+ }), [f.refs, h, g]), x = m.useMemo(() => ({
2378
+ ...f.elements,
2379
+ domReference: d
2380
+ }), [f.elements, d]), R = m.useMemo(() => ({
2381
+ ...f,
2382
+ ...r,
2383
+ refs: v,
2384
+ elements: x,
2385
+ nodeId: t
2386
+ }), [f, v, x, t, r]);
2387
+ return G(() => {
2388
+ r.dataRef.current.floatingContext = R;
2389
+ const b = p == null ? void 0 : p.nodesRef.current.find((w) => w.id === t);
2390
+ b && (b.context = R);
2391
+ }), m.useMemo(() => ({
2392
+ ...f,
2393
+ context: R,
2394
+ refs: v,
2395
+ elements: x
2396
+ }), [f, v, x, R]);
2397
+ }
2398
+ const dn = "active", mn = "selected";
2399
+ function Mt(e, t, n) {
2400
+ const r = /* @__PURE__ */ new Map(), o = n === "item";
2401
+ let i = e;
2402
+ if (o && e) {
2403
+ const {
2404
+ [dn]: s,
2405
+ [mn]: u,
2406
+ ...l
2407
+ } = e;
2408
+ i = l;
2409
+ }
2410
+ return {
2411
+ ...n === "floating" && {
2412
+ tabIndex: -1,
2413
+ [Vt]: ""
2414
+ },
2415
+ ...i,
2416
+ ...t.map((s) => {
2417
+ const u = s ? s[n] : null;
2418
+ return typeof u == "function" ? e ? u(e) : null : u;
2419
+ }).concat(e).reduce((s, u) => (u && Object.entries(u).forEach((l) => {
2420
+ let [c, d] = l;
2421
+ if (!(o && [dn, mn].includes(c)))
2422
+ if (c.indexOf("on") === 0) {
2423
+ if (r.has(c) || r.set(c, []), typeof d == "function") {
2424
+ var a;
2425
+ (a = r.get(c)) == null || a.push(d), s[c] = function() {
2426
+ for (var p, f = arguments.length, g = new Array(f), h = 0; h < f; h++)
2427
+ g[h] = arguments[h];
2428
+ return (p = r.get(c)) == null ? void 0 : p.map((v) => v(...g)).find((v) => v !== void 0);
2429
+ };
2430
+ }
2431
+ } else
2432
+ s[c] = d;
2433
+ }), s), {})
2434
+ };
2435
+ }
2436
+ function Uo(e) {
2437
+ e === void 0 && (e = []);
2438
+ const t = e.map((u) => u == null ? void 0 : u.reference), n = e.map((u) => u == null ? void 0 : u.floating), r = e.map((u) => u == null ? void 0 : u.item), o = m.useCallback(
2439
+ (u) => Mt(u, e, "reference"),
2440
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2441
+ t
2442
+ ), i = m.useCallback(
2443
+ (u) => Mt(u, e, "floating"),
2444
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2445
+ n
2446
+ ), s = m.useCallback(
2447
+ (u) => Mt(u, e, "item"),
2448
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2449
+ r
2450
+ );
2451
+ return m.useMemo(() => ({
2452
+ getReferenceProps: o,
2453
+ getFloatingProps: i,
2454
+ getItemProps: s
2455
+ }), [o, i, s]);
2456
+ }
2457
+ let gn = !1;
2458
+ function Rt(e, t, n) {
2459
+ switch (e) {
2460
+ case "vertical":
2461
+ return t;
2462
+ case "horizontal":
2463
+ return n;
2464
+ default:
2465
+ return t || n;
2466
+ }
2467
+ }
2468
+ function pn(e, t) {
2469
+ return Rt(t, e === Ht || e === et, e === $e || e === ze);
2470
+ }
2471
+ function Dt(e, t, n) {
2472
+ return Rt(t, e === et, n ? e === $e : e === ze) || e === "Enter" || e === " " || e === "";
2473
+ }
2474
+ function Po(e, t, n) {
2475
+ return Rt(t, n ? e === $e : e === ze, e === et);
2476
+ }
2477
+ function hn(e, t, n) {
2478
+ return Rt(t, n ? e === ze : e === $e, e === Ht);
2479
+ }
2480
+ function Yo(e, t) {
2481
+ const {
2482
+ open: n,
2483
+ onOpenChange: r,
2484
+ elements: o
2485
+ } = e, {
2486
+ listRef: i,
2487
+ activeIndex: s,
2488
+ onNavigate: u = () => {
2489
+ },
2490
+ enabled: l = !0,
2491
+ selectedIndex: c = null,
2492
+ allowEscape: d = !1,
2493
+ loop: a = !1,
2494
+ nested: p = !1,
2495
+ rtl: f = !1,
2496
+ virtual: g = !1,
2497
+ focusItemOnOpen: h = "auto",
2498
+ focusItemOnHover: v = !0,
2499
+ openOnArrowKeyDown: x = !0,
2500
+ disabledIndices: R = void 0,
2501
+ orientation: b = "vertical",
2502
+ cols: w = 1,
2503
+ scrollItemIntoView: D = !0,
2504
+ virtualItemRef: k,
2505
+ itemSizes: B,
2506
+ dense: W = !1
2507
+ } = t;
2508
+ process.env.NODE_ENV !== "production" && (d && (a || At("`useListNavigation` looping must be enabled to allow escaping."), g || At("`useListNavigation` must be virtual to allow escaping.")), b === "vertical" && w > 1 && At("In grid list navigation mode (`cols` > 1), the `orientation` should", 'be either "horizontal" or "both".'));
2509
+ const Z = Gn(o.floating), H = Ce(Z), $ = qt(), C = wt(), L = fe(u), T = m.useRef(h), y = m.useRef(c ?? -1), O = m.useRef(null), F = m.useRef(!0), I = m.useRef(L), E = m.useRef(!!o.floating), _ = m.useRef(n), Q = m.useRef(!1), be = m.useRef(!1), de = Ce(R), V = Ce(n), M = Ce(D), A = Ce(c), [P, q] = m.useState(), [J, te] = m.useState(), Y = fe(function(N, j, S) {
2510
+ S === void 0 && (S = !1);
2511
+ function K(z) {
2512
+ g ? (q(z.id), C == null || C.events.emit("virtualfocus", z), k && (k.current = z)) : Ie(z, {
2513
+ preventScroll: !0,
2514
+ // Mac Safari does not move the virtual cursor unless the focus call
2515
+ // is sync. However, for the very first focus call, we need to wait
2516
+ // for the position to be ready in order to prevent unwanted
2517
+ // scrolling. This means the virtual cursor will not move to the first
2518
+ // item when first opening the floating element, but will on
2519
+ // subsequent calls. `preventScroll` is supported in modern Safari,
2520
+ // so we can use that instead.
2521
+ // iOS Safari must be async or the first item will not be focused.
2522
+ sync: er() && Tn() ? gn || Q.current : !1
2523
+ });
2524
+ }
2525
+ const ie = N.current[j.current];
2526
+ ie && K(ie), requestAnimationFrame(() => {
2527
+ const z = N.current[j.current] || ie;
2528
+ if (!z) return;
2529
+ ie || K(z);
2530
+ const ge = M.current;
2531
+ ge && ye && (S || !F.current) && (z.scrollIntoView == null || z.scrollIntoView(typeof ge == "boolean" ? {
2532
+ block: "nearest",
2533
+ inline: "nearest"
2534
+ } : ge));
2535
+ });
2536
+ });
2537
+ G(() => {
2538
+ document.createElement("div").focus({
2539
+ get preventScroll() {
2540
+ return gn = !0, !1;
2541
+ }
2542
+ });
2543
+ }, []), G(() => {
2544
+ l && (n && o.floating ? T.current && c != null && (be.current = !0, y.current = c, L(c)) : E.current && (y.current = -1, I.current(null)));
2545
+ }, [l, n, o.floating, c, L]), G(() => {
2546
+ if (l && n && o.floating)
2547
+ if (s == null) {
2548
+ if (Q.current = !1, A.current != null)
2549
+ return;
2550
+ if (E.current && (y.current = -1, Y(i, y)), (!_.current || !E.current) && T.current && (O.current != null || T.current === !0 && O.current == null)) {
2551
+ let N = 0;
2552
+ const j = () => {
2553
+ i.current[0] == null ? (N < 2 && (N ? requestAnimationFrame : queueMicrotask)(j), N++) : (y.current = O.current == null || Dt(O.current, b, f) || p ? Tt(i, de.current) : tn(i, de.current), O.current = null, L(y.current));
2554
+ };
2555
+ j();
2556
+ }
2557
+ } else Ue(i, s) || (y.current = s, Y(i, y, be.current), be.current = !1);
2558
+ }, [l, n, o.floating, s, A, p, i, b, f, L, Y, de]), G(() => {
2559
+ var N;
2560
+ if (!l || o.floating || !C || g || !E.current)
2561
+ return;
2562
+ const j = C.nodesRef.current, S = (N = j.find((z) => z.id === $)) == null || (N = N.context) == null ? void 0 : N.elements.floating, K = xe(se(o.floating)), ie = j.some((z) => z.context && ne(z.context.elements.floating, K));
2563
+ S && !ie && F.current && S.focus({
2564
+ preventScroll: !0
2565
+ });
2566
+ }, [l, o.floating, C, $, g]), G(() => {
2567
+ if (!l || !C || !g || $) return;
2568
+ function N(j) {
2569
+ te(j.id), k && (k.current = j);
2570
+ }
2571
+ return C.events.on("virtualfocus", N), () => {
2572
+ C.events.off("virtualfocus", N);
2573
+ };
2574
+ }, [l, C, g, $, k]), G(() => {
2575
+ I.current = L, E.current = !!o.floating;
2576
+ }), G(() => {
2577
+ n || (O.current = null);
2578
+ }, [n]), G(() => {
2579
+ _.current = n;
2580
+ }, [n]);
2581
+ const Me = s != null, ye = m.useMemo(() => {
2582
+ function N(S) {
2583
+ if (!n) return;
2584
+ const K = i.current.indexOf(S);
2585
+ K !== -1 && L(K);
2586
+ }
2587
+ return {
2588
+ onFocus(S) {
2589
+ let {
2590
+ currentTarget: K
2591
+ } = S;
2592
+ N(K);
2593
+ },
2594
+ onClick: (S) => {
2595
+ let {
2596
+ currentTarget: K
2597
+ } = S;
2598
+ return K.focus({
2599
+ preventScroll: !0
2600
+ });
2601
+ },
2602
+ // Safari
2603
+ ...v && {
2604
+ onMouseMove(S) {
2605
+ let {
2606
+ currentTarget: K
2607
+ } = S;
2608
+ N(K);
2609
+ },
2610
+ onPointerLeave(S) {
2611
+ let {
2612
+ pointerType: K
2613
+ } = S;
2614
+ !F.current || K === "touch" || (y.current = -1, Y(i, y), L(null), g || Ie(H.current, {
2615
+ preventScroll: !0
2616
+ }));
2617
+ }
2618
+ }
2619
+ };
2620
+ }, [n, H, Y, v, i, L, g]), oe = fe((N) => {
2621
+ if (F.current = !1, Q.current = !0, !V.current && N.currentTarget === H.current)
2622
+ return;
2623
+ if (p && hn(N.key, b, f)) {
2624
+ re(N), r(!1, N.nativeEvent, "list-navigation"), X(o.domReference) && !g && o.domReference.focus();
2625
+ return;
2626
+ }
2627
+ const j = y.current, S = Tt(i, R), K = tn(i, R);
2628
+ if (N.key === "Home" && (re(N), y.current = S, L(y.current)), N.key === "End" && (re(N), y.current = K, L(y.current)), w > 1) {
2629
+ const ie = B || Array.from({
2630
+ length: i.current.length
2631
+ }, () => ({
2632
+ width: 1,
2633
+ height: 1
2634
+ })), z = uo(ie, w, W), ge = z.findIndex((ae) => ae != null && !ut(i.current, ae, R)), tt = z.reduce((ae, Re, nt) => Re != null && !ut(i.current, Re, R) ? nt : ae, -1), je = z[co({
2635
+ current: z.map((ae) => ae != null ? i.current[ae] : null)
2636
+ }, {
2637
+ event: N,
2638
+ orientation: b,
2639
+ loop: a,
2640
+ cols: w,
2641
+ // treat undefined (empty grid spaces) as disabled indices so we
2642
+ // don't end up in them
2643
+ disabledIndices: ao([...R || i.current.map((ae, Re) => ut(i.current, Re) ? Re : void 0), void 0], z),
2644
+ minIndex: ge,
2645
+ maxIndex: tt,
2646
+ prevIndex: lo(
2647
+ y.current > K ? S : y.current,
2648
+ ie,
2649
+ z,
2650
+ w,
2651
+ // use a corner matching the edge closest to the direction
2652
+ // we're moving in so we don't end up in the same item. Prefer
2653
+ // top/left over bottom/right.
2654
+ N.key === et ? "bl" : N.key === ze ? "tr" : "tl"
2655
+ ),
2656
+ stopEvent: !0
2657
+ })];
2658
+ if (je != null && (y.current = je, L(y.current)), b === "both")
2659
+ return;
2660
+ }
2661
+ if (pn(N.key, b)) {
2662
+ if (re(N), n && !g && xe(N.currentTarget.ownerDocument) === N.currentTarget) {
2663
+ y.current = Dt(N.key, b, f) ? S : K, L(y.current);
2664
+ return;
2665
+ }
2666
+ Dt(N.key, b, f) ? a ? y.current = j >= K ? d && j !== i.current.length ? -1 : S : ee(i, {
2667
+ startingIndex: j,
2668
+ disabledIndices: R
2669
+ }) : y.current = Math.min(K, ee(i, {
2670
+ startingIndex: j,
2671
+ disabledIndices: R
2672
+ })) : a ? y.current = j <= S ? d && j !== -1 ? i.current.length : K : ee(i, {
2673
+ startingIndex: j,
2674
+ decrement: !0,
2675
+ disabledIndices: R
2676
+ }) : y.current = Math.max(S, ee(i, {
2677
+ startingIndex: j,
2678
+ decrement: !0,
2679
+ disabledIndices: R
2680
+ })), Ue(i, y.current) ? L(null) : L(y.current);
2681
+ }
2682
+ }), we = m.useMemo(() => g && n && Me && {
2683
+ "aria-activedescendant": J || P
2684
+ }, [g, n, Me, J, P]), me = m.useMemo(() => ({
2685
+ "aria-orientation": b === "both" ? void 0 : b,
2686
+ ...!An(o.domReference) && we,
2687
+ onKeyDown: oe,
2688
+ onPointerMove() {
2689
+ F.current = !0;
2690
+ }
2691
+ }), [we, oe, o.domReference, b]), qe = m.useMemo(() => {
2692
+ function N(S) {
2693
+ h === "auto" && In(S.nativeEvent) && (T.current = !0);
2694
+ }
2695
+ function j(S) {
2696
+ T.current = h, h === "auto" && Cn(S.nativeEvent) && (T.current = !0);
2697
+ }
2698
+ return {
2699
+ ...we,
2700
+ onKeyDown(S) {
2701
+ F.current = !1;
2702
+ const K = S.key.indexOf("Arrow") === 0, ie = Po(S.key, b, f), z = hn(S.key, b, f), ge = pn(S.key, b), tt = (p ? ie : ge) || S.key === "Enter" || S.key.trim() === "";
2703
+ if (g && n) {
2704
+ const nt = C == null ? void 0 : C.nodesRef.current.find((rt) => rt.parentId == null), Ee = C && nt ? yo(C.nodesRef.current, nt.id) : null;
2705
+ if (K && Ee && k) {
2706
+ const rt = new KeyboardEvent("keydown", {
2707
+ key: S.key,
2708
+ bubbles: !0
2709
+ });
2710
+ if (ie || z) {
2711
+ var je, ae;
2712
+ const Xn = ((je = Ee.context) == null ? void 0 : je.elements.domReference) === S.currentTarget, Ut = z && !Xn ? (ae = Ee.context) == null ? void 0 : ae.elements.domReference : ie ? i.current.find((Yt) => (Yt == null ? void 0 : Yt.id) === P) : null;
2713
+ Ut && (re(S), Ut.dispatchEvent(rt), te(void 0));
2714
+ }
2715
+ if (ge && Ee.context && Ee.context.open && Ee.parentId && S.currentTarget !== Ee.context.elements.domReference) {
2716
+ var Re;
2717
+ re(S), (Re = Ee.context.elements.domReference) == null || Re.dispatchEvent(rt);
2718
+ return;
2719
+ }
2720
+ }
2721
+ return oe(S);
2722
+ }
2723
+ if (!(!n && !x && K)) {
2724
+ if (tt && (O.current = p && ge ? null : S.key), p) {
2725
+ ie && (re(S), n ? (y.current = Tt(i, de.current), L(y.current)) : r(!0, S.nativeEvent, "list-navigation"));
2726
+ return;
2727
+ }
2728
+ ge && (c != null && (y.current = c), re(S), !n && x ? r(!0, S.nativeEvent, "list-navigation") : oe(S), n && L(y.current));
2729
+ }
2730
+ },
2731
+ onFocus() {
2732
+ n && !g && L(null);
2733
+ },
2734
+ onPointerDown: j,
2735
+ onMouseDown: N,
2736
+ onClick: N
2737
+ };
2738
+ }, [P, we, oe, de, h, i, p, L, r, n, x, b, f, c, C, g, k]);
2739
+ return m.useMemo(() => l ? {
2740
+ reference: qe,
2741
+ floating: me,
2742
+ item: ye
2743
+ } : {}, [l, qe, me, ye]);
2744
+ }
2745
+ const ko = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
2746
+ function Go(e, t) {
2747
+ var n;
2748
+ t === void 0 && (t = {});
2749
+ const {
2750
+ open: r,
2751
+ floatingId: o
2752
+ } = e, {
2753
+ enabled: i = !0,
2754
+ role: s = "dialog"
2755
+ } = t, u = (n = ko.get(s)) != null ? n : s, l = zt(), d = qt() != null, a = m.useMemo(() => u === "tooltip" || s === "label" ? {
2756
+ ["aria-" + (s === "label" ? "labelledby" : "describedby")]: r ? o : void 0
2757
+ } : {
2758
+ "aria-expanded": r ? "true" : "false",
2759
+ "aria-haspopup": u === "alertdialog" ? "dialog" : u,
2760
+ "aria-controls": r ? o : void 0,
2761
+ ...u === "listbox" && {
2762
+ role: "combobox"
2763
+ },
2764
+ ...u === "menu" && {
2765
+ id: l
2766
+ },
2767
+ ...u === "menu" && d && {
2768
+ role: "menuitem"
2769
+ },
2770
+ ...s === "select" && {
2771
+ "aria-autocomplete": "none"
2772
+ },
2773
+ ...s === "combobox" && {
2774
+ "aria-autocomplete": "list"
2775
+ }
2776
+ }, [u, o, d, r, l, s]), p = m.useMemo(() => {
2777
+ const g = {
2778
+ id: o,
2779
+ ...u && {
2780
+ role: u
2781
+ }
2782
+ };
2783
+ return u === "tooltip" || s === "label" ? g : {
2784
+ ...g,
2785
+ ...u === "menu" && {
2786
+ "aria-labelledby": l
2787
+ }
2788
+ };
2789
+ }, [u, o, l, s]), f = m.useCallback((g) => {
2790
+ let {
2791
+ active: h,
2792
+ selected: v
2793
+ } = g;
2794
+ const x = {
2795
+ role: "option",
2796
+ ...h && {
2797
+ id: o + "-option"
2798
+ }
2799
+ };
2800
+ switch (s) {
2801
+ case "select":
2802
+ return {
2803
+ ...x,
2804
+ "aria-selected": h && v
2805
+ };
2806
+ case "combobox":
2807
+ return {
2808
+ ...x,
2809
+ ...h && {
2810
+ "aria-selected": !0
2811
+ }
2812
+ };
2813
+ }
2814
+ return {};
2815
+ }, [o, s]);
2816
+ return m.useMemo(() => i ? {
2817
+ reference: a,
2818
+ floating: p,
2819
+ item: f
2820
+ } : {}, [i, a, p, f]);
2821
+ }
2822
+ export {
2823
+ Ho as F,
2824
+ Vo as a,
2825
+ ro as b,
2826
+ No as c,
2827
+ jo as d,
2828
+ _o as e,
2829
+ to as f,
2830
+ $o as g,
2831
+ Bo as h,
2832
+ Go as i,
2833
+ qo as j,
2834
+ Yo as k,
2835
+ Uo as l,
2836
+ zo as m,
2837
+ eo as o,
2838
+ Wo as s,
2839
+ Ko as u
2840
+ };