1(function(){const ROUTE_MODAL_SELECTOR='.route-modal[data-testid="route-modal"]',DRAWER_SELECTOR="#slideout-ajax-cart",CLOSE_SELECTOR=".route-modal__close";let drawerObserverAttached=!1,isClosingRouteModal=!1;const patchedModals=new WeakSet;function getRouteModal(){const modals=document.querySelectorAll(ROUTE_MODAL_SELECTOR);if(modals.length===0)return null;if(modals.length===1)return modals[0];for(const m of modals)if(m.classList.contains("rm-open"))return m;return modals[modals.length-1]}function getAllRouteModals(){return document.querySelectorAll(ROUTE_MODAL_SELECTOR)}function getDrawer(){return document.querySelector(DRAWER_SELECTOR)}function shouldBeOpen(rm){return rm.classList.contains("rm-open")}function setDrawerPopoverMode(mode){const drawer=getDrawer();drawer&&drawer.setAttribute("popover",mode)}function ensurePopoverStateMatchesRoute(rm){if(!rm||typeof rm.showPopover!="function"||isClosingRouteModal)return;const open=shouldBeOpen(rm),isPopoverOpen=typeof rm.matches=="function"&&rm.matches(":popover-open");open&&rm.getAttribute("aria-hidden")==="true"&&rm.setAttribute("aria-hidden","false"),open&&!isPopoverOpen?(rm.setAttribute("popover","manual"),rm.showPopover()):!open&&isPopoverOpen&&typeof rm.hidePopover=="function"&&rm.hidePopover()}function bringRouteModalToTop(){const rm=getRouteModal();return rm?isClosingRouteModal?!0:(ensurePopoverStateMatchesRoute(rm),shouldBeOpen(rm)?(setDrawerPopoverMode("manual"),typeof rm.showPopover=="function"?(rm.setAttribute("popover","manual"),typeof rm.hidePopover=="function"&&rm.hidePopover(),rm.showPopover()):(rm.style.position="fixed",rm.style.inset="0",rm.style.zIndex="2147483647"),!0):(setDrawerPopoverMode("auto"),!0)):!1}function attachDrawerObserverOnce(){if(drawerObserverAttached)return;const drawer=getDrawer();if(!drawer)return;new MutationObserver(()=>bringRouteModalToTop()).observe(drawer,{attributes:!0,attributeFilter:["aria-hidden","popover-open","class"]}),drawerObserverAttached=!0}function patchRouteModal(rm){return!rm||patchedModals.has(rm)?!1:(patchedModals.add(rm),rm.addEventListener("click",e=>{e.target.closest(CLOSE_SELECTOR)&&(isClosingRouteModal=!0,setTimeout(()=>{isClosingRouteModal=!1,setDrawerPopoverMode("auto")},250))},!0),typeof MutationObserver<"u"&&new MutationObserver(()=>ensurePopoverStateMatchesRoute(rm)).observe(rm,{attributes:!0,attributeFilter:["class","aria-hidden"]}),!0)}function patchAllRouteModals(){getAllRouteModals().forEach(rm=>patchRouteModal(rm))}function removeDuplicateModals(){const modals=getAllRouteModals();if(modals.length<=1)return;let keep=null;modals.forEach(m=>{m.classList.contains("rm-open")&&(keep=m)}),keep||(keep=modals[modals.length-1]),modals.forEach(m=>{m!==keep&&m.remove()})}function runWithRetries(){removeDuplicateModals(),bringRouteModalToTop(),attachDrawerObserverOnce(),patchAllRouteModals(),[500,1e3,2e3,3e3,4e3,5e3].forEach(ms=>{setTimeout(()=>{removeDuplicateModals(),bringRouteModalToTop(),attachDrawerObserverOnce(),patchAllRouteModals()},ms)})}typeof MutationObserver<"u"&&new MutationObserver(()=>{removeDuplicateModals(),patchAllRouteModals()}).observe(document.documentElement,{childList:!0,subtree:!0}),document.readyState==="complete"?runWithRetries():window.addEventListener("load",runWithRetries,{once:!0})})(); 2//# sourceMappingURL=/cdn/shop/t/60/assets/route-popover-modal-fix.js.map?v=38880255926868022861789166683
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.