@jenesei-software/jenesei-kit-react 1.3.18 → 1.3.20

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 (343) hide show
  1. package/build/area-BLgNLu9A.js +19 -0
  2. package/build/area-BLgNLu9A.js.map +1 -0
  3. package/build/area-C5QUBcb-.js +26 -0
  4. package/build/area-C5QUBcb-.js.map +1 -0
  5. package/build/area-DAgP6K9K.cjs +2 -0
  6. package/build/area-DAgP6K9K.cjs.map +1 -0
  7. package/build/area-k8GR7Khj.cjs +2 -0
  8. package/build/area-k8GR7Khj.cjs.map +1 -0
  9. package/build/area-preview.cjs.js +1 -1
  10. package/build/area-preview.es.js +1 -1
  11. package/build/area-scroll.cjs.js +1 -1
  12. package/build/area-scroll.es.js +3 -2
  13. package/build/area-scroll.es.js.map +1 -1
  14. package/build/area-skeleton.cjs.js +1 -1
  15. package/build/area-skeleton.es.js +3 -2
  16. package/build/area-skeleton.es.js.map +1 -1
  17. package/build/{area-BDMDiVi1.js → area.styles-BJCDsTi3.js} +2 -24
  18. package/build/area.styles-BJCDsTi3.js.map +1 -0
  19. package/build/area.styles-CtrTLcAj.cjs +40 -0
  20. package/build/area.styles-CtrTLcAj.cjs.map +1 -0
  21. package/build/{area-CmCMHnRA.cjs → area.styles-DQBIvHdz.cjs} +3 -3
  22. package/build/area.styles-DQBIvHdz.cjs.map +1 -0
  23. package/build/{area-BWxBop5m.js → area.styles-DWqSyo49.js} +2 -17
  24. package/build/area.styles-DWqSyo49.js.map +1 -0
  25. package/build/build-info.txt +3 -3
  26. package/build/component-86oA9dYz.cjs +2 -0
  27. package/build/component-86oA9dYz.cjs.map +1 -0
  28. package/build/component-BLW4AlTi.cjs +2 -0
  29. package/build/component-BLW4AlTi.cjs.map +1 -0
  30. package/build/component-BLa80fGE.cjs +2 -0
  31. package/build/component-BLa80fGE.cjs.map +1 -0
  32. package/build/{component.styles-CwTYpBx_.js → component-BX7rFpno.js} +11 -63
  33. package/build/component-BX7rFpno.js.map +1 -0
  34. package/build/{component.styles-0apMzB81.js → component-BtgXUCiJ.js} +5 -75
  35. package/build/component-BtgXUCiJ.js.map +1 -0
  36. package/build/component-C-yqkm2n.cjs +2 -0
  37. package/build/component-C-yqkm2n.cjs.map +1 -0
  38. package/build/{component.styles-C4Bz4OTl.js → component-C56biWpi.js} +6 -16
  39. package/build/component-C56biWpi.js.map +1 -0
  40. package/build/component-CHmCK6Bc.js +10 -0
  41. package/build/component-CHmCK6Bc.js.map +1 -0
  42. package/build/component-Cp8VTqb2.js +21 -0
  43. package/build/component-Cp8VTqb2.js.map +1 -0
  44. package/build/component-Cr62wN62.js +64 -0
  45. package/build/component-Cr62wN62.js.map +1 -0
  46. package/build/component-D9Fz-_ZH.cjs +2 -0
  47. package/build/component-D9Fz-_ZH.cjs.map +1 -0
  48. package/build/{component.styles-euSUJAiA.js → component-DDVjxLvn.js} +5 -38
  49. package/build/component-DDVjxLvn.js.map +1 -0
  50. package/build/{component.styles-CHqowxsZ.js → component-DF8wYX_U.js} +3 -45
  51. package/build/component-DF8wYX_U.js.map +1 -0
  52. package/build/component-DP42Uzl2.cjs +2 -0
  53. package/build/{component-Bj7sLW9s.cjs.map → component-DP42Uzl2.cjs.map} +1 -1
  54. package/build/{component-B80It4vM.js → component-DQrnK2Bj.js} +5 -5
  55. package/build/component-DQrnK2Bj.js.map +1 -0
  56. package/build/component-DXSNBORy.cjs +2 -0
  57. package/build/component-DXSNBORy.cjs.map +1 -0
  58. package/build/component-DdSHuopV.cjs +2 -0
  59. package/build/component-DdSHuopV.cjs.map +1 -0
  60. package/build/{component.styles-KBaixm0o.js → component-DerXrx9p.js} +4 -56
  61. package/build/component-DerXrx9p.js.map +1 -0
  62. package/build/{component-CKBpm4U4.js → component-DhCe6E21.js} +2 -3
  63. package/build/{component-CKBpm4U4.js.map → component-DhCe6E21.js.map} +1 -1
  64. package/build/component-Ds6eJznV.cjs +2 -0
  65. package/build/component-Ds6eJznV.cjs.map +1 -0
  66. package/build/{component.styles-AEJ_tw7Y.js → component-DyEa0lzB.js} +4 -25
  67. package/build/component-DyEa0lzB.js.map +1 -0
  68. package/build/component-GqA6sCHI.cjs +2 -0
  69. package/build/component-GqA6sCHI.cjs.map +1 -0
  70. package/build/component-IlhRGJHX.cjs +2 -0
  71. package/build/component-IlhRGJHX.cjs.map +1 -0
  72. package/build/component-KwYlKatx.cjs +2 -0
  73. package/build/component-KwYlKatx.cjs.map +1 -0
  74. package/build/component-accordion.cjs.js +1 -1
  75. package/build/component-accordion.es.js +7 -6
  76. package/build/component-accordion.es.js.map +1 -1
  77. package/build/component-button-group.cjs.js +1 -1
  78. package/build/component-button-group.es.js +4 -3
  79. package/build/component-button-group.es.js.map +1 -1
  80. package/build/component-button.cjs.js +1 -1
  81. package/build/component-button.es.js +2 -2
  82. package/build/component-checkbox-group.cjs.js +1 -1
  83. package/build/component-checkbox-group.es.js +8 -7
  84. package/build/component-checkbox-group.es.js.map +1 -1
  85. package/build/component-checkbox.cjs.js +1 -1
  86. package/build/component-checkbox.es.js +6 -5
  87. package/build/component-checkbox.es.js.map +1 -1
  88. package/build/component-date-picker.cjs.js +1 -1
  89. package/build/component-date-picker.es.js +15 -14
  90. package/build/component-date-picker.es.js.map +1 -1
  91. package/build/component-icon.cjs.js +1 -1
  92. package/build/component-icon.es.js +5 -5
  93. package/build/component-image-button.cjs.js +1 -1
  94. package/build/component-image-button.es.js +1 -1
  95. package/build/component-image-select.cjs.js +1 -1
  96. package/build/component-image-select.es.js +8 -7
  97. package/build/component-image-select.es.js.map +1 -1
  98. package/build/component-image-slider.cjs.js +1 -1
  99. package/build/component-image-slider.es.js +5 -4
  100. package/build/component-image-slider.es.js.map +1 -1
  101. package/build/component-image.cjs.js +1 -1
  102. package/build/component-image.es.js +3 -2
  103. package/build/component-image.es.js.map +1 -1
  104. package/build/component-input-otp.cjs.js +1 -1
  105. package/build/component-input-otp.es.js +5 -4
  106. package/build/component-input-otp.es.js.map +1 -1
  107. package/build/component-input.cjs.js +1 -1
  108. package/build/component-input.es.js +15 -15
  109. package/build/component-map.cjs.js +1 -1
  110. package/build/component-map.es.js +13 -12
  111. package/build/component-map.es.js.map +1 -1
  112. package/build/component-pagination.cjs.js +1 -1
  113. package/build/component-pagination.es.js +1 -1
  114. package/build/component-range.cjs.js +1 -1
  115. package/build/component-range.es.js +5 -4
  116. package/build/component-range.es.js.map +1 -1
  117. package/build/component-select.cjs.js +1 -1
  118. package/build/component-select.es.js +18 -18
  119. package/build/component-separator.cjs.js +1 -1
  120. package/build/component-separator.es.js +3 -2
  121. package/build/component-separator.es.js.map +1 -1
  122. package/build/component-textarea.cjs.js +1 -1
  123. package/build/component-textarea.es.js +5 -5
  124. package/build/component-toggle.cjs.js +1 -1
  125. package/build/component-toggle.es.js +4 -3
  126. package/build/component-toggle.es.js.map +1 -1
  127. package/build/component-tooltip.cjs.js +1 -1
  128. package/build/component-tooltip.es.js +9 -9
  129. package/build/component-typography.cjs.js +1 -1
  130. package/build/component-typography.es.js +6 -6
  131. package/build/component.components-B6FC2-ox.cjs +2 -0
  132. package/build/component.components-B6FC2-ox.cjs.map +1 -0
  133. package/build/{component.components-C9TkSqTp.js → component.components-DlJ9rcRL.js} +8 -43
  134. package/build/component.components-DlJ9rcRL.js.map +1 -0
  135. package/build/{component.constants-C8li5_tq.js → component.constants-B-ZUZwuJ.js} +2 -2
  136. package/build/{component.constants-C8li5_tq.js.map → component.constants-B-ZUZwuJ.js.map} +1 -1
  137. package/build/component.constants-DiCmqOri.cjs +2 -0
  138. package/build/{component.constants-B-ZMDpFv.cjs.map → component.constants-DiCmqOri.cjs.map} +1 -1
  139. package/build/{component.constants-CnMky3Ym.js → component.constants-DwSQ9oe4.js} +9 -34
  140. package/build/component.constants-DwSQ9oe4.js.map +1 -0
  141. package/build/component.constants-hDTTnj7k.cjs +2 -0
  142. package/build/component.constants-hDTTnj7k.cjs.map +1 -0
  143. package/build/component.styles-CD6ZzRrk.cjs +14 -0
  144. package/build/component.styles-CD6ZzRrk.cjs.map +1 -0
  145. package/build/component.styles-CNn9SMc9.cjs +10 -0
  146. package/build/component.styles-CNn9SMc9.cjs.map +1 -0
  147. package/build/{component.styles-BnJjm_ES.js → component.styles-SZ5VuhNG.js} +2 -19
  148. package/build/component.styles-SZ5VuhNG.js.map +1 -0
  149. package/build/component.styles-eaocqYbA.js +16 -0
  150. package/build/component.styles-eaocqYbA.js.map +1 -0
  151. package/build/component.types-CYtUJDuN.cjs +2 -0
  152. package/build/component.types-CYtUJDuN.cjs.map +1 -0
  153. package/build/{component.types-BoTWSvjd.js → component.types-DFRLIpd6.js} +4 -213
  154. package/build/component.types-DFRLIpd6.js.map +1 -0
  155. package/build/consts.cjs.js +1 -1
  156. package/build/consts.cjs.js.map +1 -1
  157. package/build/consts.d.ts +18 -16
  158. package/build/consts.es.js +28 -26
  159. package/build/consts.es.js.map +1 -1
  160. package/build/{context.functions-CQ9GerPb.js → context-B1DS5U6M.js} +3 -33
  161. package/build/{context.functions-CQ9GerPb.js.map → context-B1DS5U6M.js.map} +1 -1
  162. package/build/{context.functions-BD15C8_y.js → context-BxU5kwVR.js} +3 -33
  163. package/build/context-BxU5kwVR.js.map +1 -0
  164. package/build/{context.hooks-BzMTkJNv.js → context-CU_dgoUl.js} +3 -11
  165. package/build/context-CU_dgoUl.js.map +1 -0
  166. package/build/context-Cr9zS5ai.cjs +2 -0
  167. package/build/context-Cr9zS5ai.cjs.map +1 -0
  168. package/build/context-_4lcMeym.cjs +2 -0
  169. package/build/context-_4lcMeym.cjs.map +1 -0
  170. package/build/context-app.cjs.js +1 -1
  171. package/build/context-app.es.js +18 -17
  172. package/build/context-app.es.js.map +1 -1
  173. package/build/context-cookie.cjs.js +1 -1
  174. package/build/context-cookie.es.js +2 -1
  175. package/build/context-cookie.es.js.map +1 -1
  176. package/build/context-dialog.cjs.js +1 -1
  177. package/build/context-dialog.es.js +13 -12
  178. package/build/context-dialog.es.js.map +1 -1
  179. package/build/context-geolocation.cjs.js +1 -1
  180. package/build/context-geolocation.es.js +2 -1
  181. package/build/context-geolocation.es.js.map +1 -1
  182. package/build/context-local-storage.cjs.js +1 -1
  183. package/build/context-local-storage.es.js +2 -1
  184. package/build/context-local-storage.es.js.map +1 -1
  185. package/build/context-q6vhN54o.cjs +2 -0
  186. package/build/{context.functions-ohI9H54j.cjs.map → context-q6vhN54o.cjs.map} +1 -1
  187. package/build/context-sonner.cjs.js +1 -1
  188. package/build/context-sonner.es.js +18 -17
  189. package/build/context-sonner.es.js.map +1 -1
  190. package/build/context.constants-C5Unln0I.js +8433 -0
  191. package/build/context.constants-C5Unln0I.js.map +1 -0
  192. package/build/context.constants-CRxCVRKK.cjs +32 -0
  193. package/build/context.constants-CRxCVRKK.cjs.map +1 -0
  194. package/build/{context.constants-BCpaUfFz.js → context.constants-CaDW-QGJ.js} +13 -51
  195. package/build/context.constants-CaDW-QGJ.js.map +1 -0
  196. package/build/context.constants-DSfxf3ST.cjs +1692 -0
  197. package/build/context.constants-DSfxf3ST.cjs.map +1 -0
  198. package/build/context.functions-54_96FIi.js +36 -0
  199. package/build/context.functions-54_96FIi.js.map +1 -0
  200. package/build/context.functions-Bk5xMi0w.cjs +2 -0
  201. package/build/context.functions-Bk5xMi0w.cjs.map +1 -0
  202. package/build/context.functions-BoRkDnCa.cjs +2 -0
  203. package/build/context.functions-BoRkDnCa.cjs.map +1 -0
  204. package/build/context.functions-X5gRRpKi.js +35 -0
  205. package/build/context.functions-X5gRRpKi.js.map +1 -0
  206. package/build/context.hooks-B2vWSael.js +13 -0
  207. package/build/context.hooks-B2vWSael.js.map +1 -0
  208. package/build/context.hooks-BfmhHvrX.cjs +2 -0
  209. package/build/context.hooks-BfmhHvrX.cjs.map +1 -0
  210. package/build/context.hooks-Bj9FlQEC.js +44 -0
  211. package/build/context.hooks-Bj9FlQEC.js.map +1 -0
  212. package/build/context.hooks-ByjHt-DO.cjs +2 -0
  213. package/build/context.hooks-ByjHt-DO.cjs.map +1 -0
  214. package/build/context.hooks-CKO6mDS-.js +13 -0
  215. package/build/context.hooks-CKO6mDS-.js.map +1 -0
  216. package/build/context.hooks-OTo7Znss.cjs +2 -0
  217. package/build/context.hooks-OTo7Znss.cjs.map +1 -0
  218. package/build/context.hooks-PU-CST61.cjs +2 -0
  219. package/build/context.hooks-PU-CST61.cjs.map +1 -0
  220. package/build/context.hooks-uRILnzQk.js +13 -0
  221. package/build/context.hooks-uRILnzQk.js.map +1 -0
  222. package/build/index.cjs.js +1 -1
  223. package/build/index.d.ts +19 -17
  224. package/build/index.es.js +290 -289
  225. package/build/style-error.cjs.js +1 -1
  226. package/build/style-error.es.js +4 -4
  227. package/build/style-theme.cjs.js +1 -1
  228. package/build/style-theme.es.js +13 -13
  229. package/build/types.d.ts +3 -3
  230. package/build/{use-CnGHh8iL.js → use-7TZR9yNq.js} +8 -9
  231. package/build/{use-CnGHh8iL.js.map → use-7TZR9yNq.js.map} +1 -1
  232. package/build/{use-BLwltPMc.cjs → use-DNJlP5ji.cjs} +3 -3
  233. package/build/{use-BLwltPMc.cjs.map → use-DNJlP5ji.cjs.map} +1 -1
  234. package/package.json +1 -1
  235. package/build/area-BDMDiVi1.js.map +0 -1
  236. package/build/area-BWxBop5m.js.map +0 -1
  237. package/build/area-Bopd6mWj.cjs +0 -2
  238. package/build/area-Bopd6mWj.cjs.map +0 -1
  239. package/build/area-CmCMHnRA.cjs.map +0 -1
  240. package/build/area-Cvp3eBBo.js +0 -114
  241. package/build/area-Cvp3eBBo.js.map +0 -1
  242. package/build/area-DqLK4RX5.cjs +0 -40
  243. package/build/area-DqLK4RX5.cjs.map +0 -1
  244. package/build/component-5o60aes-.cjs +0 -52
  245. package/build/component-5o60aes-.cjs.map +0 -1
  246. package/build/component-B80It4vM.js.map +0 -1
  247. package/build/component-BfppCwz9.cjs +0 -88
  248. package/build/component-BfppCwz9.cjs.map +0 -1
  249. package/build/component-Bj7sLW9s.cjs +0 -2
  250. package/build/component-BxetIWe6.cjs +0 -245
  251. package/build/component-BxetIWe6.cjs.map +0 -1
  252. package/build/component-ClnOIQaN.js +0 -66
  253. package/build/component-ClnOIQaN.js.map +0 -1
  254. package/build/component-b4tMFkpE.cjs +0 -2
  255. package/build/component-b4tMFkpE.cjs.map +0 -1
  256. package/build/component-eqTj4VVc.js +0 -728
  257. package/build/component-eqTj4VVc.js.map +0 -1
  258. package/build/component-jPLOz52P.js +0 -186
  259. package/build/component-jPLOz52P.js.map +0 -1
  260. package/build/component.components-BZX00SGG.cjs +0 -16
  261. package/build/component.components-BZX00SGG.cjs.map +0 -1
  262. package/build/component.components-C9TkSqTp.js.map +0 -1
  263. package/build/component.constants-B-ZMDpFv.cjs +0 -2
  264. package/build/component.constants-CnMky3Ym.js.map +0 -1
  265. package/build/component.constants-Dg6JcWmd.cjs +0 -22
  266. package/build/component.constants-Dg6JcWmd.cjs.map +0 -1
  267. package/build/component.styles-0apMzB81.js.map +0 -1
  268. package/build/component.styles-AEJ_tw7Y.js.map +0 -1
  269. package/build/component.styles-BO8xaSCQ.cjs +0 -65
  270. package/build/component.styles-BO8xaSCQ.cjs.map +0 -1
  271. package/build/component.styles-BVQQkX5c.cjs +0 -57
  272. package/build/component.styles-BVQQkX5c.cjs.map +0 -1
  273. package/build/component.styles-BYG4iVCR.cjs +0 -10
  274. package/build/component.styles-BYG4iVCR.cjs.map +0 -1
  275. package/build/component.styles-BZ9QLlOU.cjs +0 -39
  276. package/build/component.styles-BZ9QLlOU.cjs.map +0 -1
  277. package/build/component.styles-BnJjm_ES.js.map +0 -1
  278. package/build/component.styles-BviHtzJH.cjs +0 -22
  279. package/build/component.styles-BviHtzJH.cjs.map +0 -1
  280. package/build/component.styles-C4Bz4OTl.js.map +0 -1
  281. package/build/component.styles-C8ONgWei.cjs +0 -47
  282. package/build/component.styles-C8ONgWei.cjs.map +0 -1
  283. package/build/component.styles-CHqowxsZ.js.map +0 -1
  284. package/build/component.styles-CLn52hJD.cjs +0 -14
  285. package/build/component.styles-CLn52hJD.cjs.map +0 -1
  286. package/build/component.styles-CXyyc0xg.cjs +0 -32
  287. package/build/component.styles-CXyyc0xg.cjs.map +0 -1
  288. package/build/component.styles-CtZeOnGH.js +0 -120
  289. package/build/component.styles-CtZeOnGH.js.map +0 -1
  290. package/build/component.styles-CwTYpBx_.js.map +0 -1
  291. package/build/component.styles-CxlbZwr4.cjs +0 -225
  292. package/build/component.styles-CxlbZwr4.cjs.map +0 -1
  293. package/build/component.styles-CyCy2ymw.cjs +0 -21
  294. package/build/component.styles-CyCy2ymw.cjs.map +0 -1
  295. package/build/component.styles-DWDGLfbF.js +0 -137
  296. package/build/component.styles-DWDGLfbF.js.map +0 -1
  297. package/build/component.styles-DqJURuJl.js +0 -1370
  298. package/build/component.styles-DqJURuJl.js.map +0 -1
  299. package/build/component.styles-FMHm5NHm.cjs +0 -99
  300. package/build/component.styles-FMHm5NHm.cjs.map +0 -1
  301. package/build/component.styles-Hx-MJSWX.cjs +0 -137
  302. package/build/component.styles-Hx-MJSWX.cjs.map +0 -1
  303. package/build/component.styles-KBaixm0o.js.map +0 -1
  304. package/build/component.styles-SZTM0cRW.js +0 -1046
  305. package/build/component.styles-SZTM0cRW.js.map +0 -1
  306. package/build/component.styles-_keFf_Qj.cjs +0 -13
  307. package/build/component.styles-_keFf_Qj.cjs.map +0 -1
  308. package/build/component.styles-cMafDDpP.js +0 -233
  309. package/build/component.styles-cMafDDpP.js.map +0 -1
  310. package/build/component.styles-euSUJAiA.js.map +0 -1
  311. package/build/component.types-BoTWSvjd.js.map +0 -1
  312. package/build/component.types-WiRcl02d.cjs +0 -176
  313. package/build/component.types-WiRcl02d.cjs.map +0 -1
  314. package/build/context.constants-BCpaUfFz.js.map +0 -1
  315. package/build/context.constants-BLQ_1jZI.cjs +0 -32
  316. package/build/context.constants-BLQ_1jZI.cjs.map +0 -1
  317. package/build/context.constants-Cio0nsYA.js +0 -393
  318. package/build/context.constants-Cio0nsYA.js.map +0 -1
  319. package/build/context.constants-y9s5VGN2.cjs +0 -99
  320. package/build/context.constants-y9s5VGN2.cjs.map +0 -1
  321. package/build/context.functions-80N-5MqM.cjs +0 -2
  322. package/build/context.functions-80N-5MqM.cjs.map +0 -1
  323. package/build/context.functions-BD15C8_y.js.map +0 -1
  324. package/build/context.functions-ohI9H54j.cjs +0 -2
  325. package/build/context.hooks-BIIK-2HN.js +0 -527
  326. package/build/context.hooks-BIIK-2HN.js.map +0 -1
  327. package/build/context.hooks-BzMTkJNv.js.map +0 -1
  328. package/build/context.hooks-DNnrgKb0.cjs +0 -72
  329. package/build/context.hooks-DNnrgKb0.cjs.map +0 -1
  330. package/build/context.hooks-u408Pxw8.cjs +0 -2
  331. package/build/context.hooks-u408Pxw8.cjs.map +0 -1
  332. package/build/floating-ui.react-Byi6bLb1.js +0 -1818
  333. package/build/floating-ui.react-Byi6bLb1.js.map +0 -1
  334. package/build/floating-ui.react-DZzvtpim.cjs +0 -2
  335. package/build/floating-ui.react-DZzvtpim.cjs.map +0 -1
  336. package/build/style-BzxSHZDV.js +0 -61
  337. package/build/style-BzxSHZDV.js.map +0 -1
  338. package/build/style-D8DUzG0C.cjs +0 -32
  339. package/build/style-D8DUzG0C.cjs.map +0 -1
  340. package/build/theme.global-BzunMIsv.js +0 -1318
  341. package/build/theme.global-BzunMIsv.js.map +0 -1
  342. package/build/theme.global-D67h5YeA.cjs +0 -173
  343. package/build/theme.global-D67h5YeA.cjs.map +0 -1
