@intlify/core
Advanced tools
Comparing version 9.3.0-beta.17 to 9.3.0-beta.18
/*! | ||
* core v9.3.0-beta.17 | ||
* core v9.3.0-beta.18 | ||
* (c) 2023 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,r)=>t.hasOwnProperty(r)?t[r]:""))}const generateFormatCacheKey=(e,t,r)=>friendlyJSONstringify({l:e,k:t,s:r}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length;function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>"[object Object]"===toTypeString(e),toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e),CompileErrorCodes={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function createCompileError(e,t,r={}){const{domain:n,messages:o,args:s}=r,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=n,a}function defaultOnError(e){throw e}function createPosition(e,t,r){return{line:e,column:t,offset:r}}function createLocation(e,t,r){const n={start:e,end:t};return null!=r&&(n.source=r),n}CompileErrorCodes.EXPECTED_TOKEN,CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,CompileErrorCodes.UNBALANCED_CLOSING_BRACE,CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,CompileErrorCodes.EMPTY_PLACEHOLDER,CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,CompileErrorCodes.INVALID_LINKED_FORMAT,CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS;const CHAR_SP=" ",CHAR_CR="\r",CHAR_LF="\n",CHAR_LS=String.fromCharCode(8232),CHAR_PS=String.fromCharCode(8233);function createScanner(e){const t=e;let r=0,n=1,o=1,s=0;const a=e=>t[e]===CHAR_CR&&t[e+1]===CHAR_LF,i=e=>t[e]===CHAR_PS,c=e=>t[e]===CHAR_LS,l=e=>a(e)||(e=>t[e]===CHAR_LF)(e)||i(e)||c(e),u=e=>a(e)||i(e)||c(e)?CHAR_LF:t[e];function E(){return s=0,l(r)&&(n++,o=0),a(r)&&r++,r++,o++,t[r]}return{index:()=>r,line:()=>n,column:()=>o,peekOffset:()=>s,charAt:u,currentChar:()=>u(r),currentPeek:()=>u(r+s),next:E,peek:function(){return a(r+s)&&s++,s++,t[r+s]},reset:function(){r=0,n=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=r+s;for(;e!==r;)E();s=0}}}const EOF=void 0,LITERAL_DELIMITER="'",ERROR_DOMAIN$1="tokenizer";function createTokenizer(e,t={}){const r=!1!==t.location,n=createScanner(e),o=()=>n.index(),s=()=>createPosition(n.line(),n.column(),n.index()),a=s(),i=o(),c={currentType:14,offset:i,startLoc:a,endLoc:a,lastType:14,lastOffset:i,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},l=()=>c,{onError:u}=t;function E(e,t,n){e.endLoc=s(),e.currentType=t;const o={type:t};return r&&(o.loc=createLocation(e.startLoc,e.endLoc)),null!=n&&(o.value=n),o}const f=e=>E(e,14);function C(e,t){return e.currentChar()===t?(e.next(),t):(CompileErrorCodes.EXPECTED_TOKEN,s(),"")}function p(e){let t="";for(;e.currentPeek()===CHAR_SP||e.currentPeek()===CHAR_LF;)t+=e.currentPeek(),e.peek();return t}function m(e){const t=p(e);return e.skipToPeek(),t}function _(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function d(e,t){const{currentType:r}=t;if(2!==r)return!1;p(e);const n=function(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),n}function g(e){p(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function T(e,t=!0){const r=(t=!1,n="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==n&&t:"@"!==s&&s?"%"===s?(e.peek(),r(t,"%",!0)):"|"===s?!("%"!==n&&!o)||!(n===CHAR_SP||n===CHAR_LF):s===CHAR_SP?(e.peek(),r(!0,CHAR_SP,o)):s!==CHAR_LF||(e.peek(),r(!0,CHAR_LF,o)):"%"===n||t},n=r();return t&&e.resetPeek(),n}function A(e,t){const r=e.currentChar();return r===EOF?EOF:t(r)?(e.next(),r):null}function N(e){return A(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 L(e){return A(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function S(e){return A(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function O(e){let t="",r="";for(;t=L(e);)r+=t;return r}function b(e){let t="";for(;;){const r=e.currentChar();if("{"===r||"}"===r||"@"===r||"|"===r||!r)break;if("%"===r){if(!T(e))break;t+=r,e.next()}else if(r===CHAR_SP||r===CHAR_LF)if(T(e))t+=r,e.next();else{if(g(e))break;t+=r,e.next()}else t+=r,e.next()}return t}function h(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return k(e,t,4);case"U":return k(e,t,6);default:return CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,s(),""}}function k(e,t,r){C(e,t);let n="";for(let o=0;o<r;o++){const t=S(e);if(!t){CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),e.currentChar();break}n+=t}return`\\${t}${n}`}function I(e){m(e);const t=C(e,"|");return m(e),t}function D(e,t){let r=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,s()),e.next(),r=E(t,2,"{"),m(e),t.braceNest++,r;case"}":return t.braceNest>0&&2===t.currentType&&(CompileErrorCodes.EMPTY_PLACEHOLDER,s()),e.next(),r=E(t,3,"}"),t.braceNest--,t.braceNest>0&&m(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),r;case"@":return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=P(e,t)||f(t),t.braceNest=0,r;default:let n=!0,o=!0,a=!0;if(g(e))return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=E(t,1,I(e)),t.braceNest=0,t.inLinked=!1,r;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),t.braceNest=0,F(e,t);if(n=function(e,t){const{currentType:r}=t;if(2!==r)return!1;p(e);const n=_(e.currentPeek());return e.resetPeek(),n}(e,t))return r=E(t,5,function(e){m(e);let t="",r="";for(;t=N(e);)r+=t;return e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r}(e)),m(e),r;if(o=d(e,t))return r=E(t,6,function(e){m(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${O(e)}`):t+=O(e),e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),t}(e)),m(e),r;if(a=function(e,t){const{currentType:r}=t;if(2!==r)return!1;p(e);const n=e.currentPeek()===LITERAL_DELIMITER;return e.resetPeek(),n}(e,t))return r=E(t,7,function(e){m(e),C(e,"'");let t="",r="";const n=e=>e!==LITERAL_DELIMITER&&e!==CHAR_LF;for(;t=A(e,n);)r+="\\"===t?h(e):t;const o=e.currentChar();return o===CHAR_LF||o===EOF?(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),o===CHAR_LF&&(e.next(),C(e,"'")),r):(C(e,"'"),r)}(e)),m(e),r;if(!n&&!o&&!a)return r=E(t,13,function(e){m(e);let t="",r="";const n=e=>"{"!==e&&"}"!==e&&e!==CHAR_SP&&e!==CHAR_LF;for(;t=A(e,n);)r+=t;return r}(e)),CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,s(),r.value,m(e),r}return r}function P(e,t){const{currentType:r}=t;let n=null;const o=e.currentChar();switch(8!==r&&9!==r&&12!==r&&10!==r||o!==CHAR_LF&&o!==CHAR_SP||(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),o){case"@":return e.next(),n=E(t,8,"@"),t.inLinked=!0,n;case".":return m(e),e.next(),E(t,9,".");case":":return m(e),e.next(),E(t,10,":");default:return g(e)?(n=E(t,1,I(e)),t.braceNest=0,t.inLinked=!1,n):function(e,t){const{currentType:r}=t;if(8!==r)return!1;p(e);const n="."===e.currentPeek();return e.resetPeek(),n}(e,t)||function(e,t){const{currentType:r}=t;if(8!==r&&12!==r)return!1;p(e);const n=":"===e.currentPeek();return e.resetPeek(),n}(e,t)?(m(e),P(e,t)):function(e,t){const{currentType:r}=t;if(9!==r)return!1;p(e);const n=_(e.currentPeek());return e.resetPeek(),n}(e,t)?(m(e),E(t,12,function(e){let t="",r="";for(;t=N(e);)r+=t;return r}(e))):function(e,t){const{currentType:r}=t;if(10!==r)return!1;const n=()=>{const t=e.currentPeek();return"{"===t?_(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===CHAR_SP||!t)&&(t===CHAR_LF?(e.peek(),n()):_(t))},o=n();return e.resetPeek(),o}(e,t)?(m(e),"{"===o?D(e,t)||n:E(t,11,function(e){const t=(r=!1,n)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===CHAR_SP?n:o===CHAR_LF?(n+=o,e.next(),t(r,n)):(n+=o,e.next(),t(!0,n)):n};return t(!1,"")}(e))):(8===r&&(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),t.braceNest=0,t.inLinked=!1,F(e,t))}}function F(e,t){let r={type:14};if(t.braceNest>0)return D(e,t)||f(t);if(t.inLinked)return P(e,t)||f(t);switch(e.currentChar()){case"{":return D(e,t)||f(t);case"}":return CompileErrorCodes.UNBALANCED_CLOSING_BRACE,s(),e.next(),E(t,3,"}");case"@":return P(e,t)||f(t);default:if(g(e))return r=E(t,1,I(e)),t.braceNest=0,t.inLinked=!1,r;const{isModulo:n,hasSpace:o}=function(e){const t=p(e),r="%"===e.currentPeek()&&"{"===e.peek();return e.resetPeek(),{isModulo:r,hasSpace:t.length>0}}(e);if(n)return o?E(t,0,b(e)):E(t,4,function(e){m(e);const t=e.currentChar();return"%"!==t&&(CompileErrorCodes.EXPECTED_TOKEN,s()),e.next(),"%"}(e));if(T(e))return E(t,0,b(e))}return r}return{nextToken:function(){const{currentType:e,offset:t,startLoc:r,endLoc:a}=c;return c.lastType=e,c.lastOffset=t,c.lastStartLoc=r,c.lastEndLoc=a,c.offset=o(),c.startLoc=s(),n.currentChar()===EOF?E(c,14):F(n,c)},currentOffset:o,currentPosition:s,context:l}}const ERROR_DOMAIN="parser",KNOWN_ESCAPES=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function fromEscapeSequence(e,t,r){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||r,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function createParser(e={}){const t=!1!==e.location,{onError:r}=e;function n(e,r,n){const o={type:e,start:r,end:r};return t&&(o.loc={start:n,end:n}),o}function o(e,r,n,o){e.end=r,o&&(e.type=o),t&&e.loc&&(e.loc.end=n)}function s(e,t){const r=e.context(),s=n(3,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function a(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(5,s,a);return i.index=parseInt(t,10),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function i(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(4,s,a);return i.key=t,e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function c(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(9,s,a);return i.value=t.replace(KNOWN_ESCAPES,fromEscapeSequence),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function l(e){const t=e.context(),r=n(6,t.offset,t.startLoc);let s=e.nextToken();if(9===s.type){const t=function(e){const t=e.nextToken(),r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(8,s,a);return 12!==t.type?(CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,r.lastStartLoc,i.value="",o(i,s,a),{nextConsumeToken:t,node:i}):(null==t.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,r.lastStartLoc,getTokenCaption(t)),i.value=t.value||"",o(i,e.currentOffset(),e.currentPosition()),{node:i})}(e);r.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(10!==s.type&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=function(e,t){const r=e.context(),s=n(7,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=i(e,s.value||"");break;case 6:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=a(e,s.value||"");break;case 7:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=c(e,s.value||"");break;default:CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const l=e.context(),u=n(7,l.offset,l.startLoc);return u.value="",o(u,l.offset,l.startLoc),r.key=u,o(r,l.offset,l.startLoc),{nextConsumeToken:s,node:r}}return o(r,e.currentOffset(),e.currentPosition()),{node:r}}function u(e){const t=e.context(),r=n(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);r.items=[];let u=null;do{const n=u||e.nextToken();switch(u=null,n.type){case 0:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(s(e,n.value||""));break;case 6:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(a(e,n.value||""));break;case 5:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(i(e,n.value||""));break;case 7:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(c(e,n.value||""));break;case 8:const o=l(e);r.items.push(o.node),u=o.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(r,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),r}function E(e){const t=e.context(),{offset:r,startLoc:s}=t,a=u(e);return 14===t.currentType?a:function(e,t,r,s){const a=e.context();let i=0===s.items.length;const c=n(1,t,r);c.cases=[],c.cases.push(s);do{const t=u(e);i||(i=0===t.items.length),c.cases.push(t)}while(14!==a.currentType);return i&&CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,o(c,e.currentOffset(),e.currentPosition()),c}(e,r,s,a)}return{parse:function(r){const s=createTokenizer(r,assign({},e)),a=s.context(),i=n(0,a.offset,a.startLoc);return t&&i.loc&&(i.loc.source=r),i.body=E(s),14!==a.currentType&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,r[a.offset]),o(i,s.currentOffset(),s.currentPosition()),i}}}function getTokenCaption(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function createTransformer(e,t={}){const r={ast:e,helpers:new Set};return{context:()=>r,helper:e=>(r.helpers.add(e),e)}}function traverseNodes(e,t){for(let r=0;r<e.length;r++)traverseNode(e[r],t)}function traverseNode(e,t){switch(e.type){case 1:traverseNodes(e.cases,t),t.helper("plural");break;case 2:traverseNodes(e.items,t);break;case 6:traverseNode(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function transform(e,t={}){const r=createTransformer(e);r.helper("normalize"),e.body&&traverseNode(e.body,r);const n=r.context();e.helpers=Array.from(n.helpers)}function createCodeGenerator(e,t){const{sourceMap:r,filename:n,breakLineCode:o,needIndent:s}=t,a={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:s,indentLevel:0};function i(e,t){a.code+=e}function c(e,t=!0){const r=t?o:"";i(s?r+" ".repeat(e):r)}return{context:()=>a,push:i,indent:function(e=!0){const t=++a.indentLevel;e&&c(t)},deindent:function(e=!0){const t=--a.indentLevel;e&&c(t)},newline:function(){c(a.indentLevel)},helper:e=>`_${e}`,needIndent:()=>a.needIndent}}function generateLinkedNode(e,t){const{helper:r}=e;e.push(`${r("linked")}(`),generateNode(e,t.key),t.modifier?(e.push(", "),generateNode(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}function generateMessageNode(e,t){const{helper:r,needIndent:n}=e;e.push(`${r("normalize")}([`),e.indent(n());const o=t.items.length;for(let s=0;s<o&&(generateNode(e,t.items[s]),s!==o-1);s++)e.push(", ");e.deindent(n()),e.push("])")}function generatePluralNode(e,t){const{helper:r,needIndent:n}=e;if(t.cases.length>1){e.push(`${r("plural")}([`),e.indent(n());const o=t.cases.length;for(let r=0;r<o&&(generateNode(e,t.cases[r]),r!==o-1);r++)e.push(", ");e.deindent(n()),e.push("])")}}function generateResource(e,t){t.body?generateNode(e,t.body):e.push("null")}function generateNode(e,t){const{helper:r}=e;switch(t.type){case 0:generateResource(e,t);break;case 1:generatePluralNode(e,t);break;case 2:generateMessageNode(e,t);break;case 6:generateLinkedNode(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${r("interpolate")}(${r("list")}(${t.index}))`,t);break;case 4:e.push(`${r("interpolate")}(${r("named")}(${JSON.stringify(t.key)}))`,t)}}const generate=(e,t={})=>{const r=isString(t.mode)?t.mode:"normal",n=isString(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,s=null!=t.breakLineCode?t.breakLineCode:"arrow"===r?";":"\n",a=t.needIndent?t.needIndent:"arrow"!==r,i=e.helpers||[],c=createCodeGenerator(e,{mode:r,filename:n,sourceMap:o,breakLineCode:s,needIndent:a});c.push("normal"===r?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(a),i.length>0&&(c.push(`const { ${i.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),generateNode(c,e),c.deindent(a),c.push("}");const{code:l,map:u}=c.context();return{ast:e,code:l,map:u?u.toJSON():void 0}};function baseCompile(e,t={}){const r=assign({},t),n=createParser(r).parse(e);return transform(n,r),generate(n,r)}const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let r,n,o,s,a,i,c,l=-1,u=0,E=0;const f=[];function C(){const t=e[l+1];if(5===u&&"'"===t||6===u&&'"'===t)return l++,o="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===n?n=o:n+=o},f[1]=()=>{void 0!==n&&(t.push(n),n=void 0)},f[2]=()=>{f[0](),E++},f[3]=()=>{if(E>0)E--,u=4,f[0]();else{if(E=0,void 0===n)return!1;if(n=formatSubPath(n),!1===n)return!1;f[1]()}};null!==u;)if(l++,r=e[l],"\\"!==r||!C()){if(s=getPathCharType(r),c=pathStateMachine[u],a=c[s]||c.l||8,8===a)return;if(u=a[0],void 0!==a[1]&&(i=f[a[1]],i&&(o=r,!1===i())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let r=cache.get(t);if(r||(r=parse(t),r&&cache.set(t,r)),!r)return null;const n=r.length;let o=e,s=0;for(;s<n;){const e=o[r[s]];if(void 0===e)return null;o=e,s++}return o}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":e.join(""),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,r=getPluralIndex(e),n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,o=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],a=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(r,a);function i(t){const r=isFunction(e.messages)?e.messages(t):!!isObject(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const c=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,l=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>a[e],plural:e=>e[n(r,e.length,o)],linked:(t,...r)=>{const[n,o]=r;let s="text",a="";1===r.length?isObject(n)?(a=n.modifier||a,s=n.type||s):isString(n)&&(a=n||a):2===r.length&&(isString(n)&&(a=n||a),isString(o)&&(s=o||s));let c=i(t)(u);return"vnode"===s&&isArray(c)&&a&&(c=c[0]),a?(l=a,e.modifiers?e.modifiers[l]:DEFAULT_MODIFIER)(c,s):c;var l},message:i,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:l,normalize:c};return u}const IntlifyDevToolsHooks={I18nInit:"i18n:init",FunctionTranslate:"function:translate"};let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,r){devtools&&devtools.emit(IntlifyDevToolsHooks.I18nInit,{timestamp:Date.now(),i18n:e,version:t,meta:r})}const translateDevTools=createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate);function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreWarnCodes={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function getWarnMessage(e,...t){return format(warnMessages[e],...t)}function fallbackWithSimple(e,t,r){return[...new Set([r,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[r]])]}function fallbackWithLocaleChain(e,t,r){const n=isString(r)?r:DEFAULT_LOCALE,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(n);if(!s){s=[];let e=[r];for(;isArray(e);)e=appendBlockToChain(s,e,t);const a=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(a)?[a]:a,isArray(e)&&appendBlockToChain(s,e,!1),o.__localeChainCache.set(n,s)}return s}function appendBlockToChain(e,t,r){let n=!0;for(let o=0;o<t.length&&isBoolean(n);o++){const s=t[o];isString(s)&&(n=appendLocaleToChain(e,t[o],r))}return n}function appendLocaleToChain(e,t,r){let n;const o=t.split("-");do{n=appendItemToChain(e,o.join("-"),r),o.splice(-1,1)}while(o.length&&!0===n);return n}function appendItemToChain(e,t,r){let n=!1;if(!e.includes(t)&&(n=!0,t)){n="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(isArray(r)||isPlainObject(r))&&r[o]&&(n=r[o])}return n}const VERSION="9.3.0-beta.17",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isString(e.version)?e.version:VERSION,r=isString(e.locale)?e.locale:DEFAULT_LOCALE,n=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:r,o=isPlainObject(e.messages)?e.messages:{[r]:{}},s=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[r]:{}},a=isPlainObject(e.numberFormats)?e.numberFormats:{[r]:{}},i=assign({},e.modifiers||{},getDefaultLinkedModifiers()),c=e.pluralRules||{},l=isFunction(e.missing)?e.missing:null,u=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,E=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,f=!!e.fallbackFormat,C=!!e.unresolving,p=isFunction(e.postTranslation)?e.postTranslation:null,m=isPlainObject(e.processor)?e.processor:null,_=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,d=!!e.escapeParameter,g=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,T=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,A=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,N=isObject(e.fallbackContext)?e.fallbackContext:void 0,L=isFunction(e.onWarn)?e.onWarn:warn,S=e,O=isObject(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,b=isObject(S.__numberFormatters)?S.__numberFormatters:new Map,h=isObject(S.__meta)?S.__meta:{};_cid++;const k={version:t,cid:_cid,locale:r,fallbackLocale:n,messages:o,modifiers:i,pluralRules:c,missing:l,missingWarn:u,fallbackWarn:E,fallbackFormat:f,unresolving:C,postTranslation:p,processor:m,warnHtmlMessage:_,escapeParameter:d,messageCompiler:g,messageResolver:T,localeFallbacker:A,fallbackContext:N,onWarn:L,__meta:h};return k.datetimeFormats=s,k.numberFormats=a,k.__datetimeFormatters=O,k.__numberFormatters=b,k}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,r,n,o){const{missing:s,onWarn:a}=e;if(null!==s){const n=s(e,r,t,o);return isString(n)?n:t}return t}function updateFallbackLocale(e,t,r){e.__localeChainCache=new Map,e.localeFallbacker(e,r,t)}const defaultOnCacheKey=e=>e;let compileCache=Object.create(null);function clearCompileCache(){compileCache=Object.create(null)}function compileToFunction(e,t={}){{!isBoolean(t.warnHtmlMessage)||t.warnHtmlMessage;const r=(t.onCacheKey||defaultOnCacheKey)(e),n=compileCache[r];if(n)return n;let o=!1;const s=t.onError||defaultOnError;t.onError=e=>{o=!0,s(e)};const{code:a}=baseCompile(e,t),i=new Function(`return ${a}`)();return o?i:compileCache[r]=i}}let code=CompileErrorCodes.__EXTEND_POINT__;const inc=()=>++code,CoreErrorCodes={INVALID_ARGUMENT:code,INVALID_DATE_ARGUMENT:inc(),INVALID_ISO_DATE_ARGUMENT:inc(),__EXTEND_POINT__:inc()};function createCoreError(e){return createCompileError(e,null,void 0)}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT;const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:r,postTranslation:n,unresolving:o,messageCompiler:s,fallbackLocale:a,messages:i}=e,[c,l]=parseTranslateArgs(...t),u=isBoolean(l.missingWarn)?l.missingWarn:e.missingWarn,E=isBoolean(l.fallbackWarn)?l.fallbackWarn:e.fallbackWarn,f=isBoolean(l.escapeParameter)?l.escapeParameter:e.escapeParameter,C=!!l.resolvedMessage,p=isString(l.default)||isBoolean(l.default)?isBoolean(l.default)?s?c:()=>c:l.default:r?s?c:()=>c:"",m=r||""!==p,_=isString(l.locale)?l.locale:e.locale;f&&escapeParams(l);let[d,g,T]=C?[c,_,i[_]||{}]:resolveMessageFormat(e,c,_,a,E,u),A=d,N=c;if(C||isString(A)||isMessageFunction(A)||m&&(A=p,N=A),!(C||(isString(A)||isMessageFunction(A))&&isString(g)))return o?NOT_REOSLVED:c;let L=!1;const S=isMessageFunction(A)?A:compileMessageFormat(e,c,g,A,N,(()=>{L=!0}));if(L)return A;const O=evaluateMessage(e,S,createMessageContext(getMessageContextOptions(e,g,T,l)));return n?n(O,c):O}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,r,n,o,s){const{messages:a,onWarn:i,messageResolver:c,localeFallbacker:l}=e,u=l(e,n,r);let E,f={},C=null;for(let p=0;p<u.length&&(E=u[p],f=a[E]||{},null===(C=c(f,t))&&(C=f[t]),!isString(C)&&!isFunction(C));p++){const r=handleMissing(e,t,E,s,"translate");r!==t&&(C=r)}return[C,E,f]}function compileMessageFormat(e,t,r,n,o,s){const{messageCompiler:a,warnHtmlMessage:i}=e;if(isMessageFunction(n)){const e=n;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==a){const e=()=>n;return e.locale=r,e.key=t,e}const c=a(n,getCompileOptions(e,r,o,n,i,s));return c.locale=r,c.key=t,c.source=n,c}function evaluateMessage(e,t,r){return t(r)}function parseTranslateArgs(...e){const[t,r,n]=e,o={};if(!isString(t)&&!isNumber(t)&&!isMessageFunction(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(r)?o.plural=r:isString(r)?o.default=r:isPlainObject(r)&&!isEmptyObject(r)?o.named=r:isArray(r)&&(o.list=r),isNumber(n)?o.plural=n:isString(n)?o.default=n:isPlainObject(n)&&assign(o,n),[s,o]}function getCompileOptions(e,t,r,n,o,s){return{warnHtmlMessage:o,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,r,e)}}function getMessageContextOptions(e,t,r,n){const{modifiers:o,pluralRules:s,messageResolver:a,fallbackLocale:i,fallbackWarn:c,missingWarn:l,fallbackContext:u}=e,E={locale:t,modifiers:o,pluralRules:s,messages:n=>{let o=a(r,n);if(null==o&&u){const[,,e]=resolveMessageFormat(u,n,t,i,c,l);o=a(e,n)}if(isString(o)){let r=!1;const s=compileMessageFormat(e,n,t,o,n,(()=>{r=!0}));return r?NOOP_MESSAGE_FUNCTION:s}return isMessageFunction(o)?o:NOOP_MESSAGE_FUNCTION}};return e.processor&&(E.processor=e.processor),n.list&&(E.list=n.list),n.named&&(E.named=n.named),isNumber(n.plural)&&(E.pluralIndex=n.plural),E}function datetime(e,...t){const{datetimeFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__datetimeFormatters:i}=e,[c,l,u,E]=parseDateTimeArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const C=!!u.part,p=isString(u.locale)?u.locale:e.locale,m=a(e,o,p);if(!isString(c)||""===c)return new Intl.DateTimeFormat(p,E).format(l);let _,d={},g=null;for(let N=0;N<m.length&&(_=m[N],d=r[_]||{},g=d[c],!isPlainObject(g));N++)handleMissing(e,c,_,f,"datetime format");if(!isPlainObject(g)||!isString(_))return n?NOT_REOSLVED:c;let T=`${_}__${c}`;isEmptyObject(E)||(T=`${T}__${JSON.stringify(E)}`);let A=i.get(T);return A||(A=new Intl.DateTimeFormat(_,assign({},g,E)),i.set(T,A)),C?A.formatToParts(l):A.format(l)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,r,n,o]=e,s={};let a,i={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const r=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();a=new Date(r);try{a.toISOString()}catch(c){throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);a=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);a=t}return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(i=n),isPlainObject(o)&&(i=o),[s.key||"",a,s,i]}function clearDateTimeFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__datetimeFormatters.has(e)&&n.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__numberFormatters:i}=e,[c,l,u,E]=parseNumberArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const C=!!u.part,p=isString(u.locale)?u.locale:e.locale,m=a(e,o,p);if(!isString(c)||""===c)return new Intl.NumberFormat(p,E).format(l);let _,d={},g=null;for(let N=0;N<m.length&&(_=m[N],d=r[_]||{},g=d[c],!isPlainObject(g));N++)handleMissing(e,c,_,f,"number format");if(!isPlainObject(g)||!isString(_))return n?NOT_REOSLVED:c;let T=`${_}__${c}`;isEmptyObject(E)||(T=`${T}__${JSON.stringify(E)}`);let A=i.get(T);return A||(A=new Intl.NumberFormat(_,assign({},g,E)),i.set(T,A)),C?A.formatToParts(l):A.format(l)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,r,n,o]=e,s={};let a={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const i=t;return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?a[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(a=n),isPlainObject(o)&&(a=o),[s.key||"",i,s,a]}function clearNumberFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__numberFormatters.has(e)&&n.__numberFormatters.delete(e)}}registerMessageCompiler(compileToFunction),registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CompileErrorCodes,CoreErrorCodes,CoreWarnCodes,DATETIME_FORMAT_OPTIONS_KEYS,DEFAULT_LOCALE,DEFAULT_MESSAGE_DATA_TYPE,MISSING_RESOLVE_VALUE,NOT_REOSLVED,NUMBER_FORMAT_OPTIONS_KEYS,VERSION,clearCompileCache,clearDateTimeFormat,clearNumberFormat,compileToFunction,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getWarnMessage,handleMissing,initI18nDevTools,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale}; | ||
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,r)=>t.hasOwnProperty(r)?t[r]:""))}const generateFormatCacheKey=(e,t,r)=>friendlyJSONstringify({l:e,k:t,s:r}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length;function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>{if(!isObject(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object},toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e),CompileErrorCodes={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function createCompileError(e,t,r={}){const{domain:n,messages:o,args:s}=r,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=n,a}function defaultOnError(e){throw e}function createPosition(e,t,r){return{line:e,column:t,offset:r}}function createLocation(e,t,r){const n={start:e,end:t};return null!=r&&(n.source=r),n}CompileErrorCodes.EXPECTED_TOKEN,CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,CompileErrorCodes.UNBALANCED_CLOSING_BRACE,CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,CompileErrorCodes.EMPTY_PLACEHOLDER,CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,CompileErrorCodes.INVALID_LINKED_FORMAT,CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS;const CHAR_SP=" ",CHAR_CR="\r",CHAR_LF="\n",CHAR_LS=String.fromCharCode(8232),CHAR_PS=String.fromCharCode(8233);function createScanner(e){const t=e;let r=0,n=1,o=1,s=0;const a=e=>t[e]===CHAR_CR&&t[e+1]===CHAR_LF,i=e=>t[e]===CHAR_PS,c=e=>t[e]===CHAR_LS,l=e=>a(e)||(e=>t[e]===CHAR_LF)(e)||i(e)||c(e),u=e=>a(e)||i(e)||c(e)?CHAR_LF:t[e];function E(){return s=0,l(r)&&(n++,o=0),a(r)&&r++,r++,o++,t[r]}return{index:()=>r,line:()=>n,column:()=>o,peekOffset:()=>s,charAt:u,currentChar:()=>u(r),currentPeek:()=>u(r+s),next:E,peek:function(){return a(r+s)&&s++,s++,t[r+s]},reset:function(){r=0,n=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=r+s;for(;e!==r;)E();s=0}}}const EOF=void 0,LITERAL_DELIMITER="'",ERROR_DOMAIN$1="tokenizer";function createTokenizer(e,t={}){const r=!1!==t.location,n=createScanner(e),o=()=>n.index(),s=()=>createPosition(n.line(),n.column(),n.index()),a=s(),i=o(),c={currentType:14,offset:i,startLoc:a,endLoc:a,lastType:14,lastOffset:i,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},l=()=>c,{onError:u}=t;function E(e,t,n){e.endLoc=s(),e.currentType=t;const o={type:t};return r&&(o.loc=createLocation(e.startLoc,e.endLoc)),null!=n&&(o.value=n),o}const f=e=>E(e,14);function C(e,t){return e.currentChar()===t?(e.next(),t):(CompileErrorCodes.EXPECTED_TOKEN,s(),"")}function p(e){let t="";for(;e.currentPeek()===CHAR_SP||e.currentPeek()===CHAR_LF;)t+=e.currentPeek(),e.peek();return t}function m(e){const t=p(e);return e.skipToPeek(),t}function _(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function d(e,t){const{currentType:r}=t;if(2!==r)return!1;p(e);const n=function(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),n}function g(e){p(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function A(e,t=!0){const r=(t=!1,n="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==n&&t:"@"!==s&&s?"%"===s?(e.peek(),r(t,"%",!0)):"|"===s?!("%"!==n&&!o)||!(n===CHAR_SP||n===CHAR_LF):s===CHAR_SP?(e.peek(),r(!0,CHAR_SP,o)):s!==CHAR_LF||(e.peek(),r(!0,CHAR_LF,o)):"%"===n||t},n=r();return t&&e.resetPeek(),n}function T(e,t){const r=e.currentChar();return r===EOF?EOF:t(r)?(e.next(),r):null}function N(e){return T(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 L(e){return T(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function S(e){return T(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function O(e){let t="",r="";for(;t=L(e);)r+=t;return r}function b(e){let t="";for(;;){const r=e.currentChar();if("{"===r||"}"===r||"@"===r||"|"===r||!r)break;if("%"===r){if(!A(e))break;t+=r,e.next()}else if(r===CHAR_SP||r===CHAR_LF)if(A(e))t+=r,e.next();else{if(g(e))break;t+=r,e.next()}else t+=r,e.next()}return t}function h(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return k(e,t,4);case"U":return k(e,t,6);default:return CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,s(),""}}function k(e,t,r){C(e,t);let n="";for(let o=0;o<r;o++){const t=S(e);if(!t){CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),e.currentChar();break}n+=t}return`\\${t}${n}`}function I(e){m(e);const t=C(e,"|");return m(e),t}function D(e,t){let r=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,s()),e.next(),r=E(t,2,"{"),m(e),t.braceNest++,r;case"}":return t.braceNest>0&&2===t.currentType&&(CompileErrorCodes.EMPTY_PLACEHOLDER,s()),e.next(),r=E(t,3,"}"),t.braceNest--,t.braceNest>0&&m(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),r;case"@":return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=P(e,t)||f(t),t.braceNest=0,r;default:let n=!0,o=!0,a=!0;if(g(e))return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=E(t,1,I(e)),t.braceNest=0,t.inLinked=!1,r;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),t.braceNest=0,F(e,t);if(n=function(e,t){const{currentType:r}=t;if(2!==r)return!1;p(e);const n=_(e.currentPeek());return e.resetPeek(),n}(e,t))return r=E(t,5,function(e){m(e);let t="",r="";for(;t=N(e);)r+=t;return e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r}(e)),m(e),r;if(o=d(e,t))return r=E(t,6,function(e){m(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${O(e)}`):t+=O(e),e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),t}(e)),m(e),r;if(a=function(e,t){const{currentType:r}=t;if(2!==r)return!1;p(e);const n=e.currentPeek()===LITERAL_DELIMITER;return e.resetPeek(),n}(e,t))return r=E(t,7,function(e){m(e),C(e,"'");let t="",r="";const n=e=>e!==LITERAL_DELIMITER&&e!==CHAR_LF;for(;t=T(e,n);)r+="\\"===t?h(e):t;const o=e.currentChar();return o===CHAR_LF||o===EOF?(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),o===CHAR_LF&&(e.next(),C(e,"'")),r):(C(e,"'"),r)}(e)),m(e),r;if(!n&&!o&&!a)return r=E(t,13,function(e){m(e);let t="",r="";const n=e=>"{"!==e&&"}"!==e&&e!==CHAR_SP&&e!==CHAR_LF;for(;t=T(e,n);)r+=t;return r}(e)),CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,s(),r.value,m(e),r}return r}function P(e,t){const{currentType:r}=t;let n=null;const o=e.currentChar();switch(8!==r&&9!==r&&12!==r&&10!==r||o!==CHAR_LF&&o!==CHAR_SP||(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),o){case"@":return e.next(),n=E(t,8,"@"),t.inLinked=!0,n;case".":return m(e),e.next(),E(t,9,".");case":":return m(e),e.next(),E(t,10,":");default:return g(e)?(n=E(t,1,I(e)),t.braceNest=0,t.inLinked=!1,n):function(e,t){const{currentType:r}=t;if(8!==r)return!1;p(e);const n="."===e.currentPeek();return e.resetPeek(),n}(e,t)||function(e,t){const{currentType:r}=t;if(8!==r&&12!==r)return!1;p(e);const n=":"===e.currentPeek();return e.resetPeek(),n}(e,t)?(m(e),P(e,t)):function(e,t){const{currentType:r}=t;if(9!==r)return!1;p(e);const n=_(e.currentPeek());return e.resetPeek(),n}(e,t)?(m(e),E(t,12,function(e){let t="",r="";for(;t=N(e);)r+=t;return r}(e))):function(e,t){const{currentType:r}=t;if(10!==r)return!1;const n=()=>{const t=e.currentPeek();return"{"===t?_(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===CHAR_SP||!t)&&(t===CHAR_LF?(e.peek(),n()):_(t))},o=n();return e.resetPeek(),o}(e,t)?(m(e),"{"===o?D(e,t)||n:E(t,11,function(e){const t=(r=!1,n)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===CHAR_SP?n:o===CHAR_LF?(n+=o,e.next(),t(r,n)):(n+=o,e.next(),t(!0,n)):n};return t(!1,"")}(e))):(8===r&&(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),t.braceNest=0,t.inLinked=!1,F(e,t))}}function F(e,t){let r={type:14};if(t.braceNest>0)return D(e,t)||f(t);if(t.inLinked)return P(e,t)||f(t);switch(e.currentChar()){case"{":return D(e,t)||f(t);case"}":return CompileErrorCodes.UNBALANCED_CLOSING_BRACE,s(),e.next(),E(t,3,"}");case"@":return P(e,t)||f(t);default:if(g(e))return r=E(t,1,I(e)),t.braceNest=0,t.inLinked=!1,r;const{isModulo:n,hasSpace:o}=function(e){const t=p(e),r="%"===e.currentPeek()&&"{"===e.peek();return e.resetPeek(),{isModulo:r,hasSpace:t.length>0}}(e);if(n)return o?E(t,0,b(e)):E(t,4,function(e){m(e);const t=e.currentChar();return"%"!==t&&(CompileErrorCodes.EXPECTED_TOKEN,s()),e.next(),"%"}(e));if(A(e))return E(t,0,b(e))}return r}return{nextToken:function(){const{currentType:e,offset:t,startLoc:r,endLoc:a}=c;return c.lastType=e,c.lastOffset=t,c.lastStartLoc=r,c.lastEndLoc=a,c.offset=o(),c.startLoc=s(),n.currentChar()===EOF?E(c,14):F(n,c)},currentOffset:o,currentPosition:s,context:l}}const ERROR_DOMAIN="parser",KNOWN_ESCAPES=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function fromEscapeSequence(e,t,r){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||r,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function createParser(e={}){const t=!1!==e.location,{onError:r}=e;function n(e,r,n){const o={type:e,start:r,end:r};return t&&(o.loc={start:n,end:n}),o}function o(e,r,n,o){e.end=r,o&&(e.type=o),t&&e.loc&&(e.loc.end=n)}function s(e,t){const r=e.context(),s=n(3,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function a(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(5,s,a);return i.index=parseInt(t,10),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function i(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(4,s,a);return i.key=t,e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function c(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(9,s,a);return i.value=t.replace(KNOWN_ESCAPES,fromEscapeSequence),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function l(e){const t=e.context(),r=n(6,t.offset,t.startLoc);let s=e.nextToken();if(9===s.type){const t=function(e){const t=e.nextToken(),r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(8,s,a);return 12!==t.type?(CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,r.lastStartLoc,i.value="",o(i,s,a),{nextConsumeToken:t,node:i}):(null==t.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,r.lastStartLoc,getTokenCaption(t)),i.value=t.value||"",o(i,e.currentOffset(),e.currentPosition()),{node:i})}(e);r.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(10!==s.type&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=function(e,t){const r=e.context(),s=n(7,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=i(e,s.value||"");break;case 6:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=a(e,s.value||"");break;case 7:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=c(e,s.value||"");break;default:CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const l=e.context(),u=n(7,l.offset,l.startLoc);return u.value="",o(u,l.offset,l.startLoc),r.key=u,o(r,l.offset,l.startLoc),{nextConsumeToken:s,node:r}}return o(r,e.currentOffset(),e.currentPosition()),{node:r}}function u(e){const t=e.context(),r=n(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);r.items=[];let u=null;do{const n=u||e.nextToken();switch(u=null,n.type){case 0:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(s(e,n.value||""));break;case 6:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(a(e,n.value||""));break;case 5:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(i(e,n.value||""));break;case 7:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(c(e,n.value||""));break;case 8:const o=l(e);r.items.push(o.node),u=o.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(r,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),r}function E(e){const t=e.context(),{offset:r,startLoc:s}=t,a=u(e);return 14===t.currentType?a:function(e,t,r,s){const a=e.context();let i=0===s.items.length;const c=n(1,t,r);c.cases=[],c.cases.push(s);do{const t=u(e);i||(i=0===t.items.length),c.cases.push(t)}while(14!==a.currentType);return i&&CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,o(c,e.currentOffset(),e.currentPosition()),c}(e,r,s,a)}return{parse:function(r){const s=createTokenizer(r,assign({},e)),a=s.context(),i=n(0,a.offset,a.startLoc);return t&&i.loc&&(i.loc.source=r),i.body=E(s),14!==a.currentType&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,r[a.offset]),o(i,s.currentOffset(),s.currentPosition()),i}}}function getTokenCaption(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function createTransformer(e,t={}){const r={ast:e,helpers:new Set};return{context:()=>r,helper:e=>(r.helpers.add(e),e)}}function traverseNodes(e,t){for(let r=0;r<e.length;r++)traverseNode(e[r],t)}function traverseNode(e,t){switch(e.type){case 1:traverseNodes(e.cases,t),t.helper("plural");break;case 2:traverseNodes(e.items,t);break;case 6:traverseNode(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function transform(e,t={}){const r=createTransformer(e);r.helper("normalize"),e.body&&traverseNode(e.body,r);const n=r.context();e.helpers=Array.from(n.helpers)}function createCodeGenerator(e,t){const{sourceMap:r,filename:n,breakLineCode:o,needIndent:s}=t,a={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:s,indentLevel:0};function i(e,t){a.code+=e}function c(e,t=!0){const r=t?o:"";i(s?r+" ".repeat(e):r)}return{context:()=>a,push:i,indent:function(e=!0){const t=++a.indentLevel;e&&c(t)},deindent:function(e=!0){const t=--a.indentLevel;e&&c(t)},newline:function(){c(a.indentLevel)},helper:e=>`_${e}`,needIndent:()=>a.needIndent}}function generateLinkedNode(e,t){const{helper:r}=e;e.push(`${r("linked")}(`),generateNode(e,t.key),t.modifier?(e.push(", "),generateNode(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}function generateMessageNode(e,t){const{helper:r,needIndent:n}=e;e.push(`${r("normalize")}([`),e.indent(n());const o=t.items.length;for(let s=0;s<o&&(generateNode(e,t.items[s]),s!==o-1);s++)e.push(", ");e.deindent(n()),e.push("])")}function generatePluralNode(e,t){const{helper:r,needIndent:n}=e;if(t.cases.length>1){e.push(`${r("plural")}([`),e.indent(n());const o=t.cases.length;for(let r=0;r<o&&(generateNode(e,t.cases[r]),r!==o-1);r++)e.push(", ");e.deindent(n()),e.push("])")}}function generateResource(e,t){t.body?generateNode(e,t.body):e.push("null")}function generateNode(e,t){const{helper:r}=e;switch(t.type){case 0:generateResource(e,t);break;case 1:generatePluralNode(e,t);break;case 2:generateMessageNode(e,t);break;case 6:generateLinkedNode(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${r("interpolate")}(${r("list")}(${t.index}))`,t);break;case 4:e.push(`${r("interpolate")}(${r("named")}(${JSON.stringify(t.key)}))`,t)}}const generate=(e,t={})=>{const r=isString(t.mode)?t.mode:"normal",n=isString(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,s=null!=t.breakLineCode?t.breakLineCode:"arrow"===r?";":"\n",a=t.needIndent?t.needIndent:"arrow"!==r,i=e.helpers||[],c=createCodeGenerator(e,{mode:r,filename:n,sourceMap:o,breakLineCode:s,needIndent:a});c.push("normal"===r?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(a),i.length>0&&(c.push(`const { ${i.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),generateNode(c,e),c.deindent(a),c.push("}");const{code:l,map:u}=c.context();return{ast:e,code:l,map:u?u.toJSON():void 0}};function baseCompile(e,t={}){const r=assign({},t),n=createParser(r).parse(e);return transform(n,r),generate(n,r)}const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let r,n,o,s,a,i,c,l=-1,u=0,E=0;const f=[];function C(){const t=e[l+1];if(5===u&&"'"===t||6===u&&'"'===t)return l++,o="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===n?n=o:n+=o},f[1]=()=>{void 0!==n&&(t.push(n),n=void 0)},f[2]=()=>{f[0](),E++},f[3]=()=>{if(E>0)E--,u=4,f[0]();else{if(E=0,void 0===n)return!1;if(n=formatSubPath(n),!1===n)return!1;f[1]()}};null!==u;)if(l++,r=e[l],"\\"!==r||!C()){if(s=getPathCharType(r),c=pathStateMachine[u],a=c[s]||c.l||8,8===a)return;if(u=a[0],void 0!==a[1]&&(i=f[a[1]],i&&(o=r,!1===i())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let r=cache.get(t);if(r||(r=parse(t),r&&cache.set(t,r)),!r)return null;const n=r.length;let o=e,s=0;for(;s<n;){const e=o[r[s]];if(void 0===e)return null;o=e,s++}return o}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":e.join(""),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,r=getPluralIndex(e),n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,o=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],a=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(r,a);function i(t){const r=isFunction(e.messages)?e.messages(t):!!isObject(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const c=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,l=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>a[e],plural:e=>e[n(r,e.length,o)],linked:(t,...r)=>{const[n,o]=r;let s="text",a="";1===r.length?isObject(n)?(a=n.modifier||a,s=n.type||s):isString(n)&&(a=n||a):2===r.length&&(isString(n)&&(a=n||a),isString(o)&&(s=o||s));let c=i(t)(u);return"vnode"===s&&isArray(c)&&a&&(c=c[0]),a?(l=a,e.modifiers?e.modifiers[l]:DEFAULT_MODIFIER)(c,s):c;var l},message:i,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:l,normalize:c};return u}const IntlifyDevToolsHooks={I18nInit:"i18n:init",FunctionTranslate:"function:translate"};let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,r){devtools&&devtools.emit(IntlifyDevToolsHooks.I18nInit,{timestamp:Date.now(),i18n:e,version:t,meta:r})}const translateDevTools=createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate);function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreWarnCodes={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function getWarnMessage(e,...t){return format(warnMessages[e],...t)}function fallbackWithSimple(e,t,r){return[...new Set([r,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[r]])]}function fallbackWithLocaleChain(e,t,r){const n=isString(r)?r:DEFAULT_LOCALE,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(n);if(!s){s=[];let e=[r];for(;isArray(e);)e=appendBlockToChain(s,e,t);const a=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(a)?[a]:a,isArray(e)&&appendBlockToChain(s,e,!1),o.__localeChainCache.set(n,s)}return s}function appendBlockToChain(e,t,r){let n=!0;for(let o=0;o<t.length&&isBoolean(n);o++){const s=t[o];isString(s)&&(n=appendLocaleToChain(e,t[o],r))}return n}function appendLocaleToChain(e,t,r){let n;const o=t.split("-");do{n=appendItemToChain(e,o.join("-"),r),o.splice(-1,1)}while(o.length&&!0===n);return n}function appendItemToChain(e,t,r){let n=!1;if(!e.includes(t)&&(n=!0,t)){n="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(isArray(r)||isPlainObject(r))&&r[o]&&(n=r[o])}return n}const VERSION="9.3.0-beta.18",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isString(e.version)?e.version:VERSION,r=isString(e.locale)?e.locale:DEFAULT_LOCALE,n=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:r,o=isPlainObject(e.messages)?e.messages:{[r]:{}},s=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[r]:{}},a=isPlainObject(e.numberFormats)?e.numberFormats:{[r]:{}},i=assign({},e.modifiers||{},getDefaultLinkedModifiers()),c=e.pluralRules||{},l=isFunction(e.missing)?e.missing:null,u=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,E=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,f=!!e.fallbackFormat,C=!!e.unresolving,p=isFunction(e.postTranslation)?e.postTranslation:null,m=isPlainObject(e.processor)?e.processor:null,_=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,d=!!e.escapeParameter,g=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,A=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,T=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,N=isObject(e.fallbackContext)?e.fallbackContext:void 0,L=isFunction(e.onWarn)?e.onWarn:warn,S=e,O=isObject(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,b=isObject(S.__numberFormatters)?S.__numberFormatters:new Map,h=isObject(S.__meta)?S.__meta:{};_cid++;const k={version:t,cid:_cid,locale:r,fallbackLocale:n,messages:o,modifiers:i,pluralRules:c,missing:l,missingWarn:u,fallbackWarn:E,fallbackFormat:f,unresolving:C,postTranslation:p,processor:m,warnHtmlMessage:_,escapeParameter:d,messageCompiler:g,messageResolver:A,localeFallbacker:T,fallbackContext:N,onWarn:L,__meta:h};return k.datetimeFormats=s,k.numberFormats=a,k.__datetimeFormatters=O,k.__numberFormatters=b,k}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,r,n,o){const{missing:s,onWarn:a}=e;if(null!==s){const n=s(e,r,t,o);return isString(n)?n:t}return t}function updateFallbackLocale(e,t,r){e.__localeChainCache=new Map,e.localeFallbacker(e,r,t)}const defaultOnCacheKey=e=>e;let compileCache=Object.create(null);function clearCompileCache(){compileCache=Object.create(null)}function compileToFunction(e,t={}){{!isBoolean(t.warnHtmlMessage)||t.warnHtmlMessage;const r=(t.onCacheKey||defaultOnCacheKey)(e),n=compileCache[r];if(n)return n;let o=!1;const s=t.onError||defaultOnError;t.onError=e=>{o=!0,s(e)};const{code:a}=baseCompile(e,t),i=new Function(`return ${a}`)();return o?i:compileCache[r]=i}}let code=CompileErrorCodes.__EXTEND_POINT__;const inc=()=>++code,CoreErrorCodes={INVALID_ARGUMENT:code,INVALID_DATE_ARGUMENT:inc(),INVALID_ISO_DATE_ARGUMENT:inc(),__EXTEND_POINT__:inc()};function createCoreError(e){return createCompileError(e,null,void 0)}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT;const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:r,postTranslation:n,unresolving:o,messageCompiler:s,fallbackLocale:a,messages:i}=e,[c,l]=parseTranslateArgs(...t),u=isBoolean(l.missingWarn)?l.missingWarn:e.missingWarn,E=isBoolean(l.fallbackWarn)?l.fallbackWarn:e.fallbackWarn,f=isBoolean(l.escapeParameter)?l.escapeParameter:e.escapeParameter,C=!!l.resolvedMessage,p=isString(l.default)||isBoolean(l.default)?isBoolean(l.default)?s?c:()=>c:l.default:r?s?c:()=>c:"",m=r||""!==p,_=isString(l.locale)?l.locale:e.locale;f&&escapeParams(l);let[d,g,A]=C?[c,_,i[_]||{}]:resolveMessageFormat(e,c,_,a,E,u),T=d,N=c;if(C||isString(T)||isMessageFunction(T)||m&&(T=p,N=T),!(C||(isString(T)||isMessageFunction(T))&&isString(g)))return o?-1:c;let L=!1;const S=isMessageFunction(T)?T:compileMessageFormat(e,c,g,T,N,(()=>{L=!0}));if(L)return T;const O=evaluateMessage(e,S,createMessageContext(getMessageContextOptions(e,g,A,l)));return n?n(O,c):O}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,r,n,o,s){const{messages:a,onWarn:i,messageResolver:c,localeFallbacker:l}=e,u=l(e,n,r);let E,f={},C=null;for(let p=0;p<u.length&&(E=u[p],f=a[E]||{},null===(C=c(f,t))&&(C=f[t]),!isString(C)&&!isFunction(C));p++){const r=handleMissing(e,t,E,s,"translate");r!==t&&(C=r)}return[C,E,f]}function compileMessageFormat(e,t,r,n,o,s){const{messageCompiler:a,warnHtmlMessage:i}=e;if(isMessageFunction(n)){const e=n;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==a){const e=()=>n;return e.locale=r,e.key=t,e}const c=a(n,getCompileOptions(e,r,o,n,i,s));return c.locale=r,c.key=t,c.source=n,c}function evaluateMessage(e,t,r){return t(r)}function parseTranslateArgs(...e){const[t,r,n]=e,o={};if(!isString(t)&&!isNumber(t)&&!isMessageFunction(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(r)?o.plural=r:isString(r)?o.default=r:isPlainObject(r)&&!isEmptyObject(r)?o.named=r:isArray(r)&&(o.list=r),isNumber(n)?o.plural=n:isString(n)?o.default=n:isPlainObject(n)&&assign(o,n),[s,o]}function getCompileOptions(e,t,r,n,o,s){return{warnHtmlMessage:o,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,r,e)}}function getMessageContextOptions(e,t,r,n){const{modifiers:o,pluralRules:s,messageResolver:a,fallbackLocale:i,fallbackWarn:c,missingWarn:l,fallbackContext:u}=e,E={locale:t,modifiers:o,pluralRules:s,messages:n=>{let o=a(r,n);if(null==o&&u){const[,,e]=resolveMessageFormat(u,n,t,i,c,l);o=a(e,n)}if(isString(o)){let r=!1;const s=compileMessageFormat(e,n,t,o,n,(()=>{r=!0}));return r?NOOP_MESSAGE_FUNCTION:s}return isMessageFunction(o)?o:NOOP_MESSAGE_FUNCTION}};return e.processor&&(E.processor=e.processor),n.list&&(E.list=n.list),n.named&&(E.named=n.named),isNumber(n.plural)&&(E.pluralIndex=n.plural),E}function datetime(e,...t){const{datetimeFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__datetimeFormatters:i}=e,[c,l,u,E]=parseDateTimeArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const C=!!u.part,p=isString(u.locale)?u.locale:e.locale,m=a(e,o,p);if(!isString(c)||""===c)return new Intl.DateTimeFormat(p,E).format(l);let _,d={},g=null;for(let N=0;N<m.length&&(_=m[N],d=r[_]||{},g=d[c],!isPlainObject(g));N++)handleMissing(e,c,_,f,"datetime format");if(!isPlainObject(g)||!isString(_))return n?-1:c;let A=`${_}__${c}`;isEmptyObject(E)||(A=`${A}__${JSON.stringify(E)}`);let T=i.get(A);return T||(T=new Intl.DateTimeFormat(_,assign({},g,E)),i.set(A,T)),C?T.formatToParts(l):T.format(l)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,r,n,o]=e,s={};let a,i={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const r=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();a=new Date(r);try{a.toISOString()}catch(c){throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);a=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);a=t}return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(i=n),isPlainObject(o)&&(i=o),[s.key||"",a,s,i]}function clearDateTimeFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__datetimeFormatters.has(e)&&n.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__numberFormatters:i}=e,[c,l,u,E]=parseNumberArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const C=!!u.part,p=isString(u.locale)?u.locale:e.locale,m=a(e,o,p);if(!isString(c)||""===c)return new Intl.NumberFormat(p,E).format(l);let _,d={},g=null;for(let N=0;N<m.length&&(_=m[N],d=r[_]||{},g=d[c],!isPlainObject(g));N++)handleMissing(e,c,_,f,"number format");if(!isPlainObject(g)||!isString(_))return n?-1:c;let A=`${_}__${c}`;isEmptyObject(E)||(A=`${A}__${JSON.stringify(E)}`);let T=i.get(A);return T||(T=new Intl.NumberFormat(_,assign({},g,E)),i.set(A,T)),C?T.formatToParts(l):T.format(l)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,r,n,o]=e,s={};let a={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const i=t;return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?a[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(a=n),isPlainObject(o)&&(a=o),[s.key||"",i,s,a]}function clearNumberFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__numberFormatters.has(e)&&n.__numberFormatters.delete(e)}}registerMessageCompiler(compileToFunction),registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CompileErrorCodes,CoreErrorCodes,CoreWarnCodes,DATETIME_FORMAT_OPTIONS_KEYS,DEFAULT_LOCALE,DEFAULT_MESSAGE_DATA_TYPE,MISSING_RESOLVE_VALUE,NOT_REOSLVED,NUMBER_FORMAT_OPTIONS_KEYS,VERSION,clearCompileCache,clearDateTimeFormat,clearNumberFormat,compileToFunction,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getWarnMessage,handleMissing,initI18nDevTools,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale}; |
/*! | ||
* core v9.3.0-beta.17 | ||
* core v9.3.0-beta.18 | ||
* (c) 2023 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),o=e=>"number"==typeof e&&isFinite(e),a=e=>"[object Date]"===N(e),s=e=>"[object RegExp]"===N(e),c=e=>L(e)&&0===Object.keys(e).length;function l(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const u=Object.assign;function i(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const f=Array.isArray,E=e=>"function"==typeof e,_=e=>"string"==typeof e,m=e=>"boolean"==typeof e,p=e=>null!==e&&"object"==typeof e,d=Object.prototype.toString,N=e=>d.call(e),L=e=>"[object Object]"===N(e),T={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function A(e,t,n={}){const{domain:r,messages:o,args:a}=n,s=new SyntaxError(String(e));return s.code=e,t&&(s.location=t),s.domain=r,s}function C(e){throw e}function k(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}T.EXPECTED_TOKEN,T.INVALID_TOKEN_IN_PLACEHOLDER,T.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,T.UNKNOWN_ESCAPE_SEQUENCE,T.INVALID_UNICODE_ESCAPE_SEQUENCE,T.UNBALANCED_CLOSING_BRACE,T.UNTERMINATED_CLOSING_BRACE,T.EMPTY_PLACEHOLDER,T.NOT_ALLOW_NEST_PLACEHOLDER,T.INVALID_LINKED_FORMAT,T.MUST_HAVE_MESSAGES_IN_PLURAL,T.UNEXPECTED_EMPTY_LINKED_MODIFIER,T.UNEXPECTED_EMPTY_LINKED_KEY,T.UNEXPECTED_LEXICAL_ANALYSIS;const h=" ",I="\r",g="\n",b=String.fromCharCode(8232),O=String.fromCharCode(8233);function S(e){const t=e;let n=0,r=1,o=1,a=0;const s=e=>t[e]===I&&t[e+1]===g,c=e=>t[e]===O,l=e=>t[e]===b,u=e=>s(e)||(e=>t[e]===g)(e)||c(e)||l(e),i=e=>s(e)||c(e)||l(e)?g:t[e];function f(){return a=0,u(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>a,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+a),next:f,peek:function(){return s(n+a)&&a++,a++,t[n+a]},reset:function(){n=0,r=1,o=1,a=0},resetPeek:function(e=0){a=e},skipToPeek:function(){const e=n+a;for(;e!==n;)f();a=0}}}const D=void 0,y="'";function P(e,t={}){const n=!1!==t.location,r=S(e),o=()=>r.index(),a=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=a(),c=o(),l={currentType:14,offset:c,startLoc:s,endLoc:s,lastType:14,lastOffset:c,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},u=()=>l,{onError:i}=t;function f(e,t,r){e.endLoc=a(),e.currentType=t;const o={type:t};return n&&(o.loc=k(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const E=e=>f(e,14);function _(e,t){return e.currentChar()===t?(e.next(),t):(T.EXPECTED_TOKEN,a(),"")}function m(e){let t="";for(;e.currentPeek()===h||e.currentPeek()===g;)t+=e.currentPeek(),e.peek();return t}function p(e){const t=m(e);return e.skipToPeek(),t}function d(e){if(e===D)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function N(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=function(e){if(e===D)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function L(e){m(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function A(e,t=!0){const n=(t=!1,r="",o=!1)=>{const a=e.currentPeek();return"{"===a?"%"!==r&&t:"@"!==a&&a?"%"===a?(e.peek(),n(t,"%",!0)):"|"===a?!("%"!==r&&!o)||!(r===h||r===g):a===h?(e.peek(),n(!0,h,o)):a!==g||(e.peek(),n(!0,g,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function C(e,t){const n=e.currentChar();return n===D?D:t(n)?(e.next(),n):null}function I(e){return C(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 b(e){return C(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function O(e){return C(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function P(e){let t="",n="";for(;t=b(e);)n+=t;return n}function M(e){let t="";for(;;){const n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if("%"===n){if(!A(e))break;t+=n,e.next()}else if(n===h||n===g)if(A(e))t+=n,e.next();else{if(L(e))break;t+=n,e.next()}else t+=n,e.next()}return t}function R(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 T.UNKNOWN_ESCAPE_SEQUENCE,a(),""}}function F(e,t,n){_(e,t);let r="";for(let o=0;o<n;o++){const t=O(e);if(!t){T.INVALID_UNICODE_ESCAPE_SEQUENCE,a(),e.currentChar();break}r+=t}return`\\${t}${r}`}function x(e){p(e);const t=_(e,"|");return p(e),t}function U(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(T.NOT_ALLOW_NEST_PLACEHOLDER,a()),e.next(),n=f(t,2,"{"),p(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&(T.EMPTY_PLACEHOLDER,a()),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&p(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&(T.UNTERMINATED_CLOSING_BRACE,a()),n=v(e,t)||E(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(L(e))return t.braceNest>0&&(T.UNTERMINATED_CLOSING_BRACE,a()),n=f(t,1,x(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return T.UNTERMINATED_CLOSING_BRACE,a(),t.braceNest=0,w(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=d(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){p(e);let t="",n="";for(;t=I(e);)n+=t;return e.currentChar()===D&&(T.UNTERMINATED_CLOSING_BRACE,a()),n}(e)),p(e),n;if(o=N(e,t))return n=f(t,6,function(e){p(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${P(e)}`):t+=P(e),e.currentChar()===D&&(T.UNTERMINATED_CLOSING_BRACE,a()),t}(e)),p(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=e.currentPeek()===y;return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){p(e),_(e,"'");let t="",n="";const r=e=>e!==y&&e!==g;for(;t=C(e,r);)n+="\\"===t?R(e):t;const o=e.currentChar();return o===g||o===D?(T.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,a(),o===g&&(e.next(),_(e,"'")),n):(_(e,"'"),n)}(e)),p(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){p(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==h&&e!==g;for(;t=C(e,r);)n+=t;return n}(e)),T.INVALID_TOKEN_IN_PLACEHOLDER,a(),n.value,p(e),n}return n}function v(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==g&&o!==h||(T.INVALID_LINKED_FORMAT,a()),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return p(e),e.next(),f(t,9,".");case":":return p(e),e.next(),f(t,10,":");default:return L(e)?(r=f(t,1,x(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;m(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;m(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(p(e),v(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;m(e);const r=d(e.currentPeek());return e.resetPeek(),r}(e,t)?(p(e),f(t,12,function(e){let t="",n="";for(;t=I(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?d(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===h||!t)&&(t===g?(e.peek(),r()):d(t))},o=r();return e.resetPeek(),o}(e,t)?(p(e),"{"===o?U(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===h?r:o===g?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&(T.INVALID_LINKED_FORMAT,a()),t.braceNest=0,t.inLinked=!1,w(e,t))}}function w(e,t){let n={type:14};if(t.braceNest>0)return U(e,t)||E(t);if(t.inLinked)return v(e,t)||E(t);switch(e.currentChar()){case"{":return U(e,t)||E(t);case"}":return T.UNBALANCED_CLOSING_BRACE,a(),e.next(),f(t,3,"}");case"@":return v(e,t)||E(t);default:if(L(e))return n=f(t,1,x(e)),t.braceNest=0,t.inLinked=!1,n;const{isModulo:r,hasSpace:o}=function(e){const t=m(e),n="%"===e.currentPeek()&&"{"===e.peek();return e.resetPeek(),{isModulo:n,hasSpace:t.length>0}}(e);if(r)return o?f(t,0,M(e)):f(t,4,function(e){p(e);const t=e.currentChar();return"%"!==t&&(T.EXPECTED_TOKEN,a()),e.next(),"%"}(e));if(A(e))return f(t,0,M(e))}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=l;return l.lastType=e,l.lastOffset=t,l.lastStartLoc=n,l.lastEndLoc=s,l.offset=o(),l.startLoc=a(),r.currentChar()===D?f(l,14):w(r,l)},currentOffset:o,currentPosition:a,context:u}}const M=/(?:\\\\|\\'|\\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 F(e={}){const t=!1!==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 a(e,t){const n=e.context(),a=r(3,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}function s(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(5,a,s);return c.index=parseInt(t,10),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function c(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(4,a,s);return c.key=t,e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function l(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(9,a,s);return c.value=t.replace(M,R),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let a=e.nextToken();if(9===a.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(8,a,s);return 12!==t.type?(T.UNEXPECTED_EMPTY_LINKED_MODIFIER,n.lastStartLoc,c.value="",o(c,a,s),{nextConsumeToken:t,node:c}):(null==t.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,x(t)),c.value=t.value||"",o(c,e.currentOffset(),e.currentPosition()),{node:c})}(e);n.modifier=t.node,a=t.nextConsumeToken||e.nextToken()}switch(10!==a.type&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),a=e.nextToken(),2===a.type&&(a=e.nextToken()),a.type){case 11:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=function(e,t){const n=e.context(),a=r(7,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}(e,a.value||"");break;case 5:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=c(e,a.value||"");break;case 6:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=s(e,a.value||"");break;case 7:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=l(e,a.value||"");break;default:T.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const u=e.context(),i=r(7,u.offset,u.startLoc);return i.value="",o(i,u.offset,u.startLoc),n.key=i,o(n,u.offset,u.startLoc),{nextConsumeToken:a,node:n}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let u=null;do{const r=u||e.nextToken();switch(u=null,r.type){case 0:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(a(e,r.value||""));break;case 6:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(s(e,r.value||""));break;case 5:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(c(e,r.value||""));break;case 7:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(l(e,r.value||""));break;case 8:const o=i(e);n.items.push(o.node),u=o.nextConsumeToken||null}}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 E(e){const t=e.context(),{offset:n,startLoc:a}=t,s=f(e);return 14===t.currentType?s:function(e,t,n,a){const s=e.context();let c=0===a.items.length;const l=r(1,t,n);l.cases=[],l.cases.push(a);do{const t=f(e);c||(c=0===t.items.length),l.cases.push(t)}while(14!==s.currentType);return c&&T.MUST_HAVE_MESSAGES_IN_PLURAL,o(l,e.currentOffset(),e.currentPosition()),l}(e,n,a,s)}return{parse:function(n){const a=P(n,u({},e)),s=a.context(),c=r(0,s.offset,s.startLoc);return t&&c.loc&&(c.loc.source=n),c.body=E(a),14!==s.currentType&&(T.UNEXPECTED_LEXICAL_ANALYSIS,s.lastStartLoc,n[s.offset]),o(c,a.currentOffset(),a.currentPosition()),c}}}function x(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function U(e,t){for(let n=0;n<e.length;n++)v(e[n],t)}function v(e,t){switch(e.type){case 1:U(e.cases,t),t.helper("plural");break;case 2:U(e.items,t);break;case 6:v(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function w(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&&v(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function W(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?W(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(W(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let a=0;a<o&&(W(e,t.items[a]),a!==o-1);a++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),W(e,t.key),t.modifier?(e.push(", "),W(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}(e,t);break;case 8:case 7:case 9:case 3: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)}}const X=(e,t={})=>{const n=_(t.mode)?t.mode:"normal",r=_(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,a=null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",s=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],l=function(e,t){const{sourceMap:n,filename:r,breakLineCode:o,needIndent:a}=t,s={source:e.loc.source,filename:r,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:a,indentLevel:0};function c(e,t){s.code+=e}function l(e,t=!0){const n=t?o:"";c(a?n+" ".repeat(e):n)}return{context:()=>s,push:c,indent:function(e=!0){const t=++s.indentLevel;e&&l(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&l(t)},newline:function(){l(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}(e,{mode:n,filename:r,sourceMap:o,breakLineCode:a,needIndent:s});l.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(s),c.length>0&&(l.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),l.newline()),l.push("return "),W(l,e),l.deindent(s),l.push("}");const{code:u,map:i}=l.context();return{ast:e,code:u,map:i?i.toJSON():void 0}};const $=[];$[0]={w:[0],i:[3,0],"[":[4],o:[7]},$[1]={w:[1],".":[2],"[":[4],o:[7]},$[2]={w:[2],i:[3,0],0:[3,0]},$[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},$[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},$[5]={"'":[4,0],o:8,l:[5,0]},$[6]={'"':[4,0],o:8,l:[6,0]};const K=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function V(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)))&&(n=t,K.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function Y(e){const t=[];let n,r,o,a,s,c,l,u=-1,i=0,f=0;const E=[];function _(){const t=e[u+1];if(5===i&&"'"===t||6===i&&'"'===t)return u++,o="\\"+t,E[0](),!0}for(E[0]=()=>{void 0===r?r=o:r+=o},E[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},E[2]=()=>{E[0](),f++},E[3]=()=>{if(f>0)f--,i=4,E[0]();else{if(f=0,void 0===r)return!1;if(r=G(r),!1===r)return!1;E[1]()}};null!==i;)if(u++,n=e[u],"\\"!==n||!_()){if(a=V(n),l=$[i],s=l[a]||l.l||8,8===s)return;if(i=s[0],void 0!==s[1]&&(c=E[s[1]],c&&(o=n,!1===c())))return;if(7===i)return t}}const B=new Map;function H(e,t){return p(e)?e[t]:null}function j(e,t){if(!p(e))return null;let n=B.get(t);if(n||(n=Y(t),n&&B.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 Q=e=>e,z=e=>"",J="text",Z=e=>0===e.length?"":e.join(""),q=e=>null==e?"":f(e)||L(e)&&e.toString===d?JSON.stringify(e,null,2):String(e);function ee(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function te(e={}){const t=e.locale,n=function(e){const t=o(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(o(e.named.count)||o(e.named.n))?o(e.named.count)?e.named.count:o(e.named.n)?e.named.n:t:t}(e),r=p(e.pluralRules)&&_(t)&&E(e.pluralRules[t])?e.pluralRules[t]:ee,a=p(e.pluralRules)&&_(t)&&E(e.pluralRules[t])?ee:void 0,s=e.list||[],c=e.named||{};o(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,c);function l(t){const n=E(e.messages)?e.messages(t):!!p(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):z)}const u=L(e.processor)&&E(e.processor.normalize)?e.processor.normalize:Z,i=L(e.processor)&&E(e.processor.interpolate)?e.processor.interpolate:q,m={list:e=>s[e],named:e=>c[e],plural:e=>e[r(n,e.length,a)],linked:(t,...n)=>{const[r,o]=n;let a="text",s="";1===n.length?p(r)?(s=r.modifier||s,a=r.type||a):_(r)&&(s=r||s):2===n.length&&(_(r)&&(s=r||s),_(o)&&(a=o||a));let c=l(t)(m);return"vnode"===a&&f(c)&&s&&(c=c[0]),s?(u=s,e.modifiers?e.modifiers[u]:Q)(c,a):c;var u},message:l,type:L(e.processor)&&_(e.processor.type)?e.processor.type:J,interpolate:i,normalize:u};return m}const ne={I18nInit:"i18n:init",FunctionTranslate:"function:translate"};let re=null;const oe=ae(ne.FunctionTranslate);function ae(e){return t=>re&&re.emit(e,t)}const se={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},ce={[se.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[se.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[se.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[se.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[se.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[se.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function le(e,t,n){return[...new Set([n,...f(t)?t:p(t)?Object.keys(t):_(t)?[t]:[n]])]}function ue(e,t,n){const r=_(n)?n:pe,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let a=o.__localeChainCache.get(r);if(!a){a=[];let e=[n];for(;f(e);)e=ie(a,e,t);const s=f(t)||!L(t)?t:t.default?t.default:null;e=_(s)?[s]:s,f(e)&&ie(a,e,!1),o.__localeChainCache.set(r,a)}return a}function ie(e,t,n){let r=!0;for(let o=0;o<t.length&&m(r);o++){const a=t[o];_(a)&&(r=fe(e,t[o],n))}return r}function fe(e,t,n){let r;const o=t.split("-");do{r=Ee(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function Ee(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),(f(n)||L(n))&&n[o]&&(r=n[o])}return r}const _e="9.3.0-beta.17",me=-1,pe="en-US",de=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let Ne,Le,Te;function Ae(e){Ne=e}function Ce(e){Le=e}function ke(e){Te=e}let he=null;let Ie=null;let ge=0;function be(e,t,n,r,o){const{missing:a,onWarn:s}=e;if(null!==a){const r=a(e,n,t,o);return _(r)?r:t}return t}const Oe=e=>e;let Se=Object.create(null);function De(e,t={}){{!m(t.warnHtmlMessage)||t.warnHtmlMessage;const n=(t.onCacheKey||Oe)(e),r=Se[n];if(r)return r;let o=!1;const a=t.onError||C;t.onError=e=>{o=!0,a(e)};const{code:s}=function(e,t={}){const n=u({},t),r=F(n).parse(e);return w(r,n),X(r,n)}(e,t),c=new Function(`return ${s}`)();return o?c:Se[n]=c}}let ye=T.__EXTEND_POINT__;const Pe=()=>++ye,Me={INVALID_ARGUMENT:ye,INVALID_DATE_ARGUMENT:Pe(),INVALID_ISO_DATE_ARGUMENT:Pe(),__EXTEND_POINT__:Pe()};Me.INVALID_ARGUMENT,Me.INVALID_DATE_ARGUMENT,Me.INVALID_ISO_DATE_ARGUMENT;const Re=()=>"",Fe=e=>E(e);function xe(e,t,n,r,o,a){const{messages:s,onWarn:c,messageResolver:l,localeFallbacker:u}=e,i=u(e,r,n);let f,m={},p=null;for(let d=0;d<i.length&&(f=i[d],m=s[f]||{},null===(p=l(m,t))&&(p=m[t]),!_(p)&&!E(p));d++){const n=be(e,t,f,0,"translate");n!==t&&(p=n)}return[p,f,m]}function Ue(e,t,r,o,a,s){const{messageCompiler:c,warnHtmlMessage:l}=e;if(Fe(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==c){const e=()=>o;return e.locale=r,e.key=t,e}const u=c(o,function(e,t,r,o,a,s){return{warnHtmlMessage:a,onError:e=>{throw s&&s(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,a,0,l,s));return u.locale=r,u.key=t,u.source=o,u}function ve(...e){const[t,n,r]=e,a={};if(!_(t)&&!o(t)&&!Fe(t))throw Error(Me.INVALID_ARGUMENT);const s=o(t)?String(t):(Fe(t),t);return o(n)?a.plural=n:_(n)?a.default=n:L(n)&&!c(n)?a.named=n:f(n)&&(a.list=n),o(r)?a.plural=r:_(r)?a.default=r:L(r)&&u(a,r),[s,a]}const we=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function We(...e){const[t,n,r,s]=e,c={};let l,u={};if(_(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(Me.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();l=new Date(n);try{l.toISOString()}catch(i){throw Error(Me.INVALID_ISO_DATE_ARGUMENT)}}else if(a(t)){if(isNaN(t.getTime()))throw Error(Me.INVALID_DATE_ARGUMENT);l=t}else{if(!o(t))throw Error(Me.INVALID_ARGUMENT);l=t}return _(n)?c.key=n:L(n)&&Object.keys(n).forEach((e=>{we.includes(e)?u[e]=n[e]:c[e]=n[e]})),_(r)?c.locale=r:L(r)&&(u=r),L(s)&&(u=s),[c.key||"",l,c,u]}const Xe=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function $e(...e){const[t,n,r,a]=e,s={};let c={};if(!o(t))throw Error(Me.INVALID_ARGUMENT);const l=t;return _(n)?s.key=n:L(n)&&Object.keys(n).forEach((e=>{Xe.includes(e)?c[e]=n[e]:s[e]=n[e]})),_(r)?s.locale=r:L(r)&&(c=r),L(a)&&(c=a),[s.key||"",l,s,c]}return Ae(De),Ce(j),ke(ue),e.CompileErrorCodes=T,e.CoreErrorCodes=Me,e.CoreWarnCodes=se,e.DATETIME_FORMAT_OPTIONS_KEYS=we,e.DEFAULT_LOCALE=pe,e.DEFAULT_MESSAGE_DATA_TYPE=J,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=me,e.NUMBER_FORMAT_OPTIONS_KEYS=Xe,e.VERSION=_e,e.clearCompileCache=function(){Se=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compileToFunction=De,e.createCompileError=A,e.createCoreContext=function(e={}){const t=_(e.version)?e.version:_e,n=_(e.locale)?e.locale:pe,r=f(e.fallbackLocale)||L(e.fallbackLocale)||_(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=L(e.messages)?e.messages:{[n]:{}},a=L(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},c=L(e.numberFormats)?e.numberFormats:{[n]:{}},i=u({},e.modifiers||{},{upper:(e,t)=>"text"===t&&_(e)?e.toUpperCase():"vnode"===t&&p(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&_(e)?e.toLowerCase():"vnode"===t&&p(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&_(e)?de(e):"vnode"===t&&p(e)&&"__v_isVNode"in e?de(e.children):e}),d=e.pluralRules||{},N=E(e.missing)?e.missing:null,T=!m(e.missingWarn)&&!s(e.missingWarn)||e.missingWarn,A=!m(e.fallbackWarn)&&!s(e.fallbackWarn)||e.fallbackWarn,C=!!e.fallbackFormat,k=!!e.unresolving,h=E(e.postTranslation)?e.postTranslation:null,I=L(e.processor)?e.processor:null,g=!m(e.warnHtmlMessage)||e.warnHtmlMessage,b=!!e.escapeParameter,O=E(e.messageCompiler)?e.messageCompiler:Ne,S=E(e.messageResolver)?e.messageResolver:Le||H,D=E(e.localeFallbacker)?e.localeFallbacker:Te||le,y=p(e.fallbackContext)?e.fallbackContext:void 0,P=E(e.onWarn)?e.onWarn:l,M=e,R=p(M.__datetimeFormatters)?M.__datetimeFormatters:new Map,F=p(M.__numberFormatters)?M.__numberFormatters:new Map,x=p(M.__meta)?M.__meta:{};ge++;const U={version:t,cid:ge,locale:n,fallbackLocale:r,messages:o,modifiers:i,pluralRules:d,missing:N,missingWarn:T,fallbackWarn:A,fallbackFormat:C,unresolving:k,postTranslation:h,processor:I,warnHtmlMessage:g,escapeParameter:b,messageCompiler:O,messageResolver:S,localeFallbacker:D,fallbackContext:y,onWarn:P,__meta:x};return U.datetimeFormats=a,U.numberFormats=c,U.__datetimeFormatters=R,U.__numberFormatters=F,U},e.createCoreError=function(e){return A(e,null,void 0)},e.createMessageContext=te,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:a,localeFallbacker:s}=e,{__datetimeFormatters:l}=e,[i,f,E,p]=We(...t);m(E.missingWarn)?E.missingWarn:e.missingWarn,m(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const d=!!E.part,N=_(E.locale)?E.locale:e.locale,T=s(e,o,N);if(!_(i)||""===i)return new Intl.DateTimeFormat(N,p).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[i],!L(k));c++)be(e,i,A,0,"datetime format");if(!L(k)||!_(A))return r?me:i;let h=`${A}__${i}`;c(p)||(h=`${h}__${JSON.stringify(p)}`);let I=l.get(h);return I||(I=new Intl.DateTimeFormat(A,u({},k,p)),l.set(h,I)),d?I.formatToParts(f):I.format(f)},e.fallbackWithLocaleChain=ue,e.fallbackWithSimple=le,e.getAdditionalMeta=()=>he,e.getDevToolsHook=function(){return re},e.getFallbackContext=()=>Ie,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]:""))}(ce[e],...n)},e.handleMissing=be,e.initI18nDevTools=function(e,t,n){re&&re.emit(ne.I18nInit,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=Fe,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,onWarn:a,localeFallbacker:s}=e,{__numberFormatters:l}=e,[i,f,E,p]=$e(...t);m(E.missingWarn)?E.missingWarn:e.missingWarn,m(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const d=!!E.part,N=_(E.locale)?E.locale:e.locale,T=s(e,o,N);if(!_(i)||""===i)return new Intl.NumberFormat(N,p).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[i],!L(k));c++)be(e,i,A,0,"number format");if(!L(k)||!_(A))return r?me:i;let h=`${A}__${i}`;c(p)||(h=`${h}__${JSON.stringify(p)}`);let I=l.get(h);return I||(I=new Intl.NumberFormat(A,u({},k,p)),l.set(h,I)),d?I.formatToParts(f):I.format(f)},e.parse=Y,e.parseDateTimeArgs=We,e.parseNumberArgs=$e,e.parseTranslateArgs=ve,e.registerLocaleFallbacker=ke,e.registerMessageCompiler=Ae,e.registerMessageResolver=Ce,e.resolveValue=j,e.resolveWithKeyValue=H,e.setAdditionalMeta=e=>{he=e},e.setDevToolsHook=function(e){re=e},e.setFallbackContext=e=>{Ie=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:a,messageCompiler:s,fallbackLocale:c,messages:l}=e,[u,E]=ve(...t),d=m(E.missingWarn)?E.missingWarn:e.missingWarn,N=m(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn,L=m(E.escapeParameter)?E.escapeParameter:e.escapeParameter,T=!!E.resolvedMessage,A=_(E.default)||m(E.default)?m(E.default)?s?u:()=>u:E.default:n?s?u:()=>u:"",C=n||""!==A,k=_(E.locale)?E.locale:e.locale;L&&function(e){f(e.list)?e.list=e.list.map((e=>_(e)?i(e):e)):p(e.named)&&Object.keys(e.named).forEach((t=>{_(e.named[t])&&(e.named[t]=i(e.named[t]))}))}(E);let[h,I,g]=T?[u,k,l[k]||{}]:xe(e,u,k,c,N,d),b=h,O=u;if(T||_(b)||Fe(b)||C&&(b=A,O=b),!(T||(_(b)||Fe(b))&&_(I)))return a?me:u;let S=!1;const D=Fe(b)?b:Ue(e,u,I,b,O,(()=>{S=!0}));if(S)return b;const y=function(e,t,n,r){const{modifiers:a,pluralRules:s,messageResolver:c,fallbackLocale:l,fallbackWarn:u,missingWarn:i,fallbackContext:f}=e,E=r=>{let o=c(n,r);if(null==o&&f){const[,,e]=xe(f,r,t,l,u,i);o=c(e,r)}if(_(o)){let n=!1;const a=Ue(e,r,t,o,r,(()=>{n=!0}));return n?Re:a}return Fe(o)?o:Re},m={locale:t,modifiers:a,pluralRules:s,messages:E};e.processor&&(m.processor=e.processor);r.list&&(m.list=r.list);r.named&&(m.named=r.named);o(r.plural)&&(m.pluralIndex=r.plural);return m}(e,I,g,E),P=function(e,t,n){const r=t(n);return r}(0,D,te(y));return r?r(P,u):P},e.translateDevTools=oe,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({}); | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),o=e=>"number"==typeof e&&isFinite(e),a=e=>"[object Date]"===N(e),s=e=>"[object RegExp]"===N(e),c=e=>L(e)&&0===Object.keys(e).length;function l(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const u=Object.assign;function i(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const f=Array.isArray,E=e=>"function"==typeof e,_=e=>"string"==typeof e,m=e=>"boolean"==typeof e,p=e=>null!==e&&"object"==typeof e,d=Object.prototype.toString,N=e=>d.call(e),L=e=>{if(!p(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object},T={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function A(e,t,n={}){const{domain:r,messages:o,args:a}=n,s=new SyntaxError(String(e));return s.code=e,t&&(s.location=t),s.domain=r,s}function C(e){throw e}function k(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}T.EXPECTED_TOKEN,T.INVALID_TOKEN_IN_PLACEHOLDER,T.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,T.UNKNOWN_ESCAPE_SEQUENCE,T.INVALID_UNICODE_ESCAPE_SEQUENCE,T.UNBALANCED_CLOSING_BRACE,T.UNTERMINATED_CLOSING_BRACE,T.EMPTY_PLACEHOLDER,T.NOT_ALLOW_NEST_PLACEHOLDER,T.INVALID_LINKED_FORMAT,T.MUST_HAVE_MESSAGES_IN_PLURAL,T.UNEXPECTED_EMPTY_LINKED_MODIFIER,T.UNEXPECTED_EMPTY_LINKED_KEY,T.UNEXPECTED_LEXICAL_ANALYSIS;const h=" ",I="\r",g="\n",b=String.fromCharCode(8232),O=String.fromCharCode(8233);function S(e){const t=e;let n=0,r=1,o=1,a=0;const s=e=>t[e]===I&&t[e+1]===g,c=e=>t[e]===O,l=e=>t[e]===b,u=e=>s(e)||(e=>t[e]===g)(e)||c(e)||l(e),i=e=>s(e)||c(e)||l(e)?g:t[e];function f(){return a=0,u(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>a,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+a),next:f,peek:function(){return s(n+a)&&a++,a++,t[n+a]},reset:function(){n=0,r=1,o=1,a=0},resetPeek:function(e=0){a=e},skipToPeek:function(){const e=n+a;for(;e!==n;)f();a=0}}}const D=void 0,y="'";function P(e,t={}){const n=!1!==t.location,r=S(e),o=()=>r.index(),a=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=a(),c=o(),l={currentType:14,offset:c,startLoc:s,endLoc:s,lastType:14,lastOffset:c,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},u=()=>l,{onError:i}=t;function f(e,t,r){e.endLoc=a(),e.currentType=t;const o={type:t};return n&&(o.loc=k(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const E=e=>f(e,14);function _(e,t){return e.currentChar()===t?(e.next(),t):(T.EXPECTED_TOKEN,a(),"")}function m(e){let t="";for(;e.currentPeek()===h||e.currentPeek()===g;)t+=e.currentPeek(),e.peek();return t}function p(e){const t=m(e);return e.skipToPeek(),t}function d(e){if(e===D)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function N(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=function(e){if(e===D)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function L(e){m(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function A(e,t=!0){const n=(t=!1,r="",o=!1)=>{const a=e.currentPeek();return"{"===a?"%"!==r&&t:"@"!==a&&a?"%"===a?(e.peek(),n(t,"%",!0)):"|"===a?!("%"!==r&&!o)||!(r===h||r===g):a===h?(e.peek(),n(!0,h,o)):a!==g||(e.peek(),n(!0,g,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function C(e,t){const n=e.currentChar();return n===D?D:t(n)?(e.next(),n):null}function I(e){return C(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 b(e){return C(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function O(e){return C(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function P(e){let t="",n="";for(;t=b(e);)n+=t;return n}function M(e){let t="";for(;;){const n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if("%"===n){if(!A(e))break;t+=n,e.next()}else if(n===h||n===g)if(A(e))t+=n,e.next();else{if(L(e))break;t+=n,e.next()}else t+=n,e.next()}return t}function R(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return x(e,t,4);case"U":return x(e,t,6);default:return T.UNKNOWN_ESCAPE_SEQUENCE,a(),""}}function x(e,t,n){_(e,t);let r="";for(let o=0;o<n;o++){const t=O(e);if(!t){T.INVALID_UNICODE_ESCAPE_SEQUENCE,a(),e.currentChar();break}r+=t}return`\\${t}${r}`}function F(e){p(e);const t=_(e,"|");return p(e),t}function U(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(T.NOT_ALLOW_NEST_PLACEHOLDER,a()),e.next(),n=f(t,2,"{"),p(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&(T.EMPTY_PLACEHOLDER,a()),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&p(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&(T.UNTERMINATED_CLOSING_BRACE,a()),n=v(e,t)||E(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(L(e))return t.braceNest>0&&(T.UNTERMINATED_CLOSING_BRACE,a()),n=f(t,1,F(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return T.UNTERMINATED_CLOSING_BRACE,a(),t.braceNest=0,w(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=d(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){p(e);let t="",n="";for(;t=I(e);)n+=t;return e.currentChar()===D&&(T.UNTERMINATED_CLOSING_BRACE,a()),n}(e)),p(e),n;if(o=N(e,t))return n=f(t,6,function(e){p(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${P(e)}`):t+=P(e),e.currentChar()===D&&(T.UNTERMINATED_CLOSING_BRACE,a()),t}(e)),p(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=e.currentPeek()===y;return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){p(e),_(e,"'");let t="",n="";const r=e=>e!==y&&e!==g;for(;t=C(e,r);)n+="\\"===t?R(e):t;const o=e.currentChar();return o===g||o===D?(T.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,a(),o===g&&(e.next(),_(e,"'")),n):(_(e,"'"),n)}(e)),p(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){p(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==h&&e!==g;for(;t=C(e,r);)n+=t;return n}(e)),T.INVALID_TOKEN_IN_PLACEHOLDER,a(),n.value,p(e),n}return n}function v(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==g&&o!==h||(T.INVALID_LINKED_FORMAT,a()),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return p(e),e.next(),f(t,9,".");case":":return p(e),e.next(),f(t,10,":");default:return L(e)?(r=f(t,1,F(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;m(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;m(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(p(e),v(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;m(e);const r=d(e.currentPeek());return e.resetPeek(),r}(e,t)?(p(e),f(t,12,function(e){let t="",n="";for(;t=I(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?d(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===h||!t)&&(t===g?(e.peek(),r()):d(t))},o=r();return e.resetPeek(),o}(e,t)?(p(e),"{"===o?U(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===h?r:o===g?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&(T.INVALID_LINKED_FORMAT,a()),t.braceNest=0,t.inLinked=!1,w(e,t))}}function w(e,t){let n={type:14};if(t.braceNest>0)return U(e,t)||E(t);if(t.inLinked)return v(e,t)||E(t);switch(e.currentChar()){case"{":return U(e,t)||E(t);case"}":return T.UNBALANCED_CLOSING_BRACE,a(),e.next(),f(t,3,"}");case"@":return v(e,t)||E(t);default:if(L(e))return n=f(t,1,F(e)),t.braceNest=0,t.inLinked=!1,n;const{isModulo:r,hasSpace:o}=function(e){const t=m(e),n="%"===e.currentPeek()&&"{"===e.peek();return e.resetPeek(),{isModulo:n,hasSpace:t.length>0}}(e);if(r)return o?f(t,0,M(e)):f(t,4,function(e){p(e);const t=e.currentChar();return"%"!==t&&(T.EXPECTED_TOKEN,a()),e.next(),"%"}(e));if(A(e))return f(t,0,M(e))}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=l;return l.lastType=e,l.lastOffset=t,l.lastStartLoc=n,l.lastEndLoc=s,l.offset=o(),l.startLoc=a(),r.currentChar()===D?f(l,14):w(r,l)},currentOffset:o,currentPosition:a,context:u}}const M=/(?:\\\\|\\'|\\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 x(e={}){const t=!1!==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 a(e,t){const n=e.context(),a=r(3,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}function s(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(5,a,s);return c.index=parseInt(t,10),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function c(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(4,a,s);return c.key=t,e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function l(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(9,a,s);return c.value=t.replace(M,R),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let a=e.nextToken();if(9===a.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(8,a,s);return 12!==t.type?(T.UNEXPECTED_EMPTY_LINKED_MODIFIER,n.lastStartLoc,c.value="",o(c,a,s),{nextConsumeToken:t,node:c}):(null==t.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,F(t)),c.value=t.value||"",o(c,e.currentOffset(),e.currentPosition()),{node:c})}(e);n.modifier=t.node,a=t.nextConsumeToken||e.nextToken()}switch(10!==a.type&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(a)),a=e.nextToken(),2===a.type&&(a=e.nextToken()),a.type){case 11:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(a)),n.key=function(e,t){const n=e.context(),a=r(7,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}(e,a.value||"");break;case 5:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(a)),n.key=c(e,a.value||"");break;case 6:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(a)),n.key=s(e,a.value||"");break;case 7:null==a.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(a)),n.key=l(e,a.value||"");break;default:T.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const u=e.context(),i=r(7,u.offset,u.startLoc);return i.value="",o(i,u.offset,u.startLoc),n.key=i,o(n,u.offset,u.startLoc),{nextConsumeToken:a,node:n}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let u=null;do{const r=u||e.nextToken();switch(u=null,r.type){case 0:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(r)),n.items.push(a(e,r.value||""));break;case 6:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(r)),n.items.push(s(e,r.value||""));break;case 5:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(r)),n.items.push(c(e,r.value||""));break;case 7:null==r.value&&(T.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,F(r)),n.items.push(l(e,r.value||""));break;case 8:const o=i(e);n.items.push(o.node),u=o.nextConsumeToken||null}}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 E(e){const t=e.context(),{offset:n,startLoc:a}=t,s=f(e);return 14===t.currentType?s:function(e,t,n,a){const s=e.context();let c=0===a.items.length;const l=r(1,t,n);l.cases=[],l.cases.push(a);do{const t=f(e);c||(c=0===t.items.length),l.cases.push(t)}while(14!==s.currentType);return c&&T.MUST_HAVE_MESSAGES_IN_PLURAL,o(l,e.currentOffset(),e.currentPosition()),l}(e,n,a,s)}return{parse:function(n){const a=P(n,u({},e)),s=a.context(),c=r(0,s.offset,s.startLoc);return t&&c.loc&&(c.loc.source=n),c.body=E(a),14!==s.currentType&&(T.UNEXPECTED_LEXICAL_ANALYSIS,s.lastStartLoc,n[s.offset]),o(c,a.currentOffset(),a.currentPosition()),c}}}function F(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function U(e,t){for(let n=0;n<e.length;n++)v(e[n],t)}function v(e,t){switch(e.type){case 1:U(e.cases,t),t.helper("plural");break;case 2:U(e.items,t);break;case 6:v(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function w(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&&v(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function W(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?W(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(W(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let a=0;a<o&&(W(e,t.items[a]),a!==o-1);a++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),W(e,t.key),t.modifier?(e.push(", "),W(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}(e,t);break;case 8:case 7:case 9:case 3: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)}}const X=(e,t={})=>{const n=_(t.mode)?t.mode:"normal",r=_(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,a=null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",s=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],l=function(e,t){const{sourceMap:n,filename:r,breakLineCode:o,needIndent:a}=t,s={source:e.loc.source,filename:r,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:a,indentLevel:0};function c(e,t){s.code+=e}function l(e,t=!0){const n=t?o:"";c(a?n+" ".repeat(e):n)}return{context:()=>s,push:c,indent:function(e=!0){const t=++s.indentLevel;e&&l(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&l(t)},newline:function(){l(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}(e,{mode:n,filename:r,sourceMap:o,breakLineCode:a,needIndent:s});l.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(s),c.length>0&&(l.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),l.newline()),l.push("return "),W(l,e),l.deindent(s),l.push("}");const{code:u,map:i}=l.context();return{ast:e,code:u,map:i?i.toJSON():void 0}};const $=[];$[0]={w:[0],i:[3,0],"[":[4],o:[7]},$[1]={w:[1],".":[2],"[":[4],o:[7]},$[2]={w:[2],i:[3,0],0:[3,0]},$[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},$[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},$[5]={"'":[4,0],o:8,l:[5,0]},$[6]={'"':[4,0],o:8,l:[6,0]};const K=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function V(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)))&&(n=t,K.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function Y(e){const t=[];let n,r,o,a,s,c,l,u=-1,i=0,f=0;const E=[];function _(){const t=e[u+1];if(5===i&&"'"===t||6===i&&'"'===t)return u++,o="\\"+t,E[0](),!0}for(E[0]=()=>{void 0===r?r=o:r+=o},E[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},E[2]=()=>{E[0](),f++},E[3]=()=>{if(f>0)f--,i=4,E[0]();else{if(f=0,void 0===r)return!1;if(r=G(r),!1===r)return!1;E[1]()}};null!==i;)if(u++,n=e[u],"\\"!==n||!_()){if(a=V(n),l=$[i],s=l[a]||l.l||8,8===s)return;if(i=s[0],void 0!==s[1]&&(c=E[s[1]],c&&(o=n,!1===c())))return;if(7===i)return t}}const B=new Map;function H(e,t){return p(e)?e[t]:null}function j(e,t){if(!p(e))return null;let n=B.get(t);if(n||(n=Y(t),n&&B.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 Q=e=>e,z=e=>"",J="text",Z=e=>0===e.length?"":e.join(""),q=e=>null==e?"":f(e)||L(e)&&e.toString===d?JSON.stringify(e,null,2):String(e);function ee(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function te(e={}){const t=e.locale,n=function(e){const t=o(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(o(e.named.count)||o(e.named.n))?o(e.named.count)?e.named.count:o(e.named.n)?e.named.n:t:t}(e),r=p(e.pluralRules)&&_(t)&&E(e.pluralRules[t])?e.pluralRules[t]:ee,a=p(e.pluralRules)&&_(t)&&E(e.pluralRules[t])?ee:void 0,s=e.list||[],c=e.named||{};o(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,c);function l(t){const n=E(e.messages)?e.messages(t):!!p(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):z)}const u=L(e.processor)&&E(e.processor.normalize)?e.processor.normalize:Z,i=L(e.processor)&&E(e.processor.interpolate)?e.processor.interpolate:q,m={list:e=>s[e],named:e=>c[e],plural:e=>e[r(n,e.length,a)],linked:(t,...n)=>{const[r,o]=n;let a="text",s="";1===n.length?p(r)?(s=r.modifier||s,a=r.type||a):_(r)&&(s=r||s):2===n.length&&(_(r)&&(s=r||s),_(o)&&(a=o||a));let c=l(t)(m);return"vnode"===a&&f(c)&&s&&(c=c[0]),s?(u=s,e.modifiers?e.modifiers[u]:Q)(c,a):c;var u},message:l,type:L(e.processor)&&_(e.processor.type)?e.processor.type:J,interpolate:i,normalize:u};return m}const ne="i18n:init";let re=null;const oe=ae("function:translate");function ae(e){return t=>re&&re.emit(e,t)}const se={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},ce={[se.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[se.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[se.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[se.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[se.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[se.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function le(e,t,n){return[...new Set([n,...f(t)?t:p(t)?Object.keys(t):_(t)?[t]:[n]])]}function ue(e,t,n){const r=_(n)?n:me,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let a=o.__localeChainCache.get(r);if(!a){a=[];let e=[n];for(;f(e);)e=ie(a,e,t);const s=f(t)||!L(t)?t:t.default?t.default:null;e=_(s)?[s]:s,f(e)&&ie(a,e,!1),o.__localeChainCache.set(r,a)}return a}function ie(e,t,n){let r=!0;for(let o=0;o<t.length&&m(r);o++){const a=t[o];_(a)&&(r=fe(e,t[o],n))}return r}function fe(e,t,n){let r;const o=t.split("-");do{r=Ee(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function Ee(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),(f(n)||L(n))&&n[o]&&(r=n[o])}return r}const _e="9.3.0-beta.18",me="en-US",pe=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let de,Ne,Le;function Te(e){de=e}function Ae(e){Ne=e}function Ce(e){Le=e}let ke=null;let he=null;let Ie=0;function ge(e,t,n,r,o){const{missing:a,onWarn:s}=e;if(null!==a){const r=a(e,n,t,o);return _(r)?r:t}return t}const be=e=>e;let Oe=Object.create(null);function Se(e,t={}){{!m(t.warnHtmlMessage)||t.warnHtmlMessage;const n=(t.onCacheKey||be)(e),r=Oe[n];if(r)return r;let o=!1;const a=t.onError||C;t.onError=e=>{o=!0,a(e)};const{code:s}=function(e,t={}){const n=u({},t),r=x(n).parse(e);return w(r,n),X(r,n)}(e,t),c=new Function(`return ${s}`)();return o?c:Oe[n]=c}}let De=T.__EXTEND_POINT__;const ye=()=>++De,Pe={INVALID_ARGUMENT:De,INVALID_DATE_ARGUMENT:ye(),INVALID_ISO_DATE_ARGUMENT:ye(),__EXTEND_POINT__:ye()};Pe.INVALID_ARGUMENT,Pe.INVALID_DATE_ARGUMENT,Pe.INVALID_ISO_DATE_ARGUMENT;const Me=()=>"",Re=e=>E(e);function xe(e,t,n,r,o,a){const{messages:s,onWarn:c,messageResolver:l,localeFallbacker:u}=e,i=u(e,r,n);let f,m={},p=null;for(let d=0;d<i.length&&(f=i[d],m=s[f]||{},null===(p=l(m,t))&&(p=m[t]),!_(p)&&!E(p));d++){const n=ge(e,t,f,0,"translate");n!==t&&(p=n)}return[p,f,m]}function Fe(e,t,r,o,a,s){const{messageCompiler:c,warnHtmlMessage:l}=e;if(Re(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==c){const e=()=>o;return e.locale=r,e.key=t,e}const u=c(o,function(e,t,r,o,a,s){return{warnHtmlMessage:a,onError:e=>{throw s&&s(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,a,0,l,s));return u.locale=r,u.key=t,u.source=o,u}function Ue(...e){const[t,n,r]=e,a={};if(!_(t)&&!o(t)&&!Re(t))throw Error(Pe.INVALID_ARGUMENT);const s=o(t)?String(t):(Re(t),t);return o(n)?a.plural=n:_(n)?a.default=n:L(n)&&!c(n)?a.named=n:f(n)&&(a.list=n),o(r)?a.plural=r:_(r)?a.default=r:L(r)&&u(a,r),[s,a]}const ve=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function we(...e){const[t,n,r,s]=e,c={};let l,u={};if(_(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(Pe.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();l=new Date(n);try{l.toISOString()}catch(i){throw Error(Pe.INVALID_ISO_DATE_ARGUMENT)}}else if(a(t)){if(isNaN(t.getTime()))throw Error(Pe.INVALID_DATE_ARGUMENT);l=t}else{if(!o(t))throw Error(Pe.INVALID_ARGUMENT);l=t}return _(n)?c.key=n:L(n)&&Object.keys(n).forEach((e=>{ve.includes(e)?u[e]=n[e]:c[e]=n[e]})),_(r)?c.locale=r:L(r)&&(u=r),L(s)&&(u=s),[c.key||"",l,c,u]}const We=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Xe(...e){const[t,n,r,a]=e,s={};let c={};if(!o(t))throw Error(Pe.INVALID_ARGUMENT);const l=t;return _(n)?s.key=n:L(n)&&Object.keys(n).forEach((e=>{We.includes(e)?c[e]=n[e]:s[e]=n[e]})),_(r)?s.locale=r:L(r)&&(c=r),L(a)&&(c=a),[s.key||"",l,s,c]}return Te(Se),Ae(j),Ce(ue),e.CompileErrorCodes=T,e.CoreErrorCodes=Pe,e.CoreWarnCodes=se,e.DATETIME_FORMAT_OPTIONS_KEYS=ve,e.DEFAULT_LOCALE=me,e.DEFAULT_MESSAGE_DATA_TYPE=J,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=We,e.VERSION=_e,e.clearCompileCache=function(){Oe=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compileToFunction=Se,e.createCompileError=A,e.createCoreContext=function(e={}){const t=_(e.version)?e.version:_e,n=_(e.locale)?e.locale:me,r=f(e.fallbackLocale)||L(e.fallbackLocale)||_(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=L(e.messages)?e.messages:{[n]:{}},a=L(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},c=L(e.numberFormats)?e.numberFormats:{[n]:{}},i=u({},e.modifiers||{},{upper:(e,t)=>"text"===t&&_(e)?e.toUpperCase():"vnode"===t&&p(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&_(e)?e.toLowerCase():"vnode"===t&&p(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&_(e)?pe(e):"vnode"===t&&p(e)&&"__v_isVNode"in e?pe(e.children):e}),d=e.pluralRules||{},N=E(e.missing)?e.missing:null,T=!m(e.missingWarn)&&!s(e.missingWarn)||e.missingWarn,A=!m(e.fallbackWarn)&&!s(e.fallbackWarn)||e.fallbackWarn,C=!!e.fallbackFormat,k=!!e.unresolving,h=E(e.postTranslation)?e.postTranslation:null,I=L(e.processor)?e.processor:null,g=!m(e.warnHtmlMessage)||e.warnHtmlMessage,b=!!e.escapeParameter,O=E(e.messageCompiler)?e.messageCompiler:de,S=E(e.messageResolver)?e.messageResolver:Ne||H,D=E(e.localeFallbacker)?e.localeFallbacker:Le||le,y=p(e.fallbackContext)?e.fallbackContext:void 0,P=E(e.onWarn)?e.onWarn:l,M=e,R=p(M.__datetimeFormatters)?M.__datetimeFormatters:new Map,x=p(M.__numberFormatters)?M.__numberFormatters:new Map,F=p(M.__meta)?M.__meta:{};Ie++;const U={version:t,cid:Ie,locale:n,fallbackLocale:r,messages:o,modifiers:i,pluralRules:d,missing:N,missingWarn:T,fallbackWarn:A,fallbackFormat:C,unresolving:k,postTranslation:h,processor:I,warnHtmlMessage:g,escapeParameter:b,messageCompiler:O,messageResolver:S,localeFallbacker:D,fallbackContext:y,onWarn:P,__meta:F};return U.datetimeFormats=a,U.numberFormats=c,U.__datetimeFormatters=R,U.__numberFormatters=x,U},e.createCoreError=function(e){return A(e,null,void 0)},e.createMessageContext=te,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:a,localeFallbacker:s}=e,{__datetimeFormatters:l}=e,[i,f,E,p]=we(...t);m(E.missingWarn)?E.missingWarn:e.missingWarn,m(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const d=!!E.part,N=_(E.locale)?E.locale:e.locale,T=s(e,o,N);if(!_(i)||""===i)return new Intl.DateTimeFormat(N,p).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[i],!L(k));c++)ge(e,i,A,0,"datetime format");if(!L(k)||!_(A))return r?-1:i;let h=`${A}__${i}`;c(p)||(h=`${h}__${JSON.stringify(p)}`);let I=l.get(h);return I||(I=new Intl.DateTimeFormat(A,u({},k,p)),l.set(h,I)),d?I.formatToParts(f):I.format(f)},e.fallbackWithLocaleChain=ue,e.fallbackWithSimple=le,e.getAdditionalMeta=()=>ke,e.getDevToolsHook=function(){return re},e.getFallbackContext=()=>he,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]:""))}(ce[e],...n)},e.handleMissing=ge,e.initI18nDevTools=function(e,t,n){re&&re.emit(ne,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=Re,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,onWarn:a,localeFallbacker:s}=e,{__numberFormatters:l}=e,[i,f,E,p]=Xe(...t);m(E.missingWarn)?E.missingWarn:e.missingWarn,m(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const d=!!E.part,N=_(E.locale)?E.locale:e.locale,T=s(e,o,N);if(!_(i)||""===i)return new Intl.NumberFormat(N,p).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[i],!L(k));c++)ge(e,i,A,0,"number format");if(!L(k)||!_(A))return r?-1:i;let h=`${A}__${i}`;c(p)||(h=`${h}__${JSON.stringify(p)}`);let I=l.get(h);return I||(I=new Intl.NumberFormat(A,u({},k,p)),l.set(h,I)),d?I.formatToParts(f):I.format(f)},e.parse=Y,e.parseDateTimeArgs=we,e.parseNumberArgs=Xe,e.parseTranslateArgs=Ue,e.registerLocaleFallbacker=Ce,e.registerMessageCompiler=Te,e.registerMessageResolver=Ae,e.resolveValue=j,e.resolveWithKeyValue=H,e.setAdditionalMeta=e=>{ke=e},e.setDevToolsHook=function(e){re=e},e.setFallbackContext=e=>{he=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:a,messageCompiler:s,fallbackLocale:c,messages:l}=e,[u,E]=Ue(...t),d=m(E.missingWarn)?E.missingWarn:e.missingWarn,N=m(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn,L=m(E.escapeParameter)?E.escapeParameter:e.escapeParameter,T=!!E.resolvedMessage,A=_(E.default)||m(E.default)?m(E.default)?s?u:()=>u:E.default:n?s?u:()=>u:"",C=n||""!==A,k=_(E.locale)?E.locale:e.locale;L&&function(e){f(e.list)?e.list=e.list.map((e=>_(e)?i(e):e)):p(e.named)&&Object.keys(e.named).forEach((t=>{_(e.named[t])&&(e.named[t]=i(e.named[t]))}))}(E);let[h,I,g]=T?[u,k,l[k]||{}]:xe(e,u,k,c,N,d),b=h,O=u;if(T||_(b)||Re(b)||C&&(b=A,O=b),!(T||(_(b)||Re(b))&&_(I)))return a?-1:u;let S=!1;const D=Re(b)?b:Fe(e,u,I,b,O,(()=>{S=!0}));if(S)return b;const y=function(e,t,n,r){const{modifiers:a,pluralRules:s,messageResolver:c,fallbackLocale:l,fallbackWarn:u,missingWarn:i,fallbackContext:f}=e,E=r=>{let o=c(n,r);if(null==o&&f){const[,,e]=xe(f,r,t,l,u,i);o=c(e,r)}if(_(o)){let n=!1;const a=Fe(e,r,t,o,r,(()=>{n=!0}));return n?Me:a}return Re(o)?o:Me},m={locale:t,modifiers:a,pluralRules:s,messages:E};e.processor&&(m.processor=e.processor);r.list&&(m.list=r.list);r.named&&(m.named=r.named);o(r.plural)&&(m.pluralIndex=r.plural);return m}(e,I,g,E),P=function(e,t,n){const r=t(n);return r}(0,D,te(y));return r?r(P,u):P},e.translateDevTools=oe,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({}); |
/*! | ||
* core v9.3.0-beta.17 | ||
* core v9.3.0-beta.18 | ||
* (c) 2023 kazuya kawaguchi | ||
@@ -86,3 +86,8 @@ * Released under the MIT License. | ||
const toTypeString = (value) => objectToString.call(value); | ||
const isPlainObject = (val) => toTypeString(val) === '[object Object]'; | ||
const isPlainObject = (val) => { | ||
if (!isObject(val)) | ||
return false; | ||
const proto = Object.getPrototypeOf(val); | ||
return proto === null || proto.constructor === Object; | ||
}; | ||
// for converting list and named values to displayed strings. | ||
@@ -747,3 +752,3 @@ const toDisplayString = (val) => { | ||
*/ | ||
const VERSION = '9.3.0-beta.17'; | ||
const VERSION = '9.3.0-beta.18'; | ||
const NOT_REOSLVED = -1; | ||
@@ -750,0 +755,0 @@ const DEFAULT_LOCALE = 'en-US'; |
/*! | ||
* core v9.3.0-beta.17 | ||
* core v9.3.0-beta.18 | ||
* (c) 2023 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,a)=>t.hasOwnProperty(a)?t[a]:""))}const generateFormatCacheKey=(e,t,a)=>friendlyJSONstringify({l:e,k:t,s:a}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length;function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>"[object Object]"===toTypeString(e),toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e),CompileErrorCodes={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function createCompileError(e,t,a={}){const{domain:n,messages:r,args:s}=a,i=new SyntaxError(String(e));return i.code=e,t&&(i.location=t),i.domain=n,i}const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let a,n,r,s,i,o,l,c=-1,u=0,m=0;const g=[];function _(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,r="\\"+t,g[0](),!0}for(g[0]=()=>{void 0===n?n=r:n+=r},g[1]=()=>{void 0!==n&&(t.push(n),n=void 0)},g[2]=()=>{g[0](),m++},g[3]=()=>{if(m>0)m--,u=4,g[0]();else{if(m=0,void 0===n)return!1;if(n=formatSubPath(n),!1===n)return!1;g[1]()}};null!==u;)if(c++,a=e[c],"\\"!==a||!_()){if(s=getPathCharType(a),l=pathStateMachine[u],i=l[s]||l.l||8,8===i)return;if(u=i[0],void 0!==i[1]&&(o=g[i[1]],o&&(r=a,!1===o())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let a=cache.get(t);if(a||(a=parse(t),a&&cache.set(t,a)),!a)return null;const n=a.length;let r=e,s=0;for(;s<n;){const e=r[a[s]];if(void 0===e)return null;r=e,s++}return r}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":e.join(""),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,a=getPluralIndex(e),n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,r=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],i=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(a,i);function o(t){const a=isFunction(e.messages)?e.messages(t):!!isObject(e.messages)&&e.messages[t];return a||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const l=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,c=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>i[e],plural:e=>e[n(a,e.length,r)],linked:(t,...a)=>{const[n,r]=a;let s="text",i="";1===a.length?isObject(n)?(i=n.modifier||i,s=n.type||s):isString(n)&&(i=n||i):2===a.length&&(isString(n)&&(i=n||i),isString(r)&&(s=r||s));let l=o(t)(u);return"vnode"===s&&isArray(l)&&i&&(l=l[0]),i?(c=i,e.modifiers?e.modifiers[c]:DEFAULT_MODIFIER)(l,s):l;var c},message:o,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:c,normalize:l};return u}const IntlifyDevToolsHooks={I18nInit:"i18n:init",FunctionTranslate:"function:translate"};let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,a){devtools&&devtools.emit(IntlifyDevToolsHooks.I18nInit,{timestamp:Date.now(),i18n:e,version:t,meta:a})}const translateDevTools=createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate);function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreWarnCodes={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function getWarnMessage(e,...t){return format(warnMessages[e],...t)}function fallbackWithSimple(e,t,a){return[...new Set([a,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[a]])]}function fallbackWithLocaleChain(e,t,a){const n=isString(a)?a:DEFAULT_LOCALE,r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let s=r.__localeChainCache.get(n);if(!s){s=[];let e=[a];for(;isArray(e);)e=appendBlockToChain(s,e,t);const i=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(i)?[i]:i,isArray(e)&&appendBlockToChain(s,e,!1),r.__localeChainCache.set(n,s)}return s}function appendBlockToChain(e,t,a){let n=!0;for(let r=0;r<t.length&&isBoolean(n);r++){const s=t[r];isString(s)&&(n=appendLocaleToChain(e,t[r],a))}return n}function appendLocaleToChain(e,t,a){let n;const r=t.split("-");do{n=appendItemToChain(e,r.join("-"),a),r.splice(-1,1)}while(r.length&&!0===n);return n}function appendItemToChain(e,t,a){let n=!1;if(!e.includes(t)&&(n=!0,t)){n="!"!==t[t.length-1];const r=t.replace(/!/g,"");e.push(r),(isArray(a)||isPlainObject(a))&&a[r]&&(n=a[r])}return n}const VERSION="9.3.0-beta.17",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isString(e.version)?e.version:VERSION,a=isString(e.locale)?e.locale:DEFAULT_LOCALE,n=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,r=isPlainObject(e.messages)?e.messages:{[a]:{}},s=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[a]:{}},i=isPlainObject(e.numberFormats)?e.numberFormats:{[a]:{}},o=assign({},e.modifiers||{},getDefaultLinkedModifiers()),l=e.pluralRules||{},c=isFunction(e.missing)?e.missing:null,u=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,m=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,g=!!e.fallbackFormat,_=!!e.unresolving,E=isFunction(e.postTranslation)?e.postTranslation:null,f=isPlainObject(e.processor)?e.processor:null,p=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,d=!!e.escapeParameter,T=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,b=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,A=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,O=isObject(e.fallbackContext)?e.fallbackContext:void 0,C=isFunction(e.onWarn)?e.onWarn:warn,N=e,S=isObject(N.__datetimeFormatters)?N.__datetimeFormatters:new Map,F=isObject(N.__numberFormatters)?N.__numberFormatters:new Map,M=isObject(N.__meta)?N.__meta:{};_cid++;const h={version:t,cid:_cid,locale:a,fallbackLocale:n,messages:r,modifiers:o,pluralRules:l,missing:c,missingWarn:u,fallbackWarn:m,fallbackFormat:g,unresolving:_,postTranslation:E,processor:f,warnHtmlMessage:p,escapeParameter:d,messageCompiler:T,messageResolver:b,localeFallbacker:A,fallbackContext:O,onWarn:C,__meta:M};return h.datetimeFormats=s,h.numberFormats=i,h.__datetimeFormatters=S,h.__numberFormatters=F,h}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,a,n,r){const{missing:s,onWarn:i}=e;if(null!==s){const n=s(e,a,t,r);return isString(n)?n:t}return t}function updateFallbackLocale(e,t,a){e.__localeChainCache=new Map,e.localeFallbacker(e,a,t)}function clearCompileCache(){}function compileToFunction(e,t={}){return()=>e}let code=CompileErrorCodes.__EXTEND_POINT__;const inc=()=>++code,CoreErrorCodes={INVALID_ARGUMENT:code,INVALID_DATE_ARGUMENT:inc(),INVALID_ISO_DATE_ARGUMENT:inc(),__EXTEND_POINT__:inc()};function createCoreError(e){return createCompileError(e,null,void 0)}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT;const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:a,postTranslation:n,unresolving:r,messageCompiler:s,fallbackLocale:i,messages:o}=e,[l,c]=parseTranslateArgs(...t),u=isBoolean(c.missingWarn)?c.missingWarn:e.missingWarn,m=isBoolean(c.fallbackWarn)?c.fallbackWarn:e.fallbackWarn,g=isBoolean(c.escapeParameter)?c.escapeParameter:e.escapeParameter,_=!!c.resolvedMessage,E=isString(c.default)||isBoolean(c.default)?isBoolean(c.default)?s?l:()=>l:c.default:a?s?l:()=>l:"",f=a||""!==E,p=isString(c.locale)?c.locale:e.locale;g&&escapeParams(c);let[d,T,b]=_?[l,p,o[p]||{}]:resolveMessageFormat(e,l,p,i,m,u),A=d,O=l;if(_||isString(A)||isMessageFunction(A)||f&&(A=E,O=A),!(_||(isString(A)||isMessageFunction(A))&&isString(T)))return r?NOT_REOSLVED:l;let C=!1;const N=isMessageFunction(A)?A:compileMessageFormat(e,l,T,A,O,(()=>{C=!0}));if(C)return A;const S=evaluateMessage(e,N,createMessageContext(getMessageContextOptions(e,T,b,c)));return n?n(S,l):S}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,a,n,r,s){const{messages:i,onWarn:o,messageResolver:l,localeFallbacker:c}=e,u=c(e,n,a);let m,g={},_=null;for(let E=0;E<u.length&&(m=u[E],g=i[m]||{},null===(_=l(g,t))&&(_=g[t]),!isString(_)&&!isFunction(_));E++){const a=handleMissing(e,t,m,s,"translate");a!==t&&(_=a)}return[_,m,g]}function compileMessageFormat(e,t,a,n,r,s){const{messageCompiler:i,warnHtmlMessage:o}=e;if(isMessageFunction(n)){const e=n;return e.locale=e.locale||a,e.key=e.key||t,e}if(null==i){const e=()=>n;return e.locale=a,e.key=t,e}const l=i(n,getCompileOptions(e,a,r,n,o,s));return l.locale=a,l.key=t,l.source=n,l}function evaluateMessage(e,t,a){return t(a)}function parseTranslateArgs(...e){const[t,a,n]=e,r={};if(!isString(t)&&!isNumber(t)&&!isMessageFunction(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(a)?r.plural=a:isString(a)?r.default=a:isPlainObject(a)&&!isEmptyObject(a)?r.named=a:isArray(a)&&(r.list=a),isNumber(n)?r.plural=n:isString(n)?r.default=n:isPlainObject(n)&&assign(r,n),[s,r]}function getCompileOptions(e,t,a,n,r,s){return{warnHtmlMessage:r,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,a,e)}}function getMessageContextOptions(e,t,a,n){const{modifiers:r,pluralRules:s,messageResolver:i,fallbackLocale:o,fallbackWarn:l,missingWarn:c,fallbackContext:u}=e,m={locale:t,modifiers:r,pluralRules:s,messages:n=>{let r=i(a,n);if(null==r&&u){const[,,e]=resolveMessageFormat(u,n,t,o,l,c);r=i(e,n)}if(isString(r)){let a=!1;const s=compileMessageFormat(e,n,t,r,n,(()=>{a=!0}));return a?NOOP_MESSAGE_FUNCTION:s}return isMessageFunction(r)?r:NOOP_MESSAGE_FUNCTION}};return e.processor&&(m.processor=e.processor),n.list&&(m.list=n.list),n.named&&(m.named=n.named),isNumber(n.plural)&&(m.pluralIndex=n.plural),m}function datetime(e,...t){const{datetimeFormats:a,unresolving:n,fallbackLocale:r,onWarn:s,localeFallbacker:i}=e,{__datetimeFormatters:o}=e,[l,c,u,m]=parseDateTimeArgs(...t),g=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const _=!!u.part,E=isString(u.locale)?u.locale:e.locale,f=i(e,r,E);if(!isString(l)||""===l)return new Intl.DateTimeFormat(E,m).format(c);let p,d={},T=null;for(let O=0;O<f.length&&(p=f[O],d=a[p]||{},T=d[l],!isPlainObject(T));O++)handleMissing(e,l,p,g,"datetime format");if(!isPlainObject(T)||!isString(p))return n?NOT_REOSLVED:l;let b=`${p}__${l}`;isEmptyObject(m)||(b=`${b}__${JSON.stringify(m)}`);let A=o.get(b);return A||(A=new Intl.DateTimeFormat(p,assign({},T,m)),o.set(b,A)),_?A.formatToParts(c):A.format(c)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,a,n,r]=e,s={};let i,o={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const a=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();i=new Date(a);try{i.toISOString()}catch(l){throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);i=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);i=t}return isString(a)?s.key=a:isPlainObject(a)&&Object.keys(a).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?o[e]=a[e]:s[e]=a[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(o=n),isPlainObject(r)&&(o=r),[s.key||"",i,s,o]}function clearDateTimeFormat(e,t,a){const n=e;for(const r in a){const e=`${t}__${r}`;n.__datetimeFormatters.has(e)&&n.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:a,unresolving:n,fallbackLocale:r,onWarn:s,localeFallbacker:i}=e,{__numberFormatters:o}=e,[l,c,u,m]=parseNumberArgs(...t),g=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const _=!!u.part,E=isString(u.locale)?u.locale:e.locale,f=i(e,r,E);if(!isString(l)||""===l)return new Intl.NumberFormat(E,m).format(c);let p,d={},T=null;for(let O=0;O<f.length&&(p=f[O],d=a[p]||{},T=d[l],!isPlainObject(T));O++)handleMissing(e,l,p,g,"number format");if(!isPlainObject(T)||!isString(p))return n?NOT_REOSLVED:l;let b=`${p}__${l}`;isEmptyObject(m)||(b=`${b}__${JSON.stringify(m)}`);let A=o.get(b);return A||(A=new Intl.NumberFormat(p,assign({},T,m)),o.set(b,A)),_?A.formatToParts(c):A.format(c)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,a,n,r]=e,s={};let i={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const o=t;return isString(a)?s.key=a:isPlainObject(a)&&Object.keys(a).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=a[e]:s[e]=a[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(i=n),isPlainObject(r)&&(i=r),[s.key||"",o,s,i]}function clearNumberFormat(e,t,a){const n=e;for(const r in a){const e=`${t}__${r}`;n.__numberFormatters.has(e)&&n.__numberFormatters.delete(e)}}registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CompileErrorCodes,CoreErrorCodes,CoreWarnCodes,DATETIME_FORMAT_OPTIONS_KEYS,DEFAULT_LOCALE,DEFAULT_MESSAGE_DATA_TYPE,MISSING_RESOLVE_VALUE,NOT_REOSLVED,NUMBER_FORMAT_OPTIONS_KEYS,VERSION,clearCompileCache,clearDateTimeFormat,clearNumberFormat,compileToFunction,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getWarnMessage,handleMissing,initI18nDevTools,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale}; | ||
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,a)=>t.hasOwnProperty(a)?t[a]:""))}const generateFormatCacheKey=(e,t,a)=>friendlyJSONstringify({l:e,k:t,s:a}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length;function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>{if(!isObject(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object},toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e),CompileErrorCodes={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function createCompileError(e,t,a={}){const{domain:n,messages:r,args:s}=a,i=new SyntaxError(String(e));return i.code=e,t&&(i.location=t),i.domain=n,i}const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let a,n,r,s,i,o,l,c=-1,u=0,m=0;const g=[];function _(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,r="\\"+t,g[0](),!0}for(g[0]=()=>{void 0===n?n=r:n+=r},g[1]=()=>{void 0!==n&&(t.push(n),n=void 0)},g[2]=()=>{g[0](),m++},g[3]=()=>{if(m>0)m--,u=4,g[0]();else{if(m=0,void 0===n)return!1;if(n=formatSubPath(n),!1===n)return!1;g[1]()}};null!==u;)if(c++,a=e[c],"\\"!==a||!_()){if(s=getPathCharType(a),l=pathStateMachine[u],i=l[s]||l.l||8,8===i)return;if(u=i[0],void 0!==i[1]&&(o=g[i[1]],o&&(r=a,!1===o())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let a=cache.get(t);if(a||(a=parse(t),a&&cache.set(t,a)),!a)return null;const n=a.length;let r=e,s=0;for(;s<n;){const e=r[a[s]];if(void 0===e)return null;r=e,s++}return r}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":e.join(""),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,a=getPluralIndex(e),n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,r=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],i=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(a,i);function o(t){const a=isFunction(e.messages)?e.messages(t):!!isObject(e.messages)&&e.messages[t];return a||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const l=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,c=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>i[e],plural:e=>e[n(a,e.length,r)],linked:(t,...a)=>{const[n,r]=a;let s="text",i="";1===a.length?isObject(n)?(i=n.modifier||i,s=n.type||s):isString(n)&&(i=n||i):2===a.length&&(isString(n)&&(i=n||i),isString(r)&&(s=r||s));let l=o(t)(u);return"vnode"===s&&isArray(l)&&i&&(l=l[0]),i?(c=i,e.modifiers?e.modifiers[c]:DEFAULT_MODIFIER)(l,s):l;var c},message:o,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:c,normalize:l};return u}const IntlifyDevToolsHooks={I18nInit:"i18n:init",FunctionTranslate:"function:translate"};let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,a){devtools&&devtools.emit(IntlifyDevToolsHooks.I18nInit,{timestamp:Date.now(),i18n:e,version:t,meta:a})}const translateDevTools=createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate);function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreWarnCodes={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function getWarnMessage(e,...t){return format(warnMessages[e],...t)}function fallbackWithSimple(e,t,a){return[...new Set([a,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[a]])]}function fallbackWithLocaleChain(e,t,a){const n=isString(a)?a:DEFAULT_LOCALE,r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let s=r.__localeChainCache.get(n);if(!s){s=[];let e=[a];for(;isArray(e);)e=appendBlockToChain(s,e,t);const i=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(i)?[i]:i,isArray(e)&&appendBlockToChain(s,e,!1),r.__localeChainCache.set(n,s)}return s}function appendBlockToChain(e,t,a){let n=!0;for(let r=0;r<t.length&&isBoolean(n);r++){const s=t[r];isString(s)&&(n=appendLocaleToChain(e,t[r],a))}return n}function appendLocaleToChain(e,t,a){let n;const r=t.split("-");do{n=appendItemToChain(e,r.join("-"),a),r.splice(-1,1)}while(r.length&&!0===n);return n}function appendItemToChain(e,t,a){let n=!1;if(!e.includes(t)&&(n=!0,t)){n="!"!==t[t.length-1];const r=t.replace(/!/g,"");e.push(r),(isArray(a)||isPlainObject(a))&&a[r]&&(n=a[r])}return n}const VERSION="9.3.0-beta.18",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isString(e.version)?e.version:VERSION,a=isString(e.locale)?e.locale:DEFAULT_LOCALE,n=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,r=isPlainObject(e.messages)?e.messages:{[a]:{}},s=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[a]:{}},i=isPlainObject(e.numberFormats)?e.numberFormats:{[a]:{}},o=assign({},e.modifiers||{},getDefaultLinkedModifiers()),l=e.pluralRules||{},c=isFunction(e.missing)?e.missing:null,u=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,m=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,g=!!e.fallbackFormat,_=!!e.unresolving,E=isFunction(e.postTranslation)?e.postTranslation:null,f=isPlainObject(e.processor)?e.processor:null,p=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,d=!!e.escapeParameter,T=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,b=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,A=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,O=isObject(e.fallbackContext)?e.fallbackContext:void 0,C=isFunction(e.onWarn)?e.onWarn:warn,N=e,S=isObject(N.__datetimeFormatters)?N.__datetimeFormatters:new Map,F=isObject(N.__numberFormatters)?N.__numberFormatters:new Map,M=isObject(N.__meta)?N.__meta:{};_cid++;const h={version:t,cid:_cid,locale:a,fallbackLocale:n,messages:r,modifiers:o,pluralRules:l,missing:c,missingWarn:u,fallbackWarn:m,fallbackFormat:g,unresolving:_,postTranslation:E,processor:f,warnHtmlMessage:p,escapeParameter:d,messageCompiler:T,messageResolver:b,localeFallbacker:A,fallbackContext:O,onWarn:C,__meta:M};return h.datetimeFormats=s,h.numberFormats=i,h.__datetimeFormatters=S,h.__numberFormatters=F,h}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,a,n,r){const{missing:s,onWarn:i}=e;if(null!==s){const n=s(e,a,t,r);return isString(n)?n:t}return t}function updateFallbackLocale(e,t,a){e.__localeChainCache=new Map,e.localeFallbacker(e,a,t)}function clearCompileCache(){}function compileToFunction(e,t={}){return()=>e}let code=CompileErrorCodes.__EXTEND_POINT__;const inc=()=>++code,CoreErrorCodes={INVALID_ARGUMENT:code,INVALID_DATE_ARGUMENT:inc(),INVALID_ISO_DATE_ARGUMENT:inc(),__EXTEND_POINT__:inc()};function createCoreError(e){return createCompileError(e,null,void 0)}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT;const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:a,postTranslation:n,unresolving:r,messageCompiler:s,fallbackLocale:i,messages:o}=e,[l,c]=parseTranslateArgs(...t),u=isBoolean(c.missingWarn)?c.missingWarn:e.missingWarn,m=isBoolean(c.fallbackWarn)?c.fallbackWarn:e.fallbackWarn,g=isBoolean(c.escapeParameter)?c.escapeParameter:e.escapeParameter,_=!!c.resolvedMessage,E=isString(c.default)||isBoolean(c.default)?isBoolean(c.default)?s?l:()=>l:c.default:a?s?l:()=>l:"",f=a||""!==E,p=isString(c.locale)?c.locale:e.locale;g&&escapeParams(c);let[d,T,b]=_?[l,p,o[p]||{}]:resolveMessageFormat(e,l,p,i,m,u),A=d,O=l;if(_||isString(A)||isMessageFunction(A)||f&&(A=E,O=A),!(_||(isString(A)||isMessageFunction(A))&&isString(T)))return r?-1:l;let C=!1;const N=isMessageFunction(A)?A:compileMessageFormat(e,l,T,A,O,(()=>{C=!0}));if(C)return A;const S=evaluateMessage(e,N,createMessageContext(getMessageContextOptions(e,T,b,c)));return n?n(S,l):S}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,a,n,r,s){const{messages:i,onWarn:o,messageResolver:l,localeFallbacker:c}=e,u=c(e,n,a);let m,g={},_=null;for(let E=0;E<u.length&&(m=u[E],g=i[m]||{},null===(_=l(g,t))&&(_=g[t]),!isString(_)&&!isFunction(_));E++){const a=handleMissing(e,t,m,s,"translate");a!==t&&(_=a)}return[_,m,g]}function compileMessageFormat(e,t,a,n,r,s){const{messageCompiler:i,warnHtmlMessage:o}=e;if(isMessageFunction(n)){const e=n;return e.locale=e.locale||a,e.key=e.key||t,e}if(null==i){const e=()=>n;return e.locale=a,e.key=t,e}const l=i(n,getCompileOptions(e,a,r,n,o,s));return l.locale=a,l.key=t,l.source=n,l}function evaluateMessage(e,t,a){return t(a)}function parseTranslateArgs(...e){const[t,a,n]=e,r={};if(!isString(t)&&!isNumber(t)&&!isMessageFunction(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(a)?r.plural=a:isString(a)?r.default=a:isPlainObject(a)&&!isEmptyObject(a)?r.named=a:isArray(a)&&(r.list=a),isNumber(n)?r.plural=n:isString(n)?r.default=n:isPlainObject(n)&&assign(r,n),[s,r]}function getCompileOptions(e,t,a,n,r,s){return{warnHtmlMessage:r,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,a,e)}}function getMessageContextOptions(e,t,a,n){const{modifiers:r,pluralRules:s,messageResolver:i,fallbackLocale:o,fallbackWarn:l,missingWarn:c,fallbackContext:u}=e,m={locale:t,modifiers:r,pluralRules:s,messages:n=>{let r=i(a,n);if(null==r&&u){const[,,e]=resolveMessageFormat(u,n,t,o,l,c);r=i(e,n)}if(isString(r)){let a=!1;const s=compileMessageFormat(e,n,t,r,n,(()=>{a=!0}));return a?NOOP_MESSAGE_FUNCTION:s}return isMessageFunction(r)?r:NOOP_MESSAGE_FUNCTION}};return e.processor&&(m.processor=e.processor),n.list&&(m.list=n.list),n.named&&(m.named=n.named),isNumber(n.plural)&&(m.pluralIndex=n.plural),m}function datetime(e,...t){const{datetimeFormats:a,unresolving:n,fallbackLocale:r,onWarn:s,localeFallbacker:i}=e,{__datetimeFormatters:o}=e,[l,c,u,m]=parseDateTimeArgs(...t),g=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const _=!!u.part,E=isString(u.locale)?u.locale:e.locale,f=i(e,r,E);if(!isString(l)||""===l)return new Intl.DateTimeFormat(E,m).format(c);let p,d={},T=null;for(let O=0;O<f.length&&(p=f[O],d=a[p]||{},T=d[l],!isPlainObject(T));O++)handleMissing(e,l,p,g,"datetime format");if(!isPlainObject(T)||!isString(p))return n?-1:l;let b=`${p}__${l}`;isEmptyObject(m)||(b=`${b}__${JSON.stringify(m)}`);let A=o.get(b);return A||(A=new Intl.DateTimeFormat(p,assign({},T,m)),o.set(b,A)),_?A.formatToParts(c):A.format(c)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,a,n,r]=e,s={};let i,o={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const a=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();i=new Date(a);try{i.toISOString()}catch(l){throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);i=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);i=t}return isString(a)?s.key=a:isPlainObject(a)&&Object.keys(a).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?o[e]=a[e]:s[e]=a[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(o=n),isPlainObject(r)&&(o=r),[s.key||"",i,s,o]}function clearDateTimeFormat(e,t,a){const n=e;for(const r in a){const e=`${t}__${r}`;n.__datetimeFormatters.has(e)&&n.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:a,unresolving:n,fallbackLocale:r,onWarn:s,localeFallbacker:i}=e,{__numberFormatters:o}=e,[l,c,u,m]=parseNumberArgs(...t),g=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const _=!!u.part,E=isString(u.locale)?u.locale:e.locale,f=i(e,r,E);if(!isString(l)||""===l)return new Intl.NumberFormat(E,m).format(c);let p,d={},T=null;for(let O=0;O<f.length&&(p=f[O],d=a[p]||{},T=d[l],!isPlainObject(T));O++)handleMissing(e,l,p,g,"number format");if(!isPlainObject(T)||!isString(p))return n?-1:l;let b=`${p}__${l}`;isEmptyObject(m)||(b=`${b}__${JSON.stringify(m)}`);let A=o.get(b);return A||(A=new Intl.NumberFormat(p,assign({},T,m)),o.set(b,A)),_?A.formatToParts(c):A.format(c)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,a,n,r]=e,s={};let i={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const o=t;return isString(a)?s.key=a:isPlainObject(a)&&Object.keys(a).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=a[e]:s[e]=a[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(i=n),isPlainObject(r)&&(i=r),[s.key||"",o,s,i]}function clearNumberFormat(e,t,a){const n=e;for(const r in a){const e=`${t}__${r}`;n.__numberFormatters.has(e)&&n.__numberFormatters.delete(e)}}registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CompileErrorCodes,CoreErrorCodes,CoreWarnCodes,DATETIME_FORMAT_OPTIONS_KEYS,DEFAULT_LOCALE,DEFAULT_MESSAGE_DATA_TYPE,MISSING_RESOLVE_VALUE,NOT_REOSLVED,NUMBER_FORMAT_OPTIONS_KEYS,VERSION,clearCompileCache,clearDateTimeFormat,clearNumberFormat,compileToFunction,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getWarnMessage,handleMissing,initI18nDevTools,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale}; |
/*! | ||
* core v9.3.0-beta.17 | ||
* core v9.3.0-beta.18 | ||
* (c) 2023 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),a=e=>"number"==typeof e&&isFinite(e),o=e=>"[object Date]"===d(e),l=e=>"[object RegExp]"===d(e),s=e=>A(e)&&0===Object.keys(e).length;function i(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const c=Object.assign;function u(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const m=Array.isArray,_=e=>"function"==typeof e,f=e=>"string"==typeof e,g=e=>"boolean"==typeof e,E=e=>null!==e&&"object"==typeof e,p=Object.prototype.toString,d=e=>p.call(e),A=e=>"[object Object]"===d(e),T={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function N(e,t,n={}){const{domain:r,messages:a,args:o}=n,l=new SyntaxError(String(e));return l.code=e,t&&(l.location=t),l.domain=r,l}const 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 I=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function C(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 D(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,I.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function k(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,m=0;const _=[];function f(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,_[0](),!0}for(_[0]=()=>{void 0===r?r=a:r+=a},_[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},_[2]=()=>{_[0](),m++},_[3]=()=>{if(m>0)m--,u=4,_[0]();else{if(m=0,void 0===r)return!1;if(r=D(r),!1===r)return!1;_[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!f()){if(o=C(n),i=b[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=_[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const F=new Map;function L(e,t){return E(e)?e[t]:null}function h(e,t){if(!E(e))return null;let n=F.get(t);if(n||(n=k(t),n&&F.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 O=e=>e,M=e=>"",y="text",R=e=>0===e.length?"":e.join(""),S=e=>null==e?"":m(e)||A(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function W(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function v(e={}){const t=e.locale,n=function(e){const t=a(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(a(e.named.count)||a(e.named.n))?a(e.named.count)?e.named.count:a(e.named.n)?e.named.n:t:t}(e),r=E(e.pluralRules)&&f(t)&&_(e.pluralRules[t])?e.pluralRules[t]:W,o=E(e.pluralRules)&&f(t)&&_(e.pluralRules[t])?W:void 0,l=e.list||[],s=e.named||{};a(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function i(t){const n=_(e.messages)?e.messages(t):!!E(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):M)}const c=A(e.processor)&&_(e.processor.normalize)?e.processor.normalize:R,u=A(e.processor)&&_(e.processor.interpolate)?e.processor.interpolate:S,g={list:e=>l[e],named:e=>s[e],plural:e=>e[r(n,e.length,o)],linked:(t,...n)=>{const[r,a]=n;let o="text",l="";1===n.length?E(r)?(l=r.modifier||l,o=r.type||o):f(r)&&(l=r||l):2===n.length&&(f(r)&&(l=r||l),f(a)&&(o=a||o));let s=i(t)(g);return"vnode"===o&&m(s)&&l&&(s=s[0]),l?(c=l,e.modifiers?e.modifiers[c]:O)(s,o):s;var c},message:i,type:A(e.processor)&&f(e.processor.type)?e.processor.type:y,interpolate:u,normalize:c};return g}const w={I18nInit:"i18n:init",FunctionTranslate:"function:translate"};let U=null;const P=V(w.FunctionTranslate);function V(e){return t=>U&&U.emit(e,t)}const x={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},G={[x.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[x.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[x.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[x.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[x.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[x.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function K(e,t,n){return[...new Set([n,...m(t)?t:E(t)?Object.keys(t):f(t)?[t]:[n]])]}function $(e,t,n){const r=f(n)?n:z,a=e;a.__localeChainCache||(a.__localeChainCache=new Map);let o=a.__localeChainCache.get(r);if(!o){o=[];let e=[n];for(;m(e);)e=j(o,e,t);const l=m(t)||!A(t)?t:t.default?t.default:null;e=f(l)?[l]:l,m(e)&&j(o,e,!1),a.__localeChainCache.set(r,o)}return o}function j(e,t,n){let r=!0;for(let a=0;a<t.length&&g(r);a++){const o=t[a];f(o)&&(r=B(e,t[a],n))}return r}function B(e,t,n){let r;const a=t.split("-");do{r=H(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function H(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),(m(n)||A(n))&&n[a]&&(r=n[a])}return r}const Y="9.3.0-beta.17",X=-1,z="en-US",J=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let Z,Q,q;function ee(e){Q=e}function te(e){q=e}let ne=null;let re=null;let ae=0;function oe(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return f(r)?r:t}return t}let le=T.__EXTEND_POINT__;const se=()=>++le,ie={INVALID_ARGUMENT:le,INVALID_DATE_ARGUMENT:se(),INVALID_ISO_DATE_ARGUMENT:se(),__EXTEND_POINT__:se()};ie.INVALID_ARGUMENT,ie.INVALID_DATE_ARGUMENT,ie.INVALID_ISO_DATE_ARGUMENT;const ce=()=>"",ue=e=>_(e);function me(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,u=c(e,r,n);let m,g={},E=null;for(let p=0;p<u.length&&(m=u[p],g=l[m]||{},null===(E=i(g,t))&&(E=g[t]),!f(E)&&!_(E));p++){const n=oe(e,t,m,0,"translate");n!==t&&(E=n)}return[E,m,g]}function _e(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(ue(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==s){const e=()=>a;return e.locale=r,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=>n(t,r,e)}}(0,r,o,0,i,l));return c.locale=r,c.key=t,c.source=a,c}function fe(...e){const[t,n,r]=e,o={};if(!f(t)&&!a(t)&&!ue(t))throw Error(ie.INVALID_ARGUMENT);const l=a(t)?String(t):(ue(t),t);return a(n)?o.plural=n:f(n)?o.default=n:A(n)&&!s(n)?o.named=n:m(n)&&(o.list=n),a(r)?o.plural=r:f(r)?o.default=r:A(r)&&c(o,r),[l,o]}const ge=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Ee(...e){const[t,n,r,l]=e,s={};let i,c={};if(f(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(ie.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();i=new Date(n);try{i.toISOString()}catch(u){throw Error(ie.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(ie.INVALID_DATE_ARGUMENT);i=t}else{if(!a(t))throw Error(ie.INVALID_ARGUMENT);i=t}return f(n)?s.key=n:A(n)&&Object.keys(n).forEach((e=>{ge.includes(e)?c[e]=n[e]:s[e]=n[e]})),f(r)?s.locale=r:A(r)&&(c=r),A(l)&&(c=l),[s.key||"",i,s,c]}const pe=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function de(...e){const[t,n,r,o]=e,l={};let s={};if(!a(t))throw Error(ie.INVALID_ARGUMENT);const i=t;return f(n)?l.key=n:A(n)&&Object.keys(n).forEach((e=>{pe.includes(e)?s[e]=n[e]:l[e]=n[e]})),f(r)?l.locale=r:A(r)&&(s=r),A(o)&&(s=o),[l.key||"",i,l,s]}return ee(h),te($),e.CompileErrorCodes=T,e.CoreErrorCodes=ie,e.CoreWarnCodes=x,e.DATETIME_FORMAT_OPTIONS_KEYS=ge,e.DEFAULT_LOCALE=z,e.DEFAULT_MESSAGE_DATA_TYPE=y,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=X,e.NUMBER_FORMAT_OPTIONS_KEYS=pe,e.VERSION=Y,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCompileError=N,e.createCoreContext=function(e={}){const t=f(e.version)?e.version:Y,n=f(e.locale)?e.locale:z,r=m(e.fallbackLocale)||A(e.fallbackLocale)||f(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,a=A(e.messages)?e.messages:{[n]:{}},o=A(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},s=A(e.numberFormats)?e.numberFormats:{[n]:{}},u=c({},e.modifiers||{},{upper:(e,t)=>"text"===t&&f(e)?e.toUpperCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&f(e)?e.toLowerCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&f(e)?J(e):"vnode"===t&&E(e)&&"__v_isVNode"in e?J(e.children):e}),p=e.pluralRules||{},d=_(e.missing)?e.missing:null,T=!g(e.missingWarn)&&!l(e.missingWarn)||e.missingWarn,N=!g(e.fallbackWarn)&&!l(e.fallbackWarn)||e.fallbackWarn,b=!!e.fallbackFormat,I=!!e.unresolving,C=_(e.postTranslation)?e.postTranslation:null,D=A(e.processor)?e.processor:null,k=!g(e.warnHtmlMessage)||e.warnHtmlMessage,F=!!e.escapeParameter,h=_(e.messageCompiler)?e.messageCompiler:Z,O=_(e.messageResolver)?e.messageResolver:Q||L,M=_(e.localeFallbacker)?e.localeFallbacker:q||K,y=E(e.fallbackContext)?e.fallbackContext:void 0,R=_(e.onWarn)?e.onWarn:i,S=e,W=E(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,v=E(S.__numberFormatters)?S.__numberFormatters:new Map,w=E(S.__meta)?S.__meta:{};ae++;const U={version:t,cid:ae,locale:n,fallbackLocale:r,messages:a,modifiers:u,pluralRules:p,missing:d,missingWarn:T,fallbackWarn:N,fallbackFormat:b,unresolving:I,postTranslation:C,processor:D,warnHtmlMessage:k,escapeParameter:F,messageCompiler:h,messageResolver:O,localeFallbacker:M,fallbackContext:y,onWarn:R,__meta:w};return U.datetimeFormats=o,U.numberFormats=s,U.__datetimeFormatters=W,U.__numberFormatters=v,U},e.createCoreError=function(e){return N(e,null,void 0)},e.createMessageContext=v,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a,onWarn:o,localeFallbacker:l}=e,{__datetimeFormatters:i}=e,[u,m,_,E]=Ee(...t);g(_.missingWarn)?_.missingWarn:e.missingWarn,g(_.fallbackWarn)?_.fallbackWarn:e.fallbackWarn;const p=!!_.part,d=f(_.locale)?_.locale:e.locale,T=l(e,a,d);if(!f(u)||""===u)return new Intl.DateTimeFormat(d,E).format(m);let N,b={},I=null;for(let s=0;s<T.length&&(N=T[s],b=n[N]||{},I=b[u],!A(I));s++)oe(e,u,N,0,"datetime format");if(!A(I)||!f(N))return r?X:u;let C=`${N}__${u}`;s(E)||(C=`${C}__${JSON.stringify(E)}`);let D=i.get(C);return D||(D=new Intl.DateTimeFormat(N,c({},I,E)),i.set(C,D)),p?D.formatToParts(m):D.format(m)},e.fallbackWithLocaleChain=$,e.fallbackWithSimple=K,e.getAdditionalMeta=()=>ne,e.getDevToolsHook=function(){return U},e.getFallbackContext=()=>re,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&E(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(G[e],...n)},e.handleMissing=oe,e.initI18nDevTools=function(e,t,n){U&&U.emit(w.I18nInit,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=ue,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,onWarn:o,localeFallbacker:l}=e,{__numberFormatters:i}=e,[u,m,_,E]=de(...t);g(_.missingWarn)?_.missingWarn:e.missingWarn,g(_.fallbackWarn)?_.fallbackWarn:e.fallbackWarn;const p=!!_.part,d=f(_.locale)?_.locale:e.locale,T=l(e,a,d);if(!f(u)||""===u)return new Intl.NumberFormat(d,E).format(m);let N,b={},I=null;for(let s=0;s<T.length&&(N=T[s],b=n[N]||{},I=b[u],!A(I));s++)oe(e,u,N,0,"number format");if(!A(I)||!f(N))return r?X:u;let C=`${N}__${u}`;s(E)||(C=`${C}__${JSON.stringify(E)}`);let D=i.get(C);return D||(D=new Intl.NumberFormat(N,c({},I,E)),i.set(C,D)),p?D.formatToParts(m):D.format(m)},e.parse=k,e.parseDateTimeArgs=Ee,e.parseNumberArgs=de,e.parseTranslateArgs=fe,e.registerLocaleFallbacker=te,e.registerMessageCompiler=function(e){Z=e},e.registerMessageResolver=ee,e.resolveValue=h,e.resolveWithKeyValue=L,e.setAdditionalMeta=e=>{ne=e},e.setDevToolsHook=function(e){U=e},e.setFallbackContext=e=>{re=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:i}=e,[c,_]=fe(...t),p=g(_.missingWarn)?_.missingWarn:e.missingWarn,d=g(_.fallbackWarn)?_.fallbackWarn:e.fallbackWarn,A=g(_.escapeParameter)?_.escapeParameter:e.escapeParameter,T=!!_.resolvedMessage,N=f(_.default)||g(_.default)?g(_.default)?l?c:()=>c:_.default:n?l?c:()=>c:"",b=n||""!==N,I=f(_.locale)?_.locale:e.locale;A&&function(e){m(e.list)?e.list=e.list.map((e=>f(e)?u(e):e)):E(e.named)&&Object.keys(e.named).forEach((t=>{f(e.named[t])&&(e.named[t]=u(e.named[t]))}))}(_);let[C,D,k]=T?[c,I,i[I]||{}]:me(e,c,I,s,d,p),F=C,L=c;if(T||f(F)||ue(F)||b&&(F=N,L=F),!(T||(f(F)||ue(F))&&f(D)))return o?X:c;let h=!1;const O=ue(F)?F:_e(e,c,D,F,L,(()=>{h=!0}));if(h)return F;const M=function(e,t,n,r){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:m}=e,_=r=>{let a=s(n,r);if(null==a&&m){const[,,e]=me(m,r,t,i,c,u);a=s(e,r)}if(f(a)){let n=!1;const o=_e(e,r,t,a,r,(()=>{n=!0}));return n?ce:o}return ue(a)?a:ce},g={locale:t,modifiers:o,pluralRules:l,messages:_};e.processor&&(g.processor=e.processor);r.list&&(g.list=r.list);r.named&&(g.named=r.named);a(r.plural)&&(g.pluralIndex=r.plural);return g}(e,D,k,_),y=function(e,t,n){const r=t(n);return r}(0,O,v(M));return r?r(y,c):y},e.translateDevTools=P,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({}); | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),a=e=>"number"==typeof e&&isFinite(e),o=e=>"[object Date]"===d(e),l=e=>"[object RegExp]"===d(e),s=e=>A(e)&&0===Object.keys(e).length;function i(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const c=Object.assign;function u(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const m=Array.isArray,f=e=>"function"==typeof e,_=e=>"string"==typeof e,g=e=>"boolean"==typeof e,E=e=>null!==e&&"object"==typeof e,p=Object.prototype.toString,d=e=>p.call(e),A=e=>{if(!E(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object},T={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function N(e,t,n={}){const{domain:r,messages:a,args:o}=n,l=new SyntaxError(String(e));return l.code=e,t&&(l.location=t),l.domain=r,l}const 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 C=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function D(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)))&&(n=t,C.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function k(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,m=0;const f=[];function _(){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||!_()){if(o=D(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 L=new Map;function F(e,t){return E(e)?e[t]:null}function O(e,t){if(!E(e))return null;let n=L.get(t);if(n||(n=k(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 h=e=>e,y=e=>"",M="text",R=e=>0===e.length?"":e.join(""),S=e=>null==e?"":m(e)||A(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function W(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function v(e={}){const t=e.locale,n=function(e){const t=a(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(a(e.named.count)||a(e.named.n))?a(e.named.count)?e.named.count:a(e.named.n)?e.named.n:t:t}(e),r=E(e.pluralRules)&&_(t)&&f(e.pluralRules[t])?e.pluralRules[t]:W,o=E(e.pluralRules)&&_(t)&&f(e.pluralRules[t])?W:void 0,l=e.list||[],s=e.named||{};a(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function i(t){const n=f(e.messages)?e.messages(t):!!E(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):y)}const c=A(e.processor)&&f(e.processor.normalize)?e.processor.normalize:R,u=A(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:S,g={list:e=>l[e],named:e=>s[e],plural:e=>e[r(n,e.length,o)],linked:(t,...n)=>{const[r,a]=n;let o="text",l="";1===n.length?E(r)?(l=r.modifier||l,o=r.type||o):_(r)&&(l=r||l):2===n.length&&(_(r)&&(l=r||l),_(a)&&(o=a||o));let s=i(t)(g);return"vnode"===o&&m(s)&&l&&(s=s[0]),l?(c=l,e.modifiers?e.modifiers[c]:h)(s,o):s;var c},message:i,type:A(e.processor)&&_(e.processor.type)?e.processor.type:M,interpolate:u,normalize:c};return g}const w="i18n:init";let U=null;const P=V("function:translate");function V(e){return t=>U&&U.emit(e,t)}const x={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},G={[x.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[x.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[x.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[x.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[x.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[x.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function K(e,t,n){return[...new Set([n,...m(t)?t:E(t)?Object.keys(t):_(t)?[t]:[n]])]}function $(e,t,n){const r=_(n)?n:X,a=e;a.__localeChainCache||(a.__localeChainCache=new Map);let o=a.__localeChainCache.get(r);if(!o){o=[];let e=[n];for(;m(e);)e=j(o,e,t);const l=m(t)||!A(t)?t:t.default?t.default:null;e=_(l)?[l]:l,m(e)&&j(o,e,!1),a.__localeChainCache.set(r,o)}return o}function j(e,t,n){let r=!0;for(let a=0;a<t.length&&g(r);a++){const o=t[a];_(o)&&(r=B(e,t[a],n))}return r}function B(e,t,n){let r;const a=t.split("-");do{r=H(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function H(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),(m(n)||A(n))&&n[a]&&(r=n[a])}return r}const Y="9.3.0-beta.18",X="en-US",z=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let J,Z,Q;function q(e){Z=e}function ee(e){Q=e}let te=null;let ne=null;let re=0;function ae(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return _(r)?r:t}return t}let oe=T.__EXTEND_POINT__;const le=()=>++oe,se={INVALID_ARGUMENT:oe,INVALID_DATE_ARGUMENT:le(),INVALID_ISO_DATE_ARGUMENT:le(),__EXTEND_POINT__:le()};se.INVALID_ARGUMENT,se.INVALID_DATE_ARGUMENT,se.INVALID_ISO_DATE_ARGUMENT;const ie=()=>"",ce=e=>f(e);function ue(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,u=c(e,r,n);let m,g={},E=null;for(let p=0;p<u.length&&(m=u[p],g=l[m]||{},null===(E=i(g,t))&&(E=g[t]),!_(E)&&!f(E));p++){const n=ae(e,t,m,0,"translate");n!==t&&(E=n)}return[E,m,g]}function me(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(ce(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==s){const e=()=>a;return e.locale=r,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=>n(t,r,e)}}(0,r,o,0,i,l));return c.locale=r,c.key=t,c.source=a,c}function fe(...e){const[t,n,r]=e,o={};if(!_(t)&&!a(t)&&!ce(t))throw Error(se.INVALID_ARGUMENT);const l=a(t)?String(t):(ce(t),t);return a(n)?o.plural=n:_(n)?o.default=n:A(n)&&!s(n)?o.named=n:m(n)&&(o.list=n),a(r)?o.plural=r:_(r)?o.default=r:A(r)&&c(o,r),[l,o]}const _e=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function ge(...e){const[t,n,r,l]=e,s={};let i,c={};if(_(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(se.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();i=new Date(n);try{i.toISOString()}catch(u){throw Error(se.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(se.INVALID_DATE_ARGUMENT);i=t}else{if(!a(t))throw Error(se.INVALID_ARGUMENT);i=t}return _(n)?s.key=n:A(n)&&Object.keys(n).forEach((e=>{_e.includes(e)?c[e]=n[e]:s[e]=n[e]})),_(r)?s.locale=r:A(r)&&(c=r),A(l)&&(c=l),[s.key||"",i,s,c]}const Ee=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function pe(...e){const[t,n,r,o]=e,l={};let s={};if(!a(t))throw Error(se.INVALID_ARGUMENT);const i=t;return _(n)?l.key=n:A(n)&&Object.keys(n).forEach((e=>{Ee.includes(e)?s[e]=n[e]:l[e]=n[e]})),_(r)?l.locale=r:A(r)&&(s=r),A(o)&&(s=o),[l.key||"",i,l,s]}return q(O),ee($),e.CompileErrorCodes=T,e.CoreErrorCodes=se,e.CoreWarnCodes=x,e.DATETIME_FORMAT_OPTIONS_KEYS=_e,e.DEFAULT_LOCALE=X,e.DEFAULT_MESSAGE_DATA_TYPE=M,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=Ee,e.VERSION=Y,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCompileError=N,e.createCoreContext=function(e={}){const t=_(e.version)?e.version:Y,n=_(e.locale)?e.locale:X,r=m(e.fallbackLocale)||A(e.fallbackLocale)||_(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,a=A(e.messages)?e.messages:{[n]:{}},o=A(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},s=A(e.numberFormats)?e.numberFormats:{[n]:{}},u=c({},e.modifiers||{},{upper:(e,t)=>"text"===t&&_(e)?e.toUpperCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&_(e)?e.toLowerCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&_(e)?z(e):"vnode"===t&&E(e)&&"__v_isVNode"in e?z(e.children):e}),p=e.pluralRules||{},d=f(e.missing)?e.missing:null,T=!g(e.missingWarn)&&!l(e.missingWarn)||e.missingWarn,N=!g(e.fallbackWarn)&&!l(e.fallbackWarn)||e.fallbackWarn,b=!!e.fallbackFormat,C=!!e.unresolving,D=f(e.postTranslation)?e.postTranslation:null,I=A(e.processor)?e.processor:null,k=!g(e.warnHtmlMessage)||e.warnHtmlMessage,L=!!e.escapeParameter,O=f(e.messageCompiler)?e.messageCompiler:J,h=f(e.messageResolver)?e.messageResolver:Z||F,y=f(e.localeFallbacker)?e.localeFallbacker:Q||K,M=E(e.fallbackContext)?e.fallbackContext:void 0,R=f(e.onWarn)?e.onWarn:i,S=e,W=E(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,v=E(S.__numberFormatters)?S.__numberFormatters:new Map,w=E(S.__meta)?S.__meta:{};re++;const U={version:t,cid:re,locale:n,fallbackLocale:r,messages:a,modifiers:u,pluralRules:p,missing:d,missingWarn:T,fallbackWarn:N,fallbackFormat:b,unresolving:C,postTranslation:D,processor:I,warnHtmlMessage:k,escapeParameter:L,messageCompiler:O,messageResolver:h,localeFallbacker:y,fallbackContext:M,onWarn:R,__meta:w};return U.datetimeFormats=o,U.numberFormats=s,U.__datetimeFormatters=W,U.__numberFormatters=v,U},e.createCoreError=function(e){return N(e,null,void 0)},e.createMessageContext=v,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a,onWarn:o,localeFallbacker:l}=e,{__datetimeFormatters:i}=e,[u,m,f,E]=ge(...t);g(f.missingWarn)?f.missingWarn:e.missingWarn,g(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn;const p=!!f.part,d=_(f.locale)?f.locale:e.locale,T=l(e,a,d);if(!_(u)||""===u)return new Intl.DateTimeFormat(d,E).format(m);let N,b={},C=null;for(let s=0;s<T.length&&(N=T[s],b=n[N]||{},C=b[u],!A(C));s++)ae(e,u,N,0,"datetime format");if(!A(C)||!_(N))return r?-1:u;let D=`${N}__${u}`;s(E)||(D=`${D}__${JSON.stringify(E)}`);let I=i.get(D);return I||(I=new Intl.DateTimeFormat(N,c({},C,E)),i.set(D,I)),p?I.formatToParts(m):I.format(m)},e.fallbackWithLocaleChain=$,e.fallbackWithSimple=K,e.getAdditionalMeta=()=>te,e.getDevToolsHook=function(){return U},e.getFallbackContext=()=>ne,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&E(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(G[e],...n)},e.handleMissing=ae,e.initI18nDevTools=function(e,t,n){U&&U.emit(w,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=ce,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,onWarn:o,localeFallbacker:l}=e,{__numberFormatters:i}=e,[u,m,f,E]=pe(...t);g(f.missingWarn)?f.missingWarn:e.missingWarn,g(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn;const p=!!f.part,d=_(f.locale)?f.locale:e.locale,T=l(e,a,d);if(!_(u)||""===u)return new Intl.NumberFormat(d,E).format(m);let N,b={},C=null;for(let s=0;s<T.length&&(N=T[s],b=n[N]||{},C=b[u],!A(C));s++)ae(e,u,N,0,"number format");if(!A(C)||!_(N))return r?-1:u;let D=`${N}__${u}`;s(E)||(D=`${D}__${JSON.stringify(E)}`);let I=i.get(D);return I||(I=new Intl.NumberFormat(N,c({},C,E)),i.set(D,I)),p?I.formatToParts(m):I.format(m)},e.parse=k,e.parseDateTimeArgs=ge,e.parseNumberArgs=pe,e.parseTranslateArgs=fe,e.registerLocaleFallbacker=ee,e.registerMessageCompiler=function(e){J=e},e.registerMessageResolver=q,e.resolveValue=O,e.resolveWithKeyValue=F,e.setAdditionalMeta=e=>{te=e},e.setDevToolsHook=function(e){U=e},e.setFallbackContext=e=>{ne=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:i}=e,[c,f]=fe(...t),p=g(f.missingWarn)?f.missingWarn:e.missingWarn,d=g(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,A=g(f.escapeParameter)?f.escapeParameter:e.escapeParameter,T=!!f.resolvedMessage,N=_(f.default)||g(f.default)?g(f.default)?l?c:()=>c:f.default:n?l?c:()=>c:"",b=n||""!==N,C=_(f.locale)?f.locale:e.locale;A&&function(e){m(e.list)?e.list=e.list.map((e=>_(e)?u(e):e)):E(e.named)&&Object.keys(e.named).forEach((t=>{_(e.named[t])&&(e.named[t]=u(e.named[t]))}))}(f);let[D,I,k]=T?[c,C,i[C]||{}]:ue(e,c,C,s,d,p),L=D,F=c;if(T||_(L)||ce(L)||b&&(L=N,F=L),!(T||(_(L)||ce(L))&&_(I)))return o?-1:c;let O=!1;const h=ce(L)?L:me(e,c,I,L,F,(()=>{O=!0}));if(O)return L;const y=function(e,t,n,r){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:m}=e,f=r=>{let a=s(n,r);if(null==a&&m){const[,,e]=ue(m,r,t,i,c,u);a=s(e,r)}if(_(a)){let n=!1;const o=me(e,r,t,a,r,(()=>{n=!0}));return n?ie:o}return ce(a)?a:ie},g={locale:t,modifiers:o,pluralRules:l,messages:f};e.processor&&(g.processor=e.processor);r.list&&(g.list=r.list);r.named&&(g.named=r.named);a(r.plural)&&(g.pluralIndex=r.plural);return g}(e,I,k,f),M=function(e,t,n){const r=t(n);return r}(0,h,v(y));return r?r(M,c):M},e.translateDevTools=P,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({}); |
export {}; | ||
//# sourceMappingURL=basic.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=component.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=datetime-format.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=number-format.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=translation.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=plural.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=global.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=inherit-locale.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=local.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=datetime-format.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=number-format.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=translation.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=composition.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=datetime.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=basic.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=object.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=plural.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=preserve.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=basic.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=component.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=default-format.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=format.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=option.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=suppress.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=linked.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=list.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=literal.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=named.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=ruby.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=linked.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=list.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=named.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=plural.spec.d.ts.map |
@@ -0,0 +0,0 @@ import type { Page } from 'playwright'; |
export {}; | ||
//# sourceMappingURL=handler.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=option.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=suppress.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=number.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=basic.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=custom.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=global.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=inherit-locale.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=local.spec.d.ts.map |
export {}; | ||
//# sourceMappingURL=started.spec.d.ts.map |
export declare function setup(): Promise<() => Promise<void>>; | ||
//# sourceMappingURL=vitest.globalSetup.d.ts.map |
export {}; | ||
//# sourceMappingURL=vitest.setup.d.ts.map |
{ | ||
"name": "@intlify/core", | ||
"version": "9.3.0-beta.17", | ||
"version": "9.3.0-beta.18", | ||
"description": "@intlify/core", | ||
@@ -36,6 +36,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@intlify/core-base": "9.3.0-beta.17" | ||
"@intlify/core-base": "9.3.0-beta.18" | ||
}, | ||
"engines": { | ||
"node": ">= 14" | ||
"node": ">= 16" | ||
}, | ||
@@ -42,0 +42,0 @@ "buildOptions": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10090
471326
+ Added@intlify/core-base@9.3.0-beta.18(transitive)
+ Added@intlify/devtools-if@9.3.0-beta.18(transitive)
+ Added@intlify/message-compiler@9.3.0-beta.18(transitive)
+ Added@intlify/shared@9.3.0-beta.18(transitive)
+ Added@intlify/vue-devtools@9.3.0-beta.18(transitive)
- Removed@intlify/core-base@9.3.0-beta.17(transitive)
- Removed@intlify/devtools-if@9.3.0-beta.17(transitive)
- Removed@intlify/message-compiler@9.3.0-beta.17(transitive)
- Removed@intlify/shared@9.3.0-beta.17(transitive)
- Removed@intlify/vue-devtools@9.3.0-beta.17(transitive)