// (C) 2020-2025 GoodData Corporation
import { assertNever } from "@gooddata/sdk-model";
/**
 * @internal
 */
export function positionPointToAlignPoint(positionPoint) {
    const [verticalAlign, horizontalAlign] = positionPoint.split("-");
    return `${convertVerticalPoint(verticalAlign)}${convertHorizontalPoint(horizontalAlign)}`;
}
/**
 * @internal
 */
export function alignConfigToAlignPoint({ triggerAlignPoint, overlayAlignPoint, offset, }) {
    return {
        align: `${positionPointToAlignPoint(triggerAlignPoint)} ${positionPointToAlignPoint(overlayAlignPoint)}`,
        offset,
    };
}
function convertVerticalPoint(verticalPoint) {
    switch (verticalPoint) {
        case "top":
            return "t";
        case "center":
            return "c";
        case "bottom":
            return "b";
        default:
            assertNever(verticalPoint);
            return "c";
    }
}
function convertHorizontalPoint(horizontalPoint) {
    switch (horizontalPoint) {
        case "left":
            return "l";
        case "center":
            return "c";
        case "right":
            return "r";
        default:
            assertNever(horizontalPoint);
            return "c";
    }
}
