import { intervalToDuration as i, isToday as l, isYesterday as c, isThisWeek as u, isThisYear as s, format as f, formatDistance as m, formatDuration as M } from "date-fns";
import { capitalizeFirstLetter as D } from "../utils/index.js";
let r;
function n(e, t) {
  return o(), f(e, t, {
    locale: r
  });
}
function d(e, t) {
  return o(), M(e, {
    locale: r,
    format: t
  });
}
function E(e, t) {
  return o(), m(e, t, {
    locale: r
  });
}
function h() {
  return r !== void 0;
}
function o() {
  if (!h())
    throw new Error("Locale not set, please call setDateLocale(locale) and pass in a datefns locale object as the locale param before calling this function");
}
function T(e) {
  r = e;
}
function y(e) {
  return n(e, "MMMM d, y");
}
function _(e) {
  if (e < 60)
    return E(0, 29 * 1e3);
  const t = i({
    start: 0,
    end: e * 1e3
  });
  return d(t, ["hours", "minutes"]);
}
function a(e) {
  const t = new Intl.RelativeTimeFormat(r.code, { numeric: "auto" });
  return D(t.formatToParts(e, "day")[0].value, r.code);
}
function b(e) {
  return l(e) ? a(0) : c(e) ? a(-1) : u(e) ? n(e, "EEEE") : s(e) ? n(e, "EEEE, MMMM d") : n(e, "MMMM d, y");
}
export {
  _ as durationInHHMM,
  y as getDateMedium,
  b as relativeDate,
  T as setDateLocale
};
//# sourceMappingURL=index.js.map
