react-use-gesture
Advanced tools
Comparing version 8.1.0-beta.9 to 9.0.0-beta.10
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(e,t){return e.map((function(e,n){return e+t[n]}))}function o(e,t){return e.map((function(e,n){return e-t[n]}))}function i(e){return Math.hypot.apply(Math,e)}function a(e,t){void 0===t&&(t=e);var n=i(t),r=0===n?0:1/n,o=t.map((function(e){return r*e}));return{distance:i(e),direction:o}}function s(e,t,n){var r=i(t),o=0===r?0:1/r,a=0===n?0:1/n,s=a*r,u=t.map((function(e){return a*e})),c=t.map((function(e){return o*e}));return{velocities:u,velocity:s,distance:i(e),direction:c}}function u(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function c(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function l(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-c(t-e,n-t,r)+t:e>n?+c(e-n,n-t,r)+n:e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function f(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function m(){}function y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?m:1===t.length?t[0]:function(){for(var e,n,r=g(t);!(n=r()).done;){var o=n.value;e=o.apply(this,arguments)||e}return e}}function S(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function b(e,t){return Object.assign({},t,e||{})}function w(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function _(e,t){void 0===e&&(e={});for(var n={},r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0],s=i[1];switch(typeof s){case"function":n[a]=s.call(n,e[a],a,e);break;case"object":n[a]=_(e[a],s);break;case"boolean":s&&(n[a]=e[a])}}return n}function T(){return"undefined"!=typeof window&&"ontouchstart"in window}function G(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function M(e){return"pointerId"in e?[e.pointerId]:Array.from(G(e)).map((function(e){return e.identifier}))}function E(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var O=function(e){return e};function I(e,t){void 0===t&&(t=O);var n=G(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}function x(e,t,n){void 0===n&&(n=O);var r=Array.from(e.touches).filter((function(e){return t.includes(e.identifier)})),o=r[0],i=r[1],a=i.clientX-o.clientX,s=i.clientY-o.clientY,u=(i.clientX+o.clientX)/2,c=(i.clientY+o.clientY)/2;return{values:n([Math.hypot(a,s),-180*Math.atan2(a,s)/Math.PI]),origin:n([u,c])}}function P(e,t){void 0===t&&(t=O);var n=e.currentTarget;return t([n.scrollX||n.scrollLeft||0,n.scrollY||n.scrollTop||0])}function K(e,t){void 0===t&&(t=O);var n=e.deltaX,r=e.deltaY,o=e.deltaMode;return 1===o?(n*=40,r*=40):2===o&&(n*=800,r*=800),t([n,r])}function D(e,t){return void 0===t&&(t=O),t([260*e.scale,e.rotation])}var C={threshold:function(e){return void 0===e&&(e=0),S(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return S(.15);case!1:return S(0);default:return S(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:S(e)},transform:!0},k=d({},C,{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return k.bounds(e(t))};var t=e.left,n=e.right,r=e.top,o=e.bottom;return[[void 0===t?-Infinity:t,void 0===n?Infinity:n],[void 0===r?-Infinity:r,void 0===o?Infinity:o]]}}),j="undefined"!=typeof window&&window.document&&window.document.createElement,H={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=j?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=t.capture;return{passive:void 0===n||n,capture:void 0!==r&&r}},transform:!0},W=d({},C,{bounds:function(e,t,n){var r=n.distanceBounds,o=void 0===r?{}:r,i=n.angleBounds,a=void 0===i?{}:i,s=function(e){var t=b(w(o,e),{min:-Infinity,max:Infinity});return[t.min,t.max]},u=function(e){var t=b(w(a,e),{min:-Infinity,max:Infinity});return[t.min,t.max]};return"function"!=typeof o&&"function"!=typeof a?[s(),u()]:function(e){return[s(e),u(e)]}}}),A=d({},k,{useTouch:function(e){return void 0===e&&(e=!1),e&&T()},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,o=void 0!==r&&r,i=n.lockDirection,a=n.axis,s=S(e,o?3:void 0!==i&&i||(void 0===a?void 0:a)?1:0);return this.filterTaps=o,s},swipeVelocity:function(e){return void 0===e&&(e=.5),S(e)},swipeDistance:function(e){return void 0===e&&(e=60),S(e)},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function Y(e){return void 0===e&&(e={}),_(e,H)}function L(e){return void 0===e&&(e={}),_(e,k)}function V(e){return void 0===e&&(e={}),_(e,W)}function R(e){return void 0===e&&(e={}),_(e,A)}function X(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.move=L(i),a}function B(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.hover=d({enabled:!0},i),a}function z(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.drag=R(i),a}function U(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.pinch=V(i),a}function F(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.scroll=L(i),a}function $(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.wheel=L(i),a}function N(e){return d({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-Infinity,Infinity],[-Infinity,Infinity]],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:m,canceled:!1,memo:void 0,args:void 0},e)}function q(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:N({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:N({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var J=new Map,Q=function(e){return e},Z=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(i))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var o=n.controller.pointerIds.size||n.controller.touchIds.size,i=n.controller.state.shared.buttons>0||o>0,a=d({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{touches:o,down:i}),s=n.handler(a);return n.state.memo=void 0!==s?s:n.state.memo,a}}var t,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config,n=t.rubberband,i=t.threshold,a=this.state,s=a._bounds,u=a._initial,c=a._active,l=a._intentional,v=a.lastOffset,f=a.movement,h=this.getInternalMovement(e,this.state),p=this.transform(i).map(Math.abs),g=!1===l[0]?ee(h[0],p[0]):l[0],m=!1===l[1]?ee(h[1],p[1]):l[1],y=this.checkIntentionality([g,m],h);if(y._blocked)return d({},y,{_movement:h,delta:[0,0]});var S=y._intentional,b=h,w=[!1!==S[0]?h[0]-S[0]:0,!1!==S[1]?h[1]-S[1]:0],_=r(w,v),T=c?n:[0,0];return w=te(s,r(w,u),T),d({},y,{intentional:!1!==S[0]||!1!==S[1],_initial:u,_movement:b,movement:w,values:e,offset:te(s,_,T),delta:o(w,f)})},n.clean=function(){this.clearTimeout()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Q}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function ee(e,t){return Math.abs(e)>=t&&u(e)*t}function te(e,t,n){var r=t[1],o=n[1],i=e[0],a=e[1],s=a[0],u=a[1];return[l(t[0],i[0],i[1],n[0]),l(r,s,u,o)]}function ne(e,t,n){var r=e.state,o=t.timeStamp;return{_lastEventType:t.type,event:t,timeStamp:o,elapsedTime:n?0:o-r.startTime,previous:r.values}}function re(e,t,n){var r=e.config,o=e.stateKey,i=e.args,a=e.state.offset,s=n.timeStamp,u=r.initial,c=r.bounds,l=d({},q()[o],{_active:!0,args:i,values:t,initial:t,offset:a,lastOffset:a,startTime:s});return d({},l,{_initial:w(u,l),_bounds:w(c,l)})}function oe(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return e.call.apply(e,[this,d({},t,{event:n})].concat(o))}}var ie=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=T(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e={},n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];for(var i,a=g(t.classes);!(i=a()).done;){var s=i.value;new s(t,r).addBindings(e)}for(var u=0,c=Object.entries(t.nativeRefs);u<c.length;u++){var l=c[u],v=l[0],f=l[1];he(e,v,oe(f,d({},t.state.shared,{args:r})))}return t.config.domTarget?le(t,e):de(t,e)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=fe(t.config),n=t.config.eventOptions;e&&ge(e,ve(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,o=e.windowListeners;if(n){for(var i in o)ge(n,o[i],r);e.windowListeners={}}}(t)},this.state=q(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ae(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.add,n)}function se(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.delete,n)}function ue(e,t,n){var r=e.config,o=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(ge(r.window,o[t],n),delete o[t])}function ce(e,t,n,r){var o=e.config,i=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=o.eventOptions),o.window&&(ge(o.window,i[t],r),pe(o.window,i[t]=n,r))}function le(e,t){var n=e.config,r=e.domListeners,o=fe(n);if(!o)throw new Error("domTarget must be defined");var i=n.eventOptions;ge(o,ve(r),i);for(var a=0,s=Object.entries(t);a<s.length;a++){var u=s[a],c=u[1],l=u[0].slice(2).toLowerCase();r.push([l,y.apply(void 0,c)])}pe(o,r,i)}function de(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",o=0,i=Object.entries(t);o<i.length;o++){var a=i[o],s=a[0],u=a[1],c=Array.isArray(u)?u:[u];n[s+r]=y.apply(void 0,c)}return n}function ve(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function fe(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function he(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function pe(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.addEventListener(i[0],i[1],n)}}function ge(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.removeEventListener(i[0],i[1],n)}}function me(e,t,r){void 0===r&&(r={});var o=function(e){var t=new Set;return e.drag&&t.add(J.get("drag")),e.wheel&&t.add(J.get("wheel")),e.scroll&&t.add(J.get("scroll")),e.move&&t.add(J.get("move")),e.pinch&&t.add(J.get("pinch")),e.hover&&t.add(J.get("hover")),t}(e),i=n.useMemo((function(){return new ie(o)}),[]);return i.config=t,i.handlers=e,i.nativeRefs=r,n.useEffect(i.effect,[]),i.config.domTarget?ye:i.bind}function ye(){}var Se=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return o(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],o=n[1],i=this.state.axis||(r>o?"x":r<o?"y":void 0);return this.config.axis||this.config.lockDirection?i?this.config.axis&&i!==this.config.axis?{_intentional:e,_blocked:!0,axis:i}:(e["x"===i?1:0]=!1,{_intentional:e,_blocked:!1,axis:i}):{_intentional:[!1,!1],_blocked:!1,axis:i}:{_intentional:e,_blocked:!1,axis:i}},n.getKinematics=function(e,t){var n=this.getMovement(e);return n._blocked||Object.assign(n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp)),n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(Z);function be(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var we=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&(n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r}))},t.releasePointerCapture=function(){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){be(e),ce(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(h(t))],["touchcancel",t.clean.bind(h(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(h(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,be(e),t.setTimeout(t.startDrag.bind(h(t)),t.config.delay,e)},t.setStartState=function(e){var n=I(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){ae(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.config.useTouch||t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)){var n=I(e,t.transform),r=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!r.axis)return;if("x"!==r.axis)return void(t.state._active=!1);t.startDrag(e)}var o=E(e);t.updateSharedState(o);var a=ne(h(t),e),s=i(r._movement),u=t.state._dragIsTap;u&&s>=3&&(u=!1),t.updateGestureState(d({},a,r,{_dragIsTap:u})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(se(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,o=r[0],i=r[1],a=t.state.movement,s=a[0],c=a[1],l=t.state._intentional,v=l[0],f=l[1],p=t.config.swipeVelocity,g=p[0],m=p[1],y=t.config.swipeDistance,S=y[0],b=y[1],w=d({},ne(h(t),e),t.getMovement(t.state.values)),_=[0,0];w.elapsedTime<220&&(!1!==v&&Math.abs(o)>g&&Math.abs(s)>S&&(_[0]=u(o)),!1!==f&&Math.abs(i)>m&&Math.abs(c)>b&&(_[1]=u(i))),t.updateSharedState({buttons:0}),t.updateGestureState(d({},w,{tap:n,swipe:_})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(h(t)),t.state._dragStarted=!1,t.config.useTouch||t.releasePointerCapture(),ue(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}v(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(he(e,"onTouchStart",this.onDragStart),he(e,"onTouchMove",this.onDragChange),he(e,"onTouchEnd",this.onDragEnd),he(e,"onTouchCancel",this.onDragEnd)):(he(e,"onPointerDown",this.onDragStart),he(e,"onPointerMove",this.onDragChange),he(e,"onPointerUp",this.onDragEnd),he(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&he(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(Se);function _e(e,t){var n,r,o=[],i=!1;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return i&&n===this&&t(s,o)||(r=e.apply(this,s),i=!0,n=this,o=s),r}}function Te(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i,a;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;for(a=t.entries();!(o=a.next()).done;)if(!e(o.value[1],n.get(o.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(o=r;0!=o--;)if(!("_owner"===i[o]&&t.$$typeof||e(t[i[o]],n[i[o]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Ge=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="pinching",t.stateKey="pinch",t.onPinchStart=function(e){if(ae(t.controller,e),t.enabled&&!t.state._active&&!(t.controller.touchIds.size<2)){var n=Array.from(t.controller.touchIds).slice(0,2),r=x(e,n,t.transform),o=r.values,i=r.origin;t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),o,e),ne(h(t),e,!0),{_pointerIds:n,cancel:t.onCancel,origin:i})),t.updateGestureState(t.getMovement(o)),t.fireGestureHandler()}},t.onPinchChange=function(e){var n=t.state;if(!n.canceled&&n._active){var r=E(e);t.updateSharedState(r);var o=x(e,t.state._pointerIds,t.transform),i=o.origin,a=t.getKinematics(o.values,e);t.updateGestureState(d({},ne(h(t),e),a,{origin:i})),t.fireGestureHandler()}},t.onPinchEnd=function(e){se(t.controller,e);var n=M(e);t.state._pointerIds.every((function(e){return!n.includes(e)}))||(t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1})),t.fireGestureHandler()))},t.onCancel=function(){t.state.canceled||(t.updateGestureState({_active:!1,canceled:!0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onGestureStart=function(e){if(t.enabled){e.preventDefault();var n=D(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{origin:[e.clientX,e.clientY],cancel:t.onCancel})),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()}},t.onGestureChange=function(e){var n=t.state;if(!n.canceled&&n._active){e.preventDefault();var r=E(e);t.updateSharedState(r);var o=D(e,t.transform),i=t.getKinematics(o,e);t.updateGestureState(d({},ne(h(t),e),i,{origin:[e.clientX,e.clientY]})),t.fireGestureHandler()}},t.onGestureEnd=function(e){t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1,origin:[e.clientX,e.clientY]})),t.fireGestureHandler())},t.wheelShouldRun=function(e){return t.enabled&&e.ctrlKey},t.getWheelValuesFromEvent=function(e){var n=K(e,t.transform)[1],r=t.state.values,o=r[1];return{values:[r[0]-n,void 0!==o?o:0],origin:[e.clientX,e.clientY],delta:[0,n]}},t.onWheel=function(e){t.wheelShouldRun(e)&&(t.setTimeout(t.onWheelEnd),t.state._active?t.onWheelChange(e):t.onWheelStart(e))},t.onWheelStart=function(e){var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.delta,i=n.origin;e.cancelable&&e.preventDefault(),t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),r,e),ne(h(t),e,!0),{initial:t.state.values,offset:r,delta:o,origin:i})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()},t.onWheelChange=function(e){t.updateSharedState(E(e));var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.origin,i=n.delta;t.updateGestureState(d({},ne(h(t),e),t.getKinematics(r,e),{origin:o,delta:i})),t.fireGestureHandler()},t.onWheelEnd=function(){t.clean(),t.state._active&&(t.state._active=!1,t.updateGestureState(t.getMovement(t.state.values)),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(he(e,"onGestureStart",this.onGestureStart),he(e,"onGestureChange",this.onGestureChange),he(e,"onGestureEnd",this.onGestureEnd)):(he(e,"onTouchStart",this.onPinchStart),he(e,"onTouchMove",this.onPinchChange),he(e,"onTouchEnd",this.onPinchEnd),he(e,"onTouchCancel",this.onPinchEnd),he(e,"onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=t.values[1],r=e[0],i=e[1],a=void 0===i?n:i,s=a-n,c=t.turns;return Math.abs(s)>270&&(c+=u(s)),o([r,a-360*c],t.initial)},n.getKinematics=function(e,t){var n=this.getMovement(e);return d({turns:(e[1]-n._movement[1]-this.state.initial[1])/360},n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp))},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(Z)),Me=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="wheeling",t.stateKey="wheel",t.debounced=!0,t.handleEvent=function(e){if((!e.ctrlKey||!("pinch"in t.controller.handlers))&&t.enabled){t.setTimeout(t.onEnd),t.updateSharedState(E(e));var n=r(K(e,t.transform),t.state.values);if(t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var o=t.getMovement(n),i=a(o.delta);t.updateGestureState(o),t.updateGestureState(i)}t.fireGestureHandler()}},t.onEnd=function(){if(t.clean(),t.state._active){var e=t.getMovement(t.state.values);t.updateGestureState(e),t.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),t.fireGestureHandler()}},t}return v(t,e),t.prototype.addBindings=function(e){he(e,"onWheel",this.handleEvent)},t}(Se),Ee=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="moving",t.stateKey="move",t.debounced=!0,t.onMove=function(e){t.enabled&&(t.setTimeout(t.onMoveEnd),t.state._active?t.onMoveChange(e):t.onMoveStart(e))},t.onMoveStart=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0))),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()},t.onMoveChange=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e))),t.fireGestureHandler()},t.onMoveEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(t.getMovement(t.state.values)),t.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),t.fireGestureHandler())},t.hoverTransform=function(){return t.controller.config.hover.transform||t.controller.config.transform},t.onPointerEnter=function(e){if(t.controller.state.shared.hovering=!0,t.controller.config.enabled){if(t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e,!0),{args:t.args,values:n,active:!0,hovering:!0});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}"move"in t.controller.handlers&&t.onMoveStart(e)}},t.onPointerLeave=function(e){if(t.controller.state.shared.hovering=!1,"move"in t.controller.handlers&&t.onMoveEnd(),t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e),{args:t.args,values:n,active:!1});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}},t}return v(t,e),t.prototype.addBindings=function(e){"move"in this.controller.handlers&&he(e,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(he(e,"onPointerEnter",this.onPointerEnter),he(e,"onPointerLeave",this.onPointerLeave))},t}(Se),Oe=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="scrolling",t.stateKey="scroll",t.debounced=!0,t.handleEvent=function(e){if(t.enabled){t.clearTimeout(),t.setTimeout(t.onEnd);var n=P(e,t.transform);if(t.updateSharedState(E(e)),t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var r=t.getMovement(n),o=a(r.delta);t.updateGestureState(r),t.updateGestureState(o)}t.fireGestureHandler()}},t.onEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(d({},t.getMovement(t.state.values),{_active:!1,velocities:[0,0],velocity:0})),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){he(e,"onScroll",this.handleEvent)},t}(Se),Ie=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function xe(e,t){var n=t+"Start",r=t+"End";return function(o){var i=void 0;return o.first&&n in e&&e[n](o),t in e&&(i=e[t](o)),o.last&&r in e&&e[r](o),i}}exports.addV=r,exports.rubberbandIfOutOfBounds=l,exports.subV=o,exports.useDrag=function(e,n){void 0===n&&(n={}),J.set("drag",we);var r=t.useRef();return r.current||(r.current=_e(z,Te)),me({drag:e},r.current(n))},exports.useGesture=function(e,t){void 0===t&&(t={});var n=function(e){var t={},n={},r=new Set;for(var o in e)Ie.test(o)?(r.add(RegExp.lastMatch),n[o]=e[o]):t[o]=e[o];return[n,t,r]}(e),r=n[0],o=n[1],i=n[2];J.set("drag",we),J.set("hover",Ee),J.set("move",Ee),J.set("pinch",Ge),J.set("scroll",Oe),J.set("wheel",Me);var a=function(e,t){void 0===e&&(e={}),void 0===t&&(t=new Set);var n=e.drag,r=e.wheel,o=e.move,i=e.scroll,a=e.pinch,s=e.hover,u=Y({domTarget:e.domTarget,eventOptions:e.eventOptions,transform:e.transform,window:e.window,enabled:e.enabled});return t.has("onDrag")&&(u.drag=R(n)),t.has("onWheel")&&(u.wheel=L(r)),t.has("onScroll")&&(u.scroll=L(i)),t.has("onMove")&&(u.move=L(o)),t.has("onPinch")&&(u.pinch=V(a)),t.has("onHover")&&(u.hover=d({enabled:!0},s)),u}(t,i),s={};return i.has("onDrag")&&(s.drag=xe(r,"onDrag")),i.has("onWheel")&&(s.wheel=xe(r,"onWheel")),i.has("onScroll")&&(s.scroll=xe(r,"onScroll")),i.has("onMove")&&(s.move=xe(r,"onMove")),i.has("onPinch")&&(s.pinch=xe(r,"onPinch")),i.has("onHover")&&(s.hover=r.onHover),me(s,a,o)},exports.useHover=function(e,n){void 0===n&&(n={}),J.set("hover",Ee);var r=t.useRef();return r.current||(r.current=_e(B,Te)),me({hover:e},r.current(n))},exports.useMove=function(e,n){void 0===n&&(n={}),J.set("move",Ee);var r=t.useRef();return r.current||(r.current=_e(X,Te)),me({move:e},r.current(n))},exports.usePinch=function(e,n){void 0===n&&(n={}),J.set("pinch",Ge);var r=t.useRef();return r.current||(r.current=_e(U,Te)),me({pinch:e},r.current(n))},exports.useScroll=function(e,n){void 0===n&&(n={}),J.set("scroll",Oe);var r=t.useRef();return r.current||(r.current=_e(F,Te)),me({scroll:e},r.current(n))},exports.useWheel=function(e,n){void 0===n&&(n={}),J.set("wheel",Me);var r=t.useRef();return r.current||(r.current=_e($,Te)),me({wheel:e},r.current(n))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(e,t){return e.map((function(e,n){return e+t[n]}))}function o(e,t){return e.map((function(e,n){return e-t[n]}))}function i(e){return Math.hypot.apply(Math,e)}function a(e,t){void 0===t&&(t=e);var n=i(t),r=0===n?0:1/n,o=t.map((function(e){return r*e}));return{distance:i(e),direction:o}}function s(e,t,n){var r=i(t),o=0===r?0:1/r,a=0===n?0:1/n,s=a*r,u=t.map((function(e){return a*e})),c=t.map((function(e){return o*e}));return{velocities:u,velocity:s,distance:i(e),direction:c}}function u(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function c(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function l(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-c(t-e,n-t,r)+t:e>n?+c(e-n,n-t,r)+n:e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function f(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function m(){}function y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?m:1===t.length?t[0]:function(){for(var e,n,r=g(t);!(n=r()).done;){var o=n.value;e=o.apply(this,arguments)||e}return e}}function S(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function b(e,t){return Object.assign({},t,e||{})}function w(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function _(e,t){void 0===e&&(e={});for(var n={},r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0],s=i[1];switch(typeof s){case"function":n[a]=s.call(n,e[a],a,e);break;case"object":n[a]=_(e[a],s);break;case"boolean":s&&(n[a]=e[a])}}return n}function T(){return"undefined"!=typeof window&&"ontouchstart"in window}function G(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function M(e){return"pointerId"in e?[e.pointerId]:Array.from(G(e)).map((function(e){return e.identifier}))}function E(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var O=function(e){return e};function I(e,t){void 0===t&&(t=O);var n=G(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}function x(e,t,n){void 0===n&&(n=O);var r=Array.from(e.touches).filter((function(e){return t.includes(e.identifier)})),o=r[0],i=r[1],a=i.clientX-o.clientX,s=i.clientY-o.clientY,u=(i.clientX+o.clientX)/2,c=(i.clientY+o.clientY)/2;return{values:n([Math.hypot(a,s),-180*Math.atan2(a,s)/Math.PI]),origin:n([u,c])}}function P(e,t){void 0===t&&(t=O);var n=e.currentTarget;return t([n.scrollX||n.scrollLeft||0,n.scrollY||n.scrollTop||0])}function K(e,t){void 0===t&&(t=O);var n=e.deltaX,r=e.deltaY,o=e.deltaMode;return 1===o?(n*=40,r*=40):2===o&&(n*=800,r*=800),t([n,r])}function D(e,t){return void 0===t&&(t=O),t([260*e.scale,e.rotation])}var C={threshold:function(e){return void 0===e&&(e=0),S(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return S(.15);case!1:return S(0);default:return S(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:S(e)},transform:!0},k=d({},C,{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return k.bounds(e(t))};var t=e.left,n=e.right,r=e.top,o=e.bottom;return[[void 0===t?-Infinity:t,void 0===n?Infinity:n],[void 0===r?-Infinity:r,void 0===o?Infinity:o]]}}),j="undefined"!=typeof window&&window.document&&window.document.createElement,H={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=j?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=t.capture;return{passive:void 0===n||n,capture:void 0!==r&&r}},transform:!0},W=d({},C,{bounds:function(e,t,n){var r=n.distanceBounds,o=void 0===r?{}:r,i=n.angleBounds,a=void 0===i?{}:i,s=function(e){var t=b(w(o,e),{min:-Infinity,max:Infinity});return[t.min,t.max]},u=function(e){var t=b(w(a,e),{min:-Infinity,max:Infinity});return[t.min,t.max]};return"function"!=typeof o&&"function"!=typeof a?[s(),u()]:function(e){return[s(e),u(e)]}}}),A=d({},k,{useTouch:function(e){return void 0===e&&(e=!1),e&&T()},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,o=void 0!==r&&r,i=n.lockDirection,a=n.axis,s=S(e,o?3:void 0!==i&&i||(void 0===a?void 0:a)?1:0);return this.filterTaps=o,s},swipeVelocity:function(e){return void 0===e&&(e=.5),S(e)},swipeDistance:function(e){return void 0===e&&(e=60),S(e)},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function L(e){return void 0===e&&(e={}),_(e,H)}function Y(e){return void 0===e&&(e={}),_(e,k)}function V(e){return void 0===e&&(e={}),_(e,W)}function R(e){return void 0===e&&(e={}),_(e,A)}function X(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.move=Y(i),a}function B(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.hover=d({enabled:!0},i),a}function z(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.drag=R(i),a}function U(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.pinch=V(i),a}function F(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.scroll=Y(i),a}function $(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=f(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.wheel=Y(i),a}function N(e){return d({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-Infinity,Infinity],[-Infinity,Infinity]],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:m,canceled:!1,memo:void 0,args:void 0},e)}function q(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:N({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:N({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var J=new Map,Q=function(e){return e},Z=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(i))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var o=n.controller.pointerIds.size||n.controller.touchIds.size,i=n.controller.state.shared.buttons>0||o>0,a=d({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{touches:o,down:i}),s=n.handler(a);return n.state.memo=void 0!==s?s:n.state.memo,a}}var t,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config,n=t.rubberband,i=t.threshold,a=this.state,s=a._bounds,u=a._initial,c=a._active,l=a._intentional,v=a.lastOffset,f=a.movement,h=this.getInternalMovement(e,this.state),p=this.transform(i).map(Math.abs),g=!1===l[0]?ee(h[0],p[0]):l[0],m=!1===l[1]?ee(h[1],p[1]):l[1],y=this.checkIntentionality([g,m],h);if(y._blocked)return d({},y,{_movement:h,delta:[0,0]});var S=y._intentional,b=h,w=[!1!==S[0]?h[0]-S[0]:0,!1!==S[1]?h[1]-S[1]:0],_=r(w,v),T=c?n:[0,0];return w=te(s,r(w,u),T),d({},y,{intentional:!1!==S[0]||!1!==S[1],_initial:u,_movement:b,movement:w,values:e,offset:te(s,_,T),delta:o(w,f)})},n.clean=function(){this.clearTimeout()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Q}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function ee(e,t){return Math.abs(e)>=t&&u(e)*t}function te(e,t,n){var r=t[1],o=n[1],i=e[0],a=e[1],s=a[0],u=a[1];return[l(t[0],i[0],i[1],n[0]),l(r,s,u,o)]}function ne(e,t,n){var r=e.state,o=t.timeStamp;return{_lastEventType:t.type,event:t,timeStamp:o,elapsedTime:n?0:o-r.startTime,previous:r.values}}function re(e,t,n){var r=e.config,o=e.stateKey,i=e.args,a=e.state.offset,s=n.timeStamp,u=r.initial,c=r.bounds,l=d({},q()[o],{_active:!0,args:i,values:t,initial:t,offset:a,lastOffset:a,startTime:s});return d({},l,{_initial:w(u,l),_bounds:w(c,l)})}function oe(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return e.call.apply(e,[this,d({},t,{event:n})].concat(o))}}var ie=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=T(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e={},n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];for(var i,a=g(t.classes);!(i=a()).done;){var s=i.value;new s(t,r).addBindings(e)}for(var u=0,c=Object.entries(t.nativeRefs);u<c.length;u++){var l=c[u],v=l[0],f=l[1];he(e,v,oe(f,d({},t.state.shared,{args:r})))}return t.config.domTarget?le(t,e):de(t,e)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=fe(t.config),n=t.config.eventOptions;e&&ge(e,ve(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,o=e.windowListeners;if(n){for(var i in o)ge(n,o[i],r);e.windowListeners={}}}(t)},this.state=q(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ae(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.add,n)}function se(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.delete,n)}function ue(e,t,n){var r=e.config,o=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(ge(r.window,o[t],n),delete o[t])}function ce(e,t,n,r){var o=e.config,i=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=o.eventOptions),o.window&&(ge(o.window,i[t],r),pe(o.window,i[t]=n,r))}function le(e,t){var n=e.config,r=e.domListeners,o=fe(n);if(!o)throw new Error("domTarget must be defined");var i=n.eventOptions;ge(o,ve(r),i);for(var a=0,s=Object.entries(t);a<s.length;a++){var u=s[a],c=u[1],l=u[0].slice(2).toLowerCase();r.push([l,y.apply(void 0,c)])}pe(o,r,i)}function de(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",o=0,i=Object.entries(t);o<i.length;o++){var a=i[o],s=a[0],u=a[1],c=Array.isArray(u)?u:[u];n[s+r]=y.apply(void 0,c)}return n}function ve(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function fe(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function he(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function pe(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.addEventListener(i[0],i[1],n)}}function ge(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.removeEventListener(i[0],i[1],n)}}function me(e,t,r){void 0===r&&(r={});var o=function(e){var t=new Set;return e.drag&&t.add(J.get("drag")),e.wheel&&t.add(J.get("wheel")),e.scroll&&t.add(J.get("scroll")),e.move&&t.add(J.get("move")),e.pinch&&t.add(J.get("pinch")),e.hover&&t.add(J.get("hover")),t}(e),i=n.useMemo((function(){return new ie(o)}),[]);return i.config=t,i.handlers=e,i.nativeRefs=r,n.useEffect(i.effect,[]),i.config.domTarget?ye:i.bind}function ye(){}var Se=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return o(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],o=n[1],i=this.state.axis||(r>o?"x":r<o?"y":void 0);return this.config.axis||this.config.lockDirection?i?this.config.axis&&i!==this.config.axis?{_intentional:e,_blocked:!0,axis:i}:(e["x"===i?1:0]=!1,{_intentional:e,_blocked:!1,axis:i}):{_intentional:[!1,!1],_blocked:!1,axis:i}:{_intentional:e,_blocked:!1,axis:i}},n.getKinematics=function(e,t){var n=this.getMovement(e);return n._blocked||Object.assign(n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp)),n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(Z);function be(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var we=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){if(!t.config.useTouch&&!document.pointerLockElement){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){be(e),ce(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(h(t))],["touchcancel",t.clean.bind(h(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(h(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,be(e),t.setTimeout(t.startDrag.bind(h(t)),t.config.delay,e)},t.setStartState=function(e){var n=I(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){ae(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)){var n;n=document.pointerLockElement?r(t.transform([e.movementX,e.movementY]),t.state.values):I(e,t.transform);var o=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!o.axis)return;if("x"!==o.axis)return void(t.state._active=!1);t.startDrag(e)}var a=E(e);t.updateSharedState(a);var s=ne(h(t),e),u=i(o._movement),c=t.state._dragIsTap;c&&u>=3&&(c=!1),t.updateGestureState(d({},s,o,{_dragIsTap:c})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(se(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,o=r[0],i=r[1],a=t.state.movement,s=a[0],c=a[1],l=t.state._intentional,v=l[0],f=l[1],p=t.config.swipeVelocity,g=p[0],m=p[1],y=t.config.swipeDistance,S=y[0],b=y[1],w=d({},ne(h(t),e),t.getMovement(t.state.values)),_=[0,0];w.elapsedTime<220&&(!1!==v&&Math.abs(o)>g&&Math.abs(s)>S&&(_[0]=u(o)),!1!==f&&Math.abs(i)>m&&Math.abs(c)>b&&(_[1]=u(i))),t.updateSharedState({buttons:0}),t.updateGestureState(d({},w,{tap:n,swipe:_})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(h(t)),t.state._dragStarted=!1,t.releasePointerCapture(),ue(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}v(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(he(e,"onTouchStart",this.onDragStart),he(e,"onTouchMove",this.onDragChange),he(e,"onTouchEnd",this.onDragEnd),he(e,"onTouchCancel",this.onDragEnd)):(he(e,"onPointerDown",this.onDragStart),he(e,"onPointerMove",this.onDragChange),he(e,"onPointerUp",this.onDragEnd),he(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&he(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(Se);function _e(e,t){var n,r,o=[],i=!1;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return i&&n===this&&t(s,o)||(r=e.apply(this,s),i=!0,n=this,o=s),r}}function Te(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i,a;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;for(a=t.entries();!(o=a.next()).done;)if(!e(o.value[1],n.get(o.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(o=r;0!=o--;)if(!("_owner"===i[o]&&t.$$typeof||e(t[i[o]],n[i[o]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Ge=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="pinching",t.stateKey="pinch",t.onPinchStart=function(e){if(ae(t.controller,e),t.enabled&&!t.state._active&&!(t.controller.touchIds.size<2)){var n=Array.from(t.controller.touchIds).slice(0,2),r=x(e,n,t.transform),o=r.values,i=r.origin;t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),o,e),ne(h(t),e,!0),{_pointerIds:n,cancel:t.onCancel,origin:i})),t.updateGestureState(t.getMovement(o)),t.fireGestureHandler()}},t.onPinchChange=function(e){var n=t.state;if(!n.canceled&&n._active){var r=E(e);t.updateSharedState(r);var o=x(e,t.state._pointerIds,t.transform),i=o.origin,a=t.getKinematics(o.values,e);t.updateGestureState(d({},ne(h(t),e),a,{origin:i})),t.fireGestureHandler()}},t.onPinchEnd=function(e){se(t.controller,e);var n=M(e);t.state._pointerIds.every((function(e){return!n.includes(e)}))||(t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1})),t.fireGestureHandler()))},t.onCancel=function(){t.state.canceled||(t.updateGestureState({_active:!1,canceled:!0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onGestureStart=function(e){if(t.enabled){e.preventDefault();var n=D(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{origin:[e.clientX,e.clientY],cancel:t.onCancel})),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()}},t.onGestureChange=function(e){var n=t.state;if(!n.canceled&&n._active){e.preventDefault();var r=E(e);t.updateSharedState(r);var o=D(e,t.transform),i=t.getKinematics(o,e);t.updateGestureState(d({},ne(h(t),e),i,{origin:[e.clientX,e.clientY]})),t.fireGestureHandler()}},t.onGestureEnd=function(e){t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1,origin:[e.clientX,e.clientY]})),t.fireGestureHandler())},t.wheelShouldRun=function(e){return t.enabled&&e.ctrlKey},t.getWheelValuesFromEvent=function(e){var n=K(e,t.transform)[1],r=t.state.values,o=r[1];return{values:[r[0]-n,void 0!==o?o:0],origin:[e.clientX,e.clientY],delta:[0,n]}},t.onWheel=function(e){t.wheelShouldRun(e)&&(t.setTimeout(t.onWheelEnd),t.state._active?t.onWheelChange(e):t.onWheelStart(e))},t.onWheelStart=function(e){var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.delta,i=n.origin;e.cancelable&&e.preventDefault(),t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),r,e),ne(h(t),e,!0),{initial:t.state.values,offset:r,delta:o,origin:i})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()},t.onWheelChange=function(e){t.updateSharedState(E(e));var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.origin,i=n.delta;t.updateGestureState(d({},ne(h(t),e),t.getKinematics(r,e),{origin:o,delta:i})),t.fireGestureHandler()},t.onWheelEnd=function(){t.clean(),t.state._active&&(t.state._active=!1,t.updateGestureState(t.getMovement(t.state.values)),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(he(e,"onGestureStart",this.onGestureStart),he(e,"onGestureChange",this.onGestureChange),he(e,"onGestureEnd",this.onGestureEnd)):(he(e,"onTouchStart",this.onPinchStart),he(e,"onTouchMove",this.onPinchChange),he(e,"onTouchEnd",this.onPinchEnd),he(e,"onTouchCancel",this.onPinchEnd),he(e,"onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=t.values[1],r=e[0],i=e[1],a=void 0===i?n:i,s=a-n,c=t.turns;return Math.abs(s)>270&&(c+=u(s)),o([r,a-360*c],t.initial)},n.getKinematics=function(e,t){var n=this.getMovement(e);return d({turns:(e[1]-n._movement[1]-this.state.initial[1])/360},n,f(s(n.movement,n.delta,t.timeStamp-this.state.timeStamp),["distance","velocity"]))},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(Z)),Me=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="wheeling",t.stateKey="wheel",t.debounced=!0,t.handleEvent=function(e){if((!e.ctrlKey||!("pinch"in t.controller.handlers))&&t.enabled){t.setTimeout(t.onEnd),t.updateSharedState(E(e));var n=r(K(e,t.transform),t.state.values);if(t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var o=t.getMovement(n),i=a(o.delta);t.updateGestureState(o),t.updateGestureState(i)}t.fireGestureHandler()}},t.onEnd=function(){if(t.clean(),t.state._active){var e=t.getMovement(t.state.values);t.updateGestureState(e),t.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),t.fireGestureHandler()}},t}return v(t,e),t.prototype.addBindings=function(e){he(e,"onWheel",this.handleEvent)},t}(Se),Ee=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="moving",t.stateKey="move",t.debounced=!0,t.onMove=function(e){t.enabled&&(t.setTimeout(t.onMoveEnd),t.state._active?t.onMoveChange(e):t.onMoveStart(e))},t.onMoveStart=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0))),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()},t.onMoveChange=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e))),t.fireGestureHandler()},t.onMoveEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(t.getMovement(t.state.values)),t.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),t.fireGestureHandler())},t.hoverTransform=function(){return t.controller.config.hover.transform||t.controller.config.transform},t.onPointerEnter=function(e){if(t.controller.state.shared.hovering=!0,t.controller.config.enabled){if(t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e,!0),{args:t.args,values:n,active:!0,hovering:!0});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}"move"in t.controller.handlers&&t.onMoveStart(e)}},t.onPointerLeave=function(e){if(t.controller.state.shared.hovering=!1,"move"in t.controller.handlers&&t.onMoveEnd(),t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e),{args:t.args,values:n,active:!1});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}},t}return v(t,e),t.prototype.addBindings=function(e){"move"in this.controller.handlers&&he(e,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(he(e,"onPointerEnter",this.onPointerEnter),he(e,"onPointerLeave",this.onPointerLeave))},t}(Se),Oe=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="scrolling",t.stateKey="scroll",t.debounced=!0,t.handleEvent=function(e){if(t.enabled){t.clearTimeout(),t.setTimeout(t.onEnd);var n=P(e,t.transform);if(t.updateSharedState(E(e)),t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var r=t.getMovement(n),o=a(r.delta);t.updateGestureState(r),t.updateGestureState(o)}t.fireGestureHandler()}},t.onEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(d({},t.getMovement(t.state.values),{_active:!1,velocities:[0,0],velocity:0})),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){he(e,"onScroll",this.handleEvent)},t}(Se),Ie=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function xe(e,t){var n=t+"Start",r=t+"End";return function(o){var i=void 0;return o.first&&n in e&&e[n](o),t in e&&(i=e[t](o)),o.last&&r in e&&e[r](o),i}}exports.addV=r,exports.rubberbandIfOutOfBounds=l,exports.subV=o,exports.useDrag=function(e,n){void 0===n&&(n={}),J.set("drag",we);var r=t.useRef();return r.current||(r.current=_e(z,Te)),me({drag:e},r.current(n))},exports.useGesture=function(e,t){void 0===t&&(t={});var n=function(e){var t={},n={},r=new Set;for(var o in e)Ie.test(o)?(r.add(RegExp.lastMatch),n[o]=e[o]):t[o]=e[o];return[n,t,r]}(e),r=n[0],o=n[1],i=n[2];J.set("drag",we),J.set("hover",Ee),J.set("move",Ee),J.set("pinch",Ge),J.set("scroll",Oe),J.set("wheel",Me);var a=function(e,t){void 0===e&&(e={}),void 0===t&&(t=new Set);var n=e.drag,r=e.wheel,o=e.move,i=e.scroll,a=e.pinch,s=e.hover,u=L({domTarget:e.domTarget,eventOptions:e.eventOptions,transform:e.transform,window:e.window,enabled:e.enabled});return t.has("onDrag")&&(u.drag=R(n)),t.has("onWheel")&&(u.wheel=Y(r)),t.has("onScroll")&&(u.scroll=Y(i)),t.has("onMove")&&(u.move=Y(o)),t.has("onPinch")&&(u.pinch=V(a)),t.has("onHover")&&(u.hover=d({enabled:!0},s)),u}(t,i),s={};return i.has("onDrag")&&(s.drag=xe(r,"onDrag")),i.has("onWheel")&&(s.wheel=xe(r,"onWheel")),i.has("onScroll")&&(s.scroll=xe(r,"onScroll")),i.has("onMove")&&(s.move=xe(r,"onMove")),i.has("onPinch")&&(s.pinch=xe(r,"onPinch")),i.has("onHover")&&(s.hover=r.onHover),me(s,a,o)},exports.useHover=function(e,n){void 0===n&&(n={}),J.set("hover",Ee);var r=t.useRef();return r.current||(r.current=_e(B,Te)),me({hover:e},r.current(n))},exports.useMove=function(e,n){void 0===n&&(n={}),J.set("move",Ee);var r=t.useRef();return r.current||(r.current=_e(X,Te)),me({move:e},r.current(n))},exports.usePinch=function(e,n){void 0===n&&(n={}),J.set("pinch",Ge);var r=t.useRef();return r.current||(r.current=_e(U,Te)),me({pinch:e},r.current(n))},exports.useScroll=function(e,n){void 0===n&&(n={}),J.set("scroll",Oe);var r=t.useRef();return r.current||(r.current=_e(F,Te)),me({scroll:e},r.current(n))},exports.useWheel=function(e,n){void 0===n&&(n={}),J.set("wheel",Me);var r=t.useRef();return r.current||(r.current=_e($,Te)),me({wheel:e},r.current(n))}; | ||
//# sourceMappingURL=reactusegesture.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).ReactUseGesture={},e.React)}(this,(function(e,t){"use strict";var n="default"in t?t.default:t;function r(e,t){return e.map((function(e,n){return e+t[n]}))}function o(e,t){return e.map((function(e,n){return e-t[n]}))}function i(e){return Math.hypot.apply(Math,e)}function a(e,t){void 0===t&&(t=e);var n=i(t),r=0===n?0:1/n,o=t.map((function(e){return r*e}));return{distance:i(e),direction:o}}function s(e,t,n){var r=i(t),o=0===r?0:1/r,a=0===n?0:1/n,s=a*r,u=t.map((function(e){return a*e})),c=t.map((function(e){return o*e}));return{velocities:u,velocity:s,distance:i(e),direction:c}}function u(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function c(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function l(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-c(t-e,n-t,r)+t:e>n?+c(e-n,n-t,r)+n:e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function v(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function m(){}function y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?m:1===t.length?t[0]:function(){for(var e,n,r=g(t);!(n=r()).done;){var o=n.value;e=o.apply(this,arguments)||e}return e}}function S(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function b(e,t){return Object.assign({},t,e||{})}function w(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function _(e,t){void 0===e&&(e={});for(var n={},r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0],s=i[1];switch(typeof s){case"function":n[a]=s.call(n,e[a],a,e);break;case"object":n[a]=_(e[a],s);break;case"boolean":s&&(n[a]=e[a])}}return n}function T(){return"undefined"!=typeof window&&"ontouchstart"in window}function G(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function M(e){return"pointerId"in e?[e.pointerId]:Array.from(G(e)).map((function(e){return e.identifier}))}function E(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var O=function(e){return e};function I(e,t){void 0===t&&(t=O);var n=G(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}function x(e,t,n){void 0===n&&(n=O);var r=Array.from(e.touches).filter((function(e){return t.includes(e.identifier)})),o=r[0],i=r[1],a=i.clientX-o.clientX,s=i.clientY-o.clientY,u=(i.clientX+o.clientX)/2,c=(i.clientY+o.clientY)/2;return{values:n([Math.hypot(a,s),-180*Math.atan2(a,s)/Math.PI]),origin:n([u,c])}}function P(e,t){void 0===t&&(t=O);var n=e.currentTarget;return t([n.scrollX||n.scrollLeft||0,n.scrollY||n.scrollTop||0])}function K(e,t){void 0===t&&(t=O);var n=e.deltaX,r=e.deltaY,o=e.deltaMode;return 1===o?(n*=40,r*=40):2===o&&(n*=800,r*=800),t([n,r])}function D(e,t){return void 0===t&&(t=O),t([260*e.scale,e.rotation])}var C={threshold:function(e){return void 0===e&&(e=0),S(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return S(.15);case!1:return S(0);default:return S(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:S(e)},transform:!0},k=d({},C,{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return k.bounds(e(t))};var t=e.left,n=e.right,r=e.top,o=e.bottom;return[[void 0===t?-Infinity:t,void 0===n?Infinity:n],[void 0===r?-Infinity:r,void 0===o?Infinity:o]]}}),j="undefined"!=typeof window&&window.document&&window.document.createElement,H={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=j?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=t.capture;return{passive:void 0===n||n,capture:void 0!==r&&r}},transform:!0},W=d({},C,{bounds:function(e,t,n){var r=n.distanceBounds,o=void 0===r?{}:r,i=n.angleBounds,a=void 0===i?{}:i,s=function(e){var t=b(w(o,e),{min:-Infinity,max:Infinity});return[t.min,t.max]},u=function(e){var t=b(w(a,e),{min:-Infinity,max:Infinity});return[t.min,t.max]};return"function"!=typeof o&&"function"!=typeof a?[s(),u()]:function(e){return[s(e),u(e)]}}}),A=d({},k,{useTouch:function(e){return void 0===e&&(e=!1),e&&T()},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,o=void 0!==r&&r,i=n.lockDirection,a=n.axis,s=S(e,o?3:void 0!==i&&i||(void 0===a?void 0:a)?1:0);return this.filterTaps=o,s},swipeVelocity:function(e){return void 0===e&&(e=.5),S(e)},swipeDistance:function(e){return void 0===e&&(e=60),S(e)},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function Y(e){return void 0===e&&(e={}),_(e,H)}function L(e){return void 0===e&&(e={}),_(e,k)}function R(e){return void 0===e&&(e={}),_(e,W)}function V(e){return void 0===e&&(e={}),_(e,A)}function X(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.move=L(i),a}function B(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.hover=d({enabled:!0},i),a}function z(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.drag=V(i),a}function U(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.pinch=R(i),a}function F(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.scroll=L(i),a}function $(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=Y({domTarget:t,eventOptions:n,window:r,enabled:o});return a.wheel=L(i),a}function N(e){return d({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-Infinity,Infinity],[-Infinity,Infinity]],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:m,canceled:!1,memo:void 0,args:void 0},e)}function q(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:N({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:N({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var J=new Map,Q=function(e){return e},Z=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(i))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var o=n.controller.pointerIds.size||n.controller.touchIds.size,i=n.controller.state.shared.buttons>0||o>0,a=d({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{touches:o,down:i}),s=n.handler(a);return n.state.memo=void 0!==s?s:n.state.memo,a}}var t,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config,n=t.rubberband,i=t.threshold,a=this.state,s=a._bounds,u=a._initial,c=a._active,l=a._intentional,f=a.lastOffset,v=a.movement,h=this.getInternalMovement(e,this.state),p=this.transform(i).map(Math.abs),g=!1===l[0]?ee(h[0],p[0]):l[0],m=!1===l[1]?ee(h[1],p[1]):l[1],y=this.checkIntentionality([g,m],h);if(y._blocked)return d({},y,{_movement:h,delta:[0,0]});var S=y._intentional,b=h,w=[!1!==S[0]?h[0]-S[0]:0,!1!==S[1]?h[1]-S[1]:0],_=r(w,f),T=c?n:[0,0];return w=te(s,r(w,u),T),d({},y,{intentional:!1!==S[0]||!1!==S[1],_initial:u,_movement:b,movement:w,values:e,offset:te(s,_,T),delta:o(w,v)})},n.clean=function(){this.clearTimeout()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Q}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function ee(e,t){return Math.abs(e)>=t&&u(e)*t}function te(e,t,n){var r=t[1],o=n[1],i=e[0],a=e[1],s=a[0],u=a[1];return[l(t[0],i[0],i[1],n[0]),l(r,s,u,o)]}function ne(e,t,n){var r=e.state,o=t.timeStamp;return{_lastEventType:t.type,event:t,timeStamp:o,elapsedTime:n?0:o-r.startTime,previous:r.values}}function re(e,t,n){var r=e.config,o=e.stateKey,i=e.args,a=e.state.offset,s=n.timeStamp,u=r.initial,c=r.bounds,l=d({},q()[o],{_active:!0,args:i,values:t,initial:t,offset:a,lastOffset:a,startTime:s});return d({},l,{_initial:w(u,l),_bounds:w(c,l)})}function oe(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return e.call.apply(e,[this,d({},t,{event:n})].concat(o))}}var ie=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=T(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e={},n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];for(var i,a=g(t.classes);!(i=a()).done;){var s=i.value;new s(t,r).addBindings(e)}for(var u=0,c=Object.entries(t.nativeRefs);u<c.length;u++){var l=c[u],f=l[0],v=l[1];he(e,f,oe(v,d({},t.state.shared,{args:r})))}return t.config.domTarget?le(t,e):de(t,e)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=ve(t.config),n=t.config.eventOptions;e&&ge(e,fe(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,o=e.windowListeners;if(n){for(var i in o)ge(n,o[i],r);e.windowListeners={}}}(t)},this.state=q(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ae(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.add,n)}function se(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.delete,n)}function ue(e,t,n){var r=e.config,o=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(ge(r.window,o[t],n),delete o[t])}function ce(e,t,n,r){var o=e.config,i=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=o.eventOptions),o.window&&(ge(o.window,i[t],r),pe(o.window,i[t]=n,r))}function le(e,t){var n=e.config,r=e.domListeners,o=ve(n);if(!o)throw new Error("domTarget must be defined");var i=n.eventOptions;ge(o,fe(r),i);for(var a=0,s=Object.entries(t);a<s.length;a++){var u=s[a],c=u[1],l=u[0].slice(2).toLowerCase();r.push([l,y.apply(void 0,c)])}pe(o,r,i)}function de(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",o=0,i=Object.entries(t);o<i.length;o++){var a=i[o],s=a[0],u=a[1],c=Array.isArray(u)?u:[u];n[s+r]=y.apply(void 0,c)}return n}function fe(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function ve(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function he(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function pe(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.addEventListener(i[0],i[1],n)}}function ge(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.removeEventListener(i[0],i[1],n)}}function me(e,t,r){void 0===r&&(r={});var o=function(e){var t=new Set;return e.drag&&t.add(J.get("drag")),e.wheel&&t.add(J.get("wheel")),e.scroll&&t.add(J.get("scroll")),e.move&&t.add(J.get("move")),e.pinch&&t.add(J.get("pinch")),e.hover&&t.add(J.get("hover")),t}(e),i=n.useMemo((function(){return new ie(o)}),[]);return i.config=t,i.handlers=e,i.nativeRefs=r,n.useEffect(i.effect,[]),i.config.domTarget?ye:i.bind}function ye(){}var Se=function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return o(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],o=n[1],i=this.state.axis||(r>o?"x":r<o?"y":void 0);return this.config.axis||this.config.lockDirection?i?this.config.axis&&i!==this.config.axis?{_intentional:e,_blocked:!0,axis:i}:(e["x"===i?1:0]=!1,{_intentional:e,_blocked:!1,axis:i}):{_intentional:[!1,!1],_blocked:!1,axis:i}:{_intentional:e,_blocked:!1,axis:i}},n.getKinematics=function(e,t){var n=this.getMovement(e);return n._blocked||Object.assign(n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp)),n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(Z);function be(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var we=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&(n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r}))},t.releasePointerCapture=function(){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){be(e),ce(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(h(t))],["touchcancel",t.clean.bind(h(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(h(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,be(e),t.setTimeout(t.startDrag.bind(h(t)),t.config.delay,e)},t.setStartState=function(e){var n=I(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){ae(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.config.useTouch||t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)){var n=I(e,t.transform),r=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!r.axis)return;if("x"!==r.axis)return void(t.state._active=!1);t.startDrag(e)}var o=E(e);t.updateSharedState(o);var a=ne(h(t),e),s=i(r._movement),u=t.state._dragIsTap;u&&s>=3&&(u=!1),t.updateGestureState(d({},a,r,{_dragIsTap:u})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(se(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,o=r[0],i=r[1],a=t.state.movement,s=a[0],c=a[1],l=t.state._intentional,f=l[0],v=l[1],p=t.config.swipeVelocity,g=p[0],m=p[1],y=t.config.swipeDistance,S=y[0],b=y[1],w=d({},ne(h(t),e),t.getMovement(t.state.values)),_=[0,0];w.elapsedTime<220&&(!1!==f&&Math.abs(o)>g&&Math.abs(s)>S&&(_[0]=u(o)),!1!==v&&Math.abs(i)>m&&Math.abs(c)>b&&(_[1]=u(i))),t.updateSharedState({buttons:0}),t.updateGestureState(d({},w,{tap:n,swipe:_})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(h(t)),t.state._dragStarted=!1,t.config.useTouch||t.releasePointerCapture(),ue(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}f(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(he(e,"onTouchStart",this.onDragStart),he(e,"onTouchMove",this.onDragChange),he(e,"onTouchEnd",this.onDragEnd),he(e,"onTouchCancel",this.onDragEnd)):(he(e,"onPointerDown",this.onDragStart),he(e,"onPointerMove",this.onDragChange),he(e,"onPointerUp",this.onDragEnd),he(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&he(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(Se);function _e(e,t){var n,r,o=[],i=!1;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return i&&n===this&&t(s,o)||(r=e.apply(this,s),i=!0,n=this,o=s),r}}function Te(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i,a;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;for(a=t.entries();!(o=a.next()).done;)if(!e(o.value[1],n.get(o.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(o=r;0!=o--;)if(!("_owner"===i[o]&&t.$$typeof||e(t[i[o]],n[i[o]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Ge=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="pinching",t.stateKey="pinch",t.onPinchStart=function(e){if(ae(t.controller,e),t.enabled&&!t.state._active&&!(t.controller.touchIds.size<2)){var n=Array.from(t.controller.touchIds).slice(0,2),r=x(e,n,t.transform),o=r.values,i=r.origin;t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),o,e),ne(h(t),e,!0),{_pointerIds:n,cancel:t.onCancel,origin:i})),t.updateGestureState(t.getMovement(o)),t.fireGestureHandler()}},t.onPinchChange=function(e){var n=t.state;if(!n.canceled&&n._active){var r=E(e);t.updateSharedState(r);var o=x(e,t.state._pointerIds,t.transform),i=o.origin,a=t.getKinematics(o.values,e);t.updateGestureState(d({},ne(h(t),e),a,{origin:i})),t.fireGestureHandler()}},t.onPinchEnd=function(e){se(t.controller,e);var n=M(e);t.state._pointerIds.every((function(e){return!n.includes(e)}))||(t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1})),t.fireGestureHandler()))},t.onCancel=function(){t.state.canceled||(t.updateGestureState({_active:!1,canceled:!0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onGestureStart=function(e){if(t.enabled){e.preventDefault();var n=D(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{origin:[e.clientX,e.clientY],cancel:t.onCancel})),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()}},t.onGestureChange=function(e){var n=t.state;if(!n.canceled&&n._active){e.preventDefault();var r=E(e);t.updateSharedState(r);var o=D(e,t.transform),i=t.getKinematics(o,e);t.updateGestureState(d({},ne(h(t),e),i,{origin:[e.clientX,e.clientY]})),t.fireGestureHandler()}},t.onGestureEnd=function(e){t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1,origin:[e.clientX,e.clientY]})),t.fireGestureHandler())},t.wheelShouldRun=function(e){return t.enabled&&e.ctrlKey},t.getWheelValuesFromEvent=function(e){var n=K(e,t.transform)[1],r=t.state.values,o=r[1];return{values:[r[0]-n,void 0!==o?o:0],origin:[e.clientX,e.clientY],delta:[0,n]}},t.onWheel=function(e){t.wheelShouldRun(e)&&(t.setTimeout(t.onWheelEnd),t.state._active?t.onWheelChange(e):t.onWheelStart(e))},t.onWheelStart=function(e){var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.delta,i=n.origin;e.cancelable&&e.preventDefault(),t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),r,e),ne(h(t),e,!0),{initial:t.state.values,offset:r,delta:o,origin:i})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()},t.onWheelChange=function(e){t.updateSharedState(E(e));var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.origin,i=n.delta;t.updateGestureState(d({},ne(h(t),e),t.getKinematics(r,e),{origin:o,delta:i})),t.fireGestureHandler()},t.onWheelEnd=function(){t.clean(),t.state._active&&(t.state._active=!1,t.updateGestureState(t.getMovement(t.state.values)),t.fireGestureHandler())},t}return f(t,e),t.prototype.addBindings=function(e){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(he(e,"onGestureStart",this.onGestureStart),he(e,"onGestureChange",this.onGestureChange),he(e,"onGestureEnd",this.onGestureEnd)):(he(e,"onTouchStart",this.onPinchStart),he(e,"onTouchMove",this.onPinchChange),he(e,"onTouchEnd",this.onPinchEnd),he(e,"onTouchCancel",this.onPinchEnd),he(e,"onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=t.values[1],r=e[0],i=e[1],a=void 0===i?n:i,s=a-n,c=t.turns;return Math.abs(s)>270&&(c+=u(s)),o([r,a-360*c],t.initial)},n.getKinematics=function(e,t){var n=this.getMovement(e);return d({turns:(e[1]-n._movement[1]-this.state.initial[1])/360},n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp))},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(Z)),Me=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="wheeling",t.stateKey="wheel",t.debounced=!0,t.handleEvent=function(e){if((!e.ctrlKey||!("pinch"in t.controller.handlers))&&t.enabled){t.setTimeout(t.onEnd),t.updateSharedState(E(e));var n=r(K(e,t.transform),t.state.values);if(t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var o=t.getMovement(n),i=a(o.delta);t.updateGestureState(o),t.updateGestureState(i)}t.fireGestureHandler()}},t.onEnd=function(){if(t.clean(),t.state._active){var e=t.getMovement(t.state.values);t.updateGestureState(e),t.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),t.fireGestureHandler()}},t}return f(t,e),t.prototype.addBindings=function(e){he(e,"onWheel",this.handleEvent)},t}(Se),Ee=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="moving",t.stateKey="move",t.debounced=!0,t.onMove=function(e){t.enabled&&(t.setTimeout(t.onMoveEnd),t.state._active?t.onMoveChange(e):t.onMoveStart(e))},t.onMoveStart=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0))),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()},t.onMoveChange=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e))),t.fireGestureHandler()},t.onMoveEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(t.getMovement(t.state.values)),t.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),t.fireGestureHandler())},t.hoverTransform=function(){return t.controller.config.hover.transform||t.controller.config.transform},t.onPointerEnter=function(e){if(t.controller.state.shared.hovering=!0,t.controller.config.enabled){if(t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e,!0),{args:t.args,values:n,active:!0,hovering:!0});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}"move"in t.controller.handlers&&t.onMoveStart(e)}},t.onPointerLeave=function(e){if(t.controller.state.shared.hovering=!1,"move"in t.controller.handlers&&t.onMoveEnd(),t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e),{args:t.args,values:n,active:!1});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}},t}return f(t,e),t.prototype.addBindings=function(e){"move"in this.controller.handlers&&he(e,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(he(e,"onPointerEnter",this.onPointerEnter),he(e,"onPointerLeave",this.onPointerLeave))},t}(Se),Oe=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="scrolling",t.stateKey="scroll",t.debounced=!0,t.handleEvent=function(e){if(t.enabled){t.clearTimeout(),t.setTimeout(t.onEnd);var n=P(e,t.transform);if(t.updateSharedState(E(e)),t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var r=t.getMovement(n),o=a(r.delta);t.updateGestureState(r),t.updateGestureState(o)}t.fireGestureHandler()}},t.onEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(d({},t.getMovement(t.state.values),{_active:!1,velocities:[0,0],velocity:0})),t.fireGestureHandler())},t}return f(t,e),t.prototype.addBindings=function(e){he(e,"onScroll",this.handleEvent)},t}(Se),Ie=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function xe(e,t){var n=t+"Start",r=t+"End";return function(o){var i=void 0;return o.first&&n in e&&e[n](o),t in e&&(i=e[t](o)),o.last&&r in e&&e[r](o),i}}e.addV=r,e.rubberbandIfOutOfBounds=l,e.subV=o,e.useDrag=function(e,n){void 0===n&&(n={}),J.set("drag",we);var r=t.useRef();return r.current||(r.current=_e(z,Te)),me({drag:e},r.current(n))},e.useGesture=function(e,t){void 0===t&&(t={});var n=function(e){var t={},n={},r=new Set;for(var o in e)Ie.test(o)?(r.add(RegExp.lastMatch),n[o]=e[o]):t[o]=e[o];return[n,t,r]}(e),r=n[0],o=n[1],i=n[2];J.set("drag",we),J.set("hover",Ee),J.set("move",Ee),J.set("pinch",Ge),J.set("scroll",Oe),J.set("wheel",Me);var a=function(e,t){void 0===e&&(e={}),void 0===t&&(t=new Set);var n=e.drag,r=e.wheel,o=e.move,i=e.scroll,a=e.pinch,s=e.hover,u=Y({domTarget:e.domTarget,eventOptions:e.eventOptions,transform:e.transform,window:e.window,enabled:e.enabled});return t.has("onDrag")&&(u.drag=V(n)),t.has("onWheel")&&(u.wheel=L(r)),t.has("onScroll")&&(u.scroll=L(i)),t.has("onMove")&&(u.move=L(o)),t.has("onPinch")&&(u.pinch=R(a)),t.has("onHover")&&(u.hover=d({enabled:!0},s)),u}(t,i),s={};return i.has("onDrag")&&(s.drag=xe(r,"onDrag")),i.has("onWheel")&&(s.wheel=xe(r,"onWheel")),i.has("onScroll")&&(s.scroll=xe(r,"onScroll")),i.has("onMove")&&(s.move=xe(r,"onMove")),i.has("onPinch")&&(s.pinch=xe(r,"onPinch")),i.has("onHover")&&(s.hover=r.onHover),me(s,a,o)},e.useHover=function(e,n){void 0===n&&(n={}),J.set("hover",Ee);var r=t.useRef();return r.current||(r.current=_e(B,Te)),me({hover:e},r.current(n))},e.useMove=function(e,n){void 0===n&&(n={}),J.set("move",Ee);var r=t.useRef();return r.current||(r.current=_e(X,Te)),me({move:e},r.current(n))},e.usePinch=function(e,n){void 0===n&&(n={}),J.set("pinch",Ge);var r=t.useRef();return r.current||(r.current=_e(U,Te)),me({pinch:e},r.current(n))},e.useScroll=function(e,n){void 0===n&&(n={}),J.set("scroll",Oe);var r=t.useRef();return r.current||(r.current=_e(F,Te)),me({scroll:e},r.current(n))},e.useWheel=function(e,n){void 0===n&&(n={}),J.set("wheel",Me);var r=t.useRef();return r.current||(r.current=_e($,Te)),me({wheel:e},r.current(n))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).ReactUseGesture={},e.React)}(this,(function(e,t){"use strict";var n="default"in t?t.default:t;function r(e,t){return e.map((function(e,n){return e+t[n]}))}function o(e,t){return e.map((function(e,n){return e-t[n]}))}function i(e){return Math.hypot.apply(Math,e)}function a(e,t){void 0===t&&(t=e);var n=i(t),r=0===n?0:1/n,o=t.map((function(e){return r*e}));return{distance:i(e),direction:o}}function s(e,t,n){var r=i(t),o=0===r?0:1/r,a=0===n?0:1/n,s=a*r,u=t.map((function(e){return a*e})),c=t.map((function(e){return o*e}));return{velocities:u,velocity:s,distance:i(e),direction:c}}function u(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function c(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function l(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-c(t-e,n-t,r)+t:e>n?+c(e-n,n-t,r)+n:e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function v(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function m(){}function y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?m:1===t.length?t[0]:function(){for(var e,n,r=g(t);!(n=r()).done;){var o=n.value;e=o.apply(this,arguments)||e}return e}}function S(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function b(e,t){return Object.assign({},t,e||{})}function w(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function _(e,t){void 0===e&&(e={});for(var n={},r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0],s=i[1];switch(typeof s){case"function":n[a]=s.call(n,e[a],a,e);break;case"object":n[a]=_(e[a],s);break;case"boolean":s&&(n[a]=e[a])}}return n}function T(){return"undefined"!=typeof window&&"ontouchstart"in window}function G(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function M(e){return"pointerId"in e?[e.pointerId]:Array.from(G(e)).map((function(e){return e.identifier}))}function E(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var O=function(e){return e};function I(e,t){void 0===t&&(t=O);var n=G(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}function x(e,t,n){void 0===n&&(n=O);var r=Array.from(e.touches).filter((function(e){return t.includes(e.identifier)})),o=r[0],i=r[1],a=i.clientX-o.clientX,s=i.clientY-o.clientY,u=(i.clientX+o.clientX)/2,c=(i.clientY+o.clientY)/2;return{values:n([Math.hypot(a,s),-180*Math.atan2(a,s)/Math.PI]),origin:n([u,c])}}function P(e,t){void 0===t&&(t=O);var n=e.currentTarget;return t([n.scrollX||n.scrollLeft||0,n.scrollY||n.scrollTop||0])}function K(e,t){void 0===t&&(t=O);var n=e.deltaX,r=e.deltaY,o=e.deltaMode;return 1===o?(n*=40,r*=40):2===o&&(n*=800,r*=800),t([n,r])}function D(e,t){return void 0===t&&(t=O),t([260*e.scale,e.rotation])}var C={threshold:function(e){return void 0===e&&(e=0),S(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return S(.15);case!1:return S(0);default:return S(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:S(e)},transform:!0},k=d({},C,{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return k.bounds(e(t))};var t=e.left,n=e.right,r=e.top,o=e.bottom;return[[void 0===t?-Infinity:t,void 0===n?Infinity:n],[void 0===r?-Infinity:r,void 0===o?Infinity:o]]}}),j="undefined"!=typeof window&&window.document&&window.document.createElement,H={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=j?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=t.capture;return{passive:void 0===n||n,capture:void 0!==r&&r}},transform:!0},W=d({},C,{bounds:function(e,t,n){var r=n.distanceBounds,o=void 0===r?{}:r,i=n.angleBounds,a=void 0===i?{}:i,s=function(e){var t=b(w(o,e),{min:-Infinity,max:Infinity});return[t.min,t.max]},u=function(e){var t=b(w(a,e),{min:-Infinity,max:Infinity});return[t.min,t.max]};return"function"!=typeof o&&"function"!=typeof a?[s(),u()]:function(e){return[s(e),u(e)]}}}),A=d({},k,{useTouch:function(e){return void 0===e&&(e=!1),e&&T()},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,o=void 0!==r&&r,i=n.lockDirection,a=n.axis,s=S(e,o?3:void 0!==i&&i||(void 0===a?void 0:a)?1:0);return this.filterTaps=o,s},swipeVelocity:function(e){return void 0===e&&(e=.5),S(e)},swipeDistance:function(e){return void 0===e&&(e=60),S(e)},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function L(e){return void 0===e&&(e={}),_(e,H)}function Y(e){return void 0===e&&(e={}),_(e,k)}function R(e){return void 0===e&&(e={}),_(e,W)}function V(e){return void 0===e&&(e={}),_(e,A)}function X(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.move=Y(i),a}function B(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.hover=d({enabled:!0},i),a}function z(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.drag=V(i),a}function U(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.pinch=R(i),a}function F(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.scroll=Y(i),a}function $(e){var t=e.domTarget,n=e.eventOptions,r=e.window,o=e.enabled,i=v(e,["domTarget","eventOptions","window","enabled"]),a=L({domTarget:t,eventOptions:n,window:r,enabled:o});return a.wheel=Y(i),a}function N(e){return d({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-Infinity,Infinity],[-Infinity,Infinity]],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:m,canceled:!1,memo:void 0,args:void 0},e)}function q(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:N({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:N({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:N({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var J=new Map,Q=function(e){return e},Z=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(i))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var o=n.controller.pointerIds.size||n.controller.touchIds.size,i=n.controller.state.shared.buttons>0||o>0,a=d({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{touches:o,down:i}),s=n.handler(a);return n.state.memo=void 0!==s?s:n.state.memo,a}}var t,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config,n=t.rubberband,i=t.threshold,a=this.state,s=a._bounds,u=a._initial,c=a._active,l=a._intentional,f=a.lastOffset,v=a.movement,h=this.getInternalMovement(e,this.state),p=this.transform(i).map(Math.abs),g=!1===l[0]?ee(h[0],p[0]):l[0],m=!1===l[1]?ee(h[1],p[1]):l[1],y=this.checkIntentionality([g,m],h);if(y._blocked)return d({},y,{_movement:h,delta:[0,0]});var S=y._intentional,b=h,w=[!1!==S[0]?h[0]-S[0]:0,!1!==S[1]?h[1]-S[1]:0],_=r(w,f),T=c?n:[0,0];return w=te(s,r(w,u),T),d({},y,{intentional:!1!==S[0]||!1!==S[1],_initial:u,_movement:b,movement:w,values:e,offset:te(s,_,T),delta:o(w,v)})},n.clean=function(){this.clearTimeout()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Q}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function ee(e,t){return Math.abs(e)>=t&&u(e)*t}function te(e,t,n){var r=t[1],o=n[1],i=e[0],a=e[1],s=a[0],u=a[1];return[l(t[0],i[0],i[1],n[0]),l(r,s,u,o)]}function ne(e,t,n){var r=e.state,o=t.timeStamp;return{_lastEventType:t.type,event:t,timeStamp:o,elapsedTime:n?0:o-r.startTime,previous:r.values}}function re(e,t,n){var r=e.config,o=e.stateKey,i=e.args,a=e.state.offset,s=n.timeStamp,u=r.initial,c=r.bounds,l=d({},q()[o],{_active:!0,args:i,values:t,initial:t,offset:a,lastOffset:a,startTime:s});return d({},l,{_initial:w(u,l),_bounds:w(c,l)})}function oe(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return e.call.apply(e,[this,d({},t,{event:n})].concat(o))}}var ie=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=T(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e={},n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];for(var i,a=g(t.classes);!(i=a()).done;){var s=i.value;new s(t,r).addBindings(e)}for(var u=0,c=Object.entries(t.nativeRefs);u<c.length;u++){var l=c[u],f=l[0],v=l[1];he(e,f,oe(v,d({},t.state.shared,{args:r})))}return t.config.domTarget?le(t,e):de(t,e)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=ve(t.config),n=t.config.eventOptions;e&&ge(e,fe(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,o=e.windowListeners;if(n){for(var i in o)ge(n,o[i],r);e.windowListeners={}}}(t)},this.state=q(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ae(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.add,n)}function se(e,t){var n="pointerId"in t?e.pointerIds:e.touchIds;M(t).forEach(n.delete,n)}function ue(e,t,n){var r=e.config,o=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(ge(r.window,o[t],n),delete o[t])}function ce(e,t,n,r){var o=e.config,i=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=o.eventOptions),o.window&&(ge(o.window,i[t],r),pe(o.window,i[t]=n,r))}function le(e,t){var n=e.config,r=e.domListeners,o=ve(n);if(!o)throw new Error("domTarget must be defined");var i=n.eventOptions;ge(o,fe(r),i);for(var a=0,s=Object.entries(t);a<s.length;a++){var u=s[a],c=u[1],l=u[0].slice(2).toLowerCase();r.push([l,y.apply(void 0,c)])}pe(o,r,i)}function de(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",o=0,i=Object.entries(t);o<i.length;o++){var a=i[o],s=a[0],u=a[1],c=Array.isArray(u)?u:[u];n[s+r]=y.apply(void 0,c)}return n}function fe(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function ve(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function he(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function pe(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.addEventListener(i[0],i[1],n)}}function ge(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,o=g(t);!(r=o()).done;){var i=r.value;e.removeEventListener(i[0],i[1],n)}}function me(e,t,r){void 0===r&&(r={});var o=function(e){var t=new Set;return e.drag&&t.add(J.get("drag")),e.wheel&&t.add(J.get("wheel")),e.scroll&&t.add(J.get("scroll")),e.move&&t.add(J.get("move")),e.pinch&&t.add(J.get("pinch")),e.hover&&t.add(J.get("hover")),t}(e),i=n.useMemo((function(){return new ie(o)}),[]);return i.config=t,i.handlers=e,i.nativeRefs=r,n.useEffect(i.effect,[]),i.config.domTarget?ye:i.bind}function ye(){}var Se=function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return o(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],o=n[1],i=this.state.axis||(r>o?"x":r<o?"y":void 0);return this.config.axis||this.config.lockDirection?i?this.config.axis&&i!==this.config.axis?{_intentional:e,_blocked:!0,axis:i}:(e["x"===i?1:0]=!1,{_intentional:e,_blocked:!1,axis:i}):{_intentional:[!1,!1],_blocked:!1,axis:i}:{_intentional:e,_blocked:!1,axis:i}},n.getKinematics=function(e,t){var n=this.getMovement(e);return n._blocked||Object.assign(n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp)),n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(Z);function be(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var we=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){if(!t.config.useTouch&&!document.pointerLockElement){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){be(e),ce(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(h(t))],["touchcancel",t.clean.bind(h(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(h(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,be(e),t.setTimeout(t.startDrag.bind(h(t)),t.config.delay,e)},t.setStartState=function(e){var n=I(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){ae(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)){var n;n=document.pointerLockElement?r(t.transform([e.movementX,e.movementY]),t.state.values):I(e,t.transform);var o=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!o.axis)return;if("x"!==o.axis)return void(t.state._active=!1);t.startDrag(e)}var a=E(e);t.updateSharedState(a);var s=ne(h(t),e),u=i(o._movement),c=t.state._dragIsTap;c&&u>=3&&(c=!1),t.updateGestureState(d({},s,o,{_dragIsTap:c})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(se(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,o=r[0],i=r[1],a=t.state.movement,s=a[0],c=a[1],l=t.state._intentional,f=l[0],v=l[1],p=t.config.swipeVelocity,g=p[0],m=p[1],y=t.config.swipeDistance,S=y[0],b=y[1],w=d({},ne(h(t),e),t.getMovement(t.state.values)),_=[0,0];w.elapsedTime<220&&(!1!==f&&Math.abs(o)>g&&Math.abs(s)>S&&(_[0]=u(o)),!1!==v&&Math.abs(i)>m&&Math.abs(c)>b&&(_[1]=u(i))),t.updateSharedState({buttons:0}),t.updateGestureState(d({},w,{tap:n,swipe:_})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(h(t)),t.state._dragStarted=!1,t.releasePointerCapture(),ue(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}f(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(he(e,"onTouchStart",this.onDragStart),he(e,"onTouchMove",this.onDragChange),he(e,"onTouchEnd",this.onDragEnd),he(e,"onTouchCancel",this.onDragEnd)):(he(e,"onPointerDown",this.onDragStart),he(e,"onPointerMove",this.onDragChange),he(e,"onPointerUp",this.onDragEnd),he(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&he(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(Se);function _e(e,t){var n,r,o=[],i=!1;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return i&&n===this&&t(s,o)||(r=e.apply(this,s),i=!0,n=this,o=s),r}}function Te(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i,a;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;for(a=t.entries();!(o=a.next()).done;)if(!e(o.value[1],n.get(o.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a=t.entries();!(o=a.next()).done;)if(!n.has(o.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(o=r;0!=o--;)if(!("_owner"===i[o]&&t.$$typeof||e(t[i[o]],n[i[o]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Ge=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="pinching",t.stateKey="pinch",t.onPinchStart=function(e){if(ae(t.controller,e),t.enabled&&!t.state._active&&!(t.controller.touchIds.size<2)){var n=Array.from(t.controller.touchIds).slice(0,2),r=x(e,n,t.transform),o=r.values,i=r.origin;t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),o,e),ne(h(t),e,!0),{_pointerIds:n,cancel:t.onCancel,origin:i})),t.updateGestureState(t.getMovement(o)),t.fireGestureHandler()}},t.onPinchChange=function(e){var n=t.state;if(!n.canceled&&n._active){var r=E(e);t.updateSharedState(r);var o=x(e,t.state._pointerIds,t.transform),i=o.origin,a=t.getKinematics(o.values,e);t.updateGestureState(d({},ne(h(t),e),a,{origin:i})),t.fireGestureHandler()}},t.onPinchEnd=function(e){se(t.controller,e);var n=M(e);t.state._pointerIds.every((function(e){return!n.includes(e)}))||(t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1})),t.fireGestureHandler()))},t.onCancel=function(){t.state.canceled||(t.updateGestureState({_active:!1,canceled:!0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onGestureStart=function(e){if(t.enabled){e.preventDefault();var n=D(e,t.transform);t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{origin:[e.clientX,e.clientY],cancel:t.onCancel})),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()}},t.onGestureChange=function(e){var n=t.state;if(!n.canceled&&n._active){e.preventDefault();var r=E(e);t.updateSharedState(r);var o=D(e,t.transform),i=t.getKinematics(o,e);t.updateGestureState(d({},ne(h(t),e),i,{origin:[e.clientX,e.clientY]})),t.fireGestureHandler()}},t.onGestureEnd=function(e){t.clean(),t.state._active&&(t.updateGestureState(d({},ne(h(t),e),t.getMovement(t.state.values),{_active:!1,origin:[e.clientX,e.clientY]})),t.fireGestureHandler())},t.wheelShouldRun=function(e){return t.enabled&&e.ctrlKey},t.getWheelValuesFromEvent=function(e){var n=K(e,t.transform)[1],r=t.state.values,o=r[1];return{values:[r[0]-n,void 0!==o?o:0],origin:[e.clientX,e.clientY],delta:[0,n]}},t.onWheel=function(e){t.wheelShouldRun(e)&&(t.setTimeout(t.onWheelEnd),t.state._active?t.onWheelChange(e):t.onWheelStart(e))},t.onWheelStart=function(e){var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.delta,i=n.origin;e.cancelable&&e.preventDefault(),t.updateSharedState(E(e)),t.updateGestureState(d({},re(h(t),r,e),ne(h(t),e,!0),{initial:t.state.values,offset:r,delta:o,origin:i})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()},t.onWheelChange=function(e){t.updateSharedState(E(e));var n=t.getWheelValuesFromEvent(e),r=n.values,o=n.origin,i=n.delta;t.updateGestureState(d({},ne(h(t),e),t.getKinematics(r,e),{origin:o,delta:i})),t.fireGestureHandler()},t.onWheelEnd=function(){t.clean(),t.state._active&&(t.state._active=!1,t.updateGestureState(t.getMovement(t.state.values)),t.fireGestureHandler())},t}return f(t,e),t.prototype.addBindings=function(e){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(he(e,"onGestureStart",this.onGestureStart),he(e,"onGestureChange",this.onGestureChange),he(e,"onGestureEnd",this.onGestureEnd)):(he(e,"onTouchStart",this.onPinchStart),he(e,"onTouchMove",this.onPinchChange),he(e,"onTouchEnd",this.onPinchEnd),he(e,"onTouchCancel",this.onPinchEnd),he(e,"onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}f(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=t.values[1],r=e[0],i=e[1],a=void 0===i?n:i,s=a-n,c=t.turns;return Math.abs(s)>270&&(c+=u(s)),o([r,a-360*c],t.initial)},n.getKinematics=function(e,t){var n=this.getMovement(e);return d({turns:(e[1]-n._movement[1]-this.state.initial[1])/360},n,v(s(n.movement,n.delta,t.timeStamp-this.state.timeStamp),["distance","velocity"]))},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(Z)),Me=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="wheeling",t.stateKey="wheel",t.debounced=!0,t.handleEvent=function(e){if((!e.ctrlKey||!("pinch"in t.controller.handlers))&&t.enabled){t.setTimeout(t.onEnd),t.updateSharedState(E(e));var n=r(K(e,t.transform),t.state.values);if(t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var o=t.getMovement(n),i=a(o.delta);t.updateGestureState(o),t.updateGestureState(i)}t.fireGestureHandler()}},t.onEnd=function(){if(t.clean(),t.state._active){var e=t.getMovement(t.state.values);t.updateGestureState(e),t.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),t.fireGestureHandler()}},t}return f(t,e),t.prototype.addBindings=function(e){he(e,"onWheel",this.handleEvent)},t}(Se),Ee=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="moving",t.stateKey="move",t.debounced=!0,t.onMove=function(e){t.enabled&&(t.setTimeout(t.onMoveEnd),t.state._active?t.onMoveChange(e):t.onMoveStart(e))},t.onMoveStart=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0))),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()},t.onMoveChange=function(e){t.updateSharedState(E(e));var n=I(e,t.transform);t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e))),t.fireGestureHandler()},t.onMoveEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(t.getMovement(t.state.values)),t.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),t.fireGestureHandler())},t.hoverTransform=function(){return t.controller.config.hover.transform||t.controller.config.transform},t.onPointerEnter=function(e){if(t.controller.state.shared.hovering=!0,t.controller.config.enabled){if(t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e,!0),{args:t.args,values:n,active:!0,hovering:!0});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}"move"in t.controller.handlers&&t.onMoveStart(e)}},t.onPointerLeave=function(e){if(t.controller.state.shared.hovering=!1,"move"in t.controller.handlers&&t.onMoveEnd(),t.controller.config.hover.enabled){var n=I(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,ne(h(t),e),{args:t.args,values:n,active:!1});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}},t}return f(t,e),t.prototype.addBindings=function(e){"move"in this.controller.handlers&&he(e,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(he(e,"onPointerEnter",this.onPointerEnter),he(e,"onPointerLeave",this.onPointerLeave))},t}(Se),Oe=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="scrolling",t.stateKey="scroll",t.debounced=!0,t.handleEvent=function(e){if(t.enabled){t.clearTimeout(),t.setTimeout(t.onEnd);var n=P(e,t.transform);if(t.updateSharedState(E(e)),t.state._active)t.updateGestureState(d({},ne(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},re(h(t),n,e),ne(h(t),e,!0),{initial:t.state.values}));var r=t.getMovement(n),o=a(r.delta);t.updateGestureState(r),t.updateGestureState(o)}t.fireGestureHandler()}},t.onEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(d({},t.getMovement(t.state.values),{_active:!1,velocities:[0,0],velocity:0})),t.fireGestureHandler())},t}return f(t,e),t.prototype.addBindings=function(e){he(e,"onScroll",this.handleEvent)},t}(Se),Ie=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function xe(e,t){var n=t+"Start",r=t+"End";return function(o){var i=void 0;return o.first&&n in e&&e[n](o),t in e&&(i=e[t](o)),o.last&&r in e&&e[r](o),i}}e.addV=r,e.rubberbandIfOutOfBounds=l,e.subV=o,e.useDrag=function(e,n){void 0===n&&(n={}),J.set("drag",we);var r=t.useRef();return r.current||(r.current=_e(z,Te)),me({drag:e},r.current(n))},e.useGesture=function(e,t){void 0===t&&(t={});var n=function(e){var t={},n={},r=new Set;for(var o in e)Ie.test(o)?(r.add(RegExp.lastMatch),n[o]=e[o]):t[o]=e[o];return[n,t,r]}(e),r=n[0],o=n[1],i=n[2];J.set("drag",we),J.set("hover",Ee),J.set("move",Ee),J.set("pinch",Ge),J.set("scroll",Oe),J.set("wheel",Me);var a=function(e,t){void 0===e&&(e={}),void 0===t&&(t=new Set);var n=e.drag,r=e.wheel,o=e.move,i=e.scroll,a=e.pinch,s=e.hover,u=L({domTarget:e.domTarget,eventOptions:e.eventOptions,transform:e.transform,window:e.window,enabled:e.enabled});return t.has("onDrag")&&(u.drag=V(n)),t.has("onWheel")&&(u.wheel=Y(r)),t.has("onScroll")&&(u.scroll=Y(i)),t.has("onMove")&&(u.move=Y(o)),t.has("onPinch")&&(u.pinch=R(a)),t.has("onHover")&&(u.hover=d({enabled:!0},s)),u}(t,i),s={};return i.has("onDrag")&&(s.drag=xe(r,"onDrag")),i.has("onWheel")&&(s.wheel=xe(r,"onWheel")),i.has("onScroll")&&(s.scroll=xe(r,"onScroll")),i.has("onMove")&&(s.move=xe(r,"onMove")),i.has("onPinch")&&(s.pinch=xe(r,"onPinch")),i.has("onHover")&&(s.hover=r.onHover),me(s,a,o)},e.useHover=function(e,n){void 0===n&&(n={}),J.set("hover",Ee);var r=t.useRef();return r.current||(r.current=_e(B,Te)),me({hover:e},r.current(n))},e.useMove=function(e,n){void 0===n&&(n={}),J.set("move",Ee);var r=t.useRef();return r.current||(r.current=_e(X,Te)),me({move:e},r.current(n))},e.usePinch=function(e,n){void 0===n&&(n={}),J.set("pinch",Ge);var r=t.useRef();return r.current||(r.current=_e(U,Te)),me({pinch:e},r.current(n))},e.useScroll=function(e,n){void 0===n&&(n={}),J.set("scroll",Oe);var r=t.useRef();return r.current||(r.current=_e(F,Te)),me({scroll:e},r.current(n))},e.useWheel=function(e,n){void 0===n&&(n={}),J.set("wheel",Me);var r=t.useRef();return r.current||(r.current=_e($,Te)),me({wheel:e},r.current(n))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=reactusegesture.umd.production.min.js.map |
@@ -10,3 +10,3 @@ /// <reference types="react" /> | ||
/** | ||
* Returns the real movement (without taking intentionality into acount) | ||
* Returns the real movement (without taking intentionality into account) | ||
*/ | ||
@@ -13,0 +13,0 @@ protected getInternalMovement(values: Vector2, state: GestureState<T>): Vector2; |
{ | ||
"name": "react-use-gesture", | ||
"version": "8.1.0-beta.9", | ||
"version": "9.0.0-beta.10", | ||
"description": "React hook for receiving gestures https://use-gesture.netlify.app", | ||
@@ -85,19 +85,19 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@size-limit/preset-small-lib": "^4.7.0", | ||
"@size-limit/preset-small-lib": "^4.9.1", | ||
"@testing-library/jest-dom": "^5.11.6", | ||
"@testing-library/react": "^11.1.2", | ||
"@types/jest": "^26.0.15", | ||
"@types/react": "^16.9.56", | ||
"@types/react-dom": "^16.9.9", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"husky": "^4.3.0", | ||
"prettier": "^2.1.2", | ||
"@testing-library/react": "^11.2.2", | ||
"@types/jest": "^26.0.16", | ||
"@types/react": "^17.0.0", | ||
"@types/react-dom": "^17.0.0", | ||
"eslint-plugin-prettier": "^3.2.0", | ||
"husky": "^4.3.4", | ||
"prettier": "^2.2.1", | ||
"pretty-quick": "^3.1.0", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"size-limit": "^4.7.0", | ||
"size-limit": "^4.9.1", | ||
"tsdx": "^0.14.1", | ||
"tslib": "^2.0.3", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.1.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1042152
7929
0