var e=[[`Y`,1e3*60*60*24*365],[`M`,1e3*60*60*24*30],[`D`,1e3*60*60*24],[`H`,1e3*60*60],[`m`,1e3*60],[`s`,1e3],[`S`,1]];function t(t,n){let r=t,i=/\[[^\]]*\]/g,a=(n.match(i)||[]).map(e=>e.slice(1,-1)),o=n.replace(i,`[]`),s=e.reduce((e,[t,n])=>{if(e.includes(t)){let i=Math.floor(r/n);return r-=i*n,e.replace(RegExp(`${t}+`,`g`),e=>{let t=e.length;return i.toString().padStart(t,`0`)})}return e},o),c=0;return s.replace(i,()=>{let e=a[c];return c+=1,e})}function n(e,n){let{format:r=``}=n,i=new Date(e).getTime();return t(Math.max(i-Date.now(),0),r)}exports.formatCountdown=n,exports.formatTimeStr=t;