text: "use strict";
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.JobHeader = void 0;
  
  var _get3 = _interopRequireDefault(require("lodash/get"));
  
  var _react = _interopRequireDefault(require("react"));
  
  var _propTypes = _interopRequireDefault(require("prop-types"));
  
  var _classnames = _interopRequireDefault(require("classnames"));
  
  var _dateFns = require("date-fns");
  
  var _utils = require("@bundle-stats/utils");
  
  var _flexStack = require("../../layout/flex-stack");
  
  var _stack = require("../../layout/stack");
  
  var _icon = require("../../ui/icon");
  
  var _jobHeaderModule = _interopRequireDefault(require("./job-header.module.css"));
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  
  var JobHeader = function JobHeader(props) {
    var className = props.className,
        tag = props.tag,
        job = props.job,
        children = props.children;
  
    var _get2 = (0, _get3["default"])(job, "meta.".concat(_utils.SOURCE_PATH_WEBPACK_STATS), {}),
        builtAt = _get2.builtAt,
        hash = _get2.hash;
  
    var rootClassName = (0, _classnames["default"])(_jobHeaderModule["default"].root, className);
    return /*#__PURE__*/_react["default"].createElement(_stack.Stack, {
      className: rootClassName,
      space: "xxsmall"
    }, /*#__PURE__*/_react["default"].createElement("h1", {
      className: _jobHeaderModule["default"].title
    }, /*#__PURE__*/_react["default"].createElement("span", null, "#".concat(job.internalBuildNumber)), tag && /*#__PURE__*/_react["default"].createElement("span", {
      className: _jobHeaderModule["default"].tag
    }, tag)), /*#__PURE__*/_react["default"].createElement(_flexStack.FlexStack, {
      className: _jobHeaderModule["default"].meta,
      space: "xxsmall"
    }, builtAt && /*#__PURE__*/_react["default"].createElement("span", {
      className: _jobHeaderModule["default"].metaItem,
      title: "".concat((0, _utils.formatDate)(builtAt), " ").concat((0, _utils.formatTime)(builtAt))
    }, /*#__PURE__*/_react["default"].createElement(_icon.Icon, {
      glyph: "clock",
      className: _jobHeaderModule["default"].metaIcon
    }), /*#__PURE__*/_react["default"].createElement("span", {
      className: _jobHeaderModule["default"].metaLabel
    }, (0, _dateFns.formatDistanceToNow)(new Date(builtAt), {
      addSuffix: true
    }))), hash && /*#__PURE__*/_react["default"].createElement("span", {
      className: _jobHeaderModule["default"].metaItem,
      title: "Webpack bundle hash"
    }, /*#__PURE__*/_react["default"].createElement(_icon.Icon, {
      glyph: "commit",
      className: _jobHeaderModule["default"].metaIcon
    }), /*#__PURE__*/_react["default"].createElement("span", {
      className: _jobHeaderModule["default"].metaLabel
    }, hash)), /*#__PURE__*/_react["default"].createElement("div", {
      className: _jobHeaderModule["default"].content
    }, children)));
  };
  
  exports.JobHeader = JobHeader;
  JobHeader.propTypes = {
    className: _propTypes["default"].string,
    tag: _propTypes["default"].string,
    job: _propTypes["default"].shape({
      internalBuildNumber: _propTypes["default"].number,
      meta: _propTypes["default"].shape({
        builtAt: _propTypes["default"].string
      }),
      summary: _propTypes["default"].object // eslint-disable-line react/forbid-prop-types
  
    }),
    children: _propTypes["default"].element
  };
  JobHeader.defaultProps = {
    className: '',
    tag: '',
    job: null,
    children: null
  };