import _extends from "@babel/runtime/helpers/extends";
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";
import _defineProperty from "@babel/runtime/helpers/defineProperty";

var _dec, _class, _class2, _temp;

import React, { PureComponent } from 'react';
import { withTheme } from '@material-ui/core/styles';
import PropTypes from 'prop-types';
import { style } from 'typestyle';
import { emphasize, fade } from '@material-ui/core/styles/colorManipulator';
import DirCard from './DirCard';
import getHierarchy from './getHierarchy';

var getCn = function getCn(props) {
  return {
    root: style({
      boxSizing: 'border-box',
      width: '100%',
      paddingBottom: 40,
      overflowX: 'hidden',
      overflowY: 'scroll',
      fontFamily: props.theme.fontFamily,
      backgroundColor: fade(emphasize(props.theme.palette.background.paper, 1), 0.07)
    })
  };
};

var Root = (_dec = withTheme(), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_PureComponent) {
  _inherits(Root, _PureComponent);

  function Root() {
    _classCallCheck(this, Root);

    return _possibleConstructorReturn(this, _getPrototypeOf(Root).apply(this, arguments));
  }

  _createClass(Root, [{
    key: "render",
    value: function render() {
      var dcn = getCn(this.props);
      var showingFiles = this.props.showingFiles;
      var transfer = {
        isDirOpened: this.props.isDirOpened,
        handleFileSelect: this.props.handleFileSelect,
        handleDirToggle: this.props.handleDirToggle,
        handleFileMove: this.props.handleFileMove,
        handleNativeDrop: this.props.handleNativeDrop,
        openFileDialog: this.props.openFileDialog
      };
      return React.createElement("div", {
        className: dcn.root
      }, React.createElement(DirCard, _extends({
        dir: getHierarchy(showingFiles)
      }, transfer, {
        isRoot: true
      })));
    }
  }]);

  return Root;
}(PureComponent), _defineProperty(_class2, "propTypes", {
  theme: PropTypes.object.isRequired,
  showingFiles: PropTypes.array.isRequired,
  isDirOpened: PropTypes.func.isRequired,
  handleFileSelect: PropTypes.func.isRequired,
  handleDirToggle: PropTypes.func.isRequired,
  handleFileMove: PropTypes.func.isRequired,
  handleNativeDrop: PropTypes.func.isRequired,
  openFileDialog: PropTypes.func.isRequired
}), _temp)) || _class);
export { Root as default };