Files
echo-nexus/node_modules/framer-motion/dist/size-rollup-dom-max.js
T

2 lines
81 KiB
JavaScript

import{q as t,t as e,u as i,v as n,w as s,x as o,y as r,z as a,A as l,B as h,C as u,D as c,E as d,F as m,G as p,M as f,K as y,H as g,I as v,J as x,N as T,k as P,O as w,b as S,o as E,Q as A,R as D,T as b,U as M,V as k,W as V,X as C,Y as L,Z as R,_ as j,d as B,s as O,$ as F,a0 as I,l as U,e as $,f as N,a1 as W,a as z,a2 as K,j as G,a3 as H,a4 as Y,a5 as X,a6 as q,a7 as _,a8 as Z,a9 as J,aa as Q,ab as tt,r as et,ac as it,p as nt,P as st,L as ot,S as rt,g as at}from"./size-rollup-dom-max-assets.js";import{jsx as lt}from"react/jsx-runtime";import{useContext as ht,useId as ut,useEffect as ct,useCallback as dt,Component as mt,Fragment as pt}from"react";function ft(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let yt=()=>{},gt=()=>{};function vt(t){return"object"==typeof t&&null!==t}function xt(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(yt=(t,e,i)=>{t||"undefined"==typeof console||console.warn(ft(e,i))},gt=(t,e,i)=>{if(!t)throw new Error(ft(e,i))});const Tt=(t,e)=>i=>e(t(i)),Pt=(...t)=>t.reduce(Tt),wt=(t,e,i)=>{const n=e-t;return 0===n?1:(i-t)/n},St=t=>1e3*t,Et=t=>t/1e3,At=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function Dt(e,i,n,s){if(e===i&&n===s)return t;const o=t=>function(t,e,i,n,s){let o,r,a=0;do{r=e+(i-e)/2,o=At(r,n,s)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(t,0,1,e,n);return t=>0===t||1===t?t:At(o(t),i,s)}const bt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Mt=t=>e=>1-t(1-e),kt=Dt(.33,1.53,.69,.99),Vt=Mt(kt),Ct=bt(Vt),Lt=t=>(t*=2)<1?.5*Vt(t):.5*(2-Math.pow(2,-10*(t-1))),Rt=t=>1-Math.sin(Math.acos(t)),jt=Mt(Rt),Bt=bt(Rt),Ot=Dt(.42,0,1,1),Ft=Dt(0,0,.58,1),It=Dt(.42,0,.58,1),Ut=t=>Array.isArray(t)&&"number"==typeof t[0],$t={linear:t,easeIn:Ot,easeInOut:It,easeOut:Ft,circIn:Rt,circInOut:Bt,circOut:jt,backIn:Vt,backInOut:Ct,backOut:kt,anticipate:Lt},Nt=t=>{if(Ut(t)){gt(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,n,s]=t;return Dt(e,i,n,s)}return"string"==typeof t?(gt(void 0!==$t[t],`Invalid easing type '${t}'`,"invalid-easing-type"),$t[t]):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 Kt=(t,e,i)=>{const n=t*t,s=i*(e*e-n)+n;return s<0?0:Math.sqrt(s)},Gt=[s,i,n];function Ht(t){const e=(i=t,Gt.find(t=>t.test(i)));var i;if(yt(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===n&&(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 Yt=(t,n)=>{const s=Ht(t),o=Ht(n);if(!s||!o)return zt(t,n);const r={...s};return t=>(r.red=Kt(s.red,o.red,t),r.green=Kt(s.green,o.green,t),r.blue=Kt(s.blue,o.blue,t),r.alpha=e(s.alpha,o.alpha,t),i.transform(r))},Xt=new Set(["none","hidden"]);function qt(t,i){return n=>e(t,i,n)}function _t(t){return"number"==typeof t?qt:"string"==typeof t?o(t)?zt:r.test(t)?Yt:Qt:Array.isArray(t)?Zt:"object"==typeof t?r.test(t)?Yt:Jt:zt}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=a.createTransformer(e),n=l(t),s=l(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?Xt.has(t)&&!s.values.length||Xt.has(e)&&!n.values.length?function(t,e){return Xt.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):Pt(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):(yt(!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 te(t,i,n){if("number"==typeof t&&"number"==typeof i&&"number"==typeof n)return e(t,i,n);return _t(t)(t,i)}const ee=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>h.update(e,t),stop:()=>u(e),now:()=>c.isProcessing?c.timestamp:d.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 m(i-t(n),e-n)}const re=100,ae=10,le=1,he=0,ue=800,ce=.3,de=.3,me={granular:.01,default:2},pe={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;yt(t<=St(ye),"Spring duration must be 10 seconds or less","spring-duration-limit");let r=1-e;r=p(ge,ve,r),t=p(fe,ye,Et(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=St(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"],Ee=["stiffness","damping","mass"];function Ae(t,e){return e.some(e=>void 0!==t[e])}function De(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:l,damping:h,mass:u,duration:c,velocity:d,isResolvedFromDuration:m}=function(t){let e={velocity:he,stiffness:re,damping:ae,mass:le,isResolvedFromDuration:!1,...t};if(!Ae(t,Ee)&&Ae(t,Se))if(t.visualDuration){const i=t.visualDuration,n=2*Math.PI/(1.2*i),s=n*n,o=2*p(.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:-Et(i.velocity||0)}),f=d||0,y=h/(2*Math.sqrt(l*u)),g=r-o,v=Et(Math.sqrt(l/u)),x=Math.abs(g)<5;let T;if(n||(n=x?me.granular:me.default),s||(s=x?pe.granular:pe.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&&c||null,next:t=>{const e=T(t);if(m)a.done=t>=c;else{let i=0===t?f:0;y<1&&(i=0===t?St(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 be({keyframes:t,velocity:e=0,power:i=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:h=.5,restSpeed:u}){const c=t[0],d={done:!1,value:c},m=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let p=i*e;const f=c+p,y=void 0===r?f:r(f);y!==f&&(p=y-c);const g=t=>-p*Math.exp(-t/n),v=t=>y+g(t),x=t=>{const e=g(t),i=v(t);d.done=Math.abs(e)<=h,d.value=d.done?y:i};let T,P;const w=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,P=De({keyframes:[d.value,m(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(e,i,{clamp:n=!0,ease:s,mixer:o}={}){const r=e.length;if(gt(r===i.length,"Both input and output ranges must be the same length","range-length"),1===r)return()=>i[0];if(2===r&&i[0]===i[1])return()=>i[1];const a=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),i=[...i].reverse());const l=function(e,i,n){const s=[],o=n||f.mix||te,r=e.length-1;for(let n=0;n<r;n++){let r=o(e[n],e[n+1]);if(i){const e=Array.isArray(i)?i[n]||t:i;r=Pt(e,r)}s.push(r)}return s}(i,s,o),h=l.length,u=t=>{if(a&&t<e[0])return i[0];let n=0;if(h>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const s=wt(e[n],e[n+1],t);return l[n](s)};return n?t=>u(p(e[0],e[r-1],t)):u}function ke(t){const i=[0];return function(t,i){const n=t[t.length-1];for(let s=1;s<=i;s++){const o=wt(0,i,s);t.push(e(n,1,o))}}(i,t.length-1),i}function Ve({duration:t=300,keyframes:e,times:i,ease:n="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(n)?n.map(Nt):Nt(n),o={done:!1,value:e[0]},r=function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:ke(e),t),a=Me(r,e,{ease:Array.isArray(s)?s:(l=e,h=s,l.map(()=>h||It).splice(0,l.length-1))});var l,h;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}De.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:Et(s)}}(t,100,De);return t.ease=e.ease,t.duration=St(e.duration),t.type="keyframes",t};const Ce=t=>null!==t;function Le(t,{repeat:e,repeatType:i="loop"},n,s=1){const o=t.filter(Ce),r=s<0||e&&"loop"!==i&&e%2==1?0:o.length-1;return r&&void 0!==n?n:o[r]}const Re={decay:be,inertia:be,tween:Ve,keyframes:Ve,spring:De};function je(t){"string"==typeof t.type&&(t.type=Re[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 Oe=t=>t/100;class Fe 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!==d.now()&&this.tick(d.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=Ve,repeat:i=0,repeatDelay:n=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||Ve;a!==Ve&&"number"!=typeof r[0]&&(this.mixKeyframes=Pt(Oe,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:l=0,keyframes:h,repeat:u,repeatType:c,repeatDelay:d,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-l*(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(u){const t=Math.min(this.currentTime,n)/r;let e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,e=Math.min(e,u+1);Boolean(e%2)&&("reverse"===c?(i=1-i,d&&(i-=d/r)):"mirror"===c&&(T=o)),x=p(0,1,i)*r}const P=v?{done:!1,value:h[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!==be&&(P.value=Le(h,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 Et(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Et(t)}get time(){return Et(this.currentTime)}set time(t){t=St(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(d.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Et(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(d.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 Ie=xt(()=>void 0!==window.ScrollTimeline),Ue={};function $e(t,e){const i=xt(t);return()=>Ue[e]??i()}const Ne=$e(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),We=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,ze={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:We([0,.65,.55,1]),circOut:We([.55,0,1,.45]),backIn:We([.31,.01,.66,-.59]),backOut:We([.33,1.53,.69,.99])};function Ke(t,e){return t?"function"==typeof t?Ne()?ie(t,e):"ease-out":Ut(t)?We(t):Array.isArray(t)?t.map(t=>Ke(t,e)||ze.easeOut):ze[t]:void 0}function Ge(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=Ke(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 He(t){return"function"==typeof t&&"applyToOptions"in t}class Ye extends Be{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!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,gt("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return He(t)&&Ne()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Ge(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.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Et(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Et(t)}get time(){return Et(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=St(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 this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:e,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Ie()?(this.animation.timeline=e,t):i(this)}}const Xe={anticipate:Lt,backInOut:Ct,circInOut:Bt};function qe(t){"string"==typeof t.ease&&t.ease in Xe&&(t.ease=Xe[t.ease])}class _e extends Ye{constructor(t){qe(t),je(t),super(t),void 0!==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 Fe({...o,autoplay:!1}),a=Math.max(10,d.now()-this.startTime),l=p(0,10,a-10);e.setWithVelocity(r.sample(Math.max(0,a-l)).value,r.sample(a).value,l),r.stop()}}const Ze=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!a.test(t)&&"0"!==t||t.startsWith("url(")));function Je(t){t.duration=0,t.type="keyframes"}const Qe=new Set(["opacity","clipPath","filter","transform"]),ti=xt(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class ei 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=d.now();const c={autoplay:t,delay:e,type:i,repeat:n,repeatDelay:s,repeatType:o,name:a,motionValue:l,element:h,...u},m=h?.KeyframeResolver||y;this.keyframeResolver=new m(r,(t,e,i)=>this.onKeyframesResolved(t,e,c,!i),a,l,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,i,n,s){this.keyframeResolver=void 0;const{name:o,type:r,velocity:a,delay:l,isHandoff:h,onUpdate:u}=n;this.resolvedAt=d.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=Ze(s,e),a=Ze(o,e);return yt(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||He(i))&&n)}(e,o,r,a)||(!f.instantAnimations&&l||u?.(Le(e,n,i)),e[0]=e[e.length-1],Je(n),n.repeat=0);const c={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:i,...n,keyframes:e},m=!h&&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 ti()&&i&&Qe.has(i)&&("transform"!==i||!h)&&!l&&!n&&"mirror"!==s&&0!==o&&"inertia"!==r}(c)?new _e({...c,element:c.motionValue.owner.current}):new Fe(c);m.finished.then(()=>this.notifyFinished()).catch(t),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),g()),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 ii=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ni(t,e,i=1){gt(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[n,s]=function(t){const e=ii.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 v(t)?parseFloat(t):t}return o(s)?ni(s,e,i+1):s}function si(t,e){return t?.[e]??t?.default??t}const oi={type:"spring",stiffness:500,damping:25,restSpeed:10},ri={type:"keyframes",duration:.8},ai={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},li=(t,{keyframes:e})=>e.length>2?ri:x.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:oi:ai;const hi=t=>null!==t;function ui(t,e,i,n=0,s=1){const o=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),r=t.size,a=(r-1)*n;return"function"==typeof i?i(o,r):1===s?o*n:a-o*n}const ci=(t,e,i,n={},s,o)=>r=>{const a=si(n,t)||{},l=a.delay||n.delay||0;let{elapsed:u=0}=n;u-=St(l);const c={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,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(c,li(t,c)),c.duration&&(c.duration=St(c.duration)),c.repeatDelay&&(c.repeatDelay=St(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(Je(c),0===c.delay&&(d=!0)),(f.instantAnimations||f.skipAnimations)&&(d=!0,Je(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:i="loop"},n){const s=t.filter(hi),o=e&&"loop"!==i&&e%2==1?0:s.length-1;return o&&void 0!==n?n:s[o]}(c.keyframes,a);if(void 0!==t)return void h.update(()=>{c.onUpdate(t),c.onComplete()})}return a.isSync?new Fe(c):new ei(c)},di=new Set(["width","height","top","left","right","bottom",...T]);function mi(t,e,i){const n=t.getProps();return P(n,e,void 0!==i?i:n.custom,t)}const pi=t=>Array.isArray(t);function fi(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,w(i))}function yi(t){return pi(t)?t[t.length-1]||0:t}function gi(t,e){const i=t.getValue("willChange");if(n=i,Boolean(S(n)&&n.add))return i.add(e);if(!i&&f.WillChange){const i=new f.WillChange("auto");t.addValue("willChange",i),i.add(e)}var n}function vi(t){return t.props[E]}function xi({protectedKeys:t,needsAnimating:e},i){const n=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,n}function Ti(t,e,{delay:i=0,transitionOverride:n,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;n&&(o=n);const l=[],u=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||u&&xi(u,e))continue;const r={delay:i,...si(o||{},e)},c=n.get();if(void 0!==c&&!n.isAnimating&&!Array.isArray(s)&&s===c&&!r.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){const i=vi(t);if(i){const t=window.MotionHandoffAnimation(i,e,h);null!==t&&(r.startTime=t,d=!0)}}gi(t,e),n.start(ci(e,n,s,t.shouldReduceMotion&&di.has(e)?{type:!1}:r,t,d));const m=n.animation;m&&l.push(m)}return r&&Promise.all(l).then(()=>{h.update(()=>{r&&function(t,e){const i=mi(t,e);let{transitionEnd:n={},transition:s={},...o}=i||{};o={...o,...n};for(const e in o)fi(t,e,yi(o[e]))}(t,r)})}),l}function Pi(t,e,i={}){const n=mi(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(Ti(t,n,i)):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=s;return function(t,e,i=0,n=0,s=0,o=1,r){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(Pi(l,e,{...r,delay:i+("function"==typeof n?0:n)+ui(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 wi(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||A(t))}const Si=new Set(["auto","none","0"]);class Ei extends y{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(),o(n))){const s=ni(n,e.current);void 0!==s&&(t[i]=s),i===t.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!di.has(i)||2!==t.length)return;const[n,s]=t,r=b(n),a=b(s);if(M(n)!==M(s)&&k[i])this.needsMeasurement=!0;else if(r!==a)if(V(r)&&V(a))for(let e=0;e<t.length;e++){const i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else k[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)(null===t[e]||wi(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&&!Si.has(e)&&l(e).values.length&&(n=t[s]),s++}if(n&&i)for(const s of e)t[s]=D(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=k[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]=k[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()}}const Ai={x:!1,y:!1};function Di(){return Ai.x||Ai.y}function bi(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 Mi(t){return!("touch"===t.pointerType||Di())}const ki=(t,e)=>!!e&&(t===e||ki(t,e.parentElement)),Vi=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Ci=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Li(t){return Ci.has(t.tagName)||!0===t.isContentEditable}const Ri=new WeakSet;function ji(t){return e=>{"Enter"===e.key&&t(e)}}function Bi(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Oi(t){return Vi(t)&&!Di()}function Fi(t,e,i={}){const[n,s,o]=bi(t,i),r=t=>{const n=t.currentTarget;if(!Oi(t))return;Ri.add(n);const o=e(n,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Ri.has(n)&&Ri.delete(n),Oi(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,n===window||n===document||i.useGlobalTarget||ki(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),vt(e=t)&&"offsetHeight"in e&&(t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const n=ji(()=>{if(Ri.has(i))return;Bi(i,"down");const t=ji(()=>{Bi(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>Bi(i,"cancel"),e)});i.addEventListener("keydown",n,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",n),e)})(t,s)),Li(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}function Ii(t){return vt(t)&&"ownerSVGElement"in t}class Ui{constructor(t){this.isMounted=!1,this.node=t}update(){}}class $i extends C{constructor(){super(...arguments),this.KeyframeResolver=Ei}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const i=t.style;return i?i[e]:void 0}removeValueFromRenderState(t,{vars:e,style:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;S(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function Ni({top:t,left:e,right:i,bottom:n}){return{x:{min:e,max:i},y:{min:t,max:n}}}function Wi(t){return void 0===t||1===t}function zi({scale:t,scaleX:e,scaleY:i}){return!Wi(t)||!Wi(e)||!Wi(i)}function Ki(t){return zi(t)||Gi(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Gi(t){return Hi(t.x)||Hi(t.y)}function Hi(t){return t&&"0%"!==t}function Yi(t,e,i){return i+e*(t-i)}function Xi(t,e,i,n,s){return void 0!==s&&(t=Yi(t,s,n)),Yi(t,i,n)+e}function qi(t,e=0,i=1,n,s){t.min=Xi(t.min,e,i,n,s),t.max=Xi(t.max,e,i,n,s)}function _i(t,{x:e,y:i}){qi(t.x,e.translate,e.scale,e.originPoint),qi(t.y,i.translate,i.scale,i.originPoint)}const Zi=.999999999999,Ji=1.0000000000001;function Qi(t,e){t.min=t.min+e,t.max=t.max+e}function tn(t,i,n,s,o=.5){qi(t,i,n,e(t.min,t.max,o),s)}function en(t,e){tn(t.x,e.x,e.scaleX,e.scale,e.originX),tn(t.y,e.y,e.scaleY,e.scale,e.originY)}function nn(t,e){return Ni(function(t,e){if(!e)return t;const i=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:n.y,right:n.x}}(t.getBoundingClientRect(),e))}function sn(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 on extends $i{constructor(){super(...arguments),this.type="html",this.renderInstance=sn}readValueFromInstance(t,e){if(x.has(e))return this.projection?.isProjecting?L(e):R(t,e);{const n=(i=t,window.getComputedStyle(i)),s=(j(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof s?s.trim():s}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return nn(t,e)}build(t,e,i){B(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return O(t,e,i)}}const rn=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 an extends $i{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=I}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(x.has(e)){const t=W(e);return t&&t.default||0}return e=rn.has(e)?e:F(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return U(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){sn(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(rn.has(i)?i:F(i),e.attrs[i])}(t,e,0,n)}mount(t){this.isSVGTag=N(t.tagName),super.mount(t)}}const ln=K.length;function hn(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&hn(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let i=0;i<ln;i++){const n=K[i],s=t.props[n];(z(s)||!1===s)&&(e[n]=s)}return e}function un(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 cn=[...H].reverse(),dn=H.length;function mn(t){return e=>Promise.all(e.map(({animation:e,options:i})=>function(t,e,i={}){let n;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>Pi(t,e,i));n=Promise.all(s)}else if("string"==typeof e)n=Pi(t,e,i);else{const s="function"==typeof e?mi(t,e,i.custom):e;n=Promise.all(Ti(t,s,i))}return n.then(()=>{t.notify("AnimationComplete",e)})}(t,e,i)))}function pn(t){let e=mn(t),i=gn(),n=!0;const s=e=>(i,n)=>{const s=mi(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=hn(t.parent)||{},l=[],h=new Set;let u={},c=1/0;for(let e=0;e<dn;e++){const d=cn[e],m=i[d],p=void 0!==r[d]?r[d]:a[d],f=z(p),y=d===o?m.isActive:null;!1===y&&(c=e);let g=p===a[d]&&p!==r[d]&&f;if(g&&n&&t.manuallyAnimateOnMount&&(g=!1),m.protectedKeys={...u},!m.isActive&&null===y||!p&&!m.prevProp||G(p)||"boolean"==typeof p)continue;const v=fn(m.prevProp,p);let x=v||d===o&&m.isActive&&!g&&f||e>c&&f,T=!1;const P=Array.isArray(p)?p:[p];let w=P.reduce(s(d),{});!1===y&&(w={});const{prevResolvedValues:S={}}=m,E={...S,...w},A=e=>{x=!0,h.has(e)&&(T=!0,h.delete(e)),m.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in E){const e=w[t],i=S[t];if(u.hasOwnProperty(t))continue;let n=!1;n=pi(e)&&pi(i)?!un(e,i):e!==i,n?null!=e?A(t):h.add(t):void 0!==e&&h.has(t)?A(t):m.protectedKeys[t]=!0}m.prevProp=p,m.prevResolvedValues=w,m.isActive&&(u={...u,...w}),n&&t.blockInitialAnimation&&(x=!1);const D=g&&v;x&&(!D||T)&&l.push(...P.map(e=>{const i={type:d};if("string"==typeof e&&n&&!D&&t.manuallyAnimateOnMount&&t.parent){const{parent:n}=t,s=mi(n,e);if(n.enteringChildren&&s){const{delayChildren:e}=s.transition||{};i.delay=ui(n.enteringChildren,t,e)}}return{animation:e,options:i}}))}if(h.size){const e={};if("boolean"!=typeof r.initial){const i=mi(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=gn()}}}function fn(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!un(e,t)}function yn(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function gn(){return{animate:yn(!0),whileInView:yn(),whileHover:yn(),whileTap:yn(),whileDrag:yn(),whileFocus:yn(),exit:yn()}}function vn(t){return t.max-t.min}function xn(t,i,n,s=.5){t.origin=s,t.originPoint=e(i.min,i.max,t.origin),t.scale=vn(n)/vn(i),t.translate=e(n.min,n.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function Tn(t,e,i,n){xn(t.x,e.x,i.x,n?n.originX:void 0),xn(t.y,e.y,i.y,n?n.originY:void 0)}function Pn(t,e,i){t.min=i.min+e.min,t.max=t.min+vn(e)}function wn(t,e,i){t.min=e.min-i.min,t.max=t.min+vn(e)}function Sn(t,e,i){wn(t.x,e.x,i.x),wn(t.y,e.y,i.y)}function En(t,e,i,n,s){return t=Yi(t-=e,1/i,n),void 0!==s&&(t=Yi(t,1/s,n)),t}function An(t,i,[n,s,o],r,a){!function(t,i=0,n=1,s=.5,o,r=t,a=t){Y.test(i)&&(i=parseFloat(i),i=e(a.min,a.max,i/100)-a.min);if("number"!=typeof i)return;let l=e(r.min,r.max,s);t===r&&(l-=i),t.min=En(t.min,i,n,l,o),t.max=En(t.max,i,n,l,o)}(t,i[n],i[s],i[o],i.scale,r,a)}const Dn=["x","scaleX","originX"],bn=["y","scaleY","originY"];function Mn(t,e,i,n){An(t.x,e,Dn,i?i.x:void 0,n?n.x:void 0),An(t.y,e,bn,i?i.y:void 0,n?n.y:void 0)}function kn(t,e){t.min=e.min,t.max=e.max}function Vn(t,e){kn(t.x,e.x),kn(t.y,e.y)}function Cn(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Ln(t){return 0===t.translate&&1===t.scale}function Rn(t){return Ln(t.x)&&Ln(t.y)}function jn(t,e){return t.min===e.min&&t.max===e.max}function Bn(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function On(t,e){return Bn(t.x,e.x)&&Bn(t.y,e.y)}function Fn(t){return vn(t.x)/vn(t.y)}function In(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function Un(t){return[t("x"),t("y")]}const $n=["TopLeft","TopRight","BottomLeft","BottomRight"],Nn=$n.length,Wn=t=>"string"==typeof t?parseFloat(t):t,zn=t=>"number"==typeof t||X.test(t);function Kn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Gn=Yn(0,.5,jt),Hn=Yn(.5,.95,t);function Yn(t,e,i){return n=>n<t?0:n>e?1:i(wt(t,e,n))}function Xn(t,e,i,n={passive:!0}){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i)}const qn=(t,e)=>t.depth-e.depth;class _n{constructor(){this.children=[],this.isDirty=!1}add(t){q(this.children,t),this.isDirty=!0}remove(t){_(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(qn),this.isDirty=!1,this.children.forEach(t)}}class Zn{constructor(){this.members=[]}add(t){q(this.members,t),t.scheduleRender()}remove(t){if(_(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 Jn={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Qn=["","X","Y","Z"];let ts=0;function es(t,e,i,n){const{latestValues:s}=e;s[t]&&(i[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function is(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const i=vi(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",h,!(e||n))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&is(n)}function ns({attachResizeListener:t,defaultParent:i,measureScroll:n,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(t={},e=i?.()){this.id=ts++,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(rs),this.nodes.forEach(ms),this.nodes.forEach(ps),this.nodes.forEach(as)},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 _n)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Z),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const i=this.eventHandlers.get(t);i&&i.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e){if(this.instance)return;var i;this.isSVG=Ii(e)&&!(Ii(i=e)&&"svg"===i.tagName),this.instance=e;const{layoutId:n,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||n)&&(this.isLayoutDirty=!0),t){let i,n=0;const s=()=>this.root.updateBlockedByResize=!1;h.read(()=>{n=window.innerWidth}),t(e,()=>{const t=window.innerWidth;t!==n&&(n=t,this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=d.now(),n=({timestamp:s})=>{const o=s-i;o>=e&&(u(n),t(o-e))};return h.setup(n,!0),()=>u(n)}(s,250),Jn.hasAnimatedSinceResize&&(Jn.hasAnimatedSinceResize=!1,this.nodes.forEach(ds)))})}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()||Ts,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!On(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={...si(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||ds(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(),u(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(fs),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&&is(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(hs);if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(us);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(cs),this.nodes.forEach(ss),this.nodes.forEach(os)):this.nodes.forEach(us),this.clearAllSnapshots();const t=d.now();c.delta=p(0,1e3/60,t-c.timestamp),c.timestamp=t,c.isProcessing=!0,J.update.process(c),J.preRender.process(c),J.render.process(c),c.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Q.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ls),this.sharedNodes.forEach(ys)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,h.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){h.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||vn(this.snapshot.measuredBox.x)||vn(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=I(),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&&!Rn(this.projectionDelta),i=this.getTransformTemplate(),n=i?i(this.latestValues,""):void 0,s=n!==this.prevTransformTemplateValue;t&&this.instance&&(e||Ki(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)),Ss((n=i).x),Ss(n.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return I();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(As))){const{scroll:t}=this.root;t&&(Qi(e.x,t.offset.x),Qi(e.y,t.offset.y))}return e}removeElementScroll(t){const e=I();if(Vn(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&&Vn(e,t),Qi(e.x,s.offset.x),Qi(e.y,s.offset.y))}return e}applyTransform(t,e=!1){const i=I();Vn(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&&en(i,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),Ki(n.latestValues)&&en(i,n.latestValues)}return Ki(this.latestValues)&&en(i,this.latestValues),i}removeTransform(t){const e=I();Vn(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!i.instance)continue;if(!Ki(i.latestValues))continue;zi(i.latestValues)&&i.updateSnapshot();const n=I();Vn(n,i.measurePageBox()),Mn(e,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,n)}return Ki(this.latestValues)&&Mn(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!==c.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=c.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=I(),this.targetWithTransforms=I()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),r=this.target,a=this.relativeTarget,l=this.relativeParent.target,Pn(r.x,a.x,l.x),Pn(r.y,a.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Vn(this.target,this.layout.layoutBox),_i(this.target,this.targetDelta)):Vn(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&&!zi(this.parent.latestValues)&&!Gi(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=I(),this.relativeTargetOrigin=I(),Sn(this.relativeTargetOrigin,e,i),Vn(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===c.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;Vn(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&&en(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,_i(t,r)),n&&Ki(o.latestValues)&&en(t,o.latestValues))}e.x<Ji&&e.x>Zi&&(e.x=1),e.y<Ji&&e.y>Zi&&(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=I());const{target:a}=t;a?(this.projectionDelta&&this.prevProjectionDelta?(Cn(this.prevProjectionDelta.x,this.projectionDelta.x),Cn(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Tn(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.treeScale.x===o&&this.treeScale.y===r&&In(this.projectionDelta.x,this.prevProjectionDelta.x)&&In(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=tt(),this.projectionDelta=tt(),this.projectionDeltaWithTransform=tt()}setAnimationOrigin(t,i=!1){const n=this.snapshot,s=n?n.latestValues:{},o={...this.latestValues},r=tt();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!i;const a=I(),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(xs));let d;this.animationProgress=0,this.mixTargetDelta=i=>{const n=i/1e3;var h,m,p,f,y,g;gs(r.x,t.x,n),gs(r.y,t.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Sn(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,f=this.relativeTargetOrigin,y=a,g=n,vs(p.x,f.x,y.x,g),vs(p.y,f.y,y.y,g),d&&(h=this.relativeTarget,m=d,jn(h.x,m.x)&&jn(h.y,m.y))&&(this.isProjectionDirty=!1),d||(d=I()),Vn(d,this.relativeTarget)),l&&(this.animationValues=o,function(t,i,n,s,o,r){o?(t.opacity=e(0,n.opacity??1,Gn(s)),t.opacityExit=e(i.opacity??1,0,Hn(s))):r&&(t.opacity=e(i.opacity??1,n.opacity??1,s));for(let o=0;o<Nn;o++){const r=`border${$n[o]}Radius`;let a=Kn(i,r),l=Kn(n,r);void 0===a&&void 0===l||(a||(a=0),l||(l=0),0===a||0===l||zn(a)===zn(l)?(t[r]=Math.max(e(Wn(a),Wn(l),s),0),(Y.test(l)||Y.test(a))&&(t[r]+="%")):t[r]=l)}(i.rotate||n.rotate)&&(t.rotate=e(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&&(u(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=h.update(()=>{Jn.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=w(0)),this.currentAnimation=function(t,e,i){const n=S(t)?t:w(t);return n.start(ci("",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&&Es(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||I();const e=vn(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const n=vn(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+n}Vn(e,i),en(e,s),Tn(this.projectionDeltaWithTransform,this.layoutCorrected,e,s)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Zn);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&&es("z",t,n,this.animationValues);for(let e=0;e<Qn.length;e++)es(`rotate${Qn[e]}`,t,n,this.animationValues),es(`skew${Qn[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=et(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=et(e?.pointerEvents)||""),void(this.hasProjected&&!Ki(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 it){if(void 0===s[e])continue;const{correct:i,applyTo:r,isCSSVariable:a}=it[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?et(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(t=>t.currentAnimation?.stop()),this.root.nodes.forEach(hs),this.root.sharedNodes.clear()}}}function ss(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?Un(t=>{const n=o?e.measuredBox[t]:e.layoutBox[t],s=vn(n);n.min=i[t].min,n.max=n.min+s}):Es(s,e.layoutBox,i)&&Un(n=>{const s=o?e.measuredBox[n]:e.layoutBox[n],r=vn(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=tt();Tn(r,i,e.layoutBox);const a=tt();o?Tn(a,t.applyTransform(n,!0),e.measuredBox):Tn(a,i,e.layoutBox);const l=!Rn(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=I();Sn(r,e.layoutBox,s.layoutBox);const a=I();Sn(a,i,o.layoutBox),On(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 rs(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 as(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function ls(t){t.clearSnapshot()}function hs(t){t.clearMeasurements()}function us(t){t.isLayoutDirty=!1}function cs(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function ds(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ms(t){t.resolveTargetDelta()}function ps(t){t.calcProjection()}function fs(t){t.resetSkewAndRotation()}function ys(t){t.removeLeadSnapshot()}function gs(t,i,n){t.translate=e(i.translate,0,n),t.scale=e(i.scale,1,n),t.origin=i.origin,t.originPoint=i.originPoint}function vs(t,i,n,s){t.min=e(i.min,n.min,s),t.max=e(i.max,n.max,s)}function xs(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const Ts={duration:.45,ease:[.4,0,.1,1]},Ps=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),ws=Ps("applewebkit/")&&!Ps("chrome/")?Math.round:t;function Ss(t){t.min=ws(t.min),t.max=ws(t.max)}function Es(t,e,i){return"position"===t||"preserve-aspect"===t&&(n=Fn(e),s=Fn(i),o=.2,!(Math.abs(n-s)<=o));var n,s,o}function As(t){return t!==t.root&&t.scroll?.wasRoot}const Ds=ns({attachResizeListener:(t,e)=>Xn(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),bs={current:void 0},Ms=ns({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!bs.current){const t=new Ds({});t.mount(window),t.setOptions({layoutScroll:!0}),bs.current=t}return bs.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)});function ks(t){return{point:{x:t.pageX,y:t.pageY}}}function Vs(t,e,i,n){return Xn(t,e,(t=>e=>Vi(e)&&t(e,ks(e)))(i),n)}const Cs=({current:t})=>t?t.ownerDocument.defaultView:null,Ls=(t,e)=>Math.abs(t-e);const Rs=new Set(["auto","scroll"]);class js{constructor(t,e,{transformPagePoint:i,contextWindow:n=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3,element:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=t=>{this.handleScroll(t.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=Fs(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,i=function(t,e){const i=Ls(t.x,e.x),n=Ls(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}=c;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=Bs(e,this.transformPagePoint),h.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:i,onSessionEnd:n,resumeAnimation:s}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Fs("pointercancel"===t.type?this.lastMoveEventInfo:Bs(e,this.transformPagePoint),this.history);this.startEvent&&i&&i(t,o),n&&n(t,o)},!Vi(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=n||window;const a=Bs(ks(t),this.transformPagePoint),{point:l}=a,{timestamp:u}=c;this.history=[{...l,timestamp:u}];const{onSessionStart:d}=e;d&&d(t,Fs(a,this.history)),this.removeListeners=Pt(Vs(this.contextWindow,"pointermove",this.handlePointerMove),Vs(this.contextWindow,"pointerup",this.handlePointerUp),Vs(this.contextWindow,"pointercancel",this.handlePointerUp)),r&&this.startScrollTracking(r)}startScrollTracking(t){let e=t.parentElement;for(;e;){const t=getComputedStyle(e);(Rs.has(t.overflowX)||Rs.has(t.overflowY))&&this.scrollPositions.set(e,{x:e.scrollLeft,y:e.scrollTop}),e=e.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const e=this.scrollPositions.get(t);if(!e)return;const i=t===window,n=i?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s=n.x-e.x,o=n.y-e.y;0===s&&0===o||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=s,this.history[0].y-=o),this.scrollPositions.set(t,n),h.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),u(this.updatePoint)}}function Bs(t,e){return e?{point:e(t.point)}:t}function Os(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Fs({point:t},e){return{point:t,delta:Os(t,Us(e)),offset:Os(t,Is(e)),velocity:$s(e,.1)}}function Is(t){return t[0]}function Us(t){return t[t.length-1]}function $s(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,n=null;const s=Us(t);for(;i>=0&&(n=t[i],!(s.timestamp-n.timestamp>St(e)));)i--;if(!n)return{x:0,y:0};const o=Et(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 Ns(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 Ws(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 zs=.35;function Ks(t,e,i){return{min:Gs(t,e),max:Gs(t,i)}}function Gs(t,e){return"number"==typeof t?t:t[e]||0}const Hs=new WeakMap;class Ys{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=I(),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 js(t,{onSessionStart:t=>{e?(this.stopAnimation(),this.snapToCursor(ks(t).point)):this.pauseAnimation()},onStart:(t,e)=>{this.stopAnimation();const{drag:i,dragPropagation:n,onDragStart:s}=this.getProps();if(i&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=i)||"y"===o?Ai[o]?null:(Ai[o]=!0,()=>{Ai[o]=!1}):Ai.x||Ai.y?null:(Ai.x=Ai.y=!0,()=>{Ai.x=Ai.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),Un(t=>{let e=this.getAxisMotionValue(t).get()||0;if(Y.test(e)){const{projection:i}=this.visualElement;if(i&&i.layout){const n=i.layout.layoutBox[t];if(n){e=vn(n)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),s&&h.postRender(()=>s(t,e)),gi(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:()=>Un(t=>"paused"===this.getAnimationState(t)&&this.getAxisMotionValue(t).animation?.play())},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,distanceThreshold:i,contextWindow:Cs(this.visualElement),element:this.visualElement.current})}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&&h.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(t,i,n){const{drag:s}=this.getProps();if(!n||!Xs(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let r=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(r=function(t,{min:i,max:n},s){return void 0!==i&&t<i?t=s?e(i,t,s.min):Math.max(t,i):void 0!==n&&t>n&&(t=s?e(n,t,s.max):Math.min(t,n)),t}(r,this.constraints[t],this.elastic[t])),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&&nt(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i)&&function(t,{top:e,left:i,bottom:n,right:s}){return{x:Ns(t.x,i,s),y:Ns(t.y,e,n)}}(i.layoutBox,t),this.elastic=function(t=zs){return!1===t?t=0:!0===t&&(t=zs),{x:Ks(t,"left","right"),y:Ks(t,"top","bottom")}}(e),n!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Un(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||!nt(t))return!1;const i=t.current;gt(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=nn(t,i),{scroll:s}=e;return s&&(Qi(n.x,s.offset.x),Qi(n.y,s.offset.y)),n}(i,n.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Ws(t.x,e.x),y:Ws(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=Ni(t))}return o}startAnimation(t){const{drag:e,dragMomentum:i,dragElastic:n,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=Un(r=>{if(!Xs(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 gi(this.visualElement,t),i.start(ci(t,i,0,e,this.visualElement,!1))}stopAnimation(){Un(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Un(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(t){Un(i=>{const{drag:n}=this.getProps();if(!Xs(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(t[i]-e(n,r,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:i}=this.getProps(),{projection:n}=this.visualElement;if(!nt(i)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Un(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=vn(t),s=vn(e);return s>n?i=wt(e.min,e.max-n,t.min):n>s&&(i=wt(t.min,t.max-s,e.min)),p(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(),Un(i=>{if(!Xs(i,t,null))return;const n=this.getAxisMotionValue(i),{min:o,max:r}=this.constraints[i];n.set(e(o,r,s[i]))})}addListeners(){if(!this.visualElement.current)return;Hs.set(this.visualElement,this);const t=Vs(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:i=!0}=this.getProps();e&&i&&!Li(t.target)&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();nt(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()),h.read(e);const s=Xn(window,"resize",()=>this.scalePositionWithinConstraints()),o=i.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(Un(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=zs,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:i,dragPropagation:n,dragConstraints:s,dragElastic:o,dragMomentum:r}}}function Xs(t,e,i){return!(!0!==e&&e!==t||null!==i&&i!==t)}const qs=t=>(e,i)=>{t&&h.postRender(()=>t(e,i))};let _s=!1;class Zs extends mt{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),_s&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Jn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:i,drag:n,isPresent:s}=this.props,{projection:o}=i;return o?(o.isPresent=s,_s=!0,n||t.layoutDependency!==e||void 0===e||t.isPresent!==s?o.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?o.promote():o.relegate()||h.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Q.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:n}=t;_s=!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 Js(t){const[e,i]=function(t=!0){const e=ht(st);if(null===e)return[!0,null];const{isPresent:i,onExitComplete:n,register:s}=e,o=ut();ct(()=>{if(t)return s(o)},[t]);const r=dt(()=>t&&n&&n(o),[o,n,t]);return!i&&n?[!1,r]:[!0]}(),n=ht(ot);return lt(Zs,{...t,layoutGroup:n,switchLayoutGroup:ht(rt),isPresent:e,safeToRemove:i})}const Qs={pan:{Feature:class extends Ui{constructor(){super(...arguments),this.removePointerDownListener=t}onPointerDown(t){this.session=new js(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Cs(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:i,onPanEnd:n}=this.node.getProps();return{onSessionStart:qs(t),onStart:qs(e),onMove:i,onEnd:(t,e)=>{delete this.session,n&&h.postRender(()=>n(t,e))}}}mount(){this.removePointerDownListener=Vs(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 Ui{constructor(e){super(e),this.removeGroupControls=t,this.removeListeners=t,this.controls=new Ys(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||t}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:Ms,MeasureLayout:Js}},to={layout:{ProjectionNode:Ms,MeasureLayout:Js}};let eo=0;const io={animation:{Feature:class extends Ui{constructor(t){super(t),t.animationState||(t.animationState=pn(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();G(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 Ui{constructor(){super(...arguments),this.id=eo++}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 no(t,e,i){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover","Start"===i);const s=n["onHover"+i];s&&h.postRender(()=>s(e,ks(e)))}function so(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&&h.postRender(()=>s(e,ks(e)))}const oo=new WeakMap,ro=new WeakMap,ao=t=>{const e=oo.get(t.target);e&&e(t)},lo=t=>{t.forEach(ao)};function ho(t,e,i){const n=function({root:t,...e}){const i=t||document;ro.has(i)||ro.set(i,{});const n=ro.get(i),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(lo,{root:t,...e})),n[s]}(e);return oo.set(t,i),n.observe(t),()=>{oo.delete(t),n.unobserve(t)}}const uo={some:0,all:1};const co={renderer:(t,e)=>e.isSVG??at(t)?new an(e):new on(e,{allowProjection:t!==pt}),...io,...{inView:{Feature:class extends Ui{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:uo[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 Ui{mount(){const{current:t}=this.node;t&&(this.unmount=Fi(t,(t,e)=>(so(this.node,e,"Start"),(t,{success:e})=>so(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends Ui{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=Pt(Xn(this.node.current,"focus",()=>this.onFocus()),Xn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Ui{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){const[n,s,o]=bi(t,i),r=t=>{if(!Mi(t))return;const{target:i}=t,n=e(i,t);if("function"!=typeof n||!i)return;const o=t=>{Mi(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)=>(no(this.node,e,"Start"),t=>no(this.node,t,"End"))))}unmount(){}}}}},mo={...co,...Qs,...to};export{mo as domMax};