animatry
Version:
Javascript animation library.
3 lines (2 loc) • 37.2 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).animatry=e()}(this,(function(){"use strict";let t={};const e=()=>Object.assign({},{onUpdate:()=>{},onChange:()=>{},onStart:()=>{},onComplete:()=>{},onReverseStart:()=>{},onReverseComplete:()=>{},onRepeat:()=>{}},{id:void 0,delay:0,delayRecharge:!1,duration:1,repeat:0,iterationDelay:0,alternate:!1,paused:!1,ease:void 0,alternateEase:void 0,playhead:0,iteration:0,reversed:!1,timeScale:1,at:void 0,preRender:!1,stagger:0,keyframes:void 0,backwards:!1},t);var s;class r{static steps(t=3){const e=1/t,s=e/2;return t=>{const r=t+s;return Math.floor(r/e)*e}}static cubicBezier(t,e,s,r){function a(t,e,s){const r=3*e,a=3*(s-e)-r;return(((1-r-a)*t+a)*t+r)*t}function n(t,e,s){const r=3*e,a=3*(s-e)-r;return(3*(1-r-a)*t+2*a)*t+r}return function(i){let o=i;for(let l=0;l<5;l++){const l=a(o,t,s),h=n(o,t,s);if(Math.abs(l-i)<1e-5)return a(o,e,r);o-=(l-i)/h}return a(o,e,r)}}static parse(t){if("string"==typeof t){const e=t.match(/(\w+)\(([^)]*)\)/);if(e){const t=e[1],r=e[2].trim(),a=r?r.split(",").map((t=>parseFloat(t))):[];return void 0!==this[t]?this[t](...a):(U.warn(`ease '${t}' is not defined.`),s.linear())}return null==this[t]?(U.warn(`ease '${t}' is not defined.`),s.linear()):this[t]()}return t}}s=r,r.none=()=>t=>t,r.linear=()=>t=>t,r.powerIn=(t=1)=>e=>Math.pow(e,t+1),r.powerOut=(t=1)=>e=>1-Math.pow(1-e,t+1),r.powerInOut=(t=1)=>e=>e<.5?.5*Math.pow(2*e,t+1):1-.5*Math.pow(2*(1-e),t+1),r.bounceIn=()=>t=>1-s.bounceOut()(1-t),r.bounceOut=()=>t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,r.bounceInOut=()=>t=>t<.5?.5*s.bounceIn()(2*t):.5*s.bounceOut()(2*t-1)+.5,r.elasticIn=(t=6)=>e=>1-s.elasticOut(t)(1-e),r.elasticOut=(t=6)=>e=>{if(e<0)return 0;if(e>1)return 1;const s=Math.pow(.025,e),r=Math.pow(e,t**2),a=Math.pow(1-e,1);return 1+Math.sin(e*t*Math.PI-Math.PI/2)*s*(1-r)*a},r.elasticInOut=(t=6)=>e=>e<.5?.5*s.elasticIn(t)(2*e):.5*s.elasticOut(t)(2*e-1)+.5,r.backIn=(t=1.70158)=>e=>e*e*((t+1)*e-t),r.backOut=(t=1.70158)=>e=>1+(e-1)**2*((t+1)*(e-1)+t),r.backInOut=(t=1.70158)=>e=>e<.5?.5*s.backIn(t)(2*e):.5*s.backOut(t)(2*e-1)+.5;class a{constructor(t){this.delayProgress=0,this.iterationDelayProgress=0,this.isPaused=!1,this.isReversed=!1,this.playhead=0,this.frame=-1,this.tick=0,this.initialized=!1,this.options=Object.assign(e(),t),this.options.ease=r.parse(this.options.ease),this.options.alternateEase=r.parse(this.options.alternateEase),this.playhead=this.options.playhead,this.setReversed(this.options.reversed),Promise.resolve().then((()=>{this.getParent()||this.options.paused||this.isPaused||this.play()}))}_render(){if(null!=this.parent)return;const t=performance.now(),e=(this.isReversed?this.tick-t:t-this.tick)*this.getTimeScale()/1e3;this.tick=t,!this.isReversed&&this.delayProgress<1||this.options.delayRecharge&&this.isReversed&&0==this.getTotalProgress()?this.setDelayProgress(this.getDelay()>0?this.getDelayProgress()+e/this.getDelay():1):this.setTotalProgress(this.getTotalProgress()+e/(this.getTotalDuration()||1e-8)),this.isPaused||(this.frame=requestAnimationFrame(this._render.bind(this)))}play(t=void 0){1!=this.playhead&&(this.isPaused=!1,this.tick=performance.now(),this.isReversed=!1,-1==this.frame&&this._render(),null!=t&&this.seek(t))}pause(){this.isPaused=!0,cancelAnimationFrame(this.frame),this.frame=-1,1!=this.getDelayProgress()&&this.setDelayProgress(0)}reverse(){0!=this.playhead&&(this.isPaused=!1,this.tick=performance.now(),this.isReversed=!0,-1==this.frame&&this._render())}continue(){this.isReversed?this.reverse():this.play()}restart(){this.pause(),this.setTotalProgress(0),this.play()}reset(){this.setDelayProgress(0),this.setTotalProgress(0)}seek(t){this.setTotalElapsed(t)}complete(){this.setTotalProgress(1)}lastPlay(){this.setIteration(this.getReversed()?0:this.getRepeat())}getInitialized(){return this.options.preRender||this.initialized}setInitialized(){this.initialized=!0}getParent(){return this.parent}setParent(t){this.parent=t}getId(){var t;return null!==(t=this.options.id)&&void 0!==t?t:""}setId(t){this.options.id=t}getDuration(){return Math.min(this.options.duration,10**8)}setDuration(t,e=!0){return e||this.setProgress(this.getProgress()/t*this.getDuration()),this.options.duration=t,this}getProgress(){return a.getProgress(this,this.playhead)}setProgress(t){return this.setTotalElapsed(this.getIteration()*(this.getDuration()+this.getIterationDelay())+(this.isAlternating()?1-t:t)*this.getDuration()),this}getElapsed(){return this.getProgress()*this.getDuration()}setElapsed(t){return this.setProgress(0==this.getDuration()?t:t/this.getDuration()),this}getTotalProgress(){return this.playhead}setTotalProgress(t,e=!0){t=U.clamp(t,0,1),this.getReversed()?0!=t&&(this.isPaused=!1):1!=t&&(this.isPaused=!1),e&&(0==this.getTotalProgress()&&t>0&&this.options.onStart(this),this.getTotalProgress()<1&&1==t&&this.options.onComplete(this),1==this.getTotalProgress()&&t<1&&this.options.onReverseStart(this),this.getTotalProgress()>0&&0==t&&this.options.onReverseComplete(this),this.getIteration()!=a.getIteration(this,t)&&this.options.onRepeat(this)),this.playhead=t,this.isPlaying()&&(this.getReversed()?0==t&&(this.options.delayRecharge&&0!=this.getDelayProgress()||this.pause()):1==t&&this.pause())}getTotalElapsed(){return this.getTotalProgress()*(this.getTotalDuration()||1e-8)}setTotalElapsed(t){this.setTotalProgress(t/(this.getTotalDuration()||1e-8))}getDelay(){return this.options.delay}setDelay(t,e=void 0){null==e&&(e=1!==this.delayProgress);const s=this.options.delay;return this.options.delay=t,e?(this.delayProgress=0,this):(this.delayProgress=U.clamp(this.delayProgress/t*s,0,t),this)}getDelayProgress(){return 0==this.getDelay()?1:this.delayProgress}setDelayProgress(t){return this.delayProgress=U.clamp(t,0,1),this}getDelayElapsed(){return this.getDelayProgress()*this.getDelay()}setDelayElapsed(t){return this.setDelayProgress(t/this.getDelay()),this}getReversed(){return this.isReversed}setReversed(t){this.isReversed=t}getRepeat(){const{repeat:t,duration:e}=this.options;return 0==this.getDuration()?-1==t?10**8:t:Math.floor(-1==t?10**8/e:Math.min(t,10**8/e))}setRepeat(t,e=!0){const s=this.getIteration(),r=this.getProgress();return this.options.repeat=t,this.setIteration(s),this.setProgress(r),e||this.setIteration(0),s>t&&this.setTotalProgress(1),this}getAlternate(){return this.options.alternate}setAlternate(t,e=!0){const s=this.isAlternating();return this.getAlternate()!=t&&(this.options.alternate=t,e&&s!==this.isAlternating()&&this.setProgress(1-this.getProgress())),this}getIteration(){if(0==this.getTotalDuration())return Math.round(this.getTotalProgress())*this.getRepeat();if(1==this.getTotalProgress())return this.getRepeat();const t=this.getDuration()+this.getIterationDelay(),e=this.getTotalDuration()*this.playhead;return Math.floor(e/t)}setIteration(t,e=!0){return e&&this.getAlternate()&&this.getIteration()%2!=t%2&&this.setProgress(1-this.getProgress()),this.setTotalElapsed(t*(this.getDuration()+this.getIterationDelay())+(this.isAlternating()?this.getDuration()-this.getElapsed():this.getElapsed())),this}getIterationDelay(){return this.options.iterationDelay}setIterationDelay(t){const e=this.getProgress(),s=this.getIteration();return this.options.iterationDelay=t,this.setIteration(s),this.setProgress(e),this}getIterationDelayProgress(){return this.iterationDelayProgress}setIterationDelayProgress(t){return this.iterationDelayProgress=U.clamp(t,0,1),this}getTimeScale(){return this.options.timeScale}setTimeScale(t){this.options.timeScale=t}getTotalDuration(){return(this.getRepeat()+1)*this.getDuration()+this.getRepeat()*this.getIterationDelay()}getEasedProgress(){return a.getEasedProgress(this,this.playhead)}getEasedElapsed(){return this.getEasedProgress()*this.getDuration()}isAlternating(){return a.isAlternating(this,this.playhead)}isPlaying(){return!this.isPaused}onChange(t){this.options.onChange=t}onUpdate(t){this.options.onUpdate=t}onStart(t){this.options.onStart=t}onRepeat(t){this.options.onRepeat=t}onComplete(t){this.options.onComplete=t}onReverseStart(t){this.options.onReverseStart=t}onReverseComplete(t){this.options.onReverseComplete=t}static getProgress(t,e){if(0==t.getDuration()){if(t.getRepeat()>0){const s=Math.ceil(U.clamp(e*t.getRepeat(),0,1));return a.isAlternating(t,e)?1-s:s}return Math.round(e)}if(1==e&&0==t.getIterationDelay())return t.getAlternate()&&a.isAlternating(t,e)?0:1;const s=t.getDuration()+t.getIterationDelay();let r=(t.getTotalDuration()||1e-8)*e%s,n=U.clamp(r/t.getDuration(),0,1);return a.isAlternating(t,e)?1-n:n}static getEasedProgress(t,e){var s;const n=a.getProgress(t,e),i=a.isAlternating(t,t.options.backwards?1-e:e)&&void 0!==t.options.alternateEase?t.options.alternateEase:null!==(s=t.options.ease)&&void 0!==s?s:r.powerInOut();return t.options.backwards?1-i(n):i(n)}static getIteration(t,e){if(0==e)return Math.round(e)*t.getRepeat();if(1==e)return t.getRepeat();const s=t.getDuration()+t.getIterationDelay(),r=(t.getTotalDuration()||1e-8)*e;return Math.floor(r/s)}static isAlternating(t,e){return t.getAlternate()&&a.getIteration(t,e)%2==1}}const n=(t,e,s,r=void 0)=>{var a,n,i,o,l;let h=null!==(a=null==t?void 0:t.getStartTime())&&void 0!==a?a:0,c=null!==(n=null==t?void 0:t.getEndTime())&&void 0!==n?n:0;if("number"==typeof e)return null!=e?e:c;if(!e&&c>=10**8&&U.warn("Placing a tween after someting infinite will not work."),!e)return c;const[,u,d,p,g]=e.match(/(^[A-Za-z][\w]*|^<|^>)?([+-]=)?([+-]?\d*\.?\d+)?(\w*|%)?$/)||[];if(g&&!p&&!u||g&&!p)return U.warn(`invalid format '${e}'`),0;const m=/^[A-Za-z]/.test(e);m&&null==s[u]&&(u?U.warn(`label '${u}' not defined`):U.warn(`invalid format '${e}'`));const f=m?s[u]:/^</.test(e)?h:c;let y,v=m||/^[<>]/.test(e)||"%"===g||/[+-]=/.test(d),w=parseFloat(p)||0;(null==d?void 0:d.startsWith("-"))&&(w*=-1),y="%"===g?r?/[+-]=/.test(d)||m&&!d?((null==r?void 0:r.getTotalDuration())||1e-8)/100:((null===(l=null==t?void 0:t.getAnimation())||void 0===l?void 0:l.getTotalDuration())||1e-8)/100:((null===(o=null===(i=null==t?void 0:t.getAnimation())||void 0===i?void 0:i.getParent())||void 0===o?void 0:o.getDuration())||0)/100:"ms"===g?.001:1;const b=(v?f:0)+w*y;return isNaN(b)?c:b};class i{constructor(t,e){this.animation=t,this.time=e}getAnimation(){return this.animation}getStartTime(){return this.time+this.animation.getDelay()}getEndTime(){return this.getStartTime()+this.animation.getTotalDuration()/this.animation.getTimeScale()+(0==this.animation.getTotalDuration()?1e-8:0)}}class o extends a{constructor(t={}){super(Object.assign({duration:0,ease:r.none()},t)),this.attacheds=[],this.labels={},this.controller=t}getController(){return this.controller}setTotalProgress(t,e=!0){t=U.clamp(t,0,1);const s=a.getEasedProgress(this,t)*this.getDuration();let r=t<this.getTotalProgress()!==this.isAlternating();const n=r?this.attacheds.slice().reverse():this.attacheds,i=this.options.preRender;n.forEach((t=>{const e=t.getAnimation();let a=s-t.getStartTime();const n=r?s<t.getEndTime():s>t.getStartTime();(i||n)&&e.setInitialized(),n&&(e.getIteration()>0&&e.isAlternating()&&e.setTotalProgress(1,a>=t.getEndTime()),e.setTotalElapsed(a))})),super.setTotalProgress(t,e)}_updateDuration(t=!1){let e=0;t||(e=this.getDuration()),this.attacheds.forEach((t=>{t.getEndTime()>e&&(e=t.getEndTime())})),this.setDuration(e,!1)}label(t,e=void 0){return/^[A-Za-z][\w-]*$/.test(t)?(this.labels[t]=n(this.attacheds[this.attacheds.length-1],e,this.labels),this):(U.warn(`'${t}' includes invalid characters`),this)}add(t,e=void 0){var s,r;t instanceof a||(U.warn(`invalid object '${t}' did you intend to use .to() instead of .add() ?`),t=U.to(t,e),e=void 0);let o=this.attacheds[this.attacheds.length-1];const l=n(o,null!==(r=null!==(s=null!=e?e:t.options.at)&&void 0!==s?s:null==o?void 0:o.getEndTime())&&void 0!==r?r:0,this.labels,t);t.options.duration>=10**8&&(0!=t.options.repeat||0!=this.options.repeat)?(t.setRepeat(0),this.setRepeat(0)):0!=this.options.repeat&&-1==t.options.repeat&&this.setRepeat(0),t.setParent(this);const h=new i(t,l);return this.attacheds.push(h),this._updateDuration(),this.options.paused||this.play(),this}play(t=void 0){this.attacheds.forEach((t=>{t.getAnimation().play()})),super.play(t)}reverse(){this.attacheds.forEach((t=>{t.getAnimation().reverse()})),super.reverse()}seek(t){if("string"==typeof t&&/^[A-Za-z]|^[<>]/.test(t)){let e=this.attacheds[this.attacheds.length-1];t=n(e,t,this.labels)}super.seek(t)}fromTo(t,e,s,r=void 0){return this.add(U.fromTo(t,e,s),r)}to(t,e,s=void 0){return this.add(U.to(t,e),s)}from(t,e,s=void 0){return this.add(U.from(t,e),s)}set(t,e,s=void 0){return this.add(U.set(t,e),s)}}const l=/^\s*([+-]=)?\s*([+-]?\d*\.?\d+)\s*([a-z%Q]+)?\s*$/,h=t=>l.test(t),c=(t,e,s,r)=>([s,r]=d(t,e,s,r),[!1,r[0]?s[1]+r[1]:r[1],r[2]]),u=t=>{if(null==t)return U.warn("empty signed number"),[!1,0,""];const e=t.toString().match(l);if(!e)return U.warn("invalid signed number"),[!1,0,""];const s=null==e?void 0:e.slice(1);return[!!s[0],parseFloat(s[1])*(/^-/.test(s[0])?-1:1),s[2]]},d=(t,e,s,r)=>{if(!s||!r)return[[!1,0,""],[!1,0,""]];const[,a,n]=s,[i,o,l]=r;return CSS.supports(e,"1deg")||CSS.supports("transform",`${e}(1deg)`)?[[!1,t.getAngle(null!=n?n:"deg")/t.getAngle(null!=l?l:"deg")*a,null!=l?l:"deg"],[i,o,null!=l?l:"deg"]]:CSS.supports(e,"1px")||CSS.supports("transform",`${e}(1px)`)||/^(el[wh]|)$/.test(e)?[[!1,t.getLength(e,null!=n?n:"px")/t.getLength(e,null!=l?l:"px")*a,null!=l?l:"px"],[i,o,null!=l?l:"px"]]:CSS.supports(e,"1")||CSS.supports("transform",`${e}(1)`)?[[!1,a,""],r]:(U.warn(`unit conversion failed with invalid property '${e}'`),[[!1,0,""],r])},p=(t,e,s,r,a)=>{var n;return s=null!=s?s:a,r=null!==(n=null!=r?r:s)&&void 0!==n?n:a,d(t,e,c(t,e,a,s),c(t,e,a,r))},g=t=>`${t[1]}${t[2]}`,m=t=>CSS.supports("color",t),f=t=>{var e,s;let r=[];if(/^rgb(a)?\(/.test(t)){const e=t.match(/^(?:rgb(?:a)?\()(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)(?:\s*,\s*(\d*\.?\d+))?\)/);e||console.warn("invalid rgba format");const[s,a,n,i=1]=(null!=e?e:[0,0,0,0]).slice(1);r=[s,a,n,i]}else if(/^hsl(a)?\(/.test(t)){const s=t.match(/^(?:hsl(?:a)?\()(\d*\.?\d+)(?:%)?\s*,\s*(\d*\.?\d+)(?:%)?\s*,\s*(\d*\.?\d+)(?:%)?(?:\s*,\s*(\d*\.?\d+)(?:%)?)?\)/);let[a,n,i,o]=(null!==(e=null==s?void 0:s.slice(1))&&void 0!==e?e:[0,0,0,0]).map((t=>t?parseFloat(t):1));n/=100,i/=100;const l=(1-Math.abs(2*i-1))*n,h=l*(1-Math.abs(a/60%2-1)),c=i-l/2,[u,d,p]=a<60?[l,h,0]:a<120?[h,l,0]:a<180?[0,l,h]:a<240?[0,h,l]:a<300?[h,0,l]:[l,0,h],[g,m,f]=[u+c,d+c,p+c].map((t=>Math.round(255*t)));r=[g,m,f,o]}else if(/^#/.test(t)){const e=new RegExp(`^#(\\w(?:\\w)?)(\\w(?:\\w)?)(\\w(?:\\w)?)${5===t.length||9===t.length?"(\\w(?:\\w)?)":""}$`).exec(t);e||console.warn("invalid hex format");const[a,n,i,o=255]=(null!==(s=null==e?void 0:e.slice(1))&&void 0!==s?s:["#fff"]).map((t=>1===t.length?t+t:t)).map((t=>parseInt(t,16)));r=[a,n,i,o/255]}else if(/^transparent/.test(t))r=[0,0,0,0];else if(CSS.supports("color",t)){const e=document.createElement("canvas");e.width=1,e.height=1;const s=e.getContext("2d",{willReadFrequently:!0});s.fillStyle=t,s.fillRect(0,0,1,1);const a=s.getImageData(0,0,1,1).data;r=[...a].slice(0,3).concat(a[3]/255)}return["rgba(",r[0],",",r[1],",",r[2],",",r[3],")"]};function y(t,e,s){let r=[],a=[];return e.forEach(((e,n)=>{const i=s[n],o=M(t,"",e,i,null!=e?e:i);r.push(...g(o[0])),a.push(...g(o[1])),r.push(" "),a.push(" ")})),[r,a]}const v=(t,e)=>{var s;const r={};return(null!==(s=(e=e.replace("none","#fff solid 0px")).match(/(?:[^\s()]+|\([^\)]*\))+/g))&&void 0!==s?s:[]).forEach((e=>{m(e)?r[`${t}Color`]=e:/^(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)$/.test(e)?r[`${t}Style`]=e:h(e)&&(r[`${t}Width`]=e)})),r},w=(t,e)=>{const[s,r=s,a=s,n=r]=e.toString().trim().split(/\s+/);return{[`${t}Top`]:s,[`${t}Right`]:r,[`${t}Bottom`]:a,[`${t}Left`]:n}};function b(t,e){const[s,r=""]=e.split("/").map((t=>t.trim().split(/\s+/))),a=t=>1===t.length?Array(4).fill(t[0]):2===t.length?[t[0],t[1],t[0],t[1]]:3===t.length?[t[0],t[1],t[2],t[1]]:t.slice(0,4),n=a(s),i=a(Array.isArray(r)&&r.length?r:n);return{borderTopLeftRadius:`${n[0]} ${i[0]}`,borderTopRightRadius:`${n[1]} ${i[1]}`,borderBottomRightRadius:`${n[2]} ${i[2]}`,borderBottomLeftRadius:`${n[3]} ${i[3]}`}}function P(t){let e=t.split(" ");return 1==e.length&&(e=[...e,...e]),e}function E(t,e){let s=e.split(" "),r=[],a="backgroundPosition"===t?2:3;return s.forEach((t=>{/^(left|right)$/.test(t)?r[0]=t:/^(top|bottom)$/.test(t)?r[1]=t:(/^(\d+(\.\d+)?(px|%)?)$/.test(t)||"center"===t)&&(r[0]?r[1]?3!==a||r[2]||(r[2]=t):r[1]=t:r[0]=t)})),[r[0],r[1],r[2]].forEach(((t,e)=>{var n;e<a&&!t&&(r[e]=2===e?"0px":s[0]!==r[0===e?1:0]?s[0]:null!==(n=s[1])&&void 0!==n?n:"50%")})),r.slice(0,a).map((t=>t.replace(/left|top/,"0%").replace(/center/,"50%").replace(/right|bottom/,"100%")))}function $(t,e,s){function r(e){e=e.replace("none","black");const s=[];return e.split(",").forEach((e=>{const r=e.trim().split(/\s+/),a=r.find((t=>m(t))),[n="0px",i="0px",o="0px",l="0px"]=r.filter((t=>t!==a));"box-shadow"===t?s.push(n,i,o,l,a,","):s.push(n,i,o,a,",")})),","===s[s.length-1]&&s.pop(),s}const a=r(e),n=r(s),i=Math.max(a.length,n.length),o=[",","0px","0px","0px","0px","rgba(0,0,0,0)"],l=[",","0px","0px","0px","rgba(0,0,0,0)"];for(;a.length<i;)a.push(..."box-shadow"===t?o:l);for(;n.length<i;)n.push(..."box-shadow"===t?o:l);return[[...a],[...n]]}function M(t,e,s,r,a){var n,i;if(s=null!=s?s:a,r=null!==(n=null!=r?r:s)&&void 0!==n?n:a,e=U.camelToKebab(e),/^border-\w+-\w+-radius$/.test(e)){const e=P(s),n=P(r),i=P(a),o=M(t,"elw",e[0],n[0],i[0]),l=M(t,"elh",e[1],n[1],i[1]);return[[...o[0]," ",...l[0]],[...o[1]," ",...l[1]]]}if(/^transform-origin$/.test(e)){const n=E(e,s),i=E(e,r),o=E(e,a),l=M(t,"elw",n[0],i[0],o[0]),h=M(t,"elh",n[1],i[1],o[1]),c=M(t,"",n[2],i[2],o[2]);return[[...l[0]," ",...h[0]," ",...c[0]],[...l[1]," ",...h[1]," ",...c[1]]]}if(/^background-position$/.test(e)){const n=E(e,s),i=E(e,r),o=E(e,a),l=M(t,"elw",n[0],i[0],o[0]),h=M(t,"elh",n[1],i[1],o[1]);return[[...l[0]," ",...h[0]],[...l[1]," ",...h[1]]]}if(/^(box|text)-shadow$/.test(e)){const a=$(e,s,r);return y(t,a[0],a[1])}if(/^filter$/.test(e)){const e=function(t,e){function s(t){const e=/(\w+-?\w*)\(([^()]*\([^()]*\)[^()]*)\)|(\w+-?\w*)\(([^()]*)\)/g,s=[];let r;for(;null!==(r=e.exec(t));)s.push([r[1]||r[3],r[2]||r[4]]);return s}const r={blur:"0px",brightness:"100%",contrast:"100%",grayscale:"0","hue-rotate":"0deg",invert:"0",opacity:"100%",saturate:"100%",sepia:"0","drop-shadow":"0px 0px 0px black"};return function(t,e){const a=[],n=[],i=s(t),o=s(e),l=i.map((t=>t[0])),h=o.map((t=>t[0]));let c=0;for(;c<i.length&&c<o.length&&l[c]===h[c];)a.push(i[c]),n.push(o[c]),c++;return c===i.length?o.slice(c).forEach((t=>{a.push([t[0],r[t[0]]]),n.push(t)})):c===o.length?i.slice(c).forEach((t=>{a.push(t),n.push([t[0],r[t[0]]])})):(i.forEach((t=>{a.push(t),n.push([t[0],r[t[0]]])})),o.forEach((t=>{a.push([t[0],r[t[0]]]),n.push(t)}))),[a,n]}(t,e)}(s,r);let a=[[],[]];return e[0].forEach(((s,r)=>{const n=s[1],i=e[1][r][1],o=/^drop-shadow$/.test(s[0])?y(t,$("text-shadow",n,i)[0],$("text-shadow",n,i)[1]):M(t,/^invert$/.test(s[0])?"opacity":/^hue-rotate$/.test(s[0])?"rotate":"",n,i,null!=n?n:i);a[0].push(`${s[0]}(`,...g(o[0]),") "),a[1].push(`${s[0]}(`,...g(o[1]),") ")})),a}return/^opacity$/.test(e)&&("string"==typeof s&&(s=s.replace(/(\d+)%/g,((t,e)=>(e/100).toString()))),"string"==typeof r&&(r=r.replace(/(\d+)%/g,((t,e)=>(e/100).toString())))),/^(letter|word)-spacing$/.test(e)&&("string"==typeof s&&(s=s.replace("normal","0px")),"string"==typeof r&&(r=r.replace("normal","0px"))),m(s)||m(r)?[f(s),f(r)]:h(null!==(i=s)&&void 0!==i?i:r)?p(t,e,u(s),u(r),u(a)):[[s],[r]]}const D=180/Math.PI,x=([t,e,s])=>Math.sqrt(t*t+e*e+s*s),T=([t,e,s],r)=>[t,e,s].map((t=>1*t/r)),S=([t,e,s],[r,a,n])=>t*r+e*a+s*n,R=([t,e,s],[r,a,n],i,o)=>[t*i+r*o,e*i+a*o,s*i+n*o];function k(t){const e=new DOMMatrix(t),s=[[e.m11,e.m12,e.m13],[e.m21,e.m22,e.m23],[e.m31,e.m32,e.m33]],r=new Array(3),a=new Array(3);if(r[0]=x(s[0]),s[0]=T(s[0],r[0]),a[0]=S(s[0],s[1]),s[1]=R(s[1],s[0],1,-a[0]),r[1]=x(s[1]),s[1]=T(s[1],r[1]),a[0]/=r[1],a[1]=S(s[0],s[2]),s[2]=R(s[2],s[0],1,-a[1]),a[2]=S(s[1],s[2]),s[2]=R(s[2],s[1],1,-a[2]),a[0]=Math.atan(a[0]),a[1]=Math.atan(a[1]),a[2]=Math.atan(a[2]),r[2]=x(s[2]),s[2]=T(s[2],r[2]),a[1]/=r[2],a[2]/=r[2],S(s[0],(([t,e,s],[r,a,n])=>[e*n-s*a,s*r-t*n,t*a-e*r])(s[1],s[2]))<0)for(let t=0;t<3;t++)r[t]*=-1,s[t]=s[t].map((t=>-t));const n=new Array(4);n[0]=.5*Math.sqrt(Math.max(1+s[0][0]-s[1][1]-s[2][2],0)),n[1]=.5*Math.sqrt(Math.max(1-s[0][0]+s[1][1]-s[2][2],0)),n[2]=.5*Math.sqrt(Math.max(1-s[0][0]-s[1][1]+s[2][2],0)),n[3]=.5*Math.sqrt(Math.max(1+s[0][0]+s[1][1]+s[2][2],0)),s[2][1]>s[1][2]&&(n[0]=-n[0]),s[0][2]>s[2][0]&&(n[1]=-n[1]),s[1][0]>s[0][1]&&(n[2]=-n[2]);const[i,o,l,h]=n,c=i*i,u=o*o,d=l*l,p=i*o+l*h,g=h*h+c+u+d,m=p>.49999*g?[0,2*Math.atan2(i,h)*D,90]:p<-.49999*g?[0,-2*Math.atan2(i,h)*D,-90]:[Math.round(Math.atan2(2*i*h-2*o*l,1-2*c-2*d)*D),Math.round(Math.atan2(2*o*h-2*i*l,1-2*u-2*d)*D),Math.round(Math.asin(2*(i*o+l*h))*D)];return{translateX:e.m41,translateY:e.m42,translateZ:e.m43,scaleX:Math.round(1e3*r[0])/1e3,scaleY:Math.round(1e3*r[1])/1e3,scaleZ:Math.round(1e3*r[2])/1e3,rotateX:m[0],rotateY:m[1],rotateZ:m[2],skewX:Math.round(a[0]*D*1e3)/1e3,skewY:Math.round(a[1]*D*1e3)/1e3}}function A(t,e){let s=u(e);return null==s[2]&&(s[2]=/^(skew|rotate)[XYZ]/.test(t.toString())?"deg":/^scale/.test(t.toString())?"":"px"),s}function O(t){const e={};return Object.keys(t).forEach((s=>{e[s]=A(s,t[s])})),e}const I={wiw:0,wih:0,vmin:0,vmax:0};function j(){I.wiw=window.innerWidth/100,I.wih=window.innerHeight/100,I.vmin=Math.min(I.wiw,I.wih),I.vmax=Math.max(I.wiw,I.wih)}const C={deg:1,rad:180/Math.PI,grad:.9,turn:360};class z{constructor(t){this.el=t,this.css=getComputedStyle(t),this.dcss=getComputedStyle(document.documentElement)}getLength(t,e){var s,r;0===I.wiw&&(j(),window.addEventListener("resize",j));let a=1;switch(!0){case/^(elw|\w+[xX])$/.test(t):a=this.el.offsetWidth;break;case/^(elh|\w+[yY])$/.test(t):a=this.el.offsetHeight;break;case/^((max|min|column)-)?width|(margin-|padding-)?(top|right|bottom|left)$/.test(t):this.par=null!==(s=this.par)&&void 0!==s?s:U.getParent(this.el),a=this.par.offsetWidth;break;case/^((max|min|column)-height|top|bottom)$/.test(t):this.par=null!==(r=this.par)&&void 0!==r?r:U.getParent(this.el),a=this.par.offsetHeight;break;case/^font-size$/.test(t):a=parseFloat(this.dcss.fontSize);break;case/^line-height$/.test(t):a=parseFloat(this.css.fontSize)}switch(a/=100,e){case"px":return 1;case"%":return a;case"rem":return parseFloat(this.dcss.fontSize);case"em":return parseFloat(this.css.fontSize);case"cm":return 37.8;case"mm":return 3.78;case"Q":return.945;case"in":return 96;case"pc":return 16;case"pt":return 1.333;case"ex":return.5*parseFloat(this.css.fontSize);case"ch":return.6*parseFloat(this.css.fontSize);case"vmin":return I.vmin;case"vmax":return I.vmax;case"vb":return/^(ltr|rtl)$/.test(this.css.direction)?I.wih:I.wiw;case"vw":case"svw":case"lvw":case"dvw":return I.wiw;case"vh":case"svh":case"lvh":case"dvh":return I.wih;default:return 0}}getAngle(t){return C[t]||0}}function X(t,e,s){return t.map(((t,r)=>function(t,e,s){return/^[+-]?\d*\.?\d+$/.test(t)?U.round((1-s)*t+s*e,4):s>0?e:t}(t,e[r],s)))}function Y(t,e,s,r,a){const n=[{},{},{}];if(0===e.length)return n;let i=O(k(a.transform));const o={x:"translateX",y:"translateY",z:"translateZ",rotate:"rotateZ"};return[s,r].forEach(((s,r)=>{const a=s.transform?O(k(function(t,e){const s=(e,s)=>{const r=d(t,e,A(e,s),u("0px"))[0];return`${r[1]}${r[2]}`},r=(t,e)=>`${t[0]}${e.map(((e,r)=>s(e,t[r+1]))).join(", ")})`,a=(t=>{var e;return null!==(e=(null!=t?t:"").match(/(\w+\()([^()]*)(\))/g))&&void 0!==e?e:[]})(e),n=a.map((t=>/^translate3d\(|^translate\(|^translate[XYZ]\(/.test(t)?(t=>{var e;return null!==(e=(null!=t?t:"").match(/(\w+\()([^,]+)(?:,\s*([^,]+))?(?:,\s*([^,]+))?\)/))&&void 0!==e?e:[]})(t).slice(1).filter((t=>void 0!==t)):t));return n.flatMap((t=>Array.isArray(t)?/^translate3d/.test(t[0])?r(t,["translateX","translateY","translateZ"]):/^translate\(/.test(t[0])?r(t,["translateX","translateY"]):/(^translate[XYZ])\(/.test(t[0])?`${t[0]}${s(t[0].slice(0,-1),t[1])})`:t:[t])).join(" ")}(t,s.transform))):void 0;(a||1===r)&&(n[r+1]=null!=a?a:structuredClone(n[1])),delete s.transform,e.forEach((e=>{var a,l;if(null==s[e])return;let h=null!==(a=o[e])&&void 0!==a?a:e;if(/^scale$|^translate$|^translate3d$/.test(h))((e,s,r)=>{const a=/^scale$/.test(e)?["scaleX","scaleY"]:["translateX","translateY","translateZ"];("scale"===e&&1===s.length?[s[0],s[0]]:s).forEach(((e,s)=>{var o;n[r][a[s]]=c(t,a[s],0===r?i[a[s]]:null!==(o=n[1][a[s]])&&void 0!==o?o:i[a[s]],u(e))}))})(h,Array.isArray(s[e])?s[e]:s[e].toString().split(" "),r+1);else{if(!Array.isArray(s[e])&&"number"==typeof s[e]){const t=/^(skew|rotate)[XYZ]/.test(h)?"deg":/^scale/.test(h)?"":"px";s[e]=`${s[e]}${t}`}n[r+1][h]=c(t,h,0==r?i[h]:null!==(l=n[1][h])&&void 0!==l?l:i[h],u(s[e]))}}))})),[...new Set([...Object.keys(n[1]),...Object.keys(n[2])])].forEach((e=>{[n[0][e]]=p(t,e,void 0,n[1][e],i[e]),[n[1][e],n[2][e]]=p(t,e,n[1][e],n[2][e],i[e])})),n}function Z(t,e,s){const r=getComputedStyle(t),a=new z(t),[n,i]=Array.from(new Set([...Object.keys(e),...Object.keys(s)])).reduce(((t,e)=>(t[/^([xyz]|transform|(translate([XYZ]|3d)?)|(rotat(e|ion))?[XYZ]?|scale[XYZ]?|skew[XYZ])$/i.test(e)?0:1].push(e),t)),[[],[]]),o=Y(a,n,e,s,r),l=function(t,e,s,r){const a=[{},{},{}];return e.forEach((t=>{var a,n,i;if(/^autoHide$/.test(t))e.includes("visibility")&&U.warn("remove 'visibility' in order to use 'autoHide'");else{if(!(t in document.documentElement.style))return U.warn(`Unknown property '${t}'. Missing plugin?`),void(e=e.filter((e=>e!==t)));if(!CSS.supports(U.camelToKebab(t),null!==(a=s[t])&&void 0!==a?a:r[t])&&!CSS.supports(U.camelToKebab(t),(null!==(n=s[t])&&void 0!==n?n:r[t])+"px"))return void U.warn(`Property ${t} has invalid value ${null!==(i=s[t])&&void 0!==i?i:r[t]}`)}[s,r].forEach((s=>{if(!s[t])return;const r=[[/^(border(Top|Right|Bottom|Left)?|outline)$/,v],[/^(margin|padding)$/,w],[/^borderRadius$/,b]];for(const[a,n]of r)if(a.test(t)){const r=n(t,s[t]);Object.assign(s,r),e=e.filter((e=>e!==t)).concat(Object.keys(r).filter((t=>!e.includes(t)))),delete s[t];break}}))})),e.forEach((e=>{[a[0][e]]=M(t,e,void 0,void 0,t.css[e]),[a[1][e],a[2][e]]=M(t,e,s[e],r[e],t.css[e])})),a}(a,i,e,s);return[o[0],l[0],o[1],l[1],o[2],l[2]].forEach((t=>{Object.keys(t).forEach((e=>{t[e]=t[e].filter((t=>"boolean"!=typeof t))}))})),[[o[0],l[0]],[o[1],l[1]],[o[2],l[2]]]}function F(t,e){Object.keys(e[1]).forEach((s=>{"autoHide"===s?t.style.visibility=0==e[1].opacity?"hidden":"visible":t.style[s]=e[1][s]})),t.style.transform=function({translateX:t,translateY:e,translateZ:s,scaleX:r,scaleY:a,scaleZ:n,rotateX:i,rotateY:o,rotateZ:l,skewX:h,skewY:c}){return[(t||e||s)&&`translate3d(${null!=t?t:0}, ${null!=e?e:0}, ${null!=s?s:0})`,i&&"0deg"!=i&&`rotateX(${i})`,o&&"0deg"!=o&&`rotateY(${o})`,l&&"0deg"!=l&&`rotate(${l})`,(r||a)&&("1"!=r||"1"!=a)&&`scale(${null!=r?r:1}, ${null!=a?a:1})`,n&&"1"!=n&&`scaleZ(${n})`,h&&"0deg"!=h&&`skewX(${h})`,c&&"0deg"!=c&&`skewY(${c})`].filter(Boolean).join(" ")}(e[0])}class q{constructor(t){this.element=t,this.initialTransform=O(k(getComputedStyle(t).transform)),Object.keys(this.initialTransform).forEach((t=>{this.initialTransform[t]=g(this.initialTransform[t])})),this.properties=[]}getProperties(){return this.properties}setProperties(t){this.properties=[{...this.initialTransform,...this.properties[0],...t[0]},{...this.properties[1],...t[1]}]}getElement(){return this.element}}class L{static addTween(t,e){let s=L.fragments.find((e=>e.getElement()===t));return s||(s=new q(t),L.fragments.push(s)),this.tweens.find((t=>t===e))||this.tweens.push(e),s}static getTweens(t){let e=[];return(t=U.select(t)).forEach((t=>{this.tweens.forEach((s=>{s.elements[0]==t&&e.push(s)}))})),e}}L.fragments=[],L.tweens=[];const _=t=>{const e=t.getBoundingClientRect();return[e.left+e.width/2,e.top+e.height/2]},B=([t,e],s)=>{const r=Math.floor(s/e);return[e>1?s%e/(e-1):.5,t>1?r/(t-1):.5]},H=t=>{const e=Math.min(...t),s=Math.max(...t);return t.map((t=>(t-e)/(s-e)))},N=(t,e)=>{if(0==e.each)return Array.from({length:t.length},(()=>0));switch((Array.isArray(e.from)||e.axis||"center"==e.from||"right top"==e.from||"left bottom"==e.from)&&null==e.layout&&(e.layout="distance"),e.from){case"start":case"left":case"top left":case"left top":case void 0:e.from=e.layout?[0,0]:0;break;case"center":e.from=e.layout?[.5,.5]:(t.length-1)/2;break;case"end":case"right":case"bottom right":case"right bottom":case-1:e.from=e.layout?[1,1]:t.length-1;break;case"top right":case"right top":e.from=[1,0];break;case"bottom left":case"left bottom":e.from=[0,1];break;case"random":return e.invert&&U.warn("stagger invert has no effect when using random"),e.axis&&U.warn("stagger axis has no effect when using random"),H(Array.from({length:t.length},(()=>Math.random()))).map((s=>s*e.each*(t.length-1)))}let s=[];if(e.layout){let a=[],{layout:n,axis:i="xy",from:o=[.5,.5]}=e,l=1/0,h=1/0,c=-1/0,u=-1/0;if(Array.isArray(n)||"grid"===n){n="grid"===n?(t=>[new Set(t.map((t=>_(t)[0]))).size,new Set(t.map((t=>_(t)[1]))).size])(t):n;o=Array.isArray(o)?o:B(n,o),[l,c,h,u]=[0,1,0,1],a=t.map(((t,e)=>B(n,e)))}else if(a=t.map(_),a.forEach((([t,e])=>{l=Math.min(l,t),h=Math.min(h,e),c=Math.max(c,t),u=Math.max(u,e)})),!Array.isArray(o)){const[t,s]=a[o];e.from=[(t-l)/(c-l),(s-h)/(u-h)]}if((r=a).every((([t,e])=>t===r[0][0]&&e===r[0][1])))return U.warn("Elements on the same location. Can't apply any stagger layouts."),s=H(t.map(((t,e)=>e))).map((s=>s*e.each*(t.length-1))),s;const[d,p]=[c-l,u-h],[g,m]=[l+d*e.from[0],h+p*e.from[1]],[f,y]=[i.includes("x")?1:0,i.includes("y")?1:0],v=(t,e)=>{const[s,r]=[t-g,e-m];return f&&y?Math.sqrt(s**2+r**2)/Math.sqrt(d**2+p**2):f?0===d?0:s/d:y?0===p?0:r/p:0},w=Math.max(...a.map((([t,e])=>v(t,e))));s=a.map((([t,e])=>Math.abs(v(t,e)/(w||1))))}else for(let r=0;r<t.length;r++)s.push(Math.abs(r-e.from));var r;return s=H(s),e.invert&&(s=s.map((t=>Math.abs(t-1)))),s=s.map((s=>s*e.each*(t.length-1))),s};class K extends a{constructor(t,s,a){let n=U.filterObjects(s,e()),i=U.filterObjects(a,e());super({...n[0],...i[0]}),this.elements=t?U.select(t):[],this.from=n[1],this.to=i[1],0!=this.elements.length?(this.elements.length>1?(this.timeline=((t,e,s,a)=>{var n,i;e=U.select(e);let l=t.options.stagger;"number"==typeof l&&(l={each:l}),l.each=null!==(n=l.each)&&void 0!==n?n:l.duration?l.duration/(e.length-1):0,Object.keys({onUpdate:()=>{},onChange:()=>{},onStart:()=>{},onComplete:()=>{},onReverseStart:()=>{},onReverseComplete:()=>{},onRepeat:()=>{}}).forEach((t=>{a[t]=l[t]?l[t]:()=>{}}));const h=new o({ease:null!==(i=l.ease)&&void 0!==i?i:r.none()}),c=N(e,l);return e.forEach(((e,r)=>{var n,i,o;h.add(new K(e,s,Object.assign({},a,{at:Number.parseFloat(c[r].toFixed(4)),duration:t.options.duration,ease:t.options.ease,alternateEase:t.options.alternateEase,repeat:null!==(n=t.options.stagger.repeat)&&void 0!==n?n:0,iterationDelay:null!==(i=t.options.stagger.iterationDelay)&&void 0!==i?i:0,alternate:null!==(o=t.options.stagger.alternate)&&void 0!==o&&o,preRender:t.options.preRender,delay:0,timeScale:1,stagger:0})))})),t.setDuration(h.getDuration()),t.to={},h})(this,this.elements,s,a),this.elements=[]):this.options.keyframes&&(this.timeline=((t,s,a,n)=>{const i=new o,l=t.options.keyframes,h=t.getDuration()||1e-8,c=t.options.preRender;i.options.ease=l.ease?r.parse(l.ease):r.parse("none");const u=U.filterObjects(a,e())[1];if(l instanceof Array){const t=Object.keys(l).length;l.forEach(((e,r)=>{i.add(new K(s,0==r?u:{},{...e,at:r*h/t,duration:h/t,...c&&0===r&&{preRender:!0}}))}))}else{const a=U.filterObjects(l,{ease:null,easeEach:null})[1],o=U.filterObjects(n,e())[1];if(Object.keys(a)[0].includes("%")){const e=Object.keys(a).sort(((t,e)=>parseFloat(t)-parseFloat(e)));let n={};const d=Array.from(new Set(Object.values(a).flatMap(Object.keys))),p={"0%":{...Object.fromEntries(Object.entries(u).filter((([t])=>d.includes(t))))},"100%":{...Object.fromEntries(Object.entries(o).filter((([t])=>d.includes(t))))}},g=[...new Set([...Object.keys(p["0%"]).length>0?["0%"]:[],...e,...Object.keys(p["100%"]).length>0?["100%"]:[]])],m=g.reduce(((t,e)=>({...t,[e]:{...p[e]||{},...a[e]||{}}})),{});g.forEach((e=>{const a=U.filterObjects(m[e],{id:void 0,delay:0,delayRecharge:!1,duration:1,repeat:0,iterationDelay:0,alternate:!1,paused:!1,ease:void 0,alternateEase:void 0,playhead:0,iteration:0,reversed:!1,timeScale:1,at:void 0,preRender:!1,stagger:0,keyframes:void 0,backwards:!1}),o=a[0],u=a[1];let d=.01*Number.parseFloat(e);Object.keys(u).forEach((e=>{var a,p,g,f,y;0!=d&&i.add(new K(s,null!=n[e]?{[e]:m[100*n[e]+"%"][e]}:{},{[e]:u[e],duration:(d-(null!==(a=n[e])&&void 0!==a?a:0))*h,...o,ease:null!==(f=null!==(g=null!==(p=o.ease)&&void 0!==p?p:l.easeEach)&&void 0!==g?g:t.options.ease)&&void 0!==f?f:r.powerInOut(),...c&&!n[e]?{preRender:!0}:{}}),(null!==(y=n[e])&&void 0!==y?y:0)*h),n[e]=d})),i.setDuration(h)}))}else Object.keys(a).forEach((e=>{var r;const n=a[e],o=n.length,u=h/Math.max(1,o-1);for(let a=0;a<(1===o?1:o-1);a++)i.add(new K(s,{[e]:n[a]},{[e]:1===o?n[0]:n[a+1],at:1===o?0:a*u,duration:1===o?h/o:u,ease:null!==(r=l.easeEach)&&void 0!==r?r:t.options.ease,...c&&0===a?{preRender:!0}:{}}))}))}return i})(this,this.elements[0],s,a)),this.elements[0]&&(this.fragment=L.addTween(this.elements[0],this)),this.options.preRender&&(this.elements[0]&&this.render(),this.setTotalProgress(0)),this.timeline&&this.timeline.setParent(this)):U.warn(`Element '${t}' not found`)}render(){this.properties=Z(this.elements[0],this.from,this.to)}setTotalProgress(t,e=!0){t=U.round(U.clamp(t,0,1),10),super.setTotalProgress(t,e),this.fragment&&(!this.properties&&t>=0&&t<=1&&this.render(),this.properties&&(this.fragment.setProperties(function([t,e,s],r,a){const n={},i={};return U.round(r,4)!==(a.backwards?1:0)||a.preRender?Object.keys(e[0]).forEach((t=>{n[t]=X(e[0][t],s[0][t],r).join("")})):Object.keys(e[0]).forEach((e=>{n[e]=t[0][e].join("")})),Object.keys(e[1]).forEach((t=>{const a=X(e[1][t],s[1][t],r).join("");!CSS.supports(U.camelToKebab(t),a)&&r<0||(i[t]=a)})),[n,i]}(this.properties,a.getEasedProgress(this,t),this.options)),F(this.elements[0],this.fragment.getProperties()))),this.timeline&&this.timeline.setTotalProgress(a.getProgress(this,t))}play(){this.timeline&&this.timeline.play(),super.play()}reverse(){this.timeline&&this.timeline.reverse(),super.reverse()}}const U=new class{constructor(){this.pipeline=(...t)=>function(...e){let s=e;for(const e of t)s=e(...s);return s},this.filterObjects=(t,e)=>{const s={},r={};return Object.keys(t).forEach((a=>{a in e?s[a]=t[a]:r[a]=t[a]})),[s,r]},this.random=(...t)=>{const e=!0===t[t.length-1],[s,r,a=1]=t;return Array.isArray(s)?()=>s[Math.floor(Math.random()*s.length)]:()=>{const t=r-s,n=0===a?Math.random()*t+s:Math.floor(Math.random()*(t/a))*a+s;return e?parseFloat(n).toFixed(4):n}},this.shuffle=t=>{for(let e=(t=[...t]).length-1;e>0;e--){const s=Math.floor(Math.random()*(e+1));[t[e],t[s]]=[t[s],t[e]]}return t},this.clamp=(t,e=0,s=1)=>Math.min(s,Math.max(e,t)),this.round=(t,e=0)=>Number(t.toFixed(e)),this.lerp=(t,e,s)=>this.round((1-s)*t+s*e,4),this.isEven=t=>t%2,this.isOdd=t=>!this.isEven(t),this.pageReady=t=>{"complete"!==document.readyState?window.addEventListener("load",(()=>{document.fonts.ready.then((()=>{t()}))})):t()},this.select=t=>{if("string"==typeof t){const e=t.match(/\w+\[(\d+)\]/);if(e){const s=parseInt(e[1],10);return[document.querySelectorAll(t.replace(`[${e[1]}]`,""))[s]]}return Array.from(document.querySelectorAll(t))}return t instanceof Element?[t]:t instanceof NodeList||t instanceof Array?Array.from(t).flatMap((t=>this.select(t))):t instanceof Document?[t.documentElement]:(U.warn("Could not collect these elements:"+t),[])},this.selectCss=(t,e,s,r=!1)=>{const a=this.select(s)[0].querySelectorAll("*");return Array.from(a).filter((s=>{const a=window.getComputedStyle(s).getPropertyValue(t).trim();return r?a!==e.trim():a===e.trim()}))},this.getParent=t=>{const e=getComputedStyle(t).position;if("absolute"===e||"fixed"===e){for(;t&&"relative"!==getComputedStyle(t).position&&t!==document.body;)t=t.parentElement||document.body;return t}return t.parentElement||document.body},this.camelToKebab=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),this._p="background-color:rgba(0,0,0,0.5);padding:3px 7.5px;"}version(){U.log("v0.0.1")}options(e){!function(e){t={...t,...e}}(e)}fromTo(t,e={},s={}){return new K(t,Object.assign({preRender:!0},e),s)}to(t,e={}){return new K(t,{},e)}from(t,e={}){return new K(t,{},Object.assign({preRender:!0},e,{backwards:!e.backwards}))}timeline(t){return new o(t)}set(t,e={}){return new K(t,{},Object.assign(e,{duration:0}))}use(t){"function"!=typeof t?U.warn("A plugin has to be a function."):t(this)}log(t){console.log(`%cAnimatry%c ${t}`,this._p,"")}warn(t){console.warn(`%cAnimatry%c ${t}`,this._p,"")}};return U}));
//# sourceMappingURL=animatry.min.js.map