@intlify/core 12.0.0-alpha.5 → 12.0.0-alpha.7

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,5 +1,5 @@
1
1
  /**
2
- * @intlify/core v12.0.0-alpha.5
2
+ * @intlify/core v12.0.0-alpha.7
3
3
  * (c) 2016-present kazuya kawaguchi and contributors
4
4
  * @license MIT
5
5
  **/ const e = /\{([0-9a-z]+)\}/gi;
@@ -21,20 +21,20 @@ function p(e, t) {
21
21
  function m(e) {
22
22
  return f(Object.prototype, e);
23
23
  }
24
- const h = Array.isArray, g = (e) => typeof e == `function`, _ = (e) => typeof e == `string`, v = (e) => typeof e == `boolean`, y = (e) => typeof e == `object` && !!e, b = (e) => y(e) && g(e.then) && g(e.catch), x = Object.prototype.toString, S = (e) => x.call(e), C = (e) => S(e) === `[object Object]`, ee = (e) => e == null ? `` : h(e) || C(e) && e.toString === x ? JSON.stringify(e, null, 2) : String(e);
25
- function te(e, t = ``) {
24
+ const h = Array.isArray, g = (e) => typeof e == `function`, _ = (e) => typeof e == `string`, v = (e) => typeof e == `boolean`, y = (e) => typeof e == `object` && !!e, b = (e) => y(e) && g(e.then) && g(e.catch), x = Object.prototype.toString, S = (e) => x.call(e), C = (e) => S(e) === `[object Object]`, w = (e) => e == null ? `` : h(e) || C(e) && e.toString === x ? JSON.stringify(e, null, 2) : String(e);
25
+ function ee(e, t = ``) {
26
26
  return e.reduce((e, n, r) => r === 0 ? e + n : e + t + n, ``);
27
27
  }
28
- function ne(e, t) {
28
+ function te(e, t) {
29
29
  typeof console < `u` && (console.warn(`[intlify] ` + e), t && console.warn(t.stack));
30
30
  }
31
- function w(e) {
31
+ function T(e) {
32
32
  return e.replace(/&/g, `&amp;`).replace(/</g, `&lt;`).replace(/>/g, `&gt;`).replace(/"/g, `&quot;`).replace(/'/g, `&apos;`).replace(/\//g, `&#x2F;`).replace(/=/g, `&#x3D;`);
33
33
  }
34
- function re(e) {
34
+ function ne(e) {
35
35
  return e.replace(/&(?![a-z0-9#]{2,6};)/gi, `&amp;`).replace(/"/g, `&quot;`).replace(/'/g, `&apos;`).replace(/</g, `&lt;`).replace(/>/g, `&gt;`);
36
36
  }
37
- const ie = /^javascript:/i, ae = /^(?:href|src|action|formaction)$/i, oe = /&#(?:x([0-9a-f]+)|(\d+));?/gi, se = /&(?:Tab|NewLine);/g, ce = /&colon;?/gi, T = /[\u0000-\u0020\u007f-\u009f]/g, le = /(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i, ue = /(^|[\s"'<>/])on(\w+\s*=)/gi, E = /(?:^|[\s"'<>/])srcdoc\s*=/i, de = /(^|[\s"'<>/])s(rcdoc\s*=)/gi, fe = /(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;
37
+ const re = /^javascript:/i, ie = /^(?:href|src|action|formaction)$/i, ae = /&#(?:x([0-9a-f]+)|(\d+));?/gi, E = /&(?:Tab|NewLine);/g, oe = /&colon;?/gi, se = /[\u0000-\u0020\u007f-\u009f]/g, ce = /(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i, le = /(^|[\s"'<>/])on(\w+\s*=)/gi, ue = /(?:^|[\s"'<>/])srcdoc\s*=/i, de = /(^|[\s"'<>/])s(rcdoc\s*=)/gi, fe = /(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;
38
38
  function pe(e, t, n) {
39
39
  let r = t || n;
40
40
  if (!r) return e;
@@ -42,8 +42,8 @@ function pe(e, t, n) {
42
42
  return i <= 127 ? String.fromCharCode(i) : e;
43
43
  }
44
44
  function D(e) {
45
- let t = e.replace(oe, pe).replace(se, ``).replace(ce, `:`).replace(T, ``);
46
- return ie.test(t);
45
+ let t = e.replace(ae, pe).replace(E, ``).replace(oe, `:`).replace(se, ``);
46
+ return re.test(t);
47
47
  }
48
48
  function me(e) {
49
49
  let t = /url\s*\(/gi, n = ``, r = 0, i;
@@ -66,10 +66,10 @@ function me(e) {
66
66
  return n + e.slice(r);
67
67
  }
68
68
  function he(e, t) {
69
- return ae.test(e) && D(t) ? `about:blank` : re(e.toLowerCase() === `style` ? me(t) : t);
69
+ return ie.test(e) && D(t) ? `about:blank` : ne(e.toLowerCase() === `style` ? me(t) : t);
70
70
  }
71
71
  function ge(e) {
72
- return e = e.replace(/([\w:-]+)\s*=\s*"([^"]*)"/g, (e, t, n) => `${t}="${he(t, n)}"`), e = e.replace(/([\w:-]+)\s*=\s*'([^']*)'/g, (e, t, n) => `${t}='${he(t, n)}'`), le.test(e) && (e = e.replace(ue, `$1&#111;n$2`)), E.test(e) && (e = e.replace(de, `$1&#115;$2`)), e = e.replace(fe, (e, t, n, r) => D(r) ? `${t}${n}about:blank` : e), e;
72
+ return e = e.replace(/([\w:-]+)\s*=\s*"([^"]*)"/g, (e, t, n) => `${t}="${he(t, n)}"`), e = e.replace(/([\w:-]+)\s*=\s*'([^']*)'/g, (e, t, n) => `${t}='${he(t, n)}'`), ce.test(e) && (e = e.replace(le, `$1&#111;n$2`)), ue.test(e) && (e = e.replace(de, `$1&#115;$2`)), e = e.replace(fe, (e, t, n, r) => D(r) ? `${t}${n}about:blank` : e), e;
73
73
  }
74
74
  const _e = (e) => !y(e) || h(e);
75
75
  function ve(e, t) {
@@ -119,178 +119,179 @@ function ye(e, t, n = {}) {
119
119
  return o.code = e, t && (o.location = t), o.domain = r, o;
120
120
  }
121
121
  function k(e) {
122
- return y(e) && F(e) === 0 && (f(e, `b`) || f(e, `body`));
122
+ return y(e) && N(e) === 0 && (f(e, `b`) || f(e, `body`));
123
123
  }
124
- const A = [`b`, `body`];
125
- function be(e) {
126
- return L(e, A);
127
- }
128
- const j = [`c`, `cases`];
124
+ const be = [`b`, `body`];
129
125
  function xe(e) {
130
- return L(e, j, []);
126
+ return F(e, be);
131
127
  }
132
- const M = [`s`, `static`];
128
+ const A = [`c`, `cases`];
133
129
  function Se(e) {
134
- return L(e, M);
130
+ return F(e, A, []);
135
131
  }
136
- const N = [`i`, `items`];
132
+ const j = [`s`, `static`];
137
133
  function Ce(e) {
138
- return L(e, N, []);
134
+ return F(e, j);
139
135
  }
140
- const P = [`t`, `type`];
141
- function F(e) {
142
- return L(e, P);
136
+ const M = [`i`, `items`];
137
+ function we(e) {
138
+ return F(e, M, []);
143
139
  }
144
- const we = [`v`, `value`];
145
- function I(e, t) {
146
- let n = L(e, we);
147
- if (n != null) return n;
148
- throw R(t);
140
+ const Te = [`t`, `type`];
141
+ function N(e) {
142
+ return F(e, Te);
149
143
  }
150
- const Te = [`m`, `modifier`];
151
- function Ee(e) {
152
- return L(e, Te);
144
+ const Ee = [`v`, `value`];
145
+ function P(e, t) {
146
+ let n = F(e, Ee);
147
+ if (n != null) return n;
148
+ throw I(t);
153
149
  }
154
- const De = [`k`, `key`];
150
+ const De = [`m`, `modifier`];
155
151
  function Oe(e) {
156
- let t = L(e, De);
152
+ return F(e, De);
153
+ }
154
+ const ke = [`k`, `key`];
155
+ function Ae(e) {
156
+ let t = F(e, ke);
157
157
  if (t) return t;
158
- throw R(6);
158
+ throw I(6);
159
159
  }
160
- function L(e, t, n) {
160
+ function F(e, t, n) {
161
161
  for (let n = 0; n < t.length; n++) {
162
162
  let r = t[n];
163
163
  if (f(e, r) && e[r] != null) return e[r];
164
164
  }
165
165
  return n;
166
166
  }
167
- const ke = [
167
+ const je = [
168
+ ...be,
168
169
  ...A,
169
170
  ...j,
170
171
  ...M,
171
- ...N,
172
+ ...ke,
172
173
  ...De,
173
- ...Te,
174
- ...we,
175
- ...P
174
+ ...Ee,
175
+ ...Te
176
176
  ];
177
- function R(e) {
177
+ function I(e) {
178
178
  return Error(`unhandled node type: ${e}`);
179
179
  }
180
- function Ae(e) {
181
- return (t) => je(t, e);
182
- }
183
- function je(e, t) {
184
- let n = be(t);
185
- if (n == null) throw R(0);
186
- if (F(n) === 1) {
187
- let t = xe(n);
188
- return e.plural(t.reduce((t, n) => [...h(t) ? t : [t], Me(e, n)], []));
180
+ function Me(e) {
181
+ return (t) => Ne(t, e);
182
+ }
183
+ function Ne(e, t) {
184
+ let n = xe(t);
185
+ if (n == null) throw I(0);
186
+ if (N(n) === 1) {
187
+ let t = Se(n);
188
+ return e.plural(t.reduce((t, n) => [...h(t) ? t : [t], Pe(e, n)], []));
189
189
  }
190
- return Me(e, n);
190
+ return Pe(e, n);
191
191
  }
192
- function Me(e, t) {
193
- let n = Se(t);
192
+ function Pe(e, t) {
193
+ let n = Ce(t);
194
194
  if (n != null) return e.type === `text` ? n : e.normalize([n]);
195
195
  {
196
- let n = Ce(t).reduce((t, n) => [...t, z(e, n)], []);
196
+ let n = we(t).reduce((t, n) => [...t, L(e, n)], []);
197
197
  return e.normalize(n);
198
198
  }
199
199
  }
200
- function z(e, t) {
201
- let n = F(t);
200
+ function L(e, t) {
201
+ let n = N(t);
202
202
  switch (n) {
203
- case 3: return I(t, n);
204
- case 9: return I(t, n);
203
+ case 3: return P(t, n);
204
+ case 9: return P(t, n);
205
205
  case 4: {
206
206
  let r = t;
207
207
  if (f(r, `k`) && r.k) return e.interpolate(e.named(r.k));
208
208
  if (f(r, `key`) && r.key) return e.interpolate(e.named(r.key));
209
- throw R(n);
209
+ throw I(n);
210
210
  }
211
211
  case 5: {
212
212
  let r = t;
213
213
  if (f(r, `i`) && i(r.i)) return e.interpolate(e.list(r.i));
214
214
  if (f(r, `index`) && i(r.index)) return e.interpolate(e.list(r.index));
215
- throw R(n);
215
+ throw I(n);
216
216
  }
217
217
  case 6: {
218
- let n = t, r = Ee(n), i = Oe(n);
219
- return e.linked(z(e, i), r ? z(e, r) : void 0, e.type);
218
+ let n = t, r = Oe(n), i = Ae(n);
219
+ return e.linked(L(e, i), r ? L(e, r) : void 0, e.type);
220
220
  }
221
- case 7: return I(t, n);
222
- case 8: return I(t, n);
221
+ case 7: return P(t, n);
222
+ case 8: return P(t, n);
223
223
  default: throw Error(`unhandled node on format message part: ${n}`);
224
224
  }
225
225
  }
226
- let B = u();
227
- function Ne() {
228
- B = u();
226
+ let R = u();
227
+ function Fe() {
228
+ R = u();
229
229
  }
230
- function Pe(e, t) {
230
+ function Ie(e, t) {
231
231
  {
232
+ if (!k(e)) return (() => e);
232
233
  let t = e.cacheKey;
233
- return t ? B[t] || (B[t] = Ae(e)) : Ae(e);
234
+ return t ? R[t] || (R[t] = Me(e)) : Me(e);
234
235
  }
235
236
  }
236
- const V = {
237
+ const z = {
237
238
  INVALID_ARGUMENT: 17,
238
239
  INVALID_DATE_ARGUMENT: 18,
239
240
  INVALID_ISO_DATE_ARGUMENT: 19,
240
241
  NOT_SUPPORT_LOCALE_PROMISE_VALUE: 20,
241
242
  NOT_SUPPORT_LOCALE_ASYNC_FUNCTION: 21,
242
243
  NOT_SUPPORT_LOCALE_TYPE: 22
243
- }, Fe = 23;
244
- function Ie(e) {
244
+ }, Le = 23;
245
+ function Re(e) {
245
246
  return ye(e, null, void 0);
246
247
  }
247
- V.INVALID_ARGUMENT, V.INVALID_DATE_ARGUMENT, V.INVALID_ISO_DATE_ARGUMENT, V.NOT_SUPPORT_LOCALE_PROMISE_VALUE, V.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION, V.NOT_SUPPORT_LOCALE_TYPE;
248
- function H(e, t) {
249
- return t.locale == null ? W(e.locale) : W(t.locale);
248
+ z.INVALID_ARGUMENT, z.INVALID_DATE_ARGUMENT, z.INVALID_ISO_DATE_ARGUMENT, z.NOT_SUPPORT_LOCALE_PROMISE_VALUE, z.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION, z.NOT_SUPPORT_LOCALE_TYPE;
249
+ function B(e, t) {
250
+ return t.locale == null ? H(e.locale) : H(t.locale);
250
251
  }
251
- let U;
252
- function W(e) {
252
+ let V;
253
+ function H(e) {
253
254
  if (_(e)) return e;
254
255
  if (g(e)) {
255
- if (e.resolvedOnce && U != null) return U;
256
+ if (e.resolvedOnce && V != null) return V;
256
257
  if (e.constructor.name === `Function`) {
257
258
  let t = e();
258
- if (b(t)) throw Error(V.NOT_SUPPORT_LOCALE_PROMISE_VALUE);
259
- return U = t;
259
+ if (b(t)) throw Error(z.NOT_SUPPORT_LOCALE_PROMISE_VALUE);
260
+ return V = t;
260
261
  }
261
- throw Error(V.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION);
262
+ throw Error(z.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION);
262
263
  }
263
- throw Error(V.NOT_SUPPORT_LOCALE_TYPE);
264
+ throw Error(z.NOT_SUPPORT_LOCALE_TYPE);
264
265
  }
265
- function Le(e, t, n) {
266
+ function ze(e, t, n) {
266
267
  return [.../* @__PURE__ */ new Set([n, ...h(t) ? t : y(t) ? Object.keys(t).filter((e) => e !== "default") : _(t) ? [t] : [n]])];
267
268
  }
268
- function Re(e, t, n) {
269
- let r = _(n) ? n : J, i = e, a;
269
+ function Be(e, t, n) {
270
+ let r = _(n) ? n : G, i = e, a;
270
271
  y(t) ? (i.__localeChainObjectCache || (i.__localeChainObjectCache = /* @__PURE__ */ new WeakMap()), a = i.__localeChainObjectCache.get(t), a || (a = /* @__PURE__ */ new Map(), i.__localeChainObjectCache.set(t, a))) : (i.__localeChainCache || (i.__localeChainCache = /* @__PURE__ */ new Map()), a = i.__localeChainCache.get(t), a || (a = /* @__PURE__ */ new Map(), i.__localeChainCache.set(t, a)));
271
272
  let o = a.get(r);
272
273
  if (o) return o;
273
274
  let s = [], c = [n];
274
- for (; h(c);) c = G(s, c, t);
275
+ for (; h(c);) c = Ve(s, c, t);
275
276
  let l = h(t) || !C(t) ? t : t.default ? t.default : null;
276
- return c = _(l) ? [l] : l, h(c) && G(s, c, !1), a.set(r, s), s;
277
+ return c = _(l) ? [l] : l, h(c) && Ve(s, c, !1), a.set(r, s), s;
277
278
  }
278
- function G(e, t, n) {
279
+ function Ve(e, t, n) {
279
280
  let r = !0;
280
281
  for (let i = 0; i < t.length && v(r); i++) {
281
282
  let a = t[i];
282
- _(a) && (r = ze(e, t[i], n));
283
+ _(a) && (r = He(e, t[i], n));
283
284
  }
284
285
  return r;
285
286
  }
286
- function ze(e, t, n) {
287
+ function He(e, t, n) {
287
288
  let r, i = t.split(`-`);
288
289
  do
289
- r = Be(e, i.join(`-`), n), i.splice(-1, 1);
290
+ r = Ue(e, i.join(`-`), n), i.splice(-1, 1);
290
291
  while (i.length && r === !0);
291
292
  return r;
292
293
  }
293
- function Be(e, t, n) {
294
+ function Ue(e, t, n) {
294
295
  let r = !1;
295
296
  if (!e.includes(t) && (r = !0, t)) {
296
297
  r = t[t.length - 1] !== `!`;
@@ -299,53 +300,53 @@ function Be(e, t, n) {
299
300
  }
300
301
  return r;
301
302
  }
302
- const K = [];
303
- K[0] = {
303
+ const U = [];
304
+ U[0] = {
304
305
  w: [0],
305
306
  i: [3, 0],
306
307
  "[": [4],
307
308
  o: [7]
308
- }, K[1] = {
309
+ }, U[1] = {
309
310
  w: [1],
310
311
  ".": [2],
311
312
  "[": [4],
312
313
  o: [7]
313
- }, K[2] = {
314
+ }, U[2] = {
314
315
  w: [2],
315
316
  i: [3, 0],
316
317
  0: [3, 0]
317
- }, K[3] = {
318
+ }, U[3] = {
318
319
  i: [3, 0],
319
320
  0: [3, 0],
320
321
  w: [1, 1],
321
322
  ".": [2, 1],
322
323
  "[": [4, 1],
323
324
  o: [7, 1]
324
- }, K[4] = {
325
+ }, U[4] = {
325
326
  "'": [5, 0],
326
327
  "\"": [6, 0],
327
328
  "[": [4, 2],
328
329
  "]": [1, 3],
329
330
  o: 8,
330
331
  l: [4, 0]
331
- }, K[5] = {
332
+ }, U[5] = {
332
333
  "'": [4, 0],
333
334
  o: 8,
334
335
  l: [5, 0]
335
- }, K[6] = {
336
+ }, U[6] = {
336
337
  "\"": [4, 0],
337
338
  o: 8,
338
339
  l: [6, 0]
339
340
  };
340
- const Ve = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
341
- function He(e) {
342
- return Ve.test(e);
341
+ const We = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
342
+ function Ge(e) {
343
+ return We.test(e);
343
344
  }
344
- function Ue(e) {
345
+ function Ke(e) {
345
346
  let t = e.charCodeAt(0);
346
347
  return t === e.charCodeAt(e.length - 1) && (t === 34 || t === 39) ? e.slice(1, -1) : e;
347
348
  }
348
- function We(e) {
349
+ function qe(e) {
349
350
  if (e == null) return `o`;
350
351
  switch (e.charCodeAt(0)) {
351
352
  case 91:
@@ -366,11 +367,11 @@ function We(e) {
366
367
  }
367
368
  return `i`;
368
369
  }
369
- function Ge(e) {
370
+ function Je(e) {
370
371
  let t = e.trim();
371
- return e.charAt(0) === `0` && isNaN(parseInt(e)) ? !1 : He(t) ? Ue(t) : `*` + t;
372
+ return e.charAt(0) === `0` && isNaN(parseInt(e)) ? !1 : Ge(t) ? Ke(t) : `*` + t;
372
373
  }
373
- function Ke(e) {
374
+ function Ye(e) {
374
375
  let t = [], n = -1, r = 0, i = 0, a, o, s, c, l, u, d, f = [];
375
376
  f[0] = () => {
376
377
  o === void 0 ? o = s : o += s;
@@ -381,7 +382,7 @@ function Ke(e) {
381
382
  }, f[3] = () => {
382
383
  if (i > 0) i--, r = 4, f[0]();
383
384
  else {
384
- if (i = 0, o === void 0 || (o = Ge(o), o === !1)) return !1;
385
+ if (i = 0, o === void 0 || (o = Je(o), o === !1)) return !1;
385
386
  f[1]();
386
387
  }
387
388
  };
@@ -390,29 +391,29 @@ function Ke(e) {
390
391
  if (r === 5 && t === `'` || r === 6 && t === `"`) return n++, s = `\\` + t, f[0](), !0;
391
392
  }
392
393
  for (; r !== null;) if (n++, a = e[n], !(a === `\\` && p())) {
393
- if (c = We(a), d = K[r], l = d[c] || d.l || 8, l === 8 || (r = l[0], l[1] !== void 0 && (u = f[l[1]], u && (s = a, u() === !1)))) return;
394
+ if (c = qe(a), d = U[r], l = d[c] || d.l || 8, l === 8 || (r = l[0], l[1] !== void 0 && (u = f[l[1]], u && (s = a, u() === !1)))) return;
394
395
  if (r === 7) return t;
395
396
  }
396
397
  }
397
- const qe = /* @__PURE__ */ new Map();
398
- function Je(e, t) {
399
- return y(e) ? e[t] : null;
398
+ const Xe = /* @__PURE__ */ new Map();
399
+ function Ze(e, t) {
400
+ return y(e) ? p(e, t) : null;
400
401
  }
401
- function Ye(e, t) {
402
+ function Qe(e, t) {
402
403
  if (!y(e)) return null;
403
- let n = qe.get(t);
404
- if (n || (n = Ke(t), n && qe.set(t, n)), !n) return null;
404
+ let n = Xe.get(t);
405
+ if (n || (n = Ye(t), n && Xe.set(t, n)), !n) return null;
405
406
  let r = n.length, i = e, a = 0;
406
407
  for (; a < r;) {
407
408
  let e = n[a];
408
- if (ke.includes(e) && k(i) || !y(i) || !f(i, e)) return null;
409
+ if (je.includes(e) && k(i) || !y(i) || !f(i, e)) return null;
409
410
  let t = i[e];
410
411
  if (t === void 0 || g(i)) return null;
411
412
  i = t, a++;
412
413
  }
413
414
  return i;
414
415
  }
415
- const q = {
416
+ const W = {
416
417
  NOT_FOUND_KEY: 1,
417
418
  FALLBACK_TO_TRANSLATE: 2,
418
419
  CANNOT_FORMAT_NUMBER: 3,
@@ -421,87 +422,99 @@ const q = {
421
422
  FALLBACK_TO_DATE_FORMAT: 6,
422
423
  EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: 7,
423
424
  INVALID_NUMBER_ARGUMENT: 8,
424
- INVALID_DATE_ARGUMENT: 9
425
- }, Xe = 10, Ze = {
426
- [q.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale messages.`,
427
- [q.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`,
428
- [q.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
429
- [q.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`,
430
- [q.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
431
- [q.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.`,
432
- [q.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: `This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future.`,
433
- [q.INVALID_NUMBER_ARGUMENT]: `Invalid argument for number formatting: expected a number but received '{value}'.`,
434
- [q.INVALID_DATE_ARGUMENT]: `Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'.`
425
+ INVALID_DATE_ARGUMENT: 9,
426
+ IGNORE_UNSAFE_LOCALE: 10,
427
+ FALLBACK_TO_DEFAULT_PLURAL_RULE: 11,
428
+ FALLBACK_FROM_INVALID_LOCALE: 12
429
+ }, $e = 13, et = {
430
+ [W.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale {resource}.`,
431
+ [W.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`,
432
+ [W.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
433
+ [W.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`,
434
+ [W.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
435
+ [W.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.`,
436
+ [W.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: `This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future.`,
437
+ [W.INVALID_NUMBER_ARGUMENT]: `Invalid argument for number formatting: expected a number but received '{value}'.`,
438
+ [W.INVALID_DATE_ARGUMENT]: `Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'.`,
439
+ [W.IGNORE_UNSAFE_LOCALE]: `Ignore '{locale}' locale: it is a property name of Object.prototype`,
440
+ [W.FALLBACK_TO_DEFAULT_PLURAL_RULE]: `Fall back to the default plural rule for '{locale}' locale: Intl.PluralRules does not support it`,
441
+ [W.FALLBACK_FROM_INVALID_LOCALE]: `Fall back to '{target}' locale for {type} formatting with '{locale}' locale: it is not a BCP 47 language tag`
435
442
  };
436
- function Qe(e, ...n) {
437
- return t(Ze[e], ...n);
443
+ function tt(e, ...n) {
444
+ return t(et[e], ...n);
438
445
  }
439
- const $e = `12.0.0-alpha.5`, et = -1, J = `en-US`, tt = ``, nt = (e) => `${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;
440
- function rt() {
446
+ const nt = `12.0.0-alpha.7`, rt = -1, G = `en-US`, it = ``, at = (e) => `${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;
447
+ function ot() {
441
448
  return {
442
449
  upper: (e, t) => t === `text` && _(e) ? e.toUpperCase() : t === `vnode` && y(e) && `__v_isVNode` in e ? e.children.toUpperCase() : e,
443
450
  lower: (e, t) => t === `text` && _(e) ? e.toLowerCase() : t === `vnode` && y(e) && `__v_isVNode` in e ? e.children.toLowerCase() : e,
444
- capitalize: (e, t) => t === `text` && _(e) ? nt(e) : t === `vnode` && y(e) && `__v_isVNode` in e ? nt(e.children) : e
451
+ capitalize: (e, t) => t === `text` && _(e) ? at(e) : t === `vnode` && y(e) && `__v_isVNode` in e ? at(e.children) : e
445
452
  };
446
453
  }
447
- let it;
448
- function at(e) {
449
- it = e;
454
+ let st;
455
+ function ct(e) {
456
+ st = e;
450
457
  }
451
- let ot;
452
- function st(e) {
453
- ot = e;
458
+ let lt;
459
+ function ut(e) {
460
+ lt = e;
454
461
  }
455
- let ct;
456
- function lt(e) {
457
- ct = e;
462
+ let dt;
463
+ function ft(e) {
464
+ dt = e;
458
465
  }
459
- let ut = 0;
460
- function dt(e = {}) {
461
- let t = g(e.onWarn) ? e.onWarn : ne, n = _(e.version) ? e.version : $e, r = _(e.locale) || g(e.locale) ? e.locale : J, i = g(r) ? J : r, a = h(e.fallbackLocale) || C(e.fallbackLocale) || _(e.fallbackLocale) || e.fallbackLocale === !1 ? e.fallbackLocale : i, s = C(e.messages) ? e.messages : Y(i), l = C(e.datetimeFormats) ? e.datetimeFormats : Y(i), d = C(e.numberFormats) ? e.numberFormats : Y(i), f = c(u(), e.modifiers, rt()), p = e.pluralRules || u(), m = g(e.missing) ? e.missing : null, b = v(e.missingWarn) || o(e.missingWarn) ? e.missingWarn : !0, x = v(e.fallbackWarn) || o(e.fallbackWarn) ? e.fallbackWarn : !0, S = !!e.fallbackFormat, ee = !!e.unresolving, te = g(e.postTranslation) ? e.postTranslation : null, w = C(e.processor) ? e.processor : null, re = !v(e.warnHtmlMessage) || e.warnHtmlMessage, ie = !!e.escapeParameter, ae = g(e.messageCompiler) ? e.messageCompiler : it || null, oe = g(e.messageResolver) ? e.messageResolver : ot || Je, se = g(e.localeFallbacker) ? e.localeFallbacker : ct || Le, ce = y(e.fallbackContext) ? e.fallbackContext : void 0, T = e, le = y(T.__datetimeFormatters) ? T.__datetimeFormatters : /* @__PURE__ */ new Map(), ue = y(T.__numberFormatters) ? T.__numberFormatters : /* @__PURE__ */ new Map();
462
- ut++;
466
+ let pt = 0;
467
+ function mt(e = {}) {
468
+ let t = g(e.onWarn) ? e.onWarn : te, n = _(e.version) ? e.version : nt, r = _(e.locale) || g(e.locale) ? e.locale : G, i = g(r) ? G : r, a = _t(e.fallbackLocale) ? e.fallbackLocale : i, o = C(e.messages) ? e.messages : K(i), s = C(e.datetimeFormats) ? e.datetimeFormats : K(i), l = C(e.numberFormats) ? e.numberFormats : K(i), d = c(u(), e.modifiers, ot()), f = e.pluralRules || u(), p = g(e.missing) ? e.missing : null, m = !q(e.missingWarn) || e.missingWarn, h = !q(e.fallbackWarn) || e.fallbackWarn, b = !!e.fallbackFormat, x = !!e.unresolving, S = g(e.postTranslation) ? e.postTranslation : null, w = C(e.processor) ? e.processor : null, ee = !v(e.warnHtmlMessage) || e.warnHtmlMessage, T = !!e.escapeParameter, ne = g(e.messageCompiler) ? e.messageCompiler : st || null, re = g(e.messageResolver) ? e.messageResolver : lt || Ze, ie = g(e.localeFallbacker) ? e.localeFallbacker : dt || ze, ae = y(e.fallbackContext) ? e.fallbackContext : void 0;
469
+ pt++;
463
470
  let E = {
464
471
  version: n,
465
- cid: ut,
472
+ cid: pt,
466
473
  locale: r,
467
474
  fallbackLocale: a,
468
- messages: s,
469
- modifiers: f,
470
- pluralRules: p,
471
- missing: m,
472
- missingWarn: b,
473
- fallbackWarn: x,
474
- fallbackFormat: S,
475
- unresolving: ee,
476
- postTranslation: te,
475
+ messages: o,
476
+ modifiers: d,
477
+ pluralRules: f,
478
+ missing: p,
479
+ missingWarn: m,
480
+ fallbackWarn: h,
481
+ fallbackFormat: b,
482
+ unresolving: x,
483
+ postTranslation: S,
477
484
  processor: w,
478
- warnHtmlMessage: re,
479
- escapeParameter: ie,
480
- messageCompiler: ae,
481
- messageResolver: oe,
482
- localeFallbacker: se,
483
- fallbackContext: ce,
485
+ warnHtmlMessage: ee,
486
+ escapeParameter: T,
487
+ messageCompiler: ne,
488
+ messageResolver: re,
489
+ localeFallbacker: ie,
490
+ fallbackContext: ae,
484
491
  onWarn: t
485
492
  };
486
- return E.datetimeFormats = l, E.numberFormats = d, E.__datetimeFormatters = le, E.__numberFormatters = ue, E;
493
+ return E.datetimeFormats = s, E.numberFormats = l, E.__datetimeFormatters = /* @__PURE__ */ new Map(), E.__numberFormatters = /* @__PURE__ */ new Map(), E;
487
494
  }
488
- const Y = (e) => ({ [e]: u() });
489
- function ft(e, t) {
495
+ const K = (e) => ({ [e]: u() });
496
+ function ht(e, t) {
490
497
  let n = p(e.messages, t);
491
498
  if (n == null) return;
492
499
  let r = u();
493
500
  return ve(n, r), r;
494
501
  }
495
- function pt(e, t, n) {
502
+ function gt(e, t, n) {
496
503
  m(t) || (e.messages[t] = n);
497
504
  }
498
- function mt(e, t) {
505
+ function _t(e) {
506
+ return _(e) || h(e) || C(e) || e === !1;
507
+ }
508
+ function q(e) {
509
+ return v(e) || o(e);
510
+ }
511
+ function vt(e, t) {
499
512
  return o(e) ? e.test(t) : e;
500
513
  }
501
- function ht(e, t) {
514
+ function yt(e, t) {
502
515
  return o(e) ? e.test(t) : e;
503
516
  }
504
- function X(e, t, n, r, i) {
517
+ function J(e, t, n, r, i) {
505
518
  let { missing: a, onWarn: o } = e;
506
519
  if (a !== null) {
507
520
  let r = a(e, n, t, i);
@@ -509,61 +522,84 @@ function X(e, t, n, r, i) {
509
522
  }
510
523
  return t;
511
524
  }
512
- function gt(e, t) {
525
+ function bt(e, t) {
513
526
  let n = e;
514
527
  y(t) ? n.__localeChainObjectCache?.delete(t) : n.__localeChainCache?.delete(t);
515
528
  }
516
- function _t(e, t, n) {
517
- gt(e, n), e.fallbackContext && gt(e.fallbackContext, n), e.localeFallbacker(e, n, t);
529
+ function xt(e, t, n) {
530
+ bt(e, n), e.fallbackContext && bt(e.fallbackContext, n);
531
+ {
532
+ let { __datetimeFormatters: t, __numberFormatters: n } = e;
533
+ t.clear(), n.clear();
534
+ }
535
+ e.localeFallbacker(e, n, t);
518
536
  }
519
- function vt(e, t) {
537
+ function St(e, t) {
520
538
  return e !== t && e.split(`-`)[0] === t.split(`-`)[0];
521
539
  }
522
- function yt(e, t) {
540
+ function Ct(e, t) {
523
541
  let n = t.indexOf(e);
524
542
  if (n === -1) return !1;
525
- for (let r = n + 1; r < t.length; r++) if (vt(e, t[r])) return !0;
543
+ for (let r = n + 1; r < t.length; r++) if (St(e, t[r])) return !0;
526
544
  return !1;
527
545
  }
528
- function bt(e, t, n, r, i, a, o) {
546
+ function wt(e, t, n, r, i, a, o) {
529
547
  let { fallbackLocale: s, localeFallbacker: c, onWarn: l } = e, u = c(e, s, n);
530
548
  for (let n = 0; n < u.length; n++) {
531
- let a = u[n], s = (r[a] || {})[t];
549
+ let a = u[n], s = p(p(r, a) || {}, t);
532
550
  if (C(s) && _(a)) return a;
533
- X(e, t, a, i, o);
551
+ J(e, t, a, i, o);
534
552
  }
535
553
  return null;
536
554
  }
537
- function xt(e, t, n) {
555
+ function Tt(e) {
556
+ try {
557
+ return Intl.getCanonicalLocales(e), !0;
558
+ } catch {
559
+ return !1;
560
+ }
561
+ }
562
+ function Et(e, t, n, r, i) {
563
+ try {
564
+ return new t(n, r);
565
+ } catch (i) {
566
+ if (Tt(n)) throw i;
567
+ let { fallbackLocale: a, localeFallbacker: o, onWarn: s } = e;
568
+ return new t(o(e, a, n).find(Tt) || `en-US`, r);
569
+ }
570
+ }
571
+ function Dt(e, [t, n, r, i], a, o, s, l) {
572
+ let u = v(r.missingWarn) ? r.missingWarn : e.missingWarn, d = v(r.fallbackWarn) ? r.fallbackWarn : e.fallbackWarn, f = !!r.part, p = B(e, r);
573
+ if (!_(t) || t === ``) {
574
+ let t = Et(e, a, p.replace(/!/g, ``), i, l);
575
+ return f ? t.formatToParts(n) : t.format(n);
576
+ }
577
+ let m = wt(e, t, p, s, u, d, l);
578
+ if (!_(m)) return e.unresolving ? -1 : t;
579
+ let h = s[m][t], g = Ot(m, t, i), y = o.get(g);
580
+ return y || (y = Et(e, a, m, c({}, h, i), l), o.set(g, y)), f ? y.formatToParts(n) : y.format(n);
581
+ }
582
+ function Ot(e, t, n) {
538
583
  let r = `${e}__${t}`;
539
584
  return C(n) && !s(n) && (r = `${r}__${JSON.stringify(n)}`), r;
540
585
  }
541
- function St(e, t, n) {
586
+ function kt(e, t, n) {
542
587
  for (let r in n) {
543
588
  let n = `${t}__${r}`;
544
589
  for (let t of e.keys()) (t === n || t.startsWith(`${n}__`)) && e.delete(t);
545
590
  }
546
591
  }
547
- function Ct(e, t, n, r) {
592
+ function At(e, t, n, r) {
548
593
  let [, i, a, o] = e, s = n;
549
594
  return _(i) ? t.key = i : C(i) && Object.keys(i).forEach((e) => {
550
595
  r.includes(e) ? s[e] = i[e] : t[e] = i[e];
551
596
  }), _(a) ? t.locale = a : C(a) && (s = a), C(o) && (s = o), s;
552
597
  }
553
- function wt(e, ...t) {
554
- let { datetimeFormats: n, unresolving: r, onWarn: o } = e, { __datetimeFormatters: s } = e;
555
- if (!_(t[0]) && !a(t[0]) && !i(t[0])) return ``;
556
- let [l, u, d, f] = Et(...t), p = v(d.missingWarn) ? d.missingWarn : e.missingWarn, m = v(d.fallbackWarn) ? d.fallbackWarn : e.fallbackWarn, h = !!d.part, g = H(e, d);
557
- if (!_(l) || l === ``) {
558
- let e = new Intl.DateTimeFormat(g.replace(/!/g, ``), f);
559
- return h ? e.formatToParts(u) : e.format(u);
560
- }
561
- let y = bt(e, l, g, n, p, m, `datetime format`);
562
- if (!_(y)) return r ? -1 : l;
563
- let b = n[y][l], x = xt(y, l, f), S = s.get(x);
564
- return S || (S = new Intl.DateTimeFormat(y, c({}, b, f)), s.set(x, S)), h ? S.formatToParts(u) : S.format(u);
598
+ function jt(e, ...t) {
599
+ let { datetimeFormats: n, onWarn: r } = e, { __datetimeFormatters: o } = e;
600
+ return !_(t[0]) && !a(t[0]) && !i(t[0]) ? `` : Dt(e, Nt(...t), Intl.DateTimeFormat, o, n, `datetime format`);
565
601
  }
566
- const Tt = [
602
+ const Mt = [
567
603
  `localeMatcher`,
568
604
  `weekday`,
569
605
  `era`,
@@ -585,24 +621,24 @@ const Tt = [
585
621
  `hourCycle`,
586
622
  `fractionalSecondDigits`
587
623
  ];
588
- function Et(...e) {
624
+ function Nt(...e) {
589
625
  let [t] = e, n = u(), r = u(), o;
590
626
  if (_(t)) {
591
627
  let e = t.match(/^(\d{4}-\d{2}-\d{2})(?:(T|\s)(.+))?$/);
592
- if (!e) throw Error(V.INVALID_ISO_DATE_ARGUMENT);
628
+ if (!e) throw Error(z.INVALID_ISO_DATE_ARGUMENT);
593
629
  let n = e[3] ? e[3].trim().startsWith(`T`) ? `${e[1].trim()}${e[3].trim()}` : `${e[1].trim()}T${e[3].trim()}` : e[1].trim();
594
630
  o = new Date(n);
595
631
  try {
596
632
  o.toISOString();
597
633
  } catch {
598
- throw Error(V.INVALID_ISO_DATE_ARGUMENT);
634
+ throw Error(z.INVALID_ISO_DATE_ARGUMENT);
599
635
  }
600
636
  } else if (a(t)) {
601
- if (isNaN(t.getTime())) throw Error(V.INVALID_DATE_ARGUMENT);
637
+ if (isNaN(t.getTime())) throw Error(z.INVALID_DATE_ARGUMENT);
602
638
  o = t;
603
639
  } else if (i(t)) o = t;
604
- else throw Error(V.INVALID_ARGUMENT);
605
- let s = Ct(e, n, r, Tt);
640
+ else throw Error(z.INVALID_ARGUMENT);
641
+ let s = At(e, n, r, Mt);
606
642
  return [
607
643
  n.key || ``,
608
644
  o,
@@ -610,23 +646,14 @@ function Et(...e) {
610
646
  s
611
647
  ];
612
648
  }
613
- function Dt(e, t, n) {
614
- St(e.__datetimeFormatters, t, n);
649
+ function Pt(e, t, n) {
650
+ kt(e.__datetimeFormatters, t, n);
615
651
  }
616
- function Ot(e, ...t) {
617
- let { numberFormats: n, unresolving: r, onWarn: a } = e, { __numberFormatters: o } = e;
618
- if (!i(t[0])) return ``;
619
- let [s, l, u, d] = At(...t), f = v(u.missingWarn) ? u.missingWarn : e.missingWarn, p = v(u.fallbackWarn) ? u.fallbackWarn : e.fallbackWarn, m = !!u.part, h = H(e, u);
620
- if (!_(s) || s === ``) {
621
- let e = new Intl.NumberFormat(h.replace(/!/g, ``), d);
622
- return m ? e.formatToParts(l) : e.format(l);
623
- }
624
- let g = bt(e, s, h, n, f, p, `number format`);
625
- if (!_(g)) return r ? -1 : s;
626
- let y = n[g][s], b = xt(g, s, d), x = o.get(b);
627
- return x || (x = new Intl.NumberFormat(g, c({}, y, d)), o.set(b, x)), m ? x.formatToParts(l) : x.format(l);
652
+ function Ft(e, ...t) {
653
+ let { numberFormats: n, onWarn: r } = e, { __numberFormatters: a } = e;
654
+ return i(t[0]) ? Dt(e, Lt(...t), Intl.NumberFormat, a, n, `number format`) : ``;
628
655
  }
629
- const kt = [
656
+ const It = [
630
657
  `localeMatcher`,
631
658
  `style`,
632
659
  `currency`,
@@ -648,10 +675,10 @@ const kt = [
648
675
  `roundingIncrement`,
649
676
  `trailingZeroDisplay`
650
677
  ];
651
- function At(...e) {
678
+ function Lt(...e) {
652
679
  let [t] = e, n = u(), r = u();
653
- if (!i(t)) throw Error(V.INVALID_ARGUMENT);
654
- let a = t, o = Ct(e, n, r, kt);
680
+ if (!i(t)) throw Error(z.INVALID_ARGUMENT);
681
+ let a = t, o = At(e, n, r, It);
655
682
  return [
656
683
  n.key || ``,
657
684
  a,
@@ -659,111 +686,122 @@ function At(...e) {
659
686
  o
660
687
  ];
661
688
  }
662
- function jt(e, t, n) {
663
- St(e.__numberFormatters, t, n);
689
+ function Rt(e, t, n) {
690
+ kt(e.__numberFormatters, t, n);
664
691
  }
665
- const Mt = (e) => e, Nt = (e) => ``, Pt = `text`, Ft = (e) => e.length === 0 ? `` : te(e), It = ee;
666
- function Z(e, t) {
692
+ const zt = (e) => e, Bt = (e) => ``, Vt = `text`, Ht = (e) => e.length === 0 ? `` : ee(e), Ut = w;
693
+ function Y(e, t) {
667
694
  return e = Math.abs(e), t === 2 ? e === 1 ? 0 : 1 : Math.min(e, 2);
668
695
  }
669
- const Lt = [
696
+ const X = [
670
697
  `zero`,
671
698
  `one`,
672
699
  `two`,
673
700
  `few`,
674
701
  `many`,
675
702
  `other`
676
- ], Rt = /* @__PURE__ */ new Map();
677
- function zt(e) {
678
- let t = Rt.get(e);
679
- if (!t) {
680
- let n = new Intl.PluralRules(e);
681
- t = {
682
- rules: n,
683
- categories: n.resolvedOptions().pluralCategories.slice().sort((e, t) => Lt.indexOf(e) - Lt.indexOf(t))
684
- }, Rt.set(e, t);
703
+ ], Z = /* @__PURE__ */ new Map();
704
+ function Wt(e) {
705
+ try {
706
+ if (Intl.PluralRules.supportedLocalesOf(e).length === 0) return null;
707
+ let t = new Intl.PluralRules(e);
708
+ return {
709
+ rules: t,
710
+ categories: t.resolvedOptions().pluralCategories.slice().sort((e, t) => X.indexOf(e) - X.indexOf(t))
711
+ };
712
+ } catch {
713
+ return null;
685
714
  }
686
- return t;
687
715
  }
688
- function Bt(e) {
716
+ function Gt(e) {
717
+ let t = Z.get(e);
718
+ return t === void 0 && (t = Wt(e), Z.size >= 1e3 && Z.delete(Z.keys().next().value), Z.set(e, t)), t;
719
+ }
720
+ function Kt(e) {
689
721
  return i(e.pluralIndex) ? e.pluralIndex : i(e.named?.count) ? e.named.count : i(e.named?.n) ? e.named.n : -1;
690
722
  }
691
- function Vt(e = {}) {
692
- let t = e.locale, n = Bt(e), r;
693
- r = _(t) && g(e.pluralRules?.[t]) ? e.pluralRules[t] : _(t) && typeof Intl < `u` && Intl.PluralRules !== void 0 ? (e, n) => {
694
- let { rules: r, categories: i } = zt(t);
695
- if (n > i.length) return Z(e, n);
696
- let a = r.select(Math.abs(e)), o = i.indexOf(a);
697
- return Math.min(o === -1 ? n - 1 : o, n - 1);
698
- } : Z;
699
- let a = r === Z ? void 0 : Z, o = (e) => e[r(n, e.length, a)], s = e.list || [], l = (e) => s[e], d = e.named || u();
700
- i(e.pluralIndex) && (d.count ??= e.pluralIndex, d.n ??= e.pluralIndex);
701
- let f = (e) => d[e];
702
- function p(t, n) {
703
- return (g(e.messages) ? e.messages(t, !!n) : y(e.messages) ? e.messages[t] : !1) || (e.parent ? e.parent.message(t) : Nt);
723
+ function qt(e = {}) {
724
+ let t = e.locale, n = Kt(e), r;
725
+ r = _(t) && e.pluralRules && g(p(e.pluralRules, t)) ? e.pluralRules[t] : _(t) && typeof Intl < `u` && Intl.PluralRules !== void 0 ? (e, n) => {
726
+ let r = Gt(t);
727
+ if (r === null || n > r.categories.length) return Y(e, n);
728
+ let { rules: i, categories: a } = r, o = i.select(Math.abs(e)), s = a.indexOf(o);
729
+ return Math.min(s === -1 ? n - 1 : s, n - 1);
730
+ } : Y;
731
+ let a = r === Y ? void 0 : Y, o = (e) => e[r(n, e.length, a)], s = e.list || [], l = (e) => s[e], d = e.named || u(), f = i(e.pluralIndex), v = (t) => {
732
+ let n = m(t) ? p(d, t) : d[t];
733
+ return f && n == null && (t === `count` || t === `n`) ? e.pluralIndex : n;
734
+ };
735
+ function b(t, n) {
736
+ return (g(e.messages) ? e.messages(t, !!n) : y(e.messages) ? e.messages[t] : !1) || (e.parent ? e.parent.message(t) : Bt);
704
737
  }
705
- let m = (t) => e.modifiers ? e.modifiers[t] : Mt, v = g(e.processor?.normalize) ? e.processor.normalize : Ft, b = g(e.processor?.interpolate) ? e.processor.interpolate : It, x = {
738
+ let x = (t) => e.modifiers ? p(e.modifiers, t) : zt, S = g(e.processor?.normalize) ? e.processor.normalize : Ht, C = g(e.processor?.interpolate) ? e.processor.interpolate : Ut, w = {
706
739
  list: l,
707
- named: f,
740
+ named: v,
708
741
  plural: o,
709
742
  linked: (e, ...t) => {
710
743
  let [n, r] = t, i = `text`, a = ``;
711
744
  t.length === 1 ? y(n) ? (a = n.modifier || a, i = n.type || i) : _(n) && (a = n || a) : t.length === 2 && (_(n) && (a = n || a), _(r) && (i = r || i));
712
- let o = p(e, !0)(x), s = o === `` || o === void 0 ? e : o, c = i === `vnode` && h(s) && a ? s[0] : s;
713
- return a ? m(a)(c, i) : c;
745
+ let o = b(e, !0)(w), s = o === `` || o === void 0 ? e : o, c = i === `vnode` && h(s) && a ? s[0] : s;
746
+ if (!a) return c;
747
+ let l = x(a);
748
+ return g(l) ? l(c, i) : c;
714
749
  },
715
- message: p,
716
- type: _(e.processor?.type) ? e.processor.type : Pt,
717
- interpolate: b,
718
- normalize: v,
719
- values: c(u(), s, d)
750
+ message: b,
751
+ type: _(e.processor?.type) ? e.processor.type : Vt,
752
+ interpolate: C,
753
+ normalize: S,
754
+ values: c(u(), s, d, f ? {
755
+ count: v(`count`),
756
+ n: v(`n`)
757
+ } : {})
720
758
  };
721
- return x;
759
+ return w;
722
760
  }
723
- const Ht = () => ``, Q = (e) => g(e), $ = (e) => _(e) || k(e) || Q(e);
724
- function Ut(e, ...t) {
725
- let [n, r] = qt(...t), i = H(e, r), a = v(r.escapeParameter) ? r.escapeParameter : e.escapeParameter;
726
- a && Wt(r);
761
+ const Jt = () => ``, Q = (e) => g(e), $ = (e) => _(e) || k(e) || Q(e);
762
+ function Yt(e, ...t) {
763
+ let [n, r] = $t(...t), i = B(e, r), a = v(r.escapeParameter) ? r.escapeParameter : e.escapeParameter;
764
+ a && Xt(r);
727
765
  let o = !!r.resolvedMessage, [s, c, l] = o ? [
728
766
  n,
729
767
  i,
730
- e.messages[i] || u()
731
- ] : Gt(e, n, i, e.fallbackLocale, v(r.fallbackWarn) ? r.fallbackWarn : e.fallbackWarn, v(r.missingWarn) ? r.missingWarn : e.missingWarn), d = n;
768
+ p(e.messages, i) || u()
769
+ ] : Zt(e, n, i, e.fallbackLocale, v(r.fallbackWarn) ? r.fallbackWarn : e.fallbackWarn, v(r.missingWarn) ? r.missingWarn : e.missingWarn), d = n;
732
770
  if (!o && !$(s)) {
733
771
  let t = _(r.default) ? r.default : v(r.default) || e.fallbackFormat ? e.messageCompiler ? n : () => n : null;
734
772
  (e.fallbackFormat || t != null && (_(t) || g(t))) && (s = t, d = s);
735
773
  }
736
774
  if (!o && (!$(s) || !_(c))) return e.unresolving ? -1 : n;
737
- let f = !1, p = Q(s) ? s : Kt(e, n, c, s, d, () => {
775
+ let f = !1, m = Q(s) ? s : Qt(e, n, c, s, d, () => {
738
776
  f = !0;
739
777
  });
740
778
  if (f) return s;
741
- let m = p(Vt(Yt(e, c, l, r))), h = e.postTranslation ? e.postTranslation(m, n) : m;
742
- return a && _(h) && (h = ge(h)), h;
779
+ let h = m(qt(tn(e, c, l, r))), y = e.postTranslation ? e.postTranslation(h, n) : h;
780
+ return a && _(y) && (y = ge(y)), y;
743
781
  }
744
- function Wt(e) {
745
- if (h(e.list) && (e.list = e.list.map((e) => _(e) ? w(e) : e)), y(e.named)) {
782
+ function Xt(e) {
783
+ if (h(e.list) && (e.list = e.list.map((e) => _(e) ? T(e) : e)), y(e.named)) {
746
784
  let t = e.named, n = u();
747
785
  for (let e of Object.keys(t)) {
748
786
  let r = t[e];
749
- n[e] = _(r) ? w(r) : r;
787
+ n[e] = _(r) ? T(r) : r;
750
788
  }
751
789
  e.named = n;
752
790
  }
753
791
  }
754
- function Gt(e, t, n, r, i, a) {
755
- let { messages: o, onWarn: s, messageResolver: c, localeFallbacker: l } = e, d = l(e, r, n), f = u(), p, m = null;
756
- for (let n = 0; n < d.length && (p = d[n], f = o[p] || u(), (m = c(f, t)) === null && (m = f[t]), !$(m)); n++) if (!yt(p, d)) {
757
- let n = X(e, t, p, a, `translate`);
758
- n !== t && (m = n);
792
+ function Zt(e, t, n, r, i, a) {
793
+ let { messages: o, onWarn: s, messageResolver: c, localeFallbacker: l } = e, d = l(e, r, n), f = u(), m, h = null;
794
+ for (let n = 0; n < d.length && (m = d[n], f = p(o, m) || u(), (h = c(f, t)) === null && (h = p(f, t)), !$(h)); n++) if (!Ct(m, d)) {
795
+ let n = J(e, t, m, a, `translate`);
796
+ n !== t && (h = n);
759
797
  }
760
798
  return [
799
+ h,
761
800
  m,
762
- p,
763
801
  f
764
802
  ];
765
803
  }
766
- function Kt(e, t, n, r, i, a) {
804
+ function Qt(e, t, n, r, i, a) {
767
805
  if (Q(r)) {
768
806
  let e = r;
769
807
  return e.locale = e.locale || n, e.key = e.key || t, e;
@@ -772,16 +810,16 @@ function Kt(e, t, n, r, i, a) {
772
810
  let e = (() => r);
773
811
  return e.locale = n, e.key = t, e;
774
812
  }
775
- let o = e.messageCompiler(r, Jt(e, n, i, r, e.warnHtmlMessage, a));
813
+ let o = e.messageCompiler(r, en(e, n, i, r, e.warnHtmlMessage, a));
776
814
  return o.locale = n, o.key = t, o.source = r, o;
777
815
  }
778
- function qt(...e) {
816
+ function $t(...e) {
779
817
  let [t, n, r] = e;
780
- if (!_(t) && !i(t) && !Q(t) && !k(t)) throw Error(V.INVALID_ARGUMENT);
818
+ if (!_(t) && !i(t) && !Q(t) && !k(t)) throw Error(z.INVALID_ARGUMENT);
781
819
  let a = i(t) ? String(t) : (Q(t), t), o = u();
782
820
  return i(n) ? o.plural = n : _(n) ? o.default = n : C(n) && !s(n) ? o.named = n : h(n) && (o.list = n), i(r) ? o.plural = r : _(r) ? o.default = r : C(r) && c(o, r), [a, o];
783
821
  }
784
- function Jt(e, t, r, i, a, o) {
822
+ function en(e, t, r, i, a, o) {
785
823
  return {
786
824
  locale: t,
787
825
  key: r,
@@ -792,7 +830,7 @@ function Jt(e, t, r, i, a, o) {
792
830
  onCacheKey: (e) => n(t, r, e)
793
831
  };
794
832
  }
795
- function Yt(e, t, n, r) {
833
+ function tn(e, t, n, r) {
796
834
  let { modifiers: a, pluralRules: o, messageResolver: s, fallbackLocale: c, fallbackWarn: l, missingWarn: u, fallbackContext: d } = e;
797
835
  return {
798
836
  locale: t,
@@ -801,16 +839,16 @@ function Yt(e, t, n, r) {
801
839
  messages: (r, i) => {
802
840
  let a = s(n, r);
803
841
  if (a == null && (d || i)) {
804
- let [n, , i] = Gt(d || e, r, t, c, l, u);
842
+ let [n, , i] = Zt(d || e, r, t, c, l, u);
805
843
  a = n ?? s(i, r);
806
844
  }
807
845
  if (_(a) || k(a)) {
808
- let n = !1, i = Kt(e, r, t, a, r, () => {
846
+ let n = !1, i = Qt(e, r, t, a, r, () => {
809
847
  n = !0;
810
848
  });
811
- return n ? Ht : i;
849
+ return n ? Jt : i;
812
850
  }
813
- return Q(a) ? a : Ht;
851
+ return Q(a) ? a : Jt;
814
852
  },
815
853
  processor: e.processor ?? void 0,
816
854
  list: r.list ?? void 0,
@@ -818,5 +856,4 @@ function Yt(e, t, n, r) {
818
856
  pluralIndex: i(r.plural) ? r.plural : void 0
819
857
  };
820
858
  }
821
- at(Pe), st(Ye), lt(Re);
822
- export { ke as AST_NODE_PROPS_KEYS, Fe as CORE_ERROR_CODES_EXTEND_POINT, Xe as CORE_WARN_CODES_EXTEND_POINT, q as CoreWarnCodes, Tt as DATETIME_FORMAT_OPTIONS_KEYS, J as DEFAULT_LOCALE, Pt as DEFAULT_MESSAGE_DATA_TYPE, tt as MISSING_RESOLVE_VALUE, et as NOT_RESOLVED, kt as NUMBER_FORMAT_OPTIONS_KEYS, $e as VERSION, Ne as clearCompileCache, Dt as clearDateTimeFormat, jt as clearNumberFormat, Pe as compile, ye as createCompileError, dt as createCoreContext, Ie as createCoreError, Vt as createMessageContext, wt as datetime, Re as fallbackWithLocaleChain, Le as fallbackWithSimple, H as getLocale, ft as getLocaleMessage, Qe as getWarnMessage, X as handleMissing, vt as isAlmostSameLocale, yt as isImplicitFallback, k as isMessageAST, $ as isMessageFormat, Q as isMessageFunction, mt as isTranslateFallbackWarn, ht as isTranslateMissingWarn, Ot as number, Ke as parse, Et as parseDateTimeArgs, At as parseNumberArgs, qt as parseTranslateArgs, lt as registerLocaleFallbacker, at as registerMessageCompiler, st as registerMessageResolver, W as resolveLocale, Ye as resolveValue, Je as resolveWithKeyValue, pt as setLocaleMessage, Ut as translate, _t as updateFallbackLocale };
859
+ export { je as AST_NODE_PROPS_KEYS, Le as CORE_ERROR_CODES_EXTEND_POINT, $e as CORE_WARN_CODES_EXTEND_POINT, W as CoreWarnCodes, Mt as DATETIME_FORMAT_OPTIONS_KEYS, G as DEFAULT_LOCALE, Vt as DEFAULT_MESSAGE_DATA_TYPE, it as MISSING_RESOLVE_VALUE, rt as NOT_RESOLVED, It as NUMBER_FORMAT_OPTIONS_KEYS, nt as VERSION, Fe as clearCompileCache, Pt as clearDateTimeFormat, Rt as clearNumberFormat, Ie as compile, ye as createCompileError, mt as createCoreContext, Re as createCoreError, qt as createMessageContext, jt as datetime, Be as fallbackWithLocaleChain, ze as fallbackWithSimple, B as getLocale, ht as getLocaleMessage, tt as getWarnMessage, J as handleMissing, St as isAlmostSameLocale, _t as isFallbackLocale, Ct as isImplicitFallback, k as isMessageAST, $ as isMessageFormat, Q as isMessageFunction, vt as isTranslateFallbackWarn, yt as isTranslateMissingWarn, q as isWarnOption, Ft as number, Ye as parse, Nt as parseDateTimeArgs, Lt as parseNumberArgs, $t as parseTranslateArgs, ft as registerLocaleFallbacker, ct as registerMessageCompiler, ut as registerMessageResolver, H as resolveLocale, Qe as resolveValue, Ze as resolveWithKeyValue, gt as setLocaleMessage, Yt as translate, xt as updateFallbackLocale };