"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

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

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

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var GameController = function GameController(_ref) {
  var _ref$onRun = _ref.onRun,
      onRun = _ref$onRun === void 0 ? console.log : _ref$onRun,
      _ref$onSubmit = _ref.onSubmit,
      onSubmit = _ref$onSubmit === void 0 ? console.log : _ref$onSubmit,
      _ref$onClear = _ref.onClear,
      onClear = _ref$onClear === void 0 ? console.log : _ref$onClear,
      _ref$runImg = _ref.runImg,
      runImg = _ref$runImg === void 0 ? require('./runbg.png') : _ref$runImg,
      _ref$clearImg = _ref.clearImg,
      clearImg = _ref$clearImg === void 0 ? require('./clearbg.png') : _ref$clearImg,
      submitImg = _ref.submitImg,
      _ref$renderRun = _ref.renderRun,
      renderRun = _ref$renderRun === void 0 ? function () {
    return _react["default"].createElement("img", {
      style: {
        height: 20
      },
      src: require('./run.png')
    });
  } : _ref$renderRun,
      _ref$renderClear = _ref.renderClear,
      renderClear = _ref$renderClear === void 0 ? function () {
    return _react["default"].createElement("img", {
      style: {
        height: 20
      },
      src: require('./clear.png')
    });
  } : _ref$renderClear,
      _ref$style = _ref.style,
      style = _ref$style === void 0 ? {
    display: 'flex',
    flexDirection: 'column'
  } : _ref$style;

  var _style$runButtonStyle = style.runButtonStyle,
      runButtonStyle = _style$runButtonStyle === void 0 ? {
    backgroundColor: 'transparent',
    border: 'none',
    backgroundSize: '100% 100%',
    padding: 10,
    marginBottom: 5
  } : _style$runButtonStyle,
      _style$clearButtonSty = style.clearButtonStyle,
      clearButtonStyle = _style$clearButtonSty === void 0 ? {
    backgroundColor: 'transparent',
    border: 'none',
    backgroundSize: '100% 100%',
    padding: 10,
    marginBottom: 5
  } : _style$clearButtonSty,
      restStyle = _objectWithoutProperties(style, ["runButtonStyle", "clearButtonStyle"]);

  return _react["default"].createElement("div", {
    style: restStyle
  }, _react["default"].createElement("button", {
    style: _objectSpread({}, runButtonStyle, {
      backgroundImage: "url(".concat(runImg, ")")
    }),
    onClick: onRun
  }, renderRun()), _react["default"].createElement("button", {
    style: _objectSpread({}, clearButtonStyle, {
      backgroundImage: "url(".concat(clearImg, ")")
    }),
    onClick: onClear
  }, renderClear()));
};

var _default = GameController;
exports["default"] = _default;