` by default. You can change this\n * behavior by providing a `component` prop.\n * If you use React v16+ and would like to avoid a wrapping `
` element\n * you can pass in `component={null}`. This is useful if the wrapping div\n * borks your css styles.\n */\n component: PropTypes.any,\n\n /**\n * A set of `
` components, that are toggled `in` and out as they\n * leave. the `` will inject specific transition props, so\n * remember to spread them through if you are wrapping the `` as\n * with our `` example.\n *\n * While this component is meant for multiple `Transition` or `CSSTransition`\n * children, sometimes you may want to have a single transition child with\n * content that you want to be transitioned out and in when you change it\n * (e.g. routes, images etc.) In that case you can change the `key` prop of\n * the transition child as you change its content, this will cause\n * `TransitionGroup` to transition the child out and back in.\n */\n children: PropTypes.node,\n\n /**\n * A convenience prop that enables or disables appear animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n appear: PropTypes.bool,\n\n /**\n * A convenience prop that enables or disables enter animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n enter: PropTypes.bool,\n\n /**\n * A convenience prop that enables or disables exit animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n exit: PropTypes.bool,\n\n /**\n * You may need to apply reactive updates to a child as it is exiting.\n * This is generally done by using `cloneElement` however in the case of an exiting\n * child the element has already been removed and not accessible to the consumer.\n *\n * If you do need to update a child as it leaves you can provide a `childFactory`\n * to wrap every child, even the ones that are leaving.\n *\n * @type Function(child: ReactElement) -> ReactElement\n */\n childFactory: PropTypes.func\n} : {};\nTransitionGroup.defaultProps = defaultProps;\nexport default TransitionGroup;","import React from 'react';\nexport default React.createContext(null);","import { Children, cloneElement, isValidElement } from 'react';\n/**\n * Given `this.props.children`, return an object mapping key to child.\n *\n * @param {*} children `this.props.children`\n * @return {object} Mapping of key to child\n */\n\nexport function getChildMapping(children, mapFn) {\n var mapper = function mapper(child) {\n return mapFn && isValidElement(child) ? mapFn(child) : child;\n };\n\n var result = Object.create(null);\n if (children) Children.map(children, function (c) {\n return c;\n }).forEach(function (child) {\n // run the map function here instead so that the key is the computed one\n result[child.key] = mapper(child);\n });\n return result;\n}\n/**\n * When you're adding or removing children some may be added or removed in the\n * same render pass. We want to show *both* since we want to simultaneously\n * animate elements in and out. This function takes a previous set of keys\n * and a new set of keys and merges them with its best guess of the correct\n * ordering. In the future we may expose some of the utilities in\n * ReactMultiChild to make this easy, but for now React itself does not\n * directly have this concept of the union of prevChildren and nextChildren\n * so we implement it here.\n *\n * @param {object} prev prev children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @param {object} next next children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @return {object} a key set that contains all keys in `prev` and all keys\n * in `next` in a reasonable order.\n */\n\nexport function mergeChildMappings(prev, next) {\n prev = prev || {};\n next = next || {};\n\n function getValueForKey(key) {\n return key in next ? next[key] : prev[key];\n } // For each key of `next`, the list of keys to insert before that key in\n // the combined list\n\n\n var nextKeysPending = Object.create(null);\n var pendingKeys = [];\n\n for (var prevKey in prev) {\n if (prevKey in next) {\n if (pendingKeys.length) {\n nextKeysPending[prevKey] = pendingKeys;\n pendingKeys = [];\n }\n } else {\n pendingKeys.push(prevKey);\n }\n }\n\n var i;\n var childMapping = {};\n\n for (var nextKey in next) {\n if (nextKeysPending[nextKey]) {\n for (i = 0; i < nextKeysPending[nextKey].length; i++) {\n var pendingNextKey = nextKeysPending[nextKey][i];\n childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);\n }\n }\n\n childMapping[nextKey] = getValueForKey(nextKey);\n } // Finally, add the keys which didn't appear before any key in `next`\n\n\n for (i = 0; i < pendingKeys.length; i++) {\n childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);\n }\n\n return childMapping;\n}\n\nfunction getProp(child, prop, props) {\n return props[prop] != null ? props[prop] : child.props[prop];\n}\n\nexport function getInitialChildMapping(props, onExited) {\n return getChildMapping(props.children, function (child) {\n return cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n appear: getProp(child, 'appear', props),\n enter: getProp(child, 'enter', props),\n exit: getProp(child, 'exit', props)\n });\n });\n}\nexport function getNextChildMapping(nextProps, prevChildMapping, onExited) {\n var nextChildMapping = getChildMapping(nextProps.children);\n var children = mergeChildMappings(prevChildMapping, nextChildMapping);\n Object.keys(children).forEach(function (key) {\n var child = children[key];\n if (!isValidElement(child)) return;\n var hasPrev = (key in prevChildMapping);\n var hasNext = (key in nextChildMapping);\n var prevChild = prevChildMapping[key];\n var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)\n\n if (hasNext && (!hasPrev || isLeaving)) {\n // console.log('entering', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n } else if (!hasNext && hasPrev && !isLeaving) {\n // item is old (exiting)\n // console.log('leaving', key)\n children[key] = cloneElement(child, {\n in: false\n });\n } else if (hasNext && hasPrev && isValidElement(prevChild)) {\n // item hasn't changed transition states\n // copy over the last transition props;\n // console.log('unchanged', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: prevChild.props.in,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n }\n });\n return children;\n}","export var forceReflow = function forceReflow(node) {\n return node.scrollTop;\n};","import React, { useRef } from 'react';\n\n// vector add\nfunction addV(v1, v2) {\n return v1.map(function (v, i) {\n return v + v2[i];\n });\n} // vector substract\n\nfunction subV(v1, v2) {\n return v1.map(function (v, i) {\n return v - v2[i];\n });\n}\n/**\r\n * Calculates distance\r\n * @param movement the difference between current and initial vectors\r\n * @returns distance\r\n */\n\nfunction calculateDistance(movement) {\n return Math.hypot.apply(Math, movement);\n}\nfunction calculateAllGeometry(movement, delta) {\n if (delta === void 0) {\n delta = movement;\n }\n\n var dl = calculateDistance(delta);\n var alpha = dl === 0 ? 0 : 1 / dl;\n var direction = delta.map(function (v) {\n return alpha * v;\n });\n var distance = calculateDistance(movement);\n return {\n distance: distance,\n direction: direction\n };\n}\n/**\r\n * Calculates all kinematics\r\n * @template T the expected vector type\r\n * @param movement the difference between current and initial vectors\r\n * @param delta the difference between current and previous vectors\r\n * @param delta_t the time difference between current and previous timestamps\r\n * @returns all kinematics\r\n */\n\nfunction calculateAllKinematics(movement, delta, dt) {\n var dl = calculateDistance(delta);\n var alpha = dl === 0 ? 0 : 1 / dl;\n var beta = dt === 0 ? 0 : 1 / dt;\n var velocity = beta * dl;\n var velocities = delta.map(function (v) {\n return beta * v;\n });\n var direction = delta.map(function (v) {\n return alpha * v;\n });\n var distance = calculateDistance(movement);\n return {\n velocities: velocities,\n velocity: velocity,\n distance: distance,\n direction: direction\n };\n}\n/**\r\n * Because IE doesn't support `Math.sign` function, so we use the polyfill version of the function.\r\n * This polyfill function is suggested by Mozilla:\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill\r\n * @param x target number\r\n */\n\nfunction sign(x) {\n if (Math.sign) return Math.sign(x);\n return Number(x > 0) - Number(x < 0) || +x;\n}\n\nfunction minMax(value, min, max) {\n return Math.max(min, Math.min(value, max));\n} // Based on @aholachek ;)\n// https://twitter.com/chpwn/status/285540192096497664\n// iOS constant = 0.55\n// https://medium.com/@nathangitter/building-fluid-interfaces-ios-swift-9732bb934bf5\n\n\nfunction rubberband2(distance, constant) {\n // default constant from the article is 0.7\n return Math.pow(distance, constant * 5);\n}\n\nfunction rubberband(distance, dimension, constant) {\n if (dimension === 0 || Math.abs(dimension) === Infinity) return rubberband2(distance, constant);\n return distance * dimension * constant / (dimension + constant * distance);\n}\n\nfunction rubberbandIfOutOfBounds(position, min, max, constant) {\n if (constant === void 0) {\n constant = 0.15;\n }\n\n if (constant === 0) return minMax(position, min, max);\n if (position < min) return -rubberband(min - position, max - min, constant) + min;\n if (position > max) return +rubberband(position - max, max - min, constant) + max;\n return position;\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it;\n\n if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) {\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n it = o[Symbol.iterator]();\n return it.next.bind(it);\n}\n\nfunction noop() {}\n/**\r\n * TODO Beware that only optimized cases are covered in tests =)\r\n * TODO Need to cover general case as well\r\n *\r\n * @param fns\r\n */\n\nfunction chainFns() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n\n if (fns.length === 0) return noop;\n if (fns.length === 1) return fns[0];\n return function () {\n var result;\n\n for (var _iterator = _createForOfIteratorHelperLoose(fns), _step; !(_step = _iterator()).done;) {\n var fn = _step.value;\n result = fn.apply(this, arguments) || result;\n }\n\n return result;\n };\n}\n/**\r\n * Expects a simple value or 2D vector (an array with 2 elements) and\r\n * always returns 2D vector. If simple value is passed, returns a\r\n * vector with this value as both coordinates.\r\n *\r\n * @param value\r\n */\n\nfunction ensureVector(value, fallback) {\n if (value === undefined) {\n if (fallback === undefined) {\n throw new Error('Must define fallback value if undefined is expected');\n }\n\n value = fallback;\n }\n\n if (Array.isArray(value)) return value;\n return [value, value];\n}\n/**\r\n * Helper for defining a default value\r\n *\r\n * @param value\r\n * @param fallback\r\n */\n\nfunction assignDefault(value, fallback) {\n return Object.assign({}, fallback, value || {});\n}\n/**\r\n * Resolves getters (functions) by calling them\r\n * If simple value is given it just passes through\r\n *\r\n * @param v\r\n */\n\nfunction valueFn(v) {\n if (typeof v === 'function') {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n // @ts-ignore\n return v.apply(void 0, args);\n } else {\n return v;\n }\n}\n\nfunction resolveWith(config, resolvers) {\n if (config === void 0) {\n config = {};\n }\n\n var result = {};\n\n for (var _i = 0, _Object$entries = Object.entries(resolvers); _i < _Object$entries.length; _i++) {\n var _Object$entries$_i = _Object$entries[_i],\n key = _Object$entries$_i[0],\n resolver = _Object$entries$_i[1];\n\n switch (typeof resolver) {\n case 'function':\n result[key] = resolver.call(result, config[key], key, config);\n break;\n\n case 'object':\n result[key] = resolveWith(config[key], resolver);\n break;\n\n case 'boolean':\n if (resolver) result[key] = config[key];\n break;\n }\n }\n\n return result;\n}\n\n/**\r\n * Whether the browser supports GestureEvent (ie Safari)\r\n * @returns true if the browser supports gesture event\r\n */\nfunction supportsGestureEvents() {\n try {\n // TODO [TS] possibly find GestureEvent definitions?\n // @ts-ignore: no type definitions for webkit GestureEvents\n return 'constructor' in GestureEvent;\n } catch (e) {\n return false;\n }\n}\nfunction supportsTouchEvents() {\n return typeof window !== 'undefined' && 'ontouchstart' in window;\n}\nfunction supportsPointerEvents() {\n return typeof window !== 'undefined' && 'onpointerdown' in window;\n}\n\nfunction getEventTouches(event) {\n if ('pointerId' in event) return null;\n return event.type === 'touchend' ? event.changedTouches : event.targetTouches;\n}\n\nfunction getTouchIds(event) {\n return Array.from(getEventTouches(event)).map(function (t) {\n return t.identifier;\n });\n}\nfunction getGenericEventData(event) {\n var buttons = 'buttons' in event ? event.buttons : 0;\n var shiftKey = event.shiftKey,\n altKey = event.altKey,\n metaKey = event.metaKey,\n ctrlKey = event.ctrlKey; // TODO check if this might create some overrides?\n\n return {\n buttons: buttons,\n shiftKey: shiftKey,\n altKey: altKey,\n metaKey: metaKey,\n ctrlKey: ctrlKey\n };\n}\n\nvar identity = function identity(xy) {\n return xy;\n};\n/**\r\n * Gets pointer event values.\r\n * @param event\r\n * @returns pointer event values\r\n */\n\n\nfunction getPointerEventValues(event, transform) {\n if (transform === void 0) {\n transform = identity;\n }\n\n var touchEvents = getEventTouches(event);\n\n var _ref = touchEvents ? touchEvents[0] : event,\n clientX = _ref.clientX,\n clientY = _ref.clientY;\n\n return transform([clientX, clientY]);\n}\n/**\r\n * Gets two touches event data\r\n * @param event\r\n * @returns two touches event data\r\n */\n\nfunction getTwoTouchesEventValues(event, pointerIds, transform) {\n if (transform === void 0) {\n transform = identity;\n }\n\n var _Array$from$filter = Array.from(event.touches).filter(function (t) {\n return pointerIds.includes(t.identifier);\n }),\n A = _Array$from$filter[0],\n B = _Array$from$filter[1];\n\n if (!A || !B) throw Error(\"The event doesn't have two pointers matching the pointerIds\");\n var dx = B.clientX - A.clientX;\n var dy = B.clientY - A.clientY;\n var cx = (B.clientX + A.clientX) / 2;\n var cy = (B.clientY + A.clientY) / 2; // const e: any = 'nativeEvent' in event ? event.nativeEvent : event\n\n var distance = Math.hypot(dx, dy); // FIXME rotation has inconsistant values so we're not using it atm\n // const angle = (e.rotation as number) ?? -(Math.atan2(dx, dy) * 180) / Math.PI\n\n var angle = -(Math.atan2(dx, dy) * 180) / Math.PI;\n var values = transform([distance, angle]);\n var origin = transform([cx, cy]);\n return {\n values: values,\n origin: origin\n };\n}\n/**\r\n * Gets scroll event values\r\n * @param event\r\n * @returns scroll event values\r\n */\n\nfunction getScrollEventValues(event, transform) {\n if (transform === void 0) {\n transform = identity;\n }\n\n // If the currentTarget is the window then we return the scrollX/Y position.\n // If not (ie the currentTarget is a DOM element), then we return scrollLeft/Top\n var _event$currentTarget = event.currentTarget,\n scrollX = _event$currentTarget.scrollX,\n scrollY = _event$currentTarget.scrollY,\n scrollLeft = _event$currentTarget.scrollLeft,\n scrollTop = _event$currentTarget.scrollTop;\n return transform([scrollX || scrollLeft || 0, scrollY || scrollTop || 0]);\n} // wheel delta defaults from https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js\n\nvar LINE_HEIGHT = 40;\nvar PAGE_HEIGHT = 800;\n/**\r\n * Gets wheel event values.\r\n * @param event\r\n * @returns wheel event values\r\n */\n\nfunction getWheelEventValues(event, transform) {\n if (transform === void 0) {\n transform = identity;\n }\n\n var deltaX = event.deltaX,\n deltaY = event.deltaY,\n deltaMode = event.deltaMode; // normalize wheel values, especially for Firefox\n\n if (deltaMode === 1) {\n deltaX *= LINE_HEIGHT;\n deltaY *= LINE_HEIGHT;\n } else if (deltaMode === 2) {\n deltaX *= PAGE_HEIGHT;\n deltaY *= PAGE_HEIGHT;\n }\n\n return transform([deltaX, deltaY]);\n}\n/**\r\n * Gets webkit gesture event values.\r\n * @param event\r\n * @returns webkit gesture event values\r\n */\n\nfunction getWebkitGestureEventValues(event, transform) {\n if (transform === void 0) {\n transform = identity;\n }\n\n return transform([event.scale, event.rotation]);\n}\n\nvar DEFAULT_DRAG_DELAY = 180;\nvar DEFAULT_RUBBERBAND = 0.15;\nvar DEFAULT_SWIPE_VELOCITY = 0.5;\nvar DEFAULT_SWIPE_DISTANCE = 50;\nvar DEFAULT_SWIPE_DURATION = 250;\nvar InternalGestureOptionsNormalizers = {\n threshold: function threshold(value) {\n if (value === void 0) {\n value = 0;\n }\n\n return ensureVector(value);\n },\n rubberband: function rubberband(value) {\n if (value === void 0) {\n value = 0;\n }\n\n switch (value) {\n case true:\n return ensureVector(DEFAULT_RUBBERBAND);\n\n case false:\n return ensureVector(0);\n\n default:\n return ensureVector(value);\n }\n },\n enabled: function enabled(value) {\n if (value === void 0) {\n value = true;\n }\n\n return value;\n },\n triggerAllEvents: function triggerAllEvents(value) {\n if (value === void 0) {\n value = false;\n }\n\n return value;\n },\n initial: function initial(value) {\n if (value === void 0) {\n value = 0;\n }\n\n if (typeof value === 'function') return value;\n return ensureVector(value);\n },\n transform: true\n};\n\nvar InternalCoordinatesOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {\n axis: true,\n lockDirection: function lockDirection(value) {\n if (value === void 0) {\n value = false;\n }\n\n return value;\n },\n bounds: function bounds(value) {\n if (value === void 0) {\n value = {};\n }\n\n if (typeof value === 'function') return function (state) {\n return InternalCoordinatesOptionsNormalizers.bounds(value(state));\n };\n var _value2 = value,\n _value2$left = _value2.left,\n left = _value2$left === void 0 ? -Infinity : _value2$left,\n _value2$right = _value2.right,\n right = _value2$right === void 0 ? Infinity : _value2$right,\n _value2$top = _value2.top,\n top = _value2$top === void 0 ? -Infinity : _value2$top,\n _value2$bottom = _value2.bottom,\n bottom = _value2$bottom === void 0 ? Infinity : _value2$bottom;\n return [[left, right], [top, bottom]];\n }\n});\n\nvar isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;\nvar InternalGenericOptionsNormalizers = {\n enabled: function enabled(value) {\n if (value === void 0) {\n value = true;\n }\n\n return value;\n },\n domTarget: true,\n window: /*#__PURE__*/function (_window) {\n function window(_x) {\n return _window.apply(this, arguments);\n }\n\n window.toString = function () {\n return _window.toString();\n };\n\n return window;\n }(function (value) {\n if (value === void 0) {\n value = isBrowser ? window : undefined;\n }\n\n return value;\n }),\n eventOptions: function eventOptions(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$passive = _ref.passive,\n passive = _ref$passive === void 0 ? true : _ref$passive,\n _ref$capture = _ref.capture,\n capture = _ref$capture === void 0 ? false : _ref$capture;\n\n return {\n passive: passive,\n capture: capture\n };\n },\n transform: true\n};\n\nvar InternalDistanceAngleOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {\n bounds: function bounds(_value, _key, _ref2) {\n var _ref2$distanceBounds = _ref2.distanceBounds,\n distanceBounds = _ref2$distanceBounds === void 0 ? {} : _ref2$distanceBounds,\n _ref2$angleBounds = _ref2.angleBounds,\n angleBounds = _ref2$angleBounds === void 0 ? {} : _ref2$angleBounds;\n\n var _distanceBounds = function _distanceBounds(state) {\n var D = assignDefault(valueFn(distanceBounds, state), {\n min: -Infinity,\n max: Infinity\n });\n return [D.min, D.max];\n };\n\n var _angleBounds = function _angleBounds(state) {\n var A = assignDefault(valueFn(angleBounds, state), {\n min: -Infinity,\n max: Infinity\n });\n return [A.min, A.max];\n };\n\n if (typeof distanceBounds !== 'function' && typeof angleBounds !== 'function') return [_distanceBounds(), _angleBounds()];\n return function (state) {\n return [_distanceBounds(state), _angleBounds(state)];\n };\n }\n});\n\nvar InternalDragOptionsNormalizers = /*#__PURE__*/_extends({}, InternalCoordinatesOptionsNormalizers, {\n useTouch: function useTouch(value) {\n if (value === void 0) {\n value = false;\n }\n\n var supportsTouch = supportsTouchEvents();\n var supportsPointer = supportsPointerEvents();\n if (value && supportsTouch) return true;\n if (supportsTouch && !supportsPointer) return true;\n return false;\n },\n experimental_preventWindowScrollY: function experimental_preventWindowScrollY(value) {\n if (value === void 0) {\n value = false;\n }\n\n return value;\n },\n threshold: function threshold(v, _k, _ref3) {\n var _ref3$filterTaps = _ref3.filterTaps,\n filterTaps = _ref3$filterTaps === void 0 ? false : _ref3$filterTaps,\n _ref3$lockDirection = _ref3.lockDirection,\n lockDirection = _ref3$lockDirection === void 0 ? false : _ref3$lockDirection,\n _ref3$axis = _ref3.axis,\n axis = _ref3$axis === void 0 ? undefined : _ref3$axis;\n var A = ensureVector(v, filterTaps ? 3 : lockDirection ? 1 : axis ? 1 : 0);\n this.filterTaps = filterTaps;\n return A;\n },\n swipeVelocity: function swipeVelocity(v) {\n if (v === void 0) {\n v = DEFAULT_SWIPE_VELOCITY;\n }\n\n return ensureVector(v);\n },\n swipeDistance: function swipeDistance(v) {\n if (v === void 0) {\n v = DEFAULT_SWIPE_DISTANCE;\n }\n\n return ensureVector(v);\n },\n swipeDuration: function swipeDuration(value) {\n if (value === void 0) {\n value = DEFAULT_SWIPE_DURATION;\n }\n\n return value;\n },\n delay: function delay(value) {\n if (value === void 0) {\n value = 0;\n }\n\n switch (value) {\n case true:\n return DEFAULT_DRAG_DELAY;\n\n case false:\n return 0;\n\n default:\n return value;\n }\n }\n});\n\nfunction getInternalGenericOptions(config) {\n if (config === void 0) {\n config = {};\n }\n\n // TODO warn when passive is set to true and domTarget is undefined\n return resolveWith(config, InternalGenericOptionsNormalizers);\n}\nfunction getInternalCoordinatesOptions(config) {\n if (config === void 0) {\n config = {};\n }\n\n return resolveWith(config, InternalCoordinatesOptionsNormalizers);\n}\nfunction getInternalDistanceAngleOptions(config) {\n if (config === void 0) {\n config = {};\n }\n\n return resolveWith(config, InternalDistanceAngleOptionsNormalizers);\n}\nfunction getInternalDragOptions(config) {\n if (config === void 0) {\n config = {};\n }\n\n return resolveWith(config, InternalDragOptionsNormalizers);\n}\n\nfunction _buildMoveConfig(_ref) {\n var domTarget = _ref.domTarget,\n eventOptions = _ref.eventOptions,\n window = _ref.window,\n enabled = _ref.enabled,\n rest = _objectWithoutPropertiesLoose(_ref, [\"domTarget\", \"eventOptions\", \"window\", \"enabled\"]);\n\n var opts = getInternalGenericOptions({\n domTarget: domTarget,\n eventOptions: eventOptions,\n window: window,\n enabled: enabled\n });\n opts.move = getInternalCoordinatesOptions(rest);\n return opts;\n}\nfunction _buildHoverConfig(_ref2) {\n var domTarget = _ref2.domTarget,\n eventOptions = _ref2.eventOptions,\n window = _ref2.window,\n enabled = _ref2.enabled,\n rest = _objectWithoutPropertiesLoose(_ref2, [\"domTarget\", \"eventOptions\", \"window\", \"enabled\"]);\n\n var opts = getInternalGenericOptions({\n domTarget: domTarget,\n eventOptions: eventOptions,\n window: window,\n enabled: enabled\n });\n opts.hover = _extends({\n enabled: true\n }, rest);\n return opts;\n}\nfunction _buildDragConfig(_ref3) {\n var domTarget = _ref3.domTarget,\n eventOptions = _ref3.eventOptions,\n window = _ref3.window,\n enabled = _ref3.enabled,\n rest = _objectWithoutPropertiesLoose(_ref3, [\"domTarget\", \"eventOptions\", \"window\", \"enabled\"]);\n\n var opts = getInternalGenericOptions({\n domTarget: domTarget,\n eventOptions: eventOptions,\n window: window,\n enabled: enabled\n });\n opts.drag = getInternalDragOptions(rest);\n return opts;\n}\nfunction _buildPinchConfig(_ref4) {\n var domTarget = _ref4.domTarget,\n eventOptions = _ref4.eventOptions,\n window = _ref4.window,\n enabled = _ref4.enabled,\n rest = _objectWithoutPropertiesLoose(_ref4, [\"domTarget\", \"eventOptions\", \"window\", \"enabled\"]);\n\n var opts = getInternalGenericOptions({\n domTarget: domTarget,\n eventOptions: eventOptions,\n window: window,\n enabled: enabled\n });\n opts.pinch = getInternalDistanceAngleOptions(rest);\n return opts;\n}\nfunction _buildScrollConfig(_ref5) {\n var domTarget = _ref5.domTarget,\n eventOptions = _ref5.eventOptions,\n window = _ref5.window,\n enabled = _ref5.enabled,\n rest = _objectWithoutPropertiesLoose(_ref5, [\"domTarget\", \"eventOptions\", \"window\", \"enabled\"]);\n\n var opts = getInternalGenericOptions({\n domTarget: domTarget,\n eventOptions: eventOptions,\n window: window,\n enabled: enabled\n });\n opts.scroll = getInternalCoordinatesOptions(rest);\n return opts;\n}\nfunction _buildWheelConfig(_ref6) {\n var domTarget = _ref6.domTarget,\n eventOptions = _ref6.eventOptions,\n window = _ref6.window,\n enabled = _ref6.enabled,\n rest = _objectWithoutPropertiesLoose(_ref6, [\"domTarget\", \"eventOptions\", \"window\", \"enabled\"]);\n\n var opts = getInternalGenericOptions({\n domTarget: domTarget,\n eventOptions: eventOptions,\n window: window,\n enabled: enabled\n });\n opts.wheel = getInternalCoordinatesOptions(rest);\n return opts;\n}\nfunction buildComplexConfig(config, actions) {\n if (config === void 0) {\n config = {};\n }\n\n if (actions === void 0) {\n actions = new Set();\n }\n\n var _config = config,\n drag = _config.drag,\n wheel = _config.wheel,\n move = _config.move,\n scroll = _config.scroll,\n pinch = _config.pinch,\n hover = _config.hover,\n eventOptions = _config.eventOptions,\n window = _config.window,\n transform = _config.transform,\n domTarget = _config.domTarget,\n enabled = _config.enabled;\n var mergedConfig = getInternalGenericOptions({\n domTarget: domTarget,\n eventOptions: eventOptions,\n transform: transform,\n window: window,\n enabled: enabled\n });\n if (actions.has('onDrag')) mergedConfig.drag = getInternalDragOptions(drag);\n if (actions.has('onWheel')) mergedConfig.wheel = getInternalCoordinatesOptions(wheel);\n if (actions.has('onScroll')) mergedConfig.scroll = getInternalCoordinatesOptions(scroll);\n if (actions.has('onMove')) mergedConfig.move = getInternalCoordinatesOptions(move);\n if (actions.has('onPinch')) mergedConfig.pinch = getInternalDistanceAngleOptions(pinch);\n if (actions.has('onHover')) mergedConfig.hover = _extends({\n enabled: true\n }, hover);\n return mergedConfig;\n}\n\nfunction getInitial(mixed) {\n return _extends({\n _active: false,\n _blocked: false,\n _intentional: [false, false],\n _movement: [0, 0],\n _initial: [0, 0],\n _bounds: [[-Infinity, Infinity], [-Infinity, Infinity]],\n _threshold: [0, 0],\n _lastEventType: undefined,\n _dragStarted: false,\n _dragPreventScroll: false,\n _dragIsTap: true,\n _dragDelayed: false,\n event: undefined,\n intentional: false,\n values: [0, 0],\n velocities: [0, 0],\n delta: [0, 0],\n movement: [0, 0],\n offset: [0, 0],\n lastOffset: [0, 0],\n direction: [0, 0],\n initial: [0, 0],\n previous: [0, 0],\n first: false,\n last: false,\n active: false,\n timeStamp: 0,\n startTime: 0,\n elapsedTime: 0,\n cancel: noop,\n canceled: false,\n memo: undefined,\n args: undefined\n }, mixed);\n}\n\nfunction getInitialState() {\n var shared = {\n hovering: false,\n scrolling: false,\n wheeling: false,\n dragging: false,\n moving: false,\n pinching: false,\n touches: 0,\n buttons: 0,\n down: false,\n shiftKey: false,\n altKey: false,\n metaKey: false,\n ctrlKey: false,\n locked: false\n };\n var drag = getInitial({\n _pointerId: undefined,\n axis: undefined,\n xy: [0, 0],\n vxvy: [0, 0],\n velocity: 0,\n distance: 0,\n tap: false,\n swipe: [0, 0]\n });\n var pinch = getInitial({\n // @ts-expect-error when used _pointerIds we can assert its type will be [number, number]\n _pointerIds: [],\n da: [0, 0],\n vdva: [0, 0],\n // @ts-expect-error origin can never be passed as undefined in userland\n origin: undefined,\n turns: 0\n });\n var wheel = getInitial({\n axis: undefined,\n xy: [0, 0],\n vxvy: [0, 0],\n velocity: 0,\n distance: 0\n });\n var move = getInitial({\n axis: undefined,\n xy: [0, 0],\n vxvy: [0, 0],\n velocity: 0,\n distance: 0\n });\n var scroll = getInitial({\n axis: undefined,\n xy: [0, 0],\n vxvy: [0, 0],\n velocity: 0,\n distance: 0\n });\n return {\n shared: shared,\n drag: drag,\n pinch: pinch,\n wheel: wheel,\n move: move,\n scroll: scroll\n };\n}\n\nvar RecognizersMap = /*#__PURE__*/new Map();\n\nvar identity$1 = function identity(xy) {\n return xy;\n};\n/**\r\n * @private\r\n * Recognizer abstract class.\r\n */\n\n\nvar Recognizer = /*#__PURE__*/function () {\n /**\r\n * Creates an instance of a gesture recognizer.\r\n * @param stateKey drag, move, pinch, etc.\r\n * @param controller the controller attached to the gesture\r\n * @param [args] the args that should be passed to the gesture handler\r\n */\n function Recognizer(controller, args) {\n var _this = this;\n\n if (args === void 0) {\n args = [];\n }\n\n this.controller = controller;\n this.args = args;\n this.debounced = true; // Convenience method to set a timeout for a given gesture\n\n this.setTimeout = function (callback, ms) {\n var _window;\n\n if (ms === void 0) {\n ms = 140;\n }\n\n clearTimeout(_this.controller.timeouts[_this.stateKey]);\n\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n _this.controller.timeouts[_this.stateKey] = (_window = window).setTimeout.apply(_window, [callback, ms].concat(args));\n }; // Convenience method to clear a timeout for a given gesture\n\n\n this.clearTimeout = function () {\n clearTimeout(_this.controller.timeouts[_this.stateKey]);\n };\n /**\r\n * Fires the gesture handler\r\n */\n\n\n this.fireGestureHandler = function (forceFlag) {\n if (forceFlag === void 0) {\n forceFlag = false;\n }\n\n /**\r\n * If the gesture has been blocked (this can happen when the gesture has started in an unwanted direction),\r\n * clean everything and don't do anything.\r\n */\n if (_this.state._blocked) {\n // we need debounced gestures to end by themselves\n if (!_this.debounced) {\n _this.state._active = false;\n\n _this.clean();\n }\n\n return null;\n } // If the gesture has no intentional dimension, don't fire the handler.\n\n\n if (!forceFlag && !_this.state.intentional && !_this.config.triggerAllEvents) return null;\n\n if (_this.state.intentional) {\n var prev_active = _this.state.active;\n var next_active = _this.state._active;\n _this.state.active = next_active;\n _this.state.first = next_active && !prev_active;\n _this.state.last = prev_active && !next_active;\n _this.controller.state.shared[_this.ingKey] = next_active; // Sets dragging, pinching, etc. to the gesture active state\n }\n\n var touches = _this.controller.pointerIds.size || _this.controller.touchIds.size;\n var down = _this.controller.state.shared.buttons > 0 || touches > 0;\n\n var state = _extends({}, _this.controller.state.shared, _this.state, _this.mapStateValues(_this.state), {\n locked: !!document.pointerLockElement,\n touches: touches,\n down: down\n }); // @ts-expect-error\n\n\n var newMemo = _this.handler(state); // Sets memo to the returned value of the handler (unless it's not undefined)\n\n\n _this.state.memo = newMemo !== void 0 ? newMemo : _this.state.memo;\n return state;\n };\n\n this.controller = controller;\n this.args = args;\n } // Returns the gesture config\n\n\n var _proto = Recognizer.prototype;\n\n // Convenience method to update the shared state\n _proto.updateSharedState = function updateSharedState(sharedState) {\n Object.assign(this.controller.state.shared, sharedState);\n } // Convenience method to update the gesture state\n ;\n\n _proto.updateGestureState = function updateGestureState(gestureState) {\n Object.assign(this.state, gestureState);\n }\n /**\r\n * Returns state properties depending on the movement and state.\r\n *\r\n * Should be overriden for custom behavior, doesn't do anything in the implementation\r\n * below.\r\n */\n ;\n\n _proto.checkIntentionality = function checkIntentionality(_intentional, _movement) {\n return {\n _intentional: _intentional,\n _blocked: false\n };\n }\n /**\r\n * Returns basic movement properties for the gesture based on the next values and current state.\r\n */\n ;\n\n _proto.getMovement = function getMovement(values) {\n var rubberband = this.config.rubberband;\n var _this$state = this.state,\n _bounds = _this$state._bounds,\n _initial = _this$state._initial,\n _active = _this$state._active,\n wasIntentional = _this$state._intentional,\n lastOffset = _this$state.lastOffset,\n prevMovement = _this$state.movement,\n _T = _this$state._threshold;\n var M = this.getInternalMovement(values, this.state);\n var i0 = wasIntentional[0] === false ? getIntentionalDisplacement(M[0], _T[0]) : wasIntentional[0];\n var i1 = wasIntentional[1] === false ? getIntentionalDisplacement(M[1], _T[1]) : wasIntentional[1]; // Get gesture specific state properties based on intentionality and movement.\n\n var intentionalityCheck = this.checkIntentionality([i0, i1], M);\n\n if (intentionalityCheck._blocked) {\n return _extends({}, intentionalityCheck, {\n _movement: M,\n delta: [0, 0]\n });\n }\n\n var _intentional = intentionalityCheck._intentional;\n var _movement = M;\n /**\r\n * The movement sent to the handler has 0 in its dimensions when intentionality is false.\r\n * It is calculated from the actual movement minus the threshold.\r\n */\n\n var movement = [_intentional[0] !== false ? M[0] - _intentional[0] : 0, _intentional[1] !== false ? M[1] - _intentional[1] : 0];\n var offset = addV(movement, lastOffset);\n /**\r\n * Rubberband should be 0 when the gesture is no longer active, so that movement\r\n * and offset can return within their bounds.\r\n */\n\n var _rubberband = _active ? rubberband : [0, 0];\n\n movement = computeRubberband(_bounds, addV(movement, _initial), _rubberband);\n return _extends({}, intentionalityCheck, {\n intentional: _intentional[0] !== false || _intentional[1] !== false,\n _initial: _initial,\n _movement: _movement,\n movement: movement,\n values: values,\n offset: computeRubberband(_bounds, offset, _rubberband),\n delta: subV(movement, prevMovement)\n });\n } // Cleans the gesture. Can be overriden by gestures.\n ;\n\n _proto.clean = function clean() {\n this.clearTimeout();\n };\n\n _createClass(Recognizer, [{\n key: \"config\",\n get: function get() {\n return this.controller.config[this.stateKey];\n } // Is the gesture enabled\n\n }, {\n key: \"enabled\",\n get: function get() {\n return this.controller.config.enabled && this.config.enabled;\n } // Returns the controller state for a given gesture\n\n }, {\n key: \"state\",\n get: function get() {\n return this.controller.state[this.stateKey];\n } // Returns the gesture handler\n\n }, {\n key: \"handler\",\n get: function get() {\n return this.controller.handlers[this.stateKey];\n }\n }, {\n key: \"transform\",\n get: function get() {\n return this.config.transform || this.controller.config.transform || identity$1;\n }\n }]);\n\n return Recognizer;\n}(); //--------------------------------------------\n\nfunction getIntentionalDisplacement(movement, threshold) {\n if (Math.abs(movement) >= threshold) {\n return sign(movement) * threshold;\n } else {\n return false;\n }\n}\n\nfunction computeRubberband(bounds, _ref, _ref2) {\n var Vx = _ref[0],\n Vy = _ref[1];\n var Rx = _ref2[0],\n Ry = _ref2[1];\n var _bounds$ = bounds[0],\n X1 = _bounds$[0],\n X2 = _bounds$[1],\n _bounds$2 = bounds[1],\n Y1 = _bounds$2[0],\n Y2 = _bounds$2[1];\n return [rubberbandIfOutOfBounds(Vx, X1, X2, Rx), rubberbandIfOutOfBounds(Vy, Y1, Y2, Ry)];\n}\n/**\r\n * Returns a generic, common payload for all gestures from an event.\r\n */\n\n\nfunction getGenericPayload(_ref3, event, isStartEvent) {\n var state = _ref3.state;\n var timeStamp = event.timeStamp,\n _lastEventType = event.type;\n var previous = state.values;\n var elapsedTime = isStartEvent ? 0 : timeStamp - state.startTime;\n return {\n _lastEventType: _lastEventType,\n event: event,\n timeStamp: timeStamp,\n elapsedTime: elapsedTime,\n previous: previous\n };\n}\n/**\r\n * Returns the reinitialized start state for the gesture.\r\n * Should be common to all gestures.\r\n */\n\nfunction getStartGestureState(_ref4, values, event, initial) {\n var state = _ref4.state,\n config = _ref4.config,\n stateKey = _ref4.stateKey,\n args = _ref4.args,\n transform = _ref4.transform;\n var offset = state.offset;\n var startTime = event.timeStamp;\n var initialFn = config.initial,\n bounds = config.bounds,\n threshold = config.threshold; // the _threshold is the difference between a [0,0] offset converted to\n // its new space coordinates\n\n var _threshold = subV(transform(threshold), transform([0, 0])).map(Math.abs);\n\n var _state = _extends({}, getInitialState()[stateKey], {\n _active: true,\n args: args,\n values: values,\n initial: initial != null ? initial : values,\n _threshold: _threshold,\n offset: offset,\n lastOffset: offset,\n startTime: startTime\n });\n\n return _extends({}, _state, {\n _initial: valueFn(initialFn, _state),\n _bounds: valueFn(bounds, _state)\n });\n}\n\n/**\r\n * The controller will keep track of the state for all gestures and also keep\r\n * track of timeouts, and window listeners.\r\n */\n\nvar Controller = function Controller(classes) {\n var _this = this;\n\n this.classes = classes;\n this.pointerIds = new Set(); // register Pointer Events pointerIds\n\n this.touchIds = new Set(); // register Touch Events identifiers\n\n this.supportsTouchEvents = supportsTouchEvents();\n this.supportsGestureEvents = supportsGestureEvents();\n\n this.bind = function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var bindings = {};\n\n for (var _iterator = _createForOfIteratorHelperLoose(_this.classes), _step; !(_step = _iterator()).done;) {\n var RecognizerClass = _step.value;\n new RecognizerClass(_this, args).addBindings(bindings);\n } // // we also add event bindings for native handlers\n\n\n var _loop = function _loop(eventKey) {\n addBindings(bindings, eventKey, function (event) {\n return _this.nativeRefs[eventKey](_extends({}, _this.state.shared, {\n event: event,\n args: args\n }));\n });\n };\n\n for (var eventKey in _this.nativeRefs) {\n _loop(eventKey);\n }\n\n if (_this.config.domTarget) {\n // If config.domTarget is set we add event listeners to it and return the clean function.\n return updateDomListeners(_this, bindings);\n } else {\n // If not, we return an object that contains gesture handlers mapped to react handler event keys.\n return getPropsListener(_this, bindings);\n }\n };\n\n this.effect = function () {\n if (_this.config.domTarget) _this.bind();\n return _this.clean;\n };\n /**\r\n * Function ran on component unmount: cleans timeouts and removes dom listeners set by the bind function.\r\n */\n\n\n this.clean = function () {\n var domTarget = getDomTargetFromConfig(_this.config);\n var eventOptions = _this.config.eventOptions;\n if (domTarget) removeListeners(domTarget, takeAll(_this.domListeners), eventOptions);\n Object.values(_this.timeouts).forEach(clearTimeout);\n clearAllWindowListeners(_this);\n };\n\n this.classes = classes;\n this.state = getInitialState();\n this.timeouts = {};\n this.domListeners = [];\n this.windowListeners = {};\n};\nfunction addEventIds(controller, event) {\n if ('pointerId' in event) {\n controller.pointerIds.add(event.pointerId);\n } else {\n controller.touchIds = new Set(getTouchIds(event));\n }\n}\nfunction removeEventIds(controller, event) {\n if ('pointerId' in event) {\n controller.pointerIds[\"delete\"](event.pointerId);\n } else {\n getTouchIds(event).forEach(function (id) {\n return controller.touchIds[\"delete\"](id);\n });\n }\n}\nfunction clearAllWindowListeners(controller) {\n var _controller$config = controller.config,\n el = _controller$config.window,\n eventOptions = _controller$config.eventOptions,\n windowListeners = controller.windowListeners;\n if (!el) return;\n\n for (var stateKey in windowListeners) {\n var handlers = windowListeners[stateKey];\n removeListeners(el, handlers, eventOptions);\n }\n\n controller.windowListeners = {};\n}\nfunction clearWindowListeners(_ref, stateKey, options) {\n var config = _ref.config,\n windowListeners = _ref.windowListeners;\n\n if (options === void 0) {\n options = config.eventOptions;\n }\n\n if (!config.window) return;\n removeListeners(config.window, windowListeners[stateKey], options);\n delete windowListeners[stateKey];\n}\nfunction updateWindowListeners(_ref2, stateKey, listeners, options) {\n var config = _ref2.config,\n windowListeners = _ref2.windowListeners;\n\n if (listeners === void 0) {\n listeners = [];\n }\n\n if (options === void 0) {\n options = config.eventOptions;\n }\n\n if (!config.window) return;\n removeListeners(config.window, windowListeners[stateKey], options);\n addListeners(config.window, windowListeners[stateKey] = listeners, options);\n}\n\nfunction updateDomListeners(_ref3, bindings) {\n var config = _ref3.config,\n domListeners = _ref3.domListeners;\n var domTarget = getDomTargetFromConfig(config);\n if (!domTarget) throw new Error('domTarget must be defined');\n var eventOptions = config.eventOptions;\n removeListeners(domTarget, takeAll(domListeners), eventOptions);\n\n for (var _i = 0, _Object$entries = Object.entries(bindings); _i < _Object$entries.length; _i++) {\n var _Object$entries$_i = _Object$entries[_i],\n key = _Object$entries$_i[0],\n fns = _Object$entries$_i[1];\n var name = key.slice(2).toLowerCase();\n domListeners.push([name, chainFns.apply(void 0, fns)]);\n }\n\n addListeners(domTarget, domListeners, eventOptions);\n}\n\nfunction getPropsListener(_ref4, bindings) {\n var config = _ref4.config;\n var props = {};\n var captureString = config.eventOptions.capture ? 'Capture' : '';\n\n for (var _i2 = 0, _Object$entries2 = Object.entries(bindings); _i2 < _Object$entries2.length; _i2++) {\n var _Object$entries2$_i = _Object$entries2[_i2],\n event = _Object$entries2$_i[0],\n fns = _Object$entries2$_i[1];\n var fnsArray = Array.isArray(fns) ? fns : [fns];\n var key = event + captureString;\n props[key] = chainFns.apply(void 0, fnsArray);\n }\n\n return props;\n}\n\nfunction takeAll(array) {\n if (array === void 0) {\n array = [];\n }\n\n return array.splice(0, array.length);\n}\n\nfunction getDomTargetFromConfig(_ref5) {\n var domTarget = _ref5.domTarget;\n return domTarget && 'current' in domTarget ? domTarget.current : domTarget;\n}\n/**\r\n * bindings is an object which keys match ReactEventHandlerKeys.\r\n * Since a recognizer might want to bind a handler function to an event key already used by a previously\r\n * added recognizer, we need to make sure that each event key is an array of all the functions mapped for\r\n * that key.\r\n */\n\n\nfunction addBindings(bindings, name, fn) {\n if (!bindings[name]) bindings[name] = [];\n bindings[name].push(fn);\n}\n\nfunction addListeners(el, listeners, options) {\n if (listeners === void 0) {\n listeners = [];\n }\n\n if (options === void 0) {\n options = {};\n }\n\n for (var _iterator2 = _createForOfIteratorHelperLoose(listeners), _step2; !(_step2 = _iterator2()).done;) {\n var _step2$value = _step2.value,\n eventName = _step2$value[0],\n eventHandler = _step2$value[1];\n el.addEventListener(eventName, eventHandler, options);\n }\n}\n\nfunction removeListeners(el, listeners, options) {\n if (listeners === void 0) {\n listeners = [];\n }\n\n if (options === void 0) {\n options = {};\n }\n\n for (var _iterator3 = _createForOfIteratorHelperLoose(listeners), _step3; !(_step3 = _iterator3()).done;) {\n var _step3$value = _step3.value,\n eventName = _step3$value[0],\n eventHandler = _step3$value[1];\n el.removeEventListener(eventName, eventHandler, options);\n }\n}\n\n/* eslint-disable react-hooks/exhaustive-deps */\n/**\r\n * Utility hook called by all gesture hooks and that will be responsible for the internals.\r\n *\r\n * @param handlers\r\n * @param classes\r\n * @param config\r\n * @param nativeHandlers - native handlers such as onClick, onMouseDown, etc.\r\n */\n\nfunction useRecognizers(handlers, config, nativeHandlers) {\n if (nativeHandlers === void 0) {\n nativeHandlers = {};\n }\n\n var classes = resolveClasses(handlers);\n var controller = React.useMemo(function () {\n return new Controller(classes);\n }, []);\n controller.config = config;\n controller.handlers = handlers;\n controller.nativeRefs = nativeHandlers;\n React.useEffect(controller.effect, []); // @ts-ignore\n\n if (controller.config.domTarget) return deprecationNoticeForDomTarget; // @ts-ignore\n\n return controller.bind;\n}\n\nfunction deprecationNoticeForDomTarget() {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\"Deprecation notice: When the `domTarget` option is specified, you don't need to write `useEffect(bind, [bind])` anymore: event binding is now made handled internally to this lib.\\n\\nNext version won't return anything when `domTarget` is provided, therefore your code will break if you try to call `useEffect`.\");\n }\n}\n\nfunction resolveClasses(internalHandlers) {\n var classes = new Set();\n if (internalHandlers.drag) classes.add(RecognizersMap.get('drag'));\n if (internalHandlers.wheel) classes.add(RecognizersMap.get('wheel'));\n if (internalHandlers.scroll) classes.add(RecognizersMap.get('scroll'));\n if (internalHandlers.move) classes.add(RecognizersMap.get('move'));\n if (internalHandlers.pinch) classes.add(RecognizersMap.get('pinch'));\n if (internalHandlers.hover) classes.add(RecognizersMap.get('hover'));\n return classes;\n}\n\n/**\r\n * @private\r\n * Abstract class for coordinates-based gesture recongizers\r\n */\n\nvar CoordinatesRecognizer = /*#__PURE__*/function (_Recognizer) {\n _inheritsLoose(CoordinatesRecognizer, _Recognizer);\n\n function CoordinatesRecognizer() {\n return _Recognizer.apply(this, arguments) || this;\n }\n\n var _proto = CoordinatesRecognizer.prototype;\n\n /**\r\n * Returns the real movement (without taking intentionality into account)\r\n */\n _proto.getInternalMovement = function getInternalMovement(values, state) {\n return subV(values, state.initial);\n }\n /**\r\n * In coordinates-based gesture, this function will detect the first intentional axis,\r\n * lock the gesture axis if lockDirection is specified in the config, block the gesture\r\n * if the first intentional axis doesn't match the specified axis in config.\r\n */\n ;\n\n _proto.checkIntentionality = function checkIntentionality(_intentional, _movement) {\n if (_intentional[0] === false && _intentional[1] === false) {\n return {\n _intentional: _intentional,\n axis: this.state.axis\n };\n }\n\n var _movement$map = _movement.map(Math.abs),\n absX = _movement$map[0],\n absY = _movement$map[1];\n\n var axis = this.state.axis || (absX > absY ? 'x' : absX < absY ? 'y' : undefined);\n if (!this.config.axis && !this.config.lockDirection) return {\n _intentional: _intentional,\n _blocked: false,\n axis: axis\n };\n if (!axis) return {\n _intentional: [false, false],\n _blocked: false,\n axis: axis\n };\n if (!!this.config.axis && axis !== this.config.axis) return {\n _intentional: _intentional,\n _blocked: true,\n axis: axis\n };\n _intentional[axis === 'x' ? 1 : 0] = false;\n return {\n _intentional: _intentional,\n _blocked: false,\n axis: axis\n };\n };\n\n _proto.getKinematics = function getKinematics(values, event) {\n var state = this.getMovement(values);\n\n if (!state._blocked) {\n var dt = event.timeStamp - this.state.timeStamp;\n Object.assign(state, calculateAllKinematics(state.movement, state.delta, dt));\n }\n\n return state;\n };\n\n _proto.mapStateValues = function mapStateValues(state) {\n return {\n xy: state.values,\n vxvy: state.velocities\n };\n };\n\n return CoordinatesRecognizer;\n}(Recognizer);\n\nvar TAP_DISTANCE_THRESHOLD = 3;\n\nfunction persistEvent(event) {\n 'persist' in event && typeof event.persist === 'function' && event.persist();\n}\n\nvar DragRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {\n _inheritsLoose(DragRecognizer, _CoordinatesRecognize);\n\n function DragRecognizer() {\n var _this;\n\n _this = _CoordinatesRecognize.apply(this, arguments) || this;\n _this.ingKey = 'dragging';\n _this.stateKey = 'drag'; // TODO add back when setPointerCapture is widely wupported\n // https://caniuse.com/#search=setPointerCapture\n\n _this.setPointerCapture = function (event) {\n // don't perform pointere capture when user wants to use touch events or\n // when a pointerLockElement exists as this would throw an error\n if (_this.config.useTouch || document.pointerLockElement) return;\n var target = event.target,\n pointerId = event.pointerId;\n\n if (target && 'setPointerCapture' in target) {\n // this would work in the DOM but doesn't with react three fiber\n // target.addEventListener('pointermove', this.onDragChange, this.controller.config.eventOptions)\n // @ts-expect-error\n target.setPointerCapture(pointerId);\n }\n\n _this.updateGestureState({\n _dragTarget: target,\n _dragPointerId: pointerId\n });\n };\n\n _this.releasePointerCapture = function () {\n if (_this.config.useTouch || document.pointerLockElement) return;\n var _this$state = _this.state,\n _dragTarget = _this$state._dragTarget,\n _dragPointerId = _this$state._dragPointerId;\n\n if (_dragPointerId && _dragTarget && 'releasePointerCapture' in _dragTarget) {\n // this would work in the DOM but doesn't with react three fiber\n // target.removeEventListener('pointermove', this.onDragChange, this.controller.config.eventOptions)\n if (!('hasPointerCapture' in _dragTarget) || _dragTarget.hasPointerCapture(_dragPointerId)) try {\n _dragTarget.releasePointerCapture(_dragPointerId);\n } catch (e) {}\n }\n };\n\n _this.preventScroll = function (event) {\n if (_this.state._dragPreventScroll && event.cancelable) {\n event.preventDefault();\n }\n };\n\n _this.getEventId = function (event) {\n if (_this.config.useTouch) return event.changedTouches[0].identifier;\n return event.pointerId;\n };\n\n _this.isValidEvent = function (event) {\n // if we were using pointer events only event.isPrimary === 1 would suffice\n return _this.state._pointerId === _this.getEventId(event);\n };\n\n _this.shouldPreventWindowScrollY = _this.config.experimental_preventWindowScrollY && _this.controller.supportsTouchEvents;\n\n _this.setUpWindowScrollDetection = function (event) {\n persistEvent(event); // we add window listeners that will prevent the scroll when the user has started dragging\n\n updateWindowListeners(_this.controller, _this.stateKey, [['touchmove', _this.preventScroll], ['touchend', _this.clean.bind(_assertThisInitialized(_this))], ['touchcancel', _this.clean.bind(_assertThisInitialized(_this))]], {\n passive: false\n });\n\n _this.setTimeout(_this.startDrag.bind(_assertThisInitialized(_this)), 250, event);\n };\n\n _this.setUpDelayedDragTrigger = function (event) {\n _this.state._dragDelayed = true;\n persistEvent(event);\n\n _this.setTimeout(_this.startDrag.bind(_assertThisInitialized(_this)), _this.config.delay, event);\n };\n\n _this.setStartState = function (event) {\n var values = getPointerEventValues(event, _this.transform);\n\n _this.updateSharedState(getGenericEventData(event));\n\n _this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {\n _pointerId: _this.getEventId(event)\n }));\n\n _this.updateGestureState(_this.getMovement(values));\n };\n\n _this.onDragStart = function (event) {\n addEventIds(_this.controller, event);\n if (!_this.enabled || _this.state._active) return;\n\n _this.setStartState(event);\n\n _this.setPointerCapture(event);\n\n if (_this.shouldPreventWindowScrollY) _this.setUpWindowScrollDetection(event);else if (_this.config.delay > 0) _this.setUpDelayedDragTrigger(event);else _this.startDrag(event, true); // we pass the values to the startDrag event\n };\n\n _this.onDragChange = function (event) {\n if ( // if the gesture was canceled or\n _this.state.canceled || // if onDragStart wasn't fired or\n !_this.state._active || // if the event pointerId doesn't match the one that initiated the drag\n !_this.isValidEvent(event) || // if the event has the same timestamp as the previous event\n // note that checking type equality is ONLY for tests ¯\\_(ツ)_/¯\n _this.state._lastEventType === event.type && event.timeStamp === _this.state.timeStamp) return;\n var values;\n\n if (document.pointerLockElement) {\n var movementX = event.movementX,\n movementY = event.movementY;\n values = addV(_this.transform([movementX, movementY]), _this.state.values);\n } else values = getPointerEventValues(event, _this.transform);\n\n var kinematics = _this.getKinematics(values, event); // if startDrag hasn't fired\n\n\n if (!_this.state._dragStarted) {\n // If the gesture isn't active then respond to the event only if\n // it's been delayed via the `delay` option, in which case start\n // the gesture immediately.\n if (_this.state._dragDelayed) {\n _this.startDrag(event);\n\n return;\n } // if the user wants to prevent vertical window scroll when user starts dragging\n\n\n if (_this.shouldPreventWindowScrollY) {\n if (!_this.state._dragPreventScroll && kinematics.axis) {\n // if the user is dragging horizontally then we should allow the drag\n if (kinematics.axis === 'x') {\n _this.startDrag(event);\n } else {\n _this.state._active = false;\n return;\n }\n } else return;\n } else return;\n }\n\n var genericEventData = getGenericEventData(event);\n\n _this.updateSharedState(genericEventData);\n\n var genericPayload = getGenericPayload(_assertThisInitialized(_this), event); // This verifies if the drag can be assimilated to a tap by checking\n // if the real distance of the drag (ie not accounting for the threshold) is\n // greater than the TAP_DISTANCE_THRESHOLD.\n\n var realDistance = calculateDistance(kinematics._movement);\n var _dragIsTap = _this.state._dragIsTap;\n if (_dragIsTap && realDistance >= TAP_DISTANCE_THRESHOLD) _dragIsTap = false;\n\n _this.updateGestureState(_extends({}, genericPayload, kinematics, {\n _dragIsTap: _dragIsTap\n }));\n\n _this.fireGestureHandler();\n };\n\n _this.onDragEnd = function (event) {\n removeEventIds(_this.controller, event); // if the event pointerId doesn't match the one that initiated the drag\n // we don't want to end the drag\n\n if (!_this.isValidEvent(event)) return;\n\n _this.clean(); // if the gesture is no longer active (ie canceled)\n // don't do anything\n\n\n if (!_this.state._active) return;\n _this.state._active = false;\n var tap = _this.state._dragIsTap;\n var _this$state$velocitie = _this.state.velocities,\n vx = _this$state$velocitie[0],\n vy = _this$state$velocitie[1];\n var _this$state$movement = _this.state.movement,\n mx = _this$state$movement[0],\n my = _this$state$movement[1];\n var _this$state$_intentio = _this.state._intentional,\n ix = _this$state$_intentio[0],\n iy = _this$state$_intentio[1];\n var _this$config$swipeVel = _this.config.swipeVelocity,\n svx = _this$config$swipeVel[0],\n svy = _this$config$swipeVel[1];\n var _this$config$swipeDis = _this.config.swipeDistance,\n sx = _this$config$swipeDis[0],\n sy = _this$config$swipeDis[1];\n var sd = _this.config.swipeDuration;\n\n var endState = _extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values));\n\n var swipe = [0, 0];\n\n if (endState.elapsedTime < sd) {\n if (ix !== false && Math.abs(vx) > svx && Math.abs(mx) > sx) swipe[0] = sign(vx);\n if (iy !== false && Math.abs(vy) > svy && Math.abs(my) > sy) swipe[1] = sign(vy);\n }\n\n _this.updateSharedState({\n buttons: 0\n });\n\n _this.updateGestureState(_extends({}, endState, {\n tap: tap,\n swipe: swipe\n }));\n\n _this.fireGestureHandler(_this.config.filterTaps && tap === true);\n };\n\n _this.clean = function () {\n _CoordinatesRecognize.prototype.clean.call(_assertThisInitialized(_this));\n\n _this.state._dragStarted = false;\n\n _this.releasePointerCapture();\n\n clearWindowListeners(_this.controller, _this.stateKey);\n };\n\n _this.onCancel = function () {\n if (_this.state.canceled) return;\n\n _this.updateGestureState({\n canceled: true,\n _active: false\n });\n\n _this.updateSharedState({\n buttons: 0\n });\n\n setTimeout(function () {\n return _this.fireGestureHandler();\n }, 0);\n };\n\n _this.onClick = function (event) {\n if (!_this.state._dragIsTap) event.stopPropagation();\n };\n\n return _this;\n }\n\n var _proto = DragRecognizer.prototype;\n\n _proto.startDrag = function startDrag(event, onDragIsStart) {\n if (onDragIsStart === void 0) {\n onDragIsStart = false;\n }\n\n // startDrag can happen after a timeout, so we need to check if the gesture is still active\n // as the user might have lift up the pointer in between.\n if ( // if the gesture isn't active (probably means)\n !this.state._active || // if the drag has already started we should ignore subsequent attempts\n this.state._dragStarted) return;\n if (!onDragIsStart) this.setStartState(event);\n this.updateGestureState({\n _dragStarted: true,\n _dragPreventScroll: true,\n cancel: this.onCancel\n });\n this.clearTimeout();\n this.fireGestureHandler();\n };\n\n _proto.addBindings = function addBindings$1(bindings) {\n if (this.config.useTouch) {\n addBindings(bindings, 'onTouchStart', this.onDragStart);\n\n addBindings(bindings, 'onTouchMove', this.onDragChange); // this is needed for react-three-fiber\n\n\n addBindings(bindings, 'onTouchEnd', this.onDragEnd);\n\n addBindings(bindings, 'onTouchCancel', this.onDragEnd);\n } else {\n addBindings(bindings, 'onPointerDown', this.onDragStart);\n\n addBindings(bindings, 'onPointerMove', this.onDragChange); // this is needed for react-three-fiber\n\n\n addBindings(bindings, 'onPointerUp', this.onDragEnd);\n\n addBindings(bindings, 'onPointerCancel', this.onDragEnd);\n }\n\n if (this.config.filterTaps) {\n var handler = this.controller.config.eventOptions.capture ? 'onClick' : 'onClickCapture';\n\n addBindings(bindings, handler, this.onClick);\n }\n };\n\n return DragRecognizer;\n}(CoordinatesRecognizer);\n\n/**\r\n * Inlined from https://github.com/alexreardon/memoize-one\r\n */\nfunction memoizeOne(resultFn, isEqual) {\n var lastThis;\n var lastArgs = [];\n var lastResult;\n var calledOnce = false;\n\n function memoized() {\n for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {\n newArgs[_key] = arguments[_key];\n }\n\n if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {\n return lastResult;\n }\n\n lastResult = resultFn.apply(this, newArgs);\n calledOnce = true;\n lastThis = this;\n lastArgs = newArgs;\n return lastResult;\n }\n\n return memoized;\n}\n\n/**\r\n * Taken from https://github.com/FormidableLabs/react-fast-compare\r\n *\r\n * Dropped comments and ArrayBuffer handling\r\n */\nfunction equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n var length, i, keys;\n\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n\n for (i = length; i-- !== 0;) {\n if (!equal(a[i], b[i])) return false;\n }\n\n return true;\n }\n\n var it;\n\n if (typeof Map === 'function' && a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false;\n it = a.entries();\n\n while (!(i = it.next()).done) {\n if (!b.has(i.value[0])) return false;\n }\n\n it = a.entries();\n\n while (!(i = it.next()).done) {\n if (!equal(i.value[1], b.get(i.value[0]))) return false;\n }\n\n return true;\n }\n\n if (typeof Set === 'function' && a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false;\n it = a.entries();\n\n while (!(i = it.next()).done) {\n if (!b.has(i.value[0])) return false;\n }\n\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;) {\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n }\n\n if (typeof Element !== 'undefined' && a instanceof Element) return false;\n\n for (i = length; i-- !== 0;) {\n if (keys[i] === '_owner' && a.$$typeof) continue;\n if (!equal(a[keys[i]], b[keys[i]])) return false;\n }\n\n return true;\n } // true if both NaN, false otherwise — NaN !== NaN → true\n // eslint-disable-next-line no-self-compare\n\n\n return a !== a && b !== b;\n}\n\nfunction isEqual(a, b) {\n try {\n return equal(a, b);\n } catch (error) {\n if ((error.message || '').match(/stack|recursion/i)) {\n // eslint-disable-next-line no-console\n console.warn('react-fast-compare cannot handle circular refs');\n return false;\n }\n\n throw error;\n }\n}\n\n/**\r\n * Drag hook.\r\n *\r\n * @param handler - the function fired every time the drag gesture updates\r\n * @param [config={}] - the config object including generic options and drag options\r\n */\n\nfunction useDrag(handler, config) {\n if (config === void 0) {\n config = {};\n }\n\n RecognizersMap.set('drag', DragRecognizer);\n var buildDragConfig = useRef();\n\n if (!buildDragConfig.current) {\n buildDragConfig.current = memoizeOne(_buildDragConfig, isEqual);\n }\n\n return useRecognizers({\n drag: handler\n }, buildDragConfig.current(config));\n}\n\n/**\r\n * @private\r\n * Abstract class for distance/angle-based gesture recongizers\r\n */\n\nvar DistanceAngleRecognizer = /*#__PURE__*/function (_Recognizer) {\n _inheritsLoose(DistanceAngleRecognizer, _Recognizer);\n\n function DistanceAngleRecognizer() {\n return _Recognizer.apply(this, arguments) || this;\n }\n\n var _proto = DistanceAngleRecognizer.prototype;\n\n _proto.getInternalMovement = function getInternalMovement(values, state) {\n var prev_a = state.values[1]; // not be defined if ctrl+wheel is used for zoom only\n\n var d = values[0],\n _values$ = values[1],\n a = _values$ === void 0 ? prev_a : _values$;\n var delta_a = a - prev_a;\n var next_turns = state.turns;\n if (Math.abs(delta_a) > 270) next_turns += sign(delta_a);\n return subV([d, a - 360 * next_turns], state.initial);\n };\n\n _proto.getKinematics = function getKinematics(values, event) {\n var state = this.getMovement(values);\n var turns = (values[1] - state._movement[1] - this.state.initial[1]) / 360;\n var dt = event.timeStamp - this.state.timeStamp;\n\n var _calculateAllKinemati = calculateAllKinematics(state.movement, state.delta, dt),\n kinematics = _objectWithoutPropertiesLoose(_calculateAllKinemati, [\"distance\", \"velocity\"]);\n\n return _extends({\n turns: turns\n }, state, kinematics);\n };\n\n _proto.mapStateValues = function mapStateValues(state) {\n return {\n da: state.values,\n vdva: state.velocities\n };\n };\n\n return DistanceAngleRecognizer;\n}(Recognizer);\n\nvar ZOOM_CONSTANT = 7;\nvar WEBKIT_DISTANCE_SCALE_FACTOR = 260;\nvar PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {\n _inheritsLoose(PinchRecognizer, _DistanceAngleRecogni);\n\n function PinchRecognizer() {\n var _this;\n\n _this = _DistanceAngleRecogni.apply(this, arguments) || this;\n _this.ingKey = 'pinching';\n _this.stateKey = 'pinch';\n\n _this.onPinchStart = function (event) {\n addEventIds(_this.controller, event);\n var touchIds = _this.controller.touchIds;\n if (!_this.enabled) return;\n\n if (_this.state._active) {\n // check that the pointerIds that initiated the gesture\n // are still enabled. This is useful for when the page\n // loses track of the pointers (minifying gesture on iPad).\n if (_this.state._pointerIds.every(function (id) {\n return touchIds.has(id);\n })) return; // something was wrong with the pointers but we let it go.\n } // until we reach two fingers on the target don't react\n\n\n if (touchIds.size < 2) return;\n\n var _pointerIds = Array.from(touchIds).slice(0, 2);\n\n var _getTwoTouchesEventVa = getTwoTouchesEventValues(event, _pointerIds, _this.transform),\n values = _getTwoTouchesEventVa.values,\n origin = _getTwoTouchesEventVa.origin;\n\n _this.updateSharedState(getGenericEventData(event));\n\n _this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {\n _pointerIds: _pointerIds,\n cancel: _this.onCancel,\n origin: origin\n }));\n\n _this.updateGestureState(_this.getMovement(values));\n\n _this.fireGestureHandler();\n };\n\n _this.onPinchChange = function (event) {\n var _this$state = _this.state,\n canceled = _this$state.canceled,\n _active = _this$state._active;\n if (canceled || !_active || // if the event has the same timestamp as the previous event\n event.timeStamp === _this.state.timeStamp) return;\n var genericEventData = getGenericEventData(event);\n\n _this.updateSharedState(genericEventData);\n\n try {\n var _getTwoTouchesEventVa2 = getTwoTouchesEventValues(event, _this.state._pointerIds, _this.transform),\n values = _getTwoTouchesEventVa2.values,\n origin = _getTwoTouchesEventVa2.origin;\n\n var kinematics = _this.getKinematics(values, event);\n\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), kinematics, {\n origin: origin\n }));\n\n _this.fireGestureHandler();\n } catch (e) {\n _this.onPinchEnd(event);\n }\n };\n\n _this.onPinchEnd = function (event) {\n removeEventIds(_this.controller, event);\n var pointerIds = getTouchIds(event); // if none of the lifted pointerIds is in the state pointerIds don't do anything\n\n if (_this.state._pointerIds.every(function (id) {\n return !pointerIds.includes(id);\n })) return;\n\n _this.clean();\n\n if (!_this.state._active) return;\n\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values), {\n _active: false\n }));\n\n _this.fireGestureHandler();\n };\n\n _this.onCancel = function () {\n if (_this.state.canceled) return;\n\n _this.updateGestureState({\n _active: false,\n canceled: true\n });\n\n setTimeout(function () {\n return _this.fireGestureHandler();\n }, 0);\n };\n /**\r\n * PINCH WITH WEBKIT GESTURES\r\n */\n\n\n _this.onGestureStart = function (event) {\n if (!_this.enabled) return;\n event.preventDefault();\n var values = getWebkitGestureEventValues(event, _this.transform);\n\n _this.updateSharedState(getGenericEventData(event));\n\n _this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {\n origin: [event.clientX, event.clientY],\n cancel: _this.onCancel\n }));\n\n _this.updateGestureState(_this.getMovement(values));\n\n _this.fireGestureHandler();\n };\n\n _this.onGestureChange = function (event) {\n var _this$state2 = _this.state,\n canceled = _this$state2.canceled,\n _active = _this$state2._active;\n if (canceled || !_active) return;\n event.preventDefault();\n var genericEventData = getGenericEventData(event);\n\n _this.updateSharedState(genericEventData); // this normalizes the values of the Safari's WebKitEvent by calculating\n // the delta and then multiplying it by a constant.\n\n\n var values = getWebkitGestureEventValues(event, _this.transform);\n values[0] = (values[0] - _this.state.event.scale) * WEBKIT_DISTANCE_SCALE_FACTOR + _this.state.values[0];\n\n var kinematics = _this.getKinematics(values, event);\n\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), kinematics, {\n origin: [event.clientX, event.clientY]\n }));\n\n _this.fireGestureHandler();\n };\n\n _this.onGestureEnd = function (event) {\n _this.clean();\n\n if (!_this.state._active) return;\n\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values), {\n _active: false,\n origin: [event.clientX, event.clientY]\n }));\n\n _this.fireGestureHandler();\n };\n /**\r\n * PINCH WITH WHEEL\r\n */\n\n\n _this.wheelShouldRun = function (event) {\n return _this.enabled && event.ctrlKey;\n };\n\n _this.getWheelValuesFromEvent = function (event) {\n var _getWheelEventValues = getWheelEventValues(event, _this.transform),\n delta_d = _getWheelEventValues[1];\n\n var _this$state$values = _this.state.values,\n prev_d = _this$state$values[0],\n prev_a = _this$state$values[1]; // ZOOM_CONSTANT is based on Safari trackpad natural zooming\n\n var _delta_d = -delta_d * ZOOM_CONSTANT; // new distance is the previous state distance added to the delta\n\n\n var d = prev_d + _delta_d;\n var a = prev_a !== void 0 ? prev_a : 0;\n return {\n values: [d, a],\n origin: [event.clientX, event.clientY],\n delta: [_delta_d, a]\n };\n };\n\n _this.onWheel = function (event) {\n if (!_this.wheelShouldRun(event)) return;\n\n _this.setTimeout(_this.onWheelEnd);\n\n if (!_this.state._active) _this.onWheelStart(event);else _this.onWheelChange(event);\n };\n\n _this.onWheelStart = function (event) {\n var _this$getWheelValuesF = _this.getWheelValuesFromEvent(event),\n values = _this$getWheelValuesF.values,\n delta = _this$getWheelValuesF.delta,\n origin = _this$getWheelValuesF.origin;\n\n if (event.cancelable) event.preventDefault();else if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('To properly support zoom on trackpads, try using the `domTarget` option and `config.eventOptions.passive` set to `false`. This message will only appear in development mode.');\n }\n\n _this.updateSharedState(getGenericEventData(event));\n\n _this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true), {\n offset: values,\n delta: delta,\n origin: origin\n }));\n\n _this.updateGestureState(_this.getMovement(values));\n\n _this.fireGestureHandler();\n };\n\n _this.onWheelChange = function (event) {\n if (event.cancelable) event.preventDefault();\n\n _this.updateSharedState(getGenericEventData(event));\n\n var _this$getWheelValuesF2 = _this.getWheelValuesFromEvent(event),\n values = _this$getWheelValuesF2.values,\n origin = _this$getWheelValuesF2.origin,\n delta = _this$getWheelValuesF2.delta;\n\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event), {\n origin: origin,\n delta: delta\n }));\n\n _this.fireGestureHandler();\n };\n\n _this.onWheelEnd = function () {\n _this.clean();\n\n if (!_this.state._active) return;\n _this.state._active = false;\n\n _this.updateGestureState(_this.getMovement(_this.state.values));\n\n _this.fireGestureHandler();\n };\n\n return _this;\n }\n\n var _proto = PinchRecognizer.prototype;\n\n _proto.addBindings = function addBindings$1(bindings) {\n // Only try to use gesture events when they are supported and domTarget is set\n // as React doesn't support gesture handlers.\n if (this.controller.config.domTarget && !this.controller.supportsTouchEvents && this.controller.supportsGestureEvents) {\n addBindings(bindings, 'onGestureStart', this.onGestureStart);\n\n addBindings(bindings, 'onGestureChange', this.onGestureChange);\n\n addBindings(bindings, 'onGestureEnd', this.onGestureEnd);\n } else {\n addBindings(bindings, 'onTouchStart', this.onPinchStart);\n\n addBindings(bindings, 'onTouchMove', this.onPinchChange);\n\n addBindings(bindings, 'onTouchEnd', this.onPinchEnd);\n\n addBindings(bindings, 'onTouchCancel', this.onPinchEnd);\n\n addBindings(bindings, 'onWheel', this.onWheel);\n }\n };\n\n return PinchRecognizer;\n}(DistanceAngleRecognizer);\n\n/**\r\n * Pinch hook.\r\n *\r\n * @param handler - the function fired every time the pinch gesture updates\r\n * @param [config={}] - the config object including generic options and pinch options\r\n */\n\nfunction usePinch(handler, config) {\n if (config === void 0) {\n config = {};\n }\n\n RecognizersMap.set('pinch', PinchRecognizer);\n var buildPinchConfig = useRef();\n\n if (!buildPinchConfig.current) {\n buildPinchConfig.current = memoizeOne(_buildPinchConfig, isEqual);\n }\n\n return useRecognizers({\n pinch: handler\n }, buildPinchConfig.current(config));\n}\n\nvar WheelRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {\n _inheritsLoose(WheelRecognizer, _CoordinatesRecognize);\n\n function WheelRecognizer() {\n var _this;\n\n _this = _CoordinatesRecognize.apply(this, arguments) || this;\n _this.ingKey = 'wheeling';\n _this.stateKey = 'wheel';\n _this.debounced = true;\n\n _this.handleEvent = function (event) {\n if (event.ctrlKey && 'pinch' in _this.controller.handlers) return;\n if (!_this.enabled) return;\n\n _this.setTimeout(_this.onEnd);\n\n _this.updateSharedState(getGenericEventData(event));\n\n var values = addV(getWheelEventValues(event, _this.transform), _this.state.values);\n\n if (!_this.state._active) {\n _this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true)));\n\n var movement = _this.getMovement(values);\n\n var geometry = calculateAllGeometry(movement.delta);\n\n _this.updateGestureState(movement);\n\n _this.updateGestureState(geometry);\n } else {\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));\n }\n\n _this.fireGestureHandler();\n };\n\n _this.onEnd = function () {\n _this.clean();\n\n if (!_this.state._active) return;\n\n var movement = _this.getMovement(_this.state.values);\n\n _this.updateGestureState(movement);\n\n _this.updateGestureState({\n _active: false,\n velocities: [0, 0],\n velocity: 0\n });\n\n _this.fireGestureHandler();\n };\n\n return _this;\n }\n\n var _proto = WheelRecognizer.prototype;\n\n _proto.addBindings = function addBindings$1(bindings) {\n addBindings(bindings, 'onWheel', this.handleEvent);\n };\n\n return WheelRecognizer;\n}(CoordinatesRecognizer);\n\n/**\r\n * Wheel hook.\r\n *\r\n * @param handler - the function fired every time the wheel gesture updates\r\n * @param the config object including generic options and wheel options\r\n */\n\nfunction useWheel(handler, config) {\n if (config === void 0) {\n config = {};\n }\n\n RecognizersMap.set('wheel', WheelRecognizer);\n var buildWheelConfig = useRef();\n\n if (!buildWheelConfig.current) {\n buildWheelConfig.current = memoizeOne(_buildWheelConfig, isEqual);\n }\n\n return useRecognizers({\n wheel: handler\n }, buildWheelConfig.current(config));\n}\n\nvar MoveRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {\n _inheritsLoose(MoveRecognizer, _CoordinatesRecognize);\n\n function MoveRecognizer() {\n var _this;\n\n _this = _CoordinatesRecognize.apply(this, arguments) || this;\n _this.ingKey = 'moving';\n _this.stateKey = 'move';\n _this.debounced = true;\n\n _this.onMove = function (event) {\n if (!_this.enabled) return;\n\n _this.setTimeout(_this.onMoveEnd);\n\n if (!_this.state._active) _this.onMoveStart(event);else _this.onMoveChange(event);\n };\n\n _this.onMoveStart = function (event) {\n _this.updateSharedState(getGenericEventData(event));\n\n var values = getPointerEventValues(event, _this.transform);\n\n _this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true)));\n\n _this.updateGestureState(_this.getMovement(values));\n\n _this.fireGestureHandler();\n };\n\n _this.onMoveChange = function (event) {\n _this.updateSharedState(getGenericEventData(event));\n\n var values = getPointerEventValues(event, _this.transform);\n\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));\n\n _this.fireGestureHandler();\n };\n\n _this.onMoveEnd = function () {\n _this.clean();\n\n if (!_this.state._active) return;\n var values = _this.state.values;\n\n _this.updateGestureState(_this.getMovement(values));\n\n _this.updateGestureState({\n velocities: [0, 0],\n velocity: 0,\n _active: false\n });\n\n _this.fireGestureHandler();\n };\n\n _this.hoverTransform = function () {\n return _this.controller.config.hover.transform || _this.controller.config.transform;\n };\n\n _this.onPointerEnter = function (event) {\n _this.controller.state.shared.hovering = true;\n if (!_this.controller.config.enabled) return;\n\n if (_this.controller.config.hover.enabled) {\n var values = getPointerEventValues(event, _this.hoverTransform());\n\n var state = _extends({}, _this.controller.state.shared, _this.state, getGenericPayload(_assertThisInitialized(_this), event, true), {\n args: _this.args,\n values: values,\n active: true,\n hovering: true\n });\n\n _this.controller.handlers.hover(_extends({}, state, _this.mapStateValues(state)));\n }\n\n if ('move' in _this.controller.handlers) _this.onMoveStart(event);\n };\n\n _this.onPointerLeave = function (event) {\n _this.controller.state.shared.hovering = false;\n if ('move' in _this.controller.handlers) _this.onMoveEnd();\n if (!_this.controller.config.hover.enabled) return;\n var values = getPointerEventValues(event, _this.hoverTransform());\n\n var state = _extends({}, _this.controller.state.shared, _this.state, getGenericPayload(_assertThisInitialized(_this), event), {\n args: _this.args,\n values: values,\n active: false\n });\n\n _this.controller.handlers.hover(_extends({}, state, _this.mapStateValues(state)));\n };\n\n return _this;\n }\n\n var _proto = MoveRecognizer.prototype;\n\n _proto.addBindings = function addBindings$1(bindings) {\n if ('move' in this.controller.handlers) {\n addBindings(bindings, 'onPointerMove', this.onMove);\n }\n\n if ('hover' in this.controller.handlers) {\n addBindings(bindings, 'onPointerEnter', this.onPointerEnter);\n\n addBindings(bindings, 'onPointerLeave', this.onPointerLeave);\n }\n };\n\n return MoveRecognizer;\n}(CoordinatesRecognizer);\n\n/**\r\n * Move hook.\r\n *\r\n * @param handler - the function fired every time the move gesture updates\r\n * @param [config={}] - the config object including generic options and move options\r\n */\n\nfunction useMove(handler, config) {\n if (config === void 0) {\n config = {};\n }\n\n RecognizersMap.set('move', MoveRecognizer);\n var buildMoveConfig = useRef();\n\n if (!buildMoveConfig.current) {\n buildMoveConfig.current = memoizeOne(_buildMoveConfig, isEqual);\n }\n\n return useRecognizers({\n move: handler\n }, buildMoveConfig.current(config));\n}\n\n/**\r\n * Hover hook.\r\n *\r\n * @param handler - the function fired every time the hover gesture updates\r\n * @param [config={}] - the config object including generic options and hover options\r\n */\n\nfunction useHover(handler, config) {\n if (config === void 0) {\n config = {};\n }\n\n RecognizersMap.set('hover', MoveRecognizer);\n var buildHoverConfig = useRef();\n\n if (!buildHoverConfig.current) {\n buildHoverConfig.current = memoizeOne(_buildHoverConfig, isEqual);\n }\n\n return useRecognizers({\n hover: handler\n }, buildHoverConfig.current(config));\n}\n\nvar ScrollRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {\n _inheritsLoose(ScrollRecognizer, _CoordinatesRecognize);\n\n function ScrollRecognizer() {\n var _this;\n\n _this = _CoordinatesRecognize.apply(this, arguments) || this;\n _this.ingKey = 'scrolling';\n _this.stateKey = 'scroll';\n _this.debounced = true;\n\n _this.handleEvent = function (event) {\n if (!_this.enabled) return;\n\n _this.clearTimeout();\n\n _this.setTimeout(_this.onEnd);\n\n var values = getScrollEventValues(event, _this.transform);\n\n _this.updateSharedState(getGenericEventData(event));\n\n if (!_this.state._active) {\n _this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true)));\n\n var movementDetection = _this.getMovement(values);\n\n var geometry = calculateAllGeometry(movementDetection.delta);\n\n _this.updateGestureState(movementDetection);\n\n _this.updateGestureState(geometry);\n } else {\n _this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));\n }\n\n _this.fireGestureHandler();\n };\n\n _this.onEnd = function () {\n _this.clean();\n\n if (!_this.state._active) return;\n\n _this.updateGestureState(_extends({}, _this.getMovement(_this.state.values), {\n _active: false,\n velocities: [0, 0],\n velocity: 0\n }));\n\n _this.fireGestureHandler();\n };\n\n return _this;\n }\n\n var _proto = ScrollRecognizer.prototype;\n\n _proto.addBindings = function addBindings$1(bindings) {\n addBindings(bindings, 'onScroll', this.handleEvent);\n };\n\n return ScrollRecognizer;\n}(CoordinatesRecognizer);\n\n/**\r\n * Scroll hook.\r\n *\r\n * @param handler - the function fired every time the scroll gesture updates\r\n * @param [config={}] - the config object including generic options and scroll options\r\n */\n\nfunction useScroll(handler, config) {\n if (config === void 0) {\n config = {};\n }\n\n RecognizersMap.set('scroll', ScrollRecognizer);\n var buildScrollConfig = useRef();\n\n if (!buildScrollConfig.current) {\n buildScrollConfig.current = memoizeOne(_buildScrollConfig, isEqual);\n }\n\n return useRecognizers({\n scroll: handler\n }, buildScrollConfig.current(config));\n}\n\nvar RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;\n\nfunction sortHandlers(handlers) {\n var _native = {};\n var handle = {};\n var actions = new Set();\n\n for (var key in handlers) {\n if (RE_NOT_NATIVE.test(key)) {\n actions.add(RegExp.lastMatch);\n handle[key] = handlers[key];\n } else {\n _native[key] = handlers[key];\n }\n }\n\n return [handle, _native, actions];\n}\n/**\r\n * @public\r\n *\r\n * The most complete gesture hook, allowing support for multiple gestures.\r\n *\r\n * @param {Handlers} handlers - an object with on[Gesture] keys containg gesture handlers\r\n * @param {UseGestureConfig} [config={}] - the full config object\r\n * @returns {(...args: any[]) => HookReturnType}\r\n */\n\n\nfunction useGesture(_handlers, config) {\n if (config === void 0) {\n config = {};\n }\n\n var _sortHandlers = sortHandlers(_handlers),\n handlers = _sortHandlers[0],\n nativeHandlers = _sortHandlers[1],\n actions = _sortHandlers[2];\n\n RecognizersMap.set('drag', DragRecognizer);\n RecognizersMap.set('hover', MoveRecognizer);\n RecognizersMap.set('move', MoveRecognizer);\n RecognizersMap.set('pinch', PinchRecognizer);\n RecognizersMap.set('scroll', ScrollRecognizer);\n RecognizersMap.set('wheel', WheelRecognizer);\n var mergedConfig = buildComplexConfig(config, actions);\n var internalHandlers = {};\n if (actions.has('onDrag')) internalHandlers.drag = includeStartEndHandlers(handlers, 'onDrag');\n if (actions.has('onWheel')) internalHandlers.wheel = includeStartEndHandlers(handlers, 'onWheel');\n if (actions.has('onScroll')) internalHandlers.scroll = includeStartEndHandlers(handlers, 'onScroll');\n if (actions.has('onMove')) internalHandlers.move = includeStartEndHandlers(handlers, 'onMove');\n if (actions.has('onPinch')) internalHandlers.pinch = includeStartEndHandlers(handlers, 'onPinch');\n if (actions.has('onHover')) internalHandlers.hover = handlers.onHover;\n return useRecognizers(internalHandlers, mergedConfig, nativeHandlers);\n}\n\nfunction includeStartEndHandlers(handlers, handlerKey) {\n var startKey = handlerKey + 'Start';\n var endKey = handlerKey + 'End';\n\n var fn = function fn(state) {\n var memo = undefined;\n if (state.first && startKey in handlers) handlers[startKey](state);\n if (handlerKey in handlers) memo = handlers[handlerKey](state);\n if (state.last && endKey in handlers) handlers[endKey](state);\n return memo;\n };\n\n return fn;\n}\n\nexport { addV, rubberbandIfOutOfBounds, subV, useDrag, useGesture, useHover, useMove, usePinch, useScroll, useWheel };\n//# sourceMappingURL=reactusegesture.esm.js.map\n","/** @license React v16.14.0\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),g=60103;exports.Fragment=60107;if(\"function\"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h(\"react.element\");exports.Fragment=h(\"react.fragment\")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=\"\"+k);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;\n","/** @license React v16.14.0\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var l=require(\"object-assign\"),n=\"function\"===typeof Symbol&&Symbol.for,p=n?Symbol.for(\"react.element\"):60103,q=n?Symbol.for(\"react.portal\"):60106,r=n?Symbol.for(\"react.fragment\"):60107,t=n?Symbol.for(\"react.strict_mode\"):60108,u=n?Symbol.for(\"react.profiler\"):60114,v=n?Symbol.for(\"react.provider\"):60109,w=n?Symbol.for(\"react.context\"):60110,x=n?Symbol.for(\"react.forward_ref\"):60112,y=n?Symbol.for(\"react.suspense\"):60113,z=n?Symbol.for(\"react.memo\"):60115,A=n?Symbol.for(\"react.lazy\"):\n60116,B=\"function\"===typeof Symbol&&Symbol.iterator;function C(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cQ.length&&Q.push(a)}\nfunction T(a,b,c,e){var d=typeof a;if(\"undefined\"===d||\"boolean\"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case \"string\":case \"number\":g=!0;break;case \"object\":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(e,a,\"\"===b?\".\"+U(a,0):b),1;g=0;b=\"\"===b?\".\":b+\":\";if(Array.isArray(a))for(var k=0;k