;(function(){"use strict";class INavigationMenu extends HTMLElement{connectedCallback(){this.menu=this.querySelector('[data-role="menu"]');this.moreLi=this.menu.querySelector('[data-role="moreLi"]');this.moreMenu=this.moreLi.querySelector('[data-role="moreMenu"]');this.clone=this.querySelector('[data-role="clone"]');this.supportsAnchor=CSS.supports("(top: anchor(bottom)) and (not (-webkit-hyphens: auto))");if(!this.supportsAnchor){this.querySelectorAll("[popover]").forEach(dropdown=>{dropdown.addEventListener("beforetoggle",this);if(dropdown.matches(":popover-open")){dropdown.hidePopover();dropdown.showPopover();}});}
this.items=this.clone.querySelectorAll(":scope > :not([data-role='moreLiClone'])");this.items.forEach(i=>this.priorityObserver.observe(i));}
handleEvent(e){return this[`${e.type}Event`]&&this[`${e.type}Event`](e);}
static get observedAttributes(){return['data-hover'];}
attributeChangedCallback(name,oldValue,newValue){if(name==="data-hover"&&window.matchMedia("(hover: hover) and (pointer: fine)").matches){this.addEventListener("mouseover",this);this.addEventListener("mouseleave",this);}}
beforetoggleEvent(e){let dropdown=e.target;let trigger=e.source?e.source:this.querySelector(`[popovertarget="${dropdown.id}"]`);const triggerPos=trigger.getBoundingClientRect();if(e.newState==='open'){dropdown.style.setProperty("--_anchor-v",window.scrollY+triggerPos.bottom+"px");dropdown.style.setProperty("--_anchor-h",triggerPos.left+(triggerPos.width/2)+"px");}else{dropdown.style.setProperty("--_anchor-v-fixed",triggerPos.bottom+"px");}}
moveToMore(links){const moreFragment=document.createDocumentFragment();links.forEach(link=>{moreFragment.append(link);const toggle=link.querySelector("[popovertarget]");if(!toggle)return;if(!link.querySelector(".ipsNav__dropdownTitle")){toggle.insertAdjacentHTML("beforebegin",`<div class="ipsNav__dropdownTitle">${toggle.innerHTML}</div>`);}
const dropdown=link.querySelector("[popover]");if(dropdown){dropdown.removeAttribute('popover');dropdown.setAttribute('data-popover','');}});if(moreFragment.querySelector("[aria-current]")){this.moreLi.setAttribute("data-active","");}
this.moreMenu.prepend(moreFragment);}
moveToMain(links){const mainFragment=document.createDocumentFragment();links.forEach(link=>{mainFragment.append(link);const dropdown=link.querySelector("[data-popover]");if(dropdown){dropdown.removeAttribute('data-popover');dropdown.setAttribute('popover','');}});this.moreLi.before(mainFragment);if(!this.moreMenu.querySelector("[aria-current]")){this.moreLi.removeAttribute("data-active");}}
priorityObserver=new IntersectionObserver((entries)=>{let moveLinksToMain=[],moveLinksToMore=[];entries.forEach((entry)=>{if(entry.isIntersecting){const link=this.moreMenu.querySelector(`[data-id="${entry.target.dataset.id}"]`);if(!link)return;moveLinksToMain.push(link);}else{const link=this.menu.querySelector(`[data-id="${entry.target.dataset.id}"]`);if(!link)return;if(this.moreMenu.contains(link))return;moveLinksToMore.push(link);}});if(moveLinksToMain.length){this.moveToMain(moveLinksToMain);}else if(moveLinksToMore.length){this.moveToMore(moveLinksToMore);}
let firstMoreLink=this.moreMenu.firstElementChild;this.moreLi.hidden=!firstMoreLink;if(firstMoreLink){ips.utils.cookie.set("moreMenuLink",firstMoreLink.dataset.id,false);}else{ips.utils.cookie.unset("moreMenuLink");}
this.setAttribute("data-observed","");},{root:this.querySelector(".js-ipsNavPriority"),threshold:1})
mouseoverEvent(e){this.potentiallyShowHoverMenu(e);}
mouseleaveEvent(e){this.hideHoverMenu();}
potentiallyShowHoverMenu(e){if(this._raf)cancelAnimationFrame(this._raf);this._raf=requestAnimationFrame(()=>{this._raf=null;const item=e.target.closest('[data-role="menu"] > li');if(!item){this.hideHoverMenu();return;}
if(item.querySelector(":popover-open")){return;}
const anchor=item.querySelector("[popovertarget]");const dropdown=item.querySelector("[popover]");if(!anchor||!dropdown){this.hideHoverMenu();return;}
dropdown.showPopover({source:anchor});});}
hideHoverMenu(){const openedMenu=this.querySelector(":popover-open");openedMenu?.hidePopover();}};ips.ui.registerWebComponent("navigationMenu",INavigationMenu);Debug.log(`Submitted the web component constructor, INavigationMenu, for ${"navigationMenu"}`);})();;