// #region Imports
// #endregion
/**
 * The inset types.
 *
 * @public
 */
export const Inset = {
    None: 'none',
    Top: 'top',
    Right: 'right',
    Bottom: 'bottom',
    Left: 'left',
    Vertical: 'vertical',
    Horizontal: 'horizontal',
    All: 'all'
};
/**
 * @public
 */
export var InsetFn;
(function (InsetFn) {
    const INSETS = [
        'top',
        'right',
        'bottom',
        'left',
        'vertical',
        'horizontal',
        'all',
        'none'
    ];
    /**
     * @public
     */
    function parse(value) {
        const values = typeof value === 'string'
            ? value.split(/\s+/)
            : value ?? [];
        const knownValues = new Array();
        validate(values);
        values.forEach((x) => {
            if (INSETS.includes(x)) {
                knownValues.push(x);
            }
        });
        return knownValues;
    }
    InsetFn.parse = parse;
    /**
     * @public
     */
    function validate(values) {
        // Validate general values are in INSETS
        values.forEach((x) => {
            if (!INSETS.includes(x)) {
                throw new Error('Error while parsing inset.');
            }
        });
        // Validate none
        if (values.includes('none')) {
            if (values.length > 1) {
                throw new Error('Error while parsing inset.');
            }
        }
        // Validate all
        if (values.includes('all')) {
            if (values.length > 1) {
                throw new Error('Error while parsing inset.');
            }
        }
        // Validate vertical
        if (values.includes('vertical')) {
            if (values.includes('top') || values.includes('bottom')) {
                throw new Error('Error while parsing inset');
            }
        }
        // Validate horizontal
        if (values.includes('horizontal')) {
            if (values.includes('left') || values.includes('right')) {
                throw new Error('Error while parsing inset.');
            }
        }
        // Validate vertical and horizontal
        if (values.includes('vertical') && values.includes('horizontal')) {
            if (values.length > 2) {
                throw new Error('Error while parsing inset.');
            }
        }
    }
    InsetFn.validate = validate;
    /**
     * @public
     */
    function has(values, ...conditions) {
        let hasCondition = false;
        values.forEach((x) => {
            if (conditions.includes(x)) {
                hasCondition = true;
            }
        });
        return hasCondition;
    }
    InsetFn.has = has;
})(InsetFn || (InsetFn = {}));
//# sourceMappingURL=Inset.js.map