import{r as t,h as i,H as s}from"./p-40eb06b7.js";const h=class{constructor(i){t(this,i),this.value=0,this.from=0,this.fixed=0,this.thousandsSeparator=",",this.interval=1,this.withoutAnimation=!1,this.lastNumber=void 0,this.actualNumber=void 0,this.typingTimer=void 0}onChangeNumber(){this.withoutAnimation?(this.actualNumber=this.numberWithCommas(this.value),this.lastNumber=this.value):(clearTimeout(this.typingTimer),this.typingTimer=setTimeout(this.animateNumber,1e3*this.interval))}componentWillLoad(){this.lastNumber=this.from,this.actualNumber=this.from.toFixed(this.fixed)}componentDidLoad(){this.withoutAnimation?this.actualNumber=this.numberWithCommas(this.value):setTimeout((()=>{this.animateNumber()}),300)}animateNumber(){let t=null;const i=s=>{t||(t=s);const h=Math.min((s-t)/1e3,1);this.actualNumber=this.numberWithCommas(h*(this.value-this.lastNumber)+this.lastNumber),h<1?window.requestAnimationFrame(i):this.lastNumber=this.value};window.requestAnimationFrame(i)}numberWithCommas(t){return parseFloat(t).toFixed(this.fixed).replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator)}render(){return i(s,{key:"67aee761100050823da210036536ae5ea84b9e0e"},this.actualNumber)}static get watchers(){return{value:["onChangeNumber"]}}};h.style="x-number{display:inline-block}";export{h as x_number}