UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines • 145 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={},t.React)}(this,(function(t,e){"use strict";function n(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var i=n(e),s=React,o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,u=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,n){var i,s={},r=null,c=null;for(i in void 0!==n&&(r=""+n),void 0!==e.key&&(r=""+e.key),void 0!==e.ref&&(c=e.ref),e)a.call(e,i)&&!l.hasOwnProperty(i)&&(s[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===s[i]&&(s[i]=e[i]);return{$$typeof:o,type:t,key:r,ref:c,props:s,_owner:u.current}}const h=r,d=c,p=c,m=e.createContext({});function f(t){const n=e.useRef(null);return null===n.current&&(n.current=t()),n.current}const g="undefined"!=typeof window,y=g?e.useLayoutEffect:e.useEffect,v=e.createContext(null),x=e.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class w extends i.Component{getSnapshotBeforeUpdate(t){const e=this.props.childRef.current;if(e&&t.isPresent&&!this.props.isPresent){const t=e.offsetParent,n=t instanceof HTMLElement&&t.offsetWidth||0,i=this.props.sizeRef.current;i.height=e.offsetHeight||0,i.width=e.offsetWidth||0,i.top=e.offsetTop,i.left=e.offsetLeft,i.right=n-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function P({children:t,isPresent:n,anchorX:s}){const o=e.useId(),r=e.useRef(null),a=e.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:u}=e.useContext(x);return e.useInsertionEffect((()=>{const{width:t,height:e,top:i,left:l,right:c}=a.current;if(n||!r.current||!t||!e)return;const h="left"===s?`left: ${l}`:`right: ${c}`;r.current.dataset.motionPopId=o;const d=document.createElement("style");return u&&(d.nonce=u),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(`\n [data-motion-pop-id="${o}"] {\n position: absolute !important;\n width: ${t}px !important;\n height: ${e}px !important;\n ${h}px !important;\n top: ${i}px !important;\n }\n `),()=>{document.head.removeChild(d)}}),[n]),d(w,{isPresent:n,childRef:r,sizeRef:a,children:i.cloneElement(t,{ref:r})})}const T=({children:t,initial:n,isPresent:s,onExitComplete:o,custom:r,presenceAffectsLayout:a,mode:u,anchorX:l})=>{const c=f(S),h=e.useId(),p=e.useCallback((t=>{c.set(t,!0);for(const t of c.values())if(!t)return;o&&o()}),[c,o]),m=e.useMemo((()=>({id:h,initial:n,isPresent:s,custom:r,onExitComplete:p,register:t=>(c.set(t,!1),()=>c.delete(t))})),a?[Math.random(),p]:[s,p]);return e.useMemo((()=>{c.forEach(((t,e)=>c.set(e,!1)))}),[s]),i.useEffect((()=>{!s&&!c.size&&o&&o()}),[s]),"popLayout"===u&&(t=d(P,{isPresent:s,anchorX:l,children:t})),d(v.Provider,{value:m,children:t})};function S(){return new Map}function b(t=!0){const n=e.useContext(v);if(null===n)return[!0,null];const{isPresent:i,onExitComplete:s,register:o}=n,r=e.useId();e.useEffect((()=>{if(t)return o(r)}),[t]);const a=e.useCallback((()=>t&&s&&s(r)),[r,s,t]);return!i&&s?[!1,a]:[!0]}const A=t=>t.key||"";function E(t){const n=[];return e.Children.forEach(t,(t=>{e.isValidElement(t)&&n.push(t)})),n}const M=e.createContext(null);function C(t,e){-1===t.indexOf(e)&&t.push(e)}function V(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}let R=()=>{};const k={skipAnimations:!1,useManualTiming:!1};function D(t){let e;return()=>(void 0===e&&(e=t()),e)}const L=t=>t,B=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class O{constructor(){this.subscriptions=[]}add(t){return C(this.subscriptions,t),()=>V(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 F=t=>1e3*t,j=t=>t/1e3;function I(t,e){return e?t*(1e3/e):0}const U=D((()=>void 0!==window.ScrollTimeline));class W{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>U()&&n.attachTimeline?n.attachTimeline(t):"function"==typeof e?e(n):void 0));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class N extends W{then(t,e){return this.finished.finally(t).then((()=>{}))}}const $=t=>t.startsWith("--"),z=(t,e,n)=>{$(e)?t.style.setProperty(e,n):t.style[e]=n},H=(t,e)=>$(e)?t.style.getPropertyValue(e):t.style[e],X=t=>null!==t;const Y=D((()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0})),K=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","radius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","backgroundPositionX","backgroundPositionY"]);const G={value:null,addProjectionMetrics:null},_=t=>Array.isArray(t)&&"number"==typeof t[0],q={};function Z(t,e){const n=D(t);return()=>q[e]??n()}const J=Z((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Q=(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)})`},tt=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,et={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:tt([0,.65,.55,1]),circOut:tt([.55,0,1,.45]),backIn:tt([.31,.01,.66,-.59]),backOut:tt([.33,1.53,.69,.99])};function nt(t,e){return t?"function"==typeof t&&J()?Q(t,e):_(t)?tt(t):Array.isArray(t)?t.map((t=>nt(t,e)||et.easeOut)):et[t]:void 0}function it(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeInOut",times:u}={},l=void 0){const c={[e]:n};u&&(c.offset=u);const h=nt(a,s);Array.isArray(h)&&(c.easing=h);return t.animate(c,{delay:i,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal",pseudoElement:l})}function st(t){return"function"==typeof t&&"applyToOptions"in t}const ot=new WeakMap;class rt{constructor(t){if("animation"in t)return void(this.animation=t.animation);const{element:e,name:n,keyframes:i,pseudoElement:s,allowFlatten:o=!1}=t;let{transition:r}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=o;const a=function(t){const e=ot.get(t)||new Map;return ot.set(t,e),e}(e),u=((t,e)=>`${t}:${e}`)(n,s||""),l=a.get(u);l&&l.stop();const c=function(t,e,n,i){Array.isArray(n)||(n=[n]);for(let s=0;s<n.length;s++)null===n[s]&&(n[s]=0!==s||i?n[s-1]:H(t,e)),"number"==typeof n[s]&&K.has(e)&&(n[s]=n[s]+"px");return!i&&!Y()&&n.length<2&&n.unshift(H(t,e)),n}(e,n,i,s);r.type,r=function({type:t,...e}){return st(t)?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(r),this.animation=it(e,n,c,r,s),!1===r.autoplay&&this.animation.pause(),this.removeAnimation=()=>a.delete(u),this.animation.onfinish=()=>{s||(z(e,n,function(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(X),o=e&&"loop"!==n&&e%2==1?0:s.length-1;return o&&void 0!==i?i:s[o]}(c,r)),this.cancel())},a.set(u,this)}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.finish()}cancel(){try{this.animation.cancel()}catch(t){}this.removeAnimation()}stop(){const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.commitStyles(),this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming().duration||0;return j(Number(t))}get time(){return j(Number(this.animation.currentTime)||0)}set time(t){this.animation.currentTime=F(t)}get speed(){return this.animation.playbackRate}set speed(t){this.animation.playbackRate=t}get state(){return this.animation.playState}get startTime(){return Number(this.animation.startTime)}get finished(){return this.animation.finished}flatten(){this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"})}attachTimeline(t){return this.animation.timeline=t,this.animation.onfinish=null,L}then(t,e){return this.finished.then(t).catch(e)}}function at(t,e){return t?.[e]??t?.default??t}const ut=2e4;function lt(t){let e=0;let n=t.next(e);for(;!n.done&&e<ut;)e+=50,n=t.next(e);return e>=ut?1/0:e}function ct(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(lt(i),ut);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:j(s)}}function ht(t){return Boolean("function"==typeof t&&J()||!t||"string"==typeof t&&(t in et||J())||_(t)||Array.isArray(t)&&t.every(ht))}function dt(t,e){t.timeline=e,t.onfinish=null}const pt=["read","resolveKeyframes","update","preRender","render","postRender"];function mt(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=pt.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},u=0;function l(e){r.has(e)&&(c.schedule(e),t()),u++,e(a)}const c={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(l),e&&G.value&&G.value.frameloop[e].push(u),u=0,n.clear(),s=!1,o&&(o=!1,c.process(t)))}};return c}(o,e?n:void 0),t)),{}),{read:a,resolveKeyframes:u,update:l,preRender:c,render:h,postRender:d}=r,p=()=>{const o=k.useManualTiming?s.timestamp:performance.now();n=!1,k.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(o-s.timestamp,40),1)),s.timestamp=o,s.isProcessing=!0,a.process(s),u.process(s),l.process(s),c.process(s),h.process(s),d.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(p))};return{schedule:pt.reduce(((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(n||(n=!0,i=!0,s.isProcessing||t(p)),a.schedule(e,o,r)),e}),{}),cancel:t=>{for(let e=0;e<pt.length;e++)r[pt[e]].cancel(t)},state:s,steps:r}}const{schedule:ft,cancel:gt}=mt(queueMicrotask,!1),{schedule:yt,cancel:vt,state:xt,steps:wt}=mt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:L,!0);let Pt;function Tt(){Pt=void 0}const St={now:()=>(void 0===Pt&&St.set(xt.isProcessing||k.useManualTiming?xt.timestamp:performance.now()),Pt),set:t=>{Pt=t,queueMicrotask(Tt)}},bt={x:!1,y:!1};function At(){return bt.x||bt.y}function Et(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const s=n?.[t]??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}function Mt(t,e){const n=Et(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function Ct(t){return!("touch"===t.pointerType||At())}function Vt(t,e,n={}){const[i,s,o]=Mt(t,n),r=t=>{if(!Ct(t))return;const{target:n}=t,i=e(n,t);if("function"!=typeof i||!n)return;const o=t=>{Ct(t)&&(i(t),n.removeEventListener("pointerleave",o))};n.addEventListener("pointerleave",o,s)};return i.forEach((t=>{t.addEventListener("pointerenter",r,s)})),o}const Rt=(t,e)=>!!e&&(t===e||Rt(t,e.parentElement)),kt=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Dt=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Lt=new WeakSet;function Bt(t){return e=>{"Enter"===e.key&&t(e)}}function Ot(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Ft(t){return kt(t)&&!At()}function jt(t,e,n={}){const[i,s,o]=Mt(t,n),r=t=>{const i=t.currentTarget;if(!Ft(t)||Lt.has(i))return;Lt.add(i);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",u),Ft(t)&&Lt.has(i)&&(Lt.delete(i),"function"==typeof o&&o(t,{success:e}))},a=t=>{r(t,i===window||i===document||n.useGlobalTarget||Rt(i,t.target))},u=t=>{r(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",u,s)};return i.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",r,s),t instanceof HTMLElement&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=Bt((()=>{if(Lt.has(n))return;Ot(n,"down");const t=Bt((()=>{Ot(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>Ot(n,"cancel")),e)}));n.addEventListener("keydown",i,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",i)),e)})(t,s))),e=t,Dt.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),o}const It={current:void 0};class Ut{constructor(t,e={}){this.version="12.7.3",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=St.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&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=St.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new O);const n=this.events[t].add(e);return"change"===t?()=>{n(),yt.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()}get(){return It.current&&It.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=St.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return I(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.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wt(t,e){return new Ut(t,e)}const Nt=yt,$t=pt.reduce(((t,e)=>(t[e]=t=>vt(t),t)),{}),zt=(t,e,n)=>t+(e-t)*n;function Ht(t){return t.max-t.min}function Xt(t,e,n,i=.5){t.origin=i,t.originPoint=zt(e.min,e.max,t.origin),t.scale=Ht(n)/Ht(e),t.translate=zt(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 Yt(t,e,n,i){Xt(t.x,e.x,n.x,i?i.originX:void 0),Xt(t.y,e.y,n.y,i?i.originY:void 0)}function Kt(t,e,n){t.min=n.min+e.min,t.max=t.min+Ht(e)}function Gt(t,e,n){t.min=e.min-n.min,t.max=t.min+Ht(e)}function _t(t,e,n){Gt(t.x,e.x,n.x),Gt(t.y,e.y,n.y)}const qt=t=>!t.isLayoutDirty&&t.willUpdate(!1);function Zt(){const t=new Set,e=new WeakMap,n=()=>t.forEach(qt);return{add:i=>{t.add(i),e.set(i,i.addEventListener("willUpdate",n))},remove:i=>{t.delete(i);const s=e.get(i);s&&(s(),e.delete(i)),n()},dirty:n}}const Jt=t=>Boolean(t&&t.getVelocity),Qt={current:!1},te=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function ee(t,e,n,i){if(t===e&&n===i)return L;const s=e=>function(t,e,n,i,s){let o,r,a=0;do{r=e+(n-e)/2,o=te(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:te(s(t),e,i)}const ne=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ie=t=>e=>1-t(1-e),se=ee(.33,1.53,.69,.99),oe=ie(se),re=ne(oe),ae=t=>(t*=2)<1?.5*oe(t):.5*(2-Math.pow(2,-10*(t-1))),ue=t=>1-Math.sin(Math.acos(t)),le=ie(ue),ce=ne(ue),he=t=>/^0[^.\s]+$/u.test(t);const de=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],pe=new Set(de),me=new Set(["width","height","top","left","right","bottom",...de]),fe=(t,e,n)=>n>e?e:n<t?t:n,ge={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ye={...ge,transform:t=>fe(0,1,t)},ve={...ge,default:1},xe=t=>Math.round(1e5*t)/1e5,we=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Pe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Te=(t,e)=>n=>Boolean("string"==typeof n&&Pe.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Se=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(we);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},be={...ge,transform:t=>Math.round((t=>fe(0,255,t))(t))},Ae={test:Te("rgb","red"),parse:Se("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+be.transform(t)+", "+be.transform(e)+", "+be.transform(n)+", "+xe(ye.transform(i))+")"};const Ee={test:Te("#"),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:Ae.transform},Me=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Ce=Me("deg"),Ve=Me("%"),Re=Me("px"),ke=Me("vh"),De=Me("vw"),Le={...Ve,parse:t=>Ve.parse(t)/100,transform:t=>Ve.transform(100*t)},Be={test:Te("hsl","hue"),parse:Se("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+Ve.transform(xe(e))+", "+Ve.transform(xe(n))+", "+xe(ye.transform(i))+")"},Oe={test:t=>Ae.test(t)||Ee.test(t)||Be.test(t),parse:t=>Ae.test(t)?Ae.parse(t):Be.test(t)?Be.parse(t):Ee.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Ae.transform(t):Be.transform(t)},Fe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const je="number",Ie="color",Ue=/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 We(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(Ue,(t=>(Oe.test(t)?(i.color.push(o),s.push(Ie),n.push(Oe.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(je),n.push(parseFloat(t))),++o,"${}"))).split("${}");return{values:n,split:r,indexes:i,types:s}}function Ne(t){return We(t).values}function $e(t){const{split:e,types:n}=We(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===je?xe(t[o]):e===Ie?Oe.transform(t[o]):t[o]}return s}}const ze=t=>"number"==typeof t?0:t;const He={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(we)?.length||0)+(t.match(Fe)?.length||0)>0},parse:Ne,createTransformer:$e,getAnimatableNone:function(t){const e=Ne(t);return $e(t)(e.map(ze))}},Xe=new Set(["brightness","contrast","saturate","opacity"]);function Ye(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(we)||[];if(!i)return t;const s=n.replace(i,"");let o=Xe.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const Ke=/\b([a-z-]*)\(.*?\)/gu,Ge={...He,getAnimatableNone:t=>{const e=t.match(Ke);return e?e.map(Ye).join(" "):t}},_e={borderWidth:Re,borderTopWidth:Re,borderRightWidth:Re,borderBottomWidth:Re,borderLeftWidth:Re,borderRadius:Re,radius:Re,borderTopLeftRadius:Re,borderTopRightRadius:Re,borderBottomRightRadius:Re,borderBottomLeftRadius:Re,width:Re,maxWidth:Re,height:Re,maxHeight:Re,top:Re,right:Re,bottom:Re,left:Re,padding:Re,paddingTop:Re,paddingRight:Re,paddingBottom:Re,paddingLeft:Re,margin:Re,marginTop:Re,marginRight:Re,marginBottom:Re,marginLeft:Re,backgroundPositionX:Re,backgroundPositionY:Re},qe={rotate:Ce,rotateX:Ce,rotateY:Ce,rotateZ:Ce,scale:ve,scaleX:ve,scaleY:ve,scaleZ:ve,skew:Ce,skewX:Ce,skewY:Ce,distance:Re,translateX:Re,translateY:Re,translateZ:Re,x:Re,y:Re,z:Re,perspective:Re,transformPerspective:Re,opacity:ye,originX:Le,originY:Le,originZ:Re},Ze={...ge,transform:Math.round},Je={..._e,...qe,zIndex:Ze,size:Re,fillOpacity:ye,strokeOpacity:ye,numOctaves:Ze},Qe={...Je,color:Oe,backgroundColor:Oe,outlineColor:Oe,fill:Oe,stroke:Oe,borderColor:Oe,borderTopColor:Oe,borderRightColor:Oe,borderBottomColor:Oe,borderLeftColor:Oe,filter:Ge,WebkitFilter:Ge},tn=t=>Qe[t];function en(t,e){let n=tn(t);return n!==Ge&&(n=He),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const nn=new Set(["auto","none","0"]);const sn=t=>180*t/Math.PI,on=t=>{const e=sn(Math.atan2(t[1],t[0]));return an(e)},rn={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:on,rotateZ:on,skewX:t=>sn(Math.atan(t[1])),skewY:t=>sn(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},an=t=>((t%=360)<0&&(t+=360),t),un=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ln=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),cn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:un,scaleY:ln,scale:t=>(un(t)+ln(t))/2,rotateX:t=>an(sn(Math.atan2(t[6],t[5]))),rotateY:t=>an(sn(Math.atan2(-t[2],t[0]))),rotateZ:on,rotate:on,skewX:t=>sn(Math.atan(t[4])),skewY:t=>sn(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function hn(t){return t.includes("scale")?1:0}function dn(t,e){if(!t||"none"===t)return hn(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=cn,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=rn,s=e}if(!s)return hn(e);const o=i[e],r=s[1].split(",").map(pn);return"function"==typeof o?o(r):r[o]}function pn(t){return parseFloat(t.trim())}const mn=t=>t===ge||t===Re,fn=new Set(["x","y","z"]),gn=de.filter((t=>!fn.has(t)));const yn={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})=>dn(e,"x"),y:(t,{transform:e})=>dn(e,"y")};yn.translateX=yn.x,yn.translateY=yn.y;const vn=new Set;let xn=!1,wn=!1;function Pn(){if(wn){const t=Array.from(vn).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 gn.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)}))}wn=!1,xn=!1,vn.forEach((t=>t.complete())),vn.clear()}function Tn(){vn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(wn=!0)}))}class Sn{constructor(t,e,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(vn.add(this),xn||(xn=!0,yt.read(Tn),yt.resolveKeyframes(Pn))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;for(let s=0;s<t.length;s++)if(null===t[s])if(0===s){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])}else t[s]=t[s-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),vn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,vn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const bn=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),An=t=>e=>"string"==typeof e&&e.startsWith(t),En=An("--"),Mn=An("var(--"),Cn=t=>!!Mn(t)&&Vn.test(t.split("/*")[0].trim()),Vn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Rn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function kn(t,e,n=1){const[i,s]=function(t){const e=Rn.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 bn(t)?parseFloat(t):t}return Cn(s)?kn(s,e,n+1):s}const Dn=t=>e=>e.test(t),Ln=[ge,Re,Ve,Ce,De,ke,{test:t=>"auto"===t,parse:t=>t}],Bn=t=>Ln.find(Dn(t));class On extends Sn{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(),Cn(i))){const s=kn(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!me.has(n)||2!==t.length)return;const[i,s]=t,o=Bn(i),r=Bn(s);if(o!==r)if(mn(o)&&mn(r))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(i=t[e])?0===i:null===i||"none"===i||"0"===i||he(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&&!nn.has(e)&&We(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=en(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=yn[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]=yn[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 Fn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!He.test(t)&&"0"!==t||t.startsWith("url(")));function jn(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=Fn(s,e),a=Fn(o,e);return!(!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||st(n))&&i)}const In=t=>null!==t;function Un(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(In),o=e&&"loop"!==n&&e%2==1?0:s.length-1;return o&&void 0!==i?i:s[o]}class Wn{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",...r}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=St.now(),this.options={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:o,...r},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Tn(),Pn()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=St.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:r,onUpdate:a,isGenerator:u}=this.options;if(!u&&!jn(t,n,i,s)){if(Qt.current||!o)return a&&a(Un(t,this.options,e)),r&&r(),void this.resolveFinishedPromise();this.options.duration=0}const l=this.initPlayback(t,e);!1!==l&&(this._resolved={keyframes:t,finalKeyframe:e,...l},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function Nn(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 $n(t,e){return n=>n>0?e:t}const zn=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Hn=[Ee,Ae,Be];function Xn(t){const e=(n=t,Hn.find((t=>t.test(n))));var n;if(!Boolean(e))return!1;let i=e.parse(t);return e===Be&&(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=Nn(a,i,t+1/3),o=Nn(a,i,t),r=Nn(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 Yn=(t,e)=>{const n=Xn(t),i=Xn(e);if(!n||!i)return $n(t,e);const s={...n};return t=>(s.red=zn(n.red,i.red,t),s.green=zn(n.green,i.green,t),s.blue=zn(n.blue,i.blue,t),s.alpha=zt(n.alpha,i.alpha,t),Ae.transform(s))},Kn=(t,e)=>n=>e(t(n)),Gn=(...t)=>t.reduce(Kn),_n=new Set(["none","hidden"]);function qn(t,e){return n=>zt(t,e,n)}function Zn(t){return"number"==typeof t?qn:"string"==typeof t?Cn(t)?$n:Oe.test(t)?Yn:ti:Array.isArray(t)?Jn:"object"==typeof t?Oe.test(t)?Yn:Qn:$n}function Jn(t,e){const n=[...t],i=n.length,s=t.map(((t,n)=>Zn(t)(t,e[n])));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Qn(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=Zn(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const ti=(t,e)=>{const n=He.createTransformer(e),i=We(t),s=We(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?_n.has(t)&&!s.values.length||_n.has(e)&&!i.values.length?function(t,e){return _n.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Gn(Jn(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):$n(t,e)};function ei(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return zt(t,e,n);return Zn(t)(t,e)}function ni(t,e,n){const i=Math.max(e-5,0);return I(n-t(i),e-i)}const ii=100,si=10,oi=1,ri=0,ai=800,ui=.3,li=.3,ci={granular:.01,default:2},hi={granular:.005,default:.5},di=.01,pi=10,mi=.05,fi=1,gi=.001;function yi({duration:t=ai,bounce:e=ui,velocity:n=ri,mass:i=oi}){let s,o,r=1-e;r=fe(mi,fi,r),t=fe(di,pi,j(t)),r<1?(s=e=>{const i=e*r,s=i*t,o=i-n,a=xi(e,r),u=Math.exp(-s);return gi-o/a*u},o=e=>{const i=e*r*t,o=i*n+n,a=Math.pow(r,2)*Math.pow(e,2)*t,u=Math.exp(-i),l=xi(Math.pow(e,2),r);return(-s(e)+gi>0?-1:1)*((o-a)*u)/l}):(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<vi;n++)i-=t(i)/e(i);return i}(s,o,5/t);if(t=F(t),isNaN(a))return{stiffness:ii,damping:si,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*r*Math.sqrt(i*e),duration:t}}}const vi=12;function xi(t,e){return t*Math.sqrt(1-e*e)}const wi=["duration","bounce"],Pi=["stiffness","damping","mass"];function Ti(t,e){return e.some((e=>void 0!==t[e]))}function Si(t=li,e=ui){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:u,damping:l,mass:c,duration:h,velocity:d,isResolvedFromDuration:p}=function(t){let e={velocity:ri,stiffness:ii,damping:si,mass:oi,isResolvedFromDuration:!1,...t};if(!Ti(t,Pi)&&Ti(t,wi))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,o=2*fe(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:oi,stiffness:s,damping:o}}else{const n=yi(t);e={...e,...n,mass:oi},e.isResolvedFromDuration=!0}return e}({...n,velocity:-j(n.velocity||0)}),m=d||0,f=l/(2*Math.sqrt(u*c)),g=r-o,y=j(Math.sqrt(u/c)),v=Math.abs(g)<5;let x;if(i||(i=v?ci.granular:ci.default),s||(s=v?hi.granular:hi.default),f<1){const t=xi(y,f);x=e=>{const n=Math.exp(-f*y*e);return r-n*((m+f*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===f)x=t=>r-Math.exp(-y*t)*(g+(m+y*g)*t);else{const t=y*Math.sqrt(f*f-1);x=e=>{const n=Math.exp(-f*y*e),i=Math.min(t*e,300);return r-n*((m+f*y*g)*Math.sinh(i)+t*g*Math.cosh(i))/t}}const w={calculatedDuration:p&&h||null,next:t=>{const e=x(t);if(p)a.done=t>=h;else{let n=0;f<1&&(n=0===t?F(m):ni(x,t,e));const o=Math.abs(n)<=i,u=Math.abs(r-e)<=s;a.done=o&&u}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(lt(w),ut),e=Q((e=>w.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return w}function bi({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:u,restDelta:l=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},p=t=>void 0===a?u:void 0===u||Math.abs(a-t)<Math.abs(u-t)?a:u;let m=n*e;const f=h+m,g=void 0===r?f:r(f);g!==f&&(m=g-h);const y=t=>-m*Math.exp(-t/i),v=t=>g+y(t),x=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=l,d.value=d.done?g:n};let w,P;const T=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==u&&e>u)&&(w=t,P=Si({keyframes:[d.value,p(d.value)],velocity:ni(v,t,d.value),damping:s,stiffness:o,restDelta:l,restSpeed:c}))};return T(0),{calculatedDuration:null,next:t=>{let e=!1;return P||void 0!==w||(e=!0,x(t),T(t)),void 0!==w&&t>=w?P.next(t-w):(!e&&x(t),d)}}}Si.applyToOptions=t=>{const e=ct(t,100,Si);return t.ease=J()?e.ease:"easeOut",t.duration=F(e.duration),t.type="keyframes",t};const Ai=ee(.42,0,1,1),Ei=ee(0,0,.58,1),Mi=ee(.42,0,.58,1),Ci=t=>Array.isArray(t)&&"number"!=typeof t[0],Vi={linear:L,easeIn:Ai,easeInOut:Mi,easeOut:Ei,circIn:ue,circInOut:ce,circOut:le,backIn:oe,backInOut:re,backOut:se,anticipate:ae},Ri=t=>{if(_(t)){t.length;const[e,n,i,s]=t;return ee(e,n,i,s)}return"string"==typeof t?Vi[t]:t};function ki(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const o=t.length;if(e.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||ei,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]||L:e;o=Gn(t,o)}i.push(o)}return i}(e,i,s),u=a.length,l=n=>{if(r&&n<t[0])return e[0];let i=0;if(u>1)for(;i<t.length-2&&!(n<t[i+1]);i++);const s=B(t[i],t[i+1],n);return a[i](s)};return n?e=>l(fe(t[0],t[o-1],e)):l}function Di(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=B(0,e,i);t.push(zt(n,1,s))}}function Li(t){const e=[0];return Di(e,t.length-1),e}function Bi({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=Ci(i)?i.map(Ri):Ri(i),o={done:!1,value:e[0]},r=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Li(e),t),a=ki(r,e,{ease:Array.isArray(s)?s:(u=e,l=s,u.map((()=>l||Mi)).splice(0,u.length-1))});var u,l;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const Oi=t=>{const e=({timestamp:e})=>t(e);return{start:()=>yt.update(e,!0),stop:()=>vt(e),now:()=>xt.isProcessing?xt.timestamp:St.now()}},Fi={decay:bi,inertia:bi,tween:Bi,keyframes:Bi,spring:Si},ji=t=>t/100;class Ii extends Wn{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:i,keyframes:s}=this.options,o=i?.KeyframeResolver||Sn;this.resolver=new o(s,((t,e)=>this.onKeyframesResolved(t,e)),e,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,r=st(e)?e:Fi[e]||Bi;let a,u;r!==Bi&&"number"!=typeof t[0]&&(a=Gn(ji,ei(t[0],t[1])),t=[0,100]);const l=r({...this.options,keyframes:t});"mirror"===s&&(u=r({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=lt(l));const{calculatedDuration:c}=l,h=c+i;return{generator:l,mirroredGenerator:u,mapPercentToKeyframes:a,calculatedDuration:c,resolvedDuration:h,totalDuration:h*(n+1)-i}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:r,keyframes:a,calculatedDuration:u,totalDuration:l,resolvedDuration:c}=n;if(null===this.startTime)return s.next(0);const{delay:h,repeat:d,repeatType:p,repeatDelay:m,onUpdate:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=l);let v=this.currentTime,x=s;if(d){const t=Math.min(this.currentTime,l)/c;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,m&&(n-=m/c)):"mirror"===p&&(x=o)),v=fe(0,1,n)*c}const w=y?{done:!1,value:a[0]}:x.next(v);r&&(w.value=r(w.value));let{done:P}=w;y||null===u||(P=this.speed>=0?this.currentTime>=l:this.currentTime<=0);const T=null===this.holdTime&&("finished"===this.state||"running"===this.state&&P);return T&&void 0!==i&&(w.value=Un(a,this.options,i)),f&&f(w.value),T&&this.finish(),w}get duration(){const{resolved:t}=this;return t?j(t.calculatedDuration):0}get time(){return j(this.currentTime)}set time(t){t=F(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=j(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Oi,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const i=this.driver.now();null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=i):this.startTime=n??this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){this._resolved?(this.state="paused",this.holdTime=this.currentTime??0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}get finished(){return this.currentFinishedPromise}}function Ui(t){return new Ii(t)}const Wi=new Set(["opacity","clipPath","filter","transform"]),Ni=D((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const $i={anticipate:ae,backInOut:re,circInOut:ce};class zi extends Wn{constructor(t){super(t);const{name:e,motionValue:n,element:i,keyframes:s}=this.options;this.resolver=new On(s,((t,e)=>this.onKeyframesResolved(t,e)),e,n,i),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:n=300,times:i,ease:s,type:o,motionValue:r,name:a,startTime:u}=this.options;if(!r.owner||!r.owner.current)return!1;var l;if("string"==typeof s&&J()&&s in $i&&(s=$i[s]),st((l=this.options).type)||"spring"===l.type||!ht(l.ease)){const{onComplete:e,onUpdate:r,motionValue:a,element:u,...l}=this.options,c=function(t,e){const n=new Ii({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const s=[];let o=0;for(;!i.done&&o<2e4;)i=n.sample(o),s.push(i.value),o+=10;return{times:void 0,keyframes:s,duration:o-10,ease:"linear"}}(t,l);1===(t=c.keyframes).length&&(t[1]=t[0]),n=c.duration,i=c.times,s=c.ease,o="keyframes"}const c=it(r.owner.current,a,t,{...this.options,duration:n,times:i,ease:s});return c.startTime=u??this.calcStartTime(),this.pendingTimeline?(dt(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:n}=this.options;r.set(Un(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:n,times:i,type:o,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return j(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return j(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=F(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}get finished(){return this.resolved.animation.finished}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return L;const{animation:n}=e;dt(n,t)}else this.pendingTimeline=t;return L}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:i,type:s,ease:o,times:r}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:u,...l}=this.options,c=new Ii({...l,keyframes:n,duration:i,type:s,ease:o,times:r,isGenerator:!0}),h=F(this.time);t.setWithVelocity(c.sample(h-10).value,c.sample(h).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:o,type:r}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:u}=e.owner.getProps();return Ni()&&n&&Wi.has(n)&&("transform"!==n||!u)&&!a&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}}const Hi={type:"spring",stiffness:500,damping:25,restSpeed:10},Xi={type:"keyframes",duration:.8},Yi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ki=(t,{keyframes:e})=>e.length>2?Xi:pe.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Hi:Yi;const Gi=(t,e,n,i={},s,o)=>r=>{const a=at(i,t)||{},u=a.delay||i.delay||0;let{elapsed:l=0}=i;l-=F(u);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,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:n,staggerChildren:i,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:u,elapsed:l,...c}){return!!Object.keys(c).length})(a)||(c={...c,...Ki(t,c)}),c.duration&&(c.duration=F(c.duration)),c.repeatDelay&&(c.repeatDelay=F(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let h=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(c.duration=0,0===c.delay&&(h=!0)),(Qt.current||k.skipAnimations)&&(h=!0,c.duration=0,c.delay=0),c.allowFlatten=!a.type&&!a.ease,h&&!o&&void 0!==e.get()){const t=Un(c.keyframes,a);if(void 0!==t)return yt.update((()=>{c.onUpdate(t),c.onComplete()})),new N([])}return!o&&zi.supports(c)?new zi(c):new Ii(c)};function _i(t,e,n){const i=Jt(t)?t:Wt(t);return i.start(Gi("",i,e,n)),i.animation}const qi=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Zi="framerAppearId",Ji="data-"+qi(Zi);function Qi(t){return t.props[Ji]}function ts(t){return t instanceof SVGElement&&"svg"!==t.tagName}const es=(t,e)=>t.depth-e.depth;class ns{constructor(){this.children=[],this.isDirty=!1}add(t){C(this.children,t),this.isDirty=!0}remove(t){V(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(es),this.isDirty=!1,this.children.forEach(t)}}function is(t,e){const n=St.now(),i=({timestamp:s})=>{const o=s-n;o>=e&&(vt(i),t(o-e))};return yt.read(i,!0),()=>vt(i)}const ss=t=>Array.isArray(t);function os(t){const e=Jt(t)?t.get():t;return n=e,Boolean(n&&"object"==typeof n&&n.mix&&n.toValue)?e.toValue():e;var n}const rs=["TopLeft","TopRight","BottomLeft","BottomRight"],as=rs.length,us=t=>"string"==typeof t?parseFloat(t):t,ls=t=>"number"==typeof t||Re.test(t);function cs(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const hs=ps(0,.5,le),ds=ps(.5,.95,L);function ps(t,e,n){return i=>i<t?0:i>e?1:n(B(t,e,i))}function ms(t,e){t.min=e.min,t.max=e.max}function fs(t,e){ms(t.x,e.x),ms(t.y,e.y)}function gs(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function ys(t){return void 0===t||1===t}function vs({scale:t,scaleX:e,scaleY:n}){return!ys(t)||!ys(e)||!ys(n)}function xs(t){return vs(t)||ws(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function ws(t){return Ps(t.x)||Ps(t.y)}function Ps(t){return t&&"0%"!==t}function Ts(t,e,n){return n+e*(t-n)}function Ss(t,e,n,i,s){return void 0!==s&&(t=Ts(t,s,i)),Ts(t,n,i)+e}function bs(t,e=0,n=1,i,s){t.min=Ss(t.min,e,n,i,s),t.max=Ss(t.max,e,n,i,s)}function As(t,{x:e,y:n}){bs(t.x,e.translate,e.scale,e.originPoint),bs(t.y,n.translate,n.scale,n.originPoint)}const Es=.999999999999,Ms=1.0000000000001;function Cs(t,e){t.min=t.min+e,t.max=t.max+e}function Vs(t,e,n,i,s=.5){bs(t,e,n,zt(t.min,t.max,s),i)}function Rs(t,e){Vs(t.x,e.x,e.scaleX,e.scale,e.originX),Vs(t.y,e.y,e.scaleY,e.scale,e.originY)}function ks(t,e,n,i,s){return t=Ts(t-=e,1/n,i),void 0!==s&&(t=Ts(t,1/s,i)),t}function Ds(t,e,[n,i,s],o,r){!function(t,e=0,n=1,i=.5,s,o=t,r=t){Ve.test(e)&&(e=parseFloat(e),e=zt(r.min,r.max,e/100)-r.min);if("number"!=typeof e)return;let a=zt(o.min,o.max,i);t===o&&(a-=e),t.min=ks(t.min,e,n,a,s),t.max=ks(t.max,e,n,a,s)}(t,e[n],e[i],e[s],e.scale,o,r)}const Ls=["x","scaleX","originX"],Bs=["y","scaleY","originY"];function Os(t,e,n,i){Ds(t.x,e,Ls,n?n.x:void 0,i?i.x:void 0),Ds(t.y,e,Bs,n?n.y:void 0,i?i.y:void 0)}const Fs=()=>({x:{min:0,max:0},y:{min:0,max:0}});function js(t){return 0===t.translate&&1===t.scale}function Is(t){return js(t.x)&&js(t.y)}function Us(t,e){return t.min===e.min&&t.max===e.max}function Ws(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Ns(t,e){return Ws(t.x,e.x)&&Ws(t.y,e.y)}function $s(t){return Ht(t.x)/Ht(t.y)}function zs(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Hs{constructor(){this.members=[]}add(t){C(this.members,t),t.scheduleRender()}remove(t){if(V(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 n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.anima