import{f as Y}from"./formatDuration-Cqs7FPp0.js";import{e as u}from"./time-utils-tK1noPML.js";import{b3 as c,b7 as F,dP as x,dQ as _}from"./index-BKr2rJhV.js";import{d as D,g as p,c as h,a as b,b as H}from"./formatDistance-qDinyJzC.js";function S(e,t){const s=c(e),n=c(t);return s.getFullYear()-n.getFullYear()}function N(e,t){const s=c(e),n=c(t),o=y(s,n),i=Math.abs(F(s,n));s.setDate(s.getDate()-o*i);const a=+(y(s,n)===-o),r=o*(i-a);return r===0?0:r}function y(e,t){const s=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return s<0?-1:s>0?1:s}function T(e,t,s){const n=D(e,t)/x;return p()(n)}function A(e,t,s){const n=D(e,t)/_;return p()(n)}function C(e,t){const s=c(e),n=c(t),o=h(s,n),i=Math.abs(S(s,n));s.setFullYear(1584),n.setFullYear(1584);const a=h(s,n)===-o,r=o*(i-+a);return r===0?0:r}function L(e){const t=c(e.start),s=c(e.end),n={},o=C(s,t);o&&(n.years=o);const i=u(t,{years:n.years}),a=b(s,i);a&&(n.months=a);const r=u(i,{months:n.months}),f=N(s,r);f&&(n.days=f);const d=u(r,{days:n.days}),l=T(s,d);l&&(n.hours=l);const m=u(d,{hours:n.hours}),g=A(s,m);g&&(n.minutes=g);const I=u(m,{minutes:n.minutes}),M=H(s,I);return M&&(n.seconds=M),n}const P=e=>e===0?"0s":Y(L({start:0,end:e}),{format:["years","months","days","hours","minutes","seconds"],locale:{formatDistance:(t,s,n)=>Q[t].replace("{{count}}",String(s))}}),w=e=>P(e*1e3),Q={xSeconds:"{{count}}s",xMinutes:"{{count}}m",xHours:"{{count}}h",xDays:"{{count}}d",xMonths:"{{count}}m",xYears:"{{count}}y"};export{P as m,w as s};
