text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports["default"] = void 0;
  
  var React = _interopRequireWildcard(require("react"));
  
  var _propTypes = _interopRequireDefault(require("prop-types"));
  
  var _clsx = _interopRequireDefault(require("clsx"));
  
  var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallback"));
  
  var useEnhancedEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
  /**
   * @ignore - internal component.
   */
  
  function Ripple(props) {
    var classes = props.classes,
        _props$pulsate = props.pulsate,
        pulsate = _props$pulsate === void 0 ? false : _props$pulsate,
        rippleX = props.rippleX,
        rippleY = props.rippleY,
        rippleSize = props.rippleSize,
        inProp = props["in"],
        _props$onExited = props.onExited,
        onExited = _props$onExited === void 0 ? function () {} : _props$onExited,
        timeout = props.timeout;
  
    var _React$useState = React.useState(false),
        leaving = _React$useState[0],
        setLeaving = _React$useState[1];
  
    var rippleClassName = (0, _clsx["default"])(classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
    var rippleStyles = {
      width: rippleSize,
      height: rippleSize,
      top: -(rippleSize / 2) + rippleY,
      left: -(rippleSize / 2) + rippleX
    };
    var childClassName = (0, _clsx["default"])(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
    var handleExited = (0, _useEventCallback["default"])(onExited); // Ripple is used for user feedback (e.g. click or press) so we want to apply styles with the highest priority
  
    useEnhancedEffect(function () {
      if (!inProp) {
        // react-transition-group#onExit
        setLeaving(true); // react-transition-group#onExited
  
        var timeoutId = setTimeout(handleExited, timeout);
        return function () {
          clearTimeout(timeoutId);
        };
      }
  
      return undefined;
    }, [handleExited, inProp, timeout]);
    return /*#__PURE__*/React.createElement("span", {
      className: rippleClassName,
      style: rippleStyles
    }, /*#__PURE__*/React.createElement("span", {
      className: childClassName
    }));
  }
  
  process.env.NODE_ENV !== "production" ? Ripple.propTypes = {
    /**
     * Override or extend the styles applied to the component.
     * See [CSS API](#css) below for more details.
     */
    classes: _propTypes["default"].object.isRequired,
  
    /**
     * @ignore - injected from TransitionGroup
     */
    "in": _propTypes["default"].bool,
  
    /**
     * @ignore - injected from TransitionGroup
     */
    onExited: _propTypes["default"].func,
  
    /**
     * If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.
     */
    pulsate: _propTypes["default"].bool,
  
    /**
     * Diameter of the ripple.
     */
    rippleSize: _propTypes["default"].number,
  
    /**
     * Horizontal position of the ripple center.
     */
    rippleX: _propTypes["default"].number,
  
    /**
     * Vertical position of the ripple center.
     */
    rippleY: _propTypes["default"].number,
  
    /**
     * exit delay
     */
    timeout: _propTypes["default"].number.isRequired
  } : void 0;
  var _default = Ripple;
  exports["default"] = _default;