@swisspost/design-system-components 10.0.0-next.55 → 10.0.0-next.57

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 (443) hide show
  1. package/dist/{components/react/p-CJ80BZ06.js → cjs/breakpoints-Df03Ct7n.js} +103 -5
  2. package/dist/cjs/debounce-BsIBi_-2.js +13 -0
  3. package/dist/cjs/environment-BQE9Unf_.js +52 -0
  4. package/dist/cjs/{event-from-CLvtSUKf.js → event-from-CwMw19f8.js} +2 -2
  5. package/dist/cjs/fade-CPQhl1fP.js +26 -0
  6. package/dist/cjs/fade-slide-dPhQa-I1.js +38 -0
  7. package/dist/cjs/{get-focusable-children-Bx63XUQg.js → get-focusable-children-ChETM1wK.js} +29 -21
  8. package/dist/cjs/{get-root-CyMf3Vsd.js → get-root-CUAv4k4C.js} +2 -2
  9. package/dist/cjs/{index-B4gYpuJF.js → index-B4rc1pqu.js} +2150 -292
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/{package-DkJrv93P.js → package-uQ5oiSiN.js} +1 -1
  12. package/dist/cjs/post-accordion_2.cjs.entry.js +19 -15
  13. package/dist/cjs/post-avatar.cjs.entry.js +27 -17
  14. package/dist/cjs/post-back-to-top.cjs.entry.js +23 -43
  15. package/dist/cjs/post-banner.cjs.entry.js +15 -12
  16. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +14 -12
  17. package/dist/cjs/post-breadcrumbs.cjs.entry.js +33 -34
  18. package/dist/cjs/post-card-control.cjs.entry.js +42 -26
  19. package/dist/cjs/{post-closebutton_15.cjs.entry.js → post-closebutton_13.cjs.entry.js} +618 -531
  20. package/dist/cjs/post-collapsible_2.cjs.entry.js +41 -37
  21. package/dist/cjs/post-components.cjs.js +3 -3
  22. package/dist/cjs/post-env-test.cjs.entry.js +15 -0
  23. package/dist/cjs/post-footer.cjs.entry.js +24 -20
  24. package/dist/cjs/post-linkarea.cjs.entry.js +5 -5
  25. package/dist/cjs/post-pagination.cjs.entry.js +615 -0
  26. package/dist/cjs/post-popover-trigger.cjs.entry.js +54 -34
  27. package/dist/cjs/post-popover.cjs.entry.js +26 -17
  28. package/dist/cjs/post-rating.cjs.entry.js +24 -18
  29. package/dist/cjs/post-stepper-item.cjs.entry.js +5 -5
  30. package/dist/cjs/post-stepper.cjs.entry.js +40 -29
  31. package/dist/cjs/post-tab-item.cjs.entry.js +51 -0
  32. package/dist/cjs/post-tab-panel.cjs.entry.js +13 -11
  33. package/dist/cjs/post-tabs.cjs.entry.js +195 -40
  34. package/dist/cjs/post-tooltip-trigger.cjs.entry.js +13 -11
  35. package/dist/cjs/post-tooltip.cjs.entry.js +14 -12
  36. package/dist/cjs/utils-s05L2ulk.js +26 -0
  37. package/dist/collection/animations/collapse.js +3 -3
  38. package/dist/collection/animations/fade-slide.js +33 -0
  39. package/dist/collection/animations/fade.js +19 -7
  40. package/dist/collection/animations/index.js +2 -0
  41. package/dist/collection/animations/slide.js +25 -21
  42. package/dist/collection/animations/types.js +14 -0
  43. package/dist/collection/animations/utils.js +8 -0
  44. package/dist/collection/collection-manifest.json +8 -8
  45. package/dist/collection/components/post-accordion/post-accordion.css +1 -1
  46. package/dist/collection/components/post-accordion/post-accordion.js +5 -4
  47. package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
  48. package/dist/collection/components/post-accordion-item/post-accordion-item.js +9 -8
  49. package/dist/collection/components/post-avatar/post-avatar.js +11 -11
  50. package/dist/collection/components/post-back-to-top/post-back-to-top.js +15 -15
  51. package/dist/collection/components/post-banner/post-banner.css +4 -1
  52. package/dist/collection/components/post-banner/post-banner.js +6 -5
  53. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +3 -3
  54. package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +29 -29
  55. package/dist/collection/components/post-card-control/post-card-control.js +18 -18
  56. package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
  57. package/dist/collection/components/post-closebutton/post-closebutton.js +4 -3
  58. package/dist/collection/components/post-collapsible/post-collapsible.js +28 -28
  59. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +3 -3
  60. package/dist/collection/components/post-footer/post-footer.css +1 -1
  61. package/dist/collection/components/post-footer/post-footer.js +18 -16
  62. package/dist/collection/components/post-header/post-header.css +1 -1
  63. package/dist/collection/components/post-header/post-header.js +144 -82
  64. package/dist/collection/components/post-icon/post-icon.js +18 -16
  65. package/dist/collection/components/post-language-menu/post-language-menu.css +1 -0
  66. package/dist/collection/components/{post-language-switch/post-language-switch.js → post-language-menu/post-language-menu.js} +45 -36
  67. package/dist/collection/components/post-language-menu-item/post-language-menu-item.css +1 -0
  68. package/dist/collection/components/{post-language-option/post-language-option.js → post-language-menu-item/post-language-menu-item.js} +24 -23
  69. package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
  70. package/dist/collection/components/post-logo/post-logo.css +3 -1
  71. package/dist/collection/components/post-logo/post-logo.js +3 -3
  72. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
  73. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +41 -29
  74. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
  75. package/dist/collection/components/post-megadropdown/post-megadropdown.js +183 -74
  76. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +3 -1
  77. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +81 -75
  78. package/dist/collection/components/post-menu/post-menu.css +1 -1
  79. package/dist/collection/components/post-menu/post-menu.js +39 -38
  80. package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
  81. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +3 -3
  82. package/dist/collection/components/post-pagination/post-pagination.css +1 -0
  83. package/dist/collection/components/post-pagination/post-pagination.js +838 -0
  84. package/dist/collection/components/post-popover/post-popover.js +22 -16
  85. package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +45 -29
  86. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
  87. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +82 -131
  88. package/dist/collection/components/post-rating/post-rating.js +7 -7
  89. package/dist/collection/components/post-stepper/post-stepper.js +38 -35
  90. package/dist/collection/components/post-stepper-item/post-stepper-item.css +2 -2
  91. package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
  92. package/dist/collection/components/post-tab-item/post-tab-item.css +1 -0
  93. package/dist/collection/components/post-tab-item/post-tab-item.js +86 -0
  94. package/dist/collection/components/post-tab-panel/post-tab-panel.js +10 -10
  95. package/dist/collection/components/post-tabs/post-tabs.js +232 -59
  96. package/dist/collection/components/post-togglebutton/post-togglebutton.js +2 -2
  97. package/dist/collection/components/post-tooltip/post-tooltip.js +9 -27
  98. package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +4 -4
  99. package/dist/collection/utils/environment.js +47 -2
  100. package/dist/collection/utils/event-from.js +2 -2
  101. package/dist/collection/utils/get-focusable-children.js +29 -21
  102. package/dist/collection/utils/is-motion-reduced.js +1 -1
  103. package/dist/collection/utils/tests/environment/hydrate-app-helper.js +16 -0
  104. package/dist/collection/utils/tests/environment/post-env-test.js +9 -0
  105. package/dist/component-names.json +4 -5
  106. package/dist/components/breakpoints.js +1 -178
  107. package/dist/components/debounce.js +1 -0
  108. package/dist/components/environment.js +1 -0
  109. package/dist/components/event-from.js +1 -119
  110. package/dist/components/fade-slide.js +1 -0
  111. package/dist/components/fade.js +1 -11
  112. package/dist/components/focusable.js +1 -5018
  113. package/dist/components/get-focusable-children.js +1 -64
  114. package/dist/components/get-root.js +1 -15
  115. package/dist/components/heading-levels.js +1 -3
  116. package/dist/components/index.browser.js +1 -14
  117. package/dist/components/index.d.ts +11 -10
  118. package/dist/components/index.js +1 -39
  119. package/dist/components/long-press-event.js +1 -257
  120. package/dist/components/package.js +1 -3
  121. package/dist/components/post-accordion-item.js +1 -6
  122. package/dist/components/post-accordion-item2.js +1 -113
  123. package/dist/components/post-accordion.js +1 -6
  124. package/dist/components/post-accordion2.js +1 -138
  125. package/dist/components/post-avatar.js +1 -217
  126. package/dist/components/post-back-to-top.js +1 -144
  127. package/dist/components/post-banner.js +1 -98
  128. package/dist/components/post-breadcrumb-item.js +1 -6
  129. package/dist/components/post-breadcrumb-item2.js +1 -79
  130. package/dist/components/post-breadcrumbs.js +1 -196
  131. package/dist/components/post-card-control.js +1 -326
  132. package/dist/components/post-closebutton.js +1 -6
  133. package/dist/components/post-closebutton2.js +1 -77
  134. package/dist/components/post-collapsible-trigger.js +1 -6
  135. package/dist/components/post-collapsible-trigger2.js +1 -136
  136. package/dist/components/post-collapsible.js +1 -6
  137. package/dist/components/post-collapsible2.js +1 -110
  138. package/dist/components/{post-list.d.ts → post-env-test.d.ts} +4 -4
  139. package/dist/components/post-env-test.js +1 -0
  140. package/dist/components/post-footer.js +1 -116
  141. package/dist/components/post-header.js +1 -372
  142. package/dist/components/post-icon.js +1 -6
  143. package/dist/components/post-icon2.js +1 -159
  144. package/dist/components/post-language-menu-item.d.ts +11 -0
  145. package/dist/components/post-language-menu-item.js +1 -0
  146. package/dist/components/{post-language-switch.d.ts → post-language-menu.d.ts} +4 -4
  147. package/dist/components/post-language-menu.js +1 -0
  148. package/dist/components/post-linkarea.js +1 -58
  149. package/dist/components/post-logo.js +1 -58
  150. package/dist/components/post-mainnavigation.js +1 -180
  151. package/dist/components/post-megadropdown-trigger.js +1 -136
  152. package/dist/components/post-megadropdown.js +1 -267
  153. package/dist/components/post-menu-item.js +1 -6
  154. package/dist/components/post-menu-item2.js +1 -30
  155. package/dist/components/post-menu-trigger.js +1 -6
  156. package/dist/components/post-menu-trigger2.js +1 -110
  157. package/dist/components/post-menu.js +1 -6
  158. package/dist/components/post-menu2.js +1 -242
  159. package/dist/components/{post-tab-header.d.ts → post-pagination.d.ts} +4 -4
  160. package/dist/components/post-pagination.js +1 -0
  161. package/dist/components/post-popover-trigger.js +1 -132
  162. package/dist/components/post-popover.js +1 -118
  163. package/dist/components/post-popovercontainer.js +1 -6
  164. package/dist/components/post-popovercontainer2.js +1 -3127
  165. package/dist/components/post-rating.js +1 -148
  166. package/dist/components/post-stepper-item.js +1 -33
  167. package/dist/components/post-stepper.js +1 -134
  168. package/dist/components/{post-list-item.d.ts → post-tab-item.d.ts} +4 -4
  169. package/dist/components/post-tab-item.js +1 -0
  170. package/dist/components/post-tab-panel.js +1 -54
  171. package/dist/components/post-tabs.js +1 -196
  172. package/dist/components/post-togglebutton.js +1 -56
  173. package/dist/components/post-togglebutton2.js +1 -0
  174. package/dist/components/post-tooltip-trigger.js +1 -206
  175. package/dist/components/post-tooltip.js +1 -114
  176. package/dist/components/react/index.d.ts +2 -0
  177. package/dist/components/react/index.js +1 -2315
  178. package/dist/components/react/p-B8YiQ3mz.js +1 -0
  179. package/dist/components/react/p-BC5nlBvn.js +1 -0
  180. package/dist/components/react/p-BLchVpF6.js +1 -14
  181. package/dist/components/react/p-BVCjnh6Q.js +1 -0
  182. package/dist/{post-components/p-CBFgkSgY.js → components/react/p-BVGcVycs.js} +1 -1
  183. package/dist/components/react/p-B_XPj2c8.js +1 -0
  184. package/dist/components/react/p-BllOMLDs.js +1 -0
  185. package/dist/components/react/p-BmRNjQUZ.js +1 -0
  186. package/dist/components/react/p-ByFh05IW.js +1 -0
  187. package/dist/components/react/p-C9hMpmsD.js +1 -0
  188. package/dist/components/react/p-CJ13r5fi.js +1 -0
  189. package/dist/components/react/p-CZvbetqX.js +1 -0
  190. package/dist/components/react/p-C_2k3G1c.js +1 -257
  191. package/dist/components/react/p-CoDiS_Ik.js +1 -0
  192. package/dist/components/react/p-Cou17ld8.js +1 -0
  193. package/dist/components/react/p-D5knoiyy.js +1 -0
  194. package/dist/components/react/p-D9DDtvFM.js +1 -0
  195. package/dist/components/react/p-DY2U5CQt.js +1 -0
  196. package/dist/components/react/p-DjIHLduJ.js +1 -3
  197. package/dist/components/react/p-DpATRD2W.js +1 -0
  198. package/dist/components/react/p-FxUVQ4Tx.js +1 -0
  199. package/dist/components/react/p-HygIVKXC.js +1 -5018
  200. package/dist/components/react/p-YR7U0Z_g.js +1 -0
  201. package/dist/components/react/p-ZeKXASQs.js +1 -0
  202. package/dist/components/react/p-r4txK0AC.js +1 -3
  203. package/dist/components/react/p-sSn0kXFi.js +1 -0
  204. package/dist/components/react/post-accordion-item.js +1 -6
  205. package/dist/components/react/post-accordion.js +1 -6
  206. package/dist/components/react/post-avatar.js +1 -218
  207. package/dist/components/react/post-back-to-top.js +1 -145
  208. package/dist/components/react/post-banner.js +1 -99
  209. package/dist/components/react/post-breadcrumb-item.js +1 -6
  210. package/dist/components/react/post-breadcrumbs.js +1 -197
  211. package/dist/components/react/post-card-control.js +1 -327
  212. package/dist/components/react/post-closebutton.js +1 -6
  213. package/dist/components/react/post-collapsible-trigger.js +1 -6
  214. package/dist/components/react/post-collapsible.js +1 -6
  215. package/dist/components/react/{post-list.d.ts → post-env-test.d.ts} +4 -4
  216. package/dist/components/react/post-env-test.js +1 -0
  217. package/dist/components/react/post-footer.js +1 -117
  218. package/dist/components/react/post-header.js +1 -373
  219. package/dist/components/react/post-icon.js +1 -6
  220. package/dist/components/react/post-language-menu-item.d.ts +11 -0
  221. package/dist/components/react/post-language-menu-item.js +1 -0
  222. package/dist/components/react/{post-language-option.d.ts → post-language-menu.d.ts} +4 -4
  223. package/dist/components/react/post-language-menu.js +1 -0
  224. package/dist/components/react/post-linkarea.js +1 -59
  225. package/dist/components/react/post-logo.js +1 -59
  226. package/dist/components/react/post-mainnavigation.js +1 -181
  227. package/dist/components/react/post-megadropdown-trigger.js +1 -137
  228. package/dist/components/react/post-megadropdown.js +1 -268
  229. package/dist/components/react/post-menu-item.js +1 -6
  230. package/dist/components/react/post-menu-trigger.js +1 -6
  231. package/dist/components/react/post-menu.js +1 -6
  232. package/dist/components/react/{post-tab-header.d.ts → post-pagination.d.ts} +4 -4
  233. package/dist/components/react/post-pagination.js +1 -0
  234. package/dist/components/react/post-popover-trigger.js +1 -133
  235. package/dist/components/react/post-popover.js +1 -119
  236. package/dist/components/react/post-popovercontainer.js +1 -6
  237. package/dist/components/react/post-rating.js +1 -149
  238. package/dist/components/react/post-stepper-item.js +1 -34
  239. package/dist/components/react/post-stepper.js +1 -135
  240. package/dist/components/react/{post-list-item.d.ts → post-tab-item.d.ts} +4 -4
  241. package/dist/components/react/post-tab-item.js +1 -0
  242. package/dist/components/react/post-tab-panel.js +1 -55
  243. package/dist/components/react/post-tabs.js +1 -197
  244. package/dist/components/react/post-togglebutton.js +1 -57
  245. package/dist/components/react/post-tooltip-trigger.js +1 -207
  246. package/dist/components/react/post-tooltip.js +1 -115
  247. package/dist/components/switch-variants.js +1 -3
  248. package/dist/components/utils.js +1 -0
  249. package/dist/docs.d.ts +11 -0
  250. package/dist/docs.json +873 -631
  251. package/dist/{cjs/breakpoints-CEkeixld.js → esm/breakpoints-DYoSKGHO.js} +89 -6
  252. package/dist/esm/debounce-C9hMpmsD.js +11 -0
  253. package/dist/esm/environment-CEmnRoA6.js +49 -0
  254. package/dist/{components/react/p-CzIKqBrS.js → esm/event-from-rEfV4v4a.js} +2 -2
  255. package/dist/esm/fade-DsgPYmAa.js +24 -0
  256. package/dist/esm/fade-slide-CvOvauo9.js +36 -0
  257. package/dist/esm/{get-focusable-children-D9ZHp2FP.js → get-focusable-children-BXNs2_sw.js} +29 -21
  258. package/dist/{components/react/p-CBFgkSgY.js → esm/get-root-CXfAA093.js} +1 -1
  259. package/dist/esm/{index-wEFJ-c34.js → index-CDZBzSdV.js} +2150 -292
  260. package/dist/esm/loader.js +3 -3
  261. package/dist/esm/package-CZvbetqX.js +3 -0
  262. package/dist/esm/post-accordion_2.entry.js +17 -13
  263. package/dist/esm/post-avatar.entry.js +22 -12
  264. package/dist/esm/post-back-to-top.entry.js +23 -43
  265. package/dist/esm/post-banner.entry.js +14 -11
  266. package/dist/esm/post-breadcrumb-item_2.entry.js +13 -11
  267. package/dist/esm/post-breadcrumbs.entry.js +31 -32
  268. package/dist/esm/post-card-control.entry.js +32 -16
  269. package/dist/esm/{post-closebutton_15.entry.js → post-closebutton_13.entry.js} +599 -510
  270. package/dist/esm/post-collapsible_2.entry.js +38 -34
  271. package/dist/esm/post-components.js +4 -4
  272. package/dist/esm/post-env-test.entry.js +13 -0
  273. package/dist/esm/post-footer.entry.js +21 -17
  274. package/dist/esm/post-linkarea.entry.js +5 -5
  275. package/dist/esm/post-pagination.entry.js +613 -0
  276. package/dist/esm/post-popover-trigger.entry.js +52 -32
  277. package/dist/esm/post-popover.entry.js +25 -16
  278. package/dist/esm/post-rating.entry.js +16 -10
  279. package/dist/esm/post-stepper-item.entry.js +5 -5
  280. package/dist/esm/post-stepper.entry.js +39 -28
  281. package/dist/esm/post-tab-item.entry.js +49 -0
  282. package/dist/esm/post-tab-panel.entry.js +13 -11
  283. package/dist/esm/post-tabs.entry.js +195 -40
  284. package/dist/esm/post-tooltip-trigger.entry.js +10 -8
  285. package/dist/esm/post-tooltip.entry.js +13 -11
  286. package/dist/esm/utils-CoDiS_Ik.js +24 -0
  287. package/dist/post-components/p-09ba7cf9.entry.js +1 -0
  288. package/dist/post-components/p-0c091898.entry.js +1 -0
  289. package/dist/post-components/{p-cd03e6f2.entry.js → p-0e97fcfd.entry.js} +1 -1
  290. package/dist/post-components/p-296f1dd5.entry.js +1 -0
  291. package/dist/post-components/p-32ad2b21.entry.js +1 -0
  292. package/dist/post-components/p-366c28cb.entry.js +1 -0
  293. package/dist/post-components/p-41ae68d5.entry.js +1 -0
  294. package/dist/post-components/p-448e7265.entry.js +1 -0
  295. package/dist/post-components/p-554da188.entry.js +1 -0
  296. package/dist/post-components/p-5912f8f1.entry.js +1 -0
  297. package/dist/post-components/p-790f300d.entry.js +1 -0
  298. package/dist/post-components/p-7ed5a493.entry.js +1 -0
  299. package/dist/post-components/p-85bea1b6.entry.js +1 -0
  300. package/dist/post-components/p-8bcff4d2.entry.js +1 -0
  301. package/dist/post-components/p-9dc9c245.entry.js +1 -0
  302. package/dist/post-components/p-B7ebLhHc.js +1 -0
  303. package/dist/post-components/p-BVCjnh6Q.js +1 -0
  304. package/dist/post-components/p-BXNs2_sw.js +1 -0
  305. package/dist/post-components/p-C9hMpmsD.js +1 -0
  306. package/dist/post-components/p-CDZBzSdV.js +2 -0
  307. package/dist/post-components/p-CEmnRoA6.js +1 -0
  308. package/dist/post-components/p-CZvbetqX.js +1 -0
  309. package/dist/post-components/p-CoDiS_Ik.js +1 -0
  310. package/dist/post-components/p-D5knoiyy.js +1 -0
  311. package/dist/post-components/p-DI-h_mEL.js +1 -0
  312. package/dist/post-components/p-a06f9695.entry.js +1 -0
  313. package/dist/post-components/p-a191f1df.entry.js +1 -0
  314. package/dist/post-components/p-c5d19d62.entry.js +1 -0
  315. package/dist/post-components/{p-24dc54d1.entry.js → p-c8c4d05b.entry.js} +1 -1
  316. package/dist/post-components/{p-57288cb2.entry.js → p-d1a5c980.entry.js} +1 -1
  317. package/dist/post-components/p-d4e2c556.entry.js +1 -0
  318. package/dist/post-components/p-f96a310c.entry.js +1 -0
  319. package/dist/post-components/p-fab2327d.entry.js +1 -0
  320. package/dist/post-components/p-rEfV4v4a.js +1 -0
  321. package/dist/post-components/post-components.css +1 -1
  322. package/dist/post-components/post-components.esm.js +1 -1
  323. package/dist/prebuild.js +46 -0
  324. package/dist/types/animations/collapse.d.ts +1 -0
  325. package/dist/types/animations/fade-slide.d.ts +11 -0
  326. package/dist/types/animations/fade.d.ts +2 -2
  327. package/dist/types/animations/index.d.ts +2 -0
  328. package/dist/types/animations/slide.d.ts +9 -2
  329. package/dist/types/animations/types.d.ts +13 -0
  330. package/dist/types/animations/utils.d.ts +2 -0
  331. package/dist/types/components/post-accordion-item/heading-levels.d.ts +1 -1
  332. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +2 -2
  333. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +2 -2
  334. package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +6 -6
  335. package/dist/types/components/post-collapsible/post-collapsible.d.ts +4 -5
  336. package/dist/types/components/post-footer/post-footer.d.ts +4 -4
  337. package/dist/types/components/post-header/post-header.d.ts +23 -13
  338. package/dist/types/components/{post-language-switch/post-language-switch.d.ts → post-language-menu/post-language-menu.d.ts} +12 -11
  339. package/dist/types/components/{post-language-option/post-language-option.d.ts → post-language-menu-item/post-language-menu-item.d.ts} +5 -5
  340. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +6 -5
  341. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +20 -2
  342. package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +17 -23
  343. package/dist/types/components/post-menu/post-menu.d.ts +4 -4
  344. package/dist/types/components/post-pagination/post-pagination.d.ts +224 -0
  345. package/dist/types/components/post-popover/post-popover.d.ts +4 -3
  346. package/dist/types/components/post-popover-trigger/post-popover-trigger.d.ts +2 -1
  347. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +23 -21
  348. package/dist/types/components/post-rating/post-rating.d.ts +1 -1
  349. package/dist/types/components/post-stepper/post-stepper.d.ts +9 -8
  350. package/dist/types/components/post-tab-item/post-tab-item.d.ts +19 -0
  351. package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +3 -3
  352. package/dist/types/components/post-tabs/post-tabs.d.ts +33 -12
  353. package/dist/types/components/post-tooltip/post-tooltip.d.ts +1 -5
  354. package/dist/types/components.d.ts +322 -219
  355. package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/prebuild.d.ts +9 -0
  356. package/dist/types/stencil-public-runtime.d.ts +147 -10
  357. package/dist/types/types/heading-levels.d.ts +1 -1
  358. package/dist/types/utils/environment.d.ts +25 -1
  359. package/dist/types/utils/get-focusable-children.d.ts +2 -2
  360. package/dist/types/utils/tests/environment/hydrate-app-helper.d.ts +5 -0
  361. package/dist/types/utils/tests/environment/post-env-test.d.ts +3 -0
  362. package/hydrate/index.d.ts +14 -0
  363. package/hydrate/index.js +7494 -2714
  364. package/hydrate/index.mjs +7493 -2715
  365. package/package.json +7 -8
  366. package/dist/cjs/fade-nS5zzDQS.js +0 -14
  367. package/dist/cjs/index-UFKR6Ok0.js +0 -98
  368. package/dist/cjs/post-tab-header.cjs.entry.js +0 -31
  369. package/dist/collection/animations/slide-and-fade.js +0 -25
  370. package/dist/collection/components/post-language-option/post-language-option.css +0 -1
  371. package/dist/collection/components/post-language-switch/post-language-switch.css +0 -1
  372. package/dist/collection/components/post-list/post-list.css +0 -1
  373. package/dist/collection/components/post-list/post-list.js +0 -97
  374. package/dist/collection/components/post-list-item/post-list-item.css +0 -1
  375. package/dist/collection/components/post-list-item/post-list-item.js +0 -26
  376. package/dist/collection/components/post-tab-header/post-tab-header.css +0 -1
  377. package/dist/collection/components/post-tab-header/post-tab-header.js +0 -65
  378. package/dist/components/index2.js +0 -89
  379. package/dist/components/post-language-option.d.ts +0 -11
  380. package/dist/components/post-language-option.js +0 -99
  381. package/dist/components/post-language-switch.js +0 -157
  382. package/dist/components/post-list-item.js +0 -38
  383. package/dist/components/post-list.js +0 -61
  384. package/dist/components/post-tab-header.js +0 -52
  385. package/dist/components/react/p-BVXiQdHq.js +0 -64
  386. package/dist/components/react/p-BhxZzOEC.js +0 -3
  387. package/dist/components/react/p-CSAMO7iJ.js +0 -243
  388. package/dist/components/react/p-CYkf_7Y5.js +0 -89
  389. package/dist/components/react/p-Ccrl2AQn.js +0 -111
  390. package/dist/components/react/p-CewRvBtg.js +0 -139
  391. package/dist/components/react/p-Cwiv86_f.js +0 -111
  392. package/dist/components/react/p-D2waO0Zc.js +0 -31
  393. package/dist/components/react/p-DBPOV12C.js +0 -160
  394. package/dist/components/react/p-DVGEExot.js +0 -3128
  395. package/dist/components/react/p-Djvj8fd2.js +0 -80
  396. package/dist/components/react/p-LtiDhYis.js +0 -137
  397. package/dist/components/react/p-SbIC4aZX.js +0 -11
  398. package/dist/components/react/p-XrZzCOKT.js +0 -78
  399. package/dist/components/react/p-v3pOrMNQ.js +0 -114
  400. package/dist/components/react/post-language-option.js +0 -100
  401. package/dist/components/react/post-language-switch.d.ts +0 -11
  402. package/dist/components/react/post-language-switch.js +0 -158
  403. package/dist/components/react/post-list-item.js +0 -39
  404. package/dist/components/react/post-list.js +0 -62
  405. package/dist/components/react/post-tab-header.js +0 -53
  406. package/dist/esm/breakpoints-CJ80BZ06.js +0 -178
  407. package/dist/esm/event-from-CzIKqBrS.js +0 -119
  408. package/dist/esm/fade-SbIC4aZX.js +0 -11
  409. package/dist/esm/get-root-BkQ3CrLq.js +0 -15
  410. package/dist/esm/index-Beaz8wEe.js +0 -89
  411. package/dist/esm/package-BhxZzOEC.js +0 -3
  412. package/dist/esm/post-tab-header.entry.js +0 -29
  413. package/dist/post-components/p-01e678c9.entry.js +0 -1
  414. package/dist/post-components/p-034a453f.entry.js +0 -1
  415. package/dist/post-components/p-15a4cdbf.entry.js +0 -1
  416. package/dist/post-components/p-2a2030bf.entry.js +0 -1
  417. package/dist/post-components/p-2ed84cc3.entry.js +0 -1
  418. package/dist/post-components/p-3228968f.entry.js +0 -1
  419. package/dist/post-components/p-3c01ddfe.entry.js +0 -1
  420. package/dist/post-components/p-748b1f01.entry.js +0 -1
  421. package/dist/post-components/p-7745e46e.entry.js +0 -1
  422. package/dist/post-components/p-7f635728.entry.js +0 -1
  423. package/dist/post-components/p-82c178a3.entry.js +0 -1
  424. package/dist/post-components/p-9b5f8319.entry.js +0 -1
  425. package/dist/post-components/p-Beaz8wEe.js +0 -1
  426. package/dist/post-components/p-BhxZzOEC.js +0 -1
  427. package/dist/post-components/p-CJ80BZ06.js +0 -1
  428. package/dist/post-components/p-D9ZHp2FP.js +0 -1
  429. package/dist/post-components/p-SbIC4aZX.js +0 -1
  430. package/dist/post-components/p-a9644e54.entry.js +0 -1
  431. package/dist/post-components/p-af030a3a.entry.js +0 -1
  432. package/dist/post-components/p-b8ba8139.entry.js +0 -1
  433. package/dist/post-components/p-db935e8e.entry.js +0 -1
  434. package/dist/post-components/p-e62e1f57.entry.js +0 -1
  435. package/dist/post-components/p-fb4b1641.entry.js +0 -1
  436. package/dist/post-components/p-wEFJ-c34.js +0 -2
  437. package/dist/types/animations/slide-and-fade.d.ts +0 -2
  438. package/dist/types/components/post-list/post-list.d.ts +0 -24
  439. package/dist/types/components/post-list-item/post-list-item.d.ts +0 -8
  440. package/dist/types/components/post-tab-header/post-tab-header.d.ts +0 -14
  441. /package/dist/collection/components/{post-language-switch → post-language-menu}/switch-variants.js +0 -0
  442. /package/dist/{post-components/p-CzIKqBrS.js → components/react/p-rEfV4v4a.js} +0 -0
  443. /package/dist/types/components/{post-language-switch → post-language-menu}/switch-variants.d.ts +0 -0
