import { f as d } from "./number.Dp6Prh44.js";
var g = /* @__PURE__ */ ((r) => (r.Millisecond = "ms", r.Second = "s", r))(g || {}), a = /* @__PURE__ */ ((r) => (r.Day = "d", r.DayHour = "d-h", r.DayHourMinute = "d-h-m", r.DayHourMinuteSecond = "d-h-m-s", r.Hour = "h", r.HourMinute = "h-m", r.HourMinuteSecond = "h-m-s", r.Minute = "m", r.MinuteSecond = "m-s", r.Second = "s", r))(a || {}), u = /* @__PURE__ */ ((r) => (r.Digital = "digital", r.Long = "long", r.Narrow = "narrow", r.Short = "short", r))(u || {}), h = /* @__PURE__ */ ((r) => (r.English = "en", r))(h || {});
const f = [
  {
    key: "days",
    longPlural: "days",
    longSingular: "day",
    narrow: "d",
    short: "day"
  },
  {
    key: "hours",
    longPlural: "hours",
    longSingular: "hour",
    narrow: "h",
    short: "hr"
  },
  {
    key: "minutes",
    longPlural: "minutes",
    longSingular: "minute",
    narrow: "m",
    short: "min"
  },
  {
    key: "seconds",
    longPlural: "seconds",
    longSingular: "second",
    narrow: "s",
    short: "sec"
  }
], m = 1e3, D = 60 * 1e3;
function w(r, t, n = h.English) {
  const e = Intl.DurationFormat;
  if (typeof e != "function")
    throw new Error("Intl.DurationFormat is not supported");
  return new e(n, { style: t }).format(r);
}
function y(r, t) {
  const n = Math.floor(r / 1e3), e = Math.floor(n / 60), o = Math.floor(e / 60), s = Math.floor(o / 24), i = o % 24, c = e % 60, l = n % 60;
  switch (t) {
    case a.Day:
      return { days: s };
    case a.DayHour:
      return { days: s, hours: i };
    case a.DayHourMinute:
      return { days: s, hours: i, minutes: c };
    case a.DayHourMinuteSecond:
      return { days: s, hours: i, minutes: c, seconds: l };
    case a.Hour:
      return { hours: o };
    case a.HourMinute:
      return { hours: o, minutes: c };
    case a.HourMinuteSecond:
      return { hours: o, minutes: c, seconds: l };
    case a.Minute:
      return { minutes: e };
    case a.MinuteSecond:
      return { minutes: e, seconds: l };
    case a.Second:
      return { seconds: n };
    default:
      return { days: s, hours: i, minutes: c };
  }
}
function H(r) {
  return Object.fromEntries(
    Object.entries(r).filter(([, t]) => t !== 0)
  );
}
function N(r, t) {
  const n = [];
  let e = 0;
  for (const o of f) {
    const s = r[o.key];
    s !== void 0 && (n.push(
      S(s, o, t, e)
    ), e += 1);
  }
  if (n.length === 0)
    return "0";
  switch (t) {
    case u.Digital:
      return n.join(":");
    case u.Long:
    case u.Short:
      return n.join(", ");
    case u.Narrow:
    default:
      return n.join(" ");
  }
}
function S(r, t, n, e) {
  const o = n === u.Digital ? e === 0 ? String(r) : String(r).padStart(2, "0") : d(r);
  switch (n) {
    case u.Digital:
      return o;
    case u.Long:
      return `${o} ${r === 1 ? t.longSingular : t.longPlural}`;
    case u.Short:
      return `${o} ${t.short}`;
    case u.Narrow:
    default:
      return `${o}${t.narrow}`;
  }
}
export {
  u as D,
  g as F,
  h as L,
  D as M,
  m as S,
  a as U,
  N as a,
  H as c,
  w as f,
  y as g
};
