export const calculateDropdownPosition = (visiblePosition, editorDomNode, dropdownHeight = 150) => {
    if (!visiblePosition || !editorDomNode)
        return { top: 0, left: 0 };
    const { top, left } = visiblePosition;
    const editorRect = editorDomNode.getBoundingClientRect();
    const editorHeight = editorDomNode.clientHeight;
    let dropdownTop = top;
    let dropdownLeft = left;
    if (dropdownTop + dropdownHeight > editorHeight - dropdownHeight + 130) {
        dropdownTop -= Math.floor(dropdownHeight / 2) + dropdownHeight - 35;
    }
    else {
        dropdownTop -= 10;
    }
    if (left > editorRect.width * 0.6) {
        dropdownLeft -= dropdownHeight + 50;
    }
    else if (left < editorRect.width * 0.5 + dropdownHeight) {
        dropdownLeft = dropdownLeft - 42;
    }
    return { top: dropdownTop, left: dropdownLeft };
};
//# sourceMappingURL=calculateDropdownPosition.js.map