"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getFieldPosition = void 0;
const MANDATORY_HEIGHT = 400;
const getFieldPosition = (ref, placesRef) => {
  var _placesRef$current, _placesRef$current$ge;
  if (!(ref !== null && ref !== void 0 && ref.current)) return;
  const {
    bottom,
    top
  } = ref.current.getBoundingClientRect();
  const spaceAbove = top;
  const spaceBelow = window.innerHeight - bottom;
  const mandatoryHeight = (placesRef === null || placesRef === void 0 ? void 0 : (_placesRef$current = placesRef.current) === null || _placesRef$current === void 0 ? void 0 : (_placesRef$current$ge = _placesRef$current.getBoundingClientRect()) === null || _placesRef$current$ge === void 0 ? void 0 : _placesRef$current$ge.height) || MANDATORY_HEIGHT;
  return spaceAbove >= mandatoryHeight && spaceBelow < mandatoryHeight ? {
    top: true
  } : {
    bottom: true
  };
};
exports.getFieldPosition = getFieldPosition;
//# sourceMappingURL=getFieldPosition.js.map