framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 97.5 kB
JavaScript
import{x as t,u as e,y as s,z as i,A as n,B as o,C as r,D as a,E as l,F as h,G as u,H as c,I as d,J as p,K as m,t as f,d as g,b as y,o as v,M as x,m as P,r as T,N as S,c as w,i as A,l as b,f as E,p as V,O as M,Q as D,g as C,s as k,P as R,L,S as B,R as F,T as j,a as O,U,n as I,V as N,W as K,v as $,X as W,Y as z,q as Y,h as X,w as G,j as H,k as q}from"./size-rollup-dom-max-assets.js";import{jsx as _}from"react/jsx-runtime";import{useContext as Z,useId as J,useEffect as Q,useCallback as tt,Component as et,Fragment as st}from"react";function it(t,e){-1===t.indexOf(e)&&t.push(e)}function nt(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const ot={skipAnimations:!1,useManualTiming:!1};function rt(t){let e;return()=>(void 0===e&&(e=t()),e)}const at=(t,e,s)=>{const i=e-t;return 0===i?1:(s-t)/i};class lt{constructor(){this.subscriptions=[]}add(t){return it(this.subscriptions,t),()=>nt(this.subscriptions,t)}notify(t,e,s){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](t,e,s);else for(let n=0;n<i;n++){const i=this.subscriptions[n];i&&i(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ht=t=>1e3*t,ut=t=>t/1e3;function ct(t,e){return e?t*(1e3/e):0}const dt=rt((()=>void 0!==window.ScrollTimeline));class pt{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 s=0;s<this.animations.length;s++)this.animations[s][t]=e}attachTimeline(t,e){const s=this.animations.map((s=>dt()&&s.attachTimeline?s.attachTimeline(t):"function"==typeof e?e(s):void 0));return()=>{s.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 mt extends pt{then(t,e){return this.finished.finally(t).then((()=>{}))}}const ft=t=>Array.isArray(t)&&"number"==typeof t[0],gt={};function yt(t,e){const s=rt(t);return()=>gt[e]??s()}const vt=yt((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),xt=(t,e,s=10)=>{let i="";const n=Math.max(Math.round(e/s),2);for(let e=0;e<n;e++)i+=t(e/(n-1))+", ";return`linear(${i.substring(0,i.length-2)})`},Pt=([t,e,s,i])=>`cubic-bezier(${t}, ${e}, ${s}, ${i})`,Tt={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pt([0,.65,.55,1]),circOut:Pt([.55,0,1,.45]),backIn:Pt([.31,.01,.66,-.59]),backOut:Pt([.33,1.53,.69,.99])};function St(t,e){return t?"function"==typeof t&&vt()?xt(t,e):ft(t)?Pt(t):Array.isArray(t)?t.map((t=>St(t,e)||Tt.easeOut)):Tt[t]:void 0}function wt(t,e,s,{delay:i=0,duration:n=300,repeat:o=0,repeatType:r="loop",ease:a="easeInOut",times:l}={},h=void 0){const u={[e]:s};l&&(u.offset=l);const c=St(a,n);Array.isArray(c)&&(u.easing=c);return t.animate(u,{delay:i,duration:n,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal",pseudoElement:h})}function At(t){return"function"==typeof t&&"applyToOptions"in t}function bt(t,e){return t?.[e]??t?.default??t}const Et=2e4;function Vt(t){let e=0;let s=t.next(e);for(;!s.done&&e<Et;)e+=50,s=t.next(e);return e>=Et?1/0:e}function Mt(t){return Boolean("function"==typeof t&&vt()||!t||"string"==typeof t&&(t in Tt||vt())||ft(t)||Array.isArray(t)&&t.every(Mt))}function Dt(t,e){t.timeline=e,t.onfinish=null}let Ct;function kt(){Ct=void 0}const Rt={now:()=>(void 0===Ct&&Rt.set(t.isProcessing||ot.useManualTiming?t.timestamp:performance.now()),Ct),set:t=>{Ct=t,queueMicrotask(kt)}},Lt={x:!1,y:!1};function Bt(){return Lt.x||Lt.y}function Ft(t,e){const s=function(t,e,s){if(t instanceof EventTarget)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const n=s?.[t]??i.querySelectorAll(t);return n?Array.from(n):[]}return Array.from(t)}(t),i=new AbortController;return[s,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function jt(t){return!("touch"===t.pointerType||Bt())}const Ot=(t,e)=>!!e&&(t===e||Ot(t,e.parentElement)),Ut=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,It=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Nt=new WeakSet;function Kt(t){return e=>{"Enter"===e.key&&t(e)}}function $t(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Wt(t){return Ut(t)&&!Bt()}function zt(t,e,s={}){const[i,n,o]=Ft(t,s),r=t=>{const i=t.currentTarget;if(!Wt(t)||Nt.has(i))return;Nt.add(i);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Wt(t)&&Nt.has(i)&&(Nt.delete(i),"function"==typeof o&&o(t,{success:e}))},a=t=>{r(t,i===window||i===document||s.useGlobalTarget||Ot(i,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,n),window.addEventListener("pointercancel",l,n)};return i.forEach((t=>{var e;(s.useGlobalTarget?window:t).addEventListener("pointerdown",r,n),t instanceof HTMLElement&&(t.addEventListener("focus",(t=>((t,e)=>{const s=t.currentTarget;if(!s)return;const i=Kt((()=>{if(Nt.has(s))return;$t(s,"down");const t=Kt((()=>{$t(s,"up")}));s.addEventListener("keyup",t,e),s.addEventListener("blur",(()=>$t(s,"cancel")),e)}));s.addEventListener("keydown",i,e),s.addEventListener("blur",(()=>s.removeEventListener("keydown",i)),e)})(t,n))),e=t,It.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),o}class Yt{constructor(t,e={}){this.version="12.7.3",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const s=Rt.now();this.updatedAt!==s&&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=Rt.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,s){this.events[t]||(this.events[t]=new lt);const i=this.events[t].add(s);return"change"===t?()=>{i(),e.read((()=>{this.events.change.getSize()||this.stop()}))}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}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 this.current}getPrevious(){return this.prev}getVelocity(){const t=Rt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ct(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 Xt(t,e){return new Yt(t,e)}class Gt{constructor(t){this.isMounted=!1,this.node=t}update(){}}const Ht=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t;function qt(t,e,i,n){if(t===e&&i===n)return s;const o=e=>function(t,e,s,i,n){let o,r,a=0;do{r=e+(s-e)/2,o=Ht(r,i,n)-t,o>0?s=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:Ht(o(t),e,n)}const _t=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Zt=t=>e=>1-t(1-e),Jt=qt(.33,1.53,.69,.99),Qt=Zt(Jt),te=_t(Qt),ee=t=>(t*=2)<1?.5*Qt(t):.5*(2-Math.pow(2,-10*(t-1))),se=t=>1-Math.sin(Math.acos(t)),ie=Zt(se),ne=_t(se),oe=t=>/^0[^.\s]+$/u.test(t);const re=new Set(["width","height","top","left","right","bottom",...i]),ae=t=>Math.round(1e5*t)/1e5,le=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const he=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ue=(t,e)=>s=>Boolean("string"==typeof s&&he.test(s)&&s.startsWith(t)||e&&!function(t){return null==t}(s)&&Object.prototype.hasOwnProperty.call(s,e)),ce=(t,e,s)=>i=>{if("string"!=typeof i)return i;const[n,o,r,a]=i.match(le);return{[t]:parseFloat(n),[e]:parseFloat(o),[s]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},de={...n,transform:t=>Math.round((t=>r(0,255,t))(t))},pe={test:ue("rgb","red"),parse:ce("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:i=1})=>"rgba("+de.transform(t)+", "+de.transform(e)+", "+de.transform(s)+", "+ae(o.transform(i))+")"};const me={test:ue("#"),parse:function(t){let e="",s="",i="",n="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),i=t.substring(5,7),n=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),i=t.substring(3,4),n=t.substring(4,5),e+=e,s+=s,i+=i,n+=n),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:n?parseInt(n,16)/255:1}},transform:pe.transform},fe={test:ue("hsl","hue"),parse:ce("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:i=1})=>"hsla("+Math.round(t)+", "+a.transform(ae(e))+", "+a.transform(ae(s))+", "+ae(o.transform(i))+")"},ge={test:t=>pe.test(t)||me.test(t)||fe.test(t),parse:t=>pe.test(t)?pe.parse(t):fe.test(t)?fe.parse(t):me.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?pe.transform(t):fe.transform(t)},ye=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const ve="number",xe="color",Pe=/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 Te(t){const e=t.toString(),s=[],i={color:[],number:[],var:[]},n=[];let o=0;const r=e.replace(Pe,(t=>(ge.test(t)?(i.color.push(o),n.push(xe),s.push(ge.parse(t))):t.startsWith("var(")?(i.var.push(o),n.push("var"),s.push(t)):(i.number.push(o),n.push(ve),s.push(parseFloat(t))),++o,"${}"))).split("${}");return{values:s,split:r,indexes:i,types:n}}function Se(t){return Te(t).values}function we(t){const{split:e,types:s}=Te(t),i=e.length;return t=>{let n="";for(let o=0;o<i;o++)if(n+=e[o],void 0!==t[o]){const e=s[o];n+=e===ve?ae(t[o]):e===xe?ge.transform(t[o]):t[o]}return n}}const Ae=t=>"number"==typeof t?0:t;const be={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(le)?.length||0)+(t.match(ye)?.length||0)>0},parse:Se,createTransformer:we,getAnimatableNone:function(t){const e=Se(t);return we(t)(e.map(Ae))}},Ee=new Set(["brightness","contrast","saturate","opacity"]);function Ve(t){const[e,s]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=s.match(le)||[];if(!i)return t;const n=s.replace(i,"");let o=Ee.has(e)?1:0;return i!==s&&(o*=100),e+"("+o+n+")"}const Me=/\b([a-z-]*)\(.*?\)/gu,De={...be,getAnimatableNone:t=>{const e=t.match(Me);return e?e.map(Ve).join(" "):t}},Ce={...l,color:ge,backgroundColor:ge,outlineColor:ge,fill:ge,stroke:ge,borderColor:ge,borderTopColor:ge,borderRightColor:ge,borderBottomColor:ge,borderLeftColor:ge,filter:De,WebkitFilter:De},ke=t=>Ce[t];function Re(t,e){let s=ke(t);return s!==De&&(s=be),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const Le=new Set(["auto","none","0"]);const Be=t=>180*t/Math.PI,Fe=t=>{const e=Be(Math.atan2(t[1],t[0]));return Oe(e)},je={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Fe,rotateZ:Fe,skewX:t=>Be(Math.atan(t[1])),skewY:t=>Be(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Oe=t=>((t%=360)<0&&(t+=360),t),Ue=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Ie=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ne={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ue,scaleY:Ie,scale:t=>(Ue(t)+Ie(t))/2,rotateX:t=>Oe(Be(Math.atan2(t[6],t[5]))),rotateY:t=>Oe(Be(Math.atan2(-t[2],t[0]))),rotateZ:Fe,rotate:Fe,skewX:t=>Be(Math.atan(t[4])),skewY:t=>Be(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ke(t){return t.includes("scale")?1:0}function $e(t,e){if(!t||"none"===t)return Ke(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,n;if(s)i=Ne,n=s;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=je,n=e}if(!n)return Ke(e);const o=i[e],r=n[1].split(",").map(We);return"function"==typeof o?o(r):r[o]}function We(t){return parseFloat(t.trim())}const ze=t=>t===n||t===h,Ye=new Set(["x","y","z"]),Xe=i.filter((t=>!Ye.has(t)));const Ge={width:({x:t},{paddingLeft:e="0",paddingRight:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),height:({y:t},{paddingTop:e="0",paddingBottom:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),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})=>$e(e,"x"),y:(t,{transform:e})=>$e(e,"y")};Ge.translateX=Ge.x,Ge.translateY=Ge.y;const He=new Set;let qe=!1,_e=!1;function Ze(){if(_e){const t=Array.from(He).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),s=new Map;e.forEach((t=>{const e=function(t){const e=[];return Xe.forEach((s=>{const i=t.getValue(s);void 0!==i&&(e.push([s,i.get()]),i.set(s.startsWith("scale")?1:0))})),e}(t);e.length&&(s.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=s.get(t);e&&e.forEach((([e,s])=>{t.getValue(e)?.set(s)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}_e=!1,qe=!1,He.forEach((t=>t.complete())),He.clear()}function Je(){He.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(_e=!0)}))}class Qe{constructor(t,e,s,i,n,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=s,this.motionValue=i,this.element=n,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(He.add(this),qe||(qe=!0,e.read(Je),e.resolveKeyframes(Ze))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:s,motionValue:i}=this;for(let n=0;n<t.length;n++)if(null===t[n])if(0===n){const n=i?.get(),o=t[t.length-1];if(void 0!==n)t[0]=n;else if(s&&e){const i=s.readValue(e,o);null!=i&&(t[0]=i)}void 0===t[0]&&(t[0]=o),i&&void 0===n&&i.set(t[0])}else t[n]=t[n-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),He.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,He.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const ts=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),es=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ss(t,e,s=1){const[i,n]=function(t){const e=es.exec(t);if(!e)return[,];const[,s,i,n]=e;return[`--${s??i}`,n]}(t);if(!i)return;const o=window.getComputedStyle(e).getPropertyValue(i);if(o){const t=o.trim();return ts(t)?parseFloat(t):t}return u(n)?ss(n,e,s+1):n}const is=t=>e=>e.test(t),ns=[n,h,a,c,d,p,{test:t=>"auto"===t,parse:t=>t}],os=t=>ns.find(is(t));class rs extends Qe{constructor(t,e,s,i,n){super(t,e,s,i,n,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:s}=this;if(!e||!e.current)return;super.readKeyframes();for(let s=0;s<t.length;s++){let i=t[s];if("string"==typeof i&&(i=i.trim(),u(i))){const n=ss(i,e.current);void 0!==n&&(t[s]=n),s===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!re.has(s)||2!==t.length)return;const[i,n]=t,o=os(i),r=os(n);if(o!==r)if(ze(o)&&ze(r))for(let e=0;e<t.length;e++){const s=t[e];"string"==typeof s&&(t[e]=parseFloat(s))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,s=[];for(let e=0;e<t.length;e++)("number"==typeof(i=t[e])?0===i:null===i||"none"===i||"0"===i||oe(i))&&s.push(e);var i;s.length&&function(t,e,s){let i,n=0;for(;n<t.length&&!i;){const e=t[n];"string"==typeof e&&!Le.has(e)&&Te(e).values.length&&(i=t[n]),n++}if(i&&s)for(const n of e)t[n]=Re(s,i)}(t,s,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:s}=this;if(!t||!t.current)return;"height"===s&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ge[s](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&t.getValue(s,i).jump(i,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const i=t.getValue(e);i&&i.jump(this.measuredOrigin,!1);const n=s.length-1,o=s[n];s[n]=Ge[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach((([e,s])=>{t.getValue(e).set(s)})),this.resolveNoneKeyframes()}}const as=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!be.test(t)&&"0"!==t||t.startsWith("url(")));function ls(t,e,s,i){const n=t[0];if(null===n)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=as(n,e),a=as(o,e);return!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}(t)||("spring"===s||At(s))&&i)}const hs=t=>null!==t;function us(t,{repeat:e,repeatType:s="loop"},i){const n=t.filter(hs),o=e&&"loop"!==s&&e%2==1?0:n.length-1;return o&&void 0!==i?i:n[o]}class cs{constructor({autoplay:t=!0,delay:e=0,type:s="keyframes",repeat:i=0,repeatDelay:n=0,repeatType:o="loop",...r}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Rt.now(),this.options={autoplay:t,delay:e,type:s,repeat:i,repeatDelay:n,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||(Je(),Ze()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Rt.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:n,delay:o,onComplete:r,onUpdate:a,isGenerator:l}=this.options;if(!l&&!ls(t,s,i,n)){if(!o)return a&&a(us(t,this.options,e)),r&&r(),void this.resolveFinishedPromise();this.options.duration=0}const h=this.initPlayback(t,e);!1!==h&&(this._resolved={keyframes:t,finalKeyframe:e,...h},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}))}}const ds=(t,e,s)=>t+(e-t)*s;function ps(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function ms(t,e){return s=>s>0?e:t}const fs=(t,e,s)=>{const i=t*t,n=s*(e*e-i)+i;return n<0?0:Math.sqrt(n)},gs=[me,pe,fe];function ys(t){const e=(s=t,gs.find((t=>t.test(s))));var s;if(!Boolean(e))return!1;let i=e.parse(t);return e===fe&&(i=function({hue:t,saturation:e,lightness:s,alpha:i}){t/=360,s/=100;let n=0,o=0,r=0;if(e/=100){const i=s<.5?s*(1+e):s+e-s*e,a=2*s-i;n=ps(a,i,t+1/3),o=ps(a,i,t),r=ps(a,i,t-1/3)}else n=o=r=s;return{red:Math.round(255*n),green:Math.round(255*o),blue:Math.round(255*r),alpha:i}}(i)),i}const vs=(t,e)=>{const s=ys(t),i=ys(e);if(!s||!i)return ms(t,e);const n={...s};return t=>(n.red=fs(s.red,i.red,t),n.green=fs(s.green,i.green,t),n.blue=fs(s.blue,i.blue,t),n.alpha=ds(s.alpha,i.alpha,t),pe.transform(n))},xs=(t,e)=>s=>e(t(s)),Ps=(...t)=>t.reduce(xs),Ts=new Set(["none","hidden"]);function Ss(t,e){return s=>ds(t,e,s)}function ws(t){return"number"==typeof t?Ss:"string"==typeof t?u(t)?ms:ge.test(t)?vs:Es:Array.isArray(t)?As:"object"==typeof t?ge.test(t)?vs:bs:ms}function As(t,e){const s=[...t],i=s.length,n=t.map(((t,s)=>ws(t)(t,e[s])));return t=>{for(let e=0;e<i;e++)s[e]=n[e](t);return s}}function bs(t,e){const s={...t,...e},i={};for(const n in s)void 0!==t[n]&&void 0!==e[n]&&(i[n]=ws(t[n])(t[n],e[n]));return t=>{for(const e in i)s[e]=i[e](t);return s}}const Es=(t,e)=>{const s=be.createTransformer(e),i=Te(t),n=Te(e);return i.indexes.var.length===n.indexes.var.length&&i.indexes.color.length===n.indexes.color.length&&i.indexes.number.length>=n.indexes.number.length?Ts.has(t)&&!n.values.length||Ts.has(e)&&!i.values.length?function(t,e){return Ts.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}(t,e):Ps(As(function(t,e){const s=[],i={color:0,var:0,number:0};for(let n=0;n<e.values.length;n++){const o=e.types[n],r=t.indexes[o][i[o]],a=t.values[r]??0;s[n]=a,i[o]++}return s}(i,n),n.values),s):ms(t,e)};function Vs(t,e,s){if("number"==typeof t&&"number"==typeof e&&"number"==typeof s)return ds(t,e,s);return ws(t)(t,e)}function Ms(t,e,s){const i=Math.max(e-5,0);return ct(s-t(i),e-i)}const Ds=100,Cs=10,ks=1,Rs=0,Ls=800,Bs=.3,Fs=.3,js={granular:.01,default:2},Os={granular:.005,default:.5},Us=.01,Is=10,Ns=.05,Ks=1,$s=.001;function Ws({duration:t=Ls,bounce:e=Bs,velocity:s=Rs,mass:i=ks}){let n,o,a=1-e;a=r(Ns,Ks,a),t=r(Us,Is,ut(t)),a<1?(n=e=>{const i=e*a,n=i*t,o=i-s,r=Ys(e,a),l=Math.exp(-n);return $s-o/r*l},o=e=>{const i=e*a*t,o=i*s+s,r=Math.pow(a,2)*Math.pow(e,2)*t,l=Math.exp(-i),h=Ys(Math.pow(e,2),a);return(-n(e)+$s>0?-1:1)*((o-r)*l)/h}):(n=e=>Math.exp(-e*t)*((e-s)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(s-e)));const l=function(t,e,s){let i=s;for(let s=1;s<zs;s++)i-=t(i)/e(i);return i}(n,o,5/t);if(t=ht(t),isNaN(l))return{stiffness:Ds,damping:Cs,duration:t};{const e=Math.pow(l,2)*i;return{stiffness:e,damping:2*a*Math.sqrt(i*e),duration:t}}}const zs=12;function Ys(t,e){return t*Math.sqrt(1-e*e)}const Xs=["duration","bounce"],Gs=["stiffness","damping","mass"];function Hs(t,e){return e.some((e=>void 0!==t[e]))}function qs(t=Fs,e=Bs){const s="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:n}=s;const o=s.keyframes[0],a=s.keyframes[s.keyframes.length-1],l={done:!1,value:o},{stiffness:h,damping:u,mass:c,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:Rs,stiffness:Ds,damping:Cs,mass:ks,isResolvedFromDuration:!1,...t};if(!Hs(t,Gs)&&Hs(t,Xs))if(t.visualDuration){const s=t.visualDuration,i=2*Math.PI/(1.2*s),n=i*i,o=2*r(.05,1,1-(t.bounce||0))*Math.sqrt(n);e={...e,mass:ks,stiffness:n,damping:o}}else{const s=Ws(t);e={...e,...s,mass:ks},e.isResolvedFromDuration=!0}return e}({...s,velocity:-ut(s.velocity||0)}),f=p||0,g=u/(2*Math.sqrt(h*c)),y=a-o,v=ut(Math.sqrt(h/c)),x=Math.abs(y)<5;let P;if(i||(i=x?js.granular:js.default),n||(n=x?Os.granular:Os.default),g<1){const t=Ys(v,g);P=e=>{const s=Math.exp(-g*v*e);return a-s*((f+g*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===g)P=t=>a-Math.exp(-v*t)*(y+(f+v*y)*t);else{const t=v*Math.sqrt(g*g-1);P=e=>{const s=Math.exp(-g*v*e),i=Math.min(t*e,300);return a-s*((f+g*v*y)*Math.sinh(i)+t*y*Math.cosh(i))/t}}const T={calculatedDuration:m&&d||null,next:t=>{const e=P(t);if(m)l.done=t>=d;else{let s=0;g<1&&(s=0===t?ht(f):Ms(P,t,e));const o=Math.abs(s)<=i,r=Math.abs(a-e)<=n;l.done=o&&r}return l.value=l.done?a:e,l},toString:()=>{const t=Math.min(Vt(T),Et),e=xt((e=>T.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return T}function _s({keyframes:t,velocity:e=0,power:s=.8,timeConstant:i=325,bounceDamping:n=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:h=.5,restSpeed:u}){const c=t[0],d={done:!1,value:c},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=s*e;const f=c+m,g=void 0===r?f:r(f);g!==f&&(m=g-c);const y=t=>-m*Math.exp(-t/i),v=t=>g+y(t),x=t=>{const e=y(t),s=v(t);d.done=Math.abs(e)<=h,d.value=d.done?g:s};let P,T;const S=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(P=t,T=qs({keyframes:[d.value,p(d.value)],velocity:Ms(v,t,d.value),damping:n,stiffness:o,restDelta:h,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==P||(e=!0,x(t),S(t)),void 0!==P&&t>=P?T.next(t-P):(!e&&x(t),d)}}}qs.applyToOptions=t=>{const e=function(t,e=100,s){const i=s({...t,keyframes:[0,e]}),n=Math.min(Vt(i),Et);return{type:"keyframes",ease:t=>i.next(n*t).value/e,duration:ut(n)}}(t,100,qs);return t.ease=vt()?e.ease:"easeOut",t.duration=ht(e.duration),t.type="keyframes",t};const Zs=qt(.42,0,1,1),Js=qt(0,0,.58,1),Qs=qt(.42,0,.58,1),ti={linear:s,easeIn:Zs,easeInOut:Qs,easeOut:Js,circIn:se,circInOut:ne,circOut:ie,backIn:Qt,backInOut:te,backOut:Jt,anticipate:ee},ei=t=>{if(ft(t)){t.length;const[e,s,i,n]=t;return qt(e,s,i,n)}return"string"==typeof t?ti[t]:t};function si(t,e,{clamp:i=!0,ease:n,mixer:o}={}){const a=t.length;if(e.length,1===a)return()=>e[0];if(2===a&&e[0]===e[1])return()=>e[1];const l=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const h=function(t,e,i){const n=[],o=i||Vs,r=t.length-1;for(let i=0;i<r;i++){let r=o(t[i],t[i+1]);if(e){const t=Array.isArray(e)?e[i]||s:e;r=Ps(t,r)}n.push(r)}return n}(e,n,o),u=h.length,c=s=>{if(l&&s<t[0])return e[0];let i=0;if(u>1)for(;i<t.length-2&&!(s<t[i+1]);i++);const n=at(t[i],t[i+1],s);return h[i](n)};return i?e=>c(r(t[0],t[a-1],e)):c}function ii(t){const e=[0];return function(t,e){const s=t[t.length-1];for(let i=1;i<=e;i++){const n=at(0,e,i);t.push(ds(s,1,n))}}(e,t.length-1),e}function ni({duration:t=300,keyframes:e,times:s,ease:i="easeInOut"}){const n=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(ei):ei(i),o={done:!1,value:e[0]},r=function(t,e){return t.map((t=>t*e))}(s&&s.length===e.length?s:ii(e),t),a=si(r,e,{ease:Array.isArray(n)?n:(l=e,h=n,l.map((()=>h||Qs)).splice(0,l.length-1))});var l,h;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const oi=s=>{const i=({timestamp:t})=>s(t);return{start:()=>e.update(i,!0),stop:()=>m(i),now:()=>t.isProcessing?t.timestamp:Rt.now()}},ri={decay:_s,inertia:_s,tween:ni,keyframes:ni,spring:qs},ai=t=>t/100;class li extends cs{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:s,element:i,keyframes:n}=this.options,o=i?.KeyframeResolver||Qe;this.resolver=new o(n,((t,e)=>this.onKeyframesResolved(t,e)),e,s,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:s=0,repeatDelay:i=0,repeatType:n,velocity:o=0}=this.options,r=At(e)?e:ri[e]||ni;let a,l;r!==ni&&"number"!=typeof t[0]&&(a=Ps(ai,Vs(t[0],t[1])),t=[0,100]);const h=r({...this.options,keyframes:t});"mirror"===n&&(l=r({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===h.calculatedDuration&&(h.calculatedDuration=Vt(h));const{calculatedDuration:u}=h,c=u+i;return{generator:h,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:c,totalDuration:c*(s+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:s}=this;if(!s){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:i,generator:n,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:h,totalDuration:u,resolvedDuration:c}=s;if(null===this.startTime)return n.next(0);const{delay:d,repeat:p,repeatType:m,repeatDelay:f,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/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 y=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>u;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let x=this.currentTime,P=n;if(p){const t=Math.min(this.currentTime,u)/c;let e=Math.floor(t),s=t%1;!s&&t>=1&&(s=1),1===s&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===m?(s=1-s,f&&(s-=f/c)):"mirror"===m&&(P=o)),x=r(0,1,s)*c}const T=v?{done:!1,value:l[0]}:P.next(x);a&&(T.value=a(T.value));let{done:S}=T;v||null===h||(S=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return w&&void 0!==i&&(T.value=us(l,this.options,i)),g&&g(T.value),w&&this.finish(),T}get duration(){const{resolved:t}=this;return t?ut(t.calculatedDuration):0}get time(){return ut(this.currentTime)}set time(t){t=ht(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=ut(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:s}=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=s??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}}const hi=new Set(["opacity","clipPath","filter","transform"]),ui=rt((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const ci={anticipate:ee,backInOut:te,circInOut:ne};class di extends cs{constructor(t){super(t);const{name:e,motionValue:s,element:i,keyframes:n}=this.options;this.resolver=new rs(n,((t,e)=>this.onKeyframesResolved(t,e)),e,s,i),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:s=300,times:i,ease:n,type:o,motionValue:r,name:a,startTime:l}=this.options;if(!r.owner||!r.owner.current)return!1;var h;if("string"==typeof n&&vt()&&n in ci&&(n=ci[n]),At((h=this.options).type)||"spring"===h.type||!Mt(h.ease)){const{onComplete:e,onUpdate:r,motionValue:a,element:l,...h}=this.options,u=function(t,e){const s=new li({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const n=[];let o=0;for(;!i.done&&o<2e4;)i=s.sample(o),n.push(i.value),o+=10;return{times:void 0,keyframes:n,duration:o-10,ease:"linear"}}(t,h);1===(t=u.keyframes).length&&(t[1]=t[0]),s=u.duration,i=u.times,n=u.ease,o="keyframes"}const u=wt(r.owner.current,a,t,{...this.options,duration:s,times:i,ease:n});return u.startTime=l??this.calcStartTime(),this.pendingTimeline?(Dt(u,this.pendingTimeline),this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:s}=this.options;r.set(us(t,this.options,e)),s&&s(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:i,type:o,ease:n,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return ut(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return ut(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:s}=e;s.currentTime=ht(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:s}=e;s.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 s;const{animation:i}=e;Dt(i,t)}else this.pendingTimeline=t;return s}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:s,duration:i,type:n,ease:o,times:r}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:l,...h}=this.options,u=new li({...h,keyframes:s,duration:i,type:n,ease:o,times:r,isGenerator:!0}),c=ht(this.time);t.setWithVelocity(u.sample(c-10).value,u.sample(c).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:s,repeatDelay:i,repeatType:n,damping:o,type:r}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return ui()&&s&&hi.has(s)&&("transform"!==s||!l)&&!a&&!i&&"mirror"!==n&&0!==o&&"inertia"!==r}}const pi={type:"spring",stiffness:500,damping:25,restSpeed:10},mi={type:"keyframes",duration:.8},fi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},gi=(t,{keyframes:e})=>e.length>2?mi:f.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:pi:fi;const yi=(t,s,i,n={},o,r)=>a=>{const l=bt(n,t)||{},h=l.delay||n.delay||0;let{elapsed:u=0}=n;u-=ht(h);let c={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...l,delay:-u,onUpdate:t=>{s.set(t),l.onUpdate&&l.onUpdate(t)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:s,element:r?void 0:o};(function({when:t,delay:e,delayChildren:s,staggerChildren:i,staggerDirection:n,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length})(l)||(c={...c,...gi(t,c)}),c.duration&&(c.duration=ht(c.duration)),c.repeatDelay&&(c.repeatDelay=ht(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(c.duration=0,0===c.delay&&(d=!0)),c.allowFlatten=!l.type&&!l.ease,d&&!r&&void 0!==s.get()){const t=us(c.keyframes,l);if(void 0!==t)return e.update((()=>{c.onUpdate(t),c.onComplete()})),new mt([])}return!r&&di.supports(c)?new di(c):new li(c)};function vi(t,e,s,i={passive:!0}){return t.addEventListener(e,s,i),()=>t.removeEventListener(e,s)}function xi(t){return{point:{x:t.pageX,y:t.pageY}}}function Pi(t,e,s,i){return vi(t,e,(t=>e=>Ut(e)&&t(e,xi(e)))(s),i)}function Ti({top:t,left:e,right:s,bottom:i}){return{x:{min:e,max:s},y:{min:t,max:i}}}function Si(t){return t.max-t.min}function wi(t,e,s,i=.5){t.origin=i,t.originPoint=ds(e.min,e.max,t.origin),t.scale=Si(s)/Si(e),t.translate=ds(s.min,s.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 Ai(t,e,s,i){wi(t.x,e.x,s.x,i?i.originX:void 0),wi(t.y,e.y,s.y,i?i.originY:void 0)}function bi(t,e,s){t.min=s.min+e.min,t.max=t.min+Si(e)}function Ei(t,e,s){t.min=e.min-s.min,t.max=t.min+Si(e)}function Vi(t,e,s){Ei(t.x,e.x,s.x),Ei(t.y,e.y,s.y)}const Mi=()=>({x:{min:0,max:0},y:{min:0,max:0}});function Di(t){return[t("x"),t("y")]}function Ci(t){return void 0===t||1===t}function ki({scale:t,scaleX:e,scaleY:s}){return!Ci(t)||!Ci(e)||!Ci(s)}function Ri(t){return ki(t)||Li(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Li(t){return Bi(t.x)||Bi(t.y)}function Bi(t){return t&&"0%"!==t}function Fi(t,e,s){return s+e*(t-s)}function ji(t,e,s,i,n){return void 0!==n&&(t=Fi(t,n,i)),Fi(t,s,i)+e}function Oi(t,e=0,s=1,i,n){t.min=ji(t.min,e,s,i,n),t.max=ji(t.max,e,s,i,n)}function Ui(t,{x:e,y:s}){Oi(t.x,e.translate,e.scale,e.originPoint),Oi(t.y,s.translate,s.scale,s.originPoint)}const Ii=.999999999999,Ni=1.0000000000001;function Ki(t,e){t.min=t.min+e,t.max=t.max+e}function $i(t,e,s,i,n=.5){Oi(t,e,s,ds(t.min,t.max,n),i)}function Wi(t,e){$i(t.x,e.x,e.scaleX,e.scale,e.originX),$i(t.y,e.y,e.scaleY,e.scale,e.originY)}function zi(t,e){return Ti(function(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:i.y,right:i.x}}(t.getBoundingClientRect(),e))}const Yi=({current:t})=>t?t.ownerDocument.defaultView:null;function Xi(t,e){const s=t.getValue("willChange");if(i=s,Boolean(g(i)&&i.add))return s.add(e);if(!s&&ot.WillChange){const s=new ot.WillChange("auto");t.addValue("willChange",s),s.add(e)}var i}const Gi=(t,e)=>Math.abs(t-e);class Hi{constructor(s,i,{transformPagePoint:n,contextWindow:o,dragSnapToOrigin:r=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=Zi(this.lastMoveEventInfo,this.history),s=null!==this.startEvent,i=function(t,e){const s=Gi(t.x,e.x),i=Gi(t.y,e.y);return Math.sqrt(s**2+i**2)}(e.offset,{x:0,y:0})>=3;if(!s&&!i)return;const{point:n}=e,{timestamp:o}=t;this.history.push({...n,timestamp:o});const{onStart:r,onMove:a}=this.handlers;s||(r&&r(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(t,s)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=qi(s,this.transformPagePoint),e.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:s,onSessionEnd:i,resumeAnimation:n}=this.handlers;if(this.dragSnapToOrigin&&n&&n(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Zi("pointercancel"===t.type?this.lastMoveEventInfo:qi(e,this.transformPagePoint),this.history);this.startEvent&&s&&s(t,o),i&&i(t,o)},!Ut(s))return;this.dragSnapToOrigin=r,this.handlers=i,this.transformPagePoint=n,this.contextWindow=o||window;const a=qi(xi(s),this.transformPagePoint),{point:l}=a,{timestamp:h}=t;this.history=[{...l,timestamp:h}];const{onSessionStart:u}=i;u&&u(s,Zi(a,this.history)),this.removeListeners=Ps(Pi(this.contextWindow,"pointermove",this.handlePointerMove),Pi(this.contextWindow,"pointerup",this.handlePointerUp),Pi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),m(this.updatePoint)}}function qi(t,e){return e?{point:e(t.point)}:t}function _i(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Zi({point:t},e){return{point:t,delta:_i(t,Qi(e)),offset:_i(t,Ji(e)),velocity:tn(e,.1)}}function Ji(t){return t[0]}function Qi(t){return t[t.length-1]}function tn(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,i=null;const n=Qi(t);for(;s>=0&&(i=t[s],!(n.timestamp-i.timestamp>ht(e)));)s--;if(!i)return{x:0,y:0};const o=ut(n.timestamp-i.timestamp);if(0===o)return{x:0,y:0};const r={x:(n.x-i.x)/o,y:(n.y-i.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function en(t,e,s){return{min:void 0!==e?t.min+e:void 0,max:void 0!==s?t.max+s-(t.max-t.min):void 0}}function sn(t,e){let s=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([s,i]=[i,s]),{min:s,max:i}}const nn=.35;function on(t,e,s){return{min:rn(t,e),max:rn(t,s)}}function rn(t,e){return"number"==typeof t?t:t[e]||0}const an=new WeakMap;class ln{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:s=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&!1===i.isPresent)return;const{dragSnapToOrigin:n}=this.getProps();this.panSession=new Hi(t,{onSessionStart:t=>{const{dragSnapToOrigin:e}=this.getProps();e?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(xi(t).point)},onStart:(t,s)=>{const{drag:i,dragPropagation:n,onDragStart:o}=this.getProps();if(i&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(r=i)||"y"===r?Lt[r]?null:(Lt[r]=!0,()=>{Lt[r]=!1}):Lt.x||Lt.y?null:(Lt.x=Lt.y=!0,()=>{Lt.x=Lt.y=!1}),!this.openDragLock))return;var r;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Di((t=>{let e=this.getAxisMotionValue(t).get()||0;if(a.test(e)){const{projection:s}=this.visualElement;if(s&&s.layout){const i=s.layout.layoutBox[t];if(i){e=Si(i)*(parseFloat(e)/100)}}}this.originPoint[t]=e})),o&&e.postRender((()=>o(t,s))),Xi(this.visualElement,"transform");const{animationState:l}=this.visualElement;l&&l.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:s,dragDirectionLock:i,onDirectionLock:n,onDrag:o}=this.getProps();if(!s&&!this.openDragLock)return;const{offset:r}=e;if(i&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let s=null;Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x");return s}(r),void(null!==this.currentDirection&&n&&n(this.currentDirection));this.updateAxis("x",e.point,r),this.updateAxis("y",e.point,r),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>Di((t=>"paused"===this.getAnimationState(t)&&this.getAxisMotionValue(t).animation?.play()))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:n,contextWindow:Yi(this.visualElement)})}stop(t,s){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:n}=s;this.startAnimation(n);const{onDragEnd:o}=this.getProps();o&&e.postRender((()=>o(t,s)))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,s){const{drag:i}=this.getProps();if(!s||!hn(t,i,this.currentDirection))return;const n=this.getAxisMotionValue(t);let o=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:s},i){return void 0!==e&&t<e?t=i?ds(e,t,i.min):Math.max(t,e):void 0!==s&&t>s&&(t=i?ds(s,t,i.max):Math.min(t,s)),t}(o,this.constraints[t],this.elastic[t])),n.set(o)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&y(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!s)&&function(t,{top:e,left:s,bottom:i,right:n}){return{x:en(t.x,s,n),y:en(t.y,e,i)}}(s.layoutBox,t),this.elastic=function(t=nn){return!1===t?t=0:!0===t&&(t=nn),{x:on(t,"left","right"),y:on(t,"top","bottom")}}(e),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Di((t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const s={};return void 0!==e.min&&(s.min=e.min-t.min),void 0!==e.max&&(s.max=e.max-t.min),s}(s.layoutBox[t],this.constraints[t]))}))}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!y(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const n=function(t,e,s){const i=zi(t,s),{scroll:n}=e;return n&&(Ki(i.x,n.offset.x),Ki(i.y,n.offset.y)),i}(s,i.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:sn(t.x,e.x),y:sn(t.y,e.y)}}(i.layout.layoutBox,n);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=Ti(t))}return o}startAnimation(t){const{drag:e,dragMomentum:s,dragElastic:i,dragTransition:n,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=Di((r=>{if(!hn(r,e,this.currentDirection))return;let l=a&&a[r]||{};o&&(l={min:0,max:0});const h=i?200:1e6,u=i?40:1e7,c={type:"inertia",velocity:s?t[r]:0,bounceStiffness:h,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...n,...l};return this.startAxisValueAnimation(r,c)}));return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const s=this.getAxisMotionValue(t);return Xi(this.visualElement,t),s.start(yi(t,s,0,e,this.visualElement,!1))}stopAnimation(){Di((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){Di((t=>this.getAxisMotionValue(t).animation?.pause()))}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),i=s[e];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Di((e=>{const{drag:s}=this.getProps();if(!hn(e,s,this.currentDirection))return;const{projection:i}=this.visualElement,n=this.getAxisMotionValue(e);if(i&&i.layout){const{min:s,max:o}=i.layout.layoutBox[e];n.set(t[e]-ds(s,o,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:s}=this.visualElement;if(!y(e)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Di((t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const s=e.get();i[t]=function(t,e){let s=.5;const i=Si(t),n=Si(e);return n>i?s=at(e.min,e.max-i,t.min):i>n&&(s=at(t.min,t.max-n,e.min)),r(0,1,s)}({min:s,max:s},this.constraints[t])}}));const{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Di((e=>{if(!hn(e,t,null))return;const s=this.getAxisMotionValue(e),{min:n,max:o}=this.constraints[e];s.set(ds(n,o,i[e]))}))}addListeners(){if(!this.visualElement.current)return;an.set(this.visualElement,this);const t=Pi(this.visualElement.current,"pointerdown",(t=>{const{drag:e,dragListener:s=!0}=this.getProps();e&&s&&this.start(t)})),s=()=>{const{dragConstraints:t}=this.getProps();y(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,n=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),e.read(s);const o=vi(window,"resize",(()=>this.scalePositionWithinConstraints())),r=i.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(Di((e=>{const s=this.getAxisMotionValue(e);s&&(this.originPoint[e]+=t[e].translate,s.set(s.get()+t[e].translate))})),this.visualElement.render())}));return()=>{o(),t(),n(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:n=!1,dragElastic:o=nn,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:s,dragPropagation:i,dragConstraints:n,dragElastic:o,dragMomentum:r}}}function hn(t,e,s){return!(!0!==e&&e!==t||null!==s&&s!==t)}const un=t=>(s,i)=>{t&&e.postRender((()=>t(s,i)))};function cn(t){return t.props[v]}const dn=(t,e)=>t.depth-e.depth;class pn{constructor(){this.children=[],this.isDirty=!1}add(t){it(this.children,t),this.isDirty=!0}remove(t){nt(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(dn),this.isDirty=!1,this.children.forEach(t)}}const mn=["TopLeft","TopRight","BottomLeft","BottomRight"],fn=mn.length,gn=t=>"string"==typeof t?parseFloat(t):t,yn=t=>"number"==typeof t||h.test(t);function vn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const xn=Tn(0,.5,ie),Pn=Tn(.5,.95,s);function Tn(t,e,s){return i=>i<t?0:i>e?1:s(at(t,e,i))}function Sn(t,e){t.min=e.min,t.max=e.max}function wn(t,e){Sn(t.x,e.x),Sn(t.y,e.y)}function An(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function bn(t,e,s,i,n){return t=Fi(t-=e,1/s,i),void 0!==n&&(t=Fi(t,1/n,i)),t}function En(t,e,[s,i,n],o,r){!function(t,e=0,s=1,i=.5,n,o=t,r=t){a.test(e)&&(e=parseFloat(e),e=ds(r.min,r.max,e/100)-r.min);if("number"!=typeof e)return;let l=ds(o.min,o.max,i);t===o&&(l-=e),t.min=bn(t.min,e,s,l,n),t.max=bn(t.max,e,s,l,n)}(t,e[s],e[i],e[n],e.scale,o,r)}const Vn=["x","scaleX","originX"],Mn=["y","scaleY","originY"];function Dn(t,e,s,i){En(t.x,e,Vn,s?s.x:void 0,i?i.x:void 0),En(t.y,e,Mn,s?s.y:void 0,i?i.y:void 0)}function Cn(t){return 0===t.translate&&1===t.scale}function kn(t){return Cn(t.x)&&Cn(t.y)}function Rn(t,e){return t.min===e.min&&t.max===e.max}function Ln(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.m