@feedmepos/mf-connect 0.1.57-prod → 0.1.58-prod

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.
Files changed (128) hide show
  1. package/package.json +1 -1
  2. package/dist/Analytic-BqvhYgCU.js +0 -427
  3. package/dist/App-Dtl_D0cH.js +0 -4630
  4. package/dist/Bin-y4ikpgPS.js +0 -166
  5. package/dist/Broadcast-DSROFwe4.js +0 -233
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CcsG6vOP.js +0 -121
  7. package/dist/Card-BiSEPsZb.js +0 -911
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  9. package/dist/Collections-CX-nN7Xj.js +0 -458
  10. package/dist/Credit-IiV9b4cB.js +0 -228
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CoGes8YL.js +0 -2194
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-sGh_SMCH.js +0 -348
  14. package/dist/Experience-Cf-EMhKy.js +0 -229
  15. package/dist/FileSaver.min-NlMItPOc.js +0 -74
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  17. package/dist/Game-C8mfJn6W.js +0 -284
  18. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +0 -144
  19. package/dist/Index-DkvO1AoT.js +0 -259
  20. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  21. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +0 -18737
  22. package/dist/MainLayout-B1aJoR95.js +0 -41
  23. package/dist/Marketing-xJTIo3RF.js +0 -319
  24. package/dist/Member-DZkYoKW8.js +0 -279
  25. package/dist/MemberList-CAYEJnf3.js +0 -1607
  26. package/dist/MemberOverview-wL_ailso.js +0 -58
  27. package/dist/MemberTransactions-Dc5aAQ69.js +0 -45
  28. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BSvlPzw8.js +0 -60553
  29. package/dist/Mission-C_NbNWZw.js +0 -302
  30. package/dist/Overview-DyxEwEfe.js +0 -1079
  31. package/dist/Point-CsEWk61V.js +0 -232
  32. package/dist/Promotion--pWgy9Dx.js +0 -289
  33. package/dist/Queue-k3qAQR7B.js +0 -260
  34. package/dist/Record-D5F5JyVA.js +0 -341
  35. package/dist/Reward-3FSrq5mX.js +0 -442
  36. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Dzj7a7UY.js +0 -150
  37. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DRl_Gjfx.js +0 -1763
  38. package/dist/Segment-BWJn6ODR.js +0 -882
  39. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BKsV_zcr.js +0 -181
  40. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-C3efGNC_.js +0 -188
  41. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-Cj7c2V3h.js +0 -147
  42. package/dist/Setting-UiTXazZV.js +0 -1936
  43. package/dist/Store-BrvmHPCX.js +0 -1842
  44. package/dist/StoreRewards-D_7fr-Ef.js +0 -423
  45. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BXy0L5AH.js +0 -995
  46. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DumcDlBs.js +0 -139
  47. package/dist/Tier-C4wvx8F7.js +0 -895
  48. package/dist/Title-CPHT85Uj.js +0 -566
  49. package/dist/Transaction-6Ig2W00P.js +0 -39
  50. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-DknFkIJh.js +0 -130
  51. package/dist/Voucher-Bbl-7gZ5.js +0 -384
  52. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-xsswRZG8.js +0 -419
  53. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-B5J6Hd8G.js +0 -56
  54. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  55. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  56. package/dist/app-BDVZwARN.js +0 -7057
  57. package/dist/app-CAEhNFRG.js +0 -57962
  58. package/dist/app-wDQR6dpb.js +0 -39
  59. package/dist/app.js +0 -6
  60. package/dist/business-6C_ol5wd.js +0 -82
  61. package/dist/campaign-B13G6pZ3.js +0 -1810
  62. package/dist/campaign-CpzFl8Vr.js +0 -4
  63. package/dist/campaign-DrQp6qBu.js +0 -94
  64. package/dist/campaign.enum-DnTrlaNC.js +0 -20
  65. package/dist/campaign.fn-BZse90_k.js +0 -758
  66. package/dist/collectible.enum-633Me0yR.js +0 -19
  67. package/dist/collection.fn-C96855j5.js +0 -26
  68. package/dist/dto-2bMujqmZ.js +0 -216
  69. package/dist/effect-C7lAJwKh.js +0 -78
  70. package/dist/email-addresses-3ayN-9jv.js +0 -705
  71. package/dist/export-BNbDV7SC.js +0 -97
  72. package/dist/feedme.ico +0 -0
  73. package/dist/helper-CsfZ__dQ.js +0 -71
  74. package/dist/index-BLSAz0gK.js +0 -32
  75. package/dist/index-BY9I3Cer.js +0 -3
  76. package/dist/index-BdnRNcVO.js +0 -146
  77. package/dist/index-BmyNfpfG.js +0 -30076
  78. package/dist/index-CSBRkhKy.js +0 -38
  79. package/dist/index-Cf_fcvoS.js +0 -54
  80. package/dist/index-CqrO13uj.js +0 -76
  81. package/dist/index-CuvNtC_M.js +0 -61
  82. package/dist/index-D4kdSzs9.js +0 -3070
  83. package/dist/index-DcJq7tl4.js +0 -32269
  84. package/dist/index-DdjSIwSL.js +0 -44
  85. package/dist/index-LKr2k8J2.js +0 -8861
  86. package/dist/index-XAxwm-1v.js +0 -2130
  87. package/dist/index-b82LrGSB.js +0 -121
  88. package/dist/index-tcAb0W5F.js +0 -31
  89. package/dist/index-vh86FiIQ.js +0 -10
  90. package/dist/index.esm2017-BklqmujQ.js +0 -3069
  91. package/dist/loading-OXARGiqO.js +0 -71
  92. package/dist/lodash-B5I3zXaY.js +0 -3678
  93. package/dist/membership-D1Vb1rUo.js +0 -235
  94. package/dist/moment-D7p2TMB-.js +0 -2583
  95. package/dist/money-BpyAytEq.js +0 -15
  96. package/dist/number-C-PtPOOj.js +0 -12
  97. package/dist/object-qECH92oz.js +0 -26
  98. package/dist/objectId-dwaoBfJX.js +0 -7
  99. package/dist/objectid-BrLIKTmQ.js +0 -145
  100. package/dist/plugins-CjPWhNb2.js +0 -208
  101. package/dist/reward-DonQFzvW.js +0 -36
  102. package/dist/rule-AtNPBnbE.js +0 -1951
  103. package/dist/rule-builder-C0Q-3g6T.js +0 -102
  104. package/dist/style.css +0 -4
  105. package/dist/template-CNjE7eht.js +0 -190
  106. package/dist/tier-BJDhpH6X.js +0 -4
  107. package/dist/tiers/tier=1.png +0 -0
  108. package/dist/tiers/tier=2.png +0 -0
  109. package/dist/tiers/tier=3.png +0 -0
  110. package/dist/tiers/tier=4.png +0 -0
  111. package/dist/timezone-CYbdI3q2.js +0 -1151
  112. package/dist/titles/type=diamond.png +0 -0
  113. package/dist/titles/type=drinks.png +0 -0
  114. package/dist/titles/type=food.png +0 -0
  115. package/dist/titles/type=heart.png +0 -0
  116. package/dist/titles/type=medal.png +0 -0
  117. package/dist/titles/type=spend.png +0 -0
  118. package/dist/titles/type=thank-you.png +0 -0
  119. package/dist/titles/type=thumbs-up.png +0 -0
  120. package/dist/titles/type=years.png +0 -0
  121. package/dist/trigger-Bdi6n80h.js +0 -144
  122. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  123. package/dist/type_drinks-D6jnpvwV.js +0 -4
  124. package/dist/usePagination-Ds-cuHop.js +0 -223
  125. package/dist/user-BwGm78n8.js +0 -54
  126. package/dist/vue-i18n-D1nTd69a.js +0 -2365
  127. package/dist/xlsx-DF5iW3wh.js +0 -15491
  128. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -1,1810 +0,0 @@
