import{hv as i,ie as F,ig as M,I as x,ih as I,J as S,ii as y,ij as _,ik as H,il as d,im as b,io as k}from"./index-Cox3ZWL0.js";function C(t,e){const s=i(t),n=i(e);return s.getFullYear()-n.getFullYear()}function N(t,e){const s=i(t),n=i(e),r=D(s,n),o=Math.abs(F(s,n));s.setDate(s.getDate()-r*o);const a=+(D(s,n)===-r),c=r*(o-a);return c===0?0:c}function D(t,e){const s=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return s<0?-1:s>0?1:s}function T(t,e,s){const n=M(t,e)/x;return I()(n)}function j(t,e,s){const n=M(t,e)/S;return I()(n)}function v(t,e){const s=i(t),n=i(e),r=y(s,n),o=Math.abs(C(s,n));s.setFullYear(1584),n.setFullYear(1584);const a=y(s,n)===-r,c=r*(o-+a);return c===0?0:c}const z=["years","months","weeks","days","hours","minutes","seconds"];function A(t,e){const s=H(),n=(e==null?void 0:e.locale)??s.locale??_,r=(e==null?void 0:e.format)??z,o=(e==null?void 0:e.zero)??!1,a=(e==null?void 0:e.delimiter)??" ";return n.formatDistance?r.reduce((f,u)=>{const m=`x${u.replace(/(^.)/,g=>g.toUpperCase())}`,l=t[u];return l!==void 0&&(o||t[u])?f.concat(n.formatDistance(m,l)):f},[]).join(a):""}function O(t){const e=i(t.start),s=i(t.end),n={},r=v(s,e);r&&(n.years=r);const o=d(e,{years:n.years}),a=b(s,o);a&&(n.months=a);const c=d(o,{months:n.months}),f=N(s,c);f&&(n.days=f);const u=d(c,{days:n.days}),m=T(s,u);m&&(n.hours=m);const l=d(u,{hours:n.hours}),g=j(s,l);g&&(n.minutes=g);const Y=d(l,{minutes:n.minutes}),h=k(s,Y);return h&&(n.seconds=h),n}const U=t=>t===0?"0s":A(O({start:0,end:t}),{format:["years","months","days","hours","minutes","seconds"],locale:{formatDistance:(e,s,n)=>w[e].replace("{{count}}",String(s))}}),L=t=>U(t*1e3),w={xSeconds:"{{count}}s",xMinutes:"{{count}}m",xHours:"{{count}}h",xDays:"{{count}}d",xMonths:"{{count}}m",xYears:"{{count}}y"};export{U as m,L as s};
