"use strict";

exports.__esModule = true;
exports.default = void 0;
var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _forumPost = _interopRequireDefault(require("../forum-post"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const ForumThread = props => {
  const {
    answers = [],
    mainPost = false
  } = props;
  const answersView = answers.map(answerProps => /*#__PURE__*/_react.default.createElement(ForumThread, _extends({}, answerProps, {
    key: answerProps.id
  })));
  return /*#__PURE__*/_react.default.createElement("div", {
    className: mainPost ? _style.default.mainPost : null
  }, /*#__PURE__*/_react.default.createElement(_forumPost.default, _extends({}, props, {
    mainPost: mainPost && !(0, _isEmpty2.default)(answers)
  })), /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "forumAnswers",
    className: _style.default.answers
  }, answersView));
};
ForumThread.propTypes = process.env.NODE_ENV !== "production" ? {
  answers: _propTypes.default.arrayOf(_propTypes.default.shape(ForumThread.propTypes)),
  mainPost: _propTypes.default.bool
} : {};
var _default = exports.default = ForumThread;
//# sourceMappingURL=index.js.map