import{J as h,c8 as d}from"./Dk4AzF7j.js";import{e as $,f as w,h as M,i as y}from"./iLxCpTU2.js";const x=()=>{const{t:e,locale:A}=h();return{pastTime:(n,r=!0)=>{const t=new Date(n),i=new Date().getTime()-t.getTime(),a=Math.floor(i/1e3);if(a<60){const m=`${e("timeAgo.second",{count:a})}`;return r?e("timeAgo.ago",[m]):e("timeAgo.in",[m])}const s=Math.floor(i/(1e3*60));if(s<60){const m=`${e("timeAgo.minute",{count:s})}`;return r?e("timeAgo.ago",{0:m}):e("timeAgo.in",{0:m})}const u=Math.floor(i/(1e3*60*60));if(u<24)return`${e("timeAgo.hour",{count:u})}`;const c=Math.floor(i/(1e3*60*60*24));if(c<7)return`${e("timeAgo.day",{count:c})}`;const g=Math.floor(c/7);if(g<4)return`${e("timeAgo.week",{count:g})}`;const f=Math.floor(c/30.436875);if(f<12)return`${e("timeAgo.month",{count:f})}`;const l=Math.floor(c/365.25);return`${e("timeAgo.year",{count:l})}`},generateDate:n=>{const r={de:"de-DE",en:"en-US",ja:"ja-JP",fr:"fr-FR",it:"it-IT",es:"es-ES",ru:"ru-RU"};return new Date(n).toLocaleString(r[A.value])},formatLocaleTimeAgo:n=>{const r={justNow:e("timeAgo.justNow"),past:t=>t.match(/\d/)?e("timeAgo.ago",[t]):t,future:t=>t.match(/\d/)?e("timeAgo.in",[t]):t,month:(t,o)=>t===1?e(o?"timeAgo.lastMonth":"timeAgo.nextMonth"):`${e("timeAgo.month",{count:t})}`,year:(t,o)=>t===1?e(o?"timeAgo.lastYear":"timeAgo.nextYear"):`${e("timeAgo.year",{count:t})}`,day:(t,o)=>t===1?e(o?"timeAgo.yesterday":"timeAgo.tomorrow"):`${e("timeAgo.day",{count:t})}`,week:(t,o)=>t===1?e(o?"timeAgo.lastWeek":"timeAgo.nextWeek"):`${e("timeAgo.week",{count:t})}`,hour:(t,o)=>`${e("timeAgo.hour",{count:t})}`,minute:(t,o)=>`${e("timeAgo.minute",{count:t})}`,second:(t,o)=>`${e("timeAgo.second",{count:t})}`,invalid:""};return d(n,{fullDateFormatter:t=>t.toLocaleString(),messages:r})},calculateDuration:(n,r)=>{const t=$(r,n);return t<121?e("timeAgo.minute",{count:t}):t<4e3?e("timeAgo.hour",{count:w(r,n)}):t<9e4?e("timeAgo.day",{count:M(r,n)}):e("timeAgo.week",{count:y(r,n)})},formatShortElapsed:n=>{const t=Date.now()-n,o=Math.floor(t/1e3),i=Math.floor(o/60),a=Math.floor(i/60),s=Math.floor(a/24);return s>0?`${s}d ${a%24}h ago`:a>0?`${a}h ${i%60}m ago`:i>0?`${i}m ${o%60}s ago`:`${o}s ago`}}};export{x as u};
