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AqB,IAErB,qBAAsB,KAExB,WAAW,aAAe,CAExB,KAAM,EAEN,KAAM,EAEN,KAAM,EAEN,OAAQ,QAEV,QAAQ,QAAU","file":"/npm/@dior/react-prismazoom@1.2.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@dior/react-prismazoom@1.2.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');\n\nvar _slicedToArray3 = _interopRequireDefault(_slicedToArray2);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar PrismaZoom = function (_PureComponent) {\n  (0, _inherits3.default)(PrismaZoom, _PureComponent);\n\n  function PrismaZoom(props) {\n    (0, _classCallCheck3.default)(this, PrismaZoom);\n\n    // Last cursor position\n    var _this = (0, _possibleConstructorReturn3.default)(this, (PrismaZoom.__proto__ || Object.getPrototypeOf(PrismaZoom)).call(this, props));\n\n    _this.getNewPosition = function (x, y, zoom) {\n      var _ref = [_this.state.zoom, _this.state.posX, _this.state.posY],\n          prevZoom = _ref[0],\n          prevPosX = _ref[1],\n          prevPosY = _ref[2];\n\n\n      if (zoom === 1) {\n        return [0, 0];\n      }\n\n      if (zoom > prevZoom) {\n        // Get container coordinates\n        var rect = _this.refs.layout.getBoundingClientRect();\n\n        // Retrieve rectangle dimensions and mouse position\n        var centerX = rect.width / 2,\n            centerY = rect.height / 2;\n        var relativeX = x - rect.left - window.pageXOffset,\n            relativeY = y - rect.top - window.pageYOffset;\n\n        // If we are zooming down, we must try to center to mouse position\n\n        var absX = (centerX - relativeX) / prevZoom,\n            absY = (centerY - relativeY) / prevZoom;\n\n        var ratio = zoom - prevZoom;\n        return [prevPosX + absX * ratio, prevPosY + absY * ratio];\n      } else {\n        // If we are zooming down, we shall re-center the element\n        return [prevPosX * (zoom - 1) / (prevZoom - 1), prevPosY * (zoom - 1) / (prevZoom - 1)];\n      }\n    };\n\n    _this.getLimitedShift = function (shift, minLimit, maxLimit, minElement, maxElement) {\n      if (shift > 0) {\n        if (minElement > minLimit) {\n          // Forbid move if we are moving to left or top while we are already out minimum boudaries\n          return 0;\n        } else if (minElement + shift > minLimit) {\n          // Lower the shift if we are going out boundaries\n          return minLimit - minElement;\n        }\n      } else if (shift < 0) {\n        if (maxElement < maxLimit) {\n          // Forbid move if we are moving to right or bottom while we are already out maximum boudaries\n          return 0;\n        } else if (maxElement + shift < maxLimit) {\n          // Lower the shift if we are going out boundaries\n          return maxLimit - maxElement;\n        }\n      }\n\n      return shift;\n    };\n\n    _this.getCursor = function (canMoveOnX, canMoveOnY) {\n      if (canMoveOnX && canMoveOnY) {\n        return 'move';\n      } else if (canMoveOnX) {\n        return 'ew-resize';\n      } else if (canMoveOnY) {\n        return 'ns-resize';\n      } else {\n        return 'auto';\n      }\n    };\n\n    _this.fullZoomInOnPosition = function (x, y) {\n      var maxZoom = _this.props.maxZoom;\n\n\n      var zoom = maxZoom;\n\n      var _this$getNewPosition = _this.getNewPosition(x, y, zoom),\n          _this$getNewPosition2 = (0, _slicedToArray3.default)(_this$getNewPosition, 2),\n          posX = _this$getNewPosition2[0],\n          posY = _this$getNewPosition2[1];\n\n      _this.setState({ zoom: zoom, posX: posX, posY: posY, transitionDuration: _this.props.animDuration });\n    };\n\n    _this.move = function (shiftX, shiftY) {\n      var transitionDuration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n      var _this$props = _this.props,\n          leftBoundary = _this$props.leftBoundary,\n          rightBoundary = _this$props.rightBoundary,\n          topBoundary = _this$props.topBoundary,\n          bottomBoundary = _this$props.bottomBoundary;\n      var _this$state = _this.state,\n          posX = _this$state.posX,\n          posY = _this$state.posY;\n\n      // Get container and container's parent coordinates\n\n      var rect = _this.refs.layout.getBoundingClientRect();\n      var parentRect = _this.refs.layout.parentNode.getBoundingClientRect();\n\n      //Calculate limits on X axis (browser content area minus limits set via props)\n      var leftLimit = leftBoundary,\n          rightLimit = window.innerWidth - rightBoundary;\n      var isOutLeftBoundary =\n      // Check if the element is out its container left boundary\n      shiftX > 0 && rect.left < parentRect.left,\n          isOutRightBoundary =\n      // Check if the element is out its container right boundary\n      shiftX < 0 && rect.right > parentRect.right;\n\n\n      var canMoveOnX = isOutLeftBoundary || isOutRightBoundary;\n      if (canMoveOnX) {\n        posX += _this.getLimitedShift(shiftX, leftLimit, rightLimit, rect.left, rect.right);\n      }\n\n      //Calculate limits on Y axis (browser content area minus limits set via props)\n      var topLimit = topBoundary,\n          bottomLimit = window.innerHeight - bottomBoundary;\n      var isOutTopBoundary =\n      // Check if the element is out its container top boundary\n      shiftY > 0 && rect.top < parentRect.top,\n          isOutBottomBoundary =\n      // Check if the element is out its container bottom boundary\n      shiftY < 0 && rect.bottom > parentRect.bottom;\n\n\n      var canMoveOnY = isOutTopBoundary || isOutBottomBoundary;\n      if (canMoveOnY) {\n        posY += _this.getLimitedShift(shiftY, topLimit, bottomLimit, rect.top, rect.bottom);\n      }\n\n      var cursor = _this.getCursor(canMoveOnX, canMoveOnY);\n\n      _this.setState({ posX: posX, posY: posY, cursor: cursor, transitionDuration: transitionDuration });\n    };\n\n    _this.startDeceleration = function (lastShiftOnX, lastShiftOnY) {\n      var startTimestamp = null;\n\n      var move = function move(timestamp) {\n        if (startTimestamp === null) {\n          startTimestamp = timestamp;\n        }\n        var progress = timestamp - startTimestamp;\n\n        // Calculates the ratio to apply on the move (used to create a non-linear deceleration)\n        var ratio = (_this.props.decelerationDuration - progress) / _this.props.decelerationDuration;\n\n        var shiftX = lastShiftOnX * ratio,\n            shiftY = lastShiftOnY * ratio;\n\n        // Continue animation only if time has not expired and if there is still some movement (more than 1 pixel on one axis)\n\n        if (progress < _this.props.decelerationDuration && Math.max(Math.abs(shiftX), Math.abs(shiftY)) > 1) {\n          _this.move(shiftX, shiftY, 0);\n          _this.lastRequestAnimationId = requestAnimationFrame(move);\n        } else {\n          _this.lastRequestAnimationId = null;\n        }\n      };\n\n      _this.lastRequestAnimationId = requestAnimationFrame(move);\n    };\n\n    _this.handleMouseWheel = function (event) {\n      event.preventDefault();\n      var _this$props2 = _this.props,\n          minZoom = _this$props2.minZoom,\n          maxZoom = _this$props2.maxZoom,\n          scrollVelocity = _this$props2.scrollVelocity;\n      var _this$state2 = _this.state,\n          zoom = _this$state2.zoom,\n          posX = _this$state2.posX,\n          posY = _this$state2.posY;\n\n      // Keep the previous zoom value\n\n      var prevZoom = zoom;\n\n      // Determine if we are increasing or decreasing the zoom\n      var increaseZoom = event.deltaY < 0;\n\n      // Set the new zoom value\n      if (increaseZoom) {\n        zoom = zoom + scrollVelocity < maxZoom ? zoom + scrollVelocity : maxZoom;\n      } else {\n        zoom = zoom - scrollVelocity > minZoom ? zoom - scrollVelocity : minZoom;\n      }\n\n      if (zoom !== prevZoom) {\n        if (zoom !== minZoom) {\n          var _this$getNewPosition3 = _this.getNewPosition(event.pageX, event.pageY, zoom);\n\n          var _this$getNewPosition4 = (0, _slicedToArray3.default)(_this$getNewPosition3, 2);\n\n          posX = _this$getNewPosition4[0];\n          posY = _this$getNewPosition4[1];\n        } else {\n          var _ref2 = [_this.constructor.defaultState.posX, _this.constructor.defaultState.posY];\n          // Reset to original position\n\n          posX = _ref2[0];\n          posY = _ref2[1];\n        }\n      }\n\n      _this.setState({ zoom: zoom, posX: posX, posY: posY, transitionDuration: 0.05 });\n    };\n\n    _this.handleDoubleClick = function (event) {\n      event.preventDefault();\n\n      if (_this.state.zoom === _this.props.minZoom) {\n        _this.fullZoomInOnPosition(event.pageX, event.pageY);\n      } else {\n        _this.reset();\n      }\n    };\n\n    _this.handleMouseStart = function (event) {\n      event.preventDefault();\n\n      if (_this.lastRequestAnimationId) {\n        cancelAnimationFrame(_this.lastRequestAnimationId);\n      }\n\n      _this.lastCursor = { posX: event.pageX, posY: event.pageY };\n    };\n\n    _this.handleMouseMove = function (event) {\n      event.preventDefault();\n\n      if (!_this.lastCursor) {\n        return;\n      }\n\n      var _ref3 = [event.pageX, event.pageY],\n          posX = _ref3[0],\n          posY = _ref3[1];\n\n      var shiftX = posX - _this.lastCursor.posX;\n      var shiftY = posY - _this.lastCursor.posY;\n\n      _this.move(shiftX, shiftY, 0);\n      _this.lastCursor = { posX: posX, posY: posY };\n      _this.lastShift = { x: shiftX, y: shiftY };\n    };\n\n    _this.handleMouseStop = function (event) {\n      event.preventDefault();\n\n      if (_this.lastShift) {\n        // Use the last shift to make a decelerating movement effect\n        _this.startDeceleration(_this.lastShift.x, _this.lastShift.y);\n        _this.lastShift = null;\n      }\n\n      _this.lastCursor = null;\n      _this.setState({ cursor: 'auto' });\n    };\n\n    _this.handleTouchStart = function (event) {\n      event.preventDefault();\n\n      if (_this.lastRequestAnimationId) {\n        cancelAnimationFrame(_this.lastRequestAnimationId);\n      }\n\n      var _ref4 = [event.touches[0].pageX, event.touches[0].pageY],\n          posX = _ref4[0],\n          posY = _ref4[1];\n\n\n      if (event.touches.length === 1) {\n        // Check if it is a double tap\n        var touchTime = new Date().getTime();\n        if (touchTime - _this.lastTouchTime < _this.props.doubleTouchMaxDelay && touchTime - _this.lastDoubleTapTime > _this.props.doubleTouchMaxDelay) {\n          if (_this.state.zoom === _this.props.minZoom) {\n            _this.fullZoomInOnPosition(posX, posY);\n          } else {\n            _this.reset();\n          }\n          _this.lastDoubleTapTime = touchTime;\n        }\n\n        _this.lastTouchTime = touchTime;\n      }\n\n      _this.lastTouch = { posX: posX, posY: posY };\n    };\n\n    _this.handleTouchMove = function (event) {\n      event.preventDefault();\n\n      var _this$props3 = _this.props,\n          maxZoom = _this$props3.maxZoom,\n          minZoom = _this$props3.minZoom;\n      var zoom = _this.state.zoom;\n\n\n      if (!_this.lastTouch) {\n        return;\n      }\n\n      if (event.touches.length === 1) {\n        var _ref5 = [event.touches[0].pageX, event.touches[0].pageY],\n            posX = _ref5[0],\n            posY = _ref5[1];\n        // If we detect only one point, we shall just move the element\n\n        var shiftX = posX - _this.lastTouch.posX;\n        var shiftY = posY - _this.lastTouch.posY;\n\n        _this.move(shiftX, shiftY);\n        _this.lastShift = { x: shiftX, y: shiftY\n\n          // Save data for the next move\n        };_this.lastTouch = { posX: posX, posY: posY };\n        _this.lastTouchDistance = null;\n      } else if (event.touches.length > 1) {\n        // If we detect two points, we shall zoom up or down\n        var _ref6 = [event.touches[0].pageX, event.touches[0].pageY],\n            pos1X = _ref6[0],\n            pos1Y = _ref6[1];\n        var _ref7 = [event.touches[1].pageX, event.touches[1].pageY],\n            pos2X = _ref7[0],\n            pos2Y = _ref7[1];\n\n        var distance = Math.sqrt(Math.pow(pos2X - pos1X, 2) + Math.pow(pos2Y - pos1Y, 2));\n\n        if (_this.lastTouchDistance && distance && distance !== _this.lastTouchDistance) {\n          zoom += (distance - _this.lastTouchDistance) / 100;\n          if (zoom > maxZoom) {\n            zoom = maxZoom;\n          } else if (zoom < minZoom) {\n            zoom = minZoom;\n          }\n\n          // Change position using the center point between the two fingers\n          var centerX = (pos1X + pos2X) / 2,\n              centerY = (pos1Y + pos2Y) / 2;\n\n          var _this$getNewPosition5 = _this.getNewPosition(centerX, centerY, zoom),\n              _this$getNewPosition6 = (0, _slicedToArray3.default)(_this$getNewPosition5, 2),\n              _posX = _this$getNewPosition6[0],\n              _posY = _this$getNewPosition6[1];\n\n          _this.setState({ zoom: zoom, posX: _posX, posY: _posY, transitionDuration: 0 });\n        }\n\n        // Save data for the next move\n        _this.lastTouch = { posX: pos1X, posY: pos1Y };\n        _this.lastTouchDistance = distance;\n      }\n    };\n\n    _this.handleTouchStop = function () {\n      if (_this.lastShift) {\n        // Use the last shift to make a decelerating movement effect\n        _this.startDeceleration(_this.lastShift.x, _this.lastShift.y);\n        _this.lastShift = null;\n      }\n\n      _this.lastTouch = null;\n      _this.lastTouchDistance = null;\n    };\n\n    _this.zoomIn = function (value) {\n      var maxZoom = _this.props.maxZoom;\n      var _this$state3 = _this.state,\n          zoom = _this$state3.zoom,\n          posX = _this$state3.posX,\n          posY = _this$state3.posY;\n\n\n      var prevZoom = zoom;\n\n      zoom = zoom + value < maxZoom ? zoom + value : maxZoom;\n\n      if (zoom !== prevZoom) {\n        posX = posX * (zoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);\n        posY = posY * (zoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);\n      }\n\n      _this.setState({ zoom: zoom, posX: posX, posY: posY, transitionDuration: _this.props.animDuration });\n    };\n\n    _this.zoomOut = function (value) {\n      var minZoom = _this.props.minZoom;\n      var _this$state4 = _this.state,\n          zoom = _this$state4.zoom,\n          posX = _this$state4.posX,\n          posY = _this$state4.posY;\n\n\n      var prevZoom = zoom;\n\n      zoom = zoom - value > minZoom ? zoom - value : minZoom;\n\n      if (zoom !== prevZoom) {\n        posX = posX * (zoom - 1) / (prevZoom - 1);\n        posY = posY * (zoom - 1) / (prevZoom - 1);\n      }\n\n      _this.setState({ zoom: zoom, posX: posX, posY: posY, transitionDuration: _this.props.animDuration });\n    };\n\n    _this.zoomToZone = function (relX, relY, relWidth, relHeight) {\n      var _this$props4 = _this.props,\n          maxZoom = _this$props4.maxZoom,\n          leftBoundary = _this$props4.leftBoundary,\n          rightBoundary = _this$props4.rightBoundary,\n          topBoundary = _this$props4.topBoundary,\n          bottomBoundary = _this$props4.bottomBoundary;\n      var _this$state5 = _this.state,\n          zoom = _this$state5.zoom,\n          posX = _this$state5.posX,\n          posY = _this$state5.posY;\n\n\n      var prevZoom = zoom;\n\n      // Calculate zoom factor to scale the zone\n      var optimalZoomX = (window.innerWidth - leftBoundary - rightBoundary) / relWidth;\n      var optimalZoomY = (window.innerHight - topBoundary - bottomBoundary) / relHeight;\n      zoom = Math.min(optimalZoomX, optimalZoomY, maxZoom);\n\n      // Calculate new position to center the zone\n      var rect = _this.refs.layout.getBoundingClientRect();\n      var centerX = rect.width / prevZoom / 2,\n          centerY = rect.height / prevZoom / 2;\n      var zoneCenterX = relX + relWidth / 2,\n          zoneCenterY = relY + relHeight / 2;\n\n      posX = (centerX - zoneCenterX) * zoom;\n      posY = (centerY - zoneCenterY) * zoom;\n\n      _this.setState({ zoom: zoom, posX: posX, posY: posY, transitionDuration: _this.props.animDuration });\n    };\n\n    _this.reset = function () {\n      _this.setState((0, _extends3.default)({}, _this.constructor.defaultState, {\n        transitionDuration: _this.props.animDuration\n      }));\n    };\n\n    _this.getZoom = function () {\n      return _this.state.zoom;\n    };\n\n    _this.lastCursor = null;\n    // Last touch position\n    _this.lastTouch = null;\n    // Last touch time in milliseconds\n    _this.lastTouchTime = 0;\n    // Last double tap time (used to limit multiple double tap) in milliseconds\n    _this.lastDoubleTapTime = 0;\n    // Last calculated distance between two fingers in pixels\n    _this.lastTouchDistance = null;\n    // Last request animation frame identifier\n    _this.lastRequestAnimationId = null;\n\n    _this.state = (0, _extends3.default)({}, _this.constructor.defaultState, {\n      transitionDuration: props.animDuration\n    });\n    return _this;\n  }\n\n  /**\n   * Calculates new translate positions for CSS transformations.\n   * @param  {Number} x     Relative (rect-based) X position in pixels\n   * @param  {Number} y     Relative (rect-based) Y position in pixels\n   * @param  {Number} zoom  Scale value\n   * @return {Array}        New X and Y positions\n   */\n\n\n  /**\n   * Calculates the narrowed shift for panning actions.\n   * @param  {Number} shift      Initial shift in pixels\n   * @param  {Number} minLimit   Minimum limit (left or top) in pixels\n   * @param  {Number} maxLimit   Maximum limit (right or bottom) in pixels\n   * @param  {Number} minElement Left or top element position in pixels\n   * @param  {Number} maxElement Right or bottom element position in pixels\n   * @return {Number}            Narrowed shift\n   */\n\n\n  /**\n   * Determines cursor style.\n   * @param  {Boolean} canMoveOnX Element can be panned on the X axis\n   * @param  {Boolean} canMoveOnY Element can be panned on the Y axis\n   * @return {String}             Cursor style\n   */\n\n\n  /**\n   * Applies a full-zoom on the specified X and Y positions\n   * @param  {Number} x Relative (rect-based) X position in pixels\n   * @param  {Number} y Relative (rect-based) Y position in pixels\n   */\n\n\n  /**\n   * Moves the element by incrementing its position with given X and Y values.\n   * @param  {Number} shiftX             Position change to apply on X axis in pixels\n   * @param  {Number} shiftY             Position change to apply on Y axis in pixels\n   * @param  {Number} transitionDuration Transition duration (in seconds)\n   */\n\n\n  /**\n   * Trigger a decelerating movement after a mouse up or a touch end event, using the last movement shift.\n   * @param  {Number} lastShiftOnX Last shift on the X axis in pixels\n   * @param  {Number} lastShiftOnY Last shift on the Y axis in pixels\n   */\n\n\n  /**\n   * Event handler on scroll.\n   * @param  {MouseEvent} event Mouse event\n   */\n\n\n  /**\n   * Event handler on double click.\n   * @param  {MouseEvent} event Mouse event\n   */\n\n\n  /**\n   * Event handler on mouse down.\n   * @param  {MouseEvent} event Mouse event\n   */\n\n\n  /**\n   * Event handler on mouse move.\n   * @param  {MouseEvent} event Mouse event\n   */\n\n\n  /**\n   * Event handler on mouse up or mouse out.\n   * @param  {MouseEvent} event Mouse event\n   */\n\n\n  /**\n   * Event handler on touch start.\n   * Zoom-in at the maximum scale if a double tap is detected.\n   * @param  {TouchEvent} event Touch event\n   */\n\n\n  /**\n   * Event handler on touch move.\n   * Either move the element using one finger or zoom-in with a two finger pinch.\n   * @param  {TouchEvent} event Touch move\n   */\n\n\n  /**\n   * Event handler on touch end or touch cancel.\n   * @param  {TouchEvent} event Touch move\n   */\n\n\n  /**\n   * Increments the zoom with the given value.\n   * @param  {Number} value Zoom value\n   */\n\n\n  /**\n   * Decrements the zoom with the given value.\n   * @param  {Number} value Zoom value\n   */\n\n\n  /**\n   * Zoom-in on the specified zone with the given relative coordinates and dimensions.\n   * @param  {Number} relX      Relative X position of the zone left-top corner in pixels\n   * @param  {Number} relY      Relative Y position of the zone left-top corner in pixels\n   * @param  {Number} relWidth  Zone width in pixels\n   * @param  {Number} relHeight Zone height in pixels\n   */\n\n\n  /**\n   * Resets the component to its initial state.\n   */\n\n\n  /**\n   * Returns the current zoom value.\n   * @return {Number} Zoom value\n   */\n\n\n  (0, _createClass3.default)(PrismaZoom, [{\n    key: 'componentDidUpdate',\n    value: function componentDidUpdate(prevProps, prevState) {\n      if (this.props.onZoomChange && this.state.zoom !== prevState.zoom) {\n        this.props.onZoomChange(this.state.zoom);\n      }\n    }\n  }, {\n    key: 'render',\n    value: function render() {\n      var _props = this.props,\n          className = _props.className,\n          children = _props.children,\n          imgWidth = _props.imgWidth;\n      var _state = this.state,\n          zoom = _state.zoom,\n          posX = _state.posX,\n          posY = _state.posY,\n          cursor = _state.cursor,\n          transitionDuration = _state.transitionDuration;\n\n      var screenWidth = window.innerWidth;\n      var invertedZoom = screenWidth / imgWidth * zoom;\n\n      var style = (0, _extends3.default)({}, this.props.style, {\n        transform: 'scale(' + invertedZoom + ') translateY(' + posY + 'px) translateX(' + posX + 'px) translateZ(0)',\n        transition: 'transform ease-out ' + transitionDuration + 's',\n        cursor: cursor,\n        touchAction: 'none'\n      });\n\n      var attr = {\n        ref: 'layout',\n        style: style,\n        className: className,\n        onWheel: this.handleMouseWheel,\n        onDoubleClick: this.handleDoubleClick,\n        onMouseDown: this.handleMouseStart,\n        onMouseMove: this.handleMouseMove,\n        onMouseUp: this.handleMouseStop,\n        onMouseLeave: this.handleMouseStop,\n        onTouchStart: this.handleTouchStart,\n        onTouchMove: this.handleTouchMove,\n        onTouchEnd: this.handleTouchStop,\n        onTouchCancel: this.handleTouchStop\n      };\n\n      return _react2.default.createElement(\n        'div',\n        attr,\n        children\n      );\n    }\n  }]);\n  return PrismaZoom;\n}(_react.PureComponent);\n\nPrismaZoom.propTypes = {\n  children: _propTypes2.default.node.isRequired,\n  className: _propTypes2.default.string,\n  style: _propTypes2.default.object,\n  minZoom: _propTypes2.default.number,\n  maxZoom: _propTypes2.default.number,\n  scrollVelocity: _propTypes2.default.number,\n  onZoomChange: _propTypes2.default.func,\n  leftBoundary: _propTypes2.default.number,\n  rightBoundary: _propTypes2.default.number,\n  topBoundary: _propTypes2.default.number,\n  bottomBoundary: _propTypes2.default.number,\n  animDuration: _propTypes2.default.number,\n  doubleTouchMaxDelay: _propTypes2.default.number,\n  decelerationDuration: _propTypes2.default.number,\n  imgWidth: _propTypes2.default.number\n};\nPrismaZoom.defaultProps = {\n  // Class name to apply on the zoom wrapper\n  className: null,\n  // Style to apply on the zoom wrapper\n  style: {},\n  // Minimum zoom ratio\n  minZoom: 1,\n  // Maximum zoom ratio\n  maxZoom: 5,\n  // Zoom increment or decrement on each scroll wheel detection\n  scrollVelocity: 0.2,\n  // Function called each time the zoom value changes\n  onZoomChange: null,\n  // Left screen-relative boundary, used to limit panning zone\n  leftBoundary: 0,\n  // Right screen-relative boundary, used to limit panning zone\n  rightBoundary: 0,\n  // Top screen-relative boundary, used to limit panning zone\n  topBoundary: 0,\n  // Bottom screen-relative boundary, used to limit panning zone\n  bottomBoundary: 0,\n  // Animation duration (in seconds)\n  animDuration: 0.25,\n  // Max delay between two taps to consider a double tap (in milliseconds)\n  doubleTouchMaxDelay: 300,\n  // Decelerating movement duration after a mouse up or a touch end event (in milliseconds)\n  decelerationDuration: 750\n};\nPrismaZoom.defaultState = {\n  // Transform scale value property\n  zoom: 1,\n  // Transform translateX value property\n  posX: 0,\n  // Transform translateY value property\n  posY: 0,\n  // Cursor style property\n  cursor: 'auto'\n};\nexports.default = PrismaZoom;"]}