import{T as te,U as Pt,V as We,W as ne,Y as _e,Z as Ue,$ as kt,a0 as ve,a1 as Ve,a2 as je,a3 as ue,a4 as Me,a5 as K,a6 as It,a7 as H,a8 as L,a9 as U,aa as Ft,ab as E,ac as Ot,ad as j,ae as qe,af as be,ag as Rt,ah as Et,ai as Kt,aj as Lt,ak as Bt,al as ze,am as Gt,an as Nt,ao as Te,ap as Ht,aq as Wt,ar as _t,as as $e,at as Ut,au as jt,av as qt,aw as Ce,ax as De,ay as X,az as Pe,aA as zt,aB as $t,aC as Xt,aD as Yt,aE as Zt,aF as Jt,aG as Xe,aH as Qt,aI as en,aJ as tn,aK as nn,aL as sn,aM as Ye,aN as Ze,aO as Je,aP as Qe,aQ as rn,r as on}from"./index-Cy3rzI-d.js";import{i as an}from"./is-html-element-DvmxM0K5.js";const cn=(t,e)=>n=>e(t(n)),se=(...t)=>t.reduce(cn),et=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s},tt=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,ln=1e-7,un=12;function fn(t,e,n,s,i){let r,o,c=0;do o=e+(n-e)/2,r=tt(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>ln&&++cfn(r,0,1,t,n);return r=>r===0||r===1?r:tt(i(r),e,s)}const nt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,st=t=>e=>1-t(1-e),it=$(.33,1.53,.69,.99),xe=st(it),rt=nt(xe),ot=t=>t>=1?1:(t*=2)<1?.5*xe(t):.5*(2-Math.pow(2,-10*(t-1))),Ae=t=>1-Math.sin(Math.acos(t)),dn=st(Ae),at=nt(Ae),hn=$(.42,0,1,1),mn=$(0,0,.58,1),ct=$(.42,0,.58,1),pn=t=>Array.isArray(t)&&typeof t[0]!="number",gn={linear:te,easeIn:hn,easeInOut:ct,easeOut:mn,circIn:Ae,circInOut:at,circOut:dn,backIn:xe,backInOut:rt,backOut:it,anticipate:ot},yn=t=>typeof t=="string",ke=t=>{if(Pt(t)){We(t.length===4);const[e,n,s,i]=t;return $(e,n,s,i)}else if(yn(t))return gn[t];return t};function ie(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function vn({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const c=n<.5?n*(1+e):n+e-n*e,u=2*n-c;i=ie(u,c,t+1/3),r=ie(u,c,t),o=ie(u,c,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}function Z(t,e){return n=>n>0?e:t}const re=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},bn=[kt,_e,Ue],Tn=t=>bn.find(e=>e.test(t));function Ie(t){const e=Tn(t);if(!e)return!1;let n=e.parse(t);return e===Ue&&(n=vn(n)),n}const Fe=(t,e)=>{const n=Ie(t),s=Ie(e);if(!n||!s)return Z(t,e);const i={...n};return r=>(i.red=re(n.red,s.red,r),i.green=re(n.green,s.green,r),i.blue=re(n.blue,s.blue,r),i.alpha=ne(n.alpha,s.alpha,r),_e.transform(i))},fe=new Set(["none","hidden"]);function xn(t,e){return fe.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function An(t,e){return n=>ne(t,e,n)}function we(t){return typeof t=="number"?An:typeof t=="string"?ve(t)?Z:Ve.test(t)?Fe:Vn:Array.isArray(t)?lt:typeof t=="object"?Ve.test(t)?Fe:wn:Z}function lt(t,e){const n=[...t],s=n.length,i=t.map((r,o)=>we(r)(r,e[o]));return r=>{for(let o=0;o{for(const r in s)n[r]=s[r](i);return n}}function Sn(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i{const n=je.createTransformer(e),s=ue(t),i=ue(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?fe.has(t)&&!i.values.length||fe.has(e)&&!s.values.length?xn(t,e):se(lt(Sn(s,i),i.values),n):Z(t,e)};function ut(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ne(t,e,n):we(t)(t,e)}const Mn=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>H.update(e,n),stop:()=>It(e),now:()=>Me.isProcessing?Me.timestamp:K.now()}},J=2e4;function Se(t){let e=0;const n=50;let s=t.next(e);for(;!s.done&&e=J?1/0:e}function Cn(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(Se(s),J);return{type:"keyframes",ease:r=>s.next(i*r).value/e,duration:L(i)}}const S={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function de(t,e){return t*Math.sqrt(1-e*e)}const Dn=12;function Pn(t,e,n){let s=n;for(let i=1;i{const a=l*o,f=a*t,d=a-n,h=de(l,o),v=Math.exp(-f);return oe-d/h*v},r=l=>{const f=l*o*t,d=f*n+n,h=Math.pow(o,2)*Math.pow(l,2)*t,v=Math.exp(-f),g=de(Math.pow(l,2),o);return(-i(l)+oe>0?-1:1)*((d-h)*v)/g}):(i=l=>{const a=Math.exp(-l*t),f=(l-n)*t+1;return-oe+a*f},r=l=>{const a=Math.exp(-l*t),f=(n-l)*(t*t);return a*f});const c=5/t,u=Pn(i,r,c);if(t=E(t),isNaN(u))return{stiffness:S.stiffness,damping:S.damping,duration:t};{const l=Math.pow(u,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const In=["duration","bounce"],Fn=["stiffness","damping","mass"];function Oe(t,e){return e.some(n=>t[n]!==void 0)}function On(t){let e={velocity:S.velocity,stiffness:S.stiffness,damping:S.damping,mass:S.mass,isResolvedFromDuration:!1,...t};if(!Oe(t,Fn)&&Oe(t,In))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*U(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:S.mass,stiffness:i,damping:r}}else{const n=kn({...t,velocity:0});e={...e,...n,mass:S.mass},e.isResolvedFromDuration=!0}return e}function Q(t=S.visualDuration,e=S.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],c={done:!1,value:r},{stiffness:u,damping:l,mass:a,duration:f,velocity:d,isResolvedFromDuration:h}=On({...n,velocity:-L(n.velocity||0)}),v=d||0,g=l/(2*Math.sqrt(u*a)),m=o-r,p=L(Math.sqrt(u/a)),b=Math.abs(m)<5;s||(s=b?S.restSpeed.granular:S.restSpeed.default),i||(i=b?S.restDelta.granular:S.restDelta.default);let A,w,T,M,P,x;if(g<1)T=de(p,g),M=(v+g*p*m)/T,A=y=>{const V=Math.exp(-g*p*y);return o-V*(M*Math.sin(T*y)+m*Math.cos(T*y))},P=g*p*M+m*T,x=g*p*m-M*T,w=y=>Math.exp(-g*p*y)*(P*Math.sin(T*y)+x*Math.cos(T*y));else if(g===1){A=V=>o-Math.exp(-p*V)*(m+(v+p*m)*V);const y=v+p*m;w=V=>Math.exp(-p*V)*(p*y*V-v)}else{const y=p*Math.sqrt(g*g-1);A=F=>{const R=Math.exp(-g*p*F),O=Math.min(y*F,300);return o-R*((v+g*p*m)*Math.sinh(O)+y*m*Math.cosh(O))/y};const V=(v+g*p*m)/y,k=g*p*V-m*y,B=g*p*m-V*y;w=F=>{const R=Math.exp(-g*p*F),O=Math.min(y*F,300);return R*(k*Math.sinh(O)+B*Math.cosh(O))}}const C={calculatedDuration:h&&f||null,velocity:y=>E(w(y)),next:y=>{if(!h&&g<1){const k=Math.exp(-g*p*y),B=Math.sin(T*y),F=Math.cos(T*y),R=o-k*(M*B+m*F),O=E(k*(P*B+x*F));return c.done=Math.abs(O)<=s&&Math.abs(o-R)<=i,c.value=c.done?o:R,c}const V=A(y);if(h)c.done=y>=f;else{const k=E(w(y));c.done=Math.abs(k)<=s&&Math.abs(o-V)<=i}return c.value=c.done?o:V,c},toString:()=>{const y=Math.min(Se(C),J),V=Ft(k=>C.next(y*k).value,y,30);return y+"ms "+V},toTransition:()=>{}};return C}Q.applyToOptions=t=>{const e=Cn(t,100,Q);return t.ease=e.ease,t.duration=E(e.duration),t.type="keyframes",t};const Rn=5;function ft(t,e,n){const s=Math.max(e-Rn,0);return Ot(n-t(s),e-s)}function he({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:o,min:c,max:u,restDelta:l=.5,restSpeed:a}){const f=t[0],d={done:!1,value:f},h=x=>c!==void 0&&xu,v=x=>c===void 0?u:u===void 0||Math.abs(c-x)-g*Math.exp(-x/s),A=x=>p+b(x),w=x=>{const C=b(x),y=A(x);d.done=Math.abs(C)<=l,d.value=d.done?p:y};let T,M;const P=x=>{h(d.value)&&(T=x,M=Q({keyframes:[d.value,v(d.value)],velocity:ft(A,x,d.value),damping:i,stiffness:r,restDelta:l,restSpeed:a}))};return P(0),{calculatedDuration:null,next:x=>{let C=!1;return!M&&T===void 0&&(C=!0,w(x),P(x)),T!==void 0&&x>=T?M.next(x-T):(!C&&w(x),d)}}}function En(t,e,n){const s=[],i=n||j.mix||ut,r=t.length-1;for(let o=0;oe[0];if(r===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const c=En(e,s,i),u=c.length,l=a=>{if(o&&a1)for(;fl(U(t[0],t[r-1],a)):l}function Ln(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=et(0,e,s);t.push(ne(n,1,i))}}function Bn(t){const e=[0];return Ln(e,t.length-1),e}function Gn(t,e){return t.map(n=>n*e)}function Nn(t,e){return t.map(()=>e||ct).splice(0,t.length-1)}function z({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=pn(s)?s.map(ke):ke(s),r={done:!1,value:e[0]},o=Gn(n&&n.length===e.length?n:Bn(e),t),c=Kn(o,e,{ease:Array.isArray(i)?i:Nn(e,i)});return{calculatedDuration:t,next:u=>(r.value=c(u),r.done=u>=t,r)}}const Hn={decay:he,inertia:he,tween:z,keyframes:z,spring:Q};function dt(t){typeof t.type=="string"&&(t.type=Hn[t.type])}const Wn=t=>t/100;class ee extends qe{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var s,i;const{motionValue:n}=this.options;n&&n.updatedAt!==K.now()&&this.tick(K.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(s=this.options).onStop)==null||i.call(s))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;dt(e);const{type:n=z,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:o=0}=e;let{keyframes:c}=e;const u=n||z;u!==z&&typeof c[0]!="number"&&(this.mixKeyframes=se(Wn,ut(c[0],c[1])),c=[0,100]);const l=u({...e,keyframes:c});r==="mirror"&&(this.mirroredGenerator=u({...e,keyframes:[...c].reverse(),velocity:-o})),l.calculatedDuration===null&&(l.calculatedDuration=Se(l));const{calculatedDuration:a}=l;this.calculatedDuration=a,this.resolvedDuration=a+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=l}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:o,resolvedDuration:c,calculatedDuration:u}=this;if(this.startTime===null)return s.next(0);const{delay:l=0,keyframes:a,repeat:f,repeatType:d,repeatDelay:h,type:v,onUpdate:g,finalKeyframe:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const p=this.currentTime-l*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?p<0:p>i;this.currentTime=Math.max(p,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let A=this.currentTime,w=s;if(f){const x=Math.min(this.currentTime,i)/c;let C=Math.floor(x),y=x%1;!y&&x>=1&&(y=1),y===1&&C--,C=Math.min(C,f+1),!!(C%2)&&(d==="reverse"?(y=1-y,h&&(y-=h/c)):d==="mirror"&&(w=o)),A=U(0,1,y)*c}let T;b?(this.delayState.value=a[0],T=this.delayState):T=w.next(A),r&&!b&&(T.value=r(T.value));let{done:M}=T;!b&&u!==null&&(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const P=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return P&&v!==he&&(T.value=be(a,this.options,m,this.speed)),g&&g(T.value),P&&this.finish(),T}then(e,n){return this.finished.then(e,n)}get duration(){return L(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+L(e)}get time(){return L(this.currentTime)}set time(e){e=E(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return ft(s=>this.generator.next(s).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(K.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=L(this.currentTime))}play(){var i,r;if(this.isStopped)return;const{driver:e=Mn,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(r=(i=this.options).onPlay)==null||r.call(i);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(K.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}const ht={anticipate:ot,backInOut:rt,circInOut:at};function _n(t){return t in ht}function Un(t){typeof t.ease=="string"&&_n(t.ease)&&(t.ease=ht[t.ease])}const ae=10;class jn extends Rt{constructor(e){Un(e),dt(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const c=new ee({...o,autoplay:!1}),u=Math.max(ae,K.now()-this.startTime),l=U(0,ae,u-ae),a=c.sample(u).value,{name:f}=this.options;r&&f&&Et(r,f,a),n.setWithVelocity(c.sample(Math.max(0,u-l)).value,a,l),c.stop()}}const Re=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(je.test(t)||t==="0")&&!t.startsWith("url("));function qn(t){const e=t[0];if(t.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function Jn(t){var f;const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:o,keyframes:c}=t;if(!(((f=e==null?void 0:e.owner)==null?void 0:f.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:a}=e.owner.getProps();return Zn()&&n&&(Lt.has(n)||Yn.has(n)&&Xn(c))&&(n!=="transform"||!a)&&!l&&!s&&i!=="mirror"&&r!==0&&o!=="inertia"}const Qn=40;class es extends qe{constructor({autoplay:e=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:o="loop",keyframes:c,name:u,motionValue:l,element:a,...f}){var v;super(),this.stop=()=>{var g,m;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(m=this.keyframeResolver)==null||m.cancel()},this.createdAt=K.now();const d={autoplay:e,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:o,name:u,motionValue:l,element:a,...f},h=(a==null?void 0:a.KeyframeResolver)||ze;this.keyframeResolver=new h(c,(g,m,p)=>this.onKeyframesResolved(g,m,d,!p),u,l,a),(v=this.keyframeResolver)==null||v.scheduleResolve()}onKeyframesResolved(e,n,s,i){var p,b;this.keyframeResolver=void 0;const{name:r,type:o,velocity:c,delay:u,isHandoff:l,onUpdate:a}=s;this.resolvedAt=K.now();let f=!0;zn(e,r,o,c)||(f=!1,(j.instantAnimations||!u)&&(a==null||a(be(e,s,n))),e[0]=e[e.length-1],me(s),s.repeat=0);const h={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>Qn?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:e},v=f&&!l&&Jn(h),g=(b=(p=h.motionValue)==null?void 0:p.owner)==null?void 0:b.current;let m;if(v)try{m=new jn({...h,element:g})}catch{m=new ee(h)}else m=new ee(h);m.finished.then(()=>{this.notifyFinished()}).catch(te),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(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Gt()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function mt(t,e,n,s=0,i=1){const r=Array.from(t).sort((l,a)=>l.sortNodePosition(a)).indexOf(e),o=t.size,c=(o-1)*s;return typeof n=="function"?n(r,o):i===1?r*s:c-r*s}const ts=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ns(t){const e=ts.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}function pt(t,e,n=1){const[s,i]=ns(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const o=r.trim();return Nt(o)?parseFloat(o):o}return ve(i)?pt(i,e,n+1):i}const ss={type:"spring",stiffness:500,damping:25,restSpeed:10},is=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),rs={type:"keyframes",duration:.8},os={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},as=(t,{keyframes:e})=>e.length>2?rs:Te.has(t)?t.startsWith("scale")?is(e[1]):ss:os;function gt(t,e){if(t!=null&&t.inherit&&e){const{inherit:n,...s}=t;return{...e,...s}}return t}function yt(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?gt(n,t):n}const cs=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function ls(t){for(const e in t)if(!cs.has(e))return!0;return!1}const us=(t,e,n,s={},i,r)=>o=>{const c=yt(s,t)||{},u=c.delay||s.delay||0;let{elapsed:l=0}=s;l=l-E(u);const a={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...c,delay:-l,onUpdate:d=>{e.set(d),c.onUpdate&&c.onUpdate(d)},onComplete:()=>{o(),c.onComplete&&c.onComplete()},name:t,motionValue:e,element:r?void 0:i};ls(c)||Object.assign(a,as(t,a)),a.duration&&(a.duration=E(a.duration)),a.repeatDelay&&(a.repeatDelay=E(a.repeatDelay)),a.from!==void 0&&(a.keyframes[0]=a.from);let f=!1;if((a.type===!1||a.duration===0&&!a.repeatDelay)&&(me(a),a.delay===0&&(f=!0)),(j.instantAnimations||j.skipAnimations||i!=null&&i.shouldSkipAnimations)&&(f=!0,me(a),a.delay=0),a.allowFlatten=!c.type&&!c.ease,f&&!r&&e.get()!==void 0){const d=be(a.keyframes,c);if(d!==void 0){H.update(()=>{a.onUpdate(d),a.onComplete()});return}}return c.isSync?new ee(a):new es(a)};function W(t,e,n){const s=t.getProps();return Ht(s,e,n!==void 0?n:s.custom,t)}const vt=new Set(["width","height","top","left","right","bottom",...Wt]),pe=t=>Array.isArray(t);function fs(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,_t(n))}function ds(t){return pe(t)?t[t.length-1]||0:t}function hs(t,e){const n=W(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const o in r){const c=ds(r[o]);fs(t,o,c)}}function ms(t){return!!($e(t)&&t.add)}function ps(t,e){const n=t.getValue("willChange");if(ms(n))return n.add(e);if(!n&&j.WillChange){const s=new j.WillChange("auto");t.addValue("willChange",s),s.add(e)}}function gs(t){return t.props[Ut]}function ys({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}function bt(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r,transitionEnd:o,...c}=e;const u=t.getDefaultTransition();r=r?gt(r,u):u;const l=r==null?void 0:r.reduceMotion;s&&(r=s);const a=[],f=i&&t.animationState&&t.animationState.getState()[i];for(const d in c){const h=t.getValue(d,t.latestValues[d]??null),v=c[d];if(v===void 0||f&&ys(f,d))continue;const g={delay:n,...yt(r||{},d)},m=h.get();if(m!==void 0&&!h.isAnimating()&&!Array.isArray(v)&&v===m&&!g.velocity){H.update(()=>h.set(v));continue}let p=!1;if(window.MotionHandoffAnimation){const w=gs(t);if(w){const T=window.MotionHandoffAnimation(w,d,H);T!==null&&(g.startTime=T,p=!0)}}ps(t,d);const b=l??t.shouldReduceMotion;h.start(us(d,h,v,b&&vt.has(d)?{type:!1}:g,t,p));const A=h.animation;A&&a.push(A)}if(o){const d=()=>H.update(()=>{o&&hs(t,o)});a.length?Promise.all(a).then(d):d()}return a}function ge(t,e,n={}){var u;const s=W(t,e,n.type==="exit"?(u=t.presenceContext)==null?void 0:u.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Promise.all(bt(t,s,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:a=0,staggerChildren:f,staggerDirection:d}=i;return vs(t,e,l,a,f,d,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[l,a]=c==="beforeChildren"?[r,o]:[o,r];return l().then(()=>a())}else return Promise.all([r(),o(n.delay)])}function vs(t,e,n=0,s=0,i=0,r=1,o){const c=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),c.push(ge(u,e,{...o,delay:n+(typeof s=="function"?0:s)+mt(t.variantChildren,u,s,i,r)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(c)}function bs(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>ge(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=ge(t,e,n);else{const i=typeof e=="function"?W(t,e,n.custom):e;s=Promise.all(bt(t,i,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}function Ts(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||jt(t):!0}const xs=new Set(["auto","none","0"]);function As(t,e,n){let s=0,i;for(;s{e.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function Ss(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const i=(n==null?void 0:n[t])??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(s=>s!=null)}const Vs={y:!1};function Ms(){return Vs.y}function Tt(t,e){const n=Ss(t),s=new AbortController,i={passive:!0,...e,signal:s.signal};return[n,i,()=>s.abort()]}function Cs(t){return!(t.pointerType==="touch"||Ms())}function Ds(t,e,n={}){const[s,i,r]=Tt(t,n);return s.forEach(o=>{let c=!1,u=!1,l;const a=()=>{o.removeEventListener("pointerleave",v)},f=m=>{l&&(l(m),l=void 0),a()},d=m=>{c=!1,window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),u&&(u=!1,f(m))},h=()=>{c=!0,window.addEventListener("pointerup",d,i),window.addEventListener("pointercancel",d,i)},v=m=>{if(m.pointerType!=="touch"){if(c){u=!0;return}f(m)}},g=m=>{if(!Cs(m))return;u=!1;const p=e(o,m);typeof p=="function"&&(l=p,o.addEventListener("pointerleave",v,i))};o.addEventListener("pointerenter",g,i),o.addEventListener("pointerdown",h,i)}),r}const xt=(t,e)=>e?t===e?!0:xt(t,e.parentElement):!1,Ps=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,ks=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Is(t){return ks.has(t.tagName)||t.isContentEditable===!0}const Y=new WeakSet;function Ee(t){return e=>{e.key==="Enter"&&t(e)}}function ce(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Fs=(t,e)=>{const n=t.currentTarget;if(!n)return;const s=Ee(()=>{if(Y.has(n))return;ce(n,"down");const i=Ee(()=>{ce(n,"up")}),r=()=>ce(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",r,e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)};function Ke(t){return Ps(t)&&!0}const Le=new WeakSet;function Os(t,e,n={}){const[s,i,r]=Tt(t,n),o=c=>{const u=c.currentTarget;if(!Ke(c)||Le.has(c))return;Y.add(u),n.stopPropagation&&Le.add(c);const l=e(u,c),a=(h,v)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",d),Y.has(u)&&Y.delete(u),Ke(h)&&typeof l=="function"&&l(h,{success:v})},f=h=>{a(h,u===window||u===document||n.useGlobalTarget||xt(u,h.target))},d=h=>{a(h,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",d,i)};return s.forEach(c=>{(n.useGlobalTarget?window:c).addEventListener("pointerdown",o,i),an(c)&&(c.addEventListener("focus",l=>Fs(l,i)),!Is(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),r}class At extends zt{constructor(){super(...arguments),this.KeyframeResolver=ws}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const s=e.style;return s?s[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;$e(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class q{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Rs({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function Es(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Ks(t,e){return Rs(Es(t.getBoundingClientRect(),e))}function wt(t,{style:e,vars:n},s,i){const r=t.style;let o;for(o in e)r[o]=e[o];i==null||i.applyProjectionStyles(r,s);for(o in n)r.setProperty(o,n[o])}function Ls(t){return window.getComputedStyle(t)}class Bs extends At{constructor(){super(...arguments),this.type="html",this.renderInstance=wt}readValueFromInstance(e,n){var s;if(Te.has(n))return(s=this.projection)!=null&&s.isProjecting?$t(n):Xt(e,n);{const i=Ls(e),r=(Yt(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Ks(e,n)}build(e,n,s){Zt(e,n,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,s){return Jt(e,n,s)}}const St=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"]);function Gs(t,e,n,s){wt(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(St.has(i)?i:Xe(i),e.attrs[i])}class Ns extends At{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Qt}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Te.has(n)){const s=sn(n);return s&&s.default||0}return n=St.has(n)?n:Xe(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,s){return en(e,n,s)}build(e,n,s){tn(e,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,n,s,i){Gs(e,n,s,i)}mount(e){this.isSVGTag=nn(e.tagName),super.mount(e)}}const Hs=Ze.length;function Vt(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Vt(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;nPromise.all(e.map(({animation:n,options:s})=>bs(t,n,s)))}function js(t){let e=Us(t),n=Be(),s=!0,i=!1;const r=l=>(a,f)=>{var h;const d=W(t,f,l==="exit"?(h=t.presenceContext)==null?void 0:h.custom:void 0);if(d){const{transition:v,transitionEnd:g,...m}=d;a={...a,...m,...g}}return a};function o(l){e=l(t)}function c(l){const{props:a}=t,f=Vt(t.parent)||{},d=[],h=new Set;let v={},g=1/0;for(let p=0;p<_s;p++){const b=Ws[p],A=n[b],w=a[b]!==void 0?a[b]:f[b],T=Ye(w),M=b===l?A.isActive:null;M===!1&&(g=p);let P=w===f[b]&&w!==a[b]&&T;if(P&&(s||i)&&t.manuallyAnimateOnMount&&(P=!1),A.protectedKeys={...v},!A.isActive&&M===null||!w&&!A.prevProp||Je(w)||typeof w=="boolean")continue;if(b==="exit"&&A.isActive&&M!==!0){A.prevResolvedValues&&(v={...v,...A.prevResolvedValues});continue}const x=qs(A.prevProp,w);let C=x||b===l&&A.isActive&&!P&&T||p>g&&T,y=!1;const V=Array.isArray(w)?w:[w];let k=V.reduce(r(b),{});M===!1&&(k={});const{prevResolvedValues:B={}}=A,F={...B,...k},R=D=>{C=!0,h.has(D)&&(y=!0,h.delete(D)),A.needsAnimating[D]=!0;const I=t.getValue(D);I&&(I.liveStyle=!1)};for(const D in F){const I=k[D],G=B[D];if(v.hasOwnProperty(D))continue;let _=!1;pe(I)&&pe(G)?_=!Mt(I,G):_=I!==G,_?I!=null?R(D):h.add(D):I!==void 0&&h.has(D)?R(D):A.protectedKeys[D]=!0}A.prevProp=w,A.prevResolvedValues=k,A.isActive&&(v={...v,...k}),(s||i)&&t.blockInitialAnimation&&(C=!1);const O=P&&x;C&&(!O||y)&&d.push(...V.map(D=>{const I={type:b};if(typeof D=="string"&&(s||i)&&!O&&t.manuallyAnimateOnMount&&t.parent){const{parent:G}=t,_=W(G,D);if(G.enteringChildren&&_){const{delayChildren:Dt}=_.transition||{};I.delay=mt(G.enteringChildren,t,Dt)}}return{animation:D,options:I}}))}if(h.size){const p={};if(typeof a.initial!="boolean"){const b=W(t,Array.isArray(a.initial)?a.initial[0]:a.initial);b&&b.transition&&(p.transition=b.transition)}h.forEach(b=>{const A=t.getBaseTarget(b),w=t.getValue(b);w&&(w.liveStyle=!0),p[b]=A??null}),d.push({animation:p})}let m=!!d.length;return s&&(a.initial===!1||a.initial===a.animate)&&!t.manuallyAnimateOnMount&&(m=!1),s=!1,i=!1,m?e(d):Promise.resolve()}function u(l,a){var d;if(n[l].isActive===a)return Promise.resolve();(d=t.variantChildren)==null||d.forEach(h=>{var v;return(v=h.animationState)==null?void 0:v.setActive(l,a)}),n[l].isActive=a;const f=c(l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:c,setActive:u,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Be(),i=!0}}}function qs(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Mt(e,t):!1}function N(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Be(){return{animate:N(!0),whileInView:N(),whileHover:N(),whileTap:N(),whileDrag:N(),whileFocus:N(),exit:N()}}function Ge(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const zs=(t,e)=>e.isSVG??rn(t)?new Ns(e):new Bs(e,{allowProjection:t!==on.Fragment});class $s extends q{constructor(e){super(e),e.animationState||(e.animationState=js(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Je(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let Xs=0;class Ys extends q{constructor(){super(...arguments),this.id=Xs++,this.isExitComplete=!1}update(){var r;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;if(e&&s===!1){if(this.isExitComplete){const{initial:o,custom:c}=this.node.getProps();if(typeof o=="string"){const u=W(this.node,o,c);if(u){const{transition:l,transitionEnd:a,...f}=u;for(const d in f)(r=this.node.getValue(d))==null||r.jump(f[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Zs={animation:{Feature:$s},exit:{Feature:Ys}};function Ct(t){return{point:{x:t.pageX,y:t.pageY}}}function Ne(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&H.postRender(()=>r(e,Ct(e)))}class Js extends q{mount(){const{current:e}=this.node;e&&(this.unmount=Ds(e,(n,s)=>(Ne(this.node,s,"Start"),i=>Ne(this.node,i,"End"))))}unmount(){}}class Qs extends q{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=se(Ge(this.node.current,"focus",()=>this.onFocus()),Ge(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function He(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&H.postRender(()=>r(e,Ct(e)))}class ei extends q{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=Os(e,(i,r)=>(He(this.node,r,"Start"),(o,{success:c})=>He(this.node,o,c?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const ye=new WeakMap,le=new WeakMap,ti=t=>{const e=ye.get(t.target);e&&e(t)},ni=t=>{t.forEach(ti)};function si({root:t,...e}){const n=t||document;le.has(n)||le.set(n,{});const s=le.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(ni,{root:t,...e})),s[i]}function ii(t,e,n){const s=si(e);return ye.set(t,n),s.observe(t),()=>{ye.delete(t),s.unobserve(t)}}const ri={some:0,all:1};class oi extends q{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var u;(u=this.stopObserver)==null||u.call(this);const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=e,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:ri[i]},c=l=>{const{isIntersecting:a}=l;if(this.isInView===a||(this.isInView=a,r&&!a&&this.hasEnteredView))return;a&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",a);const{onViewportEnter:f,onViewportLeave:d}=this.node.getProps(),h=a?f:d;h&&h(l)};this.stopObserver=ii(this.node.current,o,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(ai(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function ai({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const ci={inView:{Feature:oi},tap:{Feature:ei},focus:{Feature:Qs},hover:{Feature:Js}},di={renderer:zs,...Zs,...ci};export{di as default};