import{bq as o}from"./Dxmw2xpT.js";function d(){const e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.overflow="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}const n=o("Modal",{state:()=>({isModalMode:!1,layers:0,stackOrderIndex:900}),actions:{incrementStackOrderIndex(){this.stackOrderIndex+=1},decrementStackOrderIndex(){this.stackOrderIndex-=1},add(){typeof window>"u"||typeof document>"u"||(this.layers+=1,this.layers>0&&(document.body.style.top=`-${window.scrollY}px`,document.body.style.left="0",document.body.style.right="0",document.body.style.bottom="0",document.body.style.position="fixed",document.body.style.paddingRight=`${d()}px`,document.body.classList.add("body--modal")))},remove(){if(!(typeof window>"u"||typeof document>"u")&&(this.layers-=1,this.layers<0&&(this.layers=0),this.layers===0)){const e=document.body.style.top;document.body.style.position="",document.body.style.top="",document.body.style.left="",document.body.style.right="",document.body.style.bottom="",document.body.style.paddingRight="",document.body.classList.remove("body--modal"),window.scrollTo(0,parseInt(e||"0")*-1)}},isAnyModalOpen(){return this.layers!==0||this.stackOrderIndex!==900}}});export{n as u};