function GScreateNumberElement(e,t){let n=document.createElement("span");return n.className=`gs-counter-number ${t}`,n.textContent=e,n}function GSanimateCounter(e,t,n,r,a,o,u){if(e>=t){a.classList.add("gs-counter-finished");return}a.innerHTML="";let s=Math.min(e+o,t),l=GScreateNumberElement(GSroundNumberforCounter(e,u),"gs-current-number"),i=GScreateNumberElement(GSroundNumberforCounter(s,u),"gs-next-number");a.appendChild(l),a.appendChild(i),requestAnimationFrame(()=>{requestAnimationFrame(()=>{l.style.transform=`translateY(-${r}px)`,l.style.opacity="0",i.style.transform="translateY(0)",i.style.opacity="1"})}),setTimeout(()=>GSanimateCounter(s,t,n,r,a,o,u),n)}function GSroundNumberforCounter(e,t){return e.toFixed(t)}document.querySelectorAll("[data-gs-counter]").forEach(e=>{let t=e.textContent,n=t.match(/\d+/);if(n){let r=JSON.parse(e.getAttribute("data-gs-counter")),a=parseFloat(n[0]),o=e.getAttribute("data-counter-end");o=o?parseFloat(o):100;let u=parseFloat(r.end)||o,s=1e3*(parseFloat(r.duration)||5),l=parseFloat(r.offset)||100,i=parseFloat(r.step)||1,c=(i.toString().split(".")[1]||"").length,m=Math.ceil((u-a)/i),d=s/m,g=document.createElement("span");g.className="gs-greenlight-counter",g.textContent=a,e.innerHTML="",e.appendChild(g);let f=e.querySelector(".gs-greenlight-counter"),p=new IntersectionObserver((e,t)=>{e.forEach(e=>{e.isIntersecting&&(GSanimateCounter(a,u,d,l,f,i,c),t.disconnect())})},{threshold:.1});p.observe(f)}});