UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines • 123 kB
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{createContext as n,useContext as i,useMemo as s,Fragment as o,createElement as r,useRef as a,useInsertionEffect as l,useCallback as h,useLayoutEffect as u,useEffect as c,forwardRef as d,useId as p,Component as m}from"react";function f(t,e){-1===t.indexOf(e)&&t.push(e)}function y(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const g=(t,e,n)=>n>e?e:n<t?t:n;function v(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let x=()=>{},w=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(x=(t,e,n)=>{t||"undefined"==typeof console||console.warn(v(e,n))},w=(t,e,n)=>{if(!t)throw new Error(v(e,n))});const T={},S=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),P=t=>"object"==typeof t&&null!==t,b=t=>/^0[^.\s]+$/u.test(t);function E(t){let e;return()=>(void 0===e&&(e=t()),e)}const A=t=>t,M=(...t)=>t.reduce((t,e)=>n=>e(t(n))),V=(t,e,n)=>{const i=e-t;return i?(n-t)/i:1};class C{constructor(){this.subscriptions=[]}add(t){return f(this.subscriptions,t),()=>y(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,D=t=>t/1e3,R=(t,e)=>e?t*(1e3/e):0,L=(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 A;const s=e=>function(t,e,n,i,s){let o,r,a=0;do{r=e+(n-e)/2,o=L(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:L(s(t),e,i)}const j=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,F=t=>e=>1-t(1-e),I=B(.33,1.53,.69,.99),O=F(I),U=j(O),W=t=>t>=1?1:(t*=2)<1?.5*O(t):.5*(2-Math.pow(2,-10*(t-1))),N=t=>1-Math.sin(Math.acos(t)),$=F(N),z=j(N),Y=B(.42,0,1,1),X=B(0,0,.58,1),H=B(.42,0,.58,1),K=t=>Array.isArray(t)&&"number"==typeof t[0],G={linear:A,easeIn:Y,easeInOut:H,easeOut:X,circIn:N,circInOut:z,circOut:$,backIn:O,backInOut:U,backOut:I,anticipate:W},q=t=>{if(K(t)){w(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,i,s]=t;return B(e,n,i,s)}return"string"==typeof t?(w(void 0!==G[t],`Invalid easing type '${t}'`,"invalid-easing-type"),G[t]):t},Z=n({}),_=n({strict:!1}),J=n({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Q=n({}),tt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function et(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=tt.reduce((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,i=!1,s=!1;const o=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function a(e){o.has(e)&&(l.schedule(e),t()),e(r)}const l={schedule:(t,s=!1,r=!1)=>{const a=r&&i?e:n;return s&&o.add(t),a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{if(r=t,i)return void(s=!0);i=!0;const o=e;e=n,n=o,e.forEach(a),e.clear(),i=!1,s&&(s=!1,l.process(t))}};return l}(o),t),{}),{setup:a,read:l,resolveKeyframes:h,preUpdate:u,update:c,preRender:d,render:p,postRender:m}=r,f=()=>{const o=T.useManualTiming,r=o?s.timestamp:performance.now();n=!1,o||(s.delta=i?1e3/60:Math.max(Math.min(r-s.timestamp,40),1)),s.timestamp=r,s.isProcessing=!0,a.process(s),l.process(s),h.process(s),u.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:tt.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<tt.length;e++)r[tt[e]].cancel(t)},state:s,steps:r}}const{schedule:nt,cancel:it,state:st,steps:ot}=et("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:A,!0);let rt;function at(){rt=void 0}const lt={now:()=>(void 0===rt&&lt.set(st.isProcessing||T.useManualTiming?st.timestamp:performance.now()),rt),set:t=>{rt=t,queueMicrotask(at)}},ht=t=>e=>"string"==typeof e&&e.startsWith(t),ut=ht("--"),ct=ht("var(--"),dt=t=>!!ct(t)&&pt.test(t.split("/*")[0].trim()),pt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function mt(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const ft={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},yt={...ft,transform:t=>g(0,1,t)},gt={...ft,default:1},vt=t=>Math.round(1e5*t)/1e5,xt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const wt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Tt=(t,e)=>n=>Boolean("string"==typeof n&&wt.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),St=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(xt);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},Pt={...ft,transform:t=>Math.round((t=>g(0,255,t))(t))},bt={test:Tt("rgb","red"),parse:St("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Pt.transform(t)+", "+Pt.transform(e)+", "+Pt.transform(n)+", "+vt(yt.transform(i))+")"};const Et={test:Tt("#"),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:bt.transform},At=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Mt=At("deg"),Vt=At("%"),Ct=At("px"),kt=At("vh"),Dt=At("vw"),Rt=(()=>({...Vt,parse:t=>Vt.parse(t)/100,transform:t=>Vt.transform(100*t)}))(),Lt={test:Tt("hsl","hue"),parse:St("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+Vt.transform(vt(e))+", "+Vt.transform(vt(n))+", "+vt(yt.transform(i))+")"},Bt={test:t=>bt.test(t)||Et.test(t)||Lt.test(t),parse:t=>bt.test(t)?bt.parse(t):Lt.test(t)?Lt.parse(t):Et.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?bt.transform(t):Lt.transform(t),getAnimatableNone:t=>{const e=Bt.parse(t);return e.alpha=0,Bt.transform(e)}},jt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Ft="number",It="color",Ot=/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 Ut(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(Ot,t=>(Bt.test(t)?(i.color.push(o),s.push(It),n.push(Bt.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(Ft),n.push(parseFloat(t))),++o,"${}")).split("${}");return{values:n,split:r,indexes:i,types:s}}function Wt({split:t,types:e}){const n=t.length;return i=>{let s="";for(let o=0;o<n;o++)if(s+=t[o],void 0!==i[o]){const t=e[o];s+=t===Ft?vt(i[o]):t===It?Bt.transform(i[o]):i[o]}return s}}const Nt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(n=t)?0:Bt.test(n)?Bt.getAnimatableNone(n):n;var n};const $t={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(xt)?.length||0)+(t.match(jt)?.length||0)>0},parse:function(t){return Ut(t).values},createTransformer:function(t){return Wt(Ut(t))},getAnimatableNone:function(t){const e=Ut(t);return Wt(e)(e.values.map((t,n)=>Nt(t,e.split[n])))}};function zt(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 Yt(t,e){return n=>n>0?e:t}const Xt=(t,e,n)=>t+(e-t)*n,Ht=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Kt=[Et,bt,Lt];function Gt(t){const e=(n=t,Kt.find(t=>t.test(n)));var n;if(x(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let i=e.parse(t);return e===Lt&&(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=zt(a,i,t+1/3),o=zt(a,i,t),r=zt(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 qt=(t,e)=>{const n=Gt(t),i=Gt(e);if(!n||!i)return Yt(t,e);const s={...n};return t=>(s.red=Ht(n.red,i.red,t),s.green=Ht(n.green,i.green,t),s.blue=Ht(n.blue,i.blue,t),s.alpha=Xt(n.alpha,i.alpha,t),bt.transform(s))},Zt=new Set(["none","hidden"]);function _t(t,e){return n=>Xt(t,e,n)}function Jt(t){return"number"==typeof t?_t:"string"==typeof t?dt(t)?Yt:Bt.test(t)?qt:ee:Array.isArray(t)?Qt:"object"==typeof t?Bt.test(t)?qt:te:Yt}function Qt(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>Jt(t)(t,e[n]));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function te(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=Jt(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const ee=(t,e)=>{const n=$t.createTransformer(e),i=Ut(t),s=Ut(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?Zt.has(t)&&!s.values.length||Zt.has(e)&&!i.values.length?function(t,e){return Zt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):M(Qt(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):(x(!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"),Yt(t,e))};function ne(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Xt(t,e,n);return Jt(t)(t,e)}const ie=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>nt.update(e,t),stop:()=>it(e),now:()=>st.isProcessing?st.timestamp:lt.now()}},se=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},oe=2e4;function re(t){let e=0;let n=t.next(e);for(;!n.done&&e<oe;)e+=50,n=t.next(e);return e>=oe?1/0:e}const ae=100,le=10,he=1,ue=0,ce=800,de=.3,pe=.3,me={granular:.01,default:2},fe={granular:.005,default:.5},ye=.01,ge=10,ve=.05,xe=1;function we(t,e){return t*Math.sqrt(1-e*e)}const Te=.001;const Se=["duration","bounce"],Pe=["stiffness","damping","mass"];function be(t,e){return e.some(e=>void 0!==t[e])}function Ee(t){let e={velocity:ue,stiffness:ae,damping:le,mass:he,isResolvedFromDuration:!1,...t};if(!be(t,Pe)&&be(t,Se))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,o=2*g(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:he,stiffness:s,damping:o}}else{const n=function({duration:t=ce,bounce:e=de,velocity:n=ue,mass:i=he}){let s,o;x(t<=k(ge),"Spring duration must be 10 seconds or less","spring-duration-limit");let r=1-e;r=g(ve,xe,r),t=g(ye,ge,D(t)),r<1?(s=e=>{const i=e*r,s=i*t,o=i-n,a=we(e,r),l=Math.exp(-s);return Te-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),h=we(Math.pow(e,2),r);return(-s(e)+Te>0?-1:1)*((o-a)*l)/h}):(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<12;n++)i-=t(i)/e(i);return i}(s,o,5/t);if(t=k(t),isNaN(a))return{stiffness:ae,damping:le,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*r*Math.sqrt(i*e),duration:t}}}({...t,velocity:0});e={...e,...n,mass:he},e.isResolvedFromDuration=!0}return e}function Ae(t=pe,e=de){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:h,mass:u,duration:c,velocity:d,isResolvedFromDuration:p}=Ee({...n,velocity:-D(n.velocity||0)}),m=d||0,f=h/(2*Math.sqrt(l*u)),y=r-o,g=D(Math.sqrt(l/u)),v=Math.abs(y)<5;let x,w,T,S,P,b;if(i||(i=v?me.granular:me.default),s||(s=v?fe.granular:fe.default),f<1)T=we(g,f),S=(m+f*g*y)/T,x=t=>{const e=Math.exp(-f*g*t);return r-e*(S*Math.sin(T*t)+y*Math.cos(T*t))},P=f*g*S+y*T,b=f*g*y-S*T,w=t=>Math.exp(-f*g*t)*(P*Math.sin(T*t)+b*Math.cos(T*t));else if(1===f){x=t=>r-Math.exp(-g*t)*(y+(m+g*y)*t);const t=m+g*y;w=e=>Math.exp(-g*e)*(g*t*e-m)}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 e=(m+f*g*y)/t,n=f*g*e-y*t,i=f*g*y-e*t;w=e=>{const s=Math.exp(-f*g*e),o=Math.min(t*e,300);return s*(n*Math.sinh(o)+i*Math.cosh(o))}}const E={calculatedDuration:p&&c||null,velocity:t=>k(w(t)),next:t=>{if(!p&&f<1){const e=Math.exp(-f*g*t),n=Math.sin(T*t),o=Math.cos(T*t),l=r-e*(S*n+y*o),h=k(e*(P*n+b*o));return a.done=Math.abs(h)<=i&&Math.abs(r-l)<=s,a.value=a.done?r:l,a}const e=x(t);if(p)a.done=t>=c;else{const n=k(w(t));a.done=Math.abs(n)<=i&&Math.abs(r-e)<=s}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(re(E),oe),e=se(e=>E.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return E}Ae.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(re(i),oe);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:D(s)}}(t,100,Ae);return t.ease=e.ease,t.duration=k(e.duration),t.type="keyframes",t};function Me(t,e,n){const i=Math.max(e-5,0);return R(n-t(i),e-i)}function Ve({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=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},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)<=h,d.value=d.done?y:n};let w,T;const S=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(w=t,T=Ae({keyframes:[d.value,p(d.value)],velocity:Me(v,t,d.value),damping:s,stiffness:o,restDelta:h,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==w||(e=!0,x(t),S(t)),void 0!==w&&t>=w?T.next(t-w):(!e&&x(t),d)}}}function Ce(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const o=t.length;if(w(o===e.length,"Both input and output ranges must be the same length","range-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||T.mix||ne,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]||A:e;o=M(t,o)}i.push(o)}return i}(e,i,s),l=a.length,h=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=V(t[i],t[i+1],n);return a[i](s)};return n?e=>h(g(t[0],t[o-1],e)):h}function ke(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=V(0,e,i);t.push(Xt(n,1,s))}}(e,t.length-1),e}function De({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(q):q(i),o={done:!1,value:e[0]},r=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:ke(e),t),a=Ce(r,e,{ease:Array.isArray(s)?s:(l=e,h=s,l.map(()=>h||H).splice(0,l.length-1))});var l,h;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const Re=t=>null!==t;function Le(t,{repeat:e,repeatType:n="loop"},i,s=1){const o=t.filter(Re),r=s<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return r&&void 0!==i?i:o[r]}const Be={decay:Ve,inertia:Ve,tween:De,keyframes:De,spring:Ae};function je(t){"string"==typeof t.type&&(t.type=Be[t.type])}class Fe{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 Ie=t=>t/100;class Oe extends Fe{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==lt.now()&&this.tick(lt.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=De,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||De;a!==De&&"number"!=typeof r[0]&&(this.mixKeyframes=M(Ie,ne(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=re(l));const{calculatedDuration:h}=l;this.calculatedDuration=h,this.resolvedDuration=h+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:h,repeat:u,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),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let x,w=this.currentTime,T=n;if(u){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,u+1);Boolean(e%2)&&("reverse"===c?(n=1-n,d&&(n-=d/r)):"mirror"===c&&(T=o)),w=g(0,1,n)*r}v?(this.delayState.value=h[0],x=this.delayState):x=T.next(w),s&&!v&&(x.value=s(x.value));let{done:S}=x;v||null===a||(S=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const P=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return P&&p!==Ve&&(x.value=Le(h,this.options,f,this.speed)),m&&m(x.value),P&&this.finish(),x}then(t,e){return this.finished.then(t,e)}get duration(){return D(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+D(t)}get time(){return D(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),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);return Me(t=>this.generator.next(t).value,t,this.generator.next(t).value)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(lt.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=D(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ie,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"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(lt.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 Ue=t=>180*t/Math.PI,We=t=>{const e=Ue(Math.atan2(t[1],t[0]));return $e(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:We,rotateZ:We,skewX:t=>Ue(Math.atan(t[1])),skewY:t=>Ue(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},$e=t=>((t%=360)<0&&(t+=360),t),ze=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:ze,scaleY:Ye,scale:t=>(ze(t)+Ye(t))/2,rotateX:t=>$e(Ue(Math.atan2(t[6],t[5]))),rotateY:t=>$e(Ue(Math.atan2(-t[2],t[0]))),rotateZ:We,rotate:We,skewX:t=>Ue(Math.atan(t[4])),skewY:t=>Ue(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function He(t){return t.includes("scale")?1:0}function Ke(t,e){if(!t||"none"===t)return He(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 He(e);const o=i[e],r=s[1].split(",").map(Ge);return"function"==typeof o?o(r):r[o]}function Ge(t){return parseFloat(t.trim())}const qe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ze=(()=>new Set(qe))(),_e=t=>t===ft||t===Ct,Je=new Set(["x","y","z"]),Qe=qe.filter(t=>!Je.has(t));const tn={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:i})=>{const s=t.max-t.min;return"border-box"===i?s:s-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:i})=>{const s=t.max-t.min;return"border-box"===i?s:s-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})=>Ke(e,"x"),y:(t,{transform:e})=>Ke(e,"y")};tn.translateX=tn.x,tn.translateY=tn.y;const en=new Set;let nn=!1,sn=!1,on=!1;function rn(){if(sn){const t=Array.from(en).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 Qe.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)})}sn=!1,nn=!1,en.forEach(t=>t.complete(on)),en.clear()}function an(){en.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(sn=!0)})}class ln{constructor(t,e,n,i,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(en.add(this),nn||(nn=!0,nt.read(an),nt.resolveKeyframes(rn))):(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.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),en.delete(this)}cancel(){"scheduled"===this.state&&(en.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function hn(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}const un={};function cn(t,e){const n=E(t);return()=>un[e]??n()}const dn=cn(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),pn=cn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),mn=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,fn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:mn([0,.65,.55,1]),circOut:mn([.55,0,1,.45]),backIn:mn([.31,.01,.66,-.59]),backOut:mn([.33,1.53,.69,.99])};function yn(t,e){return t?"function"==typeof t?pn()?se(t,e):"ease-out":K(t)?mn(t):Array.isArray(t)?t.map(t=>yn(t,e)||fn.easeOut):fn[t]:void 0}function gn(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},h=void 0){const u={[e]:n};l&&(u.offset=l);const c=yn(a,s);Array.isArray(c)&&(u.easing=c);const d={delay:i,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 vn(t){return"function"==typeof t&&"applyToOptions"in t}class xn extends Fe{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!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,w("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return vn(t)&&pn()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=gn(e,n,i,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const t=Le(i,this.options,r,this.speed);this.updateMotionValue&&this.updateMotionValue(t),hn(e,n,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(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return D(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+D(t)}get time(){return D(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=k(t),e&&this.animation.pause()}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:t,rangeStart:e,rangeEnd:n,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&dn()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),n&&(this.animation.rangeEnd=n),A):i(this)}}const wn={anticipate:W,backInOut:U,circInOut:z};function Tn(t){"string"==typeof t.ease&&t.ease in wn&&(t.ease=wn[t.ease])}class Sn extends xn{constructor(t){Tn(t),je(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(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=Math.max(10,lt.now()-this.startTime),l=g(0,10,a-10),h=r.sample(a).value,{name:u}=this.options;s&&u&&hn(s,u,h),e.setWithVelocity(r.sample(Math.max(0,a-l)).value,h,l),r.stop()}}const Pn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!$t.test(t)&&"0"!==t||t.startsWith("url(")));function bn(t){t.duration=0,t.type="keyframes"}const En=new Set(["opacity","clipPath","filter","transform"]),An=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const Mn=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Vn=E(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Cn(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:o,type:r,keyframes:a}=t,l=e?.owner?.current;if(!(l instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:u}=e.owner.getProps();return Vn()&&n&&(En.has(n)||Mn.has(n)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&An.test(t[e]))return!0;return!1}(a))&&("transform"!==n||!u)&&!h&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}class kn extends Fe{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:h,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=lt.now();const c={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:o,name:a,motionValue:l,element:h,...u},d=h?.KeyframeResolver||ln;this.keyframeResolver=new d(r,(t,e,n)=>this.onKeyframesResolved(t,e,c,!n),a,l,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:s,type:o,velocity:r,delay:a,isHandoff:l,onUpdate:h}=n;this.resolvedAt=lt.now();let u=!0;(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=Pn(s,e),a=Pn(o,e);return x(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 n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||vn(n))&&i)})(t,s,o,r)||(u=!1,!T.instantAnimations&&a||h?.(Le(t,n,e)),t[0]=t[t.length-1],bn(n),n.repeat=0);const c={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},d=u&&!l&&Cn(c),p=c.motionValue?.owner?.current;let m;if(d)try{m=new Sn({...c,element:p})}catch{m=new Oe(c)}else m=new Oe(c);m.finished.then(()=>{this.notifyFinished()}).catch(A),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(),on=!0,an(),rn(),on=!1),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()}}function Dn(t,e,n,i=0,s=1){const o=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),r=t.size,a=(r-1)*i;return"function"==typeof n?n(o,r):1===s?o*i:a-o*i}const Rn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ln(t,e,n=1){w(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,s]=function(t){const e=Rn.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 dt(s)?Ln(s,e,n+1):s}const Bn={type:"spring",stiffness:500,damping:25,restSpeed:10},jn={type:"keyframes",duration:.8},Fn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},In=(t,{keyframes:e})=>e.length>2?jn:Ze.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Bn:Fn;function On(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}function Un(t,e){const n=t?.[e]??t?.default??t;return n!==t?On(n,t):n}const Wn=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const Nn=(t,e,n,i={},s,o)=>r=>{const a=Un(i,t)||{},l=a.delay||i.delay||0;let{elapsed:h=0}=i;h-=k(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-h,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(t){for(const e in t)if(!Wn.has(e))return!0;return!1})(a)||Object.assign(u,In(t,u)),u.duration&&(u.duration=k(u.duration)),u.repeatDelay&&(u.repeatDelay=k(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let c=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(bn(u),0===u.delay&&(c=!0)),(T.instantAnimations||T.skipAnimations||s?.shouldSkipAnimations||a.skipAnimations)&&(c=!0,bn(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,c&&!o&&void 0!==e.get()){const t=Le(u.keyframes,a);if(void 0!==t)return void nt.update(()=>{u.onUpdate(t),u.onComplete()})}return a.isSync?new Oe(u):new kn(u)};function $n(t){const e=[{},{}];return t?.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function zn(t,e,n,i){if("function"==typeof e){const[s,o]=$n(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]=$n(i);e=e(void 0!==n?n:t.custom,s,o)}return e}function Yn(t,e,n){const i=t.getProps();return zn(i,e,void 0!==n?n:i.custom,t)}const Xn=new Set(["width","height","top","left","right","bottom",...qe]);class Hn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=lt.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=lt.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(),nt.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){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}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()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=lt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return R(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.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Kn(t,e){return new Hn(t,e)}const Gn=t=>Array.isArray(t);function qn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Kn(n))}function Zn(t){return Gn(t)?t[t.length-1]||0:t}const _n=t=>Boolean(t&&t.getVelocity);function Jn(t,e){const n=t.getValue("willChange");if(i=n,Boolean(_n(i)&&i.add))return n.add(e);if(!n&&T.WillChange){const n=new T.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}function Qn(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const ti="data-"+Qn("framerAppearId");function ei(t){return t.props[ti]}function ni({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function ii(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:o,transitionEnd:r,...a}=e;const l=t.getDefaultTransition();o=o?On(o,l):l;const h=o?.reduceMotion,u=o?.skipAnimations;i&&(o=i);const c=[],d=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||d&&ni(d,e))continue;const r={delay:n,...Un(o||{},e)};u&&(r.skipAnimations=!0);const l=i.get();if(void 0!==l&&!i.isAnimating()&&!Array.isArray(s)&&s===l&&!r.velocity){nt.update(()=>i.set(s));continue}let p=!1;if(window.MotionHandoffAnimation){const n=ei(t);if(n){const t=window.MotionHandoffAnimation(n,e,nt);null!==t&&(r.startTime=t,p=!0)}}Jn(t,e);const m=h??t.shouldReduceMotion;i.start(Nn(e,i,s,m&&Xn.has(e)?{type:!1}:r,t,p));const f=i.animation;f&&c.push(f)}if(r){const e=()=>nt.update(()=>{r&&function(t,e){const n=Yn(t,e);let{transitionEnd:i={},transition:s={},...o}=n||{};o={...o,...i};for(const e in o)qn(t,e,Zn(o[e]))}(t,r)});c.length?Promise.all(c).then(e):e()}return c}function si(t,e,n={}){const i=Yn(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(ii(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=0,o=1,r){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(si(l,e,{...r,delay:n+("function"==typeof i?0:i)+Dn(t.variantChildren,l,i,s,o)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,i,o,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)])}const oi=t=>e=>e.test(t),ri=[ft,Ct,Vt,Mt,Dt,kt,{test:t=>"auto"===t,parse:t=>t}],ai=t=>ri.find(oi(t));function li(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||b(t))}const hi=new Set(["brightness","contrast","saturate","opacity"]);function ui(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(xt)||[];if(!i)return t;const s=n.replace(i,"");let o=hi.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const ci=/\b([a-z-]*)\(.*?\)/gu,di={...$t,getAnimatableNone:t=>{const e=t.match(ci);return e?e.map(ui).join(" "):t}},pi={...$t,getAnimatableNone:t=>{const e=$t.parse(t);return $t.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},mi={...ft,transform:Math.round},fi={borderWidth:Ct,borderTopWidth:Ct,borderRightWidth:Ct,borderBottomWidth:Ct,borderLeftWidth:Ct,borderRadius:Ct,borderTopLeftRadius:Ct,borderTopRightRadius:Ct,borderBottomRightRadius:Ct,borderBottomLeftRadius:Ct,width:Ct,maxWidth:Ct,height:Ct,maxHeight:Ct,top:Ct,right:Ct,bottom:Ct,left:Ct,inset:Ct,insetBlock:Ct,insetBlockStart:Ct,insetBlockEnd:Ct,insetInline:Ct,insetInlineStart:Ct,insetInlineEnd:Ct,padding:Ct,paddingTop:Ct,paddingRight:Ct,paddingBottom:Ct,paddingLeft:Ct,paddingBlock:Ct,paddingBlockStart:Ct,paddingBlockEnd:Ct,paddingInline:Ct,paddingInlineStart:Ct,paddingInlineEnd:Ct,margin:Ct,marginTop:Ct,marginRight:Ct,marginBottom:Ct,marginLeft:Ct,marginBlock:Ct,marginBlockStart:Ct,marginBlockEnd:Ct,marginInline:Ct,marginInlineStart:Ct,marginInlineEnd:Ct,fontSize:Ct,backgroundPositionX:Ct,backgroundPositionY:Ct,...{rotate:Mt,rotateX:Mt,rotateY:Mt,rotateZ:Mt,scale:gt,scaleX:gt,scaleY:gt,scaleZ:gt,skew:Mt,skewX:Mt,skewY:Mt,distance:Ct,translateX:Ct,translateY:Ct,translateZ:Ct,x:Ct,y:Ct,z:Ct,perspective:Ct,transformPerspective:Ct,opacity:yt,originX:Rt,originY:Rt,originZ:Ct},zIndex:mi,fillOpacity:yt,strokeOpacity:yt,numOctaves:mi},yi={...fi,color:Bt,backgroundColor:Bt,outlineColor:Bt,fill:Bt,stroke:Bt,borderColor:Bt,borderTopColor:Bt,borderRightColor:Bt,borderBottomColor:Bt,borderLeftColor:Bt,filter:di,WebkitFilter:di,mask:pi,WebkitMask:pi},gi=t=>yi[t],vi=new Set([di,pi]);function xi(t,e){let n=gi(t);return vi.has(n)||(n=$t),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const wi=new Set(["auto","none","0"]);class Ti extends ln{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(),dt(i))){const s=Ln(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Xn.has(n)||2!==t.length)return;const[i,s]=t,o=ai(i),r=ai(s);if(mt(i)!==mt(s)&&tn[n])this.needsMeasurement=!0;else if(o!==r)if(_e(o)&&_e(r))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else tn[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||li(t[e]))&&n.push(e);n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!wi.has(e)&&Ut(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=xi(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=tn[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]=tn[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()}}function Si(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document;const i=n?.[t]??e.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(t=>null!=t)}const Pi=(t,e)=>e&&"number"==typeof t?e.transform(t):t;const{schedule:bi}=et(queueMicrotask,!1),Ei={x:!1,y:!1};function Ai(){return Ei.x||Ei.y}function Mi(t,e){const n=Si(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function Vi(t,e,n={}){const[i,s,o]=Mi(t,n);return i.forEach(t=>{let n,i=!1,o=!1;const r=e=>{n&&(n(e),n=void 0),t.removeEventListener("pointerleave",l)},a=t=>{i=!1,window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),o&&(o=!1,r(t))},l=t=>{"touch"!==t.pointerType&&(i?o=!0:r(t))};t.addEventListener("pointerenter",i=>{if("touch"===i.pointerType||Ai())return;o=!1;const r=e(t,i);"function"==typeof r&&(n=r,t.addEventListener("pointerleave",l,s))},s),t.addEventListener("pointerdown",()=>{i=!0,window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",a,s)},s)}),o}const Ci=(t,e)=>!!e&&(t===e||Ci(t,e.parentElement)),ki=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Di=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Ri=new Set(["INPUT","SELECT","TEXTAREA"]);const Li=new WeakSet;function Bi(t){return e=>{"Enter"===e.key&&t(e)}}function ji(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Fi(t){return ki(t)&&!Ai()}const Ii=new WeakSet;function Oi(t,e,n={}){const[i,s,o]=Mi(t,n),r=t=>{const i=t.currentTarget;if(!Fi(t))return;if(Ii.has(t))return;Li.add(i),n.stopPropagation&&Ii.add(t);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Li.has(i)&&Li.delete(i),Fi(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,i===window||i===document||n.useGlobalTarget||Ci(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),P(e=t)&&"offsetHeight"in e&&!("ownerSVGElement"in e)&&(t.addEventListener("focus",t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=Bi(()=>{if(Li.has(n))return;ji(n,"down");const t=Bi(()=>{ji(n,"up")});n.addEventListener("keyup",t,e),n.addEventListener("blur",()=>ji(n,"cancel"),e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)})(t,s)),function(t){return Di.has(t.tagName)||!0===t.isContentEditable}(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}function Ui(t){return P(t)&&"ownerSVGElement"in t}const Wi=new WeakMap;let Ni;const $i=(t,e,n)=>(i,s)=>s&&s[0]?s[0][t+"Size"]:Ui(i)&&"getBBox"in i?i.getBBox()[e]:i[n],zi=$i("inline","width","offsetWidth"),Yi=$i("block","height","offsetHeight");function Xi({target:t,borderBoxSize:e}){Wi.get(t)?.forEach(n=>{n(t,{get width(){return zi(t,e)},get height(){return Yi(t,e)}})})}function Hi(t){t.forEach(Xi)}function Ki(t,e){Ni||"undefined"!=typeof ResizeObserver&&(Ni=new ResizeObserver(Hi));const n=Si(t);return n.forEach(t=>{let n=Wi.get(t);n||(n=new Set,Wi.set(t,n)),n.add(e),Ni?.observe(t)}),()=>{n.forEach(t=>{const n=Wi.get(t);n?.delete(e),n?.size||Ni?.unobserve(t)})}}const Gi=new Set;let qi;function Zi(t){return Gi.add(t),qi||(qi=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Gi.forEach(e=>e(t))},window.addEventListener("resize",qi)),()=>{Gi.delete(t),Gi.size||"function"!=typeof qi||(window.removeEventListener("resize",qi),qi=void 0)}}function _i(t,e){return"function"==typeof t?Zi(t):Ki(t,e)}const Ji=[...ri,Bt,$t],Qi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),ts=new WeakMap;function es(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function ns(t){return"string"==typeof t||Array.isArray(t)}const is=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ss=["initial",...is];function os(t){return es(t.animate)||ss.some(e=>ns(t[e]))}function rs(t){return Boolean(os(t)||t.variants)}const as={current:null},ls={current:!1},hs="undefined"!=typeof window;const us=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let cs={};function ds(t){cs=t}class ps{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:i,skipAnimations:s,blockInitialAnimation:o,visualState:r},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ln,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=lt.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,nt.render(this.render,!1,!0))};const{latestValues:l,renderState:h}=r;this.latestValues=l,this.baseTarget={...l},this.initialValues=e.initial?{...l}:{},this.renderState=h,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=s,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=os(e),this.isVariantNode=rs(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==l[t]&&_n(e)&&e.set(l[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,ts.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(ls.curre