@dbp-topics/library
Version:
[GitLab Repository](https://gitlab.tugraz.at/dbp/library/library) | [npmjs package](https://www.npmjs.com/package/@dbp-topics/library) | [Unpkg CDN](https://unpkg.com/browse/@dbp-topics/library/)
1,492 lines (1,345 loc) • 156 kB
JavaScript
let _2 = t => t,
_t12,
_t13,
_t14,
_t15,
_t16,
_t17,
_t18,
_t19,
_t20,
_t21,
_t22,
_t23,
_t24,
_t25,
_t26,
_t27,
_t28,
_t29;
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/*!
* License: LGPL-2.1-or-later
* Dependencies:
*
* @dbp-toolkit/common: LGPL-2.1-or-later
* jquery: MIT
* select2: MIT
* @dbp-toolkit/organization-select: LGPL-2.1-or-later
* @babel/runtime: MIT
* i18next: MIT
* @lit/reactive-element: BSD-3-Clause
* lit-html: BSD-3-Clause
* lit-element: BSD-3-Clause
* @open-wc/dedupe-mixin: MIT
* @open-wc/scoped-elements: MIT
*/
function e(t) {
return e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
return typeof e;
} : function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, e(t);
}
function t(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
}
function r(e, t) {
for (var r = 0; r < t.length; r++) {
var n = t[r];
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
}
}
function n(e, t, n) {
return t && r(e.prototype, t), n && r(e, n), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
function o(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
function i(e, t) {
return i = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t, e;
}, i(e, t);
}
function s(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}), Object.defineProperty(e, "prototype", {
writable: !1
}), t && i(e, t);
}
function a(t, r) {
if (r && ("object" === e(r) || "function" == typeof r)) return r;
if (void 0 !== r) throw new TypeError("Derived constructors may only return object or undefined");
return o(t);
}
function c(e) {
return c = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, c(e);
}
function l(e, t, r) {
return t in e ? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = r, e;
}
function d(e, t) {
(null == t || t > e.length) && (t = e.length);
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
return n;
}
function u(e) {
return function (e) {
if (Array.isArray(e)) return e;
}(e) || function (e) {
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
}(e) || function (e, t) {
if (e) {
if ("string" == typeof e) return d(e, t);
var r = Object.prototype.toString.call(e).slice(8, -1);
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? d(e, t) : void 0;
}
}(e) || function () {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}();
}
function p(e, t) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
t && (n = n.filter(function (t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function h(e) {
for (var t = 1; t < arguments.length; t++) {
var r = null != arguments[t] ? arguments[t] : {};
t % 2 ? p(Object(r), !0).forEach(function (t) {
l(e, t, r[t]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : p(Object(r)).forEach(function (t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
});
}
return e;
}
var f = {
type: "logger",
log: function (e) {
this.output("log", e);
},
warn: function (e) {
this.output("warn", e);
},
error: function (e) {
this.output("error", e);
},
output: function (e, t) {
console && console[e] && console[e].apply(console, t);
}
},
g = function () {
function e(r) {
var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
t(this, e), this.init(r, n);
}
return n(e, [{
key: "init",
value: function (e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
this.prefix = t.prefix || "i18next:", this.logger = e || f, this.options = t, this.debug = t.debug;
}
}, {
key: "setDebug",
value: function (e) {
this.debug = e;
}
}, {
key: "log",
value: function () {
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
return this.forward(t, "log", "", !0);
}
}, {
key: "warn",
value: function () {
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
return this.forward(t, "warn", "", !0);
}
}, {
key: "error",
value: function () {
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
return this.forward(t, "error", "");
}
}, {
key: "deprecate",
value: function () {
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
}
}, {
key: "forward",
value: function (e, t, r, n) {
return n && !this.debug ? null : ("string" == typeof e[0] && (e[0] = "".concat(r).concat(this.prefix, " ").concat(e[0])), this.logger[t](e));
}
}, {
key: "create",
value: function (t) {
return new e(this.logger, h(h({}, {
prefix: "".concat(this.prefix, ":").concat(t, ":")
}), this.options));
}
}]), e;
}(),
b = new g(),
v = function () {
function e() {
t(this, e), this.observers = {};
}
return n(e, [{
key: "on",
value: function (e, t) {
var r = this;
return e.split(" ").forEach(function (e) {
r.observers[e] = r.observers[e] || [], r.observers[e].push(t);
}), this;
}
}, {
key: "off",
value: function (e, t) {
this.observers[e] && (t ? this.observers[e] = this.observers[e].filter(function (e) {
return e !== t;
}) : delete this.observers[e]);
}
}, {
key: "emit",
value: function (e) {
for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++) r[n - 1] = arguments[n];
if (this.observers[e]) {
var o = [].concat(this.observers[e]);
o.forEach(function (e) {
e.apply(void 0, r);
});
}
if (this.observers["*"]) {
var i = [].concat(this.observers["*"]);
i.forEach(function (t) {
t.apply(t, [e].concat(r));
});
}
}
}]), e;
}();
function m() {
var e,
t,
r = new Promise(function (r, n) {
e = r, t = n;
});
return r.resolve = e, r.reject = t, r;
}
function y(e) {
return null == e ? "" : "" + e;
}
function w(e, t, r) {
e.forEach(function (e) {
t[e] && (r[e] = t[e]);
});
}
function k(e, t, r) {
function n(e) {
return e && e.indexOf("###") > -1 ? e.replace(/###/g, ".") : e;
}
function o() {
return !e || "string" == typeof e;
}
for (var i = "string" != typeof t ? [].concat(t) : t.split("."); i.length > 1;) {
if (o()) return {};
var s = n(i.shift());
!e[s] && r && (e[s] = new r()), e = Object.prototype.hasOwnProperty.call(e, s) ? e[s] : {};
}
return o() ? {} : {
obj: e,
k: n(i.shift())
};
}
function x(e, t, r) {
var n = k(e, t, Object);
n.obj[n.k] = r;
}
function O(e, t) {
var r = k(e, t),
n = r.obj,
o = r.k;
if (n) return n[o];
}
function S(e, t, r) {
var n = O(e, r);
return void 0 !== n ? n : O(t, r);
}
function E(e, t, r) {
for (var n in t) "__proto__" !== n && "constructor" !== n && (n in e ? "string" == typeof e[n] || e[n] instanceof String || "string" == typeof t[n] || t[n] instanceof String ? r && (e[n] = t[n]) : E(e[n], t[n], r) : e[n] = t[n]);
return e;
}
function A(e) {
return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
var C = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"/": "/"
};
function P(e) {
return "string" == typeof e ? e.replace(/[&<>"'\/]/g, function (e) {
return C[e];
}) : e;
}
var _ = "undefined" != typeof window && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf("MSIE") > -1,
$ = [" ", ",", "?", "!", ";"];
function j(e, t) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
t && (n = n.filter(function (t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function L(e) {
for (var t = 1; t < arguments.length; t++) {
var r = null != arguments[t] ? arguments[t] : {};
t % 2 ? j(Object(r), !0).forEach(function (t) {
l(e, t, r[t]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : j(Object(r)).forEach(function (t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
});
}
return e;
}
function N(e) {
var t = function () {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
} catch (e) {
return !1;
}
}();
return function () {
var r,
n = c(e);
if (t) {
var o = c(this).constructor;
r = Reflect.construct(n, arguments, o);
} else r = n.apply(this, arguments);
return a(this, r);
};
}
function R(e, t) {
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ".";
if (e) {
if (e[t]) return e[t];
for (var n = t.split(r), o = e, i = 0; i < n.length; ++i) {
if (!o) return;
if ("string" == typeof o[n[i]] && i + 1 < n.length) return;
if (void 0 === o[n[i]]) {
for (var s = 2, a = n.slice(i, i + s).join(r), c = o[a]; void 0 === c && n.length > i + s;) s++, c = o[a = n.slice(i, i + s).join(r)];
if (void 0 === c) return;
if (t.endsWith(a)) {
if ("string" == typeof c) return c;
if (a && "string" == typeof c[a]) return c[a];
}
var l = n.slice(i + s).join(r);
return l ? R(c, l, r) : void 0;
}
o = o[n[i]];
}
return o;
}
}
var D = function (e) {
s(i, v);
var r = N(i);
function i(e) {
var n,
s = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
ns: ["translation"],
defaultNS: "translation"
};
return t(this, i), n = r.call(this), _ && v.call(o(n)), n.data = e || {}, n.options = s, void 0 === n.options.keySeparator && (n.options.keySeparator = "."), void 0 === n.options.ignoreJSONStructure && (n.options.ignoreJSONStructure = !0), n;
}
return n(i, [{
key: "addNamespaces",
value: function (e) {
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
}
}, {
key: "removeNamespaces",
value: function (e) {
var t = this.options.ns.indexOf(e);
t > -1 && this.options.ns.splice(t, 1);
}
}, {
key: "getResource",
value: function (e, t, r) {
var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},
o = void 0 !== n.keySeparator ? n.keySeparator : this.options.keySeparator,
i = void 0 !== n.ignoreJSONStructure ? n.ignoreJSONStructure : this.options.ignoreJSONStructure,
s = [e, t];
r && "string" != typeof r && (s = s.concat(r)), r && "string" == typeof r && (s = s.concat(o ? r.split(o) : r)), e.indexOf(".") > -1 && (s = e.split("."));
var a = O(this.data, s);
return a || !i || "string" != typeof r ? a : R(this.data && this.data[e] && this.data[e][t], r, o);
}
}, {
key: "addResource",
value: function (e, t, r, n) {
var o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {
silent: !1
},
i = this.options.keySeparator;
void 0 === i && (i = ".");
var s = [e, t];
r && (s = s.concat(i ? r.split(i) : r)), e.indexOf(".") > -1 && (n = t, t = (s = e.split("."))[1]), this.addNamespaces(t), x(this.data, s, n), o.silent || this.emit("added", e, t, r, n);
}
}, {
key: "addResources",
value: function (e, t, r) {
var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {
silent: !1
};
for (var o in r) "string" != typeof r[o] && "[object Array]" !== Object.prototype.toString.apply(r[o]) || this.addResource(e, t, o, r[o], {
silent: !0
});
n.silent || this.emit("added", e, t, r);
}
}, {
key: "addResourceBundle",
value: function (e, t, r, n, o) {
var i = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : {
silent: !1
},
s = [e, t];
e.indexOf(".") > -1 && (n = r, r = t, t = (s = e.split("."))[1]), this.addNamespaces(t);
var a = O(this.data, s) || {};
n ? E(a, r, o) : a = L(L({}, a), r), x(this.data, s, a), i.silent || this.emit("added", e, t, r);
}
}, {
key: "removeResourceBundle",
value: function (e, t) {
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
}
}, {
key: "hasResourceBundle",
value: function (e, t) {
return void 0 !== this.getResource(e, t);
}
}, {
key: "getResourceBundle",
value: function (e, t) {
return t || (t = this.options.defaultNS), "v1" === this.options.compatibilityAPI ? L(L({}, {}), this.getResource(e, t)) : this.getResource(e, t);
}
}, {
key: "getDataByLanguage",
value: function (e) {
return this.data[e];
}
}, {
key: "hasLanguageSomeTranslations",
value: function (e) {
var t = this.getDataByLanguage(e);
return !!(t && Object.keys(t) || []).find(function (e) {
return t[e] && Object.keys(t[e]).length > 0;
});
}
}, {
key: "toJSON",
value: function () {
return this.data;
}
}]), i;
}(),
F = {
processors: {},
addPostProcessor: function (e) {
this.processors[e.name] = e;
},
handle: function (e, t, r, n, o) {
var i = this;
return e.forEach(function (e) {
i.processors[e] && (t = i.processors[e].process(t, r, n, o));
}), t;
}
};
function T(e, t) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
t && (n = n.filter(function (t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function U(e) {
for (var t = 1; t < arguments.length; t++) {
var r = null != arguments[t] ? arguments[t] : {};
t % 2 ? T(Object(r), !0).forEach(function (t) {
l(e, t, r[t]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : T(Object(r)).forEach(function (t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
});
}
return e;
}
function I(e) {
var t = function () {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
} catch (e) {
return !1;
}
}();
return function () {
var r,
n = c(e);
if (t) {
var o = c(this).constructor;
r = Reflect.construct(n, arguments, o);
} else r = n.apply(this, arguments);
return a(this, r);
};
}
var z = {},
M = function (r) {
s(a, v);
var i = I(a);
function a(e) {
var r,
n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return t(this, a), r = i.call(this), _ && v.call(o(r)), w(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, o(r)), r.options = n, void 0 === r.options.keySeparator && (r.options.keySeparator = "."), r.logger = b.create("translator"), r;
}
return n(a, [{
key: "changeLanguage",
value: function (e) {
e && (this.language = e);
}
}, {
key: "exists",
value: function (e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
interpolation: {}
};
if (null == e) return !1;
var r = this.resolve(e, t);
return r && void 0 !== r.res;
}
}, {
key: "extractFromKey",
value: function (e, t) {
var r = void 0 !== t.nsSeparator ? t.nsSeparator : this.options.nsSeparator;
void 0 === r && (r = ":");
var n = void 0 !== t.keySeparator ? t.keySeparator : this.options.keySeparator,
o = t.ns || this.options.defaultNS || [],
i = r && e.indexOf(r) > -1,
s = !(this.options.userDefinedKeySeparator || t.keySeparator || this.options.userDefinedNsSeparator || t.nsSeparator || function (e, t, r) {
t = t || "", r = r || "";
var n = $.filter(function (e) {
return t.indexOf(e) < 0 && r.indexOf(e) < 0;
});
if (0 === n.length) return !0;
var o = new RegExp("(".concat(n.map(function (e) {
return "?" === e ? "\\?" : e;
}).join("|"), ")")),
i = !o.test(e);
if (!i) {
var s = e.indexOf(r);
s > 0 && !o.test(e.substring(0, s)) && (i = !0);
}
return i;
}(e, r, n));
if (i && !s) {
var a = e.match(this.interpolator.nestingRegexp);
if (a && a.length > 0) return {
key: e,
namespaces: o
};
var c = e.split(r);
(r !== n || r === n && this.options.ns.indexOf(c[0]) > -1) && (o = c.shift()), e = c.join(n);
}
return "string" == typeof o && (o = [o]), {
key: e,
namespaces: o
};
}
}, {
key: "translate",
value: function (t, r, n) {
var o = this;
if ("object" !== e(r) && this.options.overloadTranslationOptionHandler && (r = this.options.overloadTranslationOptionHandler(arguments)), r || (r = {}), null == t) return "";
Array.isArray(t) || (t = [String(t)]);
var i = void 0 !== r.keySeparator ? r.keySeparator : this.options.keySeparator,
s = this.extractFromKey(t[t.length - 1], r),
c = s.key,
l = s.namespaces,
d = l[l.length - 1],
u = r.lng || this.language,
p = r.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
if (u && "cimode" === u.toLowerCase()) {
if (p) {
var h = r.nsSeparator || this.options.nsSeparator;
return d + h + c;
}
return c;
}
var f = this.resolve(t, r),
g = f && f.res,
b = f && f.usedKey || c,
v = f && f.exactUsedKey || c,
m = Object.prototype.toString.apply(g),
y = ["[object Number]", "[object Function]", "[object RegExp]"],
w = void 0 !== r.joinArrays ? r.joinArrays : this.options.joinArrays,
k = !this.i18nFormat || this.i18nFormat.handleAsObject,
x = "string" != typeof g && "boolean" != typeof g && "number" != typeof g;
if (k && g && x && y.indexOf(m) < 0 && ("string" != typeof w || "[object Array]" !== m)) {
if (!r.returnObjects && !this.options.returnObjects) return this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"), this.options.returnedObjectHandler ? this.options.returnedObjectHandler(b, g, U(U({}, r), {}, {
ns: l
})) : "key '".concat(c, " (").concat(this.language, ")' returned an object instead of string.");
if (i) {
var O = "[object Array]" === m,
S = O ? [] : {},
E = O ? v : b;
for (var A in g) if (Object.prototype.hasOwnProperty.call(g, A)) {
var C = "".concat(E).concat(i).concat(A);
S[A] = this.translate(C, U(U({}, r), {
joinArrays: !1,
ns: l
})), S[A] === C && (S[A] = g[A]);
}
g = S;
}
} else if (k && "string" == typeof w && "[object Array]" === m) (g = g.join(w)) && (g = this.extendTranslation(g, t, r, n));else {
var P = !1,
_ = !1,
$ = void 0 !== r.count && "string" != typeof r.count,
j = a.hasDefaultValue(r),
L = $ ? this.pluralResolver.getSuffix(u, r.count, r) : "",
N = r["defaultValue".concat(L)] || r.defaultValue;
!this.isValidLookup(g) && j && (P = !0, g = N), this.isValidLookup(g) || (_ = !0, g = c);
var R = r.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey,
D = R && _ ? void 0 : g,
F = j && N !== g && this.options.updateMissing;
if (_ || P || F) {
if (this.logger.log(F ? "updateKey" : "missingKey", u, d, c, F ? N : g), i) {
var T = this.resolve(c, U(U({}, r), {}, {
keySeparator: !1
}));
T && T.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.");
}
var I = [],
z = this.languageUtils.getFallbackCodes(this.options.fallbackLng, r.lng || this.language);
if ("fallback" === this.options.saveMissingTo && z && z[0]) for (var M = 0; M < z.length; M++) I.push(z[M]);else "all" === this.options.saveMissingTo ? I = this.languageUtils.toResolveHierarchy(r.lng || this.language) : I.push(r.lng || this.language);
var H = function H(e, t, n) {
var i = j && n !== g ? n : D;
o.options.missingKeyHandler ? o.options.missingKeyHandler(e, d, t, i, F, r) : o.backendConnector && o.backendConnector.saveMissing && o.backendConnector.saveMissing(e, d, t, i, F, r), o.emit("missingKey", e, d, t, g);
};
this.options.saveMissing && (this.options.saveMissingPlurals && $ ? I.forEach(function (e) {
o.pluralResolver.getSuffixes(e, r).forEach(function (t) {
H([e], c + t, r["defaultValue".concat(t)] || N);
});
}) : H(I, c, N));
}
g = this.extendTranslation(g, t, r, f, n), _ && g === c && this.options.appendNamespaceToMissingKey && (g = "".concat(d, ":").concat(c)), (_ || P) && this.options.parseMissingKeyHandler && (g = "v1" !== this.options.compatibilityAPI ? this.options.parseMissingKeyHandler(c, P ? g : void 0) : this.options.parseMissingKeyHandler(g));
}
return g;
}
}, {
key: "extendTranslation",
value: function (e, t, r, n, o) {
var i = this;
if (this.i18nFormat && this.i18nFormat.parse) e = this.i18nFormat.parse(e, r, n.usedLng, n.usedNS, n.usedKey, {
resolved: n
});else if (!r.skipInterpolation) {
r.interpolation && this.interpolator.init(U(U({}, r), {
interpolation: U(U({}, this.options.interpolation), r.interpolation)
}));
var s,
a = "string" == typeof e && (r && r.interpolation && void 0 !== r.interpolation.skipOnVariables ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
if (a) {
var c = e.match(this.interpolator.nestingRegexp);
s = c && c.length;
}
var l = r.replace && "string" != typeof r.replace ? r.replace : r;
if (this.options.interpolation.defaultVariables && (l = U(U({}, this.options.interpolation.defaultVariables), l)), e = this.interpolator.interpolate(e, l, r.lng || this.language, r), a) {
var d = e.match(this.interpolator.nestingRegexp);
s < (d && d.length) && (r.nest = !1);
}
!1 !== r.nest && (e = this.interpolator.nest(e, function () {
for (var e = arguments.length, n = new Array(e), s = 0; s < e; s++) n[s] = arguments[s];
return o && o[0] === n[0] && !r.context ? (i.logger.warn("It seems you are nesting recursively key: ".concat(n[0], " in key: ").concat(t[0])), null) : i.translate.apply(i, n.concat([t]));
}, r)), r.interpolation && this.interpolator.reset();
}
var u = r.postProcess || this.options.postProcess,
p = "string" == typeof u ? [u] : u;
return null != e && p && p.length && !1 !== r.applyPostProcessor && (e = F.handle(p, e, t, this.options && this.options.postProcessPassResolved ? U({
i18nResolved: n
}, r) : r, this)), e;
}
}, {
key: "resolve",
value: function (e) {
var t,
r,
n,
o,
i,
s = this,
a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
return "string" == typeof e && (e = [e]), e.forEach(function (e) {
if (!s.isValidLookup(t)) {
var c = s.extractFromKey(e, a),
l = c.key;
r = l;
var d = c.namespaces;
s.options.fallbackNS && (d = d.concat(s.options.fallbackNS));
var u = void 0 !== a.count && "string" != typeof a.count,
p = u && !a.ordinal && 0 === a.count && s.pluralResolver.shouldUseIntlApi(),
h = void 0 !== a.context && ("string" == typeof a.context || "number" == typeof a.context) && "" !== a.context,
f = a.lngs ? a.lngs : s.languageUtils.toResolveHierarchy(a.lng || s.language, a.fallbackLng);
d.forEach(function (e) {
s.isValidLookup(t) || (i = e, !z["".concat(f[0], "-").concat(e)] && s.utils && s.utils.hasLoadedNamespace && !s.utils.hasLoadedNamespace(i) && (z["".concat(f[0], "-").concat(e)] = !0, s.logger.warn('key "'.concat(r, '" for languages "').concat(f.join(", "), '" won\'t get resolved as namespace "').concat(i, '" 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!!!")), f.forEach(function (r) {
if (!s.isValidLookup(t)) {
o = r;
var i,
c = [l];
if (s.i18nFormat && s.i18nFormat.addLookupKeys) s.i18nFormat.addLookupKeys(c, l, r, e, a);else {
var d;
u && (d = s.pluralResolver.getSuffix(r, a.count, a));
var f = "_zero";
if (u && (c.push(l + d), p && c.push(l + f)), h) {
var g = "".concat(l).concat(s.options.contextSeparator).concat(a.context);
c.push(g), u && (c.push(g + d), p && c.push(g + f));
}
}
for (; i = c.pop();) s.isValidLookup(t) || (n = i, t = s.getResource(r, e, i, a));
}
}));
});
}
}), {
res: t,
usedKey: r,
exactUsedKey: n,
usedLng: o,
usedNS: i
};
}
}, {
key: "isValidLookup",
value: function (e) {
return !(void 0 === e || !this.options.returnNull && null === e || !this.options.returnEmptyString && "" === e);
}
}, {
key: "getResource",
value: function (e, t, r) {
var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, t, r, n) : this.resourceStore.getResource(e, t, r, n);
}
}], [{
key: "hasDefaultValue",
value: function (e) {
var t = "defaultValue";
for (var r in e) if (Object.prototype.hasOwnProperty.call(e, r) && t === r.substring(0, t.length) && void 0 !== e[r]) return !0;
return !1;
}
}]), a;
}();
function H(e) {
return e.charAt(0).toUpperCase() + e.slice(1);
}
var B = function () {
function e(r) {
t(this, e), this.options = r, this.supportedLngs = this.options.supportedLngs || !1, this.logger = b.create("languageUtils");
}
return n(e, [{
key: "getScriptPartFromCode",
value: function (e) {
if (!e || e.indexOf("-") < 0) return null;
var t = e.split("-");
return 2 === t.length ? null : (t.pop(), "x" === t[t.length - 1].toLowerCase() ? null : this.formatLanguageCode(t.join("-")));
}
}, {
key: "getLanguagePartFromCode",
value: function (e) {
if (!e || e.indexOf("-") < 0) return e;
var t = e.split("-");
return this.formatLanguageCode(t[0]);
}
}, {
key: "formatLanguageCode",
value: function (e) {
if ("string" == typeof e && e.indexOf("-") > -1) {
var t = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"],
r = e.split("-");
return this.options.lowerCaseLng ? r = r.map(function (e) {
return e.toLowerCase();
}) : 2 === r.length ? (r[0] = r[0].toLowerCase(), r[1] = r[1].toUpperCase(), t.indexOf(r[1].toLowerCase()) > -1 && (r[1] = H(r[1].toLowerCase()))) : 3 === r.length && (r[0] = r[0].toLowerCase(), 2 === r[1].length && (r[1] = r[1].toUpperCase()), "sgn" !== r[0] && 2 === r[2].length && (r[2] = r[2].toUpperCase()), t.indexOf(r[1].toLowerCase()) > -1 && (r[1] = H(r[1].toLowerCase())), t.indexOf(r[2].toLowerCase()) > -1 && (r[2] = H(r[2].toLowerCase()))), r.join("-");
}
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
}
}, {
key: "isSupportedCode",
value: function (e) {
return ("languageOnly" === this.options.load || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
}
}, {
key: "getBestMatchFromCodes",
value: function (e) {
var t,
r = this;
return e ? (e.forEach(function (e) {
if (!t) {
var n = r.formatLanguageCode(e);
r.options.supportedLngs && !r.isSupportedCode(n) || (t = n);
}
}), !t && this.options.supportedLngs && e.forEach(function (e) {
if (!t) {
var n = r.getLanguagePartFromCode(e);
if (r.isSupportedCode(n)) return t = n;
t = r.options.supportedLngs.find(function (e) {
if (0 === e.indexOf(n)) return e;
});
}
}), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t) : null;
}
}, {
key: "getFallbackCodes",
value: function (e, t) {
if (!e) return [];
if ("function" == typeof e && (e = e(t)), "string" == typeof e && (e = [e]), "[object Array]" === Object.prototype.toString.apply(e)) return e;
if (!t) return e.default || [];
var r = e[t];
return r || (r = e[this.getScriptPartFromCode(t)]), r || (r = e[this.formatLanguageCode(t)]), r || (r = e[this.getLanguagePartFromCode(t)]), r || (r = e.default), r || [];
}
}, {
key: "toResolveHierarchy",
value: function (e, t) {
var r = this,
n = this.getFallbackCodes(t || this.options.fallbackLng || [], e),
o = [],
i = function i(e) {
e && (r.isSupportedCode(e) ? o.push(e) : r.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)));
};
return "string" == typeof e && e.indexOf("-") > -1 ? ("languageOnly" !== this.options.load && i(this.formatLanguageCode(e)), "languageOnly" !== this.options.load && "currentOnly" !== this.options.load && i(this.getScriptPartFromCode(e)), "currentOnly" !== this.options.load && i(this.getLanguagePartFromCode(e))) : "string" == typeof e && i(this.formatLanguageCode(e)), n.forEach(function (e) {
o.indexOf(e) < 0 && i(r.formatLanguageCode(e));
}), o;
}
}]), e;
}(),
V = [{
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
}],
K = {
1: function (e) {
return Number(e > 1);
},
2: function (e) {
return Number(1 != e);
},
3: function (e) {
return 0;
},
4: function (e) {
return Number(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 Number(0 == e ? 0 : 1 == e ? 1 : 2 == e ? 2 : e % 100 >= 3 && e % 100 <= 10 ? 3 : e % 100 >= 11 ? 4 : 5);
},
6: function (e) {
return Number(1 == e ? 0 : e >= 2 && e <= 4 ? 1 : 2);
},
7: function (e) {
return Number(1 == e ? 0 : e % 10 >= 2 && e % 10 <= 4 && (e % 100 < 10 || e % 100 >= 20) ? 1 : 2);
},
8: function (e) {
return Number(1 == e ? 0 : 2 == e ? 1 : 8 != e && 11 != e ? 2 : 3);
},
9: function (e) {
return Number(e >= 2);
},
10: function (e) {
return Number(1 == e ? 0 : 2 == e ? 1 : e < 7 ? 2 : e < 11 ? 3 : 4);
},
11: function (e) {
return Number(1 == e || 11 == e ? 0 : 2 == e || 12 == e ? 1 : e > 2 && e < 20 ? 2 : 3);
},
12: function (e) {
return Number(e % 10 != 1 || e % 100 == 11);
},
13: function (e) {
return Number(0 !== e);
},
14: function (e) {
return Number(1 == e ? 0 : 2 == e ? 1 : 3 == e ? 2 : 3);
},
15: function (e) {
return Number(e % 10 == 1 && e % 100 != 11 ? 0 : e % 10 >= 2 && (e % 100 < 10 || e % 100 >= 20) ? 1 : 2);
},
16: function (e) {
return Number(e % 10 == 1 && e % 100 != 11 ? 0 : 0 !== e ? 1 : 2);
},
17: function (e) {
return Number(1 == e || e % 10 == 1 && e % 100 != 11 ? 0 : 1);
},
18: function (e) {
return Number(0 == e ? 0 : 1 == e ? 1 : 2);
},
19: function (e) {
return Number(1 == e ? 0 : 0 == e || e % 100 > 1 && e % 100 < 11 ? 1 : e % 100 > 10 && e % 100 < 20 ? 2 : 3);
},
20: function (e) {
return Number(1 == e ? 0 : 0 == e || e % 100 > 0 && e % 100 < 20 ? 1 : 2);
},
21: function (e) {
return Number(e % 100 == 1 ? 1 : e % 100 == 2 ? 2 : e % 100 == 3 || e % 100 == 4 ? 3 : 0);
},
22: function (e) {
return Number(1 == e ? 0 : 2 == e ? 1 : (e < 0 || e > 10) && e % 10 == 0 ? 2 : 3);
}
},
J = ["v1", "v2", "v3"],
q = {
zero: 0,
one: 1,
two: 2,
few: 3,
many: 4,
other: 5
};
function W() {
var e = {};
return V.forEach(function (t) {
t.lngs.forEach(function (r) {
e[r] = {
numbers: t.nr,
plurals: K[t.fc]
};
});
}), e;
}
var Y = function () {
function e(r) {
var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
t(this, e), this.languageUtils = r, this.options = n, this.logger = b.create("pluralResolver"), this.options.compatibilityJSON && "v4" !== this.options.compatibilityJSON || "undefined" != typeof Intl && 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 = W();
}
return n(e, [{
key: "addRule",
value: function (e, t) {
this.rules[e] = t;
}
}, {
key: "getRule",
value: function (e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if (this.shouldUseIntlApi()) try {
return new Intl.PluralRules(e, {
type: t.ordinal ? "ordinal" : "cardinal"
});
} catch (e) {
return;
}
return this.rules[e] || this.rules[this.languageUtils.getLanguagePartFromCode(e)];
}
}, {
key: "needsPlural",
value: function (e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
r = this.getRule(e, t);
return this.shouldUseIntlApi() ? r && r.resolvedOptions().pluralCategories.length > 1 : r && r.numbers.length > 1;
}
}, {
key: "getPluralFormsOfKey",
value: function (e, t) {
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
return this.getSuffixes(e, r).map(function (e) {
return "".concat(t).concat(e);
});
}
}, {
key: "getSuffixes",
value: function (e) {
var t = this,
r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
n = this.getRule(e, r);
return n ? this.shouldUseIntlApi() ? n.resolvedOptions().pluralCategories.sort(function (e, t) {
return q[e] - q[t];
}).map(function (e) {
return "".concat(t.options.prepend).concat(e);
}) : n.numbers.map(function (n) {
return t.getSuffix(e, n, r);
}) : [];
}
}, {
key: "getSuffix",
value: function (e, t) {
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
n = this.getRule(e, r);
return n ? this.shouldUseIntlApi() ? "".concat(this.options.prepend).concat(n.select(t)) : this.getSuffixRetroCompatible(n, t) : (this.logger.warn("no plural rule found for: ".concat(e)), "");
}
}, {
key: "getSuffixRetroCompatible",
value: function (e, t) {
var r = this,
n = e.noAbs ? e.plurals(t) : e.plurals(Math.abs(t)),
o = e.numbers[n];
this.options.simplifyPluralSuffix && 2 === e.numbers.length && 1 === e.numbers[0] && (2 === o ? o = "plural" : 1 === o && (o = ""));
var i = function i() {
return r.options.prepend && o.toString() ? r.options.prepend + o.toString() : o.toString();
};
return "v1" === this.options.compatibilityJSON ? 1 === o ? "" : "number" == typeof o ? "_plural_".concat(o.toString()) : i() : "v2" === this.options.compatibilityJSON || this.options.simplifyPluralSuffix && 2 === e.numbers.length && 1 === e.numbers[0] ? i() : this.options.prepend && n.toString() ? this.options.prepend + n.toString() : n.toString();
}
}, {
key: "shouldUseIntlApi",
value: function () {
return !J.includes(this.options.compatibilityJSON);
}
}]), e;
}();
function G(e, t) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
t && (n = n.filter(function (t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function X(e) {
for (var t = 1; t < arguments.length; t++) {
var r = null != arguments[t] ? arguments[t] : {};
t % 2 ? G(Object(r), !0).forEach(function (t) {
l(e, t, r[t]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : G(Object(r)).forEach(function (t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
});
}
return e;
}
var Z = function () {
function e() {
var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
t(this, e), this.logger = b.create("interpolator"), this.options = r, this.format = r.interpolation && r.interpolation.format || function (e) {
return e;
}, this.init(r);
}
return n(e, [{
key: "init",
value: function () {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
e.interpolation || (e.interpolation = {
escapeValue: !0
});
var t = e.interpolation;
this.escape = void 0 !== t.escape ? t.escape : P, this.escapeValue = void 0 === t.escapeValue || t.escapeValue, this.useRawValueToEscape = void 0 !== t.useRawValueToEscape && t.useRawValueToEscape, this.prefix = t.prefix ? A(t.prefix) : t.prefixEscaped || "{{", this.suffix = t.suffix ? A(t.suffix) : t.suffixEscaped || "}}", this.formatSeparator = t.formatSeparator ? t.formatSeparator : t.formatSeparator || ",", this.unescapePrefix = t.unescapeSuffix ? "" : t.unescapePrefix || "-", this.unescapeSuffix = this.unescapePrefix ? "" : t.unescapeSuffix || "", this.nestingPrefix = t.nestingPrefix ? A(t.nestingPrefix) : t.nestingPrefixEscaped || A("$t("), this.nestingSuffix = t.nestingSuffix ? A(t.nestingSuffix) : t.nestingSuffixEscaped || A(")"), this.nestingOptionsSeparator = t.nestingOptionsSeparator ? t.nestingOptionsSeparator : t.nestingOptionsSeparator || ",", this.maxReplaces = t.maxReplaces ? t.maxReplaces : 1e3, this.alwaysFormat = void 0 !== t.alwaysFormat && t.alwaysFormat, this.resetRegExp();
}
}, {
key: "reset",
value: function () {
this.options && this.init(this.options);
}
}, {
key: "resetRegExp",
value: function () {
var e = "".concat(this.prefix, "(.+?)").concat(this.suffix);
this.regexp = new RegExp(e, "g");
var t = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
this.regexpUnescape = new RegExp(t, "g");
var r = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
this.nestingRegexp = new RegExp(r, "g");
}
}, {
key: "interpolate",
value: function (e, t, r, n) {
var o,
i,
s,
a = this,
c = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
function l(e) {
return e.replace(/\$/g, "$$$$");
}
var d = function d(e) {
if (e.indexOf(a.formatSeparator) < 0) {
var o = S(t, c, e);
return a.alwaysFormat ? a.format(o, void 0, r, X(X(X({}, n), t), {}, {
interpolationkey: e
})) : o;
}
var i = e.split(a.formatSeparator),
s = i.shift().trim(),
l = i.join(a.formatSeparator).trim();
return a.format(S(t, c, s), l, r, X(X(X({}, n), t), {}, {
interpolationkey: s
}));
};
this.resetRegExp();
var u = n && n.missingInterpolationHandler || this.options.missingInterpolationHandler,
p = n && n.interpolation && void 0 !== n.interpolation.skipOnVariables ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
return [{
regex: this.regexpUnescape,
safeValue: function (e) {
return l(e);
}
}, {
regex: this.regexp,
safeValue: function (e) {
return a.escapeValue ? l(a.escape(e)) : l(e);
}
}].forEach(function (t) {
for (s = 0; o = t.regex.exec(e);) {
var r = o[1].trim();
if (void 0 === (i = d(r))) {
if ("function" == typeof u) {
var c = u(e, o, n);
i = "string" == typeof c ? c : "";
} else if (n && n.hasOwnProperty(r)) i = "";else {
if (p) {
i = o[0];
continue;
}
a.logger.warn("missed to pass in variable ".concat(r, " for interpolating ").concat(e)), i = "";
}
} else "string" == typeof i || a.useRawValueToEscape || (i = y(i));
var l = t.safeValue(i);
if (e = e.replace(o[0], l), p ? (t.regex.lastIndex += l.length, t.regex.lastIndex -= o[0].length) : t.regex.lastIndex = 0, ++s >= a.maxReplaces) break;
}
}), e;
}
}, {
key: "nest",
value: function (e, t) {
var r,
n,
o = this,
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
s = X({}, i);
function a(e, t) {
var r = this.nestingOptionsSeparator;
if (e.indexOf(r) < 0) return e;
var n = e.split(new RegExp("".concat(r, "[ ]*{"))),
o = "{".concat(n[1]);
e = n[0], o = (o = this.interpolate(o, s)).replace(/'/g, '"');
try {
s = JSON.parse(o), t && (s = X(X({}, t), s));
} catch (t) {
return this.logger.warn("failed parsing options string in nesting for key ".concat(e), t), "".concat(e).concat(r).concat(o);
}
return delete s.defaultValue, e;
}
for (s.applyPostProcessor = !1, delete s.defaultValue; r = this.nestingRegexp.exec(e);) {
var c = [],
l = !1;
if (-1 !== r[0].indexOf(this.formatSeparator) && !/{.*}/.test(r[1])) {
var d = r[1].split(this.formatSeparator).map(function (e) {
return e.trim();
});
r[1] = d.shift(), c = d, l = !0;
}
if ((n = t(a.call(this, r[1].trim(), s), s)) && r[0] === e && "string" != typeof n) return n;
"string" != typeof n && (n = y(n)), n || (this.logger.warn("missed to resolve ".concat(r[1], " for nesting ").concat(e)), n = ""), l && (n = c.reduce(function (e, t) {
return o.format(e, t, i.lng, X(X({}, i), {}, {
interpolationkey: r[1].trim()
}));
}, n.trim())), e = e.replace(r[0], n), this.regexp.lastIndex = 0;
}
return e;
}
}]), e;
}();
function Q(e, t) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
t && (n = n.filter(function (t) {
return Object.getOwnPropertyDescriptor(e, t).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function ee(e) {
for (var t = 1; t < arguments.length; t++) {
var r = null != arguments[t] ? arguments[t] : {};
t % 2 ? Q(Object(r), !0).forEach(function (t) {
l(e, t, r[t]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Q(Object(r)).forEach(function (t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
});
}
return e;
}
var te = function () {
function e() {
var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
t(this, e), this.logger = b.create("formatter"), this.options = r, this.formats = {
number: function (e, t, r) {
return new Intl.NumberFormat(t, r).format(e);
},
currency: function (e, t, r) {
return new Intl.NumberFormat(t, ee(ee({}, r), {}, {
style: "currency"
})).format(e);
},
datetime: function (e, t, r) {
return new Intl.DateTimeFormat(t, ee({}, r)).format(e);
},
relativetime: function (e, t, r) {
return new Intl.RelativeTimeFormat(t, ee({}, r)).format(e, r.range || "day");
},
list: function (e, t, r) {
return new Intl.ListFormat(t, ee({}, r)).format(e);
}
}, this.init(r);
}
return n(e, [{
key: "init",
value: function (e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
interpolation: {}
},
r = t.interpolation;
this.formatSeparator = r.formatSeparator ? r.formatSeparator : r.formatSeparator || ",";
}
}, {
key: "add",
value: function (e, t) {
this.formats[e.toLowerCase().trim()] = t;
}
}, {
key: "format",
value: function (e, t, r, n) {
var o = this,
i = t.split(this.formatSeparator).reduce(function (e, t) {
var i = function (e) {
var t = e.toLowerCase().trim(),
r = {};
if (e.indexOf("(") > -1) {
var n = e.split("(");
t = n[0].toLowerCase().trim();
var o = n[1].substring(0, n[1].length - 1);
"currency" === t && o.indexOf(":") < 0 ? r.currency || (r.currency = o.trim()) : "relativetime" === t && o.indexOf(":") < 0 ? r.range || (r.range = o.trim()) : o.split(";").forEach(function (e) {
if (e) {
var t = u(e.split(":")),
n = t[0],
o = t.slice(1).join(":");