import * as i0 from '@angular/core';
import { isDevMode, Injectable, InjectionToken } from '@angular/core';

const popoverPlacementMap = {
    'top-start': { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
    top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },
    'top-end': { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },
    'bottom-start': { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
    bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },
    'bottom-end': { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
    'left-start': { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top' },
    left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },
    'left-end': { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom' },
    'right-start': { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top' },
    right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },
    'right-end': { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom' }
};
const DefaultPositions = [
    { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
    { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
    { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },
    { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },
    { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
    { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' }
];
const GetDefaultPosition = (position) => {
    const resultPosition = [];
    if (position && position[0]) {
        const firstPosition = position[0];
        resultPosition.push({
            ...firstPosition,
            originY: PopoverFlippedYDirection[firstPosition.originY],
            overlayY: PopoverFlippedYDirection[firstPosition.overlayY]
        });
    }
    return resultPosition.concat(DefaultPositions);
};
var PopoverPlacement;
(function (PopoverPlacement) {
    PopoverPlacement["AUTO_START"] = "auto-start";
    PopoverPlacement["AUTO"] = "auto";
    PopoverPlacement["AUTO_END"] = "auto-end";
    PopoverPlacement["TOP_START"] = "top-start";
    PopoverPlacement["TOP"] = "top";
    PopoverPlacement["TOP_END"] = "top-end";
    PopoverPlacement["RIGHT_START"] = "right-start";
    PopoverPlacement["RIGHT"] = "right";
    PopoverPlacement["RIGHT_END"] = "right-end";
    PopoverPlacement["BOTTOM_END"] = "bottom-end";
    PopoverPlacement["BOTTOM"] = "bottom";
    PopoverPlacement["BOTTOM_START"] = "bottom-start";
    PopoverPlacement["LEFT_END"] = "left-end";
    PopoverPlacement["LEFT"] = "left";
    PopoverPlacement["LEFT_START"] = "left-start";
})(PopoverPlacement || (PopoverPlacement = {}));
const PopoverFlippedYDirection = {
    bottom: 'top',
    top: 'bottom',
    center: 'center'
};
const PopoverFlippedRtlPlacement = {
    'left-start': 'right-start',
    left: 'right',
    'left-end': 'right-end',
    'right-start': 'left-start',
    right: 'left',
    'right-end': 'left-end'
};
class PopoverPosition {
    /** Get the cdk placement of the popover */
    static getCdkPlacement(placement, direction) {
        const resultCdkPlacement = popoverPlacementMap[placement];
        if (!resultCdkPlacement && isDevMode()) {
            throw new Error('Invalid function argument. Check if "placement" is type of Placement Union');
        }
        if (direction === 'rtl') {
            const startPlaceStr = placement.split('-')[0];
            if (startPlaceStr === 'left' || startPlaceStr === 'right') {
                return popoverPlacementMap[PopoverFlippedRtlPlacement[placement]];
            }
        }
        return resultCdkPlacement;
    }
}

/**
 *
 * This service holds default
 * value state aria messages
 * that are needed for accessibility purposes.
 *
 * It's intendant to be used with form controls
 * which supports different value states
 *
 */
class ValueStateAriaMessageService {
    constructor() {
        /** Value state "success" message */
        this.success = 'Value State Success';
        /** Value state "information" message */
        this.information = 'Value State Information';
        /** Value state "warning" message */
        this.warning = 'Value State Warning';
        /** Value state "error" message */
        this.error = 'Value State Error';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ValueStateAriaMessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ValueStateAriaMessageService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ValueStateAriaMessageService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }] });

const DYNAMIC_PAGE_HEADER_TOKEN = new InjectionToken('DynamicPageHeader');

const FD_TABLIST = new InjectionToken('FdTabList');

/*
 * Public API Surface of shared
 */

/**
 * Generated bundle index. Do not edit.
 */

export { DYNAMIC_PAGE_HEADER_TOKEN, DefaultPositions, FD_TABLIST, GetDefaultPosition, PopoverFlippedRtlPlacement, PopoverFlippedYDirection, PopoverPlacement, PopoverPosition, ValueStateAriaMessageService };
//# sourceMappingURL=fundamental-ngx-core-shared.mjs.map
