@haiilo/catalyst 0.2.3 → 0.4.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 (241) hide show
  1. package/dist/catalyst/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  2. package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
  3. package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  4. package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
  5. package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
  6. package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  7. package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
  8. package/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
  9. package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
  10. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
  11. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  12. package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
  13. package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
  14. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
  15. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  16. package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
  17. package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
  18. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
  19. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  20. package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
  21. package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
  22. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
  23. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  24. package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
  25. package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
  26. package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
  27. package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
  28. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
  29. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
  30. package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
  31. package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
  32. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
  33. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  34. package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
  35. package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
  36. package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
  37. package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
  38. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  39. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  40. package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
  41. package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
  42. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
  43. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  44. package/dist/catalyst/catalyst.css +1 -1959
  45. package/dist/catalyst/catalyst.esm.js +1 -131
  46. package/dist/catalyst/catalyst.esm.js.map +1 -1
  47. package/dist/catalyst/index.esm.js +1 -2
  48. package/dist/catalyst/index.esm.js.map +1 -1
  49. package/dist/catalyst/p-89a97b7b.entry.js +10 -0
  50. package/dist/catalyst/p-89a97b7b.entry.js.map +1 -0
  51. package/dist/catalyst/p-ed826597.js +2 -0
  52. package/dist/catalyst/p-ed826597.js.map +1 -0
  53. package/dist/catalyst/p-ef0a8ae9.js +2 -0
  54. package/dist/catalyst/p-ef0a8ae9.js.map +1 -0
  55. package/dist/catalyst/p-f151cb13.js +2 -0
  56. package/dist/catalyst/p-f151cb13.js.map +1 -0
  57. package/dist/cjs/app-globals-7f2b1f8e.js +173 -0
  58. package/dist/cjs/app-globals-7f2b1f8e.js.map +1 -0
  59. package/dist/cjs/cat-alert_9.cjs.entry.js +4557 -0
  60. package/dist/cjs/cat-alert_9.cjs.entry.js.map +1 -0
  61. package/dist/cjs/cat-icon-registry-850c538c.js +47 -0
  62. package/dist/cjs/cat-icon-registry-850c538c.js.map +1 -0
  63. package/dist/cjs/catalyst.cjs.js +24 -0
  64. package/dist/cjs/catalyst.cjs.js.map +1 -0
  65. package/dist/cjs/index-c0881ae0.js +1348 -0
  66. package/dist/cjs/index-c0881ae0.js.map +1 -0
  67. package/dist/cjs/index.cjs.js +11 -0
  68. package/dist/cjs/index.cjs.js.map +1 -0
  69. package/dist/cjs/loader.cjs.js +26 -0
  70. package/dist/cjs/loader.cjs.js.map +1 -0
  71. package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  72. package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
  73. package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  74. package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
  75. package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
  76. package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  77. package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
  78. package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
  79. package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
  80. package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
  81. package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  82. package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
  83. package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
  84. package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
  85. package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  86. package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
  87. package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
  88. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
  89. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  90. package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
  91. package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
  92. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
  93. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  94. package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
  95. package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
  96. package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
  97. package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
  98. package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
  99. package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
  100. package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
  101. package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
  102. package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
  103. package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  104. package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
  105. package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
  106. package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
  107. package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
  108. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  109. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  110. package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
  111. package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
  112. package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
  113. package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  114. package/dist/collection/collection-manifest.json +21 -0
  115. package/dist/collection/components/cat-alert/cat-alert.css +57 -0
  116. package/dist/collection/components/cat-alert/cat-alert.js +50 -0
  117. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -0
  118. package/dist/collection/components/cat-badge/cat-badge.css +154 -0
  119. package/dist/collection/components/cat-badge/cat-badge.js +142 -0
  120. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -0
  121. package/dist/collection/components/cat-button/cat-button.css +323 -0
  122. package/dist/collection/components/cat-button/cat-button.js +591 -0
  123. package/dist/collection/components/cat-button/cat-button.js.map +1 -0
  124. package/dist/collection/components/cat-icon/cat-icon-registry.js +42 -0
  125. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -0
  126. package/dist/collection/components/cat-icon/cat-icon.css +50 -0
  127. package/dist/collection/components/cat-icon/cat-icon.js +90 -0
  128. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -0
  129. package/dist/collection/components/cat-menu/cat-menu.css +33 -0
  130. package/dist/collection/components/cat-menu/cat-menu.js +184 -0
  131. package/dist/collection/components/cat-menu/cat-menu.js.map +1 -0
  132. package/dist/collection/components/cat-scrollable/cat-scrollable.css +69 -0
  133. package/dist/collection/components/cat-scrollable/cat-scrollable.js +309 -0
  134. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -0
  135. package/dist/collection/components/cat-skeleton/cat-skeleton.css +177 -0
  136. package/dist/collection/components/cat-skeleton/cat-skeleton.js +131 -0
  137. package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -0
  138. package/dist/collection/components/cat-spinner/cat-spinner.css +63 -0
  139. package/dist/collection/components/cat-spinner/cat-spinner.js +65 -0
  140. package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -0
  141. package/dist/collection/components/cat-tooltip/cat-tooltip.css +37 -0
  142. package/dist/collection/components/cat-tooltip/cat-tooltip.js +254 -0
  143. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -0
  144. package/dist/collection/index.cdn.js +21 -0
  145. package/dist/collection/index.js +2 -0
  146. package/dist/collection/index.js.map +1 -0
  147. package/dist/collection/init.js +9 -0
  148. package/dist/collection/init.js.map +1 -0
  149. package/dist/collection/utils/breakpoints.js +12 -0
  150. package/dist/collection/utils/breakpoints.js.map +1 -0
  151. package/dist/collection/utils/first-tabbable.js +6 -0
  152. package/dist/collection/utils/first-tabbable.js.map +1 -0
  153. package/dist/collection/utils/is-touch-screen.js +3 -0
  154. package/dist/collection/utils/is-touch-screen.js.map +1 -0
  155. package/dist/collection/utils/media-matcher.js +55 -0
  156. package/dist/collection/utils/media-matcher.js.map +1 -0
  157. package/dist/collection/utils/platform.js +50 -0
  158. package/dist/collection/utils/platform.js.map +1 -0
  159. package/dist/collection/utils/utils.js +4 -0
  160. package/dist/collection/utils/utils.js.map +1 -0
  161. package/dist/{catalyst/cat-alert.entry.js → components/cat-alert.js} +28 -8
  162. package/dist/components/cat-alert.js.map +1 -0
  163. package/dist/{catalyst/cat-badge.entry.js → components/cat-badge.js} +32 -8
  164. package/dist/components/cat-badge.js.map +1 -0
  165. package/dist/{catalyst/cat-button.entry.js → components/cat-button.js} +60 -41
  166. package/dist/components/cat-button.js.map +1 -0
  167. package/dist/components/cat-icon-registry.js +45 -0
  168. package/dist/components/cat-icon-registry.js.map +1 -0
  169. package/dist/components/cat-icon.js +8 -0
  170. package/dist/components/cat-icon.js.map +1 -0
  171. package/dist/{catalyst/cat-icon.entry.js → components/cat-icon2.js} +28 -9
  172. package/dist/components/cat-icon2.js.map +1 -0
  173. package/dist/components/cat-menu.js +870 -0
  174. package/dist/components/cat-menu.js.map +1 -0
  175. package/dist/components/cat-scrollable.js +1363 -0
  176. package/dist/components/cat-scrollable.js.map +1 -0
  177. package/dist/{catalyst/cat-skeleton.entry.js → components/cat-skeleton.js} +31 -8
  178. package/dist/components/cat-skeleton.js.map +1 -0
  179. package/dist/components/cat-spinner.js +8 -0
  180. package/dist/components/cat-spinner.js.map +1 -0
  181. package/dist/{catalyst/cat-spinner.entry.js → components/cat-spinner2.js} +26 -8
  182. package/dist/components/cat-spinner2.js.map +1 -0
  183. package/dist/components/{cat-input.d.ts → cat-tooltip.d.ts} +4 -4
  184. package/dist/components/cat-tooltip.js +154 -0
  185. package/dist/components/cat-tooltip.js.map +1 -0
  186. package/dist/components/first-tabbable.js +1495 -0
  187. package/dist/components/first-tabbable.js.map +1 -0
  188. package/dist/components/index.js +173 -0
  189. package/dist/components/index.js.map +1 -0
  190. package/dist/esm/app-globals-8af9b2cf.js +171 -0
  191. package/dist/esm/app-globals-8af9b2cf.js.map +1 -0
  192. package/dist/esm/cat-alert_9.entry.js +4545 -0
  193. package/dist/esm/cat-alert_9.entry.js.map +1 -0
  194. package/dist/{catalyst → esm}/cat-icon-registry-59da2e37.js +0 -0
  195. package/dist/{catalyst → esm}/cat-icon-registry-59da2e37.js.map +0 -0
  196. package/dist/esm/catalyst.js +22 -0
  197. package/dist/esm/catalyst.js.map +1 -0
  198. package/dist/esm/index-0ff35bca.js +1320 -0
  199. package/dist/esm/index-0ff35bca.js.map +1 -0
  200. package/dist/esm/index.js +3 -0
  201. package/dist/esm/index.js.map +1 -0
  202. package/dist/esm/loader.js +22 -0
  203. package/dist/esm/loader.js.map +1 -0
  204. package/dist/esm/polyfills/core-js.js +11 -0
  205. package/dist/esm/polyfills/css-shim.js +1 -0
  206. package/dist/esm/polyfills/dom.js +79 -0
  207. package/dist/esm/polyfills/es5-html-element.js +1 -0
  208. package/dist/esm/polyfills/index.js +34 -0
  209. package/dist/esm/polyfills/system.js +6 -0
  210. package/dist/index.cjs.js +1 -0
  211. package/dist/index.js +1 -0
  212. package/dist/types/components/cat-menu/cat-menu.d.ts +0 -1
  213. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +46 -0
  214. package/dist/types/components.d.ts +61 -0
  215. package/dist/types/index.d.ts +1 -0
  216. package/dist/types/utils/first-tabbable.d.ts +4 -0
  217. package/dist/types/utils/is-touch-screen.d.ts +2 -0
  218. package/package.json +12 -19
  219. package/dist/catalyst/app-globals-54573336.js +0 -718
  220. package/dist/catalyst/app-globals-54573336.js.map +0 -1
  221. package/dist/catalyst/cat-alert.entry.js.map +0 -1
  222. package/dist/catalyst/cat-badge.entry.js.map +0 -1
  223. package/dist/catalyst/cat-button.entry.js.map +0 -1
  224. package/dist/catalyst/cat-icon.entry.js.map +0 -1
  225. package/dist/catalyst/cat-input.entry.js +0 -55
  226. package/dist/catalyst/cat-input.entry.js.map +0 -1
  227. package/dist/catalyst/cat-menu.entry.js +0 -2986
  228. package/dist/catalyst/cat-menu.entry.js.map +0 -1
  229. package/dist/catalyst/cat-scrollable.entry.js +0 -4523
  230. package/dist/catalyst/cat-scrollable.entry.js.map +0 -1
  231. package/dist/catalyst/cat-skeleton.entry.js.map +0 -1
  232. package/dist/catalyst/cat-spinner.entry.js.map +0 -1
  233. package/dist/catalyst/css-shim-e6dd2538.js +0 -6
  234. package/dist/catalyst/css-shim-e6dd2538.js.map +0 -1
  235. package/dist/catalyst/dom-7fc649b0.js +0 -75
  236. package/dist/catalyst/dom-7fc649b0.js.map +0 -1
  237. package/dist/catalyst/index-2df805aa.js +0 -3059
  238. package/dist/catalyst/index-2df805aa.js.map +0 -1
  239. package/dist/catalyst/shadow-css-4d56fa31.js +0 -390
  240. package/dist/catalyst/shadow-css-4d56fa31.js.map +0 -1
  241. package/dist/types/components/cat-input/cat-input.d.ts +0 -70
