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

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