"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ReportViewerPage;

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

var _reactIntl = require("react-intl");

var _ContentViewerPage = _interopRequireDefault(require("./ContentViewerPage"));

var _getErrorDescription = _interopRequireDefault(require("../../helpers/getErrorDescription"));

var _ContentViewerPage2 = _interopRequireDefault(require("../../../styles/cspace-ui/ContentViewerPage.css"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

const messages = (0, _reactIntl.defineMessages)({
  error: {
    "id": "reportViewerPage.error",
    "defaultMessage": "Error running report: {error}"
  },
  loading: {
    "id": "reportViewerPage.loading",
    "defaultMessage": "Generating report\u2026"
  }
});

const renderLoading = () => /*#__PURE__*/_react.default.createElement("div", {
  className: _ContentViewerPage2.default.pending
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, messages.loading));

const renderError = error => /*#__PURE__*/_react.default.createElement("div", {
  className: _ContentViewerPage2.default.error
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, _extends({}, messages.error, {
  values: {
    error: (0, _getErrorDescription.default)(error)
  }
})));

function ReportViewerPage(props) {
  return /*#__PURE__*/_react.default.createElement(_ContentViewerPage.default, _extends({
    renderError: renderError,
    renderLoading: renderLoading
  }, props));
}