/**
 * tdesign v0.46.4
 * (c) 2022 tdesign
 * @license MIT
 */

import { getIEVersion } from './helper.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/defineProperty';

function getScrollbarWidth() {
  var defaultScrollbarWidth = 6;
  if (!navigator) return defaultScrollbarWidth;
  if (/(Chrome|Safari)/i.test(navigator.userAgent)) return defaultScrollbarWidth;
  var scrollDiv = document.createElement("div");
  scrollDiv.style.cssText = "width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;";
  document.body.appendChild(scrollDiv);
  var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
  document.body.removeChild(scrollDiv);

  if (/Firefox/.test(navigator.userAgent)) {
    scrollbarWidth -= 4;
  }

  if (getIEVersion() <= 11) {
    scrollbarWidth = 12;
  }

  return scrollbarWidth;
}

export { getScrollbarWidth as default };
//# sourceMappingURL=getScrollbarWidth.js.map
