"use strict";

exports.__esModule = true;
exports.default = void 0;
var _extend2 = _interopRequireDefault(require("lodash/fp/extend"));
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _resourcePlayer = _interopRequireWildcard(require("../resource-player"));
var _style = _interopRequireDefault(require("./style.css"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const Feedback = (props, context) => {
  const {
    media,
    mediaDescription,
    title,
    description,
    mode = 'default'
  } = props;
  const resource = media && media.type && {
    ...media,
    ...(0, _pipe2.default)((0, _get2.default)('src.0'), (0, _extend2.default)({
      description: mediaDescription
    }))(media)
  };
  return (resource || title || description ? /*#__PURE__*/_react.default.createElement("div", {
    className: mode === 'scorm' ? _style.default.feedbackContainerScorm : null
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.feedback,
    "data-name": "feedback",
    id: "feedback"
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _classnames.default)(_style.default.title, _style.default.innerHTML),
    "data-name": "title"
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: title
    }
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.descWrapper
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _classnames.default)(_style.default.description, _style.default.innerHTML),
    "data-name": "description"
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: description
    }
  }), resource ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_resourcePlayer.default, {
    className: _style.default.resourcePlayer,
    resource: resource
  }), /*#__PURE__*/_react.default.createElement("div", {
    "data-name": "mediaDescription",
    className: (0, _classnames.default)(_style.default.mediaDescription, _style.default.innerHTML)
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: mediaDescription
    }
  })) : null))) : null) || null;
};
Feedback.propTypes = process.env.NODE_ENV !== "production" ? {
  title: _propTypes.default.string,
  description: _propTypes.default.string,
  media: _propTypes.default.shape({
    type: _propTypes.default.oneOf([_resourcePlayer.TYPE_IMAGE, _resourcePlayer.TYPE_PDF, _resourcePlayer.TYPE_VIDEO, _resourcePlayer.TYPE_AUDIO]),
    src: _propTypes.default.arrayOf(_propTypes.default.any)
  }),
  mediaDescription: _propTypes.default.string
} : {};
var _default = exports.default = Feedback;
//# sourceMappingURL=index.js.map