framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 111 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 h,useRef as u,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);function b(t){return"object"==typeof t&&null!==t}const A=t=>/^0[^.\s]+$/u.test(t);function E(t){let e;return()=>(void 0===e&&(e=t()),e)}const V=t=>t,M=(t,e)=>n=>e(t(n)),D=(...t)=>t.reduce(M),C=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class k{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 R=t=>1e3*t,L=t=>t/1e3;function j(t,e){return e?t*(1e3/e):0}const B=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function F(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=B(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:B(s(t),e,i)}const O=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,I=t=>e=>1-t(1-e),U=F(.33,1.53,.69,.99),N=I(U),W=O(N),$=t=>(t*=2)<1?.5*N(t):.5*(2-Math.pow(2,-10*(t-1))),Y=t=>1-Math.sin(Math.acos(t)),X=I(Y),K=O(Y),z=F(.42,0,1,1),H=F(0,0,.58,1),q=F(.42,0,.58,1),G=t=>Array.isArray(t)&&"number"==typeof t[0],Z={linear:V,easeIn:z,easeInOut:q,easeOut:H,circIn:Y,circInOut:K,circOut:X,backIn:N,backInOut:W,backOut:U,anticipate:$},_=t=>{if(G(t)){t.length;const[e,n,i,s]=t;return F(e,n,i,s)}return"string"==typeof t?Z[t]:t},J=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],Q={value:null,addProjectionMetrics:null};function tt(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=J.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 h(e){r.has(e)&&(u.schedule(e),t()),l++,e(a)}const u={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(h),e&&Q.value&&Q.value.frameloop[e].push(l),l=0,n.clear(),s=!1,o&&(o=!1,u.process(t)))}};return u}(o,e?n:void 0),t),{}),{setup:a,read:l,resolveKeyframes:h,preUpdate:u,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),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:J.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<J.length;e++)r[J[e]].cancel(t)},state:s,steps:r}}const{schedule:et,cancel:nt,state:it,steps:st}=tt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:V,!0);let ot;function rt(){ot=void 0}const at={now:()=>(void 0===ot&&at.set(it.isProcessing||P.useManualTiming?it.timestamp:performance.now()),ot),set:t=>{ot=t,queueMicrotask(rt)}},lt=t=>e=>"string"==typeof e&&e.startsWith(t),ht=lt("--"),ut=lt("var(--"),ct=t=>!!ut(t)&&dt.test(t.split("/*")[0].trim()),dt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,pt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},mt={...pt,transform:t=>w(0,1,t)},ft={...pt,default:1},yt=t=>Math.round(1e5*t)/1e5,gt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const vt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,xt=(t,e)=>n=>Boolean("string"==typeof n&&vt.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Tt=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(gt);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},wt={...pt,transform:t=>Math.round((t=>w(0,255,t))(t))},Pt={test:xt("rgb","red"),parse:Tt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+wt.transform(t)+", "+wt.transform(e)+", "+wt.transform(n)+", "+yt(mt.transform(i))+")"};const St={test:xt("#"),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:Pt.transform},bt=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),At=bt("deg"),Et=bt("%"),Vt=bt("px"),Mt=bt("vh"),Dt=bt("vw"),Ct=(()=>({...Et,parse:t=>Et.parse(t)/100,transform:t=>Et.transform(100*t)}))(),kt={test:xt("hsl","hue"),parse:Tt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+Et.transform(yt(e))+", "+Et.transform(yt(n))+", "+yt(mt.transform(i))+")"},Rt={test:t=>Pt.test(t)||St.test(t)||kt.test(t),parse:t=>Pt.test(t)?Pt.parse(t):kt.test(t)?kt.parse(t):St.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Pt.transform(t):kt.transform(t),getAnimatableNone:t=>{const e=Rt.parse(t);return e.alpha=0,Rt.transform(e)}},Lt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const jt="number",Bt="color",Ft=/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 Ot(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(Ft,t=>(Rt.test(t)?(i.color.push(o),s.push(Bt),n.push(Rt.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(jt),n.push(parseFloat(t))),++o,"${}")).split("${}");return{values:n,split:r,indexes:i,types:s}}function It(t){return Ot(t).values}function Ut(t){const{split:e,types:n}=Ot(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===jt?yt(t[o]):e===Bt?Rt.transform(t[o]):t[o]}return s}}const Nt=t=>"number"==typeof t?0:Rt.test(t)?Rt.getAnimatableNone(t):t;const Wt={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(gt)?.length||0)+(t.match(Lt)?.length||0)>0},parse:It,createTransformer:Ut,getAnimatableNone:function(t){const e=It(t);return Ut(t)(e.map(Nt))}};function $t(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,Kt=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},zt=[St,Pt,kt];function Ht(t){const e=(n=t,zt.find(t=>t.test(n)));var n;if(!Boolean(e))return!1;let i=e.parse(t);return e===kt&&(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=$t(a,i,t+1/3),o=$t(a,i,t),r=$t(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=Ht(t),i=Ht(e);if(!n||!i)return Yt(t,e);const s={...n};return t=>(s.red=Kt(n.red,i.red,t),s.green=Kt(n.green,i.green,t),s.blue=Kt(n.blue,i.blue,t),s.alpha=Xt(n.alpha,i.alpha,t),Pt.transform(s))},Gt=new Set(["none","hidden"]);function Zt(t,e){return n=>Xt(t,e,n)}function _t(t){return"number"==typeof t?Zt:"string"==typeof t?ct(t)?Yt:Rt.test(t)?qt:te:Array.isArray(t)?Jt:"object"==typeof t?Rt.test(t)?qt:Qt:Yt}function Jt(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>_t(t)(t,e[n]));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Qt(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=_t(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const te=(t,e)=>{const n=Wt.createTransformer(e),i=Ot(t),s=Ot(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?Gt.has(t)&&!s.values.length||Gt.has(e)&&!i.values.length?function(t,e){return Gt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):D(Jt(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):Yt(t,e)};function ee(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Xt(t,e,n);return _t(t)(t,e)}const ne=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>et.update(e,t),stop:()=>nt(e),now:()=>it.isProcessing?it.timestamp:at.now()}},ie=(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)})`},se=2e4;function oe(t){let e=0;let n=t.next(e);for(;!n.done&&e<se;)e+=50,n=t.next(e);return e>=se?1/0:e}function re(t,e,n){const i=Math.max(e-5,0);return j(n-t(i),e-i)}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,Te=.001;function we({duration:t=ce,bounce:e=de,velocity:n=ue,mass:i=he}){let s,o,r=1-e;r=w(ve,xe,r),t=w(ye,ge,L(t)),r<1?(s=e=>{const i=e*r,s=i*t,o=i-n,a=Se(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=Se(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<Pe;n++)i-=t(i)/e(i);return i}(s,o,5/t);if(t=R(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}}}const Pe=12;function Se(t,e){return t*Math.sqrt(1-e*e)}const be=["duration","bounce"],Ae=["stiffness","damping","mass"];function Ee(t,e){return e.some(e=>void 0!==t[e])}function Ve(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}=function(t){let e={velocity:ue,stiffness:ae,damping:le,mass:he,isResolvedFromDuration:!1,...t};if(!Ee(t,Ae)&&Ee(t,be))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:he,stiffness:s,damping:o}}else{const n=we(t);e={...e,...n,mass:he},e.isResolvedFromDuration=!0}return e}({...n,velocity:-L(n.velocity||0)}),m=d||0,f=h/(2*Math.sqrt(l*u)),y=r-o,g=L(Math.sqrt(l/u)),v=Math.abs(y)<5;let x;if(i||(i=v?me.granular:me.default),s||(s=v?fe.granular:fe.default),f<1){const t=Se(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?R(m):re(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(oe(T),se),e=ie(e=>T.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return T}function Me({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 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:re(v,t,d.value),damping:s,stiffness:o,restDelta:h,restSpeed:u}))};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 De(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||ee,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=D(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=C(t[i],t[i+1],n);return a[i](s)};return n?e=>h(w(t[0],t[o-1],e)):h}function Ce(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=C(0,e,i);t.push(Xt(n,1,s))}}(e,t.length-1),e}function ke({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(_):_(i),o={done:!1,value:e[0]},r=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:Ce(e),t),a=De(r,e,{ease:Array.isArray(s)?s:(l=e,h=s,l.map(()=>h||q).splice(0,l.length-1))});var l,h;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(oe(i),se);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:L(s)}}(t,100,Ve);return t.ease=e.ease,t.duration=R(e.duration),t.type="keyframes",t};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 je={decay:Me,inertia:Me,tween:ke,keyframes:ke,spring:Ve};function Be(t){"string"==typeof t.type&&(t.type=je[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 Oe=t=>t/100;class Ie extends Fe{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==at.now()&&this.tick(at.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;Be(t);const{type:e=ke,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||ke;a!==ke&&"number"!=typeof r[0]&&(this.mixKeyframes=D(Oe,ee(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=oe(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),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(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&&(x=o)),v=w(0,1,n)*r}const T=g?{done:!1,value:h[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!==Me&&(T.value=Le(h,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 L(this.calculatedDuration)}get time(){return L(this.currentTime)}set time(t){t=R(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(at.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=L(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ne,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(at.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,Ne=t=>{const e=Ue(Math.atan2(t[1],t[0]));return $e(e)},We={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Ne,rotateZ:Ne,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),Ye=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Xe=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ke={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ye,scaleY:Xe,scale:t=>(Ye(t)+Xe(t))/2,rotateX:t=>$e(Ue(Math.atan2(t[6],t[5]))),rotateY:t=>$e(Ue(Math.atan2(-t[2],t[0]))),rotateZ:Ne,rotate:Ne,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 ze(t){return t.includes("scale")?1:0}function He(t,e){if(!t||"none"===t)return ze(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=Ke,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=We,s=e}if(!s)return ze(e);const o=i[e],r=s[1].split(",").map(qe);return"function"==typeof o?o(r):r[o]}function qe(t){return parseFloat(t.trim())}const Ge=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ze=(()=>new Set(Ge))(),_e=t=>t===pt||t===Vt,Je=new Set(["x","y","z"]),Qe=Ge.filter(t=>!Je.has(t));const tn={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})=>He(e,"x"),y:(t,{transform:e})=>He(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,et.read(an),et.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()}}const hn=E(()=>void 0!==window.ScrollTimeline),un={};function cn(t,e){const n=E(t);return()=>un[e]??n()}const dn=cn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),pn=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,mn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pn([0,.65,.55,1]),circOut:pn([.55,0,1,.45]),backIn:pn([.31,.01,.66,-.59]),backOut:pn([.33,1.53,.69,.99])};function fn(t,e){return t?"function"==typeof t?dn()?ie(t,e):"ease-out":G(t)?pn(t):Array.isArray(t)?t.map(t=>fn(t,e)||mn.easeOut):mn[t]:void 0}function yn(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=fn(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 gn(t){return"function"==typeof t&&"applyToOptions"in t}class vn extends Fe{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 gn(t)&&dn()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=yn(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):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()}}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 L(Number(t))}get time(){return L(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=R(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&&hn()?(this.animation.timeline=t,V):e(this)}}const xn={anticipate:$,backInOut:W,circInOut:K};function Tn(t){"string"==typeof t.ease&&t.ease in xn&&(t.ease=xn[t.ease])}class wn extends vn{constructor(t){Tn(t),Be(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 Ie({...o,autoplay:!1}),a=R(this.finishedTime??this.time);e.setWithVelocity(r.sample(a-10).value,r.sample(a).value,10),r.stop()}}const Pn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Wt.test(t)&&"0"!==t||t.startsWith("url(")));function Sn(t){return b(t)&&"offsetHeight"in t}const bn=new Set(["opacity","clipPath","filter","transform"]),An=E(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class En 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=at.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=at.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=Pn(s,e),a=Pn(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||gn(n))&&i)}(t,s,o,r)||(!P.instantAnimations&&a||h?.(Le(t,n,e)),t[0]=t[t.length-1],n.duration=0,n.repeat=0);const u={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(!Sn(e?.owner?.current))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return An()&&n&&bn.has(n)&&("transform"!==n||!l)&&!a&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}(u)?new wn({...u,element:u.motionValue.owner.current}):new Ie(u);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||(this.keyframeResolver?.resume(),on=!0,an(),rn(),on=!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&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const Vn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Mn(t,e,n=1){const[i,s]=function(t){const e=Vn.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 ct(s)?Mn(s,e,n+1):s}function Dn(t,e){return t?.[e]??t?.default??t}const Cn=new Set(["width","height","top","left","right","bottom",...Ge]),kn=t=>e=>e.test(t),Rn=[pt,Vt,Et,At,Dt,Mt,{test:t=>"auto"===t,parse:t=>t}],Ln=t=>Rn.find(kn(t));function jn(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||A(t))}const Bn=new Set(["brightness","contrast","saturate","opacity"]);function Fn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(gt)||[];if(!i)return t;const s=n.replace(i,"");let o=Bn.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const On=/\b([a-z-]*)\(.*?\)/gu,In={...Wt,getAnimatableNone:t=>{const e=t.match(On);return e?e.map(Fn).join(" "):t}},Un={...pt,transform:Math.round},Nn={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:At,rotateX:At,rotateY:At,rotateZ:At,scale:ft,scaleX:ft,scaleY:ft,scaleZ:ft,skew:At,skewX:At,skewY:At,distance:Vt,translateX:Vt,translateY:Vt,translateZ:Vt,x:Vt,y:Vt,z:Vt,perspective:Vt,transformPerspective:Vt,opacity:mt,originX:Ct,originY:Ct,originZ:Vt},zIndex:Un,fillOpacity:mt,strokeOpacity:mt,numOctaves:Un},Wn={...Nn,color:Rt,backgroundColor:Rt,outlineColor:Rt,fill:Rt,stroke:Rt,borderColor:Rt,borderTopColor:Rt,borderRightColor:Rt,borderBottomColor:Rt,borderLeftColor:Rt,filter:In,WebkitFilter:In},$n=t=>Wn[t];function Yn(t,e){let n=$n(t);return n!==In&&(n=Wt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Xn=new Set(["auto","none","0"]);class Kn 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(),ct(i))){const s=Mn(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Cn.has(n)||2!==t.length)return;const[i,s]=t,o=Ln(i),r=Ln(s);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]||jn(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&&!Xn.has(e)&&Ot(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=Yn(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()}}const zn=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class Hn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=at.now();if(this.updatedAt!==n&&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();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=at.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 k);const n=this.events[t].add(e);return"change"===t?()=>{n(),et.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()}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=at.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return j(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 qn(t,e){return new Hn(t,e)}const{schedule:Gn,cancel:Zn}=tt(queueMicrotask,!1),_n={x:!1,y:!1};function Jn(){return _n.x||_n.y}function Qn(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 ti(t){return!("touch"===t.pointerType||Jn())}const ei=(t,e)=>!!e&&(t===e||ei(t,e.parentElement)),ni=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,ii=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const si=new WeakSet;function oi(t){return e=>{"Enter"===e.key&&t(e)}}function ri(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function ai(t){return ni(t)&&!Jn()}function li(t,e,n={}){const[i,s,o]=Qn(t,n),r=t=>{const i=t.currentTarget;if(!ai(t))return;si.add(i);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),si.has(i)&&si.delete(i),ai(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,i===window||i===document||n.useGlobalTarget||ei(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),Sn(t)&&(t.addEventListener("focus",t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=oi(()=>{if(si.has(n))return;ri(n,"down");const t=oi(()=>{ri(n,"up")});n.addEventListener("keyup",t,e),n.addEventListener("blur",()=>ri(n,"cancel"),e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)})(t,s)),e=t,ii.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}function hi(t){return b(t)&&"ownerSVGElement"in t}const ui=t=>Boolean(t&&t.getVelocity),ci=[...Rn,Rt,Wt],di=t=>Array.isArray(t);function pi(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,qn(n))}function mi(t){return di(t)?t[t.length-1]||0:t}function fi(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 yi=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gi="data-"+yi("framerAppearId");function vi(t){return t.props[gi]}const xi=t=>null!==t;const Ti={type:"spring",stiffness:500,damping:25,restSpeed:10},wi={type:"keyframes",duration:.8},Pi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Si=(t,{keyframes:e})=>e.length>2?wi:Ze.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Ti:Pi;const bi=(t,e,n,i={},s,o)=>r=>{const a=Dn(i,t)||{},l=a.delay||i.delay||0;let{elapsed:h=0}=i;h-=R(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({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length})(a)||Object.assign(u,Si(t,u)),u.duration&&(u.duration=R(u.duration)),u.repeatDelay&&(u.repeatDelay=R(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let c=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(u.duration=0,0===u.delay&&(c=!0)),(P.instantAnimations||P.skipAnimations)&&(c=!0,u.duration=0,u.delay=0),u.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(xi),o=e&&"loop"!==n&&e%2==1?0:s.length-1;return o&&void 0!==i?i:s[o]}(u.keyframes,a);if(void 0!==t)return void et.update(()=>{u.onUpdate(t),u.onComplete()})}return a.isSync?new Ie(u):new En(u)};function Ai({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function Ei(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;i&&(o=i);const l=[],h=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||h&&Ai(h,e))continue;const r={delay:n,...Dn(o||{},e)},u=i.get();if(void 0!==u&&!i.isAnimating&&!Array.isArray(s)&&s===u&&!r.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){const n=vi(t);if(n){const t=window.MotionHandoffAnimation(n,e,et);null!==t&&(r.startTime=t,c=!0)}}fi(t,e),i.start(bi(e,i,s,t.shouldReduceMotion&&Cn.has(e)?{type:!1}:r,t,c));const d=i.animation;d&&l.push(d)}return r&&Promise.all(l).then(()=>{et.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)pi(t,e,mi(o[e]))}(t,r)})}),l}function Vi(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(Ei(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=[],l=t.variantChildren.size,h=(l-1)*s,u="function"==typeof i,c=u?t=>i(t,l):1===o?(t=0)=>t*s:(t=0)=>h-t*s;return Array.from(t.variantChildren).sort(Mi).forEach((t,s)=>{t.notify("AnimationStart",e),a.push(Vi(t,e,{...r,delay:n+(u?0:i)+c(s)}).then(()=>t.notify("AnimationComplete",e)))}),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)])}function Mi(t,e){return t.sortNodePosition(e)}function Di(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 Ci(t){return"string"==typeof t||Array.isArray(t)}const ki=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ri=["initial",...ki],Li=Ri.length;function ji(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&ji(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Li;n++){const i=Ri[n],s=t.props[i];(Ci(s)||!1===s)&&(e[i]=s)}return e}const Bi=[...ki].reverse(),Fi=ki.length;function Oi(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=>Vi(t,e,n));i=Promise.all(s)}else if("string"==typeof e)i=Vi(t,e,n);else{const s="function"==typeof e?v(t,e,n.custom):e;i=Promise.all(Ei(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}(t,e,n)))}function Ii(t){let e=Oi(t),n=Wi(),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=ji(t.parent)||{},l=[],h=new Set;let u={},c=1/0;for(let e=0;e<Fi;e++){const d=Bi[e],p=n[d],m=void 0!==r[d]?r[d]:a[d],y=Ci(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={...u},!p.isActive&&null===g||!m&&!p.prevProp||f(m)||"boolean"==typeof m)continue;const x=Ui(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},E=e=>{T=!0,h.has(e)&&(w=!0,h.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(u.hasOwnProperty(t))continue;let i=!1;i=di(e)&&di(n)?!Di(e,n):e!==n,i?null!=e?E(t):h.add(t):void 0!==e&&h.has(t)?E(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),i&&t.blockInitialAnimation&&(T=!1);T&&(!(v&&x)||w)&&l.push(...P.map(t=>({animation:t,options:{type:d}})))}if(h.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)}h.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=Wi(),i=!0}}}function Ui(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Di(e,t)}function Ni(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Wi(){return{animate:Ni(!0),whileInView:Ni(),whileHover:Ni(),whileTap:Ni(),whileDrag:Ni(),whileFocus:Ni(),exit:Ni()}}class $i{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Yi=0;const Xi={animation:{Feature:class extends $i{constructor(t){super(t),t.animationState||(t.animationState=Ii(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 $i{constructor(){super(...arguments),this.id=Yi++}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 Ki(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function zi(t){return{point:{x:t.pageX,y:t.pageY}}}function Hi(t,e,n,i){return Ki(t,e,(t=>e=>ni(e)&&t(e,zi(e)))(n),i)}function qi({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function Gi(t){return t.max-t.min}function Zi(t,e,n,i=.5){t.origin=i,t.originPoint=Xt(e.min,e.max,t.origin),t.scale=Gi(n)/Gi(e),t.translate=Xt(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 _i(t,e,n,i){Zi(t.x,e.x,n.x,i?i.originX:void 0),Zi(t.y,e.y,n.y,i?i.originY:void 0)}function Ji(t,e,n){t.min=n.min+e.min,t.max=t.min+Gi(e)}function Qi(t,e,n){t.min=e.min-n.min,t.max=t.min+Gi(e)}function ts(t,e,n){Qi(t.x,e.x,n.x),Qi(t.y,e.y,n.y)}const es=()=>({x:{min:0,max:0},y:{min:0,max:0}});function ns(t){return[t("x"),t("y")]}function is(t){return void 0===t||1===t}function ss({scale:t,scaleX:e,scaleY:n}){return!is(t)||!is(e)||!is(n)}function os(t){return ss(t)||rs(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function rs(t){return as(t.x)||as(t.y)}function as(t){return t&&"0%"!==t}function ls(t,e,n){return n+e*(t-n)}function hs(t,e,n,i,s){return void 0!==s&&(t=ls(t,s,i)),ls(t,n,i)+e}function us(t,e=0,n=1,i,s){t.min=hs(t.min,e,n,i,s),t.max=hs(t.max,e,n,i,s)}function cs(t,{x:e,y:n}){us(t.x,e.translate,e.scale,e.originPoint),us(t.y,n.translate,n.scale,n.originPoint)}const ds=.999999999999,ps=1.0000000000001;function ms(t,e){t.min=t.min+e,t.max=t.max+e}function fs(t,e,n,i,s=.5){us(t,e,n,Xt(t.min,t.max,s),i)}function ys(t,e){fs(t.x,e.x,e.scaleX,e.scale,e.originX),fs(t.y,e.y,e.scaleY,e.scale,e.originY)}function gs(t,e){return qi(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 vs=({current:t})=>t?t.ownerDocument.defaultView:null;function xs(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Ts=(t,e)=>Math.abs(t-e);class ws{constructor(t,e,{transformPagePoint:n,contextWindow:i=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3}={}){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=bs(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=Ts(t.x,e.x),i=Ts(t.y,e.y);return Math.sqrt(n**2+i**2)}(t.offset,{x:0,y:0})>=this.distanceThreshold;if(!e&&!n)return;const{point:i}=t,{timestamp:s}=it;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=Ps(e,this.transformPagePoint),et.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=bs("pointercancel"===t.type?this.lastMoveEventInfo:Ps(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),i&&i(t,o)},!ni(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=i||window;const r=Ps(zi(t),this.transformPagePoint),{point:a}=r,{timestamp:l}=it;this.history=[{...a,timestamp:l}];const{onSessionStart:h}=e;h&&h(t,bs(r,this.history)),this.removeListeners=D(Hi(this.contextWindow,"pointermove",this.handlePointerMove),Hi(this.contextWindow,"pointerup",this.handlePointerUp),Hi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),nt(this.updatePoint)}}function Ps(t,e){return e?{point:e(t.point)}:t}function Ss(t,e){return{x:t.x-e.x,y:t.y-e.y}}function bs({point:t},e){return{point:t,delta:Ss(t,Es(e)),offset:Ss(t,As(e)),velocity:Vs(e,.1)}}function As(t){return t[0]}function Es(t){return t[t.length-1]}function Vs(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=Es(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>R(e)));)n--;if(!i)return{x:0,y:0};const o=L(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&