@swisspost/design-system-components 9.0.0-next.8 → 9.0.0-next.9

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 (349) hide show
  1. package/dist/cjs/check-url-3ffdd2fb.js +14 -0
  2. package/dist/cjs/debounce-1151afe3.js +12 -0
  3. package/dist/cjs/{index-e1f32cce.js → index-010dc207.js} +20 -27
  4. package/dist/cjs/{index-824d2b71.js → index-5d4e0aed.js} +2 -12
  5. package/dist/cjs/index.cjs.js +45 -42
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/{package-a2b895fc.js → package-8e810a59.js} +1 -1
  8. package/dist/cjs/{post-accordion-3ce01432.js → post-accordion-b9df8522.js} +2 -2
  9. package/dist/cjs/{post-accordion-item-81601b1e.js → post-accordion-item-ecc6749f.js} +8 -7
  10. package/dist/cjs/post-accordion-item.cjs.entry.js +5 -4
  11. package/dist/cjs/post-accordion.cjs.entry.js +3 -3
  12. package/dist/cjs/{post-avatar-b1c97f51.js → post-avatar-f7236084.js} +2 -2
  13. package/dist/cjs/post-avatar.cjs.entry.js +3 -3
  14. package/dist/cjs/post-back-to-top-60762f8e.js +75 -0
  15. package/dist/cjs/post-back-to-top.cjs.entry.js +4 -3
  16. package/dist/cjs/{post-banner-8611eab5.js → post-banner-9662f22c.js} +3 -3
  17. package/dist/cjs/post-banner.cjs.entry.js +5 -4
  18. package/dist/cjs/post-breadcrumb-b40732fc.js +111 -0
  19. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
  20. package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
  21. package/dist/cjs/{post-card-control-acd30573.js → post-card-control-039c9a4b.js} +4 -4
  22. package/dist/cjs/post-card-control.cjs.entry.js +3 -3
  23. package/dist/cjs/post-closebutton_15.cjs.entry.js +33 -0
  24. package/dist/cjs/{post-collapsible-trigger-8ca4d85b.js → post-collapsible-trigger-143cf84a.js} +6 -14
  25. package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -4
  26. package/dist/cjs/post-components.cjs.js +2 -2
  27. package/dist/cjs/post-footer-5f7fdf96.js +84 -0
  28. package/dist/cjs/post-footer.cjs.entry.js +11 -0
  29. package/dist/cjs/post-menu-item-bb0b0b9e.js +74 -0
  30. package/dist/cjs/{post-popover-c4f50134.js → post-popover-d0ce9dc6.js} +3 -3
  31. package/dist/cjs/post-popover.cjs.entry.js +3 -3
  32. package/dist/cjs/{post-rating-3a87ca46.js → post-rating-1082197c.js} +3 -3
  33. package/dist/cjs/post-rating.cjs.entry.js +3 -3
  34. package/dist/cjs/{post-tab-header-5fdb05a1.js → post-tab-header-4b6d8d54.js} +3 -3
  35. package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
  36. package/dist/cjs/{post-tab-panel-34aed8e6.js → post-tab-panel-60f211a5.js} +3 -3
  37. package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
  38. package/dist/cjs/{post-tabs-dd2da5d2.js → post-tabs-1f797ce4.js} +8 -6
  39. package/dist/cjs/post-tabs.cjs.entry.js +3 -3
  40. package/dist/cjs/{post-tag-59232922.js → post-tag-ddaaaedc.js} +3 -3
  41. package/dist/cjs/post-tag.cjs.entry.js +3 -3
  42. package/dist/cjs/{post-megadropdown-trigger-7376d867.js → post-togglebutton-0984a694.js} +1789 -1234
  43. package/dist/cjs/{post-tooltip-3e0c1509.js → post-tooltip-38c839a4.js} +4 -4
  44. package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
  45. package/dist/cjs/slide-5d51abe8.js +28 -0
  46. package/dist/collection/animations/slide.js +4 -4
  47. package/dist/collection/collection-manifest.json +12 -9
  48. package/dist/collection/components/post-accordion-item/post-accordion-item.js +7 -4
  49. package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
  50. package/dist/collection/components/post-back-to-top/post-back-to-top.js +2 -2
  51. package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
  52. package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +161 -0
  53. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
  54. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +11 -1
  55. package/dist/collection/components/post-card-control/post-card-control.js +2 -2
  56. package/dist/collection/components/post-closebutton/post-closebutton.js +1 -1
  57. package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
  58. package/dist/collection/components/post-footer/post-footer.css +1 -0
  59. package/dist/collection/components/post-footer/post-footer.js +75 -0
  60. package/dist/collection/components/post-header/post-header.css +1 -1
  61. package/dist/collection/components/post-header/post-header.js +74 -17
  62. package/dist/collection/components/post-icon/post-icon.js +1 -1
  63. package/dist/collection/components/post-language-option/post-language-option.css +1 -1
  64. package/dist/collection/components/post-language-option/post-language-option.js +25 -1
  65. package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
  66. package/dist/collection/components/post-language-switch/post-language-switch.js +163 -0
  67. package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
  68. package/dist/collection/components/post-list/post-list.css +1 -1
  69. package/dist/collection/components/post-list/post-list.js +3 -3
  70. package/dist/collection/components/post-list-item/post-list-item.js +1 -1
  71. package/dist/collection/components/post-logo/post-logo.js +1 -1
  72. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
  73. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +15 -24
  74. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
  75. package/dist/collection/components/post-megadropdown/post-megadropdown.js +82 -68
  76. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -1
  77. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +80 -24
  78. package/dist/collection/components/post-menu/post-menu.js +6 -4
  79. package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
  80. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +11 -1
  81. package/dist/collection/components/post-popover/post-popover.js +1 -1
  82. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +2 -2
  83. package/dist/collection/components/post-rating/post-rating.js +1 -1
  84. package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
  85. package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
  86. package/dist/collection/components/post-tabs/post-tabs.js +6 -4
  87. package/dist/collection/components/post-tag/post-tag.js +1 -1
  88. package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -1
  89. package/dist/collection/components/post-togglebutton/post-togglebutton.js +24 -6
  90. package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
  91. package/dist/collection/index.js +12 -9
  92. package/dist/collection/utils/breakpoints.js +46 -0
  93. package/dist/components/debounce.js +10 -0
  94. package/dist/components/index.js +12 -9
  95. package/dist/components/index2.js +1 -1
  96. package/dist/components/package.js +1 -1
  97. package/dist/components/post-accordion-item2.js +5 -4
  98. package/dist/components/post-back-to-top2.js +4 -27
  99. package/dist/components/post-breadcrumb-item2.js +13 -3
  100. package/dist/components/post-breadcrumb.d.ts +11 -0
  101. package/dist/components/post-breadcrumb.js +6 -0
  102. package/dist/components/post-breadcrumb2.js +168 -0
  103. package/dist/components/post-card-control2.js +2 -2
  104. package/dist/components/post-closebutton2.js +1 -1
  105. package/dist/components/post-collapsible-trigger2.js +1 -9
  106. package/dist/components/post-collapsible2.js +2 -2
  107. package/dist/components/post-footer.d.ts +11 -0
  108. package/dist/components/post-footer.js +6 -0
  109. package/dist/components/post-footer2.js +124 -0
  110. package/dist/components/post-header2.js +55 -14
  111. package/dist/components/post-icon2.js +2 -2
  112. package/dist/components/post-language-option2.js +5 -3
  113. package/dist/components/post-language-switch.d.ts +11 -0
  114. package/dist/components/post-language-switch.js +6 -0
  115. package/dist/components/post-language-switch2.js +146 -0
  116. package/dist/components/post-list-item2.js +1 -1
  117. package/dist/components/post-list2.js +4 -4
  118. package/dist/components/post-logo2.js +2 -2
  119. package/dist/components/post-mainnavigation2.js +17 -17
  120. package/dist/components/post-megadropdown-trigger2.js +63 -11
  121. package/dist/components/post-megadropdown2.js +48 -22
  122. package/dist/components/post-menu-item2.js +1 -1
  123. package/dist/components/post-menu-trigger2.js +11 -1
  124. package/dist/components/post-menu2.js +6 -4
  125. package/dist/components/post-popover2.js +1 -1
  126. package/dist/components/post-popovercontainer2.js +2 -2
  127. package/dist/components/post-rating2.js +1 -1
  128. package/dist/components/post-tab-header2.js +1 -1
  129. package/dist/components/post-tab-panel2.js +1 -1
  130. package/dist/components/post-tabs2.js +6 -4
  131. package/dist/components/post-tag2.js +1 -1
  132. package/dist/components/post-togglebutton2.js +23 -5
  133. package/dist/components/post-tooltip2.js +2 -2
  134. package/dist/components/slide.js +25 -0
  135. package/dist/docs.json +500 -123
  136. package/dist/esm/check-url-a974431e.js +12 -0
  137. package/dist/esm/debounce-abe98cc2.js +10 -0
  138. package/dist/esm/{index-f8a00dc0.js → index-b49c9904.js} +1 -11
  139. package/dist/esm/{index-e1b64755.js → index-fb8d6be7.js} +20 -27
  140. package/dist/esm/index.js +24 -24
  141. package/dist/esm/loader.js +3 -3
  142. package/dist/esm/package-4d81f3c2.js +3 -0
  143. package/dist/esm/{post-accordion-19e88941.js → post-accordion-ee54a3ef.js} +2 -2
  144. package/dist/esm/{post-accordion-item-33bbe4de.js → post-accordion-item-e10452dc.js} +8 -7
  145. package/dist/esm/post-accordion-item.entry.js +5 -4
  146. package/dist/esm/post-accordion.entry.js +3 -3
  147. package/dist/esm/{post-avatar-d15a9f9e.js → post-avatar-5572fa73.js} +2 -2
  148. package/dist/esm/post-avatar.entry.js +3 -3
  149. package/dist/esm/post-back-to-top-1d823c43.js +73 -0
  150. package/dist/esm/post-back-to-top.entry.js +4 -3
  151. package/dist/esm/{post-banner-bf5e6a18.js → post-banner-78480475.js} +3 -3
  152. package/dist/esm/post-banner.entry.js +5 -4
  153. package/dist/esm/post-breadcrumb-aaa77f74.js +109 -0
  154. package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
  155. package/dist/esm/post-breadcrumb.entry.js +5 -0
  156. package/dist/esm/{post-card-control-f0788f6f.js → post-card-control-862aa961.js} +4 -4
  157. package/dist/esm/post-card-control.entry.js +3 -3
  158. package/dist/esm/post-closebutton_15.entry.js +11 -0
  159. package/dist/esm/{post-collapsible-trigger-1d939eb6.js → post-collapsible-trigger-1c7833f8.js} +5 -13
  160. package/dist/esm/post-collapsible_2.entry.js +6 -4
  161. package/dist/esm/post-components.js +3 -3
  162. package/dist/esm/post-footer-b18875e7.js +82 -0
  163. package/dist/esm/post-footer.entry.js +3 -0
  164. package/dist/esm/post-menu-item-2906384b.js +71 -0
  165. package/dist/esm/{post-popover-7195d05a.js → post-popover-2432bb3f.js} +3 -3
  166. package/dist/esm/post-popover.entry.js +3 -3
  167. package/dist/esm/{post-rating-8baf86fe.js → post-rating-95cbdbb8.js} +3 -3
  168. package/dist/esm/post-rating.entry.js +3 -3
  169. package/dist/esm/{post-tab-header-a1d1d9d0.js → post-tab-header-dfea00ea.js} +3 -3
  170. package/dist/esm/post-tab-header.entry.js +3 -3
  171. package/dist/esm/{post-tab-panel-afce8d40.js → post-tab-panel-cafd9e04.js} +3 -3
  172. package/dist/esm/post-tab-panel.entry.js +3 -3
  173. package/dist/esm/{post-tabs-fbb42496.js → post-tabs-beef8eae.js} +8 -6
  174. package/dist/esm/post-tabs.entry.js +3 -3
  175. package/dist/esm/{post-tag-d67b6a19.js → post-tag-a77e7af6.js} +3 -3
  176. package/dist/esm/post-tag.entry.js +3 -3
  177. package/dist/esm/{post-megadropdown-trigger-210b4ab3.js → post-togglebutton-395bf3f0.js} +1785 -1235
  178. package/dist/esm/{post-tooltip-7101ed24.js → post-tooltip-b298039a.js} +4 -4
  179. package/dist/esm/post-tooltip.entry.js +5 -4
  180. package/dist/esm/slide-3422b8a3.js +25 -0
  181. package/dist/post-components/index.esm.js +1 -1
  182. package/dist/post-components/p-0711f76d.entry.js +1 -0
  183. package/dist/post-components/p-095a06f6.entry.js +1 -0
  184. package/dist/post-components/p-0b5a5f32.js +1 -0
  185. package/dist/post-components/{p-f0f8427e.js → p-135fa60f.js} +1 -1
  186. package/dist/post-components/p-18e38d8a.js +1 -0
  187. package/dist/post-components/p-2e1ec074.entry.js +1 -0
  188. package/dist/post-components/p-4202b433.entry.js +1 -0
  189. package/dist/post-components/p-45773f59.js +1 -0
  190. package/dist/post-components/{p-282115c4.js → p-4953de7e.js} +1 -1
  191. package/dist/post-components/p-4f67c5f5.entry.js +1 -0
  192. package/dist/post-components/{p-6cea23cd.js → p-4f9746f6.js} +2 -2
  193. package/dist/post-components/p-5075c672.entry.js +1 -0
  194. package/dist/post-components/p-515e0f96.js +1 -0
  195. package/dist/post-components/p-5467b223.js +1 -0
  196. package/dist/post-components/p-67036798.entry.js +1 -0
  197. package/dist/post-components/{p-d0b8820a.js → p-6d953fb2.js} +1 -1
  198. package/dist/post-components/p-6edb0ac5.js +1 -0
  199. package/dist/post-components/{p-939f2ba7.js → p-6f8f39ca.js} +1 -1
  200. package/dist/post-components/p-7503a623.js +1 -0
  201. package/dist/post-components/p-761b24c7.entry.js +1 -0
  202. package/dist/post-components/{p-00fa0152.js → p-77c4c1d2.js} +1 -1
  203. package/dist/post-components/p-7cf0c2ad.js +1 -0
  204. package/dist/post-components/p-856c14d6.entry.js +1 -0
  205. package/dist/post-components/p-866bf50a.entry.js +1 -0
  206. package/dist/post-components/p-8d621781.js +1 -0
  207. package/dist/post-components/p-8fe2d72c.entry.js +1 -0
  208. package/dist/post-components/p-9ad5088f.entry.js +1 -0
  209. package/dist/post-components/{p-485dafcf.js → p-a1d2b90e.js} +1 -1
  210. package/dist/post-components/p-a521419d.entry.js +1 -0
  211. package/dist/post-components/p-aa538648.js +1 -0
  212. package/dist/post-components/p-afdbee2f.js +1 -0
  213. package/dist/post-components/p-b02817f2.entry.js +1 -0
  214. package/dist/post-components/p-b157dcba.entry.js +1 -0
  215. package/dist/post-components/p-b22656b1.js +1 -0
  216. package/dist/post-components/{p-61e79941.js → p-bdbd11cb.js} +1 -1
  217. package/dist/post-components/{p-3eab790d.js → p-c0ae9886.js} +1 -1
  218. package/dist/post-components/p-c537e196.entry.js +1 -0
  219. package/dist/post-components/p-d4f93f2b.js +1 -0
  220. package/dist/post-components/p-dca4246a.entry.js +1 -0
  221. package/dist/post-components/{p-f627744e.js → p-f319b026.js} +1 -1
  222. package/dist/post-components/{p-ccb6dfa1.js → p-f4b7b379.js} +1 -1
  223. package/dist/post-components/p-fac66087.entry.js +1 -0
  224. package/dist/post-components/post-components.esm.js +1 -1
  225. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +2 -0
  226. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +3 -3
  227. package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
  228. package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +1 -0
  229. package/dist/types/components/post-footer/post-footer.d.ts +23 -0
  230. package/dist/types/components/post-header/post-header.d.ts +13 -5
  231. package/dist/types/components/post-language-option/post-language-option.d.ts +5 -0
  232. package/dist/types/components/post-language-switch/post-language-switch.d.ts +31 -0
  233. package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
  234. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +10 -1
  235. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +24 -12
  236. package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +20 -5
  237. package/dist/types/components/post-menu/post-menu.d.ts +1 -0
  238. package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +4 -2
  239. package/dist/types/components.d.ts +129 -29
  240. package/dist/types/index.d.ts +12 -9
  241. package/dist/types/utils/breakpoints.d.ts +11 -0
  242. package/loaders/debounce.js +10 -0
  243. package/loaders/index.d.ts +6 -0
  244. package/loaders/index.js +3 -0
  245. package/loaders/index2.js +1 -1
  246. package/loaders/package.js +1 -1
  247. package/loaders/post-accordion-item.js +1 -99
  248. package/loaders/post-accordion-item2.js +102 -0
  249. package/loaders/post-back-to-top.js +4 -27
  250. package/loaders/post-banner.js +1 -1
  251. package/loaders/post-breadcrumb-item.js +1 -70
  252. package/loaders/post-breadcrumb-item2.js +82 -0
  253. package/loaders/post-breadcrumb.d.ts +11 -0
  254. package/loaders/post-breadcrumb.js +171 -0
  255. package/loaders/post-card-control.js +2 -2
  256. package/loaders/post-closebutton.js +1 -1
  257. package/loaders/post-collapsible-trigger2.js +1 -9
  258. package/loaders/post-collapsible2.js +1 -1
  259. package/loaders/post-footer.d.ts +11 -0
  260. package/loaders/post-footer.js +127 -0
  261. package/loaders/post-header.js +55 -14
  262. package/loaders/post-icon2.js +2 -2
  263. package/loaders/post-language-option.js +4 -2
  264. package/loaders/post-language-switch.d.ts +11 -0
  265. package/loaders/post-language-switch.js +149 -0
  266. package/loaders/post-list-item.js +1 -1
  267. package/loaders/post-list.js +4 -4
  268. package/loaders/post-logo.js +2 -2
  269. package/loaders/post-mainnavigation.js +17 -17
  270. package/loaders/post-megadropdown-trigger.js +63 -11
  271. package/loaders/post-megadropdown.js +48 -22
  272. package/loaders/post-menu-item.js +1 -31
  273. package/loaders/post-menu-item2.js +33 -0
  274. package/loaders/post-menu-trigger.js +1 -90
  275. package/{dist/esm/post-menu-trigger-80c2bdf4.js → loaders/post-menu-trigger2.js} +41 -12
  276. package/loaders/post-menu.js +1 -199
  277. package/{dist/esm/post-menu-e853e28b.js → loaders/post-menu2.js} +42 -13
  278. package/loaders/post-popover.js +1 -1
  279. package/loaders/post-popovercontainer2.js +2 -2
  280. package/loaders/post-rating.js +1 -1
  281. package/loaders/post-tab-header.js +1 -1
  282. package/loaders/post-tab-panel.js +1 -1
  283. package/loaders/post-tabs.js +6 -4
  284. package/loaders/post-tag.js +1 -1
  285. package/loaders/post-togglebutton.js +23 -5
  286. package/loaders/post-tooltip.js +1 -1
  287. package/loaders/slide.js +25 -0
  288. package/package.json +5 -4
  289. package/dist/cjs/post-back-to-top-0ce98569.js +0 -98
  290. package/dist/cjs/post-breadcrumb-item-2075462a.js +0 -49
  291. package/dist/cjs/post-breadcrumb-item.cjs.entry.js +0 -15
  292. package/dist/cjs/post-closebutton_10.cjs.entry.js +0 -25
  293. package/dist/cjs/post-language-option-cf32d0ed.js +0 -68
  294. package/dist/cjs/post-language-option.cjs.entry.js +0 -15
  295. package/dist/cjs/post-menu-a3b7b63b.js +0 -176
  296. package/dist/cjs/post-menu-item-28ab1a72.js +0 -20
  297. package/dist/cjs/post-menu-item.cjs.entry.js +0 -11
  298. package/dist/cjs/post-menu-trigger-821839f5.js +0 -75
  299. package/dist/cjs/post-menu-trigger.cjs.entry.js +0 -13
  300. package/dist/cjs/post-menu.cjs.entry.js +0 -11
  301. package/dist/cjs/post-togglebutton-59c6357b.js +0 -28
  302. package/dist/cjs/post-togglebutton.cjs.entry.js +0 -11
  303. package/dist/esm/package-9cafe148.js +0 -3
  304. package/dist/esm/post-back-to-top-bcf46150.js +0 -96
  305. package/dist/esm/post-breadcrumb-item-e3b41f74.js +0 -47
  306. package/dist/esm/post-breadcrumb-item.entry.js +0 -7
  307. package/dist/esm/post-closebutton_10.entry.js +0 -8
  308. package/dist/esm/post-language-option-1436370d.js +0 -66
  309. package/dist/esm/post-language-option.entry.js +0 -7
  310. package/dist/esm/post-menu-item-86d4c7ab.js +0 -18
  311. package/dist/esm/post-menu-item.entry.js +0 -3
  312. package/dist/esm/post-menu-trigger.entry.js +0 -5
  313. package/dist/esm/post-menu.entry.js +0 -3
  314. package/dist/esm/post-togglebutton-c3fb912d.js +0 -26
  315. package/dist/esm/post-togglebutton.entry.js +0 -3
  316. package/dist/post-components/p-0338f9da.js +0 -1
  317. package/dist/post-components/p-1667387e.entry.js +0 -1
  318. package/dist/post-components/p-19551c18.entry.js +0 -1
  319. package/dist/post-components/p-1b627f80.js +0 -1
  320. package/dist/post-components/p-24673919.js +0 -1
  321. package/dist/post-components/p-266b734f.entry.js +0 -1
  322. package/dist/post-components/p-2d0ffc1e.entry.js +0 -1
  323. package/dist/post-components/p-45018d7e.entry.js +0 -1
  324. package/dist/post-components/p-4a647a78.js +0 -1
  325. package/dist/post-components/p-4abfa65b.js +0 -1
  326. package/dist/post-components/p-517f2b1f.entry.js +0 -1
  327. package/dist/post-components/p-55224ee7.entry.js +0 -1
  328. package/dist/post-components/p-558a9849.js +0 -1
  329. package/dist/post-components/p-59b31557.js +0 -1
  330. package/dist/post-components/p-5d1db85c.entry.js +0 -1
  331. package/dist/post-components/p-679978de.entry.js +0 -1
  332. package/dist/post-components/p-6a842b96.entry.js +0 -1
  333. package/dist/post-components/p-71f03424.js +0 -1
  334. package/dist/post-components/p-8c2568c1.entry.js +0 -1
  335. package/dist/post-components/p-8fd3a3cb.entry.js +0 -1
  336. package/dist/post-components/p-a4c39296.entry.js +0 -1
  337. package/dist/post-components/p-af5d3b89.entry.js +0 -1
  338. package/dist/post-components/p-b4423249.entry.js +0 -1
  339. package/dist/post-components/p-c31a7d65.entry.js +0 -1
  340. package/dist/post-components/p-c544bb82.js +0 -1
  341. package/dist/post-components/p-d36adfb5.js +0 -1
  342. package/dist/post-components/p-da6a8268.entry.js +0 -1
  343. package/dist/post-components/p-ece14d88.js +0 -1
  344. package/dist/post-components/p-f2e1b4d8.js +0 -1
  345. package/dist/post-components/p-f7b6b96a.entry.js +0 -1
  346. package/dist/post-components/p-f812e93d.entry.js +0 -1
  347. package/dist/post-components/p-f8d41c32.js +0 -1
  348. package/dist/post-components/p-fe516cdf.entry.js +0 -1
  349. package/dist/post-components/p-fe7467fb.entry.js +0 -1
