/**
 * DevExtreme (ui/overlay/utils.js)
 * Version: 19.2.7 (build 20134-0312)
 * Build date: Wed May 13 2020
 *
 * Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.getElementMaxHeightByWindow = void 0;
var _renderer = require("../../core/renderer");
var _renderer2 = _interopRequireDefault(_renderer);
var _window = require("../../core/utils/window");
var _type = require("../../core/utils/type");

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        "default": obj
    }
}
var WINDOW_HEIGHT_PERCENT = .9;
var getElementMaxHeightByWindow = exports.getElementMaxHeightByWindow = function($element, startLocation) {
    var window = (0, _window.getWindow)();
    var actualOffset;
    if ((0, _type.isNumeric)(startLocation)) {
        actualOffset = (0, _renderer2.default)(window).innerHeight() - startLocation + (0, _renderer2.default)(window).scrollTop()
    } else {
        var offsetTop = $element.offset().top - (0, _renderer2.default)(window).scrollTop();
        var offsetBottom = (0, _renderer2.default)(window).innerHeight() - offsetTop - $element.outerHeight();
        actualOffset = Math.max(offsetTop, offsetBottom)
    }
    return actualOffset * WINDOW_HEIGHT_PERCENT
};
