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