import{be as t}from"./index-Cg3FU-dV.js";class e{constructor(e,s){this.options=e,this.animation=t({...e}),this.currentStepAnimates={},this.next=0,this.$=s}_nvuePushAnimates(t,e){let i=this.currentStepAnimates[this.next],n={};if(n=i||{styles:{},config:{}},s.includes(t)){n.styles.transform||(n.styles.transform="");let s="";"rotate"===t&&(s="deg"),n.styles.transform+=`${t}(${e+s}) `}else n.styles[t]=`${e}`;this.currentStepAnimates[this.next]=n}_animateRun(t={},e={}){let s=this.$.$refs.ani.ref;if(s)return new Promise(((i,n)=>{nvueAnimation.transition(s,{styles:t,...e},(t=>{i()}))}))}_nvueNextAnimate(t,e=0,s){let i=t[e];if(i){let{styles:n,config:a}=i;this._animateRun(n,a).then((()=>{e+=1,this._nvueNextAnimate(t,e,s)}))}else this.currentStepAnimates={},"function"==typeof s&&s(),this.isEnd=!0}step(t={}){return this.animation.step(t),this}run(t){this.$.animationData=this.animation.export(),this.$.timer=setTimeout((()=>{"function"==typeof t&&t()}),this.$.durationTime)}}const s=["matrix","matrix3d","rotate","rotate3d","rotateX","rotateY","rotateZ","scale","scale3d","scaleX","scaleY","scaleZ","skew","skewX","skewY","translate","translate3d","translateX","translateY","translateZ"];function i(t,s){if(s)return clearTimeout(s.timer),new e(t,s)}s.concat(["opacity","backgroundColor"],["width","height","left","right","top","bottom"]).forEach((t=>{e.prototype[t]=function(...e){return this.animation[t](...e),this}}));export{i as c};
