@swisspost/design-system-components 1.6.3 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/dist/cjs/{check-non-empty-ae713942.js → check-non-empty-eeaa8f77.js} +4 -4
  2. package/dist/cjs/check-non-empty-eeaa8f77.js.map +1 -0
  3. package/dist/cjs/index-8c288b1a.js +45 -0
  4. package/dist/cjs/index-8c288b1a.js.map +1 -0
  5. package/dist/cjs/{index-b619e205.js → index-c07c0cdb.js} +94 -64
  6. package/dist/cjs/index-c07c0cdb.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +17 -12
  8. package/dist/cjs/index.cjs.js.map +1 -1
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/package-cd0e9960.js +7 -0
  11. package/dist/cjs/package-cd0e9960.js.map +1 -0
  12. package/dist/cjs/post-accordion-f2e00198.js +87 -0
  13. package/dist/cjs/post-accordion-f2e00198.js.map +1 -0
  14. package/dist/cjs/post-accordion.cjs.entry.js +4 -80
  15. package/dist/cjs/post-accordion.cjs.entry.js.map +1 -1
  16. package/dist/cjs/post-alert-6d0b5e58.js +101 -0
  17. package/dist/cjs/{post-alert-b46943e0.js.map → post-alert-6d0b5e58.js.map} +1 -1
  18. package/dist/cjs/post-alert.cjs.entry.js +5 -6
  19. package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
  20. package/dist/cjs/{post-collapsible-04364cda.js → post-collapsible-0b8dce97.js} +69 -69
  21. package/dist/cjs/{post-collapsible-04364cda.js.map → post-collapsible-0b8dce97.js.map} +1 -1
  22. package/dist/cjs/post-collapsible.cjs.entry.js +4 -5
  23. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
  24. package/dist/cjs/post-components.cjs.js +3 -3
  25. package/dist/cjs/post-components.cjs.js.map +1 -1
  26. package/dist/cjs/post-icon-3dbb7728.js +105 -0
  27. package/dist/cjs/post-icon-3dbb7728.js.map +1 -0
  28. package/dist/cjs/post-icon.cjs.entry.js +5 -6
  29. package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
  30. package/dist/cjs/post-popover-ea22d235.js +118 -0
  31. package/dist/cjs/post-popover-ea22d235.js.map +1 -0
  32. package/dist/cjs/post-popover.cjs.entry.js +13 -0
  33. package/dist/cjs/post-popover.cjs.entry.js.map +1 -0
  34. package/dist/cjs/post-popovercontainer-42e4ab15.js +1878 -0
  35. package/dist/cjs/post-popovercontainer-42e4ab15.js.map +1 -0
  36. package/dist/cjs/post-popovercontainer.cjs.entry.js +13 -0
  37. package/dist/cjs/post-popovercontainer.cjs.entry.js.map +1 -0
  38. package/dist/cjs/post-tab-header-09074905.js +33 -0
  39. package/dist/cjs/{post-tab-header-805c0a52.js.map → post-tab-header-09074905.js.map} +1 -1
  40. package/dist/cjs/post-tab-header.cjs.entry.js +4 -4
  41. package/dist/cjs/post-tab-panel-9547b9ac.js +27 -0
  42. package/dist/cjs/{post-tab-panel-caa44a77.js.map → post-tab-panel-9547b9ac.js.map} +1 -1
  43. package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
  44. package/dist/cjs/post-tabs-2ec2778e.js +153 -0
  45. package/dist/cjs/post-tabs-2ec2778e.js.map +1 -0
  46. package/dist/cjs/post-tabs.cjs.entry.js +3 -3
  47. package/dist/cjs/{post-tooltip-32a9c549.js → post-tooltip-c802c51f.js} +78 -1754
  48. package/dist/cjs/post-tooltip-c802c51f.js.map +1 -0
  49. package/dist/cjs/post-tooltip.cjs.entry.js +3 -4
  50. package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
  51. package/dist/collection/animations/collapse.js +5 -5
  52. package/dist/collection/animations/collapse.js.map +1 -1
  53. package/dist/collection/collection-manifest.json +5 -3
  54. package/dist/collection/components/post-accordion/post-accordion.js +167 -166
  55. package/dist/collection/components/post-accordion/post-accordion.js.map +1 -1
  56. package/dist/collection/components/post-alert/post-alert.css +2 -2
  57. package/dist/collection/components/post-alert/post-alert.js +246 -246
  58. package/dist/collection/components/post-alert/post-alert.js.map +1 -1
  59. package/dist/collection/components/post-collapsible/post-collapsible.js +169 -168
  60. package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
  61. package/dist/collection/components/post-icon/post-icon.css +1 -1
  62. package/dist/collection/components/post-icon/post-icon.js +250 -250
  63. package/dist/collection/components/post-icon/post-icon.js.map +1 -1
  64. package/dist/collection/components/post-popover/post-popover.css +3 -0
  65. package/dist/collection/components/post-popover/post-popover.js +267 -0
  66. package/dist/collection/components/post-popover/post-popover.js.map +1 -0
  67. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -0
  68. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +288 -0
  69. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js.map +1 -0
  70. package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
  71. package/dist/collection/components/post-tab-header/post-tab-header.js +62 -62
  72. package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
  73. package/dist/collection/components/post-tab-panel/post-tab-panel.js +50 -50
  74. package/dist/collection/components/post-tab-panel/post-tab-panel.js.map +1 -1
  75. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  76. package/dist/collection/components/post-tabs/post-tabs.js +224 -223
  77. package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
  78. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  79. package/dist/collection/components/post-tooltip/post-tooltip.js +192 -325
  80. package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
  81. package/dist/collection/index.js +3 -0
  82. package/dist/collection/index.js.map +1 -1
  83. package/dist/collection/utils/is-motion-reduced.js +1 -1
  84. package/dist/collection/utils/is-motion-reduced.js.map +1 -1
  85. package/dist/collection/utils/property-checkers/check-non-empty.js +3 -3
  86. package/dist/collection/utils/property-checkers/check-non-empty.js.map +1 -1
  87. package/dist/collection/utils/property-checkers/check-one-of.js +2 -2
  88. package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -1
  89. package/dist/collection/utils/property-checkers/check-pattern.js +2 -2
  90. package/dist/collection/utils/property-checkers/check-pattern.js.map +1 -1
  91. package/dist/collection/utils/property-checkers/check-type.js +10 -10
  92. package/dist/collection/utils/property-checkers/check-type.js.map +1 -1
  93. package/dist/collection/utils/property-checkers/empty-or.js +5 -5
  94. package/dist/collection/utils/property-checkers/empty-or.js.map +1 -1
  95. package/dist/components/check-non-empty.js +3 -3
  96. package/dist/components/check-non-empty.js.map +1 -1
  97. package/dist/components/index.js +3 -0
  98. package/dist/components/index.js.map +1 -1
  99. package/dist/components/index2.js +22 -18
  100. package/dist/components/index2.js.map +1 -1
  101. package/dist/components/package.js +1 -1
  102. package/dist/components/post-accordion.d.ts +2 -2
  103. package/dist/components/post-accordion.js +1 -101
  104. package/dist/components/post-accordion.js.map +1 -1
  105. package/dist/components/post-accordion2.js +105 -0
  106. package/dist/components/post-accordion2.js.map +1 -0
  107. package/dist/components/post-alert.d.ts +2 -2
  108. package/dist/components/post-alert2.js +119 -119
  109. package/dist/components/post-alert2.js.map +1 -1
  110. package/dist/components/post-collapsible.d.ts +2 -2
  111. package/dist/components/post-collapsible2.js +90 -90
  112. package/dist/components/post-collapsible2.js.map +1 -1
  113. package/dist/components/post-icon.d.ts +2 -2
  114. package/dist/components/post-icon2.js +118 -118
  115. package/dist/components/post-icon2.js.map +1 -1
  116. package/dist/components/post-popover.d.ts +11 -0
  117. package/dist/components/post-popover.js +8 -0
  118. package/dist/components/post-popover.js.map +1 -0
  119. package/dist/components/post-popover2.js +144 -0
  120. package/dist/components/post-popover2.js.map +1 -0
  121. package/dist/components/post-popovercontainer.d.ts +11 -0
  122. package/dist/components/post-popovercontainer.js +8 -0
  123. package/dist/components/post-popovercontainer.js.map +1 -0
  124. package/dist/components/post-popovercontainer2.js +1897 -0
  125. package/dist/components/post-popovercontainer2.js.map +1 -0
  126. package/dist/components/post-tab-header.d.ts +2 -2
  127. package/dist/components/post-tab-header2.js +38 -38
  128. package/dist/components/post-tab-header2.js.map +1 -1
  129. package/dist/components/post-tab-panel.d.ts +2 -2
  130. package/dist/components/post-tab-panel2.js +30 -30
  131. package/dist/components/post-tab-panel2.js.map +1 -1
  132. package/dist/components/post-tabs.d.ts +2 -2
  133. package/dist/components/post-tabs2.js +147 -147
  134. package/dist/components/post-tabs2.js.map +1 -1
  135. package/dist/components/post-tooltip.d.ts +2 -2
  136. package/dist/components/post-tooltip2.js +100 -1774
  137. package/dist/components/post-tooltip2.js.map +1 -1
  138. package/dist/docs.d.ts +1 -21
  139. package/dist/docs.json +604 -77
  140. package/dist/esm/check-non-empty-58bd6b17.js +11 -0
  141. package/dist/esm/{check-non-empty-09c39561.js.map → check-non-empty-58bd6b17.js.map} +1 -1
  142. package/dist/esm/index-1427953c.js +40 -0
  143. package/dist/esm/index-1427953c.js.map +1 -0
  144. package/dist/esm/{index-4eff5fc5.js → index-35998e08.js} +94 -64
  145. package/dist/esm/index-35998e08.js.map +1 -0
  146. package/dist/esm/index.js +14 -12
  147. package/dist/esm/index.js.map +1 -1
  148. package/dist/esm/loader.js +3 -3
  149. package/dist/esm/package-337354c3.js +5 -0
  150. package/dist/esm/package-337354c3.js.map +1 -0
  151. package/dist/esm/post-accordion-c2013bb3.js +85 -0
  152. package/dist/esm/post-accordion-c2013bb3.js.map +1 -0
  153. package/dist/esm/post-accordion.entry.js +3 -83
  154. package/dist/esm/post-accordion.entry.js.map +1 -1
  155. package/dist/esm/post-alert-7254a70f.js +99 -0
  156. package/dist/esm/{post-alert-e457e249.js.map → post-alert-7254a70f.js.map} +1 -1
  157. package/dist/esm/post-alert.entry.js +5 -6
  158. package/dist/esm/post-alert.entry.js.map +1 -1
  159. package/dist/esm/{post-collapsible-c0a826b2.js → post-collapsible-4464cc98.js} +69 -69
  160. package/dist/esm/{post-collapsible-c0a826b2.js.map → post-collapsible-4464cc98.js.map} +1 -1
  161. package/dist/esm/post-collapsible.entry.js +4 -5
  162. package/dist/esm/post-collapsible.entry.js.map +1 -1
  163. package/dist/esm/post-components.js +4 -4
  164. package/dist/esm/post-components.js.map +1 -1
  165. package/dist/esm/post-icon-e0bbf0f5.js +103 -0
  166. package/dist/esm/post-icon-e0bbf0f5.js.map +1 -0
  167. package/dist/esm/post-icon.entry.js +5 -6
  168. package/dist/esm/post-icon.entry.js.map +1 -1
  169. package/dist/esm/post-popover-25eb3f76.js +116 -0
  170. package/dist/esm/post-popover-25eb3f76.js.map +1 -0
  171. package/dist/esm/post-popover.entry.js +5 -0
  172. package/dist/esm/post-popover.entry.js.map +1 -0
  173. package/dist/esm/post-popovercontainer-54117eea.js +1876 -0
  174. package/dist/esm/post-popovercontainer-54117eea.js.map +1 -0
  175. package/dist/esm/post-popovercontainer.entry.js +5 -0
  176. package/dist/esm/post-popovercontainer.entry.js.map +1 -0
  177. package/dist/esm/post-tab-header-1684b507.js +31 -0
  178. package/dist/esm/{post-tab-header-f0c355d6.js.map → post-tab-header-1684b507.js.map} +1 -1
  179. package/dist/esm/post-tab-header.entry.js +4 -4
  180. package/dist/esm/post-tab-panel-add26fe5.js +25 -0
  181. package/dist/esm/{post-tab-panel-46f02247.js.map → post-tab-panel-add26fe5.js.map} +1 -1
  182. package/dist/esm/post-tab-panel.entry.js +3 -3
  183. package/dist/esm/post-tabs-d738e61f.js +151 -0
  184. package/dist/esm/post-tabs-d738e61f.js.map +1 -0
  185. package/dist/esm/post-tabs.entry.js +3 -3
  186. package/dist/esm/{post-tooltip-fa7b4a0a.js → post-tooltip-57928808.js} +78 -1754
  187. package/dist/esm/post-tooltip-57928808.js.map +1 -0
  188. package/dist/esm/post-tooltip.entry.js +3 -4
  189. package/dist/esm/post-tooltip.entry.js.map +1 -1
  190. package/dist/post-components/index.esm.js +1 -1
  191. package/dist/post-components/p-05e85f2b.entry.js +2 -0
  192. package/dist/post-components/p-08abd53e.entry.js +2 -0
  193. package/dist/post-components/p-09892ad1.js +2 -0
  194. package/dist/post-components/{p-fffce1d7.js.map → p-09892ad1.js.map} +1 -1
  195. package/dist/post-components/p-1e9ec4a9.entry.js +2 -0
  196. package/dist/post-components/p-1f55663e.js +2 -0
  197. package/dist/post-components/p-1f55663e.js.map +1 -0
  198. package/dist/post-components/p-30c60b6c.entry.js +2 -0
  199. package/dist/post-components/p-38d97f62.entry.js +2 -0
  200. package/dist/post-components/p-4c188911.entry.js +2 -0
  201. package/dist/post-components/p-568bb469.entry.js +2 -0
  202. package/dist/post-components/p-65c8bd5c.entry.js +2 -0
  203. package/dist/post-components/p-6e3158e8.js +2 -0
  204. package/dist/post-components/{p-ca1e407c.js.map → p-6e3158e8.js.map} +1 -1
  205. package/dist/post-components/p-7d32dfb7.js +2 -0
  206. package/dist/post-components/{p-8b6fe20d.js.map → p-7d32dfb7.js.map} +1 -1
  207. package/dist/post-components/p-81591ad0.js +3 -0
  208. package/dist/post-components/p-81591ad0.js.map +1 -0
  209. package/dist/post-components/p-96f4ebc4.js +2 -0
  210. package/dist/post-components/p-96f4ebc4.js.map +1 -0
  211. package/dist/post-components/p-9bd5f824.js +2 -0
  212. package/dist/post-components/p-9bd5f824.js.map +1 -0
  213. package/dist/post-components/{p-b531475e.js → p-b095519d.js} +1 -1
  214. package/dist/post-components/p-b4b4f59a.js +2 -0
  215. package/dist/post-components/p-bd032124.js +2 -0
  216. package/dist/post-components/p-bd032124.js.map +1 -0
  217. package/dist/post-components/p-c5858d52.entry.js +2 -0
  218. package/dist/post-components/p-c5858d52.entry.js.map +1 -0
  219. package/dist/post-components/{p-7b8797c6.entry.js → p-dbd07f20.js} +2 -2
  220. package/dist/post-components/p-de493e36.js +2 -0
  221. package/dist/post-components/p-de493e36.js.map +1 -0
  222. package/dist/post-components/{p-3604be27.js → p-eaddd6cc.js} +2 -2
  223. package/dist/post-components/p-ed73d4c0.entry.js +2 -0
  224. package/dist/post-components/p-ed73d4c0.entry.js.map +1 -0
  225. package/dist/post-components/p-f994dce8.js +9 -0
  226. package/dist/post-components/p-f994dce8.js.map +1 -0
  227. package/dist/post-components/post-components.esm.js +1 -1
  228. package/dist/post-components/post-components.esm.js.map +1 -1
  229. package/dist/types/components/post-accordion/post-accordion.d.ts +26 -26
  230. package/dist/types/components/post-alert/post-alert.d.ts +45 -45
  231. package/dist/types/components/post-collapsible/post-collapsible.d.ts +31 -31
  232. package/dist/types/components/post-icon/post-icon.d.ts +43 -43
  233. package/dist/types/components/post-popover/post-popover.d.ts +53 -0
  234. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +62 -0
  235. package/dist/types/components/post-tab-header/post-tab-header.d.ts +9 -9
  236. package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +8 -8
  237. package/dist/types/components/post-tabs/post-tabs.d.ts +32 -32
  238. package/dist/types/components/post-tooltip/post-tooltip.d.ts +35 -62
  239. package/dist/types/components.d.ts +115 -10
  240. package/dist/types/index.d.ts +3 -0
  241. package/dist/types/stencil-public-runtime.d.ts +8 -0
  242. package/package.json +15 -13
  243. package/dist/cjs/check-non-empty-ae713942.js.map +0 -1
  244. package/dist/cjs/check-one-of-27ad3154.js +0 -10
  245. package/dist/cjs/check-one-of-27ad3154.js.map +0 -1
  246. package/dist/cjs/index-b38a23e0.js +0 -41
  247. package/dist/cjs/index-b38a23e0.js.map +0 -1
  248. package/dist/cjs/index-b619e205.js.map +0 -1
  249. package/dist/cjs/package-4e9ab85c.js +0 -7
  250. package/dist/cjs/package-4e9ab85c.js.map +0 -1
  251. package/dist/cjs/post-alert-b46943e0.js +0 -101
  252. package/dist/cjs/post-icon-5b36814e.js +0 -105
  253. package/dist/cjs/post-icon-5b36814e.js.map +0 -1
  254. package/dist/cjs/post-tab-header-805c0a52.js +0 -33
  255. package/dist/cjs/post-tab-panel-caa44a77.js +0 -27
  256. package/dist/cjs/post-tabs-29d4dc70.js +0 -153
  257. package/dist/cjs/post-tabs-29d4dc70.js.map +0 -1
  258. package/dist/cjs/post-tooltip-32a9c549.js.map +0 -1
  259. package/dist/components/check-one-of.js +0 -8
  260. package/dist/components/check-one-of.js.map +0 -1
  261. package/dist/esm/check-non-empty-09c39561.js +0 -11
  262. package/dist/esm/check-one-of-74750af9.js +0 -8
  263. package/dist/esm/check-one-of-74750af9.js.map +0 -1
  264. package/dist/esm/index-35921354.js +0 -36
  265. package/dist/esm/index-35921354.js.map +0 -1
  266. package/dist/esm/index-4eff5fc5.js.map +0 -1
  267. package/dist/esm/package-b9b10dd3.js +0 -5
  268. package/dist/esm/package-b9b10dd3.js.map +0 -1
  269. package/dist/esm/post-alert-e457e249.js +0 -99
  270. package/dist/esm/post-icon-b34da686.js +0 -103
  271. package/dist/esm/post-icon-b34da686.js.map +0 -1
  272. package/dist/esm/post-tab-header-f0c355d6.js +0 -31
  273. package/dist/esm/post-tab-panel-46f02247.js +0 -25
  274. package/dist/esm/post-tabs-5dd55290.js +0 -151
  275. package/dist/esm/post-tabs-5dd55290.js.map +0 -1
  276. package/dist/esm/post-tooltip-fa7b4a0a.js.map +0 -1
  277. package/dist/post-components/p-1339f8cd.js +0 -2
  278. package/dist/post-components/p-1339f8cd.js.map +0 -1
  279. package/dist/post-components/p-195b8c88.entry.js +0 -2
  280. package/dist/post-components/p-3225e008.entry.js +0 -2
  281. package/dist/post-components/p-61ffffa9.entry.js +0 -2
  282. package/dist/post-components/p-88262544.js +0 -2
  283. package/dist/post-components/p-8b6fe20d.js +0 -2
  284. package/dist/post-components/p-9f71d450.js +0 -2
  285. package/dist/post-components/p-a7649277.js +0 -3
  286. package/dist/post-components/p-a7649277.js.map +0 -1
  287. package/dist/post-components/p-a7c78dea.entry.js +0 -2
  288. package/dist/post-components/p-b2c3ed97.entry.js +0 -2
  289. package/dist/post-components/p-ba9aba3a.entry.js +0 -2
  290. package/dist/post-components/p-bd293ff3.entry.js +0 -2
  291. package/dist/post-components/p-ca1e407c.js +0 -2
  292. package/dist/post-components/p-d407b1c3.js +0 -2
  293. package/dist/post-components/p-d407b1c3.js.map +0 -1
  294. package/dist/post-components/p-dfe29f7f.js +0 -2
  295. package/dist/post-components/p-dfe29f7f.js.map +0 -1
  296. package/dist/post-components/p-fd7015ae.js +0 -9
  297. package/dist/post-components/p-fd7015ae.js.map +0 -1
  298. package/dist/post-components/p-fffce1d7.js +0 -2
  299. /package/dist/post-components/{p-195b8c88.entry.js.map → p-05e85f2b.entry.js.map} +0 -0
  300. /package/dist/post-components/{p-3225e008.entry.js.map → p-08abd53e.entry.js.map} +0 -0
  301. /package/dist/post-components/{p-61ffffa9.entry.js.map → p-1e9ec4a9.entry.js.map} +0 -0
  302. /package/dist/post-components/{p-88262544.js.map → p-30c60b6c.entry.js.map} +0 -0
  303. /package/dist/post-components/{p-a7c78dea.entry.js.map → p-38d97f62.entry.js.map} +0 -0
  304. /package/dist/post-components/{p-b2c3ed97.entry.js.map → p-4c188911.entry.js.map} +0 -0
  305. /package/dist/post-components/{p-ba9aba3a.entry.js.map → p-568bb469.entry.js.map} +0 -0
  306. /package/dist/post-components/{p-bd293ff3.entry.js.map → p-65c8bd5c.entry.js.map} +0 -0
  307. /package/dist/post-components/{p-b531475e.js.map → p-b095519d.js.map} +0 -0
  308. /package/dist/post-components/{p-9f71d450.js.map → p-b4b4f59a.js.map} +0 -0
  309. /package/dist/post-components/{p-7b8797c6.entry.js.map → p-dbd07f20.js.map} +0 -0
  310. /package/dist/post-components/{p-3604be27.js.map → p-eaddd6cc.js.map} +0 -0
