1import{d as e}from"./defineElement-Bh-rOTph.js";import"./GlobalStylesStore--z5tmrDj.js";import{T as t}from"./TemplateElement-u6hNeGmQ.js";import{d as i,e as s}from"./bodyScrollLock.es6-BLNflBSB.js";import{h as o}from"./html-BmWsKWcd.js";import"./StyledElement-Dmi2NcTH.js";class n extends t{#e=!1;activeLevel=null;activeContent=null;#t={1:{},2:{}};#i={1:null,2:null};#s={1:{},2:{}};constructor(){super({shadowRender:!0,styles:[":host{display:block;--main-navigation-header-height:var(--spacing-16,4rem);--main-navigation-content-min-height:calc(100vh - var(--main-navigation-header-height));--main-navigation-content-height:calc(100vh - var(--main-navigation-header-height))}.mobile-navigation{max-width:462px;left:auto}.mobile-navigation.is-open slot::slotted(.level-1){display:flex!important;flex-direction:column}.mobile-navigation.is-open slot[name='meta']::slotted(*){display:flex!important;flex-direction:column}slot[name='logo']::slotted(*){display:block!important;height:var(--spacing-12,3rem)!important;width:auto!important}.header-container{position:relative;position:sticky;top:var(--spacing-0,0px);left:var(--spacing-0,0px);right:var(--spacing-0,0px);width:100%;display:flex;align-items:center;justify-content:space-between;padding-left:var(--spacing-4,1rem);padding-right:var(--spacing-4,1rem);background-color:var(--main-navigation-header-background);height:var(--main-navigation-header-height)}.header-container:after{content:'';position:absolute;bottom:var(--spacing-0,0px);left:var(--spacing-4,1rem);right:var(--spacing-4,1rem);height:var(--spacing-px,1px);background-color:var(--colors-grey-100,#E5E5E5)}main{position:relative;overflow:hidden;height:calc(var(--main-navigation-content-height));min-height:var(--main-navigation-content-min-height)}.header-button{display:flex;height:var(--spacing-8,2rem);width:var(--spacing-8,2rem);flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;background-color:var(--colors-grey-100,#E5E5E5)}.header-button svg-icon{height:var(--spacing-4,1rem);width:var(--spacing-4,1rem)}.header-title{margin-left:var(--spacing-4,1rem);margin-right:var(--spacing-4,1rem);flex:1 1 0%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font-weight:700}.navigation-backdrop{position:fixed;inset:var(--spacing-0,0px);background:var(--theme-backdrop-color,black);opacity:var(--theme-backdrop-opacity,0.7)}"]})}get mediaQuery(){return`(max-width: ${this.maxWidth}px)`}properties(){return{open:!1,maxWidth:992,itemSelector:"[data-level-item]",contentSelector:"[data-level-content]"}}events(){return{"[ref=close]":{click:()=>{this.open=!1}},"[ref=back]":{click:()=>this.onLevelBack()},window:{touchmove:e=>{this.open&&1!==e.scale&&e.preventDefault()},resize:()=>this.setDesktopCssProperties()}}}connected(){const e=window.matchMedia(this.mediaQuery);this.onMediaChange(e.matches),e.addEventListener("change",(t=>{this.onMediaChange(e.matches)})),this.querySelectorAll(this.itemSelector).forEach((e=>{e.addEventListener("click",(t=>{const i=e.querySelector(this.contentSelector);i&&i.contains(t.target)||(t.stopPropagation(),this.onMobileLevelItem(e))}))})),this.setMouseEventListenersForLevel(1,".level-1-item"),this.setMouseEventListenersForLevel(2,".level-2-item.has-sub-menu"),this.setDesktopCssProperties()}basicMouseEnterListener(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;clearTimeout(this.#t[t]?.showSubmenuTimeout),clearTimeout(this.#t[t]?.activeTimer),clearTimeout(this.#t[t]?.resetTimer),this.#t[t].showSubmenuTimeout=setTimeout((()=>{this.showActiveSubMenuForLevel(t)}),300),this.#t[t].activeTimer=setTimeout((()=>{this.#i[t]=e}),100)}basicMouseLeaveListener(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;clearTimeout(this.#t[t]?.activeTimer),clearTimeout(this.#t[t]?.showSubmenuTimeout),this.#t[t].resetTimer=setTimeout((()=>{this.#i[t]=null,this.showActiveSubMenuForLevel(t)}),100)}setMouseEventListenersForLevel(e,t){this.#s[e]=[...this.querySelectorAll(t)].map((t=>(t.addEventListener("mouseenter",(t=>{const{currentTarget:i}=t;this.basicMouseEnterListener(i,e)})),t.addEventListener("mouseleave",(t=>{this.basicMouseLeaveListener(t.currentTarget,e)})),t)))}showActiveSubMenuForLevel(e){this.#s[e].forEach((t=>{const i=this.#i[e];if(t.classList.toggle("submenu-open",t===i),2===e){this.#i[1].classList.toggle("content-hidden",null!==i)}}))}onMobileLevelItem(e){this.activeLevel=e,this.activeContent=this.activeLevel?.querySelector(this.contentSelector)??null,this.activeLevel?([...e.parentNode.children].forEac
1h((t=>{t.classList.toggle("is-open",t===e)})),this.activeLevel.querySelectorAll(this.itemSelector).forEach((e=>{e.classList.remove("is-open")}))):this.querySelectorAll(".is-open").forEach((e=>e.classList.remove("is-open"))),this.setCssProperties(),this.requestUpdate()}onLevelBack(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.activeLevel?.parentNode.closest(this.itemSelector)??null;this.onMobileLevelItem(e?null:t)}onMediaChange(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#e=e,!e&&this.open&&(this.open=!1),this.requestUpdate()}setDesktopCssProperties(){this.querySelectorAll(`${this.itemSelector}.level-1-item.has-sub-menu`).forEach((e=>{let t=0;e.querySelectorAll(".link-list,.teaser-wrapper,.level-3-inset").forEach((e=>{const i=e.offsetHeight;i>t&&(t=i)})),e.style.setProperty("--min-flyout-height",`${t}px`)}))}setCssProperties(){const e=this.activeContent||this.$refs.measureContent;e&&this.style.setProperty("--main-navigation-content-height",`${e.offsetHeight}px`)}watch(){return{open:e=>{this.$refs.container&&(e?i(this.$refs.container):(s(this.$refs.container),this.onLevelBack(!0)),this.setCssProperties())}}}headerTemplate(){const e=this.activeLevel?.firstElementChild.textContent.trim()??"";return o` <header ref="header" part="header" class="header-container z-50"> 2 ${""!==e?o` 3 <button class="header-button" ref="back"> 4 <svg-icon name="arrow-left"></svg-icon> 5 </button> 6 <div class="header-title">${e}</div> 7 `:o` <slot name="logo"></slot>`} 8 <button class="header-button" ref="close"> 9 <svg-icon name="close"></svg-icon> 10 </button> 11 </header>`}template(){return this.#e?o` 12 <div class="${this.open?"navigation-backdrop":"hidden"}"></div> 13 <div 14 ref="container" 15 class="mobile-navigation overflow-y-scroll overflow-x-hidden fixed inset-0 h-screen w-screen bg-white 16 ${this.open?"block is-open z-50":"hidden"}" 17 > 18 ${this.headerTemplate()} 19 <main class="scrollable-content"> 20 <div ref="measureContent"> 21 <slot name="main"></slot> 22 <slot name="meta"></slot> 23 </div> 24 </main> 25 <div class="sticky bottom-0 left-0 right-0 h-1.5 bg-grey-200"></div> 26 </div> 27 `:o` <slot name="main"></slot>`}}e("main-navigation-app",n);export{n as default}; 28//# sourceMappingURL=main-navigation-app-BGPztejM.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.