gt-react 10.19.16 → 10.19.18

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/index.cjs CHANGED
@@ -23,8 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  let _generaltranslation_react_core = require("@generaltranslation/react-core");
25
25
  let react = require("react");
26
- let react$1 = __toESM(react, 1);
27
- react = __toESM(react);
26
+ react = __toESM(react, 1);
28
27
  let _generaltranslation_format = require("@generaltranslation/format");
29
28
  let react_jsx_runtime = require("react/jsx-runtime");
30
29
  require("generaltranslation");
@@ -43,27 +42,41 @@ function readAuthFromEnv({ projectId, devApiKey }) {
43
42
  };
44
43
  }
45
44
  //#endregion
45
+ //#region src/shared/cookies.ts
46
+ /**
47
+ * Minimally parses a cookie value for a given cookie name.
48
+ * @param cookieName - The name of the cookie
49
+ * @returns The cookie value, or undefined when it is not found
50
+ */
51
+ function getCookieValue(cookieName) {
52
+ if (typeof document === "undefined") return void 0;
53
+ return document.cookie.split("; ").find((row) => row.startsWith(`${cookieName}=`))?.split("=")[1];
54
+ }
55
+ /**
56
+ * Sets a cookie value for a given cookie name.
57
+ * @param cookieName - The name of the cookie
58
+ * @param value - The value to set
59
+ */
60
+ function setCookieValue(cookieName, value) {
61
+ if (typeof document === "undefined") return;
62
+ document.cookie = `${cookieName}=${value};path=/`;
63
+ }
64
+ //#endregion
46
65
  //#region src/react-context/provider/hooks/useRegionState.ts
