@arc-ui/components 11.16.0 → 11.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/dist/Calendar/Calendar.cjs.js +21 -0
  2. package/dist/Calendar/Calendar.esm.js +13 -0
  3. package/dist/Calendar/package.json +7 -0
  4. package/dist/Checkbox/Checkbox.cjs.js +3 -2
  5. package/dist/Checkbox/Checkbox.esm.js +3 -2
  6. package/dist/DatePicker/DatePicker.cjs.js +565 -0
  7. package/dist/DatePicker/DatePicker.esm.js +552 -0
  8. package/dist/DatePicker/package.json +7 -0
  9. package/dist/FormControl/FormControl.cjs.js +2 -1
  10. package/dist/FormControl/FormControl.esm.js +2 -1
  11. package/dist/InformationCard/InformationCard.cjs.js +10 -9
  12. package/dist/InformationCard/InformationCard.esm.js +8 -7
  13. package/dist/MediaCard/MediaCard.cjs.js +56 -0
  14. package/dist/MediaCard/MediaCard.esm.js +48 -0
  15. package/dist/MediaCard/package.json +7 -0
  16. package/dist/Modal/Modal.cjs.js +13 -286
  17. package/dist/Modal/Modal.esm.js +6 -279
  18. package/dist/RadioGroup/RadioGroup.cjs.js +3 -2
  19. package/dist/RadioGroup/RadioGroup.esm.js +3 -2
  20. package/dist/Select/Select.cjs.js +31 -2705
  21. package/dist/Select/Select.esm.js +13 -2668
  22. package/dist/SiteFooter/SiteFooter.cjs.js +2 -2
  23. package/dist/SiteFooter/SiteFooter.esm.js +3 -3
  24. package/dist/SiteHeader/SiteHeader.cjs.js +2 -2
  25. package/dist/SiteHeader/SiteHeader.esm.js +2 -2
  26. package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +23 -0
  27. package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +15 -0
  28. package/dist/SiteHeaderV2/package.json +7 -0
  29. package/dist/Switch/Switch.cjs.js +4 -3
  30. package/dist/Switch/Switch.esm.js +4 -3
  31. package/dist/Tabs/Tabs.cjs.js +5 -5
  32. package/dist/Tabs/Tabs.esm.js +5 -5
  33. package/dist/TextArea/TextArea.cjs.js +20 -20
  34. package/dist/TextArea/TextArea.esm.js +20 -20
  35. package/dist/TextInput/TextInput.cjs.js +3 -2
  36. package/dist/TextInput/TextInput.esm.js +3 -2
  37. package/dist/Toast/Toast.cjs.js +6 -7
  38. package/dist/Toast/Toast.esm.js +6 -7
  39. package/dist/TypographyCard/TypographyCard.cjs.js +13 -70
  40. package/dist/TypographyCard/TypographyCard.esm.js +14 -71
  41. package/dist/_shared/cjs/Calendar-18e255f8.js +4106 -0
  42. package/dist/_shared/cjs/CardFooter-43c32239.js +80 -0
  43. package/dist/_shared/cjs/CardLabel-768abf20.js +54 -0
  44. package/dist/_shared/cjs/{Checkbox-904ad028.js → Checkbox-4d4b432f.js} +1 -1
  45. package/dist/_shared/cjs/{index-3d69ea00.js → Combination-9974f2e2.js} +662 -145
  46. package/dist/_shared/cjs/{FormControl-166e0957.js → FormControl-b26ad353.js} +8 -5
  47. package/dist/_shared/cjs/{RadioGroup-1eddf86f.js → RadioGroup-23c964ae.js} +1 -1
  48. package/dist/_shared/cjs/{SiteFooter-97c27b29.js → SiteFooter-65b6360c.js} +2 -2
  49. package/dist/_shared/cjs/{SiteHeader.rehydrator-af3dddef.js → SiteHeader.rehydrator-df053a52.js} +8 -8
  50. package/dist/_shared/cjs/SiteHeaderV2-8ce6d4fc.js +610 -0
  51. package/dist/_shared/cjs/{Tabs-cc77dabb.js → Tabs-34db6bc1.js} +4 -4
  52. package/dist/_shared/cjs/{TextInput-fd9c756f.js → TextInput-d0370fa8.js} +19 -6
  53. package/dist/_shared/cjs/{Toast-91e96744.js → Toast-392b1d60.js} +292 -34
  54. package/dist/_shared/cjs/{index-84e6a68f.js → index-6eb396a3.js} +1 -1
  55. package/dist/_shared/cjs/{index-6542b467.js → index-74004a9c.js} +1 -1
  56. package/dist/_shared/cjs/index-77ab5c6a.js +2180 -0
  57. package/dist/_shared/cjs/{index-d31f2b65.js → index-9f99d686.js} +1 -1
  58. package/dist/_shared/cjs/{index-1641d0b4.js → index-a31e64a9.js} +1 -1
  59. package/dist/_shared/cjs/{index-49c72a87.js → index-d38f1bd0.js} +1 -1
  60. package/dist/_shared/esm/Calendar-4033fa48.js +4093 -0
  61. package/dist/_shared/esm/CardFooter-dd8d4000.js +74 -0
  62. package/dist/_shared/esm/CardLabel-d6d71407.js +46 -0
  63. package/dist/_shared/esm/{Checkbox-8a5bb9a1.js → Checkbox-720b074d.js} +1 -1
  64. package/dist/_shared/esm/{index-3e2bc99d.js → Combination-e9f7e64e.js} +643 -132
  65. package/dist/_shared/esm/{FormControl-9d4ddfec.js → FormControl-f0b8fe91.js} +8 -5
  66. package/dist/_shared/esm/{RadioGroup-238db88d.js → RadioGroup-37fdb06b.js} +1 -1
  67. package/dist/_shared/esm/{SiteFooter-94316b8b.js → SiteFooter-38ee1536.js} +1 -1
  68. package/dist/_shared/esm/{SiteHeader.rehydrator-1b507253.js → SiteHeader.rehydrator-32bdcd88.js} +2 -2
  69. package/dist/_shared/esm/SiteHeaderV2-f8377627.js +604 -0
  70. package/dist/_shared/esm/{Tabs-8719d952.js → Tabs-df9965dd.js} +4 -4
  71. package/dist/_shared/esm/{TextInput-c1e2a1dd.js → TextInput-abbab56b.js} +19 -6
  72. package/dist/_shared/esm/{Toast-7cb1e544.js → Toast-5d66e13f.js} +264 -7
  73. package/dist/_shared/esm/{index-39019a9b.js → index-044da8d0.js} +1 -1
  74. package/dist/_shared/esm/{index-6b7b075c.js → index-25a5b393.js} +1 -1
  75. package/dist/_shared/esm/{index-246b4f18.js → index-2cfab9f2.js} +1 -1
  76. package/dist/_shared/esm/{index-12f3a407.js → index-7b531fa7.js} +68 -68
  77. package/dist/_shared/esm/index-b84a20c6.js +2155 -0
  78. package/dist/_shared/esm/{index-db47e95a.js → index-ca72c9d5.js} +1 -1
  79. package/dist/_shared/esm/{index-936b5179.js → index-efa9be1a.js} +1 -1
  80. package/dist/_shared/esm/{index.es-c552c0ea.js → use-media-query-4c807227.js} +9 -9
  81. package/dist/index.es.js +1135 -791
  82. package/dist/index.es.js.map +1 -1
  83. package/dist/index.js +1136 -791
  84. package/dist/index.js.map +1 -1
  85. package/dist/styles.css +4 -4
  86. package/dist/types/components/Calendar/Calendar.d.ts +49 -0
  87. package/dist/types/components/Calendar/Calendar.provider.d.ts +21 -0
  88. package/dist/types/components/Calendar/components/CalendarDateSelect/CalendarDateSelect.d.ts +15 -0
  89. package/dist/types/components/Calendar/components/CalendarDateSelect/index.d.ts +1 -0
  90. package/dist/types/components/Calendar/components/CalendarDayGrid/CalendarDayGrid.d.ts +6 -0
  91. package/dist/types/components/Calendar/components/CalendarDayGrid/index.d.ts +1 -0
  92. package/dist/types/components/Calendar/components/CalendarDayNumber/CalendarDayNumber.d.ts +8 -0
  93. package/dist/types/components/Calendar/components/CalendarDayNumber/index.d.ts +1 -0
  94. package/dist/types/components/Calendar/components/CalendarDoubleMonthView/CalendarDoubleMonthView.d.ts +9 -0
  95. package/dist/types/components/Calendar/components/CalendarDoubleMonthView/index.d.ts +1 -0
  96. package/dist/types/components/Calendar/components/CalendarFooter/CalendarFooter.d.ts +6 -0
  97. package/dist/types/components/Calendar/components/CalendarFooter/index.d.ts +1 -0
  98. package/dist/types/components/Calendar/components/CalendarMonthView/CalendarMonthView.d.ts +9 -0
  99. package/dist/types/components/Calendar/components/CalendarMonthView/index.d.ts +1 -0
  100. package/dist/types/components/Calendar/components/CalendarMonthYearView/CalendarMonthYearView.d.ts +11 -0
  101. package/dist/types/components/Calendar/components/CalendarMonthYearView/index.d.ts +1 -0
  102. package/dist/types/components/Calendar/components/CalendarNavButton/CalendarNavButton.d.ts +10 -0
  103. package/dist/types/components/Calendar/components/CalendarNavButton/index.d.ts +1 -0
  104. package/dist/types/components/Calendar/components/CalendarWrapper/CalendarWrapper.d.ts +5 -0
  105. package/dist/types/components/Calendar/components/CalendarWrapper/index.d.ts +1 -0
  106. package/dist/types/components/Calendar/components/index.d.ts +6 -0
  107. package/dist/types/components/Calendar/constants/day-names.d.ts +5 -0
  108. package/dist/types/components/Calendar/constants/index.d.ts +1 -0
  109. package/dist/types/components/Calendar/helpers/contains-date.d.ts +1 -0
  110. package/dist/types/components/Calendar/helpers/contains-date.test.d.ts +1 -0
  111. package/dist/types/components/Calendar/helpers/date-without-time.d.ts +1 -0
  112. package/dist/types/components/Calendar/helpers/date-without-time.test.d.ts +1 -0
  113. package/dist/types/components/Calendar/helpers/get-calendar-type.d.ts +2 -0
  114. package/dist/types/components/Calendar/helpers/get-calendar-type.test.d.ts +1 -0
  115. package/dist/types/components/Calendar/helpers/get-dates-in-month.d.ts +1 -0
  116. package/dist/types/components/Calendar/helpers/get-dates-in-month.test.d.ts +1 -0
  117. package/dist/types/components/Calendar/helpers/get-double-month-display-range.d.ts +1 -0
  118. package/dist/types/components/Calendar/helpers/get-double-month-display-range.test.d.ts +1 -0
  119. package/dist/types/components/Calendar/helpers/get-focus-date.d.ts +5 -0
  120. package/dist/types/components/Calendar/helpers/get-focus-date.test.d.ts +1 -0
  121. package/dist/types/components/Calendar/helpers/get-highlighted-range.d.ts +6 -0
  122. package/dist/types/components/Calendar/helpers/get-highlighted-range.test.d.ts +1 -0
  123. package/dist/types/components/Calendar/helpers/get-keydown-date.d.ts +6 -0
  124. package/dist/types/components/Calendar/helpers/get-keydown-date.test.d.ts +1 -0
  125. package/dist/types/components/Calendar/helpers/index.d.ts +13 -0
  126. package/dist/types/components/Calendar/helpers/is-day.d.ts +2 -0
  127. package/dist/types/components/Calendar/helpers/is-day.test.d.ts +1 -0
  128. package/dist/types/components/Calendar/helpers/is-disabled-date.d.ts +1 -0
  129. package/dist/types/components/Calendar/helpers/is-disabled-date.test.d.ts +1 -0
  130. package/dist/types/components/Calendar/helpers/is-month-after-max-date.d.ts +1 -0
  131. package/dist/types/components/Calendar/helpers/is-month-after-max-date.test.d.ts +1 -0
  132. package/dist/types/components/Calendar/helpers/is-month-before-min-date.d.ts +1 -0
  133. package/dist/types/components/Calendar/helpers/is-month-before-min-date.test.d.ts +1 -0
  134. package/dist/types/components/Calendar/helpers/process-selected-range.d.ts +9 -0
  135. package/dist/types/components/Calendar/helpers/process-selected-range.test.d.ts +1 -0
  136. package/dist/types/components/Calendar/index.d.ts +2 -0
  137. package/dist/types/components/Calendar/state/handlers/calendar-keydown-handler.d.ts +3 -0
  138. package/dist/types/components/Calendar/state/handlers/day-grid-leave-handler.d.ts +3 -0
  139. package/dist/types/components/Calendar/state/handlers/day-number-select-handler.d.ts +3 -0
  140. package/dist/types/components/Calendar/state/handlers/default-handler.d.ts +2 -0
  141. package/dist/types/components/Calendar/state/handlers/dropdown-change-month-handler.d.ts +3 -0
  142. package/dist/types/components/Calendar/state/handlers/dropdown-change-year-handler.d.ts +3 -0
  143. package/dist/types/components/Calendar/state/handlers/highlight-range-handler.d.ts +3 -0
  144. package/dist/types/components/Calendar/state/handlers/index.d.ts +12 -0
  145. package/dist/types/components/Calendar/state/handlers/range-select-handler.d.ts +3 -0
  146. package/dist/types/components/Calendar/state/handlers/show-next-double-month-handler.d.ts +3 -0
  147. package/dist/types/components/Calendar/state/handlers/show-next-month-handler.d.ts +3 -0
  148. package/dist/types/components/Calendar/state/handlers/show-previous-double-month-handler.d.ts +3 -0
  149. package/dist/types/components/Calendar/state/handlers/show-previous-month-handler.d.ts +3 -0
  150. package/dist/types/components/Calendar/state/index.d.ts +2 -0
  151. package/dist/types/components/Calendar/state/reducer.d.ts +3 -0
  152. package/dist/types/components/Calendar/state/reducer.test.d.ts +1 -0
  153. package/dist/types/components/Calendar/state/types/actions.d.ts +81 -0
  154. package/dist/types/components/Calendar/state/types/state-handler.d.ts +3 -0
  155. package/dist/types/components/Calendar/state/types/state.d.ts +5 -0
  156. package/dist/types/components/Calendar/types/calendar-type.d.ts +1 -0
  157. package/dist/types/components/Calendar/types/date-select-value.d.ts +2 -0
  158. package/dist/types/components/Calendar/types/index.d.ts +6 -0
  159. package/dist/types/components/Calendar/types/key-names.d.ts +13 -0
  160. package/dist/types/components/Calendar/types/range-selection.d.ts +10 -0
  161. package/dist/types/components/Calendar/types/selection-type.d.ts +1 -0
  162. package/dist/types/components/Calendar/types/week-days.d.ts +18 -0
  163. package/dist/types/components/DatePicker/DatePicker.d.ts +17 -0
  164. package/dist/types/components/DatePicker/constants/date-format.d.ts +1 -0
  165. package/dist/types/components/DatePicker/constants/index.d.ts +1 -0
  166. package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.d.ts +1 -0
  167. package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.test.d.ts +1 -0
  168. package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.d.ts +1 -0
  169. package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.test.d.ts +1 -0
  170. package/dist/types/components/DatePicker/helpers/format-date.d.ts +1 -0
  171. package/dist/types/components/DatePicker/helpers/format-date.test.d.ts +1 -0
  172. package/dist/types/components/DatePicker/helpers/index.d.ts +8 -0
  173. package/dist/types/components/DatePicker/helpers/is-date-valid.d.ts +1 -0
  174. package/dist/types/components/DatePicker/helpers/is-date-valid.test.d.ts +1 -0
  175. package/dist/types/components/DatePicker/helpers/is-disabled-date.d.ts +1 -0
  176. package/dist/types/components/DatePicker/helpers/is-disabled-date.test.d.ts +1 -0
  177. package/dist/types/components/DatePicker/helpers/is-range-valid.d.ts +1 -0
  178. package/dist/types/components/DatePicker/helpers/is-range-valid.test.d.ts +1 -0
  179. package/dist/types/components/DatePicker/helpers/parse-date-string.d.ts +5 -0
  180. package/dist/types/components/DatePicker/helpers/parse-date-string.test.d.ts +1 -0
  181. package/dist/types/components/DatePicker/helpers/parse-range-string.d.ts +14 -0
  182. package/dist/types/components/DatePicker/helpers/parse-range-string.test.d.ts +1 -0
  183. package/dist/types/components/DatePicker/index.d.ts +6 -0
  184. package/dist/types/components/FormControl/FormControl.d.ts +4 -0
  185. package/dist/types/components/RadioGroup/RadioGroup.d.ts +1 -1
  186. package/dist/types/components/SiteHeaderV2/SiteHeaderV2.d.ts +77 -0
  187. package/dist/types/components/SiteHeaderV2/components/BackButton/BackButton.d.ts +5 -0
  188. package/dist/types/components/SiteHeaderV2/components/BackButton/index.d.ts +1 -0
  189. package/dist/types/components/SiteHeaderV2/components/Column/Column.d.ts +8 -0
  190. package/dist/types/components/SiteHeaderV2/components/Column/index.d.ts +1 -0
  191. package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/HorizontalPanel.d.ts +13 -0
  192. package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/index.d.ts +1 -0
  193. package/dist/types/components/SiteHeaderV2/components/Item/Item.d.ts +20 -0
  194. package/dist/types/components/SiteHeaderV2/components/Item/index.d.ts +1 -0
  195. package/dist/types/components/SiteHeaderV2/components/ItemGroup/ItemGroup.d.ts +27 -0
  196. package/dist/types/components/SiteHeaderV2/components/ItemGroup/index.d.ts +1 -0
  197. package/dist/types/components/SiteHeaderV2/components/MenuButton/MenuButton.d.ts +6 -0
  198. package/dist/types/components/SiteHeaderV2/components/MenuButton/index.d.ts +1 -0
  199. package/dist/types/components/SiteHeaderV2/components/NavItem/NavItem.d.ts +40 -0
  200. package/dist/types/components/SiteHeaderV2/components/NavItem/NavItemWithSubNav.d.ts +55 -0
  201. package/dist/types/components/SiteHeaderV2/components/NavItem/index.d.ts +2 -0
  202. package/dist/types/components/SiteHeaderV2/components/NodeItem/NodeItem.d.ts +8 -0
  203. package/dist/types/components/SiteHeaderV2/components/Panel/Panel.d.ts +26 -0
  204. package/dist/types/components/SiteHeaderV2/components/Panel/index.d.ts +1 -0
  205. package/dist/types/components/SiteHeaderV2/components/SubNavItem/SubNavItem.d.ts +45 -0
  206. package/dist/types/components/SiteHeaderV2/components/SubNavItem/index.d.ts +1 -0
  207. package/dist/types/components/SiteHeaderV2/components/VerticalDivider/VerticalDivider.d.ts +1 -0
  208. package/dist/types/components/SiteHeaderV2/components/VerticalDivider/index.d.ts +1 -0
  209. package/dist/types/components/SiteHeaderV2/index.d.ts +1 -0
  210. package/dist/types/components/TextArea/TextArea.d.ts +4 -0
  211. package/dist/types/components/TextInput/TextInput.d.ts +22 -3
  212. package/dist/types/components/index.d.ts +1 -0
  213. package/dist/types/private-components/CardFooter/CardFooter.d.ts +11 -0
  214. package/dist/types/private-components/CardFooter/index.d.ts +1 -0
  215. package/dist/types/private-components/CardHeading/CardHeading.d.ts +19 -0
  216. package/dist/types/private-components/CardHeading/index.d.ts +1 -0
  217. package/dist/types/private-components/CardLabel/CardLabel.d.ts +10 -0
  218. package/dist/types/private-components/CardLabel/index.d.ts +1 -0
  219. package/dist/types/private-components/index.d.ts +4 -0
  220. package/dist/types/styles.d.ts +6 -0
  221. package/package.json +4 -2
  222. package/dist/_shared/cjs/BtIconArrowRight.esm-8e8ac316.js +0 -30
  223. package/dist/_shared/cjs/index-4ecad2dd.js +0 -273
  224. package/dist/_shared/esm/BtIconArrowRight.esm-267916a4.js +0 -24
  225. package/dist/_shared/esm/index-d0307140.js +0 -264
  226. package/dist/types/internal-components/index.d.ts +0 -1
  227. package/dist/_shared/cjs/{index-56a040f4.js → index-dd1d18ea.js} +66 -66
  228. package/dist/_shared/cjs/{index.es-26dd8c5d.js → use-media-query-e61881d8.js} +8 -8
  229. /package/dist/types/{internal-components → private-components}/ConditionalWrapper/ConditionalWrapper.d.ts +0 -0
  230. /package/dist/types/{internal-components → private-components}/ConditionalWrapper/index.d.ts +0 -0
