"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={sec:1e3,min:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,month:1e3*60*60*24*30,year:1e3*60*60*24*30*12},u=["year","month","day","hour","min","sec"];function y(o,n="year"){let t=o;const l={year:0,month:0,day:0,hour:0,min:0,sec:0},s=u.indexOf(n);for(let r=s;r<u.length;r++){const a=u[r],e=Math.floor(t/c[a]);l[a]=e,t%=c[a]}return l}function m(o,n){const t=o.split("|");return t.length===1?`${n} ${o}`:`${n} ${n>1?t[1].trim():t[0].trim()}`}function d(o,n){const t=n.ap.timeAgo,l={s:t.second,m:t.minute,h:t.hour,d:t.days,M:t.months,y:t.years},{unit:s,count:r,type:a}=o;let e=l[o.unit],i=!0;if(s==="s"&&o.count<10?(e=t.justNow,i=!1):s==="d"&&r===1?(e=a==="ago"?t.yesterday:t.tomorrow,i=!1):s==="M"&&r===1?(e=a==="ago"?t.lastMonth:t.nextMonth,i=!1):s==="y"&&r===1&&(e=a==="ago"?t.lastYear:t.nextYear,i=!1),!i)return e;const f=a==="ago"?t.ago:t.late;return e=`${m(e,r)} ${f}`,n.name==="zh-cn"&&(e=e.replace(/\s+/g,"")),e}exports.formatDuration=y;exports.getCountWord=m;exports.getTimeAgoStr=d;
