"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const colorManipulator_1 = require("@material-ui/core/styles/colorManipulator");
exports.styles = ({ color, disabled }, muiTheme, theme) => {
    if (!color || (color === 'default' && !disabled)) {
        return;
    }
    const colors = {};
    if (disabled) {
        return;
    }
    // If color is NOT primary, secondary or default then create custom styles
    if ((color === 'primary' ||
        color === 'secondary' ||
        color === 'success' ||
        color === 'error' ||
        color === 'warning') &&
        !disabled) {
        colors.hover = theme.palette[color].dark;
        colors.main = theme.palette[color].main;
        colors.text = theme.palette[color].contrastText;
    }
    else {
        colors.hover = color;
        colors.main = color;
        colors.text = muiTheme.palette.getContrastText(color);
    }
    return {
        contained: {},
        outlined: {},
        // text: {},
        root: {
            '&$contained': {
                backgroundColor: colors.main,
                color: colors.text,
                '&:hover': {
                    backgroundColor: colors.hover,
                },
            },
            /* Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
            '&$outlined': {
                '&:hover': {
                    '@media (hover: none)': {
                        backgroundColor: 'transparent',
                    },
                    backgroundColor: colorManipulator_1.fade(colors.main, theme.palette.action.hoverOpacity),
                    border: `1px solid ${colors.main}`,
                },
                border: `1px solid ${colorManipulator_1.fade(colors.main, 0.5)}`,
                color: colors.main,
            },
            '&$text': {
                '&:hover': {
                    '@media (hover: none)': {
                        backgroundColor: 'transparent',
                    },
                    backgroundColor: colorManipulator_1.fade(colors.main, theme.palette.action.hoverOpacity),
                },
                color: colors.main,
            },
        },
        /* Styles applied to the root element if `variant="text"` */
        text: {},
    };
};
