import e from"../_util/classNames.mjs";import{computed as t,createVNode as n,defineComponent as r,onUnmounted as i,reactive as a,ref as o,watch as s}from"vue";function c({prefixCls:t,value:r,current:i,offset:a=0}){let o;return a&&(o={position:`absolute`,top:`${a}00%`,left:0}),n(`p`,{style:o,class:e(`${t}-only-unit`,{current:i})},[r])}function l(e,t,n){let r=e,i=0;for(;(r+10)%10!==t;)r+=n,i+=n;return i}var u=r({compatConfig:{MODE:3},name:`SingleNumber`,props:{prefixCls:String,value:String,count:Number},setup(e){let r=t(()=>Number(e.value)),u=t(()=>Math.abs(e.count)),d=a({prevValue:r.value,prevCount:u.value}),f=()=>{d.prevValue=r.value,d.prevCount=u.value},p=o();return s(r,()=>{clearTimeout(p.value),p.value=setTimeout(()=>{f()},1e3)},{flush:`post`}),i(()=>{clearTimeout(p.value)}),()=>{let t,i={},a=r.value;if(d.prevValue===a||Number.isNaN(a)||Number.isNaN(d.prevValue))t=[c({...e,current:!0})],i={transition:`none`};else{t=[];let n=a+10,r=[];for(let e=a;e<=n;e+=1)r.push(e);let o=r.findIndex(e=>e%10===d.prevValue);t=r.map((t,n)=>{let r=t%10;return c({...e,value:r,offset:n-o,current:n===o})});let s=d.prevCount<u.value?1:-1;i={transform:`translateY(${-l(d.prevValue,a,s)}00%)`}}return n(`span`,{class:`${e.prefixCls}-only`,style:i,onTransitionend:()=>f()},[t])}}});export{u as default};