@swisspost/internet-header 1.5.0 → 1.5.2

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 (139) hide show
  1. package/dist/cjs/index-3216e4c8.js +176 -0
  2. package/dist/cjs/index-3216e4c8.js.map +1 -0
  3. package/dist/cjs/{language.service-7dbf739d.js → language.service-41b458b1.js} +6 -1
  4. package/dist/cjs/language.service-41b458b1.js.map +1 -0
  5. package/dist/cjs/post-language-switch.cjs.entry.js +1 -1
  6. package/dist/cjs/post-logo.cjs.entry.js +1 -1
  7. package/dist/cjs/post-main-navigation.cjs.entry.js +2 -2
  8. package/dist/cjs/post-main-navigation.cjs.entry.js.map +1 -1
  9. package/dist/cjs/post-search.cjs.entry.js +1 -1
  10. package/dist/cjs/post-skiplinks.cjs.entry.js +2 -2
  11. package/dist/cjs/post-skiplinks.cjs.entry.js.map +1 -1
  12. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js +112 -92
  13. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js.map +1 -1
  14. package/dist/cjs/swisspost-internet-header.cjs.entry.js +15 -13
  15. package/dist/cjs/swisspost-internet-header.cjs.entry.js.map +1 -1
  16. package/dist/collection/assets/i18n/translations.js +5 -0
  17. package/dist/collection/assets/i18n/translations.js.map +1 -1
  18. package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.css +0 -4
  19. package/dist/collection/components/post-main-navigation/post-main-navigation.css +1 -1
  20. package/dist/collection/components/post-skiplinks/post-skiplinks.js +1 -1
  21. package/dist/collection/components/post-skiplinks/post-skiplinks.js.map +1 -1
  22. package/dist/collection/models/general.model.js.map +1 -1
  23. package/dist/collection/services/config.service.js +5 -3
  24. package/dist/collection/services/config.service.js.map +1 -1
  25. package/dist/components/index2.js +67 -35
  26. package/dist/components/index2.js.map +1 -1
  27. package/dist/components/language.service.js +5 -0
  28. package/dist/components/language.service.js.map +1 -1
  29. package/dist/components/post-main-navigation2.js +1 -1
  30. package/dist/components/post-main-navigation2.js.map +1 -1
  31. package/dist/components/post-skiplinks2.js +1 -1
  32. package/dist/components/post-skiplinks2.js.map +1 -1
  33. package/dist/components/swisspost-internet-breadcrumbs.js +110 -90
  34. package/dist/components/swisspost-internet-breadcrumbs.js.map +1 -1
  35. package/dist/components/swisspost-internet-header.js +13 -11
  36. package/dist/components/swisspost-internet-header.js.map +1 -1
  37. package/dist/esm/index-d2256e06.js +173 -0
  38. package/dist/esm/index-d2256e06.js.map +1 -0
  39. package/dist/esm/{language.service-023d2711.js → language.service-85d8689e.js} +6 -1
  40. package/dist/esm/language.service-85d8689e.js.map +1 -0
  41. package/dist/esm/post-language-switch.entry.js +1 -1
  42. package/dist/esm/post-logo.entry.js +1 -1
  43. package/dist/esm/post-main-navigation.entry.js +2 -2
  44. package/dist/esm/post-main-navigation.entry.js.map +1 -1
  45. package/dist/esm/post-search.entry.js +1 -1
  46. package/dist/esm/post-skiplinks.entry.js +2 -2
  47. package/dist/esm/post-skiplinks.entry.js.map +1 -1
  48. package/dist/esm/swisspost-internet-breadcrumbs.entry.js +112 -92
  49. package/dist/esm/swisspost-internet-breadcrumbs.entry.js.map +1 -1
  50. package/dist/esm/swisspost-internet-header.entry.js +15 -13
  51. package/dist/esm/swisspost-internet-header.entry.js.map +1 -1
  52. package/dist/esm-es5/index-d2256e06.js +2 -0
  53. package/dist/esm-es5/index-d2256e06.js.map +1 -0
  54. package/dist/esm-es5/language.service-85d8689e.js +2 -0
  55. package/dist/esm-es5/language.service-85d8689e.js.map +1 -0
  56. package/dist/esm-es5/post-language-switch.entry.js +1 -1
  57. package/dist/esm-es5/post-logo.entry.js +1 -1
  58. package/dist/esm-es5/post-main-navigation.entry.js +1 -1
  59. package/dist/esm-es5/post-main-navigation.entry.js.map +1 -1
  60. package/dist/esm-es5/post-search.entry.js +1 -1
  61. package/dist/esm-es5/post-skiplinks.entry.js +1 -1
  62. package/dist/esm-es5/post-skiplinks.entry.js.map +1 -1
  63. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js +2 -2
  64. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js.map +1 -1
  65. package/dist/esm-es5/swisspost-internet-header.entry.js +1 -1
  66. package/dist/esm-es5/swisspost-internet-header.entry.js.map +1 -1
  67. package/dist/swisspost-internet-header/p-17a47667.system.js +1 -1
  68. package/dist/swisspost-internet-header/{p-38d645ba.system.entry.js → p-1f13dad6.system.entry.js} +2 -2
  69. package/dist/swisspost-internet-header/{p-38d645ba.system.entry.js.map → p-1f13dad6.system.entry.js.map} +0 -0
  70. package/dist/swisspost-internet-header/{p-5d2fac3b.system.entry.js → p-2df9df9c.system.entry.js} +2 -2
  71. package/dist/swisspost-internet-header/{p-5d2fac3b.system.entry.js.map → p-2df9df9c.system.entry.js.map} +0 -0
  72. package/dist/swisspost-internet-header/{p-95b81c4d.entry.js → p-2fd9a085.entry.js} +2 -2
  73. package/dist/swisspost-internet-header/{p-95b81c4d.entry.js.map → p-2fd9a085.entry.js.map} +1 -1
  74. package/dist/swisspost-internet-header/p-324563ab.system.js +2 -0
  75. package/dist/swisspost-internet-header/p-324563ab.system.js.map +1 -0
  76. package/dist/swisspost-internet-header/p-33ff32c6.entry.js +2 -0
  77. package/dist/swisspost-internet-header/p-33ff32c6.entry.js.map +1 -0
  78. package/dist/swisspost-internet-header/{p-493337e1.system.entry.js → p-38f55161.system.entry.js} +2 -2
  79. package/dist/swisspost-internet-header/{p-493337e1.system.entry.js.map → p-38f55161.system.entry.js.map} +0 -0
  80. package/dist/swisspost-internet-header/p-4f39b3a4.system.entry.js +2 -0
  81. package/dist/swisspost-internet-header/p-4f39b3a4.system.entry.js.map +1 -0
  82. package/dist/swisspost-internet-header/p-5adcac2a.entry.js +6 -0
  83. package/dist/swisspost-internet-header/p-5adcac2a.entry.js.map +1 -0
  84. package/dist/swisspost-internet-header/{p-0cba8ab4.entry.js → p-5b22e42c.entry.js} +2 -2
  85. package/dist/swisspost-internet-header/{p-0cba8ab4.entry.js.map → p-5b22e42c.entry.js.map} +0 -0
  86. package/dist/swisspost-internet-header/p-733756a9.system.entry.js +7 -0
  87. package/dist/swisspost-internet-header/p-733756a9.system.entry.js.map +1 -0
  88. package/dist/swisspost-internet-header/{p-322526ef.entry.js → p-812b69b4.entry.js} +2 -2
  89. package/dist/swisspost-internet-header/{p-322526ef.entry.js.map → p-812b69b4.entry.js.map} +0 -0
  90. package/dist/swisspost-internet-header/p-84d73529.system.entry.js +2 -0
  91. package/dist/swisspost-internet-header/p-84d73529.system.entry.js.map +1 -0
  92. package/dist/swisspost-internet-header/{p-62c5cf26.entry.js → p-908c0350.entry.js} +2 -2
  93. package/dist/swisspost-internet-header/{p-62c5cf26.entry.js.map → p-908c0350.entry.js.map} +0 -0
  94. package/dist/swisspost-internet-header/p-9b4d5e90.system.js +2 -0
  95. package/dist/swisspost-internet-header/p-9b4d5e90.system.js.map +1 -0
  96. package/dist/swisspost-internet-header/p-a6001d1e.js +2 -0
  97. package/dist/swisspost-internet-header/p-a6001d1e.js.map +1 -0
  98. package/dist/swisspost-internet-header/p-a74b380d.js +2 -0
  99. package/dist/swisspost-internet-header/p-a74b380d.js.map +1 -0
  100. package/dist/swisspost-internet-header/p-c565414e.entry.js +2 -0
  101. package/dist/swisspost-internet-header/p-c565414e.entry.js.map +1 -0
  102. package/dist/swisspost-internet-header/{p-d6539597.system.entry.js → p-c5f85f6e.system.entry.js} +2 -2
  103. package/dist/swisspost-internet-header/{p-d6539597.system.entry.js.map → p-c5f85f6e.system.entry.js.map} +1 -1
  104. package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +1 -1
  105. package/dist/types/assets/i18n/translations.d.ts +5 -0
  106. package/dist/types/models/general.model.d.ts +1 -1
  107. package/dist/types/services/language.service.d.ts +5 -0
  108. package/package.json +8 -8
  109. package/readme.md +1 -1
  110. package/dist/cjs/index-e7245d60.js +0 -144
  111. package/dist/cjs/index-e7245d60.js.map +0 -1
  112. package/dist/cjs/language.service-7dbf739d.js.map +0 -1
  113. package/dist/esm/index-a75df186.js +0 -141
  114. package/dist/esm/index-a75df186.js.map +0 -1
  115. package/dist/esm/language.service-023d2711.js.map +0 -1
  116. package/dist/esm-es5/index-a75df186.js +0 -2
  117. package/dist/esm-es5/index-a75df186.js.map +0 -1
  118. package/dist/esm-es5/language.service-023d2711.js +0 -2
  119. package/dist/esm-es5/language.service-023d2711.js.map +0 -1
  120. package/dist/swisspost-internet-header/p-0942595f.js +0 -2
  121. package/dist/swisspost-internet-header/p-0942595f.js.map +0 -1
  122. package/dist/swisspost-internet-header/p-3753a678.system.js +0 -2
  123. package/dist/swisspost-internet-header/p-3753a678.system.js.map +0 -1
  124. package/dist/swisspost-internet-header/p-69c64c29.js +0 -2
  125. package/dist/swisspost-internet-header/p-69c64c29.js.map +0 -1
  126. package/dist/swisspost-internet-header/p-715ebef7.system.entry.js +0 -7
  127. package/dist/swisspost-internet-header/p-715ebef7.system.entry.js.map +0 -1
  128. package/dist/swisspost-internet-header/p-7ea26ee9.entry.js +0 -2
  129. package/dist/swisspost-internet-header/p-7ea26ee9.entry.js.map +0 -1
  130. package/dist/swisspost-internet-header/p-b228fe49.system.entry.js +0 -2
  131. package/dist/swisspost-internet-header/p-b228fe49.system.entry.js.map +0 -1
  132. package/dist/swisspost-internet-header/p-c8296f63.system.js +0 -2
  133. package/dist/swisspost-internet-header/p-c8296f63.system.js.map +0 -1
  134. package/dist/swisspost-internet-header/p-ccb522ba.entry.js +0 -2
  135. package/dist/swisspost-internet-header/p-ccb522ba.entry.js.map +0 -1
  136. package/dist/swisspost-internet-header/p-cfa787d7.entry.js +0 -6
  137. package/dist/swisspost-internet-header/p-cfa787d7.entry.js.map +0 -1
  138. package/dist/swisspost-internet-header/p-f38f38f4.system.entry.js +0 -2
  139. package/dist/swisspost-internet-header/p-f38f38f4.system.entry.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{h as i,r as t,c as n,H as e,g as o}from"./p-5032057e.js";import{t as a}from"./p-69c64c29.js";import{c as s,d as l,e as r}from"./p-a119b38d.js";import{s as d}from"./p-06649b46.js";import{u as f}from"./p-45db66a6.js";import{S as m}from"./p-f7c0cf7b.js";import{S as h}from"./p-ab1dd269.js";const u=t=>{var n,e,o;const a=t.level.url?"a":"button";return i(a,{class:{"main-link":true,active:!!t.level.isActiveOverride,focus:t.isOpen},href:t.level.url,title:((n=t.level.title)===null||n===void 0?void 0:n.trim())&&((e=t.level.title)===null||e===void 0?void 0:e.trim())!==((o=t.level.text)===null||o===void 0?void 0:o.trim())?t.level.title:undefined,tabindex:t.level.url?undefined:0,"aria-haspopup":!t.level.noFlyout+"","aria-expanded":t.level.noFlyout?null:t.isOpen+"",onTouchEnd:i=>t.onTouchEnd(i),onKeyDown:i=>t.onKeyDown(i),onClick:i=>t.onClick(i)},i("span",null,t.level.text),i("svg",{"aria-hidden":"true"},i("use",{href:"#pi-pointy-arrow-right"})))};const c='.flyout-nav,.flyout-column h3{font-size:0.9375rem;line-height:1.4}@media (min-width: 600px){.flyout-nav,.flyout-column h3{font-size:1rem}}@media (min-width: 1024px){.flyout-nav,.flyout-column h3{font-size:1.0625rem}}.flyout-title{font-size:1.0625rem;line-height:1.4}@media (min-width: 600px){.flyout-title{font-size:1.25rem}}@media (min-width: 1024px){.flyout-title{font-size:1.5rem;line-height:1.1}}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:700;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:400;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:300;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff") format("woff")}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:"Frutiger Neue For Post", system-ui, sans-serif}button{font:inherit;padding:0}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active){svg{color:white}}.main-container,.flyout-linklist,.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}.btn-blank{background-color:transparent;border:none;border-radius:0;padding:0}.main-link,.flyout-close-button,.flyout-link,.nav-link{text-decoration:none;color:rgba(0, 0, 0, 0.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:transparent;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:0.5rem}.main-link:hover,.flyout-close-button:hover,.flyout-link:hover,.nav-link:hover,.main-link:focus,.flyout-close-button:focus,.flyout-link:focus,.nav-link:focus{color:black}.main-link>svg,.flyout-close-button>svg,.flyout-link>svg,.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.main-link>span,.flyout-close-button>span,.flyout-link>span,.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1440.98px){.hidden-xxl{display:none}}:host{--host-window-height:var(--window-height, 100vh);--calculated-header-height:calc(var(--header-height) + 1px);display:block;min-width:0;height:var(--header-height)}:host(.no-animation) *{-webkit-animation:none !important;animation:none !important;-webkit-transition:none !important;transition:none !important}@media (min-width: 1024px){.main-navigation,.main-container,.main-container li,.main-link{height:100%}}.main-navigation{font-size:1.125rem}@media (min-width: 1024px){.main-navigation{font-size:1rem}}@media (min-width: 1280px){.main-navigation{margin:0 0.75rem;font-size:1.125rem}}@media (min-width: 1441px){.main-navigation{font-size:1.25rem}}@media (max-width: 1023.98px){.main-navigation{position:absolute;top:var(--calculated-header-height);left:0;background:white;height:calc(var(--host-window-height) - var(--calculated-header-height));width:100%;margin:0;overflow:hidden scroll;-webkit-overflow-scrolling:touch;-ms-scroll-chaining:none;overscroll-behavior:contain;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;z-index:-1;visibility:hidden;-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transition:visibility 0.35s, -webkit-transform 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s;transition:transform 0.35s, visibility 0.35s;transition:transform 0.35s, visibility 0.35s, -webkit-transform 0.35s}}@media (max-width: 1023.98px) and (prefers-reduced-motion: reduce){.main-navigation{-webkit-transition:none;transition:none}}@media (max-width: 1023.98px){.main-navigation.open{-webkit-transform:translateY(0);transform:translateY(0);visibility:visible}}.main-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start}@media (max-width: 1023.98px){.main-container{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;padding-top:2.5rem;padding-bottom:2.5rem}.main-container>li+li{border-top:1px solid #e6e6e6}}@media (min-width: 1024px){.main-container{padding-right:0;padding-left:0}}.main-container>li{-ms-flex:0 1 auto;flex:0 1 auto;min-width:0}.main-link{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-right:0.75rem;padding-left:0.75rem;text-align:left;cursor:pointer;width:100%}@media (min-width: 1024px){.main-link svg{display:none}}@media (max-width: 1023.98px){.main-link{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;font-weight:300;padding:0.625rem 0;width:100%;text-align:left}.main-link svg{width:1.5rem;height:1.5rem}}.main-link span{overflow:hidden;text-overflow:ellipsis}.main-link,.flyout-link{position:relative;color:black}.main-link::after,.flyout-link::after{content:"";position:absolute;bottom:-1px;left:0;width:100%;height:4px;background-color:transparent;opacity:0;-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)}@media (prefers-reduced-motion: reduce){.main-link::after,.flyout-link::after{-webkit-transition:none;transition:none}}.main-link:hover::after,.main-link.focus::after,.flyout-link:hover::after,.flyout-link.focus::after{background-color:#cccccc;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.main-link.active,.flyout-link.active{font-weight:700}.main-link.active::after,.flyout-link.active::after{background-color:#fc0;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.flyout{left:0;width:100%;background:white;padding-bottom:3rem;overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain;visibility:hidden}@media (min-width: 1024px){.flyout{position:absolute;top:100%;max-height:calc(100vh - var(--header-height) - var(--meta-header-height) - 1px);z-index:-1;-webkit-box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(-100%);transform:translateY(-100%)}.flyout.open{-webkit-box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(0);transform:translateY(0)}}@media (max-width: 1023.98px){.flyout{position:fixed;top:0;height:100%;z-index:1;-webkit-transform:translateX(100%);transform:translateX(100%)}.flyout.open{-webkit-transform:translateX(0);transform:translateX(0)}}.flyout.open{visibility:visible}.flyout.animate{-webkit-transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s}@media (prefers-reduced-motion: reduce){.flyout.animate{-webkit-transition:none;transition:none}}.flyout-nav{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;min-height:3.5rem;-webkit-box-sizing:content-box;box-sizing:content-box}.flyout-row{display:-ms-flexbox;display:flex;gap:1.5rem}@media (max-width: 1023.98px){.flyout-row{display:grid;grid-template-columns:1fr 1fr}}@media (max-width: 599.98px){.flyout-row{grid-template-columns:1fr}}.flyout-column{-ms-flex:1;flex:1;max-width:25%}@media (max-width: 1023.98px){.flyout-column{max-width:none}}.flyout-column h3{margin-top:0}.flyout-back-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-size:1rem;font-weight:400;cursor:pointer}@media (max-width: 599.98px){.flyout-back-button{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.flyout-back-button{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.flyout-back-button{padding-right:40px;padding-left:40px}}.flyout-back-button svg{width:1.5rem;height:1.5rem}@media (min-width: 1024px){.flyout-back-button{display:none}}.flyout-close-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-left:auto;padding:0 1.5rem;cursor:pointer}.flyout-close-button svg{width:1.5rem;height:1.5rem}@media (max-width: 1023.98px){.flyout-close-button{display:none}}.flyout-linklist li{border-top:1px solid #e6e6e6}.flyout-linklist:first-child>li{border-top-color:transparent}.flyout-link{display:block;padding:0.75rem 0}.flyout-title{margin:2.5rem 0 1.5rem 0}@media (min-width: 1024px){.flyout-title{display:none}}';const p=class{constructor(i){t(this,i);this.dropdownToggled=n(this,"dropdownToggled",7);this.flyoutToggled=n(this,"flyoutToggled",7);this.resizeTimer=null;this.mouseLeaveTimer=null;this.mouseEnterTimer=null;this.activeFlyout=undefined;this.mobileMenuOpen=undefined}connectedCallback(){this.throttledResize=a(300,(()=>this.handleResize()));window.addEventListener("resize",this.throttledResize,{passive:true});this.setWindowHeight()}disconnectedCallback(){window.removeEventListener("resize",this.throttledResize);s();if(this.mouseEnterTimer!==null)window.clearTimeout(this.mouseEnterTimer);if(this.mouseLeaveTimer!==null)window.clearTimeout(this.mouseLeaveTimer)}handleResize(){this.host.classList.add("no-animation");if(this.resizeTimer!==null)window.clearTimeout(this.resizeTimer);this.resizeTimer=window.setTimeout((()=>{this.host.classList.remove("no-animation")}),300);this.setWindowHeight()}setWindowHeight(){if(!this.host){return}this.host.style.setProperty("--window-height",`${window.innerHeight}px`);window.setTimeout((()=>{this.host.style.setProperty("--window-height",`${window.innerHeight}px`)}),100)}openFlyout(i){var t;const n=(t=this.host.shadowRoot)===null||t===void 0?void 0:t.getElementById(i);if(n&&this.activeFlyout!==""){this.addFlyoutAnimation(n)}this.activeFlyout=i;this.flyoutToggled.emit(i);this.setWindowHeight();if(this.mouseLeaveTimer!==null){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}}closeFlyout(i){var t;if(i===undefined)return;const n=(t=this.host.shadowRoot)===null||t===void 0?void 0:t.getElementById(i);if(n){this.addFlyoutAnimation(n)}this.activeFlyout=null;this.flyoutToggled.emit()}addFlyoutAnimation(i){if(!f()){i.classList.add("animate");i.addEventListener("transitionend",(()=>this.removeFlyoutAnimation(i)),{once:true})}}removeFlyoutAnimation(i){i.classList.remove("animate")}isActiveFlyout(i){return i===this.activeFlyout}handleMouseEnter(i){if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer);this.mouseEnterTimer=null}if(this.mouseLeaveTimer&&this.activeFlyout===i.id){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}if(window.innerWidth>=1024&&i.flyout.length>0&&this.activeFlyout!==i.id){this.mouseEnterTimer=window.setTimeout((()=>{this.mouseEnterTimer=null;if(i.id!==undefined)this.openFlyout(i.id)}),200)}}handleMouseLeave(i){if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer)}if(this.activeFlyout&&this.activeFlyout!==i.id){return}if(window.innerWidth>=1024&&i.flyout.length>0){this.mouseLeaveTimer=window.setTimeout((()=>{this.closeFlyout(i.id)}),300)}}handleTouchEnd(i,t){if(!this.isActiveFlyout(t.id)&&!t.noFlyout){if(i.cancelable)i.preventDefault();if(t.id)this.openFlyout(t.id)}}handleKeyPress(i,t){if(i.key==="Enter"&&!this.isActiveFlyout(t.id)&&!t.noFlyout){i.preventDefault();if(t.id)this.openFlyout(t.id)}}handleClick(i,t){if(!this.isActiveFlyout(t.id)&&!t.noFlyout){i.preventDefault();if(t.id)this.openFlyout(t.id)}}setBodyScroll(){if(this.mobileMenuOpen){l(this.flyoutElement)}else{r(this.flyoutElement)}}async toggleDropdown(i){this.mobileMenuOpen=i===undefined?!this.mobileMenuOpen:i;this.dropdownToggled.emit({open:this.mobileMenuOpen,element:this.host});if(i===false){this.closeFlyout()}this.setBodyScroll();this.setWindowHeight();return this.mobileMenuOpen}async setFocus(){var i;const t=(i=this.host.shadowRoot)===null||i===void 0?void 0:i.querySelector(".main-link");if(t){t.focus()}}async setActiveFlyout(i){this.activeFlyout=i;this.flyoutToggled.emit(this.activeFlyout)}render(){var t;if(((t=d.localizedConfig)===null||t===void 0?void 0:t.header)===undefined)return;const n=d.localizedConfig.header;return i(e,null,i(m,null),i("nav",{id:"post-internet-header-main-navigation",class:{"main-navigation":true,open:this.mobileMenuOpen},ref:i=>this.flyoutElement=i},i("h2",{class:"visually-hidden"},n.translations.navMainAriaLabel),i("ul",{class:"main-container container"},n.navMain.map((t=>i("li",{key:t.text,onMouseLeave:()=>this.handleMouseLeave(t),onMouseEnter:()=>this.handleMouseEnter(t)},i(u,{level:t,isOpen:this.isActiveFlyout(t.id),onTouchEnd:i=>this.handleTouchEnd(i,t),onKeyDown:i=>this.handleKeyPress(i,t),onClick:i=>this.handleClick(i,t)}),!t.noFlyout?i("div",{id:t.id,class:{flyout:true,open:this.isActiveFlyout(t.id)}},i("div",{class:"wide-container"},i("div",{class:"flyout-nav"},i("button",{class:"nav-link flyout-back-button",onClick:()=>this.closeFlyout(t.id)},i(h,{name:"pi-pointy-arrow-right",classNames:"mirrored"}),i("span",null,n.translations.backButtonText)),i("button",{class:"flyout-close-button",onClick:()=>this.closeFlyout(t.id)},i("span",{class:"visually-hidden"},n.translations.mobileNavToggleClose),i(h,{name:"pi-close"}))),i("h2",{class:"flyout-title container"},i("a",{href:t.url,class:"nav-link"},t.text)),i("div",{class:"flyout-row container"},t.flyout.map((t=>i("div",{key:t.title,class:"flyout-column"},t.title?i("h3",null,t.title):null,i("ul",{class:"flyout-linklist"},t.linkList.map((t=>i("li",{key:t.url},i("a",{class:{"flyout-link":true,active:!!(t===null||t===void 0?void 0:t.isActiveOverride)},href:t.url,target:t.target},t.title))))))))))):null)))),i("slot",null)))}get host(){return o(this)}};p.style=c;export{p as post_main_navigation};