@@ -0,0 +1,1495 @@
1
+ function getSide(placement) {
2
+ return placement.split('-')[0];
3
+ }
4
+
5
+ function getAlignment(placement) {
6
+ return placement.split('-')[1];
7
+ }
8
+
9
+ function getMainAxisFromPlacement(placement) {
10
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
11
+ }
12
+
13
+ function getLengthFromAxis(axis) {
14
+ return axis === 'y' ? 'height' : 'width';
15
+ }
16
+
17
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
18
+ let {
19
+ reference,
20
+ floating
21
+ } = _ref;
22
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
23
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
24
+ const mainAxis = getMainAxisFromPlacement(placement);
25
+ const length = getLengthFromAxis(mainAxis);
26
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
27
+ const side = getSide(placement);
28
+ const isVertical = mainAxis === 'x';
29
+ let coords;
30
+
31
+ switch (side) {
32
+ case 'top':
33
+ coords = {
34
+ x: commonX,
35
+ y: reference.y - floating.height
36
+ };
37
+ break;
38
+
39
+ case 'bottom':
40
+ coords = {
41
+ x: commonX,
42
+ y: reference.y + reference.height
43
+ };
44
+ break;
45
+
46
+ case 'right':
47
+ coords = {
48
+ x: reference.x + reference.width,
49
+ y: commonY
50
+ };
51
+ break;
52
+
53
+ case 'left':
54
+ coords = {
55
+ x: reference.x - floating.width,
56
+ y: commonY
57
+ };
58
+ break;
59
+
60
+ default:
61
+ coords = {
62
+ x: reference.x,
63
+ y: reference.y
64
+ };
65
+ }
66
+
67
+ switch (getAlignment(placement)) {
68
+ case 'start':
69
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
70
+ break;
71
+
72
+ case 'end':
73
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
74
+ break;
75
+ }
76
+
77
+ return coords;
78
+ }
79
+
80
+ /**
81
+ * Computes the `x` and `y` coordinates that will place the floating element
82
+ * next to a reference element when it is given a certain positioning strategy.
83
+ *
84
+ * This export does not have any `platform` interface logic. You will need to
85
+ * write one for the platform you are using Floating UI with.
86
+ */
87
+
88
+ const computePosition$1 = async (reference, floating, config) => {
89
+ const {
90
+ placement = 'bottom',
91
+ strategy = 'absolute',
92
+ middleware = [],
93
+ platform
94
+ } = config;
95
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
96
+
97
+ let rects = await platform.getElementRects({
98
+ reference,
99
+ floating,
100
+ strategy
101
+ });
102
+ let {
103
+ x,
104
+ y
105
+ } = computeCoordsFromPlacement(rects, placement, rtl);
106
+ let statefulPlacement = placement;
107
+ let middlewareData = {};
108
+
109
+ for (let i = 0; i < middleware.length; i++) {
110
+
111
+ const {
112
+ name,
113
+ fn
114
+ } = middleware[i];
115
+ const {
116
+ x: nextX,
117
+ y: nextY,
118
+ data,
119
+ reset
120
+ } = await fn({
121
+ x,
122
+ y,
123
+ initialPlacement: placement,
124
+ placement: statefulPlacement,
125
+ strategy,
126
+ middlewareData,
127
+ rects,
128
+ platform,
129
+ elements: {
130
+ reference,
131
+ floating
132
+ }
133
+ });
134
+ x = nextX != null ? nextX : x;
135
+ y = nextY != null ? nextY : y;
136
+ middlewareData = { ...middlewareData,
137
+ [name]: { ...middlewareData[name],
138
+ ...data
139
+ }
140
+ };
141
+
142
+ if (reset) {
143
+ if (typeof reset === 'object') {
144
+ if (reset.placement) {
145
+ statefulPlacement = reset.placement;
146
+ }
147
+
148
+ if (reset.rects) {
149
+ rects = reset.rects === true ? await platform.getElementRects({
150
+ reference,
151
+ floating,
152
+ strategy
153
+ }) : reset.rects;
154
+ }
155
+
156
+ ({
157
+ x,
158
+ y
159
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
160
+ }
161
+
162
+ i = -1;
163
+ continue;
164
+ }
165
+ }
166
+
167
+ return {
168
+ x,
169
+ y,
170
+ placement: statefulPlacement,
171
+ strategy,
172
+ middlewareData
173
+ };
174
+ };
175
+
176
+ function expandPaddingObject(padding) {
177
+ return {
178
+ top: 0,
179
+ right: 0,
180
+ bottom: 0,
181
+ left: 0,
182
+ ...padding
183
+ };
184
+ }
185
+
186
+ function getSideObjectFromPadding(padding) {
187
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
188
+ top: padding,
189
+ right: padding,
190
+ bottom: padding,
191
+ left: padding
192
+ };
193
+ }
194
+
195
+ function rectToClientRect(rect) {
196
+ return { ...rect,
197
+ top: rect.y,
198
+ left: rect.x,
199
+ right: rect.x + rect.width,
200
+ bottom: rect.y + rect.height
201
+ };
202
+ }
203
+
204
+ /**
205
+ * Resolves with an object of overflow side offsets that determine how much the
206
+ * element is overflowing a given clipping boundary.
207
+ * - positive = overflowing the boundary by that number of pixels
208
+ * - negative = how many pixels left before it will overflow
209
+ * - 0 = lies flush with the boundary
210
+ * @see https://floating-ui.com/docs/detectOverflow
211
+ */
212
+ async function detectOverflow(middlewareArguments, options) {
213
+ var _await$platform$isEle;
214
+
215
+ if (options === void 0) {
216
+ options = {};
217
+ }
218
+
219
+ const {
220
+ x,
221
+ y,
222
+ platform,
223
+ rects,
224
+ elements,
225
+ strategy
226
+ } = middlewareArguments;
227
+ const {
228
+ boundary = 'clippingAncestors',
229
+ rootBoundary = 'viewport',
230
+ elementContext = 'floating',
231
+ altBoundary = false,
232
+ padding = 0
233
+ } = options;
234
+ const paddingObject = getSideObjectFromPadding(padding);
235
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
236
+ const element = elements[altBoundary ? altContext : elementContext];
237
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
238
+ 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))),
239
+ boundary,
240
+ rootBoundary,
241
+ strategy
242
+ }));
243
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
244
+ rect: elementContext === 'floating' ? { ...rects.floating,
245
+ x,
246
+ y
247
+ } : rects.reference,
248
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
249
+ strategy
250
+ }) : rects[elementContext]); // positive = overflowing the clipping rect
251
+ // 0 or negative = within the clipping rect
252
+
253
+ return {
254
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
255
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
256
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
257
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
258
+ };
259
+ }
260
+
261
+ const hash$1 = {
262
+ left: 'right',
263
+ right: 'left',
264
+ bottom: 'top',
265
+ top: 'bottom'
266
+ };
267
+ function getOppositePlacement(placement) {
268
+ return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
269
+ }
270
+
271
+ function getAlignmentSides(placement, rects, rtl) {
272
+ if (rtl === void 0) {
273
+ rtl = false;
274
+ }
275
+
276
+ const alignment = getAlignment(placement);
277
+ const mainAxis = getMainAxisFromPlacement(placement);
278
+ const length = getLengthFromAxis(mainAxis);
279
+ let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
280
+
281
+ if (rects.reference[length] > rects.floating[length]) {
282
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
283
+ }
284
+
285
+ return {
286
+ main: mainAlignmentSide,
287
+ cross: getOppositePlacement(mainAlignmentSide)
288
+ };
289
+ }
290
+
291
+ const hash = {
292
+ start: 'end',
293
+ end: 'start'
294
+ };
295
+ function getOppositeAlignmentPlacement(placement) {
296
+ return placement.replace(/start|end/g, matched => hash[matched]);
297
+ }
298
+
299
+ function getExpandedPlacements(placement) {
300
+ const oppositePlacement = getOppositePlacement(placement);
301
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
302
+ }
303
+
304
+ /**
305
+ * Changes the placement of the floating element to one that will fit if the
306
+ * initially specified `placement` does not.
307
+ * @see https://floating-ui.com/docs/flip
308
+ */
309
+ const flip = function (options) {
310
+ if (options === void 0) {
311
+ options = {};
312
+ }
313
+
314
+ return {
315
+ name: 'flip',
316
+ options,
317
+
318
+ async fn(middlewareArguments) {
319
+ var _middlewareData$flip;
320
+
321
+ const {
322
+ placement,
323
+ middlewareData,
324
+ rects,
325
+ initialPlacement,
326
+ platform,
327
+ elements
328
+ } = middlewareArguments;
329
+ const {
330
+ mainAxis: checkMainAxis = true,
331
+ crossAxis: checkCrossAxis = true,
332
+ fallbackPlacements: specifiedFallbackPlacements,
333
+ fallbackStrategy = 'bestFit',
334
+ flipAlignment = true,
335
+ ...detectOverflowOptions
336
+ } = options;
337
+ const side = getSide(placement);
338
+ const isBasePlacement = side === initialPlacement;
339
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
340
+ const placements = [initialPlacement, ...fallbackPlacements];
341
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
342
+ const overflows = [];
343
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
344
+
345
+ if (checkMainAxis) {
346
+ overflows.push(overflow[side]);
347
+ }
348
+
349
+ if (checkCrossAxis) {
350
+ const {
351
+ main,
352
+ cross
353
+ } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
354
+ overflows.push(overflow[main], overflow[cross]);
355
+ }
356
+
357
+ overflowsData = [...overflowsData, {
358
+ placement,
359
+ overflows
360
+ }]; // One or more sides is overflowing
361
+
362
+ if (!overflows.every(side => side <= 0)) {
363
+ var _middlewareData$flip$, _middlewareData$flip2;
364
+
365
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
366
+ const nextPlacement = placements[nextIndex];
367
+
368
+ if (nextPlacement) {
369
+ // Try next placement and re-run the lifecycle
370
+ return {
371
+ data: {
372
+ index: nextIndex,
373
+ overflows: overflowsData
374
+ },
375
+ reset: {
376
+ placement: nextPlacement
377
+ }
378
+ };
379
+ }
380
+
381
+ let resetPlacement = 'bottom';
382
+
383
+ switch (fallbackStrategy) {
384
+ case 'bestFit':
385
+ {
386
+ var _overflowsData$map$so;
387
+
388
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d, 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].placement;
389
+
390
+ if (placement) {
391
+ resetPlacement = placement;
392
+ }
393
+
394
+ break;
395
+ }
396
+
397
+ case 'initialPlacement':
398
+ resetPlacement = initialPlacement;
399
+ break;
400
+ }
401
+
402
+ if (placement !== resetPlacement) {
403
+ return {
404
+ reset: {
405
+ placement: resetPlacement
406
+ }
407
+ };
408
+ }
409
+ }
410
+
411
+ return {};
412
+ }
413
+
414
+ };
415
+ };
416
+
417
+ function convertValueToCoords(placement, rects, value, rtl) {
418
+ if (rtl === void 0) {
419
+ rtl = false;
420
+ }
421
+
422
+ const side = getSide(placement);
423
+ const alignment = getAlignment(placement);
424
+ const isVertical = getMainAxisFromPlacement(placement) === 'x';
425
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
426
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
427
+ const rawValue = typeof value === 'function' ? value({ ...rects,
428
+ placement
429
+ }) : value; // eslint-disable-next-line prefer-const
430
+
431
+ let {
432
+ mainAxis,
433
+ crossAxis,
434
+ alignmentAxis
435
+ } = typeof rawValue === 'number' ? {
436
+ mainAxis: rawValue,
437
+ crossAxis: 0,
438
+ alignmentAxis: null
439
+ } : {
440
+ mainAxis: 0,
441
+ crossAxis: 0,
442
+ alignmentAxis: null,
443
+ ...rawValue
444
+ };
445
+
446
+ if (alignment && typeof alignmentAxis === 'number') {
447
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
448
+ }
449
+
450
+ return isVertical ? {
451
+ x: crossAxis * crossAxisMulti,
452
+ y: mainAxis * mainAxisMulti
453
+ } : {
454
+ x: mainAxis * mainAxisMulti,
455
+ y: crossAxis * crossAxisMulti
456
+ };
457
+ }
458
+ /**
459
+ * Displaces the floating element from its reference element.
460
+ * @see https://floating-ui.com/docs/offset
461
+ */
462
+
463
+ const offset = function (value) {
464
+ if (value === void 0) {
465
+ value = 0;
466
+ }
467
+
468
+ return {
469
+ name: 'offset',
470
+ options: value,
471
+
472
+ async fn(middlewareArguments) {
473
+ const {
474
+ x,
475
+ y,
476
+ placement,
477
+ rects,
478
+ platform,
479
+ elements
480
+ } = middlewareArguments;
481
+ const diffCoords = convertValueToCoords(placement, rects, value, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
482
+ return {
483
+ x: x + diffCoords.x,
484
+ y: y + diffCoords.y,
485
+ data: diffCoords
486
+ };
487
+ }
488
+
489
+ };
490
+ };
491
+
492
+ function isWindow(value) {
493
+ return (value == null ? void 0 : value.toString()) === '[object Window]';
494
+ }
495
+ function getWindow(node) {
496
+ if (node == null) {
497
+ return window;
498
+ }
499
+
500
+ if (!isWindow(node)) {
501
+ const ownerDocument = node.ownerDocument;
502
+ return ownerDocument ? ownerDocument.defaultView || window : window;
503
+ }
504
+
505
+ return node;
506
+ }
507
+
508
+ function getComputedStyle$1(element) {
509
+ return getWindow(element).getComputedStyle(element);
510
+ }
511
+
512
+ function getNodeName(node) {
513
+ return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
514
+ }
515
+
516
+ function isHTMLElement(value) {
517
+ return value instanceof getWindow(value).HTMLElement;
518
+ }
519
+ function isElement(value) {
520
+ return value instanceof getWindow(value).Element;
521
+ }
522
+ function isNode(value) {
523
+ return value instanceof getWindow(value).Node;
524
+ }
525
+ function isShadowRoot(node) {
526
+ const OwnElement = getWindow(node).ShadowRoot;
527
+ return node instanceof OwnElement || node instanceof ShadowRoot;
528
+ }
529
+ function isOverflowElement(element) {
530
+ // Firefox wants us to check `-x` and `-y` variations as well
531
+ const {
532
+ overflow,
533
+ overflowX,
534
+ overflowY
535
+ } = getComputedStyle$1(element);
536
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
537
+ }
538
+ function isTableElement(element) {
539
+ return ['table', 'td', 'th'].includes(getNodeName(element));
540
+ }
541
+ function isContainingBlock(element) {
542
+ // TODO: Try and use feature detection here instead
543
+ const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
544
+ const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
545
+ // create a containing block.
546
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
547
+
548
+ return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
549
+ }
550
+ function isLayoutViewport() {
551
+ // Not Safari
552
+ return !/^((?!chrome|android).)*safari/i.test(navigator.userAgent); // Feature detection for this fails in various ways
553
+ // • Always-visible scrollbar or not
554
+ // • Width of <html>, etc.
555
+ // const vV = win.visualViewport;
556
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
557
+ }
558
+
559
+ const min = Math.min;
560
+ const max = Math.max;
561
+ const round = Math.round;
562
+
563
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
564
+ if (includeScale === void 0) {
565
+ includeScale = false;
566
+ }
567
+
568
+ if (isFixedStrategy === void 0) {
569
+ isFixedStrategy = false;
570
+ }
571
+
572
+ const clientRect = element.getBoundingClientRect();
573
+ let scaleX = 1;
574
+ let scaleY = 1;
575
+
576
+ if (includeScale && isHTMLElement(element)) {
577
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
578
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
579
+ }
580
+
581
+ const win = isElement(element) ? getWindow(element) : window;
582
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
583
+ const x = (clientRect.left + (addVisualOffsets ? win.visualViewport.offsetLeft : 0)) / scaleX;
584
+ const y = (clientRect.top + (addVisualOffsets ? win.visualViewport.offsetTop : 0)) / scaleY;
585
+ const width = clientRect.width / scaleX;
586
+ const height = clientRect.height / scaleY;
587
+ return {
588
+ width,
589
+ height,
590
+ top: y,
591
+ right: x + width,
592
+ bottom: y + height,
593
+ left: x,
594
+ x,
595
+ y
596
+ };
597
+ }
598
+
599
+ function getDocumentElement(node) {
600
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
601
+ }
602
+
603
+ function getNodeScroll(element) {
604
+ if (isWindow(element)) {
605
+ return {
606
+ scrollLeft: element.pageXOffset,
607
+ scrollTop: element.pageYOffset
608
+ };
609
+ }
610
+
611
+ return {
612
+ scrollLeft: element.scrollLeft,
613
+ scrollTop: element.scrollTop
614
+ };
615
+ }
616
+
617
+ function getWindowScrollBarX(element) {
618
+ // If <html> has a CSS width greater than the viewport, then this will be
619
+ // incorrect for RTL.
620
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
621
+ }
622
+
623
+ function isScaled(element) {
624
+ const rect = getBoundingClientRect(element);
625
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
626
+ }
627
+
628
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
629
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
630
+ const documentElement = getDocumentElement(offsetParent);
631
+ const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
632
+ let scroll = {
633
+ scrollLeft: 0,
634
+ scrollTop: 0
635
+ };
636
+ const offsets = {
637
+ x: 0,
638
+ y: 0
639
+ };
640
+
641
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
642
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
643
+ scroll = getNodeScroll(offsetParent);
644
+ }
645
+
646
+ if (isHTMLElement(offsetParent)) {
647
+ const offsetRect = getBoundingClientRect(offsetParent, true);
648
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
649
+ offsets.y = offsetRect.y + offsetParent.clientTop;
650
+ } else if (documentElement) {
651
+ offsets.x = getWindowScrollBarX(documentElement);
652
+ }
653
+ }
654
+
655
+ return {
656
+ x: rect.left + scroll.scrollLeft - offsets.x,
657
+ y: rect.top + scroll.scrollTop - offsets.y,
658
+ width: rect.width,
659
+ height: rect.height
660
+ };
661
+ }
662
+
663
+ function getParentNode(node) {
664
+ if (getNodeName(node) === 'html') {
665
+ return node;
666
+ }
667
+
668
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
669
+ // @ts-ignore
670
+ node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
671
+ node.parentNode || ( // DOM Element detected
672
+ isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
673
+ getDocumentElement(node) // fallback
674
+
675
+ );
676
+ }
677
+
678
+ function getTrueOffsetParent(element) {
679
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
680
+ return null;
681
+ }
682
+
683
+ return element.offsetParent;
684
+ }
685
+
686
+ function getContainingBlock(element) {
687
+ let currentNode = getParentNode(element);
688
+
689
+ if (isShadowRoot(currentNode)) {
690
+ currentNode = currentNode.host;
691
+ }
692
+
693
+ while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
694
+ if (isContainingBlock(currentNode)) {
695
+ return currentNode;
696
+ } else {
697
+ currentNode = currentNode.parentNode;
698
+ }
699
+ }
700
+
701
+ return null;
702
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
703
+ // such as table ancestors and cross browser bugs.
704
+
705
+
706
+ function getOffsetParent(element) {
707
+ const window = getWindow(element);
708
+ let offsetParent = getTrueOffsetParent(element);
709
+
710
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
711
+ offsetParent = getTrueOffsetParent(offsetParent);
712
+ }
713
+
714
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
715
+ return window;
716
+ }
717
+
718
+ return offsetParent || getContainingBlock(element) || window;
719
+ }
720
+
721
+ function getDimensions(element) {
722
+ if (isHTMLElement(element)) {
723
+ return {
724
+ width: element.offsetWidth,
725
+ height: element.offsetHeight
726
+ };
727
+ }
728
+
729
+ const rect = getBoundingClientRect(element);
730
+ return {
731
+ width: rect.width,
732
+ height: rect.height
733
+ };
734
+ }
735
+
736
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
737
+ let {
738
+ rect,
739
+ offsetParent,
740
+ strategy
741
+ } = _ref;
742
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
743
+ const documentElement = getDocumentElement(offsetParent);
744
+
745
+ if (offsetParent === documentElement) {
746
+ return rect;
747
+ }
748
+
749
+ let scroll = {
750
+ scrollLeft: 0,
751
+ scrollTop: 0
752
+ };
753
+ const offsets = {
754
+ x: 0,
755
+ y: 0
756
+ };
757
+
758
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
759
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
760
+ scroll = getNodeScroll(offsetParent);
761
+ }
762
+
763
+ if (isHTMLElement(offsetParent)) {
764
+ const offsetRect = getBoundingClientRect(offsetParent, true);
765
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
766
+ offsets.y = offsetRect.y + offsetParent.clientTop;
767
+ } // This doesn't appear to be need to be negated.
768
+ // else if (documentElement) {
769
+ // offsets.x = getWindowScrollBarX(documentElement);
770
+ // }
771
+
772
+ }
773
+
774
+ return { ...rect,
775
+ x: rect.x - scroll.scrollLeft + offsets.x,
776
+ y: rect.y - scroll.scrollTop + offsets.y
777
+ };
778
+ }
779
+
780
+ function getViewportRect(element, strategy) {
781
+ const win = getWindow(element);
782
+ const html = getDocumentElement(element);
783
+ const visualViewport = win.visualViewport;
784
+ let width = html.clientWidth;
785
+ let height = html.clientHeight;
786
+ let x = 0;
787
+ let y = 0;
788
+
789
+ if (visualViewport) {
790
+ width = visualViewport.width;
791
+ height = visualViewport.height;
792
+ const layoutViewport = isLayoutViewport();
793
+
794
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
795
+ x = visualViewport.offsetLeft;
796
+ y = visualViewport.offsetTop;
797
+ }
798
+ }
799
+
800
+ return {
801
+ width,
802
+ height,
803
+ x,
804
+ y
805
+ };
806
+ }
807
+
808
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
809
+
810
+ function getDocumentRect(element) {
811
+ var _element$ownerDocumen;
812
+
813
+ const html = getDocumentElement(element);
814
+ const scroll = getNodeScroll(element);
815
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
816
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
817
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
818
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
819
+ const y = -scroll.scrollTop;
820
+
821
+ if (getComputedStyle$1(body || html).direction === 'rtl') {
822
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
823
+ }
824
+
825
+ return {
826
+ width,
827
+ height,
828
+ x,
829
+ y
830
+ };
831
+ }
832
+
833
+ function getNearestOverflowAncestor(node) {
834
+ const parentNode = getParentNode(node);
835
+
836
+ if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
837
+ // @ts-ignore assume body is always available
838
+ return node.ownerDocument.body;
839
+ }
840
+
841
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
842
+ return parentNode;
843
+ }
844
+
845
+ return getNearestOverflowAncestor(parentNode);
846
+ }
847
+
848
+ function getOverflowAncestors(node, list) {
849
+ var _node$ownerDocument;
850
+
851
+ if (list === void 0) {
852
+ list = [];
853
+ }
854
+
855
+ const scrollableAncestor = getNearestOverflowAncestor(node);
856
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
857
+ const win = getWindow(scrollableAncestor);
858
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
859
+ const updatedList = list.concat(target);
860
+ return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
861
+ updatedList.concat(getOverflowAncestors(getParentNode(target)));
862
+ }
863
+
864
+ function contains(parent, child) {
865
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
866
+
867
+ if (parent.contains(child)) {
868
+ return true;
869
+ } // then fallback to custom implementation with Shadow DOM support
870
+ else if (rootNode && isShadowRoot(rootNode)) {
871
+ let next = child;
872
+
873
+ do {
874
+ // use `===` replace node.isSameNode()
875
+ if (next && parent === next) {
876
+ return true;
877
+ } // @ts-ignore: need a better way to handle this...
878
+
879
+
880
+ next = next.parentNode || next.host;
881
+ } while (next);
882
+ }
883
+
884
+ return false;
885
+ }
886
+
887
+ function getInnerBoundingClientRect(element, strategy) {
888
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
889
+ const top = clientRect.top + element.clientTop;
890
+ const left = clientRect.left + element.clientLeft;
891
+ return {
892
+ top,
893
+ left,
894
+ x: left,
895
+ y: top,
896
+ right: left + element.clientWidth,
897
+ bottom: top + element.clientHeight,
898
+ width: element.clientWidth,
899
+ height: element.clientHeight
900
+ };
901
+ }
902
+
903
+ function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
904
+ if (clippingParent === 'viewport') {
905
+ return rectToClientRect(getViewportRect(element, strategy));
906
+ }
907
+
908
+ if (isElement(clippingParent)) {
909
+ return getInnerBoundingClientRect(clippingParent, strategy);
910
+ }
911
+
912
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
913
+ } // A "clipping ancestor" is an overflowable container with the characteristic of
914
+ // clipping (or hiding) overflowing elements with a position different from
915
+ // `initial`
916
+
917
+
918
+ function getClippingAncestors(element) {
919
+ const clippingAncestors = getOverflowAncestors(element);
920
+ const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
921
+ const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
922
+
923
+ if (!isElement(clipperElement)) {
924
+ return [];
925
+ } // @ts-ignore isElement check ensures we return Array<Element>
926
+
927
+
928
+ return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
929
+ } // Gets the maximum area that the element is visible in due to any number of
930
+ // clipping ancestors
931
+
932
+
933
+ function getClippingRect(_ref) {
934
+ let {
935
+ element,
936
+ boundary,
937
+ rootBoundary,
938
+ strategy
939
+ } = _ref;
940
+ const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
941
+ const clippingAncestors = [...mainClippingAncestors, rootBoundary];
942
+ const firstClippingAncestor = clippingAncestors[0];
943
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
944
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
945
+ accRect.top = max(rect.top, accRect.top);
946
+ accRect.right = min(rect.right, accRect.right);
947
+ accRect.bottom = min(rect.bottom, accRect.bottom);
948
+ accRect.left = max(rect.left, accRect.left);
949
+ return accRect;
950
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
951
+ return {
952
+ width: clippingRect.right - clippingRect.left,
953
+ height: clippingRect.bottom - clippingRect.top,
954
+ x: clippingRect.left,
955
+ y: clippingRect.top
956
+ };
957
+ }
958
+
959
+ const platform = {
960
+ getClippingRect,
961
+ convertOffsetParentRelativeRectToViewportRelativeRect,
962
+ isElement,
963
+ getDimensions,
964
+ getOffsetParent,
965
+ getDocumentElement,
966
+ getElementRects: _ref => {
967
+ let {
968
+ reference,
969
+ floating,
970
+ strategy
971
+ } = _ref;
972
+ return {
973
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
974
+ floating: { ...getDimensions(floating),
975
+ x: 0,
976
+ y: 0
977
+ }
978
+ };
979
+ },
980
+ getClientRects: element => Array.from(element.getClientRects()),
981
+ isRTL: element => getComputedStyle$1(element).direction === 'rtl'
982
+ };
983
+
984
+ /**
985
+ * Automatically updates the position of the floating element when necessary.
986
+ * @see https://floating-ui.com/docs/autoUpdate
987
+ */
988
+ function autoUpdate(reference, floating, update, options) {
989
+ if (options === void 0) {
990
+ options = {};
991
+ }
992
+
993
+ const {
994
+ ancestorScroll: _ancestorScroll = true,
995
+ ancestorResize: _ancestorResize = true,
996
+ elementResize: _elementResize = true,
997
+ animationFrame = false
998
+ } = options;
999
+ let cleanedUp = false;
1000
+ const ancestorScroll = _ancestorScroll && !animationFrame;
1001
+ const ancestorResize = _ancestorResize && !animationFrame;
1002
+ const elementResize = _elementResize && !animationFrame;
1003
+ const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1004
+ ancestors.forEach(ancestor => {
1005
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1006
+ passive: true
1007
+ });
1008
+ ancestorResize && ancestor.addEventListener('resize', update);
1009
+ });
1010
+ let observer = null;
1011
+
1012
+ if (elementResize) {
1013
+ observer = new ResizeObserver(update);
1014
+ isElement(reference) && observer.observe(reference);
1015
+ observer.observe(floating);
1016
+ }
1017
+
1018
+ let frameId;
1019
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1020
+
1021
+ if (animationFrame) {
1022
+ frameLoop();
1023
+ }
1024
+
1025
+ function frameLoop() {
1026
+ if (cleanedUp) {
1027
+ return;
1028
+ }
1029
+
1030
+ const nextRefRect = getBoundingClientRect(reference);
1031
+
1032
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1033
+ update();
1034
+ }
1035
+
1036
+ prevRefRect = nextRefRect;
1037
+ frameId = requestAnimationFrame(frameLoop);
1038
+ }
1039
+
1040
+ return () => {
1041
+ var _observer;
1042
+
1043
+ cleanedUp = true;
1044
+ ancestors.forEach(ancestor => {
1045
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1046
+ ancestorResize && ancestor.removeEventListener('resize', update);
1047
+ });
1048
+ (_observer = observer) == null ? void 0 : _observer.disconnect();
1049
+ observer = null;
1050
+
1051
+ if (animationFrame) {
1052
+ cancelAnimationFrame(frameId);
1053
+ }
1054
+ };
1055
+ }
1056
+
1057
+ /**
1058
+ * Computes the `x` and `y` coordinates that will place the floating element
1059
+ * next to a reference element when it is given a certain CSS positioning
1060
+ * strategy.
1061
+ */
1062
+
1063
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1064
+ platform,
1065
+ ...options
1066
+ });
1067
+
1068
+ /*!
1069
+ * tabbable 5.3.1
1070
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1071
+ */
1072
+ var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
1073
+ var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
1074
+ var NoElement = typeof Element === 'undefined';
1075
+ var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1076
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
1077
+ return element.getRootNode();
1078
+ } : function (element) {
1079
+ return element.ownerDocument;
1080
+ };
1081
+ /**
1082
+ * @param {Element} el container to check in
1083
+ * @param {boolean} includeContainer add container to check
1084
+ * @param {(node: Element) => boolean} filter filter candidates
1085
+ * @returns {Element[]}
1086
+ */
1087
+
1088
+ var getCandidates = function getCandidates(el, includeContainer, filter) {
1089
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1090
+
1091
+ if (includeContainer && matches.call(el, candidateSelector)) {
1092
+ candidates.unshift(el);
1093
+ }
1094
+
1095
+ candidates = candidates.filter(filter);
1096
+ return candidates;
1097
+ };
1098
+ /**
1099
+ * @callback GetShadowRoot
1100
+ * @param {Element} element to check for shadow root
1101
+ * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
1102
+ */
1103
+
1104
+ /**
1105
+ * @typedef {Object} CandidatesScope
1106
+ * @property {Element} scope contains inner candidates
1107
+ * @property {Element[]} candidates
1108
+ */
1109
+
1110
+ /**
1111
+ * @typedef {Object} IterativeOptions
1112
+ * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
1113
+ * if a function, implies shadow support is enabled and either returns the shadow root of an element
1114
+ * or a boolean stating if it has an undisclosed shadow root
1115
+ * @property {(node: Element) => boolean} filter filter candidates
1116
+ * @property {boolean} flatten if true then result will flatten any CandidatesScope into the returned list
1117
+ */
1118
+
1119
+ /**
1120
+ * @param {Element[]} elements list of element containers to match candidates from
1121
+ * @param {boolean} includeContainer add container list to check
1122
+ * @param {IterativeOptions} options
1123
+ * @returns {Array.<Element|CandidatesScope>}
1124
+ */
1125
+
1126
+
1127
+ var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
1128
+ var candidates = [];
1129
+ var elementsToCheck = Array.from(elements);
1130
+
1131
+ while (elementsToCheck.length) {
1132
+ var element = elementsToCheck.shift();
1133
+
1134
+ if (element.tagName === 'SLOT') {
1135
+ // add shadow dom slot scope (slot itself cannot be focusable)
1136
+ var assigned = element.assignedElements();
1137
+ var content = assigned.length ? assigned : element.children;
1138
+ var nestedCandidates = getCandidatesIteratively(content, true, options);
1139
+
1140
+ if (options.flatten) {
1141
+ candidates.push.apply(candidates, nestedCandidates);
1142
+ } else {
1143
+ candidates.push({
1144
+ scope: element,
1145
+ candidates: nestedCandidates
1146
+ });
1147
+ }
1148
+ } else {
1149
+ // check candidate element
1150
+ var validCandidate = matches.call(element, candidateSelector);
1151
+
1152
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
1153
+ candidates.push(element);
1154
+ } // iterate over shadow content if possible
1155
+
1156
+
1157
+ var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
1158
+ typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
1159
+
1160
+ if (shadowRoot) {
1161
+ // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
1162
+ // shadow exists, so look at light dom children as fallback BUT create a scope for any
1163
+ // child candidates found because they're likely slotted elements (elements that are
1164
+ // children of the web component element (which has the shadow), in the light dom, but
1165
+ // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
1166
+ // _after_ we return from this recursive call
1167
+ var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
1168
+
1169
+ if (options.flatten) {
1170
+ candidates.push.apply(candidates, _nestedCandidates);
1171
+ } else {
1172
+ candidates.push({
1173
+ scope: element,
1174
+ candidates: _nestedCandidates
1175
+ });
1176
+ }
1177
+ } else {
1178
+ // there's not shadow so just dig into the element's (light dom) children
1179
+ // __without__ giving the element special scope treatment
1180
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
1181
+ }
1182
+ }
1183
+ }
1184
+
1185
+ return candidates;
1186
+ };
1187
+
1188
+ var getTabindex = function getTabindex(node, isScope) {
1189
+ if (node.tabIndex < 0) {
1190
+ // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
1191
+ // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
1192
+ // yet they are still part of the regular tab order; in FF, they get a default
1193
+ // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
1194
+ // order, consider their tab index to be 0.
1195
+ // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
1196
+ // so if they don't have a tabindex attribute specifically set, assume it's 0.
1197
+ //
1198
+ // isScope is positive for custom element with shadow root or slot that by default
1199
+ // have tabIndex -1, but need to be sorted by document order in order for their
1200
+ // content to be inserted in the correct position
1201
+ if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
1202
+ return 0;
1203
+ }
1204
+ }
1205
+
1206
+ return node.tabIndex;
1207
+ };
1208
+
1209
+ var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
1210
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
1211
+ };
1212
+
1213
+ var isInput = function isInput(node) {
1214
+ return node.tagName === 'INPUT';
1215
+ };
1216
+
1217
+ var isHiddenInput = function isHiddenInput(node) {
1218
+ return isInput(node) && node.type === 'hidden';
1219
+ };
1220
+
1221
+ var isDetailsWithSummary = function isDetailsWithSummary(node) {
1222
+ var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
1223
+ return child.tagName === 'SUMMARY';
1224
+ });
1225
+ return r;
1226
+ };
1227
+
1228
+ var getCheckedRadio = function getCheckedRadio(nodes, form) {
1229
+ for (var i = 0; i < nodes.length; i++) {
1230
+ if (nodes[i].checked && nodes[i].form === form) {
1231
+ return nodes[i];
1232
+ }
1233
+ }
1234
+ };
1235
+
1236
+ var isTabbableRadio = function isTabbableRadio(node) {
1237
+ if (!node.name) {
1238
+ return true;
1239
+ }
1240
+
1241
+ var radioScope = node.form || getRootNode(node);
1242
+
1243
+ var queryRadios = function queryRadios(name) {
1244
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
1245
+ };
1246
+
1247
+ var radioSet;
1248
+
1249
+ if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
1250
+ radioSet = queryRadios(window.CSS.escape(node.name));
1251
+ } else {
1252
+ try {
1253
+ radioSet = queryRadios(node.name);
1254
+ } catch (err) {
1255
+ // eslint-disable-next-line no-console
1256
+ console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
1257
+ return false;
1258
+ }
1259
+ }
1260
+
1261
+ var checked = getCheckedRadio(radioSet, node.form);
1262
+ return !checked || checked === node;
1263
+ };
1264
+
1265
+ var isRadio = function isRadio(node) {
1266
+ return isInput(node) && node.type === 'radio';
1267
+ };
1268
+
1269
+ var isNonTabbableRadio = function isNonTabbableRadio(node) {
1270
+ return isRadio(node) && !isTabbableRadio(node);
1271
+ };
1272
+
1273
+ var isZeroArea = function isZeroArea(node) {
1274
+ var _node$getBoundingClie = node.getBoundingClientRect(),
1275
+ width = _node$getBoundingClie.width,
1276
+ height = _node$getBoundingClie.height;
1277
+
1278
+ return width === 0 && height === 0;
1279
+ };
1280
+
1281
+ var isHidden = function isHidden(node, _ref) {
1282
+ var displayCheck = _ref.displayCheck,
1283
+ getShadowRoot = _ref.getShadowRoot;
1284
+
1285
+ if (getComputedStyle(node).visibility === 'hidden') {
1286
+ return true;
1287
+ }
1288
+
1289
+ var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
1290
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
1291
+
1292
+ if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
1293
+ return true;
1294
+ }
1295
+
1296
+ if (!displayCheck || displayCheck === 'full') {
1297
+ if (typeof getShadowRoot === 'function') {
1298
+ // figure out if we should consider the node to be in an undisclosed shadow and use the
1299
+ // 'non-zero-area' fallback
1300
+ var originalNode = node;
1301
+
1302
+ while (node) {
1303
+ var parentElement = node.parentElement;
1304
+ var rootNode = getRootNode(node);
1305
+
1306
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
1307
+ ) {
1308
+ // node has an undisclosed shadow which means we can only treat it as a black box, so we
1309
+ // fall back to a non-zero-area test
1310
+ return isZeroArea(node);
1311
+ } else if (node.assignedSlot) {
1312
+ // iterate up slot
1313
+ node = node.assignedSlot;
1314
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
1315
+ // cross shadow boundary
1316
+ node = rootNode.host;
1317
+ } else {
1318
+ // iterate up normal dom
1319
+ node = parentElement;
1320
+ }
1321
+ }
1322
+
1323
+ node = originalNode;
1324
+ } // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
1325
+ // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
1326
+ // it might be a falsy value, which means shadow DOM support is disabled
1327
+ // didn't find it sitting in an undisclosed shadow (or shadows are disabled) so now we
1328
+ // can just test to see if it would normally be visible or not
1329
+ // this works wherever the node is: if there's at least one client rect, it's
1330
+ // somehow displayed; it also covers the CSS 'display: contents' case where the
1331
+ // node itself is hidden in place of its contents; and there's no need to search
1332
+ // up the hierarchy either
1333
+
1334
+
1335
+ return !node.getClientRects().length;
1336
+ } else if (displayCheck === 'non-zero-area') {
1337
+ return isZeroArea(node);
1338
+ }
1339
+
1340
+ return false;
1341
+ }; // form fields (nested) inside a disabled fieldset are not focusable/tabbable
1342
+ // unless they are in the _first_ <legend> element of the top-most disabled
1343
+ // fieldset
1344
+
1345
+
1346
+ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
1347
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
1348
+ var parentNode = node.parentElement; // check if `node` is contained in a disabled <fieldset>
1349
+
1350
+ while (parentNode) {
1351
+ if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
1352
+ // look for the first <legend> among the children of the disabled <fieldset>
1353
+ for (var i = 0; i < parentNode.children.length; i++) {
1354
+ var child = parentNode.children.item(i); // when the first <legend> (in document order) is found
1355
+
1356
+ if (child.tagName === 'LEGEND') {
1357
+ // if its parent <fieldset> is not nested in another disabled <fieldset>,
1358
+ // return whether `node` is a descendant of its first <legend>
1359
+ return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
1360
+ }
1361
+ } // the disabled <fieldset> containing `node` has no <legend>
1362
+
1363
+
1364
+ return true;
1365
+ }
1366
+
1367
+ parentNode = parentNode.parentElement;
1368
+ }
1369
+ } // else, node's tabbable/focusable state should not be affected by a fieldset's
1370
+ // enabled/disabled state
1371
+
1372
+
1373
+ return false;
1374
+ };
1375
+
1376
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
1377
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
1378
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
1379
+ return false;
1380
+ }
1381
+
1382
+ return true;
1383
+ };
1384
+
1385
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
1386
+ if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
1387
+ return false;
1388
+ }
1389
+
1390
+ return true;
1391
+ };
1392
+ /**
1393
+ * @param {Array.<Element|CandidatesScope>} candidates
1394
+ * @returns Element[]
1395
+ */
1396
+
1397
+
1398
+ var sortByOrder = function sortByOrder(candidates) {
1399
+ var regularTabbables = [];
1400
+ var orderedTabbables = [];
1401
+ candidates.forEach(function (item, i) {
1402
+ var isScope = !!item.scope;
1403
+ var element = isScope ? item.scope : item;
1404
+ var candidateTabindex = getTabindex(element, isScope);
1405
+ var elements = isScope ? sortByOrder(item.candidates) : element;
1406
+
1407
+ if (candidateTabindex === 0) {
1408
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
1409
+ } else {
1410
+ orderedTabbables.push({
1411
+ documentOrder: i,
1412
+ tabIndex: candidateTabindex,
1413
+ item: item,
1414
+ isScope: isScope,
1415
+ content: elements
1416
+ });
1417
+ }
1418
+ });
1419
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
1420
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
1421
+ return acc;
1422
+ }, []).concat(regularTabbables);
1423
+ };
1424
+
1425
+ var tabbable = function tabbable(el, options) {
1426
+ options = options || {};
1427
+ var candidates;
1428
+
1429
+ if (options.getShadowRoot) {
1430
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
1431
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
1432
+ flatten: false,
1433
+ getShadowRoot: options.getShadowRoot
1434
+ });
1435
+ } else {
1436
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
1437
+ }
1438
+
1439
+ return sortByOrder(candidates);
1440
+ };
1441
+
1442
+ var focusable = function focusable(el, options) {
1443
+ options = options || {};
1444
+ var candidates;
1445
+
1446
+ if (options.getShadowRoot) {
1447
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
1448
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
1449
+ flatten: true,
1450
+ getShadowRoot: options.getShadowRoot
1451
+ });
1452
+ } else {
1453
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
1454
+ }
1455
+
1456
+ return candidates;
1457
+ };
1458
+
1459
+ var isTabbable = function isTabbable(node, options) {
1460
+ options = options || {};
1461
+
1462
+ if (!node) {
1463
+ throw new Error('No node provided');
1464
+ }
1465
+
1466
+ if (matches.call(node, candidateSelector) === false) {
1467
+ return false;
1468
+ }
1469
+
1470
+ return isNodeMatchingSelectorTabbable(options, node);
1471
+ };
1472
+
1473
+ var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
1474
+
1475
+ var isFocusable = function isFocusable(node, options) {
1476
+ options = options || {};
1477
+
1478
+ if (!node) {
1479
+ throw new Error('No node provided');
1480
+ }
1481
+
1482
+ if (matches.call(node, focusableCandidateSelector) === false) {
1483
+ return false;
1484
+ }
1485
+
1486
+ return isNodeMatchingSelectorFocusable(options, node);
1487
+ };
1488
+
1489
+ const firstTabbable = (container) => {
1490
+ return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
1491
+ };
1492
+
1493
+ export { isFocusable as a, firstTabbable as b, autoUpdate as c, computePosition as d, flip as e, focusable as f, isTabbable as i, offset as o, tabbable as t };
1494
+
1495
+ //# sourceMappingURL=first-tabbable.js.map