import { d } from "./vue-i18n-DG0DIzwC.js";
var u = /* @__PURE__ */ ((e) => (e.Year = "YEAR", e.Month = "MONTH", e.Week = "WEEK", e.Day = "DAY", e))(u || {});
function c(e, a = 100) {
  let r = null;
  const t = function(...n) {
    return r && clearTimeout(r), new Promise((s) => {
      r = setTimeout(() => {
        r = null;
        const l = e(...n);
        s(l);
      }, a);
    });
  };
  return t.cancel = () => {
    r && (clearTimeout(r), r = null);
  }, t;
}
function y() {
  return [...Array(12).keys()].map((e) => d().month(e).format("MMM"));
}
function f(e, a, r = "") {
  switch (e.type) {
    case u.Day:
      return a("report.schedule.everyDay");
    case u.Week: {
      let t = `${a("report.schedule.everyWeek")} `;
      const n = [
        a("report.days.sunday"),
        a("report.days.monday"),
        a("report.days.tuesday"),
        a("report.days.wednesday"),
        a("report.days.thursday"),
        a("report.days.friday"),
        a("report.days.saturday")
      ];
      if (e.days)
        for (let s = 0; s < e.days.length; s++)
          t = t + n[e.days[s]] + (s !== e.days.length - 1 ? "," : "");
      return t;
    }
    case u.Month: {
      let t = `${a("report.schedule.everyMonth")} `;
      return e.days && (t = t + e.days.join(",")), t;
    }
    case u.Year: {
      if (!e.months && !e.days)
        return a("report.schedule.customDate");
      let t = `${a("report.schedule.everyYear")} `;
      if (e.months) {
        const n = y();
        t = t + e.months.map((s) => n[s - 1]).join(",");
      }
      return e.months && e.days && (t = t + ` ${a("report.common.and")} `), e.days && (t = t + e.days.join(",")), t;
    }
    default:
      return r;
  }
}
function m(e = {
  startDate: null,
  endDate: null,
  locale: "en-US"
}) {
  if (!e.startDate || !e.endDate)
    return "No comparison";
  let a = d().subtract(1, "day").endOf("day"), r = d().endOf("day");
  return e.startDate && (a = d(e.startDate).locale(e.locale)), e.endDate && (r = d(e.endDate).locale(e.locale)), a.format("YYYY") !== r.format("YYYY") ? `${a.format("DD MMM YYYY")} - ${r.format("DD MMM YYYY")}` : `${a.format("DD MMM")} - ${r.format("DD MMM YYYY")}`;
}
export {
  u as C,
  c as a,
  f as b,
  m as d,
  y as g
};
