/**
 * @since Last modified: 2024-09-14 09:23:07
 * @function getElSpace
 * @description Get the space occupied by the element, either horizontal or vertical space.
 * @param {getEl} any  - Element selector.
 * @param {'x'|'y'} [axis='y']  - The derction of space.
 * @returns {number} - Return a number.
 * @see {@link https://codepen.io/axui/pen/JjQVpvq|demo @ codepen}
 * @example
 * ax.getElSpace('#demo');
 * <!--return 100-->
 */
'use strict';
import getEl from "./getEl";
import getHeights from "./getHeights";
import getWidths from "./getWidths";
const getElSpace = (target, axis = 'y') => {
    let el = getEl(target), tmp;
    if (!el)
        return 0;
    if (axis === 'x') {
        tmp = getWidths(el);
        return el.offsetWidth + tmp.marginLeft + tmp.marginRight;
    }
    else {
        tmp = getHeights(el);
        return el.offsetHeight + tmp.marginTop + tmp.marginBottom;
    }
};
export default getElSpace;
