import{t as f,c as T,e as x,g as S,b as X,d as M,f as O}from"./en-US-ZtQonj2f.js";import{e as y,d as b}from"./endOfMonth-D4w2DAiZ.js";function D(n,s){const e=f(n),o=f(s),t=e.getTime()-o.getTime();return t<0?-1:t>0?1:t}function w(n){return T(n,Date.now())}function N(n){return s=>{const o=(n?Math[n]:Math.trunc)(s);return o===0?0:o}}function _(n,s){return+f(n)-+f(s)}function R(n){const s=f(n);return s.setHours(23,59,59,999),s}function Y(n){const s=f(n);return+R(s)==+y(s)}function v(n,s){const e=f(n),o=f(s),t=D(e,o),u=Math.abs(b(e,o));let c;if(u<1)c=0;else{e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-t*u);let r=D(e,o)===-t;Y(f(n))&&u===1&&D(n,o)===1&&(r=!1),c=t*(u-Number(r))}return c===0?0:c}function A(n,s,e){const o=_(n,s)/1e3;return N(e==null?void 0:e.roundingMethod)(o)}function H(n,s,e){const o=O(),t=(e==null?void 0:e.locale)??o.locale??x,u=2520,c=D(n,s);if(isNaN(c))throw new RangeError("Invalid time value");const r=Object.assign({},e,{addSuffix:e==null?void 0:e.addSuffix,comparison:c});let m,h;c>0?(m=f(s),h=f(n)):(m=f(n),h=f(s));const l=A(h,m),I=(S(h)-S(m))/1e3,a=Math.round((l-I)/60);let d;if(a<2)return e!=null&&e.includeSeconds?l<5?t.formatDistance("lessThanXSeconds",5,r):l<10?t.formatDistance("lessThanXSeconds",10,r):l<20?t.formatDistance("lessThanXSeconds",20,r):l<40?t.formatDistance("halfAMinute",0,r):l<60?t.formatDistance("lessThanXMinutes",1,r):t.formatDistance("xMinutes",1,r):a===0?t.formatDistance("lessThanXMinutes",1,r):t.formatDistance("xMinutes",a,r);if(a<45)return t.formatDistance("xMinutes",a,r);if(a<90)return t.formatDistance("aboutXHours",1,r);if(a<X){const i=Math.round(a/60);return t.formatDistance("aboutXHours",i,r)}else{if(a<u)return t.formatDistance("xDays",1,r);if(a<M){const i=Math.round(a/X);return t.formatDistance("xDays",i,r)}else if(a<M*2)return d=Math.round(a/M),t.formatDistance("aboutXMonths",d,r)}if(d=v(h,m),d<12){const i=Math.round(a/M);return t.formatDistance("xMonths",i,r)}else{const i=d%12,g=Math.trunc(d/12);return i<3?t.formatDistance("aboutXYears",g,r):i<9?t.formatDistance("overXYears",g,r):t.formatDistance("almostXYears",g+1,r)}}function F(n,s){return H(n,w(n),s)}export{F as f};
