motion 10.11.2 → 10.12.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,16 @@
2
2
 
3
3
  Motion One adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [10.12.0] [2022-07-10]
6
+
7
+ ### Added
8
+
9
+ - `scroll` function for tracking scroll events and powering scroll-driven animations.
10
+
11
+ ### Fixed
12
+
13
+ - Fixing `play` -> `cancel` behaviour in Safari. [Issue (sponsors only)](https://github.com/motiondivision/motionone/issues/102)
14
+
5
15
  ## [10.11.2] [2022-07-06]
6
16
 
7
17
  ### Removed
@@ -5,18 +5,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var dom = require('@motionone/dom');
6
6
  var animation = require('@motionone/animation');
7
7
 
8
- function animateProgress(target, options) {
9
- return dom.wrapAnimationWithControls([
8
+ function animateProgress(target, options = {}) {
9
+ return dom.withControls([
10
10
  () => {
11
11
  const animation$1 = new animation.Animation(target, [0, 1], options);
12
12
  animation$1.finished.catch(() => { });
13
13
  return animation$1;
14
14
  },
15
- ], options === null || options === void 0 ? void 0 : options.duration);
15
+ ], options, options.duration);
16
16
  }
17
17
  function animate(target, keyframesOrOptions, options) {
18
- const animationFunction = typeof target === "function" ? animateProgress : dom.animate;
19
- return animationFunction(target, keyframesOrOptions, options);
18
+ const factory = typeof target === "function" ? animateProgress : dom.animate;
19
+ return factory(target, keyframesOrOptions, options);
20
20
  }
21
21
 
22
22
  exports.animate = animate;
@@ -1,18 +1,18 @@
1
- import { animate as animate$1, wrapAnimationWithControls } from '@motionone/dom';
1
+ import { animate as animate$1, withControls } from '@motionone/dom';
2
2
  import { Animation } from '@motionone/animation';
3
3
 
4
- function animateProgress(target, options) {
5
- return wrapAnimationWithControls([
4
+ function animateProgress(target, options = {}) {
5
+ return withControls([
6
6
  () => {
7
7
  const animation = new Animation(target, [0, 1], options);
8
8
  animation.finished.catch(() => { });
9
9
  return animation;
10
10
  },
11
- ], options === null || options === void 0 ? void 0 : options.duration);
11
+ ], options, options.duration);
12
12
  }
13
13
  function animate(target, keyframesOrOptions, options) {
14
- const animationFunction = typeof target === "function" ? animateProgress : animate$1;
15
- return animationFunction(target, keyframesOrOptions, options);
14
+ const factory = typeof target === "function" ? animateProgress : animate$1;
15
+ return factory(target, keyframesOrOptions, options);
16
16
  }
17
17
 
18
18
  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,h=()=>{},f=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:f},skew:M},T=new Map,O=t=>`--motion-${t}`,S=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{v.forEach((e=>{S.push(t+e),T.set(O(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(${O(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 f;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 f}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=f){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:h="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)?f:F(n),p=a*(o+1),m=_(e,u,l(n)?n.map(F):f);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"===h||"alternate"===h&&u||"alternate-reverse"===h&&!u)&&(l=1-l);const f=r>=p?1:Math.min(l,1),g=m(d(f));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)?O(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=T.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,f=!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:O,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=T.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}=T.has(t)?T.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()&&!f||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:O,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(h),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 f&&u(t,n,a,{duration:p,delay:m,easing:M,repeat:v,offset:O},"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(h)),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 ht(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 ft=100,dt=10,pt=1;const mt=({stiffness:t=ft,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,h=((t=ft,e=dt,n=pt)=>e/(2*Math.sqrt(t*n)))(t,e,n);let f;if(h<1){const t=u*Math.sqrt(1-h*h);f=e=>i-Math.exp(-h*u*e)*((h*u*l-r)/t*Math.sin(t*e)+l*Math.cos(t*e))}else f=t=>i-Math.exp(-u*t)*(l+(u*l-r)*t);return t=>{c.current=f(t);const e=0===t?r:ht(f,t,c.current),n=Math.abs(e)<=s,l=Math.abs(i-c.current)<=o;var u,h,d;return c.done=n&&l,c.hasReachedTarget=(u=a,h=i,d=c.current,u<h&&d>=h||u>h&&d<=h),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],h=1===u?null:t[0];let f=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=h)&&void 0!==o?o:r,(1===u||2===u&&null===t[0])&&(f=ht((t=>p(t).current),i,r))}else d=null!==(c=h)&&void 0!==c?c:parseFloat(e());const m=i(d,n,f,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 h={hasReachedTarget:!1,done:!1,current:t,target:t},f=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);h.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);h.done=Math.abs(e)<=l,h.current=h.done?m:n};let M,w;const T=t=>{var e;(e=h.current,void 0!==o&&e<o||void 0!==c&&e>c)&&(M=t,w=mt({from:h.current,to:f(h.current),velocity:ht(v,t,h.current),damping:i,stiffness:r,restDistance:l,restSpeed:u}))};return T(0),t=>{let e=!1;return w||void 0!==M||(e=!0,b(t),T(t)),void 0!==M&&t>M?(h.hasReachedTarget=!0,w(t-M)):(h.hasReachedTarget=!1,!e&&b(t),h)}})),Mt={any:0,all:1};function wt(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?wt: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,rootMargin:a,threshold:"number"==typeof i?i:Mt[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 h=0,f=0,g=0;for(let e=0;e<t.length;e++){const a=t[e];if(o(a)){u.set(a,f);continue}if(!Array.isArray(a)){u.set(a.name,st(f,a.at,h,u));continue}const[i,d,y={}]=a;void 0!==y.at&&(f=st(f,y.at,h,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 h=it(y.delay,t,M)||0,b=f+h,w=b+l;let{offset:T=m(s.length)}=o;1===T.length&&0===T[0]&&(T[1]=1);const O=length-s.length;O>0&&p(T,O),1===s.length&&s.unshift(null),ot(i,s,u,T,b,w),v=Math.max(h+l,v),g=Math.max(w,g)}}h=f,f+=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=>"string"==typeof t,u=t=>"object"==typeof t&&Boolean(t.createAnimation),f=t=>Array.isArray(t)&&!c(t[0]);function h(t,e){return f(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}const d=(t,e,n)=>-n*t+n*e+t,p=()=>{},g=t=>t,m=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function y(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=m(0,e,i);t.push(d(n,1,r))}}function v(t){const e=[0];return y(e,t-1),e}function w(t,e=v(t.length),n=g){const i=t.length,r=i-e.length;return r>0&&y(e,r),r=>{let o=0;for(;o<i-2&&!(r<e[o+1]);o++);let a=s(0,1,m(e[o],e[o+1],r));return a=h(n,o)(a),d(t[o],t[o+1],a)}}const b=t=>1e3*t,E=t=>t/1e3;function x(t,e){return e?t*(1e3/e):0}const O=["","X","Y","Z"],S={x:"translateX",y:"translateY",z:"translateZ"},M={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},T={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:M,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:g},skew:M},A=new Map,D=t=>`--motion-${t}`,L=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{O.forEach((e=>{L.push(t+e),A.set(D(t+e),T[t])}))}));const k=(t,e)=>L.indexOf(t)-L.indexOf(e),W=new Set(L),j=t=>W.has(t),R=t=>t.sort(k).reduce(z,"").trim(),z=(t,e)=>`${t} ${e}(var(${D(e)}))`,B=t=>t.startsWith("--"),P=new Set;const V=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function $(t,e,n,i){if(t===e&&n===i)return g;const r=e=>function(t,e,n,i,r){let o,s,a=0;do{s=e+(n-e)/2,o=V(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:V(r(t),e,i)}const 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)},C=/\((.*?)\)/;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=C.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 g}class H{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:l="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=g,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,u(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=f(n)?g:F(n),this.updateDuration(i);const h=w(e,c,f(n)?n.map(F):g);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 u=a%2;("reverse"===l||"alternate"===l&&u||"alternate-reverse"===l&&!u)&&(c=1-c);const f=i>=this.totalDuration?1:Math.min(c,1),d=h(this.easing(f));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 I=t=>(t=>Array.isArray(t)&&c(t[0]))(t)?U(t):t,U=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,_=t=>document.createElement("div").animate(t,{duration:.001}),N={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{_({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(_({opacity:[0,1]}).finished)},G={},Z={};for(const t in N)Z[t]=()=>(void 0===G[t]&&(G[t]=N[t]()),G[t]);const K=t=>Array.isArray(t)?t:[t];function X(t){return S[t]&&(t=S[t]),j(t)?D(t):t}const Y={get:(t,e)=>{e=X(e);let n=B(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=A.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=X(e),B(e)?t.style.setProperty(e,n):t.style[e]=n}};function J(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function Q(t,n,o,s={}){const l=window.__MOTION_DEV_TOOLS_RECORD,h=!1!==s.record&&l;let d,{duration:g=a.duration,delay:m=a.delay,endDelay:y=a.endDelay,repeat:v=a.repeat,easing:w=a.easing,direction:E,offset:x,allowWebkitAcceleration:O=!1}=s;const M=i(t);let T=Z.waapi();const D=j(n);D&&((t,e)=>{S[e]&&(e=S[e]);const{transforms:n}=i(t);r(n,e),t.style.transform=R(n)})(t,n);const L=X(n),k=function(t,n){return t.has(n)||t.set(n,new e),t.get(n)}(M.values,L),W=A.get(L);return J(k.animation,!(u(w)&&k.generator)&&!1!==s.record),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=Y.get(t,L))&&void 0!==e?e:null==W?void 0:W.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}(K(o),e);if(u(w)){const t=w.createAnimation(i,e,D,L,k);w=t.easing,void 0!==t.keyframes&&(i=t.keyframes),void 0!==t.duration&&(g=t.duration)}if(B(L)&&(Z.cssRegisterProperty()?function(t){if(!P.has(t)){P.add(t);try{const{syntax:e,initialValue:n}=A.has(t)?A.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(L):T=!1),T){W&&(i=i.map((t=>c(t)?W.toDefaultUnit(t):t))),1!==i.length||Z.partialKeyframes()&&!h||i.unshift(e());const n={delay:b(m),duration:b(g),endDelay:b(y),easing:f(w)?void 0:I(w),direction:E,iterations:v+1,fill:"both"};d=t.animate({[L]:i,offset:x,easing:f(w)?w.map(I):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((()=>{Y.set(t,L,r),d.cancel()})).catch(p),O||(d.playbackRate=1.000001)}else if(D){i=i.map((t=>"string"==typeof t?parseFloat(t):t)),1===i.length&&i.unshift(parseFloat(e()));d=new H((e=>{W&&(e=W.toDefaultUnit(e)),Y.set(t,L,e)}),i,Object.assign(Object.assign({},s),{duration:g,easing:w}))}else{const e=i[i.length-1];Y.set(t,L,W&&c(e)?W.toDefaultUnit(e):e)}return h&&l(t,n,i,{duration:g,delay:m,easing:w,repeat:v,offset:x},"motion-one"),k.setAnimation(d),d}}const tt=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function et(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 nt=t=>t(),it=(t,e,n=a.duration)=>new Proxy({animations:t.map(nt).filter(Boolean),duration:n,options:e},rt),rt={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return E((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(ot)).catch(p)),t.finished;case"stop":return()=>{t.animations.forEach((t=>J(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=b(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},ot=t=>t.finished;function st(t,e,n){return"function"==typeof t?t(e,n):t}function at(t,e,n={}){const i=(t=et(t)).length,r=[];for(let o=0;o<i;o++){const s=t[o];for(const t in e){const a=tt(n,t);a.delay=st(a.delay,o,i);const c=Q(s,t,e[t],a);r.push(c)}}return it(r,n,n.duration)}function ct(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 lt(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 ut(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:d(r,s,i[o]),easing:h(n,o)})}function ft(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function ht(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function dt(t,e){return e[t]||(e[t]=[]),e[t]}function pt(t,e,n){const i=Math.max(e-5,0);return x(n-t(i),e-i)}const gt=100,mt=10,yt=1;const vt=({stiffness:t=gt,damping:e=mt,mass:n=yt,from:i=0,to:r=1,velocity:o=0,restSpeed:s=2,restDistance:a=.5}={})=>{o=o?E(o):0;const c={done:!1,hasReachedTarget:!1,current:i,target:r},l=r-i,u=Math.sqrt(t/n)/1e3,f=((t=gt,e=mt,n=yt)=>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 wt(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(bt)){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,i=(null==e?void 0:e.startTime)||n||0,r=(null==e?void 0:e.currentTime)||performance.now()-i,o=p(r).current;d=null!==(a=f)&&void 0!==a?a:o,(1===u||2===u&&null===t[0])&&(h=pt((t=>p(t).current),r,o))}else d=null!==(c=f)&&void 0!==c?c:parseFloat(e());const g=r(d,n,h,null==i?void 0:i.includes("scale")),m=o(g);l=Object.assign(Object.assign({},m),{easing:"linear"}),s&&(s.generator=g,s.generatorStartTime=performance.now())}else{l={easing:"ease",duration:o(r(0,100)).overshootDuration}}return l}}}}const bt=t=>"string"!=typeof t,Et=wt(vt),xt=wt((({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=b(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 p=t+d,g=void 0===s?p:s(p);f.target=g,g!==p&&(d=g-t);const m=t=>-d*Math.exp(-t/i),y=t=>g+m(t),v=t=>{const e=m(t),n=y(t);f.done=Math.abs(e)<=l,f.current=f.done?g:n};let w,E;const x=t=>{var e;(e=f.current,void 0!==a&&e<a||void 0!==c&&e>c)&&(w=t,E=vt({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 E||void 0!==w||(e=!0,v(t),x(t)),void 0!==w&&t>w?(f.hasReachedTarget=!0,E(t-w)):(f.hasReachedTarget=!1,!e&&v(t),f)}})),Ot={any:0,all:1};function St(t,e,{root:n,margin:i,amount:r="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const o=et(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);"function"==typeof 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:Ot[r]});return o.forEach((t=>a.observe(t))),()=>a.disconnect()}const Mt=new WeakMap;let Tt;function At({target:t,contentRect:e,borderBoxSize:n}){var i;null===(i=Mt.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 Dt(t){t.forEach(At)}function Lt(t,e){Tt||"undefined"!=typeof ResizeObserver&&(Tt=new ResizeObserver(Dt));const n=et(t);return n.forEach((t=>{let n=Mt.get(t);n||(n=new Set,Mt.set(t,n)),n.add(e),null==Tt||Tt.observe(t)})),()=>{n.forEach((t=>{const n=Mt.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==Tt||Tt.unobserve(t)}))}}const kt=new Set;let Wt;function jt(t){return kt.add(t),Wt||(Wt=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};kt.forEach((t=>t(e)))},window.addEventListener("resize",Wt)),()=>{kt.delete(t),!kt.size&&Wt&&(Wt=void 0)}}function Rt(t,e){return"function"==typeof t?jt(t):Lt(t,e)}const zt={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Bt(t,e,n,i){const r=n[e],{length:o,position:s}=zt[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=m(0,r.scrollLength,r.current);const l=i-c;r.velocity=l>50?0:x(r.current-a,l)}const Pt={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},Vt={start:0,center:.5,end:1};function $t(t,e,n=0){let i=0;if(void 0!==Vt[t]&&(t=Vt[t]),l(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 qt=[0,0];function Ct(t,e,n,i){let r=Array.isArray(t)?t:qt,o=0,s=0;return c(t)?r=[t,t]:l(t)&&(r=(t=t.trim()).includes(" ")?t.split(" "):[t,Vt[t]?t:"0"]),o=$t(r[0],n,i),s=$t(r[1],e),o-s}const Ft={x:0,y:0};function Ht(t,e,n){let{offset:i=Pt.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):Ft,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=Ct(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=w(v(f),e[o].offset),e[o].interpolatorOffsets=[...e[o].offset]),e[o].progress=e[o].interpolate(e[o].current)}function It(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){Bt(t,"x",e,n),Bt(t,"y",e,n),e.time=n}(t,n,e),(i.offset||i.target)&&Ht(t,n,i)},notify:"function"==typeof e?()=>e(n):Ut(e,n[r])}}function Ut(t,e){return t.pause(),t.forEachNative(((t,{easing:e})=>{var n,i;if(t.updateDuration)e||(t.easing=g),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 _t=new WeakMap,Nt=new WeakMap,Gt=new WeakMap,Zt=t=>t===document.documentElement?window:t;function Kt(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let Xt;function Yt(){if(!Xt)return;const t=Xt.sort(Qt).map(te);t.forEach(ee),t.forEach(ee),Xt=void 0}function Jt(t){Xt?r(Xt,t):(Xt=[t],requestAnimationFrame(Yt))}const Qt=(t,e)=>t.getDepth()-e.getDepth(),te=t=>t.animateUpdates(),ee=t=>t.next(),ne=(t,e)=>new CustomEvent(t,{detail:{target:e}});function ie(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function re(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const oe=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),ie(t,e,i))},se={inView:{isActive:t=>Boolean(t.inView),subscribe:(t,{enable:e,disable:n},{inViewOptions:i={}})=>{const{once:r}=i,o=ct(i,["once"]);return St(t,(i=>{if(e(),re(t,"viewenter",i),!r)return e=>{n(),re(t,"viewleave",e)}}),o)}},hover:{isActive:t=>Boolean(t.hover),subscribe:(t,{enable:e,disable:n})=>{const i=oe(t,"hoverstart",e),r=oe(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(),ie(t,"pressend",e),window.removeEventListener("pointerup",i)},r=n=>{e(),ie(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),window.removeEventListener("pointerup",i)}}}},ae=["initial","animate",...Object.keys(se),"exit"],ce=new WeakMap;function le(t){const e={},n=[];for(let i in t){const r=t[i];j(i)&&(S[i]&&(i=S[i]),n.push(i),i=D(i));let o=Array.isArray(r)?r[0]:r;const s=A.get(i);s&&(o=c(r)?s.toDefaultUnit(r):r),e[i]=o}return n.length&&(e.transform=R(n)),e}const ue=t=>`-${t.toLowerCase()}`;function fe(t,e={}){return it([()=>{const n=new H(t,[0,1],e);return n.finished.catch((()=>{})),n}],e,e.duration)}t.MotionValue=e,t.ScrollOffset=Pt,t.animate=function(t,e,n){return("function"==typeof t?fe:at)(t,e,n)},t.animateStyle=Q,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 ae)a[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const c=!1===t.initial?"animate":"initial";let l=ct(Kt(t[c]||a[c],t.variants)||{},["transition"]);const u=Object.assign({},l),f=(t,e)=>()=>{r[t]=e,Jt(d)},h=()=>{for(const e in se){const i=se[e].isActive(t),r=s[e];i&&!r?s[e]=se[e].subscribe(n,{enable:f(e,!0),disable:f(e,!1)},t):!i&&r&&(r(),delete s[e])}},d={update:e=>{n&&(t=e,h(),Jt(d))},setActive:(t,e)=>{n&&(r[t]=e,Jt(d))},animateUpdates:function*(){var e,i;const o=l;l={};const s={};for(const n of ae){if(!r[n])continue;const o=Kt(t[n]);if(o)for(const n in o)"transition"!==n&&(l[n]=o[n],s[n]=tt(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]=Y.get(n,t)),c.push(Q(n,t,l[t],s[t])))})),yield;const f=c.map((t=>t())).filter(Boolean);if(!f.length)return;const h=l;n.dispatchEvent(ne("motionstart",h)),Promise.all(f.map((t=>t.finished))).then((()=>{n.dispatchEvent(ne("motioncomplete",h))})).catch(p)},getDepth:()=>i,getTarget:()=>l,getOptions:()=>t,getContext:()=>a,mount:t=>(n=t,ce.set(n,d),h(),()=>{ce.delete(n),function(t){Xt&&o(Xt,t)}(d);for(const t in s)s[t]()}),isMounted:()=>Boolean(n)};return d},t.createStyleString=function(t={}){const e=le(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,ue),n+=`: ${e[t]}; `;return n},t.createStyles=le,t.getAnimationData=i,t.getStyleName=X,t.glide=xt,t.inView=St,t.mountedStates=ce,t.resize=Rt,t.scroll=function(t,e={}){var{container:n=document.documentElement}=e,i=ct(e,["container"]);let r=Gt.get(n);r||(r=new Set,Gt.set(n,r));const o=It(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),!_t.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()};_t.set(n,t);const e=Zt(n);window.addEventListener("resize",t,{passive:!0}),n!==document.documentElement&&Nt.set(n,Rt(n,t)),e.addEventListener("scroll",t,{passive:!0})}const s=_t.get(n),a=requestAnimationFrame(s);return()=>{var e;"function"!=typeof t&&t.stop(),cancelAnimationFrame(a);const i=Gt.get(n);if(!i)return;if(i.delete(o),i.size)return;const r=_t.get(n);_t.delete(n),r&&(Zt(n).removeEventListener("scroll",r),null===(e=Nt.get(n))||void 0===e||e(),window.removeEventListener("resize",r))}},t.spring=Et,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=F(i)(l/e)*e}return e+l}},t.style=Y,t.timeline=function(t,e={}){var n;const i=function(t,e={}){var{defaultOptions:n={}}=e,i=ct(e,["defaultOptions"]);const r=[],o=new Map,s={},c=new Map;let f=0,h=0,d=0;for(let e=0;e<t.length;e++){const i=t[e];if(l(i)){c.set(i,h);continue}if(!Array.isArray(i)){c.set(i.name,lt(h,i.at,f,c));continue}const[r,p,g={}]=i;void 0!==g.at&&(h=lt(h,g.at,f,c));let m=0;const w=et(r,s),b=w.length;for(let t=0;t<b;t++){const e=ht(w[t],o);for(const i in p){const r=dt(i,e);let o=K(p[i]);const s=tt(g,i);let{duration:c=n.duration||a.duration,easing:l=n.easing||a.easing}=s;if(u(l)){const t=j(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 f=st(g.delay,t,b)||0,w=h+f,E=w+c;let{offset:x=v(o.length)}=s;1===x.length&&0===x[0]&&(x[1]=1);const O=length-o.length;O>0&&y(x,O),1===o.length&&o.unshift(null),ut(r,o,l,x,w,E),m=Math.max(f+c,m),d=Math.max(E,d)}}f=h,h+=m}return o.forEach(((t,e)=>{for(const o in t){const s=t[o];s.sort(ft);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(m(0,d,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:d,easing:u,offset:l}),i)])}})),r}(t,e),r=i.map((t=>Q(...t))).filter(Boolean);return it(r,e,null===(n=i[0])||void 0===n?void 0:n[3].duration)},t.withControls=it,Object.defineProperty(t,"__esModule",{value:!0})}));