import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import ErrorText from './ErrorText';
import HelpText from './HelpText';
import SuccessText from './SuccessText';
import WarningText from './WarningText';
/** @type {React.ComponentType<any>} */

var ValidationText = /*#__PURE__*/function (_PureComponent) {
  _inherits(ValidationText, _PureComponent);

  var _super = _createSuper(ValidationText);

  function ValidationText() {
    _classCallCheck(this, ValidationText);

    return _super.apply(this, arguments);
  }

  _createClass(ValidationText, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          error = _this$props.error,
          inverse = _this$props.inverse,
          help = _this$props.help,
          success = _this$props.success,
          warning = _this$props.warning;

      if (error && typeof error !== 'boolean') {
        return /*#__PURE__*/React.createElement(ErrorText, {
          inverse: inverse
        }, error);
      }

      if (warning && typeof warning !== 'boolean') {
        return /*#__PURE__*/React.createElement(WarningText, {
          inverse: inverse
        }, warning);
      }

      if (success && typeof success !== 'boolean') {
        return /*#__PURE__*/React.createElement(SuccessText, {
          inverse: inverse
        }, success);
      }

      if (help) {
        return /*#__PURE__*/React.createElement(HelpText, {
          inverse: inverse
        }, help);
      }

      return null;
    }
  }]);

  return ValidationText;
}(PureComponent);

export default ValidationText;