UNPKG

animejs

Version:

JavaScript animation engine

9 lines 76.4 kB
/** * anime.js - ESM * @version v4.0.0 * @author Julian Garnier * @license MIT * @copyright (c) 2025 Julian Garnier * @see https://animejs.com */ const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={replace:0,none:1,blend:2},r=Symbol(),n=Symbol(),o=Symbol(),a=Symbol(),h=Symbol(),l=Symbol(),c=1e-11,d=1e12,u=1e3,p="",m=new Map;m.set("x","translateX"),m.set("y","translateY"),m.set("z","translateZ");const f=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],g=f.reduce(((t,e)=>({...t,[e]:e+"("})),{}),_=()=>{},y=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,v=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,b=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,S=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,x=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,T=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,w=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,k=/([a-z])([A-Z])/g,$=/(\w+)(\([^)]+\)+)/g,E=/(\*=|\+=|-=)/,C={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:u,delay:0,loopDelay:0,ease:"out(2)",composition:i.replace,modifier:t=>t,onBegin:_,onBeforeUpdate:_,onUpdate:_,onLoop:_,onPause:_,onComplete:_,onRender:_},B={defaults:C,root:s,scope:null,precision:4,timeScale:1,tickThreshold:200},D={version:"4.0.0",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(D));const L=t=>t.replace(k,"$1-$2").toLowerCase(),N=(t,e)=>0===t.indexOf(e),A=Date.now,F=Array.isArray,P=t=>t&&t.constructor===Object,R=t=>"number"==typeof t&&!isNaN(t),Y=t=>"string"==typeof t,X=t=>"function"==typeof t,M=t=>void 0===t,z=t=>M(t)||null===t,O=e=>t&&e instanceof SVGElement,I=t=>y.test(t),W=t=>N(t,"rgb"),V=t=>N(t,"hsl"),U=t=>!B.defaults.hasOwnProperty(t),H=t=>Y(t)?parseFloat(t):t,q=Math.pow,Q=Math.sqrt,j=Math.sin,G=Math.cos,Z=Math.abs,J=Math.exp,K=Math.ceil,tt=Math.floor,et=Math.asin,st=Math.max,it=Math.atan2,rt=Math.PI,nt=Math.round,ot=(t,e,s)=>t<e?e:t>s?s:t,at={},ht=(t,e)=>{if(e<0)return t;if(!e)return nt(t);let s=at[e];return s||(s=at[e]=10**e),nt(t*s)/s},lt=(t,e)=>F(e)?e.reduce(((e,s)=>Z(s-t)<Z(e-t)?s:e)):e?nt(t/e)*e:t,ct=(t,e,s)=>t+(e-t)*s,dt=t=>t===1/0?d:t===-1/0?-1e12:t,ut=t=>t<c?c:t,pt=t=>F(t)?[...t]:t,mt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=M(r)?e[i]:r}return s},ft=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},gt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},_t=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o};class yt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=ht(u/120,0),this._fps=120,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<c?c:s,r=ht(u/i,0);this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<c?c:e}requestTick(t){const e=this._scheduledTime,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const vt=(t,e,s,r,n)=>{const o=t.parent,h=t.duration,l=t.completed,d=t.iterationDuration,u=t.iterationCount,m=t._currentIteration,f=t._loopDelay,_=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,S=t._currentTime,x=b+d,T=e-b,w=ot(S,-b,h),k=ot(T,-b,h),$=T-S,E=k>0,C=k>=h,D=h<=c,L=2===n;let N=0,A=T,F=0;if(u>1){const e=~~(k/(d+(C?0:f)));t._currentIteration=ot(e,0,u),C&&t._currentIteration--,N=t._currentIteration%2,A=k%(d+f)||0}const P=_^(y&&N),R=t._ease;let Y=C?P?0:h:P?d-A:A;R&&(Y=d*R(Y/d)||0);const X=(o?o.backwards:T<S)?!P:!!P;if(t._currentTime=T,t._iterationTime=Y,t.backwards=X,E&&!t.began?(t.began=!0,s||o&&(X||!o.began)||t.onBegin(t)):T<=0&&(t.began=!1),s||v||!E||t._currentIteration===m||t.onLoop(t),L||1===n&&(e>=b&&e<=x||e<=b&&w>b||e>=x&&w!==h)||Y>=x&&w!==h||Y<=b&&w>0||e<=w&&w===h&&l||C&&!l&&D){if(E&&(t.computeDeltaTime(w),s||t.onBeforeUpdate(t)),!v){const e=L||(X?-1*$:$)>=B.tickThreshold,n=t._offset+(o?o._offset:0)+b+Y;let h,l,c,d,u=t._head,m=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,_=u._nextRep,y=u._prevRep,v=t!==i.none;if((e||(s!==o||n<=f+(_?_._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!_||_._isOverridden||n<=_._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=ot(Y-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,p=u._valueType,f=u._tweenType,g=0===f,_=0===p,y=_&&g||0===s||1===s?-1:B.precision;let b,S;if(_)b=S=n(ht(ct(u._fromNumber,u._toNumber,s),y));else if(1===p)S=n(ht(ct(u._fromNumber,u._toNumber,s),y)),b=`${S}${u._unit}`;else if(2===p){const t=u._fromNumbers,e=u._toNumbers,i=ht(ot(n(ct(t[0],e[0],s)),0,255),0),r=ht(ot(n(ct(t[1],e[1],s)),0,255),0),o=ht(ot(n(ct(t[2],e[2],s)),0,255),0),a=ot(n(ht(ct(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${a})`,v){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(3===p){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(ht(ct(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=S),r||t===i.blend)u._value=b;else{const t=u.property;h=u.target,g?h[t]=b:1===f?h.setAttribute(t,b):(l=h.style,3===f?(h!==c&&(c=h,d=h[a]),d[t]=b,m=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),E&&(F=1)}}if(m&&u._renderTransforms){let t=p;for(let e in d)t+=`${g[e]}${d[e]}) `;l.transform=t,m=0}u=u._next}!s&&F&&t.onRender(t)}!s&&E&&t.onUpdate(t)}return o&&D?!s&&(o.began&&!X&&T>=h&&!l||X&&T<=c&&l)&&(t.onComplete(t),t.completed=!X):E&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(X||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},bt=(t,e,s,i,r)=>{const n=t._currentIteration;if(vt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,h=i?e:o._iterationTime,l=A();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;ft(o,(e=>{if(a){const i=e.duration,r=e._offset+e._delay;s||!(i<=c)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&vt(e,t,s,1,2),e.began=!1,e.completed=!1})),s||o.onLoop(o)}ft(o,(t=>{const e=ht((h-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;d+=vt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),a),!s&&d&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},St={animation:null,update:_},xt=t?requestAnimationFrame:setImmediate,Tt=t?cancelAnimationFrame:clearImmediate;class wt extends yt{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=C,this.paused=!(!t||!s.hidden),this.reqId=null}update(){const t=this._currentTime=A();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(gt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):bt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}St.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=xt($t)),this}pause(){return this.paused=!0,Et()}resume(){if(this.paused)return this.paused=!1,ft(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===B.timeScale?1:u)}set speed(t){this._speed=t*B.timeScale,ft(this,(t=>t.speed=t._speed))}get timeUnit(){return 1===B.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(B.timeScale!==s){B.timeScale=s,B.tickThreshold=200*s;const t=e?.001:u;this.defaults.duration*=t,this._speed*=t}}get precision(){return B.precision}set precision(t){B.precision=t}}const kt=(()=>{const e=new wt(A());return t&&(D.engine=e,s.addEventListener("visibilitychange",(()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())}))),e})(),$t=()=>{kt._head?(kt.reqId=xt($t),kt.update()):kt.reqId=0},Et=()=>(Tt(kt.reqId),kt.reqId=0,kt);function Ct(t){const e=Y(t)?B.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Bt(e){if(z(e))return[];if(F(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(i)){const t=Ct(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}if(!t)return[e];const s=Ct(e);return s?Array.from(s):[e]}function Dt(t){const e=Bt(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[r]){s[r]=!0;const t=O(s);(s.nodeType||t)&&(s[n]=!0,s[o]=t,s[a]={})}}return e}const Lt=t=>{const e=Bt(t)[0];if(e&&O(e))return e},Nt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),At=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[o],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Nt(t,s,-1),i=Nt(t,s,1);return 180*it(i.y-e.y,i.x-e.x)/rt}{const i=Nt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Ft=["opacity","rotate","overflow","color"],Pt={morphTo:(t,e=.33)=>s=>{const i=Lt(t);if(!i)return;const r="path"===s.tagName,n=r?" ":",",o=s[h];o&&s.setAttribute(r?"d":"points",o);let a="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),h=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<h;e++){const c=e/(h-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";a+=p+ht(d.x,3)+n+d.y+" ",l+=p+ht(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[h]=l,[a,l]},createMotionPath:t=>{const e=Lt(t);if(e)return{translateX:At(e,"x"),translateY:At(e,"y"),rotate:At(e,"a")}},createDrawable:(t,e=0,s=0)=>{const i=Bt(t);return i.forEach(((t,r)=>i[r]=function(t,e,s){const i=getComputedStyle(t).strokeLinecap,r=u;let n=i;const o=new Proxy(t,{get(t,e){const s=t[e];return e===l?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),o=+s[0],a=+s[1],h=-1e3*o,l=a*r+h,c=r+(0===o&&1===a||1===o&&0===a?0:10)-l;if("butt"!==i){const e=o===a?"butt":i;n!==e&&(t.setAttribute("stroke-linecap",`${e}`),n=e)}t.setAttribute("stroke-dashoffset",`${h}`),t.setAttribute("stroke-dasharray",`${l} ${c}`)}return Reflect.apply(s,t,e)}:X(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),o.setAttribute("draw",`${e} ${s}`)),o}(t,e,s))),i}},Rt=(t,e,s)=>(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),Yt=(t,e)=>M(t)?e:t,Xt=(t,e,s,i,r)=>{if(X(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Mt=(t,e)=>t[n]?t[o]&&((t,e)=>{if(Ft.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}})(t,e)?1:f.includes(e)||m.get(e)?3:N(e,"--")?4:e in t.style?2:e in t?0:1:0,zt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[l]||t).getPropertyValue(e);return"auto"===r?"0":r},Ot=(t,e,s,i)=>{const r=M(s)?Mt(t,e):s;return 0===r?t[e]||0:1===r?t.getAttribute(e):3===r?((t,e,s)=>{const i=t.style.transform;let r;if(i){const n=t[a];let o;for(;o=$.exec(i);){const t=o[1],i=o[2].slice(1,-1);n[t]=i,t===e&&(r=i,s&&(s[e]=i))}}return i&&!M(r)?r:N(e,"scale")?"1":N(e,"rotate")||N(e,"skew")?"0deg":"0px"})(t,e,i):4===r?zt(t,e,i).trimStart():zt(t,e,i)},It=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Wt=(t,e)=>{if(e.t=0,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const n=!s.includes(" ")&&w.exec(s);if(n)return e.t=1,e.n=+n[1],e.u=n[2],e;if(e.o)return e.n=+s,e;if(I(r=s)||W(r)||V(r))return e.t=2,e.d=W(i=s)?(t=>{const e=v.exec(t)||b.exec(t),s=M(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):I(i)?(t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]})(i):V(i)?(t=>{const e=S.exec(t)||x.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=M(e[4])?1:+e[4];let o,a,h;if(0===i)o=a=h=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=ht(255*Rt(e,t,s+1/3),0),a=ht(255*Rt(e,t,s),0),h=ht(255*Rt(e,t,s-1/3),0)}return[o,a,h,n]})(i):[0,0,0,1],e;{const t=s.match(T);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(T)||[],e}}var i,r;return e.n=s,e},Vt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=pt(t._toNumbers),e.s=pt(t._strings),e),Ut={t:0,n:0,u:null,o:null,d:null,s:null},Ht={_rep:new WeakMap,_add:new Map},qt=(t,e,s="_rep")=>{const i=Ht[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Qt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,jt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},Gt=(t,e)=>{const s=t._composition;if(s===i.replace){const s=t._absoluteStartTime;_t(e,t,Qt,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){jt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)jt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<c&&jt(i)}let o=!0;if(ft(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;ft(t,(t=>{t!==e&&ft(t,(t=>{t._isOverlapped||(s=!1)}))})),s&&t.cancel()}else e.cancel()}}}else if(s===i.blend){const e=qt(t.target,t.property,"_add"),s=(t=>{let e=St.animation;return e||(e={duration:c,computeDeltaTime:_,_offset:0,_delay:0,_head:null,_tail:null},St.animation=e,St.update=()=>{t.forEach((t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=3===t||2===t?pt(i._fromNumbers):null;let r=i._fromNumber,n=s._tail;for(;n&&n!==i;){if(e)for(let t=0,s=n._numbers.length;t<s;t++)e[t]+=n._numbers[t];else r+=n._number;n=n._prevAdd}i._toNumber=r,i._toNumbers=e}}})),vt(e,1,1,0,2)}),e})(Ht._add);let r=e._head;r||(r={...t},r._composition=i.replace,r._updateDuration=c,r._startTime=0,r._numbers=pt(t._fromNumbers),r._number=0,r._next=null,r._prev=null,_t(e,r),_t(s,r));const n=t._toNumber;if(t._fromNumber=r._fromNumber-n,t._toNumber=0,t._numbers=pt(t._fromNumbers),t._number=0,r._fromNumber=n,t._toNumbers){const e=pt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=r._fromNumbers[s]-e,t._toNumbers[s]=0})),r._fromNumbers=e}_t(e,t,null,"_prevAdd","_nextAdd")}return t},Zt=t=>{const e=t._composition;if(e!==i.none){const s=t.target,r=t.property,n=Ht._rep.get(s)[r];if(gt(n,t,"_prevRep","_nextRep"),e===i.blend){const e=Ht._add,i=e.get(s);if(!i)return;const n=i[r],o=St.animation;gt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){gt(n,a,"_prevAdd","_nextAdd"),gt(o,a);let t=!0;for(let e in i)if(i[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Jt=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),Kt=t=>t._cancelled?(t._hasChildren?ft(t,Kt):ft(t,(t=>{t._composition!==i.none&&Gt(t,qt(t.target,t.property))})),t._cancelled=0,t):t;let te=0;class ee extends yt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:h,loopDelay:l,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:b}=t;B.scope&&B.scope.revertibles.push(this);const S=e?0:kt._elapsedTime,x=e?e.defaults:B.defaults,T=X(r)||M(r)?x.delay:+r,w=X(n)||M(n)?1/0:+n,k=Yt(h,x.loop),$=Yt(l,x.loopDelay),E=!0===k||k===1/0||k<0?1/0:k+1;let C=0;if(e)C=s;else{let t=A();kt.paused&&(kt.requestTick(t),t=kt._elapsedTime),C=t-kt._startTime}this.id=M(i)?++te:i,this.parent=e,this.duration=dt((w+$)*E-$)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=b||x.onUpdate,this.onLoop=f||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=w,this.iterationCount=E,this._autoplay=!e&&Yt(d,x.autoplay),this._offset=C,this._delay=T,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=_,this._running=!1,this._reversed=+Yt(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Yt(a,x.alternate),this._prev=null,this._next=null,this._elapsedTime=S,this._startTime=S,this._lastTime=S,this._fps=Yt(u,x.frameRate),this._speed=Yt(p,x.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return ot(ht(this._currentTime,B.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ht(this._iterationTime,B.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ot(ht(this._currentTime/this.duration,5),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ot(ht(this._iterationTime/this.iterationDuration,5),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*ot(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=0){return Kt(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,bt(this,0,1,t,2),Jt(this),this._hasChildren&&ft(this,Jt),this}init(t=0){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&bt(this,this.duration,1,t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!M(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*kt._speed);return this._startTime=A()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=c&&!this._hasChildren?bt(this,c,0,0,2):(this._running||(_t(kt,this),kt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,kt.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){Kt(this),this.completed=!1;const i=this.paused;return this.paused=!0,bt(this,t+this._delay,~~e,~~s,1),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?tt(d/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?ft(this,(t=>t.cancel()),!0):ft(this,Zt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration;if(e===ut(t))return this;const s=t/e,i=t<=c;return this.duration=i?c:ut(dt(ht(e*s,12))),this.iterationDuration=i?c:ut(dt(ht(this.iterationDuration*s,12))),this._offset*=s,this._delay*=s,this._loopDelay*=s,this}revert(){bt(this,0,1,0,1);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(){return this.seek(this.duration).cancel()}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const se=t=>new ee(t,null,0).init(),ie=t=>t,re=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,ne=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?ie:r=>0===r||1===r?r:re(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=re(r,e,s)-t,i>0?o=r:n=r}while(Z(i)>1e-7&&++a<100);return r})(r,t,s),e,i),oe=(t=10,e)=>{const s=e?K:tt;return e=>s(ot(e,0,1)*t)*(1/t)},ae=(...t)=>{const e=t.length;if(!e)return ie;const s=e-1,i=t[0],r=t[s],n=[0],o=[H(i)];for(let e=1;e<s;e++){const i=t[e],r=Y(i)?i.trim().split(" "):[i],a=r[0],h=r[1];n.push(M(h)?e/s:H(h)/100),o.push(H(a))}return o.push(H(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},he=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(ot(o,r,1))}return s.push(1),ae(...s)},le=rt/2,ce=2*rt,de=(t=1.68)=>e=>q(e,+t),ue={[p]:de,Quad:de(2),Cubic:de(3),Quart:de(4),Quint:de(5),Sine:t=>1-G(t*le),Circ:t=>1-Q(1-t*t),Expo:t=>t?q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=q(2,--s))-1)/11;);return 1/q(4,3-s)-7.5625*q((3*e-2)/22-t,2)},Back:(t=1.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ot(+t,1,10),i=ot(+e,c,2),r=i/ce*et(1/s),n=ce/i;return t=>0===t||1===t?t:-s*q(2,-10*(1-t))*j((1-t-r)*n)}},pe={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},me=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=pe[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:ie}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):ie}},fe=(()=>{const t={linear:ae,irregular:he,steps:oe,cubicBezier:ne};for(let e in pe)for(let s in ue){const i=ue[s],r=pe[e];t[e+s]=s===p||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ge={linear:ie},_e=t=>X(t)?t:Y(t)?me(t,fe,ge):ie,ye={},ve=(t,e,s)=>{if(3===s)return m.get(t)||t;if(2===s||1===s&&O(e)&&t in e.style){const e=ye[t];if(e)return e;{const e=t?L(t):t;return ye[t]=e,e}}return t},be={deg:1,rad:180/rt,turn:360},Se={},xe=(t,e,i,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===i)return e;const a=o+n+i,h=Se[a];if(M(h)||r){let r;if(n in be)r=o*be[n]/be[i];else{const e=100,a=t.cloneNode(),h=t.parentNode,l=h&&h!==s?h:s.body;l.appendChild(a);const c=a.style;c.width=e+n;const d=a.offsetWidth||e;c.width=e+i;const u=d/(a.offsetWidth||e);l.removeChild(a),r=u*o}e.n=r,Se[a]=r}else e.n=h;return e.t,e.u=i,e},Te=t=>{if(t._hasChildren)ft(t,Te,!0);else{const e=t;e.pause(),ft(e,(t=>{const s=t.property,i=t.target;if(i[n]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[a];if(M(n)||n===p?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=p;for(let s in e)t+=g[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else M(n)||n===p?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===p&&t.removeAttribute("style")}))}}))}return t},we={t:0,n:0,u:null,o:null,d:null,s:null},ke={t:0,n:0,u:null,o:null,d:null,s:null},$e={func:null},Ee=[null],Ce=[null,null],Be={to:null};let De,Le,Ne=0;class Ae extends ee{constructor(t,e,s,r,n=!1,o=0,a=0){super(e,s,r);const h=Dt(t),l=h.length,d=e.keyframes,p=d?mt(((t,e)=>{const s={};if(F(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(U);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map((t=>{const e={};for(let s in t){const i=t[s];U(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=Yt(e.duration,B.defaults.duration),r=Object.keys(t).map((e=>({o:parseFloat(e)/100,p:t[e]}))).sort(((t,e)=>t.o-e.o));r.forEach((t=>{const e=t.o,r=t.p;for(let t in r)if(U(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,h=n[a-1];const l={to:r[t]};let c=0;for(let t=0;t<a;t++)c+=n[t].duration;1===a&&(l.from=h.to),r.ease&&(l.ease=r.ease),l.duration=o-(a?c:0),n.push(l)}return t}));for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s})(d,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=p,S=s?s.defaults:B.defaults,x=Yt(_,S.playbackEase),T=x?_e(x):null,w=!M(g)&&!M(g.ease),k=w?g.ease:Yt(g,T?"linear":S.ease),$=w?g.duration:Yt(f,S.duration),E=Yt(m,S.delay),C=y||S.modifier,D=M(v)&&l>=u?i.none:M(v)?S.composition:v,L={},N=this._offset+(s?s._offset:0);let A=NaN,Y=NaN,X=0,z=0;for(let t=0;t<l;t++){const e=h[t],r=o||t,d=a||l;let u=NaN,m=NaN;for(let t in p)if(U(t)){const o=Mt(e,t),a=ve(t,e,o);let h=p[t];const l=F(h);if(n&&!l&&(Ce[0]=h,Ce[1]=h,h=Ce),l){const t=h.length,e=!P(h[0]);2===t&&e?(Be.to=h,Ee[0]=Be,De=Ee):t>2&&e?(De=[],h.forEach(((t,e)=>{e?1===e?(Ce[1]=t,De.push(Ce)):De.push(t):Ce[0]=t}))):De=h}else Ee[0]=h,De=Ee;let f=null,g=null,_=NaN,y=0,v=0;for(let t=De.length;v<t;v++){const n=De[v];P(n)?Le=n:(Be.to=n,Le=Be),$e.func=null;const h=Xt(Le.to,e,r,d,$e);let l;P(h)&&!M(h.to)?(Le=h,l=h.to):l=h;const u=Xt(Le.from,e,r,d),p=Le.ease,m=!M(p)&&!M(p.ease),b=m?p.ease:p||k,S=m?p.duration:Xt(Yt(Le.duration,t>1?Xt($,e,r,d)/t:$),e,r,d),x=Xt(Yt(Le.delay,v?0:E),e,r,d),T=Xt(Yt(Le.composition,D),e,r,d),w=R(T)?T:i[T],B=Le.modifier||C,A=!M(u),Y=!M(l),O=F(l),I=O||A&&Y,W=g?y+x:x,V=N+W;z||!A&&!O||(z=1);let U=g;if(w!==i.none){f||(f=qt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(U=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)jt(t),t=t._nextRep}if(I?(Wt(O?Xt(l[0],e,r,d):u,we),Wt(O?Xt(l[1],e,r,d,$e):l,ke),0===we.t&&(U?1===U._valueType&&(we.t=1,we.u=U._unit):(Wt(Ot(e,a,o,L),Ut),1===Ut.t&&(we.t=1,we.u=Ut.u)))):(Y?Wt(l,ke):g?Vt(g,ke):Wt(s&&U&&U.parent.parent===s?U._value:Ot(e,a,o,L),ke),A?Wt(u,we):g?Vt(g,we):Wt(s&&U&&U.parent.parent===s?U._value:Ot(e,a,o,L),we)),we.o&&(we.n=It(U?U._toNumber:Wt(Ot(e,a,o,L),Ut).n,we.n,we.o)),ke.o&&(ke.n=It(we.n,ke.n,ke.o)),we.t!==ke.t)if(3===we.t||3===ke.t){const t=3===we.t?we:ke,e=3===we.t?ke:we;e.t=3,e.s=pt(t.s),e.d=t.d.map((()=>e.n))}else if(1===we.t||1===ke.t){const t=1===we.t?we:ke,e=1===we.t?ke:we;e.t=1,e.u=t.u}else if(2===we.t||2===ke.t){const t=2===we.t?we:ke,e=2===we.t?ke:we;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(we.u!==ke.u){let t=ke.u?we:ke;t=xe(e,t,ke.u?ke.u:we.u,!1)}if(ke.d&&we.d&&ke.d.length!==we.d.length){const t=we.d.length>ke.d.length?we:ke,e=t===we?ke:we;e.d=t.d.map(((t,s)=>M(e.d[s])?0:e.d[s])),e.s=pt(t.s)}const H=ht(+S||c,12),q={parent:this,id:Ne++,property:a,target:e,_value:null,_func:$e.func,_ease:_e(b),_fromNumbers:pt(we.d),_toNumbers:pt(ke.d),_strings:pt(ke.s),_fromNumber:we.n,_toNumber:ke.n,_numbers:pt(we.d),_number:we.n,_unit:ke.u,_modifier:B,_currentTime:0,_startTime:W,_delay:+x,_updateDuration:H,_changeDuration:H,_absoluteStartTime:V,_tweenType:o,_valueType:ke.t,_composition:w,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};w!==i.none&&Gt(q,f),isNaN(_)&&(_=q._startTime),y=ht(W+H,12),g=q,X++,_t(this,q)}(isNaN(Y)||_<Y)&&(Y=_),(isNaN(A)||y>A)&&(A=y),3===o&&(u=X-v,m=X)}if(!isNaN(u)){let t=0;ft(this,(e=>{t>=u&&t<m&&(e._renderTransforms=1,e._composition===i.blend&&ft(St.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),Y?(ft(this,(t=>{t._startTime-t._delay||(t._delay-=Y),t._startTime-=Y})),A-=Y):Y=0,A||(A=c,this.iterationCount=0),this.targets=h,this.duration=A===c?c:dt((A+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=b||S.onRender,this._ease=T,this._delay=Y,this.iterationDuration=A,this._inlineStyles=L,!this._autoplay&&z&&this.onRender(this)}stretch(t){const e=this.duration;if(e===ut(t))return this;const s=t/e;return ft(this,(t=>{t._updateDuration=ut(ht(t._updateDuration*s,12)),t._changeDuration=ut(ht(t._changeDuration*s,12)),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return ft(this,(t=>{const e=Ot(t.target,t.property,t._tweenType);Wt(e,Ut),t._fromNumbers=pt(Ut.d),t._fromNumber=Ut.n,t._func&&(Wt(t._func(),ke),t._toNumbers=pt(ke.d),t._strings=pt(ke.s),t._toNumber=ke.n)})),this}revert(){return super.revert(),Te(this)}then(t){return super.then(t)}}const Fe=(t,e)=>new Ae(t,e,null,0,!1).init(),Pe=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Re={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Ye=(()=>{const t={};for(let e in pe)t[e]=t=>pe[e](de(t));return t})(),Xe=t=>{let e=Re[t];if(e)return e;if(e="linear",Y(t))if(N(t,"linear")||N(t,"cubic-")||N(t,"steps")||N(t,"ease"))e=t;else if(N(t,"cubicB"))e=L(t);else{const s=me(t,Ye,Re);X(s)&&(e=s===ie?"linear":Pe(s))}else if(X(t)){const s=Pe(t);s&&(e=s)}else t.ease&&(e=Pe(t.ease));return Re[t]=e},Me=["x","y","z"],ze=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Me],Oe=[...Me,...f.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))];let Ie=t&&(M(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const We={_head:null,_tail:null},Ve=(t,e,s)=>{let i=We._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,a=!s||i.parent===s;if(n&&o&&a){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),gt(We,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},Ue=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Ve(e,s),_t(We,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{Ve(e,s,t)};return n.onremove=a,n.onfinish=a,n},He=(t,e,s,i,r)=>{let n=Xt(e,s,i,r);return R(n)?ze.includes(t)||N(t,"translate")?`${n}px`:N(t,"rotate")||N(t,"skew")?`${n}deg`:`${n}`:n},qe=(t,e,s,i,r,n)=>{let o="0";const a=M(i)?getComputedStyle(t)[e]:He(e,i,t,r,n);return o=M(s)?F(i)?i.map((s=>He(e,s,t,r,n))):a:[He(e,s,t,r,n),a],o};class Qe{constructor(t,e){B.scope&&B.scope.revertibles.push(this),Ie||(f.forEach((t=>{const e=N(t,"skew"),s=N(t,"scale"),i=N(t,"rotate"),r=N(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})})),Ie=!0);const s=Dt(t),i=s.length;i||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const r=Yt(e.ease,Xe(B.defaults.ease)),n=r.ease&&r,o=Yt(e.autoplay,B.defaults.autoplay),h=!(!o||!o.link)&&o,l=e.alternate&&!0===e.alternate,c=e.reversed&&!0===e.reversed,d=Yt(e.loop,B.defaults.loop),y=!0===d||d===1/0?1/0:R(d)?d+1:1,v=l?c?"alternate-reverse":"alternate":c?"reverse":"normal",b=Xe(r),S=1===B.timeScale?1:u;this.targets=s,this.animations=[],this.controlAnimation=null,this.onComplete=e.onComplete||_,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!o||!1!==h,this.reversed=c,this.autoplay=o,this._speed=Yt(e.playbackRate,B.defaults.playbackRate),this._resolve=_,this._completed=0,this._inlineStyles=s.map((t=>t.getAttribute("style"))),s.forEach(((t,s)=>{const o=t[a],h=Oe.some((t=>e.hasOwnProperty(t))),l=(n?n.duration:Xt(Yt(e.duration,B.defaults.duration),t,s,i))*S,c=Xt(Yt(e.delay,B.defaults.delay),t,s,i)*S,d=Yt(e.composition,"replace");for(let n in e){if(!U(n))continue;const a={},u={iterations:y,direction:v,fill:"forwards",easing:b,duration:l,delay:c,composite:d},p=e[n],g=!!h&&(f.includes(n)?n:m.get(n));let _;if(P(p)){const e=p,h=Yt(e.ease,r),m=h.ease&&h,f=e.to,y=e.from;if(u.duration=(m?m.duration:Xt(Yt(e.duration,l),t,s,i))*S,u.delay=Xt(Yt(e.delay,c),t,s,i)*S,u.composite=Yt(e.composition,d),u.easing=Xe(h),_=qe(t,n,y,f,s,i),g?(a[`--${g}`]=_,o[g]=_):a[n]=qe(t,n,y,f,s,i),Ue(this,t,n,a,u),!M(y))if(g){const e=`--${g}`;t.style.setProperty(e,a[e][0])}else t.style[n]=a[n][0]}else _=F(p)?p.map((e=>He(n,e,t,s,i))):He(n,p,t,s,i),g?(a[`--${g}`]=_,o[g]=_):a[n]=_,Ue(this,t,n,a,u)}if(h){let e=p;for(let t in o)e+=`${g[t]}var(--${t})) `;t.style.transform=e}})),h&&this.autoplay.link(this)}forEach(t){const e=Y(t)?e=>e[t]():t;return this.animations.forEach(e),this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach((e=>e.playbackRate=t))}get currentTime(){const t=this.controlAnimation,e=B.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===B.timeScale?1:u);this.forEach((t=>t.currentTime=e))}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach((e=>e.currentTime=t*this.duration||0))}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const je={animate:(t,e)=>new Qe(t,e),convertEase:Pe},Ge=(t=_)=>new ee({duration:1*B.timeScale,onComplete:t},null,0).resume();function Ze(t,e,s){const i=Dt(t);if(!i.length)return;const[r]=i,n=Mt(r,e),o=ve(e,r,n);let a=Ot(r,o);if(M(s))return a;if(Wt(a,Ut),0===Ut.t||1===Ut.t){if(!1===s)return Ut.n;{const t=xe(r,Ut,s,!1);return`${ht(t.n,B.precision)}${t.u}`}}}const Je=(t,e)=>{if(!M(e))return e.duration=c,e.composition=Yt(e.composition,i.none),new Ae(t,e,null,0,!0).resume()},Ke=(t,e,s)=>{let i=!1;return ft(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=ve(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),gt(e,r),Zt(r),i=!0)}}),!0),i},ts=(t,e,s)=>{const i=Bt(t),r=e||kt,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];Ve(e,s,n)}let o;if(r._hasChildren){let e=0;ft(r,(n=>{if(!n._hasChildren)if(o=Ke(i,n,s),o&&!n._head)n.cancel(),gt(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?ts(t,n,s):n._hasChildren=!1}),!0),M(r.iterationDuration)||(r.iterationDuration=e)}else o=Ke(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},es=(t,e,s)=>{const i=10**(s||0);return tt((Math.random()*(e-t+1/i)+t)*i)/i},ss=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),is=(t,e,s,i)=>{let r=u/B.defaults.frameRate;if(!1!==i){const t=i||kt._hasChildren&&kt;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},rs=t=>(...e)=>{const s=t(...e);return new Proxy(_,{apply:(t,e,[i])=>s(i),get:(t,e)=>rs(((...t)=>{const i=os[e](...t);return t=>i(s(t))}))})},ns=(t,e=0)=>(...s)=>(s.length<t.length?rs(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),os={$:Dt,get:Ze,set:Je,remove:ts,cleanInlineStyles:Te,random:es,randomPick:t=>t[es(0,t.length-1)],shuffle:t=>{let e,s,i=t.length;for(;i;)s=es(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},lerp:is,sync:Ge,clamp:ns(ot),round:ns(ht),snap:ns(lt),wrap:ns(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:ns(ct,1),mapRange:ns(ss),roundPad:ns(((t,e)=>(+t).toFixed(e))),padStart:ns(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:ns(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:ns((t=>t*rt/180)),radToDeg:ns((t=>180*t/rt))},as=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),M(e))return s;if(R(+e))return+e;const i=e,r=t?t.labels:null,n=!z(r),o=((t,e)=>{if(N(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!M(o),h=E.exec(i);if(h){const t=h[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=a?o:n?l:s,d=+e[1];return It(c,d,t[0])}return a?o:n?M(r[i])?s:r[i]:s};function hs(t,e,s,i,r,n){const o=R(t.duration)&&t.duration<=c?s-c:s;bt(e,o,1,1,1);const a=i?new Ae(i,t,e,o,!1,r,n):new ee(t,e,o);return a.init(1),_t(e,a),ft(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return dt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}class ls extends ee{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=B.defaults;this.defaults=e?mt(e,s):s,this.onRender=t.onRender||s.onRender;const i=Yt(t.playbackEase,s.playbackEase);this._ease=i?_e(i):null,this.iterationDuration=0}add(t,e,s){const i=P(e),r=P(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(X(s)){const e=s,r=Bt(t),n=this.duration,o=this.iterationDuration,a=i.id;let h=0;const l=r.length;r.forEach((t=>{const s={...i};this.duration=n,this.iterationDuration=o,M(a)||(s.id=a+"-"+h),hs(s,this,e(t,h,l,this),t,h,l),h++}))}else hs(i,this,as(this,s),t)}else hs(t,this,as(this,e));return this.init(1)}}sync(t,e){if(M(t)||t&&M(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return this.add(t,{currentTime:[0,s],duration:s,ease:"linear"},e)}set(t,e,s){return M(e)?this:(e.duration=c,e.composition=i.replace,this.add(t,e,s))}call(t,e){return M(t)||t&&!X(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return M(t)||t&&!Y(t)||(this.labels[t]=as(this,e)),this}remove(t,e){return ts(t,this,e),this}stretch(t){const e=this.duration;if(e===ut(t))return this;const s=t/e,i=this.labels;ft(this,(t=>{t.stretch(t.duration*s)}));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return ft(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),ft(this,(t=>t.revert),!0),Te(this)}then(t){return super.then(t)}}const cs=t=>new ls(t).init();class ds{constructor(t,e){B.scope&&B.scope.revertibles.push(this);const s={},r={};if(this.targets=[],this.animations={},!M(t)&&!M(e)){for(let t in e){const i=e[t];U(t)?r[t]=i:s[t]=i}for(let e in r){const n=r[e],o=P(n);let a={},h="+=0";if(o){const t=n.unit;Y(t)&&(h+=t)}else a.duration=n;a[e]=o?mt({to:h},n):h;const l=mt(s,a);l.composition=i.replace,l.autoplay=!1;const c=this.animations[e]=new Ae(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(M(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return ft(c,(e=>{if(F(t))for(let s=0,i=t.length;s<i;s++)M(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;M(s)||(e._ease=_e(s)),e._currentTime=0})),M(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=_,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}const us=(t,e)=>new ds(t,e);class ps{constructor(t={}){this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/u,this.maxIterations=this.maxDuration/this.timeStep/u,this.m=ot(Yt(t.mass,1),0,u),this.s=ot(Yt(t.stiffness,100),1,u),this.d=ot(Yt(t.damping,10),.1,u),this.v=ot(Yt(t.velocity,0),-1e3,u),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>0===t||1===t?t:this.solve(t*this.solverDuration)}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?J(-n*e*s)*(1*G(i*n)+r*j(i*n)):(1+r*n)*J(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,h=this.w0=ot(Q(o/r),c,u),l=this.zeta=n/(2*Q(o*r)),d=this.wd=l<1?h*Q(1-l*l):0;this.b=l<1?(l*h-a)/d:-a+h;let p=0,m=0,f=0;for(;m<t&&f<e;)Z(1-this.solve(p))<s?m++:m=0,this.solverDuration=p,p+=i,f++;this.duration=ht(this.solverDuration*u,0)*B.timeScale}get mass(){return this.m}set mass(t){this.m=ot(Yt(t,1),0,u),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ot(Yt(t,100),1,u),this.compute()}get damping(){return this.d}set damping(t){this.d=ot(Yt(t,10),.1,u),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ot(Yt(t,0),-1e3,u),this.compute()}}const ms=t=>new ps(t),fs=t=>{t.cancelable&&t.preventDefault()};class gs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:_,remove:_}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class _s{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,i=0;for(;e&&e!==s;)t(e,i),e=e.parentElement,i++}getMatrix(){const t=new DOMMatrix;return this.traverseUp((e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}})),t}remove(){this.traverseUp(((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"}))}revert(){this.traverseUp(((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s}))}}const ys=(t,e)=>t&&X(t)?t(e):t;let vs=0;class bs{constructor(t,i={}){if(!t)return;B.scope&&B.scope.revertibles.push(this);const r=i.x,n=i.y,o=i.trigger,a=i.modifier,h=i.releaseEase,l=h&&_e(h),c=!M(h)&&!M(h.ease),u=P(r)&&!M(r.mapTo)?r.mapTo:"translateX",p=P(n)&&!M(n.mapTo)?n.mapTo:"translateY",m=ys(i.container,this);this.containerArray=F(m)?m:null,this.$container=m&&!this.containerArray?Bt(m)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=P(t)?new gs(t):Bt(t)[0],this.$trigger=Bt(o||t)[0],this.fixed="fixed"===Ze(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?h:ms({mass:Yt(i.releaseMass,1),stiffness:Yt(i.releaseStiffness,80),damping:Yt(i.releaseDamping,20)}),this.releaseYSpring=c?h:ms({mass:Yt(i.releaseMass,1),stiffness:Yt(i.releaseStiffness,80),damping:Yt(i.releaseDamping,20)}),this.releaseEase=l||fe.outQuint,this.hasReleaseSpring=c,this.onGrab=i.onGrab||_,this.onDrag=i.onDrag||_,this.onRelease=i.onRelease||_,this.onUpdate=i.onUpdate||_,this.onSettle=i.onSettle||_,this.onSnap=i.onSnap||_,this.onResize=i.onResize||_,this.onAfterResize=i.onAfterResize||_,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),M(r)||!0===r)f[u]=0;else if(P(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===r&&(f[u]=0,this.disabled[0]=1);if(M(n)||!0===n)f[p]=0;else if(P(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[p]=e}else!1===n&&(f[p]=0,this.disabled[1]=1);this.animate=new ds(this.$target,f),this.xProp=u,this.yProp=p,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-1e12,d,d,-1e12],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=A(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new _s(this.$target),this.overshootCoords={x:0,y:0},this.overshootXTicker=new ee({autoplay:!1},null,0).init(),this.overshootYTicker=new ee({autoplay:!1},null,0).init(),this.updateTicker=new ee({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),this.contained=!M(m),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[0]?p:u,this.animate.animations[this.activeProp].onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=it(n,r)):this.updated=!1},this.animate.animations[this.activeProp].onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new ee({autoplay:!1,duration:150*B.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=i,this.resizeObserver=new ResizeObserver((()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0})),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),P(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=A(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,h=this.maxVelocity,l=this.velocityStackIndex;n[l]=ht(ot(Q(t*t+e*e)/r*o,a,h),5);const c=st(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=ht(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=lt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=ht(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=lt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return ht(this.animate[this.xProp](),B.precision)}set x(t){this.setX(t,!1)}get y(){return ht(this.animate[this.yProp](),B.precision)}set y(t){this.setY(t,!1)}get progressX(){return ss(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(ss(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return ss(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(ss(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=ht(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=ht(this.useWin?e.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=s,this.scrollBounds[0]=s-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=s-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container,i=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=e.innerWidth,h=this.window[1]=e.innerHeight,l=this.useWin,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?ot(c,a,c):c,this.scrollView[1]=l?ot(d,h,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:S,right:x,bottom:T}=t.getBoundingClientRect();this.dragArea[2]=ht(l?ot(y,a,a):y,0),this.dragArea[3]=ht(l?ot(v,h,h):v,0);const w=Ze(t,"overflow"),k="visible"===w,$="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===s.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!F(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?l?0:t.scrollLeft:0,o=i?l?0:t.scrollTop:0,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=ht(r.top+s-(l?0:S),0),this.targetBounds[1]=ht(r.right+e-(l?a:x),0),this.targetBounds[2]=ht(r.bottom+s-(l?h:T),0),this.targetBounds[3]=ht(r.left+e-(l?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+_):(this.containerBounds[0]=-ht(r.top-(u?ot(S,0,h):S)+o-m,0),this.containerBounds[1]=-ht(r.right-(u?ot(x,0,a):x)-c+f,0),this.containerBounds[2]=-ht(r.bottom-(u?ot(T,0,h):T)-d+g,0),this.containerBounds[3]=-ht(r.left-(u?ot(b,0,a):b)+n-_,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(i,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,h]=this.disabled,l=!a&&e<o||!a&&e>r,c=!h&&s<i||!h&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=ys(t.container,this),o=ys(t.containerPadding,this)||0,a=F(o)?o:[o