const s = (i, ...h) => {
  let e = i;
  if (h.length > 0)
    for (let b = 0; b < h.length; b++)
      e = e?.replaceAll(`$${b + 1}`, h[b]);
  return e;
}, N = (i, h, e) => {
  if (!(h instanceof Date))
    return { time: "No date", value: "", unit: "" };
  const w = (/* @__PURE__ */ new Date()).getTime() - h.getTime(), o = Math.floor(w / 1e3), u = Math.floor(o / 60), l = Math.floor(u / 60), n = Math.floor(l / 24), a = Math.floor(n / 30), f = Math.floor(a / 12);
  let r, m, t = "";
  const M = f > 1 ? e.label_unit_time_years : e.label_unit_time_year, S = a % 12 > 1 ? e.label_unit_time_months : e.label_unit_time_month, p = n % 30 > 1 ? e.label_unit_time_days : e.label_unit_time_day, g = l % 24 > 1 ? e.label_unit_time_hours : e.label_unit_time_hour, c = o > 1 ? e.label_unit_time_seconds : e.label_unit_time_second, D = u % 60 > 1 ? e.label_unit_time_minutes : e.label_unit_time_minute;
  let _ = e.label_sentence_present_others;
  i === "past" ? _ = e.label_sentence_past_others : i === "future" && (_ = e.label_sentence_future_others);
  const T = ":", $ = "-";
  return o < 60 ? (i === "past" ? t = s(e.label_sentence_past_seconds, o + "", c) : i === "future" ? t = s(
    e.label_sentence_future_seconds,
    o + "",
    c
  ) : t = s(
    e.label_sentence_present_seconds,
    o + "",
    c
  ), r = o.toString().padStart(2, "0") + "", m = e.label_unit_time_seconds_short) : u < 60 ? (t = s(_, `${u}`, D), r = u.toString().padStart(2, "0") + ":" + (o % 60).toString().padStart(2, "0"), m = e.label_unit_time_minutes_short + e.label_separator_time + e.label_unit_time_seconds_short) : l < 24 ? (u % 60 > 0 ? t = s(_, `${l} ${g} ${u % 60} ${D}`, "") : t = s(_, `${l} ${g}`, ""), r = l.toString().padStart(2, "0") + ":" + (u % 60).toString().padStart(2, "0"), m = e.label_unit_time_hours_short + T + e.label_unit_time_minutes_short) : n < 30 ? (l % 24 > 0 ? t = s(_, `${n} ${p} ${l % 24} ${g}`, "") : t = s(_, `${n} ${p}`, ""), r = n.toString().padStart(2, "0") + " " + (l % 24).toString().padStart(2, "0"), m = e.label_unit_time_days_short + " " + e.label_unit_time_hours_short) : a < 12 ? (n % 30 > 0 ? t = s(_, `${a} ${S} ${n % 30} ${p}`, "") : t = s(_, `${a} ${S}`, ""), r = a.toString().padStart(2, "0") + $ + (n % 30).toString().padStart(2, "0"), m = e.label_unit_time_months_short + $ + e.label_unit_time_days_short) : (a % 12 > 0 ? t = s(_, `${f} ${M} ${a % 12} ${S}`, "") : t = s(_, `${f} ${M}`, ""), r = f.toString().padStart(2, "0") + $ + (a % 12).toString().padStart(2, "0"), m = e.label_unit_time_years_short + $ + e.label_unit_time_months_short), { time: t, value: r, unit: m };
};
export {
  N as formatDistanceToNow
};
