@beeq/core 1.8.0-beta.2 → 1.8.0-beta.3

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 (292) hide show
  1. package/dist/beeq/beeq.esm.js +1 -43
  2. package/dist/beeq/beeq.esm.js.map +1 -1
  3. package/dist/beeq/index.esm.js +1 -64
  4. package/dist/beeq/index.esm.js.map +1 -1
  5. package/dist/beeq/p-010fb578.entry.js +6 -0
  6. package/dist/beeq/{p-7c06dfec.entry.js.map → p-010fb578.entry.js.map} +1 -1
  7. package/dist/beeq/p-05b44bb7.entry.js +6 -0
  8. package/dist/beeq/{p-9aa18e2f.entry.js.map → p-05b44bb7.entry.js.map} +1 -1
  9. package/dist/beeq/p-0cbec77b.entry.js +6 -0
  10. package/dist/beeq/{p-ceb3bb9a.entry.js.map → p-0cbec77b.entry.js.map} +1 -1
  11. package/dist/beeq/p-115ed5b2.js +1 -25
  12. package/dist/beeq/p-115ed5b2.js.map +1 -1
  13. package/dist/beeq/p-1202161d.entry.js +6 -0
  14. package/dist/beeq/{p-0ebe73ef.entry.js.map → p-1202161d.entry.js.map} +1 -1
  15. package/dist/beeq/p-17b341dd.entry.js +6 -0
  16. package/dist/beeq/{p-05685544.entry.js.map → p-17b341dd.entry.js.map} +1 -1
  17. package/dist/beeq/p-1c8b6eb4.js +1 -12
  18. package/dist/beeq/p-1c8b6eb4.js.map +1 -1
  19. package/dist/beeq/p-1d81f9e5.entry.js +6 -0
  20. package/dist/beeq/{p-3dd0e436.entry.js.map → p-1d81f9e5.entry.js.map} +1 -1
  21. package/dist/beeq/p-1f3a4359.js +1 -11
  22. package/dist/beeq/p-1f3a4359.js.map +1 -1
  23. package/dist/beeq/p-2714ce21.entry.js +6 -0
  24. package/dist/beeq/{p-377c70d1.entry.js.map → p-2714ce21.entry.js.map} +1 -1
  25. package/dist/beeq/p-2e61db84.entry.js +6 -0
  26. package/dist/beeq/{p-734853f9.entry.js.map → p-2e61db84.entry.js.map} +1 -1
  27. package/dist/beeq/p-32f74048.entry.js +6 -0
  28. package/dist/beeq/{p-911e07b7.entry.js.map → p-32f74048.entry.js.map} +1 -1
  29. package/dist/beeq/p-339d14c8.entry.js +6 -0
  30. package/dist/beeq/{p-b4278945.entry.js.map → p-339d14c8.entry.js.map} +1 -1
  31. package/dist/beeq/p-35ec6cac.entry.js +6 -0
  32. package/dist/beeq/{p-c907de72.entry.js.map → p-35ec6cac.entry.js.map} +1 -1
  33. package/dist/beeq/p-38d4bd8a.js +1 -1934
  34. package/dist/beeq/p-38d4bd8a.js.map +1 -1
  35. package/dist/beeq/p-3ea228d3.entry.js +6 -0
  36. package/dist/beeq/{p-f8663855.entry.js.map → p-3ea228d3.entry.js.map} +1 -1
  37. package/dist/beeq/p-3fd0d92d.js +1 -1228
  38. package/dist/beeq/p-3fd0d92d.js.map +1 -1
  39. package/dist/beeq/p-45b7b5cf.entry.js +6 -0
  40. package/dist/beeq/{p-600e7c38.entry.js.map → p-45b7b5cf.entry.js.map} +1 -1
  41. package/dist/beeq/p-45e674b4.entry.js +6 -0
  42. package/dist/beeq/{p-026222c6.entry.js.map → p-45e674b4.entry.js.map} +1 -1
  43. package/dist/beeq/p-4954154f.entry.js +6 -0
  44. package/dist/beeq/{p-43e4fcdb.entry.js.map → p-4954154f.entry.js.map} +1 -1
  45. package/dist/beeq/p-513bab02.js +1 -11
  46. package/dist/beeq/p-513bab02.js.map +1 -1
  47. package/dist/beeq/p-57621be1.js +1 -9
  48. package/dist/beeq/p-57621be1.js.map +1 -1
  49. package/dist/beeq/p-5a9a73a0.js +6 -0
  50. package/dist/beeq/p-5a9a73a0.js.map +1 -0
  51. package/dist/beeq/p-5f3ce05a.entry.js +6 -0
  52. package/dist/beeq/{p-b38e8c5a.entry.js.map → p-5f3ce05a.entry.js.map} +1 -1
  53. package/dist/beeq/p-6823479d.entry.js +6 -0
  54. package/dist/beeq/{p-7089c66a.entry.js.map → p-6823479d.entry.js.map} +1 -1
  55. package/dist/beeq/p-687da041.js +1 -20
  56. package/dist/beeq/p-687da041.js.map +1 -1
  57. package/dist/beeq/p-76e714c6.js +7 -0
  58. package/dist/beeq/p-76e714c6.js.map +1 -0
  59. package/dist/beeq/p-7871f3f0.entry.js +6 -0
  60. package/dist/beeq/{p-19df76ba.entry.js.map → p-7871f3f0.entry.js.map} +1 -1
  61. package/dist/beeq/p-7a049750.entry.js +6 -0
  62. package/dist/beeq/{p-11eaeb5d.entry.js.map → p-7a049750.entry.js.map} +1 -1
  63. package/dist/beeq/p-83207939.entry.js +6 -0
  64. package/dist/beeq/{p-5eab4f55.entry.js.map → p-83207939.entry.js.map} +1 -1
  65. package/dist/beeq/p-8d8993ba.entry.js +6 -0
  66. package/dist/beeq/{p-7b9ff03f.entry.js.map → p-8d8993ba.entry.js.map} +1 -1
  67. package/dist/beeq/p-9406afc0.entry.js +6 -0
  68. package/dist/beeq/{p-7774eec3.entry.js.map → p-9406afc0.entry.js.map} +1 -1
  69. package/dist/beeq/p-94899104.entry.js +6 -0
  70. package/dist/beeq/{p-924ebf7d.entry.js.map → p-94899104.entry.js.map} +1 -1
  71. package/dist/beeq/p-951ba558.js +1 -64
  72. package/dist/beeq/p-951ba558.js.map +1 -1
  73. package/dist/beeq/p-95d0abdc.entry.js +6 -0
  74. package/dist/beeq/{p-12dbc6ac.entry.js.map → p-95d0abdc.entry.js.map} +1 -1
  75. package/dist/beeq/p-99829fc7.js +1 -8
  76. package/dist/beeq/p-99829fc7.js.map +1 -1
  77. package/dist/beeq/p-9da0e8d7.entry.js +6 -0
  78. package/dist/beeq/{p-37466506.entry.js.map → p-9da0e8d7.entry.js.map} +1 -1
  79. package/dist/beeq/p-a535a72f.entry.js +6 -0
  80. package/dist/beeq/{p-b48545b6.entry.js.map → p-a535a72f.entry.js.map} +1 -1
  81. package/dist/beeq/p-a5a17e6e.entry.js +6 -0
  82. package/dist/beeq/{p-f00abfb8.entry.js.map → p-a5a17e6e.entry.js.map} +1 -1
  83. package/dist/beeq/p-a5dc1c94.js +1 -118
  84. package/dist/beeq/p-a5dc1c94.js.map +1 -1
  85. package/dist/beeq/p-a8cad5ab.js +1 -5
  86. package/dist/beeq/p-a8cad5ab.js.map +1 -1
  87. package/dist/beeq/p-af062402.js +1 -7
  88. package/dist/beeq/p-af062402.js.map +1 -1
  89. package/dist/beeq/p-b2acd8f3.entry.js +6 -0
  90. package/dist/beeq/{p-900d4e78.entry.js.map → p-b2acd8f3.entry.js.map} +1 -1
  91. package/dist/beeq/p-b7f02fb6.entry.js +6 -0
  92. package/dist/beeq/{p-4a235cd2.entry.js.map → p-b7f02fb6.entry.js.map} +1 -1
  93. package/dist/beeq/p-b994054a.entry.js +6 -0
  94. package/dist/beeq/{p-04d98ed3.entry.js.map → p-b994054a.entry.js.map} +1 -1
  95. package/dist/beeq/p-be4941d0.entry.js +6 -0
  96. package/dist/beeq/{p-ae94b9f8.entry.js.map → p-be4941d0.entry.js.map} +1 -1
  97. package/dist/beeq/p-d5992d3d.entry.js +6 -0
  98. package/dist/beeq/{p-41033fe6.entry.js.map → p-d5992d3d.entry.js.map} +1 -1
  99. package/dist/beeq/p-d7a88b16.js +1 -87
  100. package/dist/beeq/p-d7a88b16.js.map +1 -1
  101. package/dist/beeq/p-dd206dba.entry.js +6 -0
  102. package/dist/beeq/{p-2ef721e1.entry.js.map → p-dd206dba.entry.js.map} +1 -1
  103. package/dist/beeq/p-ded1aed2.entry.js +6 -0
  104. package/dist/beeq/{p-4a3d8532.entry.js.map → p-ded1aed2.entry.js.map} +1 -1
  105. package/dist/beeq/p-e08d9b52.entry.js +6 -0
  106. package/dist/beeq/p-e08d9b52.entry.js.map +1 -0
  107. package/dist/beeq/p-e572b038.entry.js +6 -0
  108. package/dist/beeq/{p-4eccc020.entry.js.map → p-e572b038.entry.js.map} +1 -1
  109. package/dist/beeq/p-e5afdf8c.js +1 -82
  110. package/dist/beeq/p-e5afdf8c.js.map +1 -1
  111. package/dist/beeq/p-e7ede06e.entry.js +6 -0
  112. package/dist/beeq/{p-e7d75b87.entry.js.map → p-e7ede06e.entry.js.map} +1 -1
  113. package/dist/beeq/p-ecd27cf2.js +1 -11
  114. package/dist/beeq/p-ecd27cf2.js.map +1 -1
  115. package/dist/beeq/p-f7a0a316.entry.js +6 -0
  116. package/dist/beeq/{p-4dd962a7.entry.js.map → p-f7a0a316.entry.js.map} +1 -1
  117. package/dist/beeq/p-fbf6b04b.entry.js +6 -0
  118. package/dist/beeq/{p-4fc098bb.entry.js.map → p-fbf6b04b.entry.js.map} +1 -1
  119. package/dist/cjs/beeq.cjs.js +1 -1
  120. package/dist/cjs/bq-accordion-group.cjs.entry.js +1 -1
  121. package/dist/cjs/bq-accordion.cjs.entry.js +1 -1
  122. package/dist/cjs/bq-alert.cjs.entry.js +1 -1
  123. package/dist/cjs/bq-avatar.cjs.entry.js +1 -1
  124. package/dist/cjs/bq-badge.cjs.entry.js +2 -2
  125. package/dist/cjs/bq-breadcrumb-item.cjs.entry.js +1 -1
  126. package/dist/cjs/bq-breadcrumb.cjs.entry.js +1 -1
  127. package/dist/cjs/bq-button_2.cjs.entry.js +4 -2
  128. package/dist/cjs/bq-button_2.cjs.entry.js.map +1 -1
  129. package/dist/cjs/bq-card.cjs.entry.js +1 -1
  130. package/dist/cjs/bq-checkbox.cjs.entry.js +1 -1
  131. package/dist/cjs/bq-date-picker.cjs.entry.js +2 -2
  132. package/dist/cjs/bq-dialog.cjs.entry.js +1 -1
  133. package/dist/cjs/bq-divider.cjs.entry.js +2 -2
  134. package/dist/cjs/bq-drawer.cjs.entry.js +2 -2
  135. package/dist/cjs/bq-dropdown_2.cjs.entry.js +1 -1
  136. package/dist/cjs/bq-empty-state.cjs.entry.js +1 -1
  137. package/dist/cjs/bq-input.cjs.entry.js +1 -1
  138. package/dist/cjs/bq-notification.cjs.entry.js +4 -4
  139. package/dist/cjs/bq-notification.cjs.entry.js.map +1 -1
  140. package/dist/cjs/bq-option-group.cjs.entry.js +1 -1
  141. package/dist/cjs/bq-option-list_2.cjs.entry.js +3 -3
  142. package/dist/cjs/bq-option.cjs.entry.js +1 -1
  143. package/dist/cjs/bq-page-title.cjs.entry.js +1 -1
  144. package/dist/cjs/bq-progress.cjs.entry.js +1 -1
  145. package/dist/cjs/bq-radio-group.cjs.entry.js +1 -1
  146. package/dist/cjs/bq-radio.cjs.entry.js +1 -1
  147. package/dist/cjs/bq-select.cjs.entry.js +2 -2
  148. package/dist/cjs/bq-side-menu-item.cjs.entry.js +1 -1
  149. package/dist/cjs/bq-side-menu.cjs.entry.js +1 -1
  150. package/dist/cjs/bq-slider.cjs.entry.js +1 -1
  151. package/dist/cjs/bq-spinner.cjs.entry.js +2 -2
  152. package/dist/cjs/bq-status.cjs.entry.js +1 -1
  153. package/dist/cjs/bq-step-item.cjs.entry.js +1 -1
  154. package/dist/cjs/bq-steps.cjs.entry.js +1 -1
  155. package/dist/cjs/bq-switch.cjs.entry.js +1 -1
  156. package/dist/cjs/bq-tab-group.cjs.entry.js +1 -1
  157. package/dist/cjs/bq-tab.cjs.entry.js +1 -1
  158. package/dist/cjs/bq-textarea.cjs.entry.js +1 -1
  159. package/dist/cjs/bq-toast.cjs.entry.js +3 -3
  160. package/dist/cjs/bq-toast.cjs.entry.js.map +1 -1
  161. package/dist/cjs/bq-tooltip.cjs.entry.js +1 -1
  162. package/dist/cjs/{cssVariables-7139f0c6.js → cssVariables-a0e1e906.js} +3 -1
  163. package/dist/cjs/cssVariables-a0e1e906.js.map +1 -0
  164. package/dist/cjs/{index-1d3aac65.js → index-e6d59dbb.js} +2 -20
  165. package/dist/cjs/index-e6d59dbb.js.map +1 -0
  166. package/dist/cjs/index.cjs.js +1 -1
  167. package/dist/cjs/loader.cjs.js +1 -1
  168. package/dist/collection/components/date-picker/scss/bq-date-picker.css +1 -1
  169. package/dist/collection/components/drawer/scss/bq-drawer.css +1 -1
  170. package/dist/collection/components/icon/helper/request.js +2 -0
  171. package/dist/collection/components/icon/helper/request.js.map +1 -1
  172. package/dist/collection/components/notification/bq-notification.js +3 -3
  173. package/dist/collection/components/notification/bq-notification.js.map +1 -1
  174. package/dist/collection/components/select/scss/bq-select.css +1 -1
  175. package/dist/collection/components/tag/scss/bq-tag.css +1 -1
  176. package/dist/collection/components/toast/bq-toast.js +2 -2
  177. package/dist/collection/components/toast/bq-toast.js.map +1 -1
  178. package/dist/collection/shared/utils/cssVariables.js +2 -0
  179. package/dist/collection/shared/utils/cssVariables.js.map +1 -1
  180. package/dist/components/bq-date-picker.js +1 -1
  181. package/dist/components/bq-drawer.js +1 -1
  182. package/dist/components/bq-icon2.js +2 -0
  183. package/dist/components/bq-icon2.js.map +1 -1
  184. package/dist/components/bq-notification.js +3 -3
  185. package/dist/components/bq-notification.js.map +1 -1
  186. package/dist/components/bq-select.js +1 -1
  187. package/dist/components/bq-tag2.js +1 -1
  188. package/dist/components/bq-toast.js +2 -2
  189. package/dist/components/bq-toast.js.map +1 -1
  190. package/dist/components/cssVariables.js +2 -0
  191. package/dist/components/cssVariables.js.map +1 -1
  192. package/dist/esm/beeq.js +2 -2
  193. package/dist/esm/bq-accordion-group.entry.js +1 -1
  194. package/dist/esm/bq-accordion.entry.js +1 -1
  195. package/dist/esm/bq-alert.entry.js +1 -1
  196. package/dist/esm/bq-avatar.entry.js +1 -1
  197. package/dist/esm/bq-badge.entry.js +2 -2
  198. package/dist/esm/bq-breadcrumb-item.entry.js +1 -1
  199. package/dist/esm/bq-breadcrumb.entry.js +1 -1
  200. package/dist/esm/bq-button_2.entry.js +4 -2
  201. package/dist/esm/bq-button_2.entry.js.map +1 -1
  202. package/dist/esm/bq-card.entry.js +1 -1
  203. package/dist/esm/bq-checkbox.entry.js +1 -1
  204. package/dist/esm/bq-date-picker.entry.js +2 -2
  205. package/dist/esm/bq-dialog.entry.js +1 -1
  206. package/dist/esm/bq-divider.entry.js +2 -2
  207. package/dist/esm/bq-drawer.entry.js +2 -2
  208. package/dist/esm/bq-dropdown_2.entry.js +1 -1
  209. package/dist/esm/bq-empty-state.entry.js +1 -1
  210. package/dist/esm/bq-input.entry.js +1 -1
  211. package/dist/esm/bq-notification.entry.js +4 -4
  212. package/dist/esm/bq-notification.entry.js.map +1 -1
  213. package/dist/esm/bq-option-group.entry.js +1 -1
  214. package/dist/esm/bq-option-list_2.entry.js +3 -3
  215. package/dist/esm/bq-option.entry.js +1 -1
  216. package/dist/esm/bq-page-title.entry.js +1 -1
  217. package/dist/esm/bq-progress.entry.js +1 -1
  218. package/dist/esm/bq-radio-group.entry.js +1 -1
  219. package/dist/esm/bq-radio.entry.js +1 -1
  220. package/dist/esm/bq-select.entry.js +2 -2
  221. package/dist/esm/bq-side-menu-item.entry.js +1 -1
  222. package/dist/esm/bq-side-menu.entry.js +1 -1
  223. package/dist/esm/bq-slider.entry.js +1 -1
  224. package/dist/esm/bq-spinner.entry.js +2 -2
  225. package/dist/esm/bq-status.entry.js +1 -1
  226. package/dist/esm/bq-step-item.entry.js +1 -1
  227. package/dist/esm/bq-steps.entry.js +1 -1
  228. package/dist/esm/bq-switch.entry.js +1 -1
  229. package/dist/esm/bq-tab-group.entry.js +1 -1
  230. package/dist/esm/bq-tab.entry.js +1 -1
  231. package/dist/esm/bq-textarea.entry.js +1 -1
  232. package/dist/esm/bq-toast.entry.js +3 -3
  233. package/dist/esm/bq-toast.entry.js.map +1 -1
  234. package/dist/esm/bq-tooltip.entry.js +1 -1
  235. package/dist/esm/{cssVariables-5ffccc29.js → cssVariables-23e3ca0d.js} +3 -1
  236. package/dist/esm/cssVariables-23e3ca0d.js.map +1 -0
  237. package/dist/esm/{index-f69556fe.js → index-efc1c2ef.js} +2 -20
  238. package/dist/esm/index-efc1c2ef.js.map +1 -0
  239. package/dist/esm/index.js +1 -1
  240. package/dist/esm/loader.js +2 -2
  241. package/dist/hydrate/index.js +13 -9
  242. package/dist/hydrate/index.mjs +13 -9
  243. package/dist/types/shared/utils/cssVariables.d.ts +1 -1
  244. package/package.json +1 -1
  245. package/dist/beeq/p-026222c6.entry.js +0 -309
  246. package/dist/beeq/p-04d98ed3.entry.js +0 -257
  247. package/dist/beeq/p-05685544.entry.js +0 -121
  248. package/dist/beeq/p-0ab0b58d.js +0 -30
  249. package/dist/beeq/p-0ab0b58d.js.map +0 -1
  250. package/dist/beeq/p-0c42c08a.js +0 -1811
  251. package/dist/beeq/p-0c42c08a.js.map +0 -1
  252. package/dist/beeq/p-0ebe73ef.entry.js +0 -149
  253. package/dist/beeq/p-11eaeb5d.entry.js +0 -330
  254. package/dist/beeq/p-12dbc6ac.entry.js +0 -87
  255. package/dist/beeq/p-19df76ba.entry.js +0 -220
  256. package/dist/beeq/p-2ef721e1.entry.js +0 -261
  257. package/dist/beeq/p-37466506.entry.js +0 -103
  258. package/dist/beeq/p-377c70d1.entry.js +0 -173
  259. package/dist/beeq/p-3dd0e436.entry.js +0 -130
  260. package/dist/beeq/p-41033fe6.entry.js +0 -84
  261. package/dist/beeq/p-43e4fcdb.entry.js +0 -173
  262. package/dist/beeq/p-4a235cd2.entry.js +0 -258
  263. package/dist/beeq/p-4a3d8532.entry.js +0 -205
  264. package/dist/beeq/p-4dd962a7.entry.js +0 -104
  265. package/dist/beeq/p-4eccc020.entry.js +0 -203
  266. package/dist/beeq/p-4fc098bb.entry.js +0 -90
  267. package/dist/beeq/p-5eab4f55.entry.js +0 -117
  268. package/dist/beeq/p-600e7c38.entry.js +0 -102
  269. package/dist/beeq/p-7089c66a.entry.js +0 -156
  270. package/dist/beeq/p-734853f9.entry.js +0 -259
  271. package/dist/beeq/p-7774eec3.entry.js +0 -135
  272. package/dist/beeq/p-7b9ff03f.entry.js +0 -437
  273. package/dist/beeq/p-7c06dfec.entry.js +0 -204
  274. package/dist/beeq/p-900d4e78.entry.js +0 -102
  275. package/dist/beeq/p-911e07b7.entry.js +0 -513
  276. package/dist/beeq/p-924ebf7d.entry.js +0 -394
  277. package/dist/beeq/p-9aa18e2f.entry.js +0 -303
  278. package/dist/beeq/p-ae94b9f8.entry.js +0 -144
  279. package/dist/beeq/p-b38e8c5a.entry.js +0 -208
  280. package/dist/beeq/p-b4278945.entry.js +0 -195
  281. package/dist/beeq/p-b48545b6.entry.js +0 -248
  282. package/dist/beeq/p-c907de72.entry.js +0 -145
  283. package/dist/beeq/p-ceb3bb9a.entry.js +0 -187
  284. package/dist/beeq/p-d3008f60.entry.js +0 -279
  285. package/dist/beeq/p-d3008f60.entry.js.map +0 -1
  286. package/dist/beeq/p-e7d75b87.entry.js +0 -144
  287. package/dist/beeq/p-f00abfb8.entry.js +0 -145
  288. package/dist/beeq/p-f8663855.entry.js +0 -329
  289. package/dist/cjs/cssVariables-7139f0c6.js.map +0 -1
  290. package/dist/cjs/index-1d3aac65.js.map +0 -1
  291. package/dist/esm/cssVariables-5ffccc29.js.map +0 -1
  292. package/dist/esm/index-f69556fe.js.map +0 -1
