import { _ as _asyncToGenerator, a as _regeneratorRuntime } from '../index-CoBEoJgD.js';

function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
/* eslint-disable @bigbinary/neeto/no-dangling-constants */

var DEFAULT_LOCALE = "en";
var LOCALES = {
  af: function af() {
    return import('dayjs/locale/af');
  },
  am: function am() {
    return import('dayjs/locale/am');
  },
  "ar-dz": function arDz() {
    return import('dayjs/locale/ar-dz');
  },
  "ar-iq": function arIq() {
    return import('dayjs/locale/ar-iq');
  },
  "ar-kw": function arKw() {
    return import('dayjs/locale/ar-kw');
  },
  "ar-ly": function arLy() {
    return import('dayjs/locale/ar-ly');
  },
  "ar-ma": function arMa() {
    return import('dayjs/locale/ar-ma');
  },
  "ar-sa": function arSa() {
    return import('dayjs/locale/ar-sa');
  },
  "ar-tn": function arTn() {
    return import('dayjs/locale/ar-tn');
  },
  ar: function ar() {
    return import('dayjs/locale/ar');
  },
  az: function az() {
    return import('dayjs/locale/az');
  },
  be: function be() {
    return import('dayjs/locale/be');
  },
  bg: function bg() {
    return import('dayjs/locale/bg');
  },
  bi: function bi() {
    return import('dayjs/locale/bi');
  },
  bm: function bm() {
    return import('dayjs/locale/bm');
  },
  "bn-bd": function bnBd() {
    return import('dayjs/locale/bn-bd');
  },
  bn: function bn() {
    return import('dayjs/locale/bn');
  },
  bo: function bo() {
    return import('dayjs/locale/bo');
  },
  br: function br() {
    return import('dayjs/locale/br');
  },
  bs: function bs() {
    return import('dayjs/locale/bs');
  },
  ca: function ca() {
    return import('dayjs/locale/ca');
  },
  cs: function cs() {
    return import('dayjs/locale/cs');
  },
  cv: function cv() {
    return import('dayjs/locale/cv');
  },
  cy: function cy() {
    return import('dayjs/locale/cy');
  },
  da: function da() {
    return import('dayjs/locale/da');
  },
  "de-at": function deAt() {
    return import('dayjs/locale/de-at');
  },
  "de-ch": function deCh() {
    return import('dayjs/locale/de-ch');
  },
  de: function de() {
    return import('dayjs/locale/de');
  },
  dv: function dv() {
    return import('dayjs/locale/dv');
  },
  el: function el() {
    return import('dayjs/locale/el');
  },
  "en-au": function enAu() {
    return import('dayjs/locale/en-au');
  },
  "en-ca": function enCa() {
    return import('dayjs/locale/en-ca');
  },
  "en-gb": function enGb() {
    return import('dayjs/locale/en-gb');
  },
  "en-ie": function enIe() {
    return import('dayjs/locale/en-ie');
  },
  "en-il": function enIl() {
    return import('dayjs/locale/en-il');
  },
  "en-in": function enIn() {
    return import('dayjs/locale/en-in');
  },
  "en-nz": function enNz() {
    return import('dayjs/locale/en-nz');
  },
  "en-sg": function enSg() {
    return import('dayjs/locale/en-sg');
  },
  "en-tt": function enTt() {
    return import('dayjs/locale/en-tt');
  },
  en: function en() {
    return import('dayjs/locale/en');
  },
  eo: function eo() {
    return import('dayjs/locale/eo');
  },
  "es-do": function esDo() {
    return import('dayjs/locale/es-do');
  },
  "es-mx": function esMx() {
    return import('dayjs/locale/es-mx');
  },
  "es-pr": function esPr() {
    return import('dayjs/locale/es-pr');
  },
  "es-us": function esUs() {
    return import('dayjs/locale/es-us');
  },
  es: function es() {
    return import('dayjs/locale/es');
  },
  et: function et() {
    return import('dayjs/locale/et');
  },
  eu: function eu() {
    return import('dayjs/locale/eu');
  },
  fa: function fa() {
    return import('dayjs/locale/fa');
  },
  fi: function fi() {
    return import('dayjs/locale/fi');
  },
  fo: function fo() {
    return import('dayjs/locale/fo');
  },
  "fr-ca": function frCa() {
    return import('dayjs/locale/fr-ca');
  },
  "fr-ch": function frCh() {
    return import('dayjs/locale/fr-ch');
  },
  fr: function fr() {
    return import('dayjs/locale/fr');
  },
  fy: function fy() {
    return import('dayjs/locale/fy');
  },
  ga: function ga() {
    return import('dayjs/locale/ga');
  },
  gd: function gd() {
    return import('dayjs/locale/gd');
  },
  gl: function gl() {
    return import('dayjs/locale/gl');
  },
  "gom-latn": function gomLatn() {
    return import('dayjs/locale/gom-latn');
  },
  gu: function gu() {
    return import('dayjs/locale/gu');
  },
  he: function he() {
    return import('dayjs/locale/he');
  },
  hi: function hi() {
    return import('dayjs/locale/hi');
  },
  hr: function hr() {
    return import('dayjs/locale/hr');
  },
  ht: function ht() {
    return import('dayjs/locale/ht');
  },
  hu: function hu() {
    return import('dayjs/locale/hu');
  },
  "hy-am": function hyAm() {
    return import('dayjs/locale/hy-am');
  },
  id: function id() {
    return import('dayjs/locale/id');
  },
  is: function is() {
    return import('dayjs/locale/is');
  },
  "it-ch": function itCh() {
    return import('dayjs/locale/it-ch');
  },
  it: function it() {
    return import('dayjs/locale/it');
  },
  ja: function ja() {
    return import('dayjs/locale/ja');
  },
  jv: function jv() {
    return import('dayjs/locale/jv');
  },
  ka: function ka() {
    return import('dayjs/locale/ka');
  },
  kk: function kk() {
    return import('dayjs/locale/kk');
  },
  km: function km() {
    return import('dayjs/locale/km');
  },
  kn: function kn() {
    return import('dayjs/locale/kn');
  },
  ko: function ko() {
    return import('dayjs/locale/ko');
  },
  ku: function ku() {
    return import('dayjs/locale/ku');
  },
  ky: function ky() {
    return import('dayjs/locale/ky');
  },
  lb: function lb() {
    return import('dayjs/locale/lb');
  },
  lo: function lo() {
    return import('dayjs/locale/lo');
  },
  lt: function lt() {
    return import('dayjs/locale/lt');
  },
  lv: function lv() {
    return import('dayjs/locale/lv');
  },
  me: function me() {
    return import('dayjs/locale/me');
  },
  mi: function mi() {
    return import('dayjs/locale/mi');
  },
  mk: function mk() {
    return import('dayjs/locale/mk');
  },
  ml: function ml() {
    return import('dayjs/locale/ml');
  },
  mn: function mn() {
    return import('dayjs/locale/mn');
  },
  mr: function mr() {
    return import('dayjs/locale/mr');
  },
  "ms-my": function msMy() {
    return import('dayjs/locale/ms-my');
  },
  ms: function ms() {
    return import('dayjs/locale/ms');
  },
  mt: function mt() {
    return import('dayjs/locale/mt');
  },
  my: function my() {
    return import('dayjs/locale/my');
  },
  nb: function nb() {
    return import('dayjs/locale/nb');
  },
  ne: function ne() {
    return import('dayjs/locale/ne');
  },
  "nl-be": function nlBe() {
    return import('dayjs/locale/nl-be');
  },
  nl: function nl() {
    return import('dayjs/locale/nl');
  },
  nn: function nn() {
    return import('dayjs/locale/nn');
  },
  "oc-lnc": function ocLnc() {
    return import('dayjs/locale/oc-lnc');
  },
  "pa-in": function paIn() {
    return import('dayjs/locale/pa-in');
  },
  pl: function pl() {
    return import('dayjs/locale/pl');
  },
  "pt-br": function ptBr() {
    return import('dayjs/locale/pt-br');
  },
  pt: function pt() {
    return import('dayjs/locale/pt');
  },
  rn: function rn() {
    return import('dayjs/locale/rn');
  },
  ro: function ro() {
    return import('dayjs/locale/ro');
  },
  ru: function ru() {
    return import('dayjs/locale/ru');
  },
  rw: function rw() {
    return import('dayjs/locale/rw');
  },
  sd: function sd() {
    return import('dayjs/locale/sd');
  },
  se: function se() {
    return import('dayjs/locale/se');
  },
  si: function si() {
    return import('dayjs/locale/si');
  },
  sk: function sk() {
    return import('dayjs/locale/sk');
  },
  sl: function sl() {
    return import('dayjs/locale/sl');
  },
  sq: function sq() {
    return import('dayjs/locale/sq');
  },
  "sr-cyrl": function srCyrl() {
    return import('dayjs/locale/sr-cyrl');
  },
  sr: function sr() {
    return import('dayjs/locale/sr');
  },
  ss: function ss() {
    return import('dayjs/locale/ss');
  },
  "sv-fi": function svFi() {
    return import('dayjs/locale/sv-fi');
  },
  sv: function sv() {
    return import('dayjs/locale/sv');
  },
  sw: function sw() {
    return import('dayjs/locale/sw');
  },
  ta: function ta() {
    return import('dayjs/locale/ta');
  },
  te: function te() {
    return import('dayjs/locale/te');
  },
  tet: function tet() {
    return import('dayjs/locale/tet');
  },
  tg: function tg() {
    return import('dayjs/locale/tg');
  },
  th: function th() {
    return import('dayjs/locale/th');
  },
  tk: function tk() {
    return import('dayjs/locale/tk');
  },
  "tl-ph": function tlPh() {
    return import('dayjs/locale/tl-ph');
  },
  tlh: function tlh() {
    return import('dayjs/locale/tlh');
  },
  tr: function tr() {
    return import('dayjs/locale/tr');
  },
  tzl: function tzl() {
    return import('dayjs/locale/tzl');
  },
  "tzm-latn": function tzmLatn() {
    return import('dayjs/locale/tzm-latn');
  },
  tzm: function tzm() {
    return import('dayjs/locale/tzm');
  },
  "ug-cn": function ugCn() {
    return import('dayjs/locale/ug-cn');
  },
  uk: function uk() {
    return import('dayjs/locale/uk');
  },
  ur: function ur() {
    return import('dayjs/locale/ur');
  },
  "uz-latn": function uzLatn() {
    return import('dayjs/locale/uz-latn');
  },
  uz: function uz() {
    return import('dayjs/locale/uz');
  },
  vi: function vi() {
    return import('dayjs/locale/vi');
  },
  "x-pseudo": function xPseudo() {
    return import('dayjs/locale/x-pseudo');
  },
  yo: function yo() {
    return import('dayjs/locale/yo');
  },
  "zh-cn": function zhCn() {
    return import('dayjs/locale/zh-cn');
  },
  "zh-hk": function zhHk() {
    return import('dayjs/locale/zh-hk');
  },
  "zh-tw": function zhTw() {
    return import('dayjs/locale/zh-tw');
  },
  zh: function zh() {
    return import('dayjs/locale/zh');
  },
  // special cases
  no: function no() {
    return import('dayjs/locale/nb');
  },
  // Norwegian
  zn: function zn() {
    return import('dayjs/locale/zh-cn');
  } // Chinese
};
var getDayjsLocale = function getDayjsLocale() {
  var _iterator = _createForOfIteratorHelper(navigator.languages),
    _step;
  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var language = _step.value;
      var lang = language.toLowerCase();
      if (lang in LOCALES) return lang;

      // handle locales like `fr-be` and `fr-lu`.
      var langPrefix = lang.split("-")[0];
      if (langPrefix in LOCALES) {
        return langPrefix;
      }
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
  return DEFAULT_LOCALE;
};
var localePlugin = (/*#__PURE__*/function () {
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_o, _c, d) {
    var locale;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          _context.prev = 0;
          locale = getDayjsLocale();
          _context.next = 4;
          return LOCALES[locale]();
        case 4:
          d.locale(locale);
          _context.next = 10;
          break;
        case 7:
          _context.prev = 7;
          _context.t0 = _context["catch"](0);
          d.locale(DEFAULT_LOCALE);
        case 10:
        case "end":
          return _context.stop();
      }
    }, _callee, null, [[0, 7]]);
  }));
  return function (_x, _x2, _x3) {
    return _ref.apply(this, arguments);
  };
}());

export { localePlugin as default };
//# sourceMappingURL=localePlugin.js.map
