framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 84.8 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,function(t){"use strict";function e(t,e){-1===t.indexOf(e)&&t.push(e)}function n(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const i=(t,e,n)=>n>e?e:n<t?t:n;function s(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}t.warning=()=>{},t.invariant=()=>{},"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(t.warning=(t,e,n)=>{t||"undefined"==typeof console||console.warn(s(e,n))},t.invariant=(t,e,n)=>{if(!t)throw new Error(s(e,n))});const r={},o=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function a(t){return"object"==typeof t&&null!==t}const l=t=>/^0[^.\s]+$/u.test(t);function u(t){let e;return()=>(void 0===e&&(e=t()),e)}const c=t=>t,h=(t,e)=>n=>e(t(n)),d=(...t)=>t.reduce(h),p=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class f{constructor(){this.subscriptions=[]}add(t){return e(this.subscriptions,t),()=>n(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 m=t=>1e3*t,g=t=>t/1e3;function y(t,e){return e?t*(1e3/e):0}const v=new Set;const w=(t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t},b=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function T(t,e,n,i){if(t===e&&n===i)return c;const s=e=>function(t,e,n,i,s){let r,o,a=0;do{o=e+(n-e)/2,r=b(o,i,s)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:b(s(t),e,i)}const x=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,S=t=>e=>1-t(1-e),M=T(.33,1.53,.69,.99),V=S(M),A=x(V),k=t=>(t*=2)<1?.5*V(t):.5*(2-Math.pow(2,-10*(t-1))),E=t=>1-Math.sin(Math.acos(t)),P=S(E),C=x(E),B=T(.42,0,1,1),O=T(0,0,.58,1),R=T(.42,0,.58,1);const F=t=>Array.isArray(t)&&"number"!=typeof t[0];function I(t,e){return F(t)?t[w(0,t.length,e)]:t}const D=t=>Array.isArray(t)&&"number"==typeof t[0],L={linear:c,easeIn:B,easeInOut:R,easeOut:O,circIn:E,circInOut:C,circOut:P,backIn:V,backInOut:A,backOut:M,anticipate:k},W=e=>{if(D(e)){t.invariant(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[n,i,s,r]=e;return T(n,i,s,r)}return"string"==typeof e?(t.invariant(void 0!==L[e],`Invalid easing type '${e}'`,"invalid-easing-type"),L[e]):e},N=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],j={value:null,addProjectionMetrics:null};function $(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,a=N.reduce((t,n)=>(t[n]=function(t,e){let n=new Set,i=new Set,s=!1,r=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function u(e){o.has(e)&&(c.schedule(e),t()),l++,e(a)}const c={schedule:(t,e=!1,r=!1)=>{const a=r&&s?n:i;return e&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),o.delete(t)},process:t=>{a=t,s?r=!0:(s=!0,[n,i]=[i,n],n.forEach(u),e&&j.value&&j.value.frameloop[e].push(l),l=0,n.clear(),s=!1,r&&(r=!1,c.process(t)))}};return c}(o,e?n:void 0),t),{}),{setup:l,read:u,resolveKeyframes:c,preUpdate:h,update:d,preRender:p,render:f,postRender:m}=a,g=()=>{const o=r.useManualTiming?s.timestamp:performance.now();n=!1,r.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(o-s.timestamp,40),1)),s.timestamp=o,s.isProcessing=!0,l.process(s),u.process(s),c.process(s),h.process(s),d.process(s),p.process(s),f.process(s),m.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(g))};return{schedule:N.reduce((e,r)=>{const o=a[r];return e[r]=(e,r=!1,a=!1)=>(n||(n=!0,i=!0,s.isProcessing||t(g)),o.schedule(e,r,a)),e},{}),cancel:t=>{for(let e=0;e<N.length;e++)a[N[e]].cancel(t)},state:s,steps:a}}const{schedule:K,cancel:U,state:Y,steps:z}=$("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:c,!0);let X;function H(){X=void 0}const G={now:()=>(void 0===X&&G.set(Y.isProcessing||r.useManualTiming?Y.timestamp:performance.now()),X),set:t=>{X=t,queueMicrotask(H)}},q={layout:0,mainThread:0,waapi:0},Z=t=>e=>"string"==typeof e&&e.startsWith(t),_=Z("--"),J=Z("var(--"),Q=t=>!!J(t)&&tt.test(t.split("/*")[0].trim()),tt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,et={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},nt={...et,transform:t=>i(0,1,t)},it={...et,default:1},st=t=>Math.round(1e5*t)/1e5,rt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const ot=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,at=(t,e)=>n=>Boolean("string"==typeof n&&ot.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),lt=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,r,o,a]=i.match(rt);return{[t]:parseFloat(s),[e]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==a?parseFloat(a):1}},ut={...et,transform:t=>Math.round((t=>i(0,255,t))(t))},ct={test:at("rgb","red"),parse:lt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+ut.transform(t)+", "+ut.transform(e)+", "+ut.transform(n)+", "+st(nt.transform(i))+")"};const ht={test:at("#"),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:ct.transform},dt=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),pt=dt("deg"),ft=dt("%"),mt=dt("px"),gt=dt("vh"),yt=dt("vw"),vt=(()=>({...ft,parse:t=>ft.parse(t)/100,transform:t=>ft.transform(100*t)}))(),wt={test:at("hsl","hue"),parse:lt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+ft.transform(st(e))+", "+ft.transform(st(n))+", "+st(nt.transform(i))+")"},bt={test:t=>ct.test(t)||ht.test(t)||wt.test(t),parse:t=>ct.test(t)?ct.parse(t):wt.test(t)?wt.parse(t):ht.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ct.transform(t):wt.transform(t),getAnimatableNone:t=>{const e=bt.parse(t);return e.alpha=0,bt.transform(e)}},Tt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const xt="number",St="color",Mt=/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 Vt(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let r=0;const o=e.replace(Mt,t=>(bt.test(t)?(i.color.push(r),s.push(St),n.push(bt.parse(t))):t.startsWith("var(")?(i.var.push(r),s.push("var"),n.push(t)):(i.number.push(r),s.push(xt),n.push(parseFloat(t))),++r,"${}")).split("${}");return{values:n,split:o,indexes:i,types:s}}function At(t){return Vt(t).values}function kt(t){const{split:e,types:n}=Vt(t),i=e.length;return t=>{let s="";for(let r=0;r<i;r++)if(s+=e[r],void 0!==t[r]){const e=n[r];s+=e===xt?st(t[r]):e===St?bt.transform(t[r]):t[r]}return s}}const Et=t=>"number"==typeof t?0:bt.test(t)?bt.getAnimatableNone(t):t;const Pt={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(rt)?.length||0)+(t.match(Tt)?.length||0)>0},parse:At,createTransformer:kt,getAnimatableNone:function(t){const e=At(t);return kt(t)(e.map(Et))}};function Ct(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 Bt({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,r=0,o=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=Ct(a,i,t+1/3),r=Ct(a,i,t),o=Ct(a,i,t-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:i}}function Ot(t,e){return n=>n>0?e:t}const Rt=(t,e,n)=>t+(e-t)*n,Ft=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},It=[ht,ct,wt];function Dt(e){const n=(i=e,It.find(t=>t.test(i)));var i;if(t.warning(Boolean(n),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(n))return!1;let s=n.parse(e);return n===wt&&(s=Bt(s)),s}const Lt=(t,e)=>{const n=Dt(t),i=Dt(e);if(!n||!i)return Ot(t,e);const s={...n};return t=>(s.red=Ft(n.red,i.red,t),s.green=Ft(n.green,i.green,t),s.blue=Ft(n.blue,i.blue,t),s.alpha=Rt(n.alpha,i.alpha,t),ct.transform(s))},Wt=new Set(["none","hidden"]);function Nt(t,e){return Wt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function jt(t,e){return n=>Rt(t,e,n)}function $t(t){return"number"==typeof t?jt:"string"==typeof t?Q(t)?Ot:bt.test(t)?Lt:Yt:Array.isArray(t)?Kt:"object"==typeof t?bt.test(t)?Lt:Ut:Ot}function Kt(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 Ut(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 Yt=(e,n)=>{const i=Pt.createTransformer(n),s=Vt(e),r=Vt(n);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?Wt.has(e)&&!r.values.length||Wt.has(n)&&!s.values.length?Nt(e,n):d(Kt(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const r=e.types[s],o=t.indexes[r][i[r]],a=t.values[o]??0;n[s]=a,i[r]++}return n}(s,r),r.values),i):(t.warning(!0,`Complex values '${e}' and '${n}' 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"),Ot(e,n))};function zt(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Rt(t,e,n);return $t(t)(t,e)}const Xt=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>K.update(e,t),stop:()=>U(e),now:()=>Y.isProcessing?Y.timestamp:G.now()}},Ht=(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)})`},Gt=2e4;function qt(t){let e=0;let n=t.next(e);for(;!n.done&&e<Gt;)e+=50,n=t.next(e);return e>=Gt?1/0:e}function Zt(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(qt(i),Gt);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:g(s)}}function _t(t,e,n){const i=Math.max(e-5,0);return y(n-t(i),e-i)}const Jt=100,Qt=10,te=1,ee=0,ne=800,ie=.3,se=.3,re={granular:.01,default:2},oe={granular:.005,default:.5},ae=.01,le=10,ue=.05,ce=1,he=.001;function de({duration:e=ne,bounce:n=ie,velocity:s=ee,mass:r=te}){let o,a;t.warning(e<=m(le),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-n;l=i(ue,ce,l),e=i(ae,le,g(e)),l<1?(o=t=>{const n=t*l,i=n*e,r=n-s,o=fe(t,l),a=Math.exp(-i);return he-r/o*a},a=t=>{const n=t*l*e,i=n*s+s,r=Math.pow(l,2)*Math.pow(t,2)*e,a=Math.exp(-n),u=fe(Math.pow(t,2),l);return(-o(t)+he>0?-1:1)*((i-r)*a)/u}):(o=t=>Math.exp(-t*e)*((t-s)*e+1)-.001,a=t=>Math.exp(-t*e)*(e*e*(s-t)));const u=function(t,e,n){let i=n;for(let n=1;n<pe;n++)i-=t(i)/e(i);return i}(o,a,5/e);if(e=m(e),isNaN(u))return{stiffness:Jt,damping:Qt,duration:e};{const t=Math.pow(u,2)*r;return{stiffness:t,damping:2*l*Math.sqrt(r*t),duration:e}}}const pe=12;function fe(t,e){return t*Math.sqrt(1-e*e)}const me=["duration","bounce"],ge=["stiffness","damping","mass"];function ye(t,e){return e.some(e=>void 0!==t[e])}function ve(t=se,e=ie){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:r}=n;const o=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:o},{stiffness:u,damping:c,mass:h,duration:d,velocity:p,isResolvedFromDuration:f}=function(t){let e={velocity:ee,stiffness:Jt,damping:Qt,mass:te,isResolvedFromDuration:!1,...t};if(!ye(t,ge)&&ye(t,me))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(1.2*n),r=s*s,o=2*i(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:te,stiffness:r,damping:o}}else{const n=de(t);e={...e,...n,mass:te},e.isResolvedFromDuration=!0}return e}({...n,velocity:-g(n.velocity||0)}),y=p||0,v=c/(2*Math.sqrt(u*h)),w=a-o,b=g(Math.sqrt(u/h)),T=Math.abs(w)<5;let x;if(s||(s=T?re.granular:re.default),r||(r=T?oe.granular:oe.default),v<1){const t=fe(b,v);x=e=>{const n=Math.exp(-v*b*e);return a-n*((y+v*b*w)/t*Math.sin(t*e)+w*Math.cos(t*e))}}else if(1===v)x=t=>a-Math.exp(-b*t)*(w+(y+b*w)*t);else{const t=b*Math.sqrt(v*v-1);x=e=>{const n=Math.exp(-v*b*e),i=Math.min(t*e,300);return a-n*((y+v*b*w)*Math.sinh(i)+t*w*Math.cosh(i))/t}}const S={calculatedDuration:f&&d||null,next:t=>{const e=x(t);if(f)l.done=t>=d;else{let n=0===t?y:0;v<1&&(n=0===t?m(y):_t(x,t,e));const i=Math.abs(n)<=s,o=Math.abs(a-e)<=r;l.done=i&&o}return l.value=l.done?a:e,l},toString:()=>{const t=Math.min(qt(S),Gt),e=Ht(e=>S.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return S}function we({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let f=n*e;const m=h+f,g=void 0===o?m:o(m);g!==m&&(f=g-h);const y=t=>-f*Math.exp(-t/i),v=t=>g+y(t),w=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g:n};let b,T;const x=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(b=t,T=ve({keyframes:[d.value,p(d.value)],velocity:_t(v,t,d.value),damping:s,stiffness:r,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==b||(e=!0,w(t),x(t)),void 0!==b&&t>=b?T.next(t-b):(!e&&w(t),d)}}}function be(e,n,{clamp:s=!0,ease:o,mixer:a}={}){const l=e.length;if(t.invariant(l===n.length,"Both input and output ranges must be the same length","range-length"),1===l)return()=>n[0];if(2===l&&n[0]===n[1])return()=>n[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),n=[...n].reverse());const h=function(t,e,n){const i=[],s=n||r.mix||zt,o=t.length-1;for(let n=0;n<o;n++){let r=s(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||c:e;r=d(t,r)}i.push(r)}return i}(n,o,a),f=h.length,m=t=>{if(u&&t<e[0])return n[0];let i=0;if(f>1)for(;i<e.length-2&&!(t<e[i+1]);i++);const s=p(e[i],e[i+1],t);return h[i](s)};return s?t=>m(i(e[0],e[l-1],t)):m}function Te(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=p(0,e,i);t.push(Rt(n,1,s))}}function xe(t){const e=[0];return Te(e,t.length-1),e}function Se(t,e){return t.map(t=>t*e)}function Me(t,e){return t.map(()=>e||R).splice(0,t.length-1)}function Ve({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=F(i)?i.map(W):W(i),r={done:!1,value:e[0]},o=be(Se(n&&n.length===e.length?n:xe(e),t),e,{ease:Array.isArray(s)?s:Me(e,s)});return{calculatedDuration:t,next:e=>(r.value=o(e),r.done=e>=t,r)}}ve.applyToOptions=t=>{const e=Zt(t,100,ve);return t.ease=e.ease,t.duration=m(e.duration),t.type="keyframes",t};const Ae=t=>null!==t;function ke(t,{repeat:e,repeatType:n="loop"},i,s=1){const r=t.filter(Ae),o=s<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return o&&void 0!==i?i:r[o]}const Ee={decay:we,inertia:we,tween:Ve,keyframes:Ve,spring:ve};function Pe(t){"string"==typeof t.type&&(t.type=Ee[t.type])}class Ce{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 Be=t=>t/100;class Oe extends Ce{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!==G.now()&&this.tick(G.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},q.mainThread++,this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;Pe(t);const{type:e=Ve,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:r=0}=t;let{keyframes:o}=t;const a=e||Ve;a!==Ve&&"number"!=typeof o[0]&&(this.mixKeyframes=d(Be,zt(o[0],o[1])),o=[0,100]);const l=a({...t,keyframes:o});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...o].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=qt(l));const{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=l}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:n,totalDuration:s,mixKeyframes:r,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(null===this.startTime)return n.next(0);const{delay:u=0,keyframes:c,repeat:h,repeatType:d,repeatDelay:p,type:f,onUpdate:m,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=s);let w=this.currentTime,b=n;if(h){const t=Math.min(this.currentTime,s)/a;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,h+1);Boolean(e%2)&&("reverse"===d?(n=1-n,p&&(n-=p/a)):"mirror"===d&&(b=o)),w=i(0,1,n)*a}const T=v?{done:!1,value:c[0]}:b.next(w);r&&(T.value=r(T.value));let{done:x}=T;v||null===l||(x=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&x);return S&&f!==we&&(T.value=ke(c,this.options,g,this.speed)),m&&m(T.value),S&&this.finish(),T}then(t,e){return this.finished.then(t,e)}get duration(){return g(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+g(t)}get time(){return g(this.currentTime)}set time(t){t=m(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(G.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=g(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Xt,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(G.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,q.mainThread--}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)}}function Re(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Fe=t=>180*t/Math.PI,Ie=t=>{const e=Fe(Math.atan2(t[1],t[0]));return Le(e)},De={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Ie,rotateZ:Ie,skewX:t=>Fe(Math.atan(t[1])),skewY:t=>Fe(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Le=t=>((t%=360)<0&&(t+=360),t),We=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Ne=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),je={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:We,scaleY:Ne,scale:t=>(We(t)+Ne(t))/2,rotateX:t=>Le(Fe(Math.atan2(t[6],t[5]))),rotateY:t=>Le(Fe(Math.atan2(-t[2],t[0]))),rotateZ:Ie,rotate:Ie,skewX:t=>Fe(Math.atan(t[4])),skewY:t=>Fe(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function $e(t){return t.includes("scale")?1:0}function Ke(t,e){if(!t||"none"===t)return $e(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=je,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=De,s=e}if(!s)return $e(e);const r=i[e],o=s[1].split(",").map(Ye);return"function"==typeof r?r(o):o[r]}const Ue=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Ke(n,e)};function Ye(t){return parseFloat(t.trim())}const ze=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xe=(()=>new Set(ze))(),He=t=>t===et||t===mt,Ge=new Set(["x","y","z"]),qe=ze.filter(t=>!Ge.has(t));const Ze={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})=>Ke(e,"x"),y:(t,{transform:e})=>Ke(e,"y")};Ze.translateX=Ze.x,Ze.translateY=Ze.y;const _e=new Set;let Je=!1,Qe=!1,tn=!1;function en(){if(Qe){const t=Array.from(_e).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)})}Qe=!1,Je=!1,_e.forEach(t=>t.complete(tn)),_e.clear()}function nn(){_e.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Qe=!0)})}function sn(){tn=!0,nn(),en(),tn=!1}class rn{constructor(t,e,n,i,s,r=!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=r}scheduleResolve(){this.state="scheduled",this.isAsync?(_e.add(this),Je||(Je=!0,K.read(nn),K.resolveKeyframes(en))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;if(null===t[0]){const s=i?.get(),r=t[t.length-1];if(void 0!==s)t[0]=s;else if(n&&e){const i=n.readValue(e,r);null!=i&&(t[0]=i)}void 0===t[0]&&(t[0]=r),i&&void 0===s&&i.set(t[0])}Re(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),_e.delete(this)}cancel(){"scheduled"===this.state&&(_e.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const on=t=>t.startsWith("--");function an(t,e,n){on(e)?t.style.setProperty(e,n):t.style[e]=n}const ln=u(()=>void 0!==window.ScrollTimeline),un={};function cn(t,e){const n=u(t);return()=>un[e]??n()}const hn=cn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),dn=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,pn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dn([0,.65,.55,1]),circOut:dn([.55,0,1,.45]),backIn:dn([.31,.01,.66,-.59]),backOut:dn([.33,1.53,.69,.99])};function fn(t,e){return t?"function"==typeof t?hn()?Ht(t,e):"ease-out":D(t)?dn(t):Array.isArray(t)?t.map(t=>fn(t,e)||pn.easeOut):pn[t]:void 0}function mn(t,e,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:a="easeOut",times:l}={},u=void 0){const c={[e]:n};l&&(c.offset=l);const h=fn(a,s);Array.isArray(h)&&(c.easing=h),j.value&&q.waapi++;const d={delay:i,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"};u&&(d.pseudoElement=u);const p=t.animate(c,d);return j.value&&p.finished.finally(()=>{q.waapi--}),p}function gn(t){return"function"==typeof t&&"applyToOptions"in t}function yn({type:t,...e}){return gn(t)&&hn()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class vn extends Ce{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:i,keyframes:s,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=e,t.invariant("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const u=yn(e);this.animation=mn(n,i,s,u,r),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=ke(s,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(t):an(n,i,t),this.animation.cancel()}l?.(),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 g(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+g(t)}get time(){return g(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=m(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&ln()?(this.animation.timeline=t,c):e(this)}}const wn={anticipate:k,backInOut:A,circInOut:C};function bn(t){"string"==typeof t.ease&&t.ease in wn&&(t.ease=wn[t.ease])}class Tn extends vn{constructor(t){bn(t),Pe(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:i,element:s,...r}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const o=new Oe({...r,autoplay:!1}),a=m(this.finishedTime??this.time);e.setWithVelocity(o.sample(a-10).value,o.sample(a).value,10),o.stop()}}const xn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Pt.test(t)&&"0"!==t||t.startsWith("url(")));function Sn(t){t.duration=0,t.type="keyframes"}const Mn=new Set(["opacity","clipPath","filter","transform"]),Vn=u(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function An(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:r,type:o}=t,a=e?.owner?.current;if(!(a instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=e.owner.getProps();return Vn()&&n&&Mn.has(n)&&("transform"!==n||!u)&&!l&&!i&&"mirror"!==s&&0!==r&&"inertia"!==o}class kn extends Ce{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r="loop",keyframes:o,name:a,motionValue:l,element:u,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=G.now();const h={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:r,name:a,motionValue:l,element:u,...c},d=u?.KeyframeResolver||rn;this.keyframeResolver=new d(o,(t,e,n)=>this.onKeyframesResolved(t,e,h,!n),a,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,i,s){this.keyframeResolver=void 0;const{name:o,type:a,velocity:l,delay:u,isHandoff:h,onUpdate:d}=i;this.resolvedAt=G.now(),function(e,n,i,s){const r=e[0];if(null===r)return!1;if("display"===n||"visibility"===n)return!0;const o=e[e.length-1],a=xn(r,n),l=xn(o,n);return t.warning(a===l,`You are trying to animate ${n} from "${r}" to "${o}". "${a?o:r}" is not an animatable value.`,"value-not-animatable"),!(!a||!l)&&(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}(e)||("spring"===i||gn(i))&&s)}(e,o,a,l)||(!r.instantAnimations&&u||d?.(ke(e,i,n)),e[0]=e[e.length-1],Sn(i),i.repeat=0);const p={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},f=!h&&An(p)?new Tn({...p,element:p.motionValue.owner.current}):new Oe(p);f.finished.then(()=>this.notifyFinished()).catch(c),this.pendingTimeline&&(this.stopTimeline=f.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=f}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(),sn()),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()}}class En{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return Pn(this.animations,"duration")}get iterationDuration(){return Pn(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Pn(t,e){let n=0;for(let i=0;i<t.length;i++){const s=t[i][e];null!==s&&s>n&&(n=s)}return n}class Cn extends En{then(t,e){return this.finished.finally(t).then(()=>{})}}class Bn extends vn{constructor(t){super(),this.animation=t,t.onfinish=()=>{this.finishedTime=this.time,this.notifyFinished()}}}const On=new WeakMap,Rn=(t,e="")=>`${t}:${e}`;function Fn(t){const e=On.get(t)||new Map;return On.set(t,e),e}const In=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Dn(t){const e=In.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}function Ln(e,n,i=1){t.invariant(i<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=Dn(e);if(!s)return;const a=window.getComputedStyle(n).getPropertyValue(s);if(a){const t=a.trim();return o(t)?parseFloat(t):t}return Q(r)?Ln(r,n,i+1):r}function Wn(t,e){return t?.[e]??t?.default??t}const Nn=new Set(["width","height","top","left","right","bottom",...ze]),jn=t=>e=>e.test(t),$n=[et,mt,ft,pt,yt,gt,{test:t=>"auto"===t,parse:t=>t}],Kn=t=>$n.find(jn(t));function Un(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||l(t))}const Yn=new Set(["brightness","contrast","saturate","opacity"]);function zn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(rt)||[];if(!i)return t;const s=n.replace(i,"");let r=Yn.has(e)?1:0;return i!==n&&(r*=100),e+"("+r+s+")"}const Xn=/\b([a-z-]*)\(.*?\)/gu,Hn={...Pt,getAnimatableNone:t=>{const e=t.match(Xn);return e?e.map(zn).join(" "):t}},Gn={...et,transform:Math.round},qn={rotate:pt,rotateX:pt,rotateY:pt,rotateZ:pt,scale:it,scaleX:it,scaleY:it,scaleZ:it,skew:pt,skewX:pt,skewY:pt,distance:mt,translateX:mt,translateY:mt,translateZ:mt,x:mt,y:mt,z:mt,perspective:mt,transformPerspective:mt,opacity:nt,originX:vt,originY:vt,originZ:mt},Zn={borderWidth:mt,borderTopWidth:mt,borderRightWidth:mt,borderBottomWidth:mt,borderLeftWidth:mt,borderRadius:mt,radius:mt,borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomRightRadius:mt,borderBottomLeftRadius:mt,width:mt,maxWidth:mt,height:mt,maxHeight:mt,top:mt,right:mt,bottom:mt,left:mt,inset:mt,insetBlock:mt,insetBlockStart:mt,insetBlockEnd:mt,insetInline:mt,insetInlineStart:mt,insetInlineEnd:mt,padding:mt,paddingTop:mt,paddingRight:mt,paddingBottom:mt,paddingLeft:mt,paddingBlock:mt,paddingBlockStart:mt,paddingBlockEnd:mt,paddingInline:mt,paddingInlineStart:mt,paddingInlineEnd:mt,margin:mt,marginTop:mt,marginRight:mt,marginBottom:mt,marginLeft:mt,marginBlock:mt,marginBlockStart:mt,marginBlockEnd:mt,marginInline:mt,marginInlineStart:mt,marginInlineEnd:mt,backgroundPositionX:mt,backgroundPositionY:mt,...qn,zIndex:Gn,fillOpacity:nt,strokeOpacity:nt,numOctaves:Gn},_n={...Zn,color:bt,backgroundColor:bt,outlineColor:bt,fill:bt,stroke:bt,borderColor:bt,borderTopColor:bt,borderRightColor:bt,borderBottomColor:bt,borderLeftColor:bt,filter:Hn,WebkitFilter:Hn},Jn=t=>_n[t];function Qn(t,e){let n=Jn(t);return n!==Hn&&(n=Pt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ti=new Set(["auto","none","0"]);class ei extends rn{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(),Q(i))){const s=Ln(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Nn.has(n)||2!==t.length)return;const[i,s]=t,r=Kn(i),o=Kn(s);if(r!==o)if(He(r)&&He(o))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else Ze[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||Un(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&&!ti.has(e)&&Vt(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=Qn(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=Ze[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,r=n[s];n[s]=Ze[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}const ni=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","radius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","backgroundPositionX","backgroundPositionY"]);function ii(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&ni.has(e)&&(t[n]=t[n]+"px")}const si=u(()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0}),ri=new Set(["opacity","clipPath","filter","transform"]);function oi(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)}function ai(t){return(e,n)=>{const i=oi(e),s=[];for(const e of i){const i=t(e,n);s.push(i)}return()=>{for(const t of s)t()}}}const li=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class ui{constructor(){this.latest={},this.values=new Map}set(t,e,n,i,s=!0){const r=this.values.get(t);r&&r.onRemove();const o=()=>{const i=e.get();this.latest[t]=s?li(i,Zn[t]):i,n&&K.render(n)};o();const a=e.on("change",o);i&&e.addDependent(i);const l=()=>{a(),n&&U(n),this.values.delete(t),i&&e.removeDependent(i)};return this.values.set(t,{value:e,onRemove:l}),l}get(t){return this.values.get(t)?.value}destroy(){for(const t of this.values.values())t.onRemove()}}function ci(t){const e=new WeakMap,n=[];return(i,s)=>{const r=e.get(i)??new ui;e.set(i,r);for(const e in s){const o=s[e],a=t(i,r,e,o);n.push(a)}return()=>{for(const t of n)t()}}}const hi=(t,e,n,i)=>{const s=function(t,e){if(!(e in t))return!1;const n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),e)||Object.getOwnPropertyDescriptor(t,e);return n&&"function"==typeof n.set}(t,n),r=s?n:n.startsWith("data")||n.startsWith("aria")?n.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`):n;const o=s?()=>{t[r]=e.latest[n]}:()=>{const i=e.latest[n];null==i?t.removeAttribute(r):t.setAttribute(r,String(i))};return e.set(n,i,o)},di=ai(ci(hi)),pi=ci((t,e,n,i)=>e.set(n,i,()=>{t[n]=e.latest[n]},void 0,!1));function fi(t){return a(t)&&"offsetHeight"in t}const mi={current:void 0};class gi{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=G.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=G.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 f);const n=this.events[t].add(e);return"change"===t?()=>{n(),K.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 mi.current&&mi.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=G.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return y(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 yi(t,e){return new gi(t,e)}const vi={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const wi=new Set(["originX","originY","originZ"]),bi=(t,e,n,i)=>{let s,r;return Xe.has(n)?(e.get("transform")||(fi(t)||e.get("transformBox")||bi(t,e,"transformBox",new gi("fill-box")),e.set("transform",new gi("none"),()=>{t.style.transform=function(t){let e="",n=!0;for(let i=0;i<ze.length;i++){const s=ze[i],r=t.latest[s];if(void 0===r)continue;let o=!0;o="number"==typeof r?r===(s.startsWith("scale")?1:0):0===parseFloat(r),o||(n=!1,e+=`${vi[s]||s}(${t.latest[s]}) `)}return n?"none":e.trim()}(e)})),r=e.get("transform")):wi.has(n)?(e.get("transformOrigin")||e.set("transformOrigin",new gi(""),()=>{const n=e.latest.originX??"50%",i=e.latest.originY??"50%",s=e.latest.originZ??0;t.style.transformOrigin=`${n} ${i} ${s}`}),r=e.get("transformOrigin")):s=on(n)?()=>{t.style.setProperty(n,e.latest[n])}:()=>{t.style[n]=e.latest[n]},e.set(n,i,s,r)},Ti=ai(ci(bi)),xi=mt.transform;const Si=ai(ci((t,e,n,i)=>{if(n.startsWith("path"))return function(t,e,n,i){return K.render(()=>t.setAttribute("pathLength","1")),"pathOffset"===n?e.set(n,i,()=>t.setAttribute("stroke-dashoffset",xi(-e.latest[n]))):(e.get("stroke-dasharray")||e.set("stroke-dasharray",new gi("1 1"),()=>{const{pathLength:n=1,pathSpacing:i}=e.latest;t.setAttribute("stroke-dasharray",`${xi(n)} ${xi(i??1-Number(n))}`)}),e.set(n,i,void 0,e.get("stroke-dasharray")))}(t,e,n,i);if(n.startsWith("attr"))return hi(t,e,function(t){return t.replace(/^attr([A-Z])/,(t,e)=>e.toLowerCase())}(n),i);return(n in t.style?bi:hi)(t,e,n,i)}));const{schedule:Mi,cancel:Vi}=$(queueMicrotask,!1),Ai={x:!1,y:!1};function ki(){return Ai.x||Ai.y}function Ei(t,e){const n=oi(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function Pi(t){return!("touch"===t.pointerType||ki())}const Ci=(t,e)=>!!e&&(t===e||Ci(t,e.parentElement)),Bi=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Oi=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Ri=new WeakSet;function Fi(t){return e=>{"Enter"===e.key&&t(e)}}function Ii(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Di(t){return Bi(t)&&!ki()}function Li(t,e){const n=window.getComputedStyle(t);return on(e)?n.getPropertyValue(e):n[e]}function Wi(t){return a(t)&&"ownerSVGElement"in t}const Ni=new WeakMap;let ji;const $i=(t,e,n)=>(i,s)=>s&&s[0]?s[0][t+"Size"]:Wi(i)&&"getBBox"in i?i.getBBox()[e]:i[n],Ki=$i("inline","width","offsetWidth"),Ui=$i("block","height","offsetHeight");function Yi({target:t,borderBoxSize:e}){Ni.get(t)?.forEach(n=>{n(t,{get width(){return Ki(t,e)},get height(){return Ui(t,e)}})})}function zi(t){t.forEach(Yi)}function Xi(t,e){ji||"undefined"!=typeof ResizeObserver&&(ji=new ResizeObserver(zi));const n=oi(t);return n.forEach(t=>{let n=Ni.get(t);n||(n=new Set,Ni.set(t,n)),n.add(e),ji?.observe(t)}),()=>{n.forEach(t=>{const n=Ni.get(t);n?.delete(e),n?.size||ji?.unobserve(t)})}}const Hi=new Set;let Gi;function qi(t){return Hi.add(t),Gi||(Gi=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Hi.forEach(e=>e(t))},window.addEventListener("resize",Gi)),()=>{Hi.delete(t),Hi.size||"function"!=typeof Gi||(window.removeEventListener("resize",Gi),Gi=void 0)}}function Zi(t,e){return"function"==typeof t?qi(t):Xi(t,e)}function _i(t,e){let n;const i=()=>{const{currentTime:i}=e,s=(null===i?0:i.value)/100;n!==s&&t(s),n=s};return K.preUpdate(i,!0),()=>U(i)}function Ji(){const{value:t}=j;null!==t?(t.frameloop.rate.push(Y.delta),t.animations.mainThread.push(q.mainThread),t.animations.waapi.push(q.waapi),t.animations.layout.push(q.layout)):U(Ji)}function Qi(t){return t.reduce((t,e)=>t+e,0)/t.length}function ts(t,e=Qi){return 0===t.length?{min:0,max:0,avg:0}:{min:Math.min(...t),max:Math.max(...t),avg:e(t)}}const es=t=>Math.round(1e3/t);function ns(){j.value=null,j.addProjectionMetrics=null}function is(){const{value:t}=j;if(!t)throw new Error("Stats are not being measured");ns(),U(Ji);const e={frameloop:{setup:ts(t.frameloop.setup),rate:ts(t.frameloop.rate),read:ts(t.frameloop.read),resolveKeyframes:ts(t.frameloop.resolveKeyframes),preUpdate:ts(t.frameloop.preUpdate),update:ts(t.frameloop.update),preRender:ts(t.frameloop.preRender),render:ts(t.frameloop.render),postRender:ts(t.frameloop.postRender)},animations:{mainThread:ts(t.animations.mainThread),waapi:ts(t.animations.waapi),layout:ts(t.animations.layout)},layoutProjection:{nodes:ts(t.layoutProjection.nodes),calculatedTargetDeltas:ts(t.layoutProjection.calculatedTargetDeltas),calculatedProjections:ts(t.layoutProjection.calculatedProjections)}},{rate:n}=e.frameloop;return n.min=es(n.min),n.max=es(n.max),n.avg=es(n.avg),[n.min,n.max]=[n.max,n.min],e}function ss(t){return Wi(t)&&"svg"===t.tagName}function rs(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}function os(...t){const e=!Array.isArray(t[0]),n=e?0:-1,i=t[0+n],s=be(t[1+n],t[2+n],t[3+n]);return e?s(i):s}function as(t){const e=[];mi.current=e;const n=t();mi.current=void 0;const i=yi(n);return function(t,e,n){const i=()=>e.set(n()),s=()=>K.preRender(i,!1,!0),r=t.map(t=>t.on("change",s));e.on("destroy",()=>{r.forEach(t=>t()),U(i)})}(e,i,t),i}const ls=t=>Boolean(t&&t.getVelocity);function us(t,e,n){const i=t.get();let s,r=null,o=i;const a="string"==typeof i?i.replace(/[\d.-]/g,""):void 0,l=()=>{r&&(r.stop(),r=null)};if(t.attach((e,i)=>{o=e,s=t=>i(cs(t,a)),K.postRender(()=>{l(),r=new Oe({keyframes:[hs(t.get()),hs(o)],velocity:t.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:s}),t.events.animationStart?.notify(),r?.then(()=>{t.events.animationComplete?.notify()})})},l),ls(e)){const n=e.on("change",e=>t.set(cs(e,a))),i=t.on("destroy",n);return()=>{n(),i()}}return l}function cs(t,e){return e?t+e:t}function hs(t){return"number"==typeof t?t:parseFloat(t)}const ds=[...$n,bt,Pt],ps=t=>ds.find(jn(t));function fs(t){return"layout"===t?"group":"enter"===t||"new"===t?"new":"exit"===t||"old"===t?"old":"group"}let ms={},gs=null;const ys=(t,e)=>{ms[t]=e},vs=()=>{gs||(gs=document.createElement("style"),gs.id="motion-view");let t="";for(const e in ms){const n=ms[e];t+=`${e} {\n`;for(const[e,i]of Object.entries(n))t+=` ${e}: ${i};\n`;t+="}\n"}gs.textContent=t,document.head.appendChild(gs),ms={}},ws=()=>{gs&&gs.parentElement&&gs.parentElement.removeChild(gs)};function bs(t){const e=t.match(/::view-transition-(old|new|group|image-pair)\((.*?)\)/);return e?{layer:e[2],type:e[1]}:null}function Ts(t){const{effect:e}=t;return!!e&&(e.target===document.documentElement&&e.pseudoElement?.startsWith("::view-transition"))}function xs(){return document.getAnimations().filter(Ts)}const Ss=["layout","enter","exit","new","old"];function Ms(t){const{update:e,targets:n,options:i}=t;if(!document.startViewTransition)return new Promise(async t=>{await e(),t(new En([]))});(function(t,e){return e.has(t)&&Object.keys(e.get(t)).length>0})("root",n)||ys(":root",{"view-transition-name":"none"}),ys("::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)",{"animation-timing-function":"linear !important"}),vs();const s=document.startViewTransition(async()=>{await e()});return s.finished.finally(()=>{ws()}),new Promise(t=>{s.ready.then(()=>{const e=xs(),s=[];n.forEach((t,e)=>{for(const n of Ss){if(!t[n])continue;const{keyframes:r,options:o}=t[n];for(let[t,a]of Object.entries(r)){if(!a)continue;const r={...Wn(i,t),...Wn(o,t)},l=fs(n);if("opacity"===t&&!Array.isArray(a)){a=["new"===l?0:1,a]}"function"==typeof r.delay&&(r.delay=r.delay(0,1)),r.duration&&(r.duration=m(r.duration)),r.delay&&(r.delay=m(r.delay));const u=new vn({...r,element:document.documentElement,name:t,pseudoElement:`::view-transition-${l}(${e})`,keyframes:a});s.push(u)}}});for(const t of e){if("finished"===t.playState)continue;const{effect:e}=t;if(!(e&&e instanceof KeyframeEffect))continue;const{pseudoElement:r}=e;if(!r)continue;const o=bs(r);if(!o)continue;const a=n.get(o.layer);if(a)Vs(a,"enter")&&Vs(a,"exit")&&e.getKeyframes().some(t=>t.mixBlendMode)?s.push(new Bn(t)):t.cancel();else{const n="group"===o.type?"layout":"";let r={...Wn(i,n)};r.duration&&(r.duration=m(r.duration)),r=yn(r);const a=fn(r.ease,r.duration);e.updateTiming({delay:m(r.delay??0),duration:r.duration,easing:a}),s.push(new Bn(t))}}t(new En(s))})})}function Vs(t,e){return t?.[e]?.keyframes.opacity}let As=[],ks=null;function Es(){ks=null;const[t]=As;var e;t&&(n(As,e=t),ks=e,Ms(e).then(t=>{e.notifyReady(t),t.finished.finally(Es)}))}function Ps(){for(let t=As.length-1;t>=0;t--){const e=As[t],{interrupt:n}=e.options;if("immediate"===n){const n=As.slice(0,t+1).map(t=>t.update)