@swisspost/design-system-components 9.0.0-next.2 → 9.0.0-next.21

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 (538) hide show
  1. package/dist/.config/bindings.angular.js +4 -0
  2. package/dist/cjs/{attribute-observer-10f08c04.js → attribute-observer-6d8b886b.js} +4 -4
  3. package/dist/cjs/check-non-empty-bd99d236.js +15 -0
  4. package/dist/cjs/check-one-of-75d270b5.js +13 -0
  5. package/dist/cjs/check-type-cdbf6d29.js +21 -0
  6. package/dist/cjs/check-url-220a286c.js +19 -0
  7. package/dist/cjs/debounce-158fd76f.js +13 -0
  8. package/dist/cjs/fade-72d5ef55.js +14 -0
  9. package/dist/cjs/get-root-7a3498ef.js +11 -0
  10. package/dist/cjs/index-23e36ff7.js +37 -0
  11. package/dist/cjs/{index-c15bd800.js → index-5acef487.js} +54 -17
  12. package/dist/cjs/index.browser-2f65f583.js +15 -0
  13. package/dist/cjs/index.cjs.js +56 -27
  14. package/dist/cjs/loader.cjs.js +2 -2
  15. package/dist/cjs/{package-a7150f64.js → package-c6bc9e82.js} +1 -1
  16. package/dist/cjs/{post-accordion-62d2fd79.js → post-accordion-d1345784.js} +9 -8
  17. package/dist/cjs/post-accordion-item-a796d803.js +64 -0
  18. package/dist/cjs/post-accordion-item.cjs.entry.js +8 -5
  19. package/dist/cjs/post-accordion.cjs.entry.js +4 -4
  20. package/dist/cjs/post-avatar-b4e96354.js +144 -0
  21. package/dist/cjs/post-avatar.cjs.entry.js +13 -0
  22. package/dist/cjs/post-back-to-top-fc541c6b.js +76 -0
  23. package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
  24. package/dist/cjs/post-banner-46522b4f.js +96 -0
  25. package/dist/cjs/post-banner.cjs.entry.js +19 -0
  26. package/dist/cjs/post-breadcrumb-799d34da.js +112 -0
  27. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
  28. package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
  29. package/dist/cjs/post-card-control-7bf7d3f2.js +283 -0
  30. package/dist/cjs/post-card-control.cjs.entry.js +5 -5
  31. package/dist/cjs/post-closebutton_15.cjs.entry.js +34 -0
  32. package/dist/cjs/{post-collapsible-trigger-9dca8493.js → post-collapsible-trigger-0568e3ec.js} +50 -56
  33. package/dist/cjs/post-collapsible_2.cjs.entry.js +10 -6
  34. package/dist/cjs/post-components.cjs.js +2 -2
  35. package/dist/cjs/post-footer-f87a556b.js +88 -0
  36. package/dist/cjs/post-footer.cjs.entry.js +11 -0
  37. package/dist/cjs/post-linkarea-0ccf93fc.js +30 -0
  38. package/dist/cjs/post-linkarea.cjs.entry.js +11 -0
  39. package/dist/cjs/post-menu-item-eba24c40.js +68 -0
  40. package/dist/cjs/post-popover-35f679f6.js +106 -0
  41. package/dist/cjs/post-popover.cjs.entry.js +4 -4
  42. package/dist/cjs/{post-rating-db5a397a.js → post-rating-d12fa214.js} +16 -6
  43. package/dist/cjs/post-rating.cjs.entry.js +3 -3
  44. package/dist/cjs/post-tab-header-89dca04b.js +33 -0
  45. package/dist/cjs/post-tab-header.cjs.entry.js +5 -4
  46. package/dist/cjs/{post-tab-panel-d59cf1ec.js → post-tab-panel-ad1ab180.js} +6 -5
  47. package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
  48. package/dist/cjs/{post-tabs-7afae61a.js → post-tabs-0db75745.js} +23 -16
  49. package/dist/cjs/post-tabs.cjs.entry.js +4 -4
  50. package/dist/cjs/post-tag-396a46c9.js +47 -0
  51. package/dist/cjs/post-tag.cjs.entry.js +3 -3
  52. package/dist/cjs/post-togglebutton-69983699.js +3861 -0
  53. package/dist/cjs/{post-tooltip-432852c7.js → post-tooltip-7174ea97.js} +38 -25
  54. package/dist/cjs/post-tooltip.cjs.entry.js +8 -6
  55. package/dist/cjs/slide-8ae17ee4.js +28 -0
  56. package/dist/collection/animations/collapse.js +5 -5
  57. package/dist/collection/animations/fade.js +6 -2
  58. package/dist/collection/animations/slide.js +23 -0
  59. package/dist/collection/collection-manifest.json +22 -3
  60. package/dist/collection/components/post-accordion/post-accordion.css +1 -1
  61. package/dist/collection/components/post-accordion/post-accordion.js +5 -3
  62. package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
  63. package/dist/collection/components/post-accordion-item/post-accordion-item.js +29 -11
  64. package/dist/collection/components/post-avatar/post-avatar.css +3 -0
  65. package/dist/collection/components/post-avatar/post-avatar.js +234 -0
  66. package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
  67. package/dist/collection/components/post-back-to-top/post-back-to-top.js +109 -0
  68. package/dist/collection/components/post-banner/banner-types.js +1 -0
  69. package/dist/collection/components/post-banner/post-banner.css +3 -0
  70. package/dist/collection/components/{post-alert/post-alert.js → post-banner/post-banner.js} +51 -73
  71. package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
  72. package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +163 -0
  73. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -0
  74. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +98 -0
  75. package/dist/collection/components/post-card-control/post-card-control.css +1 -1
  76. package/dist/collection/components/post-card-control/post-card-control.js +55 -43
  77. package/dist/collection/components/post-closebutton/post-closebutton.js +13 -0
  78. package/dist/collection/components/post-collapsible/post-collapsible.css +1 -1
  79. package/dist/collection/components/post-collapsible/post-collapsible.js +15 -6
  80. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +21 -20
  81. package/dist/collection/components/post-footer/post-footer.css +1 -0
  82. package/dist/collection/components/post-footer/post-footer.js +76 -0
  83. package/dist/collection/components/post-header/post-header.css +1 -0
  84. package/dist/collection/components/post-header/post-header.js +267 -0
  85. package/dist/collection/components/post-icon/post-icon.js +80 -47
  86. package/dist/collection/components/post-language-option/post-language-option.css +3 -0
  87. package/dist/collection/components/post-language-option/post-language-option.js +224 -0
  88. package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
  89. package/dist/collection/components/post-language-switch/post-language-switch.js +164 -0
  90. package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
  91. package/dist/collection/components/post-linkarea/post-linkarea.css +1 -0
  92. package/dist/collection/components/post-linkarea/post-linkarea.js +30 -0
  93. package/dist/collection/components/post-list/post-list.css +3 -0
  94. package/dist/collection/components/post-list/post-list.js +90 -0
  95. package/dist/collection/components/post-list-item/post-list-item.css +1 -0
  96. package/dist/collection/components/post-list-item/post-list-item.js +26 -0
  97. package/dist/collection/components/post-logo/post-logo.css +1 -1
  98. package/dist/collection/components/post-logo/post-logo.js +4 -3
  99. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -0
  100. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +255 -0
  101. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -0
  102. package/dist/collection/components/post-megadropdown/post-megadropdown.js +268 -0
  103. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -0
  104. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +127 -0
  105. package/dist/collection/components/post-menu/post-menu.css +3 -0
  106. package/dist/collection/components/post-menu/post-menu.js +297 -0
  107. package/dist/collection/components/post-menu-item/post-menu-item.js +8 -0
  108. package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +1 -0
  109. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +122 -0
  110. package/dist/collection/components/post-popover/post-popover.css +1 -1
  111. package/dist/collection/components/post-popover/post-popover.js +6 -3
  112. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
  113. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +193 -38
  114. package/dist/collection/components/post-rating/post-rating.css +1 -1
  115. package/dist/collection/components/post-rating/post-rating.js +13 -2
  116. package/dist/collection/components/post-tab-header/post-tab-header.css +2 -2
  117. package/dist/collection/components/post-tab-header/post-tab-header.js +6 -4
  118. package/dist/collection/components/post-tab-panel/post-tab-panel.js +4 -2
  119. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  120. package/dist/collection/components/post-tabs/post-tabs.js +17 -14
  121. package/dist/collection/components/post-tag/post-tag.css +1 -1
  122. package/dist/collection/components/post-tag/post-tag.js +3 -2
  123. package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -0
  124. package/dist/collection/components/post-togglebutton/post-togglebutton.js +75 -0
  125. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  126. package/dist/collection/components/post-tooltip/post-tooltip.js +35 -17
  127. package/dist/collection/index.js +21 -2
  128. package/dist/collection/utils/attribute-observer.js +4 -4
  129. package/dist/collection/utils/breakpoints.js +50 -0
  130. package/dist/collection/utils/component-on-ready.js +4 -4
  131. package/dist/collection/utils/debounce.js +2 -1
  132. package/dist/collection/utils/get-focusable-children.js +33 -0
  133. package/dist/collection/utils/property-checkers/check-non-empty.js +6 -2
  134. package/dist/collection/utils/property-checkers/check-one-of.js +8 -3
  135. package/dist/collection/utils/property-checkers/check-pattern.js +8 -3
  136. package/dist/collection/utils/property-checkers/check-type.js +11 -6
  137. package/dist/collection/utils/property-checkers/check-url.js +11 -6
  138. package/dist/collection/utils/property-checkers/empty-or.js +5 -2
  139. package/dist/collection/utils/sass-export.js +8 -5
  140. package/dist/components/attribute-observer.js +4 -4
  141. package/dist/components/check-non-empty.js +6 -2
  142. package/dist/components/check-one-of.js +8 -3
  143. package/dist/components/check-type.js +11 -6
  144. package/dist/components/debounce.js +11 -0
  145. package/dist/components/fade.js +6 -2
  146. package/dist/components/get-focusable-children.js +35 -0
  147. package/dist/components/get-root.js +9 -0
  148. package/dist/components/index.browser.js +13 -0
  149. package/dist/components/index.js +21 -2
  150. package/dist/components/index2.js +25 -12
  151. package/dist/components/index3.js +135 -0
  152. package/dist/components/package.js +1 -1
  153. package/dist/components/post-accordion-item2.js +36 -16
  154. package/dist/components/post-accordion2.js +6 -5
  155. package/dist/components/post-avatar.d.ts +11 -0
  156. package/dist/components/post-avatar.js +6 -0
  157. package/dist/components/post-avatar2.js +169 -0
  158. package/dist/components/post-back-to-top.d.ts +11 -0
  159. package/dist/components/post-back-to-top.js +6 -0
  160. package/dist/components/post-back-to-top2.js +101 -0
  161. package/dist/components/post-banner.d.ts +11 -0
  162. package/dist/components/post-banner.js +6 -0
  163. package/dist/components/post-banner2.js +131 -0
  164. package/dist/components/post-breadcrumb-item.d.ts +11 -0
  165. package/dist/components/post-breadcrumb-item.js +6 -0
  166. package/dist/components/post-breadcrumb-item2.js +82 -0
  167. package/dist/components/post-breadcrumb.d.ts +11 -0
  168. package/dist/components/post-breadcrumb.js +6 -0
  169. package/dist/components/post-breadcrumb2.js +169 -0
  170. package/dist/components/post-card-control2.js +50 -39
  171. package/dist/components/post-closebutton.d.ts +11 -0
  172. package/dist/components/post-closebutton.js +6 -0
  173. package/dist/components/post-closebutton2.js +34 -0
  174. package/dist/components/post-collapsible-trigger2.js +23 -38
  175. package/dist/components/post-collapsible2.js +22 -14
  176. package/dist/components/post-footer.d.ts +11 -0
  177. package/dist/components/post-footer.js +6 -0
  178. package/dist/components/post-footer2.js +128 -0
  179. package/dist/components/post-header.d.ts +11 -0
  180. package/dist/components/post-header.js +6 -0
  181. package/dist/components/post-header2.js +217 -0
  182. package/dist/components/post-icon2.js +82 -46
  183. package/dist/components/post-language-option.d.ts +11 -0
  184. package/dist/components/post-language-option.js +6 -0
  185. package/dist/components/post-language-option2.js +102 -0
  186. package/dist/components/post-language-switch.d.ts +11 -0
  187. package/dist/components/post-language-switch.js +6 -0
  188. package/dist/components/post-language-switch2.js +135 -0
  189. package/dist/components/post-linkarea.d.ts +11 -0
  190. package/dist/components/post-linkarea.js +6 -0
  191. package/dist/components/post-linkarea2.js +42 -0
  192. package/dist/components/post-list-item.d.ts +11 -0
  193. package/dist/components/post-list-item.js +6 -0
  194. package/dist/components/post-list-item2.js +35 -0
  195. package/dist/components/{post-alert.d.ts → post-list.d.ts} +4 -4
  196. package/dist/components/post-list.js +6 -0
  197. package/dist/components/post-list2.js +55 -0
  198. package/dist/components/post-logo2.js +5 -5
  199. package/dist/components/post-mainnavigation.d.ts +11 -0
  200. package/dist/components/post-mainnavigation.js +6 -0
  201. package/dist/components/post-mainnavigation2.js +258 -0
  202. package/dist/components/post-megadropdown-trigger.d.ts +11 -0
  203. package/dist/components/post-megadropdown-trigger.js +6 -0
  204. package/dist/components/post-megadropdown-trigger2.js +113 -0
  205. package/dist/components/post-megadropdown.d.ts +11 -0
  206. package/dist/components/post-megadropdown.js +6 -0
  207. package/dist/components/post-megadropdown2.js +186 -0
  208. package/dist/components/post-menu-item.d.ts +11 -0
  209. package/dist/components/post-menu-item.js +6 -0
  210. package/dist/components/post-menu-item2.js +27 -0
  211. package/dist/components/post-menu-trigger.d.ts +11 -0
  212. package/dist/components/post-menu-trigger.js +6 -0
  213. package/dist/components/post-menu-trigger2.js +109 -0
  214. package/dist/components/post-menu.d.ts +11 -0
  215. package/dist/components/post-menu.js +6 -0
  216. package/dist/components/post-menu2.js +193 -0
  217. package/dist/components/post-popover2.js +6 -4
  218. package/dist/components/post-popovercontainer2.js +227 -59
  219. package/dist/components/post-rating2.js +14 -4
  220. package/dist/components/post-tab-header2.js +7 -6
  221. package/dist/components/post-tab-panel2.js +4 -3
  222. package/dist/components/post-tabs2.js +20 -13
  223. package/dist/components/post-tag2.js +3 -3
  224. package/dist/components/post-togglebutton.d.ts +11 -0
  225. package/dist/components/post-togglebutton.js +6 -0
  226. package/dist/components/post-togglebutton2.js +61 -0
  227. package/dist/components/post-tooltip2.js +35 -22
  228. package/dist/components/slide.js +25 -0
  229. package/dist/docs.json +1956 -270
  230. package/dist/esm/{attribute-observer-37fa950a.js → attribute-observer-2f203993.js} +4 -4
  231. package/dist/esm/check-non-empty-258a56b3.js +13 -0
  232. package/dist/esm/check-one-of-0bee20f5.js +11 -0
  233. package/dist/esm/check-type-37d5d307.js +19 -0
  234. package/dist/esm/check-url-17962bc8.js +17 -0
  235. package/dist/esm/debounce-e54c7131.js +11 -0
  236. package/dist/esm/fade-1f3cacf4.js +11 -0
  237. package/dist/esm/get-root-7af2e0d1.js +9 -0
  238. package/dist/esm/{index-0b56fc28.js → index-40846676.js} +54 -17
  239. package/dist/esm/index-8f8fe5b0.js +32 -0
  240. package/dist/esm/index.browser-51485f85.js +13 -0
  241. package/dist/esm/index.js +32 -22
  242. package/dist/esm/loader.js +3 -3
  243. package/dist/esm/package-5614c98b.js +3 -0
  244. package/dist/esm/{post-accordion-6f4d2b9a.js → post-accordion-f6d1834d.js} +9 -8
  245. package/dist/esm/post-accordion-item-7cb93300.js +62 -0
  246. package/dist/esm/post-accordion-item.entry.js +8 -5
  247. package/dist/esm/post-accordion.entry.js +4 -4
  248. package/dist/esm/post-avatar-96108967.js +142 -0
  249. package/dist/esm/post-avatar.entry.js +5 -0
  250. package/dist/esm/post-back-to-top-7f8a61c8.js +74 -0
  251. package/dist/esm/post-back-to-top.entry.js +7 -0
  252. package/dist/esm/post-banner-bb69bce8.js +94 -0
  253. package/dist/esm/post-banner.entry.js +11 -0
  254. package/dist/esm/post-breadcrumb-9d9efa4e.js +110 -0
  255. package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
  256. package/dist/esm/post-breadcrumb.entry.js +5 -0
  257. package/dist/esm/post-card-control-fdced7d5.js +281 -0
  258. package/dist/esm/post-card-control.entry.js +5 -5
  259. package/dist/esm/post-closebutton_15.entry.js +12 -0
  260. package/dist/esm/{post-collapsible-trigger-85c2064a.js → post-collapsible-trigger-17b2f067.js} +49 -55
  261. package/dist/esm/post-collapsible_2.entry.js +10 -6
  262. package/dist/esm/post-components.js +3 -3
  263. package/dist/esm/post-footer-2dcd8159.js +86 -0
  264. package/dist/esm/post-footer.entry.js +3 -0
  265. package/dist/esm/post-linkarea-06c5144d.js +28 -0
  266. package/dist/esm/post-linkarea.entry.js +3 -0
  267. package/dist/esm/post-menu-item-e917bf99.js +65 -0
  268. package/dist/esm/post-popover-67a3cbf2.js +104 -0
  269. package/dist/esm/post-popover.entry.js +4 -4
  270. package/dist/esm/{post-rating-d9fc0b40.js → post-rating-9613bee8.js} +16 -6
  271. package/dist/esm/post-rating.entry.js +3 -3
  272. package/dist/esm/post-tab-header-dff3a025.js +31 -0
  273. package/dist/esm/post-tab-header.entry.js +5 -4
  274. package/dist/esm/{post-tab-panel-926439f4.js → post-tab-panel-2b3f82a8.js} +6 -5
  275. package/dist/esm/post-tab-panel.entry.js +4 -3
  276. package/dist/esm/{post-tabs-13b2d9a6.js → post-tabs-46d1165f.js} +23 -16
  277. package/dist/esm/post-tabs.entry.js +4 -4
  278. package/dist/esm/post-tag-4176268e.js +45 -0
  279. package/dist/esm/post-tag.entry.js +3 -3
  280. package/dist/esm/post-togglebutton-5892c5bd.js +3845 -0
  281. package/dist/esm/{post-tooltip-3cde6b53.js → post-tooltip-5a45a569.js} +38 -25
  282. package/dist/esm/post-tooltip.entry.js +8 -6
  283. package/dist/esm/slide-62768431.js +25 -0
  284. package/dist/post-components/index.esm.js +1 -1
  285. package/dist/post-components/p-017dc6c7.js +1 -0
  286. package/dist/post-components/p-0227b899.js +1 -0
  287. package/dist/post-components/p-04895a54.js +1 -0
  288. package/dist/post-components/p-04c38bfe.entry.js +1 -0
  289. package/dist/post-components/p-07a0a626.js +1 -0
  290. package/dist/post-components/p-12573893.js +1 -0
  291. package/dist/post-components/p-1289b0a7.entry.js +1 -0
  292. package/dist/post-components/p-12a11565.js +1 -0
  293. package/dist/post-components/p-1542a80e.entry.js +1 -0
  294. package/dist/post-components/p-181c73d5.js +1 -0
  295. package/dist/post-components/p-254a9bd2.entry.js +1 -0
  296. package/dist/post-components/p-28500934.entry.js +1 -0
  297. package/dist/post-components/p-2b1281af.js +1 -0
  298. package/dist/post-components/p-2c69e7f2.entry.js +1 -0
  299. package/dist/post-components/p-30132b19.entry.js +1 -0
  300. package/dist/post-components/p-30af1d48.js +1 -0
  301. package/dist/post-components/p-3bdeb686.entry.js +1 -0
  302. package/dist/post-components/p-47cb31dd.js +1 -0
  303. package/dist/post-components/p-4af6dbed.js +1 -0
  304. package/dist/post-components/p-4f41f63e.js +1 -0
  305. package/dist/post-components/p-52790b8b.js +1 -0
  306. package/dist/post-components/p-5959f2bd.js +1 -0
  307. package/dist/post-components/{p-82dcf8c6.js → p-59ca0a13.js} +3 -3
  308. package/dist/post-components/p-5aaa5703.entry.js +1 -0
  309. package/dist/post-components/p-64e3de38.js +1 -0
  310. package/dist/post-components/p-67a45f16.js +1 -0
  311. package/dist/post-components/p-6d8ac9bd.entry.js +1 -0
  312. package/dist/post-components/p-7709c14a.js +1 -0
  313. package/dist/post-components/p-77cc2a5e.entry.js +1 -0
  314. package/dist/post-components/p-79c552fb.js +1 -0
  315. package/dist/post-components/p-7dd05e6d.entry.js +1 -0
  316. package/dist/post-components/p-803b7598.js +1 -0
  317. package/dist/post-components/p-85fdc2d3.js +1 -0
  318. package/dist/post-components/p-9748a355.js +1 -0
  319. package/dist/post-components/p-98fcf90b.entry.js +1 -0
  320. package/dist/post-components/p-994fae4c.entry.js +1 -0
  321. package/dist/post-components/p-a805515a.entry.js +1 -0
  322. package/dist/post-components/p-b5b48f66.entry.js +1 -0
  323. package/dist/post-components/p-b9bf5a5f.js +1 -0
  324. package/dist/post-components/p-c6b3a926.js +1 -0
  325. package/dist/post-components/p-c9dd3cdb.entry.js +1 -0
  326. package/dist/post-components/p-cb5e4a06.js +1 -0
  327. package/dist/post-components/p-d45df336.js +1 -0
  328. package/dist/post-components/p-dd4a5c0a.entry.js +1 -0
  329. package/dist/post-components/p-e1baac59.js +1 -0
  330. package/dist/post-components/p-e585c6fe.js +1 -0
  331. package/dist/post-components/p-e6d54838.entry.js +1 -0
  332. package/dist/post-components/p-f4b0cc7d.js +1 -0
  333. package/dist/post-components/p-fc91cbc2.js +1 -0
  334. package/dist/post-components/p-fe8c300c.js +1 -0
  335. package/dist/post-components/p-ff95dcd3.js +2 -0
  336. package/dist/post-components/post-components.esm.js +1 -1
  337. package/dist/types/animations/collapse.d.ts +2 -2
  338. package/dist/types/animations/fade.d.ts +2 -2
  339. package/dist/types/animations/slide.d.ts +2 -0
  340. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +8 -2
  341. package/dist/types/components/post-avatar/post-avatar.d.ts +51 -0
  342. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +19 -0
  343. package/dist/types/components/post-banner/banner-types.d.ts +2 -0
  344. package/dist/types/components/post-banner/post-banner.d.ts +49 -0
  345. package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
  346. package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +20 -0
  347. package/dist/types/components/post-card-control/post-card-control.d.ts +9 -9
  348. package/dist/types/components/post-closebutton/post-closebutton.d.ts +7 -0
  349. package/dist/types/components/post-footer/post-footer.d.ts +23 -0
  350. package/dist/types/components/post-header/post-header.d.ts +45 -0
  351. package/dist/types/components/post-icon/post-icon.d.ts +14 -12
  352. package/dist/types/components/post-language-option/post-language-option.d.ts +45 -0
  353. package/dist/types/components/post-language-switch/post-language-switch.d.ts +31 -0
  354. package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
  355. package/dist/types/components/post-linkarea/post-linkarea.d.ts +5 -0
  356. package/dist/types/components/post-list/post-list.d.ts +24 -0
  357. package/dist/types/components/post-list-item/post-list-item.d.ts +8 -0
  358. package/dist/types/components/post-logo/post-logo.d.ts +1 -1
  359. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +70 -0
  360. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +57 -0
  361. package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +31 -0
  362. package/dist/types/components/post-menu/post-menu.d.ts +48 -0
  363. package/dist/types/components/post-menu-item/post-menu-item.d.ts +3 -0
  364. package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +28 -0
  365. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +23 -1
  366. package/dist/types/components/post-tab-header/post-tab-header.d.ts +1 -1
  367. package/dist/types/components/post-tabs/post-tabs.d.ts +1 -1
  368. package/dist/types/components/post-tag/post-tag.d.ts +1 -1
  369. package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +15 -0
  370. package/dist/types/components.d.ts +609 -48
  371. package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/.config/bindings.angular.d.ts +2 -0
  372. package/dist/types/index.d.ts +22 -3
  373. package/dist/types/utils/attribute-observer.d.ts +1 -1
  374. package/dist/types/utils/breakpoints.d.ts +12 -0
  375. package/dist/types/utils/component-on-ready.d.ts +1 -1
  376. package/dist/types/utils/get-focusable-children.d.ts +1 -0
  377. package/dist/types/utils/get-root.d.ts +1 -1
  378. package/dist/types/utils/property-checkers/check-non-empty.d.ts +3 -1
  379. package/dist/types/utils/property-checkers/check-one-of.d.ts +3 -1
  380. package/dist/types/utils/property-checkers/check-pattern.d.ts +3 -1
  381. package/dist/types/utils/property-checkers/check-type.d.ts +3 -1
  382. package/dist/types/utils/property-checkers/check-url.d.ts +3 -1
  383. package/dist/types/utils/property-checkers/index.d.ts +12 -4
  384. package/dist/types/utils/sass-export.d.ts +5 -1
  385. package/loaders/attribute-observer.js +4 -4
  386. package/loaders/check-non-empty.js +6 -2
  387. package/loaders/check-one-of.js +8 -3
  388. package/loaders/check-type.js +11 -6
  389. package/loaders/debounce.js +11 -0
  390. package/loaders/fade.js +6 -2
  391. package/loaders/get-focusable-children.js +35 -0
  392. package/loaders/get-root.js +9 -0
  393. package/loaders/index.browser.js +13 -0
  394. package/loaders/index.d.ts +40 -2
  395. package/loaders/index.js +21 -2
  396. package/loaders/index2.js +25 -12
  397. package/loaders/index3.js +135 -0
  398. package/loaders/package.js +1 -1
  399. package/loaders/post-accordion-item.js +1 -81
  400. package/loaders/post-accordion-item2.js +103 -0
  401. package/loaders/post-accordion.js +6 -5
  402. package/loaders/post-avatar.d.ts +11 -0
  403. package/loaders/post-avatar.js +172 -0
  404. package/loaders/post-back-to-top.d.ts +11 -0
  405. package/loaders/post-back-to-top.js +104 -0
  406. package/loaders/post-banner.d.ts +11 -0
  407. package/loaders/post-banner.js +134 -0
  408. package/loaders/post-breadcrumb-item.d.ts +11 -0
  409. package/loaders/post-breadcrumb-item.js +6 -0
  410. package/loaders/post-breadcrumb-item2.js +82 -0
  411. package/loaders/post-breadcrumb.d.ts +11 -0
  412. package/loaders/post-breadcrumb.js +172 -0
  413. package/loaders/post-card-control.js +50 -39
  414. package/loaders/post-closebutton.d.ts +11 -0
  415. package/loaders/post-closebutton.js +37 -0
  416. package/loaders/post-collapsible-trigger2.js +23 -38
  417. package/loaders/post-collapsible2.js +21 -13
  418. package/loaders/post-footer.d.ts +11 -0
  419. package/loaders/post-footer.js +131 -0
  420. package/loaders/post-header.d.ts +11 -0
  421. package/loaders/post-header.js +220 -0
  422. package/loaders/post-icon2.js +82 -46
  423. package/loaders/post-language-option.d.ts +11 -0
  424. package/loaders/post-language-option.js +105 -0
  425. package/loaders/post-language-switch.d.ts +11 -0
  426. package/loaders/post-language-switch.js +138 -0
  427. package/loaders/post-linkarea.d.ts +11 -0
  428. package/loaders/post-linkarea.js +45 -0
  429. package/loaders/post-list-item.d.ts +11 -0
  430. package/loaders/post-list-item.js +38 -0
  431. package/loaders/{post-alert.d.ts → post-list.d.ts} +4 -4
  432. package/loaders/post-list.js +58 -0
  433. package/loaders/post-logo.js +6 -6
  434. package/loaders/post-mainnavigation.d.ts +11 -0
  435. package/loaders/post-mainnavigation.js +261 -0
  436. package/loaders/post-megadropdown-trigger.d.ts +11 -0
  437. package/loaders/post-megadropdown-trigger.js +116 -0
  438. package/loaders/post-megadropdown.d.ts +11 -0
  439. package/loaders/post-megadropdown.js +189 -0
  440. package/loaders/post-menu-item.d.ts +11 -0
  441. package/loaders/post-menu-item.js +6 -0
  442. package/loaders/post-menu-item2.js +27 -0
  443. package/loaders/post-menu-trigger.d.ts +11 -0
  444. package/loaders/post-menu-trigger.js +6 -0
  445. package/loaders/post-menu-trigger2.js +109 -0
  446. package/loaders/post-menu.d.ts +11 -0
  447. package/loaders/post-menu.js +6 -0
  448. package/loaders/post-menu2.js +193 -0
  449. package/loaders/post-popover.js +6 -4
  450. package/loaders/post-popovercontainer2.js +227 -59
  451. package/loaders/post-rating.js +14 -4
  452. package/loaders/post-tab-header.js +7 -6
  453. package/loaders/post-tab-panel.js +4 -3
  454. package/loaders/post-tabs.js +20 -13
  455. package/loaders/post-tag.js +3 -3
  456. package/loaders/post-togglebutton.d.ts +11 -0
  457. package/loaders/post-togglebutton.js +64 -0
  458. package/loaders/post-tooltip.js +34 -21
  459. package/loaders/slide.js +25 -0
  460. package/package.json +26 -20
  461. package/dist/cjs/check-non-empty-eeaa8f77.js +0 -11
  462. package/dist/cjs/check-one-of-f4f5d0c0.js +0 -8
  463. package/dist/cjs/fade-35a3633a.js +0 -10
  464. package/dist/cjs/index-01f30442.js +0 -52
  465. package/dist/cjs/post-accordion-item-7b348fa5.js +0 -51
  466. package/dist/cjs/post-alert-fca3a4a3.js +0 -98
  467. package/dist/cjs/post-alert.cjs.entry.js +0 -16
  468. package/dist/cjs/post-card-control-b4e4b4d5.js +0 -272
  469. package/dist/cjs/post-icon-3934be0b.js +0 -104
  470. package/dist/cjs/post-icon.cjs.entry.js +0 -15
  471. package/dist/cjs/post-logo-c3603fc7.js +0 -39
  472. package/dist/cjs/post-logo.cjs.entry.js +0 -14
  473. package/dist/cjs/post-popover-15f9620a.js +0 -104
  474. package/dist/cjs/post-popovercontainer-7d536276.js +0 -2186
  475. package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
  476. package/dist/cjs/post-tab-header-29b8d4e1.js +0 -32
  477. package/dist/cjs/post-tag-b7d0bbff.js +0 -47
  478. package/dist/collection/components/post-alert/alert-types.js +0 -1
  479. package/dist/collection/components/post-alert/post-alert.css +0 -7
  480. package/dist/components/post-alert.js +0 -6
  481. package/dist/components/post-alert2.js +0 -136
  482. package/dist/esm/check-non-empty-58bd6b17.js +0 -9
  483. package/dist/esm/check-one-of-6b3ef8eb.js +0 -6
  484. package/dist/esm/fade-7fd71785.js +0 -7
  485. package/dist/esm/index-f41b763f.js +0 -46
  486. package/dist/esm/package-3d758f77.js +0 -3
  487. package/dist/esm/post-accordion-item-6b5a65ad.js +0 -49
  488. package/dist/esm/post-alert-f19db551.js +0 -96
  489. package/dist/esm/post-alert.entry.js +0 -8
  490. package/dist/esm/post-card-control-1b5df6cb.js +0 -270
  491. package/dist/esm/post-icon-40929043.js +0 -102
  492. package/dist/esm/post-icon.entry.js +0 -7
  493. package/dist/esm/post-logo-c6351ba8.js +0 -37
  494. package/dist/esm/post-logo.entry.js +0 -6
  495. package/dist/esm/post-popover-58149de7.js +0 -102
  496. package/dist/esm/post-popovercontainer-8bde9fc3.js +0 -2184
  497. package/dist/esm/post-popovercontainer.entry.js +0 -3
  498. package/dist/esm/post-tab-header-ae8feb19.js +0 -30
  499. package/dist/esm/post-tag-887d5fbe.js +0 -45
  500. package/dist/post-components/p-0b71bf5a.js +0 -1
  501. package/dist/post-components/p-0e09dc41.js +0 -1
  502. package/dist/post-components/p-19e54be9.js +0 -1
  503. package/dist/post-components/p-1e8f0f36.js +0 -1
  504. package/dist/post-components/p-22257eff.entry.js +0 -1
  505. package/dist/post-components/p-249ac168.entry.js +0 -1
  506. package/dist/post-components/p-2737eaf5.js +0 -1
  507. package/dist/post-components/p-2b10e265.js +0 -1
  508. package/dist/post-components/p-3325086e.js +0 -1
  509. package/dist/post-components/p-3b823fee.entry.js +0 -1
  510. package/dist/post-components/p-45f4c803.entry.js +0 -1
  511. package/dist/post-components/p-47935dbb.js +0 -1
  512. package/dist/post-components/p-486fbbce.entry.js +0 -1
  513. package/dist/post-components/p-4a7fb0f3.entry.js +0 -1
  514. package/dist/post-components/p-5f231c2c.js +0 -1
  515. package/dist/post-components/p-611b3c41.js +0 -1
  516. package/dist/post-components/p-6a28f8b9.js +0 -1
  517. package/dist/post-components/p-6adeaa6c.js +0 -1
  518. package/dist/post-components/p-6ed3497a.entry.js +0 -1
  519. package/dist/post-components/p-820c5c19.entry.js +0 -1
  520. package/dist/post-components/p-8aeb549f.entry.js +0 -1
  521. package/dist/post-components/p-92aeec3c.js +0 -1
  522. package/dist/post-components/p-9a99cfc7.js +0 -1
  523. package/dist/post-components/p-aa8a08dc.entry.js +0 -1
  524. package/dist/post-components/p-b095519d.js +0 -1
  525. package/dist/post-components/p-b99fdec3.js +0 -1
  526. package/dist/post-components/p-ba40b28a.entry.js +0 -1
  527. package/dist/post-components/p-c62de925.js +0 -1
  528. package/dist/post-components/p-d2101b8a.entry.js +0 -1
  529. package/dist/post-components/p-d2f9de94.js +0 -2
  530. package/dist/post-components/p-d7a44f45.js +0 -1
  531. package/dist/post-components/p-db4b8ea1.entry.js +0 -1
  532. package/dist/post-components/p-deb4131c.js +0 -1
  533. package/dist/post-components/p-eedc6ae8.entry.js +0 -1
  534. package/dist/post-components/p-f217f420.js +0 -1
  535. package/dist/post-components/p-f707d163.entry.js +0 -1
  536. package/dist/types/components/post-alert/alert-types.d.ts +0 -2
  537. package/dist/types/components/post-alert/post-alert.d.ts +0 -54
  538. package/loaders/post-alert.js +0 -139