@@ -1,3127 +1 @@
1
- import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { I as IS_BROWSER } from './breakpoints.js';
3
- import { d as checkEmptyOrOneOf, e as checkEmptyOrType } from './index2.js';
4
- import { v as version } from './package.js';
5
-
6
- const PLACEMENT_TYPES = [
7
- 'top',
8
- 'right',
9
- 'bottom',
10
- 'left',
11
- 'top-start',
12
- 'top-end',
13
- 'right-start',
14
- 'right-end',
15
- 'bottom-start',
16
- 'bottom-end',
17
- 'left-start',
18
- 'left-end',
19
- ];
20
-
21
- /**
22
- * Custom positioning reference element.
23
- * @see https://floating-ui.com/docs/virtual-elements
24
- */
25
-
26
- const min = Math.min;
27
- const max = Math.max;
28
- const round = Math.round;
29
- const floor = Math.floor;
30
- const createCoords = v => ({
31
- x: v,
32
- y: v
33
- });
34
- const oppositeSideMap = {
35
- left: 'right',
36
- right: 'left',
37
- bottom: 'top',
38
- top: 'bottom'
39
- };
40
- const oppositeAlignmentMap = {
41
- start: 'end',
42
- end: 'start'
43
- };
44
- function clamp(start, value, end) {
45
- return max(start, min(value, end));
46
- }
47
- function evaluate(value, param) {
48
- return typeof value === 'function' ? value(param) : value;
49
- }
50
- function getSide(placement) {
51
- return placement.split('-')[0];
52
- }
53
- function getAlignment(placement) {
54
- return placement.split('-')[1];
55
- }
56
- function getOppositeAxis(axis) {
57
- return axis === 'x' ? 'y' : 'x';
58
- }
59
- function getAxisLength(axis) {
60
- return axis === 'y' ? 'height' : 'width';
61
- }
62
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
63
- function getSideAxis(placement) {
64
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
65
- }
66
- function getAlignmentAxis(placement) {
67
- return getOppositeAxis(getSideAxis(placement));
68
- }
69
- function getAlignmentSides(placement, rects, rtl) {
70
- if (rtl === void 0) {
71
- rtl = false;
72
- }
73
- const alignment = getAlignment(placement);
74
- const alignmentAxis = getAlignmentAxis(placement);
75
- const length = getAxisLength(alignmentAxis);
76
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
77
- if (rects.reference[length] > rects.floating[length]) {
78
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
79
- }
80
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
81
- }
82
- function getExpandedPlacements(placement) {
83
- const oppositePlacement = getOppositePlacement(placement);
84
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
85
- }
86
- function getOppositeAlignmentPlacement(placement) {
87
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
88
- }
89
- const lrPlacement = ['left', 'right'];
90
- const rlPlacement = ['right', 'left'];
91
- const tbPlacement = ['top', 'bottom'];
92
- const btPlacement = ['bottom', 'top'];
93
- function getSideList(side, isStart, rtl) {
94
- switch (side) {
95
- case 'top':
96
- case 'bottom':
97
- if (rtl) return isStart ? rlPlacement : lrPlacement;
98
- return isStart ? lrPlacement : rlPlacement;
99
- case 'left':
100
- case 'right':
101
- return isStart ? tbPlacement : btPlacement;
102
- default:
103
- return [];
104
- }
105
- }
106
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
107
- const alignment = getAlignment(placement);
108
- let list = getSideList(getSide(placement), direction === 'start', rtl);
109
- if (alignment) {
110
- list = list.map(side => side + "-" + alignment);
111
- if (flipAlignment) {
112
- list = list.concat(list.map(getOppositeAlignmentPlacement));
113
- }
114
- }
115
- return list;
116
- }
117
- function getOppositePlacement(placement) {
118
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
119
- }
120
- function expandPaddingObject(padding) {
121
- return {
122
- top: 0,
123
- right: 0,
124
- bottom: 0,
125
- left: 0,
126
- ...padding
127
- };
128
- }
129
- function getPaddingObject(padding) {
130
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
131
- top: padding,
132
- right: padding,
133
- bottom: padding,
134
- left: padding
135
- };
136
- }
137
- function rectToClientRect(rect) {
138
- const {
139
- x,
140
- y,
141
- width,
142
- height
143
- } = rect;
144
- return {
145
- width,
146
- height,
147
- top: y,
148
- left: x,
149
- right: x + width,
150
- bottom: y + height,
151
- x,
152
- y
153
- };
154
- }
155
-
156
- function computeCoordsFromPlacement(_ref, placement, rtl) {
157
- let {
158
- reference,
159
- floating
160
- } = _ref;
161
- const sideAxis = getSideAxis(placement);
162
- const alignmentAxis = getAlignmentAxis(placement);
163
- const alignLength = getAxisLength(alignmentAxis);
164
- const side = getSide(placement);
165
- const isVertical = sideAxis === 'y';
166
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
167
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
168
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
169
- let coords;
170
- switch (side) {
171
- case 'top':
172
- coords = {
173
- x: commonX,
174
- y: reference.y - floating.height
175
- };
176
- break;
177
- case 'bottom':
178
- coords = {
179
- x: commonX,
180
- y: reference.y + reference.height
181
- };
182
- break;
183
- case 'right':
184
- coords = {
185
- x: reference.x + reference.width,
186
- y: commonY
187
- };
188
- break;
189
- case 'left':
190
- coords = {
191
- x: reference.x - floating.width,
192
- y: commonY
193
- };
194
- break;
195
- default:
196
- coords = {
197
- x: reference.x,
198
- y: reference.y
199
- };
200
- }
201
- switch (getAlignment(placement)) {
202
- case 'start':
203
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
204
- break;
205
- case 'end':
206
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
207
- break;
208
- }
209
- return coords;
210
- }
211
-
212
- /**
213
- * Computes the `x` and `y` coordinates that will place the floating element
214
- * next to a given reference element.
215
- *
216
- * This export does not have any `platform` interface logic. You will need to
217
- * write one for the platform you are using Floating UI with.
218
- */
219
- const computePosition$1 = async (reference, floating, config) => {
220
- const {
221
- placement = 'bottom',
222
- strategy = 'absolute',
223
- middleware = [],
224
- platform
225
- } = config;
226
- const validMiddleware = middleware.filter(Boolean);
227
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
228
- let rects = await platform.getElementRects({
229
- reference,
230
- floating,
231
- strategy
232
- });
233
- let {
234
- x,
235
- y
236
- } = computeCoordsFromPlacement(rects, placement, rtl);
237
- let statefulPlacement = placement;
238
- let middlewareData = {};
239
- let resetCount = 0;
240
- for (let i = 0; i < validMiddleware.length; i++) {
241
- const {
242
- name,
243
- fn
244
- } = validMiddleware[i];
245
- const {
246
- x: nextX,
247
- y: nextY,
248
- data,
249
- reset
250
- } = await fn({
251
- x,
252
- y,
253
- initialPlacement: placement,
254
- placement: statefulPlacement,
255
- strategy,
256
- middlewareData,
257
- rects,
258
- platform,
259
- elements: {
260
- reference,
261
- floating
262
- }
263
- });
264
- x = nextX != null ? nextX : x;
265
- y = nextY != null ? nextY : y;
266
- middlewareData = {
267
- ...middlewareData,
268
- [name]: {
269
- ...middlewareData[name],
270
- ...data
271
- }
272
- };
273
- if (reset && resetCount <= 50) {
274
- resetCount++;
275
- if (typeof reset === 'object') {
276
- if (reset.placement) {
277
- statefulPlacement = reset.placement;
278
- }
279
- if (reset.rects) {
280
- rects = reset.rects === true ? await platform.getElementRects({
281
- reference,
282
- floating,
283
- strategy
284
- }) : reset.rects;
285
- }
286
- ({
287
- x,
288
- y
289
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
290
- }
291
- i = -1;
292
- }
293
- }
294
- return {
295
- x,
296
- y,
297
- placement: statefulPlacement,
298
- strategy,
299
- middlewareData
300
- };
301
- };
302
-
303
- /**
304
- * Resolves with an object of overflow side offsets that determine how much the
305
- * element is overflowing a given clipping boundary on each side.
306
- * - positive = overflowing the boundary by that number of pixels
307
- * - negative = how many pixels left before it will overflow
308
- * - 0 = lies flush with the boundary
309
- * @see https://floating-ui.com/docs/detectOverflow
310
- */
311
- async function detectOverflow(state, options) {
312
- var _await$platform$isEle;
313
- if (options === void 0) {
314
- options = {};
315
- }
316
- const {
317
- x,
318
- y,
319
- platform,
320
- rects,
321
- elements,
322
- strategy
323
- } = state;
324
- const {
325
- boundary = 'clippingAncestors',
326
- rootBoundary = 'viewport',
327
- elementContext = 'floating',
328
- altBoundary = false,
329
- padding = 0
330
- } = evaluate(options, state);
331
- const paddingObject = getPaddingObject(padding);
332
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
333
- const element = elements[altBoundary ? altContext : elementContext];
334
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
335
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
336
- boundary,
337
- rootBoundary,
338
- strategy
339
- }));
340
- const rect = elementContext === 'floating' ? {
341
- x,
342
- y,
343
- width: rects.floating.width,
344
- height: rects.floating.height
345
- } : rects.reference;
346
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
347
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
348
- x: 1,
349
- y: 1
350
- } : {
351
- x: 1,
352
- y: 1
353
- };
354
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
355
- elements,
356
- rect,
357
- offsetParent,
358
- strategy
359
- }) : rect);
360
- return {
361
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
362
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
363
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
364
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
365
- };
366
- }
367
-
368
- /**
369
- * Provides data to position an inner element of the floating element so that it
370
- * appears centered to the reference element.
371
- * @see https://floating-ui.com/docs/arrow
372
- */
373
- const arrow$1 = options => ({
374
- name: 'arrow',
375
- options,
376
- async fn(state) {
377
- const {
378
- x,
379
- y,
380
- placement,
381
- rects,
382
- platform,
383
- elements,
384
- middlewareData
385
- } = state;
386
- // Since `element` is required, we don't Partial<> the type.
387
- const {
388
- element,
389
- padding = 0
390
- } = evaluate(options, state) || {};
391
- if (element == null) {
392
- return {};
393
- }
394
- const paddingObject = getPaddingObject(padding);
395
- const coords = {
396
- x,
397
- y
398
- };
399
- const axis = getAlignmentAxis(placement);
400
- const length = getAxisLength(axis);
401
- const arrowDimensions = await platform.getDimensions(element);
402
- const isYAxis = axis === 'y';
403
- const minProp = isYAxis ? 'top' : 'left';
404
- const maxProp = isYAxis ? 'bottom' : 'right';
405
- const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
406
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
407
- const startDiff = coords[axis] - rects.reference[axis];
408
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
409
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
410
-
411
- // DOM platform can return `window` as the `offsetParent`.
412
- if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
413
- clientSize = elements.floating[clientProp] || rects.floating[length];
414
- }
415
- const centerToReference = endDiff / 2 - startDiff / 2;
416
-
417
- // If the padding is large enough that it causes the arrow to no longer be
418
- // centered, modify the padding so that it is centered.
419
- const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
420
- const minPadding = min(paddingObject[minProp], largestPossiblePadding);
421
- const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
422
-
423
- // Make sure the arrow doesn't overflow the floating element if the center
424
- // point is outside the floating element's bounds.
425
- const min$1 = minPadding;
426
- const max = clientSize - arrowDimensions[length] - maxPadding;
427
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
428
- const offset = clamp(min$1, center, max);
429
-
430
- // If the reference is small enough that the arrow's padding causes it to
431
- // to point to nothing for an aligned placement, adjust the offset of the
432
- // floating element itself. To ensure `shift()` continues to take action,
433
- // a single reset is performed when this is true.
434
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
435
- const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
436
- return {
437
- [axis]: coords[axis] + alignmentOffset,
438
- data: {
439
- [axis]: offset,
440
- centerOffset: center - offset - alignmentOffset,
441
- ...(shouldAddOffset && {
442
- alignmentOffset
443
- })
444
- },
445
- reset: shouldAddOffset
446
- };
447
- }
448
- });
449
-
450
- /**
451
- * Optimizes the visibility of the floating element by flipping the `placement`
452
- * in order to keep it in view when the preferred placement(s) will overflow the
453
- * clipping boundary. Alternative to `autoPlacement`.
454
- * @see https://floating-ui.com/docs/flip
455
- */
456
- const flip$1 = function (options) {
457
- if (options === void 0) {
458
- options = {};
459
- }
460
- return {
461
- name: 'flip',
462
- options,
463
- async fn(state) {
464
- var _middlewareData$arrow, _middlewareData$flip;
465
- const {
466
- placement,
467
- middlewareData,
468
- rects,
469
- initialPlacement,
470
- platform,
471
- elements
472
- } = state;
473
- const {
474
- mainAxis: checkMainAxis = true,
475
- crossAxis: checkCrossAxis = true,
476
- fallbackPlacements: specifiedFallbackPlacements,
477
- fallbackStrategy = 'bestFit',
478
- fallbackAxisSideDirection = 'none',
479
- flipAlignment = true,
480
- ...detectOverflowOptions
481
- } = evaluate(options, state);
482
-
483
- // If a reset by the arrow was caused due to an alignment offset being
484
- // added, we should skip any logic now since `flip()` has already done its
485
- // work.
486
- // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
487
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
488
- return {};
489
- }
490
- const side = getSide(placement);
491
- const initialSideAxis = getSideAxis(initialPlacement);
492
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
493
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
494
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
495
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
496
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
497
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
498
- }
499
- const placements = [initialPlacement, ...fallbackPlacements];
500
- const overflow = await detectOverflow(state, detectOverflowOptions);
501
- const overflows = [];
502
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
503
- if (checkMainAxis) {
504
- overflows.push(overflow[side]);
505
- }
506
- if (checkCrossAxis) {
507
- const sides = getAlignmentSides(placement, rects, rtl);
508
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
509
- }
510
- overflowsData = [...overflowsData, {
511
- placement,
512
- overflows
513
- }];
514
-
515
- // One or more sides is overflowing.
516
- if (!overflows.every(side => side <= 0)) {
517
- var _middlewareData$flip2, _overflowsData$filter;
518
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
519
- const nextPlacement = placements[nextIndex];
520
- if (nextPlacement) {
521
- const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
522
- if (!ignoreCrossAxisOverflow ||
523
- // We leave the current main axis only if every placement on that axis
524
- // overflows the main axis.
525
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
526
- // Try next placement and re-run the lifecycle.
527
- return {
528
- data: {
529
- index: nextIndex,
530
- overflows: overflowsData
531
- },
532
- reset: {
533
- placement: nextPlacement
534
- }
535
- };
536
- }
537
- }
538
-
539
- // First, find the candidates that fit on the mainAxis side of overflow,
540
- // then find the placement that fits the best on the main crossAxis side.
541
- 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;
542
-
543
- // Otherwise fallback.
544
- if (!resetPlacement) {
545
- switch (fallbackStrategy) {
546
- case 'bestFit':
547
- {
548
- var _overflowsData$filter2;
549
- const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
550
- if (hasFallbackAxisSideDirection) {
551
- const currentSideAxis = getSideAxis(d.placement);
552
- return currentSideAxis === initialSideAxis ||
553
- // Create a bias to the `y` side axis due to horizontal
554
- // reading directions favoring greater width.
555
- currentSideAxis === 'y';
556
- }
557
- return true;
558
- }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
559
- if (placement) {
560
- resetPlacement = placement;
561
- }
562
- break;
563
- }
564
- case 'initialPlacement':
565
- resetPlacement = initialPlacement;
566
- break;
567
- }
568
- }
569
- if (placement !== resetPlacement) {
570
- return {
571
- reset: {
572
- placement: resetPlacement
573
- }
574
- };
575
- }
576
- }
577
- return {};
578
- }
579
- };
580
- };
581
-
582
- function getBoundingRect(rects) {
583
- const minX = min(...rects.map(rect => rect.left));
584
- const minY = min(...rects.map(rect => rect.top));
585
- const maxX = max(...rects.map(rect => rect.right));
586
- const maxY = max(...rects.map(rect => rect.bottom));
587
- return {
588
- x: minX,
589
- y: minY,
590
- width: maxX - minX,
591
- height: maxY - minY
592
- };
593
- }
594
- function getRectsByLine(rects) {
595
- const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
596
- const groups = [];
597
- let prevRect = null;
598
- for (let i = 0; i < sortedRects.length; i++) {
599
- const rect = sortedRects[i];
600
- if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
601
- groups.push([rect]);
602
- } else {
603
- groups[groups.length - 1].push(rect);
604
- }
605
- prevRect = rect;
606
- }
607
- return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
608
- }
609
- /**
610
- * Provides improved positioning for inline reference elements that can span
611
- * over multiple lines, such as hyperlinks or range selections.
612
- * @see https://floating-ui.com/docs/inline
613
- */
614
- const inline$1 = function (options) {
615
- if (options === void 0) {
616
- options = {};
617
- }
618
- return {
619
- name: 'inline',
620
- options,
621
- async fn(state) {
622
- const {
623
- placement,
624
- elements,
625
- rects,
626
- platform,
627
- strategy
628
- } = state;
629
- // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
630
- // ClientRect's bounds, despite the event listener being triggered. A
631
- // padding of 2 seems to handle this issue.
632
- const {
633
- padding = 2,
634
- x,
635
- y
636
- } = evaluate(options, state);
637
- const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
638
- const clientRects = getRectsByLine(nativeClientRects);
639
- const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
640
- const paddingObject = getPaddingObject(padding);
641
- function getBoundingClientRect() {
642
- // There are two rects and they are disjoined.
643
- if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
644
- // Find the first rect in which the point is fully inside.
645
- return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
646
- }
647
-
648
- // There are 2 or more connected rects.
649
- if (clientRects.length >= 2) {
650
- if (getSideAxis(placement) === 'y') {
651
- const firstRect = clientRects[0];
652
- const lastRect = clientRects[clientRects.length - 1];
653
- const isTop = getSide(placement) === 'top';
654
- const top = firstRect.top;
655
- const bottom = lastRect.bottom;
656
- const left = isTop ? firstRect.left : lastRect.left;
657
- const right = isTop ? firstRect.right : lastRect.right;
658
- const width = right - left;
659
- const height = bottom - top;
660
- return {
661
- top,
662
- bottom,
663
- left,
664
- right,
665
- width,
666
- height,
667
- x: left,
668
- y: top
669
- };
670
- }
671
- const isLeftSide = getSide(placement) === 'left';
672
- const maxRight = max(...clientRects.map(rect => rect.right));
673
- const minLeft = min(...clientRects.map(rect => rect.left));
674
- const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
675
- const top = measureRects[0].top;
676
- const bottom = measureRects[measureRects.length - 1].bottom;
677
- const left = minLeft;
678
- const right = maxRight;
679
- const width = right - left;
680
- const height = bottom - top;
681
- return {
682
- top,
683
- bottom,
684
- left,
685
- right,
686
- width,
687
- height,
688
- x: left,
689
- y: top
690
- };
691
- }
692
- return fallback;
693
- }
694
- const resetRects = await platform.getElementRects({
695
- reference: {
696
- getBoundingClientRect
697
- },
698
- floating: elements.floating,
699
- strategy
700
- });
701
- if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
702
- return {
703
- reset: {
704
- rects: resetRects
705
- }
706
- };
707
- }
708
- return {};
709
- }
710
- };
711
- };
712
-
713
- const originSides = /*#__PURE__*/new Set(['left', 'top']);
714
-
715
- // For type backwards-compatibility, the `OffsetOptions` type was also
716
- // Derivable.
717
-
718
- async function convertValueToCoords(state, options) {
719
- const {
720
- placement,
721
- platform,
722
- elements
723
- } = state;
724
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
725
- const side = getSide(placement);
726
- const alignment = getAlignment(placement);
727
- const isVertical = getSideAxis(placement) === 'y';
728
- const mainAxisMulti = originSides.has(side) ? -1 : 1;
729
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
730
- const rawValue = evaluate(options, state);
731
-
732
- // eslint-disable-next-line prefer-const
733
- let {
734
- mainAxis,
735
- crossAxis,
736
- alignmentAxis
737
- } = typeof rawValue === 'number' ? {
738
- mainAxis: rawValue,
739
- crossAxis: 0,
740
- alignmentAxis: null
741
- } : {
742
- mainAxis: rawValue.mainAxis || 0,
743
- crossAxis: rawValue.crossAxis || 0,
744
- alignmentAxis: rawValue.alignmentAxis
745
- };
746
- if (alignment && typeof alignmentAxis === 'number') {
747
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
748
- }
749
- return isVertical ? {
750
- x: crossAxis * crossAxisMulti,
751
- y: mainAxis * mainAxisMulti
752
- } : {
753
- x: mainAxis * mainAxisMulti,
754
- y: crossAxis * crossAxisMulti
755
- };
756
- }
757
-
758
- /**
759
- * Modifies the placement by translating the floating element along the
760
- * specified axes.
761
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
762
- * object may be passed.
763
- * @see https://floating-ui.com/docs/offset
764
- */
765
- const offset$1 = function (options) {
766
- if (options === void 0) {
767
- options = 0;
768
- }
769
- return {
770
- name: 'offset',
771
- options,
772
- async fn(state) {
773
- var _middlewareData$offse, _middlewareData$arrow;
774
- const {
775
- x,
776
- y,
777
- placement,
778
- middlewareData
779
- } = state;
780
- const diffCoords = await convertValueToCoords(state, options);
781
-
782
- // If the placement is the same and the arrow caused an alignment offset
783
- // then we don't need to change the positioning coordinates.
784
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
785
- return {};
786
- }
787
- return {
788
- x: x + diffCoords.x,
789
- y: y + diffCoords.y,
790
- data: {
791
- ...diffCoords,
792
- placement
793
- }
794
- };
795
- }
796
- };
797
- };
798
-
799
- /**
800
- * Optimizes the visibility of the floating element by shifting it in order to
801
- * keep it in view when it will overflow the clipping boundary.
802
- * @see https://floating-ui.com/docs/shift
803
- */
804
- const shift$1 = function (options) {
805
- if (options === void 0) {
806
- options = {};
807
- }
808
- return {
809
- name: 'shift',
810
- options,
811
- async fn(state) {
812
- const {
813
- x,
814
- y,
815
- placement
816
- } = state;
817
- const {
818
- mainAxis: checkMainAxis = true,
819
- crossAxis: checkCrossAxis = false,
820
- limiter = {
821
- fn: _ref => {
822
- let {
823
- x,
824
- y
825
- } = _ref;
826
- return {
827
- x,
828
- y
829
- };
830
- }
831
- },
832
- ...detectOverflowOptions
833
- } = evaluate(options, state);
834
- const coords = {
835
- x,
836
- y
837
- };
838
- const overflow = await detectOverflow(state, detectOverflowOptions);
839
- const crossAxis = getSideAxis(getSide(placement));
840
- const mainAxis = getOppositeAxis(crossAxis);
841
- let mainAxisCoord = coords[mainAxis];
842
- let crossAxisCoord = coords[crossAxis];
843
- if (checkMainAxis) {
844
- const minSide = mainAxis === 'y' ? 'top' : 'left';
845
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
846
- const min = mainAxisCoord + overflow[minSide];
847
- const max = mainAxisCoord - overflow[maxSide];
848
- mainAxisCoord = clamp(min, mainAxisCoord, max);
849
- }
850
- if (checkCrossAxis) {
851
- const minSide = crossAxis === 'y' ? 'top' : 'left';
852
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
853
- const min = crossAxisCoord + overflow[minSide];
854
- const max = crossAxisCoord - overflow[maxSide];
855
- crossAxisCoord = clamp(min, crossAxisCoord, max);
856
- }
857
- const limitedCoords = limiter.fn({
858
- ...state,
859
- [mainAxis]: mainAxisCoord,
860
- [crossAxis]: crossAxisCoord
861
- });
862
- return {
863
- ...limitedCoords,
864
- data: {
865
- x: limitedCoords.x - x,
866
- y: limitedCoords.y - y,
867
- enabled: {
868
- [mainAxis]: checkMainAxis,
869
- [crossAxis]: checkCrossAxis
870
- }
871
- }
872
- };
873
- }
874
- };
875
- };
876
- /**
877
- * Built-in `limiter` that will stop `shift()` at a certain point.
878
- */
879
- const limitShift$1 = function (options) {
880
- if (options === void 0) {
881
- options = {};
882
- }
883
- return {
884
- options,
885
- fn(state) {
886
- const {
887
- x,
888
- y,
889
- placement,
890
- rects,
891
- middlewareData
892
- } = state;
893
- const {
894
- offset = 0,
895
- mainAxis: checkMainAxis = true,
896
- crossAxis: checkCrossAxis = true
897
- } = evaluate(options, state);
898
- const coords = {
899
- x,
900
- y
901
- };
902
- const crossAxis = getSideAxis(placement);
903
- const mainAxis = getOppositeAxis(crossAxis);
904
- let mainAxisCoord = coords[mainAxis];
905
- let crossAxisCoord = coords[crossAxis];
906
- const rawOffset = evaluate(offset, state);
907
- const computedOffset = typeof rawOffset === 'number' ? {
908
- mainAxis: rawOffset,
909
- crossAxis: 0
910
- } : {
911
- mainAxis: 0,
912
- crossAxis: 0,
913
- ...rawOffset
914
- };
915
- if (checkMainAxis) {
916
- const len = mainAxis === 'y' ? 'height' : 'width';
917
- const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
918
- const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
919
- if (mainAxisCoord < limitMin) {
920
- mainAxisCoord = limitMin;
921
- } else if (mainAxisCoord > limitMax) {
922
- mainAxisCoord = limitMax;
923
- }
924
- }
925
- if (checkCrossAxis) {
926
- var _middlewareData$offse, _middlewareData$offse2;
927
- const len = mainAxis === 'y' ? 'width' : 'height';
928
- const isOriginSide = originSides.has(getSide(placement));
929
- const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
930
- const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
931
- if (crossAxisCoord < limitMin) {
932
- crossAxisCoord = limitMin;
933
- } else if (crossAxisCoord > limitMax) {
934
- crossAxisCoord = limitMax;
935
- }
936
- }
937
- return {
938
- [mainAxis]: mainAxisCoord,
939
- [crossAxis]: crossAxisCoord
940
- };
941
- }
942
- };
943
- };
944
-
945
- /**
946
- * Provides data that allows you to change the size of the floating element —
947
- * for instance, prevent it from overflowing the clipping boundary or match the
948
- * width of the reference element.
949
- * @see https://floating-ui.com/docs/size
950
- */
951
- const size$1 = function (options) {
952
- if (options === void 0) {
953
- options = {};
954
- }
955
- return {
956
- name: 'size',
957
- options,
958
- async fn(state) {
959
- var _state$middlewareData, _state$middlewareData2;
960
- const {
961
- placement,
962
- rects,
963
- platform,
964
- elements
965
- } = state;
966
- const {
967
- apply = () => {},
968
- ...detectOverflowOptions
969
- } = evaluate(options, state);
970
- const overflow = await detectOverflow(state, detectOverflowOptions);
971
- const side = getSide(placement);
972
- const alignment = getAlignment(placement);
973
- const isYAxis = getSideAxis(placement) === 'y';
974
- const {
975
- width,
976
- height
977
- } = rects.floating;
978
- let heightSide;
979
- let widthSide;
980
- if (side === 'top' || side === 'bottom') {
981
- heightSide = side;
982
- widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
983
- } else {
984
- widthSide = side;
985
- heightSide = alignment === 'end' ? 'top' : 'bottom';
986
- }
987
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
988
- const maximumClippingWidth = width - overflow.left - overflow.right;
989
- const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
990
- const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
991
- const noShift = !state.middlewareData.shift;
992
- let availableHeight = overflowAvailableHeight;
993
- let availableWidth = overflowAvailableWidth;
994
- if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
995
- availableWidth = maximumClippingWidth;
996
- }
997
- if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
998
- availableHeight = maximumClippingHeight;
999
- }
1000
- if (noShift && !alignment) {
1001
- const xMin = max(overflow.left, 0);
1002
- const xMax = max(overflow.right, 0);
1003
- const yMin = max(overflow.top, 0);
1004
- const yMax = max(overflow.bottom, 0);
1005
- if (isYAxis) {
1006
- availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1007
- } else {
1008
- availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1009
- }
1010
- }
1011
- await apply({
1012
- ...state,
1013
- availableWidth,
1014
- availableHeight
1015
- });
1016
- const nextDimensions = await platform.getDimensions(elements.floating);
1017
- if (width !== nextDimensions.width || height !== nextDimensions.height) {
1018
- return {
1019
- reset: {
1020
- rects: true
1021
- }
1022
- };
1023
- }
1024
- return {};
1025
- }
1026
- };
1027
- };
1028
-
1029
- function hasWindow() {
1030
- return typeof window !== 'undefined';
1031
- }
1032
- function getNodeName(node) {
1033
- if (isNode(node)) {
1034
- return (node.nodeName || '').toLowerCase();
1035
- }
1036
- // Mocked nodes in testing environments may not be instances of Node. By
1037
- // returning `#document` an infinite loop won't occur.
1038
- // https://github.com/floating-ui/floating-ui/issues/2317
1039
- return '#document';
1040
- }
1041
- function getWindow(node) {
1042
- var _node$ownerDocument;
1043
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1044
- }
1045
- function getDocumentElement(node) {
1046
- var _ref;
1047
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1048
- }
1049
- function isNode(value) {
1050
- if (!hasWindow()) {
1051
- return false;
1052
- }
1053
- return value instanceof Node || value instanceof getWindow(value).Node;
1054
- }
1055
- function isElement(value) {
1056
- if (!hasWindow()) {
1057
- return false;
1058
- }
1059
- return value instanceof Element || value instanceof getWindow(value).Element;
1060
- }
1061
- function isHTMLElement(value) {
1062
- if (!hasWindow()) {
1063
- return false;
1064
- }
1065
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1066
- }
1067
- function isShadowRoot(value) {
1068
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
1069
- return false;
1070
- }
1071
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1072
- }
1073
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
1074
- function isOverflowElement(element) {
1075
- const {
1076
- overflow,
1077
- overflowX,
1078
- overflowY,
1079
- display
1080
- } = getComputedStyle$1(element);
1081
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
1082
- }
1083
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
1084
- function isTableElement(element) {
1085
- return tableElements.has(getNodeName(element));
1086
- }
1087
- const topLayerSelectors = [':popover-open', ':modal'];
1088
- function isTopLayer(element) {
1089
- return topLayerSelectors.some(selector => {
1090
- try {
1091
- return element.matches(selector);
1092
- } catch (_e) {
1093
- return false;
1094
- }
1095
- });
1096
- }
1097
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
1098
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
1099
- const containValues = ['paint', 'layout', 'strict', 'content'];
1100
- function isContainingBlock(elementOrCss) {
1101
- const webkit = isWebKit();
1102
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1103
-
1104
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1105
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
1106
- return transformProperties.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) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
1107
- }
1108
- function getContainingBlock(element) {
1109
- let currentNode = getParentNode(element);
1110
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1111
- if (isContainingBlock(currentNode)) {
1112
- return currentNode;
1113
- } else if (isTopLayer(currentNode)) {
1114
- return null;
1115
- }
1116
- currentNode = getParentNode(currentNode);
1117
- }
1118
- return null;
1119
- }
1120
- function isWebKit() {
1121
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1122
- return CSS.supports('-webkit-backdrop-filter', 'none');
1123
- }
1124
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
1125
- function isLastTraversableNode(node) {
1126
- return lastTraversableNodeNames.has(getNodeName(node));
1127
- }
1128
- function getComputedStyle$1(element) {
1129
- return getWindow(element).getComputedStyle(element);
1130
- }
1131
- function getNodeScroll(element) {
1132
- if (isElement(element)) {
1133
- return {
1134
- scrollLeft: element.scrollLeft,
1135
- scrollTop: element.scrollTop
1136
- };
1137
- }
1138
- return {
1139
- scrollLeft: element.scrollX,
1140
- scrollTop: element.scrollY
1141
- };
1142
- }
1143
- function getParentNode(node) {
1144
- if (getNodeName(node) === 'html') {
1145
- return node;
1146
- }
1147
- const result =
1148
- // Step into the shadow DOM of the parent of a slotted node.
1149
- node.assignedSlot ||
1150
- // DOM Element detected.
1151
- node.parentNode ||
1152
- // ShadowRoot detected.
1153
- isShadowRoot(node) && node.host ||
1154
- // Fallback.
1155
- getDocumentElement(node);
1156
- return isShadowRoot(result) ? result.host : result;
1157
- }
1158
- function getNearestOverflowAncestor(node) {
1159
- const parentNode = getParentNode(node);
1160
- if (isLastTraversableNode(parentNode)) {
1161
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1162
- }
1163
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1164
- return parentNode;
1165
- }
1166
- return getNearestOverflowAncestor(parentNode);
1167
- }
1168
- function getOverflowAncestors(node, list, traverseIframes) {
1169
- var _node$ownerDocument2;
1170
- if (list === void 0) {
1171
- list = [];
1172
- }
1173
- if (traverseIframes === void 0) {
1174
- traverseIframes = true;
1175
- }
1176
- const scrollableAncestor = getNearestOverflowAncestor(node);
1177
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1178
- const win = getWindow(scrollableAncestor);
1179
- if (isBody) {
1180
- const frameElement = getFrameElement(win);
1181
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1182
- }
1183
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1184
- }
1185
- function getFrameElement(win) {
1186
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1187
- }
1188
-
1189
- function getCssDimensions(element) {
1190
- const css = getComputedStyle$1(element);
1191
- // In testing environments, the `width` and `height` properties are empty
1192
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1193
- let width = parseFloat(css.width) || 0;
1194
- let height = parseFloat(css.height) || 0;
1195
- const hasOffset = isHTMLElement(element);
1196
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1197
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1198
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1199
- if (shouldFallback) {
1200
- width = offsetWidth;
1201
- height = offsetHeight;
1202
- }
1203
- return {
1204
- width,
1205
- height,
1206
- $: shouldFallback
1207
- };
1208
- }
1209
-
1210
- function unwrapElement(element) {
1211
- return !isElement(element) ? element.contextElement : element;
1212
- }
1213
-
1214
- function getScale(element) {
1215
- const domElement = unwrapElement(element);
1216
- if (!isHTMLElement(domElement)) {
1217
- return createCoords(1);
1218
- }
1219
- const rect = domElement.getBoundingClientRect();
1220
- const {
1221
- width,
1222
- height,
1223
- $
1224
- } = getCssDimensions(domElement);
1225
- let x = ($ ? round(rect.width) : rect.width) / width;
1226
- let y = ($ ? round(rect.height) : rect.height) / height;
1227
-
1228
- // 0, NaN, or Infinity should always fallback to 1.
1229
-
1230
- if (!x || !Number.isFinite(x)) {
1231
- x = 1;
1232
- }
1233
- if (!y || !Number.isFinite(y)) {
1234
- y = 1;
1235
- }
1236
- return {
1237
- x,
1238
- y
1239
- };
1240
- }
1241
-
1242
- const noOffsets = /*#__PURE__*/createCoords(0);
1243
- function getVisualOffsets(element) {
1244
- const win = getWindow(element);
1245
- if (!isWebKit() || !win.visualViewport) {
1246
- return noOffsets;
1247
- }
1248
- return {
1249
- x: win.visualViewport.offsetLeft,
1250
- y: win.visualViewport.offsetTop
1251
- };
1252
- }
1253
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1254
- if (isFixed === void 0) {
1255
- isFixed = false;
1256
- }
1257
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1258
- return false;
1259
- }
1260
- return isFixed;
1261
- }
1262
-
1263
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1264
- if (includeScale === void 0) {
1265
- includeScale = false;
1266
- }
1267
- if (isFixedStrategy === void 0) {
1268
- isFixedStrategy = false;
1269
- }
1270
- const clientRect = element.getBoundingClientRect();
1271
- const domElement = unwrapElement(element);
1272
- let scale = createCoords(1);
1273
- if (includeScale) {
1274
- if (offsetParent) {
1275
- if (isElement(offsetParent)) {
1276
- scale = getScale(offsetParent);
1277
- }
1278
- } else {
1279
- scale = getScale(element);
1280
- }
1281
- }
1282
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1283
- let x = (clientRect.left + visualOffsets.x) / scale.x;
1284
- let y = (clientRect.top + visualOffsets.y) / scale.y;
1285
- let width = clientRect.width / scale.x;
1286
- let height = clientRect.height / scale.y;
1287
- if (domElement) {
1288
- const win = getWindow(domElement);
1289
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1290
- let currentWin = win;
1291
- let currentIFrame = getFrameElement(currentWin);
1292
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1293
- const iframeScale = getScale(currentIFrame);
1294
- const iframeRect = currentIFrame.getBoundingClientRect();
1295
- const css = getComputedStyle$1(currentIFrame);
1296
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1297
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1298
- x *= iframeScale.x;
1299
- y *= iframeScale.y;
1300
- width *= iframeScale.x;
1301
- height *= iframeScale.y;
1302
- x += left;
1303
- y += top;
1304
- currentWin = getWindow(currentIFrame);
1305
- currentIFrame = getFrameElement(currentWin);
1306
- }
1307
- }
1308
- return rectToClientRect({
1309
- width,
1310
- height,
1311
- x,
1312
- y
1313
- });
1314
- }
1315
-
1316
- // If <html> has a CSS width greater than the viewport, then this will be
1317
- // incorrect for RTL.
1318
- function getWindowScrollBarX(element, rect) {
1319
- const leftScroll = getNodeScroll(element).scrollLeft;
1320
- if (!rect) {
1321
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1322
- }
1323
- return rect.left + leftScroll;
1324
- }
1325
-
1326
- function getHTMLOffset(documentElement, scroll) {
1327
- const htmlRect = documentElement.getBoundingClientRect();
1328
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1329
- const y = htmlRect.top + scroll.scrollTop;
1330
- return {
1331
- x,
1332
- y
1333
- };
1334
- }
1335
-
1336
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1337
- let {
1338
- elements,
1339
- rect,
1340
- offsetParent,
1341
- strategy
1342
- } = _ref;
1343
- const isFixed = strategy === 'fixed';
1344
- const documentElement = getDocumentElement(offsetParent);
1345
- const topLayer = elements ? isTopLayer(elements.floating) : false;
1346
- if (offsetParent === documentElement || topLayer && isFixed) {
1347
- return rect;
1348
- }
1349
- let scroll = {
1350
- scrollLeft: 0,
1351
- scrollTop: 0
1352
- };
1353
- let scale = createCoords(1);
1354
- const offsets = createCoords(0);
1355
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1356
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1357
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1358
- scroll = getNodeScroll(offsetParent);
1359
- }
1360
- if (isHTMLElement(offsetParent)) {
1361
- const offsetRect = getBoundingClientRect(offsetParent);
1362
- scale = getScale(offsetParent);
1363
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1364
- offsets.y = offsetRect.y + offsetParent.clientTop;
1365
- }
1366
- }
1367
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1368
- return {
1369
- width: rect.width * scale.x,
1370
- height: rect.height * scale.y,
1371
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1372
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1373
- };
1374
- }
1375
-
1376
- function getClientRects(element) {
1377
- return Array.from(element.getClientRects());
1378
- }
1379
-
1380
- // Gets the entire size of the scrollable document area, even extending outside
1381
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1382
- function getDocumentRect(element) {
1383
- const html = getDocumentElement(element);
1384
- const scroll = getNodeScroll(element);
1385
- const body = element.ownerDocument.body;
1386
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1387
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1388
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1389
- const y = -scroll.scrollTop;
1390
- if (getComputedStyle$1(body).direction === 'rtl') {
1391
- x += max(html.clientWidth, body.clientWidth) - width;
1392
- }
1393
- return {
1394
- width,
1395
- height,
1396
- x,
1397
- y
1398
- };
1399
- }
1400
-
1401
- // Safety check: ensure the scrollbar space is reasonable in case this
1402
- // calculation is affected by unusual styles.
1403
- // Most scrollbars leave 15-18px of space.
1404
- const SCROLLBAR_MAX = 25;
1405
- function getViewportRect(element, strategy) {
1406
- const win = getWindow(element);
1407
- const html = getDocumentElement(element);
1408
- const visualViewport = win.visualViewport;
1409
- let width = html.clientWidth;
1410
- let height = html.clientHeight;
1411
- let x = 0;
1412
- let y = 0;
1413
- if (visualViewport) {
1414
- width = visualViewport.width;
1415
- height = visualViewport.height;
1416
- const visualViewportBased = isWebKit();
1417
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1418
- x = visualViewport.offsetLeft;
1419
- y = visualViewport.offsetTop;
1420
- }
1421
- }
1422
- const windowScrollbarX = getWindowScrollBarX(html);
1423
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
1424
- // visual width of the <html> but this is not considered in the size
1425
- // of `html.clientWidth`.
1426
- if (windowScrollbarX <= 0) {
1427
- const doc = html.ownerDocument;
1428
- const body = doc.body;
1429
- const bodyStyles = getComputedStyle(body);
1430
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1431
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1432
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1433
- width -= clippingStableScrollbarWidth;
1434
- }
1435
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1436
- // If the <body> scrollbar is on the left, the width needs to be extended
1437
- // by the scrollbar amount so there isn't extra space on the right.
1438
- width += windowScrollbarX;
1439
- }
1440
- return {
1441
- width,
1442
- height,
1443
- x,
1444
- y
1445
- };
1446
- }
1447
-
1448
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
1449
- // Returns the inner client rect, subtracting scrollbars if present.
1450
- function getInnerBoundingClientRect(element, strategy) {
1451
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1452
- const top = clientRect.top + element.clientTop;
1453
- const left = clientRect.left + element.clientLeft;
1454
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1455
- const width = element.clientWidth * scale.x;
1456
- const height = element.clientHeight * scale.y;
1457
- const x = left * scale.x;
1458
- const y = top * scale.y;
1459
- return {
1460
- width,
1461
- height,
1462
- x,
1463
- y
1464
- };
1465
- }
1466
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1467
- let rect;
1468
- if (clippingAncestor === 'viewport') {
1469
- rect = getViewportRect(element, strategy);
1470
- } else if (clippingAncestor === 'document') {
1471
- rect = getDocumentRect(getDocumentElement(element));
1472
- } else if (isElement(clippingAncestor)) {
1473
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1474
- } else {
1475
- const visualOffsets = getVisualOffsets(element);
1476
- rect = {
1477
- x: clippingAncestor.x - visualOffsets.x,
1478
- y: clippingAncestor.y - visualOffsets.y,
1479
- width: clippingAncestor.width,
1480
- height: clippingAncestor.height
1481
- };
1482
- }
1483
- return rectToClientRect(rect);
1484
- }
1485
- function hasFixedPositionAncestor(element, stopNode) {
1486
- const parentNode = getParentNode(element);
1487
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1488
- return false;
1489
- }
1490
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1491
- }
1492
-
1493
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1494
- // clipping (or hiding) child elements. This returns all clipping ancestors
1495
- // of the given element up the tree.
1496
- function getClippingElementAncestors(element, cache) {
1497
- const cachedResult = cache.get(element);
1498
- if (cachedResult) {
1499
- return cachedResult;
1500
- }
1501
- let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1502
- let currentContainingBlockComputedStyle = null;
1503
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1504
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1505
-
1506
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1507
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1508
- const computedStyle = getComputedStyle$1(currentNode);
1509
- const currentNodeIsContaining = isContainingBlock(currentNode);
1510
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1511
- currentContainingBlockComputedStyle = null;
1512
- }
1513
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1514
- if (shouldDropCurrentNode) {
1515
- // Drop non-containing blocks.
1516
- result = result.filter(ancestor => ancestor !== currentNode);
1517
- } else {
1518
- // Record last containing block for next iteration.
1519
- currentContainingBlockComputedStyle = computedStyle;
1520
- }
1521
- currentNode = getParentNode(currentNode);
1522
- }
1523
- cache.set(element, result);
1524
- return result;
1525
- }
1526
-
1527
- // Gets the maximum area that the element is visible in due to any number of
1528
- // clipping ancestors.
1529
- function getClippingRect(_ref) {
1530
- let {
1531
- element,
1532
- boundary,
1533
- rootBoundary,
1534
- strategy
1535
- } = _ref;
1536
- const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1537
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1538
- const firstClippingAncestor = clippingAncestors[0];
1539
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1540
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1541
- accRect.top = max(rect.top, accRect.top);
1542
- accRect.right = min(rect.right, accRect.right);
1543
- accRect.bottom = min(rect.bottom, accRect.bottom);
1544
- accRect.left = max(rect.left, accRect.left);
1545
- return accRect;
1546
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1547
- return {
1548
- width: clippingRect.right - clippingRect.left,
1549
- height: clippingRect.bottom - clippingRect.top,
1550
- x: clippingRect.left,
1551
- y: clippingRect.top
1552
- };
1553
- }
1554
-
1555
- function getDimensions(element) {
1556
- const {
1557
- width,
1558
- height
1559
- } = getCssDimensions(element);
1560
- return {
1561
- width,
1562
- height
1563
- };
1564
- }
1565
-
1566
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1567
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1568
- const documentElement = getDocumentElement(offsetParent);
1569
- const isFixed = strategy === 'fixed';
1570
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1571
- let scroll = {
1572
- scrollLeft: 0,
1573
- scrollTop: 0
1574
- };
1575
- const offsets = createCoords(0);
1576
-
1577
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1578
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1579
- function setLeftRTLScrollbarOffset() {
1580
- offsets.x = getWindowScrollBarX(documentElement);
1581
- }
1582
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1583
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1584
- scroll = getNodeScroll(offsetParent);
1585
- }
1586
- if (isOffsetParentAnElement) {
1587
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1588
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1589
- offsets.y = offsetRect.y + offsetParent.clientTop;
1590
- } else if (documentElement) {
1591
- setLeftRTLScrollbarOffset();
1592
- }
1593
- }
1594
- if (isFixed && !isOffsetParentAnElement && documentElement) {
1595
- setLeftRTLScrollbarOffset();
1596
- }
1597
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1598
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1599
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1600
- return {
1601
- x,
1602
- y,
1603
- width: rect.width,
1604
- height: rect.height
1605
- };
1606
- }
1607
-
1608
- function isStaticPositioned(element) {
1609
- return getComputedStyle$1(element).position === 'static';
1610
- }
1611
-
1612
- function getTrueOffsetParent(element, polyfill) {
1613
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1614
- return null;
1615
- }
1616
- if (polyfill) {
1617
- return polyfill(element);
1618
- }
1619
- let rawOffsetParent = element.offsetParent;
1620
-
1621
- // Firefox returns the <html> element as the offsetParent if it's non-static,
1622
- // while Chrome and Safari return the <body> element. The <body> element must
1623
- // be used to perform the correct calculations even if the <html> element is
1624
- // non-static.
1625
- if (getDocumentElement(element) === rawOffsetParent) {
1626
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
1627
- }
1628
- return rawOffsetParent;
1629
- }
1630
-
1631
- // Gets the closest ancestor positioned element. Handles some edge cases,
1632
- // such as table ancestors and cross browser bugs.
1633
- function getOffsetParent(element, polyfill) {
1634
- const win = getWindow(element);
1635
- if (isTopLayer(element)) {
1636
- return win;
1637
- }
1638
- if (!isHTMLElement(element)) {
1639
- let svgOffsetParent = getParentNode(element);
1640
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1641
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1642
- return svgOffsetParent;
1643
- }
1644
- svgOffsetParent = getParentNode(svgOffsetParent);
1645
- }
1646
- return win;
1647
- }
1648
- let offsetParent = getTrueOffsetParent(element, polyfill);
1649
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1650
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1651
- }
1652
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1653
- return win;
1654
- }
1655
- return offsetParent || getContainingBlock(element) || win;
1656
- }
1657
-
1658
- const getElementRects = async function (data) {
1659
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1660
- const getDimensionsFn = this.getDimensions;
1661
- const floatingDimensions = await getDimensionsFn(data.floating);
1662
- return {
1663
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1664
- floating: {
1665
- x: 0,
1666
- y: 0,
1667
- width: floatingDimensions.width,
1668
- height: floatingDimensions.height
1669
- }
1670
- };
1671
- };
1672
-
1673
- function isRTL(element) {
1674
- return getComputedStyle$1(element).direction === 'rtl';
1675
- }
1676
-
1677
- const platform = {
1678
- convertOffsetParentRelativeRectToViewportRelativeRect,
1679
- getDocumentElement,
1680
- getClippingRect,
1681
- getOffsetParent,
1682
- getElementRects,
1683
- getClientRects,
1684
- getDimensions,
1685
- getScale,
1686
- isElement,
1687
- isRTL
1688
- };
1689
-
1690
- function rectsAreEqual(a, b) {
1691
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1692
- }
1693
-
1694
- // https://samthor.au/2021/observing-dom/
1695
- function observeMove(element, onMove) {
1696
- let io = null;
1697
- let timeoutId;
1698
- const root = getDocumentElement(element);
1699
- function cleanup() {
1700
- var _io;
1701
- clearTimeout(timeoutId);
1702
- (_io = io) == null || _io.disconnect();
1703
- io = null;
1704
- }
1705
- function refresh(skip, threshold) {
1706
- if (skip === void 0) {
1707
- skip = false;
1708
- }
1709
- if (threshold === void 0) {
1710
- threshold = 1;
1711
- }
1712
- cleanup();
1713
- const elementRectForRootMargin = element.getBoundingClientRect();
1714
- const {
1715
- left,
1716
- top,
1717
- width,
1718
- height
1719
- } = elementRectForRootMargin;
1720
- if (!skip) {
1721
- onMove();
1722
- }
1723
- if (!width || !height) {
1724
- return;
1725
- }
1726
- const insetTop = floor(top);
1727
- const insetRight = floor(root.clientWidth - (left + width));
1728
- const insetBottom = floor(root.clientHeight - (top + height));
1729
- const insetLeft = floor(left);
1730
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1731
- const options = {
1732
- rootMargin,
1733
- threshold: max(0, min(1, threshold)) || 1
1734
- };
1735
- let isFirstUpdate = true;
1736
- function handleObserve(entries) {
1737
- const ratio = entries[0].intersectionRatio;
1738
- if (ratio !== threshold) {
1739
- if (!isFirstUpdate) {
1740
- return refresh();
1741
- }
1742
- if (!ratio) {
1743
- // If the reference is clipped, the ratio is 0. Throttle the refresh
1744
- // to prevent an infinite loop of updates.
1745
- timeoutId = setTimeout(() => {
1746
- refresh(false, 1e-7);
1747
- }, 1000);
1748
- } else {
1749
- refresh(false, ratio);
1750
- }
1751
- }
1752
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1753
- // It's possible that even though the ratio is reported as 1, the
1754
- // element is not actually fully within the IntersectionObserver's root
1755
- // area anymore. This can happen under performance constraints. This may
1756
- // be a bug in the browser's IntersectionObserver implementation. To
1757
- // work around this, we compare the element's bounding rect now with
1758
- // what it was at the time we created the IntersectionObserver. If they
1759
- // are not equal then the element moved, so we refresh.
1760
- refresh();
1761
- }
1762
- isFirstUpdate = false;
1763
- }
1764
-
1765
- // Older browsers don't support a `document` as the root and will throw an
1766
- // error.
1767
- try {
1768
- io = new IntersectionObserver(handleObserve, {
1769
- ...options,
1770
- // Handle <iframe>s
1771
- root: root.ownerDocument
1772
- });
1773
- } catch (_e) {
1774
- io = new IntersectionObserver(handleObserve, options);
1775
- }
1776
- io.observe(element);
1777
- }
1778
- refresh(true);
1779
- return cleanup;
1780
- }
1781
-
1782
- /**
1783
- * Automatically updates the position of the floating element when necessary.
1784
- * Should only be called when the floating element is mounted on the DOM or
1785
- * visible on the screen.
1786
- * @returns cleanup function that should be invoked when the floating element is
1787
- * removed from the DOM or hidden from the screen.
1788
- * @see https://floating-ui.com/docs/autoUpdate
1789
- */
1790
- function autoUpdate(reference, floating, update, options) {
1791
- if (options === void 0) {
1792
- options = {};
1793
- }
1794
- const {
1795
- ancestorScroll = true,
1796
- ancestorResize = true,
1797
- elementResize = typeof ResizeObserver === 'function',
1798
- layoutShift = typeof IntersectionObserver === 'function',
1799
- animationFrame = false
1800
- } = options;
1801
- const referenceEl = unwrapElement(reference);
1802
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1803
- ancestors.forEach(ancestor => {
1804
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1805
- passive: true
1806
- });
1807
- ancestorResize && ancestor.addEventListener('resize', update);
1808
- });
1809
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1810
- let reobserveFrame = -1;
1811
- let resizeObserver = null;
1812
- if (elementResize) {
1813
- resizeObserver = new ResizeObserver(_ref => {
1814
- let [firstEntry] = _ref;
1815
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1816
- // Prevent update loops when using the `size` middleware.
1817
- // https://github.com/floating-ui/floating-ui/issues/1740
1818
- resizeObserver.unobserve(floating);
1819
- cancelAnimationFrame(reobserveFrame);
1820
- reobserveFrame = requestAnimationFrame(() => {
1821
- var _resizeObserver;
1822
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1823
- });
1824
- }
1825
- update();
1826
- });
1827
- if (referenceEl && !animationFrame) {
1828
- resizeObserver.observe(referenceEl);
1829
- }
1830
- resizeObserver.observe(floating);
1831
- }
1832
- let frameId;
1833
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1834
- if (animationFrame) {
1835
- frameLoop();
1836
- }
1837
- function frameLoop() {
1838
- const nextRefRect = getBoundingClientRect(reference);
1839
- if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1840
- update();
1841
- }
1842
- prevRefRect = nextRefRect;
1843
- frameId = requestAnimationFrame(frameLoop);
1844
- }
1845
- update();
1846
- return () => {
1847
- var _resizeObserver2;
1848
- ancestors.forEach(ancestor => {
1849
- ancestorScroll && ancestor.removeEventListener('scroll', update);
1850
- ancestorResize && ancestor.removeEventListener('resize', update);
1851
- });
1852
- cleanupIo == null || cleanupIo();
1853
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1854
- resizeObserver = null;
1855
- if (animationFrame) {
1856
- cancelAnimationFrame(frameId);
1857
- }
1858
- };
1859
- }
1860
-
1861
- /**
1862
- * Modifies the placement by translating the floating element along the
1863
- * specified axes.
1864
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
1865
- * object may be passed.
1866
- * @see https://floating-ui.com/docs/offset
1867
- */
1868
- const offset = offset$1;
1869
-
1870
- /**
1871
- * Optimizes the visibility of the floating element by shifting it in order to
1872
- * keep it in view when it will overflow the clipping boundary.
1873
- * @see https://floating-ui.com/docs/shift
1874
- */
1875
- const shift = shift$1;
1876
-
1877
- /**
1878
- * Optimizes the visibility of the floating element by flipping the `placement`
1879
- * in order to keep it in view when the preferred placement(s) will overflow the
1880
- * clipping boundary. Alternative to `autoPlacement`.
1881
- * @see https://floating-ui.com/docs/flip
1882
- */
1883
- const flip = flip$1;
1884
-
1885
- /**
1886
- * Provides data that allows you to change the size of the floating element —
1887
- * for instance, prevent it from overflowing the clipping boundary or match the
1888
- * width of the reference element.
1889
- * @see https://floating-ui.com/docs/size
1890
- */
1891
- const size = size$1;
1892
-
1893
- /**
1894
- * Provides data to position an inner element of the floating element so that it
1895
- * appears centered to the reference element.
1896
- * @see https://floating-ui.com/docs/arrow
1897
- */
1898
- const arrow = arrow$1;
1899
-
1900
- /**
1901
- * Provides improved positioning for inline reference elements that can span
1902
- * over multiple lines, such as hyperlinks or range selections.
1903
- * @see https://floating-ui.com/docs/inline
1904
- */
1905
- const inline = inline$1;
1906
-
1907
- /**
1908
- * Built-in `limiter` that will stop `shift()` at a certain point.
1909
- */
1910
- const limitShift = limitShift$1;
1911
-
1912
- /**
1913
- * Computes the `x` and `y` coordinates that will place the floating element
1914
- * next to a given reference element.
1915
- */
1916
- const computePosition = (reference, floating, options) => {
1917
- // This caches the expensive `getClippingElementAncestors` function so that
1918
- // multiple lifecycle resets re-use the same result. It only lives for a
1919
- // single call. If other functions become expensive, we can add them as well.
1920
- const cache = new Map();
1921
- const mergedOptions = {
1922
- platform,
1923
- ...options
1924
- };
1925
- const platformWithCache = {
1926
- ...mergedOptions.platform,
1927
- _c: cache
1928
- };
1929
- return computePosition$1(reference, floating, {
1930
- ...mergedOptions,
1931
- platform: platformWithCache
1932
- });
1933
- };
1934
-
1935
- // src/events.ts
1936
- var ToggleEvent = class extends Event {
1937
- oldState;
1938
- newState;
1939
- constructor(type, { oldState = "", newState = "", ...init } = {}) {
1940
- super(type, init);
1941
- this.oldState = String(oldState || "");
1942
- this.newState = String(newState || "");
1943
- }
1944
- };
1945
- var popoverToggleTaskQueue = /* @__PURE__ */ new WeakMap();
1946
- function queuePopoverToggleEventTask(element, oldState, newState) {
1947
- popoverToggleTaskQueue.set(
1948
- element,
1949
- setTimeout(() => {
1950
- if (!popoverToggleTaskQueue.has(element)) return;
1951
- element.dispatchEvent(
1952
- new ToggleEvent("toggle", {
1953
- cancelable: false,
1954
- oldState,
1955
- newState
1956
- })
1957
- );
1958
- }, 0)
1959
- );
1960
- }
1961
-
1962
- // src/popover-helpers.ts
1963
- var ShadowRoot$1 = globalThis.ShadowRoot || function() {
1964
- };
1965
- var HTMLDialogElement = globalThis.HTMLDialogElement || function() {
1966
- };
1967
- var topLayerElements = /* @__PURE__ */ new WeakMap();
1968
- var autoPopoverList = /* @__PURE__ */ new WeakMap();
1969
- var hintPopoverList = /* @__PURE__ */ new WeakMap();
1970
- var visibilityState = /* @__PURE__ */ new WeakMap();
1971
- function getPopoverVisibilityState(popover) {
1972
- return visibilityState.get(popover) || "hidden";
1973
- }
1974
- var popoverInvoker = /* @__PURE__ */ new WeakMap();
1975
- function lastSetElement(set) {
1976
- return [...set].pop();
1977
- }
1978
- function popoverTargetAttributeActivationBehavior(element) {
1979
- const popover = element.popoverTargetElement;
1980
- if (!(popover instanceof HTMLElement)) {
1981
- return;
1982
- }
1983
- const visibility = getPopoverVisibilityState(popover);
1984
- if (element.popoverTargetAction === "show" && visibility === "showing") {
1985
- return;
1986
- }
1987
- if (element.popoverTargetAction === "hide" && visibility === "hidden") return;
1988
- if (visibility === "showing") {
1989
- hidePopover(popover, true, true);
1990
- } else if (checkPopoverValidity(popover, false)) {
1991
- popoverInvoker.set(popover, element);
1992
- showPopover(popover);
1993
- }
1994
- }
1995
- function checkPopoverValidity(element, expectedToBeShowing) {
1996
- if (element.popover !== "auto" && element.popover !== "manual" && element.popover !== "hint") {
1997
- return false;
1998
- }
1999
- if (!element.isConnected) return false;
2000
- if (expectedToBeShowing && getPopoverVisibilityState(element) !== "showing") {
2001
- return false;
2002
- }
2003
- if (!expectedToBeShowing && getPopoverVisibilityState(element) !== "hidden") {
2004
- return false;
2005
- }
2006
- if (element instanceof HTMLDialogElement && element.hasAttribute("open")) {
2007
- return false;
2008
- }
2009
- if (document.fullscreenElement === element) return false;
2010
- return true;
2011
- }
2012
- function getStackPosition(popover) {
2013
- if (!popover) return 0;
2014
- const autoPopovers = autoPopoverList.get(document) || /* @__PURE__ */ new Set();
2015
- const hintPopovers = hintPopoverList.get(document) || /* @__PURE__ */ new Set();
2016
- if (hintPopovers.has(popover)) {
2017
- return [...hintPopovers].indexOf(popover) + autoPopovers.size + 1;
2018
- }
2019
- if (autoPopovers.has(popover)) {
2020
- return [...autoPopovers].indexOf(popover) + 1;
2021
- }
2022
- return 0;
2023
- }
2024
- function topMostClickedPopover(target) {
2025
- const clickedPopover = nearestInclusiveOpenPopover(target);
2026
- const invokerPopover = nearestInclusiveTargetPopoverForInvoker(target);
2027
- if (getStackPosition(clickedPopover) > getStackPosition(invokerPopover)) {
2028
- return clickedPopover;
2029
- }
2030
- return invokerPopover;
2031
- }
2032
- function topmostAutoOrHintPopover(document2) {
2033
- let topmostPopover;
2034
- const hintPopovers = hintPopoverList.get(document2) || /* @__PURE__ */ new Set();
2035
- const autoPopovers = autoPopoverList.get(document2) || /* @__PURE__ */ new Set();
2036
- const usedStack = hintPopovers.size > 0 ? hintPopovers : autoPopovers.size > 0 ? autoPopovers : null;
2037
- if (usedStack) {
2038
- topmostPopover = lastSetElement(usedStack);
2039
- if (!topmostPopover.isConnected) {
2040
- usedStack.delete(topmostPopover);
2041
- return topmostAutoOrHintPopover(document2);
2042
- }
2043
- return topmostPopover;
2044
- }
2045
- return null;
2046
- }
2047
- function topMostPopoverInList(list) {
2048
- for (const popover of list || []) {
2049
- if (!popover.isConnected) {
2050
- list.delete(popover);
2051
- } else {
2052
- return popover;
2053
- }
2054
- }
2055
- return null;
2056
- }
2057
- function getRootNode(node) {
2058
- if (typeof node.getRootNode === "function") {
2059
- return node.getRootNode();
2060
- }
2061
- if (node.parentNode) return getRootNode(node.parentNode);
2062
- return node;
2063
- }
2064
- function nearestInclusiveOpenPopover(node) {
2065
- while (node) {
2066
- if (node instanceof HTMLElement && node.popover === "auto" && visibilityState.get(node) === "showing") {
2067
- return node;
2068
- }
2069
- node = node instanceof Element && node.assignedSlot || node.parentElement || getRootNode(node);
2070
- if (node instanceof ShadowRoot$1) node = node.host;
2071
- if (node instanceof Document) return;
2072
- }
2073
- }
2074
- function nearestInclusiveTargetPopoverForInvoker(node) {
2075
- while (node) {
2076
- const nodePopover = node.popoverTargetElement;
2077
- if (nodePopover instanceof HTMLElement) return nodePopover;
2078
- node = node.parentElement || getRootNode(node);
2079
- if (node instanceof ShadowRoot$1) node = node.host;
2080
- if (node instanceof Document) return;
2081
- }
2082
- }
2083
- function topMostPopoverAncestor(newPopover, list) {
2084
- const popoverPositions = /* @__PURE__ */ new Map();
2085
- let i = 0;
2086
- for (const popover of list || []) {
2087
- popoverPositions.set(popover, i);
2088
- i += 1;
2089
- }
2090
- popoverPositions.set(newPopover, i);
2091
- i += 1;
2092
- let topMostPopoverAncestor2 = null;
2093
- function checkAncestor(candidate) {
2094
- if (!candidate) return;
2095
- let okNesting = false;
2096
- let candidateAncestor = null;
2097
- let candidatePosition = null;
2098
- while (!okNesting) {
2099
- candidateAncestor = nearestInclusiveOpenPopover(candidate) || null;
2100
- if (candidateAncestor === null) return;
2101
- if (!popoverPositions.has(candidateAncestor)) return;
2102
- if (newPopover.popover === "hint" || candidateAncestor.popover === "auto") {
2103
- okNesting = true;
2104
- }
2105
- if (!okNesting) {
2106
- candidate = candidateAncestor.parentElement;
2107
- }
2108
- }
2109
- candidatePosition = popoverPositions.get(candidateAncestor);
2110
- if (topMostPopoverAncestor2 === null || popoverPositions.get(topMostPopoverAncestor2) < candidatePosition) {
2111
- topMostPopoverAncestor2 = candidateAncestor;
2112
- }
2113
- }
2114
- checkAncestor(newPopover.parentElement || getRootNode(newPopover));
2115
- return topMostPopoverAncestor2;
2116
- }
2117
- function isFocusable(focusTarget) {
2118
- if (focusTarget.hidden || focusTarget instanceof ShadowRoot$1) return false;
2119
- if (focusTarget instanceof HTMLButtonElement || focusTarget instanceof HTMLInputElement || focusTarget instanceof HTMLSelectElement || focusTarget instanceof HTMLTextAreaElement || focusTarget instanceof HTMLOptGroupElement || focusTarget instanceof HTMLOptionElement || focusTarget instanceof HTMLFieldSetElement) {
2120
- if (focusTarget.disabled) return false;
2121
- }
2122
- if (focusTarget instanceof HTMLInputElement && focusTarget.type === "hidden") {
2123
- return false;
2124
- }
2125
- if (focusTarget instanceof HTMLAnchorElement && focusTarget.href === "") {
2126
- return false;
2127
- }
2128
- return typeof focusTarget.tabIndex === "number" && focusTarget.tabIndex !== -1;
2129
- }
2130
- function focusDelegate(focusTarget) {
2131
- if (focusTarget.shadowRoot && focusTarget.shadowRoot.delegatesFocus !== true) {
2132
- return null;
2133
- }
2134
- let whereToLook = focusTarget;
2135
- if (whereToLook.shadowRoot) {
2136
- whereToLook = whereToLook.shadowRoot;
2137
- }
2138
- let autoFocusDelegate = whereToLook.querySelector("[autofocus]");
2139
- if (autoFocusDelegate) {
2140
- return autoFocusDelegate;
2141
- } else {
2142
- const slots = whereToLook.querySelectorAll("slot");
2143
- for (const slot of slots) {
2144
- const assignedElements = slot.assignedElements({ flatten: true });
2145
- for (const el of assignedElements) {
2146
- if (el.hasAttribute("autofocus")) {
2147
- return el;
2148
- } else {
2149
- autoFocusDelegate = el.querySelector("[autofocus]");
2150
- if (autoFocusDelegate) {
2151
- return autoFocusDelegate;
2152
- }
2153
- }
2154
- }
2155
- }
2156
- }
2157
- const walker = focusTarget.ownerDocument.createTreeWalker(
2158
- whereToLook,
2159
- NodeFilter.SHOW_ELEMENT
2160
- );
2161
- let descendant = walker.currentNode;
2162
- while (descendant) {
2163
- if (isFocusable(descendant)) {
2164
- return descendant;
2165
- }
2166
- descendant = walker.nextNode();
2167
- }
2168
- }
2169
- function popoverFocusingSteps(subject) {
2170
- focusDelegate(subject)?.focus();
2171
- }
2172
- var previouslyFocusedElements = /* @__PURE__ */ new WeakMap();
2173
- function showPopover(element) {
2174
- if (!checkPopoverValidity(element, false)) {
2175
- return;
2176
- }
2177
- const document2 = element.ownerDocument;
2178
- if (!element.dispatchEvent(
2179
- new ToggleEvent("beforetoggle", {
2180
- cancelable: true,
2181
- oldState: "closed",
2182
- newState: "open"
2183
- })
2184
- )) {
2185
- return;
2186
- }
2187
- if (!checkPopoverValidity(element, false)) {
2188
- return;
2189
- }
2190
- let shouldRestoreFocus = false;
2191
- const originalType = element.popover;
2192
- let stackToAppendTo = null;
2193
- const autoAncestor = topMostPopoverAncestor(
2194
- element,
2195
- autoPopoverList.get(document2) || /* @__PURE__ */ new Set()
2196
- );
2197
- const hintAncestor = topMostPopoverAncestor(
2198
- element,
2199
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set()
2200
- );
2201
- if (originalType === "auto") {
2202
- closeAllOpenPopoversInList(
2203
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set(),
2204
- shouldRestoreFocus,
2205
- true
2206
- );
2207
- const ancestor = autoAncestor || document2;
2208
- hideAllPopoversUntil(ancestor, shouldRestoreFocus, true);
2209
- stackToAppendTo = "auto";
2210
- }
2211
- if (originalType === "hint") {
2212
- if (hintAncestor) {
2213
- hideAllPopoversUntil(hintAncestor, shouldRestoreFocus, true);
2214
- stackToAppendTo = "hint";
2215
- } else {
2216
- closeAllOpenPopoversInList(
2217
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set(),
2218
- shouldRestoreFocus,
2219
- true
2220
- );
2221
- if (autoAncestor) {
2222
- hideAllPopoversUntil(autoAncestor, shouldRestoreFocus, true);
2223
- stackToAppendTo = "auto";
2224
- } else {
2225
- stackToAppendTo = "hint";
2226
- }
2227
- }
2228
- }
2229
- if (originalType === "auto" || originalType === "hint") {
2230
- if (originalType !== element.popover || !checkPopoverValidity(element, false)) {
2231
- return;
2232
- }
2233
- if (!topmostAutoOrHintPopover(document2)) {
2234
- shouldRestoreFocus = true;
2235
- }
2236
- if (stackToAppendTo === "auto") {
2237
- if (!autoPopoverList.has(document2)) {
2238
- autoPopoverList.set(document2, /* @__PURE__ */ new Set());
2239
- }
2240
- autoPopoverList.get(document2).add(element);
2241
- } else if (stackToAppendTo === "hint") {
2242
- if (!hintPopoverList.has(document2)) {
2243
- hintPopoverList.set(document2, /* @__PURE__ */ new Set());
2244
- }
2245
- hintPopoverList.get(document2).add(element);
2246
- }
2247
- }
2248
- previouslyFocusedElements.delete(element);
2249
- const originallyFocusedElement = document2.activeElement;
2250
- element.classList.add(":popover-open");
2251
- visibilityState.set(element, "showing");
2252
- if (!topLayerElements.has(document2)) {
2253
- topLayerElements.set(document2, /* @__PURE__ */ new Set());
2254
- }
2255
- topLayerElements.get(document2).add(element);
2256
- setInvokerAriaExpanded(popoverInvoker.get(element), true);
2257
- popoverFocusingSteps(element);
2258
- if (shouldRestoreFocus && originallyFocusedElement && element.popover === "auto") {
2259
- previouslyFocusedElements.set(element, originallyFocusedElement);
2260
- }
2261
- queuePopoverToggleEventTask(element, "closed", "open");
2262
- }
2263
- function hidePopover(element, focusPreviousElement = false, fireEvents = false) {
2264
- if (!checkPopoverValidity(element, true)) {
2265
- return;
2266
- }
2267
- const document2 = element.ownerDocument;
2268
- if (["auto", "hint"].includes(element.popover)) {
2269
- hideAllPopoversUntil(element, focusPreviousElement, fireEvents);
2270
- if (!checkPopoverValidity(element, true)) {
2271
- return;
2272
- }
2273
- }
2274
- const autoList = autoPopoverList.get(document2) || /* @__PURE__ */ new Set();
2275
- const autoPopoverListContainsElement = autoList.has(element) && lastSetElement(autoList) === element;
2276
- setInvokerAriaExpanded(popoverInvoker.get(element), false);
2277
- popoverInvoker.delete(element);
2278
- if (fireEvents) {
2279
- element.dispatchEvent(
2280
- new ToggleEvent("beforetoggle", {
2281
- oldState: "open",
2282
- newState: "closed"
2283
- })
2284
- );
2285
- if (autoPopoverListContainsElement && lastSetElement(autoList) !== element) {
2286
- hideAllPopoversUntil(element, focusPreviousElement, fireEvents);
2287
- }
2288
- if (!checkPopoverValidity(element, true)) {
2289
- return;
2290
- }
2291
- }
2292
- topLayerElements.get(document2)?.delete(element);
2293
- autoList.delete(element);
2294
- hintPopoverList.get(document2)?.delete(element);
2295
- element.classList.remove(":popover-open");
2296
- visibilityState.set(element, "hidden");
2297
- if (fireEvents) {
2298
- queuePopoverToggleEventTask(element, "open", "closed");
2299
- }
2300
- const previouslyFocusedElement = previouslyFocusedElements.get(element);
2301
- if (previouslyFocusedElement) {
2302
- previouslyFocusedElements.delete(element);
2303
- if (focusPreviousElement) {
2304
- previouslyFocusedElement.focus();
2305
- }
2306
- }
2307
- }
2308
- function closeAllOpenPopovers(document2, focusPreviousElement = false, fireEvents = false) {
2309
- let popover = topmostAutoOrHintPopover(document2);
2310
- while (popover) {
2311
- hidePopover(popover, focusPreviousElement, fireEvents);
2312
- popover = topmostAutoOrHintPopover(document2);
2313
- }
2314
- }
2315
- function closeAllOpenPopoversInList(list, focusPreviousElement = false, fireEvents = false) {
2316
- let popover = topMostPopoverInList(list);
2317
- while (popover) {
2318
- hidePopover(popover, focusPreviousElement, fireEvents);
2319
- popover = topMostPopoverInList(list);
2320
- }
2321
- }
2322
- function hidePopoverStackUntil(endpoint, set, focusPreviousElement, fireEvents) {
2323
- let repeatingHide = false;
2324
- let hasRunOnce = false;
2325
- while (repeatingHide || !hasRunOnce) {
2326
- hasRunOnce = true;
2327
- let lastToHide = null;
2328
- let foundEndpoint = false;
2329
- for (const popover of set) {
2330
- if (popover === endpoint) {
2331
- foundEndpoint = true;
2332
- } else if (foundEndpoint) {
2333
- lastToHide = popover;
2334
- break;
2335
- }
2336
- }
2337
- if (!lastToHide) return;
2338
- while (getPopoverVisibilityState(lastToHide) === "showing" && set.size) {
2339
- hidePopover(lastSetElement(set), focusPreviousElement, fireEvents);
2340
- }
2341
- if (set.has(endpoint) && lastSetElement(set) !== endpoint) {
2342
- repeatingHide = true;
2343
- }
2344
- if (repeatingHide) {
2345
- fireEvents = false;
2346
- }
2347
- }
2348
- }
2349
- function hideAllPopoversUntil(endpoint, focusPreviousElement, fireEvents) {
2350
- const document2 = endpoint.ownerDocument || endpoint;
2351
- if (endpoint instanceof Document) {
2352
- return closeAllOpenPopovers(document2, focusPreviousElement, fireEvents);
2353
- }
2354
- if (hintPopoverList.get(document2)?.has(endpoint)) {
2355
- hidePopoverStackUntil(
2356
- endpoint,
2357
- hintPopoverList.get(document2),
2358
- focusPreviousElement,
2359
- fireEvents
2360
- );
2361
- return;
2362
- }
2363
- closeAllOpenPopoversInList(
2364
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set(),
2365
- focusPreviousElement,
2366
- fireEvents
2367
- );
2368
- if (!autoPopoverList.get(document2)?.has(endpoint)) {
2369
- return;
2370
- }
2371
- hidePopoverStackUntil(
2372
- endpoint,
2373
- autoPopoverList.get(document2),
2374
- focusPreviousElement,
2375
- fireEvents
2376
- );
2377
- }
2378
- var popoverPointerDownTargets = /* @__PURE__ */ new WeakMap();
2379
- function lightDismissOpenPopovers(event) {
2380
- if (!event.isTrusted) return;
2381
- const target = event.composedPath()[0];
2382
- if (!target) return;
2383
- const document2 = target.ownerDocument;
2384
- const topMostPopover = topmostAutoOrHintPopover(document2);
2385
- if (!topMostPopover) return;
2386
- const ancestor = topMostClickedPopover(target);
2387
- if (ancestor && event.type === "pointerdown") {
2388
- popoverPointerDownTargets.set(document2, ancestor);
2389
- } else if (event.type === "pointerup") {
2390
- const sameTarget = popoverPointerDownTargets.get(document2) === ancestor;
2391
- popoverPointerDownTargets.delete(document2);
2392
- if (sameTarget) {
2393
- hideAllPopoversUntil(ancestor || document2, false, true);
2394
- }
2395
- }
2396
- }
2397
- var initialAriaExpandedValue = /* @__PURE__ */ new WeakMap();
2398
- function setInvokerAriaExpanded(el, force = false) {
2399
- if (!el) return;
2400
- if (!initialAriaExpandedValue.has(el)) {
2401
- initialAriaExpandedValue.set(el, el.getAttribute("aria-expanded"));
2402
- }
2403
- const popover = el.popoverTargetElement;
2404
- if (popover instanceof HTMLElement && popover.popover === "auto") {
2405
- el.setAttribute("aria-expanded", String(force));
2406
- } else {
2407
- const initialValue = initialAriaExpandedValue.get(el);
2408
- if (!initialValue) {
2409
- el.removeAttribute("aria-expanded");
2410
- } else {
2411
- el.setAttribute("aria-expanded", initialValue);
2412
- }
2413
- }
2414
- }
2415
-
2416
- // src/popover.ts
2417
- var ShadowRoot2 = globalThis.ShadowRoot || function() {
2418
- };
2419
- function isSupported() {
2420
- return typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype === "object" && "popover" in HTMLElement.prototype;
2421
- }
2422
- function patchSelectorFn(object, name, mapper) {
2423
- const original = object[name];
2424
- Object.defineProperty(object, name, {
2425
- value(selector) {
2426
- return original.call(this, mapper(selector));
2427
- }
2428
- });
2429
- }
2430
- var nonEscapedPopoverSelector = /(^|[^\\]):popover-open\b/g;
2431
- function hasLayerSupport() {
2432
- return typeof globalThis.CSSLayerBlockRule === "function";
2433
- }
2434
- function getStyles() {
2435
- const useLayer = hasLayerSupport();
2436
- return `
2437
- ${useLayer ? "@layer popover-polyfill {" : ""}
2438
- :where([popover]) {
2439
- position: fixed;
2440
- z-index: 2147483647;
2441
- inset: 0;
2442
- padding: 0.25em;
2443
- width: fit-content;
2444
- height: fit-content;
2445
- border-width: initial;
2446
- border-color: initial;
2447
- border-image: initial;
2448
- border-style: solid;
2449
- background-color: canvas;
2450
- color: canvastext;
2451
- overflow: auto;
2452
- margin: auto;
2453
- }
2454
-
2455
- :where([popover]:not(.\\:popover-open)) {
2456
- display: none;
2457
- }
2458
-
2459
- :where(dialog[popover].\\:popover-open) {
2460
- display: block;
2461
- }
2462
-
2463
- :where(dialog[popover][open]) {
2464
- display: revert;
2465
- }
2466
-
2467
- :where([anchor].\\:popover-open) {
2468
- inset: auto;
2469
- }
2470
-
2471
- :where([anchor]:popover-open) {
2472
- inset: auto;
2473
- }
2474
-
2475
- @supports not (background-color: canvas) {
2476
- :where([popover]) {
2477
- background-color: white;
2478
- color: black;
2479
- }
2480
- }
2481
-
2482
- @supports (width: -moz-fit-content) {
2483
- :where([popover]) {
2484
- width: -moz-fit-content;
2485
- height: -moz-fit-content;
2486
- }
2487
- }
2488
-
2489
- @supports not (inset: 0) {
2490
- :where([popover]) {
2491
- top: 0;
2492
- left: 0;
2493
- right: 0;
2494
- bottom: 0;
2495
- }
2496
- }
2497
- ${useLayer ? "}" : ""}
2498
- `;
2499
- }
2500
- var popoverStyleSheet = null;
2501
- function injectStyles(root) {
2502
- const styles = getStyles();
2503
- if (popoverStyleSheet === null) {
2504
- try {
2505
- popoverStyleSheet = new CSSStyleSheet();
2506
- popoverStyleSheet.replaceSync(styles);
2507
- } catch {
2508
- popoverStyleSheet = false;
2509
- }
2510
- }
2511
- if (popoverStyleSheet === false) {
2512
- const sheet = document.createElement("style");
2513
- sheet.textContent = styles;
2514
- if (root instanceof Document) {
2515
- root.head.prepend(sheet);
2516
- } else {
2517
- root.prepend(sheet);
2518
- }
2519
- } else {
2520
- root.adoptedStyleSheets = [popoverStyleSheet, ...root.adoptedStyleSheets];
2521
- }
2522
- }
2523
- function apply() {
2524
- if (typeof window === "undefined") return;
2525
- window.ToggleEvent = window.ToggleEvent || ToggleEvent;
2526
- function rewriteSelector(selector) {
2527
- if (selector?.includes(":popover-open")) {
2528
- selector = selector.replace(
2529
- nonEscapedPopoverSelector,
2530
- "$1.\\:popover-open"
2531
- );
2532
- }
2533
- return selector;
2534
- }
2535
- patchSelectorFn(Document.prototype, "querySelector", rewriteSelector);
2536
- patchSelectorFn(Document.prototype, "querySelectorAll", rewriteSelector);
2537
- patchSelectorFn(Element.prototype, "querySelector", rewriteSelector);
2538
- patchSelectorFn(Element.prototype, "querySelectorAll", rewriteSelector);
2539
- patchSelectorFn(Element.prototype, "matches", rewriteSelector);
2540
- patchSelectorFn(Element.prototype, "closest", rewriteSelector);
2541
- patchSelectorFn(
2542
- DocumentFragment.prototype,
2543
- "querySelectorAll",
2544
- rewriteSelector
2545
- );
2546
- Object.defineProperties(HTMLElement.prototype, {
2547
- popover: {
2548
- enumerable: true,
2549
- configurable: true,
2550
- get() {
2551
- if (!this.hasAttribute("popover")) return null;
2552
- const value = (this.getAttribute("popover") || "").toLowerCase();
2553
- if (value === "" || value == "auto") return "auto";
2554
- if (value == "hint") return "hint";
2555
- return "manual";
2556
- },
2557
- set(value) {
2558
- if (value === null) {
2559
- this.removeAttribute("popover");
2560
- } else {
2561
- this.setAttribute("popover", value);
2562
- }
2563
- }
2564
- },
2565
- showPopover: {
2566
- enumerable: true,
2567
- configurable: true,
2568
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2569
- value(options = {}) {
2570
- showPopover(this);
2571
- }
2572
- },
2573
- hidePopover: {
2574
- enumerable: true,
2575
- configurable: true,
2576
- value() {
2577
- hidePopover(this, true, true);
2578
- }
2579
- },
2580
- togglePopover: {
2581
- enumerable: true,
2582
- configurable: true,
2583
- value(options = {}) {
2584
- if (typeof options === "boolean") {
2585
- options = { force: options };
2586
- }
2587
- if (visibilityState.get(this) === "showing" && options.force === void 0 || options.force === false) {
2588
- hidePopover(this, true, true);
2589
- } else if (options.force === void 0 || options.force === true) {
2590
- showPopover(this);
2591
- }
2592
- return visibilityState.get(this) === "showing";
2593
- }
2594
- }
2595
- });
2596
- const originalAttachShadow = Element.prototype.attachShadow;
2597
- if (originalAttachShadow) {
2598
- Object.defineProperties(Element.prototype, {
2599
- attachShadow: {
2600
- enumerable: true,
2601
- configurable: true,
2602
- writable: true,
2603
- value(options) {
2604
- const shadowRoot = originalAttachShadow.call(this, options);
2605
- injectStyles(shadowRoot);
2606
- return shadowRoot;
2607
- }
2608
- }
2609
- });
2610
- }
2611
- const originalAttachInternals = HTMLElement.prototype.attachInternals;
2612
- if (originalAttachInternals) {
2613
- Object.defineProperties(HTMLElement.prototype, {
2614
- attachInternals: {
2615
- enumerable: true,
2616
- configurable: true,
2617
- writable: true,
2618
- value() {
2619
- const internals = originalAttachInternals.call(this);
2620
- if (internals.shadowRoot) {
2621
- injectStyles(internals.shadowRoot);
2622
- }
2623
- return internals;
2624
- }
2625
- }
2626
- });
2627
- }
2628
- const popoverTargetAssociatedElements = /* @__PURE__ */ new WeakMap();
2629
- function applyPopoverInvokerElementMixin(ElementClass) {
2630
- Object.defineProperties(ElementClass.prototype, {
2631
- popoverTargetElement: {
2632
- enumerable: true,
2633
- configurable: true,
2634
- set(targetElement) {
2635
- if (targetElement === null) {
2636
- this.removeAttribute("popovertarget");
2637
- popoverTargetAssociatedElements.delete(this);
2638
- } else if (!(targetElement instanceof Element)) {
2639
- throw new TypeError(
2640
- `popoverTargetElement must be an element or null`
2641
- );
2642
- } else {
2643
- this.setAttribute("popovertarget", "");
2644
- popoverTargetAssociatedElements.set(this, targetElement);
2645
- }
2646
- },
2647
- get() {
2648
- if (this.localName !== "button" && this.localName !== "input") {
2649
- return null;
2650
- }
2651
- if (this.localName === "input" && this.type !== "reset" && this.type !== "image" && this.type !== "button") {
2652
- return null;
2653
- }
2654
- if (this.disabled) {
2655
- return null;
2656
- }
2657
- if (this.form && this.type === "submit") {
2658
- return null;
2659
- }
2660
- const targetElement = popoverTargetAssociatedElements.get(this);
2661
- if (targetElement && targetElement.isConnected) {
2662
- return targetElement;
2663
- } else if (targetElement && !targetElement.isConnected) {
2664
- popoverTargetAssociatedElements.delete(this);
2665
- return null;
2666
- }
2667
- const root = getRootNode(this);
2668
- const idref = this.getAttribute("popovertarget");
2669
- if ((root instanceof Document || root instanceof ShadowRoot2) && idref) {
2670
- return root.getElementById(idref) || null;
2671
- }
2672
- return null;
2673
- }
2674
- },
2675
- popoverTargetAction: {
2676
- enumerable: true,
2677
- configurable: true,
2678
- get() {
2679
- const value = (this.getAttribute("popovertargetaction") || "").toLowerCase();
2680
- if (value === "show" || value === "hide") return value;
2681
- return "toggle";
2682
- },
2683
- set(value) {
2684
- this.setAttribute("popovertargetaction", value);
2685
- }
2686
- }
2687
- });
2688
- }
2689
- applyPopoverInvokerElementMixin(HTMLButtonElement);
2690
- applyPopoverInvokerElementMixin(HTMLInputElement);
2691
- const handleInvokerActivation = (event) => {
2692
- const composedPath = event.composedPath();
2693
- const target = composedPath[0];
2694
- if (!(target instanceof Element) || target?.shadowRoot) {
2695
- return;
2696
- }
2697
- const root = getRootNode(target);
2698
- if (!(root instanceof ShadowRoot2 || root instanceof Document)) {
2699
- return;
2700
- }
2701
- const invoker = composedPath.find(
2702
- (el) => el.matches?.("[popovertargetaction],[popovertarget]")
2703
- );
2704
- if (invoker) {
2705
- popoverTargetAttributeActivationBehavior(invoker);
2706
- event.preventDefault();
2707
- return;
2708
- }
2709
- };
2710
- const onKeydown = (event) => {
2711
- const key = event.key;
2712
- const target = event.target;
2713
- if (!event.defaultPrevented && target && (key === "Escape" || key === "Esc")) {
2714
- hideAllPopoversUntil(target.ownerDocument, true, true);
2715
- }
2716
- };
2717
- const addEventListeners = (root) => {
2718
- root.addEventListener("click", handleInvokerActivation);
2719
- root.addEventListener("keydown", onKeydown);
2720
- root.addEventListener("pointerdown", lightDismissOpenPopovers);
2721
- root.addEventListener("pointerup", lightDismissOpenPopovers);
2722
- };
2723
- addEventListeners(document);
2724
- injectStyles(document);
2725
- }
2726
-
2727
- const duration = 250;
2728
- const easing = 'ease-out';
2729
- function popIn(el) {
2730
- if (!el)
2731
- return;
2732
- return el.animate([
2733
- { transform: 'scale(0.9)', opacity: 0 },
2734
- { transform: 'scale(1)', opacity: 1 },
2735
- ], {
2736
- duration,
2737
- easing,
2738
- fill: 'forwards',
2739
- });
2740
- }
2741
-
2742
- const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:var(--post-device-elevation-300);width:max-content;max-width:100%;color:var(--post-current-fg);background-color:var(--post-current-bg);border-radius:4px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:where(post-popovercontainer)>div{border:2px solid rgba(0,0,0,0)}}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer)[safe-space]::after{content:\"\";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--post-safe-space-cursor-x, 0) var(--post-safe-space-cursor-y, 0), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--post-safe-space-trigger-x-start, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-start, 0)), var(--post-safe-space-trigger-x-end, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-end, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)))}:where(post-popovercontainer):not(:has(.arrow))>div{box-shadow:var(--post-device-elevation-300)}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}";
2743
-
2744
- const PostPopovercontainer = /*@__PURE__*/ proxyCustomElement(class PostPopovercontainer extends HTMLElement$1 {
2745
- constructor() {
2746
- super();
2747
- this.__registerHost();
2748
- this.postBeforeShow = createEvent(this, "postBeforeShow", 7);
2749
- this.postShow = createEvent(this, "postShow", 7);
2750
- this.postHide = createEvent(this, "postHide", 7);
2751
- this.postBeforeToggle = createEvent(this, "postBeforeToggle", 7);
2752
- this.postToggle = createEvent(this, "postToggle", 7);
2753
- this.hasOpenedOnce = true;
2754
- /**
2755
- * Defines the placement of the popovercontainer according to the floating-ui options available at https://floating-ui.com/docs/computePosition#placement.
2756
- * Popovercontainers are automatically flipped to the opposite side if there is not enough available space and are shifted
2757
- * towards the viewport if they would overlap edge boundaries.
2758
- */
2759
- this.placement = 'top';
2760
- /**
2761
- * Gap between the edge of the page and the popovercontainer
2762
- */
2763
- this.edgeGap = 8;
2764
- /**
2765
- * Animation style
2766
- */
2767
- this.animation = null;
2768
- /**
2769
- * Whether or not to display a little pointer arrow
2770
- */
2771
- this.arrow = false;
2772
- /**
2773
- * Whether or not the popovercontainer should close when user clicks outside of it
2774
- */
2775
- this.manualClose = false;
2776
- this.currentAnimation = null;
2777
- }
2778
- validatePlacement() {
2779
- checkEmptyOrOneOf(this, 'placement', PLACEMENT_TYPES);
2780
- }
2781
- validateEdgeGap() {
2782
- checkEmptyOrType(this, 'edgeGap', 'number');
2783
- }
2784
- validateSafeSpace() {
2785
- checkEmptyOrOneOf(this, 'safeSpace', ['triangle', 'trapezoid']);
2786
- }
2787
- /**
2788
- * Updates cursor position for safe space feature when popover is open.
2789
- * Sets CSS custom properties for dynamic styling of safe area.
2790
- * @param event MouseEvent with cursor position
2791
- */
2792
- mouseTrackingHandler(event) {
2793
- this.host.style.setProperty('--post-safe-space-cursor-x', `${event.clientX}px`);
2794
- this.host.style.setProperty('--post-safe-space-cursor-y', `${event.clientY}px`);
2795
- }
2796
- connectedCallback() {
2797
- if (IS_BROWSER && !isSupported()) {
2798
- apply();
2799
- }
2800
- }
2801
- componentDidLoad() {
2802
- this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
2803
- }
2804
- disconnectedCallback() {
2805
- if (typeof this.clearAutoUpdate === 'function') {
2806
- this.clearAutoUpdate();
2807
- }
2808
- this.host.removeEventListener('beforetoggle', this.handleToggle.bind(this));
2809
- }
2810
- /**
2811
- * Programmatically display the popovercontainer
2812
- * @param target A focusable element inside the <post-popover-trigger> component that controls the popover
2813
- */
2814
- async show(target) {
2815
- if (this.toggleTimeoutId)
2816
- return;
2817
- this.eventTarget = target;
2818
- this.calculatePosition();
2819
- this.host.showPopover();
2820
- }
2821
- /**
2822
- * Handles the popover opening process and emits related events.
2823
- */
2824
- async open() {
2825
- const content = this.host.querySelector('.popover-content');
2826
- this.startAutoupdates();
2827
- if (content) {
2828
- // Only run animation and emit related events if animation is defined
2829
- if (this.animation === null) {
2830
- // No animation case
2831
- this.postBeforeToggle.emit({ willOpen: true });
2832
- this.postBeforeShow.emit({ first: this.hasOpenedOnce });
2833
- this.postToggle.emit({ isOpen: true });
2834
- this.postShow.emit({ first: this.hasOpenedOnce });
2835
- if (this.hasOpenedOnce)
2836
- this.hasOpenedOnce = false;
2837
- }
2838
- else {
2839
- this.runOpenAnimation(content);
2840
- }
2841
- }
2842
- if (this.safeSpace) {
2843
- window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
2844
- }
2845
- }
2846
- /**
2847
- * Handles the popover closing process and emits related events.
2848
- */
2849
- async close() {
2850
- if (typeof this.clearAutoUpdate === 'function') {
2851
- this.clearAutoUpdate();
2852
- }
2853
- if (this.safeSpace) {
2854
- window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
2855
- }
2856
- // Cancel any running animation
2857
- if (this.animation !== null && this.currentAnimation) {
2858
- this.currentAnimation.cancel();
2859
- this.currentAnimation = null;
2860
- }
2861
- this.postBeforeToggle.emit({ willOpen: false });
2862
- this.postToggle.emit({ isOpen: false });
2863
- this.postHide.emit();
2864
- }
2865
- /**
2866
- * Runs the animation and emits the toggle/show/hide events in the correct timing
2867
- */
2868
- async runOpenAnimation(element) {
2869
- let animation;
2870
- try {
2871
- animation = popIn(element);
2872
- this.currentAnimation = animation;
2873
- if (animation.playState === 'running') {
2874
- this.postBeforeToggle.emit({ willOpen: true });
2875
- this.postBeforeShow.emit({ first: this.hasOpenedOnce });
2876
- }
2877
- await animation.finished;
2878
- this.postToggle.emit({ isOpen: true });
2879
- this.postShow.emit({ first: this.hasOpenedOnce });
2880
- this.hasOpenedOnce = true;
2881
- }
2882
- catch (err) {
2883
- console.warn('Animation failed or was interrupted:', err);
2884
- // Reset all states to closing
2885
- this.postBeforeToggle.emit({ willOpen: false });
2886
- this.postBeforeShow.emit({ first: this.hasOpenedOnce });
2887
- this.postToggle.emit({ isOpen: false });
2888
- }
2889
- finally {
2890
- if (this.currentAnimation === animation) {
2891
- this.currentAnimation = null;
2892
- }
2893
- }
2894
- }
2895
- /**
2896
- * Programmatically hide the popovercontainer
2897
- */
2898
- async hide() {
2899
- if (!this.toggleTimeoutId) {
2900
- this.eventTarget = null;
2901
- this.host.hidePopover();
2902
- this.postHide.emit();
2903
- }
2904
- }
2905
- /**
2906
- * Toggle popovercontainer display
2907
- * @param target A focusable element inside the <post-popover-trigger> component that controls the popover
2908
- * @param force Pass true to always show or false to always hide
2909
- */
2910
- async toggle(target, force) {
2911
- this.eventTarget = target;
2912
- // Prevent instant double toggle
2913
- if (!this.toggleTimeoutId) {
2914
- this.calculatePosition();
2915
- this.host.togglePopover(force);
2916
- this.toggleTimeoutId = null;
2917
- }
2918
- return this.host.matches(':where(:popover-open, .popover-open)');
2919
- }
2920
- /**
2921
- * Start or stop auto updates based on popovercontainer events.
2922
- * Popovercontainers can be closed or opened with other methods than class members,
2923
- * therefore listening to the toggle event is safer for cleaning up.
2924
- * @param e ToggleEvent
2925
- */
2926
- handleToggle(e) {
2927
- this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
2928
- const isOpen = e.newState === 'open';
2929
- if (isOpen) {
2930
- this.open();
2931
- }
2932
- else {
2933
- this.close();
2934
- }
2935
- }
2936
- /**
2937
- * Start listening for DOM updates, scroll events etc. that have
2938
- * an influence on popovercontainer positioning
2939
- */
2940
- startAutoupdates() {
2941
- this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
2942
- }
2943
- /**
2944
- * Retrieves the dynamic height of the header
2945
- */
2946
- getHeaderHeight() {
2947
- const header = document.querySelector('post-header');
2948
- return header ? parseFloat(getComputedStyle(header).height) : 0;
2949
- }
2950
- async calculatePosition() {
2951
- const { x, y, middlewareData, placement } = await this.computeMainPosition();
2952
- const currentPlacement = placement.split('-')[0];
2953
- // Position popover
2954
- this.host.style.left = `${x}px`;
2955
- this.host.style.top = `${y}px`;
2956
- // Position arrow if enabled
2957
- if (this.arrow && middlewareData.arrow) {
2958
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
2959
- const staticSide = PostPopovercontainer.STATIC_SIDES[currentPlacement];
2960
- if (staticSide) {
2961
- Object.assign(this.arrowRef.style, {
2962
- left: arrowX ? `${arrowX}px` : '',
2963
- top: arrowY ? `${arrowY}px` : '',
2964
- [staticSide]: '-5px',
2965
- });
2966
- }
2967
- }
2968
- // Handle safe space if enabled
2969
- if (this.safeSpace && this.eventTarget) {
2970
- await this.updateSafeSpaceBoundaries(currentPlacement);
2971
- }
2972
- }
2973
- async computeMainPosition() {
2974
- const gap = this.edgeGap;
2975
- const middleware = [
2976
- flip({
2977
- padding: this.getHeaderHeight(),
2978
- }),
2979
- inline(),
2980
- shift({
2981
- padding: gap,
2982
- limiter: limitShift({
2983
- offset: 32,
2984
- }),
2985
- }),
2986
- size({
2987
- apply({ availableWidth, elements }) {
2988
- Object.assign(elements.floating.style, {
2989
- maxWidth: `${availableWidth - gap * 2}px`,
2990
- });
2991
- },
2992
- }),
2993
- offset(this.arrow ? gap + 4 : gap),
2994
- ];
2995
- if (this.arrow) {
2996
- middleware.push(arrow({ element: this.arrowRef, padding: gap }));
2997
- }
2998
- return computePosition(this.eventTarget, this.host, {
2999
- placement: this.placement || 'top',
3000
- strategy: 'fixed',
3001
- middleware,
3002
- });
3003
- }
3004
- async updateSafeSpaceBoundaries(currentPlacement) {
3005
- const targetRect = this.eventTarget.getBoundingClientRect();
3006
- const popoverRect = this.host.getBoundingClientRect();
3007
- const isVertical = currentPlacement === 'top' || currentPlacement === 'bottom';
3008
- // Helper function to get positioning data based on placement
3009
- const getPositioningData = (placement, popoverRect, targetRect) => {
3010
- if (placement === 'top' || placement === 'bottom') {
3011
- return {
3012
- popover: {
3013
- y: placement === 'top' ? popoverRect.bottom : popoverRect.top,
3014
- xStart: popoverRect.left,
3015
- xEnd: popoverRect.right,
3016
- },
3017
- trigger: {
3018
- y: placement === 'top' ? targetRect.top : targetRect.bottom,
3019
- xStart: targetRect.left,
3020
- xEnd: targetRect.right,
3021
- },
3022
- };
3023
- }
3024
- else {
3025
- // left or right
3026
- return {
3027
- popover: {
3028
- x: placement === 'left' ? popoverRect.right : popoverRect.left,
3029
- yStart: popoverRect.top,
3030
- yEnd: popoverRect.bottom,
3031
- },
3032
- trigger: {
3033
- x: placement === 'left' ? targetRect.left : targetRect.right,
3034
- yStart: targetRect.top,
3035
- yEnd: targetRect.bottom,
3036
- },
3037
- };
3038
- }
3039
- };
3040
- const posData = getPositioningData(currentPlacement, popoverRect, targetRect);
3041
- // Clear previous values
3042
- PostPopovercontainer.PROPERTIES_TO_CLEAR.forEach(prop => {
3043
- this.host.style.removeProperty(prop);
3044
- });
3045
- if (isVertical) {
3046
- // For top/bottom placement
3047
- this.host.style.setProperty('--post-safe-space-popover-y', `${posData.popover.y}px`);
3048
- this.host.style.setProperty('--post-safe-space-popover-x-start', `${posData.popover.xStart}px`);
3049
- this.host.style.setProperty('--post-safe-space-popover-x-end', `${posData.popover.xEnd}px`);
3050
- this.host.style.setProperty('--post-safe-space-trigger-y', `${posData.trigger.y}px`);
3051
- this.host.style.setProperty('--post-safe-space-trigger-x-start', `${posData.trigger.xStart}px`);
3052
- this.host.style.setProperty('--post-safe-space-trigger-x-end', `${posData.trigger.xEnd}px`);
3053
- }
3054
- else {
3055
- // For left/right placement
3056
- this.host.style.setProperty('--post-safe-space-popover-x', `${posData.popover.x}px`);
3057
- this.host.style.setProperty('--post-safe-space-popover-y-start', `${posData.popover.yStart}px`);
3058
- this.host.style.setProperty('--post-safe-space-popover-y-end', `${posData.popover.yEnd}px`);
3059
- this.host.style.setProperty('--post-safe-space-trigger-x', `${posData.trigger.x}px`);
3060
- this.host.style.setProperty('--post-safe-space-trigger-y-start', `${posData.trigger.yStart}px`);
3061
- this.host.style.setProperty('--post-safe-space-trigger-y-end', `${posData.trigger.yEnd}px`);
3062
- }
3063
- }
3064
- render() {
3065
- return (h(Host, { key: '9ec775608a6bfab69c50e9cefb1a42235deaa451', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: 'b659d1ce9cf9d3b661e3712c689cf1ffb0816f6e', class: "popover-content" }, this.arrow && (h("span", { key: '504e007d07d6b38018d93f5dca5a074b881cd50b', class: "arrow", ref: el => {
3066
- this.arrowRef = el;
3067
- } })), h("slot", { key: '207062f4582b4aad7b570a7453711fd61654d5e3' }))));
3068
- }
3069
- get host() { return this; }
3070
- static get watchers() { return {
3071
- "placement": ["validatePlacement"],
3072
- "edgeGap": ["validateEdgeGap"],
3073
- "safeSpace": ["validateSafeSpace"]
3074
- }; }
3075
- static get style() { return postPopovercontainerCss; }
3076
- }, [4, "post-popovercontainer", {
3077
- "placement": [1],
3078
- "edgeGap": [2, "edge-gap"],
3079
- "animation": [1],
3080
- "arrow": [4],
3081
- "manualClose": [4, "manual-close"],
3082
- "safeSpace": [513, "safe-space"],
3083
- "show": [64],
3084
- "open": [64],
3085
- "close": [64],
3086
- "hide": [64],
3087
- "toggle": [64]
3088
- }, undefined, {
3089
- "placement": ["validatePlacement"],
3090
- "edgeGap": ["validateEdgeGap"],
3091
- "safeSpace": ["validateSafeSpace"]
3092
- }]);
3093
- PostPopovercontainer.STATIC_SIDES = {
3094
- top: 'bottom',
3095
- right: 'left',
3096
- bottom: 'top',
3097
- left: 'right',
3098
- };
3099
- PostPopovercontainer.PROPERTIES_TO_CLEAR = [
3100
- '--post-safe-space-popover-x',
3101
- '--post-safe-space-popover-y',
3102
- '--post-safe-space-popover-x-start',
3103
- '--post-safe-space-popover-x-end',
3104
- '--post-safe-space-popover-y-start',
3105
- '--post-safe-space-popover-y-end',
3106
- '--post-safe-space-trigger-x',
3107
- '--post-safe-space-trigger-y',
3108
- '--post-safe-space-trigger-x-start',
3109
- '--post-safe-space-trigger-x-end',
3110
- '--post-safe-space-trigger-y-start',
3111
- '--post-safe-space-trigger-y-end',
3112
- ];
3113
- function defineCustomElement() {
3114
- if (typeof customElements === "undefined") {
3115
- return;
3116
- }
3117
- const components = ["post-popovercontainer"];
3118
- components.forEach(tagName => { switch (tagName) {
3119
- case "post-popovercontainer":
3120
- if (!customElements.get(tagName)) {
3121
- customElements.define(tagName, PostPopovercontainer);
3122
- }
3123
- break;
3124
- } });
3125
- }
3126
-
3127
- export { PostPopovercontainer as P, PLACEMENT_TYPES as a, defineCustomElement as d };
1
+ import{proxyCustomElement as t,HTMLElement as e,createEvent as n,h as o,Host as r,transformTag as i}from"@stencil/core/internal/client";import{I as s}from"./environment.js";import{d as a,e as c}from"./breakpoints.js";import{v as p}from"./package.js";const l=["top","right","bottom","left","top-start","top-end","right-start","right-end","bottom-start","bottom-end","left-start","left-end"],u=Math.min,f=Math.max,h=Math.round,d=Math.floor,m=t=>({x:t,y:t}),g={left:"right",right:"left",bottom:"top",top:"bottom"},v={start:"end",end:"start"};function w(t,e,n){return f(t,u(e,n))}function x(t,e){return"function"==typeof t?t(e):t}function y(t){return t.split("-")[0]}function b(t){return t.split("-")[1]}function S(t){return"x"===t?"y":"x"}function E(t){return"y"===t?"height":"width"}const k=new Set(["top","bottom"]);function T(t){return k.has(y(t))?"y":"x"}function M(t){return S(T(t))}function A(t){return t.replace(/start|end/g,(t=>v[t]))}const O=["left","right"],H=["right","left"],L=["top","bottom"],$=["bottom","top"];function D(t){return t.replace(/left|right|bottom|top/g,(t=>g[t]))}function P(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function z(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function F(t,e,n){let{reference:o,floating:r}=t;const i=T(e),s=M(e),a=E(s),c=y(e),p="y"===i,l=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,f=o[a]/2-r[a]/2;let h;switch(c){case"top":h={x:l,y:o.y-r.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:u};break;case"left":h={x:o.x-r.width,y:u};break;default:h={x:o.x,y:o.y}}switch(b(e)){case"start":h[s]-=f*(n&&p?-1:1);break;case"end":h[s]+=f*(n&&p?-1:1)}return h}async function C(t,e){var n;void 0===e&&(e={});const{x:o,y:r,platform:i,rects:s,elements:a,strategy:c}=t,{boundary:p="clippingAncestors",rootBoundary:l="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=x(e,t),d=P(h),m=a[f?"floating"===u?"reference":"floating":u],g=z(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:p,rootBoundary:l,strategy:c})),v="floating"===u?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),y=await(null==i.isElement?void 0:i.isElement(w))&&await(null==i.getScale?void 0:i.getScale(w))||{x:1,y:1},b=z(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:c}):v);return{top:(g.top-b.top+d.top)/y.y,bottom:(b.bottom-g.bottom+d.bottom)/y.y,left:(g.left-b.left+d.left)/y.x,right:(b.right-g.right+d.right)/y.x}}function R(t){const e=u(...t.map((t=>t.left))),n=u(...t.map((t=>t.top)));return{x:e,y:n,width:f(...t.map((t=>t.right)))-e,height:f(...t.map((t=>t.bottom)))-n}}const W=new Set(["left","top"]);function j(){return"undefined"!=typeof window}function B(t){return q(t)?(t.nodeName||"").toLowerCase():"#document"}function G(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function I(t){var e;return null==(e=(q(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function q(t){return!!j()&&(t instanceof Node||t instanceof G(t).Node)}function N(t){return!!j()&&(t instanceof Element||t instanceof G(t).Element)}function V(t){return!!j()&&(t instanceof HTMLElement||t instanceof G(t).HTMLElement)}function X(t){return!(!j()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof G(t).ShadowRoot)}const Y=new Set(["inline","contents"]);function _(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=st(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!Y.has(r)}const J=new Set(["table","td","th"]);function K(t){return J.has(B(t))}const Q=[":popover-open",":modal"];function U(t){return Q.some((e=>{try{return t.matches(e)}catch(t){return!1}}))}const Z=["transform","translate","scale","rotate","perspective"],tt=["transform","translate","scale","rotate","perspective","filter"],et=["paint","layout","strict","content"];function nt(t){const e=ot(),n=N(t)?st(t):t;return Z.some((t=>!!n[t]&&"none"!==n[t]))||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||tt.some((t=>(n.willChange||"").includes(t)))||et.some((t=>(n.contain||"").includes(t)))}function ot(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const rt=new Set(["html","body","#document"]);function it(t){return rt.has(B(t))}function st(t){return G(t).getComputedStyle(t)}function at(t){return N(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ct(t){if("html"===B(t))return t;const e=t.assignedSlot||t.parentNode||X(t)&&t.host||I(t);return X(e)?e.host:e}function pt(t){const e=ct(t);return it(e)?t.ownerDocument?t.ownerDocument.body:t.body:V(e)&&_(e)?e:pt(e)}function lt(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const r=pt(t),i=r===(null==(o=t.ownerDocument)?void 0:o.body),s=G(r);if(i){const t=ut(s);return e.concat(s,s.visualViewport||[],_(r)?r:[],t&&n?lt(t):[])}return e.concat(r,lt(r,[],n))}function ut(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ft(t){const e=st(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=V(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,a=h(n)!==i||h(o)!==s;return a&&(n=i,o=s),{width:n,height:o,$:a}}function ht(t){return N(t)?t:t.contextElement}function dt(t){const e=ht(t);if(!V(e))return m(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=ft(e);let s=(i?h(n.width):n.width)/o,a=(i?h(n.height):n.height)/r;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const mt=m(0);function gt(t){const e=G(t);return ot()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:mt}function vt(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const r=t.getBoundingClientRect(),i=ht(t);let s=m(1);e&&(o?N(o)&&(s=dt(o)):s=dt(t));const a=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==G(t))&&e}(i,n,o)?gt(i):m(0);let c=(r.left+a.x)/s.x,p=(r.top+a.y)/s.y,l=r.width/s.x,u=r.height/s.y;if(i){const t=G(i),e=o&&N(o)?G(o):o;let n=t,r=ut(n);for(;r&&o&&e!==n;){const t=dt(r),e=r.getBoundingClientRect(),o=st(r),i=e.left+(r.clientLeft+parseFloat(o.paddingLeft))*t.x,s=e.top+(r.clientTop+parseFloat(o.paddingTop))*t.y;c*=t.x,p*=t.y,l*=t.x,u*=t.y,c+=i,p+=s,n=G(r),r=ut(n)}}return z({width:l,height:u,x:c,y:p})}function wt(t,e){const n=at(t).scrollLeft;return e?e.left+n:vt(I(t)).left+n}function xt(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-wt(t,n),y:n.top+e.scrollTop}}const yt=new Set(["absolute","fixed"]);function bt(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=G(t),o=I(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,a=0,c=0;if(r){i=r.width,s=r.height;const t=ot();(!t||t&&"fixed"===e)&&(a=r.offsetLeft,c=r.offsetTop)}const p=wt(o);if(p<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),r="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(o.clientWidth-e.clientWidth-r);s<=25&&(i-=s)}else p<=25&&(i+=p);return{width:i,height:s,x:a,y:c}}(t,n);else if("document"===e)o=function(t){const e=I(t),n=at(t),o=t.ownerDocument.body,r=f(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=f(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+wt(t);const a=-n.scrollTop;return"rtl"===st(o).direction&&(s+=f(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:a}}(I(t));else if(N(e))o=function(t,e){const n=vt(t,!0,"fixed"===e),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=V(t)?dt(t):m(1);return{width:t.clientWidth*i.x,height:t.clientHeight*i.y,x:r*i.x,y:o*i.y}}(e,n);else{const n=gt(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return z(o)}function St(t,e){const n=ct(t);return!(n===e||!N(n)||it(n))&&("fixed"===st(n).position||St(n,e))}function Et(t,e,n){const o=V(e),r=I(e),i="fixed"===n,s=vt(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const c=m(0);function p(){c.x=wt(r)}if(o||!o&&!i)if(("body"!==B(e)||_(r))&&(a=at(e)),o){const t=vt(e,!0,i,e);c.x=t.x+e.clientLeft,c.y=t.y+e.clientTop}else r&&p();i&&!o&&r&&p();const l=!r||o||i?m(0):xt(r,a);return{x:s.left+a.scrollLeft-c.x-l.x,y:s.top+a.scrollTop-c.y-l.y,width:s.width,height:s.height}}function kt(t){return"static"===st(t).position}function Tt(t,e){if(!V(t)||"fixed"===st(t).position)return null;if(e)return e(t);let n=t.offsetParent;return I(t)===n&&(n=n.ownerDocument.body),n}function Mt(t,e){const n=G(t);if(U(t))return n;if(!V(t)){let e=ct(t);for(;e&&!it(e);){if(N(e)&&!kt(e))return e;e=ct(e)}return n}let o=Tt(t,e);for(;o&&K(o)&&kt(o);)o=Tt(o,e);return o&&it(o)&&kt(o)&&!nt(o)?n:o||function(t){let e=ct(t);for(;V(e)&&!it(e);){if(nt(e))return e;if(U(e))return null;e=ct(e)}return null}(t)||n}const At={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i="fixed"===r,s=I(o),a=!!e&&U(e.floating);if(o===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},p=m(1);const l=m(0),u=V(o);if((u||!u&&!i)&&(("body"!==B(o)||_(s))&&(c=at(o)),V(o))){const t=vt(o);p=dt(o),l.x=t.x+o.clientLeft,l.y=t.y+o.clientTop}const f=!s||u||i?m(0):xt(s,c);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-c.scrollLeft*p.x+l.x+f.x,y:n.y*p.y-c.scrollTop*p.y+l.y+f.y}},getDocumentElement:I,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[..."clippingAncestors"===n?U(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=lt(t,[],!1).filter((t=>N(t)&&"body"!==B(t))),r=null;const i="fixed"===st(t).position;let s=i?ct(t):t;for(;N(s)&&!it(s);){const e=st(s),n=nt(s);n||"fixed"!==e.position||(r=null),(i?!n&&!r:!n&&"static"===e.position&&r&&yt.has(r.position)||_(s)&&!n&&St(t,s))?o=o.filter((t=>t!==s)):r=e,s=ct(s)}return e.set(t,o),o}(e,this._c):[].concat(n),o],s=i.reduce(((t,n)=>{const o=bt(e,n,r);return t.top=f(o.top,t.top),t.right=u(o.right,t.right),t.bottom=u(o.bottom,t.bottom),t.left=f(o.left,t.left),t}),bt(e,i[0],r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Mt,getElementRects:async function(t){const e=this.getOffsetParent||Mt,n=this.getDimensions,o=await n(t.floating);return{reference:Et(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=ft(t);return{width:e,height:n}},getScale:dt,isElement:N,isRTL:function(t){return"rtl"===st(t).direction}};function Ot(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}const Ht=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:a}=e,c=await async function(t,e){const{placement:n,platform:o,elements:r}=t,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),s=y(n),a=b(n),c="y"===T(n),p=W.has(s)?-1:1,l=i&&c?-1:1,u=x(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:d}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof d&&(h="end"===a?-1*d:d),c?{x:h*l,y:f*p}:{x:f*p,y:h*l}}(e,t);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(o=a.arrow)&&o.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:s}}}}},Lt=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...c}=x(t,e),p={x:n,y:o},l=await C(e,c),u=T(y(r)),f=S(u);let h=p[f],d=p[u];i&&(h=w(h+l["y"===f?"top":"left"],h,h-l["y"===f?"bottom":"right"])),s&&(d=w(d+l["y"===u?"top":"left"],d,d-l["y"===u?"bottom":"right"]));const m=a.fn({...e,[f]:h,[u]:d});return{...m,data:{x:m.x-n,y:m.y-o,enabled:{[f]:i,[u]:s}}}}}},$t=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:p}=e,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:m=!0,...g}=x(t,e);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=y(r),w=T(a),S=y(a)===a,k=await(null==c.isRTL?void 0:c.isRTL(p.floating)),P=f||(S||!m?[D(a)]:function(t){const e=D(t);return[A(t),e,A(e)]}(a)),z="none"!==d;!f&&z&&P.push(...function(t,e,n,o){const r=b(t);let i=function(t,e,n){switch(t){case"top":case"bottom":return n?e?H:O:e?O:H;case"left":case"right":return e?L:$;default:return[]}}(y(t),"start"===n,o);return r&&(i=i.map((t=>t+"-"+r)),e&&(i=i.concat(i.map(A)))),i}(a,m,d,k));const F=[a,...P],R=await C(e,g),W=[];let j=(null==(o=i.flip)?void 0:o.overflows)||[];if(l&&W.push(R[v]),u){const t=function(t,e,n){void 0===n&&(n=!1);const o=b(t),r=M(t),i=E(r);let s="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=D(s)),[s,D(s)]}(r,s,k);W.push(R[t[0]],R[t[1]])}if(j=[...j,{placement:r,overflows:W}],!W.every((t=>t<=0))){var B,G;const t=((null==(B=i.flip)?void 0:B.index)||0)+1,e=F[t];if(e&&("alignment"!==u||w===T(e)||j.every((t=>T(t.placement)!==w||t.overflows[0]>0))))return{data:{index:t,overflows:j},reset:{placement:e}};let n=null==(G=j.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:G.placement;if(!n)switch(h){case"bestFit":{var I;const t=null==(I=j.filter((t=>{if(z){const e=T(t.placement);return e===w||"y"===e}return!0})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:I[0];t&&(n=t);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}},Dt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:s,elements:a}=e,{apply:c=()=>{},...p}=x(t,e),l=await C(e,p),h=y(r),d=b(r),m="y"===T(r),{width:g,height:v}=i.floating;let w,S;"top"===h||"bottom"===h?(w=h,S=d===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(S=h,w="end"===d?"top":"bottom");const E=v-l.top-l.bottom,k=g-l.left-l.right;let M=u(v-l[w],E),A=u(g-l[S],k);if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(A=k),null!=(o=e.middlewareData.shift)&&o.enabled.y&&(M=E),!e.middlewareData.shift&&!d){const t=f(l.left,0),e=f(l.right,0),n=f(l.top,0),o=f(l.bottom,0);m?A=g-2*(0!==t||0!==e?t+e:f(l.left,l.right)):M=v-2*(0!==n||0!==o?n+o:f(l.top,l.bottom))}await c({...e,availableWidth:A,availableHeight:M});const O=await s.getDimensions(a.floating);return g!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}},Pt=function(t){return void 0===t&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:i,middlewareData:s}=e,{offset:a=0,mainAxis:c=!0,crossAxis:p=!0}=x(t,e),l={x:n,y:o},u=T(r),f=S(u);let h=l[f],d=l[u];const m=x(a,e),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const t="y"===f?"height":"width",e=i.reference[f]-i.floating[t]+g.mainAxis,n=i.reference[f]+i.reference[t]-g.mainAxis;h<e?h=e:h>n&&(h=n)}if(p){var v,w;const t="y"===f?"width":"height",e=W.has(y(r)),n=i.reference[u]-i.floating[t]+(e&&(null==(v=s.offset)?void 0:v[u])||0)+(e?0:g.crossAxis),o=i.reference[u]+i.reference[t]+(e?0:(null==(w=s.offset)?void 0:w[u])||0)-(e?g.crossAxis:0);d<n?d=n:d>o&&(d=o)}return{[f]:h,[u]:d}}}};var zt=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:n="",...o}={}){super(t,o),this.oldState=String(e||""),this.newState=String(n||"")}},Ft=new WeakMap;function Ct(t,e,n){Ft.set(t,setTimeout((()=>{Ft.has(t)&&t.dispatchEvent(new zt("toggle",{cancelable:!1,oldState:e,newState:n}))}),0))}var Rt=globalThis.ShadowRoot||function(){},Wt=globalThis.HTMLDialogElement||function(){},jt=new WeakMap,Bt=new WeakMap,Gt=new WeakMap,It=new WeakMap;function qt(t){return It.get(t)||"hidden"}var Nt=new WeakMap;function Vt(t){return[...t].pop()}function Xt(t,e){return!("auto"!==t.popover&&"manual"!==t.popover&&"hint"!==t.popover||!t.isConnected||e&&"showing"!==qt(t)||!e&&"hidden"!==qt(t)||t instanceof Wt&&t.hasAttribute("open")||document.fullscreenElement===t)}function Yt(t){if(!t)return 0;const e=Bt.get(document)||new Set,n=Gt.get(document)||new Set;return n.has(t)?[...n].indexOf(t)+e.size+1:e.has(t)?[...e].indexOf(t)+1:0}function _t(t){let e;const n=Gt.get(t)||new Set,o=Bt.get(t)||new Set,r=n.size>0?n:o.size>0?o:null;return r?(e=Vt(r),e.isConnected?e:(r.delete(e),_t(t))):null}function Jt(t){for(const e of t||[]){if(e.isConnected)return e;t.delete(e)}return null}function Kt(t){return"function"==typeof t.getRootNode?t.getRootNode():t.parentNode?Kt(t.parentNode):t}function Qt(t){for(;t;){if(t instanceof HTMLElement&&"auto"===t.popover&&"showing"===It.get(t))return t;if((t=t instanceof Element&&t.assignedSlot||t.parentElement||Kt(t))instanceof Rt&&(t=t.host),t instanceof Document)return}}function Ut(t,e){const n=new Map;let o=0;for(const t of e||[])n.set(t,o),o+=1;n.set(t,o),o+=1;let r=null;return function(e){if(!e)return;let o=!1,i=null,s=null;for(;!o;){if(i=Qt(e)||null,null===i)return;if(!n.has(i))return;"hint"!==t.popover&&"auto"!==i.popover||(o=!0),o||(e=i.parentElement)}s=n.get(i),(null===r||n.get(r)<s)&&(r=i)}(t.parentElement||Kt(t)),r}function Zt(t){return!(t.hidden||t instanceof Rt||(t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLOptGroupElement||t instanceof HTMLOptionElement||t instanceof HTMLFieldSetElement)&&t.disabled||t instanceof HTMLInputElement&&"hidden"===t.type||t instanceof HTMLAnchorElement&&""===t.href||"number"!=typeof t.tabIndex||-1===t.tabIndex)}var te=new WeakMap;function ee(t){if(!Xt(t,!1))return;const e=t.ownerDocument;if(!t.dispatchEvent(new zt("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"})))return;if(!Xt(t,!1))return;let n=!1;const o=t.popover;let r=null;const i=Ut(t,Bt.get(e)||new Set),s=Ut(t,Gt.get(e)||new Set);if("auto"===o&&(oe(Gt.get(e)||new Set,n,!0),ie(i||e,n,!0),r="auto"),"hint"===o&&(s?(ie(s,n,!0),r="hint"):(oe(Gt.get(e)||new Set,n,!0),i?(ie(i,n,!0),r="auto"):r="hint")),"auto"===o||"hint"===o){if(o!==t.popover||!Xt(t,!1))return;_t(e)||(n=!0),"auto"===r?(Bt.has(e)||Bt.set(e,new Set),Bt.get(e).add(t)):"hint"===r&&(Gt.has(e)||Gt.set(e,new Set),Gt.get(e).add(t))}te.delete(t);const a=e.activeElement;var c;t.classList.add(":popover-open"),It.set(t,"showing"),jt.has(e)||jt.set(e,new Set),jt.get(e).add(t),pe(Nt.get(t),!0),c=t,function(t){if(t.shadowRoot&&!0!==t.shadowRoot.delegatesFocus)return null;let e=t;e.shadowRoot&&(e=e.shadowRoot);let n=e.querySelector("[autofocus]");if(n)return n;{const t=e.querySelectorAll("slot");for(const e of t){const t=e.assignedElements({flatten:!0});for(const e of t){if(e.hasAttribute("autofocus"))return e;if(n=e.querySelector("[autofocus]"),n)return n}}}const o=t.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let r=o.currentNode;for(;r;){if(Zt(r))return r;r=o.nextNode()}}(c)?.focus(),n&&a&&"auto"===t.popover&&te.set(t,a),Ct(t,"closed","open")}function ne(t,e=!1,n=!1){if(!Xt(t,!0))return;const o=t.ownerDocument;if(["auto","hint"].includes(t.popover)&&(ie(t,e,n),!Xt(t,!0)))return;const r=Bt.get(o)||new Set,i=r.has(t)&&Vt(r)===t;if(pe(Nt.get(t),!1),Nt.delete(t),n&&(t.dispatchEvent(new zt("beforetoggle",{oldState:"open",newState:"closed"})),i&&Vt(r)!==t&&ie(t,e,n),!Xt(t,!0)))return;jt.get(o)?.delete(t),r.delete(t),Gt.get(o)?.delete(t),t.classList.remove(":popover-open"),It.set(t,"hidden"),n&&Ct(t,"open","closed");const s=te.get(t);s&&(te.delete(t),e&&s.focus())}function oe(t,e=!1,n=!1){let o=Jt(t);for(;o;)ne(o,e,n),o=Jt(t)}function re(t,e,n,o){let r=!1,i=!1;for(;r||!i;){i=!0;let s=null,a=!1;for(const n of e)if(n===t)a=!0;else if(a){s=n;break}if(!s)return;for(;"showing"===qt(s)&&e.size;)ne(Vt(e),n,o);e.has(t)&&Vt(e)!==t&&(r=!0),r&&(o=!1)}}function ie(t,e,n){const o=t.ownerDocument||t;if(t instanceof Document)return function(t,e=!1,n=!1){let o=_t(t);for(;o;)ne(o,e,n),o=_t(t)}(o,e,n);Gt.get(o)?.has(t)?re(t,Gt.get(o),e,n):(oe(Gt.get(o)||new Set,e,n),Bt.get(o)?.has(t)&&re(t,Bt.get(o),e,n))}var se=new WeakMap;function ae(t){if(!t.isTrusted)return;const e=t.composedPath()[0];if(!e)return;const n=e.ownerDocument;if(!_t(n))return;const o=function(t){const e=Qt(t),n=function(t){for(;t;){const e=t.popoverTargetElement;if(e instanceof HTMLElement)return e;if((t=t.parentElement||Kt(t))instanceof Rt&&(t=t.host),t instanceof Document)return}}(t);return Yt(e)>Yt(n)?e:n}(e);if(o&&"pointerdown"===t.type)se.set(n,o);else if("pointerup"===t.type){const t=se.get(n)===o;se.delete(n),t&&ie(o||n,!1,!0)}}var ce=new WeakMap;function pe(t,e=!1){if(!t)return;ce.has(t)||ce.set(t,t.getAttribute("aria-expanded"));const n=t.popoverTargetElement;if(n instanceof HTMLElement&&"auto"===n.popover)t.setAttribute("aria-expanded",String(e));else{const e=ce.get(t);e?t.setAttribute("aria-expanded",e):t.removeAttribute("aria-expanded")}}var le=globalThis.ShadowRoot||function(){};function ue(t,e,n){const o=t[e];Object.defineProperty(t,e,{value(t){return o.call(this,n(t))}})}var fe=/(^|[^\\]):popover-open\b/g;var he=null;function de(t){const e=function(){const t="function"==typeof globalThis.CSSLayerBlockRule;return`\n${t?"@layer popover-polyfill {":""}\n :where([popover]) {\n position: fixed;\n z-index: 2147483647;\n inset: 0;\n padding: 0.25em;\n width: fit-content;\n height: fit-content;\n border-width: initial;\n border-color: initial;\n border-image: initial;\n border-style: solid;\n background-color: canvas;\n color: canvastext;\n overflow: auto;\n margin: auto;\n }\n\n :where([popover]:not(.\\:popover-open)) {\n display: none;\n }\n\n :where(dialog[popover].\\:popover-open) {\n display: block;\n }\n\n :where(dialog[popover][open]) {\n display: revert;\n }\n\n :where([anchor].\\:popover-open) {\n inset: auto;\n }\n\n :where([anchor]:popover-open) {\n inset: auto;\n }\n\n @supports not (background-color: canvas) {\n :where([popover]) {\n background-color: white;\n color: black;\n }\n }\n\n @supports (width: -moz-fit-content) {\n :where([popover]) {\n width: -moz-fit-content;\n height: -moz-fit-content;\n }\n }\n\n @supports not (inset: 0) {\n :where([popover]) {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n }\n${t?"}":""}\n`}();if(null===he)try{(he=new CSSStyleSheet).replaceSync(e)}catch{he=!1}if(!1===he){const n=document.createElement("style");n.textContent=e,t instanceof Document?t.head.prepend(n):t.prepend(n)}else t.adoptedStyleSheets=[he,...t.adoptedStyleSheets]}const me={"pop-in":function(t){if(t)return t.animate([{transform:"scale(0.9)",opacity:0},{transform:"scale(1)",opacity:1}],{duration:250,easing:"ease-out",fill:"forwards"})}},ge=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.postBeforeShow=n(this,"postBeforeShow",7),this.postShow=n(this,"postShow",7),this.postHide=n(this,"postHide",7),this.postBeforeToggle=n(this,"postBeforeToggle",7),this.postToggle=n(this,"postToggle",7),this.hasOpenedOnce=!0,this.placement="top",this.edgeGap=8,this.arrow=!1,this.animation="pop-in",this.currentAnimation=null}validatePlacement(){a(this,"placement",l)}validateEdgeGap(){c(this,"edgeGap","number")}validateSafeSpace(){a(this,"safeSpace",["triangle","trapezoid"])}mouseTrackingHandler(t){this.host.style.setProperty("--post-safe-space-cursor-x",`${t.clientX}px`),this.host.style.setProperty("--post-safe-space-cursor-y",`${t.clientY}px`)}connectedCallback(){!s||"undefined"!=typeof HTMLElement&&"object"==typeof HTMLElement.prototype&&"popover"in HTMLElement.prototype||function(){if("undefined"==typeof window)return;function t(t){return t?.includes(":popover-open")&&(t=t.replace(fe,"$1.\\:popover-open")),t}window.ToggleEvent=window.ToggleEvent||zt,ue(Document.prototype,"querySelector",t),ue(Document.prototype,"querySelectorAll",t),ue(Element.prototype,"querySelector",t),ue(Element.prototype,"querySelectorAll",t),ue(Element.prototype,"matches",t),ue(Element.prototype,"closest",t),ue(DocumentFragment.prototype,"querySelectorAll",t),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;const t=(this.getAttribute("popover")||"").toLowerCase();return""===t||"auto"==t?"auto":"hint"==t?"hint":"manual"},set(t){null===t?this.removeAttribute("popover"):this.setAttribute("popover",t)}},showPopover:{enumerable:!0,configurable:!0,value(t={}){ee(this)}},hidePopover:{enumerable:!0,configurable:!0,value(){ne(this,!0,!0)}},togglePopover:{enumerable:!0,configurable:!0,value(t={}){return"boolean"==typeof t&&(t={force:t}),"showing"===It.get(this)&&void 0===t.force||!1===t.force?ne(this,!0,!0):void 0!==t.force&&!0!==t.force||ee(this),"showing"===It.get(this)}}});const e=Element.prototype.attachShadow;e&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(t){const n=e.call(this,t);return de(n),n}}});const n=HTMLElement.prototype.attachInternals;n&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){const t=n.call(this);return t.shadowRoot&&de(t.shadowRoot),t}}});const o=new WeakMap;function r(t){Object.defineProperties(t.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(t){if(null===t)this.removeAttribute("popovertarget"),o.delete(this);else{if(!(t instanceof Element))throw new TypeError("popoverTargetElement must be an element or null");this.setAttribute("popovertarget",""),o.set(this,t)}},get(){if("button"!==this.localName&&"input"!==this.localName)return null;if("input"===this.localName&&"reset"!==this.type&&"image"!==this.type&&"button"!==this.type)return null;if(this.disabled)return null;if(this.form&&"submit"===this.type)return null;const t=o.get(this);if(t&&t.isConnected)return t;if(t&&!t.isConnected)return o.delete(this),null;const e=Kt(this),n=this.getAttribute("popovertarget");return(e instanceof Document||e instanceof le)&&n&&e.getElementById(n)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){const t=(this.getAttribute("popovertargetaction")||"").toLowerCase();return"show"===t||"hide"===t?t:"toggle"},set(t){this.setAttribute("popovertargetaction",t)}}})}var i;r(HTMLButtonElement),r(HTMLInputElement),(i=document).addEventListener("click",(t=>{const e=t.composedPath(),n=e[0];if(!(n instanceof Element)||n?.shadowRoot)return;const o=Kt(n);if(!(o instanceof le||o instanceof Document))return;const r=e.find((t=>t.matches?.("[popovertargetaction],[popovertarget]")));return r?(function(t){const e=t.popoverTargetElement;if(!(e instanceof HTMLElement))return;const n=qt(e);"show"===t.popoverTargetAction&&"showing"===n||"hide"===t.popoverTargetAction&&"hidden"===n||("showing"===n?ne(e,!0,!0):Xt(e,!1)&&(Nt.set(e,t),ee(e)))}(r),void t.preventDefault()):void 0})),i.addEventListener("keydown",(t=>{const e=t.key,n=t.target;t.defaultPrevented||!n||"Escape"!==e&&"Esc"!==e||ie(n.ownerDocument,!0,!0)})),i.addEventListener("pointerdown",ae),i.addEventListener("pointerup",ae),de(document)}()}componentDidLoad(){this.validatePlacement(),this.validateEdgeGap(),this.validateSafeSpace(),this.host.addEventListener("beforetoggle",this.handleToggle.bind(this))}disconnectedCallback(){"function"==typeof this.clearAutoUpdate&&this.clearAutoUpdate(),this.host.removeEventListener("beforetoggle",this.handleToggle.bind(this))}async show(t){this.toggleTimeoutId||(this.eventTarget=t,this.calculatePosition(),this.host.showPopover())}async hide(){this.toggleTimeoutId||(this.eventTarget=null,this.host.hidePopover(),this.postHide.emit())}async toggle(t,e){return this.eventTarget=t,this.toggleTimeoutId||(this.calculatePosition(),this.host.togglePopover(e),this.toggleTimeoutId=null),this.host.matches(":where(:popover-open, .popover-open)")}open(){const t=this.host.querySelector(".popover-content");if(this.startAutoupdates(),t){const e=me[this.animation];"function"==typeof e?this.runOpenAnimation(e,t):(this.postBeforeToggle.emit({willOpen:!0}),this.postBeforeShow.emit({first:this.hasOpenedOnce}),this.postToggle.emit({isOpen:!0}),this.postShow.emit({first:this.hasOpenedOnce}),this.hasOpenedOnce&&(this.hasOpenedOnce=!1))}this.safeSpace&&window.addEventListener("mousemove",this.mouseTrackingHandler.bind(this))}close(){"function"==typeof this.clearAutoUpdate&&this.clearAutoUpdate(),this.safeSpace&&window.removeEventListener("mousemove",this.mouseTrackingHandler.bind(this)),this.currentAnimation&&(this.currentAnimation.cancel(),this.currentAnimation=null),this.postBeforeToggle.emit({willOpen:!1}),this.postToggle.emit({isOpen:!1}),this.postHide.emit()}async runOpenAnimation(t,e){let n;try{if(n=t(e),!n)return this.postBeforeToggle.emit({willOpen:!0}),this.postBeforeShow.emit({first:this.hasOpenedOnce}),this.postToggle.emit({isOpen:!0}),void this.postShow.emit({first:this.hasOpenedOnce});this.currentAnimation=n,"running"===n.playState&&(this.postBeforeToggle.emit({willOpen:!0}),this.postBeforeShow.emit({first:this.hasOpenedOnce})),await n.finished,this.postToggle.emit({isOpen:!0}),this.postShow.emit({first:this.hasOpenedOnce}),this.hasOpenedOnce=!0}catch(t){console.warn("Animation failed or was interrupted:",t),this.postBeforeToggle.emit({willOpen:!1}),this.postBeforeShow.emit({first:this.hasOpenedOnce}),this.postToggle.emit({isOpen:!1})}finally{this.currentAnimation===n&&(this.currentAnimation=null)}}handleToggle(t){this.toggleTimeoutId=window.setTimeout((()=>this.toggleTimeoutId=null),10),"open"===t.newState?this.open():this.close()}startAutoupdates(){this.eventTarget&&this.host&&(this.clearAutoUpdate=function(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=o,p=ht(t),l=r||i?[...p?lt(p):[],...lt(e)]:[];l.forEach((t=>{r&&t.addEventListener("scroll",n,{passive:!0}),i&&t.addEventListener("resize",n)}));const h=p&&a?function(t,e){let n,o=null;const r=I(t);function i(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function s(a,c){void 0===a&&(a=!1),void 0===c&&(c=1),i();const p=t.getBoundingClientRect(),{left:l,top:h,width:m,height:g}=p;if(a||e(),!m||!g)return;const v={rootMargin:-d(h)+"px "+-d(r.clientWidth-(l+m))+"px "+-d(r.clientHeight-(h+g))+"px "+-d(l)+"px",threshold:f(0,u(1,c))||1};let w=!0;function x(e){const o=e[0].intersectionRatio;if(o!==c){if(!w)return s();o?s(!1,o):n=setTimeout((()=>{s(!1,1e-7)}),1e3)}1!==o||Ot(p,t.getBoundingClientRect())||s(),w=!1}try{o=new IntersectionObserver(x,{...v,root:r.ownerDocument})}catch(t){o=new IntersectionObserver(x,v)}o.observe(t)}(!0),i}(p,n):null;let m,g=-1,v=null;s&&(v=new ResizeObserver((t=>{let[o]=t;o&&o.target===p&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame((()=>{var t;null==(t=v)||t.observe(e)}))),n()})),p&&!c&&v.observe(p),v.observe(e));let w=c?vt(t):null;return c&&function e(){const o=vt(t);w&&!Ot(w,o)&&n(),w=o,m=requestAnimationFrame(e)}(),n(),()=>{var t;l.forEach((t=>{r&&t.removeEventListener("scroll",n),i&&t.removeEventListener("resize",n)})),null==h||h(),null==(t=v)||t.disconnect(),v=null,c&&cancelAnimationFrame(m)}}(this.eventTarget,this.host,this.calculatePosition.bind(this)))}getHeaderHeight(){const t=document.querySelector("post-header");return t?parseFloat(getComputedStyle(t).height):0}async calculatePosition(){const{x:e,y:n,middlewareData:o,placement:r}=await this.computeMainPosition(),i=r.split("-")[0];if(this.dynamicPlacement=i,this.host.style.left=`${e}px`,this.host.style.top=`${n}px`,this.arrow&&o.arrow){const{x:e,y:n}=o.arrow,r=t.STATIC_SIDES[i],s=Number.parseFloat(getComputedStyle(document.documentElement).fontSize),a=getComputedStyle(this.arrowRef).getPropertyValue("--arrow-size").trim(),c=-.5*(a.endsWith("rem")?Number.parseFloat(a)*s:Number.parseFloat(a));r&&Object.assign(this.arrowRef.style,{left:e?`${e}px`:"",top:n?`${n}px`:"",[r]:`${c}px`})}this.safeSpace&&this.eventTarget&&await this.updateSafeSpaceBoundaries(i)}async computeMainPosition(){const t=this.edgeGap,e=[$t({padding:this.getHeaderHeight()}),(void 0===n&&(n={}),{name:"inline",options:n,async fn(t){const{placement:e,elements:o,rects:r,platform:i,strategy:s}=t,{padding:a=2,x:c,y:p}=x(n,t),l=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),h=function(t){const e=t.slice().sort(((t,e)=>t.y-e.y)),n=[];let o=null;for(let t=0;t<e.length;t++){const r=e[t];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map((t=>z(R(t))))}(l),d=z(R(l)),m=P(a),g=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===h.length&&h[0].left>h[1].right&&null!=c&&null!=p)return h.find((t=>c>t.left-m.left&&c<t.right+m.right&&p>t.top-m.top&&p<t.bottom+m.bottom))||d;if(h.length>=2){if("y"===T(e)){const t=h[0],n=h[h.length-1],o="top"===y(e),r=t.top,i=n.bottom,s=o?t.left:n.left,a=o?t.right:n.right;return{top:r,bottom:i,left:s,right:a,width:a-s,height:i-r,x:s,y:r}}const t="left"===y(e),n=f(...h.map((t=>t.right))),o=u(...h.map((t=>t.left))),r=h.filter((e=>t?e.left===o:e.right===n)),i=r[0].top,s=r[r.length-1].bottom;return{top:i,bottom:s,left:o,right:n,width:n-o,height:s-i,x:o,y:i}}return d}},floating:o.floating,strategy:s});return r.reference.x!==g.reference.x||r.reference.y!==g.reference.y||r.reference.width!==g.reference.width||r.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}),Lt({padding:t,limiter:Pt({offset:32})}),Dt({apply({availableWidth:e,elements:n}){Object.assign(n.floating.style,{maxWidth:e-2*t+"px"})}}),Ht(this.arrow?t+4:t)];var n;return this.arrow&&e.push((t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:i,platform:s,elements:a,middlewareData:c}=e,{element:p,padding:l=0}=x(t,e)||{};if(null==p)return{};const f=P(l),h={x:n,y:o},d=M(r),m=E(d),g=await s.getDimensions(p),v="y"===d,y=v?"top":"left",S=v?"bottom":"right",k=v?"clientHeight":"clientWidth",T=i.reference[m]+i.reference[d]-h[d]-i.floating[m],A=h[d]-i.reference[d],O=await(null==s.getOffsetParent?void 0:s.getOffsetParent(p));let H=O?O[k]:0;H&&await(null==s.isElement?void 0:s.isElement(O))||(H=a.floating[k]||i.floating[m]);const L=T/2-A/2,$=H/2-g[m]/2-1,D=u(f[y],$),z=u(f[S],$),F=D,C=H-g[m]-z,R=H/2-g[m]/2+L,W=w(F,R,C),j=!c.arrow&&null!=b(r)&&R!==W&&i.reference[m]/2-(R<F?D:z)-g[m]/2<0,B=j?R<F?R-F:R-C:0;return{[d]:h[d]+B,data:{[d]:W,centerOffset:R-W-B,...j&&{alignmentOffset:B}},reset:j}}}))({element:this.arrowRef,padding:t})),((t,e,n)=>{const o=new Map,r={platform:At,...n},i={...r.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(null==s.isRTL?void 0:s.isRTL(e));let p=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:l,y:u}=F(p,o,c),f=o,h={},d=0;for(let n=0;n<a.length;n++){const{name:i,fn:m}=a[n],{x:g,y:v,data:w,reset:x}=await m({x:l,y:u,initialPlacement:o,placement:f,strategy:r,middlewareData:h,rects:p,platform:s,elements:{reference:t,floating:e}});l=null!=g?g:l,u=null!=v?v:u,h={...h,[i]:{...h[i],...w}},x&&d<=50&&(d++,"object"==typeof x&&(x.placement&&(f=x.placement),x.rects&&(p=!0===x.rects?await s.getElementRects({reference:t,floating:e,strategy:r}):x.rects),({x:l,y:u}=F(p,f,c))),n=-1)}return{x:l,y:u,placement:f,strategy:r,middlewareData:h}})(t,e,{...r,platform:i})})(this.eventTarget,this.host,{placement:this.placement||"top",strategy:"fixed",middleware:e})}async updateSafeSpaceBoundaries(e){const n=this.eventTarget.getBoundingClientRect(),o="top"===e||"bottom"===e,r=((t,e,n)=>"top"===t||"bottom"===t?{popover:{y:"top"===t?e.bottom:e.top,xStart:e.left,xEnd:e.right},trigger:{y:"top"===t?n.top:n.bottom,xStart:n.left,xEnd:n.right}}:{popover:{x:"left"===t?e.right:e.left,yStart:e.top,yEnd:e.bottom},trigger:{x:"left"===t?n.left:n.right,yStart:n.top,yEnd:n.bottom}})(e,this.host.getBoundingClientRect(),n);t.PROPERTIES_TO_CLEAR.forEach((t=>{this.host.style.removeProperty(t)})),o?(this.host.style.setProperty("--post-safe-space-popover-y",`${r.popover.y}px`),this.host.style.setProperty("--post-safe-space-popover-x-start",`${r.popover.xStart}px`),this.host.style.setProperty("--post-safe-space-popover-x-end",`${r.popover.xEnd}px`),this.host.style.setProperty("--post-safe-space-trigger-y",`${r.trigger.y}px`),this.host.style.setProperty("--post-safe-space-trigger-x-start",`${r.trigger.xStart}px`),this.host.style.setProperty("--post-safe-space-trigger-x-end",`${r.trigger.xEnd}px`)):(this.host.style.setProperty("--post-safe-space-popover-x",`${r.popover.x}px`),this.host.style.setProperty("--post-safe-space-popover-y-start",`${r.popover.yStart}px`),this.host.style.setProperty("--post-safe-space-popover-y-end",`${r.popover.yEnd}px`),this.host.style.setProperty("--post-safe-space-trigger-x",`${r.trigger.x}px`),this.host.style.setProperty("--post-safe-space-trigger-y-start",`${r.trigger.yStart}px`),this.host.style.setProperty("--post-safe-space-trigger-y-end",`${r.trigger.yEnd}px`))}render(){return o(r,{key:"f675b14ed97d7f2931781549df8aafd9072faa96","data-version":p,popover:"auto"},o("div",{key:"f66186a7448f60b9f9dcb1b3cbe047a74a85dc7b",class:"popover-content"},this.arrow&&o("span",{key:"d0f8f2baa005522140ac1ef49a0bccc13be72c72","dynamic-placement":this.dynamicPlacement,class:"arrow",ref:t=>{this.arrowRef=t}}),o("slot",{key:"5fbdad6fa76951f4d886ef0ab57e7471ac38c59d"})))}get host(){return this}static get watchers(){return{placement:[{validatePlacement:0}],edgeGap:[{validateEdgeGap:0}],safeSpace:[{validateSafeSpace:0}]}}static get style(){return'@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:var(--post-device-elevation-300);width:max-content;max-width:100%;color:var(--post-current-fg);background-color:var(--post-current-bg);border-radius:4px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:where(post-popovercontainer)>div{border:2px solid rgba(0,0,0,0)}}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer)[safe-space]::after{content:"";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--post-safe-space-cursor-x, 0) var(--post-safe-space-cursor-y, 0), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--post-safe-space-trigger-x-start, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-start, 0)), var(--post-safe-space-trigger-x-end, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-end, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)))}:where(post-popovercontainer):not(:has(.arrow))>div{box-shadow:var(--post-device-elevation-300)}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer) .arrow{--arrow-size: 0.5825rem;position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow[dynamic-placement=top]{border-bottom-right-radius:2px}:where(post-popovercontainer) .arrow[dynamic-placement=right]{border-bottom-left-radius:2px}:where(post-popovercontainer) .arrow[dynamic-placement=bottom]{border-top-left-radius:2px}:where(post-popovercontainer) .arrow[dynamic-placement=left]{border-top-right-radius:2px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:where(post-popovercontainer) .arrow[dynamic-placement=top]{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);bottom:-0.3796735336rem !important}:where(post-popovercontainer) .arrow[dynamic-placement=left]{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);right:-0.3796735336rem !important}:where(post-popovercontainer) .arrow[dynamic-placement=right]{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);left:-0.3796735336rem !important}:where(post-popovercontainer) .arrow[dynamic-placement=bottom]{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);top:-0.3796735336rem !important}}'}},[260,"post-popovercontainer",{placement:[1],edgeGap:[2,"edge-gap"],arrow:[4],safeSpace:[513,"safe-space"],dynamicPlacement:[32],show:[64],hide:[64],toggle:[64]},void 0,{placement:[{validatePlacement:0}],edgeGap:[{validateEdgeGap:0}],safeSpace:[{validateSafeSpace:0}]}]);function ve(){"undefined"!=typeof customElements&&["post-popovercontainer"].forEach((t=>{"post-popovercontainer"===t&&(customElements.get(i(t))||customElements.define(i(t),ge))}))}ge.STATIC_SIDES={top:"bottom",right:"left",bottom:"top",left:"right"},ge.PROPERTIES_TO_CLEAR=["--post-safe-space-popover-x","--post-safe-space-popover-y","--post-safe-space-popover-x-start","--post-safe-space-popover-x-end","--post-safe-space-popover-y-start","--post-safe-space-popover-y-end","--post-safe-space-trigger-x","--post-safe-space-trigger-y","--post-safe-space-trigger-x-start","--post-safe-space-trigger-x-end","--post-safe-space-trigger-y-start","--post-safe-space-trigger-y-end"];export{ge as P,l as a,ve as d}