@intlify/core 11.4.20 → 11.4.22
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.cjs +1 -1
- package/dist/core.esm-browser.js +262 -32
- package/dist/core.esm-browser.prod.js +2 -2
- package/dist/core.global.js +262 -32
- package/dist/core.global.prod.js +2 -2
- package/dist/core.mjs +1 -1
- package/dist/core.node.mjs +1 -1
- package/dist/core.prod.cjs +1 -1
- package/dist/core.runtime.esm-browser.js +261 -31
- package/dist/core.runtime.esm-browser.prod.js +2 -2
- package/dist/core.runtime.global.js +261 -31
- package/dist/core.runtime.global.prod.js +2 -2
- package/dist/core.runtime.mjs +1 -1
- package/dist/core.runtime.node.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v11.4.
|
|
2
|
+
* core v11.4.22
|
|
3
3
|
* (c) 2026 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -305,6 +305,169 @@ var IntlifyCore = (function (exports) {
|
|
|
305
305
|
const valueQuote = quote || '';
|
|
306
306
|
return `${name}=${valueQuote}${sanitizeAttributeValue(attrName, value)}${valueQuote}`;
|
|
307
307
|
}
|
|
308
|
+
const HTML = 0;
|
|
309
|
+
const SVG = 1;
|
|
310
|
+
const MATHML = 2;
|
|
311
|
+
// Elements that have no end tag, and elements that the HTML parser does not open in the body
|
|
312
|
+
const notOpenedElementPattern = /^(?:area|base|basefont|bgsound|br|col|embed|frame|hr|image|img|input|keygen|link|meta|param|source|track|wbr|html|head|body|frameset)$/;
|
|
313
|
+
// Start tags that end SVG and MathML content (and `<font>` with `color`, `face` or `size`)
|
|
314
|
+
const breakoutElementPattern = /^(?:b|big|blockquote|body|br|center|code|dd|div|dl|dt|em|embed|h[1-6]|head|hr|i|img|li|listing|menu|meta|nobr|ol|p|pre|ruby|s|small|span|strong|strike|sub|sup|table|tt|u|ul|var)$/;
|
|
315
|
+
// Start tags that close an open `<p>`, and the elements that they do not close a `<p>` through
|
|
316
|
+
const paragraphClosingElementPattern = /^(?:address|article|aside|blockquote|center|details|dialog|dir|div|dl|fieldset|figcaption|figure|footer|header|hgroup|main|menu|nav|ol|p|search|section|summary|ul|h[1-6]|pre|listing|form|li|dd|dt|plaintext|table|hr|xmp)$/;
|
|
317
|
+
const buttonScopeElementPattern = /^(?:applet|caption|html|table|td|th|marquee|object|template|button)$/;
|
|
318
|
+
const svgIntegrationPattern = /^(?:foreignobject|desc|title)$/;
|
|
319
|
+
// The names of SVG and MathML integration points (except `title`, whose content is text in HTML). Read with the
|
|
320
|
+
// HTML rules, they are unknown HTML elements, and their start tags become text: if the browser closed such an
|
|
321
|
+
// element early (for example, `<button>` of the translation closes the `<button>` that the translation is
|
|
322
|
+
// rendered in), its end tag would close an integration point of the page, and the rest of the page would be read
|
|
323
|
+
// as SVG or MathML
|
|
324
|
+
const integrationNamePattern = /^(?:foreignobject|desc|mi|mo|mn|ms|mtext|annotation-xml)$/;
|
|
325
|
+
const mathmlIntegrationPattern = /^(?:mi|mo|mn|ms|mtext)$/;
|
|
326
|
+
const htmlEncodingPattern = /^(?:text\/html|application\/xhtml\+xml)$/i;
|
|
327
|
+
function asciiLowercase(text) {
|
|
328
|
+
return text.replace(/[A-Z]+/g, upper => upper.toLowerCase());
|
|
329
|
+
}
|
|
330
|
+
// Whether a start tag is read with the rules of SVG and MathML content, rather than with the HTML rules
|
|
331
|
+
function isForeignContext(top, name) {
|
|
332
|
+
return (!!top &&
|
|
333
|
+
top.namespace !== HTML &&
|
|
334
|
+
(!top.integration ||
|
|
335
|
+
(mathmlIntegrationPattern.test(top.name) &&
|
|
336
|
+
(name === 'mglyph' || name === 'malignmark'))) &&
|
|
337
|
+
!(top.name === 'annotation-xml' && name === 'svg'));
|
|
338
|
+
}
|
|
339
|
+
function isBreakout(name, attributes) {
|
|
340
|
+
return (breakoutElementPattern.test(name) ||
|
|
341
|
+
(name === 'font' &&
|
|
342
|
+
(attributes.has('color') ||
|
|
343
|
+
attributes.has('face') ||
|
|
344
|
+
attributes.has('size'))));
|
|
345
|
+
}
|
|
346
|
+
// Pop the elements down to `length`, and return their end tags (innermost first).
|
|
347
|
+
// A `<form>` becomes text instead: in a form of the page, browsers ignore the `<form>`,
|
|
348
|
+
// and `</form>` would close the form of the page
|
|
349
|
+
function closeDownTo(stack, length, parts) {
|
|
350
|
+
let endTags = '';
|
|
351
|
+
for (let index = stack.length - 1; index >= length; index--) {
|
|
352
|
+
const element = stack[index];
|
|
353
|
+
if (element.namespace === HTML && element.name === 'form') {
|
|
354
|
+
parts[element.part] = escapeLessThan(parts[element.part]);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
endTags += `</${element.name}>`;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
stack.length = length;
|
|
361
|
+
return endTags;
|
|
362
|
+
}
|
|
363
|
+
// Pop SVG and MathML elements down to an HTML element or an integration point, as the tree builder does,
|
|
364
|
+
// and return their end tags
|
|
365
|
+
function closeForeign(stack, parts) {
|
|
366
|
+
let length = stack.length;
|
|
367
|
+
while (length > 0 &&
|
|
368
|
+
stack[length - 1].namespace !== HTML &&
|
|
369
|
+
!stack[length - 1].integration) {
|
|
370
|
+
length--;
|
|
371
|
+
}
|
|
372
|
+
return closeDownTo(stack, length, parts);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Open an element for a start tag, as the tree builder does
|
|
376
|
+
*
|
|
377
|
+
* @returns The end tags to write before the start tag: the SVG and MathML elements that it ends, and a `<p>`
|
|
378
|
+
* of the translation that it closes, with the elements in the `<p>` (so that no formatting element in it is
|
|
379
|
+
* made again after it), or `undefined` when the start tag becomes text
|
|
380
|
+
*/
|
|
381
|
+
function openElement(stack, parts, name, attributes, selfClosing) {
|
|
382
|
+
// the start tag is written after the end tags
|
|
383
|
+
const part = parts.length + 1;
|
|
384
|
+
let endTags = '';
|
|
385
|
+
const top = stack[stack.length - 1];
|
|
386
|
+
if (isForeignContext(top, name)) {
|
|
387
|
+
if (!isBreakout(name, attributes)) {
|
|
388
|
+
if (!selfClosing) {
|
|
389
|
+
stack.push({
|
|
390
|
+
name,
|
|
391
|
+
namespace: top.namespace,
|
|
392
|
+
integration: top.namespace === SVG
|
|
393
|
+
? svgIntegrationPattern.test(name)
|
|
394
|
+
: mathmlIntegrationPattern.test(name) ||
|
|
395
|
+
(name === 'annotation-xml' &&
|
|
396
|
+
htmlEncodingPattern.test((attributes.get('encoding') || '').replace(numericCharacterReferencePattern, decodeNumericCharacterReference))),
|
|
397
|
+
part
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return endTags;
|
|
401
|
+
}
|
|
402
|
+
endTags = closeForeign(stack, parts);
|
|
403
|
+
}
|
|
404
|
+
if (paragraphClosingElementPattern.test(name)) {
|
|
405
|
+
for (let index = stack.length - 1; index >= 0; index--) {
|
|
406
|
+
const element = stack[index];
|
|
407
|
+
if (element.namespace === HTML
|
|
408
|
+
? buttonScopeElementPattern.test(element.name)
|
|
409
|
+
: element.integration) {
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
if (element.namespace === HTML && element.name === 'p') {
|
|
413
|
+
endTags += closeDownTo(stack, index, parts);
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (integrationNamePattern.test(name)) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
if (name === 'svg' || name === 'math') {
|
|
422
|
+
if (!selfClosing) {
|
|
423
|
+
stack.push({
|
|
424
|
+
name,
|
|
425
|
+
namespace: name === 'svg' ? SVG : MATHML,
|
|
426
|
+
integration: false,
|
|
427
|
+
part
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
else if (!notOpenedElementPattern.test(name)) {
|
|
432
|
+
// HTML elements ignore `/>`
|
|
433
|
+
stack.push({ name, namespace: HTML, integration: false, part });
|
|
434
|
+
}
|
|
435
|
+
return endTags;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Close the element of an end tag: an SVG or MathML element with the same name above the innermost HTML
|
|
439
|
+
* element, or else an HTML element with the same name
|
|
440
|
+
*
|
|
441
|
+
* @returns The end tags to write before the end tag (of the elements in the closed element), or `undefined`
|
|
442
|
+
* when the end tag closes nothing in the translation, and is removed
|
|
443
|
+
*/
|
|
444
|
+
function closeElement(stack, parts, name) {
|
|
445
|
+
let endTags = '';
|
|
446
|
+
if (name === 'p' || name === 'br') {
|
|
447
|
+
// they end SVG and MathML content
|
|
448
|
+
endTags = closeForeign(stack, parts);
|
|
449
|
+
}
|
|
450
|
+
let index = stack.length - 1;
|
|
451
|
+
while (index >= 0 &&
|
|
452
|
+
stack[index].namespace !== HTML &&
|
|
453
|
+
stack[index].name !== name) {
|
|
454
|
+
index--;
|
|
455
|
+
}
|
|
456
|
+
if (index >= 0 && stack[index].namespace !== HTML) ;
|
|
457
|
+
else {
|
|
458
|
+
while (index >= 0 &&
|
|
459
|
+
!(stack[index].namespace === HTML && stack[index].name === name)) {
|
|
460
|
+
index--;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if (index < 0) {
|
|
464
|
+
// browsers read `</br>` as `<br>`, and `</p>` without an open `<p>` as `<p></p>`
|
|
465
|
+
return name === 'br' || name === 'p' ? endTags : undefined;
|
|
466
|
+
}
|
|
467
|
+
endTags += closeDownTo(stack, index + 1, parts);
|
|
468
|
+
stack.length = index;
|
|
469
|
+
return endTags;
|
|
470
|
+
}
|
|
308
471
|
/**
|
|
309
472
|
* Read a tag with the rules of the HTML tokenizer.
|
|
310
473
|
* A start tag is written again with its attributes sanitized, and an end tag is kept as it is
|
|
@@ -312,7 +475,8 @@ var IntlifyCore = (function (exports) {
|
|
|
312
475
|
* @param html - The HTML
|
|
313
476
|
* @param start - The index of `<`
|
|
314
477
|
* @param neutralized - What has been neutralized
|
|
315
|
-
* @returns The tag, the tag name,
|
|
478
|
+
* @returns The tag, the tag name, the index after the tag (-1 when the tag is not closed),
|
|
479
|
+
* whether the start tag is self-closing (`/>`), and the attributes of the start tag,
|
|
316
480
|
* or `undefined` when `<` does not start a tag
|
|
317
481
|
*/
|
|
318
482
|
function readTag(html, start, neutralized) {
|
|
@@ -323,6 +487,7 @@ var IntlifyCore = (function (exports) {
|
|
|
323
487
|
}
|
|
324
488
|
const [, slash, tagName] = tagStart;
|
|
325
489
|
let tag = tagStart[0];
|
|
490
|
+
const attributes = new Map();
|
|
326
491
|
let step;
|
|
327
492
|
tagStepPattern.lastIndex = tagStartPattern.lastIndex;
|
|
328
493
|
while ((step = tagStepPattern.exec(html))) {
|
|
@@ -330,17 +495,27 @@ var IntlifyCore = (function (exports) {
|
|
|
330
495
|
if (close) {
|
|
331
496
|
const end = tagStepPattern.lastIndex;
|
|
332
497
|
// browsers ignore the attributes of end tags
|
|
333
|
-
return [
|
|
498
|
+
return [
|
|
499
|
+
slash ? html.slice(start, end) : tag + raw,
|
|
500
|
+
tagName,
|
|
501
|
+
end,
|
|
502
|
+
!slash && separator.endsWith('/'),
|
|
503
|
+
attributes
|
|
504
|
+
];
|
|
334
505
|
}
|
|
335
506
|
if (quote && !closingQuote) {
|
|
336
507
|
break;
|
|
337
508
|
}
|
|
338
509
|
if (!slash) {
|
|
339
510
|
const value = quote ? quotedValue : unquotedValue;
|
|
511
|
+
const name = asciiLowercase(attrName);
|
|
512
|
+
if (!attributes.has(name)) {
|
|
513
|
+
attributes.set(name, value || '');
|
|
514
|
+
}
|
|
340
515
|
tag += separator + serializeAttribute(attrName, value, quote, neutralized);
|
|
341
516
|
}
|
|
342
517
|
}
|
|
343
|
-
return [tag, tagName, -1];
|
|
518
|
+
return [tag, tagName, -1, false, attributes];
|
|
344
519
|
}
|
|
345
520
|
/**
|
|
346
521
|
* Find the end tag of an element whose content is text, as the HTML tokenizer does:
|
|
@@ -365,57 +540,79 @@ var IntlifyCore = (function (exports) {
|
|
|
365
540
|
* where each tag and each attribute starts and ends, and every attribute of every start tag is checked.
|
|
366
541
|
* What is still open at the end of the string (a tag, a comment, or an element whose content is text,
|
|
367
542
|
* like `<textarea>`) becomes text: on the server (SSR), the rest of the page follows the translation,
|
|
368
|
-
* and it would be read as a part of what is open
|
|
543
|
+
* and it would be read as a part of what is open.
|
|
544
|
+
* For the same reason, the elements are followed as the tree builder of browsers opens and closes them,
|
|
545
|
+
* including SVG and MathML: an end tag that closes no element of the translation is removed, the elements
|
|
546
|
+
* in the element that an end tag closes are closed before it, and the elements still open at the end are
|
|
547
|
+
* closed. A `<form>` that the translation does not close becomes text, because browsers ignore it in a form
|
|
548
|
+
* of the page, and `</form>` would close that form
|
|
369
549
|
*
|
|
370
550
|
* @param html - The translated HTML
|
|
371
551
|
* @returns The sanitized HTML
|
|
372
552
|
*/
|
|
373
553
|
function sanitizeTranslatedHtml(html) {
|
|
374
554
|
const neutralized = {};
|
|
375
|
-
|
|
555
|
+
const parts = [];
|
|
556
|
+
const stack = [];
|
|
376
557
|
let index = 0;
|
|
377
558
|
let lessThan;
|
|
378
559
|
while ((lessThan = html.indexOf('<', index)) !== -1) {
|
|
379
|
-
|
|
560
|
+
parts.push(html.slice(index, lessThan));
|
|
380
561
|
index = lessThan + 1;
|
|
381
562
|
const read = readTag(html, lessThan, neutralized);
|
|
382
563
|
if (read) {
|
|
383
|
-
const [tag, tagName, end] = read;
|
|
564
|
+
const [tag, tagName, end, selfClosing, attributes] = read;
|
|
384
565
|
if (end === -1) {
|
|
385
566
|
neutralized.unclosed = true;
|
|
386
|
-
|
|
567
|
+
parts.push(escapeLessThan(html.slice(lessThan)));
|
|
387
568
|
index = html.length;
|
|
388
569
|
break;
|
|
389
570
|
}
|
|
390
571
|
index = end;
|
|
391
572
|
if (tag[1] === '/') {
|
|
392
|
-
|
|
573
|
+
const endTags = closeElement(stack, parts, asciiLowercase(tagName));
|
|
574
|
+
if (endTags === undefined) {
|
|
575
|
+
neutralized.closed = true;
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
if (endTags) {
|
|
579
|
+
neutralized.closed = true;
|
|
580
|
+
}
|
|
581
|
+
parts.push(endTags + tag);
|
|
582
|
+
}
|
|
393
583
|
}
|
|
394
584
|
else if (dangerousElementPattern.test(tagName)) {
|
|
395
585
|
// the start tag becomes text
|
|
396
586
|
neutralized.element = true;
|
|
397
|
-
|
|
587
|
+
parts.push(escapeLessThan(tag));
|
|
398
588
|
}
|
|
399
|
-
else
|
|
400
|
-
|
|
401
|
-
if (
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
589
|
+
else {
|
|
590
|
+
let content = '';
|
|
591
|
+
if (textContentElementPattern.test(tagName)) {
|
|
592
|
+
const contentEnd = findTextContentEnd(html, end, tagName);
|
|
593
|
+
if (contentEnd === -1) {
|
|
594
|
+
// the start tag becomes text, and the content is read as HTML, as browsers do then
|
|
595
|
+
neutralized.unclosed = true;
|
|
596
|
+
parts.push(escapeLessThan(tag));
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
content = escapeLessThan(html.slice(end, contentEnd));
|
|
600
|
+
index = contentEnd;
|
|
601
|
+
}
|
|
602
|
+
const endTags = openElement(stack, parts, asciiLowercase(tagName), attributes, selfClosing);
|
|
603
|
+
if (endTags === undefined) {
|
|
604
|
+
neutralized.closed = true;
|
|
605
|
+
parts.push(escapeLessThan(tag) + content);
|
|
405
606
|
}
|
|
406
607
|
else {
|
|
407
|
-
|
|
408
|
-
index = contentEnd;
|
|
608
|
+
parts.push(endTags, tag + content);
|
|
409
609
|
}
|
|
410
610
|
}
|
|
411
|
-
else {
|
|
412
|
-
result += tag;
|
|
413
|
-
}
|
|
414
611
|
continue;
|
|
415
612
|
}
|
|
416
613
|
commentPattern.lastIndex = lessThan;
|
|
417
614
|
if (commentPattern.test(html)) {
|
|
418
|
-
|
|
615
|
+
parts.push(html.slice(lessThan, commentPattern.lastIndex));
|
|
419
616
|
index = commentPattern.lastIndex;
|
|
420
617
|
continue;
|
|
421
618
|
}
|
|
@@ -423,9 +620,21 @@ var IntlifyCore = (function (exports) {
|
|
|
423
620
|
neutralized.unclosed = true;
|
|
424
621
|
}
|
|
425
622
|
// `<!DOCTYPE`, `<![CDATA[`, `<?`, `</` without a tag name, `<` at the end and any other `<` become text
|
|
426
|
-
|
|
623
|
+
parts.push('<');
|
|
624
|
+
}
|
|
625
|
+
parts.push(html.slice(index));
|
|
626
|
+
// close the elements that are still open
|
|
627
|
+
for (let open = stack.length - 1; open >= 0; open--) {
|
|
628
|
+
const element = stack[open];
|
|
629
|
+
neutralized.closed = true;
|
|
630
|
+
if (element.namespace === HTML && element.name === 'form') {
|
|
631
|
+
// the browser ignores `<form>` in a form of the page, and `</form>` would close that form
|
|
632
|
+
parts[element.part] = escapeLessThan(parts[element.part]);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
parts.push(`</${element.name}>`);
|
|
636
|
+
}
|
|
427
637
|
}
|
|
428
|
-
result += html.slice(index);
|
|
429
638
|
{
|
|
430
639
|
if (neutralized.eventHandler) {
|
|
431
640
|
warn('Potentially dangerous event handlers detected in translation. ' +
|
|
@@ -443,8 +652,12 @@ var IntlifyCore = (function (exports) {
|
|
|
443
652
|
warn('Unclosed tag, comment or element (such as <textarea>) detected in translation. ' +
|
|
444
653
|
'Consider closing it in your translation messages.');
|
|
445
654
|
}
|
|
655
|
+
if (neutralized.closed) {
|
|
656
|
+
warn('Unclosed or misnested elements detected in translation. ' +
|
|
657
|
+
'Consider closing every element in the right order in your translation messages.');
|
|
658
|
+
}
|
|
446
659
|
}
|
|
447
|
-
return
|
|
660
|
+
return parts.join('');
|
|
448
661
|
}
|
|
449
662
|
|
|
450
663
|
const CompileErrorCodes = {
|
|
@@ -1234,7 +1447,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1234
1447
|
* Intlify core-base version
|
|
1235
1448
|
* @internal
|
|
1236
1449
|
*/
|
|
1237
|
-
const VERSION = '11.4.
|
|
1450
|
+
const VERSION = '11.4.22';
|
|
1238
1451
|
const NOT_REOSLVED = -1;
|
|
1239
1452
|
const DEFAULT_LOCALE = 'en-US';
|
|
1240
1453
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -2007,7 +2220,7 @@ var IntlifyCore = (function (exports) {
|
|
|
2007
2220
|
return format;
|
|
2008
2221
|
}
|
|
2009
2222
|
// evaluate message with context
|
|
2010
|
-
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
|
|
2223
|
+
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options, escapeParameter);
|
|
2011
2224
|
const msgContext = createMessageContext(ctxOptions);
|
|
2012
2225
|
const messaged = evaluateMessage(context, msg, msgContext);
|
|
2013
2226
|
// if use post translation option, proceed it with handler
|
|
@@ -2043,6 +2256,8 @@ var IntlifyCore = (function (exports) {
|
|
|
2043
2256
|
}
|
|
2044
2257
|
return ret;
|
|
2045
2258
|
}
|
|
2259
|
+
// values that are not strings, such as arrays and objects, are kept here,
|
|
2260
|
+
// and their text is escaped when they are interpolated (see `resolveProcessor()`)
|
|
2046
2261
|
function escapeParams(options) {
|
|
2047
2262
|
// a call can pass both list and named values, so escape each of them
|
|
2048
2263
|
if (isArray(options.list)) {
|
|
@@ -2059,6 +2274,20 @@ var IntlifyCore = (function (exports) {
|
|
|
2059
2274
|
options.named = named;
|
|
2060
2275
|
}
|
|
2061
2276
|
}
|
|
2277
|
+
// strings have been escaped by `escapeParams()`. other values are turned into text here,
|
|
2278
|
+
// with `JSON.stringify()` for arrays and plain objects and `String()` for the rest, so escape that text
|
|
2279
|
+
function interpolateEscaped(value) {
|
|
2280
|
+
return isString(value) ? value : escapeHtml(toDisplayString(value));
|
|
2281
|
+
}
|
|
2282
|
+
function resolveProcessor(processor, escapeParameter) {
|
|
2283
|
+
// keep a processor that interpolates values by itself, such as the one of `<i18n-t>`, which renders VNodes
|
|
2284
|
+
if (!escapeParameter || isFunction(processor?.interpolate)) {
|
|
2285
|
+
return processor;
|
|
2286
|
+
}
|
|
2287
|
+
return assign({}, processor, {
|
|
2288
|
+
interpolate: interpolateEscaped
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2062
2291
|
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
|
|
2063
2292
|
const { messages, onWarn, messageResolver: resolveValue, localeFallbacker } = context;
|
|
2064
2293
|
const locales = localeFallbacker(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -2298,7 +2527,7 @@ var IntlifyCore = (function (exports) {
|
|
|
2298
2527
|
}
|
|
2299
2528
|
}
|
|
2300
2529
|
}
|
|
2301
|
-
function getMessageContextOptions(context, locale, message, options) {
|
|
2530
|
+
function getMessageContextOptions(context, locale, message, options, escapeParameter) {
|
|
2302
2531
|
const { modifiers, pluralRules, messageResolver: resolveValue, fallbackLocale, fallbackWarn, missingWarn, fallbackContext } = context;
|
|
2303
2532
|
const resolveMessage = (key, useLinked) => {
|
|
2304
2533
|
let val = resolveValue(message, key);
|
|
@@ -2332,8 +2561,9 @@ var IntlifyCore = (function (exports) {
|
|
|
2332
2561
|
pluralRules,
|
|
2333
2562
|
messages: resolveMessage
|
|
2334
2563
|
};
|
|
2335
|
-
|
|
2336
|
-
|
|
2564
|
+
const processor = resolveProcessor(context.processor, escapeParameter);
|
|
2565
|
+
if (processor) {
|
|
2566
|
+
ctxOptions.processor = processor;
|
|
2337
2567
|
}
|
|
2338
2568
|
if (options.list) {
|
|
2339
2569
|
ctxOptions.list = options.list;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v11.4.
|
|
2
|
+
* core v11.4.22
|
|
3
3
|
* (c) 2026 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),o=e=>"number"==typeof e&&isFinite(e),a=e=>"[object Date]"===O(e),l=e=>"[object RegExp]"===O(e),s=e=>C(e)&&0===Object.keys(e).length,i=Object.assign,c=Object.create,u=(e=null)=>c(e),f=Object.prototype.hasOwnProperty;function m(e,t){return f.call(e,t)}function _(e,t){const n=e[t];return m(e,t)?n:void 0}const E=Array.isArray,d=e=>"function"==typeof e,g=e=>"string"==typeof e,p=e=>"boolean"==typeof e,N=e=>null!==e&&"object"==typeof e,T=e=>N(e)&&d(e.then)&&d(e.catch),A=Object.prototype.toString,O=e=>A.call(e),C=e=>"[object Object]"===O(e);function b(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}const h=/^javascript:/i,L=/^(?:href|xlink:href|src|action|formaction)$/i,k=/&#(?:x([0-9a-f]+)|(\d+));?/gi,R=/&(?:Tab|NewLine);/g,D=/:?/gi,S=/[\u0000-\u0020\u007f-\u009f]/g,M=/^on\w/i,y=/^srcdoc$/i,F=/^(?:base|animate|set|script|plaintext)$/i,P=/^(?:iframe|noembed|noframes|noscript|style|textarea|title|xmp)$/i,U=/<(\/?)([a-z][^\t\n\f\r />]*)/iy,w=/([\t\n\f\r /]*)(?:(>)|([^\t\n\f\r />][^\t\n\f\r />=]*)(?:[\t\n\f\r ]*=[\t\n\f\r ]*(?:(["'])([\s\S]*?)(\4|$)|([^\t\n\f\r >]*)))?)/y,v=/<!--(?:>|->|[\s\S]*?--!?>)/y;function x(e,t,n){const r=t||n;if(!r)return e;const o=Number.parseInt(r,t?16:10);return o<=127?String.fromCharCode(o):e}function W(e){const t=e.replace(k,x).replace(R,"").replace(D,":").replace(S,"");return h.test(t)}function V(e,t){if(L.test(e)&&W(t))return"about:blank";const n="style"===e.toLowerCase()?function(e){const t=/url\s*\(/gi;let n,r="",o=0;for(;null!==(n=t.exec(e));){const a=n.index,l=t.lastIndex-1;let s=l+1,i=1,c=null;for(;s<e.length;s++){const t=e[s];if(c)t===c&&(c=null);else if('"'===t||"'"===t)c=t;else if("("===t)i++;else if(")"===t&&(i--,0===i))break}if(0!==i)break;const u=e.slice(l+1,s).trim(),f=u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'")?u.slice(1,-1).trim():u;r+=e.slice(o,a),r+=W(f)?"url(about:blank)":e.slice(a,s+1),o=s+1}return r+e.slice(o)}(t):t;return function(e){return e.replace(/&(?![a-z0-9#]{2,6};)/gi,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}(n)}function G(e){return e.replace(/</g,"<")}function $(e,t,n,r){let o=e;if(M.test(e)?(r.eventHandler=!0,o=`on${e.slice(2)}`):y.test(e)&&(r.srcdoc=!0,o=`s${e.slice(1)}`),void 0===t)return o;const a=n||"";return`${o}=${a}${V(e,t)}${a}`}function j(e,t,n){U.lastIndex=t;const r=U.exec(e);if(!r)return;const[,o,a]=r;let l,s=r[0];for(w.lastIndex=U.lastIndex;l=w.exec(e);){const[r,i,c,u,f,m,_,E]=l;if(c){const n=w.lastIndex;return[o?e.slice(t,n):s+r,a,n]}if(f&&!_)break;if(!o){s+=i+$(u,f?m:E,f,n)}}return[s,a,-1]}function K(e,t,n){for(let r=e.indexOf("</",t);-1!==r;r=e.indexOf("</",r+2)){const t=j(e,r,{});if(t&&t[1].toLowerCase()===n.toLowerCase())return-1===t[2]?-1:r}return-1}const Y={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};function B(e,t,n={}){const{domain:r,messages:o,args:a}=n,l=new SyntaxError(String(e));return l.code=e,t&&(l.location=t),l.domain=r,l}function H(e){return N(e)&&0===q(e)&&(m(e,"b")||m(e,"body"))}const z=["b","body"];const X=["c","cases"];const Z=["s","static"];const J=["i","items"];const Q=["t","type"];function q(e){return oe(e,Q)}const ee=["v","value"];function te(e,t){const n=oe(e,ee);if(null!=n)return n;throw le(t)}const ne=["m","modifier"];const re=["k","key"];function oe(e,t,n){for(let r=0;r<t.length;r++){const n=t[r];if(m(e,n)&&null!=e[n])return e[n]}return n}const ae=[...z,...X,...Z,...J,...re,...ne,...ee,...Q];function le(e){return new Error(`unhandled node type: ${e}`)}function se(e){return t=>function(e,t){const n=(r=t,oe(r,z));var r;if(null==n)throw le(0);if(1===q(n)){const t=function(e){return oe(e,X,[])}(n);return e.plural(t.reduce(((t,n)=>[...t,ie(e,n)]),[]))}return ie(e,n)}(t,e)}function ie(e,t){const n=function(e){return oe(e,Z)}(t);if(null!=n)return"text"===e.type?n:e.normalize([n]);{const n=function(e){return oe(e,J,[])}(t).reduce(((t,n)=>[...t,ce(e,n)]),[]);return e.normalize(n)}}function ce(e,t){const n=q(t);switch(n){case 3:case 9:case 7:case 8:return te(t,n);case 4:{const r=t;if(m(r,"k")&&r.k)return e.interpolate(e.named(r.k));if(m(r,"key")&&r.key)return e.interpolate(e.named(r.key));throw le(n)}case 5:{const r=t;if(m(r,"i")&&o(r.i))return e.interpolate(e.list(r.i));if(m(r,"index")&&o(r.index))return e.interpolate(e.list(r.index));throw le(n)}case 6:{const n=t,r=function(e){return oe(e,ne)}(n),o=function(e){const t=oe(e,re);if(t)return t;throw le(6)}(n);return e.linked(ce(e,o),r?ce(e,r):void 0,e.type)}default:throw new Error(`unhandled node on format message part: ${n}`)}}let ue=u();function fe(e,t){{if(!H(e))return()=>e;const t=e.cacheKey;if(t){const n=ue[t];return n||(ue[t]=se(e))}return se(e)}}let me=null;const _e=Ee("function:translate");function Ee(e){return t=>me&&me.emit(e,t)}const de={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function ge(e,t){return null!=t.locale?Ne(t.locale):Ne(e.locale)}let pe;function Ne(e){if(g(e))return e;if(d(e)){if(e.resolvedOnce&&null!=pe)return pe;if("Function"===e.constructor.name){const t=e();if(T(t))throw Error(de.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return pe=t}throw Error(de.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(de.NOT_SUPPORT_LOCALE_TYPE)}function Te(e,t,n){return[...new Set([n,...E(t)?t:N(t)?Object.keys(t).filter((e=>"default"!==e)):g(t)?[t]:[n]])]}function Ae(e,t,n){const r=g(n)?n:Ue,o=e;let a;N(t)?(o.__localeChainObjectCache||(o.__localeChainObjectCache=new WeakMap),a=o.__localeChainObjectCache.get(t),a||(a=new Map,o.__localeChainObjectCache.set(t,a))):(o.__localeChainCache||(o.__localeChainCache=new Map),a=o.__localeChainCache.get(t),a||(a=new Map,o.__localeChainCache.set(t,a)));const l=a.get(r);if(l)return l;const s=[];let i=[n];for(;E(i);)i=Oe(s,i,t);const c=E(t)||!C(t)?t:t.default?t.default:null;return i=g(c)?[c]:c,E(i)&&Oe(s,i,!1),a.set(r,s),s}function Oe(e,t,n){let r=!0;for(let o=0;o<t.length&&p(r);o++){const a=t[o];g(a)&&(r=Ce(e,t[o],n))}return r}function Ce(e,t,n){let r;const o=t.split("-");do{r=be(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function be(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(E(n)||C(n))&&n[o]&&(r=n[o])}return r}de.INVALID_ARGUMENT,de.INVALID_DATE_ARGUMENT,de.INVALID_ISO_DATE_ARGUMENT,de.NOT_SUPPORT_NON_STRING_MESSAGE,de.NOT_SUPPORT_LOCALE_PROMISE_VALUE,de.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,de.NOT_SUPPORT_LOCALE_TYPE;const Ie=[];Ie[0]={w:[0],i:[3,0],"[":[4],o:[7]},Ie[1]={w:[1],".":[2],"[":[4],o:[7]},Ie[2]={w:[2],i:[3,0],0:[3,0]},Ie[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Ie[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Ie[5]={"'":[4,0],o:8,l:[5,0]},Ie[6]={'"':[4,0],o:8,l:[6,0]};const he=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Le(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function ke(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,he.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function Re(e){const t=[];let n,r,o,a,l,s,i,c=-1,u=0,f=0;const m=[];function _(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,o="\\"+t,m[0](),!0}for(m[0]=()=>{void 0===r?r=o:r+=o},m[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},m[2]=()=>{m[0](),f++},m[3]=()=>{if(f>0)f--,u=4,m[0]();else{if(f=0,void 0===r)return!1;if(r=ke(r),!1===r)return!1;m[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!_()){if(a=Le(n),i=Ie[u],l=i[a]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=m[l[1]],s&&(o=n,!1===s())))return;if(7===u)return t}}const De=new Map;function Se(e,t){return N(e)?_(e,t):null}function Me(e,t){if(!N(e))return null;let n=De.get(t);if(n||(n=Re(t),n&&De.set(t,n)),!n)return null;const r=n.length;let o=e,a=0;for(;a<r;){const e=n[a];if(ae.includes(e)&&H(o))return null;if(!N(o))return null;if(!m(o,e))return null;const t=o[e];if(void 0===t)return null;if(d(o))return null;o=t,a++}return o}const ye={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7,INVALID_NUMBER_ARGUMENT:8,INVALID_DATE_ARGUMENT:9},Fe={[ye.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale {resource}.",[ye.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[ye.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[ye.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[ye.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[ye.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[ye.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.",[ye.INVALID_NUMBER_ARGUMENT]:"Invalid argument for number formatting: expected a number but received '{value}'.",[ye.INVALID_DATE_ARGUMENT]:"Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'."};const Pe="11.4.20",Ue="en-US",we=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let ve,xe,We;function Ve(e){ve=e}function Ge(e){xe=e}function $e(e){We=e}let je=null;let Ke=null;let Ye=0;const Be=e=>({[e]:u()});function He(e,t,n,r,o){const{missing:a,onWarn:l}=e;if(null!==a){const r=a(e,n,t,o);return g(r)?r:t}return t}function ze(e,t){const n=e;N(t)?n.__localeChainObjectCache?.delete(t):n.__localeChainCache?.delete(t)}function Xe(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function Ze(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(Xe(e,t[r]))return!0;return!1}function Je(e,t,n,r,o,a,l){const{fallbackLocale:s,localeFallbacker:i,onWarn:c}=e,u=i(e,s,n);for(let f=0;f<u.length;f++){const n=u[f],o=_(_(r,n)||{},t);if(C(o)&&g(n))return n;He(e,t,n,0,l)}return null}function Qe(e,t,n){let r=`${e}__${t}`;return C(n)&&!s(n)&&(r=`${r}__${JSON.stringify(n)}`),r}function qe(e,t,n){for(const r in n){const n=`${t}__${r}`;for(const t of e.keys())(t===n||t.startsWith(`${n}__`))&&e.delete(t)}}function et(e,t,n,r){const[,o,a,l]=e;let s=n;return g(o)?t.key=o:C(o)&&Object.keys(o).forEach((e=>{r.includes(e)?s[e]=o[e]:t[e]=o[e]})),g(a)?t.locale=a:C(a)&&(s=a),C(l)&&(s=l),s}const tt=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function nt(...e){const[t]=e,n=u(),r=u();let l;if(g(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(de.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();l=new Date(n);try{l.toISOString()}catch{throw Error(de.INVALID_ISO_DATE_ARGUMENT)}}else if(a(t)){if(isNaN(t.getTime()))throw Error(de.INVALID_DATE_ARGUMENT);l=t}else{if(!o(t))throw Error(de.INVALID_ARGUMENT);l=t}const s=et(e,n,r,tt);return[n.key||"",l,n,s]}const rt=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function ot(...e){const[t]=e,n=u(),r=u();if(!o(t))throw Error(de.INVALID_ARGUMENT);const a=t,l=et(e,n,r,rt);return[n.key||"",a,n,l]}const at=e=>e,lt=e=>"",st="text",it=e=>0===e.length?"":function(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}(e),ct=e=>null==e?"":E(e)||C(e)&&e.toString===A?JSON.stringify(e,null,2):String(e);function ut(e,t){return e=Math.abs(e),2===t?1===e?0:1:Math.min(e,2)}function ft(e={}){const t=e.locale,n=function(e){const t=o(e.pluralIndex)?e.pluralIndex:-1;return o(e.named?.count)?e.named.count:o(e.named?.n)?e.named.n:t}(e),r=g(t)&&e.pluralRules&&d(_(e.pluralRules,t))?e.pluralRules[t]:ut,a=r===ut?void 0:ut,l=e.list||[],s=e.named||u(),c=o(e.pluralIndex),f=t=>{const n=function(e){return m(Object.prototype,e)}(t)?_(s,t):s[t];return!c||n||"count"!==t&&"n"!==t?n:e.pluralIndex};function p(t,n){const r=d(e.messages)?e.messages(t,!!n):!!N(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):lt)}const T=d(e.processor?.normalize)?e.processor.normalize:it,A=d(e.processor?.interpolate)?e.processor.interpolate:ct,O={list:e=>l[e],named:f,plural:e=>e[r(n,e.length,a)],linked:(t,...n)=>{const[r,o]=n;let a="text",l="";1===n.length?N(r)?(l=r.modifier||l,a=r.type||a):g(r)&&(l=r||l):2===n.length&&(g(r)&&(l=r||l),g(o)&&(a=o||a));const s=p(t,!0)(O),i=""===s||void 0===s?t:s,c="vnode"===a&&E(i)&&l?i[0]:i;if(!l)return c;const u=(f=l,e.modifiers?_(e.modifiers,f):at);var f;return d(u)?u(c,a):c},message:p,type:g(e.processor?.type)?e.processor.type:st,interpolate:A,normalize:T,values:i(u(),l,s,c?{count:f("count"),n:f("n")}:{})};return O}const mt=()=>"",_t=e=>d(e),Et=e=>g(e)||H(e)||_t(e);function dt(e,t,n,r,o,a){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,f=c(e,r,n);let m,E=u(),d=null;for(let g=0;g<f.length&&(m=f[g],E=_(l,m)||u(),null===(d=i(E,t))&&(d=_(E,t)),!Et(d));g++)if(!Ze(m,f)){const n=He(e,t,m,0,"translate");n!==t&&(d=n)}return[d,m,E]}function gt(e,t,r,o,a,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(_t(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==s){const e=()=>o;return e.locale=r,e.key=t,e}const c=s(o,function(e,t,r,o,a,l){return{locale:t,key:r,warnHtmlMessage:a,onError:e=>{throw l&&l(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,a,0,i,l));return c.locale=r,c.key=t,c.source=o,c}function pt(...e){const[t,n,r]=e,a=u();if(!(g(t)||o(t)||_t(t)||H(t)))throw Error(de.INVALID_ARGUMENT);const l=o(t)?String(t):(_t(t),t);return o(n)?a.plural=n:g(n)?a.default=n:C(n)&&!s(n)?a.named=n:E(n)&&(a.list=n),o(r)?a.plural=r:g(r)?a.default=r:C(r)&&i(a,r),[l,a]}return Ve(fe),Ge(Me),$e(Ae),e.AST_NODE_PROPS_KEYS=ae,e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=10,e.CompileErrorCodes=Y,e.CoreErrorCodes=de,e.CoreWarnCodes=ye,e.DATETIME_FORMAT_OPTIONS_KEYS=tt,e.DEFAULT_LOCALE=Ue,e.DEFAULT_MESSAGE_DATA_TYPE=st,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=rt,e.VERSION=Pe,e.clearCompileCache=function(){ue=u()},e.clearDateTimeFormat=function(e,t,n){qe(e.__datetimeFormatters,t,n)},e.clearNumberFormat=function(e,t,n){qe(e.__numberFormatters,t,n)},e.compile=fe,e.createCompileError=B,e.createCoreContext=function(e={}){const t=d(e.onWarn)?e.onWarn:b,n=g(e.version)?e.version:Pe,r=g(e.locale)||d(e.locale)?e.locale:Ue,o=d(r)?Ue:r,a=E(e.fallbackLocale)||C(e.fallbackLocale)||g(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:o,s=C(e.messages)?e.messages:Be(o),c=C(e.datetimeFormats)?e.datetimeFormats:Be(o),f=C(e.numberFormats)?e.numberFormats:Be(o),m=i(u(),e.modifiers,{upper:(e,t)=>"text"===t&&g(e)?e.toUpperCase():"vnode"===t&&N(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&g(e)?e.toLowerCase():"vnode"===t&&N(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&g(e)?we(e):"vnode"===t&&N(e)&&"__v_isVNode"in e?we(e.children):e}),_=e.pluralRules||u(),T=d(e.missing)?e.missing:null,A=!p(e.missingWarn)&&!l(e.missingWarn)||e.missingWarn,O=!p(e.fallbackWarn)&&!l(e.fallbackWarn)||e.fallbackWarn,I=!!e.fallbackFormat,h=!!e.unresolving,L=d(e.postTranslation)?e.postTranslation:null,k=C(e.processor)?e.processor:null,R=!p(e.warnHtmlMessage)||e.warnHtmlMessage,D=!!e.escapeParameter,S=d(e.messageCompiler)?e.messageCompiler:ve,M=d(e.messageResolver)?e.messageResolver:xe||Se,y=d(e.localeFallbacker)?e.localeFallbacker:We||Te,F=N(e.fallbackContext)?e.fallbackContext:void 0,P=e,U=N(P.__datetimeFormatters)?P.__datetimeFormatters:new Map,w=N(P.__numberFormatters)?P.__numberFormatters:new Map,v=N(P.__meta)?P.__meta:{};Ye++;const x={version:n,cid:Ye,locale:r,fallbackLocale:a,messages:s,modifiers:m,pluralRules:_,missing:T,missingWarn:A,fallbackWarn:O,fallbackFormat:I,unresolving:h,postTranslation:L,processor:k,warnHtmlMessage:R,escapeParameter:D,messageCompiler:S,messageResolver:M,localeFallbacker:y,fallbackContext:F,onWarn:t,__meta:v};return x.datetimeFormats=c,x.numberFormats=f,x.__datetimeFormatters=U,x.__numberFormatters=w,x},e.createCoreError=function(e){return B(e,null,void 0)},e.createMessageContext=ft,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,onWarn:l}=e,{__datetimeFormatters:s}=e;if(!g(t[0])&&!a(t[0])&&!o(t[0]))return"";const[c,u,f,m]=nt(...t),_=(p(f.missingWarn)?f.missingWarn:e.missingWarn,p(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,!!f.part),E=ge(e,f);if(!g(c)||""===c){const e=new Intl.DateTimeFormat(E.replace(/!/g,""),m);return _?e.formatToParts(u):e.format(u)}const d=Je(e,c,E,n,0,0,"datetime format");if(!g(d))return r?-1:c;const N=n[d][c],T=Qe(d,c,m);let A=s.get(T);return A||(A=new Intl.DateTimeFormat(d,i({},N,m)),s.set(T,A)),_?A.formatToParts(u):A.format(u)},e.fallbackWithLocaleChain=Ae,e.fallbackWithSimple=Te,e.getAdditionalMeta=()=>je,e.getDevToolsHook=function(){return me},e.getFallbackContext=()=>Ke,e.getLocale=ge,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&N(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(Fe[e],...n)},e.handleMissing=He,e.initI18nDevTools=function(e,t,n){me&&me.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=Xe,e.isImplicitFallback=Ze,e.isMessageAST=H,e.isMessageFormat=Et,e.isMessageFunction=_t,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,onWarn:a}=e,{__numberFormatters:l}=e;if(!o(t[0]))return"";const[s,c,u,f]=ot(...t),m=(p(u.missingWarn)?u.missingWarn:e.missingWarn,p(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn,!!u.part),_=ge(e,u);if(!g(s)||""===s){const e=new Intl.NumberFormat(_.replace(/!/g,""),f);return m?e.formatToParts(c):e.format(c)}const E=Je(e,s,_,n,0,0,"number format");if(!g(E))return r?-1:s;const d=n[E][s],N=Qe(E,s,f);let T=l.get(N);return T||(T=new Intl.NumberFormat(E,i({},d,f)),l.set(N,T)),m?T.formatToParts(c):T.format(c)},e.parse=Re,e.parseDateTimeArgs=nt,e.parseNumberArgs=ot,e.parseTranslateArgs=pt,e.registerLocaleFallbacker=$e,e.registerMessageCompiler=Ve,e.registerMessageResolver=Ge,e.resolveLocale=Ne,e.resolveValue=Me,e.resolveWithKeyValue=Se,e.setAdditionalMeta=e=>{je=e},e.setDevToolsHook=function(e){me=e},e.setFallbackContext=e=>{Ke=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:a,messageCompiler:l,fallbackLocale:s,messages:i}=e,[c,f]=pt(...t),m=p(f.missingWarn)?f.missingWarn:e.missingWarn,T=p(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,A=p(f.escapeParameter)?f.escapeParameter:e.escapeParameter,O=!!f.resolvedMessage,C=g(f.default)||p(f.default)?p(f.default)?l?c:()=>c:f.default:n?l?c:()=>c:null,b=n||null!=C&&(g(C)||d(C)),h=ge(e,f);A&&function(e){E(e.list)&&(e.list=e.list.map((e=>g(e)?I(e):e)));if(N(e.named)){const t=e.named,n=u();for(const e of Object.keys(t)){const r=t[e];n[e]=g(r)?I(r):r}e.named=n}}(f);let[L,k,R]=O?[c,h,_(i,h)||u()]:dt(e,c,h,s,T,m),D=L,S=c;if(O||Et(D)||b&&(D=C,S=D),!(O||Et(D)&&g(k)))return a?-1:c;let M=!1;const y=_t(D)?D:gt(e,c,k,D,S,(()=>{M=!0}));if(M)return D;const U=function(e,t,n,r){const{modifiers:a,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:f}=e,m=(r,o)=>{let a=s(n,r);if(null==a&&(f||o)){const[n,,o]=dt(f||e,r,t,i,c,u);a=n??s(o,r)}if(g(a)||H(a)){let n=!1;const o=gt(e,r,t,a,r,(()=>{n=!0}));return n?mt:o}return _t(a)?a:mt},_={locale:t,modifiers:a,pluralRules:l,messages:m};e.processor&&(_.processor=e.processor);r.list&&(_.list=r.list);r.named&&(_.named=r.named);o(r.plural)&&(_.pluralIndex=r.plural);return _}(e,k,R,f),w=function(e,t,n){const r=t(n);return r}(0,y,ft(U));let x=r?r(w,c):w;return A&&g(x)&&(x=function(e){const t={};let n,r="",o=0;for(;-1!==(n=e.indexOf("<",o));){r+=e.slice(o,n),o=n+1;const a=j(e,n,t);if(a){const[l,s,i]=a;if(-1===i){t.unclosed=!0,r+=G(e.slice(n)),o=e.length;break}if(o=i,"/"===l[1])r+=l;else if(F.test(s))t.element=!0,r+=G(l);else if(P.test(s)){const n=K(e,i,s);-1===n?(t.unclosed=!0,r+=G(l)):(r+=l+G(e.slice(i,n)),o=n)}else r+=l}else v.lastIndex=n,v.test(e)?(r+=e.slice(n,v.lastIndex),o=v.lastIndex):(e.startsWith("\x3c!--",n)&&(t.unclosed=!0),r+="<")}return r+=e.slice(o),r}(x)),x},e.translateDevTools=_e,e.updateFallbackLocale=function(e,t,n){ze(e,n),e.fallbackContext&&ze(e.fallbackContext,n),e.localeFallbacker(e,n,t)},e}({});
|
|
6
|
+
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),a=e=>"number"==typeof e&&isFinite(e),o=e=>"[object Date]"===A(e),s=e=>"[object RegExp]"===A(e),l=e=>b(e)&&0===Object.keys(e).length,i=Object.assign,c=Object.create,u=(e=null)=>c(e),f=Object.prototype.hasOwnProperty;function m(e,t){return f.call(e,t)}function _(e,t){const n=e[t];return m(e,t)?n:void 0}const p=Array.isArray,d=e=>"function"==typeof e,g=e=>"string"==typeof e,E=e=>"boolean"==typeof e,h=e=>null!==e&&"object"==typeof e,N=e=>h(e)&&d(e.then)&&d(e.catch),T=Object.prototype.toString,A=e=>T.call(e),b=e=>"[object Object]"===A(e),O=e=>null==e?"":p(e)||b(e)&&e.toString===T?JSON.stringify(e,null,2):String(e);function C(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}const L=/^javascript:/i,k=/^(?:href|xlink:href|src|action|formaction)$/i,R=/&#(?:x([0-9a-f]+)|(\d+));?/gi,D=/&(?:Tab|NewLine);/g,S=/:?/gi,M=/[\u0000-\u0020\u007f-\u009f]/g,y=/^on\w/i,F=/^srcdoc$/i,v=/^(?:base|animate|set|script|plaintext)$/i,P=/^(?:iframe|noembed|noframes|noscript|style|textarea|title|xmp)$/i,w=/<(\/?)([a-z][^\t\n\f\r />]*)/iy,x=/([\t\n\f\r /]*)(?:(>)|([^\t\n\f\r />][^\t\n\f\r />=]*)(?:[\t\n\f\r ]*=[\t\n\f\r ]*(?:(["'])([\s\S]*?)(\4|$)|([^\t\n\f\r >]*)))?)/y,U=/<!--(?:>|->|[\s\S]*?--!?>)/y;function W(e,t,n){const r=t||n;if(!r)return e;const a=Number.parseInt(r,t?16:10);return a<=127?String.fromCharCode(a):e}function $(e){const t=e.replace(R,W).replace(D,"").replace(S,":").replace(M,"");return L.test(t)}function V(e,t){if(k.test(e)&&$(t))return"about:blank";const n="style"===e.toLowerCase()?function(e){const t=/url\s*\(/gi;let n,r="",a=0;for(;null!==(n=t.exec(e));){const o=n.index,s=t.lastIndex-1;let l=s+1,i=1,c=null;for(;l<e.length;l++){const t=e[l];if(c)t===c&&(c=null);else if('"'===t||"'"===t)c=t;else if("("===t)i++;else if(")"===t&&(i--,0===i))break}if(0!==i)break;const u=e.slice(s+1,l).trim(),f=u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'")?u.slice(1,-1).trim():u;r+=e.slice(a,o),r+=$(f)?"url(about:blank)":e.slice(o,l+1),a=l+1}return r+e.slice(a)}(t):t;return function(e){return e.replace(/&(?![a-z0-9#]{2,6};)/gi,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}(n)}function G(e){return e.replace(/</g,"<")}function j(e,t,n,r){let a=e;if(y.test(e)?(r.eventHandler=!0,a=`on${e.slice(2)}`):F.test(e)&&(r.srcdoc=!0,a=`s${e.slice(1)}`),void 0===t)return a;const o=n||"";return`${a}=${o}${V(e,t)}${o}`}const K=0,Y=1,B=2,H=/^(?:area|base|basefont|bgsound|br|col|embed|frame|hr|image|img|input|keygen|link|meta|param|source|track|wbr|html|head|body|frameset)$/,z=/^(?:b|big|blockquote|body|br|center|code|dd|div|dl|dt|em|embed|h[1-6]|head|hr|i|img|li|listing|menu|meta|nobr|ol|p|pre|ruby|s|small|span|strong|strike|sub|sup|table|tt|u|ul|var)$/,X=/^(?:address|article|aside|blockquote|center|details|dialog|dir|div|dl|fieldset|figcaption|figure|footer|header|hgroup|main|menu|nav|ol|p|search|section|summary|ul|h[1-6]|pre|listing|form|li|dd|dt|plaintext|table|hr|xmp)$/,q=/^(?:applet|caption|html|table|td|th|marquee|object|template|button)$/,Z=/^(?:foreignobject|desc|title)$/,J=/^(?:foreignobject|desc|mi|mo|mn|ms|mtext|annotation-xml)$/,Q=/^(?:mi|mo|mn|ms|mtext)$/,ee=/^(?:text\/html|application\/xhtml\+xml)$/i;function te(e){return e.replace(/[A-Z]+/g,(e=>e.toLowerCase()))}function ne(e,t,n){let r="";for(let a=e.length-1;a>=t;a--){const t=e[a];t.namespace===K&&"form"===t.name?n[t.part]=G(n[t.part]):r+=`</${t.name}>`}return e.length=t,r}function re(e,t){let n=e.length;for(;n>0&&e[n-1].namespace!==K&&!e[n-1].integration;)n--;return ne(e,n,t)}function ae(e,t,n,r,a){const o=t.length+1;let s="";const l=e[e.length-1];if(function(e,t){return!!e&&e.namespace!==K&&(!e.integration||Q.test(e.name)&&("mglyph"===t||"malignmark"===t))&&!("annotation-xml"===e.name&&"svg"===t)}(l,n)){if(!function(e,t){return z.test(e)||"font"===e&&(t.has("color")||t.has("face")||t.has("size"))}(n,r))return a||e.push({name:n,namespace:l.namespace,integration:l.namespace===Y?Z.test(n):Q.test(n)||"annotation-xml"===n&&ee.test((r.get("encoding")||"").replace(R,W)),part:o}),s;s=re(e,t)}if(X.test(n))for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.namespace===K?q.test(n.name):n.integration)break;if(n.namespace===K&&"p"===n.name){s+=ne(e,i,t);break}}if(!J.test(n))return"svg"===n||"math"===n?a||e.push({name:n,namespace:"svg"===n?Y:B,integration:!1,part:o}):H.test(n)||e.push({name:n,namespace:K,integration:!1,part:o}),s}function oe(e,t,n){let r="";"p"!==n&&"br"!==n||(r=re(e,t));let a=e.length-1;for(;a>=0&&e[a].namespace!==K&&e[a].name!==n;)a--;if(a>=0&&e[a].namespace!==K);else for(;a>=0&&(e[a].namespace!==K||e[a].name!==n);)a--;return a<0?"br"===n||"p"===n?r:void 0:(r+=ne(e,a+1,t),e.length=a,r)}function se(e,t,n){w.lastIndex=t;const r=w.exec(e);if(!r)return;const[,a,o]=r;let s=r[0];const l=new Map;let i;for(x.lastIndex=w.lastIndex;i=x.exec(e);){const[r,c,u,f,m,_,p,d]=i;if(u){const n=x.lastIndex;return[a?e.slice(t,n):s+r,o,n,!a&&c.endsWith("/"),l]}if(m&&!p)break;if(!a){const e=m?_:d,t=te(f);l.has(t)||l.set(t,e||""),s+=c+j(f,e,m,n)}}return[s,o,-1,!1,l]}function le(e,t,n){for(let r=e.indexOf("</",t);-1!==r;r=e.indexOf("</",r+2)){const t=se(e,r,{});if(t&&t[1].toLowerCase()===n.toLowerCase())return-1===t[2]?-1:r}return-1}const ie={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};function ce(e,t,n={}){const{domain:r,messages:a,args:o}=n,s=new SyntaxError(String(e));return s.code=e,t&&(s.location=t),s.domain=r,s}function ue(e){return h(e)&&0===ge(e)&&(m(e,"b")||m(e,"body"))}const fe=["b","body"];const me=["c","cases"];const _e=["s","static"];const pe=["i","items"];const de=["t","type"];function ge(e){return Ae(e,de)}const Ee=["v","value"];function he(e,t){const n=Ae(e,Ee);if(null!=n)return n;throw Oe(t)}const Ne=["m","modifier"];const Te=["k","key"];function Ae(e,t,n){for(let r=0;r<t.length;r++){const n=t[r];if(m(e,n)&&null!=e[n])return e[n]}return n}const be=[...fe,...me,..._e,...pe,...Te,...Ne,...Ee,...de];function Oe(e){return new Error(`unhandled node type: ${e}`)}function Ce(e){return t=>function(e,t){const n=(r=t,Ae(r,fe));var r;if(null==n)throw Oe(0);if(1===ge(n)){const t=function(e){return Ae(e,me,[])}(n);return e.plural(t.reduce(((t,n)=>[...t,Ie(e,n)]),[]))}return Ie(e,n)}(t,e)}function Ie(e,t){const n=function(e){return Ae(e,_e)}(t);if(null!=n)return"text"===e.type?n:e.normalize([n]);{const n=function(e){return Ae(e,pe,[])}(t).reduce(((t,n)=>[...t,Le(e,n)]),[]);return e.normalize(n)}}function Le(e,t){const n=ge(t);switch(n){case 3:case 9:case 7:case 8:return he(t,n);case 4:{const r=t;if(m(r,"k")&&r.k)return e.interpolate(e.named(r.k));if(m(r,"key")&&r.key)return e.interpolate(e.named(r.key));throw Oe(n)}case 5:{const r=t;if(m(r,"i")&&a(r.i))return e.interpolate(e.list(r.i));if(m(r,"index")&&a(r.index))return e.interpolate(e.list(r.index));throw Oe(n)}case 6:{const n=t,r=function(e){return Ae(e,Ne)}(n),a=function(e){const t=Ae(e,Te);if(t)return t;throw Oe(6)}(n);return e.linked(Le(e,a),r?Le(e,r):void 0,e.type)}default:throw new Error(`unhandled node on format message part: ${n}`)}}let ke=u();function Re(e,t){{if(!ue(e))return()=>e;const t=e.cacheKey;if(t){const n=ke[t];return n||(ke[t]=Ce(e))}return Ce(e)}}let De=null;const Se=Me("function:translate");function Me(e){return t=>De&&De.emit(e,t)}const ye={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function Fe(e,t){return null!=t.locale?Pe(t.locale):Pe(e.locale)}let ve;function Pe(e){if(g(e))return e;if(d(e)){if(e.resolvedOnce&&null!=ve)return ve;if("Function"===e.constructor.name){const t=e();if(N(t))throw Error(ye.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return ve=t}throw Error(ye.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(ye.NOT_SUPPORT_LOCALE_TYPE)}function we(e,t,n){return[...new Set([n,...p(t)?t:h(t)?Object.keys(t).filter((e=>"default"!==e)):g(t)?[t]:[n]])]}function xe(e,t,n){const r=g(n)?n:Je,a=e;let o;h(t)?(a.__localeChainObjectCache||(a.__localeChainObjectCache=new WeakMap),o=a.__localeChainObjectCache.get(t),o||(o=new Map,a.__localeChainObjectCache.set(t,o))):(a.__localeChainCache||(a.__localeChainCache=new Map),o=a.__localeChainCache.get(t),o||(o=new Map,a.__localeChainCache.set(t,o)));const s=o.get(r);if(s)return s;const l=[];let i=[n];for(;p(i);)i=Ue(l,i,t);const c=p(t)||!b(t)?t:t.default?t.default:null;return i=g(c)?[c]:c,p(i)&&Ue(l,i,!1),o.set(r,l),l}function Ue(e,t,n){let r=!0;for(let a=0;a<t.length&&E(r);a++){const o=t[a];g(o)&&(r=We(e,t[a],n))}return r}function We(e,t,n){let r;const a=t.split("-");do{r=$e(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function $e(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const a=t.replace(/!/g,"");e.push(a),(p(n)||b(n))&&n[a]&&(r=n[a])}return r}ye.INVALID_ARGUMENT,ye.INVALID_DATE_ARGUMENT,ye.INVALID_ISO_DATE_ARGUMENT,ye.NOT_SUPPORT_NON_STRING_MESSAGE,ye.NOT_SUPPORT_LOCALE_PROMISE_VALUE,ye.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,ye.NOT_SUPPORT_LOCALE_TYPE;const Ve=[];Ve[0]={w:[0],i:[3,0],"[":[4],o:[7]},Ve[1]={w:[1],".":[2],"[":[4],o:[7]},Ve[2]={w:[2],i:[3,0],0:[3,0]},Ve[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Ve[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Ve[5]={"'":[4,0],o:8,l:[5,0]},Ve[6]={'"':[4,0],o:8,l:[6,0]};const Ge=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function je(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Ke(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,Ge.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function Ye(e){const t=[];let n,r,a,o,s,l,i,c=-1,u=0,f=0;const m=[];function _(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,m[0](),!0}for(m[0]=()=>{void 0===r?r=a:r+=a},m[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},m[2]=()=>{m[0](),f++},m[3]=()=>{if(f>0)f--,u=4,m[0]();else{if(f=0,void 0===r)return!1;if(r=Ke(r),!1===r)return!1;m[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!_()){if(o=je(n),i=Ve[u],s=i[o]||i.l||8,8===s)return;if(u=s[0],void 0!==s[1]&&(l=m[s[1]],l&&(a=n,!1===l())))return;if(7===u)return t}}const Be=new Map;function He(e,t){return h(e)?_(e,t):null}function ze(e,t){if(!h(e))return null;let n=Be.get(t);if(n||(n=Ye(t),n&&Be.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=n[o];if(be.includes(e)&&ue(a))return null;if(!h(a))return null;if(!m(a,e))return null;const t=a[e];if(void 0===t)return null;if(d(a))return null;a=t,o++}return a}const Xe={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7,INVALID_NUMBER_ARGUMENT:8,INVALID_DATE_ARGUMENT:9},qe={[Xe.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale {resource}.",[Xe.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Xe.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Xe.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Xe.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Xe.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Xe.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.",[Xe.INVALID_NUMBER_ARGUMENT]:"Invalid argument for number formatting: expected a number but received '{value}'.",[Xe.INVALID_DATE_ARGUMENT]:"Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'."};const Ze="11.4.22",Je="en-US",Qe=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let et,tt,nt;function rt(e){et=e}function at(e){tt=e}function ot(e){nt=e}let st=null;let lt=null;let it=0;const ct=e=>({[e]:u()});function ut(e,t,n,r,a){const{missing:o,onWarn:s}=e;if(null!==o){const r=o(e,n,t,a);return g(r)?r:t}return t}function ft(e,t){const n=e;h(t)?n.__localeChainObjectCache?.delete(t):n.__localeChainCache?.delete(t)}function mt(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function _t(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(mt(e,t[r]))return!0;return!1}function pt(e,t,n,r,a,o,s){const{fallbackLocale:l,localeFallbacker:i,onWarn:c}=e,u=i(e,l,n);for(let f=0;f<u.length;f++){const n=u[f],a=_(_(r,n)||{},t);if(b(a)&&g(n))return n;ut(e,t,n,0,s)}return null}function dt(e,t,n){let r=`${e}__${t}`;return b(n)&&!l(n)&&(r=`${r}__${JSON.stringify(n)}`),r}function gt(e,t,n){for(const r in n){const n=`${t}__${r}`;for(const t of e.keys())(t===n||t.startsWith(`${n}__`))&&e.delete(t)}}function Et(e,t,n,r){const[,a,o,s]=e;let l=n;return g(a)?t.key=a:b(a)&&Object.keys(a).forEach((e=>{r.includes(e)?l[e]=a[e]:t[e]=a[e]})),g(o)?t.locale=o:b(o)&&(l=o),b(s)&&(l=s),l}const ht=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Nt(...e){const[t]=e,n=u(),r=u();let s;if(g(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(ye.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();s=new Date(n);try{s.toISOString()}catch{throw Error(ye.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(ye.INVALID_DATE_ARGUMENT);s=t}else{if(!a(t))throw Error(ye.INVALID_ARGUMENT);s=t}const l=Et(e,n,r,ht);return[n.key||"",s,n,l]}const Tt=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function At(...e){const[t]=e,n=u(),r=u();if(!a(t))throw Error(ye.INVALID_ARGUMENT);const o=t,s=Et(e,n,r,Tt);return[n.key||"",o,n,s]}const bt=e=>e,Ot=e=>"",Ct="text",It=e=>0===e.length?"":function(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}(e),Lt=O;function kt(e,t){return e=Math.abs(e),2===t?1===e?0:1:Math.min(e,2)}function Rt(e={}){const t=e.locale,n=function(e){const t=a(e.pluralIndex)?e.pluralIndex:-1;return a(e.named?.count)?e.named.count:a(e.named?.n)?e.named.n:t}(e),r=g(t)&&e.pluralRules&&d(_(e.pluralRules,t))?e.pluralRules[t]:kt,o=r===kt?void 0:kt,s=e.list||[],l=e.named||u(),c=a(e.pluralIndex),f=t=>{const n=function(e){return m(Object.prototype,e)}(t)?_(l,t):l[t];return!c||n||"count"!==t&&"n"!==t?n:e.pluralIndex};function E(t,n){const r=d(e.messages)?e.messages(t,!!n):!!h(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):Ot)}const N=d(e.processor?.normalize)?e.processor.normalize:It,T=d(e.processor?.interpolate)?e.processor.interpolate:Lt,A={list:e=>s[e],named:f,plural:e=>e[r(n,e.length,o)],linked:(t,...n)=>{const[r,a]=n;let o="text",s="";1===n.length?h(r)?(s=r.modifier||s,o=r.type||o):g(r)&&(s=r||s):2===n.length&&(g(r)&&(s=r||s),g(a)&&(o=a||o));const l=E(t,!0)(A),i=""===l||void 0===l?t:l,c="vnode"===o&&p(i)&&s?i[0]:i;if(!s)return c;const u=(f=s,e.modifiers?_(e.modifiers,f):bt);var f;return d(u)?u(c,o):c},message:E,type:g(e.processor?.type)?e.processor.type:Ct,interpolate:T,normalize:N,values:i(u(),s,l,c?{count:f("count"),n:f("n")}:{})};return A}const Dt=()=>"",St=e=>d(e),Mt=e=>g(e)||ue(e)||St(e);function yt(e){return g(e)?e:I(O(e))}function Ft(e,t,n,r,a,o){const{messages:s,onWarn:l,messageResolver:i,localeFallbacker:c}=e,f=c(e,r,n);let m,p=u(),d=null;for(let g=0;g<f.length&&(m=f[g],p=_(s,m)||u(),null===(d=i(p,t))&&(d=_(p,t)),!Mt(d));g++)if(!_t(m,f)){const n=ut(e,t,m,0,"translate");n!==t&&(d=n)}return[d,m,p]}function vt(e,t,r,a,o,s){const{messageCompiler:l,warnHtmlMessage:i}=e;if(St(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==l){const e=()=>a;return e.locale=r,e.key=t,e}const c=l(a,function(e,t,r,a,o,s){return{locale:t,key:r,warnHtmlMessage:o,onError:e=>{throw s&&s(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,o,0,i,s));return c.locale=r,c.key=t,c.source=a,c}function Pt(...e){const[t,n,r]=e,o=u();if(!(g(t)||a(t)||St(t)||ue(t)))throw Error(ye.INVALID_ARGUMENT);const s=a(t)?String(t):(St(t),t);return a(n)?o.plural=n:g(n)?o.default=n:b(n)&&!l(n)?o.named=n:p(n)&&(o.list=n),a(r)?o.plural=r:g(r)?o.default=r:b(r)&&i(o,r),[s,o]}return rt(Re),at(ze),ot(xe),e.AST_NODE_PROPS_KEYS=be,e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=10,e.CompileErrorCodes=ie,e.CoreErrorCodes=ye,e.CoreWarnCodes=Xe,e.DATETIME_FORMAT_OPTIONS_KEYS=ht,e.DEFAULT_LOCALE=Je,e.DEFAULT_MESSAGE_DATA_TYPE=Ct,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=Tt,e.VERSION=Ze,e.clearCompileCache=function(){ke=u()},e.clearDateTimeFormat=function(e,t,n){gt(e.__datetimeFormatters,t,n)},e.clearNumberFormat=function(e,t,n){gt(e.__numberFormatters,t,n)},e.compile=Re,e.createCompileError=ce,e.createCoreContext=function(e={}){const t=d(e.onWarn)?e.onWarn:C,n=g(e.version)?e.version:Ze,r=g(e.locale)||d(e.locale)?e.locale:Je,a=d(r)?Je:r,o=p(e.fallbackLocale)||b(e.fallbackLocale)||g(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,l=b(e.messages)?e.messages:ct(a),c=b(e.datetimeFormats)?e.datetimeFormats:ct(a),f=b(e.numberFormats)?e.numberFormats:ct(a),m=i(u(),e.modifiers,{upper:(e,t)=>"text"===t&&g(e)?e.toUpperCase():"vnode"===t&&h(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&g(e)?e.toLowerCase():"vnode"===t&&h(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&g(e)?Qe(e):"vnode"===t&&h(e)&&"__v_isVNode"in e?Qe(e.children):e}),_=e.pluralRules||u(),N=d(e.missing)?e.missing:null,T=!E(e.missingWarn)&&!s(e.missingWarn)||e.missingWarn,A=!E(e.fallbackWarn)&&!s(e.fallbackWarn)||e.fallbackWarn,O=!!e.fallbackFormat,I=!!e.unresolving,L=d(e.postTranslation)?e.postTranslation:null,k=b(e.processor)?e.processor:null,R=!E(e.warnHtmlMessage)||e.warnHtmlMessage,D=!!e.escapeParameter,S=d(e.messageCompiler)?e.messageCompiler:et,M=d(e.messageResolver)?e.messageResolver:tt||He,y=d(e.localeFallbacker)?e.localeFallbacker:nt||we,F=h(e.fallbackContext)?e.fallbackContext:void 0,v=e,P=h(v.__datetimeFormatters)?v.__datetimeFormatters:new Map,w=h(v.__numberFormatters)?v.__numberFormatters:new Map,x=h(v.__meta)?v.__meta:{};it++;const U={version:n,cid:it,locale:r,fallbackLocale:o,messages:l,modifiers:m,pluralRules:_,missing:N,missingWarn:T,fallbackWarn:A,fallbackFormat:O,unresolving:I,postTranslation:L,processor:k,warnHtmlMessage:R,escapeParameter:D,messageCompiler:S,messageResolver:M,localeFallbacker:y,fallbackContext:F,onWarn:t,__meta:x};return U.datetimeFormats=c,U.numberFormats=f,U.__datetimeFormatters=P,U.__numberFormatters=w,U},e.createCoreError=function(e){return ce(e,null,void 0)},e.createMessageContext=Rt,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,onWarn:s}=e,{__datetimeFormatters:l}=e;if(!g(t[0])&&!o(t[0])&&!a(t[0]))return"";const[c,u,f,m]=Nt(...t),_=(E(f.missingWarn)?f.missingWarn:e.missingWarn,E(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,!!f.part),p=Fe(e,f);if(!g(c)||""===c){const e=new Intl.DateTimeFormat(p.replace(/!/g,""),m);return _?e.formatToParts(u):e.format(u)}const d=pt(e,c,p,n,0,0,"datetime format");if(!g(d))return r?-1:c;const h=n[d][c],N=dt(d,c,m);let T=l.get(N);return T||(T=new Intl.DateTimeFormat(d,i({},h,m)),l.set(N,T)),_?T.formatToParts(u):T.format(u)},e.fallbackWithLocaleChain=xe,e.fallbackWithSimple=we,e.getAdditionalMeta=()=>st,e.getDevToolsHook=function(){return De},e.getFallbackContext=()=>lt,e.getLocale=Fe,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&h(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(qe[e],...n)},e.handleMissing=ut,e.initI18nDevTools=function(e,t,n){De&&De.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=mt,e.isImplicitFallback=_t,e.isMessageAST=ue,e.isMessageFormat=Mt,e.isMessageFunction=St,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,onWarn:o}=e,{__numberFormatters:s}=e;if(!a(t[0]))return"";const[l,c,u,f]=At(...t),m=(E(u.missingWarn)?u.missingWarn:e.missingWarn,E(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn,!!u.part),_=Fe(e,u);if(!g(l)||""===l){const e=new Intl.NumberFormat(_.replace(/!/g,""),f);return m?e.formatToParts(c):e.format(c)}const p=pt(e,l,_,n,0,0,"number format");if(!g(p))return r?-1:l;const d=n[p][l],h=dt(p,l,f);let N=s.get(h);return N||(N=new Intl.NumberFormat(p,i({},d,f)),s.set(h,N)),m?N.formatToParts(c):N.format(c)},e.parse=Ye,e.parseDateTimeArgs=Nt,e.parseNumberArgs=At,e.parseTranslateArgs=Pt,e.registerLocaleFallbacker=ot,e.registerMessageCompiler=rt,e.registerMessageResolver=at,e.resolveLocale=Pe,e.resolveValue=ze,e.resolveWithKeyValue=He,e.setAdditionalMeta=e=>{st=e},e.setDevToolsHook=function(e){De=e},e.setFallbackContext=e=>{lt=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:s,fallbackLocale:l,messages:c}=e,[f,m]=Pt(...t),N=E(m.missingWarn)?m.missingWarn:e.missingWarn,T=E(m.fallbackWarn)?m.fallbackWarn:e.fallbackWarn,A=E(m.escapeParameter)?m.escapeParameter:e.escapeParameter,b=!!m.resolvedMessage,O=g(m.default)||E(m.default)?E(m.default)?s?f:()=>f:m.default:n?s?f:()=>f:null,C=n||null!=O&&(g(O)||d(O)),L=Fe(e,m);A&&function(e){p(e.list)&&(e.list=e.list.map((e=>g(e)?I(e):e)));if(h(e.named)){const t=e.named,n=u();for(const e of Object.keys(t)){const r=t[e];n[e]=g(r)?I(r):r}e.named=n}}(m);let[k,R,D]=b?[f,L,_(c,L)||u()]:Ft(e,f,L,l,T,N),S=k,M=f;if(b||Mt(S)||C&&(S=O,M=S),!(b||Mt(S)&&g(R)))return o?-1:f;let y=!1;const F=St(S)?S:vt(e,f,R,S,M,(()=>{y=!0}));if(y)return S;const w=function(e,t,n,r,o){const{modifiers:s,pluralRules:l,messageResolver:c,fallbackLocale:u,fallbackWarn:f,missingWarn:m,fallbackContext:_}=e,p=(r,a)=>{let o=c(n,r);if(null==o&&(_||a)){const[n,,a]=Ft(_||e,r,t,u,f,m);o=n??c(a,r)}if(g(o)||ue(o)){let n=!1;const a=vt(e,r,t,o,r,(()=>{n=!0}));return n?Dt:a}return St(o)?o:Dt},E={locale:t,modifiers:s,pluralRules:l,messages:p},h=function(e,t){if(!t||d(e?.interpolate))return e;return i({},e,{interpolate:yt})}(e.processor,o);h&&(E.processor=h);r.list&&(E.list=r.list);r.named&&(E.named=r.named);a(r.plural)&&(E.pluralIndex=r.plural);return E}(e,R,D,m,A),x=function(e,t,n){const r=t(n);return r}(0,F,Rt(w));let W=r?r(x,f):x;return A&&g(W)&&(W=function(e){const t={},n=[],r=[];let a,o=0;for(;-1!==(a=e.indexOf("<",o));){n.push(e.slice(o,a)),o=a+1;const s=se(e,a,t);if(s){const[l,i,c,u,f]=s;if(-1===c){t.unclosed=!0,n.push(G(e.slice(a))),o=e.length;break}if(o=c,"/"===l[1]){const e=oe(r,n,te(i));void 0===e?t.closed=!0:(e&&(t.closed=!0),n.push(e+l))}else if(v.test(i))t.element=!0,n.push(G(l));else{let a="";if(P.test(i)){const r=le(e,c,i);if(-1===r){t.unclosed=!0,n.push(G(l));continue}a=G(e.slice(c,r)),o=r}const s=ae(r,n,te(i),f,u);void 0===s?(t.closed=!0,n.push(G(l)+a)):n.push(s,l+a)}}else U.lastIndex=a,U.test(e)?(n.push(e.slice(a,U.lastIndex)),o=U.lastIndex):(e.startsWith("\x3c!--",a)&&(t.unclosed=!0),n.push("<"))}n.push(e.slice(o));for(let s=r.length-1;s>=0;s--){const e=r[s];t.closed=!0,e.namespace===K&&"form"===e.name?n[e.part]=G(n[e.part]):n.push(`</${e.name}>`)}return n.join("")}(W)),W},e.translateDevTools=Se,e.updateFallbackLocale=function(e,t,n){ft(e,n),e.fallbackContext&&ft(e.fallbackContext,n),e.localeFallbacker(e,n,t)},e}({});
|
package/dist/core.runtime.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/core",
|
|
3
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.22",
|
|
4
4
|
"description": "@intlify/core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"core",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"jsdelivr": "dist/core.global.js",
|
|
34
34
|
"types": "dist/core.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@intlify/core-base": "11.4.
|
|
37
|
-
"@intlify/shared": "11.4.
|
|
36
|
+
"@intlify/core-base": "11.4.22",
|
|
37
|
+
"@intlify/shared": "11.4.22"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">= 22"
|