"use strict";
const index = require("../../../../../../scroll-into-view-if-needed@2.2.20/node_modules/scroll-into-view-if-needed/es/index.js");
const is = require("./is.js");
var __assign = globalThis && globalThis.__assign || function() {
  __assign = Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s)
        if (Object.prototype.hasOwnProperty.call(s, p))
          t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
function scrollIntoViewIfNeed(node, options) {
  if (node) {
    index(node, __assign({ block: "start", behavior: "instant", scrollMode: "if-needed" }, options));
    var height = node.offsetHeight;
    var scaleHeight = node.getBoundingClientRect().height;
    if (options && options.boundary && height !== scaleHeight) {
      var parentNode = is.isFunction(options.boundary) ? options.boundary(node) : options.boundary;
      parentNode.scrollTop = Math.round(parentNode.scrollTop * (height / scaleHeight));
    }
  }
}
module.exports = scrollIntoViewIfNeed;
//# sourceMappingURL=scrollIntoView.js.map
