import{g as o}from"./offset.esm.js";const t=new Set;function e(o){if(t.add(o),!document.body.classList.contains("nile-scroll-lock")){const o=function(){const o=document.documentElement.clientWidth;return Math.abs(window.innerWidth-o)}();document.body.classList.add("nile-scroll-lock"),document.body.style.setProperty("--nile-scroll-lock-size",`${o}px`)}}function n(o){t.delete(o),0===t.size&&(document.body.classList.remove("nile-scroll-lock"),document.body.style.removeProperty("--nile-scroll-lock-size"))}function c(t,e,n="vertical",c="smooth"){const l=o(t,e),i=l.top+e.scrollTop,s=l.left+e.scrollLeft,r=e.scrollLeft,a=e.scrollLeft+e.offsetWidth,u=e.scrollTop,f=e.scrollTop+e.offsetHeight;"horizontal"!==n&&"both"!==n||(s<r?e.scrollTo({left:s,behavior:c}):s+t.clientWidth>a&&e.scrollTo({left:s-e.offsetWidth+t.clientWidth,behavior:c})),"vertical"!==n&&"both"!==n||(i<u?e.scrollTo({top:i,behavior:c}):i+t.clientHeight>f&&e.scrollTo({top:i-e.offsetHeight+t.clientHeight,behavior:c}))}export{e as l,c as s,n as u};
