import { parse as i, format as a, isValid as m } from "date-fns";
import * as e from "date-fns/locale";
import { IMask as d } from "react-imask";
const f = {
  "bg-BG": "dd.MM.yyyy",
  "cs-CZ": "dd.MM.yyyy",
  "da-DK": "dd-MM-yyyy",
  "de-DE": "dd.MM.yyyy",
  "el-GR": "dd/MM/yyyy",
  "en-GB": "dd/MM/yyyy",
  "es-ES": "dd/MM/yyyy",
  "et-EE": "dd.MM.yyyy",
  "fi-FI": "dd.MM.yyyy",
  "fr-FR": "dd/MM/yyyy",
  "hr-HR": "dd.MM.yyyy",
  "hu-HU": "yyyy. MM. dd.",
  "it-IT": "dd/MM/yyyy",
  "lt-LT": "dd-MM-yyyy",
  "lv-LV": "dd.MM.yyyy",
  "nb-NO": "dd.MM.yyyy",
  "nl-NL": "dd-MM-yyyy",
  "pl-PL": "dd.MM.yyyy",
  "pt-BR": "dd/MM/yyyy",
  "pt-PT": "dd/MM/yyyy",
  "ro-RO": "dd.MM.yyyy",
  "sk-SK": "dd.MM.yyyy",
  "sl-SI": "dd.MM.yyyy",
  "sv-SE": "yyyy-MM-dd"
}, k = Object.keys(f), h = (y) => {
  const r = y.trim(), t = r.replace(/-([a-z])/gi, (n, M) => M.toUpperCase()), o = r.split("-")[0];
  return e[t] || e[r] || e[o] || e.enGB;
}, p = (y, r, t) => y ? a(y, s(r, t)) : "", L = (y, r, t, o) => {
  if (!y)
    return "";
  const n = (M) => p(M, r, o);
  if (t === "single" && y instanceof Date)
    return n(y);
  if (t === "multiple" && Array.isArray(y))
    return y.map(n).join(", ");
  if (t === "range" && typeof y == "object" && "from" in y) {
    const M = y.from ? n(y.from) : "...", c = y.to ? n(y.to) : "...";
    return `${M} - ${c}`;
  }
  return "";
}, s = (y, r) => r || f[y] || "yyyy-MM-dd", u = (y) => {
  let r = "";
  for (let t = 0; t < y.length; ) {
    if (y.startsWith("dd", t)) {
      r += "d", t += 2;
      continue;
    }
    if (y.startsWith("MM", t)) {
      r += "m", t += 2;
      continue;
    }
    if (y.startsWith("yyyy", t)) {
      r += "Y", t += 4;
      continue;
    }
    if (y.startsWith("HH", t)) {
      r += "H", t += 2;
      continue;
    }
    if (y.startsWith("mm", t)) {
      r += "M", t += 2;
      continue;
    }
    const o = y[t];
    if (!o)
      break;
    if (/[a-zA-Z]/.test(o))
      return;
    r += o, t += 1;
  }
  return r;
}, D = (y, r) => {
  const t = s(y, r), o = u(t);
  if (o)
    return {
      mask: Date,
      pattern: o,
      blocks: {
        H: {
          mask: d.MaskedRange,
          from: 0,
          to: 23,
          maxLength: 2
        },
        M: {
          mask: d.MaskedRange,
          from: 0,
          to: 59,
          maxLength: 2
        }
      },
      format: (n) => n ? a(n, t) : "",
      parse: (n) => i(n, t, /* @__PURE__ */ new Date())
    };
}, I = (y, r, t) => {
  if (!y)
    return;
  const o = t || s(r), n = i(y, o, /* @__PURE__ */ new Date());
  if (m(n) && a(n, o) === y)
    return n;
};
export {
  p as formatDate,
  L as formatSelectionForInput,
  s as getInputFormat,
  D as getInputMaskProps,
  I as parseDateString,
  h as resolveLocale,
  k as supportedDayPickerLocales
};
//# sourceMappingURL=dayPickerUtils.js.map
