import{r as n}from"./react-DAXU6W__.js";import{s as t}from"./react-style-singleton-0ppa2uWN.js";var o="right-scroll-bar-position",a="width-before-scroll-bar",c={left:0,top:0,right:0,gap:0},r=function(n){return parseInt(n||"",10)||0},i=function(n){if(void 0===n&&(n="margin"),"undefined"==typeof window)return c;var t=function(n){var t=window.getComputedStyle(document.body),o=t["padding"===n?"paddingLeft":"marginLeft"],a=t["padding"===n?"paddingTop":"marginTop"],c=t["padding"===n?"paddingRight":"marginRight"];return[r(o),r(a),r(c)]}(n),o=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-o+t[2]-t[0])}},e=t(),d="data-scroll-locked",g=function(n,t,c,r){var i=n.left,e=n.top,g=n.right,p=n.gap;return void 0===c&&(c="margin"),"\n  .".concat("with-scroll-bars-hidden"," {\n   overflow: hidden ").concat(r,";\n   padding-right: ").concat(p,"px ").concat(r,";\n  }\n  body[").concat(d,"] {\n    overflow: hidden ").concat(r,";\n    overscroll-behavior: contain;\n    ").concat([t&&"position: relative ".concat(r,";"),"margin"===c&&"\n    padding-left: ".concat(i,"px;\n    padding-top: ").concat(e,"px;\n    padding-right: ").concat(g,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(p,"px ").concat(r,";\n    "),"padding"===c&&"padding-right: ".concat(p,"px ").concat(r,";")].filter(Boolean).join(""),"\n  }\n  \n  .").concat(o," {\n    right: ").concat(p,"px ").concat(r,";\n  }\n  \n  .").concat(a," {\n    margin-right: ").concat(p,"px ").concat(r,";\n  }\n  \n  .").concat(o," .").concat(o," {\n    right: 0 ").concat(r,";\n  }\n  \n  .").concat(a," .").concat(a," {\n    margin-right: 0 ").concat(r,";\n  }\n  \n  body[").concat(d,"] {\n    ").concat("--removed-body-scroll-bar-size",": ").concat(p,"px;\n  }\n")},p=function(){var n=parseInt(document.body.getAttribute(d)||"0",10);return isFinite(n)?n:0},u=function(t){var o=t.noRelative,a=t.noImportant,c=t.gapMode,r=void 0===c?"margin":c;n.useEffect(function(){return document.body.setAttribute(d,(p()+1).toString()),function(){var n=p()-1;n<=0?document.body.removeAttribute(d):document.body.setAttribute(d,n.toString())}},[]);var u=n.useMemo(function(){return i(r)},[r]);return n.createElement(e,{styles:g(u,!o,r,a?"":"!important")})};export{u as R,a as f,o as z};
