UNPKG

@connectycube/chat-widget

Version:

A React component that seamlessly integrates ConnectyCube's real-time chat capabilities into your web applications. This widget offers an out-of-the-box solution for embedding chat features—such as instant messaging, user presence, and file sharing—withou

1,316 lines (1,315 loc) 1.64 MB
import * as C from "react"; import Y, { createContext as $l, useContext as qc, useCallback as Hq, useState as kq, useRef as yq, useEffect as dq, useLayoutEffect as Ac, useMemo as Nq, forwardRef as ec, createElement as yo, memo as Ur } from "react"; import aq from "connectycube"; import * as tc from "react-dom"; import Vc, { createPortal as Rp } from "react-dom"; function fA(q, A) { for (var e = 0; e < A.length; e++) { const t = A[e]; if (typeof t != "string" && !Array.isArray(t)) { for (const V in t) if (V !== "default" && !(V in q)) { const r = Object.getOwnPropertyDescriptor(t, V); r && Object.defineProperty(q, V, r.get ? r : { enumerable: !0, get: () => t[V] }); } } } return Object.freeze(Object.defineProperty(q, Symbol.toStringTag, { value: "Module" })); } var hn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function iA(q) { return q && q.__esModule && Object.prototype.hasOwnProperty.call(q, "default") ? q.default : q; } function Np(q) { if (Object.prototype.hasOwnProperty.call(q, "__esModule")) return q; var A = q.default; if (typeof A == "function") { var e = function t() { return this instanceof t ? Reflect.construct(A, arguments, this.constructor) : A.apply(this, arguments); }; e.prototype = A.prototype; } else e = {}; return Object.defineProperty(e, "__esModule", { value: !0 }), Object.keys(q).forEach(function(t) { var V = Object.getOwnPropertyDescriptor(q, t); Object.defineProperty(e, t, V.get ? V : { enumerable: !0, get: function() { return q[t]; } }); }), e; } var uV = { exports: {} }, yt = {}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var rs; function Up() { if (rs) return yt; rs = 1; var q = Symbol.for("react.transitional.element"), A = Symbol.for("react.fragment"); function e(t, V, r) { var n = null; if (r !== void 0 && (n = "" + r), V.key !== void 0 && (n = "" + V.key), "key" in V) { r = {}; for (var o in V) o !== "key" && (r[o] = V[o]); } else r = V; return V = r.ref, { $$typeof: q, type: t, key: n, ref: V !== void 0 ? V : null, props: r }; } return yt.Fragment = A, yt.jsx = e, yt.jsxs = e, yt; } var Ct = {}, ns; function Op() { if (ns) return Ct; ns = 1; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ return "production".NODE_ENV !== "production" && function() { function q(M) { if (M == null) return null; if (typeof M == "function") return M.$$typeof === U ? null : M.displayName || M.name || null; if (typeof M == "string") return M; switch (M) { case p: return "Fragment"; case w: return "Profiler"; case E: return "StrictMode"; case l: return "Suspense"; case y: return "SuspenseList"; case k: return "Activity"; } if (typeof M == "object") switch (typeof M.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), M.$$typeof) { case h: return "Portal"; case f: return (M.displayName || "Context") + ".Provider"; case I: return (M._context.displayName || "Context") + ".Consumer"; case d: var x = M.render; return M = M.displayName, M || (M = x.displayName || x.name || "", M = M !== "" ? "ForwardRef(" + M + ")" : "ForwardRef"), M; case v: return x = M.displayName || null, x !== null ? x : q(M.type) || "Memo"; case B: x = M._payload, M = M._init; try { return q(M(x)); } catch { } } return null; } function A(M) { return "" + M; } function e(M) { try { A(M); var x = !1; } catch { x = !0; } if (x) { x = console; var L = x.error, K = typeof Symbol == "function" && Symbol.toStringTag && M[Symbol.toStringTag] || M.constructor.name || "Object"; return L.call( x, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", K ), A(M); } } function t(M) { if (M === p) return "<>"; if (typeof M == "object" && M !== null && M.$$typeof === B) return "<...>"; try { var x = q(M); return x ? "<" + x + ">" : "<...>"; } catch { return "<...>"; } } function V() { var M = R.A; return M === null ? null : M.getOwner(); } function r() { return Error("react-stack-top-frame"); } function n(M) { if (G.call(M, "key")) { var x = Object.getOwnPropertyDescriptor(M, "key").get; if (x && x.isReactWarning) return !1; } return M.key !== void 0; } function o(M, x) { function L() { S || (S = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", x )); } L.isReactWarning = !0, Object.defineProperty(M, "key", { get: L, configurable: !0 }); } function s() { var M = q(this.type); return T[M] || (T[M] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), M = this.props.ref, M !== void 0 ? M : null; } function i(M, x, L, K, X, Z, H, eq) { return L = Z.ref, M = { $$typeof: m, type: M, key: x, props: Z, _owner: X }, (L !== void 0 ? L : null) !== null ? Object.defineProperty(M, "ref", { enumerable: !1, get: s }) : Object.defineProperty(M, "ref", { enumerable: !1, value: null }), M._store = {}, Object.defineProperty(M._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(M, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(M, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: H }), Object.defineProperty(M, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: eq }), Object.freeze && (Object.freeze(M.props), Object.freeze(M)), M; } function c(M, x, L, K, X, Z, H, eq) { var Vq = x.children; if (Vq !== void 0) if (K) if (P(Vq)) { for (K = 0; K < Vq.length; K++) a(Vq[K]); Object.freeze && Object.freeze(Vq); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else a(Vq); if (G.call(x, "key")) { Vq = q(M); var nq = Object.keys(x).filter(function(cq) { return cq !== "key"; }); K = 0 < nq.length ? "{key: someKey, " + nq.join(": ..., ") + ": ...}" : "{key: someKey}", O[Vq + K] || (nq = 0 < nq.length ? "{" + nq.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, K, Vq, nq, Vq ), O[Vq + K] = !0); } if (Vq = null, L !== void 0 && (e(L), Vq = "" + L), n(x) && (e(x.key), Vq = "" + x.key), "key" in x) { L = {}; for (var qq in x) qq !== "key" && (L[qq] = x[qq]); } else L = x; return Vq && o( L, typeof M == "function" ? M.displayName || M.name || "Unknown" : M ), i( M, Vq, Z, X, V(), L, H, eq ); } function a(M) { typeof M == "object" && M !== null && M.$$typeof === m && M._store && (M._store.validated = 1); } var g = Y, m = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), I = Symbol.for("react.consumer"), f = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), k = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), R = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, P = Array.isArray, Q = console.createTask ? console.createTask : function() { return null; }; g = { "react-stack-bottom-frame": function(M) { return M(); } }; var S, T = {}, W = g["react-stack-bottom-frame"].bind( g, r )(), j = Q(t(r)), O = {}; Ct.Fragment = p, Ct.jsx = function(M, x, L, K, X) { var Z = 1e4 > R.recentlyCreatedOwnerStacks++; return c( M, x, L, !1, K, X, Z ? Error("react-stack-top-frame") : W, Z ? Q(t(M)) : j ); }, Ct.jsxs = function(M, x, L, K, X) { var Z = 1e4 > R.recentlyCreatedOwnerStacks++; return c( M, x, L, !0, K, X, Z ? Error("react-stack-top-frame") : W, Z ? Q(t(M)) : j ); }; }(), Ct; } var os; function Gp() { return os || (os = 1, "production".NODE_ENV === "production" ? uV.exports = Up() : uV.exports = Op()), uV.exports; } var u = Gp(); const pq = (q) => typeof q == "string", Mt = () => { let q, A; const e = new Promise((t, V) => { q = t, A = V; }); return e.resolve = q, e.reject = A, e; }, as = (q) => q == null ? "" : "" + q, jp = (q, A, e) => { q.forEach((t) => { A[t] && (e[t] = A[t]); }); }, Pp = /###/g, ss = (q) => q && q.indexOf("###") > -1 ? q.replace(Pp, ".") : q, is = (q) => !q || pq(q), Ot = (q, A, e) => { const t = pq(A) ? A.split(".") : A; let V = 0; for (; V < t.length - 1; ) { if (is(q)) return {}; const r = ss(t[V]); !q[r] && e && (q[r] = new e()), Object.prototype.hasOwnProperty.call(q, r) ? q = q[r] : q = {}, ++V; } return is(q) ? {} : { obj: q, k: ss(t[V]) }; }, ls = (q, A, e) => { const { obj: t, k: V } = Ot(q, A, Object); if (t !== void 0 || A.length === 1) { t[V] = e; return; } let r = A[A.length - 1], n = A.slice(0, A.length - 1), o = Ot(q, n, Object); for (; o.obj === void 0 && n.length; ) r = `${n[n.length - 1]}.${r}`, n = n.slice(0, n.length - 1), o = Ot(q, n, Object), o != null && o.obj && typeof o.obj[`${o.k}.${r}`] < "u" && (o.obj = void 0); o.obj[`${o.k}.${r}`] = e; }, Lp = (q, A, e, t) => { const { obj: V, k: r } = Ot(q, A, Object); V[r] = V[r] || [], V[r].push(e); }, JV = (q, A) => { const { obj: e, k: t } = Ot(q, A); if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t]; }, Fp = (q, A, e) => { const t = JV(q, e); return t !== void 0 ? t : JV(A, e); }, rc = (q, A, e) => { for (const t in A) t !== "__proto__" && t !== "constructor" && (t in q ? pq(q[t]) || q[t] instanceof String || pq(A[t]) || A[t] instanceof String ? e && (q[t] = A[t]) : rc(q[t], A[t], e) : q[t] = A[t]); return q; }, _e = (q) => q.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); var Yp = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "/": "&#x2F;" }; const Kp = (q) => pq(q) ? q.replace(/[&<>"'\/]/g, (A) => Yp[A]) : q; class zp { constructor(A) { this.capacity = A, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = []; } getRegExp(A) { const e = this.regExpMap.get(A); if (e !== void 0) return e; const t = new RegExp(A); return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(A, t), this.regExpQueue.push(A), t; } } const Jp = [" ", ",", "?", "!", ";"], Wp = new zp(20), Zp = (q, A, e) => { A = A || "", e = e || ""; const t = Jp.filter((n) => A.indexOf(n) < 0 && e.indexOf(n) < 0); if (t.length === 0) return !0; const V = Wp.getRegExp(`(${t.map((n) => n === "?" ? "\\?" : n).join("|")})`); let r = !V.test(q); if (!r) { const n = q.indexOf(e); n > 0 && !V.test(q.substring(0, n)) && (r = !0); } return r; }, Co = (q, A, e = ".") => { if (!q) return; if (q[A]) return Object.prototype.hasOwnProperty.call(q, A) ? q[A] : void 0; const t = A.split(e); let V = q; for (let r = 0; r < t.length; ) { if (!V || typeof V != "object") return; let n, o = ""; for (let s = r; s < t.length; ++s) if (s !== r && (o += e), o += t[s], n = V[o], n !== void 0) { if (["string", "number", "boolean"].indexOf(typeof n) > -1 && s < t.length - 1) continue; r += s - r + 1; break; } V = n; } return V; }, Jt = (q) => q == null ? void 0 : q.replace("_", "-"), Hp = { type: "logger", log(q) { this.output("log", q); }, warn(q) { this.output("warn", q); }, error(q) { this.output("error", q); }, output(q, A) { var e, t; (t = (e = console == null ? void 0 : console[q]) == null ? void 0 : e.apply) == null || t.call(e, console, A); } }; class WV { constructor(A, e = {}) { this.init(A, e); } init(A, e = {}) { this.prefix = e.prefix || "i18next:", this.logger = A || Hp, this.options = e, this.debug = e.debug; } log(...A) { return this.forward(A, "log", "", !0); } warn(...A) { return this.forward(A, "warn", "", !0); } error(...A) { return this.forward(A, "error", ""); } deprecate(...A) { return this.forward(A, "warn", "WARNING DEPRECATED: ", !0); } forward(A, e, t, V) { return V && !this.debug ? null : (pq(A[0]) && (A[0] = `${t}${this.prefix} ${A[0]}`), this.logger[e](A)); } create(A) { return new WV(this.logger, { prefix: `${this.prefix}:${A}:`, ...this.options }); } clone(A) { return A = A || this.options, A.prefix = A.prefix || this.prefix, new WV(this.logger, A); } } var WA = new WV(); class Or { constructor() { this.observers = {}; } on(A, e) { return A.split(" ").forEach((t) => { this.observers[t] || (this.observers[t] = /* @__PURE__ */ new Map()); const V = this.observers[t].get(e) || 0; this.observers[t].set(e, V + 1); }), this; } off(A, e) { if (this.observers[A]) { if (!e) { delete this.observers[A]; return; } this.observers[A].delete(e); } } emit(A, ...e) { this.observers[A] && Array.from(this.observers[A].entries()).forEach(([V, r]) => { for (let n = 0; n < r; n++) V(...e); }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([V, r]) => { for (let n = 0; n < r; n++) V.apply(V, [A, ...e]); }); } } class cs extends Or { constructor(A, e = { ns: ["translation"], defaultNS: "translation" }) { super(), this.data = A || {}, this.options = e, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0); } addNamespaces(A) { this.options.ns.indexOf(A) < 0 && this.options.ns.push(A); } removeNamespaces(A) { const e = this.options.ns.indexOf(A); e > -1 && this.options.ns.splice(e, 1); } getResource(A, e, t, V = {}) { var i, c; const r = V.keySeparator !== void 0 ? V.keySeparator : this.options.keySeparator, n = V.ignoreJSONStructure !== void 0 ? V.ignoreJSONStructure : this.options.ignoreJSONStructure; let o; A.indexOf(".") > -1 ? o = A.split(".") : (o = [A, e], t && (Array.isArray(t) ? o.push(...t) : pq(t) && r ? o.push(...t.split(r)) : o.push(t))); const s = JV(this.data, o); return !s && !e && !t && A.indexOf(".") > -1 && (A = o[0], e = o[1], t = o.slice(2).join(".")), s || !n || !pq(t) ? s : Co((c = (i = this.data) == null ? void 0 : i[A]) == null ? void 0 : c[e], t, r); } addResource(A, e, t, V, r = { silent: !1 }) { const n = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator; let o = [A, e]; t && (o = o.concat(n ? t.split(n) : t)), A.indexOf(".") > -1 && (o = A.split("."), V = e, e = o[1]), this.addNamespaces(e), ls(this.data, o, V), r.silent || this.emit("added", A, e, t, V); } addResources(A, e, t, V = { silent: !1 }) { for (const r in t) (pq(t[r]) || Array.isArray(t[r])) && this.addResource(A, e, r, t[r], { silent: !0 }); V.silent || this.emit("added", A, e, t); } addResourceBundle(A, e, t, V, r, n = { silent: !1, skipCopy: !1 }) { let o = [A, e]; A.indexOf(".") > -1 && (o = A.split("."), V = t, t = e, e = o[1]), this.addNamespaces(e); let s = JV(this.data, o) || {}; n.skipCopy || (t = JSON.parse(JSON.stringify(t))), V ? rc(s, t, r) : s = { ...s, ...t }, ls(this.data, o, s), n.silent || this.emit("added", A, e, t); } removeResourceBundle(A, e) { this.hasResourceBundle(A, e) && delete this.data[A][e], this.removeNamespaces(e), this.emit("removed", A, e); } hasResourceBundle(A, e) { return this.getResource(A, e) !== void 0; } getResourceBundle(A, e) { return e || (e = this.options.defaultNS), this.getResource(A, e); } getDataByLanguage(A) { return this.data[A]; } hasLanguageSomeTranslations(A) { const e = this.getDataByLanguage(A); return !!(e && Object.keys(e) || []).find((V) => e[V] && Object.keys(e[V]).length > 0); } toJSON() { return this.data; } } var nc = { processors: {}, addPostProcessor(q) { this.processors[q.name] = q; }, handle(q, A, e, t, V) { return q.forEach((r) => { var n; A = ((n = this.processors[r]) == null ? void 0 : n.process(A, e, t, V)) ?? A; }), A; } }; const us = {}, ds = (q) => !pq(q) && typeof q != "boolean" && typeof q != "number"; class ZV extends Or { constructor(A, e = {}) { super(), jp(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], A, this), this.options = e, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = WA.create("translator"); } changeLanguage(A) { A && (this.language = A); } exists(A, e = { interpolation: {} }) { const t = { ...e }; if (A == null) return !1; const V = this.resolve(A, t); return (V == null ? void 0 : V.res) !== void 0; } extractFromKey(A, e) { let t = e.nsSeparator !== void 0 ? e.nsSeparator : this.options.nsSeparator; t === void 0 && (t = ":"); const V = e.keySeparator !== void 0 ? e.keySeparator : this.options.keySeparator; let r = e.ns || this.options.defaultNS || []; const n = t && A.indexOf(t) > -1, o = !this.options.userDefinedKeySeparator && !e.keySeparator && !this.options.userDefinedNsSeparator && !e.nsSeparator && !Zp(A, t, V); if (n && !o) { const s = A.match(this.interpolator.nestingRegexp); if (s && s.length > 0) return { key: A, namespaces: pq(r) ? [r] : r }; const i = A.split(t); (t !== V || t === V && this.options.ns.indexOf(i[0]) > -1) && (r = i.shift()), A = i.join(V); } return { key: A, namespaces: pq(r) ? [r] : r }; } translate(A, e, t) { let V = typeof e == "object" ? { ...e } : e; if (typeof V != "object" && this.options.overloadTranslationOptionHandler && (V = this.options.overloadTranslationOptionHandler(arguments)), typeof options == "object" && (V = { ...V }), V || (V = {}), A == null) return ""; Array.isArray(A) || (A = [String(A)]); const r = V.returnDetails !== void 0 ? V.returnDetails : this.options.returnDetails, n = V.keySeparator !== void 0 ? V.keySeparator : this.options.keySeparator, { key: o, namespaces: s } = this.extractFromKey(A[A.length - 1], V), i = s[s.length - 1]; let c = V.nsSeparator !== void 0 ? V.nsSeparator : this.options.nsSeparator; c === void 0 && (c = ":"); const a = V.lng || this.language, g = V.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if ((a == null ? void 0 : a.toLowerCase()) === "cimode") return g ? r ? { res: `${i}${c}${o}`, usedKey: o, exactUsedKey: o, usedLng: a, usedNS: i, usedParams: this.getUsedParamsDetails(V) } : `${i}${c}${o}` : r ? { res: o, usedKey: o, exactUsedKey: o, usedLng: a, usedNS: i, usedParams: this.getUsedParamsDetails(V) } : o; const m = this.resolve(A, V); let h = m == null ? void 0 : m.res; const p = (m == null ? void 0 : m.usedKey) || o, E = (m == null ? void 0 : m.exactUsedKey) || o, w = ["[object Number]", "[object Function]", "[object RegExp]"], I = V.joinArrays !== void 0 ? V.joinArrays : this.options.joinArrays, f = !this.i18nFormat || this.i18nFormat.handleAsObject, d = V.count !== void 0 && !pq(V.count), l = ZV.hasDefaultValue(V), y = d ? this.pluralResolver.getSuffix(a, V.count, V) : "", v = V.ordinal && d ? this.pluralResolver.getSuffix(a, V.count, { ordinal: !1 }) : "", B = d && !V.ordinal && V.count === 0, k = B && V[`defaultValue${this.options.pluralSeparator}zero`] || V[`defaultValue${y}`] || V[`defaultValue${v}`] || V.defaultValue; let U = h; f && !h && l && (U = k); const R = ds(U), G = Object.prototype.toString.apply(U); if (f && U && R && w.indexOf(G) < 0 && !(pq(I) && Array.isArray(U))) { if (!V.returnObjects && !this.options.returnObjects) { this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"); const P = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, U, { ...V, ns: s }) : `key '${o} (${this.language})' returned an object instead of string.`; return r ? (m.res = P, m.usedParams = this.getUsedParamsDetails(V), m) : P; } if (n) { const P = Array.isArray(U), Q = P ? [] : {}, S = P ? E : p; for (const T in U) if (Object.prototype.hasOwnProperty.call(U, T)) { const W = `${S}${n}${T}`; l && !h ? Q[T] = this.translate(W, { ...V, defaultValue: ds(k) ? k[T] : void 0, joinArrays: !1, ns: s }) : Q[T] = this.translate(W, { ...V, joinArrays: !1, ns: s }), Q[T] === W && (Q[T] = U[T]); } h = Q; } } else if (f && pq(I) && Array.isArray(h)) h = h.join(I), h && (h = this.extendTranslation(h, A, V, t)); else { let P = !1, Q = !1; !this.isValidLookup(h) && l && (P = !0, h = k), this.isValidLookup(h) || (Q = !0, h = o); const T = (V.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && Q ? void 0 : h, W = l && k !== h && this.options.updateMissing; if (Q || P || W) { if (this.logger.log(W ? "updateKey" : "missingKey", a, i, o, W ? k : h), n) { const x = this.resolve(o, { ...V, keySeparator: !1 }); x && x.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 j = []; const O = this.languageUtils.getFallbackCodes(this.options.fallbackLng, V.lng || this.language); if (this.options.saveMissingTo === "fallback" && O && O[0]) for (let x = 0; x < O.length; x++) j.push(O[x]); else this.options.saveMissingTo === "all" ? j = this.languageUtils.toResolveHierarchy(V.lng || this.language) : j.push(V.lng || this.language); const M = (x, L, K) => { var Z; const X = l && K !== h ? K : T; this.options.missingKeyHandler ? this.options.missingKeyHandler(x, i, L, X, W, V) : (Z = this.backendConnector) != null && Z.saveMissing && this.backendConnector.saveMissing(x, i, L, X, W, V), this.emit("missingKey", x, i, L, h); }; this.options.saveMissing && (this.options.saveMissingPlurals && d ? j.forEach((x) => { const L = this.pluralResolver.getSuffixes(x, V); B && V[`defaultValue${this.options.pluralSeparator}zero`] && L.indexOf(`${this.options.pluralSeparator}zero`) < 0 && L.push(`${this.options.pluralSeparator}zero`), L.forEach((K) => { M([x], o + K, V[`defaultValue${K}`] || k); }); }) : M(j, o, k)); } h = this.extendTranslation(h, A, V, m, t), Q && h === o && this.options.appendNamespaceToMissingKey && (h = `${i}${c}${o}`), (Q || P) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${i}${c}${o}` : o, P ? h : void 0, V)); } return r ? (m.res = h, m.usedParams = this.getUsedParamsDetails(V), m) : h; } extendTranslation(A, e, t, V, r) { var s, i; if ((s = this.i18nFormat) != null && s.parse) A = this.i18nFormat.parse(A, { ...this.options.interpolation.defaultVariables, ...t }, t.lng || this.language || V.usedLng, V.usedNS, V.usedKey, { resolved: V }); else if (!t.skipInterpolation) { t.interpolation && this.interpolator.init({ ...t, interpolation: { ...this.options.interpolation, ...t.interpolation } }); const c = pq(A) && (((i = t == null ? void 0 : t.interpolation) == null ? void 0 : i.skipOnVariables) !== void 0 ? t.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); let a; if (c) { const m = A.match(this.interpolator.nestingRegexp); a = m && m.length; } let g = t.replace && !pq(t.replace) ? t.replace : t; if (this.options.interpolation.defaultVariables && (g = { ...this.options.interpolation.defaultVariables, ...g }), A = this.interpolator.interpolate(A, g, t.lng || this.language || V.usedLng, t), c) { const m = A.match(this.interpolator.nestingRegexp), h = m && m.length; a < h && (t.nest = !1); } !t.lng && V && V.res && (t.lng = this.language || V.usedLng), t.nest !== !1 && (A = this.interpolator.nest(A, (...m) => (r == null ? void 0 : r[0]) === m[0] && !t.context ? (this.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${e[0]}`), null) : this.translate(...m, e), t)), t.interpolation && this.interpolator.reset(); } const n = t.postProcess || this.options.postProcess, o = pq(n) ? [n] : n; return A != null && (o != null && o.length) && t.applyPostProcessor !== !1 && (A = nc.handle(o, A, e, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...V, usedParams: this.getUsedParamsDetails(t) }, ...t } : t, this)), A; } resolve(A, e = {}) { let t, V, r, n, o; return pq(A) && (A = [A]), A.forEach((s) => { if (this.isValidLookup(t)) return; const i = this.extractFromKey(s, e), c = i.key; V = c; let a = i.namespaces; this.options.fallbackNS && (a = a.concat(this.options.fallbackNS)); const g = e.count !== void 0 && !pq(e.count), m = g && !e.ordinal && e.count === 0, h = e.context !== void 0 && (pq(e.context) || typeof e.context == "number") && e.context !== "", p = e.lngs ? e.lngs : this.languageUtils.toResolveHierarchy(e.lng || this.language, e.fallbackLng); a.forEach((E) => { var w, I; this.isValidLookup(t) || (o = E, !us[`${p[0]}-${E}`] && ((w = this.utils) != null && w.hasLoadedNamespace) && !((I = this.utils) != null && I.hasLoadedNamespace(o)) && (us[`${p[0]}-${E}`] = !0, this.logger.warn(`key "${V}" for languages "${p.join(", ")}" won't get resolved as namespace "${o}" 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!!!")), p.forEach((f) => { var y; if (this.isValidLookup(t)) return; n = f; const d = [c]; if ((y = this.i18nFormat) != null && y.addLookupKeys) this.i18nFormat.addLookupKeys(d, c, f, E, e); else { let v; g && (v = this.pluralResolver.getSuffix(f, e.count, e)); const B = `${this.options.pluralSeparator}zero`, k = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (g && (d.push(c + v), e.ordinal && v.indexOf(k) === 0 && d.push(c + v.replace(k, this.options.pluralSeparator)), m && d.push(c + B)), h) { const U = `${c}${this.options.contextSeparator}${e.context}`; d.push(U), g && (d.push(U + v), e.ordinal && v.indexOf(k) === 0 && d.push(U + v.replace(k, this.options.pluralSeparator)), m && d.push(U + B)); } } let l; for (; l = d.pop(); ) this.isValidLookup(t) || (r = l, t = this.getResource(f, E, l, e)); })); }); }), { res: t, usedKey: V, exactUsedKey: r, usedLng: n, usedNS: o }; } isValidLookup(A) { return A !== void 0 && !(!this.options.returnNull && A === null) && !(!this.options.returnEmptyString && A === ""); } getResource(A, e, t, V = {}) { var r; return (r = this.i18nFormat) != null && r.getResource ? this.i18nFormat.getResource(A, e, t, V) : this.resourceStore.getResource(A, e, t, V); } getUsedParamsDetails(A = {}) { const e = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], t = A.replace && !pq(A.replace); let V = t ? A.replace : A; if (t && typeof A.count < "u" && (V.count = A.count), this.options.interpolation.defaultVariables && (V = { ...this.options.interpolation.defaultVariables, ...V }), !t) { V = { ...V }; for (const r of e) delete V[r]; } return V; } static hasDefaultValue(A) { const e = "defaultValue"; for (const t in A) if (Object.prototype.hasOwnProperty.call(A, t) && e === t.substring(0, e.length) && A[t] !== void 0) return !0; return !1; } } class gs { constructor(A) { this.options = A, this.supportedLngs = this.options.supportedLngs || !1, this.logger = WA.create("languageUtils"); } getScriptPartFromCode(A) { if (A = Jt(A), !A || A.indexOf("-") < 0) return null; const e = A.split("-"); return e.length === 2 || (e.pop(), e[e.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(e.join("-")); } getLanguagePartFromCode(A) { if (A = Jt(A), !A || A.indexOf("-") < 0) return A; const e = A.split("-"); return this.formatLanguageCode(e[0]); } formatLanguageCode(A) { if (pq(A) && A.indexOf("-") > -1) { let e; try { e = Intl.getCanonicalLocales(A)[0]; } catch { } return e && this.options.lowerCaseLng && (e = e.toLowerCase()), e || (this.options.lowerCaseLng ? A.toLowerCase() : A); } return this.options.cleanCode || this.options.lowerCaseLng ? A.toLowerCase() : A; } isSupportedCode(A) { return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (A = this.getLanguagePartFromCode(A)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(A) > -1; } getBestMatchFromCodes(A) { if (!A) return null; let e; return A.forEach((t) => { if (e) return; const V = this.formatLanguageCode(t); (!this.options.supportedLngs || this.isSupportedCode(V)) && (e = V); }), !e && this.options.supportedLngs && A.forEach((t) => { if (e) return; const V = this.getScriptPartFromCode(t); if (this.isSupportedCode(V)) return e = V; const r = this.getLanguagePartFromCode(t); if (this.isSupportedCode(r)) return e = r; e = this.options.supportedLngs.find((n) => { if (n === r) return n; if (!(n.indexOf("-") < 0 && r.indexOf("-") < 0) && (n.indexOf("-") > 0 && r.indexOf("-") < 0 && n.substring(0, n.indexOf("-")) === r || n.indexOf(r) === 0 && r.length > 1)) return n; }); }), e || (e = this.getFallbackCodes(this.options.fallbackLng)[0]), e; } getFallbackCodes(A, e) { if (!A) return []; if (typeof A == "function" && (A = A(e)), pq(A) && (A = [A]), Array.isArray(A)) return A; if (!e) return A.default || []; let t = A[e]; return t || (t = A[this.getScriptPartFromCode(e)]), t || (t = A[this.formatLanguageCode(e)]), t || (t = A[this.getLanguagePartFromCode(e)]), t || (t = A.default), t || []; } toResolveHierarchy(A, e) { const t = this.getFallbackCodes((e === !1 ? [] : e) || this.options.fallbackLng || [], A), V = [], r = (n) => { n && (this.isSupportedCode(n) ? V.push(n) : this.logger.warn(`rejecting language code not found in supportedLngs: ${n}`)); }; return pq(A) && (A.indexOf("-") > -1 || A.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && r(this.formatLanguageCode(A)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && r(this.getScriptPartFromCode(A)), this.options.load !== "currentOnly" && r(this.getLanguagePartFromCode(A))) : pq(A) && r(this.formatLanguageCode(A)), t.forEach((n) => { V.indexOf(n) < 0 && r(this.formatLanguageCode(n)); }), V; } } const ps = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }, fs = { select: (q) => q === 1 ? "one" : "other", resolvedOptions: () => ({ pluralCategories: ["one", "other"] }) }; class Xp { constructor(A, e = {}) { this.languageUtils = A, this.options = e, this.logger = WA.create("pluralResolver"), this.pluralRulesCache = {}; } addRule(A, e) { this.rules[A] = e; } clearCache() { this.pluralRulesCache = {}; } getRule(A, e = {}) { const t = Jt(A === "dev" ? "en" : A), V = e.ordinal ? "ordinal" : "cardinal", r = JSON.stringify({ cleanedCode: t, type: V }); if (r in this.pluralRulesCache) return this.pluralRulesCache[r]; let n; try { n = new Intl.PluralRules(t, { type: V }); } catch { if (!Intl) return this.logger.error("No Intl support, please use an Intl polyfill!"), fs; if (!A.match(/-|_/)) return fs; const s = this.languageUtils.getLanguagePartFromCode(A); n = this.getRule(s, e); } return this.pluralRulesCache[r] = n, n; } needsPlural(A, e = {}) { let t = this.getRule(A, e); return t || (t = this.getRule("dev", e)), (t == null ? void 0 : t.resolvedOptions().pluralCategories.length) > 1; } getPluralFormsOfKey(A, e, t = {}) { return this.getSuffixes(A, t).map((V) => `${e}${V}`); } getSuffixes(A, e = {}) { let t = this.getRule(A, e); return t || (t = this.getRule("dev", e)), t ? t.resolvedOptions().pluralCategories.sort((V, r) => ps[V] - ps[r]).map((V) => `${this.options.prepend}${e.ordinal ? `ordinal${this.options.prepend}` : ""}${V}`) : []; } getSuffix(A, e, t = {}) { const V = this.getRule(A, t); return V ? `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${V.select(e)}` : (this.logger.warn(`no plural rule found for: ${A}`), this.getSuffix("dev", e, t)); } } const hs = (q, A, e, t = ".", V = !0) => { let r = Fp(q, A, e); return !r && V && pq(e) && (r = Co(q, e, t), r === void 0 && (r = Co(A, e, t))), r; }, mn = (q) => q.replace(/\$/g, "$$$$"); class _p { constructor(A = {}) { var e; this.logger = WA.create("interpolator"), this.options = A, this.format = ((e = A == null ? void 0 : A.interpolation) == null ? void 0 : e.format) || ((t) => t), this.init(A); } init(A = {}) { A.interpolation || (A.interpolation = { escapeValue: !0 }); const { escape: e, escapeValue: t, useRawValueToEscape: V, prefix: r, prefixEscaped: n, suffix: o, suffixEscaped: s, formatSeparator: i, unescapeSuffix: c, unescapePrefix: a, nestingPrefix: g, nestingPrefixEscaped: m, nestingSuffix: h, nestingSuffixEscaped: p, nestingOptionsSeparator: E, maxReplaces: w, alwaysFormat: I } = A.interpolation; this.escape = e !== void 0 ? e : Kp, this.escapeValue = t !== void 0 ? t : !0, this.useRawValueToEscape = V !== void 0 ? V : !1, this.prefix = r ? _e(r) : n || "{{", this.suffix = o ? _e(o) : s || "}}", this.formatSeparator = i || ",", this.unescapePrefix = c ? "" : a || "-", this.unescapeSuffix = this.unescapePrefix ? "" : c || "", this.nestingPrefix = g ? _e(g) : m || _e("$t("), this.nestingSuffix = h ? _e(h) : p || _e(")"), this.nestingOptionsSeparator = E || ",", this.maxReplaces = w || 1e3, this.alwaysFormat = I !== void 0 ? I : !1, this.resetRegExp(); } reset() { this.options && this.init(this.options); } resetRegExp() { const A = (e, t) => (e == null ? void 0 : e.source) === t ? (e.lastIndex = 0, e) : new RegExp(t, "g"); this.regexp = A(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = A(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = A(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`); } interpolate(A, e, t, V) { var m; let r, n, o; const s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, i = (h) => { if (h.indexOf(this.formatSeparator) < 0) { const I = hs(e, s, h, this.options.keySeparator, this.options.ignoreJSONStructure); return this.alwaysFormat ? this.format(I, void 0, t, { ...V, ...e, interpolationkey: h }) : I; } const p = h.split(this.formatSeparator), E = p.shift().trim(), w = p.join(this.formatSeparator).trim(); return this.format(hs(e, s, E, this.options.keySeparator, this.options.ignoreJSONStructure), w, t, { ...V, ...e, interpolationkey: E }); }; this.resetRegExp(); const c = (V == null ? void 0 : V.missingInterpolationHandler) || this.options.missingInterpolationHandler, a = ((m = V == null ? void 0 : V.interpolation) == null ? void 0 : m.skipOnVariables) !== void 0 ? V.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables; return [{ regex: this.regexpUnescape, safeValue: (h) => mn(h) }, { regex: this.regexp, safeValue: (h) => this.escapeValue ? mn(this.escape(h)) : mn(h) }].forEach((h) => { for (o = 0; r = h.regex.exec(A); ) { const p = r[1].trim(); if (n = i(p), n === void 0) if (typeof c == "function") { const w = c(A, r, V); n = pq(w) ? w : ""; } else if (V && Object.prototype.hasOwnProperty.call(V, p)) n = ""; else if (a) { n = r[0]; continue; } else this.logger.warn(`missed to pass in variable ${p} for interpolating ${A}`), n = ""; else !pq(n) && !this.useRawValueToEscape && (n = as(n)); const E = h.safeValue(n); if (A = A.replace(r[0], E), a ? (h.regex.lastIndex += n.length, h.regex.lastIndex -= r[0].length) : h.regex.lastIndex = 0, o++, o >= this.maxReplaces) break; } }), A; } nest(A, e, t = {}) { let V, r, n; const o = (s, i) => { const c = this.nestingOptionsSeparator; if (s.indexOf(c) < 0) return s; const a = s.split(new RegExp(`${c}[ ]*{`)); let g = `{${a[1]}`; s = a[0], g = this.interpolate(g, n); const m = g.match(/'/g), h = g.match(/"/g); (((m == null ? void 0 : m.length) ?? 0) % 2 === 0 && !h || h.length % 2 !== 0) && (g = g.replace(/'/g, '"')); try { n = JSON.parse(g), i && (n = { ...i, ...n }); } catch (p) { return this.logger.warn(`failed parsing options string in nesting for key ${s}`, p), `${s}${c}${g}`; } return n.defaultValue && n.defaultValue.indexOf(this.prefix) > -1 && delete n.defaultValue, s; }; for (; V = this.nestingRegexp.exec(A); ) { let s = []; n = { ...t }, n = n.replace && !pq(n.replace) ? n.replace : n, n.applyPostProcessor = !1, delete n.defaultValue; let i = !1; if (V[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(V[1])) { const c = V[1].split(this.formatSeparator).map((a) => a.trim()); V[1] = c.shift(), s = c, i = !0; } if (r = e(o.call(this, V[1].trim(), n), n), r && V[0] === A && !pq(r)) return r; pq(r) || (r = as(r)), r || (this.logger.warn(`missed to resolve ${V[1]} for nesting ${A}`), r = ""), i && (r = s.reduce((c, a) => this.format(c, a, t.lng, { ...t, interpolationkey: V[1].trim() }), r.trim())), A = A.replace(V[0], r), this.regexp.lastIndex = 0; } return A; } } const $p = (q) => { let A = q.toLowerCase().trim(); const e = {}; if (q.indexOf("(") > -1) { const t = q.split("("); A = t[0].toLowerCase().trim(); const V = t[1].substring(0, t[1].length - 1); A === "currency" && V.indexOf(":") < 0 ? e.currency || (e.currency = V.trim()) : A === "relativetime" && V.indexOf(":") < 0 ? e.range || (e.range = V.trim()) : V.split(";").forEach((n) => { if (n) { const [o, ...s] = n.split(":"), i = s.join(":").trim().replace(/^'+|'+$/g, ""), c = o.trim(); e[c] || (e[c] = i), i === "false" && (e[c] = !1), i === "true" && (e[c] = !0), isNaN(i) || (e[c] = parseInt(i, 10)); } }); } return { formatName: A, formatOptions: e }; }, ms = (q) => { const A = {}; return (e, t, V) => { let r = V; V && V.interpolationkey && V.formatParams && V.formatParams[V.interpolationkey] && V[V.interpolationkey] && (r = { ...r, [V.interpolationkey]: void 0 }); const n = t + JSON.stringify(r); let o = A[n]; return o || (o = q(Jt(t), V), A[n] = o), o(e); }; }, qf = (q) => (A, e, t) => q(Jt(e), t)(A); class Af { constructor(A = {}) { this.logger = WA.create("formatter"), this.options = A, this.init(A); } init(A, e = { interpolation: {} }) { this.formatSeparator = e.interpolation.formatSeparator || ","; const t = e.cacheInBuiltFormats ? ms : qf; this.formats = { number: t((V, r) => { const n = new Intl.NumberFormat(V, { ...r }); return (o) => n.format(o); }), currency: t((V, r) => { const n = new Intl.NumberFormat(V, { ...r, style: "currency" }); return (o) => n.format(o); }), datetime: t((V, r) => { const n = new Intl.DateTimeFormat(V, { ...r }); return (o) => n.format(o); }), relativetime: t((V, r) => { const n = new Intl.RelativeTimeFormat(V, { ...r }); return (o) => n.format(o, r.range || "day"); }), list: t((V, r) => { const n = new Intl.ListFormat(V, { ...r }); return (o) => n.format(o); }) }; } add(A, e) { this.formats[A.toLowerCase().trim()] = e; } addCached(A, e) { this.formats[A.toLowerCase().trim()] = ms(e); } format(A, e, t, V = {}) { const r = e.split(this.formatSeparator); if (r.length > 1 && r[0].indexOf("(") > 1 && r[0].indexOf(")") < 0 && r.find((o) => o.indexOf(")") > -1)) { const o = r.findIndex((s) => s.indexOf(")") > -1); r[0] = [r[0], ...r.splice(1, o)].join(this.formatSeparator); } return r.reduce((o, s) => { var a; const { formatName: i, formatOptions: c } = $p(s); if (this.formats[i]) { let g = o; try { const m = ((a = V == null ? void 0 : V.formatParams) == null ? void 0 : a[V.interpolationkey]) || {}, h = m.locale || m.lng || V.locale || V.lng || t; g = this.formats[i](o, h, { ...c, ...V, ...m }); } catch (m) { this.logger.warn(m); } return g; } else this.logger.warn(`there was no format function for ${i}`); return o; }, A); } } const ef = (q, A) => { q.pending[A] !== void 0 && (delete q.pending[A], q.pendingCount--); }; class tf extends Or { constructor(A, e, t, V = {}) { var r, n; super(), this.backend = A, this.store = e, this.services = t, this.languageUtils = t.languageUtils, this.options = V, this.logger = WA.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = V.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = V.maxRetries >= 0 ? V.maxRetries : 5, this.retryTimeout = V.retryTimeout >= 1 ? V.retryTimeout : 350, this.state = {}, this.queue = [], (n = (r = this.backend) == null ? void 0 : r.init) == null || n.call(r, t, V.backend, V); } queueLoad(A, e, t, V) { const r = {}, n = {}, o = {}, s = {}; return A.forEach((i) => { let c = !0; e.forEach((a) => { const g = `${i}|${a}`; !t.reload && this.store.hasResourceBundle(i, a) ? this.state[g] = 2 : this.state[g] < 0 || (this.state[g] === 1 ? n[g] === void 0 && (n[g] = !0) : (this.state[g] = 1, c = !1, n[g] === void 0 && (n[g] = !0), r[g] === void 0 && (r[g] = !0), s[a] === void 0 && (s[a] = !0))); }), c || (o[i] = !0); }), (Object.keys(r).length || Object.keys(n).length) && this.queue.push({ pending: n, pendingCount: Object.keys(n).length, loaded: {}, errors: [], callback: V }), { toLoad: Object.keys(r), pending: Object.keys(n), toLoadLanguages: Object.keys(o), toLoadNamespaces: Object.keys(s) }; } loaded(A, e, t) { const V = A.split("|"), r = V[0], n = V[1]; e && this.emit("failedLoading", r, n, e), !e && t && this.store.addResourceBundle(r, n, t, void 0, void 0, { skipCopy: !0 }), this.state[A] = e ? -1 : 2, e && t && (this.state[A] = 0); const o = {}; this.queue.forEach((s) => { Lp(s.loaded, [r], n), ef(s, A), e && s.errors.push(e), s.pendingCount === 0 && !s.done && (Object.keys(s.loaded).forEach((i) => { o[i] || (o[i] = {}); const c = s.loaded[i]; c.length && c.forEach((a) => { o[i][a] === void 0 && (o[i][a] = !0); }); }), s.done = !0, s.errors.length ? s.callback(s.errors) : s.callback()); }), this.emit("loaded", o), this.queue = this.queue.filter((s) => !s.done); } read(A, e, t, V = 0, r = this.retryTimeout, n) { if (!A.length) return n(null, {}); if (this.readingCalls >= this.maxParallelReads) { this.waitingReads.push({ lng: A, ns: e, fcName: t, tried: V, wait: r, callback: n }); return; } this.readingCalls++; const o = (i, c) => { if (this.readingCalls--, this.waitingReads.length > 0) { const a = this.waitingReads.shift(); this.read(a.lng, a.ns, a.fcName, a.tried, a.wait, a.callback); } if (i && c && V < this.maxRetries) { setTimeout(() => { this.read.call(this, A, e, t, V + 1, r * 2, n); }, r); return; } n(i, c); }, s = this.backend[t].bind(this.backend); if (s.length === 2) { try { const i = s(A, e); i && typeof i.then == "function" ? i.then((c) => o(null, c)).catch(o) : o(null, i); } catch (i) { o(i); } return; } return s(A, e, o); } prepareLoading(A, e, t = {}, V) { if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), V && V(); pq(A) && (A = this.languageUtils.toResolveHierarchy(A)), pq(e) && (e = [e]); const r = this.queueLoad(A, e, t, V); if (!r.toLoad.length) return r.pending.length || V(), null; r.toLoad.forEach((n) => { this.loadOne(n); }); } load(A, e, t) { this.prepareLoading(A, e, {}, t); } reload(A, e, t) { this.prepareLoading(A, e, { reload: !0 }, t); } loadOne(A, e = "") { const t = A.split("|"), V = t[0], r = t[1]; this.read(V, r, "read", void 0, void 0, (n, o) => {