framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 110 kB
JavaScript
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{createContext as n,useContext as i,useId as s,useEffect as o,useCallback as r,Component as a,useMemo as l,useLayoutEffect as u,useRef as h,useInsertionEffect as c,forwardRef as d,Fragment as p,createElement as m}from"react";function f(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function y(t){const e=[{},{}];return t?.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function g(t,e,n,i){if("function"==typeof e){const[s,o]=y(i);e=e(void 0!==n?n:t.custom,s,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[s,o]=y(i);e=e(void 0!==n?n:t.custom,s,o)}return e}function v(t,e,n){const i=t.getProps();return g(i,e,void 0!==n?n:i.custom,t)}function x(t,e){-1===t.indexOf(e)&&t.push(e)}function T(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const w=(t,e,n)=>n>e?e:n<t?t:n;const P={},S=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),b=t=>/^0[^.\s]+$/u.test(t);function A(t){let e;return()=>(void 0===e&&(e=t()),e)}const V=t=>t,E=(t,e)=>n=>e(t(n)),M=(...t)=>t.reduce(E),D=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class C{constructor(){this.subscriptions=[]}add(t){return x(this.subscriptions,t),()=>T(this.subscriptions,t)}notify(t,e,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](t,e,n);else for(let s=0;s<i;s++){const i=this.subscriptions[s];i&&i(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const k=t=>1e3*t,R=t=>t/1e3;function L(t,e){return e?t*(1e3/e):0}const j=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function B(t,e,n,i){if(t===e&&n===i)return V;const s=e=>function(t,e,n,i,s){let o,r,a=0;do{r=e+(n-e)/2,o=j(r,i,s)-t,o>0?n=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:j(s(t),e,i)}const F=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,O=t=>e=>1-t(1-e),I=B(.33,1.53,.69,.99),U=O(I),N=F(U),W=t=>(t*=2)<1?.5*U(t):.5*(2-Math.pow(2,-10*(t-1))),$=t=>1-Math.sin(Math.acos(t)),Y=O($),X=F($),K=B(.42,0,1,1),z=B(0,0,.58,1),H=B(.42,0,.58,1),q=t=>Array.isArray(t)&&"number"==typeof t[0],G={linear:V,easeIn:K,easeInOut:H,easeOut:z,circIn:$,circInOut:X,circOut:Y,backIn:U,backInOut:N,backOut:I,anticipate:W},Z=t=>{if(q(t)){t.length;const[e,n,i,s]=t;return B(e,n,i,s)}return"string"==typeof t?G[t]:t},_=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],J={value:null,addProjectionMetrics:null};function Q(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=_.reduce(((t,n)=>(t[n]=function(t,e){let n=new Set,i=new Set,s=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function u(e){r.has(e)&&(h.schedule(e),t()),l++,e(a)}const h={schedule:(t,e=!1,o=!1)=>{const a=o&&s?n:i;return e&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),r.delete(t)},process:t=>{a=t,s?o=!0:(s=!0,[n,i]=[i,n],n.forEach(u),e&&J.value&&J.value.frameloop[e].push(l),l=0,n.clear(),s=!1,o&&(o=!1,h.process(t)))}};return h}(o,e?n:void 0),t)),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:h,update:c,preRender:d,render:p,postRender:m}=r,f=()=>{const o=P.useManualTiming?s.timestamp:performance.now();n=!1,P.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(o-s.timestamp,40),1)),s.timestamp=o,s.isProcessing=!0,a.process(s),l.process(s),u.process(s),h.process(s),c.process(s),d.process(s),p.process(s),m.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(f))};return{schedule:_.reduce(((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(n||(n=!0,i=!0,s.isProcessing||t(f)),a.schedule(e,o,r)),e}),{}),cancel:t=>{for(let e=0;e<_.length;e++)r[_[e]].cancel(t)},state:s,steps:r}}const{schedule:tt,cancel:et,state:nt,steps:it}=Q("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:V,!0);let st;function ot(){st=void 0}const rt={now:()=>(void 0===st&&rt.set(nt.isProcessing||P.useManualTiming?nt.timestamp:performance.now()),st),set:t=>{st=t,queueMicrotask(ot)}},at=t=>e=>"string"==typeof e&&e.startsWith(t),lt=at("--"),ut=at("var(--"),ht=t=>!!ut(t)&&ct.test(t.split("/*")[0].trim()),ct=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,dt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},pt={...dt,transform:t=>w(0,1,t)},mt={...dt,default:1},ft=t=>Math.round(1e5*t)/1e5,yt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const gt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,vt=(t,e)=>n=>Boolean("string"==typeof n&>.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),xt=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(yt);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},Tt={...dt,transform:t=>Math.round((t=>w(0,255,t))(t))},wt={test:vt("rgb","red"),parse:xt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Tt.transform(t)+", "+Tt.transform(e)+", "+Tt.transform(n)+", "+ft(pt.transform(i))+")"};const Pt={test:vt("#"),parse:function(t){let e="",n="",i="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}},transform:wt.transform},St=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),bt=St("deg"),At=St("%"),Vt=St("px"),Et=St("vh"),Mt=St("vw"),Dt=(()=>({...At,parse:t=>At.parse(t)/100,transform:t=>At.transform(100*t)}))(),Ct={test:vt("hsl","hue"),parse:xt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+At.transform(ft(e))+", "+At.transform(ft(n))+", "+ft(pt.transform(i))+")"},kt={test:t=>wt.test(t)||Pt.test(t)||Ct.test(t),parse:t=>wt.test(t)?wt.parse(t):Ct.test(t)?Ct.parse(t):Pt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?wt.transform(t):Ct.transform(t)},Rt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Lt="number",jt="color",Bt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ft(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(Bt,(t=>(kt.test(t)?(i.color.push(o),s.push(jt),n.push(kt.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(Lt),n.push(parseFloat(t))),++o,"${}"))).split("${}");return{values:n,split:r,indexes:i,types:s}}function Ot(t){return Ft(t).values}function It(t){const{split:e,types:n}=Ft(t),i=e.length;return t=>{let s="";for(let o=0;o<i;o++)if(s+=e[o],void 0!==t[o]){const e=n[o];s+=e===Lt?ft(t[o]):e===jt?kt.transform(t[o]):t[o]}return s}}const Ut=t=>"number"==typeof t?0:t;const Nt={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(yt)?.length||0)+(t.match(Rt)?.length||0)>0},parse:Ot,createTransformer:It,getAnimatableNone:function(t){const e=Ot(t);return It(t)(e.map(Ut))}};function Wt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function $t(t,e){return n=>n>0?e:t}const Yt=(t,e,n)=>t+(e-t)*n,Xt=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Kt=[Pt,wt,Ct];function zt(t){const e=(n=t,Kt.find((t=>t.test(n))));var n;if(!Boolean(e))return!1;let i=e.parse(t);return e===Ct&&(i=function({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,o=0,r=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=Wt(a,i,t+1/3),o=Wt(a,i,t),r=Wt(a,i,t-1/3)}else s=o=r=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:i}}(i)),i}const Ht=(t,e)=>{const n=zt(t),i=zt(e);if(!n||!i)return $t(t,e);const s={...n};return t=>(s.red=Xt(n.red,i.red,t),s.green=Xt(n.green,i.green,t),s.blue=Xt(n.blue,i.blue,t),s.alpha=Yt(n.alpha,i.alpha,t),wt.transform(s))},qt=new Set(["none","hidden"]);function Gt(t,e){return n=>Yt(t,e,n)}function Zt(t){return"number"==typeof t?Gt:"string"==typeof t?ht(t)?$t:kt.test(t)?Ht:Qt:Array.isArray(t)?_t:"object"==typeof t?kt.test(t)?Ht:Jt:$t}function _t(t,e){const n=[...t],i=n.length,s=t.map(((t,n)=>Zt(t)(t,e[n])));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Jt(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=Zt(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const Qt=(t,e)=>{const n=Nt.createTransformer(e),i=Ft(t),s=Ft(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?qt.has(t)&&!s.values.length||qt.has(e)&&!i.values.length?function(t,e){return qt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):M(_t(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][i[o]],a=t.values[r]??0;n[s]=a,i[o]++}return n}(i,s),s.values),n):$t(t,e)};function te(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Yt(t,e,n);return Zt(t)(t,e)}const ee=t=>{const e=({timestamp:e})=>t(e);return{start:()=>tt.update(e,!0),stop:()=>et(e),now:()=>nt.isProcessing?nt.timestamp:rt.now()}},ne=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=t(e/(s-1))+", ";return`linear(${i.substring(0,i.length-2)})`},ie=2e4;function se(t){let e=0;let n=t.next(e);for(;!n.done&&e<ie;)e+=50,n=t.next(e);return e>=ie?1/0:e}function oe(t,e,n){const i=Math.max(e-5,0);return L(n-t(i),e-i)}const re=100,ae=10,le=1,ue=0,he=800,ce=.3,de=.3,pe={granular:.01,default:2},me={granular:.005,default:.5},fe=.01,ye=10,ge=.05,ve=1,xe=.001;function Te({duration:t=he,bounce:e=ce,velocity:n=ue,mass:i=le}){let s,o,r=1-e;r=w(ge,ve,r),t=w(fe,ye,R(t)),r<1?(s=e=>{const i=e*r,s=i*t,o=i-n,a=Pe(e,r),l=Math.exp(-s);return xe-o/a*l},o=e=>{const i=e*r*t,o=i*n+n,a=Math.pow(r,2)*Math.pow(e,2)*t,l=Math.exp(-i),u=Pe(Math.pow(e,2),r);return(-s(e)+xe>0?-1:1)*((o-a)*l)/u}):(s=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<we;n++)i-=t(i)/e(i);return i}(s,o,5/t);if(t=k(t),isNaN(a))return{stiffness:re,damping:ae,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*r*Math.sqrt(i*e),duration:t}}}const we=12;function Pe(t,e){return t*Math.sqrt(1-e*e)}const Se=["duration","bounce"],be=["stiffness","damping","mass"];function Ae(t,e){return e.some((e=>void 0!==t[e]))}function Ve(t=de,e=ce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const o=n.keyframes[0],r=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:u,mass:h,duration:c,velocity:d,isResolvedFromDuration:p}=function(t){let e={velocity:ue,stiffness:re,damping:ae,mass:le,isResolvedFromDuration:!1,...t};if(!Ae(t,be)&&Ae(t,Se))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,o=2*w(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:le,stiffness:s,damping:o}}else{const n=Te(t);e={...e,...n,mass:le},e.isResolvedFromDuration=!0}return e}({...n,velocity:-R(n.velocity||0)}),m=d||0,f=u/(2*Math.sqrt(l*h)),y=r-o,g=R(Math.sqrt(l/h)),v=Math.abs(y)<5;let x;if(i||(i=v?pe.granular:pe.default),s||(s=v?me.granular:me.default),f<1){const t=Pe(g,f);x=e=>{const n=Math.exp(-f*g*e);return r-n*((m+f*g*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===f)x=t=>r-Math.exp(-g*t)*(y+(m+g*y)*t);else{const t=g*Math.sqrt(f*f-1);x=e=>{const n=Math.exp(-f*g*e),i=Math.min(t*e,300);return r-n*((m+f*g*y)*Math.sinh(i)+t*y*Math.cosh(i))/t}}const T={calculatedDuration:p&&c||null,next:t=>{const e=x(t);if(p)a.done=t>=c;else{let n=0===t?m:0;f<1&&(n=0===t?k(m):oe(x,t,e));const o=Math.abs(n)<=i,l=Math.abs(r-e)<=s;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(se(T),ie),e=ne((e=>T.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return T}function Ee({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:u=.5,restSpeed:h}){const c=t[0],d={done:!1,value:c},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=n*e;const f=c+m,y=void 0===r?f:r(f);y!==f&&(m=y-c);const g=t=>-m*Math.exp(-t/i),v=t=>y+g(t),x=t=>{const e=g(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?y:n};let T,w;const P=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,w=Ve({keyframes:[d.value,p(d.value)],velocity:oe(v,t,d.value),damping:s,stiffness:o,restDelta:u,restSpeed:h}))};return P(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==T||(e=!0,x(t),P(t)),void 0!==T&&t>=T?w.next(t-T):(!e&&x(t),d)}}}function Me(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const o=t.length;if(e.length,1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const r=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const i=[],s=n||P.mix||te,o=t.length-1;for(let n=0;n<o;n++){let o=s(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||V:e;o=M(t,o)}i.push(o)}return i}(e,i,s),l=a.length,u=n=>{if(r&&n<t[0])return e[0];let i=0;if(l>1)for(;i<t.length-2&&!(n<t[i+1]);i++);const s=D(t[i],t[i+1],n);return a[i](s)};return n?e=>u(w(t[0],t[o-1],e)):u}function De(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=D(0,e,i);t.push(Yt(n,1,s))}}(e,t.length-1),e}function Ce({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(Z):Z(i),o={done:!1,value:e[0]},r=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:De(e),t),a=Me(r,e,{ease:Array.isArray(s)?s:(l=e,u=s,l.map((()=>u||H)).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}Ve.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(se(i),ie);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:R(s)}}(t,100,Ve);return t.ease=e.ease,t.duration=k(e.duration),t.type="keyframes",t};const ke=t=>null!==t;function Re(t,{repeat:e,repeatType:n="loop"},i,s=1){const o=t.filter(ke),r=s<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return r&&void 0!==i?i:o[r]}const Le={decay:Ee,inertia:Ee,tween:Ce,keyframes:Ce,spring:Ve};function je(t){"string"==typeof t.type&&(t.type=Le[t.type])}class Be{constructor(){this.count=0,this.updateFinished()}get finished(){return this._finished}updateFinished(){this.count++,this._finished=new Promise((t=>{this.resolve=t}))}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const Fe=t=>t/100;class Oe 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;if(t&&t.updatedAt!==rt.now()&&this.tick(rt.now()),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:e}=this.options;e&&e()},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;je(t);const{type:e=Ce,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||Ce;a!==Ce&&"number"!=typeof r[0]&&(this.mixKeyframes=M(Fe,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:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(n+1)-i,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:n,totalDuration:i,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:r,calculatedDuration:a}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:u,repeat:h,repeatType:c,repeatDelay:d,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const y=this.currentTime-l*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let v=this.currentTime,x=n;if(h){const t=Math.min(this.currentTime,i)/r;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,h+1);Boolean(e%2)&&("reverse"===c?(n=1-n,d&&(n-=d/r)):"mirror"===c&&(x=o)),v=w(0,1,n)*r}const T=g?{done:!1,value:u[0]}:x.next(v);s&&(T.value=s(T.value));let{done:P}=T;g||null===a||(P=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&P);return S&&p!==Ee&&(T.value=Re(u,this.options,f,this.speed)),m&&m(T.value),S&&this.finish(),T}then(t,e){return this.finished.then(t,e)}get duration(){return R(this.calculatedDuration)}get time(){return R(this.currentTime)}set time(t){t=k(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)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(rt.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=R(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ee,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();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=n??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(rt.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown()}teardown(){this.notifyFinished(),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()),t.observe(this)}}const Ie=t=>180*t/Math.PI,Ue=t=>{const e=Ie(Math.atan2(t[1],t[0]));return We(e)},Ne={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Ue,rotateZ:Ue,skewX:t=>Ie(Math.atan(t[1])),skewY:t=>Ie(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},We=t=>((t%=360)<0&&(t+=360),t),$e=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Ye=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Xe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:$e,scaleY:Ye,scale:t=>($e(t)+Ye(t))/2,rotateX:t=>We(Ie(Math.atan2(t[6],t[5]))),rotateY:t=>We(Ie(Math.atan2(-t[2],t[0]))),rotateZ:Ue,rotate:Ue,skewX:t=>Ie(Math.atan(t[4])),skewY:t=>Ie(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ke(t){return t.includes("scale")?1:0}function ze(t,e){if(!t||"none"===t)return Ke(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=Xe,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=Ne,s=e}if(!s)return Ke(e);const o=i[e],r=s[1].split(",").map(He);return"function"==typeof o?o(r):r[o]}function He(t){return parseFloat(t.trim())}const qe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ge=(()=>new Set(qe))(),Ze=t=>t===dt||t===Vt,_e=new Set(["x","y","z"]),Je=qe.filter((t=>!_e.has(t)));const Qe={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>ze(e,"x"),y:(t,{transform:e})=>ze(e,"y")};Qe.translateX=Qe.x,Qe.translateY=Qe.y;const tn=new Set;let en=!1,nn=!1,sn=!1;function on(){if(nn){const t=Array.from(tn).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Je.forEach((n=>{const i=t.getValue(n);void 0!==i&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{t.getValue(e)?.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}nn=!1,en=!1,tn.forEach((t=>t.complete(sn))),tn.clear()}function rn(){tn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(nn=!0)}))}class an{constructor(t,e,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(tn.add(this),en||(en=!0,tt.read(rn),tt.resolveKeyframes(on))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;if(null===t[0]){const s=i?.get(),o=t[t.length-1];if(void 0!==s)t[0]=s;else if(n&&e){const i=n.readValue(e,o);null!=i&&(t[0]=i)}void 0===t[0]&&(t[0]=o),i&&void 0===s&&i.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),tn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,tn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const ln=A((()=>void 0!==window.ScrollTimeline)),un={};function hn(t,e){const n=A(t);return()=>un[e]??n()}const cn=hn((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),dn=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,pn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dn([0,.65,.55,1]),circOut:dn([.55,0,1,.45]),backIn:dn([.31,.01,.66,-.59]),backOut:dn([.33,1.53,.69,.99])};function mn(t,e){return t?"function"==typeof t?cn()?ne(t,e):"ease-out":q(t)?dn(t):Array.isArray(t)?t.map((t=>mn(t,e)||pn.easeOut)):pn[t]:void 0}function fn(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},u=void 0){const h={[e]:n};l&&(h.offset=l);const c=mn(a,s);Array.isArray(c)&&(h.easing=c);const d={delay:i,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};u&&(d.pseudoElement=u);return t.animate(h,d)}function yn(t){return"function"==typeof t&&"applyToOptions"in t}class gn extends Be{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:r,onComplete:a}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=o,this.options=t,t.type;const l=function({type:t,...e}){return yn(t)&&cn()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=fn(e,n,i,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const t=Re(i,this.options,r,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}a?.(),this.notifyFinished()},this.animation.oncancel=()=>this.notifyFinished()}play(){this.isStopped||(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 R(Number(t))}get time(){return R(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=k(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 Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&ln()?(this.animation.timeline=t,V):e(this)}}const vn={anticipate:W,backInOut:N,circInOut:X};function xn(t){"string"==typeof t.ease&&t.ease in vn&&(t.ease=vn[t.ease])}class Tn extends gn{constructor(t){xn(t),je(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:i,element:s,...o}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const r=new Oe({...o,autoplay:!1}),a=k(this.finishedTime??this.time);e.setWithVelocity(r.sample(a-10).value,r.sample(a).value,10),r.stop()}}const wn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Nt.test(t)&&"0"!==t||t.startsWith("url(")));const Pn=new Set(["opacity","clipPath","filter","transform"]),Sn=A((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class bn extends Be{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",keyframes:r,name:a,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation?(this._animation.stop(),this.stopTimeline?.()):this.keyframeResolver?.cancel()},this.createdAt=rt.now();const c={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:o,name:a,motionValue:l,element:u,...h},d=u?.KeyframeResolver||an;this.keyframeResolver=new d(r,((t,e,n)=>this.onKeyframesResolved(t,e,c,!n)),a,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:s,type:o,velocity:r,delay:a,isHandoff:l,onUpdate:u}=n;this.resolvedAt=rt.now(),function(t,e,n,i){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=wn(s,e),a=wn(o,e);return!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||yn(n))&&i)}(t,s,o,r)||(!P.instantAnimations&&a||u?.(Re(t,n,e)),t[0]=t[t.length-1],n.duration=0,n.repeat=0);const h={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},c=!l&&function(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:o,type:r}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return Sn()&&n&&Pn.has(n)&&("transform"!==n||!l)&&!a&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}(h)?new Tn({...h,element:h.motionValue.owner.current}):new Oe(h);c.finished.then((()=>this.notifyFinished())).catch(V),this.pendingTimeline&&(this.stopTimeline=c.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=c}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then((()=>{}))}get animation(){return this._animation||(sn=!0,rn(),on(),sn=!1),this._animation}get duration(){return this.animation.duration}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.cancel()}}const An=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Vn(t,e,n=1){const[i,s]=function(t){const e=An.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}(t);if(!i)return;const o=window.getComputedStyle(e).getPropertyValue(i);if(o){const t=o.trim();return S(t)?parseFloat(t):t}return ht(s)?Vn(s,e,n+1):s}function En(t,e){return t?.[e]??t?.default??t}const Mn=new Set(["width","height","top","left","right","bottom",...qe]),Dn=t=>e=>e.test(t),Cn=[dt,Vt,At,bt,Mt,Et,{test:t=>"auto"===t,parse:t=>t}],kn=t=>Cn.find(Dn(t));const Rn=new Set(["brightness","contrast","saturate","opacity"]);function Ln(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(yt)||[];if(!i)return t;const s=n.replace(i,"");let o=Rn.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const jn=/\b([a-z-]*)\(.*?\)/gu,Bn={...Nt,getAnimatableNone:t=>{const e=t.match(jn);return e?e.map(Ln).join(" "):t}},Fn={...dt,transform:Math.round},On={borderWidth:Vt,borderTopWidth:Vt,borderRightWidth:Vt,borderBottomWidth:Vt,borderLeftWidth:Vt,borderRadius:Vt,radius:Vt,borderTopLeftRadius:Vt,borderTopRightRadius:Vt,borderBottomRightRadius:Vt,borderBottomLeftRadius:Vt,width:Vt,maxWidth:Vt,height:Vt,maxHeight:Vt,top:Vt,right:Vt,bottom:Vt,left:Vt,padding:Vt,paddingTop:Vt,paddingRight:Vt,paddingBottom:Vt,paddingLeft:Vt,margin:Vt,marginTop:Vt,marginRight:Vt,marginBottom:Vt,marginLeft:Vt,backgroundPositionX:Vt,backgroundPositionY:Vt,...{rotate:bt,rotateX:bt,rotateY:bt,rotateZ:bt,scale:mt,scaleX:mt,scaleY:mt,scaleZ:mt,skew:bt,skewX:bt,skewY:bt,distance:Vt,translateX:Vt,translateY:Vt,translateZ:Vt,x:Vt,y:Vt,z:Vt,perspective:Vt,transformPerspective:Vt,opacity:pt,originX:Dt,originY:Dt,originZ:Vt},zIndex:Fn,fillOpacity:pt,strokeOpacity:pt,numOctaves:Fn},In={...On,color:kt,backgroundColor:kt,outlineColor:kt,fill:kt,stroke:kt,borderColor:kt,borderTopColor:kt,borderRightColor:kt,borderBottomColor:kt,borderLeftColor:kt,filter:Bn,WebkitFilter:Bn},Un=t=>In[t];function Nn(t,e){let n=Un(t);return n!==Bn&&(n=Nt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Wn=new Set(["auto","none","0"]);class $n extends an{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let i=t[n];if("string"==typeof i&&(i=i.trim(),ht(i))){const s=Vn(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Mn.has(n)||2!==t.length)return;const[i,s]=t,o=kn(i),r=kn(s);if(o!==r)if(Ze(o)&&Ze(r))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||("number"==typeof(i=t[e])?0===i:null===i||"none"===i||"0"===i||b(i)))&&n.push(e);var i;n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!Wn.has(e)&&Ft(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=Nn(n,i)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Qe[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&t.getValue(n,i).jump(i,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const i=t.getValue(e);i&&i.jump(this.measuredOrigin,!1);const s=n.length-1,o=n[s];n[s]=Qe[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach((([e,n])=>{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}}const{schedule:Yn,cancel:Xn}=Q(queueMicrotask,!1),Kn={x:!1,y:!1};function zn(){return Kn.x||Kn.y}function Hn(t,e){const n=function(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const s=n?.[t]??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function qn(t){return!("touch"===t.pointerType||zn())}const Gn=(t,e)=>!!e&&(t===e||Gn(t,e.parentElement)),Zn=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,_n=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Jn=new WeakSet;function Qn(t){return e=>{"Enter"===e.key&&t(e)}}function ti(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function ei(t){return Zn(t)&&!zn()}function ni(t,e,n={}){const[i,s,o]=Hn(t,n),r=t=>{const i=t.currentTarget;if(!ei(t)||Jn.has(i))return;Jn.add(i);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),ei(t)&&Jn.has(i)&&(Jn.delete(i),"function"==typeof o&&o(t,{success:e}))},a=t=>{r(t,i===window||i===document||n.useGlobalTarget||Gn(i,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",l,s)};return i.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",r,s),t instanceof HTMLElement&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=Qn((()=>{if(Jn.has(n))return;ti(n,"down");const t=Qn((()=>{ti(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>ti(n,"cancel")),e)}));n.addEventListener("keydown",i,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",i)),e)})(t,s))),e=t,_n.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),o}class ii{constructor(t,e={}){this.version="12.9.1",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=rt.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change?.notify(this.current),e&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=rt.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new C);const n=this.events[t].add(e);return"change"===t?()=>{n(),tt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=rt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return L(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function si(t,e){return new ii(t,e)}const oi=[...Cn,kt,Nt],ri=(t,e)=>e&&"number"==typeof t?e.transform(t):t,ai=t=>Array.isArray(t);function li(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,si(n))}const ui=t=>Boolean(t&&t.getVelocity);function hi(t,e){const n=t.getValue("willChange");if(i=n,Boolean(ui(i)&&i.add))return n.add(e);if(!n&&P.WillChange){const n=new P.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}const ci=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),di="data-"+ci("framerAppearId");function pi(t){return t.props[di]}const mi=t=>null!==t;const fi={type:"spring",stiffness:500,damping:25,restSpeed:10},yi={type:"keyframes",duration:.8},gi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vi=(t,{keyframes:e})=>e.length>2?yi:Ge.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:fi:gi;const xi=(t,e,n,i={},s,o)=>r=>{const a=En(i,t)||{},l=a.delay||i.delay||0;let{elapsed:u=0}=i;u-=k(l);const h={keyframes:Array.isArray(n)?n:[null,n],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:n,staggerChildren:i,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:u,...h}){return!!Object.keys(h).length})(a)||Object.assign(h,vi(t,h)),h.duration&&(h.duration=k(h.duration)),h.repeatDelay&&(h.repeatDelay=k(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let c=!1;if((!1===h.type||0===h.duration&&!h.repeatDelay)&&(h.duration=0,0===h.delay&&(c=!0)),(P.instantAnimations||P.skipAnimations)&&(c=!0,h.duration=0,h.delay=0),h.allowFlatten=!a.type&&!a.ease,c&&!o&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(mi),o=e&&"loop"!==n&&e%2==1?0:s.length-1;return o&&void 0!==i?i:s[o]}(h.keyframes,a);if(void 0!==t)return void tt.update((()=>{h.onUpdate(t),h.onComplete()}))}return new bn(h)};function Ti({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function wi(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;i&&(o=i);const l=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const i=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||u&&Ti(u,e))continue;const r={delay:n,...En(o||{},e)},h=i.get();if(void 0!==h&&!i.isAnimating&&!Array.isArray(s)&&s===h&&!r.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){const n=pi(t);if(n){const t=window.MotionHandoffAnimation(n,e,tt);null!==t&&(r.startTime=t,c=!0)}}hi(t,e),i.start(xi(e,i,s,t.shouldReduceMotion&&Mn.has(e)?{type:!1}:r,t,c));const d=i.animation;d&&l.push(d)}return r&&Promise.all(l).then((()=>{tt.update((()=>{r&&function(t,e){const n=v(t,e);let{transitionEnd:i={},transition:s={},...o}=n||{};o={...o,...i};for(const e in o)li(t,e,(r=o[e],ai(r)?r[r.length-1]||0:r));var r}(t,r)}))})),l}function Pi(t,e,n={}){const i=v(t,e,"exit"===n.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const o=i?()=>Promise.all(wi(t,i,n)):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(i=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=s;return function(t,e,n=0,i=0,s=1,o){const r=[],a=(t.variantChildren.size-1)*i,l=1===s?(t=0)=>t*i:(t=0)=>a-t*i;return Array.from(t.variantChildren).sort(Si).forEach(((t,i)=>{t.notify("AnimationStart",e),r.push(Pi(t,e,{...o,delay:n+l(i)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(r)}(t,e,o+i,r,a,n)}:()=>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(n.delay)])}function Si(t,e){return t.sortNodePosition(e)}function bi(t,e){if(!Array.isArray(e))return!1;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}function Ai(t){return"string"==typeof t||Array.isArray(t)}const Vi=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ei=["initial",...Vi],Mi=Ei.length;function Di(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Di(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Mi;n++){const i=Ei[n],s=t.props[i];(Ai(s)||!1===s)&&(e[i]=s)}return e}const Ci=[...Vi].reverse(),ki=Vi.length;function Ri(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let i;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map((e=>Pi(t,e,n)));i=Promise.all(s)}else if("string"==typeof e)i=Pi(t,e,n);else{const s="function"==typeof e?v(t,e,n.custom):e;i=Promise.all(wi(t,s,n))}return i.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Li(t){let e=Ri(t),n=Fi(),i=!0;const s=e=>(n,i)=>{const s=v(t,i,"exit"===e?t.presenceContext?.custom:void 0);if(s){const{transition:t,transitionEnd:e,...i}=s;n={...n,...i,...e}}return n};function o(o){const{props:r}=t,a=Di(t.parent)||{},l=[],u=new Set;let h={},c=1/0;for(let e=0;e<ki;e++){const d=Ci[e],p=n[d],m=void 0!==r[d]?r[d]:a[d],y=Ai(m),g=d===o?p.isActive:null;!1===g&&(c=e);let v=m===a[d]&&m!==r[d]&&y;if(v&&i&&t.manuallyAnimateOnMount&&(v=!1),p.protectedKeys={...h},!p.isActive&&null===g||!m&&!p.prevProp||f(m)||"boolean"==typeof m)continue;const x=ji(p.prevProp,m);let T=x||d===o&&p.isActive&&!v&&y||e>c&&y,w=!1;const P=Array.isArray(m)?m:[m];let S=P.reduce(s(d),{});!1===g&&(S={});const{prevResolvedValues:b={}}=p,A={...b,...S},V=e=>{T=!0,u.has(e)&&(w=!0,u.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in A){const e=S[t],n=b[t];if(h.hasOwnProperty(t))continue;let i=!1;i=ai(e)&&ai(n)?!bi(e,n):e!==n,i?null!=e?V(t):u.add(t):void 0!==e&&u.has(t)?V(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(h={...h,...S}),i&&t.blockInitialAnimation&&(T=!1);T&&(!(v&&x)||w)&&l.push(...P.map((t=>({animation:t,options:{type:d}}))))}if(u.size){const e={};if("boolean"!=typeof r.initial){const n=v(t,Array.isArray(r.initial)?r.initial[0]:r.initial);n&&n.transition&&(e.transition=n.transition)}u.forEach((n=>{const i=t.getBaseTarget(n),s=t.getValue(n);s&&(s.liveStyle=!0),e[n]=i??null})),l.push({animation:e})}let d=Boolean(l.length);return!i||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),i=!1,d?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,i){if(n[e].isActive===i)return Promise.resolve();t.variantChildren?.forEach((t=>t.animationState?.setActive(e,i))),n[e].isActive=i;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Fi(),i=!0}}}function ji(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!bi(e,t)}function Bi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Fi(){return{animate:Bi(!0),whileInView:Bi(),whileHover:Bi(),whileTap:Bi(),whileDrag:Bi(),whileFocus:Bi(),exit:Bi()}}class Oi{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Ii=0;const Ui={animation:{Feature:class extends Oi{constructor(t){super(t),t.animationState||(t.animationState=Li(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();f(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends Oi{constructor(){super(...arguments),this.id=Ii++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const i=this.node.animationState.setActive("exit",!t);e&&!t&&i.then((()=>{e(this.id)}))}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function Ni(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Wi(t){return{point:{x:t.pageX,y:t.pageY}}}function $i(t,e,n,i){return Ni(t,e,(t=>e=>Zn(e)&&t(e,Wi(e)))(n),i)}function Yi({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function Xi(t){return t.max-t.min}function Ki(t,e,n,i=.5){t.origin=i,t.originPoint=Yt(e.min,e.max,t.origin),t.scale=Xi(n)/Xi(e),t.translate=Yt(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 zi(t,e,n,i){Ki(t.x,e.x,n.x,i?i.originX:void 0),Ki(t.y,e.y,n.y,i?i.originY:void 0)}function Hi(t,e,n){t.min=n.min+e.min,t.max=t.min+Xi(e)}function qi(t,e,n){t.min=e.min-n.min,t.max=t.min+Xi(e)}function Gi(t,e,n){qi(t.x,e.x,n.x),qi(t.y,e.y,n.y)}const Zi=()=>({x:{min:0,max:0},y:{min:0,max:0}});function _i(t){return[t("x"),t("y")]}function Ji(t){return void 0===t||1===t}function Qi({scale:t,scaleX:e,scaleY:n}){return!Ji(t)||!Ji(e)||!Ji(n)}function ts(t){return Qi(t)||es(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function es(t){return ns(t.x)||ns(t.y)}function ns(t){return t&&"0%"!==t}function is(t,e,n){return n+e*(t-n)}function ss(t,e,n,i,s){return void 0!==s&&(t=is(t,s,i)),is(t,n,i)+e}function os(t,e=0,n=1,i,s){t.min=ss(t.min,e,n,i,s),t.max=ss(t.max,e,n,i,s)}function rs(t,{x:e,y:n}){os(t.x,e.translate,e.scale,e.originPoint),os(t.y,n.translate,n.scale,n.originPoint)}const as=.999999999999,ls=1.0000000000001;function us(t,e){t.min=t.min+e,t.max=t.max+e}function hs(t,e,n,i,s=.5){os(t,e,n,Yt(t.min,t.max,s),i)}function cs(t,e){hs(t.x,e.x,e.scaleX,e.scale,e.originX),hs(t.y,e.y,e.scaleY,e.scale,e.originY)}function ds(t,e){return Yi(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(t.getBoundingClientRect(),e))}const ps=({current:t})=>t?t.ownerDocument.defaultView:null;function ms(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const fs=(t,e)=>Math.abs(t-e);class ys{constructor(t,e,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=xs(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=fs(t.x,e.x),i=fs(t.y,e.y);return Math.sqrt(n**2+i**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:i}=t,{timestamp:s}=nt;this.history.push({...i,timestamp:s});const{onStart:o,onMove:r}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),r&&r(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=gs(e,this.transformPagePoint),tt.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:i,resumeAnimation:s}=this.handlers;if(this.dragSnapToOrigin&&s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=xs("pointercancel"===t.type?this.lastMoveEventInfo:gs(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),i&&i(t,o)},!Zn(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=n,this.contextWindow=i||window;const o=gs(Wi(t),this.transformPagePoint),{point:r}=o,{timestamp:a}=nt;this.history=[{...r,timestamp:a}];const{onSessionStart:l}=e;l&&l(t,xs(o,this.history)),this.removeListeners=M($i(this.contextWindow,"pointermove",this.handlePointerMove),$i(this.contextWindow,"pointerup",this.handlePointerUp),$i(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),et(this.updatePoint)}}function gs(t,e){return e?{point:e(t.point)}:t}function vs(t,e){return{x:t.x-e.x,y:t.y-e.y}}function xs({point:t},e){return{point:t,delta:vs(t,ws(e)),offset:vs(t,Ts(e)),velocity:Ps(e,.1)}}function Ts(t){return t[0]}function ws(t){return t[t.length-1]}function Ps(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=ws(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>k(e)));)n--;if(!i)return{x:0,y:0};const o=R(s.timestamp-i.timestamp);if(0===o)return{x:0,y:0};const r={x:(s.x-i.x)/o,y:(s.y-i.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function Ss(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function bs(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}const As=.35;function Vs(t,e,n){return{min:Es(t,e),max:Es(t,n)}}function Es(t,e){return"number"==typeof t?t:t[e]||0}const Ms=new WeakMap;class Ds{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(