@@ -1,21 +1,273 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-e1f32cce.js');
4
- const _package = require('./package-a2b895fc.js');
5
- const index$1 = require('./index-824d2b71.js');
3
+ const index = require('./index-010dc207.js');
4
+ const _package = require('./package-8e810a59.js');
5
+ const slide = require('./slide-5d51abe8.js');
6
+ const index$1 = require('./index-5d4e0aed.js');
6
7
  const checkNonEmpty = require('./check-non-empty-eeaa8f77.js');
7
8
  const checkType = require('./check-type-64af82a9.js');
9
+ const getRoot = require('./get-root-7a3498ef.js');
8
10
 
9
11
  const PostClosebutton = class {
10
12
  constructor(hostRef) {
11
13
  index.registerInstance(this, hostRef);
12
14
  }
13
15
  render() {
14
- return (index.h(index.Host, { key: '4e03f31cdefe37e70ae44d8c7baaa71abf660db4', "data-version": _package.version }, index.h("button", { key: 'bcb645f50e587470fbdc6bee7b369c58aef403fd', class: "btn btn-icon-close" }, index.h("post-icon", { key: '5860a0b4c8a2cfd740cca788b22377e2e4bc9614', "aria-hidden": "true", name: "2043" }), index.h("span", { key: '4381a0a47c99703b0a6ca9f864b69437afff167f', class: "visually-hidden" }, index.h("slot", { key: '55a72682749ddac4716463c21f8bc31a89f285b9' })))));
16
+ return (index.h(index.Host, { key: 'cb5be35247053b1227c32f7949baca51ccc31081', "data-version": _package.version }, index.h("button", { key: 'b68dc109cc7a9a99b85fc995447bc7c0b0ddc3bf', class: "btn btn-icon-close" }, index.h("post-icon", { key: '9276c885e5b48092a0a24285ec6cd4301a4fc032', "aria-hidden": "true", name: "closex" }), index.h("span", { key: '3e04657ab677186830d80b8dabe769d70b6b8e8e', class: "visually-hidden" }, index.h("slot", { key: 'c2c9e8df9f62516a1b88b1dbc3949287fbaa3991' })))));
15
17
  }
16
18
  get host() { return index.getElement(this); }
17
19
  };
18
20
 