@@ -2,1938 +2,5 @@
2
2
  * Built by Endavans
3
3
  * © https://beeq.design - Apache 2 License.
4
4
  */
5
- /**
6
- * Custom positioning reference element.
7
- * @see https://floating-ui.com/docs/virtual-elements
8
- */
9
- const t = [ "top", "right", "bottom", "left" ];
10
-
11
- const e = [ "start", "end" ];
12
-
13
- const n = t.reduce(((t, n) => t.concat(n, n + "-" + e[0], n + "-" + e[1])), []);
14
-
15
- const o = Math.min;
16
-
17
- const i = Math.max;
18
-
19
- const s = Math.round;
20
-
21
- const c = Math.floor;
22
-
23
- const createCoords = t => ({
24
- x: t,
25
- y: t
26
- });
27
-
28
- const r = {
29
- left: "right",
30
- right: "left",
31
- bottom: "top",
32
- top: "bottom"
33
- };
34
-
35
- const l = {
36
- start: "end",
37
- end: "start"
38
- };
39
-
40
- function clamp(t, e, n) {
41
- return i(t, o(e, n));
42
- }
43
-
44
- function evaluate(t, e) {
45
- return typeof t === "function" ? t(e) : t;
46
- }
47
-
48
- function getSide(t) {
49
- return t.split("-")[0];
50
- }
51
-
52
- function getAlignment(t) {
53
- return t.split("-")[1];
54
- }
55
-
56
- function getOppositeAxis(t) {
57
- return t === "x" ? "y" : "x";
58
- }
59
-
60
- function getAxisLength(t) {
61
- return t === "y" ? "height" : "width";
62
- }
63
-
64
- function getSideAxis(t) {
65
- return [ "top", "bottom" ].includes(getSide(t)) ? "y" : "x";
66
- }
67
-
68
- function getAlignmentAxis(t) {
69
- return getOppositeAxis(getSideAxis(t));
70
- }
71
-
72
- function getAlignmentSides(t, e, n) {
73
- if (n === void 0) {
74
- n = false;
75
- }
76
- const o = getAlignment(t);
77
- const i = getAlignmentAxis(t);
78
- const s = getAxisLength(i);
79
- let c = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
80
- if (e.reference[s] > e.floating[s]) {
81
- c = getOppositePlacement(c);
82
- }
83
- return [ c, getOppositePlacement(c) ];
84
- }
85
-
86
- function getExpandedPlacements(t) {
87
- const e = getOppositePlacement(t);
88
- return [ getOppositeAlignmentPlacement(t), e, getOppositeAlignmentPlacement(e) ];
89
- }
90
-
91
- function getOppositeAlignmentPlacement(t) {
92
- return t.replace(/start|end/g, (t => l[t]));
93
- }
94
-
95
- function getSideList(t, e, n) {
96
- const o = [ "left", "right" ];
97
- const i = [ "right", "left" ];
98
- const s = [ "top", "bottom" ];
99
- const c = [ "bottom", "top" ];
100
- switch (t) {
101
- case "top":
102
- case "bottom":
103
- if (n) return e ? i : o;
104
- return e ? o : i;
105
-
106
- case "left":
107
- case "right":
108
- return e ? s : c;
109
-
110
- default:
111
- return [];
112
- }
113
- }
114
-
115
- function getOppositeAxisPlacements(t, e, n, o) {
116
- const i = getAlignment(t);
117
- let s = getSideList(getSide(t), n === "start", o);
118
- if (i) {
119
- s = s.map((t => t + "-" + i));
120
- if (e) {
121
- s = s.concat(s.map(getOppositeAlignmentPlacement));
122
- }
123
- }
124
- return s;
125
- }
126
-
127
- function getOppositePlacement(t) {
128
- return t.replace(/left|right|bottom|top/g, (t => r[t]));
129
- }
130
-
131
- function expandPaddingObject(t) {
132
- return {
133
- top: 0,
134
- right: 0,
135
- bottom: 0,
136
- left: 0,
137
- ...t
138
- };
139
- }
140
-
141
- function getPaddingObject(t) {
142
- return typeof t !== "number" ? expandPaddingObject(t) : {
143
- top: t,
144
- right: t,
145
- bottom: t,
146
- left: t
147
- };
148
- }
149
-
150
- function rectToClientRect(t) {
151
- const {x: e, y: n, width: o, height: i} = t;
152
- return {
153
- width: o,
154
- height: i,
155
- top: n,
156
- left: e,
157
- right: e + o,
158
- bottom: n + i,
159
- x: e,
160
- y: n
161
- };
162
- }
163
-
164
- function computeCoordsFromPlacement(t, e, n) {
165
- let {reference: o, floating: i} = t;
166
- const s = getSideAxis(e);
167
- const c = getAlignmentAxis(e);
168
- const r = getAxisLength(c);
169
- const l = getSide(e);
170
- const a = s === "y";
171
- const f = o.x + o.width / 2 - i.width / 2;
172
- const u = o.y + o.height / 2 - i.height / 2;
173
- const g = o[r] / 2 - i[r] / 2;
174
- let d;
175
- switch (l) {
176
- case "top":
177
- d = {
178
- x: f,
179
- y: o.y - i.height
180
- };
181
- break;
182
-
183
- case "bottom":
184
- d = {
185
- x: f,
186
- y: o.y + o.height
187
- };
188
- break;
189
-
190
- case "right":
191
- d = {
192
- x: o.x + o.width,
193
- y: u
194
- };
195
- break;
196
-
197
- case "left":
198
- d = {
199
- x: o.x - i.width,
200
- y: u
201
- };
202
- break;
203
-
204
- default:
205
- d = {
206
- x: o.x,
207
- y: o.y
208
- };
209
- }
210
- switch (getAlignment(e)) {
211
- case "start":
212
- d[c] -= g * (n && a ? -1 : 1);
213
- break;
214
-
215
- case "end":
216
- d[c] += g * (n && a ? -1 : 1);
217
- break;
218
- }
219
- return d;
220
- }
221
-
222
- /**
223
- * Computes the `x` and `y` coordinates that will place the floating element
224
- * next to a given reference element.
225
- *
226
- * This export does not have any `platform` interface logic. You will need to
227
- * write one for the platform you are using Floating UI with.
228
- */ const computePosition$1 = async (t, e, n) => {
229
- const {placement: o = "bottom", strategy: i = "absolute", middleware: s = [], platform: c} = n;
230
- const r = s.filter(Boolean);
231
- const l = await (c.isRTL == null ? void 0 : c.isRTL(e));
232
- let a = await c.getElementRects({
233
- reference: t,
234
- floating: e,
235
- strategy: i
236
- });
237
- let {x: f, y: u} = computeCoordsFromPlacement(a, o, l);
238
- let g = o;
239
- let d = {};
240
- let m = 0;
241
- for (let n = 0; n < r.length; n++) {
242
- const {name: s, fn: p} = r[n];
243
- const {x: h, y: w, data: y, reset: v} = await p({
244
- x: f,
245
- y: u,
246
- initialPlacement: o,
247
- placement: g,
248
- strategy: i,
249
- middlewareData: d,
250
- rects: a,
251
- platform: c,
252
- elements: {
253
- reference: t,
254
- floating: e
255
- }
256
- });
257
- f = h != null ? h : f;
258
- u = w != null ? w : u;
259
- d = {
260
- ...d,
261
- [s]: {
262
- ...d[s],
263
- ...y
264
- }
265
- };
266
- if (v && m <= 50) {
267
- m++;
268
- if (typeof v === "object") {
269
- if (v.placement) {
270
- g = v.placement;
271
- }
272
- if (v.rects) {
273
- a = v.rects === true ? await c.getElementRects({
274
- reference: t,
275
- floating: e,
276
- strategy: i
277
- }) : v.rects;
278
- }
279
- ({x: f, y: u} = computeCoordsFromPlacement(a, g, l));
280
- }
281
- n = -1;
282
- }
283
- }
284
- return {
285
- x: f,
286
- y: u,
287
- placement: g,
288
- strategy: i,
289
- middlewareData: d
290
- };
291
- };
292
-
293
- /**
294
- * Resolves with an object of overflow side offsets that determine how much the
295
- * element is overflowing a given clipping boundary on each side.
296
- * - positive = overflowing the boundary by that number of pixels
297
- * - negative = how many pixels left before it will overflow
298
- * - 0 = lies flush with the boundary
299
- * @see https://floating-ui.com/docs/detectOverflow
300
- */ async function detectOverflow(t, e) {
301
- var n;
302
- if (e === void 0) {
303
- e = {};
304
- }
305
- const {x: o, y: i, platform: s, rects: c, elements: r, strategy: l} = t;
306
- const {boundary: a = "clippingAncestors", rootBoundary: f = "viewport", elementContext: u = "floating", altBoundary: g = false, padding: d = 0} = evaluate(e, t);
307
- const m = getPaddingObject(d);
308
- const p = u === "floating" ? "reference" : "floating";
309
- const h = r[g ? p : u];
310
- const w = rectToClientRect(await s.getClippingRect({
311
- element: ((n = await (s.isElement == null ? void 0 : s.isElement(h))) != null ? n : true) ? h : h.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(r.floating)),
312
- boundary: a,
313
- rootBoundary: f,
314
- strategy: l
315
- }));
316
- const y = u === "floating" ? {
317
- x: o,
318
- y: i,
319
- width: c.floating.width,
320
- height: c.floating.height
321
- } : c.reference;
322
- const v = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(r.floating));
323
- const x = await (s.isElement == null ? void 0 : s.isElement(v)) ? await (s.getScale == null ? void 0 : s.getScale(v)) || {
324
- x: 1,
325
- y: 1
326
- } : {
327
- x: 1,
328
- y: 1
329
- };
330
- const A = rectToClientRect(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
331
- elements: r,
332
- rect: y,
333
- offsetParent: v,
334
- strategy: l
335
- }) : y);
336
- return {
337
- top: (w.top - A.top + m.top) / x.y,
338
- bottom: (A.bottom - w.bottom + m.bottom) / x.y,
339
- left: (w.left - A.left + m.left) / x.x,
340
- right: (A.right - w.right + m.right) / x.x
341
- };
342
- }
343
-
344
- /**
345
- * Provides data to position an inner element of the floating element so that it
346
- * appears centered to the reference element.
347
- * @see https://floating-ui.com/docs/arrow
348
- */ const arrow$1 = t => ({
349
- name: "arrow",
350
- options: t,
351
- async fn(e) {
352
- const {x: n, y: i, placement: s, rects: c, platform: r, elements: l, middlewareData: a} = e;
353
- // Since `element` is required, we don't Partial<> the type.
354
- const {element: f, padding: u = 0} = evaluate(t, e) || {};
355
- if (f == null) {
356
- return {};
357
- }
358
- const g = getPaddingObject(u);
359
- const d = {
360
- x: n,
361
- y: i
362
- };
363
- const m = getAlignmentAxis(s);
364
- const p = getAxisLength(m);
365
- const h = await r.getDimensions(f);
366
- const w = m === "y";
367
- const y = w ? "top" : "left";
368
- const v = w ? "bottom" : "right";
369
- const x = w ? "clientHeight" : "clientWidth";
370
- const A = c.reference[p] + c.reference[m] - d[m] - c.floating[p];
371
- const b = d[m] - c.reference[m];
372
- const O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(f));
373
- let S = O ? O[x] : 0;
374
- // DOM platform can return `window` as the `offsetParent`.
375
- if (!S || !await (r.isElement == null ? void 0 : r.isElement(O))) {
376
- S = l.floating[x] || c.floating[p];
377
- }
378
- const C = A / 2 - b / 2;
379
- // If the padding is large enough that it causes the arrow to no longer be
380
- // centered, modify the padding so that it is centered.
381
- const R = S / 2 - h[p] / 2 - 1;
382
- const P = o(g[y], R);
383
- const E = o(g[v], R);
384
- // Make sure the arrow doesn't overflow the floating element if the center
385
- // point is outside the floating element's bounds.
386
- const T = P;
387
- const L = S - h[p] - E;
388
- const N = S / 2 - h[p] / 2 + C;
389
- const B = clamp(T, N, L);
390
- // If the reference is small enough that the arrow's padding causes it to
391
- // to point to nothing for an aligned placement, adjust the offset of the
392
- // floating element itself. To ensure `shift()` continues to take action,
393
- // a single reset is performed when this is true.
394
- const D = !a.arrow && getAlignment(s) != null && N !== B && c.reference[p] / 2 - (N < T ? P : E) - h[p] / 2 < 0;
395
- const F = D ? N < T ? N - T : N - L : 0;
396
- return {
397
- [m]: d[m] + F,
398
- data: {
399
- [m]: B,
400
- centerOffset: N - B - F,
401
- ...D && {
402
- alignmentOffset: F
403
- }
404
- },
405
- reset: D
406
- };
407
- }
408
- });
409
-
410
- function getPlacementList(t, e, n) {
411
- const o = t ? [ ...n.filter((e => getAlignment(e) === t)), ...n.filter((e => getAlignment(e) !== t)) ] : n.filter((t => getSide(t) === t));
412
- return o.filter((n => {
413
- if (t) {
414
- return getAlignment(n) === t || (e ? getOppositeAlignmentPlacement(n) !== n : false);
415
- }
416
- return true;
417
- }));
418
- }
419
-
420
- /**
421
- * Optimizes the visibility of the floating element by choosing the placement
422
- * that has the most space available automatically, without needing to specify a
423
- * preferred placement. Alternative to `flip`.
424
- * @see https://floating-ui.com/docs/autoPlacement
425
- */ const autoPlacement = function(t) {
426
- if (t === void 0) {
427
- t = {};
428
- }
429
- return {
430
- name: "autoPlacement",
431
- options: t,
432
- async fn(e) {
433
- var o, i, s;
434
- const {rects: c, middlewareData: r, placement: l, platform: a, elements: f} = e;
435
- const {crossAxis: u = false, alignment: g, allowedPlacements: d = n, autoAlignment: m = true, ...p} = evaluate(t, e);
436
- const h = g !== undefined || d === n ? getPlacementList(g || null, m, d) : d;
437
- const w = await detectOverflow(e, p);
438
- const y = ((o = r.autoPlacement) == null ? void 0 : o.index) || 0;
439
- const v = h[y];
440
- if (v == null) {
441
- return {};
442
- }
443
- const x = getAlignmentSides(v, c, await (a.isRTL == null ? void 0 : a.isRTL(f.floating)));
444
- // Make `computeCoords` start from the right place.
445
- if (l !== v) {
446
- return {
447
- reset: {
448
- placement: h[0]
449
- }
450
- };
451
- }
452
- const A = [ w[getSide(v)], w[x[0]], w[x[1]] ];
453
- const b = [ ...((i = r.autoPlacement) == null ? void 0 : i.overflows) || [], {
454
- placement: v,
455
- overflows: A
456
- } ];
457
- const O = h[y + 1];
458
- // There are more placements to check.
459
- if (O) {
460
- return {
461
- data: {
462
- index: y + 1,
463
- overflows: b
464
- },
465
- reset: {
466
- placement: O
467
- }
468
- };
469
- }
470
- const S = b.map((t => {
471
- const e = getAlignment(t.placement);
472
- return [ t.placement, e && u ?
473
- // Check along the mainAxis and main crossAxis side.
474
- t.overflows.slice(0, 2).reduce(((t, e) => t + e), 0) :
475
- // Check only the mainAxis.
476
- t.overflows[0], t.overflows ];
477
- })).sort(((t, e) => t[1] - e[1]));
478
- const C = S.filter((t => t[2].slice(0,
479
- // Aligned placements should not check their opposite crossAxis
480
- // side.
481
- getAlignment(t[0]) ? 2 : 3).every((t => t <= 0))));
482
- const R = ((s = C[0]) == null ? void 0 : s[0]) || S[0][0];
483
- if (R !== l) {
484
- return {
485
- data: {
486
- index: y + 1,
487
- overflows: b
488
- },
489
- reset: {
490
- placement: R
491
- }
492
- };
493
- }
494
- return {};
495
- }
496
- };
497
- };
498
-
499
- /**
500
- * Optimizes the visibility of the floating element by flipping the `placement`
501
- * in order to keep it in view when the preferred placement(s) will overflow the
502
- * clipping boundary. Alternative to `autoPlacement`.
503
- * @see https://floating-ui.com/docs/flip
504
- */ const flip$1 = function(t) {
505
- if (t === void 0) {
506
- t = {};
507
- }
508
- return {
509
- name: "flip",
510
- options: t,
511
- async fn(e) {
512
- var n, o;
513
- const {placement: i, middlewareData: s, rects: c, initialPlacement: r, platform: l, elements: a} = e;
514
- const {mainAxis: f = true, crossAxis: u = true, fallbackPlacements: g, fallbackStrategy: d = "bestFit", fallbackAxisSideDirection: m = "none", flipAlignment: p = true, ...h} = evaluate(t, e);
515
- // If a reset by the arrow was caused due to an alignment offset being
516
- // added, we should skip any logic now since `flip()` has already done its
517
- // work.
518
- // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
519
- if ((n = s.arrow) != null && n.alignmentOffset) {
520
- return {};
521
- }
522
- const w = getSide(i);
523
- const y = getSideAxis(r);
524
- const v = getSide(r) === r;
525
- const x = await (l.isRTL == null ? void 0 : l.isRTL(a.floating));
526
- const A = g || (v || !p ? [ getOppositePlacement(r) ] : getExpandedPlacements(r));
527
- const b = m !== "none";
528
- if (!g && b) {
529
- A.push(...getOppositeAxisPlacements(r, p, m, x));
530
- }
531
- const O = [ r, ...A ];
532
- const S = await detectOverflow(e, h);
533
- const C = [];
534
- let R = ((o = s.flip) == null ? void 0 : o.overflows) || [];
535
- if (f) {
536
- C.push(S[w]);
537
- }
538
- if (u) {
539
- const t = getAlignmentSides(i, c, x);
540
- C.push(S[t[0]], S[t[1]]);
541
- }
542
- R = [ ...R, {
543
- placement: i,
544
- overflows: C
545
- } ];
546
- // One or more sides is overflowing.
547
- if (!C.every((t => t <= 0))) {
548
- var P, E;
549
- const t = (((P = s.flip) == null ? void 0 : P.index) || 0) + 1;
550
- const e = O[t];
551
- if (e) {
552
- // Try next placement and re-run the lifecycle.
553
- return {
554
- data: {
555
- index: t,
556
- overflows: R
557
- },
558
- reset: {
559
- placement: e
560
- }
561
- };
562
- }
563
- // First, find the candidates that fit on the mainAxis side of overflow,
564
- // then find the placement that fits the best on the main crossAxis side.
565
- let n = (E = R.filter((t => t.overflows[0] <= 0)).sort(((t, e) => t.overflows[1] - e.overflows[1]))[0]) == null ? void 0 : E.placement;
566
- // Otherwise fallback.
567
- if (!n) {
568
- switch (d) {
569
- case "bestFit":
570
- {
571
- var T;
572
- const t = (T = R.filter((t => {
573
- if (b) {
574
- const e = getSideAxis(t.placement);
575
- return e === y ||
576
- // Create a bias to the `y` side axis due to horizontal
577
- // reading directions favoring greater width.
578
- e === "y";
579
- }
580
- return true;
581
- })).map((t => [ t.placement, t.overflows.filter((t => t > 0)).reduce(((t, e) => t + e), 0) ])).sort(((t, e) => t[1] - e[1]))[0]) == null ? void 0 : T[0];
582
- if (t) {
583
- n = t;
584
- }
585
- break;
586
- }
587
-
588
- case "initialPlacement":
589
- n = r;
590
- break;
591
- }
592
- }
593
- if (i !== n) {
594
- return {
595
- reset: {
596
- placement: n
597
- }
598
- };
599
- }
600
- }
601
- return {};
602
- }
603
- };
604
- };
605
-
606
- function getSideOffsets(t, e) {
607
- return {
608
- top: t.top - e.height,
609
- right: t.right - e.width,
610
- bottom: t.bottom - e.height,
611
- left: t.left - e.width
612
- };
613
- }
614
-
615
- function isAnySideFullyClipped(e) {
616
- return t.some((t => e[t] >= 0));
617
- }
618
-
619
- /**
620
- * Provides data to hide the floating element in applicable situations, such as
621
- * when it is not in the same clipping context as the reference element.
622
- * @see https://floating-ui.com/docs/hide
623
- */ const hide$1 = function(t) {
624
- if (t === void 0) {
625
- t = {};
626
- }
627
- return {
628
- name: "hide",
629
- options: t,
630
- async fn(e) {
631
- const {rects: n} = e;
632
- const {strategy: o = "referenceHidden", ...i} = evaluate(t, e);
633
- switch (o) {
634
- case "referenceHidden":
635
- {
636
- const t = await detectOverflow(e, {
637
- ...i,
638
- elementContext: "reference"
639
- });
640
- const o = getSideOffsets(t, n.reference);
641
- return {
642
- data: {
643
- referenceHiddenOffsets: o,
644
- referenceHidden: isAnySideFullyClipped(o)
645
- }
646
- };
647
- }
648
-
649
- case "escaped":
650
- {
651
- const t = await detectOverflow(e, {
652
- ...i,
653
- altBoundary: true
654
- });
655
- const o = getSideOffsets(t, n.floating);
656
- return {
657
- data: {
658
- escapedOffsets: o,
659
- escaped: isAnySideFullyClipped(o)
660
- }
661
- };
662
- }
663
-
664
- default:
665
- {
666
- return {};
667
- }
668
- }
669
- }
670
- };
671
- };
672
-
673
- function getBoundingRect(t) {
674
- const e = o(...t.map((t => t.left)));
675
- const n = o(...t.map((t => t.top)));
676
- const s = i(...t.map((t => t.right)));
677
- const c = i(...t.map((t => t.bottom)));
678
- return {
679
- x: e,
680
- y: n,
681
- width: s - e,
682
- height: c - n
683
- };
684
- }
685
-
686
- function getRectsByLine(t) {
687
- const e = t.slice().sort(((t, e) => t.y - e.y));
688
- const n = [];
689
- let o = null;
690
- for (let t = 0; t < e.length; t++) {
691
- const i = e[t];
692
- if (!o || i.y - o.y > o.height / 2) {
693
- n.push([ i ]);
694
- } else {
695
- n[n.length - 1].push(i);
696
- }
697
- o = i;
698
- }
699
- return n.map((t => rectToClientRect(getBoundingRect(t))));
700
- }
701
-
702
- /**
703
- * Provides improved positioning for inline reference elements that can span
704
- * over multiple lines, such as hyperlinks or range selections.
705
- * @see https://floating-ui.com/docs/inline
706
- */ const inline = function(t) {
707
- if (t === void 0) {
708
- t = {};
709
- }
710
- return {
711
- name: "inline",
712
- options: t,
713
- async fn(e) {
714
- const {placement: n, elements: s, rects: c, platform: r, strategy: l} = e;
715
- // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
716
- // ClientRect's bounds, despite the event listener being triggered. A
717
- // padding of 2 seems to handle this issue.
718
- const {padding: a = 2, x: f, y: u} = evaluate(t, e);
719
- const g = Array.from(await (r.getClientRects == null ? void 0 : r.getClientRects(s.reference)) || []);
720
- const d = getRectsByLine(g);
721
- const m = rectToClientRect(getBoundingRect(g));
722
- const p = getPaddingObject(a);
723
- function getBoundingClientRect() {
724
- // There are two rects and they are disjoined.
725
- if (d.length === 2 && d[0].left > d[1].right && f != null && u != null) {
726
- // Find the first rect in which the point is fully inside.
727
- return d.find((t => f > t.left - p.left && f < t.right + p.right && u > t.top - p.top && u < t.bottom + p.bottom)) || m;
728
- }
729
- // There are 2 or more connected rects.
730
- if (d.length >= 2) {
731
- if (getSideAxis(n) === "y") {
732
- const t = d[0];
733
- const e = d[d.length - 1];
734
- const o = getSide(n) === "top";
735
- const i = t.top;
736
- const s = e.bottom;
737
- const c = o ? t.left : e.left;
738
- const r = o ? t.right : e.right;
739
- const l = r - c;
740
- const a = s - i;
741
- return {
742
- top: i,
743
- bottom: s,
744
- left: c,
745
- right: r,
746
- width: l,
747
- height: a,
748
- x: c,
749
- y: i
750
- };
751
- }
752
- const t = getSide(n) === "left";
753
- const e = i(...d.map((t => t.right)));
754
- const s = o(...d.map((t => t.left)));
755
- const c = d.filter((n => t ? n.left === s : n.right === e));
756
- const r = c[0].top;
757
- const l = c[c.length - 1].bottom;
758
- const a = s;
759
- const f = e;
760
- const u = f - a;
761
- const g = l - r;
762
- return {
763
- top: r,
764
- bottom: l,
765
- left: a,
766
- right: f,
767
- width: u,
768
- height: g,
769
- x: a,
770
- y: r
771
- };
772
- }
773
- return m;
774
- }
775
- const h = await r.getElementRects({
776
- reference: {
777
- getBoundingClientRect
778
- },
779
- floating: s.floating,
780
- strategy: l
781
- });
782
- if (c.reference.x !== h.reference.x || c.reference.y !== h.reference.y || c.reference.width !== h.reference.width || c.reference.height !== h.reference.height) {
783
- return {
784
- reset: {
785
- rects: h
786
- }
787
- };
788
- }
789
- return {};
790
- }
791
- };
792
- };
793
-
794
- // For type backwards-compatibility, the `OffsetOptions` type was also
795
- // Derivable.
796
- async function convertValueToCoords(t, e) {
797
- const {placement: n, platform: o, elements: i} = t;
798
- const s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating));
799
- const c = getSide(n);
800
- const r = getAlignment(n);
801
- const l = getSideAxis(n) === "y";
802
- const a = [ "left", "top" ].includes(c) ? -1 : 1;
803
- const f = s && l ? -1 : 1;
804
- const u = evaluate(e, t);
805
- // eslint-disable-next-line prefer-const
806
- let {mainAxis: g, crossAxis: d, alignmentAxis: m} = typeof u === "number" ? {
807
- mainAxis: u,
808
- crossAxis: 0,
809
- alignmentAxis: null
810
- } : {
811
- mainAxis: 0,
812
- crossAxis: 0,
813
- alignmentAxis: null,
814
- ...u
815
- };
816
- if (r && typeof m === "number") {
817
- d = r === "end" ? m * -1 : m;
818
- }
819
- return l ? {
820
- x: d * f,
821
- y: g * a
822
- } : {
823
- x: g * a,
824
- y: d * f
825
- };
826
- }
827
-
828
- /**
829
- * Modifies the placement by translating the floating element along the
830
- * specified axes.
831
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
832
- * object may be passed.
833
- * @see https://floating-ui.com/docs/offset
834
- */ const offset$1 = function(t) {
835
- if (t === void 0) {
836
- t = 0;
837
- }
838
- return {
839
- name: "offset",
840
- options: t,
841
- async fn(e) {
842
- var n, o;
843
- const {x: i, y: s, placement: c, middlewareData: r} = e;
844
- const l = await convertValueToCoords(e, t);
845
- // If the placement is the same and the arrow caused an alignment offset
846
- // then we don't need to change the positioning coordinates.
847
- if (c === ((n = r.offset) == null ? void 0 : n.placement) && (o = r.arrow) != null && o.alignmentOffset) {
848
- return {};
849
- }
850
- return {
851
- x: i + l.x,
852
- y: s + l.y,
853
- data: {
854
- ...l,
855
- placement: c
856
- }
857
- };
858
- }
859
- };
860
- };
861
-
862
- /**
863
- * Optimizes the visibility of the floating element by shifting it in order to
864
- * keep it in view when it will overflow the clipping boundary.
865
- * @see https://floating-ui.com/docs/shift
866
- */ const shift$1 = function(t) {
867
- if (t === void 0) {
868
- t = {};
869
- }
870
- return {
871
- name: "shift",
872
- options: t,
873
- async fn(e) {
874
- const {x: n, y: o, placement: i} = e;
875
- const {mainAxis: s = true, crossAxis: c = false, limiter: r = {
876
- fn: t => {
877
- let {x: e, y: n} = t;
878
- return {
879
- x: e,
880
- y: n
881
- };
882
- }
883
- }, ...l} = evaluate(t, e);
884
- const a = {
885
- x: n,
886
- y: o
887
- };
888
- const f = await detectOverflow(e, l);
889
- const u = getSideAxis(getSide(i));
890
- const g = getOppositeAxis(u);
891
- let d = a[g];
892
- let m = a[u];
893
- if (s) {
894
- const t = g === "y" ? "top" : "left";
895
- const e = g === "y" ? "bottom" : "right";
896
- const n = d + f[t];
897
- const o = d - f[e];
898
- d = clamp(n, d, o);
899
- }
900
- if (c) {
901
- const t = u === "y" ? "top" : "left";
902
- const e = u === "y" ? "bottom" : "right";
903
- const n = m + f[t];
904
- const o = m - f[e];
905
- m = clamp(n, m, o);
906
- }
907
- const p = r.fn({
908
- ...e,
909
- [g]: d,
910
- [u]: m
911
- });
912
- return {
913
- ...p,
914
- data: {
915
- x: p.x - n,
916
- y: p.y - o
917
- }
918
- };
919
- }
920
- };
921
- };
922
-
923
- /**
924
- * Built-in `limiter` that will stop `shift()` at a certain point.
925
- */ const limitShift = function(t) {
926
- if (t === void 0) {
927
- t = {};
928
- }
929
- return {
930
- options: t,
931
- fn(e) {
932
- const {x: n, y: o, placement: i, rects: s, middlewareData: c} = e;
933
- const {offset: r = 0, mainAxis: l = true, crossAxis: a = true} = evaluate(t, e);
934
- const f = {
935
- x: n,
936
- y: o
937
- };
938
- const u = getSideAxis(i);
939
- const g = getOppositeAxis(u);
940
- let d = f[g];
941
- let m = f[u];
942
- const p = evaluate(r, e);
943
- const h = typeof p === "number" ? {
944
- mainAxis: p,
945
- crossAxis: 0
946
- } : {
947
- mainAxis: 0,
948
- crossAxis: 0,
949
- ...p
950
- };
951
- if (l) {
952
- const t = g === "y" ? "height" : "width";
953
- const e = s.reference[g] - s.floating[t] + h.mainAxis;
954
- const n = s.reference[g] + s.reference[t] - h.mainAxis;
955
- if (d < e) {
956
- d = e;
957
- } else if (d > n) {
958
- d = n;
959
- }
960
- }
961
- if (a) {
962
- var w, y;
963
- const t = g === "y" ? "width" : "height";
964
- const e = [ "top", "left" ].includes(getSide(i));
965
- const n = s.reference[u] - s.floating[t] + (e ? ((w = c.offset) == null ? void 0 : w[u]) || 0 : 0) + (e ? 0 : h.crossAxis);
966
- const o = s.reference[u] + s.reference[t] + (e ? 0 : ((y = c.offset) == null ? void 0 : y[u]) || 0) - (e ? h.crossAxis : 0);
967
- if (m < n) {
968
- m = n;
969
- } else if (m > o) {
970
- m = o;
971
- }
972
- }
973
- return {
974
- [g]: d,
975
- [u]: m
976
- };
977
- }
978
- };
979
- };
980
-
981
- /**
982
- * Provides data that allows you to change the size of the floating element —
983
- * for instance, prevent it from overflowing the clipping boundary or match the
984
- * width of the reference element.
985
- * @see https://floating-ui.com/docs/size
986
- */ const size$1 = function(t) {
987
- if (t === void 0) {
988
- t = {};
989
- }
990
- return {
991
- name: "size",
992
- options: t,
993
- async fn(e) {
994
- const {placement: n, rects: s, platform: c, elements: r} = e;
995
- const {apply: l = (() => {}), ...a} = evaluate(t, e);
996
- const f = await detectOverflow(e, a);
997
- const u = getSide(n);
998
- const g = getAlignment(n);
999
- const d = getSideAxis(n) === "y";
1000
- const {width: m, height: p} = s.floating;
1001
- let h;
1002
- let w;
1003
- if (u === "top" || u === "bottom") {
1004
- h = u;
1005
- w = g === (await (c.isRTL == null ? void 0 : c.isRTL(r.floating)) ? "start" : "end") ? "left" : "right";
1006
- } else {
1007
- w = u;
1008
- h = g === "end" ? "top" : "bottom";
1009
- }
1010
- const y = p - f.top - f.bottom;
1011
- const v = m - f.left - f.right;
1012
- const x = o(p - f[h], y);
1013
- const A = o(m - f[w], v);
1014
- const b = !e.middlewareData.shift;
1015
- let O = x;
1016
- let S = A;
1017
- if (d) {
1018
- S = g || b ? o(A, v) : v;
1019
- } else {
1020
- O = g || b ? o(x, y) : y;
1021
- }
1022
- if (b && !g) {
1023
- const t = i(f.left, 0);
1024
- const e = i(f.right, 0);
1025
- const n = i(f.top, 0);
1026
- const o = i(f.bottom, 0);
1027
- if (d) {
1028
- S = m - 2 * (t !== 0 || e !== 0 ? t + e : i(f.left, f.right));
1029
- } else {
1030
- O = p - 2 * (n !== 0 || o !== 0 ? n + o : i(f.top, f.bottom));
1031
- }
1032
- }
1033
- await l({
1034
- ...e,
1035
- availableWidth: S,
1036
- availableHeight: O
1037
- });
1038
- const C = await c.getDimensions(r.floating);
1039
- if (m !== C.width || p !== C.height) {
1040
- return {
1041
- reset: {
1042
- rects: true
1043
- }
1044
- };
1045
- }
1046
- return {};
1047
- }
1048
- };
1049
- };
1050
-
1051
- function getNodeName(t) {
1052
- if (isNode(t)) {
1053
- return (t.nodeName || "").toLowerCase();
1054
- }
1055
- // Mocked nodes in testing environments may not be instances of Node. By
1056
- // returning `#document` an infinite loop won't occur.
1057
- // https://github.com/floating-ui/floating-ui/issues/2317
1058
- return "#document";
1059
- }
1060
-
1061
- function getWindow(t) {
1062
- var e;
1063
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
1064
- }
1065
-
1066
- function getDocumentElement(t) {
1067
- var e;
1068
- return (e = (isNode(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
1069
- }
1070
-
1071
- function isNode(t) {
1072
- return t instanceof Node || t instanceof getWindow(t).Node;
1073
- }
1074
-
1075
- function isElement(t) {
1076
- return t instanceof Element || t instanceof getWindow(t).Element;
1077
- }
1078
-
1079
- function isHTMLElement(t) {
1080
- return t instanceof HTMLElement || t instanceof getWindow(t).HTMLElement;
1081
- }
1082
-
1083
- function isShadowRoot(t) {
1084
- // Browsers without `ShadowRoot` support.
1085
- if (typeof ShadowRoot === "undefined") {
1086
- return false;
1087
- }
1088
- return t instanceof ShadowRoot || t instanceof getWindow(t).ShadowRoot;
1089
- }
1090
-
1091
- function isOverflowElement(t) {
1092
- const {overflow: e, overflowX: n, overflowY: o, display: i} = getComputedStyle(t);
1093
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && ![ "inline", "contents" ].includes(i);
1094
- }
1095
-
1096
- function isTableElement(t) {
1097
- return [ "table", "td", "th" ].includes(getNodeName(t));
1098
- }
1099
-
1100
- function isTopLayer(t) {
1101
- return [ ":popover-open", ":modal" ].some((e => {
1102
- try {
1103
- return t.matches(e);
1104
- } catch (t) {
1105
- return false;
1106
- }
1107
- }));
1108
- }
1109
-
1110
- function isContainingBlock(t) {
1111
- const e = isWebKit();
1112
- const n = isElement(t) ? getComputedStyle(t) : t;
1113
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1114
- return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : false) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : false) || !e && (n.filter ? n.filter !== "none" : false) || [ "transform", "perspective", "filter" ].some((t => (n.willChange || "").includes(t))) || [ "paint", "layout", "strict", "content" ].some((t => (n.contain || "").includes(t)));
1115
- }
1116
-
1117
- function getContainingBlock(t) {
1118
- let e = getParentNode(t);
1119
- while (isHTMLElement(e) && !isLastTraversableNode(e)) {
1120
- if (isContainingBlock(e)) {
1121
- return e;
1122
- } else if (isTopLayer(e)) {
1123
- return null;
1124
- }
1125
- e = getParentNode(e);
1126
- }
1127
- return null;
1128
- }
1129
-
1130
- function isWebKit() {
1131
- if (typeof CSS === "undefined" || !CSS.supports) return false;
1132
- return CSS.supports("-webkit-backdrop-filter", "none");
1133
- }
1134
-
1135
- function isLastTraversableNode(t) {
1136
- return [ "html", "body", "#document" ].includes(getNodeName(t));
1137
- }
1138
-
1139
- function getComputedStyle(t) {
1140
- return getWindow(t).getComputedStyle(t);
1141
- }
1142
-
1143
- function getNodeScroll(t) {
1144
- if (isElement(t)) {
1145
- return {
1146
- scrollLeft: t.scrollLeft,
1147
- scrollTop: t.scrollTop
1148
- };
1149
- }
1150
- return {
1151
- scrollLeft: t.scrollX,
1152
- scrollTop: t.scrollY
1153
- };
1154
- }
1155
-
1156
- function getParentNode(t) {
1157
- if (getNodeName(t) === "html") {
1158
- return t;
1159
- }
1160
- const e =
1161
- // Step into the shadow DOM of the parent of a slotted node.
1162
- t.assignedSlot ||
1163
- // DOM Element detected.
1164
- t.parentNode ||
1165
- // ShadowRoot detected.
1166
- isShadowRoot(t) && t.host ||
1167
- // Fallback.
1168
- getDocumentElement(t);
1169
- return isShadowRoot(e) ? e.host : e;
1170
- }
1171
-
1172
- function getNearestOverflowAncestor(t) {
1173
- const e = getParentNode(t);
1174
- if (isLastTraversableNode(e)) {
1175
- return t.ownerDocument ? t.ownerDocument.body : t.body;
1176
- }
1177
- if (isHTMLElement(e) && isOverflowElement(e)) {
1178
- return e;
1179
- }
1180
- return getNearestOverflowAncestor(e);
1181
- }
1182
-
1183
- function getOverflowAncestors(t, e, n) {
1184
- var o;
1185
- if (e === void 0) {
1186
- e = [];
1187
- }
1188
- if (n === void 0) {
1189
- n = true;
1190
- }
1191
- const i = getNearestOverflowAncestor(t);
1192
- const s = i === ((o = t.ownerDocument) == null ? void 0 : o.body);
1193
- const c = getWindow(i);
1194
- if (s) {
1195
- const t = getFrameElement(c);
1196
- return e.concat(c, c.visualViewport || [], isOverflowElement(i) ? i : [], t && n ? getOverflowAncestors(t) : []);
1197
- }
1198
- return e.concat(i, getOverflowAncestors(i, [], n));
1199
- }
1200
-
1201
- function getFrameElement(t) {
1202
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
1203
- }
1204
-
1205
- function getCssDimensions(t) {
1206
- const e = getComputedStyle(t);
1207
- // In testing environments, the `width` and `height` properties are empty
1208
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1209
- let n = parseFloat(e.width) || 0;
1210
- let o = parseFloat(e.height) || 0;
1211
- const i = isHTMLElement(t);
1212
- const c = i ? t.offsetWidth : n;
1213
- const r = i ? t.offsetHeight : o;
1214
- const l = s(n) !== c || s(o) !== r;
1215
- if (l) {
1216
- n = c;
1217
- o = r;
1218
- }
1219
- return {
1220
- width: n,
1221
- height: o,
1222
- $: l
1223
- };
1224
- }
1225
-
1226
- function unwrapElement(t) {
1227
- return !isElement(t) ? t.contextElement : t;
1228
- }
1229
-
1230
- function getScale(t) {
1231
- const e = unwrapElement(t);
1232
- if (!isHTMLElement(e)) {
1233
- return createCoords(1);
1234
- }
1235
- const n = e.getBoundingClientRect();
1236
- const {width: o, height: i, $: c} = getCssDimensions(e);
1237
- let r = (c ? s(n.width) : n.width) / o;
1238
- let l = (c ? s(n.height) : n.height) / i;
1239
- // 0, NaN, or Infinity should always fallback to 1.
1240
- if (!r || !Number.isFinite(r)) {
1241
- r = 1;
1242
- }
1243
- if (!l || !Number.isFinite(l)) {
1244
- l = 1;
1245
- }
1246
- return {
1247
- x: r,
1248
- y: l
1249
- };
1250
- }
1251
-
1252
- const a = createCoords(0);
1253
-
1254
- function getVisualOffsets(t) {
1255
- const e = getWindow(t);
1256
- if (!isWebKit() || !e.visualViewport) {
1257
- return a;
1258
- }
1259
- return {
1260
- x: e.visualViewport.offsetLeft,
1261
- y: e.visualViewport.offsetTop
1262
- };
1263
- }
1264
-
1265
- function shouldAddVisualOffsets(t, e, n) {
1266
- if (e === void 0) {
1267
- e = false;
1268
- }
1269
- if (!n || e && n !== getWindow(t)) {
1270
- return false;
1271
- }
1272
- return e;
1273
- }
1274
-
1275
- function getBoundingClientRect(t, e, n, o) {
1276
- if (e === void 0) {
1277
- e = false;
1278
- }
1279
- if (n === void 0) {
1280
- n = false;
1281
- }
1282
- const i = t.getBoundingClientRect();
1283
- const s = unwrapElement(t);
1284
- let c = createCoords(1);
1285
- if (e) {
1286
- if (o) {
1287
- if (isElement(o)) {
1288
- c = getScale(o);
1289
- }
1290
- } else {
1291
- c = getScale(t);
1292
- }
1293
- }
1294
- const r = shouldAddVisualOffsets(s, n, o) ? getVisualOffsets(s) : createCoords(0);
1295
- let l = (i.left + r.x) / c.x;
1296
- let a = (i.top + r.y) / c.y;
1297
- let f = i.width / c.x;
1298
- let u = i.height / c.y;
1299
- if (s) {
1300
- const t = getWindow(s);
1301
- const e = o && isElement(o) ? getWindow(o) : o;
1302
- let n = t;
1303
- let i = getFrameElement(n);
1304
- while (i && o && e !== n) {
1305
- const t = getScale(i);
1306
- const e = i.getBoundingClientRect();
1307
- const o = getComputedStyle(i);
1308
- const s = e.left + (i.clientLeft + parseFloat(o.paddingLeft)) * t.x;
1309
- const c = e.top + (i.clientTop + parseFloat(o.paddingTop)) * t.y;
1310
- l *= t.x;
1311
- a *= t.y;
1312
- f *= t.x;
1313
- u *= t.y;
1314
- l += s;
1315
- a += c;
1316
- n = getWindow(i);
1317
- i = getFrameElement(n);
1318
- }
1319
- }
1320
- return rectToClientRect({
1321
- width: f,
1322
- height: u,
1323
- x: l,
1324
- y: a
1325
- });
1326
- }
1327
-
1328
- function convertOffsetParentRelativeRectToViewportRelativeRect(t) {
1329
- let {elements: e, rect: n, offsetParent: o, strategy: i} = t;
1330
- const s = i === "fixed";
1331
- const c = getDocumentElement(o);
1332
- const r = e ? isTopLayer(e.floating) : false;
1333
- if (o === c || r && s) {
1334
- return n;
1335
- }
1336
- let l = {
1337
- scrollLeft: 0,
1338
- scrollTop: 0
1339
- };
1340
- let a = createCoords(1);
1341
- const f = createCoords(0);
1342
- const u = isHTMLElement(o);
1343
- if (u || !u && !s) {
1344
- if (getNodeName(o) !== "body" || isOverflowElement(c)) {
1345
- l = getNodeScroll(o);
1346
- }
1347
- if (isHTMLElement(o)) {
1348
- const t = getBoundingClientRect(o);
1349
- a = getScale(o);
1350
- f.x = t.x + o.clientLeft;
1351
- f.y = t.y + o.clientTop;
1352
- }
1353
- }
1354
- return {
1355
- width: n.width * a.x,
1356
- height: n.height * a.y,
1357
- x: n.x * a.x - l.scrollLeft * a.x + f.x,
1358
- y: n.y * a.y - l.scrollTop * a.y + f.y
1359
- };
1360
- }
1361
-
1362
- function getClientRects(t) {
1363
- return Array.from(t.getClientRects());
1364
- }
1365
-
1366
- function getWindowScrollBarX(t) {
1367
- // If <html> has a CSS width greater than the viewport, then this will be
1368
- // incorrect for RTL.
1369
- return getBoundingClientRect(getDocumentElement(t)).left + getNodeScroll(t).scrollLeft;
1370
- }
1371
-
1372
- // Gets the entire size of the scrollable document area, even extending outside
1373
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1374
- function getDocumentRect(t) {
1375
- const e = getDocumentElement(t);
1376
- const n = getNodeScroll(t);
1377
- const o = t.ownerDocument.body;
1378
- const s = i(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth);
1379
- const c = i(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
1380
- let r = -n.scrollLeft + getWindowScrollBarX(t);
1381
- const l = -n.scrollTop;
1382
- if (getComputedStyle(o).direction === "rtl") {
1383
- r += i(e.clientWidth, o.clientWidth) - s;
1384
- }
1385
- return {
1386
- width: s,
1387
- height: c,
1388
- x: r,
1389
- y: l
1390
- };
1391
- }
1392
-
1393
- function getViewportRect(t, e) {
1394
- const n = getWindow(t);
1395
- const o = getDocumentElement(t);
1396
- const i = n.visualViewport;
1397
- let s = o.clientWidth;
1398
- let c = o.clientHeight;
1399
- let r = 0;
1400
- let l = 0;
1401
- if (i) {
1402
- s = i.width;
1403
- c = i.height;
1404
- const t = isWebKit();
1405
- if (!t || t && e === "fixed") {
1406
- r = i.offsetLeft;
1407
- l = i.offsetTop;
1408
- }
1409
- }
1410
- return {
1411
- width: s,
1412
- height: c,
1413
- x: r,
1414
- y: l
1415
- };
1416
- }
1417
-
1418
- // Returns the inner client rect, subtracting scrollbars if present.
1419
- function getInnerBoundingClientRect(t, e) {
1420
- const n = getBoundingClientRect(t, true, e === "fixed");
1421
- const o = n.top + t.clientTop;
1422
- const i = n.left + t.clientLeft;
1423
- const s = isHTMLElement(t) ? getScale(t) : createCoords(1);
1424
- const c = t.clientWidth * s.x;
1425
- const r = t.clientHeight * s.y;
1426
- const l = i * s.x;
1427
- const a = o * s.y;
1428
- return {
1429
- width: c,
1430
- height: r,
1431
- x: l,
1432
- y: a
1433
- };
1434
- }
1435
-
1436
- function getClientRectFromClippingAncestor(t, e, n) {
1437
- let o;
1438
- if (e === "viewport") {
1439
- o = getViewportRect(t, n);
1440
- } else if (e === "document") {
1441
- o = getDocumentRect(getDocumentElement(t));
1442
- } else if (isElement(e)) {
1443
- o = getInnerBoundingClientRect(e, n);
1444
- } else {
1445
- const n = getVisualOffsets(t);
1446
- o = {
1447
- ...e,
1448
- x: e.x - n.x,
1449
- y: e.y - n.y
1450
- };
1451
- }
1452
- return rectToClientRect(o);
1453
- }
1454
-
1455
- function hasFixedPositionAncestor(t, e) {
1456
- const n = getParentNode(t);
1457
- if (n === e || !isElement(n) || isLastTraversableNode(n)) {
1458
- return false;
1459
- }
1460
- return getComputedStyle(n).position === "fixed" || hasFixedPositionAncestor(n, e);
1461
- }
1462
-
1463
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1464
- // clipping (or hiding) child elements. This returns all clipping ancestors
1465
- // of the given element up the tree.
1466
- function getClippingElementAncestors(t, e) {
1467
- const n = e.get(t);
1468
- if (n) {
1469
- return n;
1470
- }
1471
- let o = getOverflowAncestors(t, [], false).filter((t => isElement(t) && getNodeName(t) !== "body"));
1472
- let i = null;
1473
- const s = getComputedStyle(t).position === "fixed";
1474
- let c = s ? getParentNode(t) : t;
1475
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1476
- while (isElement(c) && !isLastTraversableNode(c)) {
1477
- const e = getComputedStyle(c);
1478
- const n = isContainingBlock(c);
1479
- if (!n && e.position === "fixed") {
1480
- i = null;
1481
- }
1482
- const r = s ? !n && !i : !n && e.position === "static" && !!i && [ "absolute", "fixed" ].includes(i.position) || isOverflowElement(c) && !n && hasFixedPositionAncestor(t, c);
1483
- if (r) {
1484
- // Drop non-containing blocks.
1485
- o = o.filter((t => t !== c));
1486
- } else {
1487
- // Record last containing block for next iteration.
1488
- i = e;
1489
- }
1490
- c = getParentNode(c);
1491
- }
1492
- e.set(t, o);
1493
- return o;
1494
- }
1495
-
1496
- // Gets the maximum area that the element is visible in due to any number of
1497
- // clipping ancestors.
1498
- function getClippingRect(t) {
1499
- let {element: e, boundary: n, rootBoundary: s, strategy: c} = t;
1500
- const r = n === "clippingAncestors" ? isTopLayer(e) ? [] : getClippingElementAncestors(e, this._c) : [].concat(n);
1501
- const l = [ ...r, s ];
1502
- const a = l[0];
1503
- const f = l.reduce(((t, n) => {
1504
- const s = getClientRectFromClippingAncestor(e, n, c);
1505
- t.top = i(s.top, t.top);
1506
- t.right = o(s.right, t.right);
1507
- t.bottom = o(s.bottom, t.bottom);
1508
- t.left = i(s.left, t.left);
1509
- return t;
1510
- }), getClientRectFromClippingAncestor(e, a, c));
1511
- return {
1512
- width: f.right - f.left,
1513
- height: f.bottom - f.top,
1514
- x: f.left,
1515
- y: f.top
1516
- };
1517
- }
1518
-
1519
- function getDimensions(t) {
1520
- const {width: e, height: n} = getCssDimensions(t);
1521
- return {
1522
- width: e,
1523
- height: n
1524
- };
1525
- }
1526
-
1527
- function getRectRelativeToOffsetParent(t, e, n) {
1528
- const o = isHTMLElement(e);
1529
- const i = getDocumentElement(e);
1530
- const s = n === "fixed";
1531
- const c = getBoundingClientRect(t, true, s, e);
1532
- let r = {
1533
- scrollLeft: 0,
1534
- scrollTop: 0
1535
- };
1536
- const l = createCoords(0);
1537
- if (o || !o && !s) {
1538
- if (getNodeName(e) !== "body" || isOverflowElement(i)) {
1539
- r = getNodeScroll(e);
1540
- }
1541
- if (o) {
1542
- const t = getBoundingClientRect(e, true, s, e);
1543
- l.x = t.x + e.clientLeft;
1544
- l.y = t.y + e.clientTop;
1545
- } else if (i) {
1546
- l.x = getWindowScrollBarX(i);
1547
- }
1548
- }
1549
- const a = c.left + r.scrollLeft - l.x;
1550
- const f = c.top + r.scrollTop - l.y;
1551
- return {
1552
- x: a,
1553
- y: f,
1554
- width: c.width,
1555
- height: c.height
1556
- };
1557
- }
1558
-
1559
- function isStaticPositioned(t) {
1560
- return getComputedStyle(t).position === "static";
1561
- }
1562
-
1563
- function getTrueOffsetParent(t, e) {
1564
- if (!isHTMLElement(t) || getComputedStyle(t).position === "fixed") {
1565
- return null;
1566
- }
1567
- if (e) {
1568
- return e(t);
1569
- }
1570
- return t.offsetParent;
1571
- }
1572
-
1573
- // Gets the closest ancestor positioned element. Handles some edge cases,
1574
- // such as table ancestors and cross browser bugs.
1575
- function getOffsetParent(t, e) {
1576
- const n = getWindow(t);
1577
- if (isTopLayer(t)) {
1578
- return n;
1579
- }
1580
- if (!isHTMLElement(t)) {
1581
- let e = getParentNode(t);
1582
- while (e && !isLastTraversableNode(e)) {
1583
- if (isElement(e) && !isStaticPositioned(e)) {
1584
- return e;
1585
- }
1586
- e = getParentNode(e);
1587
- }
1588
- return n;
1589
- }
1590
- let o = getTrueOffsetParent(t, e);
1591
- while (o && isTableElement(o) && isStaticPositioned(o)) {
1592
- o = getTrueOffsetParent(o, e);
1593
- }
1594
- if (o && isLastTraversableNode(o) && isStaticPositioned(o) && !isContainingBlock(o)) {
1595
- return n;
1596
- }
1597
- return o || getContainingBlock(t) || n;
1598
- }
1599
-
1600
- const getElementRects = async function(t) {
1601
- const e = this.getOffsetParent || getOffsetParent;
1602
- const n = this.getDimensions;
1603
- const o = await n(t.floating);
1604
- return {
1605
- reference: getRectRelativeToOffsetParent(t.reference, await e(t.floating), t.strategy),
1606
- floating: {
1607
- x: 0,
1608
- y: 0,
1609
- width: o.width,
1610
- height: o.height
1611
- }
1612
- };
1613
- };
1614
-
1615
- function isRTL(t) {
1616
- return getComputedStyle(t).direction === "rtl";
1617
- }
1618
-
1619
- const f = {
1620
- convertOffsetParentRelativeRectToViewportRelativeRect,
1621
- getDocumentElement,
1622
- getClippingRect,
1623
- getOffsetParent,
1624
- getElementRects,
1625
- getClientRects,
1626
- getDimensions,
1627
- getScale,
1628
- isElement,
1629
- isRTL
1630
- };
1631
-
1632
- // https://samthor.au/2021/observing-dom/
1633
- function observeMove(t, e) {
1634
- let n = null;
1635
- let s;
1636
- const r = getDocumentElement(t);
1637
- function cleanup() {
1638
- var t;
1639
- clearTimeout(s);
1640
- (t = n) == null || t.disconnect();
1641
- n = null;
1642
- }
1643
- function refresh(l, a) {
1644
- if (l === void 0) {
1645
- l = false;
1646
- }
1647
- if (a === void 0) {
1648
- a = 1;
1649
- }
1650
- cleanup();
1651
- const {left: f, top: u, width: g, height: d} = t.getBoundingClientRect();
1652
- if (!l) {
1653
- e();
1654
- }
1655
- if (!g || !d) {
1656
- return;
1657
- }
1658
- const m = c(u);
1659
- const p = c(r.clientWidth - (f + g));
1660
- const h = c(r.clientHeight - (u + d));
1661
- const w = c(f);
1662
- const y = -m + "px " + -p + "px " + -h + "px " + -w + "px";
1663
- const v = {
1664
- rootMargin: y,
1665
- threshold: i(0, o(1, a)) || 1
1666
- };
1667
- let x = true;
1668
- function handleObserve(t) {
1669
- const e = t[0].intersectionRatio;
1670
- if (e !== a) {
1671
- if (!x) {
1672
- return refresh();
1673
- }
1674
- if (!e) {
1675
- // If the reference is clipped, the ratio is 0. Throttle the refresh
1676
- // to prevent an infinite loop of updates.
1677
- s = setTimeout((() => {
1678
- refresh(false, 1e-7);
1679
- }), 1e3);
1680
- } else {
1681
- refresh(false, e);
1682
- }
1683
- }
1684
- x = false;
1685
- }
1686
- // Older browsers don't support a `document` as the root and will throw an
1687
- // error.
1688
- try {
1689
- n = new IntersectionObserver(handleObserve, {
1690
- ...v,
1691
- // Handle <iframe>s
1692
- root: r.ownerDocument
1693
- });
1694
- } catch (t) {
1695
- n = new IntersectionObserver(handleObserve, v);
1696
- }
1697
- n.observe(t);
1698
- }
1699
- refresh(true);
1700
- return cleanup;
1701
- }
1702
-
1703
- /**
1704
- * Automatically updates the position of the floating element when necessary.
1705
- * Should only be called when the floating element is mounted on the DOM or
1706
- * visible on the screen.
1707
- * @returns cleanup function that should be invoked when the floating element is
1708
- * removed from the DOM or hidden from the screen.
1709
- * @see https://floating-ui.com/docs/autoUpdate
1710
- */ function autoUpdate(t, e, n, o) {
1711
- if (o === void 0) {
1712
- o = {};
1713
- }
1714
- const {ancestorScroll: i = true, ancestorResize: s = true, elementResize: c = typeof ResizeObserver === "function", layoutShift: r = typeof IntersectionObserver === "function", animationFrame: l = false} = o;
1715
- const a = unwrapElement(t);
1716
- const f = i || s ? [ ...a ? getOverflowAncestors(a) : [], ...getOverflowAncestors(e) ] : [];
1717
- f.forEach((t => {
1718
- i && t.addEventListener("scroll", n, {
1719
- passive: true
1720
- });
1721
- s && t.addEventListener("resize", n);
1722
- }));
1723
- const u = a && r ? observeMove(a, n) : null;
1724
- let g = -1;
1725
- let d = null;
1726
- if (c) {
1727
- d = new ResizeObserver((t => {
1728
- let [o] = t;
1729
- if (o && o.target === a && d) {
1730
- // Prevent update loops when using the `size` middleware.
1731
- // https://github.com/floating-ui/floating-ui/issues/1740
1732
- d.unobserve(e);
1733
- cancelAnimationFrame(g);
1734
- g = requestAnimationFrame((() => {
1735
- var t;
1736
- (t = d) == null || t.observe(e);
1737
- }));
1738
- }
1739
- n();
1740
- }));
1741
- if (a && !l) {
1742
- d.observe(a);
1743
- }
1744
- d.observe(e);
1745
- }
1746
- let m;
1747
- let p = l ? getBoundingClientRect(t) : null;
1748
- if (l) {
1749
- frameLoop();
1750
- }
1751
- function frameLoop() {
1752
- const e = getBoundingClientRect(t);
1753
- if (p && (e.x !== p.x || e.y !== p.y || e.width !== p.width || e.height !== p.height)) {
1754
- n();
1755
- }
1756
- p = e;
1757
- m = requestAnimationFrame(frameLoop);
1758
- }
1759
- n();
1760
- return () => {
1761
- var t;
1762
- f.forEach((t => {
1763
- i && t.removeEventListener("scroll", n);
1764
- s && t.removeEventListener("resize", n);
1765
- }));
1766
- u == null || u();
1767
- (t = d) == null || t.disconnect();
1768
- d = null;
1769
- if (l) {
1770
- cancelAnimationFrame(m);
1771
- }
1772
- };
1773
- }
1774
-
1775
- /**
1776
- * Modifies the placement by translating the floating element along the
1777
- * specified axes.
1778
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
1779
- * object may be passed.
1780
- * @see https://floating-ui.com/docs/offset
1781
- */ const u = offset$1;
1782
-
1783
- /**
1784
- * Optimizes the visibility of the floating element by choosing the placement
1785
- * that has the most space available automatically, without needing to specify a
1786
- * preferred placement. Alternative to `flip`.
1787
- * @see https://floating-ui.com/docs/autoPlacement
1788
- */ autoPlacement;
1789
-
1790
- /**
1791
- * Optimizes the visibility of the floating element by shifting it in order to
1792
- * keep it in view when it will overflow the clipping boundary.
1793
- * @see https://floating-ui.com/docs/shift
1794
- */ const g = shift$1;
1795
-
1796
- /**
1797
- * Optimizes the visibility of the floating element by flipping the `placement`
1798
- * in order to keep it in view when the preferred placement(s) will overflow the
1799
- * clipping boundary. Alternative to `autoPlacement`.
1800
- * @see https://floating-ui.com/docs/flip
1801
- */ const d = flip$1;
1802
-
1803
- /**
1804
- * Provides data that allows you to change the size of the floating element —
1805
- * for instance, prevent it from overflowing the clipping boundary or match the
1806
- * width of the reference element.
1807
- * @see https://floating-ui.com/docs/size
1808
- */ const m = size$1;
1809
-
1810
- /**
1811
- * Provides data to hide the floating element in applicable situations, such as
1812
- * when it is not in the same clipping context as the reference element.
1813
- * @see https://floating-ui.com/docs/hide
1814
- */ const p = hide$1;
1815
-
1816
- /**
1817
- * Provides data to position an inner element of the floating element so that it
1818
- * appears centered to the reference element.
1819
- * @see https://floating-ui.com/docs/arrow
1820
- */ const h = arrow$1;
1821
-
1822
- /**
1823
- * Provides improved positioning for inline reference elements that can span
1824
- * over multiple lines, such as hyperlinks or range selections.
1825
- * @see https://floating-ui.com/docs/inline
1826
- */ inline;
1827
-
1828
- /**
1829
- * Built-in `limiter` that will stop `shift()` at a certain point.
1830
- */ limitShift;
1831
-
1832
- /**
1833
- * Computes the `x` and `y` coordinates that will place the floating element
1834
- * next to a given reference element.
1835
- */ const computePosition = (t, e, n) => {
1836
- // This caches the expensive `getClippingElementAncestors` function so that
1837
- // multiple lifecycle resets re-use the same result. It only lives for a
1838
- // single call. If other functions become expensive, we can add them as well.
1839
- const o = new Map;
1840
- const i = {
1841
- platform: f,
1842
- ...n
1843
- };
1844
- const s = {
1845
- ...i.platform,
1846
- _c: o
1847
- };
1848
- return computePosition$1(t, e, {
1849
- ...i,
1850
- platform: s
1851
- });
1852
- };
1853
-
1854
- class w {
1855
- constructor(t, e, n) {
1856
- this.trigger = t;
1857
- this.panel = e;
1858
- this.options = {
1859
- distance: 20,
1860
- placement: "bottom",
1861
- strategy: "fixed",
1862
- sameWidth: false,
1863
- ...n
1864
- };
1865
- this.init(n);
1866
- }
1867
- init(t) {
1868
- this.options = Object.assign(this.options, t);
1869
- this.update();
1870
- }
1871
- update() {
1872
- this.cleanUp = autoUpdate(this.trigger, this.panel, (() => {
1873
- (async () => {
1874
- const {x: t, y: e, placement: n, middlewareData: o} = await computePosition(this.trigger, this.panel, {
1875
- placement: this.options.placement,
1876
- strategy: this.options.strategy,
1877
- middleware: [ u({
1878
- mainAxis: this.options.distance,
1879
- crossAxis: this.options.skidding
1880
- }), d(), g(), m(this.options.sameWidth && {
1881
- apply({rects: t, elements: e}) {
1882
- Object.assign(e.floating.style, {
1883
- width: `${t.reference.width}px`
1884
- });
1885
- }
1886
- }), h({
1887
- element: this.options.arrow || null
1888
- }), this.positionChange(), p() ]
1889
- });
1890
- Object.assign(this.panel.style, {
1891
- top: "0",
1892
- left: "0",
1893
- transform: `translate(${this.roundByDPR(t)}px,${this.roundByDPR(e)}px)`
1894
- });
1895
- if (this.options.arrow) {
1896
- const {x: t, y: e} = o.arrow;
1897
- const i = {
1898
- top: "bottom",
1899
- right: "left",
1900
- bottom: "top",
1901
- left: "right"
1902
- }[n.split("-")[0]];
1903
- Object.assign(this.options.arrow.style, {
1904
- left: t != null ? `${t}px` : "",
1905
- top: e != null ? `${e}px` : "",
1906
- right: "",
1907
- bottom: "",
1908
- [i]: "-4px"
1909
- });
1910
- }
1911
- const {referenceHidden: i} = o.hide;
1912
- Object.assign(this.panel.style, {
1913
- visibility: i ? "hidden" : "visible"
1914
- });
1915
- })();
1916
- }));
1917
- }
1918
- destroy() {
1919
- if (!this.cleanUp) return;
1920
- this.cleanUp();
1921
- }
1922
- positionChange() {
1923
- return {
1924
- name: "positionChange",
1925
- fn: ({placement: t}) => {
1926
- if (typeof this.options.onPositionChange !== "function") return {};
1927
- this.options.onPositionChange(t);
1928
- return {};
1929
- }
1930
- };
1931
- }
1932
- roundByDPR(t) {
1933
- const e = window.devicePixelRatio || 1;
1934
- return Math.round(t * e) / e;
1935
- }
1936
- }
1937
-
1938
- export { w as F };
5
+ const t=["top","right","bottom","left"];const n=["start","end"];const e=t.reduce(((t,e)=>t.concat(e,e+"-"+n[0],e+"-"+n[1])),[]);const o=Math.min;const s=Math.max;const i=Math.round;const c=Math.floor;const r=t=>({x:t,y:t});const l={left:"right",right:"left",bottom:"top",top:"bottom"};const a={start:"end",end:"start"};function f(t,n,e){return s(t,o(n,e))}function u(t,n){return typeof t==="function"?t(n):t}function d(t){return t.split("-")[0]}function h(t){return t.split("-")[1]}function m(t){return t==="x"?"y":"x"}function p(t){return t==="y"?"height":"width"}function y(t){return["top","bottom"].includes(d(t))?"y":"x"}function w(t){return m(y(t))}function g(t,n,e){if(e===void 0){e=false}const o=h(t);const s=w(t);const i=p(s);let c=s==="x"?o===(e?"end":"start")?"right":"left":o==="start"?"bottom":"top";if(n.reference[i]>n.floating[i]){c=O(c)}return[c,O(c)]}function x(t){const n=O(t);return[v(t),n,v(n)]}function v(t){return t.replace(/start|end/g,(t=>a[t]))}function b(t,n,e){const o=["left","right"];const s=["right","left"];const i=["top","bottom"];const c=["bottom","top"];switch(t){case"top":case"bottom":if(e)return n?s:o;return n?o:s;case"left":case"right":return n?i:c;default:return[]}}function A(t,n,e,o){const s=h(t);let i=b(d(t),e==="start",o);if(s){i=i.map((t=>t+"-"+s));if(n){i=i.concat(i.map(v))}}return i}function O(t){return t.replace(/left|right|bottom|top/g,(t=>l[t]))}function R(t){return{top:0,right:0,bottom:0,left:0,...t}}function k(t){return typeof t!=="number"?R(t):{top:t,right:t,bottom:t,left:t}}function S(t){const{x:n,y:e,width:o,height:s}=t;return{width:o,height:s,top:e,left:n,right:n+o,bottom:e+s,x:n,y:e}}function D(t,n,e){let{reference:o,floating:s}=t;const i=y(n);const c=w(n);const r=p(c);const l=d(n);const a=i==="y";const f=o.x+o.width/2-s.width/2;const u=o.y+o.height/2-s.height/2;const m=o[r]/2-s[r]/2;let g;switch(l){case"top":g={x:f,y:o.y-s.height};break;case"bottom":g={x:f,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y:u};break;case"left":g={x:o.x-s.width,y:u};break;default:g={x:o.x,y:o.y}}switch(h(n)){case"start":g[c]-=m*(e&&a?-1:1);break;case"end":g[c]+=m*(e&&a?-1:1);break}return g}const F=async(t,n,e)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:c}=e;const r=i.filter(Boolean);const l=await(c.isRTL==null?void 0:c.isRTL(n));let a=await c.getElementRects({reference:t,floating:n,strategy:s});let{x:f,y:u}=D(a,o,l);let d=o;let h={};let m=0;for(let e=0;e<r.length;e++){const{name:i,fn:p}=r[e];const{x:y,y:w,data:g,reset:x}=await p({x:f,y:u,initialPlacement:o,placement:d,strategy:s,middlewareData:h,rects:a,platform:c,elements:{reference:t,floating:n}});f=y!=null?y:f;u=w!=null?w:u;h={...h,[i]:{...h[i],...g}};if(x&&m<=50){m++;if(typeof x==="object"){if(x.placement){d=x.placement}if(x.rects){a=x.rects===true?await c.getElementRects({reference:t,floating:n,strategy:s}):x.rects}({x:f,y:u}=D(a,d,l))}e=-1}}return{x:f,y:u,placement:d,strategy:s,middlewareData:h}};async function P(t,n){var e;if(n===void 0){n={}}const{x:o,y:s,platform:i,rects:c,elements:r,strategy:l}=t;const{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:h=false,padding:m=0}=u(n,t);const p=k(m);const y=d==="floating"?"reference":"floating";const w=r[h?y:d];const g=S(await i.getClippingRect({element:((e=await(i.isElement==null?void 0:i.isElement(w)))!=null?e:true)?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(r.floating)),boundary:a,rootBoundary:f,strategy:l}));const x=d==="floating"?{x:o,y:s,width:c.floating.width,height:c.floating.height}:c.reference;const v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(r.floating));const b=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1};const A=S(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:x,offsetParent:v,strategy:l}):x);return{top:(g.top-A.top+p.top)/b.y,bottom:(A.bottom-g.bottom+p.bottom)/b.y,left:(g.left-A.left+p.left)/b.x,right:(A.right-g.right+p.right)/b.x}}const C=t=>({name:"arrow",options:t,async fn(n){const{x:e,y:s,placement:i,rects:c,platform:r,elements:l,middlewareData:a}=n;const{element:d,padding:m=0}=u(t,n)||{};if(d==null){return{}}const y=k(m);const g={x:e,y:s};const x=w(i);const v=p(x);const b=await r.getDimensions(d);const A=x==="y";const O=A?"top":"left";const R=A?"bottom":"right";const S=A?"clientHeight":"clientWidth";const D=c.reference[v]+c.reference[x]-g[x]-c.floating[v];const F=g[x]-c.reference[x];const P=await(r.getOffsetParent==null?void 0:r.getOffsetParent(d));let C=P?P[S]:0;if(!C||!await(r.isElement==null?void 0:r.isElement(P))){C=l.floating[S]||c.floating[v]}const T=D/2-F/2;const B=C/2-b[v]/2-1;const H=o(y[O],B);const M=o(y[R],B);const j=H;const z=C-b[v]-M;const $=C/2-b[v]/2+T;const L=f(j,$,z);const E=!a.arrow&&h(i)!=null&&$!==L&&c.reference[v]/2-($<j?H:M)-b[v]/2<0;const I=E?$<j?$-j:$-z:0;return{[x]:g[x]+I,data:{[x]:L,centerOffset:$-L-I,...E&&{alignmentOffset:I}},reset:E}}});function T(t,n,e){const o=t?[...e.filter((n=>h(n)===t)),...e.filter((n=>h(n)!==t))]:e.filter((t=>d(t)===t));return o.filter((e=>{if(t){return h(e)===t||(n?v(e)!==e:false)}return true}))}const B=function(t){if(t===void 0){t={}}return{name:"autoPlacement",options:t,async fn(n){var o,s,i;const{rects:c,middlewareData:r,placement:l,platform:a,elements:f}=n;const{crossAxis:m=false,alignment:p,allowedPlacements:y=e,autoAlignment:w=true,...x}=u(t,n);const v=p!==undefined||y===e?T(p||null,w,y):y;const b=await P(n,x);const A=((o=r.autoPlacement)==null?void 0:o.index)||0;const O=v[A];if(O==null){return{}}const R=g(O,c,await(a.isRTL==null?void 0:a.isRTL(f.floating)));if(l!==O){return{reset:{placement:v[0]}}}const k=[b[d(O)],b[R[0]],b[R[1]]];const S=[...((s=r.autoPlacement)==null?void 0:s.overflows)||[],{placement:O,overflows:k}];const D=v[A+1];if(D){return{data:{index:A+1,overflows:S},reset:{placement:D}}}const F=S.map((t=>{const n=h(t.placement);return[t.placement,n&&m?t.overflows.slice(0,2).reduce(((t,n)=>t+n),0):t.overflows[0],t.overflows]})).sort(((t,n)=>t[1]-n[1]));const C=F.filter((t=>t[2].slice(0,h(t[0])?2:3).every((t=>t<=0))));const B=((i=C[0])==null?void 0:i[0])||F[0][0];if(B!==l){return{data:{index:A+1,overflows:S},reset:{placement:B}}}return{}}}};const H=function(t){if(t===void 0){t={}}return{name:"flip",options:t,async fn(n){var e,o;const{placement:s,middlewareData:i,rects:c,initialPlacement:r,platform:l,elements:a}=n;const{mainAxis:f=true,crossAxis:h=true,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:v=true,...b}=u(t,n);if((e=i.arrow)!=null&&e.alignmentOffset){return{}}const R=d(s);const k=y(r);const S=d(r)===r;const D=await(l.isRTL==null?void 0:l.isRTL(a.floating));const F=m||(S||!v?[O(r)]:x(r));const C=w!=="none";if(!m&&C){F.push(...A(r,v,w,D))}const T=[r,...F];const B=await P(n,b);const H=[];let M=((o=i.flip)==null?void 0:o.overflows)||[];if(f){H.push(B[R])}if(h){const t=g(s,c,D);H.push(B[t[0]],B[t[1]])}M=[...M,{placement:s,overflows:H}];if(!H.every((t=>t<=0))){var j,z;const t=(((j=i.flip)==null?void 0:j.index)||0)+1;const n=T[t];if(n){return{data:{index:t,overflows:M},reset:{placement:n}}}let e=(z=M.filter((t=>t.overflows[0]<=0)).sort(((t,n)=>t.overflows[1]-n.overflows[1]))[0])==null?void 0:z.placement;if(!e){switch(p){case"bestFit":{var $;const t=($=M.filter((t=>{if(C){const n=y(t.placement);return n===k||n==="y"}return true})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,n)=>t+n),0)])).sort(((t,n)=>t[1]-n[1]))[0])==null?void 0:$[0];if(t){e=t}break}case"initialPlacement":e=r;break}}if(s!==e){return{reset:{placement:e}}}}return{}}}};function M(t,n){return{top:t.top-n.height,right:t.right-n.width,bottom:t.bottom-n.height,left:t.left-n.width}}function j(n){return t.some((t=>n[t]>=0))}const z=function(t){if(t===void 0){t={}}return{name:"hide",options:t,async fn(n){const{rects:e}=n;const{strategy:o="referenceHidden",...s}=u(t,n);switch(o){case"referenceHidden":{const t=await P(n,{...s,elementContext:"reference"});const o=M(t,e.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:j(o)}}}case"escaped":{const t=await P(n,{...s,altBoundary:true});const o=M(t,e.floating);return{data:{escapedOffsets:o,escaped:j(o)}}}default:{return{}}}}}};function $(t){const n=o(...t.map((t=>t.left)));const e=o(...t.map((t=>t.top)));const i=s(...t.map((t=>t.right)));const c=s(...t.map((t=>t.bottom)));return{x:n,y:e,width:i-n,height:c-e}}function L(t){const n=t.slice().sort(((t,n)=>t.y-n.y));const e=[];let o=null;for(let t=0;t<n.length;t++){const s=n[t];if(!o||s.y-o.y>o.height/2){e.push([s])}else{e[e.length-1].push(s)}o=s}return e.map((t=>S($(t))))}const E=function(t){if(t===void 0){t={}}return{name:"inline",options:t,async fn(n){const{placement:e,elements:i,rects:c,platform:r,strategy:l}=n;const{padding:a=2,x:f,y:h}=u(t,n);const m=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(i.reference))||[]);const p=L(m);const w=S($(m));const g=k(a);function x(){if(p.length===2&&p[0].left>p[1].right&&f!=null&&h!=null){return p.find((t=>f>t.left-g.left&&f<t.right+g.right&&h>t.top-g.top&&h<t.bottom+g.bottom))||w}if(p.length>=2){if(y(e)==="y"){const t=p[0];const n=p[p.length-1];const o=d(e)==="top";const s=t.top;const i=n.bottom;const c=o?t.left:n.left;const r=o?t.right:n.right;const l=r-c;const a=i-s;return{top:s,bottom:i,left:c,right:r,width:l,height:a,x:c,y:s}}const t=d(e)==="left";const n=s(...p.map((t=>t.right)));const i=o(...p.map((t=>t.left)));const c=p.filter((e=>t?e.left===i:e.right===n));const r=c[0].top;const l=c[c.length-1].bottom;const a=i;const f=n;const u=f-a;const h=l-r;return{top:r,bottom:l,left:a,right:f,width:u,height:h,x:a,y:r}}return w}const v=await r.getElementRects({reference:{getBoundingClientRect:x},floating:i.floating,strategy:l});if(c.reference.x!==v.reference.x||c.reference.y!==v.reference.y||c.reference.width!==v.reference.width||c.reference.height!==v.reference.height){return{reset:{rects:v}}}return{}}}};async function I(t,n){const{placement:e,platform:o,elements:s}=t;const i=await(o.isRTL==null?void 0:o.isRTL(s.floating));const c=d(e);const r=h(e);const l=y(e)==="y";const a=["left","top"].includes(c)?-1:1;const f=i&&l?-1:1;const m=u(n,t);let{mainAxis:p,crossAxis:w,alignmentAxis:g}=typeof m==="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};if(r&&typeof g==="number"){w=r==="end"?g*-1:g}return l?{x:w*f,y:p*a}:{x:p*a,y:w*f}}const N=function(t){if(t===void 0){t=0}return{name:"offset",options:t,async fn(n){var e,o;const{x:s,y:i,placement:c,middlewareData:r}=n;const l=await I(n,t);if(c===((e=r.offset)==null?void 0:e.placement)&&(o=r.arrow)!=null&&o.alignmentOffset){return{}}return{x:s+l.x,y:i+l.y,data:{...l,placement:c}}}}};const W=function(t){if(t===void 0){t={}}return{name:"shift",options:t,async fn(n){const{x:e,y:o,placement:s}=n;const{mainAxis:i=true,crossAxis:c=false,limiter:r={fn:t=>{let{x:n,y:e}=t;return{x:n,y:e}}},...l}=u(t,n);const a={x:e,y:o};const h=await P(n,l);const p=y(d(s));const w=m(p);let g=a[w];let x=a[p];if(i){const t=w==="y"?"top":"left";const n=w==="y"?"bottom":"right";const e=g+h[t];const o=g-h[n];g=f(e,g,o)}if(c){const t=p==="y"?"top":"left";const n=p==="y"?"bottom":"right";const e=x+h[t];const o=x-h[n];x=f(e,x,o)}const v=r.fn({...n,[w]:g,[p]:x});return{...v,data:{x:v.x-e,y:v.y-o}}}}};const q=function(t){if(t===void 0){t={}}return{options:t,fn(n){const{x:e,y:o,placement:s,rects:i,middlewareData:c}=n;const{offset:r=0,mainAxis:l=true,crossAxis:a=true}=u(t,n);const f={x:e,y:o};const h=y(s);const p=m(h);let w=f[p];let g=f[h];const x=u(r,n);const v=typeof x==="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(l){const t=p==="y"?"height":"width";const n=i.reference[p]-i.floating[t]+v.mainAxis;const e=i.reference[p]+i.reference[t]-v.mainAxis;if(w<n){w=n}else if(w>e){w=e}}if(a){var b,A;const t=p==="y"?"width":"height";const n=["top","left"].includes(d(s));const e=i.reference[h]-i.floating[t]+(n?((b=c.offset)==null?void 0:b[h])||0:0)+(n?0:v.crossAxis);const o=i.reference[h]+i.reference[t]+(n?0:((A=c.offset)==null?void 0:A[h])||0)-(n?v.crossAxis:0);if(g<e){g=e}else if(g>o){g=o}}return{[p]:w,[h]:g}}}};const V=function(t){if(t===void 0){t={}}return{name:"size",options:t,async fn(n){const{placement:e,rects:i,platform:c,elements:r}=n;const{apply:l=(()=>{}),...a}=u(t,n);const f=await P(n,a);const m=d(e);const p=h(e);const w=y(e)==="y";const{width:g,height:x}=i.floating;let v;let b;if(m==="top"||m==="bottom"){v=m;b=p===(await(c.isRTL==null?void 0:c.isRTL(r.floating))?"start":"end")?"left":"right"}else{b=m;v=p==="end"?"top":"bottom"}const A=x-f.top-f.bottom;const O=g-f.left-f.right;const R=o(x-f[v],A);const k=o(g-f[b],O);const S=!n.middlewareData.shift;let D=R;let F=k;if(w){F=p||S?o(k,O):O}else{D=p||S?o(R,A):A}if(S&&!p){const t=s(f.left,0);const n=s(f.right,0);const e=s(f.top,0);const o=s(f.bottom,0);if(w){F=g-2*(t!==0||n!==0?t+n:s(f.left,f.right))}else{D=x-2*(e!==0||o!==0?e+o:s(f.top,f.bottom))}}await l({...n,availableWidth:F,availableHeight:D});const C=await c.getDimensions(r.floating);if(g!==C.width||x!==C.height){return{reset:{rects:true}}}return{}}}};function X(t){if(G(t)){return(t.nodeName||"").toLowerCase()}return"#document"}function Y(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function _(t){var n;return(n=(G(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function G(t){return t instanceof Node||t instanceof Y(t).Node}function J(t){return t instanceof Element||t instanceof Y(t).Element}function K(t){return t instanceof HTMLElement||t instanceof Y(t).HTMLElement}function Q(t){if(typeof ShadowRoot==="undefined"){return false}return t instanceof ShadowRoot||t instanceof Y(t).ShadowRoot}function U(t){const{overflow:n,overflowX:e,overflowY:o,display:s}=it(t);return/auto|scroll|overlay|hidden|clip/.test(n+o+e)&&!["inline","contents"].includes(s)}function Z(t){return["table","td","th"].includes(X(t))}function tt(t){return[":popover-open",":modal"].some((n=>{try{return t.matches(n)}catch(t){return false}}))}function nt(t){const n=ot();const e=J(t)?it(t):t;return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":false)||!n&&(e.backdropFilter?e.backdropFilter!=="none":false)||!n&&(e.filter?e.filter!=="none":false)||["transform","perspective","filter"].some((t=>(e.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(e.contain||"").includes(t)))}function et(t){let n=rt(t);while(K(n)&&!st(n)){if(nt(n)){return n}else if(tt(n)){return null}n=rt(n)}return null}function ot(){if(typeof CSS==="undefined"||!CSS.supports)return false;return CSS.supports("-webkit-backdrop-filter","none")}function st(t){return["html","body","#document"].includes(X(t))}function it(t){return Y(t).getComputedStyle(t)}function ct(t){if(J(t)){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}return{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function rt(t){if(X(t)==="html"){return t}const n=t.assignedSlot||t.parentNode||Q(t)&&t.host||_(t);return Q(n)?n.host:n}function lt(t){const n=rt(t);if(st(n)){return t.ownerDocument?t.ownerDocument.body:t.body}if(K(n)&&U(n)){return n}return lt(n)}function at(t,n,e){var o;if(n===void 0){n=[]}if(e===void 0){e=true}const s=lt(t);const i=s===((o=t.ownerDocument)==null?void 0:o.body);const c=Y(s);if(i){const t=ft(c);return n.concat(c,c.visualViewport||[],U(s)?s:[],t&&e?at(t):[])}return n.concat(s,at(s,[],e))}function ft(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ut(t){const n=it(t);let e=parseFloat(n.width)||0;let o=parseFloat(n.height)||0;const s=K(t);const c=s?t.offsetWidth:e;const r=s?t.offsetHeight:o;const l=i(e)!==c||i(o)!==r;if(l){e=c;o=r}return{width:e,height:o,$:l}}function dt(t){return!J(t)?t.contextElement:t}function ht(t){const n=dt(t);if(!K(n)){return r(1)}const e=n.getBoundingClientRect();const{width:o,height:s,$:c}=ut(n);let l=(c?i(e.width):e.width)/o;let a=(c?i(e.height):e.height)/s;if(!l||!Number.isFinite(l)){l=1}if(!a||!Number.isFinite(a)){a=1}return{x:l,y:a}}const mt=r(0);function pt(t){const n=Y(t);if(!ot()||!n.visualViewport){return mt}return{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function yt(t,n,e){if(n===void 0){n=false}if(!e||n&&e!==Y(t)){return false}return n}function wt(t,n,e,o){if(n===void 0){n=false}if(e===void 0){e=false}const s=t.getBoundingClientRect();const i=dt(t);let c=r(1);if(n){if(o){if(J(o)){c=ht(o)}}else{c=ht(t)}}const l=yt(i,e,o)?pt(i):r(0);let a=(s.left+l.x)/c.x;let f=(s.top+l.y)/c.y;let u=s.width/c.x;let d=s.height/c.y;if(i){const t=Y(i);const n=o&&J(o)?Y(o):o;let e=t;let s=ft(e);while(s&&o&&n!==e){const t=ht(s);const n=s.getBoundingClientRect();const o=it(s);const i=n.left+(s.clientLeft+parseFloat(o.paddingLeft))*t.x;const c=n.top+(s.clientTop+parseFloat(o.paddingTop))*t.y;a*=t.x;f*=t.y;u*=t.x;d*=t.y;a+=i;f+=c;e=Y(s);s=ft(e)}}return S({width:u,height:d,x:a,y:f})}function gt(t){let{elements:n,rect:e,offsetParent:o,strategy:s}=t;const i=s==="fixed";const c=_(o);const l=n?tt(n.floating):false;if(o===c||l&&i){return e}let a={scrollLeft:0,scrollTop:0};let f=r(1);const u=r(0);const d=K(o);if(d||!d&&!i){if(X(o)!=="body"||U(c)){a=ct(o)}if(K(o)){const t=wt(o);f=ht(o);u.x=t.x+o.clientLeft;u.y=t.y+o.clientTop}}return{width:e.width*f.x,height:e.height*f.y,x:e.x*f.x-a.scrollLeft*f.x+u.x,y:e.y*f.y-a.scrollTop*f.y+u.y}}function xt(t){return Array.from(t.getClientRects())}function vt(t){return wt(_(t)).left+ct(t).scrollLeft}function bt(t){const n=_(t);const e=ct(t);const o=t.ownerDocument.body;const i=s(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth);const c=s(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let r=-e.scrollLeft+vt(t);const l=-e.scrollTop;if(it(o).direction==="rtl"){r+=s(n.clientWidth,o.clientWidth)-i}return{width:i,height:c,x:r,y:l}}function At(t,n){const e=Y(t);const o=_(t);const s=e.visualViewport;let i=o.clientWidth;let c=o.clientHeight;let r=0;let l=0;if(s){i=s.width;c=s.height;const t=ot();if(!t||t&&n==="fixed"){r=s.offsetLeft;l=s.offsetTop}}return{width:i,height:c,x:r,y:l}}function Ot(t,n){const e=wt(t,true,n==="fixed");const o=e.top+t.clientTop;const s=e.left+t.clientLeft;const i=K(t)?ht(t):r(1);const c=t.clientWidth*i.x;const l=t.clientHeight*i.y;const a=s*i.x;const f=o*i.y;return{width:c,height:l,x:a,y:f}}function Rt(t,n,e){let o;if(n==="viewport"){o=At(t,e)}else if(n==="document"){o=bt(_(t))}else if(J(n)){o=Ot(n,e)}else{const e=pt(t);o={...n,x:n.x-e.x,y:n.y-e.y}}return S(o)}function kt(t,n){const e=rt(t);if(e===n||!J(e)||st(e)){return false}return it(e).position==="fixed"||kt(e,n)}function St(t,n){const e=n.get(t);if(e){return e}let o=at(t,[],false).filter((t=>J(t)&&X(t)!=="body"));let s=null;const i=it(t).position==="fixed";let c=i?rt(t):t;while(J(c)&&!st(c)){const n=it(c);const e=nt(c);if(!e&&n.position==="fixed"){s=null}const r=i?!e&&!s:!e&&n.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||U(c)&&!e&&kt(t,c);if(r){o=o.filter((t=>t!==c))}else{s=n}c=rt(c)}n.set(t,o);return o}function Dt(t){let{element:n,boundary:e,rootBoundary:i,strategy:c}=t;const r=e==="clippingAncestors"?tt(n)?[]:St(n,this._c):[].concat(e);const l=[...r,i];const a=l[0];const f=l.reduce(((t,e)=>{const i=Rt(n,e,c);t.top=s(i.top,t.top);t.right=o(i.right,t.right);t.bottom=o(i.bottom,t.bottom);t.left=s(i.left,t.left);return t}),Rt(n,a,c));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Ft(t){const{width:n,height:e}=ut(t);return{width:n,height:e}}function Pt(t,n,e){const o=K(n);const s=_(n);const i=e==="fixed";const c=wt(t,true,i,n);let l={scrollLeft:0,scrollTop:0};const a=r(0);if(o||!o&&!i){if(X(n)!=="body"||U(s)){l=ct(n)}if(o){const t=wt(n,true,i,n);a.x=t.x+n.clientLeft;a.y=t.y+n.clientTop}else if(s){a.x=vt(s)}}const f=c.left+l.scrollLeft-a.x;const u=c.top+l.scrollTop-a.y;return{x:f,y:u,width:c.width,height:c.height}}function Ct(t){return it(t).position==="static"}function Tt(t,n){if(!K(t)||it(t).position==="fixed"){return null}if(n){return n(t)}return t.offsetParent}function Bt(t,n){const e=Y(t);if(tt(t)){return e}if(!K(t)){let n=rt(t);while(n&&!st(n)){if(J(n)&&!Ct(n)){return n}n=rt(n)}return e}let o=Tt(t,n);while(o&&Z(o)&&Ct(o)){o=Tt(o,n)}if(o&&st(o)&&Ct(o)&&!nt(o)){return e}return o||et(t)||e}const Ht=async function(t){const n=this.getOffsetParent||Bt;const e=this.getDimensions;const o=await e(t.floating);return{reference:Pt(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Mt(t){return it(t).direction==="rtl"}const jt={convertOffsetParentRelativeRectToViewportRelativeRect:gt,getDocumentElement:_,getClippingRect:Dt,getOffsetParent:Bt,getElementRects:Ht,getClientRects:xt,getDimensions:Ft,getScale:ht,isElement:J,isRTL:Mt};function zt(t,n){let e=null;let i;const r=_(t);function l(){var t;clearTimeout(i);(t=e)==null||t.disconnect();e=null}function a(f,u){if(f===void 0){f=false}if(u===void 0){u=1}l();const{left:d,top:h,width:m,height:p}=t.getBoundingClientRect();if(!f){n()}if(!m||!p){return}const y=c(h);const w=c(r.clientWidth-(d+m));const g=c(r.clientHeight-(h+p));const x=c(d);const v=-y+"px "+-w+"px "+-g+"px "+-x+"px";const b={rootMargin:v,threshold:s(0,o(1,u))||1};let A=true;function O(t){const n=t[0].intersectionRatio;if(n!==u){if(!A){return a()}if(!n){i=setTimeout((()=>{a(false,1e-7)}),1e3)}else{a(false,n)}}A=false}try{e=new IntersectionObserver(O,{...b,root:r.ownerDocument})}catch(t){e=new IntersectionObserver(O,b)}e.observe(t)}a(true);return l}function $t(t,n,e,o){if(o===void 0){o={}}const{ancestorScroll:s=true,ancestorResize:i=true,elementResize:c=typeof ResizeObserver==="function",layoutShift:r=typeof IntersectionObserver==="function",animationFrame:l=false}=o;const a=dt(t);const f=s||i?[...a?at(a):[],...at(n)]:[];f.forEach((t=>{s&&t.addEventListener("scroll",e,{passive:true});i&&t.addEventListener("resize",e)}));const u=a&&r?zt(a,e):null;let d=-1;let h=null;if(c){h=new ResizeObserver((t=>{let[o]=t;if(o&&o.target===a&&h){h.unobserve(n);cancelAnimationFrame(d);d=requestAnimationFrame((()=>{var t;(t=h)==null||t.observe(n)}))}e()}));if(a&&!l){h.observe(a)}h.observe(n)}let m;let p=l?wt(t):null;if(l){y()}function y(){const n=wt(t);if(p&&(n.x!==p.x||n.y!==p.y||n.width!==p.width||n.height!==p.height)){e()}p=n;m=requestAnimationFrame(y)}e();return()=>{var t;f.forEach((t=>{s&&t.removeEventListener("scroll",e);i&&t.removeEventListener("resize",e)}));u==null||u();(t=h)==null||t.disconnect();h=null;if(l){cancelAnimationFrame(m)}}}const Lt=N;B;const Et=W;const It=H;const Nt=V;const Wt=z;const qt=C;E;q;const Vt=(t,n,e)=>{const o=new Map;const s={platform:jt,...e};const i={...s.platform,_c:o};return F(t,n,{...s,platform:i})};class Xt{constructor(t,n,e){this.trigger=t;this.panel=n;this.options={distance:20,placement:"bottom",strategy:"fixed",sameWidth:false,...e};this.init(e)}init(t){this.options=Object.assign(this.options,t);this.update()}update(){this.cleanUp=$t(this.trigger,this.panel,(()=>{(async()=>{const{x:t,y:n,placement:e,middlewareData:o}=await Vt(this.trigger,this.panel,{placement:this.options.placement,strategy:this.options.strategy,middleware:[Lt({mainAxis:this.options.distance,crossAxis:this.options.skidding}),It(),Et(),Nt(this.options.sameWidth&&{apply({rects:t,elements:n}){Object.assign(n.floating.style,{width:`${t.reference.width}px`})}}),qt({element:this.options.arrow||null}),this.positionChange(),Wt()]});Object.assign(this.panel.style,{top:"0",left:"0",transform:`translate(${this.roundByDPR(t)}px,${this.roundByDPR(n)}px)`});if(this.options.arrow){const{x:t,y:n}=o.arrow;const s={top:"bottom",right:"left",bottom:"top",left:"right"}[e.split("-")[0]];Object.assign(this.options.arrow.style,{left:t!=null?`${t}px`:"",top:n!=null?`${n}px`:"",right:"",bottom:"",[s]:"-4px"})}const{referenceHidden:s}=o.hide;Object.assign(this.panel.style,{visibility:s?"hidden":"visible"})})()}))}destroy(){if(!this.cleanUp)return;this.cleanUp()}positionChange(){return{name:"positionChange",fn:({placement:t})=>{if(typeof this.options.onPositionChange!=="function")return{};this.options.onPositionChange(t);return{}}}}roundByDPR(t){const n=window.devicePixelRatio||1;return Math.round(t*n)/n}}export{Xt as F};
1939
6
  //# sourceMappingURL=p-38d4bd8a.js.map