import f from "../../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import * as m from "react";
import { updateCSS as d, removeCSS as r } from "../../../rc-util/es/Dom/dynamicCSS.mjs";
import l from "../../../rc-util/es/hooks/useLayoutEffect.mjs";
import { getTargetScrollBarSize as s } from "../../../rc-util/es/getScrollBarSize.mjs";
import { isBodyOverflowing as S } from "./util.mjs";
var p = "rc-util-locker-".concat(Date.now()), e = 0;
function h(c) {
  var o = !!c, a = m.useState(function() {
    return e += 1, "".concat(p, "_").concat(e);
  }), n = f(a, 1), t = n[0];
  l(function() {
    if (o) {
      var i = s(document.body).width, u = S();
      d(`
html body {
  overflow-y: hidden;
  `.concat(u ? "width: calc(100% - ".concat(i, "px);") : "", `
}`), t);
    } else
      r(t);
    return function() {
      r(t);
    };
  }, [o, t]);
}
export {
  h as default
};