@@ -0,0 +1,2180 @@
1
+ 'use strict';
2
+
3
+ var _extends = require('./extends-8c5e4b48.js');
4
+ var React = require('react');
5
+ var $7SXl2$reactdom = require('react-dom');
6
+ var index$1 = require('./index-dd1d18ea.js');
7
+
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n["default"] = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
+ var $7SXl2$reactdom__namespace = /*#__PURE__*/_interopNamespace($7SXl2$reactdom);
28
+
29
+ const sides = ['top', 'right', 'bottom', 'left'];
30
+ const min = Math.min;
31
+ const max = Math.max;
32
+ const round = Math.round;
33
+ const floor = Math.floor;
34
+ const createCoords = v => ({
35
+ x: v,
36
+ y: v
37
+ });
38
+ const oppositeSideMap = {
39
+ left: 'right',
40
+ right: 'left',
41
+ bottom: 'top',
42
+ top: 'bottom'
43
+ };
44
+ const oppositeAlignmentMap = {
45
+ start: 'end',
46
+ end: 'start'
47
+ };
48
+ function clamp(start, value, end) {
49
+ return max(start, min(value, end));
50
+ }
51
+ function evaluate(value, param) {
52
+ return typeof value === 'function' ? value(param) : value;
53
+ }
54
+ function getSide(placement) {
55
+ return placement.split('-')[0];
56
+ }
57
+ function getAlignment(placement) {
58
+ return placement.split('-')[1];
59
+ }
60
+ function getOppositeAxis(axis) {
61
+ return axis === 'x' ? 'y' : 'x';
62
+ }
63
+ function getAxisLength(axis) {
64
+ return axis === 'y' ? 'height' : 'width';
65
+ }
66
+ function getSideAxis(placement) {
67
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
68
+ }
69
+ function getAlignmentAxis(placement) {
70
+ return getOppositeAxis(getSideAxis(placement));
71
+ }
72
+ function getAlignmentSides(placement, rects, rtl) {
73
+ if (rtl === void 0) {
74
+ rtl = false;
75
+ }
76
+ const alignment = getAlignment(placement);
77
+ const alignmentAxis = getAlignmentAxis(placement);
78
+ const length = getAxisLength(alignmentAxis);
79
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
80
+ if (rects.reference[length] > rects.floating[length]) {
81
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
82
+ }
83
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
84
+ }
85
+ function getExpandedPlacements(placement) {
86
+ const oppositePlacement = getOppositePlacement(placement);
87
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
88
+ }
89
+ function getOppositeAlignmentPlacement(placement) {
90
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
91
+ }
92
+ function getSideList(side, isStart, rtl) {
93
+ const lr = ['left', 'right'];
94
+ const rl = ['right', 'left'];
95
+ const tb = ['top', 'bottom'];
96
+ const bt = ['bottom', 'top'];
97
+ switch (side) {
98
+ case 'top':
99
+ case 'bottom':
100
+ if (rtl) return isStart ? rl : lr;
101
+ return isStart ? lr : rl;
102
+ case 'left':
103
+ case 'right':
104
+ return isStart ? tb : bt;
105
+ default:
106
+ return [];
107
+ }
108
+ }
109
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
110
+ const alignment = getAlignment(placement);
111
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
112
+ if (alignment) {
113
+ list = list.map(side => side + "-" + alignment);
114
+ if (flipAlignment) {
115
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
116
+ }
117
+ }
118
+ return list;
119
+ }
120
+ function getOppositePlacement(placement) {
121
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
122
+ }
123
+ function expandPaddingObject(padding) {
124
+ return {
125
+ top: 0,
126
+ right: 0,
127
+ bottom: 0,
128
+ left: 0,
129
+ ...padding
130
+ };
131
+ }
132
+ function getPaddingObject(padding) {
133
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
134
+ top: padding,
135
+ right: padding,
136
+ bottom: padding,
137
+ left: padding
138
+ };
139
+ }
140
+ function rectToClientRect(rect) {
141
+ return {
142
+ ...rect,
143
+ top: rect.y,
144
+ left: rect.x,
145
+ right: rect.x + rect.width,
146
+ bottom: rect.y + rect.height
147
+ };
148
+ }
149
+
150
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
151
+ let {
152
+ reference,
153
+ floating
154
+ } = _ref;
155
+ const sideAxis = getSideAxis(placement);
156
+ const alignmentAxis = getAlignmentAxis(placement);
157
+ const alignLength = getAxisLength(alignmentAxis);
158
+ const side = getSide(placement);
159
+ const isVertical = sideAxis === 'y';
160
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
161
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
162
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
163
+ let coords;
164
+ switch (side) {
165
+ case 'top':
166
+ coords = {
167
+ x: commonX,
168
+ y: reference.y - floating.height
169
+ };
170
+ break;
171
+ case 'bottom':
172
+ coords = {
173
+ x: commonX,
174
+ y: reference.y + reference.height
175
+ };
176
+ break;
177
+ case 'right':
178
+ coords = {
179
+ x: reference.x + reference.width,
180
+ y: commonY
181
+ };
182
+ break;
183
+ case 'left':
184
+ coords = {
185
+ x: reference.x - floating.width,
186
+ y: commonY
187
+ };
188
+ break;
189
+ default:
190
+ coords = {
191
+ x: reference.x,
192
+ y: reference.y
193
+ };
194
+ }
195
+ switch (getAlignment(placement)) {
196
+ case 'start':
197
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
198
+ break;
199
+ case 'end':
200
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
201
+ break;
202
+ }
203
+ return coords;
204
+ }
205
+
206
+ /**
207
+ * Computes the `x` and `y` coordinates that will place the floating element
208
+ * next to a reference element when it is given a certain positioning strategy.
209
+ *
210
+ * This export does not have any `platform` interface logic. You will need to
211
+ * write one for the platform you are using Floating UI with.
212
+ */
213
+ const computePosition$1 = async (reference, floating, config) => {
214
+ const {
215
+ placement = 'bottom',
216
+ strategy = 'absolute',
217
+ middleware = [],
218
+ platform
219
+ } = config;
220
+ const validMiddleware = middleware.filter(Boolean);
221
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
222
+ let rects = await platform.getElementRects({
223
+ reference,
224
+ floating,
225
+ strategy
226
+ });
227
+ let {
228
+ x,
229
+ y
230
+ } = computeCoordsFromPlacement(rects, placement, rtl);
231
+ let statefulPlacement = placement;
232
+ let middlewareData = {};
233
+ let resetCount = 0;
234
+ for (let i = 0; i < validMiddleware.length; i++) {
235
+ const {
236
+ name,
237
+ fn
238
+ } = validMiddleware[i];
239
+ const {
240
+ x: nextX,
241
+ y: nextY,
242
+ data,
243
+ reset
244
+ } = await fn({
245
+ x,
246
+ y,
247
+ initialPlacement: placement,
248
+ placement: statefulPlacement,
249
+ strategy,
250
+ middlewareData,
251
+ rects,
252
+ platform,
253
+ elements: {
254
+ reference,
255
+ floating
256
+ }
257
+ });
258
+ x = nextX != null ? nextX : x;
259
+ y = nextY != null ? nextY : y;
260
+ middlewareData = {
261
+ ...middlewareData,
262
+ [name]: {
263
+ ...middlewareData[name],
264
+ ...data
265
+ }
266
+ };
267
+ if (reset && resetCount <= 50) {
268
+ resetCount++;
269
+ if (typeof reset === 'object') {
270
+ if (reset.placement) {
271
+ statefulPlacement = reset.placement;
272
+ }
273
+ if (reset.rects) {
274
+ rects = reset.rects === true ? await platform.getElementRects({
275
+ reference,
276
+ floating,
277
+ strategy
278
+ }) : reset.rects;
279
+ }
280
+ ({
281
+ x,
282
+ y
283
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
284
+ }
285
+ i = -1;
286
+ continue;
287
+ }
288
+ }
289
+ return {
290
+ x,
291
+ y,
292
+ placement: statefulPlacement,
293
+ strategy,
294
+ middlewareData
295
+ };
296
+ };
297
+
298
+ /**
299
+ * Resolves with an object of overflow side offsets that determine how much the
300
+ * element is overflowing a given clipping boundary on each side.
301
+ * - positive = overflowing the boundary by that number of pixels
302
+ * - negative = how many pixels left before it will overflow
303
+ * - 0 = lies flush with the boundary
304
+ * @see https://floating-ui.com/docs/detectOverflow
305
+ */
306
+ async function detectOverflow(state, options) {
307
+ var _await$platform$isEle;
308
+ if (options === void 0) {
309
+ options = {};
310
+ }
311
+ const {
312
+ x,
313
+ y,
314
+ platform,
315
+ rects,
316
+ elements,
317
+ strategy
318
+ } = state;
319
+ const {
320
+ boundary = 'clippingAncestors',
321
+ rootBoundary = 'viewport',
322
+ elementContext = 'floating',
323
+ altBoundary = false,
324
+ padding = 0
325
+ } = evaluate(options, state);
326
+ const paddingObject = getPaddingObject(padding);
327
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
328
+ const element = elements[altBoundary ? altContext : elementContext];
329
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
330
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
331
+ boundary,
332
+ rootBoundary,
333
+ strategy
334
+ }));
335
+ const rect = elementContext === 'floating' ? {
336
+ ...rects.floating,
337
+ x,
338
+ y
339
+ } : rects.reference;
340
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
341
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
342
+ x: 1,
343
+ y: 1
344
+ } : {
345
+ x: 1,
346
+ y: 1
347
+ };
348
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
349
+ rect,
350
+ offsetParent,
351
+ strategy
352
+ }) : rect);
353
+ return {
354
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
355
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
356
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
357
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
358
+ };
359
+ }
360
+
361
+ /**
362
+ * Provides data to position an inner element of the floating element so that it
363
+ * appears centered to the reference element.
364
+ * @see https://floating-ui.com/docs/arrow
365
+ */
366
+ const arrow$1 = options => ({
367
+ name: 'arrow',
368
+ options,
369
+ async fn(state) {
370
+ const {
371
+ x,
372
+ y,
373
+ placement,
374
+ rects,
375
+ platform,
376
+ elements,
377
+ middlewareData
378
+ } = state;
379
+ // Since `element` is required, we don't Partial<> the type.
380
+ const {
381
+ element,
382
+ padding = 0
383
+ } = evaluate(options, state) || {};
384
+ if (element == null) {
385
+ return {};
386
+ }
387
+ const paddingObject = getPaddingObject(padding);
388
+ const coords = {
389
+ x,
390
+ y
391
+ };
392
+ const axis = getAlignmentAxis(placement);
393
+ const length = getAxisLength(axis);
394
+ const arrowDimensions = await platform.getDimensions(element);
395
+ const isYAxis = axis === 'y';
396
+ const minProp = isYAxis ? 'top' : 'left';
397
+ const maxProp = isYAxis ? 'bottom' : 'right';
398
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
399
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
400
+ const startDiff = coords[axis] - rects.reference[axis];
401
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
402
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
403
+
404
+ // DOM platform can return `window` as the `offsetParent`.
405
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
406
+ clientSize = elements.floating[clientProp] || rects.floating[length];
407
+ }
408
+ const centerToReference = endDiff / 2 - startDiff / 2;
409
+
410
+ // If the padding is large enough that it causes the arrow to no longer be
411
+ // centered, modify the padding so that it is centered.
412
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
413
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
414
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
415
+
416
+ // Make sure the arrow doesn't overflow the floating element if the center
417
+ // point is outside the floating element's bounds.
418
+ const min$1 = minPadding;
419
+ const max = clientSize - arrowDimensions[length] - maxPadding;
420
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
421
+ const offset = clamp(min$1, center, max);
422
+
423
+ // If the reference is small enough that the arrow's padding causes it to
424
+ // to point to nothing for an aligned placement, adjust the offset of the
425
+ // floating element itself. To ensure `shift()` continues to take action,
426
+ // a single reset is performed when this is true.
427
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
428
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
429
+ return {
430
+ [axis]: coords[axis] + alignmentOffset,
431
+ data: {
432
+ [axis]: offset,
433
+ centerOffset: center - offset - alignmentOffset,
434
+ ...(shouldAddOffset && {
435
+ alignmentOffset
436
+ })
437
+ },
438
+ reset: shouldAddOffset
439
+ };
440
+ }
441
+ });
442
+
443
+ /**
444
+ * Optimizes the visibility of the floating element by flipping the `placement`
445
+ * in order to keep it in view when the preferred placement(s) will overflow the
446
+ * clipping boundary. Alternative to `autoPlacement`.
447
+ * @see https://floating-ui.com/docs/flip
448
+ */
449
+ const flip = function (options) {
450
+ if (options === void 0) {
451
+ options = {};
452
+ }
453
+ return {
454
+ name: 'flip',
455
+ options,
456
+ async fn(state) {
457
+ var _middlewareData$arrow, _middlewareData$flip;
458
+ const {
459
+ placement,
460
+ middlewareData,
461
+ rects,
462
+ initialPlacement,
463
+ platform,
464
+ elements
465
+ } = state;
466
+ const {
467
+ mainAxis: checkMainAxis = true,
468
+ crossAxis: checkCrossAxis = true,
469
+ fallbackPlacements: specifiedFallbackPlacements,
470
+ fallbackStrategy = 'bestFit',
471
+ fallbackAxisSideDirection = 'none',
472
+ flipAlignment = true,
473
+ ...detectOverflowOptions
474
+ } = evaluate(options, state);
475
+
476
+ // If a reset by the arrow was caused due to an alignment offset being
477
+ // added, we should skip any logic now since `flip()` has already done its
478
+ // work.
479
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
480
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
481
+ return {};
482
+ }
483
+ const side = getSide(placement);
484
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
485
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
486
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
487
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
488
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
489
+ }
490
+ const placements = [initialPlacement, ...fallbackPlacements];
491
+ const overflow = await detectOverflow(state, detectOverflowOptions);
492
+ const overflows = [];
493
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
494
+ if (checkMainAxis) {
495
+ overflows.push(overflow[side]);
496
+ }
497
+ if (checkCrossAxis) {
498
+ const sides = getAlignmentSides(placement, rects, rtl);
499
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
500
+ }
501
+ overflowsData = [...overflowsData, {
502
+ placement,
503
+ overflows
504
+ }];
505
+
506
+ // One or more sides is overflowing.
507
+ if (!overflows.every(side => side <= 0)) {
508
+ var _middlewareData$flip2, _overflowsData$filter;
509
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
510
+ const nextPlacement = placements[nextIndex];
511
+ if (nextPlacement) {
512
+ // Try next placement and re-run the lifecycle.
513
+ return {
514
+ data: {
515
+ index: nextIndex,
516
+ overflows: overflowsData
517
+ },
518
+ reset: {
519
+ placement: nextPlacement
520
+ }
521
+ };
522
+ }
523
+
524
+ // First, find the candidates that fit on the mainAxis side of overflow,
525
+ // then find the placement that fits the best on the main crossAxis side.
526
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
527
+
528
+ // Otherwise fallback.
529
+ if (!resetPlacement) {
530
+ switch (fallbackStrategy) {
531
+ case 'bestFit':
532
+ {
533
+ var _overflowsData$map$so;
534
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
535
+ if (placement) {
536
+ resetPlacement = placement;
537
+ }
538
+ break;
539
+ }
540
+ case 'initialPlacement':
541
+ resetPlacement = initialPlacement;
542
+ break;
543
+ }
544
+ }
545
+ if (placement !== resetPlacement) {
546
+ return {
547
+ reset: {
548
+ placement: resetPlacement
549
+ }
550
+ };
551
+ }
552
+ }
553
+ return {};
554
+ }
555
+ };
556
+ };
557
+
558
+ function getSideOffsets(overflow, rect) {
559
+ return {
560
+ top: overflow.top - rect.height,
561
+ right: overflow.right - rect.width,
562
+ bottom: overflow.bottom - rect.height,
563
+ left: overflow.left - rect.width
564
+ };
565
+ }
566
+ function isAnySideFullyClipped(overflow) {
567
+ return sides.some(side => overflow[side] >= 0);
568
+ }
569
+ /**
570
+ * Provides data to hide the floating element in applicable situations, such as
571
+ * when it is not in the same clipping context as the reference element.
572
+ * @see https://floating-ui.com/docs/hide
573
+ */
574
+ const hide = function (options) {
575
+ if (options === void 0) {
576
+ options = {};
577
+ }
578
+ return {
579
+ name: 'hide',
580
+ options,
581
+ async fn(state) {
582
+ const {
583
+ rects
584
+ } = state;
585
+ const {
586
+ strategy = 'referenceHidden',
587
+ ...detectOverflowOptions
588
+ } = evaluate(options, state);
589
+ switch (strategy) {
590
+ case 'referenceHidden':
591
+ {
592
+ const overflow = await detectOverflow(state, {
593
+ ...detectOverflowOptions,
594
+ elementContext: 'reference'
595
+ });
596
+ const offsets = getSideOffsets(overflow, rects.reference);
597
+ return {
598
+ data: {
599
+ referenceHiddenOffsets: offsets,
600
+ referenceHidden: isAnySideFullyClipped(offsets)
601
+ }
602
+ };
603
+ }
604
+ case 'escaped':
605
+ {
606
+ const overflow = await detectOverflow(state, {
607
+ ...detectOverflowOptions,
608
+ altBoundary: true
609
+ });
610
+ const offsets = getSideOffsets(overflow, rects.floating);
611
+ return {
612
+ data: {
613
+ escapedOffsets: offsets,
614
+ escaped: isAnySideFullyClipped(offsets)
615
+ }
616
+ };
617
+ }
618
+ default:
619
+ {
620
+ return {};
621
+ }
622
+ }
623
+ }
624
+ };
625
+ };
626
+
627
+ // For type backwards-compatibility, the `OffsetOptions` type was also
628
+ // Derivable.
629
+ async function convertValueToCoords(state, options) {
630
+ const {
631
+ placement,
632
+ platform,
633
+ elements
634
+ } = state;
635
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
636
+ const side = getSide(placement);
637
+ const alignment = getAlignment(placement);
638
+ const isVertical = getSideAxis(placement) === 'y';
639
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
640
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
641
+ const rawValue = evaluate(options, state);
642
+
643
+ // eslint-disable-next-line prefer-const
644
+ let {
645
+ mainAxis,
646
+ crossAxis,
647
+ alignmentAxis
648
+ } = typeof rawValue === 'number' ? {
649
+ mainAxis: rawValue,
650
+ crossAxis: 0,
651
+ alignmentAxis: null
652
+ } : {
653
+ mainAxis: 0,
654
+ crossAxis: 0,
655
+ alignmentAxis: null,
656
+ ...rawValue
657
+ };
658
+ if (alignment && typeof alignmentAxis === 'number') {
659
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
660
+ }
661
+ return isVertical ? {
662
+ x: crossAxis * crossAxisMulti,
663
+ y: mainAxis * mainAxisMulti
664
+ } : {
665
+ x: mainAxis * mainAxisMulti,
666
+ y: crossAxis * crossAxisMulti
667
+ };
668
+ }
669
+
670
+ /**
671
+ * Modifies the placement by translating the floating element along the
672
+ * specified axes.
673
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
674
+ * object may be passed.
675
+ * @see https://floating-ui.com/docs/offset
676
+ */
677
+ const offset = function (options) {
678
+ if (options === void 0) {
679
+ options = 0;
680
+ }
681
+ return {
682
+ name: 'offset',
683
+ options,
684
+ async fn(state) {
685
+ const {
686
+ x,
687
+ y
688
+ } = state;
689
+ const diffCoords = await convertValueToCoords(state, options);
690
+ return {
691
+ x: x + diffCoords.x,
692
+ y: y + diffCoords.y,
693
+ data: diffCoords
694
+ };
695
+ }
696
+ };
697
+ };
698
+
699
+ /**
700
+ * Optimizes the visibility of the floating element by shifting it in order to
701
+ * keep it in view when it will overflow the clipping boundary.
702
+ * @see https://floating-ui.com/docs/shift
703
+ */
704
+ const shift = function (options) {
705
+ if (options === void 0) {
706
+ options = {};
707
+ }
708
+ return {
709
+ name: 'shift',
710
+ options,
711
+ async fn(state) {
712
+ const {
713
+ x,
714
+ y,
715
+ placement
716
+ } = state;
717
+ const {
718
+ mainAxis: checkMainAxis = true,
719
+ crossAxis: checkCrossAxis = false,
720
+ limiter = {
721
+ fn: _ref => {
722
+ let {
723
+ x,
724
+ y
725
+ } = _ref;
726
+ return {
727
+ x,
728
+ y
729
+ };
730
+ }
731
+ },
732
+ ...detectOverflowOptions
733
+ } = evaluate(options, state);
734
+ const coords = {
735
+ x,
736
+ y
737
+ };
738
+ const overflow = await detectOverflow(state, detectOverflowOptions);
739
+ const crossAxis = getSideAxis(getSide(placement));
740
+ const mainAxis = getOppositeAxis(crossAxis);
741
+ let mainAxisCoord = coords[mainAxis];
742
+ let crossAxisCoord = coords[crossAxis];
743
+ if (checkMainAxis) {
744
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
745
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
746
+ const min = mainAxisCoord + overflow[minSide];
747
+ const max = mainAxisCoord - overflow[maxSide];
748
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
749
+ }
750
+ if (checkCrossAxis) {
751
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
752
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
753
+ const min = crossAxisCoord + overflow[minSide];
754
+ const max = crossAxisCoord - overflow[maxSide];
755
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
756
+ }
757
+ const limitedCoords = limiter.fn({
758
+ ...state,
759
+ [mainAxis]: mainAxisCoord,
760
+ [crossAxis]: crossAxisCoord
761
+ });
762
+ return {
763
+ ...limitedCoords,
764
+ data: {
765
+ x: limitedCoords.x - x,
766
+ y: limitedCoords.y - y
767
+ }
768
+ };
769
+ }
770
+ };
771
+ };
772
+ /**
773
+ * Built-in `limiter` that will stop `shift()` at a certain point.
774
+ */
775
+ const limitShift = function (options) {
776
+ if (options === void 0) {
777
+ options = {};
778
+ }
779
+ return {
780
+ options,
781
+ fn(state) {
782
+ const {
783
+ x,
784
+ y,
785
+ placement,
786
+ rects,
787
+ middlewareData
788
+ } = state;
789
+ const {
790
+ offset = 0,
791
+ mainAxis: checkMainAxis = true,
792
+ crossAxis: checkCrossAxis = true
793
+ } = evaluate(options, state);
794
+ const coords = {
795
+ x,
796
+ y
797
+ };
798
+ const crossAxis = getSideAxis(placement);
799
+ const mainAxis = getOppositeAxis(crossAxis);
800
+ let mainAxisCoord = coords[mainAxis];
801
+ let crossAxisCoord = coords[crossAxis];
802
+ const rawOffset = evaluate(offset, state);
803
+ const computedOffset = typeof rawOffset === 'number' ? {
804
+ mainAxis: rawOffset,
805
+ crossAxis: 0
806
+ } : {
807
+ mainAxis: 0,
808
+ crossAxis: 0,
809
+ ...rawOffset
810
+ };
811
+ if (checkMainAxis) {
812
+ const len = mainAxis === 'y' ? 'height' : 'width';
813
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
814
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
815
+ if (mainAxisCoord < limitMin) {
816
+ mainAxisCoord = limitMin;
817
+ } else if (mainAxisCoord > limitMax) {
818
+ mainAxisCoord = limitMax;
819
+ }
820
+ }
821
+ if (checkCrossAxis) {
822
+ var _middlewareData$offse, _middlewareData$offse2;
823
+ const len = mainAxis === 'y' ? 'width' : 'height';
824
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
825
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
826
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
827
+ if (crossAxisCoord < limitMin) {
828
+ crossAxisCoord = limitMin;
829
+ } else if (crossAxisCoord > limitMax) {
830
+ crossAxisCoord = limitMax;
831
+ }
832
+ }
833
+ return {
834
+ [mainAxis]: mainAxisCoord,
835
+ [crossAxis]: crossAxisCoord
836
+ };
837
+ }
838
+ };
839
+ };
840
+
841
+ /**
842
+ * Provides data that allows you to change the size of the floating element —
843
+ * for instance, prevent it from overflowing the clipping boundary or match the
844
+ * width of the reference element.
845
+ * @see https://floating-ui.com/docs/size
846
+ */
847
+ const size = function (options) {
848
+ if (options === void 0) {
849
+ options = {};
850
+ }
851
+ return {
852
+ name: 'size',
853
+ options,
854
+ async fn(state) {
855
+ const {
856
+ placement,
857
+ rects,
858
+ platform,
859
+ elements
860
+ } = state;
861
+ const {
862
+ apply = () => {},
863
+ ...detectOverflowOptions
864
+ } = evaluate(options, state);
865
+ const overflow = await detectOverflow(state, detectOverflowOptions);
866
+ const side = getSide(placement);
867
+ const alignment = getAlignment(placement);
868
+ const isYAxis = getSideAxis(placement) === 'y';
869
+ const {
870
+ width,
871
+ height
872
+ } = rects.floating;
873
+ let heightSide;
874
+ let widthSide;
875
+ if (side === 'top' || side === 'bottom') {
876
+ heightSide = side;
877
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
878
+ } else {
879
+ widthSide = side;
880
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
881
+ }
882
+ const overflowAvailableHeight = height - overflow[heightSide];
883
+ const overflowAvailableWidth = width - overflow[widthSide];
884
+ const noShift = !state.middlewareData.shift;
885
+ let availableHeight = overflowAvailableHeight;
886
+ let availableWidth = overflowAvailableWidth;
887
+ if (isYAxis) {
888
+ const maximumClippingWidth = width - overflow.left - overflow.right;
889
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
890
+ } else {
891
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
892
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
893
+ }
894
+ if (noShift && !alignment) {
895
+ const xMin = max(overflow.left, 0);
896
+ const xMax = max(overflow.right, 0);
897
+ const yMin = max(overflow.top, 0);
898
+ const yMax = max(overflow.bottom, 0);
899
+ if (isYAxis) {
900
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
901
+ } else {
902
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
903
+ }
904
+ }
905
+ await apply({
906
+ ...state,
907
+ availableWidth,
908
+ availableHeight
909
+ });
910
+ const nextDimensions = await platform.getDimensions(elements.floating);
911
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
912
+ return {
913
+ reset: {
914
+ rects: true
915
+ }
916
+ };
917
+ }
918
+ return {};
919
+ }
920
+ };
921
+ };
922
+
923
+ function getNodeName(node) {
924
+ if (isNode(node)) {
925
+ return (node.nodeName || '').toLowerCase();
926
+ }
927
+ // Mocked nodes in testing environments may not be instances of Node. By
928
+ // returning `#document` an infinite loop won't occur.
929
+ // https://github.com/floating-ui/floating-ui/issues/2317
930
+ return '#document';
931
+ }
932
+ function getWindow(node) {
933
+ var _node$ownerDocument;
934
+ return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
935
+ }
936
+ function getDocumentElement(node) {
937
+ var _ref;
938
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
939
+ }
940
+ function isNode(value) {
941
+ return value instanceof Node || value instanceof getWindow(value).Node;
942
+ }
943
+ function isElement(value) {
944
+ return value instanceof Element || value instanceof getWindow(value).Element;
945
+ }
946
+ function isHTMLElement(value) {
947
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
948
+ }
949
+ function isShadowRoot(value) {
950
+ // Browsers without `ShadowRoot` support.
951
+ if (typeof ShadowRoot === 'undefined') {
952
+ return false;
953
+ }
954
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
955
+ }
956
+ function isOverflowElement(element) {
957
+ const {
958
+ overflow,
959
+ overflowX,
960
+ overflowY,
961
+ display
962
+ } = getComputedStyle(element);
963
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
964
+ }
965
+ function isTableElement(element) {
966
+ return ['table', 'td', 'th'].includes(getNodeName(element));
967
+ }
968
+ function isContainingBlock(element) {
969
+ const webkit = isWebKit();
970
+ const css = getComputedStyle(element);
971
+
972
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
973
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
974
+ }
975
+ function getContainingBlock(element) {
976
+ let currentNode = getParentNode(element);
977
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
978
+ if (isContainingBlock(currentNode)) {
979
+ return currentNode;
980
+ } else {
981
+ currentNode = getParentNode(currentNode);
982
+ }
983
+ }
984
+ return null;
985
+ }
986
+ function isWebKit() {
987
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
988
+ return CSS.supports('-webkit-backdrop-filter', 'none');
989
+ }
990
+ function isLastTraversableNode(node) {
991
+ return ['html', 'body', '#document'].includes(getNodeName(node));
992
+ }
993
+ function getComputedStyle(element) {
994
+ return getWindow(element).getComputedStyle(element);
995
+ }
996
+ function getNodeScroll(element) {
997
+ if (isElement(element)) {
998
+ return {
999
+ scrollLeft: element.scrollLeft,
1000
+ scrollTop: element.scrollTop
1001
+ };
1002
+ }
1003
+ return {
1004
+ scrollLeft: element.pageXOffset,
1005
+ scrollTop: element.pageYOffset
1006
+ };
1007
+ }
1008
+ function getParentNode(node) {
1009
+ if (getNodeName(node) === 'html') {
1010
+ return node;
1011
+ }
1012
+ const result =
1013
+ // Step into the shadow DOM of the parent of a slotted node.
1014
+ node.assignedSlot ||
1015
+ // DOM Element detected.
1016
+ node.parentNode ||
1017
+ // ShadowRoot detected.
1018
+ isShadowRoot(node) && node.host ||
1019
+ // Fallback.
1020
+ getDocumentElement(node);
1021
+ return isShadowRoot(result) ? result.host : result;
1022
+ }
1023
+ function getNearestOverflowAncestor(node) {
1024
+ const parentNode = getParentNode(node);
1025
+ if (isLastTraversableNode(parentNode)) {
1026
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1027
+ }
1028
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1029
+ return parentNode;
1030
+ }
1031
+ return getNearestOverflowAncestor(parentNode);
1032
+ }
1033
+ function getOverflowAncestors(node, list, traverseIframes) {
1034
+ var _node$ownerDocument2;
1035
+ if (list === void 0) {
1036
+ list = [];
1037
+ }
1038
+ if (traverseIframes === void 0) {
1039
+ traverseIframes = true;
1040
+ }
1041
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1042
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1043
+ const win = getWindow(scrollableAncestor);
1044
+ if (isBody) {
1045
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
1046
+ }
1047
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1048
+ }
1049
+
1050
+ function getCssDimensions(element) {
1051
+ const css = getComputedStyle(element);
1052
+ // In testing environments, the `width` and `height` properties are empty
1053
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1054
+ let width = parseFloat(css.width) || 0;
1055
+ let height = parseFloat(css.height) || 0;
1056
+ const hasOffset = isHTMLElement(element);
1057
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1058
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1059
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1060
+ if (shouldFallback) {
1061
+ width = offsetWidth;
1062
+ height = offsetHeight;
1063
+ }
1064
+ return {
1065
+ width,
1066
+ height,
1067
+ $: shouldFallback
1068
+ };
1069
+ }
1070
+
1071
+ function unwrapElement(element) {
1072
+ return !isElement(element) ? element.contextElement : element;
1073
+ }
1074
+
1075
+ function getScale(element) {
1076
+ const domElement = unwrapElement(element);
1077
+ if (!isHTMLElement(domElement)) {
1078
+ return createCoords(1);
1079
+ }
1080
+ const rect = domElement.getBoundingClientRect();
1081
+ const {
1082
+ width,
1083
+ height,
1084
+ $
1085
+ } = getCssDimensions(domElement);
1086
+ let x = ($ ? round(rect.width) : rect.width) / width;
1087
+ let y = ($ ? round(rect.height) : rect.height) / height;
1088
+
1089
+ // 0, NaN, or Infinity should always fallback to 1.
1090
+
1091
+ if (!x || !Number.isFinite(x)) {
1092
+ x = 1;
1093
+ }
1094
+ if (!y || !Number.isFinite(y)) {
1095
+ y = 1;
1096
+ }
1097
+ return {
1098
+ x,
1099
+ y
1100
+ };
1101
+ }
1102
+
1103
+ const noOffsets = /*#__PURE__*/createCoords(0);
1104
+ function getVisualOffsets(element) {
1105
+ const win = getWindow(element);
1106
+ if (!isWebKit() || !win.visualViewport) {
1107
+ return noOffsets;
1108
+ }
1109
+ return {
1110
+ x: win.visualViewport.offsetLeft,
1111
+ y: win.visualViewport.offsetTop
1112
+ };
1113
+ }
1114
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1115
+ if (isFixed === void 0) {
1116
+ isFixed = false;
1117
+ }
1118
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1119
+ return false;
1120
+ }
1121
+ return isFixed;
1122
+ }
1123
+
1124
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1125
+ if (includeScale === void 0) {
1126
+ includeScale = false;
1127
+ }
1128
+ if (isFixedStrategy === void 0) {
1129
+ isFixedStrategy = false;
1130
+ }
1131
+ const clientRect = element.getBoundingClientRect();
1132
+ const domElement = unwrapElement(element);
1133
+ let scale = createCoords(1);
1134
+ if (includeScale) {
1135
+ if (offsetParent) {
1136
+ if (isElement(offsetParent)) {
1137
+ scale = getScale(offsetParent);
1138
+ }
1139
+ } else {
1140
+ scale = getScale(element);
1141
+ }
1142
+ }
1143
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1144
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1145
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1146
+ let width = clientRect.width / scale.x;
1147
+ let height = clientRect.height / scale.y;
1148
+ if (domElement) {
1149
+ const win = getWindow(domElement);
1150
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1151
+ let currentIFrame = win.frameElement;
1152
+ while (currentIFrame && offsetParent && offsetWin !== win) {
1153
+ const iframeScale = getScale(currentIFrame);
1154
+ const iframeRect = currentIFrame.getBoundingClientRect();
1155
+ const css = getComputedStyle(currentIFrame);
1156
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1157
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1158
+ x *= iframeScale.x;
1159
+ y *= iframeScale.y;
1160
+ width *= iframeScale.x;
1161
+ height *= iframeScale.y;
1162
+ x += left;
1163
+ y += top;
1164
+ currentIFrame = getWindow(currentIFrame).frameElement;
1165
+ }
1166
+ }
1167
+ return rectToClientRect({
1168
+ width,
1169
+ height,
1170
+ x,
1171
+ y
1172
+ });
1173
+ }
1174
+
1175
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1176
+ let {
1177
+ rect,
1178
+ offsetParent,
1179
+ strategy
1180
+ } = _ref;
1181
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1182
+ const documentElement = getDocumentElement(offsetParent);
1183
+ if (offsetParent === documentElement) {
1184
+ return rect;
1185
+ }
1186
+ let scroll = {
1187
+ scrollLeft: 0,
1188
+ scrollTop: 0
1189
+ };
1190
+ let scale = createCoords(1);
1191
+ const offsets = createCoords(0);
1192
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1193
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1194
+ scroll = getNodeScroll(offsetParent);
1195
+ }
1196
+ if (isHTMLElement(offsetParent)) {
1197
+ const offsetRect = getBoundingClientRect(offsetParent);
1198
+ scale = getScale(offsetParent);
1199
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1200
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1201
+ }
1202
+ }
1203
+ return {
1204
+ width: rect.width * scale.x,
1205
+ height: rect.height * scale.y,
1206
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1207
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1208
+ };
1209
+ }
1210
+
1211
+ function getClientRects(element) {
1212
+ return Array.from(element.getClientRects());
1213
+ }
1214
+
1215
+ function getWindowScrollBarX(element) {
1216
+ // If <html> has a CSS width greater than the viewport, then this will be
1217
+ // incorrect for RTL.
1218
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1219
+ }
1220
+
1221
+ // Gets the entire size of the scrollable document area, even extending outside
1222
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1223
+ function getDocumentRect(element) {
1224
+ const html = getDocumentElement(element);
1225
+ const scroll = getNodeScroll(element);
1226
+ const body = element.ownerDocument.body;
1227
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1228
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1229
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1230
+ const y = -scroll.scrollTop;
1231
+ if (getComputedStyle(body).direction === 'rtl') {
1232
+ x += max(html.clientWidth, body.clientWidth) - width;
1233
+ }
1234
+ return {
1235
+ width,
1236
+ height,
1237
+ x,
1238
+ y
1239
+ };
1240
+ }
1241
+
1242
+ function getViewportRect(element, strategy) {
1243
+ const win = getWindow(element);
1244
+ const html = getDocumentElement(element);
1245
+ const visualViewport = win.visualViewport;
1246
+ let width = html.clientWidth;
1247
+ let height = html.clientHeight;
1248
+ let x = 0;
1249
+ let y = 0;
1250
+ if (visualViewport) {
1251
+ width = visualViewport.width;
1252
+ height = visualViewport.height;
1253
+ const visualViewportBased = isWebKit();
1254
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1255
+ x = visualViewport.offsetLeft;
1256
+ y = visualViewport.offsetTop;
1257
+ }
1258
+ }
1259
+ return {
1260
+ width,
1261
+ height,
1262
+ x,
1263
+ y
1264
+ };
1265
+ }
1266
+
1267
+ // Returns the inner client rect, subtracting scrollbars if present.
1268
+ function getInnerBoundingClientRect(element, strategy) {
1269
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1270
+ const top = clientRect.top + element.clientTop;
1271
+ const left = clientRect.left + element.clientLeft;
1272
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1273
+ const width = element.clientWidth * scale.x;
1274
+ const height = element.clientHeight * scale.y;
1275
+ const x = left * scale.x;
1276
+ const y = top * scale.y;
1277
+ return {
1278
+ width,
1279
+ height,
1280
+ x,
1281
+ y
1282
+ };
1283
+ }
1284
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1285
+ let rect;
1286
+ if (clippingAncestor === 'viewport') {
1287
+ rect = getViewportRect(element, strategy);
1288
+ } else if (clippingAncestor === 'document') {
1289
+ rect = getDocumentRect(getDocumentElement(element));
1290
+ } else if (isElement(clippingAncestor)) {
1291
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1292
+ } else {
1293
+ const visualOffsets = getVisualOffsets(element);
1294
+ rect = {
1295
+ ...clippingAncestor,
1296
+ x: clippingAncestor.x - visualOffsets.x,
1297
+ y: clippingAncestor.y - visualOffsets.y
1298
+ };
1299
+ }
1300
+ return rectToClientRect(rect);
1301
+ }
1302
+ function hasFixedPositionAncestor(element, stopNode) {
1303
+ const parentNode = getParentNode(element);
1304
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1305
+ return false;
1306
+ }
1307
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1308
+ }
1309
+
1310
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1311
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1312
+ // of the given element up the tree.
1313
+ function getClippingElementAncestors(element, cache) {
1314
+ const cachedResult = cache.get(element);
1315
+ if (cachedResult) {
1316
+ return cachedResult;
1317
+ }
1318
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1319
+ let currentContainingBlockComputedStyle = null;
1320
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1321
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1322
+
1323
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1324
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1325
+ const computedStyle = getComputedStyle(currentNode);
1326
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1327
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1328
+ currentContainingBlockComputedStyle = null;
1329
+ }
1330
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1331
+ if (shouldDropCurrentNode) {
1332
+ // Drop non-containing blocks.
1333
+ result = result.filter(ancestor => ancestor !== currentNode);
1334
+ } else {
1335
+ // Record last containing block for next iteration.
1336
+ currentContainingBlockComputedStyle = computedStyle;
1337
+ }
1338
+ currentNode = getParentNode(currentNode);
1339
+ }
1340
+ cache.set(element, result);
1341
+ return result;
1342
+ }
1343
+
1344
+ // Gets the maximum area that the element is visible in due to any number of
1345
+ // clipping ancestors.
1346
+ function getClippingRect(_ref) {
1347
+ let {
1348
+ element,
1349
+ boundary,
1350
+ rootBoundary,
1351
+ strategy
1352
+ } = _ref;
1353
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
1354
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1355
+ const firstClippingAncestor = clippingAncestors[0];
1356
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1357
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1358
+ accRect.top = max(rect.top, accRect.top);
1359
+ accRect.right = min(rect.right, accRect.right);
1360
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1361
+ accRect.left = max(rect.left, accRect.left);
1362
+ return accRect;
1363
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1364
+ return {
1365
+ width: clippingRect.right - clippingRect.left,
1366
+ height: clippingRect.bottom - clippingRect.top,
1367
+ x: clippingRect.left,
1368
+ y: clippingRect.top
1369
+ };
1370
+ }
1371
+
1372
+ function getDimensions(element) {
1373
+ return getCssDimensions(element);
1374
+ }
1375
+
1376
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1377
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1378
+ const documentElement = getDocumentElement(offsetParent);
1379
+ const isFixed = strategy === 'fixed';
1380
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1381
+ let scroll = {
1382
+ scrollLeft: 0,
1383
+ scrollTop: 0
1384
+ };
1385
+ const offsets = createCoords(0);
1386
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1387
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1388
+ scroll = getNodeScroll(offsetParent);
1389
+ }
1390
+ if (isOffsetParentAnElement) {
1391
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1392
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1393
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1394
+ } else if (documentElement) {
1395
+ offsets.x = getWindowScrollBarX(documentElement);
1396
+ }
1397
+ }
1398
+ return {
1399
+ x: rect.left + scroll.scrollLeft - offsets.x,
1400
+ y: rect.top + scroll.scrollTop - offsets.y,
1401
+ width: rect.width,
1402
+ height: rect.height
1403
+ };
1404
+ }
1405
+
1406
+ function getTrueOffsetParent(element, polyfill) {
1407
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1408
+ return null;
1409
+ }
1410
+ if (polyfill) {
1411
+ return polyfill(element);
1412
+ }
1413
+ return element.offsetParent;
1414
+ }
1415
+
1416
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1417
+ // such as table ancestors and cross browser bugs.
1418
+ function getOffsetParent(element, polyfill) {
1419
+ const window = getWindow(element);
1420
+ if (!isHTMLElement(element)) {
1421
+ return window;
1422
+ }
1423
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1424
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1425
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1426
+ }
1427
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1428
+ return window;
1429
+ }
1430
+ return offsetParent || getContainingBlock(element) || window;
1431
+ }
1432
+
1433
+ const getElementRects = async function (_ref) {
1434
+ let {
1435
+ reference,
1436
+ floating,
1437
+ strategy
1438
+ } = _ref;
1439
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1440
+ const getDimensionsFn = this.getDimensions;
1441
+ return {
1442
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
1443
+ floating: {
1444
+ x: 0,
1445
+ y: 0,
1446
+ ...(await getDimensionsFn(floating))
1447
+ }
1448
+ };
1449
+ };
1450
+
1451
+ function isRTL(element) {
1452
+ return getComputedStyle(element).direction === 'rtl';
1453
+ }
1454
+
1455
+ const platform = {
1456
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1457
+ getDocumentElement,
1458
+ getClippingRect,
1459
+ getOffsetParent,
1460
+ getElementRects,
1461
+ getClientRects,
1462
+ getDimensions,
1463
+ getScale,
1464
+ isElement,
1465
+ isRTL
1466
+ };
1467
+
1468
+ // https://samthor.au/2021/observing-dom/
1469
+ function observeMove(element, onMove) {
1470
+ let io = null;
1471
+ let timeoutId;
1472
+ const root = getDocumentElement(element);
1473
+ function cleanup() {
1474
+ clearTimeout(timeoutId);
1475
+ io && io.disconnect();
1476
+ io = null;
1477
+ }
1478
+ function refresh(skip, threshold) {
1479
+ if (skip === void 0) {
1480
+ skip = false;
1481
+ }
1482
+ if (threshold === void 0) {
1483
+ threshold = 1;
1484
+ }
1485
+ cleanup();
1486
+ const {
1487
+ left,
1488
+ top,
1489
+ width,
1490
+ height
1491
+ } = element.getBoundingClientRect();
1492
+ if (!skip) {
1493
+ onMove();
1494
+ }
1495
+ if (!width || !height) {
1496
+ return;
1497
+ }
1498
+ const insetTop = floor(top);
1499
+ const insetRight = floor(root.clientWidth - (left + width));
1500
+ const insetBottom = floor(root.clientHeight - (top + height));
1501
+ const insetLeft = floor(left);
1502
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1503
+ const options = {
1504
+ rootMargin,
1505
+ threshold: max(0, min(1, threshold)) || 1
1506
+ };
1507
+ let isFirstUpdate = true;
1508
+ function handleObserve(entries) {
1509
+ const ratio = entries[0].intersectionRatio;
1510
+ if (ratio !== threshold) {
1511
+ if (!isFirstUpdate) {
1512
+ return refresh();
1513
+ }
1514
+ if (!ratio) {
1515
+ timeoutId = setTimeout(() => {
1516
+ refresh(false, 1e-7);
1517
+ }, 100);
1518
+ } else {
1519
+ refresh(false, ratio);
1520
+ }
1521
+ }
1522
+ isFirstUpdate = false;
1523
+ }
1524
+
1525
+ // Older browsers don't support a `document` as the root and will throw an
1526
+ // error.
1527
+ try {
1528
+ io = new IntersectionObserver(handleObserve, {
1529
+ ...options,
1530
+ // Handle <iframe>s
1531
+ root: root.ownerDocument
1532
+ });
1533
+ } catch (e) {
1534
+ io = new IntersectionObserver(handleObserve, options);
1535
+ }
1536
+ io.observe(element);
1537
+ }
1538
+ refresh(true);
1539
+ return cleanup;
1540
+ }
1541
+
1542
+ /**
1543
+ * Automatically updates the position of the floating element when necessary.
1544
+ * Should only be called when the floating element is mounted on the DOM or
1545
+ * visible on the screen.
1546
+ * @returns cleanup function that should be invoked when the floating element is
1547
+ * removed from the DOM or hidden from the screen.
1548
+ * @see https://floating-ui.com/docs/autoUpdate
1549
+ */
1550
+ function autoUpdate(reference, floating, update, options) {
1551
+ if (options === void 0) {
1552
+ options = {};
1553
+ }
1554
+ const {
1555
+ ancestorScroll = true,
1556
+ ancestorResize = true,
1557
+ elementResize = typeof ResizeObserver === 'function',
1558
+ layoutShift = typeof IntersectionObserver === 'function',
1559
+ animationFrame = false
1560
+ } = options;
1561
+ const referenceEl = unwrapElement(reference);
1562
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1563
+ ancestors.forEach(ancestor => {
1564
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1565
+ passive: true
1566
+ });
1567
+ ancestorResize && ancestor.addEventListener('resize', update);
1568
+ });
1569
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1570
+ let reobserveFrame = -1;
1571
+ let resizeObserver = null;
1572
+ if (elementResize) {
1573
+ resizeObserver = new ResizeObserver(_ref => {
1574
+ let [firstEntry] = _ref;
1575
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1576
+ // Prevent update loops when using the `size` middleware.
1577
+ // https://github.com/floating-ui/floating-ui/issues/1740
1578
+ resizeObserver.unobserve(floating);
1579
+ cancelAnimationFrame(reobserveFrame);
1580
+ reobserveFrame = requestAnimationFrame(() => {
1581
+ resizeObserver && resizeObserver.observe(floating);
1582
+ });
1583
+ }
1584
+ update();
1585
+ });
1586
+ if (referenceEl && !animationFrame) {
1587
+ resizeObserver.observe(referenceEl);
1588
+ }
1589
+ resizeObserver.observe(floating);
1590
+ }
1591
+ let frameId;
1592
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1593
+ if (animationFrame) {
1594
+ frameLoop();
1595
+ }
1596
+ function frameLoop() {
1597
+ const nextRefRect = getBoundingClientRect(reference);
1598
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1599
+ update();
1600
+ }
1601
+ prevRefRect = nextRefRect;
1602
+ frameId = requestAnimationFrame(frameLoop);
1603
+ }
1604
+ update();
1605
+ return () => {
1606
+ ancestors.forEach(ancestor => {
1607
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1608
+ ancestorResize && ancestor.removeEventListener('resize', update);
1609
+ });
1610
+ cleanupIo && cleanupIo();
1611
+ resizeObserver && resizeObserver.disconnect();
1612
+ resizeObserver = null;
1613
+ if (animationFrame) {
1614
+ cancelAnimationFrame(frameId);
1615
+ }
1616
+ };
1617
+ }
1618
+
1619
+ /**
1620
+ * Computes the `x` and `y` coordinates that will place the floating element
1621
+ * next to a reference element when it is given a certain CSS positioning
1622
+ * strategy.
1623
+ */
1624
+ const computePosition = (reference, floating, options) => {
1625
+ // This caches the expensive `getClippingElementAncestors` function so that
1626
+ // multiple lifecycle resets re-use the same result. It only lives for a
1627
+ // single call. If other functions become expensive, we can add them as well.
1628
+ const cache = new Map();
1629
+ const mergedOptions = {
1630
+ platform,
1631
+ ...options
1632
+ };
1633
+ const platformWithCache = {
1634
+ ...mergedOptions.platform,
1635
+ _c: cache
1636
+ };
1637
+ return computePosition$1(reference, floating, {
1638
+ ...mergedOptions,
1639
+ platform: platformWithCache
1640
+ });
1641
+ };
1642
+
1643
+ /**
1644
+ * Provides data to position an inner element of the floating element so that it
1645
+ * appears centered to the reference element.
1646
+ * This wraps the core `arrow` middleware to allow React refs as the element.
1647
+ * @see https://floating-ui.com/docs/arrow
1648
+ */
1649
+ const arrow = options => {
1650
+ function isRef(value) {
1651
+ return {}.hasOwnProperty.call(value, 'current');
1652
+ }
1653
+ return {
1654
+ name: 'arrow',
1655
+ options,
1656
+ fn(state) {
1657
+ const {
1658
+ element,
1659
+ padding
1660
+ } = typeof options === 'function' ? options(state) : options;
1661
+ if (element && isRef(element)) {
1662
+ if (element.current != null) {
1663
+ return arrow$1({
1664
+ element: element.current,
1665
+ padding
1666
+ }).fn(state);
1667
+ }
1668
+ return {};
1669
+ } else if (element) {
1670
+ return arrow$1({
1671
+ element,
1672
+ padding
1673
+ }).fn(state);
1674
+ }
1675
+ return {};
1676
+ }
1677
+ };
1678
+ };
1679
+
1680
+ var index = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
1681
+
1682
+ // Fork of `fast-deep-equal` that only does the comparisons we need and compares
1683
+ // functions
1684
+ function deepEqual(a, b) {
1685
+ if (a === b) {
1686
+ return true;
1687
+ }
1688
+ if (typeof a !== typeof b) {
1689
+ return false;
1690
+ }
1691
+ if (typeof a === 'function' && a.toString() === b.toString()) {
1692
+ return true;
1693
+ }
1694
+ let length, i, keys;
1695
+ if (a && b && typeof a == 'object') {
1696
+ if (Array.isArray(a)) {
1697
+ length = a.length;
1698
+ if (length != b.length) return false;
1699
+ for (i = length; i-- !== 0;) {
1700
+ if (!deepEqual(a[i], b[i])) {
1701
+ return false;
1702
+ }
1703
+ }
1704
+ return true;
1705
+ }
1706
+ keys = Object.keys(a);
1707
+ length = keys.length;
1708
+ if (length !== Object.keys(b).length) {
1709
+ return false;
1710
+ }
1711
+ for (i = length; i-- !== 0;) {
1712
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
1713
+ return false;
1714
+ }
1715
+ }
1716
+ for (i = length; i-- !== 0;) {
1717
+ const key = keys[i];
1718
+ if (key === '_owner' && a.$$typeof) {
1719
+ continue;
1720
+ }
1721
+ if (!deepEqual(a[key], b[key])) {
1722
+ return false;
1723
+ }
1724
+ }
1725
+ return true;
1726
+ }
1727
+ return a !== a && b !== b;
1728
+ }
1729
+
1730
+ function getDPR(element) {
1731
+ if (typeof window === 'undefined') {
1732
+ return 1;
1733
+ }
1734
+ const win = element.ownerDocument.defaultView || window;
1735
+ return win.devicePixelRatio || 1;
1736
+ }
1737
+
1738
+ function roundByDPR(element, value) {
1739
+ const dpr = getDPR(element);
1740
+ return Math.round(value * dpr) / dpr;
1741
+ }
1742
+
1743
+ function useLatestRef(value) {
1744
+ const ref = React__namespace.useRef(value);
1745
+ index(() => {
1746
+ ref.current = value;
1747
+ });
1748
+ return ref;
1749
+ }
1750
+
1751
+ /**
1752
+ * Provides data to position a floating element.
1753
+ * @see https://floating-ui.com/docs/react
1754
+ */
1755
+ function useFloating(options) {
1756
+ if (options === void 0) {
1757
+ options = {};
1758
+ }
1759
+ const {
1760
+ placement = 'bottom',
1761
+ strategy = 'absolute',
1762
+ middleware = [],
1763
+ platform,
1764
+ elements: {
1765
+ reference: externalReference,
1766
+ floating: externalFloating
1767
+ } = {},
1768
+ transform = true,
1769
+ whileElementsMounted,
1770
+ open
1771
+ } = options;
1772
+ const [data, setData] = React__namespace.useState({
1773
+ x: 0,
1774
+ y: 0,
1775
+ strategy,
1776
+ placement,
1777
+ middlewareData: {},
1778
+ isPositioned: false
1779
+ });
1780
+ const [latestMiddleware, setLatestMiddleware] = React__namespace.useState(middleware);
1781
+ if (!deepEqual(latestMiddleware, middleware)) {
1782
+ setLatestMiddleware(middleware);
1783
+ }
1784
+ const [_reference, _setReference] = React__namespace.useState(null);
1785
+ const [_floating, _setFloating] = React__namespace.useState(null);
1786
+ const setReference = React__namespace.useCallback(node => {
1787
+ if (node != referenceRef.current) {
1788
+ referenceRef.current = node;
1789
+ _setReference(node);
1790
+ }
1791
+ }, [_setReference]);
1792
+ const setFloating = React__namespace.useCallback(node => {
1793
+ if (node !== floatingRef.current) {
1794
+ floatingRef.current = node;
1795
+ _setFloating(node);
1796
+ }
1797
+ }, [_setFloating]);
1798
+ const referenceEl = externalReference || _reference;
1799
+ const floatingEl = externalFloating || _floating;
1800
+ const referenceRef = React__namespace.useRef(null);
1801
+ const floatingRef = React__namespace.useRef(null);
1802
+ const dataRef = React__namespace.useRef(data);
1803
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
1804
+ const platformRef = useLatestRef(platform);
1805
+ const update = React__namespace.useCallback(() => {
1806
+ if (!referenceRef.current || !floatingRef.current) {
1807
+ return;
1808
+ }
1809
+ const config = {
1810
+ placement,
1811
+ strategy,
1812
+ middleware: latestMiddleware
1813
+ };
1814
+ if (platformRef.current) {
1815
+ config.platform = platformRef.current;
1816
+ }
1817
+ computePosition(referenceRef.current, floatingRef.current, config).then(data => {
1818
+ const fullData = {
1819
+ ...data,
1820
+ isPositioned: true
1821
+ };
1822
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
1823
+ dataRef.current = fullData;
1824
+ $7SXl2$reactdom__namespace.flushSync(() => {
1825
+ setData(fullData);
1826
+ });
1827
+ }
1828
+ });
1829
+ }, [latestMiddleware, placement, strategy, platformRef]);
1830
+ index(() => {
1831
+ if (open === false && dataRef.current.isPositioned) {
1832
+ dataRef.current.isPositioned = false;
1833
+ setData(data => ({
1834
+ ...data,
1835
+ isPositioned: false
1836
+ }));
1837
+ }
1838
+ }, [open]);
1839
+ const isMountedRef = React__namespace.useRef(false);
1840
+ index(() => {
1841
+ isMountedRef.current = true;
1842
+ return () => {
1843
+ isMountedRef.current = false;
1844
+ };
1845
+ }, []);
1846
+ index(() => {
1847
+ if (referenceEl) referenceRef.current = referenceEl;
1848
+ if (floatingEl) floatingRef.current = floatingEl;
1849
+ if (referenceEl && floatingEl) {
1850
+ if (whileElementsMountedRef.current) {
1851
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
1852
+ } else {
1853
+ update();
1854
+ }
1855
+ }
1856
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef]);
1857
+ const refs = React__namespace.useMemo(() => ({
1858
+ reference: referenceRef,
1859
+ floating: floatingRef,
1860
+ setReference,
1861
+ setFloating
1862
+ }), [setReference, setFloating]);
1863
+ const elements = React__namespace.useMemo(() => ({
1864
+ reference: referenceEl,
1865
+ floating: floatingEl
1866
+ }), [referenceEl, floatingEl]);
1867
+ const floatingStyles = React__namespace.useMemo(() => {
1868
+ const initialStyles = {
1869
+ position: strategy,
1870
+ left: 0,
1871
+ top: 0
1872
+ };
1873
+ if (!elements.floating) {
1874
+ return initialStyles;
1875
+ }
1876
+ const x = roundByDPR(elements.floating, data.x);
1877
+ const y = roundByDPR(elements.floating, data.y);
1878
+ if (transform) {
1879
+ return {
1880
+ ...initialStyles,
1881
+ transform: "translate(" + x + "px, " + y + "px)",
1882
+ ...(getDPR(elements.floating) >= 1.5 && {
1883
+ willChange: 'transform'
1884
+ })
1885
+ };
1886
+ }
1887
+ return {
1888
+ position: strategy,
1889
+ left: x,
1890
+ top: y
1891
+ };
1892
+ }, [strategy, transform, elements.floating, data.x, data.y]);
1893
+ return React__namespace.useMemo(() => ({
1894
+ ...data,
1895
+ update,
1896
+ refs,
1897
+ elements,
1898
+ floatingStyles
1899
+ }), [data, update, refs, elements, floatingStyles]);
1900
+ }
1901
+
1902
+ function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
1903
+ const [size, setSize] = React.useState(undefined);
1904
+ index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
1905
+ if (element) {
1906
+ // provide size as early as possible
1907
+ setSize({
1908
+ width: element.offsetWidth,
1909
+ height: element.offsetHeight
1910
+ });
1911
+ const resizeObserver = new ResizeObserver((entries)=>{
1912
+ if (!Array.isArray(entries)) return;
1913
+ // Since we only observe the one element, we don't need to loop over the
1914
+ // array
1915
+ if (!entries.length) return;
1916
+ const entry = entries[0];
1917
+ let width;
1918
+ let height;
1919
+ if ('borderBoxSize' in entry) {
1920
+ const borderSizeEntry = entry['borderBoxSize']; // iron out differences between browsers
1921
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
1922
+ width = borderSize['inlineSize'];
1923
+ height = borderSize['blockSize'];
1924
+ } else {
1925
+ // for browsers that don't support `borderBoxSize`
1926
+ // we calculate it ourselves to get the correct border box.
1927
+ width = element.offsetWidth;
1928
+ height = element.offsetHeight;
1929
+ }
1930
+ setSize({
1931
+ width: width,
1932
+ height: height
1933
+ });
1934
+ });
1935
+ resizeObserver.observe(element, {
1936
+ box: 'border-box'
1937
+ });
1938
+ return ()=>resizeObserver.unobserve(element)
1939
+ ;
1940
+ } else // We only want to reset to `undefined` when the element becomes `null`,
1941
+ // not if it changes to another element.
1942
+ setSize(undefined);
1943
+ }, [
1944
+ element
1945
+ ]);
1946
+ return size;
1947
+ }
1948
+
1949
+ /* -------------------------------------------------------------------------------------------------
1950
+ * Popper
1951
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$POPPER_NAME = 'Popper';
1952
+ const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = index$1.$c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME);
1953
+ const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
1954
+ const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props)=>{
1955
+ const { __scopePopper: __scopePopper , children: children } = props;
1956
+ const [anchor, setAnchor] = React.useState(null);
1957
+ return /*#__PURE__*/ React.createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
1958
+ scope: __scopePopper,
1959
+ anchor: anchor,
1960
+ onAnchorChange: setAnchor
1961
+ }, children);
1962
+ };
1963
+ /* -------------------------------------------------------------------------------------------------
1964
+ * PopperAnchor
1965
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = 'PopperAnchor';
1966
+ const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
1967
+ const { __scopePopper: __scopePopper , virtualRef: virtualRef , ...anchorProps } = props;
1968
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
1969
+ const ref = React.useRef(null);
1970
+ const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
1971
+ React.useEffect(()=>{
1972
+ // Consumer can anchor the popper to something that isn't
1973
+ // a DOM node e.g. pointer position, so we override the
1974
+ // `anchorRef` with their virtual ref in this case.
1975
+ context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
1976
+ });
1977
+ return virtualRef ? null : /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({}, anchorProps, {
1978
+ ref: composedRefs
1979
+ }));
1980
+ });
1981
+ /* -------------------------------------------------------------------------------------------------
1982
+ * PopperContent
1983
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$CONTENT_NAME = 'PopperContent';
1984
+ const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME);
1985
+ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
1986
+ var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
1987
+ const { __scopePopper: __scopePopper , side: side = 'bottom' , sideOffset: sideOffset = 0 , align: align = 'center' , alignOffset: alignOffset = 0 , arrowPadding: arrowPadding = 0 , avoidCollisions: avoidCollisions = true , collisionBoundary: collisionBoundary = [] , collisionPadding: collisionPaddingProp = 0 , sticky: sticky = 'partial' , hideWhenDetached: hideWhenDetached = false , updatePositionStrategy: updatePositionStrategy = 'optimized' , onPlaced: onPlaced , ...contentProps } = props;
1988
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
1989
+ const [content, setContent] = React.useState(null);
1990
+ const composedRefs = index$1.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
1991
+ );
1992
+ const [arrow$1, setArrow] = React.useState(null);
1993
+ const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$1);
1994
+ const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
1995
+ const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
1996
+ const desiredPlacement = side + (align !== 'center' ? '-' + align : '');
1997
+ const collisionPadding = typeof collisionPaddingProp === 'number' ? collisionPaddingProp : {
1998
+ top: 0,
1999
+ right: 0,
2000
+ bottom: 0,
2001
+ left: 0,
2002
+ ...collisionPaddingProp
2003
+ };
2004
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [
2005
+ collisionBoundary
2006
+ ];
2007
+ const hasExplicitBoundaries = boundary.length > 0;
2008
+ const detectOverflowOptions = {
2009
+ padding: collisionPadding,
2010
+ boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull),
2011
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
2012
+ altBoundary: hasExplicitBoundaries
2013
+ };
2014
+ const { refs: refs , floatingStyles: floatingStyles , placement: placement , isPositioned: isPositioned , middlewareData: middlewareData } = useFloating({
2015
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
2016
+ strategy: 'fixed',
2017
+ placement: desiredPlacement,
2018
+ whileElementsMounted: (...args)=>{
2019
+ const cleanup = autoUpdate(...args, {
2020
+ animationFrame: updatePositionStrategy === 'always'
2021
+ });
2022
+ return cleanup;
2023
+ },
2024
+ elements: {
2025
+ reference: context.anchor
2026
+ },
2027
+ middleware: [
2028
+ offset({
2029
+ mainAxis: sideOffset + arrowHeight,
2030
+ alignmentAxis: alignOffset
2031
+ }),
2032
+ avoidCollisions && shift({
2033
+ mainAxis: true,
2034
+ crossAxis: false,
2035
+ limiter: sticky === 'partial' ? limitShift() : undefined,
2036
+ ...detectOverflowOptions
2037
+ }),
2038
+ avoidCollisions && flip({
2039
+ ...detectOverflowOptions
2040
+ }),
2041
+ size({
2042
+ ...detectOverflowOptions,
2043
+ apply: ({ elements: elements , rects: rects , availableWidth: availableWidth , availableHeight: availableHeight })=>{
2044
+ const { width: anchorWidth , height: anchorHeight } = rects.reference;
2045
+ const contentStyle = elements.floating.style;
2046
+ contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);
2047
+ contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);
2048
+ contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);
2049
+ contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);
2050
+ }
2051
+ }),
2052
+ arrow$1 && arrow({
2053
+ element: arrow$1,
2054
+ padding: arrowPadding
2055
+ }),
2056
+ $cf1ac5d9fe0e8206$var$transformOrigin({
2057
+ arrowWidth: arrowWidth,
2058
+ arrowHeight: arrowHeight
2059
+ }),
2060
+ hideWhenDetached && hide({
2061
+ strategy: 'referenceHidden',
2062
+ ...detectOverflowOptions
2063
+ })
2064
+ ]
2065
+ });
2066
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2067
+ const handlePlaced = index$1.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced);
2068
+ index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
2069
+ if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
2070
+ }, [
2071
+ isPositioned,
2072
+ handlePlaced
2073
+ ]);
2074
+ const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
2075
+ const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
2076
+ const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
2077
+ const [contentZIndex, setContentZIndex] = React.useState();
2078
+ index$1.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
2079
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
2080
+ }, [
2081
+ content
2082
+ ]);
2083
+ return /*#__PURE__*/ React.createElement("div", {
2084
+ ref: refs.setFloating,
2085
+ "data-radix-popper-content-wrapper": "",
2086
+ style: {
2087
+ ...floatingStyles,
2088
+ transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)',
2089
+ // keep off the page when measuring
2090
+ minWidth: 'max-content',
2091
+ zIndex: contentZIndex,
2092
+ ['--radix-popper-transform-origin']: [
2093
+ (_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x,
2094
+ (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y
2095
+ ].join(' ')
2096
+ } // Floating UI interally calculates logical alignment based the `dir` attribute on
2097
+ ,
2098
+ dir: props.dir
2099
+ }, /*#__PURE__*/ React.createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
2100
+ scope: __scopePopper,
2101
+ placedSide: placedSide,
2102
+ onArrowChange: setArrow,
2103
+ arrowX: arrowX,
2104
+ arrowY: arrowY,
2105
+ shouldHideArrow: cannotCenterArrow
2106
+ }, /*#__PURE__*/ React.createElement(index$1.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends._extends({
2107
+ "data-side": placedSide,
2108
+ "data-align": placedAlign
2109
+ }, contentProps, {
2110
+ ref: composedRefs,
2111
+ style: {
2112
+ ...contentProps.style,
2113
+ // if the PopperContent hasn't been placed yet (not all measurements done)
2114
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
2115
+ animation: !isPositioned ? 'none' : undefined,
2116
+ // hide the content if using the hide middleware and should be hidden
2117
+ opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : undefined
2118
+ }
2119
+ }))));
2120
+ });
2121
+ /* -----------------------------------------------------------------------------------------------*/ function $cf1ac5d9fe0e8206$var$isNotNull(value) {
2122
+ return value !== null;
2123
+ }
2124
+ const $cf1ac5d9fe0e8206$var$transformOrigin = (options)=>({
2125
+ name: 'transformOrigin',
2126
+ options: options,
2127
+ fn (data) {
2128
+ var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
2129
+ const { placement: placement , rects: rects , middlewareData: middlewareData } = data;
2130
+ const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
2131
+ const isArrowHidden = cannotCenterArrow;
2132
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
2133
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
2134
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2135
+ const noArrowAlign = {
2136
+ start: '0%',
2137
+ center: '50%',
2138
+ end: '100%'
2139
+ }[placedAlign];
2140
+ const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
2141
+ const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
2142
+ let x = '';
2143
+ let y = '';
2144
+ if (placedSide === 'bottom') {
2145
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2146
+ y = `${-arrowHeight}px`;
2147
+ } else if (placedSide === 'top') {
2148
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2149
+ y = `${rects.floating.height + arrowHeight}px`;
2150
+ } else if (placedSide === 'right') {
2151
+ x = `${-arrowHeight}px`;
2152
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2153
+ } else if (placedSide === 'left') {
2154
+ x = `${rects.floating.width + arrowHeight}px`;
2155
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2156
+ }
2157
+ return {
2158
+ data: {
2159
+ x: x,
2160
+ y: y
2161
+ }
2162
+ };
2163
+ }
2164
+ })
2165
+ ;
2166
+ function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
2167
+ const [side, align = 'center'] = placement.split('-');
2168
+ return [
2169
+ side,
2170
+ align
2171
+ ];
2172
+ }
2173
+ const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
2174
+ const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
2175
+ const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
2176
+
2177
+ exports.$cf1ac5d9fe0e8206$export$722aac194ae923 = $cf1ac5d9fe0e8206$export$722aac194ae923;
2178
+ exports.$cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2;
2179
+ exports.$cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$b688253958b8dfe7;
2180
+ exports.$cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9;