2
- //# sourceMappingURL=p-95b81c4d.entry.js.map
1
+ import{h as i,r as t,c as n,H as e,g as o}from"./p-5032057e.js";import{t as a}from"./p-a74b380d.js";import{c as s,d as l,e as r}from"./p-a119b38d.js";import{s as d}from"./p-06649b46.js";import{u as f}from"./p-45db66a6.js";import{S as m}from"./p-f7c0cf7b.js";import{S as h}from"./p-ab1dd269.js";const u=t=>{var n,e,o;const a=t.level.url?"a":"button";return i(a,{class:{"main-link":true,active:!!t.level.isActiveOverride,focus:t.isOpen},href:t.level.url,title:((n=t.level.title)===null||n===void 0?void 0:n.trim())&&((e=t.level.title)===null||e===void 0?void 0:e.trim())!==((o=t.level.text)===null||o===void 0?void 0:o.trim())?t.level.title:undefined,tabindex:t.level.url?undefined:0,"aria-haspopup":!t.level.noFlyout+"","aria-expanded":t.level.noFlyout?null:t.isOpen+"",onTouchEnd:i=>t.onTouchEnd(i),onKeyDown:i=>t.onKeyDown(i),onClick:i=>t.onClick(i)},i("span",null,t.level.text),i("svg",{"aria-hidden":"true"},i("use",{href:"#pi-pointy-arrow-right"})))};const c='.flyout-nav,.flyout-column h3{font-size:0.9375rem;line-height:1.4}@media (min-width: 600px){.flyout-nav,.flyout-column h3{font-size:1rem}}@media (min-width: 1024px){.flyout-nav,.flyout-column h3{font-size:1.0625rem}}.flyout-title{font-size:1.0625rem;line-height:1.4}@media (min-width: 600px){.flyout-title{font-size:1.25rem}}@media (min-width: 1024px){.flyout-title{font-size:1.5rem;line-height:1.1}}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:700;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:400;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:300;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff") format("woff")}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:"Frutiger Neue For Post", system-ui, sans-serif}button{font:inherit;padding:0}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active){svg{color:white}}.main-container,.flyout-linklist,.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}.btn-blank{background-color:transparent;border:none;border-radius:0;padding:0}.main-link,.flyout-close-button,.flyout-link,.nav-link{text-decoration:none;color:rgba(0, 0, 0, 0.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:transparent;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:0.5rem}.main-link:hover,.flyout-close-button:hover,.flyout-link:hover,.nav-link:hover,.main-link:focus,.flyout-close-button:focus,.flyout-link:focus,.nav-link:focus{color:black}.main-link>svg,.flyout-close-button>svg,.flyout-link>svg,.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.main-link>span,.flyout-close-button>span,.flyout-link>span,.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1440.98px){.hidden-xxl{display:none}}:host{--host-window-height:var(--window-height, 100vh);--calculated-header-height:calc(var(--header-height) + 1px);display:block;min-width:0;height:var(--header-height)}:host(.no-animation) *{-webkit-animation:none !important;animation:none !important;-webkit-transition:none !important;transition:none !important}@media (min-width: 1024px){.main-navigation,.main-container,.main-container li,.main-link{height:100%}}.main-navigation{font-size:1.125rem}@media (min-width: 1024px){.main-navigation{font-size:1rem;margin:0 0.75rem}}@media (min-width: 1280px){.main-navigation{font-size:1.125rem}}@media (min-width: 1441px){.main-navigation{font-size:1.25rem}}@media (max-width: 1023.98px){.main-navigation{position:absolute;top:var(--calculated-header-height);left:0;background:white;height:calc(var(--host-window-height) - var(--calculated-header-height));width:100%;margin:0;overflow:hidden scroll;-webkit-overflow-scrolling:touch;-ms-scroll-chaining:none;overscroll-behavior:contain;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;z-index:-1;visibility:hidden;-webkit-transform:translateY(-100%);transform:translateY(-100%);-webkit-transition:visibility 0.35s, -webkit-transform 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s;transition:transform 0.35s, visibility 0.35s;transition:transform 0.35s, visibility 0.35s, -webkit-transform 0.35s}}@media (max-width: 1023.98px) and (prefers-reduced-motion: reduce){.main-navigation{-webkit-transition:none;transition:none}}@media (max-width: 1023.98px){.main-navigation.open{-webkit-transform:translateY(0);transform:translateY(0);visibility:visible}}.main-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start}@media (max-width: 1023.98px){.main-container{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;padding-top:2.5rem;padding-bottom:2.5rem}.main-container>li+li{border-top:1px solid #e6e6e6}}@media (min-width: 1024px){.main-container{padding-right:0;padding-left:0}}.main-container>li{-ms-flex:0 1 auto;flex:0 1 auto;min-width:0}.main-link{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding-right:0.75rem;padding-left:0.75rem;text-align:left;cursor:pointer;width:100%}@media (min-width: 1024px){.main-link svg{display:none}}@media (max-width: 1023.98px){.main-link{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;font-weight:300;padding:0.625rem 0;width:100%;text-align:left}.main-link svg{width:1.5rem;height:1.5rem}}.main-link span{overflow:hidden;text-overflow:ellipsis}.main-link,.flyout-link{position:relative;color:black}.main-link::after,.flyout-link::after{content:"";position:absolute;bottom:-1px;left:0;width:100%;height:4px;background-color:transparent;opacity:0;-webkit-transform:scaleX(0.8);transform:scaleX(0.8);-webkit-transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)}@media (prefers-reduced-motion: reduce){.main-link::after,.flyout-link::after{-webkit-transition:none;transition:none}}.main-link:hover::after,.main-link.focus::after,.flyout-link:hover::after,.flyout-link.focus::after{background-color:#cccccc;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.main-link.active,.flyout-link.active{font-weight:700}.main-link.active::after,.flyout-link.active::after{background-color:#fc0;opacity:1;-webkit-transform:scale(1);transform:scale(1)}.flyout{left:0;width:100%;background:white;padding-bottom:3rem;overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain;visibility:hidden}@media (min-width: 1024px){.flyout{position:absolute;top:100%;max-height:calc(100vh - var(--header-height) - var(--meta-header-height) - 1px);z-index:-1;-webkit-box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 1px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(-100%);transform:translateY(-100%)}.flyout.open{-webkit-box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.4);-webkit-transform:translateY(0);transform:translateY(0)}}@media (max-width: 1023.98px){.flyout{position:fixed;top:0;height:100%;z-index:1;-webkit-transform:translateX(100%);transform:translateX(100%)}.flyout.open{-webkit-transform:translateX(0);transform:translateX(0)}}.flyout.open{visibility:visible}.flyout.animate{-webkit-transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:visibility 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s;transition:transform 0.35s, visibility 0.35s, box-shadow 0.35s, -webkit-transform 0.35s, -webkit-box-shadow 0.35s}@media (prefers-reduced-motion: reduce){.flyout.animate{-webkit-transition:none;transition:none}}.flyout-nav{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;min-height:3.5rem;-webkit-box-sizing:content-box;box-sizing:content-box}.flyout-row{display:-ms-flexbox;display:flex;gap:1.5rem}@media (max-width: 1023.98px){.flyout-row{display:grid;grid-template-columns:1fr 1fr}}@media (max-width: 599.98px){.flyout-row{grid-template-columns:1fr}}.flyout-column{-ms-flex:1;flex:1;max-width:25%}@media (max-width: 1023.98px){.flyout-column{max-width:none}}.flyout-column h3{margin-top:0}.flyout-back-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-size:1rem;font-weight:400;cursor:pointer}@media (max-width: 599.98px){.flyout-back-button{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.flyout-back-button{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.flyout-back-button{padding-right:40px;padding-left:40px}}.flyout-back-button svg{width:1.5rem;height:1.5rem}@media (min-width: 1024px){.flyout-back-button{display:none}}.flyout-close-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-left:auto;padding:0 1.5rem;cursor:pointer}.flyout-close-button svg{width:1.5rem;height:1.5rem}@media (max-width: 1023.98px){.flyout-close-button{display:none}}.flyout-linklist li{border-top:1px solid #e6e6e6}.flyout-linklist:first-child>li{border-top-color:transparent}.flyout-link{display:block;padding:0.75rem 0}.flyout-title{margin:2.5rem 0 1.5rem 0}@media (min-width: 1024px){.flyout-title{display:none}}';const p=class{constructor(i){t(this,i);this.dropdownToggled=n(this,"dropdownToggled",7);this.flyoutToggled=n(this,"flyoutToggled",7);this.resizeTimer=null;this.mouseLeaveTimer=null;this.mouseEnterTimer=null;this.activeFlyout=undefined;this.mobileMenuOpen=undefined}connectedCallback(){this.throttledResize=a(300,(()=>this.handleResize()));window.addEventListener("resize",this.throttledResize,{passive:true});this.setWindowHeight()}disconnectedCallback(){window.removeEventListener("resize",this.throttledResize);s();if(this.mouseEnterTimer!==null)window.clearTimeout(this.mouseEnterTimer);if(this.mouseLeaveTimer!==null)window.clearTimeout(this.mouseLeaveTimer)}handleResize(){this.host.classList.add("no-animation");if(this.resizeTimer!==null)window.clearTimeout(this.resizeTimer);this.resizeTimer=window.setTimeout((()=>{this.host.classList.remove("no-animation")}),300);this.setWindowHeight()}setWindowHeight(){if(!this.host){return}this.host.style.setProperty("--window-height",`${window.innerHeight}px`);window.setTimeout((()=>{this.host.style.setProperty("--window-height",`${window.innerHeight}px`)}),100)}openFlyout(i){var t;const n=(t=this.host.shadowRoot)===null||t===void 0?void 0:t.getElementById(i);if(n&&this.activeFlyout!==""){this.addFlyoutAnimation(n)}this.activeFlyout=i;this.flyoutToggled.emit(i);this.setWindowHeight();if(this.mouseLeaveTimer!==null){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}}closeFlyout(i){var t;if(i===undefined)return;const n=(t=this.host.shadowRoot)===null||t===void 0?void 0:t.getElementById(i);if(n){this.addFlyoutAnimation(n)}this.activeFlyout=null;this.flyoutToggled.emit()}addFlyoutAnimation(i){if(!f()){i.classList.add("animate");i.addEventListener("transitionend",(()=>this.removeFlyoutAnimation(i)),{once:true})}}removeFlyoutAnimation(i){i.classList.remove("animate")}isActiveFlyout(i){return i===this.activeFlyout}handleMouseEnter(i){if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer);this.mouseEnterTimer=null}if(this.mouseLeaveTimer&&this.activeFlyout===i.id){window.clearTimeout(this.mouseLeaveTimer);this.mouseLeaveTimer=null}if(window.innerWidth>=1024&&i.flyout.length>0&&this.activeFlyout!==i.id){this.mouseEnterTimer=window.setTimeout((()=>{this.mouseEnterTimer=null;if(i.id!==undefined)this.openFlyout(i.id)}),200)}}handleMouseLeave(i){if(this.mouseEnterTimer!==null){window.clearTimeout(this.mouseEnterTimer)}if(this.activeFlyout&&this.activeFlyout!==i.id){return}if(window.innerWidth>=1024&&i.flyout.length>0){this.mouseLeaveTimer=window.setTimeout((()=>{this.closeFlyout(i.id)}),300)}}handleTouchEnd(i,t){if(!this.isActiveFlyout(t.id)&&!t.noFlyout){if(i.cancelable)i.preventDefault();if(t.id)this.openFlyout(t.id)}}handleKeyPress(i,t){if(i.key==="Enter"&&!this.isActiveFlyout(t.id)&&!t.noFlyout){i.preventDefault();if(t.id)this.openFlyout(t.id)}}handleClick(i,t){if(!this.isActiveFlyout(t.id)&&!t.noFlyout){i.preventDefault();if(t.id)this.openFlyout(t.id)}}setBodyScroll(){if(this.mobileMenuOpen){l(this.flyoutElement)}else{r(this.flyoutElement)}}async toggleDropdown(i){this.mobileMenuOpen=i===undefined?!this.mobileMenuOpen:i;this.dropdownToggled.emit({open:this.mobileMenuOpen,element:this.host});if(i===false){this.closeFlyout()}this.setBodyScroll();this.setWindowHeight();return this.mobileMenuOpen}async setFocus(){var i;const t=(i=this.host.shadowRoot)===null||i===void 0?void 0:i.querySelector(".main-link");if(t){t.focus()}}async setActiveFlyout(i){this.activeFlyout=i;this.flyoutToggled.emit(this.activeFlyout)}render(){var t;if(((t=d.localizedConfig)===null||t===void 0?void 0:t.header)===undefined)return;const n=d.localizedConfig.header;return i(e,null,i(m,null),i("nav",{id:"post-internet-header-main-navigation",class:{"main-navigation":true,open:this.mobileMenuOpen},ref:i=>this.flyoutElement=i},i("h2",{class:"visually-hidden"},n.translations.navMainAriaLabel),i("ul",{class:"main-container container"},n.navMain.map((t=>i("li",{key:t.text,onMouseLeave:()=>this.handleMouseLeave(t),onMouseEnter:()=>this.handleMouseEnter(t)},i(u,{level:t,isOpen:this.isActiveFlyout(t.id),onTouchEnd:i=>this.handleTouchEnd(i,t),onKeyDown:i=>this.handleKeyPress(i,t),onClick:i=>this.handleClick(i,t)}),!t.noFlyout?i("div",{id:t.id,class:{flyout:true,open:this.isActiveFlyout(t.id)}},i("div",{class:"wide-container"},i("div",{class:"flyout-nav"},i("button",{class:"nav-link flyout-back-button",onClick:()=>this.closeFlyout(t.id)},i(h,{name:"pi-pointy-arrow-right",classNames:"mirrored"}),i("span",null,n.translations.backButtonText)),i("button",{class:"flyout-close-button",onClick:()=>this.closeFlyout(t.id)},i("span",{class:"visually-hidden"},n.translations.mobileNavToggleClose),i(h,{name:"pi-close"}))),i("h2",{class:"flyout-title container"},i("a",{href:t.url,class:"nav-link"},t.text)),i("div",{class:"flyout-row container"},t.flyout.map((t=>i("div",{key:t.title,class:"flyout-column"},t.title?i("h3",null,t.title):null,i("ul",{class:"flyout-linklist"},t.linkList.map((t=>i("li",{key:t.url},i("a",{class:{"flyout-link":true,active:!!(t===null||t===void 0?void 0:t.isActiveOverride)},href:t.url,target:t.target},t.title))))))))))):null)))),i("slot",null)))}get host(){return o(this)}};p.style=c;export{p as post_main_navigation};
2
+ //# sourceMappingURL=p-2fd9a085.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LevelOneAction","props","TagName","level","url","h","class","active","isActiveOverride","focus","isOpen","href","title","_a","trim","_b","_c","text","undefined","tabindex","noFlyout","onTouchEnd","e","onKeyDown","onClick","postMainNavigationCss","PostMainNavigation","this","resizeTimer","mouseLeaveTimer","mouseEnterTimer","connectedCallback","throttledResize","throttle","handleResize","window","addEventListener","passive","setWindowHeight","disconnectedCallback","removeEventListener","clearAllBodyScrollLocks","clearTimeout","host","classList","add","setTimeout","remove","style","setProperty","innerHeight","openFlyout","id","flyout","shadowRoot","getElementById","activeFlyout","addFlyoutAnimation","flyoutToggled","emit","closeFlyout","userPrefersReducedMotion","removeFlyoutAnimation","once","isActiveFlyout","handleMouseEnter","innerWidth","length","handleMouseLeave","handleTouchEnd","event","cancelable","preventDefault","handleKeyPress","key","handleClick","setBodyScroll","mobileMenuOpen","disableBodyScroll","flyoutElement","enableBodyScroll","async","force","dropdownToggled","open","element","firstLink","querySelector","render","state","localizedConfig","header","headerConfig","Host","SvgSprite","ref","el","translations","navMainAriaLabel","navMain","map","levelOne","onMouseLeave","onMouseEnter","SvgIcon","name","classNames","backButtonText","mobileNavToggleClose","linkList","link","target"],"sources":["./src/components/post-main-navigation/components/level-one-action.component.tsx","./src/components/post-main-navigation/post-main-navigation.scss?tag=post-main-navigation&encapsulation=shadow","./src/components/post-main-navigation/post-main-navigation.tsx"],"sourcesContent":["import { h } from '@stencil/core';\nimport { NavMainEntity } from '../../../models/header.model';\n\nexport const LevelOneAction = (props: {\n level: NavMainEntity;\n isOpen: boolean;\n onTouchEnd: (e: any) => void;\n onKeyDown: (e: any) => void;\n onClick: (e: any) => void;\n}) => {\n const TagName = props.level.url ? 'a' : 'button';\n\n return (\n <TagName\n class={{\n 'main-link': true,\n 'active': !!props.level.isActiveOverride,\n 'focus': props.isOpen,\n }}\n href={props.level.url}\n title={\n props.level.title?.trim() && props.level.title?.trim() !== props.level.text?.trim()\n ? props.level.title\n : undefined\n }\n tabindex={props.level.url ? undefined : 0}\n aria-haspopup={!props.level.noFlyout + ''}\n aria-expanded={props.level.noFlyout ? null : props.isOpen + ''}\n onTouchEnd={e => props.onTouchEnd(e)}\n onKeyDown={e => props.onKeyDown(e)}\n onClick={e => props.onClick(e)}\n >\n <span>{props.level.text}</span>\n <svg aria-hidden=\"true\">\n <use href=\"#pi-pointy-arrow-right\" />\n </svg>\n </TagName>\n );\n};\n","@use '@swisspost/design-system-styles/variables/color';\n@use '@swisspost/design-system-styles/placeholders/text';\n@use '@swisspost/design-system-styles/functions';\n@use '../../utils/utils.scss';\n@use '../../utils/mixins.scss';\n\n:host {\n --host-window-height: var(--window-height, 100vh);\n --calculated-header-height: calc(var(--header-height) + 1px);\n\n display: block;\n min-width: 0;\n height: var(--header-height);\n}\n\n:host(.no-animation) {\n * {\n animation: none !important;\n transition: none !important;\n }\n}\n\n.main-navigation,\n.main-container,\n.main-container li,\n.main-link {\n @include mixins.min(lg) {\n height: 100%;\n }\n}\n\n.main-navigation {\n font-size: functions.px-to-rem(18px);\n\n @include mixins.min(lg) {\n font-size: functions.px-to-rem(16px);\n }\n\n @include mixins.min(xl) {\n margin: 0 0.75rem;\n font-size: functions.px-to-rem(18px);\n }\n\n @include mixins.min(xxl) {\n font-size: functions.px-to-rem(20px);\n }\n\n @include mixins.max(lg) {\n position: absolute;\n top: var(--calculated-header-height);\n left: 0;\n background: white;\n height: calc(var(--host-window-height) - var(--calculated-header-height));\n width: 100%;\n margin: 0;\n overflow: hidden scroll;\n -webkit-overflow-scrolling: touch;\n overscroll-behavior: contain;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n z-index: -1;\n visibility: hidden;\n transform: translateY(-100%);\n transition: transform 0.35s, visibility 0.35s;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n\n &.open {\n transform: translateY(0);\n visibility: visible;\n }\n }\n}\n\n.main-container {\n @extend %no-list;\n\n display: flex;\n align-items: center;\n justify-content: flex-start;\n\n @include mixins.max(lg) {\n flex-direction: column;\n align-items: stretch;\n justify-content: flex-start;\n padding-top: 2.5rem;\n padding-bottom: 2.5rem;\n\n > li + li {\n border-top: 1px solid color.$gray-10;\n }\n }\n\n @include mixins.min(lg) {\n padding-right: 0;\n padding-left: 0;\n }\n\n > li {\n flex: 0 1 auto;\n min-width: 0;\n }\n}\n\n.main-link {\n @extend %nav-link;\n\n display: flex;\n align-items: center;\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n text-align: left;\n cursor: pointer;\n width: 100%;\n\n @include mixins.min(lg) {\n svg {\n display: none;\n }\n }\n\n @include mixins.max(lg) {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-weight: 300;\n padding: 0.625rem 0;\n width: 100%;\n text-align: left;\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n }\n\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n}\n\n.main-link,\n.flyout-link {\n position: relative;\n color: black;\n\n &::after {\n content: '';\n position: absolute;\n bottom: -1px;\n left: 0;\n width: 100%;\n height: 4px;\n background-color: transparent;\n opacity: 0;\n transform: scaleX(0.8);\n transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),\n transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n\n &:hover,\n &.focus {\n &::after {\n background-color: color.$gray-20;\n opacity: 1;\n transform: scale(1);\n }\n }\n\n &.active {\n font-weight: 700;\n\n &::after {\n background-color: color.$yellow;\n opacity: 1;\n transform: scale(1);\n }\n }\n}\n\n.flyout {\n left: 0;\n width: 100%;\n background: white;\n padding-bottom: 3rem;\n overflow: auto;\n overscroll-behavior: contain;\n visibility: hidden;\n\n @include mixins.min(lg) {\n position: absolute;\n top: 100%;\n max-height: calc(100vh - var(--header-height) - var(--meta-header-height) - 1px);\n z-index: -1;\n box-shadow: 0 0 1px 0 rgb(0 0 0 / 40%);\n transform: translateY(-100%);\n\n &.open {\n box-shadow: 0 0 8px 0 rgb(0 0 0 / 40%);\n transform: translateY(0);\n }\n }\n\n @include mixins.max(lg) {\n position: fixed;\n top: 0;\n height: 100%;\n z-index: 1;\n transform: translateX(100%);\n\n &.open {\n transform: translateX(0);\n }\n }\n\n &.open {\n visibility: visible;\n }\n\n &.animate {\n transition: transform 0.35s, visibility 0.35s, box-shadow 0.35s;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n}\n\n.flyout-nav {\n @extend %font-curve-small;\n\n display: flex;\n justify-content: space-between;\n min-height: 3.5rem;\n\n // Change box-sizing to content-box to add 1px border width to flyout-nav hight.\n // This ensures flyout-nav has same hight as main-navigation-container.\n box-sizing: content-box;\n}\n\n.flyout-row {\n display: flex;\n gap: 1.5rem;\n\n @include mixins.max(lg) {\n display: grid;\n grid-template-columns: 1fr 1fr;\n }\n\n @include mixins.max(rg) {\n grid-template-columns: 1fr;\n }\n}\n\n.flyout-column {\n flex: 1;\n max-width: 25%;\n\n @include mixins.max(lg) {\n max-width: none;\n }\n\n h3 {\n @extend %font-curve-small;\n margin-top: 0;\n }\n}\n\n.flyout-back-button {\n @include mixins.container-padding();\n\n display: flex;\n align-items: center;\n font-size: functions.px-to-rem(16px);\n font-weight: 400;\n cursor: pointer;\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n\n @include mixins.min(lg) {\n display: none;\n }\n}\n\n.flyout-close-button {\n @extend %nav-link;\n\n display: flex;\n align-items: center;\n margin-left: auto;\n padding: 0 1.5rem;\n cursor: pointer;\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n\n @include mixins.max(lg) {\n display: none;\n }\n}\n\n.flyout-linklist {\n @extend %no-list;\n\n li {\n border-top: 1px solid color.$gray-10;\n }\n\n &:first-child > li {\n border-top-color: transparent;\n }\n}\n\n.flyout-link {\n @extend %nav-link;\n\n display: block;\n padding: 0.75rem 0;\n}\n\n.flyout-title {\n @extend %font-curve-bigger-regular;\n\n margin: 2.5rem 0 1.5rem 0;\n\n @include mixins.min(lg) {\n display: none;\n }\n}\n","import { Component, Host, h, State, Method, Event, Element, EventEmitter } from '@stencil/core';\nimport { throttle } from 'throttle-debounce';\nimport { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';\nimport { state } from '../../data/store';\nimport {\n DropdownElement,\n DropdownEvent,\n HasDropdown,\n IsFocusable,\n NavMainEntity,\n} from '../../models/header.model';\nimport { userPrefersReducedMotion } from '../../services/ui.service';\nimport { SvgSprite } from '../../utils/svg-sprite.component';\nimport { SvgIcon } from '../../utils/svg-icon.component';\nimport { LevelOneAction } from './components/level-one-action.component';\n\n@Component({\n tag: 'post-main-navigation',\n styleUrl: 'post-main-navigation.scss',\n shadow: true,\n})\nexport class PostMainNavigation implements HasDropdown, IsFocusable {\n @State() activeFlyout: string | null;\n @State() mobileMenuOpen: boolean;\n @Event() dropdownToggled: EventEmitter<DropdownEvent>;\n @Event() flyoutToggled: EventEmitter<string | null>;\n @Element() host: DropdownElement;\n private throttledResize: throttle<() => void>;\n private resizeTimer: number | null = null;\n private mouseLeaveTimer: number | null = null;\n private mouseEnterTimer: number | null = null;\n private flyoutElement: HTMLElement | undefined;\n\n connectedCallback() {\n this.throttledResize = throttle(300, () => this.handleResize());\n window.addEventListener('resize', this.throttledResize, { passive: true });\n this.setWindowHeight();\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.throttledResize);\n clearAllBodyScrollLocks();\n if (this.mouseEnterTimer !== null) window.clearTimeout(this.mouseEnterTimer);\n if (this.mouseLeaveTimer !== null) window.clearTimeout(this.mouseLeaveTimer);\n }\n\n handleResize() {\n // Suspend all animations and transitions on window resize\n this.host.classList.add('no-animation');\n if (this.resizeTimer !== null) window.clearTimeout(this.resizeTimer);\n this.resizeTimer = window.setTimeout(() => {\n this.host.classList.remove('no-animation');\n }, 300);\n\n this.setWindowHeight();\n }\n\n // Update window height var\n setWindowHeight() {\n if (!this.host) {\n return;\n }\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n\n // Safari might or might not show a blank bar at the bottom where the browser\n // controls should be. This timeout waits for this bar to appear before resetting the available height\n window.setTimeout(() => {\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n }, 100);\n }\n\n openFlyout(id: string) {\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout && this.activeFlyout !== '') {\n // Add flyout animation if there's no flyout open\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = id;\n this.flyoutToggled.emit(id);\n this.setWindowHeight();\n\n if (this.mouseLeaveTimer !== null) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n }\n\n closeFlyout(id?: string) {\n if (id === undefined) return;\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout) {\n // Add flyout animation for close action\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = null;\n this.flyoutToggled.emit();\n }\n\n addFlyoutAnimation(flyout: HTMLElement) {\n // Check if user prefers to see animations or not\n if (!userPrefersReducedMotion()) {\n flyout.classList.add('animate');\n\n // Remove flyout animation after transition ended\n flyout.addEventListener('transitionend', () => this.removeFlyoutAnimation(flyout), {\n once: true,\n });\n }\n }\n\n removeFlyoutAnimation(flyout: HTMLElement) {\n flyout.classList.remove('animate');\n }\n\n isActiveFlyout(id?: string) {\n return id === this.activeFlyout;\n }\n\n handleMouseEnter(level: NavMainEntity) {\n // Cancel opening the flyout if there already is one scheduled to open\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n this.mouseEnterTimer = null;\n }\n\n // Cancel closing if we enter again\n if (this.mouseLeaveTimer && this.activeFlyout === level.id) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0 && this.activeFlyout !== level.id) {\n // Delay opening the flyout for a moment to give users a chance to move the mouse over the navigation without triggering the flyout\n this.mouseEnterTimer = window.setTimeout(() => {\n this.mouseEnterTimer = null;\n if (level.id !== undefined) this.openFlyout(level.id);\n }, 200);\n }\n }\n\n handleMouseLeave(level: NavMainEntity) {\n // Cancel opening the flyout if a mouseleave event happens before the flyout opened\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n }\n\n // Don't close an open flyout if the mouseleave is from another mainnav entry\n if (this.activeFlyout && this.activeFlyout !== level.id) {\n return;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0) {\n // Allow the pointer to shortly leave the flyout without closing it. This\n // allows for user mistakes and makes the experience less nervous\n this.mouseLeaveTimer = window.setTimeout(() => {\n this.closeFlyout(level.id);\n }, 300);\n }\n }\n\n handleTouchEnd(event: TouchEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first touchstart and has a flyout, prevent link activation and open the flyout\n if (event.cancelable) event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleKeyPress(event: KeyboardEvent, level: NavMainEntity) {\n if (event.key === 'Enter' && !this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first enter keypress and has a flyout, prevent link activation and open the flyout\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleClick(event: MouseEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first click, always open the flyout, never the link\n // This is relevant for desktop with active screenreader which\n // translates an enter keypress to a click\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n /**\n * Disable or re-enable body scrolling, depending on whether mobile menu is open or closed\n */\n setBodyScroll() {\n if (this.mobileMenuOpen) {\n disableBodyScroll(this.flyoutElement);\n } else {\n enableBodyScroll(this.flyoutElement);\n }\n }\n\n /**\n * Toggle the main navigation (only visible on mobile)\n * @param force Force a state\n * @returns Boolean indicating new state\n */\n @Method()\n async toggleDropdown(force?: boolean) {\n this.mobileMenuOpen = force === undefined ? !this.mobileMenuOpen : force;\n this.dropdownToggled.emit({ open: this.mobileMenuOpen, element: this.host });\n\n if (force === false) {\n this.closeFlyout();\n }\n\n this.setBodyScroll();\n this.setWindowHeight();\n\n return this.mobileMenuOpen;\n }\n\n /**\n * Focus the main navigation toggle button\n */\n @Method()\n async setFocus() {\n const firstLink = this.host.shadowRoot?.querySelector<HTMLElement>('.main-link');\n if (firstLink) {\n firstLink.focus();\n }\n }\n\n /**\n * Open a specific flyout\n * @param id Flyout ID\n */\n @Method()\n async setActiveFlyout(id: string | null) {\n this.activeFlyout = id;\n this.flyoutToggled.emit(this.activeFlyout);\n }\n\n render() {\n if (state.localizedConfig?.header === undefined) return;\n const headerConfig = state.localizedConfig.header;\n\n return (\n <Host>\n <SvgSprite />\n <nav\n id=\"post-internet-header-main-navigation\"\n class={{ 'main-navigation': true, 'open': this.mobileMenuOpen }}\n ref={el => (this.flyoutElement = el)}\n >\n <h2 class=\"visually-hidden\">{headerConfig.translations.navMainAriaLabel}</h2>\n <ul class=\"main-container container\">\n {headerConfig.navMain.map(levelOne => (\n <li\n key={levelOne.text}\n onMouseLeave={() => this.handleMouseLeave(levelOne)}\n onMouseEnter={() => this.handleMouseEnter(levelOne)}\n >\n <LevelOneAction\n level={levelOne}\n isOpen={this.isActiveFlyout(levelOne.id)}\n onTouchEnd={e => this.handleTouchEnd(e, levelOne)}\n onKeyDown={e => this.handleKeyPress(e, levelOne)}\n onClick={e => this.handleClick(e, levelOne)}\n />\n {!levelOne.noFlyout ? (\n <div\n id={levelOne.id}\n class={{ flyout: true, open: this.isActiveFlyout(levelOne.id) }}\n >\n <div class=\"wide-container\">\n <div class=\"flyout-nav\">\n <button\n class=\"nav-link flyout-back-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <SvgIcon name=\"pi-pointy-arrow-right\" classNames=\"mirrored\" />\n <span>{headerConfig.translations.backButtonText}</span>\n </button>\n <button\n class=\"flyout-close-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <span class=\"visually-hidden\">\n {headerConfig.translations.mobileNavToggleClose}\n </span>\n <SvgIcon name=\"pi-close\" />\n </button>\n </div>\n <h2 class=\"flyout-title container\">\n <a href={levelOne.url} class=\"nav-link\">\n {levelOne.text}\n </a>\n </h2>\n <div class=\"flyout-row container\">\n {levelOne.flyout.map(flyout => (\n <div key={flyout.title} class=\"flyout-column\">\n {flyout.title ? <h3>{flyout.title}</h3> : null}\n <ul class=\"flyout-linklist\">\n {flyout.linkList.map(link => (\n <li key={link.url}>\n <a\n class={{\n 'flyout-link': true,\n 'active': !!link?.isActiveOverride,\n }}\n href={link.url}\n target={link.target}\n >\n {link.title}\n </a>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n </div>\n ) : null}\n </li>\n ))}\n </ul>\n <slot></slot>\n </nav>\n </Host>\n );\n }\n}\n"],"mappings":"sSAGO,MAAMA,EAAkBC,I,UAO7B,MAAMC,EAAUD,EAAME,MAAMC,IAAM,IAAM,SAExC,OACEC,EAACH,EAAO,CACNI,MAAO,CACL,YAAa,KACbC,SAAYN,EAAME,MAAMK,iBACxBC,MAASR,EAAMS,QAEjBC,KAAMV,EAAME,MAAMC,IAClBQ,QACEC,EAAAZ,EAAME,MAAMS,SAAK,MAAAC,SAAA,SAAAA,EAAEC,WAAUC,EAAAd,EAAME,MAAMS,SAAK,MAAAG,SAAA,SAAAA,EAAED,YAAWE,EAAAf,EAAME,MAAMc,QAAI,MAAAD,SAAA,SAAAA,EAAEF,QACzEb,EAAME,MAAMS,MACZM,UAENC,SAAUlB,EAAME,MAAMC,IAAMc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AAwBC,WAAW,aACjDrG,EAAA,YAAOuF,EAAaK,aAAaU,iBAEnCtG,EAAA,UACEC,MAAM,sBACNkB,QAAS,IAAMG,KAAKiC,YAAYyC,EAASjD,KAEzC/C,EAAA,QAAMC,MAAM,mBACTsF,EAAaK,aAAaW,sBAE7BvG,EAACmG,EAAO,CAACC,KAAK,eAGlBpG,EAAA,MAAIC,MAAM,0BACRD,EAAA,KAAGM,KAAM0F,EAASjG,IAAKE,MAAM,YAC1B+F,EAASpF,OAGdZ,EAAA,OAAKC,MAAM,wBACR+F,EAAShD,OAAO+C,KAAI/C,GACnBhD,EAAA,OAAKqE,IAAKrB,EAAOzC,MAAON,MAAM,iBAC3B+C,EAAOzC,MAAQP,EAAA,UAAKgD,EAAOzC,OAAc,KAC1CP,EAAA,MAAIC,MAAM,mBACP+C,EAAOwD,SAAST,KAAIU,GACnBzG,EAAA,MAAIqE,IAAKoC,EAAK1G,KACZC,EAAA,KACEC,MAAO,CACL,cAAe,KACfC,UAAYuG,IAAI,MAAJA,SAAI,SAAJA,EAAMtG,mBAEpBG,KAAMmG,EAAK1G,IACX2G,OAAQD,EAAKC,QAEZD,EAAKlG,iBAUtB,SAIVP,EAAA,c"}
1
+ {"version":3,"names":["LevelOneAction","props","TagName","level","url","h","class","active","isActiveOverride","focus","isOpen","href","title","_a","trim","_b","_c","text","undefined","tabindex","noFlyout","onTouchEnd","e","onKeyDown","onClick","postMainNavigationCss","PostMainNavigation","this","resizeTimer","mouseLeaveTimer","mouseEnterTimer","connectedCallback","throttledResize","throttle","handleResize","window","addEventListener","passive","setWindowHeight","disconnectedCallback","removeEventListener","clearAllBodyScrollLocks","clearTimeout","host","classList","add","setTimeout","remove","style","setProperty","innerHeight","openFlyout","id","flyout","shadowRoot","getElementById","activeFlyout","addFlyoutAnimation","flyoutToggled","emit","closeFlyout","userPrefersReducedMotion","removeFlyoutAnimation","once","isActiveFlyout","handleMouseEnter","innerWidth","length","handleMouseLeave","handleTouchEnd","event","cancelable","preventDefault","handleKeyPress","key","handleClick","setBodyScroll","mobileMenuOpen","disableBodyScroll","flyoutElement","enableBodyScroll","async","force","dropdownToggled","open","element","firstLink","querySelector","render","state","localizedConfig","header","headerConfig","Host","SvgSprite","ref","el","translations","navMainAriaLabel","navMain","map","levelOne","onMouseLeave","onMouseEnter","SvgIcon","name","classNames","backButtonText","mobileNavToggleClose","linkList","link","target"],"sources":["./src/components/post-main-navigation/components/level-one-action.component.tsx","./src/components/post-main-navigation/post-main-navigation.scss?tag=post-main-navigation&encapsulation=shadow","./src/components/post-main-navigation/post-main-navigation.tsx"],"sourcesContent":["import { h } from '@stencil/core';\nimport { NavMainEntity } from '../../../models/header.model';\n\nexport const LevelOneAction = (props: {\n level: NavMainEntity;\n isOpen: boolean;\n onTouchEnd: (e: any) => void;\n onKeyDown: (e: any) => void;\n onClick: (e: any) => void;\n}) => {\n const TagName = props.level.url ? 'a' : 'button';\n\n return (\n <TagName\n class={{\n 'main-link': true,\n 'active': !!props.level.isActiveOverride,\n 'focus': props.isOpen,\n }}\n href={props.level.url}\n title={\n props.level.title?.trim() && props.level.title?.trim() !== props.level.text?.trim()\n ? props.level.title\n : undefined\n }\n tabindex={props.level.url ? undefined : 0}\n aria-haspopup={!props.level.noFlyout + ''}\n aria-expanded={props.level.noFlyout ? null : props.isOpen + ''}\n onTouchEnd={e => props.onTouchEnd(e)}\n onKeyDown={e => props.onKeyDown(e)}\n onClick={e => props.onClick(e)}\n >\n <span>{props.level.text}</span>\n <svg aria-hidden=\"true\">\n <use href=\"#pi-pointy-arrow-right\" />\n </svg>\n </TagName>\n );\n};\n","@use '@swisspost/design-system-styles/variables/color';\n@use '@swisspost/design-system-styles/placeholders/text';\n@use '@swisspost/design-system-styles/functions';\n@use '../../utils/utils.scss';\n@use '../../utils/mixins.scss';\n\n:host {\n --host-window-height: var(--window-height, 100vh);\n --calculated-header-height: calc(var(--header-height) + 1px);\n\n display: block;\n min-width: 0;\n height: var(--header-height);\n}\n\n:host(.no-animation) {\n * {\n animation: none !important;\n transition: none !important;\n }\n}\n\n.main-navigation,\n.main-container,\n.main-container li,\n.main-link {\n @include mixins.min(lg) {\n height: 100%;\n }\n}\n\n.main-navigation {\n font-size: functions.px-to-rem(18px);\n\n @include mixins.min(lg) {\n font-size: functions.px-to-rem(16px);\n margin: 0 0.75rem;\n }\n\n @include mixins.min(xl) {\n font-size: functions.px-to-rem(18px);\n }\n\n @include mixins.min(xxl) {\n font-size: functions.px-to-rem(20px);\n }\n\n @include mixins.max(lg) {\n position: absolute;\n top: var(--calculated-header-height);\n left: 0;\n background: white;\n height: calc(var(--host-window-height) - var(--calculated-header-height));\n width: 100%;\n margin: 0;\n overflow: hidden scroll;\n -webkit-overflow-scrolling: touch;\n overscroll-behavior: contain;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n z-index: -1;\n visibility: hidden;\n transform: translateY(-100%);\n transition: transform 0.35s, visibility 0.35s;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n\n &.open {\n transform: translateY(0);\n visibility: visible;\n }\n }\n}\n\n.main-container {\n @extend %no-list;\n\n display: flex;\n align-items: center;\n justify-content: flex-start;\n\n @include mixins.max(lg) {\n flex-direction: column;\n align-items: stretch;\n justify-content: flex-start;\n padding-top: 2.5rem;\n padding-bottom: 2.5rem;\n\n > li + li {\n border-top: 1px solid color.$gray-10;\n }\n }\n\n @include mixins.min(lg) {\n padding-right: 0;\n padding-left: 0;\n }\n\n > li {\n flex: 0 1 auto;\n min-width: 0;\n }\n}\n\n.main-link {\n @extend %nav-link;\n\n display: flex;\n align-items: center;\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n text-align: left;\n cursor: pointer;\n width: 100%;\n\n @include mixins.min(lg) {\n svg {\n display: none;\n }\n }\n\n @include mixins.max(lg) {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-weight: 300;\n padding: 0.625rem 0;\n width: 100%;\n text-align: left;\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n }\n\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n}\n\n.main-link,\n.flyout-link {\n position: relative;\n color: black;\n\n &::after {\n content: '';\n position: absolute;\n bottom: -1px;\n left: 0;\n width: 100%;\n height: 4px;\n background-color: transparent;\n opacity: 0;\n transform: scaleX(0.8);\n transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),\n transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n\n &:hover,\n &.focus {\n &::after {\n background-color: color.$gray-20;\n opacity: 1;\n transform: scale(1);\n }\n }\n\n &.active {\n font-weight: 700;\n\n &::after {\n background-color: color.$yellow;\n opacity: 1;\n transform: scale(1);\n }\n }\n}\n\n.flyout {\n left: 0;\n width: 100%;\n background: white;\n padding-bottom: 3rem;\n overflow: auto;\n overscroll-behavior: contain;\n visibility: hidden;\n\n @include mixins.min(lg) {\n position: absolute;\n top: 100%;\n max-height: calc(100vh - var(--header-height) - var(--meta-header-height) - 1px);\n z-index: -1;\n box-shadow: 0 0 1px 0 rgb(0 0 0 / 40%);\n transform: translateY(-100%);\n\n &.open {\n box-shadow: 0 0 8px 0 rgb(0 0 0 / 40%);\n transform: translateY(0);\n }\n }\n\n @include mixins.max(lg) {\n position: fixed;\n top: 0;\n height: 100%;\n z-index: 1;\n transform: translateX(100%);\n\n &.open {\n transform: translateX(0);\n }\n }\n\n &.open {\n visibility: visible;\n }\n\n &.animate {\n transition: transform 0.35s, visibility 0.35s, box-shadow 0.35s;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n}\n\n.flyout-nav {\n @extend %font-curve-small;\n\n display: flex;\n justify-content: space-between;\n min-height: 3.5rem;\n\n // Change box-sizing to content-box to add 1px border width to flyout-nav hight.\n // This ensures flyout-nav has same hight as main-navigation-container.\n box-sizing: content-box;\n}\n\n.flyout-row {\n display: flex;\n gap: 1.5rem;\n\n @include mixins.max(lg) {\n display: grid;\n grid-template-columns: 1fr 1fr;\n }\n\n @include mixins.max(rg) {\n grid-template-columns: 1fr;\n }\n}\n\n.flyout-column {\n flex: 1;\n max-width: 25%;\n\n @include mixins.max(lg) {\n max-width: none;\n }\n\n h3 {\n @extend %font-curve-small;\n margin-top: 0;\n }\n}\n\n.flyout-back-button {\n @include mixins.container-padding();\n\n display: flex;\n align-items: center;\n font-size: functions.px-to-rem(16px);\n font-weight: 400;\n cursor: pointer;\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n\n @include mixins.min(lg) {\n display: none;\n }\n}\n\n.flyout-close-button {\n @extend %nav-link;\n\n display: flex;\n align-items: center;\n margin-left: auto;\n padding: 0 1.5rem;\n cursor: pointer;\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n\n @include mixins.max(lg) {\n display: none;\n }\n}\n\n.flyout-linklist {\n @extend %no-list;\n\n li {\n border-top: 1px solid color.$gray-10;\n }\n\n &:first-child > li {\n border-top-color: transparent;\n }\n}\n\n.flyout-link {\n @extend %nav-link;\n\n display: block;\n padding: 0.75rem 0;\n}\n\n.flyout-title {\n @extend %font-curve-bigger-regular;\n\n margin: 2.5rem 0 1.5rem 0;\n\n @include mixins.min(lg) {\n display: none;\n }\n}\n","import { Component, Host, h, State, Method, Event, Element, EventEmitter } from '@stencil/core';\nimport { throttle } from 'throttle-debounce';\nimport { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';\nimport { state } from '../../data/store';\nimport {\n DropdownElement,\n DropdownEvent,\n HasDropdown,\n IsFocusable,\n NavMainEntity,\n} from '../../models/header.model';\nimport { userPrefersReducedMotion } from '../../services/ui.service';\nimport { SvgSprite } from '../../utils/svg-sprite.component';\nimport { SvgIcon } from '../../utils/svg-icon.component';\nimport { LevelOneAction } from './components/level-one-action.component';\n\n@Component({\n tag: 'post-main-navigation',\n styleUrl: 'post-main-navigation.scss',\n shadow: true,\n})\nexport class PostMainNavigation implements HasDropdown, IsFocusable {\n @State() activeFlyout: string | null;\n @State() mobileMenuOpen: boolean;\n @Event() dropdownToggled: EventEmitter<DropdownEvent>;\n @Event() flyoutToggled: EventEmitter<string | null>;\n @Element() host: DropdownElement;\n private throttledResize: throttle<() => void>;\n private resizeTimer: number | null = null;\n private mouseLeaveTimer: number | null = null;\n private mouseEnterTimer: number | null = null;\n private flyoutElement: HTMLElement | undefined;\n\n connectedCallback() {\n this.throttledResize = throttle(300, () => this.handleResize());\n window.addEventListener('resize', this.throttledResize, { passive: true });\n this.setWindowHeight();\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.throttledResize);\n clearAllBodyScrollLocks();\n if (this.mouseEnterTimer !== null) window.clearTimeout(this.mouseEnterTimer);\n if (this.mouseLeaveTimer !== null) window.clearTimeout(this.mouseLeaveTimer);\n }\n\n handleResize() {\n // Suspend all animations and transitions on window resize\n this.host.classList.add('no-animation');\n if (this.resizeTimer !== null) window.clearTimeout(this.resizeTimer);\n this.resizeTimer = window.setTimeout(() => {\n this.host.classList.remove('no-animation');\n }, 300);\n\n this.setWindowHeight();\n }\n\n // Update window height var\n setWindowHeight() {\n if (!this.host) {\n return;\n }\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n\n // Safari might or might not show a blank bar at the bottom where the browser\n // controls should be. This timeout waits for this bar to appear before resetting the available height\n window.setTimeout(() => {\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n }, 100);\n }\n\n openFlyout(id: string) {\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout && this.activeFlyout !== '') {\n // Add flyout animation if there's no flyout open\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = id;\n this.flyoutToggled.emit(id);\n this.setWindowHeight();\n\n if (this.mouseLeaveTimer !== null) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n }\n\n closeFlyout(id?: string) {\n if (id === undefined) return;\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout) {\n // Add flyout animation for close action\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = null;\n this.flyoutToggled.emit();\n }\n\n addFlyoutAnimation(flyout: HTMLElement) {\n // Check if user prefers to see animations or not\n if (!userPrefersReducedMotion()) {\n flyout.classList.add('animate');\n\n // Remove flyout animation after transition ended\n flyout.addEventListener('transitionend', () => this.removeFlyoutAnimation(flyout), {\n once: true,\n });\n }\n }\n\n removeFlyoutAnimation(flyout: HTMLElement) {\n flyout.classList.remove('animate');\n }\n\n isActiveFlyout(id?: string) {\n return id === this.activeFlyout;\n }\n\n handleMouseEnter(level: NavMainEntity) {\n // Cancel opening the flyout if there already is one scheduled to open\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n this.mouseEnterTimer = null;\n }\n\n // Cancel closing if we enter again\n if (this.mouseLeaveTimer && this.activeFlyout === level.id) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0 && this.activeFlyout !== level.id) {\n // Delay opening the flyout for a moment to give users a chance to move the mouse over the navigation without triggering the flyout\n this.mouseEnterTimer = window.setTimeout(() => {\n this.mouseEnterTimer = null;\n if (level.id !== undefined) this.openFlyout(level.id);\n }, 200);\n }\n }\n\n handleMouseLeave(level: NavMainEntity) {\n // Cancel opening the flyout if a mouseleave event happens before the flyout opened\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n }\n\n // Don't close an open flyout if the mouseleave is from another mainnav entry\n if (this.activeFlyout && this.activeFlyout !== level.id) {\n return;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0) {\n // Allow the pointer to shortly leave the flyout without closing it. This\n // allows for user mistakes and makes the experience less nervous\n this.mouseLeaveTimer = window.setTimeout(() => {\n this.closeFlyout(level.id);\n }, 300);\n }\n }\n\n handleTouchEnd(event: TouchEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first touchstart and has a flyout, prevent link activation and open the flyout\n if (event.cancelable) event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleKeyPress(event: KeyboardEvent, level: NavMainEntity) {\n if (event.key === 'Enter' && !this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first enter keypress and has a flyout, prevent link activation and open the flyout\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleClick(event: MouseEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first click, always open the flyout, never the link\n // This is relevant for desktop with active screenreader which\n // translates an enter keypress to a click\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n /**\n * Disable or re-enable body scrolling, depending on whether mobile menu is open or closed\n */\n setBodyScroll() {\n if (this.mobileMenuOpen) {\n disableBodyScroll(this.flyoutElement);\n } else {\n enableBodyScroll(this.flyoutElement);\n }\n }\n\n /**\n * Toggle the main navigation (only visible on mobile)\n * @param force Force a state\n * @returns Boolean indicating new state\n */\n @Method()\n async toggleDropdown(force?: boolean) {\n this.mobileMenuOpen = force === undefined ? !this.mobileMenuOpen : force;\n this.dropdownToggled.emit({ open: this.mobileMenuOpen, element: this.host });\n\n if (force === false) {\n this.closeFlyout();\n }\n\n this.setBodyScroll();\n this.setWindowHeight();\n\n return this.mobileMenuOpen;\n }\n\n /**\n * Focus the main navigation toggle button\n */\n @Method()\n async setFocus() {\n const firstLink = this.host.shadowRoot?.querySelector<HTMLElement>('.main-link');\n if (firstLink) {\n firstLink.focus();\n }\n }\n\n /**\n * Open a specific flyout\n * @param id Flyout ID\n */\n @Method()\n async setActiveFlyout(id: string | null) {\n this.activeFlyout = id;\n this.flyoutToggled.emit(this.activeFlyout);\n }\n\n render() {\n if (state.localizedConfig?.header === undefined) return;\n const headerConfig = state.localizedConfig.header;\n\n return (\n <Host>\n <SvgSprite />\n <nav\n id=\"post-internet-header-main-navigation\"\n class={{ 'main-navigation': true, 'open': this.mobileMenuOpen }}\n ref={el => (this.flyoutElement = el)}\n >\n <h2 class=\"visually-hidden\">{headerConfig.translations.navMainAriaLabel}</h2>\n <ul class=\"main-container container\">\n {headerConfig.navMain.map(levelOne => (\n <li\n key={levelOne.text}\n onMouseLeave={() => this.handleMouseLeave(levelOne)}\n onMouseEnter={() => this.handleMouseEnter(levelOne)}\n >\n <LevelOneAction\n level={levelOne}\n isOpen={this.isActiveFlyout(levelOne.id)}\n onTouchEnd={e => this.handleTouchEnd(e, levelOne)}\n onKeyDown={e => this.handleKeyPress(e, levelOne)}\n onClick={e => this.handleClick(e, levelOne)}\n />\n {!levelOne.noFlyout ? (\n <div\n id={levelOne.id}\n class={{ flyout: true, open: this.isActiveFlyout(levelOne.id) }}\n >\n <div class=\"wide-container\">\n <div class=\"flyout-nav\">\n <button\n class=\"nav-link flyout-back-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <SvgIcon name=\"pi-pointy-arrow-right\" classNames=\"mirrored\" />\n <span>{headerConfig.translations.backButtonText}</span>\n </button>\n <button\n class=\"flyout-close-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <span class=\"visually-hidden\">\n {headerConfig.translations.mobileNavToggleClose}\n </span>\n <SvgIcon name=\"pi-close\" />\n </button>\n </div>\n <h2 class=\"flyout-title container\">\n <a href={levelOne.url} class=\"nav-link\">\n {levelOne.text}\n </a>\n </h2>\n <div class=\"flyout-row container\">\n {levelOne.flyout.map(flyout => (\n <div key={flyout.title} class=\"flyout-column\">\n {flyout.title ? <h3>{flyout.title}</h3> : null}\n <ul class=\"flyout-linklist\">\n {flyout.linkList.map(link => (\n <li key={link.url}>\n <a\n class={{\n 'flyout-link': true,\n 'active': !!link?.isActiveOverride,\n }}\n href={link.url}\n target={link.target}\n >\n {link.title}\n </a>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n </div>\n ) : null}\n </li>\n ))}\n </ul>\n <slot></slot>\n </nav>\n </Host>\n );\n }\n}\n"],"mappings":"sSAGO,MAAMA,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(e){"use strict";var n;return{setters:[function(e){n=e.s}],execute:function(){var r={"Close overlay":{de:"Overlay Schliessen",fr:"Fermer la superposition",it:"Chiudi sovrapposizione"},"Current language is English":{de:"Die aktuelle Sprache ist Deutsch",fr:"La langue actuelle est le français",it:"La lingua corrente è l'italiano"},"Change language":{de:"Sprache wechseln",fr:"Changer de langue",it:"Cambia lingua"},"Go to main content":{de:"Zum Hauptinhalt springen",fr:"Aller au contenu principal",it:"Vai al contenuto principale"},"Go to search":{de:"Zur Suche springen",fr:"Aller à la recherche",it:"Vai alla ricerca"},"Go to login":{de:"Zum Login springen",fr:"Aller au login",it:"Vai al login"},"Open menu":{de:"Menü öffnen",fr:"Ouvrir le menu",it:"Apri il menu"},"Navigate on post.ch":{de:"Navigieren auf post.ch",fr:"Naviguer sur post.ch",it:"Navigate su post.ch"}};var a=e("g",(function(e,r,a,t){if(e.length===0){return undefined}if(e.length===1){return e[0]}var u=new URL(window.location.href);var l=[r,u.searchParams.get("lang"),u.pathname.split("/").find((function(n){return e.includes(n)})),a!==undefined?window.localStorage.getItem(a):null,i("language"),i("lang"),t!==undefined?i(t):null,document.documentElement.lang,o(e),n.currentLanguage].filter((function(e){return!!e}));var c=l.find((function(n){return e.includes(n)}))||e[0];if(!c||c.length!==2){throw new Error("Current language could not be determined from settings or the language provided (".concat(c,") is not supported by the Header API."))}return c}));var t=e("p",(function(e,r,a){if(a!==undefined){window.localStorage.setItem(a,e)}if(r!==undefined){u(r,e)}n.currentLanguage=e}));var i=function(e){var n;return((n=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)"))===null||n===void 0?void 0:n.pop())||""};var u=function(e,n){document.cookie="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(n))};var o=function(e){if(navigator.language){var n=l(navigator.language);if(e.indexOf(n)!==-1){return n}}if(navigator.languages){for(var r=0,a=navigator.languages;r<a.length;r++){var t=a[r];var n=l(t);if(e.indexOf(n)!==-1){return n}}}return null};var l=function(e){return e.substring(0,2).toLowerCase()};var c=e("t",(function(e,a,t){if(t===void 0){t=r}var i,u,o;return(o=(i=t[e])===null||i===void 0?void 0:i[(u=a!==null&&a!==void 0?a:n.currentLanguage)!==null&&u!==void 0?u:""])!==null&&o!==void 0?o:e}))}}}));
2
+ //# sourceMappingURL=p-324563ab.system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["translations","de","fr","it","getUserLang","exports","supportedLanguages","implementorPreferredLanguage","localStorageKey","cookieKey","length","undefined","url","URL","window","location","href","languagesSet","searchParams","get","pathname","split","find","segment","includes","localStorage","getItem","getCookie","document","documentElement","lang","getPreferredLanguageFromBrowser","state","currentLanguage","filter","language","Error","concat","persistLanguageChoice","setItem","setCookie","name","_a","cookie","match","pop","key","value","encodeURIComponent","navigator","extractLanguage","indexOf","languages","_i","_d","l","substring","toLowerCase","translate","translationObject","_b","_c"],"sources":["src/assets/i18n/translations.ts","src/services/language.service.ts"],"sourcesContent":["export const translations = {\n 'Close overlay': {\n de: 'Overlay Schliessen',\n fr: 'Fermer la superposition',\n it: 'Chiudi sovrapposizione',\n },\n 'Current language is English': {\n de: 'Die aktuelle Sprache ist Deutsch',\n fr: 'La langue actuelle est le français',\n it: \"La lingua corrente è l'italiano\",\n },\n 'Change language': {\n de: 'Sprache wechseln',\n fr: 'Changer de langue',\n it: 'Cambia lingua',\n },\n 'Go to main content': {\n de: 'Zum Hauptinhalt springen',\n fr: 'Aller au contenu principal',\n it: 'Vai al contenuto principale',\n },\n 'Go to search': {\n de: 'Zur Suche springen',\n fr: 'Aller à la recherche',\n it: 'Vai alla ricerca',\n },\n 'Go to login': {\n de: 'Zum Login springen',\n fr: 'Aller au login',\n it: 'Vai al login',\n },\n 'Open menu': {\n de: 'Menü öffnen',\n fr: 'Ouvrir le menu',\n it: 'Apri il menu',\n },\n 'Navigate on post.ch': {\n de: 'Navigieren auf post.ch',\n fr: 'Naviguer sur post.ch',\n it: 'Navigate su post.ch',\n },\n};\n","import { translations } from '../assets/i18n/translations';\nimport { state } from '../data/store';\n\nexport const getUserLang = (\n supportedLanguages: string[],\n implementorPreferredLanguage?: string,\n localStorageKey?: string,\n cookieKey?: string,\n) => {\n // If there are no supported languages, well...\n if (supportedLanguages.length === 0) {\n return undefined;\n }\n\n // If there is only one language in the config, use this\n if (supportedLanguages.length === 1) {\n return supportedLanguages[0];\n }\n\n const url = new URL(window.location.href);\n\n /**\n * Build array of possible language definitions in order of importance.\n * At the end is a filter function that will weed out any undefined or null entries.\n */\n let languagesSet: Array<string> = [\n // Check if implementor overrides lang config\n implementorPreferredLanguage,\n\n // Check query string param\n url.searchParams.get('lang'),\n\n // Check url pathname\n url.pathname.split('/').find(segment => supportedLanguages.includes(segment)),\n\n // Check local storage with the key provided\n localStorageKey !== undefined ? window.localStorage.getItem(localStorageKey) : null,\n\n // Check cookies\n getCookie('language'),\n getCookie('lang'),\n cookieKey !== undefined ? getCookie(cookieKey) : null,\n\n // Check document language\n document.documentElement.lang,\n\n // Check browser preferred language\n getPreferredLanguageFromBrowser(supportedLanguages),\n\n // Check the state\n state.currentLanguage,\n ].filter((lang): lang is string => !!lang);\n\n // Check the set of languages to see if it matches\n // any of the supported languages. Return the first\n // supported language if there is none set\n const lang =\n languagesSet.find(language => supportedLanguages.includes(language)) || supportedLanguages[0];\n\n if (!lang || lang.length !== 2) {\n throw new Error(\n `Current language could not be determined from settings or the language provided (${lang}) is not supported by the Header API.`,\n );\n }\n\n return lang;\n};\n\n/**\n * Persist chosen language to local storage\n * @param lang Currently chose language, two char string\n */\nexport const persistLanguageChoice = (\n lang: string,\n cookieKey?: string,\n localStorageKey?: string,\n) => {\n if (localStorageKey !== undefined) {\n window.localStorage.setItem(localStorageKey, lang);\n }\n\n if (cookieKey !== undefined) {\n setCookie(cookieKey, lang);\n }\n\n state.currentLanguage = lang;\n};\n\n/**\n * Read a cookie by name\n * https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript?rq=1\n * @param name Cookie name\n * @returns Cookie value or an empty string\n */\nexport const getCookie = (name: string) => {\n return document.cookie.match('(^|;)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)')?.pop() || '';\n};\n\n/**\n * Write a new cookie\n * https://developer.mozilla.org/en-US/docs/Web/API/document/cookie#A_little_framework.3A_a_complete_cookies_reader.2Fwriter_with_full_unicode_support\n * @param key\n * @param value\n */\nexport const setCookie = (key: string, value: string) => {\n document.cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;\n};\n\nconst getPreferredLanguageFromBrowser = (supportedLanguages: string[]): string | null => {\n // IE & Chrome\n if (navigator.language) {\n const lang = extractLanguage(navigator.language);\n if (supportedLanguages.indexOf(lang) !== -1) {\n return lang;\n }\n }\n\n // Chrome supports a list of preferred languages: if the preferred is not supported, we go down the list.\n if (navigator.languages) {\n for (const l of navigator.languages) {\n const lang = extractLanguage(l);\n if (supportedLanguages.indexOf(lang) !== -1) {\n return lang;\n }\n }\n }\n\n return null;\n};\n\nconst extractLanguage = (language: string): string => language.substring(0, 2).toLowerCase();\n\n/**\n * Simple translate function for general header UI strings\n *\n * @param key Translation key\n * @param lang Force a language\n * @param translationObject Optionally provide translations\n * @returns Translated string or the key\n */\nexport const translate = (key: string, lang?: string, translationObject = translations) =>\n translationObject[key]?.[lang ?? state.currentLanguage ?? ''] ?? key;\n"],"mappings":"kIAAO,IAAMA,EAAe,CAC1B,gBAAiB,CACfC,GAAI,qBACJC,GAAI,0BACJC,GAAI,0BAEN,8BAA+B,CAC7BF,GAAI,mCACJC,GAAI,qCACJC,GAAI,mCAEN,kBAAmB,CACjBF,GAAI,mBACJC,GAAI,oBACJC,GAAI,iBAEN,qBAAsB,CACpBF,GAAI,2BACJC,GAAI,6BACJC,GAAI,+BAEN,eAAgB,CACdF,GAAI,qBACJC,GAAI,uBACJC,GAAI,oBAEN,cAAe,CACbF,GAAI,qBACJC,GAAI,iBACJC,GAAI,gBAEN,YAAa,CACXF,GAAI,cACJC,GAAI,iBACJC,GAAI,gBAEN,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AN,OAAGW,mBAAmBF,GAAI,KAAAT,OAAIW,mBAAmBD,GACrE,EAEA,IAAMhB,EAAkC,SAACzB,GAEvC,GAAI2C,UAAUd,SAAU,CACtB,IAAML,EAAOoB,EAAgBD,UAAUd,UACvC,GAAI7B,EAAmB6C,QAAQrB,MAAW,EAAG,CAC3C,OAAOA,C,EAKX,GAAImB,UAAUG,UAAW,CACvB,IAAgB,IAAAC,EAAA,EAAAC,EAAAL,UAAUG,UAAVC,EAAAC,EAAA5C,OAAA2C,IAAqB,CAAhC,IAAME,EAACD,EAAAD,GACV,IAAMvB,EAAOoB,EAAgBK,GAC7B,GAAIjD,EAAmB6C,QAAQrB,MAAW,EAAG,CAC3C,OAAOA,C,GAKb,OAAO,IACT,EAEA,IAAMoB,EAAkB,SAACf,GAA6B,OAAAA,EAASqB,UAAU,EAAG,GAAGC,aAAzB,E,IAUzCC,EAASrD,EAAA,KAAG,SAACyC,EAAahB,EAAe6B,GAAA,GAAAA,SAAA,GAAAA,EAAA3D,CAAgC,KAAA0C,EAAAkB,EAAAC,EACpF,OAAAA,GAAAnB,EAAAiB,EAAkBb,MAAI,MAAAJ,SAAA,SAAAA,GAAGkB,EAAA9B,IAAI,MAAJA,SAAI,EAAJA,EAAQE,EAAMC,mBAAe,MAAA2B,SAAA,EAAAA,EAAI,OAAG,MAAAC,SAAA,EAAAA,EAAIf,CAAG,G"}
@@ -0,0 +1,2 @@
1
+ import{r as t,c as e,h as i,H as n,g as o}from"./p-5032057e.js";import{t as s,d as a}from"./p-a74b380d.js";import{g as r,p as l}from"./p-a6001d1e.js";import{u as d}from"./p-8bf099a8.js";import{s as h,d as c}from"./p-06649b46.js";import{S as u}from"./p-f7c0cf7b.js";import{S as f}from"./p-ab1dd269.js";import{I as p}from"./p-a2f9d462.js";const g=(t,e)=>{if(e===false){return t}let i;t=v(t);if(e==="auto"||e==="exact"){if(m(t)){return w(t)}i=new URL(window.location.href)}else{try{i=new URL(e,document.location.origin)}catch(i){console.warn(`Active Route: ${e} is not a valid URL. Navigation highlighting has been disabled.`);return t}}const n=b(t,i,e);if(n.length===0){return t}const o=n[0];o.main.isActiveOverride=true;if(o.sub)o.sub.isActiveOverride=true;return t};const m=t=>t.filter((t=>t.isActive)).length>0;const w=t=>t.map((t=>Object.assign(Object.assign({},t),{isActiveOverride:t.isActive,flyout:t.flyout.map((t=>Object.assign(Object.assign({},t),{linkList:t.linkList.map((t=>Object.assign(Object.assign({},t),{isActiveOverride:t.isActive})))})))})));const v=t=>t.map((t=>Object.assign(Object.assign({},t),{isActiveOverride:false,flyout:t.flyout.map((t=>Object.assign(Object.assign({},t),{linkList:t.linkList.map((t=>Object.assign(Object.assign({},t),{isActiveOverride:false})))})))})));const b=(t,e,i)=>{let n=false;const o=[];t.forEach((t=>{if(n||!t){return}try{const s=x(e,new URL(t.url),i);if(s>0){if(s===Infinity)n=true;o.push({main:t,score:s})}}catch(t){}if(t.flyout.length){t.flyout.forEach((s=>{if(s.linkList){s.linkList.forEach((s=>{if(s.isActive&&(i==="auto"||i==="exact")){n=true;return}try{const a=new URL(s.url);const r=x(e,a,i);if(r>0){if(r===Infinity)n=true;o.push({main:t,sub:s,score:r})}}catch(t){}}))}}))}}));return o.sort(((t,e)=>e.score-t.score))};const x=(t,e,i)=>{if(!t||!e||t.origin!==e.origin){return 0}if(t.pathname===e.pathname){return Infinity}if(t.pathname.length<e.pathname.length){return 0}if(i==="auto"){const i=[t.origin,...t.pathname.split("/").filter((t=>!!t))];const n=[e.origin,...e.pathname.split("/").filter((t=>!!t))];const o=y(i,n);return Math.min(i.length,n.length)===o?o:0}return 0};const y=(t,e)=>{if(!(t===null||t===void 0?void 0:t.length)||!(e===null||e===void 0?void 0:e.length)){return 0}let i=0;for(;i<Math.min(t.length,e.length);i++){if(t[i]!==e[i]){return 0}}return i};let j=null;let k=null;const O=async({projectId:t,environment:e,language:i,cookieKey:n,localStorageKey:o,activeRouteProp:s,localizedCustomConfig:a,osFlyoutOverrides:d})=>{var h,c;if(!j){j=F(t,e)}const u=await j;const f=r(Object.keys(u),i,o,n);if(f===undefined){throw new Error("Internet Header: unable to determine current language")}let p=Object.assign({},u[f]);if(a){const t=((h=a===null||a===void 0?void 0:a.header)===null||h===void 0?void 0:h.navMain)?Object.assign(Object.assign({},p.header),{navMain:[...p.header.navMain,...a.header.navMain]}):p.header;p=Object.assign(Object.assign({},p),{header:t})}if(d)p.header.navMain=C(p,d);if(s)p.header.navMain=g(p.header.navMain,s);S((c=p===null||p===void 0?void 0:p.header)===null||c===void 0?void 0:c.navMain);l(f,n,o);return p};const C=(t,e)=>{if(!e)return t.header.navMain;return t.header.navMain.map((t=>{var i,n;if(t.id!=="flyout_os")return t;if(k===null){k=JSON.parse(JSON.stringify(t))}const o=(i=e.text)!==null&&i!==void 0?i:k.text;const s=(n=e.title)!==null&&n!==void 0?n:k.title;if(!k.flyout||k.flyout.length===0||!e.flyout||e.flyout.length===0)return Object.assign(Object.assign({},t),{title:s,text:o});const a=[...k.flyout.map(((t,i)=>{var n;const o=e.flyout[i];const s=(n=o.title)!==null&&n!==void 0?n:t.title;const a=o.linkList?e.flyout[i].linkList:[];return{title:s,linkList:[...t.linkList,...a]}})),...e.flyout.slice(k.flyout.length)];return Object.assign(Object.assign({},t),{text:o,title:s,flyout:a})}))};const F=async(t,e)=>{if(!N(t)){throw new Error(`Internet Header: invalid project id "${t}"`)}if(t==="test"){e="int01"}let i=L(t,e);try{const t=await fetch(i);return await t.json()}catch(t){throw new Error(`Internet Header: fetching config failed. ${t.message}`)}};const L=(t,e)=>{if(t==="test")return"assets/config/test-configuration.json";const i=e.toLowerCase();const n=i.startsWith("int");const o=`https://${n?"int":"www"}.post.ch`;try{return new URL(`${o}/api/headerjs/Json?serviceid=${encodeURIComponent(t)}${n?"&environment="+i:""}`).toString()}catch(t){throw new Error(`Internet Header: Config URL is invalid.`)}};const N=t=>t!==""&&t.length>0&&/^[a-zA-Z][\w-]*[a-zA-Z0-9]$/.test(t);const I=(t,e)=>{var i;let n;try{n=typeof t==="string"?JSON.parse(t):t}catch(t){throw new Error(`Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. `)}let o=n[e];if((i=o===null||o===void 0?void 0:o.header)===null||i===void 0?void 0:i.navMain)S(o.header.navMain);return o};const S=t=>{t.forEach((t=>{t.id=t.id==="flyout_os"?t.id:d("main-nav-")}))};const z="@swisspost/internet-header";const R="1.5.2";const P="Swiss Post Internet Header";const A="Apache-2.0";const K="loader/index.cjs.js";const $="loader/index.js";const E="loader/index.es2017.js";const H="loader/index.es2017.js";const J="loader/index.d.ts";const M="dist/collection/collection-manifest.json";const T="loader/cdn.js";const U={access:"public"};const D=["dist/","loader/"];const W={build:"npm run stencil:build",clean:"rimraf www dist loader storybook-static",start:"npm run stencil:serve",test:"jest",lint:"eslint src/**/*{.ts,.tsx}","lint:fix":"eslint src/**/*{.ts,.tsx} --fix","stencil:start":"stencil build --docs --watch","stencil:build":"stencil build --docs","stencil:serve":"stencil build --watch --serve --docs",generate:"stencil generate",jest:"jest","jest:watch":"jest --watch"};const _={"@sindresorhus/slugify":"2.2.0","@stencil/core":"3.0.0","@stencil/store":"2.0.3","body-scroll-lock":"4.0.0-beta.0","iframe-resizer":"4.3.3",jquery:"3.6.3",tabbable:"6.0.1","throttle-debounce":"5.0.0","url-polyfill":"1.1.12"};const q={"@babel/core":"7.20.12","@stencil/eslint-plugin":"0.4.0","@stencil/sass":"2.0.3","@swisspost/design-system-styles":"5.3.1","@types/iframe-resizer":"3.5.9","@types/jest":"27.5.2","@types/jquery":"3.5.16","@types/node":"18.11.19","@types/throttle-debounce":"5.0.0","babel-loader":"9.1.2",bootstrap:"5.1","eslint-plugin-react":"^7.32.0",globby:"13.1.3",jest:"27.5.1",rimraf:"4.1.2","rollup-plugin-node-polyfills":"0.2.1","rollup-plugin-scss":"4.0.0","rollup-plugin-visualizer":"5.9.0",sass:"1.58.0","start-server-and-test":"1.15.3","ts-jest":"27.1.5",typescript:"4.8.4"};const B={name:z,version:R,description:P,license:A,main:K,module:$,es2015:E,es2017:H,"jsnext:main":"loader/index.es2017.js",types:J,collection:M,"collection:main":"dist/collection/index.js",unpkg:T,publishConfig:U,files:D,scripts:W,dependencies:_,devDependencies:q};const X='@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:700;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:400;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff") format("woff")}@font-face{font-display:swap;font-family:"Frutiger Neue For Post";font-weight:300;src:url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff2") format("woff2"), url("https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff") format("woff")}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:"Frutiger Neue For Post", system-ui, sans-serif}button{font:inherit;padding:0}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active){svg{color:white}}.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}.btn-blank{background-color:transparent;border:none;border-radius:0;padding:0}.nav-link{text-decoration:none;color:rgba(0, 0, 0, 0.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:transparent;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:0.5rem}.nav-link:hover,.nav-link:focus{color:black}.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px) and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1440.98px){.hidden-xxl{display:none}}:host{display:block;position:relative;font-size:1rem;font-weight:300;z-index:var(--header-z-index, 10);--header-height:3.5rem;--meta-header-height:0px;--language-dropdown-margin-top:0px}@media (min-width: 1024px){:host{--meta-header-height:3rem;--header-height:4rem}}@media (min-width: 1280px){:host{--header-height:4.5rem}}:host([meta=false]){--meta-header-height:0px;--language-dropdown-margin-top:1px}@supports ((position: -webkit-sticky) or (position: sticky)){:host(:not(.stickyness-none)){position:-webkit-sticky;position:sticky}:host(.stickyness-full){top:0}:host(.stickyness-main){top:calc(var(--meta-header-height, 0px) * -1)}:host(.stickyness-minimal){top:calc((var(--header-height, 0px) + var(--meta-header-height, 0px)) * -1);-webkit-transition:top 200ms ease-in;transition:top 200ms ease-in}:host(.stickyness-minimal.scrolling-up),:host(.stickyness-minimal.dropdown-open){top:calc(var(--meta-header-height, 0px) * -1);-webkit-transition:top 200ms ease-out;transition:top 200ms ease-out}}.post-internet-header{border-bottom:1px solid #e6e6e6;background-color:white}.main-navigation-container{display:-ms-flexbox;display:flex}.main-navigation-container>.main-navigation-controls{-ms-flex:0 0 auto;flex:0 0 auto}.main-navigation{display:-ms-flexbox;display:flex}.sub-navigation-container{position:absolute;top:100%;left:0;width:100%;display:-ms-flexbox;display:flex;background:white;visibility:hidden}.main-navigation-item:hover .sub-navigation-container{visibility:visible}.main-navigation-controls{display:-ms-flexbox;display:flex;margin-left:auto}@media (max-width: 1023.98px){.main-navigation-controls{font-weight:400}}@media (min-width: 1024px){.main-navigation-controls{font-size:1.0625rem}}.main-navigation-controls>*{border-left:1px solid #e6e6e6}.menu-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 calc(1rem - 1px);font-weight:300;cursor:pointer;border-left:1px solid #e6e6e6;-ms-flex-order:1;order:1;}@media (min-width: 1024px){.menu-button{display:none}}@media (min-width: 600px) and (max-width: 1023.98px){.menu-button .visually-hidden{position:static;width:auto;height:auto;margin:auto;overflow:visible;clip:auto;visibility:visible;margin-right:0.5rem}}.menu-button svg{width:1.5rem;height:1.5rem}.full-width .wide-container{max-width:none}';const Z=class{async getCurrentLanguage(){var t;return(t=h.currentLanguage)!==null&&t!==void 0?t:"de"}constructor(i){t(this,i);this.headerLoaded=e(this,"headerLoaded",7);this.lastScrollTop=window.scrollY||document.documentElement.scrollTop;this.lastWindowWidth=window.innerWidth;this.handleClickOutsideBound=this.handleClickOutside.bind(this);this.project=undefined;this.stickyness="minimal";this.language=undefined;this.meta=true;this.login=true;this.search=true;this.skiplinks=true;this.configProxy=undefined;this.environment="prod";this.languageSwitchOverrides=undefined;this.customConfig=undefined;this.languageCookieKey=undefined;this.languageLocalStorageKey="swisspost-internet-header-language";this.activeRoute="auto";this.osFlyoutOverrides=undefined;this.fullWidth=false;this.activeFlyout=null;this.activeDropdownElement=null;if(this.project===undefined||this.project===""||!N(this.project)){throw new Error(`Internet Header project key is "${this.project}". Please provide a valid project key.`)}}connectedCallback(){this.throttledScroll=s(300,(()=>this.handleScrollEvent()));this.debouncedResize=a(200,(()=>this.handleResize()));window.addEventListener("scroll",this.throttledScroll,{passive:true});window.addEventListener("resize",this.debouncedResize,{passive:true})}disconnectedCallback(){window.removeEventListener("scroll",this.throttledScroll);window.removeEventListener("resize",this.debouncedResize);c()}async componentWillLoad(){try{h.projectId=this.project;h.environment=this.environment;if(this.language!==undefined)h.currentLanguage=this.language;h.languageSwitchOverrides=typeof this.languageSwitchOverrides==="string"?JSON.parse(this.languageSwitchOverrides):this.languageSwitchOverrides;h.osFlyoutOverrides=typeof this.osFlyoutOverrides==="string"?JSON.parse(this.osFlyoutOverrides):this.osFlyoutOverrides;if(this.customConfig!==undefined&&h.currentLanguage!==null){h.localizedCustomConfig=I(this.customConfig,h.currentLanguage)}h.localizedConfig=await O({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:h.localizedCustomConfig,osFlyoutOverrides:h.osFlyoutOverrides})}catch(t){console.error(t)}}componentDidLoad(){window.requestAnimationFrame((()=>{this.handleResize();this.headerLoaded.emit();this.host.classList.add("header-loaded")}))}async handleLanguageChange(t){h.currentLanguage=t;h.localizedConfig=await O({projectId:this.project,environment:this.environment,language:t,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:h.localizedCustomConfig,osFlyoutOverrides:h.osFlyoutOverrides});if(this.customConfig)h.localizedCustomConfig=I(this.customConfig,t)}handleAvailableLanguagesChage(t){h.languageSwitchOverrides=typeof t==="string"?JSON.parse(t):t}async handleOsFlyoutOverrides(t){h.osFlyoutOverrides=typeof t==="string"?JSON.parse(t):t;h.localizedConfig=await O({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:h.localizedCustomConfig,osFlyoutOverrides:h.osFlyoutOverrides})}async handleActiveRouteChange(t){h.localizedConfig=await O({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:t,localizedCustomConfig:h.localizedCustomConfig,osFlyoutOverrides:h.osFlyoutOverrides})}async handleCustomConfigChange(t){if(this.language===undefined)return;const e=I(t,this.language);h.localizedCustomConfig=e;h.localizedConfig=await O({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:e,osFlyoutOverrides:h.osFlyoutOverrides})}handleSearchChange(t){h.search=t}handleLoginChange(t){h.login=t}handleMetaChange(t){h.meta=t}handleLanguageChangeEvent(t){this.handleLanguageChange(t.detail)}handleClickOutside(t){if(this.activeDropdownElement&&!t.composedPath().includes(this.activeDropdownElement)){this.activeDropdownElement.toggleDropdown(false)}}handleKeyUp(t){if(t.key==="Escape"){if(this.activeDropdownElement){this.activeDropdownElement.toggleDropdown(false)}if(this.activeFlyout!==null&&this.mainNav){this.mainNav.toggleDropdown(false)}}}handleScrollEvent(){const t=window.scrollY||document.documentElement.scrollTop;if(this.stickyness==="minimal"){this.host.classList.toggle("scrolling-up",t<=this.lastScrollTop)}this.lastScrollTop=t<=0?0:t}handleResize(){var t;if(this.isMainNavOpen()&&this.lastWindowWidth<1024&&window.innerWidth>=1024){(t=this.activeDropdownElement)===null||t===void 0?void 0:t.toggleDropdown(false)}this.lastWindowWidth=window.innerWidth}handleDropdownToggled(t){if(!t.detail.open&&this.activeDropdownElement!==t.detail.element){return}if(t.detail.open===true){if(this.activeDropdownElement){this.activeDropdownElement.toggleDropdown(false)}this.activeDropdownElement=t.detail.element;if(window.innerWidth>=1024){window.setTimeout((()=>{window.addEventListener("click",this.handleClickOutsideBound)}),10)}if(this.activeFlyout!==null&&this.mainNav){this.mainNav.setActiveFlyout(null)}}else{this.activeDropdownElement=null;window.removeEventListener("click",this.handleClickOutsideBound)}}handleFlyoutToggled(t){this.activeFlyout=t.detail;if(this.activeDropdownElement&&t.detail&&!this.isMainNavOpen()){this.activeDropdownElement.toggleDropdown(false)}}toggleMobileDropdown(){var t;(t=this.mainNav)===null||t===void 0?void 0:t.toggleDropdown()}isMainNavOpen(){return this.activeDropdownElement&&this.activeDropdownElement.tagName==="POST-MAIN-NAVIGATION"}render(){var t,e,o;if(!((t=h.localizedConfig)===null||t===void 0?void 0:t.header)){console.error(new Error("Internet Header: Config cannot be loaded"));return}const s=h.localizedConfig;const a=this.meta&&s.header.navMeta!==undefined&&((e=s.header.navMeta)===null||e===void 0?void 0:e.filter((t=>!t.isHomeLink)).length)>0;const r=((o=this.login)!==null&&o!==void 0?o:!s.header.isLoginWidgetHidden)&&s.header.loginWidgetOptions;const l=s.header.navLang.length>1;return i(n,{class:`stickyness-${this.stickyness} ${this.activeDropdownElement||this.activeFlyout?"dropdown-open":""}`,"data-version":B.version,onKeyup:t=>this.handleKeyUp(t)},i("header",{class:`post-internet-header${this.fullWidth?" full-width":""}`},i(u,null),i(p,{condition:this.skiplinks===true},i("post-skiplinks",null)),i(p,{condition:a===true},i("post-meta-navigation",{orientation:"horizontal",class:"hidden-lg","full-width":this.fullWidth},i(p,{condition:l===true},i("post-language-switch",{id:"post-language-switch-desktop",mode:"dropdown",onDropdownToggled:t=>this.handleDropdownToggled(t)})))),i("div",{class:"main-navigation-container wide-container"},i("post-logo",null),i("button",{class:"menu-button nav-link",onClick:()=>this.toggleMobileDropdown()},i("span",{class:"menu-button-text visually-hidden"},s.header.mobileMenu.text),i(f,{name:this.isMainNavOpen()?"pi-close":"pi-menu"})),i("post-main-navigation",{onDropdownToggled:t=>this.handleDropdownToggled(t),onFlyoutToggled:t=>this.handleFlyoutToggled(t),ref:t=>this.mainNav=t},i(p,{condition:a===true},i("post-meta-navigation",{orientation:"vertical"},i(p,{condition:l===true},i("post-language-switch",{id:"post-language-switch-mobile",mode:"list"}))))),i("div",{class:"main-navigation-controls"},i(p,{condition:this.search!==false},i("post-search",{onDropdownToggled:t=>this.handleDropdownToggled(t)})),i(p,{condition:!!r},i("post-klp-login-widget",null,i("slot",{name:"login-widget"}))),i(p,{condition:a===false&&l===true},i("post-language-switch",{id:"post-language-switch-no-meta",onDropdownToggled:t=>this.handleDropdownToggled(t),mode:"dropdown"})),i("slot",{name:"main"})))))}get host(){return o(this)}static get watchers(){return{language:["handleLanguageChange"],languageSwitchOverrides:["handleAvailableLanguagesChage"],osFlyoutOverrides:["handleOsFlyoutOverrides"],activeRoute:["handleActiveRouteChange"],customConfig:["handleCustomConfigChange"],search:["handleSearchChange"],login:["handleLoginChange"],meta:["handleMetaChange"]}}};Z.style=X;export{Z as swisspost_internet_header};
2
+ //# sourceMappingURL=p-33ff32c6.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["markActiveRoute","config","activeRouteProp","compareUrl","resetOverrideConfig","hasActivePortalRoute","resetActiveStateToPortalConfig","URL","window","location","href","document","origin","error","console","warn","scoreList","compileScoreList","length","winnerPair","main","isActiveOverride","sub","filter","nav","isActive","map","Object","assign","flyout","linkList","link","hadAnyActiveLink","forEach","mainNav","score","compareRoutes","url","Infinity","push","_a","linklist","sort","a","b","baseUrl","matchMode","pathname","baseSegments","split","x","compareSegments","getSimilarityScore","Math","min","i","request","osFlyoutCache","getLocalizedConfig","async","projectId","environment","language","cookieKey","localStorageKey","localizedCustomConfig","osFlyoutOverrides","fetchConfig","lang","getUserLang","keys","undefined","Error","localizedConfig","header","navMain","mergeOsFlyoutOverrides","setMainNavigationIds","_b","persistLanguageChoice","id","JSON","parse","stringify","mainNavText","text","mainNavTitle","title","mainNavFlyout","col","index","overrides","slice","isValidProjectId","generateConfigUrl","res","fetch","json","message","parsedEnvironment","toLowerCase","isInt","startsWith","host","encodeURIComponent","toString","test","getLocalizedCustomConfig","customConfig","navMainEntities","navMainEntity","uniqueId","postInternetHeaderCss","PostInternetHeader","state","currentLanguage","constructor","hostRef","this","lastScrollTop","scrollY","documentElement","scrollTop","lastWindowWidth","innerWidth","handleClickOutsideBound","handleClickOutside","bind","project","connectedCallback","throttledScroll","throttle","handleScrollEvent","debouncedResize","debounce","handleResize","addEventListener","passive","disconnectedCallback","removeEventListener","dispose","languageSwitchOverrides","languageCookieKey","languageLocalStorageKey","activeRoute","componentDidLoad","requestAnimationFrame","headerLoaded","emit","classList","add","newValue","handleAvailableLanguagesChage","handleSearchChange","search","handleLoginChange","login","handleMetaChange","meta","handleLanguageChangeEvent","event","handleLanguageChange","detail","activeDropdownElement","composedPath","includes","toggleDropdown","handleKeyUp","key","activeFlyout","st","stickyness","toggle","isMainNavOpen","handleDropdownToggled","open","element","setTimeout","setActiveFlyout","handleFlyoutToggled","toggleMobileDropdown","tagName","render","renderMetaNavigation","navMeta","isHomeLink","renderLogin","_c","isLoginWidgetHidden","loginWidgetOptions","renderLanguageSwitch","navLang","h","Host","class","packageJson","version","onKeyup","e","fullWidth","SvgSprite","If","condition","skiplinks","orientation","mode","onDropdownToggled","onClick","mobileMenu","SvgIcon","name","onFlyoutToggled","ref","el"],"sources":["./src/services/route.service.ts","./src/services/config.service.ts","./src/components/post-internet-header/post-internet-header.scss?tag=swisspost-internet-header&encapsulation=shadow","./src/components/post-internet-header/post-internet-header.tsx"],"sourcesContent":["import { ActiveRouteProp } from '../models/general.model';\nimport { NavMainEntity, MainNavScoreList } from '../models/header.model';\n\n/**\n * Activate the current route based on the config and the match mode\n * @param config Main Navigation Config\n * @param activeRouteProp Match mode\n * @returns Modified Main Navigation Config\n */\nexport const markActiveRoute = (\n config: NavMainEntity[],\n activeRouteProp: ActiveRouteProp,\n): NavMainEntity[] => {\n // Don't highlight any route\n if (activeRouteProp === false) {\n return config;\n }\n\n // Set compare URL and check if activeRouteProp is valid\n let compareUrl: URL;\n config = resetOverrideConfig(config);\n\n if (activeRouteProp === 'auto' || activeRouteProp === 'exact') {\n // Check if an active route is already configured, set override to that and return\n if (hasActivePortalRoute(config)) {\n return resetActiveStateToPortalConfig(config);\n }\n\n compareUrl = new URL(window.location.href);\n } else {\n try {\n compareUrl = new URL(activeRouteProp, document.location.origin);\n } catch (error) {\n console.warn(\n `Active Route: ${activeRouteProp} is not a valid URL. Navigation highlighting has been disabled.`,\n );\n return config;\n }\n }\n\n const scoreList = compileScoreList(config, compareUrl, activeRouteProp);\n\n if (scoreList.length === 0) {\n // No match found or already active links defined\n return config;\n }\n\n const winnerPair = scoreList[0];\n winnerPair.main.isActiveOverride = true;\n if (winnerPair.sub) winnerPair.sub.isActiveOverride = true;\n\n return config;\n};\n\n/**\n * Check if the portal config set any active route\n * @param config Main navigation config\n * @returns True if portal set any route as active\n */\nexport const hasActivePortalRoute = (config: NavMainEntity[]): boolean => {\n return config.filter(nav => nav.isActive).length > 0;\n};\n\nexport const resetActiveStateToPortalConfig = (config: NavMainEntity[]): NavMainEntity[] => {\n return config.map(nav => ({\n ...nav,\n isActiveOverride: nav.isActive,\n flyout: nav.flyout.map(flyout => ({\n ...flyout,\n linkList: flyout.linkList.map(link => ({ ...link, isActiveOverride: link.isActive })),\n })),\n }));\n};\n\nconst resetOverrideConfig = (config: NavMainEntity[]): NavMainEntity[] => {\n return config.map(nav => ({\n ...nav,\n isActiveOverride: false,\n flyout: nav.flyout.map(flyout => ({\n ...flyout,\n linkList: flyout.linkList.map(link => ({ ...link, isActiveOverride: false })),\n })),\n }));\n};\n\n/**\n * Compile a list of scores based on the map mode, sorted in descending order\n * @param config Main Nav Config\n * @param compareUrl Current Browser URL or a custom URL\n * @param activeRouteProp Match mode\n * @returns A list of scored URLs if any matched\n */\nexport const compileScoreList = (\n config: NavMainEntity[],\n compareUrl: URL,\n activeRouteProp: ActiveRouteProp,\n): MainNavScoreList => {\n // Flag to check if the Portal set any active links or if there are any exact matches\n let hadAnyActiveLink = false;\n const scoreList: MainNavScoreList = [];\n\n config.forEach(mainNav => {\n if (hadAnyActiveLink || !mainNav) {\n return;\n }\n\n try {\n const score = compareRoutes(\n compareUrl,\n new URL(mainNav.url),\n activeRouteProp as 'auto' | 'exact',\n );\n if (score > 0) {\n if (score === Infinity) hadAnyActiveLink = true;\n scoreList.push({ main: mainNav, score });\n }\n } catch {\n // Not a valid url, continue\n }\n\n // Loop through flyout links 2nd level\n if (mainNav.flyout.length) {\n mainNav.flyout.forEach(flyout => {\n if (flyout.linkList) {\n flyout.linkList.forEach(linklist => {\n // Don't override if any link is already active\n if (linklist.isActive && (activeRouteProp === 'auto' || activeRouteProp === 'exact')) {\n hadAnyActiveLink = true;\n return;\n }\n\n try {\n const url = new URL(linklist.url);\n const score = compareRoutes(compareUrl, url, activeRouteProp as 'auto' | 'exact');\n if (score > 0) {\n if (score === Infinity) hadAnyActiveLink = true;\n\n // Push score\n scoreList.push({\n main: mainNav,\n sub: linklist,\n score,\n });\n }\n } catch {\n // Not a valid URL, continue\n }\n });\n }\n });\n }\n });\n\n return scoreList.sort((a, b) => b.score - a.score);\n};\n\n/**\n * Compare two URLs for similarity based on a match mode\n * @param baseUrl Browser URL\n * @param compareUrl Navigatgion URL\n * @param matchMode exact or auto matching\n * @returns Score\n */\nexport const compareRoutes = (\n baseUrl: URL,\n compareUrl: URL,\n matchMode?: 'auto' | 'exact',\n): number => {\n // One url is not defined or they don't share the same orign\n if (!baseUrl || !compareUrl || baseUrl.origin !== compareUrl.origin) {\n return 0;\n }\n\n // Exact match, origin and pathname are the same\n if (baseUrl.pathname === compareUrl.pathname) {\n return Infinity;\n }\n\n // The basepath is longer than the comparison, a match is impossible\n if (baseUrl.pathname.length < compareUrl.pathname.length) {\n return 0;\n }\n\n if (matchMode === 'auto') {\n const baseSegments = [baseUrl.origin, ...baseUrl.pathname.split('/').filter(x => !!x)];\n const compareSegments = [compareUrl.origin, ...compareUrl.pathname.split('/').filter(x => !!x)];\n\n const score = getSimilarityScore(baseSegments, compareSegments);\n\n // If only some segments match, but not the whole smaller array, it's not a match\n return Math.min(baseSegments.length, compareSegments.length) === score ? score : 0;\n }\n\n return 0;\n};\n\n/**\n * Check how many items in an array match\n * @param a Base array\n * @param b Compare array\n * @returns Score\n */\nexport const getSimilarityScore = (a: string[], b: string[]): number => {\n if (!a?.length || !b?.length) {\n return 0;\n }\n\n let i = 0;\n for (; i < Math.min(a.length, b.length); i++) {\n if (a[i] !== b[i]) {\n return 0;\n }\n }\n\n return i;\n};\n","import {\n Environment,\n IPortalConfig,\n ILocalizedConfig,\n ICustomConfig,\n ILocalizedCustomConfig,\n LocalizedConfigParameters,\n} from '../models/general.model';\nimport { NavMainEntity } from '../models/header.model';\nimport { getUserLang, persistLanguageChoice } from './language.service';\nimport { uniqueId } from '../utils/utils';\nimport { markActiveRoute } from './route.service';\n\n// Prevent double requests\nlet request: Promise<IPortalConfig> | null = null;\n\n// Cache the original os flyout to use it for updates\nlet osFlyoutCache: NavMainEntity | null = null;\n\n/**\n * Get a localized config object\n *\n * @param projectId String identifying the project\n * @param language [optional] Preferred language\n * @returns Localized config object\n */\nexport const getLocalizedConfig = async ({\n projectId,\n environment,\n language,\n cookieKey,\n localStorageKey,\n activeRouteProp,\n localizedCustomConfig,\n osFlyoutOverrides,\n}: LocalizedConfigParameters): Promise<ILocalizedConfig> => {\n if (!request) {\n request = fetchConfig(projectId, environment);\n }\n\n const config = await request;\n const lang = getUserLang(Object.keys(config), language, localStorageKey, cookieKey);\n\n if (lang === undefined) {\n throw new Error('Internet Header: unable to determine current language');\n }\n\n // Clone config for more predictable state updates\n let localizedConfig: ILocalizedConfig = { ...config[lang] };\n\n // Merge custom config with portal config\n if (localizedCustomConfig) {\n const header = localizedCustomConfig?.header?.navMain\n ? {\n ...localizedConfig.header,\n navMain: [...localizedConfig.header.navMain, ...localizedCustomConfig.header.navMain],\n }\n : localizedConfig.header;\n localizedConfig = {\n ...localizedConfig,\n header,\n };\n }\n\n // Add entries to flyout_os\n if (osFlyoutOverrides)\n localizedConfig.header.navMain = mergeOsFlyoutOverrides(localizedConfig, osFlyoutOverrides);\n\n // Mark active route\n if (activeRouteProp)\n localizedConfig.header.navMain = markActiveRoute(\n localizedConfig.header.navMain,\n activeRouteProp,\n );\n\n setMainNavigationIds(localizedConfig?.header?.navMain);\n\n // Set the new language choice\n persistLanguageChoice(lang, cookieKey, localStorageKey);\n\n return localizedConfig;\n};\n\n/**\n * Merge portal config with custom os flyout overrides\n * @param config Localized config\n * @param osFlyoutOverrides Overrides for the flyout\n * @returns Merged localized config\n */\nexport const mergeOsFlyoutOverrides = (\n config: ILocalizedConfig,\n osFlyoutOverrides: NavMainEntity,\n): NavMainEntity[] => {\n if (!osFlyoutOverrides) return config.header.navMain;\n\n return config.header.navMain.map(mainNav => {\n if (mainNav.id !== 'flyout_os') return mainNav;\n\n if (osFlyoutCache === null) {\n osFlyoutCache = JSON.parse(JSON.stringify(mainNav)) as NavMainEntity;\n }\n\n const mainNavText = osFlyoutOverrides.text ?? osFlyoutCache.text;\n const mainNavTitle = osFlyoutOverrides.title ?? osFlyoutCache.title;\n\n if (\n !osFlyoutCache.flyout ||\n osFlyoutCache.flyout.length === 0 ||\n !osFlyoutOverrides.flyout ||\n osFlyoutOverrides.flyout.length === 0\n )\n return {\n ...mainNav,\n title: mainNavTitle,\n text: mainNavText,\n };\n\n // Add entries for os flyout columns without overriding existing config\n const mainNavFlyout = [\n ...osFlyoutCache.flyout.map((col, index) => {\n const overrides = osFlyoutOverrides.flyout[index];\n const title = overrides.title ?? col.title;\n\n const linkList = overrides.linkList ? osFlyoutOverrides.flyout[index].linkList : [];\n\n return {\n title,\n linkList: [...col.linkList, ...linkList],\n };\n }),\n ...osFlyoutOverrides.flyout.slice(osFlyoutCache.flyout.length),\n ];\n\n return {\n ...mainNav,\n text: mainNavText,\n title: mainNavTitle,\n flyout: mainNavFlyout,\n } as NavMainEntity;\n });\n};\n\n/**\n * Fetch the general config based on project id\n *\n * @returns Promise for Post Portal general config\n */\nexport const fetchConfig = async (\n projectId: string,\n environment: Environment,\n): Promise<IPortalConfig> => {\n // Check if project id is sanitized\n if (!isValidProjectId(projectId)) {\n throw new Error(`Internet Header: invalid project id \"${projectId}\"`);\n }\n\n if (projectId === 'test') {\n environment = 'int01';\n }\n\n let url = generateConfigUrl(projectId, environment);\n\n // Get the config if cache is invalid\n try {\n const res = await fetch(url);\n return (await res.json()) as IPortalConfig;\n } catch (error) {\n throw new Error(`Internet Header: fetching config failed. ${error.message}`);\n }\n};\n\n/**\n * Generate an URL with all necessary query params to get the configuration.\n * Project id \"test\" will return a test configuration\n * @param projectId string\n * @param environment int01, int02 or prod\n * @returns URL pointing to the project config\n */\nexport const generateConfigUrl = (projectId: string, environment: Environment): string => {\n if (projectId === 'test') return 'assets/config/test-configuration.json';\n\n const parsedEnvironment = environment.toLowerCase();\n const isInt = parsedEnvironment.startsWith('int');\n const host = `https://${isInt ? 'int' : 'www'}.post.ch`;\n try {\n // Use URL to validate the generated URL\n return new URL(\n `${host}/api/headerjs/Json?serviceid=${encodeURIComponent(projectId)}${\n isInt ? '&environment=' + parsedEnvironment : ''\n }`,\n ).toString();\n } catch (error) {\n throw new Error(`Internet Header: Config URL is invalid.`);\n }\n};\n\n/**\n * Check if project id contains only URL safe characters\n *\n * @param projectId Project Id string\n * @returns The valid project id\n */\nexport const isValidProjectId = (projectId: string): boolean => {\n return projectId !== '' && projectId.length > 0 && /^[a-zA-Z][\\w-]*[a-zA-Z0-9]$/.test(projectId);\n};\n\n/**\n * Get the localized config object from a custom config\n *\n * @param config String or json object of the custom config\n * @param language Specific language\n * @returns Localized custom config object\n */\nexport const getLocalizedCustomConfig = (\n config: string | ICustomConfig,\n language: string,\n): ILocalizedCustomConfig | undefined => {\n let customConfig: ICustomConfig;\n try {\n customConfig = typeof config === 'string' ? JSON.parse(config) : config;\n } catch (error) {\n throw new Error(\n `Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. `,\n );\n }\n let localizedCustomConfig: ILocalizedCustomConfig | undefined = customConfig[language];\n if (localizedCustomConfig?.header?.navMain)\n setMainNavigationIds(localizedCustomConfig.header.navMain);\n return localizedCustomConfig;\n};\n\n/**\n * Check if mobile header styles are applied or not\n * @returns True if browser is smaller than 1024px\n */\nexport const isMobile = () => window.innerWidth < 1024;\n\n/**\n * Set unique ID's on main navigation entities but conserve flyout_os to be able to\n * identify the online-service flyout, which can be configured by osFlyoutOverrides\n */\nexport const setMainNavigationIds = (navMainEntities: NavMainEntity[]): void => {\n navMainEntities.forEach(navMainEntity => {\n navMainEntity.id = navMainEntity.id === 'flyout_os' ? navMainEntity.id : uniqueId('main-nav-');\n });\n};\n","@use '@swisspost/design-system-styles/variables/color';\n@use '../../utils/utils.scss';\n@use '../../utils/mixins.scss';\n\n:host {\n display: block;\n position: relative;\n font-size: 1rem;\n font-weight: 300;\n z-index: var(--header-z-index, 10);\n\n --header-height: 3.5rem; // 56px\n --meta-header-height: 0px; // Not visible on mobile\n --language-dropdown-margin-top: 0px;\n\n @include mixins.min(lg) {\n --meta-header-height: 3rem; // 48px\n --header-height: 4rem; // 64px\n }\n\n @include mixins.min(xl) {\n --header-height: 4.5rem; // 72px\n }\n}\n\n// Set height to 0 if meta is never visible\n:host([meta='false']) {\n --meta-header-height: 0px;\n // Compensation for header border-bottom, when language dropdown is displayed within main navigation controls\n --language-dropdown-margin-top: 1px;\n}\n\n// Support different kinds of stickyness modes\n// Works only in combination with setting header heights dynamically\n@supports (position: sticky) {\n // If stickyness is none, simply apply no styles, all others are sticky\n :host(:not(.stickyness-none)) {\n position: sticky;\n }\n\n // Everything is always sticky\n :host(.stickyness-full) {\n top: 0;\n }\n\n // Only main nav is sticky\n :host(.stickyness-main) {\n top: calc(var(--meta-header-height, 0px) * -1);\n }\n\n // Hide everything\n :host(.stickyness-minimal) {\n top: calc((var(--header-height, 0px) + var(--meta-header-height, 0px)) * -1);\n transition: top 200ms ease-in;\n }\n\n // Show main when scrolling up or any of the menus are open\n :host(.stickyness-minimal.scrolling-up),\n :host(.stickyness-minimal.dropdown-open) {\n top: calc(var(--meta-header-height, 0px) * -1);\n transition: top 200ms ease-out;\n }\n}\n\n.post-internet-header {\n border-bottom: 1px solid color.$gray-10;\n background-color: white;\n}\n\n.main-navigation-container {\n display: flex;\n\n & > .main-navigation-controls {\n flex: 0 0 auto;\n }\n}\n\n.main-navigation {\n display: flex;\n}\n\n.sub-navigation-container {\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n display: flex;\n background: white;\n visibility: hidden;\n}\n\n.main-navigation-item:hover .sub-navigation-container {\n visibility: visible;\n}\n\n.main-navigation-controls {\n display: flex;\n margin-left: auto;\n\n @include mixins.max(lg) {\n font-weight: 400;\n }\n\n @include mixins.min(lg) {\n font-size: 1.0625rem;\n }\n\n & > * {\n border-left: 1px solid color.$gray-10;\n }\n}\n\n.menu-button {\n display: flex;\n align-items: center;\n padding: 0 calc(1rem - 1px);\n font-weight: 300;\n cursor: pointer;\n border-left: 1px solid color.$gray-10;\n order: 1; /* Display on the far right because of tab order */\n\n @include mixins.min(lg) {\n display: none;\n }\n\n .visually-hidden {\n @include mixins.between(rg, lg) {\n @include mixins.reset-visually-hidden();\n\n margin-right: 0.5rem;\n }\n }\n\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n}\n\n.full-width {\n .wide-container {\n max-width: none;\n }\n}\n","import {\n Component,\n Host,\n Element,\n h,\n State,\n Prop,\n Watch,\n Listen,\n EventEmitter,\n Event,\n Method,\n} from '@stencil/core';\nimport { debounce, throttle } from 'throttle-debounce';\nimport {\n getLocalizedConfig,\n getLocalizedCustomConfig,\n isValidProjectId,\n} from '../../services/config.service';\nimport { state, dispose } from '../../data/store';\nimport { DropdownElement, DropdownEvent, NavMainEntity } from '../../models/header.model';\nimport { SvgSprite } from '../../utils/svg-sprite.component';\nimport { SvgIcon } from '../../utils/svg-icon.component';\nimport { StickynessOptions } from '../../models/implementor.model';\nimport { ActiveRouteProp, Environment, ICustomConfig } from '../../models/general.model';\nimport { IAvailableLanguage } from '../../models/language.model';\nimport { If } from '../../utils/if.component';\nimport packageJson from '../../../package.json';\n\n@Component({\n tag: 'swisspost-internet-header',\n styleUrl: 'post-internet-header.scss',\n shadow: true,\n})\nexport class PostInternetHeader {\n /**\n * Your project id, previously passed as query string parameter serviceId.\n */\n @Prop() project: string;\n\n /**\n * Sticky behaviour of the header.\n */\n @Prop() stickyness: StickynessOptions = 'minimal';\n\n /**\n * Initial language to be used. Overrides automatic language detection.\n */\n @Prop() language?: string;\n\n /**\n * Toggle the meta navigation.\n */\n @Prop() meta: boolean = true;\n\n /**\n * Toggle the login link (when logged out) or the user widget (when logged in).\n */\n @Prop() login: boolean = true;\n\n /**\n * Toggle the search button.\n */\n @Prop() search: boolean = true;\n\n /**\n * Toggle skiplinks. They help keyboard users to quickly jump to important sections of the page.\n */\n @Prop() skiplinks: boolean = true;\n\n /**\n * DEPRECATED!: Define a proxy URL for the config fetch request. Will be removed in the next major version\n */\n @Prop() configProxy?: string;\n\n /**\n * Target environment. Choose 'int01' for local testing.\n */\n @Prop() environment: Environment = 'prod';\n\n /**\n * Override the language switch links with custom URLs. Helpful when your application contains sub-pages and you\n * would like to stay on subpages when the user changes language.\n */\n @Prop() languageSwitchOverrides?: string | IAvailableLanguage[];\n\n /**\n * Customize the header config loaded from the post portal.\n */\n @Prop() customConfig?: string | ICustomConfig;\n\n /**\n * The header uses this cookie to set the language. Disables automatic language detection.\n */\n @Prop() languageCookieKey?: string;\n\n /**\n * The header uses this local storage key to set the language. Disables automatic language selection.\n */\n @Prop() languageLocalStorageKey?: string = 'swisspost-internet-header-language';\n\n /**\n * Set the currently activated route. If there is a link matching this URL in the header, it will be highlighted.\n * Will also highlight partly matching URLs. When set to auto, will use current location.href for comparison.\n */\n @Prop() activeRoute?: 'auto' | false | string = 'auto';\n\n /**\n * Online Services only: Add custom links to the special online service navigation entry\n */\n @Prop() osFlyoutOverrides?: string | NavMainEntity;\n\n /**\n * Displays the header at full width for full-screen applications\n */\n @Prop() fullWidth?: boolean = false;\n\n /**\n * Fires when the header has been rendered to the page.\n */\n @Event() headerLoaded: EventEmitter<void>;\n\n @State() activeFlyout: string | null = null;\n @State() activeDropdownElement: DropdownElement | null = null;\n @Element() host: HTMLElement;\n\n /**\n * Get the currently set language as a two letter string (\"de\", \"fr\" \"it\" or \"en\")\n * @returns string\n */\n @Method()\n async getCurrentLanguage(): Promise<'de' | 'fr' | 'it' | 'en' | string> {\n return state.currentLanguage ?? 'de';\n }\n\n private mainNav?: HTMLPostMainNavigationElement;\n private lastScrollTop = window.scrollY || document.documentElement.scrollTop;\n private throttledScroll: throttle<() => void>;\n private debouncedResize: debounce<() => void>;\n private lastWindowWidth: number = window.innerWidth;\n\n constructor() {\n if (this.project === undefined || this.project === '' || !isValidProjectId(this.project)) {\n throw new Error(\n `Internet Header project key is \"${this.project}\". Please provide a valid project key.`,\n );\n }\n }\n\n connectedCallback() {\n this.throttledScroll = throttle(300, () => this.handleScrollEvent());\n this.debouncedResize = debounce(200, () => this.handleResize());\n window.addEventListener('scroll', this.throttledScroll, { passive: true });\n window.addEventListener('resize', this.debouncedResize, { passive: true });\n }\n\n disconnectedCallback() {\n window.removeEventListener('scroll', this.throttledScroll);\n window.removeEventListener('resize', this.debouncedResize);\n\n // Reset the store to its original state\n dispose();\n }\n\n async componentWillLoad() {\n // Wait for the config to arrive, then render the header\n try {\n state.projectId = this.project;\n state.environment = this.environment;\n if (this.language !== undefined) state.currentLanguage = this.language;\n state.languageSwitchOverrides =\n typeof this.languageSwitchOverrides === 'string'\n ? JSON.parse(this.languageSwitchOverrides)\n : this.languageSwitchOverrides;\n state.osFlyoutOverrides =\n typeof this.osFlyoutOverrides === 'string'\n ? JSON.parse(this.osFlyoutOverrides)\n : this.osFlyoutOverrides;\n\n if (this.customConfig !== undefined && state.currentLanguage !== null) {\n state.localizedCustomConfig = getLocalizedCustomConfig(\n this.customConfig,\n state.currentLanguage,\n );\n }\n\n state.localizedConfig = await getLocalizedConfig({\n projectId: this.project,\n environment: this.environment,\n language: this.language,\n cookieKey: this.languageCookieKey,\n localStorageKey: this.languageLocalStorageKey,\n activeRouteProp: this.activeRoute,\n localizedCustomConfig: state.localizedCustomConfig,\n osFlyoutOverrides: state.osFlyoutOverrides,\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n componentDidLoad() {\n window.requestAnimationFrame(() => {\n this.handleResize();\n this.headerLoaded.emit();\n this.host.classList.add('header-loaded');\n });\n }\n\n @Watch('language')\n async handleLanguageChange(newValue: string) {\n state.currentLanguage = newValue;\n state.localizedConfig = await getLocalizedConfig({\n projectId: this.project,\n environment: this.environment,\n language: newValue,\n cookieKey: this.languageCookieKey,\n localStorageKey: this.languageLocalStorageKey,\n activeRouteProp: this.activeRoute,\n localizedCustomConfig: state.localizedCustomConfig,\n osFlyoutOverrides: state.osFlyoutOverrides,\n });\n if (this.customConfig)\n state.localizedCustomConfig = getLocalizedCustomConfig(this.customConfig, newValue);\n }\n\n @Watch('languageSwitchOverrides')\n handleAvailableLanguagesChage(newValue: string | IAvailableLanguage[]) {\n state.languageSwitchOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;\n }\n\n @Watch('osFlyoutOverrides')\n async handleOsFlyoutOverrides(newValue: string | NavMainEntity) {\n state.osFlyoutOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;\n state.localizedConfig = await getLocalizedConfig({\n projectId: this.project,\n environment: this.environment,\n language: this.language,\n cookieKey: this.languageCookieKey,\n localStorageKey: this.languageLocalStorageKey,\n activeRouteProp: this.activeRoute,\n localizedCustomConfig: state.localizedCustomConfig,\n osFlyoutOverrides: state.osFlyoutOverrides,\n });\n }\n\n @Watch('activeRoute')\n async handleActiveRouteChange(newValue: string | ActiveRouteProp) {\n state.localizedConfig = await getLocalizedConfig({\n projectId: this.project,\n environment: this.environment,\n language: this.language,\n cookieKey: this.languageCookieKey,\n localStorageKey: this.languageLocalStorageKey,\n activeRouteProp: newValue,\n localizedCustomConfig: state.localizedCustomConfig,\n osFlyoutOverrides: state.osFlyoutOverrides,\n });\n }\n\n @Watch('customConfig')\n async handleCustomConfigChange(newValue: string | ICustomConfig) {\n if (this.language === undefined) return;\n const localizedCustomConfig = getLocalizedCustomConfig(newValue, this.language);\n state.localizedCustomConfig = localizedCustomConfig;\n state.localizedConfig = await getLocalizedConfig({\n projectId: this.project,\n environment: this.environment,\n language: this.language,\n cookieKey: this.languageCookieKey,\n localStorageKey: this.languageLocalStorageKey,\n activeRouteProp: this.activeRoute,\n localizedCustomConfig: localizedCustomConfig,\n osFlyoutOverrides: state.osFlyoutOverrides,\n });\n }\n\n @Watch('search')\n handleSearchChange(newValue: boolean) {\n state.search = newValue;\n }\n\n @Watch('login')\n handleLoginChange(newValue: boolean) {\n state.login = newValue;\n }\n\n @Watch('meta')\n handleMetaChange(newValue: boolean) {\n state.meta = newValue;\n }\n\n @Listen('languageChanged')\n handleLanguageChangeEvent(event: CustomEvent<string>) {\n this.handleLanguageChange(event.detail);\n }\n\n private handleClickOutsideBound = this.handleClickOutside.bind(this);\n\n private handleClickOutside(event: Event) {\n // Close active dropdown element on click outside of it\n if (this.activeDropdownElement && !event.composedPath().includes(this.activeDropdownElement)) {\n this.activeDropdownElement.toggleDropdown(false);\n }\n }\n\n private handleKeyUp(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n if (this.activeDropdownElement) {\n this.activeDropdownElement.toggleDropdown(false);\n }\n if (this.activeFlyout !== null && this.mainNav) {\n this.mainNav.toggleDropdown(false);\n }\n }\n }\n\n private handleScrollEvent() {\n // Credits: \"https://github.com/qeremy/so/blob/master/so.dom.js#L426\"\n const st = window.scrollY || document.documentElement.scrollTop;\n\n // Toggle class without re-rendering the component if stickyness is minimal\n // the other stickyness modes do not need the class\n if (this.stickyness === 'minimal') {\n this.host.classList.toggle('scrolling-up', st <= this.lastScrollTop);\n }\n\n // For Mobile or negative scrolling\n this.lastScrollTop = st <= 0 ? 0 : st;\n }\n\n private handleResize() {\n // Close main navigation dropdown if size changed to bigger than 1024px (search dropdown will be kept open)\n if (this.isMainNavOpen() && this.lastWindowWidth < 1024 && window.innerWidth >= 1024) {\n this.activeDropdownElement?.toggleDropdown(false);\n }\n\n this.lastWindowWidth = window.innerWidth;\n }\n\n /**\n * Close open dropdown menus if another is being opened\n *\n * @param event Dropdown toggled event\n * @returns void\n */\n private handleDropdownToggled(event: CustomEvent<DropdownEvent>) {\n if (!event.detail.open && this.activeDropdownElement !== event.detail.element) {\n // Some dropdown got closed programmatically (possibly by this function). To prevent\n // a circle or an outdated state, we'll not handle this event\n return;\n }\n\n if (event.detail.open === true) {\n if (this.activeDropdownElement) {\n this.activeDropdownElement.toggleDropdown(false);\n }\n\n this.activeDropdownElement = event.detail.element;\n\n if (window.innerWidth >= 1024) {\n // Add event listener to close active dropdown element on click outsite of it\n // Also adds 10ms delay in case of an external interaction:\n // Some button on the page calls toggleDropdown() -> dropdown opens\n // Click event bubbles to the window, this.handleClickOutsideBound closes dropdown again\n window.setTimeout(() => {\n window.addEventListener('click', this.handleClickOutsideBound);\n }, 10);\n }\n\n if (this.activeFlyout !== null && this.mainNav) {\n this.mainNav.setActiveFlyout(null);\n }\n } else {\n this.activeDropdownElement = null;\n\n // Remove event listener as it is not needed if no dropdown element is active\n window.removeEventListener('click', this.handleClickOutsideBound);\n }\n }\n\n /**\n * Close open dropdowns if the flyout is being opened\n * @param event Flyout toggle event\n */\n private handleFlyoutToggled(event: CustomEvent<string | null>) {\n this.activeFlyout = event.detail;\n\n if (this.activeDropdownElement && event.detail && !this.isMainNavOpen()) {\n this.activeDropdownElement.toggleDropdown(false);\n }\n }\n\n private toggleMobileDropdown() {\n this.mainNav?.toggleDropdown();\n }\n\n private isMainNavOpen() {\n return (\n this.activeDropdownElement && this.activeDropdownElement.tagName === 'POST-MAIN-NAVIGATION'\n );\n }\n\n render() {\n if (!state.localizedConfig?.header) {\n console.error(new Error('Internet Header: Config cannot be loaded'));\n return;\n }\n\n const config = state.localizedConfig;\n const renderMetaNavigation =\n this.meta &&\n config.header.navMeta !== undefined &&\n config.header.navMeta?.filter(meta => !meta.isHomeLink).length > 0;\n const renderLogin =\n (this.login ?? !config.header.isLoginWidgetHidden) && config.header.loginWidgetOptions;\n const renderLanguageSwitch = config.header.navLang.length > 1;\n\n return (\n <Host\n class={`stickyness-${this.stickyness} ${\n this.activeDropdownElement || this.activeFlyout ? 'dropdown-open' : ''\n }`}\n data-version={packageJson.version}\n onKeyup={(e: KeyboardEvent) => this.handleKeyUp(e)}\n >\n <header class={`post-internet-header${this.fullWidth ? ' full-width' : ''}`}>\n <SvgSprite />\n <If condition={this.skiplinks === true}>\n <post-skiplinks></post-skiplinks>\n </If>\n <If condition={renderMetaNavigation === true}>\n <post-meta-navigation\n orientation=\"horizontal\"\n class=\"hidden-lg\"\n full-width={this.fullWidth}\n >\n <If condition={renderLanguageSwitch === true}>\n <post-language-switch\n id=\"post-language-switch-desktop\"\n mode=\"dropdown\"\n onDropdownToggled={e => this.handleDropdownToggled(e)}\n ></post-language-switch>\n </If>\n </post-meta-navigation>\n </If>\n <div class=\"main-navigation-container wide-container\">\n <post-logo></post-logo>\n <button class=\"menu-button nav-link\" onClick={() => this.toggleMobileDropdown()}>\n <span class=\"menu-button-text visually-hidden\">{config.header.mobileMenu.text}</span>\n <SvgIcon name={this.isMainNavOpen() ? 'pi-close' : 'pi-menu'}></SvgIcon>\n </button>\n <post-main-navigation\n onDropdownToggled={e => this.handleDropdownToggled(e)}\n onFlyoutToggled={e => this.handleFlyoutToggled(e)}\n ref={el => (this.mainNav = el)}\n >\n <If condition={renderMetaNavigation === true}>\n <post-meta-navigation orientation=\"vertical\">\n <If condition={renderLanguageSwitch === true}>\n <post-language-switch\n id=\"post-language-switch-mobile\"\n mode=\"list\"\n ></post-language-switch>\n </If>\n </post-meta-navigation>\n </If>\n </post-main-navigation>\n <div class=\"main-navigation-controls\">\n <If condition={this.search !== false}>\n <post-search onDropdownToggled={e => this.handleDropdownToggled(e)}></post-search>\n </If>\n <If condition={!!renderLogin}>\n <post-klp-login-widget>\n <slot name=\"login-widget\"></slot>\n </post-klp-login-widget>\n </If>\n <If condition={renderMetaNavigation === false && renderLanguageSwitch === true}>\n <post-language-switch\n id=\"post-language-switch-no-meta\"\n onDropdownToggled={e => this.handleDropdownToggled(e)}\n mode=\"dropdown\"\n ></post-language-switch>\n </If>\n <slot name=\"main\"></slot>\n </div>\n </div>\n </header>\n </Host>\n );\n }\n}\n"],"mappings":"iVASO,MAAMA,EAAkB,CAC7BC,EACAC,KAGA,GAAIA,IAAoB,MAAO,CAC7B,OAAOD,C,CAIT,IAAIE,EACJF,EAASG,EAAoBH,GAE7B,GAAIC,IAAoB,QAAUA,IAAoB,QAAS,CAE7D,GAAIG,EAAqBJ,GAAS,CAChC,OAAOK,EAA+BL,E,CAGxCE,EAAa,IAAII,IAAIC,OAAOC,SAASC,K,KAChC,CACL,IACEP,EAAa,IAAII,IAAIL,EAAiBS,SAASF,SAASG,O,CACxD,MAAOC,GACPC,QAAQC,KACN,iBAAiBb,oEAEnB,OAAOD,C,EAIX,MAAMe,EAAYC,EAAiBhB,EAAQE,EAAYD,GAEvD,GAAIc,EAAUE,SAAW,EAAG,CAE1B,OAAOjB,C,CAGT,MAAMkB,EAAaH,EAAU,GAC7BG,EAAWC,KAAKC,iBAAmB,KACnC,GAAIF,EAAWG,IAAKH,EAAWG,IAAID,iBAAmB,KAEtD,OAAOpB,CAAM,EAQR,MAAMI,EAAwBJ,GAC5BA,EAAOsB,QAAOC,GAAOA,EAAIC,WAAUP,OAAS,EAG9C,MAAMZ,EAAkCL,GACtCA,EAAOyB,KAAIF,GAAGG,OAAAC,OAAAD,OAAAC,OAAA,GAChBJ,GAAG,CACNH,iBAAkBG,EAAIC,SACtBI,OAAQL,EAAIK,OAAOH,KAAIG,GAAMF,OAAAC,OAAAD,OAAAC,OAAA,GACxBC,GAAM,CACTC,SAAUD,EAAOC,SAASJ,KAAIK,GAAIJ,OAAAC,OAAAD,OAAAC,OAAA,GAAUG,GAAI,CAAEV,iBAAkBU,EAAKN,qBAK/E,MAAMrB,EAAuBH,GACpBA,EAAOyB,KAAIF,GAAGG,OAAAC,OAAAD,OAAAC,OAAA,GAChBJ,G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