@@ -1,1818 +0,0 @@
1
- import * as React from "react";
2
- import { useLayoutEffect } from "react";
3
- import "./jsx-runtime-BrDlu8eK.js";
4
- import * as ReactDOM from "react-dom";
5
- function hasWindow() {
6
- return typeof window !== "undefined";
7
- }
8
- function getNodeName(node) {
9
- if (isNode(node)) {
10
- return (node.nodeName || "").toLowerCase();
11
- }
12
- return "#document";
13
- }
14
- function getWindow(node) {
15
- var _node$ownerDocument;
16
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
17
- }
18
- function getDocumentElement(node) {
19
- var _ref;
20
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
21
- }
22
- function isNode(value) {
23
- if (!hasWindow()) {
24
- return false;
25
- }
26
- return value instanceof Node || value instanceof getWindow(value).Node;
27
- }
28
- function isElement(value) {
29
- if (!hasWindow()) {
30
- return false;
31
- }
32
- return value instanceof Element || value instanceof getWindow(value).Element;
33
- }
34
- function isHTMLElement(value) {
35
- if (!hasWindow()) {
36
- return false;
37
- }
38
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
39
- }
40
- function isShadowRoot(value) {
41
- if (!hasWindow() || typeof ShadowRoot === "undefined") {
42
- return false;
43
- }
44
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
45
- }
46
- function isOverflowElement(element) {
47
- const {
48
- overflow,
49
- overflowX,
50
- overflowY,
51
- display
52
- } = getComputedStyle(element);
53
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
54
- }
55
- function isTableElement(element) {
56
- return ["table", "td", "th"].includes(getNodeName(element));
57
- }
58
- function isTopLayer(element) {
59
- return [":popover-open", ":modal"].some((selector) => {
60
- try {
61
- return element.matches(selector);
62
- } catch (e) {
63
- return false;
64
- }
65
- });
66
- }
67
- function isContainingBlock(elementOrCss) {
68
- const webkit = isWebKit();
69
- const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
70
- return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
71
- }
72
- function getContainingBlock(element) {
73
- let currentNode = getParentNode(element);
74
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
75
- if (isContainingBlock(currentNode)) {
76
- return currentNode;
77
- } else if (isTopLayer(currentNode)) {
78
- return null;
79
- }
80
- currentNode = getParentNode(currentNode);
81
- }
82
- return null;
83
- }
84
- function isWebKit() {
85
- if (typeof CSS === "undefined" || !CSS.supports) return false;
86
- return CSS.supports("-webkit-backdrop-filter", "none");
87
- }
88
- function isLastTraversableNode(node) {
89
- return ["html", "body", "#document"].includes(getNodeName(node));
90
- }
91
- function getComputedStyle(element) {
92
- return getWindow(element).getComputedStyle(element);
93
- }
94
- function getNodeScroll(element) {
95
- if (isElement(element)) {
96
- return {
97
- scrollLeft: element.scrollLeft,
98
- scrollTop: element.scrollTop
99
- };
100
- }
101
- return {
102
- scrollLeft: element.scrollX,
103
- scrollTop: element.scrollY
104
- };
105
- }
106
- function getParentNode(node) {
107
- if (getNodeName(node) === "html") {
108
- return node;
109
- }
110
- const result = (
111
- // Step into the shadow DOM of the parent of a slotted node.
112
- node.assignedSlot || // DOM Element detected.
113
- node.parentNode || // ShadowRoot detected.
114
- isShadowRoot(node) && node.host || // Fallback.
115
- getDocumentElement(node)
116
- );
117
- return isShadowRoot(result) ? result.host : result;
118
- }
119
- function getNearestOverflowAncestor(node) {
120
- const parentNode = getParentNode(node);
121
- if (isLastTraversableNode(parentNode)) {
122
- return node.ownerDocument ? node.ownerDocument.body : node.body;
123
- }
124
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
125
- return parentNode;
126
- }
127
- return getNearestOverflowAncestor(parentNode);
128
- }
129
- function getOverflowAncestors(node, list, traverseIframes) {
130
- var _node$ownerDocument2;
131
- if (list === void 0) {
132
- list = [];
133
- }
134
- if (traverseIframes === void 0) {
135
- traverseIframes = true;
136
- }
137
- const scrollableAncestor = getNearestOverflowAncestor(node);
138
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
139
- const win = getWindow(scrollableAncestor);
140
- if (isBody) {
141
- const frameElement = getFrameElement(win);
142
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
143
- }
144
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
145
- }
146
- function getFrameElement(win) {
147
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
148
- }
149
- const min = Math.min;
150
- const max = Math.max;
151
- const round = Math.round;
152
- const floor = Math.floor;
153
- const createCoords = (v) => ({
154
- x: v,
155
- y: v
156
- });
157
- const oppositeSideMap = {
158
- left: "right",
159
- right: "left",
160
- bottom: "top",
161
- top: "bottom"
162
- };
163
- const oppositeAlignmentMap = {
164
- start: "end",
165
- end: "start"
166
- };
167
- function clamp(start, value, end) {
168
- return max(start, min(value, end));
169
- }
170
- function evaluate(value, param) {
171
- return typeof value === "function" ? value(param) : value;
172
- }
173
- function getSide(placement) {
174
- return placement.split("-")[0];
175
- }
176
- function getAlignment(placement) {
177
- return placement.split("-")[1];
178
- }
179
- function getOppositeAxis(axis) {
180
- return axis === "x" ? "y" : "x";
181
- }
182
- function getAxisLength(axis) {
183
- return axis === "y" ? "height" : "width";
184
- }
185
- function getSideAxis(placement) {
186
- return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
187
- }
188
- function getAlignmentAxis(placement) {
189
- return getOppositeAxis(getSideAxis(placement));
190
- }
191
- function getAlignmentSides(placement, rects, rtl) {
192
- if (rtl === void 0) {
193
- rtl = false;
194
- }
195
- const alignment = getAlignment(placement);
196
- const alignmentAxis = getAlignmentAxis(placement);
197
- const length = getAxisLength(alignmentAxis);
198
- let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
199
- if (rects.reference[length] > rects.floating[length]) {
200
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
201
- }
202
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
203
- }
204
- function getExpandedPlacements(placement) {
205
- const oppositePlacement = getOppositePlacement(placement);
206
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
207
- }
208
- function getOppositeAlignmentPlacement(placement) {
209
- return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
210
- }
211
- function getSideList(side, isStart, rtl) {
212
- const lr = ["left", "right"];
213
- const rl = ["right", "left"];
214
- const tb = ["top", "bottom"];
215
- const bt = ["bottom", "top"];
216
- switch (side) {
217
- case "top":
218
- case "bottom":
219
- if (rtl) return isStart ? rl : lr;
220
- return isStart ? lr : rl;
221
- case "left":
222
- case "right":
223
- return isStart ? tb : bt;
224
- default:
225
- return [];
226
- }
227
- }
228
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
229
- const alignment = getAlignment(placement);
230
- let list = getSideList(getSide(placement), direction === "start", rtl);
231
- if (alignment) {
232
- list = list.map((side) => side + "-" + alignment);
233
- if (flipAlignment) {
234
- list = list.concat(list.map(getOppositeAlignmentPlacement));
235
- }
236
- }
237
- return list;
238
- }
239
- function getOppositePlacement(placement) {
240
- return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
241
- }
242
- function expandPaddingObject(padding) {
243
- return {
244
- top: 0,
245
- right: 0,
246
- bottom: 0,
247
- left: 0,
248
- ...padding
249
- };
250
- }
251
- function getPaddingObject(padding) {
252
- return typeof padding !== "number" ? expandPaddingObject(padding) : {
253
- top: padding,
254
- right: padding,
255
- bottom: padding,
256
- left: padding
257
- };
258
- }
259
- function rectToClientRect(rect) {
260
- const {
261
- x,
262
- y,
263
- width,
264
- height
265
- } = rect;
266
- return {
267
- width,
268
- height,
269
- top: y,
270
- left: x,
271
- right: x + width,
272
- bottom: y + height,
273
- x,
274
- y
275
- };
276
- }
277
- var isClient$1 = typeof document !== "undefined";
278
- var noop$1 = function noop() {
279
- };
280
- var index$1 = isClient$1 ? useLayoutEffect : noop$1;
281
- const SafeReact$1 = {
282
- ...React
283
- };
284
- const useInsertionEffect = SafeReact$1.useInsertionEffect;
285
- const useSafeInsertionEffect = useInsertionEffect || ((fn) => fn());
286
- function useEffectEvent(callback) {
287
- const ref = React.useRef(() => {
288
- if (process.env.NODE_ENV !== "production") {
289
- throw new Error("Cannot call an event handler while rendering.");
290
- }
291
- });
292
- useSafeInsertionEffect(() => {
293
- ref.current = callback;
294
- });
295
- return React.useCallback(function() {
296
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
297
- args[_key] = arguments[_key];
298
- }
299
- return ref.current == null ? void 0 : ref.current(...args);
300
- }, []);
301
- }
302
- function computeCoordsFromPlacement(_ref, placement, rtl) {
303
- let {
304
- reference,
305
- floating
306
- } = _ref;
307
- const sideAxis = getSideAxis(placement);
308
- const alignmentAxis = getAlignmentAxis(placement);
309
- const alignLength = getAxisLength(alignmentAxis);
310
- const side = getSide(placement);
311
- const isVertical = sideAxis === "y";
312
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
313
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
314
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
315
- let coords;
316
- switch (side) {
317
- case "top":
318
- coords = {
319
- x: commonX,
320
- y: reference.y - floating.height
321
- };
322
- break;
323
- case "bottom":
324
- coords = {
325
- x: commonX,
326
- y: reference.y + reference.height
327
- };
328
- break;
329
- case "right":
330
- coords = {
331
- x: reference.x + reference.width,
332
- y: commonY
333
- };
334
- break;
335
- case "left":
336
- coords = {
337
- x: reference.x - floating.width,
338
- y: commonY
339
- };
340
- break;
341
- default:
342
- coords = {
343
- x: reference.x,
344
- y: reference.y
345
- };
346
- }
347
- switch (getAlignment(placement)) {
348
- case "start":
349
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
350
- break;
351
- case "end":
352
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
353
- break;
354
- }
355
- return coords;
356
- }
357
- const computePosition$1 = async (reference, floating, config) => {
358
- const {
359
- placement = "bottom",
360
- strategy = "absolute",
361
- middleware = [],
362
- platform: platform2
363
- } = config;
364
- const validMiddleware = middleware.filter(Boolean);
365
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
366
- let rects = await platform2.getElementRects({
367
- reference,
368
- floating,
369
- strategy
370
- });
371
- let {
372
- x,
373
- y
374
- } = computeCoordsFromPlacement(rects, placement, rtl);
375
- let statefulPlacement = placement;
376
- let middlewareData = {};
377
- let resetCount = 0;
378
- for (let i = 0; i < validMiddleware.length; i++) {
379
- const {
380
- name,
381
- fn
382
- } = validMiddleware[i];
383
- const {
384
- x: nextX,
385
- y: nextY,
386
- data,
387
- reset
388
- } = await fn({
389
- x,
390
- y,
391
- initialPlacement: placement,
392
- placement: statefulPlacement,
393
- strategy,
394
- middlewareData,
395
- rects,
396
- platform: platform2,
397
- elements: {
398
- reference,
399
- floating
400
- }
401
- });
402
- x = nextX != null ? nextX : x;
403
- y = nextY != null ? nextY : y;
404
- middlewareData = {
405
- ...middlewareData,
406
- [name]: {
407
- ...middlewareData[name],
408
- ...data
409
- }
410
- };
411
- if (reset && resetCount <= 50) {
412
- resetCount++;
413
- if (typeof reset === "object") {
414
- if (reset.placement) {
415
- statefulPlacement = reset.placement;
416
- }
417
- if (reset.rects) {
418
- rects = reset.rects === true ? await platform2.getElementRects({
419
- reference,
420
- floating,
421
- strategy
422
- }) : reset.rects;
423
- }
424
- ({
425
- x,
426
- y
427
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
428
- }
429
- i = -1;
430
- }
431
- }
432
- return {
433
- x,
434
- y,
435
- placement: statefulPlacement,
436
- strategy,
437
- middlewareData
438
- };
439
- };
440
- async function detectOverflow(state, options) {
441
- var _await$platform$isEle;
442
- if (options === void 0) {
443
- options = {};
444
- }
445
- const {
446
- x,
447
- y,
448
- platform: platform2,
449
- rects,
450
- elements,
451
- strategy
452
- } = state;
453
- const {
454
- boundary = "clippingAncestors",
455
- rootBoundary = "viewport",
456
- elementContext = "floating",
457
- altBoundary = false,
458
- padding = 0
459
- } = evaluate(options, state);
460
- const paddingObject = getPaddingObject(padding);
461
- const altContext = elementContext === "floating" ? "reference" : "floating";
462
- const element = elements[altBoundary ? altContext : elementContext];
463
- const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
464
- element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
465
- boundary,
466
- rootBoundary,
467
- strategy
468
- }));
469
- const rect = elementContext === "floating" ? {
470
- x,
471
- y,
472
- width: rects.floating.width,
473
- height: rects.floating.height
474
- } : rects.reference;
475
- const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
476
- const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
477
- x: 1,
478
- y: 1
479
- } : {
480
- x: 1,
481
- y: 1
482
- };
483
- const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
484
- elements,
485
- rect,
486
- offsetParent,
487
- strategy
488
- }) : rect);
489
- return {
490
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
491
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
492
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
493
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
494
- };
495
- }
496
- const flip$2 = function(options) {
497
- if (options === void 0) {
498
- options = {};
499
- }
500
- return {
501
- name: "flip",
502
- options,
503
- async fn(state) {
504
- var _middlewareData$arrow, _middlewareData$flip;
505
- const {
506
- placement,
507
- middlewareData,
508
- rects,
509
- initialPlacement,
510
- platform: platform2,
511
- elements
512
- } = state;
513
- const {
514
- mainAxis: checkMainAxis = true,
515
- crossAxis: checkCrossAxis = true,
516
- fallbackPlacements: specifiedFallbackPlacements,
517
- fallbackStrategy = "bestFit",
518
- fallbackAxisSideDirection = "none",
519
- flipAlignment = true,
520
- ...detectOverflowOptions
521
- } = evaluate(options, state);
522
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
523
- return {};
524
- }
525
- const side = getSide(placement);
526
- const initialSideAxis = getSideAxis(initialPlacement);
527
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
528
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
529
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
530
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
531
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
532
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
533
- }
534
- const placements = [initialPlacement, ...fallbackPlacements];
535
- const overflow = await detectOverflow(state, detectOverflowOptions);
536
- const overflows = [];
537
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
538
- if (checkMainAxis) {
539
- overflows.push(overflow[side]);
540
- }
541
- if (checkCrossAxis) {
542
- const sides = getAlignmentSides(placement, rects, rtl);
543
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
544
- }
545
- overflowsData = [...overflowsData, {
546
- placement,
547
- overflows
548
- }];
549
- if (!overflows.every((side2) => side2 <= 0)) {
550
- var _middlewareData$flip2, _overflowsData$filter;
551
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
552
- const nextPlacement = placements[nextIndex];
553
- if (nextPlacement) {
554
- const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
555
- if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
556
- // overflows the main axis.
557
- overflowsData.every((d) => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
558
- return {
559
- data: {
560
- index: nextIndex,
561
- overflows: overflowsData
562
- },
563
- reset: {
564
- placement: nextPlacement
565
- }
566
- };
567
- }
568
- }
569
- let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
570
- if (!resetPlacement) {
571
- switch (fallbackStrategy) {
572
- case "bestFit": {
573
- var _overflowsData$filter2;
574
- const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
575
- if (hasFallbackAxisSideDirection) {
576
- const currentSideAxis = getSideAxis(d.placement);
577
- return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
578
- // reading directions favoring greater width.
579
- currentSideAxis === "y";
580
- }
581
- return true;
582
- }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
583
- if (placement2) {
584
- resetPlacement = placement2;
585
- }
586
- break;
587
- }
588
- case "initialPlacement":
589
- resetPlacement = initialPlacement;
590
- break;
591
- }
592
- }
593
- if (placement !== resetPlacement) {
594
- return {
595
- reset: {
596
- placement: resetPlacement
597
- }
598
- };
599
- }
600
- }
601
- return {};
602
- }
603
- };
604
- };
605
- async function convertValueToCoords(state, options) {
606
- const {
607
- placement,
608
- platform: platform2,
609
- elements
610
- } = state;
611
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
612
- const side = getSide(placement);
613
- const alignment = getAlignment(placement);
614
- const isVertical = getSideAxis(placement) === "y";
615
- const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
616
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
617
- const rawValue = evaluate(options, state);
618
- let {
619
- mainAxis,
620
- crossAxis,
621
- alignmentAxis
622
- } = typeof rawValue === "number" ? {
623
- mainAxis: rawValue,
624
- crossAxis: 0,
625
- alignmentAxis: null
626
- } : {
627
- mainAxis: rawValue.mainAxis || 0,
628
- crossAxis: rawValue.crossAxis || 0,
629
- alignmentAxis: rawValue.alignmentAxis
630
- };
631
- if (alignment && typeof alignmentAxis === "number") {
632
- crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
633
- }
634
- return isVertical ? {
635
- x: crossAxis * crossAxisMulti,
636
- y: mainAxis * mainAxisMulti
637
- } : {
638
- x: mainAxis * mainAxisMulti,
639
- y: crossAxis * crossAxisMulti
640
- };
641
- }
642
- const offset$2 = function(options) {
643
- if (options === void 0) {
644
- options = 0;
645
- }
646
- return {
647
- name: "offset",
648
- options,
649
- async fn(state) {
650
- var _middlewareData$offse, _middlewareData$arrow;
651
- const {
652
- x,
653
- y,
654
- placement,
655
- middlewareData
656
- } = state;
657
- const diffCoords = await convertValueToCoords(state, options);
658
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
659
- return {};
660
- }
661
- return {
662
- x: x + diffCoords.x,
663
- y: y + diffCoords.y,
664
- data: {
665
- ...diffCoords,
666
- placement
667
- }
668
- };
669
- }
670
- };
671
- };
672
- const shift$2 = function(options) {
673
- if (options === void 0) {
674
- options = {};
675
- }
676
- return {
677
- name: "shift",
678
- options,
679
- async fn(state) {
680
- const {
681
- x,
682
- y,
683
- placement
684
- } = state;
685
- const {
686
- mainAxis: checkMainAxis = true,
687
- crossAxis: checkCrossAxis = false,
688
- limiter = {
689
- fn: (_ref) => {
690
- let {
691
- x: x2,
692
- y: y2
693
- } = _ref;
694
- return {
695
- x: x2,
696
- y: y2
697
- };
698
- }
699
- },
700
- ...detectOverflowOptions
701
- } = evaluate(options, state);
702
- const coords = {
703
- x,
704
- y
705
- };
706
- const overflow = await detectOverflow(state, detectOverflowOptions);
707
- const crossAxis = getSideAxis(getSide(placement));
708
- const mainAxis = getOppositeAxis(crossAxis);
709
- let mainAxisCoord = coords[mainAxis];
710
- let crossAxisCoord = coords[crossAxis];
711
- if (checkMainAxis) {
712
- const minSide = mainAxis === "y" ? "top" : "left";
713
- const maxSide = mainAxis === "y" ? "bottom" : "right";
714
- const min2 = mainAxisCoord + overflow[minSide];
715
- const max2 = mainAxisCoord - overflow[maxSide];
716
- mainAxisCoord = clamp(min2, mainAxisCoord, max2);
717
- }
718
- if (checkCrossAxis) {
719
- const minSide = crossAxis === "y" ? "top" : "left";
720
- const maxSide = crossAxis === "y" ? "bottom" : "right";
721
- const min2 = crossAxisCoord + overflow[minSide];
722
- const max2 = crossAxisCoord - overflow[maxSide];
723
- crossAxisCoord = clamp(min2, crossAxisCoord, max2);
724
- }
725
- const limitedCoords = limiter.fn({
726
- ...state,
727
- [mainAxis]: mainAxisCoord,
728
- [crossAxis]: crossAxisCoord
729
- });
730
- return {
731
- ...limitedCoords,
732
- data: {
733
- x: limitedCoords.x - x,
734
- y: limitedCoords.y - y,
735
- enabled: {
736
- [mainAxis]: checkMainAxis,
737
- [crossAxis]: checkCrossAxis
738
- }
739
- }
740
- };
741
- }
742
- };
743
- };
744
- function getCssDimensions(element) {
745
- const css = getComputedStyle(element);
746
- let width = parseFloat(css.width) || 0;
747
- let height = parseFloat(css.height) || 0;
748
- const hasOffset = isHTMLElement(element);
749
- const offsetWidth = hasOffset ? element.offsetWidth : width;
750
- const offsetHeight = hasOffset ? element.offsetHeight : height;
751
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
752
- if (shouldFallback) {
753
- width = offsetWidth;
754
- height = offsetHeight;
755
- }
756
- return {
757
- width,
758
- height,
759
- $: shouldFallback
760
- };
761
- }
762
- function unwrapElement(element) {
763
- return !isElement(element) ? element.contextElement : element;
764
- }
765
- function getScale(element) {
766
- const domElement = unwrapElement(element);
767
- if (!isHTMLElement(domElement)) {
768
- return createCoords(1);
769
- }
770
- const rect = domElement.getBoundingClientRect();
771
- const {
772
- width,
773
- height,
774
- $
775
- } = getCssDimensions(domElement);
776
- let x = ($ ? round(rect.width) : rect.width) / width;
777
- let y = ($ ? round(rect.height) : rect.height) / height;
778
- if (!x || !Number.isFinite(x)) {
779
- x = 1;
780
- }
781
- if (!y || !Number.isFinite(y)) {
782
- y = 1;
783
- }
784
- return {
785
- x,
786
- y
787
- };
788
- }
789
- const noOffsets = /* @__PURE__ */ createCoords(0);
790
- function getVisualOffsets(element) {
791
- const win = getWindow(element);
792
- if (!isWebKit() || !win.visualViewport) {
793
- return noOffsets;
794
- }
795
- return {
796
- x: win.visualViewport.offsetLeft,
797
- y: win.visualViewport.offsetTop
798
- };
799
- }
800
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
801
- if (isFixed === void 0) {
802
- isFixed = false;
803
- }
804
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
805
- return false;
806
- }
807
- return isFixed;
808
- }
809
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
810
- if (includeScale === void 0) {
811
- includeScale = false;
812
- }
813
- if (isFixedStrategy === void 0) {
814
- isFixedStrategy = false;
815
- }
816
- const clientRect = element.getBoundingClientRect();
817
- const domElement = unwrapElement(element);
818
- let scale = createCoords(1);
819
- if (includeScale) {
820
- if (offsetParent) {
821
- if (isElement(offsetParent)) {
822
- scale = getScale(offsetParent);
823
- }
824
- } else {
825
- scale = getScale(element);
826
- }
827
- }
828
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
829
- let x = (clientRect.left + visualOffsets.x) / scale.x;
830
- let y = (clientRect.top + visualOffsets.y) / scale.y;
831
- let width = clientRect.width / scale.x;
832
- let height = clientRect.height / scale.y;
833
- if (domElement) {
834
- const win = getWindow(domElement);
835
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
836
- let currentWin = win;
837
- let currentIFrame = getFrameElement(currentWin);
838
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
839
- const iframeScale = getScale(currentIFrame);
840
- const iframeRect = currentIFrame.getBoundingClientRect();
841
- const css = getComputedStyle(currentIFrame);
842
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
843
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
844
- x *= iframeScale.x;
845
- y *= iframeScale.y;
846
- width *= iframeScale.x;
847
- height *= iframeScale.y;
848
- x += left;
849
- y += top;
850
- currentWin = getWindow(currentIFrame);
851
- currentIFrame = getFrameElement(currentWin);
852
- }
853
- }
854
- return rectToClientRect({
855
- width,
856
- height,
857
- x,
858
- y
859
- });
860
- }
861
- function getWindowScrollBarX(element, rect) {
862
- const leftScroll = getNodeScroll(element).scrollLeft;
863
- if (!rect) {
864
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
865
- }
866
- return rect.left + leftScroll;
867
- }
868
- function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
869
- if (ignoreScrollbarX === void 0) {
870
- ignoreScrollbarX = false;
871
- }
872
- const htmlRect = documentElement.getBoundingClientRect();
873
- const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
874
- // RTL <body> scrollbar.
875
- getWindowScrollBarX(documentElement, htmlRect)
876
- ));
877
- const y = htmlRect.top + scroll.scrollTop;
878
- return {
879
- x,
880
- y
881
- };
882
- }
883
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
884
- let {
885
- elements,
886
- rect,
887
- offsetParent,
888
- strategy
889
- } = _ref;
890
- const isFixed = strategy === "fixed";
891
- const documentElement = getDocumentElement(offsetParent);
892
- const topLayer = elements ? isTopLayer(elements.floating) : false;
893
- if (offsetParent === documentElement || topLayer && isFixed) {
894
- return rect;
895
- }
896
- let scroll = {
897
- scrollLeft: 0,
898
- scrollTop: 0
899
- };
900
- let scale = createCoords(1);
901
- const offsets = createCoords(0);
902
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
903
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
904
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
905
- scroll = getNodeScroll(offsetParent);
906
- }
907
- if (isHTMLElement(offsetParent)) {
908
- const offsetRect = getBoundingClientRect(offsetParent);
909
- scale = getScale(offsetParent);
910
- offsets.x = offsetRect.x + offsetParent.clientLeft;
911
- offsets.y = offsetRect.y + offsetParent.clientTop;
912
- }
913
- }
914
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
915
- return {
916
- width: rect.width * scale.x,
917
- height: rect.height * scale.y,
918
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
919
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
920
- };
921
- }
922
- function getClientRects(element) {
923
- return Array.from(element.getClientRects());
924
- }
925
- function getDocumentRect(element) {
926
- const html = getDocumentElement(element);
927
- const scroll = getNodeScroll(element);
928
- const body = element.ownerDocument.body;
929
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
930
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
931
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
932
- const y = -scroll.scrollTop;
933
- if (getComputedStyle(body).direction === "rtl") {
934
- x += max(html.clientWidth, body.clientWidth) - width;
935
- }
936
- return {
937
- width,
938
- height,
939
- x,
940
- y
941
- };
942
- }
943
- function getViewportRect(element, strategy) {
944
- const win = getWindow(element);
945
- const html = getDocumentElement(element);
946
- const visualViewport = win.visualViewport;
947
- let width = html.clientWidth;
948
- let height = html.clientHeight;
949
- let x = 0;
950
- let y = 0;
951
- if (visualViewport) {
952
- width = visualViewport.width;
953
- height = visualViewport.height;
954
- const visualViewportBased = isWebKit();
955
- if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
956
- x = visualViewport.offsetLeft;
957
- y = visualViewport.offsetTop;
958
- }
959
- }
960
- return {
961
- width,
962
- height,
963
- x,
964
- y
965
- };
966
- }
967
- function getInnerBoundingClientRect(element, strategy) {
968
- const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
969
- const top = clientRect.top + element.clientTop;
970
- const left = clientRect.left + element.clientLeft;
971
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
972
- const width = element.clientWidth * scale.x;
973
- const height = element.clientHeight * scale.y;
974
- const x = left * scale.x;
975
- const y = top * scale.y;
976
- return {
977
- width,
978
- height,
979
- x,
980
- y
981
- };
982
- }
983
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
984
- let rect;
985
- if (clippingAncestor === "viewport") {
986
- rect = getViewportRect(element, strategy);
987
- } else if (clippingAncestor === "document") {
988
- rect = getDocumentRect(getDocumentElement(element));
989
- } else if (isElement(clippingAncestor)) {
990
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
991
- } else {
992
- const visualOffsets = getVisualOffsets(element);
993
- rect = {
994
- x: clippingAncestor.x - visualOffsets.x,
995
- y: clippingAncestor.y - visualOffsets.y,
996
- width: clippingAncestor.width,
997
- height: clippingAncestor.height
998
- };
999
- }
1000
- return rectToClientRect(rect);
1001
- }
1002
- function hasFixedPositionAncestor(element, stopNode) {
1003
- const parentNode = getParentNode(element);
1004
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1005
- return false;
1006
- }
1007
- return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
1008
- }
1009
- function getClippingElementAncestors(element, cache) {
1010
- const cachedResult = cache.get(element);
1011
- if (cachedResult) {
1012
- return cachedResult;
1013
- }
1014
- let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
1015
- let currentContainingBlockComputedStyle = null;
1016
- const elementIsFixed = getComputedStyle(element).position === "fixed";
1017
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1018
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1019
- const computedStyle = getComputedStyle(currentNode);
1020
- const currentNodeIsContaining = isContainingBlock(currentNode);
1021
- if (!currentNodeIsContaining && computedStyle.position === "fixed") {
1022
- currentContainingBlockComputedStyle = null;
1023
- }
1024
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1025
- if (shouldDropCurrentNode) {
1026
- result = result.filter((ancestor) => ancestor !== currentNode);
1027
- } else {
1028
- currentContainingBlockComputedStyle = computedStyle;
1029
- }
1030
- currentNode = getParentNode(currentNode);
1031
- }
1032
- cache.set(element, result);
1033
- return result;
1034
- }
1035
- function getClippingRect(_ref) {
1036
- let {
1037
- element,
1038
- boundary,
1039
- rootBoundary,
1040
- strategy
1041
- } = _ref;
1042
- const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1043
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1044
- const firstClippingAncestor = clippingAncestors[0];
1045
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1046
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1047
- accRect.top = max(rect.top, accRect.top);
1048
- accRect.right = min(rect.right, accRect.right);
1049
- accRect.bottom = min(rect.bottom, accRect.bottom);
1050
- accRect.left = max(rect.left, accRect.left);
1051
- return accRect;
1052
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1053
- return {
1054
- width: clippingRect.right - clippingRect.left,
1055
- height: clippingRect.bottom - clippingRect.top,
1056
- x: clippingRect.left,
1057
- y: clippingRect.top
1058
- };
1059
- }
1060
- function getDimensions(element) {
1061
- const {
1062
- width,
1063
- height
1064
- } = getCssDimensions(element);
1065
- return {
1066
- width,
1067
- height
1068
- };
1069
- }
1070
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1071
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1072
- const documentElement = getDocumentElement(offsetParent);
1073
- const isFixed = strategy === "fixed";
1074
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1075
- let scroll = {
1076
- scrollLeft: 0,
1077
- scrollTop: 0
1078
- };
1079
- const offsets = createCoords(0);
1080
- function setLeftRTLScrollbarOffset() {
1081
- offsets.x = getWindowScrollBarX(documentElement);
1082
- }
1083
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1084
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1085
- scroll = getNodeScroll(offsetParent);
1086
- }
1087
- if (isOffsetParentAnElement) {
1088
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1089
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1090
- offsets.y = offsetRect.y + offsetParent.clientTop;
1091
- } else if (documentElement) {
1092
- setLeftRTLScrollbarOffset();
1093
- }
1094
- }
1095
- if (isFixed && !isOffsetParentAnElement && documentElement) {
1096
- setLeftRTLScrollbarOffset();
1097
- }
1098
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1099
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1100
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1101
- return {
1102
- x,
1103
- y,
1104
- width: rect.width,
1105
- height: rect.height
1106
- };
1107
- }
1108
- function isStaticPositioned(element) {
1109
- return getComputedStyle(element).position === "static";
1110
- }
1111
- function getTrueOffsetParent(element, polyfill) {
1112
- if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
1113
- return null;
1114
- }
1115
- if (polyfill) {
1116
- return polyfill(element);
1117
- }
1118
- let rawOffsetParent = element.offsetParent;
1119
- if (getDocumentElement(element) === rawOffsetParent) {
1120
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
1121
- }
1122
- return rawOffsetParent;
1123
- }
1124
- function getOffsetParent(element, polyfill) {
1125
- const win = getWindow(element);
1126
- if (isTopLayer(element)) {
1127
- return win;
1128
- }
1129
- if (!isHTMLElement(element)) {
1130
- let svgOffsetParent = getParentNode(element);
1131
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1132
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1133
- return svgOffsetParent;
1134
- }
1135
- svgOffsetParent = getParentNode(svgOffsetParent);
1136
- }
1137
- return win;
1138
- }
1139
- let offsetParent = getTrueOffsetParent(element, polyfill);
1140
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1141
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1142
- }
1143
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1144
- return win;
1145
- }
1146
- return offsetParent || getContainingBlock(element) || win;
1147
- }
1148
- const getElementRects = async function(data) {
1149
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1150
- const getDimensionsFn = this.getDimensions;
1151
- const floatingDimensions = await getDimensionsFn(data.floating);
1152
- return {
1153
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1154
- floating: {
1155
- x: 0,
1156
- y: 0,
1157
- width: floatingDimensions.width,
1158
- height: floatingDimensions.height
1159
- }
1160
- };
1161
- };
1162
- function isRTL(element) {
1163
- return getComputedStyle(element).direction === "rtl";
1164
- }
1165
- const platform = {
1166
- convertOffsetParentRelativeRectToViewportRelativeRect,
1167
- getDocumentElement,
1168
- getClippingRect,
1169
- getOffsetParent,
1170
- getElementRects,
1171
- getClientRects,
1172
- getDimensions,
1173
- getScale,
1174
- isElement,
1175
- isRTL
1176
- };
1177
- function rectsAreEqual(a, b) {
1178
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1179
- }
1180
- function observeMove(element, onMove) {
1181
- let io = null;
1182
- let timeoutId;
1183
- const root = getDocumentElement(element);
1184
- function cleanup() {
1185
- var _io;
1186
- clearTimeout(timeoutId);
1187
- (_io = io) == null || _io.disconnect();
1188
- io = null;
1189
- }
1190
- function refresh(skip, threshold) {
1191
- if (skip === void 0) {
1192
- skip = false;
1193
- }
1194
- if (threshold === void 0) {
1195
- threshold = 1;
1196
- }
1197
- cleanup();
1198
- const elementRectForRootMargin = element.getBoundingClientRect();
1199
- const {
1200
- left,
1201
- top,
1202
- width,
1203
- height
1204
- } = elementRectForRootMargin;
1205
- if (!skip) {
1206
- onMove();
1207
- }
1208
- if (!width || !height) {
1209
- return;
1210
- }
1211
- const insetTop = floor(top);
1212
- const insetRight = floor(root.clientWidth - (left + width));
1213
- const insetBottom = floor(root.clientHeight - (top + height));
1214
- const insetLeft = floor(left);
1215
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1216
- const options = {
1217
- rootMargin,
1218
- threshold: max(0, min(1, threshold)) || 1
1219
- };
1220
- let isFirstUpdate = true;
1221
- function handleObserve(entries) {
1222
- const ratio = entries[0].intersectionRatio;
1223
- if (ratio !== threshold) {
1224
- if (!isFirstUpdate) {
1225
- return refresh();
1226
- }
1227
- if (!ratio) {
1228
- timeoutId = setTimeout(() => {
1229
- refresh(false, 1e-7);
1230
- }, 1e3);
1231
- } else {
1232
- refresh(false, ratio);
1233
- }
1234
- }
1235
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1236
- refresh();
1237
- }
1238
- isFirstUpdate = false;
1239
- }
1240
- try {
1241
- io = new IntersectionObserver(handleObserve, {
1242
- ...options,
1243
- // Handle <iframe>s
1244
- root: root.ownerDocument
1245
- });
1246
- } catch (_e) {
1247
- io = new IntersectionObserver(handleObserve, options);
1248
- }
1249
- io.observe(element);
1250
- }
1251
- refresh(true);
1252
- return cleanup;
1253
- }
1254
- function autoUpdate(reference, floating, update, options) {
1255
- if (options === void 0) {
1256
- options = {};
1257
- }
1258
- const {
1259
- ancestorScroll = true,
1260
- ancestorResize = true,
1261
- elementResize = typeof ResizeObserver === "function",
1262
- layoutShift = typeof IntersectionObserver === "function",
1263
- animationFrame = false
1264
- } = options;
1265
- const referenceEl = unwrapElement(reference);
1266
- const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
1267
- ancestors.forEach((ancestor) => {
1268
- ancestorScroll && ancestor.addEventListener("scroll", update, {
1269
- passive: true
1270
- });
1271
- ancestorResize && ancestor.addEventListener("resize", update);
1272
- });
1273
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1274
- let reobserveFrame = -1;
1275
- let resizeObserver = null;
1276
- if (elementResize) {
1277
- resizeObserver = new ResizeObserver((_ref) => {
1278
- let [firstEntry] = _ref;
1279
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1280
- resizeObserver.unobserve(floating);
1281
- cancelAnimationFrame(reobserveFrame);
1282
- reobserveFrame = requestAnimationFrame(() => {
1283
- var _resizeObserver;
1284
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1285
- });
1286
- }
1287
- update();
1288
- });
1289
- if (referenceEl && !animationFrame) {
1290
- resizeObserver.observe(referenceEl);
1291
- }
1292
- resizeObserver.observe(floating);
1293
- }
1294
- let frameId;
1295
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1296
- if (animationFrame) {
1297
- frameLoop();
1298
- }
1299
- function frameLoop() {
1300
- const nextRefRect = getBoundingClientRect(reference);
1301
- if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1302
- update();
1303
- }
1304
- prevRefRect = nextRefRect;
1305
- frameId = requestAnimationFrame(frameLoop);
1306
- }
1307
- update();
1308
- return () => {
1309
- var _resizeObserver2;
1310
- ancestors.forEach((ancestor) => {
1311
- ancestorScroll && ancestor.removeEventListener("scroll", update);
1312
- ancestorResize && ancestor.removeEventListener("resize", update);
1313
- });
1314
- cleanupIo == null || cleanupIo();
1315
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1316
- resizeObserver = null;
1317
- if (animationFrame) {
1318
- cancelAnimationFrame(frameId);
1319
- }
1320
- };
1321
- }
1322
- const offset$1 = offset$2;
1323
- const shift$1 = shift$2;
1324
- const flip$1 = flip$2;
1325
- const computePosition = (reference, floating, options) => {
1326
- const cache = /* @__PURE__ */ new Map();
1327
- const mergedOptions = {
1328
- platform,
1329
- ...options
1330
- };
1331
- const platformWithCache = {
1332
- ...mergedOptions.platform,
1333
- _c: cache
1334
- };
1335
- return computePosition$1(reference, floating, {
1336
- ...mergedOptions,
1337
- platform: platformWithCache
1338
- });
1339
- };
1340
- var isClient = typeof document !== "undefined";
1341
- var noop2 = function noop3() {
1342
- };
1343
- var index = isClient ? useLayoutEffect : noop2;
1344
- function deepEqual(a, b) {
1345
- if (a === b) {
1346
- return true;
1347
- }
1348
- if (typeof a !== typeof b) {
1349
- return false;
1350
- }
1351
- if (typeof a === "function" && a.toString() === b.toString()) {
1352
- return true;
1353
- }
1354
- let length;
1355
- let i;
1356
- let keys;
1357
- if (a && b && typeof a === "object") {
1358
- if (Array.isArray(a)) {
1359
- length = a.length;
1360
- if (length !== b.length) return false;
1361
- for (i = length; i-- !== 0; ) {
1362
- if (!deepEqual(a[i], b[i])) {
1363
- return false;
1364
- }
1365
- }
1366
- return true;
1367
- }
1368
- keys = Object.keys(a);
1369
- length = keys.length;
1370
- if (length !== Object.keys(b).length) {
1371
- return false;
1372
- }
1373
- for (i = length; i-- !== 0; ) {
1374
- if (!{}.hasOwnProperty.call(b, keys[i])) {
1375
- return false;
1376
- }
1377
- }
1378
- for (i = length; i-- !== 0; ) {
1379
- const key = keys[i];
1380
- if (key === "_owner" && a.$$typeof) {
1381
- continue;
1382
- }
1383
- if (!deepEqual(a[key], b[key])) {
1384
- return false;
1385
- }
1386
- }
1387
- return true;
1388
- }
1389
- return a !== a && b !== b;
1390
- }
1391
- function getDPR(element) {
1392
- if (typeof window === "undefined") {
1393
- return 1;
1394
- }
1395
- const win = element.ownerDocument.defaultView || window;
1396
- return win.devicePixelRatio || 1;
1397
- }
1398
- function roundByDPR(element, value) {
1399
- const dpr = getDPR(element);
1400
- return Math.round(value * dpr) / dpr;
1401
- }
1402
- function useLatestRef(value) {
1403
- const ref = React.useRef(value);
1404
- index(() => {
1405
- ref.current = value;
1406
- });
1407
- return ref;
1408
- }
1409
- function useFloating$1(options) {
1410
- if (options === void 0) {
1411
- options = {};
1412
- }
1413
- const {
1414
- placement = "bottom",
1415
- strategy = "absolute",
1416
- middleware = [],
1417
- platform: platform2,
1418
- elements: {
1419
- reference: externalReference,
1420
- floating: externalFloating
1421
- } = {},
1422
- transform = true,
1423
- whileElementsMounted,
1424
- open
1425
- } = options;
1426
- const [data, setData] = React.useState({
1427
- x: 0,
1428
- y: 0,
1429
- strategy,
1430
- placement,
1431
- middlewareData: {},
1432
- isPositioned: false
1433
- });
1434
- const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
1435
- if (!deepEqual(latestMiddleware, middleware)) {
1436
- setLatestMiddleware(middleware);
1437
- }
1438
- const [_reference, _setReference] = React.useState(null);
1439
- const [_floating, _setFloating] = React.useState(null);
1440
- const setReference = React.useCallback((node) => {
1441
- if (node !== referenceRef.current) {
1442
- referenceRef.current = node;
1443
- _setReference(node);
1444
- }
1445
- }, []);
1446
- const setFloating = React.useCallback((node) => {
1447
- if (node !== floatingRef.current) {
1448
- floatingRef.current = node;
1449
- _setFloating(node);
1450
- }
1451
- }, []);
1452
- const referenceEl = externalReference || _reference;
1453
- const floatingEl = externalFloating || _floating;
1454
- const referenceRef = React.useRef(null);
1455
- const floatingRef = React.useRef(null);
1456
- const dataRef = React.useRef(data);
1457
- const hasWhileElementsMounted = whileElementsMounted != null;
1458
- const whileElementsMountedRef = useLatestRef(whileElementsMounted);
1459
- const platformRef = useLatestRef(platform2);
1460
- const openRef = useLatestRef(open);
1461
- const update = React.useCallback(() => {
1462
- if (!referenceRef.current || !floatingRef.current) {
1463
- return;
1464
- }
1465
- const config = {
1466
- placement,
1467
- strategy,
1468
- middleware: latestMiddleware
1469
- };
1470
- if (platformRef.current) {
1471
- config.platform = platformRef.current;
1472
- }
1473
- computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
1474
- const fullData = {
1475
- ...data2,
1476
- // The floating element's position may be recomputed while it's closed
1477
- // but still mounted (such as when transitioning out). To ensure
1478
- // `isPositioned` will be `false` initially on the next open, avoid
1479
- // setting it to `true` when `open === false` (must be specified).
1480
- isPositioned: openRef.current !== false
1481
- };
1482
- if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
1483
- dataRef.current = fullData;
1484
- ReactDOM.flushSync(() => {
1485
- setData(fullData);
1486
- });
1487
- }
1488
- });
1489
- }, [latestMiddleware, placement, strategy, platformRef, openRef]);
1490
- index(() => {
1491
- if (open === false && dataRef.current.isPositioned) {
1492
- dataRef.current.isPositioned = false;
1493
- setData((data2) => ({
1494
- ...data2,
1495
- isPositioned: false
1496
- }));
1497
- }
1498
- }, [open]);
1499
- const isMountedRef = React.useRef(false);
1500
- index(() => {
1501
- isMountedRef.current = true;
1502
- return () => {
1503
- isMountedRef.current = false;
1504
- };
1505
- }, []);
1506
- index(() => {
1507
- if (referenceEl) referenceRef.current = referenceEl;
1508
- if (floatingEl) floatingRef.current = floatingEl;
1509
- if (referenceEl && floatingEl) {
1510
- if (whileElementsMountedRef.current) {
1511
- return whileElementsMountedRef.current(referenceEl, floatingEl, update);
1512
- }
1513
- update();
1514
- }
1515
- }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
1516
- const refs = React.useMemo(() => ({
1517
- reference: referenceRef,
1518
- floating: floatingRef,
1519
- setReference,
1520
- setFloating
1521
- }), [setReference, setFloating]);
1522
- const elements = React.useMemo(() => ({
1523
- reference: referenceEl,
1524
- floating: floatingEl
1525
- }), [referenceEl, floatingEl]);
1526
- const floatingStyles = React.useMemo(() => {
1527
- const initialStyles = {
1528
- position: strategy,
1529
- left: 0,
1530
- top: 0
1531
- };
1532
- if (!elements.floating) {
1533
- return initialStyles;
1534
- }
1535
- const x = roundByDPR(elements.floating, data.x);
1536
- const y = roundByDPR(elements.floating, data.y);
1537
- if (transform) {
1538
- return {
1539
- ...initialStyles,
1540
- transform: "translate(" + x + "px, " + y + "px)",
1541
- ...getDPR(elements.floating) >= 1.5 && {
1542
- willChange: "transform"
1543
- }
1544
- };
1545
- }
1546
- return {
1547
- position: strategy,
1548
- left: x,
1549
- top: y
1550
- };
1551
- }, [strategy, transform, elements.floating, data.x, data.y]);
1552
- return React.useMemo(() => ({
1553
- ...data,
1554
- update,
1555
- refs,
1556
- elements,
1557
- floatingStyles
1558
- }), [data, update, refs, elements, floatingStyles]);
1559
- }
1560
- const offset = (options, deps) => ({
1561
- ...offset$1(options),
1562
- options: [options, deps]
1563
- });
1564
- const shift = (options, deps) => ({
1565
- ...shift$1(options),
1566
- options: [options, deps]
1567
- });
1568
- const flip = (options, deps) => ({
1569
- ...flip$1(options),
1570
- options: [options, deps]
1571
- });
1572
- function useMergeRefs(refs) {
1573
- const cleanupRef = React.useRef(void 0);
1574
- const refEffect = React.useCallback((instance) => {
1575
- const cleanups = refs.map((ref) => {
1576
- if (ref == null) {
1577
- return;
1578
- }
1579
- if (typeof ref === "function") {
1580
- const refCallback = ref;
1581
- const refCleanup = refCallback(instance);
1582
- return typeof refCleanup === "function" ? refCleanup : () => {
1583
- refCallback(null);
1584
- };
1585
- }
1586
- ref.current = instance;
1587
- return () => {
1588
- ref.current = null;
1589
- };
1590
- });
1591
- return () => {
1592
- cleanups.forEach((refCleanup) => refCleanup == null ? void 0 : refCleanup());
1593
- };
1594
- }, refs);
1595
- return React.useMemo(() => {
1596
- if (refs.every((ref) => ref == null)) {
1597
- return null;
1598
- }
1599
- return (value) => {
1600
- if (cleanupRef.current) {
1601
- cleanupRef.current();
1602
- cleanupRef.current = void 0;
1603
- }
1604
- if (value != null) {
1605
- cleanupRef.current = refEffect(value);
1606
- }
1607
- };
1608
- }, refs);
1609
- }
1610
- const SafeReact = {
1611
- ...React
1612
- };
1613
- let serverHandoffComplete = false;
1614
- let count = 0;
1615
- const genId = () => (
1616
- // Ensure the id is unique with multiple independent versions of Floating UI
1617
- // on <React 18
1618
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + count++
1619
- );
1620
- function useFloatingId() {
1621
- const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : void 0);
1622
- index$1(() => {
1623
- if (id == null) {
1624
- setId(genId());
1625
- }
1626
- }, []);
1627
- React.useEffect(() => {
1628
- serverHandoffComplete = true;
1629
- }, []);
1630
- return id;
1631
- }
1632
- const useReactId = SafeReact.useId;
1633
- const useId = useReactId || useFloatingId;
1634
- let devMessageSet;
1635
- if (process.env.NODE_ENV !== "production") {
1636
- devMessageSet = /* @__PURE__ */ new Set();
1637
- }
1638
- function error() {
1639
- var _devMessageSet3;
1640
- for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1641
- messages[_key2] = arguments[_key2];
1642
- }
1643
- const message = "Floating UI: " + messages.join(" ");
1644
- if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
1645
- var _devMessageSet4;
1646
- (_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
1647
- console.error(message);
1648
- }
1649
- }
1650
- function createEventEmitter() {
1651
- const map = /* @__PURE__ */ new Map();
1652
- return {
1653
- emit(event, data) {
1654
- var _map$get;
1655
- (_map$get = map.get(event)) == null || _map$get.forEach((listener) => listener(data));
1656
- },
1657
- on(event, listener) {
1658
- if (!map.has(event)) {
1659
- map.set(event, /* @__PURE__ */ new Set());
1660
- }
1661
- map.get(event).add(listener);
1662
- },
1663
- off(event, listener) {
1664
- var _map$get2;
1665
- (_map$get2 = map.get(event)) == null || _map$get2.delete(listener);
1666
- }
1667
- };
1668
- }
1669
- const FloatingNodeContext = /* @__PURE__ */ React.createContext(null);
1670
- const FloatingTreeContext = /* @__PURE__ */ React.createContext(null);
1671
- const useFloatingParentNodeId = () => {
1672
- var _React$useContext;
1673
- return ((_React$useContext = React.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
1674
- };
1675
- const useFloatingTree = () => React.useContext(FloatingTreeContext);
1676
- function useFloatingRootContext(options) {
1677
- const {
1678
- open = false,
1679
- onOpenChange: onOpenChangeProp,
1680
- elements: elementsProp
1681
- } = options;
1682
- const floatingId = useId();
1683
- const dataRef = React.useRef({});
1684
- const [events] = React.useState(() => createEventEmitter());
1685
- const nested = useFloatingParentNodeId() != null;
1686
- if (process.env.NODE_ENV !== "production") {
1687
- const optionDomReference = elementsProp.reference;
1688
- if (optionDomReference && !isElement(optionDomReference)) {
1689
- error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
1690
- }
1691
- }
1692
- const [positionReference, setPositionReference] = React.useState(elementsProp.reference);
1693
- const onOpenChange = useEffectEvent((open2, event, reason) => {
1694
- dataRef.current.openEvent = open2 ? event : void 0;
1695
- events.emit("openchange", {
1696
- open: open2,
1697
- event,
1698
- reason,
1699
- nested
1700
- });
1701
- onOpenChangeProp == null || onOpenChangeProp(open2, event, reason);
1702
- });
1703
- const refs = React.useMemo(() => ({
1704
- setPositionReference
1705
- }), []);
1706
- const elements = React.useMemo(() => ({
1707
- reference: positionReference || elementsProp.reference || null,
1708
- floating: elementsProp.floating || null,
1709
- domReference: elementsProp.reference
1710
- }), [positionReference, elementsProp.reference, elementsProp.floating]);
1711
- return React.useMemo(() => ({
1712
- dataRef,
1713
- open,
1714
- onOpenChange,
1715
- elements,
1716
- events,
1717
- floatingId,
1718
- refs
1719
- }), [open, onOpenChange, elements, events, floatingId, refs]);
1720
- }
1721
- function useFloating(options) {
1722
- if (options === void 0) {
1723
- options = {};
1724
- }
1725
- const {
1726
- nodeId
1727
- } = options;
1728
- const internalRootContext = useFloatingRootContext({
1729
- ...options,
1730
- elements: {
1731
- reference: null,
1732
- floating: null,
1733
- ...options.elements
1734
- }
1735
- });
1736
- const rootContext = options.rootContext || internalRootContext;
1737
- const computedElements = rootContext.elements;
1738
- const [_domReference, setDomReference] = React.useState(null);
1739
- const [positionReference, _setPositionReference] = React.useState(null);
1740
- const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;
1741
- const domReference = optionDomReference || _domReference;
1742
- const domReferenceRef = React.useRef(null);
1743
- const tree = useFloatingTree();
1744
- index$1(() => {
1745
- if (domReference) {
1746
- domReferenceRef.current = domReference;
1747
- }
1748
- }, [domReference]);
1749
- const position = useFloating$1({
1750
- ...options,
1751
- elements: {
1752
- ...computedElements,
1753
- ...positionReference && {
1754
- reference: positionReference
1755
- }
1756
- }
1757
- });
1758
- const setPositionReference = React.useCallback((node) => {
1759
- const computedPositionReference = isElement(node) ? {
1760
- getBoundingClientRect: () => node.getBoundingClientRect(),
1761
- getClientRects: () => node.getClientRects(),
1762
- contextElement: node
1763
- } : node;
1764
- _setPositionReference(computedPositionReference);
1765
- position.refs.setReference(computedPositionReference);
1766
- }, [position.refs]);
1767
- const setReference = React.useCallback((node) => {
1768
- if (isElement(node) || node === null) {
1769
- domReferenceRef.current = node;
1770
- setDomReference(node);
1771
- }
1772
- if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1773
- // `null` to support `positionReference` + an unstable `reference`
1774
- // callback ref.
1775
- node !== null && !isElement(node)) {
1776
- position.refs.setReference(node);
1777
- }
1778
- }, [position.refs]);
1779
- const refs = React.useMemo(() => ({
1780
- ...position.refs,
1781
- setReference,
1782
- setPositionReference,
1783
- domReference: domReferenceRef
1784
- }), [position.refs, setReference, setPositionReference]);
1785
- const elements = React.useMemo(() => ({
1786
- ...position.elements,
1787
- domReference
1788
- }), [position.elements, domReference]);
1789
- const context = React.useMemo(() => ({
1790
- ...position,
1791
- ...rootContext,
1792
- refs,
1793
- elements,
1794
- nodeId
1795
- }), [position, refs, elements, nodeId, rootContext]);
1796
- index$1(() => {
1797
- rootContext.dataRef.current.floatingContext = context;
1798
- const node = tree == null ? void 0 : tree.nodesRef.current.find((node2) => node2.id === nodeId);
1799
- if (node) {
1800
- node.context = context;
1801
- }
1802
- });
1803
- return React.useMemo(() => ({
1804
- ...position,
1805
- context,
1806
- refs,
1807
- elements
1808
- }), [position, refs, elements, context]);
1809
- }
1810
- export {
1811
- useFloating as a,
1812
- autoUpdate as b,
1813
- flip as f,
1814
- offset as o,
1815
- shift as s,
1816
- useMergeRefs as u
1817
- };
1818
- //# sourceMappingURL=floating-ui.react-Byi6bLb1.js.map