"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.DangerousHTML = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var DangerousHTML =
/*#__PURE__*/
function (_React$Component) {
  (0, _inheritsLoose2.default)(DangerousHTML, _React$Component);

  function DangerousHTML() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = DangerousHTML.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        children = _this$props.children,
        testAutomationId = _this$props.testAutomationId,
        props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["children", "testAutomationId"]);

    if (testAutomationId) {
      props['data-test-automation-id'] = testAutomationId;
    }

    if (typeof children === 'string') {
      props.dangerouslySetInnerHTML = {
        __html: children
      };
    } else {
      props.children = children;
    }

    return _react.default.createElement("div", (0, _extends2.default)({
      className: "inline-block"
    }, props));
  };

  return DangerousHTML;
}(_react.default.Component);

exports.DangerousHTML = DangerousHTML;
(0, _defineProperty2.default)(DangerousHTML, "propTypes", {
  children: _propTypes.default.node.isRequired,
  testAutomationId: _propTypes.default.string
});
(0, _defineProperty2.default)(DangerousHTML, "defaultProps", {
  testAutomationId: null
});