text: "use strict";
  
  exports.__esModule = true;
  exports.CmdButton = exports.CmdDiv = exports.CmdSwitch = exports.CmdCheckbox = exports.withCommand = undefined;
  
  var _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; };
  
  var _react = require("react");
  
  var _react2 = _interopRequireDefault(_react);
  
  var _core = require("@blueprintjs/core");
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
  
  var withCommand = function withCommand(mappings) {
    return function (WrappedComponent) {
      return function (_ref) {
        var cmd = _ref.cmd,
            _ref$cmdOptions = _ref.cmdOptions,
            cmdOptions = _ref$cmdOptions === undefined ? {} : _ref$cmdOptions,
            props = _objectWithoutProperties(_ref, ["cmd", "cmdOptions"]);
  
        var mappedProps = {};
        Object.keys(mappings).forEach(function (k) {
          mappedProps[k] = mappings[k] === "execute" ? function (event) {
            return cmd.execute({ event: event });
          } : typeof mappings[k] === "function" ? mappings[k](cmd, props) : cmd[mappings[k]];
        });
  
        var out = _react2.default.createElement(WrappedComponent, _extends({}, props, mappedProps));
        var tooltip = cmd.tooltip || typeof cmd.isDisabled === "string" && cmd.isDisabled;
        if (tooltip && !cmdOptions.ignoreTooltip) {
          out = _react2.default.createElement(
            _core.Tooltip,
            { content: tooltip },
            out
          );
        }
  
        return cmd.isHidden && !cmdOptions.ignoreHidden ? null : out;
      };
    };
  };
  
  exports.withCommand = withCommand;
  var CmdCheckbox = exports.CmdCheckbox = withCommand({
    onChange: "execute",
    label: function label(cmd, props) {
      return props.name || props.prefix && _react2.default.createElement(
        _react2.default.Fragment,
        null,
        props.prefix,
        cmd.name
      ) || cmd.name;
    },
    disabled: "isDisabled",
    checked: "isActive"
  })(_core.Checkbox);
  
  var CmdSwitch = exports.CmdSwitch = withCommand({
    onChange: "execute",
    label: function label(cmd, props) {
      return props.name || props.prefix && _react2.default.createElement(
        _react2.default.Fragment,
        null,
        props.prefix,
        cmd.name
      ) || cmd.name;
    },
    disabled: "isDisabled",
    checked: "isActive"
  })(_core.Switch);
  
  var Div = function Div(_ref2) {
    var onChange = _ref2.onChange,
        children = _ref2.children;
  
    return _react2.default.createElement(
      "div",
      { onClick: onChange },
      children
    );
  };
  
  var CmdDiv = exports.CmdDiv = withCommand({
    onChange: "execute",
    children: function children(cmd, props) {
      return props.name || props.prefix && _react2.default.createElement(
        _react2.default.Fragment,
        null,
        props.prefix,
        cmd.name
      ) || cmd.name;
    },
    disabled: "isDisabled",
    checked: "isActive"
  })(Div);
  
  var CmdButton = exports.CmdButton = withCommand({
    onClick: "execute",
    text: function text(cmd) {
      return cmd.isActive === false && cmd.inactiveName || cmd.name;
    },
    icon: "icon",
    disabled: "isDisabled"
  })(_core.Button);