framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 83 kB
JavaScript
import{q as t,t as e,u as i,v as n,w as s,x as o,y as r,z as a,A as l,B as h,C as u,D as c,E as d,F as m,G as p,M as f,K as y,H as g,I as v,J as x,N as T,k as P,O as w,b as S,o as E,Q as A,R as D,T as b,U as M,V as k,W as V,X as C,Y as L,Z as R,_ as j,d as B,s as O,$ as F,a0 as I,l as U,e as $,f as N,a1 as W,a as z,a2 as K,j as G,a3 as H,a4 as Y,a5 as X,a6 as q,a7 as _,a8 as Z,a9 as J,aa as Q,ab as tt,r as et,ac as it,p as nt,P as st,L as ot,S as rt,g as at}from"./size-rollup-dom-max-assets.js";import{jsx as lt}from"react/jsx-runtime";import{useContext as ht,useId as ut,useEffect as ct,useCallback as dt,Component as mt,Fragment as pt}from"react";function ft(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let yt=()=>{},gt=()=>{};function vt(t){return"object"==typeof t&&null!==t}function xt(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(yt=(t,e,i)=>{t||"undefined"==typeof console||console.warn(ft(e,i))},gt=(t,e,i)=>{if(!t)throw new Error(ft(e,i))});const Tt=(t,e)=>i=>e(t(i)),Pt=(...t)=>t.reduce(Tt),wt=(t,e,i)=>{const n=e-t;return 0===n?1:(i-t)/n},St=t=>1e3*t,Et=t=>t/1e3,At=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function Dt(e,i,n,s){if(e===i&&n===s)return t;const o=t=>function(t,e,i,n,s){let o,r,a=0;do{r=e+(i-e)/2,o=At(r,n,s)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(t,0,1,e,n);return t=>0===t||1===t?t:At(o(t),i,s)}const bt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Mt=t=>e=>1-t(1-e),kt=Dt(.33,1.53,.69,.99),Vt=Mt(kt),Ct=bt(Vt),Lt=t=>(t*=2)<1?.5*Vt(t):.5*(2-Math.pow(2,-10*(t-1))),Rt=t=>1-Math.sin(Math.acos(t)),jt=Mt(Rt),Bt=bt(Rt),Ot=Dt(.42,0,1,1),Ft=Dt(0,0,.58,1),It=Dt(.42,0,.58,1),Ut=t=>Array.isArray(t)&&"number"==typeof t[0],$t={linear:t,easeIn:Ot,easeInOut:It,easeOut:Ft,circIn:Rt,circInOut:Bt,circOut:jt,backIn:Vt,backInOut:Ct,backOut:kt,anticipate:Lt},Nt=t=>{if(Ut(t)){gt(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,n,s]=t;return Dt(e,i,n,s)}return"string"==typeof t?(gt(void 0!==$t[t],`Invalid easing type '${t}'`,"invalid-easing-type"),$t[t]):t};function Wt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function zt(t,e){return i=>i>0?e:t}const Kt=(t,e,i)=>{const n=t*t,s=i*(e*e-n)+n;return s<0?0:Math.sqrt(s)},Gt=[s,i,n];function Ht(t){const e=(i=t,Gt.find(t=>t.test(i)));var i;if(yt(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let s=e.parse(t);return e===n&&(s=function({hue:t,saturation:e,lightness:i,alpha:n}){t/=360,i/=100;let s=0,o=0,r=0;if(e/=100){const n=i<.5?i*(1+e):i+e-i*e,a=2*i-n;s=Wt(a,n,t+1/3),o=Wt(a,n,t),r=Wt(a,n,t-1/3)}else s=o=r=i;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:n}}(s)),s}const Yt=(t,n)=>{const s=Ht(t),o=Ht(n);if(!s||!o)return zt(t,n);const r={...s};return t=>(r.red=Kt(s.red,o.red,t),r.green=Kt(s.green,o.green,t),r.blue=Kt(s.blue,o.blue,t),r.alpha=e(s.alpha,o.alpha,t),i.transform(r))},Xt=new Set(["none","hidden"]);function qt(t,i){return n=>e(t,i,n)}function _t(t){return"number"==typeof t?qt:"string"==typeof t?o(t)?zt:r.test(t)?Yt:Qt:Array.isArray(t)?Zt:"object"==typeof t?r.test(t)?Yt:Jt:zt}function Zt(t,e){const i=[...t],n=i.length,s=t.map((t,i)=>_t(t)(t,e[i]));return t=>{for(let e=0;e<n;e++)i[e]=s[e](t);return i}}function Jt(t,e){const i={...t,...e},n={};for(const s in i)void 0!==t[s]&&void 0!==e[s]&&(n[s]=_t(t[s])(t[s],e[s]));return t=>{for(const e in n)i[e]=n[e](t);return i}}const Qt=(t,e)=>{const i=a.createTransformer(e),n=l(t),s=l(e);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?Xt.has(t)&&!s.values.length||Xt.has(e)&&!n.values.length?function(t,e){return Xt.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):Pt(Zt(function(t,e){const i=[],n={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][n[o]],a=t.values[r]??0;i[s]=a,n[o]++}return i}(n,s),s.values),i):(yt(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),zt(t,e))};function te(t,i,n){if("number"==typeof t&&"number"==typeof i&&"number"==typeof n)return e(t,i,n);return _t(t)(t,i)}const ee=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>h.update(e,t),stop:()=>u(e),now:()=>c.isProcessing?c.timestamp:d.now()}},ie=(t,e,i=10)=>{let n="";const s=Math.max(Math.round(e/i),2);for(let e=0;e<s;e++)n+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},ne=2e4;function se(t){let e=0;let i=t.next(e);for(;!i.done&&e<ne;)e+=50,i=t.next(e);return e>=ne?1/0:e}function oe(t,e,i){const n=Math.max(e-5,0);return m(i-t(n),e-n)}const re=100,ae=10,le=1,he=0,ue=800,ce=.3,de=.3,me={granular:.01,default:2},pe={granular:.005,default:.5},fe=.01,ye=10,ge=.05,ve=1,xe=.001;function Te({duration:t=ue,bounce:e=ce,velocity:i=he,mass:n=le}){let s,o;yt(t<=St(ye),"Spring duration must be 10 seconds or less","spring-duration-limit");let r=1-e;r=p(ge,ve,r),t=p(fe,ye,Et(t)),r<1?(s=e=>{const n=e*r,s=n*t,o=n-i,a=we(e,r),l=Math.exp(-s);return xe-o/a*l},o=e=>{const n=e*r*t,o=n*i+i,a=Math.pow(r,2)*Math.pow(e,2)*t,l=Math.exp(-n),h=we(Math.pow(e,2),r);return(-s(e)+xe>0?-1:1)*((o-a)*l)/h}):(s=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(i-e)));const a=function(t,e,i){let n=i;for(let i=1;i<Pe;i++)n-=t(n)/e(n);return n}(s,o,5/t);if(t=St(t),isNaN(a))return{stiffness:re,damping:ae,duration:t};{const e=Math.pow(a,2)*n;return{stiffness:e,damping:2*r*Math.sqrt(n*e),duration:t}}}const Pe=12;function we(t,e){return t*Math.sqrt(1-e*e)}const Se=["duration","bounce"],Ee=["stiffness","damping","mass"];function Ae(t,e){return e.some(e=>void 0!==t[e])}function De(t=de,e=ce){const i="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:s}=i;const o=i.keyframes[0],r=i.keyframes[i.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:h,mass:u,duration:c,velocity:d,isResolvedFromDuration:m}=function(t){let e={velocity:he,stiffness:re,damping:ae,mass:le,isResolvedFromDuration:!1,...t};if(!Ae(t,Ee)&&Ae(t,Se))if(t.visualDuration){const i=t.visualDuration,n=2*Math.PI/(1.2*i),s=n*n,o=2*p(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:le,stiffness:s,damping:o}}else{const i=Te(t);e={...e,...i,mass:le},e.isResolvedFromDuration=!0}return e}({...i,velocity:-Et(i.velocity||0)}),f=d||0,y=h/(2*Math.sqrt(l*u)),g=r-o,v=Et(Math.sqrt(l/u)),x=Math.abs(g)<5;let T;if(n||(n=x?me.granular:me.default),s||(s=x?pe.granular:pe.default),y<1){const t=we(v,y);T=e=>{const i=Math.exp(-y*v*e);return r-i*((f+y*v*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===y)T=t=>r-Math.exp(-v*t)*(g+(f+v*g)*t);else{const t=v*Math.sqrt(y*y-1);T=e=>{const i=Math.exp(-y*v*e),n=Math.min(t*e,300);return r-i*((f+y*v*g)*Math.sinh(n)+t*g*Math.cosh(n))/t}}const P={calculatedDuration:m&&c||null,next:t=>{const e=T(t);if(m)a.done=t>=c;else{let i=0===t?f:0;y<1&&(i=0===t?St(f):oe(T,t,e));const o=Math.abs(i)<=n,l=Math.abs(r-e)<=s;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(se(P),ne),e=ie(e=>P.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return P}function be({keyframes:t,velocity:e=0,power:i=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:h=.5,restSpeed:u}){const c=t[0],d={done:!1,value:c},m=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let p=i*e;const f=c+p,y=void 0===r?f:r(f);y!==f&&(p=y-c);const g=t=>-p*Math.exp(-t/n),v=t=>y+g(t),x=t=>{const e=g(t),i=v(t);d.done=Math.abs(e)<=h,d.value=d.done?y:i};let T,P;const w=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,P=De({keyframes:[d.value,m(d.value)],velocity:oe(v,t,d.value),damping:s,stiffness:o,restDelta:h,restSpeed:u}))};return w(0),{calculatedDuration:null,next:t=>{let e=!1;return P||void 0!==T||(e=!0,x(t),w(t)),void 0!==T&&t>=T?P.next(t-T):(!e&&x(t),d)}}}function Me(e,i,{clamp:n=!0,ease:s,mixer:o}={}){const r=e.length;if(gt(r===i.length,"Both input and output ranges must be the same length","range-length"),1===r)return()=>i[0];if(2===r&&i[0]===i[1])return()=>i[1];const a=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),i=[...i].reverse());const l=function(e,i,n){const s=[],o=n||f.mix||te,r=e.length-1;for(let n=0;n<r;n++){let r=o(e[n],e[n+1]);if(i){const e=Array.isArray(i)?i[n]||t:i;r=Pt(e,r)}s.push(r)}return s}(i,s,o),h=l.length,u=t=>{if(a&&t<e[0])return i[0];let n=0;if(h>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const s=wt(e[n],e[n+1],t);return l[n](s)};return n?t=>u(p(e[0],e[r-1],t)):u}function ke(t){const i=[0];return function(t,i){const n=t[t.length-1];for(let s=1;s<=i;s++){const o=wt(0,i,s);t.push(e(n,1,o))}}(i,t.length-1),i}function Ve({duration:t=300,keyframes:e,times:i,ease:n="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(n)?n.map(Nt):Nt(n),o={done:!1,value:e[0]},r=function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:ke(e),t),a=Me(r,e,{ease:Array.isArray(s)?s:(l=e,h=s,l.map(()=>h||It).splice(0,l.length-1))});var l,h;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}De.applyToOptions=t=>{const e=function(t,e=100,i){const n=i({...t,keyframes:[0,e]}),s=Math.min(se(n),ne);return{type:"keyframes",ease:t=>n.next(s*t).value/e,duration:Et(s)}}(t,100,De);return t.ease=e.ease,t.duration=St(e.duration),t.type="keyframes",t};const Ce=t=>null!==t;function Le(t,{repeat:e,repeatType:i="loop"},n,s=1){const o=t.filter(Ce),r=s<0||e&&"loop"!==i&&e%2==1?0:o.length-1;return r&&void 0!==n?n:o[r]}const Re={decay:be,inertia:be,tween:Ve,keyframes:Ve,spring:De};function je(t){"string"==typeof t.type&&(t.type=Re[t.type])}class Be{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const Oe=t=>t/100;class Fe extends Be{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==d.now()&&this.tick(d.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;je(t);const{type:e=Ve,repeat:i=0,repeatDelay:n=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||Ve;a!==Ve&&"number"!=typeof r[0]&&(this.mixKeyframes=Pt(Oe,te(r[0],r[1])),r=[0,100]);const l=a({...t,keyframes:r});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...r].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=se(l));const{calculatedDuration:h}=l;this.calculatedDuration=h,this.resolvedDuration=h+n,this.totalDuration=this.resolvedDuration*(i+1)-n,this.generator=l}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:i,totalDuration:n,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:r,calculatedDuration:a}=this;if(null===this.startTime)return i.next(0);const{delay:l=0,keyframes:h,repeat:u,repeatType:c,repeatDelay:d,type:m,onUpdate:f,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-n/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let x=this.currentTime,T=i;if(u){const t=Math.min(this.currentTime,n)/r;let e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,e=Math.min(e,u+1);Boolean(e%2)&&("reverse"===c?(i=1-i,d&&(i-=d/r)):"mirror"===c&&(T=o)),x=p(0,1,i)*r}const P=v?{done:!1,value:h[0]}:T.next(x);s&&(P.value=s(P.value));let{done:w}=P;v||null===a||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&m!==be&&(P.value=Le(h,this.options,y,this.speed)),f&&f(P.value),S&&this.finish(),P}then(t,e){return this.finished.then(t,e)}get duration(){return Et(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Et(t)}get time(){return Et(this.currentTime)}set time(t){t=St(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(d.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Et(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ee,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const i=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=i):null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime||(this.startTime=e??i),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(d.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const Ie=xt(()=>void 0!==window.ScrollTimeline),Ue={};function $e(t,e){const i=xt(t);return()=>Ue[e]??i()}const Ne=$e(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),We=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,ze={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:We([0,.65,.55,1]),circOut:We([.55,0,1,.45]),backIn:We([.31,.01,.66,-.59]),backOut:We([.33,1.53,.69,.99])};function Ke(t,e){return t?"function"==typeof t?Ne()?ie(t,e):"ease-out":Ut(t)?We(t):Array.isArray(t)?t.map(t=>Ke(t,e)||ze.easeOut):ze[t]:void 0}function Ge(t,e,i,{delay:n=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},h=void 0){const u={[e]:i};l&&(u.offset=l);const c=Ke(a,s);Array.isArray(c)&&(u.easing=c);const d={delay:n,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};h&&(d.pseudoElement=h);return t.animate(u,d)}function He(t){return"function"==typeof t&&"applyToOptions"in t}class Ye extends Be{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:i,keyframes:n,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:r,onComplete:a}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=o,this.options=t,gt("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return He(t)&&Ne()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Ge(e,i,n,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const t=Le(n,this.options,r,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,i){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,i):t.style[e]=i}(e,i,t),this.animation.cancel()}a?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Et(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Et(t)}get time(){return Et(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=St(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:e,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Ie()?(this.animation.timeline=e,t):i(this)}}const Xe={anticipate:Lt,backInOut:Ct,circInOut:Bt};function qe(t){"string"==typeof t.ease&&t.ease in Xe&&(t.ease=Xe[t.ease])}class _e extends Ye{constructor(t){qe(t),je(t),super(t),void 0!==t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:i,onComplete:n,element:s,...o}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const r=new Fe({...o,autoplay:!1}),a=Math.max(10,d.now()-this.startTime),l=p(0,10,a-10);e.setWithVelocity(r.sample(Math.max(0,a-l)).value,r.sample(a).value,l),r.stop()}}const Ze=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!a.test(t)&&"0"!==t||t.startsWith("url(")));function Je(t){t.duration=0,t.type="keyframes"}const Qe=new Set(["opacity","clipPath","filter","transform"]),ti=xt(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class ei extends Be{constructor({autoplay:t=!0,delay:e=0,type:i="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:o="loop",keyframes:r,name:a,motionValue:l,element:h,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=d.now();const c={autoplay:t,delay:e,type:i,repeat:n,repeatDelay:s,repeatType:o,name:a,motionValue:l,element:h,...u},m=h?.KeyframeResolver||y;this.keyframeResolver=new m(r,(t,e,i)=>this.onKeyframesResolved(t,e,c,!i),a,l,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,i,n,s){this.keyframeResolver=void 0;const{name:o,type:r,velocity:a,delay:l,isHandoff:h,onUpdate:u}=n;this.resolvedAt=d.now(),function(t,e,i,n){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=Ze(s,e),a=Ze(o,e);return yt(r===a,`You are trying to animate ${e} from "${s}" to "${o}". "${r?o:s}" is not an animatable value.`,"value-not-animatable"),!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||He(i))&&n)}(e,o,r,a)||(!f.instantAnimations&&l||u?.(Le(e,n,i)),e[0]=e[e.length-1],Je(n),n.repeat=0);const c={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:i,...n,keyframes:e},m=!h&&function(t){const{motionValue:e,name:i,repeatDelay:n,repeatType:s,damping:o,type:r}=t,a=e?.owner?.current;if(!(a instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:h}=e.owner.getProps();return ti()&&i&&Qe.has(i)&&("transform"!==i||!h)&&!l&&!n&&"mirror"!==s&&0!==o&&"inertia"!==r}(c)?new _e({...c,element:c.motionValue.owner.current}):new Fe(c);m.finished.then(()=>this.notifyFinished()).catch(t),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),g()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const ii=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ni(t,e,i=1){gt(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,s]=function(t){const e=ii.exec(t);if(!e)return[,];const[,i,n,s]=e;return[`--${i??n}`,s]}(t);if(!n)return;const r=window.getComputedStyle(e).getPropertyValue(n);if(r){const t=r.trim();return v(t)?parseFloat(t):t}return o(s)?ni(s,e,i+1):s}function si(t,e){return t?.[e]??t?.default??t}const oi={type:"spring",stiffness:500,damping:25,restSpeed:10},ri={type:"keyframes",duration:.8},ai={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},li=(t,{keyframes:e})=>e.length>2?ri:x.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:oi:ai;const hi=t=>null!==t;function ui(t,e,i,n=0,s=1){const o=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),r=t.size,a=(r-1)*n;return"function"==typeof i?i(o,r):1===s?o*n:a-o*n}const ci=(t,e,i,n={},s,o)=>r=>{const a=si(n,t)||{},l=a.delay||n.delay||0;let{elapsed:u=0}=n;u-=St(l);const c={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:s};(function({when:t,delay:e,delayChildren:i,staggerChildren:n,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length})(a)||Object.assign(c,li(t,c)),c.duration&&(c.duration=St(c.duration)),c.repeatDelay&&(c.repeatDelay=St(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(Je(c),0===c.delay&&(d=!0)),(f.instantAnimations||f.skipAnimations)&&(d=!0,Je(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:i="loop"},n){const s=t.filter(hi),o=e&&"loop"!==i&&e%2==1?0:s.length-1;return o&&void 0!==n?n:s[o]}(c.keyframes,a);if(void 0!==t)return void h.update(()=>{c.onUpdate(t),c.onComplete()})}return a.isSync?new Fe(c):new ei(c)},di=new Set(["width","height","top","left","right","bottom",...T]);function mi(t,e,i){const n=t.getProps();return P(n,e,void 0!==i?i:n.custom,t)}const pi=t=>Array.isArray(t);function fi(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,w(i))}function yi(t){return pi(t)?t[t.length-1]||0:t}function gi(t,e){const i=t.getValue("willChange");if(n=i,Boolean(S(n)&&n.add))return i.add(e);if(!i&&f.WillChange){const i=new f.WillChange("auto");t.addValue("willChange",i),i.add(e)}var n}function vi(t){return t.props[E]}function xi({protectedKeys:t,needsAnimating:e},i){const n=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,n}function Ti(t,e,{delay:i=0,transitionOverride:n,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;n&&(o=n);const l=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const n=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||u&&xi(u,e))continue;const r={delay:i,...si(o||{},e)},c=n.get();if(void 0!==c&&!n.isAnimating&&!Array.isArray(s)&&s===c&&!r.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){const i=vi(t);if(i){const t=window.MotionHandoffAnimation(i,e,h);null!==t&&(r.startTime=t,d=!0)}}gi(t,e),n.start(ci(e,n,s,t.shouldReduceMotion&&di.has(e)?{type:!1}:r,t,d));const m=n.animation;m&&l.push(m)}return r&&Promise.all(l).then(()=>{h.update(()=>{r&&function(t,e){const i=mi(t,e);let{transitionEnd:n={},transition:s={},...o}=i||{};o={...o,...n};for(const e in o)fi(t,e,yi(o[e]))}(t,r)})}),l}function Pi(t,e,i={}){const n=mi(t,e,"exit"===i.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=n||{};i.transitionOverride&&(s=i.transitionOverride);const o=n?()=>Promise.all(Ti(t,n,i)):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=s;return function(t,e,i=0,n=0,s=0,o=1,r){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(Pi(l,e,{...r,delay:i+("function"==typeof n?0:n)+ui(t.variantChildren,l,n,s,o)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,n,o,r,a,i)}:()=>Promise.resolve(),{when:a}=s;if(a){const[t,e]="beforeChildren"===a?[o,r]:[r,o];return t().then(()=>e())}return Promise.all([o(),r(i.delay)])}function wi(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||A(t))}const Si=new Set(["auto","none","0"]);class Ei extends y{constructor(t,e,i,n,s){super(t,e,i,n,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let i=0;i<t.length;i++){let n=t[i];if("string"==typeof n&&(n=n.trim(),o(n))){const s=ni(n,e.current);void 0!==s&&(t[i]=s),i===t.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!di.has(i)||2!==t.length)return;const[n,s]=t,r=b(n),a=b(s);if(M(n)!==M(s)&&k[i])this.needsMeasurement=!0;else if(r!==a)if(V(r)&&V(a))for(let e=0;e<t.length;e++){const i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else k[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)(null===t[e]||wi(t[e]))&&i.push(e);i.length&&function(t,e,i){let n,s=0;for(;s<t.length&&!n;){const e=t[s];"string"==typeof e&&!Si.has(e)&&l(e).values.length&&(n=t[s]),s++}if(n&&i)for(const s of e)t[s]=D(i,n)}(t,i,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:i}=this;if(!t||!t.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=k[i](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const n=e[e.length-1];void 0!==n&&t.getValue(i,n).jump(n,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const n=t.getValue(e);n&&n.jump(this.measuredOrigin,!1);const s=i.length-1,o=i[s];i[s]=k[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,i])=>{t.getValue(e).set(i)}),this.resolveNoneKeyframes()}}const Ai={x:!1,y:!1};function Di(){return Ai.x||Ai.y}function bi(t,e){const i=function(t){if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t)}(t),n=new AbortController;return[i,{passive:!0,...e,signal:n.signal},()=>n.abort()]}function Mi(t){return!("touch"===t.pointerType||Di())}const ki=(t,e)=>!!e&&(t===e||ki(t,e.parentElement)),Vi=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Ci=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Li(t){return Ci.has(t.tagName)||!0===t.isContentEditable}const Ri=new WeakSet;function ji(t){return e=>{"Enter"===e.key&&t(e)}}function Bi(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Oi(t){return Vi(t)&&!Di()}function Fi(t,e,i={}){const[n,s,o]=bi(t,i),r=t=>{const n=t.currentTarget;if(!Oi(t))return;Ri.add(n);const o=e(n,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Ri.has(n)&&Ri.delete(n),Oi(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,n===window||n===document||i.useGlobalTarget||ki(n,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",l,s)};return n.forEach(t=>{var e;(i.useGlobalTarget?window:t).addEventListener("pointerdown",r,s),vt(e=t)&&"offsetHeight"in e&&(t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const n=ji(()=>{if(Ri.has(i))return;Bi(i,"down");const t=ji(()=>{Bi(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>Bi(i,"cancel"),e)});i.addEventListener("keydown",n,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",n),e)})(t,s)),Li(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}function Ii(t){return vt(t)&&"ownerSVGElement"in t}class Ui{constructor(t){this.isMounted=!1,this.node=t}update(){}}class $i extends C{constructor(){super(...arguments),this.KeyframeResolver=Ei}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const i=t.style;return i?i[e]:void 0}removeValueFromRenderState(t,{vars:e,style:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;S(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function Ni({top:t,left:e,right:i,bottom:n}){return{x:{min:e,max:i},y:{min:t,max:n}}}function Wi(t){return void 0===t||1===t}function zi({scale:t,scaleX:e,scaleY:i}){return!Wi(t)||!Wi(e)||!Wi(i)}function Ki(t){return zi(t)||Gi(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Gi(t){return Hi(t.x)||Hi(t.y)}function Hi(t){return t&&"0%"!==t}function Yi(t,e,i){return i+e*(t-i)}function Xi(t,e,i,n,s){return void 0!==s&&(t=Yi(t,s,n)),Yi(t,i,n)+e}function qi(t,e=0,i=1,n,s){t.min=Xi(t.min,e,i,n,s),t.max=Xi(t.max,e,i,n,s)}function _i(t,{x:e,y:i}){qi(t.x,e.translate,e.scale,e.originPoint),qi(t.y,i.translate,i.scale,i.originPoint)}const Zi=.999999999999,Ji=1.0000000000001;function Qi(t,e){t.min=t.min+e,t.max=t.max+e}function tn(t,i,n,s,o=.5){qi(t,i,n,e(t.min,t.max,o),s)}function en(t,e){tn(t.x,e.x,e.scaleX,e.scale,e.originX),tn(t.y,e.y,e.scaleY,e.scale,e.originY)}function nn(t,e){return Ni(function(t,e){if(!e)return t;const i=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:n.y,right:n.x}}(t.getBoundingClientRect(),e))}function sn(t,{style:e,vars:i},n,s){const o=t.style;let r;for(r in e)o[r]=e[r];for(r in s?.applyProjectionStyles(o,n),i)o.setProperty(r,i[r])}class on extends $i{constructor(){super(...arguments),this.type="html",this.renderInstance=sn}readValueFromInstance(t,e){if(x.has(e))return this.projection?.isProjecting?L(e):R(t,e);{const n=(i=t,window.getComputedStyle(i)),s=(j(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof s?s.trim():s}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return nn(t,e)}build(t,e,i){B(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return O(t,e,i)}}const rn=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);class an extends $i{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=I}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(x.has(e)){const t=W(e);return t&&t.default||0}return e=rn.has(e)?e:F(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return U(t,e,i)}build(t,e,i){$(t,e,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,e,i,n){!function(t,e,i,n){sn(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(rn.has(i)?i:F(i),e.attrs[i])}(t,e,0,n)}mount(t){this.isSVGTag=N(t.tagName),super.mount(t)}}const ln=K.length;function hn(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&hn(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let i=0;i<ln;i++){const n=K[i],s=t.props[n];(z(s)||!1===s)&&(e[n]=s)}return e}function un(t,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==t.length)return!1;for(let n=0;n<i;n++)if(e[n]!==t[n])return!1;return!0}const cn=[...H].reverse(),dn=H.length;function mn(t){return e=>Promise.all(e.map(({animation:e,options:i})=>function(t,e,i={}){let n;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>Pi(t,e,i));n=Promise.all(s)}else if("string"==typeof e)n=Pi(t,e,i);else{const s="function"==typeof e?mi(t,e,i.custom):e;n=Promise.all(Ti(t,s,i))}return n.then(()=>{t.notify("AnimationComplete",e)})}(t,e,i)))}function pn(t){let e=mn(t),i=gn(),n=!0;const s=e=>(i,n)=>{const s=mi(t,n,"exit"===e?t.presenceContext?.custom:void 0);if(s){const{transition:t,transitionEnd:e,...n}=s;i={...i,...n,...e}}return i};function o(o){const{props:r}=t,a=hn(t.parent)||{},l=[],h=new Set;let u={},c=1/0;for(let e=0;e<dn;e++){const d=cn[e],m=i[d],p=void 0!==r[d]?r[d]:a[d],f=z(p),y=d===o?m.isActive:null;!1===y&&(c=e);let g=p===a[d]&&p!==r[d]&&f;if(g&&n&&t.manuallyAnimateOnMount&&(g=!1),m.protectedKeys={...u},!m.isActive&&null===y||!p&&!m.prevProp||G(p)||"boolean"==typeof p)continue;const v=fn(m.prevProp,p);let x=v||d===o&&m.isActive&&!g&&f||e>c&&f,T=!1;const P=Array.isArray(p)?p:[p];let w=P.reduce(s(d),{});!1===y&&(w={});const{prevResolvedValues:S={}}=m,E={...S,...w},A=e=>{x=!0,h.has(e)&&(T=!0,h.delete(e)),m.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in E){const e=w[t],i=S[t];if(u.hasOwnProperty(t))continue;let n=!1;n=pi(e)&&pi(i)?!un(e,i):e!==i,n?null!=e?A(t):h.add(t):void 0!==e&&h.has(t)?A(t):m.protectedKeys[t]=!0}m.prevProp=p,m.prevResolvedValues=w,m.isActive&&(u={...u,...w}),n&&t.blockInitialAnimation&&(x=!1);const D=g&&v;x&&(!D||T)&&l.push(...P.map(e=>{const i={type:d};if("string"==typeof e&&n&&!D&&t.manuallyAnimateOnMount&&t.parent){const{parent:n}=t,s=mi(n,e);if(n.enteringChildren&&s){const{delayChildren:e}=s.transition||{};i.delay=ui(n.enteringChildren,t,e)}}return{animation:e,options:i}}))}if(h.size){const e={};if("boolean"!=typeof r.initial){const i=mi(t,Array.isArray(r.initial)?r.initial[0]:r.initial);i&&i.transition&&(e.transition=i.transition)}h.forEach(i=>{const n=t.getBaseTarget(i),s=t.getValue(i);s&&(s.liveStyle=!0),e[i]=n??null}),l.push({animation:e})}let d=Boolean(l.length);return!n||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),n=!1,d?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,n){if(i[e].isActive===n)return Promise.resolve();t.variantChildren?.forEach(t=>t.animationState?.setActive(e,n)),i[e].isActive=n;const s=o(e);for(const t in i)i[t].protectedKeys={};return s},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=gn()}}}function fn(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!un(e,t)}function yn(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function gn(){return{animate:yn(!0),whileInView:yn(),whileHover:yn(),whileTap:yn(),whileDrag:yn(),whileFocus:yn(),exit:yn()}}function vn(t){return t.max-t.min}function xn(t,i,n,s=.5){t.origin=s,t.originPoint=e(i.min,i.max,t.origin),t.scale=vn(n)/vn(i),t.translate=e(n.min,n.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function Tn(t,e,i,n){xn(t.x,e.x,i.x,n?n.originX:void 0),xn(t.y,e.y,i.y,n?n.originY:void 0)}function Pn(t,e,i){t.min=i.min+e.min,t.max=t.min+vn(e)}function wn(t,e,i){t.min=e.min-i.min,t.max=t.min+vn(e)}function Sn(t,e,i){wn(t.x,e.x,i.x),wn(t.y,e.y,i.y)}function En(t,e,i,n,s){return t=Yi(t-=e,1/i,n),void 0!==s&&(t=Yi(t,1/s,n)),t}function An(t,i,[n,s,o],r,a){!function(t,i=0,n=1,s=.5,o,r=t,a=t){Y.test(i)&&(i=parseFloat(i),i=e(a.min,a.max,i/100)-a.min);if("number"!=typeof i)return;let l=e(r.min,r.max,s);t===r&&(l-=i),t.min=En(t.min,i,n,l,o),t.max=En(t.max,i,n,l,o)}(t,i[n],i[s],i[o],i.scale,r,a)}const Dn=["x","scaleX","originX"],bn=["y","scaleY","originY"];function Mn(t,e,i,n){An(t.x,e,Dn,i?i.x:void 0,n?n.x:void 0),An(t.y,e,bn,i?i.y:void 0,n?n.y:void 0)}function kn(t,e){t.min=e.min,t.max=e.max}function Vn(t,e){kn(t.x,e.x),kn(t.y,e.y)}function Cn(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Ln(t){return 0===t.translate&&1===t.scale}function Rn(t){return Ln(t.x)&&Ln(t.y)}function jn(t,e){return t.min===e.min&&t.max===e.max}function Bn(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function On(t,e){return Bn(t.x,e.x)&&Bn(t.y,e.y)}function Fn(t){return vn(t.x)/vn(t.y)}function In(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function Un(t){return[t("x"),t("y")]}const $n=["TopLeft","TopRight","BottomLeft","BottomRight"],Nn=$n.length,Wn=t=>"string"==typeof t?parseFloat(t):t,zn=t=>"number"==typeof t||X.test(t);function Kn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Gn=Yn(0,.5,jt),Hn=Yn(.5,.95,t);function Yn(t,e,i){return n=>n<t?0:n>e?1:i(wt(t,e,n))}function Xn(t,e,i,n={passive:!0}){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i)}const qn=(t,e)=>t.depth-e.depth;class _n{constructor(){this.children=[],this.isDirty=!1}add(t){q(this.children,t),this.isDirty=!0}remove(t){_(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(qn),this.isDirty=!1,this.children.forEach(t)}}class Zn{constructor(){this.members=[]}add(t){q(this.members,t),t.scheduleRender()}remove(t){if(_(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let i;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){i=e;break}}return!!i&&(this.promote(i),!0)}promote(t,e){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,e&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:n}=t.options;!1===n&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:i}=t;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Jn={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Qn=["","X","Y","Z"];let ts=0;function es(t,e,i,n){const{latestValues:s}=e;s[t]&&(i[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function is(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const i=vi(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",h,!(e||n))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&is(n)}function ns({attachResizeListener:t,defaultParent:i,measureScroll:n,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(t={},e=i?.()){this.id=ts++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(rs),this.nodes.forEach(ms),this.nodes.forEach(ps),this.nodes.forEach(as)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new _n)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Z),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const i=this.eventHandlers.get(t);i&&i.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e){if(this.instance)return;var i;this.isSVG=Ii(e)&&!(Ii(i=e)&&"svg"===i.tagName),this.instance=e;const{layoutId:n,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||n)&&(this.isLayoutDirty=!0),t){let i,n=0;const s=()=>this.root.updateBlockedByResize=!1;h.read(()=>{n=window.innerWidth}),t(e,()=>{const t=window.innerWidth;t!==n&&(n=t,this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=d.now(),n=({timestamp:s})=>{const o=s-i;o>=e&&(u(n),t(o-e))};return h.setup(n,!0),()=>u(n)}(s,250),Jn.hasAnimatedSinceResize&&(Jn.hasAnimatedSinceResize=!1,this.nodes.forEach(ds)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&o&&(n||s)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeLayoutChanged:i,layout:n})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const s=this.options.transition||o.getDefaultTransition()||Ts,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!On(this.targetLayout,n),h=!e&&i;if(this.options.layoutRoot||this.resumeFrom||h||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const e={...si(s,"layout"),onPlay:r,onComplete:a};(o.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e),this.setAnimationOrigin(t,h)}else e||ds(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),u(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fs),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&is(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(hs);if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(us);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(cs),this.nodes.forEach(ss),this.nodes.forEach(os)):this.nodes.forEach(us),this.clearAllSnapshots();const t=d.now();c.delta=p(0,1e3/60,t-c.timestamp),c.timestamp=t,c.isProcessing=!0,J.update.process(c),J.preRender.process(c),J.render.process(c),c.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Q.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ls),this.sharedNodes.forEach(ys)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,h.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){h.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||vn(this.snapshot.measuredBox.x)||vn(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=I(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=s(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!o)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!Rn(this.projectionDelta),i=this.getTransformTemplate(),n=i?i(this.latestValues,""):void 0,s=n!==this.prevTransformTemplateValue;t&&this.instance&&(e||Ki(this.latestValues)||s)&&(o(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let i=this.removeElementScroll(e);var n;return t&&(i=this.removeTransform(i)),Ss((n=i).x),Ss(n.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return I();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(As))){const{scroll:t}=this.root;t&&(Qi(e.x,t.offset.x),Qi(e.y,t.offset.y))}return e}removeElementScroll(t){const e=I();if(Vn(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const n=this.path[i],{scroll:s,options:o}=n;n!==this.root&&s&&o.layoutScroll&&(s.wasRoot&&Vn(e,t),Qi(e.x,s.offset.x),Qi(e.y,s.offset.y))}return e}applyTransform(t,e=!1){const i=I();Vn(i,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];!e&&n.options.layoutScroll&&n.scroll&&n!==n.root&&en(i,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),Ki(n.latestValues)&&en(i,n.latestValues)}return Ki(this.latestValues)&&en(i,this.latestValues),i}removeTransform(t){const e=I();Vn(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!i.instance)continue;if(!Ki(i.latestValues))continue;zi(i.latestValues)&&i.updateSnapshot();const n=I();Vn(n,i.measurePageBox()),Mn(e,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,n)}return Ki(this.latestValues)&&Mn(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==c.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:s}=this.options;if(!this.layout||!n&&!s)return;this.resolvedRelativeTargetAt=c.timestamp;const o=this.getClosestProjectingParent();var r,a,l;(o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta)&&(this.target||(this.target=I(),this.targetWithTransforms=I()),this.relativeTarget&&this