import{proxyCustomElement,HTMLElement,forceUpdate,h,Host}from"@stencil/core/internal/client";import{d as defineCustomElement$5}from"./va-accordion2.js";import{d as defineCustomElement$4}from"./va-accordion-item2.js";import{d as defineCustomElement$3}from"./va-button-icon2.js";import{d as defineCustomElement$2}from"./va-icon2.js";const vaSidenavCss=":host{display:block}.va-sidenav__list{margin-bottom:0;margin-top:0;list-style-type:none;padding-left:0;font-size:var(--vads-font-size-source-sans-normalized);line-height:var(--vads-font-line-height-2);border-top:1px solid var(--vads-color-base-lighter)}.va-sidenav__header{-ms-flex-align:center;align-items:center;color:var(--vads-color-base);display:-ms-flexbox;display:flex;font-family:var(--font-serif);font-size:var(--font-size-h4);font-weight:var(--font-weight-bold);margin-bottom:12px;margin-top:0}.va-sidenav__header .va-sidenav__icon-background{font-size:24px}.va-sidenav__icon-background{color:var(--vads-color-white);border-radius:50%;width:40px;height:40px;margin-right:8px;position:relative}.va-sidenav__icon-background va-icon{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}va-accordion-item::part(accordion-header){padding-left:1.4rem}",VaSidenavStyle0=vaSidenavCss,MEDIUM_SCREEN_BREAKPOINT=768,VaSidenav$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.isDesktop=window.innerWidth>=768,this.iconBackgroundColorStyle=()=>({backgroundColor:`var(--${this.iconBackgroundColor})`}),this.header=void 0,this.mobileHeader="Related pages menu",this.navAriaLabel="Related pages menu",this.iconName=void 0,this.iconBackgroundColor="vads-color-primary"}handleResize(){this.isDesktop=window.innerWidth>=768,forceUpdate(this)}setOnlyOneCurrentPage(){this.el.querySelectorAll("va-sidenav-item[current-page], va-sidenav-submenu[current-page]").forEach((e,t)=>{t>0&&e.removeAttribute("current-page")})}setupCurrentPageObserver(){this.mutationObserver=new MutationObserver(e=>{const t=e.filter(e=>"attributes"===e.type&&"current-page"===e.attributeName);if(t.length>0){const e=t.find(e=>{const t=e.target.getAttribute("current-page");return null!==t&&"false"!==t});if(e){const t=e.target;this.el.querySelectorAll("va-sidenav-item[current-page], va-sidenav-submenu[current-page]").forEach(e=>{e!==t&&e.removeAttribute("current-page")})}}}),this.mutationObserver.observe(this.el,{attributes:!0,attributeFilter:["current-page"],subtree:!0})}componentWillLoad(){this.setOnlyOneCurrentPage()}componentDidLoad(){this.setupCurrentPageObserver()}disconnectedCallback(){this.mutationObserver&&this.mutationObserver.disconnect()}render(){return this.isDesktop?h(Host,null,h("nav",{"aria-label":this.navAriaLabel},this.header&&h("span",{class:"va-sidenav__header"},this.iconName?h("span",{class:"va-sidenav__icon-background",style:this.iconBackgroundColorStyle()},h("va-icon",{icon:this.iconName})):null,this.header),h("div",{role:"list",class:"va-sidenav__list"},h("slot",null)))):h(Host,null,h("va-accordion",{"open-single":!0,bordered:!0},h("va-accordion-item",{exportparts:"accordion-content, accordion-header",header:this.mobileHeader},h("nav",{"aria-label":this.navAriaLabel},h("div",{role:"list",class:"va-sidenav__list"},h("slot",null))))))}get el(){return this}static get style(){return VaSidenavStyle0}},[1,"va-sidenav",{header:[1],mobileHeader:[1,"mobile-header"],navAriaLabel:[1,"nav-aria-label"],iconName:[1,"icon-name"],iconBackgroundColor:[1,"icon-background-color"]},[[9,"resize","handleResize"]]]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-sidenav","va-accordion","va-accordion-item","va-button-icon","va-icon"].forEach(e=>{switch(e){case"va-sidenav":customElements.get(e)||customElements.define(e,VaSidenav$1);break;case"va-accordion":customElements.get(e)||defineCustomElement$5();break;case"va-accordion-item":customElements.get(e)||defineCustomElement$4();break;case"va-button-icon":customElements.get(e)||defineCustomElement$3();break;case"va-icon":customElements.get(e)||defineCustomElement$2()}})}const VaSidenav=VaSidenav$1,defineCustomElement=defineCustomElement$1;export{VaSidenav,defineCustomElement};