@@ -0,0 +1,3845 @@
1
+ import { r as registerInstance, g as getElement, h, H as Host, c as createEvent } from './index-40846676.js';
2
+ import { v as version } from './package-5614c98b.js';
3
+ import { s as slideUp, a as slideDown } from './slide-62768431.js';
4
+ import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-8f8fe5b0.js';
5
+ import { c as checkNonEmpty } from './check-non-empty-258a56b3.js';
6
+ import { c as checkType } from './check-type-37d5d307.js';
7
+ import { n as nanoid } from './index.browser-51485f85.js';
8
+ import { g as getRoot } from './get-root-7af2e0d1.js';
9
+
10
+ const PostClosebutton = class {
11
+ constructor(hostRef) {
12
+ registerInstance(this, hostRef);
13
+ }
14
+ get host() { return getElement(this); }
15
+ render() {
16
+ return (h(Host, { key: 'c03f50379252ba13992bc3d021989ac07dba9f79', "data-version": version }, h("button", { key: 'e97a86bb6e1eace89a1a3a78fb231047f065dd5e', class: "btn btn-icon-close", type: "button" }, h("post-icon", { key: 'aca522d4c251a8183c91c2bd4d810d0716a2fe13', "aria-hidden": "true", name: "closex" }), h("span", { key: '6873522961b1683d1261163b07ee022f93eed836', class: "visually-hidden" }, h("slot", { key: 'bf4b13356c9a0164f1481d1fedc3a78a53e5f8e0' })))));
17
+ }
18
+ };
19
+
20
+ /* eslint-disable no-undefined,no-param-reassign,no-shadow */
21
+
22
+ /**
23
+ * Throttle execution of a function. Especially useful for rate limiting
24
+ * execution of handlers on events like resize and scroll.
25
+ *
26
+ * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
27
+ * are most useful.
28
+ * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
29
+ * as-is, to `callback` when the throttled-function is executed.
30
+ * @param {object} [options] - An object to configure options.
31
+ * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
32
+ * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
33
+ * one final time after the last throttled-function call. (After the throttled-function has not been called for
34
+ * `delay` milliseconds, the internal counter is reset).
35
+ * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
36
+ * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
37
+ * callback will never executed if both noLeading = true and noTrailing = true.
38
+ * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
39
+ * false (at end), schedule `callback` to execute after `delay` ms.
40
+ *
41
+ * @returns {Function} A new, throttled, function.
42
+ */
43
+ function throttle (delay, callback, options) {
44
+ var _ref = options || {},
45
+ _ref$noTrailing = _ref.noTrailing,
46
+ noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
47
+ _ref$noLeading = _ref.noLeading,
48
+ noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
49
+ _ref$debounceMode = _ref.debounceMode,
50
+ debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
51
+ /*
52
+ * After wrapper has stopped being called, this timeout ensures that
53
+ * `callback` is executed at the proper times in `throttle` and `end`
54
+ * debounce modes.
55
+ */
56
+ var timeoutID;
57
+ var cancelled = false;
58
+
59
+ // Keep track of the last time `callback` was executed.
60
+ var lastExec = 0;
61
+
62
+ // Function to clear existing timeout
63
+ function clearExistingTimeout() {
64
+ if (timeoutID) {
65
+ clearTimeout(timeoutID);
66
+ }
67
+ }
68
+
69
+ // Function to cancel next exec
70
+ function cancel(options) {
71
+ var _ref2 = options || {},
72
+ _ref2$upcomingOnly = _ref2.upcomingOnly,
73
+ upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
74
+ clearExistingTimeout();
75
+ cancelled = !upcomingOnly;
76
+ }
77
+
78
+ /*
79
+ * The `wrapper` function encapsulates all of the throttling / debouncing
80
+ * functionality and when executed will limit the rate at which `callback`
81
+ * is executed.
82
+ */
83
+ function wrapper() {
84
+ for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
85
+ arguments_[_key] = arguments[_key];
86
+ }
87
+ var self = this;
88
+ var elapsed = Date.now() - lastExec;
89
+ if (cancelled) {
90
+ return;
91
+ }
92
+
93
+ // Execute `callback` and update the `lastExec` timestamp.
94
+ function exec() {
95
+ lastExec = Date.now();
96
+ callback.apply(self, arguments_);
97
+ }
98
+
99
+ /*
100
+ * If `debounceMode` is true (at begin) this is used to clear the flag
101
+ * to allow future `callback` executions.
102
+ */
103
+ function clear() {
104
+ timeoutID = undefined;
105
+ }
106
+ if (!noLeading && debounceMode && !timeoutID) {
107
+ /*
108
+ * Since `wrapper` is being called for the first time and
109
+ * `debounceMode` is true (at begin), execute `callback`
110
+ * and noLeading != true.
111
+ */
112
+ exec();
113
+ }
114
+ clearExistingTimeout();
115
+ if (debounceMode === undefined && elapsed > delay) {
116
+ if (noLeading) {
117
+ /*
118
+ * In throttle mode with noLeading, if `delay` time has
119
+ * been exceeded, update `lastExec` and schedule `callback`
120
+ * to execute after `delay` ms.
121
+ */
122
+ lastExec = Date.now();
123
+ if (!noTrailing) {
124
+ timeoutID = setTimeout(debounceMode ? clear : exec, delay);
125
+ }
126
+ } else {
127
+ /*
128
+ * In throttle mode without noLeading, if `delay` time has been exceeded, execute
129
+ * `callback`.
130
+ */
131
+ exec();
132
+ }
133
+ } else if (noTrailing !== true) {
134
+ /*
135
+ * In trailing throttle mode, since `delay` time has not been
136
+ * exceeded, schedule `callback` to execute `delay` ms after most
137
+ * recent execution.
138
+ *
139
+ * If `debounceMode` is true (at begin), schedule `clear` to execute
140
+ * after `delay` ms.
141
+ *
142
+ * If `debounceMode` is false (at end), schedule `callback` to
143
+ * execute after `delay` ms.
144
+ */
145
+ timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
146
+ }
147
+ }
148
+ wrapper.cancel = cancel;
149
+
150
+ // Return the wrapper function.
151
+ return wrapper;
152
+ }
153
+
154
+ const focusableSelector = `:where(${[
155
+ 'button',
156
+ 'input:not([type="hidden"])',
157
+ '[tabindex]',
158
+ 'select',
159
+ 'textarea',
160
+ '[contenteditable]',
161
+ 'a[href]',
162
+ 'iframe',
163
+ 'audio[controls]',
164
+ 'video[controls]',
165
+ 'area[href]',
166
+ 'details > summary:first-of-type',
167
+ ].join(',')})`;
168
+ const focusDisablingSelector = `:where(${[
169
+ '[inert]',
170
+ '[inert] *',
171
+ ':disabled',
172
+ 'dialog:not([open]) *',
173
+ '[popover]:not(:popover-open) *',
174
+ 'details:not([open]) > *:not(details > summary:first-of-type)',
175
+ 'details:not([open]) > *:not(details > summary:first-of-type) *',
176
+ '[tabindex^="-"]',
177
+ '[hidden]:not([hidden="false"])',
178
+ ].join(',')})`;
179
+ function getFocusableChildren(element) {
180
+ const focusableChildren = element.querySelectorAll(`${focusableSelector}:not(${focusDisablingSelector})`);
181
+ const visibleFocusableChildren = Array.from(focusableChildren).filter(child => {
182
+ const style = window.getComputedStyle(child.parentElement);
183
+ return style.display !== 'none' && style.visibility !== 'hidden';
184
+ });
185
+ return visibleFocusableChildren;
186
+ }
187
+
188
+ const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}:host(:not(:has([slot=title]))) .local-header{padding-block-start:0}:host(:not(:has([slot=title]))) .local-sub{display:none}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;position:sticky;padding-inline:4px;height:var(--global-header-height)}@media screen and (max-width: 1023.98px){.global-header{z-index:3;inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{z-index:5;padding-inline-end:12px;inset-block-start:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.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-reduced-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 !important;list-style:none;display:flex;padding-left:0;gap:1rem;flex-shrink:0 !important}.local-header{display:flex;position:sticky;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px;min-height:var(--local-header-min-height);background:#fff;transition:box-shadow .2s ease-in-out;border-block-end:1px solid #e1e0dc}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--global-header-height);padding-block:12px;flex-wrap:wrap;gap:16px}.local-header.local-header-mobile-extended{border-bottom:1px solid #e1e0dc}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}::slotted(h1){margin:0 !important;flex-shrink:10;z-index:3}@media screen and (min-width: 600px){::slotted(h1){margin-inline-start:12px !important}}@media screen and (max-width: 599.98px){::slotted(h1){margin-inline-start:8px !important}}@media screen and (min-width: 1024px){::slotted(h1){font-size:28px !important}}@media screen and (max-width: 1023.98px){::slotted(h1){font-size:20px !important;max-width:calc(100vw - 8px - 16px)}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--global-header-reduced-height)}.navigation::before{display:block;content:\"\";position:absolute;inset:0;z-index:2;background:#fff}}@media screen and (max-width: 1023.98px){.navigation{position:fixed;z-index:1;inset-inline:0;background:#fff;inset-block-end:calc(100dvh - var(--header-height))}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:16px 24px;padding-inline:32px}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}.navigation.extended{height:calc(100dvh - var(--header-height));display:flex;flex-direction:column}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){background-color:#fafafa;gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}";
189
+ const PostHeaderStyle0 = postHeaderCss;
190
+
191
+ const PostHeader = class {
192
+ constructor(hostRef) {
193
+ registerInstance(this, hostRef);
194
+ this.postUpdateDevice = createEvent(this, "postUpdateDevice", 7);
195
+ this.device = null;
196
+ this.mobileMenuExtended = false;
197
+ }
198
+ firstFocusableEl;
199
+ lastFocusableEl;
200
+ scrollParent = null;
201
+ mobileMenu;
202
+ mobileMenuAnimation;
203
+ throttledScroll = () => this.handleScrollEvent();
204
+ throttledResize = throttle(50, () => this.handleResize());
205
+ componentWillRender() {
206
+ this.scrollParent = this.getScrollParent(this.host);
207
+ this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
208
+ window.addEventListener('resize', this.throttledResize, { passive: true });
209
+ this.handleResize();
210
+ this.handleScrollEvent();
211
+ this.getFocusableElements();
212
+ }
213
+ componentDidLoad() {
214
+ this.updateLocalHeaderHeight();
215
+ }
216
+ // Clean up possible side effects when post-header is disconnected
217
+ disconnectedCallback() {
218
+ this.mobileMenuExtended = false;
219
+ document.body.style.overflow = '';
220
+ this.host.removeEventListener('keydown', e => {
221
+ this.keyboardHandler(e);
222
+ });
223
+ }
224
+ get host() { return getElement(this); }
225
+ frozeBody(isMobileMenuExtended) {
226
+ document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
227
+ if (isMobileMenuExtended) {
228
+ this.host.addEventListener('keydown', e => {
229
+ this.keyboardHandler(e);
230
+ });
231
+ }
232
+ else {
233
+ this.host.removeEventListener('keydown', e => {
234
+ this.keyboardHandler(e);
235
+ });
236
+ }
237
+ }
238
+ /**
239
+ * An event emitted when the device has changed
240
+ */
241
+ postUpdateDevice;
242
+ /**
243
+ * Toggles the mobile navigation.
244
+ */
245
+ async toggleMobileMenu() {
246
+ if (this.device === 'desktop')
247
+ return;
248
+ this.mobileMenuAnimation = this.mobileMenuExtended
249
+ ? slideUp(this.mobileMenu)
250
+ : slideDown(this.mobileMenu);
251
+ // Update the state of the toggle button
252
+ const menuButton = this.host.querySelector('post-togglebutton');
253
+ menuButton.toggled = !this.mobileMenuExtended;
254
+ // Toggle menu visibility before it slides down and after it slides back up
255
+ if (this.mobileMenuExtended)
256
+ await this.mobileMenuAnimation.finished;
257
+ this.mobileMenuExtended = !this.mobileMenuExtended;
258
+ if (!this.mobileMenuExtended)
259
+ await this.mobileMenuAnimation.finished;
260
+ }
261
+ // Get all the focusable elements in the post-header mobile menu
262
+ getFocusableElements() {
263
+ // Get elements in the correct order (different as the DOM order)
264
+ const focusableEls = [
265
+ ...Array.from(this.host.querySelectorAll('.list-inline:not([slot="meta-navigation"]) > li')),
266
+ ...Array.from(this.host.querySelectorAll('nav > post-list > div > post-list-item, post-mainnavigation > .back-button, post-megadropdown-trigger')),
267
+ ...Array.from(this.host.querySelectorAll('.list-inline[slot="meta-navigation"] > li, post-language-option')),
268
+ ];
269
+ // Add the main toggle menu button to the list of focusable children
270
+ const focusableChildren = [
271
+ this.host.querySelector('post-togglebutton'),
272
+ ...focusableEls.flatMap(el => Array.from(getFocusableChildren(el))),
273
+ ];
274
+ this.firstFocusableEl = focusableChildren[0];
275
+ this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
276
+ }
277
+ keyboardHandler(e) {
278
+ if (e.key === 'Tab' && this.mobileMenuExtended) {
279
+ if (e.shiftKey && document.activeElement === this.firstFocusableEl) {
280
+ // If back tab (Tab + Shift) and first element is focused, focus goes to the last element of the megadropdown
281
+ e.preventDefault();
282
+ this.lastFocusableEl.focus();
283
+ }
284
+ else if (!e.shiftKey && document.activeElement === this.lastFocusableEl) {
285
+ // If Tab and last element is focused, focus goes back to the first element of the megadropdown
286
+ e.preventDefault();
287
+ this.firstFocusableEl.focus();
288
+ }
289
+ }
290
+ }
291
+ handleScrollEvent() {
292
+ // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
293
+ const st = Math.max(0, this.scrollParent instanceof Document
294
+ ? this.scrollParent.documentElement.scrollTop
295
+ : this.scrollParent.scrollTop);
296
+ this.host.style.setProperty('--header-scroll-top', `${st}px`);
297
+ }
298
+ getScrollParent(node) {
299
+ let currentParent = node.parentElement;
300
+ while (currentParent) {
301
+ if (currentParent.nodeName === 'BODY') {
302
+ return document;
303
+ }
304
+ if (this.isScrollable(currentParent)) {
305
+ return currentParent;
306
+ }
307
+ currentParent = currentParent.parentElement;
308
+ }
309
+ return document;
310
+ }
311
+ isScrollable(node) {
312
+ if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
313
+ return false;
314
+ }
315
+ const style = getComputedStyle(node);
316
+ return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
317
+ const value = style.getPropertyValue(propertyName);
318
+ return value === 'auto' || value === 'scroll';
319
+ });
320
+ }
321
+ updateLocalHeaderHeight() {
322
+ requestAnimationFrame(() => {
323
+ const mhh = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
324
+ this.host.style.setProperty('--local-header-height', `${mhh}px`);
325
+ });
326
+ }
327
+ handleResize() {
328
+ const previousDevice = this.device;
329
+ let newDevice;
330
+ const width = window?.innerWidth;
331
+ if (width >= 1024) {
332
+ newDevice = 'desktop';
333
+ }
334
+ else if (width >= 600) {
335
+ newDevice = 'tablet';
336
+ }
337
+ else {
338
+ newDevice = 'mobile';
339
+ }
340
+ // Close any open mobile menu
341
+ if (newDevice === 'desktop' && this.mobileMenuExtended) {
342
+ this.toggleMobileMenu();
343
+ this.mobileMenuAnimation.finish(); // no animation
344
+ }
345
+ this.updateLocalHeaderHeight();
346
+ // Apply only on change for doing work only when necessary
347
+ if (newDevice !== previousDevice) {
348
+ this.device = newDevice;
349
+ this.postUpdateDevice.emit(this.device);
350
+ window.requestAnimationFrame(() => {
351
+ this.switchLanguageSwitchMode();
352
+ });
353
+ }
354
+ }
355
+ switchLanguageSwitchMode() {
356
+ const variant = this.device === 'desktop' ? 'menu' : 'list';
357
+ Array.from(this.host.querySelectorAll('post-language-switch')).forEach(languageSwitch => {
358
+ languageSwitch?.setAttribute('variant', variant);
359
+ });
360
+ }
361
+ renderNavigation() {
362
+ const navigationClasses = ['navigation'];
363
+ if (this.mobileMenuExtended) {
364
+ navigationClasses.push('extended');
365
+ }
366
+ return (h("div", { ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, h("slot", { name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { class: "navigation-footer" }, h("slot", { name: "meta-navigation" }), h("slot", { name: "post-language-switch" })))));
367
+ }
368
+ render() {
369
+ return (h(Host, { key: '45452d2c2f6ac9a067ce71330ea898a797040cca', version: version }, h("div", { key: 'c50478141de45d0a718b18c0edc416eb9c832fde', class: "global-header" }, h("div", { key: 'a2ddc2de9a94fb3b16928fe9c1ac3b3ae61ff9bf', class: "global-sub" }, h("div", { key: '30083683ff7683202118471473f2a0ed98a1c920', class: "logo" }, h("slot", { key: '028bd4a8f03a228378b09a80dce8654d52c30e5c', name: "post-logo" }))), h("div", { key: '853bcf2e6c8a95d88f62795cef8d8e58c8996811', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '40e3027a4e4358b7a614558ed7e1f59fa65ed312', name: "meta-navigation" }), h("slot", { key: '31c141cc45aa12441557d9b817630328df3d3778', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'afe4b2c3123a89c1a4390578c22e89dfff7be655', name: "post-language-switch" }), h("div", { key: 'aea74d0c7f25288afa18b5aeb3e557216d695ec3', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '1efed8b7c823ef49b89120ed2e23f151c64b9c0e', name: "post-togglebutton" })))), h("div", { key: 'e09df2136d01c0516d0166f505055615cf1d70d3', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: '491f9bbcb2743519f544b24ae6f00405be85e589', name: "title" }), h("div", { key: 'e85c0a76597832a6966e989111b4508579fb9c4d', class: "local-sub" }, h("slot", { key: 'f2d504ea6a3d7592a15551e6be8cb0c1ba220fbc', name: "local-controls" }), h("slot", { key: 'e0dd0f9c12e0c6bf5d5d66cb29139af59f7c0b4d' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
370
+ }
371
+ static get watchers() { return {
372
+ "mobileMenuExtended": ["frozeBody"]
373
+ }; }
374
+ };
375
+ PostHeader.style = PostHeaderStyle0;
376
+
377
+ const postIconCss = ":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}: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)}}";
378
+ const PostIconStyle0 = postIconCss;
379
+
380
+ const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons/';
381
+ const ANIMATION_NAMES = [
382
+ 'cylon',
383
+ 'cylon-vertical',
384
+ 'spin',
385
+ 'spin-reverse',
386
+ 'fade',
387
+ 'throb',
388
+ ];
389
+ const ANIMATION_KEYS = [...ANIMATION_NAMES];
390
+ const PostIcon = class {
391
+ constructor(hostRef) {
392
+ registerInstance(this, hostRef);
393
+ this.animation = null;
394
+ this.base = null;
395
+ this.flipH = false;
396
+ this.flipV = false;
397
+ this.name = undefined;
398
+ this.rotate = null;
399
+ this.scale = null;
400
+ }
401
+ isSSR = typeof window === 'undefined';
402
+ get host() { return getElement(this); }
403
+ validateAnimation(newValue = this.animation) {
404
+ if (newValue !== undefined)
405
+ checkEmptyOrOneOf(this, 'animation', ANIMATION_KEYS);
406
+ }
407
+ validateBase() {
408
+ checkEmptyOrType(this, 'base', 'string');
409
+ }
410
+ validateFlipH() {
411
+ checkEmptyOrType(this, 'flipH', 'boolean');
412
+ }
413
+ validateFlipV() {
414
+ checkEmptyOrType(this, 'flipV', 'boolean');
415
+ }
416
+ validateName() {
417
+ checkNonEmpty(this, 'name');
418
+ checkType(this, 'name', 'string');
419
+ }
420
+ validateRotate() {
421
+ checkEmptyOrType(this, 'rotate', 'number');
422
+ }
423
+ validateScale() {
424
+ checkEmptyOrType(this, 'scale', 'number');
425
+ }
426
+ // Construct the icon url from different possible sources
427
+ getUrl() {
428
+ let url;
429
+ const file = `${this.name}.svg`;
430
+ // the first definition object which defines a domain, will be used to set the domain of the file url
431
+ // the first definition object which defines a slug, will be used to set the slug of the file url
432
+ const urlDefinitions = [this.getUrlDefinition(this.base, 'both')];
433
+ if (!this.isSSR) {
434
+ urlDefinitions.push(this.getUrlDefinition(document.head
435
+ .querySelector('meta[name="design-system-settings"][data-post-icon-base]')
436
+ ?.getAttribute('data-post-icon-base'), 'relative'));
437
+ urlDefinitions.push(this.getUrlDefinition(document.querySelector('base[href]')?.getAttribute('href'), 'both'));
438
+ }
439
+ // in case no definition defines a domain, a relative url is used to load the icon
440
+ const origin = urlDefinitions.find(d => d.definesDomain)?.url?.origin;
441
+ // in case no definition defines a slug either, the cdn url is used as a fallback
442
+ const slug = urlDefinitions.find(d => d.definesSlug)?.url?.pathname;
443
+ if (origin && slug) {
444
+ url = `${origin}${slug}${file}`;
445
+ }
446
+ else if (!origin && slug) {
447
+ url = `${slug}${file}`;
448
+ }
449
+ else {
450
+ url = `${CDN_URL}${file}`;
451
+ }
452
+ return url;
453
+ }
454
+ getUrlDefinition(url, allow) {
455
+ return {
456
+ url: this.getUrlObject(url),
457
+ definesDomain: allow !== 'relative' ? this.definesDomain(url) : false,
458
+ definesSlug: allow !== 'absolute' ? this.definesSlug(url) : false,
459
+ };
460
+ }
461
+ getUrlObject(url) {
462
+ if (url) {
463
+ url = url?.endsWith('/') ? url : `${url}/`;
464
+ return new URL(url, 'https://url.base');
465
+ }
466
+ else {
467
+ return null;
468
+ }
469
+ }
470
+ definesDomain(url) {
471
+ return url ? /^https?:\/\//.test(url) : false;
472
+ }
473
+ definesSlug(url) {
474
+ return Boolean(/^\/.+/.test(this.getUrlObject(url)?.pathname));
475
+ }
476
+ getStyles() {
477
+ const url = this.getUrl();
478
+ return Object.entries({
479
+ '-webkit-mask-image': `url(${url})`,
480
+ 'mask-image': `url('${url}')`,
481
+ 'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
482
+ (this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
483
+ })
484
+ .filter(([_key, value]) => value !== null)
485
+ .reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
486
+ }
487
+ componentDidLoad() {
488
+ this.validateBase();
489
+ this.validateName();
490
+ this.validateFlipH();
491
+ this.validateFlipV();
492
+ this.validateScale();
493
+ this.validateRotate();
494
+ this.validateAnimation();
495
+ }
496
+ render() {
497
+ return (h(Host, { key: 'c80aaf693f730902c4ae57ca78360eee5dedf624', "data-version": version }, h("span", { key: '7e01e1cf7e4fec380e8f054d3cc8fa5404c7a829', style: this.getStyles() })));
498
+ }
499
+ static get watchers() { return {
500
+ "animation": ["validateAnimation"],
501
+ "base": ["validateBase"],
502
+ "flipH": ["validateFlipH"],
503
+ "flipV": ["validateFlipV"],
504
+ "name": ["validateName"],
505
+ "rotate": ["validateRotate"],
506
+ "scale": ["validateScale"]
507
+ }; }
508
+ };
509
+ PostIcon.style = PostIconStyle0;
510
+
511
+ const postLanguageOptionCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-language-option{display:inline-block}post-language-option button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option button{background-color:ButtonFace !important}post-language-option button:hover{background-color:Highlight !important}}post-language-option a{color:inherit;text-decoration:none}post-language-option :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:2px;text-transform:uppercase}post-language-option :is(a,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-language-option :is(a,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-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-option :is(a,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-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-option:where([variant=list]) :is(a,button){padding-inline:0;width:40px;height:40px;border-radius:2px}post-language-option:where([variant=list]) :is(a,button):hover{color:#504f4b}post-language-option:where([variant=list]):not([active=false]) :is(a,button){background-color:#050400 !important;color:#fff;pointer-events:none}post-language-option:where([variant=list]):not([active=false]) :hover{color:#fff}post-language-option:where([variant=menu]){width:100%}post-language-option:where([variant=menu]):not([active=false]){display:none}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative;width:100%}post-language-option:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}";
512
+ const PostLanguageOptionStyle0 = postLanguageOptionCss;
513
+
514
+ const PostLanguageOption = class {
515
+ constructor(hostRef) {
516
+ registerInstance(this, hostRef);
517
+ this.postChange = createEvent(this, "postChange", 7);
518
+ this.code = undefined;
519
+ this.active = undefined;
520
+ this.variant = undefined;
521
+ this.name = undefined;
522
+ this.url = undefined;
523
+ }
524
+ get host() { return getElement(this); }
525
+ validateCode() {
526
+ checkType(this, 'code', 'string');
527
+ }
528
+ validateActiveProp() {
529
+ checkEmptyOrType(this, 'active', 'boolean');
530
+ }
531
+ validateName() {
532
+ checkEmptyOrType(this, 'name', 'string');
533
+ }
534
+ validateUrl() {
535
+ checkEmptyOrType(this, 'url', 'string');
536
+ }
537
+ componentDidLoad() {
538
+ this.validateCode();
539
+ this.validateActiveProp();
540
+ this.validateName();
541
+ this.validateUrl();
542
+ if (!this.name && this.isNameRequired()) {
543
+ throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
544
+ }
545
+ }
546
+ /**
547
+ * An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
548
+ */
549
+ postChange;
550
+ /**
551
+ * Selects the language option programmatically.
552
+ */
553
+ async select() {
554
+ this.active = true;
555
+ this.emitChange();
556
+ }
557
+ emitChange() {
558
+ this.postChange.emit(this.code);
559
+ }
560
+ isNameRequired() {
561
+ return this.host.textContent.toLowerCase() === this.code.toLowerCase();
562
+ }
563
+ render() {
564
+ const lang = this.code.toLowerCase();
565
+ const emitOnKeyDown = (e) => {
566
+ if (e.key === 'Enter' || e.key === ' ') {
567
+ this.emitChange();
568
+ }
569
+ };
570
+ return (h(Host, { key: 'f987cfc18bb86866781e0668516e86f89be6241b', "data-version": version, role: this.variant ? `${this.variant}item` : null }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
571
+ }
572
+ static get watchers() { return {
573
+ "code": ["validateCode"],
574
+ "active": ["validateActiveProp"],
575
+ "name": ["validateName"],
576
+ "url": ["validateUrl"]
577
+ }; }
578
+ };
579
+ PostLanguageOption.style = PostLanguageOptionStyle0;
580
+
581
+ const SWITCH_VARIANTS = ['list', 'menu'];
582
+
583
+ const postLanguageSwitchCss = ":host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-dropdown-container>*{width:100%}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.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:16px;width:16px}.post-language-switch-trigger[aria-expanded=true]{background-color:#050400;color:#fff}.post-language-switch-trigger[aria-expanded=true] post-icon{transform:rotate(180deg)}.post-language-switch-trigger[aria-expanded=true]:hover{background-color:#504f4b;color:#fff}";
584
+ const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
585
+
586
+ const PostLanguageSwitch = class {
587
+ constructor(hostRef) {
588
+ registerInstance(this, hostRef);
589
+ this.caption = undefined;
590
+ this.description = undefined;
591
+ this.variant = 'list';
592
+ this.activeLang = undefined;
593
+ }
594
+ get host() { return getElement(this); }
595
+ validateCaption() {
596
+ checkType(this, 'caption', 'string');
597
+ }
598
+ validateDescription() {
599
+ checkType(this, 'description', 'string');
600
+ }
601
+ validateVariant() {
602
+ checkEmptyOrOneOf(this, 'variant', SWITCH_VARIANTS);
603
+ }
604
+ connectedCallback() {
605
+ this.updateChildrenVariant();
606
+ // Get the active language based on children's active state
607
+ const activeLanguageOption = this.host.querySelector('post-language-option[active]:not([active="false"])');
608
+ if (activeLanguageOption)
609
+ this.activeLang = activeLanguageOption.getAttribute('code');
610
+ }
611
+ // Update post-language-option variant to have the correct style
612
+ updateChildrenVariant() {
613
+ this.host.querySelectorAll('post-language-option').forEach(el => {
614
+ el.setAttribute('variant', this.variant);
615
+ });
616
+ }
617
+ componentWillUpdate() {
618
+ this.updateChildrenVariant();
619
+ }
620
+ componentDidLoad() {
621
+ this.validateCaption();
622
+ this.validateDescription();
623
+ this.validateVariant();
624
+ // Detects a change in the active language
625
+ this.host.addEventListener('postChange', (el) => {
626
+ this.activeLang = el.detail;
627
+ // Update the active state in the children post-language-option components
628
+ this.host.querySelectorAll('post-language-option').forEach(lang => {
629
+ if (lang.code && lang.code === this.activeLang) {
630
+ lang.setAttribute('active', 'true');
631
+ }
632
+ else {
633
+ lang.setAttribute('active', 'false');
634
+ }
635
+ });
636
+ // Hides the dropdown when an option has been clicked
637
+ if (this.variant === 'menu') {
638
+ const menu = this.host.shadowRoot.querySelector('post-menu');
639
+ menu.toggle(menu);
640
+ }
641
+ });
642
+ }
643
+ menuId = `p${nanoid(11)}`;
644
+ renderList() {
645
+ return (h(Host, { "data-version": version, role: "list", "aria-label": this.caption }, h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, h("slot", null))));
646
+ }
647
+ renderDropdown() {
648
+ return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, h("slot", null))));
649
+ }
650
+ render() {
651
+ return this.variant === 'list' ? this.renderList() : this.renderDropdown();
652
+ }
653
+ static get watchers() { return {
654
+ "caption": ["validateCaption"],
655
+ "description": ["validateDescription"],
656
+ "variant": ["validateVariant"]
657
+ }; }
658
+ };
659
+ PostLanguageSwitch.style = PostLanguageSwitchStyle0;
660
+
661
+ 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}";
662
+ const PostListStyle0 = postListCss;
663
+
664
+ const PostList = class {
665
+ constructor(hostRef) {
666
+ registerInstance(this, hostRef);
667
+ this.titleId = undefined;
668
+ this.titleHidden = false;
669
+ this.horizontal = false;
670
+ }
671
+ get host() { return getElement(this); }
672
+ titleEl;
673
+ componentWillLoad() {
674
+ /**
675
+ * Get the id set on the host element or use a random id by default
676
+ */
677
+ this.titleId = `title-${this.host.id || nanoid(6)}`;
678
+ }
679
+ componentDidLoad() {
680
+ this.checkTitle();
681
+ }
682
+ checkTitle() {
683
+ if (!this.titleEl.textContent.trim()) {
684
+ console.error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
685
+ }
686
+ }
687
+ render() {
688
+ return (h(Host, { key: '085a63d7b4cc85461f2c8fd0c7b9d9f48f42055a', "data-version": version }, h("div", { key: 'd13a66ba16b71eff1a86666b04ca2f41957962e1', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: '0270bcd71c8a3a34390b98b6374a1a2f06e0d606' })), h("div", { key: 'de04b08bf94900435c53f972c8fcd0798c8a5faf', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: 'f7aa9976b3283ee4da3d32d84b36e2549c29e80f', name: "post-list-item" }))));
689
+ }
690
+ };
691
+ PostList.style = PostListStyle0;
692
+
693
+ const postListItemCss = ":host{display:flex}";
694
+ const PostListItemStyle0 = postListItemCss;
695
+
696
+ const PostListItem = class {
697
+ constructor(hostRef) {
698
+ registerInstance(this, hostRef);
699
+ }
700
+ get host() { return getElement(this); }
701
+ connectedCallback() {
702
+ this.host.setAttribute('slot', 'post-list-item');
703
+ }
704
+ render() {
705
+ return (h(Host, { key: '8e209e77859bd05d62cae41aec9dec6fb2e820cb', role: "listitem", slot: "post-list-item" }, h("slot", { key: 'ce79a335e80401465b74208957e22983d6df4ce0' })));
706
+ }
707
+ };
708
+ PostListItem.style = PostListItemStyle0;
709
+
710
+ 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}.logo-link{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}.logo-link: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){.logo-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.logo-link: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){.logo-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.logo-link :focus,:focus-visible{border-radius:2px}";
711
+ const PostLogoStyle0 = postLogoCss;
712
+
713
+ const PostLogo = class {
714
+ constructor(hostRef) {
715
+ registerInstance(this, hostRef);
716
+ this.url = undefined;
717
+ }
718
+ get host() { return getElement(this); }
719
+ validateUrl() {
720
+ checkEmptyOrUrl(this, 'url');
721
+ }
722
+ componentDidLoad() {
723
+ this.validateUrl();
724
+ this.checkDescription();
725
+ }
726
+ checkDescription() {
727
+ if (!this.host.textContent) {
728
+ console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
729
+ }
730
+ }
731
+ render() {
732
+ const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
733
+ const LogoTag = logoLink ? 'a' : 'span';
734
+ return (h(Host, { key: '128604612a51624b537f30b0b9c91d9ea6b950be', "data-version": version }, h(LogoTag, { key: '885f057200f9da839fd38cb7070f319f6c89793e', class: `logo ${logoLink ? 'logo-link' : ''}`, ...(logoLink ? { href: logoLink } : {}) }, h("span", { key: 'bee12585bf74fe5c2ce8a644c540c86626295526', class: "description" }, h("slot", { key: 'e516075c5138cef9378d3dc7137eb6c28d02b279', onSlotchange: () => this.checkDescription() })), h("svg", { key: 'c0056463b93f7c0e5da07db4656d9c8dc9161c32', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: '1dfc33886c9b1fb6cd3b08f448a89c11a6080598', id: "Logo" }, h("rect", { key: 'dd84426568259714379a92a3f56349c6b3220a61', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '56fa6445c184a41355a968365098b75387a16f48', 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" }), h("path", { key: 'f2abb1db77a2e795f477662453d7296a28882756', 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" }))))));
735
+ }
736
+ static get watchers() { return {
737
+ "url": ["validateUrl"]
738
+ }; }
739
+ };
740
+ PostLogo.style = PostLogoStyle0;
741
+
742
+ 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:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button{background-color:ButtonFace !important}post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:Highlight !important}}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 post-megadropdown-trigger button{flex:0 0 fit-content;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a: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 post-megadropdown-trigger button:focus-visible{border-radius:4px}post-mainnavigation .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.98px){post-mainnavigation .back-button{font-size:16px}}@media screen and (max-width: 599.98px){post-mainnavigation .back-button{font-size:14px}}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{content:\"\";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:24px;width:24px}@media screen and (min-width: 1024px){post-mainnavigation{display:block}post-mainnavigation nav{max-width:100vw;background:#fff;max-height:var(--main-navigation-height);user-select:none;transition:margin 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{z-index:4;position:absolute;inset-block-end:0;overflow:hidden}post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;background:#fff;padding:16px;box-shadow:var(--post-device-elevation-500);line-height:100%;height:var(--main-navigation-height)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{background-color:ButtonFace !important}post-mainnavigation .left-scroll-button button:hover,post-mainnavigation .right-scroll-button button:hover{background-color:Highlight !important}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button button post-icon,post-mainnavigation .right-scroll-button button post-icon{font-size:1rem}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button{inset-inline-start:0;padding-inline-end:2rem}}@media screen and (min-width: 1024px){post-mainnavigation .right-scroll-button{inset-inline-end:0;padding-inline-start:2rem}}@media screen and (min-width: 1024px){post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{position:sticky;padding-inline:12px;height:var(--main-navigation-height);gap:4px;font-size:16px;z-index:4}post-mainnavigation post-list-item>a .nav-el-active,post-mainnavigation post-list-item>button .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-active{font-weight:700;text-align:center;opacity:0}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{position:absolute;opacity:1;text-align:center;width:100%;left:0}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]{background-color:#050400;color:#fff;font-weight:700}post-mainnavigation post-list-item>a.selected .nav-el-active,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item>button.selected .nav-el-active,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-active{opacity:1}post-mainnavigation post-list-item>a.selected .nav-el-inactive,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item>button.selected .nav-el-inactive,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-inactive{opacity:0}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}}@media screen and (min-width: 1024px)and (max-width: 599.98px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{font-size:14px}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:12px;transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{width:calc(100% - 28px)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{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)}}@media screen and (min-width: 1024px){post-mainnavigation post-megadropdown button:not(.btn-icon-close),post-mainnavigation post-megadropdown a{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-megadropdown button:not(.btn-icon-close)::before,post-mainnavigation post-megadropdown a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-megadropdown button:not(.btn-icon-close).selected,post-mainnavigation post-megadropdown button:not(.btn-icon-close)[aria-expanded=true],post-mainnavigation post-megadropdown a.selected,post-mainnavigation post-megadropdown a[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover,post-mainnavigation post-megadropdown a:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover::before,post-mainnavigation post-megadropdown a:hover::before{background-color:#504f4b}}@media screen and (min-width: 1024px){post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.98px){post-mainnavigation nav{transform:none !important}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{display:none}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-list-item>a::before,post-mainnavigation post-list-item>button::before,post-mainnavigation post-list-item post-megadropdown-trigger button::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}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]{background-color:#050400;color:#fff}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-list-item>a:hover::before,post-mainnavigation post-list-item>button:hover::before,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::before{background-color:#504f4b}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{display:none}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{transform:rotate(-90deg)}}post-mainnavigation .back-button .btn{padding-inline:0}";
743
+ const PostMainnavigationStyle0 = postMainnavigationCss;
744
+
745
+ const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
746
+ const NAVBAR_DISABLE_DURATION = 400; // Duration to temporarily disable navbar interactions during scrolling
747
+ const NAVIGATION_LIST_SELECTOR = 'post-list > [role="list"]:not(post-megadropdown *)';
748
+ const NAVIGATION_ITEM_SELECTOR = 'post-list-item :is(a, button):not(post-megadropdown *)';
749
+ const PostMainnavigation = class {
750
+ constructor(hostRef) {
751
+ registerInstance(this, hostRef);
752
+ this.canScrollLeft = false;
753
+ this.canScrollRight = false;
754
+ this.translationAmount = 0;
755
+ }
756
+ header;
757
+ navbar;
758
+ rightScrollButton;
759
+ leftScrollButton;
760
+ scrollRepeatInterval;
761
+ navbarDisableTimer;
762
+ mutationObserver = new MutationObserver(async (mutations) => {
763
+ // Wait for all elements to be hydrated
764
+ await Promise.all(mutations
765
+ .flatMap((mutation) => Array.from(mutation.addedNodes))
766
+ .map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
767
+ // Recalculate scrollability after DOM changes
768
+ this.checkScrollability();
769
+ });
770
+ get host() { return getElement(this); }
771
+ /**
772
+ * Update navbar translation when 'translateAmount' changes and recalculate scrollability
773
+ */
774
+ onTranslateAmountChanges(value) {
775
+ this.navbar.style.marginInlineStart = `-${value}px`;
776
+ this.checkScrollability();
777
+ }
778
+ /**
779
+ * Retrieves a reference to the closest 'post-header' element when the main navigation is added to the DOM.
780
+ * This ensures that we can interact with the header for mobile menu toggling.
781
+ */
782
+ connectedCallback() {
783
+ this.header = this.host.closest('post-header');
784
+ }
785
+ /**
786
+ * Cleans up references and disconnects the MutationObserver when the main navigation is removed from the DOM.
787
+ */
788
+ disconnectedCallback() {
789
+ this.header = null;
790
+ this.mutationObserver.disconnect();
791
+ }
792
+ componentDidLoad() {
793
+ setTimeout(() => this.checkScrollability()); // Initial check to determine if scrolling is needed
794
+ this.mutationObserver.observe(this.navigationList, { subtree: true, childList: true }); // Recheck scrollability when navigation list changes
795
+ this.fixLayoutShift();
796
+ window.addEventListener('resize', // Recheck scrollability on window resize
797
+ throttle(100, () => this.checkScrollability()));
798
+ // Handle focus changes and adjust scroll as needed
799
+ this.navbar.addEventListener('focusin', e => this.adjustTranslation(e));
800
+ }
801
+ // Hack that duplicates navigation elements to fix the layout shift on active elements
802
+ fixLayoutShift() {
803
+ // Select first level of main navigation elements, both the links and the megadropdown trigger buttons
804
+ const children = this.host.querySelectorAll('nav > post-list > div > post-list-item > a, nav > post-list > div > post-list-item > post-megadropdown-trigger > button');
805
+ // Update HTML so that the content is duplicated
806
+ children.forEach(child => (child.innerHTML = `<span class="nav-el-active">${child.innerHTML}</span><span class="nav-el-inactive"aria-hidden="true">${child.innerHTML}</span>`));
807
+ }
808
+ handleBackButtonClick() {
809
+ if (this.header)
810
+ this.header.toggleMobileMenu();
811
+ }
812
+ /**
813
+ * Moves focus on the navbar and adjusts scrolling to bring focused element into view.
814
+ */
815
+ adjustTranslation(e) {
816
+ const focusedElement = e.target;
817
+ if (!this.canScroll || !focusedElement.matches(NAVIGATION_ITEM_SELECTOR))
818
+ return;
819
+ // We need to move the element into the view before it is focused to avoid browser default behavior
820
+ e.preventDefault();
821
+ this.withoutTransition(() => {
822
+ // Try scrolling in both directions, only the necessary translation will actually occur
823
+ this.translateRightTo(focusedElement);
824
+ this.translateLeftTo(focusedElement);
825
+ focusedElement.focus();
826
+ });
827
+ }
828
+ /**
829
+ * Checks if scrolling is possible in either direction (left or right) and updates the state accordingly.
830
+ */
831
+ checkScrollability() {
832
+ const { scrollWidth, clientWidth } = this.navbar;
833
+ const couldScroll = this.canScroll;
834
+ if (scrollWidth === clientWidth) {
835
+ // If scroll width equals client width, scrolling is disabled in both directions
836
+ this.canScrollLeft = this.canScrollRight = false;
837
+ }
838
+ else {
839
+ this.canScrollLeft = this.translationAmount > 0; // Scrolling left is possible if not at the start
840
+ this.canScrollRight = clientWidth + this.translationAmount < scrollWidth; // Scrolling right is possible if not at the end
841
+ }
842
+ if (couldScroll && !this.canScroll) {
843
+ this.withoutTransition(() => (this.translationAmount = 0));
844
+ }
845
+ }
846
+ /**
847
+ * Returns whether scrolling is enabled in either the left or right direction.
848
+ */
849
+ get canScroll() {
850
+ return this.canScrollLeft || this.canScrollRight;
851
+ }
852
+ /**
853
+ * Handles the scrolling behavior when a user clicks on the left or right scroll buttons.
854
+ */
855
+ handleScrollButtonClick(direction) {
856
+ if (!this.canScroll)
857
+ return;
858
+ // Disable interaction with the navbar during scrolling
859
+ this.disableNavbar();
860
+ // Perform the initial scroll action
861
+ this.scroll(direction);
862
+ // Repeat the scrolling action while the button is held down
863
+ this.scrollRepeatInterval = setInterval(() => {
864
+ this.scroll(direction);
865
+ }, SCROLL_REPEAT_INTERVAL);
866
+ }
867
+ /**
868
+ * Stops the repeated scrolling when the mouse button is released.
869
+ */
870
+ stopScrolling() {
871
+ if (this.scrollRepeatInterval)
872
+ clearInterval(this.scrollRepeatInterval);
873
+ }
874
+ scroll(direction) {
875
+ const navigationItems = Array.from(this.navigationItems);
876
+ if (direction === 'left')
877
+ navigationItems.reverse();
878
+ for (const item of navigationItems) {
879
+ const couldScroll = direction === 'left' ? this.translateLeftTo(item, true) : this.translateRightTo(item, true);
880
+ if (couldScroll)
881
+ break;
882
+ }
883
+ }
884
+ translateRightTo(navigationItem, skipSmallTranslation = false) {
885
+ const listItem = navigationItem.closest('post-list-item');
886
+ // Calculate the right edge position of the list item relative to the left of the screen
887
+ const rightEdgePosition = listItem.offsetLeft + listItem.offsetWidth;
888
+ // Calculate the last visible position on the screen, right before the right scroll button
889
+ const lastVisiblePosition = this.host.clientWidth - this.rightScrollButton.clientWidth;
890
+ // If the item is already fully visible, no translation is needed
891
+ if (rightEdgePosition < lastVisiblePosition)
892
+ return false;
893
+ const translationIncrease = rightEdgePosition - lastVisiblePosition + 1; // + 1 because offset values are rounded
894
+ // If the required scroll distance is too small (less than half the width of the item), avoid unnecessary scroll
895
+ if (skipSmallTranslation && translationIncrease < listItem.clientWidth / 2)
896
+ return false;
897
+ // Calculate the maximum translation amount to prevent scrolling past the end of the content
898
+ const maximumTranslation = this.navbar.scrollWidth - this.host.clientWidth;
899
+ // Adjust the translation amount, ensuring it doesn't exceed the maximum scrollable area
900
+ const { marginRight } = getComputedStyle(this.navigationList);
901
+ this.translationAmount =
902
+ Math.min(this.translationAmount + translationIncrease, maximumTranslation) +
903
+ parseInt(marginRight);
904
+ return true;
905
+ }
906
+ translateLeftTo(navigationItem, skipSmallTranslation = false) {
907
+ const listItem = navigationItem.closest('post-list-item');
908
+ // Get the left edge position of the list item relative to the left of the screen
909
+ const leftEdgePosition = listItem.offsetLeft;
910
+ // Calculate the first visible position on the screen to the left, right after the left scroll button
911
+ const firstVisiblePosition = this.leftScrollButton.clientWidth;
912
+ // If the item is already fully visible, no translation is needed
913
+ if (leftEdgePosition > firstVisiblePosition)
914
+ return false;
915
+ const translationDecrease = firstVisiblePosition - leftEdgePosition + 1; // + 1 because offset values are rounded
916
+ // If the required scroll distance is too small (less than half the width of the item), don't perform the scroll
917
+ if (skipSmallTranslation && translationDecrease < listItem.clientWidth / 2)
918
+ return false;
919
+ // Calculate the minimum allowed translation amount (no negative scrolling allowed)
920
+ const minimumTranslation = 0;
921
+ // Adjust the translation amount, ensuring it doesn't go below the minimum scrollable area
922
+ const { marginLeft } = getComputedStyle(this.navigationList);
923
+ this.translationAmount = Math.max(this.translationAmount - translationDecrease - parseInt(marginLeft), minimumTranslation);
924
+ return true;
925
+ }
926
+ /**
927
+ * Returns the navigation list container element
928
+ */
929
+ get navigationList() {
930
+ return this.navbar.querySelector(NAVIGATION_LIST_SELECTOR);
931
+ }
932
+ /**
933
+ * Returns the navigation items
934
+ */
935
+ get navigationItems() {
936
+ return this.navbar.querySelectorAll(NAVIGATION_ITEM_SELECTOR);
937
+ }
938
+ /**
939
+ * Temporarily disables interactions with the navbar during scrolling to prevent accidental clicks.
940
+ * Re-enables interactions after a brief delay to avoid blocking the user entirely.
941
+ */
942
+ disableNavbar() {
943
+ if (this.navbarDisableTimer)
944
+ clearTimeout(this.navbarDisableTimer);
945
+ this.navbar.style.pointerEvents = 'none';
946
+ this.navbarDisableTimer = setTimeout(() => {
947
+ this.navbar.style.pointerEvents = 'initial';
948
+ }, NAVBAR_DISABLE_DURATION);
949
+ }
950
+ /**
951
+ * Allows to translate the navbar without a transition
952
+ */
953
+ withoutTransition(callback) {
954
+ const transition = this.navbar.style.transition;
955
+ this.navbar.style.transition = 'none';
956
+ callback();
957
+ setTimeout(() => {
958
+ this.navbar.style.transition = transition;
959
+ });
960
+ }
961
+ render() {
962
+ return (h(Host, { key: 'd9be56167f714c041eb05283832986ec38c451cd', slot: "post-mainnavigation" }, h("div", { key: '5852c66b93a6eb9697fd7c7b1379e748804c6917', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '0d4d98897fb5a8f8cf1c0871037ac01023c41cc2', name: "back-button" })), h("nav", { key: 'c60635b5db5a54b9e7661b92eeec29ed6d453cfe', ref: el => (this.navbar = el) }, h("slot", { key: 'd83facd6cb8c2a892ad432e42357123660c647ed' })), h("div", { key: 'e9afc48596b3e877d9efb9a4189abb8c84aadb6d', class: `left-scroll-button${this.canScrollLeft ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: 'ef11720ec4f6d7811eb10027871a336e46ba6b84', type: "button", tabindex: "-1", ref: el => (this.leftScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('left') }, h("post-icon", { key: 'f85ff2ef87841409f4b4f6c33e6d0dca4c764cc6', "aria-hidden": "true", name: "chevronleft" }))), h("div", { key: '181dc100ddedcba3f07b5f0ff9aedf165499f74f', class: `right-scroll-button${this.canScrollRight ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: '83a8a824fcfe499207f6030e11381e68d530c67d', type: "button", tabindex: "-1", ref: el => (this.rightScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('right') }, h("post-icon", { key: '52caec8a9a8c15e97ea5702ec3fe30bd4777c728', "aria-hidden": "true", name: "chevronright" })))));
963
+ }
964
+ static get watchers() { return {
965
+ "translationAmount": ["onTranslateAmountChanges"]
966
+ }; }
967
+ };
968
+ PostMainnavigation.style = PostMainnavigationStyle0;
969
+
970
+ const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;border-top:1px solid #e1e0dc;width:100%;top:100%;left:0;border-radius:0}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;top:0 !important;left:0;width:100%;position:fixed;height:calc(100dvh - var(--header-height));max-height:calc(100dvh - var(--header-height));border-top:unset;overflow:auto}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.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.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.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;display:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.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;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:2px;position:absolute;left:0}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}";
971
+ const PostMegadropdownStyle0 = postMegadropdownCss;
972
+
973
+ const PostMegadropdown = class {
974
+ constructor(hostRef) {
975
+ registerInstance(this, hostRef);
976
+ this.postToggleMegadropdown = createEvent(this, "postToggleMegadropdown", 7);
977
+ this.device = undefined;
978
+ this.isVisible = false;
979
+ this.animationClass = null;
980
+ }
981
+ header;
982
+ firstFocusableEl;
983
+ lastFocusableEl;
984
+ get host() { return getElement(this); }
985
+ /** Tracks the currently active dropdown instance. */
986
+ static activeDropdown = null;
987
+ /**
988
+ * Emits when the dropdown is shown or hidden.
989
+ * The event payload is an object.
990
+ * `isVisible` is true when the dropdown gets opened and false when it gets closed
991
+ * `focusParent` determines whether after the closing of the mega dropdown, the focus should go back to the trigger parent or naturally go to the next focusable element in the page
992
+ **/
993
+ postToggleMegadropdown;
994
+ disconnectedCallback() {
995
+ this.removeListeners();
996
+ if (PostMegadropdown.activeDropdown === this) {
997
+ PostMegadropdown.activeDropdown = null;
998
+ }
999
+ }
1000
+ componentWillRender() {
1001
+ this.getFocusableElements();
1002
+ }
1003
+ /**
1004
+ * Toggles the dropdown visibility based on its current state.
1005
+ */
1006
+ async toggle() {
1007
+ if (this.isVisible) {
1008
+ this.hide();
1009
+ }
1010
+ else {
1011
+ await this.show();
1012
+ }
1013
+ }
1014
+ /**
1015
+ * Displays the dropdown.
1016
+ */
1017
+ async show() {
1018
+ if (PostMegadropdown.activeDropdown && PostMegadropdown.activeDropdown !== this) {
1019
+ // Close the previously active dropdown without animation
1020
+ PostMegadropdown.activeDropdown.forceClose();
1021
+ }
1022
+ else {
1023
+ this.animationClass = 'slide-in';
1024
+ }
1025
+ this.isVisible = true;
1026
+ PostMegadropdown.activeDropdown = this;
1027
+ this.postToggleMegadropdown.emit({ isVisible: this.isVisible });
1028
+ if (this.firstFocusableEl &&
1029
+ window.getComputedStyle(this.firstFocusableEl).display !== 'none') {
1030
+ this.firstFocusableEl.focus();
1031
+ }
1032
+ this.addListeners();
1033
+ }
1034
+ /**
1035
+ * Hides the dropdown with an animation.
1036
+ */
1037
+ async hide(focusParent = true) {
1038
+ this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
1039
+ this.animationClass = 'slide-out';
1040
+ }
1041
+ async focusFirst() {
1042
+ this.firstFocusableEl?.focus();
1043
+ }
1044
+ connectedCallback() {
1045
+ this.header = this.host.closest('post-header');
1046
+ if (this.header) {
1047
+ this.header.addEventListener('postUpdateDevice', (event) => {
1048
+ this.device = event.detail;
1049
+ });
1050
+ }
1051
+ }
1052
+ /**
1053
+ * Forces the dropdown to close without animation.
1054
+ */
1055
+ forceClose() {
1056
+ this.isVisible = false;
1057
+ this.animationClass = null;
1058
+ this.postToggleMegadropdown.emit({ isVisible: this.isVisible, focusParent: false });
1059
+ this.removeListeners();
1060
+ }
1061
+ handleAnimationEnd() {
1062
+ if (this.animationClass === 'slide-out') {
1063
+ this.isVisible = false;
1064
+ this.animationClass = null;
1065
+ PostMegadropdown.activeDropdown = null;
1066
+ this.removeListeners();
1067
+ }
1068
+ }
1069
+ handleClickOutside = (event) => {
1070
+ const target = event.target;
1071
+ if (this.host.contains(target)) {
1072
+ return;
1073
+ }
1074
+ if (target instanceof HTMLElement) {
1075
+ const trigger = target.closest('post-megadropdown-trigger');
1076
+ if (trigger) {
1077
+ const targetDropdownId = trigger.getAttribute('for');
1078
+ if (targetDropdownId !== this.host.id) {
1079
+ return;
1080
+ }
1081
+ }
1082
+ }
1083
+ this.hide(false);
1084
+ };
1085
+ addListeners() {
1086
+ this.host.addEventListener('keydown', e => this.keyboardHandler(e));
1087
+ document.addEventListener('keyup', e => this.handleTabOutside(e));
1088
+ document.addEventListener('mousedown', this.handleClickOutside);
1089
+ }
1090
+ removeListeners() {
1091
+ this.host.removeEventListener('keydown', e => this.keyboardHandler(e));
1092
+ document.removeEventListener('keyup', e => this.handleTabOutside(e));
1093
+ document.removeEventListener('mousedown', this.handleClickOutside);
1094
+ }
1095
+ getFocusableElements() {
1096
+ const focusableEls = Array.from(this.host.querySelectorAll('post-list-item, h3, .back-button'));
1097
+ const focusableChildren = focusableEls.flatMap(el => Array.from(getFocusableChildren(el)));
1098
+ this.firstFocusableEl = focusableChildren[0];
1099
+ this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
1100
+ }
1101
+ // Loop through the focusable children
1102
+ keyboardHandler(e) {
1103
+ if (e.key === 'Tab' && this.device !== 'desktop') {
1104
+ if (e.shiftKey && document.activeElement === this.firstFocusableEl) {
1105
+ // If back tab (TAB + Shift) and first element is focused, focus goes to the last element of the megadropdown
1106
+ e.preventDefault();
1107
+ this.lastFocusableEl.focus();
1108
+ }
1109
+ else if (!e.shiftKey && document.activeElement === this.lastFocusableEl) {
1110
+ // If TAB and last element is focused, focus goes back to the first element of the megadropdown
1111
+ e.preventDefault();
1112
+ this.firstFocusableEl.focus();
1113
+ }
1114
+ }
1115
+ }
1116
+ handleTabOutside(e) {
1117
+ if (e.key === 'Tab' && this.device === 'desktop') {
1118
+ if (!this.host.contains(e.target)) {
1119
+ this.hide(false);
1120
+ }
1121
+ }
1122
+ }
1123
+ render() {
1124
+ const containerStyle = this.isVisible ? {} : { display: 'none' };
1125
+ return (h(Host, { key: '1475e9ff941f5333d5cfe4f00157f8b2fc826b5e' }, h("div", { key: 'f3da1ec8abc7d00be7020821be69ea3af16f3ad2', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: 'f02279d454c7413080ce52711fe0cb923950d066', class: "megadropdown" }, h("slot", { key: '87da859d1a8408c3a49ea1ab050ea5f27de45ec2', name: "megadropdown-title" }), h("div", { key: 'c389959cf97c2ea69dd7b3f6945071e0c1793458', class: "megadropdown-content" }, h("slot", { key: '1a1241624a5b5421de0e4a3a54ddba3eb1e0834f' })), h("div", { key: 'f8fad723719e1505730f679dfff6428f3a5f1340', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: '6ca62ac352810b6d3642ee69433de4aac4089117', name: "back-button" })), h("div", { key: '16200fc7dee7d5535399e0450e39a816f04dffd6', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: 'e9478713c07f69011f397af3e3ffa6a3b8b7fb6a', name: "close-button" }))))));
1126
+ }
1127
+ };
1128
+ PostMegadropdown.style = PostMegadropdownStyle0;
1129
+
1130
+ const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%;position:relative;z-index:3}";
1131
+ const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
1132
+
1133
+ const PostMegadropdownTrigger = class {
1134
+ constructor(hostRef) {
1135
+ registerInstance(this, hostRef);
1136
+ this.for = undefined;
1137
+ this.ariaExpanded = false;
1138
+ }
1139
+ get host() { return getElement(this); }
1140
+ /**
1141
+ * Reference to the slotted button within the trigger, if present.
1142
+ * Used to manage click and key events for mega dropdown control.
1143
+ */
1144
+ slottedButton = null;
1145
+ /**
1146
+ * Tracks whether this trigger's dropdown was expanded before a state change.
1147
+ * Used to determine if this trigger should handle focus when its dropdown closes.
1148
+ */
1149
+ wasExpanded = false;
1150
+ /**
1151
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
1152
+ * @param forValue - The new value of the `for` property.
1153
+ */
1154
+ validateControlFor() {
1155
+ checkType(this, 'for', 'string');
1156
+ }
1157
+ get megadropdown() {
1158
+ const ref = document.getElementById(this.for);
1159
+ return ref && ref.localName === 'post-megadropdown'
1160
+ ? ref
1161
+ : null;
1162
+ }
1163
+ handleToggle() {
1164
+ if (this.megadropdown) {
1165
+ this.megadropdown.toggle();
1166
+ }
1167
+ else {
1168
+ console.warn(`No post-megadropdown found with ID: ${this.for}`);
1169
+ }
1170
+ }
1171
+ handleKeyDown = (event) => {
1172
+ if (event.key === 'Enter') {
1173
+ event.preventDefault();
1174
+ this.handleToggle();
1175
+ if (this.megadropdown && !this.ariaExpanded) {
1176
+ setTimeout(() => this.megadropdown.focusFirst(), 100);
1177
+ }
1178
+ }
1179
+ };
1180
+ componentDidLoad() {
1181
+ this.validateControlFor();
1182
+ // Check if the mega dropdown attached to the trigger is expanded or not
1183
+ document.addEventListener('postToggleMegadropdown', (event) => {
1184
+ if (event.target.id === this.for) {
1185
+ this.ariaExpanded = event.detail.isVisible;
1186
+ // Focus on the trigger parent of the dropdown after it's closed if close button had been clicked
1187
+ if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
1188
+ setTimeout(() => {
1189
+ this.slottedButton?.focus();
1190
+ }, 100);
1191
+ }
1192
+ this.wasExpanded = this.ariaExpanded;
1193
+ if (this.slottedButton) {
1194
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
1195
+ }
1196
+ }
1197
+ });
1198
+ this.slottedButton = this.host.querySelector('button');
1199
+ if (this.slottedButton) {
1200
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
1201
+ this.slottedButton.addEventListener('click', () => {
1202
+ this.handleToggle();
1203
+ });
1204
+ this.slottedButton.addEventListener('keydown', this.handleKeyDown);
1205
+ }
1206
+ else {
1207
+ console.warn('No button found within post-megadropdown-trigger');
1208
+ }
1209
+ }
1210
+ render() {
1211
+ return (h(Host, { key: '99849b6b851d061c1365eb5d507cba0e7e6e3ae6', "data-version": version, "tab-index": "-1" }, h("button", { key: 'ddd553c4b893538155263e5bd82c763be68eb3f3' }, h("slot", { key: 'eb006c5b13c69a8e089702f1b46f88bc3d74b045' }))));
1212
+ }
1213
+ static get watchers() { return {
1214
+ "for": ["validateControlFor"]
1215
+ }; }
1216
+ };
1217
+ PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
1218
+
1219
+ 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)}.popover-container{display:flex;flex-direction:column}";
1220
+ const PostMenuStyle0 = postMenuCss;
1221
+
1222
+ const PostMenu = class {
1223
+ constructor(hostRef) {
1224
+ registerInstance(this, hostRef);
1225
+ this.toggleMenu = createEvent(this, "toggleMenu", 7);
1226
+ this.placement = 'bottom';
1227
+ this.isVisible = false;
1228
+ }
1229
+ popoverRef;
1230
+ lastFocusedElement = null;
1231
+ KEYCODES = {
1232
+ SPACE: ' ',
1233
+ ENTER: 'Enter',
1234
+ UP: 'ArrowUp',
1235
+ DOWN: 'ArrowDown',
1236
+ TAB: 'Tab',
1237
+ HOME: 'Home',
1238
+ END: 'End',
1239
+ ESCAPE: 'Escape',
1240
+ };
1241
+ get host() { return getElement(this); }
1242
+ /**
1243
+ * Emits when the menu is shown or hidden.
1244
+ * The event payload is a boolean: `true` when the menu was opened, `false` when it was closed.
1245
+ **/
1246
+ toggleMenu;
1247
+ root;
1248
+ connectedCallback() {
1249
+ this.root = getRoot(this.host);
1250
+ this.host.addEventListener('keydown', this.handleKeyDown);
1251
+ this.host.addEventListener('click', this.handleClick);
1252
+ }
1253
+ disconnectedCallback() {
1254
+ this.host.removeEventListener('keydown', this.handleKeyDown);
1255
+ this.host.removeEventListener('click', this.handleClick);
1256
+ }
1257
+ componentDidLoad() {
1258
+ this.popoverRef.addEventListener('postToggle', (event) => {
1259
+ this.isVisible = event.detail;
1260
+ this.toggleMenu.emit(this.isVisible);
1261
+ requestAnimationFrame(() => {
1262
+ if (this.isVisible) {
1263
+ this.lastFocusedElement = this.root.activeElement;
1264
+ const menuItems = this.getSlottedItems();
1265
+ if (menuItems.length > 0) {
1266
+ menuItems[0].focus();
1267
+ }
1268
+ }
1269
+ else if (this.lastFocusedElement) {
1270
+ this.lastFocusedElement.focus();
1271
+ }
1272
+ });
1273
+ });
1274
+ }
1275
+ /**
1276
+ * Toggles the menu visibility based on its current state.
1277
+ */
1278
+ async toggle(target) {
1279
+ if (this.popoverRef) {
1280
+ await this.popoverRef.toggle(target);
1281
+ }
1282
+ else {
1283
+ console.error('toggle: popoverRef is null or undefined');
1284
+ }
1285
+ }
1286
+ /**
1287
+ * Displays the popover menu, focusing the first menu item.
1288
+ *
1289
+ * @param target - The HTML element relative to which the popover menu should be displayed.
1290
+ */
1291
+ async show(target) {
1292
+ if (this.popoverRef) {
1293
+ await this.popoverRef.show(target);
1294
+ }
1295
+ else {
1296
+ console.error('show: popoverRef is null or undefined');
1297
+ }
1298
+ }
1299
+ /**
1300
+ * Hides the popover menu and restores focus to the previously focused element.
1301
+ */
1302
+ async hide() {
1303
+ if (this.popoverRef) {
1304
+ await this.popoverRef.hide();
1305
+ }
1306
+ else {
1307
+ console.error('hide: popoverRef is null or undefined');
1308
+ }
1309
+ }
1310
+ handleKeyDown = (e) => {
1311
+ e.stopPropagation();
1312
+ if (e.key === this.KEYCODES.ESCAPE) {
1313
+ this.toggle(this.host);
1314
+ return;
1315
+ }
1316
+ if (Object.values(this.KEYCODES).includes(e.key)) {
1317
+ this.controlKeyDownHandler(e);
1318
+ }
1319
+ };
1320
+ handleClick = (e) => {
1321
+ const target = e.target;
1322
+ if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
1323
+ this.toggle(this.host);
1324
+ }
1325
+ };
1326
+ controlKeyDownHandler(e) {
1327
+ const menuItems = this.getSlottedItems();
1328
+ if (!menuItems.length) {
1329
+ return;
1330
+ }
1331
+ let currentIndex = menuItems.findIndex(el => {
1332
+ // Check if the item is currently focused within its rendered scope (document or shadow root)
1333
+ return el === getRoot(el).activeElement;
1334
+ });
1335
+ switch (e.key) {
1336
+ case this.KEYCODES.UP:
1337
+ e.preventDefault();
1338
+ currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
1339
+ break;
1340
+ case this.KEYCODES.DOWN:
1341
+ e.preventDefault();
1342
+ currentIndex = (currentIndex + 1) % menuItems.length;
1343
+ break;
1344
+ case this.KEYCODES.HOME:
1345
+ currentIndex = 0;
1346
+ break;
1347
+ case this.KEYCODES.END:
1348
+ e.preventDefault();
1349
+ currentIndex = menuItems.length - 1;
1350
+ break;
1351
+ case this.KEYCODES.SPACE:
1352
+ this.toggle(this.host);
1353
+ return;
1354
+ case this.KEYCODES.TAB:
1355
+ this.toggle(this.host);
1356
+ break;
1357
+ }
1358
+ if (menuItems[currentIndex]) {
1359
+ menuItems[currentIndex].focus();
1360
+ }
1361
+ }
1362
+ getSlottedItems() {
1363
+ const slot = this.host.shadowRoot.querySelector('slot');
1364
+ const slottedElements = slot ? slot.assignedElements() : [];
1365
+ return (slottedElements
1366
+ // If the element is a slot, get the assigned elements
1367
+ .flatMap(el => (el instanceof HTMLSlotElement ? el.assignedElements() : el))
1368
+ // Filter out elements that have a 'menuitem' role
1369
+ .filter(el => el.getAttribute('role') === 'menuitem')
1370
+ // For each menu item, get any focusable children (e.g., buttons, links)
1371
+ .flatMap(el => Array.from(getFocusableChildren(el))));
1372
+ }
1373
+ render() {
1374
+ return (h(Host, { key: '3a79b9df5a5d4c121aa9ca36883d6e17cbf2a66e', "data-version": version }, h("post-popovercontainer", { key: '9c8a37a2c70b98ff9a960f467ab951af10c34726', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '0cda7fc8df3f201d4b4e0170bb8a94e72e123814', class: "popover-container", part: "popover-container" }, h("slot", { key: 'ac20e448dededb6ea79715c2c29122dccf0d7309' })))));
1375
+ }
1376
+ };
1377
+ PostMenu.style = PostMenuStyle0;
1378
+
1379
+ const postMenuTriggerCss = ":host{display:inline-block}";
1380
+ const PostMenuTriggerStyle0 = postMenuTriggerCss;
1381
+
1382
+ const PostMenuTrigger = class {
1383
+ constructor(hostRef) {
1384
+ registerInstance(this, hostRef);
1385
+ this.for = undefined;
1386
+ this.ariaExpanded = false;
1387
+ }
1388
+ get host() { return getElement(this); }
1389
+ /**
1390
+ * Reference to the slotted button within the trigger, if present.
1391
+ * Used to manage click and key events for menu control.
1392
+ */
1393
+ slottedButton = null;
1394
+ root;
1395
+ /**
1396
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
1397
+ * @param forValue - The new value of the `for` property.
1398
+ */
1399
+ validateControlFor() {
1400
+ checkType(this, 'for', 'string');
1401
+ }
1402
+ get menu() {
1403
+ const ref = this.root.getElementById(this.for);
1404
+ return ref && ref.localName === 'post-menu' ? ref : null;
1405
+ }
1406
+ handleToggle() {
1407
+ if (this.menu) {
1408
+ this.menu.toggle(this.host);
1409
+ }
1410
+ else {
1411
+ console.warn(`No post-menu found with ID: ${this.for}`);
1412
+ }
1413
+ }
1414
+ handleKeyDown = (e) => {
1415
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
1416
+ e.preventDefault();
1417
+ this.handleToggle();
1418
+ }
1419
+ };
1420
+ connectedCallback() {
1421
+ this.root = getRoot(this.host);
1422
+ }
1423
+ componentDidLoad() {
1424
+ this.validateControlFor();
1425
+ this.slottedButton = this.host.querySelector('button');
1426
+ // Check if the slottedButton is within a web component
1427
+ if (!this.slottedButton) {
1428
+ const webComponent = this.host.querySelector('.menu-trigger-webc');
1429
+ if (webComponent.shadowRoot) {
1430
+ const slottedButton = webComponent.shadowRoot.querySelector('button');
1431
+ if (slottedButton) {
1432
+ this.slottedButton = slottedButton;
1433
+ }
1434
+ }
1435
+ }
1436
+ if (this.slottedButton) {
1437
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
1438
+ // Listen to the `toggleMenu` event emitted by the `post-menu` component
1439
+ if (this.menu && this.slottedButton) {
1440
+ this.menu.addEventListener('toggleMenu', (event) => {
1441
+ this.ariaExpanded = event.detail;
1442
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
1443
+ });
1444
+ }
1445
+ this.slottedButton.addEventListener('click', () => {
1446
+ this.handleToggle();
1447
+ });
1448
+ this.slottedButton.addEventListener('keydown', this.handleKeyDown);
1449
+ }
1450
+ else {
1451
+ console.warn('No button found within post-menu-trigger');
1452
+ }
1453
+ }
1454
+ render() {
1455
+ return (h(Host, { key: '84316d4a69c4231be636e5ff8971752d5af9bab2', "data-version": version, "tab-index": "-1" }, h("slot", { key: 'd3091adcf7033c4dd25e49fa383ccb9773b2d226' })));
1456
+ }
1457
+ static get watchers() { return {
1458
+ "for": ["validateControlFor"]
1459
+ }; }
1460
+ };
1461
+ PostMenuTrigger.style = PostMenuTriggerStyle0;
1462
+
1463
+ /**
1464
+ * Custom positioning reference element.
1465
+ * @see https://floating-ui.com/docs/virtual-elements
1466
+ */
1467
+
1468
+ const sides = ['top', 'right', 'bottom', 'left'];
1469
+ const alignments = ['start', 'end'];
1470
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
1471
+ const min = Math.min;
1472
+ const max = Math.max;
1473
+ const round = Math.round;
1474
+ const floor = Math.floor;
1475
+ const createCoords = v => ({
1476
+ x: v,
1477
+ y: v
1478
+ });
1479
+ const oppositeSideMap = {
1480
+ left: 'right',
1481
+ right: 'left',
1482
+ bottom: 'top',
1483
+ top: 'bottom'
1484
+ };
1485
+ const oppositeAlignmentMap = {
1486
+ start: 'end',
1487
+ end: 'start'
1488
+ };
1489
+ function clamp(start, value, end) {
1490
+ return max(start, min(value, end));
1491
+ }
1492
+ function evaluate(value, param) {
1493
+ return typeof value === 'function' ? value(param) : value;
1494
+ }
1495
+ function getSide(placement) {
1496
+ return placement.split('-')[0];
1497
+ }
1498
+ function getAlignment(placement) {
1499
+ return placement.split('-')[1];
1500
+ }
1501
+ function getOppositeAxis(axis) {
1502
+ return axis === 'x' ? 'y' : 'x';
1503
+ }
1504
+ function getAxisLength(axis) {
1505
+ return axis === 'y' ? 'height' : 'width';
1506
+ }
1507
+ function getSideAxis(placement) {
1508
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
1509
+ }
1510
+ function getAlignmentAxis(placement) {
1511
+ return getOppositeAxis(getSideAxis(placement));
1512
+ }
1513
+ function getAlignmentSides(placement, rects, rtl) {
1514
+ if (rtl === void 0) {
1515
+ rtl = false;
1516
+ }
1517
+ const alignment = getAlignment(placement);
1518
+ const alignmentAxis = getAlignmentAxis(placement);
1519
+ const length = getAxisLength(alignmentAxis);
1520
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
1521
+ if (rects.reference[length] > rects.floating[length]) {
1522
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1523
+ }
1524
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
1525
+ }
1526
+ function getExpandedPlacements(placement) {
1527
+ const oppositePlacement = getOppositePlacement(placement);
1528
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1529
+ }
1530
+ function getOppositeAlignmentPlacement(placement) {
1531
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
1532
+ }
1533
+ function getSideList(side, isStart, rtl) {
1534
+ const lr = ['left', 'right'];
1535
+ const rl = ['right', 'left'];
1536
+ const tb = ['top', 'bottom'];
1537
+ const bt = ['bottom', 'top'];
1538
+ switch (side) {
1539
+ case 'top':
1540
+ case 'bottom':
1541
+ if (rtl) return isStart ? rl : lr;
1542
+ return isStart ? lr : rl;
1543
+ case 'left':
1544
+ case 'right':
1545
+ return isStart ? tb : bt;
1546
+ default:
1547
+ return [];
1548
+ }
1549
+ }
1550
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
1551
+ const alignment = getAlignment(placement);
1552
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
1553
+ if (alignment) {
1554
+ list = list.map(side => side + "-" + alignment);
1555
+ if (flipAlignment) {
1556
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
1557
+ }
1558
+ }
1559
+ return list;
1560
+ }
1561
+ function getOppositePlacement(placement) {
1562
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
1563
+ }
1564
+ function expandPaddingObject(padding) {
1565
+ return {
1566
+ top: 0,
1567
+ right: 0,
1568
+ bottom: 0,
1569
+ left: 0,
1570
+ ...padding
1571
+ };
1572
+ }
1573
+ function getPaddingObject(padding) {
1574
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
1575
+ top: padding,
1576
+ right: padding,
1577
+ bottom: padding,
1578
+ left: padding
1579
+ };
1580
+ }
1581
+ function rectToClientRect(rect) {
1582
+ const {
1583
+ x,
1584
+ y,
1585
+ width,
1586
+ height
1587
+ } = rect;
1588
+ return {
1589
+ width,
1590
+ height,
1591
+ top: y,
1592
+ left: x,
1593
+ right: x + width,
1594
+ bottom: y + height,
1595
+ x,
1596
+ y
1597
+ };
1598
+ }
1599
+
1600
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
1601
+ let {
1602
+ reference,
1603
+ floating
1604
+ } = _ref;
1605
+ const sideAxis = getSideAxis(placement);
1606
+ const alignmentAxis = getAlignmentAxis(placement);
1607
+ const alignLength = getAxisLength(alignmentAxis);
1608
+ const side = getSide(placement);
1609
+ const isVertical = sideAxis === 'y';
1610
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
1611
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
1612
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
1613
+ let coords;
1614
+ switch (side) {
1615
+ case 'top':
1616
+ coords = {
1617
+ x: commonX,
1618
+ y: reference.y - floating.height
1619
+ };
1620
+ break;
1621
+ case 'bottom':
1622
+ coords = {
1623
+ x: commonX,
1624
+ y: reference.y + reference.height
1625
+ };
1626
+ break;
1627
+ case 'right':
1628
+ coords = {
1629
+ x: reference.x + reference.width,
1630
+ y: commonY
1631
+ };
1632
+ break;
1633
+ case 'left':
1634
+ coords = {
1635
+ x: reference.x - floating.width,
1636
+ y: commonY
1637
+ };
1638
+ break;
1639
+ default:
1640
+ coords = {
1641
+ x: reference.x,
1642
+ y: reference.y
1643
+ };
1644
+ }
1645
+ switch (getAlignment(placement)) {
1646
+ case 'start':
1647
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1648
+ break;
1649
+ case 'end':
1650
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1651
+ break;
1652
+ }
1653
+ return coords;
1654
+ }
1655
+
1656
+ /**
1657
+ * Computes the `x` and `y` coordinates that will place the floating element
1658
+ * next to a given reference element.
1659
+ *
1660
+ * This export does not have any `platform` interface logic. You will need to
1661
+ * write one for the platform you are using Floating UI with.
1662
+ */
1663
+ const computePosition$1 = async (reference, floating, config) => {
1664
+ const {
1665
+ placement = 'bottom',
1666
+ strategy = 'absolute',
1667
+ middleware = [],
1668
+ platform
1669
+ } = config;
1670
+ const validMiddleware = middleware.filter(Boolean);
1671
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
1672
+ let rects = await platform.getElementRects({
1673
+ reference,
1674
+ floating,
1675
+ strategy
1676
+ });
1677
+ let {
1678
+ x,
1679
+ y
1680
+ } = computeCoordsFromPlacement(rects, placement, rtl);
1681
+ let statefulPlacement = placement;
1682
+ let middlewareData = {};
1683
+ let resetCount = 0;
1684
+ for (let i = 0; i < validMiddleware.length; i++) {
1685
+ const {
1686
+ name,
1687
+ fn
1688
+ } = validMiddleware[i];
1689
+ const {
1690
+ x: nextX,
1691
+ y: nextY,
1692
+ data,
1693
+ reset
1694
+ } = await fn({
1695
+ x,
1696
+ y,
1697
+ initialPlacement: placement,
1698
+ placement: statefulPlacement,
1699
+ strategy,
1700
+ middlewareData,
1701
+ rects,
1702
+ platform,
1703
+ elements: {
1704
+ reference,
1705
+ floating
1706
+ }
1707
+ });
1708
+ x = nextX != null ? nextX : x;
1709
+ y = nextY != null ? nextY : y;
1710
+ middlewareData = {
1711
+ ...middlewareData,
1712
+ [name]: {
1713
+ ...middlewareData[name],
1714
+ ...data
1715
+ }
1716
+ };
1717
+ if (reset && resetCount <= 50) {
1718
+ resetCount++;
1719
+ if (typeof reset === 'object') {
1720
+ if (reset.placement) {
1721
+ statefulPlacement = reset.placement;
1722
+ }
1723
+ if (reset.rects) {
1724
+ rects = reset.rects === true ? await platform.getElementRects({
1725
+ reference,
1726
+ floating,
1727
+ strategy
1728
+ }) : reset.rects;
1729
+ }
1730
+ ({
1731
+ x,
1732
+ y
1733
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1734
+ }
1735
+ i = -1;
1736
+ }
1737
+ }
1738
+ return {
1739
+ x,
1740
+ y,
1741
+ placement: statefulPlacement,
1742
+ strategy,
1743
+ middlewareData
1744
+ };
1745
+ };
1746
+
1747
+ /**
1748
+ * Resolves with an object of overflow side offsets that determine how much the
1749
+ * element is overflowing a given clipping boundary on each side.
1750
+ * - positive = overflowing the boundary by that number of pixels
1751
+ * - negative = how many pixels left before it will overflow
1752
+ * - 0 = lies flush with the boundary
1753
+ * @see https://floating-ui.com/docs/detectOverflow
1754
+ */
1755
+ async function detectOverflow(state, options) {
1756
+ var _await$platform$isEle;
1757
+ if (options === void 0) {
1758
+ options = {};
1759
+ }
1760
+ const {
1761
+ x,
1762
+ y,
1763
+ platform,
1764
+ rects,
1765
+ elements,
1766
+ strategy
1767
+ } = state;
1768
+ const {
1769
+ boundary = 'clippingAncestors',
1770
+ rootBoundary = 'viewport',
1771
+ elementContext = 'floating',
1772
+ altBoundary = false,
1773
+ padding = 0
1774
+ } = evaluate(options, state);
1775
+ const paddingObject = getPaddingObject(padding);
1776
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1777
+ const element = elements[altBoundary ? altContext : elementContext];
1778
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1779
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
1780
+ boundary,
1781
+ rootBoundary,
1782
+ strategy
1783
+ }));
1784
+ const rect = elementContext === 'floating' ? {
1785
+ ...rects.floating,
1786
+ x,
1787
+ y
1788
+ } : rects.reference;
1789
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
1790
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
1791
+ x: 1,
1792
+ y: 1
1793
+ } : {
1794
+ x: 1,
1795
+ y: 1
1796
+ };
1797
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1798
+ elements,
1799
+ rect,
1800
+ offsetParent,
1801
+ strategy
1802
+ }) : rect);
1803
+ return {
1804
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1805
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1806
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1807
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1808
+ };
1809
+ }
1810
+
1811
+ /**
1812
+ * Provides data to position an inner element of the floating element so that it
1813
+ * appears centered to the reference element.
1814
+ * @see https://floating-ui.com/docs/arrow
1815
+ */
1816
+ const arrow$1 = options => ({
1817
+ name: 'arrow',
1818
+ options,
1819
+ async fn(state) {
1820
+ const {
1821
+ x,
1822
+ y,
1823
+ placement,
1824
+ rects,
1825
+ platform,
1826
+ elements,
1827
+ middlewareData
1828
+ } = state;
1829
+ // Since `element` is required, we don't Partial<> the type.
1830
+ const {
1831
+ element,
1832
+ padding = 0
1833
+ } = evaluate(options, state) || {};
1834
+ if (element == null) {
1835
+ return {};
1836
+ }
1837
+ const paddingObject = getPaddingObject(padding);
1838
+ const coords = {
1839
+ x,
1840
+ y
1841
+ };
1842
+ const axis = getAlignmentAxis(placement);
1843
+ const length = getAxisLength(axis);
1844
+ const arrowDimensions = await platform.getDimensions(element);
1845
+ const isYAxis = axis === 'y';
1846
+ const minProp = isYAxis ? 'top' : 'left';
1847
+ const maxProp = isYAxis ? 'bottom' : 'right';
1848
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
1849
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1850
+ const startDiff = coords[axis] - rects.reference[axis];
1851
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1852
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1853
+
1854
+ // DOM platform can return `window` as the `offsetParent`.
1855
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
1856
+ clientSize = elements.floating[clientProp] || rects.floating[length];
1857
+ }
1858
+ const centerToReference = endDiff / 2 - startDiff / 2;
1859
+
1860
+ // If the padding is large enough that it causes the arrow to no longer be
1861
+ // centered, modify the padding so that it is centered.
1862
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1863
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1864
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1865
+
1866
+ // Make sure the arrow doesn't overflow the floating element if the center
1867
+ // point is outside the floating element's bounds.
1868
+ const min$1 = minPadding;
1869
+ const max = clientSize - arrowDimensions[length] - maxPadding;
1870
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1871
+ const offset = clamp(min$1, center, max);
1872
+
1873
+ // If the reference is small enough that the arrow's padding causes it to
1874
+ // to point to nothing for an aligned placement, adjust the offset of the
1875
+ // floating element itself. To ensure `shift()` continues to take action,
1876
+ // a single reset is performed when this is true.
1877
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1878
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
1879
+ return {
1880
+ [axis]: coords[axis] + alignmentOffset,
1881
+ data: {
1882
+ [axis]: offset,
1883
+ centerOffset: center - offset - alignmentOffset,
1884
+ ...(shouldAddOffset && {
1885
+ alignmentOffset
1886
+ })
1887
+ },
1888
+ reset: shouldAddOffset
1889
+ };
1890
+ }
1891
+ });
1892
+
1893
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
1894
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
1895
+ return allowedPlacementsSortedByAlignment.filter(placement => {
1896
+ if (alignment) {
1897
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
1898
+ }
1899
+ return true;
1900
+ });
1901
+ }
1902
+ /**
1903
+ * Optimizes the visibility of the floating element by choosing the placement
1904
+ * that has the most space available automatically, without needing to specify a
1905
+ * preferred placement. Alternative to `flip`.
1906
+ * @see https://floating-ui.com/docs/autoPlacement
1907
+ */
1908
+ const autoPlacement = function (options) {
1909
+ if (options === void 0) {
1910
+ options = {};
1911
+ }
1912
+ return {
1913
+ name: 'autoPlacement',
1914
+ options,
1915
+ async fn(state) {
1916
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
1917
+ const {
1918
+ rects,
1919
+ middlewareData,
1920
+ placement,
1921
+ platform,
1922
+ elements
1923
+ } = state;
1924
+ const {
1925
+ crossAxis = false,
1926
+ alignment,
1927
+ allowedPlacements = placements,
1928
+ autoAlignment = true,
1929
+ ...detectOverflowOptions
1930
+ } = evaluate(options, state);
1931
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
1932
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1933
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
1934
+ const currentPlacement = placements$1[currentIndex];
1935
+ if (currentPlacement == null) {
1936
+ return {};
1937
+ }
1938
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1939
+
1940
+ // Make `computeCoords` start from the right place.
1941
+ if (placement !== currentPlacement) {
1942
+ return {
1943
+ reset: {
1944
+ placement: placements$1[0]
1945
+ }
1946
+ };
1947
+ }
1948
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
1949
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
1950
+ placement: currentPlacement,
1951
+ overflows: currentOverflows
1952
+ }];
1953
+ const nextPlacement = placements$1[currentIndex + 1];
1954
+
1955
+ // There are more placements to check.
1956
+ if (nextPlacement) {
1957
+ return {
1958
+ data: {
1959
+ index: currentIndex + 1,
1960
+ overflows: allOverflows
1961
+ },
1962
+ reset: {
1963
+ placement: nextPlacement
1964
+ }
1965
+ };
1966
+ }
1967
+ const placementsSortedByMostSpace = allOverflows.map(d => {
1968
+ const alignment = getAlignment(d.placement);
1969
+ return [d.placement, alignment && crossAxis ?
1970
+ // Check along the mainAxis and main crossAxis side.
1971
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
1972
+ // Check only the mainAxis.
1973
+ d.overflows[0], d.overflows];
1974
+ }).sort((a, b) => a[1] - b[1]);
1975
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
1976
+ // Aligned placements should not check their opposite crossAxis
1977
+ // side.
1978
+ getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
1979
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
1980
+ if (resetPlacement !== placement) {
1981
+ return {
1982
+ data: {
1983
+ index: currentIndex + 1,
1984
+ overflows: allOverflows
1985
+ },
1986
+ reset: {
1987
+ placement: resetPlacement
1988
+ }
1989
+ };
1990
+ }
1991
+ return {};
1992
+ }
1993
+ };
1994
+ };
1995
+
1996
+ /**
1997
+ * Optimizes the visibility of the floating element by flipping the `placement`
1998
+ * in order to keep it in view when the preferred placement(s) will overflow the
1999
+ * clipping boundary. Alternative to `autoPlacement`.
2000
+ * @see https://floating-ui.com/docs/flip
2001
+ */
2002
+ const flip$1 = function (options) {
2003
+ if (options === void 0) {
2004
+ options = {};
2005
+ }
2006
+ return {
2007
+ name: 'flip',
2008
+ options,
2009
+ async fn(state) {
2010
+ var _middlewareData$arrow, _middlewareData$flip;
2011
+ const {
2012
+ placement,
2013
+ middlewareData,
2014
+ rects,
2015
+ initialPlacement,
2016
+ platform,
2017
+ elements
2018
+ } = state;
2019
+ const {
2020
+ mainAxis: checkMainAxis = true,
2021
+ crossAxis: checkCrossAxis = true,
2022
+ fallbackPlacements: specifiedFallbackPlacements,
2023
+ fallbackStrategy = 'bestFit',
2024
+ fallbackAxisSideDirection = 'none',
2025
+ flipAlignment = true,
2026
+ ...detectOverflowOptions
2027
+ } = evaluate(options, state);
2028
+
2029
+ // If a reset by the arrow was caused due to an alignment offset being
2030
+ // added, we should skip any logic now since `flip()` has already done its
2031
+ // work.
2032
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
2033
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
2034
+ return {};
2035
+ }
2036
+ const side = getSide(placement);
2037
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
2038
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
2039
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
2040
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
2041
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
2042
+ }
2043
+ const placements = [initialPlacement, ...fallbackPlacements];
2044
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2045
+ const overflows = [];
2046
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
2047
+ if (checkMainAxis) {
2048
+ overflows.push(overflow[side]);
2049
+ }
2050
+ if (checkCrossAxis) {
2051
+ const sides = getAlignmentSides(placement, rects, rtl);
2052
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
2053
+ }
2054
+ overflowsData = [...overflowsData, {
2055
+ placement,
2056
+ overflows
2057
+ }];
2058
+
2059
+ // One or more sides is overflowing.
2060
+ if (!overflows.every(side => side <= 0)) {
2061
+ var _middlewareData$flip2, _overflowsData$filter;
2062
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
2063
+ const nextPlacement = placements[nextIndex];
2064
+ if (nextPlacement) {
2065
+ // Try next placement and re-run the lifecycle.
2066
+ return {
2067
+ data: {
2068
+ index: nextIndex,
2069
+ overflows: overflowsData
2070
+ },
2071
+ reset: {
2072
+ placement: nextPlacement
2073
+ }
2074
+ };
2075
+ }
2076
+
2077
+ // First, find the candidates that fit on the mainAxis side of overflow,
2078
+ // then find the placement that fits the best on the main crossAxis side.
2079
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
2080
+
2081
+ // Otherwise fallback.
2082
+ if (!resetPlacement) {
2083
+ switch (fallbackStrategy) {
2084
+ case 'bestFit':
2085
+ {
2086
+ var _overflowsData$map$so;
2087
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
2088
+ if (placement) {
2089
+ resetPlacement = placement;
2090
+ }
2091
+ break;
2092
+ }
2093
+ case 'initialPlacement':
2094
+ resetPlacement = initialPlacement;
2095
+ break;
2096
+ }
2097
+ }
2098
+ if (placement !== resetPlacement) {
2099
+ return {
2100
+ reset: {
2101
+ placement: resetPlacement
2102
+ }
2103
+ };
2104
+ }
2105
+ }
2106
+ return {};
2107
+ }
2108
+ };
2109
+ };
2110
+
2111
+ function getSideOffsets(overflow, rect) {
2112
+ return {
2113
+ top: overflow.top - rect.height,
2114
+ right: overflow.right - rect.width,
2115
+ bottom: overflow.bottom - rect.height,
2116
+ left: overflow.left - rect.width
2117
+ };
2118
+ }
2119
+ function isAnySideFullyClipped(overflow) {
2120
+ return sides.some(side => overflow[side] >= 0);
2121
+ }
2122
+ /**
2123
+ * Provides data to hide the floating element in applicable situations, such as
2124
+ * when it is not in the same clipping context as the reference element.
2125
+ * @see https://floating-ui.com/docs/hide
2126
+ */
2127
+ const hide = function (options) {
2128
+ if (options === void 0) {
2129
+ options = {};
2130
+ }
2131
+ return {
2132
+ name: 'hide',
2133
+ options,
2134
+ async fn(state) {
2135
+ const {
2136
+ rects
2137
+ } = state;
2138
+ const {
2139
+ strategy = 'referenceHidden',
2140
+ ...detectOverflowOptions
2141
+ } = evaluate(options, state);
2142
+ switch (strategy) {
2143
+ case 'referenceHidden':
2144
+ {
2145
+ const overflow = await detectOverflow(state, {
2146
+ ...detectOverflowOptions,
2147
+ elementContext: 'reference'
2148
+ });
2149
+ const offsets = getSideOffsets(overflow, rects.reference);
2150
+ return {
2151
+ data: {
2152
+ referenceHiddenOffsets: offsets,
2153
+ referenceHidden: isAnySideFullyClipped(offsets)
2154
+ }
2155
+ };
2156
+ }
2157
+ case 'escaped':
2158
+ {
2159
+ const overflow = await detectOverflow(state, {
2160
+ ...detectOverflowOptions,
2161
+ altBoundary: true
2162
+ });
2163
+ const offsets = getSideOffsets(overflow, rects.floating);
2164
+ return {
2165
+ data: {
2166
+ escapedOffsets: offsets,
2167
+ escaped: isAnySideFullyClipped(offsets)
2168
+ }
2169
+ };
2170
+ }
2171
+ default:
2172
+ {
2173
+ return {};
2174
+ }
2175
+ }
2176
+ }
2177
+ };
2178
+ };
2179
+
2180
+ function getBoundingRect(rects) {
2181
+ const minX = min(...rects.map(rect => rect.left));
2182
+ const minY = min(...rects.map(rect => rect.top));
2183
+ const maxX = max(...rects.map(rect => rect.right));
2184
+ const maxY = max(...rects.map(rect => rect.bottom));
2185
+ return {
2186
+ x: minX,
2187
+ y: minY,
2188
+ width: maxX - minX,
2189
+ height: maxY - minY
2190
+ };
2191
+ }
2192
+ function getRectsByLine(rects) {
2193
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
2194
+ const groups = [];
2195
+ let prevRect = null;
2196
+ for (let i = 0; i < sortedRects.length; i++) {
2197
+ const rect = sortedRects[i];
2198
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
2199
+ groups.push([rect]);
2200
+ } else {
2201
+ groups[groups.length - 1].push(rect);
2202
+ }
2203
+ prevRect = rect;
2204
+ }
2205
+ return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
2206
+ }
2207
+ /**
2208
+ * Provides improved positioning for inline reference elements that can span
2209
+ * over multiple lines, such as hyperlinks or range selections.
2210
+ * @see https://floating-ui.com/docs/inline
2211
+ */
2212
+ const inline$1 = function (options) {
2213
+ if (options === void 0) {
2214
+ options = {};
2215
+ }
2216
+ return {
2217
+ name: 'inline',
2218
+ options,
2219
+ async fn(state) {
2220
+ const {
2221
+ placement,
2222
+ elements,
2223
+ rects,
2224
+ platform,
2225
+ strategy
2226
+ } = state;
2227
+ // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
2228
+ // ClientRect's bounds, despite the event listener being triggered. A
2229
+ // padding of 2 seems to handle this issue.
2230
+ const {
2231
+ padding = 2,
2232
+ x,
2233
+ y
2234
+ } = evaluate(options, state);
2235
+ const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
2236
+ const clientRects = getRectsByLine(nativeClientRects);
2237
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
2238
+ const paddingObject = getPaddingObject(padding);
2239
+ function getBoundingClientRect() {
2240
+ // There are two rects and they are disjoined.
2241
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
2242
+ // Find the first rect in which the point is fully inside.
2243
+ return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
2244
+ }
2245
+
2246
+ // There are 2 or more connected rects.
2247
+ if (clientRects.length >= 2) {
2248
+ if (getSideAxis(placement) === 'y') {
2249
+ const firstRect = clientRects[0];
2250
+ const lastRect = clientRects[clientRects.length - 1];
2251
+ const isTop = getSide(placement) === 'top';
2252
+ const top = firstRect.top;
2253
+ const bottom = lastRect.bottom;
2254
+ const left = isTop ? firstRect.left : lastRect.left;
2255
+ const right = isTop ? firstRect.right : lastRect.right;
2256
+ const width = right - left;
2257
+ const height = bottom - top;
2258
+ return {
2259
+ top,
2260
+ bottom,
2261
+ left,
2262
+ right,
2263
+ width,
2264
+ height,
2265
+ x: left,
2266
+ y: top
2267
+ };
2268
+ }
2269
+ const isLeftSide = getSide(placement) === 'left';
2270
+ const maxRight = max(...clientRects.map(rect => rect.right));
2271
+ const minLeft = min(...clientRects.map(rect => rect.left));
2272
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
2273
+ const top = measureRects[0].top;
2274
+ const bottom = measureRects[measureRects.length - 1].bottom;
2275
+ const left = minLeft;
2276
+ const right = maxRight;
2277
+ const width = right - left;
2278
+ const height = bottom - top;
2279
+ return {
2280
+ top,
2281
+ bottom,
2282
+ left,
2283
+ right,
2284
+ width,
2285
+ height,
2286
+ x: left,
2287
+ y: top
2288
+ };
2289
+ }
2290
+ return fallback;
2291
+ }
2292
+ const resetRects = await platform.getElementRects({
2293
+ reference: {
2294
+ getBoundingClientRect
2295
+ },
2296
+ floating: elements.floating,
2297
+ strategy
2298
+ });
2299
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
2300
+ return {
2301
+ reset: {
2302
+ rects: resetRects
2303
+ }
2304
+ };
2305
+ }
2306
+ return {};
2307
+ }
2308
+ };
2309
+ };
2310
+
2311
+ // For type backwards-compatibility, the `OffsetOptions` type was also
2312
+ // Derivable.
2313
+
2314
+ async function convertValueToCoords(state, options) {
2315
+ const {
2316
+ placement,
2317
+ platform,
2318
+ elements
2319
+ } = state;
2320
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
2321
+ const side = getSide(placement);
2322
+ const alignment = getAlignment(placement);
2323
+ const isVertical = getSideAxis(placement) === 'y';
2324
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
2325
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
2326
+ const rawValue = evaluate(options, state);
2327
+ let {
2328
+ mainAxis,
2329
+ crossAxis,
2330
+ alignmentAxis
2331
+ } = typeof rawValue === 'number' ? {
2332
+ mainAxis: rawValue,
2333
+ crossAxis: 0,
2334
+ alignmentAxis: null
2335
+ } : {
2336
+ mainAxis: 0,
2337
+ crossAxis: 0,
2338
+ alignmentAxis: null,
2339
+ ...rawValue
2340
+ };
2341
+ if (alignment && typeof alignmentAxis === 'number') {
2342
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
2343
+ }
2344
+ return isVertical ? {
2345
+ x: crossAxis * crossAxisMulti,
2346
+ y: mainAxis * mainAxisMulti
2347
+ } : {
2348
+ x: mainAxis * mainAxisMulti,
2349
+ y: crossAxis * crossAxisMulti
2350
+ };
2351
+ }
2352
+
2353
+ /**
2354
+ * Modifies the placement by translating the floating element along the
2355
+ * specified axes.
2356
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2357
+ * object may be passed.
2358
+ * @see https://floating-ui.com/docs/offset
2359
+ */
2360
+ const offset$1 = function (options) {
2361
+ if (options === void 0) {
2362
+ options = 0;
2363
+ }
2364
+ return {
2365
+ name: 'offset',
2366
+ options,
2367
+ async fn(state) {
2368
+ var _middlewareData$offse, _middlewareData$arrow;
2369
+ const {
2370
+ x,
2371
+ y,
2372
+ placement,
2373
+ middlewareData
2374
+ } = state;
2375
+ const diffCoords = await convertValueToCoords(state, options);
2376
+
2377
+ // If the placement is the same and the arrow caused an alignment offset
2378
+ // then we don't need to change the positioning coordinates.
2379
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
2380
+ return {};
2381
+ }
2382
+ return {
2383
+ x: x + diffCoords.x,
2384
+ y: y + diffCoords.y,
2385
+ data: {
2386
+ ...diffCoords,
2387
+ placement
2388
+ }
2389
+ };
2390
+ }
2391
+ };
2392
+ };
2393
+
2394
+ /**
2395
+ * Optimizes the visibility of the floating element by shifting it in order to
2396
+ * keep it in view when it will overflow the clipping boundary.
2397
+ * @see https://floating-ui.com/docs/shift
2398
+ */
2399
+ const shift$1 = function (options) {
2400
+ if (options === void 0) {
2401
+ options = {};
2402
+ }
2403
+ return {
2404
+ name: 'shift',
2405
+ options,
2406
+ async fn(state) {
2407
+ const {
2408
+ x,
2409
+ y,
2410
+ placement
2411
+ } = state;
2412
+ const {
2413
+ mainAxis: checkMainAxis = true,
2414
+ crossAxis: checkCrossAxis = false,
2415
+ limiter = {
2416
+ fn: _ref => {
2417
+ let {
2418
+ x,
2419
+ y
2420
+ } = _ref;
2421
+ return {
2422
+ x,
2423
+ y
2424
+ };
2425
+ }
2426
+ },
2427
+ ...detectOverflowOptions
2428
+ } = evaluate(options, state);
2429
+ const coords = {
2430
+ x,
2431
+ y
2432
+ };
2433
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2434
+ const crossAxis = getSideAxis(getSide(placement));
2435
+ const mainAxis = getOppositeAxis(crossAxis);
2436
+ let mainAxisCoord = coords[mainAxis];
2437
+ let crossAxisCoord = coords[crossAxis];
2438
+ if (checkMainAxis) {
2439
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
2440
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
2441
+ const min = mainAxisCoord + overflow[minSide];
2442
+ const max = mainAxisCoord - overflow[maxSide];
2443
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
2444
+ }
2445
+ if (checkCrossAxis) {
2446
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
2447
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
2448
+ const min = crossAxisCoord + overflow[minSide];
2449
+ const max = crossAxisCoord - overflow[maxSide];
2450
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
2451
+ }
2452
+ const limitedCoords = limiter.fn({
2453
+ ...state,
2454
+ [mainAxis]: mainAxisCoord,
2455
+ [crossAxis]: crossAxisCoord
2456
+ });
2457
+ return {
2458
+ ...limitedCoords,
2459
+ data: {
2460
+ x: limitedCoords.x - x,
2461
+ y: limitedCoords.y - y
2462
+ }
2463
+ };
2464
+ }
2465
+ };
2466
+ };
2467
+ /**
2468
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2469
+ */
2470
+ const limitShift$1 = function (options) {
2471
+ if (options === void 0) {
2472
+ options = {};
2473
+ }
2474
+ return {
2475
+ options,
2476
+ fn(state) {
2477
+ const {
2478
+ x,
2479
+ y,
2480
+ placement,
2481
+ rects,
2482
+ middlewareData
2483
+ } = state;
2484
+ const {
2485
+ offset = 0,
2486
+ mainAxis: checkMainAxis = true,
2487
+ crossAxis: checkCrossAxis = true
2488
+ } = evaluate(options, state);
2489
+ const coords = {
2490
+ x,
2491
+ y
2492
+ };
2493
+ const crossAxis = getSideAxis(placement);
2494
+ const mainAxis = getOppositeAxis(crossAxis);
2495
+ let mainAxisCoord = coords[mainAxis];
2496
+ let crossAxisCoord = coords[crossAxis];
2497
+ const rawOffset = evaluate(offset, state);
2498
+ const computedOffset = typeof rawOffset === 'number' ? {
2499
+ mainAxis: rawOffset,
2500
+ crossAxis: 0
2501
+ } : {
2502
+ mainAxis: 0,
2503
+ crossAxis: 0,
2504
+ ...rawOffset
2505
+ };
2506
+ if (checkMainAxis) {
2507
+ const len = mainAxis === 'y' ? 'height' : 'width';
2508
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
2509
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
2510
+ if (mainAxisCoord < limitMin) {
2511
+ mainAxisCoord = limitMin;
2512
+ } else if (mainAxisCoord > limitMax) {
2513
+ mainAxisCoord = limitMax;
2514
+ }
2515
+ }
2516
+ if (checkCrossAxis) {
2517
+ var _middlewareData$offse, _middlewareData$offse2;
2518
+ const len = mainAxis === 'y' ? 'width' : 'height';
2519
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
2520
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
2521
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
2522
+ if (crossAxisCoord < limitMin) {
2523
+ crossAxisCoord = limitMin;
2524
+ } else if (crossAxisCoord > limitMax) {
2525
+ crossAxisCoord = limitMax;
2526
+ }
2527
+ }
2528
+ return {
2529
+ [mainAxis]: mainAxisCoord,
2530
+ [crossAxis]: crossAxisCoord
2531
+ };
2532
+ }
2533
+ };
2534
+ };
2535
+
2536
+ /**
2537
+ * Provides data that allows you to change the size of the floating element —
2538
+ * for instance, prevent it from overflowing the clipping boundary or match the
2539
+ * width of the reference element.
2540
+ * @see https://floating-ui.com/docs/size
2541
+ */
2542
+ const size$1 = function (options) {
2543
+ if (options === void 0) {
2544
+ options = {};
2545
+ }
2546
+ return {
2547
+ name: 'size',
2548
+ options,
2549
+ async fn(state) {
2550
+ const {
2551
+ placement,
2552
+ rects,
2553
+ platform,
2554
+ elements
2555
+ } = state;
2556
+ const {
2557
+ apply = () => {},
2558
+ ...detectOverflowOptions
2559
+ } = evaluate(options, state);
2560
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2561
+ const side = getSide(placement);
2562
+ const alignment = getAlignment(placement);
2563
+ const isYAxis = getSideAxis(placement) === 'y';
2564
+ const {
2565
+ width,
2566
+ height
2567
+ } = rects.floating;
2568
+ let heightSide;
2569
+ let widthSide;
2570
+ if (side === 'top' || side === 'bottom') {
2571
+ heightSide = side;
2572
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
2573
+ } else {
2574
+ widthSide = side;
2575
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
2576
+ }
2577
+ const overflowAvailableHeight = height - overflow[heightSide];
2578
+ const overflowAvailableWidth = width - overflow[widthSide];
2579
+ const noShift = !state.middlewareData.shift;
2580
+ let availableHeight = overflowAvailableHeight;
2581
+ let availableWidth = overflowAvailableWidth;
2582
+ if (isYAxis) {
2583
+ const maximumClippingWidth = width - overflow.left - overflow.right;
2584
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
2585
+ } else {
2586
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
2587
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
2588
+ }
2589
+ if (noShift && !alignment) {
2590
+ const xMin = max(overflow.left, 0);
2591
+ const xMax = max(overflow.right, 0);
2592
+ const yMin = max(overflow.top, 0);
2593
+ const yMax = max(overflow.bottom, 0);
2594
+ if (isYAxis) {
2595
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
2596
+ } else {
2597
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
2598
+ }
2599
+ }
2600
+ await apply({
2601
+ ...state,
2602
+ availableWidth,
2603
+ availableHeight
2604
+ });
2605
+ const nextDimensions = await platform.getDimensions(elements.floating);
2606
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
2607
+ return {
2608
+ reset: {
2609
+ rects: true
2610
+ }
2611
+ };
2612
+ }
2613
+ return {};
2614
+ }
2615
+ };
2616
+ };
2617
+
2618
+ function hasWindow() {
2619
+ return typeof window !== 'undefined';
2620
+ }
2621
+ function getNodeName(node) {
2622
+ if (isNode(node)) {
2623
+ return (node.nodeName || '').toLowerCase();
2624
+ }
2625
+ // Mocked nodes in testing environments may not be instances of Node. By
2626
+ // returning `#document` an infinite loop won't occur.
2627
+ // https://github.com/floating-ui/floating-ui/issues/2317
2628
+ return '#document';
2629
+ }
2630
+ function getWindow(node) {
2631
+ var _node$ownerDocument;
2632
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2633
+ }
2634
+ function getDocumentElement(node) {
2635
+ var _ref;
2636
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2637
+ }
2638
+ function isNode(value) {
2639
+ if (!hasWindow()) {
2640
+ return false;
2641
+ }
2642
+ return value instanceof Node || value instanceof getWindow(value).Node;
2643
+ }
2644
+ function isElement(value) {
2645
+ if (!hasWindow()) {
2646
+ return false;
2647
+ }
2648
+ return value instanceof Element || value instanceof getWindow(value).Element;
2649
+ }
2650
+ function isHTMLElement(value) {
2651
+ if (!hasWindow()) {
2652
+ return false;
2653
+ }
2654
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
2655
+ }
2656
+ function isShadowRoot(value) {
2657
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
2658
+ return false;
2659
+ }
2660
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2661
+ }
2662
+ function isOverflowElement(element) {
2663
+ const {
2664
+ overflow,
2665
+ overflowX,
2666
+ overflowY,
2667
+ display
2668
+ } = getComputedStyle$1(element);
2669
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
2670
+ }
2671
+ function isTableElement(element) {
2672
+ return ['table', 'td', 'th'].includes(getNodeName(element));
2673
+ }
2674
+ function isTopLayer(element) {
2675
+ return [':popover-open', ':modal'].some(selector => {
2676
+ try {
2677
+ return element.matches(selector);
2678
+ } catch (e) {
2679
+ return false;
2680
+ }
2681
+ });
2682
+ }
2683
+ function isContainingBlock(elementOrCss) {
2684
+ const webkit = isWebKit();
2685
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
2686
+
2687
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2688
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
2689
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
2690
+ }
2691
+ function getContainingBlock(element) {
2692
+ let currentNode = getParentNode(element);
2693
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2694
+ if (isContainingBlock(currentNode)) {
2695
+ return currentNode;
2696
+ } else if (isTopLayer(currentNode)) {
2697
+ return null;
2698
+ }
2699
+ currentNode = getParentNode(currentNode);
2700
+ }
2701
+ return null;
2702
+ }
2703
+ function isWebKit() {
2704
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
2705
+ return CSS.supports('-webkit-backdrop-filter', 'none');
2706
+ }
2707
+ function isLastTraversableNode(node) {
2708
+ return ['html', 'body', '#document'].includes(getNodeName(node));
2709
+ }
2710
+ function getComputedStyle$1(element) {
2711
+ return getWindow(element).getComputedStyle(element);
2712
+ }
2713
+ function getNodeScroll(element) {
2714
+ if (isElement(element)) {
2715
+ return {
2716
+ scrollLeft: element.scrollLeft,
2717
+ scrollTop: element.scrollTop
2718
+ };
2719
+ }
2720
+ return {
2721
+ scrollLeft: element.scrollX,
2722
+ scrollTop: element.scrollY
2723
+ };
2724
+ }
2725
+ function getParentNode(node) {
2726
+ if (getNodeName(node) === 'html') {
2727
+ return node;
2728
+ }
2729
+ const result =
2730
+ // Step into the shadow DOM of the parent of a slotted node.
2731
+ node.assignedSlot ||
2732
+ // DOM Element detected.
2733
+ node.parentNode ||
2734
+ // ShadowRoot detected.
2735
+ isShadowRoot(node) && node.host ||
2736
+ // Fallback.
2737
+ getDocumentElement(node);
2738
+ return isShadowRoot(result) ? result.host : result;
2739
+ }
2740
+ function getNearestOverflowAncestor(node) {
2741
+ const parentNode = getParentNode(node);
2742
+ if (isLastTraversableNode(parentNode)) {
2743
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
2744
+ }
2745
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2746
+ return parentNode;
2747
+ }
2748
+ return getNearestOverflowAncestor(parentNode);
2749
+ }
2750
+ function getOverflowAncestors(node, list, traverseIframes) {
2751
+ var _node$ownerDocument2;
2752
+ if (list === void 0) {
2753
+ list = [];
2754
+ }
2755
+ if (traverseIframes === void 0) {
2756
+ traverseIframes = true;
2757
+ }
2758
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2759
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2760
+ const win = getWindow(scrollableAncestor);
2761
+ if (isBody) {
2762
+ const frameElement = getFrameElement(win);
2763
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
2764
+ }
2765
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2766
+ }
2767
+ function getFrameElement(win) {
2768
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
2769
+ }
2770
+
2771
+ function getCssDimensions(element) {
2772
+ const css = getComputedStyle$1(element);
2773
+ // In testing environments, the `width` and `height` properties are empty
2774
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
2775
+ let width = parseFloat(css.width) || 0;
2776
+ let height = parseFloat(css.height) || 0;
2777
+ const hasOffset = isHTMLElement(element);
2778
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2779
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2780
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2781
+ if (shouldFallback) {
2782
+ width = offsetWidth;
2783
+ height = offsetHeight;
2784
+ }
2785
+ return {
2786
+ width,
2787
+ height,
2788
+ $: shouldFallback
2789
+ };
2790
+ }
2791
+
2792
+ function unwrapElement(element) {
2793
+ return !isElement(element) ? element.contextElement : element;
2794
+ }
2795
+
2796
+ function getScale(element) {
2797
+ const domElement = unwrapElement(element);
2798
+ if (!isHTMLElement(domElement)) {
2799
+ return createCoords(1);
2800
+ }
2801
+ const rect = domElement.getBoundingClientRect();
2802
+ const {
2803
+ width,
2804
+ height,
2805
+ $
2806
+ } = getCssDimensions(domElement);
2807
+ let x = ($ ? round(rect.width) : rect.width) / width;
2808
+ let y = ($ ? round(rect.height) : rect.height) / height;
2809
+
2810
+ // 0, NaN, or Infinity should always fallback to 1.
2811
+
2812
+ if (!x || !Number.isFinite(x)) {
2813
+ x = 1;
2814
+ }
2815
+ if (!y || !Number.isFinite(y)) {
2816
+ y = 1;
2817
+ }
2818
+ return {
2819
+ x,
2820
+ y
2821
+ };
2822
+ }
2823
+
2824
+ const noOffsets = /*#__PURE__*/createCoords(0);
2825
+ function getVisualOffsets(element) {
2826
+ const win = getWindow(element);
2827
+ if (!isWebKit() || !win.visualViewport) {
2828
+ return noOffsets;
2829
+ }
2830
+ return {
2831
+ x: win.visualViewport.offsetLeft,
2832
+ y: win.visualViewport.offsetTop
2833
+ };
2834
+ }
2835
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2836
+ if (isFixed === void 0) {
2837
+ isFixed = false;
2838
+ }
2839
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
2840
+ return false;
2841
+ }
2842
+ return isFixed;
2843
+ }
2844
+
2845
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2846
+ if (includeScale === void 0) {
2847
+ includeScale = false;
2848
+ }
2849
+ if (isFixedStrategy === void 0) {
2850
+ isFixedStrategy = false;
2851
+ }
2852
+ const clientRect = element.getBoundingClientRect();
2853
+ const domElement = unwrapElement(element);
2854
+ let scale = createCoords(1);
2855
+ if (includeScale) {
2856
+ if (offsetParent) {
2857
+ if (isElement(offsetParent)) {
2858
+ scale = getScale(offsetParent);
2859
+ }
2860
+ } else {
2861
+ scale = getScale(element);
2862
+ }
2863
+ }
2864
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2865
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2866
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2867
+ let width = clientRect.width / scale.x;
2868
+ let height = clientRect.height / scale.y;
2869
+ if (domElement) {
2870
+ const win = getWindow(domElement);
2871
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2872
+ let currentWin = win;
2873
+ let currentIFrame = getFrameElement(currentWin);
2874
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2875
+ const iframeScale = getScale(currentIFrame);
2876
+ const iframeRect = currentIFrame.getBoundingClientRect();
2877
+ const css = getComputedStyle$1(currentIFrame);
2878
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
2879
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
2880
+ x *= iframeScale.x;
2881
+ y *= iframeScale.y;
2882
+ width *= iframeScale.x;
2883
+ height *= iframeScale.y;
2884
+ x += left;
2885
+ y += top;
2886
+ currentWin = getWindow(currentIFrame);
2887
+ currentIFrame = getFrameElement(currentWin);
2888
+ }
2889
+ }
2890
+ return rectToClientRect({
2891
+ width,
2892
+ height,
2893
+ x,
2894
+ y
2895
+ });
2896
+ }
2897
+
2898
+ // If <html> has a CSS width greater than the viewport, then this will be
2899
+ // incorrect for RTL.
2900
+ function getWindowScrollBarX(element, rect) {
2901
+ const leftScroll = getNodeScroll(element).scrollLeft;
2902
+ if (!rect) {
2903
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
2904
+ }
2905
+ return rect.left + leftScroll;
2906
+ }
2907
+
2908
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
2909
+ if (ignoreScrollbarX === void 0) {
2910
+ ignoreScrollbarX = false;
2911
+ }
2912
+ const htmlRect = documentElement.getBoundingClientRect();
2913
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
2914
+ // RTL <body> scrollbar.
2915
+ getWindowScrollBarX(documentElement, htmlRect));
2916
+ const y = htmlRect.top + scroll.scrollTop;
2917
+ return {
2918
+ x,
2919
+ y
2920
+ };
2921
+ }
2922
+
2923
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2924
+ let {
2925
+ elements,
2926
+ rect,
2927
+ offsetParent,
2928
+ strategy
2929
+ } = _ref;
2930
+ const isFixed = strategy === 'fixed';
2931
+ const documentElement = getDocumentElement(offsetParent);
2932
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2933
+ if (offsetParent === documentElement || topLayer && isFixed) {
2934
+ return rect;
2935
+ }
2936
+ let scroll = {
2937
+ scrollLeft: 0,
2938
+ scrollTop: 0
2939
+ };
2940
+ let scale = createCoords(1);
2941
+ const offsets = createCoords(0);
2942
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2943
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2944
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2945
+ scroll = getNodeScroll(offsetParent);
2946
+ }
2947
+ if (isHTMLElement(offsetParent)) {
2948
+ const offsetRect = getBoundingClientRect(offsetParent);
2949
+ scale = getScale(offsetParent);
2950
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2951
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2952
+ }
2953
+ }
2954
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
2955
+ return {
2956
+ width: rect.width * scale.x,
2957
+ height: rect.height * scale.y,
2958
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
2959
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
2960
+ };
2961
+ }
2962
+
2963
+ function getClientRects(element) {
2964
+ return Array.from(element.getClientRects());
2965
+ }
2966
+
2967
+ // Gets the entire size of the scrollable document area, even extending outside
2968
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2969
+ function getDocumentRect(element) {
2970
+ const html = getDocumentElement(element);
2971
+ const scroll = getNodeScroll(element);
2972
+ const body = element.ownerDocument.body;
2973
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
2974
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
2975
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2976
+ const y = -scroll.scrollTop;
2977
+ if (getComputedStyle$1(body).direction === 'rtl') {
2978
+ x += max(html.clientWidth, body.clientWidth) - width;
2979
+ }
2980
+ return {
2981
+ width,
2982
+ height,
2983
+ x,
2984
+ y
2985
+ };
2986
+ }
2987
+
2988
+ function getViewportRect(element, strategy) {
2989
+ const win = getWindow(element);
2990
+ const html = getDocumentElement(element);
2991
+ const visualViewport = win.visualViewport;
2992
+ let width = html.clientWidth;
2993
+ let height = html.clientHeight;
2994
+ let x = 0;
2995
+ let y = 0;
2996
+ if (visualViewport) {
2997
+ width = visualViewport.width;
2998
+ height = visualViewport.height;
2999
+ const visualViewportBased = isWebKit();
3000
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
3001
+ x = visualViewport.offsetLeft;
3002
+ y = visualViewport.offsetTop;
3003
+ }
3004
+ }
3005
+ return {
3006
+ width,
3007
+ height,
3008
+ x,
3009
+ y
3010
+ };
3011
+ }
3012
+
3013
+ // Returns the inner client rect, subtracting scrollbars if present.
3014
+ function getInnerBoundingClientRect(element, strategy) {
3015
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
3016
+ const top = clientRect.top + element.clientTop;
3017
+ const left = clientRect.left + element.clientLeft;
3018
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
3019
+ const width = element.clientWidth * scale.x;
3020
+ const height = element.clientHeight * scale.y;
3021
+ const x = left * scale.x;
3022
+ const y = top * scale.y;
3023
+ return {
3024
+ width,
3025
+ height,
3026
+ x,
3027
+ y
3028
+ };
3029
+ }
3030
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
3031
+ let rect;
3032
+ if (clippingAncestor === 'viewport') {
3033
+ rect = getViewportRect(element, strategy);
3034
+ } else if (clippingAncestor === 'document') {
3035
+ rect = getDocumentRect(getDocumentElement(element));
3036
+ } else if (isElement(clippingAncestor)) {
3037
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
3038
+ } else {
3039
+ const visualOffsets = getVisualOffsets(element);
3040
+ rect = {
3041
+ x: clippingAncestor.x - visualOffsets.x,
3042
+ y: clippingAncestor.y - visualOffsets.y,
3043
+ width: clippingAncestor.width,
3044
+ height: clippingAncestor.height
3045
+ };
3046
+ }
3047
+ return rectToClientRect(rect);
3048
+ }
3049
+ function hasFixedPositionAncestor(element, stopNode) {
3050
+ const parentNode = getParentNode(element);
3051
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
3052
+ return false;
3053
+ }
3054
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
3055
+ }
3056
+
3057
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
3058
+ // clipping (or hiding) child elements. This returns all clipping ancestors
3059
+ // of the given element up the tree.
3060
+ function getClippingElementAncestors(element, cache) {
3061
+ const cachedResult = cache.get(element);
3062
+ if (cachedResult) {
3063
+ return cachedResult;
3064
+ }
3065
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
3066
+ let currentContainingBlockComputedStyle = null;
3067
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
3068
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
3069
+
3070
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
3071
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
3072
+ const computedStyle = getComputedStyle$1(currentNode);
3073
+ const currentNodeIsContaining = isContainingBlock(currentNode);
3074
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
3075
+ currentContainingBlockComputedStyle = null;
3076
+ }
3077
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
3078
+ if (shouldDropCurrentNode) {
3079
+ // Drop non-containing blocks.
3080
+ result = result.filter(ancestor => ancestor !== currentNode);
3081
+ } else {
3082
+ // Record last containing block for next iteration.
3083
+ currentContainingBlockComputedStyle = computedStyle;
3084
+ }
3085
+ currentNode = getParentNode(currentNode);
3086
+ }
3087
+ cache.set(element, result);
3088
+ return result;
3089
+ }
3090
+
3091
+ // Gets the maximum area that the element is visible in due to any number of
3092
+ // clipping ancestors.
3093
+ function getClippingRect(_ref) {
3094
+ let {
3095
+ element,
3096
+ boundary,
3097
+ rootBoundary,
3098
+ strategy
3099
+ } = _ref;
3100
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
3101
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
3102
+ const firstClippingAncestor = clippingAncestors[0];
3103
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
3104
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
3105
+ accRect.top = max(rect.top, accRect.top);
3106
+ accRect.right = min(rect.right, accRect.right);
3107
+ accRect.bottom = min(rect.bottom, accRect.bottom);
3108
+ accRect.left = max(rect.left, accRect.left);
3109
+ return accRect;
3110
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
3111
+ return {
3112
+ width: clippingRect.right - clippingRect.left,
3113
+ height: clippingRect.bottom - clippingRect.top,
3114
+ x: clippingRect.left,
3115
+ y: clippingRect.top
3116
+ };
3117
+ }
3118
+
3119
+ function getDimensions(element) {
3120
+ const {
3121
+ width,
3122
+ height
3123
+ } = getCssDimensions(element);
3124
+ return {
3125
+ width,
3126
+ height
3127
+ };
3128
+ }
3129
+
3130
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
3131
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
3132
+ const documentElement = getDocumentElement(offsetParent);
3133
+ const isFixed = strategy === 'fixed';
3134
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
3135
+ let scroll = {
3136
+ scrollLeft: 0,
3137
+ scrollTop: 0
3138
+ };
3139
+ const offsets = createCoords(0);
3140
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3141
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
3142
+ scroll = getNodeScroll(offsetParent);
3143
+ }
3144
+ if (isOffsetParentAnElement) {
3145
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
3146
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
3147
+ offsets.y = offsetRect.y + offsetParent.clientTop;
3148
+ } else if (documentElement) {
3149
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
3150
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
3151
+ offsets.x = getWindowScrollBarX(documentElement);
3152
+ }
3153
+ }
3154
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
3155
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
3156
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
3157
+ return {
3158
+ x,
3159
+ y,
3160
+ width: rect.width,
3161
+ height: rect.height
3162
+ };
3163
+ }
3164
+
3165
+ function isStaticPositioned(element) {
3166
+ return getComputedStyle$1(element).position === 'static';
3167
+ }
3168
+
3169
+ function getTrueOffsetParent(element, polyfill) {
3170
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
3171
+ return null;
3172
+ }
3173
+ if (polyfill) {
3174
+ return polyfill(element);
3175
+ }
3176
+ let rawOffsetParent = element.offsetParent;
3177
+
3178
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
3179
+ // while Chrome and Safari return the <body> element. The <body> element must
3180
+ // be used to perform the correct calculations even if the <html> element is
3181
+ // non-static.
3182
+ if (getDocumentElement(element) === rawOffsetParent) {
3183
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
3184
+ }
3185
+ return rawOffsetParent;
3186
+ }
3187
+
3188
+ // Gets the closest ancestor positioned element. Handles some edge cases,
3189
+ // such as table ancestors and cross browser bugs.
3190
+ function getOffsetParent(element, polyfill) {
3191
+ const win = getWindow(element);
3192
+ if (isTopLayer(element)) {
3193
+ return win;
3194
+ }
3195
+ if (!isHTMLElement(element)) {
3196
+ let svgOffsetParent = getParentNode(element);
3197
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
3198
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
3199
+ return svgOffsetParent;
3200
+ }
3201
+ svgOffsetParent = getParentNode(svgOffsetParent);
3202
+ }
3203
+ return win;
3204
+ }
3205
+ let offsetParent = getTrueOffsetParent(element, polyfill);
3206
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
3207
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
3208
+ }
3209
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
3210
+ return win;
3211
+ }
3212
+ return offsetParent || getContainingBlock(element) || win;
3213
+ }
3214
+
3215
+ const getElementRects = async function (data) {
3216
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
3217
+ const getDimensionsFn = this.getDimensions;
3218
+ const floatingDimensions = await getDimensionsFn(data.floating);
3219
+ return {
3220
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
3221
+ floating: {
3222
+ x: 0,
3223
+ y: 0,
3224
+ width: floatingDimensions.width,
3225
+ height: floatingDimensions.height
3226
+ }
3227
+ };
3228
+ };
3229
+
3230
+ function isRTL(element) {
3231
+ return getComputedStyle$1(element).direction === 'rtl';
3232
+ }
3233
+
3234
+ const platform = {
3235
+ convertOffsetParentRelativeRectToViewportRelativeRect,
3236
+ getDocumentElement,
3237
+ getClippingRect,
3238
+ getOffsetParent,
3239
+ getElementRects,
3240
+ getClientRects,
3241
+ getDimensions,
3242
+ getScale,
3243
+ isElement,
3244
+ isRTL
3245
+ };
3246
+
3247
+ function rectsAreEqual(a, b) {
3248
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
3249
+ }
3250
+
3251
+ // https://samthor.au/2021/observing-dom/
3252
+ function observeMove(element, onMove) {
3253
+ let io = null;
3254
+ let timeoutId;
3255
+ const root = getDocumentElement(element);
3256
+ function cleanup() {
3257
+ var _io;
3258
+ clearTimeout(timeoutId);
3259
+ (_io = io) == null || _io.disconnect();
3260
+ io = null;
3261
+ }
3262
+ function refresh(skip, threshold) {
3263
+ if (skip === void 0) {
3264
+ skip = false;
3265
+ }
3266
+ if (threshold === void 0) {
3267
+ threshold = 1;
3268
+ }
3269
+ cleanup();
3270
+ const elementRectForRootMargin = element.getBoundingClientRect();
3271
+ const {
3272
+ left,
3273
+ top,
3274
+ width,
3275
+ height
3276
+ } = elementRectForRootMargin;
3277
+ if (!skip) {
3278
+ onMove();
3279
+ }
3280
+ if (!width || !height) {
3281
+ return;
3282
+ }
3283
+ const insetTop = floor(top);
3284
+ const insetRight = floor(root.clientWidth - (left + width));
3285
+ const insetBottom = floor(root.clientHeight - (top + height));
3286
+ const insetLeft = floor(left);
3287
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
3288
+ const options = {
3289
+ rootMargin,
3290
+ threshold: max(0, min(1, threshold)) || 1
3291
+ };
3292
+ let isFirstUpdate = true;
3293
+ function handleObserve(entries) {
3294
+ const ratio = entries[0].intersectionRatio;
3295
+ if (ratio !== threshold) {
3296
+ if (!isFirstUpdate) {
3297
+ return refresh();
3298
+ }
3299
+ if (!ratio) {
3300
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
3301
+ // to prevent an infinite loop of updates.
3302
+ timeoutId = setTimeout(() => {
3303
+ refresh(false, 1e-7);
3304
+ }, 1000);
3305
+ } else {
3306
+ refresh(false, ratio);
3307
+ }
3308
+ }
3309
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
3310
+ // It's possible that even though the ratio is reported as 1, the
3311
+ // element is not actually fully within the IntersectionObserver's root
3312
+ // area anymore. This can happen under performance constraints. This may
3313
+ // be a bug in the browser's IntersectionObserver implementation. To
3314
+ // work around this, we compare the element's bounding rect now with
3315
+ // what it was at the time we created the IntersectionObserver. If they
3316
+ // are not equal then the element moved, so we refresh.
3317
+ refresh();
3318
+ }
3319
+ isFirstUpdate = false;
3320
+ }
3321
+
3322
+ // Older browsers don't support a `document` as the root and will throw an
3323
+ // error.
3324
+ try {
3325
+ io = new IntersectionObserver(handleObserve, {
3326
+ ...options,
3327
+ // Handle <iframe>s
3328
+ root: root.ownerDocument
3329
+ });
3330
+ } catch (e) {
3331
+ io = new IntersectionObserver(handleObserve, options);
3332
+ }
3333
+ io.observe(element);
3334
+ }
3335
+ refresh(true);
3336
+ return cleanup;
3337
+ }
3338
+
3339
+ /**
3340
+ * Automatically updates the position of the floating element when necessary.
3341
+ * Should only be called when the floating element is mounted on the DOM or
3342
+ * visible on the screen.
3343
+ * @returns cleanup function that should be invoked when the floating element is
3344
+ * removed from the DOM or hidden from the screen.
3345
+ * @see https://floating-ui.com/docs/autoUpdate
3346
+ */
3347
+ function autoUpdate(reference, floating, update, options) {
3348
+ if (options === void 0) {
3349
+ options = {};
3350
+ }
3351
+ const {
3352
+ ancestorScroll = true,
3353
+ ancestorResize = true,
3354
+ elementResize = typeof ResizeObserver === 'function',
3355
+ layoutShift = typeof IntersectionObserver === 'function',
3356
+ animationFrame = false
3357
+ } = options;
3358
+ const referenceEl = unwrapElement(reference);
3359
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
3360
+ ancestors.forEach(ancestor => {
3361
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
3362
+ passive: true
3363
+ });
3364
+ ancestorResize && ancestor.addEventListener('resize', update);
3365
+ });
3366
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
3367
+ let reobserveFrame = -1;
3368
+ let resizeObserver = null;
3369
+ if (elementResize) {
3370
+ resizeObserver = new ResizeObserver(_ref => {
3371
+ let [firstEntry] = _ref;
3372
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
3373
+ // Prevent update loops when using the `size` middleware.
3374
+ // https://github.com/floating-ui/floating-ui/issues/1740
3375
+ resizeObserver.unobserve(floating);
3376
+ cancelAnimationFrame(reobserveFrame);
3377
+ reobserveFrame = requestAnimationFrame(() => {
3378
+ var _resizeObserver;
3379
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
3380
+ });
3381
+ }
3382
+ update();
3383
+ });
3384
+ if (referenceEl && !animationFrame) {
3385
+ resizeObserver.observe(referenceEl);
3386
+ }
3387
+ resizeObserver.observe(floating);
3388
+ }
3389
+ let frameId;
3390
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
3391
+ if (animationFrame) {
3392
+ frameLoop();
3393
+ }
3394
+ function frameLoop() {
3395
+ const nextRefRect = getBoundingClientRect(reference);
3396
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
3397
+ update();
3398
+ }
3399
+ prevRefRect = nextRefRect;
3400
+ frameId = requestAnimationFrame(frameLoop);
3401
+ }
3402
+ update();
3403
+ return () => {
3404
+ var _resizeObserver2;
3405
+ ancestors.forEach(ancestor => {
3406
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
3407
+ ancestorResize && ancestor.removeEventListener('resize', update);
3408
+ });
3409
+ cleanupIo == null || cleanupIo();
3410
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
3411
+ resizeObserver = null;
3412
+ if (animationFrame) {
3413
+ cancelAnimationFrame(frameId);
3414
+ }
3415
+ };
3416
+ }
3417
+
3418
+ /**
3419
+ * Modifies the placement by translating the floating element along the
3420
+ * specified axes.
3421
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
3422
+ * object may be passed.
3423
+ * @see https://floating-ui.com/docs/offset
3424
+ */
3425
+ const offset = offset$1;
3426
+
3427
+ /**
3428
+ * Optimizes the visibility of the floating element by choosing the placement
3429
+ * that has the most space available automatically, without needing to specify a
3430
+ * preferred placement. Alternative to `flip`.
3431
+ * @see https://floating-ui.com/docs/autoPlacement
3432
+ */
3433
+ autoPlacement;
3434
+
3435
+ /**
3436
+ * Optimizes the visibility of the floating element by shifting it in order to
3437
+ * keep it in view when it will overflow the clipping boundary.
3438
+ * @see https://floating-ui.com/docs/shift
3439
+ */
3440
+ const shift = shift$1;
3441
+
3442
+ /**
3443
+ * Optimizes the visibility of the floating element by flipping the `placement`
3444
+ * in order to keep it in view when the preferred placement(s) will overflow the
3445
+ * clipping boundary. Alternative to `autoPlacement`.
3446
+ * @see https://floating-ui.com/docs/flip
3447
+ */
3448
+ const flip = flip$1;
3449
+
3450
+ /**
3451
+ * Provides data that allows you to change the size of the floating element —
3452
+ * for instance, prevent it from overflowing the clipping boundary or match the
3453
+ * width of the reference element.
3454
+ * @see https://floating-ui.com/docs/size
3455
+ */
3456
+ const size = size$1;
3457
+
3458
+ /**
3459
+ * Provides data to hide the floating element in applicable situations, such as
3460
+ * when it is not in the same clipping context as the reference element.
3461
+ * @see https://floating-ui.com/docs/hide
3462
+ */
3463
+ hide;
3464
+
3465
+ /**
3466
+ * Provides data to position an inner element of the floating element so that it
3467
+ * appears centered to the reference element.
3468
+ * @see https://floating-ui.com/docs/arrow
3469
+ */
3470
+ const arrow = arrow$1;
3471
+
3472
+ /**
3473
+ * Provides improved positioning for inline reference elements that can span
3474
+ * over multiple lines, such as hyperlinks or range selections.
3475
+ * @see https://floating-ui.com/docs/inline
3476
+ */
3477
+ const inline = inline$1;
3478
+
3479
+ /**
3480
+ * Built-in `limiter` that will stop `shift()` at a certain point.
3481
+ */
3482
+ const limitShift = limitShift$1;
3483
+
3484
+ /**
3485
+ * Computes the `x` and `y` coordinates that will place the floating element
3486
+ * next to a given reference element.
3487
+ */
3488
+ const computePosition = (reference, floating, options) => {
3489
+ // This caches the expensive `getClippingElementAncestors` function so that
3490
+ // multiple lifecycle resets re-use the same result. It only lives for a
3491
+ // single call. If other functions become expensive, we can add them as well.
3492
+ const cache = new Map();
3493
+ const mergedOptions = {
3494
+ platform,
3495
+ ...options
3496
+ };
3497
+ const platformWithCache = {
3498
+ ...mergedOptions.platform,
3499
+ _c: cache
3500
+ };
3501
+ return computePosition$1(reference, floating, {
3502
+ ...mergedOptions,
3503
+ platform: platformWithCache
3504
+ });
3505
+ };
3506
+
3507
+ (()=>{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=`
3508
+ :where([popover]) {
3509
+ position: fixed;
3510
+ z-index: 2147483647;
3511
+ inset: 0;
3512
+ padding: 0.25em;
3513
+ width: fit-content;
3514
+ height: fit-content;
3515
+ border-width: initial;
3516
+ border-color: initial;
3517
+ border-image: initial;
3518
+ border-style: solid;
3519
+ background-color: canvas;
3520
+ color: canvastext;
3521
+ overflow: auto;
3522
+ margin: auto;
3523
+ }
3524
+
3525
+ :where(dialog[popover][open]) {
3526
+ display: revert;
3527
+ }
3528
+
3529
+ :where([anchor].\\:popover-open) {
3530
+ inset: auto;
3531
+ }
3532
+
3533
+ :where([anchor]:popover-open) {
3534
+ inset: auto;
3535
+ }
3536
+
3537
+ @supports not (background-color: canvas) {
3538
+ :where([popover]) {
3539
+ background-color: white;
3540
+ color: black;
3541
+ }
3542
+ }
3543
+
3544
+ @supports (width: -moz-fit-content) {
3545
+ :where([popover]) {
3546
+ width: -moz-fit-content;
3547
+ height: -moz-fit-content;
3548
+ }
3549
+ }
3550
+
3551
+ @supports not (inset: 0) {
3552
+ :where([popover]) {
3553
+ top: 0;
3554
+ left: 0;
3555
+ right: 0;
3556
+ bottom: 0;
3557
+ }
3558
+ }
3559
+
3560
+ :where([popover]:not(.\\:popover-open)) {
3561
+ display: none;
3562
+ }
3563
+ `,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();})();
3564
+
3565
+ const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;z-index:1060;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:var(--post-device-elevation-300);width:max-content;color:var(--post-current-palette-fg);background-color:var(--post-current-palette-bg);border:2px solid rgba(0,0,0,0);border-radius:4px}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer)[safe-space]::after{content:\"\";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--safe-space-cursor-x, 0) var(--safe-space-cursor-y, 0), var(--safe-space-popover-x-start, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-start, 0)), var(--safe-space-popover-x-end, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--safe-space-trigger-x-start, var(--safe-space-trigger-x, 0)) var(--safe-space-trigger-y, var(--safe-space-trigger-y-start, 0)), var(--safe-space-trigger-x-end, var(--safe-space-trigger-x, 0)) var(--safe-space-trigger-y, var(--safe-space-trigger-y-end, 0)), var(--safe-space-popover-x-end, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-end, 0)), var(--safe-space-popover-x-start, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-start, 0)))}:where(post-popovercontainer):not(:has(.arrow))>div{box-shadow:var(--post-device-elevation-300)}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-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)}";
3566
+ const PostPopovercontainerStyle0 = postPopovercontainerCss;
3567
+
3568
+ const PostPopovercontainer = class {
3569
+ constructor(hostRef) {
3570
+ registerInstance(this, hostRef);
3571
+ this.postToggle = createEvent(this, "postToggle", 7);
3572
+ this.manualClose = false;
3573
+ this.placement = 'top';
3574
+ this.edgeGap = 8;
3575
+ this.arrow = false;
3576
+ this.safeSpace = undefined;
3577
+ }
3578
+ static STATIC_SIDES = {
3579
+ top: 'bottom',
3580
+ right: 'left',
3581
+ bottom: 'top',
3582
+ left: 'right',
3583
+ };
3584
+ static PROPERTIES_TO_CLEAR = [
3585
+ '--safe-space-popover-x',
3586
+ '--safe-space-popover-y',
3587
+ '--safe-space-popover-x-start',
3588
+ '--safe-space-popover-x-end',
3589
+ '--safe-space-popover-y-start',
3590
+ '--safe-space-popover-y-end',
3591
+ '--safe-space-trigger-x',
3592
+ '--safe-space-trigger-y',
3593
+ '--safe-space-trigger-x-start',
3594
+ '--safe-space-trigger-x-end',
3595
+ '--safe-space-trigger-y-start',
3596
+ '--safe-space-trigger-y-end',
3597
+ ];
3598
+ get host() { return getElement(this); }
3599
+ arrowRef;
3600
+ eventTarget;
3601
+ clearAutoUpdate;
3602
+ toggleTimeoutId;
3603
+ /**
3604
+ * Fires whenever the popover gets shown or hidden, passing the new state in event.details as a boolean
3605
+ */
3606
+ postToggle;
3607
+ /**
3608
+ * Updates cursor position for safe space feature when popover is open.
3609
+ * Sets CSS custom properties for dynamic styling of safe area.
3610
+ * @param event MouseEvent with cursor position
3611
+ */
3612
+ mouseTrackingHandler(event) {
3613
+ this.host.style.setProperty('--safe-space-cursor-x', `${event.clientX}px`);
3614
+ this.host.style.setProperty('--safe-space-cursor-y', `${event.clientY}px`);
3615
+ }
3616
+ componentDidLoad() {
3617
+ this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
3618
+ }
3619
+ disconnectedCallback() {
3620
+ if (typeof this.clearAutoUpdate === 'function') {
3621
+ this.clearAutoUpdate();
3622
+ }
3623
+ }
3624
+ /**
3625
+ * Programmatically display the tooltip
3626
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3627
+ */
3628
+ async show(target) {
3629
+ if (!this.toggleTimeoutId) {
3630
+ this.eventTarget = target;
3631
+ this.calculatePosition();
3632
+ this.host.showPopover();
3633
+ }
3634
+ }
3635
+ /**
3636
+ * Programmatically hide this tooltip
3637
+ */
3638
+ async hide() {
3639
+ if (!this.toggleTimeoutId) {
3640
+ this.eventTarget = null;
3641
+ this.host.hidePopover();
3642
+ }
3643
+ }
3644
+ /**
3645
+ * Toggle tooltip display
3646
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3647
+ * @param force Pass true to always show or false to always hide
3648
+ */
3649
+ async toggle(target, force) {
3650
+ // Prevent instant double toggle
3651
+ if (!this.toggleTimeoutId) {
3652
+ this.eventTarget = target;
3653
+ this.calculatePosition();
3654
+ this.host.togglePopover(force);
3655
+ this.toggleTimeoutId = null;
3656
+ }
3657
+ return this.host.matches(':where(:popover-open, .popover-open)');
3658
+ }
3659
+ /**
3660
+ * Start or stop auto updates based on tooltip events.
3661
+ * Tooltips can be closed or opened with other methods than class members,
3662
+ * therefore listening to the toggle event is safer for cleaning up.
3663
+ * @param e ToggleEvent
3664
+ */
3665
+ handleToggle(e) {
3666
+ this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
3667
+ const isOpen = e.newState === 'open';
3668
+ if (isOpen) {
3669
+ this.startAutoupdates();
3670
+ if (this.safeSpace)
3671
+ window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
3672
+ }
3673
+ else {
3674
+ if (typeof this.clearAutoUpdate === 'function')
3675
+ this.clearAutoUpdate();
3676
+ if (this.safeSpace)
3677
+ window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
3678
+ }
3679
+ this.postToggle.emit(isOpen);
3680
+ }
3681
+ /**
3682
+ * Start listening for DOM updates, scroll events etc. that have
3683
+ * an influence on tooltip positioning
3684
+ */
3685
+ startAutoupdates() {
3686
+ this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
3687
+ }
3688
+ async calculatePosition() {
3689
+ const { x, y, middlewareData, placement } = await this.computeMainPosition();
3690
+ const currentPlacement = placement.split('-')[0];
3691
+ // Position popover
3692
+ this.host.style.left = `${x}px`;
3693
+ this.host.style.top = `${y}px`;
3694
+ // Position arrow if enabled
3695
+ if (this.arrow && middlewareData.arrow) {
3696
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
3697
+ const staticSide = PostPopovercontainer.STATIC_SIDES[currentPlacement];
3698
+ if (staticSide) {
3699
+ Object.assign(this.arrowRef.style, {
3700
+ left: arrowX ? `${arrowX}px` : '',
3701
+ top: arrowY ? `${arrowY}px` : '',
3702
+ [staticSide]: '-7px',
3703
+ });
3704
+ }
3705
+ }
3706
+ // Handle safe space if enabled
3707
+ if (this.safeSpace && this.eventTarget) {
3708
+ await this.updateSafeSpaceBoundaries(currentPlacement);
3709
+ }
3710
+ }
3711
+ async computeMainPosition() {
3712
+ const gap = this.edgeGap;
3713
+ const middleware = [
3714
+ flip(),
3715
+ inline(),
3716
+ shift({
3717
+ padding: gap,
3718
+ limiter: limitShift({
3719
+ offset: 32,
3720
+ }),
3721
+ }),
3722
+ size({
3723
+ apply({ availableWidth, elements }) {
3724
+ Object.assign(elements.floating.style, {
3725
+ maxWidth: `${availableWidth - gap * 2}px`,
3726
+ });
3727
+ },
3728
+ }),
3729
+ offset(this.arrow ? gap + 4 : gap),
3730
+ ];
3731
+ if (this.arrow) {
3732
+ middleware.push(arrow({ element: this.arrowRef, padding: gap }));
3733
+ }
3734
+ return computePosition(this.eventTarget, this.host, {
3735
+ placement: this.placement || 'top',
3736
+ strategy: 'fixed',
3737
+ middleware,
3738
+ });
3739
+ }
3740
+ async updateSafeSpaceBoundaries(currentPlacement) {
3741
+ const targetRect = this.eventTarget.getBoundingClientRect();
3742
+ const popoverRect = this.host.getBoundingClientRect();
3743
+ const isVertical = currentPlacement === 'top' || currentPlacement === 'bottom';
3744
+ // Helper function to get positioning data based on placement
3745
+ const getPositioningData = (placement, popoverRect, targetRect) => {
3746
+ if (placement === 'top' || placement === 'bottom') {
3747
+ return {
3748
+ popover: {
3749
+ y: placement === 'top' ? popoverRect.bottom : popoverRect.top,
3750
+ xStart: popoverRect.left,
3751
+ xEnd: popoverRect.right,
3752
+ },
3753
+ trigger: {
3754
+ y: placement === 'top' ? targetRect.top : targetRect.bottom,
3755
+ xStart: targetRect.left,
3756
+ xEnd: targetRect.right,
3757
+ },
3758
+ };
3759
+ }
3760
+ else {
3761
+ // left or right
3762
+ return {
3763
+ popover: {
3764
+ x: placement === 'left' ? popoverRect.right : popoverRect.left,
3765
+ yStart: popoverRect.top,
3766
+ yEnd: popoverRect.bottom,
3767
+ },
3768
+ trigger: {
3769
+ x: placement === 'left' ? targetRect.left : targetRect.right,
3770
+ yStart: targetRect.top,
3771
+ yEnd: targetRect.bottom,
3772
+ },
3773
+ };
3774
+ }
3775
+ };
3776
+ const posData = getPositioningData(currentPlacement, popoverRect, targetRect);
3777
+ // Clear previous values
3778
+ PostPopovercontainer.PROPERTIES_TO_CLEAR.forEach(prop => {
3779
+ this.host.style.removeProperty(prop);
3780
+ });
3781
+ if (isVertical) {
3782
+ // For top/bottom placement
3783
+ this.host.style.setProperty('--safe-space-popover-y', `${posData.popover.y}px`);
3784
+ this.host.style.setProperty('--safe-space-popover-x-start', `${posData.popover.xStart}px`);
3785
+ this.host.style.setProperty('--safe-space-popover-x-end', `${posData.popover.xEnd}px`);
3786
+ this.host.style.setProperty('--safe-space-trigger-y', `${posData.trigger.y}px`);
3787
+ this.host.style.setProperty('--safe-space-trigger-x-start', `${posData.trigger.xStart}px`);
3788
+ this.host.style.setProperty('--safe-space-trigger-x-end', `${posData.trigger.xEnd}px`);
3789
+ }
3790
+ else {
3791
+ // For left/right placement
3792
+ this.host.style.setProperty('--safe-space-popover-x', `${posData.popover.x}px`);
3793
+ this.host.style.setProperty('--safe-space-popover-y-start', `${posData.popover.yStart}px`);
3794
+ this.host.style.setProperty('--safe-space-popover-y-end', `${posData.popover.yEnd}px`);
3795
+ this.host.style.setProperty('--safe-space-trigger-x', `${posData.trigger.x}px`);
3796
+ this.host.style.setProperty('--safe-space-trigger-y-start', `${posData.trigger.yStart}px`);
3797
+ this.host.style.setProperty('--safe-space-trigger-y-end', `${posData.trigger.yEnd}px`);
3798
+ }
3799
+ }
3800
+ render() {
3801
+ return (h(Host, { key: '2d04c94fe2a6de0c0fe17c1e2dcb99481d13336b', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: '3653be7880e5b896ae85e97ad709838732032f2d' }, this.arrow && (h("span", { key: '770f1727acf0ccb47e3940d034850df9fc3a6096', class: "arrow", ref: el => {
3802
+ this.arrowRef = el;
3803
+ } })), h("slot", { key: 'b12e95d51accec79a08fda3970f3b46ba7147ed7' }))));
3804
+ }
3805
+ };
3806
+ PostPopovercontainer.style = PostPopovercontainerStyle0;
3807
+
3808
+ 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}";
3809
+ const PostTogglebuttonStyle0 = postTogglebuttonCss;
3810
+
3811
+ const PostTogglebutton = class {
3812
+ constructor(hostRef) {
3813
+ registerInstance(this, hostRef);
3814
+ this.toggled = false;
3815
+ }
3816
+ get host() { return getElement(this); }
3817
+ validateToggled() {
3818
+ checkType(this, 'toggled', 'boolean');
3819
+ }
3820
+ componentWillLoad() {
3821
+ this.validateToggled();
3822
+ // add event listener to not override listener that might be set on the host
3823
+ this.host.addEventListener('click', () => this.handleClick());
3824
+ this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
3825
+ }
3826
+ handleClick = () => {
3827
+ this.toggled = !this.toggled;
3828
+ };
3829
+ handleKeydown = (event) => {
3830
+ // perform a click when enter or spaced are pressed to mimic the button behavior
3831
+ if (event.key === 'Enter' || event.key === ' ') {
3832
+ event.preventDefault(); // prevents the page from scrolling when space is pressed
3833
+ this.host.click();
3834
+ }
3835
+ };
3836
+ render() {
3837
+ return (h(Host, { key: '3a1429a9b67b8cfafae184fe0d060ee3a04974e0', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '9ab1537574423740fc335fde732c699698acac25' })));
3838
+ }
3839
+ static get watchers() { return {
3840
+ "toggled": ["validateToggled"]
3841
+ }; }
3842
+ };
3843
+ PostTogglebutton.style = PostTogglebuttonStyle0;
3844
+
3845
+ export { PostClosebutton as P, PostHeader as a, PostIcon as b, PostLanguageOption as c, PostLanguageSwitch as d, PostList as e, PostListItem as f, PostLogo as g, PostMainnavigation as h, PostMegadropdown as i, PostMegadropdownTrigger as j, PostMenu as k, PostMenuTrigger as l, PostPopovercontainer as m, PostTogglebutton as n };