motion 10.11.1 → 10.13.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  Motion One adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [10.13.0] [2022-07-10]
6
+
7
+ ### Added
8
+
9
+ - `animate` and `timeline` now support custom easing functions.
10
+
11
+ ### Removed
12
+
13
+ - `motion/react` entry point.
14
+
15
+ ## [10.12.0] [2022-07-10]
16
+
17
+ ### Added
18
+
19
+ - `scroll` function for tracking scroll events and powering scroll-driven animations.
20
+
21
+ ### Fixed
22
+
23
+ - Fixing `play` -> `cancel` behaviour in Safari. [Issue (sponsors only)](https://github.com/motiondivision/motionone/issues/102)
24
+
25
+ ## [10.11.2] [2022-07-06]
26
+
27
+ ### Removed
28
+
29
+ - Removing default `root` in `inView` as this [silently fails in iOS Safari 14-15](https://bugs.webkit.org/show_bug.cgi?id=224324).
30
+
5
31
  ## [10.11.1] [2022-07-06]
6
32
 
7
33
  ### Added
@@ -3,20 +3,21 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var dom = require('@motionone/dom');
6
+ var utils = require('@motionone/utils');
6
7
  var animation = require('@motionone/animation');
7
8
 
8
- function animateProgress(target, options) {
9
- return dom.wrapAnimationWithControls([
9
+ function animateProgress(target, options = {}) {
10
+ return dom.withControls([
10
11
  () => {
11
12
  const animation$1 = new animation.Animation(target, [0, 1], options);
12
13
  animation$1.finished.catch(() => { });
13
14
  return animation$1;
14
15
  },
15
- ], options === null || options === void 0 ? void 0 : options.duration);
16
+ ], options, options.duration);
16
17
  }
17
18
  function animate(target, keyframesOrOptions, options) {
18
- const animationFunction = typeof target === "function" ? animateProgress : dom.animate;
19
- return animationFunction(target, keyframesOrOptions, options);
19
+ const factory = utils.isFunction(target) ? animateProgress : dom.animate;
20
+ return factory(target, keyframesOrOptions, options);
20
21
  }
21
22
 
22
23
  exports.animate = animate;
@@ -1,18 +1,19 @@
1
- import { animate as animate$1, wrapAnimationWithControls } from '@motionone/dom';
1
+ import { animate as animate$1, withControls } from '@motionone/dom';
2
+ import { isFunction } from '@motionone/utils';
2
3
  import { Animation } from '@motionone/animation';
3
4
 
4
- function animateProgress(target, options) {
5
- return wrapAnimationWithControls([
5
+ function animateProgress(target, options = {}) {
6
+ return withControls([
6
7
  () => {
7
8
  const animation = new Animation(target, [0, 1], options);
8
9
  animation.finished.catch(() => { });
9
10
  return animation;
10
11
  },
11
- ], options === null || options === void 0 ? void 0 : options.duration);
12
+ ], options, options.duration);
12
13
  }
13
14
  function animate(target, keyframesOrOptions, options) {
14
- const animationFunction = typeof target === "function" ? animateProgress : animate$1;
15
- return animationFunction(target, keyframesOrOptions, options);
15
+ const factory = isFunction(target) ? animateProgress : animate$1;
16
+ return factory(target, keyframesOrOptions, options);
16
17
  }
17
18
 
18
19
  export { animate, animateProgress };
package/dist/main.cjs.js CHANGED
@@ -3,36 +3,18 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var dom = require('@motionone/dom');
6
- var animate = require('./animate.cjs.js');
7
6
  var types = require('@motionone/types');
7
+ var animate = require('./animate.cjs.js');
8
8
 
9
9
 
10
10
 
11
- Object.defineProperty(exports, 'glide', {
12
- enumerable: true,
13
- get: function () { return dom.glide; }
14
- });
15
- Object.defineProperty(exports, 'inView', {
16
- enumerable: true,
17
- get: function () { return dom.inView; }
18
- });
19
- Object.defineProperty(exports, 'spring', {
20
- enumerable: true,
21
- get: function () { return dom.spring; }
22
- });
23
- Object.defineProperty(exports, 'stagger', {
24
- enumerable: true,
25
- get: function () { return dom.stagger; }
26
- });
27
- Object.defineProperty(exports, 'style', {
28
- enumerable: true,
29
- get: function () { return dom.style; }
30
- });
31
- Object.defineProperty(exports, 'timeline', {
32
- enumerable: true,
33
- get: function () { return dom.timeline; }
34
- });
35
11
  exports.animate = animate.animate;
12
+ Object.keys(dom).forEach(function (k) {
13
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
14
+ enumerable: true,
15
+ get: function () { return dom[k]; }
16
+ });
17
+ });
36
18
  Object.keys(types).forEach(function (k) {
37
19
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
38
20
  enumerable: true,
package/dist/main.es.js CHANGED
@@ -1,3 +1,3 @@
1
- export { glide, inView, spring, stagger, style, timeline } from '@motionone/dom';
2
- export { animate } from './animate.es.js';
1
+ export * from '@motionone/dom';
3
2
  export * from '@motionone/types';
3
+ export { animate } from './animate.es.js';
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,(function(t){"use strict";class e{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const n=new WeakMap;function a(t){return n.has(t)||n.set(t,{transforms:[],values:new Map}),n.get(t)}function i(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const r={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},s=t=>"number"==typeof t,o=t=>"string"==typeof t,c=t=>"object"==typeof t&&Boolean(t.createAnimation),l=t=>Array.isArray(t)&&!s(t[0]),u=(t,e,n)=>-n*t+n*e+t,f=()=>{},h=t=>t,d=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function p(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const i=d(0,e,a);t.push(u(n,1,i))}}function m(t){const e=[0];return p(e,t-1),e}const g=t=>1e3*t,y=t=>t/1e3;const v=["","X","Y","Z"],b={x:"translateX",y:"translateY",z:"translateZ"},M={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},w={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:M,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:h},skew:M},O=new Map,T=t=>`--motion-${t}`,S=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{v.forEach((e=>{S.push(t+e),O.set(T(t+e),w[t])}))}));const x=(t,e)=>S.indexOf(t)-S.indexOf(e),A=new Set(S),k=t=>A.has(t),j=t=>t.sort(x).reduce(D,"").trim(),D=(t,e)=>`${t} ${e}(var(${T(e)}))`,R=t=>t.startsWith("--"),P=new Set;const E=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function $(t,e,n,a){if(t===e&&n===a)return h;const i=e=>function(t,e,n,a,i){let r,s,o=0;do{s=e+(n-e)/2,r=E(s,a,i)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:E(i(t),e,a)}const V=(t,e="end")=>n=>{const a=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,i="end"===e?Math.floor(a):Math.ceil(a);return r=0,s=1,o=i/t,Math.min(Math.max(o,r),s);var r,s,o},q={ease:$(.25,.1,.25,1),"ease-in":$(.42,0,1,1),"ease-in-out":$(.42,0,.58,1),"ease-out":$(0,0,.58,1)},I=/\((.*?)\)/;function F(t){if("function"==typeof t)return t;if(Array.isArray(t))return $(...t);if(q[t])return q[t];if(t.startsWith("steps")){const e=I.exec(t);if(e){const t=e[1].split(",");return V(parseFloat(t[0]),t[1].trim())}}return h}function W(t,e){return l(t)?t[((t,e,n)=>{const a=e-t;return((n-t)%a+a)%a+t})(0,t.length,e)]:t}function _(t,e=m(t.length),n=h){const a=t.length,i=a-e.length;return i>0&&p(e,i),i=>{let r=0;for(;r<a-2&&!(i<e[r+1]);r++);let s=(o=d(e[r],e[r+1],i),Math.min(1,Math.max(o,0)));var o;return s=W(n,r)(s),u(t[r],t[r+1],s)}}class U{constructor(t,e=[0,1],{easing:n=r.easing,duration:a=r.duration,delay:i=r.delay,endDelay:s=r.endDelay,repeat:o=r.repeat,offset:u,direction:f="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),c(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(a=t.duration)}const d=l(n)?h:F(n),p=a*(o+1),m=_(e,u,l(n)?n.map(F):h);this.tick=e=>{var n;this.pauseTime&&(e=this.pauseTime);let r=(e-this.startTime)*this.rate;this.t=r,r/=1e3,r=Math.max(r-i,0),"finished"===this.playState&&(r=p);const o=r/a;let c=Math.floor(o),l=o%1;!l&&o>=1&&(l=1),1===l&&c--;const u=c%2;("reverse"===f||"alternate"===f&&u||"alternate-reverse"===f&&!u)&&(l=1-l);const h=r>=p?1:Math.min(l,1),g=m(d(h));t(g);"finished"===this.playState||r>=p+s?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,g)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){var t;const e=performance.now();this.playState="running",this.pauseTime?this.startTime=e-(this.pauseTime-(null!==(t=this.startTime)&&void 0!==t?t:0)):this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const B=t=>(t=>Array.isArray(t)&&s(t[0]))(t)?C(t):t,C=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,z=t=>document.createElement("div").animate(t,{duration:.001}),K={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{z({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(z({opacity:[0,1]}).finished)},X={},Y={};for(const t in K)Y[t]=()=>(void 0===X[t]&&(X[t]=K[t]()),X[t]);const Z=t=>Array.isArray(t)?t:[t];function L(t){return b[t]&&(t=b[t]),k(t)?T(t):t}const N={get:(t,e)=>{e=L(e);let n=R(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=O.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=L(e),R(e)?t.style.setProperty(e,n):t.style[e]=n}};function G(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function H(t,n,i,o={}){const u=window.__MOTION_DEV_TOOLS_RECORD,h=!1!==o.record&&u;let d,{duration:p=r.duration,delay:m=r.delay,endDelay:y=r.endDelay,repeat:v=r.repeat,easing:M=r.easing,direction:w,offset:T,allowWebkitAcceleration:S=!1}=o;const x=a(t);let A=Y.waapi();const D=k(n);D&&((t,e)=>{b[e]&&(e=b[e]);const{transforms:n}=a(t);var i,r;r=e,-1===(i=n).indexOf(r)&&i.push(r),t.style.transform=j(n)})(t,n);const E=L(n),$=function(t,n){return t.has(n)||t.set(n,new e),t.get(n)}(x.values,E),V=O.get(E);return G($.animation,!(c(M)&&$.generator)&&!1!==o.record),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=N.get(t,E))&&void 0!==e?e:null==V?void 0:V.initialValue)&&void 0!==n?n:0};let a=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(Z(i),e);if(c(M)){const t=M.createAnimation(a,e,D,E,$);M=t.easing,void 0!==t.keyframes&&(a=t.keyframes),void 0!==t.duration&&(p=t.duration)}if(R(E)&&(Y.cssRegisterProperty()?function(t){if(!P.has(t)){P.add(t);try{const{syntax:e,initialValue:n}=O.has(t)?O.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(E):A=!1),A){V&&(a=a.map((t=>s(t)?V.toDefaultUnit(t):t))),1!==a.length||Y.partialKeyframes()&&!h||a.unshift(e());const n={delay:g(m),duration:g(p),endDelay:g(y),easing:l(M)?void 0:B(M),direction:w,iterations:v+1,fill:"both"};d=t.animate({[E]:a,offset:T,easing:l(M)?M.map(B):void 0},n),d.finished||(d.finished=new Promise(((t,e)=>{d.onfinish=t,d.oncancel=e})));const i=a[a.length-1];d.finished.then((()=>{N.set(t,E,i),d.cancel()})).catch(f),S||(d.playbackRate=1.000001)}else if(D){a=a.map((t=>"string"==typeof t?parseFloat(t):t)),1===a.length&&a.unshift(parseFloat(e()));d=new U((e=>{V&&(e=V.toDefaultUnit(e)),N.set(t,E,e)}),a,Object.assign(Object.assign({},o),{duration:p,easing:M}))}else{const e=a[a.length-1];N.set(t,E,V&&s(e)?V.toDefaultUnit(e):e)}return h&&u(t,n,a,{duration:p,delay:m,easing:M,repeat:v,offset:T},"motion-one"),$.setAnimation(d),d}}const J=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function Q(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const tt=t=>t(),et=(t,e=r.duration)=>new Proxy({animations:t.map(tt).filter(Boolean),duration:e},nt),nt={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":let a=(null==n?void 0:n[e])||0;return a?a/1e3:0;case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(at)).catch(f)),t.finished;case"stop":return()=>t.animations.forEach((t=>G(t)));default:return void 0===(null==n?void 0:n[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=g(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},at=t=>t.finished;function it(t,e,n){return"function"==typeof t?t(e,n):t}function rt(t,e,n={}){const a=(t=Q(t)).length,i=[];for(let r=0;r<a;r++){const s=t[r];for(const t in e){const o=J(n,t);o.delay=it(o.delay,r,a);const c=H(s,t,e[t],o);i.push(c)}}return et(i,n.duration)}function st(t,e,n,a){var i;return s(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(i=a.get(e))&&void 0!==i?i:t}function ot(t,e,n,a,r,s){!function(t,e,n){for(let a=0;a<t.length;a++){const r=t[a];r.at>e&&r.at<n&&(i(t,r),a--)}}(t,r,s);for(let i=0;i<e.length;i++)t.push({value:e[i],at:u(r,s,a[i]),easing:W(n,i)})}function ct(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function lt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ut(t,e){return e[t]||(e[t]=[]),e[t]}function ft(t,e,n){const a=Math.max(e-5,0);return i=n-t(a),(r=e-a)?i*(1e3/r):0;var i,r}const ht=100,dt=10,pt=1;const mt=({stiffness:t=ht,damping:e=dt,mass:n=pt,from:a=0,to:i=1,velocity:r=0,restSpeed:s=2,restDistance:o=.5}={})=>{r=r?y(r):0;const c={done:!1,hasReachedTarget:!1,current:a,target:i},l=i-a,u=Math.sqrt(t/n)/1e3,f=((t=ht,e=dt,n=pt)=>e/(2*Math.sqrt(t*n)))(t,e,n);let h;if(f<1){const t=u*Math.sqrt(1-f*f);h=e=>i-Math.exp(-f*u*e)*((f*u*l-r)/t*Math.sin(t*e)+l*Math.cos(t*e))}else h=t=>i-Math.exp(-u*t)*(l+(u*l-r)*t);return t=>{c.current=h(t);const e=0===t?r:ft(h,t,c.current),n=Math.abs(e)<=s,l=Math.abs(i-c.current)<=o;var u,f,d;return c.done=n&&l,c.hasReachedTarget=(u=a,f=i,d=c.current,u<f&&d>=f||u>f&&d<=f),c}};function gt(t){const e=new WeakMap;return(n={})=>{const a=new Map,i=(e=0,i=100,r=0,s=!1)=>{const o=`${e}-${i}-${r}-${s}`;return a.has(o)||a.set(o,t(Object.assign({from:e,to:i,velocity:r,restSpeed:s?.05:2,restDistance:s?.01:.5},n))),a.get(o)},r=t=>(e.has(t)||e.set(t,function(t){let e,n=10,a=t(0);const i=[a.current];for(;!a.done&&n<1e4;)a=t(n),i.push(a.done?a.target:a.current),void 0===e&&a.hasReachedTarget&&(e=n),n+=10;const r=n-10;return 1===i.length&&i.push(a.current),{keyframes:i,duration:r/1e3,overshootDuration:(null!=e?e:r)/1e3}}(t)),e.get(t));return{createAnimation:(t,e,n,a,s)=>{var o,c;let l;const u=t.length;if(n&&u<=2&&t.every(yt)){const n=t[u-1],f=1===u?null:t[0];let h=0,d=0;const p=null==s?void 0:s.generator;if(p){const{animation:e,generatorStartTime:n}=s,a=(null==e?void 0:e.startTime)||n||0,i=(null==e?void 0:e.currentTime)||performance.now()-a,r=p(i).current;d=null!==(o=f)&&void 0!==o?o:r,(1===u||2===u&&null===t[0])&&(h=ft((t=>p(t).current),i,r))}else d=null!==(c=f)&&void 0!==c?c:parseFloat(e());const m=i(d,n,h,null==a?void 0:a.includes("scale")),g=r(m);l=Object.assign(Object.assign({},g),{easing:"linear"}),s&&(s.generator=m,s.generatorStartTime=performance.now())}else{l={easing:"ease",duration:r(i(0,100)).overshootDuration}}return l}}}}const yt=t=>"string"!=typeof t,vt=gt(mt),bt=gt((({from:t=0,velocity:e=0,power:n=.8,decay:a=.325,bounceDamping:i,bounceStiffness:r,changeTarget:s,min:o,max:c,restDistance:l=.5,restSpeed:u})=>{a=g(a);const f={hasReachedTarget:!1,done:!1,current:t,target:t},h=t=>void 0===o?c:void 0===c||Math.abs(o-t)<Math.abs(c-t)?o:c;let d=n*e;const p=t+d,m=void 0===s?p:s(p);f.target=m,m!==p&&(d=m-t);const y=t=>-d*Math.exp(-t/a),v=t=>m+y(t),b=t=>{const e=y(t),n=v(t);f.done=Math.abs(e)<=l,f.current=f.done?m:n};let M,w;const O=t=>{var e;(e=f.current,void 0!==o&&e<o||void 0!==c&&e>c)&&(M=t,w=mt({from:f.current,to:h(f.current),velocity:ft(v,t,f.current),damping:i,stiffness:r,restDistance:l,restSpeed:u}))};return O(0),t=>{let e=!1;return w||void 0!==M||(e=!0,b(t),O(t)),void 0!==M&&t>M?(f.hasReachedTarget=!0,w(t-M)):(f.hasReachedTarget=!1,!e&&b(t),f)}}));let Mt;function wt(){if(void 0===Mt)try{new IntersectionObserver(f,{root:document}),Mt=!0}catch(t){Mt=!1}return Mt?document:void 0}const Ot={any:0,all:1};function Tt(t,e){return et([()=>{const n=new U(t,[0,1],e);return n.finished.catch((()=>{})),n}],null==e?void 0:e.duration)}t.MotionValue=e,t.animate=function(t,e,n){return("function"==typeof t?Tt:rt)(t,e,n)},t.glide=bt,t.inView=function(t,e,{root:n,margin:a,amount:i="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const r=Q(t),s=new WeakMap,o=new IntersectionObserver((t=>{t.forEach((t=>{const n=s.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);"function"==typeof n?s.set(t.target,n):o.unobserve(t.target)}else n&&(n(t),s.delete(t.target))}))}),{root:n||wt(),rootMargin:a,threshold:"number"==typeof i?i:Ot[i]});return r.forEach((t=>o.observe(t))),()=>o.disconnect()},t.spring=vt,t.stagger=function(t=.1,{start:e=0,from:n=0,easing:a}={}){return(i,r)=>{const o=s(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,r),c=Math.abs(o-i);let l=t*c;if(a){const e=r*t;l=F(a)(l/e)*e}return e+l}},t.style=N,t.timeline=function(t,e={}){var n;const a=function(t,e={}){var{defaultOptions:n={}}=e,a=function(t,e){var n={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(n[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(t);i<a.length;i++)e.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(t,a[i])&&(n[a[i]]=t[a[i]])}return n}(e,["defaultOptions"]);const i=[],s=new Map,l={},u=new Map;let f=0,h=0,g=0;for(let e=0;e<t.length;e++){const a=t[e];if(o(a)){u.set(a,h);continue}if(!Array.isArray(a)){u.set(a.name,st(h,a.at,f,u));continue}const[i,d,y={}]=a;void 0!==y.at&&(h=st(h,y.at,f,u));let v=0;const b=Q(i,l),M=b.length;for(let t=0;t<M;t++){const e=lt(b[t],s);for(const a in d){const i=ut(a,e);let s=Z(d[a]);const o=J(y,a);let{duration:l=n.duration||r.duration,easing:u=n.easing||r.easing}=o;if(c(u)){const t=k(a);s.length;const e=u.createAnimation(s,(()=>"0"),t);u=e.easing,void 0!==e.keyframes&&(s=e.keyframes),void 0!==e.duration&&(l=e.duration)}const f=it(y.delay,t,M)||0,b=h+f,w=b+l;let{offset:O=m(s.length)}=o;1===O.length&&0===O[0]&&(O[1]=1);const T=length-s.length;T>0&&p(O,T),1===s.length&&s.unshift(null),ot(i,s,u,O,b,w),v=Math.max(f+l,v),g=Math.max(w,g)}}f=h,h+=v}return s.forEach(((t,e)=>{for(const s in t){const o=t[s];o.sort(ct);const c=[],l=[],u=[];for(let t=0;t<o.length;t++){const{at:e,value:n,easing:a}=o[t];c.push(n),l.push(d(0,g,e)),u.push(a||r.easing)}0!==l[0]&&(l.unshift(0),c.unshift(c[0]),u.unshift("linear")),1!==l[l.length-1]&&(l.push(1),c.push(null)),i.push([e,s,c,Object.assign(Object.assign(Object.assign({},n),{duration:g,easing:u,offset:l}),a)])}})),i}(t,e),i=a.map((t=>H(...t))).filter(Boolean);return et(i,null===(n=a[0])||void 0===n?void 0:n[3].duration)},Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,(function(t){"use strict";class e{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const n=new WeakMap;function i(t){return n.has(t)||n.set(t,{transforms:[],values:new Map}),n.get(t)}function r(t,e){-1===t.indexOf(e)&&t.push(e)}function o(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const s=(t,e,n)=>Math.min(Math.max(n,t),e),a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},c=t=>"number"==typeof t,l=t=>Array.isArray(t)&&!c(t[0]);function u(t,e){return l(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}const f=(t,e,n)=>-n*t+n*e+t,h=()=>{},d=t=>t,g=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function p(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=g(0,e,i);t.push(f(n,1,r))}}function m(t){const e=[0];return p(e,t-1),e}function y(t,e=m(t.length),n=d){const i=t.length,r=i-e.length;return r>0&&p(e,r),r=>{let o=0;for(;o<i-2&&!(r<e[o+1]);o++);let a=s(0,1,g(e[o],e[o+1],r));return a=u(n,o)(a),f(t[o],t[o+1],a)}}const v=t=>"object"==typeof t&&Boolean(t.createAnimation),w=t=>"function"==typeof t,b=t=>"string"==typeof t,E=t=>1e3*t,x=t=>t/1e3;function O(t,e){return e?t*(1e3/e):0}const S=["","X","Y","Z"],M={x:"translateX",y:"translateY",z:"translateZ"},T={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},A={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:T,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:d},skew:T},D=new Map,L=t=>`--motion-${t}`,k=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{S.forEach((e=>{k.push(t+e),D.set(L(t+e),A[t])}))}));const W=(t,e)=>k.indexOf(t)-k.indexOf(e),j=new Set(k),R=t=>j.has(t),z=t=>t.sort(W).reduce(B,"").trim(),B=(t,e)=>`${t} ${e}(var(${L(e)}))`,P=t=>t.startsWith("--"),V=new Set;const $=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function q(t,e,n,i){if(t===e&&n===i)return d;const r=e=>function(t,e,n,i,r){let o,s,a=0;do{s=e+(n-e)/2,o=$(s,i,r)-t,o>0?n=s:e=s}while(Math.abs(o)>1e-7&&++a<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:$(r(t),e,i)}const C={ease:q(.25,.1,.25,1),"ease-in":q(.42,0,1,1),"ease-in-out":q(.42,0,.58,1),"ease-out":q(0,0,.58,1)},F=/\((.*?)\)/;function H(t){if(w(t))return t;if(Array.isArray(t))return q(...t);if(C[t])return C[t];if(t.startsWith("steps")){const e=F.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,r="end"===e?Math.floor(i):Math.ceil(i);return s(0,1,r/t)})(parseFloat(t[0]),t[1].trim())}}return d}class I{constructor(t,e=[0,1],{easing:n,duration:i=a.duration,delay:r=a.delay,endDelay:o=a.endDelay,repeat:s=a.repeat,offset:c,direction:u="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=d,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),n=n||a.easing,v(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(i=t.duration)}this.repeat=s,this.easing=l(n)?d:H(n),this.updateDuration(i);const f=y(e,c,l(n)?n.map(H):d);this.tick=e=>{var n;let i=0;i=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=i,i/=1e3,i=Math.max(i-r,0),"finished"===this.playState&&void 0===this.pauseTime&&(i=this.totalDuration);const s=i/this.duration;let a=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&a--;const l=a%2;("reverse"===u||"alternate"===u&&l||"alternate-reverse"===u&&!l)&&(c=1-c);const h=i>=this.totalDuration?1:Math.min(c,1),d=f(this.easing(h));t(d);void 0===this.pauseTime&&("finished"===this.playState||i>=this.totalDuration+o)?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const U=(t,e)=>document.createElement("div").animate(t,e),_={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{U({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(U({opacity:[0,1]},{duration:.001}).finished),linearEasing:()=>{try{U({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}},N={},G={};for(const t in _)G[t]=()=>(void 0===N[t]&&(N[t]=_[t]()),N[t]);const Z=(t,e)=>w(t)?G.linearEasing()?`linear(${((t,e)=>{let n="";const i=Math.round(e/.015);for(let e=0;e<i;e++)n+=t(g(0,i-1,e))+", ";return n.substring(0,n.length-2)})(t,e)})`:a.easing:(t=>Array.isArray(t)&&c(t[0]))(t)?K(t):t,K=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;const X=t=>Array.isArray(t)?t:[t];function Y(t){return M[t]&&(t=M[t]),R(t)?L(t):t}const J={get:(t,e)=>{e=Y(e);let n=P(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=D.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=Y(e),P(e)?t.style.setProperty(e,n):t.style[e]=n}};function Q(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function tt(t,n,o,s={}){const u=window.__MOTION_DEV_TOOLS_RECORD,f=!1!==s.record&&u;let d,{duration:g=a.duration,delay:p=a.delay,endDelay:m=a.endDelay,repeat:y=a.repeat,easing:b=a.easing,direction:x,offset:O,allowWebkitAcceleration:S=!1}=s;const T=i(t),A=R(n);let L=G.waapi();A&&((t,e)=>{M[e]&&(e=M[e]);const{transforms:n}=i(t);r(n,e),t.style.transform=z(n)})(t,n);const k=Y(n),W=function(t,n){return t.has(n)||t.set(n,new e),t.get(n)}(T.values,k),j=D.get(k);return Q(W.animation,!(v(b)&&W.generator)&&!1!==s.record),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=J.get(t,k))&&void 0!==e?e:null==j?void 0:j.initialValue)&&void 0!==n?n:0};let i=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(X(o),e);if(v(b)){const t=b.createAnimation(i,e,A,k,W);b=t.easing,void 0!==t.keyframes&&(i=t.keyframes),void 0!==t.duration&&(g=t.duration)}if(P(k)&&(G.cssRegisterProperty()?function(t){if(!V.has(t)){V.add(t);try{const{syntax:e,initialValue:n}=D.has(t)?D.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(k):L=!1),w(b)&&!G.linearEasing()&&A&&(L=!1),L){j&&(i=i.map((t=>c(t)?j.toDefaultUnit(t):t))),1!==i.length||G.partialKeyframes()&&!f||i.unshift(e());const n={delay:E(p),duration:E(g),endDelay:E(m),easing:l(b)?void 0:Z(b,g),direction:x,iterations:y+1,fill:"both"};d=t.animate({[k]:i,offset:O,easing:l(b)?b.map((t=>Z(t,g))):void 0},n),d.finished||(d.finished=new Promise(((t,e)=>{d.onfinish=t,d.oncancel=e})));const r=i[i.length-1];d.finished.then((()=>{J.set(t,k,r),d.cancel()})).catch(h),S||(d.playbackRate=1.000001)}else if(A){i=i.map((t=>"string"==typeof t?parseFloat(t):t)),1===i.length&&i.unshift(parseFloat(e()));d=new I((e=>{j&&(e=j.toDefaultUnit(e)),J.set(t,k,e)}),i,Object.assign(Object.assign({},s),{duration:g,easing:b}))}else{const e=i[i.length-1];J.set(t,k,j&&c(e)?j.toDefaultUnit(e):e)}return f&&u(t,n,i,{duration:g,delay:p,easing:b,repeat:y,offset:O},"motion-one"),W.setAnimation(d),d}}const et=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function nt(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const it=t=>t(),rt=(t,e,n=a.duration)=>new Proxy({animations:t.map(it).filter(Boolean),duration:n,options:e},ot),ot={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return x((null==n?void 0:n[e])||0);case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(st)).catch(h)),t.finished;case"stop":return()=>{t.animations.forEach((t=>Q(t)))};case"forEachNative":return e=>{t.animations.forEach((n=>e(n,t)))};default:return void 0===(null==n?void 0:n[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=E(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},st=t=>t.finished;function at(t,e,n){return w(t)?t(e,n):t}function ct(t,e,n={}){const i=(t=nt(t)).length,r=[];for(let o=0;o<i;o++){const s=t[o];for(const t in e){const a=et(n,t);a.delay=at(a.delay,o,i);const c=tt(s,t,e[t],a);r.push(c)}}return rt(r,n,n.duration)}function lt(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}function ut(t,e,n,i){var r;return c(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(r=i.get(e))&&void 0!==r?r:t}function ft(t,e,n,i,r,s){!function(t,e,n){for(let i=0;i<t.length;i++){const r=t[i];r.at>e&&r.at<n&&(o(t,r),i--)}}(t,r,s);for(let o=0;o<e.length;o++)t.push({value:e[o],at:f(r,s,i[o]),easing:u(n,o)})}function ht(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function dt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function gt(t,e){return e[t]||(e[t]=[]),e[t]}function pt(t,e,n){const i=Math.max(e-5,0);return O(n-t(i),e-i)}const mt=100,yt=10,vt=1;const wt=({stiffness:t=mt,damping:e=yt,mass:n=vt,from:i=0,to:r=1,velocity:o=0,restSpeed:s=2,restDistance:a=.5}={})=>{o=o?x(o):0;const c={done:!1,hasReachedTarget:!1,current:i,target:r},l=r-i,u=Math.sqrt(t/n)/1e3,f=((t=mt,e=yt,n=vt)=>e/(2*Math.sqrt(t*n)))(t,e,n);let h;if(f<1){const t=u*Math.sqrt(1-f*f);h=e=>r-Math.exp(-f*u*e)*((f*u*l-o)/t*Math.sin(t*e)+l*Math.cos(t*e))}else h=t=>r-Math.exp(-u*t)*(l+(u*l-o)*t);return t=>{c.current=h(t);const e=0===t?o:pt(h,t,c.current),n=Math.abs(e)<=s,l=Math.abs(r-c.current)<=a;var u,f,d;return c.done=n&&l,c.hasReachedTarget=(u=i,f=r,d=c.current,u<f&&d>=f||u>f&&d<=f),c}};function bt(t){const e=new WeakMap;return(n={})=>{const i=new Map,r=(e=0,r=100,o=0,s=!1)=>{const a=`${e}-${r}-${o}-${s}`;return i.has(a)||i.set(a,t(Object.assign({from:e,to:r,velocity:o,restSpeed:s?.05:2,restDistance:s?.01:.5},n))),i.get(a)},o=t=>(e.has(t)||e.set(t,function(t){let e,n=10,i=t(0);const r=[i.current];for(;!i.done&&n<1e4;)i=t(n),r.push(i.done?i.target:i.current),void 0===e&&i.hasReachedTarget&&(e=n),n+=10;const o=n-10;return 1===r.length&&r.push(i.current),{keyframes:r,duration:o/1e3,overshootDuration:(null!=e?e:o)/1e3}}(t)),e.get(t));return{createAnimation:(t,e,n,i,s)=>{var a,c;let l;const u=t.length;if(n&&u<=2&&t.every(Et)){const n=t[u-1],f=1===u?null:t[0];let h=0,d=0;const g=null==s?void 0:s.generator;if(g){const{animation:e,generatorStartTime:n}=s,i=(null==e?void 0:e.startTime)||n||0,r=(null==e?void 0:e.currentTime)||performance.now()-i,o=g(r).current;d=null!==(a=f)&&void 0!==a?a:o,(1===u||2===u&&null===t[0])&&(h=pt((t=>g(t).current),r,o))}else d=null!==(c=f)&&void 0!==c?c:parseFloat(e());const p=r(d,n,h,null==i?void 0:i.includes("scale")),m=o(p);l=Object.assign(Object.assign({},m),{easing:"linear"}),s&&(s.generator=p,s.generatorStartTime=performance.now())}else{l={easing:"ease",duration:o(r(0,100)).overshootDuration}}return l}}}}const Et=t=>"string"!=typeof t,xt=bt(wt),Ot=bt((({from:t=0,velocity:e=0,power:n=.8,decay:i=.325,bounceDamping:r,bounceStiffness:o,changeTarget:s,min:a,max:c,restDistance:l=.5,restSpeed:u})=>{i=E(i);const f={hasReachedTarget:!1,done:!1,current:t,target:t},h=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let d=n*e;const g=t+d,p=void 0===s?g:s(g);f.target=p,p!==g&&(d=p-t);const m=t=>-d*Math.exp(-t/i),y=t=>p+m(t),v=t=>{const e=m(t),n=y(t);f.done=Math.abs(e)<=l,f.current=f.done?p:n};let w,b;const x=t=>{var e;(e=f.current,void 0!==a&&e<a||void 0!==c&&e>c)&&(w=t,b=wt({from:f.current,to:h(f.current),velocity:pt(y,t,f.current),damping:r,stiffness:o,restDistance:l,restSpeed:u}))};return x(0),t=>{let e=!1;return b||void 0!==w||(e=!0,v(t),x(t)),void 0!==w&&t>w?(f.hasReachedTarget=!0,b(t-w)):(f.hasReachedTarget=!1,!e&&v(t),f)}})),St={any:0,all:1};function Mt(t,e,{root:n,margin:i,amount:r="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const o=nt(t),s=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=s.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);w(n)?s.set(t.target,n):a.unobserve(t.target)}else n&&(n(t),s.delete(t.target))}))}),{root:n,rootMargin:i,threshold:"number"==typeof r?r:St[r]});return o.forEach((t=>a.observe(t))),()=>a.disconnect()}const Tt=new WeakMap;let At;function Dt({target:t,contentRect:e,borderBoxSize:n}){var i;null===(i=Tt.get(t))||void 0===i||i.forEach((i=>{i({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function Lt(t){t.forEach(Dt)}function kt(t,e){At||"undefined"!=typeof ResizeObserver&&(At=new ResizeObserver(Lt));const n=nt(t);return n.forEach((t=>{let n=Tt.get(t);n||(n=new Set,Tt.set(t,n)),n.add(e),null==At||At.observe(t)})),()=>{n.forEach((t=>{const n=Tt.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==At||At.unobserve(t)}))}}const Wt=new Set;let jt;function Rt(t){return Wt.add(t),jt||(jt=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Wt.forEach((t=>t(e)))},window.addEventListener("resize",jt)),()=>{Wt.delete(t),!Wt.size&&jt&&(jt=void 0)}}function zt(t,e){return w(t)?Rt(t):kt(t,e)}const Bt={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Pt(t,e,n,i){const r=n[e],{length:o,position:s}=Bt[e],a=r.current,c=n.time;r.current=t["scroll"+s],r.scrollLength=t["scroll"+o]-t["client"+o],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=g(0,r.scrollLength,r.current);const l=i-c;r.velocity=l>50?0:O(r.current-a,l)}const Vt={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},$t={start:0,center:.5,end:1};function qt(t,e,n=0){let i=0;if(void 0!==$t[t]&&(t=$t[t]),b(t)){const e=parseFloat(t);t.endsWith("px")?i=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?i=e/100*document.documentElement.clientWidth:t.endsWith("vh")?i=e/100*document.documentElement.clientHeight:t=e}return c(t)&&(i=e*t),n+i}const Ct=[0,0];function Ft(t,e,n,i){let r=Array.isArray(t)?t:Ct,o=0,s=0;return c(t)?r=[t,t]:b(t)&&(r=(t=t.trim()).includes(" ")?t.split(" "):[t,$t[t]?t:"0"]),o=qt(r[0],n,i),s=qt(r[1],e),o-s}const Ht={x:0,y:0};function It(t,e,n){let{offset:i=Vt.All}=n;const{target:r=t,axis:o="y"}=n,s="y"===o?"height":"width",a=r!==t?function(t,e){let n={x:0,y:0},i=t;for(;i&&i!==e;)if(i instanceof HTMLElement)n.x+=i.offsetLeft,n.y+=i.offsetTop,i=i.offsetParent;else if(i instanceof SVGGraphicsElement&&"getBBox"in i){const{top:t,left:e}=i.getBBox();for(n.x+=e,n.y+=t;i&&"svg"!==i.tagName;)i=i.parentNode}return n}(r,t):Ht,c=r===t?{width:t.scrollWidth,height:t.scrollHeight}:{width:r.clientWidth,height:r.clientHeight},l={width:t.clientWidth,height:t.clientHeight};e[o].offset.length=0;let u=!e[o].interpolate;const f=i.length;for(let t=0;t<f;t++){const n=Ft(i[t],l[s],c[s],a[o]);u||n===e[o].interpolatorOffsets[t]||(u=!0),e[o].offset[t]=n}u&&(e[o].interpolate=y(m(f),e[o].offset),e[o].interpolatorOffsets=[...e[o].offset]),e[o].progress=e[o].interpolate(e[o].current)}function Ut(t,e,n,i={}){const r=i.axis||"y";return{measure:()=>function(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let i=e;for(;i&&i!=t;)n.x.targetOffset+=i.offsetLeft,n.y.targetOffset+=i.offsetTop,i=i.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,i.target,n),update:e=>{!function(t,e,n){Pt(t,"x",e,n),Pt(t,"y",e,n),e.time=n}(t,n,e),(i.offset||i.target)&&It(t,n,i)},notify:w(e)?()=>e(n):_t(e,n[r])}}function _t(t,e){return t.pause(),t.forEachNative(((t,{easing:e})=>{var n,i;if(t.updateDuration)e||(t.easing=d),t.updateDuration(1);else{const r={duration:1e3};e||(r.easing="linear"),null===(i=null===(n=t.effect)||void 0===n?void 0:n.updateTiming)||void 0===i||i.call(n,r)}})),()=>{t.currentTime=e.progress}}const Nt=new WeakMap,Gt=new WeakMap,Zt=new WeakMap,Kt=t=>t===document.documentElement?window:t;function Xt(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let Yt;function Jt(){if(!Yt)return;const t=Yt.sort(te).map(ee);t.forEach(ne),t.forEach(ne),Yt=void 0}function Qt(t){Yt?r(Yt,t):(Yt=[t],requestAnimationFrame(Jt))}const te=(t,e)=>t.getDepth()-e.getDepth(),ee=t=>t.animateUpdates(),ne=t=>t.next(),ie=(t,e)=>new CustomEvent(t,{detail:{target:e}});function re(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function oe(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const se=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),re(t,e,i))},ae={inView:{isActive:t=>Boolean(t.inView),subscribe:(t,{enable:e,disable:n},{inViewOptions:i={}})=>{const{once:r}=i,o=lt(i,["once"]);return Mt(t,(i=>{if(e(),oe(t,"viewenter",i),!r)return e=>{n(),oe(t,"viewleave",e)}}),o)}},hover:{isActive:t=>Boolean(t.hover),subscribe:(t,{enable:e,disable:n})=>{const i=se(t,"hoverstart",e),r=se(t,"hoverend",n);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",r)}}},press:{isActive:t=>Boolean(t.press),subscribe:(t,{enable:e,disable:n})=>{const i=e=>{n(),re(t,"pressend",e),window.removeEventListener("pointerup",i)},r=n=>{e(),re(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),window.removeEventListener("pointerup",i)}}}},ce=["initial","animate",...Object.keys(ae),"exit"],le=new WeakMap;function ue(t){const e={},n=[];for(let i in t){const r=t[i];R(i)&&(M[i]&&(i=M[i]),n.push(i),i=L(i));let o=Array.isArray(r)?r[0]:r;const s=D.get(i);s&&(o=c(r)?s.toDefaultUnit(r):r),e[i]=o}return n.length&&(e.transform=z(n)),e}const fe=t=>`-${t.toLowerCase()}`;function he(t,e={}){return rt([()=>{const n=new I(t,[0,1],e);return n.finished.catch((()=>{})),n}],e,e.duration)}t.MotionValue=e,t.ScrollOffset=Vt,t.animate=function(t,e,n){return(w(t)?he:ct)(t,e,n)},t.animateStyle=tt,t.createMotionState=function(t={},e){let n,i=e?e.getDepth()+1:0;const r={initial:!0,animate:!0},s={},a={};for(const n of ce)a[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const c=!1===t.initial?"animate":"initial";let l=lt(Xt(t[c]||a[c],t.variants)||{},["transition"]);const u=Object.assign({},l),f=(t,e)=>()=>{r[t]=e,Qt(g)},d=()=>{for(const e in ae){const i=ae[e].isActive(t),r=s[e];i&&!r?s[e]=ae[e].subscribe(n,{enable:f(e,!0),disable:f(e,!1)},t):!i&&r&&(r(),delete s[e])}},g={update:e=>{n&&(t=e,d(),Qt(g))},setActive:(t,e)=>{n&&(r[t]=e,Qt(g))},animateUpdates:function*(){var e,i;const o=l;l={};const s={};for(const n of ce){if(!r[n])continue;const o=Xt(t[n]);if(o)for(const n in o)"transition"!==n&&(l[n]=o[n],s[n]=et(null!==(i=null!==(e=o.transition)&&void 0!==e?e:t.transition)&&void 0!==i?i:{},n))}const a=new Set([...Object.keys(l),...Object.keys(o)]),c=[];a.forEach((t=>{var e,i,r;void 0===l[t]&&(l[t]=u[t]),i=o[t],r=l[t],typeof i==typeof r&&(Array.isArray(i)&&Array.isArray(r)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}(i,r):i===r)||(null!==(e=u[t])&&void 0!==e||(u[t]=J.get(n,t)),c.push(tt(n,t,l[t],s[t])))})),yield;const f=c.map((t=>t())).filter(Boolean);if(!f.length)return;const d=l;n.dispatchEvent(ie("motionstart",d)),Promise.all(f.map((t=>t.finished))).then((()=>{n.dispatchEvent(ie("motioncomplete",d))})).catch(h)},getDepth:()=>i,getTarget:()=>l,getOptions:()=>t,getContext:()=>a,mount:t=>(n=t,le.set(n,g),d(),()=>{le.delete(n),function(t){Yt&&o(Yt,t)}(g);for(const t in s)s[t]()}),isMounted:()=>Boolean(n)};return g},t.createStyleString=function(t={}){const e=ue(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,fe),n+=`: ${e[t]}; `;return n},t.createStyles=ue,t.getAnimationData=i,t.getStyleName=Y,t.glide=Ot,t.inView=Mt,t.mountedStates=le,t.resize=zt,t.scroll=function(t,e={}){var{container:n=document.documentElement}=e,i=lt(e,["container"]);let r=Zt.get(n);r||(r=new Set,Zt.set(n,r));const o=Ut(n,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},i);if(r.add(o),!Nt.has(n)){const t=()=>{const t=performance.now();for(const t of r)t.measure();for(const e of r)e.update(t);for(const t of r)t.notify()};Nt.set(n,t);const e=Kt(n);window.addEventListener("resize",t,{passive:!0}),n!==document.documentElement&&Gt.set(n,zt(n,t)),e.addEventListener("scroll",t,{passive:!0})}const s=Nt.get(n),a=requestAnimationFrame(s);return()=>{var e;"function"!=typeof t&&t.stop(),cancelAnimationFrame(a);const i=Zt.get(n);if(!i)return;if(i.delete(o),i.size)return;const r=Nt.get(n);Nt.delete(n),r&&(Kt(n).removeEventListener("scroll",r),null===(e=Gt.get(n))||void 0===e||e(),window.removeEventListener("resize",r))}},t.spring=xt,t.stagger=function(t=.1,{start:e=0,from:n=0,easing:i}={}){return(r,o)=>{const s=c(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,o),a=Math.abs(s-r);let l=t*a;if(i){const e=o*t;l=H(i)(l/e)*e}return e+l}},t.style=J,t.timeline=function(t,e={}){var n;const i=function(t,e={}){var{defaultOptions:n={}}=e,i=lt(e,["defaultOptions"]);const r=[],o=new Map,s={},c=new Map;let l=0,u=0,f=0;for(let e=0;e<t.length;e++){const i=t[e];if(b(i)){c.set(i,u);continue}if(!Array.isArray(i)){c.set(i.name,ut(u,i.at,l,c));continue}const[r,h,d={}]=i;void 0!==d.at&&(u=ut(u,d.at,l,c));let g=0;const y=nt(r,s),w=y.length;for(let t=0;t<w;t++){const e=dt(y[t],o);for(const i in h){const r=gt(i,e);let o=X(h[i]);const s=et(d,i);let{duration:c=n.duration||a.duration,easing:l=n.easing||a.easing}=s;if(v(l)){const t=R(i);o.length;const e=l.createAnimation(o,(()=>"0"),t);l=e.easing,void 0!==e.keyframes&&(o=e.keyframes),void 0!==e.duration&&(c=e.duration)}const y=at(d.delay,t,w)||0,b=u+y,E=b+c;let{offset:x=m(o.length)}=s;1===x.length&&0===x[0]&&(x[1]=1);const O=length-o.length;O>0&&p(x,O),1===o.length&&o.unshift(null),ft(r,o,l,x,b,E),g=Math.max(y+c,g),f=Math.max(E,f)}}l=u,u+=g}return o.forEach(((t,e)=>{for(const o in t){const s=t[o];s.sort(ht);const c=[],l=[],u=[];for(let t=0;t<s.length;t++){const{at:e,value:n,easing:i}=s[t];c.push(n),l.push(g(0,f,e)),u.push(i||a.easing)}0!==l[0]&&(l.unshift(0),c.unshift(c[0]),u.unshift("linear")),1!==l[l.length-1]&&(l.push(1),c.push(null)),r.push([e,o,c,Object.assign(Object.assign(Object.assign({},n),{duration:f,easing:u,offset:l}),i)])}})),r}(t,e),r=i.map((t=>tt(...t))).filter(Boolean);return rt(r,e,null===(n=i[0])||void 0===n?void 0:n[3].duration)},t.withControls=rt,Object.defineProperty(t,"__esModule",{value:!0})}));