/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Utilities
 */
import { RelativePosition } from "@itwin/appui-abstract";
/**
 * Utility for converting a Placement or RelativePosition to a RelativePosition.
 * Should be removed N+1 major versions after RelativePosition's deprecation.
 * @internal
 */
export function mapToRelativePosition(input) {
    if (typeof input === "string")
        return placementToRelativePositionMap[input];
    return input;
}
/**
 * Utility for converting a RelativePosition to a Placement.
 * Should most likely be removed N+1 major versions after RelativePosition's deprecation.
 * @internal
 */
export function mapToPlacement(input) {
    if (!input)
        return "top-end";
    if (typeof input === "string")
        return input;
    return relativePositionToPlacementMap[input];
}
const placementToRelativePositionMap = {
    left: RelativePosition.Left,
    top: RelativePosition.Top,
    right: RelativePosition.Right,
    bottom: RelativePosition.Bottom,
    "left-start": RelativePosition.LeftTop,
    "left-end": RelativePosition.Left,
    "right-start": RelativePosition.RightTop,
    "right-end": RelativePosition.Right,
    "top-start": RelativePosition.TopLeft,
    "top-end": RelativePosition.TopRight,
    "bottom-start": RelativePosition.BottomLeft,
    "bottom-end": RelativePosition.BottomRight,
};
const relativePositionToPlacementMap = {
    [RelativePosition.Left]: "left",
    [RelativePosition.Top]: "top",
    [RelativePosition.Right]: "right",
    [RelativePosition.Bottom]: "bottom",
    [RelativePosition.LeftTop]: "left-start",
    [RelativePosition.RightTop]: "right-start",
    [RelativePosition.TopLeft]: "top-start",
    [RelativePosition.TopRight]: "top-end",
    [RelativePosition.BottomLeft]: "bottom-start",
    [RelativePosition.BottomRight]: "bottom-end",
};
//# sourceMappingURL=Placement.js.map