@intlify/core
Advanced tools
Comparing version 9.1.4 to 9.1.5
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===k(e),o=e=>g(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const s=Object.assign;function a(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const u=Object.prototype.hasOwnProperty;function l(e,t){return u.call(e,t)}const i=Array.isArray,f=e=>"function"==typeof e,p=e=>"string"==typeof e,m=e=>"boolean"==typeof e,d=e=>null!==e&&"object"==typeof e,h=Object.prototype.toString,k=e=>h.call(e),g=e=>"[object Object]"===k(e),b=[];b[0]={w:[0],i:[3,0],"[":[4],o:[7]},b[1]={w:[1],".":[2],"[":[4],o:[7]},b[2]={w:[2],i:[3,0],0:[3,0]},b[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},b[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},b[5]={"'":[4,0],o:8,l:[5,0]},b[6]={'"':[4,0],o:8,l:[6,0]};const y=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function x(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function w(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(y.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function C(e){const t=[];let n,r,o,c,s,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=w(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(c=x(n),u=b[i],s=u[c]||u.l||8,8===s)return;if(i=s[0],void 0!==s[1]&&(a=p[s[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const _=new Map;function v(e,t){if(!d(e))return null;let n=_.get(t);if(n||(n=C(t),n&&_.set(t,n)),!n)return null;const r=n.length;let o=e,c=0;for(;c<r;){const e=o[n[c]];if(void 0===e)return null;o=e,c++}return o}function L(e){if(!d(e))return e;for(const t in e)if(l(e,t))if(t.includes(".")){const n=t.split("."),r=n.length-1;let o=e;for(let e=0;e<r;e++)n[e]in o||(o[n[e]]={}),o=o[n[e]];o[n[r]]=e[t],delete e[t],d(o[n[r]])&&L(o[n[r]])}else d(e[t])&&L(e[t]);return e}const T=e=>e,P=e=>"",O="text",F=e=>0===e.length?"":e.join(""),N=e=>null==e?"":i(e)||g(e)&&e.toString===h?JSON.stringify(e,null,2):String(e);function $(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function S(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?e.pluralRules[t]:$,c=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?$:void 0,s=e.list||[],a=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,a);function u(t){const n=f(e.messages)?e.messages(t):!!d(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):P)}const l=g(e.processor)&&f(e.processor.normalize)?e.processor.normalize:F,i=g(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:N,m={list:e=>s[e],named:e=>a[e],plural:e=>e[o(r,e.length,c)],linked:(t,n)=>{const r=u(t)(m);return p(n)?(o=n,e.modifiers?e.modifiers[o]:T)(r):r;var o},message:u,type:g(e.processor)&&p(e.processor.type)?e.processor.type:"text",interpolate:i,normalize:l};return m}function I(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function E(e){throw e}function j(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const A=String.fromCharCode(8232),W=String.fromCharCode(8233);function M(e){const t=e;let n=0,r=1,o=1,c=0;const s=e=>"\r"===t[e]&&"\n"===t[e+1],a=e=>t[e]===W,u=e=>t[e]===A,l=e=>s(e)||(e=>"\n"===t[e])(e)||a(e)||u(e),i=e=>s(e)||a(e)||u(e)?"\n":t[e];function f(){return c=0,l(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>c,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+c),next:f,peek:function(){return s(n+c)&&c++,c++,t[n+c]},reset:function(){n=0,r=1,o=1,c=0},resetPeek:function(e=0){c=e},skipToPeek:function(){const e=n+c;for(;e!==n;)f();c=0}}}const R=void 0;function J(e,t={}){const n=!1!==t.location,r=M(e),o=()=>r.index(),c=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=c(),a=o(),u={currentType:14,offset:a,startLoc:s,endLoc:s,lastType:14,lastOffset:a,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=c(),e.currentType=t;const o={type:t};return n&&(o.loc=j(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(c(),"")}function d(e){let t="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===R)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===R)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const c=e.currentPeek();return"{"===c?"%"!==r&&t:"@"!==c&&c?"%"===c?(e.peek(),n(t,"%",!0)):"|"===c?!("%"!==r&&!o)||!(" "===r||"\n"===r):" "===c?(e.peek(),n(!0," ",o)):"\n"!==c||(e.peek(),n(!0,"\n",o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function x(e,t){const n=e.currentChar();return n===R?R:t(n)?(e.next(),n):null}function w(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function C(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function _(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function v(e){let t="",n="";for(;t=C(e);)n+=t;return n}function L(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return T(e,t,4);case"U":return T(e,t,6);default:return c(),""}}function T(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=_(e);if(!t){c(),e.currentChar();break}r+=t}return`\\${t}${r}`}function P(e){h(e);const t=m(e,"|");return h(e),t}function O(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&c(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&c(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&c(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(b(e))return t.braceNest>0&&c(),n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return c(),t.braceNest=0,N(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=w(e);)n+=t;return e.currentChar()===R&&c(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${v(e)}`):t+=v(e),e.currentChar()===R&&c(),t}(e)),h(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&"\n"!==e;for(;t=x(e,r);)n+="\\"===t?L(e):t;const o=e.currentChar();return"\n"===o||o===R?(c(),"\n"===o&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;t=x(e,r);)n+=t;return n}(e)),c(),h(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||"\n"!==o&&" "!==o||c(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=w(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||" "===t||!t)&&("\n"===t?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?O(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?" "===o?r:"\n"===o?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&c(),t.braceNest=0,t.inLinked=!1,N(e,t))}}function N(e,t){let n={type:14};if(t.braceNest>0)return O(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return O(e,t)||p(t);case"}":return c(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(b(e))return n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:" "===r||"\n"===r?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=s,u.offset=o(),u.startLoc=c(),r.currentChar()===R?f(u,14):N(r,u)},currentOffset:o,currentPosition:c,context:l}}const z=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function D(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 H(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 c(e,t){const n=e.context(),c=r(3,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}function a(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(5,c,s);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(4,c,s);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(9,c,s);return a.value=t.replace(z,D),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let c=e.nextToken();if(9===c.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(8,c,s);return 12!==t.type?(a.value="",o(a,c,s),{nextConsumeToken:t,node:a}):(null==t.value&&U(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,c=t.nextConsumeToken||e.nextToken()}switch(10!==c.type&&U(c),c=e.nextToken(),2===c.type&&(c=e.nextToken()),c.type){case 11:null==c.value&&U(c),n.key=function(e,t){const n=e.context(),c=r(7,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}(e,c.value||"");break;case 5:null==c.value&&U(c),n.key=u(e,c.value||"");break;case 6:null==c.value&&U(c),n.key=a(e,c.value||"");break;case 7:null==c.value&&U(c),n.key=l(e,c.value||"");break;default:const t=e.context(),s=r(7,t.offset,t.startLoc);return s.value="",o(s,t.offset,t.startLoc),n.key=s,o(n,t.offset,t.startLoc),{nextConsumeToken:c,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 s=null;do{const t=s||e.nextToken();switch(s=null,t.type){case 0:null==t.value&&U(t),n.items.push(c(e,t.value||""));break;case 6:null==t.value&&U(t),n.items.push(a(e,t.value||""));break;case 5:null==t.value&&U(t),n.items.push(u(e,t.value||""));break;case 7:null==t.value&&U(t),n.items.push(l(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),s=r.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 p(e){const t=e.context(),{offset:n,startLoc:c}=t,s=f(e);return 14===t.currentType?s:function(e,t,n,c){const s=e.context();let a=0===c.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(c);do{const t=f(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==s.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,c,s)}return{parse:function(n){const c=J(n,s({},e)),a=c.context(),u=r(0,a.offset,a.startLoc);return t&&u.loc&&(u.loc.source=n),u.body=p(c),o(u,c.currentOffset(),c.currentPosition()),u}}}function U(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 K(e,t){for(let n=0;n<e.length;n++)q(e[n],t)}function q(e,t){switch(e.type){case 1:K(e.cases,t),t.helper("plural");break;case 2:K(e.items,t);break;case 6:q(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function Z(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&&q(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function B(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?B(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&&(B(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 n=0;n<o&&(B(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),B(e,t.key),t.modifier&&(e.push(", "),B(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function G(e,t={}){const n=s({},t),r=H(n).parse(e);return Z(r,n),((e,t={})=>{const n=p(t.mode)?t.mode:"normal",r=p(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],s=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,c={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function s(e,t){c.code+=e}function a(e,t=!0){const n=t?r:"";s(o?n+" ".repeat(e):n)}return{context:()=>c,push:s,indent:function(e=!0){const t=++c.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--c.indentLevel;e&&a(t)},newline:function(){a(c.indentLevel)},helper:e=>`_${e}`,needIndent:()=>c.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});s.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),s.indent(o),c.length>0&&(s.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),s.newline()),s.push("return "),B(s,e),s.deindent(o),s.push("}");const{code:a,map:u}=s.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(r,n)}const Q="i18n:init";let V=null;function X(e){V=e}function Y(){return V}function ee(e,t,n){V&&V.emit(Q,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const te=ne("function:translate");function ne(e){return t=>V&&V.emit(e,t)}const re={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function oe(t,...n){return function(t,...n){return 1===n.length&&d(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(re[t],...n)}const ce="9.1.4",se=-1,ae="";let ue;function le(e){ue=e}let ie=null;const fe=e=>{ie=e},pe=()=>ie;let me=0;function de(e={}){const t=p(e.version)?e.version:"9.1.4",n=p(e.locale)?e.locale:"en-US",o=i(e.fallbackLocale)||g(e.fallbackLocale)||p(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=g(e.messages)?e.messages:{[n]:{}},a=g(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},u=g(e.numberFormats)?e.numberFormats:{[n]:{}},l=Object.assign({},e.modifiers||{},{upper:e=>p(e)?e.toUpperCase():e,lower:e=>p(e)?e.toLowerCase():e,capitalize:e=>p(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),h=e.pluralRules||{},k=f(e.missing)?e.missing:null,b=!m(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,y=!m(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,x=!!e.fallbackFormat,w=!!e.unresolving,C=f(e.postTranslation)?e.postTranslation:null,_=g(e.processor)?e.processor:null,v=!m(e.warnHtmlMessage)||e.warnHtmlMessage,L=!!e.escapeParameter,T=f(e.messageCompiler)?e.messageCompiler:ue,P=f(e.onWarn)?e.onWarn:c,O=e,F=d(O.__datetimeFormatters)?O.__datetimeFormatters:new Map,N=d(O.__numberFormatters)?O.__numberFormatters:new Map,$=d(O.__meta)?O.__meta:{};me++;return{version:t,cid:me,locale:n,fallbackLocale:o,messages:s,datetimeFormats:a,numberFormats:u,modifiers:l,pluralRules:h,missing:k,missingWarn:b,fallbackWarn:y,fallbackFormat:x,unresolving:w,postTranslation:C,processor:_,warnHtmlMessage:v,escapeParameter:L,messageCompiler:T,onWarn:P,__datetimeFormatters:F,__numberFormatters:N,__meta:$}}function he(e,t){return e instanceof RegExp?e.test(t):e}function ke(e,t){return e instanceof RegExp?e.test(t):e}function ge(e,t,n,r,o){const{missing:c}=e;if(null!==c){const r=c(e,n,t,o);return p(r)?r:t}return t}function be(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;i(e);)e=ye(o,e,t);const c=i(t)?t:g(t)?t.default?t.default:null:t;e=p(c)?[c]:c,i(e)&&ye(o,e,!1),r.__localeChainCache.set(n,o)}return o}function ye(e,t,n){let r=!0;for(let o=0;o<t.length&&m(r);o++){p(t[o])&&(r=xe(e,t[o],n))}return r}function xe(e,t,n){let r;const o=t.split("-");do{r=we(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function we(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),(i(n)||g(n))&&n[o]&&(r=n[o])}return r}function Ce(e,t,n){e.__localeChainCache=new Map,be(e,n,t)}const _e=e=>e;let ve=Object.create(null);function Le(){ve=Object.create(null)}function Te(e,t={}){{const n=(t.onCacheKey||_e)(e),r=ve[n];if(r)return r;let o=!1;const c=t.onError||E;t.onError=e=>{o=!0,c(e)};const{code:s}=G(e,t),a=new Function(`return ${s}`)();return o?a:ve[n]=a}}function Pe(e){return I(e,null,void 0)}const Oe=()=>"",Fe=e=>f(e);function Ne(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:c,fallbackLocale:s,messages:u}=e,[l,h]=Se(...t),k=(m(h.missingWarn),m(h.fallbackWarn),m(h.escapeParameter)?h.escapeParameter:e.escapeParameter),g=!!h.resolvedMessage,b=p(h.default)||m(h.default)?m(h.default)?l:h.default:r?l:"",y=r||""!==b,x=p(h.locale)?h.locale:e.locale;k&&function(e){i(e.list)?e.list=e.list.map((e=>p(e)?a(e):e)):d(e.named)&&Object.keys(e.named).forEach((t=>{p(e.named[t])&&(e.named[t]=a(e.named[t]))}))}(h);let[w,C,_]=g?[l,x,u[x]||{}]:function(e,t,n,r,o,c){const{messages:s}=e,a=be(e,r,n);let u,l={},i=null;const m="translate";for(let n=0;n<a.length&&(u=a[n],l=s[u]||{},null===(i=v(l,t))&&(i=l[t]),!p(i)&&!f(i));n++){const n=ge(e,t,u,0,m);n!==t&&(i=n)}return[i,u,l]}(e,l,x,s),L=l;if(g||p(w)||Fe(w)||y&&(w=b,L=w),!(g||(p(w)||Fe(w))&&p(C)))return c?-1:l;let T=!1;const P=Fe(w)?w:$e(e,l,C,w,L,(()=>{T=!0}));if(T)return w;const O=function(e,t,n){return t(n)}(0,P,S(function(e,t,r,o){const{modifiers:c,pluralRules:s}=e,a={locale:t,modifiers:c,pluralRules:s,messages:n=>{const o=v(r,n);if(p(o)){let r=!1;const c=$e(e,n,t,o,n,(()=>{r=!0}));return r?Oe:c}return Fe(o)?o:Oe}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);n(o.plural)&&(a.pluralIndex=o.plural);return a}(e,C,_,h)));return o?o(O):O}function $e(e,n,r,o,c,s){const{messageCompiler:a,warnHtmlMessage:u}=e;if(Fe(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const l=a(o,function(e,n,r,o,c,s){return{warnHtmlMessage:c,onError:e=>{throw s&&s(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,c,0,u,s));return l.locale=r,l.key=n,l.source=o,l}function Se(...e){const[t,r,c]=e,s={};if(!p(t)&&!n(t)&&!Fe(t))throw Error(14);const a=n(t)?String(t):(Fe(t),t);return n(r)?s.plural=r:p(r)?s.default=r:g(r)&&!o(r)?s.named=r:i(r)&&(s.list=r),n(c)?s.plural=c:p(c)?s.default=c:g(c)&&Object.assign(s,c),[a,s]}function Ie(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:c}=e,{__datetimeFormatters:s}=e,[a,u,l,i]=Ee(...t);m(l.missingWarn);m(l.fallbackWarn);const f=!!l.part,d=p(l.locale)?l.locale:e.locale,h=be(e,c,d);if(!p(a)||""===a)return new Intl.DateTimeFormat(d).format(u);let k,b={},y=null;for(let t=0;t<h.length&&(k=h[t],b=n[k]||{},y=b[a],!g(y));t++)ge(e,a,k,0,"datetime format");if(!g(y)||!p(k))return r?-1:a;let x=`${k}__${a}`;o(i)||(x=`${x}__${JSON.stringify(i)}`);let w=s.get(x);return w||(w=new Intl.DateTimeFormat(k,Object.assign({},y,i)),s.set(x,w)),f?w.formatToParts(u):w.format(u)}function Ee(...e){const[t,r,o,c]=e;let s,a={},u={};if(p(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);s=new Date(t);try{s.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===k(t)){if(isNaN(t.getTime()))throw Error(15);s=t}else{if(!n(t))throw Error(14);s=t}return p(r)?a.key=r:g(r)&&(a=r),p(o)?a.locale=o:g(o)&&(u=o),g(c)&&(u=c),[a.key||"",s,a,u]}function je(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function Ae(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:c}=e,{__numberFormatters:s}=e,[a,u,l,i]=We(...t);m(l.missingWarn);m(l.fallbackWarn);const f=!!l.part,d=p(l.locale)?l.locale:e.locale,h=be(e,c,d);if(!p(a)||""===a)return new Intl.NumberFormat(d).format(u);let k,b={},y=null;for(let t=0;t<h.length&&(k=h[t],b=n[k]||{},y=b[a],!g(y));t++)ge(e,a,k,0,"number format");if(!g(y)||!p(k))return r?-1:a;let x=`${k}__${a}`;o(i)||(x=`${x}__${JSON.stringify(i)}`);let w=s.get(x);return w||(w=new Intl.NumberFormat(k,Object.assign({},y,i)),s.set(x,w)),f?w.formatToParts(u):w.format(u)}function We(...e){const[t,r,o,c]=e;let s={},a={};if(!n(t))throw Error(14);const u=t;return p(r)?s.key=r:g(r)&&(s=r),p(o)?s.locale=o:g(o)&&(a=o),g(c)&&(a=c),[s.key||"",u,s,a]}function Me(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}le(Te);export{O as DEFAULT_MESSAGE_DATA_TYPE,ae as MISSING_RESOLVE_VALUE,se as NOT_REOSLVED,ce as VERSION,Le as clearCompileCache,je as clearDateTimeFormat,Me as clearNumberFormat,Te as compileToFunction,I as createCompileError,de as createCoreContext,Pe as createCoreError,S as createMessageContext,Ie as datetime,pe as getAdditionalMeta,Y as getDevToolsHook,be as getLocaleChain,oe as getWarnMessage,L as handleFlatJson,ge as handleMissing,ee as initI18nDevTools,Fe as isMessageFunction,he as isTranslateFallbackWarn,ke as isTranslateMissingWarn,Ae as number,C as parse,Ee as parseDateTimeArgs,We as parseNumberArgs,Se as parseTranslateArgs,le as registerMessageCompiler,v as resolveValue,fe as setAdditionalMeta,X as setDevToolsHook,Ne as translate,te as translateDevTools,Ce as updateFallbackLocale}; | ||
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===k(e),o=e=>g(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const s=Object.assign;function a(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const u=Object.prototype.hasOwnProperty;function l(e,t){return u.call(e,t)}const i=Array.isArray,f=e=>"function"==typeof e,p=e=>"string"==typeof e,m=e=>"boolean"==typeof e,d=e=>null!==e&&"object"==typeof e,h=Object.prototype.toString,k=e=>h.call(e),g=e=>"[object Object]"===k(e),b=[];b[0]={w:[0],i:[3,0],"[":[4],o:[7]},b[1]={w:[1],".":[2],"[":[4],o:[7]},b[2]={w:[2],i:[3,0],0:[3,0]},b[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},b[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},b[5]={"'":[4,0],o:8,l:[5,0]},b[6]={'"':[4,0],o:8,l:[6,0]};const y=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function x(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function w(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(y.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function C(e){const t=[];let n,r,o,c,s,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=w(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(c=x(n),u=b[i],s=u[c]||u.l||8,8===s)return;if(i=s[0],void 0!==s[1]&&(a=p[s[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const _=new Map;function v(e,t){if(!d(e))return null;let n=_.get(t);if(n||(n=C(t),n&&_.set(t,n)),!n)return null;const r=n.length;let o=e,c=0;for(;c<r;){const e=o[n[c]];if(void 0===e)return null;o=e,c++}return o}function L(e){if(!d(e))return e;for(const t in e)if(l(e,t))if(t.includes(".")){const n=t.split("."),r=n.length-1;let o=e;for(let e=0;e<r;e++)n[e]in o||(o[n[e]]={}),o=o[n[e]];o[n[r]]=e[t],delete e[t],d(o[n[r]])&&L(o[n[r]])}else d(e[t])&&L(e[t]);return e}const T=e=>e,P=e=>"",O="text",F=e=>0===e.length?"":e.join(""),N=e=>null==e?"":i(e)||g(e)&&e.toString===h?JSON.stringify(e,null,2):String(e);function $(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function S(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?e.pluralRules[t]:$,c=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?$:void 0,s=e.list||[],a=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,a);function u(t){const n=f(e.messages)?e.messages(t):!!d(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):P)}const l=g(e.processor)&&f(e.processor.normalize)?e.processor.normalize:F,i=g(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:N,m={list:e=>s[e],named:e=>a[e],plural:e=>e[o(r,e.length,c)],linked:(t,n)=>{const r=u(t)(m);return p(n)?(o=n,e.modifiers?e.modifiers[o]:T)(r):r;var o},message:u,type:g(e.processor)&&p(e.processor.type)?e.processor.type:"text",interpolate:i,normalize:l};return m}function I(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function E(e){throw e}function A(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const W=String.fromCharCode(8232),j=String.fromCharCode(8233);function M(e){const t=e;let n=0,r=1,o=1,c=0;const s=e=>"\r"===t[e]&&"\n"===t[e+1],a=e=>t[e]===j,u=e=>t[e]===W,l=e=>s(e)||(e=>"\n"===t[e])(e)||a(e)||u(e),i=e=>s(e)||a(e)||u(e)?"\n":t[e];function f(){return c=0,l(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>c,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+c),next:f,peek:function(){return s(n+c)&&c++,c++,t[n+c]},reset:function(){n=0,r=1,o=1,c=0},resetPeek:function(e=0){c=e},skipToPeek:function(){const e=n+c;for(;e!==n;)f();c=0}}}const R=void 0;function J(e,t={}){const n=!1!==t.location,r=M(e),o=()=>r.index(),c=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=c(),a=o(),u={currentType:14,offset:a,startLoc:s,endLoc:s,lastType:14,lastOffset:a,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=c(),e.currentType=t;const o={type:t};return n&&(o.loc=A(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(c(),"")}function d(e){let t="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===R)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===R)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const c=e.currentPeek();return"{"===c?"%"!==r&&t:"@"!==c&&c?"%"===c?(e.peek(),n(t,"%",!0)):"|"===c?!("%"!==r&&!o)||!(" "===r||"\n"===r):" "===c?(e.peek(),n(!0," ",o)):"\n"!==c||(e.peek(),n(!0,"\n",o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function x(e,t){const n=e.currentChar();return n===R?R:t(n)?(e.next(),n):null}function w(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function C(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function _(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function v(e){let t="",n="";for(;t=C(e);)n+=t;return n}function L(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return T(e,t,4);case"U":return T(e,t,6);default:return c(),""}}function T(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=_(e);if(!t){c(),e.currentChar();break}r+=t}return`\\${t}${r}`}function P(e){h(e);const t=m(e,"|");return h(e),t}function O(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&c(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&c(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&c(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(b(e))return t.braceNest>0&&c(),n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return c(),t.braceNest=0,N(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=w(e);)n+=t;return e.currentChar()===R&&c(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${v(e)}`):t+=v(e),e.currentChar()===R&&c(),t}(e)),h(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&"\n"!==e;for(;t=x(e,r);)n+="\\"===t?L(e):t;const o=e.currentChar();return"\n"===o||o===R?(c(),"\n"===o&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;t=x(e,r);)n+=t;return n}(e)),c(),h(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||"\n"!==o&&" "!==o||c(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=w(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||" "===t||!t)&&("\n"===t?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?O(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?" "===o?r:"\n"===o?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&c(),t.braceNest=0,t.inLinked=!1,N(e,t))}}function N(e,t){let n={type:14};if(t.braceNest>0)return O(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return O(e,t)||p(t);case"}":return c(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(b(e))return n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:" "===r||"\n"===r?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=s,u.offset=o(),u.startLoc=c(),r.currentChar()===R?f(u,14):N(r,u)},currentOffset:o,currentPosition:c,context:l}}const z=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function D(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 H(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 c(e,t){const n=e.context(),c=r(3,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}function a(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(5,c,s);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(4,c,s);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(9,c,s);return a.value=t.replace(z,D),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let c=e.nextToken();if(9===c.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(8,c,s);return 12!==t.type?(a.value="",o(a,c,s),{nextConsumeToken:t,node:a}):(null==t.value&&U(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,c=t.nextConsumeToken||e.nextToken()}switch(10!==c.type&&U(c),c=e.nextToken(),2===c.type&&(c=e.nextToken()),c.type){case 11:null==c.value&&U(c),n.key=function(e,t){const n=e.context(),c=r(7,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}(e,c.value||"");break;case 5:null==c.value&&U(c),n.key=u(e,c.value||"");break;case 6:null==c.value&&U(c),n.key=a(e,c.value||"");break;case 7:null==c.value&&U(c),n.key=l(e,c.value||"");break;default:const t=e.context(),s=r(7,t.offset,t.startLoc);return s.value="",o(s,t.offset,t.startLoc),n.key=s,o(n,t.offset,t.startLoc),{nextConsumeToken:c,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 s=null;do{const t=s||e.nextToken();switch(s=null,t.type){case 0:null==t.value&&U(t),n.items.push(c(e,t.value||""));break;case 6:null==t.value&&U(t),n.items.push(a(e,t.value||""));break;case 5:null==t.value&&U(t),n.items.push(u(e,t.value||""));break;case 7:null==t.value&&U(t),n.items.push(l(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),s=r.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 p(e){const t=e.context(),{offset:n,startLoc:c}=t,s=f(e);return 14===t.currentType?s:function(e,t,n,c){const s=e.context();let a=0===c.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(c);do{const t=f(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==s.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,c,s)}return{parse:function(n){const c=J(n,s({},e)),a=c.context(),u=r(0,a.offset,a.startLoc);return t&&u.loc&&(u.loc.source=n),u.body=p(c),o(u,c.currentOffset(),c.currentPosition()),u}}}function U(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 K(e,t){for(let n=0;n<e.length;n++)q(e[n],t)}function q(e,t){switch(e.type){case 1:K(e.cases,t),t.helper("plural");break;case 2:K(e.items,t);break;case 6:q(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function Z(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&&q(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function B(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?B(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&&(B(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 n=0;n<o&&(B(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),B(e,t.key),t.modifier&&(e.push(", "),B(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function G(e,t={}){const n=s({},t),r=H(n).parse(e);return Z(r,n),((e,t={})=>{const n=p(t.mode)?t.mode:"normal",r=p(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],s=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,c={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function s(e,t){c.code+=e}function a(e,t=!0){const n=t?r:"";s(o?n+" ".repeat(e):n)}return{context:()=>c,push:s,indent:function(e=!0){const t=++c.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--c.indentLevel;e&&a(t)},newline:function(){a(c.indentLevel)},helper:e=>`_${e}`,needIndent:()=>c.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});s.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),s.indent(o),c.length>0&&(s.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),s.newline()),s.push("return "),B(s,e),s.deindent(o),s.push("}");const{code:a,map:u}=s.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(r,n)}const Q="i18n:init";let V=null;function X(e){V=e}function Y(){return V}function ee(e,t,n){V&&V.emit(Q,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const te=ne("function:translate");function ne(e){return t=>V&&V.emit(e,t)}const re={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function oe(t,...n){return function(t,...n){return 1===n.length&&d(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(re[t],...n)}const ce="9.1.5",se=-1,ae="";let ue;function le(e){ue=e}let ie=null;const fe=e=>{ie=e},pe=()=>ie;let me=0;function de(e={}){const t=p(e.version)?e.version:"9.1.5",n=p(e.locale)?e.locale:"en-US",o=i(e.fallbackLocale)||g(e.fallbackLocale)||p(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,a=g(e.messages)?e.messages:{[n]:{}},u=g(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=g(e.numberFormats)?e.numberFormats:{[n]:{}},h=s({},e.modifiers||{},{upper:e=>p(e)?e.toUpperCase():e,lower:e=>p(e)?e.toLowerCase():e,capitalize:e=>p(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),k=e.pluralRules||{},b=f(e.missing)?e.missing:null,y=!m(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,x=!m(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,w=!!e.fallbackFormat,C=!!e.unresolving,_=f(e.postTranslation)?e.postTranslation:null,v=g(e.processor)?e.processor:null,L=!m(e.warnHtmlMessage)||e.warnHtmlMessage,T=!!e.escapeParameter,P=f(e.messageCompiler)?e.messageCompiler:ue,O=f(e.onWarn)?e.onWarn:c,F=e,N=d(F.__datetimeFormatters)?F.__datetimeFormatters:new Map,$=d(F.__numberFormatters)?F.__numberFormatters:new Map,S=d(F.__meta)?F.__meta:{};me++;return{version:t,cid:me,locale:n,fallbackLocale:o,messages:a,datetimeFormats:u,numberFormats:l,modifiers:h,pluralRules:k,missing:b,missingWarn:y,fallbackWarn:x,fallbackFormat:w,unresolving:C,postTranslation:_,processor:v,warnHtmlMessage:L,escapeParameter:T,messageCompiler:P,onWarn:O,__datetimeFormatters:N,__numberFormatters:$,__meta:S}}function he(e,t){return e instanceof RegExp?e.test(t):e}function ke(e,t){return e instanceof RegExp?e.test(t):e}function ge(e,t,n,r,o){const{missing:c}=e;if(null!==c){const r=c(e,n,t,o);return p(r)?r:t}return t}function be(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;i(e);)e=ye(o,e,t);const c=i(t)?t:g(t)?t.default?t.default:null:t;e=p(c)?[c]:c,i(e)&&ye(o,e,!1),r.__localeChainCache.set(n,o)}return o}function ye(e,t,n){let r=!0;for(let o=0;o<t.length&&m(r);o++){p(t[o])&&(r=xe(e,t[o],n))}return r}function xe(e,t,n){let r;const o=t.split("-");do{r=we(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function we(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),(i(n)||g(n))&&n[o]&&(r=n[o])}return r}function Ce(e,t,n){e.__localeChainCache=new Map,be(e,n,t)}const _e=e=>e;let ve=Object.create(null);function Le(){ve=Object.create(null)}function Te(e,t={}){{const n=(t.onCacheKey||_e)(e),r=ve[n];if(r)return r;let o=!1;const c=t.onError||E;t.onError=e=>{o=!0,c(e)};const{code:s}=G(e,t),a=new Function(`return ${s}`)();return o?a:ve[n]=a}}function Pe(e){return I(e,null,void 0)}const Oe=()=>"",Fe=e=>f(e);function Ne(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:c,fallbackLocale:s,messages:u}=e,[l,h]=Se(...t),k=(m(h.missingWarn),m(h.fallbackWarn),m(h.escapeParameter)?h.escapeParameter:e.escapeParameter),g=!!h.resolvedMessage,b=p(h.default)||m(h.default)?m(h.default)?l:h.default:r?l:"",y=r||""!==b,x=p(h.locale)?h.locale:e.locale;k&&function(e){i(e.list)?e.list=e.list.map((e=>p(e)?a(e):e)):d(e.named)&&Object.keys(e.named).forEach((t=>{p(e.named[t])&&(e.named[t]=a(e.named[t]))}))}(h);let[w,C,_]=g?[l,x,u[x]||{}]:function(e,t,n,r,o,c){const{messages:s}=e,a=be(e,r,n);let u,l={},i=null;const m="translate";for(let n=0;n<a.length&&(u=a[n],l=s[u]||{},null===(i=v(l,t))&&(i=l[t]),!p(i)&&!f(i));n++){const n=ge(e,t,u,0,m);n!==t&&(i=n)}return[i,u,l]}(e,l,x,s),L=l;if(g||p(w)||Fe(w)||y&&(w=b,L=w),!(g||(p(w)||Fe(w))&&p(C)))return c?-1:l;let T=!1;const P=Fe(w)?w:$e(e,l,C,w,L,(()=>{T=!0}));if(T)return w;const O=function(e,t,n){return t(n)}(0,P,S(function(e,t,r,o){const{modifiers:c,pluralRules:s}=e,a={locale:t,modifiers:c,pluralRules:s,messages:n=>{const o=v(r,n);if(p(o)){let r=!1;const c=$e(e,n,t,o,n,(()=>{r=!0}));return r?Oe:c}return Fe(o)?o:Oe}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);n(o.plural)&&(a.pluralIndex=o.plural);return a}(e,C,_,h)));return o?o(O):O}function $e(e,n,r,o,c,s){const{messageCompiler:a,warnHtmlMessage:u}=e;if(Fe(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const l=a(o,function(e,n,r,o,c,s){return{warnHtmlMessage:c,onError:e=>{throw s&&s(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,c,0,u,s));return l.locale=r,l.key=n,l.source=o,l}function Se(...e){const[t,r,c]=e,a={};if(!p(t)&&!n(t)&&!Fe(t))throw Error(14);const u=n(t)?String(t):(Fe(t),t);return n(r)?a.plural=r:p(r)?a.default=r:g(r)&&!o(r)?a.named=r:i(r)&&(a.list=r),n(c)?a.plural=c:p(c)?a.default=c:g(c)&&s(a,c),[u,a]}function Ie(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:c}=e,{__datetimeFormatters:a}=e,[u,l,i,f]=Ee(...t);m(i.missingWarn);m(i.fallbackWarn);const d=!!i.part,h=p(i.locale)?i.locale:e.locale,k=be(e,c,h);if(!p(u)||""===u)return new Intl.DateTimeFormat(h).format(l);let b,y={},x=null;for(let t=0;t<k.length&&(b=k[t],y=n[b]||{},x=y[u],!g(x));t++)ge(e,u,b,0,"datetime format");if(!g(x)||!p(b))return r?-1:u;let w=`${b}__${u}`;o(f)||(w=`${w}__${JSON.stringify(f)}`);let C=a.get(w);return C||(C=new Intl.DateTimeFormat(b,s({},x,f)),a.set(w,C)),d?C.formatToParts(l):C.format(l)}function Ee(...e){const[t,r,o,c]=e;let s,a={},u={};if(p(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);s=new Date(t);try{s.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===k(t)){if(isNaN(t.getTime()))throw Error(15);s=t}else{if(!n(t))throw Error(14);s=t}return p(r)?a.key=r:g(r)&&(a=r),p(o)?a.locale=o:g(o)&&(u=o),g(c)&&(u=c),[a.key||"",s,a,u]}function Ae(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function We(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:c}=e,{__numberFormatters:a}=e,[u,l,i,f]=je(...t);m(i.missingWarn);m(i.fallbackWarn);const d=!!i.part,h=p(i.locale)?i.locale:e.locale,k=be(e,c,h);if(!p(u)||""===u)return new Intl.NumberFormat(h).format(l);let b,y={},x=null;for(let t=0;t<k.length&&(b=k[t],y=n[b]||{},x=y[u],!g(x));t++)ge(e,u,b,0,"number format");if(!g(x)||!p(b))return r?-1:u;let w=`${b}__${u}`;o(f)||(w=`${w}__${JSON.stringify(f)}`);let C=a.get(w);return C||(C=new Intl.NumberFormat(b,s({},x,f)),a.set(w,C)),d?C.formatToParts(l):C.format(l)}function je(...e){const[t,r,o,c]=e;let s={},a={};if(!n(t))throw Error(14);const u=t;return p(r)?s.key=r:g(r)&&(s=r),p(o)?s.locale=o:g(o)&&(a=o),g(c)&&(a=c),[s.key||"",u,s,a]}function Me(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}le(Te);export{O as DEFAULT_MESSAGE_DATA_TYPE,ae as MISSING_RESOLVE_VALUE,se as NOT_REOSLVED,ce as VERSION,Le as clearCompileCache,Ae as clearDateTimeFormat,Me as clearNumberFormat,Te as compileToFunction,I as createCompileError,de as createCoreContext,Pe as createCoreError,S as createMessageContext,Ie as datetime,pe as getAdditionalMeta,Y as getDevToolsHook,be as getLocaleChain,oe as getWarnMessage,L as handleFlatJson,ge as handleMissing,ee as initI18nDevTools,Fe as isMessageFunction,he as isTranslateFallbackWarn,ke as isTranslateMissingWarn,We as number,C as parse,Ee as parseDateTimeArgs,je as parseNumberArgs,Se as parseTranslateArgs,le as registerMessageCompiler,v as resolveValue,fe as setAdditionalMeta,X as setDevToolsHook,Ne as translate,te as translateDevTools,Ce as updateFallbackLocale}; |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),o=e=>"[object RegExp]"===g(e),s=e=>b(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const a=Object.assign;function u(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const l=Object.prototype.hasOwnProperty;function i(e,t){return l.call(e,t)}const f=Array.isArray,p=e=>"function"==typeof e,m=e=>"string"==typeof e,d=e=>"boolean"==typeof e,h=e=>null!==e&&"object"==typeof e,k=Object.prototype.toString,g=e=>k.call(e),b=e=>"[object Object]"===g(e),y=[];y[0]={w:[0],i:[3,0],"[":[4],o:[7]},y[1]={w:[1],".":[2],"[":[4],o:[7]},y[2]={w:[2],i:[3,0],0:[3,0]},y[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},y[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},y[5]={"'":[4,0],o:8,l:[5,0]},y[6]={'"':[4,0],o:8,l:[6,0]};const x=/^\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 T(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(x.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function _(e){const t=[];let n,r,o,s,c,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=T(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(s=C(n),u=y[i],c=u[s]||u.l||8,8===c)return;if(i=c[0],void 0!==c[1]&&(a=p[c[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const v=new Map;function L(e,t){if(!h(e))return null;let n=v.get(t);if(n||(n=_(t),n&&v.set(t,n)),!n)return null;const r=n.length;let o=e,s=0;for(;s<r;){const e=o[n[s]];if(void 0===e)return null;o=e,s++}return o}const w=e=>e,O=e=>"",P="text",F=e=>0===e.length?"":e.join(""),N=e=>null==e?"":f(e)||b(e)&&e.toString===k?JSON.stringify(e,null,2):String(e);function S(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function $(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),o=h(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?e.pluralRules[t]:S,s=h(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?S:void 0,c=e.list||[],a=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,a);function u(t){const n=p(e.messages)?e.messages(t):!!h(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):O)}const l=b(e.processor)&&p(e.processor.normalize)?e.processor.normalize:F,i=b(e.processor)&&p(e.processor.interpolate)?e.processor.interpolate:N,f={list:e=>c[e],named:e=>a[e],plural:e=>e[o(n,e.length,s)],linked:(t,n)=>{const r=u(t)(f);return m(n)?(o=n,e.modifiers?e.modifiers[o]:w)(r):r;var o},message:u,type:b(e.processor)&&m(e.processor.type)?e.processor.type:P,interpolate:i,normalize:l};return f}function E(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function I(e){throw e}function A(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const M=" ",j="\n",W=String.fromCharCode(8232),D=String.fromCharCode(8233);function R(e){const t=e;let n=0,r=1,o=1,s=0;const c=e=>"\r"===t[e]&&t[e+1]===j,a=e=>t[e]===D,u=e=>t[e]===W,l=e=>c(e)||(e=>t[e]===j)(e)||a(e)||u(e),i=e=>c(e)||a(e)||u(e)?j:t[e];function f(){return s=0,l(n)&&(r++,o=0),c(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>s,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+s),next:f,peek:function(){return c(n+s)&&s++,s++,t[n+s]},reset:function(){n=0,r=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=n+s;for(;e!==n;)f();s=0}}}const J=void 0;function z(e,t={}){const n=!1!==t.location,r=R(e),o=()=>r.index(),s=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},c=s(),a=o(),u={currentType:14,offset:a,startLoc:c,endLoc:c,lastType:14,lastOffset:a,lastStartLoc:c,lastEndLoc:c,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=s(),e.currentType=t;const o={type:t};return n&&(o.loc=A(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(s(),"")}function d(e){let t="";for(;e.currentPeek()===M||e.currentPeek()===j;)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===J)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===J)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==r&&t:"@"!==s&&s?"%"===s?(e.peek(),n(t,"%",!0)):"|"===s?!("%"!==r&&!o)||!(r===M||r===j):s===M?(e.peek(),n(!0,M,o)):s!==j||(e.peek(),n(!0,j,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function x(e,t){const n=e.currentChar();return n===J?J:t(n)?(e.next(),n):null}function C(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function T(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function _(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function v(e){let t="",n="";for(;t=T(e);)n+=t;return n}function L(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return w(e,t,4);case"U":return w(e,t,6);default:return s(),""}}function w(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=_(e);if(!t){s(),e.currentChar();break}r+=t}return`\\${t}${r}`}function O(e){h(e);const t=m(e,"|");return h(e),t}function P(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&s(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&s(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&s(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,c=!0;if(b(e))return t.braceNest>0&&s(),n=f(t,1,O(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return s(),t.braceNest=0,N(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=C(e);)n+=t;return e.currentChar()===J&&s(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${v(e)}`):t+=v(e),e.currentChar()===J&&s(),t}(e)),h(e),n;if(c=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&e!==j;for(;t=x(e,r);)n+="\\"===t?L(e):t;const o=e.currentChar();return o===j||o===J?(s(),o===j&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!c)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==M&&e!==j;for(;t=x(e,r);)n+=t;return n}(e)),s(),h(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==j&&o!==M||s(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,O(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=C(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===M||!t)&&(t===j?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?P(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===M?r:o===j?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&s(),t.braceNest=0,t.inLinked=!1,N(e,t))}}function N(e,t){let n={type:14};if(t.braceNest>0)return P(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return P(e,t)||p(t);case"}":return s(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(b(e))return n=f(t,1,O(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:r===M||r===j?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:c}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=c,u.offset=o(),u.startLoc=s(),r.currentChar()===J?f(u,14):N(r,u)},currentOffset:o,currentPosition:s,context:l}}const H=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function U(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 V(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 s(e,t){const n=e.context(),s=r(3,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function c(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(5,s,c);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(4,s,c);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(9,s,c);return a.value=t.replace(H,U),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let s=e.nextToken();if(9===s.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(8,s,c);return 12!==t.type?(a.value="",o(a,s,c),{nextConsumeToken:t,node:a}):(null==t.value&&G(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(10!==s.type&&G(s),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:null==s.value&&G(s),n.key=function(e,t){const n=e.context(),s=r(7,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:null==s.value&&G(s),n.key=u(e,s.value||"");break;case 6:null==s.value&&G(s),n.key=c(e,s.value||"");break;case 7:null==s.value&&G(s),n.key=l(e,s.value||"");break;default:const t=e.context(),a=r(7,t.offset,t.startLoc);return a.value="",o(a,t.offset,t.startLoc),n.key=a,o(n,t.offset,t.startLoc),{nextConsumeToken:s,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 a=null;do{const t=a||e.nextToken();switch(a=null,t.type){case 0:null==t.value&&G(t),n.items.push(s(e,t.value||""));break;case 6:null==t.value&&G(t),n.items.push(c(e,t.value||""));break;case 5:null==t.value&&G(t),n.items.push(u(e,t.value||""));break;case 7:null==t.value&&G(t),n.items.push(l(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),a=r.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 p(e){const t=e.context(),{offset:n,startLoc:s}=t,c=f(e);return 14===t.currentType?c:function(e,t,n,s){const c=e.context();let a=0===s.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(s);do{const t=f(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==c.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,s,c)}return{parse:function(n){const s=z(n,a({},e)),c=s.context(),u=r(0,c.offset,c.startLoc);return t&&u.loc&&(u.loc.source=n),u.body=p(s),o(u,s.currentOffset(),s.currentPosition()),u}}}function G(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 K(e,t){for(let n=0;n<e.length;n++)q(e[n],t)}function q(e,t){switch(e.type){case 1:K(e.cases,t),t.helper("plural");break;case 2:K(e.items,t);break;case 6:q(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function Y(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&&q(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function Z(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?Z(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&&(Z(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 n=0;n<o&&(Z(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),Z(e,t.key),t.modifier&&(e.push(", "),Z(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function B(e,t={}){const n=a({},t),r=V(n).parse(e);return Y(r,n),((e,t={})=>{const n=m(t.mode)?t.mode:"normal",r=m(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,s=e.helpers||[],c=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,s={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function c(e,t){s.code+=e}function a(e,t=!0){const n=t?r:"";c(o?n+" ".repeat(e):n)}return{context:()=>s,push:c,indent:function(e=!0){const t=++s.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&a(t)},newline:function(){a(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});c.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(o),s.length>0&&(c.push(`const { ${s.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),Z(c,e),c.deindent(o),c.push("}");const{code:a,map:u}=c.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(r,n)}const Q="i18n:init";let X=null;const ee=te("function:translate");function te(e){return t=>X&&X.emit(e,t)}const ne={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};const re="9.1.4";let oe;function se(e){oe=e}let ce=null;let ae=0;function ue(e,t,n,r,o){const{missing:s}=e;if(null!==s){const r=s(e,n,t,o);return m(r)?r:t}return t}function le(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;f(e);)e=ie(o,e,t);const s=f(t)?t:b(t)?t.default?t.default:null:t;e=m(s)?[s]:s,f(e)&&ie(o,e,!1),r.__localeChainCache.set(n,o)}return o}function ie(e,t,n){let r=!0;for(let o=0;o<t.length&&d(r);o++){m(t[o])&&(r=fe(e,t[o],n))}return r}function fe(e,t,n){let r;const o=t.split("-");do{r=pe(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function pe(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)||b(n))&&n[o]&&(r=n[o])}return r}const me=e=>e;let de=Object.create(null);function he(e,t={}){{const n=(t.onCacheKey||me)(e),r=de[n];if(r)return r;let o=!1;const s=t.onError||I;t.onError=e=>{o=!0,s(e)};const{code:c}=B(e,t),a=new Function(`return ${c}`)();return o?a:de[n]=a}}const ke=()=>"",ge=e=>p(e);function be(e,t,r,o,s,c){const{messageCompiler:a,warnHtmlMessage:u}=e;if(ge(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}const l=a(o,function(e,t,r,o,s,c){return{warnHtmlMessage:s,onError:e=>{throw c&&c(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,s,0,u,c));return l.locale=r,l.key=t,l.source=o,l}function ye(...e){const[t,n,o]=e,c={};if(!m(t)&&!r(t)&&!ge(t))throw Error(14);const a=r(t)?String(t):(ge(t),t);return r(n)?c.plural=n:m(n)?c.default=n:b(n)&&!s(n)?c.named=n:f(n)&&(c.list=n),r(o)?c.plural=o:m(o)?c.default=o:b(o)&&Object.assign(c,o),[a,c]}function xe(...e){const[t,n,o,s]=e;let c,a={},u={};if(m(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);c=new Date(t);try{c.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===g(t)){if(isNaN(t.getTime()))throw Error(15);c=t}else{if(!r(t))throw Error(14);c=t}return m(n)?a.key=n:b(n)&&(a=n),m(o)?a.locale=o:b(o)&&(u=o),b(s)&&(u=s),[a.key||"",c,a,u]}function Ce(...e){const[t,n,o,s]=e;let c={},a={};if(!r(t))throw Error(14);const u=t;return m(n)?c.key=n:b(n)&&(c=n),m(o)?c.locale=o:b(o)&&(a=o),b(s)&&(a=s),[c.key||"",u,c,a]}return se(he),e.DEFAULT_MESSAGE_DATA_TYPE=P,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.VERSION=re,e.clearCompileCache=function(){de=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=he,e.createCompileError=E,e.createCoreContext=function(e={}){const t=m(e.version)?e.version:re,n=m(e.locale)?e.locale:"en-US",r=f(e.fallbackLocale)||b(e.fallbackLocale)||m(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=b(e.messages)?e.messages:{[n]:{}},a=b(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},u=b(e.numberFormats)?e.numberFormats:{[n]:{}},l=Object.assign({},e.modifiers||{},{upper:e=>m(e)?e.toUpperCase():e,lower:e=>m(e)?e.toLowerCase():e,capitalize:e=>m(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),i=e.pluralRules||{},k=p(e.missing)?e.missing:null,g=!d(e.missingWarn)&&!o(e.missingWarn)||e.missingWarn,y=!d(e.fallbackWarn)&&!o(e.fallbackWarn)||e.fallbackWarn,x=!!e.fallbackFormat,C=!!e.unresolving,T=p(e.postTranslation)?e.postTranslation:null,_=b(e.processor)?e.processor:null,v=!d(e.warnHtmlMessage)||e.warnHtmlMessage,L=!!e.escapeParameter,w=p(e.messageCompiler)?e.messageCompiler:oe,O=p(e.onWarn)?e.onWarn:c,P=e,F=h(P.__datetimeFormatters)?P.__datetimeFormatters:new Map,N=h(P.__numberFormatters)?P.__numberFormatters:new Map,S=h(P.__meta)?P.__meta:{};return ae++,{version:t,cid:ae,locale:n,fallbackLocale:r,messages:s,datetimeFormats:a,numberFormats:u,modifiers:l,pluralRules:i,missing:k,missingWarn:g,fallbackWarn:y,fallbackFormat:x,unresolving:C,postTranslation:T,processor:_,warnHtmlMessage:v,escapeParameter:L,messageCompiler:w,onWarn:O,__datetimeFormatters:F,__numberFormatters:N,__meta:S}},e.createCoreError=function(e){return E(e,null,void 0)},e.createMessageContext=$,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o}=e,{__datetimeFormatters:c}=e,[a,u,l,i]=xe(...t);d(l.missingWarn),d(l.fallbackWarn);const f=!!l.part,p=m(l.locale)?l.locale:e.locale,h=le(e,o,p);if(!m(a)||""===a)return new Intl.DateTimeFormat(p).format(u);let k,g={},y=null;for(let t=0;t<h.length&&(k=h[t],g=n[k]||{},y=g[a],!b(y));t++)ue(e,a,k,0,"datetime format");if(!b(y)||!m(k))return r?-1:a;let x=`${k}__${a}`;s(i)||(x=`${x}__${JSON.stringify(i)}`);let C=c.get(x);return C||(C=new Intl.DateTimeFormat(k,Object.assign({},y,i)),c.set(x,C)),f?C.formatToParts(u):C.format(u)},e.getAdditionalMeta=()=>ce,e.getDevToolsHook=function(){return X},e.getLocaleChain=le,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&h(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(ne[e],...n)},e.handleFlatJson=function e(t){if(!h(t))return t;for(const n in t)if(i(t,n))if(n.includes(".")){const r=n.split("."),o=r.length-1;let s=t;for(let e=0;e<o;e++)r[e]in s||(s[r[e]]={}),s=s[r[e]];s[r[o]]=t[n],delete t[n],h(s[r[o]])&&e(s[r[o]])}else h(t[n])&&e(t[n]);return t},e.handleMissing=ue,e.initI18nDevTools=function(e,t,n){X&&X.emit(Q,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=ge,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o}=e,{__numberFormatters:c}=e,[a,u,l,i]=Ce(...t);d(l.missingWarn),d(l.fallbackWarn);const f=!!l.part,p=m(l.locale)?l.locale:e.locale,h=le(e,o,p);if(!m(a)||""===a)return new Intl.NumberFormat(p).format(u);let k,g={},y=null;for(let t=0;t<h.length&&(k=h[t],g=n[k]||{},y=g[a],!b(y));t++)ue(e,a,k,0,"number format");if(!b(y)||!m(k))return r?-1:a;let x=`${k}__${a}`;s(i)||(x=`${x}__${JSON.stringify(i)}`);let C=c.get(x);return C||(C=new Intl.NumberFormat(k,Object.assign({},y,i)),c.set(x,C)),f?C.formatToParts(u):C.format(u)},e.parse=_,e.parseDateTimeArgs=xe,e.parseNumberArgs=Ce,e.parseTranslateArgs=ye,e.registerMessageCompiler=se,e.resolveValue=L,e.setAdditionalMeta=e=>{ce=e},e.setDevToolsHook=function(e){X=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:o,unresolving:s,fallbackLocale:c,messages:a}=e,[l,i]=ye(...t),k=(d(i.missingWarn),d(i.fallbackWarn),d(i.escapeParameter)?i.escapeParameter:e.escapeParameter),g=!!i.resolvedMessage,b=m(i.default)||d(i.default)?d(i.default)?l:i.default:n?l:"",y=n||""!==b,x=m(i.locale)?i.locale:e.locale;k&&function(e){f(e.list)?e.list=e.list.map((e=>m(e)?u(e):e)):h(e.named)&&Object.keys(e.named).forEach((t=>{m(e.named[t])&&(e.named[t]=u(e.named[t]))}))}(i);let[C,T,_]=g?[l,x,a[x]||{}]:function(e,t,n,r,o,s){const{messages:c}=e,a=le(e,r,n);let u,l={},i=null;const f="translate";for(let n=0;n<a.length&&(u=a[n],l=c[u]||{},null===(i=L(l,t))&&(i=l[t]),!m(i)&&!p(i));n++){const n=ue(e,t,u,0,f);n!==t&&(i=n)}return[i,u,l]}(e,l,x,c),v=l;if(g||m(C)||ge(C)||y&&(C=b,v=C),!(g||(m(C)||ge(C))&&m(T)))return s?-1:l;let w=!1;const O=ge(C)?C:be(e,l,T,C,v,(()=>{w=!0}));if(w)return C;const P=function(e,t,n){return t(n)}(0,O,$(function(e,t,n,o){const{modifiers:s,pluralRules:c}=e,a={locale:t,modifiers:s,pluralRules:c,messages:r=>{const o=L(n,r);if(m(o)){let n=!1;const s=be(e,r,t,o,r,(()=>{n=!0}));return n?ke:s}return ge(o)?o:ke}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);r(o.plural)&&(a.pluralIndex=o.plural);return a}(e,T,_,i)));return o?o(P):P},e.translateDevTools=ee,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,le(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),o=e=>"[object RegExp]"===g(e),s=e=>b(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const a=Object.assign;function u(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const l=Object.prototype.hasOwnProperty;function i(e,t){return l.call(e,t)}const f=Array.isArray,p=e=>"function"==typeof e,m=e=>"string"==typeof e,d=e=>"boolean"==typeof e,h=e=>null!==e&&"object"==typeof e,k=Object.prototype.toString,g=e=>k.call(e),b=e=>"[object Object]"===g(e),y=[];y[0]={w:[0],i:[3,0],"[":[4],o:[7]},y[1]={w:[1],".":[2],"[":[4],o:[7]},y[2]={w:[2],i:[3,0],0:[3,0]},y[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},y[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},y[5]={"'":[4,0],o:8,l:[5,0]},y[6]={'"':[4,0],o:8,l:[6,0]};const x=/^\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 T(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(x.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function _(e){const t=[];let n,r,o,s,c,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=T(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(s=C(n),u=y[i],c=u[s]||u.l||8,8===c)return;if(i=c[0],void 0!==c[1]&&(a=p[c[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const v=new Map;function L(e,t){if(!h(e))return null;let n=v.get(t);if(n||(n=_(t),n&&v.set(t,n)),!n)return null;const r=n.length;let o=e,s=0;for(;s<r;){const e=o[n[s]];if(void 0===e)return null;o=e,s++}return o}const w=e=>e,P=e=>"",O="text",F=e=>0===e.length?"":e.join(""),N=e=>null==e?"":f(e)||b(e)&&e.toString===k?JSON.stringify(e,null,2):String(e);function S(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function $(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),o=h(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?e.pluralRules[t]:S,s=h(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?S:void 0,c=e.list||[],a=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,a);function u(t){const n=p(e.messages)?e.messages(t):!!h(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):P)}const l=b(e.processor)&&p(e.processor.normalize)?e.processor.normalize:F,i=b(e.processor)&&p(e.processor.interpolate)?e.processor.interpolate:N,f={list:e=>c[e],named:e=>a[e],plural:e=>e[o(n,e.length,s)],linked:(t,n)=>{const r=u(t)(f);return m(n)?(o=n,e.modifiers?e.modifiers[o]:w)(r):r;var o},message:u,type:b(e.processor)&&m(e.processor.type)?e.processor.type:O,interpolate:i,normalize:l};return f}function E(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function I(e){throw e}function A(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const M=" ",W="\n",j=String.fromCharCode(8232),D=String.fromCharCode(8233);function R(e){const t=e;let n=0,r=1,o=1,s=0;const c=e=>"\r"===t[e]&&t[e+1]===W,a=e=>t[e]===D,u=e=>t[e]===j,l=e=>c(e)||(e=>t[e]===W)(e)||a(e)||u(e),i=e=>c(e)||a(e)||u(e)?W:t[e];function f(){return s=0,l(n)&&(r++,o=0),c(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>s,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+s),next:f,peek:function(){return c(n+s)&&s++,s++,t[n+s]},reset:function(){n=0,r=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=n+s;for(;e!==n;)f();s=0}}}const J=void 0;function z(e,t={}){const n=!1!==t.location,r=R(e),o=()=>r.index(),s=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},c=s(),a=o(),u={currentType:14,offset:a,startLoc:c,endLoc:c,lastType:14,lastOffset:a,lastStartLoc:c,lastEndLoc:c,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=s(),e.currentType=t;const o={type:t};return n&&(o.loc=A(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(s(),"")}function d(e){let t="";for(;e.currentPeek()===M||e.currentPeek()===W;)t+=e.currentPeek(),e.peek();return t}function h(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===J)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function g(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===J)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function b(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function y(e,t=!0){const n=(t=!1,r="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==r&&t:"@"!==s&&s?"%"===s?(e.peek(),n(t,"%",!0)):"|"===s?!("%"!==r&&!o)||!(r===M||r===W):s===M?(e.peek(),n(!0,M,o)):s!==W||(e.peek(),n(!0,W,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function x(e,t){const n=e.currentChar();return n===J?J:t(n)?(e.next(),n):null}function C(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function T(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function _(e){return x(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function v(e){let t="",n="";for(;t=T(e);)n+=t;return n}function L(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return w(e,t,4);case"U":return w(e,t,6);default:return s(),""}}function w(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=_(e);if(!t){s(),e.currentChar();break}r+=t}return`\\${t}${r}`}function P(e){h(e);const t=m(e,"|");return h(e),t}function O(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&s(),e.next(),n=f(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&s(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&s(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,c=!0;if(b(e))return t.braceNest>0&&s(),n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return s(),t.braceNest=0,N(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){h(e);let t="",n="";for(;t=C(e);)n+=t;return e.currentChar()===J&&s(),n}(e)),h(e),n;if(o=g(e,t))return n=f(t,6,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${v(e)}`):t+=v(e),e.currentChar()===J&&s(),t}(e)),h(e),n;if(c=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){h(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&e!==W;for(;t=x(e,r);)n+="\\"===t?L(e):t;const o=e.currentChar();return o===W||o===J?(s(),o===W&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),h(e),n;if(!r&&!o&&!c)return n=f(t,13,function(e){h(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==M&&e!==W;for(;t=x(e,r);)n+=t;return n}(e)),s(),h(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==W&&o!==M||s(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),f(t,9,".");case":":return h(e),e.next(),f(t,10,":");default:return b(e)?(r=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),f(t,12,function(e){let t="",n="";for(;t=C(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===M||!t)&&(t===W?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(h(e),"{"===o?O(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===M?r:o===W?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&s(),t.braceNest=0,t.inLinked=!1,N(e,t))}}function N(e,t){let n={type:14};if(t.braceNest>0)return O(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return O(e,t)||p(t);case"}":return s(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(b(e))return n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(y(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?y(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:r===M||r===W?y(e)?(n+=r,e.next(),t(n)):b(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:c}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=c,u.offset=o(),u.startLoc=s(),r.currentChar()===J?f(u,14):N(r,u)},currentOffset:o,currentPosition:s,context:l}}const H=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function U(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 V(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 s(e,t){const n=e.context(),s=r(3,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function c(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(5,s,c);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(4,s,c);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(9,s,c);return a.value=t.replace(H,U),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let s=e.nextToken();if(9===s.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(8,s,c);return 12!==t.type?(a.value="",o(a,s,c),{nextConsumeToken:t,node:a}):(null==t.value&&G(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(10!==s.type&&G(s),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:null==s.value&&G(s),n.key=function(e,t){const n=e.context(),s=r(7,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:null==s.value&&G(s),n.key=u(e,s.value||"");break;case 6:null==s.value&&G(s),n.key=c(e,s.value||"");break;case 7:null==s.value&&G(s),n.key=l(e,s.value||"");break;default:const t=e.context(),a=r(7,t.offset,t.startLoc);return a.value="",o(a,t.offset,t.startLoc),n.key=a,o(n,t.offset,t.startLoc),{nextConsumeToken:s,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 a=null;do{const t=a||e.nextToken();switch(a=null,t.type){case 0:null==t.value&&G(t),n.items.push(s(e,t.value||""));break;case 6:null==t.value&&G(t),n.items.push(c(e,t.value||""));break;case 5:null==t.value&&G(t),n.items.push(u(e,t.value||""));break;case 7:null==t.value&&G(t),n.items.push(l(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),a=r.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 p(e){const t=e.context(),{offset:n,startLoc:s}=t,c=f(e);return 14===t.currentType?c:function(e,t,n,s){const c=e.context();let a=0===s.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(s);do{const t=f(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==c.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,s,c)}return{parse:function(n){const s=z(n,a({},e)),c=s.context(),u=r(0,c.offset,c.startLoc);return t&&u.loc&&(u.loc.source=n),u.body=p(s),o(u,s.currentOffset(),s.currentPosition()),u}}}function G(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 K(e,t){for(let n=0;n<e.length;n++)q(e[n],t)}function q(e,t){switch(e.type){case 1:K(e.cases,t),t.helper("plural");break;case 2:K(e.items,t);break;case 6:q(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function Y(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&&q(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function Z(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?Z(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&&(Z(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 n=0;n<o&&(Z(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),Z(e,t.key),t.modifier&&(e.push(", "),Z(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function B(e,t={}){const n=a({},t),r=V(n).parse(e);return Y(r,n),((e,t={})=>{const n=m(t.mode)?t.mode:"normal",r=m(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,s=e.helpers||[],c=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,s={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function c(e,t){s.code+=e}function a(e,t=!0){const n=t?r:"";c(o?n+" ".repeat(e):n)}return{context:()=>s,push:c,indent:function(e=!0){const t=++s.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&a(t)},newline:function(){a(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});c.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(o),s.length>0&&(c.push(`const { ${s.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),Z(c,e),c.deindent(o),c.push("}");const{code:a,map:u}=c.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(r,n)}const Q="i18n:init";let X=null;const ee=te("function:translate");function te(e){return t=>X&&X.emit(e,t)}const ne={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};const re="9.1.5";let oe;function se(e){oe=e}let ce=null;let ae=0;function ue(e,t,n,r,o){const{missing:s}=e;if(null!==s){const r=s(e,n,t,o);return m(r)?r:t}return t}function le(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;f(e);)e=ie(o,e,t);const s=f(t)?t:b(t)?t.default?t.default:null:t;e=m(s)?[s]:s,f(e)&&ie(o,e,!1),r.__localeChainCache.set(n,o)}return o}function ie(e,t,n){let r=!0;for(let o=0;o<t.length&&d(r);o++){m(t[o])&&(r=fe(e,t[o],n))}return r}function fe(e,t,n){let r;const o=t.split("-");do{r=pe(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function pe(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)||b(n))&&n[o]&&(r=n[o])}return r}const me=e=>e;let de=Object.create(null);function he(e,t={}){{const n=(t.onCacheKey||me)(e),r=de[n];if(r)return r;let o=!1;const s=t.onError||I;t.onError=e=>{o=!0,s(e)};const{code:c}=B(e,t),a=new Function(`return ${c}`)();return o?a:de[n]=a}}const ke=()=>"",ge=e=>p(e);function be(e,t,r,o,s,c){const{messageCompiler:a,warnHtmlMessage:u}=e;if(ge(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}const l=a(o,function(e,t,r,o,s,c){return{warnHtmlMessage:s,onError:e=>{throw c&&c(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,s,0,u,c));return l.locale=r,l.key=t,l.source=o,l}function ye(...e){const[t,n,o]=e,c={};if(!m(t)&&!r(t)&&!ge(t))throw Error(14);const u=r(t)?String(t):(ge(t),t);return r(n)?c.plural=n:m(n)?c.default=n:b(n)&&!s(n)?c.named=n:f(n)&&(c.list=n),r(o)?c.plural=o:m(o)?c.default=o:b(o)&&a(c,o),[u,c]}function xe(...e){const[t,n,o,s]=e;let c,a={},u={};if(m(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);c=new Date(t);try{c.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===g(t)){if(isNaN(t.getTime()))throw Error(15);c=t}else{if(!r(t))throw Error(14);c=t}return m(n)?a.key=n:b(n)&&(a=n),m(o)?a.locale=o:b(o)&&(u=o),b(s)&&(u=s),[a.key||"",c,a,u]}function Ce(...e){const[t,n,o,s]=e;let c={},a={};if(!r(t))throw Error(14);const u=t;return m(n)?c.key=n:b(n)&&(c=n),m(o)?c.locale=o:b(o)&&(a=o),b(s)&&(a=s),[c.key||"",u,c,a]}return se(he),e.DEFAULT_MESSAGE_DATA_TYPE=O,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.VERSION=re,e.clearCompileCache=function(){de=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=he,e.createCompileError=E,e.createCoreContext=function(e={}){const t=m(e.version)?e.version:re,n=m(e.locale)?e.locale:"en-US",r=f(e.fallbackLocale)||b(e.fallbackLocale)||m(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=b(e.messages)?e.messages:{[n]:{}},u=b(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=b(e.numberFormats)?e.numberFormats:{[n]:{}},i=a({},e.modifiers||{},{upper:e=>m(e)?e.toUpperCase():e,lower:e=>m(e)?e.toLowerCase():e,capitalize:e=>m(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),k=e.pluralRules||{},g=p(e.missing)?e.missing:null,y=!d(e.missingWarn)&&!o(e.missingWarn)||e.missingWarn,x=!d(e.fallbackWarn)&&!o(e.fallbackWarn)||e.fallbackWarn,C=!!e.fallbackFormat,T=!!e.unresolving,_=p(e.postTranslation)?e.postTranslation:null,v=b(e.processor)?e.processor:null,L=!d(e.warnHtmlMessage)||e.warnHtmlMessage,w=!!e.escapeParameter,P=p(e.messageCompiler)?e.messageCompiler:oe,O=p(e.onWarn)?e.onWarn:c,F=e,N=h(F.__datetimeFormatters)?F.__datetimeFormatters:new Map,S=h(F.__numberFormatters)?F.__numberFormatters:new Map,$=h(F.__meta)?F.__meta:{};return ae++,{version:t,cid:ae,locale:n,fallbackLocale:r,messages:s,datetimeFormats:u,numberFormats:l,modifiers:i,pluralRules:k,missing:g,missingWarn:y,fallbackWarn:x,fallbackFormat:C,unresolving:T,postTranslation:_,processor:v,warnHtmlMessage:L,escapeParameter:w,messageCompiler:P,onWarn:O,__datetimeFormatters:N,__numberFormatters:S,__meta:$}},e.createCoreError=function(e){return E(e,null,void 0)},e.createMessageContext=$,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o}=e,{__datetimeFormatters:c}=e,[u,l,i,f]=xe(...t);d(i.missingWarn),d(i.fallbackWarn);const p=!!i.part,h=m(i.locale)?i.locale:e.locale,k=le(e,o,h);if(!m(u)||""===u)return new Intl.DateTimeFormat(h).format(l);let g,y={},x=null;for(let t=0;t<k.length&&(g=k[t],y=n[g]||{},x=y[u],!b(x));t++)ue(e,u,g,0,"datetime format");if(!b(x)||!m(g))return r?-1:u;let C=`${g}__${u}`;s(f)||(C=`${C}__${JSON.stringify(f)}`);let T=c.get(C);return T||(T=new Intl.DateTimeFormat(g,a({},x,f)),c.set(C,T)),p?T.formatToParts(l):T.format(l)},e.getAdditionalMeta=()=>ce,e.getDevToolsHook=function(){return X},e.getLocaleChain=le,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&h(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(ne[e],...n)},e.handleFlatJson=function e(t){if(!h(t))return t;for(const n in t)if(i(t,n))if(n.includes(".")){const r=n.split("."),o=r.length-1;let s=t;for(let e=0;e<o;e++)r[e]in s||(s[r[e]]={}),s=s[r[e]];s[r[o]]=t[n],delete t[n],h(s[r[o]])&&e(s[r[o]])}else h(t[n])&&e(t[n]);return t},e.handleMissing=ue,e.initI18nDevTools=function(e,t,n){X&&X.emit(Q,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=ge,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o}=e,{__numberFormatters:c}=e,[u,l,i,f]=Ce(...t);d(i.missingWarn),d(i.fallbackWarn);const p=!!i.part,h=m(i.locale)?i.locale:e.locale,k=le(e,o,h);if(!m(u)||""===u)return new Intl.NumberFormat(h).format(l);let g,y={},x=null;for(let t=0;t<k.length&&(g=k[t],y=n[g]||{},x=y[u],!b(x));t++)ue(e,u,g,0,"number format");if(!b(x)||!m(g))return r?-1:u;let C=`${g}__${u}`;s(f)||(C=`${C}__${JSON.stringify(f)}`);let T=c.get(C);return T||(T=new Intl.NumberFormat(g,a({},x,f)),c.set(C,T)),p?T.formatToParts(l):T.format(l)},e.parse=_,e.parseDateTimeArgs=xe,e.parseNumberArgs=Ce,e.parseTranslateArgs=ye,e.registerMessageCompiler=se,e.resolveValue=L,e.setAdditionalMeta=e=>{ce=e},e.setDevToolsHook=function(e){X=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:o,unresolving:s,fallbackLocale:c,messages:a}=e,[l,i]=ye(...t),k=(d(i.missingWarn),d(i.fallbackWarn),d(i.escapeParameter)?i.escapeParameter:e.escapeParameter),g=!!i.resolvedMessage,b=m(i.default)||d(i.default)?d(i.default)?l:i.default:n?l:"",y=n||""!==b,x=m(i.locale)?i.locale:e.locale;k&&function(e){f(e.list)?e.list=e.list.map((e=>m(e)?u(e):e)):h(e.named)&&Object.keys(e.named).forEach((t=>{m(e.named[t])&&(e.named[t]=u(e.named[t]))}))}(i);let[C,T,_]=g?[l,x,a[x]||{}]:function(e,t,n,r,o,s){const{messages:c}=e,a=le(e,r,n);let u,l={},i=null;const f="translate";for(let n=0;n<a.length&&(u=a[n],l=c[u]||{},null===(i=L(l,t))&&(i=l[t]),!m(i)&&!p(i));n++){const n=ue(e,t,u,0,f);n!==t&&(i=n)}return[i,u,l]}(e,l,x,c),v=l;if(g||m(C)||ge(C)||y&&(C=b,v=C),!(g||(m(C)||ge(C))&&m(T)))return s?-1:l;let w=!1;const P=ge(C)?C:be(e,l,T,C,v,(()=>{w=!0}));if(w)return C;const O=function(e,t,n){return t(n)}(0,P,$(function(e,t,n,o){const{modifiers:s,pluralRules:c}=e,a={locale:t,modifiers:s,pluralRules:c,messages:r=>{const o=L(n,r);if(m(o)){let n=!1;const s=be(e,r,t,o,r,(()=>{n=!0}));return n?ke:s}return ge(o)?o:ke}};e.processor&&(a.processor=e.processor);o.list&&(a.list=o.list);o.named&&(a.named=o.named);r(o.plural)&&(a.pluralIndex=o.plural);return a}(e,T,_,i)));return o?o(O):O},e.translateDevTools=ee,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,le(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
@@ -59,2 +59,3 @@ * Released under the MIT License. | ||
} | ||
const assign = Object.assign; | ||
function escapeHtml(rawText) { | ||
@@ -588,3 +589,3 @@ return rawText | ||
*/ | ||
const VERSION = '9.1.4'; | ||
const VERSION = '9.1.5'; | ||
const NOT_REOSLVED = -1; | ||
@@ -633,3 +634,3 @@ const MISSING_RESOLVE_VALUE = ''; | ||
: { [locale]: {} }; | ||
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers()); | ||
const modifiers = assign({}, options.modifiers || {}, getDefaultLinkedModifiers()); | ||
const pluralRules = options.pluralRules || {}; | ||
@@ -935,3 +936,3 @@ const missing = isFunction(options.missing) ? options.missing : null; | ||
}; | ||
payloads.meta = Object.assign({}, context.__meta, getAdditionalMeta() || {}); | ||
payloads.meta = assign({}, context.__meta, getAdditionalMeta() || {}); | ||
translateDevTools(payloads); | ||
@@ -1132,3 +1133,3 @@ } | ||
else if (isPlainObject(arg3)) { | ||
Object.assign(options, arg3); | ||
assign(options, arg3); | ||
} | ||
@@ -1280,3 +1281,3 @@ return [key, options]; | ||
if (!formatter) { | ||
formatter = new Intl.DateTimeFormat(targetLocale, Object.assign({}, format, overrides)); | ||
formatter = new Intl.DateTimeFormat(targetLocale, assign({}, format, overrides)); | ||
__datetimeFormatters.set(id, formatter); | ||
@@ -1416,3 +1417,3 @@ } | ||
if (!formatter) { | ||
formatter = new Intl.NumberFormat(targetLocale, Object.assign({}, format, overrides)); | ||
formatter = new Intl.NumberFormat(targetLocale, assign({}, format, overrides)); | ||
__numberFormatters.set(id, formatter); | ||
@@ -1419,0 +1420,0 @@ } |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===d(e),o=e=>b(e)&&0===Object.keys(e).length;function a(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function l(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const s=Object.prototype.hasOwnProperty;function c(e,t){return s.call(e,t)}const i=Array.isArray,u=e=>"function"==typeof e,f=e=>"string"==typeof e,m=e=>"boolean"==typeof e,p=e=>null!==e&&"object"==typeof e,g=Object.prototype.toString,d=e=>g.call(e),b=e=>"[object Object]"===d(e),h=[];h[0]={w:[0],i:[3,0],"[":[4],o:[7]},h[1]={w:[1],".":[2],"[":[4],o:[7]},h[2]={w:[2],i:[3,0],0:[3,0]},h[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},h[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},h[5]={"'":[4,0],o:8,l:[5,0]},h[6]={'"':[4,0],o:8,l:[6,0]};const _=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function k(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 w(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(_.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function y(e){const t=[];let n,r,o,a,l,s,c,i=-1,u=0,f=0;const m=[];function p(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,o="\\"+t,m[0](),!0}for(m[0]=()=>{void 0===r?r=o:r+=o},m[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},m[2]=()=>{m[0](),f++},m[3]=()=>{if(f>0)f--,u=4,m[0]();else{if(f=0,void 0===r)return!1;if(r=w(r),!1===r)return!1;m[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!p()){if(a=k(n),c=h[u],l=c[a]||c.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=m[l[1]],s&&(o=n,!1===s())))return;if(7===u)return t}}const F=new Map;function C(e,t){if(!p(e))return null;let n=F.get(t);if(n||(n=y(t),n&&F.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}function v(e){if(!p(e))return e;for(const t in e)if(c(e,t))if(t.includes(".")){const n=t.split("."),r=n.length-1;let o=e;for(let e=0;e<r;e++)n[e]in o||(o[n[e]]={}),o=o[n[e]];o[n[r]]=e[t],delete e[t],p(o[n[r]])&&v(o[n[r]])}else p(e[t])&&v(e[t]);return e}const O=e=>e,W=e=>"",j="text",$=e=>0===e.length?"":e.join(""),M=e=>null==e?"":i(e)||b(e)&&e.toString===g?JSON.stringify(e,null,2):String(e);function S(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function E(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=p(e.pluralRules)&&f(t)&&u(e.pluralRules[t])?e.pluralRules[t]:S,a=p(e.pluralRules)&&f(t)&&u(e.pluralRules[t])?S:void 0,l=e.list||[],s=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,s);function c(t){const n=u(e.messages)?e.messages(t):!!p(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):W)}const i=b(e.processor)&&u(e.processor.normalize)?e.processor.normalize:$,m=b(e.processor)&&u(e.processor.interpolate)?e.processor.interpolate:M,g={list:e=>l[e],named:e=>s[e],plural:e=>e[o(r,e.length,a)],linked:(t,n)=>{const r=c(t)(g);return f(n)?(o=n,e.modifiers?e.modifiers[o]:O)(r):r;var o},message:c,type:b(e.processor)&&f(e.processor.type)?e.processor.type:"text",interpolate:m,normalize:i};return g}function I(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}const N="i18n:init";let R=null;function x(e){R=e}function L(){return R}function T(e,t,n){R&&R.emit(N,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const P=A("function:translate");function A(e){return t=>R&&R.emit(e,t)}const D={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function z(t,...n){return function(t,...n){return 1===n.length&&p(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(D[t],...n)}const H="9.1.4",J=-1,U="";let q;function K(e){q=e}let Z=null;const B=e=>{Z=e},G=()=>Z;let Q=0;function V(e={}){const t=f(e.version)?e.version:"9.1.4",n=f(e.locale)?e.locale:"en-US",o=i(e.fallbackLocale)||b(e.fallbackLocale)||f(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,l=b(e.messages)?e.messages:{[n]:{}},s=b(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},c=b(e.numberFormats)?e.numberFormats:{[n]:{}},g=Object.assign({},e.modifiers||{},{upper:e=>f(e)?e.toUpperCase():e,lower:e=>f(e)?e.toLowerCase():e,capitalize:e=>f(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),d=e.pluralRules||{},h=u(e.missing)?e.missing:null,_=!m(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,k=!m(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,w=!!e.fallbackFormat,y=!!e.unresolving,F=u(e.postTranslation)?e.postTranslation:null,C=b(e.processor)?e.processor:null,v=!m(e.warnHtmlMessage)||e.warnHtmlMessage,O=!!e.escapeParameter,W=u(e.messageCompiler)?e.messageCompiler:q,j=u(e.onWarn)?e.onWarn:a,$=e,M=p($.__datetimeFormatters)?$.__datetimeFormatters:new Map,S=p($.__numberFormatters)?$.__numberFormatters:new Map,E=p($.__meta)?$.__meta:{};Q++;return{version:t,cid:Q,locale:n,fallbackLocale:o,messages:l,datetimeFormats:s,numberFormats:c,modifiers:g,pluralRules:d,missing:h,missingWarn:_,fallbackWarn:k,fallbackFormat:w,unresolving:y,postTranslation:F,processor:C,warnHtmlMessage:v,escapeParameter:O,messageCompiler:W,onWarn:j,__datetimeFormatters:M,__numberFormatters:S,__meta:E}}function X(e,t){return e instanceof RegExp?e.test(t):e}function Y(e,t){return e instanceof RegExp?e.test(t):e}function ee(e,t,n,r,o){const{missing:a}=e;if(null!==a){const r=a(e,n,t,o);return f(r)?r:t}return t}function te(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;i(e);)e=ne(o,e,t);const a=i(t)?t:b(t)?t.default?t.default:null:t;e=f(a)?[a]:a,i(e)&&ne(o,e,!1),r.__localeChainCache.set(n,o)}return o}function ne(e,t,n){let r=!0;for(let o=0;o<t.length&&m(r);o++){f(t[o])&&(r=re(e,t[o],n))}return r}function re(e,t,n){let r;const o=t.split("-");do{r=oe(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function oe(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(i(n)||b(n))&&n[o]&&(r=n[o])}return r}function ae(e,t,n){e.__localeChainCache=new Map,te(e,n,t)}function le(){}function se(e,t={}){return()=>e}function ce(e){return I(e,null,void 0)}const ie=()=>"",ue=e=>u(e);function fe(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:a,fallbackLocale:s,messages:c}=e,[g,d]=pe(...t),b=(m(d.missingWarn),m(d.fallbackWarn),m(d.escapeParameter)?d.escapeParameter:e.escapeParameter),h=!!d.resolvedMessage,_=f(d.default)||m(d.default)?m(d.default)?g:d.default:r?g:"",k=r||""!==_,w=f(d.locale)?d.locale:e.locale;b&&function(e){i(e.list)?e.list=e.list.map((e=>f(e)?l(e):e)):p(e.named)&&Object.keys(e.named).forEach((t=>{f(e.named[t])&&(e.named[t]=l(e.named[t]))}))}(d);let[y,F,v]=h?[g,w,c[w]||{}]:function(e,t,n,r,o,a){const{messages:l}=e,s=te(e,r,n);let c,i={},m=null;const p="translate";for(let n=0;n<s.length&&(c=s[n],i=l[c]||{},null===(m=C(i,t))&&(m=i[t]),!f(m)&&!u(m));n++){const n=ee(e,t,c,0,p);n!==t&&(m=n)}return[m,c,i]}(e,g,w,s),O=g;if(h||f(y)||ue(y)||k&&(y=_,O=y),!(h||(f(y)||ue(y))&&f(F)))return a?-1:g;let W=!1;const j=ue(y)?y:me(e,g,F,y,O,(()=>{W=!0}));if(W)return y;const $=function(e,t,n){return t(n)}(0,j,E(function(e,t,r,o){const{modifiers:a,pluralRules:l}=e,s={locale:t,modifiers:a,pluralRules:l,messages:n=>{const o=C(r,n);if(f(o)){let r=!1;const a=me(e,n,t,o,n,(()=>{r=!0}));return r?ie:a}return ue(o)?o:ie}};e.processor&&(s.processor=e.processor);o.list&&(s.list=o.list);o.named&&(s.named=o.named);n(o.plural)&&(s.pluralIndex=o.plural);return s}(e,F,v,d)));return o?o($):$}function me(e,n,r,o,a,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(ue(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const i=s(o,function(e,n,r,o,a,l){return{warnHtmlMessage:a,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,a,0,c,l));return i.locale=r,i.key=n,i.source=o,i}function pe(...e){const[t,r,a]=e,l={};if(!f(t)&&!n(t)&&!ue(t))throw Error(14);const s=n(t)?String(t):(ue(t),t);return n(r)?l.plural=r:f(r)?l.default=r:b(r)&&!o(r)?l.named=r:i(r)&&(l.list=r),n(a)?l.plural=a:f(a)?l.default=a:b(a)&&Object.assign(l,a),[s,l]}function ge(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a}=e,{__datetimeFormatters:l}=e,[s,c,i,u]=de(...t);m(i.missingWarn);m(i.fallbackWarn);const p=!!i.part,g=f(i.locale)?i.locale:e.locale,d=te(e,a,g);if(!f(s)||""===s)return new Intl.DateTimeFormat(g).format(c);let h,_={},k=null;for(let t=0;t<d.length&&(h=d[t],_=n[h]||{},k=_[s],!b(k));t++)ee(e,s,h,0,"datetime format");if(!b(k)||!f(h))return r?-1:s;let w=`${h}__${s}`;o(u)||(w=`${w}__${JSON.stringify(u)}`);let y=l.get(w);return y||(y=new Intl.DateTimeFormat(h,Object.assign({},k,u)),l.set(w,y)),p?y.formatToParts(c):y.format(c)}function de(...e){const[t,r,o,a]=e;let l,s={},c={};if(f(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);l=new Date(t);try{l.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===d(t)){if(isNaN(t.getTime()))throw Error(15);l=t}else{if(!n(t))throw Error(14);l=t}return f(r)?s.key=r:b(r)&&(s=r),f(o)?s.locale=o:b(o)&&(c=o),b(a)&&(c=a),[s.key||"",l,s,c]}function be(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function he(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:a}=e,{__numberFormatters:l}=e,[s,c,i,u]=_e(...t);m(i.missingWarn);m(i.fallbackWarn);const p=!!i.part,g=f(i.locale)?i.locale:e.locale,d=te(e,a,g);if(!f(s)||""===s)return new Intl.NumberFormat(g).format(c);let h,_={},k=null;for(let t=0;t<d.length&&(h=d[t],_=n[h]||{},k=_[s],!b(k));t++)ee(e,s,h,0,"number format");if(!b(k)||!f(h))return r?-1:s;let w=`${h}__${s}`;o(u)||(w=`${w}__${JSON.stringify(u)}`);let y=l.get(w);return y||(y=new Intl.NumberFormat(h,Object.assign({},k,u)),l.set(w,y)),p?y.formatToParts(c):y.format(c)}function _e(...e){const[t,r,o,a]=e;let l={},s={};if(!n(t))throw Error(14);const c=t;return f(r)?l.key=r:b(r)&&(l=r),f(o)?l.locale=o:b(o)&&(s=o),b(a)&&(s=a),[l.key||"",c,l,s]}function ke(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}export{j as DEFAULT_MESSAGE_DATA_TYPE,U as MISSING_RESOLVE_VALUE,J as NOT_REOSLVED,H as VERSION,le as clearCompileCache,be as clearDateTimeFormat,ke as clearNumberFormat,se as compileToFunction,I as createCompileError,V as createCoreContext,ce as createCoreError,E as createMessageContext,ge as datetime,G as getAdditionalMeta,L as getDevToolsHook,te as getLocaleChain,z as getWarnMessage,v as handleFlatJson,ee as handleMissing,T as initI18nDevTools,ue as isMessageFunction,X as isTranslateFallbackWarn,Y as isTranslateMissingWarn,he as number,y as parse,de as parseDateTimeArgs,_e as parseNumberArgs,pe as parseTranslateArgs,K as registerMessageCompiler,C as resolveValue,B as setAdditionalMeta,x as setDevToolsHook,fe as translate,P as translateDevTools,ae as updateFallbackLocale}; | ||
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===b(e),o=e=>h(e)&&0===Object.keys(e).length;function a(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const l=Object.assign;function s(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const c=Object.prototype.hasOwnProperty;function i(e,t){return c.call(e,t)}const u=Array.isArray,f=e=>"function"==typeof e,m=e=>"string"==typeof e,p=e=>"boolean"==typeof e,g=e=>null!==e&&"object"==typeof e,d=Object.prototype.toString,b=e=>d.call(e),h=e=>"[object Object]"===b(e),_=[];_[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 w(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function y(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(k.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function F(e){const t=[];let n,r,o,a,l,s,c,i=-1,u=0,f=0;const m=[];function p(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,o="\\"+t,m[0](),!0}for(m[0]=()=>{void 0===r?r=o:r+=o},m[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},m[2]=()=>{m[0](),f++},m[3]=()=>{if(f>0)f--,u=4,m[0]();else{if(f=0,void 0===r)return!1;if(r=y(r),!1===r)return!1;m[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!p()){if(a=w(n),c=_[u],l=c[a]||c.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=m[l[1]],s&&(o=n,!1===s())))return;if(7===u)return t}}const C=new Map;function v(e,t){if(!g(e))return null;let n=C.get(t);if(n||(n=F(t),n&&C.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}function W(e){if(!g(e))return e;for(const t in e)if(i(e,t))if(t.includes(".")){const n=t.split("."),r=n.length-1;let o=e;for(let e=0;e<r;e++)n[e]in o||(o[n[e]]={}),o=o[n[e]];o[n[r]]=e[t],delete e[t],g(o[n[r]])&&W(o[n[r]])}else g(e[t])&&W(e[t]);return e}const $=e=>e,O=e=>"",M="text",S=e=>0===e.length?"":e.join(""),j=e=>null==e?"":u(e)||h(e)&&e.toString===d?JSON.stringify(e,null,2):String(e);function E(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function I(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=g(e.pluralRules)&&m(t)&&f(e.pluralRules[t])?e.pluralRules[t]:E,a=g(e.pluralRules)&&m(t)&&f(e.pluralRules[t])?E:void 0,l=e.list||[],s=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,s);function c(t){const n=f(e.messages)?e.messages(t):!!g(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):O)}const i=h(e.processor)&&f(e.processor.normalize)?e.processor.normalize:S,u=h(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:j,p={list:e=>l[e],named:e=>s[e],plural:e=>e[o(r,e.length,a)],linked:(t,n)=>{const r=c(t)(p);return m(n)?(o=n,e.modifiers?e.modifiers[o]:$)(r):r;var o},message:c,type:h(e.processor)&&m(e.processor.type)?e.processor.type:"text",interpolate:u,normalize:i};return p}function N(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}const R="i18n:init";let x=null;function L(e){x=e}function T(){return x}function P(e,t,n){x&&x.emit(R,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const A=D("function:translate");function D(e){return t=>x&&x.emit(e,t)}const z={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};function H(t,...n){return function(t,...n){return 1===n.length&&g(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(z[t],...n)}const J="9.1.5",U=-1,q="";let K;function Z(e){K=e}let B=null;const G=e=>{B=e},Q=()=>B;let V=0;function X(e={}){const t=m(e.version)?e.version:"9.1.5",n=m(e.locale)?e.locale:"en-US",o=u(e.fallbackLocale)||h(e.fallbackLocale)||m(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=h(e.messages)?e.messages:{[n]:{}},c=h(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},i=h(e.numberFormats)?e.numberFormats:{[n]:{}},d=l({},e.modifiers||{},{upper:e=>m(e)?e.toUpperCase():e,lower:e=>m(e)?e.toLowerCase():e,capitalize:e=>m(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),b=e.pluralRules||{},_=f(e.missing)?e.missing:null,k=!p(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,w=!p(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,y=!!e.fallbackFormat,F=!!e.unresolving,C=f(e.postTranslation)?e.postTranslation:null,v=h(e.processor)?e.processor:null,W=!p(e.warnHtmlMessage)||e.warnHtmlMessage,$=!!e.escapeParameter,O=f(e.messageCompiler)?e.messageCompiler:K,M=f(e.onWarn)?e.onWarn:a,S=e,j=g(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,E=g(S.__numberFormatters)?S.__numberFormatters:new Map,I=g(S.__meta)?S.__meta:{};V++;return{version:t,cid:V,locale:n,fallbackLocale:o,messages:s,datetimeFormats:c,numberFormats:i,modifiers:d,pluralRules:b,missing:_,missingWarn:k,fallbackWarn:w,fallbackFormat:y,unresolving:F,postTranslation:C,processor:v,warnHtmlMessage:W,escapeParameter:$,messageCompiler:O,onWarn:M,__datetimeFormatters:j,__numberFormatters:E,__meta:I}}function Y(e,t){return e instanceof RegExp?e.test(t):e}function ee(e,t){return e instanceof RegExp?e.test(t):e}function te(e,t,n,r,o){const{missing:a}=e;if(null!==a){const r=a(e,n,t,o);return m(r)?r:t}return t}function ne(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;u(e);)e=re(o,e,t);const a=u(t)?t:h(t)?t.default?t.default:null:t;e=m(a)?[a]:a,u(e)&&re(o,e,!1),r.__localeChainCache.set(n,o)}return o}function re(e,t,n){let r=!0;for(let o=0;o<t.length&&p(r);o++){m(t[o])&&(r=oe(e,t[o],n))}return r}function oe(e,t,n){let r;const o=t.split("-");do{r=ae(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function ae(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(u(n)||h(n))&&n[o]&&(r=n[o])}return r}function le(e,t,n){e.__localeChainCache=new Map,ne(e,n,t)}function se(){}function ce(e,t={}){return()=>e}function ie(e){return N(e,null,void 0)}const ue=()=>"",fe=e=>f(e);function me(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:a,fallbackLocale:l,messages:c}=e,[i,d]=ge(...t),b=(p(d.missingWarn),p(d.fallbackWarn),p(d.escapeParameter)?d.escapeParameter:e.escapeParameter),h=!!d.resolvedMessage,_=m(d.default)||p(d.default)?p(d.default)?i:d.default:r?i:"",k=r||""!==_,w=m(d.locale)?d.locale:e.locale;b&&function(e){u(e.list)?e.list=e.list.map((e=>m(e)?s(e):e)):g(e.named)&&Object.keys(e.named).forEach((t=>{m(e.named[t])&&(e.named[t]=s(e.named[t]))}))}(d);let[y,F,C]=h?[i,w,c[w]||{}]:function(e,t,n,r,o,a){const{messages:l}=e,s=ne(e,r,n);let c,i={},u=null;const p="translate";for(let n=0;n<s.length&&(c=s[n],i=l[c]||{},null===(u=v(i,t))&&(u=i[t]),!m(u)&&!f(u));n++){const n=te(e,t,c,0,p);n!==t&&(u=n)}return[u,c,i]}(e,i,w,l),W=i;if(h||m(y)||fe(y)||k&&(y=_,W=y),!(h||(m(y)||fe(y))&&m(F)))return a?-1:i;let $=!1;const O=fe(y)?y:pe(e,i,F,y,W,(()=>{$=!0}));if($)return y;const M=function(e,t,n){return t(n)}(0,O,I(function(e,t,r,o){const{modifiers:a,pluralRules:l}=e,s={locale:t,modifiers:a,pluralRules:l,messages:n=>{const o=v(r,n);if(m(o)){let r=!1;const a=pe(e,n,t,o,n,(()=>{r=!0}));return r?ue:a}return fe(o)?o:ue}};e.processor&&(s.processor=e.processor);o.list&&(s.list=o.list);o.named&&(s.named=o.named);n(o.plural)&&(s.pluralIndex=o.plural);return s}(e,F,C,d)));return o?o(M):M}function pe(e,n,r,o,a,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(fe(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const i=s(o,function(e,n,r,o,a,l){return{warnHtmlMessage:a,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,a,0,c,l));return i.locale=r,i.key=n,i.source=o,i}function ge(...e){const[t,r,a]=e,s={};if(!m(t)&&!n(t)&&!fe(t))throw Error(14);const c=n(t)?String(t):(fe(t),t);return n(r)?s.plural=r:m(r)?s.default=r:h(r)&&!o(r)?s.named=r:u(r)&&(s.list=r),n(a)?s.plural=a:m(a)?s.default=a:h(a)&&l(s,a),[c,s]}function de(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a}=e,{__datetimeFormatters:s}=e,[c,i,u,f]=be(...t);p(u.missingWarn);p(u.fallbackWarn);const g=!!u.part,d=m(u.locale)?u.locale:e.locale,b=ne(e,a,d);if(!m(c)||""===c)return new Intl.DateTimeFormat(d).format(i);let _,k={},w=null;for(let t=0;t<b.length&&(_=b[t],k=n[_]||{},w=k[c],!h(w));t++)te(e,c,_,0,"datetime format");if(!h(w)||!m(_))return r?-1:c;let y=`${_}__${c}`;o(f)||(y=`${y}__${JSON.stringify(f)}`);let F=s.get(y);return F||(F=new Intl.DateTimeFormat(_,l({},w,f)),s.set(y,F)),g?F.formatToParts(i):F.format(i)}function be(...e){const[t,r,o,a]=e;let l,s={},c={};if(m(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);l=new Date(t);try{l.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===b(t)){if(isNaN(t.getTime()))throw Error(15);l=t}else{if(!n(t))throw Error(14);l=t}return m(r)?s.key=r:h(r)&&(s=r),m(o)?s.locale=o:h(o)&&(c=o),h(a)&&(c=a),[s.key||"",l,s,c]}function he(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function _e(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:a}=e,{__numberFormatters:s}=e,[c,i,u,f]=ke(...t);p(u.missingWarn);p(u.fallbackWarn);const g=!!u.part,d=m(u.locale)?u.locale:e.locale,b=ne(e,a,d);if(!m(c)||""===c)return new Intl.NumberFormat(d).format(i);let _,k={},w=null;for(let t=0;t<b.length&&(_=b[t],k=n[_]||{},w=k[c],!h(w));t++)te(e,c,_,0,"number format");if(!h(w)||!m(_))return r?-1:c;let y=`${_}__${c}`;o(f)||(y=`${y}__${JSON.stringify(f)}`);let F=s.get(y);return F||(F=new Intl.NumberFormat(_,l({},w,f)),s.set(y,F)),g?F.formatToParts(i):F.format(i)}function ke(...e){const[t,r,o,a]=e;let l={},s={};if(!n(t))throw Error(14);const c=t;return m(r)?l.key=r:h(r)&&(l=r),m(o)?l.locale=o:h(o)&&(s=o),h(a)&&(s=a),[l.key||"",c,l,s]}function we(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}export{M as DEFAULT_MESSAGE_DATA_TYPE,q as MISSING_RESOLVE_VALUE,U as NOT_REOSLVED,J as VERSION,se as clearCompileCache,he as clearDateTimeFormat,we as clearNumberFormat,ce as compileToFunction,N as createCompileError,X as createCoreContext,ie as createCoreError,I as createMessageContext,de as datetime,Q as getAdditionalMeta,T as getDevToolsHook,ne as getLocaleChain,H as getWarnMessage,W as handleFlatJson,te as handleMissing,P as initI18nDevTools,fe as isMessageFunction,Y as isTranslateFallbackWarn,ee as isTranslateMissingWarn,_e as number,F as parse,be as parseDateTimeArgs,ke as parseNumberArgs,ge as parseTranslateArgs,Z as registerMessageCompiler,v as resolveValue,G as setAdditionalMeta,L as setDevToolsHook,me as translate,A as translateDevTools,le as updateFallbackLocale}; |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
@@ -62,2 +62,3 @@ * Released under the MIT License. | ||
} | ||
const assign = Object.assign; | ||
function escapeHtml(rawText) { | ||
@@ -591,3 +592,3 @@ return rawText | ||
*/ | ||
const VERSION = '9.1.4'; | ||
const VERSION = '9.1.5'; | ||
const NOT_REOSLVED = -1; | ||
@@ -636,3 +637,3 @@ const MISSING_RESOLVE_VALUE = ''; | ||
: { [locale]: {} }; | ||
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers()); | ||
const modifiers = assign({}, options.modifiers || {}, getDefaultLinkedModifiers()); | ||
const pluralRules = options.pluralRules || {}; | ||
@@ -938,3 +939,3 @@ const missing = isFunction(options.missing) ? options.missing : null; | ||
}; | ||
payloads.meta = Object.assign({}, context.__meta, getAdditionalMeta() || {}); | ||
payloads.meta = assign({}, context.__meta, getAdditionalMeta() || {}); | ||
translateDevTools(payloads); | ||
@@ -1135,3 +1136,3 @@ } | ||
else if (isPlainObject(arg3)) { | ||
Object.assign(options, arg3); | ||
assign(options, arg3); | ||
} | ||
@@ -1283,3 +1284,3 @@ return [key, options]; | ||
if (!formatter) { | ||
formatter = new Intl.DateTimeFormat(targetLocale, Object.assign({}, format, overrides)); | ||
formatter = new Intl.DateTimeFormat(targetLocale, assign({}, format, overrides)); | ||
__datetimeFormatters.set(id, formatter); | ||
@@ -1419,3 +1420,3 @@ } | ||
if (!formatter) { | ||
formatter = new Intl.NumberFormat(targetLocale, Object.assign({}, format, overrides)); | ||
formatter = new Intl.NumberFormat(targetLocale, assign({}, format, overrides)); | ||
__numberFormatters.set(id, formatter); | ||
@@ -1422,0 +1423,0 @@ } |
/*! | ||
* @intlify/core v9.1.4 | ||
* @intlify/core v9.1.5 | ||
* (c) 2021 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),a=e=>"[object RegExp]"===b(e),o=e=>_(e)&&0===Object.keys(e).length;function l(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function s(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const c=Object.prototype.hasOwnProperty;function i(e,t){return c.call(e,t)}const u=Array.isArray,m=e=>"function"==typeof e,f=e=>"string"==typeof e,p=e=>"boolean"==typeof e,g=e=>null!==e&&"object"==typeof e,d=Object.prototype.toString,b=e=>d.call(e),_=e=>"[object Object]"===b(e),h=[];h[0]={w:[0],i:[3,0],"[":[4],o:[7]},h[1]={w:[1],".":[2],"[":[4],o:[7]},h[2]={w:[2],i:[3,0],0:[3,0]},h[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},h[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},h[5]={"'":[4,0],o:8,l:[5,0]},h[6]={'"':[4,0],o:8,l:[6,0]};const k=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function y(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 w(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(k.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function F(e){const t=[];let n,r,a,o,l,s,c,i=-1,u=0,m=0;const f=[];function p(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,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=w(r),!1===r)return!1;f[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!p()){if(o=y(n),c=h[u],l=c[o]||c.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 C=new Map;function v(e,t){if(!g(e))return null;let n=C.get(t);if(n||(n=F(t),n&&C.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 T=e=>e,E=e=>"",M="text",O=e=>0===e.length?"":e.join(""),S=e=>null==e?"":u(e)||_(e)&&e.toString===d?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 A(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),a=g(e.pluralRules)&&f(t)&&m(e.pluralRules[t])?e.pluralRules[t]:W,o=g(e.pluralRules)&&f(t)&&m(e.pluralRules[t])?W:void 0,l=e.list||[],s=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function c(t){const n=m(e.messages)?e.messages(t):!!g(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):E)}const i=_(e.processor)&&m(e.processor.normalize)?e.processor.normalize:O,u=_(e.processor)&&m(e.processor.interpolate)?e.processor.interpolate:S,p={list:e=>l[e],named:e=>s[e],plural:e=>e[a(n,e.length,o)],linked:(t,n)=>{const r=c(t)(p);return f(n)?(a=n,e.modifiers?e.modifiers[a]:T)(r):r;var a},message:c,type:_(e.processor)&&f(e.processor.type)?e.processor.type:M,interpolate:u,normalize:i};return p}function I(e,t,n={}){const{domain:r}=n,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=r,a}const L="i18n:init";let N=null;const j=D("function:translate");function D(e){return t=>N&&N.emit(e,t)}const R={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};const $="9.1.4";let P;let x=null;let H=0;function z(e,t,n,r,a){const{missing:o}=e;if(null!==o){const r=o(e,n,t,a);return f(r)?r:t}return t}function J(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let a=r.__localeChainCache.get(n);if(!a){a=[];let e=[n];for(;u(e);)e=U(a,e,t);const o=u(t)?t:_(t)?t.default?t.default:null:t;e=f(o)?[o]:o,u(e)&&U(a,e,!1),r.__localeChainCache.set(n,a)}return a}function U(e,t,n){let r=!0;for(let a=0;a<t.length&&p(r);a++){f(t[a])&&(r=V(e,t[a],n))}return r}function V(e,t,n){let r;const a=t.split("-");do{r=G(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function G(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),(u(n)||_(n))&&n[a]&&(r=n[a])}return r}const q=()=>"",K=e=>m(e);function Y(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(K(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}const i=s(a,function(e,t,r,a,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,o,0,c,l));return i.locale=r,i.key=t,i.source=a,i}function Z(...e){const[t,n,a]=e,l={};if(!f(t)&&!r(t)&&!K(t))throw Error(14);const s=r(t)?String(t):(K(t),t);return r(n)?l.plural=n:f(n)?l.default=n:_(n)&&!o(n)?l.named=n:u(n)&&(l.list=n),r(a)?l.plural=a:f(a)?l.default=a:_(a)&&Object.assign(l,a),[s,l]}function B(...e){const[t,n,a,o]=e;let l,s={},c={};if(f(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);l=new Date(t);try{l.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===b(t)){if(isNaN(t.getTime()))throw Error(15);l=t}else{if(!r(t))throw Error(14);l=t}return f(n)?s.key=n:_(n)&&(s=n),f(a)?s.locale=a:_(a)&&(c=a),_(o)&&(c=o),[s.key||"",l,s,c]}function Q(...e){const[t,n,a,o]=e;let l={},s={};if(!r(t))throw Error(14);const c=t;return f(n)?l.key=n:_(n)&&(l=n),f(a)?l.locale=a:_(a)&&(s=a),_(o)&&(s=o),[l.key||"",c,l,s]}return e.DEFAULT_MESSAGE_DATA_TYPE=M,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.VERSION=$,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCompileError=I,e.createCoreContext=function(e={}){const t=f(e.version)?e.version:$,n=f(e.locale)?e.locale:"en-US",r=u(e.fallbackLocale)||_(e.fallbackLocale)||f(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=_(e.messages)?e.messages:{[n]:{}},s=_(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},c=_(e.numberFormats)?e.numberFormats:{[n]:{}},i=Object.assign({},e.modifiers||{},{upper:e=>f(e)?e.toUpperCase():e,lower:e=>f(e)?e.toLowerCase():e,capitalize:e=>f(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),d=e.pluralRules||{},b=m(e.missing)?e.missing:null,h=!p(e.missingWarn)&&!a(e.missingWarn)||e.missingWarn,k=!p(e.fallbackWarn)&&!a(e.fallbackWarn)||e.fallbackWarn,y=!!e.fallbackFormat,w=!!e.unresolving,F=m(e.postTranslation)?e.postTranslation:null,C=_(e.processor)?e.processor:null,v=!p(e.warnHtmlMessage)||e.warnHtmlMessage,T=!!e.escapeParameter,E=m(e.messageCompiler)?e.messageCompiler:P,M=m(e.onWarn)?e.onWarn:l,O=e,S=g(O.__datetimeFormatters)?O.__datetimeFormatters:new Map,W=g(O.__numberFormatters)?O.__numberFormatters:new Map,A=g(O.__meta)?O.__meta:{};return H++,{version:t,cid:H,locale:n,fallbackLocale:r,messages:o,datetimeFormats:s,numberFormats:c,modifiers:i,pluralRules:d,missing:b,missingWarn:h,fallbackWarn:k,fallbackFormat:y,unresolving:w,postTranslation:F,processor:C,warnHtmlMessage:v,escapeParameter:T,messageCompiler:E,onWarn:M,__datetimeFormatters:S,__numberFormatters:W,__meta:A}},e.createCoreError=function(e){return I(e,null,void 0)},e.createMessageContext=A,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a}=e,{__datetimeFormatters:l}=e,[s,c,i,u]=B(...t);p(i.missingWarn),p(i.fallbackWarn);const m=!!i.part,g=f(i.locale)?i.locale:e.locale,d=J(e,a,g);if(!f(s)||""===s)return new Intl.DateTimeFormat(g).format(c);let b,h={},k=null;for(let t=0;t<d.length&&(b=d[t],h=n[b]||{},k=h[s],!_(k));t++)z(e,s,b,0,"datetime format");if(!_(k)||!f(b))return r?-1:s;let y=`${b}__${s}`;o(u)||(y=`${y}__${JSON.stringify(u)}`);let w=l.get(y);return w||(w=new Intl.DateTimeFormat(b,Object.assign({},k,u)),l.set(y,w)),m?w.formatToParts(c):w.format(c)},e.getAdditionalMeta=()=>x,e.getDevToolsHook=function(){return N},e.getLocaleChain=J,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&g(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(R[e],...n)},e.handleFlatJson=function e(t){if(!g(t))return t;for(const n in t)if(i(t,n))if(n.includes(".")){const r=n.split("."),a=r.length-1;let o=t;for(let e=0;e<a;e++)r[e]in o||(o[r[e]]={}),o=o[r[e]];o[r[a]]=t[n],delete t[n],g(o[r[a]])&&e(o[r[a]])}else g(t[n])&&e(t[n]);return t},e.handleMissing=z,e.initI18nDevTools=function(e,t,n){N&&N.emit(L,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=K,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:a}=e,{__numberFormatters:l}=e,[s,c,i,u]=Q(...t);p(i.missingWarn),p(i.fallbackWarn);const m=!!i.part,g=f(i.locale)?i.locale:e.locale,d=J(e,a,g);if(!f(s)||""===s)return new Intl.NumberFormat(g).format(c);let b,h={},k=null;for(let t=0;t<d.length&&(b=d[t],h=n[b]||{},k=h[s],!_(k));t++)z(e,s,b,0,"number format");if(!_(k)||!f(b))return r?-1:s;let y=`${b}__${s}`;o(u)||(y=`${y}__${JSON.stringify(u)}`);let w=l.get(y);return w||(w=new Intl.NumberFormat(b,Object.assign({},k,u)),l.set(y,w)),m?w.formatToParts(c):w.format(c)},e.parse=F,e.parseDateTimeArgs=B,e.parseNumberArgs=Q,e.parseTranslateArgs=Z,e.registerMessageCompiler=function(e){P=e},e.resolveValue=v,e.setAdditionalMeta=e=>{x=e},e.setDevToolsHook=function(e){N=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:a,unresolving:o,fallbackLocale:l,messages:c}=e,[i,d]=Z(...t),b=(p(d.missingWarn),p(d.fallbackWarn),p(d.escapeParameter)?d.escapeParameter:e.escapeParameter),_=!!d.resolvedMessage,h=f(d.default)||p(d.default)?p(d.default)?i:d.default:n?i:"",k=n||""!==h,y=f(d.locale)?d.locale:e.locale;b&&function(e){u(e.list)?e.list=e.list.map((e=>f(e)?s(e):e)):g(e.named)&&Object.keys(e.named).forEach((t=>{f(e.named[t])&&(e.named[t]=s(e.named[t]))}))}(d);let[w,F,C]=_?[i,y,c[y]||{}]:function(e,t,n,r,a,o){const{messages:l}=e,s=J(e,r,n);let c,i={},u=null;const p="translate";for(let n=0;n<s.length&&(c=s[n],i=l[c]||{},null===(u=v(i,t))&&(u=i[t]),!f(u)&&!m(u));n++){const n=z(e,t,c,0,p);n!==t&&(u=n)}return[u,c,i]}(e,i,y,l),T=i;if(_||f(w)||K(w)||k&&(w=h,T=w),!(_||(f(w)||K(w))&&f(F)))return o?-1:i;let E=!1;const M=K(w)?w:Y(e,i,F,w,T,(()=>{E=!0}));if(E)return w;const O=function(e,t,n){return t(n)}(0,M,A(function(e,t,n,a){const{modifiers:o,pluralRules:l}=e,s={locale:t,modifiers:o,pluralRules:l,messages:r=>{const a=v(n,r);if(f(a)){let n=!1;const o=Y(e,r,t,a,r,(()=>{n=!0}));return n?q:o}return K(a)?a:q}};e.processor&&(s.processor=e.processor);a.list&&(s.list=a.list);a.named&&(s.named=a.named);r(a.plural)&&(s.pluralIndex=a.plural);return s}(e,F,C,d)));return a?a(O):O},e.translateDevTools=j,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,J(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),a=e=>"[object RegExp]"===b(e),o=e=>h(e)&&0===Object.keys(e).length;function l(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const s=Object.assign;function c(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const i=Object.prototype.hasOwnProperty;function u(e,t){return i.call(e,t)}const m=Array.isArray,f=e=>"function"==typeof e,p=e=>"string"==typeof e,g=e=>"boolean"==typeof e,d=e=>null!==e&&"object"==typeof e,_=Object.prototype.toString,b=e=>_.call(e),h=e=>"[object Object]"===b(e),k=[];k[0]={w:[0],i:[3,0],"[":[4],o:[7]},k[1]={w:[1],".":[2],"[":[4],o:[7]},k[2]={w:[2],i:[3,0],0:[3,0]},k[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},k[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},k[5]={"'":[4,0],o:8,l:[5,0]},k[6]={'"':[4,0],o:8,l:[6,0]};const y=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function w(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 F(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(y.test(t)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t)}function C(e){const t=[];let n,r,a,o,l,s,c,i=-1,u=0,m=0;const f=[];function p(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,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=F(r),!1===r)return!1;f[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!p()){if(o=w(n),c=k[u],l=c[o]||c.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 v=new Map;function T(e,t){if(!d(e))return null;let n=v.get(t);if(n||(n=C(t),n&&v.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 E=e=>e,M=e=>"",S="text",W=e=>0===e.length?"":e.join(""),O=e=>null==e?"":m(e)||h(e)&&e.toString===_?JSON.stringify(e,null,2):String(e);function A(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function I(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),a=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?e.pluralRules[t]:A,o=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?A:void 0,l=e.list||[],s=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function c(t){const n=f(e.messages)?e.messages(t):!!d(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):M)}const i=h(e.processor)&&f(e.processor.normalize)?e.processor.normalize:W,u=h(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:O,m={list:e=>l[e],named:e=>s[e],plural:e=>e[a(n,e.length,o)],linked:(t,n)=>{const r=c(t)(m);return p(n)?(a=n,e.modifiers?e.modifiers[a]:E)(r):r;var a},message:c,type:h(e.processor)&&p(e.processor.type)?e.processor.type:S,interpolate:u,normalize:i};return m}function L(e,t,n={}){const{domain:r}=n,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=r,a}const N="i18n:init";let D=null;const R=$("function:translate");function $(e){return t=>D&&D.emit(e,t)}const j={0:"Not found '{key}' key in '{locale}' locale messages.",1:"Fall back to translate '{key}' key with '{target}' locale.",2:"Cannot format a number value due to not supported Intl.NumberFormat.",3:"Fall back to number format '{key}' key with '{target}' locale.",4:"Cannot format a date value due to not supported Intl.DateTimeFormat.",5:"Fall back to datetime format '{key}' key with '{target}' locale."};const P="9.1.5";let x;let H=null;let z=0;function J(e,t,n,r,a){const{missing:o}=e;if(null!==o){const r=o(e,n,t,a);return p(r)?r:t}return t}function U(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let a=r.__localeChainCache.get(n);if(!a){a=[];let e=[n];for(;m(e);)e=V(a,e,t);const o=m(t)?t:h(t)?t.default?t.default:null:t;e=p(o)?[o]:o,m(e)&&V(a,e,!1),r.__localeChainCache.set(n,a)}return a}function V(e,t,n){let r=!0;for(let a=0;a<t.length&&g(r);a++){p(t[a])&&(r=G(e,t[a],n))}return r}function G(e,t,n){let r;const a=t.split("-");do{r=q(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function q(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)||h(n))&&n[a]&&(r=n[a])}return r}const K=()=>"",Y=e=>f(e);function Z(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(Y(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}const i=s(a,function(e,t,r,a,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,o,0,c,l));return i.locale=r,i.key=t,i.source=a,i}function B(...e){const[t,n,a]=e,l={};if(!p(t)&&!r(t)&&!Y(t))throw Error(14);const c=r(t)?String(t):(Y(t),t);return r(n)?l.plural=n:p(n)?l.default=n:h(n)&&!o(n)?l.named=n:m(n)&&(l.list=n),r(a)?l.plural=a:p(a)?l.default=a:h(a)&&s(l,a),[c,l]}function Q(...e){const[t,n,a,o]=e;let l,s={},c={};if(p(t)){if(!/\d{4}-\d{2}-\d{2}(T.*)?/.test(t))throw Error(16);l=new Date(t);try{l.toISOString()}catch(e){throw Error(16)}}else if("[object Date]"===b(t)){if(isNaN(t.getTime()))throw Error(15);l=t}else{if(!r(t))throw Error(14);l=t}return p(n)?s.key=n:h(n)&&(s=n),p(a)?s.locale=a:h(a)&&(c=a),h(o)&&(c=o),[s.key||"",l,s,c]}function X(...e){const[t,n,a,o]=e;let l={},s={};if(!r(t))throw Error(14);const c=t;return p(n)?l.key=n:h(n)&&(l=n),p(a)?l.locale=a:h(a)&&(s=a),h(o)&&(s=o),[l.key||"",c,l,s]}return e.DEFAULT_MESSAGE_DATA_TYPE=S,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.VERSION=P,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCompileError=L,e.createCoreContext=function(e={}){const t=p(e.version)?e.version:P,n=p(e.locale)?e.locale:"en-US",r=m(e.fallbackLocale)||h(e.fallbackLocale)||p(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=h(e.messages)?e.messages:{[n]:{}},c=h(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},i=h(e.numberFormats)?e.numberFormats:{[n]:{}},u=s({},e.modifiers||{},{upper:e=>p(e)?e.toUpperCase():e,lower:e=>p(e)?e.toLowerCase():e,capitalize:e=>p(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),_=e.pluralRules||{},b=f(e.missing)?e.missing:null,k=!g(e.missingWarn)&&!a(e.missingWarn)||e.missingWarn,y=!g(e.fallbackWarn)&&!a(e.fallbackWarn)||e.fallbackWarn,w=!!e.fallbackFormat,F=!!e.unresolving,C=f(e.postTranslation)?e.postTranslation:null,v=h(e.processor)?e.processor:null,T=!g(e.warnHtmlMessage)||e.warnHtmlMessage,E=!!e.escapeParameter,M=f(e.messageCompiler)?e.messageCompiler:x,S=f(e.onWarn)?e.onWarn:l,W=e,O=d(W.__datetimeFormatters)?W.__datetimeFormatters:new Map,A=d(W.__numberFormatters)?W.__numberFormatters:new Map,I=d(W.__meta)?W.__meta:{};return z++,{version:t,cid:z,locale:n,fallbackLocale:r,messages:o,datetimeFormats:c,numberFormats:i,modifiers:u,pluralRules:_,missing:b,missingWarn:k,fallbackWarn:y,fallbackFormat:w,unresolving:F,postTranslation:C,processor:v,warnHtmlMessage:T,escapeParameter:E,messageCompiler:M,onWarn:S,__datetimeFormatters:O,__numberFormatters:A,__meta:I}},e.createCoreError=function(e){return L(e,null,void 0)},e.createMessageContext=I,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a}=e,{__datetimeFormatters:l}=e,[c,i,u,m]=Q(...t);g(u.missingWarn),g(u.fallbackWarn);const f=!!u.part,d=p(u.locale)?u.locale:e.locale,_=U(e,a,d);if(!p(c)||""===c)return new Intl.DateTimeFormat(d).format(i);let b,k={},y=null;for(let t=0;t<_.length&&(b=_[t],k=n[b]||{},y=k[c],!h(y));t++)J(e,c,b,0,"datetime format");if(!h(y)||!p(b))return r?-1:c;let w=`${b}__${c}`;o(m)||(w=`${w}__${JSON.stringify(m)}`);let F=l.get(w);return F||(F=new Intl.DateTimeFormat(b,s({},y,m)),l.set(w,F)),f?F.formatToParts(i):F.format(i)},e.getAdditionalMeta=()=>H,e.getDevToolsHook=function(){return D},e.getLocaleChain=U,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&d(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(j[e],...n)},e.handleFlatJson=function e(t){if(!d(t))return t;for(const n in t)if(u(t,n))if(n.includes(".")){const r=n.split("."),a=r.length-1;let o=t;for(let e=0;e<a;e++)r[e]in o||(o[r[e]]={}),o=o[r[e]];o[r[a]]=t[n],delete t[n],d(o[r[a]])&&e(o[r[a]])}else d(t[n])&&e(t[n]);return t},e.handleMissing=J,e.initI18nDevTools=function(e,t,n){D&&D.emit(N,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=Y,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:a}=e,{__numberFormatters:l}=e,[c,i,u,m]=X(...t);g(u.missingWarn),g(u.fallbackWarn);const f=!!u.part,d=p(u.locale)?u.locale:e.locale,_=U(e,a,d);if(!p(c)||""===c)return new Intl.NumberFormat(d).format(i);let b,k={},y=null;for(let t=0;t<_.length&&(b=_[t],k=n[b]||{},y=k[c],!h(y));t++)J(e,c,b,0,"number format");if(!h(y)||!p(b))return r?-1:c;let w=`${b}__${c}`;o(m)||(w=`${w}__${JSON.stringify(m)}`);let F=l.get(w);return F||(F=new Intl.NumberFormat(b,s({},y,m)),l.set(w,F)),f?F.formatToParts(i):F.format(i)},e.parse=C,e.parseDateTimeArgs=Q,e.parseNumberArgs=X,e.parseTranslateArgs=B,e.registerMessageCompiler=function(e){x=e},e.resolveValue=T,e.setAdditionalMeta=e=>{H=e},e.setDevToolsHook=function(e){D=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:a,unresolving:o,fallbackLocale:l,messages:s}=e,[i,u]=B(...t),_=(g(u.missingWarn),g(u.fallbackWarn),g(u.escapeParameter)?u.escapeParameter:e.escapeParameter),b=!!u.resolvedMessage,h=p(u.default)||g(u.default)?g(u.default)?i:u.default:n?i:"",k=n||""!==h,y=p(u.locale)?u.locale:e.locale;_&&function(e){m(e.list)?e.list=e.list.map((e=>p(e)?c(e):e)):d(e.named)&&Object.keys(e.named).forEach((t=>{p(e.named[t])&&(e.named[t]=c(e.named[t]))}))}(u);let[w,F,C]=b?[i,y,s[y]||{}]:function(e,t,n,r,a,o){const{messages:l}=e,s=U(e,r,n);let c,i={},u=null;const m="translate";for(let n=0;n<s.length&&(c=s[n],i=l[c]||{},null===(u=T(i,t))&&(u=i[t]),!p(u)&&!f(u));n++){const n=J(e,t,c,0,m);n!==t&&(u=n)}return[u,c,i]}(e,i,y,l),v=i;if(b||p(w)||Y(w)||k&&(w=h,v=w),!(b||(p(w)||Y(w))&&p(F)))return o?-1:i;let E=!1;const M=Y(w)?w:Z(e,i,F,w,v,(()=>{E=!0}));if(E)return w;const S=function(e,t,n){return t(n)}(0,M,I(function(e,t,n,a){const{modifiers:o,pluralRules:l}=e,s={locale:t,modifiers:o,pluralRules:l,messages:r=>{const a=T(n,r);if(p(a)){let n=!1;const o=Z(e,r,t,a,r,(()=>{n=!0}));return n?K:o}return Y(a)?a:K}};e.processor&&(s.processor=e.processor);a.list&&(s.list=a.list);a.named&&(s.named=a.named);r(a.plural)&&(s.pluralIndex=a.plural);return s}(e,F,C,u)));return a?a(S):S},e.translateDevTools=R,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,U(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); |
{ | ||
"name": "@intlify/core", | ||
"version": "9.1.4", | ||
"version": "9.1.5", | ||
"description": "@intlify/core", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@intlify/core-base": "9.1.4" | ||
"@intlify/core-base": "9.1.5" | ||
}, | ||
@@ -39,0 +39,0 @@ "engines": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
8813
391825
+ Added@intlify/core-base@9.1.5(transitive)
+ Added@intlify/devtools-if@9.1.5(transitive)
+ Added@intlify/message-compiler@9.1.5(transitive)
+ Added@intlify/message-resolver@9.1.5(transitive)
+ Added@intlify/runtime@9.1.5(transitive)
+ Added@intlify/shared@9.1.5(transitive)
+ Added@intlify/vue-devtools@9.1.5(transitive)
- Removed@intlify/core-base@9.1.4(transitive)
- Removed@intlify/devtools-if@9.1.4(transitive)
- Removed@intlify/message-compiler@9.1.4(transitive)
- Removed@intlify/message-resolver@9.1.4(transitive)
- Removed@intlify/runtime@9.1.4(transitive)
- Removed@intlify/shared@9.1.4(transitive)
- Removed@intlify/vue-devtools@9.1.4(transitive)
Updated@intlify/core-base@9.1.5