1const DATASET_KEY="scrollLocks",SCROLL_POSITION_KEY="scrollLockPosition",hasDocument=typeof document<"u",getLocks=()=>{if(!hasDocument||!document.body)return new Set;const raw=document.body.dataset[DATASET_KEY];return raw?new Set(raw.split(",").map(lock=>lock.trim()).filter(Boolean)):new Set},persistLocks=locks=>{if(!(!hasDocument||!document.body)){if(!locks||locks.size===0){delete document.body.dataset[DATASET_KEY];return}document.body.dataset[DATASET_KEY]=Array.from(locks).join(",")}};export const lockScroll=(lockId="default")=>{if(!hasDocument||!document.body||!lockId)return;const activeLocks=getLocks();if(!activeLocks.has(lockId)){if(activeLocks.size===0){const currentScrollY=window.scrollY||0,scrollbarWidth=window.innerWidth-document.documentElement.clientWidth;document.body.dataset[SCROLL_POSITION_KEY]=String(currentScrollY),document.documentElement.style.setProperty("--preserved-scroll-y",`-${currentScrollY}px`),document.documentElement.style.setProperty("--scrollbar-width",`${scrollbarWidth}px`),document.body.classList.add("modal-position-lock")}activeLocks.add(lockId),persistLocks(activeLocks)}},unlockScroll=(lockId="default")=>{if(!hasDocument||!document.body||!lockId)return;const activeLocks=getLocks();if(!activeLocks.has(lockId))return;if(activeLocks.delete(lockId),activeLocks.size>0){persistLocks(activeLocks);return}const preservedScroll=document.body.dataset[SCROLL_POSITION_KEY],numericScroll=preservedScroll&&parseInt(preservedScroll,10)||0,html=document.documentElement;document.body.classList.remove("modal-position-lock"),html&&(html.style.removeProperty("--preserved-scroll-y"),html.style.removeProperty("--scrollbar-width")),persistLocks(activeLocks),delete document.body.dataset[SCROLL_POSITION_KEY];let previousScrollBehavior;if(html&&(previousScrollBehavior=html.style.scrollBehavior,html.style.scrollBehavior="auto"),window.scrollTo({top:numericScroll,behavior:"auto"}),html){const restoreScrollBehavior=()=>{if(previousScrollBehavior){html.style.scrollBehavior=previousScrollBehavior;return}html.style.removeProperty("scroll-behavior")};typeof requestAnimationFrame=="function"?requestAnimationFrame(restoreScrollBehavior):setTimeout(restoreScrollBehavior,0)}}; 2//# sourceMappingURL=/cdn/shop/t/243/assets/scroll-lock.js.map?v=181845040853833132811785923267
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.