"use strict";var e=require("react");const t=e=>new Date(e).getTime()-new Date().getTime(),r=e=>{let t=Math.floor(e/6e4),r=Math.floor(e%6e4/1e3),l=`${t<10?"0":""}${t}:${r<10?"0":""}${r}`;return{isExpired:t+r<=0,format:l}};exports.useCountdown=l=>{let[n,s]=e.useState(t(l));return e.useEffect(()=>{let e=null;return n>0&&(e=setInterval(()=>{n>0?s(t(l)):e&&(clearInterval(e),e=null)},1e3)),()=>{e&&clearInterval(e)}},[n,l]),e.useEffect(()=>{s(t(l))},[l]),r(n)},exports.useGetTextExpired=t=>{let{isExpired:r,expiredText:l,conditionText:n,format:s}=t,u=e.useMemo(()=>r?l:`${n} <span dir="ltr">${s}</span>`,[r,s,n,l]);return{text:u}};
