PageSourceSearch

https://celeirobikers.com.br/cdn/shop/t/3/assets/header-menu.js?v=138387690177295788221773244888

js celeirobikers.com.br collected 2026-09-24 14:35:18 UTC 5,461 bytes, 2 lines download raw bytes

1import{Component}from"@theme/component";import{debounce,onDocumentLoaded,setHeaderMenuStyle}from"@theme/utilities";import{MegaMenuHoverEvent}from"@theme/events";class HeaderMenu extends Component{requiredRefs=["overflowMenu"];#submenuMutationObserver=null;connectedCallback(){super.connectedCallback(),onDocumentLoaded(this.#preloadImages),window.addEventListener("resize",this.#resizeListener),this.overflowMenu?.addEventListener("pointerleave",this.#overflowSubmenuListener)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#resizeListener),this.overflowMenu?.removeEventListener("pointerleave",this.#overflowSubmenuListener),this.#cleanupMutationObserver()}#resizeListener=debounce(()=>{setHeaderMenuStyle()},100);#overflowSubmenuListener=()=>{this.#deactivate()};#state={activeItem:null};get overflowMenu(){return this.refs.overflowMenu?.shadowRoot?.querySelector('[part="overflow"]')}get overflowListHovered(){return this.refs.overflowMenu?.shadowRoot?.querySelector('[part="overflow-list"]')?.matches(":hover")??!1}get headerComponent(){return this.closest("header-component")}activate=event=>{if(this.dispatchEvent(new MegaMenuHoverEvent),!(event.target instanceof Element)||!this.headerComponent)return;let item=findMenuItem(event.target);if(!item||item==this.#state.activeItem)return;const isDefaultSlot=event.target.slot==="";this.dataset.overflowExpanded=(!isDefaultSlot).toString();const previouslyActiveItem=this.#state.activeItem;previouslyActiveItem&&(previouslyActiveItem.ariaExpanded="false"),this.#state.activeItem=item,this.ariaExpanded="true",item.ariaExpanded="true";let submenu=findSubmenu(item);const hasSubmenu=!!submenu;!hasSubmenu&&!isDefaultSlot&&(submenu=this.overflowMenu),submenu&&(submenu.dataset.active="",this.#cleanupMutationObserver(),this.#submenuMutationObserver=new MutationObserver(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{submenu.offsetHeight>0&&(this.headerComponent?.style.setProperty("--submenu-height",`${submenu.offsetHeight}px`),this.#cleanupMutationObserver())})})}),this.#submenuMutationObserver.observe(submenu,{childList:!0,subtree:!0}),setTimeout(()=>{this.#cleanupMutationObserver()},500));let finalHeight=submenu?.offsetHeight||0;if(!isDefaultSlot){const overflowListHeight=this.#getOverflowListLinksHeight();if(hasSubmenu){const overflowHeight=this.overflowMenu?.offsetHeight||0;finalHeight=Math.max(overflowHeight,overflowListHeight)}else finalHeight=overflowListHeight}submenu||(finalHeight=0),this.headerComponent.style.setProperty("--submenu-height",`${finalHeight}px`),this.#setFullOpenHeaderHeight(finalHeight),this.style.setProperty("--submenu-opacity","1")};deactivate(event){if(!(event.target instanceof Element))return;const menu=findSubmenu(this.#state.activeItem),isMovingWithinMenu=event.relatedTarget instanceof Node&&menu?.contains(document.activeElement),isMovingToSubmenu=event.relatedTarget instanceof Node&&event.type==="blur"&&menu?.contains(event.relatedTarget),isMovingToOverflowMenu=event.relatedTarget instanceof Node&&event.relatedTarget.parentElement?.matches('[slot="overflow"]');isMovingWithinMenu||isMovingToOverflowMenu||isMovingToSubmenu||this.#deactivate()}#deactivate=(item=this.#state.activeItem)=>{if(!item||item!=this.#state.activeItem||this.overflowListHovered||this.overflowMenu?.matches(":hover"))return;this.headerComponent?.style.setProperty("--submenu-height","0px"),this.#setFullOpenHeaderHeight(0),this.style.setProperty("--submenu-opacity","0"),this.dataset.overflowExpanded="false";const submenu=findSubmenu(item);this.#state.activeItem=null,this.ariaExpanded="false",item.ariaExpanded="false",submenu&&delete submenu.dataset.active};#getOverflowListLinksHeight(){const slottedMenuLinks=this.overflowMenu?.querySelector("slot")?.assignedElements();if(!slottedMenuLinks)return this.overflowMenu?.offsetHeight||0;const mapSubmenus=cb=>{slottedMenuLinks.forEach(link=>{const submenu=link.querySelector('[ref="submenu[]"]');submenu&&cb(submenu)})};mapSubmenus(submenu=>{submenu.style.setProperty("display","none")});const height=this.overflowMenu?.offsetHeight||0;return mapSubmenus(submenu=>{submenu.style.removeProperty("display")}),height}#setFullOpenHeaderHeight(submenuHeight){if(!this.headerComponent)return;const headerVisibleHeight=this.headerComponent.hasAttribute("data-submenu-overlap-bottom-row")&&this.headerComponent.offsetHeight>0?this.headerComponent.querySelector(".header__row--top")?.offsetHeight??0:this.headerComponent.offsetHeight,fullOpenHeaderHeight=submenuHeight===0?0:submenuHeight+(headerVisibleHeight??0);this.headerComponent?.style.setProperty("--full-open-header-height",`${fullOpenHeaderHeight}px`)}#preloadImages=()=>{this.querySelectorAll('img[loading="lazy"]')?.forEach(image=>image.removeAttribute("loading"))};#cleanupMutationObserver(){this.#submenuMutationObserver?.disconnect(),this.#submenuMutationObserver=null}}customElements.get("header-menu")||customElements.define("header-menu",HeaderMenu);function findMenuItem(element){return element instanceof Element?element?.matches('[slot="more"')?findMenuItem(element.parentElement?.querySelector('[slot="overflow"]')):element?.querySelector('[ref="menuitem"]'):null}function findSubmenu(element){const submenu=element?.parentElement?.querySelector('[ref="submenu[]"]');return submenu instanceof HTMLElement?submenu:null}
2//# sourceMappingURL=/cdn/shop/t/3/assets/header-menu.js.map?v=138387690177295788221773244888

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.