'use strict';

var is = require('../is.cjs');

function getScroll(target, top) {
  var _a, _b;
  if (typeof window === "undefined")
    return 0;
  const method = top ? "scrollTop" : "scrollLeft";
  let result = 0;
  if (is.isWindow(target)) {
    result = target[top ? "pageYOffset" : "pageXOffset"];
  } else if (target instanceof Document) {
    result = target.documentElement[method];
  } else if (target instanceof HTMLElement) {
    result = target[method];
  } else if (target) {
    result = target[method];
  }
  if (target && !is.isWindow(target) && typeof result !== "number")
    result = (_b = ((_a = target.ownerDocument) != null ? _a : target).documentElement) == null ? void 0 : _b[method];
  return result;
}

exports.getScroll = getScroll;
//# sourceMappingURL=getScroll.cjs.map
