"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getElementSize = getElementSize;
function getElementSize(system, element) {
    const { api: { window: { HTMLElement }, document: { createRange }, }, } = system;
    if (!(element instanceof HTMLElement)) {
        const range = createRange();
        range.selectNodeContents(element);
        const rects = range.getClientRects();
        const rect = rects[0] || { width: 0, height: 0 };
        return rect;
    }
    const bb = element.getBoundingClientRect();
    const { width, height } = bb;
    return { width, height };
}
//# sourceMappingURL=getSize.js.map