@feedmepos/mf-connect 0.1.0-beta.33 → 0.1.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Analytic-COFvmYc_.js → Analytic-DYfm1eg5.js} +24 -23
- package/dist/{App-Di7kbEH7.js → App-DV85I2xq.js} +6 -6
- package/dist/{Broadcast-CAku3lNW.js → Broadcast-CNpwvxRx.js} +8 -8
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B1Ozu6-2.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Bv8Ki3vl.js} +7 -7
- package/dist/{Card-CcRmp6aK.js → Card-Bk4hfK9U.js} +15 -15
- package/dist/{Collections-BRLR37TF.js → Collections-CrND62Vz.js} +4 -4
- package/dist/{Credit-BEViCbtH.js → Credit-ICo98p8n.js} +8 -8
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DDSSHrcX.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-LFtf2JM3.js} +27 -26
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CGBjH5AK.js → EffectSheet.vue_vue_type_style_index_0_lang-CdVIbAT3.js} +6 -6
- package/dist/{Experience-BL71InUh.js → Experience-BqMJUymq.js} +8 -8
- package/dist/{Game-vmhBTg3f.js → Game-DvjisU7I.js} +8 -8
- package/dist/{Index-DGkT3yms.js → Index-Vbv5hpsB.js} +9 -9
- package/dist/{Marketing-BCqFnOrR.js → Marketing-CU6GUm2L.js} +5 -5
- package/dist/{Member-C7uOPBUa.js → Member-Dcyb6og-.js} +4 -4
- package/dist/{MemberList-CaY2SRSx.js → MemberList-CBO6SVE-.js} +14 -14
- package/dist/{MemberTransactions-v2sui0Sy.js → MemberTransactions-BuPoUtjA.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-za7Jz9uG.js → MessageInput.vue_vue_type_script_setup_true_lang-B_q37PEs.js} +2 -2
- package/dist/{Mission-DZG8d3vM.js → Mission-_Vi8gaKQ.js} +8 -8
- package/dist/{Overview-egVspSvq.js → Overview-8ZkvZh2U.js} +370 -346
- package/dist/{Point-DW_SHWMs.js → Point-BqmJ8ak3.js} +8 -8
- package/dist/{Promotion-C8tygVa7.js → Promotion-CDOtfUpE.js} +9 -9
- package/dist/{Record-D7XgEVn_.js → Record-NUadzYL2.js} +5 -5
- package/dist/Reward-CgRFzQHO.js +432 -0
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Dyj14jcj.js → RewardGroup.vue_vue_type_script_setup_true_lang-Cg5cJLSS.js} +11 -11
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Cmv-8YZd.js → RuleGroup.vue_vue_type_script_setup_true_lang-Bac_RiwJ.js} +13 -13
- package/dist/{Segment-DAYnubHq.js → Segment-bHLt_9xi.js} +13 -13
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BviSuL4I.js → SelectItems.vue_vue_type_script_setup_true_lang-DWulr5sA.js} +2 -2
- package/dist/{Setting-Dd-PlldV.js → Setting-AQjJ0LBm.js} +8 -8
- package/dist/{Store-DmBeTkdi.js → Store-DzGhYzS9.js} +46 -46
- package/dist/{StoreRewards-VrmRII1r.js → StoreRewards-BN33UZrN.js} +12 -12
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Bx1AwHhj.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CF7R6Mbf.js} +17 -17
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DanZYVUH.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C3wxmJBS.js} +1 -1
- package/dist/{Tier-h5t-OofQ.js → Tier-BaIm0-nO.js} +19 -19
- package/dist/{Title-BIGAZzv4.js → Title-CGU2TRSf.js} +19 -19
- package/dist/{Transaction-WfW0gCVl.js → Transaction-DA2CK2a4.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-KB8LAOv_.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DSVVsk_u.js} +6 -6
- package/dist/{Voucher-CzA0AnCo.js → Voucher-Bzh_fJpa.js} +11 -11
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BbYPy9pR.js → VoucherEditor.vue_vue_type_script_setup_true_lang-Bflyp1V0.js} +10 -10
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BPHAIlP5.js → ZodTextField.vue_vue_type_script_setup_true_lang-Wh_Pc7qk.js} +1 -1
- package/dist/{app-BhP-DVoF.js → app-CBijF7l9.js} +1 -1
- package/dist/{app-C2GiWW62.js → app-Ceasya0M.js} +28 -28
- package/dist/app.js +1 -1
- package/dist/{business-BjQMXRkL.js → business-BJ-cyfj6.js} +1 -1
- package/dist/{campaign-tqh1zOQn.js → campaign-B5Cvxv_n.js} +2 -2
- package/dist/campaign.enum-CwvY4pwh.js +20 -0
- package/dist/campaign.fn-CWcwUEiZ.js +758 -0
- package/dist/{collectible.enum-904x3SQw.js → collectible.enum-COdcR96r.js} +1 -1
- package/dist/{collection.fn-B1wW3tQk.js → collection.fn-BTQbGCVW.js} +2 -2
- package/dist/dto-BnknKYcg.js +2018 -0
- package/dist/{effect-DlIXzIWd.js → effect-DqWwcDoL.js} +1 -1
- package/dist/{email-addresses-bquAp7UR.js → email-addresses-DPPlvfPT.js} +1 -1
- package/dist/{export-9ZU9HjO9.js → export-FXBFFRdK.js} +3 -3
- package/dist/{helper-D0S39he1.js → helper-C776lUH-.js} +1 -1
- package/dist/{index-DTsmbmOR.js → index-BG5txN30.js} +3 -3
- package/dist/{index-D4QKa9x3.js → index-BjAdYoh3.js} +7 -7
- package/dist/{index-BoJwjzpx.js → index-C1aWGTdZ.js} +1 -1
- package/dist/{index-kkystjJw.js → index-CRlD2sul.js} +3 -3
- package/dist/{index-Dszb1Xy-.js → index-CZaQ-veW.js} +1 -1
- package/dist/{index-DN5WVCu6.js → index-Cgaj4reE.js} +1 -1
- package/dist/{index-BwDwKkyV.js → index-CpD4ezv2.js} +1 -1
- package/dist/{index-DF3fzy-k.js → index-CxU9mwRl.js} +1 -1
- package/dist/{index-DNa1m2cM.js → index-D62SBn2q.js} +3 -3
- package/dist/{index-DnGzf-f8.js → index-DeMgVwv8.js} +2 -2
- package/dist/{index-B6SrZyMF.js → index-Dw1WniG7.js} +206 -222
- package/dist/{index-l_74COL_.js → index-I27oHD1a.js} +1 -1
- package/dist/{index.esm2017-CNuwLU2a.js → index.esm2017-Cf8UXsST.js} +1 -1
- package/dist/{loading-CiI8Y9Fj.js → loading-DCSdIZqP.js} +4 -4
- package/dist/{membership-CPNrhOk0.js → membership-KiKcnWxt.js} +4 -4
- package/dist/{money-DnAxVjb7.js → money-B_LMR19r.js} +1 -1
- package/dist/{number-B5VKL1Yu.js → number-Bk18T5Xb.js} +1 -1
- package/dist/{objectid-C-IOC4JL.js → objectid-CZ5qnZ1J.js} +5 -5
- package/dist/{reward-D4RyiYb6.js → reward-ozVC4wTW.js} +1 -1
- package/dist/{rule-DVMHVRWb.js → rule-CWT8hI3A.js} +3 -3
- package/dist/{rule-builder-CFUNraRE.js → rule-builder-DTEvWEjJ.js} +1 -1
- package/dist/{template-OBoSoTcO.js → template-9N1FRXDZ.js} +4 -4
- package/dist/{trigger-R6mF8LNa.js → trigger-C2-zYC46.js} +4 -4
- package/dist/{user-BGP1BTAw.js → user-DBxVxr4P.js} +1 -1
- package/dist/{vue-i18n-_ooGZZRG.js → vue-i18n-BK0qKZu-.js} +357 -357
- package/dist/{xlsx-ByJGlrKD.js → xlsx-CmKV4f40.js} +1 -1
- package/package.json +1 -1
- package/dist/Reward-DqP89Pqb.js +0 -413
- package/dist/dto-C9SOa-xs.js +0 -2770
|
@@ -0,0 +1,2018 @@
|
|
|
1
|
+
import { h as V } from "./moment-BWErdI6_.js";
|
|
2
|
+
import { g as Ae, a as k, h as Ve } from "./index-Dw1WniG7.js";
|
|
3
|
+
import { e as X } from "./effect-DqWwcDoL.js";
|
|
4
|
+
import { components as le } from "@feedmepos/ui-library";
|
|
5
|
+
import { i as ge, R as ue } from "./rule-builder-DTEvWEjJ.js";
|
|
6
|
+
import { c as Me } from "./rule-CWT8hI3A.js";
|
|
7
|
+
import { u as _e } from "./business-BJ-cyfj6.js";
|
|
8
|
+
import { C as A } from "./campaign.fn-CWcwUEiZ.js";
|
|
9
|
+
import { c as ve, F as w, z as b } from "./loading-DCSdIZqP.js";
|
|
10
|
+
import { e as Ue, Z as S, a as ye, i as De, z as Ke } from "./app-Ceasya0M.js";
|
|
11
|
+
import { createFeedMeI18n as He, detectLocale as he } from "@feedmepos/mf-common";
|
|
12
|
+
import { h as Y } from "vue";
|
|
13
|
+
import { F as $ } from "./campaign.enum-CwvY4pwh.js";
|
|
14
|
+
import { F as re } from "./index-DeMgVwv8.js";
|
|
15
|
+
const d = (r) => typeof r == "string", W = () => {
|
|
16
|
+
let r, e;
|
|
17
|
+
const t = new Promise((s, i) => {
|
|
18
|
+
r = s, e = i;
|
|
19
|
+
});
|
|
20
|
+
return t.resolve = r, t.reject = e, t;
|
|
21
|
+
}, xe = (r) => r == null ? "" : "" + r, ze = (r, e, t) => {
|
|
22
|
+
r.forEach((s) => {
|
|
23
|
+
e[s] && (t[s] = e[s]);
|
|
24
|
+
});
|
|
25
|
+
}, Be = /###/g, be = (r) => r && r.indexOf("###") > -1 ? r.replace(Be, ".") : r, Oe = (r) => !r || d(r), G = (r, e, t) => {
|
|
26
|
+
const s = d(e) ? e.split(".") : e;
|
|
27
|
+
let i = 0;
|
|
28
|
+
for (; i < s.length - 1; ) {
|
|
29
|
+
if (Oe(r)) return {};
|
|
30
|
+
const n = be(s[i]);
|
|
31
|
+
!r[n] && t && (r[n] = new t()), Object.prototype.hasOwnProperty.call(r, n) ? r = r[n] : r = {}, ++i;
|
|
32
|
+
}
|
|
33
|
+
return Oe(r) ? {} : {
|
|
34
|
+
obj: r,
|
|
35
|
+
k: be(s[i])
|
|
36
|
+
};
|
|
37
|
+
}, Se = (r, e, t) => {
|
|
38
|
+
const {
|
|
39
|
+
obj: s,
|
|
40
|
+
k: i
|
|
41
|
+
} = G(r, e, Object);
|
|
42
|
+
if (s !== void 0 || e.length === 1) {
|
|
43
|
+
s[i] = t;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let n = e[e.length - 1], a = e.slice(0, e.length - 1), o = G(r, a, Object);
|
|
47
|
+
for (; o.obj === void 0 && a.length; )
|
|
48
|
+
n = `${a[a.length - 1]}.${n}`, a = a.slice(0, a.length - 1), o = G(r, a, Object), o != null && o.obj && typeof o.obj[`${o.k}.${n}`] < "u" && (o.obj = void 0);
|
|
49
|
+
o.obj[`${o.k}.${n}`] = t;
|
|
50
|
+
}, Je = (r, e, t, s) => {
|
|
51
|
+
const {
|
|
52
|
+
obj: i,
|
|
53
|
+
k: n
|
|
54
|
+
} = G(r, e, Object);
|
|
55
|
+
i[n] = i[n] || [], i[n].push(t);
|
|
56
|
+
}, ee = (r, e) => {
|
|
57
|
+
const {
|
|
58
|
+
obj: t,
|
|
59
|
+
k: s
|
|
60
|
+
} = G(r, e);
|
|
61
|
+
if (t && Object.prototype.hasOwnProperty.call(t, s))
|
|
62
|
+
return t[s];
|
|
63
|
+
}, We = (r, e, t) => {
|
|
64
|
+
const s = ee(r, t);
|
|
65
|
+
return s !== void 0 ? s : ee(e, t);
|
|
66
|
+
}, Fe = (r, e, t) => {
|
|
67
|
+
for (const s in e)
|
|
68
|
+
s !== "__proto__" && s !== "constructor" && (s in r ? d(r[s]) || r[s] instanceof String || d(e[s]) || e[s] instanceof String ? t && (r[s] = e[s]) : Fe(r[s], e[s], t) : r[s] = e[s]);
|
|
69
|
+
return r;
|
|
70
|
+
}, U = (r) => r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
71
|
+
var Ye = {
|
|
72
|
+
"&": "&",
|
|
73
|
+
"<": "<",
|
|
74
|
+
">": ">",
|
|
75
|
+
'"': """,
|
|
76
|
+
"'": "'",
|
|
77
|
+
"/": "/"
|
|
78
|
+
};
|
|
79
|
+
const Ge = (r) => d(r) ? r.replace(/[&<>"'\/]/g, (e) => Ye[e]) : r;
|
|
80
|
+
class Ze {
|
|
81
|
+
constructor(e) {
|
|
82
|
+
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
83
|
+
}
|
|
84
|
+
getRegExp(e) {
|
|
85
|
+
const t = this.regExpMap.get(e);
|
|
86
|
+
if (t !== void 0)
|
|
87
|
+
return t;
|
|
88
|
+
const s = new RegExp(e);
|
|
89
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const qe = [" ", ",", "?", "!", ";"], Qe = new Ze(20), Xe = (r, e, t) => {
|
|
93
|
+
e = e || "", t = t || "";
|
|
94
|
+
const s = qe.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
|
|
95
|
+
if (s.length === 0) return !0;
|
|
96
|
+
const i = Qe.getRegExp(`(${s.map((a) => a === "?" ? "\\?" : a).join("|")})`);
|
|
97
|
+
let n = !i.test(r);
|
|
98
|
+
if (!n) {
|
|
99
|
+
const a = r.indexOf(t);
|
|
100
|
+
a > 0 && !i.test(r.substring(0, a)) && (n = !0);
|
|
101
|
+
}
|
|
102
|
+
return n;
|
|
103
|
+
}, ce = function(r, e) {
|
|
104
|
+
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
105
|
+
if (!r) return;
|
|
106
|
+
if (r[e])
|
|
107
|
+
return Object.prototype.hasOwnProperty.call(r, e) ? r[e] : void 0;
|
|
108
|
+
const s = e.split(t);
|
|
109
|
+
let i = r;
|
|
110
|
+
for (let n = 0; n < s.length; ) {
|
|
111
|
+
if (!i || typeof i != "object")
|
|
112
|
+
return;
|
|
113
|
+
let a, o = "";
|
|
114
|
+
for (let l = n; l < s.length; ++l)
|
|
115
|
+
if (l !== n && (o += t), o += s[l], a = i[o], a !== void 0) {
|
|
116
|
+
if (["string", "number", "boolean"].indexOf(typeof a) > -1 && l < s.length - 1)
|
|
117
|
+
continue;
|
|
118
|
+
n += l - n + 1;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
i = a;
|
|
122
|
+
}
|
|
123
|
+
return i;
|
|
124
|
+
}, te = (r) => r == null ? void 0 : r.replace("_", "-"), et = {
|
|
125
|
+
type: "logger",
|
|
126
|
+
log(r) {
|
|
127
|
+
this.output("log", r);
|
|
128
|
+
},
|
|
129
|
+
warn(r) {
|
|
130
|
+
this.output("warn", r);
|
|
131
|
+
},
|
|
132
|
+
error(r) {
|
|
133
|
+
this.output("error", r);
|
|
134
|
+
},
|
|
135
|
+
output(r, e) {
|
|
136
|
+
var t, s;
|
|
137
|
+
(s = (t = console == null ? void 0 : console[r]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
class se {
|
|
141
|
+
constructor(e) {
|
|
142
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
143
|
+
this.init(e, t);
|
|
144
|
+
}
|
|
145
|
+
init(e) {
|
|
146
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
147
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || et, this.options = t, this.debug = t.debug;
|
|
148
|
+
}
|
|
149
|
+
log() {
|
|
150
|
+
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
151
|
+
t[s] = arguments[s];
|
|
152
|
+
return this.forward(t, "log", "", !0);
|
|
153
|
+
}
|
|
154
|
+
warn() {
|
|
155
|
+
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
156
|
+
t[s] = arguments[s];
|
|
157
|
+
return this.forward(t, "warn", "", !0);
|
|
158
|
+
}
|
|
159
|
+
error() {
|
|
160
|
+
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
161
|
+
t[s] = arguments[s];
|
|
162
|
+
return this.forward(t, "error", "");
|
|
163
|
+
}
|
|
164
|
+
deprecate() {
|
|
165
|
+
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
166
|
+
t[s] = arguments[s];
|
|
167
|
+
return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
|
|
168
|
+
}
|
|
169
|
+
forward(e, t, s, i) {
|
|
170
|
+
return i && !this.debug ? null : (d(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
171
|
+
}
|
|
172
|
+
create(e) {
|
|
173
|
+
return new se(this.logger, {
|
|
174
|
+
prefix: `${this.prefix}:${e}:`,
|
|
175
|
+
...this.options
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
clone(e) {
|
|
179
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new se(this.logger, e);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
var E = new se();
|
|
183
|
+
class ne {
|
|
184
|
+
constructor() {
|
|
185
|
+
this.observers = {};
|
|
186
|
+
}
|
|
187
|
+
on(e, t) {
|
|
188
|
+
return e.split(" ").forEach((s) => {
|
|
189
|
+
this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
|
|
190
|
+
const i = this.observers[s].get(t) || 0;
|
|
191
|
+
this.observers[s].set(t, i + 1);
|
|
192
|
+
}), this;
|
|
193
|
+
}
|
|
194
|
+
off(e, t) {
|
|
195
|
+
if (this.observers[e]) {
|
|
196
|
+
if (!t) {
|
|
197
|
+
delete this.observers[e];
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
this.observers[e].delete(t);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
emit(e) {
|
|
204
|
+
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
|
|
205
|
+
s[i - 1] = arguments[i];
|
|
206
|
+
this.observers[e] && Array.from(this.observers[e].entries()).forEach((a) => {
|
|
207
|
+
let [o, l] = a;
|
|
208
|
+
for (let u = 0; u < l; u++)
|
|
209
|
+
o(...s);
|
|
210
|
+
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((a) => {
|
|
211
|
+
let [o, l] = a;
|
|
212
|
+
for (let u = 0; u < l; u++)
|
|
213
|
+
o.apply(o, [e, ...s]);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
class Ce extends ne {
|
|
218
|
+
constructor(e) {
|
|
219
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
220
|
+
ns: ["translation"],
|
|
221
|
+
defaultNS: "translation"
|
|
222
|
+
};
|
|
223
|
+
super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
|
|
224
|
+
}
|
|
225
|
+
addNamespaces(e) {
|
|
226
|
+
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
227
|
+
}
|
|
228
|
+
removeNamespaces(e) {
|
|
229
|
+
const t = this.options.ns.indexOf(e);
|
|
230
|
+
t > -1 && this.options.ns.splice(t, 1);
|
|
231
|
+
}
|
|
232
|
+
getResource(e, t, s) {
|
|
233
|
+
var u, f;
|
|
234
|
+
let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
235
|
+
const n = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, a = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
236
|
+
let o;
|
|
237
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : d(s) && n ? o.push(...s.split(n)) : o.push(s)));
|
|
238
|
+
const l = ee(this.data, o);
|
|
239
|
+
return !l && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), l || !a || !d(s) ? l : ce((f = (u = this.data) == null ? void 0 : u[e]) == null ? void 0 : f[t], s, n);
|
|
240
|
+
}
|
|
241
|
+
addResource(e, t, s, i) {
|
|
242
|
+
let n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
243
|
+
silent: !1
|
|
244
|
+
};
|
|
245
|
+
const a = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
|
|
246
|
+
let o = [e, t];
|
|
247
|
+
s && (o = o.concat(a ? s.split(a) : s)), e.indexOf(".") > -1 && (o = e.split("."), i = t, t = o[1]), this.addNamespaces(t), Se(this.data, o, i), n.silent || this.emit("added", e, t, s, i);
|
|
248
|
+
}
|
|
249
|
+
addResources(e, t, s) {
|
|
250
|
+
let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
|
|
251
|
+
silent: !1
|
|
252
|
+
};
|
|
253
|
+
for (const n in s)
|
|
254
|
+
(d(s[n]) || Array.isArray(s[n])) && this.addResource(e, t, n, s[n], {
|
|
255
|
+
silent: !0
|
|
256
|
+
});
|
|
257
|
+
i.silent || this.emit("added", e, t, s);
|
|
258
|
+
}
|
|
259
|
+
addResourceBundle(e, t, s, i, n) {
|
|
260
|
+
let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
|
|
261
|
+
silent: !1,
|
|
262
|
+
skipCopy: !1
|
|
263
|
+
}, o = [e, t];
|
|
264
|
+
e.indexOf(".") > -1 && (o = e.split("."), i = s, s = t, t = o[1]), this.addNamespaces(t);
|
|
265
|
+
let l = ee(this.data, o) || {};
|
|
266
|
+
a.skipCopy || (s = JSON.parse(JSON.stringify(s))), i ? Fe(l, s, n) : l = {
|
|
267
|
+
...l,
|
|
268
|
+
...s
|
|
269
|
+
}, Se(this.data, o, l), a.silent || this.emit("added", e, t, s);
|
|
270
|
+
}
|
|
271
|
+
removeResourceBundle(e, t) {
|
|
272
|
+
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
273
|
+
}
|
|
274
|
+
hasResourceBundle(e, t) {
|
|
275
|
+
return this.getResource(e, t) !== void 0;
|
|
276
|
+
}
|
|
277
|
+
getResourceBundle(e, t) {
|
|
278
|
+
return t || (t = this.options.defaultNS), this.getResource(e, t);
|
|
279
|
+
}
|
|
280
|
+
getDataByLanguage(e) {
|
|
281
|
+
return this.data[e];
|
|
282
|
+
}
|
|
283
|
+
hasLanguageSomeTranslations(e) {
|
|
284
|
+
const t = this.getDataByLanguage(e);
|
|
285
|
+
return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
|
|
286
|
+
}
|
|
287
|
+
toJSON() {
|
|
288
|
+
return this.data;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
var je = {
|
|
292
|
+
processors: {},
|
|
293
|
+
addPostProcessor(r) {
|
|
294
|
+
this.processors[r.name] = r;
|
|
295
|
+
},
|
|
296
|
+
handle(r, e, t, s, i) {
|
|
297
|
+
return r.forEach((n) => {
|
|
298
|
+
var a;
|
|
299
|
+
e = ((a = this.processors[n]) == null ? void 0 : a.process(e, t, s, i)) ?? e;
|
|
300
|
+
}), e;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const Le = {};
|
|
304
|
+
class ie extends ne {
|
|
305
|
+
constructor(e) {
|
|
306
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
307
|
+
super(), ze(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = E.create("translator");
|
|
308
|
+
}
|
|
309
|
+
changeLanguage(e) {
|
|
310
|
+
e && (this.language = e);
|
|
311
|
+
}
|
|
312
|
+
exists(e) {
|
|
313
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
314
|
+
interpolation: {}
|
|
315
|
+
};
|
|
316
|
+
if (e == null)
|
|
317
|
+
return !1;
|
|
318
|
+
const s = this.resolve(e, t);
|
|
319
|
+
return (s == null ? void 0 : s.res) !== void 0;
|
|
320
|
+
}
|
|
321
|
+
extractFromKey(e, t) {
|
|
322
|
+
let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
|
|
323
|
+
s === void 0 && (s = ":");
|
|
324
|
+
const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
325
|
+
let n = t.ns || this.options.defaultNS || [];
|
|
326
|
+
const a = s && e.indexOf(s) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Xe(e, s, i);
|
|
327
|
+
if (a && !o) {
|
|
328
|
+
const l = e.match(this.interpolator.nestingRegexp);
|
|
329
|
+
if (l && l.length > 0)
|
|
330
|
+
return {
|
|
331
|
+
key: e,
|
|
332
|
+
namespaces: d(n) ? [n] : n
|
|
333
|
+
};
|
|
334
|
+
const u = e.split(s);
|
|
335
|
+
(s !== i || s === i && this.options.ns.indexOf(u[0]) > -1) && (n = u.shift()), e = u.join(i);
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
key: e,
|
|
339
|
+
namespaces: d(n) ? [n] : n
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
translate(e, t, s) {
|
|
343
|
+
if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
|
|
344
|
+
...t
|
|
345
|
+
}), t || (t = {}), e == null) return "";
|
|
346
|
+
Array.isArray(e) || (e = [String(e)]);
|
|
347
|
+
const i = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
|
|
348
|
+
key: a,
|
|
349
|
+
namespaces: o
|
|
350
|
+
} = this.extractFromKey(e[e.length - 1], t), l = o[o.length - 1], u = t.lng || this.language, f = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
351
|
+
if ((u == null ? void 0 : u.toLowerCase()) === "cimode") {
|
|
352
|
+
if (f) {
|
|
353
|
+
const y = t.nsSeparator || this.options.nsSeparator;
|
|
354
|
+
return i ? {
|
|
355
|
+
res: `${l}${y}${a}`,
|
|
356
|
+
usedKey: a,
|
|
357
|
+
exactUsedKey: a,
|
|
358
|
+
usedLng: u,
|
|
359
|
+
usedNS: l,
|
|
360
|
+
usedParams: this.getUsedParamsDetails(t)
|
|
361
|
+
} : `${l}${y}${a}`;
|
|
362
|
+
}
|
|
363
|
+
return i ? {
|
|
364
|
+
res: a,
|
|
365
|
+
usedKey: a,
|
|
366
|
+
exactUsedKey: a,
|
|
367
|
+
usedLng: u,
|
|
368
|
+
usedNS: l,
|
|
369
|
+
usedParams: this.getUsedParamsDetails(t)
|
|
370
|
+
} : a;
|
|
371
|
+
}
|
|
372
|
+
const g = this.resolve(e, t);
|
|
373
|
+
let c = g == null ? void 0 : g.res;
|
|
374
|
+
const m = (g == null ? void 0 : g.usedKey) || a, h = (g == null ? void 0 : g.exactUsedKey) || a, p = Object.prototype.toString.apply(c), v = ["[object Number]", "[object Function]", "[object RegExp]"], L = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, P = !this.i18nFormat || this.i18nFormat.handleAsObject, M = !d(c) && typeof c != "boolean" && typeof c != "number";
|
|
375
|
+
if (P && c && M && v.indexOf(p) < 0 && !(d(L) && Array.isArray(c))) {
|
|
376
|
+
if (!t.returnObjects && !this.options.returnObjects) {
|
|
377
|
+
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
378
|
+
const y = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, c, {
|
|
379
|
+
...t,
|
|
380
|
+
ns: o
|
|
381
|
+
}) : `key '${a} (${this.language})' returned an object instead of string.`;
|
|
382
|
+
return i ? (g.res = y, g.usedParams = this.getUsedParamsDetails(t), g) : y;
|
|
383
|
+
}
|
|
384
|
+
if (n) {
|
|
385
|
+
const y = Array.isArray(c), C = y ? [] : {}, I = y ? h : m;
|
|
386
|
+
for (const x in c)
|
|
387
|
+
if (Object.prototype.hasOwnProperty.call(c, x)) {
|
|
388
|
+
const F = `${I}${n}${x}`;
|
|
389
|
+
C[x] = this.translate(F, {
|
|
390
|
+
...t,
|
|
391
|
+
joinArrays: !1,
|
|
392
|
+
ns: o
|
|
393
|
+
}), C[x] === F && (C[x] = c[x]);
|
|
394
|
+
}
|
|
395
|
+
c = C;
|
|
396
|
+
}
|
|
397
|
+
} else if (P && d(L) && Array.isArray(c))
|
|
398
|
+
c = c.join(L), c && (c = this.extendTranslation(c, e, t, s));
|
|
399
|
+
else {
|
|
400
|
+
let y = !1, C = !1;
|
|
401
|
+
const I = t.count !== void 0 && !d(t.count), x = ie.hasDefaultValue(t), F = I ? this.pluralResolver.getSuffix(u, t.count, t) : "", _ = t.ordinal && I ? this.pluralResolver.getSuffix(u, t.count, {
|
|
402
|
+
ordinal: !1
|
|
403
|
+
}) : "", j = I && !t.ordinal && t.count === 0, H = j && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${F}`] || t[`defaultValue${_}`] || t.defaultValue;
|
|
404
|
+
!this.isValidLookup(c) && x && (y = !0, c = H), this.isValidLookup(c) || (C = !0, c = a);
|
|
405
|
+
const Te = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && C ? void 0 : c, z = x && H !== c && this.options.updateMissing;
|
|
406
|
+
if (C || y || z) {
|
|
407
|
+
if (this.logger.log(z ? "updateKey" : "missingKey", u, l, a, z ? H : c), n) {
|
|
408
|
+
const R = this.resolve(a, {
|
|
409
|
+
...t,
|
|
410
|
+
keySeparator: !1
|
|
411
|
+
});
|
|
412
|
+
R && R.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.");
|
|
413
|
+
}
|
|
414
|
+
let B = [];
|
|
415
|
+
const q = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
|
|
416
|
+
if (this.options.saveMissingTo === "fallback" && q && q[0])
|
|
417
|
+
for (let R = 0; R < q.length; R++)
|
|
418
|
+
B.push(q[R]);
|
|
419
|
+
else this.options.saveMissingTo === "all" ? B = this.languageUtils.toResolveHierarchy(t.lng || this.language) : B.push(t.lng || this.language);
|
|
420
|
+
const de = (R, T, J) => {
|
|
421
|
+
var me;
|
|
422
|
+
const pe = x && J !== c ? J : Te;
|
|
423
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(R, l, T, pe, z, t) : (me = this.backendConnector) != null && me.saveMissing && this.backendConnector.saveMissing(R, l, T, pe, z, t), this.emit("missingKey", R, l, T, c);
|
|
424
|
+
};
|
|
425
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && I ? B.forEach((R) => {
|
|
426
|
+
const T = this.pluralResolver.getSuffixes(R, t);
|
|
427
|
+
j && t[`defaultValue${this.options.pluralSeparator}zero`] && T.indexOf(`${this.options.pluralSeparator}zero`) < 0 && T.push(`${this.options.pluralSeparator}zero`), T.forEach((J) => {
|
|
428
|
+
de([R], a + J, t[`defaultValue${J}`] || H);
|
|
429
|
+
});
|
|
430
|
+
}) : de(B, a, H));
|
|
431
|
+
}
|
|
432
|
+
c = this.extendTranslation(c, e, t, g, s), C && c === a && this.options.appendNamespaceToMissingKey && (c = `${l}:${a}`), (C || y) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}:${a}` : a, y ? c : void 0));
|
|
433
|
+
}
|
|
434
|
+
return i ? (g.res = c, g.usedParams = this.getUsedParamsDetails(t), g) : c;
|
|
435
|
+
}
|
|
436
|
+
extendTranslation(e, t, s, i, n) {
|
|
437
|
+
var u, f;
|
|
438
|
+
var a = this;
|
|
439
|
+
if ((u = this.i18nFormat) != null && u.parse)
|
|
440
|
+
e = this.i18nFormat.parse(e, {
|
|
441
|
+
...this.options.interpolation.defaultVariables,
|
|
442
|
+
...s
|
|
443
|
+
}, s.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
|
|
444
|
+
resolved: i
|
|
445
|
+
});
|
|
446
|
+
else if (!s.skipInterpolation) {
|
|
447
|
+
s.interpolation && this.interpolator.init({
|
|
448
|
+
...s,
|
|
449
|
+
interpolation: {
|
|
450
|
+
...this.options.interpolation,
|
|
451
|
+
...s.interpolation
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
const g = d(e) && (((f = s == null ? void 0 : s.interpolation) == null ? void 0 : f.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
455
|
+
let c;
|
|
456
|
+
if (g) {
|
|
457
|
+
const h = e.match(this.interpolator.nestingRegexp);
|
|
458
|
+
c = h && h.length;
|
|
459
|
+
}
|
|
460
|
+
let m = s.replace && !d(s.replace) ? s.replace : s;
|
|
461
|
+
if (this.options.interpolation.defaultVariables && (m = {
|
|
462
|
+
...this.options.interpolation.defaultVariables,
|
|
463
|
+
...m
|
|
464
|
+
}), e = this.interpolator.interpolate(e, m, s.lng || this.language || i.usedLng, s), g) {
|
|
465
|
+
const h = e.match(this.interpolator.nestingRegexp), p = h && h.length;
|
|
466
|
+
c < p && (s.nest = !1);
|
|
467
|
+
}
|
|
468
|
+
!s.lng && i && i.res && (s.lng = this.language || i.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
|
|
469
|
+
for (var h = arguments.length, p = new Array(h), v = 0; v < h; v++)
|
|
470
|
+
p[v] = arguments[v];
|
|
471
|
+
return (n == null ? void 0 : n[0]) === p[0] && !s.context ? (a.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`), null) : a.translate(...p, t);
|
|
472
|
+
}, s)), s.interpolation && this.interpolator.reset();
|
|
473
|
+
}
|
|
474
|
+
const o = s.postProcess || this.options.postProcess, l = d(o) ? [o] : o;
|
|
475
|
+
return e != null && (l != null && l.length) && s.applyPostProcessor !== !1 && (e = je.handle(l, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
476
|
+
i18nResolved: {
|
|
477
|
+
...i,
|
|
478
|
+
usedParams: this.getUsedParamsDetails(s)
|
|
479
|
+
},
|
|
480
|
+
...s
|
|
481
|
+
} : s, this)), e;
|
|
482
|
+
}
|
|
483
|
+
resolve(e) {
|
|
484
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, i, n, a, o;
|
|
485
|
+
return d(e) && (e = [e]), e.forEach((l) => {
|
|
486
|
+
if (this.isValidLookup(s)) return;
|
|
487
|
+
const u = this.extractFromKey(l, t), f = u.key;
|
|
488
|
+
i = f;
|
|
489
|
+
let g = u.namespaces;
|
|
490
|
+
this.options.fallbackNS && (g = g.concat(this.options.fallbackNS));
|
|
491
|
+
const c = t.count !== void 0 && !d(t.count), m = c && !t.ordinal && t.count === 0, h = t.context !== void 0 && (d(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
492
|
+
g.forEach((v) => {
|
|
493
|
+
var L, P;
|
|
494
|
+
this.isValidLookup(s) || (o = v, !Le[`${p[0]}-${v}`] && ((L = this.utils) != null && L.hasLoadedNamespace) && !((P = this.utils) != null && P.hasLoadedNamespace(o)) && (Le[`${p[0]}-${v}`] = !0, this.logger.warn(`key "${i}" 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((M) => {
|
|
495
|
+
var I;
|
|
496
|
+
if (this.isValidLookup(s)) return;
|
|
497
|
+
a = M;
|
|
498
|
+
const y = [f];
|
|
499
|
+
if ((I = this.i18nFormat) != null && I.addLookupKeys)
|
|
500
|
+
this.i18nFormat.addLookupKeys(y, f, M, v, t);
|
|
501
|
+
else {
|
|
502
|
+
let x;
|
|
503
|
+
c && (x = this.pluralResolver.getSuffix(M, t.count, t));
|
|
504
|
+
const F = `${this.options.pluralSeparator}zero`, _ = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
505
|
+
if (c && (y.push(f + x), t.ordinal && x.indexOf(_) === 0 && y.push(f + x.replace(_, this.options.pluralSeparator)), m && y.push(f + F)), h) {
|
|
506
|
+
const j = `${f}${this.options.contextSeparator}${t.context}`;
|
|
507
|
+
y.push(j), c && (y.push(j + x), t.ordinal && x.indexOf(_) === 0 && y.push(j + x.replace(_, this.options.pluralSeparator)), m && y.push(j + F));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
let C;
|
|
511
|
+
for (; C = y.pop(); )
|
|
512
|
+
this.isValidLookup(s) || (n = C, s = this.getResource(M, v, C, t));
|
|
513
|
+
}));
|
|
514
|
+
});
|
|
515
|
+
}), {
|
|
516
|
+
res: s,
|
|
517
|
+
usedKey: i,
|
|
518
|
+
exactUsedKey: n,
|
|
519
|
+
usedLng: a,
|
|
520
|
+
usedNS: o
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
isValidLookup(e) {
|
|
524
|
+
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
525
|
+
}
|
|
526
|
+
getResource(e, t, s) {
|
|
527
|
+
var n;
|
|
528
|
+
let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
529
|
+
return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t, s, i) : this.resourceStore.getResource(e, t, s, i);
|
|
530
|
+
}
|
|
531
|
+
getUsedParamsDetails() {
|
|
532
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
533
|
+
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !d(e.replace);
|
|
534
|
+
let i = s ? e.replace : e;
|
|
535
|
+
if (s && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
|
|
536
|
+
...this.options.interpolation.defaultVariables,
|
|
537
|
+
...i
|
|
538
|
+
}), !s) {
|
|
539
|
+
i = {
|
|
540
|
+
...i
|
|
541
|
+
};
|
|
542
|
+
for (const n of t)
|
|
543
|
+
delete i[n];
|
|
544
|
+
}
|
|
545
|
+
return i;
|
|
546
|
+
}
|
|
547
|
+
static hasDefaultValue(e) {
|
|
548
|
+
const t = "defaultValue";
|
|
549
|
+
for (const s in e)
|
|
550
|
+
if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
|
|
551
|
+
return !0;
|
|
552
|
+
return !1;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
class Re {
|
|
556
|
+
constructor(e) {
|
|
557
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = E.create("languageUtils");
|
|
558
|
+
}
|
|
559
|
+
getScriptPartFromCode(e) {
|
|
560
|
+
if (e = te(e), !e || e.indexOf("-") < 0) return null;
|
|
561
|
+
const t = e.split("-");
|
|
562
|
+
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
563
|
+
}
|
|
564
|
+
getLanguagePartFromCode(e) {
|
|
565
|
+
if (e = te(e), !e || e.indexOf("-") < 0) return e;
|
|
566
|
+
const t = e.split("-");
|
|
567
|
+
return this.formatLanguageCode(t[0]);
|
|
568
|
+
}
|
|
569
|
+
formatLanguageCode(e) {
|
|
570
|
+
if (d(e) && e.indexOf("-") > -1) {
|
|
571
|
+
let t;
|
|
572
|
+
try {
|
|
573
|
+
t = Intl.getCanonicalLocales(e)[0];
|
|
574
|
+
} catch {
|
|
575
|
+
}
|
|
576
|
+
return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
|
|
577
|
+
}
|
|
578
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
579
|
+
}
|
|
580
|
+
isSupportedCode(e) {
|
|
581
|
+
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
|
|
582
|
+
}
|
|
583
|
+
getBestMatchFromCodes(e) {
|
|
584
|
+
if (!e) return null;
|
|
585
|
+
let t;
|
|
586
|
+
return e.forEach((s) => {
|
|
587
|
+
if (t) return;
|
|
588
|
+
const i = this.formatLanguageCode(s);
|
|
589
|
+
(!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
|
|
590
|
+
}), !t && this.options.supportedLngs && e.forEach((s) => {
|
|
591
|
+
if (t) return;
|
|
592
|
+
const i = this.getLanguagePartFromCode(s);
|
|
593
|
+
if (this.isSupportedCode(i)) return t = i;
|
|
594
|
+
t = this.options.supportedLngs.find((n) => {
|
|
595
|
+
if (n === i) return n;
|
|
596
|
+
if (!(n.indexOf("-") < 0 && i.indexOf("-") < 0) && (n.indexOf("-") > 0 && i.indexOf("-") < 0 && n.substring(0, n.indexOf("-")) === i || n.indexOf(i) === 0 && i.length > 1))
|
|
597
|
+
return n;
|
|
598
|
+
});
|
|
599
|
+
}), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
|
|
600
|
+
}
|
|
601
|
+
getFallbackCodes(e, t) {
|
|
602
|
+
if (!e) return [];
|
|
603
|
+
if (typeof e == "function" && (e = e(t)), d(e) && (e = [e]), Array.isArray(e)) return e;
|
|
604
|
+
if (!t) return e.default || [];
|
|
605
|
+
let s = e[t];
|
|
606
|
+
return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
|
|
607
|
+
}
|
|
608
|
+
toResolveHierarchy(e, t) {
|
|
609
|
+
const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), i = [], n = (a) => {
|
|
610
|
+
a && (this.isSupportedCode(a) ? i.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`));
|
|
611
|
+
};
|
|
612
|
+
return d(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && n(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && n(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && n(this.getLanguagePartFromCode(e))) : d(e) && n(this.formatLanguageCode(e)), s.forEach((a) => {
|
|
613
|
+
i.indexOf(a) < 0 && n(this.formatLanguageCode(a));
|
|
614
|
+
}), i;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const we = {
|
|
618
|
+
zero: 0,
|
|
619
|
+
one: 1,
|
|
620
|
+
two: 2,
|
|
621
|
+
few: 3,
|
|
622
|
+
many: 4,
|
|
623
|
+
other: 5
|
|
624
|
+
}, Pe = {
|
|
625
|
+
select: (r) => r === 1 ? "one" : "other",
|
|
626
|
+
resolvedOptions: () => ({
|
|
627
|
+
pluralCategories: ["one", "other"]
|
|
628
|
+
})
|
|
629
|
+
};
|
|
630
|
+
class tt {
|
|
631
|
+
constructor(e) {
|
|
632
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
633
|
+
this.languageUtils = e, this.options = t, this.logger = E.create("pluralResolver"), this.pluralRulesCache = {};
|
|
634
|
+
}
|
|
635
|
+
addRule(e, t) {
|
|
636
|
+
this.rules[e] = t;
|
|
637
|
+
}
|
|
638
|
+
clearCache() {
|
|
639
|
+
this.pluralRulesCache = {};
|
|
640
|
+
}
|
|
641
|
+
getRule(e) {
|
|
642
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
643
|
+
const s = te(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
|
|
644
|
+
cleanedCode: s,
|
|
645
|
+
type: i
|
|
646
|
+
});
|
|
647
|
+
if (n in this.pluralRulesCache)
|
|
648
|
+
return this.pluralRulesCache[n];
|
|
649
|
+
let a;
|
|
650
|
+
try {
|
|
651
|
+
a = new Intl.PluralRules(s, {
|
|
652
|
+
type: i
|
|
653
|
+
});
|
|
654
|
+
} catch {
|
|
655
|
+
if (!Intl)
|
|
656
|
+
return this.logger.error("No Intl support, please use an Intl polyfill!"), Pe;
|
|
657
|
+
if (!e.match(/-|_/)) return Pe;
|
|
658
|
+
const l = this.languageUtils.getLanguagePartFromCode(e);
|
|
659
|
+
a = this.getRule(l, t);
|
|
660
|
+
}
|
|
661
|
+
return this.pluralRulesCache[n] = a, a;
|
|
662
|
+
}
|
|
663
|
+
needsPlural(e) {
|
|
664
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
|
|
665
|
+
return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
|
|
666
|
+
}
|
|
667
|
+
getPluralFormsOfKey(e, t) {
|
|
668
|
+
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
669
|
+
return this.getSuffixes(e, s).map((i) => `${t}${i}`);
|
|
670
|
+
}
|
|
671
|
+
getSuffixes(e) {
|
|
672
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
|
|
673
|
+
return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((i, n) => we[i] - we[n]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
|
|
674
|
+
}
|
|
675
|
+
getSuffix(e, t) {
|
|
676
|
+
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
677
|
+
const i = this.getRule(e, s);
|
|
678
|
+
return i ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s));
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
const $e = function(r, e, t) {
|
|
682
|
+
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, n = We(r, e, t);
|
|
683
|
+
return !n && i && d(t) && (n = ce(r, t, s), n === void 0 && (n = ce(e, t, s))), n;
|
|
684
|
+
}, ae = (r) => r.replace(/\$/g, "$$$$");
|
|
685
|
+
class st {
|
|
686
|
+
constructor() {
|
|
687
|
+
var t;
|
|
688
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
689
|
+
this.logger = E.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((s) => s), this.init(e);
|
|
690
|
+
}
|
|
691
|
+
init() {
|
|
692
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
693
|
+
e.interpolation || (e.interpolation = {
|
|
694
|
+
escapeValue: !0
|
|
695
|
+
});
|
|
696
|
+
const {
|
|
697
|
+
escape: t,
|
|
698
|
+
escapeValue: s,
|
|
699
|
+
useRawValueToEscape: i,
|
|
700
|
+
prefix: n,
|
|
701
|
+
prefixEscaped: a,
|
|
702
|
+
suffix: o,
|
|
703
|
+
suffixEscaped: l,
|
|
704
|
+
formatSeparator: u,
|
|
705
|
+
unescapeSuffix: f,
|
|
706
|
+
unescapePrefix: g,
|
|
707
|
+
nestingPrefix: c,
|
|
708
|
+
nestingPrefixEscaped: m,
|
|
709
|
+
nestingSuffix: h,
|
|
710
|
+
nestingSuffixEscaped: p,
|
|
711
|
+
nestingOptionsSeparator: v,
|
|
712
|
+
maxReplaces: L,
|
|
713
|
+
alwaysFormat: P
|
|
714
|
+
} = e.interpolation;
|
|
715
|
+
this.escape = t !== void 0 ? t : Ge, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = n ? U(n) : a || "{{", this.suffix = o ? U(o) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = f ? "" : g || "-", this.unescapeSuffix = this.unescapePrefix ? "" : f || "", this.nestingPrefix = c ? U(c) : m || U("$t("), this.nestingSuffix = h ? U(h) : p || U(")"), this.nestingOptionsSeparator = v || ",", this.maxReplaces = L || 1e3, this.alwaysFormat = P !== void 0 ? P : !1, this.resetRegExp();
|
|
716
|
+
}
|
|
717
|
+
reset() {
|
|
718
|
+
this.options && this.init(this.options);
|
|
719
|
+
}
|
|
720
|
+
resetRegExp() {
|
|
721
|
+
const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
|
|
722
|
+
this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
|
|
723
|
+
}
|
|
724
|
+
interpolate(e, t, s, i) {
|
|
725
|
+
var m;
|
|
726
|
+
let n, a, o;
|
|
727
|
+
const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (h) => {
|
|
728
|
+
if (h.indexOf(this.formatSeparator) < 0) {
|
|
729
|
+
const P = $e(t, l, h, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
730
|
+
return this.alwaysFormat ? this.format(P, void 0, s, {
|
|
731
|
+
...i,
|
|
732
|
+
...t,
|
|
733
|
+
interpolationkey: h
|
|
734
|
+
}) : P;
|
|
735
|
+
}
|
|
736
|
+
const p = h.split(this.formatSeparator), v = p.shift().trim(), L = p.join(this.formatSeparator).trim();
|
|
737
|
+
return this.format($e(t, l, v, this.options.keySeparator, this.options.ignoreJSONStructure), L, s, {
|
|
738
|
+
...i,
|
|
739
|
+
...t,
|
|
740
|
+
interpolationkey: v
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
this.resetRegExp();
|
|
744
|
+
const f = (i == null ? void 0 : i.missingInterpolationHandler) || this.options.missingInterpolationHandler, g = ((m = i == null ? void 0 : i.interpolation) == null ? void 0 : m.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
745
|
+
return [{
|
|
746
|
+
regex: this.regexpUnescape,
|
|
747
|
+
safeValue: (h) => ae(h)
|
|
748
|
+
}, {
|
|
749
|
+
regex: this.regexp,
|
|
750
|
+
safeValue: (h) => this.escapeValue ? ae(this.escape(h)) : ae(h)
|
|
751
|
+
}].forEach((h) => {
|
|
752
|
+
for (o = 0; n = h.regex.exec(e); ) {
|
|
753
|
+
const p = n[1].trim();
|
|
754
|
+
if (a = u(p), a === void 0)
|
|
755
|
+
if (typeof f == "function") {
|
|
756
|
+
const L = f(e, n, i);
|
|
757
|
+
a = d(L) ? L : "";
|
|
758
|
+
} else if (i && Object.prototype.hasOwnProperty.call(i, p))
|
|
759
|
+
a = "";
|
|
760
|
+
else if (g) {
|
|
761
|
+
a = n[0];
|
|
762
|
+
continue;
|
|
763
|
+
} else
|
|
764
|
+
this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), a = "";
|
|
765
|
+
else !d(a) && !this.useRawValueToEscape && (a = xe(a));
|
|
766
|
+
const v = h.safeValue(a);
|
|
767
|
+
if (e = e.replace(n[0], v), g ? (h.regex.lastIndex += a.length, h.regex.lastIndex -= n[0].length) : h.regex.lastIndex = 0, o++, o >= this.maxReplaces)
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
}), e;
|
|
771
|
+
}
|
|
772
|
+
nest(e, t) {
|
|
773
|
+
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, n, a;
|
|
774
|
+
const o = (l, u) => {
|
|
775
|
+
const f = this.nestingOptionsSeparator;
|
|
776
|
+
if (l.indexOf(f) < 0) return l;
|
|
777
|
+
const g = l.split(new RegExp(`${f}[ ]*{`));
|
|
778
|
+
let c = `{${g[1]}`;
|
|
779
|
+
l = g[0], c = this.interpolate(c, a);
|
|
780
|
+
const m = c.match(/'/g), h = c.match(/"/g);
|
|
781
|
+
(((m == null ? void 0 : m.length) ?? 0) % 2 === 0 && !h || h.length % 2 !== 0) && (c = c.replace(/'/g, '"'));
|
|
782
|
+
try {
|
|
783
|
+
a = JSON.parse(c), u && (a = {
|
|
784
|
+
...u,
|
|
785
|
+
...a
|
|
786
|
+
});
|
|
787
|
+
} catch (p) {
|
|
788
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${l}`, p), `${l}${f}${c}`;
|
|
789
|
+
}
|
|
790
|
+
return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, l;
|
|
791
|
+
};
|
|
792
|
+
for (; i = this.nestingRegexp.exec(e); ) {
|
|
793
|
+
let l = [];
|
|
794
|
+
a = {
|
|
795
|
+
...s
|
|
796
|
+
}, a = a.replace && !d(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
797
|
+
let u = !1;
|
|
798
|
+
if (i[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(i[1])) {
|
|
799
|
+
const f = i[1].split(this.formatSeparator).map((g) => g.trim());
|
|
800
|
+
i[1] = f.shift(), l = f, u = !0;
|
|
801
|
+
}
|
|
802
|
+
if (n = t(o.call(this, i[1].trim(), a), a), n && i[0] === e && !d(n)) return n;
|
|
803
|
+
d(n) || (n = xe(n)), n || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), n = ""), u && (n = l.reduce((f, g) => this.format(f, g, s.lng, {
|
|
804
|
+
...s,
|
|
805
|
+
interpolationkey: i[1].trim()
|
|
806
|
+
}), n.trim())), e = e.replace(i[0], n), this.regexp.lastIndex = 0;
|
|
807
|
+
}
|
|
808
|
+
return e;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
const it = (r) => {
|
|
812
|
+
let e = r.toLowerCase().trim();
|
|
813
|
+
const t = {};
|
|
814
|
+
if (r.indexOf("(") > -1) {
|
|
815
|
+
const s = r.split("(");
|
|
816
|
+
e = s[0].toLowerCase().trim();
|
|
817
|
+
const i = s[1].substring(0, s[1].length - 1);
|
|
818
|
+
e === "currency" && i.indexOf(":") < 0 ? t.currency || (t.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? t.range || (t.range = i.trim()) : i.split(";").forEach((a) => {
|
|
819
|
+
if (a) {
|
|
820
|
+
const [o, ...l] = a.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), f = o.trim();
|
|
821
|
+
t[f] || (t[f] = u), u === "false" && (t[f] = !1), u === "true" && (t[f] = !0), isNaN(u) || (t[f] = parseInt(u, 10));
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
return {
|
|
826
|
+
formatName: e,
|
|
827
|
+
formatOptions: t
|
|
828
|
+
};
|
|
829
|
+
}, K = (r) => {
|
|
830
|
+
const e = {};
|
|
831
|
+
return (t, s, i) => {
|
|
832
|
+
let n = i;
|
|
833
|
+
i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (n = {
|
|
834
|
+
...n,
|
|
835
|
+
[i.interpolationkey]: void 0
|
|
836
|
+
});
|
|
837
|
+
const a = s + JSON.stringify(n);
|
|
838
|
+
let o = e[a];
|
|
839
|
+
return o || (o = r(te(s), i), e[a] = o), o(t);
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
class nt {
|
|
843
|
+
constructor() {
|
|
844
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
845
|
+
this.logger = E.create("formatter"), this.options = e, this.formats = {
|
|
846
|
+
number: K((t, s) => {
|
|
847
|
+
const i = new Intl.NumberFormat(t, {
|
|
848
|
+
...s
|
|
849
|
+
});
|
|
850
|
+
return (n) => i.format(n);
|
|
851
|
+
}),
|
|
852
|
+
currency: K((t, s) => {
|
|
853
|
+
const i = new Intl.NumberFormat(t, {
|
|
854
|
+
...s,
|
|
855
|
+
style: "currency"
|
|
856
|
+
});
|
|
857
|
+
return (n) => i.format(n);
|
|
858
|
+
}),
|
|
859
|
+
datetime: K((t, s) => {
|
|
860
|
+
const i = new Intl.DateTimeFormat(t, {
|
|
861
|
+
...s
|
|
862
|
+
});
|
|
863
|
+
return (n) => i.format(n);
|
|
864
|
+
}),
|
|
865
|
+
relativetime: K((t, s) => {
|
|
866
|
+
const i = new Intl.RelativeTimeFormat(t, {
|
|
867
|
+
...s
|
|
868
|
+
});
|
|
869
|
+
return (n) => i.format(n, s.range || "day");
|
|
870
|
+
}),
|
|
871
|
+
list: K((t, s) => {
|
|
872
|
+
const i = new Intl.ListFormat(t, {
|
|
873
|
+
...s
|
|
874
|
+
});
|
|
875
|
+
return (n) => i.format(n);
|
|
876
|
+
})
|
|
877
|
+
}, this.init(e);
|
|
878
|
+
}
|
|
879
|
+
init(e) {
|
|
880
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
881
|
+
interpolation: {}
|
|
882
|
+
};
|
|
883
|
+
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
884
|
+
}
|
|
885
|
+
add(e, t) {
|
|
886
|
+
this.formats[e.toLowerCase().trim()] = t;
|
|
887
|
+
}
|
|
888
|
+
addCached(e, t) {
|
|
889
|
+
this.formats[e.toLowerCase().trim()] = K(t);
|
|
890
|
+
}
|
|
891
|
+
format(e, t, s) {
|
|
892
|
+
let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
893
|
+
const n = t.split(this.formatSeparator);
|
|
894
|
+
if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((o) => o.indexOf(")") > -1)) {
|
|
895
|
+
const o = n.findIndex((l) => l.indexOf(")") > -1);
|
|
896
|
+
n[0] = [n[0], ...n.splice(1, o)].join(this.formatSeparator);
|
|
897
|
+
}
|
|
898
|
+
return n.reduce((o, l) => {
|
|
899
|
+
var g;
|
|
900
|
+
const {
|
|
901
|
+
formatName: u,
|
|
902
|
+
formatOptions: f
|
|
903
|
+
} = it(l);
|
|
904
|
+
if (this.formats[u]) {
|
|
905
|
+
let c = o;
|
|
906
|
+
try {
|
|
907
|
+
const m = ((g = i == null ? void 0 : i.formatParams) == null ? void 0 : g[i.interpolationkey]) || {}, h = m.locale || m.lng || i.locale || i.lng || s;
|
|
908
|
+
c = this.formats[u](o, h, {
|
|
909
|
+
...f,
|
|
910
|
+
...i,
|
|
911
|
+
...m
|
|
912
|
+
});
|
|
913
|
+
} catch (m) {
|
|
914
|
+
this.logger.warn(m);
|
|
915
|
+
}
|
|
916
|
+
return c;
|
|
917
|
+
} else
|
|
918
|
+
this.logger.warn(`there was no format function for ${u}`);
|
|
919
|
+
return o;
|
|
920
|
+
}, e);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
const rt = (r, e) => {
|
|
924
|
+
r.pending[e] !== void 0 && (delete r.pending[e], r.pendingCount--);
|
|
925
|
+
};
|
|
926
|
+
class at extends ne {
|
|
927
|
+
constructor(e, t, s) {
|
|
928
|
+
var n, a;
|
|
929
|
+
let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
930
|
+
super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = i, this.logger = E.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], (a = (n = this.backend) == null ? void 0 : n.init) == null || a.call(n, s, i.backend, i);
|
|
931
|
+
}
|
|
932
|
+
queueLoad(e, t, s, i) {
|
|
933
|
+
const n = {}, a = {}, o = {}, l = {};
|
|
934
|
+
return e.forEach((u) => {
|
|
935
|
+
let f = !0;
|
|
936
|
+
t.forEach((g) => {
|
|
937
|
+
const c = `${u}|${g}`;
|
|
938
|
+
!s.reload && this.store.hasResourceBundle(u, g) ? this.state[c] = 2 : this.state[c] < 0 || (this.state[c] === 1 ? a[c] === void 0 && (a[c] = !0) : (this.state[c] = 1, f = !1, a[c] === void 0 && (a[c] = !0), n[c] === void 0 && (n[c] = !0), l[g] === void 0 && (l[g] = !0)));
|
|
939
|
+
}), f || (o[u] = !0);
|
|
940
|
+
}), (Object.keys(n).length || Object.keys(a).length) && this.queue.push({
|
|
941
|
+
pending: a,
|
|
942
|
+
pendingCount: Object.keys(a).length,
|
|
943
|
+
loaded: {},
|
|
944
|
+
errors: [],
|
|
945
|
+
callback: i
|
|
946
|
+
}), {
|
|
947
|
+
toLoad: Object.keys(n),
|
|
948
|
+
pending: Object.keys(a),
|
|
949
|
+
toLoadLanguages: Object.keys(o),
|
|
950
|
+
toLoadNamespaces: Object.keys(l)
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
loaded(e, t, s) {
|
|
954
|
+
const i = e.split("|"), n = i[0], a = i[1];
|
|
955
|
+
t && this.emit("failedLoading", n, a, t), !t && s && this.store.addResourceBundle(n, a, s, void 0, void 0, {
|
|
956
|
+
skipCopy: !0
|
|
957
|
+
}), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
|
|
958
|
+
const o = {};
|
|
959
|
+
this.queue.forEach((l) => {
|
|
960
|
+
Je(l.loaded, [n], a), rt(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
|
|
961
|
+
o[u] || (o[u] = {});
|
|
962
|
+
const f = l.loaded[u];
|
|
963
|
+
f.length && f.forEach((g) => {
|
|
964
|
+
o[u][g] === void 0 && (o[u][g] = !0);
|
|
965
|
+
});
|
|
966
|
+
}), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
|
|
967
|
+
}), this.emit("loaded", o), this.queue = this.queue.filter((l) => !l.done);
|
|
968
|
+
}
|
|
969
|
+
read(e, t, s) {
|
|
970
|
+
let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0;
|
|
971
|
+
if (!e.length) return a(null, {});
|
|
972
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
973
|
+
this.waitingReads.push({
|
|
974
|
+
lng: e,
|
|
975
|
+
ns: t,
|
|
976
|
+
fcName: s,
|
|
977
|
+
tried: i,
|
|
978
|
+
wait: n,
|
|
979
|
+
callback: a
|
|
980
|
+
});
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
this.readingCalls++;
|
|
984
|
+
const o = (u, f) => {
|
|
985
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
986
|
+
const g = this.waitingReads.shift();
|
|
987
|
+
this.read(g.lng, g.ns, g.fcName, g.tried, g.wait, g.callback);
|
|
988
|
+
}
|
|
989
|
+
if (u && f && i < this.maxRetries) {
|
|
990
|
+
setTimeout(() => {
|
|
991
|
+
this.read.call(this, e, t, s, i + 1, n * 2, a);
|
|
992
|
+
}, n);
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
a(u, f);
|
|
996
|
+
}, l = this.backend[s].bind(this.backend);
|
|
997
|
+
if (l.length === 2) {
|
|
998
|
+
try {
|
|
999
|
+
const u = l(e, t);
|
|
1000
|
+
u && typeof u.then == "function" ? u.then((f) => o(null, f)).catch(o) : o(null, u);
|
|
1001
|
+
} catch (u) {
|
|
1002
|
+
o(u);
|
|
1003
|
+
}
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
return l(e, t, o);
|
|
1007
|
+
}
|
|
1008
|
+
prepareLoading(e, t) {
|
|
1009
|
+
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 ? arguments[3] : void 0;
|
|
1010
|
+
if (!this.backend)
|
|
1011
|
+
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
|
|
1012
|
+
d(e) && (e = this.languageUtils.toResolveHierarchy(e)), d(t) && (t = [t]);
|
|
1013
|
+
const n = this.queueLoad(e, t, s, i);
|
|
1014
|
+
if (!n.toLoad.length)
|
|
1015
|
+
return n.pending.length || i(), null;
|
|
1016
|
+
n.toLoad.forEach((a) => {
|
|
1017
|
+
this.loadOne(a);
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
load(e, t, s) {
|
|
1021
|
+
this.prepareLoading(e, t, {}, s);
|
|
1022
|
+
}
|
|
1023
|
+
reload(e, t, s) {
|
|
1024
|
+
this.prepareLoading(e, t, {
|
|
1025
|
+
reload: !0
|
|
1026
|
+
}, s);
|
|
1027
|
+
}
|
|
1028
|
+
loadOne(e) {
|
|
1029
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
1030
|
+
const s = e.split("|"), i = s[0], n = s[1];
|
|
1031
|
+
this.read(i, n, "read", void 0, void 0, (a, o) => {
|
|
1032
|
+
a && this.logger.warn(`${t}loading namespace ${n} for language ${i} failed`, a), !a && o && this.logger.log(`${t}loaded namespace ${n} for language ${i}`, o), this.loaded(e, a, o);
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
saveMissing(e, t, s, i, n) {
|
|
1036
|
+
var l, u, f, g, c;
|
|
1037
|
+
let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
|
|
1038
|
+
};
|
|
1039
|
+
if ((u = (l = this.services) == null ? void 0 : l.utils) != null && u.hasLoadedNamespace && !((g = (f = this.services) == null ? void 0 : f.utils) != null && g.hasLoadedNamespace(t))) {
|
|
1040
|
+
this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
if (!(s == null || s === "")) {
|
|
1044
|
+
if ((c = this.backend) != null && c.create) {
|
|
1045
|
+
const m = {
|
|
1046
|
+
...a,
|
|
1047
|
+
isUpdate: n
|
|
1048
|
+
}, h = this.backend.create.bind(this.backend);
|
|
1049
|
+
if (h.length < 6)
|
|
1050
|
+
try {
|
|
1051
|
+
let p;
|
|
1052
|
+
h.length === 5 ? p = h(e, t, s, i, m) : p = h(e, t, s, i), p && typeof p.then == "function" ? p.then((v) => o(null, v)).catch(o) : o(null, p);
|
|
1053
|
+
} catch (p) {
|
|
1054
|
+
o(p);
|
|
1055
|
+
}
|
|
1056
|
+
else
|
|
1057
|
+
h(e, t, s, i, o, m);
|
|
1058
|
+
}
|
|
1059
|
+
!e || !e[0] || this.store.addResource(e[0], t, s, i);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
const Ne = () => ({
|
|
1064
|
+
debug: !1,
|
|
1065
|
+
initAsync: !0,
|
|
1066
|
+
ns: ["translation"],
|
|
1067
|
+
defaultNS: ["translation"],
|
|
1068
|
+
fallbackLng: ["dev"],
|
|
1069
|
+
fallbackNS: !1,
|
|
1070
|
+
supportedLngs: !1,
|
|
1071
|
+
nonExplicitSupportedLngs: !1,
|
|
1072
|
+
load: "all",
|
|
1073
|
+
preload: !1,
|
|
1074
|
+
simplifyPluralSuffix: !0,
|
|
1075
|
+
keySeparator: ".",
|
|
1076
|
+
nsSeparator: ":",
|
|
1077
|
+
pluralSeparator: "_",
|
|
1078
|
+
contextSeparator: "_",
|
|
1079
|
+
partialBundledLanguages: !1,
|
|
1080
|
+
saveMissing: !1,
|
|
1081
|
+
updateMissing: !1,
|
|
1082
|
+
saveMissingTo: "fallback",
|
|
1083
|
+
saveMissingPlurals: !0,
|
|
1084
|
+
missingKeyHandler: !1,
|
|
1085
|
+
missingInterpolationHandler: !1,
|
|
1086
|
+
postProcess: !1,
|
|
1087
|
+
postProcessPassResolved: !1,
|
|
1088
|
+
returnNull: !1,
|
|
1089
|
+
returnEmptyString: !0,
|
|
1090
|
+
returnObjects: !1,
|
|
1091
|
+
joinArrays: !1,
|
|
1092
|
+
returnedObjectHandler: !1,
|
|
1093
|
+
parseMissingKeyHandler: !1,
|
|
1094
|
+
appendNamespaceToMissingKey: !1,
|
|
1095
|
+
appendNamespaceToCIMode: !1,
|
|
1096
|
+
overloadTranslationOptionHandler: (r) => {
|
|
1097
|
+
let e = {};
|
|
1098
|
+
if (typeof r[1] == "object" && (e = r[1]), d(r[1]) && (e.defaultValue = r[1]), d(r[2]) && (e.tDescription = r[2]), typeof r[2] == "object" || typeof r[3] == "object") {
|
|
1099
|
+
const t = r[3] || r[2];
|
|
1100
|
+
Object.keys(t).forEach((s) => {
|
|
1101
|
+
e[s] = t[s];
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
return e;
|
|
1105
|
+
},
|
|
1106
|
+
interpolation: {
|
|
1107
|
+
escapeValue: !0,
|
|
1108
|
+
format: (r) => r,
|
|
1109
|
+
prefix: "{{",
|
|
1110
|
+
suffix: "}}",
|
|
1111
|
+
formatSeparator: ",",
|
|
1112
|
+
unescapePrefix: "-",
|
|
1113
|
+
nestingPrefix: "$t(",
|
|
1114
|
+
nestingSuffix: ")",
|
|
1115
|
+
nestingOptionsSeparator: ",",
|
|
1116
|
+
maxReplaces: 1e3,
|
|
1117
|
+
skipOnVariables: !0
|
|
1118
|
+
}
|
|
1119
|
+
}), Ee = (r) => {
|
|
1120
|
+
var e, t;
|
|
1121
|
+
return d(r.ns) && (r.ns = [r.ns]), d(r.fallbackLng) && (r.fallbackLng = [r.fallbackLng]), d(r.fallbackNS) && (r.fallbackNS = [r.fallbackNS]), ((t = (e = r.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (r.supportedLngs = r.supportedLngs.concat(["cimode"])), typeof r.initImmediate == "boolean" && (r.initAsync = r.initImmediate), r;
|
|
1122
|
+
}, Q = () => {
|
|
1123
|
+
}, ot = (r) => {
|
|
1124
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((t) => {
|
|
1125
|
+
typeof r[t] == "function" && (r[t] = r[t].bind(r));
|
|
1126
|
+
});
|
|
1127
|
+
};
|
|
1128
|
+
class Z extends ne {
|
|
1129
|
+
constructor() {
|
|
1130
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
1131
|
+
if (super(), this.options = Ee(e), this.services = {}, this.logger = E, this.modules = {
|
|
1132
|
+
external: []
|
|
1133
|
+
}, ot(this), t && !this.isInitialized && !e.isClone) {
|
|
1134
|
+
if (!this.options.initAsync)
|
|
1135
|
+
return this.init(e, t), this;
|
|
1136
|
+
setTimeout(() => {
|
|
1137
|
+
this.init(e, t);
|
|
1138
|
+
}, 0);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
init() {
|
|
1142
|
+
var e = this;
|
|
1143
|
+
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
|
|
1144
|
+
this.isInitializing = !0, typeof t == "function" && (s = t, t = {}), t.defaultNS == null && t.ns && (d(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
|
|
1145
|
+
const i = Ne();
|
|
1146
|
+
this.options = {
|
|
1147
|
+
...i,
|
|
1148
|
+
...this.options,
|
|
1149
|
+
...Ee(t)
|
|
1150
|
+
}, this.options.interpolation = {
|
|
1151
|
+
...i.interpolation,
|
|
1152
|
+
...this.options.interpolation
|
|
1153
|
+
}, t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
|
|
1154
|
+
const n = (f) => f ? typeof f == "function" ? new f() : f : null;
|
|
1155
|
+
if (!this.options.isClone) {
|
|
1156
|
+
this.modules.logger ? E.init(n(this.modules.logger), this.options) : E.init(null, this.options);
|
|
1157
|
+
let f;
|
|
1158
|
+
this.modules.formatter ? f = this.modules.formatter : f = nt;
|
|
1159
|
+
const g = new Re(this.options);
|
|
1160
|
+
this.store = new Ce(this.options.resources, this.options);
|
|
1161
|
+
const c = this.services;
|
|
1162
|
+
c.logger = E, c.resourceStore = this.store, c.languageUtils = g, c.pluralResolver = new tt(g, {
|
|
1163
|
+
prepend: this.options.pluralSeparator,
|
|
1164
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1165
|
+
}), f && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (c.formatter = n(f), c.formatter.init(c, this.options), this.options.interpolation.format = c.formatter.format.bind(c.formatter)), c.interpolator = new st(this.options), c.utils = {
|
|
1166
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1167
|
+
}, c.backendConnector = new at(n(this.modules.backend), c.resourceStore, c, this.options), c.backendConnector.on("*", function(m) {
|
|
1168
|
+
for (var h = arguments.length, p = new Array(h > 1 ? h - 1 : 0), v = 1; v < h; v++)
|
|
1169
|
+
p[v - 1] = arguments[v];
|
|
1170
|
+
e.emit(m, ...p);
|
|
1171
|
+
}), this.modules.languageDetector && (c.languageDetector = n(this.modules.languageDetector), c.languageDetector.init && c.languageDetector.init(c, this.options.detection, this.options)), this.modules.i18nFormat && (c.i18nFormat = n(this.modules.i18nFormat), c.i18nFormat.init && c.i18nFormat.init(this)), this.translator = new ie(this.services, this.options), this.translator.on("*", function(m) {
|
|
1172
|
+
for (var h = arguments.length, p = new Array(h > 1 ? h - 1 : 0), v = 1; v < h; v++)
|
|
1173
|
+
p[v - 1] = arguments[v];
|
|
1174
|
+
e.emit(m, ...p);
|
|
1175
|
+
}), this.modules.external.forEach((m) => {
|
|
1176
|
+
m.init && m.init(this);
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
if (this.format = this.options.interpolation.format, s || (s = Q), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1180
|
+
const f = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1181
|
+
f.length > 0 && f[0] !== "dev" && (this.options.lng = f[0]);
|
|
1182
|
+
}
|
|
1183
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((f) => {
|
|
1184
|
+
this[f] = function() {
|
|
1185
|
+
return e.store[f](...arguments);
|
|
1186
|
+
};
|
|
1187
|
+
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((f) => {
|
|
1188
|
+
this[f] = function() {
|
|
1189
|
+
return e.store[f](...arguments), e;
|
|
1190
|
+
};
|
|
1191
|
+
});
|
|
1192
|
+
const l = W(), u = () => {
|
|
1193
|
+
const f = (g, c) => {
|
|
1194
|
+
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), l.resolve(c), s(g, c);
|
|
1195
|
+
};
|
|
1196
|
+
if (this.languages && !this.isInitialized) return f(null, this.t.bind(this));
|
|
1197
|
+
this.changeLanguage(this.options.lng, f);
|
|
1198
|
+
};
|
|
1199
|
+
return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), l;
|
|
1200
|
+
}
|
|
1201
|
+
loadResources(e) {
|
|
1202
|
+
var n, a;
|
|
1203
|
+
let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Q;
|
|
1204
|
+
const i = d(e) ? e : this.language;
|
|
1205
|
+
if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1206
|
+
if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
|
|
1207
|
+
const o = [], l = (u) => {
|
|
1208
|
+
if (!u || u === "cimode") return;
|
|
1209
|
+
this.services.languageUtils.toResolveHierarchy(u).forEach((g) => {
|
|
1210
|
+
g !== "cimode" && o.indexOf(g) < 0 && o.push(g);
|
|
1211
|
+
});
|
|
1212
|
+
};
|
|
1213
|
+
i ? l(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((f) => l(f)), (a = (n = this.options.preload) == null ? void 0 : n.forEach) == null || a.call(n, (u) => l(u)), this.services.backendConnector.load(o, this.options.ns, (u) => {
|
|
1214
|
+
!u && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(u);
|
|
1215
|
+
});
|
|
1216
|
+
} else
|
|
1217
|
+
s(null);
|
|
1218
|
+
}
|
|
1219
|
+
reloadResources(e, t, s) {
|
|
1220
|
+
const i = W();
|
|
1221
|
+
return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = Q), this.services.backendConnector.reload(e, t, (n) => {
|
|
1222
|
+
i.resolve(), s(n);
|
|
1223
|
+
}), i;
|
|
1224
|
+
}
|
|
1225
|
+
use(e) {
|
|
1226
|
+
if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1227
|
+
if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1228
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && je.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1229
|
+
}
|
|
1230
|
+
setResolvedLanguage(e) {
|
|
1231
|
+
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
|
|
1232
|
+
for (let t = 0; t < this.languages.length; t++) {
|
|
1233
|
+
const s = this.languages[t];
|
|
1234
|
+
if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
|
|
1235
|
+
this.resolvedLanguage = s;
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
changeLanguage(e, t) {
|
|
1241
|
+
var s = this;
|
|
1242
|
+
this.isLanguageChangingTo = e;
|
|
1243
|
+
const i = W();
|
|
1244
|
+
this.emit("languageChanging", e);
|
|
1245
|
+
const n = (l) => {
|
|
1246
|
+
this.language = l, this.languages = this.services.languageUtils.toResolveHierarchy(l), this.resolvedLanguage = void 0, this.setResolvedLanguage(l);
|
|
1247
|
+
}, a = (l, u) => {
|
|
1248
|
+
u ? (n(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, i.resolve(function() {
|
|
1249
|
+
return s.t(...arguments);
|
|
1250
|
+
}), t && t(l, function() {
|
|
1251
|
+
return s.t(...arguments);
|
|
1252
|
+
});
|
|
1253
|
+
}, o = (l) => {
|
|
1254
|
+
var f, g;
|
|
1255
|
+
!e && !l && this.services.languageDetector && (l = []);
|
|
1256
|
+
const u = d(l) ? l : this.services.languageUtils.getBestMatchFromCodes(l);
|
|
1257
|
+
u && (this.language || n(u), this.translator.language || this.translator.changeLanguage(u), (g = (f = this.services.languageDetector) == null ? void 0 : f.cacheUserLanguage) == null || g.call(f, u)), this.loadResources(u, (c) => {
|
|
1258
|
+
a(c, u);
|
|
1259
|
+
});
|
|
1260
|
+
};
|
|
1261
|
+
return !e && this.services.languageDetector && !this.services.languageDetector.async ? o(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(o) : this.services.languageDetector.detect(o) : o(e), i;
|
|
1262
|
+
}
|
|
1263
|
+
getFixedT(e, t, s) {
|
|
1264
|
+
var i = this;
|
|
1265
|
+
const n = function(a, o) {
|
|
1266
|
+
let l;
|
|
1267
|
+
if (typeof o != "object") {
|
|
1268
|
+
for (var u = arguments.length, f = new Array(u > 2 ? u - 2 : 0), g = 2; g < u; g++)
|
|
1269
|
+
f[g - 2] = arguments[g];
|
|
1270
|
+
l = i.options.overloadTranslationOptionHandler([a, o].concat(f));
|
|
1271
|
+
} else
|
|
1272
|
+
l = {
|
|
1273
|
+
...o
|
|
1274
|
+
};
|
|
1275
|
+
l.lng = l.lng || n.lng, l.lngs = l.lngs || n.lngs, l.ns = l.ns || n.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || s || n.keyPrefix);
|
|
1276
|
+
const c = i.options.keySeparator || ".";
|
|
1277
|
+
let m;
|
|
1278
|
+
return l.keyPrefix && Array.isArray(a) ? m = a.map((h) => `${l.keyPrefix}${c}${h}`) : m = l.keyPrefix ? `${l.keyPrefix}${c}${a}` : a, i.t(m, l);
|
|
1279
|
+
};
|
|
1280
|
+
return d(e) ? n.lng = e : n.lngs = e, n.ns = t, n.keyPrefix = s, n;
|
|
1281
|
+
}
|
|
1282
|
+
t() {
|
|
1283
|
+
var i;
|
|
1284
|
+
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
1285
|
+
t[s] = arguments[s];
|
|
1286
|
+
return (i = this.translator) == null ? void 0 : i.translate(...t);
|
|
1287
|
+
}
|
|
1288
|
+
exists() {
|
|
1289
|
+
var i;
|
|
1290
|
+
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
1291
|
+
t[s] = arguments[s];
|
|
1292
|
+
return (i = this.translator) == null ? void 0 : i.exists(...t);
|
|
1293
|
+
}
|
|
1294
|
+
setDefaultNamespace(e) {
|
|
1295
|
+
this.options.defaultNS = e;
|
|
1296
|
+
}
|
|
1297
|
+
hasLoadedNamespace(e) {
|
|
1298
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1299
|
+
if (!this.isInitialized)
|
|
1300
|
+
return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1301
|
+
if (!this.languages || !this.languages.length)
|
|
1302
|
+
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1303
|
+
const s = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
|
|
1304
|
+
if (s.toLowerCase() === "cimode") return !0;
|
|
1305
|
+
const a = (o, l) => {
|
|
1306
|
+
const u = this.services.backendConnector.state[`${o}|${l}`];
|
|
1307
|
+
return u === -1 || u === 0 || u === 2;
|
|
1308
|
+
};
|
|
1309
|
+
if (t.precheck) {
|
|
1310
|
+
const o = t.precheck(this, a);
|
|
1311
|
+
if (o !== void 0) return o;
|
|
1312
|
+
}
|
|
1313
|
+
return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(s, e) && (!i || a(n, e)));
|
|
1314
|
+
}
|
|
1315
|
+
loadNamespaces(e, t) {
|
|
1316
|
+
const s = W();
|
|
1317
|
+
return this.options.ns ? (d(e) && (e = [e]), e.forEach((i) => {
|
|
1318
|
+
this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
|
|
1319
|
+
}), this.loadResources((i) => {
|
|
1320
|
+
s.resolve(), t && t(i);
|
|
1321
|
+
}), s) : (t && t(), Promise.resolve());
|
|
1322
|
+
}
|
|
1323
|
+
loadLanguages(e, t) {
|
|
1324
|
+
const s = W();
|
|
1325
|
+
d(e) && (e = [e]);
|
|
1326
|
+
const i = this.options.preload || [], n = e.filter((a) => i.indexOf(a) < 0 && this.services.languageUtils.isSupportedCode(a));
|
|
1327
|
+
return n.length ? (this.options.preload = i.concat(n), this.loadResources((a) => {
|
|
1328
|
+
s.resolve(), t && t(a);
|
|
1329
|
+
}), s) : (t && t(), Promise.resolve());
|
|
1330
|
+
}
|
|
1331
|
+
dir(e) {
|
|
1332
|
+
var i, n;
|
|
1333
|
+
if (e || (e = this.resolvedLanguage || (((i = this.languages) == null ? void 0 : i.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
|
|
1334
|
+
const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], s = ((n = this.services) == null ? void 0 : n.languageUtils) || new Re(Ne());
|
|
1335
|
+
return t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1336
|
+
}
|
|
1337
|
+
static createInstance() {
|
|
1338
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
1339
|
+
return new Z(e, t);
|
|
1340
|
+
}
|
|
1341
|
+
cloneInstance() {
|
|
1342
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Q;
|
|
1343
|
+
const s = e.forkResourceStore;
|
|
1344
|
+
s && delete e.forkResourceStore;
|
|
1345
|
+
const i = {
|
|
1346
|
+
...this.options,
|
|
1347
|
+
...e,
|
|
1348
|
+
isClone: !0
|
|
1349
|
+
}, n = new Z(i);
|
|
1350
|
+
if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
|
|
1351
|
+
n[o] = this[o];
|
|
1352
|
+
}), n.services = {
|
|
1353
|
+
...this.services
|
|
1354
|
+
}, n.services.utils = {
|
|
1355
|
+
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1356
|
+
}, s) {
|
|
1357
|
+
const o = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
|
|
1358
|
+
...this.store.data[u]
|
|
1359
|
+
}, Object.keys(l[u]).reduce((f, g) => (f[g] = {
|
|
1360
|
+
...l[u][g]
|
|
1361
|
+
}, f), {})), {});
|
|
1362
|
+
n.store = new Ce(o, i), n.services.resourceStore = n.store;
|
|
1363
|
+
}
|
|
1364
|
+
return n.translator = new ie(n.services, i), n.translator.on("*", function(o) {
|
|
1365
|
+
for (var l = arguments.length, u = new Array(l > 1 ? l - 1 : 0), f = 1; f < l; f++)
|
|
1366
|
+
u[f - 1] = arguments[f];
|
|
1367
|
+
n.emit(o, ...u);
|
|
1368
|
+
}), n.init(i, t), n.translator.options = i, n.translator.backendConnector.services.utils = {
|
|
1369
|
+
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1370
|
+
}, n;
|
|
1371
|
+
}
|
|
1372
|
+
toJSON() {
|
|
1373
|
+
return {
|
|
1374
|
+
options: this.options,
|
|
1375
|
+
store: this.store,
|
|
1376
|
+
language: this.language,
|
|
1377
|
+
languages: this.languages,
|
|
1378
|
+
resolvedLanguage: this.resolvedLanguage
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
const O = Z.createInstance();
|
|
1383
|
+
O.createInstance = Z.createInstance;
|
|
1384
|
+
O.createInstance;
|
|
1385
|
+
O.dir;
|
|
1386
|
+
O.init;
|
|
1387
|
+
O.loadResources;
|
|
1388
|
+
O.reloadResources;
|
|
1389
|
+
O.use;
|
|
1390
|
+
O.changeLanguage;
|
|
1391
|
+
O.getFixedT;
|
|
1392
|
+
O.t;
|
|
1393
|
+
O.exists;
|
|
1394
|
+
O.setDefaultNamespace;
|
|
1395
|
+
O.hasLoadedNamespace;
|
|
1396
|
+
O.loadNamespaces;
|
|
1397
|
+
O.loadLanguages;
|
|
1398
|
+
var lt = (r, e) => typeof e == "bigint" ? e.toString() : e;
|
|
1399
|
+
function oe(r, e = " | ") {
|
|
1400
|
+
return r.map((t) => typeof t == "string" ? `'${t}'` : t).join(e);
|
|
1401
|
+
}
|
|
1402
|
+
var Ie = (r) => {
|
|
1403
|
+
if (typeof r != "object" || r === null)
|
|
1404
|
+
return !1;
|
|
1405
|
+
for (const e in r)
|
|
1406
|
+
if (!Object.prototype.hasOwnProperty.call(r, e))
|
|
1407
|
+
return !1;
|
|
1408
|
+
return !0;
|
|
1409
|
+
}, ut = (r, e) => {
|
|
1410
|
+
if (typeof r == "string")
|
|
1411
|
+
return { key: r, values: {} };
|
|
1412
|
+
if (Ie(r)) {
|
|
1413
|
+
const t = "key" in r && typeof r.key == "string" ? r.key : e, s = "values" in r && Ie(r.values) ? r.values : {};
|
|
1414
|
+
return { key: t, values: s };
|
|
1415
|
+
}
|
|
1416
|
+
return { key: e, values: {} };
|
|
1417
|
+
}, ke = "zod", ct = (r) => (e, t) => {
|
|
1418
|
+
var l;
|
|
1419
|
+
const { t: s, ns: i, handlePath: n } = {
|
|
1420
|
+
t: O.t,
|
|
1421
|
+
ns: ke,
|
|
1422
|
+
...r,
|
|
1423
|
+
handlePath: (r == null ? void 0 : r.handlePath) !== !1 ? {
|
|
1424
|
+
context: "with_path",
|
|
1425
|
+
ns: (r == null ? void 0 : r.ns) ?? ke,
|
|
1426
|
+
keyPrefix: void 0,
|
|
1427
|
+
...r == null ? void 0 : r.handlePath
|
|
1428
|
+
} : null
|
|
1429
|
+
};
|
|
1430
|
+
let a;
|
|
1431
|
+
a = Ue(e, t).message;
|
|
1432
|
+
const o = e.path.length > 0 && n ? {
|
|
1433
|
+
context: n.context,
|
|
1434
|
+
path: s(
|
|
1435
|
+
[n.keyPrefix, e.path.join(".")].filter(Boolean).join("."),
|
|
1436
|
+
{
|
|
1437
|
+
ns: n.ns,
|
|
1438
|
+
defaultValue: e.path.join(".")
|
|
1439
|
+
}
|
|
1440
|
+
)
|
|
1441
|
+
} : {};
|
|
1442
|
+
switch (e.code) {
|
|
1443
|
+
case S.invalid_type:
|
|
1444
|
+
e.received === ye.undefined ? a = s("errors.invalid_type_received_undefined", {
|
|
1445
|
+
ns: i,
|
|
1446
|
+
defaultValue: a,
|
|
1447
|
+
...o
|
|
1448
|
+
}) : e.received === ye.null ? a = s("errors.invalid_type_received_null", {
|
|
1449
|
+
ns: i,
|
|
1450
|
+
defaultValue: a,
|
|
1451
|
+
...o
|
|
1452
|
+
}) : a = s("errors.invalid_type", {
|
|
1453
|
+
expected: s(`types.${e.expected}`, {
|
|
1454
|
+
defaultValue: e.expected,
|
|
1455
|
+
ns: i
|
|
1456
|
+
}),
|
|
1457
|
+
received: s(`types.${e.received}`, {
|
|
1458
|
+
defaultValue: e.received,
|
|
1459
|
+
ns: i
|
|
1460
|
+
}),
|
|
1461
|
+
ns: i,
|
|
1462
|
+
defaultValue: a,
|
|
1463
|
+
...o
|
|
1464
|
+
});
|
|
1465
|
+
break;
|
|
1466
|
+
case S.invalid_literal:
|
|
1467
|
+
a = s("errors.invalid_literal", {
|
|
1468
|
+
expected: JSON.stringify(e.expected, lt),
|
|
1469
|
+
ns: i,
|
|
1470
|
+
defaultValue: a,
|
|
1471
|
+
...o
|
|
1472
|
+
});
|
|
1473
|
+
break;
|
|
1474
|
+
case S.unrecognized_keys:
|
|
1475
|
+
a = s("errors.unrecognized_keys", {
|
|
1476
|
+
keys: oe(e.keys, ", "),
|
|
1477
|
+
count: e.keys.length,
|
|
1478
|
+
ns: i,
|
|
1479
|
+
defaultValue: a,
|
|
1480
|
+
...o
|
|
1481
|
+
});
|
|
1482
|
+
break;
|
|
1483
|
+
case S.invalid_union:
|
|
1484
|
+
a = s("errors.invalid_union", {
|
|
1485
|
+
ns: i,
|
|
1486
|
+
defaultValue: a,
|
|
1487
|
+
...o
|
|
1488
|
+
});
|
|
1489
|
+
break;
|
|
1490
|
+
case S.invalid_union_discriminator:
|
|
1491
|
+
a = s("errors.invalid_union_discriminator", {
|
|
1492
|
+
options: oe(e.options),
|
|
1493
|
+
ns: i,
|
|
1494
|
+
defaultValue: a,
|
|
1495
|
+
...o
|
|
1496
|
+
});
|
|
1497
|
+
break;
|
|
1498
|
+
case S.invalid_enum_value:
|
|
1499
|
+
a = s("errors.invalid_enum_value", {
|
|
1500
|
+
options: oe(e.options),
|
|
1501
|
+
received: e.received,
|
|
1502
|
+
ns: i,
|
|
1503
|
+
defaultValue: a,
|
|
1504
|
+
...o
|
|
1505
|
+
});
|
|
1506
|
+
break;
|
|
1507
|
+
case S.invalid_arguments:
|
|
1508
|
+
a = s("errors.invalid_arguments", {
|
|
1509
|
+
ns: i,
|
|
1510
|
+
defaultValue: a,
|
|
1511
|
+
...o
|
|
1512
|
+
});
|
|
1513
|
+
break;
|
|
1514
|
+
case S.invalid_return_type:
|
|
1515
|
+
a = s("errors.invalid_return_type", {
|
|
1516
|
+
ns: i,
|
|
1517
|
+
defaultValue: a,
|
|
1518
|
+
...o
|
|
1519
|
+
});
|
|
1520
|
+
break;
|
|
1521
|
+
case S.invalid_date:
|
|
1522
|
+
a = s("errors.invalid_date", {
|
|
1523
|
+
ns: i,
|
|
1524
|
+
defaultValue: a,
|
|
1525
|
+
...o
|
|
1526
|
+
});
|
|
1527
|
+
break;
|
|
1528
|
+
case S.invalid_string:
|
|
1529
|
+
typeof e.validation == "object" ? "startsWith" in e.validation ? a = s("errors.invalid_string.startsWith", {
|
|
1530
|
+
startsWith: e.validation.startsWith,
|
|
1531
|
+
ns: i,
|
|
1532
|
+
defaultValue: a,
|
|
1533
|
+
...o
|
|
1534
|
+
}) : "endsWith" in e.validation && (a = s("errors.invalid_string.endsWith", {
|
|
1535
|
+
endsWith: e.validation.endsWith,
|
|
1536
|
+
ns: i,
|
|
1537
|
+
defaultValue: a,
|
|
1538
|
+
...o
|
|
1539
|
+
})) : a = s(`errors.invalid_string.${e.validation}`, {
|
|
1540
|
+
validation: s(`validations.${e.validation}`, {
|
|
1541
|
+
defaultValue: e.validation,
|
|
1542
|
+
ns: i
|
|
1543
|
+
}),
|
|
1544
|
+
ns: i,
|
|
1545
|
+
defaultValue: a,
|
|
1546
|
+
...o
|
|
1547
|
+
});
|
|
1548
|
+
break;
|
|
1549
|
+
case S.too_small:
|
|
1550
|
+
const u = e.type === "date" ? new Date(e.minimum) : e.minimum;
|
|
1551
|
+
a = s(
|
|
1552
|
+
`errors.too_small.${e.type}.${e.exact ? "exact" : e.inclusive ? "inclusive" : "not_inclusive"}`,
|
|
1553
|
+
{
|
|
1554
|
+
minimum: u,
|
|
1555
|
+
count: typeof u == "number" ? u : void 0,
|
|
1556
|
+
ns: i,
|
|
1557
|
+
defaultValue: a,
|
|
1558
|
+
...o
|
|
1559
|
+
}
|
|
1560
|
+
);
|
|
1561
|
+
break;
|
|
1562
|
+
case S.too_big:
|
|
1563
|
+
const f = e.type === "date" ? new Date(e.maximum) : e.maximum;
|
|
1564
|
+
a = s(
|
|
1565
|
+
`errors.too_big.${e.type}.${e.exact ? "exact" : e.inclusive ? "inclusive" : "not_inclusive"}`,
|
|
1566
|
+
{
|
|
1567
|
+
maximum: f,
|
|
1568
|
+
count: typeof f == "number" ? f : void 0,
|
|
1569
|
+
ns: i,
|
|
1570
|
+
defaultValue: a,
|
|
1571
|
+
...o
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1574
|
+
break;
|
|
1575
|
+
case S.custom:
|
|
1576
|
+
const { key: g, values: c } = ut(
|
|
1577
|
+
(l = e.params) == null ? void 0 : l.i18n,
|
|
1578
|
+
"errors.custom"
|
|
1579
|
+
);
|
|
1580
|
+
a = s(g, {
|
|
1581
|
+
...c,
|
|
1582
|
+
ns: i,
|
|
1583
|
+
defaultValue: a,
|
|
1584
|
+
...o
|
|
1585
|
+
});
|
|
1586
|
+
break;
|
|
1587
|
+
case S.invalid_intersection_types:
|
|
1588
|
+
a = s("errors.invalid_intersection_types", {
|
|
1589
|
+
ns: i,
|
|
1590
|
+
defaultValue: a,
|
|
1591
|
+
...o
|
|
1592
|
+
});
|
|
1593
|
+
break;
|
|
1594
|
+
case S.not_multiple_of:
|
|
1595
|
+
a = s("errors.not_multiple_of", {
|
|
1596
|
+
multipleOf: e.multipleOf,
|
|
1597
|
+
ns: i,
|
|
1598
|
+
defaultValue: a,
|
|
1599
|
+
...o
|
|
1600
|
+
});
|
|
1601
|
+
break;
|
|
1602
|
+
case S.not_finite:
|
|
1603
|
+
a = s("errors.not_finite", {
|
|
1604
|
+
ns: i,
|
|
1605
|
+
defaultValue: a,
|
|
1606
|
+
...o
|
|
1607
|
+
});
|
|
1608
|
+
break;
|
|
1609
|
+
}
|
|
1610
|
+
return { message: a };
|
|
1611
|
+
};
|
|
1612
|
+
const ft = He({
|
|
1613
|
+
locale: he(),
|
|
1614
|
+
messages: De
|
|
1615
|
+
});
|
|
1616
|
+
console.log(he());
|
|
1617
|
+
O.init({
|
|
1618
|
+
lng: he(),
|
|
1619
|
+
resources: De
|
|
1620
|
+
});
|
|
1621
|
+
Ke.setErrorMap(ct({ ns: ["connectZod", "connectZodCustom"] }));
|
|
1622
|
+
const fe = ft;
|
|
1623
|
+
function N(r) {
|
|
1624
|
+
return Y(
|
|
1625
|
+
"div",
|
|
1626
|
+
{
|
|
1627
|
+
class: `${r.chipClass} gap-4 h-[22px] inline-flex items-center justify-center min-w-min px-8 rounded-md`
|
|
1628
|
+
},
|
|
1629
|
+
[
|
|
1630
|
+
Y(le.FmIcon, { size: "sm", name: r.icon, outline: !0 }),
|
|
1631
|
+
Y("span", { class: "fm-typo-en-body-md-600" }, r.name)
|
|
1632
|
+
]
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
const $t = {
|
|
1636
|
+
[$.enum.CREDIT]: {
|
|
1637
|
+
chipClass: "!text-fm-color-secondary-plum !bg-[#f2ebfe]",
|
|
1638
|
+
icon: "local_activity",
|
|
1639
|
+
name: "Credit",
|
|
1640
|
+
chip() {
|
|
1641
|
+
return N(this);
|
|
1642
|
+
}
|
|
1643
|
+
},
|
|
1644
|
+
[$.enum.PROMOTION]: {
|
|
1645
|
+
chipClass: "!text-fm-color-secondary-citrus !bg-fm-color-system-warning-100",
|
|
1646
|
+
icon: "loyalty",
|
|
1647
|
+
name: "Promotion",
|
|
1648
|
+
chip() {
|
|
1649
|
+
return N(this);
|
|
1650
|
+
}
|
|
1651
|
+
},
|
|
1652
|
+
[$.enum.VOUCHER]: {
|
|
1653
|
+
chipClass: "!text-fm-color-secondary-halite !bg-[#fff0f6]",
|
|
1654
|
+
icon: "sell",
|
|
1655
|
+
name: fe.global.t("connect.campaign.voucher.title"),
|
|
1656
|
+
chip() {
|
|
1657
|
+
return N(this);
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
[$.enum.POINT]: {
|
|
1661
|
+
chipClass: "!text-fm-color-secondary-cocoa !bg-[#fff9e6]",
|
|
1662
|
+
icon: "award_star",
|
|
1663
|
+
name: "Experience",
|
|
1664
|
+
chip() {
|
|
1665
|
+
return N(this);
|
|
1666
|
+
}
|
|
1667
|
+
},
|
|
1668
|
+
[$.enum.BROADCAST]: {
|
|
1669
|
+
chipClass: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
|
|
1670
|
+
icon: "campaign",
|
|
1671
|
+
name: "Broadcast",
|
|
1672
|
+
chip() {
|
|
1673
|
+
return N(this);
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
[$.enum.GAME]: {
|
|
1677
|
+
chipClass: "!text-fm-color-secondary-mint !bg-fm-color-system-success-100",
|
|
1678
|
+
icon: "database",
|
|
1679
|
+
name: "Token",
|
|
1680
|
+
chip() {
|
|
1681
|
+
return N(this);
|
|
1682
|
+
}
|
|
1683
|
+
},
|
|
1684
|
+
[$.enum.REWARD_POOL]: {
|
|
1685
|
+
chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
|
|
1686
|
+
icon: "editor_choice",
|
|
1687
|
+
name: "Reward Pool",
|
|
1688
|
+
chip() {
|
|
1689
|
+
return N(this);
|
|
1690
|
+
}
|
|
1691
|
+
},
|
|
1692
|
+
[$.enum.COIN]: {
|
|
1693
|
+
chipClass: "!text-fm-color-system-success-400 !bg-fm-color-system-success-100",
|
|
1694
|
+
icon: "monetization_on",
|
|
1695
|
+
name: "Point",
|
|
1696
|
+
chip() {
|
|
1697
|
+
return N(this);
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
[$.enum.MEMBERSHIP]: {
|
|
1701
|
+
chipClass: "",
|
|
1702
|
+
icon: "",
|
|
1703
|
+
name: "Membership",
|
|
1704
|
+
chip() {
|
|
1705
|
+
return N(this);
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
// TODO: confirm color
|
|
1709
|
+
[$.enum.MISSION]: {
|
|
1710
|
+
chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
|
|
1711
|
+
icon: "editor_choice",
|
|
1712
|
+
name: "Mission",
|
|
1713
|
+
chip() {
|
|
1714
|
+
return N(this);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
function Nt(r) {
|
|
1719
|
+
const e = gt(r), t = {
|
|
1720
|
+
active: "text-fm-color-typo-success bg-fm-color-system-success-100",
|
|
1721
|
+
upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
|
|
1722
|
+
expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
|
|
1723
|
+
};
|
|
1724
|
+
return r.type == "VOUCHER" ? Y(le.FmChip, {
|
|
1725
|
+
class: t[e],
|
|
1726
|
+
label: ve.title(fe.global.t(`connect.campaign.common.status.${e}`)),
|
|
1727
|
+
compact: !0
|
|
1728
|
+
}) : Y(le.FmChip, {
|
|
1729
|
+
class: t[e],
|
|
1730
|
+
label: ve.title(fe.global.t(`connect.campaign.common.status.${e}`)),
|
|
1731
|
+
compact: !0
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
function Et(r) {
|
|
1735
|
+
const { campaign: e } = r;
|
|
1736
|
+
function t(s) {
|
|
1737
|
+
if (!s || !s.start && !s.end)
|
|
1738
|
+
return "connect.campaign.common.always";
|
|
1739
|
+
const i = s.start ? V(s.start).format("DD MMM YYYY") : "From campaign creation", n = s.end ? V(s.end).format("DD MMM YYYY") : "Never ends";
|
|
1740
|
+
return `${i} - ${n}`;
|
|
1741
|
+
}
|
|
1742
|
+
return {
|
|
1743
|
+
"connect.campaign.common.campaign_name": e.name,
|
|
1744
|
+
"connect.campaign.common.campaign_period": t(e.timeframeOptions),
|
|
1745
|
+
get "connect.campaign.common.next_schedule_at"() {
|
|
1746
|
+
if (e.event.type != "SCHEDULE" || !e.event.rule || !ge(e.event.rule))
|
|
1747
|
+
return;
|
|
1748
|
+
const s = Me(
|
|
1749
|
+
e.event.rule.rules.g_schedule
|
|
1750
|
+
);
|
|
1751
|
+
return s ? V(s).format("ddd, DD MMM YYYY, hh:mmA") : void 0;
|
|
1752
|
+
},
|
|
1753
|
+
get "connect.campaign.common.discount_type"() {
|
|
1754
|
+
if (e.type == "PROMOTION") return X(e.effect);
|
|
1755
|
+
if ("configs" in r && r.configs.type == "VOUCHER")
|
|
1756
|
+
return X(r.configs.extras.effect);
|
|
1757
|
+
},
|
|
1758
|
+
get "connect.campaign.common.available_at"() {
|
|
1759
|
+
return e.targetLocation ? e.targetLocation.length > 0 ? e.targetLocation.map(
|
|
1760
|
+
(s) => _e().locationItems.find((i) => i.value == s).label
|
|
1761
|
+
).join(",") : "connect.campaign.common.no_location" : "connect.campaign.common.all_locations";
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
function gt(r) {
|
|
1766
|
+
return r.timeframeOptions && r.timeframeOptions.type == "timeframe" ? V().isBetween(
|
|
1767
|
+
r.timeframeOptions.start ?? V().subtract(1, "d"),
|
|
1768
|
+
r.timeframeOptions.end ?? V().add(1, "d")
|
|
1769
|
+
) ? "active" : V().isAfter(r.timeframeOptions.end) ? "expired" : "upcoming" : "active";
|
|
1770
|
+
}
|
|
1771
|
+
function It(r) {
|
|
1772
|
+
var e, t;
|
|
1773
|
+
switch (r.event.type) {
|
|
1774
|
+
case "BILL_COMPLETED":
|
|
1775
|
+
const s = `Spend to get ${A.formattedType(r.type)}`;
|
|
1776
|
+
switch (r.type) {
|
|
1777
|
+
case "POINT":
|
|
1778
|
+
case "CREDIT":
|
|
1779
|
+
case "COIN":
|
|
1780
|
+
return r.earningOption.type == "FIXED" ? `Spend to get ${r.earningOption.amount} ${A.formattedType(r.type)}` : `Every ${r.earningOption.every} amount spent get ${r.earningOption.amount} ${A.formattedType(r.type)}`;
|
|
1781
|
+
case "VOUCHER":
|
|
1782
|
+
const i = (t = (e = r == null ? void 0 : r.pf_collectible) == null ? void 0 : e.extras) == null ? void 0 : t.effect;
|
|
1783
|
+
return i ? `${s} - ${X(i)}` : s;
|
|
1784
|
+
default:
|
|
1785
|
+
return s;
|
|
1786
|
+
}
|
|
1787
|
+
case "FEEDBACK":
|
|
1788
|
+
return `Give feedback to receive ${A.formattedType(r.type)}`;
|
|
1789
|
+
case "SCHEDULE":
|
|
1790
|
+
return `Receive ${A.formattedType(r.type)} on scheduled time`;
|
|
1791
|
+
case "SIMPLE_CLAIM":
|
|
1792
|
+
return "Simple claim voucher";
|
|
1793
|
+
case "TIER_UPGRADED":
|
|
1794
|
+
return `Receive ${A.formattedType(r.type)} when member tier upgraded`;
|
|
1795
|
+
case "MEMBERSHIP_JOINED":
|
|
1796
|
+
return `Receive ${A.formattedType(r.type)} when member joined`;
|
|
1797
|
+
case "MAKING_ORDER":
|
|
1798
|
+
return r.type !== "PROMOTION" ? void 0 : X(r.effect);
|
|
1799
|
+
default:
|
|
1800
|
+
throw new Error(
|
|
1801
|
+
`Not implemented ${JSON.stringify({ cause: r.event.type })}`
|
|
1802
|
+
);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
function kt(r, e) {
|
|
1806
|
+
var i, n;
|
|
1807
|
+
if (!r) return;
|
|
1808
|
+
const t = r.campaign;
|
|
1809
|
+
if (!t) return;
|
|
1810
|
+
const s = t.event.rule;
|
|
1811
|
+
if (!s || !ge(s)) {
|
|
1812
|
+
e.addIssue({
|
|
1813
|
+
code: "custom",
|
|
1814
|
+
path: ["campaign", "event", "rule"],
|
|
1815
|
+
params: {
|
|
1816
|
+
i18n: { key: "zodCustom.campaign.rule_required", values: { type: t.event.type } }
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
return;
|
|
1820
|
+
}
|
|
1821
|
+
switch (t.type) {
|
|
1822
|
+
case "MISSION": {
|
|
1823
|
+
t.earningOption.amount > t.mission.end && e.addIssue({
|
|
1824
|
+
code: "custom",
|
|
1825
|
+
path: ["campaign", "earningOption"],
|
|
1826
|
+
params: {
|
|
1827
|
+
i18n: { key: "zodCustom.campaign.earning_amount_exceed", values: { max: t.mission.end } }
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
break;
|
|
1831
|
+
}
|
|
1832
|
+
case "CREDIT": {
|
|
1833
|
+
const a = (i = t.config) == null ? void 0 : i.validityOption;
|
|
1834
|
+
(!a || ["validForDay", "validBefore"].every((l) => a[l] == null)) && e.addIssue({
|
|
1835
|
+
code: "custom",
|
|
1836
|
+
path: ["campaign", "config", "validityOption"],
|
|
1837
|
+
params: {
|
|
1838
|
+
i18n: { key: "zodCustom.campaign.credit_validity_required" }
|
|
1839
|
+
}
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
switch (t.event.type) {
|
|
1844
|
+
case "BILL_COMPLETED":
|
|
1845
|
+
t.type === "MISSION" && t.rewards.length && (t.rewards.forEach((a, o) => {
|
|
1846
|
+
(a.threshold < 0 || a.threshold > t.mission.end) && e.addIssue({
|
|
1847
|
+
code: "custom",
|
|
1848
|
+
path: ["campaign", "rewards", o, "threshold"],
|
|
1849
|
+
params: {
|
|
1850
|
+
i18n: { key: "zodCustom.campaign.reward_threshold_range" }
|
|
1851
|
+
}
|
|
1852
|
+
});
|
|
1853
|
+
}), (n = t.config) != null && n.validityOption.followFirstReceive || e.addIssue({
|
|
1854
|
+
code: "custom",
|
|
1855
|
+
path: ["campaign", "config", "validityOption"],
|
|
1856
|
+
params: {
|
|
1857
|
+
i18n: { key: "zodCustom.campaign.mission_first_receive" }
|
|
1858
|
+
}
|
|
1859
|
+
}));
|
|
1860
|
+
break;
|
|
1861
|
+
case "SCHEDULE": {
|
|
1862
|
+
if (!s.rules.g_schedule) {
|
|
1863
|
+
e.addIssue({
|
|
1864
|
+
code: "custom",
|
|
1865
|
+
path: ["campaign", "event", "rule"],
|
|
1866
|
+
params: {
|
|
1867
|
+
i18n: { key: "zodCustom.campaign.schedule_period_required" }
|
|
1868
|
+
},
|
|
1869
|
+
fatal: !0
|
|
1870
|
+
});
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
const a = ue.getRules(
|
|
1874
|
+
s.rules.g_schedule
|
|
1875
|
+
), o = [
|
|
1876
|
+
{
|
|
1877
|
+
property: "trigger.date",
|
|
1878
|
+
operator: ["_isOnDate", "_rrule"]
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
property: "trigger.time",
|
|
1882
|
+
operator: ["_isOnTime"]
|
|
1883
|
+
}
|
|
1884
|
+
];
|
|
1885
|
+
o.length == a.length && o.every((u) => a.some((f) => {
|
|
1886
|
+
const g = ue.simplify(f);
|
|
1887
|
+
return g.property === u.property && u.operator.includes(g.operator);
|
|
1888
|
+
})) || e.addIssue({
|
|
1889
|
+
code: "custom",
|
|
1890
|
+
path: ["campaign", "event", "rule"],
|
|
1891
|
+
params: {
|
|
1892
|
+
i18n: { key: "zodCustom.campaign.active_period_invalid" }
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
break;
|
|
1896
|
+
}
|
|
1897
|
+
default: {
|
|
1898
|
+
"earningOption" in t && t.earningOption.type != "FIXED" && e.addIssue({
|
|
1899
|
+
code: "custom",
|
|
1900
|
+
path: ["campaign", "earningOption"],
|
|
1901
|
+
params: {
|
|
1902
|
+
i18n: { key: "zodCustom.campaign.fixed_earning_required" }
|
|
1903
|
+
}
|
|
1904
|
+
});
|
|
1905
|
+
break;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
function Dt(r) {
|
|
1910
|
+
var t;
|
|
1911
|
+
if (r.campaign.type === "VOUCHER" && "configs" in r) {
|
|
1912
|
+
const s = r.configs;
|
|
1913
|
+
s.extras.targetLocation = r.campaign.targetLocation;
|
|
1914
|
+
const i = Math.max(
|
|
1915
|
+
r.campaign.earningOption.amount,
|
|
1916
|
+
s.options.maxUse ?? 1
|
|
1917
|
+
);
|
|
1918
|
+
r.campaign.earningOption.amount = i, s.options.maxUse = i, r.campaign.earningOption = {
|
|
1919
|
+
type: "FIXED",
|
|
1920
|
+
amount: 1
|
|
1921
|
+
};
|
|
1922
|
+
}
|
|
1923
|
+
if (r.campaign.type == "MISSION" && "configs" in r) {
|
|
1924
|
+
const s = r.configs;
|
|
1925
|
+
s.options.validityOption = (t = r.campaign.config) == null ? void 0 : t.validityOption;
|
|
1926
|
+
}
|
|
1927
|
+
const e = r.campaign.event;
|
|
1928
|
+
return e.type != "BILL_COMPLETED" && e.rule && ge(e.rule) && (e.rule = ue.removeEntry(e.rule, "g_bill"), r.campaign.event = e), r;
|
|
1929
|
+
}
|
|
1930
|
+
function D(r) {
|
|
1931
|
+
const e = Ve.optionsMap.get(r).extend({
|
|
1932
|
+
_id: w.optional(),
|
|
1933
|
+
collectible: b.string().nullish()
|
|
1934
|
+
});
|
|
1935
|
+
switch (r) {
|
|
1936
|
+
case "VOUCHER":
|
|
1937
|
+
return b.object({
|
|
1938
|
+
campaign: e,
|
|
1939
|
+
templateId: w,
|
|
1940
|
+
configs: re,
|
|
1941
|
+
updateCollections: b.boolean().optional(),
|
|
1942
|
+
code: b.string().optional()
|
|
1943
|
+
});
|
|
1944
|
+
case "PROMOTION":
|
|
1945
|
+
return b.object({
|
|
1946
|
+
campaign: e,
|
|
1947
|
+
templateId: w
|
|
1948
|
+
});
|
|
1949
|
+
case "POINT":
|
|
1950
|
+
return b.object({
|
|
1951
|
+
campaign: e,
|
|
1952
|
+
templateId: w
|
|
1953
|
+
});
|
|
1954
|
+
case "CREDIT":
|
|
1955
|
+
return b.object({
|
|
1956
|
+
campaign: e,
|
|
1957
|
+
templateId: w
|
|
1958
|
+
});
|
|
1959
|
+
case "BROADCAST":
|
|
1960
|
+
return b.object({
|
|
1961
|
+
campaign: e,
|
|
1962
|
+
templateId: w
|
|
1963
|
+
});
|
|
1964
|
+
case "COIN":
|
|
1965
|
+
return b.object({
|
|
1966
|
+
campaign: e,
|
|
1967
|
+
templateId: w
|
|
1968
|
+
});
|
|
1969
|
+
case "REWARD_POOL":
|
|
1970
|
+
return b.object({
|
|
1971
|
+
campaign: e,
|
|
1972
|
+
templateId: w,
|
|
1973
|
+
updateCollections: b.boolean().optional()
|
|
1974
|
+
});
|
|
1975
|
+
case "GAME":
|
|
1976
|
+
return b.object({
|
|
1977
|
+
campaign: e,
|
|
1978
|
+
configs: re,
|
|
1979
|
+
templateId: w,
|
|
1980
|
+
updateCollections: b.boolean().optional()
|
|
1981
|
+
});
|
|
1982
|
+
case "MISSION":
|
|
1983
|
+
return b.object({
|
|
1984
|
+
campaign: e,
|
|
1985
|
+
configs: re,
|
|
1986
|
+
templateId: w,
|
|
1987
|
+
updateCollections: b.boolean().optional()
|
|
1988
|
+
});
|
|
1989
|
+
default:
|
|
1990
|
+
throw new Error("Not implemented");
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
const Ft = Ae.extend({
|
|
1994
|
+
_id: w.optional(),
|
|
1995
|
+
name: b.string().min(1).max(300),
|
|
1996
|
+
business: w.optional(),
|
|
1997
|
+
campaigns: b.array(w).optional()
|
|
1998
|
+
}), jt = {
|
|
1999
|
+
[k.enum.VOUCHER]: D("VOUCHER"),
|
|
2000
|
+
[k.enum.PROMOTION]: D("PROMOTION"),
|
|
2001
|
+
[k.enum.POINT]: D("POINT"),
|
|
2002
|
+
[k.enum.CREDIT]: D("CREDIT"),
|
|
2003
|
+
[k.enum.BROADCAST]: D("BROADCAST"),
|
|
2004
|
+
[k.enum.COIN]: D("COIN"),
|
|
2005
|
+
[k.enum.REWARD_POOL]: D("REWARD_POOL"),
|
|
2006
|
+
[k.enum.GAME]: D("GAME"),
|
|
2007
|
+
[k.enum.MISSION]: D("MISSION")
|
|
2008
|
+
};
|
|
2009
|
+
export {
|
|
2010
|
+
$t as C,
|
|
2011
|
+
Ft as F,
|
|
2012
|
+
It as a,
|
|
2013
|
+
Et as b,
|
|
2014
|
+
kt as c,
|
|
2015
|
+
jt as d,
|
|
2016
|
+
Dt as e,
|
|
2017
|
+
Nt as g
|
|
2018
|
+
};
|