react-ui-animate 3.3.2 → 4.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +1,53 @@
1
- import type { FluidValueConfig, Length } from '@raidipesh78/re-motion';
2
- interface WithOnCallbacks extends Pick<FluidValueConfig, 'onRest' | 'onStart' | 'onChange'> {
1
+ import type { UseFluidValueConfig } from '@raidipesh78/re-motion';
2
+ interface WithOnCallbacks extends Pick<UseFluidValueConfig, 'onRest' | 'onStart' | 'onChange'> {
3
3
  }
4
4
  interface WithEaseConfig extends WithOnCallbacks {
5
5
  }
6
- interface WithSpringConfig extends Pick<FluidValueConfig, 'mass' | 'friction' | 'tension'>, WithOnCallbacks {
6
+ interface WithSpringConfig extends Pick<UseFluidValueConfig, 'mass' | 'friction' | 'tension'>, WithOnCallbacks {
7
7
  }
8
- interface WithTimingConfig extends Pick<FluidValueConfig, 'duration' | 'easing'>, WithOnCallbacks {
8
+ interface WithTimingConfig extends Pick<UseFluidValueConfig, 'duration' | 'easing'>, WithOnCallbacks {
9
9
  }
10
- interface WithDecayConfig extends Pick<FluidValueConfig, 'decay' | 'velocity' | 'deceleration'>, WithOnCallbacks {
10
+ interface WithDecayConfig extends Pick<UseFluidValueConfig, 'decay' | 'velocity' | 'deceleration'>, WithOnCallbacks {
11
11
  }
12
12
  /**
13
13
  * Creates a default animation configuration.
14
- * @param {Length} toValue - The target value of the animation.
15
- * @param {FluidValueConfig} config - Optional configuration.
16
- * @returns {{ toValue: Length; config: FluidValueConfig }}
14
+ * @param {number} toValue - The target value of the animation.
15
+ * @param {UseFluidValueConfig} config - Optional configuration.
16
+ * @returns {{ toValue: number; config: UseFluidValueConfig }}
17
17
  */
18
- export declare const withConfig: (toValue: Length, config?: FluidValueConfig) => {
19
- toValue: Length;
20
- config: FluidValueConfig | undefined;
18
+ export declare const withConfig: (toValue: number, config?: UseFluidValueConfig) => {
19
+ toValue: number;
20
+ config: UseFluidValueConfig | undefined;
21
21
  };
22
22
  /**
23
23
  * Creates an ease animation configuration.
24
- * @param {Length} toValue - The target value of the animation.
25
- * @param {FluidValueConfig} [config=AnimationConfigUtils.EASE] - Optional ease configuration.
26
- * @returns {{ toValue: Length; config: FluidValueConfig }}
24
+ * @param {number} toValue - The target value of the animation.
25
+ * @param {UseFluidValueConfig} [config=AnimationConfigUtils.EASE] - Optional ease configuration.
26
+ * @returns {{ toValue: number; config: UseFluidValueConfig }}
27
27
  */
28
- export declare const withEase: (toValue: Length, config?: WithEaseConfig) => {
29
- toValue: Length;
30
- config: FluidValueConfig | undefined;
28
+ export declare const withEase: (toValue: number, config?: WithEaseConfig) => {
29
+ toValue: number;
30
+ config: UseFluidValueConfig | undefined;
31
31
  };
32
32
  /**
33
33
  * Creates a spring animation configuration.
34
- * @param {Length} toValue - The target value of the animation.
34
+ * @param {number} toValue - The target value of the animation.
35
35
  * @param {WithSpringConfig} [config=AnimationConfigUtils.ELASTIC] - Optional spring configuration.
36
- * @returns {{ toValue: Length; config: WithSpringConfig }}
36
+ * @returns {{ toValue: number; config: WithSpringConfig }}
37
37
  */
38
- export declare const withSpring: (toValue: Length, config?: WithSpringConfig) => {
39
- toValue: Length;
40
- config: FluidValueConfig | undefined;
38
+ export declare const withSpring: (toValue: number, config?: WithSpringConfig) => {
39
+ toValue: number;
40
+ config: UseFluidValueConfig | undefined;
41
41
  };
42
42
  /**
43
43
  * Creates a timing animation configuration.
44
- * @param {Length} toValue - The target value of the animation.
44
+ * @param {number} toValue - The target value of the animation.
45
45
  * @param {WithTimingConfig} [config={ duration: 250 }] - Optional timing configuration.
46
- * @returns {{ toValue: Length; config: WithTimingConfig }}
46
+ * @returns {{ toValue: number; config: WithTimingConfig }}
47
47
  */
48
- export declare const withTiming: (toValue: Length, config?: WithTimingConfig) => {
49
- toValue: Length;
50
- config: FluidValueConfig | undefined;
48
+ export declare const withTiming: (toValue: number, config?: WithTimingConfig) => {
49
+ toValue: number;
50
+ config: UseFluidValueConfig | undefined;
51
51
  };
52
52
  /**
53
53
  * Creates a decay animation configuration.
@@ -59,25 +59,25 @@ export declare const withDecay: (config: WithDecayConfig) => {
59
59
  };
60
60
  /**
61
61
  * Creates a sequence of animations that run one after another.
62
- * @param {Array<{ toValue: Length; config?: FluidValueConfig } | number>} configs - An array of animation configurations or delays.
62
+ * @param {Array<{ toValue: number; config?: UseFluidValueConfig } | number>} configs - An array of animation configurations or delays.
63
63
  * @returns {Function} An async function that runs the animations in sequence.
64
64
  */
65
65
  export declare const withSequence: (configs: Array<{
66
- toValue?: Length;
67
- config?: FluidValueConfig;
66
+ toValue?: number;
67
+ config?: UseFluidValueConfig;
68
68
  } | number>) => (next: (arg: {
69
- toValue?: Length;
70
- config?: FluidValueConfig;
69
+ toValue?: number;
70
+ config?: UseFluidValueConfig;
71
71
  }) => void) => Promise<void>;
72
72
  /**
73
73
  * Adds a delay before the given animation.
74
74
  * @param {number} delay - The delay in milliseconds.
75
- * @param {{ toValue: Length; config?: FluidValueConfig }} animation - The animation configuration (withTiming | withSpring).
76
- * @returns {{ toValue: Length; config: FluidValueConfig }} The updated animation configuration with delay.
75
+ * @param {{ toValue: number; config?: UseFluidValueConfig }} animation - The animation configuration (withTiming | withSpring).
76
+ * @returns {{ toValue: number; config: UseFluidValueConfig }} The updated animation configuration with delay.
77
77
  */
78
78
  export declare const withDelay: (delay: number, animation: {
79
- toValue: Length;
80
- config?: FluidValueConfig;
79
+ toValue: number;
80
+ config?: UseFluidValueConfig;
81
81
  }) => {
82
82
  config: {
83
83
  delay: number;
@@ -85,16 +85,16 @@ export declare const withDelay: (delay: number, animation: {
85
85
  tension?: number;
86
86
  friction?: number;
87
87
  duration?: number;
88
- easing?: import("@raidipesh78/re-motion/dist/types/common").Fn<number, number>;
88
+ easing?: (value: number) => number;
89
89
  immediate?: boolean;
90
90
  restDistance?: number;
91
- onChange?: import("@raidipesh78/re-motion/dist/types/common").Fn<number, void>;
92
- onRest?: import("@raidipesh78/re-motion/dist/types/common").Fn<number, void>;
93
- onStart?: import("@raidipesh78/re-motion/dist/types/common").Fn<number, void>;
91
+ onChange?: (value: number) => void;
92
+ onRest?: (value: number) => void;
93
+ onStart?: (value: number) => void;
94
94
  decay?: boolean;
95
95
  velocity?: number;
96
96
  deceleration?: number;
97
97
  };
98
- toValue: Length;
98
+ toValue: number;
99
99
  };
100
100
  export {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Easing, makeFluid as makeAnimated, fluid as animate, } from '@raidipesh78/re-motion';
2
- export { AnimatedBlock, AnimatedImage, AnimatedInline, AnimationConfigUtils, MountedBlock, ScrollableBlock, TransitionBlock, } from './animation';
2
+ export { AnimationConfigUtils, MountedBlock, ScrollableBlock, TransitionBlock, } from './animation';
3
3
  export { bInterpolate, interpolate } from './animation';
4
4
  export { useAnimatedValue, useMountedValue } from './animation';
5
5
  export { withSpring, withTiming, withSequence, withDelay, withEase, withConfig, withDecay, delay, } from './animation';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var t=require("@raidipesh78/re-motion"),e=require("react/jsx-runtime"),n=require("react");function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var r=i(n),o=function(t){return null!=t};function s(e){if(!o(e)||"number"!=typeof e&&!t.isFluidValue(e))throw console.log(e),new Error("Invalid ".concat(e," type for interpolate function. Expected number or FluidValue."));return e}var u=t.makeFluid("div"),c=t.makeFluid("span"),a=t.makeFluid("img");function l(e,n){var i=t.useMount(e,n);return function(t){return i((function(e,n){return t({value:e},n)}))}}var h=function(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},h(t,e)};function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return v=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},v.apply(this,arguments)};function m(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function u(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((i=i.apply(t,e||[])).next())}))}function p(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=e.call(t,s)}catch(t){u=[6,t],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function y(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function x(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var b=function(e){switch(e){case"elastic":return{mass:1,friction:18,tension:250};case"stiff":return{mass:1,friction:18,tension:350};case"wooble":return{mass:1,friction:8,tension:250};case"bounce":return{duration:500,easing:t.Easing.bounce};case"power1":return{duration:500,easing:t.Easing.bezier(.17,.42,.51,.97)};case"power2":return{duration:500,easing:t.Easing.bezier(.07,.11,.13,1)};case"power3":return{duration:500,easing:t.Easing.bezier(.09,.7,.16,1.04)};case"power4":return{duration:500,easing:t.Easing.bezier(.05,.54,0,1.03)};case"linear":return{duration:500,easing:t.Easing.linear};case"easein":return{duration:500,easing:t.Easing.in(t.Easing.ease)};case"easeout":return{duration:500,easing:t.Easing.out(t.Easing.ease)};case"easeinout":return{duration:500,easing:t.Easing.inOut(t.Easing.ease)};default:return{mass:1,friction:34,tension:290}}},g={ELASTIC:b("elastic"),BOUNCE:b("bounce"),EASE:b("ease"),STIFF:b("stiff"),WOOBLE:b("wooble"),EASE_IN:b("easein"),EASE_OUT:b("easeout"),EASE_IN_OUT:b("easeinout"),POWER1:b("power1"),POWER2:b("power2"),POWER3:b("power3"),POWER4:b("power4"),LINEAR:b("linear")};function E(e,n){var i=d(t.useFluidValue(e,v(v({},g.EASE),n)),2),r=i[0],o=i[1],s={value:r,currentValue:r.get()};return new Proxy(s,{set:function(t,e,n){if("value"===e)return"number"==typeof n||"string"==typeof n?queueMicrotask((function(){return o({toValue:n})})):"object"!=typeof n&&"function"!=typeof n||queueMicrotask((function(){return o(n)})),!0;throw new Error("You cannot set any other property to animation node.")},get:function(t,e){if("value"===e)return r;if("currentValue"===e)return r.get();throw new Error("You cannot access any other property from animation node.")}})}function w(t){return t?1:0}function M(t,e,n){return Math.min(Math.max(t,e),n)}function _(t,e,n){return 0===e||Math.abs(e)===1/0?function(t,e){return Math.pow(t,5*e)}(t,n):t*e*n/(e+n*t)}var I=function(t,e){return{toValue:t,config:e}};function T(t,e){var n=new Map;return e.forEach((function(e){var i=d(e,3),r=i[0],o=i[1],s=i[2],u=void 0!==s&&s;n.set(r,function(t,e,n,i){return void 0===i&&(i=!1),t.forEach((function(t){t.addEventListener(e,n,i)})),function(){t.forEach((function(t){t.removeEventListener(e,n,i)}))}}(t,r,o,u))})),function(t){var e,i;try{for(var r=y(n.entries()),o=r.next();!o.done;o=r.next()){var s=d(o.value,2),u=s[0],c=s[1];if(!t)return void c();-1!==t.indexOf(u)&&c()}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}}}var O=function(t,e){return{x:t,y:e}},k=function(){function t(){this.lastTimeStamp=Date.now(),this.isActive=!1,this.targetElements=[]}return t.prototype._initEvents=function(){},t.prototype._cancelEvents=function(){this._subscribe&&this._subscribe()},t.prototype.applyCallback=function(t){this.callback=t},t.prototype.applyGesture=function(t){var e=this,n=t.targetElement,i=t.targetElements,r=t.callback,o=t.config;return this.targetElement=n,this.targetElements=i.map((function(t){return t.current})),this.callback=r,this.config=o,this._initEvents(),function(){return e._subscribe&&e._subscribe()}},t._VELOCITY_LIMIT=20,t}(),L=function(t){function e(){var e=t.apply(this,x([],d(arguments),!1))||this;return e.movementStart=O(0,0),e.initialMovement=O(0,0),e.movement=O(0,0),e.previousMovement=O(0,0),e.translation=O(0,0),e.offset=O(0,0),e.velocity=O(0,0),e}return f(e,t),e.prototype._initEvents=function(){(this.targetElement||this.targetElements.length>0)&&(this._subscribe=T([window],[["mousedown",this.pointerDown.bind(this)],["mousemove",this.pointerMove.bind(this)],["mouseup",this.pointerUp.bind(this)],["touchstart",this.pointerDown.bind(this),{passive:!1}],["touchmove",this.pointerMove.bind(this),{passive:!1}],["touchend",this.pointerUp.bind(this)]]))},e.prototype._cancelEvents=function(){this._subscribe&&this._subscribe(["mousedown","mousemove","touchstart","touchmove"])},e.prototype._handleCallback=function(){var t=this;this.callback&&this.callback({args:[this.currentIndex],down:this.isActive,movementX:this.movement.x,movementY:this.movement.y,offsetX:this.translation.x,offsetY:this.translation.y,velocityX:this.velocity.x,velocityY:this.velocity.y,distanceX:Math.abs(this.movement.x),distanceY:Math.abs(this.movement.y),directionX:Math.sign(this.movement.x),directionY:Math.sign(this.movement.y),cancel:function(){t._cancelEvents()}})},e.prototype.pointerDown=function(t){var e;"touchstart"===t.type?this.movementStart={x:t.touches[0].clientX,y:t.touches[0].clientY}:this.movementStart={x:t.clientX,y:t.clientY},this.movement={x:0,y:0},this.offset={x:this.translation.x,y:this.translation.y},this.previousMovement={x:0,y:0},this.velocity={x:0,y:0};var n=this.targetElements.find((function(e){return e===t.target}));if(t.target===this.targetElement||n){this.isActive=!0,t.preventDefault(),n&&(this.currentIndex=this.targetElements.indexOf(n));var i=(null===(e=this.config)||void 0===e?void 0:e.initial)&&this.config.initial(),r=null==i?void 0:i.movementX,o=null==i?void 0:i.movementY;this.initialMovement={x:null!=r?r:0,y:null!=o?o:0},this.movement={x:this.initialMovement.x,y:this.initialMovement.y},this.previousMovement={x:this.initialMovement.x,y:this.initialMovement.y},this._handleCallback()}},e.prototype.pointerMove=function(t){if(this.isActive){t.preventDefault();var e=Date.now(),n=M(e-this.lastTimeStamp,.1,64);this.lastTimeStamp=e;var i=n/1e3;"touchmove"===t.type?this.movement={x:this.initialMovement.x+(t.touches[0].clientX-this.movementStart.x),y:this.initialMovement.y+(t.touches[0].clientY-this.movementStart.y)}:this.movement={x:this.initialMovement.x+(t.clientX-this.movementStart.x),y:this.initialMovement.y+(t.clientY-this.movementStart.y)},this.translation={x:this.offset.x+this.movement.x,y:this.offset.y+this.movement.y},this.velocity={x:M((this.movement.x-this.previousMovement.x)/i/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT),y:M((this.movement.y-this.previousMovement.y)/i/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()}},e.prototype.pointerUp=function(){this.isActive&&(this.isActive=!1,this._handleCallback(),this._cancelEvents(),this._initEvents())},e}(k),Y=function(t){function e(){var e=t.apply(this,x([],d(arguments),!1))||this;return e.movement=O(0,0),e.previousMovement=O(0,0),e.velocity=O(0,0),e.direction=O(0,0),e}return f(e,t),e.prototype._initEvents=function(){this.targetElement?this._subscribe=T([this.targetElement],[["mousemove",this.onMouseMove.bind(this)]]):this.targetElements.length>0?this._subscribe=T(this.targetElements,[["mousemove",this.onMouseMove.bind(this)]]):this._subscribe=T([window],[["mousemove",this.onMouseMove.bind(this)]])},e.prototype._handleCallback=function(){var t;this.callback&&this.callback({args:[this.currentIndex],event:this.event,isMoving:this.isActive,target:null===(t=this.event)||void 0===t?void 0:t.target,mouseX:this.movement.x,mouseY:this.movement.y,velocityX:this.velocity.x,velocityY:this.velocity.y,directionX:this.direction.x,directionY:this.direction.y})},e.prototype.onMouseMove=function(t){var e=this,n=this.targetElements.find((function(e){return e===t.target}));n&&(this.currentIndex=this.targetElements.indexOf(n)),this.event=t;var i=Date.now(),r=Math.min(i-this.lastTimeStamp,64);this.lastTimeStamp=i;var o=r/1e3,s=t.clientX,u=t.clientY;this.movement={x:s,y:u},-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){e.isActive=!1,e.direction={x:0,y:0},e.velocity={x:0,y:0},e._handleCallback()}),250);var c=this.movement.x-this.previousMovement.x,a=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(c),y:Math.sign(a)},this.velocity={x:M(c/o/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT),y:M(a/o/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},e}(k),S=function(t){function e(){var e=t.apply(this,x([],d(arguments),!1))||this;return e.movement=O(0,0),e.previousMovement=O(0,0),e.direction=O(0,0),e.velocity=O(0,0),e}return f(e,t),e.prototype._initEvents=function(){this.targetElement?this._subscribe=T([this.targetElement],[["scroll",this.scrollElementListener.bind(this)]]):this._subscribe=T([window],[["scroll",this.scrollListener.bind(this)]])},e.prototype._handleCallback=function(){this.callback&&this.callback({isScrolling:this.isActive,scrollX:this.movement.x,scrollY:this.movement.y,velocityX:this.velocity.x,velocityY:this.velocity.y,directionX:this.direction.x,directionY:this.direction.y})},e.prototype.onScroll=function(t){var e=this,n=t.x,i=t.y,r=Date.now(),o=Math.min(r-this.lastTimeStamp,64);this.lastTimeStamp=r;var s=o/1e3;this.movement={x:n,y:i},-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){e.isActive=!1,e.direction={x:0,y:0},e.velocity={x:0,y:0},e._handleCallback()}),250);var u=this.movement.x-this.previousMovement.x,c=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(u),y:Math.sign(c)},this.velocity={x:M(u/s/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT),y:M(c/s/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},e.prototype.scrollListener=function(){var t=window.pageYOffset,e=window.pageXOffset;this.onScroll({x:e,y:t})},e.prototype.scrollElementListener=function(){var t,e,n=(null===(t=this.targetElement)||void 0===t?void 0:t.scrollLeft)||0,i=(null===(e=this.targetElement)||void 0===e?void 0:e.scrollTop)||0;this.onScroll({x:n,y:i})},e}(k),A=function(t){function e(){var e=t.apply(this,x([],d(arguments),!1))||this;return e.movement=O(0,0),e.previousMovement=O(0,0),e.direction=O(0,0),e.velocity=O(0,0),e.delta=O(0,0),e.offset=O(0,0),e.translation=O(0,0),e}return f(e,t),e.prototype._initEvents=function(){this.targetElement&&(this._subscribe=T([this.targetElement],[["wheel",this.onWheel.bind(this)]]))},e.prototype._handleCallback=function(){this.callback&&this.callback({target:this.targetElement,isWheeling:this.isActive,deltaX:this.delta.x,deltaY:this.delta.y,directionX:this.direction.x,directionY:this.direction.y,movementX:this.movement.x,movementY:this.movement.y,offsetX:this.offset.x,offsetY:this.offset.y,velocityX:this.velocity.x,velocityY:this.velocity.y})},e.prototype.onWheel=function(t){var e=this,n=t.deltaX,i=t.deltaY,r=t.deltaMode,o=Date.now(),s=Math.min(o-this.lastTimeStamp,64);this.lastTimeStamp=o;var u=s/1e3;this.isActive=!0,-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){e.isActive=!1,e.translation={x:e.offset.x,y:e.offset.y},e._handleCallback(),e.velocity={x:0,y:0},e.movement={x:0,y:0}}),200),1===r?(n*=40,i*=40):2===r&&(n*=800,i*=800),this.delta={x:n,y:i},this.movement={x:this.movement.x+n,y:this.movement.y+i},this.offset={x:this.translation.x+this.movement.x,y:this.translation.y+this.movement.y};var c=this.movement.x-this.previousMovement.x,a=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(c),y:Math.sign(a)},this.velocity={x:M(c/u/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT),y:M(a/u/1e3,-1*k._VELOCITY_LIMIT,k._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},e}(k),C=function(t){var e=r.useRef(),n=r.useRef([]),i=r.useRef(new Map).current;return r.useEffect((function(){var e,n;try{for(var r=y(i.entries()),o=r.next();!o.done;o=r.next()){var s=d(o.value,2)[1],u=s.keyIndex,c=s.gesture,a=d(t[u],3)[2];c.applyCallback(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}}),[t]),r.useEffect((function(){return t.forEach((function(t,r){var o=d(t,4),s=o[0],u=o[1],c=o[2],a=o[3];queueMicrotask((function(){return i.set(s,{keyIndex:r,gesture:u,unsubscribe:u.applyGesture({targetElement:e.current,targetElements:n.current,callback:c,config:a})})}))})),function(){var t,e;try{for(var n=y(i.entries()),r=n.next();!r.done;r=n.next()){var o=d(r.value,2)[1].unsubscribe;o&&o()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}}})),function(t){return null==t?{ref:e}:(n.current[t]=n.current[t]||r.createRef(),{ref:n.current[t]})}};Object.defineProperty(exports,"Easing",{enumerable:!0,get:function(){return t.Easing}}),Object.defineProperty(exports,"animate",{enumerable:!0,get:function(){return t.fluid}}),Object.defineProperty(exports,"makeAnimated",{enumerable:!0,get:function(){return t.makeFluid}}),exports.AnimatedBlock=u,exports.AnimatedImage=a,exports.AnimatedInline=c,exports.AnimationConfigUtils=g,exports.MountedBlock=function(t){var n=t.state,i=t.children,r=t.from,o=void 0===r?0:r,s=t.enter,u=void 0===s?1:s,c=t.exit,a=l(n,{from:o,enter:u,exit:void 0===c?0:c,config:t.config});return e.jsx(e.Fragment,{children:a((function(t,e){return e&&i({value:t.value})}))})},exports.ScrollableBlock=function(t){var n=t.children,i=t.direction,o=void 0===i?"single":i,s=t.animationConfig,u=t.threshold,c=void 0===u?.2:u,a=r.useRef(null),l=E(0,s);return r.useEffect((function(){var t=a.current,e=new IntersectionObserver((function(t){d(t,1)[0].isIntersecting?l.value=1:"both"===o&&(l.value=0)}),{root:null,threshold:c});return t&&e.observe(t),function(){t&&e.unobserve(t)}}),[]),e.jsx("div",{ref:a,children:n&&n({value:l.value})})},exports.TransitionBlock=function(t){var n=t.state,i=t.children,r=t.config,o=E(w(n),r);return e.jsx(e.Fragment,{children:i({value:o.value})})},exports.bInterpolate=function(e,n,i,r){var o=s(e);return t.interpolate(o,[0,1],[n,i],r)},exports.bin=w,exports.clamp=M,exports.delay=function(t){return new Promise((function(e){setTimeout((function(){return e(null)}),t)}))},exports.interpolate=function(e,n,i,r){var o=s(e);return t.interpolate(o,n,i,r)},exports.mix=function(t,e,n){return e*(1-t)+n*t},exports.move=function(t,e,n){var i=t[e],r=t.length,o=e-n;if(o>0)return x(x(x(x([],d(t.slice(0,n)),!1),[i],!1),d(t.slice(n,e)),!1),d(t.slice(e+1,r)),!1);if(o<0){var s=n+1;return x(x(x(x([],d(t.slice(0,e)),!1),d(t.slice(e+1,s)),!1),[i],!1),d(t.slice(s,r)),!1)}return t},exports.rubberClamp=function(t,e,n,i){return void 0===i&&(i=.15),0===i?M(t,e,n):t<e?-_(e-t,n-e,i)+e:t>n?+_(t-n,n-e,i)+n:t},exports.snapTo=function(t,e,n){var i=t+.2*e,r=function(t){return Math.abs(t-i)},o=n.map(r),s=Math.min.apply(Math,x([],d(o),!1));return n.reduce((function(t,e){return r(e)===s?e:t}))},exports.useAnimatedValue=E,exports.useDrag=function(t,e){var n=r.useRef(new L).current;return C([["drag",n,t,e]])},exports.useGesture=function(t){var e=t.onDrag,n=t.onWheel,i=t.onScroll,o=t.onMouseMove,s=r.useRef(new L).current,u=r.useRef(new A).current,c=r.useRef(new S).current,a=r.useRef(new Y).current;return C([["drag",s,e],["wheel",u,n],["scroll",c,i],["move",a,o]])},exports.useMeasure=function(t,e){var i=n.useRef(null),r=n.useRef([]),o=n.useRef(t);return n.useEffect((function(){return o.current=t,function(){o.current=function(){return!1}}}),e),n.useEffect((function(){var t=i.current||document.documentElement,e=r.current,n=new ResizeObserver((function(e){var n=d(e,1)[0].target.getBoundingClientRect(),i=n.left,r=n.top,s=n.width,u=n.height,c=window.pageXOffset,a=window.pageYOffset;if(o){if(t===document.documentElement)return;o.current({left:i+c,top:r+a,width:s,height:u,vLeft:i,vTop:r})}})),s=new ResizeObserver((function(t){var e=[],n=[],i=[],r=[],s=[],u=[];t.forEach((function(t){var o=t.target.getBoundingClientRect(),c=o.left,a=o.top,l=o.width,h=o.height,f=c+window.pageXOffset,v=a+window.pageYOffset;e.push(f),n.push(v),i.push(l),r.push(h),s.push(c),u.push(a)})),o&&o.current({left:e,top:n,width:i,height:r,vLeft:s,vTop:u})}));return t&&(t===document.documentElement&&e.length>0?e.forEach((function(t){s.observe(t.current)})):n.observe(t)),function(){t&&(t===document.documentElement&&e.length>0?e.forEach((function(t){s.unobserve(t.current)})):n.unobserve(t))}}),[]),function(t){return null==t?{ref:i}:(r.current[t]=r.current[t]||n.createRef(),{ref:r.current[t]})}},exports.useMountedValue=l,exports.useMouseMove=function(t){var e=r.useRef(new Y).current;return C([["move",e,t]])},exports.useOutsideClick=function(t,e,i){var r=n.useRef();r.current||(r.current=e),n.useEffect((function(){return r.current=e,function(){r.current=function(){return!1}}}),i),n.useEffect((function(){var e=T([document],[["click",function(e){var n;(null===(n=null==t?void 0:t.current)||void 0===n?void 0:n.contains(e.target))||r.current&&r.current(e)}]]);return function(){return e&&e()}}),[])},exports.useScroll=function(t){var e=r.useRef(new S).current;return C([["scroll",e,t]])},exports.useWheel=function(t){var e=r.useRef(new A).current;return C([["wheel",e,t]])},exports.useWindowDimension=function(t,e){var i=n.useRef({width:0,height:0,innerWidth:0,innerHeight:0}),r=n.useRef(t);n.useEffect((function(){return r.current=t,function(){r.current=function(){return!1}}}),e),n.useEffect((function(){var t=new ResizeObserver((function(t){var e=d(t,1)[0].target,n=e.clientWidth,o=e.clientHeight,s=window.innerWidth,u=window.innerHeight;i.current={width:n,height:o,innerWidth:s,innerHeight:u},r&&r.current(v({},i.current))}));return t.observe(document.documentElement),function(){return t.unobserve(document.documentElement)}}),[])},exports.withConfig=I,exports.withDecay=function(t){return{config:t}},exports.withDelay=function(t,e){return v(v({},e),{config:v(v({},e.config),{delay:t})})},exports.withEase=function(t,e){return I(t,v(v({},g.EASE),e))},exports.withSequence=function(t){return function(e){return m(void 0,void 0,void 0,(function(){var n,i,r,o,s,u;return p(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,7]),n=y(t),i=n.next(),c.label=1;case 1:return i.done?[3,4]:(r=i.value,[4,e("number"==typeof r?{toValue:r}:r)]);case 2:c.sent(),c.label=3;case 3:return i=n.next(),[3,1];case 4:return[3,7];case 5:return o=c.sent(),s={error:o},[3,7];case 6:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}))}},exports.withSpring=function(t,e){return I(t,v(v({},g.ELASTIC),e))},exports.withTiming=function(t,e){return I(t,v({duration:250},e))};
1
+ var t=require("@raidipesh78/re-motion"),e=require("react/jsx-runtime"),n=require("react");function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var r=i(n),o=function(t){return null!=t};function s(e){if(!(o(e)&&e instanceof t.FluidValue))throw console.log(e),new Error("Invalid ".concat(e," type for interpolate function. Expected FluidValue."));return e}function u(e,n){var i=t.useMount(e,n);return function(t){return i((function(e,n){return t({value:e},n)}))}}var c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},c(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var l=function(){return l=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},l.apply(this,arguments)};function h(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function u(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((i=i.apply(t,e||[])).next())}))}function f(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=e.call(t,s)}catch(t){u=[6,t],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function v(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function p(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var y=function(e){switch(e){case"elastic":return{mass:1,friction:18,tension:250};case"stiff":return{mass:1,friction:18,tension:350};case"wooble":return{mass:1,friction:8,tension:250};case"bounce":return{duration:500,easing:t.Easing.bounce};case"power1":return{duration:500,easing:t.Easing.bezier(.17,.42,.51,.97)};case"power2":return{duration:500,easing:t.Easing.bezier(.07,.11,.13,1)};case"power3":return{duration:500,easing:t.Easing.bezier(.09,.7,.16,1.04)};case"power4":return{duration:500,easing:t.Easing.bezier(.05,.54,0,1.03)};case"linear":return{duration:500,easing:t.Easing.linear};case"easein":return{duration:500,easing:t.Easing.in(t.Easing.ease)};case"easeout":return{duration:500,easing:t.Easing.out(t.Easing.ease)};case"easeinout":return{duration:500,easing:t.Easing.inOut(t.Easing.ease)};default:return{mass:1,friction:26,tension:170}}},d={ELASTIC:y("elastic"),BOUNCE:y("bounce"),EASE:y("ease"),STIFF:y("stiff"),WOOBLE:y("wooble"),EASE_IN:y("easein"),EASE_OUT:y("easeout"),EASE_IN_OUT:y("easeinout"),POWER1:y("power1"),POWER2:y("power2"),POWER3:y("power3"),POWER4:y("power4"),LINEAR:y("linear")};function x(e,n){var i=m(t.useFluidValue(e,l(l({},d.EASE),n)),2),r=i[0],o=i[1],s={value:r,currentValue:r.get()};return new Proxy(s,{set:function(t,e,n){if("value"===e)return"number"==typeof n?queueMicrotask((function(){return o({toValue:n})})):"function"==typeof n&&queueMicrotask((function(){return o(n)})),!0;throw new Error("You cannot set any other property to animation node.")},get:function(t,e){if("value"===e)return r;if("currentValue"===e)return r.get();throw new Error("You cannot access any other property from animation node.")}})}function b(t){return t?1:0}function g(t,e,n){return Math.min(Math.max(t,e),n)}function E(t,e,n){return 0===e||Math.abs(e)===1/0?function(t,e){return Math.pow(t,5*e)}(t,n):t*e*n/(e+n*t)}var w=function(t,e){return{toValue:t,config:e}};function M(t,e){var n=new Map;return e.forEach((function(e){var i=m(e,3),r=i[0],o=i[1],s=i[2],u=void 0!==s&&s;n.set(r,function(t,e,n,i){return void 0===i&&(i=!1),t.forEach((function(t){t.addEventListener(e,n,i)})),function(){t.forEach((function(t){t.removeEventListener(e,n,i)}))}}(t,r,o,u))})),function(t){var e,i;try{for(var r=v(n.entries()),o=r.next();!o.done;o=r.next()){var s=m(o.value,2),u=s[0],c=s[1];if(!t)return void c();-1!==t.indexOf(u)&&c()}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}}}var _=function(t,e){return{x:t,y:e}},I=function(){function t(){this.lastTimeStamp=Date.now(),this.isActive=!1,this.targetElements=[]}return t.prototype._initEvents=function(){},t.prototype._cancelEvents=function(){this._subscribe&&this._subscribe()},t.prototype.applyCallback=function(t){this.callback=t},t.prototype.applyGesture=function(t){var e=this,n=t.targetElement,i=t.targetElements,r=t.callback,o=t.config;return this.targetElement=n,this.targetElements=i.map((function(t){return t.current})),this.callback=r,this.config=o,this._initEvents(),function(){return e._subscribe&&e._subscribe()}},t._VELOCITY_LIMIT=20,t}(),T=function(t){function e(){var e=t.apply(this,p([],m(arguments),!1))||this;return e.movementStart=_(0,0),e.initialMovement=_(0,0),e.movement=_(0,0),e.previousMovement=_(0,0),e.translation=_(0,0),e.offset=_(0,0),e.velocity=_(0,0),e}return a(e,t),e.prototype._initEvents=function(){(this.targetElement||this.targetElements.length>0)&&(this._subscribe=M([window],[["mousedown",this.pointerDown.bind(this)],["mousemove",this.pointerMove.bind(this)],["mouseup",this.pointerUp.bind(this)],["touchstart",this.pointerDown.bind(this),{passive:!1}],["touchmove",this.pointerMove.bind(this),{passive:!1}],["touchend",this.pointerUp.bind(this)]]))},e.prototype._cancelEvents=function(){this._subscribe&&this._subscribe(["mousedown","mousemove","touchstart","touchmove"])},e.prototype._handleCallback=function(){var t=this;this.callback&&this.callback({args:[this.currentIndex],down:this.isActive,movementX:this.movement.x,movementY:this.movement.y,offsetX:this.translation.x,offsetY:this.translation.y,velocityX:this.velocity.x,velocityY:this.velocity.y,distanceX:Math.abs(this.movement.x),distanceY:Math.abs(this.movement.y),directionX:Math.sign(this.movement.x),directionY:Math.sign(this.movement.y),cancel:function(){t._cancelEvents()}})},e.prototype.pointerDown=function(t){var e;"touchstart"===t.type?this.movementStart={x:t.touches[0].clientX,y:t.touches[0].clientY}:this.movementStart={x:t.clientX,y:t.clientY},this.movement={x:0,y:0},this.offset={x:this.translation.x,y:this.translation.y},this.previousMovement={x:0,y:0},this.velocity={x:0,y:0};var n=this.targetElements.find((function(e){return e===t.target}));if(t.target===this.targetElement||n){this.isActive=!0,t.preventDefault(),n&&(this.currentIndex=this.targetElements.indexOf(n));var i=(null===(e=this.config)||void 0===e?void 0:e.initial)&&this.config.initial(),r=null==i?void 0:i.movementX,o=null==i?void 0:i.movementY;this.initialMovement={x:null!=r?r:0,y:null!=o?o:0},this.movement={x:this.initialMovement.x,y:this.initialMovement.y},this.previousMovement={x:this.initialMovement.x,y:this.initialMovement.y},this._handleCallback()}},e.prototype.pointerMove=function(t){if(this.isActive){t.preventDefault();var e=Date.now(),n=g(e-this.lastTimeStamp,.1,64);this.lastTimeStamp=e;var i=n/1e3;"touchmove"===t.type?this.movement={x:this.initialMovement.x+(t.touches[0].clientX-this.movementStart.x),y:this.initialMovement.y+(t.touches[0].clientY-this.movementStart.y)}:this.movement={x:this.initialMovement.x+(t.clientX-this.movementStart.x),y:this.initialMovement.y+(t.clientY-this.movementStart.y)},this.translation={x:this.offset.x+this.movement.x,y:this.offset.y+this.movement.y},this.velocity={x:g((this.movement.x-this.previousMovement.x)/i/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT),y:g((this.movement.y-this.previousMovement.y)/i/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()}},e.prototype.pointerUp=function(){this.isActive&&(this.isActive=!1,this._handleCallback(),this._cancelEvents(),this._initEvents())},e}(I),O=function(t){function e(){var e=t.apply(this,p([],m(arguments),!1))||this;return e.movement=_(0,0),e.previousMovement=_(0,0),e.velocity=_(0,0),e.direction=_(0,0),e}return a(e,t),e.prototype._initEvents=function(){this.targetElement?this._subscribe=M([this.targetElement],[["mousemove",this.onMouseMove.bind(this)]]):this.targetElements.length>0?this._subscribe=M(this.targetElements,[["mousemove",this.onMouseMove.bind(this)]]):this._subscribe=M([window],[["mousemove",this.onMouseMove.bind(this)]])},e.prototype._handleCallback=function(){var t;this.callback&&this.callback({args:[this.currentIndex],event:this.event,isMoving:this.isActive,target:null===(t=this.event)||void 0===t?void 0:t.target,mouseX:this.movement.x,mouseY:this.movement.y,velocityX:this.velocity.x,velocityY:this.velocity.y,directionX:this.direction.x,directionY:this.direction.y})},e.prototype.onMouseMove=function(t){var e=this,n=this.targetElements.find((function(e){return e===t.target}));n&&(this.currentIndex=this.targetElements.indexOf(n)),this.event=t;var i=Date.now(),r=Math.min(i-this.lastTimeStamp,64);this.lastTimeStamp=i;var o=r/1e3,s=t.clientX,u=t.clientY;this.movement={x:s,y:u},-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){e.isActive=!1,e.direction={x:0,y:0},e.velocity={x:0,y:0},e._handleCallback()}),250);var c=this.movement.x-this.previousMovement.x,a=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(c),y:Math.sign(a)},this.velocity={x:g(c/o/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT),y:g(a/o/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},e}(I),L=function(t){function e(){var e=t.apply(this,p([],m(arguments),!1))||this;return e.movement=_(0,0),e.previousMovement=_(0,0),e.direction=_(0,0),e.velocity=_(0,0),e}return a(e,t),e.prototype._initEvents=function(){this.targetElement?this._subscribe=M([this.targetElement],[["scroll",this.scrollElementListener.bind(this)]]):this._subscribe=M([window],[["scroll",this.scrollListener.bind(this)]])},e.prototype._handleCallback=function(){this.callback&&this.callback({isScrolling:this.isActive,scrollX:this.movement.x,scrollY:this.movement.y,velocityX:this.velocity.x,velocityY:this.velocity.y,directionX:this.direction.x,directionY:this.direction.y})},e.prototype.onScroll=function(t){var e=this,n=t.x,i=t.y,r=Date.now(),o=Math.min(r-this.lastTimeStamp,64);this.lastTimeStamp=r;var s=o/1e3;this.movement={x:n,y:i},-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){e.isActive=!1,e.direction={x:0,y:0},e.velocity={x:0,y:0},e._handleCallback()}),250);var u=this.movement.x-this.previousMovement.x,c=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(u),y:Math.sign(c)},this.velocity={x:g(u/s/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT),y:g(c/s/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},e.prototype.scrollListener=function(){var t=window.pageYOffset,e=window.pageXOffset;this.onScroll({x:e,y:t})},e.prototype.scrollElementListener=function(){var t,e,n=(null===(t=this.targetElement)||void 0===t?void 0:t.scrollLeft)||0,i=(null===(e=this.targetElement)||void 0===e?void 0:e.scrollTop)||0;this.onScroll({x:n,y:i})},e}(I),Y=function(t){function e(){var e=t.apply(this,p([],m(arguments),!1))||this;return e.movement=_(0,0),e.previousMovement=_(0,0),e.direction=_(0,0),e.velocity=_(0,0),e.delta=_(0,0),e.offset=_(0,0),e.translation=_(0,0),e}return a(e,t),e.prototype._initEvents=function(){this.targetElement&&(this._subscribe=M([this.targetElement],[["wheel",this.onWheel.bind(this)]]))},e.prototype._handleCallback=function(){this.callback&&this.callback({target:this.targetElement,isWheeling:this.isActive,deltaX:this.delta.x,deltaY:this.delta.y,directionX:this.direction.x,directionY:this.direction.y,movementX:this.movement.x,movementY:this.movement.y,offsetX:this.offset.x,offsetY:this.offset.y,velocityX:this.velocity.x,velocityY:this.velocity.y})},e.prototype.onWheel=function(t){var e=this,n=t.deltaX,i=t.deltaY,r=t.deltaMode,o=Date.now(),s=Math.min(o-this.lastTimeStamp,64);this.lastTimeStamp=o;var u=s/1e3;this.isActive=!0,-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){e.isActive=!1,e.translation={x:e.offset.x,y:e.offset.y},e._handleCallback(),e.velocity={x:0,y:0},e.movement={x:0,y:0}}),200),1===r?(n*=40,i*=40):2===r&&(n*=800,i*=800),this.delta={x:n,y:i},this.movement={x:this.movement.x+n,y:this.movement.y+i},this.offset={x:this.translation.x+this.movement.x,y:this.translation.y+this.movement.y};var c=this.movement.x-this.previousMovement.x,a=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(c),y:Math.sign(a)},this.velocity={x:g(c/u/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT),y:g(a/u/1e3,-1*I._VELOCITY_LIMIT,I._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},e}(I),k=function(t){var e=r.useRef(),n=r.useRef([]),i=r.useRef(new Map).current;return r.useEffect((function(){var e,n;try{for(var r=v(i.entries()),o=r.next();!o.done;o=r.next()){var s=m(o.value,2)[1],u=s.keyIndex,c=s.gesture,a=m(t[u],3)[2];c.applyCallback(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}}),[t]),r.useEffect((function(){return t.forEach((function(t,r){var o=m(t,4),s=o[0],u=o[1],c=o[2],a=o[3];queueMicrotask((function(){return i.set(s,{keyIndex:r,gesture:u,unsubscribe:u.applyGesture({targetElement:e.current,targetElements:n.current,callback:c,config:a})})}))})),function(){var t,e;try{for(var n=v(i.entries()),r=n.next();!r.done;r=n.next()){var o=m(r.value,2)[1].unsubscribe;o&&o()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}}})),function(t){return null==t?{ref:e}:(n.current[t]=n.current[t]||r.createRef(),{ref:n.current[t]})}};Object.defineProperty(exports,"Easing",{enumerable:!0,get:function(){return t.Easing}}),Object.defineProperty(exports,"animate",{enumerable:!0,get:function(){return t.fluid}}),Object.defineProperty(exports,"makeAnimated",{enumerable:!0,get:function(){return t.makeFluid}}),exports.AnimationConfigUtils=d,exports.MountedBlock=function(t){var n=t.state,i=t.children,r=t.from,o=void 0===r?0:r,s=t.enter,c=void 0===s?1:s,a=t.exit,l=u(n,{from:o,enter:c,exit:void 0===a?0:a,config:t.config});return e.jsx(e.Fragment,{children:l((function(t,e){return e&&i({value:t.value})}))})},exports.ScrollableBlock=function(t){var n=t.children,i=t.direction,o=void 0===i?"single":i,s=t.animationConfig,u=t.threshold,c=void 0===u?.2:u,a=r.useRef(null),l=x(0,s);return r.useEffect((function(){var t=a.current,e=new IntersectionObserver((function(t){m(t,1)[0].isIntersecting?l.value=1:"both"===o&&(l.value=0)}),{root:null,threshold:c});return t&&e.observe(t),function(){t&&e.unobserve(t)}}),[]),e.jsx("div",{ref:a,children:n&&n({value:l.value})})},exports.TransitionBlock=function(t){var n=t.state,i=t.children,r=t.config,o=x(b(n),r);return e.jsx(e.Fragment,{children:i({value:o.value})})},exports.bInterpolate=function(e,n,i,r){var o=s(e);return t.interpolate(o,[0,1],[n,i],r)},exports.bin=b,exports.clamp=g,exports.delay=function(t){return new Promise((function(e){setTimeout((function(){return e(null)}),t)}))},exports.interpolate=function(e,n,i,r){var o=s(e);return t.interpolate(o,n,i,r)},exports.mix=function(t,e,n){return e*(1-t)+n*t},exports.move=function(t,e,n){var i=t[e],r=t.length,o=e-n;if(o>0)return p(p(p(p([],m(t.slice(0,n)),!1),[i],!1),m(t.slice(n,e)),!1),m(t.slice(e+1,r)),!1);if(o<0){var s=n+1;return p(p(p(p([],m(t.slice(0,e)),!1),m(t.slice(e+1,s)),!1),[i],!1),m(t.slice(s,r)),!1)}return t},exports.rubberClamp=function(t,e,n,i){return void 0===i&&(i=.15),0===i?g(t,e,n):t<e?-E(e-t,n-e,i)+e:t>n?+E(t-n,n-e,i)+n:t},exports.snapTo=function(t,e,n){var i=t+.2*e,r=function(t){return Math.abs(t-i)},o=n.map(r),s=Math.min.apply(Math,p([],m(o),!1));return n.reduce((function(t,e){return r(e)===s?e:t}))},exports.useAnimatedValue=x,exports.useDrag=function(t,e){var n=r.useRef(new T).current;return k([["drag",n,t,e]])},exports.useGesture=function(t){var e=t.onDrag,n=t.onWheel,i=t.onScroll,o=t.onMouseMove,s=r.useRef(new T).current,u=r.useRef(new Y).current,c=r.useRef(new L).current,a=r.useRef(new O).current;return k([["drag",s,e],["wheel",u,n],["scroll",c,i],["move",a,o]])},exports.useMeasure=function(t,e){var i=n.useRef(null),r=n.useRef([]),o=n.useRef(t);return n.useEffect((function(){return o.current=t,function(){o.current=function(){return!1}}}),e),n.useEffect((function(){var t=i.current||document.documentElement,e=r.current,n=new ResizeObserver((function(e){var n=m(e,1)[0].target.getBoundingClientRect(),i=n.left,r=n.top,s=n.width,u=n.height,c=window.pageXOffset,a=window.pageYOffset;if(o){if(t===document.documentElement)return;o.current({left:i+c,top:r+a,width:s,height:u,vLeft:i,vTop:r})}})),s=new ResizeObserver((function(t){var e=[],n=[],i=[],r=[],s=[],u=[];t.forEach((function(t){var o=t.target.getBoundingClientRect(),c=o.left,a=o.top,l=o.width,h=o.height,f=c+window.pageXOffset,v=a+window.pageYOffset;e.push(f),n.push(v),i.push(l),r.push(h),s.push(c),u.push(a)})),o&&o.current({left:e,top:n,width:i,height:r,vLeft:s,vTop:u})}));return t&&(t===document.documentElement&&e.length>0?e.forEach((function(t){s.observe(t.current)})):n.observe(t)),function(){t&&(t===document.documentElement&&e.length>0?e.forEach((function(t){s.unobserve(t.current)})):n.unobserve(t))}}),[]),function(t){return null==t?{ref:i}:(r.current[t]=r.current[t]||n.createRef(),{ref:r.current[t]})}},exports.useMountedValue=u,exports.useMouseMove=function(t){var e=r.useRef(new O).current;return k([["move",e,t]])},exports.useOutsideClick=function(t,e,i){var r=n.useRef();r.current||(r.current=e),n.useEffect((function(){return r.current=e,function(){r.current=function(){return!1}}}),i),n.useEffect((function(){var e=M([document],[["click",function(e){var n;(null===(n=null==t?void 0:t.current)||void 0===n?void 0:n.contains(e.target))||r.current&&r.current(e)}]]);return function(){return e&&e()}}),[])},exports.useScroll=function(t){var e=r.useRef(new L).current;return k([["scroll",e,t]])},exports.useWheel=function(t){var e=r.useRef(new Y).current;return k([["wheel",e,t]])},exports.useWindowDimension=function(t,e){var i=n.useRef({width:0,height:0,innerWidth:0,innerHeight:0}),r=n.useRef(t);n.useEffect((function(){return r.current=t,function(){r.current=function(){return!1}}}),e),n.useEffect((function(){var t=new ResizeObserver((function(t){var e=m(t,1)[0].target,n=e.clientWidth,o=e.clientHeight,s=window.innerWidth,u=window.innerHeight;i.current={width:n,height:o,innerWidth:s,innerHeight:u},r&&r.current(l({},i.current))}));return t.observe(document.documentElement),function(){return t.unobserve(document.documentElement)}}),[])},exports.withConfig=w,exports.withDecay=function(t){return{config:t}},exports.withDelay=function(t,e){return l(l({},e),{config:l(l({},e.config),{delay:t})})},exports.withEase=function(t,e){return void 0===e&&(e=d.EASE),w(t,e)},exports.withSequence=function(t){return function(e){return h(void 0,void 0,void 0,(function(){var n,i,r,o,s,u;return f(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,7]),n=v(t),i=n.next(),c.label=1;case 1:return i.done?[3,4]:(r=i.value,[4,e("number"==typeof r?{toValue:r}:r)]);case 2:c.sent(),c.label=3;case 3:return i=n.next(),[3,1];case 4:return[3,7];case 5:return o=c.sent(),s={error:o},[3,7];case 6:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}))}},exports.withSpring=function(t,e){return void 0===e&&(e=d.ELASTIC),w(t,e)},exports.withTiming=function(t,e){return void 0===e&&(e={duration:250}),w(t,e)};
2
2
  //# sourceMappingURL=index.js.map