import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
import React from 'react';
import { Component } from 'react';
import CrossIcon from '@atlaskit/icon/core/migration/cross';
import { MediaButton, hideControlsClassName, InactivityDetector } from '@atlaskit/media-ui';
import { CloseButtonWrapper, ContentWrapper } from './styleWrappers';
export var Content = /*#__PURE__*/function (_Component) {
  function Content() {
    _classCallCheck(this, Content);
    return _callSuper(this, Content, arguments);
  }
  _inherits(Content, _Component);
  return _createClass(Content, [{
    key: "render",
    value:
    /*
     * Here we get called by InactivityDetector and given a function we
     * pass down as "showControls" to out children.
     */
    function render() {
      var _this = this;
      var _this$props = this.props,
        onClose = _this$props.onClose,
        isSidebarVisible = _this$props.isSidebarVisible;
      return /*#__PURE__*/React.createElement(ContentWrapper, {
        isSidebarVisible: isSidebarVisible
      }, /*#__PURE__*/React.createElement(InactivityDetector, null, function (triggerActivityCallback) {
        var children = /*#__PURE__*/React.cloneElement(_this.props.children, {
          showControls: triggerActivityCallback
        });
        return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CloseButtonWrapper, {
          className: hideControlsClassName
        }, /*#__PURE__*/React.createElement(MediaButton, {
          testId: "media-viewer-close-button",
          onClick: onClose,
          iconBefore: /*#__PURE__*/React.createElement(CrossIcon, {
            color: "currentColor",
            spacing: "spacious",
            label: "Close"
          })
        })), children);
      }));
    }
  }]);
}(Component);