"use strict";const t=require("../common/config.js");function i(){return{data:()=>({transitionClass:"",transitionDurations:300,className:"",realVisible:!1}),props:{visible:{type:Boolean,default:null},appear:Boolean,name:{type:String,default:"fade"},durations:{type:Number,optionalTypes:[Array]}},watch:{visible:{handler(t,i){this.watchVisible(t,i)}}},created(){this.status="",this.transitionT=0},beforeMount(){this.dataDurations=this.getDurations(),this.visible&&this.enter(),this.inited=!0},destroyed(){clearTimeout(this.transitionT)},methods:{watchVisible(t,i){this.inited&&t!==i&&(t?this.enter():this.leave())},getDurations(){const{durations:t}=this;return Array.isArray(t)?t.map((t=>Number(t))):[Number(t),Number(t)]},enter(){const{name:i,transitionDurations:s}=this,[e]=this.dataDurations;this.status="entering",this.realVisible=!0,this.transitionClass=`${t.prefix}-${i}-enter ${t.prefix}-${i}-enter-active`,setTimeout((()=>{this.transitionClass=`${t.prefix}-${i}-enter-active ${t.prefix}-${i}-enter-to`}),30),this.transitionT="number"==typeof e&&e>0?setTimeout(this.entered.bind(this),e+30):setTimeout("leaving"===this.status?this.leaved.bind(this):()=>{},s+30)},entered(){this.customDuration=!1,clearTimeout(this.transitionT),this.status="entered",this.transitionClass=""},leave(){const{name:i,transitionDurations:s}=this,[,e]=this.dataDurations;this.status="leaving",this.transitionClass=`${t.prefix}-${i}-leave  ${t.prefix}-${i}-leave-active`,clearTimeout(this.transitionT),setTimeout((()=>{this.transitionClass=`${t.prefix}-${i}-leave-active ${t.prefix}-${i}-leave-to`}),30),"number"==typeof e&&e>0?(this.customDuration=!0,this.transitionT=setTimeout(this.leaved.bind(this),e+30)):this.transitionT=setTimeout("leaving"===this.status?this.leaved.bind(this):()=>{},s+30)},leaved(){this.customDuration=!1,this.$emit("leaved"),clearTimeout(this.transitionT),this.status="leaved",this.transitionClass="",this.realVisible=!1},onTransitionEnd(){this.customDuration||(clearTimeout(this.transitionT),"entering"===this.status&&this.visible?this.entered():"leaving"!==this.status||this.visible||this.leaved())}}}}const s=i();exports.transition=i,exports.transitionMixins=s;
