framer-motion 12.24.6 → 12.24.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 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 p,G as m,H as f,I as y,J as g,K as v,b as x,m as T,o as P,r as w,M as S,n as A,i as b,h as V,p as E,k as M,N as C,d as D,s as k,P as R,L,S as j,a as B,O as F,j as I,Q as O,R as U,l as N,e as $,f as K,g as W}from"./size-rollup-dom-max-assets.js";import{jsx as z}from"react/jsx-runtime";import{useContext as Y,useId as X,useEffect as G,useCallback as H,Component as q,Fragment as _}from"react";function Z(t,e){-1===t.indexOf(e)&&t.push(e)}function J(t,e){const i=t.indexOf(e);i>-1&&t.splice(i,1)}function Q(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let tt=()=>{},et=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(tt=(t,e,i)=>{t||"undefined"==typeof console||console.warn(Q(e,i))},et=(t,e,i)=>{if(!t)throw new Error(Q(e,i))});const it={},nt=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function st(t){return"object"==typeof t&&null!==t}const ot=t=>/^0[^.\s]+$/u.test(t);function rt(t){let e;return()=>(void 0===e&&(e=t()),e)}const at=t=>t,lt=(t,e)=>i=>e(t(i)),ht=(...t)=>t.reduce(lt),ut=(t,e,i)=>{const n=e-t;return 0===n?1:(i-t)/n};class ct{constructor(){this.subscriptions=[]}add(t){return Z(this.subscriptions,t),()=>J(this.subscriptions,t)}notify(t,e,i){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,i);else for(let s=0;s<n;s++){const n=this.subscriptions[s];n&&n(t,e,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const dt=t=>1e3*t,pt=t=>t/1e3;function mt(t,e){return e?t*(1e3/e):0}const ft=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function yt(t,e,i,n){if(t===e&&i===n)return at;const s=e=>function(t,e,i,n,s){let o,r,a=0;do{r=e+(i-e)/2,o=ft(r,n,s)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:ft(s(t),e,n)}const gt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,vt=t=>e=>1-t(1-e),xt=yt(.33,1.53,.69,.99),Tt=vt(xt),Pt=gt(Tt),wt=t=>(t*=2)<1?.5*Tt(t):.5*(2-Math.pow(2,-10*(t-1))),St=t=>1-Math.sin(Math.acos(t)),At=vt(St),bt=gt(St),Vt=yt(.42,0,1,1),Et=yt(0,0,.58,1),Mt=yt(.42,0,.58,1),Ct=t=>Array.isArray(t)&&"number"==typeof t[0],Dt={linear:at,easeIn:Vt,easeInOut:Mt,easeOut:Et,circIn:St,circInOut:bt,circOut:At,backIn:Tt,backInOut:Pt,backOut:xt,anticipate:wt},kt=t=>{if(Ct(t)){et(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,n,s]=t;return yt(e,i,n,s)}return"string"==typeof t?(et(void 0!==Dt[t],`Invalid easing type '${t}'`,"invalid-easing-type"),Dt[t]):t},Rt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],Lt={value:null,addProjectionMetrics:null};function jt(t,e){let i=!1,n=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>i=!0,r=Rt.reduce((t,i)=>(t[i]=function(t,e){let i=new Set,n=new Set,s=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function h(e){r.has(e)&&(u.schedule(e),t()),l++,e(a)}const u={schedule:(t,e=!1,o=!1)=>{const a=o&&s?i:n;return e&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),r.delete(t)},process:t=>{a=t,s?o=!0:(s=!0,[i,n]=[n,i],i.forEach(h),e&&Lt.value&&Lt.value.frameloop[e].push(l),l=0,i.clear(),s=!1,o&&(o=!1,u.process(t)))}};return u}(o,e?i:void 0),t),{}),{setup:a,read:l,resolveKeyframes:h,preUpdate:u,update:c,preRender:d,render:p,postRender:m}=r,f=()=>{const o=it.useManualTiming?s.timestamp:performance.now();i=!1,it.useManualTiming||(s.delta=n?1e3/60:Math.max(Math.min(o-s.timestamp,40),1)),s.timestamp=o,s.isProcessing=!0,a.process(s),l.process(s),h.process(s),u.process(s),c.process(s),d.process(s),p.process(s),m.process(s),s.isProcessing=!1,i&&e&&(n=!1,t(f))};return{schedule:Rt.reduce((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(i||(i=!0,n=!0,s.isProcessing||t(f)),a.schedule(e,o,r)),e},{}),cancel:t=>{for(let e=0;e<Rt.length;e++)r[Rt[e]].cancel(t)},state:s,steps:r}}const{schedule:Bt,cancel:Ft,state:It,steps:Ot}=jt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:at,!0);let Ut;function Nt(){Ut=void 0}const $t={now:()=>(void 0===Ut&&$t.set(It.isProcessing||it.useManualTiming?It.timestamp:performance.now()),Ut),set:t=>{Ut=t,queueMicrotask(Nt)}};function Kt(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 Wt(t,e){return i=>i>0?e:t}const zt=(t,e,i)=>{const n=t*t,s=i*(e*e-n)+n;return s<0?0:Math.sqrt(s)},Yt=[n,e,i];function Xt(t){const e=(n=t,Yt.find(t=>t.test(n)));var n;if(tt(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let s=e.parse(t);return e===i&&(s=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=Kt(a,n,t+1/3),o=Kt(a,n,t),r=Kt(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}}(s)),s}const Gt=(i,n)=>{const s=Xt(i),o=Xt(n);if(!s||!o)return Wt(i,n);const r={...s};return i=>(r.red=zt(s.red,o.red,i),r.green=zt(s.green,o.green,i),r.blue=zt(s.blue,o.blue,i),r.alpha=t(s.alpha,o.alpha,i),e.transform(r))},Ht=new Set(["none","hidden"]);function qt(e,i){return n=>t(e,i,n)}function _t(t){return"number"==typeof t?qt:"string"==typeof t?s(t)?Wt:o.test(t)?Gt:Qt:Array.isArray(t)?Zt:"object"==typeof t?o.test(t)?Gt:Jt:Wt}function Zt(t,e){const i=[...t],n=i.length,s=t.map((t,i)=>_t(t)(t,e[i]));return t=>{for(let e=0;e<n;e++)i[e]=s[e](t);return i}}function Jt(t,e){const i={...t,...e},n={};for(const s in i)void 0!==t[s]&&void 0!==e[s]&&(n[s]=_t(t[s])(t[s],e[s]));return t=>{for(const e in n)i[e]=n[e](t);return i}}const Qt=(t,e)=>{const i=r.createTransformer(e),n=a(t),s=a(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?Ht.has(t)&&!s.values.length||Ht.has(e)&&!n.values.length?function(t,e){return Ht.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):ht(Zt(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):(tt(!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"),Wt(t,e))};function te(e,i,n){if("number"==typeof e&&"number"==typeof i&&"number"==typeof n)return t(e,i,n);return _t(e)(e,i)}const ee=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>Bt.update(e,t),stop:()=>Ft(e),now:()=>It.isProcessing?It.timestamp:$t.now()}},ie=(t,e,i=10)=>{let n="";const s=Math.max(Math.round(e/i),2);for(let e=0;e<s;e++)n+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},ne=2e4;function se(t){let e=0;let i=t.next(e);for(;!i.done&&e<ne;)e+=50,i=t.next(e);return e>=ne?1/0:e}function oe(t,e,i){const n=Math.max(e-5,0);return mt(i-t(n),e-n)}const re=100,ae=10,le=1,he=0,ue=800,ce=.3,de=.3,pe={granular:.01,default:2},me={granular:.005,default:.5},fe=.01,ye=10,ge=.05,ve=1,xe=.001;function Te({duration:t=ue,bounce:e=ce,velocity:i=he,mass:n=le}){let s,o;tt(t<=dt(ye),"Spring duration must be 10 seconds or less","spring-duration-limit");let r=1-e;r=l(ge,ve,r),t=l(fe,ye,pt(t)),r<1?(s=e=>{const n=e*r,s=n*t,o=n-i,a=we(e,r),l=Math.exp(-s);return xe-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=we(Math.pow(e,2),r);return(-s(e)+xe>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 a=function(t,e,i){let n=i;for(let i=1;i<Pe;i++)n-=t(n)/e(n);return n}(s,o,5/t);if(t=dt(t),isNaN(a))return{stiffness:re,damping:ae,duration:t};{const e=Math.pow(a,2)*n;return{stiffness:e,damping:2*r*Math.sqrt(n*e),duration:t}}}const Pe=12;function we(t,e){return t*Math.sqrt(1-e*e)}const Se=["duration","bounce"],Ae=["stiffness","damping","mass"];function be(t,e){return e.some(e=>void 0!==t[e])}function Ve(t=de,e=ce){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:h,damping:u,mass:c,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:he,stiffness:re,damping:ae,mass:le,isResolvedFromDuration:!1,...t};if(!be(t,Ae)&&be(t,Se))if(t.visualDuration){const i=t.visualDuration,n=2*Math.PI/(1.2*i),s=n*n,o=2*l(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:le,stiffness:s,damping:o}}else{const i=Te(t);e={...e,...i,mass:le},e.isResolvedFromDuration=!0}return e}({...i,velocity:-pt(i.velocity||0)}),f=p||0,y=u/(2*Math.sqrt(h*c)),g=r-o,v=pt(Math.sqrt(h/c)),x=Math.abs(g)<5;let T;if(n||(n=x?pe.granular:pe.default),s||(s=x?me.granular:me.default),y<1){const t=we(v,y);T=e=>{const i=Math.exp(-y*v*e);return r-i*((f+y*v*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===y)T=t=>r-Math.exp(-v*t)*(g+(f+v*g)*t);else{const t=v*Math.sqrt(y*y-1);T=e=>{const i=Math.exp(-y*v*e),n=Math.min(t*e,300);return r-i*((f+y*v*g)*Math.sinh(n)+t*g*Math.cosh(n))/t}}const P={calculatedDuration:m&&d||null,next:t=>{const e=T(t);if(m)a.done=t>=d;else{let i=0===t?f:0;y<1&&(i=0===t?dt(f):oe(T,t,e));const o=Math.abs(i)<=n,l=Math.abs(r-e)<=s;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(se(P),ne),e=ie(e=>P.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return P}function Ee({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},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=i*e;const f=c+m,y=void 0===r?f:r(f);y!==f&&(m=y-c);const g=t=>-m*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,P;const w=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,P=Ve({keyframes:[d.value,p(d.value)],velocity:oe(v,t,d.value),damping:s,stiffness:o,restDelta:h,restSpeed:u}))};return w(0),{calculatedDuration:null,next:t=>{let e=!1;return P||void 0!==T||(e=!0,x(t),w(t)),void 0!==T&&t>=T?P.next(t-T):(!e&&x(t),d)}}}function Me(t,e,{clamp:i=!0,ease:n,mixer:s}={}){const o=t.length;if(et(o===e.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const r=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,i){const n=[],s=i||it.mix||te,o=t.length-1;for(let i=0;i<o;i++){let o=s(t[i],t[i+1]);if(e){const t=Array.isArray(e)?e[i]||at:e;o=ht(t,o)}n.push(o)}return n}(e,n,s),h=a.length,u=i=>{if(r&&i<t[0])return e[0];let n=0;if(h>1)for(;n<t.length-2&&!(i<t[n+1]);n++);const s=ut(t[n],t[n+1],i);return a[n](s)};return i?e=>u(l(t[0],t[o-1],e)):u}function Ce(e){const i=[0];return function(e,i){const n=e[e.length-1];for(let s=1;s<=i;s++){const o=ut(0,i,s);e.push(t(n,1,o))}}(i,e.length-1),i}function De({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:Ce(e),t),a=Me(r,e,{ease:Array.isArray(s)?s:(l=e,h=s,l.map(()=>h||Mt).splice(0,l.length-1))});var l,h;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}Ve.applyToOptions=t=>{const e=function(t,e=100,i){const n=i({...t,keyframes:[0,e]}),s=Math.min(se(n),ne);return{type:"keyframes",ease:t=>n.next(s*t).value/e,duration:pt(s)}}(t,100,Ve);return t.ease=e.ease,t.duration=dt(e.duration),t.type="keyframes",t};const ke=t=>null!==t;function Re(t,{repeat:e,repeatType:i="loop"},n,s=1){const o=t.filter(ke),r=s<0||e&&"loop"!==i&&e%2==1?0:o.length-1;return r&&void 0!==n?n:o[r]}const Le={decay:Ee,inertia:Ee,tween:De,keyframes:De,spring:Ve};function je(t){"string"==typeof t.type&&(t.type=Le[t.type])}class Be{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 Fe=t=>t/100;class Ie extends Be{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==$t.now()&&this.tick($t.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;je(t);const{type:e=De,repeat:i=0,repeatDelay:n=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||De;a!==De&&"number"!=typeof r[0]&&(this.mixKeyframes=ht(Fe,te(r[0],r[1])),r=[0,100]);const l=a({...t,keyframes:r});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...r].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=se(l));const{calculatedDuration: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:h=0,keyframes:u,repeat:c,repeatType:d,repeatDelay:p,type:m,onUpdate:f,finalKeyframe:y}=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 g=this.currentTime-h*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let x=this.currentTime,T=i;if(c){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,c+1);Boolean(e%2)&&("reverse"===d?(i=1-i,p&&(i-=p/r)):"mirror"===d&&(T=o)),x=l(0,1,i)*r}const P=v?{done:!1,value:u[0]}:T.next(x);s&&(P.value=s(P.value));let{done:w}=P;v||null===a||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&m!==Ee&&(P.value=Re(u,this.options,y,this.speed)),f&&f(P.value),S&&this.finish(),P}then(t,e){return this.finished.then(t,e)}get duration(){return pt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+pt(t)}get time(){return pt(this.currentTime)}set time(t){t=dt(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($t.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=pt(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ee,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($t.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 Oe=t=>180*t/Math.PI,Ue=t=>{const e=Oe(Math.atan2(t[1],t[0]));return $e(e)},Ne={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Ue,rotateZ:Ue,skewX:t=>Oe(Math.atan(t[1])),skewY:t=>Oe(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},$e=t=>((t%=360)<0&&(t+=360),t),Ke=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),We=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),ze={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ke,scaleY:We,scale:t=>(Ke(t)+We(t))/2,rotateX:t=>$e(Oe(Math.atan2(t[6],t[5]))),rotateY:t=>$e(Oe(Math.atan2(-t[2],t[0]))),rotateZ:Ue,rotate:Ue,skewX:t=>Oe(Math.atan(t[4])),skewY:t=>Oe(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ye(t){return t.includes("scale")?1:0}function Xe(t,e){if(!t||"none"===t)return Ye(e);const i=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,s;if(i)n=ze,s=i;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=Ne,s=e}if(!s)return Ye(e);const o=n[e],r=s[1].split(",").map(Ge);return"function"==typeof o?o(r):r[o]}function Ge(t){return parseFloat(t.trim())}const He=t=>t===h||t===u,qe=new Set(["x","y","z"]),_e=c.filter(t=>!qe.has(t));const Ze={width:({x:t},{paddingLeft:e="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),height:({y:t},{paddingTop:e="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),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})=>Xe(e,"x"),y:(t,{transform:e})=>Xe(e,"y")};Ze.translateX=Ze.x,Ze.translateY=Ze.y;const Je=new Set;let Qe=!1,ti=!1,ei=!1;function ii(){if(ti){const t=Array.from(Je).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),i=new Map;e.forEach(t=>{const e=function(t){const e=[];return _e.forEach(i=>{const n=t.getValue(i);void 0!==n&&(e.push([i,n.get()]),n.set(i.startsWith("scale")?1:0))}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=i.get(t);e&&e.forEach(([e,i])=>{t.getValue(e)?.set(i)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}ti=!1,Qe=!1,Je.forEach(t=>t.complete(ei)),Je.clear()}function ni(){Je.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ti=!0)})}class si{constructor(t,e,i,n,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=i,this.motionValue=n,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Je.add(this),Qe||(Qe=!0,Bt.read(ni),Bt.resolveKeyframes(ii))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:i,motionValue:n}=this;if(null===t[0]){const s=n?.get(),o=t[t.length-1];if(void 0!==s)t[0]=s;else if(i&&e){const n=i.readValue(e,o);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=o),n&&void 0===s&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Je.delete(this)}cancel(){"scheduled"===this.state&&(Je.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const oi=rt(()=>void 0!==window.ScrollTimeline),ri={};function ai(t,e){const i=rt(t);return()=>ri[e]??i()}const li=ai(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),hi=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,ui={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:hi([0,.65,.55,1]),circOut:hi([.55,0,1,.45]),backIn:hi([.31,.01,.66,-.59]),backOut:hi([.33,1.53,.69,.99])};function ci(t,e){return t?"function"==typeof t?li()?ie(t,e):"ease-out":Ct(t)?hi(t):Array.isArray(t)?t.map(t=>ci(t,e)||ui.easeOut):ui[t]:void 0}function di(t,e,i,{delay:n=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},h=void 0){const u={[e]:i};l&&(u.offset=l);const c=ci(a,s);Array.isArray(c)&&(u.easing=c);const d={delay:n,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};h&&(d.pseudoElement=h);return t.animate(u,d)}function pi(t){return"function"==typeof t&&"applyToOptions"in t}class mi extends Be{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:e,name:i,keyframes:n,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:r,onComplete:a}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=o,this.options=t,et("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return pi(t)&&li()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=di(e,i,n,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const t=Re(n,this.options,r,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,i){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,i):t.style[e]=i}(e,i,t),this.animation.cancel()}a?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return pt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+pt(t)}get time(){return pt(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=dt(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&&oi()?(this.animation.timeline=t,at):e(this)}}const fi={anticipate:wt,backInOut:Pt,circInOut:bt};function yi(t){"string"==typeof t.ease&&t.ease in fi&&(t.ease=fi[t.ease])}class gi extends mi{constructor(t){yi(t),je(t),super(t),t.startTime&&(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 Ie({...o,autoplay:!1}),a=dt(this.finishedTime??this.time);e.setWithVelocity(r.sample(a-10).value,r.sample(a).value,10),r.stop()}}const vi=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!r.test(t)&&"0"!==t||t.startsWith("url(")));function xi(t){t.duration=0,t.type="keyframes"}const Ti=new Set(["opacity","clipPath","filter","transform"]),Pi=rt(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class wi extends Be{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=$t.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||si;this.keyframeResolver=new d(r,(t,e,i)=>this.onKeyframesResolved(t,e,c,!i),a,l,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,i,n){this.keyframeResolver=void 0;const{name:s,type:o,velocity:r,delay:a,isHandoff:l,onUpdate:h}=i;this.resolvedAt=$t.now(),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=vi(s,e),a=vi(o,e);return tt(r===a,`You are trying to animate ${e} from "${s}" to "${o}". "${r?o:s}" is not an animatable value.`,"value-not-animatable"),!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||pi(i))&&n)}(t,s,o,r)||(!it.instantAnimations&&a||h?.(Re(t,i,e)),t[0]=t[t.length-1],xi(i),i.repeat=0);const u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...i,keyframes:t},c=!l&&function(t){const{motionValue:e,name:i,repeatDelay:n,repeatType:s,damping:o,type:r}=t,a=e?.owner?.current;if(!(a instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:h}=e.owner.getProps();return Pi()&&i&&Ti.has(i)&&("transform"!==i||!h)&&!l&&!n&&"mirror"!==s&&0!==o&&"inertia"!==r}(u)?new gi({...u,element:u.motionValue.owner.current}):new Ie(u);c.finished.then(()=>this.notifyFinished()).catch(at),this.pendingTimeline&&(this.stopTimeline=c.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=c}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),ei=!0,ni(),ii(),ei=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const Si=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ai(t,e,i=1){et(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,o]=function(t){const e=Si.exec(t);if(!e)return[,];const[,i,n,s]=e;return[`--${i??n}`,s]}(t);if(!n)return;const r=window.getComputedStyle(e).getPropertyValue(n);if(r){const t=r.trim();return nt(t)?parseFloat(t):t}return s(o)?Ai(o,e,i+1):o}function bi(t,e){return t?.[e]??t?.default??t}const Vi=new Set(["width","height","top","left","right","bottom",...c]),Ei=t=>e=>e.test(t),Mi=[h,u,d,p,m,f,{test:t=>"auto"===t,parse:t=>t}],Ci=t=>Mi.find(Ei(t));function Di(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||ot(t))}const ki=new Set(["brightness","contrast","saturate","opacity"]);function Ri(t){const[e,i]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=i.match(y)||[];if(!n)return t;const s=i.replace(n,"");let o=ki.has(e)?1:0;return n!==i&&(o*=100),e+"("+o+s+")"}const Li=/\b([a-z-]*)\(.*?\)/gu,ji={...r,getAnimatableNone:t=>{const e=t.match(Li);return e?e.map(Ri).join(" "):t}},Bi={...g,color:o,backgroundColor:o,outlineColor:o,fill:o,stroke:o,borderColor:o,borderTopColor:o,borderRightColor:o,borderBottomColor:o,borderLeftColor:o,filter:ji,WebkitFilter:ji},Fi=t=>Bi[t];function Ii(t,e){let i=Fi(t);return i!==ji&&(i=r),i.getAnimatableNone?i.getAnimatableNone(e):void 0}const Oi=new Set(["auto","none","0"]);class Ui extends si{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(),s(n))){const s=Ai(n,e.current);void 0!==s&&(t[i]=s),i===t.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!Vi.has(i)||2!==t.length)return;const[n,o]=t,r=Ci(n),a=Ci(o);if(r!==a)if(He(r)&&He(a))for(let e=0;e<t.length;e++){const i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else Ze[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)(null===t[e]||Di(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&&!Oi.has(e)&&a(e).values.length&&(n=t[s]),s++}if(n&&i)for(const s of e)t[s]=Ii(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=Ze[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]=Ze[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()}}class Ni{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=$t.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=$t.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 ct);const i=this.events[t].add(e);return"change"===t?()=>{i(),Bt.read(()=>{this.events.change.getSize()||this.stop()})}:i}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,i){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=$t.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return mt(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 $i(t,e){return new Ni(t,e)}const{schedule:Ki,cancel:Wi}=jt(queueMicrotask,!1),zi={x:!1,y:!1};function Yi(){return zi.x||zi.y}function Xi(t,e){const i=function(t){if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t)}(t),n=new AbortController;return[i,{passive:!0,...e,signal:n.signal},()=>n.abort()]}function Gi(t){return!("touch"===t.pointerType||Yi())}const Hi=(t,e)=>!!e&&(t===e||Hi(t,e.parentElement)),qi=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,_i=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Zi=new WeakSet;function Ji(t){return e=>{"Enter"===e.key&&t(e)}}function Qi(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function tn(t){return qi(t)&&!Yi()}function en(t,e,i={}){const[n,s,o]=Xi(t,i),r=t=>{const n=t.currentTarget;if(!tn(t))return;Zi.add(n);const o=e(n,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Zi.has(n)&&Zi.delete(n),tn(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,n===window||n===document||i.useGlobalTarget||Hi(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),st(e=t)&&"offsetHeight"in e&&(t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const n=Ji(()=>{if(Zi.has(i))return;Qi(i,"down");const t=Ji(()=>{Qi(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>Qi(i,"cancel"),e)});i.addEventListener("keydown",n,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",n),e)})(t,s)),function(t){return _i.has(t.tagName)||-1!==t.tabIndex}(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}function nn(t){return st(t)&&"ownerSVGElement"in t}const sn=[...Mi,o,r];class on{constructor(t){this.isMounted=!1,this.node=t}update(){}}const rn=t=>null!==t;const an={type:"spring",stiffness:500,damping:25,restSpeed:10},ln={type:"keyframes",duration:.8},hn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},un=(t,{keyframes:e})=>e.length>2?ln:v.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:an:hn;const cn=(t,e,i,n={},s,o)=>r=>{const a=bi(n,t)||{},l=a.delay||n.delay||0;let{elapsed:h=0}=n;h-=dt(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({when:t,delay:e,delayChildren:i,staggerChildren:n,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length})(a)||Object.assign(u,un(t,u)),u.duration&&(u.duration=dt(u.duration)),u.repeatDelay&&(u.repeatDelay=dt(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let c=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(xi(u),0===u.delay&&(c=!0)),(it.instantAnimations||it.skipAnimations)&&(c=!0,xi(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,c&&!o&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:i="loop"},n){const s=t.filter(rn),o=e&&"loop"!==i&&e%2==1?0:s.length-1;return o&&void 0!==n?n:s[o]}(u.keyframes,a);if(void 0!==t)return void Bt.update(()=>{u.onUpdate(t),u.onComplete()})}return a.isSync?new Ie(u):new wi(u)};function dn(t,e,i,n={passive:!0}){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i)}function pn(t){return{point:{x:t.pageX,y:t.pageY}}}function mn(t,e,i,n){return dn(t,e,(t=>e=>qi(e)&&t(e,pn(e)))(i),n)}function fn({top:t,left:e,right:i,bottom:n}){return{x:{min:e,max:i},y:{min:t,max:n}}}function yn(t){return t.max-t.min}function gn(e,i,n,s=.5){e.origin=s,e.originPoint=t(i.min,i.max,e.origin),e.scale=yn(n)/yn(i),e.translate=t(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function vn(t,e,i,n){gn(t.x,e.x,i.x,n?n.originX:void 0),gn(t.y,e.y,i.y,n?n.originY:void 0)}function xn(t,e,i){t.min=i.min+e.min,t.max=t.min+yn(e)}function Tn(t,e,i){t.min=e.min-i.min,t.max=t.min+yn(e)}function Pn(t,e,i){Tn(t.x,e.x,i.x),Tn(t.y,e.y,i.y)}const wn=()=>({x:{min:0,max:0},y:{min:0,max:0}});function Sn(t){return[t("x"),t("y")]}function An(t){return void 0===t||1===t}function bn({scale:t,scaleX:e,scaleY:i}){return!An(t)||!An(e)||!An(i)}function Vn(t){return bn(t)||En(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function En(t){return Mn(t.x)||Mn(t.y)}function Mn(t){return t&&"0%"!==t}function Cn(t,e,i){return i+e*(t-i)}function Dn(t,e,i,n,s){return void 0!==s&&(t=Cn(t,s,n)),Cn(t,i,n)+e}function kn(t,e=0,i=1,n,s){t.min=Dn(t.min,e,i,n,s),t.max=Dn(t.max,e,i,n,s)}function Rn(t,{x:e,y:i}){kn(t.x,e.translate,e.scale,e.originPoint),kn(t.y,i.translate,i.scale,i.originPoint)}const Ln=.999999999999,jn=1.0000000000001;function Bn(t,e){t.min=t.min+e,t.max=t.max+e}function Fn(e,i,n,s,o=.5){kn(e,i,n,t(e.min,e.max,o),s)}function In(t,e){Fn(t.x,e.x,e.scaleX,e.scale,e.originX),Fn(t.y,e.y,e.scaleY,e.scale,e.originY)}function On(t,e){return fn(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))}const Un=({current:t})=>t?t.ownerDocument.defaultView:null;function Nn(t,e){const i=t.getValue("willChange");if(n=i,Boolean(x(n)&&n.add))return i.add(e);if(!i&&it.WillChange){const i=new it.WillChange("auto");t.addValue("willChange",i),i.add(e)}var n}const $n=(t,e)=>Math.abs(t-e);class Kn{constructor(t,e,{transformPagePoint:i,contextWindow:n=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=Yn(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,i=function(t,e){const i=$n(t.x,e.x),n=$n(t.y,e.y);return Math.sqrt(i**2+n**2)}(t.offset,{x:0,y:0})>=this.distanceThreshold;if(!e&&!i)return;const{point:n}=t,{timestamp:s}=It;this.history.push({...n,timestamp:s});const{onStart:o,onMove:r}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),r&&r(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=Wn(e,this.transformPagePoint),Bt.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:i,onSessionEnd:n,resumeAnimation:s}=this.handlers;if(this.dragSnapToOrigin&&s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Yn("pointercancel"===t.type?this.lastMoveEventInfo:Wn(e,this.transformPagePoint),this.history);this.startEvent&&i&&i(t,o),n&&n(t,o)},!qi(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=n||window;const r=Wn(pn(t),this.transformPagePoint),{point:a}=r,{timestamp:l}=It;this.history=[{...a,timestamp:l}];const{onSessionStart:h}=e;h&&h(t,Yn(r,this.history)),this.removeListeners=ht(mn(this.contextWindow,"pointermove",this.handlePointerMove),mn(this.contextWindow,"pointerup",this.handlePointerUp),mn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ft(this.updatePoint)}}function Wn(t,e){return e?{point:e(t.point)}:t}function zn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Yn({point:t},e){return{point:t,delta:zn(t,Gn(e)),offset:zn(t,Xn(e)),velocity:Hn(e,.1)}}function Xn(t){return t[0]}function Gn(t){return t[t.length-1]}function Hn(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,n=null;const s=Gn(t);for(;i>=0&&(n=t[i],!(s.timestamp-n.timestamp>dt(e)));)i--;if(!n)return{x:0,y:0};const o=pt(s.timestamp-n.timestamp);if(0===o)return{x:0,y:0};const r={x:(s.x-n.x)/o,y:(s.y-n.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function qn(t,e,i){return{min:void 0!==e?t.min+e:void 0,max:void 0!==i?t.max+i-(t.max-t.min):void 0}}function _n(t,e){let i=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([i,n]=[n,i]),{min:i,max:n}}const Zn=.35;function Jn(t,e,i){return{min:Qn(t,e),max:Qn(t,i)}}function Qn(t,e){return"number"==typeof t?t:t[e]||0}const ts=new WeakMap;class es{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:e=!1,distanceThreshold:i}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:s}=this.getProps();this.panSession=new Kn(t,{onSessionStart:t=>{const{dragSnapToOrigin:i}=this.getProps();i?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(pn(t).point)},onStart:(t,e)=>{const{drag:i,dragPropagation:n,onDragStart:s}=this.getProps();if(i&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=i)||"y"===o?zi[o]?null:(zi[o]=!0,()=>{zi[o]=!1}):zi.x||zi.y?null:(zi.x=zi.y=!0,()=>{zi.x=zi.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=t,this.latestPanInfo=e,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Sn(t=>{let e=this.getAxisMotionValue(t).get()||0;if(d.test(e)){const{projection:i}=this.visualElement;if(i&&i.layout){const n=i.layout.layoutBox[t];if(n){e=yn(n)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),s&&Bt.postRender(()=>s(t,e)),Nn(this.visualElement,"transform");const{animationState:r}=this.visualElement;r&&r.setActive("whileDrag",!0)},onMove:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e;const{dragPropagation:i,dragDirectionLock:n,onDirectionLock:s,onDrag:o}=this.getProps();if(!i&&!this.openDragLock)return;const{offset:r}=e;if(n&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let i=null;Math.abs(t.y)>e?i="y":Math.abs(t.x)>e&&(i="x");return i}(r),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",e.point,r),this.updateAxis("y",e.point,r),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e,this.stop(t,e),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>Sn(t=>"paused"===this.getAnimationState(t)&&this.getAxisMotionValue(t).animation?.play())},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,distanceThreshold:i,contextWindow:Un(this.visualElement)})}stop(t,e){const i=t||this.latestPointerEvent,n=e||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!n||!i)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:r}=this.getProps();r&&Bt.postRender(()=>r(i,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(e,i,n){const{drag:s}=this.getProps();if(!n||!is(e,s,this.currentDirection))return;const o=this.getAxisMotionValue(e);let r=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:i,max:n},s){return void 0!==i&&e<i?e=s?t(i,e,s.min):Math.max(e,i):void 0!==n&&e>n&&(e=s?t(n,e,s.max):Math.min(e,n)),e}(r,this.constraints[e],this.elastic[e])),o.set(r)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;t&&T(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i)&&function(t,{top:e,left:i,bottom:n,right:s}){return{x:qn(t.x,i,s),y:qn(t.y,e,n)}}(i.layoutBox,t),this.elastic=function(t=Zn){return!1===t?t=0:!0===t&&(t=Zn),{x:Jn(t,"left","right"),y:Jn(t,"top","bottom")}}(e),n!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Sn(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const i={};return void 0!==e.min&&(i.min=e.min-t.min),void 0!==e.max&&(i.max=e.max-t.min),i}(i.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!T(t))return!1;const i=t.current;et(null!==i,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:n}=this.visualElement;if(!n||!n.layout)return!1;const s=function(t,e,i){const n=On(t,i),{scroll:s}=e;return s&&(Bn(n.x,s.offset.x),Bn(n.y,s.offset.y)),n}(i,n.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:_n(t.x,e.x),y:_n(t.y,e.y)}}(n.layout.layoutBox,s);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=fn(t))}return o}startAnimation(t){const{drag:e,dragMomentum:i,dragElastic:n,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=Sn(r=>{if(!is(r,e,this.currentDirection))return;let l=a&&a[r]||{};o&&(l={min:0,max:0});const h=n?200:1e6,u=n?40:1e7,c={type:"inertia",velocity:i?t[r]:0,bounceStiffness:h,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(r,c)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const i=this.getAxisMotionValue(t);return Nn(this.visualElement,t),i.start(cn(t,i,0,e,this.visualElement,!1))}stopAnimation(){Sn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Sn(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),n=i[e];return n||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(e){Sn(i=>{const{drag:n}=this.getProps();if(!is(i,n,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(i);if(s&&s.layout){const{min:n,max:r}=s.layout.layoutBox[i],a=o.get()||0;o.set(e[i]-t(n,r,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:i}=this.getProps(),{projection:n}=this.visualElement;if(!T(i)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Sn(t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const i=e.get();s[t]=function(t,e){let i=.5;const n=yn(t),s=yn(e);return s>n?i=ut(e.min,e.max-n,t.min):n>s&&(i=ut(t.min,t.max-s,e.min)),l(0,1,i)}({min:i,max:i},this.constraints[t])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Sn(i=>{if(!is(i,e,null))return;const n=this.getAxisMotionValue(i),{min:o,max:r}=this.constraints[i];n.set(t(o,r,s[i]))})}addListeners(){if(!this.visualElement.current)return;ts.set(this.visualElement,this);const t=mn(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:i=!0}=this.getProps();e&&i&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();T(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,n=i.addEventListener("measure",e);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Bt.read(e);const s=dn(window,"resize",()=>this.scalePositionWithinConstraints()),o=i.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(Sn(e=>{const i=this.getAxisMotionValue(e);i&&(this.originPoint[e]+=t[e].translate,i.set(i.get()+t[e].translate))}),this.visualElement.render())});return()=>{s(),t(),n(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:i=!1,dragPropagation:n=!1,dragConstraints:s=!1,dragElastic:o=Zn,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:i,dragPropagation:n,dragConstraints:s,dragElastic:o,dragMomentum:r}}}function is(t,e,i){return!(!0!==e&&e!==t||null!==i&&i!==t)}const ns=t=>(e,i)=>{t&&Bt.postRender(()=>t(e,i))};function ss(t){return t.props[P]}const os=(t,e)=>t.depth-e.depth;class rs{constructor(){this.children=[],this.isDirty=!1}add(t){Z(this.children,t),this.isDirty=!0}remove(t){J(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(os),this.isDirty=!1,this.children.forEach(t)}}const as=["TopLeft","TopRight","BottomLeft","BottomRight"],ls=as.length,hs=t=>"string"==typeof t?parseFloat(t):t,us=t=>"number"==typeof t||u.test(t);function cs(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const ds=ms(0,.5,At),ps=ms(.5,.95,at);function ms(t,e,i){return n=>n<t?0:n>e?1:i(ut(t,e,n))}function fs(t,e){t.min=e.min,t.max=e.max}function ys(t,e){fs(t.x,e.x),fs(t.y,e.y)}function gs(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function vs(t,e,i,n,s){return t=Cn(t-=e,1/i,n),void 0!==s&&(t=Cn(t,1/s,n)),t}function xs(e,i,[n,s,o],r,a){!function(e,i=0,n=1,s=.5,o,r=e,a=e){d.test(i)&&(i=parseFloat(i),i=t(a.min,a.max,i/100)-a.min);if("number"!=typeof i)return;let l=t(r.min,r.max,s);e===r&&(l-=i),e.min=vs(e.min,i,n,l,o),e.max=vs(e.max,i,n,l,o)}(e,i[n],i[s],i[o],i.scale,r,a)}const Ts=["x","scaleX","originX"],Ps=["y","scaleY","originY"];function ws(t,e,i,n){xs(t.x,e,Ts,i?i.x:void 0,n?n.x:void 0),xs(t.y,e,Ps,i?i.y:void 0,n?n.y:void 0)}function Ss(t){return 0===t.translate&&1===t.scale}function As(t){return Ss(t.x)&&Ss(t.y)}function bs(t,e){return t.min===e.min&&t.max===e.max}function Vs(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Es(t,e){return Vs(t.x,e.x)&&Vs(t.y,e.y)}function Ms(t){return yn(t.x)/yn(t.y)}function Cs(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Ds{constructor(){this.members=[]}add(t){Z(this.members,t),t.scheduleRender()}remove(t){if(J(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){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let i;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){i=e;break}}return!!i&&(this.promote(i),!0)}promote(t,e){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,e&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:n}=t.options;!1===n&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:i}=t;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const ks={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Rs=["","X","Y","Z"];let Ls=0;function js(t,e,i,n){const{latestValues:s}=e;s[t]&&(i[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function Bs(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const i=ss(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",Bt,!(e||n))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&Bs(n)}function Fs({attachResizeListener:e,defaultParent:i,measureScroll:n,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(t={},e=i?.()){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(Us),this.nodes.forEach(Xs),this.nodes.forEach(Gs),this.nodes.forEach(Ns)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new rs)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new ct),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(t){if(this.instance)return;var i;this.isSVG=nn(t)&&!(nn(i=t)&&"svg"===i.tagName),this.instance=t;const{layoutId:n,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||n)&&(this.isLayoutDirty=!0),e){let i,n=0;const s=()=>this.root.updateBlockedByResize=!1;Bt.read(()=>{n=window.innerWidth}),e(t,()=>{const t=window.innerWidth;t!==n&&(n=t,this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=$t.now(),n=({timestamp:s})=>{const o=s-i;o>=e&&(Ft(n),t(o-e))};return Bt.setup(n,!0),()=>Ft(n)}(s,250),ks.hasAnimatedSinceResize&&(ks.hasAnimatedSinceResize=!1,this.nodes.forEach(Ys)))})}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()||Qs,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!Es(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={...bi(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||Ys(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(),Ft(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(Hs),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&&Bs(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,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())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Ks);if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(Ws);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(zs),this.nodes.forEach(Is),this.nodes.forEach(Os)):this.nodes.forEach(Ws),this.clearAllSnapshots();const t=$t.now();It.delta=l(0,1e3/60,t-It.timestamp),It.timestamp=t,It.isProcessing=!0,Ot.update.process(It),Ot.preRender.process(It),Ot.render.process(It),It.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ki.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($s),this.sharedNodes.forEach(qs)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Bt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Bt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||yn(this.snapshot.measuredBox.x)||yn(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={x:{min:0,max:0},y:{min:0,max:0}},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:n(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&&!As(this.projectionDelta),i=this.getTransformTemplate(),n=i?i(this.latestValues,""):void 0,s=n!==this.prevTransformTemplateValue;t&&this.instance&&(e||Vn(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)),io((n=i).x),io(n.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(so))){const{scroll:t}=this.root;t&&(Bn(e.x,t.offset.x),Bn(e.y,t.offset.y))}return e}removeElementScroll(t){const e={x:{min:0,max:0},y:{min:0,max:0}};if(ys(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&&ys(e,t),Bn(e.x,s.offset.x),Bn(e.y,s.offset.y))}return e}applyTransform(t,e=!1){const i={x:{min:0,max:0},y:{min:0,max:0}};ys(i,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];!e&&n.options.layoutScroll&&n.scroll&&n!==n.root&&In(i,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),Vn(n.latestValues)&&In(i,n.latestValues)}return Vn(this.latestValues)&&In(i,this.latestValues),i}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};ys(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!i.instance)continue;if(!Vn(i.latestValues))continue;bn(i.latestValues)&&i.updateSnapshot();const n=wn();ys(n,i.measurePageBox()),ws(e,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,n)}return Vn(this.latestValues)&&ws(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!==It.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=It.timestamp;const o=this.getClosestProjectingParent();var r,a,l;(o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),r=this.target,a=this.relativeTarget,l=this.relativeParent.target,xn(r.x,a.x,l.x),xn(r.y,a.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):ys(this.target,this.layout.layoutBox),Rn(this.target,this.targetDelta)):ys(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,o&&Boolean(o.resumingFrom)===Boolean(this.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!bn(this.parent.latestValues)&&!En(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},Pn(this.relativeTargetOrigin,e,i),ys(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===It.timestamp&&(i=!1),i)return;const{layout:n,layoutId:s}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!s)return;ys(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,r=this.treeScale.y;!function(t,e,i,n=!1){const s=i.length;if(!s)return;let o,r;e.x=e.y=1;for(let a=0;a<s;a++){o=i[a],r=o.projectionDelta;const{visualElement:s}=o.options;s&&s.props.style&&"contents"===s.props.style.display||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&In(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,Rn(t,r)),n&&Vn(o.latestValues)&&In(t,o.latestValues))}e.x<jn&&e.x>Ln&&(e.x=1),e.y<jn&&e.y>Ln&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:a}=t;a?(this.projectionDelta&&this.prevProjectionDelta?(gs(this.prevProjectionDelta.x,this.projectionDelta.x),gs(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),vn(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.treeScale.x===o&&this.treeScale.y===r&&Cs(this.projectionDelta.x,this.prevProjectionDelta.x)&&Cs(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,i=!1){const n=this.snapshot,s=n?n.latestValues:{},o={...this.latestValues},r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!i;const a={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),h=this.getStack(),u=!h||h.members.length<=1,c=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(Js));let p;this.animationProgress=0,this.mixTargetDelta=i=>{const n=i/1e3;var h,m,f,y,g,v;_s(r.x,e.x,n),_s(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pn(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),f=this.relativeTarget,y=this.relativeTargetOrigin,g=a,v=n,Zs(f.x,y.x,g.x,v),Zs(f.y,y.y,g.y,v),p&&(h=this.relativeTarget,m=p,bs(h.x,m.x)&&bs(h.y,m.y))&&(this.isProjectionDirty=!1),p||(p={x:{min:0,max:0},y:{min:0,max:0}}),ys(p,this.relativeTarget)),l&&(this.animationValues=o,function(e,i,n,s,o,r){o?(e.opacity=t(0,n.opacity??1,ds(s)),e.opacityExit=t(i.opacity??1,0,ps(s))):r&&(e.opacity=t(i.opacity??1,n.opacity??1,s));for(let o=0;o<ls;o++){const r=`border${as[o]}Radius`;let a=cs(i,r),l=cs(n,r);void 0===a&&void 0===l||(a||(a=0),l||(l=0),0===a||0===l||us(a)===us(l)?(e[r]=Math.max(t(hs(a),hs(l),s),0),(d.test(l)||d.test(a))&&(e[r]+="%")):e[r]=l)}(i.rotate||n.rotate)&&(e.rotate=t(i.rotate||0,n.rotate||0,s))}(o,s,this.latestValues,n,c,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Ft(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Bt.update(()=>{ks.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=$i(0)),this.currentAnimation=function(t,e,i){const n=x(t)?t:$i(t);return n.start(cn("",n,e,i)),n.animation}(this.motionValue,[0,1e3],{...t,velocity:0,isSync:!0,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onStop:()=>{},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:n,latestValues:s}=t;if(e&&i&&n){if(this!==t&&this.layout&&n&&no(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=yn(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const n=yn(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+n}ys(e,i),In(e,s),vn(this.projectionDeltaWithTransform,this.layoutCorrected,e,s)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Ds);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:i}={}){const n=this.getStack();n&&n.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const n={};i.z&&js("z",t,n,this.animationValues);for(let e=0;e<Rs.length;e++)js(`rotate${Rs[e]}`,t,n,this.animationValues),js(`skew${Rs[e]}`,t,n,this.animationValues);t.render();for(const e in n)t.setStaticValue(e,n[e]),this.animationValues&&(this.animationValues[e]=n[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=w(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=w(e?.pointerEvents)||""),void(this.hasProjected&&!Vn(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const s=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(t,e,i){let n="";const s=t.x.translate/e.x,o=t.y.translate/e.y,r=i?.z||0;if((s||o||r)&&(n=`translate3d(${s}px, ${o}px, ${r}px) `),1===e.x&&1===e.y||(n+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:t,rotate:e,rotateX:s,rotateY:o,skewX:r,skewY:a}=i;t&&(n=`perspective(${t}px) ${n}`),e&&(n+=`rotate(${e}deg) `),s&&(n+=`rotateX(${s}deg) `),o&&(n+=`rotateY(${o}deg) `),r&&(n+=`skewX(${r}deg) `),a&&(n+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return 1===a&&1===l||(n+=`scale(${a}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,s);i&&(o=i(s,o)),t.transform=o;const{x:r,y:a}=this.projectionDelta;t.transformOrigin=`${100*r.origin}% ${100*a.origin}% 0`,n.animationValues?t.opacity=n===this?s.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:t.opacity=n===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const e in S){if(void 0===s[e])continue;const{correct:i,applyTo:r,isCSSVariable:a}=S[e],l="none"===o?s[e]:i(s[e],n);if(r){const e=r.length;for(let i=0;i<e;i++)t[r[i]]=l}else a?this.options.visualElement.renderState.vars[e]=l:t[e]=l}this.options.layoutId&&(t.pointerEvents=n===this?w(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(t=>t.currentAnimation?.stop()),this.root.nodes.forEach(Ks),this.root.sharedNodes.clear()}}}function Is(t){t.updateLayout()}function Os(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:n}=t.layout,{animationType:s}=t.options,o=e.source!==t.layout.source;"size"===s?Sn(t=>{const n=o?e.measuredBox[t]:e.layoutBox[t],s=yn(n);n.min=i[t].min,n.max=n.min+s}):no(s,e.layoutBox,i)&&Sn(n=>{const s=o?e.measuredBox[n]:e.layoutBox[n],r=yn(i[n]);s.max=s.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[n].max=t.relativeTarget[n].min+r)});const r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};vn(r,i,e.layoutBox);const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?vn(a,t.applyTransform(n,!0),e.measuredBox):vn(a,i,e.layoutBox);const l=!As(r);let h=!1;if(!t.resumeFrom){const n=t.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:s,layout:o}=n;if(s&&o){const r={x:{min:0,max:0},y:{min:0,max:0}};Pn(r,e.layoutBox,s.layoutBox);const a={x:{min:0,max:0},y:{min:0,max:0}};Pn(a,i,o.layoutBox),Es(r,a)||(h=!0),n.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=n)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Us(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Ns(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function $s(t){t.clearSnapshot()}function Ks(t){t.clearMeasurements()}function Ws(t){t.isLayoutDirty=!1}function zs(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Ys(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Xs(t){t.resolveTargetDelta()}function Gs(t){t.calcProjection()}function Hs(t){t.resetSkewAndRotation()}function qs(t){t.removeLeadSnapshot()}function _s(e,i,n){e.translate=t(i.translate,0,n),e.scale=t(i.scale,1,n),e.origin=i.origin,e.originPoint=i.originPoint}function Zs(e,i,n,s){e.min=t(i.min,n.min,s),e.max=t(i.max,n.max,s)}function Js(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const Qs={duration:.45,ease:[.4,0,.1,1]},to=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),eo=to("applewebkit/")&&!to("chrome/")?Math.round:at;function io(t){t.min=eo(t.min),t.max=eo(t.max)}function no(t,e,i){return"position"===t||"preserve-aspect"===t&&(n=Ms(e),s=Ms(i),o=.2,!(Math.abs(n-s)<=o));var n,s,o}function so(t){return t!==t.root&&t.scroll?.wasRoot}const oo=Fs({attachResizeListener:(t,e)=>dn(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ro={current:void 0},ao=Fs({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ro.current){const t=new oo({});t.mount(window),t.setOptions({layoutScroll:!0}),ro.current=t}return ro.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),lo={current:null},ho={current:!1};const uo=new WeakMap;const co=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class po{scrapeMotionValuesFromProps(t,e,i){return{}}constructor({parent:t,props:e,presenceContext:i,reducedMotionConfig:n,blockInitialAnimation:s,visualState:o},r={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=si,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=$t.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Bt.render(this.render,!1,!0))};const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=e,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.options=r,this.blockInitialAnimation=Boolean(s),this.isControllingVariants=b(e),this.isVariantNode=V(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:h,...u}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in u){const e=u[t];void 0!==a[t]&&x(e)&&e.set(a[t])}}mount(t){this.current=t,uo.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(ho.current||function(){if(ho.current=!0,A)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>lo.current=t.matches;t.addEventListener("change",e),e()}else lo.current=!1}(),this.shouldReduceMotion=lo.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Ft(this.notifyUpdate),Ft(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=v.has(t);i&&this.onBindTransform&&this.onBindTransform();const n=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&Bt.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{n(),s&&s(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in E){const e=E[t];if(!e)continue;const{isEnabled:i,Feature:n}=e;if(!this.features[t]&&n&&i(this.props)&&(this.features[t]=new n(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<co.length;e++){const i=co[e];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const n=t["on"+i];n&&(this.propEventSubscriptions[i]=this.on(i,n))}this.prevMotionValues=function(t,e,i){for(const n in e){const s=e[n],o=i[n];if(x(s))t.addValue(n,s);else if(x(o))t.addValue(n,$i(s,{owner:t}));else if(o!==s)if(t.hasValue(n)){const e=t.getValue(n);!0===e.liveStyle?e.jump(s):e.hasAnimated||e.set(s)}else{const e=t.getStaticValue(n);t.addValue(n,$i(void 0!==e?e:s,{owner:t}))}}for(const n in i)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const i=this.values.get(t);e!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return void 0===i&&void 0!==e&&(i=$i(null===e?void 0:e,{owner:this}),this.addValue(t,i)),i}readValue(t,e){let i=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=i&&("string"==typeof i&&(nt(i)||ot(i))?i=parseFloat(i):(n=i,!sn.find(Ei(n))&&r.test(e)&&(i=Ii(t,e))),this.setBaseTarget(t,x(i)?i.get():i)),x(i)?i.get():i}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let i;if("string"==typeof e||"object"==typeof e){const n=M(this.props,e,this.presenceContext?.custom);n&&(i=n[t])}if(e&&void 0!==i)return i;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||x(n)?void 0!==this.initialValues[t]&&void 0===i?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new ct),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){Ki.render(this.render)}}class mo extends po{constructor(){super(...arguments),this.KeyframeResolver=Ui}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[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;x(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function fo(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 yo extends mo{constructor(){super(...arguments),this.type="html",this.renderInstance=fo}readValueFromInstance(t,e){if(v.has(e))return this.projection?.isProjecting?Ye(e):((t,e)=>{const{transform:i="none"}=getComputedStyle(t);return Xe(i,e)})(t,e);{const n=(i=t,window.getComputedStyle(i)),s=(C(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof s?s.trim():s}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return On(t,e)}build(t,e,i){D(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return k(t,e,i)}}let go=!1;class vo extends q{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i,layoutId:n}=this.props,{projection:s}=t;s&&(e.group&&e.group.add(s),i&&i.register&&n&&i.register(s),go&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),ks.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:i,drag:n,isPresent:s}=this.props,{projection:o}=i;return o?(o.isPresent=s,go=!0,n||t.layoutDependency!==e||void 0===e||t.isPresent!==s?o.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?o.promote():o.relegate()||Bt.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Ki.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:n}=t;go=!0,n&&(n.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(n),i&&i.deregister&&i.deregister(n))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function xo(t){const[e,i]=function(t=!0){const e=Y(R);if(null===e)return[!0,null];const{isPresent:i,onExitComplete:n,register:s}=e,o=X();G(()=>{if(t)return s(o)},[t]);const r=H(()=>t&&n&&n(o),[o,n,t]);return!i&&n?[!1,r]:[!0]}(),n=Y(L);return z(vo,{...t,layoutGroup:n,switchLayoutGroup:Y(j),isPresent:e,safeToRemove:i})}const To={pan:{Feature:class extends on{constructor(){super(...arguments),this.removePointerDownListener=at}onPointerDown(t){this.session=new Kn(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Un(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:i,onPanEnd:n}=this.node.getProps();return{onSessionStart:ns(t),onStart:ns(e),onMove:i,onEnd:(t,e)=>{delete this.session,n&&Bt.postRender(()=>n(t,e))}}}mount(){this.removePointerDownListener=mn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends on{constructor(t){super(t),this.removeGroupControls=at,this.removeListeners=at,this.controls=new es(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||at}update(){const{dragControls:t}=this.node.getProps(),{dragControls:e}=this.node.prevProps||{};t!==e&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:ao,MeasureLayout:xo}},Po={layout:{ProjectionNode:ao,MeasureLayout:xo}};function wo(t,e,i){const n=t.getProps();return M(n,e,void 0!==i?i:n.custom,t)}const So=t=>Array.isArray(t);function Ao(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,$i(i))}function bo(t){return So(t)?t[t.length-1]||0:t}function Vo({protectedKeys:t,needsAnimating:e},i){const n=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,n}function Eo(t,e,{delay:i=0,transitionOverride:n,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;n&&(o=n);const l=[],h=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||h&&Vo(h,e))continue;const r={delay:i,...bi(o||{},e)},u=n.get();if(void 0!==u&&!n.isAnimating&&!Array.isArray(s)&&s===u&&!r.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){const i=ss(t);if(i){const t=window.MotionHandoffAnimation(i,e,Bt);null!==t&&(r.startTime=t,c=!0)}}Nn(t,e),n.start(cn(e,n,s,t.shouldReduceMotion&&Vi.has(e)?{type:!1}:r,t,c));const d=n.animation;d&&l.push(d)}return r&&Promise.all(l).then(()=>{Bt.update(()=>{r&&function(t,e){const i=wo(t,e);let{transitionEnd:n={},transition:s={},...o}=i||{};o={...o,...n};for(const e in o)Ao(t,e,bo(o[e]))}(t,r)})}),l}function Mo(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}function Co(t,e,i={}){const n=wo(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(Eo(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(Co(l,e,{...r,delay:i+("function"==typeof n?0:n)+Mo(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 Do(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 ko=F.length;function Ro(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Ro(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let i=0;i<ko;i++){const n=F[i],s=t.props[n];(B(s)||!1===s)&&(e[n]=s)}return e}const Lo=[...O].reverse(),jo=O.length;function Bo(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=>Co(t,e,i));n=Promise.all(s)}else if("string"==typeof e)n=Co(t,e,i);else{const s="function"==typeof e?wo(t,e,i.custom):e;n=Promise.all(Eo(t,s,i))}return n.then(()=>{t.notify("AnimationComplete",e)})}(t,e,i)))}function Fo(t){let e=Bo(t),i=Uo(),n=!0;const s=e=>(i,n)=>{const s=wo(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 o(o){const{props:r}=t,a=Ro(t.parent)||{},l=[],h=new Set;let u={},c=1/0;for(let e=0;e<jo;e++){const d=Lo[e],p=i[d],m=void 0!==r[d]?r[d]:a[d],f=B(m),y=d===o?p.isActive:null;!1===y&&(c=e);let g=m===a[d]&&m!==r[d]&&f;if(g&&n&&t.manuallyAnimateOnMount&&(g=!1),p.protectedKeys={...u},!p.isActive&&null===y||!m&&!p.prevProp||I(m)||"boolean"==typeof m)continue;const v=Io(p.prevProp,m);let x=v||d===o&&p.isActive&&!g&&f||e>c&&f,T=!1;const P=Array.isArray(m)?m:[m];let w=P.reduce(s(d),{});!1===y&&(w={});const{prevResolvedValues:S={}}=p,A={...S,...w},b=e=>{x=!0,h.has(e)&&(T=!0,h.delete(e)),p.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in A){const e=w[t],i=S[t];if(u.hasOwnProperty(t))continue;let n=!1;n=So(e)&&So(i)?!Do(e,i):e!==i,n?null!=e?b(t):h.add(t):void 0!==e&&h.has(t)?b(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=w,p.isActive&&(u={...u,...w}),n&&t.blockInitialAnimation&&(x=!1);const V=g&&v;x&&(!V||T)&&l.push(...P.map(e=>{const i={type:d};if("string"==typeof e&&n&&!V&&t.manuallyAnimateOnMount&&t.parent){const{parent:n}=t,s=wo(n,e);if(n.enteringChildren&&s){const{delayChildren:e}=s.transition||{};i.delay=Mo(n.enteringChildren,t,e)}}return{animation:e,options:i}}))}if(h.size){const e={};if("boolean"!=typeof r.initial){const i=wo(t,Array.isArray(r.initial)?r.initial[0]:r.initial);i&&i.transition&&(e.transition=i.transition)}h.forEach(i=>{const n=t.getBaseTarget(i),s=t.getValue(i);s&&(s.liveStyle=!0),e[i]=n??null}),l.push({animation:e})}let d=Boolean(l.length);return!n||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),n=!1,d?e(l):Promise.resolve()}return{animateChanges:o,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=o(e);for(const t in i)i[t].protectedKeys={};return s},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=Uo()}}}function Io(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Do(e,t)}function Oo(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Uo(){return{animate:Oo(!0),whileInView:Oo(),whileHover:Oo(),whileTap:Oo(),whileDrag:Oo(),whileFocus:Oo(),exit:Oo()}}let No=0;const $o={animation:{Feature:class extends on{constructor(t){super(t),t.animationState||(t.animationState=Fo(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();I(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends on{constructor(){super(...arguments),this.id=No++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const n=this.node.animationState.setActive("exit",!t);e&&!t&&n.then(()=>{e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function Ko(t,e,i){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover","Start"===i);const s=n["onHover"+i];s&&Bt.postRender(()=>s(e,pn(e)))}function Wo(t,e,i){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap","Start"===i);const s=n["onTap"+("End"===i?"":i)];s&&Bt.postRender(()=>s(e,pn(e)))}const zo=new WeakMap,Yo=new WeakMap,Xo=t=>{const e=zo.get(t.target);e&&e(t)},Go=t=>{t.forEach(Xo)};function Ho(t,e,i){const n=function({root:t,...e}){const i=t||document;Yo.has(i)||Yo.set(i,{});const n=Yo.get(i),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(Go,{root:t,...e})),n[s]}(e);return zo.set(t,i),n.observe(t),()=>{zo.delete(t),n.unobserve(t)}}const qo={some:0,all:1};const _o={inView:{Feature:class extends on{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:i,amount:n="some",once:s}=t,o={root:e?e.current:void 0,rootMargin:i,threshold:"number"==typeof n?n:qo[n]};return Ho(this.node.current,o,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,s&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:i,onViewportLeave:n}=this.node.getProps(),o=e?i:n;o&&o(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return i=>t[i]!==e[i]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends on{mount(){const{current:t}=this.node;t&&(this.unmount=en(t,(t,e)=>(Wo(this.node,e,"Start"),(t,{success:e})=>Wo(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends on{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ht(dn(this.node.current,"focus",()=>this.onFocus()),dn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends on{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){const[n,s,o]=Xi(t,i),r=t=>{if(!Gi(t))return;const{target:i}=t,n=e(i,t);if("function"!=typeof n||!i)return;const o=t=>{Gi(t)&&(n(t),i.removeEventListener("pointerleave",o))};i.addEventListener("pointerleave",o,s)};return n.forEach(t=>{t.addEventListener("pointerenter",r,s)}),o}(t,(t,e)=>(Ko(this.node,e,"Start"),t=>Ko(this.node,t,"End"))))}unmount(){}}}},Zo=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 Jo extends mo{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=wn}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(v.has(e)){const t=Fi(e);return t&&t.default||0}return e=Zo.has(e)?e:U(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return N(t,e,i)}build(t,e,i){$(t,e,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,e,i,n){!function(t,e,i,n){fo(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(Zo.has(i)?i:U(i),e.attrs[i])}(t,e,0,n)}mount(t){this.isSVGTag=K(t.tagName),super.mount(t)}}const Qo={renderer:(t,e)=>e.isSVG??W(t)?new Jo(e):new yo(e,{allowProjection:t!==_}),...$o,..._o},tr={...Qo,...To,...Po};export{tr as domMax};
1
+ 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 p,G as m,H as f,I as y,J as g,K as v,M as x,b as T,m as P,o as w,r as S,N as A,n as b,i as V,h as E,p as M,k as C,O as D,d as k,s as R,P as L,L as j,S as B,a as F,Q as I,j as O,R as U,T as N,l as $,e as K,f as W,g as z}from"./size-rollup-dom-max-assets.js";import{jsx as Y}from"react/jsx-runtime";import{useContext as X,useId as G,useEffect as H,useCallback as q,Component as _,Fragment as Z}from"react";function J(t,e){-1===t.indexOf(e)&&t.push(e)}function Q(t,e){const i=t.indexOf(e);i>-1&&t.splice(i,1)}function tt(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let et=()=>{},it=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(et=(t,e,i)=>{t||"undefined"==typeof console||console.warn(tt(e,i))},it=(t,e,i)=>{if(!t)throw new Error(tt(e,i))});const nt={},st=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function ot(t){return"object"==typeof t&&null!==t}const rt=t=>/^0[^.\s]+$/u.test(t);function at(t){let e;return()=>(void 0===e&&(e=t()),e)}const lt=t=>t,ht=(t,e)=>i=>e(t(i)),ut=(...t)=>t.reduce(ht),ct=(t,e,i)=>{const n=e-t;return 0===n?1:(i-t)/n};class dt{constructor(){this.subscriptions=[]}add(t){return J(this.subscriptions,t),()=>Q(this.subscriptions,t)}notify(t,e,i){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,i);else for(let s=0;s<n;s++){const n=this.subscriptions[s];n&&n(t,e,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pt=t=>1e3*t,mt=t=>t/1e3;function ft(t,e){return e?t*(1e3/e):0}const yt=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function gt(t,e,i,n){if(t===e&&i===n)return lt;const s=e=>function(t,e,i,n,s){let o,r,a=0;do{r=e+(i-e)/2,o=yt(r,n,s)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:yt(s(t),e,n)}const vt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,xt=t=>e=>1-t(1-e),Tt=gt(.33,1.53,.69,.99),Pt=xt(Tt),wt=vt(Pt),St=t=>(t*=2)<1?.5*Pt(t):.5*(2-Math.pow(2,-10*(t-1))),At=t=>1-Math.sin(Math.acos(t)),bt=xt(At),Vt=vt(At),Et=gt(.42,0,1,1),Mt=gt(0,0,.58,1),Ct=gt(.42,0,.58,1),Dt=t=>Array.isArray(t)&&"number"==typeof t[0],kt={linear:lt,easeIn:Et,easeInOut:Ct,easeOut:Mt,circIn:At,circInOut:Vt,circOut:bt,backIn:Pt,backInOut:wt,backOut:Tt,anticipate:St},Rt=t=>{if(Dt(t)){it(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,n,s]=t;return gt(e,i,n,s)}return"string"==typeof t?(it(void 0!==kt[t],`Invalid easing type '${t}'`,"invalid-easing-type"),kt[t]):t},Lt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],jt={value:null,addProjectionMetrics:null};function Bt(t,e){let i=!1,n=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>i=!0,r=Lt.reduce((t,i)=>(t[i]=function(t,e){let i=new Set,n=new Set,s=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function h(e){r.has(e)&&(u.schedule(e),t()),l++,e(a)}const u={schedule:(t,e=!1,o=!1)=>{const a=o&&s?i:n;return e&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),r.delete(t)},process:t=>{a=t,s?o=!0:(s=!0,[i,n]=[n,i],i.forEach(h),e&&jt.value&&jt.value.frameloop[e].push(l),l=0,i.clear(),s=!1,o&&(o=!1,u.process(t)))}};return u}(o,e?i:void 0),t),{}),{setup:a,read:l,resolveKeyframes:h,preUpdate:u,update:c,preRender:d,render:p,postRender:m}=r,f=()=>{const o=nt.useManualTiming?s.timestamp:performance.now();i=!1,nt.useManualTiming||(s.delta=n?1e3/60:Math.max(Math.min(o-s.timestamp,40),1)),s.timestamp=o,s.isProcessing=!0,a.process(s),l.process(s),h.process(s),u.process(s),c.process(s),d.process(s),p.process(s),m.process(s),s.isProcessing=!1,i&&e&&(n=!1,t(f))};return{schedule:Lt.reduce((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(i||(i=!0,n=!0,s.isProcessing||t(f)),a.schedule(e,o,r)),e},{}),cancel:t=>{for(let e=0;e<Lt.length;e++)r[Lt[e]].cancel(t)},state:s,steps:r}}const{schedule:Ft,cancel:It,state:Ot,steps:Ut}=Bt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:lt,!0);let Nt;function $t(){Nt=void 0}const Kt={now:()=>(void 0===Nt&&Kt.set(Ot.isProcessing||nt.useManualTiming?Ot.timestamp:performance.now()),Nt),set:t=>{Nt=t,queueMicrotask($t)}};function Wt(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 zt(t,e){return i=>i>0?e:t}const Yt=(t,e,i)=>{const n=t*t,s=i*(e*e-n)+n;return s<0?0:Math.sqrt(s)},Xt=[n,e,i];function Gt(t){const e=(n=t,Xt.find(t=>t.test(n)));var n;if(et(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let s=e.parse(t);return e===i&&(s=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=Wt(a,n,t+1/3),o=Wt(a,n,t),r=Wt(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}}(s)),s}const Ht=(i,n)=>{const s=Gt(i),o=Gt(n);if(!s||!o)return zt(i,n);const r={...s};return i=>(r.red=Yt(s.red,o.red,i),r.green=Yt(s.green,o.green,i),r.blue=Yt(s.blue,o.blue,i),r.alpha=t(s.alpha,o.alpha,i),e.transform(r))},qt=new Set(["none","hidden"]);function _t(e,i){return n=>t(e,i,n)}function Zt(t){return"number"==typeof t?_t:"string"==typeof t?s(t)?zt:o.test(t)?Ht:te:Array.isArray(t)?Jt:"object"==typeof t?o.test(t)?Ht:Qt:zt}function Jt(t,e){const i=[...t],n=i.length,s=t.map((t,i)=>Zt(t)(t,e[i]));return t=>{for(let e=0;e<n;e++)i[e]=s[e](t);return i}}function Qt(t,e){const i={...t,...e},n={};for(const s in i)void 0!==t[s]&&void 0!==e[s]&&(n[s]=Zt(t[s])(t[s],e[s]));return t=>{for(const e in n)i[e]=n[e](t);return i}}const te=(t,e)=>{const i=r.createTransformer(e),n=a(t),s=a(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):ut(Jt(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):(et(!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"),zt(t,e))};function ee(e,i,n){if("number"==typeof e&&"number"==typeof i&&"number"==typeof n)return t(e,i,n);return Zt(e)(e,i)}const ie=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>Ft.update(e,t),stop:()=>It(e),now:()=>Ot.isProcessing?Ot.timestamp:Kt.now()}},ne=(t,e,i=10)=>{let n="";const s=Math.max(Math.round(e/i),2);for(let e=0;e<s;e++)n+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},se=2e4;function oe(t){let e=0;let i=t.next(e);for(;!i.done&&e<se;)e+=50,i=t.next(e);return e>=se?1/0:e}function re(t,e,i){const n=Math.max(e-5,0);return ft(i-t(n),e-n)}const ae=100,le=10,he=1,ue=0,ce=800,de=.3,pe=.3,me={granular:.01,default:2},fe={granular:.005,default:.5},ye=.01,ge=10,ve=.05,xe=1,Te=.001;function Pe({duration:t=ce,bounce:e=de,velocity:i=ue,mass:n=he}){let s,o;et(t<=pt(ge),"Spring duration must be 10 seconds or less","spring-duration-limit");let r=1-e;r=l(ve,xe,r),t=l(ye,ge,mt(t)),r<1?(s=e=>{const n=e*r,s=n*t,o=n-i,a=Se(e,r),l=Math.exp(-s);return Te-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=Se(Math.pow(e,2),r);return(-s(e)+Te>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 a=function(t,e,i){let n=i;for(let i=1;i<we;i++)n-=t(n)/e(n);return n}(s,o,5/t);if(t=pt(t),isNaN(a))return{stiffness:ae,damping:le,duration:t};{const e=Math.pow(a,2)*n;return{stiffness:e,damping:2*r*Math.sqrt(n*e),duration:t}}}const we=12;function Se(t,e){return t*Math.sqrt(1-e*e)}const Ae=["duration","bounce"],be=["stiffness","damping","mass"];function Ve(t,e){return e.some(e=>void 0!==t[e])}function Ee(t=pe,e=de){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:h,damping:u,mass:c,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:ue,stiffness:ae,damping:le,mass:he,isResolvedFromDuration:!1,...t};if(!Ve(t,be)&&Ve(t,Ae))if(t.visualDuration){const i=t.visualDuration,n=2*Math.PI/(1.2*i),s=n*n,o=2*l(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:he,stiffness:s,damping:o}}else{const i=Pe(t);e={...e,...i,mass:he},e.isResolvedFromDuration=!0}return e}({...i,velocity:-mt(i.velocity||0)}),f=p||0,y=u/(2*Math.sqrt(h*c)),g=r-o,v=mt(Math.sqrt(h/c)),x=Math.abs(g)<5;let T;if(n||(n=x?me.granular:me.default),s||(s=x?fe.granular:fe.default),y<1){const t=Se(v,y);T=e=>{const i=Math.exp(-y*v*e);return r-i*((f+y*v*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===y)T=t=>r-Math.exp(-v*t)*(g+(f+v*g)*t);else{const t=v*Math.sqrt(y*y-1);T=e=>{const i=Math.exp(-y*v*e),n=Math.min(t*e,300);return r-i*((f+y*v*g)*Math.sinh(n)+t*g*Math.cosh(n))/t}}const P={calculatedDuration:m&&d||null,next:t=>{const e=T(t);if(m)a.done=t>=d;else{let i=0===t?f:0;y<1&&(i=0===t?pt(f):re(T,t,e));const o=Math.abs(i)<=n,l=Math.abs(r-e)<=s;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(oe(P),se),e=ne(e=>P.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return P}function Me({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},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=i*e;const f=c+m,y=void 0===r?f:r(f);y!==f&&(m=y-c);const g=t=>-m*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,P;const w=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,P=Ee({keyframes:[d.value,p(d.value)],velocity:re(v,t,d.value),damping:s,stiffness:o,restDelta:h,restSpeed:u}))};return w(0),{calculatedDuration:null,next:t=>{let e=!1;return P||void 0!==T||(e=!0,x(t),w(t)),void 0!==T&&t>=T?P.next(t-T):(!e&&x(t),d)}}}function Ce(t,e,{clamp:i=!0,ease:n,mixer:s}={}){const o=t.length;if(it(o===e.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const r=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,i){const n=[],s=i||nt.mix||ee,o=t.length-1;for(let i=0;i<o;i++){let o=s(t[i],t[i+1]);if(e){const t=Array.isArray(e)?e[i]||lt:e;o=ut(t,o)}n.push(o)}return n}(e,n,s),h=a.length,u=i=>{if(r&&i<t[0])return e[0];let n=0;if(h>1)for(;n<t.length-2&&!(i<t[n+1]);n++);const s=ct(t[n],t[n+1],i);return a[n](s)};return i?e=>u(l(t[0],t[o-1],e)):u}function De(e){const i=[0];return function(e,i){const n=e[e.length-1];for(let s=1;s<=i;s++){const o=ct(0,i,s);e.push(t(n,1,o))}}(i,e.length-1),i}function ke({duration:t=300,keyframes:e,times:i,ease:n="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(n)?n.map(Rt):Rt(n),o={done:!1,value:e[0]},r=function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:De(e),t),a=Ce(r,e,{ease:Array.isArray(s)?s:(l=e,h=s,l.map(()=>h||Ct).splice(0,l.length-1))});var l,h;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}Ee.applyToOptions=t=>{const e=function(t,e=100,i){const n=i({...t,keyframes:[0,e]}),s=Math.min(oe(n),se);return{type:"keyframes",ease:t=>n.next(s*t).value/e,duration:mt(s)}}(t,100,Ee);return t.ease=e.ease,t.duration=pt(e.duration),t.type="keyframes",t};const Re=t=>null!==t;function Le(t,{repeat:e,repeatType:i="loop"},n,s=1){const o=t.filter(Re),r=s<0||e&&"loop"!==i&&e%2==1?0:o.length-1;return r&&void 0!==n?n:o[r]}const je={decay:Me,inertia:Me,tween:ke,keyframes:ke,spring:Ee};function Be(t){"string"==typeof t.type&&(t.type=je[t.type])}class Fe{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const Ie=t=>t/100;class Oe extends Fe{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==Kt.now()&&this.tick(Kt.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;Be(t);const{type:e=ke,repeat:i=0,repeatDelay:n=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||ke;a!==ke&&"number"!=typeof r[0]&&(this.mixKeyframes=ut(Ie,ee(r[0],r[1])),r=[0,100]);const l=a({...t,keyframes:r});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...r].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=oe(l));const{calculatedDuration:h}=l;this.calculatedDuration=h,this.resolvedDuration=h+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:h=0,keyframes:u,repeat:c,repeatType:d,repeatDelay:p,type:m,onUpdate:f,finalKeyframe:y}=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 g=this.currentTime-h*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let x=this.currentTime,T=i;if(c){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,c+1);Boolean(e%2)&&("reverse"===d?(i=1-i,p&&(i-=p/r)):"mirror"===d&&(T=o)),x=l(0,1,i)*r}const P=v?{done:!1,value:u[0]}:T.next(x);s&&(P.value=s(P.value));let{done:w}=P;v||null===a||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return S&&m!==Me&&(P.value=Le(u,this.options,y,this.speed)),f&&f(P.value),S&&this.finish(),P}then(t,e){return this.finished.then(t,e)}get duration(){return mt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+mt(t)}get time(){return mt(this.currentTime)}set time(t){t=pt(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(Kt.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=mt(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ie,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const 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(Kt.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const Ue=t=>180*t/Math.PI,Ne=t=>{const e=Ue(Math.atan2(t[1],t[0]));return Ke(e)},$e={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Ne,rotateZ:Ne,skewX:t=>Ue(Math.atan(t[1])),skewY:t=>Ue(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ke=t=>((t%=360)<0&&(t+=360),t),We=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ze=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ye={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:We,scaleY:ze,scale:t=>(We(t)+ze(t))/2,rotateX:t=>Ke(Ue(Math.atan2(t[6],t[5]))),rotateY:t=>Ke(Ue(Math.atan2(-t[2],t[0]))),rotateZ:Ne,rotate:Ne,skewX:t=>Ue(Math.atan(t[4])),skewY:t=>Ue(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Xe(t){return t.includes("scale")?1:0}function Ge(t,e){if(!t||"none"===t)return Xe(e);const i=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,s;if(i)n=Ye,s=i;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=$e,s=e}if(!s)return Xe(e);const o=n[e],r=s[1].split(",").map(He);return"function"==typeof o?o(r):r[o]}function He(t){return parseFloat(t.trim())}const qe=t=>t===h||t===u,_e=new Set(["x","y","z"]),Ze=c.filter(t=>!_e.has(t));const Je={width:({x:t},{paddingLeft:e="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),height:({y:t},{paddingTop:e="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),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})=>Ge(e,"x"),y:(t,{transform:e})=>Ge(e,"y")};Je.translateX=Je.x,Je.translateY=Je.y;const Qe=new Set;let ti=!1,ei=!1,ii=!1;function ni(){if(ei){const t=Array.from(Qe).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),i=new Map;e.forEach(t=>{const e=function(t){const e=[];return Ze.forEach(i=>{const n=t.getValue(i);void 0!==n&&(e.push([i,n.get()]),n.set(i.startsWith("scale")?1:0))}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=i.get(t);e&&e.forEach(([e,i])=>{t.getValue(e)?.set(i)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}ei=!1,ti=!1,Qe.forEach(t=>t.complete(ii)),Qe.clear()}function si(){Qe.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ei=!0)})}class oi{constructor(t,e,i,n,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=i,this.motionValue=n,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Qe.add(this),ti||(ti=!0,Ft.read(si),Ft.resolveKeyframes(ni))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:i,motionValue:n}=this;if(null===t[0]){const s=n?.get(),o=t[t.length-1];if(void 0!==s)t[0]=s;else if(i&&e){const n=i.readValue(e,o);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=o),n&&void 0===s&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Qe.delete(this)}cancel(){"scheduled"===this.state&&(Qe.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const ri=at(()=>void 0!==window.ScrollTimeline),ai={};function li(t,e){const i=at(t);return()=>ai[e]??i()}const hi=li(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),ui=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,ci={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ui([0,.65,.55,1]),circOut:ui([.55,0,1,.45]),backIn:ui([.31,.01,.66,-.59]),backOut:ui([.33,1.53,.69,.99])};function di(t,e){return t?"function"==typeof t?hi()?ne(t,e):"ease-out":Dt(t)?ui(t):Array.isArray(t)?t.map(t=>di(t,e)||ci.easeOut):ci[t]:void 0}function pi(t,e,i,{delay:n=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},h=void 0){const u={[e]:i};l&&(u.offset=l);const c=di(a,s);Array.isArray(c)&&(u.easing=c);const d={delay:n,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};h&&(d.pseudoElement=h);return t.animate(u,d)}function mi(t){return"function"==typeof t&&"applyToOptions"in t}class fi extends Fe{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:e,name:i,keyframes:n,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:r,onComplete:a}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=o,this.options=t,it("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return mi(t)&&hi()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=pi(e,i,n,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const t=Le(n,this.options,r,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,i){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,i):t.style[e]=i}(e,i,t),this.animation.cancel()}a?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return mt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+mt(t)}get time(){return mt(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=pt(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&&ri()?(this.animation.timeline=t,lt):e(this)}}const yi={anticipate:St,backInOut:wt,circInOut:Vt};function gi(t){"string"==typeof t.ease&&t.ease in yi&&(t.ease=yi[t.ease])}class vi extends fi{constructor(t){gi(t),Be(t),super(t),t.startTime&&(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=pt(this.finishedTime??this.time);e.setWithVelocity(r.sample(a-10).value,r.sample(a).value,10),r.stop()}}const xi=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!r.test(t)&&"0"!==t||t.startsWith("url(")));function Ti(t){t.duration=0,t.type="keyframes"}const Pi=new Set(["opacity","clipPath","filter","transform"]),wi=at(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class Si extends Fe{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=Kt.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||oi;this.keyframeResolver=new d(r,(t,e,i)=>this.onKeyframesResolved(t,e,c,!i),a,l,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,i,n){this.keyframeResolver=void 0;const{name:s,type:o,velocity:r,delay:a,isHandoff:l,onUpdate:h}=i;this.resolvedAt=Kt.now(),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=xi(s,e),a=xi(o,e);return et(r===a,`You are trying to animate ${e} from "${s}" to "${o}". "${r?o:s}" is not an animatable value.`,"value-not-animatable"),!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||mi(i))&&n)}(t,s,o,r)||(!nt.instantAnimations&&a||h?.(Le(t,i,e)),t[0]=t[t.length-1],Ti(i),i.repeat=0);const u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...i,keyframes:t},c=!l&&function(t){const{motionValue:e,name:i,repeatDelay:n,repeatType:s,damping:o,type:r}=t,a=e?.owner?.current;if(!(a instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:h}=e.owner.getProps();return wi()&&i&&Pi.has(i)&&("transform"!==i||!h)&&!l&&!n&&"mirror"!==s&&0!==o&&"inertia"!==r}(u)?new vi({...u,element:u.motionValue.owner.current}):new Oe(u);c.finished.then(()=>this.notifyFinished()).catch(lt),this.pendingTimeline&&(this.stopTimeline=c.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=c}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),ii=!0,si(),ni(),ii=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const Ai=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function bi(t,e,i=1){it(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,o]=function(t){const e=Ai.exec(t);if(!e)return[,];const[,i,n,s]=e;return[`--${i??n}`,s]}(t);if(!n)return;const r=window.getComputedStyle(e).getPropertyValue(n);if(r){const t=r.trim();return st(t)?parseFloat(t):t}return s(o)?bi(o,e,i+1):o}function Vi(t,e){return t?.[e]??t?.default??t}const Ei=new Set(["width","height","top","left","right","bottom",...c]),Mi=t=>e=>e.test(t),Ci=[h,u,d,p,m,f,{test:t=>"auto"===t,parse:t=>t}],Di=t=>Ci.find(Mi(t));function ki(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||rt(t))}const Ri=new Set(["brightness","contrast","saturate","opacity"]);function Li(t){const[e,i]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=i.match(y)||[];if(!n)return t;const s=i.replace(n,"");let o=Ri.has(e)?1:0;return n!==i&&(o*=100),e+"("+o+s+")"}const ji=/\b([a-z-]*)\(.*?\)/gu,Bi={...r,getAnimatableNone:t=>{const e=t.match(ji);return e?e.map(Li).join(" "):t}},Fi={...g,color:o,backgroundColor:o,outlineColor:o,fill:o,stroke:o,borderColor:o,borderTopColor:o,borderRightColor:o,borderBottomColor:o,borderLeftColor:o,filter:Bi,WebkitFilter:Bi},Ii=t=>Fi[t];function Oi(t,e){let i=Ii(t);return i!==Bi&&(i=r),i.getAnimatableNone?i.getAnimatableNone(e):void 0}const Ui=new Set(["auto","none","0"]);class Ni extends oi{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(),s(n))){const s=bi(n,e.current);void 0!==s&&(t[i]=s),i===t.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!Ei.has(i)||2!==t.length)return;const[n,o]=t,r=Di(n),a=Di(o);if(v(n)!==v(o)&&Je[i])this.needsMeasurement=!0;else if(r!==a)if(qe(r)&&qe(a))for(let e=0;e<t.length;e++){const i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else Je[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)(null===t[e]||ki(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&&!Ui.has(e)&&a(e).values.length&&(n=t[s]),s++}if(n&&i)for(const s of e)t[s]=Oi(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=Je[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]=Je[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()}}class $i{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=Kt.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=Kt.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 dt);const i=this.events[t].add(e);return"change"===t?()=>{i(),Ft.read(()=>{this.events.change.getSize()||this.stop()})}:i}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,i){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Kt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ft(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 Ki(t,e){return new $i(t,e)}const{schedule:Wi,cancel:zi}=Bt(queueMicrotask,!1),Yi={x:!1,y:!1};function Xi(){return Yi.x||Yi.y}function Gi(t,e){const i=function(t){if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t)}(t),n=new AbortController;return[i,{passive:!0,...e,signal:n.signal},()=>n.abort()]}function Hi(t){return!("touch"===t.pointerType||Xi())}const qi=(t,e)=>!!e&&(t===e||qi(t,e.parentElement)),_i=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Zi=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Ji=new WeakSet;function Qi(t){return e=>{"Enter"===e.key&&t(e)}}function tn(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function en(t){return _i(t)&&!Xi()}function nn(t,e,i={}){const[n,s,o]=Gi(t,i),r=t=>{const n=t.currentTarget;if(!en(t))return;Ji.add(n);const o=e(n,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Ji.has(n)&&Ji.delete(n),en(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,n===window||n===document||i.useGlobalTarget||qi(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),ot(e=t)&&"offsetHeight"in e&&(t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const n=Qi(()=>{if(Ji.has(i))return;tn(i,"down");const t=Qi(()=>{tn(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>tn(i,"cancel"),e)});i.addEventListener("keydown",n,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",n),e)})(t,s)),function(t){return Zi.has(t.tagName)||-1!==t.tabIndex}(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}function sn(t){return ot(t)&&"ownerSVGElement"in t}const on=[...Ci,o,r];class rn{constructor(t){this.isMounted=!1,this.node=t}update(){}}const an=t=>null!==t;const ln={type:"spring",stiffness:500,damping:25,restSpeed:10},hn={type:"keyframes",duration:.8},un={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},cn=(t,{keyframes:e})=>e.length>2?hn:x.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ln:un;const dn=(t,e,i,n={},s,o)=>r=>{const a=Vi(n,t)||{},l=a.delay||n.delay||0;let{elapsed:h=0}=n;h-=pt(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({when:t,delay:e,delayChildren:i,staggerChildren:n,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length})(a)||Object.assign(u,cn(t,u)),u.duration&&(u.duration=pt(u.duration)),u.repeatDelay&&(u.repeatDelay=pt(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let c=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(Ti(u),0===u.delay&&(c=!0)),(nt.instantAnimations||nt.skipAnimations)&&(c=!0,Ti(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,c&&!o&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:i="loop"},n){const s=t.filter(an),o=e&&"loop"!==i&&e%2==1?0:s.length-1;return o&&void 0!==n?n:s[o]}(u.keyframes,a);if(void 0!==t)return void Ft.update(()=>{u.onUpdate(t),u.onComplete()})}return a.isSync?new Oe(u):new Si(u)};function pn(t,e,i,n={passive:!0}){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i)}function mn(t){return{point:{x:t.pageX,y:t.pageY}}}function fn(t,e,i,n){return pn(t,e,(t=>e=>_i(e)&&t(e,mn(e)))(i),n)}function yn({top:t,left:e,right:i,bottom:n}){return{x:{min:e,max:i},y:{min:t,max:n}}}function gn(t){return t.max-t.min}function vn(e,i,n,s=.5){e.origin=s,e.originPoint=t(i.min,i.max,e.origin),e.scale=gn(n)/gn(i),e.translate=t(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function xn(t,e,i,n){vn(t.x,e.x,i.x,n?n.originX:void 0),vn(t.y,e.y,i.y,n?n.originY:void 0)}function Tn(t,e,i){t.min=i.min+e.min,t.max=t.min+gn(e)}function Pn(t,e,i){t.min=e.min-i.min,t.max=t.min+gn(e)}function wn(t,e,i){Pn(t.x,e.x,i.x),Pn(t.y,e.y,i.y)}const Sn=()=>({x:{min:0,max:0},y:{min:0,max:0}});function An(t){return[t("x"),t("y")]}function bn(t){return void 0===t||1===t}function Vn({scale:t,scaleX:e,scaleY:i}){return!bn(t)||!bn(e)||!bn(i)}function En(t){return Vn(t)||Mn(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Mn(t){return Cn(t.x)||Cn(t.y)}function Cn(t){return t&&"0%"!==t}function Dn(t,e,i){return i+e*(t-i)}function kn(t,e,i,n,s){return void 0!==s&&(t=Dn(t,s,n)),Dn(t,i,n)+e}function Rn(t,e=0,i=1,n,s){t.min=kn(t.min,e,i,n,s),t.max=kn(t.max,e,i,n,s)}function Ln(t,{x:e,y:i}){Rn(t.x,e.translate,e.scale,e.originPoint),Rn(t.y,i.translate,i.scale,i.originPoint)}const jn=.999999999999,Bn=1.0000000000001;function Fn(t,e){t.min=t.min+e,t.max=t.max+e}function In(e,i,n,s,o=.5){Rn(e,i,n,t(e.min,e.max,o),s)}function On(t,e){In(t.x,e.x,e.scaleX,e.scale,e.originX),In(t.y,e.y,e.scaleY,e.scale,e.originY)}function Un(t,e){return yn(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))}const Nn=({current:t})=>t?t.ownerDocument.defaultView:null;function $n(t,e){const i=t.getValue("willChange");if(n=i,Boolean(T(n)&&n.add))return i.add(e);if(!i&&nt.WillChange){const i=new nt.WillChange("auto");t.addValue("willChange",i),i.add(e)}var n}const Kn=(t,e)=>Math.abs(t-e);class Wn{constructor(t,e,{transformPagePoint:i,contextWindow:n=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=Xn(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,i=function(t,e){const i=Kn(t.x,e.x),n=Kn(t.y,e.y);return Math.sqrt(i**2+n**2)}(t.offset,{x:0,y:0})>=this.distanceThreshold;if(!e&&!i)return;const{point:n}=t,{timestamp:s}=Ot;this.history.push({...n,timestamp:s});const{onStart:o,onMove:r}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),r&&r(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=zn(e,this.transformPagePoint),Ft.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:i,onSessionEnd:n,resumeAnimation:s}=this.handlers;if(this.dragSnapToOrigin&&s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Xn("pointercancel"===t.type?this.lastMoveEventInfo:zn(e,this.transformPagePoint),this.history);this.startEvent&&i&&i(t,o),n&&n(t,o)},!_i(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=n||window;const r=zn(mn(t),this.transformPagePoint),{point:a}=r,{timestamp:l}=Ot;this.history=[{...a,timestamp:l}];const{onSessionStart:h}=e;h&&h(t,Xn(r,this.history)),this.removeListeners=ut(fn(this.contextWindow,"pointermove",this.handlePointerMove),fn(this.contextWindow,"pointerup",this.handlePointerUp),fn(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),It(this.updatePoint)}}function zn(t,e){return e?{point:e(t.point)}:t}function Yn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Xn({point:t},e){return{point:t,delta:Yn(t,Hn(e)),offset:Yn(t,Gn(e)),velocity:qn(e,.1)}}function Gn(t){return t[0]}function Hn(t){return t[t.length-1]}function qn(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,n=null;const s=Hn(t);for(;i>=0&&(n=t[i],!(s.timestamp-n.timestamp>pt(e)));)i--;if(!n)return{x:0,y:0};const o=mt(s.timestamp-n.timestamp);if(0===o)return{x:0,y:0};const r={x:(s.x-n.x)/o,y:(s.y-n.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function _n(t,e,i){return{min:void 0!==e?t.min+e:void 0,max:void 0!==i?t.max+i-(t.max-t.min):void 0}}function Zn(t,e){let i=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([i,n]=[n,i]),{min:i,max:n}}const Jn=.35;function Qn(t,e,i){return{min:ts(t,e),max:ts(t,i)}}function ts(t,e){return"number"==typeof t?t:t[e]||0}const es=new WeakMap;class is{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:e=!1,distanceThreshold:i}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:s}=this.getProps();this.panSession=new Wn(t,{onSessionStart:t=>{const{dragSnapToOrigin:i}=this.getProps();i?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(mn(t).point)},onStart:(t,e)=>{const{drag:i,dragPropagation:n,onDragStart:s}=this.getProps();if(i&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=i)||"y"===o?Yi[o]?null:(Yi[o]=!0,()=>{Yi[o]=!1}):Yi.x||Yi.y?null:(Yi.x=Yi.y=!0,()=>{Yi.x=Yi.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=t,this.latestPanInfo=e,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),An(t=>{let e=this.getAxisMotionValue(t).get()||0;if(d.test(e)){const{projection:i}=this.visualElement;if(i&&i.layout){const n=i.layout.layoutBox[t];if(n){e=gn(n)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),s&&Ft.postRender(()=>s(t,e)),$n(this.visualElement,"transform");const{animationState:r}=this.visualElement;r&&r.setActive("whileDrag",!0)},onMove:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e;const{dragPropagation:i,dragDirectionLock:n,onDirectionLock:s,onDrag:o}=this.getProps();if(!i&&!this.openDragLock)return;const{offset:r}=e;if(n&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let i=null;Math.abs(t.y)>e?i="y":Math.abs(t.x)>e&&(i="x");return i}(r),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",e.point,r),this.updateAxis("y",e.point,r),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e,this.stop(t,e),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>An(t=>"paused"===this.getAnimationState(t)&&this.getAxisMotionValue(t).animation?.play())},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,distanceThreshold:i,contextWindow:Nn(this.visualElement)})}stop(t,e){const i=t||this.latestPointerEvent,n=e||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!n||!i)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:r}=this.getProps();r&&Ft.postRender(()=>r(i,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(e,i,n){const{drag:s}=this.getProps();if(!n||!ns(e,s,this.currentDirection))return;const o=this.getAxisMotionValue(e);let r=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:i,max:n},s){return void 0!==i&&e<i?e=s?t(i,e,s.min):Math.max(e,i):void 0!==n&&e>n&&(e=s?t(n,e,s.max):Math.min(e,n)),e}(r,this.constraints[e],this.elastic[e])),o.set(r)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;t&&P(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i)&&function(t,{top:e,left:i,bottom:n,right:s}){return{x:_n(t.x,i,s),y:_n(t.y,e,n)}}(i.layoutBox,t),this.elastic=function(t=Jn){return!1===t?t=0:!0===t&&(t=Jn),{x:Qn(t,"left","right"),y:Qn(t,"top","bottom")}}(e),n!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&An(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const i={};return void 0!==e.min&&(i.min=e.min-t.min),void 0!==e.max&&(i.max=e.max-t.min),i}(i.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!P(t))return!1;const i=t.current;it(null!==i,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:n}=this.visualElement;if(!n||!n.layout)return!1;const s=function(t,e,i){const n=Un(t,i),{scroll:s}=e;return s&&(Fn(n.x,s.offset.x),Fn(n.y,s.offset.y)),n}(i,n.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Zn(t.x,e.x),y:Zn(t.y,e.y)}}(n.layout.layoutBox,s);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=yn(t))}return o}startAnimation(t){const{drag:e,dragMomentum:i,dragElastic:n,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=An(r=>{if(!ns(r,e,this.currentDirection))return;let l=a&&a[r]||{};o&&(l={min:0,max:0});const h=n?200:1e6,u=n?40:1e7,c={type:"inertia",velocity:i?t[r]:0,bounceStiffness:h,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(r,c)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const i=this.getAxisMotionValue(t);return $n(this.visualElement,t),i.start(dn(t,i,0,e,this.visualElement,!1))}stopAnimation(){An(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){An(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),n=i[e];return n||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(e){An(i=>{const{drag:n}=this.getProps();if(!ns(i,n,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(i);if(s&&s.layout){const{min:n,max:r}=s.layout.layoutBox[i],a=o.get()||0;o.set(e[i]-t(n,r,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:i}=this.getProps(),{projection:n}=this.visualElement;if(!P(i)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};An(t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const i=e.get();s[t]=function(t,e){let i=.5;const n=gn(t),s=gn(e);return s>n?i=ct(e.min,e.max-n,t.min):n>s&&(i=ct(t.min,t.max-s,e.min)),l(0,1,i)}({min:i,max:i},this.constraints[t])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),An(i=>{if(!ns(i,e,null))return;const n=this.getAxisMotionValue(i),{min:o,max:r}=this.constraints[i];n.set(t(o,r,s[i]))})}addListeners(){if(!this.visualElement.current)return;es.set(this.visualElement,this);const t=fn(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:i=!0}=this.getProps();e&&i&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();P(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,n=i.addEventListener("measure",e);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Ft.read(e);const s=pn(window,"resize",()=>this.scalePositionWithinConstraints()),o=i.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(An(e=>{const i=this.getAxisMotionValue(e);i&&(this.originPoint[e]+=t[e].translate,i.set(i.get()+t[e].translate))}),this.visualElement.render())});return()=>{s(),t(),n(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:i=!1,dragPropagation:n=!1,dragConstraints:s=!1,dragElastic:o=Jn,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:i,dragPropagation:n,dragConstraints:s,dragElastic:o,dragMomentum:r}}}function ns(t,e,i){return!(!0!==e&&e!==t||null!==i&&i!==t)}const ss=t=>(e,i)=>{t&&Ft.postRender(()=>t(e,i))};function os(t){return t.props[w]}const rs=(t,e)=>t.depth-e.depth;class as{constructor(){this.children=[],this.isDirty=!1}add(t){J(this.children,t),this.isDirty=!0}remove(t){Q(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(rs),this.isDirty=!1,this.children.forEach(t)}}const ls=["TopLeft","TopRight","BottomLeft","BottomRight"],hs=ls.length,us=t=>"string"==typeof t?parseFloat(t):t,cs=t=>"number"==typeof t||u.test(t);function ds(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const ps=fs(0,.5,bt),ms=fs(.5,.95,lt);function fs(t,e,i){return n=>n<t?0:n>e?1:i(ct(t,e,n))}function ys(t,e){t.min=e.min,t.max=e.max}function gs(t,e){ys(t.x,e.x),ys(t.y,e.y)}function vs(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function xs(t,e,i,n,s){return t=Dn(t-=e,1/i,n),void 0!==s&&(t=Dn(t,1/s,n)),t}function Ts(e,i,[n,s,o],r,a){!function(e,i=0,n=1,s=.5,o,r=e,a=e){d.test(i)&&(i=parseFloat(i),i=t(a.min,a.max,i/100)-a.min);if("number"!=typeof i)return;let l=t(r.min,r.max,s);e===r&&(l-=i),e.min=xs(e.min,i,n,l,o),e.max=xs(e.max,i,n,l,o)}(e,i[n],i[s],i[o],i.scale,r,a)}const Ps=["x","scaleX","originX"],ws=["y","scaleY","originY"];function Ss(t,e,i,n){Ts(t.x,e,Ps,i?i.x:void 0,n?n.x:void 0),Ts(t.y,e,ws,i?i.y:void 0,n?n.y:void 0)}function As(t){return 0===t.translate&&1===t.scale}function bs(t){return As(t.x)&&As(t.y)}function Vs(t,e){return t.min===e.min&&t.max===e.max}function Es(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Ms(t,e){return Es(t.x,e.x)&&Es(t.y,e.y)}function Cs(t){return gn(t.x)/gn(t.y)}function Ds(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class ks{constructor(){this.members=[]}add(t){J(this.members,t),t.scheduleRender()}remove(t){if(Q(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){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let i;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){i=e;break}}return!!i&&(this.promote(i),!0)}promote(t,e){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,e&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:n}=t.options;!1===n&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:i}=t;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Rs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ls=["","X","Y","Z"];let js=0;function Bs(t,e,i,n){const{latestValues:s}=e;s[t]&&(i[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function Fs(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const i=os(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",Ft,!(e||n))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&Fs(n)}function Is({attachResizeListener:e,defaultParent:i,measureScroll:n,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(t={},e=i?.()){this.id=js++,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(Ns),this.nodes.forEach(Gs),this.nodes.forEach(Hs),this.nodes.forEach($s)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new as)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new dt),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(t){if(this.instance)return;var i;this.isSVG=sn(t)&&!(sn(i=t)&&"svg"===i.tagName),this.instance=t;const{layoutId:n,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||n)&&(this.isLayoutDirty=!0),e){let i,n=0;const s=()=>this.root.updateBlockedByResize=!1;Ft.read(()=>{n=window.innerWidth}),e(t,()=>{const t=window.innerWidth;t!==n&&(n=t,this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=Kt.now(),n=({timestamp:s})=>{const o=s-i;o>=e&&(It(n),t(o-e))};return Ft.setup(n,!0),()=>It(n)}(s,250),Rs.hasAnimatedSinceResize&&(Rs.hasAnimatedSinceResize=!1,this.nodes.forEach(Xs)))})}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()||to,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!Ms(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={...Vi(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||Xs(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(),It(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(qs),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&&Fs(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,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())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Ws);if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(zs);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Ys),this.nodes.forEach(Os),this.nodes.forEach(Us)):this.nodes.forEach(zs),this.clearAllSnapshots();const t=Kt.now();Ot.delta=l(0,1e3/60,t-Ot.timestamp),Ot.timestamp=t,Ot.isProcessing=!0,Ut.update.process(Ot),Ut.preRender.process(Ot),Ut.render.process(Ot),Ot.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Wi.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ks),this.sharedNodes.forEach(_s)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ft.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ft.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||gn(this.snapshot.measuredBox.x)||gn(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={x:{min:0,max:0},y:{min:0,max:0}},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:n(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&&!bs(this.projectionDelta),i=this.getTransformTemplate(),n=i?i(this.latestValues,""):void 0,s=n!==this.prevTransformTemplateValue;t&&this.instance&&(e||En(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)),no((n=i).x),no(n.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(oo))){const{scroll:t}=this.root;t&&(Fn(e.x,t.offset.x),Fn(e.y,t.offset.y))}return e}removeElementScroll(t){const e={x:{min:0,max:0},y:{min:0,max:0}};if(gs(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&&gs(e,t),Fn(e.x,s.offset.x),Fn(e.y,s.offset.y))}return e}applyTransform(t,e=!1){const i={x:{min:0,max:0},y:{min:0,max:0}};gs(i,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];!e&&n.options.layoutScroll&&n.scroll&&n!==n.root&&On(i,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),En(n.latestValues)&&On(i,n.latestValues)}return En(this.latestValues)&&On(i,this.latestValues),i}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};gs(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!i.instance)continue;if(!En(i.latestValues))continue;Vn(i.latestValues)&&i.updateSnapshot();const n=Sn();gs(n,i.measurePageBox()),Ss(e,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,n)}return En(this.latestValues)&&Ss(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!==Ot.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=Ot.timestamp;const o=this.getClosestProjectingParent();var r,a,l;(o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),r=this.target,a=this.relativeTarget,l=this.relativeParent.target,Tn(r.x,a.x,l.x),Tn(r.y,a.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):gs(this.target,this.layout.layoutBox),Ln(this.target,this.targetDelta)):gs(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,o&&Boolean(o.resumingFrom)===Boolean(this.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!Vn(this.parent.latestValues)&&!Mn(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},wn(this.relativeTargetOrigin,e,i),gs(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===Ot.timestamp&&(i=!1),i)return;const{layout:n,layoutId:s}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!s)return;gs(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,r=this.treeScale.y;!function(t,e,i,n=!1){const s=i.length;if(!s)return;let o,r;e.x=e.y=1;for(let a=0;a<s;a++){o=i[a],r=o.projectionDelta;const{visualElement:s}=o.options;s&&s.props.style&&"contents"===s.props.style.display||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&On(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,Ln(t,r)),n&&En(o.latestValues)&&On(t,o.latestValues))}e.x<Bn&&e.x>jn&&(e.x=1),e.y<Bn&&e.y>jn&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:a}=t;a?(this.projectionDelta&&this.prevProjectionDelta?(vs(this.prevProjectionDelta.x,this.projectionDelta.x),vs(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),xn(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.treeScale.x===o&&this.treeScale.y===r&&Ds(this.projectionDelta.x,this.prevProjectionDelta.x)&&Ds(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,i=!1){const n=this.snapshot,s=n?n.latestValues:{},o={...this.latestValues},r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!i;const a={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),h=this.getStack(),u=!h||h.members.length<=1,c=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(Qs));let p;this.animationProgress=0,this.mixTargetDelta=i=>{const n=i/1e3;var h,m,f,y,g,v;Zs(r.x,e.x,n),Zs(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wn(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),f=this.relativeTarget,y=this.relativeTargetOrigin,g=a,v=n,Js(f.x,y.x,g.x,v),Js(f.y,y.y,g.y,v),p&&(h=this.relativeTarget,m=p,Vs(h.x,m.x)&&Vs(h.y,m.y))&&(this.isProjectionDirty=!1),p||(p={x:{min:0,max:0},y:{min:0,max:0}}),gs(p,this.relativeTarget)),l&&(this.animationValues=o,function(e,i,n,s,o,r){o?(e.opacity=t(0,n.opacity??1,ps(s)),e.opacityExit=t(i.opacity??1,0,ms(s))):r&&(e.opacity=t(i.opacity??1,n.opacity??1,s));for(let o=0;o<hs;o++){const r=`border${ls[o]}Radius`;let a=ds(i,r),l=ds(n,r);void 0===a&&void 0===l||(a||(a=0),l||(l=0),0===a||0===l||cs(a)===cs(l)?(e[r]=Math.max(t(us(a),us(l),s),0),(d.test(l)||d.test(a))&&(e[r]+="%")):e[r]=l)}(i.rotate||n.rotate)&&(e.rotate=t(i.rotate||0,n.rotate||0,s))}(o,s,this.latestValues,n,c,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(It(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ft.update(()=>{Rs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ki(0)),this.currentAnimation=function(t,e,i){const n=T(t)?t:Ki(t);return n.start(dn("",n,e,i)),n.animation}(this.motionValue,[0,1e3],{...t,velocity:0,isSync:!0,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onStop:()=>{},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:n,latestValues:s}=t;if(e&&i&&n){if(this!==t&&this.layout&&n&&so(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=gn(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const n=gn(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+n}gs(e,i),On(e,s),xn(this.projectionDeltaWithTransform,this.layoutCorrected,e,s)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new ks);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:i}={}){const n=this.getStack();n&&n.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const n={};i.z&&Bs("z",t,n,this.animationValues);for(let e=0;e<Ls.length;e++)Bs(`rotate${Ls[e]}`,t,n,this.animationValues),Bs(`skew${Ls[e]}`,t,n,this.animationValues);t.render();for(const e in n)t.setStaticValue(e,n[e]),this.animationValues&&(this.animationValues[e]=n[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=S(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=S(e?.pointerEvents)||""),void(this.hasProjected&&!En(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const s=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(t,e,i){let n="";const s=t.x.translate/e.x,o=t.y.translate/e.y,r=i?.z||0;if((s||o||r)&&(n=`translate3d(${s}px, ${o}px, ${r}px) `),1===e.x&&1===e.y||(n+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:t,rotate:e,rotateX:s,rotateY:o,skewX:r,skewY:a}=i;t&&(n=`perspective(${t}px) ${n}`),e&&(n+=`rotate(${e}deg) `),s&&(n+=`rotateX(${s}deg) `),o&&(n+=`rotateY(${o}deg) `),r&&(n+=`skewX(${r}deg) `),a&&(n+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return 1===a&&1===l||(n+=`scale(${a}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,s);i&&(o=i(s,o)),t.transform=o;const{x:r,y:a}=this.projectionDelta;t.transformOrigin=`${100*r.origin}% ${100*a.origin}% 0`,n.animationValues?t.opacity=n===this?s.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:t.opacity=n===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const e in A){if(void 0===s[e])continue;const{correct:i,applyTo:r,isCSSVariable:a}=A[e],l="none"===o?s[e]:i(s[e],n);if(r){const e=r.length;for(let i=0;i<e;i++)t[r[i]]=l}else a?this.options.visualElement.renderState.vars[e]=l:t[e]=l}this.options.layoutId&&(t.pointerEvents=n===this?S(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(t=>t.currentAnimation?.stop()),this.root.nodes.forEach(Ws),this.root.sharedNodes.clear()}}}function Os(t){t.updateLayout()}function Us(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:n}=t.layout,{animationType:s}=t.options,o=e.source!==t.layout.source;"size"===s?An(t=>{const n=o?e.measuredBox[t]:e.layoutBox[t],s=gn(n);n.min=i[t].min,n.max=n.min+s}):so(s,e.layoutBox,i)&&An(n=>{const s=o?e.measuredBox[n]:e.layoutBox[n],r=gn(i[n]);s.max=s.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[n].max=t.relativeTarget[n].min+r)});const r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};xn(r,i,e.layoutBox);const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?xn(a,t.applyTransform(n,!0),e.measuredBox):xn(a,i,e.layoutBox);const l=!bs(r);let h=!1;if(!t.resumeFrom){const n=t.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:s,layout:o}=n;if(s&&o){const r={x:{min:0,max:0},y:{min:0,max:0}};wn(r,e.layoutBox,s.layoutBox);const a={x:{min:0,max:0},y:{min:0,max:0}};wn(a,i,o.layoutBox),Ms(r,a)||(h=!0),n.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=n)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Ns(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function $s(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Ks(t){t.clearSnapshot()}function Ws(t){t.clearMeasurements()}function zs(t){t.isLayoutDirty=!1}function Ys(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Xs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Gs(t){t.resolveTargetDelta()}function Hs(t){t.calcProjection()}function qs(t){t.resetSkewAndRotation()}function _s(t){t.removeLeadSnapshot()}function Zs(e,i,n){e.translate=t(i.translate,0,n),e.scale=t(i.scale,1,n),e.origin=i.origin,e.originPoint=i.originPoint}function Js(e,i,n,s){e.min=t(i.min,n.min,s),e.max=t(i.max,n.max,s)}function Qs(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const to={duration:.45,ease:[.4,0,.1,1]},eo=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),io=eo("applewebkit/")&&!eo("chrome/")?Math.round:lt;function no(t){t.min=io(t.min),t.max=io(t.max)}function so(t,e,i){return"position"===t||"preserve-aspect"===t&&(n=Cs(e),s=Cs(i),o=.2,!(Math.abs(n-s)<=o));var n,s,o}function oo(t){return t!==t.root&&t.scroll?.wasRoot}const ro=Is({attachResizeListener:(t,e)=>pn(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ao={current:void 0},lo=Is({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ao.current){const t=new ro({});t.mount(window),t.setOptions({layoutScroll:!0}),ao.current=t}return ao.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),ho={current:null},uo={current:!1};const co=new WeakMap;const po=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class mo{scrapeMotionValuesFromProps(t,e,i){return{}}constructor({parent:t,props:e,presenceContext:i,reducedMotionConfig:n,blockInitialAnimation:s,visualState:o},r={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=oi,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Kt.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Ft.render(this.render,!1,!0))};const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=e,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.options=r,this.blockInitialAnimation=Boolean(s),this.isControllingVariants=V(e),this.isVariantNode=E(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:h,...u}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in u){const e=u[t];void 0!==a[t]&&T(e)&&e.set(a[t])}}mount(t){this.current=t,co.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(uo.current||function(){if(uo.current=!0,b)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ho.current=t.matches;t.addEventListener("change",e),e()}else ho.current=!1}(),this.shouldReduceMotion=ho.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),It(this.notifyUpdate),It(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=x.has(t);i&&this.onBindTransform&&this.onBindTransform();const n=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&Ft.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{n(),s&&s(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in M){const e=M[t];if(!e)continue;const{isEnabled:i,Feature:n}=e;if(!this.features[t]&&n&&i(this.props)&&(this.features[t]=new n(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<po.length;e++){const i=po[e];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const n=t["on"+i];n&&(this.propEventSubscriptions[i]=this.on(i,n))}this.prevMotionValues=function(t,e,i){for(const n in e){const s=e[n],o=i[n];if(T(s))t.addValue(n,s);else if(T(o))t.addValue(n,Ki(s,{owner:t}));else if(o!==s)if(t.hasValue(n)){const e=t.getValue(n);!0===e.liveStyle?e.jump(s):e.hasAnimated||e.set(s)}else{const e=t.getStaticValue(n);t.addValue(n,Ki(void 0!==e?e:s,{owner:t}))}}for(const n in i)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const i=this.values.get(t);e!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return void 0===i&&void 0!==e&&(i=Ki(null===e?void 0:e,{owner:this}),this.addValue(t,i)),i}readValue(t,e){let i=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=i&&("string"==typeof i&&(st(i)||rt(i))?i=parseFloat(i):(n=i,!on.find(Mi(n))&&r.test(e)&&(i=Oi(t,e))),this.setBaseTarget(t,T(i)?i.get():i)),T(i)?i.get():i}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let i;if("string"==typeof e||"object"==typeof e){const n=C(this.props,e,this.presenceContext?.custom);n&&(i=n[t])}if(e&&void 0!==i)return i;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||T(n)?void 0!==this.initialValues[t]&&void 0===i?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new dt),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){Wi.render(this.render)}}class fo extends mo{constructor(){super(...arguments),this.KeyframeResolver=Ni}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[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;T(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function yo(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 go extends fo{constructor(){super(...arguments),this.type="html",this.renderInstance=yo}readValueFromInstance(t,e){if(x.has(e))return this.projection?.isProjecting?Xe(e):((t,e)=>{const{transform:i="none"}=getComputedStyle(t);return Ge(i,e)})(t,e);{const n=(i=t,window.getComputedStyle(i)),s=(D(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof s?s.trim():s}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return Un(t,e)}build(t,e,i){k(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return R(t,e,i)}}let vo=!1;class xo extends _{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i,layoutId:n}=this.props,{projection:s}=t;s&&(e.group&&e.group.add(s),i&&i.register&&n&&i.register(s),vo&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Rs.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:i,drag:n,isPresent:s}=this.props,{projection:o}=i;return o?(o.isPresent=s,vo=!0,n||t.layoutDependency!==e||void 0===e||t.isPresent!==s?o.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?o.promote():o.relegate()||Ft.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Wi.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:n}=t;vo=!0,n&&(n.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(n),i&&i.deregister&&i.deregister(n))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function To(t){const[e,i]=function(t=!0){const e=X(L);if(null===e)return[!0,null];const{isPresent:i,onExitComplete:n,register:s}=e,o=G();H(()=>{if(t)return s(o)},[t]);const r=q(()=>t&&n&&n(o),[o,n,t]);return!i&&n?[!1,r]:[!0]}(),n=X(j);return Y(xo,{...t,layoutGroup:n,switchLayoutGroup:X(B),isPresent:e,safeToRemove:i})}const Po={pan:{Feature:class extends rn{constructor(){super(...arguments),this.removePointerDownListener=lt}onPointerDown(t){this.session=new Wn(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Nn(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:i,onPanEnd:n}=this.node.getProps();return{onSessionStart:ss(t),onStart:ss(e),onMove:i,onEnd:(t,e)=>{delete this.session,n&&Ft.postRender(()=>n(t,e))}}}mount(){this.removePointerDownListener=fn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends rn{constructor(t){super(t),this.removeGroupControls=lt,this.removeListeners=lt,this.controls=new is(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||lt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:e}=this.node.prevProps||{};t!==e&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:lo,MeasureLayout:To}},wo={layout:{ProjectionNode:lo,MeasureLayout:To}};function So(t,e,i){const n=t.getProps();return C(n,e,void 0!==i?i:n.custom,t)}const Ao=t=>Array.isArray(t);function bo(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,Ki(i))}function Vo(t){return Ao(t)?t[t.length-1]||0:t}function Eo({protectedKeys:t,needsAnimating:e},i){const n=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,n}function Mo(t,e,{delay:i=0,transitionOverride:n,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;n&&(o=n);const l=[],h=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||h&&Eo(h,e))continue;const r={delay:i,...Vi(o||{},e)},u=n.get();if(void 0!==u&&!n.isAnimating&&!Array.isArray(s)&&s===u&&!r.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){const i=os(t);if(i){const t=window.MotionHandoffAnimation(i,e,Ft);null!==t&&(r.startTime=t,c=!0)}}$n(t,e),n.start(dn(e,n,s,t.shouldReduceMotion&&Ei.has(e)?{type:!1}:r,t,c));const d=n.animation;d&&l.push(d)}return r&&Promise.all(l).then(()=>{Ft.update(()=>{r&&function(t,e){const i=So(t,e);let{transitionEnd:n={},transition:s={},...o}=i||{};o={...o,...n};for(const e in o)bo(t,e,Vo(o[e]))}(t,r)})}),l}function Co(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}function Do(t,e,i={}){const n=So(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(Mo(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(Do(l,e,{...r,delay:i+("function"==typeof n?0:n)+Co(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 ko(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 Ro=I.length;function Lo(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Lo(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let i=0;i<Ro;i++){const n=I[i],s=t.props[n];(F(s)||!1===s)&&(e[n]=s)}return e}const jo=[...U].reverse(),Bo=U.length;function Fo(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=>Do(t,e,i));n=Promise.all(s)}else if("string"==typeof e)n=Do(t,e,i);else{const s="function"==typeof e?So(t,e,i.custom):e;n=Promise.all(Mo(t,s,i))}return n.then(()=>{t.notify("AnimationComplete",e)})}(t,e,i)))}function Io(t){let e=Fo(t),i=No(),n=!0;const s=e=>(i,n)=>{const s=So(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 o(o){const{props:r}=t,a=Lo(t.parent)||{},l=[],h=new Set;let u={},c=1/0;for(let e=0;e<Bo;e++){const d=jo[e],p=i[d],m=void 0!==r[d]?r[d]:a[d],f=F(m),y=d===o?p.isActive:null;!1===y&&(c=e);let g=m===a[d]&&m!==r[d]&&f;if(g&&n&&t.manuallyAnimateOnMount&&(g=!1),p.protectedKeys={...u},!p.isActive&&null===y||!m&&!p.prevProp||O(m)||"boolean"==typeof m)continue;const v=Oo(p.prevProp,m);let x=v||d===o&&p.isActive&&!g&&f||e>c&&f,T=!1;const P=Array.isArray(m)?m:[m];let w=P.reduce(s(d),{});!1===y&&(w={});const{prevResolvedValues:S={}}=p,A={...S,...w},b=e=>{x=!0,h.has(e)&&(T=!0,h.delete(e)),p.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in A){const e=w[t],i=S[t];if(u.hasOwnProperty(t))continue;let n=!1;n=Ao(e)&&Ao(i)?!ko(e,i):e!==i,n?null!=e?b(t):h.add(t):void 0!==e&&h.has(t)?b(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=w,p.isActive&&(u={...u,...w}),n&&t.blockInitialAnimation&&(x=!1);const V=g&&v;x&&(!V||T)&&l.push(...P.map(e=>{const i={type:d};if("string"==typeof e&&n&&!V&&t.manuallyAnimateOnMount&&t.parent){const{parent:n}=t,s=So(n,e);if(n.enteringChildren&&s){const{delayChildren:e}=s.transition||{};i.delay=Co(n.enteringChildren,t,e)}}return{animation:e,options:i}}))}if(h.size){const e={};if("boolean"!=typeof r.initial){const i=So(t,Array.isArray(r.initial)?r.initial[0]:r.initial);i&&i.transition&&(e.transition=i.transition)}h.forEach(i=>{const n=t.getBaseTarget(i),s=t.getValue(i);s&&(s.liveStyle=!0),e[i]=n??null}),l.push({animation:e})}let d=Boolean(l.length);return!n||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),n=!1,d?e(l):Promise.resolve()}return{animateChanges:o,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=o(e);for(const t in i)i[t].protectedKeys={};return s},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=No()}}}function Oo(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!ko(e,t)}function Uo(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function No(){return{animate:Uo(!0),whileInView:Uo(),whileHover:Uo(),whileTap:Uo(),whileDrag:Uo(),whileFocus:Uo(),exit:Uo()}}let $o=0;const Ko={animation:{Feature:class extends rn{constructor(t){super(t),t.animationState||(t.animationState=Io(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();O(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends rn{constructor(){super(...arguments),this.id=$o++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const n=this.node.animationState.setActive("exit",!t);e&&!t&&n.then(()=>{e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function Wo(t,e,i){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover","Start"===i);const s=n["onHover"+i];s&&Ft.postRender(()=>s(e,mn(e)))}function zo(t,e,i){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap","Start"===i);const s=n["onTap"+("End"===i?"":i)];s&&Ft.postRender(()=>s(e,mn(e)))}const Yo=new WeakMap,Xo=new WeakMap,Go=t=>{const e=Yo.get(t.target);e&&e(t)},Ho=t=>{t.forEach(Go)};function qo(t,e,i){const n=function({root:t,...e}){const i=t||document;Xo.has(i)||Xo.set(i,{});const n=Xo.get(i),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(Ho,{root:t,...e})),n[s]}(e);return Yo.set(t,i),n.observe(t),()=>{Yo.delete(t),n.unobserve(t)}}const _o={some:0,all:1};const Zo={inView:{Feature:class extends rn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:i,amount:n="some",once:s}=t,o={root:e?e.current:void 0,rootMargin:i,threshold:"number"==typeof n?n:_o[n]};return qo(this.node.current,o,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,s&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:i,onViewportLeave:n}=this.node.getProps(),o=e?i:n;o&&o(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return i=>t[i]!==e[i]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends rn{mount(){const{current:t}=this.node;t&&(this.unmount=nn(t,(t,e)=>(zo(this.node,e,"Start"),(t,{success:e})=>zo(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends rn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ut(pn(this.node.current,"focus",()=>this.onFocus()),pn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends rn{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){const[n,s,o]=Gi(t,i),r=t=>{if(!Hi(t))return;const{target:i}=t,n=e(i,t);if("function"!=typeof n||!i)return;const o=t=>{Hi(t)&&(n(t),i.removeEventListener("pointerleave",o))};i.addEventListener("pointerleave",o,s)};return n.forEach(t=>{t.addEventListener("pointerenter",r,s)}),o}(t,(t,e)=>(Wo(this.node,e,"Start"),t=>Wo(this.node,t,"End"))))}unmount(){}}}},Jo=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 Qo extends fo{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Sn}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(x.has(e)){const t=Ii(e);return t&&t.default||0}return e=Jo.has(e)?e:N(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return $(t,e,i)}build(t,e,i){K(t,e,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,e,i,n){!function(t,e,i,n){yo(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(Jo.has(i)?i:N(i),e.attrs[i])}(t,e,0,n)}mount(t){this.isSVGTag=W(t.tagName),super.mount(t)}}const tr={renderer:(t,e)=>e.isSVG??z(t)?new Qo(e):new go(e,{allowProjection:t!==Z}),...Ko,...Zo},er={...tr,...Po,...wo};export{er as domMax};