@prosopo/cli 3.8.17 → 3.8.19

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.
@@ -1,856 +0,0 @@
1
- import { n as e, t } from "./i18next-CzgfK_Ir.js";
2
- import { l as n } from "./provider.cli.bundle.js";
3
- //#region ../../node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js
4
- var { slice: r, forEach: i } = [];
5
- function a(e) {
6
- return i.call(r.call(arguments, 1), (t) => {
7
- if (t) for (let n in t) e[n] === void 0 && (e[n] = t[n]);
8
- }), e;
9
- }
10
- function o(e) {
11
- return typeof e == "string" && [
12
- /<\s*script.*?>/i,
13
- /<\s*\/\s*script\s*>/i,
14
- /<\s*img.*?on\w+\s*=/i,
15
- /<\s*\w+\s*on\w+\s*=.*?>/i,
16
- /javascript\s*:/i,
17
- /vbscript\s*:/i,
18
- /expression\s*\(/i,
19
- /eval\s*\(/i,
20
- /alert\s*\(/i,
21
- /document\.cookie/i,
22
- /document\.write\s*\(/i,
23
- /window\.location/i,
24
- /innerHTML/i
25
- ].some((t) => t.test(e));
26
- }
27
- var s = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, c = function(e, t) {
28
- let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { path: "/" }, r = `${e}=${encodeURIComponent(t)}`;
29
- if (n.maxAge > 0) {
30
- let e = n.maxAge - 0;
31
- if (Number.isNaN(e)) throw Error("maxAge should be a Number");
32
- r += `; Max-Age=${Math.floor(e)}`;
33
- }
34
- if (n.domain) {
35
- if (!s.test(n.domain)) throw TypeError("option domain is invalid");
36
- r += `; Domain=${n.domain}`;
37
- }
38
- if (n.path) {
39
- if (!s.test(n.path)) throw TypeError("option path is invalid");
40
- r += `; Path=${n.path}`;
41
- }
42
- if (n.expires) {
43
- if (typeof n.expires.toUTCString != "function") throw TypeError("option expires is invalid");
44
- r += `; Expires=${n.expires.toUTCString()}`;
45
- }
46
- if (n.httpOnly && (r += "; HttpOnly"), n.secure && (r += "; Secure"), n.sameSite) switch (typeof n.sameSite == "string" ? n.sameSite.toLowerCase() : n.sameSite) {
47
- case !0:
48
- r += "; SameSite=Strict";
49
- break;
50
- case "lax":
51
- r += "; SameSite=Lax";
52
- break;
53
- case "strict":
54
- r += "; SameSite=Strict";
55
- break;
56
- case "none":
57
- r += "; SameSite=None";
58
- break;
59
- default: throw TypeError("option sameSite is invalid");
60
- }
61
- return n.partitioned && (r += "; Partitioned"), r;
62
- }, l = {
63
- create(e, t, n, r) {
64
- let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
65
- path: "/",
66
- sameSite: "strict"
67
- };
68
- n && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + n * 60 * 1e3)), r && (i.domain = r), document.cookie = c(e, t, i);
69
- },
70
- read(e) {
71
- let t = `${e}=`, n = document.cookie.split(";");
72
- for (let e = 0; e < n.length; e++) {
73
- let r = n[e];
74
- for (; r.charAt(0) === " ";) r = r.substring(1, r.length);
75
- if (r.indexOf(t) === 0) return r.substring(t.length, r.length);
76
- }
77
- return null;
78
- },
79
- remove(e, t) {
80
- this.create(e, "", -1, t);
81
- }
82
- }, u = {
83
- name: "cookie",
84
- lookup(e) {
85
- let { lookupCookie: t } = e;
86
- if (t && typeof document < "u") return l.read(t) || void 0;
87
- },
88
- cacheUserLanguage(e, t) {
89
- let { lookupCookie: n, cookieMinutes: r, cookieDomain: i, cookieOptions: a } = t;
90
- n && typeof document < "u" && l.create(n, e, r, i, a);
91
- }
92
- }, d = {
93
- name: "querystring",
94
- lookup(e) {
95
- let { lookupQuerystring: t } = e, n;
96
- if (typeof window < "u") {
97
- let { search: e } = window.location;
98
- !window.location.search && window.location.hash?.indexOf("?") > -1 && (e = window.location.hash.substring(window.location.hash.indexOf("?")));
99
- let r = e.substring(1).split("&");
100
- for (let e = 0; e < r.length; e++) {
101
- let i = r[e].indexOf("=");
102
- i > 0 && r[e].substring(0, i) === t && (n = r[e].substring(i + 1));
103
- }
104
- }
105
- return n;
106
- }
107
- }, f = {
108
- name: "hash",
109
- lookup(e) {
110
- let { lookupHash: t, lookupFromHashIndex: n } = e, r;
111
- if (typeof window < "u") {
112
- let { hash: e } = window.location;
113
- if (e && e.length > 2) {
114
- let i = e.substring(1);
115
- if (t) {
116
- let e = i.split("&");
117
- for (let n = 0; n < e.length; n++) {
118
- let i = e[n].indexOf("=");
119
- i > 0 && e[n].substring(0, i) === t && (r = e[n].substring(i + 1));
120
- }
121
- }
122
- if (r) return r;
123
- if (!r && n > -1) {
124
- let t = e.match(/\/([a-zA-Z-]*)/g);
125
- return Array.isArray(t) ? t[typeof n == "number" ? n : 0]?.replace("/", "") : void 0;
126
- }
127
- }
128
- }
129
- return r;
130
- }
131
- }, p = null, m = () => {
132
- if (p !== null) return p;
133
- try {
134
- if (p = typeof window < "u" && window.localStorage !== null, !p) return !1;
135
- let e = "i18next.translate.boo";
136
- window.localStorage.setItem(e, "foo"), window.localStorage.removeItem(e);
137
- } catch {
138
- p = !1;
139
- }
140
- return p;
141
- }, ee = {
142
- name: "localStorage",
143
- lookup(e) {
144
- let { lookupLocalStorage: t } = e;
145
- if (t && m()) return window.localStorage.getItem(t) || void 0;
146
- },
147
- cacheUserLanguage(e, t) {
148
- let { lookupLocalStorage: n } = t;
149
- n && m() && window.localStorage.setItem(n, e);
150
- }
151
- }, h = null, g = () => {
152
- if (h !== null) return h;
153
- try {
154
- if (h = typeof window < "u" && window.sessionStorage !== null, !h) return !1;
155
- let e = "i18next.translate.boo";
156
- window.sessionStorage.setItem(e, "foo"), window.sessionStorage.removeItem(e);
157
- } catch {
158
- h = !1;
159
- }
160
- return h;
161
- }, _ = {
162
- name: "sessionStorage",
163
- lookup(e) {
164
- let { lookupSessionStorage: t } = e;
165
- if (t && g()) return window.sessionStorage.getItem(t) || void 0;
166
- },
167
- cacheUserLanguage(e, t) {
168
- let { lookupSessionStorage: n } = t;
169
- n && g() && window.sessionStorage.setItem(n, e);
170
- }
171
- }, v = {
172
- name: "navigator",
173
- lookup(e) {
174
- let t = [];
175
- if (typeof navigator < "u") {
176
- let { languages: e, userLanguage: n, language: r } = navigator;
177
- if (e) for (let n = 0; n < e.length; n++) t.push(e[n]);
178
- n && t.push(n), r && t.push(r);
179
- }
180
- return t.length > 0 ? t : void 0;
181
- }
182
- }, te = {
183
- name: "htmlTag",
184
- lookup(e) {
185
- let { htmlTag: t } = e, n, r = t || (typeof document < "u" ? document.documentElement : null);
186
- return r && typeof r.getAttribute == "function" && (n = r.getAttribute("lang")), n;
187
- }
188
- }, ne = {
189
- name: "path",
190
- lookup(e) {
191
- let { lookupFromPathIndex: t } = e;
192
- if (typeof window > "u") return;
193
- let n = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
194
- if (Array.isArray(n)) return n[typeof t == "number" ? t : 0]?.replace("/", "");
195
- }
196
- }, re = {
197
- name: "subdomain",
198
- lookup(e) {
199
- let { lookupFromSubdomainIndex: t } = e, n = typeof t == "number" ? t + 1 : 1, r = typeof window < "u" && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
200
- if (r) return r[n];
201
- }
202
- }, y = !1;
203
- try {
204
- document.cookie, y = !0;
205
- } catch {}
206
- var b = [
207
- "querystring",
208
- "cookie",
209
- "localStorage",
210
- "sessionStorage",
211
- "navigator",
212
- "htmlTag"
213
- ];
214
- y || b.splice(1, 1);
215
- var x = () => ({
216
- order: b,
217
- lookupQuerystring: "lng",
218
- lookupCookie: "i18next",
219
- lookupLocalStorage: "i18nextLng",
220
- lookupSessionStorage: "i18nextLng",
221
- caches: ["localStorage"],
222
- excludeCacheFor: ["cimode"],
223
- convertDetectedLanguage: (e) => e
224
- }), S = class {
225
- constructor(e) {
226
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
227
- this.type = "languageDetector", this.detectors = {}, this.init(e, t);
228
- }
229
- init() {
230
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { languageUtils: {} }, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
231
- this.services = e, this.options = a(t, this.options || {}, x()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (e) => e.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = n, this.addDetector(u), this.addDetector(d), this.addDetector(ee), this.addDetector(_), this.addDetector(v), this.addDetector(te), this.addDetector(ne), this.addDetector(re), this.addDetector(f);
232
- }
233
- addDetector(e) {
234
- return this.detectors[e.name] = e, this;
235
- }
236
- detect() {
237
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.order, t = [];
238
- return e.forEach((e) => {
239
- if (this.detectors[e]) {
240
- let n = this.detectors[e].lookup(this.options);
241
- n && typeof n == "string" && (n = [n]), n && (t = t.concat(n));
242
- }
243
- }), t = t.filter((e) => e != null && !o(e)).map((e) => this.options.convertDetectedLanguage(e)), this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes ? t : t.length > 0 ? t[0] : null;
244
- }
245
- cacheUserLanguage(e) {
246
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.caches;
247
- t && (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(e) > -1 || t.forEach((t) => {
248
- this.detectors[t] && this.detectors[t].cacheUserLanguage(e, this.options);
249
- }));
250
- }
251
- };
252
- S.type = "languageDetector";
253
- //#endregion
254
- //#region ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
255
- function ie(e, t) {
256
- if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
257
- }
258
- //#endregion
259
- //#region ../../node_modules/@babel/runtime/helpers/esm/typeof.js
260
- function C(e) {
261
- "@babel/helpers - typeof";
262
- return C = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
263
- return typeof e;
264
- } : function(e) {
265
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
266
- }, C(e);
267
- }
268
- //#endregion
269
- //#region ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
270
- function ae(e, t) {
271
- if (C(e) != "object" || !e) return e;
272
- var n = e[Symbol.toPrimitive];
273
- if (n !== void 0) {
274
- var r = n.call(e, t || "default");
275
- if (C(r) != "object") return r;
276
- throw TypeError("@@toPrimitive must return a primitive value.");
277
- }
278
- return (t === "string" ? String : Number)(e);
279
- }
280
- //#endregion
281
- //#region ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
282
- function oe(e) {
283
- var t = ae(e, "string");
284
- return C(t) == "symbol" ? t : t + "";
285
- }
286
- //#endregion
287
- //#region ../../node_modules/@babel/runtime/helpers/esm/createClass.js
288
- function w(e, t) {
289
- for (var n = 0; n < t.length; n++) {
290
- var r = t[n];
291
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, oe(r.key), r);
292
- }
293
- }
294
- function se(e, t, n) {
295
- return t && w(e.prototype, t), n && w(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
296
- }
297
- //#endregion
298
- //#region ../../node_modules/i18next-chained-backend/dist/esm/i18nextChainedBackend.js
299
- var T = [], ce = T.forEach, le = T.slice;
300
- function E(e) {
301
- return ce.call(le.call(arguments, 1), function(t) {
302
- if (t) for (var n in t) e[n] === void 0 && (e[n] = t[n]);
303
- }), e;
304
- }
305
- function ue(e) {
306
- return e ? typeof e == "function" ? new e() : e : null;
307
- }
308
- function de() {
309
- return {
310
- handleEmptyResourcesAsFailed: !0,
311
- cacheHitMode: "none"
312
- };
313
- }
314
- function D(e, t, n, r) {
315
- var i = e.read.bind(e);
316
- if (i.length === 2) {
317
- try {
318
- var a = i(t, n);
319
- a && typeof a.then == "function" ? a.then(function(e) {
320
- return r(null, e);
321
- }).catch(r) : r(null, a);
322
- } catch (e) {
323
- r(e);
324
- }
325
- return;
326
- }
327
- i(t, n, r);
328
- }
329
- var O = /*#__PURE__*/ function() {
330
- function e(t) {
331
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
332
- ie(this, e), this.backends = [], this.type = "backend", this.allOptions = r, this.init(t, n);
333
- }
334
- return se(e, [
335
- {
336
- key: "init",
337
- value: function(e) {
338
- var t = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
339
- this.services = e, this.options = E(n, this.options || {}, de()), this.allOptions = r, this.options.backends && this.options.backends.forEach(function(n, i) {
340
- t.backends[i] = t.backends[i] || ue(n), t.backends[i].init(e, t.options.backendOptions && t.options.backendOptions[i] || {}, r);
341
- }), this.services && this.options.reloadInterval && setInterval(function() {
342
- return t.reload();
343
- }, this.options.reloadInterval);
344
- }
345
- },
346
- {
347
- key: "read",
348
- value: function(e, t, n) {
349
- var r = this, i = this.backends.length, a = function a(s) {
350
- if (s >= i) return n(Error("non of the backend loaded data", !0));
351
- var c = s === i - 1, l = r.options.handleEmptyResourcesAsFailed && !c ? 0 : -1, u = r.backends[s];
352
- u.read ? D(u, e, t, function(i, c, d) {
353
- if (!i && c && Object.keys(c).length > l) {
354
- if (n(null, c, s), o(s - 1, c), u.save && r.options.cacheHitMode && ["refresh", "refreshAndUpdateStore"].indexOf(r.options.cacheHitMode) > -1) {
355
- if (d && r.options.refreshExpirationTime && d + r.options.refreshExpirationTime > Date.now()) return;
356
- var f = r.backends[s + 1];
357
- f && f.read && D(f, e, t, function(n, i) {
358
- n || i && (Object.keys(i).length <= l || (o(s, i), r.options.cacheHitMode === "refreshAndUpdateStore" && r.services && r.services.resourceStore && r.services.resourceStore.addResourceBundle(e, t, i)));
359
- });
360
- }
361
- } else a(s + 1);
362
- }) : a(s + 1);
363
- }, o = function n(i, a) {
364
- if (!(i < 0)) {
365
- var o = r.backends[i];
366
- o.save && o.save(e, t, a), n(i - 1, a);
367
- }
368
- };
369
- a(0);
370
- }
371
- },
372
- {
373
- key: "create",
374
- value: function(e, t, n, r) {
375
- var i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : function() {}, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
376
- this.backends.forEach(function(o) {
377
- if (o.create) {
378
- var s = o.create.bind(o);
379
- if (s.length < 6) {
380
- try {
381
- var c = s.length === 5 ? s(e, t, n, r, a) : s(e, t, n, r);
382
- c && typeof c.then == "function" ? c.then(function(e) {
383
- return i(null, e);
384
- }).catch(i) : i(null, c);
385
- } catch (e) {
386
- i(e);
387
- }
388
- return;
389
- }
390
- s(e, t, n, r, i, a);
391
- }
392
- });
393
- }
394
- },
395
- {
396
- key: "reload",
397
- value: function() {
398
- var e = this, t = this.services, n = t.backendConnector, r = t.languageUtils, i = t.logger, a = n.language;
399
- if (!(a && a.toLowerCase() === "cimode")) {
400
- var o = [], s = function(e) {
401
- r.toResolveHierarchy(e).forEach(function(e) {
402
- o.indexOf(e) < 0 && o.push(e);
403
- });
404
- };
405
- s(a), this.allOptions.preload && this.allOptions.preload.forEach(function(e) {
406
- return s(e);
407
- }), o.forEach(function(t) {
408
- e.allOptions.ns.forEach(function(e) {
409
- n.read(t, e, "read", null, null, function(r, a) {
410
- r && i.warn(`loading namespace ${e} for language ${t} failed`, r), !r && a && i.log(`loaded namespace ${e} for language ${t}`, a), n.loaded(`${t}|${e}`, r, a);
411
- });
412
- });
413
- });
414
- }
415
- }
416
- }
417
- ]), e;
418
- }();
419
- O.type = "backend";
420
- //#endregion
421
- //#region ../../node_modules/i18next-http-backend/esm/utils.js
422
- function k(e) {
423
- "@babel/helpers - typeof";
424
- return k = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
425
- return typeof e;
426
- } : function(e) {
427
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
428
- }, k(e);
429
- }
430
- var A = [];
431
- A.forEach, A.slice;
432
- function j() {
433
- return typeof XMLHttpRequest == "function" || (typeof XMLHttpRequest > "u" ? "undefined" : k(XMLHttpRequest)) === "object";
434
- }
435
- function fe(e) {
436
- return !!e && typeof e.then == "function";
437
- }
438
- function pe(e) {
439
- return fe(e) ? e : Promise.resolve(e);
440
- }
441
- //#endregion
442
- //#region ../../node_modules/i18next-http-backend/esm/request.js
443
- function M(e, t) {
444
- var n = Object.keys(e);
445
- if (Object.getOwnPropertySymbols) {
446
- var r = Object.getOwnPropertySymbols(e);
447
- t && (r = r.filter(function(t) {
448
- return Object.getOwnPropertyDescriptor(e, t).enumerable;
449
- })), n.push.apply(n, r);
450
- }
451
- return n;
452
- }
453
- function N(e) {
454
- for (var t = 1; t < arguments.length; t++) {
455
- var n = arguments[t] == null ? {} : arguments[t];
456
- t % 2 ? M(Object(n), !0).forEach(function(t) {
457
- P(e, t, n[t]);
458
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : M(Object(n)).forEach(function(t) {
459
- Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
460
- });
461
- }
462
- return e;
463
- }
464
- function P(e, t, n) {
465
- return (t = F(t)) in e ? Object.defineProperty(e, t, {
466
- value: n,
467
- enumerable: !0,
468
- configurable: !0,
469
- writable: !0
470
- }) : e[t] = n, e;
471
- }
472
- function F(e) {
473
- var t = I(e, "string");
474
- return L(t) == "symbol" ? t : t + "";
475
- }
476
- function I(e, t) {
477
- if (L(e) != "object" || !e) return e;
478
- var n = e[Symbol.toPrimitive];
479
- if (n !== void 0) {
480
- var r = n.call(e, t || "default");
481
- if (L(r) != "object") return r;
482
- throw TypeError("@@toPrimitive must return a primitive value.");
483
- }
484
- return (t === "string" ? String : Number)(e);
485
- }
486
- function L(e) {
487
- "@babel/helpers - typeof";
488
- return L = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
489
- return typeof e;
490
- } : function(e) {
491
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
492
- }, L(e);
493
- }
494
- var R = typeof fetch == "function" ? fetch : void 0;
495
- typeof global < "u" && global.fetch ? R = global.fetch : typeof window < "u" && window.fetch && (R = window.fetch);
496
- var z;
497
- j() && (typeof global < "u" && global.XMLHttpRequest ? z = global.XMLHttpRequest : typeof window < "u" && window.XMLHttpRequest && (z = window.XMLHttpRequest));
498
- var B;
499
- if (typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObject ? B = global.ActiveXObject : typeof window < "u" && window.ActiveXObject && (B = window.ActiveXObject)), typeof R != "function" && (R = void 0), !R && !z && !B) try {
500
- import("./node-ponyfill-ByScaio2.js").then((e) => /* @__PURE__ */ n(e.default, 1)).then(function(e) {
501
- R = e.default;
502
- }).catch(function() {});
503
- } catch {}
504
- var V = function(e, t) {
505
- if (t && L(t) === "object") {
506
- var n = "";
507
- for (var r in t) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(t[r]);
508
- if (!n) return e;
509
- e = e + (e.indexOf("?") === -1 ? "?" : "&") + n.slice(1);
510
- }
511
- return e;
512
- }, H = function(e, t, n, r) {
513
- var i = function(e) {
514
- if (!e.ok) return n(e.statusText || "Error", { status: e.status });
515
- e.text().then(function(t) {
516
- n(null, {
517
- status: e.status,
518
- data: t
519
- });
520
- }).catch(n);
521
- };
522
- if (r) {
523
- var a = r(e, t);
524
- if (a instanceof Promise) {
525
- a.then(i).catch(n);
526
- return;
527
- }
528
- }
529
- typeof fetch == "function" ? fetch(e, t).then(i).catch(n) : R(e, t).then(i).catch(n);
530
- }, U = !1, me = function(e, t, n, r) {
531
- e.queryStringParams && (t = V(t, e.queryStringParams));
532
- var i = N({}, typeof e.customHeaders == "function" ? e.customHeaders() : e.customHeaders);
533
- typeof window > "u" && typeof global < "u" && global.process !== void 0 && global.process.versions && global.process.versions.node && (i["User-Agent"] = `i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`), n && (i["Content-Type"] = "application/json");
534
- var a = typeof e.requestOptions == "function" ? e.requestOptions(n) : e.requestOptions, o = N({
535
- method: n ? "POST" : "GET",
536
- body: n ? e.stringify(n) : void 0,
537
- headers: i
538
- }, U ? {} : a), s = typeof e.alternateFetch == "function" && e.alternateFetch.length >= 1 ? e.alternateFetch : void 0;
539
- try {
540
- H(t, o, r, s);
541
- } catch (e) {
542
- if (!a || Object.keys(a).length === 0 || !e.message || e.message.indexOf("not implemented") < 0) return r(e);
543
- try {
544
- Object.keys(a).forEach(function(e) {
545
- delete o[e];
546
- }), H(t, o, r, s), U = !0;
547
- } catch (e) {
548
- r(e);
549
- }
550
- }
551
- }, he = function(e, t, n, r) {
552
- n && L(n) === "object" && (n = V("", n).slice(1)), e.queryStringParams && (t = V(t, e.queryStringParams));
553
- try {
554
- var i = z ? new z() : new B("MSXML2.XMLHTTP.3.0");
555
- i.open(n ? "POST" : "GET", t, 1), e.crossDomain || i.setRequestHeader("X-Requested-With", "XMLHttpRequest"), i.withCredentials = !!e.withCredentials, n && i.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), i.overrideMimeType && i.overrideMimeType("application/json");
556
- var a = e.customHeaders;
557
- if (a = typeof a == "function" ? a() : a, a) for (var o in a) i.setRequestHeader(o, a[o]);
558
- i.onreadystatechange = function() {
559
- i.readyState > 3 && r(i.status >= 400 ? i.statusText : null, {
560
- status: i.status,
561
- data: i.responseText
562
- });
563
- }, i.send(n);
564
- } catch (e) {
565
- console && console.log(e);
566
- }
567
- }, ge = function(e, t, n, r) {
568
- if (typeof n == "function" && (r = n, n = void 0), r ||= function() {}, R && t.indexOf("file:") !== 0) return me(e, t, n, r);
569
- if (j() || typeof ActiveXObject == "function") return he(e, t, n, r);
570
- r(/* @__PURE__ */ Error("No fetch and no xhr implementation found!"));
571
- };
572
- //#endregion
573
- //#region ../../node_modules/i18next-http-backend/esm/index.js
574
- function W(e) {
575
- "@babel/helpers - typeof";
576
- return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
577
- return typeof e;
578
- } : function(e) {
579
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
580
- }, W(e);
581
- }
582
- function G(e, t) {
583
- var n = Object.keys(e);
584
- if (Object.getOwnPropertySymbols) {
585
- var r = Object.getOwnPropertySymbols(e);
586
- t && (r = r.filter(function(t) {
587
- return Object.getOwnPropertyDescriptor(e, t).enumerable;
588
- })), n.push.apply(n, r);
589
- }
590
- return n;
591
- }
592
- function K(e) {
593
- for (var t = 1; t < arguments.length; t++) {
594
- var n = arguments[t] == null ? {} : arguments[t];
595
- t % 2 ? G(Object(n), !0).forEach(function(t) {
596
- J(e, t, n[t]);
597
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : G(Object(n)).forEach(function(t) {
598
- Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
599
- });
600
- }
601
- return e;
602
- }
603
- function _e(e, t) {
604
- if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
605
- }
606
- function q(e, t) {
607
- for (var n = 0; n < t.length; n++) {
608
- var r = t[n];
609
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, Y(r.key), r);
610
- }
611
- }
612
- function ve(e, t, n) {
613
- return t && q(e.prototype, t), n && q(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
614
- }
615
- function J(e, t, n) {
616
- return (t = Y(t)) in e ? Object.defineProperty(e, t, {
617
- value: n,
618
- enumerable: !0,
619
- configurable: !0,
620
- writable: !0
621
- }) : e[t] = n, e;
622
- }
623
- function Y(e) {
624
- var t = ye(e, "string");
625
- return W(t) == "symbol" ? t : t + "";
626
- }
627
- function ye(e, t) {
628
- if (W(e) != "object" || !e) return e;
629
- var n = e[Symbol.toPrimitive];
630
- if (n !== void 0) {
631
- var r = n.call(e, t || "default");
632
- if (W(r) != "object") return r;
633
- throw TypeError("@@toPrimitive must return a primitive value.");
634
- }
635
- return (t === "string" ? String : Number)(e);
636
- }
637
- var be = function() {
638
- return {
639
- loadPath: "/locales/{{lng}}/{{ns}}.json",
640
- addPath: "/locales/add/{{lng}}/{{ns}}",
641
- parse: function(e) {
642
- return JSON.parse(e);
643
- },
644
- stringify: JSON.stringify,
645
- parsePayload: function(e, t, n) {
646
- return J({}, t, n || "");
647
- },
648
- parseLoadPayload: function(e, t) {},
649
- request: ge,
650
- reloadInterval: typeof window < "u" ? !1 : 3600 * 1e3,
651
- customHeaders: {},
652
- queryStringParams: {},
653
- crossDomain: !1,
654
- withCredentials: !1,
655
- overrideMimeType: !1,
656
- requestOptions: {
657
- mode: "cors",
658
- credentials: "same-origin",
659
- cache: "default"
660
- }
661
- };
662
- }, X = function() {
663
- function e(t) {
664
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
665
- _e(this, e), this.services = t, this.options = n, this.allOptions = r, this.type = "backend", this.init(t, n, r);
666
- }
667
- return ve(e, [
668
- {
669
- key: "init",
670
- value: function(e) {
671
- var t = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
672
- if (this.services = e, this.options = K(K(K({}, be()), this.options || {}), n), this.allOptions = r, this.services && this.options.reloadInterval) {
673
- var i = setInterval(function() {
674
- return t.reload();
675
- }, this.options.reloadInterval);
676
- W(i) === "object" && typeof i.unref == "function" && i.unref();
677
- }
678
- }
679
- },
680
- {
681
- key: "readMulti",
682
- value: function(e, t, n) {
683
- this._readAny(e, e, t, t, n);
684
- }
685
- },
686
- {
687
- key: "read",
688
- value: function(e, t, n) {
689
- this._readAny([e], e, [t], t, n);
690
- }
691
- },
692
- {
693
- key: "_readAny",
694
- value: function(e, t, n, r, i) {
695
- var a = this, o = this.options.loadPath;
696
- typeof this.options.loadPath == "function" && (o = this.options.loadPath(e, n)), o = pe(o), o.then(function(o) {
697
- if (!o) return i(null, {});
698
- var s = a.services.interpolator.interpolate(o, {
699
- lng: e.join("+"),
700
- ns: n.join("+")
701
- });
702
- a.loadUrl(s, i, t, r);
703
- });
704
- }
705
- },
706
- {
707
- key: "loadUrl",
708
- value: function(e, t, n, r) {
709
- var i = this, a = typeof n == "string" ? [n] : n, o = typeof r == "string" ? [r] : r, s = this.options.parseLoadPayload(a, o);
710
- this.options.request(this.options, e, s, function(a, o) {
711
- if (o && (o.status >= 500 && o.status < 600 || !o.status)) return t("failed loading " + e + "; status code: " + o.status, !0);
712
- if (o && o.status >= 400 && o.status < 500) return t("failed loading " + e + "; status code: " + o.status, !1);
713
- if (!o && a && a.message) {
714
- var s = a.message.toLowerCase();
715
- if ([
716
- "failed",
717
- "fetch",
718
- "network",
719
- "load"
720
- ].find(function(e) {
721
- return s.indexOf(e) > -1;
722
- })) return t("failed loading " + e + ": " + a.message, !0);
723
- }
724
- if (a) return t(a, !1);
725
- var c, l;
726
- try {
727
- c = typeof o.data == "string" ? i.options.parse(o.data, n, r) : o.data;
728
- } catch {
729
- l = "failed parsing " + e + " to json";
730
- }
731
- if (l) return t(l, !1);
732
- t(null, c);
733
- });
734
- }
735
- },
736
- {
737
- key: "create",
738
- value: function(e, t, n, r, i) {
739
- var a = this;
740
- if (this.options.addPath) {
741
- typeof e == "string" && (e = [e]);
742
- var o = this.options.parsePayload(t, n, r), s = 0, c = [], l = [];
743
- e.forEach(function(n) {
744
- var r = a.options.addPath;
745
- typeof a.options.addPath == "function" && (r = a.options.addPath(n, t));
746
- var u = a.services.interpolator.interpolate(r, {
747
- lng: n,
748
- ns: t
749
- });
750
- a.options.request(a.options, u, o, function(t, n) {
751
- s += 1, c.push(t), l.push(n), s === e.length && typeof i == "function" && i(c, l);
752
- });
753
- });
754
- }
755
- }
756
- },
757
- {
758
- key: "reload",
759
- value: function() {
760
- var e = this, t = this.services, n = t.backendConnector, r = t.languageUtils, i = t.logger, a = n.language;
761
- if (!(a && a.toLowerCase() === "cimode")) {
762
- var o = [], s = function(e) {
763
- r.toResolveHierarchy(e).forEach(function(e) {
764
- o.indexOf(e) < 0 && o.push(e);
765
- });
766
- };
767
- s(a), this.allOptions.preload && this.allOptions.preload.forEach(function(e) {
768
- return s(e);
769
- }), o.forEach(function(t) {
770
- e.allOptions.ns.forEach(function(e) {
771
- n.read(t, e, "read", null, null, function(r, a) {
772
- r && i.warn(`loading namespace ${e} for language ${t} failed`, r), !r && a && i.log(`loaded namespace ${e} for language ${t}`, a), n.loaded(`${t}|${e}`, r, a);
773
- });
774
- });
775
- });
776
- }
777
- }
778
- }
779
- ]);
780
- }();
781
- X.type = "backend";
782
- //#endregion
783
- //#region ../../node_modules/i18next-resources-to-backend/dist/esm/index.js
784
- var xe = [
785
- "__proto__",
786
- "constructor",
787
- "prototype"
788
- ], Z = function(e, t) {
789
- return !(typeof e != "string" || e.length > 128 || xe.indexOf(e) > -1 || e.indexOf("..") > -1 || e.indexOf("\\") > -1 || !t && e.indexOf("/") > -1 || /[\x00-\x1F\x7F]/.test(e));
790
- }, Se = function(e) {
791
- return {
792
- type: "backend",
793
- init: function(e, t, n) {},
794
- read: function(t, n, r) {
795
- if (!Z(t, !1) || !Z(n, !0)) return r(/* @__PURE__ */ Error("i18next-resources-to-backend: unsafe language/namespace value"), !1);
796
- if (typeof e == "function") {
797
- if (e.length < 3) {
798
- try {
799
- var i = e(t, n);
800
- i && typeof i.then == "function" ? i.then(function(e) {
801
- return r(null, e && e.default || e);
802
- }).catch(r) : r(null, i);
803
- } catch (e) {
804
- r(e);
805
- }
806
- return;
807
- }
808
- e(t, n, r);
809
- return;
810
- }
811
- r(null, e && e[t] && e[t][n]);
812
- }
813
- };
814
- }, Ce = { detection: {
815
- order: [
816
- "navigator",
817
- "htmlTag",
818
- "path",
819
- "subdomain"
820
- ],
821
- caches: ["localStorage", "cookie"]
822
- } }, Q = (e, t) => {
823
- let n = import.meta.url.split("/").pop();
824
- return `${import.meta.url.replace(`/${n}`, "")}/locales/${e}/${t}.json`;
825
- };
826
- function $(n, r) {
827
- if (t.isInitialized) n?.(t);
828
- else {
829
- t.use(O).use(new S(null, {
830
- order: [
831
- "cookie",
832
- "localStorage",
833
- "navigator"
834
- ],
835
- lookupQuerystring: "lng",
836
- lookupCookie: "i18next",
837
- lookupLocalStorage: "i18nextLng",
838
- caches: ["localStorage", "cookie"]
839
- })).init({
840
- ...e,
841
- ...r ? { lng: r } : {},
842
- backend: {
843
- backends: [X, Se((e, t) => import(Q(e, t)))],
844
- backendOptions: [{ loadPath: Q("{{lng}}", "{{ns}}") }]
845
- },
846
- ...Ce
847
- });
848
- let i = !1;
849
- t.on("loaded", () => {
850
- i || (i = !0, n?.(t));
851
- });
852
- }
853
- return t;
854
- }
855
- //#endregion
856
- export { $ as default, $ as initializeI18n };