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