1
- import { h as F } from "./moment-D7p2TMB-.js";
2
- import "./index-D4kdSzs9.js";
3
- import { e as G } from "./effect-C7lAJwKh.js";
4
- import { components as ie } from "@feedmepos/ui-library";
5
- import { i as Ne } from "./rule-builder-C0Q-3g6T.js";
6
- import { c as Ee } from "./rule-AtNPBnbE.js";
7
- import { u as Ve } from "./business-6C_ol5wd.js";
8
- import { C as j } from "./campaign.fn-BZse90_k.js";
9
- import { c as ce } from "./plugins-CjPWhNb2.js";
10
- import { e as je, Z as S, a as fe, i as Re, z as Fe } from "./app-BDVZwARN.js";
11
- import { detectLocale as Ie, createFeedMeI18n as De } from "@feedmepos/mf-common";
12
- import { h as B } from "vue";
13
- import { F as R } from "./campaign.enum-DnTrlaNC.js";
14
- const d = (a) => typeof a == "string", _ = () => {
15
- let a, e;
16
- const t = new Promise((s, i) => {
17
- a = s, e = i;
18
- });
19
- return t.resolve = a, t.reject = e, t;
20
- }, he = (a) => a == null ? "" : "" + a, Te = (a, e, t) => {
21
- a.forEach((s) => {
22
- e[s] && (t[s] = e[s]);
23
- });
24
- }, Ae = /###/g, ge = (a) => a && a.indexOf("###") > -1 ? a.replace(Ae, ".") : a, de = (a) => !a || d(a), z = (a, e, t) => {
25
- const s = d(e) ? e.split(".") : e;
26
- let i = 0;
27
- for (; i < s.length - 1; ) {
28
- if (de(a)) return {};
29
- const r = ge(s[i]);
30
- !a[r] && t && (a[r] = new t()), Object.prototype.hasOwnProperty.call(a, r) ? a = a[r] : a = {}, ++i;
31
- }
32
- return de(a) ? {} : {
33
- obj: a,
34
- k: ge(s[i])
35
- };
36
- }, pe = (a, e, t) => {
37
- const {
38
- obj: s,
39
- k: i
40
- } = z(a, e, Object);
41
- if (s !== void 0 || e.length === 1) {
42
- s[i] = t;
43
- return;
44
- }
45
- let r = e[e.length - 1], n = e.slice(0, e.length - 1), o = z(a, n, Object);
46
- for (; o.obj === void 0 && n.length; )
47
- r = `${n[n.length - 1]}.${r}`, n = n.slice(0, n.length - 1), o = z(a, n, Object), o != null && o.obj && typeof o.obj[`${o.k}.${r}`] < "u" && (o.obj = void 0);
48
- o.obj[`${o.k}.${r}`] = t;
49
- }, Me = (a, e, t, s) => {
50
- const {
51
- obj: i,
52
- k: r
53
- } = z(a, e, Object);
54
- i[r] = i[r] || [], i[r].push(t);
55
- }, Z = (a, e) => {
56
- const {
57
- obj: t,
58
- k: s
59
- } = z(a, e);
60
- if (t && Object.prototype.hasOwnProperty.call(t, s))
61
- return t[s];
62
- }, Ke = (a, e, t) => {
63
- const s = Z(a, t);
64
- return s !== void 0 ? s : Z(e, t);
65
- }, $e = (a, e, t) => {
66
- for (const s in e)
67
- s !== "__proto__" && s !== "constructor" && (s in a ? d(a[s]) || a[s] instanceof String || d(e[s]) || e[s] instanceof String ? t && (a[s] = e[s]) : $e(a[s], e[s], t) : a[s] = e[s]);
68
- return a;
69
- }, T = (a) => a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
70
- var Ue = {
71
- "&": "&amp;",
72
- "<": "&lt;",
73
- ">": "&gt;",
74
- '"': "&quot;",
75
- "'": "&#39;",
76
- "/": "&#x2F;"
77
- };
78
- const He = (a) => d(a) ? a.replace(/[&<>"'\/]/g, (e) => Ue[e]) : a;
79
- class _e {
80
- constructor(e) {
81
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
82
- }
83
- getRegExp(e) {
84
- const t = this.regExpMap.get(e);
85
- if (t !== void 0)
86
- return t;
87
- const s = new RegExp(e);
88
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
89
- }
90
- }
91
- const Be = [" ", ",", "?", "!", ";"], ze = new _e(20), Je = (a, e, t) => {
92
- e = e || "", t = t || "";
93
- const s = Be.filter((n) => e.indexOf(n) < 0 && t.indexOf(n) < 0);
94
- if (s.length === 0) return !0;
95
- const i = ze.getRegExp(`(${s.map((n) => n === "?" ? "\\?" : n).join("|")})`);
96
- let r = !i.test(a);
97
- if (!r) {
98
- const n = a.indexOf(t);
99
- n > 0 && !i.test(a.substring(0, n)) && (r = !0);
100
- }
101
- return r;
102
- }, re = function(a, e) {
103
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
104
- if (!a) return;
105
- if (a[e])
106
- return Object.prototype.hasOwnProperty.call(a, e) ? a[e] : void 0;
107
- const s = e.split(t);
108
- let i = a;
109
- for (let r = 0; r < s.length; ) {
110
- if (!i || typeof i != "object")
111
- return;
112
- let n, o = "";
113
- for (let l = r; l < s.length; ++l)
114
- if (l !== r && (o += t), o += s[l], n = i[o], n !== void 0) {
115
- if (["string", "number", "boolean"].indexOf(typeof n) > -1 && l < s.length - 1)
116
- continue;
117
- r += l - r + 1;
118
- break;
119
- }
120
- i = n;
121
- }
122
- return i;
123
- }, Q = (a) => a == null ? void 0 : a.replace("_", "-"), Ye = {
124
- type: "logger",
125
- log(a) {
126
- this.output("log", a);
127
- },
128
- warn(a) {
129
- this.output("warn", a);
130
- },
131
- error(a) {
132
- this.output("error", a);
133
- },
134
- output(a, e) {
135
- var t, s;
136
- (s = (t = console == null ? void 0 : console[a]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
137
- }
138
- };
139
- class X {
140
- constructor(e) {
141
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
142
- this.init(e, t);
143
- }
144
- init(e) {
145
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
146
- this.prefix = t.prefix || "i18next:", this.logger = e || Ye, this.options = t, this.debug = t.debug;
147
- }
148
- log() {
149
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
150
- t[s] = arguments[s];
151
- return this.forward(t, "log", "", !0);
152
- }
153
- warn() {
154
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
155
- t[s] = arguments[s];
156
- return this.forward(t, "warn", "", !0);
157
- }
158
- error() {
159
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
160
- t[s] = arguments[s];
161
- return this.forward(t, "error", "");
162
- }
163
- deprecate() {
164
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
165
- t[s] = arguments[s];
166
- return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
167
- }
168
- forward(e, t, s, i) {
169
- return i && !this.debug ? null : (d(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
170
- }
171
- create(e) {
172
- return new X(this.logger, {
173
- prefix: `${this.prefix}:${e}:`,
174
- ...this.options
175
- });
176
- }
177
- clone(e) {
178
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new X(this.logger, e);
179
- }
180
- }
181
- var P = new X();
182
- class ee {
183
- constructor() {
184
- this.observers = {};
185
- }
186
- on(e, t) {
187
- return e.split(" ").forEach((s) => {
188
- this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
189
- const i = this.observers[s].get(t) || 0;
190
- this.observers[s].set(t, i + 1);
191
- }), this;
192
- }
193
- off(e, t) {
194
- if (this.observers[e]) {
195
- if (!t) {
196
- delete this.observers[e];
197
- return;
198
- }
199
- this.observers[e].delete(t);
200
- }
201
- }
202
- emit(e) {
203
- for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
204
- s[i - 1] = arguments[i];
205
- this.observers[e] && Array.from(this.observers[e].entries()).forEach((n) => {
206
- let [o, l] = n;
207
- for (let u = 0; u < l; u++)
208
- o(...s);
209
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((n) => {
210
- let [o, l] = n;
211
- for (let u = 0; u < l; u++)
212
- o.apply(o, [e, ...s]);
213
- });
214
- }
215
- }
216
- class me extends ee {
217
- constructor(e) {
218
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
219
- ns: ["translation"],
220
- defaultNS: "translation"
221
- };
222
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
223
- }
224
- addNamespaces(e) {
225
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
226
- }
227
- removeNamespaces(e) {
228
- const t = this.options.ns.indexOf(e);
229
- t > -1 && this.options.ns.splice(t, 1);
230
- }
231
- getResource(e, t, s) {
232
- var u, f;
233
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
234
- const r = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, n = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
235
- let o;
236
- e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : d(s) && r ? o.push(...s.split(r)) : o.push(s)));
237
- const l = Z(this.data, o);
238
- return !l && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), l || !n || !d(s) ? l : re((f = (u = this.data) == null ? void 0 : u[e]) == null ? void 0 : f[t], s, r);
239
- }
240
- addResource(e, t, s, i) {
241
- let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
242
- silent: !1
243
- };
244
- const n = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
245
- let o = [e, t];
246
- s && (o = o.concat(n ? s.split(n) : s)), e.indexOf(".") > -1 && (o = e.split("."), i = t, t = o[1]), this.addNamespaces(t), pe(this.data, o, i), r.silent || this.emit("added", e, t, s, i);
247
- }
248
- addResources(e, t, s) {
249
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
250
- silent: !1
251
- };
252
- for (const r in s)
253
- (d(s[r]) || Array.isArray(s[r])) && this.addResource(e, t, r, s[r], {
254
- silent: !0
255
- });
256
- i.silent || this.emit("added", e, t, s);
257
- }
258
- addResourceBundle(e, t, s, i, r) {
259
- let n = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
260
- silent: !1,
261
- skipCopy: !1
262
- }, o = [e, t];
263
- e.indexOf(".") > -1 && (o = e.split("."), i = s, s = t, t = o[1]), this.addNamespaces(t);
264
- let l = Z(this.data, o) || {};
265
- n.skipCopy || (s = JSON.parse(JSON.stringify(s))), i ? $e(l, s, r) : l = {
266
- ...l,
267
- ...s
268
- }, pe(this.data, o, l), n.silent || this.emit("added", e, t, s);
269
- }
270
- removeResourceBundle(e, t) {
271
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
272
- }
273
- hasResourceBundle(e, t) {
274
- return this.getResource(e, t) !== void 0;
275
- }
276
- getResourceBundle(e, t) {
277
- return t || (t = this.options.defaultNS), this.getResource(e, t);
278
- }
279
- getDataByLanguage(e) {
280
- return this.data[e];
281
- }
282
- hasLanguageSomeTranslations(e) {
283
- const t = this.getDataByLanguage(e);
284
- return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
285
- }
286
- toJSON() {
287
- return this.data;
288
- }
289
- }
290
- var Pe = {
291
- processors: {},
292
- addPostProcessor(a) {
293
- this.processors[a.name] = a;
294
- },
295
- handle(a, e, t, s, i) {
296
- return a.forEach((r) => {
297
- var n;
298
- e = ((n = this.processors[r]) == null ? void 0 : n.process(e, t, s, i)) ?? e;
299
- }), e;
300
- }
301
- };
302
- const ve = {};
303
- class q extends ee {
304
- constructor(e) {
305
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
306
- super(), Te(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = P.create("translator");
307
- }
308
- changeLanguage(e) {
309
- e && (this.language = e);
310
- }
311
- exists(e) {
312
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
313
- interpolation: {}
314
- };
315
- if (e == null)
316
- return !1;
317
- const s = this.resolve(e, t);
318
- return (s == null ? void 0 : s.res) !== void 0;
319
- }
320
- extractFromKey(e, t) {
321
- let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
322
- s === void 0 && (s = ":");
323
- const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
324
- let r = t.ns || this.options.defaultNS || [];
325
- const n = s && e.indexOf(s) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Je(e, s, i);
326
- if (n && !o) {
327
- const l = e.match(this.interpolator.nestingRegexp);
328
- if (l && l.length > 0)
329
- return {
330
- key: e,
331
- namespaces: d(r) ? [r] : r
332
- };
333
- const u = e.split(s);
334
- (s !== i || s === i && this.options.ns.indexOf(u[0]) > -1) && (r = u.shift()), e = u.join(i);
335
- }
336
- return {
337
- key: e,
338
- namespaces: d(r) ? [r] : r
339
- };
340
- }
341
- translate(e, t, s) {
342
- if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
343
- ...t
344
- }), t || (t = {}), e == null) return "";
345
- Array.isArray(e) || (e = [String(e)]);
346
- const i = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, r = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
347
- key: n,
348
- namespaces: o
349
- } = this.extractFromKey(e[e.length - 1], t), l = o[o.length - 1], u = t.lng || this.language, f = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
350
- if ((u == null ? void 0 : u.toLowerCase()) === "cimode") {
351
- if (f) {
352
- const y = t.nsSeparator || this.options.nsSeparator;
353
- return i ? {
354
- res: `${l}${y}${n}`,
355
- usedKey: n,
356
- exactUsedKey: n,
357
- usedLng: u,
358
- usedNS: l,
359
- usedParams: this.getUsedParamsDetails(t)
360
- } : `${l}${y}${n}`;
361
- }
362
- return i ? {
363
- res: n,
364
- usedKey: n,
365
- exactUsedKey: n,
366
- usedLng: u,
367
- usedNS: l,
368
- usedParams: this.getUsedParamsDetails(t)
369
- } : n;
370
- }
371
- const h = this.resolve(e, t);
372
- let c = h == null ? void 0 : h.res;
373
- const m = (h == null ? void 0 : h.usedKey) || n, g = (h == null ? void 0 : h.exactUsedKey) || n, p = Object.prototype.toString.apply(c), v = ["[object Number]", "[object Function]", "[object RegExp]"], L = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, w = !this.i18nFormat || this.i18nFormat.handleAsObject, I = !d(c) && typeof c != "boolean" && typeof c != "number";
374
- if (w && c && I && v.indexOf(p) < 0 && !(d(L) && Array.isArray(c))) {
375
- if (!t.returnObjects && !this.options.returnObjects) {
376
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
377
- const y = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, c, {
378
- ...t,
379
- ns: o
380
- }) : `key '${n} (${this.language})' returned an object instead of string.`;
381
- return i ? (h.res = y, h.usedParams = this.getUsedParamsDetails(t), h) : y;
382
- }
383
- if (r) {
384
- const y = Array.isArray(c), O = y ? [] : {}, k = y ? g : m;
385
- for (const x in c)
386
- if (Object.prototype.hasOwnProperty.call(c, x)) {
387
- const N = `${k}${r}${x}`;
388
- O[x] = this.translate(N, {
389
- ...t,
390
- joinArrays: !1,
391
- ns: o
392
- }), O[x] === N && (O[x] = c[x]);
393
- }
394
- c = O;
395
- }
396
- } else if (w && d(L) && Array.isArray(c))
397
- c = c.join(L), c && (c = this.extendTranslation(c, e, t, s));
398
- else {
399
- let y = !1, O = !1;
400
- const k = t.count !== void 0 && !d(t.count), x = q.hasDefaultValue(t), N = k ? this.pluralResolver.getSuffix(u, t.count, t) : "", D = t.ordinal && k ? this.pluralResolver.getSuffix(u, t.count, {
401
- ordinal: !1
402
- }) : "", E = k && !t.ordinal && t.count === 0, M = E && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${N}`] || t[`defaultValue${D}`] || t.defaultValue;
403
- !this.isValidLookup(c) && x && (y = !0, c = M), this.isValidLookup(c) || (O = !0, c = n);
404
- const ke = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && O ? void 0 : c, K = x && M !== c && this.options.updateMissing;
405
- if (O || y || K) {
406
- if (this.logger.log(K ? "updateKey" : "missingKey", u, l, n, K ? M : c), r) {
407
- const C = this.resolve(n, {
408
- ...t,
409
- keySeparator: !1
410
- });
411
- C && C.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.");
412
- }
413
- let U = [];
414
- const Y = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
415
- if (this.options.saveMissingTo === "fallback" && Y && Y[0])
416
- for (let C = 0; C < Y.length; C++)
417
- U.push(Y[C]);
418
- else this.options.saveMissingTo === "all" ? U = this.languageUtils.toResolveHierarchy(t.lng || this.language) : U.push(t.lng || this.language);
419
- const oe = (C, V, H) => {
420
- var ue;
421
- const le = x && H !== c ? H : ke;
422
- this.options.missingKeyHandler ? this.options.missingKeyHandler(C, l, V, le, K, t) : (ue = this.backendConnector) != null && ue.saveMissing && this.backendConnector.saveMissing(C, l, V, le, K, t), this.emit("missingKey", C, l, V, c);
423
- };
424
- this.options.saveMissing && (this.options.saveMissingPlurals && k ? U.forEach((C) => {
425
- const V = this.pluralResolver.getSuffixes(C, t);
426
- E && t[`defaultValue${this.options.pluralSeparator}zero`] && V.indexOf(`${this.options.pluralSeparator}zero`) < 0 && V.push(`${this.options.pluralSeparator}zero`), V.forEach((H) => {
427
- oe([C], n + H, t[`defaultValue${H}`] || M);
428
- });
429
- }) : oe(U, n, M));
430
- }
431
- c = this.extendTranslation(c, e, t, h, s), O && c === n && this.options.appendNamespaceToMissingKey && (c = `${l}:${n}`), (O || y) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}:${n}` : n, y ? c : void 0));
432
- }
433
- return i ? (h.res = c, h.usedParams = this.getUsedParamsDetails(t), h) : c;
434
- }
435
- extendTranslation(e, t, s, i, r) {
436
- var u, f;
437
- var n = this;
438
- if ((u = this.i18nFormat) != null && u.parse)
439
- e = this.i18nFormat.parse(e, {
440
- ...this.options.interpolation.defaultVariables,
441
- ...s
442
- }, s.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
443
- resolved: i
444
- });
445
- else if (!s.skipInterpolation) {
446
- s.interpolation && this.interpolator.init({
447
- ...s,
448
- interpolation: {
449
- ...this.options.interpolation,
450
- ...s.interpolation
451
- }
452
- });
453
- const h = d(e) && (((f = s == null ? void 0 : s.interpolation) == null ? void 0 : f.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
454
- let c;
455
- if (h) {
456
- const g = e.match(this.interpolator.nestingRegexp);
457
- c = g && g.length;
458
- }
459
- let m = s.replace && !d(s.replace) ? s.replace : s;
460
- if (this.options.interpolation.defaultVariables && (m = {
461
- ...this.options.interpolation.defaultVariables,
462
- ...m
463
- }), e = this.interpolator.interpolate(e, m, s.lng || this.language || i.usedLng, s), h) {
464
- const g = e.match(this.interpolator.nestingRegexp), p = g && g.length;
465
- c < p && (s.nest = !1);
466
- }
467
- !s.lng && i && i.res && (s.lng = this.language || i.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
468
- for (var g = arguments.length, p = new Array(g), v = 0; v < g; v++)
469
- p[v] = arguments[v];
470
- return (r == null ? void 0 : r[0]) === p[0] && !s.context ? (n.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`), null) : n.translate(...p, t);
471
- }, s)), s.interpolation && this.interpolator.reset();
472
- }
473
- const o = s.postProcess || this.options.postProcess, l = d(o) ? [o] : o;
474
- return e != null && (l != null && l.length) && s.applyPostProcessor !== !1 && (e = Pe.handle(l, e, t, this.options && this.options.postProcessPassResolved ? {
475
- i18nResolved: {
476
- ...i,
477
- usedParams: this.getUsedParamsDetails(s)
478
- },
479
- ...s
480
- } : s, this)), e;
481
- }
482
- resolve(e) {
483
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, i, r, n, o;
484
- return d(e) && (e = [e]), e.forEach((l) => {
485
- if (this.isValidLookup(s)) return;
486
- const u = this.extractFromKey(l, t), f = u.key;
487
- i = f;
488
- let h = u.namespaces;
489
- this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
490
- const c = t.count !== void 0 && !d(t.count), m = c && !t.ordinal && t.count === 0, g = 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);
491
- h.forEach((v) => {
492
- var L, w;
493
- this.isValidLookup(s) || (o = v, !ve[`${p[0]}-${v}`] && ((L = this.utils) != null && L.hasLoadedNamespace) && !((w = this.utils) != null && w.hasLoadedNamespace(o)) && (ve[`${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((I) => {
494
- var k;
495
- if (this.isValidLookup(s)) return;
496
- n = I;
497
- const y = [f];
498
- if ((k = this.i18nFormat) != null && k.addLookupKeys)
499
- this.i18nFormat.addLookupKeys(y, f, I, v, t);
500
- else {
501
- let x;
502
- c && (x = this.pluralResolver.getSuffix(I, t.count, t));
503
- const N = `${this.options.pluralSeparator}zero`, D = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
504
- if (c && (y.push(f + x), t.ordinal && x.indexOf(D) === 0 && y.push(f + x.replace(D, this.options.pluralSeparator)), m && y.push(f + N)), g) {
505
- const E = `${f}${this.options.contextSeparator}${t.context}`;
506
- y.push(E), c && (y.push(E + x), t.ordinal && x.indexOf(D) === 0 && y.push(E + x.replace(D, this.options.pluralSeparator)), m && y.push(E + N));
507
- }
508
- }
509
- let O;
510
- for (; O = y.pop(); )
511
- this.isValidLookup(s) || (r = O, s = this.getResource(I, v, O, t));
512
- }));
513
- });
514
- }), {
515
- res: s,
516
- usedKey: i,
517
- exactUsedKey: r,
518
- usedLng: n,
519
- usedNS: o
520
- };
521
- }
522
- isValidLookup(e) {
523
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
524
- }
525
- getResource(e, t, s) {
526
- var r;
527
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
528
- return (r = this.i18nFormat) != null && r.getResource ? this.i18nFormat.getResource(e, t, s, i) : this.resourceStore.getResource(e, t, s, i);
529
- }
530
- getUsedParamsDetails() {
531
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
532
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !d(e.replace);
533
- let i = s ? e.replace : e;
534
- if (s && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
535
- ...this.options.interpolation.defaultVariables,
536
- ...i
537
- }), !s) {
538
- i = {
539
- ...i
540
- };
541
- for (const r of t)
542
- delete i[r];
543
- }
544
- return i;
545
- }
546
- static hasDefaultValue(e) {
547
- const t = "defaultValue";
548
- for (const s in e)
549
- if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
550
- return !0;
551
- return !1;
552
- }
553
- }
554
- class ye {
555
- constructor(e) {
556
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = P.create("languageUtils");
557
- }
558
- getScriptPartFromCode(e) {
559
- if (e = Q(e), !e || e.indexOf("-") < 0) return null;
560
- const t = e.split("-");
561
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
562
- }
563
- getLanguagePartFromCode(e) {
564
- if (e = Q(e), !e || e.indexOf("-") < 0) return e;
565
- const t = e.split("-");
566
- return this.formatLanguageCode(t[0]);
567
- }
568
- formatLanguageCode(e) {
569
- if (d(e) && e.indexOf("-") > -1) {
570
- let t;
571
- try {
572
- t = Intl.getCanonicalLocales(e)[0];
573
- } catch {
574
- }
575
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
576
- }
577
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
578
- }
579
- isSupportedCode(e) {
580
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
581
- }
582
- getBestMatchFromCodes(e) {
583
- if (!e) return null;
584
- let t;
585
- return e.forEach((s) => {
586
- if (t) return;
587
- const i = this.formatLanguageCode(s);
588
- (!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
589
- }), !t && this.options.supportedLngs && e.forEach((s) => {
590
- if (t) return;
591
- const i = this.getLanguagePartFromCode(s);
592
- if (this.isSupportedCode(i)) return t = i;
593
- t = this.options.supportedLngs.find((r) => {
594
- if (r === i) return r;
595
- if (!(r.indexOf("-") < 0 && i.indexOf("-") < 0) && (r.indexOf("-") > 0 && i.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === i || r.indexOf(i) === 0 && i.length > 1))
596
- return r;
597
- });
598
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
599
- }
600
- getFallbackCodes(e, t) {
601
- if (!e) return [];
602
- if (typeof e == "function" && (e = e(t)), d(e) && (e = [e]), Array.isArray(e)) return e;
603
- if (!t) return e.default || [];
604
- let s = e[t];
605
- return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
606
- }
607
- toResolveHierarchy(e, t) {
608
- const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), i = [], r = (n) => {
609
- n && (this.isSupportedCode(n) ? i.push(n) : this.logger.warn(`rejecting language code not found in supportedLngs: ${n}`));
610
- };
611
- return d(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && r(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && r(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && r(this.getLanguagePartFromCode(e))) : d(e) && r(this.formatLanguageCode(e)), s.forEach((n) => {
612
- i.indexOf(n) < 0 && r(this.formatLanguageCode(n));
613
- }), i;
614
- }
615
- }
616
- const xe = {
617
- zero: 0,
618
- one: 1,
619
- two: 2,
620
- few: 3,
621
- many: 4,
622
- other: 5
623
- }, be = {
624
- select: (a) => a === 1 ? "one" : "other",
625
- resolvedOptions: () => ({
626
- pluralCategories: ["one", "other"]
627
- })
628
- };
629
- class We {
630
- constructor(e) {
631
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
632
- this.languageUtils = e, this.options = t, this.logger = P.create("pluralResolver"), this.pluralRulesCache = {};
633
- }
634
- addRule(e, t) {
635
- this.rules[e] = t;
636
- }
637
- clearCache() {
638
- this.pluralRulesCache = {};
639
- }
640
- getRule(e) {
641
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
642
- const s = Q(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", r = JSON.stringify({
643
- cleanedCode: s,
644
- type: i
645
- });
646
- if (r in this.pluralRulesCache)
647
- return this.pluralRulesCache[r];
648
- let n;
649
- try {
650
- n = new Intl.PluralRules(s, {
651
- type: i
652
- });
653
- } catch {
654
- if (!Intl)
655
- return this.logger.error("No Intl support, please use an Intl polyfill!"), be;
656
- if (!e.match(/-|_/)) return be;
657
- const l = this.languageUtils.getLanguagePartFromCode(e);
658
- n = this.getRule(l, t);
659
- }
660
- return this.pluralRulesCache[r] = n, n;
661
- }
662
- needsPlural(e) {
663
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
664
- return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
665
- }
666
- getPluralFormsOfKey(e, t) {
667
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
668
- return this.getSuffixes(e, s).map((i) => `${t}${i}`);
669
- }
670
- getSuffixes(e) {
671
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
672
- return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((i, r) => xe[i] - xe[r]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
673
- }
674
- getSuffix(e, t) {
675
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
676
- const i = this.getRule(e, s);
677
- 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));
678
- }
679
- }
680
- const Se = function(a, e, t) {
681
- let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, r = Ke(a, e, t);
682
- return !r && i && d(t) && (r = re(a, t, s), r === void 0 && (r = re(e, t, s))), r;
683
- }, te = (a) => a.replace(/\$/g, "$$$$");
684
- class Ge {
685
- constructor() {
686
- var t;
687
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
688
- this.logger = P.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((s) => s), this.init(e);
689
- }
690
- init() {
691
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
692
- e.interpolation || (e.interpolation = {
693
- escapeValue: !0
694
- });
695
- const {
696
- escape: t,
697
- escapeValue: s,
698
- useRawValueToEscape: i,
699
- prefix: r,
700
- prefixEscaped: n,
701
- suffix: o,
702
- suffixEscaped: l,
703
- formatSeparator: u,
704
- unescapeSuffix: f,
705
- unescapePrefix: h,
706
- nestingPrefix: c,
707
- nestingPrefixEscaped: m,
708
- nestingSuffix: g,
709
- nestingSuffixEscaped: p,
710
- nestingOptionsSeparator: v,
711
- maxReplaces: L,
712
- alwaysFormat: w
713
- } = e.interpolation;
714
- this.escape = t !== void 0 ? t : He, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = r ? T(r) : n || "{{", this.suffix = o ? T(o) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = f ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : f || "", this.nestingPrefix = c ? T(c) : m || T("$t("), this.nestingSuffix = g ? T(g) : p || T(")"), this.nestingOptionsSeparator = v || ",", this.maxReplaces = L || 1e3, this.alwaysFormat = w !== void 0 ? w : !1, this.resetRegExp();
715
- }
716
- reset() {
717
- this.options && this.init(this.options);
718
- }
719
- resetRegExp() {
720
- const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
721
- 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}`);
722
- }
723
- interpolate(e, t, s, i) {
724
- var m;
725
- let r, n, o;
726
- const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (g) => {
727
- if (g.indexOf(this.formatSeparator) < 0) {
728
- const w = Se(t, l, g, this.options.keySeparator, this.options.ignoreJSONStructure);
729
- return this.alwaysFormat ? this.format(w, void 0, s, {
730
- ...i,
731
- ...t,
732
- interpolationkey: g
733
- }) : w;
734
- }
735
- const p = g.split(this.formatSeparator), v = p.shift().trim(), L = p.join(this.formatSeparator).trim();
736
- return this.format(Se(t, l, v, this.options.keySeparator, this.options.ignoreJSONStructure), L, s, {
737
- ...i,
738
- ...t,
739
- interpolationkey: v
740
- });
741
- };
742
- this.resetRegExp();
743
- const f = (i == null ? void 0 : i.missingInterpolationHandler) || this.options.missingInterpolationHandler, h = ((m = i == null ? void 0 : i.interpolation) == null ? void 0 : m.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
744
- return [{
745
- regex: this.regexpUnescape,
746
- safeValue: (g) => te(g)
747
- }, {
748
- regex: this.regexp,
749
- safeValue: (g) => this.escapeValue ? te(this.escape(g)) : te(g)
750
- }].forEach((g) => {
751
- for (o = 0; r = g.regex.exec(e); ) {
752
- const p = r[1].trim();
753
- if (n = u(p), n === void 0)
754
- if (typeof f == "function") {
755
- const L = f(e, r, i);
756
- n = d(L) ? L : "";
757
- } else if (i && Object.prototype.hasOwnProperty.call(i, p))
758
- n = "";
759
- else if (h) {
760
- n = r[0];
761
- continue;
762
- } else
763
- this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), n = "";
764
- else !d(n) && !this.useRawValueToEscape && (n = he(n));
765
- const v = g.safeValue(n);
766
- if (e = e.replace(r[0], v), h ? (g.regex.lastIndex += n.length, g.regex.lastIndex -= r[0].length) : g.regex.lastIndex = 0, o++, o >= this.maxReplaces)
767
- break;
768
- }
769
- }), e;
770
- }
771
- nest(e, t) {
772
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, r, n;
773
- const o = (l, u) => {
774
- const f = this.nestingOptionsSeparator;
775
- if (l.indexOf(f) < 0) return l;
776
- const h = l.split(new RegExp(`${f}[ ]*{`));
777
- let c = `{${h[1]}`;
778
- l = h[0], c = this.interpolate(c, n);
779
- const m = c.match(/'/g), g = c.match(/"/g);
780
- (((m == null ? void 0 : m.length) ?? 0) % 2 === 0 && !g || g.length % 2 !== 0) && (c = c.replace(/'/g, '"'));
781
- try {
782
- n = JSON.parse(c), u && (n = {
783
- ...u,
784
- ...n
785
- });
786
- } catch (p) {
787
- return this.logger.warn(`failed parsing options string in nesting for key ${l}`, p), `${l}${f}${c}`;
788
- }
789
- return n.defaultValue && n.defaultValue.indexOf(this.prefix) > -1 && delete n.defaultValue, l;
790
- };
791
- for (; i = this.nestingRegexp.exec(e); ) {
792
- let l = [];
793
- n = {
794
- ...s
795
- }, n = n.replace && !d(n.replace) ? n.replace : n, n.applyPostProcessor = !1, delete n.defaultValue;
796
- let u = !1;
797
- if (i[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(i[1])) {
798
- const f = i[1].split(this.formatSeparator).map((h) => h.trim());
799
- i[1] = f.shift(), l = f, u = !0;
800
- }
801
- if (r = t(o.call(this, i[1].trim(), n), n), r && i[0] === e && !d(r)) return r;
802
- d(r) || (r = he(r)), r || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), r = ""), u && (r = l.reduce((f, h) => this.format(f, h, s.lng, {
803
- ...s,
804
- interpolationkey: i[1].trim()
805
- }), r.trim())), e = e.replace(i[0], r), this.regexp.lastIndex = 0;
806
- }
807
- return e;
808
- }
809
- }
810
- const Ze = (a) => {
811
- let e = a.toLowerCase().trim();
812
- const t = {};
813
- if (a.indexOf("(") > -1) {
814
- const s = a.split("(");
815
- e = s[0].toLowerCase().trim();
816
- const i = s[1].substring(0, s[1].length - 1);
817
- 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((n) => {
818
- if (n) {
819
- const [o, ...l] = n.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), f = o.trim();
820
- t[f] || (t[f] = u), u === "false" && (t[f] = !1), u === "true" && (t[f] = !0), isNaN(u) || (t[f] = parseInt(u, 10));
821
- }
822
- });
823
- }
824
- return {
825
- formatName: e,
826
- formatOptions: t
827
- };
828
- }, A = (a) => {
829
- const e = {};
830
- return (t, s, i) => {
831
- let r = i;
832
- i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (r = {
833
- ...r,
834
- [i.interpolationkey]: void 0
835
- });
836
- const n = s + JSON.stringify(r);
837
- let o = e[n];
838
- return o || (o = a(Q(s), i), e[n] = o), o(t);
839
- };
840
- };
841
- class Qe {
842
- constructor() {
843
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
844
- this.logger = P.create("formatter"), this.options = e, this.formats = {
845
- number: A((t, s) => {
846
- const i = new Intl.NumberFormat(t, {
847
- ...s
848
- });
849
- return (r) => i.format(r);
850
- }),
851
- currency: A((t, s) => {
852
- const i = new Intl.NumberFormat(t, {
853
- ...s,
854
- style: "currency"
855
- });
856
- return (r) => i.format(r);
857
- }),
858
- datetime: A((t, s) => {
859
- const i = new Intl.DateTimeFormat(t, {
860
- ...s
861
- });
862
- return (r) => i.format(r);
863
- }),
864
- relativetime: A((t, s) => {
865
- const i = new Intl.RelativeTimeFormat(t, {
866
- ...s
867
- });
868
- return (r) => i.format(r, s.range || "day");
869
- }),
870
- list: A((t, s) => {
871
- const i = new Intl.ListFormat(t, {
872
- ...s
873
- });
874
- return (r) => i.format(r);
875
- })
876
- }, this.init(e);
877
- }
878
- init(e) {
879
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
880
- interpolation: {}
881
- };
882
- this.formatSeparator = t.interpolation.formatSeparator || ",";
883
- }
884
- add(e, t) {
885
- this.formats[e.toLowerCase().trim()] = t;
886
- }
887
- addCached(e, t) {
888
- this.formats[e.toLowerCase().trim()] = A(t);
889
- }
890
- format(e, t, s) {
891
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
892
- const r = t.split(this.formatSeparator);
893
- if (r.length > 1 && r[0].indexOf("(") > 1 && r[0].indexOf(")") < 0 && r.find((o) => o.indexOf(")") > -1)) {
894
- const o = r.findIndex((l) => l.indexOf(")") > -1);
895
- r[0] = [r[0], ...r.splice(1, o)].join(this.formatSeparator);
896
- }
897
- return r.reduce((o, l) => {
898
- var h;
899
- const {
900
- formatName: u,
901
- formatOptions: f
902
- } = Ze(l);
903
- if (this.formats[u]) {
904
- let c = o;
905
- try {
906
- const m = ((h = i == null ? void 0 : i.formatParams) == null ? void 0 : h[i.interpolationkey]) || {}, g = m.locale || m.lng || i.locale || i.lng || s;
907
- c = this.formats[u](o, g, {
908
- ...f,
909
- ...i,
910
- ...m
911
- });
912
- } catch (m) {
913
- this.logger.warn(m);
914
- }
915
- return c;
916
- } else
917
- this.logger.warn(`there was no format function for ${u}`);
918
- return o;
919
- }, e);
920
- }
921
- }
922
- const Xe = (a, e) => {
923
- a.pending[e] !== void 0 && (delete a.pending[e], a.pendingCount--);
924
- };
925
- class qe extends ee {
926
- constructor(e, t, s) {
927
- var r, n;
928
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
929
- super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = i, this.logger = P.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 = [], (n = (r = this.backend) == null ? void 0 : r.init) == null || n.call(r, s, i.backend, i);
930
- }
931
- queueLoad(e, t, s, i) {
932
- const r = {}, n = {}, o = {}, l = {};
933
- return e.forEach((u) => {
934
- let f = !0;
935
- t.forEach((h) => {
936
- const c = `${u}|${h}`;
937
- !s.reload && this.store.hasResourceBundle(u, h) ? this.state[c] = 2 : this.state[c] < 0 || (this.state[c] === 1 ? n[c] === void 0 && (n[c] = !0) : (this.state[c] = 1, f = !1, n[c] === void 0 && (n[c] = !0), r[c] === void 0 && (r[c] = !0), l[h] === void 0 && (l[h] = !0)));
938
- }), f || (o[u] = !0);
939
- }), (Object.keys(r).length || Object.keys(n).length) && this.queue.push({
940
- pending: n,
941
- pendingCount: Object.keys(n).length,
942
- loaded: {},
943
- errors: [],
944
- callback: i
945
- }), {
946
- toLoad: Object.keys(r),
947
- pending: Object.keys(n),
948
- toLoadLanguages: Object.keys(o),
949
- toLoadNamespaces: Object.keys(l)
950
- };
951
- }
952
- loaded(e, t, s) {
953
- const i = e.split("|"), r = i[0], n = i[1];
954
- t && this.emit("failedLoading", r, n, t), !t && s && this.store.addResourceBundle(r, n, s, void 0, void 0, {
955
- skipCopy: !0
956
- }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
957
- const o = {};
958
- this.queue.forEach((l) => {
959
- Me(l.loaded, [r], n), Xe(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
960
- o[u] || (o[u] = {});
961
- const f = l.loaded[u];
962
- f.length && f.forEach((h) => {
963
- o[u][h] === void 0 && (o[u][h] = !0);
964
- });
965
- }), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
966
- }), this.emit("loaded", o), this.queue = this.queue.filter((l) => !l.done);
967
- }
968
- read(e, t, s) {
969
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, n = arguments.length > 5 ? arguments[5] : void 0;
970
- if (!e.length) return n(null, {});
971
- if (this.readingCalls >= this.maxParallelReads) {
972
- this.waitingReads.push({
973
- lng: e,
974
- ns: t,
975
- fcName: s,
976
- tried: i,
977
- wait: r,
978
- callback: n
979
- });
980
- return;
981
- }
982
- this.readingCalls++;
983
- const o = (u, f) => {
984
- if (this.readingCalls--, this.waitingReads.length > 0) {
985
- const h = this.waitingReads.shift();
986
- this.read(h.lng, h.ns, h.fcName, h.tried, h.wait, h.callback);
987
- }
988
- if (u && f && i < this.maxRetries) {
989
- setTimeout(() => {
990
- this.read.call(this, e, t, s, i + 1, r * 2, n);
991
- }, r);
992
- return;
993
- }
994
- n(u, f);
995
- }, l = this.backend[s].bind(this.backend);
996
- if (l.length === 2) {
997
- try {
998
- const u = l(e, t);
999
- u && typeof u.then == "function" ? u.then((f) => o(null, f)).catch(o) : o(null, u);
1000
- } catch (u) {
1001
- o(u);
1002
- }
1003
- return;
1004
- }
1005
- return l(e, t, o);
1006
- }
1007
- prepareLoading(e, t) {
1008
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 ? arguments[3] : void 0;
1009
- if (!this.backend)
1010
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
1011
- d(e) && (e = this.languageUtils.toResolveHierarchy(e)), d(t) && (t = [t]);
1012
- const r = this.queueLoad(e, t, s, i);
1013
- if (!r.toLoad.length)
1014
- return r.pending.length || i(), null;
1015
- r.toLoad.forEach((n) => {
1016
- this.loadOne(n);
1017
- });
1018
- }
1019
- load(e, t, s) {
1020
- this.prepareLoading(e, t, {}, s);
1021
- }
1022
- reload(e, t, s) {
1023
- this.prepareLoading(e, t, {
1024
- reload: !0
1025
- }, s);
1026
- }
1027
- loadOne(e) {
1028
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1029
- const s = e.split("|"), i = s[0], r = s[1];
1030
- this.read(i, r, "read", void 0, void 0, (n, o) => {
1031
- n && this.logger.warn(`${t}loading namespace ${r} for language ${i} failed`, n), !n && o && this.logger.log(`${t}loaded namespace ${r} for language ${i}`, o), this.loaded(e, n, o);
1032
- });
1033
- }
1034
- saveMissing(e, t, s, i, r) {
1035
- var l, u, f, h, c;
1036
- let n = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1037
- };
1038
- if ((u = (l = this.services) == null ? void 0 : l.utils) != null && u.hasLoadedNamespace && !((h = (f = this.services) == null ? void 0 : f.utils) != null && h.hasLoadedNamespace(t))) {
1039
- 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!!!");
1040
- return;
1041
- }
1042
- if (!(s == null || s === "")) {
1043
- if ((c = this.backend) != null && c.create) {
1044
- const m = {
1045
- ...n,
1046
- isUpdate: r
1047
- }, g = this.backend.create.bind(this.backend);
1048
- if (g.length < 6)
1049
- try {
1050
- let p;
1051
- g.length === 5 ? p = g(e, t, s, i, m) : p = g(e, t, s, i), p && typeof p.then == "function" ? p.then((v) => o(null, v)).catch(o) : o(null, p);
1052
- } catch (p) {
1053
- o(p);
1054
- }
1055
- else
1056
- g(e, t, s, i, o, m);
1057
- }
1058
- !e || !e[0] || this.store.addResource(e[0], t, s, i);
1059
- }
1060
- }
1061
- }
1062
- const Oe = () => ({
1063
- debug: !1,
1064
- initAsync: !0,
1065
- ns: ["translation"],
1066
- defaultNS: ["translation"],
1067
- fallbackLng: ["dev"],
1068
- fallbackNS: !1,
1069
- supportedLngs: !1,
1070
- nonExplicitSupportedLngs: !1,
1071
- load: "all",
1072
- preload: !1,
1073
- simplifyPluralSuffix: !0,
1074
- keySeparator: ".",
1075
- nsSeparator: ":",
1076
- pluralSeparator: "_",
1077
- contextSeparator: "_",
1078
- partialBundledLanguages: !1,
1079
- saveMissing: !1,
1080
- updateMissing: !1,
1081
- saveMissingTo: "fallback",
1082
- saveMissingPlurals: !0,
1083
- missingKeyHandler: !1,
1084
- missingInterpolationHandler: !1,
1085
- postProcess: !1,
1086
- postProcessPassResolved: !1,
1087
- returnNull: !1,
1088
- returnEmptyString: !0,
1089
- returnObjects: !1,
1090
- joinArrays: !1,
1091
- returnedObjectHandler: !1,
1092
- parseMissingKeyHandler: !1,
1093
- appendNamespaceToMissingKey: !1,
1094
- appendNamespaceToCIMode: !1,
1095
- overloadTranslationOptionHandler: (a) => {
1096
- let e = {};
1097
- if (typeof a[1] == "object" && (e = a[1]), d(a[1]) && (e.defaultValue = a[1]), d(a[2]) && (e.tDescription = a[2]), typeof a[2] == "object" || typeof a[3] == "object") {
1098
- const t = a[3] || a[2];
1099
- Object.keys(t).forEach((s) => {
1100
- e[s] = t[s];
1101
- });
1102
- }
1103
- return e;
1104
- },
1105
- interpolation: {
1106
- escapeValue: !0,
1107
- format: (a) => a,
1108
- prefix: "{{",
1109
- suffix: "}}",
1110
- formatSeparator: ",",
1111
- unescapePrefix: "-",
1112
- nestingPrefix: "$t(",
1113
- nestingSuffix: ")",
1114
- nestingOptionsSeparator: ",",
1115
- maxReplaces: 1e3,
1116
- skipOnVariables: !0
1117
- }
1118
- }), Le = (a) => {
1119
- var e, t;
1120
- return d(a.ns) && (a.ns = [a.ns]), d(a.fallbackLng) && (a.fallbackLng = [a.fallbackLng]), d(a.fallbackNS) && (a.fallbackNS = [a.fallbackNS]), ((t = (e = a.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (a.supportedLngs = a.supportedLngs.concat(["cimode"])), typeof a.initImmediate == "boolean" && (a.initAsync = a.initImmediate), a;
1121
- }, W = () => {
1122
- }, et = (a) => {
1123
- Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach((t) => {
1124
- typeof a[t] == "function" && (a[t] = a[t].bind(a));
1125
- });
1126
- };
1127
- class J extends ee {
1128
- constructor() {
1129
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1130
- if (super(), this.options = Le(e), this.services = {}, this.logger = P, this.modules = {
1131
- external: []
1132
- }, et(this), t && !this.isInitialized && !e.isClone) {
1133
- if (!this.options.initAsync)
1134
- return this.init(e, t), this;
1135
- setTimeout(() => {
1136
- this.init(e, t);
1137
- }, 0);
1138
- }
1139
- }
1140
- init() {
1141
- var e = this;
1142
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
1143
- 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]));
1144
- const i = Oe();
1145
- this.options = {
1146
- ...i,
1147
- ...this.options,
1148
- ...Le(t)
1149
- }, this.options.interpolation = {
1150
- ...i.interpolation,
1151
- ...this.options.interpolation
1152
- }, t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
1153
- const r = (f) => f ? typeof f == "function" ? new f() : f : null;
1154
- if (!this.options.isClone) {
1155
- this.modules.logger ? P.init(r(this.modules.logger), this.options) : P.init(null, this.options);
1156
- let f;
1157
- this.modules.formatter ? f = this.modules.formatter : f = Qe;
1158
- const h = new ye(this.options);
1159
- this.store = new me(this.options.resources, this.options);
1160
- const c = this.services;
1161
- c.logger = P, c.resourceStore = this.store, c.languageUtils = h, c.pluralResolver = new We(h, {
1162
- prepend: this.options.pluralSeparator,
1163
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1164
- }), f && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (c.formatter = r(f), c.formatter.init(c, this.options), this.options.interpolation.format = c.formatter.format.bind(c.formatter)), c.interpolator = new Ge(this.options), c.utils = {
1165
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1166
- }, c.backendConnector = new qe(r(this.modules.backend), c.resourceStore, c, this.options), c.backendConnector.on("*", function(m) {
1167
- for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), v = 1; v < g; v++)
1168
- p[v - 1] = arguments[v];
1169
- e.emit(m, ...p);
1170
- }), this.modules.languageDetector && (c.languageDetector = r(this.modules.languageDetector), c.languageDetector.init && c.languageDetector.init(c, this.options.detection, this.options)), this.modules.i18nFormat && (c.i18nFormat = r(this.modules.i18nFormat), c.i18nFormat.init && c.i18nFormat.init(this)), this.translator = new q(this.services, this.options), this.translator.on("*", function(m) {
1171
- for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), v = 1; v < g; v++)
1172
- p[v - 1] = arguments[v];
1173
- e.emit(m, ...p);
1174
- }), this.modules.external.forEach((m) => {
1175
- m.init && m.init(this);
1176
- });
1177
- }
1178
- if (this.format = this.options.interpolation.format, s || (s = W), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1179
- const f = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1180
- f.length > 0 && f[0] !== "dev" && (this.options.lng = f[0]);
1181
- }
1182
- !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) => {
1183
- this[f] = function() {
1184
- return e.store[f](...arguments);
1185
- };
1186
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((f) => {
1187
- this[f] = function() {
1188
- return e.store[f](...arguments), e;
1189
- };
1190
- });
1191
- const l = _(), u = () => {
1192
- const f = (h, c) => {
1193
- 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(h, c);
1194
- };
1195
- if (this.languages && !this.isInitialized) return f(null, this.t.bind(this));
1196
- this.changeLanguage(this.options.lng, f);
1197
- };
1198
- return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), l;
1199
- }
1200
- loadResources(e) {
1201
- var r, n;
1202
- let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : W;
1203
- const i = d(e) ? e : this.language;
1204
- if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1205
- if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
1206
- const o = [], l = (u) => {
1207
- if (!u || u === "cimode") return;
1208
- this.services.languageUtils.toResolveHierarchy(u).forEach((h) => {
1209
- h !== "cimode" && o.indexOf(h) < 0 && o.push(h);
1210
- });
1211
- };
1212
- i ? l(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((f) => l(f)), (n = (r = this.options.preload) == null ? void 0 : r.forEach) == null || n.call(r, (u) => l(u)), this.services.backendConnector.load(o, this.options.ns, (u) => {
1213
- !u && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(u);
1214
- });
1215
- } else
1216
- s(null);
1217
- }
1218
- reloadResources(e, t, s) {
1219
- const i = _();
1220
- 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 = W), this.services.backendConnector.reload(e, t, (r) => {
1221
- i.resolve(), s(r);
1222
- }), i;
1223
- }
1224
- use(e) {
1225
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1226
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1227
- 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" && Pe.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1228
- }
1229
- setResolvedLanguage(e) {
1230
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
1231
- for (let t = 0; t < this.languages.length; t++) {
1232
- const s = this.languages[t];
1233
- if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1234
- this.resolvedLanguage = s;
1235
- break;
1236
- }
1237
- }
1238
- }
1239
- changeLanguage(e, t) {
1240
- var s = this;
1241
- this.isLanguageChangingTo = e;
1242
- const i = _();
1243
- this.emit("languageChanging", e);
1244
- const r = (l) => {
1245
- this.language = l, this.languages = this.services.languageUtils.toResolveHierarchy(l), this.resolvedLanguage = void 0, this.setResolvedLanguage(l);
1246
- }, n = (l, u) => {
1247
- u ? (r(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() {
1248
- return s.t(...arguments);
1249
- }), t && t(l, function() {
1250
- return s.t(...arguments);
1251
- });
1252
- }, o = (l) => {
1253
- var f, h;
1254
- !e && !l && this.services.languageDetector && (l = []);
1255
- const u = d(l) ? l : this.services.languageUtils.getBestMatchFromCodes(l);
1256
- u && (this.language || r(u), this.translator.language || this.translator.changeLanguage(u), (h = (f = this.services.languageDetector) == null ? void 0 : f.cacheUserLanguage) == null || h.call(f, u)), this.loadResources(u, (c) => {
1257
- n(c, u);
1258
- });
1259
- };
1260
- 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;
1261
- }
1262
- getFixedT(e, t, s) {
1263
- var i = this;
1264
- const r = function(n, o) {
1265
- let l;
1266
- if (typeof o != "object") {
1267
- for (var u = arguments.length, f = new Array(u > 2 ? u - 2 : 0), h = 2; h < u; h++)
1268
- f[h - 2] = arguments[h];
1269
- l = i.options.overloadTranslationOptionHandler([n, o].concat(f));
1270
- } else
1271
- l = {
1272
- ...o
1273
- };
1274
- l.lng = l.lng || r.lng, l.lngs = l.lngs || r.lngs, l.ns = l.ns || r.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || s || r.keyPrefix);
1275
- const c = i.options.keySeparator || ".";
1276
- let m;
1277
- return l.keyPrefix && Array.isArray(n) ? m = n.map((g) => `${l.keyPrefix}${c}${g}`) : m = l.keyPrefix ? `${l.keyPrefix}${c}${n}` : n, i.t(m, l);
1278
- };
1279
- return d(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = s, r;
1280
- }
1281
- t() {
1282
- var i;
1283
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
1284
- t[s] = arguments[s];
1285
- return (i = this.translator) == null ? void 0 : i.translate(...t);
1286
- }
1287
- exists() {
1288
- var i;
1289
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
1290
- t[s] = arguments[s];
1291
- return (i = this.translator) == null ? void 0 : i.exists(...t);
1292
- }
1293
- setDefaultNamespace(e) {
1294
- this.options.defaultNS = e;
1295
- }
1296
- hasLoadedNamespace(e) {
1297
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1298
- if (!this.isInitialized)
1299
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1300
- if (!this.languages || !this.languages.length)
1301
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1302
- const s = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
1303
- if (s.toLowerCase() === "cimode") return !0;
1304
- const n = (o, l) => {
1305
- const u = this.services.backendConnector.state[`${o}|${l}`];
1306
- return u === -1 || u === 0 || u === 2;
1307
- };
1308
- if (t.precheck) {
1309
- const o = t.precheck(this, n);
1310
- if (o !== void 0) return o;
1311
- }
1312
- return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || n(s, e) && (!i || n(r, e)));
1313
- }
1314
- loadNamespaces(e, t) {
1315
- const s = _();
1316
- return this.options.ns ? (d(e) && (e = [e]), e.forEach((i) => {
1317
- this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
1318
- }), this.loadResources((i) => {
1319
- s.resolve(), t && t(i);
1320
- }), s) : (t && t(), Promise.resolve());
1321
- }
1322
- loadLanguages(e, t) {
1323
- const s = _();
1324
- d(e) && (e = [e]);
1325
- const i = this.options.preload || [], r = e.filter((n) => i.indexOf(n) < 0 && this.services.languageUtils.isSupportedCode(n));
1326
- return r.length ? (this.options.preload = i.concat(r), this.loadResources((n) => {
1327
- s.resolve(), t && t(n);
1328
- }), s) : (t && t(), Promise.resolve());
1329
- }
1330
- dir(e) {
1331
- var i, r;
1332
- if (e || (e = this.resolvedLanguage || (((i = this.languages) == null ? void 0 : i.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1333
- 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 = ((r = this.services) == null ? void 0 : r.languageUtils) || new ye(Oe());
1334
- return t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1335
- }
1336
- static createInstance() {
1337
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1338
- return new J(e, t);
1339
- }
1340
- cloneInstance() {
1341
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : W;
1342
- const s = e.forkResourceStore;
1343
- s && delete e.forkResourceStore;
1344
- const i = {
1345
- ...this.options,
1346
- ...e,
1347
- isClone: !0
1348
- }, r = new J(i);
1349
- if ((e.debug !== void 0 || e.prefix !== void 0) && (r.logger = r.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
1350
- r[o] = this[o];
1351
- }), r.services = {
1352
- ...this.services
1353
- }, r.services.utils = {
1354
- hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1355
- }, s) {
1356
- const o = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
1357
- ...this.store.data[u]
1358
- }, Object.keys(l[u]).reduce((f, h) => (f[h] = {
1359
- ...l[u][h]
1360
- }, f), {})), {});
1361
- r.store = new me(o, i), r.services.resourceStore = r.store;
1362
- }
1363
- return r.translator = new q(r.services, i), r.translator.on("*", function(o) {
1364
- for (var l = arguments.length, u = new Array(l > 1 ? l - 1 : 0), f = 1; f < l; f++)
1365
- u[f - 1] = arguments[f];
1366
- r.emit(o, ...u);
1367
- }), r.init(i, t), r.translator.options = i, r.translator.backendConnector.services.utils = {
1368
- hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1369
- }, r;
1370
- }
1371
- toJSON() {
1372
- return {
1373
- options: this.options,
1374
- store: this.store,
1375
- language: this.language,
1376
- languages: this.languages,
1377
- resolvedLanguage: this.resolvedLanguage
1378
- };
1379
- }
1380
- }
1381
- const b = J.createInstance();
1382
- b.createInstance = J.createInstance;
1383
- b.createInstance;
1384
- b.dir;
1385
- b.init;
1386
- b.loadResources;
1387
- b.reloadResources;
1388
- b.use;
1389
- b.changeLanguage;
1390
- b.getFixedT;
1391
- b.t;
1392
- b.exists;
1393
- b.setDefaultNamespace;
1394
- b.hasLoadedNamespace;
1395
- b.loadNamespaces;
1396
- b.loadLanguages;
1397
- var tt = (a, e) => typeof e == "bigint" ? e.toString() : e;
1398
- function se(a, e = " | ") {
1399
- return a.map((t) => typeof t == "string" ? `'${t}'` : t).join(e);
1400
- }
1401
- var Ce = (a) => {
1402
- if (typeof a != "object" || a === null)
1403
- return !1;
1404
- for (const e in a)
1405
- if (!Object.prototype.hasOwnProperty.call(a, e))
1406
- return !1;
1407
- return !0;
1408
- }, st = (a, e) => {
1409
- if (typeof a == "string")
1410
- return { key: a, values: {} };
1411
- if (Ce(a)) {
1412
- const t = "key" in a && typeof a.key == "string" ? a.key : e, s = "values" in a && Ce(a.values) ? a.values : {};
1413
- return { key: t, values: s };
1414
- }
1415
- return { key: e, values: {} };
1416
- }, we = "zod", it = (a) => (e, t) => {
1417
- var l;
1418
- const { t: s, ns: i, handlePath: r } = {
1419
- t: b.t,
1420
- ns: we,
1421
- ...a,
1422
- handlePath: (a == null ? void 0 : a.handlePath) !== !1 ? {
1423
- context: "with_path",
1424
- ns: (a == null ? void 0 : a.ns) ?? we,
1425
- keyPrefix: void 0,
1426
- ...a == null ? void 0 : a.handlePath
1427
- } : null
1428
- };
1429
- let n;
1430
- n = je(e, t).message;
1431
- const o = e.path.length > 0 && r ? {
1432
- context: r.context,
1433
- path: s(
1434
- [r.keyPrefix, e.path.join(".")].filter(Boolean).join("."),
1435
- {
1436
- ns: r.ns,
1437
- defaultValue: e.path.join(".")
1438
- }
1439
- )
1440
- } : {};
1441
- switch (e.code) {
1442
- case S.invalid_type:
1443
- e.received === fe.undefined ? n = s("errors.invalid_type_received_undefined", {
1444
- ns: i,
1445
- defaultValue: n,
1446
- ...o
1447
- }) : e.received === fe.null ? n = s("errors.invalid_type_received_null", {
1448
- ns: i,
1449
- defaultValue: n,
1450
- ...o
1451
- }) : n = s("errors.invalid_type", {
1452
- expected: s(`types.${e.expected}`, {
1453
- defaultValue: e.expected,
1454
- ns: i
1455
- }),
1456
- received: s(`types.${e.received}`, {
1457
- defaultValue: e.received,
1458
- ns: i
1459
- }),
1460
- ns: i,
1461
- defaultValue: n,
1462
- ...o
1463
- });
1464
- break;
1465
- case S.invalid_literal:
1466
- n = s("errors.invalid_literal", {
1467
- expected: JSON.stringify(e.expected, tt),
1468
- ns: i,
1469
- defaultValue: n,
1470
- ...o
1471
- });
1472
- break;
1473
- case S.unrecognized_keys:
1474
- n = s("errors.unrecognized_keys", {
1475
- keys: se(e.keys, ", "),
1476
- count: e.keys.length,
1477
- ns: i,
1478
- defaultValue: n,
1479
- ...o
1480
- });
1481
- break;
1482
- case S.invalid_union:
1483
- n = s("errors.invalid_union", {
1484
- ns: i,
1485
- defaultValue: n,
1486
- ...o
1487
- });
1488
- break;
1489
- case S.invalid_union_discriminator:
1490
- n = s("errors.invalid_union_discriminator", {
1491
- options: se(e.options),
1492
- ns: i,
1493
- defaultValue: n,
1494
- ...o
1495
- });
1496
- break;
1497
- case S.invalid_enum_value:
1498
- n = s("errors.invalid_enum_value", {
1499
- options: se(e.options),
1500
- received: e.received,
1501
- ns: i,
1502
- defaultValue: n,
1503
- ...o
1504
- });
1505
- break;
1506
- case S.invalid_arguments:
1507
- n = s("errors.invalid_arguments", {
1508
- ns: i,
1509
- defaultValue: n,
1510
- ...o
1511
- });
1512
- break;
1513
- case S.invalid_return_type:
1514
- n = s("errors.invalid_return_type", {
1515
- ns: i,
1516
- defaultValue: n,
1517
- ...o
1518
- });
1519
- break;
1520
- case S.invalid_date:
1521
- n = s("errors.invalid_date", {
1522
- ns: i,
1523
- defaultValue: n,
1524
- ...o
1525
- });
1526
- break;
1527
- case S.invalid_string:
1528
- typeof e.validation == "object" ? "startsWith" in e.validation ? n = s("errors.invalid_string.startsWith", {
1529
- startsWith: e.validation.startsWith,
1530
- ns: i,
1531
- defaultValue: n,
1532
- ...o
1533
- }) : "endsWith" in e.validation && (n = s("errors.invalid_string.endsWith", {
1534
- endsWith: e.validation.endsWith,
1535
- ns: i,
1536
- defaultValue: n,
1537
- ...o
1538
- })) : n = s(`errors.invalid_string.${e.validation}`, {
1539
- validation: s(`validations.${e.validation}`, {
1540
- defaultValue: e.validation,
1541
- ns: i
1542
- }),
1543
- ns: i,
1544
- defaultValue: n,
1545
- ...o
1546
- });
1547
- break;
1548
- case S.too_small:
1549
- const u = e.type === "date" ? new Date(e.minimum) : e.minimum;
1550
- n = s(
1551
- `errors.too_small.${e.type}.${e.exact ? "exact" : e.inclusive ? "inclusive" : "not_inclusive"}`,
1552
- {
1553
- minimum: u,
1554
- count: typeof u == "number" ? u : void 0,
1555
- ns: i,
1556
- defaultValue: n,
1557
- ...o
1558
- }
1559
- );
1560
- break;
1561
- case S.too_big:
1562
- const f = e.type === "date" ? new Date(e.maximum) : e.maximum;
1563
- n = s(
1564
- `errors.too_big.${e.type}.${e.exact ? "exact" : e.inclusive ? "inclusive" : "not_inclusive"}`,
1565
- {
1566
- maximum: f,
1567
- count: typeof f == "number" ? f : void 0,
1568
- ns: i,
1569
- defaultValue: n,
1570
- ...o
1571
- }
1572
- );
1573
- break;
1574
- case S.custom:
1575
- const { key: h, values: c } = st(
1576
- (l = e.params) == null ? void 0 : l.i18n,
1577
- "errors.custom"
1578
- );
1579
- n = s(h, {
1580
- ...c,
1581
- ns: i,
1582
- defaultValue: n,
1583
- ...o
1584
- });
1585
- break;
1586
- case S.invalid_intersection_types:
1587
- n = s("errors.invalid_intersection_types", {
1588
- ns: i,
1589
- defaultValue: n,
1590
- ...o
1591
- });
1592
- break;
1593
- case S.not_multiple_of:
1594
- n = s("errors.not_multiple_of", {
1595
- multipleOf: e.multipleOf,
1596
- ns: i,
1597
- defaultValue: n,
1598
- ...o
1599
- });
1600
- break;
1601
- case S.not_finite:
1602
- n = s("errors.not_finite", {
1603
- ns: i,
1604
- defaultValue: n,
1605
- ...o
1606
- });
1607
- break;
1608
- }
1609
- return { message: n };
1610
- };
1611
- const ae = Ie(), rt = De({
1612
- locale: ae,
1613
- messages: Re
1614
- });
1615
- console.info("Current locale:", ae);
1616
- b.init({
1617
- lng: ae,
1618
- resources: Re
1619
- });
1620
- Fe.setErrorMap(it({ ns: ["connectZod", "connectZodCustom"] }));
1621
- const ne = rt;
1622
- function $(a) {
1623
- return B(
1624
- "div",
1625
- {
1626
- class: `${a.chipClass} gap-4 h-[22px] inline-flex items-center justify-center min-w-min px-8 rounded-md`
1627
- },
1628
- [
1629
- B(ie.FmIcon, { size: "sm", name: a.icon, outline: !0 }),
1630
- B("span", { class: "fm-typo-en-body-md-600" }, a.name)
1631
- ]
1632
- );
1633
- }
1634
- const bt = {
1635
- [R.enum.CREDIT]: {
1636
- chipClass: "!text-fm-color-secondary-plum !bg-[#f2ebfe]",
1637
- icon: "local_activity",
1638
- name: "Credit",
1639
- chip() {
1640
- return $(this);
1641
- }
1642
- },
1643
- [R.enum.PROMOTION]: {
1644
- chipClass: "!text-fm-color-secondary-citrus !bg-fm-color-system-warning-100",
1645
- icon: "loyalty",
1646
- name: "Promotion",
1647
- chip() {
1648
- return $(this);
1649
- }
1650
- },
1651
- [R.enum.VOUCHER]: {
1652
- chipClass: "!text-fm-color-secondary-halite !bg-[#fff0f6]",
1653
- icon: "sell",
1654
- name: ne.global.t("connect.campaign.voucher.title"),
1655
- chip() {
1656
- return $(this);
1657
- }
1658
- },
1659
- [R.enum.POINT]: {
1660
- chipClass: "!text-fm-color-secondary-cocoa !bg-[#fff9e6]",
1661
- icon: "award_star",
1662
- name: "Experience",
1663
- chip() {
1664
- return $(this);
1665
- }
1666
- },
1667
- [R.enum.BROADCAST]: {
1668
- chipClass: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
1669
- icon: "campaign",
1670
- name: "Broadcast",
1671
- chip() {
1672
- return $(this);
1673
- }
1674
- },
1675
- [R.enum.GAME]: {
1676
- chipClass: "!text-fm-color-secondary-mint !bg-fm-color-system-success-100",
1677
- icon: "database",
1678
- name: "Token",
1679
- chip() {
1680
- return $(this);
1681
- }
1682
- },
1683
- [R.enum.REWARD_POOL]: {
1684
- chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
1685
- icon: "editor_choice",
1686
- name: "Reward Pool",
1687
- chip() {
1688
- return $(this);
1689
- }
1690
- },
1691
- [R.enum.COIN]: {
1692
- chipClass: "!text-fm-color-system-success-400 !bg-fm-color-system-success-100",
1693
- icon: "monetization_on",
1694
- name: "Point",
1695
- chip() {
1696
- return $(this);
1697
- }
1698
- },
1699
- [R.enum.MEMBERSHIP]: {
1700
- chipClass: "",
1701
- icon: "",
1702
- name: "Membership",
1703
- chip() {
1704
- return $(this);
1705
- }
1706
- },
1707
- // TODO: confirm color
1708
- [R.enum.MISSION]: {
1709
- chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
1710
- icon: "editor_choice",
1711
- name: "Mission",
1712
- chip() {
1713
- return $(this);
1714
- }
1715
- }
1716
- };
1717
- function St(a) {
1718
- const e = nt(a), t = {
1719
- active: "text-fm-color-typo-success bg-fm-color-system-success-100",
1720
- upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
1721
- expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
1722
- };
1723
- return a.type == "VOUCHER" ? B(ie.FmChip, {
1724
- class: t[e],
1725
- label: ce.title(ne.global.t(`connect.campaign.common.status.${e}`)),
1726
- compact: !0
1727
- }) : B(ie.FmChip, {
1728
- class: t[e],
1729
- label: ce.title(ne.global.t(`connect.campaign.common.status.${e}`)),
1730
- compact: !0
1731
- });
1732
- }
1733
- function Ot(a) {
1734
- const { campaign: e } = a;
1735
- function t(s) {
1736
- if (!s || !s.start && !s.end)
1737
- return "connect.campaign.common.always";
1738
- const i = s.start ? F(s.start).format("DD MMM YYYY") : "From campaign creation", r = s.end ? F(s.end).format("DD MMM YYYY") : "Never ends";
1739
- return `${i} - ${r}`;
1740
- }
1741
- return {
1742
- "connect.campaign.common.campaign_name": e.name,
1743
- "connect.campaign.common.campaign_period": t(e.timeframeOptions),
1744
- get "connect.campaign.common.next_schedule_at"() {
1745
- if (e.event.type != "SCHEDULE" || !e.event.rule || !Ne(e.event.rule))
1746
- return;
1747
- const s = Ee(
1748
- e.event.rule.rules.g_schedule
1749
- );
1750
- return s ? F(s).format("ddd, DD MMM YYYY, hh:mmA") : void 0;
1751
- },
1752
- get "connect.campaign.common.discount_type"() {
1753
- if (e.type == "PROMOTION") return G(e.effect);
1754
- if ("configs" in a && a.configs.type == "VOUCHER")
1755
- return G(a.configs.extras.effect);
1756
- },
1757
- get "connect.campaign.common.available_at"() {
1758
- return e.targetLocation ? e.targetLocation.length > 0 ? e.targetLocation.map(
1759
- (s) => Ve().locationItems.find((i) => i.value == s).label
1760
- ).join(",") : "connect.campaign.common.no_location" : "connect.campaign.common.all_locations";
1761
- }
1762
- };
1763
- }
1764
- function nt(a) {
1765
- return a.timeframeOptions && a.timeframeOptions.type == "timeframe" ? F().isBetween(
1766
- a.timeframeOptions.start ?? F().subtract(1, "d"),
1767
- a.timeframeOptions.end ?? F().add(1, "d")
1768
- ) ? "active" : F().isAfter(a.timeframeOptions.end) ? "expired" : "upcoming" : "active";
1769
- }
1770
- function Lt(a) {
1771
- var e, t;
1772
- switch (a.event.type) {
1773
- case "BILL_COMPLETED":
1774
- const s = `Spend to get ${j.formattedType(a.type)}`;
1775
- switch (a.type) {
1776
- case "POINT":
1777
- case "CREDIT":
1778
- case "COIN":
1779
- return a.earningOption.type == "FIXED" ? `Spend to get ${a.earningOption.amount} ${j.formattedType(a.type)}` : `Every ${a.earningOption.every} amount spent get ${a.earningOption.amount} ${j.formattedType(a.type)}`;
1780
- case "VOUCHER":
1781
- const i = (t = (e = a == null ? void 0 : a.pf_collectible) == null ? void 0 : e.extras) == null ? void 0 : t.effect;
1782
- return i ? `${s} - ${G(i)}` : s;
1783
- default:
1784
- return s;
1785
- }
1786
- case "FEEDBACK":
1787
- return `Give feedback to receive ${j.formattedType(a.type)}`;
1788
- case "SCHEDULE":
1789
- return `Receive ${j.formattedType(a.type)} on scheduled time`;
1790
- case "SIMPLE_CLAIM":
1791
- return "Simple claim voucher";
1792
- case "TIER_UPGRADED":
1793
- return `Receive ${j.formattedType(a.type)} when member tier upgraded`;
1794
- case "MEMBERSHIP_JOINED":
1795
- return `Receive ${j.formattedType(a.type)} when member joined`;
1796
- case "MAKING_ORDER":
1797
- return a.type !== "PROMOTION" ? void 0 : G(a.effect);
1798
- default:
1799
- throw new Error(
1800
- `Not implemented ${JSON.stringify({ cause: a.event.type })}`
1801
- );
1802
- }
1803
- }
1804
- export {
1805
- bt as C,
1806
- St as a,
1807
- Lt as b,
1808
- Ot as c,
1809
- nt as g
1810
- };