@intlify/core 12.0.0-alpha.1 → 12.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/core.d.ts +1 -4
- package/dist/core.esm-browser.js +2462 -3041
- package/dist/core.esm-browser.prod.js +1498 -6
- package/dist/core.esm-bundler.js +1 -1
- package/dist/core.global.js +2741 -3317
- package/dist/core.global.prod.js +1520 -6
- package/dist/core.js +5 -30
- package/dist/core.node.js +5 -30
- package/dist/core.runtime.esm-browser.js +1530 -1845
- package/dist/core.runtime.esm-browser.prod.js +914 -6
- package/dist/core.runtime.esm-bundler.js +1 -1
- package/dist/core.runtime.global.js +1784 -2096
- package/dist/core.runtime.global.prod.js +917 -6
- package/dist/core.runtime.js +14 -28
- package/dist/core.runtime.node.js +14 -28
- package/package.json +40 -39
package/dist/core.global.prod.js
CHANGED
|
@@ -1,6 +1,1520 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),o=e=>"number"==typeof e&&isFinite(e),a=e=>"[object Date]"===k(e),c=e=>"[object RegExp]"===k(e),s=e=>C(e)&&0===Object.keys(e).length,l=Object.assign,u=Object.create,i=(e=null)=>u(e);function f(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const E=Object.prototype.hasOwnProperty;function m(e,t){return E.call(e,t)}const _=Array.isArray,d=e=>"function"==typeof e,p=e=>"string"==typeof e,N=e=>"boolean"==typeof e,L=e=>null!==e&&"object"==typeof e,T=e=>L(e)&&d(e.then)&&d(e.catch),A=Object.prototype.toString,k=e=>A.call(e),C=e=>"[object Object]"===k(e);function g(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}function h(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const O=e=>!L(e)||_(e);function y(e,t,n){return{start:e,end:t}}const b={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};function I(e,t,n={}){const{domain:r,messages:o,args:a}=n,c=new SyntaxError(String(e));return c.code=e,t&&(c.location=t),c.domain=r,c}function S(e){throw e}function P(e){switch(e.t=e.type,e.type){case 0:{const t=e;P(t.body),t.b=t.body,delete t.body;break}case 1:{const t=e,n=t.cases;for(let e=0;e<n.length;e++)P(n[e]);t.c=n,delete t.cases;break}case 2:{const t=e,n=t.items;for(let e=0;e<n.length;e++)P(n[e]);t.i=n,delete t.items,t.static&&(t.s=t.static,delete t.static);break}case 3:case 9:case 8:case 7:{const t=e;t.value&&(t.v=t.value,delete t.value);break}case 6:{const t=e;P(t.key),t.k=t.key,delete t.key,t.modifier&&(P(t.modifier),t.m=t.modifier,delete t.modifier);break}case 5:{const t=e;t.i=t.index,delete t.index;break}case 4:{const t=e;t.k=t.key,delete t.key;break}}delete e.type}function D(e){if(1===e.items.length){const t=e.items[0];3!==t.type&&9!==t.type||(e.static=t.value,delete t.value)}else{const t=[];for(let n=0;n<e.items.length;n++){const r=e.items[n];if(3!==r.type&&9!==r.type)break;if(null==r.value)break;t.push(r.value)}if(t.length===e.items.length){e.static=g(t);for(let t=0;t<e.items.length;t++){const n=e.items[t];3!==n.type&&9!==n.type||delete n.value}}}}const R=" ",v="\r",M="\n",F=String.fromCharCode(8232),x=String.fromCharCode(8233);function U(e){const t=e;let n=0,r=1,o=1,a=0;const c=e=>t[e]===v&&t[e+1]===M,s=e=>t[e]===x,l=e=>t[e]===F,u=e=>c(e)||(e=>t[e]===M)(e)||s(e)||l(e),i=e=>c(e)||s(e)||l(e)?M:t[e];function f(){return a=0,u(n)&&(r++,o=0),c(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>a,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+a),next:f,peek:function(){return c(n+a)&&a++,a++,t[n+a]},reset:function(){n=0,r=1,o=1,a=0},resetPeek:function(e=0){a=e},skipToPeek:function(){const e=n+a;for(;e!==n;)f();a=0}}}const w=void 0,W="'";function X(e,t={}){const n=!1!==t.location,r=U(e),o=()=>r.index(),a=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},c=a(),s=o(),l={currentType:13,offset:s,startLoc:c,endLoc:c,lastType:13,lastOffset:s,lastStartLoc:c,lastEndLoc:c,braceNest:0,inLinked:!1,text:""},u=()=>l,{onError:i}=t;function f(e,t,r){e.endLoc=a(),e.currentType=t;const o={type:t};return n&&(o.loc=y(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const E=e=>f(e,13);function m(e,t){return e.currentChar()===t?(e.next(),t):(b.EXPECTED_TOKEN,a(),"")}function _(e){let t="";for(;e.currentPeek()===R||e.currentPeek()===M;)t+=e.currentPeek(),e.peek();return t}function d(e){const t=_(e);return e.skipToPeek(),t}function p(e){if(e===w)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function N(e,t){const{currentType:n}=t;if(2!==n)return!1;_(e);const r=function(e){if(e===w)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function L(e){_(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function T(e,t=!0){const n=(t=!1,r="")=>{const o=e.currentPeek();return"{"===o?t:"@"!==o&&o?"|"===o?!(r===R||r===M):o===R?(e.peek(),n(!0,R)):o!==M||(e.peek(),n(!0,M)):t},r=n();return t&&e.resetPeek(),r}function A(e,t){const n=e.currentChar();return n===w?w:t(n)?(e.next(),n):null}function k(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 A(e,k)}function g(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t||45===t}function h(e){return A(e,g)}function O(e){const t=e.charCodeAt(0);return t>=48&&t<=57}function I(e){return A(e,O)}function S(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function P(e){return A(e,S)}function D(e){let t="",n="";for(;t=I(e);)n+=t;return n}function v(e){return e!==W&&e!==M}function F(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return x(e,t,4);case"U":return x(e,t,6);default:return b.UNKNOWN_ESCAPE_SEQUENCE,a(),""}}function x(e,t,n){m(e,t);let r="";for(let o=0;o<n;o++){const t=P(e);if(!t){b.INVALID_UNICODE_ESCAPE_SEQUENCE,a(),e.currentChar();break}r+=t}return`\\${t}${r}`}function X(e){return"{"!==e&&"}"!==e&&e!==R&&e!==M}function K(e){d(e);const t=m(e,"|");return d(e),t}function Y(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(b.NOT_ALLOW_NEST_PLACEHOLDER,a()),e.next(),n=f(t,2,"{"),d(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&(b.EMPTY_PLACEHOLDER,a()),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&d(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&(b.UNTERMINATED_CLOSING_BRACE,a()),n=G(e,t)||E(t),t.braceNest=0,n;default:{let r=!0,o=!0,c=!0;if(L(e))return t.braceNest>0&&(b.UNTERMINATED_CLOSING_BRACE,a()),n=f(t,1,K(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(4===t.currentType||5===t.currentType||6===t.currentType))return b.UNTERMINATED_CLOSING_BRACE,a(),t.braceNest=0,V(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;_(e);const r=p(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,4,function(e){d(e);let t="",n="";for(;t=h(e);)n+=t;return e.currentChar()===w&&(b.UNTERMINATED_CLOSING_BRACE,a()),n}(e)),d(e),n;if(o=N(e,t))return n=f(t,5,function(e){d(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${D(e)}`):t+=D(e),e.currentChar()===w&&(b.UNTERMINATED_CLOSING_BRACE,a()),t}(e)),d(e),n;if(c=function(e,t){const{currentType:n}=t;if(2!==n)return!1;_(e);const r=e.currentPeek()===W;return e.resetPeek(),r}(e,t))return n=f(t,6,function(e){d(e),m(e,"'");let t="",n="";for(;t=A(e,v);)n+="\\"===t?F(e):t;const r=e.currentChar();return r===M||r===w?(b.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,a(),r===M&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),d(e),n;if(!r&&!o&&!c)return n=f(t,12,function(e){d(e);let t="",n="";for(;t=A(e,X);)n+=t;return n}(e)),b.INVALID_TOKEN_IN_PLACEHOLDER,a(),n.value,d(e),n;break}}return n}function G(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(7!==n&&8!==n&&11!==n&&9!==n||o!==M&&o!==R||(b.INVALID_LINKED_FORMAT,a()),o){case"@":return e.next(),r=f(t,7,"@"),t.inLinked=!0,r;case".":return d(e),e.next(),f(t,8,".");case":":return d(e),e.next(),f(t,9,":");default:return L(e)?(r=f(t,1,K(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(7!==n)return!1;_(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(7!==n&&11!==n)return!1;_(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(d(e),G(e,t)):function(e,t){const{currentType:n}=t;if(8!==n)return!1;_(e);const r=p(e.currentPeek());return e.resetPeek(),r}(e,t)?(d(e),f(t,11,function(e){let t="",n="";for(;t=C(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(9!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?p(e.peek()):!("@"===t||"|"===t||":"===t||"."===t||t===R||!t)&&(t===M?(e.peek(),r()):T(e,!1))},o=r();return e.resetPeek(),o}(e,t)?(d(e),"{"===o?Y(e,t)||r:f(t,10,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"@"!==r&&"|"!==r&&"("!==r&&")"!==r&&r?r===R?n:(n+=r,e.next(),t(n)):n};return t("")}(e))):(7===n&&(b.INVALID_LINKED_FORMAT,a()),t.braceNest=0,t.inLinked=!1,V(e,t))}}function V(e,t){let n={type:13};if(t.braceNest>0)return Y(e,t)||E(t);if(t.inLinked)return G(e,t)||E(t);switch(e.currentChar()){case"{":return Y(e,t)||E(t);case"}":return b.UNBALANCED_CLOSING_BRACE,a(),e.next(),f(t,3,"}");case"@":return G(e,t)||E(t);default:if(L(e))return n=f(t,1,K(e)),t.braceNest=0,t.inLinked=!1,n;if(T(e))return f(t,0,function(e){let t="";for(;;){const n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if(n===R||n===M)if(T(e))t+=n,e.next();else{if(L(e))break;t+=n,e.next()}else t+=n,e.next()}return t}(e))}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:c}=l;return l.lastType=e,l.lastOffset=t,l.lastStartLoc=n,l.lastEndLoc=c,l.offset=o(),l.startLoc=a(),r.currentChar()===w?f(l,13):V(r,l)},currentOffset:o,currentPosition:a,context:u}}const K=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function Y(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 G(e={}){const t=!1!==e.location,{onError:n}=e;function r(e,n,r){const o={type:e};return t&&(o.start=n,o.end=n,o.loc={start:r,end:r}),o}function o(e,n,r,o){t&&(e.end=n,e.loc&&(e.loc.end=r))}function a(e,t){const n=e.context(),a=r(3,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}function c(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:c}=n,s=r(5,a,c);return s.index=parseInt(t,10),e.nextToken(),o(s,e.currentOffset(),e.currentPosition()),s}function s(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:c}=n,s=r(4,a,c);return s.key=t,e.nextToken(),o(s,e.currentOffset(),e.currentPosition()),s}function u(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:c}=n,s=r(9,a,c);return s.value=t.replace(K,Y),e.nextToken(),o(s,e.currentOffset(),e.currentPosition()),s}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let a=e.nextToken();if(8===a.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:a,lastStartLoc:c}=n,s=r(8,a,c);return 11!==t.type?(b.UNEXPECTED_EMPTY_LINKED_MODIFIER,n.lastStartLoc,s.value="",o(s,a,c),{nextConsumeToken:t,node:s}):(null==t.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,V(t)),s.value=t.value||"",o(s,e.currentOffset(),e.currentPosition()),{node:s})}(e);n.modifier=t.node,a=t.nextConsumeToken||e.nextToken()}switch(9!==a.type&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(a)),a=e.nextToken(),2===a.type&&(a=e.nextToken()),a.type){case 10:null==a.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(a)),n.key=function(e,t){const n=e.context(),a=r(7,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}(e,a.value||"");break;case 4:null==a.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(a)),n.key=s(e,a.value||"");break;case 5:null==a.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(a)),n.key=c(e,a.value||"");break;case 6:null==a.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(a)),n.key=u(e,a.value||"");break;default:{b.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const c=e.context(),s=r(7,c.offset,c.startLoc);return s.value="",o(s,c.offset,c.startLoc),n.key=s,o(n,c.offset,c.startLoc),{nextConsumeToken:a,node:n}}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let l=null;do{const r=l||e.nextToken();switch(l=null,r.type){case 0:null==r.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(r)),n.items.push(a(e,r.value||""));break;case 5:null==r.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(r)),n.items.push(c(e,r.value||""));break;case 4:null==r.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(r)),n.items.push(s(e,r.value||""));break;case 6:null==r.value&&(b.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,V(r)),n.items.push(u(e,r.value||""));break;case 7:{const t=i(e);n.items.push(t.node),l=t.nextConsumeToken||null;break}}}while(13!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function E(e){const t=e.context(),{offset:n,startLoc:a}=t,c=f(e);return 13===t.currentType?c:function(e,t,n,a){const c=e.context();let s=0===a.items.length;const l=r(1,t,n);l.cases=[],l.cases.push(a);do{const t=f(e);s||(s=0===t.items.length),l.cases.push(t)}while(13!==c.currentType);return o(l,e.currentOffset(),e.currentPosition()),l}(e,n,a,c)}return{parse:function(n){const a=X(n,l({},e)),c=a.context(),s=r(0,c.offset,c.startLoc);return t&&s.loc&&(s.loc.source=n),s.body=E(a),e.onCacheKey&&(s.cacheKey=e.onCacheKey(n)),13!==c.currentType&&(b.UNEXPECTED_LEXICAL_ANALYSIS,c.lastStartLoc,n[c.offset]),o(s,a.currentOffset(),a.currentPosition()),s}}}function V(e){if(13===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function $(e){return t=>function(e,t){const n=(r=t,oe(r,B));var r;if(null==n)throw ae(0);if(1===q(n)){const t=function(e){return oe(e,H,[])}(n);return e.plural(t.reduce(((t,n)=>[...t,j(e,n)]),[]))}return j(e,n)}(t,e)}const B=["b","body"];const H=["c","cases"];function j(e,t){const n=function(e){return oe(e,z)}(t);if(null!=n)return"text"===e.type?n:e.normalize([n]);{const n=function(e){return oe(e,Q,[])}(t).reduce(((t,n)=>[...t,J(e,n)]),[]);return e.normalize(n)}}const z=["s","static"];const Q=["i","items"];function J(e,t){const n=q(t);switch(n){case 3:case 9:case 7:case 8:return te(t,n);case 4:{const r=t;if(m(r,"k")&&r.k)return e.interpolate(e.named(r.k));if(m(r,"key")&&r.key)return e.interpolate(e.named(r.key));throw ae(n)}case 5:{const r=t;if(m(r,"i")&&o(r.i))return e.interpolate(e.list(r.i));if(m(r,"index")&&o(r.index))return e.interpolate(e.list(r.index));throw ae(n)}case 6:{const n=t,r=function(e){return oe(e,ne)}(n),o=function(e){const t=oe(e,re);if(t)return t;throw ae(6)}(n);return e.linked(J(e,o),r?J(e,r):void 0,e.type)}default:throw new Error(`unhandled node on format message part: ${n}`)}}const Z=["t","type"];function q(e){return oe(e,Z)}const ee=["v","value"];function te(e,t){const n=oe(e,ee);if(null!=n)return n;throw ae(t)}const ne=["m","modifier"];const re=["k","key"];function oe(e,t,n){for(let r=0;r<t.length;r++){const n=t[r];if(m(e,n)&&null!=e[n])return e[n]}return n}function ae(e){return new Error(`unhandled node type: ${e}`)}const ce=e=>e;let se=i();function le(e){return L(e)&&0===q(e)&&(m(e,"b")||m(e,"body"))}function ue(e,t={}){let n=!1;const r=t.onError||S;t.onError=e=>{n=!0,r(e)};const o=G(t).parse(e);return t.optimize&&function(e){const t=e.body;2===t.type?D(t):t.cases.forEach((e=>D(e)))}(o),t.mangle&&P(o),{ast:o,detectError:n,code:""}}function ie(e,t){if(p(e)){!N(t.warnHtmlMessage)||t.warnHtmlMessage;const n=(t.onCacheKey||ce)(e),r=se[n];if(r)return r;const{ast:o,detectError:a}=ue(e,{...t,location:!1,mangle:!0,optimize:!0}),c=$(o);return a?c:se[n]=c}{const t=e.cacheKey;if(t){const n=se[t];return n||(se[t]=$(e))}return $(e)}}let fe=null;const Ee=me("function:translate");function me(e){return t=>fe&&fe.emit(e,t)}const _e={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function de(e,t){return null!=t.locale?Ne(t.locale):Ne(e.locale)}let pe;function Ne(e){if(p(e))return e;if(d(e)){if(e.resolvedOnce&&null!=pe)return pe;if("Function"===e.constructor.name){const t=e();if(T(t))throw Error(_e.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return pe=t}throw Error(_e.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(_e.NOT_SUPPORT_LOCALE_TYPE)}function Le(e,t,n){return[...new Set([n,..._(t)?t:L(t)?Object.keys(t):p(t)?[t]:[n]])]}function Te(e,t,n){const r=p(n)?n:Me,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let a=o.__localeChainCache.get(r);if(!a){a=[];let e=[n];for(;_(e);)e=Ae(a,e,t);const c=_(t)||!C(t)?t:t.default?t.default:null;e=p(c)?[c]:c,_(e)&&Ae(a,e,!1),o.__localeChainCache.set(r,a)}return a}function Ae(e,t,n){let r=!0;for(let o=0;o<t.length&&N(r);o++){const a=t[o];p(a)&&(r=ke(e,t[o],n))}return r}function ke(e,t,n){let r;const o=t.split("-");do{r=Ce(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function Ce(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),(_(n)||C(n))&&n[o]&&(r=n[o])}return r}const ge=[];ge[0]={w:[0],i:[3,0],"[":[4],o:[7]},ge[1]={w:[1],".":[2],"[":[4],o:[7]},ge[2]={w:[2],i:[3,0],0:[3,0]},ge[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},ge[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},ge[5]={"'":[4,0],o:8,l:[5,0]},ge[6]={'"':[4,0],o:8,l:[6,0]};const he=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Oe(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 ye(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,he.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function be(e){const t=[];let n,r,o,a,c,s,l,u=-1,i=0,f=0;const E=[];function m(){const t=e[u+1];if(5===i&&"'"===t||6===i&&'"'===t)return u++,o="\\"+t,E[0](),!0}for(E[0]=()=>{void 0===r?r=o:r+=o},E[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},E[2]=()=>{E[0](),f++},E[3]=()=>{if(f>0)f--,i=4,E[0]();else{if(f=0,void 0===r)return!1;if(r=ye(r),!1===r)return!1;E[1]()}};null!==i;)if(u++,n=e[u],"\\"!==n||!m()){if(a=Oe(n),l=ge[i],c=l[a]||l.l||8,8===c)return;if(i=c[0],void 0!==c[1]&&(s=E[c[1]],s&&(o=n,!1===s())))return;if(7===i)return t}}const Ie=new Map;function Se(e,t){return L(e)?e[t]:null}function Pe(e,t){if(!L(e))return null;let n=Ie.get(t);if(n||(n=be(t),n&&Ie.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;if(d(o))return null;o=e,a++}return o}const De={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},Re={[De.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[De.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[De.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[De.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[De.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[De.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[De.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};const ve="12.0.0-alpha.1",Me="en-US",Fe=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let xe,Ue,we;function We(e){xe=e}function Xe(e){Ue=e}function Ke(e){we=e}let Ye=null;let Ge=null;let Ve=0;const $e=e=>({[e]:i()});function Be(e,t,n,r,o){const{missing:a,onWarn:c}=e;if(null!==a){const r=a(e,n,t,o);return p(r)?r:t}return t}function He(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function je(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(He(e,t[r]))return!0;return!1}const ze=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Qe(...e){const[t,n,r,c]=e,s=i();let l,u=i();if(p(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(_e.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();l=new Date(n);try{l.toISOString()}catch{throw Error(_e.INVALID_ISO_DATE_ARGUMENT)}}else if(a(t)){if(isNaN(t.getTime()))throw Error(_e.INVALID_DATE_ARGUMENT);l=t}else{if(!o(t))throw Error(_e.INVALID_ARGUMENT);l=t}return p(n)?s.key=n:C(n)&&Object.keys(n).forEach((e=>{ze.includes(e)?u[e]=n[e]:s[e]=n[e]})),p(r)?s.locale=r:C(r)&&(u=r),C(c)&&(u=c),[s.key||"",l,s,u]}const Je=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ze(...e){const[t,n,r,a]=e,c=i();let s=i();if(!o(t))throw Error(_e.INVALID_ARGUMENT);const l=t;return p(n)?c.key=n:C(n)&&Object.keys(n).forEach((e=>{Je.includes(e)?s[e]=n[e]:c[e]=n[e]})),p(r)?c.locale=r:C(r)&&(s=r),C(a)&&(s=a),[c.key||"",l,c,s]}const qe=e=>e,et=e=>"",tt="text",nt=e=>0===e.length?"":g(e),rt=e=>null==e?"":_(e)||C(e)&&e.toString===A?JSON.stringify(e,null,2):String(e);function ot(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function at(e={}){const t=e.locale,n=function(e){const t=o(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(o(e.named.count)||o(e.named.n))?o(e.named.count)?e.named.count:o(e.named.n)?e.named.n:t:t}(e),r=L(e.pluralRules)&&p(t)&&d(e.pluralRules[t])?e.pluralRules[t]:ot,a=L(e.pluralRules)&&p(t)&&d(e.pluralRules[t])?ot:void 0,c=e.list||[],s=e.named||i();o(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function u(t,n){const r=d(e.messages)?e.messages(t,!!n):!!L(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):et)}const f=C(e.processor)&&d(e.processor.normalize)?e.processor.normalize:nt,E=C(e.processor)&&d(e.processor.interpolate)?e.processor.interpolate:rt,m={list:e=>c[e],named:e=>s[e],plural:e=>e[r(n,e.length,a)],linked:(t,...n)=>{const[r,o]=n;let a="text",c="";1===n.length?L(r)?(c=r.modifier||c,a=r.type||a):p(r)&&(c=r||c):2===n.length&&(p(r)&&(c=r||c),p(o)&&(a=o||a));const s=u(t,!0)(m),l="vnode"===a&&_(s)&&c?s[0]:s;return c?(i=c,e.modifiers?e.modifiers[i]:qe)(l,a):l;var i},message:u,type:C(e.processor)&&p(e.processor.type)?e.processor.type:tt,interpolate:E,normalize:f,values:l(i(),c,s)};return m}const ct=()=>"",st=e=>d(e);function lt(e,t,n,r,o,a){const{messages:c,onWarn:s,messageResolver:l,localeFallbacker:u}=e,f=u(e,r,n);let E,m=i(),_=null;for(let d=0;d<f.length&&(E=f[d],m=c[E]||i(),null===(_=l(m,t))&&(_=m[t]),!(p(_)||le(_)||st(_)));d++)if(!je(E,f)){const n=Be(e,t,E,0,"translate");n!==t&&(_=n)}return[_,E,m]}function ut(e,t,r,o,a,c){const{messageCompiler:s,warnHtmlMessage:l}=e;if(st(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==s){const e=()=>o;return e.locale=r,e.key=t,e}const u=s(o,function(e,t,r,o,a,c){return{locale:t,key:r,warnHtmlMessage:a,onError:e=>{throw c&&c(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,a,0,l,c));return u.locale=r,u.key=t,u.source=o,u}function it(...e){const[t,n,r]=e,a=i();if(!(p(t)||o(t)||st(t)||le(t)))throw Error(_e.INVALID_ARGUMENT);const c=o(t)?String(t):(st(t),t);return o(n)?a.plural=n:p(n)?a.default=n:C(n)&&!s(n)?a.named=n:_(n)&&(a.list=n),o(r)?a.plural=r:p(r)?a.default=r:C(r)&&l(a,r),[c,a]}return We(ie),Xe(Pe),Ke(Te),e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=8,e.CoreWarnCodes=De,e.DATETIME_FORMAT_OPTIONS_KEYS=ze,e.DEFAULT_LOCALE=Me,e.DEFAULT_MESSAGE_DATA_TYPE=tt,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=Je,e.VERSION=ve,e.clearCompileCache=function(){se=i()},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compile=ie,e.createCompileError=I,e.createCoreContext=function(e={}){const t=d(e.onWarn)?e.onWarn:h,n=p(e.version)?e.version:ve,r=p(e.locale)||d(e.locale)?e.locale:Me,o=d(r)?Me:r,a=_(e.fallbackLocale)||C(e.fallbackLocale)||p(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:o,s=C(e.messages)?e.messages:$e(o),u=C(e.datetimeFormats)?e.datetimeFormats:$e(o),f=C(e.numberFormats)?e.numberFormats:$e(o),E=l(i(),e.modifiers,{upper:(e,t)=>"text"===t&&p(e)?e.toUpperCase():"vnode"===t&&L(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&p(e)?e.toLowerCase():"vnode"===t&&L(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&p(e)?Fe(e):"vnode"===t&&L(e)&&"__v_isVNode"in e?Fe(e.children):e}),m=e.pluralRules||i(),T=d(e.missing)?e.missing:null,A=!N(e.missingWarn)&&!c(e.missingWarn)||e.missingWarn,k=!N(e.fallbackWarn)&&!c(e.fallbackWarn)||e.fallbackWarn,g=!!e.fallbackFormat,O=!!e.unresolving,y=d(e.postTranslation)?e.postTranslation:null,b=C(e.processor)?e.processor:null,I=!N(e.warnHtmlMessage)||e.warnHtmlMessage,S=!!e.escapeParameter,P=d(e.messageCompiler)?e.messageCompiler:xe,D=d(e.messageResolver)?e.messageResolver:Ue||Se,R=d(e.localeFallbacker)?e.localeFallbacker:we||Le,v=L(e.fallbackContext)?e.fallbackContext:void 0,M=e,F=L(M.__datetimeFormatters)?M.__datetimeFormatters:new Map,x=L(M.__numberFormatters)?M.__numberFormatters:new Map,U=L(M.__meta)?M.__meta:{};Ve++;const w={version:n,cid:Ve,locale:r,fallbackLocale:a,messages:s,modifiers:E,pluralRules:m,missing:T,missingWarn:A,fallbackWarn:k,fallbackFormat:g,unresolving:O,postTranslation:y,processor:b,warnHtmlMessage:I,escapeParameter:S,messageCompiler:P,messageResolver:D,localeFallbacker:R,fallbackContext:v,onWarn:t,__meta:U};return w.datetimeFormats=u,w.numberFormats=f,w.__datetimeFormatters=F,w.__numberFormatters=x,w},e.createCoreError=function(e){return I(e,null,void 0)},e.createMessageContext=at,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:a,localeFallbacker:c}=e,{__datetimeFormatters:u}=e,[i,f,E,m]=Qe(...t);N(E.missingWarn)?E.missingWarn:e.missingWarn,N(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const _=!!E.part,d=de(e,E),L=c(e,o,d);if(!p(i)||""===i)return new Intl.DateTimeFormat(d,m).format(f);let T,A={},k=null;for(let s=0;s<L.length&&(T=L[s],A=n[T]||{},k=A[i],!C(k));s++)Be(e,i,T,0,"datetime format");if(!C(k)||!p(T))return r?-1:i;let g=`${T}__${i}`;s(m)||(g=`${g}__${JSON.stringify(m)}`);let h=u.get(g);return h||(h=new Intl.DateTimeFormat(T,l({},k,m)),u.set(g,h)),_?h.formatToParts(f):h.format(f)},e.fallbackWithLocaleChain=Te,e.fallbackWithSimple=Le,e.getAdditionalMeta=()=>Ye,e.getDevToolsHook=function(){return fe},e.getFallbackContext=()=>Ge,e.getLocale=de,e.getLocaleMessage=function(e,t){const n=e.messages[t];if(null==n)return;const r=i();return function(e,t){if(O(e)||O(t))throw new Error("Invalid value");const n=[{src:e,des:t}];for(;n.length;){const{src:e,des:t}=n.pop();Object.keys(e).forEach((r=>{"__proto__"!==r&&(L(e[r])&&!L(t[r])&&(t[r]=Array.isArray(e[r])?[]:i()),O(t[r])||O(e[r])?t[r]=e[r]:n.push({src:e[r],des:t[r]}))}))}}(n,r),r},e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&L(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(Re[e],...n)},e.handleMissing=Be,e.initI18nDevTools=function(e,t,n){fe&&fe.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=He,e.isImplicitFallback=je,e.isMessageAST=le,e.isMessageFunction=st,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o,onWarn:a,localeFallbacker:c}=e,{__numberFormatters:u}=e,[i,f,E,m]=Ze(...t);N(E.missingWarn)?E.missingWarn:e.missingWarn,N(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const _=!!E.part,d=de(e,E),L=c(e,o,d);if(!p(i)||""===i)return new Intl.NumberFormat(d,m).format(f);let T,A={},k=null;for(let s=0;s<L.length&&(T=L[s],A=n[T]||{},k=A[i],!C(k));s++)Be(e,i,T,0,"number format");if(!C(k)||!p(T))return r?-1:i;let g=`${T}__${i}`;s(m)||(g=`${g}__${JSON.stringify(m)}`);let h=u.get(g);return h||(h=new Intl.NumberFormat(T,l({},k,m)),u.set(g,h)),_?h.formatToParts(f):h.format(f)},e.parse=be,e.parseDateTimeArgs=Qe,e.parseNumberArgs=Ze,e.parseTranslateArgs=it,e.registerLocaleFallbacker=Ke,e.registerMessageCompiler=We,e.registerMessageResolver=Xe,e.resolveLocale=Ne,e.resolveValue=Pe,e.resolveWithKeyValue=Se,e.setAdditionalMeta=e=>{Ye=e},e.setDevToolsHook=function(e){fe=e},e.setFallbackContext=e=>{Ge=e},e.setLocaleMessage=function(e,t,n){e.messages[t]=n},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:a,messageCompiler:c,fallbackLocale:s,messages:l}=e,[u,E]=it(...t),m=N(E.missingWarn)?E.missingWarn:e.missingWarn,T=N(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn,A=N(E.escapeParameter)?E.escapeParameter:e.escapeParameter,k=!!E.resolvedMessage,C=p(E.default)||N(E.default)?N(E.default)?c?u:()=>u:E.default:n?c?u:()=>u:null,g=n||null!=C&&(p(C)||d(C)),h=de(e,E);A&&function(e){_(e.list)?e.list=e.list.map((e=>p(e)?f(e):e)):L(e.named)&&Object.keys(e.named).forEach((t=>{p(e.named[t])&&(e.named[t]=f(e.named[t]))}))}(E);let[O,y,b]=k?[u,h,l[h]||i()]:lt(e,u,h,s,T,m),I=O,S=u;if(k||p(I)||le(I)||st(I)||g&&(I=C,S=I),!(k||(p(I)||le(I)||st(I))&&p(y)))return a?-1:u;let P=!1;const D=st(I)?I:ut(e,u,y,I,S,(()=>{P=!0}));if(P)return I;const R=function(e,t,n,r){const{modifiers:a,pluralRules:c,messageResolver:s,fallbackLocale:l,fallbackWarn:u,missingWarn:i,fallbackContext:f}=e,E=(r,o)=>{let a=s(n,r);if(null==a&&(f||o)){const[,,n]=lt(f||e,r,t,l,u,i);a=s(n,r)}if(p(a)||le(a)){let n=!1;const o=ut(e,r,t,a,r,(()=>{n=!0}));return n?ct:o}return st(a)?a:ct},m={locale:t,modifiers:a,pluralRules:c,messages:E};e.processor&&(m.processor=e.processor);r.list&&(m.list=r.list);r.named&&(m.named=r.named);o(r.plural)&&(m.pluralIndex=r.plural);return m}(e,y,b,E),v=function(e,t,n){const r=t(n);return r}(0,D,at(R));return r?r(v,u):v},e.translateDevTools=Ee,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({});
|
|
1
|
+
/**
|
|
2
|
+
* @intlify/core v12.0.0-alpha.11
|
|
3
|
+
* (c) 2016-present kazuya kawaguchi and contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/ var IntlifyCore = (function(e) {
|
|
6
|
+
Object.defineProperty(e, Symbol.toStringTag, { value: `Module` });
|
|
7
|
+
let t = /\{([0-9a-z]+)\}/gi;
|
|
8
|
+
function n(e, ...n) {
|
|
9
|
+
return n.length === 1 && b(n[0]) && (n = n[0]), n && n.hasOwnProperty || (n = {}), e.replace(t, (e, t) => n.hasOwnProperty(t) ? n[t] : ``);
|
|
10
|
+
}
|
|
11
|
+
let r = (e, t, n) => i({
|
|
12
|
+
l: e,
|
|
13
|
+
k: t,
|
|
14
|
+
s: n
|
|
15
|
+
}), i = (e) => JSON.stringify(e).replace(/\u2028/g, `\\u2028`).replace(/\u2029/g, `\\u2029`).replace(/\u0027/g, `\\u0027`), a = (e) => typeof e == `number` && isFinite(e), o = (e) => C(e) === `[object Date]`, s = (e) => C(e) === `[object RegExp]`, c = (e) => Object.keys(e).length === 0, l = Object.assign, u = Object.create, d = (e = null) => u(e), f = Object.prototype.hasOwnProperty;
|
|
16
|
+
function p(e, t) {
|
|
17
|
+
return f.call(e, t);
|
|
18
|
+
}
|
|
19
|
+
function m(e, t) {
|
|
20
|
+
let n = e[t];
|
|
21
|
+
return p(e, t) ? n : void 0;
|
|
22
|
+
}
|
|
23
|
+
function h(e) {
|
|
24
|
+
return p(Object.prototype, e);
|
|
25
|
+
}
|
|
26
|
+
let g = Array.isArray, _ = (e) => typeof e == `function`, v = (e) => typeof e == `string`, y = (e) => typeof e == `boolean`, b = (e) => typeof e == `object` && !!e, x = (e) => b(e) && _(e.then) && _(e.catch), S = Object.prototype.toString, C = (e) => S.call(e), w = (e) => C(e) === `[object Object]`, ee = (e) => e == null ? `` : g(e) || w(e) && e.toString === S ? JSON.stringify(e, null, 2) : String(e);
|
|
27
|
+
function T(e, t = ``) {
|
|
28
|
+
return e.reduce((e, n, r) => r === 0 ? e + n : e + t + n, ``);
|
|
29
|
+
}
|
|
30
|
+
function E(e, t) {
|
|
31
|
+
typeof console < `u` && (console.warn(`[intlify] ` + e), t && console.warn(t.stack));
|
|
32
|
+
}
|
|
33
|
+
function D(e) {
|
|
34
|
+
return e.replace(/&/g, `&`).replace(/</g, `<`).replace(/>/g, `>`).replace(/"/g, `"`).replace(/'/g, `'`).replace(/\//g, `/`).replace(/=/g, `=`);
|
|
35
|
+
}
|
|
36
|
+
function te(e) {
|
|
37
|
+
return e.replace(/&(?![a-z0-9#]{2,6};)/gi, `&`).replace(/"/g, `"`).replace(/'/g, `'`).replace(/</g, `<`).replace(/>/g, `>`);
|
|
38
|
+
}
|
|
39
|
+
let ne = /^javascript:/i, re = /^(?:href|xlink:href|src|action|formaction)$/i, O = /&#(?:x([0-9a-f]+)|(\d+));?/gi, ie = /&(?:Tab|NewLine);/g, ae = /:?/gi, oe = /[\u0000-\u0020\u007f-\u009f]/g, se = /^on\w/i, ce = /^srcdoc$/i, le = /^(?:base|animate|set|script|plaintext)$/i, ue = /^(?:iframe|noembed|noframes|noscript|style|textarea|title|xmp)$/i, k = /<(\/?)([a-z][^\t\n\f\r />]*)/iy, A = /([\t\n\f\r /]*)(?:(>)|([^\t\n\f\r />][^\t\n\f\r />=]*)(?:[\t\n\f\r ]*=[\t\n\f\r ]*(?:(["'])([\s\S]*?)(\4|$)|([^\t\n\f\r >]*)))?)/y, j = /<!--(?:>|->|[\s\S]*?--!?>)/y;
|
|
40
|
+
function de(e, t, n) {
|
|
41
|
+
let r = t || n;
|
|
42
|
+
if (!r) return e;
|
|
43
|
+
let i = Number.parseInt(r, t ? 16 : 10);
|
|
44
|
+
return i <= 127 ? String.fromCharCode(i) : e;
|
|
45
|
+
}
|
|
46
|
+
function M(e) {
|
|
47
|
+
let t = e.replace(O, de).replace(ie, ``).replace(ae, `:`).replace(oe, ``);
|
|
48
|
+
return ne.test(t);
|
|
49
|
+
}
|
|
50
|
+
function fe(e) {
|
|
51
|
+
let t = /url\s*\(/gi, n = ``, r = 0, i;
|
|
52
|
+
for (; (i = t.exec(e)) !== null;) {
|
|
53
|
+
let a = i.index, o = t.lastIndex - 1, s = o + 1, c = 1, l = null;
|
|
54
|
+
for (; s < e.length; s++) {
|
|
55
|
+
let t = e[s];
|
|
56
|
+
if (l) t === l && (l = null);
|
|
57
|
+
else if (t === `"` || t === `'`) l = t;
|
|
58
|
+
else if (t === `(`) c++;
|
|
59
|
+
else if (t === `)` && (c--, c === 0)) break;
|
|
60
|
+
}
|
|
61
|
+
if (c !== 0) break;
|
|
62
|
+
let u = e.slice(o + 1, s).trim(), d = u.startsWith(`"`) && u.endsWith(`"`) || u.startsWith(`'`) && u.endsWith(`'`) ? u.slice(1, -1).trim() : u;
|
|
63
|
+
n += e.slice(r, a), n += M(d) ? `url(about:blank)` : e.slice(a, s + 1), r = s + 1;
|
|
64
|
+
}
|
|
65
|
+
return n + e.slice(r);
|
|
66
|
+
}
|
|
67
|
+
function pe(e, t) {
|
|
68
|
+
return re.test(e) && M(t) ? `about:blank` : te(e.toLowerCase() === `style` ? fe(t) : t);
|
|
69
|
+
}
|
|
70
|
+
function N(e) {
|
|
71
|
+
return e.replace(/</g, `<`);
|
|
72
|
+
}
|
|
73
|
+
function me(e, t, n, r) {
|
|
74
|
+
let i = e;
|
|
75
|
+
if (se.test(e) ? (r.eventHandler = !0, i = `on${e.slice(2)}`) : ce.test(e) && (r.srcdoc = !0, i = `s${e.slice(1)}`), t === void 0) return i;
|
|
76
|
+
let a = n || ``;
|
|
77
|
+
return `${i}=${a}${pe(e, t)}${a}`;
|
|
78
|
+
}
|
|
79
|
+
function he(e, t, n) {
|
|
80
|
+
k.lastIndex = t;
|
|
81
|
+
let r = k.exec(e);
|
|
82
|
+
if (!r) return;
|
|
83
|
+
let [, i, a] = r, o = r[0], s;
|
|
84
|
+
for (A.lastIndex = k.lastIndex; s = A.exec(e);) {
|
|
85
|
+
let [r, c, l, u, d, f, p, m] = s;
|
|
86
|
+
if (l) {
|
|
87
|
+
let n = A.lastIndex;
|
|
88
|
+
return [
|
|
89
|
+
i ? e.slice(t, n) : o + r,
|
|
90
|
+
a,
|
|
91
|
+
n
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
if (d && !p) break;
|
|
95
|
+
i || (o += c + me(u, d ? f : m, d, n));
|
|
96
|
+
}
|
|
97
|
+
return [
|
|
98
|
+
o,
|
|
99
|
+
a,
|
|
100
|
+
-1
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
function P(e, t, n) {
|
|
104
|
+
for (let r = e.indexOf(`</`, t); r !== -1; r = e.indexOf(`</`, r + 2)) {
|
|
105
|
+
let t = he(e, r, {});
|
|
106
|
+
if (t && t[1].toLowerCase() === n.toLowerCase()) return t[2] === -1 ? -1 : r;
|
|
107
|
+
}
|
|
108
|
+
return -1;
|
|
109
|
+
}
|
|
110
|
+
function F(e) {
|
|
111
|
+
let t = {}, n = ``, r = 0, i;
|
|
112
|
+
for (; (i = e.indexOf(`<`, r)) !== -1;) {
|
|
113
|
+
n += e.slice(r, i), r = i + 1;
|
|
114
|
+
let a = he(e, i, t);
|
|
115
|
+
if (a) {
|
|
116
|
+
let [o, s, c] = a;
|
|
117
|
+
if (c === -1) {
|
|
118
|
+
t.unclosed = !0, n += N(e.slice(i)), r = e.length;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
if (r = c, o[1] === `/`) n += o;
|
|
122
|
+
else if (le.test(s)) t.element = !0, n += N(o);
|
|
123
|
+
else if (ue.test(s)) {
|
|
124
|
+
let i = P(e, c, s);
|
|
125
|
+
i === -1 ? (t.unclosed = !0, n += N(o)) : (n += o + N(e.slice(c, i)), r = i);
|
|
126
|
+
} else n += o;
|
|
127
|
+
} else j.lastIndex = i, j.test(e) ? (n += e.slice(i, j.lastIndex), r = j.lastIndex) : (e.startsWith(`<!--`, i) && (t.unclosed = !0), n += `<`);
|
|
128
|
+
}
|
|
129
|
+
return n += e.slice(r), n;
|
|
130
|
+
}
|
|
131
|
+
let I = (e) => !b(e) || g(e);
|
|
132
|
+
function L(e, t) {
|
|
133
|
+
if (I(e) || I(t) || t === Object.prototype) throw Error(`Invalid value`);
|
|
134
|
+
let n = [e, t];
|
|
135
|
+
for (; n.length;) {
|
|
136
|
+
let e = n.pop(), t = n.pop(), r = Object.keys(t);
|
|
137
|
+
for (let i = 0; i < r.length; i++) {
|
|
138
|
+
let a = r[i];
|
|
139
|
+
if (a === `__proto__`) continue;
|
|
140
|
+
let o = t[a];
|
|
141
|
+
if (!b(o)) {
|
|
142
|
+
e[a] = o;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (g(o)) {
|
|
146
|
+
let t = [];
|
|
147
|
+
t.length = o.length, e[a] = t, n.push(o, t);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
let s = e[a];
|
|
151
|
+
(!b(s) || g(s)) && (s = e[a] = d()), n.push(o, s);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function ge(e, t, n) {
|
|
156
|
+
return {
|
|
157
|
+
line: e,
|
|
158
|
+
column: t,
|
|
159
|
+
offset: n
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function _e(e, t, n) {
|
|
163
|
+
let r = {
|
|
164
|
+
start: e,
|
|
165
|
+
end: t
|
|
166
|
+
};
|
|
167
|
+
return n != null && (r.source = n), r;
|
|
168
|
+
}
|
|
169
|
+
let R = {
|
|
170
|
+
EXPECTED_TOKEN: 1,
|
|
171
|
+
INVALID_TOKEN_IN_PLACEHOLDER: 2,
|
|
172
|
+
UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3,
|
|
173
|
+
UNKNOWN_ESCAPE_SEQUENCE: 4,
|
|
174
|
+
INVALID_UNICODE_ESCAPE_SEQUENCE: 5,
|
|
175
|
+
UNBALANCED_CLOSING_BRACE: 6,
|
|
176
|
+
UNTERMINATED_CLOSING_BRACE: 7,
|
|
177
|
+
EMPTY_PLACEHOLDER: 8,
|
|
178
|
+
NOT_ALLOW_NEST_PLACEHOLDER: 9,
|
|
179
|
+
INVALID_LINKED_FORMAT: 10,
|
|
180
|
+
MUST_HAVE_MESSAGES_IN_PLURAL: 11,
|
|
181
|
+
UNEXPECTED_EMPTY_LINKED_MODIFIER: 12,
|
|
182
|
+
UNEXPECTED_EMPTY_LINKED_KEY: 13,
|
|
183
|
+
UNEXPECTED_LEXICAL_ANALYSIS: 14,
|
|
184
|
+
UNHANDLED_CODEGEN_NODE_TYPE: 15,
|
|
185
|
+
UNHANDLED_MINIFIER_NODE_TYPE: 16
|
|
186
|
+
};
|
|
187
|
+
R.EXPECTED_TOKEN, R.INVALID_TOKEN_IN_PLACEHOLDER, R.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, R.UNKNOWN_ESCAPE_SEQUENCE, R.INVALID_UNICODE_ESCAPE_SEQUENCE, R.UNBALANCED_CLOSING_BRACE, R.UNTERMINATED_CLOSING_BRACE, R.EMPTY_PLACEHOLDER, R.NOT_ALLOW_NEST_PLACEHOLDER, R.INVALID_LINKED_FORMAT, R.MUST_HAVE_MESSAGES_IN_PLURAL, R.UNEXPECTED_EMPTY_LINKED_MODIFIER, R.UNEXPECTED_EMPTY_LINKED_KEY, R.UNEXPECTED_LEXICAL_ANALYSIS, R.UNHANDLED_CODEGEN_NODE_TYPE, R.UNHANDLED_MINIFIER_NODE_TYPE;
|
|
188
|
+
function z(e, t, n = {}) {
|
|
189
|
+
let { domain: r, messages: i, args: a } = n, o = SyntaxError(String(e));
|
|
190
|
+
return o.code = e, t && (o.location = t), o.domain = r, o;
|
|
191
|
+
}
|
|
192
|
+
function ve(e) {
|
|
193
|
+
throw e;
|
|
194
|
+
}
|
|
195
|
+
function B(e) {
|
|
196
|
+
switch (e.t = e.type, e.type) {
|
|
197
|
+
case 0: {
|
|
198
|
+
let t = e;
|
|
199
|
+
B(t.body), t.b = t.body, delete t.body;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case 1: {
|
|
203
|
+
let t = e, n = t.cases;
|
|
204
|
+
for (let e = 0; e < n.length; e++) B(n[e]);
|
|
205
|
+
t.c = n, delete t.cases;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
case 2: {
|
|
209
|
+
let t = e, n = t.items;
|
|
210
|
+
for (let e = 0; e < n.length; e++) B(n[e]);
|
|
211
|
+
t.i = n, delete t.items, t.static && (t.s = t.static, delete t.static);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case 3:
|
|
215
|
+
case 9:
|
|
216
|
+
case 8:
|
|
217
|
+
case 7: {
|
|
218
|
+
let t = e;
|
|
219
|
+
t.value && (t.v = t.value, delete t.value);
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
case 6: {
|
|
223
|
+
let t = e;
|
|
224
|
+
B(t.key), t.k = t.key, delete t.key, t.modifier && (B(t.modifier), t.m = t.modifier, delete t.modifier);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case 5: {
|
|
228
|
+
let t = e;
|
|
229
|
+
t.i = t.index, delete t.index;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case 4: {
|
|
233
|
+
let t = e;
|
|
234
|
+
t.k = t.key, delete t.key;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
delete e.type;
|
|
239
|
+
}
|
|
240
|
+
function ye(e) {
|
|
241
|
+
let t = e.body;
|
|
242
|
+
return t.type === 2 ? be(t) : t.cases.forEach((e) => be(e)), e;
|
|
243
|
+
}
|
|
244
|
+
function be(e) {
|
|
245
|
+
if (e.items.length === 1) {
|
|
246
|
+
let t = e.items[0];
|
|
247
|
+
(t.type === 3 || t.type === 9) && (e.static = t.value, delete t.value);
|
|
248
|
+
} else {
|
|
249
|
+
let t = [];
|
|
250
|
+
for (let n = 0; n < e.items.length; n++) {
|
|
251
|
+
let r = e.items[n];
|
|
252
|
+
if (r.type !== 3 && r.type !== 9 || r.value == null) break;
|
|
253
|
+
t.push(r.value);
|
|
254
|
+
}
|
|
255
|
+
if (t.length === e.items.length) {
|
|
256
|
+
e.static = T(t);
|
|
257
|
+
for (let t = 0; t < e.items.length; t++) {
|
|
258
|
+
let n = e.items[t];
|
|
259
|
+
(n.type === 3 || n.type === 9) && delete n.value;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function xe(e) {
|
|
265
|
+
let t = e, n = 0, r = 1, i = 1, a = 0, o = (e) => t[e] === `\r` && t[e + 1] === `
|
|
266
|
+
`, s = (e) => t[e] === `
|
|
267
|
+
`, c = (e) => t[e] === `\u2029`, l = (e) => t[e] === `\u2028`, u = (e) => o(e) || s(e) || c(e) || l(e), d = () => n, f = () => r, p = () => i, m = () => a, h = (e) => o(e) || c(e) || l(e) ? `
|
|
268
|
+
` : t[e], g = () => h(n), _ = () => h(n + a);
|
|
269
|
+
function v() {
|
|
270
|
+
return a = 0, u(n) && (r++, i = 0), o(n) && n++, n++, i++, t[n];
|
|
271
|
+
}
|
|
272
|
+
function y() {
|
|
273
|
+
return o(n + a) && a++, a++, t[n + a];
|
|
274
|
+
}
|
|
275
|
+
function b() {
|
|
276
|
+
n = 0, r = 1, i = 1, a = 0;
|
|
277
|
+
}
|
|
278
|
+
function x(e = 0) {
|
|
279
|
+
a = e;
|
|
280
|
+
}
|
|
281
|
+
function S() {
|
|
282
|
+
let e = n + a;
|
|
283
|
+
for (; e !== n;) v();
|
|
284
|
+
a = 0;
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
index: d,
|
|
288
|
+
line: f,
|
|
289
|
+
column: p,
|
|
290
|
+
peekOffset: m,
|
|
291
|
+
charAt: h,
|
|
292
|
+
currentChar: g,
|
|
293
|
+
currentPeek: _,
|
|
294
|
+
next: v,
|
|
295
|
+
peek: y,
|
|
296
|
+
reset: b,
|
|
297
|
+
resetPeek: x,
|
|
298
|
+
skipToPeek: S
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function Se(e, t = {}) {
|
|
302
|
+
let n = t.location !== !1, r = xe(e), i = () => r.index(), a = () => ge(r.line(), r.column(), r.index()), o = a(), s = i(), c = {
|
|
303
|
+
currentType: 13,
|
|
304
|
+
offset: s,
|
|
305
|
+
startLoc: o,
|
|
306
|
+
endLoc: o,
|
|
307
|
+
lastType: 13,
|
|
308
|
+
lastOffset: s,
|
|
309
|
+
lastStartLoc: o,
|
|
310
|
+
lastEndLoc: o,
|
|
311
|
+
braceNest: 0,
|
|
312
|
+
inLinked: !1,
|
|
313
|
+
text: ``
|
|
314
|
+
}, l = () => c, { onError: u } = t;
|
|
315
|
+
function d(e, t, r, ...i) {
|
|
316
|
+
let a = l();
|
|
317
|
+
if (t.column += r, t.offset += r, u) {
|
|
318
|
+
let r = z(e, n ? _e(a.startLoc, t) : null, {
|
|
319
|
+
domain: `tokenizer`,
|
|
320
|
+
args: i
|
|
321
|
+
});
|
|
322
|
+
u(r);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function f(e, t, r) {
|
|
326
|
+
e.endLoc = a(), e.currentType = t;
|
|
327
|
+
let i = { type: t };
|
|
328
|
+
return n && (i.loc = _e(e.startLoc, e.endLoc)), r != null && (i.value = r), i;
|
|
329
|
+
}
|
|
330
|
+
let p = (e) => f(e, 13);
|
|
331
|
+
function m(e, t) {
|
|
332
|
+
return e.currentChar() === t ? (e.next(), t) : (d(R.EXPECTED_TOKEN, a(), 0, t), ``);
|
|
333
|
+
}
|
|
334
|
+
function h(e) {
|
|
335
|
+
let t = ``;
|
|
336
|
+
for (; e.currentPeek() === ` ` || e.currentPeek() === `
|
|
337
|
+
`;) t += e.currentPeek(), e.peek();
|
|
338
|
+
return t;
|
|
339
|
+
}
|
|
340
|
+
function g(e) {
|
|
341
|
+
let t = h(e);
|
|
342
|
+
return e.skipToPeek(), t;
|
|
343
|
+
}
|
|
344
|
+
function _(e) {
|
|
345
|
+
if (e === void 0) return !1;
|
|
346
|
+
let t = e.charCodeAt(0);
|
|
347
|
+
return t >= 97 && t <= 122 || t >= 65 && t <= 90 || t === 95;
|
|
348
|
+
}
|
|
349
|
+
function v(e) {
|
|
350
|
+
if (e === void 0) return !1;
|
|
351
|
+
let t = e.charCodeAt(0);
|
|
352
|
+
return t >= 48 && t <= 57;
|
|
353
|
+
}
|
|
354
|
+
function y(e, t) {
|
|
355
|
+
let { currentType: n } = t;
|
|
356
|
+
if (n !== 2) return !1;
|
|
357
|
+
h(e);
|
|
358
|
+
let r = _(e.currentPeek());
|
|
359
|
+
return e.resetPeek(), r;
|
|
360
|
+
}
|
|
361
|
+
function b(e, t) {
|
|
362
|
+
let { currentType: n } = t;
|
|
363
|
+
if (n !== 2) return !1;
|
|
364
|
+
h(e);
|
|
365
|
+
let r = v(e.currentPeek() === `-` ? e.peek() : e.currentPeek());
|
|
366
|
+
return e.resetPeek(), r;
|
|
367
|
+
}
|
|
368
|
+
function x(e, t) {
|
|
369
|
+
let { currentType: n } = t;
|
|
370
|
+
if (n !== 2) return !1;
|
|
371
|
+
h(e);
|
|
372
|
+
let r = e.currentPeek() === `'`;
|
|
373
|
+
return e.resetPeek(), r;
|
|
374
|
+
}
|
|
375
|
+
function S(e, t) {
|
|
376
|
+
let { currentType: n } = t;
|
|
377
|
+
if (n !== 7) return !1;
|
|
378
|
+
h(e);
|
|
379
|
+
let r = e.currentPeek() === `.`;
|
|
380
|
+
return e.resetPeek(), r;
|
|
381
|
+
}
|
|
382
|
+
function C(e, t) {
|
|
383
|
+
let { currentType: n } = t;
|
|
384
|
+
if (n !== 8) return !1;
|
|
385
|
+
h(e);
|
|
386
|
+
let r = _(e.currentPeek());
|
|
387
|
+
return e.resetPeek(), r;
|
|
388
|
+
}
|
|
389
|
+
function w(e, t) {
|
|
390
|
+
let { currentType: n } = t;
|
|
391
|
+
if (n !== 7 && n !== 11) return !1;
|
|
392
|
+
h(e);
|
|
393
|
+
let r = e.currentPeek() === `:`;
|
|
394
|
+
return e.resetPeek(), r;
|
|
395
|
+
}
|
|
396
|
+
function ee(e, t) {
|
|
397
|
+
let { currentType: n } = t;
|
|
398
|
+
if (n !== 9) return !1;
|
|
399
|
+
let r = () => {
|
|
400
|
+
let t = e.currentPeek();
|
|
401
|
+
return t === `{` ? _(e.peek()) : t === `@` || t === `|` || t === `:` || t === `.` || t === ` ` || !t ? !1 : t === `
|
|
402
|
+
` ? (e.peek(), r()) : E(e, !1);
|
|
403
|
+
}, i = r();
|
|
404
|
+
return e.resetPeek(), i;
|
|
405
|
+
}
|
|
406
|
+
function T(e) {
|
|
407
|
+
h(e);
|
|
408
|
+
let t = e.currentPeek() === `|`;
|
|
409
|
+
return e.resetPeek(), t;
|
|
410
|
+
}
|
|
411
|
+
function E(e, t = !0) {
|
|
412
|
+
let n = (t = !1, r = ``) => {
|
|
413
|
+
let i = e.currentPeek();
|
|
414
|
+
return i === `{` || i === `@` || !i ? t : i === `|` ? r !== ` ` && r !== `
|
|
415
|
+
` : i === ` ` ? (e.peek(), n(!0, ` `)) : i !== `
|
|
416
|
+
` || (e.peek(), n(!0, `
|
|
417
|
+
`));
|
|
418
|
+
}, r = n();
|
|
419
|
+
return t && e.resetPeek(), r;
|
|
420
|
+
}
|
|
421
|
+
function D(e, t) {
|
|
422
|
+
let n = e.currentChar();
|
|
423
|
+
if (n !== void 0) return t(n) ? (e.next(), n) : null;
|
|
424
|
+
}
|
|
425
|
+
function te(e) {
|
|
426
|
+
let t = e.charCodeAt(0);
|
|
427
|
+
return t >= 97 && t <= 122 || t >= 65 && t <= 90 || t >= 48 && t <= 57 || t === 95 || t === 36;
|
|
428
|
+
}
|
|
429
|
+
function ne(e) {
|
|
430
|
+
return D(e, te);
|
|
431
|
+
}
|
|
432
|
+
function re(e) {
|
|
433
|
+
let t = e.charCodeAt(0);
|
|
434
|
+
return t >= 97 && t <= 122 || t >= 65 && t <= 90 || t >= 48 && t <= 57 || t === 95 || t === 36 || t === 45;
|
|
435
|
+
}
|
|
436
|
+
function O(e) {
|
|
437
|
+
return D(e, re);
|
|
438
|
+
}
|
|
439
|
+
function ie(e) {
|
|
440
|
+
let t = e.charCodeAt(0);
|
|
441
|
+
return t >= 48 && t <= 57;
|
|
442
|
+
}
|
|
443
|
+
function ae(e) {
|
|
444
|
+
return D(e, ie);
|
|
445
|
+
}
|
|
446
|
+
function oe(e) {
|
|
447
|
+
let t = e.charCodeAt(0);
|
|
448
|
+
return t >= 48 && t <= 57 || t >= 65 && t <= 70 || t >= 97 && t <= 102;
|
|
449
|
+
}
|
|
450
|
+
function se(e) {
|
|
451
|
+
return D(e, oe);
|
|
452
|
+
}
|
|
453
|
+
function ce(e) {
|
|
454
|
+
let t = ``, n = ``;
|
|
455
|
+
for (; t = ae(e);) n += t;
|
|
456
|
+
return n;
|
|
457
|
+
}
|
|
458
|
+
function le(e) {
|
|
459
|
+
let t = ``;
|
|
460
|
+
for (;;) {
|
|
461
|
+
let n = e.currentChar();
|
|
462
|
+
if (n === `\\`) {
|
|
463
|
+
let r = e.peek();
|
|
464
|
+
r === `{` || r === `}` || r === `@` || r === `|` || r === `\\` ? (t += n + r, e.next(), e.next()) : (e.resetPeek(), t += n, e.next());
|
|
465
|
+
} else if (n === `{` || n === `}` || n === `@` || n === `|` || !n) break;
|
|
466
|
+
else if (n === ` ` || n === `
|
|
467
|
+
`) {
|
|
468
|
+
if (E(e)) t += n, e.next();
|
|
469
|
+
else if (T(e)) break;
|
|
470
|
+
else t += n, e.next();
|
|
471
|
+
} else t += n, e.next();
|
|
472
|
+
}
|
|
473
|
+
return t;
|
|
474
|
+
}
|
|
475
|
+
function ue(e) {
|
|
476
|
+
g(e);
|
|
477
|
+
let t = ``, n = ``;
|
|
478
|
+
for (; t = O(e);) n += t;
|
|
479
|
+
let r = e.currentChar();
|
|
480
|
+
if (r && r !== `}` && r !== void 0 && r !== ` ` && r !== `
|
|
481
|
+
` && r !== ` `) {
|
|
482
|
+
let t = pe(e);
|
|
483
|
+
return d(R.INVALID_TOKEN_IN_PLACEHOLDER, a(), 0, n + t), n + t;
|
|
484
|
+
}
|
|
485
|
+
return e.currentChar() === void 0 && d(R.UNTERMINATED_CLOSING_BRACE, a(), 0), n;
|
|
486
|
+
}
|
|
487
|
+
function k(e) {
|
|
488
|
+
g(e);
|
|
489
|
+
let t = ``;
|
|
490
|
+
return e.currentChar() === `-` ? (e.next(), t += `-${ce(e)}`) : t += ce(e), e.currentChar() === void 0 && d(R.UNTERMINATED_CLOSING_BRACE, a(), 0), t;
|
|
491
|
+
}
|
|
492
|
+
function A(e) {
|
|
493
|
+
return e !== `'` && e !== `
|
|
494
|
+
`;
|
|
495
|
+
}
|
|
496
|
+
function j(e) {
|
|
497
|
+
g(e), m(e, `'`);
|
|
498
|
+
let t = ``, n = ``;
|
|
499
|
+
for (; t = D(e, A);) n += t === `\\` ? de(e) : t;
|
|
500
|
+
let r = e.currentChar();
|
|
501
|
+
return r === `
|
|
502
|
+
` || r === void 0 ? (d(R.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, a(), 0), r === `
|
|
503
|
+
` && (e.next(), m(e, `'`)), n) : (m(e, `'`), n);
|
|
504
|
+
}
|
|
505
|
+
function de(e) {
|
|
506
|
+
let t = e.currentChar();
|
|
507
|
+
switch (t) {
|
|
508
|
+
case `\\`:
|
|
509
|
+
case `'`: return e.next(), `\\${t}`;
|
|
510
|
+
case `u`: return M(e, t, 4);
|
|
511
|
+
case `U`: return M(e, t, 6);
|
|
512
|
+
default: return d(R.UNKNOWN_ESCAPE_SEQUENCE, a(), 0, t), ``;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function M(e, t, n) {
|
|
516
|
+
m(e, t);
|
|
517
|
+
let r = ``;
|
|
518
|
+
for (let i = 0; i < n; i++) {
|
|
519
|
+
let n = se(e);
|
|
520
|
+
if (!n) {
|
|
521
|
+
d(R.INVALID_UNICODE_ESCAPE_SEQUENCE, a(), 0, `\\${t}${r}${e.currentChar()}`);
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
r += n;
|
|
525
|
+
}
|
|
526
|
+
return `\\${t}${r}`;
|
|
527
|
+
}
|
|
528
|
+
function fe(e) {
|
|
529
|
+
return e !== `{` && e !== `}` && e !== ` ` && e !== `
|
|
530
|
+
`;
|
|
531
|
+
}
|
|
532
|
+
function pe(e) {
|
|
533
|
+
g(e);
|
|
534
|
+
let t = ``, n = ``;
|
|
535
|
+
for (; t = D(e, fe);) n += t;
|
|
536
|
+
return n;
|
|
537
|
+
}
|
|
538
|
+
function N(e) {
|
|
539
|
+
let t = ``, n = ``;
|
|
540
|
+
for (; t = ne(e);) n += t;
|
|
541
|
+
return n;
|
|
542
|
+
}
|
|
543
|
+
function me(e) {
|
|
544
|
+
return e !== `{` && e !== `@` && e !== `|` && e !== `(` && e !== `)` && e !== ` ` && e !== ` ` && e !== `
|
|
545
|
+
`;
|
|
546
|
+
}
|
|
547
|
+
function he(e) {
|
|
548
|
+
for (; e.currentChar() === ` `;) e.next();
|
|
549
|
+
let t = ``, n;
|
|
550
|
+
for (; (n = e.currentChar()) && me(n);) t += n, e.next();
|
|
551
|
+
return t;
|
|
552
|
+
}
|
|
553
|
+
function P(e) {
|
|
554
|
+
g(e);
|
|
555
|
+
let t = m(e, `|`);
|
|
556
|
+
return g(e), t;
|
|
557
|
+
}
|
|
558
|
+
function F(e, t) {
|
|
559
|
+
let n = null;
|
|
560
|
+
switch (e.currentChar()) {
|
|
561
|
+
case `{`: return t.braceNest >= 1 && d(R.NOT_ALLOW_NEST_PLACEHOLDER, a(), 0), e.next(), n = f(t, 2, `{`), g(e), t.braceNest++, n;
|
|
562
|
+
case `}`: return t.braceNest > 0 && t.currentType === 2 && d(R.EMPTY_PLACEHOLDER, a(), 0), e.next(), n = f(t, 3, `}`), t.braceNest--, t.braceNest > 0 && g(e), t.inLinked && t.braceNest === 0 && (t.inLinked = !1), n;
|
|
563
|
+
case `@`: return t.braceNest > 0 && d(R.UNTERMINATED_CLOSING_BRACE, a(), 0), n = I(e, t) || p(t), t.braceNest = 0, n;
|
|
564
|
+
default: {
|
|
565
|
+
let r = !0, i = !0, o = !0;
|
|
566
|
+
if (T(e)) return t.braceNest > 0 && d(R.UNTERMINATED_CLOSING_BRACE, a(), 0), n = f(t, 1, P(e)), t.braceNest = 0, t.inLinked = !1, n;
|
|
567
|
+
if (t.braceNest > 0 && (t.currentType === 4 || t.currentType === 5 || t.currentType === 6)) return d(R.UNTERMINATED_CLOSING_BRACE, a(), 0), t.braceNest = 0, L(e, t);
|
|
568
|
+
if (r = y(e, t)) return n = f(t, 4, ue(e)), g(e), n;
|
|
569
|
+
if (i = b(e, t)) return n = f(t, 5, k(e)), g(e), n;
|
|
570
|
+
if (o = x(e, t)) return n = f(t, 6, j(e)), g(e), n;
|
|
571
|
+
if (!r && !i && !o) return n = f(t, 12, pe(e)), d(R.INVALID_TOKEN_IN_PLACEHOLDER, a(), 0, n.value), g(e), n;
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return n;
|
|
576
|
+
}
|
|
577
|
+
function I(e, t) {
|
|
578
|
+
let { currentType: n } = t, r = null, i = e.currentChar();
|
|
579
|
+
switch (n !== 7 && n !== 8 && n !== 11 && n !== 9 || i !== `
|
|
580
|
+
` && i !== ` ` || d(R.INVALID_LINKED_FORMAT, a(), 0), i) {
|
|
581
|
+
case `@`: return e.next(), r = f(t, 7, `@`), t.inLinked = !0, r;
|
|
582
|
+
case `.`: return g(e), e.next(), f(t, 8, `.`);
|
|
583
|
+
case `:`: return g(e), e.next(), f(t, 9, `:`);
|
|
584
|
+
default: return T(e) ? (r = f(t, 1, P(e)), t.braceNest = 0, t.inLinked = !1, r) : S(e, t) || w(e, t) ? (g(e), I(e, t)) : C(e, t) ? (g(e), f(t, 11, N(e))) : ee(e, t) ? (g(e), i === `{` ? F(e, t) || r : f(t, 10, he(e))) : (n === 7 && d(R.INVALID_LINKED_FORMAT, a(), 0), t.braceNest = 0, t.inLinked = !1, L(e, t));
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
function L(e, t) {
|
|
588
|
+
let n = { type: 13 };
|
|
589
|
+
if (t.braceNest > 0) return F(e, t) || p(t);
|
|
590
|
+
if (t.inLinked) return I(e, t) || p(t);
|
|
591
|
+
switch (e.currentChar()) {
|
|
592
|
+
case `{`: return F(e, t) || p(t);
|
|
593
|
+
case `}`: return d(R.UNBALANCED_CLOSING_BRACE, a(), 0), e.next(), f(t, 3, `}`);
|
|
594
|
+
case `@`: return I(e, t) || p(t);
|
|
595
|
+
default:
|
|
596
|
+
if (T(e)) return n = f(t, 1, P(e)), t.braceNest = 0, t.inLinked = !1, n;
|
|
597
|
+
if (E(e)) return f(t, 0, le(e));
|
|
598
|
+
}
|
|
599
|
+
return n;
|
|
600
|
+
}
|
|
601
|
+
function ve() {
|
|
602
|
+
let { currentType: e, offset: t, startLoc: n, endLoc: o } = c;
|
|
603
|
+
return c.lastType = e, c.lastOffset = t, c.lastStartLoc = n, c.lastEndLoc = o, c.offset = i(), c.startLoc = a(), r.currentChar() === void 0 ? f(c, 13) : L(r, c);
|
|
604
|
+
}
|
|
605
|
+
return {
|
|
606
|
+
nextToken: ve,
|
|
607
|
+
currentOffset: i,
|
|
608
|
+
currentPosition: a,
|
|
609
|
+
context: l
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
let Ce = /\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6})/g, we = /\\([\\@{}|])/g;
|
|
613
|
+
function Te(e, t) {
|
|
614
|
+
return t;
|
|
615
|
+
}
|
|
616
|
+
function Ee(e, t, n) {
|
|
617
|
+
switch (e) {
|
|
618
|
+
case `\\\\`: return `\\`;
|
|
619
|
+
case `\\'`: return `'`;
|
|
620
|
+
default: {
|
|
621
|
+
let e = parseInt(t || n, 16);
|
|
622
|
+
return e <= 55295 || e >= 57344 ? String.fromCodePoint(e) : `�`;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
function De(e = {}) {
|
|
627
|
+
let t = e.location !== !1, { onError: n } = e;
|
|
628
|
+
function r(e, r, i, a, ...o) {
|
|
629
|
+
let s = e.currentPosition();
|
|
630
|
+
if (s.offset += a, s.column += a, n) {
|
|
631
|
+
let e = z(r, t ? _e(i, s) : null, {
|
|
632
|
+
domain: `parser`,
|
|
633
|
+
args: o
|
|
634
|
+
});
|
|
635
|
+
n(e);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function i(e, n, r) {
|
|
639
|
+
let i = { type: e };
|
|
640
|
+
return t && (i.start = n, i.end = n, i.loc = {
|
|
641
|
+
start: r,
|
|
642
|
+
end: r
|
|
643
|
+
}), i;
|
|
644
|
+
}
|
|
645
|
+
function a(e, n, r, i) {
|
|
646
|
+
i && (e.type = i), t && (e.end = n, e.loc && (e.loc.end = r));
|
|
647
|
+
}
|
|
648
|
+
function o(e, t) {
|
|
649
|
+
let n = e.context(), r = i(3, n.offset, n.startLoc);
|
|
650
|
+
return r.value = t.replace(we, Te), a(r, e.currentOffset(), e.currentPosition()), r;
|
|
651
|
+
}
|
|
652
|
+
function s(e, t) {
|
|
653
|
+
let { lastOffset: n, lastStartLoc: r } = e.context(), o = i(5, n, r);
|
|
654
|
+
return o.index = parseInt(t, 10), e.nextToken(), a(o, e.currentOffset(), e.currentPosition()), o;
|
|
655
|
+
}
|
|
656
|
+
function c(e, t) {
|
|
657
|
+
let { lastOffset: n, lastStartLoc: r } = e.context(), o = i(4, n, r);
|
|
658
|
+
return o.key = t, e.nextToken(), a(o, e.currentOffset(), e.currentPosition()), o;
|
|
659
|
+
}
|
|
660
|
+
function u(e, t) {
|
|
661
|
+
let { lastOffset: n, lastStartLoc: r } = e.context(), o = i(9, n, r);
|
|
662
|
+
return o.value = t.replace(Ce, Ee), e.nextToken(), a(o, e.currentOffset(), e.currentPosition()), o;
|
|
663
|
+
}
|
|
664
|
+
function d(e) {
|
|
665
|
+
let t = e.nextToken(), n = e.context(), { lastOffset: o, lastStartLoc: s } = n, c = i(8, o, s);
|
|
666
|
+
return t.type === 11 ? (t.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, n.lastStartLoc, 0, V(t)), c.value = t.value || ``, a(c, e.currentOffset(), e.currentPosition()), { node: c }) : (r(e, R.UNEXPECTED_EMPTY_LINKED_MODIFIER, n.lastStartLoc, 0), c.value = ``, a(c, o, s), {
|
|
667
|
+
nextConsumeToken: t,
|
|
668
|
+
node: c
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
function f(e, t) {
|
|
672
|
+
let n = e.context(), r = i(7, n.offset, n.startLoc);
|
|
673
|
+
return r.value = t, a(r, e.currentOffset(), e.currentPosition()), r;
|
|
674
|
+
}
|
|
675
|
+
function p(e) {
|
|
676
|
+
let t = e.context(), n = i(6, t.offset, t.startLoc), o = e.nextToken();
|
|
677
|
+
if (o.type === 8) {
|
|
678
|
+
let t = d(e);
|
|
679
|
+
n.modifier = t.node, o = t.nextConsumeToken || e.nextToken();
|
|
680
|
+
}
|
|
681
|
+
switch (o.type !== 9 && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(o)), o = e.nextToken(), o.type === 2 && (o = e.nextToken()), o.type) {
|
|
682
|
+
case 10:
|
|
683
|
+
o.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(o)), n.key = f(e, o.value || ``);
|
|
684
|
+
break;
|
|
685
|
+
case 4:
|
|
686
|
+
o.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(o)), n.key = c(e, o.value || ``);
|
|
687
|
+
break;
|
|
688
|
+
case 5:
|
|
689
|
+
o.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(o)), n.key = s(e, o.value || ``);
|
|
690
|
+
break;
|
|
691
|
+
case 6:
|
|
692
|
+
o.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(o)), n.key = u(e, o.value || ``);
|
|
693
|
+
break;
|
|
694
|
+
default: {
|
|
695
|
+
r(e, R.UNEXPECTED_EMPTY_LINKED_KEY, t.lastStartLoc, 0);
|
|
696
|
+
let s = e.context(), c = i(7, s.offset, s.startLoc);
|
|
697
|
+
return c.value = ``, a(c, s.offset, s.startLoc), n.key = c, a(n, s.offset, s.startLoc), {
|
|
698
|
+
nextConsumeToken: o,
|
|
699
|
+
node: n
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return a(n, e.currentOffset(), e.currentPosition()), { node: n };
|
|
704
|
+
}
|
|
705
|
+
function m(e) {
|
|
706
|
+
let t = e.context(), n = i(2, t.currentType === 1 ? e.currentOffset() : t.offset, t.currentType === 1 ? t.endLoc : t.startLoc);
|
|
707
|
+
n.items = [];
|
|
708
|
+
let l = null;
|
|
709
|
+
do {
|
|
710
|
+
let i = l || e.nextToken();
|
|
711
|
+
switch (l = null, i.type) {
|
|
712
|
+
case 0:
|
|
713
|
+
i.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(i)), n.items.push(o(e, i.value || ``));
|
|
714
|
+
break;
|
|
715
|
+
case 5:
|
|
716
|
+
i.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(i)), n.items.push(s(e, i.value || ``));
|
|
717
|
+
break;
|
|
718
|
+
case 4:
|
|
719
|
+
i.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(i)), n.items.push(c(e, i.value || ``));
|
|
720
|
+
break;
|
|
721
|
+
case 6:
|
|
722
|
+
i.value == null && r(e, R.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, V(i)), n.items.push(u(e, i.value || ``));
|
|
723
|
+
break;
|
|
724
|
+
case 7: {
|
|
725
|
+
let t = p(e);
|
|
726
|
+
n.items.push(t.node), l = t.nextConsumeToken || null;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
} while (t.currentType !== 13 && t.currentType !== 1);
|
|
731
|
+
return a(n, t.currentType === 1 ? t.lastOffset : e.currentOffset(), t.currentType === 1 ? t.lastEndLoc : e.currentPosition()), n;
|
|
732
|
+
}
|
|
733
|
+
function h(e, t, n, o) {
|
|
734
|
+
let s = e.context(), c = o.items.length === 0, l = i(1, t, n);
|
|
735
|
+
l.cases = [], l.cases.push(o);
|
|
736
|
+
do {
|
|
737
|
+
let t = m(e);
|
|
738
|
+
c || (c = t.items.length === 0), l.cases.push(t);
|
|
739
|
+
} while (s.currentType !== 13);
|
|
740
|
+
return c && r(e, R.MUST_HAVE_MESSAGES_IN_PLURAL, n, 0), a(l, e.currentOffset(), e.currentPosition()), l;
|
|
741
|
+
}
|
|
742
|
+
function g(e) {
|
|
743
|
+
let t = e.context(), { offset: n, startLoc: r } = t, i = m(e);
|
|
744
|
+
return t.currentType === 13 ? i : h(e, n, r, i);
|
|
745
|
+
}
|
|
746
|
+
function _(n) {
|
|
747
|
+
let o = Se(n, l({}, e)), s = o.context(), c = i(0, s.offset, s.startLoc);
|
|
748
|
+
return t && c.loc && (c.loc.source = n), c.body = g(o), e.onCacheKey && (c.cacheKey = e.onCacheKey(n)), s.currentType !== 13 && r(o, R.UNEXPECTED_LEXICAL_ANALYSIS, s.lastStartLoc, 0, n[s.offset] || ``), a(c, o.currentOffset(), o.currentPosition()), c;
|
|
749
|
+
}
|
|
750
|
+
return { parse: _ };
|
|
751
|
+
}
|
|
752
|
+
function V(e) {
|
|
753
|
+
if (e.type === 13) return `EOF`;
|
|
754
|
+
let t = (e.value || ``).replace(/\r?\n/gu, `\\n`);
|
|
755
|
+
return t.length > 10 ? t.slice(0, 9) + `…` : t;
|
|
756
|
+
}
|
|
757
|
+
function H(e) {
|
|
758
|
+
return b(e) && Le(e) === 0 && (p(e, `b`) || p(e, `body`));
|
|
759
|
+
}
|
|
760
|
+
let Oe = [`b`, `body`];
|
|
761
|
+
function ke(e) {
|
|
762
|
+
return W(e, Oe);
|
|
763
|
+
}
|
|
764
|
+
let Ae = [`c`, `cases`];
|
|
765
|
+
function je(e) {
|
|
766
|
+
return W(e, Ae, []);
|
|
767
|
+
}
|
|
768
|
+
let Me = [`s`, `static`];
|
|
769
|
+
function Ne(e) {
|
|
770
|
+
return W(e, Me);
|
|
771
|
+
}
|
|
772
|
+
let Pe = [`i`, `items`];
|
|
773
|
+
function Fe(e) {
|
|
774
|
+
return W(e, Pe, []);
|
|
775
|
+
}
|
|
776
|
+
let Ie = [`t`, `type`];
|
|
777
|
+
function Le(e) {
|
|
778
|
+
return W(e, Ie);
|
|
779
|
+
}
|
|
780
|
+
let Re = [`v`, `value`];
|
|
781
|
+
function U(e, t) {
|
|
782
|
+
let n = W(e, Re);
|
|
783
|
+
if (n != null) return n;
|
|
784
|
+
throw G(t);
|
|
785
|
+
}
|
|
786
|
+
let ze = [`m`, `modifier`];
|
|
787
|
+
function Be(e) {
|
|
788
|
+
return W(e, ze);
|
|
789
|
+
}
|
|
790
|
+
let Ve = [`k`, `key`];
|
|
791
|
+
function He(e) {
|
|
792
|
+
let t = W(e, Ve);
|
|
793
|
+
if (t) return t;
|
|
794
|
+
throw G(6);
|
|
795
|
+
}
|
|
796
|
+
function W(e, t, n) {
|
|
797
|
+
for (let n = 0; n < t.length; n++) {
|
|
798
|
+
let r = t[n];
|
|
799
|
+
if (p(e, r) && e[r] != null) return e[r];
|
|
800
|
+
}
|
|
801
|
+
return n;
|
|
802
|
+
}
|
|
803
|
+
let Ue = [
|
|
804
|
+
...Oe,
|
|
805
|
+
...Ae,
|
|
806
|
+
...Me,
|
|
807
|
+
...Pe,
|
|
808
|
+
...Ve,
|
|
809
|
+
...ze,
|
|
810
|
+
...Re,
|
|
811
|
+
...Ie
|
|
812
|
+
];
|
|
813
|
+
function G(e) {
|
|
814
|
+
return Error(`unhandled node type: ${e}`);
|
|
815
|
+
}
|
|
816
|
+
function We(e) {
|
|
817
|
+
return (t) => Ge(t, e);
|
|
818
|
+
}
|
|
819
|
+
function Ge(e, t) {
|
|
820
|
+
let n = ke(t);
|
|
821
|
+
if (n == null) throw G(0);
|
|
822
|
+
if (Le(n) === 1) {
|
|
823
|
+
let t = je(n);
|
|
824
|
+
return e.plural(t.reduce((t, n) => [...g(t) ? t : [t], Ke(e, n)], []));
|
|
825
|
+
}
|
|
826
|
+
return Ke(e, n);
|
|
827
|
+
}
|
|
828
|
+
function Ke(e, t) {
|
|
829
|
+
let n = Ne(t);
|
|
830
|
+
if (n != null) return e.type === `text` ? n : e.normalize([n]);
|
|
831
|
+
{
|
|
832
|
+
let n = Fe(t).reduce((t, n) => [...t, qe(e, n)], []);
|
|
833
|
+
return e.normalize(n);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function qe(e, t) {
|
|
837
|
+
let n = Le(t);
|
|
838
|
+
switch (n) {
|
|
839
|
+
case 3: return U(t, n);
|
|
840
|
+
case 9: return U(t, n);
|
|
841
|
+
case 4: {
|
|
842
|
+
let r = t;
|
|
843
|
+
if (p(r, `k`) && r.k) return e.interpolate(e.named(r.k));
|
|
844
|
+
if (p(r, `key`) && r.key) return e.interpolate(e.named(r.key));
|
|
845
|
+
throw G(n);
|
|
846
|
+
}
|
|
847
|
+
case 5: {
|
|
848
|
+
let r = t;
|
|
849
|
+
if (p(r, `i`) && a(r.i)) return e.interpolate(e.list(r.i));
|
|
850
|
+
if (p(r, `index`) && a(r.index)) return e.interpolate(e.list(r.index));
|
|
851
|
+
throw G(n);
|
|
852
|
+
}
|
|
853
|
+
case 6: {
|
|
854
|
+
let n = t, r = Be(n), i = He(n);
|
|
855
|
+
return e.linked(qe(e, i), r ? qe(e, r) : void 0, e.type);
|
|
856
|
+
}
|
|
857
|
+
case 7: return U(t, n);
|
|
858
|
+
case 8: return U(t, n);
|
|
859
|
+
default: throw Error(`unhandled node on format message part: ${n}`);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
let Je = (e) => e, K = d();
|
|
863
|
+
function Ye() {
|
|
864
|
+
K = d();
|
|
865
|
+
}
|
|
866
|
+
function Xe(e, t = {}) {
|
|
867
|
+
let n = !1, r = t.onError || ve;
|
|
868
|
+
t.onError = (e) => {
|
|
869
|
+
n = !0, r(e);
|
|
870
|
+
};
|
|
871
|
+
let i = De(t).parse(e);
|
|
872
|
+
return t.optimize && ye(i), t.mangle && B(i), {
|
|
873
|
+
ast: i,
|
|
874
|
+
detectError: n,
|
|
875
|
+
code: ``
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
function Ze(e, t) {
|
|
879
|
+
if (v(e)) {
|
|
880
|
+
y(t.warnHtmlMessage) && t.warnHtmlMessage;
|
|
881
|
+
let n = (t.onCacheKey || Je)(e), r = K[n];
|
|
882
|
+
if (r) return r;
|
|
883
|
+
let { ast: i, detectError: a } = Xe(e, {
|
|
884
|
+
...t,
|
|
885
|
+
location: !1,
|
|
886
|
+
mangle: !0,
|
|
887
|
+
optimize: !0
|
|
888
|
+
}), o = We(i);
|
|
889
|
+
return a ? o : K[n] = o;
|
|
890
|
+
}
|
|
891
|
+
{
|
|
892
|
+
if (!H(e)) return (() => e);
|
|
893
|
+
let t = e.cacheKey;
|
|
894
|
+
return t ? K[t] || (K[t] = We(e)) : We(e);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
let q = {
|
|
898
|
+
INVALID_ARGUMENT: 17,
|
|
899
|
+
INVALID_DATE_ARGUMENT: 18,
|
|
900
|
+
INVALID_ISO_DATE_ARGUMENT: 19,
|
|
901
|
+
NOT_SUPPORT_LOCALE_PROMISE_VALUE: 20,
|
|
902
|
+
NOT_SUPPORT_LOCALE_ASYNC_FUNCTION: 21,
|
|
903
|
+
NOT_SUPPORT_LOCALE_TYPE: 22
|
|
904
|
+
};
|
|
905
|
+
function J(e) {
|
|
906
|
+
return z(e, null, void 0);
|
|
907
|
+
}
|
|
908
|
+
q.INVALID_ARGUMENT, q.INVALID_DATE_ARGUMENT, q.INVALID_ISO_DATE_ARGUMENT, q.NOT_SUPPORT_LOCALE_PROMISE_VALUE, q.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION, q.NOT_SUPPORT_LOCALE_TYPE;
|
|
909
|
+
function Qe(e, t) {
|
|
910
|
+
return t.locale == null ? et(e.locale) : et(t.locale);
|
|
911
|
+
}
|
|
912
|
+
let $e;
|
|
913
|
+
function et(e) {
|
|
914
|
+
if (v(e)) return e;
|
|
915
|
+
if (_(e)) {
|
|
916
|
+
if (e.resolvedOnce && $e != null) return $e;
|
|
917
|
+
if (e.constructor.name === `Function`) {
|
|
918
|
+
let t = e();
|
|
919
|
+
if (x(t)) throw J(q.NOT_SUPPORT_LOCALE_PROMISE_VALUE);
|
|
920
|
+
return $e = t;
|
|
921
|
+
}
|
|
922
|
+
throw J(q.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION);
|
|
923
|
+
}
|
|
924
|
+
throw J(q.NOT_SUPPORT_LOCALE_TYPE);
|
|
925
|
+
}
|
|
926
|
+
function tt(e, t, n) {
|
|
927
|
+
return [.../* @__PURE__ */ new Set([n, ...g(t) ? t : b(t) ? Object.keys(t).filter((e) => e !== "default") : v(t) ? [t] : [n]])];
|
|
928
|
+
}
|
|
929
|
+
function nt(e, t, n) {
|
|
930
|
+
let r = v(n) ? n : Z, i = e, a;
|
|
931
|
+
b(t) ? (i.__localeChainObjectCache || (i.__localeChainObjectCache = /* @__PURE__ */ new WeakMap()), a = i.__localeChainObjectCache.get(t), a || (a = /* @__PURE__ */ new Map(), i.__localeChainObjectCache.set(t, a))) : (i.__localeChainCache || (i.__localeChainCache = /* @__PURE__ */ new Map()), a = i.__localeChainCache.get(t), a || (a = /* @__PURE__ */ new Map(), i.__localeChainCache.set(t, a)));
|
|
932
|
+
let o = a.get(r);
|
|
933
|
+
if (o) return o;
|
|
934
|
+
let s = [], c = [n];
|
|
935
|
+
for (; g(c);) c = rt(s, c, t);
|
|
936
|
+
let l = g(t) || !w(t) ? t : t.default ? t.default : null;
|
|
937
|
+
return c = v(l) ? [l] : l, g(c) && rt(s, c, !1), a.set(r, s), s;
|
|
938
|
+
}
|
|
939
|
+
function rt(e, t, n) {
|
|
940
|
+
let r = !0;
|
|
941
|
+
for (let i = 0; i < t.length && y(r); i++) {
|
|
942
|
+
let a = t[i];
|
|
943
|
+
v(a) && (r = it(e, t[i], n));
|
|
944
|
+
}
|
|
945
|
+
return r;
|
|
946
|
+
}
|
|
947
|
+
function it(e, t, n) {
|
|
948
|
+
let r, i = t.split(`-`);
|
|
949
|
+
do
|
|
950
|
+
r = at(e, i.join(`-`), n), i.splice(-1, 1);
|
|
951
|
+
while (i.length && r === !0);
|
|
952
|
+
return r;
|
|
953
|
+
}
|
|
954
|
+
function at(e, t, n) {
|
|
955
|
+
let r = !1;
|
|
956
|
+
if (!e.includes(t) && (r = !0, t)) {
|
|
957
|
+
r = t[t.length - 1] !== `!`;
|
|
958
|
+
let i = t.replace(/!/g, ``);
|
|
959
|
+
e.push(i), (g(n) || w(n)) && n[i] && (r = n[i]);
|
|
960
|
+
}
|
|
961
|
+
return r;
|
|
962
|
+
}
|
|
963
|
+
let Y = [];
|
|
964
|
+
Y[0] = {
|
|
965
|
+
w: [0],
|
|
966
|
+
i: [3, 0],
|
|
967
|
+
"[": [4],
|
|
968
|
+
o: [7]
|
|
969
|
+
}, Y[1] = {
|
|
970
|
+
w: [1],
|
|
971
|
+
".": [2],
|
|
972
|
+
"[": [4],
|
|
973
|
+
o: [7]
|
|
974
|
+
}, Y[2] = {
|
|
975
|
+
w: [2],
|
|
976
|
+
i: [3, 0],
|
|
977
|
+
0: [3, 0]
|
|
978
|
+
}, Y[3] = {
|
|
979
|
+
i: [3, 0],
|
|
980
|
+
0: [3, 0],
|
|
981
|
+
w: [1, 1],
|
|
982
|
+
".": [2, 1],
|
|
983
|
+
"[": [4, 1],
|
|
984
|
+
o: [7, 1]
|
|
985
|
+
}, Y[4] = {
|
|
986
|
+
"'": [5, 0],
|
|
987
|
+
"\"": [6, 0],
|
|
988
|
+
"[": [4, 2],
|
|
989
|
+
"]": [1, 3],
|
|
990
|
+
o: 8,
|
|
991
|
+
l: [4, 0]
|
|
992
|
+
}, Y[5] = {
|
|
993
|
+
"'": [4, 0],
|
|
994
|
+
o: 8,
|
|
995
|
+
l: [5, 0]
|
|
996
|
+
}, Y[6] = {
|
|
997
|
+
"\"": [4, 0],
|
|
998
|
+
o: 8,
|
|
999
|
+
l: [6, 0]
|
|
1000
|
+
};
|
|
1001
|
+
let ot = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
|
|
1002
|
+
function st(e) {
|
|
1003
|
+
return ot.test(e);
|
|
1004
|
+
}
|
|
1005
|
+
function ct(e) {
|
|
1006
|
+
let t = e.charCodeAt(0);
|
|
1007
|
+
return t === e.charCodeAt(e.length - 1) && (t === 34 || t === 39) ? e.slice(1, -1) : e;
|
|
1008
|
+
}
|
|
1009
|
+
function lt(e) {
|
|
1010
|
+
if (e == null) return `o`;
|
|
1011
|
+
switch (e.charCodeAt(0)) {
|
|
1012
|
+
case 91:
|
|
1013
|
+
case 93:
|
|
1014
|
+
case 46:
|
|
1015
|
+
case 34:
|
|
1016
|
+
case 39: return e;
|
|
1017
|
+
case 95:
|
|
1018
|
+
case 36:
|
|
1019
|
+
case 45: return `i`;
|
|
1020
|
+
case 9:
|
|
1021
|
+
case 10:
|
|
1022
|
+
case 13:
|
|
1023
|
+
case 160:
|
|
1024
|
+
case 65279:
|
|
1025
|
+
case 8232:
|
|
1026
|
+
case 8233: return `w`;
|
|
1027
|
+
}
|
|
1028
|
+
return `i`;
|
|
1029
|
+
}
|
|
1030
|
+
function ut(e) {
|
|
1031
|
+
let t = e.trim();
|
|
1032
|
+
return e.charAt(0) === `0` && isNaN(parseInt(e)) ? !1 : st(t) ? ct(t) : `*` + t;
|
|
1033
|
+
}
|
|
1034
|
+
function dt(e) {
|
|
1035
|
+
let t = [], n = -1, r = 0, i = 0, a, o, s, c, l, u, d, f = [];
|
|
1036
|
+
f[0] = () => {
|
|
1037
|
+
o === void 0 ? o = s : o += s;
|
|
1038
|
+
}, f[1] = () => {
|
|
1039
|
+
o !== void 0 && (t.push(o), o = void 0);
|
|
1040
|
+
}, f[2] = () => {
|
|
1041
|
+
f[0](), i++;
|
|
1042
|
+
}, f[3] = () => {
|
|
1043
|
+
if (i > 0) i--, r = 4, f[0]();
|
|
1044
|
+
else {
|
|
1045
|
+
if (i = 0, o === void 0 || (o = ut(o), o === !1)) return !1;
|
|
1046
|
+
f[1]();
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
function p() {
|
|
1050
|
+
let t = e[n + 1];
|
|
1051
|
+
if (r === 5 && t === `'` || r === 6 && t === `"`) return n++, s = `\\` + t, f[0](), !0;
|
|
1052
|
+
}
|
|
1053
|
+
for (; r !== null;) if (n++, a = e[n], !(a === `\\` && p())) {
|
|
1054
|
+
if (c = lt(a), d = Y[r], l = d[c] || d.l || 8, l === 8 || (r = l[0], l[1] !== void 0 && (u = f[l[1]], u && (s = a, u() === !1)))) return;
|
|
1055
|
+
if (r === 7) return t;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
let ft = /* @__PURE__ */ new Map();
|
|
1059
|
+
function pt(e, t) {
|
|
1060
|
+
return b(e) ? m(e, t) : null;
|
|
1061
|
+
}
|
|
1062
|
+
function mt(e, t) {
|
|
1063
|
+
if (!b(e)) return null;
|
|
1064
|
+
let n = ft.get(t);
|
|
1065
|
+
if (n || (n = dt(t), n && ft.set(t, n)), !n) return null;
|
|
1066
|
+
let r = n.length, i = e, a = 0;
|
|
1067
|
+
for (; a < r;) {
|
|
1068
|
+
let e = n[a];
|
|
1069
|
+
if (Ue.includes(e) && H(i) || !b(i) || !p(i, e)) return null;
|
|
1070
|
+
let t = i[e];
|
|
1071
|
+
if (t === void 0 || _(i)) return null;
|
|
1072
|
+
i = t, a++;
|
|
1073
|
+
}
|
|
1074
|
+
return i;
|
|
1075
|
+
}
|
|
1076
|
+
let X = {
|
|
1077
|
+
NOT_FOUND_KEY: 1,
|
|
1078
|
+
FALLBACK_TO_TRANSLATE: 2,
|
|
1079
|
+
CANNOT_FORMAT_NUMBER: 3,
|
|
1080
|
+
FALLBACK_TO_NUMBER_FORMAT: 4,
|
|
1081
|
+
CANNOT_FORMAT_DATE: 5,
|
|
1082
|
+
FALLBACK_TO_DATE_FORMAT: 6,
|
|
1083
|
+
EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: 7,
|
|
1084
|
+
INVALID_NUMBER_ARGUMENT: 8,
|
|
1085
|
+
INVALID_DATE_ARGUMENT: 9,
|
|
1086
|
+
IGNORE_UNSAFE_LOCALE: 10,
|
|
1087
|
+
FALLBACK_TO_DEFAULT_PLURAL_RULE: 11,
|
|
1088
|
+
FALLBACK_FROM_INVALID_LOCALE: 12
|
|
1089
|
+
}, ht = {
|
|
1090
|
+
[X.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale {resource}.`,
|
|
1091
|
+
[X.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`,
|
|
1092
|
+
[X.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
|
|
1093
|
+
[X.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`,
|
|
1094
|
+
[X.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
|
|
1095
|
+
[X.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.`,
|
|
1096
|
+
[X.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: `This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future.`,
|
|
1097
|
+
[X.INVALID_NUMBER_ARGUMENT]: `Invalid argument for number formatting: expected a number but received '{value}'.`,
|
|
1098
|
+
[X.INVALID_DATE_ARGUMENT]: `Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'.`,
|
|
1099
|
+
[X.IGNORE_UNSAFE_LOCALE]: `Ignore '{locale}' locale: it is a property name of Object.prototype`,
|
|
1100
|
+
[X.FALLBACK_TO_DEFAULT_PLURAL_RULE]: `Fall back to the default plural rule for '{locale}' locale: Intl.PluralRules does not support it`,
|
|
1101
|
+
[X.FALLBACK_FROM_INVALID_LOCALE]: `Fall back to '{target}' locale for {type} formatting with '{locale}' locale: it is not a BCP 47 language tag`
|
|
1102
|
+
};
|
|
1103
|
+
function gt(e, ...t) {
|
|
1104
|
+
return n(ht[e], ...t);
|
|
1105
|
+
}
|
|
1106
|
+
let _t = `12.0.0-alpha.11`, Z = `en-US`, vt = (e) => `${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;
|
|
1107
|
+
function yt() {
|
|
1108
|
+
return {
|
|
1109
|
+
upper: (e, t) => t === `text` && v(e) ? e.toUpperCase() : t === `vnode` && b(e) && `__v_isVNode` in e ? e.children.toUpperCase() : e,
|
|
1110
|
+
lower: (e, t) => t === `text` && v(e) ? e.toLowerCase() : t === `vnode` && b(e) && `__v_isVNode` in e ? e.children.toLowerCase() : e,
|
|
1111
|
+
capitalize: (e, t) => t === `text` && v(e) ? vt(e) : t === `vnode` && b(e) && `__v_isVNode` in e ? vt(e.children) : e
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
let bt;
|
|
1115
|
+
function xt(e) {
|
|
1116
|
+
bt = e;
|
|
1117
|
+
}
|
|
1118
|
+
let St;
|
|
1119
|
+
function Ct(e) {
|
|
1120
|
+
St = e;
|
|
1121
|
+
}
|
|
1122
|
+
let wt;
|
|
1123
|
+
function Tt(e) {
|
|
1124
|
+
wt = e;
|
|
1125
|
+
}
|
|
1126
|
+
let Et = 0;
|
|
1127
|
+
function Dt(e = {}) {
|
|
1128
|
+
let t = _(e.onWarn) ? e.onWarn : E, n = v(e.version) ? e.version : _t, r = v(e.locale) || _(e.locale) ? e.locale : Z, i = _(r) ? Z : r, a = jt(e.fallbackLocale) ? e.fallbackLocale : i, o = w(e.messages) ? e.messages : Ot(i), s = w(e.datetimeFormats) ? e.datetimeFormats : Ot(i), c = w(e.numberFormats) ? e.numberFormats : Ot(i), u = l(d(), e.modifiers, yt()), f = e.pluralRules || d(), p = _(e.missing) ? e.missing : null, m = !Mt(e.missingWarn) || e.missingWarn, h = !Mt(e.fallbackWarn) || e.fallbackWarn, g = !!e.fallbackFormat, x = !!e.unresolving, S = _(e.postTranslation) ? e.postTranslation : null, C = w(e.processor) ? e.processor : null, ee = !y(e.warnHtmlMessage) || e.warnHtmlMessage, T = !!e.escapeParameter, D = _(e.messageCompiler) ? e.messageCompiler : bt || null, te = _(e.messageResolver) ? e.messageResolver : St || pt, ne = _(e.localeFallbacker) ? e.localeFallbacker : wt || tt, re = b(e.fallbackContext) ? e.fallbackContext : void 0;
|
|
1129
|
+
Et++;
|
|
1130
|
+
let O = {
|
|
1131
|
+
version: n,
|
|
1132
|
+
cid: Et,
|
|
1133
|
+
locale: r,
|
|
1134
|
+
fallbackLocale: a,
|
|
1135
|
+
messages: o,
|
|
1136
|
+
modifiers: u,
|
|
1137
|
+
pluralRules: f,
|
|
1138
|
+
missing: p,
|
|
1139
|
+
missingWarn: m,
|
|
1140
|
+
fallbackWarn: h,
|
|
1141
|
+
fallbackFormat: g,
|
|
1142
|
+
unresolving: x,
|
|
1143
|
+
postTranslation: S,
|
|
1144
|
+
processor: C,
|
|
1145
|
+
warnHtmlMessage: ee,
|
|
1146
|
+
escapeParameter: T,
|
|
1147
|
+
messageCompiler: D,
|
|
1148
|
+
messageResolver: te,
|
|
1149
|
+
localeFallbacker: ne,
|
|
1150
|
+
fallbackContext: re,
|
|
1151
|
+
onWarn: t
|
|
1152
|
+
};
|
|
1153
|
+
return O.datetimeFormats = s, O.numberFormats = c, O.__datetimeFormatters = /* @__PURE__ */ new Map(), O.__numberFormatters = /* @__PURE__ */ new Map(), O;
|
|
1154
|
+
}
|
|
1155
|
+
let Ot = (e) => ({ [e]: d() });
|
|
1156
|
+
function kt(e, t) {
|
|
1157
|
+
let n = m(e.messages, t);
|
|
1158
|
+
if (n == null) return;
|
|
1159
|
+
let r = d();
|
|
1160
|
+
return L(n, r), r;
|
|
1161
|
+
}
|
|
1162
|
+
function At(e, t, n) {
|
|
1163
|
+
h(t) || (e.messages[t] = n);
|
|
1164
|
+
}
|
|
1165
|
+
function jt(e) {
|
|
1166
|
+
return v(e) || g(e) || w(e) || e === !1;
|
|
1167
|
+
}
|
|
1168
|
+
function Mt(e) {
|
|
1169
|
+
return y(e) || s(e);
|
|
1170
|
+
}
|
|
1171
|
+
function Nt(e, t) {
|
|
1172
|
+
return s(e) ? e.test(t) : e;
|
|
1173
|
+
}
|
|
1174
|
+
function Pt(e, t) {
|
|
1175
|
+
return s(e) ? e.test(t) : e;
|
|
1176
|
+
}
|
|
1177
|
+
function Ft(e, t, n, r, i) {
|
|
1178
|
+
let { missing: a, onWarn: o } = e;
|
|
1179
|
+
if (a !== null) {
|
|
1180
|
+
let r = a(e, n, t, i);
|
|
1181
|
+
return v(r) ? r : t;
|
|
1182
|
+
}
|
|
1183
|
+
return t;
|
|
1184
|
+
}
|
|
1185
|
+
function It(e, t) {
|
|
1186
|
+
let n = e;
|
|
1187
|
+
b(t) ? n.__localeChainObjectCache?.delete(t) : n.__localeChainCache?.delete(t);
|
|
1188
|
+
}
|
|
1189
|
+
function Lt(e, t, n) {
|
|
1190
|
+
It(e, n), e.fallbackContext && It(e.fallbackContext, n);
|
|
1191
|
+
{
|
|
1192
|
+
let { __datetimeFormatters: t, __numberFormatters: n } = e;
|
|
1193
|
+
t.clear(), n.clear();
|
|
1194
|
+
}
|
|
1195
|
+
e.localeFallbacker(e, n, t);
|
|
1196
|
+
}
|
|
1197
|
+
function Rt(e, t) {
|
|
1198
|
+
return e !== t && e.split(`-`)[0] === t.split(`-`)[0];
|
|
1199
|
+
}
|
|
1200
|
+
function zt(e, t) {
|
|
1201
|
+
let n = t.indexOf(e);
|
|
1202
|
+
if (n === -1) return !1;
|
|
1203
|
+
for (let r = n + 1; r < t.length; r++) if (Rt(e, t[r])) return !0;
|
|
1204
|
+
return !1;
|
|
1205
|
+
}
|
|
1206
|
+
function Bt(e, t, n, r, i, a, o) {
|
|
1207
|
+
let { fallbackLocale: s, localeFallbacker: c, onWarn: l } = e, u = c(e, s, n);
|
|
1208
|
+
for (let n = 0; n < u.length; n++) {
|
|
1209
|
+
let a = u[n], s = m(m(r, a) || {}, t);
|
|
1210
|
+
if (w(s) && v(a)) return a;
|
|
1211
|
+
Ft(e, t, a, i, o);
|
|
1212
|
+
}
|
|
1213
|
+
return null;
|
|
1214
|
+
}
|
|
1215
|
+
function Vt(e) {
|
|
1216
|
+
try {
|
|
1217
|
+
return Intl.getCanonicalLocales(e), !0;
|
|
1218
|
+
} catch {
|
|
1219
|
+
return !1;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
function Ht(e, t, n, r, i) {
|
|
1223
|
+
try {
|
|
1224
|
+
return new t(n, r);
|
|
1225
|
+
} catch (i) {
|
|
1226
|
+
if (Vt(n)) throw i;
|
|
1227
|
+
let { fallbackLocale: a, localeFallbacker: o, onWarn: s } = e;
|
|
1228
|
+
return new t(o(e, a, n).find(Vt) || `en-US`, r);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
function Ut(e, [t, n, r, i], a, o, s, c) {
|
|
1232
|
+
let u = y(r.missingWarn) ? r.missingWarn : e.missingWarn, d = y(r.fallbackWarn) ? r.fallbackWarn : e.fallbackWarn, f = !!r.part, p = Qe(e, r);
|
|
1233
|
+
if (!v(t) || t === ``) {
|
|
1234
|
+
let t = Ht(e, a, p.replace(/!/g, ``), i, c);
|
|
1235
|
+
return f ? t.formatToParts(n) : t.format(n);
|
|
1236
|
+
}
|
|
1237
|
+
let m = Bt(e, t, p, s, u, d, c);
|
|
1238
|
+
if (!v(m)) return e.unresolving ? -1 : t;
|
|
1239
|
+
let h = s[m][t], g = Wt(m, t, i), _ = o.get(g);
|
|
1240
|
+
return _ || (_ = Ht(e, a, m, l({}, h, i), c), o.set(g, _)), f ? _.formatToParts(n) : _.format(n);
|
|
1241
|
+
}
|
|
1242
|
+
function Wt(e, t, n) {
|
|
1243
|
+
let r = `${e}__${t}`;
|
|
1244
|
+
return w(n) && !c(n) && (r = `${r}__${JSON.stringify(n)}`), r;
|
|
1245
|
+
}
|
|
1246
|
+
function Gt(e, t, n) {
|
|
1247
|
+
for (let r in n) {
|
|
1248
|
+
let n = `${t}__${r}`;
|
|
1249
|
+
for (let t of e.keys()) (t === n || t.startsWith(`${n}__`)) && e.delete(t);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
function Kt(e, t, n, r) {
|
|
1253
|
+
let [, i, a, o] = e, s = n;
|
|
1254
|
+
return v(i) ? t.key = i : w(i) && Object.keys(i).forEach((e) => {
|
|
1255
|
+
r.includes(e) ? s[e] = i[e] : t[e] = i[e];
|
|
1256
|
+
}), v(a) ? t.locale = a : w(a) && (s = a), w(o) && (s = o), s;
|
|
1257
|
+
}
|
|
1258
|
+
function qt(e, ...t) {
|
|
1259
|
+
let { datetimeFormats: n, onWarn: r } = e, { __datetimeFormatters: i } = e;
|
|
1260
|
+
return !v(t[0]) && !o(t[0]) && !a(t[0]) ? `` : Ut(e, Yt(...t), Intl.DateTimeFormat, i, n, `datetime format`);
|
|
1261
|
+
}
|
|
1262
|
+
let Jt = [
|
|
1263
|
+
`localeMatcher`,
|
|
1264
|
+
`weekday`,
|
|
1265
|
+
`era`,
|
|
1266
|
+
`year`,
|
|
1267
|
+
`month`,
|
|
1268
|
+
`day`,
|
|
1269
|
+
`hour`,
|
|
1270
|
+
`minute`,
|
|
1271
|
+
`second`,
|
|
1272
|
+
`timeZoneName`,
|
|
1273
|
+
`formatMatcher`,
|
|
1274
|
+
`hour12`,
|
|
1275
|
+
`timeZone`,
|
|
1276
|
+
`dateStyle`,
|
|
1277
|
+
`timeStyle`,
|
|
1278
|
+
`calendar`,
|
|
1279
|
+
`dayPeriod`,
|
|
1280
|
+
`numberingSystem`,
|
|
1281
|
+
`hourCycle`,
|
|
1282
|
+
`fractionalSecondDigits`
|
|
1283
|
+
];
|
|
1284
|
+
function Yt(...e) {
|
|
1285
|
+
let [t] = e, n = d(), r = d(), i;
|
|
1286
|
+
if (v(t)) {
|
|
1287
|
+
let e = t.match(/^(\d{4}-\d{2}-\d{2})(?:(T|\s)(.+))?$/);
|
|
1288
|
+
if (!e) throw J(q.INVALID_ISO_DATE_ARGUMENT);
|
|
1289
|
+
let n = e[3] ? e[3].trim().startsWith(`T`) ? `${e[1].trim()}${e[3].trim()}` : `${e[1].trim()}T${e[3].trim()}` : e[1].trim();
|
|
1290
|
+
i = new Date(n);
|
|
1291
|
+
try {
|
|
1292
|
+
i.toISOString();
|
|
1293
|
+
} catch {
|
|
1294
|
+
throw J(q.INVALID_ISO_DATE_ARGUMENT);
|
|
1295
|
+
}
|
|
1296
|
+
} else if (o(t)) {
|
|
1297
|
+
if (isNaN(t.getTime())) throw J(q.INVALID_DATE_ARGUMENT);
|
|
1298
|
+
i = t;
|
|
1299
|
+
} else if (a(t)) i = t;
|
|
1300
|
+
else throw J(q.INVALID_ARGUMENT);
|
|
1301
|
+
let s = Kt(e, n, r, Jt);
|
|
1302
|
+
return [
|
|
1303
|
+
n.key || ``,
|
|
1304
|
+
i,
|
|
1305
|
+
n,
|
|
1306
|
+
s
|
|
1307
|
+
];
|
|
1308
|
+
}
|
|
1309
|
+
function Xt(e, t, n) {
|
|
1310
|
+
Gt(e.__datetimeFormatters, t, n);
|
|
1311
|
+
}
|
|
1312
|
+
function Zt(e, ...t) {
|
|
1313
|
+
let { numberFormats: n, onWarn: r } = e, { __numberFormatters: i } = e;
|
|
1314
|
+
return a(t[0]) ? Ut(e, $t(...t), Intl.NumberFormat, i, n, `number format`) : ``;
|
|
1315
|
+
}
|
|
1316
|
+
let Qt = [
|
|
1317
|
+
`localeMatcher`,
|
|
1318
|
+
`style`,
|
|
1319
|
+
`currency`,
|
|
1320
|
+
`currencyDisplay`,
|
|
1321
|
+
`currencySign`,
|
|
1322
|
+
`useGrouping`,
|
|
1323
|
+
`minimumIntegerDigits`,
|
|
1324
|
+
`minimumFractionDigits`,
|
|
1325
|
+
`maximumFractionDigits`,
|
|
1326
|
+
`minimumSignificantDigits`,
|
|
1327
|
+
`maximumSignificantDigits`,
|
|
1328
|
+
`compactDisplay`,
|
|
1329
|
+
`notation`,
|
|
1330
|
+
`signDisplay`,
|
|
1331
|
+
`unit`,
|
|
1332
|
+
`unitDisplay`,
|
|
1333
|
+
`roundingMode`,
|
|
1334
|
+
`roundingPriority`,
|
|
1335
|
+
`roundingIncrement`,
|
|
1336
|
+
`trailingZeroDisplay`
|
|
1337
|
+
];
|
|
1338
|
+
function $t(...e) {
|
|
1339
|
+
let [t] = e, n = d(), r = d();
|
|
1340
|
+
if (!a(t)) throw J(q.INVALID_ARGUMENT);
|
|
1341
|
+
let i = t, o = Kt(e, n, r, Qt);
|
|
1342
|
+
return [
|
|
1343
|
+
n.key || ``,
|
|
1344
|
+
i,
|
|
1345
|
+
n,
|
|
1346
|
+
o
|
|
1347
|
+
];
|
|
1348
|
+
}
|
|
1349
|
+
function en(e, t, n) {
|
|
1350
|
+
Gt(e.__numberFormatters, t, n);
|
|
1351
|
+
}
|
|
1352
|
+
let tn = (e) => e, nn = (e) => ``, rn = `text`, an = (e) => e.length === 0 ? `` : T(e), on = ee;
|
|
1353
|
+
function sn(e, t) {
|
|
1354
|
+
return e = Math.abs(e), t === 2 ? e === 1 ? 0 : 1 : Math.min(e, 2);
|
|
1355
|
+
}
|
|
1356
|
+
let cn = [
|
|
1357
|
+
`zero`,
|
|
1358
|
+
`one`,
|
|
1359
|
+
`two`,
|
|
1360
|
+
`few`,
|
|
1361
|
+
`many`,
|
|
1362
|
+
`other`
|
|
1363
|
+
], Q = /* @__PURE__ */ new Map();
|
|
1364
|
+
function ln(e) {
|
|
1365
|
+
try {
|
|
1366
|
+
if (Intl.PluralRules.supportedLocalesOf(e).length === 0) return null;
|
|
1367
|
+
let t = new Intl.PluralRules(e);
|
|
1368
|
+
return {
|
|
1369
|
+
rules: t,
|
|
1370
|
+
categories: t.resolvedOptions().pluralCategories.slice().sort((e, t) => cn.indexOf(e) - cn.indexOf(t))
|
|
1371
|
+
};
|
|
1372
|
+
} catch {
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
function un(e) {
|
|
1377
|
+
let t = Q.get(e);
|
|
1378
|
+
return t === void 0 && (t = ln(e), Q.size >= 1e3 && Q.delete(Q.keys().next().value), Q.set(e, t)), t;
|
|
1379
|
+
}
|
|
1380
|
+
function dn(e) {
|
|
1381
|
+
return a(e.pluralIndex) ? e.pluralIndex : a(e.named?.count) ? e.named.count : a(e.named?.n) ? e.named.n : -1;
|
|
1382
|
+
}
|
|
1383
|
+
function fn(e = {}) {
|
|
1384
|
+
let t = e.locale, n = dn(e), r;
|
|
1385
|
+
r = v(t) && e.pluralRules && _(m(e.pluralRules, t)) ? e.pluralRules[t] : v(t) && typeof Intl < `u` && Intl.PluralRules !== void 0 ? (e, n) => {
|
|
1386
|
+
let r = un(t);
|
|
1387
|
+
if (r === null || n > r.categories.length) return sn(e, n);
|
|
1388
|
+
let { rules: i, categories: a } = r, o = i.select(Math.abs(e)), s = a.indexOf(o);
|
|
1389
|
+
return Math.min(s === -1 ? n - 1 : s, n - 1);
|
|
1390
|
+
} : sn;
|
|
1391
|
+
let i = r === sn ? void 0 : sn, o = (e) => e[r(n, e.length, i)], s = e.list || [], c = (e) => s[e], u = e.named || d(), f = a(e.pluralIndex), p = (t) => {
|
|
1392
|
+
let n = h(t) ? m(u, t) : u[t];
|
|
1393
|
+
return f && n == null && (t === `count` || t === `n`) ? e.pluralIndex : n;
|
|
1394
|
+
};
|
|
1395
|
+
function y(t, n) {
|
|
1396
|
+
return (_(e.messages) ? e.messages(t, !!n) : b(e.messages) ? e.messages[t] : !1) || (e.parent ? e.parent.message(t) : nn);
|
|
1397
|
+
}
|
|
1398
|
+
let x = (t) => e.modifiers ? m(e.modifiers, t) : tn, S = _(e.processor?.normalize) ? e.processor.normalize : an, C = _(e.processor?.interpolate) ? e.processor.interpolate : on, w = {
|
|
1399
|
+
list: c,
|
|
1400
|
+
named: p,
|
|
1401
|
+
plural: o,
|
|
1402
|
+
linked: (e, ...t) => {
|
|
1403
|
+
let [n, r] = t, i = `text`, a = ``;
|
|
1404
|
+
t.length === 1 ? b(n) ? (a = n.modifier || a, i = n.type || i) : v(n) && (a = n || a) : t.length === 2 && (v(n) && (a = n || a), v(r) && (i = r || i));
|
|
1405
|
+
let o = y(e, !0)(w), s = o === `` || o === void 0 ? e : o, c = i === `vnode` && g(s) && a ? s[0] : s;
|
|
1406
|
+
if (!a) return c;
|
|
1407
|
+
let l = x(a);
|
|
1408
|
+
return _(l) ? l(c, i) : c;
|
|
1409
|
+
},
|
|
1410
|
+
message: y,
|
|
1411
|
+
type: v(e.processor?.type) ? e.processor.type : rn,
|
|
1412
|
+
interpolate: C,
|
|
1413
|
+
normalize: S,
|
|
1414
|
+
values: l(d(), s, u, f ? {
|
|
1415
|
+
count: p(`count`),
|
|
1416
|
+
n: p(`n`)
|
|
1417
|
+
} : {})
|
|
1418
|
+
};
|
|
1419
|
+
return w;
|
|
1420
|
+
}
|
|
1421
|
+
let pn = () => ``, $ = (e) => _(e), mn = (e) => v(e) || H(e) || $(e);
|
|
1422
|
+
function hn(e, ...t) {
|
|
1423
|
+
let [n, r] = yn(...t), i = Qe(e, r), a = y(r.escapeParameter) ? r.escapeParameter : e.escapeParameter;
|
|
1424
|
+
a && gn(r);
|
|
1425
|
+
let o = !!r.resolvedMessage, [s, c, l] = o ? [
|
|
1426
|
+
n,
|
|
1427
|
+
i,
|
|
1428
|
+
m(e.messages, i) || d()
|
|
1429
|
+
] : _n(e, n, i, e.fallbackLocale, y(r.fallbackWarn) ? r.fallbackWarn : e.fallbackWarn, y(r.missingWarn) ? r.missingWarn : e.missingWarn), u = n;
|
|
1430
|
+
if (!o && !mn(s)) {
|
|
1431
|
+
let t = v(r.default) ? r.default : y(r.default) || e.fallbackFormat ? e.messageCompiler ? n : () => n : null;
|
|
1432
|
+
(e.fallbackFormat || t != null && (v(t) || _(t))) && (s = t, u = s);
|
|
1433
|
+
}
|
|
1434
|
+
if (!o && (!mn(s) || !v(c))) return e.unresolving ? -1 : n;
|
|
1435
|
+
let f = !1, p = $(s) ? s : vn(e, n, c, s, u, () => {
|
|
1436
|
+
f = !0;
|
|
1437
|
+
});
|
|
1438
|
+
if (f) return s;
|
|
1439
|
+
let h = p(fn(xn(e, c, l, r))), g = e.postTranslation ? e.postTranslation(h, n) : h;
|
|
1440
|
+
return a && v(g) && (g = F(g)), g;
|
|
1441
|
+
}
|
|
1442
|
+
function gn(e) {
|
|
1443
|
+
if (g(e.list) && (e.list = e.list.map((e) => v(e) ? D(e) : e)), b(e.named)) {
|
|
1444
|
+
let t = e.named, n = d();
|
|
1445
|
+
for (let e of Object.keys(t)) {
|
|
1446
|
+
let r = t[e];
|
|
1447
|
+
n[e] = v(r) ? D(r) : r;
|
|
1448
|
+
}
|
|
1449
|
+
e.named = n;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
function _n(e, t, n, r, i, a) {
|
|
1453
|
+
let { messages: o, onWarn: s, messageResolver: c, localeFallbacker: l } = e, u = l(e, r, n), f = d(), p, h = null;
|
|
1454
|
+
for (let n = 0; n < u.length && (p = u[n], f = m(o, p) || d(), (h = c(f, t)) === null && (h = m(f, t)), !mn(h)); n++) if (!zt(p, u)) {
|
|
1455
|
+
let n = Ft(e, t, p, a, `translate`);
|
|
1456
|
+
n !== t && (h = n);
|
|
1457
|
+
}
|
|
1458
|
+
return [
|
|
1459
|
+
h,
|
|
1460
|
+
p,
|
|
1461
|
+
f
|
|
1462
|
+
];
|
|
1463
|
+
}
|
|
1464
|
+
function vn(e, t, n, r, i, a) {
|
|
1465
|
+
if ($(r)) {
|
|
1466
|
+
let e = r;
|
|
1467
|
+
return e.locale = e.locale || n, e.key = e.key || t, e;
|
|
1468
|
+
}
|
|
1469
|
+
if (e.messageCompiler == null) {
|
|
1470
|
+
let e = (() => r);
|
|
1471
|
+
return e.locale = n, e.key = t, e;
|
|
1472
|
+
}
|
|
1473
|
+
let o = e.messageCompiler(r, bn(e, n, i, r, e.warnHtmlMessage, a));
|
|
1474
|
+
return o.locale = n, o.key = t, o.source = r, o;
|
|
1475
|
+
}
|
|
1476
|
+
function yn(...e) {
|
|
1477
|
+
let [t, n, r] = e;
|
|
1478
|
+
if (!v(t) && !a(t) && !$(t) && !H(t)) throw J(q.INVALID_ARGUMENT);
|
|
1479
|
+
let i = a(t) ? String(t) : ($(t), t), o = d();
|
|
1480
|
+
return a(n) ? o.plural = n : v(n) ? o.default = n : w(n) && !c(n) ? o.named = n : g(n) && (o.list = n), a(r) ? o.plural = r : v(r) ? o.default = r : w(r) && l(o, r), [i, o];
|
|
1481
|
+
}
|
|
1482
|
+
function bn(e, t, n, i, a, o) {
|
|
1483
|
+
return {
|
|
1484
|
+
locale: t,
|
|
1485
|
+
key: n,
|
|
1486
|
+
warnHtmlMessage: a,
|
|
1487
|
+
onError: (e) => {
|
|
1488
|
+
throw o?.(e), e;
|
|
1489
|
+
},
|
|
1490
|
+
onCacheKey: (e) => r(t, n, e)
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
function xn(e, t, n, r) {
|
|
1494
|
+
let { modifiers: i, pluralRules: o, messageResolver: s, fallbackLocale: c, fallbackWarn: l, missingWarn: u, fallbackContext: d } = e;
|
|
1495
|
+
return {
|
|
1496
|
+
locale: t,
|
|
1497
|
+
modifiers: i,
|
|
1498
|
+
pluralRules: o,
|
|
1499
|
+
messages: (r, i) => {
|
|
1500
|
+
let a = s(n, r);
|
|
1501
|
+
if (a == null && (d || i)) {
|
|
1502
|
+
let [n, , i] = _n(d || e, r, t, c, l, u);
|
|
1503
|
+
a = n ?? s(i, r);
|
|
1504
|
+
}
|
|
1505
|
+
if (v(a) || H(a)) {
|
|
1506
|
+
let n = !1, i = vn(e, r, t, a, r, () => {
|
|
1507
|
+
n = !0;
|
|
1508
|
+
});
|
|
1509
|
+
return n ? pn : i;
|
|
1510
|
+
}
|
|
1511
|
+
return $(a) ? a : pn;
|
|
1512
|
+
},
|
|
1513
|
+
processor: e.processor ?? void 0,
|
|
1514
|
+
list: r.list ?? void 0,
|
|
1515
|
+
named: r.named ?? void 0,
|
|
1516
|
+
pluralIndex: a(r.plural) ? r.plural : void 0
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
return e.AST_NODE_PROPS_KEYS = Ue, e.CORE_ERROR_CODES_EXTEND_POINT = 23, e.CORE_WARN_CODES_EXTEND_POINT = 13, e.CoreWarnCodes = X, e.DATETIME_FORMAT_OPTIONS_KEYS = Jt, e.DEFAULT_LOCALE = Z, e.DEFAULT_MESSAGE_DATA_TYPE = rn, e.MISSING_RESOLVE_VALUE = ``, e.NOT_RESOLVED = -1, e.NUMBER_FORMAT_OPTIONS_KEYS = Qt, e.VERSION = _t, e.clearCompileCache = Ye, e.clearDateTimeFormat = Xt, e.clearNumberFormat = en, e.compile = Ze, e.createCompileError = z, e.createCoreContext = Dt, e.createCoreError = J, e.createMessageContext = fn, e.datetime = qt, e.fallbackWithLocaleChain = nt, e.fallbackWithSimple = tt, e.getLocale = Qe, e.getLocaleMessage = kt, e.getWarnMessage = gt, e.handleMissing = Ft, e.isAlmostSameLocale = Rt, e.isFallbackLocale = jt, e.isImplicitFallback = zt, e.isMessageAST = H, e.isMessageFormat = mn, e.isMessageFunction = $, e.isTranslateFallbackWarn = Nt, e.isTranslateMissingWarn = Pt, e.isWarnOption = Mt, e.number = Zt, e.parse = dt, e.parseDateTimeArgs = Yt, e.parseNumberArgs = $t, e.parseTranslateArgs = yn, e.registerLocaleFallbacker = Tt, e.registerMessageCompiler = xt, e.registerMessageResolver = Ct, e.resolveLocale = et, e.resolveValue = mt, e.resolveWithKeyValue = pt, e.setLocaleMessage = At, e.translate = hn, e.updateFallbackLocale = Lt, e;
|
|
1520
|
+
})({});
|