const d = (o) => typeof o == "string", T = () => {
  let o, e;
  const t = new Promise((s, n) => {
    o = s, e = n;
  });
  return t.resolve = o, t.reject = e, t;
}, te = (o) => o == null ? "" : "" + o, me = (o, e, t) => {
  o.forEach((s) => {
    e[s] && (t[s] = e[s]);
  });
}, ve = /###/g, se = (o) => o && o.indexOf("###") > -1 ? o.replace(ve, ".") : o, ne = (o) => !o || d(o), U = (o, e, t) => {
  const s = d(e) ? e.split(".") : e;
  let n = 0;
  for (; n < s.length - 1; ) {
    if (ne(o)) return {};
    const i = se(s[n]);
    !o[i] && t && (o[i] = new t()), Object.prototype.hasOwnProperty.call(o, i) ? o = o[i] : o = {}, ++n;
  }
  return ne(o) ? {} : {
    obj: o,
    k: se(s[n])
  };
}, ie = (o, e, t) => {
  const {
    obj: s,
    k: n
  } = U(o, e, Object);
  if (s !== void 0 || e.length === 1) {
    s[n] = t;
    return;
  }
  let i = e[e.length - 1], r = e.slice(0, e.length - 1), l = U(o, r, Object);
  for (; l.obj === void 0 && r.length; )
    i = `${r[r.length - 1]}.${i}`, r = r.slice(0, r.length - 1), l = U(o, r, Object), l != null && l.obj && typeof l.obj[`${l.k}.${i}`] < "u" && (l.obj = void 0);
  l.obj[`${l.k}.${i}`] = t;
}, ye = (o, e, t, s) => {
  const {
    obj: n,
    k: i
  } = U(o, e, Object);
  n[i] = n[i] || [], n[i].push(t);
}, B = (o, e) => {
  const {
    obj: t,
    k: s
  } = U(o, e);
  if (t && Object.prototype.hasOwnProperty.call(t, s))
    return t[s];
}, xe = (o, e, t) => {
  const s = B(o, t);
  return s !== void 0 ? s : B(e, t);
}, de = (o, e, t) => {
  for (const s in e)
    s !== "__proto__" && s !== "constructor" && (s in o ? d(o[s]) || o[s] instanceof String || d(e[s]) || e[s] instanceof String ? t && (o[s] = e[s]) : de(o[s], e[s], t) : o[s] = e[s]);
  return o;
}, D = (o) => o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
var be = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;",
  "/": "&#x2F;"
};
const ke = (o) => d(o) ? o.replace(/[&<>"'\/]/g, (e) => be[e]) : o;
class Se {
  constructor(e) {
    this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
  }
  getRegExp(e) {
    const t = this.regExpMap.get(e);
    if (t !== void 0)
      return t;
    const s = new RegExp(e);
    return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
  }
}
const Oe = [" ", ",", "?", "!", ";"], Le = new Se(20), we = (o, e, t) => {
  e = e || "", t = t || "";
  const s = Oe.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
  if (s.length === 0) return !0;
  const n = Le.getRegExp(`(${s.map((r) => r === "?" ? "\\?" : r).join("|")})`);
  let i = !n.test(o);
  if (!i) {
    const r = o.indexOf(t);
    r > 0 && !n.test(o.substring(0, r)) && (i = !0);
  }
  return i;
}, Y = function(o, e) {
  let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
  if (!o) return;
  if (o[e])
    return Object.prototype.hasOwnProperty.call(o, e) ? o[e] : void 0;
  const s = e.split(t);
  let n = o;
  for (let i = 0; i < s.length; ) {
    if (!n || typeof n != "object")
      return;
    let r, l = "";
    for (let a = i; a < s.length; ++a)
      if (a !== i && (l += t), l += s[a], r = n[l], r !== void 0) {
        if (["string", "number", "boolean"].indexOf(typeof r) > -1 && a < s.length - 1)
          continue;
        i += a - i + 1;
        break;
      }
    n = r;
  }
  return n;
}, J = (o) => o == null ? void 0 : o.replace("_", "-"), Re = {
  type: "logger",
  log(o) {
    this.output("log", o);
  },
  warn(o) {
    this.output("warn", o);
  },
  error(o) {
    this.output("error", o);
  },
  output(o, e) {
    var t, s;
    (s = (t = console == null ? void 0 : console[o]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
  }
};
class q {
  constructor(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    this.init(e, t);
  }
  init(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    this.prefix = t.prefix || "i18next:", this.logger = e || Re, this.options = t, this.debug = t.debug;
  }
  log() {
    for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
      t[s] = arguments[s];
    return this.forward(t, "log", "", !0);
  }
  warn() {
    for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
      t[s] = arguments[s];
    return this.forward(t, "warn", "", !0);
  }
  error() {
    for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
      t[s] = arguments[s];
    return this.forward(t, "error", "");
  }
  deprecate() {
    for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
      t[s] = arguments[s];
    return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
  }
  forward(e, t, s, n) {
    return n && !this.debug ? null : (d(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
  }
  create(e) {
    return new q(this.logger, {
      prefix: `${this.prefix}:${e}:`,
      ...this.options
    });
  }
  clone(e) {
    return e = e || this.options, e.prefix = e.prefix || this.prefix, new q(this.logger, e);
  }
}
var P = new q();
class _ {
  constructor() {
    this.observers = {};
  }
  on(e, t) {
    return e.split(" ").forEach((s) => {
      this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
      const n = this.observers[s].get(t) || 0;
      this.observers[s].set(t, n + 1);
    }), this;
  }
  off(e, t) {
    if (this.observers[e]) {
      if (!t) {
        delete this.observers[e];
        return;
      }
      this.observers[e].delete(t);
    }
  }
  emit(e) {
    for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
      s[n - 1] = arguments[n];
    this.observers[e] && Array.from(this.observers[e].entries()).forEach((i) => {
      let [r, l] = i;
      for (let a = 0; a < l; a++)
        r(...s);
    }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((i) => {
      let [r, l] = i;
      for (let a = 0; a < l; a++)
        r.apply(r, [e, ...s]);
    });
  }
}
class re extends _ {
  constructor(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
      ns: ["translation"],
      defaultNS: "translation"
    };
    super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
  }
  addNamespaces(e) {
    this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
  }
  removeNamespaces(e) {
    const t = this.options.ns.indexOf(e);
    t > -1 && this.options.ns.splice(t, 1);
  }
  getResource(e, t, s) {
    var n, i;
    let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    const l = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator, a = r.ignoreJSONStructure !== void 0 ? r.ignoreJSONStructure : this.options.ignoreJSONStructure;
    let u;
    e.indexOf(".") > -1 ? u = e.split(".") : (u = [e, t], s && (Array.isArray(s) ? u.push(...s) : d(s) && l ? u.push(...s.split(l)) : u.push(s)));
    const h = B(this.data, u);
    return !h && !t && !s && e.indexOf(".") > -1 && (e = u[0], t = u[1], s = u.slice(2).join(".")), h || !a || !d(s) ? h : Y((i = (n = this.data) == null ? void 0 : n[e]) == null ? void 0 : i[t], s, l);
  }
  addResource(e, t, s, n) {
    let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
      silent: !1
    };
    const r = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator;
    let l = [e, t];
    s && (l = l.concat(r ? s.split(r) : s)), e.indexOf(".") > -1 && (l = e.split("."), n = t, t = l[1]), this.addNamespaces(t), ie(this.data, l, n), i.silent || this.emit("added", e, t, s, n);
  }
  addResources(e, t, s) {
    let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
      silent: !1
    };
    for (const i in s)
      (d(s[i]) || Array.isArray(s[i])) && this.addResource(e, t, i, s[i], {
        silent: !0
      });
    n.silent || this.emit("added", e, t, s);
  }
  addResourceBundle(e, t, s, n, i) {
    let r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
      silent: !1,
      skipCopy: !1
    }, l = [e, t];
    e.indexOf(".") > -1 && (l = e.split("."), n = s, s = t, t = l[1]), this.addNamespaces(t);
    let a = B(this.data, l) || {};
    r.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? de(a, s, i) : a = {
      ...a,
      ...s
    }, ie(this.data, l, a), r.silent || this.emit("added", e, t, s);
  }
  removeResourceBundle(e, t) {
    this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
  }
  hasResourceBundle(e, t) {
    return this.getResource(e, t) !== void 0;
  }
  getResourceBundle(e, t) {
    return t || (t = this.options.defaultNS), this.getResource(e, t);
  }
  getDataByLanguage(e) {
    return this.data[e];
  }
  hasLanguageSomeTranslations(e) {
    const t = this.getDataByLanguage(e);
    return !!(t && Object.keys(t) || []).find((s) => t[s] && Object.keys(t[s]).length > 0);
  }
  toJSON() {
    return this.data;
  }
}
var fe = {
  processors: {},
  addPostProcessor(o) {
    this.processors[o.name] = o;
  },
  handle(o, e, t, s, n) {
    return o.forEach((i) => {
      var r;
      e = ((r = this.processors[i]) == null ? void 0 : r.process(e, t, s, n)) ?? e;
    }), e;
  }
};
const ae = {}, oe = (o) => !d(o) && typeof o != "boolean" && typeof o != "number";
class W extends _ {
  constructor(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    super(), me(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = P.create("translator");
  }
  changeLanguage(e) {
    e && (this.language = e);
  }
  exists(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
      interpolation: {}
    };
    if (e == null)
      return !1;
    const s = this.resolve(e, t);
    return (s == null ? void 0 : s.res) !== void 0;
  }
  extractFromKey(e, t) {
    let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
    s === void 0 && (s = ":");
    const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
    let i = t.ns || this.options.defaultNS || [];
    const r = s && e.indexOf(s) > -1, l = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !we(e, s, n);
    if (r && !l) {
      const a = e.match(this.interpolator.nestingRegexp);
      if (a && a.length > 0)
        return {
          key: e,
          namespaces: d(i) ? [i] : i
        };
      const u = e.split(s);
      (s !== n || s === n && this.options.ns.indexOf(u[0]) > -1) && (i = u.shift()), e = u.join(n);
    }
    return {
      key: e,
      namespaces: d(i) ? [i] : i
    };
  }
  translate(e, t, s) {
    if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
      ...t
    }), t || (t = {}), e == null) return "";
    Array.isArray(e) || (e = [String(e)]);
    const n = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
      key: r,
      namespaces: l
    } = this.extractFromKey(e[e.length - 1], t), a = l[l.length - 1], u = t.lng || this.language, h = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
    if ((u == null ? void 0 : u.toLowerCase()) === "cimode") {
      if (h) {
        const S = t.nsSeparator || this.options.nsSeparator;
        return n ? {
          res: `${a}${S}${r}`,
          usedKey: r,
          exactUsedKey: r,
          usedLng: u,
          usedNS: a,
          usedParams: this.getUsedParamsDetails(t)
        } : `${a}${S}${r}`;
      }
      return n ? {
        res: r,
        usedKey: r,
        exactUsedKey: r,
        usedLng: u,
        usedNS: a,
        usedParams: this.getUsedParamsDetails(t)
      } : r;
    }
    const c = this.resolve(e, t);
    let g = c == null ? void 0 : c.res;
    const p = (c == null ? void 0 : c.usedKey) || r, f = (c == null ? void 0 : c.exactUsedKey) || r, m = ["[object Number]", "[object Function]", "[object RegExp]"], v = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, L = !this.i18nFormat || this.i18nFormat.handleAsObject, $ = t.count !== void 0 && !d(t.count), C = W.hasDefaultValue(t), M = $ ? this.pluralResolver.getSuffix(u, t.count, t) : "", w = t.ordinal && $ ? this.pluralResolver.getSuffix(u, t.count, {
      ordinal: !1
    }) : "", E = $ && !t.ordinal && t.count === 0, y = E && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${M}`] || t[`defaultValue${w}`] || t.defaultValue;
    let k = g;
    L && !g && C && (k = y);
    const F = oe(k), V = Object.prototype.toString.apply(k);
    if (L && k && F && m.indexOf(V) < 0 && !(d(v) && Array.isArray(k))) {
      if (!t.returnObjects && !this.options.returnObjects) {
        this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
        const S = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, k, {
          ...t,
          ns: l
        }) : `key '${r} (${this.language})' returned an object instead of string.`;
        return n ? (c.res = S, c.usedParams = this.getUsedParamsDetails(t), c) : S;
      }
      if (i) {
        const S = Array.isArray(k), R = S ? [] : {}, G = S ? f : p;
        for (const b in k)
          if (Object.prototype.hasOwnProperty.call(k, b)) {
            const N = `${G}${i}${b}`;
            C && !g ? R[b] = this.translate(N, {
              ...t,
              defaultValue: oe(y) ? y[b] : void 0,
              joinArrays: !1,
              ns: l
            }) : R[b] = this.translate(N, {
              ...t,
              joinArrays: !1,
              ns: l
            }), R[b] === N && (R[b] = k[b]);
          }
        g = R;
      }
    } else if (L && d(v) && Array.isArray(g))
      g = g.join(v), g && (g = this.extendTranslation(g, e, t, s));
    else {
      let S = !1, R = !1;
      !this.isValidLookup(g) && C && (S = !0, g = y), this.isValidLookup(g) || (R = !0, g = r);
      const G = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && R ? void 0 : g, b = C && y !== g && this.options.updateMissing;
      if (R || S || b) {
        if (this.logger.log(b ? "updateKey" : "missingKey", u, a, r, b ? y : g), i) {
          const O = this.resolve(r, {
            ...t,
            keySeparator: !1
          });
          O && O.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
        }
        let N = [];
        const z = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
        if (this.options.saveMissingTo === "fallback" && z && z[0])
          for (let O = 0; O < z.length; O++)
            N.push(z[O]);
        else this.options.saveMissingTo === "all" ? N = this.languageUtils.toResolveHierarchy(t.lng || this.language) : N.push(t.lng || this.language);
        const X = (O, j, I) => {
          var Z;
          const ee = C && I !== g ? I : G;
          this.options.missingKeyHandler ? this.options.missingKeyHandler(O, a, j, ee, b, t) : (Z = this.backendConnector) != null && Z.saveMissing && this.backendConnector.saveMissing(O, a, j, ee, b, t), this.emit("missingKey", O, a, j, g);
        };
        this.options.saveMissing && (this.options.saveMissingPlurals && $ ? N.forEach((O) => {
          const j = this.pluralResolver.getSuffixes(O, t);
          E && t[`defaultValue${this.options.pluralSeparator}zero`] && j.indexOf(`${this.options.pluralSeparator}zero`) < 0 && j.push(`${this.options.pluralSeparator}zero`), j.forEach((I) => {
            X([O], r + I, t[`defaultValue${I}`] || y);
          });
        }) : X(N, r, y));
      }
      g = this.extendTranslation(g, e, t, c, s), R && g === r && this.options.appendNamespaceToMissingKey && (g = `${a}:${r}`), (R || S) && this.options.parseMissingKeyHandler && (g = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${a}:${r}` : r, S ? g : void 0));
    }
    return n ? (c.res = g, c.usedParams = this.getUsedParamsDetails(t), c) : g;
  }
  extendTranslation(e, t, s, n, i) {
    var r, l, a = this;
    if ((r = this.i18nFormat) != null && r.parse)
      e = this.i18nFormat.parse(e, {
        ...this.options.interpolation.defaultVariables,
        ...s
      }, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
        resolved: n
      });
    else if (!s.skipInterpolation) {
      s.interpolation && this.interpolator.init({
        ...s,
        interpolation: {
          ...this.options.interpolation,
          ...s.interpolation
        }
      });
      const c = d(e) && (((l = s == null ? void 0 : s.interpolation) == null ? void 0 : l.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
      let g;
      if (c) {
        const f = e.match(this.interpolator.nestingRegexp);
        g = f && f.length;
      }
      let p = s.replace && !d(s.replace) ? s.replace : s;
      if (this.options.interpolation.defaultVariables && (p = {
        ...this.options.interpolation.defaultVariables,
        ...p
      }), e = this.interpolator.interpolate(e, p, s.lng || this.language || n.usedLng, s), c) {
        const f = e.match(this.interpolator.nestingRegexp), m = f && f.length;
        g < m && (s.nest = !1);
      }
      !s.lng && n && n.res && (s.lng = this.language || n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
        for (var f = arguments.length, m = new Array(f), v = 0; v < f; v++)
          m[v] = arguments[v];
        return (i == null ? void 0 : i[0]) === m[0] && !s.context ? (a.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${t[0]}`), null) : a.translate(...m, t);
      }, s)), s.interpolation && this.interpolator.reset();
    }
    const u = s.postProcess || this.options.postProcess, h = d(u) ? [u] : u;
    return e != null && h != null && h.length && s.applyPostProcessor !== !1 && (e = fe.handle(h, e, t, this.options && this.options.postProcessPassResolved ? {
      i18nResolved: {
        ...n,
        usedParams: this.getUsedParamsDetails(s)
      },
      ...s
    } : s, this)), e;
  }
  resolve(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, n, i, r, l;
    return d(e) && (e = [e]), e.forEach((a) => {
      if (this.isValidLookup(s)) return;
      const u = this.extractFromKey(a, t), h = u.key;
      n = h;
      let c = u.namespaces;
      this.options.fallbackNS && (c = c.concat(this.options.fallbackNS));
      const g = t.count !== void 0 && !d(t.count), p = g && !t.ordinal && t.count === 0, f = t.context !== void 0 && (d(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
      c.forEach((v) => {
        var L, $;
        this.isValidLookup(s) || (l = v, !ae[`${m[0]}-${v}`] && (L = this.utils) != null && L.hasLoadedNamespace && !(($ = this.utils) != null && $.hasLoadedNamespace(l)) && (ae[`${m[0]}-${v}`] = !0, this.logger.warn(`key "${n}" for languages "${m.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((C) => {
          var M;
          if (this.isValidLookup(s)) return;
          r = C;
          const w = [h];
          if ((M = this.i18nFormat) != null && M.addLookupKeys)
            this.i18nFormat.addLookupKeys(w, h, C, v, t);
          else {
            let y;
            g && (y = this.pluralResolver.getSuffix(C, t.count, t));
            const k = `${this.options.pluralSeparator}zero`, F = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
            if (g && (w.push(h + y), t.ordinal && y.indexOf(F) === 0 && w.push(h + y.replace(F, this.options.pluralSeparator)), p && w.push(h + k)), f) {
              const V = `${h}${this.options.contextSeparator}${t.context}`;
              w.push(V), g && (w.push(V + y), t.ordinal && y.indexOf(F) === 0 && w.push(V + y.replace(F, this.options.pluralSeparator)), p && w.push(V + k));
            }
          }
          let E;
          for (; E = w.pop(); )
            this.isValidLookup(s) || (i = E, s = this.getResource(C, v, E, t));
        }));
      });
    }), {
      res: s,
      usedKey: n,
      exactUsedKey: i,
      usedLng: r,
      usedNS: l
    };
  }
  isValidLookup(e) {
    return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
  }
  getResource(e, t, s) {
    var n;
    let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t, s, i) : this.resourceStore.getResource(e, t, s, i);
  }
  getUsedParamsDetails() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !d(e.replace);
    let n = s ? e.replace : e;
    if (s && typeof e.count < "u" && (n.count = e.count), this.options.interpolation.defaultVariables && (n = {
      ...this.options.interpolation.defaultVariables,
      ...n
    }), !s) {
      n = {
        ...n
      };
      for (const i of t)
        delete n[i];
    }
    return n;
  }
  static hasDefaultValue(e) {
    const t = "defaultValue";
    for (const s in e)
      if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
        return !0;
    return !1;
  }
}
class le {
  constructor(e) {
    this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = P.create("languageUtils");
  }
  getScriptPartFromCode(e) {
    if (e = J(e), !e || e.indexOf("-") < 0) return null;
    const t = e.split("-");
    return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
  }
  getLanguagePartFromCode(e) {
    if (e = J(e), !e || e.indexOf("-") < 0) return e;
    const t = e.split("-");
    return this.formatLanguageCode(t[0]);
  }
  formatLanguageCode(e) {
    if (d(e) && e.indexOf("-") > -1) {
      let t;
      try {
        t = Intl.getCanonicalLocales(e)[0];
      } catch {
      }
      return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
    }
    return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
  }
  isSupportedCode(e) {
    return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
  }
  getBestMatchFromCodes(e) {
    if (!e) return null;
    let t;
    return e.forEach((s) => {
      if (t) return;
      const n = this.formatLanguageCode(s);
      (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
    }), !t && this.options.supportedLngs && e.forEach((s) => {
      if (t) return;
      const n = this.getLanguagePartFromCode(s);
      if (this.isSupportedCode(n)) return t = n;
      t = this.options.supportedLngs.find((i) => {
        if (i === n || !(i.indexOf("-") < 0 && n.indexOf("-") < 0) && (i.indexOf("-") > 0 && n.indexOf("-") < 0 && i.substring(0, i.indexOf("-")) === n || i.indexOf(n) === 0 && n.length > 1))
          return i;
      });
    }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
  }
  getFallbackCodes(e, t) {
    if (!e) return [];
    if (typeof e == "function" && (e = e(t)), d(e) && (e = [e]), Array.isArray(e)) return e;
    if (!t) return e.default || [];
    let s = e[t];
    return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
  }
  toResolveHierarchy(e, t) {
    const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), n = [], i = (r) => {
      r && (this.isSupportedCode(r) ? n.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
    };
    return d(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && i(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && i(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && i(this.getLanguagePartFromCode(e))) : d(e) && i(this.formatLanguageCode(e)), s.forEach((r) => {
      n.indexOf(r) < 0 && i(this.formatLanguageCode(r));
    }), n;
  }
}
const ue = {
  zero: 0,
  one: 1,
  two: 2,
  few: 3,
  many: 4,
  other: 5
}, ge = {
  select: (o) => o === 1 ? "one" : "other",
  resolvedOptions: () => ({
    pluralCategories: ["one", "other"]
  })
};
class $e {
  constructor(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    this.languageUtils = e, this.options = t, this.logger = P.create("pluralResolver"), this.pluralRulesCache = {};
  }
  addRule(e, t) {
    this.rules[e] = t;
  }
  clearCache() {
    this.pluralRulesCache = {};
  }
  getRule(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    const s = J(e === "dev" ? "en" : e), n = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
      cleanedCode: s,
      type: n
    });
    if (i in this.pluralRulesCache)
      return this.pluralRulesCache[i];
    let r;
    try {
      r = new Intl.PluralRules(s, {
        type: n
      });
    } catch {
      if (!Intl)
        return this.logger.error("No Intl support, please use an Intl polyfill!"), ge;
      if (!e.match(/-|_/)) return ge;
      const l = this.languageUtils.getLanguagePartFromCode(e);
      r = this.getRule(l, t);
    }
    return this.pluralRulesCache[i] = r, r;
  }
  needsPlural(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
    return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
  }
  getPluralFormsOfKey(e, t) {
    let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    return this.getSuffixes(e, s).map((n) => `${t}${n}`);
  }
  getSuffixes(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
    return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((n, i) => ue[n] - ue[i]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : [];
  }
  getSuffix(e, t) {
    let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    const n = this.getRule(e, s);
    return n ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s));
  }
}
const he = function(o, e, t) {
  let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = xe(o, e, t);
  return !i && n && d(t) && (i = Y(o, t, s), i === void 0 && (i = Y(e, t, s))), i;
}, Q = (o) => o.replace(/\$/g, "$$$$");
class Ce {
  constructor() {
    var e;
    let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    this.logger = P.create("interpolator"), this.options = t, this.format = ((e = t == null ? void 0 : t.interpolation) == null ? void 0 : e.format) || ((s) => s), this.init(t);
  }
  init() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    e.interpolation || (e.interpolation = {
      escapeValue: !0
    });
    const {
      escape: t,
      escapeValue: s,
      useRawValueToEscape: n,
      prefix: i,
      prefixEscaped: r,
      suffix: l,
      suffixEscaped: a,
      formatSeparator: u,
      unescapeSuffix: h,
      unescapePrefix: c,
      nestingPrefix: g,
      nestingPrefixEscaped: p,
      nestingSuffix: f,
      nestingSuffixEscaped: m,
      nestingOptionsSeparator: v,
      maxReplaces: L,
      alwaysFormat: $
    } = e.interpolation;
    this.escape = t !== void 0 ? t : ke, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = i ? D(i) : r || "{{", this.suffix = l ? D(l) : a || "}}", this.formatSeparator = u || ",", this.unescapePrefix = h ? "" : c || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = g ? D(g) : p || D("$t("), this.nestingSuffix = f ? D(f) : m || D(")"), this.nestingOptionsSeparator = v || ",", this.maxReplaces = L || 1e3, this.alwaysFormat = $ !== void 0 ? $ : !1, this.resetRegExp();
  }
  reset() {
    this.options && this.init(this.options);
  }
  resetRegExp() {
    const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
    this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
  }
  interpolate(e, t, s, n) {
    var i;
    let r, l, a;
    const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, h = (p) => {
      if (p.indexOf(this.formatSeparator) < 0) {
        const L = he(t, u, p, this.options.keySeparator, this.options.ignoreJSONStructure);
        return this.alwaysFormat ? this.format(L, void 0, s, {
          ...n,
          ...t,
          interpolationkey: p
        }) : L;
      }
      const f = p.split(this.formatSeparator), m = f.shift().trim(), v = f.join(this.formatSeparator).trim();
      return this.format(he(t, u, m, this.options.keySeparator, this.options.ignoreJSONStructure), v, s, {
        ...n,
        ...t,
        interpolationkey: m
      });
    };
    this.resetRegExp();
    const c = (n == null ? void 0 : n.missingInterpolationHandler) || this.options.missingInterpolationHandler, g = ((i = n == null ? void 0 : n.interpolation) == null ? void 0 : i.skipOnVariables) !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
    return [{
      regex: this.regexpUnescape,
      safeValue: (p) => Q(p)
    }, {
      regex: this.regexp,
      safeValue: (p) => this.escapeValue ? Q(this.escape(p)) : Q(p)
    }].forEach((p) => {
      for (a = 0; r = p.regex.exec(e); ) {
        const f = r[1].trim();
        if (l = h(f), l === void 0)
          if (typeof c == "function") {
            const v = c(e, r, n);
            l = d(v) ? v : "";
          } else if (n && Object.prototype.hasOwnProperty.call(n, f))
            l = "";
          else if (g) {
            l = r[0];
            continue;
          } else
            this.logger.warn(`missed to pass in variable ${f} for interpolating ${e}`), l = "";
        else !d(l) && !this.useRawValueToEscape && (l = te(l));
        const m = p.safeValue(l);
        if (e = e.replace(r[0], m), g ? (p.regex.lastIndex += l.length, p.regex.lastIndex -= r[0].length) : p.regex.lastIndex = 0, a++, a >= this.maxReplaces)
          break;
      }
    }), e;
  }
  nest(e, t) {
    let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n, i, r;
    const l = (a, u) => {
      const h = this.nestingOptionsSeparator;
      if (a.indexOf(h) < 0) return a;
      const c = a.split(new RegExp(`${h}[ ]*{`));
      let g = `{${c[1]}`;
      a = c[0], g = this.interpolate(g, r);
      const p = g.match(/'/g), f = g.match(/"/g);
      (((p == null ? void 0 : p.length) ?? 0) % 2 === 0 && !f || f.length % 2 !== 0) && (g = g.replace(/'/g, '"'));
      try {
        r = JSON.parse(g), u && (r = {
          ...u,
          ...r
        });
      } catch (m) {
        return this.logger.warn(`failed parsing options string in nesting for key ${a}`, m), `${a}${h}${g}`;
      }
      return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, a;
    };
    for (; n = this.nestingRegexp.exec(e); ) {
      let a = [];
      r = {
        ...s
      }, r = r.replace && !d(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
      let u = !1;
      if (n[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(n[1])) {
        const h = n[1].split(this.formatSeparator).map((c) => c.trim());
        n[1] = h.shift(), a = h, u = !0;
      }
      if (i = t(l.call(this, n[1].trim(), r), r), i && n[0] === e && !d(i)) return i;
      d(i) || (i = te(i)), i || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), i = ""), u && (i = a.reduce((h, c) => this.format(h, c, s.lng, {
        ...s,
        interpolationkey: n[1].trim()
      }), i.trim())), e = e.replace(n[0], i), this.regexp.lastIndex = 0;
    }
    return e;
  }
}
const Pe = (o) => {
  let e = o.toLowerCase().trim();
  const t = {};
  if (o.indexOf("(") > -1) {
    const s = o.split("(");
    e = s[0].toLowerCase().trim();
    const n = s[1].substring(0, s[1].length - 1);
    e === "currency" && n.indexOf(":") < 0 ? t.currency || (t.currency = n.trim()) : e === "relativetime" && n.indexOf(":") < 0 ? t.range || (t.range = n.trim()) : n.split(";").forEach((i) => {
      if (i) {
        const [r, ...l] = i.split(":"), a = l.join(":").trim().replace(/^'+|'+$/g, ""), u = r.trim();
        t[u] || (t[u] = a), a === "false" && (t[u] = !1), a === "true" && (t[u] = !0), isNaN(a) || (t[u] = parseInt(a, 10));
      }
    });
  }
  return {
    formatName: e,
    formatOptions: t
  };
}, A = (o) => {
  const e = {};
  return (t, s, n) => {
    let i = n;
    n && n.interpolationkey && n.formatParams && n.formatParams[n.interpolationkey] && n[n.interpolationkey] && (i = {
      ...i,
      [n.interpolationkey]: void 0
    });
    const r = s + JSON.stringify(i);
    let l = e[r];
    return l || (l = o(J(s), n), e[r] = l), l(t);
  };
};
class Ne {
  constructor() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    this.logger = P.create("formatter"), this.options = e, this.formats = {
      number: A((t, s) => {
        const n = new Intl.NumberFormat(t, {
          ...s
        });
        return (i) => n.format(i);
      }),
      currency: A((t, s) => {
        const n = new Intl.NumberFormat(t, {
          ...s,
          style: "currency"
        });
        return (i) => n.format(i);
      }),
      datetime: A((t, s) => {
        const n = new Intl.DateTimeFormat(t, {
          ...s
        });
        return (i) => n.format(i);
      }),
      relativetime: A((t, s) => {
        const n = new Intl.RelativeTimeFormat(t, {
          ...s
        });
        return (i) => n.format(i, s.range || "day");
      }),
      list: A((t, s) => {
        const n = new Intl.ListFormat(t, {
          ...s
        });
        return (i) => n.format(i);
      })
    }, this.init(e);
  }
  init(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
      interpolation: {}
    };
    this.formatSeparator = t.interpolation.formatSeparator || ",";
  }
  add(e, t) {
    this.formats[e.toLowerCase().trim()] = t;
  }
  addCached(e, t) {
    this.formats[e.toLowerCase().trim()] = A(t);
  }
  format(e, t, s) {
    let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    const i = t.split(this.formatSeparator);
    if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((r) => r.indexOf(")") > -1)) {
      const r = i.findIndex((l) => l.indexOf(")") > -1);
      i[0] = [i[0], ...i.splice(1, r)].join(this.formatSeparator);
    }
    return i.reduce((r, l) => {
      var a;
      const {
        formatName: u,
        formatOptions: h
      } = Pe(l);
      if (this.formats[u]) {
        let c = r;
        try {
          const g = ((a = n == null ? void 0 : n.formatParams) == null ? void 0 : a[n.interpolationkey]) || {}, p = g.locale || g.lng || n.locale || n.lng || s;
          c = this.formats[u](r, p, {
            ...h,
            ...n,
            ...g
          });
        } catch (g) {
          this.logger.warn(g);
        }
        return c;
      } else
        this.logger.warn(`there was no format function for ${u}`);
      return r;
    }, e);
  }
}
const je = (o, e) => {
  o.pending[e] !== void 0 && (delete o.pending[e], o.pendingCount--);
};
class Ee extends _ {
  constructor(e, t, s) {
    var n, i;
    let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = r, this.logger = P.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], (i = (n = this.backend) == null ? void 0 : n.init) == null || i.call(n, s, r.backend, r);
  }
  queueLoad(e, t, s, n) {
    const i = {}, r = {}, l = {}, a = {};
    return e.forEach((u) => {
      let h = !0;
      t.forEach((c) => {
        const g = `${u}|${c}`;
        !s.reload && this.store.hasResourceBundle(u, c) ? this.state[g] = 2 : this.state[g] < 0 || (this.state[g] === 1 ? r[g] === void 0 && (r[g] = !0) : (this.state[g] = 1, h = !1, r[g] === void 0 && (r[g] = !0), i[g] === void 0 && (i[g] = !0), a[c] === void 0 && (a[c] = !0)));
      }), h || (l[u] = !0);
    }), (Object.keys(i).length || Object.keys(r).length) && this.queue.push({
      pending: r,
      pendingCount: Object.keys(r).length,
      loaded: {},
      errors: [],
      callback: n
    }), {
      toLoad: Object.keys(i),
      pending: Object.keys(r),
      toLoadLanguages: Object.keys(l),
      toLoadNamespaces: Object.keys(a)
    };
  }
  loaded(e, t, s) {
    const n = e.split("|"), i = n[0], r = n[1];
    t && this.emit("failedLoading", i, r, t), !t && s && this.store.addResourceBundle(i, r, s, void 0, void 0, {
      skipCopy: !0
    }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
    const l = {};
    this.queue.forEach((a) => {
      ye(a.loaded, [i], r), je(a, e), t && a.errors.push(t), a.pendingCount === 0 && !a.done && (Object.keys(a.loaded).forEach((u) => {
        l[u] || (l[u] = {});
        const h = a.loaded[u];
        h.length && h.forEach((c) => {
          l[u][c] === void 0 && (l[u][c] = !0);
        });
      }), a.done = !0, a.errors.length ? a.callback(a.errors) : a.callback());
    }), this.emit("loaded", l), this.queue = this.queue.filter((a) => !a.done);
  }
  read(e, t, s) {
    let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, r = arguments.length > 5 ? arguments[5] : void 0;
    if (!e.length) return r(null, {});
    if (this.readingCalls >= this.maxParallelReads) {
      this.waitingReads.push({
        lng: e,
        ns: t,
        fcName: s,
        tried: n,
        wait: i,
        callback: r
      });
      return;
    }
    this.readingCalls++;
    const l = (u, h) => {
      if (this.readingCalls--, this.waitingReads.length > 0) {
        const c = this.waitingReads.shift();
        this.read(c.lng, c.ns, c.fcName, c.tried, c.wait, c.callback);
      }
      if (u && h && n < this.maxRetries) {
        setTimeout(() => {
          this.read.call(this, e, t, s, n + 1, i * 2, r);
        }, i);
        return;
      }
      r(u, h);
    }, a = this.backend[s].bind(this.backend);
    if (a.length === 2) {
      try {
        const u = a(e, t);
        u && typeof u.then == "function" ? u.then((h) => l(null, h)).catch(l) : l(null, u);
      } catch (u) {
        l(u);
      }
      return;
    }
    return a(e, t, l);
  }
  prepareLoading(e, t) {
    let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = arguments.length > 3 ? arguments[3] : void 0;
    if (!this.backend)
      return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
    d(e) && (e = this.languageUtils.toResolveHierarchy(e)), d(t) && (t = [t]);
    const i = this.queueLoad(e, t, s, n);
    if (!i.toLoad.length)
      return i.pending.length || n(), null;
    i.toLoad.forEach((r) => {
      this.loadOne(r);
    });
  }
  load(e, t, s) {
    this.prepareLoading(e, t, {}, s);
  }
  reload(e, t, s) {
    this.prepareLoading(e, t, {
      reload: !0
    }, s);
  }
  loadOne(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
    const s = e.split("|"), n = s[0], i = s[1];
    this.read(n, i, "read", void 0, void 0, (r, l) => {
      r && this.logger.warn(`${t}loading namespace ${i} for language ${n} failed`, r), !r && l && this.logger.log(`${t}loaded namespace ${i} for language ${n}`, l), this.loaded(e, r, l);
    });
  }
  saveMissing(e, t, s, n, i) {
    var r, l, a, u, h;
    let c = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, g = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
    };
    if ((l = (r = this.services) == null ? void 0 : r.utils) != null && l.hasLoadedNamespace && !((u = (a = this.services) == null ? void 0 : a.utils) != null && u.hasLoadedNamespace(t))) {
      this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
      return;
    }
    if (!(s == null || s === "")) {
      if ((h = this.backend) != null && h.create) {
        const p = {
          ...c,
          isUpdate: i
        }, f = this.backend.create.bind(this.backend);
        if (f.length < 6)
          try {
            let m;
            f.length === 5 ? m = f(e, t, s, n, p) : m = f(e, t, s, n), m && typeof m.then == "function" ? m.then((v) => g(null, v)).catch(g) : g(null, m);
          } catch (m) {
            g(m);
          }
        else
          f(e, t, s, n, g, p);
      }
      !e || !e[0] || this.store.addResource(e[0], t, s, n);
    }
  }
}
const ce = () => ({
  debug: !1,
  initAsync: !0,
  ns: ["translation"],
  defaultNS: ["translation"],
  fallbackLng: ["dev"],
  fallbackNS: !1,
  supportedLngs: !1,
  nonExplicitSupportedLngs: !1,
  load: "all",
  preload: !1,
  simplifyPluralSuffix: !0,
  keySeparator: ".",
  nsSeparator: ":",
  pluralSeparator: "_",
  contextSeparator: "_",
  partialBundledLanguages: !1,
  saveMissing: !1,
  updateMissing: !1,
  saveMissingTo: "fallback",
  saveMissingPlurals: !0,
  missingKeyHandler: !1,
  missingInterpolationHandler: !1,
  postProcess: !1,
  postProcessPassResolved: !1,
  returnNull: !1,
  returnEmptyString: !0,
  returnObjects: !1,
  joinArrays: !1,
  returnedObjectHandler: !1,
  parseMissingKeyHandler: !1,
  appendNamespaceToMissingKey: !1,
  appendNamespaceToCIMode: !1,
  overloadTranslationOptionHandler: (o) => {
    let e = {};
    if (typeof o[1] == "object" && (e = o[1]), d(o[1]) && (e.defaultValue = o[1]), d(o[2]) && (e.tDescription = o[2]), typeof o[2] == "object" || typeof o[3] == "object") {
      const t = o[3] || o[2];
      Object.keys(t).forEach((s) => {
        e[s] = t[s];
      });
    }
    return e;
  },
  interpolation: {
    escapeValue: !0,
    format: (o) => o,
    prefix: "{{",
    suffix: "}}",
    formatSeparator: ",",
    unescapePrefix: "-",
    nestingPrefix: "$t(",
    nestingSuffix: ")",
    nestingOptionsSeparator: ",",
    maxReplaces: 1e3,
    skipOnVariables: !0
  }
}), pe = (o) => {
  var e, t;
  return d(o.ns) && (o.ns = [o.ns]), d(o.fallbackLng) && (o.fallbackLng = [o.fallbackLng]), d(o.fallbackNS) && (o.fallbackNS = [o.fallbackNS]), ((t = (e = o.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (o.supportedLngs = o.supportedLngs.concat(["cimode"])), typeof o.initImmediate == "boolean" && (o.initAsync = o.initImmediate), o;
}, H = () => {
}, Fe = (o) => {
  Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach((e) => {
    typeof o[e] == "function" && (o[e] = o[e].bind(o));
  });
};
class K extends _ {
  constructor() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
    if (super(), this.options = pe(e), this.services = {}, this.logger = P, this.modules = {
      external: []
    }, Fe(this), t && !this.isInitialized && !e.isClone) {
      if (!this.options.initAsync)
        return this.init(e, t), this;
      setTimeout(() => {
        this.init(e, t);
      }, 0);
    }
  }
  init() {
    var e = this;
    let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
    this.isInitializing = !0, typeof t == "function" && (s = t, t = {}), t.defaultNS == null && t.ns && (d(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
    const n = ce();
    this.options = {
      ...n,
      ...this.options,
      ...pe(t)
    }, this.options.interpolation = {
      ...n.interpolation,
      ...this.options.interpolation
    }, t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
    const i = (a) => a ? typeof a == "function" ? new a() : a : null;
    if (!this.options.isClone) {
      this.modules.logger ? P.init(i(this.modules.logger), this.options) : P.init(null, this.options);
      let a;
      this.modules.formatter ? a = this.modules.formatter : a = Ne;
      const u = new le(this.options);
      this.store = new re(this.options.resources, this.options);
      const h = this.services;
      h.logger = P, h.resourceStore = this.store, h.languageUtils = u, h.pluralResolver = new $e(u, {
        prepend: this.options.pluralSeparator,
        simplifyPluralSuffix: this.options.simplifyPluralSuffix
      }), a && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (h.formatter = i(a), h.formatter.init(h, this.options), this.options.interpolation.format = h.formatter.format.bind(h.formatter)), h.interpolator = new Ce(this.options), h.utils = {
        hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
      }, h.backendConnector = new Ee(i(this.modules.backend), h.resourceStore, h, this.options), h.backendConnector.on("*", function(c) {
        for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), f = 1; f < g; f++)
          p[f - 1] = arguments[f];
        e.emit(c, ...p);
      }), this.modules.languageDetector && (h.languageDetector = i(this.modules.languageDetector), h.languageDetector.init && h.languageDetector.init(h, this.options.detection, this.options)), this.modules.i18nFormat && (h.i18nFormat = i(this.modules.i18nFormat), h.i18nFormat.init && h.i18nFormat.init(this)), this.translator = new W(this.services, this.options), this.translator.on("*", function(c) {
        for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), f = 1; f < g; f++)
          p[f - 1] = arguments[f];
        e.emit(c, ...p);
      }), this.modules.external.forEach((c) => {
        c.init && c.init(this);
      });
    }
    if (this.format = this.options.interpolation.format, s || (s = H), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
      const a = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
      a.length > 0 && a[0] !== "dev" && (this.options.lng = a[0]);
    }
    !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((a) => {
      this[a] = function() {
        return e.store[a](...arguments);
      };
    }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((a) => {
      this[a] = function() {
        return e.store[a](...arguments), e;
      };
    });
    const r = T(), l = () => {
      const a = (u, h) => {
        this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), r.resolve(h), s(u, h);
      };
      if (this.languages && !this.isInitialized) return a(null, this.t.bind(this));
      this.changeLanguage(this.options.lng, a);
    };
    return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0), r;
  }
  loadResources(e) {
    var t, s;
    let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : H;
    const i = d(e) ? e : this.language;
    if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
      if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
      const r = [], l = (a) => {
        !a || a === "cimode" || this.services.languageUtils.toResolveHierarchy(a).forEach((u) => {
          u !== "cimode" && r.indexOf(u) < 0 && r.push(u);
        });
      };
      i ? l(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((a) => l(a)), (s = (t = this.options.preload) == null ? void 0 : t.forEach) == null || s.call(t, (a) => l(a)), this.services.backendConnector.load(r, this.options.ns, (a) => {
        !a && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(a);
      });
    } else
      n(null);
  }
  reloadResources(e, t, s) {
    const n = T();
    return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = H), this.services.backendConnector.reload(e, t, (i) => {
      n.resolve(), s(i);
    }), n;
  }
  use(e) {
    if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
    if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
    return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && fe.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
  }
  setResolvedLanguage(e) {
    if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
      for (let t = 0; t < this.languages.length; t++) {
        const s = this.languages[t];
        if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
          this.resolvedLanguage = s;
          break;
        }
      }
  }
  changeLanguage(e, t) {
    var s = this;
    this.isLanguageChangingTo = e;
    const n = T();
    this.emit("languageChanging", e);
    const i = (a) => {
      this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
    }, r = (a, u) => {
      u ? (i(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, n.resolve(function() {
        return s.t(...arguments);
      }), t && t(a, function() {
        return s.t(...arguments);
      });
    }, l = (a) => {
      var u, h;
      !e && !a && this.services.languageDetector && (a = []);
      const c = d(a) ? a : this.services.languageUtils.getBestMatchFromCodes(a);
      c && (this.language || i(c), this.translator.language || this.translator.changeLanguage(c), (h = (u = this.services.languageDetector) == null ? void 0 : u.cacheUserLanguage) == null || h.call(u, c)), this.loadResources(c, (g) => {
        r(g, c);
      });
    };
    return !e && this.services.languageDetector && !this.services.languageDetector.async ? l(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(l) : this.services.languageDetector.detect(l) : l(e), n;
  }
  getFixedT(e, t, s) {
    var n = this;
    const i = function(r, l) {
      let a;
      if (typeof l != "object") {
        for (var u = arguments.length, h = new Array(u > 2 ? u - 2 : 0), c = 2; c < u; c++)
          h[c - 2] = arguments[c];
        a = n.options.overloadTranslationOptionHandler([r, l].concat(h));
      } else
        a = {
          ...l
        };
      a.lng = a.lng || i.lng, a.lngs = a.lngs || i.lngs, a.ns = a.ns || i.ns, a.keyPrefix !== "" && (a.keyPrefix = a.keyPrefix || s || i.keyPrefix);
      const g = n.options.keySeparator || ".";
      let p;
      return a.keyPrefix && Array.isArray(r) ? p = r.map((f) => `${a.keyPrefix}${g}${f}`) : p = a.keyPrefix ? `${a.keyPrefix}${g}${r}` : r, n.t(p, a);
    };
    return d(e) ? i.lng = e : i.lngs = e, i.ns = t, i.keyPrefix = s, i;
  }
  t() {
    for (var e, t = arguments.length, s = new Array(t), n = 0; n < t; n++)
      s[n] = arguments[n];
    return (e = this.translator) == null ? void 0 : e.translate(...s);
  }
  exists() {
    for (var e, t = arguments.length, s = new Array(t), n = 0; n < t; n++)
      s[n] = arguments[n];
    return (e = this.translator) == null ? void 0 : e.exists(...s);
  }
  setDefaultNamespace(e) {
    this.options.defaultNS = e;
  }
  hasLoadedNamespace(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    if (!this.isInitialized)
      return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
    if (!this.languages || !this.languages.length)
      return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
    const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
    if (s.toLowerCase() === "cimode") return !0;
    const r = (l, a) => {
      const u = this.services.backendConnector.state[`${l}|${a}`];
      return u === -1 || u === 0 || u === 2;
    };
    if (t.precheck) {
      const l = t.precheck(this, r);
      if (l !== void 0) return l;
    }
    return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(s, e) && (!n || r(i, e)));
  }
  loadNamespaces(e, t) {
    const s = T();
    return this.options.ns ? (d(e) && (e = [e]), e.forEach((n) => {
      this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
    }), this.loadResources((n) => {
      s.resolve(), t && t(n);
    }), s) : (t && t(), Promise.resolve());
  }
  loadLanguages(e, t) {
    const s = T();
    d(e) && (e = [e]);
    const n = this.options.preload || [], i = e.filter((r) => n.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
    return i.length ? (this.options.preload = n.concat(i), this.loadResources((r) => {
      s.resolve(), t && t(r);
    }), s) : (t && t(), Promise.resolve());
  }
  dir(e) {
    var t, s;
    if (e || (e = this.resolvedLanguage || (((t = this.languages) == null ? void 0 : t.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
    const n = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], i = ((s = this.services) == null ? void 0 : s.languageUtils) || new le(ce());
    return n.indexOf(i.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
  }
  static createInstance() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
    return new K(e, t);
  }
  cloneInstance() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : H;
    const s = e.forkResourceStore;
    s && delete e.forkResourceStore;
    const n = {
      ...this.options,
      ...e,
      isClone: !0
    }, i = new K(n);
    if ((e.debug !== void 0 || e.prefix !== void 0) && (i.logger = i.logger.clone(e)), ["store", "services", "language"].forEach((r) => {
      i[r] = this[r];
    }), i.services = {
      ...this.services
    }, i.services.utils = {
      hasLoadedNamespace: i.hasLoadedNamespace.bind(i)
    }, s) {
      const r = Object.keys(this.store.data).reduce((l, a) => (l[a] = {
        ...this.store.data[a]
      }, Object.keys(l[a]).reduce((u, h) => (u[h] = {
        ...l[a][h]
      }, u), {})), {});
      i.store = new re(r, n), i.services.resourceStore = i.store;
    }
    return i.translator = new W(i.services, n), i.translator.on("*", function(r) {
      for (var l = arguments.length, a = new Array(l > 1 ? l - 1 : 0), u = 1; u < l; u++)
        a[u - 1] = arguments[u];
      i.emit(r, ...a);
    }), i.init(n, t), i.translator.options = n, i.translator.backendConnector.services.utils = {
      hasLoadedNamespace: i.hasLoadedNamespace.bind(i)
    }, i;
  }
  toJSON() {
    return {
      options: this.options,
      store: this.store,
      language: this.language,
      languages: this.languages,
      resolvedLanguage: this.resolvedLanguage
    };
  }
}
const x = K.createInstance();
x.createInstance = K.createInstance;
x.createInstance;
x.dir;
x.init;
x.loadResources;
x.reloadResources;
x.use;
x.changeLanguage;
x.getFixedT;
const Ve = x.t;
x.exists;
x.setDefaultNamespace;
x.hasLoadedNamespace;
x.loadNamespaces;
x.loadLanguages;
export {
  Ve as D
};
//# sourceMappingURL=i18next-CTOWN_jH-BKKbdDel.js.map
