UNPKG

michihouse-components-tmp

Version:

Biblioteca de componentes da MichiHouse

1,270 lines 1.63 MB
var mw = Object.defineProperty; var hw = (e, t, n) => t in e ? mw(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var c3 = (e, t, n) => hw(e, typeof t != "symbol" ? t + "" : t, n); import * as d from "react"; import s, { createContext as Kn, useContext as Qn, useState as jt, useRef as yt, useEffect as it, useCallback as an, useLayoutEffect as Nf, forwardRef as Et, createElement as He, useMemo as So, Children as Yr, isValidElement as qr, cloneElement as ya, Fragment as c4, useReducer as pw } from "react"; import * as bs from "react-dom"; import Rf, { flushSync as u4 } from "react-dom"; const gw = { type: "logger", log(e) { this.output("log", e); }, warn(e) { this.output("warn", e); }, error(e) { this.output("error", e); }, output(e, t) { console && console[e] && console[e].apply(console, t); } }; class Hl { constructor(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.init(t, n); } init(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.prefix = n.prefix || "i18next:", this.logger = t || gw, this.options = n, this.debug = n.debug; } log() { for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r]; return this.forward(n, "log", "", !0); } warn() { for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r]; return this.forward(n, "warn", "", !0); } error() { for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r]; return this.forward(n, "error", ""); } deprecate() { for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r]; return this.forward(n, "warn", "WARNING DEPRECATED: ", !0); } forward(t, n, r, a) { return a && !this.debug ? null : (typeof t[0] == "string" && (t[0] = `${r}${this.prefix} ${t[0]}`), this.logger[n](t)); } create(t) { return new Hl(this.logger, { prefix: `${this.prefix}:${t}:`, ...this.options }); } clone(t) { return t = t || this.options, t.prefix = t.prefix || this.prefix, new Hl(this.logger, t); } } var ar = new Hl(); class Ic { constructor() { this.observers = {}; } on(t, n) { return t.split(" ").forEach((r) => { this.observers[r] || (this.observers[r] = /* @__PURE__ */ new Map()); const a = this.observers[r].get(n) || 0; this.observers[r].set(n, a + 1); }), this; } off(t, n) { if (this.observers[t]) { if (!n) { delete this.observers[t]; return; } this.observers[t].delete(n); } } emit(t) { for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), a = 1; a < n; a++) r[a - 1] = arguments[a]; this.observers[t] && Array.from(this.observers[t].entries()).forEach((i) => { let [l, c] = i; for (let u = 0; u < c; u++) l(...r); }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((i) => { let [l, c] = i; for (let u = 0; u < c; u++) l.apply(l, [t, ...r]); }); } } function ri() { let e, t; const n = new Promise((r, a) => { e = r, t = a; }); return n.resolve = e, n.reject = t, n; } function u3(e) { return e == null ? "" : "" + e; } function vw(e, t, n) { e.forEach((r) => { t[r] && (n[r] = t[r]); }); } const yw = /###/g; function Mi(e, t, n) { function r(l) { return l && l.indexOf("###") > -1 ? l.replace(yw, ".") : l; } function a() { return !e || typeof e == "string"; } const o = typeof t != "string" ? t : t.split("."); let i = 0; for (; i < o.length - 1; ) { if (a()) return {}; const l = r(o[i]); !e[l] && n && (e[l] = new n()), Object.prototype.hasOwnProperty.call(e, l) ? e = e[l] : e = {}, ++i; } return a() ? {} : { obj: e, k: r(o[i]) }; } function d3(e, t, n) { const { obj: r, k: a } = Mi(e, t, Object); if (r !== void 0 || t.length === 1) { r[a] = n; return; } let o = t[t.length - 1], i = t.slice(0, t.length - 1), l = Mi(e, i, Object); for (; l.obj === void 0 && i.length; ) o = `${i[i.length - 1]}.${o}`, i = i.slice(0, i.length - 1), l = Mi(e, i, Object), l && l.obj && typeof l.obj[`${l.k}.${o}`] < "u" && (l.obj = void 0); l.obj[`${l.k}.${o}`] = n; } function bw(e, t, n, r) { const { obj: a, k: o } = Mi(e, t, Object); a[o] = a[o] || [], a[o].push(n); } function jl(e, t) { const { obj: n, k: r } = Mi(e, t); if (n) return n[r]; } function ww(e, t, n) { const r = jl(e, n); return r !== void 0 ? r : jl(t, n); } function d4(e, t, n) { for (const r in t) r !== "__proto__" && r !== "constructor" && (r in e ? typeof e[r] == "string" || e[r] instanceof String || typeof t[r] == "string" || t[r] instanceof String ? n && (e[r] = t[r]) : d4(e[r], t[r], n) : e[r] = t[r]); return e; } function Ba(e) { return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); } var Ew = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "/": "&#x2F;" }; function xw(e) { return typeof e == "string" ? e.replace(/[&<>"'\/]/g, (t) => Ew[t]) : e; } class $w { constructor(t) { this.capacity = t, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = []; } getRegExp(t) { const n = this.regExpMap.get(t); if (n !== void 0) return n; const r = new RegExp(t); return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(t, r), this.regExpQueue.push(t), r; } } const Cw = [" ", ",", "?", "!", ";"], Sw = new $w(20); function Mw(e, t, n) { t = t || "", n = n || ""; const r = Cw.filter((i) => t.indexOf(i) < 0 && n.indexOf(i) < 0); if (r.length === 0) return !0; const a = Sw.getRegExp(`(${r.map((i) => i === "?" ? "\\?" : i).join("|")})`); let o = !a.test(e); if (!o) { const i = e.indexOf(n); i > 0 && !a.test(e.substring(0, i)) && (o = !0); } return o; } function a1(e, t) { let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "."; if (!e) return; if (e[t]) return e[t]; const r = t.split(n); let a = e; for (let o = 0; o < r.length; ) { if (!a || typeof a != "object") return; let i, l = ""; for (let c = o; c < r.length; ++c) if (c !== o && (l += n), l += r[c], i = a[l], i !== void 0) { if (["string", "number", "boolean"].indexOf(typeof i) > -1 && c < r.length - 1) continue; o += c - o + 1; break; } a = i; } return a; } function Vl(e) { return e && e.indexOf("_") > 0 ? e.replace("_", "-") : e; } class f3 extends Ic { constructor(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { ns: ["translation"], defaultNS: "translation" }; super(), this.data = t || {}, this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0); } addNamespaces(t) { this.options.ns.indexOf(t) < 0 && this.options.ns.push(t); } removeNamespaces(t) { const n = this.options.ns.indexOf(t); n > -1 && this.options.ns.splice(n, 1); } getResource(t, n, r) { let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; const o = a.keySeparator !== void 0 ? a.keySeparator : this.options.keySeparator, i = a.ignoreJSONStructure !== void 0 ? a.ignoreJSONStructure : this.options.ignoreJSONStructure; let l; t.indexOf(".") > -1 ? l = t.split(".") : (l = [t, n], r && (Array.isArray(r) ? l.push(...r) : typeof r == "string" && o ? l.push(...r.split(o)) : l.push(r))); const c = jl(this.data, l); return !c && !n && !r && t.indexOf(".") > -1 && (t = l[0], n = l[1], r = l.slice(2).join(".")), c || !i || typeof r != "string" ? c : a1(this.data && this.data[t] && this.data[t][n], r, o); } addResource(t, n, r, a) { let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { silent: !1 }; const i = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator; let l = [t, n]; r && (l = l.concat(i ? r.split(i) : r)), t.indexOf(".") > -1 && (l = t.split("."), a = n, n = l[1]), this.addNamespaces(n), d3(this.data, l, a), o.silent || this.emit("added", t, n, r, a); } addResources(t, n, r) { let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : { silent: !1 }; for (const o in r) (typeof r[o] == "string" || Array.isArray(r[o])) && this.addResource(t, n, o, r[o], { silent: !0 }); a.silent || this.emit("added", t, n, r); } addResourceBundle(t, n, r, a, o) { let i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : { silent: !1, skipCopy: !1 }, l = [t, n]; t.indexOf(".") > -1 && (l = t.split("."), a = r, r = n, n = l[1]), this.addNamespaces(n); let c = jl(this.data, l) || {}; i.skipCopy || (r = JSON.parse(JSON.stringify(r))), a ? d4(c, r, o) : c = { ...c, ...r }, d3(this.data, l, c), i.silent || this.emit("added", t, n, r); } removeResourceBundle(t, n) { this.hasResourceBundle(t, n) && delete this.data[t][n], this.removeNamespaces(n), this.emit("removed", t, n); } hasResourceBundle(t, n) { return this.getResource(t, n) !== void 0; } getResourceBundle(t, n) { return n || (n = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? { ...this.getResource(t, n) } : this.getResource(t, n); } getDataByLanguage(t) { return this.data[t]; } hasLanguageSomeTranslations(t) { const n = this.getDataByLanguage(t); return !!(n && Object.keys(n) || []).find((a) => n[a] && Object.keys(n[a]).length > 0); } toJSON() { return this.data; } } var f4 = { processors: {}, addPostProcessor(e) { this.processors[e.name] = e; }, handle(e, t, n, r, a) { return e.forEach((o) => { this.processors[o] && (t = this.processors[o].process(t, n, r, a)); }), t; } }; const m3 = {}; class Bl extends Ic { constructor(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; super(), vw(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], t, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = ar.create("translator"); } changeLanguage(t) { t && (this.language = t); } exists(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }; if (t == null) return !1; const r = this.resolve(t, n); return r && r.res !== void 0; } extractFromKey(t, n) { let r = n.nsSeparator !== void 0 ? n.nsSeparator : this.options.nsSeparator; r === void 0 && (r = ":"); const a = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator; let o = n.ns || this.options.defaultNS || []; const i = r && t.indexOf(r) > -1, l = !this.options.userDefinedKeySeparator && !n.keySeparator && !this.options.userDefinedNsSeparator && !n.nsSeparator && !Mw(t, r, a); if (i && !l) { const c = t.match(this.interpolator.nestingRegexp); if (c && c.length > 0) return { key: t, namespaces: o }; const u = t.split(r); (r !== a || r === a && this.options.ns.indexOf(u[0]) > -1) && (o = u.shift()), t = u.join(a); } return typeof o == "string" && (o = [o]), { key: t, namespaces: o }; } translate(t, n, r) { if (typeof n != "object" && this.options.overloadTranslationOptionHandler && (n = this.options.overloadTranslationOptionHandler(arguments)), typeof n == "object" && (n = { ...n }), n || (n = {}), t == null) return ""; Array.isArray(t) || (t = [String(t)]); const a = n.returnDetails !== void 0 ? n.returnDetails : this.options.returnDetails, o = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, { key: i, namespaces: l } = this.extractFromKey(t[t.length - 1], n), c = l[l.length - 1], u = n.lng || this.language, f = n.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if (u && u.toLowerCase() === "cimode") { if (f) { const C = n.nsSeparator || this.options.nsSeparator; return a ? { res: `${c}${C}${i}`, usedKey: i, exactUsedKey: i, usedLng: u, usedNS: c, usedParams: this.getUsedParamsDetails(n) } : `${c}${C}${i}`; } return a ? { res: i, usedKey: i, exactUsedKey: i, usedLng: u, usedNS: c, usedParams: this.getUsedParamsDetails(n) } : i; } const m = this.resolve(t, n); let h = m && m.res; const p = m && m.usedKey || i, v = m && m.exactUsedKey || i, g = Object.prototype.toString.apply(h), y = ["[object Number]", "[object Function]", "[object RegExp]"], b = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, w = !this.i18nFormat || this.i18nFormat.handleAsObject; if (w && h && (typeof h != "string" && typeof h != "boolean" && typeof h != "number") && y.indexOf(g) < 0 && !(typeof b == "string" && Array.isArray(h))) { if (!n.returnObjects && !this.options.returnObjects) { this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"); const C = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, h, { ...n, ns: l }) : `key '${i} (${this.language})' returned an object instead of string.`; return a ? (m.res = C, m.usedParams = this.getUsedParamsDetails(n), m) : C; } if (o) { const C = Array.isArray(h), E = C ? [] : {}, _ = C ? v : p; for (const F in h) if (Object.prototype.hasOwnProperty.call(h, F)) { const z = `${_}${o}${F}`; E[F] = this.translate(z, { ...n, joinArrays: !1, ns: l }), E[F] === z && (E[F] = h[F]); } h = E; } } else if (w && typeof b == "string" && Array.isArray(h)) h = h.join(b), h && (h = this.extendTranslation(h, t, n, r)); else { let C = !1, E = !1; const _ = n.count !== void 0 && typeof n.count != "string", F = Bl.hasDefaultValue(n), z = _ ? this.pluralResolver.getSuffix(u, n.count, n) : "", I = n.ordinal && _ ? this.pluralResolver.getSuffix(u, n.count, { ordinal: !1 }) : "", L = _ && !n.ordinal && n.count === 0 && this.pluralResolver.shouldUseIntlApi(), G = L && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${z}`] || n[`defaultValue${I}`] || n.defaultValue; !this.isValidLookup(h) && F && (C = !0, h = G), this.isValidLookup(h) || (E = !0, h = i); const W = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && E ? void 0 : h, K = F && G !== h && this.options.updateMissing; if (E || C || K) { if (this.logger.log(K ? "updateKey" : "missingKey", u, c, i, K ? G : h), o) { const V = this.resolve(i, { ...n, keySeparator: !1 }); V && V.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 Q = []; const ee = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language); if (this.options.saveMissingTo === "fallback" && ee && ee[0]) for (let V = 0; V < ee.length; V++) Q.push(ee[V]); else this.options.saveMissingTo === "all" ? Q = this.languageUtils.toResolveHierarchy(n.lng || this.language) : Q.push(n.lng || this.language); const j = (V, X, U) => { const J = F && U !== h ? U : W; this.options.missingKeyHandler ? this.options.missingKeyHandler(V, c, X, J, K, n) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(V, c, X, J, K, n), this.emit("missingKey", V, c, X, h); }; this.options.saveMissing && (this.options.saveMissingPlurals && _ ? Q.forEach((V) => { const X = this.pluralResolver.getSuffixes(V, n); L && n[`defaultValue${this.options.pluralSeparator}zero`] && X.indexOf(`${this.options.pluralSeparator}zero`) < 0 && X.push(`${this.options.pluralSeparator}zero`), X.forEach((U) => { j([V], i + U, n[`defaultValue${U}`] || G); }); }) : j(Q, i, G)); } h = this.extendTranslation(h, t, n, m, r), E && h === i && this.options.appendNamespaceToMissingKey && (h = `${c}:${i}`), (E || C) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}:${i}` : i, C ? h : void 0) : h = this.options.parseMissingKeyHandler(h)); } return a ? (m.res = h, m.usedParams = this.getUsedParamsDetails(n), m) : h; } extendTranslation(t, n, r, a, o) { var i = this; if (this.i18nFormat && this.i18nFormat.parse) t = this.i18nFormat.parse(t, { ...this.options.interpolation.defaultVariables, ...r }, r.lng || this.language || a.usedLng, a.usedNS, a.usedKey, { resolved: a }); else if (!r.skipInterpolation) { r.interpolation && this.interpolator.init({ ...r, interpolation: { ...this.options.interpolation, ...r.interpolation } }); const u = typeof t == "string" && (r && r.interpolation && r.interpolation.skipOnVariables !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); let f; if (u) { const h = t.match(this.interpolator.nestingRegexp); f = h && h.length; } let m = r.replace && typeof r.replace != "string" ? r.replace : r; if (this.options.interpolation.defaultVariables && (m = { ...this.options.interpolation.defaultVariables, ...m }), t = this.interpolator.interpolate(t, m, r.lng || this.language, r), u) { const h = t.match(this.interpolator.nestingRegexp), p = h && h.length; f < p && (r.nest = !1); } !r.lng && this.options.compatibilityAPI !== "v1" && a && a.res && (r.lng = a.usedLng), r.nest !== !1 && (t = this.interpolator.nest(t, function() { for (var h = arguments.length, p = new Array(h), v = 0; v < h; v++) p[v] = arguments[v]; return o && o[0] === p[0] && !r.context ? (i.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${n[0]}`), null) : i.translate(...p, n); }, r)), r.interpolation && this.interpolator.reset(); } const l = r.postProcess || this.options.postProcess, c = typeof l == "string" ? [l] : l; return t != null && c && c.length && r.applyPostProcessor !== !1 && (t = f4.handle(c, t, n, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...a, usedParams: this.getUsedParamsDetails(r) }, ...r } : r, this)), t; } resolve(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r, a, o, i, l; return typeof t == "string" && (t = [t]), t.forEach((c) => { if (this.isValidLookup(r)) return; const u = this.extractFromKey(c, n), f = u.key; a = f; let m = u.namespaces; this.options.fallbackNS && (m = m.concat(this.options.fallbackNS)); const h = n.count !== void 0 && typeof n.count != "string", p = h && !n.ordinal && n.count === 0 && this.pluralResolver.shouldUseIntlApi(), v = n.context !== void 0 && (typeof n.context == "string" || typeof n.context == "number") && n.context !== "", g = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng); m.forEach((y) => { this.isValidLookup(r) || (l = y, !m3[`${g[0]}-${y}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(l) && (m3[`${g[0]}-${y}`] = !0, this.logger.warn(`key "${a}" for languages "${g.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!!!")), g.forEach((b) => { if (this.isValidLookup(r)) return; i = b; const w = [f]; if (this.i18nFormat && this.i18nFormat.addLookupKeys) this.i18nFormat.addLookupKeys(w, f, b, y, n); else { let C; h && (C = this.pluralResolver.getSuffix(b, n.count, n)); const E = `${this.options.pluralSeparator}zero`, _ = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (h && (w.push(f + C), n.ordinal && C.indexOf(_) === 0 && w.push(f + C.replace(_, this.options.pluralSeparator)), p && w.push(f + E)), v) { const F = `${f}${this.options.contextSeparator}${n.context}`; w.push(F), h && (w.push(F + C), n.ordinal && C.indexOf(_) === 0 && w.push(F + C.replace(_, this.options.pluralSeparator)), p && w.push(F + E)); } } let $; for (; $ = w.pop(); ) this.isValidLookup(r) || (o = $, r = this.getResource(b, y, $, n)); })); }); }), { res: r, usedKey: a, exactUsedKey: o, usedLng: i, usedNS: l }; } isValidLookup(t) { return t !== void 0 && !(!this.options.returnNull && t === null) && !(!this.options.returnEmptyString && t === ""); } getResource(t, n, r) { let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(t, n, r, a) : this.resourceStore.getResource(t, n, r, a); } getUsedParamsDetails() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const n = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = t.replace && typeof t.replace != "string"; let a = r ? t.replace : t; if (r && typeof t.count < "u" && (a.count = t.count), this.options.interpolation.defaultVariables && (a = { ...this.options.interpolation.defaultVariables, ...a }), !r) { a = { ...a }; for (const o of n) delete a[o]; } return a; } static hasDefaultValue(t) { const n = "defaultValue"; for (const r in t) if (Object.prototype.hasOwnProperty.call(t, r) && n === r.substring(0, n.length) && t[r] !== void 0) return !0; return !1; } } function Ju(e) { return e.charAt(0).toUpperCase() + e.slice(1); } class h3 { constructor(t) { this.options = t, this.supportedLngs = this.options.supportedLngs || !1, this.logger = ar.create("languageUtils"); } getScriptPartFromCode(t) { if (t = Vl(t), !t || t.indexOf("-") < 0) return null; const n = t.split("-"); return n.length === 2 || (n.pop(), n[n.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(n.join("-")); } getLanguagePartFromCode(t) { if (t = Vl(t), !t || t.indexOf("-") < 0) return t; const n = t.split("-"); return this.formatLanguageCode(n[0]); } formatLanguageCode(t) { if (typeof t == "string" && t.indexOf("-") > -1) { const n = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"]; let r = t.split("-"); return this.options.lowerCaseLng ? r = r.map((a) => a.toLowerCase()) : r.length === 2 ? (r[0] = r[0].toLowerCase(), r[1] = r[1].toUpperCase(), n.indexOf(r[1].toLowerCase()) > -1 && (r[1] = Ju(r[1].toLowerCase()))) : r.length === 3 && (r[0] = r[0].toLowerCase(), r[1].length === 2 && (r[1] = r[1].toUpperCase()), r[0] !== "sgn" && r[2].length === 2 && (r[2] = r[2].toUpperCase()), n.indexOf(r[1].toLowerCase()) > -1 && (r[1] = Ju(r[1].toLowerCase())), n.indexOf(r[2].toLowerCase()) > -1 && (r[2] = Ju(r[2].toLowerCase()))), r.join("-"); } return this.options.cleanCode || this.options.lowerCaseLng ? t.toLowerCase() : t; } isSupportedCode(t) { return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (t = this.getLanguagePartFromCode(t)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(t) > -1; } getBestMatchFromCodes(t) { if (!t) return null; let n; return t.forEach((r) => { if (n) return; const a = this.formatLanguageCode(r); (!this.options.supportedLngs || this.isSupportedCode(a)) && (n = a); }), !n && this.options.supportedLngs && t.forEach((r) => { if (n) return; const a = this.getLanguagePartFromCode(r); if (this.isSupportedCode(a)) return n = a; n = this.options.supportedLngs.find((o) => { if (o === a) return o; if (!(o.indexOf("-") < 0 && a.indexOf("-") < 0) && (o.indexOf("-") > 0 && a.indexOf("-") < 0 && o.substring(0, o.indexOf("-")) === a || o.indexOf(a) === 0 && a.length > 1)) return o; }); }), n || (n = this.getFallbackCodes(this.options.fallbackLng)[0]), n; } getFallbackCodes(t, n) { if (!t) return []; if (typeof t == "function" && (t = t(n)), typeof t == "string" && (t = [t]), Array.isArray(t)) return t; if (!n) return t.default || []; let r = t[n]; return r || (r = t[this.getScriptPartFromCode(n)]), r || (r = t[this.formatLanguageCode(n)]), r || (r = t[this.getLanguagePartFromCode(n)]), r || (r = t.default), r || []; } toResolveHierarchy(t, n) { const r = this.getFallbackCodes(n || this.options.fallbackLng || [], t), a = [], o = (i) => { i && (this.isSupportedCode(i) ? a.push(i) : this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`)); }; return typeof t == "string" && (t.indexOf("-") > -1 || t.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && o(this.formatLanguageCode(t)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && o(this.getScriptPartFromCode(t)), this.options.load !== "currentOnly" && o(this.getLanguagePartFromCode(t))) : typeof t == "string" && o(this.formatLanguageCode(t)), r.forEach((i) => { a.indexOf(i) < 0 && o(this.formatLanguageCode(i)); }), a; } } let _w = [{ lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"], nr: [1, 2], fc: 1 }, { lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"], nr: [1, 2], fc: 2 }, { lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"], nr: [1], fc: 3 }, { lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"], nr: [1, 2, 5], fc: 4 }, { lngs: ["ar"], nr: [0, 1, 2, 3, 11, 100], fc: 5 }, { lngs: ["cs", "sk"], nr: [1, 2, 5], fc: 6 }, { lngs: ["csb", "pl"], nr: [1, 2, 5], fc: 7 }, { lngs: ["cy"], nr: [1, 2, 3, 8], fc: 8 }, { lngs: ["fr"], nr: [1, 2], fc: 9 }, { lngs: ["ga"], nr: [1, 2, 3, 7, 11], fc: 10 }, { lngs: ["gd"], nr: [1, 2, 3, 20], fc: 11 }, { lngs: ["is"], nr: [1, 2], fc: 12 }, { lngs: ["jv"], nr: [0, 1], fc: 13 }, { lngs: ["kw"], nr: [1, 2, 3, 4], fc: 14 }, { lngs: ["lt"], nr: [1, 2, 10], fc: 15 }, { lngs: ["lv"], nr: [1, 2, 0], fc: 16 }, { lngs: ["mk"], nr: [1, 2], fc: 17 }, { lngs: ["mnk"], nr: [0, 1, 2], fc: 18 }, { lngs: ["mt"], nr: [1, 2, 11, 20], fc: 19 }, { lngs: ["or"], nr: [2, 1], fc: 2 }, { lngs: ["ro"], nr: [1, 2, 20], fc: 20 }, { lngs: ["sl"], nr: [5, 1, 2, 3], fc: 21 }, { lngs: ["he", "iw"], nr: [1, 2, 20, 21], fc: 22 }], Fw = { 1: function(e) { return +(e > 1); }, 2: function(e) { return +(e != 1); }, 3: function(e) { return 0; }, 4: function(e) { return e % 10 == 1 && e % 100 != 11 ? 0 : e % 10 >= 2 && e % 10 <= 4 && (e % 100 < 10 || e % 100 >= 20) ? 1 : 2; }, 5: function(e) { return e == 0 ? 0 : e == 1 ? 1 : e == 2 ? 2 : e % 100 >= 3 && e % 100 <= 10 ? 3 : e % 100 >= 11 ? 4 : 5; }, 6: function(e) { return e == 1 ? 0 : e >= 2 && e <= 4 ? 1 : 2; }, 7: function(e) { return e == 1 ? 0 : e % 10 >= 2 && e % 10 <= 4 && (e % 100 < 10 || e % 100 >= 20) ? 1 : 2; }, 8: function(e) { return e == 1 ? 0 : e == 2 ? 1 : e != 8 && e != 11 ? 2 : 3; }, 9: function(e) { return +(e >= 2); }, 10: function(e) { return e == 1 ? 0 : e == 2 ? 1 : e < 7 ? 2 : e < 11 ? 3 : 4; }, 11: function(e) { return e == 1 || e == 11 ? 0 : e == 2 || e == 12 ? 1 : e > 2 && e < 20 ? 2 : 3; }, 12: function(e) { return +(e % 10 != 1 || e % 100 == 11); }, 13: function(e) { return +(e !== 0); }, 14: function(e) { return e == 1 ? 0 : e == 2 ? 1 : e == 3 ? 2 : 3; }, 15: function(e) { return e % 10 == 1 && e % 100 != 11 ? 0 : e % 10 >= 2 && (e % 100 < 10 || e % 100 >= 20) ? 1 : 2; }, 16: function(e) { return e % 10 == 1 && e % 100 != 11 ? 0 : e !== 0 ? 1 : 2; }, 17: function(e) { return e == 1 || e % 10 == 1 && e % 100 != 11 ? 0 : 1; }, 18: function(e) { return e == 0 ? 0 : e == 1 ? 1 : 2; }, 19: function(e) { return e == 1 ? 0 : e == 0 || e % 100 > 1 && e % 100 < 11 ? 1 : e % 100 > 10 && e % 100 < 20 ? 2 : 3; }, 20: function(e) { return e == 1 ? 0 : e == 0 || e % 100 > 0 && e % 100 < 20 ? 1 : 2; }, 21: function(e) { return e % 100 == 1 ? 1 : e % 100 == 2 ? 2 : e % 100 == 3 || e % 100 == 4 ? 3 : 0; }, 22: function(e) { return e == 1 ? 0 : e == 2 ? 1 : (e < 0 || e > 10) && e % 10 == 0 ? 2 : 3; } }; const Pw = ["v1", "v2", "v3"], Nw = ["v4"], p3 = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }; function Rw() { const e = {}; return _w.forEach((t) => { t.lngs.forEach((n) => { e[n] = { numbers: t.nr, plurals: Fw[t.fc] }; }); }), e; } class Ow { constructor(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.languageUtils = t, this.options = n, this.logger = ar.create("pluralResolver"), (!this.options.compatibilityJSON || Nw.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = Rw(); } addRule(t, n) { this.rules[t] = n; } getRule(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (this.shouldUseIntlApi()) try { return new Intl.PluralRules(Vl(t === "dev" ? "en" : t), { type: n.ordinal ? "ordinal" : "cardinal" }); } catch { return; } return this.rules[t] || this.rules[this.languageUtils.getLanguagePartFromCode(t)]; } needsPlural(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const r = this.getRule(t, n); return this.shouldUseIntlApi() ? r && r.resolvedOptions().pluralCategories.length > 1 : r && r.numbers.length > 1; } getPluralFormsOfKey(t, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; return this.getSuffixes(t, r).map((a) => `${n}${a}`); } getSuffixes(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const r = this.getRule(t, n); return r ? this.shouldUseIntlApi() ? r.resolvedOptions().pluralCategories.sort((a, o) => p3[a] - p3[o]).map((a) => `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${a}`) : r.numbers.map((a) => this.getSuffix(t, a, n)) : []; } getSuffix(t, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; const a = this.getRule(t, r); return a ? this.shouldUseIntlApi() ? `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${a.select(n)}` : this.getSuffixRetroCompatible(a, n) : (this.logger.warn(`no plural rule found for: ${t}`), ""); } getSuffixRetroCompatible(t, n) { const r = t.noAbs ? t.plurals(n) : t.plurals(Math.abs(n)); let a = t.numbers[r]; this.options.simplifyPluralSuffix && t.numbers.length === 2 && t.numbers[0] === 1 && (a === 2 ? a = "plural" : a === 1 && (a = "")); const o = () => this.options.prepend && a.toString() ? this.options.prepend + a.toString() : a.toString(); return this.options.compatibilityJSON === "v1" ? a === 1 ? "" : typeof a == "number" ? `_plural_${a.toString()}` : o() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && t.numbers.length === 2 && t.numbers[0] === 1 ? o() : this.options.prepend && r.toString() ? this.options.prepend + r.toString() : r.toString(); } shouldUseIntlApi() { return !Pw.includes(this.options.compatibilityJSON); } } function g3(e, t, n) { let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, o = ww(e, t, n); return !o && a && typeof n == "string" && (o = a1(e, n, r), o === void 0 && (o = a1(t, n, r))), o; } class Aw { constructor() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = ar.create("interpolator"), this.options = t, this.format = t.interpolation && t.interpolation.format || ((n) => n), this.init(t); } init() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; t.interpolation || (t.interpolation = { escapeValue: !0 }); const { escape: n, escapeValue: r, useRawValueToEscape: a, prefix: o, prefixEscaped: i, suffix: l, suffixEscaped: c, formatSeparator: u, unescapeSuffix: f, unescapePrefix: m, nestingPrefix: h, nestingPrefixEscaped: p, nestingSuffix: v, nestingSuffixEscaped: g, nestingOptionsSeparator: y, maxReplaces: b, alwaysFormat: w } = t.interpolation; this.escape = n !== void 0 ? n : xw, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = a !== void 0 ? a : !1, this.prefix = o ? Ba(o) : i || "{{", this.suffix = l ? Ba(l) : c || "}}", this.formatSeparator = u || ",", this.unescapePrefix = f ? "" : m || "-", this.unescapeSuffix = this.unescapePrefix ? "" : f || "", this.nestingPrefix = h ? Ba(h) : p || Ba("$t("), this.nestingSuffix = v ? Ba(v) : g || Ba(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = b || 1e3, this.alwaysFormat = w !== void 0 ? w : !1, this.resetRegExp(); } reset() { this.options && this.init(this.options); } resetRegExp() { const t = (n, r) => n && n.source === r ? (n.lastIndex = 0, n) : new RegExp(r, "g"); this.regexp = t(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = t(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = t(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`); } interpolate(t, n, r, a) { let o, i, l; const c = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}; function u(v) { return v.replace(/\$/g, "$$$$"); } const f = (v) => { if (v.indexOf(this.formatSeparator) < 0) { const w = g3(n, c, v, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(w, void 0, r, { ...a, ...n, interpolationkey: v }) : w; } const g = v.split(this.formatSeparator), y = g.shift().trim(), b = g.join(this.formatSeparator).trim(); return this.format(g3(n, c, y, this.options.keySeparator, this.options.ignoreJSONStructure), b, r, { ...a, ...n, interpolationkey: y }); }; this.resetRegExp(); const m = a && a.missingInterpolationHandler || this.options.missingInterpolationHandler, h = a && a.interpolation && a.interpolation.skipOnVariables !== void 0 ? a.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; return [{ regex: this.regexpUnescape, safeValue: (v) => u(v) }, { regex: this.regexp, safeValue: (v) => this.escapeValue ? u(this.escape(v)) : u(v) }].forEach((v) => { for (l = 0; o = v.regex.exec(t); ) { const g = o[1].trim(); if (i = f(g), i === void 0) if (typeof m == "function") { const b = m(t, o, a); i = typeof b == "string" ? b : ""; } else if (a && Object.prototype.hasOwnProperty.call(a, g)) i = ""; else if (h) { i = o[0]; continue; } else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`), i = ""; else typeof i != "string" && !this.useRawValueToEscape && (i = u3(i)); const y = v.safeValue(i); if (t = t.replace(o[0], y), h ? (v.regex.lastIndex += i.length, v.regex.lastIndex -= o[0].length) : v.regex.lastIndex = 0, l++, l >= this.maxReplaces) break; } }), t; } nest(t, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, a, o, i; function l(c, u) { const f = this.nestingOptionsSeparator; if (c.indexOf(f) < 0) return c; const m = c.split(new RegExp(`${f}[ ]*{`)); let h = `{${m[1]}`; c = m[0], h = this.interpolate(h, i); const p = h.match(/'/g), v = h.match(/"/g); (p && p.length % 2 === 0 && !v || v.length % 2 !== 0) && (h = h.replace(/'/g, '"')); try { i = JSON.parse(h), u && (i = { ...u, ...i }); } catch (g) { return this.logger.warn(`failed parsing options string in nesting for key ${c}`, g), `${c}${f}${h}`; } return i.defaultValue && i.defaultValue.indexOf(this.prefix) > -1 && delete i.defaultValue, c; } for (; a = this.nestingRegexp.exec(t); ) { let c = []; i = { ...r }, i = i.replace && typeof i.replace != "string" ? i.replace : i, i.applyPostProcessor = !1, delete i.defaultValue; let u = !1; if (a[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(a[1])) { const f = a[1].split(this.formatSeparator).map((m) => m.trim()); a[1] = f.shift(), c = f, u = !0; } if (o = n(l.call(this, a[1].trim(), i), i), o && a[0] === t && typeof o != "string") return o; typeof o != "string" && (o = u3(o)), o || (this.logger.warn(`missed to resolve ${a[1]} for nesting ${t}`), o = ""), u && (o = c.reduce((f, m) => this.format(f, m, r.lng, { ...r, interpolationkey: a[1].trim() }), o.trim())), t = t.replace(a[0], o), this.regexp.lastIndex = 0; } return t; } } function Tw(e) { let t = e.toLowerCase().trim(); const n = {}; if (e.indexOf("(") > -1) { const r = e.split("("); t = r[0].toLowerCase().trim(); const a = r[1].substring(0, r[1].length - 1); t === "currency" && a.indexOf(":") < 0 ? n.currency || (n.currency = a.trim()) : t === "relativetime" && a.indexOf(":") < 0 ? n.range || (n.range = a.trim()) : a.split(";").forEach((i) => { if (i) { const [l, ...c] = i.split(":"), u = c.join(":").trim().replace(/^'+|'+$/g, ""), f = l.trim(); n[f] || (n[f] = u), u === "false" && (n[f] = !1), u === "true" && (n[f] = !0), isNaN(u) || (n[f] = parseInt(u, 10)); } }); } return { formatName: t, formatOptions: n }; } function Ua(e) { const t = {}; return function(r, a, o) { const i = a + JSON.stringify(o); let l = t[i]; return l || (l = e(Vl(a), o), t[i] = l), l(r); }; } class Dw { constructor() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; this.logger = ar.create("formatter"), this.options = t, this.formats = { number: Ua((n, r) => { const a = new Intl.NumberFormat(n, { ...r }); return (o) => a.format(o); }), currency: Ua((n, r) => { const a = new Intl.NumberFormat(n, { ...r, style: "currency" }); return (o) => a.format(o); }), datetime: Ua((n, r) => { const a = new Intl.DateTimeFormat(n, { ...r }); return (o) => a.format(o); }), relativetime: Ua((n, r) => { const a = new Intl.RelativeTimeFormat(n, { ...r }); return (o) => a.format(o, r.range || "day"); }), list: Ua((n, r) => { const a = new Intl.ListFormat(n, { ...r }); return (o) => a.format(o); }) }, this.init(t); } init(t) { const r = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }).interpolation; this.formatSeparator = r.formatSeparator ? r.formatSeparator : r.formatSeparator || ","; } add(t, n) { this.formats[t.toLowerCase().trim()] = n; } addCached(t, n) { this.formats[t.toLowerCase().trim()] = Ua(n); } format(t, n, r) { let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; return n.split(this.formatSeparator).reduce((l, c) => { const { formatName: u, formatOptions: f } = Tw(c); if (this.formats[u]) { let m = l; try { const h = a && a.formatParams && a.formatParams[a.interpolationkey] || {}, p = h.locale || h.lng || a.locale || a.lng || r; m = this.formats[u](l, p, { ...f, ...a, ...h }); } catch (h) { this.logger.warn(h); } return m; } else this.logger.warn(`there was no format function for ${u}`); return l; }, t); } } function zw(e, t) { e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--); } class Iw extends Ic { constructor(t, n, r) { let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; super(), this.backend = t, this.store = n, this.services = r, this.languageUtils = r.languageUtils, this.options = a, this.logger = ar.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = a.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = a.maxRetries >= 0 ? a.maxRetries : 5, this.retryTimeout = a.retryTimeout >= 1 ? a.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(r, a.backend, a); } queueLoad(t, n, r, a) { const o = {}, i = {}, l = {}, c = {}; return t.forEach((u) => { let f = !0; n.forEach((m) => { const h = `${u}|${m}`; !r.reload && this.store.hasResourceBundle(u, m) ? this.state[h] = 2 : this.state[h] < 0 || (this.state[h] === 1 ? i[h] === void 0 && (i[h] = !0) : (this.state[h] = 1, f = !1, i[h] === void 0 && (i[h] = !0), o[h] === void 0 && (o[h] = !0), c[m] === void 0 && (c[m] = !0))); }), f || (l[u] = !0); }), (Object.keys(o).length || Object.keys(i).length) && this.queue.push({ pending: i, pendingCount: Object.keys(i).length, loaded: {}, errors: [], callback: a }), { toLoad: Object.keys(o), pending: Object.keys(i), toLoadLanguages: Object.keys(l), toLoadNamespaces: Object.keys(c) }; } loaded(t, n, r) { const a = t.split("|"), o = a[0], i = a[1]; n && this.emit("failedLoading", o, i, n), r && this.store.addResourceBundle(o, i, r, void 0, void 0, { skipCopy: !0 }), this.state[t] = n ? -1 : 2; const l = {}; this.queue.forEach((c) => { bw(c.loaded, [o], i), zw(c, t), n && c.errors.push(n), c.pendingCount === 0 && !c.done && (Object.keys(c.loaded).forEach((u) => { l[u] || (l[u] = {}); const f = c.loaded[u]; f.length && f.forEach((m) => { l[u][m] === void 0 && (l[u][m] = !0); }); }), c.done = !0, c.errors.length ? c.callback(c.errors) : c.callback()); }), this.emit("loaded", l), this.queue = this.queue.filter((c) => !c.done); } read(t, n, r) { let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, i = arguments.length > 5 ? arguments[5] : void 0; if (!t.length) return i(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({ lng: t, ns: n, fcName: r, tried: a, wait: o, callback: i }); return; } this.readingCalls++; const l = (u, f) => { if (this.readingCalls--, this.waitingReads.length > 0) { const m = this.waitingReads.shift(); this.read(m.lng, m.ns, m.fcName, m.tried, m.wait, m.callback); } if (u && f && a < this.maxRetries) { setTimeout(() => { this.read.call(this, t, n, r, a + 1, o * 2, i); }, o); return; } i(u, f); }, c = this.backend[r].bind(this.backend); if (c.length === 2) { try { const u = c(t, n); u && typeof u.then == "function" ? u.then((f) => l(null, f)).catch(l) : l(null, u); } catch (u) { l(u); } return; } return c(t, n, l); } prepareLoading(t, n) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, a = 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."), a && a(); typeof t == "string" && (t = this.languageUtils.toResolveHierarchy(t)), typeof n == "string" && (n = [n]); const o = this.queueLoad(t, n, r, a); if (!o.toLoad.length) return o.pending.length || a(), null; o.toLoad.forEach((i) => { this.loadOne(i); }); } load(t, n, r) { this.prepareLoading(t, n, {}, r); } reload(t, n, r) { this.prepareLoading(t, n, { reload: !0 }, r); } loadOne(t) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; const r = t.split("|"), a = r[0], o = r[1]; this.read(a, o, "read", void 0, void 0, (i, l) => { i && this.logger.warn(`${n}loading namespace ${o} for language ${a} failed`, i), !i && l && this.logger.log(`${n}loaded namespace ${o} for language ${a}`, l), this.loaded(t, i, l); }); } saveMissing(t, n, r, a, o) { let i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, l = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => { }; if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(n)) { this.logger.warn(`did not save key "${r}" as the namespace "${n}" 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 (!(r == null || r === "")) { if (this.backend && this.backend.create) { const c = { ...i, isUpdate: o }, u = this.backend.create.bind(this.backend); if (u.length < 6) try { let f; u.length === 5 ? f = u(t, n, r, a, c) : f = u(t, n, r, a), f && typeof f.then == "function" ? f.then((m) => l(null, m)).catch(l) : l(null, f); } catch (f) { l(f); } else u(t, n, r, a, l, c); } !t || !t[0] || this.store.addResource(t[0], n, r, a); } } } function v3() { return { debug: !1, initImmediate: !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: function(t) { let n = {}; if (typeof t[1] == "object" && (n = t[1]), typeof t[1] == "string" && (n.defaultValue = t[1]), typeof t[2] == "string" && (n.tDescription = t[2]), typeof t[2] == "object" || typeof t[3] == "object") { const r = t[3] || t[2]; Object.keys(r).forEach((