@nemme/js-sdk 0.2.3 → 0.3.0
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/assets/js-sdk.css +1 -1
- package/dist/forms/form-manager.d.ts +1 -0
- package/dist/forms/question-choice/question-choice.d.ts +2 -0
- package/dist/forms/question-text/question-text.d.ts +2 -0
- package/dist/forms/question-wrapper.d.ts +2 -0
- package/dist/forms/transition-end/transition-end.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1190 -1192
- package/dist/index.esm.js.map +1 -1
- package/dist/nemme-sdk.umd.js +5 -5
- package/dist/nemme-sdk.umd.js.map +1 -1
- package/dist/translations/en.json.d.ts +2 -0
- package/package.json +13 -12
package/dist/index.esm.js
CHANGED
|
@@ -1,46 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { createRoot as At } from "react-dom/client";
|
|
7
|
-
const Vt = (i, e, t, n) => {
|
|
8
|
-
var s, a, o, c;
|
|
9
|
-
const r = [t, {
|
|
1
|
+
import * as g from "react";
|
|
2
|
+
import rt, { createContext as Se, useContext as st, useCallback as K, useState as X, useRef as at, useEffect as oe, useMemo as $t, createElement as pe } from "react";
|
|
3
|
+
import { createRoot as Rt } from "react-dom/client";
|
|
4
|
+
const Ft = (r, e, t, n) => {
|
|
5
|
+
const i = [t, {
|
|
10
6
|
code: e,
|
|
11
7
|
...n || {}
|
|
12
8
|
}];
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
if (
|
|
9
|
+
if (r?.services?.logger?.forward)
|
|
10
|
+
return r.services.logger.forward(i, "warn", "react-i18next::", !0);
|
|
11
|
+
B(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), r?.services?.logger?.warn ? r.services.logger.warn(...i) : console?.warn && console.warn(...i);
|
|
12
|
+
}, je = {}, me = (r, e, t, n) => {
|
|
13
|
+
B(t) && je[t] || (B(t) && (je[t] = /* @__PURE__ */ new Date()), Ft(r, e, t, n));
|
|
14
|
+
}, ot = (r, e) => () => {
|
|
15
|
+
if (r.isInitialized)
|
|
20
16
|
e();
|
|
21
17
|
else {
|
|
22
18
|
const t = () => {
|
|
23
19
|
setTimeout(() => {
|
|
24
|
-
|
|
20
|
+
r.off("initialized", t);
|
|
25
21
|
}, 0), e();
|
|
26
22
|
};
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
if (
|
|
33
|
-
t.forEach((
|
|
34
|
-
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
23
|
+
r.on("initialized", t);
|
|
24
|
+
}
|
|
25
|
+
}, ye = (r, e, t) => {
|
|
26
|
+
r.loadNamespaces(e, ot(r, t));
|
|
27
|
+
}, Te = (r, e, t, n) => {
|
|
28
|
+
if (B(t) && (t = [t]), r.options.preload && r.options.preload.indexOf(e) > -1) return ye(r, t, n);
|
|
29
|
+
t.forEach((i) => {
|
|
30
|
+
r.options.ns.indexOf(i) < 0 && r.options.ns.push(i);
|
|
31
|
+
}), r.loadLanguages(e, ot(r, n));
|
|
32
|
+
}, Mt = (r, e, t = {}) => !e.languages || !e.languages.length ? (me(e, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
37
33
|
languages: e.languages
|
|
38
|
-
}), !0) : e.hasLoadedNamespace(
|
|
34
|
+
}), !0) : e.hasLoadedNamespace(r, {
|
|
39
35
|
lng: t.lng,
|
|
40
|
-
precheck: (n,
|
|
41
|
-
if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && n.services.backendConnector.backend && n.isLanguageChangingTo && !
|
|
36
|
+
precheck: (n, i) => {
|
|
37
|
+
if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && n.services.backendConnector.backend && n.isLanguageChangingTo && !i(n.isLanguageChangingTo, r)) return !1;
|
|
42
38
|
}
|
|
43
|
-
}),
|
|
39
|
+
}), B = (r) => typeof r == "string", Dt = (r) => typeof r == "object" && r !== null, At = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, It = {
|
|
44
40
|
"&": "&",
|
|
45
41
|
"&": "&",
|
|
46
42
|
"<": "<",
|
|
@@ -61,8 +57,8 @@ const Vt = (i, e, t, n) => {
|
|
|
61
57
|
"…": "…",
|
|
62
58
|
"/": "/",
|
|
63
59
|
"/": "/"
|
|
64
|
-
},
|
|
65
|
-
let
|
|
60
|
+
}, Vt = (r) => It[r], Ht = (r) => r.replace(At, Vt);
|
|
61
|
+
let xe = {
|
|
66
62
|
bindI18n: "languageChanged",
|
|
67
63
|
bindI18nStore: "",
|
|
68
64
|
transEmptyNodeValue: "",
|
|
@@ -70,24 +66,24 @@ let ve = {
|
|
|
70
66
|
transWrapTextNodes: "",
|
|
71
67
|
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
72
68
|
useSuspense: !0,
|
|
73
|
-
unescape:
|
|
69
|
+
unescape: Ht
|
|
74
70
|
};
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
...
|
|
71
|
+
const Kt = (r = {}) => {
|
|
72
|
+
xe = {
|
|
73
|
+
...xe,
|
|
74
|
+
...r
|
|
79
75
|
};
|
|
80
|
-
},
|
|
81
|
-
let
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
},
|
|
76
|
+
}, Bt = () => xe;
|
|
77
|
+
let lt;
|
|
78
|
+
const zt = (r) => {
|
|
79
|
+
lt = r;
|
|
80
|
+
}, qt = () => lt, Ut = {
|
|
85
81
|
type: "3rdParty",
|
|
86
|
-
init(
|
|
87
|
-
|
|
82
|
+
init(r) {
|
|
83
|
+
Kt(r.options.react), zt(r);
|
|
88
84
|
}
|
|
89
|
-
},
|
|
90
|
-
class
|
|
85
|
+
}, ct = Se();
|
|
86
|
+
class _t {
|
|
91
87
|
constructor() {
|
|
92
88
|
this.usedNamespaces = {};
|
|
93
89
|
}
|
|
@@ -100,78 +96,77 @@ class Gt {
|
|
|
100
96
|
return Object.keys(this.usedNamespaces);
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
|
-
const
|
|
104
|
-
const t =
|
|
105
|
-
return
|
|
106
|
-
t.current =
|
|
107
|
-
}, [
|
|
108
|
-
},
|
|
109
|
-
var P, C, V, j;
|
|
99
|
+
const Wt = (r, e) => {
|
|
100
|
+
const t = at();
|
|
101
|
+
return oe(() => {
|
|
102
|
+
t.current = r;
|
|
103
|
+
}, [r, e]), t.current;
|
|
104
|
+
}, dt = (r, e, t, n) => r.getFixedT(e, t, n), Zt = (r, e, t, n) => K(dt(r, e, t, n), [r, e, t, n]), ke = (r, e = {}) => {
|
|
110
105
|
const {
|
|
111
106
|
i18n: t
|
|
112
107
|
} = e, {
|
|
113
108
|
i18n: n,
|
|
114
|
-
defaultNS:
|
|
115
|
-
} =
|
|
116
|
-
if (s && !s.reportNamespaces && (s.reportNamespaces = new
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
|
|
109
|
+
defaultNS: i
|
|
110
|
+
} = st(ct) || {}, s = t || n || qt();
|
|
111
|
+
if (s && !s.reportNamespaces && (s.reportNamespaces = new _t()), !s) {
|
|
112
|
+
me(s, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
113
|
+
const S = (E, P) => B(P) ? P : Dt(P) && B(P.defaultValue) ? P.defaultValue : Array.isArray(E) ? E[E.length - 1] : E, k = [S, {}, !1];
|
|
114
|
+
return k.t = S, k.i18n = {}, k.ready = !1, k;
|
|
115
|
+
}
|
|
116
|
+
s.options.react?.wait && me(s, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
122
117
|
const a = {
|
|
123
|
-
...
|
|
118
|
+
...Bt(),
|
|
124
119
|
...s.options.react,
|
|
125
120
|
...e
|
|
126
121
|
}, {
|
|
127
122
|
useSuspense: o,
|
|
128
123
|
keyPrefix: c
|
|
129
124
|
} = a;
|
|
130
|
-
let l =
|
|
131
|
-
l =
|
|
132
|
-
const d = (s.isInitialized || s.initializedStoreOnce) && l.every((
|
|
125
|
+
let l = i || s.options?.defaultNS;
|
|
126
|
+
l = B(l) ? [l] : l || ["translation"], s.reportNamespaces.addUsedNamespaces?.(l);
|
|
127
|
+
const d = (s.isInitialized || s.initializedStoreOnce) && l.every((S) => Mt(S, s, a)), u = Zt(s, e.lng || null, a.nsMode === "fallback" ? l : l[0], c), h = () => u, f = () => dt(s, e.lng || null, a.nsMode === "fallback" ? l : l[0], c), [p, y] = X(h);
|
|
133
128
|
let b = l.join();
|
|
134
129
|
e.lng && (b = `${e.lng}${b}`);
|
|
135
|
-
const v =
|
|
136
|
-
|
|
130
|
+
const v = Wt(b), w = at(!0);
|
|
131
|
+
oe(() => {
|
|
137
132
|
const {
|
|
138
|
-
bindI18n:
|
|
139
|
-
bindI18nStore:
|
|
133
|
+
bindI18n: S,
|
|
134
|
+
bindI18nStore: k
|
|
140
135
|
} = a;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}) :
|
|
144
|
-
|
|
145
|
-
})), d && v && v !== b &&
|
|
146
|
-
const
|
|
147
|
-
|
|
136
|
+
w.current = !0, !d && !o && (e.lng ? Te(s, e.lng, l, () => {
|
|
137
|
+
w.current && y(f);
|
|
138
|
+
}) : ye(s, l, () => {
|
|
139
|
+
w.current && y(f);
|
|
140
|
+
})), d && v && v !== b && w.current && y(f);
|
|
141
|
+
const E = () => {
|
|
142
|
+
w.current && y(f);
|
|
148
143
|
};
|
|
149
|
-
return
|
|
150
|
-
|
|
144
|
+
return S && s?.on(S, E), k && s?.store.on(k, E), () => {
|
|
145
|
+
w.current = !1, s && S && S?.split(" ").forEach((P) => s.off(P, E)), k && s && k.split(" ").forEach((P) => s.store.off(P, E));
|
|
151
146
|
};
|
|
152
|
-
}, [s, b]),
|
|
153
|
-
|
|
147
|
+
}, [s, b]), oe(() => {
|
|
148
|
+
w.current && d && y(h);
|
|
154
149
|
}, [s, c, d]);
|
|
155
|
-
const L = [
|
|
156
|
-
if (L.t =
|
|
157
|
-
throw new Promise((
|
|
158
|
-
e.lng ?
|
|
150
|
+
const L = [p, s, d];
|
|
151
|
+
if (L.t = p, L.i18n = s, L.ready = d, d || !d && !o) return L;
|
|
152
|
+
throw new Promise((S) => {
|
|
153
|
+
e.lng ? Te(s, e.lng, l, () => S()) : ye(s, l, () => S());
|
|
159
154
|
});
|
|
160
155
|
};
|
|
161
|
-
function
|
|
162
|
-
i18n:
|
|
156
|
+
function Jt({
|
|
157
|
+
i18n: r,
|
|
163
158
|
defaultNS: e,
|
|
164
159
|
children: t
|
|
165
160
|
}) {
|
|
166
|
-
const n =
|
|
167
|
-
i18n:
|
|
161
|
+
const n = $t(() => ({
|
|
162
|
+
i18n: r,
|
|
168
163
|
defaultNS: e
|
|
169
|
-
}), [
|
|
170
|
-
return
|
|
164
|
+
}), [r, e]);
|
|
165
|
+
return pe(ct.Provider, {
|
|
171
166
|
value: n
|
|
172
167
|
}, t);
|
|
173
168
|
}
|
|
174
|
-
var
|
|
169
|
+
var he = { exports: {} }, Z = {};
|
|
175
170
|
/**
|
|
176
171
|
* @license React
|
|
177
172
|
* react-jsx-runtime.production.min.js
|
|
@@ -181,49 +176,69 @@ var pe = { exports: {} }, Y = {};
|
|
|
181
176
|
* This source code is licensed under the MIT license found in the
|
|
182
177
|
* LICENSE file in the root directory of this source tree.
|
|
183
178
|
*/
|
|
184
|
-
var
|
|
185
|
-
function
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
var
|
|
179
|
+
var $e;
|
|
180
|
+
function Qt() {
|
|
181
|
+
if ($e) return Z;
|
|
182
|
+
$e = 1;
|
|
183
|
+
var r = rt, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
189
184
|
function a(o, c, l) {
|
|
190
185
|
var d, u = {}, h = null, f = null;
|
|
191
186
|
l !== void 0 && (h = "" + l), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (f = c.ref);
|
|
192
187
|
for (d in c) n.call(c, d) && !s.hasOwnProperty(d) && (u[d] = c[d]);
|
|
193
188
|
if (o && o.defaultProps) for (d in c = o.defaultProps, c) u[d] === void 0 && (u[d] = c[d]);
|
|
194
|
-
return { $$typeof: e, type: o, key: h, ref: f, props: u, _owner:
|
|
189
|
+
return { $$typeof: e, type: o, key: h, ref: f, props: u, _owner: i.current };
|
|
195
190
|
}
|
|
196
|
-
return
|
|
191
|
+
return Z.Fragment = t, Z.jsx = a, Z.jsxs = a, Z;
|
|
197
192
|
}
|
|
198
|
-
var
|
|
199
|
-
function
|
|
200
|
-
return
|
|
193
|
+
var Re;
|
|
194
|
+
function Gt() {
|
|
195
|
+
return Re || (Re = 1, he.exports = Qt()), he.exports;
|
|
201
196
|
}
|
|
202
|
-
var m =
|
|
203
|
-
const
|
|
204
|
-
const { t: o } =
|
|
197
|
+
var m = Gt();
|
|
198
|
+
const Yt = ({ step: r, form: e, formState: t, onDismiss: n, onNextStep: i, onPreviousStep: s, onUpdateResponse: a }) => {
|
|
199
|
+
const { t: o } = ke(), l = ((d) => {
|
|
205
200
|
let u = 0;
|
|
206
201
|
if (e.startTransition) {
|
|
207
202
|
if (d === u)
|
|
208
|
-
return {
|
|
203
|
+
return {
|
|
204
|
+
type: "start",
|
|
205
|
+
transition: e.startTransition,
|
|
206
|
+
hasPreviousStep: !1,
|
|
207
|
+
hasNextStep: e.questions.length > 0 || !!e.endTransition
|
|
208
|
+
};
|
|
209
209
|
u++;
|
|
210
210
|
}
|
|
211
211
|
const h = d - u;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
if (h >= 0 && h < e.questions.length)
|
|
213
|
+
return {
|
|
214
|
+
type: "question",
|
|
215
|
+
questionIndex: h,
|
|
216
|
+
question: e.questions[h],
|
|
217
|
+
hasPreviousStep: d > 0,
|
|
218
|
+
hasNextStep: d < e.questions.length - 1 || !!e.endTransition
|
|
219
|
+
};
|
|
220
|
+
if (u += e.questions.length, e.endTransition && d === u)
|
|
221
|
+
return {
|
|
222
|
+
type: "end",
|
|
223
|
+
transition: e.endTransition,
|
|
224
|
+
hasPreviousStep: d > 0,
|
|
225
|
+
hasNextStep: !1
|
|
226
|
+
};
|
|
227
|
+
throw new Error("Invalid step order");
|
|
228
|
+
})(r);
|
|
229
|
+
if (l.type === "start") {
|
|
215
230
|
const {
|
|
216
231
|
title: d,
|
|
217
232
|
description: u,
|
|
218
233
|
image: h,
|
|
219
234
|
includeOptOut: f,
|
|
220
|
-
customStartButton:
|
|
235
|
+
customStartButton: p,
|
|
221
236
|
startButtonText: y,
|
|
222
237
|
customOptOutButton: b,
|
|
223
238
|
optOutButtonText: v
|
|
224
239
|
} = l.transition;
|
|
225
240
|
return /* @__PURE__ */ m.jsx(
|
|
226
|
-
|
|
241
|
+
yn,
|
|
227
242
|
{
|
|
228
243
|
title: d,
|
|
229
244
|
description: u,
|
|
@@ -231,96 +246,101 @@ const nn = ({ step: i, form: e, formState: t, onDismiss: n, onNextStep: r, onPre
|
|
|
231
246
|
image: h,
|
|
232
247
|
quitText: f ? b ? v : o("Quit") : void 0,
|
|
233
248
|
onQuit: f ? () => n(t) : void 0,
|
|
234
|
-
startText:
|
|
235
|
-
onStart:
|
|
249
|
+
startText: p ? y : o("Start"),
|
|
250
|
+
onStart: i
|
|
236
251
|
}
|
|
237
252
|
);
|
|
238
253
|
}
|
|
239
|
-
if (
|
|
240
|
-
const { title: d, description: u, image: h, customEndButton: f, endButtonText:
|
|
254
|
+
if (l.type === "end") {
|
|
255
|
+
const { title: d, description: u, image: h, customEndButton: f, endButtonText: p, customEndButtonLink: y, endButtonLink: b } = l.transition;
|
|
241
256
|
return /* @__PURE__ */ m.jsx(
|
|
242
|
-
|
|
257
|
+
mn,
|
|
243
258
|
{
|
|
244
259
|
title: d,
|
|
245
260
|
description: u,
|
|
246
261
|
icon: e.icon,
|
|
247
262
|
image: h,
|
|
248
|
-
quitText: f ?
|
|
249
|
-
onQuit:
|
|
263
|
+
quitText: f ? p : o("Done"),
|
|
264
|
+
onQuit: i,
|
|
250
265
|
externalLink: y ? b : void 0
|
|
251
266
|
}
|
|
252
267
|
);
|
|
253
268
|
}
|
|
254
|
-
if (
|
|
269
|
+
if (l.type === "question") {
|
|
255
270
|
const { question: d } = l;
|
|
271
|
+
if (!d) throw new Error("No question found");
|
|
256
272
|
if (d.questionType === "choice") {
|
|
257
|
-
const { title: u, description: h, image: f, alternatives:
|
|
273
|
+
const { title: u, description: h, image: f, alternatives: p, maxSelections: y, required: b } = d, v = t.responses[d.id] || [], w = (y ? v.length <= y || y === 4 : !0) && (b ? v.length > 0 : !0);
|
|
258
274
|
return /* @__PURE__ */ m.jsx(
|
|
259
|
-
|
|
275
|
+
fn,
|
|
260
276
|
{
|
|
261
277
|
title: u,
|
|
262
278
|
description: h,
|
|
263
279
|
image: f,
|
|
264
|
-
alternatives:
|
|
280
|
+
alternatives: p,
|
|
265
281
|
onPrevious: s,
|
|
266
|
-
onNext:
|
|
282
|
+
onNext: i,
|
|
267
283
|
icon: e.icon,
|
|
268
284
|
maxAlternatives: y,
|
|
269
285
|
onQuit: () => n(t),
|
|
270
286
|
selectedAlternatives: v,
|
|
271
287
|
onAlternativeSelect: (L) => {
|
|
272
288
|
if (y > 1) {
|
|
273
|
-
const
|
|
274
|
-
a(d.id,
|
|
289
|
+
const k = v, E = k.includes(L) ? k.filter((P) => P !== L) : y && k.length >= y && y != 4 ? k : [...k, L];
|
|
290
|
+
a(d.id, E);
|
|
275
291
|
} else
|
|
276
292
|
v.includes(L) ? a(d.id, []) : a(d.id, [L]);
|
|
277
293
|
},
|
|
278
|
-
isValid:
|
|
294
|
+
isValid: w,
|
|
295
|
+
hasPreviousStep: l.hasPreviousStep,
|
|
296
|
+
hasNextStep: l.hasNextStep
|
|
279
297
|
}
|
|
280
298
|
);
|
|
281
299
|
}
|
|
282
300
|
if (d.questionType === "text") {
|
|
283
|
-
const { title: u, description: h, image: f, maxChars:
|
|
301
|
+
const { title: u, description: h, image: f, maxChars: p, limited: y, required: b } = d, v = t.responses[d.id] || "", w = (y && p ? v.length <= p : !0) && (b ? v.length > 0 : !0);
|
|
284
302
|
return /* @__PURE__ */ m.jsx(
|
|
285
|
-
|
|
303
|
+
pn,
|
|
286
304
|
{
|
|
287
305
|
title: u,
|
|
288
306
|
icon: e.icon,
|
|
289
307
|
description: h,
|
|
290
|
-
onNext:
|
|
308
|
+
onNext: i,
|
|
291
309
|
onPrevious: s,
|
|
292
310
|
onQuit: () => n(t),
|
|
293
311
|
image: f,
|
|
294
|
-
maxCharacters: y ?
|
|
312
|
+
maxCharacters: y ? p : void 0,
|
|
295
313
|
inputText: v,
|
|
296
314
|
setInputText: (L) => {
|
|
297
|
-
y &&
|
|
315
|
+
y && p && L.length > p || a(d.id, L);
|
|
298
316
|
},
|
|
299
|
-
isValid:
|
|
317
|
+
isValid: w,
|
|
318
|
+
hasPreviousStep: l.hasPreviousStep,
|
|
319
|
+
hasNextStep: l.hasNextStep
|
|
300
320
|
}
|
|
301
321
|
);
|
|
302
322
|
}
|
|
303
323
|
}
|
|
304
324
|
return null;
|
|
305
|
-
},
|
|
306
|
-
const s = (
|
|
325
|
+
}, Xt = ({ form: r, onDismiss: e, onComplete: t, zIndex: n = 100 }) => {
|
|
326
|
+
const s = (r.startTransition ? 1 : 0) + r.questions.length + (r.endTransition ? 1 : 0) - 1, [a, o] = X({
|
|
307
327
|
responses: {},
|
|
308
328
|
currentStep: 0,
|
|
309
329
|
startedAt: /* @__PURE__ */ new Date()
|
|
310
|
-
}), c =
|
|
311
|
-
o((
|
|
312
|
-
...
|
|
330
|
+
}), c = K((h, f) => {
|
|
331
|
+
o((p) => ({
|
|
332
|
+
...p,
|
|
313
333
|
responses: {
|
|
314
|
-
...
|
|
334
|
+
...p.responses,
|
|
315
335
|
[h]: f
|
|
316
336
|
}
|
|
317
337
|
}));
|
|
318
|
-
}, []), l =
|
|
338
|
+
}, []), l = K((h) => {
|
|
319
339
|
o((f) => ({
|
|
320
340
|
...f,
|
|
321
341
|
currentStep: h
|
|
322
342
|
}));
|
|
323
|
-
}, []), d =
|
|
343
|
+
}, []), d = K(() => {
|
|
324
344
|
if (a.currentStep < s)
|
|
325
345
|
l(a.currentStep + 1);
|
|
326
346
|
else {
|
|
@@ -330,7 +350,7 @@ const nn = ({ step: i, form: e, formState: t, onDismiss: n, onNextStep: r, onPre
|
|
|
330
350
|
};
|
|
331
351
|
t(h);
|
|
332
352
|
}
|
|
333
|
-
}, [a, s, l, t]), u =
|
|
353
|
+
}, [a, s, l, t]), u = K(() => {
|
|
334
354
|
a.currentStep > 0 && l(a.currentStep - 1);
|
|
335
355
|
}, [a.currentStep, l]);
|
|
336
356
|
return /* @__PURE__ */ m.jsx(
|
|
@@ -339,10 +359,10 @@ const nn = ({ step: i, form: e, formState: t, onDismiss: n, onNextStep: r, onPre
|
|
|
339
359
|
className: "flex flex-col justify-center items-center absolute inset-0 bg-overlay-background-default-light dark:bg-overlay-background-default-dark",
|
|
340
360
|
style: { zIndex: n },
|
|
341
361
|
children: /* @__PURE__ */ m.jsx(
|
|
342
|
-
|
|
362
|
+
Yt,
|
|
343
363
|
{
|
|
344
364
|
step: a.currentStep,
|
|
345
|
-
form:
|
|
365
|
+
form: r,
|
|
346
366
|
formState: a,
|
|
347
367
|
onDismiss: e,
|
|
348
368
|
onNextStep: d,
|
|
@@ -352,170 +372,170 @@ const nn = ({ step: i, form: e, formState: t, onDismiss: n, onNextStep: r, onPre
|
|
|
352
372
|
)
|
|
353
373
|
}
|
|
354
374
|
);
|
|
355
|
-
},
|
|
375
|
+
}, en = /* @__PURE__ */ new Map([
|
|
356
376
|
[
|
|
357
377
|
"bold",
|
|
358
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z" }))
|
|
359
379
|
],
|
|
360
380
|
[
|
|
361
381
|
"duotone",
|
|
362
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement(
|
|
363
383
|
"path",
|
|
364
384
|
{
|
|
365
385
|
d: "M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",
|
|
366
386
|
opacity: "0.2"
|
|
367
387
|
}
|
|
368
|
-
), /* @__PURE__ */
|
|
388
|
+
), /* @__PURE__ */ g.createElement("path", { d: "M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z" }))
|
|
369
389
|
],
|
|
370
390
|
[
|
|
371
391
|
"fill",
|
|
372
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z" }))
|
|
373
393
|
],
|
|
374
394
|
[
|
|
375
395
|
"light",
|
|
376
|
-
/* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z" }))
|
|
377
397
|
],
|
|
378
398
|
[
|
|
379
399
|
"regular",
|
|
380
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z" }))
|
|
381
401
|
],
|
|
382
402
|
[
|
|
383
403
|
"thin",
|
|
384
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z" }))
|
|
385
405
|
]
|
|
386
|
-
]),
|
|
406
|
+
]), tn = /* @__PURE__ */ new Map([
|
|
387
407
|
[
|
|
388
408
|
"bold",
|
|
389
|
-
/* @__PURE__ */
|
|
409
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z" }))
|
|
390
410
|
],
|
|
391
411
|
[
|
|
392
412
|
"duotone",
|
|
393
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M160,48V208L80,128Z", opacity: "0.2" }), /* @__PURE__ */ g.createElement("path", { d: "M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z" }))
|
|
394
414
|
],
|
|
395
415
|
[
|
|
396
416
|
"fill",
|
|
397
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z" }))
|
|
398
418
|
],
|
|
399
419
|
[
|
|
400
420
|
"light",
|
|
401
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z" }))
|
|
402
422
|
],
|
|
403
423
|
[
|
|
404
424
|
"regular",
|
|
405
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z" }))
|
|
406
426
|
],
|
|
407
427
|
[
|
|
408
428
|
"thin",
|
|
409
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z" }))
|
|
410
430
|
]
|
|
411
|
-
]),
|
|
431
|
+
]), nn = /* @__PURE__ */ new Map([
|
|
412
432
|
[
|
|
413
433
|
"bold",
|
|
414
|
-
/* @__PURE__ */
|
|
434
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z" }))
|
|
415
435
|
],
|
|
416
436
|
[
|
|
417
437
|
"duotone",
|
|
418
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M176,128,96,208V48Z", opacity: "0.2" }), /* @__PURE__ */ g.createElement("path", { d: "M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z" }))
|
|
419
439
|
],
|
|
420
440
|
[
|
|
421
441
|
"fill",
|
|
422
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z" }))
|
|
423
443
|
],
|
|
424
444
|
[
|
|
425
445
|
"light",
|
|
426
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z" }))
|
|
427
447
|
],
|
|
428
448
|
[
|
|
429
449
|
"regular",
|
|
430
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z" }))
|
|
431
451
|
],
|
|
432
452
|
[
|
|
433
453
|
"thin",
|
|
434
|
-
/* @__PURE__ */
|
|
454
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z" }))
|
|
435
455
|
]
|
|
436
|
-
]),
|
|
456
|
+
]), rn = /* @__PURE__ */ new Map([
|
|
437
457
|
[
|
|
438
458
|
"bold",
|
|
439
|
-
/* @__PURE__ */
|
|
459
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z" }))
|
|
440
460
|
],
|
|
441
461
|
[
|
|
442
462
|
"duotone",
|
|
443
|
-
/* @__PURE__ */
|
|
463
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement(
|
|
444
464
|
"path",
|
|
445
465
|
{
|
|
446
466
|
d: "M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",
|
|
447
467
|
opacity: "0.2"
|
|
448
468
|
}
|
|
449
|
-
), /* @__PURE__ */
|
|
469
|
+
), /* @__PURE__ */ g.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
450
470
|
],
|
|
451
471
|
[
|
|
452
472
|
"fill",
|
|
453
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
454
474
|
],
|
|
455
475
|
[
|
|
456
476
|
"light",
|
|
457
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z" }))
|
|
458
478
|
],
|
|
459
479
|
[
|
|
460
480
|
"regular",
|
|
461
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
462
482
|
],
|
|
463
483
|
[
|
|
464
484
|
"thin",
|
|
465
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("path", { d: "M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z" }))
|
|
466
486
|
]
|
|
467
|
-
]),
|
|
487
|
+
]), ut = Se({
|
|
468
488
|
color: "currentColor",
|
|
469
489
|
size: "1em",
|
|
470
490
|
weight: "regular",
|
|
471
491
|
mirrored: !1
|
|
472
|
-
}),
|
|
473
|
-
(
|
|
492
|
+
}), ie = g.forwardRef(
|
|
493
|
+
(r, e) => {
|
|
474
494
|
const {
|
|
475
495
|
alt: t,
|
|
476
496
|
color: n,
|
|
477
|
-
size:
|
|
497
|
+
size: i,
|
|
478
498
|
weight: s,
|
|
479
499
|
mirrored: a,
|
|
480
500
|
children: o,
|
|
481
501
|
weights: c,
|
|
482
502
|
...l
|
|
483
|
-
} =
|
|
503
|
+
} = r, {
|
|
484
504
|
color: d = "currentColor",
|
|
485
505
|
size: u,
|
|
486
506
|
weight: h = "regular",
|
|
487
507
|
mirrored: f = !1,
|
|
488
|
-
...
|
|
489
|
-
} =
|
|
490
|
-
return /* @__PURE__ */
|
|
508
|
+
...p
|
|
509
|
+
} = g.useContext(ut);
|
|
510
|
+
return /* @__PURE__ */ g.createElement(
|
|
491
511
|
"svg",
|
|
492
512
|
{
|
|
493
513
|
ref: e,
|
|
494
514
|
xmlns: "http://www.w3.org/2000/svg",
|
|
495
|
-
width:
|
|
496
|
-
height:
|
|
515
|
+
width: i ?? u,
|
|
516
|
+
height: i ?? u,
|
|
497
517
|
fill: n ?? d,
|
|
498
518
|
viewBox: "0 0 256 256",
|
|
499
519
|
transform: a || f ? "scale(-1, 1)" : void 0,
|
|
500
|
-
...
|
|
520
|
+
...p,
|
|
501
521
|
...l
|
|
502
522
|
},
|
|
503
|
-
!!t && /* @__PURE__ */
|
|
523
|
+
!!t && /* @__PURE__ */ g.createElement("title", null, t),
|
|
504
524
|
o,
|
|
505
525
|
c.get(s ?? h)
|
|
506
526
|
);
|
|
507
527
|
}
|
|
508
528
|
);
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
var
|
|
529
|
+
ie.displayName = "IconBase";
|
|
530
|
+
const ht = g.forwardRef((r, e) => /* @__PURE__ */ g.createElement(ie, { ref: e, ...r, weights: en }));
|
|
531
|
+
ht.displayName = "ArrowSquareOutIcon";
|
|
532
|
+
const ft = g.forwardRef((r, e) => /* @__PURE__ */ g.createElement(ie, { ref: e, ...r, weights: tn }));
|
|
533
|
+
ft.displayName = "CaretLeftIcon";
|
|
534
|
+
const gt = g.forwardRef((r, e) => /* @__PURE__ */ g.createElement(ie, { ref: e, ...r, weights: nn }));
|
|
535
|
+
gt.displayName = "CaretRightIcon";
|
|
536
|
+
const de = g.forwardRef((r, e) => /* @__PURE__ */ g.createElement(ie, { ref: e, ...r, weights: rn }));
|
|
537
|
+
de.displayName = "XIcon";
|
|
538
|
+
var Fe = { exports: {} }, J = {};
|
|
519
539
|
/**
|
|
520
540
|
* @license React
|
|
521
541
|
* react-jsx-runtime.production.min.js
|
|
@@ -525,63 +545,63 @@ var Ae = { exports: {} }, X = {};
|
|
|
525
545
|
* This source code is licensed under the MIT license found in the
|
|
526
546
|
* LICENSE file in the root directory of this source tree.
|
|
527
547
|
*/
|
|
528
|
-
var
|
|
529
|
-
function
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
var
|
|
548
|
+
var Me;
|
|
549
|
+
function sn() {
|
|
550
|
+
if (Me) return J;
|
|
551
|
+
Me = 1;
|
|
552
|
+
var r = rt, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
533
553
|
function a(o, c, l) {
|
|
534
554
|
var d, u = {}, h = null, f = null;
|
|
535
555
|
l !== void 0 && (h = "" + l), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (f = c.ref);
|
|
536
556
|
for (d in c) n.call(c, d) && !s.hasOwnProperty(d) && (u[d] = c[d]);
|
|
537
557
|
if (o && o.defaultProps) for (d in c = o.defaultProps, c) u[d] === void 0 && (u[d] = c[d]);
|
|
538
|
-
return { $$typeof: e, type: o, key: h, ref: f, props: u, _owner:
|
|
558
|
+
return { $$typeof: e, type: o, key: h, ref: f, props: u, _owner: i.current };
|
|
539
559
|
}
|
|
540
|
-
return
|
|
560
|
+
return J.Fragment = t, J.jsx = a, J.jsxs = a, J;
|
|
541
561
|
}
|
|
542
|
-
var
|
|
543
|
-
function
|
|
544
|
-
return
|
|
562
|
+
var De;
|
|
563
|
+
function an() {
|
|
564
|
+
return De || (De = 1, Fe.exports = /* @__PURE__ */ sn()), Fe.exports;
|
|
545
565
|
}
|
|
546
|
-
var
|
|
547
|
-
const
|
|
548
|
-
variant:
|
|
566
|
+
var ae = /* @__PURE__ */ an();
|
|
567
|
+
const A = ({
|
|
568
|
+
variant: r = "primary",
|
|
549
569
|
size: e = "medium",
|
|
550
570
|
text: t,
|
|
551
571
|
iconBefore: n,
|
|
552
|
-
iconAfter:
|
|
572
|
+
iconAfter: i,
|
|
553
573
|
className: s,
|
|
554
574
|
disabled: a = !1,
|
|
555
575
|
...o
|
|
556
|
-
}) => /* @__PURE__ */
|
|
576
|
+
}) => /* @__PURE__ */ ae.jsx(
|
|
557
577
|
"button",
|
|
558
578
|
{
|
|
559
|
-
className:
|
|
579
|
+
className: j(
|
|
560
580
|
"flex gap-2 justify-center items-center rounded-lg disabled:pointer-events-none",
|
|
561
|
-
|
|
562
|
-
|
|
581
|
+
on(r),
|
|
582
|
+
ln(e),
|
|
563
583
|
s
|
|
564
584
|
),
|
|
565
585
|
disabled: a,
|
|
566
586
|
...o,
|
|
567
|
-
children: /* @__PURE__ */
|
|
568
|
-
|
|
587
|
+
children: /* @__PURE__ */ ae.jsxs(
|
|
588
|
+
ut.Provider,
|
|
569
589
|
{
|
|
570
590
|
value: {
|
|
571
591
|
size: e === "xsmall" ? 8 : 16,
|
|
572
592
|
weight: "regular",
|
|
573
|
-
className:
|
|
593
|
+
className: j(Ae(r, a))
|
|
574
594
|
},
|
|
575
595
|
children: [
|
|
576
596
|
n && n,
|
|
577
|
-
t && /* @__PURE__ */
|
|
578
|
-
|
|
597
|
+
t && /* @__PURE__ */ ae.jsx("span", { className: j(Ae(r, a), cn(e)), children: t }),
|
|
598
|
+
i && i
|
|
579
599
|
]
|
|
580
600
|
}
|
|
581
601
|
)
|
|
582
602
|
}
|
|
583
|
-
),
|
|
584
|
-
switch (
|
|
603
|
+
), on = (r) => {
|
|
604
|
+
switch (r) {
|
|
585
605
|
case "primary":
|
|
586
606
|
return "border border-grey-0/0 bg-primary-action-button-light dark:bg-primary-action-button-dark hover:bg-primary-action-button-hover-light dark:hover:bg-primary-action-button-hover-dark disabled:bg-primary-action-disabled-light dark:disabled:bg-primary-action-disabled-dark";
|
|
587
607
|
case "secondary":
|
|
@@ -591,9 +611,9 @@ const B = ({
|
|
|
591
611
|
case "subtle":
|
|
592
612
|
return "border border-grey-0/0 hover:bg-background-universal-overlay-light dark:hover:bg-background-universal-overlay-dark";
|
|
593
613
|
}
|
|
594
|
-
},
|
|
614
|
+
}, Ae = (r, e) => {
|
|
595
615
|
if (e) return "text-label-tertiary-light dark:text-label-tertiary-dark";
|
|
596
|
-
switch (
|
|
616
|
+
switch (r) {
|
|
597
617
|
case "primary":
|
|
598
618
|
return "text-nonadaptable-text-light";
|
|
599
619
|
case "secondary":
|
|
@@ -603,8 +623,8 @@ const B = ({
|
|
|
603
623
|
case "subtle":
|
|
604
624
|
return "text-label-primary-light dark:text-label-primary-dark";
|
|
605
625
|
}
|
|
606
|
-
},
|
|
607
|
-
switch (
|
|
626
|
+
}, ln = (r) => {
|
|
627
|
+
switch (r) {
|
|
608
628
|
case "xsmall":
|
|
609
629
|
return "p-1";
|
|
610
630
|
case "small":
|
|
@@ -612,8 +632,8 @@ const B = ({
|
|
|
612
632
|
case "medium":
|
|
613
633
|
return "p-3";
|
|
614
634
|
}
|
|
615
|
-
},
|
|
616
|
-
switch (
|
|
635
|
+
}, cn = (r) => {
|
|
636
|
+
switch (r) {
|
|
617
637
|
case "xsmall":
|
|
618
638
|
return "text-[10px] leading-[14px]";
|
|
619
639
|
case "small":
|
|
@@ -622,23 +642,23 @@ const B = ({
|
|
|
622
642
|
return "text-[15px] leading-[16px] -tracking-0,1";
|
|
623
643
|
}
|
|
624
644
|
};
|
|
625
|
-
function
|
|
645
|
+
function pt(r) {
|
|
626
646
|
var e, t, n = "";
|
|
627
|
-
if (typeof
|
|
628
|
-
else if (typeof
|
|
629
|
-
var
|
|
630
|
-
for (e = 0; e <
|
|
631
|
-
} else for (t in
|
|
647
|
+
if (typeof r == "string" || typeof r == "number") n += r;
|
|
648
|
+
else if (typeof r == "object") if (Array.isArray(r)) {
|
|
649
|
+
var i = r.length;
|
|
650
|
+
for (e = 0; e < i; e++) r[e] && (t = pt(r[e])) && (n && (n += " "), n += t);
|
|
651
|
+
} else for (t in r) r[t] && (n && (n += " "), n += t);
|
|
632
652
|
return n;
|
|
633
653
|
}
|
|
634
|
-
function
|
|
635
|
-
for (var
|
|
654
|
+
function dn() {
|
|
655
|
+
for (var r, e, t = 0, n = "", i = arguments.length; t < i; t++) (r = arguments[t]) && (e = pt(r)) && (n && (n += " "), n += e);
|
|
636
656
|
return n;
|
|
637
657
|
}
|
|
638
|
-
const
|
|
639
|
-
const s =
|
|
640
|
-
return /* @__PURE__ */
|
|
641
|
-
},
|
|
658
|
+
const j = dn, I = ({ children: r, className: e, variant: t = "B1", significance: n = "primary", as: i }) => {
|
|
659
|
+
const s = i ?? un[t], a = mt[t];
|
|
660
|
+
return /* @__PURE__ */ ae.jsx(s, { className: j("font-sans", hn[n], e, a), children: r });
|
|
661
|
+
}, mt = {
|
|
642
662
|
Di1: "text-[72px] font-bold leading-[90px] -tracking-2,5",
|
|
643
663
|
Di2: "text-[60px] font-bold leading-[72px] -tracking-2,0",
|
|
644
664
|
Di3: "text-[48px] font-bold leading-[60px] -tracking-1,5",
|
|
@@ -657,7 +677,7 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
657
677
|
D1B: "text-[12px] font-bold leading-[16px]",
|
|
658
678
|
D1: "text-[12px] leading-[16px]",
|
|
659
679
|
M: "text-[10px] leading-[16px]"
|
|
660
|
-
},
|
|
680
|
+
}, un = {
|
|
661
681
|
Di1: "h1",
|
|
662
682
|
Di2: "h2",
|
|
663
683
|
Di3: "h3",
|
|
@@ -676,7 +696,7 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
676
696
|
D1B: "p",
|
|
677
697
|
D1: "p",
|
|
678
698
|
M: "p"
|
|
679
|
-
},
|
|
699
|
+
}, hn = {
|
|
680
700
|
primary: "text-label-primary-light dark:text-label-primary-dark",
|
|
681
701
|
secondary: "text-label-secondary-light dark:text-label-secondary-dark",
|
|
682
702
|
tertiary: "text-label-tertiary-light dark:text-label-tertiary-dark",
|
|
@@ -684,22 +704,24 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
684
704
|
placeholder: "text-label-placeholder-light dark:text-label-placeholder-dark",
|
|
685
705
|
"nonadaptable-text": "text-nonadaptable-text-light dark:text-nonadaptable-text-dark",
|
|
686
706
|
disabled: "text-primary-action-disabled-light dark:text-primary-action-disabled-dark"
|
|
687
|
-
},
|
|
688
|
-
title:
|
|
707
|
+
}, yt = ({
|
|
708
|
+
title: r,
|
|
689
709
|
icon: e,
|
|
690
710
|
description: t,
|
|
691
711
|
image: n,
|
|
692
|
-
children:
|
|
712
|
+
children: i,
|
|
693
713
|
onPrevious: s,
|
|
694
714
|
onNext: a,
|
|
695
715
|
onQuit: o,
|
|
696
|
-
isValid: c
|
|
716
|
+
isValid: c,
|
|
717
|
+
hasPreviousStep: l,
|
|
718
|
+
hasNextStep: d
|
|
697
719
|
}) => {
|
|
698
|
-
const { t:
|
|
720
|
+
const { t: u } = ke();
|
|
699
721
|
return /* @__PURE__ */ m.jsxs(
|
|
700
722
|
"div",
|
|
701
723
|
{
|
|
702
|
-
className:
|
|
724
|
+
className: j(
|
|
703
725
|
"grid mx-4 my-8 rounded-xl border relative",
|
|
704
726
|
"grid-cols-1 p-4 pt-10",
|
|
705
727
|
"md:p-8 md:gap-16 md:max-w-[960px] md:min-w-[660px]",
|
|
@@ -713,49 +735,49 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
713
735
|
e && /* @__PURE__ */ m.jsx(
|
|
714
736
|
"div",
|
|
715
737
|
{
|
|
716
|
-
className:
|
|
738
|
+
className: j("h-8 w-8 rounded-lg overflow-hidden mb-1 md:mb-2", n ? "hidden md:block" : "block"),
|
|
717
739
|
children: /* @__PURE__ */ m.jsx("img", { className: "w-full h-full object-cover", src: e, alt: "icon" })
|
|
718
740
|
}
|
|
719
741
|
),
|
|
720
|
-
/* @__PURE__ */ m.jsx(
|
|
742
|
+
/* @__PURE__ */ m.jsx(I, { variant: "H2", children: r }),
|
|
721
743
|
t && t.trim().replace(/\n{3,}/g, `
|
|
722
744
|
|
|
723
745
|
`).split(`
|
|
724
746
|
|
|
725
|
-
`).map((
|
|
747
|
+
`).map((h, f) => /* @__PURE__ */ m.jsx(I, { significance: "secondary", children: h.trim() }, f))
|
|
726
748
|
] }),
|
|
727
|
-
|
|
749
|
+
i
|
|
728
750
|
] }),
|
|
729
751
|
/* @__PURE__ */ m.jsxs("div", { className: "flex justify-end pt-4 gap-2", children: [
|
|
730
|
-
/* @__PURE__ */ m.jsx(
|
|
731
|
-
|
|
752
|
+
l && /* @__PURE__ */ m.jsx(
|
|
753
|
+
A,
|
|
732
754
|
{
|
|
733
755
|
variant: "subtle",
|
|
734
756
|
onClick: s,
|
|
735
|
-
iconBefore: /* @__PURE__ */ m.jsx(
|
|
757
|
+
iconBefore: /* @__PURE__ */ m.jsx(ft, {}),
|
|
736
758
|
disabled: !s,
|
|
737
|
-
text:
|
|
759
|
+
text: u("Previous")
|
|
738
760
|
}
|
|
739
761
|
),
|
|
740
762
|
/* @__PURE__ */ m.jsx(
|
|
741
|
-
|
|
763
|
+
A,
|
|
742
764
|
{
|
|
743
765
|
variant: "subtle",
|
|
744
766
|
onClick: a,
|
|
745
|
-
iconAfter: /* @__PURE__ */ m.jsx(
|
|
767
|
+
iconAfter: /* @__PURE__ */ m.jsx(gt, {}),
|
|
746
768
|
disabled: !a || !c,
|
|
747
|
-
text:
|
|
769
|
+
text: u(d ? "Next" : "Submit")
|
|
748
770
|
}
|
|
749
771
|
)
|
|
750
772
|
] }),
|
|
751
773
|
o && /* @__PURE__ */ m.jsx(
|
|
752
|
-
|
|
774
|
+
A,
|
|
753
775
|
{
|
|
754
776
|
className: "absolute top-0 right-1 md:top-1",
|
|
755
777
|
variant: "subtle",
|
|
756
778
|
size: "small",
|
|
757
779
|
onClick: o,
|
|
758
|
-
iconAfter: /* @__PURE__ */ m.jsx(
|
|
780
|
+
iconAfter: /* @__PURE__ */ m.jsx(de, {}),
|
|
759
781
|
"aria-label": "quit"
|
|
760
782
|
}
|
|
761
783
|
)
|
|
@@ -764,69 +786,73 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
764
786
|
]
|
|
765
787
|
}
|
|
766
788
|
);
|
|
767
|
-
},
|
|
768
|
-
title:
|
|
789
|
+
}, fn = ({
|
|
790
|
+
title: r,
|
|
769
791
|
icon: e,
|
|
770
792
|
description: t,
|
|
771
793
|
image: n,
|
|
772
|
-
onPrevious:
|
|
794
|
+
onPrevious: i,
|
|
773
795
|
onNext: s,
|
|
774
796
|
onQuit: a,
|
|
775
797
|
alternatives: o = [],
|
|
776
798
|
onAlternativeSelect: c,
|
|
777
799
|
selectedAlternatives: l,
|
|
778
800
|
maxAlternatives: d,
|
|
779
|
-
isValid: u
|
|
801
|
+
isValid: u,
|
|
802
|
+
hasPreviousStep: h,
|
|
803
|
+
hasNextStep: f
|
|
780
804
|
}) => /* @__PURE__ */ m.jsx(
|
|
781
|
-
|
|
805
|
+
yt,
|
|
782
806
|
{
|
|
783
|
-
title:
|
|
807
|
+
title: r,
|
|
784
808
|
icon: e,
|
|
785
809
|
description: t,
|
|
786
810
|
image: n,
|
|
787
|
-
onPrevious:
|
|
811
|
+
onPrevious: i,
|
|
788
812
|
onNext: s,
|
|
789
813
|
onQuit: a,
|
|
790
814
|
isValid: u,
|
|
791
|
-
|
|
815
|
+
hasPreviousStep: h,
|
|
816
|
+
hasNextStep: f,
|
|
817
|
+
children: /* @__PURE__ */ m.jsx("div", { className: "flex flex-col max-h-[272px] md:max-h-full overflow-y-auto", children: d === 1 ? /* @__PURE__ */ m.jsx("div", { className: "flex flex-col py-3 md:py-4 gap-2 items-end md:items-start", children: o.map((p) => /* @__PURE__ */ m.jsxs(
|
|
792
818
|
"button",
|
|
793
819
|
{
|
|
794
|
-
onClick: () => c(
|
|
820
|
+
onClick: () => c(p.id),
|
|
795
821
|
className: "flex items-center gap-2 p-3 justify-end rounded-lg border text-label-primary-light dark:text-label-primary-dark border-separator-regular-light dark:border-separator-regular-dark",
|
|
796
822
|
children: [
|
|
797
|
-
/* @__PURE__ */ m.jsx(
|
|
798
|
-
/* @__PURE__ */ m.jsx(
|
|
823
|
+
/* @__PURE__ */ m.jsx(I, { variant: "B1Button", children: p.text }),
|
|
824
|
+
/* @__PURE__ */ m.jsx(gn, { size: 20, selected: l.includes(p.id) })
|
|
799
825
|
]
|
|
800
826
|
},
|
|
801
|
-
|
|
802
|
-
)) }) : /* @__PURE__ */ m.jsx("div", { className: "flex py-3 md:py-4 gap-2 justify-end md:justify-start flex-wrap", children: o.map((
|
|
827
|
+
p.id
|
|
828
|
+
)) }) : /* @__PURE__ */ m.jsx("div", { className: "flex py-3 md:py-4 gap-2 justify-end md:justify-start flex-wrap", children: o.map((p) => /* @__PURE__ */ m.jsx(
|
|
803
829
|
"button",
|
|
804
830
|
{
|
|
805
|
-
onClick: () => c(
|
|
806
|
-
className:
|
|
831
|
+
onClick: () => c(p.id),
|
|
832
|
+
className: j(
|
|
807
833
|
"flex items-center gap-2 p-3 justify-end rounded-lg border",
|
|
808
|
-
l.includes(
|
|
834
|
+
l.includes(p.id) ? "text-label-quaternary-light dark:text-label-quaternary-dark border-label-quaternary-light dark:border-label-quaternary-dark bg-secondary-action-base-light dark:bg-secondary-action-base-dark" : "text-label-primary-light dark:text-label-primary-dark border-separator-regular-light dark:border-separator-regular-dark"
|
|
809
835
|
),
|
|
810
836
|
children: /* @__PURE__ */ m.jsx(
|
|
811
|
-
|
|
837
|
+
I,
|
|
812
838
|
{
|
|
813
839
|
variant: "B1Button",
|
|
814
|
-
significance: l.includes(
|
|
815
|
-
children:
|
|
840
|
+
significance: l.includes(p.id) ? "quaternary" : "primary",
|
|
841
|
+
children: p.text
|
|
816
842
|
}
|
|
817
843
|
)
|
|
818
844
|
},
|
|
819
|
-
|
|
845
|
+
p.id
|
|
820
846
|
)) }) })
|
|
821
847
|
}
|
|
822
|
-
),
|
|
823
|
-
const
|
|
848
|
+
), gn = ({ size: r = 16, strokeColor: e = "currentColor", fillColor: t = "none", selected: n = !1 }) => {
|
|
849
|
+
const i = r + 1, s = i / 2, a = (r - 2) / 2;
|
|
824
850
|
return /* @__PURE__ */ m.jsxs(
|
|
825
851
|
"svg",
|
|
826
852
|
{
|
|
827
|
-
width:
|
|
828
|
-
height:
|
|
829
|
-
viewBox: `0 0 ${
|
|
853
|
+
width: r,
|
|
854
|
+
height: r,
|
|
855
|
+
viewBox: `0 0 ${i} ${i}`,
|
|
830
856
|
fill: n ? t : "none",
|
|
831
857
|
xmlns: "http://www.w3.org/2000/svg",
|
|
832
858
|
children: [
|
|
@@ -854,42 +880,46 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
854
880
|
]
|
|
855
881
|
}
|
|
856
882
|
);
|
|
857
|
-
},
|
|
858
|
-
title:
|
|
883
|
+
}, pn = ({
|
|
884
|
+
title: r,
|
|
859
885
|
icon: e,
|
|
860
886
|
description: t,
|
|
861
887
|
image: n,
|
|
862
|
-
onPrevious:
|
|
888
|
+
onPrevious: i,
|
|
863
889
|
onNext: s,
|
|
864
890
|
onQuit: a,
|
|
865
891
|
inputText: o,
|
|
866
892
|
setInputText: c,
|
|
867
893
|
maxCharacters: l,
|
|
868
|
-
isValid: d
|
|
894
|
+
isValid: d,
|
|
895
|
+
hasPreviousStep: u,
|
|
896
|
+
hasNextStep: h
|
|
869
897
|
}) => {
|
|
870
|
-
const { t:
|
|
898
|
+
const { t: f } = ke();
|
|
871
899
|
return /* @__PURE__ */ m.jsx(
|
|
872
|
-
|
|
900
|
+
yt,
|
|
873
901
|
{
|
|
874
|
-
title:
|
|
902
|
+
title: r,
|
|
875
903
|
icon: e,
|
|
876
904
|
description: t,
|
|
877
905
|
image: n,
|
|
878
|
-
onPrevious:
|
|
906
|
+
onPrevious: i,
|
|
879
907
|
onNext: s,
|
|
880
908
|
onQuit: a,
|
|
881
909
|
isValid: d,
|
|
910
|
+
hasPreviousStep: u,
|
|
911
|
+
hasNextStep: h,
|
|
882
912
|
children: /* @__PURE__ */ m.jsxs("div", { className: "flex flex-col py-3 gap-2", children: [
|
|
883
913
|
l && /* @__PURE__ */ m.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
884
|
-
/* @__PURE__ */ m.jsx(
|
|
885
|
-
/* @__PURE__ */ m.jsx(
|
|
914
|
+
/* @__PURE__ */ m.jsx(I, { significance: "secondary", children: f("Max {{maxCharacters}} characters", { maxCharacters: l }) }),
|
|
915
|
+
/* @__PURE__ */ m.jsx(I, { significance: "secondary", children: `${o.length}/${l}` })
|
|
886
916
|
] }),
|
|
887
917
|
/* @__PURE__ */ m.jsxs("div", { className: "flex flex-col relative", children: [
|
|
888
918
|
/* @__PURE__ */ m.jsx(
|
|
889
|
-
|
|
919
|
+
I,
|
|
890
920
|
{
|
|
891
921
|
as: "div",
|
|
892
|
-
className:
|
|
922
|
+
className: j(
|
|
893
923
|
"overflow-y-hidden whitespace-pre-wrap invisible break-words rounded-lg py-3 px-4 min-h-20 border-separator-opaque-light dark:border-separator-opaque-dark"
|
|
894
924
|
),
|
|
895
925
|
children: o
|
|
@@ -899,26 +929,26 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
899
929
|
"textarea",
|
|
900
930
|
{
|
|
901
931
|
id: "primary",
|
|
902
|
-
placeholder:
|
|
903
|
-
className:
|
|
932
|
+
placeholder: f("Type your answer here"),
|
|
933
|
+
className: j(
|
|
904
934
|
"absolute inset-0 resize-none",
|
|
905
|
-
"overflow-hidden break-words outline-
|
|
935
|
+
"overflow-hidden break-words outline-hidden resize-none material-medium",
|
|
906
936
|
"rounded-lg py-3 px-4 min-h-20 border border-separator-opaque-light dark:border-separator-opaque-dark",
|
|
907
937
|
"text-label-primary-light dark:text-label-primary-dark",
|
|
908
|
-
|
|
938
|
+
mt.B1
|
|
909
939
|
),
|
|
910
940
|
value: o,
|
|
911
|
-
onChange: (
|
|
941
|
+
onChange: (p) => c(p.target.value)
|
|
912
942
|
}
|
|
913
943
|
)
|
|
914
944
|
] })
|
|
915
945
|
] })
|
|
916
946
|
}
|
|
917
947
|
);
|
|
918
|
-
},
|
|
948
|
+
}, xt = ({ title: r, icon: e, description: t, image: n, children: i, wrapperClassName: s }) => /* @__PURE__ */ m.jsxs(
|
|
919
949
|
"div",
|
|
920
950
|
{
|
|
921
|
-
className:
|
|
951
|
+
className: j(
|
|
922
952
|
"grid mx-4 my-8 rounded-xl border",
|
|
923
953
|
"grid-cols-1 p-4 pt-10",
|
|
924
954
|
"md:p-8 md:gap-16 md:max-w-[960px] md:min-w-[660px]",
|
|
@@ -930,77 +960,77 @@ const F = gn, z = ({ children: i, className: e, variant: t = "B1", significance:
|
|
|
930
960
|
/* @__PURE__ */ m.jsxs("div", { className: "flex flex-col justify-between gap-6 md:gap-8 order-2 md:order-1", children: [
|
|
931
961
|
/* @__PURE__ */ m.jsxs("div", { className: "flex flex-col gap-6 md:gap-8", children: [
|
|
932
962
|
/* @__PURE__ */ m.jsxs("div", { className: "flex flex-col gap-2 md:gap-4", children: [
|
|
933
|
-
e && /* @__PURE__ */ m.jsx("div", { className:
|
|
934
|
-
/* @__PURE__ */ m.jsx(
|
|
963
|
+
e && /* @__PURE__ */ m.jsx("div", { className: j("h-8 w-8 rounded-lg overflow-hidden", n ? "hidden md:block" : "block"), children: /* @__PURE__ */ m.jsx("img", { className: "w-full h-full object-cover", src: e, alt: "icon" }) }),
|
|
964
|
+
/* @__PURE__ */ m.jsx(I, { variant: "H2", children: r })
|
|
935
965
|
] }),
|
|
936
966
|
t && t.trim().replace(/\n{3,}/g, `
|
|
937
967
|
|
|
938
968
|
`).split(`
|
|
939
969
|
|
|
940
|
-
`).map((a, o) => /* @__PURE__ */ m.jsx(
|
|
970
|
+
`).map((a, o) => /* @__PURE__ */ m.jsx(I, { children: a.trim() }, o))
|
|
941
971
|
] }),
|
|
942
|
-
|
|
972
|
+
i
|
|
943
973
|
] }),
|
|
944
974
|
n && /* @__PURE__ */ m.jsx("div", { className: "flex flex-col justify-center order-1 md:order-2", children: /* @__PURE__ */ m.jsx("div", { className: "rounded-lg overflow-hidden mb-6 md:mb-0", children: /* @__PURE__ */ m.jsx("img", { className: "w-full h-full object-cover aspect-video md:aspect-square", src: n, alt: "image" }) }) })
|
|
945
975
|
]
|
|
946
976
|
}
|
|
947
|
-
),
|
|
977
|
+
), mn = ({ title: r, icon: e, description: t, image: n, quitText: i, onQuit: s, externalLink: a }) => /* @__PURE__ */ m.jsxs(xt, { title: r, icon: e, description: t, image: n, children: [
|
|
948
978
|
/* @__PURE__ */ m.jsx("div", { className: "flex justify-end gap-2", children: a ? /* @__PURE__ */ m.jsx(
|
|
949
|
-
|
|
979
|
+
A,
|
|
950
980
|
{
|
|
951
981
|
variant: "secondary",
|
|
952
|
-
text:
|
|
953
|
-
iconAfter: /* @__PURE__ */ m.jsx(
|
|
982
|
+
text: i,
|
|
983
|
+
iconAfter: /* @__PURE__ */ m.jsx(ht, {}),
|
|
954
984
|
onClick: () => {
|
|
955
|
-
window.open(a, "_blank"), s
|
|
985
|
+
window.open(a, "_blank"), s();
|
|
956
986
|
}
|
|
957
987
|
}
|
|
958
|
-
) : /* @__PURE__ */ m.jsx(
|
|
959
|
-
|
|
960
|
-
|
|
988
|
+
) : /* @__PURE__ */ m.jsx(A, { variant: "secondary", onClick: s, text: i }) }),
|
|
989
|
+
a && /* @__PURE__ */ m.jsx(
|
|
990
|
+
A,
|
|
961
991
|
{
|
|
962
992
|
className: "absolute -top-2 -right-2 md:-top-4 md:-right-4",
|
|
963
993
|
variant: "secondary",
|
|
964
994
|
size: "small",
|
|
965
995
|
onClick: s,
|
|
966
|
-
iconAfter: /* @__PURE__ */ m.jsx(
|
|
996
|
+
iconAfter: /* @__PURE__ */ m.jsx(de, {}),
|
|
967
997
|
"aria-label": "quit"
|
|
968
998
|
}
|
|
969
999
|
)
|
|
970
|
-
] }),
|
|
971
|
-
title:
|
|
1000
|
+
] }), yn = ({
|
|
1001
|
+
title: r,
|
|
972
1002
|
icon: e,
|
|
973
1003
|
description: t,
|
|
974
1004
|
image: n,
|
|
975
|
-
quitText:
|
|
1005
|
+
quitText: i,
|
|
976
1006
|
onQuit: s,
|
|
977
1007
|
startText: a,
|
|
978
1008
|
onStart: o
|
|
979
|
-
}) => /* @__PURE__ */ m.jsxs(
|
|
1009
|
+
}) => /* @__PURE__ */ m.jsxs(xt, { title: r, icon: e, description: t, image: n, wrapperClassName: "relative", children: [
|
|
980
1010
|
/* @__PURE__ */ m.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
981
|
-
s &&
|
|
982
|
-
/* @__PURE__ */ m.jsx(
|
|
1011
|
+
s && i && /* @__PURE__ */ m.jsx(A, { variant: "subtle", text: i, onClick: s }),
|
|
1012
|
+
/* @__PURE__ */ m.jsx(A, { variant: "secondary", text: a, onClick: o })
|
|
983
1013
|
] }),
|
|
984
1014
|
s && /* @__PURE__ */ m.jsx(
|
|
985
|
-
|
|
1015
|
+
A,
|
|
986
1016
|
{
|
|
987
1017
|
className: "absolute top-0 right-1 md:top-1",
|
|
988
1018
|
variant: "subtle",
|
|
989
1019
|
size: "small",
|
|
990
1020
|
onClick: s,
|
|
991
|
-
iconAfter: /* @__PURE__ */ m.jsx(
|
|
1021
|
+
iconAfter: /* @__PURE__ */ m.jsx(de, {}),
|
|
992
1022
|
"aria-label": "quit"
|
|
993
1023
|
}
|
|
994
1024
|
)
|
|
995
1025
|
] });
|
|
996
|
-
let
|
|
997
|
-
function
|
|
998
|
-
return
|
|
1026
|
+
let bt = {};
|
|
1027
|
+
function xn() {
|
|
1028
|
+
return bt;
|
|
999
1029
|
}
|
|
1000
|
-
function
|
|
1001
|
-
|
|
1030
|
+
function bn(r) {
|
|
1031
|
+
bt = r;
|
|
1002
1032
|
}
|
|
1003
|
-
const
|
|
1033
|
+
const wn = {
|
|
1004
1034
|
lessThanXSeconds: {
|
|
1005
1035
|
one: "less than a second",
|
|
1006
1036
|
other: "less than {{count}} seconds"
|
|
@@ -1062,49 +1092,49 @@ const Ln = {
|
|
|
1062
1092
|
one: "almost 1 year",
|
|
1063
1093
|
other: "almost {{count}} years"
|
|
1064
1094
|
}
|
|
1065
|
-
},
|
|
1095
|
+
}, vn = (r, e, t) => {
|
|
1066
1096
|
let n;
|
|
1067
|
-
const
|
|
1068
|
-
return typeof
|
|
1097
|
+
const i = wn[r];
|
|
1098
|
+
return typeof i == "string" ? n = i : e === 1 ? n = i.one : n = i.other.replace("{{count}}", e.toString()), t?.addSuffix ? t.comparison && t.comparison > 0 ? "in " + n : n + " ago" : n;
|
|
1069
1099
|
};
|
|
1070
|
-
function
|
|
1100
|
+
function fe(r) {
|
|
1071
1101
|
return (e = {}) => {
|
|
1072
|
-
const t = e.width ? String(e.width) :
|
|
1073
|
-
return
|
|
1102
|
+
const t = e.width ? String(e.width) : r.defaultWidth;
|
|
1103
|
+
return r.formats[t] || r.formats[r.defaultWidth];
|
|
1074
1104
|
};
|
|
1075
1105
|
}
|
|
1076
|
-
const
|
|
1106
|
+
const Sn = {
|
|
1077
1107
|
lastWeek: "'last' eeee 'at' p",
|
|
1078
1108
|
yesterday: "'yesterday at' p",
|
|
1079
1109
|
today: "'today at' p",
|
|
1080
1110
|
tomorrow: "'tomorrow at' p",
|
|
1081
1111
|
nextWeek: "eeee 'at' p",
|
|
1082
1112
|
other: "P"
|
|
1083
|
-
},
|
|
1084
|
-
function Q(
|
|
1113
|
+
}, kn = (r, e, t, n) => Sn[r];
|
|
1114
|
+
function Q(r) {
|
|
1085
1115
|
return (e, t) => {
|
|
1086
|
-
const n = t
|
|
1087
|
-
let
|
|
1088
|
-
if (n === "formatting" &&
|
|
1089
|
-
const a =
|
|
1090
|
-
|
|
1116
|
+
const n = t?.context ? String(t.context) : "standalone";
|
|
1117
|
+
let i;
|
|
1118
|
+
if (n === "formatting" && r.formattingValues) {
|
|
1119
|
+
const a = r.defaultFormattingWidth || r.defaultWidth, o = t?.width ? String(t.width) : a;
|
|
1120
|
+
i = r.formattingValues[o] || r.formattingValues[a];
|
|
1091
1121
|
} else {
|
|
1092
|
-
const a =
|
|
1093
|
-
|
|
1122
|
+
const a = r.defaultWidth, o = t?.width ? String(t.width) : r.defaultWidth;
|
|
1123
|
+
i = r.values[o] || r.values[a];
|
|
1094
1124
|
}
|
|
1095
|
-
const s =
|
|
1096
|
-
return
|
|
1125
|
+
const s = r.argumentCallback ? r.argumentCallback(e) : e;
|
|
1126
|
+
return i[s];
|
|
1097
1127
|
};
|
|
1098
1128
|
}
|
|
1099
|
-
const
|
|
1129
|
+
const Ln = {
|
|
1100
1130
|
narrow: ["B", "A"],
|
|
1101
1131
|
abbreviated: ["BC", "AD"],
|
|
1102
1132
|
wide: ["Before Christ", "Anno Domini"]
|
|
1103
|
-
},
|
|
1133
|
+
}, En = {
|
|
1104
1134
|
narrow: ["1", "2", "3", "4"],
|
|
1105
1135
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
1106
1136
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
1107
|
-
},
|
|
1137
|
+
}, Pn = {
|
|
1108
1138
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
1109
1139
|
abbreviated: [
|
|
1110
1140
|
"Jan",
|
|
@@ -1134,7 +1164,7 @@ const Cn = {
|
|
|
1134
1164
|
"November",
|
|
1135
1165
|
"December"
|
|
1136
1166
|
]
|
|
1137
|
-
},
|
|
1167
|
+
}, On = {
|
|
1138
1168
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
1139
1169
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
1140
1170
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -1147,7 +1177,7 @@ const Cn = {
|
|
|
1147
1177
|
"Friday",
|
|
1148
1178
|
"Saturday"
|
|
1149
1179
|
]
|
|
1150
|
-
},
|
|
1180
|
+
}, Nn = {
|
|
1151
1181
|
narrow: {
|
|
1152
1182
|
am: "a",
|
|
1153
1183
|
pm: "p",
|
|
@@ -1178,7 +1208,7 @@ const Cn = {
|
|
|
1178
1208
|
evening: "evening",
|
|
1179
1209
|
night: "night"
|
|
1180
1210
|
}
|
|
1181
|
-
},
|
|
1211
|
+
}, Cn = {
|
|
1182
1212
|
narrow: {
|
|
1183
1213
|
am: "a",
|
|
1184
1214
|
pm: "p",
|
|
@@ -1209,8 +1239,8 @@ const Cn = {
|
|
|
1209
1239
|
evening: "in the evening",
|
|
1210
1240
|
night: "at night"
|
|
1211
1241
|
}
|
|
1212
|
-
},
|
|
1213
|
-
const t = Number(
|
|
1242
|
+
}, jn = (r, e) => {
|
|
1243
|
+
const t = Number(r), n = t % 100;
|
|
1214
1244
|
if (n > 20 || n < 10)
|
|
1215
1245
|
switch (n % 10) {
|
|
1216
1246
|
case 1:
|
|
@@ -1221,43 +1251,43 @@ const Cn = {
|
|
|
1221
1251
|
return t + "rd";
|
|
1222
1252
|
}
|
|
1223
1253
|
return t + "th";
|
|
1224
|
-
},
|
|
1225
|
-
ordinalNumber:
|
|
1254
|
+
}, Tn = {
|
|
1255
|
+
ordinalNumber: jn,
|
|
1226
1256
|
era: Q({
|
|
1227
|
-
values:
|
|
1257
|
+
values: Ln,
|
|
1228
1258
|
defaultWidth: "wide"
|
|
1229
1259
|
}),
|
|
1230
1260
|
quarter: Q({
|
|
1231
|
-
values:
|
|
1261
|
+
values: En,
|
|
1232
1262
|
defaultWidth: "wide",
|
|
1233
|
-
argumentCallback: (
|
|
1263
|
+
argumentCallback: (r) => r - 1
|
|
1234
1264
|
}),
|
|
1235
1265
|
month: Q({
|
|
1236
|
-
values:
|
|
1266
|
+
values: Pn,
|
|
1237
1267
|
defaultWidth: "wide"
|
|
1238
1268
|
}),
|
|
1239
1269
|
day: Q({
|
|
1240
|
-
values:
|
|
1270
|
+
values: On,
|
|
1241
1271
|
defaultWidth: "wide"
|
|
1242
1272
|
}),
|
|
1243
1273
|
dayPeriod: Q({
|
|
1244
|
-
values:
|
|
1274
|
+
values: Nn,
|
|
1245
1275
|
defaultWidth: "wide",
|
|
1246
|
-
formattingValues:
|
|
1276
|
+
formattingValues: Cn,
|
|
1247
1277
|
defaultFormattingWidth: "wide"
|
|
1248
1278
|
})
|
|
1249
1279
|
};
|
|
1250
|
-
function
|
|
1280
|
+
function G(r) {
|
|
1251
1281
|
return (e, t = {}) => {
|
|
1252
|
-
const n = t.width,
|
|
1282
|
+
const n = t.width, i = n && r.matchPatterns[n] || r.matchPatterns[r.defaultMatchWidth], s = e.match(i);
|
|
1253
1283
|
if (!s)
|
|
1254
1284
|
return null;
|
|
1255
|
-
const a = s[0], o = n &&
|
|
1285
|
+
const a = s[0], o = n && r.parsePatterns[n] || r.parsePatterns[r.defaultParseWidth], c = Array.isArray(o) ? Rn(o, (u) => u.test(a)) : (
|
|
1256
1286
|
// [TODO] -- I challenge you to fix the type
|
|
1257
|
-
|
|
1287
|
+
$n(o, (u) => u.test(a))
|
|
1258
1288
|
);
|
|
1259
1289
|
let l;
|
|
1260
|
-
l =
|
|
1290
|
+
l = r.valueCallback ? r.valueCallback(c) : c, l = t.valueCallback ? (
|
|
1261
1291
|
// [TODO] -- I challenge you to fix the type
|
|
1262
1292
|
t.valueCallback(l)
|
|
1263
1293
|
) : l;
|
|
@@ -1265,45 +1295,45 @@ function ee(i) {
|
|
|
1265
1295
|
return { value: l, rest: d };
|
|
1266
1296
|
};
|
|
1267
1297
|
}
|
|
1268
|
-
function
|
|
1269
|
-
for (const t in
|
|
1270
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1298
|
+
function $n(r, e) {
|
|
1299
|
+
for (const t in r)
|
|
1300
|
+
if (Object.prototype.hasOwnProperty.call(r, t) && e(r[t]))
|
|
1271
1301
|
return t;
|
|
1272
1302
|
}
|
|
1273
|
-
function
|
|
1274
|
-
for (let t = 0; t <
|
|
1275
|
-
if (e(
|
|
1303
|
+
function Rn(r, e) {
|
|
1304
|
+
for (let t = 0; t < r.length; t++)
|
|
1305
|
+
if (e(r[t]))
|
|
1276
1306
|
return t;
|
|
1277
1307
|
}
|
|
1278
|
-
function
|
|
1308
|
+
function Fn(r) {
|
|
1279
1309
|
return (e, t = {}) => {
|
|
1280
|
-
const n = e.match(
|
|
1310
|
+
const n = e.match(r.matchPattern);
|
|
1281
1311
|
if (!n) return null;
|
|
1282
|
-
const
|
|
1312
|
+
const i = n[0], s = e.match(r.parsePattern);
|
|
1283
1313
|
if (!s) return null;
|
|
1284
|
-
let a =
|
|
1314
|
+
let a = r.valueCallback ? r.valueCallback(s[0]) : s[0];
|
|
1285
1315
|
a = t.valueCallback ? t.valueCallback(a) : a;
|
|
1286
|
-
const o = e.slice(
|
|
1316
|
+
const o = e.slice(i.length);
|
|
1287
1317
|
return { value: a, rest: o };
|
|
1288
1318
|
};
|
|
1289
1319
|
}
|
|
1290
|
-
const
|
|
1320
|
+
const Mn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, An = {
|
|
1291
1321
|
narrow: /^(b|a)/i,
|
|
1292
1322
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
1293
1323
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
1294
|
-
},
|
|
1324
|
+
}, In = {
|
|
1295
1325
|
any: [/^b/i, /^(a|c)/i]
|
|
1296
|
-
},
|
|
1326
|
+
}, Vn = {
|
|
1297
1327
|
narrow: /^[1234]/i,
|
|
1298
1328
|
abbreviated: /^q[1234]/i,
|
|
1299
1329
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
1300
|
-
},
|
|
1330
|
+
}, Hn = {
|
|
1301
1331
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
1302
|
-
},
|
|
1332
|
+
}, Kn = {
|
|
1303
1333
|
narrow: /^[jfmasond]/i,
|
|
1304
1334
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
1305
1335
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
1306
|
-
},
|
|
1336
|
+
}, Bn = {
|
|
1307
1337
|
narrow: [
|
|
1308
1338
|
/^j/i,
|
|
1309
1339
|
/^f/i,
|
|
@@ -1332,18 +1362,18 @@ const In = /^(\d+)(th|st|nd|rd)?/i, Hn = /\d+/i, Bn = {
|
|
|
1332
1362
|
/^n/i,
|
|
1333
1363
|
/^d/i
|
|
1334
1364
|
]
|
|
1335
|
-
},
|
|
1365
|
+
}, zn = {
|
|
1336
1366
|
narrow: /^[smtwf]/i,
|
|
1337
1367
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
1338
1368
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
1339
1369
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
1340
|
-
},
|
|
1370
|
+
}, qn = {
|
|
1341
1371
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
1342
1372
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
1343
|
-
},
|
|
1373
|
+
}, Un = {
|
|
1344
1374
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
1345
1375
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
1346
|
-
},
|
|
1376
|
+
}, _n = {
|
|
1347
1377
|
any: {
|
|
1348
1378
|
am: /^a/i,
|
|
1349
1379
|
pm: /^p/i,
|
|
@@ -1354,148 +1384,148 @@ const In = /^(\d+)(th|st|nd|rd)?/i, Hn = /\d+/i, Bn = {
|
|
|
1354
1384
|
evening: /evening/i,
|
|
1355
1385
|
night: /night/i
|
|
1356
1386
|
}
|
|
1357
|
-
},
|
|
1358
|
-
ordinalNumber:
|
|
1359
|
-
matchPattern:
|
|
1360
|
-
parsePattern:
|
|
1361
|
-
valueCallback: (
|
|
1387
|
+
}, Wn = {
|
|
1388
|
+
ordinalNumber: Fn({
|
|
1389
|
+
matchPattern: Mn,
|
|
1390
|
+
parsePattern: Dn,
|
|
1391
|
+
valueCallback: (r) => parseInt(r, 10)
|
|
1362
1392
|
}),
|
|
1363
|
-
era:
|
|
1364
|
-
matchPatterns:
|
|
1393
|
+
era: G({
|
|
1394
|
+
matchPatterns: An,
|
|
1365
1395
|
defaultMatchWidth: "wide",
|
|
1366
|
-
parsePatterns:
|
|
1396
|
+
parsePatterns: In,
|
|
1367
1397
|
defaultParseWidth: "any"
|
|
1368
1398
|
}),
|
|
1369
|
-
quarter:
|
|
1370
|
-
matchPatterns:
|
|
1399
|
+
quarter: G({
|
|
1400
|
+
matchPatterns: Vn,
|
|
1371
1401
|
defaultMatchWidth: "wide",
|
|
1372
|
-
parsePatterns:
|
|
1402
|
+
parsePatterns: Hn,
|
|
1373
1403
|
defaultParseWidth: "any",
|
|
1374
|
-
valueCallback: (
|
|
1404
|
+
valueCallback: (r) => r + 1
|
|
1375
1405
|
}),
|
|
1376
|
-
month:
|
|
1377
|
-
matchPatterns:
|
|
1406
|
+
month: G({
|
|
1407
|
+
matchPatterns: Kn,
|
|
1378
1408
|
defaultMatchWidth: "wide",
|
|
1379
|
-
parsePatterns:
|
|
1409
|
+
parsePatterns: Bn,
|
|
1380
1410
|
defaultParseWidth: "any"
|
|
1381
1411
|
}),
|
|
1382
|
-
day:
|
|
1383
|
-
matchPatterns:
|
|
1412
|
+
day: G({
|
|
1413
|
+
matchPatterns: zn,
|
|
1384
1414
|
defaultMatchWidth: "wide",
|
|
1385
|
-
parsePatterns:
|
|
1415
|
+
parsePatterns: qn,
|
|
1386
1416
|
defaultParseWidth: "any"
|
|
1387
1417
|
}),
|
|
1388
|
-
dayPeriod:
|
|
1389
|
-
matchPatterns:
|
|
1418
|
+
dayPeriod: G({
|
|
1419
|
+
matchPatterns: Un,
|
|
1390
1420
|
defaultMatchWidth: "any",
|
|
1391
|
-
parsePatterns:
|
|
1421
|
+
parsePatterns: _n,
|
|
1392
1422
|
defaultParseWidth: "any"
|
|
1393
1423
|
})
|
|
1394
1424
|
};
|
|
1395
|
-
function
|
|
1396
|
-
const e = {}, t =
|
|
1425
|
+
function Zn(r) {
|
|
1426
|
+
const e = {}, t = xn();
|
|
1397
1427
|
for (const n in t)
|
|
1398
1428
|
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
1399
|
-
for (const n in
|
|
1400
|
-
Object.prototype.hasOwnProperty.call(
|
|
1401
|
-
|
|
1429
|
+
for (const n in r)
|
|
1430
|
+
Object.prototype.hasOwnProperty.call(r, n) && (r[n] === void 0 ? delete e[n] : e[n] = r[n]);
|
|
1431
|
+
bn(e);
|
|
1402
1432
|
}
|
|
1403
|
-
const
|
|
1433
|
+
const Jn = {
|
|
1404
1434
|
full: "EEEE, d MMMM yyyy",
|
|
1405
1435
|
long: "d MMMM yyyy",
|
|
1406
1436
|
medium: "d MMM yyyy",
|
|
1407
1437
|
short: "dd/MM/yyyy"
|
|
1408
|
-
},
|
|
1438
|
+
}, Qn = {
|
|
1409
1439
|
full: "HH:mm:ss zzzz",
|
|
1410
1440
|
long: "HH:mm:ss z",
|
|
1411
1441
|
medium: "HH:mm:ss",
|
|
1412
1442
|
short: "HH:mm"
|
|
1413
|
-
},
|
|
1443
|
+
}, Gn = {
|
|
1414
1444
|
full: "{{date}} 'at' {{time}}",
|
|
1415
1445
|
long: "{{date}} 'at' {{time}}",
|
|
1416
1446
|
medium: "{{date}}, {{time}}",
|
|
1417
1447
|
short: "{{date}}, {{time}}"
|
|
1418
|
-
},
|
|
1419
|
-
date:
|
|
1420
|
-
formats:
|
|
1448
|
+
}, Yn = {
|
|
1449
|
+
date: fe({
|
|
1450
|
+
formats: Jn,
|
|
1421
1451
|
defaultWidth: "full"
|
|
1422
1452
|
}),
|
|
1423
|
-
time:
|
|
1424
|
-
formats:
|
|
1453
|
+
time: fe({
|
|
1454
|
+
formats: Qn,
|
|
1425
1455
|
defaultWidth: "full"
|
|
1426
1456
|
}),
|
|
1427
|
-
dateTime:
|
|
1428
|
-
formats:
|
|
1457
|
+
dateTime: fe({
|
|
1458
|
+
formats: Gn,
|
|
1429
1459
|
defaultWidth: "full"
|
|
1430
1460
|
})
|
|
1431
|
-
},
|
|
1461
|
+
}, Xn = {
|
|
1432
1462
|
code: "en-GB",
|
|
1433
|
-
formatDistance:
|
|
1434
|
-
formatLong:
|
|
1435
|
-
formatRelative:
|
|
1436
|
-
localize:
|
|
1437
|
-
match:
|
|
1463
|
+
formatDistance: vn,
|
|
1464
|
+
formatLong: Yn,
|
|
1465
|
+
formatRelative: kn,
|
|
1466
|
+
localize: Tn,
|
|
1467
|
+
match: Wn,
|
|
1438
1468
|
options: {
|
|
1439
1469
|
weekStartsOn: 1,
|
|
1440
1470
|
firstWeekContainsDate: 4
|
|
1441
1471
|
}
|
|
1442
|
-
}, x = (
|
|
1443
|
-
let
|
|
1444
|
-
const t = new Promise((n,
|
|
1445
|
-
|
|
1472
|
+
}, x = (r) => typeof r == "string", Y = () => {
|
|
1473
|
+
let r, e;
|
|
1474
|
+
const t = new Promise((n, i) => {
|
|
1475
|
+
r = n, e = i;
|
|
1446
1476
|
});
|
|
1447
|
-
return t.resolve =
|
|
1448
|
-
},
|
|
1449
|
-
|
|
1477
|
+
return t.resolve = r, t.reject = e, t;
|
|
1478
|
+
}, Ie = (r) => r == null ? "" : "" + r, ei = (r, e, t) => {
|
|
1479
|
+
r.forEach((n) => {
|
|
1450
1480
|
e[n] && (t[n] = e[n]);
|
|
1451
1481
|
});
|
|
1452
|
-
},
|
|
1482
|
+
}, ti = /###/g, Ve = (r) => r && r.indexOf("###") > -1 ? r.replace(ti, ".") : r, He = (r) => !r || x(r), ee = (r, e, t) => {
|
|
1453
1483
|
const n = x(e) ? e.split(".") : e;
|
|
1454
|
-
let
|
|
1455
|
-
for (;
|
|
1456
|
-
if (
|
|
1457
|
-
const s =
|
|
1458
|
-
!
|
|
1484
|
+
let i = 0;
|
|
1485
|
+
for (; i < n.length - 1; ) {
|
|
1486
|
+
if (He(r)) return {};
|
|
1487
|
+
const s = Ve(n[i]);
|
|
1488
|
+
!r[s] && t && (r[s] = new t()), Object.prototype.hasOwnProperty.call(r, s) ? r = r[s] : r = {}, ++i;
|
|
1459
1489
|
}
|
|
1460
|
-
return
|
|
1461
|
-
obj:
|
|
1462
|
-
k:
|
|
1490
|
+
return He(r) ? {} : {
|
|
1491
|
+
obj: r,
|
|
1492
|
+
k: Ve(n[i])
|
|
1463
1493
|
};
|
|
1464
|
-
},
|
|
1494
|
+
}, Ke = (r, e, t) => {
|
|
1465
1495
|
const {
|
|
1466
1496
|
obj: n,
|
|
1467
|
-
k:
|
|
1468
|
-
} =
|
|
1497
|
+
k: i
|
|
1498
|
+
} = ee(r, e, Object);
|
|
1469
1499
|
if (n !== void 0 || e.length === 1) {
|
|
1470
|
-
n[
|
|
1500
|
+
n[i] = t;
|
|
1471
1501
|
return;
|
|
1472
1502
|
}
|
|
1473
|
-
let s = e[e.length - 1], a = e.slice(0, e.length - 1), o =
|
|
1503
|
+
let s = e[e.length - 1], a = e.slice(0, e.length - 1), o = ee(r, a, Object);
|
|
1474
1504
|
for (; o.obj === void 0 && a.length; )
|
|
1475
|
-
s = `${a[a.length - 1]}.${s}`, a = a.slice(0, a.length - 1), o =
|
|
1505
|
+
s = `${a[a.length - 1]}.${s}`, a = a.slice(0, a.length - 1), o = ee(r, a, Object), o?.obj && typeof o.obj[`${o.k}.${s}`] < "u" && (o.obj = void 0);
|
|
1476
1506
|
o.obj[`${o.k}.${s}`] = t;
|
|
1477
|
-
},
|
|
1507
|
+
}, ni = (r, e, t, n) => {
|
|
1478
1508
|
const {
|
|
1479
|
-
obj:
|
|
1509
|
+
obj: i,
|
|
1480
1510
|
k: s
|
|
1481
|
-
} =
|
|
1482
|
-
|
|
1483
|
-
},
|
|
1511
|
+
} = ee(r, e, Object);
|
|
1512
|
+
i[s] = i[s] || [], i[s].push(t);
|
|
1513
|
+
}, le = (r, e) => {
|
|
1484
1514
|
const {
|
|
1485
1515
|
obj: t,
|
|
1486
1516
|
k: n
|
|
1487
|
-
} =
|
|
1517
|
+
} = ee(r, e);
|
|
1488
1518
|
if (t && Object.prototype.hasOwnProperty.call(t, n))
|
|
1489
1519
|
return t[n];
|
|
1490
|
-
},
|
|
1491
|
-
const n =
|
|
1492
|
-
return n !== void 0 ? n :
|
|
1493
|
-
},
|
|
1520
|
+
}, ii = (r, e, t) => {
|
|
1521
|
+
const n = le(r, t);
|
|
1522
|
+
return n !== void 0 ? n : le(e, t);
|
|
1523
|
+
}, wt = (r, e, t) => {
|
|
1494
1524
|
for (const n in e)
|
|
1495
|
-
n !== "__proto__" && n !== "constructor" && (n in
|
|
1496
|
-
return
|
|
1497
|
-
},
|
|
1498
|
-
var
|
|
1525
|
+
n !== "__proto__" && n !== "constructor" && (n in r ? x(r[n]) || r[n] instanceof String || x(e[n]) || e[n] instanceof String ? t && (r[n] = e[n]) : wt(r[n], e[n], t) : r[n] = e[n]);
|
|
1526
|
+
return r;
|
|
1527
|
+
}, z = (r) => r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
1528
|
+
var ri = {
|
|
1499
1529
|
"&": "&",
|
|
1500
1530
|
"<": "<",
|
|
1501
1531
|
">": ">",
|
|
@@ -1503,8 +1533,8 @@ var lr = {
|
|
|
1503
1533
|
"'": "'",
|
|
1504
1534
|
"/": "/"
|
|
1505
1535
|
};
|
|
1506
|
-
const
|
|
1507
|
-
class
|
|
1536
|
+
const si = (r) => x(r) ? r.replace(/[&<>"'\/]/g, (e) => ri[e]) : r;
|
|
1537
|
+
class ai {
|
|
1508
1538
|
constructor(e) {
|
|
1509
1539
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
1510
1540
|
}
|
|
@@ -1516,59 +1546,58 @@ class dr {
|
|
|
1516
1546
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
1517
1547
|
}
|
|
1518
1548
|
}
|
|
1519
|
-
const
|
|
1549
|
+
const oi = [" ", ",", "?", "!", ";"], li = new ai(20), ci = (r, e, t) => {
|
|
1520
1550
|
e = e || "", t = t || "";
|
|
1521
|
-
const n =
|
|
1551
|
+
const n = oi.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
|
|
1522
1552
|
if (n.length === 0) return !0;
|
|
1523
|
-
const
|
|
1524
|
-
let s = !
|
|
1553
|
+
const i = li.getRegExp(`(${n.map((a) => a === "?" ? "\\?" : a).join("|")})`);
|
|
1554
|
+
let s = !i.test(r);
|
|
1525
1555
|
if (!s) {
|
|
1526
|
-
const a =
|
|
1527
|
-
a > 0 && !
|
|
1556
|
+
const a = r.indexOf(t);
|
|
1557
|
+
a > 0 && !i.test(r.substring(0, a)) && (s = !0);
|
|
1528
1558
|
}
|
|
1529
1559
|
return s;
|
|
1530
|
-
},
|
|
1531
|
-
if (!
|
|
1532
|
-
if (
|
|
1533
|
-
return Object.prototype.hasOwnProperty.call(
|
|
1560
|
+
}, be = (r, e, t = ".") => {
|
|
1561
|
+
if (!r) return;
|
|
1562
|
+
if (r[e])
|
|
1563
|
+
return Object.prototype.hasOwnProperty.call(r, e) ? r[e] : void 0;
|
|
1534
1564
|
const n = e.split(t);
|
|
1535
|
-
let
|
|
1565
|
+
let i = r;
|
|
1536
1566
|
for (let s = 0; s < n.length; ) {
|
|
1537
|
-
if (!
|
|
1567
|
+
if (!i || typeof i != "object")
|
|
1538
1568
|
return;
|
|
1539
1569
|
let a, o = "";
|
|
1540
1570
|
for (let c = s; c < n.length; ++c)
|
|
1541
|
-
if (c !== s && (o += t), o += n[c], a =
|
|
1571
|
+
if (c !== s && (o += t), o += n[c], a = i[o], a !== void 0) {
|
|
1542
1572
|
if (["string", "number", "boolean"].indexOf(typeof a) > -1 && c < n.length - 1)
|
|
1543
1573
|
continue;
|
|
1544
1574
|
s += c - s + 1;
|
|
1545
1575
|
break;
|
|
1546
1576
|
}
|
|
1547
|
-
|
|
1577
|
+
i = a;
|
|
1548
1578
|
}
|
|
1549
|
-
return
|
|
1550
|
-
},
|
|
1579
|
+
return i;
|
|
1580
|
+
}, te = (r) => r?.replace("_", "-"), di = {
|
|
1551
1581
|
type: "logger",
|
|
1552
|
-
log(
|
|
1553
|
-
this.output("log",
|
|
1582
|
+
log(r) {
|
|
1583
|
+
this.output("log", r);
|
|
1554
1584
|
},
|
|
1555
|
-
warn(
|
|
1556
|
-
this.output("warn",
|
|
1585
|
+
warn(r) {
|
|
1586
|
+
this.output("warn", r);
|
|
1557
1587
|
},
|
|
1558
|
-
error(
|
|
1559
|
-
this.output("error",
|
|
1588
|
+
error(r) {
|
|
1589
|
+
this.output("error", r);
|
|
1560
1590
|
},
|
|
1561
|
-
output(
|
|
1562
|
-
|
|
1563
|
-
(n = (t = console == null ? void 0 : console[i]) == null ? void 0 : t.apply) == null || n.call(t, console, e);
|
|
1591
|
+
output(r, e) {
|
|
1592
|
+
console?.[r]?.apply?.(console, e);
|
|
1564
1593
|
}
|
|
1565
1594
|
};
|
|
1566
|
-
let
|
|
1595
|
+
let ui = class we {
|
|
1567
1596
|
constructor(e, t = {}) {
|
|
1568
1597
|
this.init(e, t);
|
|
1569
1598
|
}
|
|
1570
1599
|
init(e, t = {}) {
|
|
1571
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
1600
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || di, this.options = t, this.debug = t.debug;
|
|
1572
1601
|
}
|
|
1573
1602
|
log(...e) {
|
|
1574
1603
|
return this.forward(e, "log", "", !0);
|
|
@@ -1582,29 +1611,29 @@ let pr = class ke {
|
|
|
1582
1611
|
deprecate(...e) {
|
|
1583
1612
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
1584
1613
|
}
|
|
1585
|
-
forward(e, t, n,
|
|
1586
|
-
return
|
|
1614
|
+
forward(e, t, n, i) {
|
|
1615
|
+
return i && !this.debug ? null : (x(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
1587
1616
|
}
|
|
1588
1617
|
create(e) {
|
|
1589
|
-
return new
|
|
1618
|
+
return new we(this.logger, {
|
|
1590
1619
|
prefix: `${this.prefix}:${e}:`,
|
|
1591
1620
|
...this.options
|
|
1592
1621
|
});
|
|
1593
1622
|
}
|
|
1594
1623
|
clone(e) {
|
|
1595
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new
|
|
1624
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new we(this.logger, e);
|
|
1596
1625
|
}
|
|
1597
1626
|
};
|
|
1598
|
-
var
|
|
1599
|
-
class
|
|
1627
|
+
var F = new ui();
|
|
1628
|
+
class ue {
|
|
1600
1629
|
constructor() {
|
|
1601
1630
|
this.observers = {};
|
|
1602
1631
|
}
|
|
1603
1632
|
on(e, t) {
|
|
1604
1633
|
return e.split(" ").forEach((n) => {
|
|
1605
1634
|
this.observers[n] || (this.observers[n] = /* @__PURE__ */ new Map());
|
|
1606
|
-
const
|
|
1607
|
-
this.observers[n].set(t,
|
|
1635
|
+
const i = this.observers[n].get(t) || 0;
|
|
1636
|
+
this.observers[n].set(t, i + 1);
|
|
1608
1637
|
}), this;
|
|
1609
1638
|
}
|
|
1610
1639
|
off(e, t) {
|
|
@@ -1617,16 +1646,16 @@ class ge {
|
|
|
1617
1646
|
}
|
|
1618
1647
|
}
|
|
1619
1648
|
emit(e, ...t) {
|
|
1620
|
-
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([
|
|
1649
|
+
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([i, s]) => {
|
|
1621
1650
|
for (let a = 0; a < s; a++)
|
|
1622
|
-
|
|
1623
|
-
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([
|
|
1651
|
+
i(...t);
|
|
1652
|
+
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([i, s]) => {
|
|
1624
1653
|
for (let a = 0; a < s; a++)
|
|
1625
|
-
|
|
1654
|
+
i.apply(i, [e, ...t]);
|
|
1626
1655
|
});
|
|
1627
1656
|
}
|
|
1628
1657
|
}
|
|
1629
|
-
class
|
|
1658
|
+
class Be extends ue {
|
|
1630
1659
|
constructor(e, t = {
|
|
1631
1660
|
ns: ["translation"],
|
|
1632
1661
|
defaultNS: "translation"
|
|
@@ -1640,41 +1669,40 @@ class Ue extends ge {
|
|
|
1640
1669
|
const t = this.options.ns.indexOf(e);
|
|
1641
1670
|
t > -1 && this.options.ns.splice(t, 1);
|
|
1642
1671
|
}
|
|
1643
|
-
getResource(e, t, n,
|
|
1644
|
-
|
|
1645
|
-
const s = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator, a = r.ignoreJSONStructure !== void 0 ? r.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
1672
|
+
getResource(e, t, n, i = {}) {
|
|
1673
|
+
const s = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, a = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
1646
1674
|
let o;
|
|
1647
1675
|
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : x(n) && s ? o.push(...n.split(s)) : o.push(n)));
|
|
1648
|
-
const c =
|
|
1649
|
-
return !c && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), c || !a || !x(n) ? c :
|
|
1676
|
+
const c = le(this.data, o);
|
|
1677
|
+
return !c && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), c || !a || !x(n) ? c : be(this.data?.[e]?.[t], n, s);
|
|
1650
1678
|
}
|
|
1651
|
-
addResource(e, t, n,
|
|
1679
|
+
addResource(e, t, n, i, s = {
|
|
1652
1680
|
silent: !1
|
|
1653
1681
|
}) {
|
|
1654
1682
|
const a = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator;
|
|
1655
1683
|
let o = [e, t];
|
|
1656
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."),
|
|
1684
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), i = t, t = o[1]), this.addNamespaces(t), Ke(this.data, o, i), s.silent || this.emit("added", e, t, n, i);
|
|
1657
1685
|
}
|
|
1658
|
-
addResources(e, t, n,
|
|
1686
|
+
addResources(e, t, n, i = {
|
|
1659
1687
|
silent: !1
|
|
1660
1688
|
}) {
|
|
1661
1689
|
for (const s in n)
|
|
1662
1690
|
(x(n[s]) || Array.isArray(n[s])) && this.addResource(e, t, s, n[s], {
|
|
1663
1691
|
silent: !0
|
|
1664
1692
|
});
|
|
1665
|
-
|
|
1693
|
+
i.silent || this.emit("added", e, t, n);
|
|
1666
1694
|
}
|
|
1667
|
-
addResourceBundle(e, t, n,
|
|
1695
|
+
addResourceBundle(e, t, n, i, s, a = {
|
|
1668
1696
|
silent: !1,
|
|
1669
1697
|
skipCopy: !1
|
|
1670
1698
|
}) {
|
|
1671
1699
|
let o = [e, t];
|
|
1672
|
-
e.indexOf(".") > -1 && (o = e.split("."),
|
|
1673
|
-
let c =
|
|
1674
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))),
|
|
1700
|
+
e.indexOf(".") > -1 && (o = e.split("."), i = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
1701
|
+
let c = le(this.data, o) || {};
|
|
1702
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), i ? wt(c, n, s) : c = {
|
|
1675
1703
|
...c,
|
|
1676
1704
|
...n
|
|
1677
|
-
},
|
|
1705
|
+
}, Ke(this.data, o, c), a.silent || this.emit("added", e, t, n);
|
|
1678
1706
|
}
|
|
1679
1707
|
removeResourceBundle(e, t) {
|
|
1680
1708
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -1690,43 +1718,39 @@ class Ue extends ge {
|
|
|
1690
1718
|
}
|
|
1691
1719
|
hasLanguageSomeTranslations(e) {
|
|
1692
1720
|
const t = this.getDataByLanguage(e);
|
|
1693
|
-
return !!(t && Object.keys(t) || []).find((
|
|
1721
|
+
return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
|
|
1694
1722
|
}
|
|
1695
1723
|
toJSON() {
|
|
1696
1724
|
return this.data;
|
|
1697
1725
|
}
|
|
1698
1726
|
}
|
|
1699
|
-
var
|
|
1727
|
+
var vt = {
|
|
1700
1728
|
processors: {},
|
|
1701
|
-
addPostProcessor(
|
|
1702
|
-
this.processors[
|
|
1729
|
+
addPostProcessor(r) {
|
|
1730
|
+
this.processors[r.name] = r;
|
|
1703
1731
|
},
|
|
1704
|
-
handle(
|
|
1705
|
-
return
|
|
1706
|
-
|
|
1707
|
-
e = ((a = this.processors[s]) == null ? void 0 : a.process(e, t, n, r)) ?? e;
|
|
1732
|
+
handle(r, e, t, n, i) {
|
|
1733
|
+
return r.forEach((s) => {
|
|
1734
|
+
e = this.processors[s]?.process(e, t, n, i) ?? e;
|
|
1708
1735
|
}), e;
|
|
1709
1736
|
}
|
|
1710
1737
|
};
|
|
1711
|
-
const
|
|
1712
|
-
function
|
|
1713
|
-
const
|
|
1738
|
+
const St = Symbol("i18next/PATH_KEY");
|
|
1739
|
+
function hi() {
|
|
1740
|
+
const r = [], e = /* @__PURE__ */ Object.create(null);
|
|
1714
1741
|
let t;
|
|
1715
|
-
return e.get = (n,
|
|
1716
|
-
var s;
|
|
1717
|
-
return (s = t == null ? void 0 : t.revoke) == null || s.call(t), r === Et ? i : (i.push(r), t = Proxy.revocable(n, e), t.proxy);
|
|
1718
|
-
}, Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
|
|
1742
|
+
return e.get = (n, i) => (t?.revoke?.(), i === St ? r : (r.push(i), t = Proxy.revocable(n, e), t.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
|
|
1719
1743
|
}
|
|
1720
|
-
function
|
|
1744
|
+
function ve(r, e) {
|
|
1721
1745
|
const {
|
|
1722
|
-
[
|
|
1723
|
-
} =
|
|
1724
|
-
return t.join(
|
|
1746
|
+
[St]: t
|
|
1747
|
+
} = r(hi());
|
|
1748
|
+
return t.join(e?.keySeparator ?? ".");
|
|
1725
1749
|
}
|
|
1726
|
-
const
|
|
1727
|
-
class
|
|
1750
|
+
const ze = {}, qe = (r) => !x(r) && typeof r != "boolean" && typeof r != "number";
|
|
1751
|
+
class ce extends ue {
|
|
1728
1752
|
constructor(e, t = {}) {
|
|
1729
|
-
super(),
|
|
1753
|
+
super(), ei(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = F.create("translator");
|
|
1730
1754
|
}
|
|
1731
1755
|
changeLanguage(e) {
|
|
1732
1756
|
e && (this.language = e);
|
|
@@ -1737,16 +1761,14 @@ class he extends ge {
|
|
|
1737
1761
|
const n = {
|
|
1738
1762
|
...t
|
|
1739
1763
|
};
|
|
1740
|
-
|
|
1741
|
-
const r = this.resolve(e, n);
|
|
1742
|
-
return (r == null ? void 0 : r.res) !== void 0;
|
|
1764
|
+
return e == null ? !1 : this.resolve(e, n)?.res !== void 0;
|
|
1743
1765
|
}
|
|
1744
1766
|
extractFromKey(e, t) {
|
|
1745
1767
|
let n = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
|
|
1746
1768
|
n === void 0 && (n = ":");
|
|
1747
|
-
const
|
|
1769
|
+
const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
1748
1770
|
let s = t.ns || this.options.defaultNS || [];
|
|
1749
|
-
const a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !
|
|
1771
|
+
const a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !ci(e, n, i);
|
|
1750
1772
|
if (a && !o) {
|
|
1751
1773
|
const c = e.match(this.interpolator.nestingRegexp);
|
|
1752
1774
|
if (c && c.length > 0)
|
|
@@ -1755,7 +1777,7 @@ class he extends ge {
|
|
|
1755
1777
|
namespaces: x(s) ? [s] : s
|
|
1756
1778
|
};
|
|
1757
1779
|
const l = e.split(n);
|
|
1758
|
-
(n !==
|
|
1780
|
+
(n !== i || n === i && this.options.ns.indexOf(l[0]) > -1) && (s = l.shift()), e = l.join(i);
|
|
1759
1781
|
}
|
|
1760
1782
|
return {
|
|
1761
1783
|
key: e,
|
|
@@ -1763,118 +1785,116 @@ class he extends ge {
|
|
|
1763
1785
|
};
|
|
1764
1786
|
}
|
|
1765
1787
|
translate(e, t, n) {
|
|
1766
|
-
let
|
|
1788
|
+
let i = typeof t == "object" ? {
|
|
1767
1789
|
...t
|
|
1768
1790
|
} : t;
|
|
1769
|
-
if (typeof
|
|
1770
|
-
...
|
|
1771
|
-
}),
|
|
1772
|
-
typeof e == "function" && (e =
|
|
1791
|
+
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = {
|
|
1792
|
+
...i
|
|
1793
|
+
}), i || (i = {}), e == null) return "";
|
|
1794
|
+
typeof e == "function" && (e = ve(e, {
|
|
1773
1795
|
...this.options,
|
|
1774
|
-
...
|
|
1796
|
+
...i
|
|
1775
1797
|
})), Array.isArray(e) || (e = [String(e)]);
|
|
1776
|
-
const s =
|
|
1798
|
+
const s = i.returnDetails !== void 0 ? i.returnDetails : this.options.returnDetails, a = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, {
|
|
1777
1799
|
key: o,
|
|
1778
1800
|
namespaces: c
|
|
1779
|
-
} = this.extractFromKey(e[e.length - 1],
|
|
1780
|
-
let d =
|
|
1801
|
+
} = this.extractFromKey(e[e.length - 1], i), l = c[c.length - 1];
|
|
1802
|
+
let d = i.nsSeparator !== void 0 ? i.nsSeparator : this.options.nsSeparator;
|
|
1781
1803
|
d === void 0 && (d = ":");
|
|
1782
|
-
const u =
|
|
1783
|
-
if (
|
|
1804
|
+
const u = i.lng || this.language, h = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
1805
|
+
if (u?.toLowerCase() === "cimode")
|
|
1784
1806
|
return h ? s ? {
|
|
1785
1807
|
res: `${l}${d}${o}`,
|
|
1786
1808
|
usedKey: o,
|
|
1787
1809
|
exactUsedKey: o,
|
|
1788
1810
|
usedLng: u,
|
|
1789
1811
|
usedNS: l,
|
|
1790
|
-
usedParams: this.getUsedParamsDetails(
|
|
1812
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
1791
1813
|
} : `${l}${d}${o}` : s ? {
|
|
1792
1814
|
res: o,
|
|
1793
1815
|
usedKey: o,
|
|
1794
1816
|
exactUsedKey: o,
|
|
1795
1817
|
usedLng: u,
|
|
1796
1818
|
usedNS: l,
|
|
1797
|
-
usedParams: this.getUsedParamsDetails(
|
|
1819
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
1798
1820
|
} : o;
|
|
1799
|
-
const f = this.resolve(e,
|
|
1800
|
-
let
|
|
1801
|
-
const y =
|
|
1821
|
+
const f = this.resolve(e, i);
|
|
1822
|
+
let p = f?.res;
|
|
1823
|
+
const y = f?.usedKey || o, b = f?.exactUsedKey || o, v = ["[object Number]", "[object Function]", "[object RegExp]"], w = i.joinArrays !== void 0 ? i.joinArrays : this.options.joinArrays, L = !this.i18nFormat || this.i18nFormat.handleAsObject, S = i.count !== void 0 && !x(i.count), k = ce.hasDefaultValue(i), E = S ? this.pluralResolver.getSuffix(u, i.count, i) : "", P = i.ordinal && S ? this.pluralResolver.getSuffix(u, i.count, {
|
|
1802
1824
|
ordinal: !1
|
|
1803
|
-
}) : "",
|
|
1804
|
-
let
|
|
1805
|
-
L && !
|
|
1806
|
-
const
|
|
1807
|
-
if (L &&
|
|
1808
|
-
if (!
|
|
1825
|
+
}) : "", Pe = S && !i.ordinal && i.count === 0, V = Pe && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${E}`] || i[`defaultValue${P}`] || i.defaultValue;
|
|
1826
|
+
let T = p;
|
|
1827
|
+
L && !p && k && (T = V);
|
|
1828
|
+
const jt = qe(T), Tt = Object.prototype.toString.apply(T);
|
|
1829
|
+
if (L && T && jt && v.indexOf(Tt) < 0 && !(x(w) && Array.isArray(T))) {
|
|
1830
|
+
if (!i.returnObjects && !this.options.returnObjects) {
|
|
1809
1831
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
1810
|
-
const
|
|
1811
|
-
...
|
|
1832
|
+
const $ = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(y, T, {
|
|
1833
|
+
...i,
|
|
1812
1834
|
ns: c
|
|
1813
1835
|
}) : `key '${o} (${this.language})' returned an object instead of string.`;
|
|
1814
|
-
return s ? (f.res =
|
|
1836
|
+
return s ? (f.res = $, f.usedParams = this.getUsedParamsDetails(i), f) : $;
|
|
1815
1837
|
}
|
|
1816
1838
|
if (a) {
|
|
1817
|
-
const
|
|
1818
|
-
for (const
|
|
1819
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1820
|
-
const
|
|
1821
|
-
|
|
1822
|
-
...
|
|
1823
|
-
defaultValue:
|
|
1839
|
+
const $ = Array.isArray(T), C = $ ? [] : {}, Oe = $ ? b : y;
|
|
1840
|
+
for (const R in T)
|
|
1841
|
+
if (Object.prototype.hasOwnProperty.call(T, R)) {
|
|
1842
|
+
const M = `${Oe}${a}${R}`;
|
|
1843
|
+
k && !p ? C[R] = this.translate(M, {
|
|
1844
|
+
...i,
|
|
1845
|
+
defaultValue: qe(V) ? V[R] : void 0,
|
|
1824
1846
|
joinArrays: !1,
|
|
1825
1847
|
ns: c
|
|
1826
|
-
}) : R
|
|
1827
|
-
...
|
|
1848
|
+
}) : C[R] = this.translate(M, {
|
|
1849
|
+
...i,
|
|
1828
1850
|
joinArrays: !1,
|
|
1829
1851
|
ns: c
|
|
1830
|
-
}), R
|
|
1852
|
+
}), C[R] === M && (C[R] = T[R]);
|
|
1831
1853
|
}
|
|
1832
|
-
|
|
1854
|
+
p = C;
|
|
1833
1855
|
}
|
|
1834
|
-
} else if (L && x(
|
|
1835
|
-
|
|
1856
|
+
} else if (L && x(w) && Array.isArray(p))
|
|
1857
|
+
p = p.join(w), p && (p = this.extendTranslation(p, e, i, n));
|
|
1836
1858
|
else {
|
|
1837
|
-
let
|
|
1838
|
-
!this.isValidLookup(
|
|
1839
|
-
const
|
|
1840
|
-
if (
|
|
1841
|
-
if (this.logger.log(
|
|
1842
|
-
const
|
|
1843
|
-
...
|
|
1859
|
+
let $ = !1, C = !1;
|
|
1860
|
+
!this.isValidLookup(p) && k && ($ = !0, p = V), this.isValidLookup(p) || (C = !0, p = o);
|
|
1861
|
+
const R = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && C ? void 0 : p, M = k && V !== p && this.options.updateMissing;
|
|
1862
|
+
if (C || $ || M) {
|
|
1863
|
+
if (this.logger.log(M ? "updateKey" : "missingKey", u, l, o, M ? V : p), a) {
|
|
1864
|
+
const N = this.resolve(o, {
|
|
1865
|
+
...i,
|
|
1844
1866
|
keySeparator: !1
|
|
1845
1867
|
});
|
|
1846
|
-
|
|
1868
|
+
N && N.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.");
|
|
1847
1869
|
}
|
|
1848
|
-
let
|
|
1849
|
-
const
|
|
1850
|
-
if (this.options.saveMissingTo === "fallback" &&
|
|
1851
|
-
for (let
|
|
1852
|
-
|
|
1853
|
-
else this.options.saveMissingTo === "all" ?
|
|
1854
|
-
const
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(T, l, K, Te, I, r) : ($e = this.backendConnector) != null && $e.saveMissing && this.backendConnector.saveMissing(T, l, K, Te, I, r), this.emit("missingKey", T, l, K, g);
|
|
1870
|
+
let _ = [];
|
|
1871
|
+
const re = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
|
|
1872
|
+
if (this.options.saveMissingTo === "fallback" && re && re[0])
|
|
1873
|
+
for (let N = 0; N < re.length; N++)
|
|
1874
|
+
_.push(re[N]);
|
|
1875
|
+
else this.options.saveMissingTo === "all" ? _ = this.languageUtils.toResolveHierarchy(i.lng || this.language) : _.push(i.lng || this.language);
|
|
1876
|
+
const Ne = (N, H, W) => {
|
|
1877
|
+
const Ce = k && W !== p ? W : R;
|
|
1878
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(N, l, H, Ce, M, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(N, l, H, Ce, M, i), this.emit("missingKey", N, l, H, p);
|
|
1858
1879
|
};
|
|
1859
|
-
this.options.saveMissing && (this.options.saveMissingPlurals &&
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
|
|
1880
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && S ? _.forEach((N) => {
|
|
1881
|
+
const H = this.pluralResolver.getSuffixes(N, i);
|
|
1882
|
+
Pe && i[`defaultValue${this.options.pluralSeparator}zero`] && H.indexOf(`${this.options.pluralSeparator}zero`) < 0 && H.push(`${this.options.pluralSeparator}zero`), H.forEach((W) => {
|
|
1883
|
+
Ne([N], o + W, i[`defaultValue${W}`] || V);
|
|
1863
1884
|
});
|
|
1864
|
-
}) :
|
|
1885
|
+
}) : Ne(_, o, V));
|
|
1865
1886
|
}
|
|
1866
|
-
|
|
1887
|
+
p = this.extendTranslation(p, e, i, f, n), C && p === o && this.options.appendNamespaceToMissingKey && (p = `${l}${d}${o}`), (C || $) && this.options.parseMissingKeyHandler && (p = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${d}${o}` : o, $ ? p : void 0, i));
|
|
1867
1888
|
}
|
|
1868
|
-
return s ? (f.res =
|
|
1889
|
+
return s ? (f.res = p, f.usedParams = this.getUsedParamsDetails(i), f) : p;
|
|
1869
1890
|
}
|
|
1870
|
-
extendTranslation(e, t, n,
|
|
1871
|
-
|
|
1872
|
-
if ((c = this.i18nFormat) != null && c.parse)
|
|
1891
|
+
extendTranslation(e, t, n, i, s) {
|
|
1892
|
+
if (this.i18nFormat?.parse)
|
|
1873
1893
|
e = this.i18nFormat.parse(e, {
|
|
1874
1894
|
...this.options.interpolation.defaultVariables,
|
|
1875
1895
|
...n
|
|
1876
|
-
}, n.lng || this.language ||
|
|
1877
|
-
resolved:
|
|
1896
|
+
}, n.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
|
|
1897
|
+
resolved: i
|
|
1878
1898
|
});
|
|
1879
1899
|
else if (!n.skipInterpolation) {
|
|
1880
1900
|
n.interpolation && this.interpolator.init({
|
|
@@ -1884,66 +1904,64 @@ class he extends ge {
|
|
|
1884
1904
|
...n.interpolation
|
|
1885
1905
|
}
|
|
1886
1906
|
});
|
|
1887
|
-
const
|
|
1888
|
-
let
|
|
1889
|
-
if (
|
|
1890
|
-
const
|
|
1891
|
-
|
|
1907
|
+
const c = x(e) && (n?.interpolation?.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
1908
|
+
let l;
|
|
1909
|
+
if (c) {
|
|
1910
|
+
const u = e.match(this.interpolator.nestingRegexp);
|
|
1911
|
+
l = u && u.length;
|
|
1892
1912
|
}
|
|
1893
|
-
let
|
|
1894
|
-
if (this.options.interpolation.defaultVariables && (
|
|
1913
|
+
let d = n.replace && !x(n.replace) ? n.replace : n;
|
|
1914
|
+
if (this.options.interpolation.defaultVariables && (d = {
|
|
1895
1915
|
...this.options.interpolation.defaultVariables,
|
|
1896
|
-
...
|
|
1897
|
-
}), e = this.interpolator.interpolate(e,
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1916
|
+
...d
|
|
1917
|
+
}), e = this.interpolator.interpolate(e, d, n.lng || this.language || i.usedLng, n), c) {
|
|
1918
|
+
const u = e.match(this.interpolator.nestingRegexp), h = u && u.length;
|
|
1919
|
+
l < h && (n.nest = !1);
|
|
1900
1920
|
}
|
|
1901
|
-
!n.lng &&
|
|
1921
|
+
!n.lng && i && i.res && (n.lng = this.language || i.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...u) => s?.[0] === u[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${u[0]} in key: ${t[0]}`), null) : this.translate(...u, t), n)), n.interpolation && this.interpolator.reset();
|
|
1902
1922
|
}
|
|
1903
1923
|
const a = n.postProcess || this.options.postProcess, o = x(a) ? [a] : a;
|
|
1904
|
-
return e != null &&
|
|
1924
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = vt.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
1905
1925
|
i18nResolved: {
|
|
1906
|
-
...
|
|
1926
|
+
...i,
|
|
1907
1927
|
usedParams: this.getUsedParamsDetails(n)
|
|
1908
1928
|
},
|
|
1909
1929
|
...n
|
|
1910
1930
|
} : n, this)), e;
|
|
1911
1931
|
}
|
|
1912
1932
|
resolve(e, t = {}) {
|
|
1913
|
-
let n,
|
|
1933
|
+
let n, i, s, a, o;
|
|
1914
1934
|
return x(e) && (e = [e]), e.forEach((c) => {
|
|
1915
1935
|
if (this.isValidLookup(n)) return;
|
|
1916
1936
|
const l = this.extractFromKey(c, t), d = l.key;
|
|
1917
|
-
|
|
1937
|
+
i = d;
|
|
1918
1938
|
let u = l.namespaces;
|
|
1919
1939
|
this.options.fallbackNS && (u = u.concat(this.options.fallbackNS));
|
|
1920
|
-
const h = t.count !== void 0 && !x(t.count), f = h && !t.ordinal && t.count === 0,
|
|
1940
|
+
const h = t.count !== void 0 && !x(t.count), f = h && !t.ordinal && t.count === 0, p = t.context !== void 0 && (x(t.context) || typeof t.context == "number") && t.context !== "", y = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
1921
1941
|
u.forEach((b) => {
|
|
1922
|
-
|
|
1923
|
-
this.isValidLookup(n) || (o = b, !_e[`${y[0]}-${b}`] && ((v = this.utils) != null && v.hasLoadedNamespace) && !((k = this.utils) != null && k.hasLoadedNamespace(o)) && (_e[`${y[0]}-${b}`] = !0, this.logger.warn(`key "${r}" for languages "${y.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!!!")), y.forEach((L) => {
|
|
1924
|
-
var V;
|
|
1942
|
+
this.isValidLookup(n) || (o = b, !ze[`${y[0]}-${b}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (ze[`${y[0]}-${b}`] = !0, this.logger.warn(`key "${i}" for languages "${y.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!!!")), y.forEach((v) => {
|
|
1925
1943
|
if (this.isValidLookup(n)) return;
|
|
1926
|
-
a =
|
|
1927
|
-
const
|
|
1928
|
-
if (
|
|
1929
|
-
this.i18nFormat.addLookupKeys(
|
|
1944
|
+
a = v;
|
|
1945
|
+
const w = [d];
|
|
1946
|
+
if (this.i18nFormat?.addLookupKeys)
|
|
1947
|
+
this.i18nFormat.addLookupKeys(w, d, v, b, t);
|
|
1930
1948
|
else {
|
|
1931
|
-
let
|
|
1932
|
-
h && (
|
|
1933
|
-
const
|
|
1934
|
-
if (h && (t.ordinal &&
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1949
|
+
let S;
|
|
1950
|
+
h && (S = this.pluralResolver.getSuffix(v, t.count, t));
|
|
1951
|
+
const k = `${this.options.pluralSeparator}zero`, E = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
1952
|
+
if (h && (t.ordinal && S.indexOf(E) === 0 && w.push(d + S.replace(E, this.options.pluralSeparator)), w.push(d + S), f && w.push(d + k)), p) {
|
|
1953
|
+
const P = `${d}${this.options.contextSeparator || "_"}${t.context}`;
|
|
1954
|
+
w.push(P), h && (t.ordinal && S.indexOf(E) === 0 && w.push(P + S.replace(E, this.options.pluralSeparator)), w.push(P + S), f && w.push(P + k));
|
|
1937
1955
|
}
|
|
1938
1956
|
}
|
|
1939
|
-
let
|
|
1940
|
-
for (;
|
|
1941
|
-
this.isValidLookup(n) || (s =
|
|
1957
|
+
let L;
|
|
1958
|
+
for (; L = w.pop(); )
|
|
1959
|
+
this.isValidLookup(n) || (s = L, n = this.getResource(v, b, L, t));
|
|
1942
1960
|
}));
|
|
1943
1961
|
});
|
|
1944
1962
|
}), {
|
|
1945
1963
|
res: n,
|
|
1946
|
-
usedKey:
|
|
1964
|
+
usedKey: i,
|
|
1947
1965
|
exactUsedKey: s,
|
|
1948
1966
|
usedLng: a,
|
|
1949
1967
|
usedNS: o
|
|
@@ -1952,24 +1970,23 @@ class he extends ge {
|
|
|
1952
1970
|
isValidLookup(e) {
|
|
1953
1971
|
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
1954
1972
|
}
|
|
1955
|
-
getResource(e, t, n,
|
|
1956
|
-
|
|
1957
|
-
return (s = this.i18nFormat) != null && s.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
|
|
1973
|
+
getResource(e, t, n, i = {}) {
|
|
1974
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, i) : this.resourceStore.getResource(e, t, n, i);
|
|
1958
1975
|
}
|
|
1959
1976
|
getUsedParamsDetails(e = {}) {
|
|
1960
1977
|
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = e.replace && !x(e.replace);
|
|
1961
|
-
let
|
|
1962
|
-
if (n && typeof e.count < "u" && (
|
|
1978
|
+
let i = n ? e.replace : e;
|
|
1979
|
+
if (n && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
|
|
1963
1980
|
...this.options.interpolation.defaultVariables,
|
|
1964
|
-
...
|
|
1981
|
+
...i
|
|
1965
1982
|
}), !n) {
|
|
1966
|
-
|
|
1967
|
-
...
|
|
1983
|
+
i = {
|
|
1984
|
+
...i
|
|
1968
1985
|
};
|
|
1969
1986
|
for (const s of t)
|
|
1970
|
-
delete
|
|
1987
|
+
delete i[s];
|
|
1971
1988
|
}
|
|
1972
|
-
return
|
|
1989
|
+
return i;
|
|
1973
1990
|
}
|
|
1974
1991
|
static hasDefaultValue(e) {
|
|
1975
1992
|
const t = "defaultValue";
|
|
@@ -1979,17 +1996,17 @@ class he extends ge {
|
|
|
1979
1996
|
return !1;
|
|
1980
1997
|
}
|
|
1981
1998
|
}
|
|
1982
|
-
class
|
|
1999
|
+
class Ue {
|
|
1983
2000
|
constructor(e) {
|
|
1984
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
2001
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = F.create("languageUtils");
|
|
1985
2002
|
}
|
|
1986
2003
|
getScriptPartFromCode(e) {
|
|
1987
|
-
if (e =
|
|
2004
|
+
if (e = te(e), !e || e.indexOf("-") < 0) return null;
|
|
1988
2005
|
const t = e.split("-");
|
|
1989
2006
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
1990
2007
|
}
|
|
1991
2008
|
getLanguagePartFromCode(e) {
|
|
1992
|
-
if (e =
|
|
2009
|
+
if (e = te(e), !e || e.indexOf("-") < 0) return e;
|
|
1993
2010
|
const t = e.split("-");
|
|
1994
2011
|
return this.formatLanguageCode(t[0]);
|
|
1995
2012
|
}
|
|
@@ -2012,12 +2029,12 @@ class Ze {
|
|
|
2012
2029
|
let t;
|
|
2013
2030
|
return e.forEach((n) => {
|
|
2014
2031
|
if (t) return;
|
|
2015
|
-
const
|
|
2016
|
-
(!this.options.supportedLngs || this.isSupportedCode(
|
|
2032
|
+
const i = this.formatLanguageCode(n);
|
|
2033
|
+
(!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
|
|
2017
2034
|
}), !t && this.options.supportedLngs && e.forEach((n) => {
|
|
2018
2035
|
if (t) return;
|
|
2019
|
-
const
|
|
2020
|
-
if (this.isSupportedCode(
|
|
2036
|
+
const i = this.getScriptPartFromCode(n);
|
|
2037
|
+
if (this.isSupportedCode(i)) return t = i;
|
|
2021
2038
|
const s = this.getLanguagePartFromCode(n);
|
|
2022
2039
|
if (this.isSupportedCode(s)) return t = s;
|
|
2023
2040
|
t = this.options.supportedLngs.find((a) => {
|
|
@@ -2035,30 +2052,30 @@ class Ze {
|
|
|
2035
2052
|
return n || (n = e[this.getScriptPartFromCode(t)]), n || (n = e[this.formatLanguageCode(t)]), n || (n = e[this.getLanguagePartFromCode(t)]), n || (n = e.default), n || [];
|
|
2036
2053
|
}
|
|
2037
2054
|
toResolveHierarchy(e, t) {
|
|
2038
|
-
const n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e),
|
|
2039
|
-
a && (this.isSupportedCode(a) ?
|
|
2055
|
+
const n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), i = [], s = (a) => {
|
|
2056
|
+
a && (this.isSupportedCode(a) ? i.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`));
|
|
2040
2057
|
};
|
|
2041
2058
|
return x(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && s(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && s(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && s(this.getLanguagePartFromCode(e))) : x(e) && s(this.formatLanguageCode(e)), n.forEach((a) => {
|
|
2042
|
-
|
|
2043
|
-
}),
|
|
2059
|
+
i.indexOf(a) < 0 && s(this.formatLanguageCode(a));
|
|
2060
|
+
}), i;
|
|
2044
2061
|
}
|
|
2045
2062
|
}
|
|
2046
|
-
const
|
|
2063
|
+
const _e = {
|
|
2047
2064
|
zero: 0,
|
|
2048
2065
|
one: 1,
|
|
2049
2066
|
two: 2,
|
|
2050
2067
|
few: 3,
|
|
2051
2068
|
many: 4,
|
|
2052
2069
|
other: 5
|
|
2053
|
-
},
|
|
2054
|
-
select: (
|
|
2070
|
+
}, We = {
|
|
2071
|
+
select: (r) => r === 1 ? "one" : "other",
|
|
2055
2072
|
resolvedOptions: () => ({
|
|
2056
2073
|
pluralCategories: ["one", "other"]
|
|
2057
2074
|
})
|
|
2058
2075
|
};
|
|
2059
|
-
class
|
|
2076
|
+
class fi {
|
|
2060
2077
|
constructor(e, t = {}) {
|
|
2061
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
2078
|
+
this.languageUtils = e, this.options = t, this.logger = F.create("pluralResolver"), this.pluralRulesCache = {};
|
|
2062
2079
|
}
|
|
2063
2080
|
addRule(e, t) {
|
|
2064
2081
|
this.rules[e] = t;
|
|
@@ -2067,21 +2084,21 @@ class yr {
|
|
|
2067
2084
|
this.pluralRulesCache = {};
|
|
2068
2085
|
}
|
|
2069
2086
|
getRule(e, t = {}) {
|
|
2070
|
-
const n =
|
|
2087
|
+
const n = te(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", s = JSON.stringify({
|
|
2071
2088
|
cleanedCode: n,
|
|
2072
|
-
type:
|
|
2089
|
+
type: i
|
|
2073
2090
|
});
|
|
2074
2091
|
if (s in this.pluralRulesCache)
|
|
2075
2092
|
return this.pluralRulesCache[s];
|
|
2076
2093
|
let a;
|
|
2077
2094
|
try {
|
|
2078
2095
|
a = new Intl.PluralRules(n, {
|
|
2079
|
-
type:
|
|
2096
|
+
type: i
|
|
2080
2097
|
});
|
|
2081
2098
|
} catch {
|
|
2082
2099
|
if (!Intl)
|
|
2083
|
-
return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
2084
|
-
if (!e.match(/-|_/)) return
|
|
2100
|
+
return this.logger.error("No Intl support, please use an Intl polyfill!"), We;
|
|
2101
|
+
if (!e.match(/-|_/)) return We;
|
|
2085
2102
|
const c = this.languageUtils.getLanguagePartFromCode(e);
|
|
2086
2103
|
a = this.getRule(c, t);
|
|
2087
2104
|
}
|
|
@@ -2089,28 +2106,27 @@ class yr {
|
|
|
2089
2106
|
}
|
|
2090
2107
|
needsPlural(e, t = {}) {
|
|
2091
2108
|
let n = this.getRule(e, t);
|
|
2092
|
-
return n || (n = this.getRule("dev", t)),
|
|
2109
|
+
return n || (n = this.getRule("dev", t)), n?.resolvedOptions().pluralCategories.length > 1;
|
|
2093
2110
|
}
|
|
2094
2111
|
getPluralFormsOfKey(e, t, n = {}) {
|
|
2095
|
-
return this.getSuffixes(e, n).map((
|
|
2112
|
+
return this.getSuffixes(e, n).map((i) => `${t}${i}`);
|
|
2096
2113
|
}
|
|
2097
2114
|
getSuffixes(e, t = {}) {
|
|
2098
2115
|
let n = this.getRule(e, t);
|
|
2099
|
-
return n || (n = this.getRule("dev", t)), n ? n.resolvedOptions().pluralCategories.sort((
|
|
2116
|
+
return n || (n = this.getRule("dev", t)), n ? n.resolvedOptions().pluralCategories.sort((i, s) => _e[i] - _e[s]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
|
|
2100
2117
|
}
|
|
2101
2118
|
getSuffix(e, t, n = {}) {
|
|
2102
|
-
const
|
|
2103
|
-
return
|
|
2119
|
+
const i = this.getRule(e, n);
|
|
2120
|
+
return i ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
2104
2121
|
}
|
|
2105
2122
|
}
|
|
2106
|
-
const
|
|
2107
|
-
let s =
|
|
2108
|
-
return !s &&
|
|
2109
|
-
},
|
|
2110
|
-
class
|
|
2123
|
+
const Ze = (r, e, t, n = ".", i = !0) => {
|
|
2124
|
+
let s = ii(r, e, t);
|
|
2125
|
+
return !s && i && x(t) && (s = be(r, t, n), s === void 0 && (s = be(e, t, n))), s;
|
|
2126
|
+
}, ge = (r) => r.replace(/\$/g, "$$$$");
|
|
2127
|
+
class gi {
|
|
2111
2128
|
constructor(e = {}) {
|
|
2112
|
-
|
|
2113
|
-
this.logger = A.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((n) => n), this.init(e);
|
|
2129
|
+
this.logger = F.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((t) => t), this.init(e);
|
|
2114
2130
|
}
|
|
2115
2131
|
init(e = {}) {
|
|
2116
2132
|
e.interpolation || (e.interpolation = {
|
|
@@ -2119,7 +2135,7 @@ class xr {
|
|
|
2119
2135
|
const {
|
|
2120
2136
|
escape: t,
|
|
2121
2137
|
escapeValue: n,
|
|
2122
|
-
useRawValueToEscape:
|
|
2138
|
+
useRawValueToEscape: i,
|
|
2123
2139
|
prefix: s,
|
|
2124
2140
|
prefixEscaped: a,
|
|
2125
2141
|
suffix: o,
|
|
@@ -2129,79 +2145,78 @@ class xr {
|
|
|
2129
2145
|
unescapePrefix: u,
|
|
2130
2146
|
nestingPrefix: h,
|
|
2131
2147
|
nestingPrefixEscaped: f,
|
|
2132
|
-
nestingSuffix:
|
|
2148
|
+
nestingSuffix: p,
|
|
2133
2149
|
nestingSuffixEscaped: y,
|
|
2134
2150
|
nestingOptionsSeparator: b,
|
|
2135
2151
|
maxReplaces: v,
|
|
2136
|
-
alwaysFormat:
|
|
2152
|
+
alwaysFormat: w
|
|
2137
2153
|
} = e.interpolation;
|
|
2138
|
-
this.escape = t !== void 0 ? t :
|
|
2154
|
+
this.escape = t !== void 0 ? t : si, this.escapeValue = n !== void 0 ? n : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? z(s) : a || "{{", this.suffix = o ? z(o) : c || "}}", this.formatSeparator = l || ",", this.unescapePrefix = d ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : d || "", this.nestingPrefix = h ? z(h) : f || z("$t("), this.nestingSuffix = p ? z(p) : y || z(")"), this.nestingOptionsSeparator = b || ",", this.maxReplaces = v || 1e3, this.alwaysFormat = w !== void 0 ? w : !1, this.resetRegExp();
|
|
2139
2155
|
}
|
|
2140
2156
|
reset() {
|
|
2141
2157
|
this.options && this.init(this.options);
|
|
2142
2158
|
}
|
|
2143
2159
|
resetRegExp() {
|
|
2144
|
-
const e = (t, n) =>
|
|
2160
|
+
const e = (t, n) => t?.source === n ? (t.lastIndex = 0, t) : new RegExp(n, "g");
|
|
2145
2161
|
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}`);
|
|
2146
2162
|
}
|
|
2147
|
-
interpolate(e, t, n,
|
|
2148
|
-
var f;
|
|
2163
|
+
interpolate(e, t, n, i) {
|
|
2149
2164
|
let s, a, o;
|
|
2150
|
-
const c = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, l = (
|
|
2151
|
-
if (
|
|
2152
|
-
const
|
|
2153
|
-
return this.alwaysFormat ? this.format(
|
|
2154
|
-
...
|
|
2165
|
+
const c = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, l = (f) => {
|
|
2166
|
+
if (f.indexOf(this.formatSeparator) < 0) {
|
|
2167
|
+
const v = Ze(t, c, f, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
2168
|
+
return this.alwaysFormat ? this.format(v, void 0, n, {
|
|
2169
|
+
...i,
|
|
2155
2170
|
...t,
|
|
2156
|
-
interpolationkey:
|
|
2157
|
-
}) :
|
|
2171
|
+
interpolationkey: f
|
|
2172
|
+
}) : v;
|
|
2158
2173
|
}
|
|
2159
|
-
const
|
|
2160
|
-
return this.format(
|
|
2161
|
-
...
|
|
2174
|
+
const p = f.split(this.formatSeparator), y = p.shift().trim(), b = p.join(this.formatSeparator).trim();
|
|
2175
|
+
return this.format(Ze(t, c, y, this.options.keySeparator, this.options.ignoreJSONStructure), b, n, {
|
|
2176
|
+
...i,
|
|
2162
2177
|
...t,
|
|
2163
|
-
interpolationkey:
|
|
2178
|
+
interpolationkey: y
|
|
2164
2179
|
});
|
|
2165
2180
|
};
|
|
2166
2181
|
this.resetRegExp();
|
|
2167
|
-
const d =
|
|
2182
|
+
const d = i?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = i?.interpolation?.skipOnVariables !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
2168
2183
|
return [{
|
|
2169
2184
|
regex: this.regexpUnescape,
|
|
2170
|
-
safeValue: (
|
|
2185
|
+
safeValue: (f) => ge(f)
|
|
2171
2186
|
}, {
|
|
2172
2187
|
regex: this.regexp,
|
|
2173
|
-
safeValue: (
|
|
2174
|
-
}].forEach((
|
|
2175
|
-
for (o = 0; s =
|
|
2176
|
-
const
|
|
2177
|
-
if (a = l(
|
|
2188
|
+
safeValue: (f) => this.escapeValue ? ge(this.escape(f)) : ge(f)
|
|
2189
|
+
}].forEach((f) => {
|
|
2190
|
+
for (o = 0; s = f.regex.exec(e); ) {
|
|
2191
|
+
const p = s[1].trim();
|
|
2192
|
+
if (a = l(p), a === void 0)
|
|
2178
2193
|
if (typeof d == "function") {
|
|
2179
|
-
const
|
|
2180
|
-
a = x(
|
|
2181
|
-
} else if (
|
|
2194
|
+
const b = d(e, s, i);
|
|
2195
|
+
a = x(b) ? b : "";
|
|
2196
|
+
} else if (i && Object.prototype.hasOwnProperty.call(i, p))
|
|
2182
2197
|
a = "";
|
|
2183
2198
|
else if (u) {
|
|
2184
2199
|
a = s[0];
|
|
2185
2200
|
continue;
|
|
2186
2201
|
} else
|
|
2187
|
-
this.logger.warn(`missed to pass in variable ${
|
|
2188
|
-
else !x(a) && !this.useRawValueToEscape && (a =
|
|
2189
|
-
const
|
|
2190
|
-
if (e = e.replace(s[0],
|
|
2202
|
+
this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), a = "";
|
|
2203
|
+
else !x(a) && !this.useRawValueToEscape && (a = Ie(a));
|
|
2204
|
+
const y = f.safeValue(a);
|
|
2205
|
+
if (e = e.replace(s[0], y), u ? (f.regex.lastIndex += a.length, f.regex.lastIndex -= s[0].length) : f.regex.lastIndex = 0, o++, o >= this.maxReplaces)
|
|
2191
2206
|
break;
|
|
2192
2207
|
}
|
|
2193
2208
|
}), e;
|
|
2194
2209
|
}
|
|
2195
2210
|
nest(e, t, n = {}) {
|
|
2196
|
-
let
|
|
2211
|
+
let i, s, a;
|
|
2197
2212
|
const o = (c, l) => {
|
|
2198
2213
|
const d = this.nestingOptionsSeparator;
|
|
2199
2214
|
if (c.indexOf(d) < 0) return c;
|
|
2200
2215
|
const u = c.split(new RegExp(`${d}[ ]*{`));
|
|
2201
2216
|
let h = `{${u[1]}`;
|
|
2202
2217
|
c = u[0], h = this.interpolate(h, a);
|
|
2203
|
-
const f = h.match(/'/g),
|
|
2204
|
-
((
|
|
2218
|
+
const f = h.match(/'/g), p = h.match(/"/g);
|
|
2219
|
+
((f?.length ?? 0) % 2 === 0 && !p || p.length % 2 !== 0) && (h = h.replace(/'/g, '"'));
|
|
2205
2220
|
try {
|
|
2206
2221
|
a = JSON.parse(h), l && (a = {
|
|
2207
2222
|
...l,
|
|
@@ -2212,29 +2227,29 @@ class xr {
|
|
|
2212
2227
|
}
|
|
2213
2228
|
return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, c;
|
|
2214
2229
|
};
|
|
2215
|
-
for (;
|
|
2230
|
+
for (; i = this.nestingRegexp.exec(e); ) {
|
|
2216
2231
|
let c = [];
|
|
2217
2232
|
a = {
|
|
2218
2233
|
...n
|
|
2219
2234
|
}, a = a.replace && !x(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
2220
|
-
const l = /{.*}/.test(
|
|
2221
|
-
if (l !== -1 && (c =
|
|
2222
|
-
x(s) || (s =
|
|
2235
|
+
const l = /{.*}/.test(i[1]) ? i[1].lastIndexOf("}") + 1 : i[1].indexOf(this.formatSeparator);
|
|
2236
|
+
if (l !== -1 && (c = i[1].slice(l).split(this.formatSeparator).map((d) => d.trim()).filter(Boolean), i[1] = i[1].slice(0, l)), s = t(o.call(this, i[1].trim(), a), a), s && i[0] === e && !x(s)) return s;
|
|
2237
|
+
x(s) || (s = Ie(s)), s || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), s = ""), c.length && (s = c.reduce((d, u) => this.format(d, u, n.lng, {
|
|
2223
2238
|
...n,
|
|
2224
|
-
interpolationkey:
|
|
2225
|
-
}), s.trim())), e = e.replace(
|
|
2239
|
+
interpolationkey: i[1].trim()
|
|
2240
|
+
}), s.trim())), e = e.replace(i[0], s), this.regexp.lastIndex = 0;
|
|
2226
2241
|
}
|
|
2227
2242
|
return e;
|
|
2228
2243
|
}
|
|
2229
2244
|
}
|
|
2230
|
-
const
|
|
2231
|
-
let e =
|
|
2245
|
+
const pi = (r) => {
|
|
2246
|
+
let e = r.toLowerCase().trim();
|
|
2232
2247
|
const t = {};
|
|
2233
|
-
if (
|
|
2234
|
-
const n =
|
|
2248
|
+
if (r.indexOf("(") > -1) {
|
|
2249
|
+
const n = r.split("(");
|
|
2235
2250
|
e = n[0].toLowerCase().trim();
|
|
2236
|
-
const
|
|
2237
|
-
e === "currency" &&
|
|
2251
|
+
const i = n[1].substring(0, n[1].length - 1);
|
|
2252
|
+
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) => {
|
|
2238
2253
|
if (a) {
|
|
2239
2254
|
const [o, ...c] = a.split(":"), l = c.join(":").trim().replace(/^'+|'+$/g, ""), d = o.trim();
|
|
2240
2255
|
t[d] || (t[d] = l), l === "false" && (t[d] = !1), l === "true" && (t[d] = !0), isNaN(l) || (t[d] = parseInt(l, 10));
|
|
@@ -2245,56 +2260,56 @@ const br = (i) => {
|
|
|
2245
2260
|
formatName: e,
|
|
2246
2261
|
formatOptions: t
|
|
2247
2262
|
};
|
|
2248
|
-
},
|
|
2263
|
+
}, Je = (r) => {
|
|
2249
2264
|
const e = {};
|
|
2250
|
-
return (t, n,
|
|
2251
|
-
let s =
|
|
2252
|
-
|
|
2265
|
+
return (t, n, i) => {
|
|
2266
|
+
let s = i;
|
|
2267
|
+
i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (s = {
|
|
2253
2268
|
...s,
|
|
2254
|
-
[
|
|
2269
|
+
[i.interpolationkey]: void 0
|
|
2255
2270
|
});
|
|
2256
2271
|
const a = n + JSON.stringify(s);
|
|
2257
2272
|
let o = e[a];
|
|
2258
|
-
return o || (o =
|
|
2273
|
+
return o || (o = r(te(n), i), e[a] = o), o(t);
|
|
2259
2274
|
};
|
|
2260
|
-
},
|
|
2261
|
-
class
|
|
2275
|
+
}, mi = (r) => (e, t, n) => r(te(t), n)(e);
|
|
2276
|
+
class yi {
|
|
2262
2277
|
constructor(e = {}) {
|
|
2263
|
-
this.logger =
|
|
2278
|
+
this.logger = F.create("formatter"), this.options = e, this.init(e);
|
|
2264
2279
|
}
|
|
2265
2280
|
init(e, t = {
|
|
2266
2281
|
interpolation: {}
|
|
2267
2282
|
}) {
|
|
2268
2283
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
2269
|
-
const n = t.cacheInBuiltFormats ?
|
|
2284
|
+
const n = t.cacheInBuiltFormats ? Je : mi;
|
|
2270
2285
|
this.formats = {
|
|
2271
|
-
number: n((
|
|
2272
|
-
const a = new Intl.NumberFormat(
|
|
2286
|
+
number: n((i, s) => {
|
|
2287
|
+
const a = new Intl.NumberFormat(i, {
|
|
2273
2288
|
...s
|
|
2274
2289
|
});
|
|
2275
2290
|
return (o) => a.format(o);
|
|
2276
2291
|
}),
|
|
2277
|
-
currency: n((
|
|
2278
|
-
const a = new Intl.NumberFormat(
|
|
2292
|
+
currency: n((i, s) => {
|
|
2293
|
+
const a = new Intl.NumberFormat(i, {
|
|
2279
2294
|
...s,
|
|
2280
2295
|
style: "currency"
|
|
2281
2296
|
});
|
|
2282
2297
|
return (o) => a.format(o);
|
|
2283
2298
|
}),
|
|
2284
|
-
datetime: n((
|
|
2285
|
-
const a = new Intl.DateTimeFormat(
|
|
2299
|
+
datetime: n((i, s) => {
|
|
2300
|
+
const a = new Intl.DateTimeFormat(i, {
|
|
2286
2301
|
...s
|
|
2287
2302
|
});
|
|
2288
2303
|
return (o) => a.format(o);
|
|
2289
2304
|
}),
|
|
2290
|
-
relativetime: n((
|
|
2291
|
-
const a = new Intl.RelativeTimeFormat(
|
|
2305
|
+
relativetime: n((i, s) => {
|
|
2306
|
+
const a = new Intl.RelativeTimeFormat(i, {
|
|
2292
2307
|
...s
|
|
2293
2308
|
});
|
|
2294
2309
|
return (o) => a.format(o, s.range || "day");
|
|
2295
2310
|
}),
|
|
2296
|
-
list: n((
|
|
2297
|
-
const a = new Intl.ListFormat(
|
|
2311
|
+
list: n((i, s) => {
|
|
2312
|
+
const a = new Intl.ListFormat(i, {
|
|
2298
2313
|
...s
|
|
2299
2314
|
});
|
|
2300
2315
|
return (o) => a.format(o);
|
|
@@ -2305,48 +2320,46 @@ class vr {
|
|
|
2305
2320
|
this.formats[e.toLowerCase().trim()] = t;
|
|
2306
2321
|
}
|
|
2307
2322
|
addCached(e, t) {
|
|
2308
|
-
this.formats[e.toLowerCase().trim()] =
|
|
2323
|
+
this.formats[e.toLowerCase().trim()] = Je(t);
|
|
2309
2324
|
}
|
|
2310
|
-
format(e, t, n,
|
|
2325
|
+
format(e, t, n, i = {}) {
|
|
2311
2326
|
const s = t.split(this.formatSeparator);
|
|
2312
2327
|
if (s.length > 1 && s[0].indexOf("(") > 1 && s[0].indexOf(")") < 0 && s.find((o) => o.indexOf(")") > -1)) {
|
|
2313
2328
|
const o = s.findIndex((c) => c.indexOf(")") > -1);
|
|
2314
2329
|
s[0] = [s[0], ...s.splice(1, o)].join(this.formatSeparator);
|
|
2315
2330
|
}
|
|
2316
2331
|
return s.reduce((o, c) => {
|
|
2317
|
-
var u;
|
|
2318
2332
|
const {
|
|
2319
2333
|
formatName: l,
|
|
2320
2334
|
formatOptions: d
|
|
2321
|
-
} =
|
|
2335
|
+
} = pi(c);
|
|
2322
2336
|
if (this.formats[l]) {
|
|
2323
|
-
let
|
|
2337
|
+
let u = o;
|
|
2324
2338
|
try {
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2339
|
+
const h = i?.formatParams?.[i.interpolationkey] || {}, f = h.locale || h.lng || i.locale || i.lng || n;
|
|
2340
|
+
u = this.formats[l](o, f, {
|
|
2327
2341
|
...d,
|
|
2328
|
-
...
|
|
2329
|
-
...
|
|
2342
|
+
...i,
|
|
2343
|
+
...h
|
|
2330
2344
|
});
|
|
2331
|
-
} catch (
|
|
2332
|
-
this.logger.warn(
|
|
2345
|
+
} catch (h) {
|
|
2346
|
+
this.logger.warn(h);
|
|
2333
2347
|
}
|
|
2334
|
-
return
|
|
2348
|
+
return u;
|
|
2335
2349
|
} else
|
|
2336
2350
|
this.logger.warn(`there was no format function for ${l}`);
|
|
2337
2351
|
return o;
|
|
2338
2352
|
}, e);
|
|
2339
2353
|
}
|
|
2340
2354
|
}
|
|
2341
|
-
const
|
|
2342
|
-
|
|
2355
|
+
const xi = (r, e) => {
|
|
2356
|
+
r.pending[e] !== void 0 && (delete r.pending[e], r.pendingCount--);
|
|
2343
2357
|
};
|
|
2344
|
-
class
|
|
2345
|
-
constructor(e, t, n,
|
|
2346
|
-
|
|
2347
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = A.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], (a = (s = this.backend) == null ? void 0 : s.init) == null || a.call(s, n, r.backend, r);
|
|
2358
|
+
class bi extends ue {
|
|
2359
|
+
constructor(e, t, n, i = {}) {
|
|
2360
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = i, this.logger = F.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 = [], this.backend?.init?.(n, i.backend, i);
|
|
2348
2361
|
}
|
|
2349
|
-
queueLoad(e, t, n,
|
|
2362
|
+
queueLoad(e, t, n, i) {
|
|
2350
2363
|
const s = {}, a = {}, o = {}, c = {};
|
|
2351
2364
|
return e.forEach((l) => {
|
|
2352
2365
|
let d = !0;
|
|
@@ -2359,7 +2372,7 @@ class kr extends ge {
|
|
|
2359
2372
|
pendingCount: Object.keys(a).length,
|
|
2360
2373
|
loaded: {},
|
|
2361
2374
|
errors: [],
|
|
2362
|
-
callback:
|
|
2375
|
+
callback: i
|
|
2363
2376
|
}), {
|
|
2364
2377
|
toLoad: Object.keys(s),
|
|
2365
2378
|
pending: Object.keys(a),
|
|
@@ -2368,13 +2381,13 @@ class kr extends ge {
|
|
|
2368
2381
|
};
|
|
2369
2382
|
}
|
|
2370
2383
|
loaded(e, t, n) {
|
|
2371
|
-
const
|
|
2384
|
+
const i = e.split("|"), s = i[0], a = i[1];
|
|
2372
2385
|
t && this.emit("failedLoading", s, a, t), !t && n && this.store.addResourceBundle(s, a, n, void 0, void 0, {
|
|
2373
2386
|
skipCopy: !0
|
|
2374
2387
|
}), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
2375
2388
|
const o = {};
|
|
2376
2389
|
this.queue.forEach((c) => {
|
|
2377
|
-
|
|
2390
|
+
ni(c.loaded, [s], a), xi(c, e), t && c.errors.push(t), c.pendingCount === 0 && !c.done && (Object.keys(c.loaded).forEach((l) => {
|
|
2378
2391
|
o[l] || (o[l] = {});
|
|
2379
2392
|
const d = c.loaded[l];
|
|
2380
2393
|
d.length && d.forEach((u) => {
|
|
@@ -2383,14 +2396,14 @@ class kr extends ge {
|
|
|
2383
2396
|
}), c.done = !0, c.errors.length ? c.callback(c.errors) : c.callback());
|
|
2384
2397
|
}), this.emit("loaded", o), this.queue = this.queue.filter((c) => !c.done);
|
|
2385
2398
|
}
|
|
2386
|
-
read(e, t, n,
|
|
2399
|
+
read(e, t, n, i = 0, s = this.retryTimeout, a) {
|
|
2387
2400
|
if (!e.length) return a(null, {});
|
|
2388
2401
|
if (this.readingCalls >= this.maxParallelReads) {
|
|
2389
2402
|
this.waitingReads.push({
|
|
2390
2403
|
lng: e,
|
|
2391
2404
|
ns: t,
|
|
2392
2405
|
fcName: n,
|
|
2393
|
-
tried:
|
|
2406
|
+
tried: i,
|
|
2394
2407
|
wait: s,
|
|
2395
2408
|
callback: a
|
|
2396
2409
|
});
|
|
@@ -2402,9 +2415,9 @@ class kr extends ge {
|
|
|
2402
2415
|
const u = this.waitingReads.shift();
|
|
2403
2416
|
this.read(u.lng, u.ns, u.fcName, u.tried, u.wait, u.callback);
|
|
2404
2417
|
}
|
|
2405
|
-
if (l && d &&
|
|
2418
|
+
if (l && d && i < this.maxRetries) {
|
|
2406
2419
|
setTimeout(() => {
|
|
2407
|
-
this.read.call(this, e, t, n,
|
|
2420
|
+
this.read.call(this, e, t, n, i + 1, s * 2, a);
|
|
2408
2421
|
}, s);
|
|
2409
2422
|
return;
|
|
2410
2423
|
}
|
|
@@ -2421,13 +2434,13 @@ class kr extends ge {
|
|
|
2421
2434
|
}
|
|
2422
2435
|
return c(e, t, o);
|
|
2423
2436
|
}
|
|
2424
|
-
prepareLoading(e, t, n = {},
|
|
2437
|
+
prepareLoading(e, t, n = {}, i) {
|
|
2425
2438
|
if (!this.backend)
|
|
2426
|
-
return this.logger.warn("No backend was added via i18next.use. Will not load resources."),
|
|
2439
|
+
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
|
|
2427
2440
|
x(e) && (e = this.languageUtils.toResolveHierarchy(e)), x(t) && (t = [t]);
|
|
2428
|
-
const s = this.queueLoad(e, t, n,
|
|
2441
|
+
const s = this.queueLoad(e, t, n, i);
|
|
2429
2442
|
if (!s.toLoad.length)
|
|
2430
|
-
return s.pending.length ||
|
|
2443
|
+
return s.pending.length || i(), null;
|
|
2431
2444
|
s.toLoad.forEach((a) => {
|
|
2432
2445
|
this.loadOne(a);
|
|
2433
2446
|
});
|
|
@@ -2441,35 +2454,34 @@ class kr extends ge {
|
|
|
2441
2454
|
}, n);
|
|
2442
2455
|
}
|
|
2443
2456
|
loadOne(e, t = "") {
|
|
2444
|
-
const n = e.split("|"),
|
|
2445
|
-
this.read(
|
|
2446
|
-
a && this.logger.warn(`${t}loading namespace ${s} for language ${
|
|
2457
|
+
const n = e.split("|"), i = n[0], s = n[1];
|
|
2458
|
+
this.read(i, s, "read", void 0, void 0, (a, o) => {
|
|
2459
|
+
a && this.logger.warn(`${t}loading namespace ${s} for language ${i} failed`, a), !a && o && this.logger.log(`${t}loaded namespace ${s} for language ${i}`, o), this.loaded(e, a, o);
|
|
2447
2460
|
});
|
|
2448
2461
|
}
|
|
2449
|
-
saveMissing(e, t, n,
|
|
2462
|
+
saveMissing(e, t, n, i, s, a = {}, o = () => {
|
|
2450
2463
|
}) {
|
|
2451
|
-
|
|
2452
|
-
if ((l = (c = this.services) == null ? void 0 : c.utils) != null && l.hasLoadedNamespace && !((u = (d = this.services) == null ? void 0 : d.utils) != null && u.hasLoadedNamespace(t))) {
|
|
2464
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
|
|
2453
2465
|
this.logger.warn(`did not save key "${n}" 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!!!");
|
|
2454
2466
|
return;
|
|
2455
2467
|
}
|
|
2456
2468
|
if (!(n == null || n === "")) {
|
|
2457
|
-
if (
|
|
2458
|
-
const
|
|
2469
|
+
if (this.backend?.create) {
|
|
2470
|
+
const c = {
|
|
2459
2471
|
...a,
|
|
2460
2472
|
isUpdate: s
|
|
2461
|
-
},
|
|
2462
|
-
if (
|
|
2473
|
+
}, l = this.backend.create.bind(this.backend);
|
|
2474
|
+
if (l.length < 6)
|
|
2463
2475
|
try {
|
|
2464
|
-
let
|
|
2465
|
-
|
|
2466
|
-
} catch (
|
|
2467
|
-
o(
|
|
2476
|
+
let d;
|
|
2477
|
+
l.length === 5 ? d = l(e, t, n, i, c) : d = l(e, t, n, i), d && typeof d.then == "function" ? d.then((u) => o(null, u)).catch(o) : o(null, d);
|
|
2478
|
+
} catch (d) {
|
|
2479
|
+
o(d);
|
|
2468
2480
|
}
|
|
2469
2481
|
else
|
|
2470
|
-
|
|
2482
|
+
l(e, t, n, i, o, c);
|
|
2471
2483
|
}
|
|
2472
|
-
!e || !e[0] || this.store.addResource(e[0], t, n,
|
|
2484
|
+
!e || !e[0] || this.store.addResource(e[0], t, n, i);
|
|
2473
2485
|
}
|
|
2474
2486
|
}
|
|
2475
2487
|
}
|
|
@@ -2506,10 +2518,10 @@ const Qe = () => ({
|
|
|
2506
2518
|
parseMissingKeyHandler: !1,
|
|
2507
2519
|
appendNamespaceToMissingKey: !1,
|
|
2508
2520
|
appendNamespaceToCIMode: !1,
|
|
2509
|
-
overloadTranslationOptionHandler: (
|
|
2521
|
+
overloadTranslationOptionHandler: (r) => {
|
|
2510
2522
|
let e = {};
|
|
2511
|
-
if (typeof
|
|
2512
|
-
const t =
|
|
2523
|
+
if (typeof r[1] == "object" && (e = r[1]), x(r[1]) && (e.defaultValue = r[1]), x(r[2]) && (e.tDescription = r[2]), typeof r[2] == "object" || typeof r[3] == "object") {
|
|
2524
|
+
const t = r[3] || r[2];
|
|
2513
2525
|
Object.keys(t).forEach((n) => {
|
|
2514
2526
|
e[n] = t[n];
|
|
2515
2527
|
});
|
|
@@ -2518,7 +2530,7 @@ const Qe = () => ({
|
|
|
2518
2530
|
},
|
|
2519
2531
|
interpolation: {
|
|
2520
2532
|
escapeValue: !0,
|
|
2521
|
-
format: (
|
|
2533
|
+
format: (r) => r,
|
|
2522
2534
|
prefix: "{{",
|
|
2523
2535
|
suffix: "}}",
|
|
2524
2536
|
formatSeparator: ",",
|
|
@@ -2530,20 +2542,17 @@ const Qe = () => ({
|
|
|
2530
2542
|
skipOnVariables: !0
|
|
2531
2543
|
},
|
|
2532
2544
|
cacheInBuiltFormats: !0
|
|
2533
|
-
}),
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
}, Lr = (i) => {
|
|
2538
|
-
Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((t) => {
|
|
2539
|
-
typeof i[t] == "function" && (i[t] = i[t].bind(i));
|
|
2545
|
+
}), Ge = (r) => (x(r.ns) && (r.ns = [r.ns]), x(r.fallbackLng) && (r.fallbackLng = [r.fallbackLng]), x(r.fallbackNS) && (r.fallbackNS = [r.fallbackNS]), r.supportedLngs?.indexOf?.("cimode") < 0 && (r.supportedLngs = r.supportedLngs.concat(["cimode"])), typeof r.initImmediate == "boolean" && (r.initAsync = r.initImmediate), r), se = () => {
|
|
2546
|
+
}, wi = (r) => {
|
|
2547
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((t) => {
|
|
2548
|
+
typeof r[t] == "function" && (r[t] = r[t].bind(r));
|
|
2540
2549
|
});
|
|
2541
2550
|
};
|
|
2542
|
-
class
|
|
2551
|
+
class ne extends ue {
|
|
2543
2552
|
constructor(e = {}, t) {
|
|
2544
|
-
if (super(), this.options =
|
|
2553
|
+
if (super(), this.options = Ge(e), this.services = {}, this.logger = F, this.modules = {
|
|
2545
2554
|
external: []
|
|
2546
|
-
},
|
|
2555
|
+
}, wi(this), t && !this.isInitialized && !e.isClone) {
|
|
2547
2556
|
if (!this.options.initAsync)
|
|
2548
2557
|
return this.init(e, t), this;
|
|
2549
2558
|
setTimeout(() => {
|
|
@@ -2557,33 +2566,33 @@ class se extends ge {
|
|
|
2557
2566
|
this.options = {
|
|
2558
2567
|
...n,
|
|
2559
2568
|
...this.options,
|
|
2560
|
-
...
|
|
2569
|
+
...Ge(e)
|
|
2561
2570
|
}, this.options.interpolation = {
|
|
2562
2571
|
...n.interpolation,
|
|
2563
2572
|
...this.options.interpolation
|
|
2564
2573
|
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator);
|
|
2565
|
-
const
|
|
2574
|
+
const i = (l) => l ? typeof l == "function" ? new l() : l : null;
|
|
2566
2575
|
if (!this.options.isClone) {
|
|
2567
|
-
this.modules.logger ?
|
|
2576
|
+
this.modules.logger ? F.init(i(this.modules.logger), this.options) : F.init(null, this.options);
|
|
2568
2577
|
let l;
|
|
2569
|
-
this.modules.formatter ? l = this.modules.formatter : l =
|
|
2570
|
-
const d = new
|
|
2571
|
-
this.store = new
|
|
2578
|
+
this.modules.formatter ? l = this.modules.formatter : l = yi;
|
|
2579
|
+
const d = new Ue(this.options);
|
|
2580
|
+
this.store = new Be(this.options.resources, this.options);
|
|
2572
2581
|
const u = this.services;
|
|
2573
|
-
u.logger =
|
|
2582
|
+
u.logger = F, u.resourceStore = this.store, u.languageUtils = d, u.pluralResolver = new fi(d, {
|
|
2574
2583
|
prepend: this.options.pluralSeparator,
|
|
2575
2584
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
2576
|
-
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), l && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (u.formatter =
|
|
2585
|
+
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), l && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (u.formatter = i(l), u.formatter.init && u.formatter.init(u, this.options), this.options.interpolation.format = u.formatter.format.bind(u.formatter)), u.interpolator = new gi(this.options), u.utils = {
|
|
2577
2586
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
2578
|
-
}, u.backendConnector = new
|
|
2579
|
-
this.emit(f, ...
|
|
2580
|
-
}), this.modules.languageDetector && (u.languageDetector =
|
|
2581
|
-
this.emit(f, ...
|
|
2587
|
+
}, u.backendConnector = new bi(i(this.modules.backend), u.resourceStore, u, this.options), u.backendConnector.on("*", (f, ...p) => {
|
|
2588
|
+
this.emit(f, ...p);
|
|
2589
|
+
}), this.modules.languageDetector && (u.languageDetector = i(this.modules.languageDetector), u.languageDetector.init && u.languageDetector.init(u, this.options.detection, this.options)), this.modules.i18nFormat && (u.i18nFormat = i(this.modules.i18nFormat), u.i18nFormat.init && u.i18nFormat.init(this)), this.translator = new ce(this.services, this.options), this.translator.on("*", (f, ...p) => {
|
|
2590
|
+
this.emit(f, ...p);
|
|
2582
2591
|
}), this.modules.external.forEach((f) => {
|
|
2583
2592
|
f.init && f.init(this);
|
|
2584
2593
|
});
|
|
2585
2594
|
}
|
|
2586
|
-
if (this.format = this.options.interpolation.format, t || (t =
|
|
2595
|
+
if (this.format = this.options.interpolation.format, t || (t = se), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
2587
2596
|
const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2588
2597
|
l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
|
|
2589
2598
|
}
|
|
@@ -2592,7 +2601,7 @@ class se extends ge {
|
|
|
2592
2601
|
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((l) => {
|
|
2593
2602
|
this[l] = (...d) => (this.store[l](...d), this);
|
|
2594
2603
|
});
|
|
2595
|
-
const o =
|
|
2604
|
+
const o = Y(), c = () => {
|
|
2596
2605
|
const l = (d, u) => {
|
|
2597
2606
|
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), o.resolve(u), t(d, u);
|
|
2598
2607
|
};
|
|
@@ -2601,34 +2610,33 @@ class se extends ge {
|
|
|
2601
2610
|
};
|
|
2602
2611
|
return this.options.resources || !this.options.initAsync ? c() : setTimeout(c, 0), o;
|
|
2603
2612
|
}
|
|
2604
|
-
loadResources(e, t =
|
|
2605
|
-
var s, a;
|
|
2613
|
+
loadResources(e, t = se) {
|
|
2606
2614
|
let n = t;
|
|
2607
|
-
const
|
|
2615
|
+
const i = x(e) ? e : this.language;
|
|
2608
2616
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
2609
|
-
if (
|
|
2610
|
-
const
|
|
2611
|
-
if (!
|
|
2612
|
-
this.services.languageUtils.toResolveHierarchy(
|
|
2613
|
-
|
|
2617
|
+
if (i?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
2618
|
+
const s = [], a = (o) => {
|
|
2619
|
+
if (!o || o === "cimode") return;
|
|
2620
|
+
this.services.languageUtils.toResolveHierarchy(o).forEach((l) => {
|
|
2621
|
+
l !== "cimode" && s.indexOf(l) < 0 && s.push(l);
|
|
2614
2622
|
});
|
|
2615
2623
|
};
|
|
2616
|
-
|
|
2617
|
-
!
|
|
2624
|
+
i ? a(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((c) => a(c)), this.options.preload?.forEach?.((o) => a(o)), this.services.backendConnector.load(s, this.options.ns, (o) => {
|
|
2625
|
+
!o && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(o);
|
|
2618
2626
|
});
|
|
2619
2627
|
} else
|
|
2620
2628
|
n(null);
|
|
2621
2629
|
}
|
|
2622
2630
|
reloadResources(e, t, n) {
|
|
2623
|
-
const
|
|
2624
|
-
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), n || (n =
|
|
2625
|
-
|
|
2626
|
-
}),
|
|
2631
|
+
const i = Y();
|
|
2632
|
+
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), n || (n = se), this.services.backendConnector.reload(e, t, (s) => {
|
|
2633
|
+
i.resolve(), n(s);
|
|
2634
|
+
}), i;
|
|
2627
2635
|
}
|
|
2628
2636
|
use(e) {
|
|
2629
2637
|
if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
2630
2638
|
if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
2631
|
-
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" &&
|
|
2639
|
+
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" && vt.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
2632
2640
|
}
|
|
2633
2641
|
setResolvedLanguage(e) {
|
|
2634
2642
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
@@ -2644,47 +2652,44 @@ class se extends ge {
|
|
|
2644
2652
|
}
|
|
2645
2653
|
changeLanguage(e, t) {
|
|
2646
2654
|
this.isLanguageChangingTo = e;
|
|
2647
|
-
const n =
|
|
2655
|
+
const n = Y();
|
|
2648
2656
|
this.emit("languageChanging", e);
|
|
2649
|
-
const
|
|
2657
|
+
const i = (o) => {
|
|
2650
2658
|
this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
|
|
2651
2659
|
}, s = (o, c) => {
|
|
2652
|
-
c ? this.isLanguageChangingTo === e && (
|
|
2660
|
+
c ? this.isLanguageChangingTo === e && (i(c), this.translator.changeLanguage(c), this.isLanguageChangingTo = void 0, this.emit("languageChanged", c), this.logger.log("languageChanged", c)) : this.isLanguageChangingTo = void 0, n.resolve((...l) => this.t(...l)), t && t(o, (...l) => this.t(...l));
|
|
2653
2661
|
}, a = (o) => {
|
|
2654
|
-
var d, u;
|
|
2655
2662
|
!e && !o && this.services.languageDetector && (o = []);
|
|
2656
2663
|
const c = x(o) ? o : o && o[0], l = this.store.hasLanguageSomeTranslations(c) ? c : this.services.languageUtils.getBestMatchFromCodes(x(o) ? [o] : o);
|
|
2657
|
-
l && (this.language ||
|
|
2658
|
-
s(
|
|
2664
|
+
l && (this.language || i(l), this.translator.language || this.translator.changeLanguage(l), this.services.languageDetector?.cacheUserLanguage?.(l)), this.loadResources(l, (d) => {
|
|
2665
|
+
s(d, l);
|
|
2659
2666
|
});
|
|
2660
2667
|
};
|
|
2661
2668
|
return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), n;
|
|
2662
2669
|
}
|
|
2663
2670
|
getFixedT(e, t, n) {
|
|
2664
|
-
const
|
|
2671
|
+
const i = (s, a, ...o) => {
|
|
2665
2672
|
let c;
|
|
2666
2673
|
typeof a != "object" ? c = this.options.overloadTranslationOptionHandler([s, a].concat(o)) : c = {
|
|
2667
2674
|
...a
|
|
2668
|
-
}, c.lng = c.lng ||
|
|
2675
|
+
}, c.lng = c.lng || i.lng, c.lngs = c.lngs || i.lngs, c.ns = c.ns || i.ns, c.keyPrefix !== "" && (c.keyPrefix = c.keyPrefix || n || i.keyPrefix);
|
|
2669
2676
|
const l = this.options.keySeparator || ".";
|
|
2670
2677
|
let d;
|
|
2671
|
-
return c.keyPrefix && Array.isArray(s) ? d = s.map((u) => (typeof u == "function" && (u =
|
|
2678
|
+
return c.keyPrefix && Array.isArray(s) ? d = s.map((u) => (typeof u == "function" && (u = ve(u, {
|
|
2672
2679
|
...this.options,
|
|
2673
2680
|
...a
|
|
2674
|
-
})), `${c.keyPrefix}${l}${u}`)) : (typeof s == "function" && (s =
|
|
2681
|
+
})), `${c.keyPrefix}${l}${u}`)) : (typeof s == "function" && (s = ve(s, {
|
|
2675
2682
|
...this.options,
|
|
2676
2683
|
...a
|
|
2677
2684
|
})), d = c.keyPrefix ? `${c.keyPrefix}${l}${s}` : s), this.t(d, c);
|
|
2678
2685
|
};
|
|
2679
|
-
return x(e) ?
|
|
2686
|
+
return x(e) ? i.lng = e : i.lngs = e, i.ns = t, i.keyPrefix = n, i;
|
|
2680
2687
|
}
|
|
2681
2688
|
t(...e) {
|
|
2682
|
-
|
|
2683
|
-
return (t = this.translator) == null ? void 0 : t.translate(...e);
|
|
2689
|
+
return this.translator?.translate(...e);
|
|
2684
2690
|
}
|
|
2685
2691
|
exists(...e) {
|
|
2686
|
-
|
|
2687
|
-
return (t = this.translator) == null ? void 0 : t.exists(...e);
|
|
2692
|
+
return this.translator?.exists(...e);
|
|
2688
2693
|
}
|
|
2689
2694
|
setDefaultNamespace(e) {
|
|
2690
2695
|
this.options.defaultNS = e;
|
|
@@ -2694,7 +2699,7 @@ class se extends ge {
|
|
|
2694
2699
|
return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
2695
2700
|
if (!this.languages || !this.languages.length)
|
|
2696
2701
|
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
2697
|
-
const n = t.lng || this.resolvedLanguage || this.languages[0],
|
|
2702
|
+
const n = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, s = this.languages[this.languages.length - 1];
|
|
2698
2703
|
if (n.toLowerCase() === "cimode") return !0;
|
|
2699
2704
|
const a = (o, c) => {
|
|
2700
2705
|
const l = this.services.backendConnector.state[`${o}|${c}`];
|
|
@@ -2704,49 +2709,48 @@ class se extends ge {
|
|
|
2704
2709
|
const o = t.precheck(this, a);
|
|
2705
2710
|
if (o !== void 0) return o;
|
|
2706
2711
|
}
|
|
2707
|
-
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!
|
|
2712
|
+
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!i || a(s, e)));
|
|
2708
2713
|
}
|
|
2709
2714
|
loadNamespaces(e, t) {
|
|
2710
|
-
const n =
|
|
2711
|
-
return this.options.ns ? (x(e) && (e = [e]), e.forEach((
|
|
2712
|
-
this.options.ns.indexOf(
|
|
2713
|
-
}), this.loadResources((
|
|
2714
|
-
n.resolve(), t && t(
|
|
2715
|
+
const n = Y();
|
|
2716
|
+
return this.options.ns ? (x(e) && (e = [e]), e.forEach((i) => {
|
|
2717
|
+
this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
|
|
2718
|
+
}), this.loadResources((i) => {
|
|
2719
|
+
n.resolve(), t && t(i);
|
|
2715
2720
|
}), n) : (t && t(), Promise.resolve());
|
|
2716
2721
|
}
|
|
2717
2722
|
loadLanguages(e, t) {
|
|
2718
|
-
const n =
|
|
2723
|
+
const n = Y();
|
|
2719
2724
|
x(e) && (e = [e]);
|
|
2720
|
-
const
|
|
2721
|
-
return s.length ? (this.options.preload =
|
|
2725
|
+
const i = this.options.preload || [], s = e.filter((a) => i.indexOf(a) < 0 && this.services.languageUtils.isSupportedCode(a));
|
|
2726
|
+
return s.length ? (this.options.preload = i.concat(s), this.loadResources((a) => {
|
|
2722
2727
|
n.resolve(), t && t(a);
|
|
2723
2728
|
}), n) : (t && t(), Promise.resolve());
|
|
2724
2729
|
}
|
|
2725
2730
|
dir(e) {
|
|
2726
|
-
|
|
2727
|
-
if (e || (e = this.resolvedLanguage || (((r = this.languages) == null ? void 0 : r.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
|
|
2731
|
+
if (e || (e = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language)), !e) return "rtl";
|
|
2728
2732
|
try {
|
|
2729
|
-
const
|
|
2730
|
-
if (
|
|
2731
|
-
const
|
|
2732
|
-
if (
|
|
2733
|
+
const i = new Intl.Locale(e);
|
|
2734
|
+
if (i && i.getTextInfo) {
|
|
2735
|
+
const s = i.getTextInfo();
|
|
2736
|
+
if (s && s.direction) return s.direction;
|
|
2733
2737
|
}
|
|
2734
2738
|
} catch {
|
|
2735
2739
|
}
|
|
2736
|
-
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"], n =
|
|
2740
|
+
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"], n = this.services?.languageUtils || new Ue(Qe());
|
|
2737
2741
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
2738
2742
|
}
|
|
2739
2743
|
static createInstance(e = {}, t) {
|
|
2740
|
-
return new
|
|
2744
|
+
return new ne(e, t);
|
|
2741
2745
|
}
|
|
2742
|
-
cloneInstance(e = {}, t =
|
|
2746
|
+
cloneInstance(e = {}, t = se) {
|
|
2743
2747
|
const n = e.forkResourceStore;
|
|
2744
2748
|
n && delete e.forkResourceStore;
|
|
2745
|
-
const
|
|
2749
|
+
const i = {
|
|
2746
2750
|
...this.options,
|
|
2747
2751
|
...e,
|
|
2748
2752
|
isClone: !0
|
|
2749
|
-
}, s = new
|
|
2753
|
+
}, s = new ne(i);
|
|
2750
2754
|
if ((e.debug !== void 0 || e.prefix !== void 0) && (s.logger = s.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
|
|
2751
2755
|
s[o] = this[o];
|
|
2752
2756
|
}), s.services = {
|
|
@@ -2759,11 +2763,11 @@ class se extends ge {
|
|
|
2759
2763
|
}, c[l] = Object.keys(c[l]).reduce((d, u) => (d[u] = {
|
|
2760
2764
|
...c[l][u]
|
|
2761
2765
|
}, d), c[l]), c), {});
|
|
2762
|
-
s.store = new
|
|
2766
|
+
s.store = new Be(o, i), s.services.resourceStore = s.store;
|
|
2763
2767
|
}
|
|
2764
|
-
return s.translator = new
|
|
2768
|
+
return s.translator = new ce(s.services, i), s.translator.on("*", (o, ...c) => {
|
|
2765
2769
|
s.emit(o, ...c);
|
|
2766
|
-
}), s.init(
|
|
2770
|
+
}), s.init(i, t), s.translator.options = i, s.translator.backendConnector.services.utils = {
|
|
2767
2771
|
hasLoadedNamespace: s.hasLoadedNamespace.bind(s)
|
|
2768
2772
|
}, s;
|
|
2769
2773
|
}
|
|
@@ -2777,53 +2781,53 @@ class se extends ge {
|
|
|
2777
2781
|
};
|
|
2778
2782
|
}
|
|
2779
2783
|
}
|
|
2780
|
-
const
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2784
|
+
const O = ne.createInstance();
|
|
2785
|
+
O.createInstance = ne.createInstance;
|
|
2786
|
+
O.createInstance;
|
|
2787
|
+
O.dir;
|
|
2788
|
+
O.init;
|
|
2789
|
+
O.loadResources;
|
|
2790
|
+
O.reloadResources;
|
|
2791
|
+
O.use;
|
|
2792
|
+
O.changeLanguage;
|
|
2793
|
+
O.getFixedT;
|
|
2794
|
+
O.t;
|
|
2795
|
+
O.exists;
|
|
2796
|
+
O.setDefaultNamespace;
|
|
2797
|
+
O.hasLoadedNamespace;
|
|
2798
|
+
O.loadNamespaces;
|
|
2799
|
+
O.loadLanguages;
|
|
2796
2800
|
const {
|
|
2797
|
-
slice:
|
|
2798
|
-
forEach:
|
|
2801
|
+
slice: vi,
|
|
2802
|
+
forEach: Si
|
|
2799
2803
|
} = [];
|
|
2800
|
-
function
|
|
2801
|
-
return
|
|
2804
|
+
function ki(r) {
|
|
2805
|
+
return Si.call(vi.call(arguments, 1), (e) => {
|
|
2802
2806
|
if (e)
|
|
2803
2807
|
for (const t in e)
|
|
2804
|
-
|
|
2805
|
-
}),
|
|
2808
|
+
r[t] === void 0 && (r[t] = e[t]);
|
|
2809
|
+
}), r;
|
|
2806
2810
|
}
|
|
2807
|
-
function
|
|
2808
|
-
return typeof
|
|
2811
|
+
function Li(r) {
|
|
2812
|
+
return typeof r != "string" ? !1 : [/<\s*script.*?>/i, /<\s*\/\s*script\s*>/i, /<\s*img.*?on\w+\s*=/i, /<\s*\w+\s*on\w+\s*=.*?>/i, /javascript\s*:/i, /vbscript\s*:/i, /expression\s*\(/i, /eval\s*\(/i, /alert\s*\(/i, /document\.cookie/i, /document\.write\s*\(/i, /window\.location/i, /innerHTML/i].some((t) => t.test(r));
|
|
2809
2813
|
}
|
|
2810
|
-
const
|
|
2814
|
+
const Ye = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Ei = function(r, e) {
|
|
2811
2815
|
const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
2812
2816
|
path: "/"
|
|
2813
|
-
},
|
|
2814
|
-
let s = `${
|
|
2817
|
+
}, i = encodeURIComponent(e);
|
|
2818
|
+
let s = `${r}=${i}`;
|
|
2815
2819
|
if (n.maxAge > 0) {
|
|
2816
2820
|
const a = n.maxAge - 0;
|
|
2817
2821
|
if (Number.isNaN(a)) throw new Error("maxAge should be a Number");
|
|
2818
2822
|
s += `; Max-Age=${Math.floor(a)}`;
|
|
2819
2823
|
}
|
|
2820
2824
|
if (n.domain) {
|
|
2821
|
-
if (!
|
|
2825
|
+
if (!Ye.test(n.domain))
|
|
2822
2826
|
throw new TypeError("option domain is invalid");
|
|
2823
2827
|
s += `; Domain=${n.domain}`;
|
|
2824
2828
|
}
|
|
2825
2829
|
if (n.path) {
|
|
2826
|
-
if (!
|
|
2830
|
+
if (!Ye.test(n.path))
|
|
2827
2831
|
throw new TypeError("option path is invalid");
|
|
2828
2832
|
s += `; Path=${n.path}`;
|
|
2829
2833
|
}
|
|
@@ -2850,219 +2854,215 @@ const tt = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Nr = function(i, e) {
|
|
|
2850
2854
|
throw new TypeError("option sameSite is invalid");
|
|
2851
2855
|
}
|
|
2852
2856
|
return n.partitioned && (s += "; Partitioned"), s;
|
|
2853
|
-
},
|
|
2854
|
-
create(
|
|
2855
|
-
let
|
|
2857
|
+
}, Xe = {
|
|
2858
|
+
create(r, e, t, n) {
|
|
2859
|
+
let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
2856
2860
|
path: "/",
|
|
2857
2861
|
sameSite: "strict"
|
|
2858
2862
|
};
|
|
2859
|
-
t && (
|
|
2863
|
+
t && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + t * 60 * 1e3)), n && (i.domain = n), document.cookie = Ei(r, e, i);
|
|
2860
2864
|
},
|
|
2861
|
-
read(
|
|
2862
|
-
const e = `${
|
|
2865
|
+
read(r) {
|
|
2866
|
+
const e = `${r}=`, t = document.cookie.split(";");
|
|
2863
2867
|
for (let n = 0; n < t.length; n++) {
|
|
2864
|
-
let
|
|
2865
|
-
for (;
|
|
2866
|
-
if (
|
|
2868
|
+
let i = t[n];
|
|
2869
|
+
for (; i.charAt(0) === " "; ) i = i.substring(1, i.length);
|
|
2870
|
+
if (i.indexOf(e) === 0) return i.substring(e.length, i.length);
|
|
2867
2871
|
}
|
|
2868
2872
|
return null;
|
|
2869
2873
|
},
|
|
2870
|
-
remove(
|
|
2871
|
-
this.create(
|
|
2874
|
+
remove(r, e) {
|
|
2875
|
+
this.create(r, "", -1, e);
|
|
2872
2876
|
}
|
|
2873
2877
|
};
|
|
2874
|
-
var
|
|
2878
|
+
var Pi = {
|
|
2875
2879
|
name: "cookie",
|
|
2876
2880
|
// Deconstruct the options object and extract the lookupCookie property
|
|
2877
|
-
lookup(
|
|
2881
|
+
lookup(r) {
|
|
2878
2882
|
let {
|
|
2879
2883
|
lookupCookie: e
|
|
2880
|
-
} =
|
|
2884
|
+
} = r;
|
|
2881
2885
|
if (e && typeof document < "u")
|
|
2882
|
-
return
|
|
2886
|
+
return Xe.read(e) || void 0;
|
|
2883
2887
|
},
|
|
2884
2888
|
// Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties
|
|
2885
|
-
cacheUserLanguage(
|
|
2889
|
+
cacheUserLanguage(r, e) {
|
|
2886
2890
|
let {
|
|
2887
2891
|
lookupCookie: t,
|
|
2888
2892
|
cookieMinutes: n,
|
|
2889
|
-
cookieDomain:
|
|
2893
|
+
cookieDomain: i,
|
|
2890
2894
|
cookieOptions: s
|
|
2891
2895
|
} = e;
|
|
2892
|
-
t && typeof document < "u" &&
|
|
2896
|
+
t && typeof document < "u" && Xe.create(t, r, n, i, s);
|
|
2893
2897
|
}
|
|
2894
|
-
},
|
|
2898
|
+
}, Oi = {
|
|
2895
2899
|
name: "querystring",
|
|
2896
2900
|
// Deconstruct the options object and extract the lookupQuerystring property
|
|
2897
|
-
lookup(
|
|
2898
|
-
var n;
|
|
2901
|
+
lookup(r) {
|
|
2899
2902
|
let {
|
|
2900
2903
|
lookupQuerystring: e
|
|
2901
|
-
} =
|
|
2904
|
+
} = r, t;
|
|
2902
2905
|
if (typeof window < "u") {
|
|
2903
2906
|
let {
|
|
2904
|
-
search:
|
|
2907
|
+
search: n
|
|
2905
2908
|
} = window.location;
|
|
2906
|
-
!window.location.search &&
|
|
2907
|
-
const
|
|
2908
|
-
for (let
|
|
2909
|
-
const
|
|
2910
|
-
|
|
2909
|
+
!window.location.search && window.location.hash?.indexOf("?") > -1 && (n = window.location.hash.substring(window.location.hash.indexOf("?")));
|
|
2910
|
+
const s = n.substring(1).split("&");
|
|
2911
|
+
for (let a = 0; a < s.length; a++) {
|
|
2912
|
+
const o = s[a].indexOf("=");
|
|
2913
|
+
o > 0 && s[a].substring(0, o) === e && (t = s[a].substring(o + 1));
|
|
2911
2914
|
}
|
|
2912
2915
|
}
|
|
2913
2916
|
return t;
|
|
2914
2917
|
}
|
|
2915
|
-
},
|
|
2918
|
+
}, Ni = {
|
|
2916
2919
|
name: "hash",
|
|
2917
2920
|
// Deconstruct the options object and extract the lookupHash property and the lookupFromHashIndex property
|
|
2918
|
-
lookup(
|
|
2919
|
-
var r;
|
|
2921
|
+
lookup(r) {
|
|
2920
2922
|
let {
|
|
2921
2923
|
lookupHash: e,
|
|
2922
2924
|
lookupFromHashIndex: t
|
|
2923
|
-
} =
|
|
2925
|
+
} = r, n;
|
|
2924
2926
|
if (typeof window < "u") {
|
|
2925
2927
|
const {
|
|
2926
|
-
hash:
|
|
2928
|
+
hash: i
|
|
2927
2929
|
} = window.location;
|
|
2928
|
-
if (
|
|
2929
|
-
const
|
|
2930
|
+
if (i && i.length > 2) {
|
|
2931
|
+
const s = i.substring(1);
|
|
2930
2932
|
if (e) {
|
|
2931
|
-
const
|
|
2932
|
-
for (let
|
|
2933
|
-
const
|
|
2934
|
-
|
|
2933
|
+
const a = s.split("&");
|
|
2934
|
+
for (let o = 0; o < a.length; o++) {
|
|
2935
|
+
const c = a[o].indexOf("=");
|
|
2936
|
+
c > 0 && a[o].substring(0, c) === e && (n = a[o].substring(c + 1));
|
|
2935
2937
|
}
|
|
2936
2938
|
}
|
|
2937
2939
|
if (n) return n;
|
|
2938
2940
|
if (!n && t > -1) {
|
|
2939
|
-
const
|
|
2940
|
-
return Array.isArray(
|
|
2941
|
+
const a = i.match(/\/([a-zA-Z-]*)/g);
|
|
2942
|
+
return Array.isArray(a) ? a[typeof t == "number" ? t : 0]?.replace("/", "") : void 0;
|
|
2941
2943
|
}
|
|
2942
2944
|
}
|
|
2943
2945
|
}
|
|
2944
2946
|
return n;
|
|
2945
2947
|
}
|
|
2946
2948
|
};
|
|
2947
|
-
let
|
|
2948
|
-
const
|
|
2949
|
-
if (
|
|
2949
|
+
let q = null;
|
|
2950
|
+
const et = () => {
|
|
2951
|
+
if (q !== null) return q;
|
|
2950
2952
|
try {
|
|
2951
|
-
if (
|
|
2953
|
+
if (q = typeof window < "u" && window.localStorage !== null, !q)
|
|
2952
2954
|
return !1;
|
|
2953
|
-
const
|
|
2954
|
-
window.localStorage.setItem(
|
|
2955
|
+
const r = "i18next.translate.boo";
|
|
2956
|
+
window.localStorage.setItem(r, "foo"), window.localStorage.removeItem(r);
|
|
2955
2957
|
} catch {
|
|
2956
|
-
|
|
2958
|
+
q = !1;
|
|
2957
2959
|
}
|
|
2958
|
-
return
|
|
2960
|
+
return q;
|
|
2959
2961
|
};
|
|
2960
|
-
var
|
|
2962
|
+
var Ci = {
|
|
2961
2963
|
name: "localStorage",
|
|
2962
2964
|
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
2963
|
-
lookup(
|
|
2965
|
+
lookup(r) {
|
|
2964
2966
|
let {
|
|
2965
2967
|
lookupLocalStorage: e
|
|
2966
|
-
} =
|
|
2967
|
-
if (e &&
|
|
2968
|
+
} = r;
|
|
2969
|
+
if (e && et())
|
|
2968
2970
|
return window.localStorage.getItem(e) || void 0;
|
|
2969
2971
|
},
|
|
2970
2972
|
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
2971
|
-
cacheUserLanguage(
|
|
2973
|
+
cacheUserLanguage(r, e) {
|
|
2972
2974
|
let {
|
|
2973
2975
|
lookupLocalStorage: t
|
|
2974
2976
|
} = e;
|
|
2975
|
-
t &&
|
|
2977
|
+
t && et() && window.localStorage.setItem(t, r);
|
|
2976
2978
|
}
|
|
2977
2979
|
};
|
|
2978
|
-
let
|
|
2979
|
-
const
|
|
2980
|
-
if (
|
|
2980
|
+
let U = null;
|
|
2981
|
+
const tt = () => {
|
|
2982
|
+
if (U !== null) return U;
|
|
2981
2983
|
try {
|
|
2982
|
-
if (
|
|
2984
|
+
if (U = typeof window < "u" && window.sessionStorage !== null, !U)
|
|
2983
2985
|
return !1;
|
|
2984
|
-
const
|
|
2985
|
-
window.sessionStorage.setItem(
|
|
2986
|
+
const r = "i18next.translate.boo";
|
|
2987
|
+
window.sessionStorage.setItem(r, "foo"), window.sessionStorage.removeItem(r);
|
|
2986
2988
|
} catch {
|
|
2987
|
-
|
|
2989
|
+
U = !1;
|
|
2988
2990
|
}
|
|
2989
|
-
return
|
|
2991
|
+
return U;
|
|
2990
2992
|
};
|
|
2991
|
-
var
|
|
2993
|
+
var ji = {
|
|
2992
2994
|
name: "sessionStorage",
|
|
2993
|
-
lookup(
|
|
2995
|
+
lookup(r) {
|
|
2994
2996
|
let {
|
|
2995
2997
|
lookupSessionStorage: e
|
|
2996
|
-
} =
|
|
2997
|
-
if (e &&
|
|
2998
|
+
} = r;
|
|
2999
|
+
if (e && tt())
|
|
2998
3000
|
return window.sessionStorage.getItem(e) || void 0;
|
|
2999
3001
|
},
|
|
3000
|
-
cacheUserLanguage(
|
|
3002
|
+
cacheUserLanguage(r, e) {
|
|
3001
3003
|
let {
|
|
3002
3004
|
lookupSessionStorage: t
|
|
3003
3005
|
} = e;
|
|
3004
|
-
t &&
|
|
3006
|
+
t && tt() && window.sessionStorage.setItem(t, r);
|
|
3005
3007
|
}
|
|
3006
|
-
},
|
|
3008
|
+
}, Ti = {
|
|
3007
3009
|
name: "navigator",
|
|
3008
|
-
lookup(
|
|
3010
|
+
lookup(r) {
|
|
3009
3011
|
const e = [];
|
|
3010
3012
|
if (typeof navigator < "u") {
|
|
3011
3013
|
const {
|
|
3012
3014
|
languages: t,
|
|
3013
3015
|
userLanguage: n,
|
|
3014
|
-
language:
|
|
3016
|
+
language: i
|
|
3015
3017
|
} = navigator;
|
|
3016
3018
|
if (t)
|
|
3017
3019
|
for (let s = 0; s < t.length; s++)
|
|
3018
3020
|
e.push(t[s]);
|
|
3019
|
-
n && e.push(n),
|
|
3021
|
+
n && e.push(n), i && e.push(i);
|
|
3020
3022
|
}
|
|
3021
3023
|
return e.length > 0 ? e : void 0;
|
|
3022
3024
|
}
|
|
3023
|
-
},
|
|
3025
|
+
}, $i = {
|
|
3024
3026
|
name: "htmlTag",
|
|
3025
3027
|
// Deconstruct the options object and extract the htmlTag property
|
|
3026
|
-
lookup(
|
|
3028
|
+
lookup(r) {
|
|
3027
3029
|
let {
|
|
3028
3030
|
htmlTag: e
|
|
3029
|
-
} =
|
|
3031
|
+
} = r, t;
|
|
3030
3032
|
const n = e || (typeof document < "u" ? document.documentElement : null);
|
|
3031
3033
|
return n && typeof n.getAttribute == "function" && (t = n.getAttribute("lang")), t;
|
|
3032
3034
|
}
|
|
3033
|
-
},
|
|
3035
|
+
}, Ri = {
|
|
3034
3036
|
name: "path",
|
|
3035
3037
|
// Deconstruct the options object and extract the lookupFromPathIndex property
|
|
3036
|
-
lookup(
|
|
3037
|
-
var r;
|
|
3038
|
+
lookup(r) {
|
|
3038
3039
|
let {
|
|
3039
3040
|
lookupFromPathIndex: e
|
|
3040
|
-
} =
|
|
3041
|
+
} = r;
|
|
3041
3042
|
if (typeof window > "u") return;
|
|
3042
3043
|
const t = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
3043
|
-
return Array.isArray(t) ?
|
|
3044
|
+
return Array.isArray(t) ? t[typeof e == "number" ? e : 0]?.replace("/", "") : void 0;
|
|
3044
3045
|
}
|
|
3045
|
-
},
|
|
3046
|
+
}, Fi = {
|
|
3046
3047
|
name: "subdomain",
|
|
3047
|
-
lookup(
|
|
3048
|
-
var r, s;
|
|
3048
|
+
lookup(r) {
|
|
3049
3049
|
let {
|
|
3050
3050
|
lookupFromSubdomainIndex: e
|
|
3051
|
-
} =
|
|
3052
|
-
const t = typeof e == "number" ? e + 1 : 1, n = typeof window < "u" &&
|
|
3051
|
+
} = r;
|
|
3052
|
+
const t = typeof e == "number" ? e + 1 : 1, n = typeof window < "u" && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
|
|
3053
3053
|
if (n)
|
|
3054
3054
|
return n[t];
|
|
3055
3055
|
}
|
|
3056
3056
|
};
|
|
3057
|
-
let
|
|
3057
|
+
let kt = !1;
|
|
3058
3058
|
try {
|
|
3059
|
-
document.cookie,
|
|
3059
|
+
document.cookie, kt = !0;
|
|
3060
3060
|
} catch {
|
|
3061
3061
|
}
|
|
3062
|
-
const
|
|
3063
|
-
|
|
3064
|
-
const
|
|
3065
|
-
order:
|
|
3062
|
+
const Lt = ["querystring", "cookie", "localStorage", "sessionStorage", "navigator", "htmlTag"];
|
|
3063
|
+
kt || Lt.splice(1, 1);
|
|
3064
|
+
const Mi = () => ({
|
|
3065
|
+
order: Lt,
|
|
3066
3066
|
lookupQuerystring: "lng",
|
|
3067
3067
|
lookupCookie: "i18next",
|
|
3068
3068
|
lookupLocalStorage: "i18nextLng",
|
|
@@ -3072,9 +3072,9 @@ const Ir = () => ({
|
|
|
3072
3072
|
excludeCacheFor: ["cimode"],
|
|
3073
3073
|
// cookieMinutes: 10,
|
|
3074
3074
|
// cookieDomain: 'myDomain'
|
|
3075
|
-
convertDetectedLanguage: (
|
|
3075
|
+
convertDetectedLanguage: (r) => r
|
|
3076
3076
|
});
|
|
3077
|
-
class
|
|
3077
|
+
class Et {
|
|
3078
3078
|
constructor(e) {
|
|
3079
3079
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
3080
3080
|
this.type = "languageDetector", this.detectors = {}, this.init(e, t);
|
|
@@ -3083,7 +3083,7 @@ class Ct {
|
|
|
3083
3083
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
3084
3084
|
languageUtils: {}
|
|
3085
3085
|
}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
3086
|
-
this.services = e, this.options =
|
|
3086
|
+
this.services = e, this.options = ki(t, this.options || {}, Mi()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (i) => i.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = n, this.addDetector(Pi), this.addDetector(Oi), this.addDetector(Ci), this.addDetector(ji), this.addDetector(Ti), this.addDetector($i), this.addDetector(Ri), this.addDetector(Fi), this.addDetector(Ni);
|
|
3087
3087
|
}
|
|
3088
3088
|
addDetector(e) {
|
|
3089
3089
|
return this.detectors[e.name] = e, this;
|
|
@@ -3092,10 +3092,10 @@ class Ct {
|
|
|
3092
3092
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.order, t = [];
|
|
3093
3093
|
return e.forEach((n) => {
|
|
3094
3094
|
if (this.detectors[n]) {
|
|
3095
|
-
let
|
|
3096
|
-
|
|
3095
|
+
let i = this.detectors[n].lookup(this.options);
|
|
3096
|
+
i && typeof i == "string" && (i = [i]), i && (t = t.concat(i));
|
|
3097
3097
|
}
|
|
3098
|
-
}), t = t.filter((n) => n != null && !
|
|
3098
|
+
}), t = t.filter((n) => n != null && !Li(n)).map((n) => this.options.convertDetectedLanguage(n)), this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes ? t : t.length > 0 ? t[0] : null;
|
|
3099
3099
|
}
|
|
3100
3100
|
cacheUserLanguage(e) {
|
|
3101
3101
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.caches;
|
|
@@ -3104,19 +3104,21 @@ class Ct {
|
|
|
3104
3104
|
}));
|
|
3105
3105
|
}
|
|
3106
3106
|
}
|
|
3107
|
-
|
|
3108
|
-
const
|
|
3107
|
+
Et.type = "languageDetector";
|
|
3108
|
+
const Pt = {
|
|
3109
3109
|
apiBaseUrl: "https://api.nemme.io",
|
|
3110
3110
|
debug: !1
|
|
3111
|
-
},
|
|
3112
|
-
Previous:
|
|
3113
|
-
Next:
|
|
3111
|
+
}, Di = "Previous", Ai = "Next", Ii = "Done", Vi = "Submit", Hi = {
|
|
3112
|
+
Previous: Di,
|
|
3113
|
+
Next: Ai,
|
|
3114
|
+
Done: Ii,
|
|
3115
|
+
Submit: Vi,
|
|
3114
3116
|
"Type your answer here": "Type your answer here",
|
|
3115
3117
|
"Max {{maxCharacters}} characters": "Max {{maxCharacters}} characters"
|
|
3116
|
-
},
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
debug:
|
|
3118
|
+
}, Ki = {};
|
|
3119
|
+
Zn({ locale: Xn });
|
|
3120
|
+
O.use(Et).use(Ut).init({
|
|
3121
|
+
debug: Pt.debug,
|
|
3120
3122
|
fallbackLng: "en",
|
|
3121
3123
|
interpolation: {
|
|
3122
3124
|
escapeValue: !1
|
|
@@ -3124,28 +3126,28 @@ N.use(Ct).use(Jt).init({
|
|
|
3124
3126
|
},
|
|
3125
3127
|
resources: {
|
|
3126
3128
|
en: {
|
|
3127
|
-
translation:
|
|
3129
|
+
translation: Hi
|
|
3128
3130
|
},
|
|
3129
3131
|
nb: {
|
|
3130
|
-
tranlation:
|
|
3132
|
+
tranlation: Ki
|
|
3131
3133
|
}
|
|
3132
3134
|
}
|
|
3133
3135
|
});
|
|
3134
|
-
const
|
|
3136
|
+
const nt = {
|
|
3135
3137
|
debug: 0,
|
|
3136
3138
|
info: 1,
|
|
3137
3139
|
warn: 2,
|
|
3138
3140
|
error: 3
|
|
3139
3141
|
};
|
|
3140
|
-
class
|
|
3142
|
+
class Le {
|
|
3143
|
+
prefix;
|
|
3144
|
+
enabled;
|
|
3145
|
+
level;
|
|
3141
3146
|
constructor(e = {}) {
|
|
3142
|
-
w(this, "prefix");
|
|
3143
|
-
w(this, "enabled");
|
|
3144
|
-
w(this, "level");
|
|
3145
3147
|
this.prefix = e.prefix || "Nemme SDK", this.enabled = e.enabled !== void 0 ? e.enabled : !0, this.level = e.level || "info";
|
|
3146
3148
|
}
|
|
3147
3149
|
shouldLog(e) {
|
|
3148
|
-
return this.enabled &&
|
|
3150
|
+
return this.enabled && nt[e] >= nt[this.level];
|
|
3149
3151
|
}
|
|
3150
3152
|
formatMessage(e) {
|
|
3151
3153
|
return `[${this.prefix}] ${e}`;
|
|
@@ -3164,7 +3166,7 @@ class Pe {
|
|
|
3164
3166
|
}
|
|
3165
3167
|
// Create a child logger with a new prefix
|
|
3166
3168
|
child(e) {
|
|
3167
|
-
return new
|
|
3169
|
+
return new Le({
|
|
3168
3170
|
prefix: `${this.prefix}:${e}`,
|
|
3169
3171
|
enabled: this.enabled,
|
|
3170
3172
|
level: this.level
|
|
@@ -3175,31 +3177,31 @@ class Pe {
|
|
|
3175
3177
|
e.prefix !== void 0 && (this.prefix = e.prefix), e.enabled !== void 0 && (this.enabled = e.enabled), e.level !== void 0 && (this.level = e.level);
|
|
3176
3178
|
}
|
|
3177
3179
|
}
|
|
3178
|
-
const
|
|
3179
|
-
const t = new URL(
|
|
3180
|
-
return e && Object.entries(e).forEach(([n,
|
|
3181
|
-
|
|
3180
|
+
const Ot = new Le(), it = Ot.child("network"), Bi = 3e4, zi = (r, e) => {
|
|
3181
|
+
const t = new URL(r, Pt.apiBaseUrl);
|
|
3182
|
+
return e && Object.entries(e).forEach(([n, i]) => {
|
|
3183
|
+
i != null && t.searchParams.append(n, String(i));
|
|
3182
3184
|
}), t.toString();
|
|
3183
|
-
},
|
|
3185
|
+
}, D = {
|
|
3184
3186
|
/**
|
|
3185
3187
|
* Make an HTTP request
|
|
3186
3188
|
*/
|
|
3187
|
-
async request(
|
|
3188
|
-
const { method: t = "GET", headers: n = {}, body:
|
|
3189
|
+
async request(r, e = {}) {
|
|
3190
|
+
const { method: t = "GET", headers: n = {}, body: i, params: s, timeout: a = Bi } = e, o = zi(r, s), c = {
|
|
3189
3191
|
"Content-Type": "application/json",
|
|
3190
3192
|
Accept: "application/json",
|
|
3191
3193
|
...n
|
|
3192
3194
|
}, l = {
|
|
3193
3195
|
method: t,
|
|
3194
3196
|
headers: c,
|
|
3195
|
-
body:
|
|
3197
|
+
body: i ? JSON.stringify(i) : void 0
|
|
3196
3198
|
}, d = new AbortController(), u = setTimeout(() => d.abort(), a);
|
|
3197
3199
|
l.signal = d.signal;
|
|
3198
3200
|
try {
|
|
3199
3201
|
const h = await fetch(o, l);
|
|
3200
3202
|
let f;
|
|
3201
|
-
const
|
|
3202
|
-
if (
|
|
3203
|
+
const p = h.headers.get("content-type");
|
|
3204
|
+
if (p && p.includes("application/json"))
|
|
3203
3205
|
f = await h.json();
|
|
3204
3206
|
else {
|
|
3205
3207
|
const b = await h.text();
|
|
@@ -3220,7 +3222,7 @@ const jt = new Pe(), at = jt.child("network"), qr = 3e4, Ur = (i, e) => {
|
|
|
3220
3222
|
y.ok = !0;
|
|
3221
3223
|
else {
|
|
3222
3224
|
const b = `Request failed with status ${h.status}: ${h.statusText}`;
|
|
3223
|
-
|
|
3225
|
+
it.error(b, {
|
|
3224
3226
|
url: o,
|
|
3225
3227
|
method: t,
|
|
3226
3228
|
status: h.status,
|
|
@@ -3232,12 +3234,12 @@ const jt = new Pe(), at = jt.child("network"), qr = 3e4, Ur = (i, e) => {
|
|
|
3232
3234
|
}
|
|
3233
3235
|
return y;
|
|
3234
3236
|
} catch (h) {
|
|
3235
|
-
let f = "Network request failed",
|
|
3236
|
-
return h instanceof DOMException && h.name === "AbortError" ? (f = `Request timeout after ${a}ms`,
|
|
3237
|
+
let f = "Network request failed", p = {};
|
|
3238
|
+
return h instanceof DOMException && h.name === "AbortError" ? (f = `Request timeout after ${a}ms`, p = { timeout: a, url: o }) : p = {
|
|
3237
3239
|
message: h instanceof Error ? h.message : String(h),
|
|
3238
3240
|
url: o,
|
|
3239
3241
|
method: t
|
|
3240
|
-
},
|
|
3242
|
+
}, it.error(f, p), {
|
|
3241
3243
|
data: {},
|
|
3242
3244
|
status: 0,
|
|
3243
3245
|
statusText: f,
|
|
@@ -3245,7 +3247,7 @@ const jt = new Pe(), at = jt.child("network"), qr = 3e4, Ur = (i, e) => {
|
|
|
3245
3247
|
ok: !1,
|
|
3246
3248
|
error: {
|
|
3247
3249
|
message: f,
|
|
3248
|
-
details:
|
|
3250
|
+
details: p
|
|
3249
3251
|
}
|
|
3250
3252
|
};
|
|
3251
3253
|
} finally {
|
|
@@ -3255,53 +3257,53 @@ const jt = new Pe(), at = jt.child("network"), qr = 3e4, Ur = (i, e) => {
|
|
|
3255
3257
|
/**
|
|
3256
3258
|
* Convenience methods for common HTTP methods
|
|
3257
3259
|
*/
|
|
3258
|
-
async get(
|
|
3259
|
-
return this.request(
|
|
3260
|
+
async get(r, e = {}) {
|
|
3261
|
+
return this.request(r, { ...e, method: "GET" });
|
|
3260
3262
|
},
|
|
3261
|
-
async post(
|
|
3262
|
-
return this.request(
|
|
3263
|
+
async post(r, e, t = {}) {
|
|
3264
|
+
return this.request(r, { ...t, method: "POST", body: e });
|
|
3263
3265
|
},
|
|
3264
|
-
async put(
|
|
3265
|
-
return this.request(
|
|
3266
|
+
async put(r, e, t = {}) {
|
|
3267
|
+
return this.request(r, { ...t, method: "PUT", body: e });
|
|
3266
3268
|
},
|
|
3267
|
-
async patch(
|
|
3268
|
-
return this.request(
|
|
3269
|
+
async patch(r, e, t = {}) {
|
|
3270
|
+
return this.request(r, { ...t, method: "PATCH", body: e });
|
|
3269
3271
|
},
|
|
3270
|
-
async delete(
|
|
3271
|
-
return this.request(
|
|
3272
|
+
async delete(r, e = {}) {
|
|
3273
|
+
return this.request(r, { ...e, method: "DELETE" });
|
|
3272
3274
|
}
|
|
3273
3275
|
};
|
|
3274
|
-
class
|
|
3276
|
+
class qi {
|
|
3277
|
+
logger;
|
|
3278
|
+
headers;
|
|
3279
|
+
config;
|
|
3275
3280
|
constructor(e, t, n = {}) {
|
|
3276
|
-
w(this, "logger");
|
|
3277
|
-
w(this, "headers");
|
|
3278
|
-
w(this, "config");
|
|
3279
3281
|
this.logger = e, this.headers = t, this.config = n;
|
|
3280
3282
|
}
|
|
3281
3283
|
async fetchAndDisplayForm(e, t, n) {
|
|
3282
3284
|
this.logger.debug(`Fetching form config for: ${e}`);
|
|
3283
3285
|
try {
|
|
3284
|
-
const
|
|
3286
|
+
const i = await D.get(`/external/forms/${e}`, {
|
|
3285
3287
|
headers: this.headers
|
|
3286
3288
|
});
|
|
3287
|
-
|
|
3288
|
-
} catch (
|
|
3289
|
-
this.logger.error(`Failed to fetch form config for: ${e}`,
|
|
3289
|
+
i.ok && i.data ? (this.logger.info(`Form config loaded for: ${e}`, i.data), this.displayForm(i.data, t, n)) : this.logger.warn(`No form config found for: ${e}`);
|
|
3290
|
+
} catch (i) {
|
|
3291
|
+
this.logger.error(`Failed to fetch form config for: ${e}`, i);
|
|
3290
3292
|
}
|
|
3291
3293
|
}
|
|
3292
3294
|
displayForm(e, t, n) {
|
|
3293
|
-
const
|
|
3294
|
-
|
|
3295
|
-
const s =
|
|
3296
|
-
|
|
3297
|
-
{ i18n:
|
|
3298
|
-
|
|
3295
|
+
const i = document.createElement("div");
|
|
3296
|
+
i.id = "nm", i.className = this.config.theme === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "", document.body.appendChild(i);
|
|
3297
|
+
const s = Rt(i), a = pe(
|
|
3298
|
+
Jt,
|
|
3299
|
+
{ i18n: O },
|
|
3300
|
+
pe(Xt, {
|
|
3299
3301
|
form: e,
|
|
3300
3302
|
onDismiss: async (o) => {
|
|
3301
|
-
await t(), s.unmount(),
|
|
3303
|
+
await t(), s.unmount(), i.remove(), this.logger.info("Form dismissed", o);
|
|
3302
3304
|
},
|
|
3303
3305
|
onComplete: async (o) => {
|
|
3304
|
-
await n(), await this.postFormResponse(e, o), s.unmount(),
|
|
3306
|
+
await n(), await this.postFormResponse(e, o), s.unmount(), i.remove(), this.logger.info("Form completed", o);
|
|
3305
3307
|
},
|
|
3306
3308
|
zIndex: this.config.zIndex
|
|
3307
3309
|
})
|
|
@@ -3310,24 +3312,24 @@ class _r {
|
|
|
3310
3312
|
}
|
|
3311
3313
|
async postFormResponse(e, t) {
|
|
3312
3314
|
this.logger.info("Posting form response", t);
|
|
3313
|
-
const n = await
|
|
3315
|
+
const n = await D.post(`/external/forms/${e.slug}`, t, {
|
|
3314
3316
|
headers: this.headers
|
|
3315
3317
|
});
|
|
3316
3318
|
this.logger.info("Form response posted", n.data);
|
|
3317
3319
|
}
|
|
3318
3320
|
}
|
|
3319
|
-
class
|
|
3321
|
+
class Ui {
|
|
3322
|
+
logger;
|
|
3323
|
+
headers;
|
|
3324
|
+
formManager;
|
|
3325
|
+
deliveries = [];
|
|
3320
3326
|
constructor(e, t, n) {
|
|
3321
|
-
|
|
3322
|
-
w(this, "headers");
|
|
3323
|
-
w(this, "formManager");
|
|
3324
|
-
w(this, "deliveries", []);
|
|
3325
|
-
this.logger = e, this.headers = t, this.formManager = new _r(e, t, n);
|
|
3327
|
+
this.logger = e, this.headers = t, this.formManager = new qi(e, t, n);
|
|
3326
3328
|
}
|
|
3327
3329
|
async loadDeliveries() {
|
|
3328
3330
|
try {
|
|
3329
3331
|
this.logger.debug("Loading deliveries");
|
|
3330
|
-
const e = await
|
|
3332
|
+
const e = await D.get("/external/deliveries", { headers: this.headers });
|
|
3331
3333
|
this.deliveries = e.data, this.logger.info(`Loaded ${this.deliveries.length} deliveries`);
|
|
3332
3334
|
} catch (e) {
|
|
3333
3335
|
this.logger.error("Failed to load deliveries", e), this.deliveries = [];
|
|
@@ -3368,18 +3370,18 @@ class Wr {
|
|
|
3368
3370
|
eventKey: t.eventKey
|
|
3369
3371
|
});
|
|
3370
3372
|
try {
|
|
3371
|
-
const
|
|
3373
|
+
const i = await this.createDeliveryResponse(e);
|
|
3372
3374
|
await this.formManager.fetchAndDisplayForm(
|
|
3373
3375
|
e.productSlug,
|
|
3374
3376
|
async () => {
|
|
3375
|
-
this.logger.debug(`Form for delivery: ${e.productSlug} was cancelled`),
|
|
3377
|
+
this.logger.debug(`Form for delivery: ${e.productSlug} was cancelled`), i && await this.updateDeliveryResponse(e.id, i.id, !0);
|
|
3376
3378
|
},
|
|
3377
3379
|
async () => {
|
|
3378
|
-
this.logger.debug(`Form for delivery: ${e.productSlug} was completed`),
|
|
3380
|
+
this.logger.debug(`Form for delivery: ${e.productSlug} was completed`), i && await this.updateDeliveryResponse(e.id, i.id, !1, !0);
|
|
3379
3381
|
}
|
|
3380
3382
|
);
|
|
3381
|
-
} catch (
|
|
3382
|
-
this.logger.error(`Failed to load form for delivery: ${e.productSlug}`,
|
|
3383
|
+
} catch (i) {
|
|
3384
|
+
this.logger.error(`Failed to load form for delivery: ${e.productSlug}`, i);
|
|
3383
3385
|
}
|
|
3384
3386
|
}
|
|
3385
3387
|
}
|
|
@@ -3390,11 +3392,11 @@ class Wr {
|
|
|
3390
3392
|
} catch {
|
|
3391
3393
|
n = e.startsWith("/") ? e : `/${e}`;
|
|
3392
3394
|
}
|
|
3393
|
-
const
|
|
3395
|
+
const i = (d) => {
|
|
3394
3396
|
if (!d) return "/";
|
|
3395
3397
|
let u = d.startsWith("/") ? d : `/${d}`;
|
|
3396
3398
|
return u.length > 1 && u.endsWith("/") && (u = u.slice(0, -1)), u;
|
|
3397
|
-
}, s =
|
|
3399
|
+
}, s = i(n), a = i(t), o = a.replace(/\*\*/g, "§DOUBLE_STAR§").replace(/\*/g, "[^/]*").replace(/§DOUBLE_STAR§/g, ".*").replace(/\?/g, "."), l = new RegExp(`^${o}$`).test(s);
|
|
3398
3400
|
return this.logger.debug("URL pattern matching", {
|
|
3399
3401
|
originalUrl: e,
|
|
3400
3402
|
pathname: n,
|
|
@@ -3407,7 +3409,7 @@ class Wr {
|
|
|
3407
3409
|
}
|
|
3408
3410
|
async createDeliveryResponse(e) {
|
|
3409
3411
|
try {
|
|
3410
|
-
return (await
|
|
3412
|
+
return (await D.post(
|
|
3411
3413
|
`/external/deliveries/${e.id}/responses`,
|
|
3412
3414
|
{},
|
|
3413
3415
|
{ headers: this.headers }
|
|
@@ -3416,11 +3418,11 @@ class Wr {
|
|
|
3416
3418
|
this.logger.error(`Failed to create delivery response for delivery: ${e.id}`, t);
|
|
3417
3419
|
}
|
|
3418
3420
|
}
|
|
3419
|
-
async updateDeliveryResponse(e, t, n = !1,
|
|
3421
|
+
async updateDeliveryResponse(e, t, n = !1, i = !1) {
|
|
3420
3422
|
try {
|
|
3421
|
-
await
|
|
3423
|
+
await D.patch(
|
|
3422
3424
|
`/external/deliveries/${e}/responses/${t}`,
|
|
3423
|
-
{ wasDismissed: n, wasCompleted:
|
|
3425
|
+
{ wasDismissed: n, wasCompleted: i },
|
|
3424
3426
|
{ headers: this.headers }
|
|
3425
3427
|
);
|
|
3426
3428
|
} catch (s) {
|
|
@@ -3429,7 +3431,7 @@ class Wr {
|
|
|
3429
3431
|
}
|
|
3430
3432
|
async isDeliveryValid(e) {
|
|
3431
3433
|
try {
|
|
3432
|
-
return (await
|
|
3434
|
+
return (await D.get(`/external/deliveries/${e.id}/should-deliver`, {
|
|
3433
3435
|
headers: this.headers
|
|
3434
3436
|
})).data;
|
|
3435
3437
|
} catch (t) {
|
|
@@ -3437,28 +3439,28 @@ class Wr {
|
|
|
3437
3439
|
}
|
|
3438
3440
|
}
|
|
3439
3441
|
}
|
|
3440
|
-
class
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
this.logger = e, this.headers = t, this.sessionId = n, this.eventDefinitions =
|
|
3442
|
+
class _i {
|
|
3443
|
+
logger;
|
|
3444
|
+
headers;
|
|
3445
|
+
sessionId;
|
|
3446
|
+
eventDefinitions = [];
|
|
3447
|
+
onPageView;
|
|
3448
|
+
onEvent;
|
|
3449
|
+
// Batching
|
|
3450
|
+
backlog = [];
|
|
3451
|
+
flushTimeout = null;
|
|
3452
|
+
batchConfig = {
|
|
3453
|
+
enabled: !0,
|
|
3454
|
+
size: 10,
|
|
3455
|
+
delayMs: 1e4,
|
|
3456
|
+
// 10 seconds
|
|
3457
|
+
sendOnUnload: !0
|
|
3458
|
+
};
|
|
3459
|
+
// Page view tracking
|
|
3460
|
+
originalHistoryMethods = null;
|
|
3461
|
+
EVENT_PAGE_VIEW = "page_view";
|
|
3462
|
+
constructor({ logger: e, headers: t, sessionId: n, eventDefinitions: i, batchConfig: s, onPageView: a, onEvent: o }) {
|
|
3463
|
+
this.logger = e, this.headers = t, this.sessionId = n, this.eventDefinitions = i, this.onPageView = a, this.onEvent = o, this.flushEvents = this.flushEvents.bind(this), this.handlePopState = this.handlePopState.bind(this), this.handleVisibilityChange = this.handleVisibilityChange.bind(this), this.setupBatching(s);
|
|
3462
3464
|
}
|
|
3463
3465
|
setupBatching(e) {
|
|
3464
3466
|
typeof e == "boolean" ? this.batchConfig.enabled = e : e && (this.batchConfig = {
|
|
@@ -3482,21 +3484,20 @@ class Zr {
|
|
|
3482
3484
|
}, window.addEventListener("popstate", this.handlePopState), document.addEventListener("visibilitychange", this.handleVisibilityChange);
|
|
3483
3485
|
}
|
|
3484
3486
|
async track(e) {
|
|
3485
|
-
var a, o;
|
|
3486
3487
|
if (!this.sessionId) {
|
|
3487
3488
|
this.logger.warn("Tracking manager not initialized, cannot track event");
|
|
3488
3489
|
return;
|
|
3489
3490
|
}
|
|
3490
3491
|
const { eventKey: t, data: n = {} } = e;
|
|
3491
3492
|
this.logger.debug("Tracking event", { eventKey: t, data: n });
|
|
3492
|
-
const
|
|
3493
|
+
const i = window.location.href, s = {
|
|
3493
3494
|
sessionId: this.sessionId,
|
|
3494
3495
|
eventKey: t,
|
|
3495
3496
|
data: n || {},
|
|
3496
3497
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3497
|
-
page:
|
|
3498
|
+
page: i
|
|
3498
3499
|
};
|
|
3499
|
-
this.validateEvent(s), this.batchConfig.enabled ? (this.backlog.push(s), this.scheduleFlush()) : await this.sendEvents([s]), t === this.EVENT_PAGE_VIEW ?
|
|
3500
|
+
this.validateEvent(s), this.batchConfig.enabled ? (this.backlog.push(s), this.scheduleFlush()) : await this.sendEvents([s]), t === this.EVENT_PAGE_VIEW ? this.onPageView?.(window.location.href) : this.onEvent?.(s, i);
|
|
3500
3501
|
}
|
|
3501
3502
|
async trackPageView() {
|
|
3502
3503
|
typeof window > "u" || await this.track({
|
|
@@ -3525,10 +3526,10 @@ class Zr {
|
|
|
3525
3526
|
this.logger.warn(`Event ${e.eventKey} is not registered`);
|
|
3526
3527
|
return;
|
|
3527
3528
|
}
|
|
3528
|
-
const n = t.properties,
|
|
3529
|
-
if (
|
|
3530
|
-
for (const s of Object.keys(
|
|
3531
|
-
const a =
|
|
3529
|
+
const n = t.properties, i = e.data;
|
|
3530
|
+
if (i)
|
|
3531
|
+
for (const s of Object.keys(i)) {
|
|
3532
|
+
const a = i[s], o = n.find((c) => c.name === s);
|
|
3532
3533
|
if (!o) {
|
|
3533
3534
|
this.logger.warn(`Property ${s} is not registered for event ${e.eventKey}`);
|
|
3534
3535
|
return;
|
|
@@ -3571,27 +3572,27 @@ class Zr {
|
|
|
3571
3572
|
if (e.length !== 0)
|
|
3572
3573
|
if (e.length === 1) {
|
|
3573
3574
|
const t = e[0];
|
|
3574
|
-
await
|
|
3575
|
+
await D.post("/external/trackings/track", t, { headers: this.headers });
|
|
3575
3576
|
} else
|
|
3576
|
-
await
|
|
3577
|
+
await D.post("/external/trackings/batch", e, { headers: this.headers });
|
|
3577
3578
|
}
|
|
3578
3579
|
}
|
|
3579
|
-
class
|
|
3580
|
+
class Ee {
|
|
3581
|
+
clientKey;
|
|
3582
|
+
userIdentifier;
|
|
3583
|
+
initialized = !1;
|
|
3584
|
+
clientLogger = Ot.child("client");
|
|
3585
|
+
headers = {};
|
|
3586
|
+
formConfig;
|
|
3580
3587
|
constructor(e) {
|
|
3581
|
-
w(this, "clientKey");
|
|
3582
|
-
w(this, "userIdentifier");
|
|
3583
|
-
w(this, "initialized", !1);
|
|
3584
|
-
w(this, "clientLogger", jt.child("client"));
|
|
3585
|
-
w(this, "headers", {});
|
|
3586
|
-
w(this, "formConfig");
|
|
3587
|
-
// Module managers
|
|
3588
|
-
w(this, "trackingManager");
|
|
3589
3588
|
this.clientKey = e;
|
|
3590
3589
|
}
|
|
3590
|
+
// Module managers
|
|
3591
|
+
trackingManager;
|
|
3591
3592
|
/**
|
|
3592
3593
|
* Create a new Nemme SDK client instance
|
|
3593
3594
|
*/
|
|
3594
|
-
async init({ userIdentifier: e, debug: t = !1, batch: n, formConfig:
|
|
3595
|
+
async init({ userIdentifier: e, debug: t = !1, batch: n, formConfig: i }) {
|
|
3595
3596
|
if (!e) throw new Error("userIdentifier is required parameter");
|
|
3596
3597
|
this.userIdentifier = e, this.clientLogger.configure({
|
|
3597
3598
|
enabled: t,
|
|
@@ -3599,7 +3600,7 @@ class Ce {
|
|
|
3599
3600
|
}), this.headers = {
|
|
3600
3601
|
"X-Client-Key": this.clientKey,
|
|
3601
3602
|
"X-User-Id": this.userIdentifier
|
|
3602
|
-
}, this.formConfig =
|
|
3603
|
+
}, this.formConfig = i;
|
|
3603
3604
|
try {
|
|
3604
3605
|
const s = await this.initializeSession();
|
|
3605
3606
|
await this.initializeManagers(s, n), this.initialized = !0, this.clientLogger.info("Nemme client initialized", {
|
|
@@ -3612,12 +3613,10 @@ class Ce {
|
|
|
3612
3613
|
return this;
|
|
3613
3614
|
}
|
|
3614
3615
|
async flush() {
|
|
3615
|
-
|
|
3616
|
-
return (e = this.trackingManager) == null ? void 0 : e.flush();
|
|
3616
|
+
return this.trackingManager?.flush();
|
|
3617
3617
|
}
|
|
3618
3618
|
destroy() {
|
|
3619
|
-
|
|
3620
|
-
(e = this.trackingManager) == null || e.destroy();
|
|
3619
|
+
this.trackingManager?.destroy();
|
|
3621
3620
|
}
|
|
3622
3621
|
async track(e) {
|
|
3623
3622
|
if (!this.initialized || !this.trackingManager) {
|
|
@@ -3627,22 +3626,21 @@ class Ce {
|
|
|
3627
3626
|
return this.trackingManager.track(e);
|
|
3628
3627
|
}
|
|
3629
3628
|
async initializeSession() {
|
|
3630
|
-
var e;
|
|
3631
3629
|
try {
|
|
3632
|
-
const
|
|
3630
|
+
const e = await D.post(
|
|
3633
3631
|
"/external/trackings/initialize",
|
|
3634
3632
|
{},
|
|
3635
3633
|
{ headers: this.headers }
|
|
3636
3634
|
);
|
|
3637
|
-
if (!
|
|
3638
|
-
throw new Error(
|
|
3639
|
-
return
|
|
3640
|
-
} catch (
|
|
3641
|
-
throw this.clientLogger.error("Error during initialization",
|
|
3635
|
+
if (!e.ok)
|
|
3636
|
+
throw new Error(e.error?.message || "Request for initialising session failed");
|
|
3637
|
+
return e.data;
|
|
3638
|
+
} catch (e) {
|
|
3639
|
+
throw this.clientLogger.error("Error during initialization", e), e;
|
|
3642
3640
|
}
|
|
3643
3641
|
}
|
|
3644
3642
|
async initializeManagers(e, t) {
|
|
3645
|
-
const n = new
|
|
3643
|
+
const n = new Ui(this.clientLogger, this.headers, this.formConfig), i = new _i({
|
|
3646
3644
|
logger: this.clientLogger,
|
|
3647
3645
|
headers: this.headers,
|
|
3648
3646
|
sessionId: e.sessionId,
|
|
@@ -3655,78 +3653,78 @@ class Ce {
|
|
|
3655
3653
|
await n.evaluateDeliveryTriggers({ eventKey: s.eventKey, eventData: s.data, url: a });
|
|
3656
3654
|
}
|
|
3657
3655
|
});
|
|
3658
|
-
await n.loadDeliveries(), typeof window < "u" && (await
|
|
3656
|
+
await n.loadDeliveries(), typeof window < "u" && (await i.setupPageViewTracking(), await i.trackPageView(), await i.flush()), this.trackingManager = i;
|
|
3659
3657
|
}
|
|
3660
3658
|
}
|
|
3661
|
-
const
|
|
3662
|
-
const [n,
|
|
3663
|
-
|
|
3659
|
+
const Nt = (r) => new Ee(r), Ct = Se(void 0), Xi = ({ clientKey: r, config: e, children: t }) => {
|
|
3660
|
+
const [n, i] = X(null), [s, a] = X(!1), [o, c] = X(null);
|
|
3661
|
+
oe(() => {
|
|
3664
3662
|
let d = null, u = !1;
|
|
3665
3663
|
const h = async () => {
|
|
3666
3664
|
try {
|
|
3667
|
-
const f = new
|
|
3665
|
+
const f = new Ee(r);
|
|
3668
3666
|
if (await f.init(e), u) {
|
|
3669
3667
|
f.destroy();
|
|
3670
3668
|
return;
|
|
3671
3669
|
}
|
|
3672
|
-
d = f,
|
|
3670
|
+
d = f, i(f), a(!0), c(null);
|
|
3673
3671
|
} catch (f) {
|
|
3674
3672
|
u || (c(f instanceof Error ? f.message : "Failed to initialize Nemme client"), a(!1));
|
|
3675
3673
|
}
|
|
3676
3674
|
};
|
|
3677
|
-
return
|
|
3675
|
+
return i(null), a(!1), c(null), h(), () => {
|
|
3678
3676
|
u = !0, d && d.destroy();
|
|
3679
3677
|
};
|
|
3680
|
-
}, [
|
|
3678
|
+
}, [r, e]);
|
|
3681
3679
|
const l = {
|
|
3682
3680
|
client: n,
|
|
3683
3681
|
isInitialized: s,
|
|
3684
3682
|
error: o
|
|
3685
3683
|
};
|
|
3686
|
-
return /* @__PURE__ */ m.jsx(
|
|
3687
|
-
},
|
|
3688
|
-
const
|
|
3689
|
-
if (
|
|
3684
|
+
return /* @__PURE__ */ m.jsx(Ct.Provider, { value: l, children: t });
|
|
3685
|
+
}, Wi = () => {
|
|
3686
|
+
const r = st(Ct);
|
|
3687
|
+
if (r === void 0)
|
|
3690
3688
|
throw new Error("useNemmeContext must be used within a NemmeProvider");
|
|
3691
|
-
return
|
|
3692
|
-
},
|
|
3693
|
-
const { client:
|
|
3689
|
+
return r;
|
|
3690
|
+
}, er = () => {
|
|
3691
|
+
const { client: r, isInitialized: e, error: t } = Wi(), n = K(
|
|
3694
3692
|
async (s) => {
|
|
3695
|
-
if (!
|
|
3693
|
+
if (!r || !e) {
|
|
3696
3694
|
console.warn("Nemme client not initialized");
|
|
3697
3695
|
return;
|
|
3698
3696
|
}
|
|
3699
|
-
return
|
|
3697
|
+
return r.track(s);
|
|
3700
3698
|
},
|
|
3701
|
-
[
|
|
3702
|
-
),
|
|
3703
|
-
if (!
|
|
3699
|
+
[r, e]
|
|
3700
|
+
), i = K(async () => {
|
|
3701
|
+
if (!r || !e) {
|
|
3704
3702
|
console.warn("Nemme client not initialized");
|
|
3705
3703
|
return;
|
|
3706
3704
|
}
|
|
3707
|
-
return
|
|
3708
|
-
}, [
|
|
3705
|
+
return r.flush();
|
|
3706
|
+
}, [r, e]);
|
|
3709
3707
|
return {
|
|
3710
3708
|
track: n,
|
|
3711
|
-
flush:
|
|
3709
|
+
flush: i,
|
|
3712
3710
|
isInitialized: e,
|
|
3713
3711
|
error: t,
|
|
3714
|
-
client:
|
|
3712
|
+
client: r
|
|
3715
3713
|
};
|
|
3716
|
-
},
|
|
3717
|
-
const { clientKey: e, ...t } =
|
|
3718
|
-
return await
|
|
3719
|
-
},
|
|
3720
|
-
NemmeClient:
|
|
3721
|
-
init:
|
|
3714
|
+
}, Zi = (r) => Nt(r), Ji = async (r) => {
|
|
3715
|
+
const { clientKey: e, ...t } = r;
|
|
3716
|
+
return await Nt(e).init(t);
|
|
3717
|
+
}, Qi = Object.assign((r) => Zi(r), {
|
|
3718
|
+
NemmeClient: Ee,
|
|
3719
|
+
init: Ji
|
|
3722
3720
|
});
|
|
3723
|
-
typeof window < "u" && (window.NemmeSDK =
|
|
3721
|
+
typeof window < "u" && (window.NemmeSDK = Qi);
|
|
3724
3722
|
export {
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3723
|
+
Ee as NemmeClient,
|
|
3724
|
+
Xi as NemmeProvider,
|
|
3725
|
+
Qi as NemmeSDK,
|
|
3726
|
+
Qi as default,
|
|
3727
|
+
er as useNemme,
|
|
3728
|
+
Wi as useNemmeContext
|
|
3731
3729
|
};
|
|
3732
3730
|
//# sourceMappingURL=index.esm.js.map
|