reacto-loader
Version:
A sleek, high-performance Loader component designed for seamless integration into both React and React Native/Expo applications.
1 lines • 120 kB
JavaScript
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{createContext as n,useRef as i,useLayoutEffect as s,useEffect as o,useContext as r,useId as a,useCallback as l,useMemo as c,useInsertionEffect as u,forwardRef as h,Fragment as d,createElement as p,Component as m,useState as f}from"react";const y=n({});const g="undefined"!=typeof window,v=g?s:o,x=n(null);function T(t,e){-1===t.indexOf(e)&&t.push(e)}function w(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const b=(t,e,n)=>n>e?e:n<t?t:n;let P=()=>{},S=()=>{};"production"!==process.env.NODE_ENV&&(P=(t,e)=>{t||"undefined"==typeof console||console.warn(e)},S=(t,e)=>{if(!t)throw new Error(e)});const A={},E=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function V(t){return"object"==typeof t&&null!==t}const M=t=>/^0[^.\s]+$/u.test(t);function C(t){let e;return()=>(void 0===e&&(e=t()),e)}const D=t=>t,k=(t,e)=>n=>e(t(n)),R=(...t)=>t.reduce(k),I=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class L{constructor(){this.subscriptions=[]}add(t){return T(this.subscriptions,t),()=>w(this.subscriptions,t)}notify(t,e,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](t,e,n);else for(let s=0;s<i;s++){const i=this.subscriptions[s];i&&i(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const j=t=>1e3*t,F=t=>t/1e3;function B(t,e){return e?t*(1e3/e):0}const O=new Set;function N(t,e,n){t||O.has(e)||(console.warn(e),O.add(e))}const U=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function $(t,e,n,i){if(t===e&&n===i)return D;const s=e=>function(t,e,n,i,s){let o,r,a=0;do{r=e+(n-e)/2,o=U(r,i,s)-t,o>0?n=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:U(s(t),e,i)}const W=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Y=t=>e=>1-t(1-e),z=$(.33,1.53,.69,.99),X=Y(z),K=W(X),H=t=>(t*=2)<1?.5*X(t):.5*(2-Math.pow(2,-10*(t-1))),_=t=>1-Math.sin(Math.acos(t)),q=Y(_),G=W(_),Z=$(.42,0,1,1),J=$(0,0,.58,1),Q=$(.42,0,.58,1),tt=t=>Array.isArray(t)&&"number"==typeof t[0],et={linear:D,easeIn:Z,easeInOut:Q,easeOut:J,circIn:_,circInOut:G,circOut:q,backIn:X,backInOut:K,backOut:z,anticipate:H},nt=t=>{if(tt(t)){S(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,i,s]=t;return $(e,n,i,s)}return"string"==typeof t?(S(void 0!==et[t],`Invalid easing type '${t}'`),et[t]):t},it=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],st={value:null};function ot(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=it.reduce(((t,n)=>(t[n]=function(t,e){let n=new Set,i=new Set,s=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function c(e){r.has(e)&&(u.schedule(e),t()),l++,e(a)}const u={schedule:(t,e=!1,o=!1)=>{const a=o&&s?n:i;return e&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),r.delete(t)},process:t=>{a=t,s?o=!0:(s=!0,[n,i]=[i,n],n.forEach(c),e&&st.value&&st.value.frameloop[e].push(l),l=0,n.clear(),s=!1,o&&(o=!1,u.process(t)))}};return u}(o,e?n:void 0),t)),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:d,render:p,postRender:m}=r,f=()=>{const o=A.useManualTiming?s.timestamp:performance.now();n=!1,A.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(o-s.timestamp,40),1)),s.timestamp=o,s.isProcessing=!0,a.process(s),l.process(s),c.process(s),u.process(s),h.process(s),d.process(s),p.process(s),m.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(f))};return{schedule:it.reduce(((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(n||(n=!0,i=!0,s.isProcessing||t(f)),a.schedule(e,o,r)),e}),{}),cancel:t=>{for(let e=0;e<it.length;e++)r[it[e]].cancel(t)},state:s,steps:r}}const{schedule:rt,cancel:at,state:lt,steps:ct}=ot("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:D,!0);let ut;function ht(){ut=void 0}const dt={now:()=>(void 0===ut&&dt.set(lt.isProcessing||A.useManualTiming?lt.timestamp:performance.now()),ut),set:t=>{ut=t,queueMicrotask(ht)}},pt=t=>e=>"string"==typeof e&&e.startsWith(t),mt=pt("--"),ft=pt("var(--"),yt=t=>!!ft(t)&>.test(t.split("/*")[0].trim()),gt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},xt={...vt,transform:t=>b(0,1,t)},Tt={...vt,default:1},wt=t=>Math.round(1e5*t)/1e5,bt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Pt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,St=(t,e)=>n=>Boolean("string"==typeof n&&Pt.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),At=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(bt);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},Et={...vt,transform:t=>Math.round((t=>b(0,255,t))(t))},Vt={test:St("rgb","red"),parse:At("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Et.transform(t)+", "+Et.transform(e)+", "+Et.transform(n)+", "+wt(xt.transform(i))+")"};const Mt={test:St("#"),parse:function(t){let e="",n="",i="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}},transform:Vt.transform},Ct=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Dt=Ct("deg"),kt=Ct("%"),Rt=Ct("px"),It=Ct("vh"),Lt=Ct("vw"),jt=(()=>({...kt,parse:t=>kt.parse(t)/100,transform:t=>kt.transform(100*t)}))(),Ft={test:St("hsl","hue"),parse:At("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+kt.transform(wt(e))+", "+kt.transform(wt(n))+", "+wt(xt.transform(i))+")"},Bt={test:t=>Vt.test(t)||Mt.test(t)||Ft.test(t),parse:t=>Vt.test(t)?Vt.parse(t):Ft.test(t)?Ft.parse(t):Mt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Vt.transform(t):Ft.transform(t)},Ot=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Nt="number",Ut="color",$t=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Wt(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace($t,(t=>(Bt.test(t)?(i.color.push(o),s.push(Ut),n.push(Bt.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(Nt),n.push(parseFloat(t))),++o,"${}"))).split("${}");return{values:n,split:r,indexes:i,types:s}}function Yt(t){return Wt(t).values}function zt(t){const{split:e,types:n}=Wt(t),i=e.length;return t=>{let s="";for(let o=0;o<i;o++)if(s+=e[o],void 0!==t[o]){const e=n[o];s+=e===Nt?wt(t[o]):e===Ut?Bt.transform(t[o]):t[o]}return s}}const Xt=t=>"number"==typeof t?0:t;const Kt={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(bt)?.length||0)+(t.match(Ot)?.length||0)>0},parse:Yt,createTransformer:zt,getAnimatableNone:function(t){const e=Yt(t);return zt(t)(e.map(Xt))}};function Ht(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function _t(t,e){return n=>n>0?e:t}const qt=(t,e,n)=>t+(e-t)*n,Gt=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Zt=[Mt,Vt,Ft];function Jt(t){const e=(n=t,Zt.find((t=>t.test(n))));var n;if(P(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let i=e.parse(t);return e===Ft&&(i=function({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,o=0,r=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=Ht(a,i,t+1/3),o=Ht(a,i,t),r=Ht(a,i,t-1/3)}else s=o=r=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:i}}(i)),i}const Qt=(t,e)=>{const n=Jt(t),i=Jt(e);if(!n||!i)return _t(t,e);const s={...n};return t=>(s.red=Gt(n.red,i.red,t),s.green=Gt(n.green,i.green,t),s.blue=Gt(n.blue,i.blue,t),s.alpha=qt(n.alpha,i.alpha,t),Vt.transform(s))},te=new Set(["none","hidden"]);function ee(t,e){return n=>qt(t,e,n)}function ne(t){return"number"==typeof t?ee:"string"==typeof t?yt(t)?_t:Bt.test(t)?Qt:oe:Array.isArray(t)?ie:"object"==typeof t?Bt.test(t)?Qt:se:_t}function ie(t,e){const n=[...t],i=n.length,s=t.map(((t,n)=>ne(t)(t,e[n])));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function se(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=ne(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const oe=(t,e)=>{const n=Kt.createTransformer(e),i=Wt(t),s=Wt(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?te.has(t)&&!s.values.length||te.has(e)&&!i.values.length?function(t,e){return te.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):R(ie(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][i[o]],a=t.values[r]??0;n[s]=a,i[o]++}return n}(i,s),s.values),n):(P(!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.`),_t(t,e))};function re(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return qt(t,e,n);return ne(t)(t,e)}const ae=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>rt.update(e,t),stop:()=>at(e),now:()=>lt.isProcessing?lt.timestamp:dt.now()}},le=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=t(e/(s-1))+", ";return`linear(${i.substring(0,i.length-2)})`},ce=2e4;function ue(t){let e=0;let n=t.next(e);for(;!n.done&&e<ce;)e+=50,n=t.next(e);return e>=ce?1/0:e}function he(t,e,n){const i=Math.max(e-5,0);return B(n-t(i),e-i)}const de=100,pe=10,me=1,fe=0,ye=800,ge=.3,ve=.3,xe={granular:.01,default:2},Te={granular:.005,default:.5},we=.01,be=10,Pe=.05,Se=1;function Ae({duration:t=ye,bounce:e=ge,velocity:n=fe,mass:i=me}){let s,o;P(t<=j(be),"Spring duration must be 10 seconds or less");let r=1-e;r=b(Pe,Se,r),t=b(we,be,F(t)),r<1?(s=e=>{const i=e*r,s=i*t;return.001-(i-n)/Ve(e,r)*Math.exp(-s)},o=e=>{const i=e*r*t,o=i*n+n,a=Math.pow(r,2)*Math.pow(e,2)*t,l=Math.exp(-i),c=Ve(Math.pow(e,2),r);return(.001-s(e)>0?-1:1)*((o-a)*l)/c}):(s=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<Ee;n++)i-=t(i)/e(i);return i}(s,o,5/t);if(t=j(t),isNaN(a))return{stiffness:de,damping:pe,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*r*Math.sqrt(i*e),duration:t}}}const Ee=12;function Ve(t,e){return t*Math.sqrt(1-e*e)}const Me=["duration","bounce"],Ce=["stiffness","damping","mass"];function De(t,e){return e.some((e=>void 0!==t[e]))}function ke(t=ve,e=ge){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const o=n.keyframes[0],r=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:h,velocity:d,isResolvedFromDuration:p}=function(t){let e={velocity:fe,stiffness:de,damping:pe,mass:me,isResolvedFromDuration:!1,...t};if(!De(t,Ce)&&De(t,Me))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,o=2*b(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:me,stiffness:s,damping:o}}else{const n=Ae(t);e={...e,...n,mass:me},e.isResolvedFromDuration=!0}return e}({...n,velocity:-F(n.velocity||0)}),m=d||0,f=c/(2*Math.sqrt(l*u)),y=r-o,g=F(Math.sqrt(l/u)),v=Math.abs(y)<5;let x;if(i||(i=v?xe.granular:xe.default),s||(s=v?Te.granular:Te.default),f<1){const t=Ve(g,f);x=e=>{const n=Math.exp(-f*g*e);return r-n*((m+f*g*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===f)x=t=>r-Math.exp(-g*t)*(y+(m+g*y)*t);else{const t=g*Math.sqrt(f*f-1);x=e=>{const n=Math.exp(-f*g*e),i=Math.min(t*e,300);return r-n*((m+f*g*y)*Math.sinh(i)+t*y*Math.cosh(i))/t}}const T={calculatedDuration:p&&h||null,next:t=>{const e=x(t);if(p)a.done=t>=h;else{let n=0===t?m:0;f<1&&(n=0===t?j(m):he(x,t,e));const o=Math.abs(n)<=i,l=Math.abs(r-e)<=s;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(ue(T),ce),e=le((e=>T.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return T}function Re({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=n*e;const f=h+m,y=void 0===r?f:r(f);y!==f&&(m=y-h);const g=t=>-m*Math.exp(-t/i),v=t=>y+g(t),x=t=>{const e=g(t),n=v(t);d.done=Math.abs(e)<=c,d.value=d.done?y:n};let T,w;const b=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,w=ke({keyframes:[d.value,p(d.value)],velocity:he(v,t,d.value),damping:s,stiffness:o,restDelta:c,restSpeed:u}))};return b(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==T||(e=!0,x(t),b(t)),void 0!==T&&t>=T?w.next(t-T):(!e&&x(t),d)}}}function Ie(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const o=t.length;if(S(o===e.length,"Both input and output ranges must be the same length"),1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const r=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const i=[],s=n||A.mix||re,o=t.length-1;for(let n=0;n<o;n++){let o=s(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||D:e;o=R(t,o)}i.push(o)}return i}(e,i,s),l=a.length,c=n=>{if(r&&n<t[0])return e[0];let i=0;if(l>1)for(;i<t.length-2&&!(n<t[i+1]);i++);const s=I(t[i],t[i+1],n);return a[i](s)};return n?e=>c(b(t[0],t[o-1],e)):c}function Le(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=I(0,e,i);t.push(qt(n,1,s))}}(e,t.length-1),e}function je({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(nt):nt(i),o={done:!1,value:e[0]},r=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Le(e),t),a=Ie(r,e,{ease:Array.isArray(s)?s:(l=e,c=s,l.map((()=>c||Q)).splice(0,l.length-1))});var l,c;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}ke.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(ue(i),ce);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:F(s)}}(t,100,ke);return t.ease=e.ease,t.duration=j(e.duration),t.type="keyframes",t};const Fe=t=>null!==t;function Be(t,{repeat:e,repeatType:n="loop"},i,s=1){const o=t.filter(Fe),r=s<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return r&&void 0!==i?i:o[r]}const Oe={decay:Re,inertia:Re,tween:je,keyframes:je,spring:ke};function Ne(t){"string"==typeof t.type&&(t.type=Oe[t.type])}class Ue{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 $e=t=>t/100;class We extends Ue{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!==dt.now()&&this.tick(dt.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;Ne(t);const{type:e=je,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||je;"production"!==process.env.NODE_ENV&&a!==je&&S(r.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${r}`),a!==je&&"number"!=typeof r[0]&&(this.mixKeyframes=R($e,re(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=ue(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=l}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:n,totalDuration:i,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:r,calculatedDuration:a}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:h,repeatDelay:d,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const y=this.currentTime-l*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let v=this.currentTime,x=n;if(u){const t=Math.min(this.currentTime,i)/r;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,u+1);Boolean(e%2)&&("reverse"===h?(n=1-n,d&&(n-=d/r)):"mirror"===h&&(x=o)),v=b(0,1,n)*r}const T=g?{done:!1,value:c[0]}:x.next(v);s&&(T.value=s(T.value));let{done:w}=T;g||null===a||(w=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const P=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return P&&p!==Re&&(T.value=Be(c,this.options,f,this.speed)),m&&m(T.value),P&&this.finish(),T}then(t,e){return this.finished.then(t,e)}get duration(){return F(this.calculatedDuration)}get time(){return F(this.currentTime)}set time(t){t=j(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(dt.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=F(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ae,startTime:e}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(dt.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 Ye=t=>180*t/Math.PI,ze=t=>{const e=Ye(Math.atan2(t[1],t[0]));return Ke(e)},Xe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:ze,rotateZ:ze,skewX:t=>Ye(Math.atan(t[1])),skewY:t=>Ye(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ke=t=>((t%=360)<0&&(t+=360),t),He=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),_e=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),qe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:He,scaleY:_e,scale:t=>(He(t)+_e(t))/2,rotateX:t=>Ke(Ye(Math.atan2(t[6],t[5]))),rotateY:t=>Ke(Ye(Math.atan2(-t[2],t[0]))),rotateZ:ze,rotate:ze,skewX:t=>Ye(Math.atan(t[4])),skewY:t=>Ye(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ge(t){return t.includes("scale")?1:0}function Ze(t,e){if(!t||"none"===t)return Ge(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=qe,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=Xe,s=e}if(!s)return Ge(e);const o=i[e],r=s[1].split(",").map(Je);return"function"==typeof o?o(r):r[o]}function Je(t){return parseFloat(t.trim())}const Qe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],tn=(()=>new Set(Qe))(),en=t=>t===vt||t===Rt,nn=new Set(["x","y","z"]),sn=Qe.filter((t=>!nn.has(t)));const on={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Ze(e,"x"),y:(t,{transform:e})=>Ze(e,"y")};on.translateX=on.x,on.translateY=on.y;const rn=new Set;let an=!1,ln=!1,cn=!1;function un(){if(ln){const t=Array.from(rn).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return sn.forEach((n=>{const i=t.getValue(n);void 0!==i&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{t.getValue(e)?.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}ln=!1,an=!1,rn.forEach((t=>t.complete(cn))),rn.clear()}function hn(){rn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(ln=!0)}))}class dn{constructor(t,e,n,i,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(rn.add(this),an||(an=!0,rt.read(hn),rt.resolveKeyframes(un))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;if(null===t[0]){const s=i?.get(),o=t[t.length-1];if(void 0!==s)t[0]=s;else if(n&&e){const i=n.readValue(e,o);null!=i&&(t[0]=i)}void 0===t[0]&&(t[0]=o),i&&void 0===s&&i.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),rn.delete(this)}cancel(){"scheduled"===this.state&&(rn.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const pn=C((()=>void 0!==window.ScrollTimeline)),mn={};function fn(t,e){const n=C(t);return()=>mn[e]??n()}const yn=fn((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),gn=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,vn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gn([0,.65,.55,1]),circOut:gn([.55,0,1,.45]),backIn:gn([.31,.01,.66,-.59]),backOut:gn([.33,1.53,.69,.99])};function xn(t,e){return t?"function"==typeof t?yn()?le(t,e):"ease-out":tt(t)?gn(t):Array.isArray(t)?t.map((t=>xn(t,e)||vn.easeOut)):vn[t]:void 0}function Tn(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const h=xn(a,s);Array.isArray(h)&&(u.easing=h);const d={delay:i,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};c&&(d.pseudoElement=c);return t.animate(u,d)}function wn(t){return"function"==typeof t&&"applyToOptions"in t}class bn extends Ue{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:r,onComplete:a}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=o,this.options=t,S("string"!=typeof t.type,'animateMini doesn\'t support "type" as a string. Did you mean to import { spring } from "motion"?');const l=function({type:t,...e}){return wn(t)&&yn()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Tn(e,n,i,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const t=Be(i,this.options,r,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}a?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return F(Number(t))}get time(){return F(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=j(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&pn()?(this.animation.timeline=t,D):e(this)}}const Pn={anticipate:H,backInOut:K,circInOut:G};function Sn(t){"string"==typeof t.ease&&t.ease in Pn&&(t.ease=Pn[t.ease])}class An extends bn{constructor(t){Sn(t),Ne(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:i,element:s,...o}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const r=new We({...o,autoplay:!1}),a=j(this.finishedTime??this.time);e.setWithVelocity(r.sample(a-10).value,r.sample(a).value,10),r.stop()}}const En=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Kt.test(t)&&"0"!==t||t.startsWith("url(")));function Vn(t){return V(t)&&"offsetHeight"in t}const Mn=new Set(["opacity","clipPath","filter","transform"]),Cn=C((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Dn extends Ue{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",keyframes:r,name:a,motionValue:l,element:c,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=dt.now();const h={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:o,name:a,motionValue:l,element:c,...u},d=c?.KeyframeResolver||dn;this.keyframeResolver=new d(r,((t,e,n)=>this.onKeyframesResolved(t,e,h,!n)),a,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:s,type:o,velocity:r,delay:a,isHandoff:l,onUpdate:c}=n;this.resolvedAt=dt.now(),function(t,e,n,i){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=En(s,e),a=En(o,e);return P(r===a,`You are trying to animate ${e} from "${s}" to "${o}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${o} via the \`style\` property.`),!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||wn(n))&&i)}(t,s,o,r)||(!A.instantAnimations&&a||c?.(Be(t,n,e)),t[0]=t[t.length-1],n.duration=0,n.repeat=0);const u={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},h=!l&&function(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:o,type:r}=t;if(!Vn(e?.owner?.current))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return Cn()&&n&&Mn.has(n)&&("transform"!==n||!l)&&!a&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}(u)?new An({...u,element:u.motionValue.owner.current}):new We(u);h.finished.then((()=>this.notifyFinished())).catch(D),this.pendingTimeline&&(this.stopTimeline=h.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=h}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(),cn=!0,hn(),un(),cn=!1),this._animation}get duration(){return this.animation.duration}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 kn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Rn(t,e,n=1){S(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[i,s]=function(t){const e=kn.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}(t);if(!i)return;const o=window.getComputedStyle(e).getPropertyValue(i);if(o){const t=o.trim();return E(t)?parseFloat(t):t}return yt(s)?Rn(s,e,n+1):s}function In(t,e){return t?.[e]??t?.default??t}const Ln=new Set(["width","height","top","left","right","bottom",...Qe]),jn=t=>e=>e.test(t),Fn=[vt,Rt,kt,Dt,Lt,It,{test:t=>"auto"===t,parse:t=>t}],Bn=t=>Fn.find(jn(t));const On=new Set(["brightness","contrast","saturate","opacity"]);function Nn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(bt)||[];if(!i)return t;const s=n.replace(i,"");let o=On.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const Un=/\b([a-z-]*)\(.*?\)/gu,$n={...Kt,getAnimatableNone:t=>{const e=t.match(Un);return e?e.map(Nn).join(" "):t}},Wn={...vt,transform:Math.round},Yn={borderWidth:Rt,borderTopWidth:Rt,borderRightWidth:Rt,borderBottomWidth:Rt,borderLeftWidth:Rt,borderRadius:Rt,radius:Rt,borderTopLeftRadius:Rt,borderTopRightRadius:Rt,borderBottomRightRadius:Rt,borderBottomLeftRadius:Rt,width:Rt,maxWidth:Rt,height:Rt,maxHeight:Rt,top:Rt,right:Rt,bottom:Rt,left:Rt,padding:Rt,paddingTop:Rt,paddingRight:Rt,paddingBottom:Rt,paddingLeft:Rt,margin:Rt,marginTop:Rt,marginRight:Rt,marginBottom:Rt,marginLeft:Rt,backgroundPositionX:Rt,backgroundPositionY:Rt,...{rotate:Dt,rotateX:Dt,rotateY:Dt,rotateZ:Dt,scale:Tt,scaleX:Tt,scaleY:Tt,scaleZ:Tt,skew:Dt,skewX:Dt,skewY:Dt,distance:Rt,translateX:Rt,translateY:Rt,translateZ:Rt,x:Rt,y:Rt,z:Rt,perspective:Rt,transformPerspective:Rt,opacity:xt,originX:jt,originY:jt,originZ:Rt},zIndex:Wn,fillOpacity:xt,strokeOpacity:xt,numOctaves:Wn},zn={...Yn,color:Bt,backgroundColor:Bt,outlineColor:Bt,fill:Bt,stroke:Bt,borderColor:Bt,borderTopColor:Bt,borderRightColor:Bt,borderBottomColor:Bt,borderLeftColor:Bt,filter:$n,WebkitFilter:$n},Xn=t=>zn[t];function Kn(t,e){let n=Xn(t);return n!==$n&&(n=Kt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Hn=new Set(["auto","none","0"]);class _n extends dn{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let i=t[n];if("string"==typeof i&&(i=i.trim(),yt(i))){const s=Rn(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Ln.has(n)||2!==t.length)return;const[i,s]=t,o=Bn(i),r=Bn(s);if(o!==r)if(en(o)&&en(r))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else on[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||("number"==typeof(i=t[e])?0===i:null===i||"none"===i||"0"===i||M(i)))&&n.push(e);var i;n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!Hn.has(e)&&Wt(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=Kn(n,i)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=on[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&t.getValue(n,i).jump(i,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const i=t.getValue(e);i&&i.jump(this.measuredOrigin,!1);const s=n.length-1,o=n[s];n[s]=on[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach((([e,n])=>{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}}const qn=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class Gn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=dt.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty();e&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=dt.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return"production"!==process.env.NODE_ENV&&N(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new L);const n=this.events[t].add(e);return"change"===t?()=>{n(),rt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=dt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return B(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Zn(t,e){return new Gn(t,e)}const{schedule:Jn}=ot(queueMicrotask,!1),Qn={x:!1,y:!1};function ti(){return Qn.x||Qn.y}function ei(t,e){const n=function(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document;const i=n?.[t]??e.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function ni(t){return!("touch"===t.pointerType||ti())}const ii=(t,e)=>!!e&&(t===e||ii(t,e.parentElement)),si=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,oi=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const ri=new WeakSet;function ai(t){return e=>{"Enter"===e.key&&t(e)}}function li(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function ci(t){return si(t)&&!ti()}function ui(t,e,n={}){const[i,s,o]=ei(t,n),r=t=>{const i=t.currentTarget;if(!ci(t))return;ri.add(i);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),ri.has(i)&&ri.delete(i),ci(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,i===window||i===document||n.useGlobalTarget||ii(i,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",l,s)};return i.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",r,s),Vn(t)&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=ai((()=>{if(ri.has(n))return;li(n,"down");const t=ai((()=>{li(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>li(n,"cancel")),e)}));n.addEventListener("keydown",i,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",i)),e)})(t,s))),e=t,oi.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),o}function hi(t){return V(t)&&"ownerSVGElement"in t}const di=t=>Boolean(t&&t.getVelocity),pi=[...Fn,Bt,Kt],mi=n({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});const fi=n({strict:!1}),yi={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},gi={};for(const t in yi)gi[t]={isEnabled:e=>yi[t].some((t=>!!e[t]))};const vi=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function xi(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||vi.has(t)}let Ti=t=>!xi(t);try{(wi=require("@emotion/is-prop-valid").default)&&(Ti=t=>t.startsWith("on")?!xi(t):wi(t))}catch{}var wi;function bi(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>("production"!==process.env.NODE_ENV&&N(!1,"motion() is deprecated. Use motion.create() instead."),t(...e))),{get:(n,i)=>"create"===i?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}const Pi=n({});function Si(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Ai(t){return"string"==typeof t||Array.isArray(t)}const Ei=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Vi=["initial",...Ei];function Mi(t){return Si(t.animate)||Vi.some((e=>Ai(t[e])))}function Ci(t){return Boolean(Mi(t)||t.variants)}function Di(t){const{initial:e,animate:n}=function(t,e){if(Mi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Ai(e)?e:void 0,animate:Ai(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,r(Pi));return c((()=>({initial:e,animate:n})),[ki(e),ki(n)])}function ki(t){return Array.isArray(t)?t.join(" "):t}const Ri=Symbol.for("motionComponentSymbol");function Ii(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function Li(t,e,n){return l((i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&("function"==typeof n?n(i):Ii(n)&&(n.current=i))}),[e])}const ji=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Fi="data-"+ji("framerAppearId"),Bi=n({});function Oi(t,e,n,s,a){const{visualElement:l}=r(Pi),c=r(fi),h=r(x),d=r(mi).reducedMotion,p=i(null);s=s||c.renderer,!p.current&&s&&(p.current=s(t,{visualState:e,parent:l,props:n,presenceContext:h,blockInitialAnimation:!!h&&!1===h.initial,reducedMotionConfig:d}));const m=p.current,f=r(Bi);!m||m.projection||!a||"html"!==m.type&&"svg"!==m.type||function(t,e,n,i){const{layoutId:s,layout:o,drag:r,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ni(t.parent)),t.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:Boolean(r)||a&&Ii(a),visualElement:t,animationType:"string"==typeof o?o:"both",initialPromotionConfig:i,crossfade:u,layoutScroll:l,layoutRoot:c})}(p.current,n,a,f);const y=i(!1);u((()=>{m&&y.current&&m.update(n,h)}));const g=n[Fi],T=i(Boolean(g)&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return v((()=>{m&&(y.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),Jn.render(m.render),T.current&&m.animationState&&m.animationState.animateChanges())})),o((()=>{m&&(!T.current&&m.animationState&&m.animationState.animateChanges(),T.current&&(queueMicrotask((()=>{window.MotionHandoffMarkAsComplete?.(g)})),T.current=!1))})),m}function Ni(t){if(t)return!1!==t.options.allowProjection?t.projection:Ni(t.parent)}function Ui({preloadedFeatures:n,createVisualElement:i,useRender:s,useVisualState:o,Component:a}){function l(l,c){let u;const h={...r(mi),...l,layoutId:$i(l)},{isStatic:d}=h,p=Di(l),m=o(l,d);if(!d&&g){!function(t,e){const n=r(fi).strict;if("production"!==process.env.NODE_ENV&&e&&n){const e="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?P(!1,e):S(!1,e)}}(h,n);const t=function(t){const{drag:e,layout:n}=gi;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(h);u=t.MeasureLayout,p.visualElement=Oi(a,m,h,i,t.ProjectionNode)}return t(Pi.Provider,{value:p,children:[u&&p.visualElement?e(u,{visualElement:p.visualElement,...h}):null,s(a,l,Li(m,p.visualElement,c),m,d,p.visualElement)]})}n&&function(t){for(const e in t)gi[e]={...gi[e],...t[e]}}(n),l.displayName=`motion.${"string"==typeof a?a:`create(${a.displayName??a.name??""})`}`;const c=h(l);return c[Ri]=a,c}function $i({layoutId:t}){const e=r(y).id;return e&&void 0!==t?e+"-"+t:t}const Wi={};function Yi(t,{layout:e,layoutId:n}){return tn.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Wi[t]||"opacity"===t)}const zi={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Xi=Qe.length;function Ki(t,e,n){const{style:i,vars:s,transformOrigin:o}=t;let r=!1,a=!1;for(const t in e){const n=e[t];if(tn.has(t))r=!0;else if(mt(t))s[t]=n;else{const e=qn(n,Yn[t]);t.startsWith("origin")?(a=!0,o[t]=e):i[t]=e}}if(e.transform||(r||n?i.transform=function(t,e,n){let i="",s=!0;for(let o=0;o<Xi;o++){const r=Qe[o],a=t[r];if(void 0===a)continue;let l=!0;if(l="number"==typeof a?a===(r.startsWith("scale")?1:0):0===parseFloat(a),!l||n){const t=qn(a,Yn[r]);l||(s=!1,i+=`${zi[r]||r}(${t}) `),n&&(e[r]=t)}}return i=i.trim(),n?i=n(e,s?"":i):s&&(i="none"),i}(e,t.transform,n):i.transform&&(i.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=o;i.transformOrigin=`${t} ${e} ${n}`}}const Hi=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function _i(t,e,n){for(const i in e)di(e[i])||Yi(i,n)||(t[i]=e[i])}function qi(t,e){const n={};return _i(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return c((()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return Ki(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Gi(t,e){const n={},i=qi(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const Zi={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ji={offset:"strokeDashoffset",array:"strokeDasharray"};function Qi(t,{attrX:e,attrY:n,attrScale:i,pathLength:s,pathSpacing:o=1,pathOffset:r=0,...a},l,c,u){if(Ki(t,a,c),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:h,style:d}=t;h.transform&&(d.transform=h.transform,delete h.transform),(d.transform||h.transformOrigin)&&(d.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete h.transformBox),void 0!==e&&(h.x=e),void 0!==n&&(h.y=n),void 0!==i&&(h.scale=i),void 0!==s&&function(t,e,n=1,i=0,s=!0){t.pathLength=1;const o=s?Zi:Ji;t[o.offset]=Rt.transform(-i);const r=Rt.transform(e),a=Rt.transform(n);t[o.array]=`${r} ${a}`}(h,s,o,r,!1)}const ts=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),es=t=>"string"==typeof t&&"svg"===t.toLowerCase();function ns(t,e,n,i){const s=c((()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Qi(n,e,es(i),t.transformTemplate,t.style),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};_i(e,t.style,t),s.style={...e,...s.style}}return s}const is=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ss(t){return"string"==typeof t&&!t.includes("-")&&!!(is.indexOf(t)>-1||/[A-Z]/u.test(t))}function os(t=!1){return(e,n,i,{latestValues:s},o)=>{const r=(ss(e)?ns:Gi)(n,s,o,e),a=function(t,e,n){const i={};for(const s in t)"values"===s&&"object"==typeof t.values||(Ti(s)||!0===n&&xi(s)||!e&&!xi(s)||t.draggable&&s.startsWith("onDrag"))&&(i[s]=t[s]);return i}(n,"string"==typeof e,t),l=e!==d?{...a,...r,ref:i}:{},{children:u}=n,h=c((()=>di(u)?u.get():u),[u]);return p(e,{...l,children:h})}}function rs(t){const e=[{},{}];return t?.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function as(t,e,n,i){if("function"==typeof e){const[s,o]=rs(i);e=e(void 0!==n?n:t.custom,s,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[s,o]=rs(i);e=e(void 0!==n?n:t.custom,s,o)}return e}function ls(t){return di(t)?t.get():t}const cs=t=>(e,n)=>{const s=r(Pi),o=r(x),a=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,s){return{latestValues:us(n,i,s,t),renderState:e()}}(t,e,s,o);return n?a():function(t){const e=i(null);return null===e.current&&(e.current=t()),e.current}(a)};function us(t,e,n,i){const s={},o=i(t,{});for(const t in o)s[t]=ls(o[t]);let{initial:r,animate:a}=t;const l=Mi(t),c=Ci(t);e&&c&&!l&&!1!==t.inherit&&(void 0===r&&(r=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===r;const h=u?a:r;if(h&&"boolean"!=typeof h&&!Si(h)){const e=Array.isArray(h)?h:[h];for(let n=0;n<e.length;n++){const i=as(t,e[n]);if(i){const{transitionEnd:t,transition:e,...n}=i;for(const t in n){let e=n[t];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(s[t]=e)}for(const e in t)s[e]=t[e]}}}return s}function hs(t,e,n){const{style:i}=t,s={};for(const o in i)(di(i[o])||e.style&&di(e.style[o])||Yi(o,t)||void 0!==n?.getValue(o)?.liveStyle)&&(s[o]=i[o]);return s}const ds={useVisualState:cs({scrapeMotionValuesFromProps:hs,createRenderState:Hi})};function ps(t,e,n){const i=hs(t,e,n);for(const n in t)if(di(t[n])||di(e[n])){i[-1!==Qe.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return i}const ms={useVisualState:cs({scrapeMotionValuesFromProps:ps,createRenderState:ts})};function fs(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){return Ui({...ss(n)?ms:ds,preloadedFeatures:t,useRender:os(i),createVisualElement:e,Component:n})}}function ys(t,e,n){const i=t.getProps();return as(i,e,void 0!==n?n:i.custom,t)}const gs=t=>Array.isArray(t);function vs(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Zn(n))}function xs(t,e){const n=t.getValue("willChange");if(i=n,Boolean(di(i)&&i.add))return n.add(e);if(!n&&A.WillChange){const n=new A.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}function Ts(t){return t.props[Fi]}const ws=t=>null!==t;const bs={type:"spring",stiffness:500,damping:25,restSpeed:10},Ps={type:"keyframes",duration:.8},Ss={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},As=(t,{keyframes:e})=>e.length>2?Ps:tn.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:bs:Ss;const Es=(t,e,n,i={},s,o)=>r=>{const a=In(i,t)||{},l=a.delay||i.delay||0;let{elapsed:c=0}=i;c-=j(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},