Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@intlify/core

Package Overview
Dependencies
Maintainers
2
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intlify/core - npm Package Compare versions

Comparing version 9.0.0-beta.12 to 9.0.0-beta.13

959

dist/core.cjs.js
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi

@@ -10,956 +10,9 @@ * Released under the MIT License.

var shared = require('@intlify/shared');
var messageCompiler = require('@intlify/message-compiler');
var messageResolver = require('@intlify/message-resolver');
var runtime = require('@intlify/runtime');
var coreBase = require('@intlify/core-base');
/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return shared.format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (shared.isString(val) ? val.toUpperCase() : val),
lower: (val) => (shared.isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (shared.isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = shared.isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = shared.isArray(options.fallbackLocale) ||
shared.isPlainObject(options.fallbackLocale) ||
shared.isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = shared.isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = shared.isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = shared.isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = shared.isFunction(options.missing) ? options.missing : null;
const missingWarn = shared.isBoolean(options.missingWarn) || shared.isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = shared.isBoolean(options.fallbackWarn) || shared.isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = shared.isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = shared.isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = shared.isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = shared.isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = shared.isFunction(options.onWarn) ? options.onWarn : shared.warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = shared.isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = shared.isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
{
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
{
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return shared.isString(ret) ? ret : key;
}
else {
if ( isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (shared.isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = shared.isArray(fallback)
? fallback
: shared.isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = shared.isString(defaults) ? [defaults] : defaults;
if (shared.isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && shared.isBoolean(follow); i++) {
const locale = block[i];
if (shared.isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((shared.isArray(blocks) || shared.isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
const RE_HTML_TAG = /<\/?[\w\s="/.':;#-\/]+>/;
const WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`;
function checkHtmlMessage(source, options) {
const warnHtmlMessage = shared.isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
if (warnHtmlMessage && RE_HTML_TAG.test(source)) {
shared.warn(shared.format(WARN_MESSAGE, { source }));
}
}
const defaultOnCacheKey = (source) => source;
let compileCache = Object.create(null);
/** @internal */
function clearCompileCache() {
compileCache = Object.create(null);
}
/** @internal */
function compileToFunction(source, options = {}) {
{
// check HTML message
checkHtmlMessage(source, options);
// check caches
const onCacheKey = options.onCacheKey || defaultOnCacheKey;
const key = onCacheKey(source);
const cached = compileCache[key];
if (cached) {
return cached;
}
// compile error detecting
let occured = false;
const onError = options.onError || messageCompiler.defaultOnError;
options.onError = (err) => {
occured = true;
onError(err);
};
// compile
const { code } = messageCompiler.baseCompile(source, options);
// evaluate function
const msg = new Function(`return ${code}`)();
// if occured compile error, don't cache
return !occured ? (compileCache[key] = msg) : msg;
}
}
/** @internal */
function createCoreError(code) {
return messageCompiler.createCompileError(code, null, { messages: errorMessages } );
}
/** @internal */
const errorMessages = {
[12 /* INVALID_ARGUMENT */]: 'Invalid arguments',
[13 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[14 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
};
const NOOP_MESSAGE_FUNCTION = () => '';
const isMessageFunction = (val) => shared.isFunction(val);
// implementationo of `translate` function
/** @internal */
function translate(context, ...args) {
const { fallbackFormat, postTranslation, unresolving, fallbackLocale } = context;
const [key, options] = parseTranslateArgs(...args);
const missingWarn = shared.isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = shared.isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const escapeParameter = shared.isBoolean(options.escapeParameter)
? options.escapeParameter
: context.escapeParameter;
// prettier-ignore
const defaultMsgOrKey = shared.isString(options.default) || shared.isBoolean(options.default) // default by function option
? !shared.isBoolean(options.default)
? options.default
: key
: fallbackFormat // default by `fallbackFormat` option
? key
: '';
const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';
const locale = shared.isString(options.locale) ? options.locale : context.locale;
// escape params
escapeParameter && escapeParams(options);
// resolve message format
// eslint-disable-next-line prefer-const
let [format, targetLocale, message] = resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn);
// if you use default message, set it as message format!
let cacheBaseKey = key;
if (!(shared.isString(format) || isMessageFunction(format))) {
if (enableDefaultMsg) {
format = defaultMsgOrKey;
cacheBaseKey = format;
}
}
// checking message format and target locale
if (!(shared.isString(format) || isMessageFunction(format)) ||
!shared.isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
// setup compile error detecting
let occured = false;
const errorDetector = () => {
occured = true;
};
// compile message format
const msg = compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector);
// if occured compile error, return the message format
if (occured) {
return format;
}
// evaluate message with context
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
const msgContext = runtime.createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);
// if use post translation option, procee it with handler
return postTranslation ? postTranslation(messaged) : messaged;
}
function escapeParams(options) {
if (shared.isArray(options.list)) {
options.list = options.list.map(item => shared.isString(item) ? shared.escapeHtml(item) : item);
}
else if (shared.isObject(options.named)) {
Object.keys(options.named).forEach(key => {
if (shared.isString(options.named[key])) {
options.named[key] = shared.escapeHtml(options.named[key]);
}
});
}
}
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn } = context;
const locales = getLocaleChain(context, fallbackLocale, locale);
let message = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'translate';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if (
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(1 /* FALLBACK_TO_TRANSLATE */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ( locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
message =
messages[targetLocale] || {};
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ( shared.inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-resolve-start';
endTag = 'intlify-message-resolve-end';
shared.mark && shared.mark(startTag);
}
if ((format = messageResolver.resolveValue(message, key)) === null) {
// if null, resolve with object key path
format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any
}
// for vue-devtools timeline event
if ( shared.inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start && format) {
emitter.emit("message-resolve" /* MESSAGE_RESOLVE */, {
type: "message-resolve" /* MESSAGE_RESOLVE */,
key,
message: format,
time: end - start
});
}
if (startTag && endTag && shared.mark && shared.measure) {
shared.mark(endTag);
shared.measure('intlify message resolve', startTag, endTag);
}
}
if (shared.isString(format) || shared.isFunction(format))
break;
const missingRet = handleMissing(context, key, targetLocale, missingWarn, type);
if (missingRet !== key) {
format = missingRet;
}
from = to;
}
return [format, targetLocale, message];
}
function compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector) {
const { messageCompiler, warnHtmlMessage } = context;
if (isMessageFunction(format)) {
const msg = format;
msg.locale = msg.locale || targetLocale;
msg.key = msg.key || key;
return msg;
}
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ( shared.inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-compilation-start';
endTag = 'intlify-message-compilation-end';
shared.mark && shared.mark(startTag);
}
const msg = messageCompiler(format, getCompileOptions(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, errorDetector));
// for vue-devtools timeline event
if ( shared.inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-compilation" /* MESSAGE_COMPILATION */, {
type: "message-compilation" /* MESSAGE_COMPILATION */,
message: format,
time: end - start
});
}
if (startTag && endTag && shared.mark && shared.measure) {
shared.mark(endTag);
shared.measure('intlify message compilation', startTag, endTag);
}
}
msg.locale = targetLocale;
msg.key = key;
msg.source = format;
return msg;
}
function evaluateMessage(context, msg, msgCtx) {
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ( shared.inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-evaluation-start';
endTag = 'intlify-message-evaluation-end';
shared.mark && shared.mark(startTag);
}
const messaged = msg(msgCtx);
// for vue-devtools timeline event
if ( shared.inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-evaluation" /* MESSAGE_EVALUATION */, {
type: "message-evaluation" /* MESSAGE_EVALUATION */,
value: messaged,
time: end - start
});
}
if (startTag && endTag && shared.mark && shared.measure) {
shared.mark(endTag);
shared.measure('intlify message evaluation', startTag, endTag);
}
}
return messaged;
}
/** @internal */
function parseTranslateArgs(...args) {
const [arg1, arg2, arg3] = args;
const options = {};
if (!shared.isString(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const key = arg1;
if (shared.isNumber(arg2)) {
options.plural = arg2;
}
else if (shared.isString(arg2)) {
options.default = arg2;
}
else if (shared.isPlainObject(arg2) && !shared.isEmptyObject(arg2)) {
options.named = arg2;
}
else if (shared.isArray(arg2)) {
options.list = arg2;
}
if (shared.isNumber(arg3)) {
options.plural = arg3;
}
else if (shared.isString(arg3)) {
options.default = arg3;
}
else if (shared.isPlainObject(arg3)) {
Object.assign(options, arg3);
}
return [key, options];
}
function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) {
return {
warnHtmlMessage,
onError: (err) => {
errorDetector && errorDetector(err);
{
const message = `Message compilation error: ${err.message}`;
const codeFrame = err.location &&
shared.generateCodeFrame(source, err.location.start.offset, err.location.end.offset);
const emitter = context.__emitter;
if (emitter) {
emitter.emit("compile-error" /* COMPILE_ERROR */, {
message: source,
error: err.message,
start: err.location && err.location.start.offset,
end: err.location && err.location.end.offset
});
}
console.error(codeFrame ? `${message}\n${codeFrame}` : message);
}
},
onCacheKey: (source) => shared.generateFormatCacheKey(locale, key, source)
};
}
function getMessageContextOptions(context, locale, message, options) {
const { modifiers, pluralRules } = context;
const resolveMessage = (key) => {
const val = messageResolver.resolveValue(message, key);
if (shared.isString(val)) {
let occured = false;
const errorDetector = () => {
occured = true;
};
const msg = compileMessasgeFormat(context, key, locale, val, key, errorDetector);
return !occured
? msg
: NOOP_MESSAGE_FUNCTION;
}
else if (isMessageFunction(val)) {
return val;
}
else {
// TODO: should be implemented warning message
return NOOP_MESSAGE_FUNCTION;
}
};
const ctxOptions = {
locale,
modifiers,
pluralRules,
messages: resolveMessage
};
if (context.processor) {
ctxOptions.processor = context.processor;
}
if (options.list) {
ctxOptions.list = options.list;
}
if (options.named) {
ctxOptions.named = options.named;
}
if (shared.isNumber(options.plural)) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
const intlDefined = typeof Intl !== 'undefined';
const Availabilities = {
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
};
// implementation of `datetime` function
/** @internal */
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { __datetimeFormatters } = context;
if ( !Availabilities.dateTimeFormat) {
onWarn(getWarnMessage(4 /* CANNOT_FORMAT_DATE */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseDateTimeArgs(...args);
const missingWarn = shared.isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = shared.isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!shared.isString(key) || key === '') {
return new Intl.DateTimeFormat(locale).format(value);
}
// resolve format
let datetimeFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'datetime format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if (
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(5 /* FALLBACK_TO_DATE_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ( locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
datetimeFormat =
datetimeFormats[targetLocale] || {};
format = datetimeFormat[key];
if (shared.isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!shared.isPlainObject(format) || !shared.isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!shared.isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __datetimeFormatters.get(id);
if (!formatter) {
formatter = new Intl.DateTimeFormat(targetLocale, Object.assign({}, format, orverrides));
__datetimeFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseDateTimeArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
let value;
if (shared.isString(arg1)) {
// Only allow ISO strings - other date formats are often supported,
// but may cause different results in different browsers.
if (!/\d{4}-\d{2}-\d{2}(T.*)?/.test(arg1)) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
value = new Date(arg1);
try {
// This will fail if the date is not valid
value.toISOString();
}
catch (e) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
}
else if (shared.isDate(arg1)) {
if (isNaN(arg1.getTime())) {
throw createCoreError(13 /* INVALID_DATE_ARGUMENT */);
}
value = arg1;
}
else if (shared.isNumber(arg1)) {
value = arg1;
}
else {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
if (shared.isString(arg2)) {
options.key = arg2;
}
else if (shared.isPlainObject(arg2)) {
options = arg2;
}
if (shared.isString(arg3)) {
options.locale = arg3;
}
else if (shared.isPlainObject(arg3)) {
orverrides = arg3;
}
if (shared.isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearDateTimeFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__datetimeFormatters.has(id)) {
continue;
}
context.__datetimeFormatters.delete(id);
}
}
// implementation of `number` function
/** @internal */
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { __numberFormatters } = context;
if ( !Availabilities.numberFormat) {
onWarn(getWarnMessage(2 /* CANNOT_FORMAT_NUMBER */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseNumberArgs(...args);
const missingWarn = shared.isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = shared.isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!shared.isString(key) || key === '') {
return new Intl.NumberFormat(locale).format(value);
}
// resolve format
let numberFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'number format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if (
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(3 /* FALLBACK_TO_NUMBER_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ( locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
numberFormat =
numberFormats[targetLocale] || {};
format = numberFormat[key];
if (shared.isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!shared.isPlainObject(format) || !shared.isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!shared.isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __numberFormatters.get(id);
if (!formatter) {
formatter = new Intl.NumberFormat(targetLocale, Object.assign({}, format, orverrides));
__numberFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseNumberArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
if (!shared.isNumber(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const value = arg1;
if (shared.isString(arg2)) {
options.key = arg2;
}
else if (shared.isPlainObject(arg2)) {
options = arg2;
}
if (shared.isString(arg3)) {
options.locale = arg3;
}
else if (shared.isPlainObject(arg3)) {
orverrides = arg3;
}
if (shared.isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearNumberFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__numberFormatters.has(id)) {
continue;
}
context.__numberFormatters.delete(id);
}
}
const DevToolsLabels = {
["vue-devtools-plugin-vue-i18n" /* PLUGIN */]: 'Vue I18n devtools',
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'I18n Resources',
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 'Vue I18n: Compile Errors',
["vue-i18n-missing" /* TIMELINE_MISSING */]: 'Vue I18n: Missing',
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 'Vue I18n: Fallback',
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 'Vue I18n: Performance'
};
const DevToolsPlaceholders = {
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'Search for scopes ...'
};
const DevToolsTimelineColors = {
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 0xff0000,
["vue-i18n-missing" /* TIMELINE_MISSING */]: 0xffcd19,
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 0xffcd19,
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 0xffcd19
};
const DevToolsTimelineLayerMaps = {
["compile-error" /* COMPILE_ERROR */]: "vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */,
["missing" /* MISSING */]: "vue-i18n-missing" /* TIMELINE_MISSING */,
["fallback" /* FALBACK */]: "vue-i18n-fallback" /* TIMELINE_FALLBACK */,
["message-resolve" /* MESSAGE_RESOLVE */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-compilation" /* MESSAGE_COMPILATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-evaluation" /* MESSAGE_EVALUATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */
};
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
* - code url: https://github.com/developit/mitt/blob/master/src/index.ts
* - author: Jason Miller (https://github.com/developit)
* - license: MIT
*/
/**
* Create a event emitter
*
* @returns An event emitter
*/
function createEmitter() {
const events = new Map();
const emitter = {
events,
on(event, handler) {
const handlers = events.get(event);
const added = handlers && handlers.push(handler);
if (!added) {
events.set(event, [handler]);
}
},
off(event, handler) {
const handlers = events.get(event);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
emit(event, payload) {
(events.get(event) || [])
.slice()
.map(handler => handler(payload));
(events.get('*') || [])
.slice()
.map(handler => handler(event, payload));
}
};
return emitter;
}
// register message compiler at @intlify/core
registerMessageCompiler(compileToFunction);
coreBase.registerMessageCompiler(coreBase.compileToFunction);
exports.DevToolsLabels = DevToolsLabels;
exports.DevToolsPlaceholders = DevToolsPlaceholders;
exports.DevToolsTimelineColors = DevToolsTimelineColors;
exports.DevToolsTimelineLayerMaps = DevToolsTimelineLayerMaps;
exports.MISSING_RESOLVE_VALUE = MISSING_RESOLVE_VALUE;
exports.NOT_REOSLVED = NOT_REOSLVED;
exports.clearCompileCache = clearCompileCache;
exports.clearDateTimeFormat = clearDateTimeFormat;
exports.clearNumberFormat = clearNumberFormat;
exports.compileToFunction = compileToFunction;
exports.createCoreContext = createCoreContext;
exports.createCoreError = createCoreError;
exports.createEmitter = createEmitter;
exports.datetime = datetime;
exports.errorMessages = errorMessages;
exports.getLocaleChain = getLocaleChain;
exports.getWarnMessage = getWarnMessage;
exports.handleMissing = handleMissing;
exports.isTranslateFallbackWarn = isTranslateFallbackWarn;
exports.isTranslateMissingWarn = isTranslateMissingWarn;
exports.number = number;
exports.parseDateTimeArgs = parseDateTimeArgs;
exports.parseNumberArgs = parseNumberArgs;
exports.parseTranslateArgs = parseTranslateArgs;
exports.registerMessageCompiler = registerMessageCompiler;
exports.translate = translate;
exports.updateFallbackLocale = updateFallbackLocale;
exports.warnMessages = warnMessages;
Object.keys(coreBase).forEach(function (k) {
if (k !== 'default') exports[k] = coreBase[k];
});
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi

@@ -10,754 +10,9 @@ * Released under the MIT License.

var shared = require('@intlify/shared');
var messageCompiler = require('@intlify/message-compiler');
var messageResolver = require('@intlify/message-resolver');
var runtime = require('@intlify/runtime');
var coreBase = require('@intlify/core-base');
/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return shared.format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (shared.isString(val) ? val.toUpperCase() : val),
lower: (val) => (shared.isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (shared.isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = shared.isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = shared.isArray(options.fallbackLocale) ||
shared.isPlainObject(options.fallbackLocale) ||
shared.isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = shared.isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = shared.isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = shared.isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = shared.isFunction(options.missing) ? options.missing : null;
const missingWarn = shared.isBoolean(options.missingWarn) || shared.isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = shared.isBoolean(options.fallbackWarn) || shared.isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = shared.isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = shared.isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = shared.isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = shared.isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = shared.isFunction(options.onWarn) ? options.onWarn : shared.warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = shared.isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = shared.isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
if (missing !== null) {
const ret = missing(context, locale, key, type);
return shared.isString(ret) ? ret : key;
}
else {
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (shared.isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = shared.isArray(fallback)
? fallback
: shared.isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = shared.isString(defaults) ? [defaults] : defaults;
if (shared.isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && shared.isBoolean(follow); i++) {
const locale = block[i];
if (shared.isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((shared.isArray(blocks) || shared.isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
const defaultOnCacheKey = (source) => source;
let compileCache = Object.create(null);
/** @internal */
function clearCompileCache() {
compileCache = Object.create(null);
}
/** @internal */
function compileToFunction(source, options = {}) {
{
// check caches
const onCacheKey = options.onCacheKey || defaultOnCacheKey;
const key = onCacheKey(source);
const cached = compileCache[key];
if (cached) {
return cached;
}
// compile error detecting
let occured = false;
const onError = options.onError || messageCompiler.defaultOnError;
options.onError = (err) => {
occured = true;
onError(err);
};
// compile
const { code } = messageCompiler.baseCompile(source, options);
// evaluate function
const msg = new Function(`return ${code}`)();
// if occured compile error, don't cache
return !occured ? (compileCache[key] = msg) : msg;
}
}
/** @internal */
function createCoreError(code) {
return messageCompiler.createCompileError(code, null, undefined);
}
/** @internal */
const errorMessages = {
[12 /* INVALID_ARGUMENT */]: 'Invalid arguments',
[13 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[14 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
};
const NOOP_MESSAGE_FUNCTION = () => '';
const isMessageFunction = (val) => shared.isFunction(val);
// implementationo of `translate` function
/** @internal */
function translate(context, ...args) {
const { fallbackFormat, postTranslation, unresolving, fallbackLocale } = context;
const [key, options] = parseTranslateArgs(...args);
const missingWarn = shared.isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = shared.isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const escapeParameter = shared.isBoolean(options.escapeParameter)
? options.escapeParameter
: context.escapeParameter;
// prettier-ignore
const defaultMsgOrKey = shared.isString(options.default) || shared.isBoolean(options.default) // default by function option
? !shared.isBoolean(options.default)
? options.default
: key
: fallbackFormat // default by `fallbackFormat` option
? key
: '';
const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';
const locale = shared.isString(options.locale) ? options.locale : context.locale;
// escape params
escapeParameter && escapeParams(options);
// resolve message format
// eslint-disable-next-line prefer-const
let [format, targetLocale, message] = resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn);
// if you use default message, set it as message format!
let cacheBaseKey = key;
if (!(shared.isString(format) || isMessageFunction(format))) {
if (enableDefaultMsg) {
format = defaultMsgOrKey;
cacheBaseKey = format;
}
}
// checking message format and target locale
if (!(shared.isString(format) || isMessageFunction(format)) ||
!shared.isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
// setup compile error detecting
let occured = false;
const errorDetector = () => {
occured = true;
};
// compile message format
const msg = compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector);
// if occured compile error, return the message format
if (occured) {
return format;
}
// evaluate message with context
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
const msgContext = runtime.createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);
// if use post translation option, procee it with handler
return postTranslation ? postTranslation(messaged) : messaged;
}
function escapeParams(options) {
if (shared.isArray(options.list)) {
options.list = options.list.map(item => shared.isString(item) ? shared.escapeHtml(item) : item);
}
else if (shared.isObject(options.named)) {
Object.keys(options.named).forEach(key => {
if (shared.isString(options.named[key])) {
options.named[key] = shared.escapeHtml(options.named[key]);
}
});
}
}
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn } = context;
const locales = getLocaleChain(context, fallbackLocale, locale);
let message = {};
let targetLocale;
let format = null;
let to = null;
const type = 'translate';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
message =
messages[targetLocale] || {};
if ((format = messageResolver.resolveValue(message, key)) === null) {
// if null, resolve with object key path
format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any
}
if (shared.isString(format) || shared.isFunction(format))
break;
const missingRet = handleMissing(context, key, targetLocale, missingWarn, type);
if (missingRet !== key) {
format = missingRet;
}
}
return [format, targetLocale, message];
}
function compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector) {
const { messageCompiler, warnHtmlMessage } = context;
if (isMessageFunction(format)) {
const msg = format;
msg.locale = msg.locale || targetLocale;
msg.key = msg.key || key;
return msg;
}
const msg = messageCompiler(format, getCompileOptions(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, errorDetector));
msg.locale = targetLocale;
msg.key = key;
msg.source = format;
return msg;
}
function evaluateMessage(context, msg, msgCtx) {
const messaged = msg(msgCtx);
return messaged;
}
/** @internal */
function parseTranslateArgs(...args) {
const [arg1, arg2, arg3] = args;
const options = {};
if (!shared.isString(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const key = arg1;
if (shared.isNumber(arg2)) {
options.plural = arg2;
}
else if (shared.isString(arg2)) {
options.default = arg2;
}
else if (shared.isPlainObject(arg2) && !shared.isEmptyObject(arg2)) {
options.named = arg2;
}
else if (shared.isArray(arg2)) {
options.list = arg2;
}
if (shared.isNumber(arg3)) {
options.plural = arg3;
}
else if (shared.isString(arg3)) {
options.default = arg3;
}
else if (shared.isPlainObject(arg3)) {
Object.assign(options, arg3);
}
return [key, options];
}
function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) {
return {
warnHtmlMessage,
onError: (err) => {
errorDetector && errorDetector(err);
{
throw err;
}
},
onCacheKey: (source) => shared.generateFormatCacheKey(locale, key, source)
};
}
function getMessageContextOptions(context, locale, message, options) {
const { modifiers, pluralRules } = context;
const resolveMessage = (key) => {
const val = messageResolver.resolveValue(message, key);
if (shared.isString(val)) {
let occured = false;
const errorDetector = () => {
occured = true;
};
const msg = compileMessasgeFormat(context, key, locale, val, key, errorDetector);
return !occured
? msg
: NOOP_MESSAGE_FUNCTION;
}
else if (isMessageFunction(val)) {
return val;
}
else {
// TODO: should be implemented warning message
return NOOP_MESSAGE_FUNCTION;
}
};
const ctxOptions = {
locale,
modifiers,
pluralRules,
messages: resolveMessage
};
if (context.processor) {
ctxOptions.processor = context.processor;
}
if (options.list) {
ctxOptions.list = options.list;
}
if (options.named) {
ctxOptions.named = options.named;
}
if (shared.isNumber(options.plural)) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
// implementation of `datetime` function
/** @internal */
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { __datetimeFormatters } = context;
const [key, value, options, orverrides] = parseDateTimeArgs(...args);
const missingWarn = shared.isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = shared.isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!shared.isString(key) || key === '') {
return new Intl.DateTimeFormat(locale).format(value);
}
// resolve format
let datetimeFormat = {};
let targetLocale;
let format = null;
let to = null;
const type = 'datetime format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
datetimeFormat =
datetimeFormats[targetLocale] || {};
format = datetimeFormat[key];
if (shared.isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
}
// checking format and target locale
if (!shared.isPlainObject(format) || !shared.isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!shared.isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __datetimeFormatters.get(id);
if (!formatter) {
formatter = new Intl.DateTimeFormat(targetLocale, Object.assign({}, format, orverrides));
__datetimeFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseDateTimeArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
let value;
if (shared.isString(arg1)) {
// Only allow ISO strings - other date formats are often supported,
// but may cause different results in different browsers.
if (!/\d{4}-\d{2}-\d{2}(T.*)?/.test(arg1)) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
value = new Date(arg1);
try {
// This will fail if the date is not valid
value.toISOString();
}
catch (e) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
}
else if (shared.isDate(arg1)) {
if (isNaN(arg1.getTime())) {
throw createCoreError(13 /* INVALID_DATE_ARGUMENT */);
}
value = arg1;
}
else if (shared.isNumber(arg1)) {
value = arg1;
}
else {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
if (shared.isString(arg2)) {
options.key = arg2;
}
else if (shared.isPlainObject(arg2)) {
options = arg2;
}
if (shared.isString(arg3)) {
options.locale = arg3;
}
else if (shared.isPlainObject(arg3)) {
orverrides = arg3;
}
if (shared.isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearDateTimeFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__datetimeFormatters.has(id)) {
continue;
}
context.__datetimeFormatters.delete(id);
}
}
// implementation of `number` function
/** @internal */
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { __numberFormatters } = context;
const [key, value, options, orverrides] = parseNumberArgs(...args);
const missingWarn = shared.isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = shared.isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!shared.isString(key) || key === '') {
return new Intl.NumberFormat(locale).format(value);
}
// resolve format
let numberFormat = {};
let targetLocale;
let format = null;
let to = null;
const type = 'number format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
numberFormat =
numberFormats[targetLocale] || {};
format = numberFormat[key];
if (shared.isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
}
// checking format and target locale
if (!shared.isPlainObject(format) || !shared.isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!shared.isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __numberFormatters.get(id);
if (!formatter) {
formatter = new Intl.NumberFormat(targetLocale, Object.assign({}, format, orverrides));
__numberFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseNumberArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
if (!shared.isNumber(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const value = arg1;
if (shared.isString(arg2)) {
options.key = arg2;
}
else if (shared.isPlainObject(arg2)) {
options = arg2;
}
if (shared.isString(arg3)) {
options.locale = arg3;
}
else if (shared.isPlainObject(arg3)) {
orverrides = arg3;
}
if (shared.isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearNumberFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__numberFormatters.has(id)) {
continue;
}
context.__numberFormatters.delete(id);
}
}
const DevToolsLabels = {
["vue-devtools-plugin-vue-i18n" /* PLUGIN */]: 'Vue I18n devtools',
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'I18n Resources',
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 'Vue I18n: Compile Errors',
["vue-i18n-missing" /* TIMELINE_MISSING */]: 'Vue I18n: Missing',
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 'Vue I18n: Fallback',
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 'Vue I18n: Performance'
};
const DevToolsPlaceholders = {
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'Search for scopes ...'
};
const DevToolsTimelineColors = {
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 0xff0000,
["vue-i18n-missing" /* TIMELINE_MISSING */]: 0xffcd19,
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 0xffcd19,
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 0xffcd19
};
const DevToolsTimelineLayerMaps = {
["compile-error" /* COMPILE_ERROR */]: "vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */,
["missing" /* MISSING */]: "vue-i18n-missing" /* TIMELINE_MISSING */,
["fallback" /* FALBACK */]: "vue-i18n-fallback" /* TIMELINE_FALLBACK */,
["message-resolve" /* MESSAGE_RESOLVE */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-compilation" /* MESSAGE_COMPILATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-evaluation" /* MESSAGE_EVALUATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */
};
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
* - code url: https://github.com/developit/mitt/blob/master/src/index.ts
* - author: Jason Miller (https://github.com/developit)
* - license: MIT
*/
/**
* Create a event emitter
*
* @returns An event emitter
*/
function createEmitter() {
const events = new Map();
const emitter = {
events,
on(event, handler) {
const handlers = events.get(event);
const added = handlers && handlers.push(handler);
if (!added) {
events.set(event, [handler]);
}
},
off(event, handler) {
const handlers = events.get(event);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
emit(event, payload) {
(events.get(event) || [])
.slice()
.map(handler => handler(payload));
(events.get('*') || [])
.slice()
.map(handler => handler(event, payload));
}
};
return emitter;
}
// register message compiler at @intlify/core
registerMessageCompiler(compileToFunction);
coreBase.registerMessageCompiler(coreBase.compileToFunction);
exports.DevToolsLabels = DevToolsLabels;
exports.DevToolsPlaceholders = DevToolsPlaceholders;
exports.DevToolsTimelineColors = DevToolsTimelineColors;
exports.DevToolsTimelineLayerMaps = DevToolsTimelineLayerMaps;
exports.MISSING_RESOLVE_VALUE = MISSING_RESOLVE_VALUE;
exports.NOT_REOSLVED = NOT_REOSLVED;
exports.clearCompileCache = clearCompileCache;
exports.clearDateTimeFormat = clearDateTimeFormat;
exports.clearNumberFormat = clearNumberFormat;
exports.compileToFunction = compileToFunction;
exports.createCoreContext = createCoreContext;
exports.createCoreError = createCoreError;
exports.createEmitter = createEmitter;
exports.datetime = datetime;
exports.errorMessages = errorMessages;
exports.getLocaleChain = getLocaleChain;
exports.getWarnMessage = getWarnMessage;
exports.handleMissing = handleMissing;
exports.isTranslateFallbackWarn = isTranslateFallbackWarn;
exports.isTranslateMissingWarn = isTranslateMissingWarn;
exports.number = number;
exports.parseDateTimeArgs = parseDateTimeArgs;
exports.parseNumberArgs = parseNumberArgs;
exports.parseTranslateArgs = parseTranslateArgs;
exports.registerMessageCompiler = registerMessageCompiler;
exports.translate = translate;
exports.updateFallbackLocale = updateFallbackLocale;
exports.warnMessages = warnMessages;
Object.keys(coreBase).forEach(function (k) {
if (k !== 'default') exports[k] = coreBase[k];
});

@@ -1,572 +0,4 @@

import type { CompileError } from '@intlify/message-compiler';
import type { CompileOptions } from '@intlify/message-compiler';
import type { LinkedModifiers } from '@intlify/runtime';
import type { MessageFunction } from '@intlify/runtime';
import type { MessageProcessor } from '@intlify/runtime';
import type { MessageType } from '@intlify/runtime';
import type { NamedValue } from '@intlify/runtime';
import type { Path } from '@intlify/message-resolver';
import type { PathValue } from '@intlify/message-resolver';
import type { PluralizationRules } from '@intlify/runtime';
/* Excluded from this release type: clearCompileCache */
export * from "@intlify/core-base";
/* Excluded from this release type: clearDateTimeFormat */
/* Excluded from this release type: clearNumberFormat */
/* Excluded from this release type: compileToFunction */
/* Excluded from this release type: CoreCommonContext */
/* Excluded from this release type: CoreContext */
/* Excluded from this release type: CoreDateTimeContext */
/* Excluded from this release type: CoreError */
/* Excluded from this release type: CoreErrorCodes */
/* Excluded from this release type: CoreInternalContext */
/* Excluded from this release type: CoreInternalOptions */
/* Excluded from this release type: CoreMissingHandler */
/* Excluded from this release type: CoreMissingType */
/* Excluded from this release type: CoreNumberContext */
/* Excluded from this release type: CoreOptions */
/* Excluded from this release type: CoreTranslationContext */
/* Excluded from this release type: CoreWarnCodes */
/* Excluded from this release type: createCoreContext */
/* Excluded from this release type: createCoreError */
/**
* Create a event emitter
*
* @returns An event emitter
*/
export declare function createEmitter<Events extends Record<EventType, unknown>>(): Emittable<Events>;
/**
* number
*/
export declare type CurrencyDisplay = 'symbol' | 'code' | 'name';
export declare interface CurrencyNumberFormatOptions extends Intl.NumberFormatOptions {
style: 'currency';
currency: string;
currencyDisplay?: CurrencyDisplay;
localeMatcher?: 'lookup' | 'best-fit';
formatMatcher?: 'basic' | 'best-fit';
}
/* Excluded from this release type: datetime */
export declare type DateTimeDigital = 'numeric' | '2-digit';
export declare type DateTimeFormat = {
[key: string]: DateTimeFormatOptions;
};
export declare type DateTimeFormatOptions = Intl.DateTimeFormatOptions | SpecificDateTimeFormatOptions;
export declare type DateTimeFormats = {
[locale: string]: DateTimeFormat;
};
/**
* datetime
*/
export declare type DateTimeHumanReadable = 'long' | 'short' | 'narrow';
/**
* # datetime
*
* ## usages:
* // for example `context.datetimeFormats` below
* 'en-US': {
* short: {
* year: 'numeric', month: '2-digit', day: '2-digit',
* hour: '2-digit', minute: '2-digit'
* }
* },
* 'ja-JP': { ... }
*
* // datetimeable value only
* datetime(context, value)
*
* // key argument
* datetime(context, value, 'short')
*
* // key & locale argument
* datetime(context, value, 'short', 'ja-JP')
*
* // object sytle argument
* datetime(context, value, { key: 'short', locale: 'ja-JP' })
*
* // suppress localize miss warning option, override context.missingWarn
* datetime(context, value, { key: 'short', locale: 'ja-JP', missingWarn: false })
*
* // suppress localize fallback warning option, override context.fallbackWarn
* datetime(context, value, { key: 'short', locale: 'ja-JP', fallbackWarn: false })
*
* // if you specify `part` options, you can get an array of objects containing the formatted datetime in parts
* datetime(context, value, { key: 'short', part: true })
*
* // orverride context.datetimeFormats[locale] options with functino options
* datetime(cnotext, value, 'short', { currency: 'EUR' })
* datetime(cnotext, value, 'short', 'ja-JP', { currency: 'EUR' })
* datetime(context, value, { key: 'short', part: true }, { currency: 'EUR'})
*/
/**
* DateTime options
*
* @remarks
* Options for Datetime formatting API
*
* @VueI18nGeneral
*/
export declare interface DateTimeOptions {
/**
* @remarks
* The target format key
*/
key?: string;
/**
* @remarks
* The locale of localization
*/
locale?: Locale;
/**
* @remarks
* Whether suppress warnings outputted when localization fails
*/
missingWarn?: boolean;
/**
* @remarks
* Whether do resolve on format keys when your language lacks a formatting for a key
*/
fallbackWarn?: boolean;
/**
* @remarks
* Whether to use [Intel.DateTimeForrmat#formatToParts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts)
*/
part?: boolean;
}
export declare type DevToolsEmitter = Emittable<DevToolsEmitterEvents>;
export declare type DevToolsEmitterEvents = {
[DevToolsTimelineEvents.COMPILE_ERROR]: DevToolsTimelineEventPayloads[DevToolsTimelineEvents.COMPILE_ERROR];
[DevToolsTimelineEvents.MISSING]: DevToolsTimelineEventPayloads[DevToolsTimelineEvents.MISSING];
[DevToolsTimelineEvents.FALBACK]: DevToolsTimelineEventPayloads[DevToolsTimelineEvents.FALBACK];
[DevToolsTimelineEvents.MESSAGE_RESOLVE]: DevToolsTimelineEventPayloads[DevToolsTimelineEvents.MESSAGE_RESOLVE];
[DevToolsTimelineEvents.MESSAGE_COMPILATION]: DevToolsTimelineEventPayloads[DevToolsTimelineEvents.MESSAGE_COMPILATION];
[DevToolsTimelineEvents.MESSAGE_EVALUATION]: DevToolsTimelineEventPayloads[DevToolsTimelineEvents.MESSAGE_EVALUATION];
};
export declare const enum DevToolsIDs {
PLUGIN = "vue-devtools-plugin-vue-i18n",
CUSTOM_INSPECTOR = "vue-i18n-resource-inspector",
TIMELINE_COMPILE_ERROR = "vue-i18n-compile-error",
TIMELINE_MISSING = "vue-i18n-missing",
TIMELINE_FALLBACK = "vue-i18n-fallback",
TIMELINE_PERFORMANCE = "vue-i18n-performance"
}
export declare const DevToolsLabels: Record<string, string>;
export declare const DevToolsPlaceholders: Record<string, string>;
export declare const DevToolsTimelineColors: Record<string, number>;
export declare type DevToolsTimelineEventPayloads = {
[DevToolsTimelineEvents.COMPILE_ERROR]: {
message: PathValue;
error: string;
start?: number;
end?: number;
};
[DevToolsTimelineEvents.MISSING]: {
locale: Locale;
key: Path;
type: CoreMissingType;
};
[DevToolsTimelineEvents.FALBACK]: {
key: Path;
type: CoreMissingType;
from?: Locale;
to: Locale | 'global';
};
[DevToolsTimelineEvents.MESSAGE_RESOLVE]: {
type: DevToolsTimelineEvents.MESSAGE_RESOLVE;
key: Path;
message: PathValue;
time: number;
};
[DevToolsTimelineEvents.MESSAGE_COMPILATION]: {
type: DevToolsTimelineEvents.MESSAGE_COMPILATION;
message: PathValue;
time: number;
};
[DevToolsTimelineEvents.MESSAGE_EVALUATION]: {
type: DevToolsTimelineEvents.MESSAGE_EVALUATION;
value: unknown;
time: number;
};
};
export declare const enum DevToolsTimelineEvents {
COMPILE_ERROR = "compile-error",
MISSING = "missing",
FALBACK = "fallback",
MESSAGE_RESOLVE = "message-resolve",
MESSAGE_COMPILATION = "message-compilation",
MESSAGE_EVALUATION = "message-evaluation"
}
export declare const DevToolsTimelineLayerMaps: Record<string, string>;
/**
* Event emitter interface
*/
export declare interface Emittable<Events extends Record<EventType, unknown> = {}> {
/**
* A map of event names of registered event handlers
*/
events: EventHandlerMap<Events>;
/**
* Register an event handler with the event type
*
* @param event - An {@link EventType}
* @param handler - An {@link EventHandler}, or a {@link WildcardEventHandler} if you are specified "*"
*/
on<Key extends keyof Events>(event: Key | '*', handler: EventHandler<Events[keyof Events]> | WildcardEventHandler<Events>): void;
/**
* Unregister an event handler for the event type
*
* @param event - An {@link EventType}
* @param handler - An {@link EventHandler}, or a {@link WildcardEventHandler} if you are specified "*"
*/
off<Key extends keyof Events>(event: Key | '*', handler: EventHandler<Events[keyof Events]> | WildcardEventHandler<Events>): void;
/**
* Invoke all handlers with the event type
*
* @remarks
* Note Manually firing "*" handlers should be not supported
*
* @param event - An {@link EventType}
* @param payload - An event payload, optional
*/
emit<Key extends keyof Events>(event: Key, payload?: Events[keyof Events]): void;
}
/* Excluded from this release type: errorMessages */
/**
* Event handler
*/
export declare type EventHandler<T = unknown> = (payload?: T) => void;
/**
* Event handler list
*/
export declare type EventHandlerList<T = unknown> = Array<EventHandler<T>>;
/**
* Event handler map
*/
export declare type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<keyof Events | '*', EventHandlerList<Events[keyof Events]> | WildcardEventHandlerList<Events>>;
/**
* Event type
*/
export declare type EventType = string | symbol;
/** @VueI18nGeneral */
export declare type FallbackLocale = Locale | Locale[] | {
[locale in string]: Locale[];
} | false;
export declare type FormattedNumberPart = {
type: FormattedNumberPartType;
value: string;
};
export declare type FormattedNumberPartType = 'currency' | 'decimal' | 'fraction' | 'group' | 'infinity' | 'integer' | 'literal' | 'minusSign' | 'nan' | 'plusSign' | 'percentSign';
/* Excluded from this release type: getLocaleChain */
/* Excluded from this release type: getWarnMessage */
/* Excluded from this release type: handleMissing */
/* Excluded from this release type: isTranslateFallbackWarn */
/* Excluded from this release type: isTranslateMissingWarn */
/** @VueI18nGeneral */
export declare type Locale = string;
/** @VueI18nGeneral */
export declare interface LocaleMessageArray<Message = string> extends Array<LocaleMessageValue<Message>> {
}
/** @VueI18nGeneral */
export declare type LocaleMessageDictionary<Message = string> = {
[property: string]: LocaleMessageValue<Message>;
};
/** @VueI18nGeneral */
export declare type LocaleMessages<Message = string> = Record<Locale, LocaleMessageDictionary<Message>>;
/** @VueI18nGeneral */
export declare type LocaleMessageValue<Message = string> = string | MessageFunction<Message> | LocaleMessageDictionary<Message> | LocaleMessageArray<Message>;
/* Excluded from this release type: MessageCompiler */
/* Excluded from this release type: MISSING_RESOLVE_VALUE */
/* Excluded from this release type: NOT_REOSLVED */
/* Excluded from this release type: number */
export declare type NumberFormat = {
[key: string]: NumberFormatOptions;
};
export declare type NumberFormatOptions = Intl.NumberFormatOptions | SpecificNumberFormatOptions | CurrencyNumberFormatOptions;
export declare type NumberFormats = {
[locale: string]: NumberFormat;
};
export declare type NumberFormatToPartsResult = {
[index: number]: FormattedNumberPart;
};
/**
* # number
*
* ## usages
* // for example `context.numberFormats` below
* 'en-US': {
* 'currency': {
* style: 'currency', currency: 'USD', currencyDisplay: 'symbol'
* }
* },
* 'ja-JP: { ... }
*
* // value only
* number(context, value)
*
* // key argument
* number(context, value, 'currency')
*
* // key & locale argument
* number(context, value, 'currency', 'ja-JP')
*
* // object sytle argument
* number(context, value, { key: 'currency', locale: 'ja-JP' })
*
* // suppress localize miss warning option, override context.missingWarn
* number(context, value, { key: 'currency', locale: 'ja-JP', missingWarn: false })
*
* // suppress localize fallback warning option, override context.fallbackWarn
* number(context, value, { key: 'currency', locale: 'ja-JP', fallbackWarn: false })
*
* // if you specify `part` options, you can get an array of objects containing the formatted number in parts
* number(context, value, { key: 'currenty', part: true })
*
* // orverride context.numberFormats[locale] options with functino options
* number(cnotext, value, 'currency', { year: '2-digit' })
* number(cnotext, value, 'currency', 'ja-JP', { year: '2-digit' })
* number(context, value, { key: 'currenty', part: true }, { year: '2-digit'})
*/
/**
* Number Options
*
* @remarks
* Options for Number formatting API
*
* @VueI18nGeneral
*/
export declare interface NumberOptions {
/**
* @remarks
* The target format key
*/
key?: string;
/**
* @remarks
* The locale of localization
*/
locale?: Locale;
/**
* @remarks
* Whether suppress warnings outputted when localization fails
*/
missingWarn?: boolean;
/**
* @remarks
* Whether do resolve on format keys when your language lacks a formatting for a key
*/
fallbackWarn?: boolean;
/**
* @remarks
* Whether to use [Intel.NumberForrmat#formatToParts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts)
*/
part?: boolean;
}
/* Excluded from this release type: parseDateTimeArgs */
/* Excluded from this release type: parseNumberArgs */
/* Excluded from this release type: parseTranslateArgs */
/** @VueI18nGeneral */
export declare type PostTranslationHandler<Message = string> = (translated: MessageType<Message>) => MessageType<Message>;
/* Excluded from this release type: registerMessageCompiler */
export declare interface SpecificDateTimeFormatOptions extends Intl.DateTimeFormatOptions {
year?: DateTimeDigital;
month?: DateTimeDigital | DateTimeHumanReadable;
day?: DateTimeDigital;
hour?: DateTimeDigital;
minute?: DateTimeDigital;
second?: DateTimeDigital;
weekday?: DateTimeHumanReadable;
era?: DateTimeHumanReadable;
timeZoneName?: 'long' | 'short';
localeMatcher?: 'lookup' | 'best-fit';
formatMatcher?: 'basic' | 'best-fit';
}
export declare interface SpecificNumberFormatOptions extends Intl.NumberFormatOptions {
style?: 'decimal' | 'percent';
currency?: string;
currencyDisplay?: CurrencyDisplay;
localeMatcher?: 'lookup' | 'best-fit';
formatMatcher?: 'basic' | 'best-fit';
}
/* Excluded from this release type: translate */
/**
* # translate
*
* ## usages:
* // for example, locale messages key
* { 'foo.bar': 'hi {0} !' or 'hi {name} !' }
*
* // no argument, context & path only
* translate(context, 'foo.bar')
*
* // list argument
* translate(context, 'foo.bar', ['kazupon'])
*
* // named argument
* translate(context, 'foo.bar', { name: 'kazupon' })
*
* // plural choice number
* translate(context, 'foo.bar', 2)
*
* // plural choice number with name argument
* translate(context, 'foo.bar', { name: 'kazupon' }, 2)
*
* // default message argument
* translate(context, 'foo.bar', 'this is default message')
*
* // default message with named argument
* translate(context, 'foo.bar', { name: 'kazupon' }, 'Hello {name} !')
*
* // use key as default message
* translate(context, 'hi {0} !', ['kazupon'], { default: true })
*
* // locale option, override context.locale
* translate(context, 'foo.bar', { name: 'kazupon' }, { locale: 'ja' })
*
* // suppress localize miss warning option, override context.missingWarn
* translate(context, 'foo.bar', { name: 'kazupon' }, { missingWarn: false })
*
* // suppress localize fallback warning option, override context.fallbackWarn
* translate(context, 'foo.bar', { name: 'kazupon' }, { fallbackWarn: false })
*
* // escape parameter option, override context.escapeParameter
* translate(context, 'foo.bar', { name: 'kazupon' }, { escapeParameter: true })
*/
/**
* Translate Options
*
* @remarks
* Options for Translation API
*
* @VueI18nGeneral
*/
export declare interface TranslateOptions {
/**
* @remarks
* List interpolation
*/
list?: unknown[];
/**
* @remarks
* Named interpolation
*/
named?: NamedValue;
/**
* @remarks
* Plulralzation choice number
*/
plural?: number;
/**
* @remarks
* Default message when is occured translation missing
*/
default?: string | boolean;
/**
* @remarks
* The locale of localization
*/
locale?: Locale;
/**
* @remarks
* Whether suppress warnings outputted when localization fails
*/
missingWarn?: boolean;
/**
* @remarks
* Whether do template interpolation on translation keys when your language lacks a translation for a key
*/
fallbackWarn?: boolean;
/**
* @remarks
* Whether do escape parameter for list or named interpolation values
*/
escapeParameter?: boolean;
}
/* Excluded from this release type: updateFallbackLocale */
/* Excluded from this release type: warnMessages */
/**
* Wildcard event handler
*/
export declare type WildcardEventHandler<T = Record<string, unknown>> = (event: keyof T, payload?: T[keyof T]) => void;
/**
* Wildcard event handler list
*/
export declare type WildcardEventHandlerList<T = Record<string, unknown>> = Array<WildcardEventHandler<T>>;
export { }

4

dist/core.esm-browser.prod.js
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===m(e),o=e=>d(e)&&0===Object.keys(e).length;function c(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function s(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const a=Array.isArray,u=e=>"function"==typeof e,i=e=>"string"==typeof e,l=e=>"boolean"==typeof e,f=e=>null!==e&&"object"==typeof e,p=Object.prototype.toString,m=e=>p.call(e),d=e=>"[object Object]"===m(e),h={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function k(t,...n){return function(t,...n){return 1===n.length&&f(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(h[t],...n)}const g=-1,b="";let y;function v(e){y=e}function x(e={}){const t=i(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:a(e.fallbackLocale)||d(e.fallbackLocale)||i(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:d(e.messages)?e.messages:{[t]:{}},datetimeFormats:d(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:d(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>i(e)?e.toUpperCase():e,lower:e=>i(e)?e.toLowerCase():e,capitalize:e=>i(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:u(e.missing)?e.missing:null,missingWarn:!l(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,fallbackWarn:!l(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:u(e.postTranslation)?e.postTranslation:null,processor:d(e.processor)?e.processor:null,warnHtmlMessage:!l(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:u(e.messageCompiler)?e.messageCompiler:y,onWarn:u(e.onWarn)?e.onWarn:c,__datetimeFormatters:f(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:f(n.__numberFormatters)?n.__numberFormatters:new Map}}function w(e,t){return e instanceof RegExp?e.test(t):e}function _(e,t){return e instanceof RegExp?e.test(t):e}function C(e,t,n,r,o){const{missing:c}=e;if(null!==c){const r=c(e,n,t,o);return i(r)?r:t}return t}function T(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;a(e);)e=L(o,e,t);const c=a(t)?t:d(t)?t.default?t.default:null:t;e=i(c)?[c]:c,a(e)&&L(o,e,!1),r.__localeChainCache.set(n,o)}return o}function L(e,t,n){let r=!0;for(let o=0;o<t.length&&l(r);o++){i(t[o])&&(r=P(e,t[o],n))}return r}function P(e,t,n){let r;const o=t.split("-");do{r=O(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function O(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),(a(n)||d(n))&&n[o]&&(r=n[o])}return r}function F(e,t,n){e.__localeChainCache=new Map,T(e,n,t)}function $(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function N(e){throw e}function S(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const I=String.fromCharCode(8232),E=String.fromCharCode(8233);function j(e){const t=e;let n=0,r=1,o=1,c=0;const s=e=>"\r"===t[e]&&"\n"===t[e+1],a=e=>t[e]===E,u=e=>t[e]===I,i=e=>s(e)||(e=>"\n"===t[e])(e)||a(e)||u(e),l=e=>s(e)||a(e)||u(e)?"\n":t[e];function f(){return c=0,i(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>c,charAt:l,currentChar:()=>l(n),currentPeek:()=>l(n+c),next:f,peek:function(){return s(n+c)&&c++,c++,t[n+c]},reset:function(){n=0,r=1,o=1,c=0},resetPeek:function(e=0){c=e},skipToPeek:function(){const e=n+c;for(;e!==n;)f();c=0}}}const M=void 0;function W(e,t={}){const n=!t.location,r=j(e),o=()=>r.index(),c=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=c(),a=o(),u={currentType:14,offset:a,startLoc:s,endLoc:s,lastType:14,lastOffset:a,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},i=()=>u,{onError:l}=t;function f(e,t,r){e.endLoc=c(),e.currentType=t;const o={type:t};return n&&(o.loc=S(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(c(),"")}function d(e){let t="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===M)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===M)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const c=e.currentPeek();return"{"===c?"%"!==r&&t:"@"!==c&&c?"%"===c?(e.peek(),n(t,"%",!0)):"|"===c?!("%"!==r&&!o)||!(" "===r||"\n"===r):" "===c?(e.peek(),n(!0," ",o)):"\n"!==c||(e.peek(),n(!0,"\n",o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function v(e,t){const n=e.currentChar();return n===M?M:t(n)?(e.next(),n):null}function x(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function w(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function _(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function C(e){let t="",n="";for(;t=w(e);)n+=t;return n}function T(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return L(e,t,4);case"U":return L(e,t,6);default:return c(),""}}function L(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=_(e);if(!t){c(),e.currentChar();break}r+=t}return`\\${t}${r}`}function P(e){h(e);const t=m(e,"|");return h(e),t}function O(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&c(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&c(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&c(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(b(e))return t.braceNest>0&&c(),n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return c(),t.braceNest=0,$(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=x(e);)n+=t;return e.currentChar()===M&&c(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${C(e)}`):t+=C(e),e.currentChar()===M&&c(),t}(e)),h(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&"\n"!==e;for(;t=v(e,r);)n+="\\"===t?T(e):t;const o=e.currentChar();return"\n"===o||o===M?(c(),"\n"===o&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;t=v(e,r);)n+=t;return n}(e)),c(),h(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||"\n"!==o&&" "!==o||c(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=x(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||" "===t||!t)&&("\n"===t?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?O(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?" "===o?r:"\n"===o?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&c(),t.braceNest=0,t.inLinked=!1,$(e,t))}}function $(e,t){let n={type:14};if(t.braceNest>0)return O(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return O(e,t)||p(t);case"}":return c(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(b(e))return n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:" "===r||"\n"===r?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=s,u.offset=o(),u.startLoc=c(),r.currentChar()===M?f(u,14):$(r,u)},currentOffset:o,currentPosition:c,context:i}}const A=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function R(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function J(e={}){const t=!e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function c(e,t){const n=e.context(),c=r(3,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}function s(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(5,c,s);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function a(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(4,c,s);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(9,c,s);return a.value=t.replace(A,R),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let c=e.nextToken();switch(9===c.type&&(n.modifier=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(8,c,s);return a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),a}(e),c=e.nextToken()),c=e.nextToken(),2===c.type&&(c=e.nextToken()),c.type){case 11:n.key=function(e,t){const n=e.context(),c=r(7,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}(e,c.value||"");break;case 5:n.key=a(e,c.value||"");break;case 6:n.key=s(e,c.value||"");break;case 7:n.key=u(e,c.value||"")}return o(n,e.currentOffset(),e.currentPosition()),n}function l(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];do{const t=e.nextToken();switch(t.type){case 0:n.items.push(c(e,t.value||""));break;case 6:n.items.push(s(e,t.value||""));break;case 5:n.items.push(a(e,t.value||""));break;case 7:n.items.push(u(e,t.value||""));break;case 8:n.items.push(i(e))}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function f(e){const t=e.context(),{offset:n,startLoc:c}=t,s=l(e);return 14===t.currentType?s:function(e,t,n,c){const s=e.context();let a=0===c.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(c);do{const t=l(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==s.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,c,s)}return{parse:function(n){const c=W(n,{...e}),s=c.context(),a=r(0,s.offset,s.startLoc);return t&&a.loc&&(a.loc.source=n),a.body=f(c),o(a,c.currentOffset(),c.currentPosition()),a}}}function z(e,t){for(let n=0;n<e.length;n++)D(e[n],t)}function D(e,t){switch(e.type){case 1:z(e.cases,t),t.helper("plural");break;case 2:z(e.items,t);break;case 6:D(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function H(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&D(e.body,n);const r=n.context();e.helpers=[...r.helpers]}function U(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?U(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent();const r=t.cases.length;for(let n=0;n<r&&(U(e,t.cases[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n}=e;e.push(`${n("normalize")}([`),e.indent();const r=t.items.length;for(let n=0;n<r&&(U(e,t.items[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),U(e,t.key),t.modifier&&(e.push(", "),U(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function V(e,t={}){const n=J({...t}).parse(e);return H(n,{...t}),((e,t={})=>{const n=i(t.mode)?t.mode:"normal",r=i(t.filename)?t.filename:"message.intl",o=!!l(t.sourceMap)&&t.sourceMap,c=e.helpers||[],s=function(e,t){const{filename:n}=t,r={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,indentLevel:0};function o(e,t){r.code+=e}function c(e){o("\n"+" ".repeat(e))}return{context:()=>r,push:o,indent:function(){c(++r.indentLevel)},deindent:function(e){e?--r.indentLevel:c(--r.indentLevel)},newline:function(){c(r.indentLevel)},helper:e=>`_${e}`}}(e,{mode:n,filename:r,sourceMap:o});s.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),s.indent(),c.length>0&&(s.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),s.newline()),s.push("return "),U(s,e),s.deindent(),s.push("}");const{code:a,map:u}=s.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(n,{...t})}const K=e=>e;let q=Object.create(null);function Z(){q=Object.create(null)}function B(e,t={}){{const n=(t.onCacheKey||K)(e),r=q[n];if(r)return r;let o=!1;const c=t.onError||N;t.onError=e=>{o=!0,c(e)};const{code:s}=V(e,t),a=new Function(`return ${s}`)();return o?a:q[n]=a}}const G=[];G[0]={w:[0],i:[3,0],"[":[4],o:[7]},G[1]={w:[1],".":[2],"[":[4],o:[7]},G[2]={w:[2],i:[3,0],0:[3,0]},G[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},G[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},G[5]={"'":[4,0],o:8,l:[5,0]},G[6]={'"':[4,0],o:8,l:[6,0]};const Q=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function X(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 Y(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(Q.test(t)?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)}const ee=new Map;function te(e,t){if(!f(e))return null;let n=ee.get(t);if(n||(n=function(e){const t=[];let n,r,o,c,s,a,u,i=-1,l=0,f=0;const p=[];function m(){const t=e[i+1];if(5===l&&"'"===t||6===l&&'"'===t)return i++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,l=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=Y(r),!1===r)return!1;p[1]()}};null!==l;)if(i++,n=e[i],"\\"!==n||!m()){if(c=X(n),u=G[l],s=u[c]||u.l||8,8===s)return;if(l=s[0],void 0!==s[1]&&(a=p[s[1]],a&&(o=n,!1===a())))return;if(7===l)return t}}(t),n&&ee.set(t,n)),!n)return null;const r=n.length;let o=e,c=0;for(;c<r;){const e=o[n[c]];if(void 0===e)return null;o=e,c++}return o}const ne=e=>e,re=e=>"",oe=e=>0===e.length?"":e.join(""),ce=e=>null==e?"":a(e)||d(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function se(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function ae(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=f(e.pluralRules)&&i(t)&&u(e.pluralRules[t])?e.pluralRules[t]:se,c=f(e.pluralRules)&&i(t)&&u(e.pluralRules[t])?se:void 0,s=e.list||[],a=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,a);function l(t){const n=u(e.messages)?e.messages(t):!!f(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):re)}const p=d(e.processor)&&u(e.processor.normalize)?e.processor.normalize:oe,m=d(e.processor)&&u(e.processor.interpolate)?e.processor.interpolate:ce,h={list:e=>s[e],named:e=>a[e],plural:e=>e[o(r,e.length,c)],linked:(t,n)=>{const r=l(t)(h);return i(n)?(o=n,e.modifiers?e.modifiers[o]:ne)(r):r;var o},message:l,type:d(e.processor)&&i(e.processor.type)?e.processor.type:"text",interpolate:m,normalize:p};return h}function ue(e){return $(e,null,void 0)}const ie={12:"Invalid arguments",13:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",14:"The argument provided is not a valid ISO date string"},le=()=>"",fe=e=>u(e);function pe(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:c,fallbackLocale:p}=e,[m,d]=de(...t),h=(l(d.missingWarn),l(d.fallbackWarn),l(d.escapeParameter)?d.escapeParameter:e.escapeParameter),k=i(d.default)||l(d.default)?l(d.default)?m:d.default:r?m:"",g=r||""!==k,b=i(d.locale)?d.locale:e.locale;h&&function(e){a(e.list)?e.list=e.list.map((e=>i(e)?s(e):e)):f(e.named)&&Object.keys(e.named).forEach((t=>{i(e.named[t])&&(e.named[t]=s(e.named[t]))}))}(d);let[y,v,x]=function(e,t,n,r,o,c){const{messages:s}=e,a=T(e,r,n);let l,f={},p=null,m=null;const d="translate";for(let n=0;n<a.length&&(l=m=a[n],f=s[l]||{},null===(p=te(f,t))&&(p=f[t]),!i(p)&&!u(p));n++){const n=C(e,t,l,0,d);n!==t&&(p=n)}return[p,l,f]}(e,m,b,p),w=m;if(i(y)||fe(y)||g&&(y=k,w=y),!i(y)&&!fe(y)||!i(v))return c?-1:m;let _=!1;const L=me(e,m,v,y,w,(()=>{_=!0}));if(_)return y;const P=function(e,t,n){return t(n)}(0,L,ae(function(e,t,r,o){const{modifiers:c,pluralRules:s}=e,a={locale:t,modifiers:c,pluralRules:s,messages:n=>{const o=te(r,n);if(i(o)){let r=!1;const c=me(e,n,t,o,n,(()=>{r=!0}));return r?le:c}return fe(o)?o:le}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);n(o.plural)&&(a.pluralIndex=o.plural);return a}(e,v,x,d)));return o?o(P):P}function me(e,n,r,o,c,s){const{messageCompiler:a,warnHtmlMessage:u}=e;if(fe(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const i=a(o,function(e,n,r,o,c,s){return{warnHtmlMessage:c,onError:e=>{throw s&&s(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,c,0,u,s));return i.locale=r,i.key=n,i.source=o,i}function de(...e){const[t,r,c]=e,s={};if(!i(t))throw Error(12);const u=t;return n(r)?s.plural=r:i(r)?s.default=r:d(r)&&!o(r)?s.named=r:a(r)&&(s.list=r),n(c)?s.plural=c:i(c)?s.default=c:d(c)&&Object.assign(s,c),[u,s]}function he(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:c}=e,{__datetimeFormatters:s}=e,[a,u,f,p]=ke(...t),m=(l(f.missingWarn),l(f.fallbackWarn),!!f.part),h=i(f.locale)?f.locale:e.locale,k=T(e,c,h);if(!i(a)||""===a)return new Intl.DateTimeFormat(h).format(u);let g,b={},y=null,v=null;for(let t=0;t<k.length&&(g=v=k[t],b=n[g]||{},y=b[a],!d(y));t++)C(e,a,g,0,"datetime format");if(!d(y)||!i(g))return r?-1:a;let x=`${g}__${a}`;o(p)||(x=`${x}__${JSON.stringify(p)}`);let w=s.get(x);return w||(w=new Intl.DateTimeFormat(g,Object.assign({},y,p)),s.set(x,w)),m?w.formatToParts(u):w.format(u)}function ke(...e){const[t,r,o,c]=e;let s,a={},u={};if(i(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);s=new Date(t);try{s.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===m(t)){if(isNaN(t.getTime()))throw Error(13);s=t}else{if(!n(t))throw Error(12);s=t}return i(r)?a.key=r:d(r)&&(a=r),i(o)?a.locale=o:d(o)&&(u=o),d(c)&&(u=c),[a.key||"",s,a,u]}function ge(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function be(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:c}=e,{__numberFormatters:s}=e,[a,u,f,p]=ye(...t),m=(l(f.missingWarn),l(f.fallbackWarn),!!f.part),h=i(f.locale)?f.locale:e.locale,k=T(e,c,h);if(!i(a)||""===a)return new Intl.NumberFormat(h).format(u);let g,b={},y=null,v=null;for(let t=0;t<k.length&&(g=v=k[t],b=n[g]||{},y=b[a],!d(y));t++)C(e,a,g,0,"number format");if(!d(y)||!i(g))return r?-1:a;let x=`${g}__${a}`;o(p)||(x=`${x}__${JSON.stringify(p)}`);let w=s.get(x);return w||(w=new Intl.NumberFormat(g,Object.assign({},y,p)),s.set(x,w)),m?w.formatToParts(u):w.format(u)}function ye(...e){const[t,r,o,c]=e;let s={},a={};if(!n(t))throw Error(12);const u=t;return i(r)?s.key=r:d(r)&&(s=r),i(o)?s.locale=o:d(o)&&(a=o),d(c)&&(a=c),[s.key||"",u,s,a]}function ve(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}const xe={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},we={"vue-i18n-resource-inspector":"Search for scopes ..."},_e={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},Ce={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};function Te(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}}v(B);export{xe as DevToolsLabels,we as DevToolsPlaceholders,_e as DevToolsTimelineColors,Ce as DevToolsTimelineLayerMaps,b as MISSING_RESOLVE_VALUE,g as NOT_REOSLVED,Z as clearCompileCache,ge as clearDateTimeFormat,ve as clearNumberFormat,B as compileToFunction,x as createCoreContext,ue as createCoreError,Te as createEmitter,he as datetime,ie as errorMessages,T as getLocaleChain,k as getWarnMessage,C as handleMissing,w as isTranslateFallbackWarn,_ as isTranslateMissingWarn,be as number,ke as parseDateTimeArgs,ye as parseNumberArgs,de as parseTranslateArgs,v as registerMessageCompiler,pe as translate,F as updateFallbackLocale,h as warnMessages};
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===m(e),o=e=>d(e)&&0===Object.keys(e).length;function c(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function s(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const a=Array.isArray,u=e=>"function"==typeof e,l=e=>"string"==typeof e,i=e=>"boolean"==typeof e,f=e=>null!==e&&"object"==typeof e,p=Object.prototype.toString,m=e=>p.call(e),d=e=>"[object Object]"===m(e),h=[];h[0]={w:[0],i:[3,0],"[":[4],o:[7]},h[1]={w:[1],".":[2],"[":[4],o:[7]},h[2]={w:[2],i:[3,0],0:[3,0]},h[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},h[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},h[5]={"'":[4,0],o:8,l:[5,0]},h[6]={'"':[4,0],o:8,l:[6,0]};const k=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function g(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 b(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(k.test(t)?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)}function y(e){const t=[];let n,r,o,c,s,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=b(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(c=g(n),u=h[i],s=u[c]||u.l||8,8===s)return;if(i=s[0],void 0!==s[1]&&(a=p[s[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const x=new Map;function v(e,t){if(!f(e))return null;let n=x.get(t);if(n||(n=y(t),n&&x.set(t,n)),!n)return null;const r=n.length;let o=e,c=0;for(;c<r;){const e=o[n[c]];if(void 0===e)return null;o=e,c++}return o}const w=e=>e,_=e=>"",C="text",L=e=>0===e.length?"":e.join(""),P=e=>null==e?"":a(e)||d(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function T(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function O(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=f(e.pluralRules)&&l(t)&&u(e.pluralRules[t])?e.pluralRules[t]:T,c=f(e.pluralRules)&&l(t)&&u(e.pluralRules[t])?T:void 0,s=e.list||[],a=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,a);function i(t){const n=u(e.messages)?e.messages(t):!!f(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):_)}const p=d(e.processor)&&u(e.processor.normalize)?e.processor.normalize:L,m=d(e.processor)&&u(e.processor.interpolate)?e.processor.interpolate:P,h={list:e=>s[e],named:e=>a[e],plural:e=>e[o(r,e.length,c)],linked:(t,n)=>{const r=i(t)(h);return l(n)?(o=n,e.modifiers?e.modifiers[o]:w)(r):r;var o},message:i,type:d(e.processor)&&l(e.processor.type)?e.processor.type:"text",interpolate:m,normalize:p};return h}function F(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function $(e){throw e}function N(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const S=String.fromCharCode(8232),E=String.fromCharCode(8233);function I(e){const t=e;let n=0,r=1,o=1,c=0;const s=e=>"\r"===t[e]&&"\n"===t[e+1],a=e=>t[e]===E,u=e=>t[e]===S,l=e=>s(e)||(e=>"\n"===t[e])(e)||a(e)||u(e),i=e=>s(e)||a(e)||u(e)?"\n":t[e];function f(){return c=0,l(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>c,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+c),next:f,peek:function(){return s(n+c)&&c++,c++,t[n+c]},reset:function(){n=0,r=1,o=1,c=0},resetPeek:function(e=0){c=e},skipToPeek:function(){const e=n+c;for(;e!==n;)f();c=0}}}const j=void 0;function M(e,t={}){const n=!t.location,r=I(e),o=()=>r.index(),c=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=c(),a=o(),u={currentType:14,offset:a,startLoc:s,endLoc:s,lastType:14,lastOffset:a,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=c(),e.currentType=t;const o={type:t};return n&&(o.loc=N(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(c(),"")}function d(e){let t="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===j)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===j)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const c=e.currentPeek();return"{"===c?"%"!==r&&t:"@"!==c&&c?"%"===c?(e.peek(),n(t,"%",!0)):"|"===c?!("%"!==r&&!o)||!(" "===r||"\n"===r):" "===c?(e.peek(),n(!0," ",o)):"\n"!==c||(e.peek(),n(!0,"\n",o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function x(e,t){const n=e.currentChar();return n===j?j:t(n)?(e.next(),n):null}function v(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function w(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function _(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function C(e){let t="",n="";for(;t=w(e);)n+=t;return n}function L(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return P(e,t,4);case"U":return P(e,t,6);default:return c(),""}}function P(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=_(e);if(!t){c(),e.currentChar();break}r+=t}return`\\${t}${r}`}function T(e){h(e);const t=m(e,"|");return h(e),t}function O(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&c(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&c(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&c(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(b(e))return t.braceNest>0&&c(),n=f(t,1,T(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return c(),t.braceNest=0,$(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=v(e);)n+=t;return e.currentChar()===j&&c(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${C(e)}`):t+=C(e),e.currentChar()===j&&c(),t}(e)),h(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&"\n"!==e;for(;t=x(e,r);)n+="\\"===t?L(e):t;const o=e.currentChar();return"\n"===o||o===j?(c(),"\n"===o&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;t=x(e,r);)n+=t;return n}(e)),c(),h(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||"\n"!==o&&" "!==o||c(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,T(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=v(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||" "===t||!t)&&("\n"===t?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?O(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?" "===o?r:"\n"===o?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&c(),t.braceNest=0,t.inLinked=!1,$(e,t))}}function $(e,t){let n={type:14};if(t.braceNest>0)return O(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return O(e,t)||p(t);case"}":return c(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(b(e))return n=f(t,1,T(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:" "===r||"\n"===r?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=s,u.offset=o(),u.startLoc=c(),r.currentChar()===j?f(u,14):$(r,u)},currentOffset:o,currentPosition:c,context:l}}const W=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function A(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function R(e={}){const t=!e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function c(e,t){const n=e.context(),c=r(3,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}function s(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(5,c,s);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function a(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(4,c,s);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(9,c,s);return a.value=t.replace(W,A),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let c=e.nextToken();switch(9===c.type&&(n.modifier=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(8,c,s);return a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),a}(e),c=e.nextToken()),c=e.nextToken(),2===c.type&&(c=e.nextToken()),c.type){case 11:n.key=function(e,t){const n=e.context(),c=r(7,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}(e,c.value||"");break;case 5:n.key=a(e,c.value||"");break;case 6:n.key=s(e,c.value||"");break;case 7:n.key=u(e,c.value||"")}return o(n,e.currentOffset(),e.currentPosition()),n}function i(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];do{const t=e.nextToken();switch(t.type){case 0:n.items.push(c(e,t.value||""));break;case 6:n.items.push(s(e,t.value||""));break;case 5:n.items.push(a(e,t.value||""));break;case 7:n.items.push(u(e,t.value||""));break;case 8:n.items.push(l(e))}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function f(e){const t=e.context(),{offset:n,startLoc:c}=t,s=i(e);return 14===t.currentType?s:function(e,t,n,c){const s=e.context();let a=0===c.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(c);do{const t=i(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==s.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,c,s)}return{parse:function(n){const c=M(n,{...e}),s=c.context(),a=r(0,s.offset,s.startLoc);return t&&a.loc&&(a.loc.source=n),a.body=f(c),o(a,c.currentOffset(),c.currentPosition()),a}}}function J(e,t){for(let n=0;n<e.length;n++)z(e[n],t)}function z(e,t){switch(e.type){case 1:J(e.cases,t),t.helper("plural");break;case 2:J(e.items,t);break;case 6:z(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function D(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&z(e.body,n);const r=n.context();e.helpers=[...r.helpers]}function H(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?H(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent();const r=t.cases.length;for(let n=0;n<r&&(H(e,t.cases[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n}=e;e.push(`${n("normalize")}([`),e.indent();const r=t.items.length;for(let n=0;n<r&&(H(e,t.items[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),H(e,t.key),t.modifier&&(e.push(", "),H(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function U(e,t={}){const n=R({...t}).parse(e);return D(n,{...t}),((e,t={})=>{const n=l(t.mode)?t.mode:"normal",r=l(t.filename)?t.filename:"message.intl",o=!!i(t.sourceMap)&&t.sourceMap,c=e.helpers||[],s=function(e,t){const{filename:n}=t,r={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,indentLevel:0};function o(e,t){r.code+=e}function c(e){o("\n"+" ".repeat(e))}return{context:()=>r,push:o,indent:function(){c(++r.indentLevel)},deindent:function(e){e?--r.indentLevel:c(--r.indentLevel)},newline:function(){c(r.indentLevel)},helper:e=>`_${e}`}}(e,{mode:n,filename:r,sourceMap:o});s.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),s.indent(),c.length>0&&(s.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),s.newline()),s.push("return "),H(s,e),s.deindent(),s.push("}");const{code:a,map:u}=s.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(n,{...t})}const V={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function K(t,...n){return function(t,...n){return 1===n.length&&f(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(V[t],...n)}const q=-1,Z="";let B;function G(e){B=e}function Q(e={}){const t=l(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:a(e.fallbackLocale)||d(e.fallbackLocale)||l(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:d(e.messages)?e.messages:{[t]:{}},datetimeFormats:d(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:d(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>l(e)?e.toUpperCase():e,lower:e=>l(e)?e.toLowerCase():e,capitalize:e=>l(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:u(e.missing)?e.missing:null,missingWarn:!i(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,fallbackWarn:!i(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:u(e.postTranslation)?e.postTranslation:null,processor:d(e.processor)?e.processor:null,warnHtmlMessage:!i(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:u(e.messageCompiler)?e.messageCompiler:B,onWarn:u(e.onWarn)?e.onWarn:c,__datetimeFormatters:f(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:f(n.__numberFormatters)?n.__numberFormatters:new Map}}function X(e,t){return e instanceof RegExp?e.test(t):e}function Y(e,t){return e instanceof RegExp?e.test(t):e}function ee(e,t,n,r,o){const{missing:c}=e;if(null!==c){const r=c(e,n,t,o);return l(r)?r:t}return t}function te(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;a(e);)e=ne(o,e,t);const c=a(t)?t:d(t)?t.default?t.default:null:t;e=l(c)?[c]:c,a(e)&&ne(o,e,!1),r.__localeChainCache.set(n,o)}return o}function ne(e,t,n){let r=!0;for(let o=0;o<t.length&&i(r);o++){l(t[o])&&(r=re(e,t[o],n))}return r}function re(e,t,n){let r;const o=t.split("-");do{r=oe(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function oe(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),(a(n)||d(n))&&n[o]&&(r=n[o])}return r}function ce(e,t,n){e.__localeChainCache=new Map,te(e,n,t)}const se=e=>e;let ae=Object.create(null);function ue(){ae=Object.create(null)}function le(e,t={}){{const n=(t.onCacheKey||se)(e),r=ae[n];if(r)return r;let o=!1;const c=t.onError||$;t.onError=e=>{o=!0,c(e)};const{code:s}=U(e,t),a=new Function(`return ${s}`)();return o?a:ae[n]=a}}function ie(e){return F(e,null,void 0)}const fe=()=>"",pe=e=>u(e);function me(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:c,fallbackLocale:p}=e,[m,d]=he(...t),h=(i(d.missingWarn),i(d.fallbackWarn),i(d.escapeParameter)?d.escapeParameter:e.escapeParameter),k=l(d.default)||i(d.default)?i(d.default)?m:d.default:r?m:"",g=r||""!==k,b=l(d.locale)?d.locale:e.locale;h&&function(e){a(e.list)?e.list=e.list.map((e=>l(e)?s(e):e)):f(e.named)&&Object.keys(e.named).forEach((t=>{l(e.named[t])&&(e.named[t]=s(e.named[t]))}))}(d);let[y,x,w]=function(e,t,n,r,o,c){const{messages:s}=e,a=te(e,r,n);let i,f={},p=null,m=null;const d="translate";for(let n=0;n<a.length&&(i=m=a[n],f=s[i]||{},null===(p=v(f,t))&&(p=f[t]),!l(p)&&!u(p));n++){const n=ee(e,t,i,0,d);n!==t&&(p=n)}return[p,i,f]}(e,m,b,p),_=m;if(l(y)||pe(y)||g&&(y=k,_=y),!l(y)&&!pe(y)||!l(x))return c?-1:m;let C=!1;const L=de(e,m,x,y,_,(()=>{C=!0}));if(C)return y;const P=function(e,t,n){return t(n)}(0,L,O(function(e,t,r,o){const{modifiers:c,pluralRules:s}=e,a={locale:t,modifiers:c,pluralRules:s,messages:n=>{const o=v(r,n);if(l(o)){let r=!1;const c=de(e,n,t,o,n,(()=>{r=!0}));return r?fe:c}return pe(o)?o:fe}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);n(o.plural)&&(a.pluralIndex=o.plural);return a}(e,x,w,d)));return o?o(P):P}function de(e,n,r,o,c,s){const{messageCompiler:a,warnHtmlMessage:u}=e;if(pe(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const l=a(o,function(e,n,r,o,c,s){return{warnHtmlMessage:c,onError:e=>{throw s&&s(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,c,0,u,s));return l.locale=r,l.key=n,l.source=o,l}function he(...e){const[t,r,c]=e,s={};if(!l(t))throw Error(12);const u=t;return n(r)?s.plural=r:l(r)?s.default=r:d(r)&&!o(r)?s.named=r:a(r)&&(s.list=r),n(c)?s.plural=c:l(c)?s.default=c:d(c)&&Object.assign(s,c),[u,s]}function ke(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:c}=e,{__datetimeFormatters:s}=e,[a,u,f,p]=ge(...t),m=(i(f.missingWarn),i(f.fallbackWarn),!!f.part),h=l(f.locale)?f.locale:e.locale,k=te(e,c,h);if(!l(a)||""===a)return new Intl.DateTimeFormat(h).format(u);let g,b={},y=null,x=null;for(let t=0;t<k.length&&(g=x=k[t],b=n[g]||{},y=b[a],!d(y));t++)ee(e,a,g,0,"datetime format");if(!d(y)||!l(g))return r?-1:a;let v=`${g}__${a}`;o(p)||(v=`${v}__${JSON.stringify(p)}`);let w=s.get(v);return w||(w=new Intl.DateTimeFormat(g,Object.assign({},y,p)),s.set(v,w)),m?w.formatToParts(u):w.format(u)}function ge(...e){const[t,r,o,c]=e;let s,a={},u={};if(l(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);s=new Date(t);try{s.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===m(t)){if(isNaN(t.getTime()))throw Error(13);s=t}else{if(!n(t))throw Error(12);s=t}return l(r)?a.key=r:d(r)&&(a=r),l(o)?a.locale=o:d(o)&&(u=o),d(c)&&(u=c),[a.key||"",s,a,u]}function be(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function ye(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:c}=e,{__numberFormatters:s}=e,[a,u,f,p]=xe(...t),m=(i(f.missingWarn),i(f.fallbackWarn),!!f.part),h=l(f.locale)?f.locale:e.locale,k=te(e,c,h);if(!l(a)||""===a)return new Intl.NumberFormat(h).format(u);let g,b={},y=null,x=null;for(let t=0;t<k.length&&(g=x=k[t],b=n[g]||{},y=b[a],!d(y));t++)ee(e,a,g,0,"number format");if(!d(y)||!l(g))return r?-1:a;let v=`${g}__${a}`;o(p)||(v=`${v}__${JSON.stringify(p)}`);let w=s.get(v);return w||(w=new Intl.NumberFormat(g,Object.assign({},y,p)),s.set(v,w)),m?w.formatToParts(u):w.format(u)}function xe(...e){const[t,r,o,c]=e;let s={},a={};if(!n(t))throw Error(12);const u=t;return l(r)?s.key=r:d(r)&&(s=r),l(o)?s.locale=o:d(o)&&(a=o),d(c)&&(a=c),[s.key||"",u,s,a]}function ve(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}const we={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},_e={"vue-i18n-resource-inspector":"Search for scopes ..."},Ce={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},Le={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};function Pe(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}}G(le);export{C as DEFAULT_MESSAGE_DATA_TYPE,we as DevToolsLabels,_e as DevToolsPlaceholders,Ce as DevToolsTimelineColors,Le as DevToolsTimelineLayerMaps,Z as MISSING_RESOLVE_VALUE,q as NOT_REOSLVED,ue as clearCompileCache,be as clearDateTimeFormat,ve as clearNumberFormat,le as compileToFunction,F as createCompileError,Q as createCoreContext,ie as createCoreError,Pe as createEmitter,O as createMessageContext,ke as datetime,te as getLocaleChain,K as getWarnMessage,ee as handleMissing,X as isTranslateFallbackWarn,Y as isTranslateMissingWarn,ye as number,y as parse,ge as parseDateTimeArgs,xe as parseNumberArgs,he as parseTranslateArgs,G as registerMessageCompiler,v as resolveValue,me as translate,ce as updateFallbackLocale};
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
import { format, isString, isArray, isPlainObject, isFunction, isBoolean, isRegExp, warn, isObject, escapeHtml, inBrowser, mark, measure, generateCodeFrame, generateFormatCacheKey, isNumber, isEmptyObject, isDate } from '@intlify/shared';
import { defaultOnError, baseCompile, createCompileError } from '@intlify/message-compiler';
import { resolveValue } from '@intlify/message-resolver';
import { createMessageContext } from '@intlify/runtime';
import { registerMessageCompiler, compileToFunction } from '@intlify/core-base';
export * from '@intlify/core-base';
/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (isString(val) ? val.toUpperCase() : val),
lower: (val) => (isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production')) {
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production')) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return isString(ret) ? ret : key;
}
else {
if ((process.env.NODE_ENV !== 'production') && isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback)
? fallback
: isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
const RE_HTML_TAG = /<\/?[\w\s="/.':;#-\/]+>/;
const WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`;
function checkHtmlMessage(source, options) {
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
if (warnHtmlMessage && RE_HTML_TAG.test(source)) {
warn(format(WARN_MESSAGE, { source }));
}
}
const defaultOnCacheKey = (source) => source;
let compileCache = Object.create(null);
/** @internal */
function clearCompileCache() {
compileCache = Object.create(null);
}
/** @internal */
function compileToFunction(source, options = {}) {
{
// check HTML message
(process.env.NODE_ENV !== 'production') && checkHtmlMessage(source, options);
// check caches
const onCacheKey = options.onCacheKey || defaultOnCacheKey;
const key = onCacheKey(source);
const cached = compileCache[key];
if (cached) {
return cached;
}
// compile error detecting
let occured = false;
const onError = options.onError || defaultOnError;
options.onError = (err) => {
occured = true;
onError(err);
};
// compile
const { code } = baseCompile(source, options);
// evaluate function
const msg = new Function(`return ${code}`)();
// if occured compile error, don't cache
return !occured ? (compileCache[key] = msg) : msg;
}
}
/** @internal */
function createCoreError(code) {
return createCompileError(code, null, (process.env.NODE_ENV !== 'production') ? { messages: errorMessages } : undefined);
}
/** @internal */
const errorMessages = {
[12 /* INVALID_ARGUMENT */]: 'Invalid arguments',
[13 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[14 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
};
const NOOP_MESSAGE_FUNCTION = () => '';
const isMessageFunction = (val) => isFunction(val);
// implementationo of `translate` function
/** @internal */
function translate(context, ...args) {
const { fallbackFormat, postTranslation, unresolving, fallbackLocale } = context;
const [key, options] = parseTranslateArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const escapeParameter = isBoolean(options.escapeParameter)
? options.escapeParameter
: context.escapeParameter;
// prettier-ignore
const defaultMsgOrKey = isString(options.default) || isBoolean(options.default) // default by function option
? !isBoolean(options.default)
? options.default
: key
: fallbackFormat // default by `fallbackFormat` option
? key
: '';
const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';
const locale = isString(options.locale) ? options.locale : context.locale;
// escape params
escapeParameter && escapeParams(options);
// resolve message format
// eslint-disable-next-line prefer-const
let [format, targetLocale, message] = resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn);
// if you use default message, set it as message format!
let cacheBaseKey = key;
if (!(isString(format) || isMessageFunction(format))) {
if (enableDefaultMsg) {
format = defaultMsgOrKey;
cacheBaseKey = format;
}
}
// checking message format and target locale
if (!(isString(format) || isMessageFunction(format)) ||
!isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
// setup compile error detecting
let occured = false;
const errorDetector = () => {
occured = true;
};
// compile message format
const msg = compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector);
// if occured compile error, return the message format
if (occured) {
return format;
}
// evaluate message with context
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
const msgContext = createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);
// if use post translation option, procee it with handler
return postTranslation ? postTranslation(messaged) : messaged;
}
function escapeParams(options) {
if (isArray(options.list)) {
options.list = options.list.map(item => isString(item) ? escapeHtml(item) : item);
}
else if (isObject(options.named)) {
Object.keys(options.named).forEach(key => {
if (isString(options.named[key])) {
options.named[key] = escapeHtml(options.named[key]);
}
});
}
}
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn } = context;
const locales = getLocaleChain(context, fallbackLocale, locale);
let message = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'translate';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if ((process.env.NODE_ENV !== 'production') &&
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(1 /* FALLBACK_TO_TRANSLATE */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
message =
messages[targetLocale] || {};
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-resolve-start';
endTag = 'intlify-message-resolve-end';
mark && mark(startTag);
}
if ((format = resolveValue(message, key)) === null) {
// if null, resolve with object key path
format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start && format) {
emitter.emit("message-resolve" /* MESSAGE_RESOLVE */, {
type: "message-resolve" /* MESSAGE_RESOLVE */,
key,
message: format,
time: end - start
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message resolve', startTag, endTag);
}
}
if (isString(format) || isFunction(format))
break;
const missingRet = handleMissing(context, key, targetLocale, missingWarn, type);
if (missingRet !== key) {
format = missingRet;
}
from = to;
}
return [format, targetLocale, message];
}
function compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector) {
const { messageCompiler, warnHtmlMessage } = context;
if (isMessageFunction(format)) {
const msg = format;
msg.locale = msg.locale || targetLocale;
msg.key = msg.key || key;
return msg;
}
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-compilation-start';
endTag = 'intlify-message-compilation-end';
mark && mark(startTag);
}
const msg = messageCompiler(format, getCompileOptions(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, errorDetector));
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-compilation" /* MESSAGE_COMPILATION */, {
type: "message-compilation" /* MESSAGE_COMPILATION */,
message: format,
time: end - start
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message compilation', startTag, endTag);
}
}
msg.locale = targetLocale;
msg.key = key;
msg.source = format;
return msg;
}
function evaluateMessage(context, msg, msgCtx) {
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-evaluation-start';
endTag = 'intlify-message-evaluation-end';
mark && mark(startTag);
}
const messaged = msg(msgCtx);
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-evaluation" /* MESSAGE_EVALUATION */, {
type: "message-evaluation" /* MESSAGE_EVALUATION */,
value: messaged,
time: end - start
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message evaluation', startTag, endTag);
}
}
return messaged;
}
/** @internal */
function parseTranslateArgs(...args) {
const [arg1, arg2, arg3] = args;
const options = {};
if (!isString(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const key = arg1;
if (isNumber(arg2)) {
options.plural = arg2;
}
else if (isString(arg2)) {
options.default = arg2;
}
else if (isPlainObject(arg2) && !isEmptyObject(arg2)) {
options.named = arg2;
}
else if (isArray(arg2)) {
options.list = arg2;
}
if (isNumber(arg3)) {
options.plural = arg3;
}
else if (isString(arg3)) {
options.default = arg3;
}
else if (isPlainObject(arg3)) {
Object.assign(options, arg3);
}
return [key, options];
}
function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) {
return {
warnHtmlMessage,
onError: (err) => {
errorDetector && errorDetector(err);
if ((process.env.NODE_ENV !== 'production')) {
const message = `Message compilation error: ${err.message}`;
const codeFrame = err.location &&
generateCodeFrame(source, err.location.start.offset, err.location.end.offset);
const emitter = context.__emitter;
if (emitter) {
emitter.emit("compile-error" /* COMPILE_ERROR */, {
message: source,
error: err.message,
start: err.location && err.location.start.offset,
end: err.location && err.location.end.offset
});
}
console.error(codeFrame ? `${message}\n${codeFrame}` : message);
}
else {
throw err;
}
},
onCacheKey: (source) => generateFormatCacheKey(locale, key, source)
};
}
function getMessageContextOptions(context, locale, message, options) {
const { modifiers, pluralRules } = context;
const resolveMessage = (key) => {
const val = resolveValue(message, key);
if (isString(val)) {
let occured = false;
const errorDetector = () => {
occured = true;
};
const msg = compileMessasgeFormat(context, key, locale, val, key, errorDetector);
return !occured
? msg
: NOOP_MESSAGE_FUNCTION;
}
else if (isMessageFunction(val)) {
return val;
}
else {
// TODO: should be implemented warning message
return NOOP_MESSAGE_FUNCTION;
}
};
const ctxOptions = {
locale,
modifiers,
pluralRules,
messages: resolveMessage
};
if (context.processor) {
ctxOptions.processor = context.processor;
}
if (options.list) {
ctxOptions.list = options.list;
}
if (options.named) {
ctxOptions.named = options.named;
}
if (isNumber(options.plural)) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
const intlDefined = typeof Intl !== 'undefined';
const Availabilities = {
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
};
// implementation of `datetime` function
/** @internal */
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { __datetimeFormatters } = context;
if ((process.env.NODE_ENV !== 'production') && !Availabilities.dateTimeFormat) {
onWarn(getWarnMessage(4 /* CANNOT_FORMAT_DATE */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseDateTimeArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!isString(key) || key === '') {
return new Intl.DateTimeFormat(locale).format(value);
}
// resolve format
let datetimeFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'datetime format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if ((process.env.NODE_ENV !== 'production') &&
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(5 /* FALLBACK_TO_DATE_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
datetimeFormat =
datetimeFormats[targetLocale] || {};
format = datetimeFormat[key];
if (isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!isPlainObject(format) || !isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __datetimeFormatters.get(id);
if (!formatter) {
formatter = new Intl.DateTimeFormat(targetLocale, Object.assign({}, format, orverrides));
__datetimeFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseDateTimeArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
let value;
if (isString(arg1)) {
// Only allow ISO strings - other date formats are often supported,
// but may cause different results in different browsers.
if (!/\d{4}-\d{2}-\d{2}(T.*)?/.test(arg1)) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
value = new Date(arg1);
try {
// This will fail if the date is not valid
value.toISOString();
}
catch (e) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
}
else if (isDate(arg1)) {
if (isNaN(arg1.getTime())) {
throw createCoreError(13 /* INVALID_DATE_ARGUMENT */);
}
value = arg1;
}
else if (isNumber(arg1)) {
value = arg1;
}
else {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
if (isString(arg2)) {
options.key = arg2;
}
else if (isPlainObject(arg2)) {
options = arg2;
}
if (isString(arg3)) {
options.locale = arg3;
}
else if (isPlainObject(arg3)) {
orverrides = arg3;
}
if (isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearDateTimeFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__datetimeFormatters.has(id)) {
continue;
}
context.__datetimeFormatters.delete(id);
}
}
// implementation of `number` function
/** @internal */
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { __numberFormatters } = context;
if ((process.env.NODE_ENV !== 'production') && !Availabilities.numberFormat) {
onWarn(getWarnMessage(2 /* CANNOT_FORMAT_NUMBER */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseNumberArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!isString(key) || key === '') {
return new Intl.NumberFormat(locale).format(value);
}
// resolve format
let numberFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'number format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if ((process.env.NODE_ENV !== 'production') &&
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(3 /* FALLBACK_TO_NUMBER_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
numberFormat =
numberFormats[targetLocale] || {};
format = numberFormat[key];
if (isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!isPlainObject(format) || !isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __numberFormatters.get(id);
if (!formatter) {
formatter = new Intl.NumberFormat(targetLocale, Object.assign({}, format, orverrides));
__numberFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseNumberArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
if (!isNumber(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const value = arg1;
if (isString(arg2)) {
options.key = arg2;
}
else if (isPlainObject(arg2)) {
options = arg2;
}
if (isString(arg3)) {
options.locale = arg3;
}
else if (isPlainObject(arg3)) {
orverrides = arg3;
}
if (isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearNumberFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__numberFormatters.has(id)) {
continue;
}
context.__numberFormatters.delete(id);
}
}
const DevToolsLabels = {
["vue-devtools-plugin-vue-i18n" /* PLUGIN */]: 'Vue I18n devtools',
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'I18n Resources',
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 'Vue I18n: Compile Errors',
["vue-i18n-missing" /* TIMELINE_MISSING */]: 'Vue I18n: Missing',
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 'Vue I18n: Fallback',
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 'Vue I18n: Performance'
};
const DevToolsPlaceholders = {
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'Search for scopes ...'
};
const DevToolsTimelineColors = {
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 0xff0000,
["vue-i18n-missing" /* TIMELINE_MISSING */]: 0xffcd19,
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 0xffcd19,
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 0xffcd19
};
const DevToolsTimelineLayerMaps = {
["compile-error" /* COMPILE_ERROR */]: "vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */,
["missing" /* MISSING */]: "vue-i18n-missing" /* TIMELINE_MISSING */,
["fallback" /* FALBACK */]: "vue-i18n-fallback" /* TIMELINE_FALLBACK */,
["message-resolve" /* MESSAGE_RESOLVE */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-compilation" /* MESSAGE_COMPILATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-evaluation" /* MESSAGE_EVALUATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */
};
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
* - code url: https://github.com/developit/mitt/blob/master/src/index.ts
* - author: Jason Miller (https://github.com/developit)
* - license: MIT
*/
/**
* Create a event emitter
*
* @returns An event emitter
*/
function createEmitter() {
const events = new Map();
const emitter = {
events,
on(event, handler) {
const handlers = events.get(event);
const added = handlers && handlers.push(handler);
if (!added) {
events.set(event, [handler]);
}
},
off(event, handler) {
const handlers = events.get(event);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
emit(event, payload) {
(events.get(event) || [])
.slice()
.map(handler => handler(payload));
(events.get('*') || [])
.slice()
.map(handler => handler(event, payload));
}
};
return emitter;
}
// register message compiler at @intlify/core
registerMessageCompiler(compileToFunction);
export { DevToolsLabels, DevToolsPlaceholders, DevToolsTimelineColors, DevToolsTimelineLayerMaps, MISSING_RESOLVE_VALUE, NOT_REOSLVED, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCoreContext, createCoreError, createEmitter, datetime, errorMessages, getLocaleChain, getWarnMessage, handleMissing, isTranslateFallbackWarn, isTranslateMissingWarn, number, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerMessageCompiler, translate, updateFallbackLocale, warnMessages };
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),o=e=>"[object RegExp]"===d(e),s=e=>h(e)&&0===Object.keys(e).length;function c(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function a(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const u=Array.isArray,l=e=>"function"==typeof e,i=e=>"string"==typeof e,f=e=>"boolean"==typeof e,p=e=>null!==e&&"object"==typeof e,m=Object.prototype.toString,d=e=>m.call(e),h=e=>"[object Object]"===d(e),k={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};let g;function b(e){g=e}function y(e,t,n,r,o){const{missing:s}=e;if(null!==s){const r=s(e,n,t,o);return i(r)?r:t}return t}function v(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;u(e);)e=x(o,e,t);const s=u(t)?t:h(t)?t.default?t.default:null:t;e=i(s)?[s]:s,u(e)&&x(o,e,!1),r.__localeChainCache.set(n,o)}return o}function x(e,t,n){let r=!0;for(let o=0;o<t.length&&f(r);o++){i(t[o])&&(r=T(e,t[o],n))}return r}function T(e,t,n){let r;const o=t.split("-");do{r=C(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function C(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),(u(n)||h(n))&&n[o]&&(r=n[o])}return r}function w(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function _(e){throw e}function L(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const P=" ",O="\n",F=String.fromCharCode(8232),N=String.fromCharCode(8233);function $(e){const t=e;let n=0,r=1,o=1,s=0;const c=e=>"\r"===t[e]&&t[e+1]===O,a=e=>t[e]===N,u=e=>t[e]===F,l=e=>c(e)||(e=>t[e]===O)(e)||a(e)||u(e),i=e=>c(e)||a(e)||u(e)?O:t[e];function f(){return s=0,l(n)&&(r++,o=0),c(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>s,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+s),next:f,peek:function(){return c(n+s)&&s++,s++,t[n+s]},reset:function(){n=0,r=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=n+s;for(;e!==n;)f();s=0}}}const S=void 0;function E(e,t={}){const n=!t.location,r=$(e),o=()=>r.index(),s=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},c=s(),a=o(),u={currentType:14,offset:a,startLoc:c,endLoc:c,lastType:14,lastOffset:a,lastStartLoc:c,lastEndLoc:c,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=s(),e.currentType=t;const o={type:t};return n&&(o.loc=L(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(s(),"")}function d(e){let t="";for(;e.currentPeek()===P||e.currentPeek()===O;)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===S)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===S)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==r&&t:"@"!==s&&s?"%"===s?(e.peek(),n(t,"%",!0)):"|"===s?!("%"!==r&&!o)||!(r===P||r===O):s===P?(e.peek(),n(!0,P,o)):s!==O||(e.peek(),n(!0,O,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function v(e,t){const n=e.currentChar();return n===S?S:t(n)?(e.next(),n):null}function x(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function T(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function C(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function w(e){let t="",n="";for(;t=T(e);)n+=t;return n}function _(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return F(e,t,4);case"U":return F(e,t,6);default:return s(),""}}function F(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=C(e);if(!t){s(),e.currentChar();break}r+=t}return`\\${t}${r}`}function N(e){h(e);const t=m(e,"|");return h(e),t}function E(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&s(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&s(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&s(),n=M(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,c=!0;if(b(e))return t.braceNest>0&&s(),n=f(t,1,N(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return s(),t.braceNest=0,I(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=x(e);)n+=t;return e.currentChar()===S&&s(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${w(e)}`):t+=w(e),e.currentChar()===S&&s(),t}(e)),h(e),n;if(c=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&e!==O;for(;t=v(e,r);)n+="\\"===t?_(e):t;const o=e.currentChar();return o===O||o===S?(s(),o===O&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!c)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==P&&e!==O;for(;t=v(e,r);)n+=t;return n}(e)),s(),h(e),n}return n}function M(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==O&&o!==P||s(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,N(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),M(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=x(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===P||!t)&&(t===O?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?E(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===P?r:o===O?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&s(),t.braceNest=0,t.inLinked=!1,I(e,t))}}function I(e,t){let n={type:14};if(t.braceNest>0)return E(e,t)||p(t);if(t.inLinked)return M(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return E(e,t)||p(t);case"}":return s(),e.next(),f(t,3,"}");case"@":return M(e,t)||p(t);default:if(b(e))return n=f(t,1,N(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:r===P||r===O?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:c}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=c,u.offset=o(),u.startLoc=s(),r.currentChar()===S?f(u,14):I(r,u)},currentOffset:o,currentPosition:s,context:l}}const M=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function I(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function A(e={}){const t=!e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function s(e,t){const n=e.context(),s=r(3,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function c(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(5,s,c);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function a(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(4,s,c);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(9,s,c);return a.value=t.replace(M,I),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let s=e.nextToken();switch(9===s.type&&(n.modifier=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(8,s,c);return a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),a}(e),s=e.nextToken()),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:n.key=function(e,t){const n=e.context(),s=r(7,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:n.key=a(e,s.value||"");break;case 6:n.key=c(e,s.value||"");break;case 7:n.key=u(e,s.value||"")}return o(n,e.currentOffset(),e.currentPosition()),n}function i(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];do{const t=e.nextToken();switch(t.type){case 0:n.items.push(s(e,t.value||""));break;case 6:n.items.push(c(e,t.value||""));break;case 5:n.items.push(a(e,t.value||""));break;case 7:n.items.push(u(e,t.value||""));break;case 8:n.items.push(l(e))}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function f(e){const t=e.context(),{offset:n,startLoc:s}=t,c=i(e);return 14===t.currentType?c:function(e,t,n,s){const c=e.context();let a=0===s.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(s);do{const t=i(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==c.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,s,c)}return{parse:function(n){const s=E(n,{...e}),c=s.context(),a=r(0,c.offset,c.startLoc);return t&&a.loc&&(a.loc.source=n),a.body=f(s),o(a,s.currentOffset(),s.currentPosition()),a}}}function W(e,t){for(let n=0;n<e.length;n++)j(e[n],t)}function j(e,t){switch(e.type){case 1:W(e.cases,t),t.helper("plural");break;case 2:W(e.items,t);break;case 6:j(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function R(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&j(e.body,n);const r=n.context();e.helpers=[...r.helpers]}function D(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?D(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent();const r=t.cases.length;for(let n=0;n<r&&(D(e,t.cases[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n}=e;e.push(`${n("normalize")}([`),e.indent();const r=t.items.length;for(let n=0;n<r&&(D(e,t.items[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),D(e,t.key),t.modifier&&(e.push(", "),D(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function J(e,t={}){const n=A({...t}).parse(e);return R(n,{...t}),((e,t={})=>{const n=i(t.mode)?t.mode:"normal",r=i(t.filename)?t.filename:"message.intl",o=!!f(t.sourceMap)&&t.sourceMap,s=e.helpers||[],c=function(e,t){const{filename:n}=t,r={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,indentLevel:0};function o(e,t){r.code+=e}function s(e){o("\n"+" ".repeat(e))}return{context:()=>r,push:o,indent:function(){s(++r.indentLevel)},deindent:function(e){e?--r.indentLevel:s(--r.indentLevel)},newline:function(){s(r.indentLevel)},helper:e=>`_${e}`}}(e,{mode:n,filename:r,sourceMap:o});c.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(),s.length>0&&(c.push(`const { ${s.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),D(c,e),c.deindent(),c.push("}");const{code:a,map:u}=c.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(n,{...t})}const V=e=>e;let z=Object.create(null);function U(e,t={}){{const n=(t.onCacheKey||V)(e),r=z[n];if(r)return r;let o=!1;const s=t.onError||_;t.onError=e=>{o=!0,s(e)};const{code:c}=J(e,t),a=new Function(`return ${c}`)();return o?a:z[n]=a}}const H=[];H[0]={w:[0],i:[3,0],"[":[4],o:[7]},H[1]={w:[1],".":[2],"[":[4],o:[7]},H[2]={w:[2],i:[3,0],0:[3,0]},H[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},H[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},H[5]={"'":[4,0],o:8,l:[5,0]},H[6]={'"':[4,0],o:8,l:[6,0]};const K=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function q(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 G(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(K.test(t)?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)}const Z=new Map;function B(e,t){if(!p(e))return null;let n=Z.get(t);if(n||(n=function(e){const t=[];let n,r,o,s,c,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=G(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(s=q(n),u=H[i],c=u[s]||u.l||8,8===c)return;if(i=c[0],void 0!==c[1]&&(a=p[c[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}(t),n&&Z.set(t,n)),!n)return null;const r=n.length;let o=e,s=0;for(;s<r;){const e=o[n[s]];if(void 0===e)return null;o=e,s++}return o}const Q=e=>e,X=e=>"",Y=e=>0===e.length?"":e.join(""),ee=e=>null==e?"":u(e)||h(e)&&e.toString===m?JSON.stringify(e,null,2):String(e);function te(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function ne(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),o=p(e.pluralRules)&&i(t)&&l(e.pluralRules[t])?e.pluralRules[t]:te,s=p(e.pluralRules)&&i(t)&&l(e.pluralRules[t])?te:void 0,c=e.list||[],a=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,a);function u(t){const n=l(e.messages)?e.messages(t):!!p(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):X)}const f=h(e.processor)&&l(e.processor.normalize)?e.processor.normalize:Y,m=h(e.processor)&&l(e.processor.interpolate)?e.processor.interpolate:ee,d={list:e=>c[e],named:e=>a[e],plural:e=>e[o(n,e.length,s)],linked:(t,n)=>{const r=u(t)(d);return i(n)?(o=n,e.modifiers?e.modifiers[o]:Q)(r):r;var o},message:u,type:h(e.processor)&&i(e.processor.type)?e.processor.type:"text",interpolate:m,normalize:f};return d}const re={12:"Invalid arguments",13:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",14:"The argument provided is not a valid ISO date string"},oe=()=>"",se=e=>l(e);function ce(e,t,r,o,s,c){const{messageCompiler:a,warnHtmlMessage:u}=e;if(se(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}const l=a(o,function(e,t,r,o,s,c){return{warnHtmlMessage:s,onError:e=>{throw c&&c(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,s,0,u,c));return l.locale=r,l.key=t,l.source=o,l}function ae(...e){const[t,n,o]=e,c={};if(!i(t))throw Error(12);const a=t;return r(n)?c.plural=n:i(n)?c.default=n:h(n)&&!s(n)?c.named=n:u(n)&&(c.list=n),r(o)?c.plural=o:i(o)?c.default=o:h(o)&&Object.assign(c,o),[a,c]}function ue(...e){const[t,n,o,s]=e;let c,a={},u={};if(i(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);c=new Date(t);try{c.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===d(t)){if(isNaN(t.getTime()))throw Error(13);c=t}else{if(!r(t))throw Error(12);c=t}return i(n)?a.key=n:h(n)&&(a=n),i(o)?a.locale=o:h(o)&&(u=o),h(s)&&(u=s),[a.key||"",c,a,u]}function le(...e){const[t,n,o,s]=e;let c={},a={};if(!r(t))throw Error(12);const u=t;return i(n)?c.key=n:h(n)&&(c=n),i(o)?c.locale=o:h(o)&&(a=o),h(s)&&(a=s),[c.key||"",u,c,a]}const ie={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},fe={"vue-i18n-resource-inspector":"Search for scopes ..."},pe={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},me={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};return b(U),e.DevToolsLabels=ie,e.DevToolsPlaceholders=fe,e.DevToolsTimelineColors=pe,e.DevToolsTimelineLayerMaps=me,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.clearCompileCache=function(){z=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=U,e.createCoreContext=function(e={}){const t=i(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:u(e.fallbackLocale)||h(e.fallbackLocale)||i(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:h(e.messages)?e.messages:{[t]:{}},datetimeFormats:h(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:h(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>i(e)?e.toUpperCase():e,lower:e=>i(e)?e.toLowerCase():e,capitalize:e=>i(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:l(e.missing)?e.missing:null,missingWarn:!f(e.missingWarn)&&!o(e.missingWarn)||e.missingWarn,fallbackWarn:!f(e.fallbackWarn)&&!o(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:l(e.postTranslation)?e.postTranslation:null,processor:h(e.processor)?e.processor:null,warnHtmlMessage:!f(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:l(e.messageCompiler)?e.messageCompiler:g,onWarn:l(e.onWarn)?e.onWarn:c,__datetimeFormatters:p(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:p(n.__numberFormatters)?n.__numberFormatters:new Map}},e.createCoreError=function(e){return w(e,null,void 0)},e.createEmitter=function(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}},e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o}=e,{__datetimeFormatters:c}=e,[a,u,l,p]=ue(...t),m=(f(l.missingWarn),f(l.fallbackWarn),!!l.part),d=i(l.locale)?l.locale:e.locale,k=v(e,o,d);if(!i(a)||""===a)return new Intl.DateTimeFormat(d).format(u);let g,b={},x=null,T=null;for(let t=0;t<k.length&&(g=T=k[t],b=n[g]||{},x=b[a],!h(x));t++)y(e,a,g,0,"datetime format");if(!h(x)||!i(g))return r?-1:a;let C=`${g}__${a}`;s(p)||(C=`${C}__${JSON.stringify(p)}`);let w=c.get(C);return w||(w=new Intl.DateTimeFormat(g,Object.assign({},x,p)),c.set(C,w)),m?w.formatToParts(u):w.format(u)},e.errorMessages=re,e.getLocaleChain=v,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&p(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(k[e],...n)},e.handleMissing=y,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,fallbackLocale:o}=e,{__numberFormatters:c}=e,[a,u,l,p]=le(...t),m=(f(l.missingWarn),f(l.fallbackWarn),!!l.part),d=i(l.locale)?l.locale:e.locale,k=v(e,o,d);if(!i(a)||""===a)return new Intl.NumberFormat(d).format(u);let g,b={},x=null,T=null;for(let t=0;t<k.length&&(g=T=k[t],b=n[g]||{},x=b[a],!h(x));t++)y(e,a,g,0,"number format");if(!h(x)||!i(g))return r?-1:a;let C=`${g}__${a}`;s(p)||(C=`${C}__${JSON.stringify(p)}`);let w=c.get(C);return w||(w=new Intl.NumberFormat(g,Object.assign({},x,p)),c.set(C,w)),m?w.formatToParts(u):w.format(u)},e.parseDateTimeArgs=ue,e.parseNumberArgs=le,e.parseTranslateArgs=ae,e.registerMessageCompiler=b,e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:o,unresolving:s,fallbackLocale:c}=e,[m,d]=ae(...t),h=(f(d.missingWarn),f(d.fallbackWarn),f(d.escapeParameter)?d.escapeParameter:e.escapeParameter),k=i(d.default)||f(d.default)?f(d.default)?m:d.default:n?m:"",g=n||""!==k,b=i(d.locale)?d.locale:e.locale;h&&function(e){u(e.list)?e.list=e.list.map((e=>i(e)?a(e):e)):p(e.named)&&Object.keys(e.named).forEach((t=>{i(e.named[t])&&(e.named[t]=a(e.named[t]))}))}(d);let[x,T,C]=function(e,t,n,r,o,s){const{messages:c}=e,a=v(e,r,n);let u,f={},p=null,m=null;const d="translate";for(let n=0;n<a.length&&(u=m=a[n],f=c[u]||{},null===(p=B(f,t))&&(p=f[t]),!i(p)&&!l(p));n++){const n=y(e,t,u,0,d);n!==t&&(p=n)}return[p,u,f]}(e,m,b,c),w=m;if(i(x)||se(x)||g&&(x=k,w=x),!i(x)&&!se(x)||!i(T))return s?-1:m;let _=!1;const L=ce(e,m,T,x,w,(()=>{_=!0}));if(_)return x;const P=function(e,t,n){return t(n)}(0,L,ne(function(e,t,n,o){const{modifiers:s,pluralRules:c}=e,a={locale:t,modifiers:s,pluralRules:c,messages:r=>{const o=B(n,r);if(i(o)){let n=!1;const s=ce(e,r,t,o,r,(()=>{n=!0}));return n?oe:s}return se(o)?o:oe}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);r(o.plural)&&(a.pluralIndex=o.plural);return a}(e,T,C,d)));return o?o(P):P},e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,v(e,n,t)},e.warnMessages=k,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),o=e=>"[object RegExp]"===d(e),s=e=>h(e)&&0===Object.keys(e).length;function c(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function a(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const u=Array.isArray,l=e=>"function"==typeof e,i=e=>"string"==typeof e,f=e=>"boolean"==typeof e,p=e=>null!==e&&"object"==typeof e,m=Object.prototype.toString,d=e=>m.call(e),h=e=>"[object Object]"===d(e),k=[];k[0]={w:[0],i:[3,0],"[":[4],o:[7]},k[1]={w:[1],".":[2],"[":[4],o:[7]},k[2]={w:[2],i:[3,0],0:[3,0]},k[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},k[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},k[5]={"'":[4,0],o:8,l:[5,0]},k[6]={'"':[4,0],o:8,l:[6,0]};const g=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function b(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 y(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(g.test(t)?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)}function v(e){const t=[];let n,r,o,s,c,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=y(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(s=b(n),u=k[i],c=u[s]||u.l||8,8===c)return;if(i=c[0],void 0!==c[1]&&(a=p[c[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const x=new Map;function T(e,t){if(!p(e))return null;let n=x.get(t);if(n||(n=v(t),n&&x.set(t,n)),!n)return null;const r=n.length;let o=e,s=0;for(;s<r;){const e=o[n[s]];if(void 0===e)return null;o=e,s++}return o}const C=e=>e,_=e=>"",L="text",w=e=>0===e.length?"":e.join(""),P=e=>null==e?"":u(e)||h(e)&&e.toString===m?JSON.stringify(e,null,2):String(e);function O(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function F(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),o=p(e.pluralRules)&&i(t)&&l(e.pluralRules[t])?e.pluralRules[t]:O,s=p(e.pluralRules)&&i(t)&&l(e.pluralRules[t])?O:void 0,c=e.list||[],a=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,a);function u(t){const n=l(e.messages)?e.messages(t):!!p(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):_)}const f=h(e.processor)&&l(e.processor.normalize)?e.processor.normalize:w,m=h(e.processor)&&l(e.processor.interpolate)?e.processor.interpolate:P,d={list:e=>c[e],named:e=>a[e],plural:e=>e[o(n,e.length,s)],linked:(t,n)=>{const r=u(t)(d);return i(n)?(o=n,e.modifiers?e.modifiers[o]:C)(r):r;var o},message:u,type:h(e.processor)&&i(e.processor.type)?e.processor.type:L,interpolate:m,normalize:f};return d}function N(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function $(e){throw e}function S(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const E=" ",M="\n",A=String.fromCharCode(8232),I=String.fromCharCode(8233);function W(e){const t=e;let n=0,r=1,o=1,s=0;const c=e=>"\r"===t[e]&&t[e+1]===M,a=e=>t[e]===I,u=e=>t[e]===A,l=e=>c(e)||(e=>t[e]===M)(e)||a(e)||u(e),i=e=>c(e)||a(e)||u(e)?M:t[e];function f(){return s=0,l(n)&&(r++,o=0),c(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>s,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+s),next:f,peek:function(){return c(n+s)&&s++,s++,t[n+s]},reset:function(){n=0,r=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=n+s;for(;e!==n;)f();s=0}}}const j=void 0;function R(e,t={}){const n=!t.location,r=W(e),o=()=>r.index(),s=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},c=s(),a=o(),u={currentType:14,offset:a,startLoc:c,endLoc:c,lastType:14,lastOffset:a,lastStartLoc:c,lastEndLoc:c,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=s(),e.currentType=t;const o={type:t};return n&&(o.loc=S(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(s(),"")}function d(e){let t="";for(;e.currentPeek()===E||e.currentPeek()===M;)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===j)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===j)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==r&&t:"@"!==s&&s?"%"===s?(e.peek(),n(t,"%",!0)):"|"===s?!("%"!==r&&!o)||!(r===E||r===M):s===E?(e.peek(),n(!0,E,o)):s!==M||(e.peek(),n(!0,M,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function v(e,t){const n=e.currentChar();return n===j?j:t(n)?(e.next(),n):null}function x(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function T(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function C(e){return v(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function _(e){let t="",n="";for(;t=T(e);)n+=t;return n}function L(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return w(e,t,4);case"U":return w(e,t,6);default:return s(),""}}function w(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=C(e);if(!t){s(),e.currentChar();break}r+=t}return`\\${t}${r}`}function P(e){h(e);const t=m(e,"|");return h(e),t}function O(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&s(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&s(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&s(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,c=!0;if(b(e))return t.braceNest>0&&s(),n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return s(),t.braceNest=0,N(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=x(e);)n+=t;return e.currentChar()===j&&s(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${_(e)}`):t+=_(e),e.currentChar()===j&&s(),t}(e)),h(e),n;if(c=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&e!==M;for(;t=v(e,r);)n+="\\"===t?L(e):t;const o=e.currentChar();return o===M||o===j?(s(),o===M&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!c)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==E&&e!==M;for(;t=v(e,r);)n+=t;return n}(e)),s(),h(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==M&&o!==E||s(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=x(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===E||!t)&&(t===M?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?O(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===E?r:o===M?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&s(),t.braceNest=0,t.inLinked=!1,N(e,t))}}function N(e,t){let n={type:14};if(t.braceNest>0)return O(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return O(e,t)||p(t);case"}":return s(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(b(e))return n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:r===E||r===M?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:c}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=c,u.offset=o(),u.startLoc=s(),r.currentChar()===j?f(u,14):N(r,u)},currentOffset:o,currentPosition:s,context:l}}const D=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function V(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function J(e={}){const t=!e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function s(e,t){const n=e.context(),s=r(3,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function c(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(5,s,c);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function a(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(4,s,c);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(9,s,c);return a.value=t.replace(D,V),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let s=e.nextToken();switch(9===s.type&&(n.modifier=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(8,s,c);return a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),a}(e),s=e.nextToken()),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:n.key=function(e,t){const n=e.context(),s=r(7,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:n.key=a(e,s.value||"");break;case 6:n.key=c(e,s.value||"");break;case 7:n.key=u(e,s.value||"")}return o(n,e.currentOffset(),e.currentPosition()),n}function i(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];do{const t=e.nextToken();switch(t.type){case 0:n.items.push(s(e,t.value||""));break;case 6:n.items.push(c(e,t.value||""));break;case 5:n.items.push(a(e,t.value||""));break;case 7:n.items.push(u(e,t.value||""));break;case 8:n.items.push(l(e))}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function f(e){const t=e.context(),{offset:n,startLoc:s}=t,c=i(e);return 14===t.currentType?c:function(e,t,n,s){const c=e.context();let a=0===s.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(s);do{const t=i(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==c.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,s,c)}return{parse:function(n){const s=R(n,{...e}),c=s.context(),a=r(0,c.offset,c.startLoc);return t&&a.loc&&(a.loc.source=n),a.body=f(s),o(a,s.currentOffset(),s.currentPosition()),a}}}function z(e,t){for(let n=0;n<e.length;n++)U(e[n],t)}function U(e,t){switch(e.type){case 1:z(e.cases,t),t.helper("plural");break;case 2:z(e.items,t);break;case 6:U(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function H(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&U(e.body,n);const r=n.context();e.helpers=[...r.helpers]}function G(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?G(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent();const r=t.cases.length;for(let n=0;n<r&&(G(e,t.cases[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n}=e;e.push(`${n("normalize")}([`),e.indent();const r=t.items.length;for(let n=0;n<r&&(G(e,t.items[n]),n!==r-1);n++)e.push(", ");e.deindent(),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),G(e,t.key),t.modifier&&(e.push(", "),G(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function K(e,t={}){const n=J({...t}).parse(e);return H(n,{...t}),((e,t={})=>{const n=i(t.mode)?t.mode:"normal",r=i(t.filename)?t.filename:"message.intl",o=!!f(t.sourceMap)&&t.sourceMap,s=e.helpers||[],c=function(e,t){const{filename:n}=t,r={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,indentLevel:0};function o(e,t){r.code+=e}function s(e){o("\n"+" ".repeat(e))}return{context:()=>r,push:o,indent:function(){s(++r.indentLevel)},deindent:function(e){e?--r.indentLevel:s(--r.indentLevel)},newline:function(){s(r.indentLevel)},helper:e=>`_${e}`}}(e,{mode:n,filename:r,sourceMap:o});c.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(),s.length>0&&(c.push(`const { ${s.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),G(c,e),c.deindent(),c.push("}");const{code:a,map:u}=c.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(n,{...t})}const q={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};let Y;function Z(e){Y=e}function B(e,t,n,r,o){const{missing:s}=e;if(null!==s){const r=s(e,n,t,o);return i(r)?r:t}return t}function Q(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;u(e);)e=X(o,e,t);const s=u(t)?t:h(t)?t.default?t.default:null:t;e=i(s)?[s]:s,u(e)&&X(o,e,!1),r.__localeChainCache.set(n,o)}return o}function X(e,t,n){let r=!0;for(let o=0;o<t.length&&f(r);o++){i(t[o])&&(r=ee(e,t[o],n))}return r}function ee(e,t,n){let r;const o=t.split("-");do{r=te(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function te(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),(u(n)||h(n))&&n[o]&&(r=n[o])}return r}const ne=e=>e;let re=Object.create(null);function oe(e,t={}){{const n=(t.onCacheKey||ne)(e),r=re[n];if(r)return r;let o=!1;const s=t.onError||$;t.onError=e=>{o=!0,s(e)};const{code:c}=K(e,t),a=new Function(`return ${c}`)();return o?a:re[n]=a}}const se=()=>"",ce=e=>l(e);function ae(e,t,r,o,s,c){const{messageCompiler:a,warnHtmlMessage:u}=e;if(ce(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}const l=a(o,function(e,t,r,o,s,c){return{warnHtmlMessage:s,onError:e=>{throw c&&c(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,s,0,u,c));return l.locale=r,l.key=t,l.source=o,l}function ue(...e){const[t,n,o]=e,c={};if(!i(t))throw Error(12);const a=t;return r(n)?c.plural=n:i(n)?c.default=n:h(n)&&!s(n)?c.named=n:u(n)&&(c.list=n),r(o)?c.plural=o:i(o)?c.default=o:h(o)&&Object.assign(c,o),[a,c]}function le(...e){const[t,n,o,s]=e;let c,a={},u={};if(i(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);c=new Date(t);try{c.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===d(t)){if(isNaN(t.getTime()))throw Error(13);c=t}else{if(!r(t))throw Error(12);c=t}return i(n)?a.key=n:h(n)&&(a=n),i(o)?a.locale=o:h(o)&&(u=o),h(s)&&(u=s),[a.key||"",c,a,u]}function ie(...e){const[t,n,o,s]=e;let c={},a={};if(!r(t))throw Error(12);const u=t;return i(n)?c.key=n:h(n)&&(c=n),i(o)?c.locale=o:h(o)&&(a=o),h(s)&&(a=s),[c.key||"",u,c,a]}const fe={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},pe={"vue-i18n-resource-inspector":"Search for scopes ..."},me={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},de={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};return Z(oe),e.DEFAULT_MESSAGE_DATA_TYPE=L,e.DevToolsLabels=fe,e.DevToolsPlaceholders=pe,e.DevToolsTimelineColors=me,e.DevToolsTimelineLayerMaps=de,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.clearCompileCache=function(){re=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=oe,e.createCompileError=N,e.createCoreContext=function(e={}){const t=i(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:u(e.fallbackLocale)||h(e.fallbackLocale)||i(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:h(e.messages)?e.messages:{[t]:{}},datetimeFormats:h(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:h(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>i(e)?e.toUpperCase():e,lower:e=>i(e)?e.toLowerCase():e,capitalize:e=>i(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:l(e.missing)?e.missing:null,missingWarn:!f(e.missingWarn)&&!o(e.missingWarn)||e.missingWarn,fallbackWarn:!f(e.fallbackWarn)&&!o(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:l(e.postTranslation)?e.postTranslation:null,processor:h(e.processor)?e.processor:null,warnHtmlMessage:!f(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:l(e.messageCompiler)?e.messageCompiler:Y,onWarn:l(e.onWarn)?e.onWarn:c,__datetimeFormatters:p(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:p(n.__numberFormatters)?n.__numberFormatters:new Map}},e.createCoreError=function(e){return N(e,null,void 0)},e.createEmitter=function(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}},e.createMessageContext=F,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o}=e,{__datetimeFormatters:c}=e,[a,u,l,p]=le(...t),m=(f(l.missingWarn),f(l.fallbackWarn),!!l.part),d=i(l.locale)?l.locale:e.locale,k=Q(e,o,d);if(!i(a)||""===a)return new Intl.DateTimeFormat(d).format(u);let g,b={},y=null,v=null;for(let t=0;t<k.length&&(g=v=k[t],b=n[g]||{},y=b[a],!h(y));t++)B(e,a,g,0,"datetime format");if(!h(y)||!i(g))return r?-1:a;let x=`${g}__${a}`;s(p)||(x=`${x}__${JSON.stringify(p)}`);let T=c.get(x);return T||(T=new Intl.DateTimeFormat(g,Object.assign({},y,p)),c.set(x,T)),m?T.formatToParts(u):T.format(u)},e.getLocaleChain=Q,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&p(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(q[e],...n)},e.handleMissing=B,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,fallbackLocale:o}=e,{__numberFormatters:c}=e,[a,u,l,p]=ie(...t),m=(f(l.missingWarn),f(l.fallbackWarn),!!l.part),d=i(l.locale)?l.locale:e.locale,k=Q(e,o,d);if(!i(a)||""===a)return new Intl.NumberFormat(d).format(u);let g,b={},y=null,v=null;for(let t=0;t<k.length&&(g=v=k[t],b=n[g]||{},y=b[a],!h(y));t++)B(e,a,g,0,"number format");if(!h(y)||!i(g))return r?-1:a;let x=`${g}__${a}`;s(p)||(x=`${x}__${JSON.stringify(p)}`);let T=c.get(x);return T||(T=new Intl.NumberFormat(g,Object.assign({},y,p)),c.set(x,T)),m?T.formatToParts(u):T.format(u)},e.parse=v,e.parseDateTimeArgs=le,e.parseNumberArgs=ie,e.parseTranslateArgs=ue,e.registerMessageCompiler=Z,e.resolveValue=T,e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:o,unresolving:s,fallbackLocale:c}=e,[m,d]=ue(...t),h=(f(d.missingWarn),f(d.fallbackWarn),f(d.escapeParameter)?d.escapeParameter:e.escapeParameter),k=i(d.default)||f(d.default)?f(d.default)?m:d.default:n?m:"",g=n||""!==k,b=i(d.locale)?d.locale:e.locale;h&&function(e){u(e.list)?e.list=e.list.map((e=>i(e)?a(e):e)):p(e.named)&&Object.keys(e.named).forEach((t=>{i(e.named[t])&&(e.named[t]=a(e.named[t]))}))}(d);let[y,v,x]=function(e,t,n,r,o,s){const{messages:c}=e,a=Q(e,r,n);let u,f={},p=null,m=null;const d="translate";for(let n=0;n<a.length&&(u=m=a[n],f=c[u]||{},null===(p=T(f,t))&&(p=f[t]),!i(p)&&!l(p));n++){const n=B(e,t,u,0,d);n!==t&&(p=n)}return[p,u,f]}(e,m,b,c),C=m;if(i(y)||ce(y)||g&&(y=k,C=y),!i(y)&&!ce(y)||!i(v))return s?-1:m;let _=!1;const L=ae(e,m,v,y,C,(()=>{_=!0}));if(_)return y;const w=function(e,t,n){return t(n)}(0,L,F(function(e,t,n,o){const{modifiers:s,pluralRules:c}=e,a={locale:t,modifiers:s,pluralRules:c,messages:r=>{const o=T(n,r);if(i(o)){let n=!1;const s=ae(e,r,t,o,r,(()=>{n=!0}));return n?se:s}return ce(o)?o:se}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);r(o.plural)&&(a.pluralIndex=o.plural);return a}(e,v,x,d)));return o?o(w):w},e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,Q(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi

@@ -128,271 +128,2 @@ * Released under the MIT License.

/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (isString(val) ? val.toUpperCase() : val),
lower: (val) => (isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
{
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
{
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return isString(ret) ? ret : key;
}
else {
if ( isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback)
? fallback
: isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
/** @internal */
const errorMessages = {
// tokenizer error messages
[0 /* EXPECTED_TOKEN */]: `Expected token: '{0}'`,
[1 /* INVALID_TOKEN_IN_PLACEHOLDER */]: `Invalid token in placeholder: '{0}'`,
[2 /* UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER */]: `Unterminated single quote in placeholder`,
[3 /* UNKNOWN_ESCAPE_SEQUENCE */]: `Unknown escape sequence: \\{0}`,
[4 /* INVALID_UNICODE_ESCAPE_SEQUENCE */]: `Invalid unicode escape sequence: {0}`,
[5 /* UNBALANCED_CLOSING_BRACE */]: `Unbalanced closing brace`,
[6 /* UNTERMINATED_CLOSING_BRACE */]: `Unterminated closing brace`,
[7 /* EMPTY_PLACEHOLDER */]: `Empty placeholder`,
[8 /* NOT_ALLOW_NEST_PLACEHOLDER */]: `Not allowed nest placeholder`,
[9 /* INVALID_LINKED_FORMAT */]: `Invalid linked format`,
// parser error messages
[10 /* MUST_HAVE_MESSAGES_IN_PLURAL */]: `Plural must have messages`,
[11 /* UNEXPECTED_LEXICAL_ANALYSIS */]: `Unexpected lexical analysis in token: '{0}'`
};
/** @internal */
function createCompileError(code, loc, optinos = {}) {
const { domain, messages, args } = optinos;
const msg = format((messages || errorMessages)[code] || '', ...(args || []))
;
const error = new SyntaxError(String(msg));
error.code = code;
if (loc) {
error.location = loc;
}
error.domain = domain;
return error;
}
/** @internal */
function clearCompileCache() {
}
/** @internal */
function compileToFunction(source, options = {}) {
{
warn(`Runtime compilation is not supported in ${'core.runtime.esm-browser.js' }.`);
return (() => source);
}
}
const pathStateMachine = [];

@@ -738,2 +469,271 @@ pathStateMachine[0 /* BEFORE_PATH */] = {

/** @internal */
const errorMessages = {
// tokenizer error messages
[0 /* EXPECTED_TOKEN */]: `Expected token: '{0}'`,
[1 /* INVALID_TOKEN_IN_PLACEHOLDER */]: `Invalid token in placeholder: '{0}'`,
[2 /* UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER */]: `Unterminated single quote in placeholder`,
[3 /* UNKNOWN_ESCAPE_SEQUENCE */]: `Unknown escape sequence: \\{0}`,
[4 /* INVALID_UNICODE_ESCAPE_SEQUENCE */]: `Invalid unicode escape sequence: {0}`,
[5 /* UNBALANCED_CLOSING_BRACE */]: `Unbalanced closing brace`,
[6 /* UNTERMINATED_CLOSING_BRACE */]: `Unterminated closing brace`,
[7 /* EMPTY_PLACEHOLDER */]: `Empty placeholder`,
[8 /* NOT_ALLOW_NEST_PLACEHOLDER */]: `Not allowed nest placeholder`,
[9 /* INVALID_LINKED_FORMAT */]: `Invalid linked format`,
// parser error messages
[10 /* MUST_HAVE_MESSAGES_IN_PLURAL */]: `Plural must have messages`,
[11 /* UNEXPECTED_LEXICAL_ANALYSIS */]: `Unexpected lexical analysis in token: '{0}'`
};
/** @internal */
function createCompileError(code, loc, optinos = {}) {
const { domain, messages, args } = optinos;
const msg = format((messages || errorMessages)[code] || '', ...(args || []))
;
const error = new SyntaxError(String(msg));
error.code = code;
if (loc) {
error.location = loc;
}
error.domain = domain;
return error;
}
/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (isString(val) ? val.toUpperCase() : val),
lower: (val) => (isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
{
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
{
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return isString(ret) ? ret : key;
}
else {
if ( isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback)
? fallback
: isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
/** @internal */
function clearCompileCache() {
}
/** @internal */
function compileToFunction(source, options = {}) {
{
warn(`Runtime compilation is not supported in ${'core.runtime.esm-browser.js' }.`);
return (() => source);
}
}
/** @internal */
function createCoreError(code) {

@@ -1391,2 +1391,2 @@ return createCompileError(code, null, { messages: errorMessages$1 } );

export { DevToolsLabels, DevToolsPlaceholders, DevToolsTimelineColors, DevToolsTimelineLayerMaps, MISSING_RESOLVE_VALUE, NOT_REOSLVED, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCoreContext, createCoreError, createEmitter, datetime, errorMessages$1 as errorMessages, getLocaleChain, getWarnMessage, handleMissing, isTranslateFallbackWarn, isTranslateMissingWarn, number, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerMessageCompiler, translate, updateFallbackLocale, warnMessages };
export { DEFAULT_MESSAGE_DATA_TYPE, DevToolsLabels, DevToolsPlaceholders, DevToolsTimelineColors, DevToolsTimelineLayerMaps, MISSING_RESOLVE_VALUE, NOT_REOSLVED, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCompileError, createCoreContext, createCoreError, createEmitter, createMessageContext, datetime, getLocaleChain, getWarnMessage, handleMissing, isTranslateFallbackWarn, isTranslateMissingWarn, number, parse, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerMessageCompiler, resolveValue, translate, updateFallbackLocale };
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===p(e),a=e=>g(e)&&0===Object.keys(e).length;function o(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function l(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const s=Array.isArray,i=e=>"function"==typeof e,c=e=>"string"==typeof e,u=e=>"boolean"==typeof e,m=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,p=e=>f.call(e),g=e=>"[object Object]"===p(e),d={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function b(t,...n){return function(t,...n){return 1===n.length&&m(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(d[t],...n)}const h=-1,k="";let _;function v(e){_=e}function y(e={}){const t=c(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:s(e.fallbackLocale)||g(e.fallbackLocale)||c(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:g(e.messages)?e.messages:{[t]:{}},datetimeFormats:g(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:g(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>c(e)?e.toUpperCase():e,lower:e=>c(e)?e.toLowerCase():e,capitalize:e=>c(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:i(e.missing)?e.missing:null,missingWarn:!u(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,fallbackWarn:!u(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:i(e.postTranslation)?e.postTranslation:null,processor:g(e.processor)?e.processor:null,warnHtmlMessage:!u(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:i(e.messageCompiler)?e.messageCompiler:_,onWarn:i(e.onWarn)?e.onWarn:o,__datetimeFormatters:m(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:m(n.__numberFormatters)?n.__numberFormatters:new Map}}function w(e,t){return e instanceof RegExp?e.test(t):e}function F(e,t){return e instanceof RegExp?e.test(t):e}function C(e,t,n,r,a){const{missing:o}=e;if(null!==o){const r=o(e,n,t,a);return c(r)?r:t}return t}function I(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let a=r.__localeChainCache.get(n);if(!a){a=[];let e=[n];for(;s(e);)e=O(a,e,t);const o=s(t)?t:g(t)?t.default?t.default:null:t;e=c(o)?[o]:o,s(e)&&O(a,e,!1),r.__localeChainCache.set(n,a)}return a}function O(e,t,n){let r=!0;for(let a=0;a<t.length&&u(r);a++){c(t[a])&&(r=W(e,t[a],n))}return r}function W(e,t,n){let r;const a=t.split("-");do{r=M(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function M(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),(s(n)||g(n))&&n[a]&&(r=n[a])}return r}function $(e,t,n){e.__localeChainCache=new Map,I(e,n,t)}function j(e,t,n={}){const{domain:r}=n,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=r,a}function S(){}function E(e,t={}){return()=>e}const R=[];R[0]={w:[0],i:[3,0],"[":[4],o:[7]},R[1]={w:[1],".":[2],"[":[4],o:[7]},R[2]={w:[2],i:[3,0],0:[3,0]},R[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},R[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},R[5]={"'":[4,0],o:8,l:[5,0]},R[6]={'"':[4,0],o:8,l:[6,0]};const T=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function N(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 x(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(T.test(t)?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)}const L=new Map;function P(e,t){if(!m(e))return null;let n=L.get(t);if(n||(n=function(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,m=0;const f=[];function p(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===r?r=a:r+=a},f[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===r)return!1;if(r=x(r),!1===r)return!1;f[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!p()){if(o=N(n),i=R[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=f[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}(t),n&&L.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=a[n[o]];if(void 0===e)return null;a=e,o++}return a}const A=e=>e,D=e=>"",z=e=>0===e.length?"":e.join(""),H=e=>null==e?"":s(e)||g(e)&&e.toString===f?JSON.stringify(e,null,2):String(e);function V(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function J(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),a=m(e.pluralRules)&&c(t)&&i(e.pluralRules[t])?e.pluralRules[t]:V,o=m(e.pluralRules)&&c(t)&&i(e.pluralRules[t])?V:void 0,l=e.list||[],s=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,s);function u(t){const n=i(e.messages)?e.messages(t):!!m(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):D)}const f=g(e.processor)&&i(e.processor.normalize)?e.processor.normalize:z,p=g(e.processor)&&i(e.processor.interpolate)?e.processor.interpolate:H,d={list:e=>l[e],named:e=>s[e],plural:e=>e[a(r,e.length,o)],linked:(t,n)=>{const r=u(t)(d);return c(n)?(a=n,e.modifiers?e.modifiers[a]:A)(r):r;var a},message:u,type:g(e.processor)&&c(e.processor.type)?e.processor.type:"text",interpolate:p,normalize:f};return d}function U(e){return j(e,null,void 0)}const q={12:"Invalid arguments",13:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",14:"The argument provided is not a valid ISO date string"},K=()=>"",Z=e=>i(e);function B(e,...t){const{fallbackFormat:r,postTranslation:a,unresolving:f,fallbackLocale:p}=e,[g,d]=Q(...t),b=(u(d.missingWarn),u(d.fallbackWarn),u(d.escapeParameter)?d.escapeParameter:e.escapeParameter),h=c(d.default)||u(d.default)?u(d.default)?g:d.default:r?g:"",k=r||""!==h,_=c(d.locale)?d.locale:e.locale;b&&function(e){s(e.list)?e.list=e.list.map((e=>c(e)?l(e):e)):m(e.named)&&Object.keys(e.named).forEach((t=>{c(e.named[t])&&(e.named[t]=l(e.named[t]))}))}(d);let[v,y,w]=function(e,t,n,r,a,o){const{messages:l}=e,s=I(e,r,n);let u,m={},f=null,p=null;const g="translate";for(let n=0;n<s.length&&(u=p=s[n],m=l[u]||{},null===(f=P(m,t))&&(f=m[t]),!c(f)&&!i(f));n++){const n=C(e,t,u,0,g);n!==t&&(f=n)}return[f,u,m]}(e,g,_,p),F=g;if(c(v)||Z(v)||k&&(v=h,F=v),!c(v)&&!Z(v)||!c(y))return f?-1:g;if(c(v)&&null==e.messageCompiler)return o("Message format compilation is not supported in this build, because message compiler isn't included, you need to pre-compilation all message format."),g;let O=!1;const W=G(e,g,y,v,F,(()=>{O=!0}));if(O)return v;const M=function(e,t,n){return t(n)}(0,W,J(function(e,t,r,a){const{modifiers:o,pluralRules:l}=e,s={locale:t,modifiers:o,pluralRules:l,messages:n=>{const a=P(r,n);if(c(a)){let r=!1;const o=G(e,n,t,a,n,(()=>{r=!0}));return r?K:o}return Z(a)?a:K}};e.processor&&(s.processor=e.processor);a.list&&(s.list=a.list);a.named&&(s.named=a.named);n(a.plural)&&(s.pluralIndex=a.plural);return s}(e,y,w,d)));return a?a(M):M}function G(e,n,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(Z(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||n,e}const c=s(a,function(e,n,r,a,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,o,0,i,l));return c.locale=r,c.key=n,c.source=a,c}function Q(...e){const[t,r,o]=e,l={};if(!c(t))throw Error(12);const i=t;return n(r)?l.plural=r:c(r)?l.default=r:g(r)&&!a(r)?l.named=r:s(r)&&(l.list=r),n(o)?l.plural=o:c(o)?l.default=o:g(o)&&Object.assign(l,o),[i,l]}function X(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o}=e,{__datetimeFormatters:l}=e,[s,i,m,f]=Y(...t),p=(u(m.missingWarn),u(m.fallbackWarn),!!m.part),d=c(m.locale)?m.locale:e.locale,b=I(e,o,d);if(!c(s)||""===s)return new Intl.DateTimeFormat(d).format(i);let h,k={},_=null,v=null;for(let t=0;t<b.length&&(h=v=b[t],k=n[h]||{},_=k[s],!g(_));t++)C(e,s,h,0,"datetime format");if(!g(_)||!c(h))return r?-1:s;let y=`${h}__${s}`;a(f)||(y=`${y}__${JSON.stringify(f)}`);let w=l.get(y);return w||(w=new Intl.DateTimeFormat(h,Object.assign({},_,f)),l.set(y,w)),p?w.formatToParts(i):w.format(i)}function Y(...e){const[t,r,a,o]=e;let l,s={},i={};if(c(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);l=new Date(t);try{l.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===p(t)){if(isNaN(t.getTime()))throw Error(13);l=t}else{if(!n(t))throw Error(12);l=t}return c(r)?s.key=r:g(r)&&(s=r),c(a)?s.locale=a:g(a)&&(i=a),g(o)&&(i=o),[s.key||"",l,s,i]}function ee(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function te(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o}=e,{__numberFormatters:l}=e,[s,i,m,f]=ne(...t),p=(u(m.missingWarn),u(m.fallbackWarn),!!m.part),d=c(m.locale)?m.locale:e.locale,b=I(e,o,d);if(!c(s)||""===s)return new Intl.NumberFormat(d).format(i);let h,k={},_=null,v=null;for(let t=0;t<b.length&&(h=v=b[t],k=n[h]||{},_=k[s],!g(_));t++)C(e,s,h,0,"number format");if(!g(_)||!c(h))return r?-1:s;let y=`${h}__${s}`;a(f)||(y=`${y}__${JSON.stringify(f)}`);let w=l.get(y);return w||(w=new Intl.NumberFormat(h,Object.assign({},_,f)),l.set(y,w)),p?w.formatToParts(i):w.format(i)}function ne(...e){const[t,r,a,o]=e;let l={},s={};if(!n(t))throw Error(12);const i=t;return c(r)?l.key=r:g(r)&&(l=r),c(a)?l.locale=a:g(a)&&(s=a),g(o)&&(s=o),[l.key||"",i,l,s]}function re(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}const ae={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},oe={"vue-i18n-resource-inspector":"Search for scopes ..."},le={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},se={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};function ie(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}}export{ae as DevToolsLabels,oe as DevToolsPlaceholders,le as DevToolsTimelineColors,se as DevToolsTimelineLayerMaps,k as MISSING_RESOLVE_VALUE,h as NOT_REOSLVED,S as clearCompileCache,ee as clearDateTimeFormat,re as clearNumberFormat,E as compileToFunction,y as createCoreContext,U as createCoreError,ie as createEmitter,X as datetime,q as errorMessages,I as getLocaleChain,b as getWarnMessage,C as handleMissing,w as isTranslateFallbackWarn,F as isTranslateMissingWarn,te as number,Y as parseDateTimeArgs,ne as parseNumberArgs,Q as parseTranslateArgs,v as registerMessageCompiler,B as translate,$ as updateFallbackLocale,d as warnMessages};
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===p(e),o=e=>g(e)&&0===Object.keys(e).length;function a(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function l(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const s=Array.isArray,c=e=>"function"==typeof e,i=e=>"string"==typeof e,u=e=>"boolean"==typeof e,m=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,p=e=>f.call(e),g=e=>"[object Object]"===p(e),d=[];d[0]={w:[0],i:[3,0],"[":[4],o:[7]},d[1]={w:[1],".":[2],"[":[4],o:[7]},d[2]={w:[2],i:[3,0],0:[3,0]},d[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},d[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},d[5]={"'":[4,0],o:8,l:[5,0]},d[6]={'"':[4,0],o:8,l:[6,0]};const b=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function h(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 k(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(b.test(t)?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)}function _(e){const t=[];let n,r,o,a,l,s,c,i=-1,u=0,m=0;const f=[];function p(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,o="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===r?r=o:r+=o},f[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===r)return!1;if(r=k(r),!1===r)return!1;f[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!p()){if(a=h(n),c=d[u],l=c[a]||c.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=f[l[1]],s&&(o=n,!1===s())))return;if(7===u)return t}}const w=new Map;function y(e,t){if(!m(e))return null;let n=w.get(t);if(n||(n=_(t),n&&w.set(t,n)),!n)return null;const r=n.length;let o=e,a=0;for(;a<r;){const e=o[n[a]];if(void 0===e)return null;o=e,a++}return o}const v=e=>e,F=e=>"",C="text",I=e=>0===e.length?"":e.join(""),W=e=>null==e?"":s(e)||g(e)&&e.toString===f?JSON.stringify(e,null,2):String(e);function O(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function $(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=m(e.pluralRules)&&i(t)&&c(e.pluralRules[t])?e.pluralRules[t]:O,a=m(e.pluralRules)&&i(t)&&c(e.pluralRules[t])?O:void 0,l=e.list||[],s=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,s);function u(t){const n=c(e.messages)?e.messages(t):!!m(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):F)}const f=g(e.processor)&&c(e.processor.normalize)?e.processor.normalize:I,p=g(e.processor)&&c(e.processor.interpolate)?e.processor.interpolate:W,d={list:e=>l[e],named:e=>s[e],plural:e=>e[o(r,e.length,a)],linked:(t,n)=>{const r=u(t)(d);return i(n)?(o=n,e.modifiers?e.modifiers[o]:v)(r):r;var o},message:u,type:g(e.processor)&&i(e.processor.type)?e.processor.type:"text",interpolate:p,normalize:f};return d}function M(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}const j={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function E(t,...n){return function(t,...n){return 1===n.length&&m(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(j[t],...n)}const R=-1,S="";let x;function N(e){x=e}function L(e={}){const t=i(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:s(e.fallbackLocale)||g(e.fallbackLocale)||i(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:g(e.messages)?e.messages:{[t]:{}},datetimeFormats:g(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:g(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>i(e)?e.toUpperCase():e,lower:e=>i(e)?e.toLowerCase():e,capitalize:e=>i(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:c(e.missing)?e.missing:null,missingWarn:!u(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,fallbackWarn:!u(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:c(e.postTranslation)?e.postTranslation:null,processor:g(e.processor)?e.processor:null,warnHtmlMessage:!u(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:c(e.messageCompiler)?e.messageCompiler:x,onWarn:c(e.onWarn)?e.onWarn:a,__datetimeFormatters:m(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:m(n.__numberFormatters)?n.__numberFormatters:new Map}}function T(e,t){return e instanceof RegExp?e.test(t):e}function P(e,t){return e instanceof RegExp?e.test(t):e}function A(e,t,n,r,o){const{missing:a}=e;if(null!==a){const r=a(e,n,t,o);return i(r)?r:t}return t}function z(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;s(e);)e=D(o,e,t);const a=s(t)?t:g(t)?t.default?t.default:null:t;e=i(a)?[a]:a,s(e)&&D(o,e,!1),r.__localeChainCache.set(n,o)}return o}function D(e,t,n){let r=!0;for(let o=0;o<t.length&&u(r);o++){i(t[o])&&(r=H(e,t[o],n))}return r}function H(e,t,n){let r;const o=t.split("-");do{r=V(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function V(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),(s(n)||g(n))&&n[o]&&(r=n[o])}return r}function J(e,t,n){e.__localeChainCache=new Map,z(e,n,t)}function U(){}function q(e,t={}){return()=>e}function K(e){return M(e,null,void 0)}const Z=()=>"",B=e=>c(e);function G(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:f,fallbackLocale:p}=e,[g,d]=X(...t),b=(u(d.missingWarn),u(d.fallbackWarn),u(d.escapeParameter)?d.escapeParameter:e.escapeParameter),h=i(d.default)||u(d.default)?u(d.default)?g:d.default:r?g:"",k=r||""!==h,_=i(d.locale)?d.locale:e.locale;b&&function(e){s(e.list)?e.list=e.list.map((e=>i(e)?l(e):e)):m(e.named)&&Object.keys(e.named).forEach((t=>{i(e.named[t])&&(e.named[t]=l(e.named[t]))}))}(d);let[w,v,F]=function(e,t,n,r,o,a){const{messages:l}=e,s=z(e,r,n);let u,m={},f=null,p=null;const g="translate";for(let n=0;n<s.length&&(u=p=s[n],m=l[u]||{},null===(f=y(m,t))&&(f=m[t]),!i(f)&&!c(f));n++){const n=A(e,t,u,0,g);n!==t&&(f=n)}return[f,u,m]}(e,g,_,p),C=g;if(i(w)||B(w)||k&&(w=h,C=w),!i(w)&&!B(w)||!i(v))return f?-1:g;if(i(w)&&null==e.messageCompiler)return a("Message format compilation is not supported in this build, because message compiler isn't included, you need to pre-compilation all message format."),g;let I=!1;const W=Q(e,g,v,w,C,(()=>{I=!0}));if(I)return w;const O=function(e,t,n){return t(n)}(0,W,$(function(e,t,r,o){const{modifiers:a,pluralRules:l}=e,s={locale:t,modifiers:a,pluralRules:l,messages:n=>{const o=y(r,n);if(i(o)){let r=!1;const a=Q(e,n,t,o,n,(()=>{r=!0}));return r?Z:a}return B(o)?o:Z}};e.processor&&(s.processor=e.processor);o.list&&(s.list=o.list);o.named&&(s.named=o.named);n(o.plural)&&(s.pluralIndex=o.plural);return s}(e,v,F,d)));return o?o(O):O}function Q(e,n,r,o,a,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(B(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const i=s(o,function(e,n,r,o,a,l){return{warnHtmlMessage:a,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,a,0,c,l));return i.locale=r,i.key=n,i.source=o,i}function X(...e){const[t,r,a]=e,l={};if(!i(t))throw Error(12);const c=t;return n(r)?l.plural=r:i(r)?l.default=r:g(r)&&!o(r)?l.named=r:s(r)&&(l.list=r),n(a)?l.plural=a:i(a)?l.default=a:g(a)&&Object.assign(l,a),[c,l]}function Y(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a}=e,{__datetimeFormatters:l}=e,[s,c,m,f]=ee(...t),p=(u(m.missingWarn),u(m.fallbackWarn),!!m.part),d=i(m.locale)?m.locale:e.locale,b=z(e,a,d);if(!i(s)||""===s)return new Intl.DateTimeFormat(d).format(c);let h,k={},_=null,w=null;for(let t=0;t<b.length&&(h=w=b[t],k=n[h]||{},_=k[s],!g(_));t++)A(e,s,h,0,"datetime format");if(!g(_)||!i(h))return r?-1:s;let y=`${h}__${s}`;o(f)||(y=`${y}__${JSON.stringify(f)}`);let v=l.get(y);return v||(v=new Intl.DateTimeFormat(h,Object.assign({},_,f)),l.set(y,v)),p?v.formatToParts(c):v.format(c)}function ee(...e){const[t,r,o,a]=e;let l,s={},c={};if(i(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);l=new Date(t);try{l.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===p(t)){if(isNaN(t.getTime()))throw Error(13);l=t}else{if(!n(t))throw Error(12);l=t}return i(r)?s.key=r:g(r)&&(s=r),i(o)?s.locale=o:g(o)&&(c=o),g(a)&&(c=a),[s.key||"",l,s,c]}function te(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function ne(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:a}=e,{__numberFormatters:l}=e,[s,c,m,f]=re(...t),p=(u(m.missingWarn),u(m.fallbackWarn),!!m.part),d=i(m.locale)?m.locale:e.locale,b=z(e,a,d);if(!i(s)||""===s)return new Intl.NumberFormat(d).format(c);let h,k={},_=null,w=null;for(let t=0;t<b.length&&(h=w=b[t],k=n[h]||{},_=k[s],!g(_));t++)A(e,s,h,0,"number format");if(!g(_)||!i(h))return r?-1:s;let y=`${h}__${s}`;o(f)||(y=`${y}__${JSON.stringify(f)}`);let v=l.get(y);return v||(v=new Intl.NumberFormat(h,Object.assign({},_,f)),l.set(y,v)),p?v.formatToParts(c):v.format(c)}function re(...e){const[t,r,o,a]=e;let l={},s={};if(!n(t))throw Error(12);const c=t;return i(r)?l.key=r:g(r)&&(l=r),i(o)?l.locale=o:g(o)&&(s=o),g(a)&&(s=a),[l.key||"",c,l,s]}function oe(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}const ae={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},le={"vue-i18n-resource-inspector":"Search for scopes ..."},se={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},ce={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};function ie(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}}export{C as DEFAULT_MESSAGE_DATA_TYPE,ae as DevToolsLabels,le as DevToolsPlaceholders,se as DevToolsTimelineColors,ce as DevToolsTimelineLayerMaps,S as MISSING_RESOLVE_VALUE,R as NOT_REOSLVED,U as clearCompileCache,te as clearDateTimeFormat,oe as clearNumberFormat,q as compileToFunction,M as createCompileError,L as createCoreContext,K as createCoreError,ie as createEmitter,$ as createMessageContext,Y as datetime,z as getLocaleChain,E as getWarnMessage,A as handleMissing,T as isTranslateFallbackWarn,P as isTranslateMissingWarn,ne as number,_ as parse,ee as parseDateTimeArgs,re as parseNumberArgs,X as parseTranslateArgs,N as registerMessageCompiler,y as resolveValue,G as translate,J as updateFallbackLocale};
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
import { format, isString, isArray, isPlainObject, isFunction, isBoolean, isRegExp, warn, isObject, escapeHtml, inBrowser, mark, measure, generateCodeFrame, generateFormatCacheKey, isNumber, isEmptyObject, isDate } from '@intlify/shared';
import { createCompileError } from '@intlify/message-compiler';
import { resolveValue } from '@intlify/message-resolver';
import { createMessageContext } from '@intlify/runtime';
/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (isString(val) ? val.toUpperCase() : val),
lower: (val) => (isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production')) {
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production')) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return isString(ret) ? ret : key;
}
else {
if ((process.env.NODE_ENV !== 'production') && isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback)
? fallback
: isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
/** @internal */
function clearCompileCache() {
}
/** @internal */
function compileToFunction(source, options = {}) {
{
(process.env.NODE_ENV !== 'production') &&
warn(`Runtime compilation is not supported in ${'core.runtime.esm-bundler.js' }.`);
return (() => source);
}
}
/** @internal */
function createCoreError(code) {
return createCompileError(code, null, (process.env.NODE_ENV !== 'production') ? { messages: errorMessages } : undefined);
}
/** @internal */
const errorMessages = {
[12 /* INVALID_ARGUMENT */]: 'Invalid arguments',
[13 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[14 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
};
const NOOP_MESSAGE_FUNCTION = () => '';
const isMessageFunction = (val) => isFunction(val);
// implementationo of `translate` function
/** @internal */
function translate(context, ...args) {
const { fallbackFormat, postTranslation, unresolving, fallbackLocale } = context;
const [key, options] = parseTranslateArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const escapeParameter = isBoolean(options.escapeParameter)
? options.escapeParameter
: context.escapeParameter;
// prettier-ignore
const defaultMsgOrKey = isString(options.default) || isBoolean(options.default) // default by function option
? !isBoolean(options.default)
? options.default
: key
: fallbackFormat // default by `fallbackFormat` option
? key
: '';
const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';
const locale = isString(options.locale) ? options.locale : context.locale;
// escape params
escapeParameter && escapeParams(options);
// resolve message format
// eslint-disable-next-line prefer-const
let [format, targetLocale, message] = resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn);
// if you use default message, set it as message format!
let cacheBaseKey = key;
if (!(isString(format) || isMessageFunction(format))) {
if (enableDefaultMsg) {
format = defaultMsgOrKey;
cacheBaseKey = format;
}
}
// checking message format and target locale
if (!(isString(format) || isMessageFunction(format)) ||
!isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
if ( isString(format) && context.messageCompiler == null) {
warn(`Message format compilation is not supported in this build, because message compiler isn't included, you need to pre-compilation all message format.`);
return key;
}
// setup compile error detecting
let occured = false;
const errorDetector = () => {
occured = true;
};
// compile message format
const msg = compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector);
// if occured compile error, return the message format
if (occured) {
return format;
}
// evaluate message with context
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
const msgContext = createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);
// if use post translation option, procee it with handler
return postTranslation ? postTranslation(messaged) : messaged;
}
function escapeParams(options) {
if (isArray(options.list)) {
options.list = options.list.map(item => isString(item) ? escapeHtml(item) : item);
}
else if (isObject(options.named)) {
Object.keys(options.named).forEach(key => {
if (isString(options.named[key])) {
options.named[key] = escapeHtml(options.named[key]);
}
});
}
}
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn } = context;
const locales = getLocaleChain(context, fallbackLocale, locale);
let message = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'translate';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if ((process.env.NODE_ENV !== 'production') &&
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(1 /* FALLBACK_TO_TRANSLATE */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
message =
messages[targetLocale] || {};
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-resolve-start';
endTag = 'intlify-message-resolve-end';
mark && mark(startTag);
}
if ((format = resolveValue(message, key)) === null) {
// if null, resolve with object key path
format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start && format) {
emitter.emit("message-resolve" /* MESSAGE_RESOLVE */, {
type: "message-resolve" /* MESSAGE_RESOLVE */,
key,
message: format,
time: end - start
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message resolve', startTag, endTag);
}
}
if (isString(format) || isFunction(format))
break;
const missingRet = handleMissing(context, key, targetLocale, missingWarn, type);
if (missingRet !== key) {
format = missingRet;
}
from = to;
}
return [format, targetLocale, message];
}
function compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector) {
const { messageCompiler, warnHtmlMessage } = context;
if (isMessageFunction(format)) {
const msg = format;
msg.locale = msg.locale || targetLocale;
msg.key = msg.key || key;
return msg;
}
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-compilation-start';
endTag = 'intlify-message-compilation-end';
mark && mark(startTag);
}
const msg = messageCompiler(format, getCompileOptions(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, errorDetector));
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-compilation" /* MESSAGE_COMPILATION */, {
type: "message-compilation" /* MESSAGE_COMPILATION */,
message: format,
time: end - start
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message compilation', startTag, endTag);
}
}
msg.locale = targetLocale;
msg.key = key;
msg.source = format;
return msg;
}
function evaluateMessage(context, msg, msgCtx) {
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-evaluation-start';
endTag = 'intlify-message-evaluation-end';
mark && mark(startTag);
}
const messaged = msg(msgCtx);
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-evaluation" /* MESSAGE_EVALUATION */, {
type: "message-evaluation" /* MESSAGE_EVALUATION */,
value: messaged,
time: end - start
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message evaluation', startTag, endTag);
}
}
return messaged;
}
/** @internal */
function parseTranslateArgs(...args) {
const [arg1, arg2, arg3] = args;
const options = {};
if (!isString(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const key = arg1;
if (isNumber(arg2)) {
options.plural = arg2;
}
else if (isString(arg2)) {
options.default = arg2;
}
else if (isPlainObject(arg2) && !isEmptyObject(arg2)) {
options.named = arg2;
}
else if (isArray(arg2)) {
options.list = arg2;
}
if (isNumber(arg3)) {
options.plural = arg3;
}
else if (isString(arg3)) {
options.default = arg3;
}
else if (isPlainObject(arg3)) {
Object.assign(options, arg3);
}
return [key, options];
}
function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) {
return {
warnHtmlMessage,
onError: (err) => {
errorDetector && errorDetector(err);
if ((process.env.NODE_ENV !== 'production')) {
const message = `Message compilation error: ${err.message}`;
const codeFrame = err.location &&
generateCodeFrame(source, err.location.start.offset, err.location.end.offset);
const emitter = context.__emitter;
if (emitter) {
emitter.emit("compile-error" /* COMPILE_ERROR */, {
message: source,
error: err.message,
start: err.location && err.location.start.offset,
end: err.location && err.location.end.offset
});
}
console.error(codeFrame ? `${message}\n${codeFrame}` : message);
}
else {
throw err;
}
},
onCacheKey: (source) => generateFormatCacheKey(locale, key, source)
};
}
function getMessageContextOptions(context, locale, message, options) {
const { modifiers, pluralRules } = context;
const resolveMessage = (key) => {
const val = resolveValue(message, key);
if (isString(val)) {
let occured = false;
const errorDetector = () => {
occured = true;
};
const msg = compileMessasgeFormat(context, key, locale, val, key, errorDetector);
return !occured
? msg
: NOOP_MESSAGE_FUNCTION;
}
else if (isMessageFunction(val)) {
return val;
}
else {
// TODO: should be implemented warning message
return NOOP_MESSAGE_FUNCTION;
}
};
const ctxOptions = {
locale,
modifiers,
pluralRules,
messages: resolveMessage
};
if (context.processor) {
ctxOptions.processor = context.processor;
}
if (options.list) {
ctxOptions.list = options.list;
}
if (options.named) {
ctxOptions.named = options.named;
}
if (isNumber(options.plural)) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
const intlDefined = typeof Intl !== 'undefined';
const Availabilities = {
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
};
// implementation of `datetime` function
/** @internal */
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { __datetimeFormatters } = context;
if ((process.env.NODE_ENV !== 'production') && !Availabilities.dateTimeFormat) {
onWarn(getWarnMessage(4 /* CANNOT_FORMAT_DATE */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseDateTimeArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!isString(key) || key === '') {
return new Intl.DateTimeFormat(locale).format(value);
}
// resolve format
let datetimeFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'datetime format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if ((process.env.NODE_ENV !== 'production') &&
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(5 /* FALLBACK_TO_DATE_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
datetimeFormat =
datetimeFormats[targetLocale] || {};
format = datetimeFormat[key];
if (isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!isPlainObject(format) || !isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __datetimeFormatters.get(id);
if (!formatter) {
formatter = new Intl.DateTimeFormat(targetLocale, Object.assign({}, format, orverrides));
__datetimeFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseDateTimeArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
let value;
if (isString(arg1)) {
// Only allow ISO strings - other date formats are often supported,
// but may cause different results in different browsers.
if (!/\d{4}-\d{2}-\d{2}(T.*)?/.test(arg1)) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
value = new Date(arg1);
try {
// This will fail if the date is not valid
value.toISOString();
}
catch (e) {
throw createCoreError(14 /* INVALID_ISO_DATE_ARGUMENT */);
}
}
else if (isDate(arg1)) {
if (isNaN(arg1.getTime())) {
throw createCoreError(13 /* INVALID_DATE_ARGUMENT */);
}
value = arg1;
}
else if (isNumber(arg1)) {
value = arg1;
}
else {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
if (isString(arg2)) {
options.key = arg2;
}
else if (isPlainObject(arg2)) {
options = arg2;
}
if (isString(arg3)) {
options.locale = arg3;
}
else if (isPlainObject(arg3)) {
orverrides = arg3;
}
if (isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearDateTimeFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__datetimeFormatters.has(id)) {
continue;
}
context.__datetimeFormatters.delete(id);
}
}
// implementation of `number` function
/** @internal */
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { __numberFormatters } = context;
if ((process.env.NODE_ENV !== 'production') && !Availabilities.numberFormat) {
onWarn(getWarnMessage(2 /* CANNOT_FORMAT_NUMBER */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseNumberArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!isString(key) || key === '') {
return new Intl.NumberFormat(locale).format(value);
}
// resolve format
let numberFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'number format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if ((process.env.NODE_ENV !== 'production') &&
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(3 /* FALLBACK_TO_NUMBER_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to
});
}
}
numberFormat =
numberFormats[targetLocale] || {};
format = numberFormat[key];
if (isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!isPlainObject(format) || !isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __numberFormatters.get(id);
if (!formatter) {
formatter = new Intl.NumberFormat(targetLocale, Object.assign({}, format, orverrides));
__numberFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseNumberArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
if (!isNumber(arg1)) {
throw createCoreError(12 /* INVALID_ARGUMENT */);
}
const value = arg1;
if (isString(arg2)) {
options.key = arg2;
}
else if (isPlainObject(arg2)) {
options = arg2;
}
if (isString(arg3)) {
options.locale = arg3;
}
else if (isPlainObject(arg3)) {
orverrides = arg3;
}
if (isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearNumberFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__numberFormatters.has(id)) {
continue;
}
context.__numberFormatters.delete(id);
}
}
const DevToolsLabels = {
["vue-devtools-plugin-vue-i18n" /* PLUGIN */]: 'Vue I18n devtools',
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'I18n Resources',
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 'Vue I18n: Compile Errors',
["vue-i18n-missing" /* TIMELINE_MISSING */]: 'Vue I18n: Missing',
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 'Vue I18n: Fallback',
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 'Vue I18n: Performance'
};
const DevToolsPlaceholders = {
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'Search for scopes ...'
};
const DevToolsTimelineColors = {
["vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */]: 0xff0000,
["vue-i18n-missing" /* TIMELINE_MISSING */]: 0xffcd19,
["vue-i18n-fallback" /* TIMELINE_FALLBACK */]: 0xffcd19,
["vue-i18n-performance" /* TIMELINE_PERFORMANCE */]: 0xffcd19
};
const DevToolsTimelineLayerMaps = {
["compile-error" /* COMPILE_ERROR */]: "vue-i18n-compile-error" /* TIMELINE_COMPILE_ERROR */,
["missing" /* MISSING */]: "vue-i18n-missing" /* TIMELINE_MISSING */,
["fallback" /* FALBACK */]: "vue-i18n-fallback" /* TIMELINE_FALLBACK */,
["message-resolve" /* MESSAGE_RESOLVE */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-compilation" /* MESSAGE_COMPILATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */,
["message-evaluation" /* MESSAGE_EVALUATION */]: "vue-i18n-performance" /* TIMELINE_PERFORMANCE */
};
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
* - code url: https://github.com/developit/mitt/blob/master/src/index.ts
* - author: Jason Miller (https://github.com/developit)
* - license: MIT
*/
/**
* Create a event emitter
*
* @returns An event emitter
*/
function createEmitter() {
const events = new Map();
const emitter = {
events,
on(event, handler) {
const handlers = events.get(event);
const added = handlers && handlers.push(handler);
if (!added) {
events.set(event, [handler]);
}
},
off(event, handler) {
const handlers = events.get(event);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
emit(event, payload) {
(events.get(event) || [])
.slice()
.map(handler => handler(payload));
(events.get('*') || [])
.slice()
.map(handler => handler(event, payload));
}
};
return emitter;
}
export { DevToolsLabels, DevToolsPlaceholders, DevToolsTimelineColors, DevToolsTimelineLayerMaps, MISSING_RESOLVE_VALUE, NOT_REOSLVED, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCoreContext, createCoreError, createEmitter, datetime, errorMessages, getLocaleChain, getWarnMessage, handleMissing, isTranslateFallbackWarn, isTranslateMissingWarn, number, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerMessageCompiler, translate, updateFallbackLocale, warnMessages };
export * from '@intlify/core-base';
/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi

@@ -131,271 +131,2 @@ * Released under the MIT License.

/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (isString(val) ? val.toUpperCase() : val),
lower: (val) => (isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
{
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
{
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return isString(ret) ? ret : key;
}
else {
if ( isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback)
? fallback
: isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
/** @internal */
const errorMessages = {
// tokenizer error messages
[0 /* EXPECTED_TOKEN */]: `Expected token: '{0}'`,
[1 /* INVALID_TOKEN_IN_PLACEHOLDER */]: `Invalid token in placeholder: '{0}'`,
[2 /* UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER */]: `Unterminated single quote in placeholder`,
[3 /* UNKNOWN_ESCAPE_SEQUENCE */]: `Unknown escape sequence: \\{0}`,
[4 /* INVALID_UNICODE_ESCAPE_SEQUENCE */]: `Invalid unicode escape sequence: {0}`,
[5 /* UNBALANCED_CLOSING_BRACE */]: `Unbalanced closing brace`,
[6 /* UNTERMINATED_CLOSING_BRACE */]: `Unterminated closing brace`,
[7 /* EMPTY_PLACEHOLDER */]: `Empty placeholder`,
[8 /* NOT_ALLOW_NEST_PLACEHOLDER */]: `Not allowed nest placeholder`,
[9 /* INVALID_LINKED_FORMAT */]: `Invalid linked format`,
// parser error messages
[10 /* MUST_HAVE_MESSAGES_IN_PLURAL */]: `Plural must have messages`,
[11 /* UNEXPECTED_LEXICAL_ANALYSIS */]: `Unexpected lexical analysis in token: '{0}'`
};
/** @internal */
function createCompileError(code, loc, optinos = {}) {
const { domain, messages, args } = optinos;
const msg = format((messages || errorMessages)[code] || '', ...(args || []))
;
const error = new SyntaxError(String(msg));
error.code = code;
if (loc) {
error.location = loc;
}
error.domain = domain;
return error;
}
/** @internal */
function clearCompileCache() {
}
/** @internal */
function compileToFunction(source, options = {}) {
{
warn(`Runtime compilation is not supported in ${'core.runtime.global.js' }.`);
return (() => source);
}
}
const pathStateMachine = [];

@@ -741,2 +472,271 @@ pathStateMachine[0 /* BEFORE_PATH */] = {

/** @internal */
const errorMessages = {
// tokenizer error messages
[0 /* EXPECTED_TOKEN */]: `Expected token: '{0}'`,
[1 /* INVALID_TOKEN_IN_PLACEHOLDER */]: `Invalid token in placeholder: '{0}'`,
[2 /* UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER */]: `Unterminated single quote in placeholder`,
[3 /* UNKNOWN_ESCAPE_SEQUENCE */]: `Unknown escape sequence: \\{0}`,
[4 /* INVALID_UNICODE_ESCAPE_SEQUENCE */]: `Invalid unicode escape sequence: {0}`,
[5 /* UNBALANCED_CLOSING_BRACE */]: `Unbalanced closing brace`,
[6 /* UNTERMINATED_CLOSING_BRACE */]: `Unterminated closing brace`,
[7 /* EMPTY_PLACEHOLDER */]: `Empty placeholder`,
[8 /* NOT_ALLOW_NEST_PLACEHOLDER */]: `Not allowed nest placeholder`,
[9 /* INVALID_LINKED_FORMAT */]: `Invalid linked format`,
// parser error messages
[10 /* MUST_HAVE_MESSAGES_IN_PLURAL */]: `Plural must have messages`,
[11 /* UNEXPECTED_LEXICAL_ANALYSIS */]: `Unexpected lexical analysis in token: '{0}'`
};
/** @internal */
function createCompileError(code, loc, optinos = {}) {
const { domain, messages, args } = optinos;
const msg = format((messages || errorMessages)[code] || '', ...(args || []))
;
const error = new SyntaxError(String(msg));
error.code = code;
if (loc) {
error.location = loc;
}
error.domain = domain;
return error;
}
/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
/** @internal */
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
/** @internal */
const NOT_REOSLVED = -1;
/** @internal */
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (isString(val) ? val.toUpperCase() : val),
lower: (val) => (isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
/** @internal */
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
/** @internal */
function createCoreContext(options = {}) {
// setup options
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
{
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
{
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return isString(ret) ? ret : key;
}
else {
if ( isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback)
? fallback
: isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
/** @internal */
function clearCompileCache() {
}
/** @internal */
function compileToFunction(source, options = {}) {
{
warn(`Runtime compilation is not supported in ${'core.runtime.global.js' }.`);
return (() => source);
}
}
/** @internal */
function createCoreError(code) {

@@ -1394,2 +1394,3 @@ return createCompileError(code, null, { messages: errorMessages$1 } );

exports.DEFAULT_MESSAGE_DATA_TYPE = DEFAULT_MESSAGE_DATA_TYPE;
exports.DevToolsLabels = DevToolsLabels;

@@ -1405,7 +1406,8 @@ exports.DevToolsPlaceholders = DevToolsPlaceholders;

exports.compileToFunction = compileToFunction;
exports.createCompileError = createCompileError;
exports.createCoreContext = createCoreContext;
exports.createCoreError = createCoreError;
exports.createEmitter = createEmitter;
exports.createMessageContext = createMessageContext;
exports.datetime = datetime;
exports.errorMessages = errorMessages$1;
exports.getLocaleChain = getLocaleChain;

@@ -1417,2 +1419,3 @@ exports.getWarnMessage = getWarnMessage;

exports.number = number;
exports.parse = parse;
exports.parseDateTimeArgs = parseDateTimeArgs;

@@ -1422,5 +1425,5 @@ exports.parseNumberArgs = parseNumberArgs;

exports.registerMessageCompiler = registerMessageCompiler;
exports.resolveValue = resolveValue;
exports.translate = translate;
exports.updateFallbackLocale = updateFallbackLocale;
exports.warnMessages = warnMessages;

@@ -1427,0 +1430,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

/*!
* @intlify/core v9.0.0-beta.12
* @intlify/core v9.0.0-beta.13
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),a=e=>"[object RegExp]"===g(e),o=e=>d(e)&&0===Object.keys(e).length;function s(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function l(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const i=Array.isArray,c=e=>"function"==typeof e,u=e=>"string"==typeof e,m=e=>"boolean"==typeof e,f=e=>null!==e&&"object"==typeof e,p=Object.prototype.toString,g=e=>p.call(e),d=e=>"[object Object]"===g(e),b={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};let h;function v(e,t,n,r,a){const{missing:o}=e;if(null!==o){const r=o(e,n,t,a);return u(r)?r:t}return t}function _(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let a=r.__localeChainCache.get(n);if(!a){a=[];let e=[n];for(;i(e);)e=k(a,e,t);const o=i(t)?t:d(t)?t.default?t.default:null:t;e=u(o)?[o]:o,i(e)&&k(a,e,!1),r.__localeChainCache.set(n,a)}return a}function k(e,t,n){let r=!0;for(let a=0;a<t.length&&m(r);a++){u(t[a])&&(r=y(e,t[a],n))}return r}function y(e,t,n){let r;const a=t.split("-");do{r=w(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function w(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),(i(n)||d(n))&&n[a]&&(r=n[a])}return r}function F(e,t,n={}){const{domain:r}=n,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=r,a}const C=[];C[0]={w:[0],i:[3,0],"[":[4],o:[7]},C[1]={w:[1],".":[2],"[":[4],o:[7]},C[2]={w:[2],i:[3,0],0:[3,0]},C[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},C[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},C[5]={"'":[4,0],o:8,l:[5,0]},C[6]={'"':[4,0],o:8,l:[6,0]};const T=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function M(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 I(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(T.test(t)?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)}const O=new Map;function E(e,t){if(!f(e))return null;let n=O.get(t);if(n||(n=function(e){const t=[];let n,r,a,o,s,l,i,c=-1,u=0,m=0;const f=[];function p(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===r?r=a:r+=a},f[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===r)return!1;if(r=I(r),!1===r)return!1;f[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!p()){if(o=M(n),i=C[u],s=i[o]||i.l||8,8===s)return;if(u=s[0],void 0!==s[1]&&(l=f[s[1]],l&&(a=n,!1===l())))return;if(7===u)return t}}(t),n&&O.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=a[n[o]];if(void 0===e)return null;a=e,o++}return a}const W=e=>e,L=e=>"",S=e=>0===e.length?"":e.join(""),j=e=>null==e?"":i(e)||d(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function N(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function $(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),a=f(e.pluralRules)&&u(t)&&c(e.pluralRules[t])?e.pluralRules[t]:N,o=f(e.pluralRules)&&u(t)&&c(e.pluralRules[t])?N:void 0,s=e.list||[],l=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,l);function i(t){const n=c(e.messages)?e.messages(t):!!f(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):L)}const m=d(e.processor)&&c(e.processor.normalize)?e.processor.normalize:S,p=d(e.processor)&&c(e.processor.interpolate)?e.processor.interpolate:j,g={list:e=>s[e],named:e=>l[e],plural:e=>e[a(n,e.length,o)],linked:(t,n)=>{const r=i(t)(g);return u(n)?(a=n,e.modifiers?e.modifiers[a]:W)(r):r;var a},message:i,type:d(e.processor)&&u(e.processor.type)?e.processor.type:"text",interpolate:p,normalize:m};return g}const R={12:"Invalid arguments",13:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",14:"The argument provided is not a valid ISO date string"},D=()=>"",A=e=>c(e);function P(e,t,r,a,o,s){const{messageCompiler:l,warnHtmlMessage:i}=e;if(A(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}const c=l(a,function(e,t,r,a,o,s){return{warnHtmlMessage:o,onError:e=>{throw s&&s(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,o,0,i,s));return c.locale=r,c.key=t,c.source=a,c}function x(...e){const[t,n,a]=e,s={};if(!u(t))throw Error(12);const l=t;return r(n)?s.plural=n:u(n)?s.default=n:d(n)&&!o(n)?s.named=n:i(n)&&(s.list=n),r(a)?s.plural=a:u(a)?s.default=a:d(a)&&Object.assign(s,a),[l,s]}function V(...e){const[t,n,a,o]=e;let s,l={},i={};if(u(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);s=new Date(t);try{s.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===g(t)){if(isNaN(t.getTime()))throw Error(13);s=t}else{if(!r(t))throw Error(12);s=t}return u(n)?l.key=n:d(n)&&(l=n),u(a)?l.locale=a:d(a)&&(i=a),d(o)&&(i=o),[l.key||"",s,l,i]}function z(...e){const[t,n,a,o]=e;let s={},l={};if(!r(t))throw Error(12);const i=t;return u(n)?s.key=n:d(n)&&(s=n),u(a)?s.locale=a:d(a)&&(l=a),d(o)&&(l=o),[s.key||"",i,s,l]}const H={"vue-i18n-resource-inspector":"Search for scopes ..."},J={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},U={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};return e.DevToolsLabels={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},e.DevToolsPlaceholders=H,e.DevToolsTimelineColors=J,e.DevToolsTimelineLayerMaps=U,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCoreContext=function(e={}){const t=u(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:i(e.fallbackLocale)||d(e.fallbackLocale)||u(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:d(e.messages)?e.messages:{[t]:{}},datetimeFormats:d(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:d(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>u(e)?e.toUpperCase():e,lower:e=>u(e)?e.toLowerCase():e,capitalize:e=>u(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:c(e.missing)?e.missing:null,missingWarn:!m(e.missingWarn)&&!a(e.missingWarn)||e.missingWarn,fallbackWarn:!m(e.fallbackWarn)&&!a(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:c(e.postTranslation)?e.postTranslation:null,processor:d(e.processor)?e.processor:null,warnHtmlMessage:!m(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:c(e.messageCompiler)?e.messageCompiler:h,onWarn:c(e.onWarn)?e.onWarn:s,__datetimeFormatters:f(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:f(n.__numberFormatters)?n.__numberFormatters:new Map}},e.createCoreError=function(e){return F(e,null,void 0)},e.createEmitter=function(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}},e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a}=e,{__datetimeFormatters:s}=e,[l,i,c,f]=V(...t),p=(m(c.missingWarn),m(c.fallbackWarn),!!c.part),g=u(c.locale)?c.locale:e.locale,b=_(e,a,g);if(!u(l)||""===l)return new Intl.DateTimeFormat(g).format(i);let h,k={},y=null,w=null;for(let t=0;t<b.length&&(h=w=b[t],k=n[h]||{},y=k[l],!d(y));t++)v(e,l,h,0,"datetime format");if(!d(y)||!u(h))return r?-1:l;let F=`${h}__${l}`;o(f)||(F=`${F}__${JSON.stringify(f)}`);let C=s.get(F);return C||(C=new Intl.DateTimeFormat(h,Object.assign({},y,f)),s.set(F,C)),p?C.formatToParts(i):C.format(i)},e.errorMessages=R,e.getLocaleChain=_,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&f(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(b[e],...n)},e.handleMissing=v,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,fallbackLocale:a}=e,{__numberFormatters:s}=e,[l,i,c,f]=z(...t),p=(m(c.missingWarn),m(c.fallbackWarn),!!c.part),g=u(c.locale)?c.locale:e.locale,b=_(e,a,g);if(!u(l)||""===l)return new Intl.NumberFormat(g).format(i);let h,k={},y=null,w=null;for(let t=0;t<b.length&&(h=w=b[t],k=n[h]||{},y=k[l],!d(y));t++)v(e,l,h,0,"number format");if(!d(y)||!u(h))return r?-1:l;let F=`${h}__${l}`;o(f)||(F=`${F}__${JSON.stringify(f)}`);let C=s.get(F);return C||(C=new Intl.NumberFormat(h,Object.assign({},y,f)),s.set(F,C)),p?C.formatToParts(i):C.format(i)},e.parseDateTimeArgs=V,e.parseNumberArgs=z,e.parseTranslateArgs=x,e.registerMessageCompiler=function(e){h=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:a,unresolving:o,fallbackLocale:p}=e,[g,d]=x(...t),b=(m(d.missingWarn),m(d.fallbackWarn),m(d.escapeParameter)?d.escapeParameter:e.escapeParameter),h=u(d.default)||m(d.default)?m(d.default)?g:d.default:n?g:"",k=n||""!==h,y=u(d.locale)?d.locale:e.locale;b&&function(e){i(e.list)?e.list=e.list.map((e=>u(e)?l(e):e)):f(e.named)&&Object.keys(e.named).forEach((t=>{u(e.named[t])&&(e.named[t]=l(e.named[t]))}))}(d);let[w,F,C]=function(e,t,n,r,a,o){const{messages:s}=e,l=_(e,r,n);let i,m={},f=null,p=null;const g="translate";for(let n=0;n<l.length&&(i=p=l[n],m=s[i]||{},null===(f=E(m,t))&&(f=m[t]),!u(f)&&!c(f));n++){const n=v(e,t,i,0,g);n!==t&&(f=n)}return[f,i,m]}(e,g,y,p),T=g;if(u(w)||A(w)||k&&(w=h,T=w),!u(w)&&!A(w)||!u(F))return o?-1:g;if(u(w)&&null==e.messageCompiler)return s("Message format compilation is not supported in this build, because message compiler isn't included, you need to pre-compilation all message format."),g;let M=!1;const I=P(e,g,F,w,T,(()=>{M=!0}));if(M)return w;const O=function(e,t,n){return t(n)}(0,I,$(function(e,t,n,a){const{modifiers:o,pluralRules:s}=e,l={locale:t,modifiers:o,pluralRules:s,messages:r=>{const a=E(n,r);if(u(a)){let n=!1;const o=P(e,r,t,a,r,(()=>{n=!0}));return n?D:o}return A(a)?a:D}};e.processor&&(l.processor=e.processor);a.list&&(l.list=a.list);a.named&&(l.named=a.named);r(a.plural)&&(l.pluralIndex=a.plural);return l}(e,F,C,d)));return a?a(O):O},e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,_(e,n,t)},e.warnMessages=b,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),a=e=>"[object RegExp]"===g(e),o=e=>d(e)&&0===Object.keys(e).length;function l(e,t){if("undefined"!=typeof console){console.warn(`[${"intlify"}] `+e),t&&console.warn(t.stack)}}function s(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const i=Array.isArray,c=e=>"function"==typeof e,u=e=>"string"==typeof e,m=e=>"boolean"==typeof e,f=e=>null!==e&&"object"==typeof e,p=Object.prototype.toString,g=e=>p.call(e),d=e=>"[object Object]"===g(e),b=[];b[0]={w:[0],i:[3,0],"[":[4],o:[7]},b[1]={w:[1],".":[2],"[":[4],o:[7]},b[2]={w:[2],i:[3,0],0:[3,0]},b[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},b[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},b[5]={"'":[4,0],o:8,l:[5,0]},b[6]={'"':[4,0],o:8,l:[6,0]};const h=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function _(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 k(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(h.test(t)?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)}function v(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,m=0;const f=[];function p(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===r?r=a:r+=a},f[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===r)return!1;if(r=k(r),!1===r)return!1;f[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!p()){if(o=_(n),i=b[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=f[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const y=new Map;function w(e,t){if(!f(e))return null;let n=y.get(t);if(n||(n=v(t),n&&y.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=a[n[o]];if(void 0===e)return null;a=e,o++}return a}const F=e=>e,C=e=>"",T="text",E=e=>0===e.length?"":e.join(""),M=e=>null==e?"":i(e)||d(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function I(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function O(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),a=f(e.pluralRules)&&u(t)&&c(e.pluralRules[t])?e.pluralRules[t]:I,o=f(e.pluralRules)&&u(t)&&c(e.pluralRules[t])?I:void 0,l=e.list||[],s=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function i(t){const n=c(e.messages)?e.messages(t):!!f(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):C)}const m=d(e.processor)&&c(e.processor.normalize)?e.processor.normalize:E,p=d(e.processor)&&c(e.processor.interpolate)?e.processor.interpolate:M,g={list:e=>l[e],named:e=>s[e],plural:e=>e[a(n,e.length,o)],linked:(t,n)=>{const r=i(t)(g);return u(n)?(a=n,e.modifiers?e.modifiers[a]:F)(r):r;var a},message:i,type:d(e.processor)&&u(e.processor.type)?e.processor.type:T,interpolate:p,normalize:m};return g}function W(e,t,n={}){const{domain:r}=n,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=r,a}const L={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};let S;function A(e,t,n,r,a){const{missing:o}=e;if(null!==o){const r=o(e,n,t,a);return u(r)?r:t}return t}function N(e,t,n=""){const r=e;if(""===n)return[];r.__localeChainCache||(r.__localeChainCache=new Map);let a=r.__localeChainCache.get(n);if(!a){a=[];let e=[n];for(;i(e);)e=$(a,e,t);const o=i(t)?t:d(t)?t.default?t.default:null:t;e=u(o)?[o]:o,i(e)&&$(a,e,!1),r.__localeChainCache.set(n,a)}return a}function $(e,t,n){let r=!0;for(let a=0;a<t.length&&m(r);a++){u(t[a])&&(r=j(e,t[a],n))}return r}function j(e,t,n){let r;const a=t.split("-");do{r=R(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function R(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),(i(n)||d(n))&&n[a]&&(r=n[a])}return r}const D=()=>"",P=e=>c(e);function x(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(P(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}const c=s(a,function(e,t,r,a,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,o,0,i,l));return c.locale=r,c.key=t,c.source=a,c}function V(...e){const[t,n,a]=e,l={};if(!u(t))throw Error(12);const s=t;return r(n)?l.plural=n:u(n)?l.default=n:d(n)&&!o(n)?l.named=n:i(n)&&(l.list=n),r(a)?l.plural=a:u(a)?l.default=a:d(a)&&Object.assign(l,a),[s,l]}function z(...e){const[t,n,a,o]=e;let l,s={},i={};if(u(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(14);l=new Date(t);try{l.toISOString()}catch(e){throw Error(14)}}else if("[object Date]"===g(t)){if(isNaN(t.getTime()))throw Error(13);l=t}else{if(!r(t))throw Error(12);l=t}return u(n)?s.key=n:d(n)&&(s=n),u(a)?s.locale=a:d(a)&&(i=a),d(o)&&(i=o),[s.key||"",l,s,i]}function H(...e){const[t,n,a,o]=e;let l={},s={};if(!r(t))throw Error(12);const i=t;return u(n)?l.key=n:d(n)&&(l=n),u(a)?l.locale=a:d(a)&&(s=a),d(o)&&(s=o),[l.key||"",i,l,s]}const U={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-compile-error":"Vue I18n: Compile Errors","vue-i18n-missing":"Vue I18n: Missing","vue-i18n-fallback":"Vue I18n: Fallback","vue-i18n-performance":"Vue I18n: Performance"},J={"vue-i18n-resource-inspector":"Search for scopes ..."},G={"vue-i18n-compile-error":16711680,"vue-i18n-missing":16764185,"vue-i18n-fallback":16764185,"vue-i18n-performance":16764185},q={"compile-error":"vue-i18n-compile-error",missing:"vue-i18n-missing",fallback:"vue-i18n-fallback","message-resolve":"vue-i18n-performance","message-compilation":"vue-i18n-performance","message-evaluation":"vue-i18n-performance"};return e.DEFAULT_MESSAGE_DATA_TYPE=T,e.DevToolsLabels=U,e.DevToolsPlaceholders=J,e.DevToolsTimelineColors=G,e.DevToolsTimelineLayerMaps=q,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCompileError=W,e.createCoreContext=function(e={}){const t=u(e.locale)?e.locale:"en-US",n=e;return{locale:t,fallbackLocale:i(e.fallbackLocale)||d(e.fallbackLocale)||u(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,messages:d(e.messages)?e.messages:{[t]:{}},datetimeFormats:d(e.datetimeFormats)?e.datetimeFormats:{[t]:{}},numberFormats:d(e.numberFormats)?e.numberFormats:{[t]:{}},modifiers:Object.assign({},e.modifiers||{},{upper:e=>u(e)?e.toUpperCase():e,lower:e=>u(e)?e.toLowerCase():e,capitalize:e=>u(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),pluralRules:e.pluralRules||{},missing:c(e.missing)?e.missing:null,missingWarn:!m(e.missingWarn)&&!a(e.missingWarn)||e.missingWarn,fallbackWarn:!m(e.fallbackWarn)&&!a(e.fallbackWarn)||e.fallbackWarn,fallbackFormat:!!e.fallbackFormat,unresolving:!!e.unresolving,postTranslation:c(e.postTranslation)?e.postTranslation:null,processor:d(e.processor)?e.processor:null,warnHtmlMessage:!m(e.warnHtmlMessage)||e.warnHtmlMessage,escapeParameter:!!e.escapeParameter,messageCompiler:c(e.messageCompiler)?e.messageCompiler:S,onWarn:c(e.onWarn)?e.onWarn:l,__datetimeFormatters:f(n.__datetimeFormatters)?n.__datetimeFormatters:new Map,__numberFormatters:f(n.__numberFormatters)?n.__numberFormatters:new Map}},e.createCoreError=function(e){return W(e,null,void 0)},e.createEmitter=function(){const e=new Map;return{events:e,on(t,n){const r=e.get(t);r&&r.push(n)||e.set(t,[n])},off(t,n){const r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>e(n))),(e.get("*")||[]).slice().map((e=>e(t,n)))}}},e.createMessageContext=O,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a}=e,{__datetimeFormatters:l}=e,[s,i,c,f]=z(...t),p=(m(c.missingWarn),m(c.fallbackWarn),!!c.part),g=u(c.locale)?c.locale:e.locale,b=N(e,a,g);if(!u(s)||""===s)return new Intl.DateTimeFormat(g).format(i);let h,_={},k=null,v=null;for(let t=0;t<b.length&&(h=v=b[t],_=n[h]||{},k=_[s],!d(k));t++)A(e,s,h,0,"datetime format");if(!d(k)||!u(h))return r?-1:s;let y=`${h}__${s}`;o(f)||(y=`${y}__${JSON.stringify(f)}`);let w=l.get(y);return w||(w=new Intl.DateTimeFormat(h,Object.assign({},k,f)),l.set(y,w)),p?w.formatToParts(i):w.format(i)},e.getLocaleChain=N,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&f(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(L[e],...n)},e.handleMissing=A,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,fallbackLocale:a}=e,{__numberFormatters:l}=e,[s,i,c,f]=H(...t),p=(m(c.missingWarn),m(c.fallbackWarn),!!c.part),g=u(c.locale)?c.locale:e.locale,b=N(e,a,g);if(!u(s)||""===s)return new Intl.NumberFormat(g).format(i);let h,_={},k=null,v=null;for(let t=0;t<b.length&&(h=v=b[t],_=n[h]||{},k=_[s],!d(k));t++)A(e,s,h,0,"number format");if(!d(k)||!u(h))return r?-1:s;let y=`${h}__${s}`;o(f)||(y=`${y}__${JSON.stringify(f)}`);let w=l.get(y);return w||(w=new Intl.NumberFormat(h,Object.assign({},k,f)),l.set(y,w)),p?w.formatToParts(i):w.format(i)},e.parse=v,e.parseDateTimeArgs=z,e.parseNumberArgs=H,e.parseTranslateArgs=V,e.registerMessageCompiler=function(e){S=e},e.resolveValue=w,e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:a,unresolving:o,fallbackLocale:p}=e,[g,d]=V(...t),b=(m(d.missingWarn),m(d.fallbackWarn),m(d.escapeParameter)?d.escapeParameter:e.escapeParameter),h=u(d.default)||m(d.default)?m(d.default)?g:d.default:n?g:"",_=n||""!==h,k=u(d.locale)?d.locale:e.locale;b&&function(e){i(e.list)?e.list=e.list.map((e=>u(e)?s(e):e)):f(e.named)&&Object.keys(e.named).forEach((t=>{u(e.named[t])&&(e.named[t]=s(e.named[t]))}))}(d);let[v,y,F]=function(e,t,n,r,a,o){const{messages:l}=e,s=N(e,r,n);let i,m={},f=null,p=null;const g="translate";for(let n=0;n<s.length&&(i=p=s[n],m=l[i]||{},null===(f=w(m,t))&&(f=m[t]),!u(f)&&!c(f));n++){const n=A(e,t,i,0,g);n!==t&&(f=n)}return[f,i,m]}(e,g,k,p),C=g;if(u(v)||P(v)||_&&(v=h,C=v),!u(v)&&!P(v)||!u(y))return o?-1:g;if(u(v)&&null==e.messageCompiler)return l("Message format compilation is not supported in this build, because message compiler isn't included, you need to pre-compilation all message format."),g;let T=!1;const E=x(e,g,y,v,C,(()=>{T=!0}));if(T)return v;const M=function(e,t,n){return t(n)}(0,E,O(function(e,t,n,a){const{modifiers:o,pluralRules:l}=e,s={locale:t,modifiers:o,pluralRules:l,messages:r=>{const a=w(n,r);if(u(a)){let n=!1;const o=x(e,r,t,a,r,(()=>{n=!0}));return n?D:o}return P(a)?a:D}};e.processor&&(s.processor=e.processor);a.list&&(s.list=a.list);a.named&&(s.named=a.named);r(a.plural)&&(s.pluralIndex=a.plural);return s}(e,y,F,d)));return a?a(M):M},e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,N(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
{
"name": "@intlify/core",
"version": "9.0.0-beta.12",
"version": "9.0.0-beta.13",
"description": "@intlify/core",

@@ -33,6 +33,3 @@ "keywords": [

"dependencies": {
"@intlify/message-compiler": "9.0.0-beta.12",
"@intlify/message-resolver": "9.0.0-beta.12",
"@intlify/runtime": "9.0.0-beta.12",
"@intlify/shared": "9.0.0-beta.12"
"@intlify/core-base": "9.0.0-beta.13"
},

@@ -39,0 +36,0 @@ "engines": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc