@intlify/message-compiler 12.0.0-alpha.2 → 12.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/message-compiler.d.ts +189 -230
- package/dist/message-compiler.esm-browser.js +1216 -1481
- package/dist/message-compiler.esm-browser.prod.js +788 -6
- package/dist/message-compiler.esm-bundler.js +1 -1
- package/dist/message-compiler.global.js +1295 -1561
- package/dist/message-compiler.global.prod.js +803 -6
- package/dist/message-compiler.js +1200 -1464
- package/dist/message-compiler.node.js +1242 -1517
- package/package.json +38 -38
|
@@ -1,6 +1,803 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var IntlifyMessageCompiler=function(e){"use strict";const t=Object.assign,n=e=>"string"==typeof e;function r(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}function c(e,t,n){return{line:e,column:t,offset:n}}function o(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const s={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},u={[s.EXPECTED_TOKEN]:"Expected token: '{0}'",[s.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[s.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[s.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[s.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[s.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[s.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[s.EMPTY_PLACEHOLDER]:"Empty placeholder",[s.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[s.INVALID_LINKED_FORMAT]:"Invalid linked format",[s.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[s.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[s.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[s.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[s.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[s.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function a(e,t,n={}){const{domain:r,messages:c,args:o}=n,s=new SyntaxError(String(e));return s.code=e,t&&(s.location=t),s.domain=r,s}function i(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?i(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const c=t.cases.length;for(let n=0;n<c&&(i(e,t.cases[n]),n!==c-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const c=t.items.length;for(let o=0;o<c&&(i(e,t.items[o]),o!==c-1);o++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),i(e,t.key),t.modifier?(e.push(", "),i(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t)}}function l(e){switch(e.t=e.type,e.type){case 0:{const t=e;l(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++)l(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++)l(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;l(t.key),t.k=t.key,delete t.key,t.modifier&&(l(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 E(e){const t=e.body;return 2===t.type?f(t):t.cases.forEach((e=>f(e))),e}function f(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=r(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 L=" ",d="\r",N="\n",_=String.fromCharCode(8232),p=String.fromCharCode(8233);function C(e){const t=e;let n=0,r=1,c=1,o=0;const s=e=>t[e]===d&&t[e+1]===N,u=e=>t[e]===p,a=e=>t[e]===_,i=e=>s(e)||(e=>t[e]===N)(e)||u(e)||a(e),l=e=>s(e)||u(e)||a(e)?N:t[e];function E(){return o=0,i(n)&&(r++,c=0),s(n)&&n++,n++,c++,t[n]}return{index:()=>n,line:()=>r,column:()=>c,peekOffset:()=>o,charAt:l,currentChar:()=>l(n),currentPeek:()=>l(n+o),next:E,peek:function(){return s(n+o)&&o++,o++,t[n+o]},reset:function(){n=0,r=1,c=1,o=0},resetPeek:function(e=0){o=e},skipToPeek:function(){const e=n+o;for(;e!==n;)E();o=0}}}const A=void 0,T="'";function k(e,t={}){const n=!1!==t.location,r=C(e),u=()=>r.index(),a=()=>c(r.line(),r.column(),r.index()),i=a(),l=u(),E={currentType:13,offset:l,startLoc:i,endLoc:i,lastType:13,lastOffset:l,lastStartLoc:i,lastEndLoc:i,braceNest:0,inLinked:!1,text:""},f=()=>E,{onError:d}=t;function _(e,t,r){e.endLoc=a(),e.currentType=t;const c={type:t};return n&&(c.loc=o(e.startLoc,e.endLoc)),null!=r&&(c.value=r),c}const p=e=>_(e,13);function k(e,t){return e.currentChar()===t?(e.next(),t):(s.EXPECTED_TOKEN,a(),"")}function I(e){let t="";for(;e.currentPeek()===L||e.currentPeek()===N;)t+=e.currentPeek(),e.peek();return t}function h(e){const t=I(e);return e.skipToPeek(),t}function P(e){if(e===A)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function S(e,t){const{currentType:n}=t;if(2!==n)return!1;I(e);const r=function(e){if(e===A)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function y(e){I(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function D(e,t=!0){const n=(t=!1,r="")=>{const c=e.currentPeek();return"{"===c?t:"@"!==c&&c?"|"===c?!(r===L||r===N):c===L?(e.peek(),n(!0,L)):c!==N||(e.peek(),n(!0,N)):t},r=n();return t&&e.resetPeek(),r}function O(e,t){const n=e.currentChar();return n===A?A:t(n)?(e.next(),n):null}function m(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}function b(e){return O(e,m)}function U(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 x(e){return O(e,U)}function R(e){const t=e.charCodeAt(0);return t>=48&&t<=57}function v(e){return O(e,R)}function M(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function g(e){return O(e,M)}function X(e){let t="",n="";for(;t=v(e);)n+=t;return n}function Y(e){return e!==T&&e!==N}function K(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return w(e,t,4);case"U":return w(e,t,6);default:return s.UNKNOWN_ESCAPE_SEQUENCE,a(),""}}function w(e,t,n){k(e,t);let r="";for(let c=0;c<n;c++){const t=g(e);if(!t){s.INVALID_UNICODE_ESCAPE_SEQUENCE,a(),e.currentChar();break}r+=t}return`\\${t}${r}`}function H(e){return"{"!==e&&"}"!==e&&e!==L&&e!==N}function G(e){h(e);const t=k(e,"|");return h(e),t}function $(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(s.NOT_ALLOW_NEST_PLACEHOLDER,a()),e.next(),n=_(t,2,"{"),h(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&(s.EMPTY_PLACEHOLDER,a()),e.next(),n=_(t,3,"}"),t.braceNest--,t.braceNest>0&&h(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&(s.UNTERMINATED_CLOSING_BRACE,a()),n=B(e,t)||p(t),t.braceNest=0,n;default:{let r=!0,c=!0,o=!0;if(y(e))return t.braceNest>0&&(s.UNTERMINATED_CLOSING_BRACE,a()),n=_(t,1,G(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(4===t.currentType||5===t.currentType||6===t.currentType))return s.UNTERMINATED_CLOSING_BRACE,a(),t.braceNest=0,V(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;I(e);const r=P(e.currentPeek());return e.resetPeek(),r}(e,t))return n=_(t,4,function(e){h(e);let t="",n="";for(;t=x(e);)n+=t;return e.currentChar()===A&&(s.UNTERMINATED_CLOSING_BRACE,a()),n}(e)),h(e),n;if(c=S(e,t))return n=_(t,5,function(e){h(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${X(e)}`):t+=X(e),e.currentChar()===A&&(s.UNTERMINATED_CLOSING_BRACE,a()),t}(e)),h(e),n;if(o=function(e,t){const{currentType:n}=t;if(2!==n)return!1;I(e);const r=e.currentPeek()===T;return e.resetPeek(),r}(e,t))return n=_(t,6,function(e){h(e),k(e,"'");let t="",n="";for(;t=O(e,Y);)n+="\\"===t?K(e):t;const r=e.currentChar();return r===N||r===A?(s.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,a(),r===N&&(e.next(),k(e,"'")),n):(k(e,"'"),n)}(e)),h(e),n;if(!r&&!c&&!o)return n=_(t,12,function(e){h(e);let t="",n="";for(;t=O(e,H);)n+=t;return n}(e)),s.INVALID_TOKEN_IN_PLACEHOLDER,a(),n.value,h(e),n;break}}return n}function B(e,t){const{currentType:n}=t;let r=null;const c=e.currentChar();switch(7!==n&&8!==n&&11!==n&&9!==n||c!==N&&c!==L||(s.INVALID_LINKED_FORMAT,a()),c){case"@":return e.next(),r=_(t,7,"@"),t.inLinked=!0,r;case".":return h(e),e.next(),_(t,8,".");case":":return h(e),e.next(),_(t,9,":");default:return y(e)?(r=_(t,1,G(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(7!==n)return!1;I(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;I(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(h(e),B(e,t)):function(e,t){const{currentType:n}=t;if(8!==n)return!1;I(e);const r=P(e.currentPeek());return e.resetPeek(),r}(e,t)?(h(e),_(t,11,function(e){let t="",n="";for(;t=b(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===L||!t)&&(t===N?(e.peek(),r()):D(e,!1))},c=r();return e.resetPeek(),c}(e,t)?(h(e),"{"===c?$(e,t)||r:_(t,10,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"@"!==r&&"|"!==r&&"("!==r&&")"!==r&&r?r===L?n:(n+=r,e.next(),t(n)):n};return t("")}(e))):(7===n&&(s.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 $(e,t)||p(t);if(t.inLinked)return B(e,t)||p(t);switch(e.currentChar()){case"{":return $(e,t)||p(t);case"}":return s.UNBALANCED_CLOSING_BRACE,a(),e.next(),_(t,3,"}");case"@":return B(e,t)||p(t);default:if(y(e))return n=_(t,1,G(e)),t.braceNest=0,t.inLinked=!1,n;if(D(e))return _(t,0,function(e){let t="";for(;;){const n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if(n===L||n===N)if(D(e))t+=n,e.next();else{if(y(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}=E;return E.lastType=e,E.lastOffset=t,E.lastStartLoc=n,E.lastEndLoc=c,E.offset=u(),E.startLoc=a(),r.currentChar()===A?_(E,13):V(r,E)},currentOffset:u,currentPosition:a,context:f}}const I="parser",h=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function P(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 S(e={}){const n=!1!==e.location,{onError:r}=e;function c(e,t,r){const c={type:e};return n&&(c.start=t,c.end=t,c.loc={start:r,end:r}),c}function o(e,t,r,c){n&&(e.end=t,e.loc&&(e.loc.end=r))}function u(e,t){const n=e.context(),r=c(3,n.offset,n.startLoc);return r.value=t,o(r,e.currentOffset(),e.currentPosition()),r}function a(e,t){const n=e.context(),{lastOffset:r,lastStartLoc:s}=n,u=c(5,r,s);return u.index=parseInt(t,10),e.nextToken(),o(u,e.currentOffset(),e.currentPosition()),u}function i(e,t){const n=e.context(),{lastOffset:r,lastStartLoc:s}=n,u=c(4,r,s);return u.key=t,e.nextToken(),o(u,e.currentOffset(),e.currentPosition()),u}function l(e,t){const n=e.context(),{lastOffset:r,lastStartLoc:s}=n,u=c(9,r,s);return u.value=t.replace(h,P),e.nextToken(),o(u,e.currentOffset(),e.currentPosition()),u}function E(e){const t=e.context(),n=c(6,t.offset,t.startLoc);let r=e.nextToken();if(8===r.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:r,lastStartLoc:u}=n,a=c(8,r,u);return 11!==t.type?(s.UNEXPECTED_EMPTY_LINKED_MODIFIER,n.lastStartLoc,a.value="",o(a,r,u),{nextConsumeToken:t,node:a}):(null==t.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,y(t)),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,r=t.nextConsumeToken||e.nextToken()}switch(9!==r.type&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(r)),r=e.nextToken(),2===r.type&&(r=e.nextToken()),r.type){case 10:null==r.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(r)),n.key=function(e,t){const n=e.context(),r=c(7,n.offset,n.startLoc);return r.value=t,o(r,e.currentOffset(),e.currentPosition()),r}(e,r.value||"");break;case 4:null==r.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(r)),n.key=i(e,r.value||"");break;case 5:null==r.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(r)),n.key=a(e,r.value||"");break;case 6:null==r.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(r)),n.key=l(e,r.value||"");break;default:{s.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const u=e.context(),a=c(7,u.offset,u.startLoc);return a.value="",o(a,u.offset,u.startLoc),n.key=a,o(n,u.offset,u.startLoc),{nextConsumeToken:r,node:n}}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=c(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let r=null;do{const c=r||e.nextToken();switch(r=null,c.type){case 0:null==c.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(c)),n.items.push(u(e,c.value||""));break;case 5:null==c.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(c)),n.items.push(a(e,c.value||""));break;case 4:null==c.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(c)),n.items.push(i(e,c.value||""));break;case 6:null==c.value&&(s.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,y(c)),n.items.push(l(e,c.value||""));break;case 7:{const t=E(e);n.items.push(t.node),r=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 L(e){const t=e.context(),{offset:n,startLoc:r}=t,u=f(e);return 13===t.currentType?u:function(e,t,n,r){const u=e.context();let a=0===r.items.length;const i=c(1,t,n);i.cases=[],i.cases.push(r);do{const t=f(e);a||(a=0===t.items.length),i.cases.push(t)}while(13!==u.currentType);return a&&s.MUST_HAVE_MESSAGES_IN_PLURAL,o(i,e.currentOffset(),e.currentPosition()),i}(e,n,r,u)}return{parse:function(r){const u=k(r,t({},e)),a=u.context(),i=c(0,a.offset,a.startLoc);return n&&i.loc&&(i.loc.source=r),i.body=L(u),e.onCacheKey&&(i.cacheKey=e.onCacheKey(r)),13!==a.currentType&&(s.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,r[a.offset]),o(i,u.currentOffset(),u.currentPosition()),i}}}function y(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 D(e,t){for(let n=0;n<e.length;n++)O(e[n],t)}function O(e,t){switch(e.type){case 1:D(e.cases,t),t.helper("plural");break;case 2:D(e.items,t);break;case 6:O(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function m(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&O(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}const b=/<\/?[\w\s="/.':;#-\/]+>/;return e.COMPILE_ERROR_CODES_EXTEND_POINT=17,e.CompileErrorCodes=s,e.ERROR_DOMAIN=I,e.LOCATION_STUB={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0}},e.baseCompile=function(e,c={}){const o=t({},c),s=!!o.jit,u=!!o.mangle,a=null==o.optimize||o.optimize,f=S(o).parse(e);return s?(a&&E(f),u&&l(f),{ast:f,code:""}):(m(f,o),((e,t={})=>{const c=n(t.mode)?t.mode:"normal",o=n(t.filename)?t.filename:"message.intl",s=!!t.sourceMap,u=null!=t.breakLineCode?t.breakLineCode:"arrow"===c?";":"\n",a=t.needIndent?t.needIndent:"arrow"!==c,l=e.helpers||[],E=function(e,t){const{sourceMap:n,filename:r,breakLineCode:c,needIndent:o}=t,s=!1!==t.location,u={filename:r,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:c,needIndent:o,indentLevel:0};function a(e,t){u.code+=e}function i(e,t=!0){const n=t?c:"";a(o?n+" ".repeat(e):n)}return s&&e.loc&&(u.source=e.loc.source),{context:()=>u,push:a,indent:function(e=!0){const t=++u.indentLevel;e&&i(t)},deindent:function(e=!0){const t=--u.indentLevel;e&&i(t)},newline:function(){i(u.indentLevel)},helper:e=>`_${e}`,needIndent:()=>u.needIndent}}(e,{mode:c,filename:o,sourceMap:s,breakLineCode:u,needIndent:a});E.push("normal"===c?"function __msg__ (ctx) {":"(ctx) => {"),E.indent(a),l.length>0&&(E.push(`const { ${r(l.map((e=>`${e}: _${e}`)),", ")} } = ctx`),E.newline()),E.push("return "),i(E,e),E.deindent(a),E.push("}"),delete e.helpers;const{code:f,map:L}=E.context();return{ast:e,code:f,map:L?L.toJSON():void 0}})(f,o))},e.createCompileError=a,e.createLocation=o,e.createParser=S,e.createPosition=c,e.defaultOnError=function(e){throw e},e.detectHtmlTag=e=>b.test(e),e.errorMessages=u,e.mangle=l,e.optimize=E,e}({});
|
|
1
|
+
/**
|
|
2
|
+
* @intlify/message-compiler v12.0.0-alpha.4
|
|
3
|
+
* (c) 2016-present kazuya kawaguchi and contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/ var IntlifyMessageCompiler = (function(e) {
|
|
6
|
+
Object.defineProperty(e, Symbol.toStringTag, { value: `Module` });
|
|
7
|
+
let t = Object.assign;
|
|
8
|
+
Array.isArray;
|
|
9
|
+
let n = (e) => typeof e == `string`;
|
|
10
|
+
function r(e, t = ``) {
|
|
11
|
+
return e.reduce((e, n, r) => r === 0 ? e + n : e + t + n, ``);
|
|
12
|
+
}
|
|
13
|
+
let i = function(e) {
|
|
14
|
+
return e[e.Resource = 0] = `Resource`, e[e.Plural = 1] = `Plural`, e[e.Message = 2] = `Message`, e[e.Text = 3] = `Text`, e[e.Named = 4] = `Named`, e[e.List = 5] = `List`, e[e.Linked = 6] = `Linked`, e[e.LinkedKey = 7] = `LinkedKey`, e[e.LinkedModifier = 8] = `LinkedModifier`, e[e.Literal = 9] = `Literal`, e;
|
|
15
|
+
}({}), a = {
|
|
16
|
+
start: {
|
|
17
|
+
line: 1,
|
|
18
|
+
column: 1,
|
|
19
|
+
offset: 0
|
|
20
|
+
},
|
|
21
|
+
end: {
|
|
22
|
+
line: 1,
|
|
23
|
+
column: 1,
|
|
24
|
+
offset: 0
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function o(e, t, n) {
|
|
28
|
+
return {
|
|
29
|
+
line: e,
|
|
30
|
+
column: t,
|
|
31
|
+
offset: n
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function s(e, t, n) {
|
|
35
|
+
let r = {
|
|
36
|
+
start: e,
|
|
37
|
+
end: t
|
|
38
|
+
};
|
|
39
|
+
return n != null && (r.source = n), r;
|
|
40
|
+
}
|
|
41
|
+
let c = function(e) {
|
|
42
|
+
return e.LIST = `list`, e.NAMED = `named`, e.PLURAL = `plural`, e.LINKED = `linked`, e.MESSAGE = `message`, e.TYPE = `type`, e.INTERPOLATE = `interpolate`, e.NORMALIZE = `normalize`, e.VALUES = `values`, e;
|
|
43
|
+
}({}), l = /<[\w\s=":;#-/]+>/, u = (e) => l.test(e), d = {
|
|
44
|
+
EXPECTED_TOKEN: 1,
|
|
45
|
+
INVALID_TOKEN_IN_PLACEHOLDER: 2,
|
|
46
|
+
UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3,
|
|
47
|
+
UNKNOWN_ESCAPE_SEQUENCE: 4,
|
|
48
|
+
INVALID_UNICODE_ESCAPE_SEQUENCE: 5,
|
|
49
|
+
UNBALANCED_CLOSING_BRACE: 6,
|
|
50
|
+
UNTERMINATED_CLOSING_BRACE: 7,
|
|
51
|
+
EMPTY_PLACEHOLDER: 8,
|
|
52
|
+
NOT_ALLOW_NEST_PLACEHOLDER: 9,
|
|
53
|
+
INVALID_LINKED_FORMAT: 10,
|
|
54
|
+
MUST_HAVE_MESSAGES_IN_PLURAL: 11,
|
|
55
|
+
UNEXPECTED_EMPTY_LINKED_MODIFIER: 12,
|
|
56
|
+
UNEXPECTED_EMPTY_LINKED_KEY: 13,
|
|
57
|
+
UNEXPECTED_LEXICAL_ANALYSIS: 14,
|
|
58
|
+
UNHANDLED_CODEGEN_NODE_TYPE: 15,
|
|
59
|
+
UNHANDLED_MINIFIER_NODE_TYPE: 16
|
|
60
|
+
}, f = {
|
|
61
|
+
[d.EXPECTED_TOKEN]: `Expected token: '{0}'`,
|
|
62
|
+
[d.INVALID_TOKEN_IN_PLACEHOLDER]: `Invalid token in placeholder: '{0}'`,
|
|
63
|
+
[d.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]: `Unterminated single quote in placeholder`,
|
|
64
|
+
[d.UNKNOWN_ESCAPE_SEQUENCE]: `Unknown escape sequence: \\{0}`,
|
|
65
|
+
[d.INVALID_UNICODE_ESCAPE_SEQUENCE]: `Invalid unicode escape sequence: {0}`,
|
|
66
|
+
[d.UNBALANCED_CLOSING_BRACE]: `Unbalanced closing brace`,
|
|
67
|
+
[d.UNTERMINATED_CLOSING_BRACE]: `Unterminated closing brace`,
|
|
68
|
+
[d.EMPTY_PLACEHOLDER]: `Empty placeholder`,
|
|
69
|
+
[d.NOT_ALLOW_NEST_PLACEHOLDER]: `Not allowed nest placeholder`,
|
|
70
|
+
[d.INVALID_LINKED_FORMAT]: `Invalid linked format`,
|
|
71
|
+
[d.MUST_HAVE_MESSAGES_IN_PLURAL]: `Plural must have messages`,
|
|
72
|
+
[d.UNEXPECTED_EMPTY_LINKED_MODIFIER]: `Unexpected empty linked modifier`,
|
|
73
|
+
[d.UNEXPECTED_EMPTY_LINKED_KEY]: `Unexpected empty linked key`,
|
|
74
|
+
[d.UNEXPECTED_LEXICAL_ANALYSIS]: `Unexpected lexical analysis in token: '{0}'`,
|
|
75
|
+
[d.UNHANDLED_CODEGEN_NODE_TYPE]: `unhandled codegen node type: '{0}'`,
|
|
76
|
+
[d.UNHANDLED_MINIFIER_NODE_TYPE]: `unhandled mimifier node type: '{0}'`
|
|
77
|
+
};
|
|
78
|
+
function p(e, t, n = {}) {
|
|
79
|
+
let { domain: r, messages: i, args: a } = n, o = SyntaxError(String(e));
|
|
80
|
+
return o.code = e, t && (o.location = t), o.domain = r, o;
|
|
81
|
+
}
|
|
82
|
+
function m(e) {
|
|
83
|
+
throw e;
|
|
84
|
+
}
|
|
85
|
+
function h(e, t) {
|
|
86
|
+
let { sourceMap: n, filename: r, breakLineCode: i, needIndent: a } = t, o = t.location !== !1, s = {
|
|
87
|
+
filename: r,
|
|
88
|
+
code: ``,
|
|
89
|
+
column: 1,
|
|
90
|
+
line: 1,
|
|
91
|
+
offset: 0,
|
|
92
|
+
map: void 0,
|
|
93
|
+
breakLineCode: i,
|
|
94
|
+
needIndent: a,
|
|
95
|
+
indentLevel: 0
|
|
96
|
+
};
|
|
97
|
+
o && e.loc && (s.source = e.loc.source);
|
|
98
|
+
let c = () => s;
|
|
99
|
+
function l(e, t) {
|
|
100
|
+
s.code += e;
|
|
101
|
+
}
|
|
102
|
+
function u(e, t = !0) {
|
|
103
|
+
let n = t ? i : ``;
|
|
104
|
+
l(a ? n + ` `.repeat(e) : n);
|
|
105
|
+
}
|
|
106
|
+
function d(e = !0) {
|
|
107
|
+
let t = ++s.indentLevel;
|
|
108
|
+
e && u(t);
|
|
109
|
+
}
|
|
110
|
+
function f(e = !0) {
|
|
111
|
+
let t = --s.indentLevel;
|
|
112
|
+
e && u(t);
|
|
113
|
+
}
|
|
114
|
+
function p() {
|
|
115
|
+
u(s.indentLevel);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
context: c,
|
|
119
|
+
push: l,
|
|
120
|
+
indent: d,
|
|
121
|
+
deindent: f,
|
|
122
|
+
newline: p,
|
|
123
|
+
helper: (e) => `_${e}`,
|
|
124
|
+
needIndent: () => s.needIndent
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function g(e, t) {
|
|
128
|
+
let { helper: n } = e;
|
|
129
|
+
e.push(`${n(`linked`)}(`), b(e, t.key), t.modifier ? (e.push(`, `), b(e, t.modifier), e.push(`, _type`)) : e.push(`, undefined, _type`), e.push(`)`);
|
|
130
|
+
}
|
|
131
|
+
function _(e, t) {
|
|
132
|
+
let { helper: n, needIndent: r } = e;
|
|
133
|
+
e.push(`${n(`normalize`)}([`), e.indent(r());
|
|
134
|
+
let i = t.items.length;
|
|
135
|
+
for (let n = 0; n < i && (b(e, t.items[n]), n !== i - 1); n++) e.push(`, `);
|
|
136
|
+
e.deindent(r()), e.push(`])`);
|
|
137
|
+
}
|
|
138
|
+
function v(e, t) {
|
|
139
|
+
let { helper: n, needIndent: r } = e;
|
|
140
|
+
if (t.cases.length > 1) {
|
|
141
|
+
e.push(`${n(`plural`)}([`), e.indent(r());
|
|
142
|
+
let i = t.cases.length;
|
|
143
|
+
for (let n = 0; n < i && (b(e, t.cases[n]), n !== i - 1); n++) e.push(`, `);
|
|
144
|
+
e.deindent(r()), e.push(`])`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function y(e, t) {
|
|
148
|
+
t.body ? b(e, t.body) : e.push(`null`);
|
|
149
|
+
}
|
|
150
|
+
function b(e, t) {
|
|
151
|
+
let { helper: n } = e;
|
|
152
|
+
switch (t.type) {
|
|
153
|
+
case 0:
|
|
154
|
+
y(e, t);
|
|
155
|
+
break;
|
|
156
|
+
case 1:
|
|
157
|
+
v(e, t);
|
|
158
|
+
break;
|
|
159
|
+
case 2:
|
|
160
|
+
_(e, t);
|
|
161
|
+
break;
|
|
162
|
+
case 6:
|
|
163
|
+
g(e, t);
|
|
164
|
+
break;
|
|
165
|
+
case 8:
|
|
166
|
+
e.push(JSON.stringify(t.value), t);
|
|
167
|
+
break;
|
|
168
|
+
case 7:
|
|
169
|
+
e.push(JSON.stringify(t.value), t);
|
|
170
|
+
break;
|
|
171
|
+
case 5:
|
|
172
|
+
e.push(`${n(`interpolate`)}(${n(`list`)}(${t.index}))`, t);
|
|
173
|
+
break;
|
|
174
|
+
case 4:
|
|
175
|
+
e.push(`${n(`interpolate`)}(${n(`named`)}(${JSON.stringify(t.key)}))`, t);
|
|
176
|
+
break;
|
|
177
|
+
case 9:
|
|
178
|
+
e.push(JSON.stringify(t.value), t);
|
|
179
|
+
break;
|
|
180
|
+
case 3:
|
|
181
|
+
e.push(JSON.stringify(t.value), t);
|
|
182
|
+
break;
|
|
183
|
+
default:
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
let x = (e, t = {}) => {
|
|
187
|
+
let i = n(t.mode) ? t.mode : `normal`, a = n(t.filename) ? t.filename : `message.intl`, o = !!t.sourceMap, s = t.breakLineCode == null ? i === `arrow` ? `;` : `
|
|
188
|
+
` : t.breakLineCode, c = t.needIndent ? t.needIndent : i !== `arrow`, l = e.helpers || [], u = h(e, {
|
|
189
|
+
mode: i,
|
|
190
|
+
filename: a,
|
|
191
|
+
sourceMap: o,
|
|
192
|
+
breakLineCode: s,
|
|
193
|
+
needIndent: c
|
|
194
|
+
});
|
|
195
|
+
u.push(i === `normal` ? `function __msg__ (ctx) {` : `(ctx) => {`), u.indent(c), l.length > 0 && (u.push(`const { ${r(l.map((e) => `${e}: _${e}`), `, `)} } = ctx`), u.newline()), u.push(`return `), b(u, e), u.deindent(c), u.push(`}`), delete e.helpers;
|
|
196
|
+
let { code: d, map: f } = u.context();
|
|
197
|
+
return {
|
|
198
|
+
ast: e,
|
|
199
|
+
code: d,
|
|
200
|
+
map: f ? f.toJSON() : void 0
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
function S(e) {
|
|
204
|
+
switch (e.t = e.type, e.type) {
|
|
205
|
+
case 0: {
|
|
206
|
+
let t = e;
|
|
207
|
+
S(t.body), t.b = t.body, delete t.body;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
case 1: {
|
|
211
|
+
let t = e, n = t.cases;
|
|
212
|
+
for (let e = 0; e < n.length; e++) S(n[e]);
|
|
213
|
+
t.c = n, delete t.cases;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
case 2: {
|
|
217
|
+
let t = e, n = t.items;
|
|
218
|
+
for (let e = 0; e < n.length; e++) S(n[e]);
|
|
219
|
+
t.i = n, delete t.items, t.static && (t.s = t.static, delete t.static);
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
case 3:
|
|
223
|
+
case 9:
|
|
224
|
+
case 8:
|
|
225
|
+
case 7: {
|
|
226
|
+
let t = e;
|
|
227
|
+
t.value && (t.v = t.value, delete t.value);
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case 6: {
|
|
231
|
+
let t = e;
|
|
232
|
+
S(t.key), t.k = t.key, delete t.key, t.modifier && (S(t.modifier), t.m = t.modifier, delete t.modifier);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case 5: {
|
|
236
|
+
let t = e;
|
|
237
|
+
t.i = t.index, delete t.index;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
case 4: {
|
|
241
|
+
let t = e;
|
|
242
|
+
t.k = t.key, delete t.key;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
default:
|
|
246
|
+
}
|
|
247
|
+
delete e.type;
|
|
248
|
+
}
|
|
249
|
+
function C(e) {
|
|
250
|
+
let t = e.body;
|
|
251
|
+
return t.type === 2 ? w(t) : t.cases.forEach((e) => w(e)), e;
|
|
252
|
+
}
|
|
253
|
+
function w(e) {
|
|
254
|
+
if (e.items.length === 1) {
|
|
255
|
+
let t = e.items[0];
|
|
256
|
+
(t.type === 3 || t.type === 9) && (e.static = t.value, delete t.value);
|
|
257
|
+
} else {
|
|
258
|
+
let t = [];
|
|
259
|
+
for (let n = 0; n < e.items.length; n++) {
|
|
260
|
+
let r = e.items[n];
|
|
261
|
+
if (!(r.type === 3 || r.type === 9) || r.value == null) break;
|
|
262
|
+
t.push(r.value);
|
|
263
|
+
}
|
|
264
|
+
if (t.length === e.items.length) {
|
|
265
|
+
e.static = r(t);
|
|
266
|
+
for (let t = 0; t < e.items.length; t++) {
|
|
267
|
+
let n = e.items[t];
|
|
268
|
+
(n.type === 3 || n.type === 9) && delete n.value;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function ee(e) {
|
|
274
|
+
let t = e, n = 0, r = 1, i = 1, a = 0, o = (e) => t[e] === `\r` && t[e + 1] === `
|
|
275
|
+
`, s = (e) => t[e] === `
|
|
276
|
+
`, 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) ? `
|
|
277
|
+
` : t[e], g = () => h(n), _ = () => h(n + a);
|
|
278
|
+
function v() {
|
|
279
|
+
return a = 0, u(n) && (r++, i = 0), o(n) && n++, n++, i++, t[n];
|
|
280
|
+
}
|
|
281
|
+
function y() {
|
|
282
|
+
return o(n + a) && a++, a++, t[n + a];
|
|
283
|
+
}
|
|
284
|
+
function b() {
|
|
285
|
+
n = 0, r = 1, i = 1, a = 0;
|
|
286
|
+
}
|
|
287
|
+
function x(e = 0) {
|
|
288
|
+
a = e;
|
|
289
|
+
}
|
|
290
|
+
function S() {
|
|
291
|
+
let e = n + a;
|
|
292
|
+
for (; e !== n;) v();
|
|
293
|
+
a = 0;
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
index: d,
|
|
297
|
+
line: f,
|
|
298
|
+
column: p,
|
|
299
|
+
peekOffset: m,
|
|
300
|
+
charAt: h,
|
|
301
|
+
currentChar: g,
|
|
302
|
+
currentPeek: _,
|
|
303
|
+
next: v,
|
|
304
|
+
peek: y,
|
|
305
|
+
reset: b,
|
|
306
|
+
resetPeek: x,
|
|
307
|
+
skipToPeek: S
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function T(e, t = {}) {
|
|
311
|
+
let n = t.location !== !1, r = ee(e), i = () => r.index(), a = () => o(r.line(), r.column(), r.index()), c = a(), l = i(), u = {
|
|
312
|
+
currentType: 13,
|
|
313
|
+
offset: l,
|
|
314
|
+
startLoc: c,
|
|
315
|
+
endLoc: c,
|
|
316
|
+
lastType: 13,
|
|
317
|
+
lastOffset: l,
|
|
318
|
+
lastStartLoc: c,
|
|
319
|
+
lastEndLoc: c,
|
|
320
|
+
braceNest: 0,
|
|
321
|
+
inLinked: !1,
|
|
322
|
+
text: ``
|
|
323
|
+
}, f = () => u, { onError: m } = t;
|
|
324
|
+
function h(e, t, r, ...i) {
|
|
325
|
+
let a = f();
|
|
326
|
+
t.column += r, t.offset += r, m && m(p(e, n ? s(a.startLoc, t) : null, {
|
|
327
|
+
domain: `tokenizer`,
|
|
328
|
+
args: i
|
|
329
|
+
}));
|
|
330
|
+
}
|
|
331
|
+
function g(e, t, r) {
|
|
332
|
+
e.endLoc = a(), e.currentType = t;
|
|
333
|
+
let i = { type: t };
|
|
334
|
+
return n && (i.loc = s(e.startLoc, e.endLoc)), r != null && (i.value = r), i;
|
|
335
|
+
}
|
|
336
|
+
let _ = (e) => g(e, 13);
|
|
337
|
+
function v(e, t) {
|
|
338
|
+
return e.currentChar() === t ? (e.next(), t) : (h(d.EXPECTED_TOKEN, a(), 0, t), ``);
|
|
339
|
+
}
|
|
340
|
+
function y(e) {
|
|
341
|
+
let t = ``;
|
|
342
|
+
for (; e.currentPeek() === ` ` || e.currentPeek() === `
|
|
343
|
+
`;) t += e.currentPeek(), e.peek();
|
|
344
|
+
return t;
|
|
345
|
+
}
|
|
346
|
+
function b(e) {
|
|
347
|
+
let t = y(e);
|
|
348
|
+
return e.skipToPeek(), t;
|
|
349
|
+
}
|
|
350
|
+
function x(e) {
|
|
351
|
+
if (e === void 0) return !1;
|
|
352
|
+
let t = e.charCodeAt(0);
|
|
353
|
+
return t >= 97 && t <= 122 || t >= 65 && t <= 90 || t === 95;
|
|
354
|
+
}
|
|
355
|
+
function S(e) {
|
|
356
|
+
if (e === void 0) return !1;
|
|
357
|
+
let t = e.charCodeAt(0);
|
|
358
|
+
return t >= 48 && t <= 57;
|
|
359
|
+
}
|
|
360
|
+
function C(e, t) {
|
|
361
|
+
let { currentType: n } = t;
|
|
362
|
+
if (n !== 2) return !1;
|
|
363
|
+
y(e);
|
|
364
|
+
let r = x(e.currentPeek());
|
|
365
|
+
return e.resetPeek(), r;
|
|
366
|
+
}
|
|
367
|
+
function w(e, t) {
|
|
368
|
+
let { currentType: n } = t;
|
|
369
|
+
if (n !== 2) return !1;
|
|
370
|
+
y(e);
|
|
371
|
+
let r = S(e.currentPeek() === `-` ? e.peek() : e.currentPeek());
|
|
372
|
+
return e.resetPeek(), r;
|
|
373
|
+
}
|
|
374
|
+
function T(e, t) {
|
|
375
|
+
let { currentType: n } = t;
|
|
376
|
+
if (n !== 2) return !1;
|
|
377
|
+
y(e);
|
|
378
|
+
let r = e.currentPeek() === `'`;
|
|
379
|
+
return e.resetPeek(), r;
|
|
380
|
+
}
|
|
381
|
+
function E(e, t) {
|
|
382
|
+
let { currentType: n } = t;
|
|
383
|
+
if (n !== 7) return !1;
|
|
384
|
+
y(e);
|
|
385
|
+
let r = e.currentPeek() === `.`;
|
|
386
|
+
return e.resetPeek(), r;
|
|
387
|
+
}
|
|
388
|
+
function D(e, t) {
|
|
389
|
+
let { currentType: n } = t;
|
|
390
|
+
if (n !== 8) return !1;
|
|
391
|
+
y(e);
|
|
392
|
+
let r = x(e.currentPeek());
|
|
393
|
+
return e.resetPeek(), r;
|
|
394
|
+
}
|
|
395
|
+
function O(e, t) {
|
|
396
|
+
let { currentType: n } = t;
|
|
397
|
+
if (!(n === 7 || n === 11)) return !1;
|
|
398
|
+
y(e);
|
|
399
|
+
let r = e.currentPeek() === `:`;
|
|
400
|
+
return e.resetPeek(), r;
|
|
401
|
+
}
|
|
402
|
+
function k(e, t) {
|
|
403
|
+
let { currentType: n } = t;
|
|
404
|
+
if (n !== 9) return !1;
|
|
405
|
+
let r = () => {
|
|
406
|
+
let t = e.currentPeek();
|
|
407
|
+
return t === `{` ? x(e.peek()) : t === `@` || t === `|` || t === `:` || t === `.` || t === ` ` || !t ? !1 : t === `
|
|
408
|
+
` ? (e.peek(), r()) : j(e, !1);
|
|
409
|
+
}, i = r();
|
|
410
|
+
return e.resetPeek(), i;
|
|
411
|
+
}
|
|
412
|
+
function A(e) {
|
|
413
|
+
y(e);
|
|
414
|
+
let t = e.currentPeek() === `|`;
|
|
415
|
+
return e.resetPeek(), t;
|
|
416
|
+
}
|
|
417
|
+
function j(e, t = !0) {
|
|
418
|
+
let n = (t = !1, r = ``) => {
|
|
419
|
+
let i = e.currentPeek();
|
|
420
|
+
return i === `{` || i === `@` || !i ? t : i === `|` ? !(r === ` ` || r === `
|
|
421
|
+
`) : i === ` ` ? (e.peek(), n(!0, ` `)) : i === `
|
|
422
|
+
` ? (e.peek(), n(!0, `
|
|
423
|
+
`)) : !0;
|
|
424
|
+
}, r = n();
|
|
425
|
+
return t && e.resetPeek(), r;
|
|
426
|
+
}
|
|
427
|
+
function M(e, t) {
|
|
428
|
+
let n = e.currentChar();
|
|
429
|
+
if (n !== void 0) return t(n) ? (e.next(), n) : null;
|
|
430
|
+
}
|
|
431
|
+
function N(e) {
|
|
432
|
+
let t = e.charCodeAt(0);
|
|
433
|
+
return t >= 97 && t <= 122 || t >= 65 && t <= 90 || t >= 48 && t <= 57 || t === 95 || t === 36;
|
|
434
|
+
}
|
|
435
|
+
function P(e) {
|
|
436
|
+
return M(e, N);
|
|
437
|
+
}
|
|
438
|
+
function F(e) {
|
|
439
|
+
let t = e.charCodeAt(0);
|
|
440
|
+
return t >= 97 && t <= 122 || t >= 65 && t <= 90 || t >= 48 && t <= 57 || t === 95 || t === 36 || t === 45;
|
|
441
|
+
}
|
|
442
|
+
function I(e) {
|
|
443
|
+
return M(e, F);
|
|
444
|
+
}
|
|
445
|
+
function L(e) {
|
|
446
|
+
let t = e.charCodeAt(0);
|
|
447
|
+
return t >= 48 && t <= 57;
|
|
448
|
+
}
|
|
449
|
+
function R(e) {
|
|
450
|
+
return M(e, L);
|
|
451
|
+
}
|
|
452
|
+
function z(e) {
|
|
453
|
+
let t = e.charCodeAt(0);
|
|
454
|
+
return t >= 48 && t <= 57 || t >= 65 && t <= 70 || t >= 97 && t <= 102;
|
|
455
|
+
}
|
|
456
|
+
function B(e) {
|
|
457
|
+
return M(e, z);
|
|
458
|
+
}
|
|
459
|
+
function V(e) {
|
|
460
|
+
let t = ``, n = ``;
|
|
461
|
+
for (; t = R(e);) n += t;
|
|
462
|
+
return n;
|
|
463
|
+
}
|
|
464
|
+
function H(e) {
|
|
465
|
+
let t = ``;
|
|
466
|
+
for (;;) {
|
|
467
|
+
let n = e.currentChar();
|
|
468
|
+
if (n === `\\`) {
|
|
469
|
+
let r = e.peek();
|
|
470
|
+
r === `{` || r === `}` || r === `@` || r === `|` || r === `\\` ? (t += n + r, e.next(), e.next()) : (e.resetPeek(), t += n, e.next());
|
|
471
|
+
} else if (n === `{` || n === `}` || n === `@` || n === `|` || !n) break;
|
|
472
|
+
else if (n === ` ` || n === `
|
|
473
|
+
`) if (j(e)) t += n, e.next();
|
|
474
|
+
else if (A(e)) break;
|
|
475
|
+
else t += n, e.next();
|
|
476
|
+
else t += n, e.next();
|
|
477
|
+
}
|
|
478
|
+
return t;
|
|
479
|
+
}
|
|
480
|
+
function U(e) {
|
|
481
|
+
b(e);
|
|
482
|
+
let t = ``, n = ``;
|
|
483
|
+
for (; t = I(e);) n += t;
|
|
484
|
+
let r = e.currentChar();
|
|
485
|
+
if (r && r !== `}` && r !== void 0 && r !== ` ` && r !== `
|
|
486
|
+
` && r !== ` `) {
|
|
487
|
+
let t = Y(e);
|
|
488
|
+
return h(d.INVALID_TOKEN_IN_PLACEHOLDER, a(), 0, n + t), n + t;
|
|
489
|
+
}
|
|
490
|
+
return e.currentChar() === void 0 && h(d.UNTERMINATED_CLOSING_BRACE, a(), 0), n;
|
|
491
|
+
}
|
|
492
|
+
function W(e) {
|
|
493
|
+
b(e);
|
|
494
|
+
let t = ``;
|
|
495
|
+
return e.currentChar() === `-` ? (e.next(), t += `-${V(e)}`) : t += V(e), e.currentChar() === void 0 && h(d.UNTERMINATED_CLOSING_BRACE, a(), 0), t;
|
|
496
|
+
}
|
|
497
|
+
function G(e) {
|
|
498
|
+
return e !== `'` && e !== `
|
|
499
|
+
`;
|
|
500
|
+
}
|
|
501
|
+
function K(e) {
|
|
502
|
+
b(e), v(e, `'`);
|
|
503
|
+
let t = ``, n = ``;
|
|
504
|
+
for (; t = M(e, G);) t === `\\` ? n += q(e) : n += t;
|
|
505
|
+
let r = e.currentChar();
|
|
506
|
+
return r === `
|
|
507
|
+
` || r === void 0 ? (h(d.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, a(), 0), r === `
|
|
508
|
+
` && (e.next(), v(e, `'`)), n) : (v(e, `'`), n);
|
|
509
|
+
}
|
|
510
|
+
function q(e) {
|
|
511
|
+
let t = e.currentChar();
|
|
512
|
+
switch (t) {
|
|
513
|
+
case `\\`:
|
|
514
|
+
case `'`: return e.next(), `\\${t}`;
|
|
515
|
+
case `u`: return J(e, t, 4);
|
|
516
|
+
case `U`: return J(e, t, 6);
|
|
517
|
+
default: return h(d.UNKNOWN_ESCAPE_SEQUENCE, a(), 0, t), ``;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function J(e, t, n) {
|
|
521
|
+
v(e, t);
|
|
522
|
+
let r = ``;
|
|
523
|
+
for (let i = 0; i < n; i++) {
|
|
524
|
+
let n = B(e);
|
|
525
|
+
if (!n) {
|
|
526
|
+
h(d.INVALID_UNICODE_ESCAPE_SEQUENCE, a(), 0, `\\${t}${r}${e.currentChar()}`);
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
r += n;
|
|
530
|
+
}
|
|
531
|
+
return `\\${t}${r}`;
|
|
532
|
+
}
|
|
533
|
+
function te(e) {
|
|
534
|
+
return e !== `{` && e !== `}` && e !== ` ` && e !== `
|
|
535
|
+
`;
|
|
536
|
+
}
|
|
537
|
+
function Y(e) {
|
|
538
|
+
b(e);
|
|
539
|
+
let t = ``, n = ``;
|
|
540
|
+
for (; t = M(e, te);) n += t;
|
|
541
|
+
return n;
|
|
542
|
+
}
|
|
543
|
+
function ne(e) {
|
|
544
|
+
let t = ``, n = ``;
|
|
545
|
+
for (; t = P(e);) n += t;
|
|
546
|
+
return n;
|
|
547
|
+
}
|
|
548
|
+
function re(e) {
|
|
549
|
+
let t = (n) => {
|
|
550
|
+
let r = e.currentChar();
|
|
551
|
+
return r === `{` || r === `@` || r === `|` || r === `(` || r === `)` || !r || r === ` ` ? n : (n += r, e.next(), t(n));
|
|
552
|
+
};
|
|
553
|
+
return t(``);
|
|
554
|
+
}
|
|
555
|
+
function X(e) {
|
|
556
|
+
b(e);
|
|
557
|
+
let t = v(e, `|`);
|
|
558
|
+
return b(e), t;
|
|
559
|
+
}
|
|
560
|
+
function Z(e, t) {
|
|
561
|
+
let n = null;
|
|
562
|
+
switch (e.currentChar()) {
|
|
563
|
+
case `{`: return t.braceNest >= 1 && h(d.NOT_ALLOW_NEST_PLACEHOLDER, a(), 0), e.next(), n = g(t, 2, `{`), b(e), t.braceNest++, n;
|
|
564
|
+
case `}`: return t.braceNest > 0 && t.currentType === 2 && h(d.EMPTY_PLACEHOLDER, a(), 0), e.next(), n = g(t, 3, `}`), t.braceNest--, t.braceNest > 0 && b(e), t.inLinked && t.braceNest === 0 && (t.inLinked = !1), n;
|
|
565
|
+
case `@`: return t.braceNest > 0 && h(d.UNTERMINATED_CLOSING_BRACE, a(), 0), n = Q(e, t) || _(t), t.braceNest = 0, n;
|
|
566
|
+
default: {
|
|
567
|
+
let r = !0, i = !0, o = !0;
|
|
568
|
+
if (A(e)) return t.braceNest > 0 && h(d.UNTERMINATED_CLOSING_BRACE, a(), 0), n = g(t, 1, X(e)), t.braceNest = 0, t.inLinked = !1, n;
|
|
569
|
+
if (t.braceNest > 0 && (t.currentType === 4 || t.currentType === 5 || t.currentType === 6)) return h(d.UNTERMINATED_CLOSING_BRACE, a(), 0), t.braceNest = 0, $(e, t);
|
|
570
|
+
if (r = C(e, t)) return n = g(t, 4, U(e)), b(e), n;
|
|
571
|
+
if (i = w(e, t)) return n = g(t, 5, W(e)), b(e), n;
|
|
572
|
+
if (o = T(e, t)) return n = g(t, 6, K(e)), b(e), n;
|
|
573
|
+
if (!r && !i && !o) return n = g(t, 12, Y(e)), h(d.INVALID_TOKEN_IN_PLACEHOLDER, a(), 0, n.value), b(e), n;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return n;
|
|
578
|
+
}
|
|
579
|
+
function Q(e, t) {
|
|
580
|
+
let { currentType: n } = t, r = null, i = e.currentChar();
|
|
581
|
+
switch ((n === 7 || n === 8 || n === 11 || n === 9) && (i === `
|
|
582
|
+
` || i === ` `) && h(d.INVALID_LINKED_FORMAT, a(), 0), i) {
|
|
583
|
+
case `@`: return e.next(), r = g(t, 7, `@`), t.inLinked = !0, r;
|
|
584
|
+
case `.`: return b(e), e.next(), g(t, 8, `.`);
|
|
585
|
+
case `:`: return b(e), e.next(), g(t, 9, `:`);
|
|
586
|
+
default: return A(e) ? (r = g(t, 1, X(e)), t.braceNest = 0, t.inLinked = !1, r) : E(e, t) || O(e, t) ? (b(e), Q(e, t)) : D(e, t) ? (b(e), g(t, 11, ne(e))) : k(e, t) ? (b(e), i === `{` ? Z(e, t) || r : g(t, 10, re(e))) : (n === 7 && h(d.INVALID_LINKED_FORMAT, a(), 0), t.braceNest = 0, t.inLinked = !1, $(e, t));
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
function $(e, t) {
|
|
590
|
+
let n = { type: 13 };
|
|
591
|
+
if (t.braceNest > 0) return Z(e, t) || _(t);
|
|
592
|
+
if (t.inLinked) return Q(e, t) || _(t);
|
|
593
|
+
switch (e.currentChar()) {
|
|
594
|
+
case `{`: return Z(e, t) || _(t);
|
|
595
|
+
case `}`: return h(d.UNBALANCED_CLOSING_BRACE, a(), 0), e.next(), g(t, 3, `}`);
|
|
596
|
+
case `@`: return Q(e, t) || _(t);
|
|
597
|
+
default:
|
|
598
|
+
if (A(e)) return n = g(t, 1, X(e)), t.braceNest = 0, t.inLinked = !1, n;
|
|
599
|
+
if (j(e)) return g(t, 0, H(e));
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
return n;
|
|
603
|
+
}
|
|
604
|
+
function ie() {
|
|
605
|
+
let { currentType: e, offset: t, startLoc: n, endLoc: o } = u;
|
|
606
|
+
return u.lastType = e, u.lastOffset = t, u.lastStartLoc = n, u.lastEndLoc = o, u.offset = i(), u.startLoc = a(), r.currentChar() === void 0 ? g(u, 13) : $(r, u);
|
|
607
|
+
}
|
|
608
|
+
return {
|
|
609
|
+
nextToken: ie,
|
|
610
|
+
currentOffset: i,
|
|
611
|
+
currentPosition: a,
|
|
612
|
+
context: f
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
let E = `parser`, D = /\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6})/g, O = /\\([\\@{}|])/g;
|
|
616
|
+
function k(e, t) {
|
|
617
|
+
return t;
|
|
618
|
+
}
|
|
619
|
+
function A(e, t, n) {
|
|
620
|
+
switch (e) {
|
|
621
|
+
case `\\\\`: return `\\`;
|
|
622
|
+
case `\\'`: return `'`;
|
|
623
|
+
default: {
|
|
624
|
+
let e = parseInt(t || n, 16);
|
|
625
|
+
return e <= 55295 || e >= 57344 ? String.fromCodePoint(e) : `�`;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function j(e = {}) {
|
|
630
|
+
let n = e.location !== !1, { onError: r } = e;
|
|
631
|
+
function i(e, t, i, a, ...o) {
|
|
632
|
+
let c = e.currentPosition();
|
|
633
|
+
c.offset += a, c.column += a, r && r(p(t, n ? s(i, c) : null, {
|
|
634
|
+
domain: E,
|
|
635
|
+
args: o
|
|
636
|
+
}));
|
|
637
|
+
}
|
|
638
|
+
function a(e, t, r) {
|
|
639
|
+
let i = { type: e };
|
|
640
|
+
return n && (i.start = t, i.end = t, i.loc = {
|
|
641
|
+
start: r,
|
|
642
|
+
end: r
|
|
643
|
+
}), i;
|
|
644
|
+
}
|
|
645
|
+
function o(e, t, r, i) {
|
|
646
|
+
i && (e.type = i), n && (e.end = t, e.loc && (e.loc.end = r));
|
|
647
|
+
}
|
|
648
|
+
function c(e, t) {
|
|
649
|
+
let n = e.context(), r = a(3, n.offset, n.startLoc);
|
|
650
|
+
return r.value = t.replace(O, k), o(r, e.currentOffset(), e.currentPosition()), r;
|
|
651
|
+
}
|
|
652
|
+
function l(e, t) {
|
|
653
|
+
let { lastOffset: n, lastStartLoc: r } = e.context(), i = a(5, n, r);
|
|
654
|
+
return i.index = parseInt(t, 10), e.nextToken(), o(i, e.currentOffset(), e.currentPosition()), i;
|
|
655
|
+
}
|
|
656
|
+
function u(e, t) {
|
|
657
|
+
let { lastOffset: n, lastStartLoc: r } = e.context(), i = a(4, n, r);
|
|
658
|
+
return i.key = t, e.nextToken(), o(i, e.currentOffset(), e.currentPosition()), i;
|
|
659
|
+
}
|
|
660
|
+
function f(e, t) {
|
|
661
|
+
let { lastOffset: n, lastStartLoc: r } = e.context(), i = a(9, n, r);
|
|
662
|
+
return i.value = t.replace(D, A), e.nextToken(), o(i, e.currentOffset(), e.currentPosition()), i;
|
|
663
|
+
}
|
|
664
|
+
function m(e) {
|
|
665
|
+
let t = e.nextToken(), n = e.context(), { lastOffset: r, lastStartLoc: s } = n, c = a(8, r, s);
|
|
666
|
+
return t.type === 11 ? (t.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, n.lastStartLoc, 0, M(t)), c.value = t.value || ``, o(c, e.currentOffset(), e.currentPosition()), { node: c }) : (i(e, d.UNEXPECTED_EMPTY_LINKED_MODIFIER, n.lastStartLoc, 0), c.value = ``, o(c, r, s), {
|
|
667
|
+
nextConsumeToken: t,
|
|
668
|
+
node: c
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
function h(e, t) {
|
|
672
|
+
let n = e.context(), r = a(7, n.offset, n.startLoc);
|
|
673
|
+
return r.value = t, o(r, e.currentOffset(), e.currentPosition()), r;
|
|
674
|
+
}
|
|
675
|
+
function g(e) {
|
|
676
|
+
let t = e.context(), n = a(6, t.offset, t.startLoc), r = e.nextToken();
|
|
677
|
+
if (r.type === 8) {
|
|
678
|
+
let t = m(e);
|
|
679
|
+
n.modifier = t.node, r = t.nextConsumeToken || e.nextToken();
|
|
680
|
+
}
|
|
681
|
+
switch (r.type !== 9 && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(r)), r = e.nextToken(), r.type === 2 && (r = e.nextToken()), r.type) {
|
|
682
|
+
case 10:
|
|
683
|
+
r.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(r)), n.key = h(e, r.value || ``);
|
|
684
|
+
break;
|
|
685
|
+
case 4:
|
|
686
|
+
r.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(r)), n.key = u(e, r.value || ``);
|
|
687
|
+
break;
|
|
688
|
+
case 5:
|
|
689
|
+
r.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(r)), n.key = l(e, r.value || ``);
|
|
690
|
+
break;
|
|
691
|
+
case 6:
|
|
692
|
+
r.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(r)), n.key = f(e, r.value || ``);
|
|
693
|
+
break;
|
|
694
|
+
default: {
|
|
695
|
+
i(e, d.UNEXPECTED_EMPTY_LINKED_KEY, t.lastStartLoc, 0);
|
|
696
|
+
let s = e.context(), c = a(7, s.offset, s.startLoc);
|
|
697
|
+
return c.value = ``, o(c, s.offset, s.startLoc), n.key = c, o(n, s.offset, s.startLoc), {
|
|
698
|
+
nextConsumeToken: r,
|
|
699
|
+
node: n
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return o(n, e.currentOffset(), e.currentPosition()), { node: n };
|
|
704
|
+
}
|
|
705
|
+
function _(e) {
|
|
706
|
+
let t = e.context(), n = a(2, t.currentType === 1 ? e.currentOffset() : t.offset, t.currentType === 1 ? t.endLoc : t.startLoc);
|
|
707
|
+
n.items = [];
|
|
708
|
+
let r = null;
|
|
709
|
+
do {
|
|
710
|
+
let a = r || e.nextToken();
|
|
711
|
+
switch (r = null, a.type) {
|
|
712
|
+
case 0:
|
|
713
|
+
a.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(a)), n.items.push(c(e, a.value || ``));
|
|
714
|
+
break;
|
|
715
|
+
case 5:
|
|
716
|
+
a.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(a)), n.items.push(l(e, a.value || ``));
|
|
717
|
+
break;
|
|
718
|
+
case 4:
|
|
719
|
+
a.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(a)), n.items.push(u(e, a.value || ``));
|
|
720
|
+
break;
|
|
721
|
+
case 6:
|
|
722
|
+
a.value == null && i(e, d.UNEXPECTED_LEXICAL_ANALYSIS, t.lastStartLoc, 0, M(a)), n.items.push(f(e, a.value || ``));
|
|
723
|
+
break;
|
|
724
|
+
case 7: {
|
|
725
|
+
let t = g(e);
|
|
726
|
+
n.items.push(t.node), r = t.nextConsumeToken || null;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
} while (t.currentType !== 13 && t.currentType !== 1);
|
|
731
|
+
return o(n, t.currentType === 1 ? t.lastOffset : e.currentOffset(), t.currentType === 1 ? t.lastEndLoc : e.currentPosition()), n;
|
|
732
|
+
}
|
|
733
|
+
function v(e, t, n, r) {
|
|
734
|
+
let s = e.context(), c = r.items.length === 0, l = a(1, t, n);
|
|
735
|
+
l.cases = [], l.cases.push(r);
|
|
736
|
+
do {
|
|
737
|
+
let t = _(e);
|
|
738
|
+
c || (c = t.items.length === 0), l.cases.push(t);
|
|
739
|
+
} while (s.currentType !== 13);
|
|
740
|
+
return c && i(e, d.MUST_HAVE_MESSAGES_IN_PLURAL, n, 0), o(l, e.currentOffset(), e.currentPosition()), l;
|
|
741
|
+
}
|
|
742
|
+
function y(e) {
|
|
743
|
+
let t = e.context(), { offset: n, startLoc: r } = t, i = _(e);
|
|
744
|
+
return t.currentType === 13 ? i : v(e, n, r, i);
|
|
745
|
+
}
|
|
746
|
+
function b(r) {
|
|
747
|
+
let s = T(r, t({}, e)), c = s.context(), l = a(0, c.offset, c.startLoc);
|
|
748
|
+
return n && l.loc && (l.loc.source = r), l.body = y(s), e.onCacheKey && (l.cacheKey = e.onCacheKey(r)), c.currentType !== 13 && i(s, d.UNEXPECTED_LEXICAL_ANALYSIS, c.lastStartLoc, 0, r[c.offset] || ``), o(l, s.currentOffset(), s.currentPosition()), l;
|
|
749
|
+
}
|
|
750
|
+
return { parse: b };
|
|
751
|
+
}
|
|
752
|
+
function M(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 N(e, t = {}) {
|
|
758
|
+
let n = {
|
|
759
|
+
ast: e,
|
|
760
|
+
helpers: /* @__PURE__ */ new Set()
|
|
761
|
+
};
|
|
762
|
+
return {
|
|
763
|
+
context: () => n,
|
|
764
|
+
helper: (e) => (n.helpers.add(e), e)
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
function P(e, t) {
|
|
768
|
+
for (let n = 0; n < e.length; n++) F(e[n], t);
|
|
769
|
+
}
|
|
770
|
+
function F(e, t) {
|
|
771
|
+
switch (e.type) {
|
|
772
|
+
case 1:
|
|
773
|
+
P(e.cases, t), t.helper(`plural`);
|
|
774
|
+
break;
|
|
775
|
+
case 2:
|
|
776
|
+
P(e.items, t);
|
|
777
|
+
break;
|
|
778
|
+
case 6:
|
|
779
|
+
F(e.key, t), t.helper(`linked`), t.helper(`type`);
|
|
780
|
+
break;
|
|
781
|
+
case 5:
|
|
782
|
+
t.helper(`interpolate`), t.helper(`list`);
|
|
783
|
+
break;
|
|
784
|
+
case 4:
|
|
785
|
+
t.helper(`interpolate`), t.helper(`named`);
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
function I(e, t = {}) {
|
|
790
|
+
let n = N(e);
|
|
791
|
+
n.helper(`normalize`), e.body && F(e.body, n);
|
|
792
|
+
let r = n.context();
|
|
793
|
+
e.helpers = Array.from(r.helpers);
|
|
794
|
+
}
|
|
795
|
+
function L(e, n = {}) {
|
|
796
|
+
let r = t({}, n), i = !!r.jit, a = !!r.mangle, o = r.optimize == null ? !0 : r.optimize, s = j(r).parse(e);
|
|
797
|
+
return i ? (o && C(s), a && S(s), {
|
|
798
|
+
ast: s,
|
|
799
|
+
code: ``
|
|
800
|
+
}) : (I(s, r), x(s, r));
|
|
801
|
+
}
|
|
802
|
+
return e.COMPILE_ERROR_CODES_EXTEND_POINT = 17, e.CompileErrorCodes = d, e.ERROR_DOMAIN = E, e.HelperNameMap = c, e.LOCATION_STUB = a, e.NodeTypes = i, e.baseCompile = L, e.createCompileError = p, e.createLocation = s, e.createParser = j, e.createPosition = o, e.defaultOnError = m, e.detectHtmlTag = u, e.errorMessages = f, e.mangle = S, e.optimize = C, e;
|
|
803
|
+
})({});
|