UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

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