21
+ /* eslint-disable no-undefined,no-param-reassign,no-shadow */
22
+
23
+ /**
24
+ * Throttle execution of a function. Especially useful for rate limiting
25
+ * execution of handlers on events like resize and scroll.
26
+ *
27
+ * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
28
+ * are most useful.
29
+ * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
30
+ * as-is, to `callback` when the throttled-function is executed.
31
+ * @param {object} [options] - An object to configure options.
32
+ * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
33
+ * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
34
+ * one final time after the last throttled-function call. (After the throttled-function has not been called for
35
+ * `delay` milliseconds, the internal counter is reset).
36
+ * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
37
+ * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
38
+ * callback will never executed if both noLeading = true and noTrailing = true.
39
+ * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
40
+ * false (at end), schedule `callback` to execute after `delay` ms.
41
+ *
42
+ * @returns {Function} A new, throttled, function.
43
+ */
44
+ function throttle (delay, callback, options) {
45
+ var _ref = options || {},
46
+ _ref$noTrailing = _ref.noTrailing,
47
+ noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
48
+ _ref$noLeading = _ref.noLeading,
49
+ noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
50
+ _ref$debounceMode = _ref.debounceMode,
51
+ debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
52
+ /*
53
+ * After wrapper has stopped being called, this timeout ensures that
54
+ * `callback` is executed at the proper times in `throttle` and `end`
55
+ * debounce modes.
56
+ */
57
+ var timeoutID;
58
+ var cancelled = false;
59
+
60
+ // Keep track of the last time `callback` was executed.
61
+ var lastExec = 0;
62
+
63
+ // Function to clear existing timeout
64
+ function clearExistingTimeout() {
65
+ if (timeoutID) {
66
+ clearTimeout(timeoutID);
67
+ }
68
+ }
69
+
70
+ // Function to cancel next exec
71
+ function cancel(options) {
72
+ var _ref2 = options || {},
73
+ _ref2$upcomingOnly = _ref2.upcomingOnly,
74
+ upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
75
+ clearExistingTimeout();
76
+ cancelled = !upcomingOnly;
77
+ }
78
+
79
+ /*
80
+ * The `wrapper` function encapsulates all of the throttling / debouncing
81
+ * functionality and when executed will limit the rate at which `callback`
82
+ * is executed.
83
+ */
84
+ function wrapper() {
85
+ for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
86
+ arguments_[_key] = arguments[_key];
87
+ }
88
+ var self = this;
89
+ var elapsed = Date.now() - lastExec;
90
+ if (cancelled) {
91
+ return;
92
+ }
93
+
94
+ // Execute `callback` and update the `lastExec` timestamp.
95
+ function exec() {
96
+ lastExec = Date.now();
97
+ callback.apply(self, arguments_);
98
+ }
99
+
100
+ /*
101
+ * If `debounceMode` is true (at begin) this is used to clear the flag
102
+ * to allow future `callback` executions.
103
+ */
104
+ function clear() {
105
+ timeoutID = undefined;
106
+ }
107
+ if (!noLeading && debounceMode && !timeoutID) {
108
+ /*
109
+ * Since `wrapper` is being called for the first time and
110
+ * `debounceMode` is true (at begin), execute `callback`
111
+ * and noLeading != true.
112
+ */
113
+ exec();
114
+ }
115
+ clearExistingTimeout();
116
+ if (debounceMode === undefined && elapsed > delay) {
117
+ if (noLeading) {
118
+ /*
119
+ * In throttle mode with noLeading, if `delay` time has
120
+ * been exceeded, update `lastExec` and schedule `callback`
121
+ * to execute after `delay` ms.
122
+ */
123
+ lastExec = Date.now();
124
+ if (!noTrailing) {
125
+ timeoutID = setTimeout(debounceMode ? clear : exec, delay);
126
+ }
127
+ } else {
128
+ /*
129
+ * In throttle mode without noLeading, if `delay` time has been exceeded, execute
130
+ * `callback`.
131
+ */
132
+ exec();
133
+ }
134
+ } else if (noTrailing !== true) {
135
+ /*
136
+ * In trailing throttle mode, since `delay` time has not been
137
+ * exceeded, schedule `callback` to execute `delay` ms after most
138
+ * recent execution.
139
+ *
140
+ * If `debounceMode` is true (at begin), schedule `clear` to execute
141
+ * after `delay` ms.
142
+ *
143
+ * If `debounceMode` is false (at end), schedule `callback` to
144
+ * execute after `delay` ms.
145
+ */
146
+ timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
147
+ }
148
+ }
149
+ wrapper.cancel = cancel;
150
+
151
+ // Return the wrapper function.
152
+ return wrapper;
153
+ }
154
+
155
+ const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{--global-header-height:72px;--global-header-minimal-height:24px;--main-header-height:56px;--header-height:calc(var(--global-header-height) + var(--main-header-height))}@media screen and (min-width: 1024px){:host{display:block;position:sticky;inset-inline:0;inset-block-start:calc(-1*(var(--global-header-height) + var(--main-header-height) - var(--global-header-minimal-height)));box-shadow:var(--post-core-elevation-3)}}@media screen and (max-width: 1023.99px){:host{--global-header-height:64px;--main-header-height:48px}}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;align-items:center;position:sticky;padding-inline:var(--post-core-dimension-4);height:var(--global-header-height);z-index:1}@media screen and (max-width: 1023.99px){.global-header{inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{padding-inline-end:var(--post-core-dimension-12);top:calc((var(--global-header-height) - var(--global-header-minimal-height))*-1)}}slot[name=post-logo]{align-self:flex-end}.global-sub{display:flex;align-items:center;gap:var(--post-core-dimension-24);height:var(--global-header-height)}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-minimal-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem}.title-header{display:flex;align-items:center;gap:var(--post-core-dimension-4);height:var(--main-header-height);background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.title-header{padding:var(--post-core-dimension-18) var(--post-core-dimension-16) var(--post-core-dimension-4) var(--post-core-dimension-12)}}@media screen and (max-width: 1023.99px){.title-header{position:sticky;z-index:1;inset-block-start:var(--global-header-height);padding-inline:var(--post-core-dimension-8) var(--post-core-dimension-16)}}:host(:not(:has([slot=title]))) .title-header{display:none}::slotted(h1){margin:0 !important}@media screen and (min-width: 1024px){::slotted(h1){font-size:var(--post-core-font-size-28) !important}}@media screen and (max-width: 1023.99px){::slotted(h1){font-size:var(--post-core-font-size-20) !important}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.navigation{position:sticky;z-index:1;inset-block-start:var(--global-header-minimal-height)}}@media screen and (max-width: 1023.99px){.navigation{position:fixed;inset-inline:0;inset-block-end:calc(100vh - var(--header-height));box-shadow:var(--post-core-elevation-3);min-height:var(--post-core-dimension-10);max-height:calc(100vh - var(--header-height));overflow:auto}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:var(--post-core-dimension-16) var(--post-core-dimension-24);padding-inline:var(--post-core-dimension-32)}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}::slotted(post-mainnavigation){background-color:var(--post-core-color-sandgrey-002);gap:var(--post-core-dimension-32)}.navigation-footer{background-color:var(--post-core-color-sandgrey-006);gap:var(--post-core-dimension-24)}}";
156
+ const PostHeaderStyle0 = postHeaderCss;
157
+
158
+ const PostHeader = class {
159
+ constructor(hostRef) {
160
+ index.registerInstance(this, hostRef);
161
+ this.scrollParent = null;
162
+ this.throttledScroll = () => this.handleScrollEvent();
163
+ this.throttledResize = throttle(50, () => this.handleResize());
164
+ this.device = null;
165
+ this.mobileMenuExtended = false;
166
+ }
167
+ componentWillRender() {
168
+ this.scrollParent = this.getScrollParent(this.host);
169
+ this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
170
+ window.addEventListener('resize', this.throttledResize, { passive: true });
171
+ this.handleResize();
172
+ this.handleScrollEvent();
173
+ }
174
+ frozeBody(isMobileMenuExtended) {
175
+ document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
176
+ }
177
+ /**
178
+ * Toggles the mobile navigation.
179
+ */
180
+ async toggleMobileMenu() {
181
+ if (this.device === 'desktop')
182
+ return;
183
+ this.mobileMenuAnimation = this.mobileMenuExtended
184
+ ? slide.slideUp(this.mobileMenu)
185
+ : slide.slideDown(this.mobileMenu);
186
+ // Update the state of the toggle button
187
+ const menuButton = this.host.querySelector('post-togglebutton');
188
+ menuButton.toggled = !this.mobileMenuExtended;
189
+ // Toggle menu visibility before it slides down and after it slides back up
190
+ if (this.mobileMenuExtended)
191
+ await this.mobileMenuAnimation.finished;
192
+ this.mobileMenuExtended = !this.mobileMenuExtended;
193
+ if (!this.mobileMenuExtended)
194
+ await this.mobileMenuAnimation.finished;
195
+ }
196
+ handleScrollEvent() {
197
+ // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
198
+ const st = Math.max(0, this.scrollParent instanceof Document
199
+ ? this.scrollParent.documentElement.scrollTop
200
+ : this.scrollParent.scrollTop);
201
+ this.host.style.setProperty('--header-scroll-top', `${st}px`);
202
+ }
203
+ getScrollParent(node) {
204
+ let currentParent = node.parentElement;
205
+ while (currentParent) {
206
+ if (currentParent.nodeName === 'BODY') {
207
+ return document;
208
+ }
209
+ if (this.isScrollable(currentParent)) {
210
+ return currentParent;
211
+ }
212
+ currentParent = currentParent.parentElement;
213
+ }
214
+ return document;
215
+ }
216
+ isScrollable(node) {
217
+ if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
218
+ return false;
219
+ }
220
+ const style = getComputedStyle(node);
221
+ return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
222
+ const value = style.getPropertyValue(propertyName);
223
+ return value === 'auto' || value === 'scroll';
224
+ });
225
+ }
226
+ handleResize() {
227
+ const previousDevice = this.device;
228
+ let newDevice;
229
+ const width = window === null || window === void 0 ? void 0 : window.innerWidth;
230
+ if (width >= 1024) {
231
+ newDevice = 'desktop';
232
+ }
233
+ else if (width >= 600) {
234
+ newDevice = 'tablet';
235
+ }
236
+ else {
237
+ newDevice = 'mobile';
238
+ }
239
+ // Close any open mobile menu
240
+ if (newDevice === 'desktop' && this.mobileMenuExtended) {
241
+ this.toggleMobileMenu();
242
+ this.mobileMenuAnimation.finish(); // no animation
243
+ }
244
+ // Apply only on change for doing work only when necessary
245
+ if (newDevice !== previousDevice) {
246
+ this.device = newDevice;
247
+ window.requestAnimationFrame(() => {
248
+ this.switchLanguageSwitchMode();
249
+ });
250
+ }
251
+ }
252
+ switchLanguageSwitchMode() {
253
+ var _a;
254
+ const variant = this.device === 'desktop' ? 'dropdown' : 'list';
255
+ (_a = this.host.querySelector('post-language-switch')) === null || _a === void 0 ? void 0 : _a.setAttribute('variant', variant);
256
+ }
257
+ render() {
258
+ const navigationClasses = ['navigation'];
259
+ if (this.mobileMenuExtended) {
260
+ navigationClasses.push('extended');
261
+ }
262
+ return (index.h(index.Host, { key: 'd96b46b64946ef425059463d127fa1188c99ea58', version: _package.version }, index.h("div", { key: '831ebc53d0f598a99e72d46a1530c2c34c196948', class: "global-header" }, index.h("div", { key: '69f3b3bc47a61810eea3ae60d7b2423af1750416', class: "global-sub" }, index.h("div", { key: 'ad6d36c7e7f029edfdee223ab1df664a1b7002f8', class: "logo" }, index.h("slot", { key: '95adfc2ad9e63fde9eef3cc71b63247e140fba3d', name: "post-logo" }))), index.h("div", { key: '741e62693a4df8558213c85d7a837efb8b0cfa6d', class: "global-sub" }, this.device === 'desktop' && index.h("slot", { key: '992844b617955cb77079a175fcaaf54943a6eef2', name: "meta-navigation" }), index.h("slot", { key: '4384ae4c04d239bf1b1947ba6d1457ae6879a5cf', name: "global-controls" }), this.device === 'desktop' && index.h("slot", { key: 'c5b33b6bfb8c00d44710ec997a80d56720aab760', name: "post-language-switch" }), index.h("div", { key: '25a629a419c94fc4789eb374b87cf7c159b746c6', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, index.h("slot", { key: '3f3078832237abc5a6df79b4a57fe20fae926aa3', name: "post-togglebutton" })))), index.h("div", { key: 'e11ca83bc108d4677e849b7386ad7bd09d8c9331', class: "title-header d-flex space-between align-center" }, index.h("slot", { key: '87430ad15ab09f800b714be45be00a50e5b7dc0a', name: "title" }), index.h("div", { key: '494a198d3ee8185a26b16fce97a85bed01d6b3f7', class: "global-sub" }, index.h("slot", { key: '8a54e3d1366d39c11d64c0de90f35a4330836428', name: "local-controls" }), index.h("slot", { key: '63f841457e0f7b7722a3f8b1ea83ff0d78d9c08e' }))), index.h("div", { key: '90cf667c412d90f8e466e7e7925fa4a2f8223ad8', ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, index.h("slot", { key: 'a046286cb6cc770bfb8fb4439cdacac7c351001b', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (index.h("div", { key: '6e0ad5841ef53daf0c0885b75efdf12d69f4a72d', class: "navigation-footer" }, index.h("slot", { key: '1eaebace0d5e37794867ae2a317a104726bb873a', name: "meta-navigation" }), index.h("slot", { key: '79217cd6fd16d4c6ef3e8aaa656e6dc0a8842b23', name: "post-language-switch" }))))));
263
+ }
264
+ get host() { return index.getElement(this); }
265
+ static get watchers() { return {
266
+ "mobileMenuExtended": ["frozeBody"]
267
+ }; }
268
+ };
269
+ PostHeader.style = PostHeaderStyle0;
270
+
19
271
  const postIconCss = ":host{container-name:post-icon;container-type:inline-size;display:inline-block;width:1em;height:1em;vertical-align:-0.15em}svg{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color}@container post-icon (max-width: 23.98px){svg{--pis-16: block}}@container post-icon (min-width: 24px) and (max-width: 31.98px){svg{--pis-24: block}}@container post-icon (min-width: 32px) and (max-width: 39.98px){svg{--pis-32: block}}@container post-icon (min-width: 40px) and (max-width: 47.98px){svg{--pis-40: block}}@container post-icon (min-width: 48px) and (max-width: 63.98px){svg{--pis-48: block}}@container post-icon (min-width: 64px){svg{--pis-64: block}}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";
20
272
  const PostIconStyle0 = postIconCss;
21
273
 
@@ -92,7 +344,7 @@ const PostIcon = class {
92
344
  this.validateAnimation();
93
345
  }
94
346
  render() {
95
- return (index.h(index.Host, { key: '1a04eea6f1039329937a9f58d64778c272088018', "data-version": _package.version }, index.h("svg", { key: '843d95a54a58f839bfa1031d2aa834c70fbc6f9e', style: this.getStyles() }, index.h("use", { key: 'e93c6a6fd50ebd4757c92c1ee02f9c8cd65a65b7', href: this.getPath() }))));
347
+ return (index.h(index.Host, { key: '7864661c5ba45508fa3902c49fd0da1d6c026795', "data-version": _package.version }, index.h("svg", { key: '588f70bd81afc4cc5a312388aa6225bc9c853b57', style: this.getStyles() }, index.h("use", { key: 'c4505cf12ddf083ad86b3b9304ffbf37ac3489d1', href: this.getPath() }))));
96
348
  }
97
349
  get host() { return index.getElement(this); }
98
350
  static get watchers() { return {
@@ -107,59 +359,671 @@ const PostIcon = class {
107
359
  };
108
360
  PostIcon.style = PostIconStyle0;
109
361
 
110
- const postLogoCss = ":host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
111
- const PostLogoStyle0 = postLogoCss;
362
+ const postLanguageOptionCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:inline-block;width:fit-content}button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button}a{color:inherit;text-decoration:none}:is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;height:100%;width:100%;padding:var(--post-language-option-padding)}.post-language-option-list{border-radius:2px;width:40px;height:40px}.post-language-option-list{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-option-list:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-option-list:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-option-list:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-option-list:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-option-list[aria-current=true],.post-language-option-list[aria-current=page]{background-color:#050400;color:#fff}.post-language-option-dropdown{padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative}.post-language-option-dropdown[aria-current=true]::after,.post-language-option-dropdown[aria-current=page]::after{content:\"\";left:-2px;height:3px;background-color:#504f4b;width:calc(100% + 4px);display:block;position:absolute;bottom:3px}.post-language-option-dropdown[aria-current=true]:focus::after,.post-language-option-dropdown[aria-current=page]:focus::after{width:calc(100% - 5px);left:2px}";
363
+ const PostLanguageOptionStyle0 = postLanguageOptionCss;
112
364
 
113
- const PostLogo = class {
365
+ const PostLanguageOption = class {
114
366
  constructor(hostRef) {
115
367
  index.registerInstance(this, hostRef);
368
+ this.postChange = index.createEvent(this, "postChange", 7);
369
+ this.code = undefined;
370
+ this.active = undefined;
371
+ this.variant = undefined;
372
+ this.name = undefined;
116
373
  this.url = undefined;
117
374
  }
118
- validateUrl() {
119
- index$1.checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
375
+ validateCode(value = this.code) {
376
+ checkType.checkType(value, 'string', 'The "code" property of the post-language-option component must be a string.');
377
+ }
378
+ validateActiveProp(value = this.active) {
379
+ index$1.checkEmptyOrType(value, 'boolean', 'The "active" property of the post-language-option component must be a boolean value.');
380
+ }
381
+ validateName(value = this.name) {
382
+ index$1.checkEmptyOrType(value, 'string', 'The "name" property of the post-language-option component must be a string.');
383
+ }
384
+ validateUrl(value = this.url) {
385
+ index$1.checkEmptyOrType(value, 'string', 'The "url" property of the post-language-option component must be a valid URL.');
120
386
  }
121
387
  componentDidLoad() {
388
+ this.validateCode();
389
+ this.validateActiveProp();
390
+ this.validateName();
122
391
  this.validateUrl();
123
- this.checkDescription();
124
- }
125
- checkDescription() {
126
- if (!this.host.textContent) {
127
- console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
392
+ if (!this.name && this.isNameRequired()) {
393
+ throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
128
394
  }
129
395
  }
396
+ /**
397
+ * Selects the language option programmatically.
398
+ */
399
+ async select() {
400
+ this.active = true;
401
+ this.emitChange();
402
+ }
403
+ emitChange() {
404
+ this.postChange.emit(this.code);
405
+ }
406
+ isNameRequired() {
407
+ return this.host.textContent.toLowerCase() === this.code.toLowerCase();
408
+ }
130
409
  render() {
131
- const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
132
- const LogoTag = logoLink ? 'a' : 'span';
133
- return (index.h(index.Host, { key: 'ec5f82baaa08c75a03808a6cda7a9971152a54d6', "data-version": _package.version, slot: "post-logo" }, index.h(LogoTag, Object.assign({ key: 'ce6aeff4dfab0612376e4c6aa14c74c438213b5d', class: "logo" }, (logoLink ? { href: logoLink } : {})), index.h("span", { key: 'fa6f8ecaf3c3a4a8e60a8c8e2171dbd25d585ede', class: "description" }, index.h("slot", { key: '2dcff76129e8e054e58244b2aa77a5b51e059b6b', onSlotchange: () => this.checkDescription() })), index.h("svg", { key: '468282e3c21fb6cfc97fccee64298abe43542da5', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, index.h("g", { key: 'd3f4e0a6a7372991ccef5be9fad206cab2f553e7', id: "Logo" }, index.h("rect", { key: '3f17ddd240131ce23faf1e73a76ca4f702b029d7', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), index.h("polygon", { key: '1b714023d9e587a57571fd86a9515701ec77f993', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), index.h("path", { key: 'b4064875cbad1263ac2278613fdf5db8d1697c2a', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
410
+ const lang = this.code.toLowerCase();
411
+ return (index.h(index.Host, { key: '9a3f49ee993b69393ea8f81b671cd5482049ff1c', "data-version": _package.version, role: "listitem" }, this.url ? (index.h("a", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange() }, index.h("slot", null))) : (index.h("button", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange() }, index.h("slot", null)))));
134
412
  }
135
413
  get host() { return index.getElement(this); }
136
414
  static get watchers() { return {
415
+ "code": ["validateCode"],
416
+ "active": ["validateActiveProp"],
417
+ "name": ["validateName"],
137
418
  "url": ["validateUrl"]
138
419
  }; }
139
420
  };
140
- PostLogo.style = PostLogoStyle0;
421
+ PostLanguageOption.style = PostLanguageOptionStyle0;
141
422
 
142
- /**
143
- * Custom positioning reference element.
144
- * @see https://floating-ui.com/docs/virtual-elements
145
- */
423
+ const SWITCH_VARIANTS = ['list', 'dropdown'];
146
424
 
147
- const sides = ['top', 'right', 'bottom', 'left'];
148
- const alignments = ['start', 'end'];
149
- const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
150
- const min = Math.min;
151
- const max = Math.max;
152
- const round = Math.round;
153
- const floor = Math.floor;
154
- const createCoords = v => ({
155
- x: v,
156
- y: v
157
- });
158
- const oppositeSideMap = {
159
- left: 'right',
160
- right: 'left',
161
- bottom: 'top',
162
- top: 'bottom'
425
+ const urlAlphabet =
426
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
427
+
428
+ let nanoid = (size = 21) => {
429
+ let id = '';
430
+ let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
431
+ while (size--) {
432
+ id += urlAlphabet[bytes[size] & 63];
433
+ }
434
+ return id
435
+ };
436
+
437
+ const postLanguageSwitchCss = ":host{display:block}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-trigger{cursor:pointer;padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:var(--post-core-dimension-6);border-radius:var(--post-core-dimension-24);font-size:var(--post-core-font-size-16);padding:var(--post-core-dimension-3) var(--post-core-dimension-10)}.post-language-switch-trigger{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:var(--post-core-dimension-16);width:var(--post-core-dimension-16)}";
438
+ const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
439
+
440
+ const PostLanguageSwitch = class {
441
+ constructor(hostRef) {
442
+ index.registerInstance(this, hostRef);
443
+ this.menuId = `p${nanoid(11)}`;
444
+ this.caption = undefined;
445
+ this.description = undefined;
446
+ this.variant = 'list';
447
+ this.activeLang = undefined;
448
+ }
449
+ validateCaption(value = this.caption) {
450
+ checkType.checkType(value, 'string', 'The "caption" property of the post-language-switch component must be a string.');
451
+ }
452
+ validateDescription(value = this.description) {
453
+ checkType.checkType(value, 'string', 'The "description" property of the post-language-switch component must be a string.');
454
+ }
455
+ validateVariant(value = this.variant) {
456
+ index$1.checkEmptyOrOneOf(value, SWITCH_VARIANTS, `The "variant" property of the post-language-switch component must be: ${SWITCH_VARIANTS.join(', ')}`);
457
+ }
458
+ connectedCallback() {
459
+ this.updateChildrenVariant();
460
+ // Get the active language based on children's active state
461
+ this.activeLang = Array.from(this.host.querySelectorAll('post-language-option'))
462
+ .find(el => el.getAttribute('active') == 'true')
463
+ .getAttribute('code');
464
+ }
465
+ // Update post-language-option variant to have the correct style
466
+ updateChildrenVariant() {
467
+ this.host.querySelectorAll('post-language-option').forEach(el => {
468
+ el.setAttribute('variant', this.variant);
469
+ });
470
+ }
471
+ componentShouldUpdate() {
472
+ this.updateChildrenVariant();
473
+ }
474
+ componentDidLoad() {
475
+ this.validateCaption();
476
+ this.validateDescription();
477
+ this.validateVariant();
478
+ // Detects a change in the active language
479
+ this.host.addEventListener('postChange', (el) => {
480
+ this.activeLang = el.detail;
481
+ // Update the active state in the children post-language-option components
482
+ this.host.querySelectorAll('post-language-option').forEach(lang => {
483
+ if (lang.code && lang.code === this.activeLang) {
484
+ lang.setAttribute('active', 'true');
485
+ }
486
+ else {
487
+ lang.setAttribute('active', 'false');
488
+ }
489
+ });
490
+ // Hides the dropdown when an option has been clicked
491
+ if (this.variant === 'dropdown') {
492
+ const menu = this.host.shadowRoot.querySelector('post-menu');
493
+ menu.toggle(menu);
494
+ }
495
+ });
496
+ }
497
+ renderList() {
498
+ return (index.h(index.Host, { "data-version": _package.version, "aria-label": `${this.caption}, ${this.description}`, "aria-role": "list" }, index.h("slot", null)));
499
+ }
500
+ renderDropdown() {
501
+ return (index.h(index.Host, { "data-version": _package.version }, index.h("post-menu-trigger", { for: this.menuId }, index.h("button", { class: "post-language-switch-trigger", "aria-label": `${this.caption}, ${this.description}` }, this.activeLang.toUpperCase(), index.h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), index.h("post-menu", { id: this.menuId }, index.h("div", { class: "post-language-switch-dropdown-container" }, index.h("slot", null)))));
502
+ }
503
+ render() {
504
+ return this.variant === 'list' ? this.renderList() : this.renderDropdown();
505
+ }
506
+ get host() { return index.getElement(this); }
507
+ static get watchers() { return {
508
+ "caption": ["validateCaption"],
509
+ "description": ["validateDescription"],
510
+ "variant": ["validateVariant"]
511
+ }; }
512
+ };
513
+ PostLanguageSwitch.style = PostLanguageSwitchStyle0;
514
+
515
+ const postListCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-list{display:flex;flex-direction:column;gap:var(--post-list-title-gap, 0)}post-list>[role=list]{display:flex;flex-direction:column;gap:var(--post-list-item-gap, 0)}post-list:where([horizontal]:not([horizontal=false])){flex-direction:row;align-items:center}post-list:where([horizontal]:not([horizontal=false]))>[role=list]{flex-direction:row;align-items:center}post-list>.list-title.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}post-list>.list-title.visually-hidden:not(caption){position:absolute !important}";
516
+ const PostListStyle0 = postListCss;
517
+
518
+ const PostList = class {
519
+ constructor(hostRef) {
520
+ index.registerInstance(this, hostRef);
521
+ this.titleId = undefined;
522
+ this.titleHidden = false;
523
+ this.horizontal = false;
524
+ }
525
+ componentWillLoad() {
526
+ /**
527
+ * Get the id set on the host element or use a random id by default
528
+ */
529
+ this.titleId = `title-${this.host.id || crypto.randomUUID()}`;
530
+ }
531
+ componentDidLoad() {
532
+ this.checkTitle();
533
+ }
534
+ checkTitle() {
535
+ if (!this.titleEl.textContent.trim()) {
536
+ throw new Error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
537
+ }
538
+ }
539
+ render() {
540
+ return (index.h(index.Host, { key: '4f982e717530514589c5528553b70463d678b676', "data-version": _package.version }, index.h("div", { key: 'cc65ed208f48e7a22482af96fd069d05363f2617', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, index.h("slot", { key: '0f8bbeade50b59e53767ce2169dd57bb79644705' })), index.h("div", { key: '7fa5de37a169e6f76928c2088c46ee747427887e', role: "list", "aria-labelledby": this.titleId }, index.h("slot", { key: '86b4d71b83671babb61dd12e842710d67350a09e', name: "post-list-item" }))));
541
+ }
542
+ get host() { return index.getElement(this); }
543
+ };
544
+ PostList.style = PostListStyle0;
545
+
546
+ const postListItemCss = ":host{display:flex}";
547
+ const PostListItemStyle0 = postListItemCss;
548
+
549
+ const PostListItem = class {
550
+ constructor(hostRef) {
551
+ index.registerInstance(this, hostRef);
552
+ }
553
+ connectedCallback() {
554
+ this.host.setAttribute('slot', 'post-list-item');
555
+ }
556
+ render() {
557
+ return (index.h(index.Host, { key: 'aa9a31c64e3e8ba5dcac1d03b54ab3c886149c1f', role: "listitem", slot: "post-list-item" }, index.h("slot", { key: '06353140f8917fc5373de6d56708467af2ef52b2' })));
558
+ }
559
+ get host() { return index.getElement(this); }
560
+ };
561
+ PostListItem.style = PostListItemStyle0;
562
+
563
+ const postLogoCss = ":host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
564
+ const PostLogoStyle0 = postLogoCss;
565
+
566
+ const PostLogo = class {
567
+ constructor(hostRef) {
568
+ index.registerInstance(this, hostRef);
569
+ this.url = undefined;
570
+ }
571
+ validateUrl() {
572
+ index$1.checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
573
+ }
574
+ componentDidLoad() {
575
+ this.validateUrl();
576
+ this.checkDescription();
577
+ }
578
+ checkDescription() {
579
+ if (!this.host.textContent) {
580
+ console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
581
+ }
582
+ }
583
+ render() {
584
+ const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
585
+ const LogoTag = logoLink ? 'a' : 'span';
586
+ return (index.h(index.Host, { key: 'b8d47e2530eb39f7b05370b4cea0b728cb00a1fb', "data-version": _package.version, slot: "post-logo" }, index.h(LogoTag, Object.assign({ key: '47a4d88622aab30e652a08827e221dacda36cb48', class: "logo" }, (logoLink ? { href: logoLink } : {})), index.h("span", { key: '4eb6ad1bc6c165197b6bcce8fe1146eb9d48fb21', class: "description" }, index.h("slot", { key: 'c66a4385f19711daab6f4ba87d5f78f59ad8b263', onSlotchange: () => this.checkDescription() })), index.h("svg", { key: '824643e64a3fb0914082f8f78a11753d66c98842', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, index.h("g", { key: 'e4f63d237c1fe1128005f29ea604c865f6b50943', id: "Logo" }, index.h("rect", { key: '34fec89177fb5461318d3e8fcc725f32dd97057a', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), index.h("polygon", { key: '5600de7c21a8e363fffa35710a3f41e4295b76c7', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), index.h("path", { key: '719be82825355704c4eac3c60fb461f6303734f7', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
587
+ }
588
+ get host() { return index.getElement(this); }
589
+ static get watchers() { return {
590
+ "url": ["validateUrl"]
591
+ }; }
592
+ };
593
+ PostLogo.style = PostLogoStyle0;
594
+
595
+ const postMainnavigationCss = "post-mainnavigation post-list-item>a{text-decoration:none;border-radius:0}post-mainnavigation post-list-item post-megadropdown-trigger button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}post-mainnavigation post-list-item>a:focus-visible,post-mainnavigation post-list-item>button:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:var(--post-core-dimension-4);z-index:1}@media screen and (min-width: 1024px){post-mainnavigation nav{position:relative;max-width:100vw;max-height:var(--post-core-dimension-56);user-select:none}post-mainnavigation post-list{margin-inline:var(--post-core-dimension-4)}post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw;transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline:var(--post-core-dimension-12);height:var(--post-core-dimension-56);gap:var(--post-core-dimension-4);font-size:var(--post-core-font-size-16);border-block:0 solid rgba(0,0,0,0);border-block-end-color:currentColor}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{border-block-width:var(--post-core-dimension-2)}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{border-block-width:var(--post-core-dimension-4);font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:var(--post-core-dimension-12);transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{content:\"\";-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:var(--post-core-dimension-24);width:var(--post-core-dimension-24);transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button.selected::after,post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-mainnavigation post-list-item post-megadropdown-trigger button.selected::after,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.99px){post-mainnavigation post-list>[role=list]{transform:none !important}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;height:var(--post-core-dimension-48);padding-inline-end:var(--post-core-dimension-6);gap:var(--post-core-dimension-16);border-block:var(--post-core-dimension-1) solid rgba(0,0,0,0);border-block-end-color:currentColor;font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button.selected{border-block-width:var(--post-core-dimension-3)}post-mainnavigation post-list-item>a:hover::after,post-mainnavigation post-list-item>button:hover::after,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::after{content:\"\";display:block;-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.667 5.333H18.8L29.467 16H0v1.333h29.467L18.8 28h1.867L32 16.667z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.667 5.333H18.8L29.467 16H0v1.333h29.467L18.8 28h1.867L32 16.667z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;width:var(--post-core-dimension-24);height:var(--post-core-dimension-24)}}";
596
+ const PostMainnavigationStyle0 = postMainnavigationCss;
597
+
598
+ const PostMainnavigation = class {
599
+ constructor(hostRef) {
600
+ index.registerInstance(this, hostRef);
601
+ this.postToggle = index.createEvent(this, "postToggle", 7);
602
+ }
603
+ /**
604
+ * Retrieves a reference to the closest 'post-header' element when the main navigation is added to the DOM.
605
+ */
606
+ connectedCallback() {
607
+ this.header = this.host.closest('post-header');
608
+ }
609
+ /**
610
+ * Cleans up references and disconnects the MutationObserver when the main navigation is removed from the DOM.
611
+ */
612
+ disconnectedCallback() {
613
+ this.header = null;
614
+ }
615
+ handleBackButtonClick() {
616
+ if (this.header)
617
+ this.header.toggleMobileMenu();
618
+ }
619
+ render() {
620
+ return (index.h(index.Host, { key: 'f21c438ac0bbcb08e08fd419589bf92b7d8b3a61', slot: "post-mainnavigation" }, index.h("div", { key: '1925f47932d7e842e8b9f059d7ade955c577fa50', onClick: () => this.handleBackButtonClick(), class: "back-button" }, index.h("slot", { key: 'fe18f6859a6d79c7ae701b65a31be1eab9c8b2ac', name: "back-button" })), index.h("nav", { key: 'ad2b0a52bc0bcf78a3c3340ba163ee6167be2c73' }, index.h("slot", { key: '8fc7b01cc0f3729cd2c12c4967ec87891fe0dcf5' }))));
621
+ }
622
+ get host() { return index.getElement(this); }
623
+ };
624
+ PostMainnavigation.style = PostMainnavigationStyle0;
625
+
626
+ const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}*,::before,::after{box-sizing:border-box}post-popovercontainer{--post-global-header-height:72px;--post-main-header-height:56px;--post-header-height:calc(var(--post-global-header-height) + var(--post-main-header-height));background-color:#fafafa;border:none;border-top:1px solid #e1e0dc;width:100%;border-radius:0;box-shadow:0 8px 6px rgba(0,0,0,.16)}@media screen and (max-width: 1023.99px){post-popovercontainer{--post-global-header-height:64px;position:absolute;top:var(--post-header-height) !important;bottom:0;left:0;width:100%;height:auto}post-popovercontainer.slide-in{animation:slide-in;animation-duration:350ms;animation-fill-mode:forwards}post-popovercontainer.slide-out{animation:slide-out;animation-duration:350ms;animation-fill-mode:forwards}}.megadropdown{padding:31px 40px 40px}@media screen and (max-width: 1023.99px){.megadropdown{padding:16px 32px 24px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.99px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.99px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-top:0;margin-bottom:8px;font-weight:900}.megadropdown h2 a{text-decoration:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown h2{display:block;font-size:20px}}.megadropdown a:hover{border-block-width:0}.megadropdown a:hover::after{content:unset}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;border-bottom:1px solid #050400;padding:15px 12px 14px 0;display:block;font-weight:900}.megadropdown post-list .list-title h3 a{text-decoration:none;width:100%;font-size:inherit;display:inline-block;font-weight:inherit;height:unset;padding:0;border:0}@media screen and (max-width: 1023.99px){.megadropdown post-list .list-title h3{font-size:16px;padding:12px 12px 11px 0}}.megadropdown post-list-item{border-bottom:1px solid #050400}.megadropdown post-list-item>a{padding:13px 12px 12px 0;display:block;text-decoration:none;width:100%;border-bottom:0;height:auto;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown post-list-item>a{padding:12px 12px 11px 0}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}.megadropdown .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.99px){.megadropdown .back-button{display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.99px){.megadropdown .close-button{display:none}}";
627
+ const PostMegadropdownStyle0 = postMegadropdownCss;
628
+
629
+ const PostMegadropdown = class {
630
+ constructor(hostRef) {
631
+ index.registerInstance(this, hostRef);
632
+ this.postToggleMegadropdown = index.createEvent(this, "postToggleMegadropdown", 7);
633
+ this.isVisible = false;
634
+ this.animationClass = null;
635
+ }
636
+ componentDidLoad() {
637
+ this.popoverRef.addEventListener('postToggle', (event) => {
638
+ this.isVisible = event.detail;
639
+ this.postToggleMegadropdown.emit(this.isVisible);
640
+ });
641
+ this.popoverRef.addEventListener('animationend', () => {
642
+ if (this.animationClass === 'slide-out') {
643
+ this.hide();
644
+ }
645
+ });
646
+ }
647
+ /**
648
+ * Toggles the dropdown visibility based on its current state.
649
+ */
650
+ async toggle(target) {
651
+ this.isVisible ? this.hide() : await this.show(target);
652
+ }
653
+ /**
654
+ * Displays the popover dropdown
655
+ *
656
+ * @param target - The HTML element relative to which the popover dropdown should be displayed.
657
+ */
658
+ async show(target) {
659
+ if (this.popoverRef) {
660
+ await this.popoverRef.show(target);
661
+ this.animationClass = 'slide-in';
662
+ }
663
+ else {
664
+ console.error('show: popoverRef is null or undefined');
665
+ }
666
+ }
667
+ /**
668
+ * Hides the popover dropdown
669
+ */
670
+ hide() {
671
+ if (this.popoverRef) {
672
+ this.popoverRef.hide();
673
+ }
674
+ else {
675
+ console.error('hide: popoverRef is null or undefined');
676
+ }
677
+ }
678
+ handleBackButtonClick() {
679
+ this.animationClass = 'slide-out';
680
+ }
681
+ handleCloseButtonClick() {
682
+ this.popoverRef.hide();
683
+ }
684
+ render() {
685
+ return (index.h(index.Host, { key: 'cfd4e6c7bb87c50e471d304a4b4f086266e1c2fe' }, index.h("post-popovercontainer", { key: '31dc3a5e98a5c60a4db8d47375491a6f3957af0b', class: this.animationClass, placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, index.h("div", { key: '7001d0e108544a0244af088be0bde49f90a3dea3', class: "megadropdown" }, index.h("div", { key: '513b0710163e8f58677b6b50d2ba2d241cf9ff35', onClick: () => this.handleBackButtonClick(), class: "back-button" }, index.h("slot", { key: '5457c0b9bfff045f39f470e600b5aa31036c0807', name: "back-button" })), index.h("div", { key: 'c3314a4ae4f386224a2db7fe32203f72f6a1b284', onClick: () => this.handleCloseButtonClick(), class: "close-button" }, index.h("slot", { key: '8feeec24fe5f2522ba1a54ab0b7c682d3a152086', name: "close-button" })), index.h("slot", { key: '6d9426756a809ed26045c9cd56cacf0f36aa9400', name: "megadropdown-title" }), index.h("div", { key: 'fd3b0ac7998eec76700ccc6668d8b2e3fcc4c63a', class: "megadropdown-content" }, index.h("slot", { key: '23638936fdffa224de9631bfd599c0872202a30d' }))))));
686
+ }
687
+ get host() { return index.getElement(this); }
688
+ };
689
+ PostMegadropdown.style = PostMegadropdownStyle0;
690
+
691
+ const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%}";
692
+ const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
693
+
694
+ const PostMegadropdownTrigger = class {
695
+ constructor(hostRef) {
696
+ index.registerInstance(this, hostRef);
697
+ /**
698
+ * Reference to the slotted button within the trigger, if present.
699
+ * Used to manage click and key events for mega dropdown control.
700
+ */
701
+ this.slottedButton = null;
702
+ this.for = undefined;
703
+ this.ariaExpanded = false;
704
+ }
705
+ /**
706
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
707
+ * @param forValue - The new value of the `for` property.
708
+ */
709
+ validateControlFor(forValue = this.for) {
710
+ checkType.checkType(forValue, 'string', 'The "for" property is required and should be a string.');
711
+ }
712
+ get megadropdown() {
713
+ const ref = document.getElementById(this.for);
714
+ return ref && ref.localName === 'post-megadropdown'
715
+ ? ref
716
+ : null;
717
+ }
718
+ handleToggle() {
719
+ if (this.megadropdown) {
720
+ this.megadropdown.toggle(this.host);
721
+ }
722
+ else {
723
+ console.warn(`No post-megadropdown found with ID: ${this.for}`);
724
+ }
725
+ }
726
+ componentDidLoad() {
727
+ this.validateControlFor();
728
+ // Check if the mega dropdown attached to the trigger is expanded or not
729
+ document.addEventListener('postToggleMegadropdown', (event) => {
730
+ if (event.target.id === this.for) {
731
+ this.ariaExpanded = event.detail;
732
+ if (this.slottedButton) {
733
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
734
+ }
735
+ }
736
+ });
737
+ this.slottedButton = this.host.querySelector('button');
738
+ if (this.slottedButton) {
739
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
740
+ this.slottedButton.addEventListener('click', () => {
741
+ this.handleToggle();
742
+ });
743
+ }
744
+ else {
745
+ console.warn('No button found within post-megadropdown-trigger');
746
+ }
747
+ }
748
+ render() {
749
+ return (index.h(index.Host, { key: '4ab919adeaa51fc12d45131fa540c76fb3ba73d9', "data-version": _package.version, "tab-index": "-1" }, index.h("button", { key: 'e7dac321691cdb19a4874fd0b2097227d077af35' }, index.h("slot", { key: 'beffc38d2d35a67e74364c3b40b6d39896aa4de3' }))));
750
+ }
751
+ get host() { return index.getElement(this); }
752
+ static get watchers() { return {
753
+ "for": ["validateControlFor"]
754
+ }; }
755
+ };
756
+ PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
757
+
758
+ const focusableSelector = `:where(${[
759
+ 'button',
760
+ 'input:not([type="hidden"])',
761
+ '[tabindex]',
762
+ 'select',
763
+ 'textarea',
764
+ '[contenteditable]',
765
+ 'a[href]',
766
+ 'iframe',
767
+ 'audio[controls]',
768
+ 'video[controls]',
769
+ 'area[href]',
770
+ 'details > summary:first-of-type',
771
+ ].join(',')})`;
772
+ const focusDisablingSelector = `:where(${[
773
+ '[inert]',
774
+ '[inert] *',
775
+ ':disabled',
776
+ 'dialog:not([open]) *',
777
+ '[popover]:not(:popover-open) *',
778
+ 'details:not([open]) > *:not(details > summary:first-of-type)',
779
+ 'details:not([open]) > *:not(details > summary:first-of-type) *',
780
+ ].join(',')})`;
781
+ const isFocusable = (element) => {
782
+ return (element === null || element === void 0 ? void 0 : element.matches(focusableSelector)) && !(element === null || element === void 0 ? void 0 : element.matches(focusDisablingSelector));
783
+ };
784
+
785
+ const postMenuCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}post-popovercontainer{padding:var(--post-menu-padding);background-color:var(--post-menu-bg, #ffffff);border-color:var(--post-menu-bg, #ffffff)}";
786
+ const PostMenuStyle0 = postMenuCss;
787
+
788
+ const PostMenu = class {
789
+ constructor(hostRef) {
790
+ index.registerInstance(this, hostRef);
791
+ this.toggleMenu = index.createEvent(this, "toggleMenu", 7);
792
+ this.lastFocusedElement = null;
793
+ this.KEYCODES = {
794
+ SPACE: ' ',
795
+ ENTER: 'Enter',
796
+ UP: 'ArrowUp',
797
+ DOWN: 'ArrowDown',
798
+ TAB: 'Tab',
799
+ HOME: 'Home',
800
+ END: 'End',
801
+ ESCAPE: 'Escape',
802
+ };
803
+ this.handleKeyDown = (e) => {
804
+ e.stopPropagation();
805
+ if (e.key === this.KEYCODES.ESCAPE) {
806
+ this.toggle(this.host);
807
+ return;
808
+ }
809
+ if (Object.values(this.KEYCODES).includes(e.key)) {
810
+ this.controlKeyDownHandler(e);
811
+ }
812
+ };
813
+ this.handleClick = (e) => {
814
+ const target = e.target;
815
+ if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
816
+ this.toggle(this.host);
817
+ }
818
+ };
819
+ this.placement = 'bottom';
820
+ this.isVisible = false;
821
+ }
822
+ connectedCallback() {
823
+ this.root = getRoot.getRoot(this.host);
824
+ this.host.addEventListener('keydown', this.handleKeyDown);
825
+ this.host.addEventListener('click', this.handleClick);
826
+ }
827
+ disconnectedCallback() {
828
+ this.host.removeEventListener('keydown', this.handleKeyDown);
829
+ this.host.removeEventListener('click', this.handleClick);
830
+ }
831
+ componentDidLoad() {
832
+ this.popoverRef.addEventListener('postToggle', (event) => {
833
+ this.isVisible = event.detail;
834
+ this.toggleMenu.emit(this.isVisible);
835
+ });
836
+ }
837
+ /**
838
+ * Toggles the menu visibility based on its current state.
839
+ */
840
+ async toggle(target) {
841
+ this.isVisible ? await this.hide() : await this.show(target);
842
+ }
843
+ /**
844
+ * Displays the popover menu, focusing the first menu item.
845
+ *
846
+ * @param target - The HTML element relative to which the popover menu should be displayed.
847
+ */
848
+ async show(target) {
849
+ if (this.popoverRef) {
850
+ await this.popoverRef.show(target);
851
+ this.lastFocusedElement = this.root.activeElement; // Use root's activeElement
852
+ const menuItems = this.getSlottedItems();
853
+ if (menuItems.length > 0) {
854
+ menuItems[0].focus();
855
+ }
856
+ }
857
+ else {
858
+ console.error('show: popoverRef is null or undefined');
859
+ }
860
+ }
861
+ /**
862
+ * Hides the popover menu and restores focus to the previously focused element.
863
+ */
864
+ async hide() {
865
+ if (this.popoverRef) {
866
+ await this.popoverRef.hide();
867
+ if (this.lastFocusedElement) {
868
+ this.lastFocusedElement.focus();
869
+ }
870
+ }
871
+ else {
872
+ console.error('hide: popoverRef is null or undefined');
873
+ }
874
+ }
875
+ controlKeyDownHandler(e) {
876
+ const menuItems = this.getSlottedItems();
877
+ if (!menuItems.length) {
878
+ return;
879
+ }
880
+ const currentFocusedElement = this.root.activeElement; // Use root's activeElement
881
+ let currentIndex = menuItems.findIndex(el => el === currentFocusedElement);
882
+ switch (e.key) {
883
+ case this.KEYCODES.UP:
884
+ e.preventDefault();
885
+ currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
886
+ break;
887
+ case this.KEYCODES.DOWN:
888
+ e.preventDefault();
889
+ currentIndex = (currentIndex + 1) % menuItems.length;
890
+ break;
891
+ case this.KEYCODES.HOME:
892
+ currentIndex = 0;
893
+ break;
894
+ case this.KEYCODES.END:
895
+ currentIndex = menuItems.length - 1;
896
+ break;
897
+ case this.KEYCODES.SPACE:
898
+ case this.KEYCODES.ENTER:
899
+ this.toggle(this.host);
900
+ return;
901
+ case this.KEYCODES.TAB:
902
+ this.toggle(this.host);
903
+ break;
904
+ }
905
+ if (menuItems[currentIndex]) {
906
+ menuItems[currentIndex].focus();
907
+ }
908
+ }
909
+ getSlottedItems() {
910
+ const slot = this.host.shadowRoot.querySelector('slot');
911
+ const slottedElements = slot ? slot.assignedElements() : [];
912
+ const menuItems = slottedElements
913
+ .filter(el => el.tagName === 'POST-MENU-ITEM')
914
+ .map(el => {
915
+ const slot = el.shadowRoot.querySelector('slot');
916
+ const assignedElements = slot ? slot.assignedElements() : [];
917
+ return assignedElements.filter(isFocusable);
918
+ })
919
+ .flat();
920
+ return menuItems;
921
+ }
922
+ render() {
923
+ return (index.h(index.Host, { key: '48e04f36dc7a3d8ed81b9570d1a4c931ace3cadd', "data-version": _package.version }, index.h("post-popovercontainer", { key: '58532143bd7a8be7ea77cbd0a929fa74ee0ee890', placement: this.placement, ref: e => (this.popoverRef = e) }, index.h("div", { key: '967bf8aa936611ac6d533d9a8a1e176ee84b2a73', class: "popover-container", part: "popover-container" }, index.h("slot", { key: '4eb6b7fe34e8ea1df0d7cd8de31b57452442c3bb' })))));
924
+ }
925
+ get host() { return index.getElement(this); }
926
+ };
927
+ PostMenu.style = PostMenuStyle0;
928
+
929
+ const postMenuTriggerCss = ":host{display:inline-block}";
930
+ const PostMenuTriggerStyle0 = postMenuTriggerCss;
931
+
932
+ const PostMenuTrigger = class {
933
+ constructor(hostRef) {
934
+ index.registerInstance(this, hostRef);
935
+ /**
936
+ * Reference to the slotted button within the trigger, if present.
937
+ * Used to manage click and key events for menu control.
938
+ */
939
+ this.slottedButton = null;
940
+ this.handleKeyDown = (e) => {
941
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
942
+ e.preventDefault();
943
+ this.handleToggle();
944
+ }
945
+ };
946
+ this.for = undefined;
947
+ this.ariaExpanded = false;
948
+ }
949
+ /**
950
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
951
+ * @param forValue - The new value of the `for` property.
952
+ */
953
+ validateControlFor(forValue = this.for) {
954
+ checkType.checkType(forValue, 'string', 'The "for" property is required and should be a string.');
955
+ }
956
+ get menu() {
957
+ const ref = this.root.getElementById(this.for);
958
+ return ref && ref.localName === 'post-menu' ? ref : null;
959
+ }
960
+ handleToggle() {
961
+ const menu = this.menu;
962
+ if (menu && this.slottedButton) {
963
+ this.ariaExpanded = !this.ariaExpanded;
964
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
965
+ menu.toggle(this.host);
966
+ }
967
+ else {
968
+ console.warn(`No post-menu found with ID: ${this.for}`);
969
+ }
970
+ }
971
+ componentDidLoad() {
972
+ this.root = getRoot.getRoot(this.host);
973
+ this.validateControlFor();
974
+ this.slottedButton = this.host.querySelector('button');
975
+ // Check if the slottedButton is within a web component
976
+ if (!this.slottedButton) {
977
+ const webComponent = this.host.querySelector('.menu-trigger-webc');
978
+ if (webComponent.shadowRoot) {
979
+ const slottedButton = webComponent.shadowRoot.querySelector('button');
980
+ if (slottedButton) {
981
+ this.slottedButton = slottedButton;
982
+ }
983
+ }
984
+ }
985
+ if (this.slottedButton) {
986
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
987
+ this.slottedButton.addEventListener('click', () => {
988
+ this.handleToggle();
989
+ });
990
+ this.slottedButton.addEventListener('keydown', this.handleKeyDown);
991
+ }
992
+ else {
993
+ console.warn('No button found within post-menu-trigger');
994
+ }
995
+ }
996
+ render() {
997
+ return (index.h(index.Host, { key: '64e9e7e6448160c7b52fc732b5107e94e9776678', "data-version": _package.version, "tab-index": "-1" }, index.h("slot", { key: '711d641147cec0c26c7a3917f9302f1bbbee0d73' })));
998
+ }
999
+ get host() { return index.getElement(this); }
1000
+ static get watchers() { return {
1001
+ "for": ["validateControlFor"]
1002
+ }; }
1003
+ };
1004
+ PostMenuTrigger.style = PostMenuTriggerStyle0;
1005
+
1006
+ /**
1007
+ * Custom positioning reference element.
1008
+ * @see https://floating-ui.com/docs/virtual-elements
1009
+ */
1010
+
1011
+ const sides = ['top', 'right', 'bottom', 'left'];
1012
+ const alignments = ['start', 'end'];
1013
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
1014
+ const min = Math.min;
1015
+ const max = Math.max;
1016
+ const round = Math.round;
1017
+ const floor = Math.floor;
1018
+ const createCoords = v => ({
1019
+ x: v,
1020
+ y: v
1021
+ });
1022
+ const oppositeSideMap = {
1023
+ left: 'right',
1024
+ right: 'left',
1025
+ bottom: 'top',
1026
+ top: 'bottom'
163
1027
  };
164
1028
  const oppositeAlignmentMap = {
165
1029
  start: 'end',
@@ -1336,1349 +2200,1040 @@ function isOverflowElement(element) {
1336
2200
  } = getComputedStyle$1(element);
1337
2201
  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1338
2202
  }
1339
- function isTableElement(element) {
1340
- return ['table', 'td', 'th'].includes(getNodeName(element));
1341
- }
1342
- function isTopLayer(element) {
1343
- return [':popover-open', ':modal'].some(selector => {
1344
- try {
1345
- return element.matches(selector);
1346
- } catch (e) {
1347
- return false;
1348
- }
1349
- });
1350
- }
1351
- function isContainingBlock(elementOrCss) {
1352
- const webkit = isWebKit();
1353
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1354
-
1355
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1356
- 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));
1357
- }
1358
- function getContainingBlock(element) {
1359
- let currentNode = getParentNode(element);
1360
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1361
- if (isContainingBlock(currentNode)) {
1362
- return currentNode;
1363
- } else if (isTopLayer(currentNode)) {
1364
- return null;
1365
- }
1366
- currentNode = getParentNode(currentNode);
1367
- }
1368
- return null;
1369
- }
1370
- function isWebKit() {
1371
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1372
- return CSS.supports('-webkit-backdrop-filter', 'none');
1373
- }
1374
- function isLastTraversableNode(node) {
1375
- return ['html', 'body', '#document'].includes(getNodeName(node));
1376
- }
1377
- function getComputedStyle$1(element) {
1378
- return getWindow(element).getComputedStyle(element);
1379
- }
1380
- function getNodeScroll(element) {
1381
- if (isElement(element)) {
1382
- return {
1383
- scrollLeft: element.scrollLeft,
1384
- scrollTop: element.scrollTop
1385
- };
1386
- }
1387
- return {
1388
- scrollLeft: element.scrollX,
1389
- scrollTop: element.scrollY
1390
- };
1391
- }
1392
- function getParentNode(node) {
1393
- if (getNodeName(node) === 'html') {
1394
- return node;
1395
- }
1396
- const result =
1397
- // Step into the shadow DOM of the parent of a slotted node.
1398
- node.assignedSlot ||
1399
- // DOM Element detected.
1400
- node.parentNode ||
1401
- // ShadowRoot detected.
1402
- isShadowRoot(node) && node.host ||
1403
- // Fallback.
1404
- getDocumentElement(node);
1405
- return isShadowRoot(result) ? result.host : result;
1406
- }
1407
- function getNearestOverflowAncestor(node) {
1408
- const parentNode = getParentNode(node);
1409
- if (isLastTraversableNode(parentNode)) {
1410
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1411
- }
1412
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1413
- return parentNode;
1414
- }
1415
- return getNearestOverflowAncestor(parentNode);
1416
- }
1417
- function getOverflowAncestors(node, list, traverseIframes) {
1418
- var _node$ownerDocument2;
1419
- if (list === void 0) {
1420
- list = [];
1421
- }
1422
- if (traverseIframes === void 0) {
1423
- traverseIframes = true;
1424
- }
1425
- const scrollableAncestor = getNearestOverflowAncestor(node);
1426
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1427
- const win = getWindow(scrollableAncestor);
1428
- if (isBody) {
1429
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
1430
- }
1431
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1432
- }
1433
-
1434
- function getCssDimensions(element) {
1435
- const css = getComputedStyle$1(element);
1436
- // In testing environments, the `width` and `height` properties are empty
1437
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1438
- let width = parseFloat(css.width) || 0;
1439
- let height = parseFloat(css.height) || 0;
1440
- const hasOffset = isHTMLElement(element);
1441
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1442
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1443
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1444
- if (shouldFallback) {
1445
- width = offsetWidth;
1446
- height = offsetHeight;
1447
- }
1448
- return {
1449
- width,
1450
- height,
1451
- $: shouldFallback
1452
- };
1453
- }
1454
-
1455
- function unwrapElement(element) {
1456
- return !isElement(element) ? element.contextElement : element;
1457
- }
1458
-
1459
- function getScale(element) {
1460
- const domElement = unwrapElement(element);
1461
- if (!isHTMLElement(domElement)) {
1462
- return createCoords(1);
1463
- }
1464
- const rect = domElement.getBoundingClientRect();
1465
- const {
1466
- width,
1467
- height,
1468
- $
1469
- } = getCssDimensions(domElement);
1470
- let x = ($ ? round(rect.width) : rect.width) / width;
1471
- let y = ($ ? round(rect.height) : rect.height) / height;
1472
-
1473
- // 0, NaN, or Infinity should always fallback to 1.
1474
-
1475
- if (!x || !Number.isFinite(x)) {
1476
- x = 1;
1477
- }
1478
- if (!y || !Number.isFinite(y)) {
1479
- y = 1;
1480
- }
1481
- return {
1482
- x,
1483
- y
1484
- };
1485
- }
1486
-
1487
- const noOffsets = /*#__PURE__*/createCoords(0);
1488
- function getVisualOffsets(element) {
1489
- const win = getWindow(element);
1490
- if (!isWebKit() || !win.visualViewport) {
1491
- return noOffsets;
1492
- }
1493
- return {
1494
- x: win.visualViewport.offsetLeft,
1495
- y: win.visualViewport.offsetTop
1496
- };
1497
- }
1498
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1499
- if (isFixed === void 0) {
1500
- isFixed = false;
1501
- }
1502
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1503
- return false;
1504
- }
1505
- return isFixed;
1506
- }
1507
-
1508
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1509
- if (includeScale === void 0) {
1510
- includeScale = false;
1511
- }
1512
- if (isFixedStrategy === void 0) {
1513
- isFixedStrategy = false;
1514
- }
1515
- const clientRect = element.getBoundingClientRect();
1516
- const domElement = unwrapElement(element);
1517
- let scale = createCoords(1);
1518
- if (includeScale) {
1519
- if (offsetParent) {
1520
- if (isElement(offsetParent)) {
1521
- scale = getScale(offsetParent);
1522
- }
1523
- } else {
1524
- scale = getScale(element);
1525
- }
1526
- }
1527
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1528
- let x = (clientRect.left + visualOffsets.x) / scale.x;
1529
- let y = (clientRect.top + visualOffsets.y) / scale.y;
1530
- let width = clientRect.width / scale.x;
1531
- let height = clientRect.height / scale.y;
1532
- if (domElement) {
1533
- const win = getWindow(domElement);
1534
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1535
- let currentWin = win;
1536
- let currentIFrame = currentWin.frameElement;
1537
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1538
- const iframeScale = getScale(currentIFrame);
1539
- const iframeRect = currentIFrame.getBoundingClientRect();
1540
- const css = getComputedStyle$1(currentIFrame);
1541
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1542
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1543
- x *= iframeScale.x;
1544
- y *= iframeScale.y;
1545
- width *= iframeScale.x;
1546
- height *= iframeScale.y;
1547
- x += left;
1548
- y += top;
1549
- currentWin = getWindow(currentIFrame);
1550
- currentIFrame = currentWin.frameElement;
2203
+ function isTableElement(element) {
2204
+ return ['table', 'td', 'th'].includes(getNodeName(element));
2205
+ }
2206
+ function isTopLayer(element) {
2207
+ return [':popover-open', ':modal'].some(selector => {
2208
+ try {
2209
+ return element.matches(selector);
2210
+ } catch (e) {
2211
+ return false;
1551
2212
  }
1552
- }
1553
- return rectToClientRect({
1554
- width,
1555
- height,
1556
- x,
1557
- y
1558
2213
  });
1559
2214
  }
2215
+ function isContainingBlock(elementOrCss) {
2216
+ const webkit = isWebKit();
2217
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1560
2218
 
1561
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1562
- let {
1563
- elements,
1564
- rect,
1565
- offsetParent,
1566
- strategy
1567
- } = _ref;
1568
- const isFixed = strategy === 'fixed';
1569
- const documentElement = getDocumentElement(offsetParent);
1570
- const topLayer = elements ? isTopLayer(elements.floating) : false;
1571
- if (offsetParent === documentElement || topLayer && isFixed) {
1572
- return rect;
1573
- }
1574
- let scroll = {
1575
- scrollLeft: 0,
1576
- scrollTop: 0
1577
- };
1578
- let scale = createCoords(1);
1579
- const offsets = createCoords(0);
1580
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1581
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1582
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1583
- scroll = getNodeScroll(offsetParent);
1584
- }
1585
- if (isHTMLElement(offsetParent)) {
1586
- const offsetRect = getBoundingClientRect(offsetParent);
1587
- scale = getScale(offsetParent);
1588
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1589
- offsets.y = offsetRect.y + offsetParent.clientTop;
2219
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2220
+ 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));
2221
+ }
2222
+ function getContainingBlock(element) {
2223
+ let currentNode = getParentNode(element);
2224
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2225
+ if (isContainingBlock(currentNode)) {
2226
+ return currentNode;
2227
+ } else if (isTopLayer(currentNode)) {
2228
+ return null;
1590
2229
  }
2230
+ currentNode = getParentNode(currentNode);
1591
2231
  }
1592
- return {
1593
- width: rect.width * scale.x,
1594
- height: rect.height * scale.y,
1595
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1596
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1597
- };
2232
+ return null;
1598
2233
  }
1599
-
1600
- function getClientRects(element) {
1601
- return Array.from(element.getClientRects());
2234
+ function isWebKit() {
2235
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
2236
+ return CSS.supports('-webkit-backdrop-filter', 'none');
1602
2237
  }
1603
-
1604
- function getWindowScrollBarX(element) {
1605
- // If <html> has a CSS width greater than the viewport, then this will be
1606
- // incorrect for RTL.
1607
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2238
+ function isLastTraversableNode(node) {
2239
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1608
2240
  }
1609
-
1610
- // Gets the entire size of the scrollable document area, even extending outside
1611
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1612
- function getDocumentRect(element) {
1613
- const html = getDocumentElement(element);
1614
- const scroll = getNodeScroll(element);
1615
- const body = element.ownerDocument.body;
1616
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1617
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1618
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1619
- const y = -scroll.scrollTop;
1620
- if (getComputedStyle$1(body).direction === 'rtl') {
1621
- x += max(html.clientWidth, body.clientWidth) - width;
1622
- }
1623
- return {
1624
- width,
1625
- height,
1626
- x,
1627
- y
1628
- };
2241
+ function getComputedStyle$1(element) {
2242
+ return getWindow(element).getComputedStyle(element);
1629
2243
  }
1630
-
1631
- function getViewportRect(element, strategy) {
1632
- const win = getWindow(element);
1633
- const html = getDocumentElement(element);
1634
- const visualViewport = win.visualViewport;
1635
- let width = html.clientWidth;
1636
- let height = html.clientHeight;
1637
- let x = 0;
1638
- let y = 0;
1639
- if (visualViewport) {
1640
- width = visualViewport.width;
1641
- height = visualViewport.height;
1642
- const visualViewportBased = isWebKit();
1643
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1644
- x = visualViewport.offsetLeft;
1645
- y = visualViewport.offsetTop;
1646
- }
2244
+ function getNodeScroll(element) {
2245
+ if (isElement(element)) {
2246
+ return {
2247
+ scrollLeft: element.scrollLeft,
2248
+ scrollTop: element.scrollTop
2249
+ };
1647
2250
  }
1648
2251
  return {
1649
- width,
1650
- height,
1651
- x,
1652
- y
1653
- };
1654
- }
1655
-
1656
- // Returns the inner client rect, subtracting scrollbars if present.
1657
- function getInnerBoundingClientRect(element, strategy) {
1658
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1659
- const top = clientRect.top + element.clientTop;
1660
- const left = clientRect.left + element.clientLeft;
1661
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1662
- const width = element.clientWidth * scale.x;
1663
- const height = element.clientHeight * scale.y;
1664
- const x = left * scale.x;
1665
- const y = top * scale.y;
1666
- return {
1667
- width,
1668
- height,
1669
- x,
1670
- y
2252
+ scrollLeft: element.scrollX,
2253
+ scrollTop: element.scrollY
1671
2254
  };
1672
2255
  }
1673
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1674
- let rect;
1675
- if (clippingAncestor === 'viewport') {
1676
- rect = getViewportRect(element, strategy);
1677
- } else if (clippingAncestor === 'document') {
1678
- rect = getDocumentRect(getDocumentElement(element));
1679
- } else if (isElement(clippingAncestor)) {
1680
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1681
- } else {
1682
- const visualOffsets = getVisualOffsets(element);
1683
- rect = {
1684
- ...clippingAncestor,
1685
- x: clippingAncestor.x - visualOffsets.x,
1686
- y: clippingAncestor.y - visualOffsets.y
1687
- };
2256
+ function getParentNode(node) {
2257
+ if (getNodeName(node) === 'html') {
2258
+ return node;
1688
2259
  }
1689
- return rectToClientRect(rect);
2260
+ const result =
2261
+ // Step into the shadow DOM of the parent of a slotted node.
2262
+ node.assignedSlot ||
2263
+ // DOM Element detected.
2264
+ node.parentNode ||
2265
+ // ShadowRoot detected.
2266
+ isShadowRoot(node) && node.host ||
2267
+ // Fallback.
2268
+ getDocumentElement(node);
2269
+ return isShadowRoot(result) ? result.host : result;
1690
2270
  }
1691
- function hasFixedPositionAncestor(element, stopNode) {
1692
- const parentNode = getParentNode(element);
1693
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1694
- return false;
2271
+ function getNearestOverflowAncestor(node) {
2272
+ const parentNode = getParentNode(node);
2273
+ if (isLastTraversableNode(parentNode)) {
2274
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1695
2275
  }
1696
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
2276
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2277
+ return parentNode;
2278
+ }
2279
+ return getNearestOverflowAncestor(parentNode);
1697
2280
  }
1698
-
1699
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1700
- // clipping (or hiding) child elements. This returns all clipping ancestors
1701
- // of the given element up the tree.
1702
- function getClippingElementAncestors(element, cache) {
1703
- const cachedResult = cache.get(element);
1704
- if (cachedResult) {
1705
- return cachedResult;
2281
+ function getOverflowAncestors(node, list, traverseIframes) {
2282
+ var _node$ownerDocument2;
2283
+ if (list === void 0) {
2284
+ list = [];
1706
2285
  }
1707
- let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1708
- let currentContainingBlockComputedStyle = null;
1709
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1710
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1711
-
1712
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1713
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1714
- const computedStyle = getComputedStyle$1(currentNode);
1715
- const currentNodeIsContaining = isContainingBlock(currentNode);
1716
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1717
- currentContainingBlockComputedStyle = null;
1718
- }
1719
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1720
- if (shouldDropCurrentNode) {
1721
- // Drop non-containing blocks.
1722
- result = result.filter(ancestor => ancestor !== currentNode);
1723
- } else {
1724
- // Record last containing block for next iteration.
1725
- currentContainingBlockComputedStyle = computedStyle;
1726
- }
1727
- currentNode = getParentNode(currentNode);
2286
+ if (traverseIframes === void 0) {
2287
+ traverseIframes = true;
1728
2288
  }
1729
- cache.set(element, result);
1730
- return result;
1731
- }
1732
-
1733
- // Gets the maximum area that the element is visible in due to any number of
1734
- // clipping ancestors.
1735
- function getClippingRect(_ref) {
1736
- let {
1737
- element,
1738
- boundary,
1739
- rootBoundary,
1740
- strategy
1741
- } = _ref;
1742
- const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1743
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1744
- const firstClippingAncestor = clippingAncestors[0];
1745
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1746
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1747
- accRect.top = max(rect.top, accRect.top);
1748
- accRect.right = min(rect.right, accRect.right);
1749
- accRect.bottom = min(rect.bottom, accRect.bottom);
1750
- accRect.left = max(rect.left, accRect.left);
1751
- return accRect;
1752
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1753
- return {
1754
- width: clippingRect.right - clippingRect.left,
1755
- height: clippingRect.bottom - clippingRect.top,
1756
- x: clippingRect.left,
1757
- y: clippingRect.top
1758
- };
2289
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2290
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2291
+ const win = getWindow(scrollableAncestor);
2292
+ if (isBody) {
2293
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
2294
+ }
2295
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1759
2296
  }
1760
2297
 
1761
- function getDimensions(element) {
1762
- const {
1763
- width,
1764
- height
1765
- } = getCssDimensions(element);
2298
+ function getCssDimensions(element) {
2299
+ const css = getComputedStyle$1(element);
2300
+ // In testing environments, the `width` and `height` properties are empty
2301
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
2302
+ let width = parseFloat(css.width) || 0;
2303
+ let height = parseFloat(css.height) || 0;
2304
+ const hasOffset = isHTMLElement(element);
2305
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2306
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2307
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2308
+ if (shouldFallback) {
2309
+ width = offsetWidth;
2310
+ height = offsetHeight;
2311
+ }
1766
2312
  return {
1767
2313
  width,
1768
- height
2314
+ height,
2315
+ $: shouldFallback
1769
2316
  };
1770
2317
  }
1771
2318
 
1772
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1773
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1774
- const documentElement = getDocumentElement(offsetParent);
1775
- const isFixed = strategy === 'fixed';
1776
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1777
- let scroll = {
1778
- scrollLeft: 0,
1779
- scrollTop: 0
1780
- };
1781
- const offsets = createCoords(0);
1782
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1783
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1784
- scroll = getNodeScroll(offsetParent);
1785
- }
1786
- if (isOffsetParentAnElement) {
1787
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1788
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1789
- offsets.y = offsetRect.y + offsetParent.clientTop;
1790
- } else if (documentElement) {
1791
- offsets.x = getWindowScrollBarX(documentElement);
1792
- }
1793
- }
1794
- const x = rect.left + scroll.scrollLeft - offsets.x;
1795
- const y = rect.top + scroll.scrollTop - offsets.y;
1796
- return {
1797
- x,
1798
- y,
1799
- width: rect.width,
1800
- height: rect.height
1801
- };
2319
+ function unwrapElement(element) {
2320
+ return !isElement(element) ? element.contextElement : element;
1802
2321
  }
1803
2322
 
1804
- function isStaticPositioned(element) {
1805
- return getComputedStyle$1(element).position === 'static';
1806
- }
2323
+ function getScale(element) {
2324
+ const domElement = unwrapElement(element);
2325
+ if (!isHTMLElement(domElement)) {
2326
+ return createCoords(1);
2327
+ }
2328
+ const rect = domElement.getBoundingClientRect();
2329
+ const {
2330
+ width,
2331
+ height,
2332
+ $
2333
+ } = getCssDimensions(domElement);
2334
+ let x = ($ ? round(rect.width) : rect.width) / width;
2335
+ let y = ($ ? round(rect.height) : rect.height) / height;
1807
2336
 
1808
- function getTrueOffsetParent(element, polyfill) {
1809
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1810
- return null;
2337
+ // 0, NaN, or Infinity should always fallback to 1.
2338
+
2339
+ if (!x || !Number.isFinite(x)) {
2340
+ x = 1;
1811
2341
  }
1812
- if (polyfill) {
1813
- return polyfill(element);
2342
+ if (!y || !Number.isFinite(y)) {
2343
+ y = 1;
1814
2344
  }
1815
- return element.offsetParent;
2345
+ return {
2346
+ x,
2347
+ y
2348
+ };
1816
2349
  }
1817
2350
 
1818
- // Gets the closest ancestor positioned element. Handles some edge cases,
1819
- // such as table ancestors and cross browser bugs.
1820
- function getOffsetParent(element, polyfill) {
2351
+ const noOffsets = /*#__PURE__*/createCoords(0);
2352
+ function getVisualOffsets(element) {
1821
2353
  const win = getWindow(element);
1822
- if (isTopLayer(element)) {
1823
- return win;
1824
- }
1825
- if (!isHTMLElement(element)) {
1826
- let svgOffsetParent = getParentNode(element);
1827
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1828
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1829
- return svgOffsetParent;
1830
- }
1831
- svgOffsetParent = getParentNode(svgOffsetParent);
1832
- }
1833
- return win;
1834
- }
1835
- let offsetParent = getTrueOffsetParent(element, polyfill);
1836
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1837
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1838
- }
1839
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1840
- return win;
2354
+ if (!isWebKit() || !win.visualViewport) {
2355
+ return noOffsets;
1841
2356
  }
1842
- return offsetParent || getContainingBlock(element) || win;
1843
- }
1844
-
1845
- const getElementRects = async function (data) {
1846
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1847
- const getDimensionsFn = this.getDimensions;
1848
- const floatingDimensions = await getDimensionsFn(data.floating);
1849
2357
  return {
1850
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1851
- floating: {
1852
- x: 0,
1853
- y: 0,
1854
- width: floatingDimensions.width,
1855
- height: floatingDimensions.height
1856
- }
2358
+ x: win.visualViewport.offsetLeft,
2359
+ y: win.visualViewport.offsetTop
1857
2360
  };
1858
- };
1859
-
1860
- function isRTL(element) {
1861
- return getComputedStyle$1(element).direction === 'rtl';
2361
+ }
2362
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2363
+ if (isFixed === void 0) {
2364
+ isFixed = false;
2365
+ }
2366
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
2367
+ return false;
2368
+ }
2369
+ return isFixed;
1862
2370
  }
1863
2371
 
1864
- const platform = {
1865
- convertOffsetParentRelativeRectToViewportRelativeRect,
1866
- getDocumentElement,
1867
- getClippingRect,
1868
- getOffsetParent,
1869
- getElementRects,
1870
- getClientRects,
1871
- getDimensions,
1872
- getScale,
1873
- isElement,
1874
- isRTL
1875
- };
1876
-
1877
- // https://samthor.au/2021/observing-dom/
1878
- function observeMove(element, onMove) {
1879
- let io = null;
1880
- let timeoutId;
1881
- const root = getDocumentElement(element);
1882
- function cleanup() {
1883
- var _io;
1884
- clearTimeout(timeoutId);
1885
- (_io = io) == null || _io.disconnect();
1886
- io = null;
2372
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2373
+ if (includeScale === void 0) {
2374
+ includeScale = false;
1887
2375
  }
1888
- function refresh(skip, threshold) {
1889
- if (skip === void 0) {
1890
- skip = false;
1891
- }
1892
- if (threshold === void 0) {
1893
- threshold = 1;
1894
- }
1895
- cleanup();
1896
- const {
1897
- left,
1898
- top,
1899
- width,
1900
- height
1901
- } = element.getBoundingClientRect();
1902
- if (!skip) {
1903
- onMove();
1904
- }
1905
- if (!width || !height) {
1906
- return;
1907
- }
1908
- const insetTop = floor(top);
1909
- const insetRight = floor(root.clientWidth - (left + width));
1910
- const insetBottom = floor(root.clientHeight - (top + height));
1911
- const insetLeft = floor(left);
1912
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1913
- const options = {
1914
- rootMargin,
1915
- threshold: max(0, min(1, threshold)) || 1
1916
- };
1917
- let isFirstUpdate = true;
1918
- function handleObserve(entries) {
1919
- const ratio = entries[0].intersectionRatio;
1920
- if (ratio !== threshold) {
1921
- if (!isFirstUpdate) {
1922
- return refresh();
1923
- }
1924
- if (!ratio) {
1925
- // If the reference is clipped, the ratio is 0. Throttle the refresh
1926
- // to prevent an infinite loop of updates.
1927
- timeoutId = setTimeout(() => {
1928
- refresh(false, 1e-7);
1929
- }, 1000);
1930
- } else {
1931
- refresh(false, ratio);
1932
- }
2376
+ if (isFixedStrategy === void 0) {
2377
+ isFixedStrategy = false;
2378
+ }
2379
+ const clientRect = element.getBoundingClientRect();
2380
+ const domElement = unwrapElement(element);
2381
+ let scale = createCoords(1);
2382
+ if (includeScale) {
2383
+ if (offsetParent) {
2384
+ if (isElement(offsetParent)) {
2385
+ scale = getScale(offsetParent);
1933
2386
  }
1934
- isFirstUpdate = false;
2387
+ } else {
2388
+ scale = getScale(element);
1935
2389
  }
1936
-
1937
- // Older browsers don't support a `document` as the root and will throw an
1938
- // error.
1939
- try {
1940
- io = new IntersectionObserver(handleObserve, {
1941
- ...options,
1942
- // Handle <iframe>s
1943
- root: root.ownerDocument
1944
- });
1945
- } catch (e) {
1946
- io = new IntersectionObserver(handleObserve, options);
2390
+ }
2391
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2392
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2393
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2394
+ let width = clientRect.width / scale.x;
2395
+ let height = clientRect.height / scale.y;
2396
+ if (domElement) {
2397
+ const win = getWindow(domElement);
2398
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2399
+ let currentWin = win;
2400
+ let currentIFrame = currentWin.frameElement;
2401
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2402
+ const iframeScale = getScale(currentIFrame);
2403
+ const iframeRect = currentIFrame.getBoundingClientRect();
2404
+ const css = getComputedStyle$1(currentIFrame);
2405
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
2406
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
2407
+ x *= iframeScale.x;
2408
+ y *= iframeScale.y;
2409
+ width *= iframeScale.x;
2410
+ height *= iframeScale.y;
2411
+ x += left;
2412
+ y += top;
2413
+ currentWin = getWindow(currentIFrame);
2414
+ currentIFrame = currentWin.frameElement;
1947
2415
  }
1948
- io.observe(element);
1949
2416
  }
1950
- refresh(true);
1951
- return cleanup;
2417
+ return rectToClientRect({
2418
+ width,
2419
+ height,
2420
+ x,
2421
+ y
2422
+ });
1952
2423
  }
1953
2424
 
1954
- /**
1955
- * Automatically updates the position of the floating element when necessary.
1956
- * Should only be called when the floating element is mounted on the DOM or
1957
- * visible on the screen.
1958
- * @returns cleanup function that should be invoked when the floating element is
1959
- * removed from the DOM or hidden from the screen.
1960
- * @see https://floating-ui.com/docs/autoUpdate
1961
- */
1962
- function autoUpdate(reference, floating, update, options) {
1963
- if (options === void 0) {
1964
- options = {};
2425
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2426
+ let {
2427
+ elements,
2428
+ rect,
2429
+ offsetParent,
2430
+ strategy
2431
+ } = _ref;
2432
+ const isFixed = strategy === 'fixed';
2433
+ const documentElement = getDocumentElement(offsetParent);
2434
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2435
+ if (offsetParent === documentElement || topLayer && isFixed) {
2436
+ return rect;
1965
2437
  }
1966
- const {
1967
- ancestorScroll = true,
1968
- ancestorResize = true,
1969
- elementResize = typeof ResizeObserver === 'function',
1970
- layoutShift = typeof IntersectionObserver === 'function',
1971
- animationFrame = false
1972
- } = options;
1973
- const referenceEl = unwrapElement(reference);
1974
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1975
- ancestors.forEach(ancestor => {
1976
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1977
- passive: true
1978
- });
1979
- ancestorResize && ancestor.addEventListener('resize', update);
1980
- });
1981
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1982
- let reobserveFrame = -1;
1983
- let resizeObserver = null;
1984
- if (elementResize) {
1985
- resizeObserver = new ResizeObserver(_ref => {
1986
- let [firstEntry] = _ref;
1987
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1988
- // Prevent update loops when using the `size` middleware.
1989
- // https://github.com/floating-ui/floating-ui/issues/1740
1990
- resizeObserver.unobserve(floating);
1991
- cancelAnimationFrame(reobserveFrame);
1992
- reobserveFrame = requestAnimationFrame(() => {
1993
- var _resizeObserver;
1994
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1995
- });
1996
- }
1997
- update();
1998
- });
1999
- if (referenceEl && !animationFrame) {
2000
- resizeObserver.observe(referenceEl);
2438
+ let scroll = {
2439
+ scrollLeft: 0,
2440
+ scrollTop: 0
2441
+ };
2442
+ let scale = createCoords(1);
2443
+ const offsets = createCoords(0);
2444
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2445
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2446
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2447
+ scroll = getNodeScroll(offsetParent);
2001
2448
  }
2002
- resizeObserver.observe(floating);
2003
- }
2004
- let frameId;
2005
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2006
- if (animationFrame) {
2007
- frameLoop();
2008
- }
2009
- function frameLoop() {
2010
- const nextRefRect = getBoundingClientRect(reference);
2011
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2012
- update();
2449
+ if (isHTMLElement(offsetParent)) {
2450
+ const offsetRect = getBoundingClientRect(offsetParent);
2451
+ scale = getScale(offsetParent);
2452
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2453
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2013
2454
  }
2014
- prevRefRect = nextRefRect;
2015
- frameId = requestAnimationFrame(frameLoop);
2016
2455
  }
2017
- update();
2018
- return () => {
2019
- var _resizeObserver2;
2020
- ancestors.forEach(ancestor => {
2021
- ancestorScroll && ancestor.removeEventListener('scroll', update);
2022
- ancestorResize && ancestor.removeEventListener('resize', update);
2023
- });
2024
- cleanupIo == null || cleanupIo();
2025
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2026
- resizeObserver = null;
2027
- if (animationFrame) {
2028
- cancelAnimationFrame(frameId);
2029
- }
2456
+ return {
2457
+ width: rect.width * scale.x,
2458
+ height: rect.height * scale.y,
2459
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2460
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2030
2461
  };
2031
2462
  }
2032
2463
 
2033
- /**
2034
- * Modifies the placement by translating the floating element along the
2035
- * specified axes.
2036
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
2037
- * object may be passed.
2038
- * @see https://floating-ui.com/docs/offset
2039
- */
2040
- const offset = offset$1;
2041
-
2042
- /**
2043
- * Optimizes the visibility of the floating element by choosing the placement
2044
- * that has the most space available automatically, without needing to specify a
2045
- * preferred placement. Alternative to `flip`.
2046
- * @see https://floating-ui.com/docs/autoPlacement
2047
- */
2048
- autoPlacement;
2049
-
2050
- /**
2051
- * Optimizes the visibility of the floating element by shifting it in order to
2052
- * keep it in view when it will overflow the clipping boundary.
2053
- * @see https://floating-ui.com/docs/shift
2054
- */
2055
- const shift = shift$1;
2464
+ function getClientRects(element) {
2465
+ return Array.from(element.getClientRects());
2466
+ }
2056
2467
 
2057
- /**
2058
- * Optimizes the visibility of the floating element by flipping the `placement`
2059
- * in order to keep it in view when the preferred placement(s) will overflow the
2060
- * clipping boundary. Alternative to `autoPlacement`.
2061
- * @see https://floating-ui.com/docs/flip
2062
- */
2063
- const flip = flip$1;
2468
+ function getWindowScrollBarX(element) {
2469
+ // If <html> has a CSS width greater than the viewport, then this will be
2470
+ // incorrect for RTL.
2471
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2472
+ }
2064
2473
 
2065
- /**
2066
- * Provides data that allows you to change the size of the floating element —
2067
- * for instance, prevent it from overflowing the clipping boundary or match the
2068
- * width of the reference element.
2069
- * @see https://floating-ui.com/docs/size
2070
- */
2071
- const size = size$1;
2474
+ // Gets the entire size of the scrollable document area, even extending outside
2475
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2476
+ function getDocumentRect(element) {
2477
+ const html = getDocumentElement(element);
2478
+ const scroll = getNodeScroll(element);
2479
+ const body = element.ownerDocument.body;
2480
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
2481
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
2482
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2483
+ const y = -scroll.scrollTop;
2484
+ if (getComputedStyle$1(body).direction === 'rtl') {
2485
+ x += max(html.clientWidth, body.clientWidth) - width;
2486
+ }
2487
+ return {
2488
+ width,
2489
+ height,
2490
+ x,
2491
+ y
2492
+ };
2493
+ }
2072
2494
 
2073
- /**
2074
- * Provides data to hide the floating element in applicable situations, such as
2075
- * when it is not in the same clipping context as the reference element.
2076
- * @see https://floating-ui.com/docs/hide
2077
- */
2078
- hide;
2495
+ function getViewportRect(element, strategy) {
2496
+ const win = getWindow(element);
2497
+ const html = getDocumentElement(element);
2498
+ const visualViewport = win.visualViewport;
2499
+ let width = html.clientWidth;
2500
+ let height = html.clientHeight;
2501
+ let x = 0;
2502
+ let y = 0;
2503
+ if (visualViewport) {
2504
+ width = visualViewport.width;
2505
+ height = visualViewport.height;
2506
+ const visualViewportBased = isWebKit();
2507
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
2508
+ x = visualViewport.offsetLeft;
2509
+ y = visualViewport.offsetTop;
2510
+ }
2511
+ }
2512
+ return {
2513
+ width,
2514
+ height,
2515
+ x,
2516
+ y
2517
+ };
2518
+ }
2079
2519
 
2080
- /**
2081
- * Provides data to position an inner element of the floating element so that it
2082
- * appears centered to the reference element.
2083
- * @see https://floating-ui.com/docs/arrow
2084
- */
2085
- const arrow = arrow$1;
2520
+ // Returns the inner client rect, subtracting scrollbars if present.
2521
+ function getInnerBoundingClientRect(element, strategy) {
2522
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
2523
+ const top = clientRect.top + element.clientTop;
2524
+ const left = clientRect.left + element.clientLeft;
2525
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2526
+ const width = element.clientWidth * scale.x;
2527
+ const height = element.clientHeight * scale.y;
2528
+ const x = left * scale.x;
2529
+ const y = top * scale.y;
2530
+ return {
2531
+ width,
2532
+ height,
2533
+ x,
2534
+ y
2535
+ };
2536
+ }
2537
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2538
+ let rect;
2539
+ if (clippingAncestor === 'viewport') {
2540
+ rect = getViewportRect(element, strategy);
2541
+ } else if (clippingAncestor === 'document') {
2542
+ rect = getDocumentRect(getDocumentElement(element));
2543
+ } else if (isElement(clippingAncestor)) {
2544
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2545
+ } else {
2546
+ const visualOffsets = getVisualOffsets(element);
2547
+ rect = {
2548
+ ...clippingAncestor,
2549
+ x: clippingAncestor.x - visualOffsets.x,
2550
+ y: clippingAncestor.y - visualOffsets.y
2551
+ };
2552
+ }
2553
+ return rectToClientRect(rect);
2554
+ }
2555
+ function hasFixedPositionAncestor(element, stopNode) {
2556
+ const parentNode = getParentNode(element);
2557
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
2558
+ return false;
2559
+ }
2560
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
2561
+ }
2086
2562
 
2087
- /**
2088
- * Provides improved positioning for inline reference elements that can span
2089
- * over multiple lines, such as hyperlinks or range selections.
2090
- * @see https://floating-ui.com/docs/inline
2091
- */
2092
- const inline = inline$1;
2563
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
2564
+ // clipping (or hiding) child elements. This returns all clipping ancestors
2565
+ // of the given element up the tree.
2566
+ function getClippingElementAncestors(element, cache) {
2567
+ const cachedResult = cache.get(element);
2568
+ if (cachedResult) {
2569
+ return cachedResult;
2570
+ }
2571
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
2572
+ let currentContainingBlockComputedStyle = null;
2573
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
2574
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
2093
2575
 
2094
- /**
2095
- * Built-in `limiter` that will stop `shift()` at a certain point.
2096
- */
2097
- const limitShift = limitShift$1;
2576
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2577
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2578
+ const computedStyle = getComputedStyle$1(currentNode);
2579
+ const currentNodeIsContaining = isContainingBlock(currentNode);
2580
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
2581
+ currentContainingBlockComputedStyle = null;
2582
+ }
2583
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2584
+ if (shouldDropCurrentNode) {
2585
+ // Drop non-containing blocks.
2586
+ result = result.filter(ancestor => ancestor !== currentNode);
2587
+ } else {
2588
+ // Record last containing block for next iteration.
2589
+ currentContainingBlockComputedStyle = computedStyle;
2590
+ }
2591
+ currentNode = getParentNode(currentNode);
2592
+ }
2593
+ cache.set(element, result);
2594
+ return result;
2595
+ }
2098
2596
 
2099
- /**
2100
- * Computes the `x` and `y` coordinates that will place the floating element
2101
- * next to a given reference element.
2102
- */
2103
- const computePosition = (reference, floating, options) => {
2104
- // This caches the expensive `getClippingElementAncestors` function so that
2105
- // multiple lifecycle resets re-use the same result. It only lives for a
2106
- // single call. If other functions become expensive, we can add them as well.
2107
- const cache = new Map();
2108
- const mergedOptions = {
2109
- platform,
2110
- ...options
2597
+ // Gets the maximum area that the element is visible in due to any number of
2598
+ // clipping ancestors.
2599
+ function getClippingRect(_ref) {
2600
+ let {
2601
+ element,
2602
+ boundary,
2603
+ rootBoundary,
2604
+ strategy
2605
+ } = _ref;
2606
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
2607
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2608
+ const firstClippingAncestor = clippingAncestors[0];
2609
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2610
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2611
+ accRect.top = max(rect.top, accRect.top);
2612
+ accRect.right = min(rect.right, accRect.right);
2613
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2614
+ accRect.left = max(rect.left, accRect.left);
2615
+ return accRect;
2616
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2617
+ return {
2618
+ width: clippingRect.right - clippingRect.left,
2619
+ height: clippingRect.bottom - clippingRect.top,
2620
+ x: clippingRect.left,
2621
+ y: clippingRect.top
2111
2622
  };
2112
- const platformWithCache = {
2113
- ...mergedOptions.platform,
2114
- _c: cache
2623
+ }
2624
+
2625
+ function getDimensions(element) {
2626
+ const {
2627
+ width,
2628
+ height
2629
+ } = getCssDimensions(element);
2630
+ return {
2631
+ width,
2632
+ height
2115
2633
  };
2116
- return computePosition$1(reference, floating, {
2117
- ...mergedOptions,
2118
- platform: platformWithCache
2119
- });
2120
- };
2634
+ }
2121
2635
 
2122
- (()=>{var c=class extends Event{oldState;newState;constructor(t,{oldState:o="",newState:r="",...i}={}){super(t,i),this.oldState=String(o||""),this.newState=String(r||"");}},R=new WeakMap;function A(e,t,o){R.set(e,setTimeout(()=>{R.has(e)&&e.dispatchEvent(new c("toggle",{cancelable:!1,oldState:t,newState:o}));},0));}var D=globalThis.ShadowRoot||function(){},z=globalThis.HTMLDialogElement||function(){},M=new WeakMap,p=new WeakMap,h=new WeakMap;function L(e){return h.get(e)||"hidden"}var b=new WeakMap;function O(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let o=L(t);e.popoverTargetAction==="show"&&o==="showing"||e.popoverTargetAction==="hide"&&o==="hidden"||(o==="showing"?m(t,!0,!0):d(t,!1)&&(b.set(t,e),S(t)));}function d(e,t){return !(e.popover!=="auto"&&e.popover!=="manual"||!e.isConnected||t&&L(e)!=="showing"||!t&&L(e)!=="hidden"||e instanceof z&&e.hasAttribute("open")||document.fullscreenElement===e)}function N(e){return e?Array.from(p.get(e.ownerDocument)||[]).indexOf(e)+1:0}function V(e){let t=W(e),o=U(e);return N(t)>N(o)?t:o}function y(e){let t=p.get(e);for(let o of t||[])if(!o.isConnected)t.delete(o);else return o;return null}function v(e){return typeof e.getRootNode=="function"?e.getRootNode():e.parentNode?v(e.parentNode):e}function W(e){for(;e;){if(e instanceof HTMLElement&&e.popover==="auto"&&h.get(e)==="showing")return e;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function U(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function G(e){let t=new Map,o=0,r=e.ownerDocument;for(let a of p.get(r)||[])t.set(a,o),o+=1;t.set(e,o),o+=1;let i=null;function l(a){let g=W(a);if(g===null)return null;let n=t.get(g);(i===null||t.get(i)<n)&&(i=g);}return l(e?.parentElement),i}function Q(e){return e.hidden||e instanceof D||(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:typeof e.tabIndex=="number"&&e.tabIndex!==-1}function _(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 l=t.querySelectorAll("slot");for(let a of l){let g=a.assignedElements({flatten:!0});for(let n of g){if(n.hasAttribute("autofocus"))return n;if(o=n.querySelector("[autofocus]"),o)return o}}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(Q(i))return i;i=r.nextNode();}}function $(e){_(e)?.focus();}var H=new WeakMap;function S(e){if(!d(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new c("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!d(e,!1))return;let o=!1;if(e.popover==="auto"){let i=e.getAttribute("popover"),l=G(e)||t;if(T(l,!1,!0),i!==e.getAttribute("popover")||!d(e,!1))return}y(t)||(o=!0),H.delete(e);let r=t.activeElement;e.classList.add(":popover-open"),h.set(e,"showing"),M.has(t)||M.set(t,new Set),M.get(t).add(e),$(e),e.popover==="auto"&&(p.has(t)||p.set(t,new Set),p.get(t).add(e),q(b.get(e),!0)),o&&r&&e.popover==="auto"&&H.set(e,r),A(e,"closed","open");}function m(e,t=!1,o=!1){if(!d(e,!0))return;let r=e.ownerDocument;if(e.popover==="auto"&&(T(e,t,o),!d(e,!0))||(q(b.get(e),!1),b.delete(e),o&&(e.dispatchEvent(new c("beforetoggle",{oldState:"open",newState:"closed"})),!d(e,!0))))return;M.get(r)?.delete(e),p.get(r)?.delete(e),e.classList.remove(":popover-open"),h.set(e,"hidden"),o&&A(e,"open","closed");let i=H.get(e);i&&(H.delete(e),t&&i.focus());}function F(e,t=!1,o=!1){let r=y(e);for(;r;)m(r,t,o),r=y(e);}function T(e,t,o){let r=e.ownerDocument||e;if(e instanceof Document)return F(r,t,o);let i=null,l=!1;for(let a of p.get(r)||[])if(a===e)l=!0;else if(l){i=a;break}if(!l)return F(r,t,o);for(;i&&L(i)==="showing"&&p.get(r)?.size;)m(i,t,o);}var P=new WeakMap;function x(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let o=t.ownerDocument;if(!y(o))return;let i=V(t);if(i&&e.type==="pointerdown")P.set(o,i);else if(e.type==="pointerup"){let l=P.get(o)===i;P.delete(o),l&&T(i||o,!1,!0);}}var k=new WeakMap;function q(e,t=!1){if(!e)return;k.has(e)||k.set(e,e.getAttribute("aria-expanded"));let o=e.popoverTargetElement;if(o instanceof HTMLElement&&o.popover==="auto")e.setAttribute("aria-expanded",String(t));else {let r=k.get(e);r?e.setAttribute("aria-expanded",r):e.removeAttribute("aria-expanded");}}var B=globalThis.ShadowRoot||function(){};function j(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function f(e,t,o){let r=e[t];Object.defineProperty(e,t,{value(i){return r.call(this,o(i))}});}var J=/(^|[^\\]):popover-open\b/g,C=`
2123
- :where([popover]) {
2124
- position: fixed;
2125
- z-index: 2147483647;
2126
- inset: 0;
2127
- padding: 0.25em;
2128
- width: fit-content;
2129
- height: fit-content;
2130
- border-width: initial;
2131
- border-color: initial;
2132
- border-image: initial;
2133
- border-style: solid;
2134
- background-color: canvas;
2135
- color: canvastext;
2136
- overflow: auto;
2137
- margin: auto;
2636
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2637
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2638
+ const documentElement = getDocumentElement(offsetParent);
2639
+ const isFixed = strategy === 'fixed';
2640
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2641
+ let scroll = {
2642
+ scrollLeft: 0,
2643
+ scrollTop: 0
2644
+ };
2645
+ const offsets = createCoords(0);
2646
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2647
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2648
+ scroll = getNodeScroll(offsetParent);
2649
+ }
2650
+ if (isOffsetParentAnElement) {
2651
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2652
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2653
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2654
+ } else if (documentElement) {
2655
+ offsets.x = getWindowScrollBarX(documentElement);
2656
+ }
2138
2657
  }
2658
+ const x = rect.left + scroll.scrollLeft - offsets.x;
2659
+ const y = rect.top + scroll.scrollTop - offsets.y;
2660
+ return {
2661
+ x,
2662
+ y,
2663
+ width: rect.width,
2664
+ height: rect.height
2665
+ };
2666
+ }
2139
2667
 
2140
- :where(dialog[popover][open]) {
2141
- display: revert;
2142
- }
2668
+ function isStaticPositioned(element) {
2669
+ return getComputedStyle$1(element).position === 'static';
2670
+ }
2143
2671
 
2144
- :where([anchor].\\:popover-open) {
2145
- inset: auto;
2672
+ function getTrueOffsetParent(element, polyfill) {
2673
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
2674
+ return null;
2146
2675
  }
2147
-
2148
- :where([anchor]:popover-open) {
2149
- inset: auto;
2676
+ if (polyfill) {
2677
+ return polyfill(element);
2150
2678
  }
2679
+ return element.offsetParent;
2680
+ }
2151
2681
 
2152
- @supports not (background-color: canvas) {
2153
- :where([popover]) {
2154
- background-color: white;
2155
- color: black;
2156
- }
2682
+ // Gets the closest ancestor positioned element. Handles some edge cases,
2683
+ // such as table ancestors and cross browser bugs.
2684
+ function getOffsetParent(element, polyfill) {
2685
+ const win = getWindow(element);
2686
+ if (isTopLayer(element)) {
2687
+ return win;
2157
2688
  }
2158
-
2159
- @supports (width: -moz-fit-content) {
2160
- :where([popover]) {
2161
- width: -moz-fit-content;
2162
- height: -moz-fit-content;
2689
+ if (!isHTMLElement(element)) {
2690
+ let svgOffsetParent = getParentNode(element);
2691
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
2692
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
2693
+ return svgOffsetParent;
2694
+ }
2695
+ svgOffsetParent = getParentNode(svgOffsetParent);
2163
2696
  }
2697
+ return win;
2164
2698
  }
2165
-
2166
- @supports not (inset: 0) {
2167
- :where([popover]) {
2168
- top: 0;
2169
- left: 0;
2170
- right: 0;
2171
- bottom: 0;
2172
- }
2699
+ let offsetParent = getTrueOffsetParent(element, polyfill);
2700
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
2701
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2173
2702
  }
2174
-
2175
- :where([popover]:not(.\\:popover-open)) {
2176
- display: none;
2703
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
2704
+ return win;
2177
2705
  }
2178
- `,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(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(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.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=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||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);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
2179
-
2180
- const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){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:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
2181
- const PostPopovercontainerStyle0 = postPopovercontainerCss;
2706
+ return offsetParent || getContainingBlock(element) || win;
2707
+ }
2182
2708
 
2183
- const SIDE_MAP = {
2184
- top: 'bottom',
2185
- right: 'left',
2186
- bottom: 'top',
2187
- left: 'right',
2188
- };
2189
- const PostPopovercontainer = class {
2190
- constructor(hostRef) {
2191
- index.registerInstance(this, hostRef);
2192
- this.postToggle = index.createEvent(this, "postToggle", 7);
2193
- this.placement = 'top';
2194
- this.edgeGap = 8;
2195
- this.arrow = false;
2196
- }
2197
- componentDidLoad() {
2198
- this.host.setAttribute('popover', '');
2199
- this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
2200
- }
2201
- disconnectedCallback() {
2202
- if (typeof this.clearAutoUpdate === 'function')
2203
- this.clearAutoUpdate();
2204
- }
2205
- /**
2206
- * Programmatically display the tooltip
2207
- * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
2208
- */
2209
- async show(target) {
2210
- if (!this.toggleTimeoutId) {
2211
- this.eventTarget = target;
2212
- this.calculatePosition();
2213
- this.host.showPopover();
2214
- }
2709
+ const getElementRects = async function (data) {
2710
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2711
+ const getDimensionsFn = this.getDimensions;
2712
+ const floatingDimensions = await getDimensionsFn(data.floating);
2713
+ return {
2714
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2715
+ floating: {
2716
+ x: 0,
2717
+ y: 0,
2718
+ width: floatingDimensions.width,
2719
+ height: floatingDimensions.height
2215
2720
  }
2216
- /**
2217
- * Programmatically hide this tooltip
2218
- */
2219
- async hide() {
2220
- if (!this.toggleTimeoutId) {
2221
- this.eventTarget = null;
2222
- this.host.hidePopover();
2223
- }
2721
+ };
2722
+ };
2723
+
2724
+ function isRTL(element) {
2725
+ return getComputedStyle$1(element).direction === 'rtl';
2726
+ }
2727
+
2728
+ const platform = {
2729
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2730
+ getDocumentElement,
2731
+ getClippingRect,
2732
+ getOffsetParent,
2733
+ getElementRects,
2734
+ getClientRects,
2735
+ getDimensions,
2736
+ getScale,
2737
+ isElement,
2738
+ isRTL
2739
+ };
2740
+
2741
+ // https://samthor.au/2021/observing-dom/
2742
+ function observeMove(element, onMove) {
2743
+ let io = null;
2744
+ let timeoutId;
2745
+ const root = getDocumentElement(element);
2746
+ function cleanup() {
2747
+ var _io;
2748
+ clearTimeout(timeoutId);
2749
+ (_io = io) == null || _io.disconnect();
2750
+ io = null;
2751
+ }
2752
+ function refresh(skip, threshold) {
2753
+ if (skip === void 0) {
2754
+ skip = false;
2224
2755
  }
2225
- /**
2226
- * Toggle tooltip display
2227
- * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
2228
- * @param force Pass true to always show or false to always hide
2229
- */
2230
- async toggle(target, force) {
2231
- // Prevent instant double toggle
2232
- if (!this.toggleTimeoutId) {
2233
- this.eventTarget = target;
2234
- this.calculatePosition();
2235
- this.host.togglePopover(force);
2236
- this.toggleTimeoutId = null;
2237
- }
2238
- return this.host.matches(':where(:popover-open, .popover-open');
2756
+ if (threshold === void 0) {
2757
+ threshold = 1;
2239
2758
  }
2240
- /**
2241
- * Start or stop auto updates based on tooltip events.
2242
- * Tooltips can be closed or opened with other methods than class members,
2243
- * therefore listening to the toggle event is safer for cleaning up.
2244
- * @param e ToggleEvent
2245
- */
2246
- handleToggle(e) {
2247
- this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
2248
- const isOpen = e.newState === 'open';
2249
- if (isOpen) {
2250
- this.startAutoupdates();
2251
- }
2252
- else {
2253
- if (typeof this.clearAutoUpdate === 'function')
2254
- this.clearAutoUpdate();
2255
- }
2256
- this.postToggle.emit(isOpen);
2759
+ cleanup();
2760
+ const {
2761
+ left,
2762
+ top,
2763
+ width,
2764
+ height
2765
+ } = element.getBoundingClientRect();
2766
+ if (!skip) {
2767
+ onMove();
2257
2768
  }
2258
- /**
2259
- * Start listening for DOM updates, scroll events etc. that have
2260
- * an influence on tooltip positioning
2261
- */
2262
- startAutoupdates() {
2263
- this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
2769
+ if (!width || !height) {
2770
+ return;
2264
2771
  }
2265
- async calculatePosition() {
2266
- const gap = this.edgeGap;
2267
- const middleware = [
2268
- flip(),
2269
- inline(),
2270
- shift({
2271
- padding: gap,
2272
- // Prevents shifting away from the anchor too far, while shifting as far as possible
2273
- // https://floating-ui.com/docs/shift#limiter
2274
- limiter: limitShift({
2275
- offset: 32,
2276
- }),
2277
- }),
2278
- size({
2279
- apply({ availableWidth, elements }) {
2280
- Object.assign(elements.floating.style, {
2281
- maxWidth: `${availableWidth - gap * 2}px`,
2282
- });
2283
- },
2284
- }),
2285
- offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
2286
- ];
2287
- if (this.arrow) {
2288
- middleware.push(arrow({ element: this.arrowRef, padding: gap }));
2772
+ const insetTop = floor(top);
2773
+ const insetRight = floor(root.clientWidth - (left + width));
2774
+ const insetBottom = floor(root.clientHeight - (top + height));
2775
+ const insetLeft = floor(left);
2776
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2777
+ const options = {
2778
+ rootMargin,
2779
+ threshold: max(0, min(1, threshold)) || 1
2780
+ };
2781
+ let isFirstUpdate = true;
2782
+ function handleObserve(entries) {
2783
+ const ratio = entries[0].intersectionRatio;
2784
+ if (ratio !== threshold) {
2785
+ if (!isFirstUpdate) {
2786
+ return refresh();
2289
2787
  }
2290
- const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
2291
- placement: this.placement || 'top',
2292
- strategy: 'fixed',
2293
- middleware,
2294
- });
2295
- // Tooltip
2296
- this.host.style.left = `${x}px`;
2297
- this.host.style.top = `${y}px`;
2298
- // Arrow
2299
- if (this.arrow) {
2300
- // Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
2301
- const side = currentPlacement.split('-')[0];
2302
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
2303
- const staticSide = SIDE_MAP[side];
2304
- const offsetBorderLineJoin = 2;
2305
- Object.assign(this.arrowRef.style, {
2306
- top: arrowY ? `${arrowY}px` : '',
2307
- left: arrowX ? `${arrowX}px` : '',
2308
- [staticSide]: `${-this.arrowRef.offsetWidth / 2 - offsetBorderLineJoin}px`,
2309
- });
2310
- // Add position as a class to be able to style arrow for HCM
2311
- this.arrowRef.classList.remove(...Object.values(SIDE_MAP));
2312
- this.arrowRef.classList.add(staticSide);
2788
+ if (!ratio) {
2789
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
2790
+ // to prevent an infinite loop of updates.
2791
+ timeoutId = setTimeout(() => {
2792
+ refresh(false, 1e-7);
2793
+ }, 1000);
2794
+ } else {
2795
+ refresh(false, ratio);
2313
2796
  }
2797
+ }
2798
+ isFirstUpdate = false;
2314
2799
  }
2315
- render() {
2316
- return (index.h(index.Host, { key: 'b8be8594adfd503c47f85872508d5bbd3473cc5a', "data-version": _package.version }, this.arrow && (index.h("span", { key: 'f046737966eb3b801af1e888555178543ea015eb', class: "arrow", ref: el => {
2317
- this.arrowRef = el;
2318
- } })), index.h("slot", { key: '5d478472a83442d47e4f16ff8121782c8e6a524b' })));
2319
- }
2320
- get host() { return index.getElement(this); }
2321
- };
2322
- PostPopovercontainer.style = PostPopovercontainerStyle0;
2323
-
2324
- const postListCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-list{display:flex;gap:var(--post-list-title-gap);flex-direction:column;align-items:flex-start}post-list>div[role=list]{flex-direction:column;display:flex;gap:var(--post-list-item-gap)}post-list[horizontal]:not([horizontal=false]){flex-direction:row;align-items:baseline}post-list[horizontal]:not([horizontal=false])>div[role=list]{flex-direction:row;align-items:center}post-list>.list-title.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}post-list>.list-title.visually-hidden:not(caption){position:absolute !important}";
2325
- const PostListStyle0 = postListCss;
2326
2800
 
2327
- const PostList = class {
2328
- constructor(hostRef) {
2329
- index.registerInstance(this, hostRef);
2330
- this.titleId = undefined;
2331
- this.titleHidden = false;
2332
- this.horizontal = false;
2333
- }
2334
- componentWillLoad() {
2335
- /**
2336
- * Get the id set on the host element or use a random id by default
2337
- */
2338
- this.titleId = `list-${crypto.randomUUID()}`;
2339
- }
2340
- componentDidLoad() {
2341
- this.checkTitle();
2801
+ // Older browsers don't support a `document` as the root and will throw an
2802
+ // error.
2803
+ try {
2804
+ io = new IntersectionObserver(handleObserve, {
2805
+ ...options,
2806
+ // Handle <iframe>s
2807
+ root: root.ownerDocument
2808
+ });
2809
+ } catch (e) {
2810
+ io = new IntersectionObserver(handleObserve, options);
2342
2811
  }
2343
- checkTitle() {
2344
- if (!this.titleEl.textContent.trim()) {
2345
- throw new Error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
2346
- }
2812
+ io.observe(element);
2813
+ }
2814
+ refresh(true);
2815
+ return cleanup;
2816
+ }
2817
+
2818
+ /**
2819
+ * Automatically updates the position of the floating element when necessary.
2820
+ * Should only be called when the floating element is mounted on the DOM or
2821
+ * visible on the screen.
2822
+ * @returns cleanup function that should be invoked when the floating element is
2823
+ * removed from the DOM or hidden from the screen.
2824
+ * @see https://floating-ui.com/docs/autoUpdate
2825
+ */
2826
+ function autoUpdate(reference, floating, update, options) {
2827
+ if (options === void 0) {
2828
+ options = {};
2829
+ }
2830
+ const {
2831
+ ancestorScroll = true,
2832
+ ancestorResize = true,
2833
+ elementResize = typeof ResizeObserver === 'function',
2834
+ layoutShift = typeof IntersectionObserver === 'function',
2835
+ animationFrame = false
2836
+ } = options;
2837
+ const referenceEl = unwrapElement(reference);
2838
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
2839
+ ancestors.forEach(ancestor => {
2840
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
2841
+ passive: true
2842
+ });
2843
+ ancestorResize && ancestor.addEventListener('resize', update);
2844
+ });
2845
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2846
+ let reobserveFrame = -1;
2847
+ let resizeObserver = null;
2848
+ if (elementResize) {
2849
+ resizeObserver = new ResizeObserver(_ref => {
2850
+ let [firstEntry] = _ref;
2851
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2852
+ // Prevent update loops when using the `size` middleware.
2853
+ // https://github.com/floating-ui/floating-ui/issues/1740
2854
+ resizeObserver.unobserve(floating);
2855
+ cancelAnimationFrame(reobserveFrame);
2856
+ reobserveFrame = requestAnimationFrame(() => {
2857
+ var _resizeObserver;
2858
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2859
+ });
2860
+ }
2861
+ update();
2862
+ });
2863
+ if (referenceEl && !animationFrame) {
2864
+ resizeObserver.observe(referenceEl);
2347
2865
  }
2348
- render() {
2349
- return (index.h(index.Host, { key: '017f05c43fa95bb93c856bbeddd5d26cbc2f4cfa', "data-version": _package.version }, index.h("div", { key: '71fd7d32c761cecf7b4d5d5f39cedb3bf668a0cb', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, index.h("slot", { key: 'fe0e03d5d25f6a975e04be00549facae49a0970b' })), index.h("div", { key: 'bb717e4338396c86fa28dbf8236f5f185823f9be', role: "list", "aria-labelledby": this.titleId }, index.h("slot", { key: '7fd25cab433f5fbbafaa7ca01f42774823cbf579', name: "post-list-item" }))));
2866
+ resizeObserver.observe(floating);
2867
+ }
2868
+ let frameId;
2869
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2870
+ if (animationFrame) {
2871
+ frameLoop();
2872
+ }
2873
+ function frameLoop() {
2874
+ const nextRefRect = getBoundingClientRect(reference);
2875
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2876
+ update();
2350
2877
  }
2351
- get host() { return index.getElement(this); }
2352
- };
2353
- PostList.style = PostListStyle0;
2878
+ prevRefRect = nextRefRect;
2879
+ frameId = requestAnimationFrame(frameLoop);
2880
+ }
2881
+ update();
2882
+ return () => {
2883
+ var _resizeObserver2;
2884
+ ancestors.forEach(ancestor => {
2885
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
2886
+ ancestorResize && ancestor.removeEventListener('resize', update);
2887
+ });
2888
+ cleanupIo == null || cleanupIo();
2889
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2890
+ resizeObserver = null;
2891
+ if (animationFrame) {
2892
+ cancelAnimationFrame(frameId);
2893
+ }
2894
+ };
2895
+ }
2354
2896
 
2355
- const postListItemCss = ":host{display:flex}";
2356
- const PostListItemStyle0 = postListItemCss;
2897
+ /**
2898
+ * Modifies the placement by translating the floating element along the
2899
+ * specified axes.
2900
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2901
+ * object may be passed.
2902
+ * @see https://floating-ui.com/docs/offset
2903
+ */
2904
+ const offset = offset$1;
2357
2905
 
2358
- const PostListItem = class {
2359
- constructor(hostRef) {
2360
- index.registerInstance(this, hostRef);
2361
- }
2362
- connectedCallback() {
2363
- this.host.setAttribute('slot', 'post-list-item');
2364
- }
2365
- render() {
2366
- return (index.h(index.Host, { key: 'bbf12424f2997b7d2e7cd9e272def0bf2838f94f', role: "listitem" }, index.h("slot", { key: '2ce4e71879485f16ad90dfddbd1b79512107bdb0' })));
2367
- }
2368
- get host() { return index.getElement(this); }
2369
- };
2370
- PostListItem.style = PostListItemStyle0;
2906
+ /**
2907
+ * Optimizes the visibility of the floating element by choosing the placement
2908
+ * that has the most space available automatically, without needing to specify a
2909
+ * preferred placement. Alternative to `flip`.
2910
+ * @see https://floating-ui.com/docs/autoPlacement
2911
+ */
2912
+ autoPlacement;
2371
2913
 
2372
- /* eslint-disable no-undefined,no-param-reassign,no-shadow */
2914
+ /**
2915
+ * Optimizes the visibility of the floating element by shifting it in order to
2916
+ * keep it in view when it will overflow the clipping boundary.
2917
+ * @see https://floating-ui.com/docs/shift
2918
+ */
2919
+ const shift = shift$1;
2373
2920
 
2374
2921
  /**
2375
- * Throttle execution of a function. Especially useful for rate limiting
2376
- * execution of handlers on events like resize and scroll.
2377
- *
2378
- * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
2379
- * are most useful.
2380
- * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
2381
- * as-is, to `callback` when the throttled-function is executed.
2382
- * @param {object} [options] - An object to configure options.
2383
- * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
2384
- * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
2385
- * one final time after the last throttled-function call. (After the throttled-function has not been called for
2386
- * `delay` milliseconds, the internal counter is reset).
2387
- * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
2388
- * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
2389
- * callback will never executed if both noLeading = true and noTrailing = true.
2390
- * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
2391
- * false (at end), schedule `callback` to execute after `delay` ms.
2392
- *
2393
- * @returns {Function} A new, throttled, function.
2922
+ * Optimizes the visibility of the floating element by flipping the `placement`
2923
+ * in order to keep it in view when the preferred placement(s) will overflow the
2924
+ * clipping boundary. Alternative to `autoPlacement`.
2925
+ * @see https://floating-ui.com/docs/flip
2394
2926
  */
2395
- function throttle (delay, callback, options) {
2396
- var _ref = options || {},
2397
- _ref$noTrailing = _ref.noTrailing,
2398
- noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
2399
- _ref$noLeading = _ref.noLeading,
2400
- noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
2401
- _ref$debounceMode = _ref.debounceMode,
2402
- debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
2403
- /*
2404
- * After wrapper has stopped being called, this timeout ensures that
2405
- * `callback` is executed at the proper times in `throttle` and `end`
2406
- * debounce modes.
2407
- */
2408
- var timeoutID;
2409
- var cancelled = false;
2927
+ const flip = flip$1;
2410
2928
 
2411
- // Keep track of the last time `callback` was executed.
2412
- var lastExec = 0;
2929
+ /**
2930
+ * Provides data that allows you to change the size of the floating element —
2931
+ * for instance, prevent it from overflowing the clipping boundary or match the
2932
+ * width of the reference element.
2933
+ * @see https://floating-ui.com/docs/size
2934
+ */
2935
+ const size = size$1;
2413
2936
 
2414
- // Function to clear existing timeout
2415
- function clearExistingTimeout() {
2416
- if (timeoutID) {
2417
- clearTimeout(timeoutID);
2418
- }
2419
- }
2937
+ /**
2938
+ * Provides data to hide the floating element in applicable situations, such as
2939
+ * when it is not in the same clipping context as the reference element.
2940
+ * @see https://floating-ui.com/docs/hide
2941
+ */
2942
+ hide;
2420
2943
 
2421
- // Function to cancel next exec
2422
- function cancel(options) {
2423
- var _ref2 = options || {},
2424
- _ref2$upcomingOnly = _ref2.upcomingOnly,
2425
- upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
2426
- clearExistingTimeout();
2427
- cancelled = !upcomingOnly;
2428
- }
2944
+ /**
2945
+ * Provides data to position an inner element of the floating element so that it
2946
+ * appears centered to the reference element.
2947
+ * @see https://floating-ui.com/docs/arrow
2948
+ */
2949
+ const arrow = arrow$1;
2429
2950
 
2430
- /*
2431
- * The `wrapper` function encapsulates all of the throttling / debouncing
2432
- * functionality and when executed will limit the rate at which `callback`
2433
- * is executed.
2434
- */
2435
- function wrapper() {
2436
- for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
2437
- arguments_[_key] = arguments[_key];
2438
- }
2439
- var self = this;
2440
- var elapsed = Date.now() - lastExec;
2441
- if (cancelled) {
2442
- return;
2443
- }
2951
+ /**
2952
+ * Provides improved positioning for inline reference elements that can span
2953
+ * over multiple lines, such as hyperlinks or range selections.
2954
+ * @see https://floating-ui.com/docs/inline
2955
+ */
2956
+ const inline = inline$1;
2444
2957
 
2445
- // Execute `callback` and update the `lastExec` timestamp.
2446
- function exec() {
2447
- lastExec = Date.now();
2448
- callback.apply(self, arguments_);
2449
- }
2958
+ /**
2959
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2960
+ */
2961
+ const limitShift = limitShift$1;
2450
2962
 
2451
- /*
2452
- * If `debounceMode` is true (at begin) this is used to clear the flag
2453
- * to allow future `callback` executions.
2454
- */
2455
- function clear() {
2456
- timeoutID = undefined;
2457
- }
2458
- if (!noLeading && debounceMode && !timeoutID) {
2459
- /*
2460
- * Since `wrapper` is being called for the first time and
2461
- * `debounceMode` is true (at begin), execute `callback`
2462
- * and noLeading != true.
2463
- */
2464
- exec();
2465
- }
2466
- clearExistingTimeout();
2467
- if (debounceMode === undefined && elapsed > delay) {
2468
- if (noLeading) {
2469
- /*
2470
- * In throttle mode with noLeading, if `delay` time has
2471
- * been exceeded, update `lastExec` and schedule `callback`
2472
- * to execute after `delay` ms.
2473
- */
2474
- lastExec = Date.now();
2475
- if (!noTrailing) {
2476
- timeoutID = setTimeout(debounceMode ? clear : exec, delay);
2477
- }
2478
- } else {
2479
- /*
2480
- * In throttle mode without noLeading, if `delay` time has been exceeded, execute
2481
- * `callback`.
2482
- */
2483
- exec();
2484
- }
2485
- } else if (noTrailing !== true) {
2486
- /*
2487
- * In trailing throttle mode, since `delay` time has not been
2488
- * exceeded, schedule `callback` to execute `delay` ms after most
2489
- * recent execution.
2490
- *
2491
- * If `debounceMode` is true (at begin), schedule `clear` to execute
2492
- * after `delay` ms.
2493
- *
2494
- * If `debounceMode` is false (at end), schedule `callback` to
2495
- * execute after `delay` ms.
2496
- */
2497
- timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
2498
- }
2963
+ /**
2964
+ * Computes the `x` and `y` coordinates that will place the floating element
2965
+ * next to a given reference element.
2966
+ */
2967
+ const computePosition = (reference, floating, options) => {
2968
+ // This caches the expensive `getClippingElementAncestors` function so that
2969
+ // multiple lifecycle resets re-use the same result. It only lives for a
2970
+ // single call. If other functions become expensive, we can add them as well.
2971
+ const cache = new Map();
2972
+ const mergedOptions = {
2973
+ platform,
2974
+ ...options
2975
+ };
2976
+ const platformWithCache = {
2977
+ ...mergedOptions.platform,
2978
+ _c: cache
2979
+ };
2980
+ return computePosition$1(reference, floating, {
2981
+ ...mergedOptions,
2982
+ platform: platformWithCache
2983
+ });
2984
+ };
2985
+
2986
+ (()=>{var c=class extends Event{oldState;newState;constructor(t,{oldState:o="",newState:r="",...i}={}){super(t,i),this.oldState=String(o||""),this.newState=String(r||"");}},R=new WeakMap;function A(e,t,o){R.set(e,setTimeout(()=>{R.has(e)&&e.dispatchEvent(new c("toggle",{cancelable:!1,oldState:t,newState:o}));},0));}var D=globalThis.ShadowRoot||function(){},z=globalThis.HTMLDialogElement||function(){},M=new WeakMap,p=new WeakMap,h=new WeakMap;function L(e){return h.get(e)||"hidden"}var b=new WeakMap;function O(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let o=L(t);e.popoverTargetAction==="show"&&o==="showing"||e.popoverTargetAction==="hide"&&o==="hidden"||(o==="showing"?m(t,!0,!0):d(t,!1)&&(b.set(t,e),S(t)));}function d(e,t){return !(e.popover!=="auto"&&e.popover!=="manual"||!e.isConnected||t&&L(e)!=="showing"||!t&&L(e)!=="hidden"||e instanceof z&&e.hasAttribute("open")||document.fullscreenElement===e)}function N(e){return e?Array.from(p.get(e.ownerDocument)||[]).indexOf(e)+1:0}function V(e){let t=W(e),o=U(e);return N(t)>N(o)?t:o}function y(e){let t=p.get(e);for(let o of t||[])if(!o.isConnected)t.delete(o);else return o;return null}function v(e){return typeof e.getRootNode=="function"?e.getRootNode():e.parentNode?v(e.parentNode):e}function W(e){for(;e;){if(e instanceof HTMLElement&&e.popover==="auto"&&h.get(e)==="showing")return e;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function U(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function G(e){let t=new Map,o=0,r=e.ownerDocument;for(let a of p.get(r)||[])t.set(a,o),o+=1;t.set(e,o),o+=1;let i=null;function l(a){let g=W(a);if(g===null)return null;let n=t.get(g);(i===null||t.get(i)<n)&&(i=g);}return l(e?.parentElement),i}function Q(e){return e.hidden||e instanceof D||(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:typeof e.tabIndex=="number"&&e.tabIndex!==-1}function _(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 l=t.querySelectorAll("slot");for(let a of l){let g=a.assignedElements({flatten:!0});for(let n of g){if(n.hasAttribute("autofocus"))return n;if(o=n.querySelector("[autofocus]"),o)return o}}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(Q(i))return i;i=r.nextNode();}}function $(e){_(e)?.focus();}var H=new WeakMap;function S(e){if(!d(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new c("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!d(e,!1))return;let o=!1;if(e.popover==="auto"){let i=e.getAttribute("popover"),l=G(e)||t;if(T(l,!1,!0),i!==e.getAttribute("popover")||!d(e,!1))return}y(t)||(o=!0),H.delete(e);let r=t.activeElement;e.classList.add(":popover-open"),h.set(e,"showing"),M.has(t)||M.set(t,new Set),M.get(t).add(e),$(e),e.popover==="auto"&&(p.has(t)||p.set(t,new Set),p.get(t).add(e),q(b.get(e),!0)),o&&r&&e.popover==="auto"&&H.set(e,r),A(e,"closed","open");}function m(e,t=!1,o=!1){if(!d(e,!0))return;let r=e.ownerDocument;if(e.popover==="auto"&&(T(e,t,o),!d(e,!0))||(q(b.get(e),!1),b.delete(e),o&&(e.dispatchEvent(new c("beforetoggle",{oldState:"open",newState:"closed"})),!d(e,!0))))return;M.get(r)?.delete(e),p.get(r)?.delete(e),e.classList.remove(":popover-open"),h.set(e,"hidden"),o&&A(e,"open","closed");let i=H.get(e);i&&(H.delete(e),t&&i.focus());}function F(e,t=!1,o=!1){let r=y(e);for(;r;)m(r,t,o),r=y(e);}function T(e,t,o){let r=e.ownerDocument||e;if(e instanceof Document)return F(r,t,o);let i=null,l=!1;for(let a of p.get(r)||[])if(a===e)l=!0;else if(l){i=a;break}if(!l)return F(r,t,o);for(;i&&L(i)==="showing"&&p.get(r)?.size;)m(i,t,o);}var P=new WeakMap;function x(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let o=t.ownerDocument;if(!y(o))return;let i=V(t);if(i&&e.type==="pointerdown")P.set(o,i);else if(e.type==="pointerup"){let l=P.get(o)===i;P.delete(o),l&&T(i||o,!1,!0);}}var k=new WeakMap;function q(e,t=!1){if(!e)return;k.has(e)||k.set(e,e.getAttribute("aria-expanded"));let o=e.popoverTargetElement;if(o instanceof HTMLElement&&o.popover==="auto")e.setAttribute("aria-expanded",String(t));else {let r=k.get(e);r?e.setAttribute("aria-expanded",r):e.removeAttribute("aria-expanded");}}var B=globalThis.ShadowRoot||function(){};function j(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function f(e,t,o){let r=e[t];Object.defineProperty(e,t,{value(i){return r.call(this,o(i))}});}var J=/(^|[^\\]):popover-open\b/g,C=`
2987
+ :where([popover]) {
2988
+ position: fixed;
2989
+ z-index: 2147483647;
2990
+ inset: 0;
2991
+ padding: 0.25em;
2992
+ width: fit-content;
2993
+ height: fit-content;
2994
+ border-width: initial;
2995
+ border-color: initial;
2996
+ border-image: initial;
2997
+ border-style: solid;
2998
+ background-color: canvas;
2999
+ color: canvastext;
3000
+ overflow: auto;
3001
+ margin: auto;
2499
3002
  }
2500
- wrapper.cancel = cancel;
2501
3003
 
2502
- // Return the wrapper function.
2503
- return wrapper;
2504
- }
3004
+ :where(dialog[popover][open]) {
3005
+ display: revert;
3006
+ }
2505
3007
 
2506
- const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{--global-header-height:72px;--main-header-height:56px;--header-height:calc(var(--global-header-height) + var(--main-header-height))}@media screen and (max-width: 1023.99px){:host{--global-header-height:64px}}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;align-items:center;position:sticky;padding-inline-start:4px;padding-inline-end:12px;height:var(--global-header-height)}@media screen and (max-width: 1023.99px){.global-header{top:0}}@media screen and (min-width: 1024px){.global-header{top:calc((var(--global-header-height) - 24px)*-1)}}slot[name=post-logo]{align-self:flex-end}.global-sub{display:flex;align-items:center;gap:2rem;height:var(--global-header-height)}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:24px;align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem}.title-header,.main-navigation{display:flex;align-items:center;padding-inline:12px;background:#fff}.title-header{height:var(--main-header-height);display:flex;align-items:center}@media screen and (max-width: 1023.99px){.title-header{border-bottom:1px solid #000}}:host(:not(:has([slot=title]))) .title-header{display:none}::slotted(h1){margin:0 !important;font-size:28px !important}.main-navigation{position:sticky;top:24px;height:var(--main-header-height)}@media screen and (min-width: 1024px){.main-navigation{border-bottom:1px solid #000}}@media screen and (max-width: 1023.99px){.main-navigation{display:none;position:absolute;top:var(--header-height);bottom:0;width:100%;background-color:#fff;height:auto}.main-navigation.extended{display:block}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}";
2507
- const PostHeaderStyle0 = postHeaderCss;
3008
+ :where([anchor].\\:popover-open) {
3009
+ inset: auto;
3010
+ }
2508
3011
 
2509
- const PostHeader = class {
2510
- constructor(hostRef) {
2511
- index.registerInstance(this, hostRef);
2512
- this.scrollParent = null;
2513
- this.throttledScroll = () => this.handleScrollEvent();
2514
- this.throttledResize = throttle(50, () => this.handleResize());
2515
- this.device = null;
2516
- this.mobileMenuExtended = false;
2517
- }
2518
- componentWillRender() {
2519
- this.scrollParent = this.getScrollParent(this.host);
2520
- this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
2521
- window.addEventListener('resize', this.throttledResize, { passive: true });
2522
- this.handleResize();
2523
- this.handleScrollEvent();
2524
- }
2525
- handlePostMainNavigationClosed() {
2526
- this.mobileMenuExtended = false;
2527
- }
2528
- handleScrollEvent() {
2529
- // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
2530
- const st = Math.max(0, this.scrollParent instanceof Document
2531
- ? this.scrollParent.documentElement.scrollTop
2532
- : this.scrollParent.scrollTop);
2533
- this.host.style.setProperty('--header-scroll-top', `${st}px`);
2534
- }
2535
- getScrollParent(node) {
2536
- let currentParent = node.parentElement;
2537
- while (currentParent) {
2538
- if (currentParent.nodeName === 'BODY') {
2539
- return document;
2540
- }
2541
- if (this.isScrollable(currentParent)) {
2542
- return currentParent;
2543
- }
2544
- currentParent = currentParent.parentElement;
2545
- }
2546
- return document;
2547
- }
2548
- isScrollable(node) {
2549
- if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
2550
- return false;
2551
- }
2552
- const style = getComputedStyle(node);
2553
- return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
2554
- const value = style.getPropertyValue(propertyName);
2555
- return value === 'auto' || value === 'scroll';
2556
- });
2557
- }
2558
- handleResize() {
2559
- const width = window === null || window === void 0 ? void 0 : window.innerWidth;
2560
- if (width >= 1024) {
2561
- this.device = 'desktop';
2562
- this.mobileMenuExtended = false; // Close any open mobile menu
2563
- }
2564
- else if (width >= 600) {
2565
- this.device = 'tablet';
2566
- }
2567
- else {
2568
- this.device = 'mobile';
2569
- }
3012
+ :where([anchor]:popover-open) {
3013
+ inset: auto;
3014
+ }
3015
+
3016
+ @supports not (background-color: canvas) {
3017
+ :where([popover]) {
3018
+ background-color: white;
3019
+ color: black;
2570
3020
  }
2571
- handleMobileMenuToggle() {
2572
- this.mobileMenuExtended = !this.mobileMenuExtended;
3021
+ }
3022
+
3023
+ @supports (width: -moz-fit-content) {
3024
+ :where([popover]) {
3025
+ width: -moz-fit-content;
3026
+ height: -moz-fit-content;
2573
3027
  }
2574
- render() {
2575
- const mainNavClasses = ['main-navigation'];
2576
- if (this.mobileMenuExtended) {
2577
- mainNavClasses.push('extended');
2578
- }
2579
- return (index.h(index.Host, { key: 'a09985740ff01e4f38e7bbe5e0b9012d77e7cba2', version: _package.version }, index.h("div", { key: 'c612b90e757d916036bee002d7bba8abfeb19073', class: "global-header" }, index.h("div", { key: 'd11c51f756d1c7a8c0b4f3b9625cfbe8cae88435', class: "global-sub" }, index.h("div", { key: '43fb63bfe0350ffca0e44fd611bb6bbe6c3eef0c', class: "logo" }, index.h("slot", { key: '8d90d7f20b0fd6a7cbc93e5dd95ad8200c027822', name: "post-logo" }))), index.h("div", { key: 'b1bc83b4fcb3a0af6ffd99976af4acf454b3d29d', class: "global-sub" }, this.device === 'desktop' && index.h("slot", { key: 'bbe38f3e0d070bfd84e1656e7dd631816df0101c', name: "meta-navigation" }), index.h("slot", { key: 'b1483eea11ecdc9cddf122077cf0746d88f69239', name: "global-controls" }), this.device === 'desktop' && index.h("slot", { key: '785f557f30bffc5cd282a0505e9ffc7e3e6e1029', name: "post-language-switch" }), index.h("div", { key: 'f088ddb3df417929525b22a09fa3be113042e48f', onClick: () => this.handleMobileMenuToggle(), class: "mobile-toggle" }, index.h("slot", { key: 'de65884a443290e057ed911289818d5a323f5a9c', name: "post-togglebutton" })))), index.h("div", { key: '56ebdec46003a6ead4f3710dc9c0f60e9a86ed8d', class: "title-header d-flex space-between align-center" }, index.h("slot", { key: '8e61e4711ea8018e51fd11c5b5faa30a1ad9445c', name: "title" }), index.h("div", { key: '4d762d1f4d3f45470d52af167c7f4a71651e7970', class: "global-sub" }, index.h("slot", { key: 'c8c5b73b1fa0e665a7133ae8db0212ef8948ba29', name: "local-controls" }), index.h("slot", { key: '212640155af85dfab34182ab236bfe72456e77b1' }))), index.h("div", { key: 'c4004d443fd546fac8a2651482725fae99c2db6c', class: mainNavClasses.join(' ') }, index.h("slot", { key: '783787f85d25d9e42d96213ae77f6c689f872b70', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (index.h("slot", { key: '04cfd7d09d03ab85ac9c12f9c3d6cb31fbb65fc2', name: "meta-navigation" })), (this.device === 'mobile' || this.device === 'tablet') && (index.h("slot", { key: '117e76f18fdc93493115428e1cd0d6a119c7a652', name: "post-language-switch" })))));
3028
+ }
3029
+
3030
+ @supports not (inset: 0) {
3031
+ :where([popover]) {
3032
+ top: 0;
3033
+ left: 0;
3034
+ right: 0;
3035
+ bottom: 0;
2580
3036
  }
2581
- get host() { return index.getElement(this); }
2582
- };
2583
- PostHeader.style = PostHeaderStyle0;
3037
+ }
2584
3038
 
2585
- const postMainnavigationCss = "*,::before,::after{box-sizing:border-box}@media screen and (min-width: 1024px){slot[name=back-button],[slot=back-button]{display:none}}@media screen and (min-width: 1024px){h2{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}}post-mainnavigation{height:100%}:host{height:100%;display:block}.main-navigation{margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem}@media screen and (max-width: 1023.99px){.main-navigation{flex-direction:column}}.main-navigation>post-list{display:flex;align-items:stretch;gap:1rem;height:100%}@media screen and (max-width: 1023.99px){.main-navigation>post-list{flex-direction:column}}.main-navigation a,.main-navigation post-megadropdown-toggle{height:100%;display:flex;align-items:center}";
2586
- const PostMainnavigationStyle0 = postMainnavigationCss;
3039
+ :where([popover]:not(.\\:popover-open)) {
3040
+ display: none;
3041
+ }
3042
+ `,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(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(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.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=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||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);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
2587
3043
 
2588
- const PostMainnavigation = class {
3044
+ const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){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:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
3045
+ const PostPopovercontainerStyle0 = postPopovercontainerCss;
3046
+
3047
+ const SIDE_MAP = {
3048
+ top: 'bottom',
3049
+ right: 'left',
3050
+ bottom: 'top',
3051
+ left: 'right',
3052
+ };
3053
+ const PostPopovercontainer = class {
2589
3054
  constructor(hostRef) {
2590
3055
  index.registerInstance(this, hostRef);
2591
3056
  this.postToggle = index.createEvent(this, "postToggle", 7);
3057
+ this.placement = 'top';
3058
+ this.edgeGap = 8;
3059
+ this.arrow = false;
2592
3060
  }
2593
- handleMegadropdownToggled(event) {
2594
- // Find next element sibling
2595
- let megalodon;
2596
- let target = event.target;
2597
- while (target !== null) {
2598
- if (target.tagName === 'POST-MEGADROPDOWN') {
2599
- megalodon = target;
2600
- break;
2601
- }
2602
- target = target.nextElementSibling;
2603
- }
2604
- if (megalodon)
2605
- megalodon.toggle(event.target);
3061
+ componentDidLoad() {
3062
+ this.host.setAttribute('popover', '');
3063
+ this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
2606
3064
  }
2607
- handleBackButtonClick() {
2608
- this.postToggle.emit();
3065
+ disconnectedCallback() {
3066
+ if (typeof this.clearAutoUpdate === 'function')
3067
+ this.clearAutoUpdate();
2609
3068
  }
2610
- render() {
2611
- return (index.h(index.Host, { key: '7179d087e93ab9e14dc21e16b52beaf965c53cd3', slot: "post-mainnavigation" }, index.h("div", { key: '2aede886c29972bf1dfebbe4513c4acf2e47c6ea', onClick: () => this.handleBackButtonClick(), class: "back-button" }, index.h("slot", { key: '4697ec520be78fccee832a358b349f68081b2f54', name: "back-button" })), index.h("nav", { key: '5bae57025152af07b9d68a19a07b61d0149d31dc', class: "main-navigation" }, index.h("slot", { key: 'e2a73a4b814a39a7cb1f7733f87c3c588f484006' }))));
3069
+ /**
3070
+ * Programmatically display the tooltip
3071
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3072
+ */
3073
+ async show(target) {
3074
+ if (!this.toggleTimeoutId) {
3075
+ this.eventTarget = target;
3076
+ this.calculatePosition();
3077
+ this.host.showPopover();
3078
+ }
2612
3079
  }
2613
- };
2614
- PostMainnavigation.style = PostMainnavigationStyle0;
2615
-
2616
- const postMegadropdownCss = "*,::before,::after{box-sizing:border-box}post-popovercontainer{background-color:#fafafa;width:100%;border-bottom:1px solid #000}@media screen and (max-width: 1023.99px){post-popovercontainer{position:absolute;top:var(--header-height) !important;bottom:0;left:0;width:100%;height:auto}}.megadropdown{display:flex;gap:1rem;padding:1.5rem;border-radius:0 0 3px 3px}@media screen and (max-width: 1023.99px){.megadropdown{flex-direction:column}}.megadropdown post-list{display:flex;flex-direction:column;gap:.5rem}.megadropdown post-list-item{border-bottom:1px solid gray}.megadropdown post-list-item>a{padding-block:.25rem;display:block;text-decoration:none}.back-button{display:none}@media screen and (max-width: 1023.99px){.back-button{display:block}}post-closebutton{margin-left:auto}@media screen and (max-width: 1023.99px){post-closebutton{display:none}}h3{font-size:20px}";
2617
- const PostMegadropdownStyle0 = postMegadropdownCss;
2618
-
2619
- const PostMegadropdown = class {
2620
- constructor(hostRef) {
2621
- index.registerInstance(this, hostRef);
3080
+ /**
3081
+ * Programmatically hide this tooltip
3082
+ */
3083
+ async hide() {
3084
+ if (!this.toggleTimeoutId) {
3085
+ this.eventTarget = null;
3086
+ this.host.hidePopover();
3087
+ }
2622
3088
  }
2623
3089
  /**
2624
- * Show megadropdown
2625
- * @param element HTMLElement
2626
- * @returns boolean
3090
+ * Toggle tooltip display
3091
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3092
+ * @param force Pass true to always show or false to always hide
2627
3093
  */
2628
- async show(element) {
2629
- return this.popoverRef.show(element);
3094
+ async toggle(target, force) {
3095
+ // Prevent instant double toggle
3096
+ if (!this.toggleTimeoutId) {
3097
+ this.eventTarget = target;
3098
+ this.calculatePosition();
3099
+ this.host.togglePopover(force);
3100
+ this.toggleTimeoutId = null;
3101
+ }
3102
+ return this.host.matches(':where(:popover-open, .popover-open');
2630
3103
  }
2631
3104
  /**
2632
- * Hide megadropdown
2633
- * @returns boolean
3105
+ * Start or stop auto updates based on tooltip events.
3106
+ * Tooltips can be closed or opened with other methods than class members,
3107
+ * therefore listening to the toggle event is safer for cleaning up.
3108
+ * @param e ToggleEvent
2634
3109
  */
2635
- async hide() {
2636
- return this.popoverRef.hide();
3110
+ handleToggle(e) {
3111
+ this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
3112
+ const isOpen = e.newState === 'open';
3113
+ if (isOpen) {
3114
+ this.startAutoupdates();
3115
+ }
3116
+ else {
3117
+ if (typeof this.clearAutoUpdate === 'function')
3118
+ this.clearAutoUpdate();
3119
+ }
3120
+ this.postToggle.emit(isOpen);
2637
3121
  }
2638
3122
  /**
2639
- * Toggle megadropdown
2640
- * @param element HTMLElement
2641
- * @param force boolean
2642
- * @returns boolean
3123
+ * Start listening for DOM updates, scroll events etc. that have
3124
+ * an influence on tooltip positioning
2643
3125
  */
2644
- async toggle(element, force) {
2645
- return this.popoverRef.toggle(element, force !== null && force !== void 0 ? force : undefined);
3126
+ startAutoupdates() {
3127
+ this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
2646
3128
  }
2647
- handleBackButtonClick() {
2648
- this.hide();
3129
+ async calculatePosition() {
3130
+ const gap = this.edgeGap;
3131
+ const middleware = [
3132
+ flip(),
3133
+ inline(),
3134
+ shift({
3135
+ padding: gap,
3136
+ // Prevents shifting away from the anchor too far, while shifting as far as possible
3137
+ // https://floating-ui.com/docs/shift#limiter
3138
+ limiter: limitShift({
3139
+ offset: 32,
3140
+ }),
3141
+ }),
3142
+ size({
3143
+ apply({ availableWidth, elements }) {
3144
+ Object.assign(elements.floating.style, {
3145
+ maxWidth: `${availableWidth - gap * 2}px`,
3146
+ });
3147
+ },
3148
+ }),
3149
+ offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
3150
+ ];
3151
+ if (this.arrow) {
3152
+ middleware.push(arrow({ element: this.arrowRef, padding: gap }));
3153
+ }
3154
+ const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
3155
+ placement: this.placement || 'top',
3156
+ strategy: 'fixed',
3157
+ middleware,
3158
+ });
3159
+ // Tooltip
3160
+ this.host.style.left = `${x}px`;
3161
+ this.host.style.top = `${y}px`;
3162
+ // Arrow
3163
+ if (this.arrow) {
3164
+ // Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
3165
+ const side = currentPlacement.split('-')[0];
3166
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
3167
+ const staticSide = SIDE_MAP[side];
3168
+ const offsetBorderLineJoin = 2;
3169
+ Object.assign(this.arrowRef.style, {
3170
+ top: arrowY ? `${arrowY}px` : '',
3171
+ left: arrowX ? `${arrowX}px` : '',
3172
+ [staticSide]: `${-this.arrowRef.offsetWidth / 2 - offsetBorderLineJoin}px`,
3173
+ });
3174
+ // Add position as a class to be able to style arrow for HCM
3175
+ this.arrowRef.classList.remove(...Object.values(SIDE_MAP));
3176
+ this.arrowRef.classList.add(staticSide);
3177
+ }
2649
3178
  }
2650
3179
  render() {
2651
- return (index.h(index.Host, { key: '9b8e17f4120259f55ed3dbce4780559cb8876540', slot: "post-mainnavigation" }, index.h("post-popovercontainer", { key: 'ac48d1fffbcdff5aa20d9f2f6fed9beb4dd3be23', placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, index.h("div", { key: 'af02d9fd35973b6d889b639f1d856dd3d9921ae1', class: "megadropdown" }, index.h("div", { key: '445aa9b1a04e63c0d2b17466c610a30662f3db0e', onClick: () => this.handleBackButtonClick(), class: "back-button" }, index.h("slot", { key: '8d8f4cad3d5860fdfc1c615e7122ab5dd2ca5ed3', name: "back-button" })), index.h("slot", { key: 'c9ba8c0941f86fd29a44153e186cd679bcd678f5' })))));
3180
+ return (index.h(index.Host, { key: '23e391236e263f7ae7c66c994b2847bcba269b37', "data-version": _package.version }, this.arrow && (index.h("span", { key: '6c6053b2fd315a5940a2c3493182249782b2492c', class: "arrow", ref: el => {
3181
+ this.arrowRef = el;
3182
+ } })), index.h("slot", { key: 'ff998f110f42a22e886eba398285c41d94718bab' })));
2652
3183
  }
3184
+ get host() { return index.getElement(this); }
2653
3185
  };
2654
- PostMegadropdown.style = PostMegadropdownStyle0;
3186
+ PostPopovercontainer.style = PostPopovercontainerStyle0;
2655
3187
 
2656
- const postMegadropdownTriggerCss = ":host{display:inline-block}";
2657
- const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
3188
+ const postTogglebuttonCss = ":host{cursor:pointer;outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(:focus-visible){outline-color:Highlight !important}}:host([aria-pressed=true]) ::slotted([data-showwhen=untoggled]){display:none}:host([aria-pressed=false]) ::slotted([data-showwhen=toggled]){display:none}";
3189
+ const PostTogglebuttonStyle0 = postTogglebuttonCss;
2658
3190
 
2659
- const PostMegadropdownTrigger = class {
3191
+ const PostTogglebutton = class {
2660
3192
  constructor(hostRef) {
2661
3193
  index.registerInstance(this, hostRef);
2662
- this.postToggle = index.createEvent(this, "postToggle", 7);
3194
+ this.handleClick = () => {
3195
+ this.toggled = !this.toggled;
3196
+ };
3197
+ this.handleKeydown = (event) => {
3198
+ // perform a click when enter or spaced are pressed to mimic the button behavior
3199
+ if (event.key === 'Enter' || event.key === ' ') {
3200
+ event.preventDefault(); // prevents the page from scrolling when space is pressed
3201
+ this.host.click();
3202
+ }
3203
+ };
2663
3204
  this.toggled = false;
2664
3205
  }
2665
- handleClick() {
2666
- this.toggled = !this.toggled;
2667
- this.postToggle.emit();
3206
+ validateToggled(value = this.toggled) {
3207
+ checkType.checkType(value, 'boolean', 'The "toggled" property of the post-togglebutton must be a boolean.');
3208
+ }
3209
+ componentWillLoad() {
3210
+ this.validateToggled();
3211
+ // add event listener to not override listener that might be set on the host
3212
+ this.host.addEventListener('click', () => this.handleClick());
3213
+ this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
2668
3214
  }
2669
3215
  render() {
2670
- return (index.h(index.Host, { key: 'd139b405fe28c7334c01eec4846a6f8b5bf1e261', slot: "post-megadropdown-trigger" }, index.h("button", { key: 'd3aee53488359a79764974d440d7a058d5d96873', "aria-expanded": this.toggled, onClick: () => this.handleClick() }, index.h("slot", { key: '7012055defbb7c8058481db5c4129919847010c6' }))));
3216
+ return (index.h(index.Host, { key: 'f20b7e5f7cd14c1b0addf12600df27e7e5dab841', slot: "post-togglebutton", "data-version": _package.version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, index.h("slot", { key: '526540ce9a66fa08f0142e674811fe88e3abcfa6' })));
2671
3217
  }
3218
+ get host() { return index.getElement(this); }
3219
+ static get watchers() { return {
3220
+ "toggled": ["validateToggled"]
3221
+ }; }
2672
3222
  };
2673
- PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
3223
+ PostTogglebutton.style = PostTogglebuttonStyle0;
2674
3224
 
2675
3225
  exports.PostClosebutton = PostClosebutton;
2676
3226
  exports.PostHeader = PostHeader;
2677
3227
  exports.PostIcon = PostIcon;
3228
+ exports.PostLanguageOption = PostLanguageOption;
3229
+ exports.PostLanguageSwitch = PostLanguageSwitch;
2678
3230
  exports.PostList = PostList;
2679
3231
  exports.PostListItem = PostListItem;
2680
3232
  exports.PostLogo = PostLogo;
2681
3233
  exports.PostMainnavigation = PostMainnavigation;
2682
3234
  exports.PostMegadropdown = PostMegadropdown;
2683
3235
  exports.PostMegadropdownTrigger = PostMegadropdownTrigger;
3236
+ exports.PostMenu = PostMenu;
3237
+ exports.PostMenuTrigger = PostMenuTrigger;
2684
3238
  exports.PostPopovercontainer = PostPopovercontainer;
3239
+ exports.PostTogglebutton = PostTogglebutton;