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B,2BAA4B,GAC5B,mBAAmB,EACnB,SAAU,WAAqB","file":"/npm/react-twentytwenty@1.2.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-twentytwenty@1.2.1/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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\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\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar DEGREES_IN_RADIAN = 180 / Math.PI;\n\nvar TwentyTwenty = function (_Component) {\n  _inherits(TwentyTwenty, _Component);\n\n  function TwentyTwenty(props) {\n    _classCallCheck(this, TwentyTwenty);\n\n    // initialPosition was between 0 and 100, defaultPosition is between 0 and 1\n    var _this = _possibleConstructorReturn(this, (TwentyTwenty.__proto__ || Object.getPrototypeOf(TwentyTwenty)).call(this, props));\n\n    var _props$initialPositio = props.initialPosition,\n        initialPosition = _props$initialPositio === undefined ? 50 : _props$initialPositio,\n        _props$defaultPositio = props.defaultPosition,\n        defaultPosition = _props$defaultPositio === undefined ? initialPosition / 100 : _props$defaultPositio;\n\n    _this.state = {\n      startX: NaN,\n      startY: NaN,\n      isDragging: false,\n      position: defaultPosition\n    };\n\n    _this.beginDrag = _this.beginDrag.bind(_this);\n    _this.endDrag = _this.endDrag.bind(_this);\n    _this.onDragMove = _this.onDragMove.bind(_this);\n\n    // TODO: Replace with React.createRef() when React 16.3 is more widely adopted\n    _this.container = function (element) {\n      _this.container.current = element;\n    };\n    _this.container.current = null;\n    return _this;\n  }\n\n  _createClass(TwentyTwenty, [{\n    key: 'componentWillUnmount',\n    value: function componentWillUnmount() {\n      this.endDrag();\n    }\n  }, {\n    key: 'onDragMove',\n    value: function onDragMove(e) {\n      var _this2 = this;\n\n      if (!this.props.isDraggingEnabled) return;\n\n      var isDragging = this.state.isDragging;\n\n      var isTouch = 'touches' in e;\n\n      var _ref = isTouch ? e.touches[0] : e,\n          pageX = _ref.pageX,\n          pageY = _ref.pageY;\n\n      if (!isDragging && isTouch) {\n        var _props = this.props,\n            maxAngleToBeginInteraction = _props.maxAngleToBeginInteraction,\n            minDistanceToBeginInteraction = _props.minDistanceToBeginInteraction;\n        var _state = this.state,\n            startX = _state.startX,\n            startY = _state.startY;\n\n\n        var dx = startX - pageX;\n        var dy = startY - pageY;\n\n        var angle = Math.atan(dy / dx) * DEGREES_IN_RADIAN;\n        var distance = Math.sqrt(dx * dx + dy * dy);\n        isDragging = distance >= minDistanceToBeginInteraction;\n\n        if (isDragging && Math.abs(angle) > maxAngleToBeginInteraction) {\n          // They're trying to scroll vertically\n          this.endDrag();\n          return;\n        } else if (!isDragging) {\n          return;\n        }\n      }\n\n      if (isTouch) e.preventDefault();\n\n      var _container$current$ge = this.container.current.getBoundingClientRect(),\n          left = _container$current$ge.left,\n          width = _container$current$ge.width;\n\n      var position = (pageX - left) / width;\n      position = Math.max(Math.min(position, 1), 0);\n\n      if (this.props.position != null) {\n        this.setState(function (state) {\n          return !state.isDragging !== isDragging ? { isDragging: isDragging } : null;\n        }, function () {\n          _this2.props.onChange(position);\n        });\n      } else {\n        this.setState({ position: position, isDragging: isDragging });\n      }\n    }\n  }, {\n    key: 'beginDrag',\n    value: function beginDrag(e) {\n      if (e != null && !('touches' in e)) e.preventDefault();\n      if (!this.props.isDraggingEnabled) return;\n\n      var _ref2 = 'touches' in e ? e.touches[0] : e,\n          pageX = _ref2.pageX,\n          pageY = _ref2.pageY;\n\n      this.setState({ startX: pageX, startY: pageY });\n\n      document.addEventListener('mousemove', this.onDragMove);\n      document.addEventListener('mouseup', this.endDrag);\n      document.addEventListener('touchmove', this.onDragMove);\n      document.addEventListener('touchend', this.endDrag);\n    }\n  }, {\n    key: 'endDrag',\n    value: function endDrag() {\n      document.removeEventListener('mousemove', this.onDragMove);\n      document.removeEventListener('mouseup', this.endDrag);\n      document.removeEventListener('touchmove', this.onDragMove);\n      document.removeEventListener('touchend', this.endDrag);\n\n      this.setState({ isDragging: false, startY: NaN, endY: NaN });\n    }\n  }, {\n    key: 'render',\n    value: function render() {\n      var _props$position = this.props.position,\n          position = _props$position === undefined ? this.state.position : _props$position;\n      var _props2 = this.props,\n          _props2$children = _props2.children,\n          children = _props2$children === undefined ? [] : _props2$children,\n          _props2$left = _props2.left,\n          left = _props2$left === undefined ? children[0] : _props2$left,\n          _props2$right = _props2.right,\n          right = _props2$right === undefined ? children[1] : _props2$right,\n          _props2$slider = _props2.slider,\n          slider = _props2$slider === undefined ? children[2] : _props2$slider,\n          verticalAlign = _props2.verticalAlign,\n          leftHorizontalAlign = _props2.leftHorizontalAlign,\n          rightHorizontalAlign = _props2.rightHorizontalAlign;\n\n\n      return _react2.default.createElement(\n        'div',\n        {\n          ref: this.container,\n          style: { position: 'relative', overflow: 'hidden', whiteSpace: 'nowrap' },\n          onMouseDown: this.beginDrag,\n          onTouchStart: this.beginDrag\n        },\n        _react2.default.createElement(\n          'div',\n          {\n            style: {\n              position: 'absolute',\n              left: position * 100 + '%',\n              height: '100%',\n              width: 0,\n              zIndex: 1\n            }\n          },\n          slider\n        ),\n        _react2.default.createElement(\n          'div',\n          {\n            style: {\n              display: 'inline-block',\n              width: '100%',\n              position: 'relative',\n              verticalAlign: verticalAlign,\n              left: (position - 1) * 100 + '%',\n              overflow: 'hidden'\n            }\n          },\n          _react2.default.createElement(\n            'div',\n            {\n              style: {\n                position: 'relative',\n                right: (position - 1) * 100 + '%',\n                textAlign: leftHorizontalAlign\n              }\n            },\n            left\n          )\n        ),\n        _react2.default.createElement(\n          'div',\n          {\n            style: {\n              display: 'inline-block',\n              width: '100%',\n              position: 'relative',\n              verticalAlign: verticalAlign,\n              left: (position - 1) * 100 + '%',\n              overflow: 'hidden'\n            }\n          },\n          _react2.default.createElement(\n            'div',\n            {\n              style: {\n                position: 'relative',\n                right: position * 100 + '%',\n                textAlign: rightHorizontalAlign\n              }\n            },\n            right\n          )\n        )\n      );\n    }\n  }]);\n\n  return TwentyTwenty;\n}(_react.Component);\n\nexports.default = TwentyTwenty;\n\n\nTwentyTwenty.propTypes = {\n  left: _propTypes2.default.element.isRequired,\n  right: _propTypes2.default.element.isRequired,\n  splitter: _propTypes2.default.element,\n  verticalAlign: _propTypes2.default.string,\n  leftHorizontalAlign: _propTypes2.default.string,\n  rightHorizontalAlign: _propTypes2.default.string,\n  minDistanceToBeginInteraction: _propTypes2.default.number,\n  maxAngleToBeginInteraction: _propTypes2.default.number,\n  defaultPosition: _propTypes2.default.number,\n  position: _propTypes2.default.number,\n  isDraggingEnabled: _propTypes2.default.bool,\n  onChange: _propTypes2.default.func\n};\n\nTwentyTwenty.defaultProps = {\n  verticalAlign: 'middle',\n  leftHorizontalAlign: 'center',\n  rightHorizontalAlign: 'center',\n  minDistanceToBeginInteraction: 15,\n  maxAngleToBeginInteraction: 30,\n  isDraggingEnabled: true,\n  onChange: function onChange() {}\n};\n"]}