47
- function getNewRegion({ _region, regionCookieName }) {
48
- const cookieRegion = typeof document !== "undefined" ? document.cookie.split("; ").find((row) => row.startsWith(`${regionCookieName}=`))?.split("=")[1] : void 0;
66
+ function getNewRegion(_region, regionCookieName) {
67
+ const cookieRegion = getCookieValue(regionCookieName);
49
68
  const newRegion = _region || cookieRegion;
50
- if (cookieRegion && cookieRegion !== newRegion && typeof document !== "undefined") document.cookie = `${regionCookieName}=${newRegion};path=/`;
69
+ if (cookieRegion && cookieRegion !== newRegion) setCookieValue(regionCookieName, newRegion || "");
51
70
  return newRegion;
52
71
  }
53
72
  function useRegionState({ _region, ssr, regionCookieName }) {
54
- const [region, _setRegion] = (0, react.useState)(ssr ? void 0 : getNewRegion({
55
- _region,
56
- regionCookieName
57
- }));
73
+ const [region, _setRegion] = (0, react.useState)(ssr ? void 0 : getNewRegion(_region, regionCookieName));
58
74
  const setRegion = (region) => {
59
75
  _setRegion(region);
60
- if (typeof document !== "undefined") document.cookie = `${regionCookieName}=${region || ""};path=/`;
76
+ setCookieValue(regionCookieName, region || "");
61
77
  };
62
78
  (0, react.useEffect)(() => {
63
- _setRegion(getNewRegion({
64
- _region,
65
- regionCookieName
66
- }));
79
+ _setRegion(getNewRegion(_region, regionCookieName));
67
80
  }, [_region, regionCookieName]);
68
81
  return {
69
82
  region,
@@ -82,16 +95,15 @@ function useRegionState({ _region, ssr, regionCookieName }) {
82
95
  function useEnableI18n({ enableI18n: _enableI18n, enableI18nCookieName, enableI18nLoaded, ssr }) {
83
96
  const asyncEnabled = enableI18nLoaded !== void 0;
84
97
  const isFirstRender = (0, react.useRef)(true);
85
- const [enableI18n, setEnableI18n] = (0, react.useState)(() => getInitialEnableI18n({
86
- _enableI18n,
87
- asyncEnabled,
88
- enableI18nCookieName,
89
- ssr
90
- }));
98
+ const getCookieEnableI18nValue = () => {
99
+ const rawCookieValue = getCookieValue(enableI18nCookieName);
100
+ return rawCookieValue === "true" ? true : rawCookieValue === "false" ? false : null;
101
+ };
102
+ const [enableI18n, setEnableI18n] = (0, react.useState)(() => !asyncEnabled || ssr ? _enableI18n : getCookieEnableI18nValue() ?? _enableI18n);
91
103
  (0, react.useEffect)(() => {
92
104
  if (ssr && asyncEnabled && isFirstRender.current) {
93
105
  isFirstRender.current = false;
94
- const cookieValue = getCookieEnableI18nValue(enableI18nCookieName);
106
+ const cookieValue = getCookieEnableI18nValue();
95
107
  if (cookieValue !== null && cookieValue !== enableI18n) setEnableI18n(cookieValue);
96
108
  return;
97
109
  }
@@ -109,10 +121,7 @@ function useEnableI18n({ enableI18n: _enableI18n, enableI18nCookieName, enableI1
109
121
  return;
110
122
  }
111
123
  if (!enableI18nLoaded) return;
112
- persistEnableI18nFlagToCookie({
113
- enableI18n: _enableI18n,
114
- enableI18nCookieName
115
- });
124
+ setCookieValue(enableI18nCookieName, _enableI18n ? "true" : "false");
116
125
  setEnableI18n(_enableI18n);
117
126
  }, [
118
127
  _enableI18n,
@@ -123,31 +132,133 @@ function useEnableI18n({ enableI18n: _enableI18n, enableI18nCookieName, enableI1
123
132
  ]);
124
133
  return { enableI18n };
125
134
  }
126
- /**
127
- * Get initial enableI18n flag
128
- */
129
- function getInitialEnableI18n({ _enableI18n, asyncEnabled, enableI18nCookieName, ssr }) {
130
- if (!asyncEnabled) return _enableI18n;
131
- if (ssr) return _enableI18n;
132
- const cookieValue = getCookieEnableI18nValue(enableI18nCookieName);
133
- if (cookieValue !== null) return cookieValue;
134
- return _enableI18n;
135
- }
136
- function getCookieEnableI18nValue(enableI18nCookieName) {
137
- if (typeof document === "undefined") return null;
138
- const rawCookieValue = document.cookie.split("; ").find((row) => row.startsWith(`${enableI18nCookieName}=`))?.split("=")[1];
139
- return rawCookieValue === "true" ? true : rawCookieValue === "false" ? false : null;
140
- }
141
- function persistEnableI18nFlagToCookie({ enableI18n, enableI18nCookieName }) {
142
- if (typeof document === "undefined") return;
143
- document.cookie = `${enableI18nCookieName}=${enableI18n ? "true" : "false"};path=/;`;
135
+ //#endregion
136
+ //#region ../core/dist/base64-r7YWJYWt.mjs
137
+ function ensureSentence(text) {
138
+ const trimmed = text.trim();
139
+ if (!trimmed) return "";
140
+ return /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;
141
+ }
142
+ function stripSentence(text) {
143
+ const trimmed = text.trim();
144
+ let end = trimmed.length;
145
+ while (end > 0) {
146
+ const char = trimmed[end - 1];
147
+ if (char !== "." && char !== "!" && char !== "?") break;
148
+ end -= 1;
149
+ }
150
+ return trimmed.slice(0, end);
151
+ }
152
+ function lowercaseFirstWord(text) {
153
+ return text.replace(/^[A-Z][a-z]/, (match) => match.toLowerCase());
154
+ }
155
+ function formatDetails(details) {
156
+ if (!details) return "";
157
+ const detailText = Array.isArray(details) ? details.join(", ") : details;
158
+ if (!detailText.trim()) return "";
159
+ return ensureSentence(`Details: ${detailText}`);
160
+ }
161
+ function createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {
162
+ const prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : "";
163
+ const whatAndWhy = why ? `${stripSentence(whatHappened)} because ${lowercaseFirstWord(stripSentence(why))}` : whatHappened;
164
+ const shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));
165
+ const messageParts = [
166
+ whatAndWhy,
167
+ reassurance,
168
+ shouldCombineWayOut ? `${stripSentence(fix)}, or ${lowercaseFirstWord(stripSentence(wayOut))}` : fix,
169
+ shouldCombineWayOut ? void 0 : wayOut,
170
+ formatDetails(details)
171
+ ].filter((part) => !!part).map(ensureSentence);
172
+ if (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);
173
+ const message = messageParts.join(" ");
174
+ return prefix ? `${prefix} ${message}` : message;
144
175
  }
145
176
  //#endregion
146
177
  //#region ../react-core/dist/errors.esm.min.mjs
147
- const e = `@generaltranslation/react-core`;
148
- `${e}`, `${e}`, `${e}`, `${e}`, `${e}`, `${e}`, `${e}`, `${e}`, `${e}`;
149
- const t$1 = (t, n, r = e) => `${r} Warning: "${n}" is not a supported locale. Update supported locales in your dashboard or gt.config.json. Falling back to "${t}".`;
150
- `${e}`, `${e}`;
178
+ function e(e) {
179
+ let t = e.trim();
180
+ return t ? /[.!?)]$/.test(t) ? t : `${t}.` : ``;
181
+ }
182
+ function t$1(e) {
183
+ let t = e.trim(), n = t.length;
184
+ for (; n > 0;) {
185
+ let e = t[n - 1];
186
+ if (e !== `.` && e !== `!` && e !== `?`) break;
187
+ --n;
188
+ }
189
+ return t.slice(0, n);
190
+ }
191
+ function n$1(e) {
192
+ return e.replace(/^[A-Z][a-z]/, (e) => e.toLowerCase());
193
+ }
194
+ function r$1(t) {
195
+ if (!t) return ``;
196
+ let n = Array.isArray(t) ? t.join(`, `) : t;
197
+ return n.trim() ? e(`Details: ${n}`) : ``;
198
+ }
199
+ function i$1({ source: i, severity: a, whatHappened: o, reassurance: s, why: c, fix: l, wayOut: u, details: d, docsUrl: f }) {
200
+ let p = i ? a ? `${i} ${a}:` : `${i}:` : a ? `${a}:` : ``, m = c ? `${t$1(o)} because ${n$1(t$1(c))}` : o, h = !!l && !!u && /^[a-z]/.test(t$1(u)), g = [
201
+ m,
202
+ s,
203
+ h ? `${t$1(l)}, or ${n$1(t$1(u))}` : l,
204
+ h ? void 0 : u,
205
+ r$1(d)
206
+ ].filter((e) => !!e).map(e);
207
+ f && g.push(`Learn more: ${f}`);
208
+ let _ = g.join(` `);
209
+ return p ? `${p} ${_}` : _;
210
+ }
211
+ const a$1 = `@generaltranslation/react-core`;
212
+ function o$1(e) {
213
+ return i$1({
214
+ source: a$1,
215
+ ...e
216
+ });
217
+ }
218
+ o$1({
219
+ severity: `Error`,
220
+ whatHappened: `Runtime translation needs a project ID`,
221
+ fix: `Add projectId to your <GTProvider> configuration or set GT_PROJECT_ID in your environment`,
222
+ docsUrl: `https://generaltranslation.com/dashboard`
223
+ }), o$1({
224
+ severity: `Error`,
225
+ whatHappened: `Production environments cannot use a development API key`,
226
+ fix: `Replace it with a production API key before deploying`
227
+ }), o$1({
228
+ severity: `Error`,
229
+ whatHappened: `The API key is available to client-side production code`,
230
+ fix: `Move translation credentials to a server-only environment before deploying`
231
+ }), o$1({
232
+ severity: `Error`,
233
+ whatHappened: `Runtime translation is not configured`,
234
+ fix: `Add projectId and devApiKey to your environment, or pass them to <GTProvider> directly`
235
+ }), o$1({
236
+ severity: `Error`,
237
+ whatHappened: `Runtime translations could not be loaded`,
238
+ wayOut: `Source content will render as a fallback`,
239
+ fix: `Check your runtime translation configuration and try again`
240
+ }), o$1({
241
+ severity: `Error`,
242
+ whatHappened: `Runtime translation could not be completed`
243
+ }), o$1({
244
+ severity: `Warning`,
245
+ whatHappened: `Runtime translation needs a project ID`,
246
+ fix: `Add projectId to <GTProvider> or set GT_PROJECT_ID in your environment`,
247
+ docsUrl: `https://generaltranslation.com/dashboard`
248
+ }), o$1({
249
+ severity: `Warning`,
250
+ whatHappened: `Runtime translation needs a development API key`,
251
+ fix: `Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation`
252
+ }), o$1({
253
+ severity: `Warning`,
254
+ whatHappened: `Runtime translation timed out`
255
+ });
256
+ const s$1 = (e, t, n = a$1) => `${n} Warning: "${t}" is not a supported locale. Update supported locales in your dashboard or gt.config.json. Falling back to "${e}".`;
257
+ o$1({
258
+ severity: `Warning`,
259
+ whatHappened: `No dictionary was found`,
260
+ fix: `Pass a dictionary to <GTProvider> or configure a dictionary loader before rendering translations`
261
+ }), `${a$1}`;
151
262
  //#endregion
152
263
  //#region ../react-core/dist/internal.esm.min.mjs
153
264
  var c = Object.defineProperty, l = Object.getOwnPropertyDescriptor, u = Object.getOwnPropertyNames, d = Object.prototype.hasOwnProperty, f = (e, t) => () => (e && (t = e(e = 0)), t), p = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), m = (e, t) => {
@@ -164,43 +275,76 @@ var c = Object.defineProperty, l = Object.getOwnPropertyDescriptor, u = Object.g
164
275
  });
165
276
  return e;
166
277
  }, g = (e) => d.call(e, `module.exports`) ? e[`module.exports`] : h(c({}, `__esModule`, { value: !0 }), e);
167
- function w(e) {
278
+ function b(e) {
279
+ let t = e.trim();
280
+ return t ? /[.!?)]$/.test(t) ? t : `${t}.` : ``;
281
+ }
282
+ function x(e) {
283
+ let t = e.trim(), n = t.length;
284
+ for (; n > 0;) {
285
+ let e = t[n - 1];
286
+ if (e !== `.` && e !== `!` && e !== `?`) break;
287
+ --n;
288
+ }
289
+ return t.slice(0, n);
290
+ }
291
+ function te(e) {
292
+ return e.replace(/^[A-Z][a-z]/, (e) => e.toLowerCase());
293
+ }
294
+ function ne(e) {
295
+ if (!e) return ``;
296
+ let t = Array.isArray(e) ? e.join(`, `) : e;
297
+ return t.trim() ? b(`Details: ${t}`) : ``;
298
+ }
299
+ function S({ source: e, severity: t, whatHappened: n, reassurance: r, why: i, fix: a, wayOut: o, details: s, docsUrl: c }) {
300
+ let l = e ? t ? `${e} ${t}:` : `${e}:` : t ? `${t}:` : ``, u = i ? `${x(n)} because ${te(x(i))}` : n, d = !!a && !!o && /^[a-z]/.test(x(o)), f = [
301
+ u,
302
+ r,
303
+ d ? `${x(a)}, or ${te(x(o))}` : a,
304
+ d ? void 0 : o,
305
+ ne(s)
306
+ ].filter((e) => !!e).map(b);
307
+ c && f.push(`Learn more: ${c}`);
308
+ let p = f.join(` `);
309
+ return l ? `${l} ${p}` : p;
310
+ }
311
+ function ie(e) {
168
312
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === `Uint8Array` && `BYTES_PER_ELEMENT` in e && e.BYTES_PER_ELEMENT === 1;
169
313
  }
170
- function T$1(e, t, n = ``) {
171
- let r = w(e), i = e?.length, a = t !== void 0;
314
+ function D(e, t, n = ``) {
315
+ let r = ie(e), i = e?.length, a = t !== void 0;
172
316
  if (!r || a && i !== t) {
173
317
  let o = n && `"${n}" `, s = a ? ` of length ${t}` : ``, c = r ? `length=${i}` : `type=${typeof e}`, l = o + `expected Uint8Array` + s + `, got ` + c;
174
318
  throw r ? RangeError(l) : TypeError(l);
175
319
  }
176
320
  return e;
177
321
  }
178
- function E(e, t = !0) {
322
+ function ae(e, t = !0) {
179
323
  if (e.destroyed) throw Error(`Hash instance has been destroyed`);
180
324
  if (t && e.finished) throw Error(`Hash#digest() has already been called`);
181
325
  }
182
- function D(e, t) {
183
- T$1(e, void 0, `digestInto() output`);
326
+ function oe(e, t) {
327
+ D(e, void 0, `digestInto() output`);
184
328
  let n = t.outputLen;
185
329
  if (e.length < n) throw RangeError(`"digestInto() output" expected to be of length >=` + n);
186
330
  }
187
- function O(...e) {
331
+ function se(...e) {
188
332
  for (let t = 0; t < e.length; t++) e[t].fill(0);
189
333
  }
190
- function k(e) {
334
+ function ce(e) {
191
335
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
192
336
  }
193
- function A(e, t) {
337
+ function O(e, t) {
194
338
  return e << 32 - t | e >>> t;
195
339
  }
196
340
  new Uint8Array(new Uint32Array([287454020]).buffer)[0];
197
341
  typeof Uint8Array.from([]).toHex == `function` && Uint8Array.fromHex;
198
342
  Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, `0`));
199
- function oe(e, t = {}) {
343
+ function pe(e, t = {}) {
200
344
  let n = (t, n) => e(n).update(t).digest(), r = e(void 0);
201
345
  return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.canXOF = r.canXOF, n.create = (t) => e(t), Object.assign(n, t), Object.freeze(n);
202
346
  }
203
- const se = (e) => ({ oid: Uint8Array.from([
347
+ const me = (e) => ({ oid: Uint8Array.from([
204
348
  6,
205
349
  9,
206
350
  96,
@@ -213,13 +357,13 @@ const se = (e) => ({ oid: Uint8Array.from([
213
357
  2,
214
358
  e
215
359
  ]) });
216
- function ce(e, t, n) {
360
+ function he(e, t, n) {
217
361
  return e & t ^ ~e & n;
218
362
  }
219
- function le(e, t, n) {
363
+ function ge(e, t, n) {
220
364
  return e & t ^ e & n ^ t & n;
221
365
  }
222
- var ue = class {
366
+ var _e = class {
223
367
  blockLen;
224
368
  outputLen;
225
369
  canXOF = !1;
@@ -232,15 +376,15 @@ var ue = class {
232
376
  pos = 0;
233
377
  destroyed = !1;
234
378
  constructor(e, t, n, r) {
235
- this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = k(this.buffer);
379
+ this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = ce(this.buffer);
236
380
  }
237
381
  update(e) {
238
- E(this), T$1(e);
382
+ ae(this), D(e);
239
383
  let { view: t, buffer: n, blockLen: r } = this, i = e.length;
240
384
  for (let a = 0; a < i;) {
241
385
  let o = Math.min(r - this.pos, i - a);
242
386
  if (o === r) {
243
- let t = k(e);
387
+ let t = ce(e);
244
388
  for (; r <= i - a; a += r) this.process(t, a);
245
389
  continue;
246
390
  }
@@ -249,12 +393,12 @@ var ue = class {
249
393
  return this.length += e.length, this.roundClean(), this;
250
394
  }
251
395
  digestInto(e) {
252
- E(this), D(e, this), this.finished = !0;
396
+ ae(this), oe(e, this), this.finished = !0;
253
397
  let { buffer: t, view: n, blockLen: r, isLE: i } = this, { pos: a } = this;
254
- t[a++] = 128, O(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0);
398
+ t[a++] = 128, se(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0);
255
399
  for (let e = a; e < r; e++) t[e] = 0;
256
400
  n.setBigUint64(r - 8, BigInt(this.length * 8), i), this.process(n, 0);
257
- let o = k(e), s = this.outputLen;
401
+ let o = ce(e), s = this.outputLen;
258
402
  if (s % 4) throw Error(`_sha2: outputLen must be aligned to 32bit`);
259
403
  let c = s / 4, l = this.get();
260
404
  if (c > l.length) throw Error(`_sha2: outputLen bigger than state`);
@@ -275,7 +419,7 @@ var ue = class {
275
419
  return this._cloneInto();
276
420
  }
277
421
  };
278
- const j = Uint32Array.from([
422
+ const k = Uint32Array.from([
279
423
  1779033703,
280
424
  3144134277,
281
425
  1013904242,
@@ -284,25 +428,25 @@ const j = Uint32Array.from([
284
428
  2600822924,
285
429
  528734635,
286
430
  1541459225
287
- ]), M = BigInt(2 ** 32 - 1), de = BigInt(32);
288
- function fe(e, t = !1) {
431
+ ]), A = BigInt(2 ** 32 - 1), ve = BigInt(32);
432
+ function ye(e, t = !1) {
289
433
  return t ? {
290
- h: Number(e & M),
291
- l: Number(e >> de & M)
434
+ h: Number(e & A),
435
+ l: Number(e >> ve & A)
292
436
  } : {
293
- h: Number(e >> de & M) | 0,
294
- l: Number(e & M) | 0
437
+ h: Number(e >> ve & A) | 0,
438
+ l: Number(e & A) | 0
295
439
  };
296
440
  }
297
- function pe(e, t = !1) {
441
+ function be(e, t = !1) {
298
442
  let n = e.length, r = new Uint32Array(n), i = new Uint32Array(n);
299
443
  for (let a = 0; a < n; a++) {
300
- let { h: n, l: o } = fe(e[a], t);
444
+ let { h: n, l: o } = ye(e[a], t);
301
445
  [r[a], i[a]] = [n, o];
302
446
  }
303
447
  return [r, i];
304
448
  }
305
- const me = Uint32Array.from([
449
+ const xe = Uint32Array.from([
306
450
  1116352408,
307
451
  1899447441,
308
452
  3049323471,
@@ -367,8 +511,8 @@ const me = Uint32Array.from([
367
511
  2756734187,
368
512
  3204031479,
369
513
  3329325298
370
- ]), N = new Uint32Array(64);
371
- var he = class extends ue {
514
+ ]), j = new Uint32Array(64);
515
+ var Se = class extends _e {
372
516
  constructor(e) {
373
517
  super(64, e, 8, !1);
374
518
  }
@@ -389,41 +533,41 @@ var he = class extends ue {
389
533
  this.A = e | 0, this.B = t | 0, this.C = n | 0, this.D = r | 0, this.E = i | 0, this.F = a | 0, this.G = o | 0, this.H = s | 0;
390
534
  }
391
535
  process(e, t) {
392
- for (let n = 0; n < 16; n++, t += 4) N[n] = e.getUint32(t, !1);
536
+ for (let n = 0; n < 16; n++, t += 4) j[n] = e.getUint32(t, !1);
393
537
  for (let e = 16; e < 64; e++) {
394
- let t = N[e - 15], n = N[e - 2], r = A(t, 7) ^ A(t, 18) ^ t >>> 3;
395
- N[e] = (A(n, 17) ^ A(n, 19) ^ n >>> 10) + N[e - 7] + r + N[e - 16] | 0;
538
+ let t = j[e - 15], n = j[e - 2], r = O(t, 7) ^ O(t, 18) ^ t >>> 3;
539
+ j[e] = (O(n, 17) ^ O(n, 19) ^ n >>> 10) + j[e - 7] + r + j[e - 16] | 0;
396
540
  }
397
541
  let { A: n, B: r, C: i, D: a, E: o, F: s, G: c, H: l } = this;
398
542
  for (let e = 0; e < 64; e++) {
399
- let t = A(o, 6) ^ A(o, 11) ^ A(o, 25), u = l + t + ce(o, s, c) + me[e] + N[e] | 0, d = (A(n, 2) ^ A(n, 13) ^ A(n, 22)) + le(n, r, i) | 0;
543
+ let t = O(o, 6) ^ O(o, 11) ^ O(o, 25), u = l + t + he(o, s, c) + xe[e] + j[e] | 0, d = (O(n, 2) ^ O(n, 13) ^ O(n, 22)) + ge(n, r, i) | 0;
400
544
  l = c, c = s, s = o, o = a + u | 0, a = i, i = r, r = n, n = u + d | 0;
401
545
  }
402
546
  n = n + this.A | 0, r = r + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, s = s + this.F | 0, c = c + this.G | 0, l = l + this.H | 0, this.set(n, r, i, a, o, s, c, l);
403
547
  }
404
548
  roundClean() {
405
- O(N);
549
+ se(j);
406
550
  }
407
551
  destroy() {
408
- this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), O(this.buffer);
409
- }
410
- }, ge = class extends he {
411
- A = j[0] | 0;
412
- B = j[1] | 0;
413
- C = j[2] | 0;
414
- D = j[3] | 0;
415
- E = j[4] | 0;
416
- F = j[5] | 0;
417
- G = j[6] | 0;
418
- H = j[7] | 0;
552
+ this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), se(this.buffer);
553
+ }
554
+ }, Ce = class extends Se {
555
+ A = k[0] | 0;
556
+ B = k[1] | 0;
557
+ C = k[2] | 0;
558
+ D = k[3] | 0;
559
+ E = k[4] | 0;
560
+ F = k[5] | 0;
561
+ G = k[6] | 0;
562
+ H = k[7] | 0;
419
563
  constructor() {
420
564
  super(32);
421
565
  }
422
566
  };
423
- const _e = pe(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map((e) => BigInt(e)));
424
- _e[0], _e[1];
425
- oe(() => new ge(), se(1));
426
- const ye = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${e}.`, be = `DEFAULT_TERMINATOR_KEY`, xe = {
567
+ const we = be(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map((e) => BigInt(e)));
568
+ we[0], we[1];
569
+ pe(() => new Ce(), me(1));
570
+ const Ee = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${e}.`, De = `DEFAULT_TERMINATOR_KEY`, Oe = {
427
571
  ellipsis: {
428
572
  fr: {
429
573
  terminator: `…`,
@@ -437,37 +581,35 @@ const ye = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${
437
581
  terminator: `……`,
438
582
  separator: void 0
439
583
  },
440
- [be]: {
584
+ [De]: {
441
585
  terminator: `…`,
442
586
  separator: void 0
443
587
  }
444
588
  },
445
- none: { [be]: {
589
+ none: { [De]: {
446
590
  terminator: void 0,
447
591
  separator: void 0
448
592
  } }
449
593
  };
450
- var Se = class {
451
- constructor(e, t = {}) {
594
+ var ke = class e {
595
+ static resolveLocale(e) {
452
596
  try {
453
- let t = e ? Array.isArray(e) ? e.map((e) => String(e)) : [String(e)] : [`en`], n = Intl.getCanonicalLocales(t);
454
- this.locale = n.length ? n[0] : `en`;
597
+ let t = e ? Array.isArray(e) ? e.map(String) : [String(e)] : [`en`], [n] = Intl.getCanonicalLocales(t);
598
+ return n ?? `en`;
455
599
  } catch {
456
- this.locale = `en`;
457
- }
458
- if (!xe[t.style ?? `ellipsis`]) throw Error(ye(t.style ?? `ellipsis`));
459
- let n, r;
460
- if (t.maxChars !== void 0) {
461
- n = t.style ?? `ellipsis`;
462
- let e = new Intl.Locale(this.locale).language;
463
- r = xe[n][e] || xe[n].DEFAULT_TERMINATOR_KEY;
600
+ return `en`;
464
601
  }
465
- let i = t.terminator ?? r?.terminator, a = i == null ? void 0 : t.separator ?? r?.separator;
466
- this.additionLength = (i?.length ?? 0) + (a?.length ?? 0), t.maxChars !== void 0 && Math.abs(t.maxChars) < this.additionLength && (i = void 0, a = void 0), this.options = {
467
- maxChars: t.maxChars,
468
- style: n,
469
- terminator: i,
470
- separator: a
602
+ }
603
+ constructor(t, n = {}) {
604
+ this.locale = e.resolveLocale(t);
605
+ let r = n.style ?? `ellipsis`;
606
+ if (!Oe[r]) throw Error(Ee(r));
607
+ let i = n.maxChars === void 0 ? void 0 : Oe[r][new Intl.Locale(this.locale).language] || Oe[r].DEFAULT_TERMINATOR_KEY, a = n.terminator ?? i?.terminator, o = a == null ? void 0 : n.separator ?? i?.separator;
608
+ this.additionLength = (a?.length ?? 0) + (o?.length ?? 0), n.maxChars !== void 0 && Math.abs(n.maxChars) < this.additionLength && (a = void 0, o = void 0), this.options = {
609
+ maxChars: n.maxChars,
610
+ style: n.maxChars === void 0 ? void 0 : r,
611
+ terminator: a,
612
+ separator: o
471
613
  };
472
614
  }
473
615
  format(e) {
@@ -489,7 +631,7 @@ var Se = class {
489
631
  return this.options;
490
632
  }
491
633
  };
492
- const Ce = {
634
+ const Ae = {
493
635
  Collator: Intl.Collator,
494
636
  DateTimeFormat: Intl.DateTimeFormat,
495
637
  DisplayNames: Intl.DisplayNames,
@@ -499,81 +641,83 @@ const Ce = {
499
641
  PluralRules: Intl.PluralRules,
500
642
  RelativeTimeFormat: Intl.RelativeTimeFormat,
501
643
  Segmenter: Intl.Segmenter,
502
- CutoffFormat: Se
644
+ CutoffFormat: ke
503
645
  };
504
646
  new class {
505
647
  constructor() {
506
648
  this.cache = {};
507
649
  }
508
- _generateKey(e, t = {}) {
650
+ generateKey(e, t = {}) {
509
651
  return `${e ? Array.isArray(e) ? e.map((e) => String(e)).join(`,`) : String(e) : `undefined`}:${t ? JSON.stringify(t, Object.keys(t).sort()) : `{}`}`;
510
652
  }
511
653
  get(e, ...t) {
512
- let [n = `en`, r = {}] = t, i = this._generateKey(n, r), a = this.cache[e]?.[i];
513
- return a === void 0 && (a = new Ce[e](...t), this.cache[e] || (this.cache[e] = {}), this.cache[e][i] = a), a;
654
+ let [n = `en`, r = {}] = t, i = this.generateKey(n, r), a = this.cache[e];
655
+ a === void 0 && (a = {}, this.cache[e] = a);
656
+ let o = a[i];
657
+ return o === void 0 && (o = new Ae[e](...t), a[i] = o), o;
514
658
  }
515
659
  }();
516
- var P = m({
517
- __addDisposableResource: () => Ze,
518
- __assign: () => R,
519
- __asyncDelegator: () => Ue,
520
- __asyncGenerator: () => He,
521
- __asyncValues: () => We,
522
- __await: () => I,
523
- __awaiter: () => Fe,
524
- __classPrivateFieldGet: () => Je,
525
- __classPrivateFieldIn: () => Xe,
526
- __classPrivateFieldSet: () => Ye,
527
- __createBinding: () => z,
528
- __decorate: () => Oe,
529
- __disposeResources: () => Qe,
530
- __esDecorate: () => Ae,
531
- __exportStar: () => Le,
532
- __extends: () => Ee,
533
- __generator: () => Ie,
534
- __importDefault: () => qe,
535
- __importStar: () => Ke,
536
- __makeTemplateObject: () => Ge,
537
- __metadata: () => Pe,
538
- __param: () => ke,
539
- __propKey: () => Me,
540
- __read: () => Re,
541
- __rest: () => De,
542
- __rewriteRelativeImportExtension: () => $e,
543
- __runInitializers: () => je,
544
- __setFunctionName: () => Ne,
545
- __spread: () => ze,
546
- __spreadArray: () => Ve,
547
- __spreadArrays: () => Be,
548
- __values: () => F,
549
- default: () => nt
660
+ var M = m({
661
+ __addDisposableResource: () => it,
662
+ __assign: () => F,
663
+ __asyncDelegator: () => Xe,
664
+ __asyncGenerator: () => Ye,
665
+ __asyncValues: () => Ze,
666
+ __await: () => P,
667
+ __awaiter: () => He,
668
+ __classPrivateFieldGet: () => tt,
669
+ __classPrivateFieldIn: () => rt,
670
+ __classPrivateFieldSet: () => nt,
671
+ __createBinding: () => I,
672
+ __decorate: () => Fe,
673
+ __disposeResources: () => at,
674
+ __esDecorate: () => Le,
675
+ __exportStar: () => We,
676
+ __extends: () => Ne,
677
+ __generator: () => Ue,
678
+ __importDefault: () => et,
679
+ __importStar: () => $e,
680
+ __makeTemplateObject: () => Qe,
681
+ __metadata: () => Ve,
682
+ __param: () => Ie,
683
+ __propKey: () => ze,
684
+ __read: () => Ge,
685
+ __rest: () => Pe,
686
+ __rewriteRelativeImportExtension: () => ot,
687
+ __runInitializers: () => Re,
688
+ __setFunctionName: () => Be,
689
+ __spread: () => Ke,
690
+ __spreadArray: () => Je,
691
+ __spreadArrays: () => qe,
692
+ __values: () => N,
693
+ default: () => ut
550
694
  });
551
- function Ee(e, t) {
695
+ function Ne(e, t) {
552
696
  if (typeof t != `function` && t !== null) throw TypeError(`Class extends value ` + String(t) + ` is not a constructor or null`);
553
- L(e, t);
697
+ st(e, t);
554
698
  function n() {
555
699
  this.constructor = e;
556
700
  }
557
701
  e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
558
702
  }
559
- function De(e, t) {
703
+ function Pe(e, t) {
560
704
  var n = {};
561
705
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
562
706
  if (e != null && typeof Object.getOwnPropertySymbols == `function`) for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++) t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
563
707
  return n;
564
708
  }
565
- function Oe(e, t, n, r) {
709
+ function Fe(e, t, n, r) {
566
710
  var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
567
711
  if (typeof Reflect == `object` && typeof Reflect.decorate == `function`) a = Reflect.decorate(e, t, n, r);
568
712
  else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
569
713
  return i > 3 && a && Object.defineProperty(t, n, a), a;
570
714
  }
571
- function ke(e, t) {
715
+ function Ie(e, t) {
572
716
  return function(n, r) {
573
717
  t(n, r, e);
574
718
  };
575
719
  }
576
- function Ae(e, t, n, r, i, a) {
720
+ function Le(e, t, n, r, i, a) {
577
721
  function o(e) {
578
722
  if (e !== void 0 && typeof e != `function`) throw TypeError(`Function expected`);
579
723
  return e;
@@ -598,23 +742,23 @@ function Ae(e, t, n, r, i, a) {
598
742
  }
599
743
  l && Object.defineProperty(l, r.name, u), f = !0;
600
744
  }
601
- function je(e, t, n) {
745
+ function Re(e, t, n) {
602
746
  for (var r = arguments.length > 2, i = 0; i < t.length; i++) n = r ? t[i].call(e, n) : t[i].call(e);
603
747
  return r ? n : void 0;
604
748
  }
605
- function Me(e) {
749
+ function ze(e) {
606
750
  return typeof e == `symbol` ? e : `${e}`;
607
751
  }
608
- function Ne(e, t, n) {
752
+ function Be(e, t, n) {
609
753
  return typeof t == `symbol` && (t = t.description ? `[${t.description}]` : ``), Object.defineProperty(e, `name`, {
610
754
  configurable: !0,
611
755
  value: n ? `${n} ${t}` : t
612
756
  });
613
757
  }
614
- function Pe(e, t) {
758
+ function Ve(e, t) {
615
759
  if (typeof Reflect == `object` && typeof Reflect.metadata == `function`) return Reflect.metadata(e, t);
616
760
  }
617
- function Fe(e, t, n, r) {
761
+ function He(e, t, n, r) {
618
762
  function i(e) {
619
763
  return e instanceof n ? e : new n(function(t) {
620
764
  t(e);
@@ -641,7 +785,7 @@ function Fe(e, t, n, r) {
641
785
  c((r = r.apply(e, t || [])).next());
642
786
  });
643
787
  }
644
- function Ie(e, t) {
788
+ function Ue(e, t) {
645
789
  var n = {
646
790
  label: 0,
647
791
  sent: function() {
@@ -711,10 +855,10 @@ function Ie(e, t) {
711
855
  };
712
856
  }
713
857
  }
714
- function Le(e, t) {
715
- for (var n in e) n !== `default` && !Object.prototype.hasOwnProperty.call(t, n) && z(t, e, n);
858
+ function We(e, t) {
859
+ for (var n in e) n !== `default` && !Object.prototype.hasOwnProperty.call(t, n) && I(t, e, n);
716
860
  }
717
- function F(e) {
861
+ function N(e) {
718
862
  var t = typeof Symbol == `function` && Symbol.iterator, n = t && e[t], r = 0;
719
863
  if (n) return n.call(e);
720
864
  if (e && typeof e.length == `number`) return { next: function() {
@@ -725,7 +869,7 @@ function F(e) {
725
869
  } };
726
870
  throw TypeError(t ? `Object is not iterable.` : `Symbol.iterator is not defined.`);
727
871
  }
728
- function Re(e, t) {
872
+ function Ge(e, t) {
729
873
  var n = typeof Symbol == `function` && e[Symbol.iterator];
730
874
  if (!n) return e;
731
875
  var r = n.call(e), i, a = [], o;
@@ -742,23 +886,23 @@ function Re(e, t) {
742
886
  }
743
887
  return a;
744
888
  }
745
- function ze() {
746
- for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(Re(arguments[t]));
889
+ function Ke() {
890
+ for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(Ge(arguments[t]));
747
891
  return e;
748
892
  }
749
- function Be() {
893
+ function qe() {
750
894
  for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
751
895
  for (var r = Array(e), i = 0, t = 0; t < n; t++) for (var a = arguments[t], o = 0, s = a.length; o < s; o++, i++) r[i] = a[o];
752
896
  return r;
753
897
  }
754
- function Ve(e, t, n) {
898
+ function Je(e, t, n) {
755
899
  if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
756
900
  return e.concat(a || Array.prototype.slice.call(t));
757
901
  }
758
- function I(e) {
759
- return this instanceof I ? (this.v = e, this) : new I(e);
902
+ function P(e) {
903
+ return this instanceof P ? (this.v = e, this) : new P(e);
760
904
  }
761
- function He(e, t, n) {
905
+ function Ye(e, t, n) {
762
906
  if (!Symbol.asyncIterator) throw TypeError(`Symbol.asyncIterator is not defined.`);
763
907
  var r = n.apply(e, t || []), i, a = [];
764
908
  return i = Object.create((typeof AsyncIterator == `function` ? AsyncIterator : Object).prototype), s(`next`), s(`throw`), s(`return`, o), i[Symbol.asyncIterator] = function() {
@@ -789,7 +933,7 @@ function He(e, t, n) {
789
933
  }
790
934
  }
791
935
  function l(e) {
792
- e.value instanceof I ? Promise.resolve(e.value.v).then(u, d) : f(a[0][2], e);
936
+ e.value instanceof P ? Promise.resolve(e.value.v).then(u, d) : f(a[0][2], e);
793
937
  }
794
938
  function u(e) {
795
939
  c(`next`, e);
@@ -801,7 +945,7 @@ function He(e, t, n) {
801
945
  e(t), a.shift(), a.length && c(a[0][0], a[0][1]);
802
946
  }
803
947
  }
804
- function Ue(e) {
948
+ function Xe(e) {
805
949
  var t, n;
806
950
  return t = {}, r(`next`), r(`throw`, function(e) {
807
951
  throw e;
@@ -811,16 +955,16 @@ function Ue(e) {
811
955
  function r(r, i) {
812
956
  t[r] = e[r] ? function(t) {
813
957
  return (n = !n) ? {
814
- value: I(e[r](t)),
958
+ value: P(e[r](t)),
815
959
  done: !1
816
960
  } : i ? i(t) : t;
817
961
  } : i;
818
962
  }
819
963
  }
820
- function We(e) {
964
+ function Ze(e) {
821
965
  if (!Symbol.asyncIterator) throw TypeError(`Symbol.asyncIterator is not defined.`);
822
966
  var t = e[Symbol.asyncIterator], n;
823
- return t ? t.call(e) : (e = typeof F == `function` ? F(e) : e[Symbol.iterator](), n = {}, r(`next`), r(`throw`), r(`return`), n[Symbol.asyncIterator] = function() {
967
+ return t ? t.call(e) : (e = typeof N == `function` ? N(e) : e[Symbol.iterator](), n = {}, r(`next`), r(`throw`), r(`return`), n[Symbol.asyncIterator] = function() {
824
968
  return this;
825
969
  }, n);
826
970
  function r(t) {
@@ -839,34 +983,34 @@ function We(e) {
839
983
  }, t);
840
984
  }
841
985
  }
842
- function Ge(e, t) {
986
+ function Qe(e, t) {
843
987
  return Object.defineProperty ? Object.defineProperty(e, `raw`, { value: t }) : e.raw = t, e;
844
988
  }
845
- function Ke(e) {
989
+ function $e(e) {
846
990
  if (e && e.__esModule) return e;
847
991
  var t = {};
848
- if (e != null) for (var n = B(e), r = 0; r < n.length; r++) n[r] !== `default` && z(t, e, n[r]);
849
- return et(t, e), t;
992
+ if (e != null) for (var n = L(e), r = 0; r < n.length; r++) n[r] !== `default` && I(t, e, n[r]);
993
+ return ct(t, e), t;
850
994
  }
851
- function qe(e) {
995
+ function et(e) {
852
996
  return e && e.__esModule ? e : { default: e };
853
997
  }
854
- function Je(e, t, n, r) {
998
+ function tt(e, t, n, r) {
855
999
  if (n === `a` && !r) throw TypeError(`Private accessor was defined without a getter`);
856
1000
  if (typeof t == `function` ? e !== t || !r : !t.has(e)) throw TypeError(`Cannot read private member from an object whose class did not declare it`);
857
1001
  return n === `m` ? r : n === `a` ? r.call(e) : r ? r.value : t.get(e);
858
1002
  }
859
- function Ye(e, t, n, r, i) {
1003
+ function nt(e, t, n, r, i) {
860
1004
  if (r === `m`) throw TypeError(`Private method is not writable`);
861
1005
  if (r === `a` && !i) throw TypeError(`Private accessor was defined without a setter`);
862
1006
  if (typeof t == `function` ? e !== t || !i : !t.has(e)) throw TypeError(`Cannot write private member to an object whose class did not declare it`);
863
1007
  return r === `a` ? i.call(e, n) : i ? i.value = n : t.set(e, n), n;
864
1008
  }
865
- function Xe(e, t) {
1009
+ function rt(e, t) {
866
1010
  if (t === null || typeof t != `object` && typeof t != `function`) throw TypeError(`Cannot use 'in' operator on non-object`);
867
1011
  return typeof e == `function` ? t === e : e.has(t);
868
1012
  }
869
- function Ze(e, t, n) {
1013
+ function it(e, t, n) {
870
1014
  if (t != null) {
871
1015
  if (typeof t != `object` && typeof t != `function`) throw TypeError(`Object expected.`);
872
1016
  var r, i;
@@ -893,9 +1037,9 @@ function Ze(e, t, n) {
893
1037
  } else n && e.stack.push({ async: !0 });
894
1038
  return t;
895
1039
  }
896
- function Qe(e) {
1040
+ function at(e) {
897
1041
  function t(t) {
898
- e.error = e.hasError ? new tt(t, e.error, `An error was suppressed during disposal.`) : t, e.hasError = !0;
1042
+ e.error = e.hasError ? new lt(t, e.error, `An error was suppressed during disposal.`) : t, e.hasError = !0;
899
1043
  }
900
1044
  var n, r = 0;
901
1045
  function i() {
@@ -915,24 +1059,24 @@ function Qe(e) {
915
1059
  }
916
1060
  return i();
917
1061
  }
918
- function $e(e, t) {
1062
+ function ot(e, t) {
919
1063
  return typeof e == `string` && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(e, n, r, i, a) {
920
1064
  return n ? t ? `.jsx` : `.js` : r && (!i || !a) ? e : r + i + `.` + a.toLowerCase() + `js`;
921
1065
  }) : e;
922
1066
  }
923
- var L, R, z, et, B, tt, nt, V = f((() => {
924
- L = function(e, t) {
925
- return L = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
1067
+ var st, F, I, ct, L, lt, ut, R = f((() => {
1068
+ st = function(e, t) {
1069
+ return st = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
926
1070
  e.__proto__ = t;
927
1071
  } || function(e, t) {
928
1072
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
929
- }, L(e, t);
930
- }, R = function() {
931
- return R = Object.assign || function(e) {
1073
+ }, st(e, t);
1074
+ }, F = function() {
1075
+ return F = Object.assign || function(e) {
932
1076
  for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
933
1077
  return e;
934
- }, R.apply(this, arguments);
935
- }, z = Object.create ? (function(e, t, n, r) {
1078
+ }, F.apply(this, arguments);
1079
+ }, I = Object.create ? (function(e, t, n, r) {
936
1080
  r === void 0 && (r = n);
937
1081
  var i = Object.getOwnPropertyDescriptor(t, n);
938
1082
  (!i || (`get` in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
@@ -943,63 +1087,63 @@ var L, R, z, et, B, tt, nt, V = f((() => {
943
1087
  }), Object.defineProperty(e, r, i);
944
1088
  }) : (function(e, t, n, r) {
945
1089
  r === void 0 && (r = n), e[r] = t[n];
946
- }), et = Object.create ? (function(e, t) {
1090
+ }), ct = Object.create ? (function(e, t) {
947
1091
  Object.defineProperty(e, `default`, {
948
1092
  enumerable: !0,
949
1093
  value: t
950
1094
  });
951
1095
  }) : function(e, t) {
952
1096
  e.default = t;
953
- }, B = function(e) {
954
- return B = Object.getOwnPropertyNames || function(e) {
1097
+ }, L = function(e) {
1098
+ return L = Object.getOwnPropertyNames || function(e) {
955
1099
  var t = [];
956
1100
  for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[t.length] = n);
957
1101
  return t;
958
- }, B(e);
959
- }, tt = typeof SuppressedError == `function` ? SuppressedError : function(e, t, n) {
1102
+ }, L(e);
1103
+ }, lt = typeof SuppressedError == `function` ? SuppressedError : function(e, t, n) {
960
1104
  var r = Error(n);
961
1105
  return r.name = `SuppressedError`, r.error = e, r.suppressed = t, r;
962
- }, nt = {
963
- __extends: Ee,
964
- __assign: R,
965
- __rest: De,
966
- __decorate: Oe,
967
- __param: ke,
968
- __esDecorate: Ae,
969
- __runInitializers: je,
970
- __propKey: Me,
971
- __setFunctionName: Ne,
972
- __metadata: Pe,
973
- __awaiter: Fe,
974
- __generator: Ie,
975
- __createBinding: z,
976
- __exportStar: Le,
977
- __values: F,
978
- __read: Re,
979
- __spread: ze,
980
- __spreadArrays: Be,
981
- __spreadArray: Ve,
982
- __await: I,
983
- __asyncGenerator: He,
984
- __asyncDelegator: Ue,
985
- __asyncValues: We,
986
- __makeTemplateObject: Ge,
987
- __importStar: Ke,
988
- __importDefault: qe,
989
- __classPrivateFieldGet: Je,
990
- __classPrivateFieldSet: Ye,
991
- __classPrivateFieldIn: Xe,
992
- __addDisposableResource: Ze,
993
- __disposeResources: Qe,
994
- __rewriteRelativeImportExtension: $e
1106
+ }, ut = {
1107
+ __extends: Ne,
1108
+ __assign: F,
1109
+ __rest: Pe,
1110
+ __decorate: Fe,
1111
+ __param: Ie,
1112
+ __esDecorate: Le,
1113
+ __runInitializers: Re,
1114
+ __propKey: ze,
1115
+ __setFunctionName: Be,
1116
+ __metadata: Ve,
1117
+ __awaiter: He,
1118
+ __generator: Ue,
1119
+ __createBinding: I,
1120
+ __exportStar: We,
1121
+ __values: N,
1122
+ __read: Ge,
1123
+ __spread: Ke,
1124
+ __spreadArrays: qe,
1125
+ __spreadArray: Je,
1126
+ __await: P,
1127
+ __asyncGenerator: Ye,
1128
+ __asyncDelegator: Xe,
1129
+ __asyncValues: Ze,
1130
+ __makeTemplateObject: Qe,
1131
+ __importStar: $e,
1132
+ __importDefault: et,
1133
+ __classPrivateFieldGet: tt,
1134
+ __classPrivateFieldSet: nt,
1135
+ __classPrivateFieldIn: rt,
1136
+ __addDisposableResource: it,
1137
+ __disposeResources: at,
1138
+ __rewriteRelativeImportExtension: ot
995
1139
  };
996
- })), rt = p(((e) => {
1140
+ })), dt = p(((e) => {
997
1141
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.ErrorKind = void 0;
998
1142
  var t;
999
1143
  (function(e) {
1000
1144
  e[e.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = `EXPECT_ARGUMENT_CLOSING_BRACE`, e[e.EMPTY_ARGUMENT = 2] = `EMPTY_ARGUMENT`, e[e.MALFORMED_ARGUMENT = 3] = `MALFORMED_ARGUMENT`, e[e.EXPECT_ARGUMENT_TYPE = 4] = `EXPECT_ARGUMENT_TYPE`, e[e.INVALID_ARGUMENT_TYPE = 5] = `INVALID_ARGUMENT_TYPE`, e[e.EXPECT_ARGUMENT_STYLE = 6] = `EXPECT_ARGUMENT_STYLE`, e[e.INVALID_NUMBER_SKELETON = 7] = `INVALID_NUMBER_SKELETON`, e[e.INVALID_DATE_TIME_SKELETON = 8] = `INVALID_DATE_TIME_SKELETON`, e[e.EXPECT_NUMBER_SKELETON = 9] = `EXPECT_NUMBER_SKELETON`, e[e.EXPECT_DATE_TIME_SKELETON = 10] = `EXPECT_DATE_TIME_SKELETON`, e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = `UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`, e[e.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = `EXPECT_SELECT_ARGUMENT_OPTIONS`, e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = `EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`, e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = `INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`, e[e.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = `EXPECT_SELECT_ARGUMENT_SELECTOR`, e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = `EXPECT_PLURAL_ARGUMENT_SELECTOR`, e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = `EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`, e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = `EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`, e[e.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = `INVALID_PLURAL_ARGUMENT_SELECTOR`, e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = `DUPLICATE_PLURAL_ARGUMENT_SELECTOR`, e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = `DUPLICATE_SELECT_ARGUMENT_SELECTOR`, e[e.MISSING_OTHER_CLAUSE = 22] = `MISSING_OTHER_CLAUSE`, e[e.INVALID_TAG = 23] = `INVALID_TAG`, e[e.INVALID_TAG_NAME = 25] = `INVALID_TAG_NAME`, e[e.UNMATCHED_CLOSING_TAG = 26] = `UNMATCHED_CLOSING_TAG`, e[e.UNCLOSED_TAG = 27] = `UNCLOSED_TAG`;
1001
1145
  })(t || (e.ErrorKind = t = {}));
1002
- })), H = p(((e) => {
1146
+ })), z = p(((e) => {
1003
1147
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.SKELETON_TYPE = e.TYPE = void 0, e.isLiteralElement = r, e.isArgumentElement = i, e.isNumberElement = a, e.isDateElement = o, e.isTimeElement = s, e.isSelectElement = c, e.isPluralElement = l, e.isPoundElement = u, e.isTagElement = d, e.isNumberSkeleton = f, e.isDateTimeSkeleton = p, e.createLiteralElement = m, e.createNumberElement = h;
1004
1148
  var t;
1005
1149
  (function(e) {
@@ -1055,9 +1199,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
1055
1199
  style: n
1056
1200
  };
1057
1201
  }
1058
- })), it = p(((e) => {
1202
+ })), ft = p(((e) => {
1059
1203
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.WHITE_SPACE_REGEX = e.SPACE_SEPARATOR_REGEX = void 0, e.SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, e.WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/;
1060
- })), at = p(((e) => {
1204
+ })), pt = p(((e) => {
1061
1205
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.parseDateTimeSkeleton = n;
1062
1206
  var t = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
1063
1207
  function n(e) {
@@ -1157,11 +1301,11 @@ var L, R, z, et, B, tt, nt, V = f((() => {
1157
1301
  return ``;
1158
1302
  }), n;
1159
1303
  }
1160
- })), ot = p(((e) => {
1304
+ })), mt = p(((e) => {
1161
1305
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.WHITE_SPACE_REGEX = void 0, e.WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
1162
- })), st = p(((e) => {
1306
+ })), ht = p(((e) => {
1163
1307
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.parseNumberSkeletonFromString = r, e.parseNumberSkeleton = p;
1164
- var t = (V(), g(P)), n = ot();
1308
+ var t = (R(), g(M)), n = mt();
1165
1309
  function r(e) {
1166
1310
  if (e.length === 0) throw Error(`Number skeleton cannot be empty`);
1167
1311
  for (var t = e.split(n.WHITE_SPACE_REGEX).filter(function(e) {
@@ -1339,11 +1483,11 @@ var L, R, z, et, B, tt, nt, V = f((() => {
1339
1483
  }
1340
1484
  return n;
1341
1485
  }
1342
- })), ct = p(((e) => {
1486
+ })), gt = p(((e) => {
1343
1487
  Object.defineProperty(e, `__esModule`, { value: !0 });
1344
- var t = (V(), g(P));
1345
- t.__exportStar(at(), e), t.__exportStar(st(), e);
1346
- })), lt = p(((e) => {
1488
+ var t = (R(), g(M));
1489
+ t.__exportStar(pt(), e), t.__exportStar(ht(), e);
1490
+ })), _t = p(((e) => {
1347
1491
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.timeData = void 0, e.timeData = {
1348
1492
  "001": [`H`, `h`],
1349
1493
  419: [
@@ -2500,9 +2644,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2500
2644
  `h`
2501
2645
  ]
2502
2646
  };
2503
- })), ut = p(((e) => {
2647
+ })), vt = p(((e) => {
2504
2648
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.getBestPattern = n;
2505
- var t = lt();
2649
+ var t = _t();
2506
2650
  function n(e, t) {
2507
2651
  for (var n = ``, i = 0; i < e.length; i++) {
2508
2652
  var a = e.charAt(i);
@@ -2527,9 +2671,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2527
2671
  var r = e.language, i;
2528
2672
  return r !== `root` && (i = e.maximize().region), (t.timeData[i || ``] || t.timeData[r || ``] || t.timeData[`${r}-001`] || t.timeData[`001`])[0];
2529
2673
  }
2530
- })), dt = p(((e) => {
2674
+ })), yt = p(((e) => {
2531
2675
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.Parser = void 0;
2532
- var t = (V(), g(P)), n = rt(), r = H(), i = it(), a = ct(), o = ut(), s = RegExp(`^${i.SPACE_SEPARATOR_REGEX.source}*`), c = RegExp(`${i.SPACE_SEPARATOR_REGEX.source}*\$`);
2676
+ var t = (R(), g(M)), n = dt(), r = z(), i = ft(), a = gt(), o = vt(), s = RegExp(`^${i.SPACE_SEPARATOR_REGEX.source}*`), c = RegExp(`${i.SPACE_SEPARATOR_REGEX.source}*\$`);
2533
2677
  function l(e, t) {
2534
2678
  return {
2535
2679
  start: e,
@@ -2540,21 +2684,21 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2540
2684
  return typeof e == `number` && isFinite(e) && Math.floor(e) === e && Math.abs(e) <= 9007199254740991;
2541
2685
  }, v = !0;
2542
2686
  try {
2543
- v = C(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`).exec(`a`)?.[0] === `a`;
2687
+ v = S(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`).exec(`a`)?.[0] === `a`;
2544
2688
  } catch {
2545
2689
  v = !1;
2546
2690
  }
2547
- var y = u ? function(e, t, n) {
2691
+ var ee = u ? function(e, t, n) {
2548
2692
  return e.startsWith(t, n);
2549
2693
  } : function(e, t, n) {
2550
2694
  return e.slice(n, n + t.length) === t;
2551
- }, b = d ? String.fromCodePoint : function() {
2695
+ }, y = d ? String.fromCodePoint : function() {
2552
2696
  for (var e = [...arguments], t = ``, n = e.length, r = 0, i; n > r;) {
2553
2697
  if (i = e[r++], i > 1114111) throw RangeError(i + ` is not a valid code point`);
2554
2698
  t += i < 65536 ? String.fromCharCode(i) : String.fromCharCode(((i -= 65536) >> 10) + 55296, i % 1024 + 56320);
2555
2699
  }
2556
2700
  return t;
2557
- }, ee = f ? Object.fromEntries : function(e) {
2701
+ }, b = f ? Object.fromEntries : function(e) {
2558
2702
  for (var t = {}, n = 0, r = e; n < r.length; n++) {
2559
2703
  var i = r[n], a = i[0];
2560
2704
  t[a] = i[1];
@@ -2568,31 +2712,31 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2568
2712
  var r = e.charCodeAt(t), i;
2569
2713
  return r < 55296 || r > 56319 || t + 1 === n || (i = e.charCodeAt(t + 1)) < 56320 || i > 57343 ? r : (r - 55296 << 10) + (i - 56320) + 65536;
2570
2714
  }
2571
- }, S = m ? function(e) {
2715
+ }, te = m ? function(e) {
2572
2716
  return e.trimStart();
2573
2717
  } : function(e) {
2574
2718
  return e.replace(s, ``);
2575
- }, te = h ? function(e) {
2719
+ }, ne = h ? function(e) {
2576
2720
  return e.trimEnd();
2577
2721
  } : function(e) {
2578
2722
  return e.replace(c, ``);
2579
2723
  };
2580
- function C(e, t) {
2724
+ function S(e, t) {
2581
2725
  return new RegExp(e, t);
2582
2726
  }
2583
- var w;
2727
+ var C;
2584
2728
  if (v) {
2585
- var T = C(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`);
2586
- w = function(e, t) {
2587
- return T.lastIndex = t, T.exec(e)[1] ?? ``;
2729
+ var w = S(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`);
2730
+ C = function(e, t) {
2731
+ return w.lastIndex = t, w.exec(e)[1] ?? ``;
2588
2732
  };
2589
- } else w = function(e, t) {
2733
+ } else C = function(e, t) {
2590
2734
  for (var n = [];;) {
2591
2735
  var r = x(e, t);
2592
- if (r === void 0 || k(r) || A(r)) break;
2736
+ if (r === void 0 || ie(r) || D(r)) break;
2593
2737
  n.push(r), t += r >= 65536 ? 2 : 1;
2594
2738
  }
2595
- return b.apply(void 0, n);
2739
+ return y.apply(void 0, n);
2596
2740
  };
2597
2741
  e.Parser = function() {
2598
2742
  function e(e, t) {
@@ -2622,7 +2766,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2622
2766
  } else if (o === 60 && !this.ignoreTag && this.peek() === 47) {
2623
2767
  if (i) break;
2624
2768
  return this.error(n.ErrorKind.UNMATCHED_CLOSING_TAG, l(this.clonePosition(), this.clonePosition()));
2625
- } else if (o === 60 && !this.ignoreTag && E(this.peek() || 0)) {
2769
+ } else if (o === 60 && !this.ignoreTag && T(this.peek() || 0)) {
2626
2770
  var s = this.parseTag(e, t);
2627
2771
  if (s.err) return s;
2628
2772
  a.push(s.val);
@@ -2653,7 +2797,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2653
2797
  if (o.err) return o;
2654
2798
  var s = o.val, c = this.clonePosition();
2655
2799
  if (this.bumpIf(`</`)) {
2656
- if (this.isEOF() || !E(this.char())) return this.error(n.ErrorKind.INVALID_TAG, l(c, this.clonePosition()));
2800
+ if (this.isEOF() || !T(this.char())) return this.error(n.ErrorKind.INVALID_TAG, l(c, this.clonePosition()));
2657
2801
  var u = this.clonePosition();
2658
2802
  return a === this.parseTagName() ? (this.bumpSpace(), this.bumpIf(`>`) ? {
2659
2803
  val: {
@@ -2668,7 +2812,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2668
2812
  } else return this.error(n.ErrorKind.INVALID_TAG, l(i, this.clonePosition()));
2669
2813
  }, e.prototype.parseTagName = function() {
2670
2814
  var e = this.offset();
2671
- for (this.bump(); !this.isEOF() && O(this.char());) this.bump();
2815
+ for (this.bump(); !this.isEOF() && E(this.char());) this.bump();
2672
2816
  return this.message.slice(e, this.offset());
2673
2817
  }, e.prototype.parseLiteral = function(e, t) {
2674
2818
  for (var n = this.clonePosition(), i = ``;;) {
@@ -2699,7 +2843,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2699
2843
  err: null
2700
2844
  };
2701
2845
  }, e.prototype.tryParseLeftAngleBracket = function() {
2702
- return !this.isEOF() && this.char() === 60 && (this.ignoreTag || !D(this.peek() || 0)) ? (this.bump(), `<`) : null;
2846
+ return !this.isEOF() && this.char() === 60 && (this.ignoreTag || !re(this.peek() || 0)) ? (this.bump(), `<`) : null;
2703
2847
  }, e.prototype.tryParseQuote = function(e) {
2704
2848
  if (this.isEOF() || this.char() !== 39) return null;
2705
2849
  switch (this.peek()) {
@@ -2725,11 +2869,11 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2725
2869
  else t.push(n);
2726
2870
  this.bump();
2727
2871
  }
2728
- return b.apply(void 0, t);
2872
+ return y.apply(void 0, t);
2729
2873
  }, e.prototype.tryParseUnquoted = function(e, t) {
2730
2874
  if (this.isEOF()) return null;
2731
2875
  var n = this.char();
2732
- return n === 60 || n === 123 || n === 35 && (t === `plural` || t === `selectordinal`) || n === 125 && e > 0 ? null : (this.bump(), b(n));
2876
+ return n === 60 || n === 123 || n === 35 && (t === `plural` || t === `selectordinal`) || n === 125 && e > 0 ? null : (this.bump(), y(n));
2733
2877
  }, e.prototype.parseArgument = function(e, t) {
2734
2878
  var i = this.clonePosition();
2735
2879
  if (this.bump(), this.bumpSpace(), this.isEOF()) return this.error(n.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, l(i, this.clonePosition()));
@@ -2750,7 +2894,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2750
2894
  default: return this.error(n.ErrorKind.MALFORMED_ARGUMENT, l(i, this.clonePosition()));
2751
2895
  }
2752
2896
  }, e.prototype.parseIdentifierIfPossible = function() {
2753
- var e = this.clonePosition(), t = this.offset(), n = w(this.message, t), r = t + n.length;
2897
+ var e = this.clonePosition(), t = this.offset(), n = C(this.message, t), r = t + n.length;
2754
2898
  return this.bumpTo(r), {
2755
2899
  value: n,
2756
2900
  location: l(e, this.clonePosition())
@@ -2768,7 +2912,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2768
2912
  this.bumpSpace();
2769
2913
  var m = this.clonePosition(), h = this.parseSimpleArgStyleIfPossible();
2770
2914
  if (h.err) return h;
2771
- var g = te(h.val);
2915
+ var g = ne(h.val);
2772
2916
  if (g.length === 0) return this.error(n.ErrorKind.EXPECT_ARGUMENT_STYLE, l(this.clonePosition(), this.clonePosition()));
2773
2917
  p = {
2774
2918
  style: g,
@@ -2778,10 +2922,10 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2778
2922
  var _ = this.tryParseArgumentClose(c);
2779
2923
  if (_.err) return _;
2780
2924
  var v = l(c, this.clonePosition());
2781
- if (p && y(p?.style, `::`, 0)) {
2782
- var b = S(p.style.slice(2));
2925
+ if (p && ee(p?.style, `::`, 0)) {
2926
+ var y = te(p.style.slice(2));
2783
2927
  if (d === `number`) {
2784
- var h = this.parseNumberSkeletonFromString(b, p.styleLocation);
2928
+ var h = this.parseNumberSkeletonFromString(y, p.styleLocation);
2785
2929
  return h.err ? h : {
2786
2930
  val: {
2787
2931
  type: r.TYPE.number,
@@ -2792,9 +2936,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2792
2936
  err: null
2793
2937
  };
2794
2938
  } else {
2795
- if (b.length === 0) return this.error(n.ErrorKind.EXPECT_DATE_TIME_SKELETON, v);
2796
- var x = b;
2797
- this.locale && (x = (0, o.getBestPattern)(b, this.locale));
2939
+ if (y.length === 0) return this.error(n.ErrorKind.EXPECT_DATE_TIME_SKELETON, v);
2940
+ var x = y;
2941
+ this.locale && (x = (0, o.getBestPattern)(y, this.locale));
2798
2942
  var g = {
2799
2943
  type: r.SKELETON_TYPE.dateTime,
2800
2944
  pattern: x,
@@ -2824,38 +2968,38 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2824
2968
  case `plural`:
2825
2969
  case `selectordinal`:
2826
2970
  case `select`:
2827
- var C = this.clonePosition();
2828
- if (this.bumpSpace(), !this.bumpIf(`,`)) return this.error(n.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, l(C, t.__assign({}, C)));
2971
+ var S = this.clonePosition();
2972
+ if (this.bumpSpace(), !this.bumpIf(`,`)) return this.error(n.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, l(S, t.__assign({}, S)));
2829
2973
  this.bumpSpace();
2830
- var w = this.parseIdentifierIfPossible(), T = 0;
2831
- if (d !== `select` && w.value === `offset`) {
2974
+ var C = this.parseIdentifierIfPossible(), w = 0;
2975
+ if (d !== `select` && C.value === `offset`) {
2832
2976
  if (!this.bumpIf(`:`)) return this.error(n.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, l(this.clonePosition(), this.clonePosition()));
2833
2977
  this.bumpSpace();
2834
2978
  var h = this.tryParseDecimalInteger(n.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, n.ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
2835
2979
  if (h.err) return h;
2836
- this.bumpSpace(), w = this.parseIdentifierIfPossible(), T = h.val;
2980
+ this.bumpSpace(), C = this.parseIdentifierIfPossible(), w = h.val;
2837
2981
  }
2838
- var E = this.tryParsePluralOrSelectOptions(e, d, i, w);
2839
- if (E.err) return E;
2982
+ var T = this.tryParsePluralOrSelectOptions(e, d, i, C);
2983
+ if (T.err) return T;
2840
2984
  var _ = this.tryParseArgumentClose(c);
2841
2985
  if (_.err) return _;
2842
- var D = l(c, this.clonePosition());
2986
+ var re = l(c, this.clonePosition());
2843
2987
  return d === `select` ? {
2844
2988
  val: {
2845
2989
  type: r.TYPE.select,
2846
2990
  value: s,
2847
- options: ee(E.val),
2848
- location: D
2991
+ options: b(T.val),
2992
+ location: re
2849
2993
  },
2850
2994
  err: null
2851
2995
  } : {
2852
2996
  val: {
2853
2997
  type: r.TYPE.plural,
2854
2998
  value: s,
2855
- options: ee(E.val),
2856
- offset: T,
2999
+ options: b(T.val),
3000
+ offset: w,
2857
3001
  pluralType: d === `plural` ? `cardinal` : `ordinal`,
2858
- location: D
3002
+ location: re
2859
3003
  },
2860
3004
  err: null
2861
3005
  };
@@ -2979,7 +3123,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2979
3123
  e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2);
2980
3124
  }
2981
3125
  }, e.prototype.bumpIf = function(e) {
2982
- if (y(this.message, e, this.offset())) {
3126
+ if (ee(this.message, e, this.offset())) {
2983
3127
  for (var t = 0; t < e.length; t++) this.bump();
2984
3128
  return !0;
2985
3129
  }
@@ -2996,31 +3140,31 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2996
3140
  if (this.bump(), this.isEOF()) break;
2997
3141
  }
2998
3142
  }, e.prototype.bumpSpace = function() {
2999
- for (; !this.isEOF() && k(this.char());) this.bump();
3143
+ for (; !this.isEOF() && ie(this.char());) this.bump();
3000
3144
  }, e.prototype.peek = function() {
3001
3145
  if (this.isEOF()) return null;
3002
3146
  var e = this.char(), t = this.offset();
3003
3147
  return this.message.charCodeAt(t + (e >= 65536 ? 2 : 1)) ?? null;
3004
3148
  }, e;
3005
3149
  }();
3006
- function E(e) {
3150
+ function T(e) {
3007
3151
  return e >= 97 && e <= 122 || e >= 65 && e <= 90;
3008
3152
  }
3009
- function D(e) {
3010
- return E(e) || e === 47;
3153
+ function re(e) {
3154
+ return T(e) || e === 47;
3011
3155
  }
3012
- function O(e) {
3156
+ function E(e) {
3013
3157
  return e === 45 || e === 46 || e >= 48 && e <= 57 || e === 95 || e >= 97 && e <= 122 || e >= 65 && e <= 90 || e == 183 || e >= 192 && e <= 214 || e >= 216 && e <= 246 || e >= 248 && e <= 893 || e >= 895 && e <= 8191 || e >= 8204 && e <= 8205 || e >= 8255 && e <= 8256 || e >= 8304 && e <= 8591 || e >= 11264 && e <= 12271 || e >= 12289 && e <= 55295 || e >= 63744 && e <= 64975 || e >= 65008 && e <= 65533 || e >= 65536 && e <= 983039;
3014
3158
  }
3015
- function k(e) {
3159
+ function ie(e) {
3016
3160
  return e >= 9 && e <= 13 || e === 32 || e === 133 || e >= 8206 && e <= 8207 || e === 8232 || e === 8233;
3017
3161
  }
3018
- function A(e) {
3162
+ function D(e) {
3019
3163
  return e >= 33 && e <= 35 || e === 36 || e >= 37 && e <= 39 || e === 40 || e === 41 || e === 42 || e === 43 || e === 44 || e === 45 || e >= 46 && e <= 47 || e >= 58 && e <= 59 || e >= 60 && e <= 62 || e >= 63 && e <= 64 || e === 91 || e === 92 || e === 93 || e === 94 || e === 96 || e === 123 || e === 124 || e === 125 || e === 126 || e === 161 || e >= 162 && e <= 165 || e === 166 || e === 167 || e === 169 || e === 171 || e === 172 || e === 174 || e === 176 || e === 177 || e === 182 || e === 187 || e === 191 || e === 215 || e === 247 || e >= 8208 && e <= 8213 || e >= 8214 && e <= 8215 || e === 8216 || e === 8217 || e === 8218 || e >= 8219 && e <= 8220 || e === 8221 || e === 8222 || e === 8223 || e >= 8224 && e <= 8231 || e >= 8240 && e <= 8248 || e === 8249 || e === 8250 || e >= 8251 && e <= 8254 || e >= 8257 && e <= 8259 || e === 8260 || e === 8261 || e === 8262 || e >= 8263 && e <= 8273 || e === 8274 || e === 8275 || e >= 8277 && e <= 8286 || e >= 8592 && e <= 8596 || e >= 8597 && e <= 8601 || e >= 8602 && e <= 8603 || e >= 8604 && e <= 8607 || e === 8608 || e >= 8609 && e <= 8610 || e === 8611 || e >= 8612 && e <= 8613 || e === 8614 || e >= 8615 && e <= 8621 || e === 8622 || e >= 8623 && e <= 8653 || e >= 8654 && e <= 8655 || e >= 8656 && e <= 8657 || e === 8658 || e === 8659 || e === 8660 || e >= 8661 && e <= 8691 || e >= 8692 && e <= 8959 || e >= 8960 && e <= 8967 || e === 8968 || e === 8969 || e === 8970 || e === 8971 || e >= 8972 && e <= 8991 || e >= 8992 && e <= 8993 || e >= 8994 && e <= 9e3 || e === 9001 || e === 9002 || e >= 9003 && e <= 9083 || e === 9084 || e >= 9085 && e <= 9114 || e >= 9115 && e <= 9139 || e >= 9140 && e <= 9179 || e >= 9180 && e <= 9185 || e >= 9186 && e <= 9254 || e >= 9255 && e <= 9279 || e >= 9280 && e <= 9290 || e >= 9291 && e <= 9311 || e >= 9472 && e <= 9654 || e === 9655 || e >= 9656 && e <= 9664 || e === 9665 || e >= 9666 && e <= 9719 || e >= 9720 && e <= 9727 || e >= 9728 && e <= 9838 || e === 9839 || e >= 9840 && e <= 10087 || e === 10088 || e === 10089 || e === 10090 || e === 10091 || e === 10092 || e === 10093 || e === 10094 || e === 10095 || e === 10096 || e === 10097 || e === 10098 || e === 10099 || e === 10100 || e === 10101 || e >= 10132 && e <= 10175 || e >= 10176 && e <= 10180 || e === 10181 || e === 10182 || e >= 10183 && e <= 10213 || e === 10214 || e === 10215 || e === 10216 || e === 10217 || e === 10218 || e === 10219 || e === 10220 || e === 10221 || e === 10222 || e === 10223 || e >= 10224 && e <= 10239 || e >= 10240 && e <= 10495 || e >= 10496 && e <= 10626 || e === 10627 || e === 10628 || e === 10629 || e === 10630 || e === 10631 || e === 10632 || e === 10633 || e === 10634 || e === 10635 || e === 10636 || e === 10637 || e === 10638 || e === 10639 || e === 10640 || e === 10641 || e === 10642 || e === 10643 || e === 10644 || e === 10645 || e === 10646 || e === 10647 || e === 10648 || e >= 10649 && e <= 10711 || e === 10712 || e === 10713 || e === 10714 || e === 10715 || e >= 10716 && e <= 10747 || e === 10748 || e === 10749 || e >= 10750 && e <= 11007 || e >= 11008 && e <= 11055 || e >= 11056 && e <= 11076 || e >= 11077 && e <= 11078 || e >= 11079 && e <= 11084 || e >= 11085 && e <= 11123 || e >= 11124 && e <= 11125 || e >= 11126 && e <= 11157 || e === 11158 || e >= 11159 && e <= 11263 || e >= 11776 && e <= 11777 || e === 11778 || e === 11779 || e === 11780 || e === 11781 || e >= 11782 && e <= 11784 || e === 11785 || e === 11786 || e === 11787 || e === 11788 || e === 11789 || e >= 11790 && e <= 11798 || e === 11799 || e >= 11800 && e <= 11801 || e === 11802 || e === 11803 || e === 11804 || e === 11805 || e >= 11806 && e <= 11807 || e === 11808 || e === 11809 || e === 11810 || e === 11811 || e === 11812 || e === 11813 || e === 11814 || e === 11815 || e === 11816 || e === 11817 || e >= 11818 && e <= 11822 || e === 11823 || e >= 11824 && e <= 11833 || e >= 11834 && e <= 11835 || e >= 11836 && e <= 11839 || e === 11840 || e === 11841 || e === 11842 || e >= 11843 && e <= 11855 || e >= 11856 && e <= 11857 || e === 11858 || e >= 11859 && e <= 11903 || e >= 12289 && e <= 12291 || e === 12296 || e === 12297 || e === 12298 || e === 12299 || e === 12300 || e === 12301 || e === 12302 || e === 12303 || e === 12304 || e === 12305 || e >= 12306 && e <= 12307 || e === 12308 || e === 12309 || e === 12310 || e === 12311 || e === 12312 || e === 12313 || e === 12314 || e === 12315 || e === 12316 || e === 12317 || e >= 12318 && e <= 12319 || e === 12320 || e === 12336 || e === 64830 || e === 64831 || e >= 65093 && e <= 65094;
3020
3164
  }
3021
- })), ft = p(((e) => {
3165
+ })), bt = p(((e) => {
3022
3166
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.hoistSelectors = s, e.isStructurallySame = l;
3023
- var t = (V(), g(P)), n = H();
3167
+ var t = (R(), g(M)), n = z();
3024
3168
  function r(e) {
3025
3169
  return Array.isArray(e) ? t.__spreadArray([], e.map(r), !0) : typeof e == `object` && e ? Object.keys(e).reduce(function(t, n) {
3026
3170
  return t[n] = r(e[n]), t;
@@ -3077,9 +3221,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
3077
3221
  error: Error(`Different number of variables: [${Array.from(r.keys()).join(`, `)}] vs [${Array.from(i.keys()).join(`, `)}]`)
3078
3222
  };
3079
3223
  }
3080
- })), pt = p(((e) => {
3224
+ })), xt = p(((e) => {
3081
3225
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.isStructurallySame = e._Parser = void 0, e.parse = o;
3082
- var t = (V(), g(P)), n = rt(), r = dt(), i = H();
3226
+ var t = (R(), g(M)), n = dt(), r = yt(), i = z();
3083
3227
  function a(e) {
3084
3228
  e.forEach(function(e) {
3085
3229
  if (delete e.location, (0, i.isSelectElement)(e) || (0, i.isPluralElement)(e)) for (var t in e.options) delete e.options[t].location, a(e.options[t].value);
@@ -3098,17 +3242,17 @@ var L, R, z, et, B, tt, nt, V = f((() => {
3098
3242
  }
3099
3243
  return i?.captureLocation || a(o.val), o.val;
3100
3244
  }
3101
- t.__exportStar(H(), e), e._Parser = r.Parser;
3102
- var s = ft();
3245
+ t.__exportStar(z(), e), e._Parser = r.Parser;
3246
+ var s = bt();
3103
3247
  Object.defineProperty(e, `isStructurallySame`, {
3104
3248
  enumerable: !0,
3105
3249
  get: function() {
3106
3250
  return s.isStructurallySame;
3107
3251
  }
3108
3252
  });
3109
- })), mt = p(((e) => {
3253
+ })), St = p(((e) => {
3110
3254
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.printAST = r;
3111
- var t = (V(), g(P)), n = H();
3255
+ var t = (R(), g(M)), n = z();
3112
3256
  function r(e) {
3113
3257
  return i(e, !1);
3114
3258
  }
@@ -3171,128 +3315,167 @@ var L, R, z, et, B, tt, nt, V = f((() => {
3171
3315
  ].join(`,`)}}`;
3172
3316
  }
3173
3317
  }));
3174
- pt();
3175
- H();
3176
- mt();
3177
- const K = `_gt_`;
3178
- RegExp(`^${K}\\d+$`);
3179
- RegExp(`^${K}$`);
3180
- const q = `@generaltranslation/react-core`;
3181
- `${q}`, `${q}`, `${q}`, `${q}`, `${q}`, `${q}`;
3182
- `${q}`, `${q}`, `${q}`, `${q}`;
3183
- `${q}`;
3184
- const sn = `generaltranslation.locale`;
3185
- react$1.use;
3186
- function Hn({ children: e }) {
3318
+ xt();
3319
+ z();
3320
+ St();
3321
+ const U = `_gt_`;
3322
+ RegExp(`^${U}\\d+$`);
3323
+ RegExp(`^${U}$`);
3324
+ const Ht = `@generaltranslation/react-core`;
3325
+ function W(e) {
3326
+ return S({
3327
+ source: Ht,
3328
+ ...e
3329
+ });
3330
+ }
3331
+ W({
3332
+ severity: `Error`,
3333
+ whatHappened: `Runtime translation needs a project ID`,
3334
+ fix: `Add projectId to your <GTProvider> configuration or set GT_PROJECT_ID in your environment`,
3335
+ docsUrl: `https://generaltranslation.com/dashboard`
3336
+ }), W({
3337
+ severity: `Error`,
3338
+ whatHappened: `Production environments cannot use a development API key`,
3339
+ fix: `Replace it with a production API key before deploying`
3340
+ }), W({
3341
+ severity: `Error`,
3342
+ whatHappened: `The API key is available to client-side production code`,
3343
+ fix: `Move translation credentials to a server-only environment before deploying`
3344
+ }), W({
3345
+ severity: `Error`,
3346
+ whatHappened: `Runtime translation is not configured`,
3347
+ fix: `Add projectId and devApiKey to your environment, or pass them to <GTProvider> directly`
3348
+ }), W({
3349
+ severity: `Error`,
3350
+ whatHappened: `Runtime translations could not be loaded`,
3351
+ wayOut: `Source content will render as a fallback`,
3352
+ fix: `Check your runtime translation configuration and try again`
3353
+ }), W({
3354
+ severity: `Error`,
3355
+ whatHappened: `Runtime translation could not be completed`
3356
+ });
3357
+ W({
3358
+ severity: `Warning`,
3359
+ whatHappened: `Runtime translation needs a project ID`,
3360
+ fix: `Add projectId to <GTProvider> or set GT_PROJECT_ID in your environment`,
3361
+ docsUrl: `https://generaltranslation.com/dashboard`
3362
+ }), W({
3363
+ severity: `Warning`,
3364
+ whatHappened: `Runtime translation needs a development API key`,
3365
+ fix: `Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation`
3366
+ }), W({
3367
+ severity: `Warning`,
3368
+ whatHappened: `Runtime translation timed out`
3369
+ }), W({
3370
+ severity: `Warning`,
3371
+ whatHappened: `No dictionary was found`,
3372
+ fix: `Pass a dictionary to <GTProvider> or configure a dictionary loader before rendering translations`
3373
+ });
3374
+ `${Ht}`;
3375
+ const pn = `generaltranslation.locale`;
3376
+ react.use;
3377
+ function Jn({ children: e }) {
3187
3378
  return e;
3188
3379
  }
3189
- function Un(e) {
3190
- return Hn(e);
3380
+ function Yn(e) {
3381
+ return Jn(e);
3191
3382
  }
3192
- Hn._gtt = `derive`, Un._gtt = `derive`;
3383
+ Jn._gtt = `derive`, Yn._gtt = `derive`;
3193
3384
  //#endregion
3194
3385
  //#region src/shared/messages.ts
3195
3386
  const PACKAGE_NAME = "gt-react";
3196
- `${PACKAGE_NAME}${PACKAGE_NAME}`;
3197
- `${PACKAGE_NAME}`;
3198
- `${PACKAGE_NAME}`;
3387
+ createDiagnosticMessage({
3388
+ source: `${PACKAGE_NAME}/browser`,
3389
+ severity: "Error",
3390
+ whatHappened: "This module requires a browser environment",
3391
+ fix: "Import it only from client-side code"
3392
+ });
3393
+ createDiagnosticMessage({
3394
+ source: PACKAGE_NAME,
3395
+ severity: "Error",
3396
+ whatHappened: "A browser-only module was imported outside the browser",
3397
+ fix: "Move this import to client-side code"
3398
+ });
3399
+ createDiagnosticMessage({
3400
+ source: PACKAGE_NAME,
3401
+ severity: "Error",
3402
+ whatHappened: "BrowserI18nManager is not initialized",
3403
+ fix: "Call initializeGT() before using browser translation APIs"
3404
+ });
3199
3405
  //#endregion
3200
3406
  //#region src/react-context/provider/hooks/locales/useDetermineLocale.ts
3201
- function useDetermineLocale({ locale: initialLocale = "", defaultLocale = "en", locales: initialLocales = [], localeCookieName = sn, ssr = true, customMapping, enableI18n, reloadOnLocaleUpdate = false }) {
3407
+ function useDetermineLocale({ locale: initialLocale = "", defaultLocale = "en", locales: initialLocales = [], localeCookieName = pn, ssr = true, customMapping, enableI18n, reloadOnLocaleUpdate = false }) {
3202
3408
  const _locale = (0, react.useMemo)(() => (0, _generaltranslation_format.resolveAliasLocale)(initialLocale, customMapping), [initialLocale, customMapping]);
3203
3409
  const locales = (0, react.useMemo)(() => initialLocales.map((locale) => (0, _generaltranslation_format.resolveAliasLocale)(locale, customMapping)), [initialLocales, customMapping]);
3204
- const initializeLocale = () => {
3410
+ /**
3411
+ * Choose a locale to use
3412
+ * (1) use provided locale
3413
+ * (2) use cookie locale
3414
+ * (3) use preferred locale
3415
+ * (5) fallback to defaultLocale
3416
+ * Update the cookie locale to be correct
3417
+ */
3418
+ const getNewLocale = (0, react.useCallback)((locale) => {
3205
3419
  if (!enableI18n) return defaultLocale;
3206
- return (0, _generaltranslation_format.resolveAliasLocale)(ssr ? _locale ? (0, _generaltranslation_format.determineLocale)(_locale, locales, customMapping) || "" : "" : getNewLocale({
3207
- _locale,
3208
- locale: _locale,
3209
- locales,
3210
- defaultLocale,
3211
- localeCookieName,
3212
- customMapping,
3213
- enableI18n
3214
- }), customMapping);
3215
- };
3216
- const [locale, _setLocale] = (0, react.useState)(initializeLocale);
3217
- const [setLocale, setLocaleWithoutSettingCookie] = createSetLocale({
3218
- locale,
3219
- locales,
3220
- defaultLocale,
3221
- localeCookieName,
3222
- _setLocale,
3223
- customMapping,
3224
- enableI18n,
3225
- reloadOnLocaleUpdate
3226
- });
3227
- (0, react.useEffect)(() => {
3228
- setLocaleWithoutSettingCookie(getNewLocale({
3229
- _locale,
3230
- locale,
3231
- locales,
3232
- defaultLocale,
3233
- localeCookieName,
3234
- customMapping,
3235
- enableI18n
3236
- }));
3420
+ if (_locale && _locale === locale && (0, _generaltranslation_format.determineLocale)(_locale, locales, customMapping) === locale) return _locale;
3421
+ let cookieLocale = getCookieValue(localeCookieName);
3422
+ if (cookieLocale) cookieLocale = (0, _generaltranslation_format.resolveAliasLocale)(cookieLocale, customMapping);
3423
+ const browserLocales = getBrowserLocales(customMapping);
3424
+ let newLocale = (0, _generaltranslation_format.determineLocale)([
3425
+ ..._locale ? [_locale] : [],
3426
+ ...cookieLocale ? [cookieLocale] : [],
3427
+ ...browserLocales
3428
+ ], locales, customMapping) || defaultLocale;
3429
+ if (newLocale) newLocale = (0, _generaltranslation_format.resolveAliasLocale)(newLocale, customMapping);
3430
+ if (cookieLocale && cookieLocale !== newLocale) setCookieValue(localeCookieName, newLocale);
3431
+ return newLocale;
3237
3432
  }, [
3238
3433
  _locale,
3239
- locale,
3240
- locales,
3434
+ customMapping,
3241
3435
  defaultLocale,
3436
+ enableI18n,
3242
3437
  localeCookieName,
3243
- enableI18n
3438
+ locales
3244
3439
  ]);
3245
- return [locale, setLocale];
3246
- }
3247
- /**
3248
- * Choose a locale to use
3249
- * (1) use provided locale
3250
- * (2) use cookie locale
3251
- * (3) use preferred locale
3252
- * (5) fallback to defaultLocale
3253
- * Update the cookie locale to be correct
3254
- */
3255
- function getNewLocale({ _locale, locale, locales, defaultLocale, localeCookieName, customMapping, enableI18n }) {
3256
- if (!enableI18n) return defaultLocale;
3257
- if (_locale && _locale === locale && (0, _generaltranslation_format.determineLocale)(_locale, locales, customMapping) === locale) return (0, _generaltranslation_format.resolveAliasLocale)(_locale, customMapping);
3258
- let cookieLocale = typeof document !== "undefined" ? document.cookie.split("; ").find((row) => row.startsWith(`${localeCookieName}=`))?.split("=")[1] : void 0;
3259
- if (cookieLocale) cookieLocale = (0, _generaltranslation_format.resolveAliasLocale)(cookieLocale, customMapping);
3260
- let browserLocales = (() => {
3261
- if (typeof navigator === "undefined") return [];
3262
- if (navigator?.languages) return navigator.languages;
3263
- if (navigator?.language) return [navigator.language];
3264
- const legacyNavigator = navigator;
3265
- if (legacyNavigator.userLanguage) return [legacyNavigator.userLanguage];
3266
- return [];
3267
- })();
3268
- browserLocales = browserLocales.map((locale) => (0, _generaltranslation_format.resolveAliasLocale)(locale, customMapping));
3269
- let newLocale = (0, _generaltranslation_format.determineLocale)([
3270
- ..._locale ? [_locale] : [],
3271
- ...cookieLocale ? [cookieLocale] : [],
3272
- ...browserLocales
3273
- ], locales, customMapping) || defaultLocale;
3274
- if (newLocale) newLocale = (0, _generaltranslation_format.resolveAliasLocale)(newLocale, customMapping);
3275
- if (cookieLocale && cookieLocale !== newLocale && typeof document !== "undefined") document.cookie = `${localeCookieName}=${newLocale};path=/`;
3276
- return newLocale;
3277
- }
3278
- function createSetLocale({ locale, locales, defaultLocale, localeCookieName, _setLocale, customMapping, enableI18n, reloadOnLocaleUpdate }) {
3279
- locale = (0, _generaltranslation_format.resolveAliasLocale)(locale, customMapping);
3280
- const setLocaleWithoutSettingCookie = (newLocale) => {
3440
+ const initializeLocale = () => {
3441
+ if (!enableI18n) return defaultLocale;
3442
+ return (0, _generaltranslation_format.resolveAliasLocale)(ssr ? _locale ? (0, _generaltranslation_format.determineLocale)(_locale, locales, customMapping) || "" : "" : getNewLocale(_locale), customMapping);
3443
+ };
3444
+ const [locale, _setLocale] = (0, react.useState)(initializeLocale);
3445
+ const currentLocale = (0, _generaltranslation_format.resolveAliasLocale)(locale, customMapping);
3446
+ const setLocaleWithoutSettingCookie = (0, react.useCallback)((newLocale) => {
3281
3447
  if (!enableI18n) return defaultLocale;
3282
- if (newLocale === locale) return locale;
3283
- const validatedLocale = (0, _generaltranslation_format.resolveAliasLocale)((0, _generaltranslation_format.determineLocale)(newLocale, locales, customMapping) || locale || defaultLocale, customMapping);
3284
- if (validatedLocale !== newLocale) console.warn(t$1(validatedLocale, newLocale, PACKAGE_NAME));
3448
+ if (newLocale === currentLocale) return currentLocale;
3449
+ const validatedLocale = (0, _generaltranslation_format.resolveAliasLocale)((0, _generaltranslation_format.determineLocale)(newLocale, locales, customMapping) || currentLocale || defaultLocale, customMapping);
3450
+ if (validatedLocale !== newLocale) console.warn(s$1(validatedLocale, newLocale, PACKAGE_NAME));
3285
3451
  _setLocale(validatedLocale);
3286
3452
  return validatedLocale;
3287
- };
3453
+ }, [
3454
+ currentLocale,
3455
+ customMapping,
3456
+ defaultLocale,
3457
+ enableI18n,
3458
+ locales
3459
+ ]);
3288
3460
  const setLocale = (newLocale) => {
3289
3461
  if (!enableI18n) return;
3290
3462
  newLocale = (0, _generaltranslation_format.resolveAliasLocale)(newLocale);
3291
- const validatedLocale = setLocaleWithoutSettingCookie(newLocale);
3292
- if (typeof document !== "undefined") document.cookie = `${localeCookieName}=${validatedLocale};path=/`;
3293
- if (typeof window !== "undefined" && newLocale !== locale && reloadOnLocaleUpdate) window.location.reload();
3463
+ setCookieValue(localeCookieName, setLocaleWithoutSettingCookie(newLocale));
3464
+ if (typeof window !== "undefined" && newLocale !== currentLocale && reloadOnLocaleUpdate) window.location.reload();
3294
3465
  };
3295
- return [setLocale, setLocaleWithoutSettingCookie];
3466
+ (0, react.useEffect)(() => {
3467
+ setLocaleWithoutSettingCookie(getNewLocale(locale));
3468
+ }, [
3469
+ locale,
3470
+ setLocaleWithoutSettingCookie,
3471
+ getNewLocale
3472
+ ]);
3473
+ return [locale, setLocale];
3474
+ }
3475
+ function getBrowserLocales(customMapping) {
3476
+ if (typeof navigator === "undefined") return [];
3477
+ const legacyNavigator = navigator;
3478
+ return (navigator.languages || (navigator.language ? [navigator.language] : legacyNavigator.userLanguage ? [legacyNavigator.userLanguage] : [])).map((locale) => (0, _generaltranslation_format.resolveAliasLocale)(locale, customMapping));
3296
3479
  }
3297
3480
  //#endregion
3298
3481
  //#region src/react-context/provider/helpers/isSSREnabled.ts
@@ -3377,13 +3560,12 @@ function _convertCustomNamesToMapping(customNames) {
3377
3560
  */
3378
3561
  function InternalLocaleSelector({ locale, locales, customNames, customMapping = _convertCustomNamesToMapping(customNames), setLocale, getLocaleProperties, ...props }) {
3379
3562
  const getDisplayName = (locale) => {
3380
- if (customMapping && customMapping[locale]) {
3381
- if (typeof customMapping[locale] === "string") return customMapping[locale];
3382
- if (customMapping[locale].name) return customMapping[locale].name;
3383
- }
3563
+ const customLocale = customMapping?.[locale];
3564
+ if (typeof customLocale === "string") return customLocale;
3565
+ if (customLocale?.name) return customLocale.name;
3384
3566
  return capitalizeName(getLocaleProperties(locale).nativeNameWithRegionCode);
3385
3567
  };
3386
- if (!locales || locales.length === 0 || !setLocale) return null;
3568
+ if (!locales?.length || !setLocale) return null;
3387
3569
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
3388
3570
  ...props,
3389
3571
  value: locale || "",