'use strict';

require('core-js/modules/es.symbol.js');
require('core-js/modules/es.array.filter.js');
require('core-js/modules/es.object.get-own-property-descriptor.js');
require('core-js/modules/es.object.get-own-property-descriptors.js');
require('core-js/modules/es.object.keys.js');
require('core-js/modules/es.object.to-string.js');
require('core-js/modules/web.dom-collections.for-each.js');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var React = require('react');
var PropTypes = require('prop-types');
var Minimap = require('./Minimap.js');
var iconsReact = require('@carbon/icons-react');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var React__default = /*#__PURE__*/_interopDefault(React);
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var propTypes = _objectSpread(_objectSpread({}, Minimap.MinimapPropTypes), {}, {
  draggable: PropTypes__default.default.bool,
  dragging: PropTypes__default.default.bool,
  hideMinimap: PropTypes__default.default.bool,
  onZoomToFit: PropTypes__default.default.func.isRequired,
  onZoomOut: PropTypes__default.default.func.isRequired,
  onZoomIn: PropTypes__default.default.func.isRequired,
  i18n: PropTypes__default.default.shape({
    zoomIn: PropTypes__default.default.string,
    zoomOut: PropTypes__default.default.string,
    zoomToFit: PropTypes__default.default.string
  }).isRequired
});
var defaultProps = {
  draggable: false,
  dragging: false,
  hideMinimap: false
};
var ImageControls = function ImageControls(_ref) {
  var minimap = _ref.minimap,
    draggable = _ref.draggable,
    dragging = _ref.dragging,
    hideMinimap = _ref.hideMinimap,
    onZoomToFit = _ref.onZoomToFit,
    onZoomIn = _ref.onZoomIn,
    onZoomOut = _ref.onZoomOut,
    _ref$i18n = _ref.i18n,
    zoomToFit = _ref$i18n.zoomToFit,
    zoomIn = _ref$i18n.zoomIn,
    zoomOut = _ref$i18n.zoomOut;
  var bottomControlsStyle = {
    position: 'absolute',
    bottom: 10,
    right: 10,
    pointerEvents: dragging ? 'none' : 'auto'
  };
  var buttonStyle = {
    width: '25px',
    height: '25px',
    border: 'none',
    background: '#fff',
    boxShadow: '0px 0px 2px 0px rgba(0,0,0,0.5)',
    display: 'flex',
    justifyContent: 'center',
    alignItems: 'center'
  };
  return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement("div", {
    style: bottomControlsStyle
  }, draggable && /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement("button", {
    type: "button",
    style: buttonStyle,
    onClick: onZoomToFit
  }, /*#__PURE__*/React__default.default.createElement(iconsReact.Minimize, {
    size: 20,
    "aria-label": zoomToFit
  })), /*#__PURE__*/React__default.default.createElement("br", null)), /*#__PURE__*/React__default.default.createElement("button", {
    title: zoomIn,
    type: "button",
    style: buttonStyle,
    onClick: onZoomIn
  }, "+"), /*#__PURE__*/React__default.default.createElement("button", {
    title: zoomOut,
    type: "button",
    style: buttonStyle,
    onClick: onZoomOut
  }, "-")), !hideMinimap && /*#__PURE__*/React__default.default.createElement(Minimap.default, minimap));
};
ImageControls.propTypes = propTypes;
ImageControls.defaultProps = defaultProps;
ImageControls.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "ImageControls",
  "props": {
    "draggable": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "dragging": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hideMinimap": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "onZoomToFit": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "onZoomOut": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "onZoomIn": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "i18n": {
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "zoomIn": {
            "name": "string",
            "required": false
          },
          "zoomOut": {
            "name": "string",
            "required": false
          },
          "zoomToFit": {
            "name": "string",
            "required": false
          }
        }
      },
      "required": true
    }
  },
  "composes": ["./Minimap"]
};
var ImageControls$1 = ImageControls;

module.exports = ImageControls$1;
