text: import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
  import _extends from "@babel/runtime/helpers/esm/extends";
  import * as React from 'react';
  import PropTypes from 'prop-types';
  import clsx from 'clsx';
  import { withStyles, lighten, darken } from '@material-ui/core/styles';
  import Paper from '@material-ui/core/Paper';
  import SuccessOutlinedIcon from '../internal/svg-icons/SuccessOutlined';
  import ReportProblemOutlinedIcon from '../internal/svg-icons/ReportProblemOutlined';
  import ErrorOutlineIcon from '../internal/svg-icons/ErrorOutline';
  import InfoOutlinedIcon from '../internal/svg-icons/InfoOutlined';
  import CloseIcon from '../internal/svg-icons/Close';
  import IconButton from '@material-ui/core/IconButton';
  import { capitalize } from '@material-ui/core/utils';
  export var styles = function styles(theme) {
    var getColor = theme.palette.type === 'light' ? darken : lighten;
    var getBackgroundColor = theme.palette.type === 'light' ? lighten : darken;
    return {
      /* Styles applied to the root element. */
      root: _extends(_extends({}, theme.typography.body2), {}, {
        borderRadius: theme.shape.borderRadius,
        backgroundColor: 'transparent',
        display: 'flex',
        padding: '6px 16px'
      }),
  
      /* Styles applied to the root element if `variant="standard"` and `color="success"`. */
      standardSuccess: {
        color: getColor(theme.palette.success.main, 0.6),
        backgroundColor: getBackgroundColor(theme.palette.success.main, 0.9),
        '& $icon': {
          color: theme.palette.success.main
        }
      },
  
      /* Styles applied to the root element if `variant="standard"` and `color="info"`. */
      standardInfo: {
        color: getColor(theme.palette.info.main, 0.6),
        backgroundColor: getBackgroundColor(theme.palette.info.main, 0.9),
        '& $icon': {
          color: theme.palette.info.main
        }
      },
  
      /* Styles applied to the root element if `variant="standard"` and `color="warning"`. */
      standardWarning: {
        color: getColor(theme.palette.warning.main, 0.6),
        backgroundColor: getBackgroundColor(theme.palette.warning.main, 0.9),
        '& $icon': {
          color: theme.palette.warning.main
        }
      },
  
      /* Styles applied to the root element if `variant="standard"` and `color="error"`. */
      standardError: {
        color: getColor(theme.palette.error.main, 0.6),
        backgroundColor: getBackgroundColor(theme.palette.error.main, 0.9),
        '& $icon': {
          color: theme.palette.error.main
        }
      },
  
      /* Styles applied to the root element if `variant="outlined"` and `color="success"`. */
      outlinedSuccess: {
        color: getColor(theme.palette.success.main, 0.6),
        border: "1px solid ".concat(theme.palette.success.main),
        '& $icon': {
          color: theme.palette.success.main
        }
      },
  
      /* Styles applied to the root element if `variant="outlined"` and `color="info"`. */
      outlinedInfo: {
        color: getColor(theme.palette.info.main, 0.6),
        border: "1px solid ".concat(theme.palette.info.main),
        '& $icon': {
          color: theme.palette.info.main
        }
      },
  
      /* Styles applied to the root element if `variant="outlined"` and `color="warning"`. */
      outlinedWarning: {
        color: getColor(theme.palette.warning.main, 0.6),
        border: "1px solid ".concat(theme.palette.warning.main),
        '& $icon': {
          color: theme.palette.warning.main
        }
      },
  
      /* Styles applied to the root element if `variant="outlined"` and `color="error"`. */
      outlinedError: {
        color: getColor(theme.palette.error.main, 0.6),
        border: "1px solid ".concat(theme.palette.error.main),
        '& $icon': {
          color: theme.palette.error.main
        }
      },
  
      /* Styles applied to the root element if `variant="filled"` and `color="success"`. */
      filledSuccess: {
        color: '#fff',
        fontWeight: theme.typography.fontWeightMedium,
        backgroundColor: theme.palette.success.main
      },
  
      /* Styles applied to the root element if `variant="filled"` and `color="info"`. */
      filledInfo: {
        color: '#fff',
        fontWeight: theme.typography.fontWeightMedium,
        backgroundColor: theme.palette.info.main
      },
  
      /* Styles applied to the root element if `variant="filled"` and `color="warning"`. */
      filledWarning: {
        color: '#fff',
        fontWeight: theme.typography.fontWeightMedium,
        backgroundColor: theme.palette.warning.main
      },
  
      /* Styles applied to the root element if `variant="filled"` and `color="error"`. */
      filledError: {
        color: '#fff',
        fontWeight: theme.typography.fontWeightMedium,
        backgroundColor: theme.palette.error.main
      },
  
      /* Styles applied to the icon wrapper element. */
      icon: {
        marginRight: 12,
        padding: '7px 0',
        display: 'flex',
        fontSize: 22,
        opacity: 0.9
      },
  
      /* Styles applied to the message wrapper element. */
      message: {
        padding: '8px 0'
      },
  
      /* Styles applied to the action wrapper element if `action` is provided. */
      action: {
        display: 'flex',
        alignItems: 'center',
        marginLeft: 'auto',
        paddingLeft: 16,
        marginRight: -8
      }
    };
  };
  var defaultIconMapping = {
    success: /*#__PURE__*/React.createElement(SuccessOutlinedIcon, {
      fontSize: "inherit"
    }),
    warning: /*#__PURE__*/React.createElement(ReportProblemOutlinedIcon, {
      fontSize: "inherit"
    }),
    error: /*#__PURE__*/React.createElement(ErrorOutlineIcon, {
      fontSize: "inherit"
    }),
    info: /*#__PURE__*/React.createElement(InfoOutlinedIcon, {
      fontSize: "inherit"
    })
  };
  
  var _ref = /*#__PURE__*/React.createElement(CloseIcon, {
    fontSize: "small"
  });
  
  var Alert = React.forwardRef(function Alert(props, ref) {
    var action = props.action,
        children = props.children,
        classes = props.classes,
        className = props.className,
        _props$closeText = props.closeText,
        closeText = _props$closeText === void 0 ? 'Close' : _props$closeText,
        color = props.color,
        icon = props.icon,
        _props$iconMapping = props.iconMapping,
        iconMapping = _props$iconMapping === void 0 ? defaultIconMapping : _props$iconMapping,
        onClose = props.onClose,
        _props$role = props.role,
        role = _props$role === void 0 ? 'alert' : _props$role,
        _props$severity = props.severity,
        severity = _props$severity === void 0 ? 'success' : _props$severity,
        _props$variant = props.variant,
        variant = _props$variant === void 0 ? 'standard' : _props$variant,
        other = _objectWithoutProperties(props, ["action", "children", "classes", "className", "closeText", "color", "icon", "iconMapping", "onClose", "role", "severity", "variant"]);
  
    return /*#__PURE__*/React.createElement(Paper, _extends({
      role: role,
      square: true,
      elevation: 0,
      className: clsx(classes.root, classes["".concat(variant).concat(capitalize(color || severity))], className),
      ref: ref
    }, other), icon !== false ? /*#__PURE__*/React.createElement("div", {
      className: classes.icon
    }, icon || iconMapping[severity] || defaultIconMapping[severity]) : null, /*#__PURE__*/React.createElement("div", {
      className: classes.message
    }, children), action != null ? /*#__PURE__*/React.createElement("div", {
      className: classes.action
    }, action) : null, action == null && onClose ? /*#__PURE__*/React.createElement("div", {
      className: classes.action
    }, /*#__PURE__*/React.createElement(IconButton, {
      size: "small",
      "aria-label": closeText,
      title: closeText,
      color: "inherit",
      onClick: onClose
    }, _ref)) : null);
  });
  process.env.NODE_ENV !== "production" ? Alert.propTypes = {
    // ----------------------------- Warning --------------------------------
    // | These PropTypes are generated from the TypeScript type definitions |
    // |     To update them edit the d.ts file and run "yarn proptypes"     |
    // ----------------------------------------------------------------------
  
    /**
     * The action to display. It renders after the message, at the end of the alert.
     */
    action: PropTypes.node,
  
    /**
     * The content of the component.
     */
    children: PropTypes.node,
  
    /**
     * Override or extend the styles applied to the component.
     * See [CSS API](#css) below for more details.
     */
    classes: PropTypes.object,
  
    /**
     * @ignore
     */
    className: PropTypes.string,
  
    /**
     * Override the default label for the *close popup* icon button.
     *
     * For localization purposes, you can use the provided [translations](/guides/localization/).
     */
    closeText: PropTypes.string,
  
    /**
     * The main color for the alert. Unless provided, the value is taken from the `severity` prop.
     */
    color: PropTypes.oneOf(['error', 'info', 'success', 'warning']),
  
    /**
     * Override the icon displayed before the children.
     * Unless provided, the icon is mapped to the value of the `severity` prop.
     */
    icon: PropTypes.node,
  
    /**
     * The component maps the `severity` prop to a range of different icons,
     * for instance success to `<SuccessOutlined>`.
     * If you wish to change this mapping, you can provide your own.
     * Alternatively, you can use the `icon` prop to override the icon displayed.
     */
    iconMapping: PropTypes.shape({
      error: PropTypes.node,
      info: PropTypes.node,
      success: PropTypes.node,
      warning: PropTypes.node
    }),
  
    /**
     * Callback fired when the component requests to be closed.
     * When provided and no `action` prop is set, a close icon button is displayed that triggers the callback when clicked.
     *
     * @param {object} event The event source of the callback.
     */
    onClose: PropTypes.func,
  
    /**
     * The ARIA role attribute of the element.
     */
    role: PropTypes.string,
  
    /**
     * The severity of the alert. This defines the color and icon used.
     */
    severity: PropTypes.oneOf(['error', 'info', 'success', 'warning']),
  
    /**
     * The variant to use.
     */
    variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
  } : void 0;
  export default withStyles(styles, {
    name: 'MuiAlert'
  })(Alert);