@@ -0,0 +1,1897 @@
1
+ import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version } from './package.js';
3
+
4
+ /**
5
+ * Custom positioning reference element.
6
+ * @see https://floating-ui.com/docs/virtual-elements
7
+ */
8
+ const min = Math.min;
9
+ const max = Math.max;
10
+ const round = Math.round;
11
+ const floor = Math.floor;
12
+ const createCoords = v => ({
13
+ x: v,
14
+ y: v
15
+ });
16
+ const oppositeSideMap = {
17
+ left: 'right',
18
+ right: 'left',
19
+ bottom: 'top',
20
+ top: 'bottom'
21
+ };
22
+ const oppositeAlignmentMap = {
23
+ start: 'end',
24
+ end: 'start'
25
+ };
26
+ function clamp(start, value, end) {
27
+ return max(start, min(value, end));
28
+ }
29
+ function evaluate(value, param) {
30
+ return typeof value === 'function' ? value(param) : value;
31
+ }
32
+ function getSide(placement) {
33
+ return placement.split('-')[0];
34
+ }
35
+ function getAlignment(placement) {
36
+ return placement.split('-')[1];
37
+ }
38
+ function getOppositeAxis(axis) {
39
+ return axis === 'x' ? 'y' : 'x';
40
+ }
41
+ function getAxisLength(axis) {
42
+ return axis === 'y' ? 'height' : 'width';
43
+ }
44
+ function getSideAxis(placement) {
45
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
46
+ }
47
+ function getAlignmentAxis(placement) {
48
+ return getOppositeAxis(getSideAxis(placement));
49
+ }
50
+ function getAlignmentSides(placement, rects, rtl) {
51
+ if (rtl === void 0) {
52
+ rtl = false;
53
+ }
54
+ const alignment = getAlignment(placement);
55
+ const alignmentAxis = getAlignmentAxis(placement);
56
+ const length = getAxisLength(alignmentAxis);
57
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
58
+ if (rects.reference[length] > rects.floating[length]) {
59
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
60
+ }
61
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
62
+ }
63
+ function getExpandedPlacements(placement) {
64
+ const oppositePlacement = getOppositePlacement(placement);
65
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
66
+ }
67
+ function getOppositeAlignmentPlacement(placement) {
68
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
69
+ }
70
+ function getSideList(side, isStart, rtl) {
71
+ const lr = ['left', 'right'];
72
+ const rl = ['right', 'left'];
73
+ const tb = ['top', 'bottom'];
74
+ const bt = ['bottom', 'top'];
75
+ switch (side) {
76
+ case 'top':
77
+ case 'bottom':
78
+ if (rtl) return isStart ? rl : lr;
79
+ return isStart ? lr : rl;
80
+ case 'left':
81
+ case 'right':
82
+ return isStart ? tb : bt;
83
+ default:
84
+ return [];
85
+ }
86
+ }
87
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
88
+ const alignment = getAlignment(placement);
89
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
90
+ if (alignment) {
91
+ list = list.map(side => side + "-" + alignment);
92
+ if (flipAlignment) {
93
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
94
+ }
95
+ }
96
+ return list;
97
+ }
98
+ function getOppositePlacement(placement) {
99
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
100
+ }
101
+ function expandPaddingObject(padding) {
102
+ return {
103
+ top: 0,
104
+ right: 0,
105
+ bottom: 0,
106
+ left: 0,
107
+ ...padding
108
+ };
109
+ }
110
+ function getPaddingObject(padding) {
111
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
112
+ top: padding,
113
+ right: padding,
114
+ bottom: padding,
115
+ left: padding
116
+ };
117
+ }
118
+ function rectToClientRect(rect) {
119
+ return {
120
+ ...rect,
121
+ top: rect.y,
122
+ left: rect.x,
123
+ right: rect.x + rect.width,
124
+ bottom: rect.y + rect.height
125
+ };
126
+ }
127
+
128
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
129
+ let {
130
+ reference,
131
+ floating
132
+ } = _ref;
133
+ const sideAxis = getSideAxis(placement);
134
+ const alignmentAxis = getAlignmentAxis(placement);
135
+ const alignLength = getAxisLength(alignmentAxis);
136
+ const side = getSide(placement);
137
+ const isVertical = sideAxis === 'y';
138
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
139
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
140
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
141
+ let coords;
142
+ switch (side) {
143
+ case 'top':
144
+ coords = {
145
+ x: commonX,
146
+ y: reference.y - floating.height
147
+ };
148
+ break;
149
+ case 'bottom':
150
+ coords = {
151
+ x: commonX,
152
+ y: reference.y + reference.height
153
+ };
154
+ break;
155
+ case 'right':
156
+ coords = {
157
+ x: reference.x + reference.width,
158
+ y: commonY
159
+ };
160
+ break;
161
+ case 'left':
162
+ coords = {
163
+ x: reference.x - floating.width,
164
+ y: commonY
165
+ };
166
+ break;
167
+ default:
168
+ coords = {
169
+ x: reference.x,
170
+ y: reference.y
171
+ };
172
+ }
173
+ switch (getAlignment(placement)) {
174
+ case 'start':
175
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
176
+ break;
177
+ case 'end':
178
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
179
+ break;
180
+ }
181
+ return coords;
182
+ }
183
+
184
+ /**
185
+ * Computes the `x` and `y` coordinates that will place the floating element
186
+ * next to a given reference element.
187
+ *
188
+ * This export does not have any `platform` interface logic. You will need to
189
+ * write one for the platform you are using Floating UI with.
190
+ */
191
+ const computePosition$1 = async (reference, floating, config) => {
192
+ const {
193
+ placement = 'bottom',
194
+ strategy = 'absolute',
195
+ middleware = [],
196
+ platform
197
+ } = config;
198
+ const validMiddleware = middleware.filter(Boolean);
199
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
200
+ let rects = await platform.getElementRects({
201
+ reference,
202
+ floating,
203
+ strategy
204
+ });
205
+ let {
206
+ x,
207
+ y
208
+ } = computeCoordsFromPlacement(rects, placement, rtl);
209
+ let statefulPlacement = placement;
210
+ let middlewareData = {};
211
+ let resetCount = 0;
212
+ for (let i = 0; i < validMiddleware.length; i++) {
213
+ const {
214
+ name,
215
+ fn
216
+ } = validMiddleware[i];
217
+ const {
218
+ x: nextX,
219
+ y: nextY,
220
+ data,
221
+ reset
222
+ } = await fn({
223
+ x,
224
+ y,
225
+ initialPlacement: placement,
226
+ placement: statefulPlacement,
227
+ strategy,
228
+ middlewareData,
229
+ rects,
230
+ platform,
231
+ elements: {
232
+ reference,
233
+ floating
234
+ }
235
+ });
236
+ x = nextX != null ? nextX : x;
237
+ y = nextY != null ? nextY : y;
238
+ middlewareData = {
239
+ ...middlewareData,
240
+ [name]: {
241
+ ...middlewareData[name],
242
+ ...data
243
+ }
244
+ };
245
+ if (reset && resetCount <= 50) {
246
+ resetCount++;
247
+ if (typeof reset === 'object') {
248
+ if (reset.placement) {
249
+ statefulPlacement = reset.placement;
250
+ }
251
+ if (reset.rects) {
252
+ rects = reset.rects === true ? await platform.getElementRects({
253
+ reference,
254
+ floating,
255
+ strategy
256
+ }) : reset.rects;
257
+ }
258
+ ({
259
+ x,
260
+ y
261
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
262
+ }
263
+ i = -1;
264
+ continue;
265
+ }
266
+ }
267
+ return {
268
+ x,
269
+ y,
270
+ placement: statefulPlacement,
271
+ strategy,
272
+ middlewareData
273
+ };
274
+ };
275
+
276
+ /**
277
+ * Resolves with an object of overflow side offsets that determine how much the
278
+ * element is overflowing a given clipping boundary on each side.
279
+ * - positive = overflowing the boundary by that number of pixels
280
+ * - negative = how many pixels left before it will overflow
281
+ * - 0 = lies flush with the boundary
282
+ * @see https://floating-ui.com/docs/detectOverflow
283
+ */
284
+ async function detectOverflow(state, options) {
285
+ var _await$platform$isEle;
286
+ if (options === void 0) {
287
+ options = {};
288
+ }
289
+ const {
290
+ x,
291
+ y,
292
+ platform,
293
+ rects,
294
+ elements,
295
+ strategy
296
+ } = state;
297
+ const {
298
+ boundary = 'clippingAncestors',
299
+ rootBoundary = 'viewport',
300
+ elementContext = 'floating',
301
+ altBoundary = false,
302
+ padding = 0
303
+ } = evaluate(options, state);
304
+ const paddingObject = getPaddingObject(padding);
305
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
306
+ const element = elements[altBoundary ? altContext : elementContext];
307
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
308
+ 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))),
309
+ boundary,
310
+ rootBoundary,
311
+ strategy
312
+ }));
313
+ const rect = elementContext === 'floating' ? {
314
+ ...rects.floating,
315
+ x,
316
+ y
317
+ } : rects.reference;
318
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
319
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
320
+ x: 1,
321
+ y: 1
322
+ } : {
323
+ x: 1,
324
+ y: 1
325
+ };
326
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
327
+ rect,
328
+ offsetParent,
329
+ strategy
330
+ }) : rect);
331
+ return {
332
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
333
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
334
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
335
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
336
+ };
337
+ }
338
+
339
+ /**
340
+ * Provides data to position an inner element of the floating element so that it
341
+ * appears centered to the reference element.
342
+ * @see https://floating-ui.com/docs/arrow
343
+ */
344
+ const arrow$1 = options => ({
345
+ name: 'arrow',
346
+ options,
347
+ async fn(state) {
348
+ const {
349
+ x,
350
+ y,
351
+ placement,
352
+ rects,
353
+ platform,
354
+ elements,
355
+ middlewareData
356
+ } = state;
357
+ // Since `element` is required, we don't Partial<> the type.
358
+ const {
359
+ element,
360
+ padding = 0
361
+ } = evaluate(options, state) || {};
362
+ if (element == null) {
363
+ return {};
364
+ }
365
+ const paddingObject = getPaddingObject(padding);
366
+ const coords = {
367
+ x,
368
+ y
369
+ };
370
+ const axis = getAlignmentAxis(placement);
371
+ const length = getAxisLength(axis);
372
+ const arrowDimensions = await platform.getDimensions(element);
373
+ const isYAxis = axis === 'y';
374
+ const minProp = isYAxis ? 'top' : 'left';
375
+ const maxProp = isYAxis ? 'bottom' : 'right';
376
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
377
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
378
+ const startDiff = coords[axis] - rects.reference[axis];
379
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
380
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
381
+
382
+ // DOM platform can return `window` as the `offsetParent`.
383
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
384
+ clientSize = elements.floating[clientProp] || rects.floating[length];
385
+ }
386
+ const centerToReference = endDiff / 2 - startDiff / 2;
387
+
388
+ // If the padding is large enough that it causes the arrow to no longer be
389
+ // centered, modify the padding so that it is centered.
390
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
391
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
392
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
393
+
394
+ // Make sure the arrow doesn't overflow the floating element if the center
395
+ // point is outside the floating element's bounds.
396
+ const min$1 = minPadding;
397
+ const max = clientSize - arrowDimensions[length] - maxPadding;
398
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
399
+ const offset = clamp(min$1, center, max);
400
+
401
+ // If the reference is small enough that the arrow's padding causes it to
402
+ // to point to nothing for an aligned placement, adjust the offset of the
403
+ // floating element itself. To ensure `shift()` continues to take action,
404
+ // a single reset is performed when this is true.
405
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
406
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
407
+ return {
408
+ [axis]: coords[axis] + alignmentOffset,
409
+ data: {
410
+ [axis]: offset,
411
+ centerOffset: center - offset - alignmentOffset,
412
+ ...(shouldAddOffset && {
413
+ alignmentOffset
414
+ })
415
+ },
416
+ reset: shouldAddOffset
417
+ };
418
+ }
419
+ });
420
+
421
+ /**
422
+ * Optimizes the visibility of the floating element by flipping the `placement`
423
+ * in order to keep it in view when the preferred placement(s) will overflow the
424
+ * clipping boundary. Alternative to `autoPlacement`.
425
+ * @see https://floating-ui.com/docs/flip
426
+ */
427
+ const flip$1 = function (options) {
428
+ if (options === void 0) {
429
+ options = {};
430
+ }
431
+ return {
432
+ name: 'flip',
433
+ options,
434
+ async fn(state) {
435
+ var _middlewareData$arrow, _middlewareData$flip;
436
+ const {
437
+ placement,
438
+ middlewareData,
439
+ rects,
440
+ initialPlacement,
441
+ platform,
442
+ elements
443
+ } = state;
444
+ const {
445
+ mainAxis: checkMainAxis = true,
446
+ crossAxis: checkCrossAxis = true,
447
+ fallbackPlacements: specifiedFallbackPlacements,
448
+ fallbackStrategy = 'bestFit',
449
+ fallbackAxisSideDirection = 'none',
450
+ flipAlignment = true,
451
+ ...detectOverflowOptions
452
+ } = evaluate(options, state);
453
+
454
+ // If a reset by the arrow was caused due to an alignment offset being
455
+ // added, we should skip any logic now since `flip()` has already done its
456
+ // work.
457
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
458
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
459
+ return {};
460
+ }
461
+ const side = getSide(placement);
462
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
463
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
464
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
465
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
466
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
467
+ }
468
+ const placements = [initialPlacement, ...fallbackPlacements];
469
+ const overflow = await detectOverflow(state, detectOverflowOptions);
470
+ const overflows = [];
471
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
472
+ if (checkMainAxis) {
473
+ overflows.push(overflow[side]);
474
+ }
475
+ if (checkCrossAxis) {
476
+ const sides = getAlignmentSides(placement, rects, rtl);
477
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
478
+ }
479
+ overflowsData = [...overflowsData, {
480
+ placement,
481
+ overflows
482
+ }];
483
+
484
+ // One or more sides is overflowing.
485
+ if (!overflows.every(side => side <= 0)) {
486
+ var _middlewareData$flip2, _overflowsData$filter;
487
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
488
+ const nextPlacement = placements[nextIndex];
489
+ if (nextPlacement) {
490
+ // Try next placement and re-run the lifecycle.
491
+ return {
492
+ data: {
493
+ index: nextIndex,
494
+ overflows: overflowsData
495
+ },
496
+ reset: {
497
+ placement: nextPlacement
498
+ }
499
+ };
500
+ }
501
+
502
+ // First, find the candidates that fit on the mainAxis side of overflow,
503
+ // then find the placement that fits the best on the main crossAxis side.
504
+ 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;
505
+
506
+ // Otherwise fallback.
507
+ if (!resetPlacement) {
508
+ switch (fallbackStrategy) {
509
+ case 'bestFit':
510
+ {
511
+ var _overflowsData$map$so;
512
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
513
+ if (placement) {
514
+ resetPlacement = placement;
515
+ }
516
+ break;
517
+ }
518
+ case 'initialPlacement':
519
+ resetPlacement = initialPlacement;
520
+ break;
521
+ }
522
+ }
523
+ if (placement !== resetPlacement) {
524
+ return {
525
+ reset: {
526
+ placement: resetPlacement
527
+ }
528
+ };
529
+ }
530
+ }
531
+ return {};
532
+ }
533
+ };
534
+ };
535
+
536
+ function getBoundingRect(rects) {
537
+ const minX = min(...rects.map(rect => rect.left));
538
+ const minY = min(...rects.map(rect => rect.top));
539
+ const maxX = max(...rects.map(rect => rect.right));
540
+ const maxY = max(...rects.map(rect => rect.bottom));
541
+ return {
542
+ x: minX,
543
+ y: minY,
544
+ width: maxX - minX,
545
+ height: maxY - minY
546
+ };
547
+ }
548
+ function getRectsByLine(rects) {
549
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
550
+ const groups = [];
551
+ let prevRect = null;
552
+ for (let i = 0; i < sortedRects.length; i++) {
553
+ const rect = sortedRects[i];
554
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
555
+ groups.push([rect]);
556
+ } else {
557
+ groups[groups.length - 1].push(rect);
558
+ }
559
+ prevRect = rect;
560
+ }
561
+ return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
562
+ }
563
+ /**
564
+ * Provides improved positioning for inline reference elements that can span
565
+ * over multiple lines, such as hyperlinks or range selections.
566
+ * @see https://floating-ui.com/docs/inline
567
+ */
568
+ const inline$1 = function (options) {
569
+ if (options === void 0) {
570
+ options = {};
571
+ }
572
+ return {
573
+ name: 'inline',
574
+ options,
575
+ async fn(state) {
576
+ const {
577
+ placement,
578
+ elements,
579
+ rects,
580
+ platform,
581
+ strategy
582
+ } = state;
583
+ // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
584
+ // ClientRect's bounds, despite the event listener being triggered. A
585
+ // padding of 2 seems to handle this issue.
586
+ const {
587
+ padding = 2,
588
+ x,
589
+ y
590
+ } = evaluate(options, state);
591
+ const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
592
+ const clientRects = getRectsByLine(nativeClientRects);
593
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
594
+ const paddingObject = getPaddingObject(padding);
595
+ function getBoundingClientRect() {
596
+ // There are two rects and they are disjoined.
597
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
598
+ // Find the first rect in which the point is fully inside.
599
+ 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;
600
+ }
601
+
602
+ // There are 2 or more connected rects.
603
+ if (clientRects.length >= 2) {
604
+ if (getSideAxis(placement) === 'y') {
605
+ const firstRect = clientRects[0];
606
+ const lastRect = clientRects[clientRects.length - 1];
607
+ const isTop = getSide(placement) === 'top';
608
+ const top = firstRect.top;
609
+ const bottom = lastRect.bottom;
610
+ const left = isTop ? firstRect.left : lastRect.left;
611
+ const right = isTop ? firstRect.right : lastRect.right;
612
+ const width = right - left;
613
+ const height = bottom - top;
614
+ return {
615
+ top,
616
+ bottom,
617
+ left,
618
+ right,
619
+ width,
620
+ height,
621
+ x: left,
622
+ y: top
623
+ };
624
+ }
625
+ const isLeftSide = getSide(placement) === 'left';
626
+ const maxRight = max(...clientRects.map(rect => rect.right));
627
+ const minLeft = min(...clientRects.map(rect => rect.left));
628
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
629
+ const top = measureRects[0].top;
630
+ const bottom = measureRects[measureRects.length - 1].bottom;
631
+ const left = minLeft;
632
+ const right = maxRight;
633
+ const width = right - left;
634
+ const height = bottom - top;
635
+ return {
636
+ top,
637
+ bottom,
638
+ left,
639
+ right,
640
+ width,
641
+ height,
642
+ x: left,
643
+ y: top
644
+ };
645
+ }
646
+ return fallback;
647
+ }
648
+ const resetRects = await platform.getElementRects({
649
+ reference: {
650
+ getBoundingClientRect
651
+ },
652
+ floating: elements.floating,
653
+ strategy
654
+ });
655
+ 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) {
656
+ return {
657
+ reset: {
658
+ rects: resetRects
659
+ }
660
+ };
661
+ }
662
+ return {};
663
+ }
664
+ };
665
+ };
666
+
667
+ // For type backwards-compatibility, the `OffsetOptions` type was also
668
+ // Derivable.
669
+
670
+ async function convertValueToCoords(state, options) {
671
+ const {
672
+ placement,
673
+ platform,
674
+ elements
675
+ } = state;
676
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
677
+ const side = getSide(placement);
678
+ const alignment = getAlignment(placement);
679
+ const isVertical = getSideAxis(placement) === 'y';
680
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
681
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
682
+ const rawValue = evaluate(options, state);
683
+
684
+ // eslint-disable-next-line prefer-const
685
+ let {
686
+ mainAxis,
687
+ crossAxis,
688
+ alignmentAxis
689
+ } = typeof rawValue === 'number' ? {
690
+ mainAxis: rawValue,
691
+ crossAxis: 0,
692
+ alignmentAxis: null
693
+ } : {
694
+ mainAxis: 0,
695
+ crossAxis: 0,
696
+ alignmentAxis: null,
697
+ ...rawValue
698
+ };
699
+ if (alignment && typeof alignmentAxis === 'number') {
700
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
701
+ }
702
+ return isVertical ? {
703
+ x: crossAxis * crossAxisMulti,
704
+ y: mainAxis * mainAxisMulti
705
+ } : {
706
+ x: mainAxis * mainAxisMulti,
707
+ y: crossAxis * crossAxisMulti
708
+ };
709
+ }
710
+
711
+ /**
712
+ * Modifies the placement by translating the floating element along the
713
+ * specified axes.
714
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
715
+ * object may be passed.
716
+ * @see https://floating-ui.com/docs/offset
717
+ */
718
+ const offset = function (options) {
719
+ if (options === void 0) {
720
+ options = 0;
721
+ }
722
+ return {
723
+ name: 'offset',
724
+ options,
725
+ async fn(state) {
726
+ var _middlewareData$offse, _middlewareData$arrow;
727
+ const {
728
+ x,
729
+ y,
730
+ placement,
731
+ middlewareData
732
+ } = state;
733
+ const diffCoords = await convertValueToCoords(state, options);
734
+
735
+ // If the placement is the same and the arrow caused an alignment offset
736
+ // then we don't need to change the positioning coordinates.
737
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
738
+ return {};
739
+ }
740
+ return {
741
+ x: x + diffCoords.x,
742
+ y: y + diffCoords.y,
743
+ data: {
744
+ ...diffCoords,
745
+ placement
746
+ }
747
+ };
748
+ }
749
+ };
750
+ };
751
+
752
+ /**
753
+ * Optimizes the visibility of the floating element by shifting it in order to
754
+ * keep it in view when it will overflow the clipping boundary.
755
+ * @see https://floating-ui.com/docs/shift
756
+ */
757
+ const shift$1 = function (options) {
758
+ if (options === void 0) {
759
+ options = {};
760
+ }
761
+ return {
762
+ name: 'shift',
763
+ options,
764
+ async fn(state) {
765
+ const {
766
+ x,
767
+ y,
768
+ placement
769
+ } = state;
770
+ const {
771
+ mainAxis: checkMainAxis = true,
772
+ crossAxis: checkCrossAxis = false,
773
+ limiter = {
774
+ fn: _ref => {
775
+ let {
776
+ x,
777
+ y
778
+ } = _ref;
779
+ return {
780
+ x,
781
+ y
782
+ };
783
+ }
784
+ },
785
+ ...detectOverflowOptions
786
+ } = evaluate(options, state);
787
+ const coords = {
788
+ x,
789
+ y
790
+ };
791
+ const overflow = await detectOverflow(state, detectOverflowOptions);
792
+ const crossAxis = getSideAxis(getSide(placement));
793
+ const mainAxis = getOppositeAxis(crossAxis);
794
+ let mainAxisCoord = coords[mainAxis];
795
+ let crossAxisCoord = coords[crossAxis];
796
+ if (checkMainAxis) {
797
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
798
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
799
+ const min = mainAxisCoord + overflow[minSide];
800
+ const max = mainAxisCoord - overflow[maxSide];
801
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
802
+ }
803
+ if (checkCrossAxis) {
804
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
805
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
806
+ const min = crossAxisCoord + overflow[minSide];
807
+ const max = crossAxisCoord - overflow[maxSide];
808
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
809
+ }
810
+ const limitedCoords = limiter.fn({
811
+ ...state,
812
+ [mainAxis]: mainAxisCoord,
813
+ [crossAxis]: crossAxisCoord
814
+ });
815
+ return {
816
+ ...limitedCoords,
817
+ data: {
818
+ x: limitedCoords.x - x,
819
+ y: limitedCoords.y - y
820
+ }
821
+ };
822
+ }
823
+ };
824
+ };
825
+ /**
826
+ * Built-in `limiter` that will stop `shift()` at a certain point.
827
+ */
828
+ const limitShift$1 = function (options) {
829
+ if (options === void 0) {
830
+ options = {};
831
+ }
832
+ return {
833
+ options,
834
+ fn(state) {
835
+ const {
836
+ x,
837
+ y,
838
+ placement,
839
+ rects,
840
+ middlewareData
841
+ } = state;
842
+ const {
843
+ offset = 0,
844
+ mainAxis: checkMainAxis = true,
845
+ crossAxis: checkCrossAxis = true
846
+ } = evaluate(options, state);
847
+ const coords = {
848
+ x,
849
+ y
850
+ };
851
+ const crossAxis = getSideAxis(placement);
852
+ const mainAxis = getOppositeAxis(crossAxis);
853
+ let mainAxisCoord = coords[mainAxis];
854
+ let crossAxisCoord = coords[crossAxis];
855
+ const rawOffset = evaluate(offset, state);
856
+ const computedOffset = typeof rawOffset === 'number' ? {
857
+ mainAxis: rawOffset,
858
+ crossAxis: 0
859
+ } : {
860
+ mainAxis: 0,
861
+ crossAxis: 0,
862
+ ...rawOffset
863
+ };
864
+ if (checkMainAxis) {
865
+ const len = mainAxis === 'y' ? 'height' : 'width';
866
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
867
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
868
+ if (mainAxisCoord < limitMin) {
869
+ mainAxisCoord = limitMin;
870
+ } else if (mainAxisCoord > limitMax) {
871
+ mainAxisCoord = limitMax;
872
+ }
873
+ }
874
+ if (checkCrossAxis) {
875
+ var _middlewareData$offse, _middlewareData$offse2;
876
+ const len = mainAxis === 'y' ? 'width' : 'height';
877
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
878
+ 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);
879
+ 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);
880
+ if (crossAxisCoord < limitMin) {
881
+ crossAxisCoord = limitMin;
882
+ } else if (crossAxisCoord > limitMax) {
883
+ crossAxisCoord = limitMax;
884
+ }
885
+ }
886
+ return {
887
+ [mainAxis]: mainAxisCoord,
888
+ [crossAxis]: crossAxisCoord
889
+ };
890
+ }
891
+ };
892
+ };
893
+
894
+ /**
895
+ * Provides data that allows you to change the size of the floating element —
896
+ * for instance, prevent it from overflowing the clipping boundary or match the
897
+ * width of the reference element.
898
+ * @see https://floating-ui.com/docs/size
899
+ */
900
+ const size$1 = function (options) {
901
+ if (options === void 0) {
902
+ options = {};
903
+ }
904
+ return {
905
+ name: 'size',
906
+ options,
907
+ async fn(state) {
908
+ const {
909
+ placement,
910
+ rects,
911
+ platform,
912
+ elements
913
+ } = state;
914
+ const {
915
+ apply = () => {},
916
+ ...detectOverflowOptions
917
+ } = evaluate(options, state);
918
+ const overflow = await detectOverflow(state, detectOverflowOptions);
919
+ const side = getSide(placement);
920
+ const alignment = getAlignment(placement);
921
+ const isYAxis = getSideAxis(placement) === 'y';
922
+ const {
923
+ width,
924
+ height
925
+ } = rects.floating;
926
+ let heightSide;
927
+ let widthSide;
928
+ if (side === 'top' || side === 'bottom') {
929
+ heightSide = side;
930
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
931
+ } else {
932
+ widthSide = side;
933
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
934
+ }
935
+ const overflowAvailableHeight = height - overflow[heightSide];
936
+ const overflowAvailableWidth = width - overflow[widthSide];
937
+ const noShift = !state.middlewareData.shift;
938
+ let availableHeight = overflowAvailableHeight;
939
+ let availableWidth = overflowAvailableWidth;
940
+ if (isYAxis) {
941
+ const maximumClippingWidth = width - overflow.left - overflow.right;
942
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
943
+ } else {
944
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
945
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
946
+ }
947
+ if (noShift && !alignment) {
948
+ const xMin = max(overflow.left, 0);
949
+ const xMax = max(overflow.right, 0);
950
+ const yMin = max(overflow.top, 0);
951
+ const yMax = max(overflow.bottom, 0);
952
+ if (isYAxis) {
953
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
954
+ } else {
955
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
956
+ }
957
+ }
958
+ await apply({
959
+ ...state,
960
+ availableWidth,
961
+ availableHeight
962
+ });
963
+ const nextDimensions = await platform.getDimensions(elements.floating);
964
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
965
+ return {
966
+ reset: {
967
+ rects: true
968
+ }
969
+ };
970
+ }
971
+ return {};
972
+ }
973
+ };
974
+ };
975
+
976
+ function getNodeName(node) {
977
+ if (isNode(node)) {
978
+ return (node.nodeName || '').toLowerCase();
979
+ }
980
+ // Mocked nodes in testing environments may not be instances of Node. By
981
+ // returning `#document` an infinite loop won't occur.
982
+ // https://github.com/floating-ui/floating-ui/issues/2317
983
+ return '#document';
984
+ }
985
+ function getWindow(node) {
986
+ var _node$ownerDocument;
987
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
988
+ }
989
+ function getDocumentElement(node) {
990
+ var _ref;
991
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
992
+ }
993
+ function isNode(value) {
994
+ return value instanceof Node || value instanceof getWindow(value).Node;
995
+ }
996
+ function isElement(value) {
997
+ return value instanceof Element || value instanceof getWindow(value).Element;
998
+ }
999
+ function isHTMLElement(value) {
1000
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1001
+ }
1002
+ function isShadowRoot(value) {
1003
+ // Browsers without `ShadowRoot` support.
1004
+ if (typeof ShadowRoot === 'undefined') {
1005
+ return false;
1006
+ }
1007
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1008
+ }
1009
+ function isOverflowElement(element) {
1010
+ const {
1011
+ overflow,
1012
+ overflowX,
1013
+ overflowY,
1014
+ display
1015
+ } = getComputedStyle(element);
1016
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1017
+ }
1018
+ function isTableElement(element) {
1019
+ return ['table', 'td', 'th'].includes(getNodeName(element));
1020
+ }
1021
+ function isContainingBlock(element) {
1022
+ const webkit = isWebKit();
1023
+ const css = getComputedStyle(element);
1024
+
1025
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1026
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1027
+ }
1028
+ function getContainingBlock(element) {
1029
+ let currentNode = getParentNode(element);
1030
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1031
+ if (isContainingBlock(currentNode)) {
1032
+ return currentNode;
1033
+ } else {
1034
+ currentNode = getParentNode(currentNode);
1035
+ }
1036
+ }
1037
+ return null;
1038
+ }
1039
+ function isWebKit() {
1040
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
1041
+ return CSS.supports('-webkit-backdrop-filter', 'none');
1042
+ }
1043
+ function isLastTraversableNode(node) {
1044
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1045
+ }
1046
+ function getComputedStyle(element) {
1047
+ return getWindow(element).getComputedStyle(element);
1048
+ }
1049
+ function getNodeScroll(element) {
1050
+ if (isElement(element)) {
1051
+ return {
1052
+ scrollLeft: element.scrollLeft,
1053
+ scrollTop: element.scrollTop
1054
+ };
1055
+ }
1056
+ return {
1057
+ scrollLeft: element.pageXOffset,
1058
+ scrollTop: element.pageYOffset
1059
+ };
1060
+ }
1061
+ function getParentNode(node) {
1062
+ if (getNodeName(node) === 'html') {
1063
+ return node;
1064
+ }
1065
+ const result =
1066
+ // Step into the shadow DOM of the parent of a slotted node.
1067
+ node.assignedSlot ||
1068
+ // DOM Element detected.
1069
+ node.parentNode ||
1070
+ // ShadowRoot detected.
1071
+ isShadowRoot(node) && node.host ||
1072
+ // Fallback.
1073
+ getDocumentElement(node);
1074
+ return isShadowRoot(result) ? result.host : result;
1075
+ }
1076
+ function getNearestOverflowAncestor(node) {
1077
+ const parentNode = getParentNode(node);
1078
+ if (isLastTraversableNode(parentNode)) {
1079
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1080
+ }
1081
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1082
+ return parentNode;
1083
+ }
1084
+ return getNearestOverflowAncestor(parentNode);
1085
+ }
1086
+ function getOverflowAncestors(node, list, traverseIframes) {
1087
+ var _node$ownerDocument2;
1088
+ if (list === void 0) {
1089
+ list = [];
1090
+ }
1091
+ if (traverseIframes === void 0) {
1092
+ traverseIframes = true;
1093
+ }
1094
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1095
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1096
+ const win = getWindow(scrollableAncestor);
1097
+ if (isBody) {
1098
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
1099
+ }
1100
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1101
+ }
1102
+
1103
+ function getCssDimensions(element) {
1104
+ const css = getComputedStyle(element);
1105
+ // In testing environments, the `width` and `height` properties are empty
1106
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1107
+ let width = parseFloat(css.width) || 0;
1108
+ let height = parseFloat(css.height) || 0;
1109
+ const hasOffset = isHTMLElement(element);
1110
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1111
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1112
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1113
+ if (shouldFallback) {
1114
+ width = offsetWidth;
1115
+ height = offsetHeight;
1116
+ }
1117
+ return {
1118
+ width,
1119
+ height,
1120
+ $: shouldFallback
1121
+ };
1122
+ }
1123
+
1124
+ function unwrapElement(element) {
1125
+ return !isElement(element) ? element.contextElement : element;
1126
+ }
1127
+
1128
+ function getScale(element) {
1129
+ const domElement = unwrapElement(element);
1130
+ if (!isHTMLElement(domElement)) {
1131
+ return createCoords(1);
1132
+ }
1133
+ const rect = domElement.getBoundingClientRect();
1134
+ const {
1135
+ width,
1136
+ height,
1137
+ $
1138
+ } = getCssDimensions(domElement);
1139
+ let x = ($ ? round(rect.width) : rect.width) / width;
1140
+ let y = ($ ? round(rect.height) : rect.height) / height;
1141
+
1142
+ // 0, NaN, or Infinity should always fallback to 1.
1143
+
1144
+ if (!x || !Number.isFinite(x)) {
1145
+ x = 1;
1146
+ }
1147
+ if (!y || !Number.isFinite(y)) {
1148
+ y = 1;
1149
+ }
1150
+ return {
1151
+ x,
1152
+ y
1153
+ };
1154
+ }
1155
+
1156
+ const noOffsets = /*#__PURE__*/createCoords(0);
1157
+ function getVisualOffsets(element) {
1158
+ const win = getWindow(element);
1159
+ if (!isWebKit() || !win.visualViewport) {
1160
+ return noOffsets;
1161
+ }
1162
+ return {
1163
+ x: win.visualViewport.offsetLeft,
1164
+ y: win.visualViewport.offsetTop
1165
+ };
1166
+ }
1167
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1168
+ if (isFixed === void 0) {
1169
+ isFixed = false;
1170
+ }
1171
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1172
+ return false;
1173
+ }
1174
+ return isFixed;
1175
+ }
1176
+
1177
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1178
+ if (includeScale === void 0) {
1179
+ includeScale = false;
1180
+ }
1181
+ if (isFixedStrategy === void 0) {
1182
+ isFixedStrategy = false;
1183
+ }
1184
+ const clientRect = element.getBoundingClientRect();
1185
+ const domElement = unwrapElement(element);
1186
+ let scale = createCoords(1);
1187
+ if (includeScale) {
1188
+ if (offsetParent) {
1189
+ if (isElement(offsetParent)) {
1190
+ scale = getScale(offsetParent);
1191
+ }
1192
+ } else {
1193
+ scale = getScale(element);
1194
+ }
1195
+ }
1196
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1197
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1198
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1199
+ let width = clientRect.width / scale.x;
1200
+ let height = clientRect.height / scale.y;
1201
+ if (domElement) {
1202
+ const win = getWindow(domElement);
1203
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1204
+ let currentIFrame = win.frameElement;
1205
+ while (currentIFrame && offsetParent && offsetWin !== win) {
1206
+ const iframeScale = getScale(currentIFrame);
1207
+ const iframeRect = currentIFrame.getBoundingClientRect();
1208
+ const css = getComputedStyle(currentIFrame);
1209
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1210
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1211
+ x *= iframeScale.x;
1212
+ y *= iframeScale.y;
1213
+ width *= iframeScale.x;
1214
+ height *= iframeScale.y;
1215
+ x += left;
1216
+ y += top;
1217
+ currentIFrame = getWindow(currentIFrame).frameElement;
1218
+ }
1219
+ }
1220
+ return rectToClientRect({
1221
+ width,
1222
+ height,
1223
+ x,
1224
+ y
1225
+ });
1226
+ }
1227
+
1228
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1229
+ let {
1230
+ rect,
1231
+ offsetParent,
1232
+ strategy
1233
+ } = _ref;
1234
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1235
+ const documentElement = getDocumentElement(offsetParent);
1236
+ if (offsetParent === documentElement) {
1237
+ return rect;
1238
+ }
1239
+ let scroll = {
1240
+ scrollLeft: 0,
1241
+ scrollTop: 0
1242
+ };
1243
+ let scale = createCoords(1);
1244
+ const offsets = createCoords(0);
1245
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1246
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1247
+ scroll = getNodeScroll(offsetParent);
1248
+ }
1249
+ if (isHTMLElement(offsetParent)) {
1250
+ const offsetRect = getBoundingClientRect(offsetParent);
1251
+ scale = getScale(offsetParent);
1252
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1253
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1254
+ }
1255
+ }
1256
+ return {
1257
+ width: rect.width * scale.x,
1258
+ height: rect.height * scale.y,
1259
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1260
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1261
+ };
1262
+ }
1263
+
1264
+ function getClientRects(element) {
1265
+ return Array.from(element.getClientRects());
1266
+ }
1267
+
1268
+ function getWindowScrollBarX(element) {
1269
+ // If <html> has a CSS width greater than the viewport, then this will be
1270
+ // incorrect for RTL.
1271
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1272
+ }
1273
+
1274
+ // Gets the entire size of the scrollable document area, even extending outside
1275
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1276
+ function getDocumentRect(element) {
1277
+ const html = getDocumentElement(element);
1278
+ const scroll = getNodeScroll(element);
1279
+ const body = element.ownerDocument.body;
1280
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1281
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1282
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1283
+ const y = -scroll.scrollTop;
1284
+ if (getComputedStyle(body).direction === 'rtl') {
1285
+ x += max(html.clientWidth, body.clientWidth) - width;
1286
+ }
1287
+ return {
1288
+ width,
1289
+ height,
1290
+ x,
1291
+ y
1292
+ };
1293
+ }
1294
+
1295
+ function getViewportRect(element, strategy) {
1296
+ const win = getWindow(element);
1297
+ const html = getDocumentElement(element);
1298
+ const visualViewport = win.visualViewport;
1299
+ let width = html.clientWidth;
1300
+ let height = html.clientHeight;
1301
+ let x = 0;
1302
+ let y = 0;
1303
+ if (visualViewport) {
1304
+ width = visualViewport.width;
1305
+ height = visualViewport.height;
1306
+ const visualViewportBased = isWebKit();
1307
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1308
+ x = visualViewport.offsetLeft;
1309
+ y = visualViewport.offsetTop;
1310
+ }
1311
+ }
1312
+ return {
1313
+ width,
1314
+ height,
1315
+ x,
1316
+ y
1317
+ };
1318
+ }
1319
+
1320
+ // Returns the inner client rect, subtracting scrollbars if present.
1321
+ function getInnerBoundingClientRect(element, strategy) {
1322
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1323
+ const top = clientRect.top + element.clientTop;
1324
+ const left = clientRect.left + element.clientLeft;
1325
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1326
+ const width = element.clientWidth * scale.x;
1327
+ const height = element.clientHeight * scale.y;
1328
+ const x = left * scale.x;
1329
+ const y = top * scale.y;
1330
+ return {
1331
+ width,
1332
+ height,
1333
+ x,
1334
+ y
1335
+ };
1336
+ }
1337
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1338
+ let rect;
1339
+ if (clippingAncestor === 'viewport') {
1340
+ rect = getViewportRect(element, strategy);
1341
+ } else if (clippingAncestor === 'document') {
1342
+ rect = getDocumentRect(getDocumentElement(element));
1343
+ } else if (isElement(clippingAncestor)) {
1344
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1345
+ } else {
1346
+ const visualOffsets = getVisualOffsets(element);
1347
+ rect = {
1348
+ ...clippingAncestor,
1349
+ x: clippingAncestor.x - visualOffsets.x,
1350
+ y: clippingAncestor.y - visualOffsets.y
1351
+ };
1352
+ }
1353
+ return rectToClientRect(rect);
1354
+ }
1355
+ function hasFixedPositionAncestor(element, stopNode) {
1356
+ const parentNode = getParentNode(element);
1357
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1358
+ return false;
1359
+ }
1360
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1361
+ }
1362
+
1363
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1364
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1365
+ // of the given element up the tree.
1366
+ function getClippingElementAncestors(element, cache) {
1367
+ const cachedResult = cache.get(element);
1368
+ if (cachedResult) {
1369
+ return cachedResult;
1370
+ }
1371
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1372
+ let currentContainingBlockComputedStyle = null;
1373
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1374
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1375
+
1376
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1377
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1378
+ const computedStyle = getComputedStyle(currentNode);
1379
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1380
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1381
+ currentContainingBlockComputedStyle = null;
1382
+ }
1383
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1384
+ if (shouldDropCurrentNode) {
1385
+ // Drop non-containing blocks.
1386
+ result = result.filter(ancestor => ancestor !== currentNode);
1387
+ } else {
1388
+ // Record last containing block for next iteration.
1389
+ currentContainingBlockComputedStyle = computedStyle;
1390
+ }
1391
+ currentNode = getParentNode(currentNode);
1392
+ }
1393
+ cache.set(element, result);
1394
+ return result;
1395
+ }
1396
+
1397
+ // Gets the maximum area that the element is visible in due to any number of
1398
+ // clipping ancestors.
1399
+ function getClippingRect(_ref) {
1400
+ let {
1401
+ element,
1402
+ boundary,
1403
+ rootBoundary,
1404
+ strategy
1405
+ } = _ref;
1406
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
1407
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1408
+ const firstClippingAncestor = clippingAncestors[0];
1409
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1410
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1411
+ accRect.top = max(rect.top, accRect.top);
1412
+ accRect.right = min(rect.right, accRect.right);
1413
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1414
+ accRect.left = max(rect.left, accRect.left);
1415
+ return accRect;
1416
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1417
+ return {
1418
+ width: clippingRect.right - clippingRect.left,
1419
+ height: clippingRect.bottom - clippingRect.top,
1420
+ x: clippingRect.left,
1421
+ y: clippingRect.top
1422
+ };
1423
+ }
1424
+
1425
+ function getDimensions(element) {
1426
+ const {
1427
+ width,
1428
+ height
1429
+ } = getCssDimensions(element);
1430
+ return {
1431
+ width,
1432
+ height
1433
+ };
1434
+ }
1435
+
1436
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1437
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1438
+ const documentElement = getDocumentElement(offsetParent);
1439
+ const isFixed = strategy === 'fixed';
1440
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1441
+ let scroll = {
1442
+ scrollLeft: 0,
1443
+ scrollTop: 0
1444
+ };
1445
+ const offsets = createCoords(0);
1446
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1447
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1448
+ scroll = getNodeScroll(offsetParent);
1449
+ }
1450
+ if (isOffsetParentAnElement) {
1451
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1452
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1453
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1454
+ } else if (documentElement) {
1455
+ offsets.x = getWindowScrollBarX(documentElement);
1456
+ }
1457
+ }
1458
+ return {
1459
+ x: rect.left + scroll.scrollLeft - offsets.x,
1460
+ y: rect.top + scroll.scrollTop - offsets.y,
1461
+ width: rect.width,
1462
+ height: rect.height
1463
+ };
1464
+ }
1465
+
1466
+ function getTrueOffsetParent(element, polyfill) {
1467
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1468
+ return null;
1469
+ }
1470
+ if (polyfill) {
1471
+ return polyfill(element);
1472
+ }
1473
+ return element.offsetParent;
1474
+ }
1475
+
1476
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1477
+ // such as table ancestors and cross browser bugs.
1478
+ function getOffsetParent(element, polyfill) {
1479
+ const window = getWindow(element);
1480
+ if (!isHTMLElement(element)) {
1481
+ return window;
1482
+ }
1483
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1484
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1485
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1486
+ }
1487
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1488
+ return window;
1489
+ }
1490
+ return offsetParent || getContainingBlock(element) || window;
1491
+ }
1492
+
1493
+ const getElementRects = async function (_ref) {
1494
+ let {
1495
+ reference,
1496
+ floating,
1497
+ strategy
1498
+ } = _ref;
1499
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1500
+ const getDimensionsFn = this.getDimensions;
1501
+ return {
1502
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
1503
+ floating: {
1504
+ x: 0,
1505
+ y: 0,
1506
+ ...(await getDimensionsFn(floating))
1507
+ }
1508
+ };
1509
+ };
1510
+
1511
+ function isRTL(element) {
1512
+ return getComputedStyle(element).direction === 'rtl';
1513
+ }
1514
+
1515
+ const platform = {
1516
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1517
+ getDocumentElement,
1518
+ getClippingRect,
1519
+ getOffsetParent,
1520
+ getElementRects,
1521
+ getClientRects,
1522
+ getDimensions,
1523
+ getScale,
1524
+ isElement,
1525
+ isRTL
1526
+ };
1527
+
1528
+ // https://samthor.au/2021/observing-dom/
1529
+ function observeMove(element, onMove) {
1530
+ let io = null;
1531
+ let timeoutId;
1532
+ const root = getDocumentElement(element);
1533
+ function cleanup() {
1534
+ clearTimeout(timeoutId);
1535
+ io && io.disconnect();
1536
+ io = null;
1537
+ }
1538
+ function refresh(skip, threshold) {
1539
+ if (skip === void 0) {
1540
+ skip = false;
1541
+ }
1542
+ if (threshold === void 0) {
1543
+ threshold = 1;
1544
+ }
1545
+ cleanup();
1546
+ const {
1547
+ left,
1548
+ top,
1549
+ width,
1550
+ height
1551
+ } = element.getBoundingClientRect();
1552
+ if (!skip) {
1553
+ onMove();
1554
+ }
1555
+ if (!width || !height) {
1556
+ return;
1557
+ }
1558
+ const insetTop = floor(top);
1559
+ const insetRight = floor(root.clientWidth - (left + width));
1560
+ const insetBottom = floor(root.clientHeight - (top + height));
1561
+ const insetLeft = floor(left);
1562
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1563
+ const options = {
1564
+ rootMargin,
1565
+ threshold: max(0, min(1, threshold)) || 1
1566
+ };
1567
+ let isFirstUpdate = true;
1568
+ function handleObserve(entries) {
1569
+ const ratio = entries[0].intersectionRatio;
1570
+ if (ratio !== threshold) {
1571
+ if (!isFirstUpdate) {
1572
+ return refresh();
1573
+ }
1574
+ if (!ratio) {
1575
+ timeoutId = setTimeout(() => {
1576
+ refresh(false, 1e-7);
1577
+ }, 100);
1578
+ } else {
1579
+ refresh(false, ratio);
1580
+ }
1581
+ }
1582
+ isFirstUpdate = false;
1583
+ }
1584
+
1585
+ // Older browsers don't support a `document` as the root and will throw an
1586
+ // error.
1587
+ try {
1588
+ io = new IntersectionObserver(handleObserve, {
1589
+ ...options,
1590
+ // Handle <iframe>s
1591
+ root: root.ownerDocument
1592
+ });
1593
+ } catch (e) {
1594
+ io = new IntersectionObserver(handleObserve, options);
1595
+ }
1596
+ io.observe(element);
1597
+ }
1598
+ refresh(true);
1599
+ return cleanup;
1600
+ }
1601
+
1602
+ /**
1603
+ * Automatically updates the position of the floating element when necessary.
1604
+ * Should only be called when the floating element is mounted on the DOM or
1605
+ * visible on the screen.
1606
+ * @returns cleanup function that should be invoked when the floating element is
1607
+ * removed from the DOM or hidden from the screen.
1608
+ * @see https://floating-ui.com/docs/autoUpdate
1609
+ */
1610
+ function autoUpdate(reference, floating, update, options) {
1611
+ if (options === void 0) {
1612
+ options = {};
1613
+ }
1614
+ const {
1615
+ ancestorScroll = true,
1616
+ ancestorResize = true,
1617
+ elementResize = typeof ResizeObserver === 'function',
1618
+ layoutShift = typeof IntersectionObserver === 'function',
1619
+ animationFrame = false
1620
+ } = options;
1621
+ const referenceEl = unwrapElement(reference);
1622
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1623
+ ancestors.forEach(ancestor => {
1624
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1625
+ passive: true
1626
+ });
1627
+ ancestorResize && ancestor.addEventListener('resize', update);
1628
+ });
1629
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1630
+ let reobserveFrame = -1;
1631
+ let resizeObserver = null;
1632
+ if (elementResize) {
1633
+ resizeObserver = new ResizeObserver(_ref => {
1634
+ let [firstEntry] = _ref;
1635
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1636
+ // Prevent update loops when using the `size` middleware.
1637
+ // https://github.com/floating-ui/floating-ui/issues/1740
1638
+ resizeObserver.unobserve(floating);
1639
+ cancelAnimationFrame(reobserveFrame);
1640
+ reobserveFrame = requestAnimationFrame(() => {
1641
+ resizeObserver && resizeObserver.observe(floating);
1642
+ });
1643
+ }
1644
+ update();
1645
+ });
1646
+ if (referenceEl && !animationFrame) {
1647
+ resizeObserver.observe(referenceEl);
1648
+ }
1649
+ resizeObserver.observe(floating);
1650
+ }
1651
+ let frameId;
1652
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1653
+ if (animationFrame) {
1654
+ frameLoop();
1655
+ }
1656
+ function frameLoop() {
1657
+ const nextRefRect = getBoundingClientRect(reference);
1658
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1659
+ update();
1660
+ }
1661
+ prevRefRect = nextRefRect;
1662
+ frameId = requestAnimationFrame(frameLoop);
1663
+ }
1664
+ update();
1665
+ return () => {
1666
+ ancestors.forEach(ancestor => {
1667
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1668
+ ancestorResize && ancestor.removeEventListener('resize', update);
1669
+ });
1670
+ cleanupIo && cleanupIo();
1671
+ resizeObserver && resizeObserver.disconnect();
1672
+ resizeObserver = null;
1673
+ if (animationFrame) {
1674
+ cancelAnimationFrame(frameId);
1675
+ }
1676
+ };
1677
+ }
1678
+
1679
+ /**
1680
+ * Optimizes the visibility of the floating element by shifting it in order to
1681
+ * keep it in view when it will overflow the clipping boundary.
1682
+ * @see https://floating-ui.com/docs/shift
1683
+ */
1684
+ const shift = shift$1;
1685
+
1686
+ /**
1687
+ * Optimizes the visibility of the floating element by flipping the `placement`
1688
+ * in order to keep it in view when the preferred placement(s) will overflow the
1689
+ * clipping boundary. Alternative to `autoPlacement`.
1690
+ * @see https://floating-ui.com/docs/flip
1691
+ */
1692
+ const flip = flip$1;
1693
+
1694
+ /**
1695
+ * Provides data that allows you to change the size of the floating element —
1696
+ * for instance, prevent it from overflowing the clipping boundary or match the
1697
+ * width of the reference element.
1698
+ * @see https://floating-ui.com/docs/size
1699
+ */
1700
+ const size = size$1;
1701
+
1702
+ /**
1703
+ * Provides data to position an inner element of the floating element so that it
1704
+ * appears centered to the reference element.
1705
+ * @see https://floating-ui.com/docs/arrow
1706
+ */
1707
+ const arrow = arrow$1;
1708
+
1709
+ /**
1710
+ * Provides improved positioning for inline reference elements that can span
1711
+ * over multiple lines, such as hyperlinks or range selections.
1712
+ * @see https://floating-ui.com/docs/inline
1713
+ */
1714
+ const inline = inline$1;
1715
+
1716
+ /**
1717
+ * Built-in `limiter` that will stop `shift()` at a certain point.
1718
+ */
1719
+ const limitShift = limitShift$1;
1720
+
1721
+ /**
1722
+ * Computes the `x` and `y` coordinates that will place the floating element
1723
+ * next to a given reference element.
1724
+ */
1725
+ const computePosition = (reference, floating, options) => {
1726
+ // This caches the expensive `getClippingElementAncestors` function so that
1727
+ // multiple lifecycle resets re-use the same result. It only lives for a
1728
+ // single call. If other functions become expensive, we can add them as well.
1729
+ const cache = new Map();
1730
+ const mergedOptions = {
1731
+ platform,
1732
+ ...options
1733
+ };
1734
+ const platformWithCache = {
1735
+ ...mergedOptions.platform,
1736
+ _c: cache
1737
+ };
1738
+ return computePosition$1(reference, floating, {
1739
+ ...mergedOptions,
1740
+ platform: platformWithCache
1741
+ });
1742
+ };
1743
+
1744
+ (()=>{var p=class extends Event{oldState;newState;constructor(t,{oldState:o="",newState:i="",...r}={}){super(t,r),this.oldState=String(o||""),this.newState=String(i||"");}},A=new WeakMap;function b(e,t,o){A.set(e,setTimeout(()=>{A.has(e)&&e.dispatchEvent(new p("toggle",{cancelable:!1,oldState:t,newState:o}));},0));}var x=globalThis.ShadowRoot||function(){},O=globalThis.HTMLDialogElement||function(){},h=new WeakMap,a=new WeakMap,d=new WeakMap;function T(e){return d.get(e)||"hidden"}var M=new WeakMap;function I(e){let t=e.popoverTargetElement;if(!t)return;let o=T(t);e.popoverTargetAction==="show"&&o==="showing"||e.popoverTargetAction==="hide"&&o==="hidden"||(o==="showing"?v(t,!0,!0):f(t,!1)&&(M.set(t,e),H(t)));}function f(e,t){return !(e.popover!=="auto"&&e.popover!=="manual"||!e.isConnected||t&&T(e)!=="showing"||!t&&T(e)!=="hidden"||e instanceof O&&e.hasAttribute("open")||document.fullscreenElement===e)}function k(e){return e?Array.from(a.get(e.ownerDocument)||[]).indexOf(e)+1:0}function q(e){let t=N(e),o=C(e);return k(t)>k(o)?t:o}function L(e){let t=a.get(e);for(let o of t||[])if(!o.isConnected)t.delete(o);else return o;return null}function g(e){return typeof e.getRootNode=="function"?e.getRootNode():e.parentNode?g(e.parentNode):e}function N(e){for(;e;){if(e instanceof HTMLElement&&e.popover==="auto"&&d.get(e)==="showing")return e;if(e=e.parentElement||g(e),e instanceof x&&(e=e.host),e instanceof Document)return}}function C(e){for(;e;){let t=e.popoverTargetElement;if(t)return t;if(e=e.parentElement||g(e),e instanceof x&&(e=e.host),e instanceof Document)return}}function K(e){let t=new Map,o=0,i=e.ownerDocument;for(let n of a.get(i)||[])t.set(n,o),o+=1;t.set(e,o),o+=1;let r=null;function u(n){let s=N(n);if(s===null)return null;let l=t.get(s);(r===null||t.get(r)<l)&&(r=s);}return u(e?.parentElement),r}function V(e){return e.hidden||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement||e instanceof HTMLFieldSetElement)&&e.disabled||e instanceof HTMLInputElement&&e.type==="hidden"||e instanceof HTMLAnchorElement&&e.href===""?!1:e.tabIndex!==-1}function j(e){if(e.shadowRoot&&e.shadowRoot.delegatesFocus!==!0)return null;let t=e;t.shadowRoot&&(t=t.shadowRoot);let o=t.querySelector("[autofocus]");if(o)return o;let i=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=i.currentNode;for(;r;){if(V(r))return r;r=i.nextNode();}}function U(e){j(e)?.focus();}var w=new WeakMap;function H(e){if(!f(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new p("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!f(e,!1))return;let o=!1;if(e.popover==="auto"){let r=e.getAttribute("popover"),u=K(e)||t;if(m(u,!1,!0),r!==e.getAttribute("popover")||!f(e,!1))return}L(t)||(o=!0),w.delete(e);let i=t.activeElement;e.classList.add(":popover-open"),d.set(e,"showing"),h.has(t)||h.set(t,new Set),h.get(t).add(e),U(e),e.popover==="auto"&&(a.has(t)||a.set(t,new Set),a.get(t).add(e),R(M.get(e),!0)),o&&i&&e.popover==="auto"&&w.set(e,i),b(e,"closed","open");}function v(e,t=!1,o=!1){if(!f(e,!0))return;let i=e.ownerDocument;if(e.popover==="auto"&&(m(e,t,o),!f(e,!0))||(R(M.get(e),!1),M.delete(e),o&&(e.dispatchEvent(new p("beforetoggle",{oldState:"open",newState:"closed"})),!f(e,!0))))return;h.get(i)?.delete(e),a.get(i)?.delete(e),e.classList.remove(":popover-open"),d.set(e,"hidden"),o&&b(e,"open","closed");let r=w.get(e);r&&(w.delete(e),t&&r.focus());}function D(e,t=!1,o=!1){let i=L(e);for(;i;)v(i,t,o),i=L(e);}function m(e,t,o){let i=e.ownerDocument||e;if(e instanceof Document)return D(i,t,o);let r=null,u=!1;for(let n of a.get(i)||[])if(n===e)u=!0;else if(u){r=n;break}if(!u)return D(i,t,o);for(;r&&T(r)==="showing"&&a.get(i)?.size;)v(r,t,o);}var y=new WeakMap;function S(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let o=t.ownerDocument;if(!L(o))return;let r=q(t);if(r&&e.type==="pointerdown")y.set(o,r);else if(e.type==="pointerup"){let u=y.get(o)===r;y.delete(o),u&&m(r||o,!1,!0);}}var P=new WeakMap;function R(e,t=!1){if(!e)return;P.has(e)||P.set(e,e.getAttribute("aria-expanded"));let o=e.popoverTargetElement;if(o&&o.popover==="auto")e.setAttribute("aria-expanded",String(t));else {let i=P.get(e);i?e.setAttribute("aria-expanded",i):e.removeAttribute("aria-expanded");}}var F=globalThis.ShadowRoot||function(){};function W(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function c(e,t,o){let i=e[t];Object.defineProperty(e,t,{value(r){return i.call(this,o(r))}});}var z=/(^|[^\\]):popover-open\b/g;function B(){window.ToggleEvent=window.ToggleEvent||p;function e(n){return n?.includes(":popover-open")&&(n=n.replace(z,"$1.\\:popover-open")),n}c(Document.prototype,"querySelector",e),c(Document.prototype,"querySelectorAll",e),c(Element.prototype,"querySelector",e),c(Element.prototype,"querySelectorAll",e),c(Element.prototype,"matches",e),c(Element.prototype,"closest",e),c(DocumentFragment.prototype,"querySelectorAll",e),c(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let n=(this.getAttribute("popover")||"").toLowerCase();return n===""||n=="auto"?"auto":"manual"},set(n){this.setAttribute("popover",n);}},showPopover:{enumerable:!0,configurable:!0,value(){H(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){v(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){d.get(this)==="showing"&&n===void 0||n===!1?v(this,!0,!0):(n===void 0||n===!0)&&H(this);}}});let t=new WeakMap;function o(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),t.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),t.set(this,s);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let s=t.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return t.delete(this),null;let l=g(this),E=this.getAttribute("popovertarget");return (l instanceof Document||l instanceof F)&&E&&l.getElementById(E)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let s=(this.getAttribute("popovertargetaction")||"").toLowerCase();return s==="show"||s==="hide"?s:"toggle"},set(s){this.setAttribute("popovertargetaction",s);}}});}o(HTMLButtonElement),o(HTMLInputElement);let i=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let l=g(s);if(!(l instanceof F||l instanceof Document))return;let E=s.closest("[popovertargetaction],[popovertarget]");if(E){I(E);return}},r=n=>{let s=n.key,l=n.target;l&&(s==="Escape"||s==="Esc")&&m(l.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",i),n.addEventListener("keydown",r),n.addEventListener("pointerdown",S),n.addEventListener("pointerup",S);})(document);}W()||B();})();
1745
+
1746
+ const postPopovercontainerCss = "@layer polyfill{[popover]{position:fixed;z-index:2147483647;inset:0;padding:.25em;width:fit-content;height:fit-content;border-width:initial;border-color:initial;border-image:initial;border-style:solid;background-color:canvas;color:canvastext;overflow:auto;margin:auto}[popover]:not(.\\:popover-open){display:none}[popover]:is(dialog[open]){display:revert}[anchor].\\:popover-open{inset:auto}@supports selector([popover]:popover-open){[popover]:not(.\\:popover-open,dialog[open]){display:revert}[anchor]:is(:popover-open){inset:auto}}@supports not (background-color: canvas){[popover]{background-color:white;color:black}}@supports(width: -moz-fit-content){[popover]{width:-moz-fit-content;height:-moz-fit-content}}@supports not (inset: 0){[popover]{top:0;left:0;right:0;bottom:0}}}.popover{box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:1px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}.arrow{position:absolute;width:.7071067812rem;height:.7071067812rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1;border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
1747
+
1748
+ const SIDE_MAP = {
1749
+ top: 'bottom',
1750
+ right: 'left',
1751
+ bottom: 'top',
1752
+ left: 'right',
1753
+ };
1754
+ const PostPopovercontainer = /*@__PURE__*/ proxyCustomElement(class PostPopovercontainer extends HTMLElement$1 {
1755
+ constructor() {
1756
+ super();
1757
+ this.__registerHost();
1758
+ this.__attachShadow();
1759
+ this.postPopoverToggled = createEvent(this, "postPopoverToggled", 7);
1760
+ this.placement = 'top';
1761
+ this.arrow = false;
1762
+ }
1763
+ componentDidLoad() {
1764
+ this.popoverRef.setAttribute('popover', '');
1765
+ this.popoverRef.addEventListener('beforetoggle', this.handleToggle.bind(this));
1766
+ }
1767
+ disconnectedCallback() {
1768
+ if (this.popoverRef)
1769
+ this.popoverRef.removeEventListener('beforetoggle', e => this.toggle(e.target));
1770
+ if (typeof this.clearAutoUpdate === 'function')
1771
+ this.clearAutoUpdate();
1772
+ }
1773
+ /**
1774
+ * Programmatically display the tooltip
1775
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
1776
+ */
1777
+ async show(target) {
1778
+ this.eventTarget = target;
1779
+ this.popoverRef.showPopover();
1780
+ }
1781
+ /**
1782
+ * Programmatically hide this tooltip
1783
+ */
1784
+ async hide() {
1785
+ this.eventTarget = null;
1786
+ this.popoverRef.hidePopover();
1787
+ }
1788
+ /**
1789
+ * Toggle tooltip display
1790
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
1791
+ * @param force Pass true to always show or false to always hide
1792
+ */
1793
+ async toggle(target, force) {
1794
+ this.eventTarget = target;
1795
+ this.popoverRef.togglePopover(force);
1796
+ return this.popoverRef.matches(':popover-open');
1797
+ }
1798
+ /**
1799
+ * Start or stop auto updates based on tooltip events.
1800
+ * Tooltips can be closed or opened with other methods than class members,
1801
+ * therefore listening to the toggle event is safer for cleaning up.
1802
+ * @param e ToggleEvent
1803
+ */
1804
+ handleToggle(e) {
1805
+ const isOpen = e.newState === 'open';
1806
+ if (isOpen) {
1807
+ this.startAutoupdates();
1808
+ }
1809
+ else {
1810
+ if (typeof this.clearAutoUpdate === 'function')
1811
+ this.clearAutoUpdate();
1812
+ }
1813
+ this.postPopoverToggled.emit(isOpen);
1814
+ }
1815
+ /**
1816
+ * Start listening for DOM updates, scroll events etc. that have
1817
+ * an influence on tooltip positioning
1818
+ */
1819
+ startAutoupdates() {
1820
+ this.clearAutoUpdate = autoUpdate(this.eventTarget, this.popoverRef, this.calculatePosition.bind(this));
1821
+ }
1822
+ async calculatePosition() {
1823
+ const middleware = [
1824
+ flip(),
1825
+ inline(),
1826
+ shift({
1827
+ padding: 8,
1828
+ // Prevents shifting away from the anchor too far, while shifting as far as possible
1829
+ // https://floating-ui.com/docs/shift#limiter
1830
+ limiter: limitShift({
1831
+ offset: 32,
1832
+ }),
1833
+ }),
1834
+ size({
1835
+ apply({ availableWidth, elements }) {
1836
+ Object.assign(elements.floating.style, {
1837
+ maxWidth: `${availableWidth - 16}px`,
1838
+ });
1839
+ },
1840
+ }),
1841
+ offset(this.arrow ? 12 : 8), // 4px outside of element to account for focus outline + ~arrow size
1842
+ ];
1843
+ if (this.arrow) {
1844
+ middleware.push(arrow({ element: this.arrowRef, padding: 8 }));
1845
+ }
1846
+ const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.popoverRef, {
1847
+ placement: this.placement || 'top',
1848
+ strategy: 'fixed',
1849
+ middleware,
1850
+ });
1851
+ // Tooltip
1852
+ this.popoverRef.style.left = `${x}px`;
1853
+ this.popoverRef.style.top = `${y}px`;
1854
+ // Arrow
1855
+ if (this.arrow) {
1856
+ // Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
1857
+ const side = currentPlacement.split('-')[0];
1858
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
1859
+ const staticSide = SIDE_MAP[side];
1860
+ Object.assign(this.arrowRef.style, {
1861
+ top: arrowY ? `${arrowY}px` : '',
1862
+ left: arrowX ? `${arrowX}px` : '',
1863
+ [staticSide]: `${-this.arrowRef.offsetWidth / 2}px`,
1864
+ });
1865
+ }
1866
+ }
1867
+ render() {
1868
+ return (h(Host, { "data-version": version }, h("div", { class: "popover", part: "popover", ref: (el) => (this.popoverRef = el) }, this.arrow && (h("span", { class: "arrow", ref: el => {
1869
+ this.arrowRef = el;
1870
+ } })), h("slot", null))));
1871
+ }
1872
+ get host() { return this; }
1873
+ static get style() { return postPopovercontainerCss; }
1874
+ }, [1, "post-popovercontainer", {
1875
+ "placement": [1],
1876
+ "arrow": [4],
1877
+ "show": [64],
1878
+ "hide": [64],
1879
+ "toggle": [64]
1880
+ }]);
1881
+ function defineCustomElement() {
1882
+ if (typeof customElements === "undefined") {
1883
+ return;
1884
+ }
1885
+ const components = ["post-popovercontainer"];
1886
+ components.forEach(tagName => { switch (tagName) {
1887
+ case "post-popovercontainer":
1888
+ if (!customElements.get(tagName)) {
1889
+ customElements.define(tagName, PostPopovercontainer);
1890
+ }
1891
+ break;
1892
+ } });
1893
+ }
1894
+
1895
+ export { PostPopovercontainer as P, defineCustomElement as d };
1896
+
1897
+ //# sourceMappingURL=post-popovercontainer2.js.map