@intlify/message-compiler 9.2.0-beta.3 → 9.2.0-beta.32

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * message-compiler v9.2.0-beta.3
3
- * (c) 2021 kazuya kawaguchi
2
+ * message-compiler v9.2.0-beta.32
3
+ * (c) 2022 kazuya kawaguchi
4
4
  * Released under the MIT License.
5
5
  */
6
- const e=Object.assign,n=e=>"string"==typeof e,t={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15},r={[t.EXPECTED_TOKEN]:"Expected token: '{0}'",[t.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[t.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[t.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[t.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[t.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[t.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[t.EMPTY_PLACEHOLDER]:"Empty placeholder",[t.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[t.INVALID_LINKED_FORMAT]:"Invalid linked format",[t.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[t.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[t.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[t.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'"};function o(e,n,t={}){const{domain:r}=t,o=new SyntaxError(String(e));return o.code=e,n&&(o.location=n),o.domain=r,o}function i(e){throw e}const s={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0}};function u(e,n,t){return{line:e,column:n,offset:t}}function a(e,n,t){const r={start:e,end:n};return null!=t&&(r.source=t),r}const c=String.fromCharCode(8232),l=String.fromCharCode(8233);function p(e){const n=e;let t=0,r=1,o=1,i=0;const s=e=>"\r"===n[e]&&"\n"===n[e+1],u=e=>n[e]===l,a=e=>n[e]===c,p=e=>s(e)||(e=>"\n"===n[e])(e)||u(e)||a(e),f=e=>s(e)||u(e)||a(e)?"\n":n[e];function h(){return i=0,p(t)&&(r++,o=0),s(t)&&t++,t++,o++,n[t]}return{index:()=>t,line:()=>r,column:()=>o,peekOffset:()=>i,charAt:f,currentChar:()=>f(t),currentPeek:()=>f(t+i),next:h,peek:function(){return s(t+i)&&i++,i++,n[t+i]},reset:function(){t=0,r=1,o=1,i=0},resetPeek:function(e=0){i=e},skipToPeek:function(){const e=t+i;for(;e!==t;)h();i=0}}}const f=void 0;function h(e,n={}){const r=!1!==n.location,i=p(e),s=()=>i.index(),c=()=>u(i.line(),i.column(),i.index()),l=c(),h=s(),g={currentType:14,offset:h,startLoc:l,endLoc:l,lastType:14,lastOffset:h,lastStartLoc:l,lastEndLoc:l,braceNest:0,inLinked:!1,text:""},d=()=>g,{onError:m}=n;function _(e,n,t,...r){const i=d();if(n.column+=t,n.offset+=t,m){const t=o(e,a(i.startLoc,n),{domain:"tokenizer",args:r});m(t)}}function E(e,n,t){e.endLoc=c(),e.currentType=n;const o={type:n};return r&&(o.loc=a(e.startLoc,e.endLoc)),null!=t&&(o.value=t),o}const L=e=>E(e,14);function C(e,n){return e.currentChar()===n?(e.next(),n):(_(t.EXPECTED_TOKEN,c(),0,n),"")}function A(e){let n="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)n+=e.currentPeek(),e.peek();return n}function y(e){const n=A(e);return e.skipToPeek(),n}function S(e){if(e===f)return!1;const n=e.charCodeAt(0);return n>=97&&n<=122||n>=65&&n<=90||95===n}function v(e,n){const{currentType:t}=n;if(2!==t)return!1;A(e);const r=function(e){if(e===f)return!1;const n=e.charCodeAt(0);return n>=48&&n<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function N(e){A(e);const n="|"===e.currentPeek();return e.resetPeek(),n}function O(e,n=!0){const t=(n=!1,r="",o=!1)=>{const i=e.currentPeek();return"{"===i?"%"!==r&&n:"@"!==i&&i?"%"===i?(e.peek(),t(n,"%",!0)):"|"===i?!("%"!==r&&!o)||!(" "===r||"\n"===r):" "===i?(e.peek(),t(!0," ",o)):"\n"!==i||(e.peek(),t(!0,"\n",o)):"%"===r||n},r=t();return n&&e.resetPeek(),r}function T(e,n){const t=e.currentChar();return t===f?f:n(t)?(e.next(),t):null}function I(e){return T(e,(e=>{const n=e.charCodeAt(0);return n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||95===n||36===n}))}function P(e){return T(e,(e=>{const n=e.charCodeAt(0);return n>=48&&n<=57}))}function M(e){return T(e,(e=>{const n=e.charCodeAt(0);return n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102}))}function k(e){let n="",t="";for(;n=P(e);)t+=n;return t}function R(e){const n=e.currentChar();switch(n){case"\\":case"'":return e.next(),`\\${n}`;case"u":return b(e,n,4);case"U":return b(e,n,6);default:return _(t.UNKNOWN_ESCAPE_SEQUENCE,c(),0,n),""}}function b(e,n,r){C(e,n);let o="";for(let i=0;i<r;i++){const r=M(e);if(!r){_(t.INVALID_UNICODE_ESCAPE_SEQUENCE,c(),0,`\\${n}${o}${e.currentChar()}`);break}o+=r}return`\\${n}${o}`}function w(e){y(e);const n=C(e,"|");return y(e),n}function D(e,n){let r=null;switch(e.currentChar()){case"{":return n.braceNest>=1&&_(t.NOT_ALLOW_NEST_PLACEHOLDER,c(),0),e.next(),r=E(n,2,"{"),y(e),n.braceNest++,r;case"}":return n.braceNest>0&&2===n.currentType&&_(t.EMPTY_PLACEHOLDER,c(),0),e.next(),r=E(n,3,"}"),n.braceNest--,n.braceNest>0&&y(e),n.inLinked&&0===n.braceNest&&(n.inLinked=!1),r;case"@":return n.braceNest>0&&_(t.UNTERMINATED_CLOSING_BRACE,c(),0),r=U(e,n)||L(n),n.braceNest=0,r;default:let o=!0,i=!0,s=!0;if(N(e))return n.braceNest>0&&_(t.UNTERMINATED_CLOSING_BRACE,c(),0),r=E(n,1,w(e)),n.braceNest=0,n.inLinked=!1,r;if(n.braceNest>0&&(5===n.currentType||6===n.currentType||7===n.currentType))return _(t.UNTERMINATED_CLOSING_BRACE,c(),0),n.braceNest=0,x(e,n);if(o=function(e,n){const{currentType:t}=n;if(2!==t)return!1;A(e);const r=S(e.currentPeek());return e.resetPeek(),r}(e,n))return r=E(n,5,function(e){y(e);let n="",r="";for(;n=I(e);)r+=n;return e.currentChar()===f&&_(t.UNTERMINATED_CLOSING_BRACE,c(),0),r}(e)),y(e),r;if(i=v(e,n))return r=E(n,6,function(e){y(e);let n="";return"-"===e.currentChar()?(e.next(),n+=`-${k(e)}`):n+=k(e),e.currentChar()===f&&_(t.UNTERMINATED_CLOSING_BRACE,c(),0),n}(e)),y(e),r;if(s=function(e,n){const{currentType:t}=n;if(2!==t)return!1;A(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,n))return r=E(n,7,function(e){y(e),C(e,"'");let n="",r="";const o=e=>"'"!==e&&"\n"!==e;for(;n=T(e,o);)r+="\\"===n?R(e):n;const i=e.currentChar();return"\n"===i||i===f?(_(t.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,c(),0),"\n"===i&&(e.next(),C(e,"'")),r):(C(e,"'"),r)}(e)),y(e),r;if(!o&&!i&&!s)return r=E(n,13,function(e){y(e);let n="",t="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;n=T(e,r);)t+=n;return t}(e)),_(t.INVALID_TOKEN_IN_PLACEHOLDER,c(),0,r.value),y(e),r}return r}function U(e,n){const{currentType:r}=n;let o=null;const i=e.currentChar();switch(8!==r&&9!==r&&12!==r&&10!==r||"\n"!==i&&" "!==i||_(t.INVALID_LINKED_FORMAT,c(),0),i){case"@":return e.next(),o=E(n,8,"@"),n.inLinked=!0,o;case".":return y(e),e.next(),E(n,9,".");case":":return y(e),e.next(),E(n,10,":");default:return N(e)?(o=E(n,1,w(e)),n.braceNest=0,n.inLinked=!1,o):function(e,n){const{currentType:t}=n;if(8!==t)return!1;A(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,n)||function(e,n){const{currentType:t}=n;if(8!==t&&12!==t)return!1;A(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,n)?(y(e),U(e,n)):function(e,n){const{currentType:t}=n;if(9!==t)return!1;A(e);const r=S(e.currentPeek());return e.resetPeek(),r}(e,n)?(y(e),E(n,12,function(e){let n="",t="";for(;n=I(e);)t+=n;return t}(e))):function(e,n){const{currentType:t}=n;if(10!==t)return!1;const r=()=>{const n=e.currentPeek();return"{"===n?S(e.peek()):!("@"===n||"%"===n||"|"===n||":"===n||"."===n||" "===n||!n)&&("\n"===n?(e.peek(),r()):S(n))},o=r();return e.resetPeek(),o}(e,n)?(y(e),"{"===i?D(e,n)||o:E(n,11,function(e){const n=(t=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?" "===o?r:"\n"===o?(r+=o,e.next(),n(t,r)):(r+=o,e.next(),n(!0,r)):r};return n(!1,"")}(e))):(8===r&&_(t.INVALID_LINKED_FORMAT,c(),0),n.braceNest=0,n.inLinked=!1,x(e,n))}}function x(e,n){let r={type:14};if(n.braceNest>0)return D(e,n)||L(n);if(n.inLinked)return U(e,n)||L(n);const o=e.currentChar();switch(o){case"{":return D(e,n)||L(n);case"}":return _(t.UNBALANCED_CLOSING_BRACE,c(),0),e.next(),E(n,3,"}");case"@":return U(e,n)||L(n);default:if(N(e))return r=E(n,1,w(e)),n.braceNest=0,n.inLinked=!1,r;if(O(e))return E(n,0,function(e){const n=t=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?O(e)?(t+=r,e.next(),n(t)):t:"|"===r?t:" "===r||"\n"===r?O(e)?(t+=r,e.next(),n(t)):N(e)?t:(t+=r,e.next(),n(t)):(t+=r,e.next(),n(t)):t};return n("")}(e));if("%"===o)return e.next(),E(n,4,"%")}return r}return{nextToken:function(){const{currentType:e,offset:n,startLoc:t,endLoc:r}=g;return g.lastType=e,g.lastOffset=n,g.lastStartLoc=t,g.lastEndLoc=r,g.offset=s(),g.startLoc=c(),i.currentChar()===f?E(g,14):x(i,g)},currentOffset:s,currentPosition:c,context:d}}const g="parser",d=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function m(e,n,t){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(n||t,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function _(n={}){const r=!1!==n.location,{onError:i}=n;function s(e,n,t,r,...s){const u=e.currentPosition();if(u.offset+=r,u.column+=r,i){const e=o(n,a(t,u),{domain:"parser",args:s});i(e)}}function u(e,n,t){const o={type:e,start:n,end:n};return r&&(o.loc={start:t,end:t}),o}function c(e,n,t,o){e.end=n,o&&(e.type=o),r&&e.loc&&(e.loc.end=t)}function l(e,n){const t=e.context(),r=u(3,t.offset,t.startLoc);return r.value=n,c(r,e.currentOffset(),e.currentPosition()),r}function p(e,n){const t=e.context(),{lastOffset:r,lastStartLoc:o}=t,i=u(5,r,o);return i.index=parseInt(n,10),e.nextToken(),c(i,e.currentOffset(),e.currentPosition()),i}function f(e,n){const t=e.context(),{lastOffset:r,lastStartLoc:o}=t,i=u(4,r,o);return i.key=n,e.nextToken(),c(i,e.currentOffset(),e.currentPosition()),i}function g(e,n){const t=e.context(),{lastOffset:r,lastStartLoc:o}=t,i=u(9,r,o);return i.value=n.replace(d,m),e.nextToken(),c(i,e.currentOffset(),e.currentPosition()),i}function _(e){const n=e.context(),r=u(6,n.offset,n.startLoc);let o=e.nextToken();if(9===o.type){const n=function(e){const n=e.nextToken(),r=e.context(),{lastOffset:o,lastStartLoc:i}=r,a=u(8,o,i);return 12!==n.type?(s(e,t.UNEXPECTED_EMPTY_LINKED_MODIFIER,r.lastStartLoc,0),a.value="",c(a,o,i),{nextConsumeToken:n,node:a}):(null==n.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,r.lastStartLoc,0,E(n)),a.value=n.value||"",c(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);r.modifier=n.node,o=n.nextConsumeToken||e.nextToken()}switch(10!==o.type&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(o)),o=e.nextToken(),2===o.type&&(o=e.nextToken()),o.type){case 11:null==o.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(o)),r.key=function(e,n){const t=e.context(),r=u(7,t.offset,t.startLoc);return r.value=n,c(r,e.currentOffset(),e.currentPosition()),r}(e,o.value||"");break;case 5:null==o.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(o)),r.key=f(e,o.value||"");break;case 6:null==o.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(o)),r.key=p(e,o.value||"");break;case 7:null==o.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(o)),r.key=g(e,o.value||"");break;default:s(e,t.UNEXPECTED_EMPTY_LINKED_KEY,n.lastStartLoc,0);const i=e.context(),a=u(7,i.offset,i.startLoc);return a.value="",c(a,i.offset,i.startLoc),r.key=a,c(r,i.offset,i.startLoc),{nextConsumeToken:o,node:r}}return c(r,e.currentOffset(),e.currentPosition()),{node:r}}function L(e){const n=e.context(),r=u(2,1===n.currentType?e.currentOffset():n.offset,1===n.currentType?n.endLoc:n.startLoc);r.items=[];let o=null;do{const i=o||e.nextToken();switch(o=null,i.type){case 0:null==i.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(i)),r.items.push(l(e,i.value||""));break;case 6:null==i.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(i)),r.items.push(p(e,i.value||""));break;case 5:null==i.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(i)),r.items.push(f(e,i.value||""));break;case 7:null==i.value&&s(e,t.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,0,E(i)),r.items.push(g(e,i.value||""));break;case 8:const u=_(e);r.items.push(u.node),o=u.nextConsumeToken||null}}while(14!==n.currentType&&1!==n.currentType);return c(r,1===n.currentType?n.lastOffset:e.currentOffset(),1===n.currentType?n.lastEndLoc:e.currentPosition()),r}function C(e){const n=e.context(),{offset:r,startLoc:o}=n,i=L(e);return 14===n.currentType?i:function(e,n,r,o){const i=e.context();let a=0===o.items.length;const l=u(1,n,r);l.cases=[],l.cases.push(o);do{const n=L(e);a||(a=0===n.items.length),l.cases.push(n)}while(14!==i.currentType);return a&&s(e,t.MUST_HAVE_MESSAGES_IN_PLURAL,r,0),c(l,e.currentOffset(),e.currentPosition()),l}(e,r,o,i)}return{parse:function(o){const i=h(o,e({},n)),a=i.context(),l=u(0,a.offset,a.startLoc);return r&&l.loc&&(l.loc.source=o),l.body=C(i),14!==a.currentType&&s(i,t.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,0,o[a.offset]||""),c(l,i.currentOffset(),i.currentPosition()),l}}}function E(e){if(14===e.type)return"EOF";const n=(e.value||"").replace(/\r?\n/gu,"\\n");return n.length>10?n.slice(0,9)+"…":n}function L(e,n){for(let t=0;t<e.length;t++)C(e[t],n)}function C(e,n){switch(e.type){case 1:L(e.cases,n),n.helper("plural");break;case 2:L(e.items,n);break;case 6:C(e.key,n),n.helper("linked");break;case 5:n.helper("interpolate"),n.helper("list");break;case 4:n.helper("interpolate"),n.helper("named")}}function A(e,n={}){const t=function(e,n={}){const t={ast:e,helpers:new Set};return{context:()=>t,helper:e=>(t.helpers.add(e),e)}}(e);t.helper("normalize"),e.body&&C(e.body,t);const r=t.context();e.helpers=Array.from(r.helpers)}var y={},S={},v={},N={},O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");N.encode=function(e){if(0<=e&&e<O.length)return O[e];throw new TypeError("Must be between 0 and 63: "+e)},N.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1};var T=N;v.encode=function(e){var n,t="",r=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{n=31&r,(r>>>=5)>0&&(n|=32),t+=T.encode(n)}while(r>0);return t},v.decode=function(e,n,t){var r,o,i,s,u=e.length,a=0,c=0;do{if(n>=u)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=T.decode(e.charCodeAt(n++))))throw new Error("Invalid base64 digit: "+e.charAt(n-1));r=!!(32&o),a+=(o&=31)<<c,c+=5}while(r);t.value=(s=(i=a)>>1,1==(1&i)?-s:s),t.rest=n};var I={};!function(e){e.getArg=function(e,n,t){if(n in e)return e[n];if(3===arguments.length)return t;throw new Error('"'+n+'" is a required argument.')};var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,t=/^data:.+\,.+$/;function r(e){var t=e.match(n);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function o(e){var n="";return e.scheme&&(n+=e.scheme+":"),n+="//",e.auth&&(n+=e.auth+"@"),e.host&&(n+=e.host),e.port&&(n+=":"+e.port),e.path&&(n+=e.path),n}function i(n){var t=n,i=r(n);if(i){if(!i.path)return n;t=i.path}for(var s,u=e.isAbsolute(t),a=t.split(/\/+/),c=0,l=a.length-1;l>=0;l--)"."===(s=a[l])?a.splice(l,1):".."===s?c++:c>0&&(""===s?(a.splice(l+1,c),c=0):(a.splice(l,2),c--));return""===(t=a.join("/"))&&(t=u?"/":"."),i?(i.path=t,o(i)):t}function s(e,n){""===e&&(e="."),""===n&&(n=".");var s=r(n),u=r(e);if(u&&(e=u.path||"/"),s&&!s.scheme)return u&&(s.scheme=u.scheme),o(s);if(s||n.match(t))return n;if(u&&!u.host&&!u.path)return u.host=n,o(u);var a="/"===n.charAt(0)?n:i(e.replace(/\/+$/,"")+"/"+n);return u?(u.path=a,o(u)):a}e.urlParse=r,e.urlGenerate=o,e.normalize=i,e.join=s,e.isAbsolute=function(e){return"/"===e.charAt(0)||n.test(e)},e.relative=function(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var t=0;0!==n.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return n;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return n;++t}return Array(t+1).join("../")+n.substr(e.length+1)};var u=!("__proto__"in Object.create(null));function a(e){return e}function c(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var t=n-10;t>=0;t--)if(36!==e.charCodeAt(t))return!1;return!0}function l(e,n){return e===n?0:null===e?1:null===n?-1:e>n?1:-1}e.toSetString=u?a:function(e){return c(e)?"$"+e:e},e.fromSetString=u?a:function(e){return c(e)?e.slice(1):e},e.compareByOriginalPositions=function(e,n,t){var r=l(e.source,n.source);return 0!==r||0!==(r=e.originalLine-n.originalLine)||0!==(r=e.originalColumn-n.originalColumn)||t||0!==(r=e.generatedColumn-n.generatedColumn)||0!==(r=e.generatedLine-n.generatedLine)?r:l(e.name,n.name)},e.compareByGeneratedPositionsDeflated=function(e,n,t){var r=e.generatedLine-n.generatedLine;return 0!==r||0!==(r=e.generatedColumn-n.generatedColumn)||t||0!==(r=l(e.source,n.source))||0!==(r=e.originalLine-n.originalLine)||0!==(r=e.originalColumn-n.originalColumn)?r:l(e.name,n.name)},e.compareByGeneratedPositionsInflated=function(e,n){var t=e.generatedLine-n.generatedLine;return 0!==t||0!==(t=e.generatedColumn-n.generatedColumn)||0!==(t=l(e.source,n.source))||0!==(t=e.originalLine-n.originalLine)||0!==(t=e.originalColumn-n.originalColumn)?t:l(e.name,n.name)},e.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,n,t){if(n=n||"",e&&("/"!==e[e.length-1]&&"/"!==n[0]&&(e+="/"),n=e+n),t){var u=r(t);if(!u)throw new Error("sourceMapURL could not be parsed");if(u.path){var a=u.path.lastIndexOf("/");a>=0&&(u.path=u.path.substring(0,a+1))}n=s(o(u),n)}return i(n)}}(I);var P={},M=I,k=Object.prototype.hasOwnProperty,R="undefined"!=typeof Map;function b(){this._array=[],this._set=R?new Map:Object.create(null)}b.fromArray=function(e,n){for(var t=new b,r=0,o=e.length;r<o;r++)t.add(e[r],n);return t},b.prototype.size=function(){return R?this._set.size:Object.getOwnPropertyNames(this._set).length},b.prototype.add=function(e,n){var t=R?e:M.toSetString(e),r=R?this.has(e):k.call(this._set,t),o=this._array.length;r&&!n||this._array.push(e),r||(R?this._set.set(e,o):this._set[t]=o)},b.prototype.has=function(e){if(R)return this._set.has(e);var n=M.toSetString(e);return k.call(this._set,n)},b.prototype.indexOf=function(e){if(R){var n=this._set.get(e);if(n>=0)return n}else{var t=M.toSetString(e);if(k.call(this._set,t))return this._set[t]}throw new Error('"'+e+'" is not in the set.')},b.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},b.prototype.toArray=function(){return this._array.slice()},P.ArraySet=b;var w={},D=I;function U(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}U.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},U.prototype.add=function(e){var n,t,r,o;(o=(t=e).generatedLine)>(r=(n=this._last).generatedLine)||o==r&&t.generatedColumn>=n.generatedColumn||D.compareByGeneratedPositionsInflated(n,t)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},U.prototype.toArray=function(){return this._sorted||(this._array.sort(D.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},w.MappingList=U;var x=v,G=I,B=P.ArraySet,X=w.MappingList;function $(e){e||(e={}),this._file=G.getArg(e,"file",null),this._sourceRoot=G.getArg(e,"sourceRoot",null),this._skipValidation=G.getArg(e,"skipValidation",!1),this._sources=new B,this._names=new B,this._mappings=new X,this._sourcesContents=null}$.prototype._version=3,$.fromSourceMap=function(e){var n=e.sourceRoot,t=new $({file:e.file,sourceRoot:n});return e.eachMapping((function(e){var r={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(r.source=e.source,null!=n&&(r.source=G.relative(n,r.source)),r.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(r.name=e.name)),t.addMapping(r)})),e.sources.forEach((function(r){var o=r;null!==n&&(o=G.relative(n,r)),t._sources.has(o)||t._sources.add(o);var i=e.sourceContentFor(r);null!=i&&t.setSourceContent(r,i)})),t},$.prototype.addMapping=function(e){var n=G.getArg(e,"generated"),t=G.getArg(e,"original",null),r=G.getArg(e,"source",null),o=G.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,t,r,o),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=t&&t.line,originalColumn:null!=t&&t.column,source:r,name:o})},$.prototype.setSourceContent=function(e,n){var t=e;null!=this._sourceRoot&&(t=G.relative(this._sourceRoot,t)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[G.toSetString(t)]=n):this._sourcesContents&&(delete this._sourcesContents[G.toSetString(t)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},$.prototype.applySourceMap=function(e,n,t){var r=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=e.file}var o=this._sourceRoot;null!=o&&(r=G.relative(o,r));var i=new B,s=new B;this._mappings.unsortedForEach((function(n){if(n.source===r&&null!=n.originalLine){var u=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=u.source&&(n.source=u.source,null!=t&&(n.source=G.join(t,n.source)),null!=o&&(n.source=G.relative(o,n.source)),n.originalLine=u.line,n.originalColumn=u.column,null!=u.name&&(n.name=u.name))}var a=n.source;null==a||i.has(a)||i.add(a);var c=n.name;null==c||s.has(c)||s.add(c)}),this),this._sources=i,this._names=s,e.sources.forEach((function(n){var r=e.sourceContentFor(n);null!=r&&(null!=t&&(n=G.join(t,n)),null!=o&&(n=G.relative(o,n)),this.setSourceContent(n,r))}),this)},$.prototype._validateMapping=function(e,n,t,r){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||n||t||r)&&!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&t))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:t,original:n,name:r}))},$.prototype._serializeMappings=function(){for(var e,n,t,r,o=0,i=1,s=0,u=0,a=0,c=0,l="",p=this._mappings.toArray(),f=0,h=p.length;f<h;f++){if(e="",(n=p[f]).generatedLine!==i)for(o=0;n.generatedLine!==i;)e+=";",i++;else if(f>0){if(!G.compareByGeneratedPositionsInflated(n,p[f-1]))continue;e+=","}e+=x.encode(n.generatedColumn-o),o=n.generatedColumn,null!=n.source&&(r=this._sources.indexOf(n.source),e+=x.encode(r-c),c=r,e+=x.encode(n.originalLine-1-u),u=n.originalLine-1,e+=x.encode(n.originalColumn-s),s=n.originalColumn,null!=n.name&&(t=this._names.indexOf(n.name),e+=x.encode(t-a),a=t)),l+=e}return l},$.prototype._generateSourcesContent=function(e,n){return e.map((function(e){if(!this._sourcesContents)return null;null!=n&&(e=G.relative(n,e));var t=G.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,t)?this._sourcesContents[t]:null}),this)},$.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},$.prototype.toString=function(){return JSON.stringify(this.toJSON())},S.SourceMapGenerator=$;var F={},j={};!function(e){function n(t,r,o,i,s,u){var a=Math.floor((r-t)/2)+t,c=s(o,i[a],!0);return 0===c?a:c>0?r-a>1?n(a,r,o,i,s,u):u==e.LEAST_UPPER_BOUND?r<i.length?r:-1:a:a-t>1?n(t,a,o,i,s,u):u==e.LEAST_UPPER_BOUND?a:t<0?-1:t}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(t,r,o,i){if(0===r.length)return-1;var s=n(-1,r.length,t,r,o,i||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===o(r[s],r[s-1],!0);)--s;return s}}(j);var Y={};function K(e,n,t){var r=e[n];e[n]=e[t],e[t]=r}function V(e,n,t,r){if(t<r){var o=t-1;K(e,(a=t,c=r,Math.round(a+Math.random()*(c-a))),r);for(var i=e[r],s=t;s<r;s++)n(e[s],i)<=0&&K(e,o+=1,s);K(e,o+1,s);var u=o+1;V(e,n,t,u-1),V(e,n,u+1,r)}var a,c}Y.quickSort=function(e,n){V(e,n,0,e.length-1)};var H=I,W=j,z=P.ArraySet,Q=v,q=Y.quickSort;function J(e,n){var t=e;return"string"==typeof e&&(t=H.parseSourceMapInput(e)),null!=t.sections?new ne(t,n):new Z(t,n)}function Z(e,n){var t=e;"string"==typeof e&&(t=H.parseSourceMapInput(e));var r=H.getArg(t,"version"),o=H.getArg(t,"sources"),i=H.getArg(t,"names",[]),s=H.getArg(t,"sourceRoot",null),u=H.getArg(t,"sourcesContent",null),a=H.getArg(t,"mappings"),c=H.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);s&&(s=H.normalize(s)),o=o.map(String).map(H.normalize).map((function(e){return s&&H.isAbsolute(s)&&H.isAbsolute(e)?H.relative(s,e):e})),this._names=z.fromArray(i.map(String),!0),this._sources=z.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map((function(e){return H.computeSourceURL(s,e,n)})),this.sourceRoot=s,this.sourcesContent=u,this._mappings=a,this._sourceMapURL=n,this.file=c}function ee(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function ne(e,n){var t=e;"string"==typeof e&&(t=H.parseSourceMapInput(e));var r=H.getArg(t,"version"),o=H.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new z,this._names=new z;var i={line:-1,column:0};this._sections=o.map((function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=H.getArg(e,"offset"),r=H.getArg(t,"line"),o=H.getArg(t,"column");if(r<i.line||r===i.line&&o<i.column)throw new Error("Section offsets must be ordered and non-overlapping.");return i=t,{generatedOffset:{generatedLine:r+1,generatedColumn:o+1},consumer:new J(H.getArg(e,"map"),n)}}))}J.fromSourceMap=function(e,n){return Z.fromSourceMap(e,n)},J.prototype._version=3,J.prototype.__generatedMappings=null,Object.defineProperty(J.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),J.prototype.__originalMappings=null,Object.defineProperty(J.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),J.prototype._charIsMappingSeparator=function(e,n){var t=e.charAt(n);return";"===t||","===t},J.prototype._parseMappings=function(e,n){throw new Error("Subclasses must implement _parseMappings")},J.GENERATED_ORDER=1,J.ORIGINAL_ORDER=2,J.GREATEST_LOWER_BOUND=1,J.LEAST_UPPER_BOUND=2,J.prototype.eachMapping=function(e,n,t){var r,o=n||null;switch(t||J.GENERATED_ORDER){case J.GENERATED_ORDER:r=this._generatedMappings;break;case J.ORIGINAL_ORDER:r=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var i=this.sourceRoot;r.map((function(e){var n=null===e.source?null:this._sources.at(e.source);return{source:n=H.computeSourceURL(i,n,this._sourceMapURL),generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}}),this).forEach(e,o)},J.prototype.allGeneratedPositionsFor=function(e){var n=H.getArg(e,"line"),t={source:H.getArg(e,"source"),originalLine:n,originalColumn:H.getArg(e,"column",0)};if(t.source=this._findSourceIndex(t.source),t.source<0)return[];var r=[],o=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",H.compareByOriginalPositions,W.LEAST_UPPER_BOUND);if(o>=0){var i=this._originalMappings[o];if(void 0===e.column)for(var s=i.originalLine;i&&i.originalLine===s;)r.push({line:H.getArg(i,"generatedLine",null),column:H.getArg(i,"generatedColumn",null),lastColumn:H.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var u=i.originalColumn;i&&i.originalLine===n&&i.originalColumn==u;)r.push({line:H.getArg(i,"generatedLine",null),column:H.getArg(i,"generatedColumn",null),lastColumn:H.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return r},F.SourceMapConsumer=J,(Z.prototype=Object.create(J.prototype)).consumer=J,Z.prototype._findSourceIndex=function(e){var n,t=e;if(null!=this.sourceRoot&&(t=H.relative(this.sourceRoot,t)),this._sources.has(t))return this._sources.indexOf(t);for(n=0;n<this._absoluteSources.length;++n)if(this._absoluteSources[n]==e)return n;return-1},Z.fromSourceMap=function(e,n){var t=Object.create(Z.prototype),r=t._names=z.fromArray(e._names.toArray(),!0),o=t._sources=z.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file,t._sourceMapURL=n,t._absoluteSources=t._sources.toArray().map((function(e){return H.computeSourceURL(t.sourceRoot,e,n)}));for(var i=e._mappings.toArray().slice(),s=t.__generatedMappings=[],u=t.__originalMappings=[],a=0,c=i.length;a<c;a++){var l=i[a],p=new ee;p.generatedLine=l.generatedLine,p.generatedColumn=l.generatedColumn,l.source&&(p.source=o.indexOf(l.source),p.originalLine=l.originalLine,p.originalColumn=l.originalColumn,l.name&&(p.name=r.indexOf(l.name)),u.push(p)),s.push(p)}return q(t.__originalMappings,H.compareByOriginalPositions),t},Z.prototype._version=3,Object.defineProperty(Z.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),Z.prototype._parseMappings=function(e,n){for(var t,r,o,i,s=1,u=0,a=0,c=0,l=0,p=0,f=e.length,h=0,g={},d={},m=[],_=[];h<f;)if(";"===e.charAt(h))s++,h++,u=0;else if(","===e.charAt(h))h++;else{for((t=new ee).generatedLine=s,i=h;i<f&&!this._charIsMappingSeparator(e,i);i++);if(o=g[r=e.slice(h,i)])h+=r.length;else{for(o=[];h<i;)Q.decode(e,h,d),h=d.rest,o.push(d.value);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");g[r]=o}t.generatedColumn=u+o[0],u=t.generatedColumn,o.length>1&&(t.source=l+o[1],l+=o[1],t.originalLine=a+o[2],a=t.originalLine,t.originalLine+=1,t.originalColumn=c+o[3],c=t.originalColumn,o.length>4&&(t.name=p+o[4],p+=o[4])),_.push(t),"number"==typeof t.originalLine&&m.push(t)}q(_,H.compareByGeneratedPositionsDeflated),this.__generatedMappings=_,q(m,H.compareByOriginalPositions),this.__originalMappings=m},Z.prototype._findMapping=function(e,n,t,r,o,i){if(e[t]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[t]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return W.search(e,n,o,i)},Z.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var n=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var t=this._generatedMappings[e+1];if(n.generatedLine===t.generatedLine){n.lastGeneratedColumn=t.generatedColumn-1;continue}}n.lastGeneratedColumn=1/0}},Z.prototype.originalPositionFor=function(e){var n={generatedLine:H.getArg(e,"line"),generatedColumn:H.getArg(e,"column")},t=this._findMapping(n,this._generatedMappings,"generatedLine","generatedColumn",H.compareByGeneratedPositionsDeflated,H.getArg(e,"bias",J.GREATEST_LOWER_BOUND));if(t>=0){var r=this._generatedMappings[t];if(r.generatedLine===n.generatedLine){var o=H.getArg(r,"source",null);null!==o&&(o=this._sources.at(o),o=H.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var i=H.getArg(r,"name",null);return null!==i&&(i=this._names.at(i)),{source:o,line:H.getArg(r,"originalLine",null),column:H.getArg(r,"originalColumn",null),name:i}}}return{source:null,line:null,column:null,name:null}},Z.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))},Z.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;var t=this._findSourceIndex(e);if(t>=0)return this.sourcesContent[t];var r,o=e;if(null!=this.sourceRoot&&(o=H.relative(this.sourceRoot,o)),null!=this.sourceRoot&&(r=H.urlParse(this.sourceRoot))){var i=o.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(i))return this.sourcesContent[this._sources.indexOf(i)];if((!r.path||"/"==r.path)&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(n)return null;throw new Error('"'+o+'" is not in the SourceMap.')},Z.prototype.generatedPositionFor=function(e){var n=H.getArg(e,"source");if((n=this._findSourceIndex(n))<0)return{line:null,column:null,lastColumn:null};var t={source:n,originalLine:H.getArg(e,"line"),originalColumn:H.getArg(e,"column")},r=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",H.compareByOriginalPositions,H.getArg(e,"bias",J.GREATEST_LOWER_BOUND));if(r>=0){var o=this._originalMappings[r];if(o.source===t.source)return{line:H.getArg(o,"generatedLine",null),column:H.getArg(o,"generatedColumn",null),lastColumn:H.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},F.BasicSourceMapConsumer=Z,(ne.prototype=Object.create(J.prototype)).constructor=J,ne.prototype._version=3,Object.defineProperty(ne.prototype,"sources",{get:function(){for(var e=[],n=0;n<this._sections.length;n++)for(var t=0;t<this._sections[n].consumer.sources.length;t++)e.push(this._sections[n].consumer.sources[t]);return e}}),ne.prototype.originalPositionFor=function(e){var n={generatedLine:H.getArg(e,"line"),generatedColumn:H.getArg(e,"column")},t=W.search(n,this._sections,(function(e,n){var t=e.generatedLine-n.generatedOffset.generatedLine;return t||e.generatedColumn-n.generatedOffset.generatedColumn})),r=this._sections[t];return r?r.consumer.originalPositionFor({line:n.generatedLine-(r.generatedOffset.generatedLine-1),column:n.generatedColumn-(r.generatedOffset.generatedLine===n.generatedLine?r.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},ne.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))},ne.prototype.sourceContentFor=function(e,n){for(var t=0;t<this._sections.length;t++){var r=this._sections[t].consumer.sourceContentFor(e,!0);if(r)return r}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')},ne.prototype.generatedPositionFor=function(e){for(var n=0;n<this._sections.length;n++){var t=this._sections[n];if(-1!==t.consumer._findSourceIndex(H.getArg(e,"source"))){var r=t.consumer.generatedPositionFor(e);if(r)return{line:r.line+(t.generatedOffset.generatedLine-1),column:r.column+(t.generatedOffset.generatedLine===r.line?t.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},ne.prototype._parseMappings=function(e,n){this.__generatedMappings=[],this.__originalMappings=[];for(var t=0;t<this._sections.length;t++)for(var r=this._sections[t],o=r.consumer._generatedMappings,i=0;i<o.length;i++){var s=o[i],u=r.consumer._sources.at(s.source);u=H.computeSourceURL(r.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var a=null;s.name&&(a=r.consumer._names.at(s.name),this._names.add(a),a=this._names.indexOf(a));var c={source:u,generatedLine:s.generatedLine+(r.generatedOffset.generatedLine-1),generatedColumn:s.generatedColumn+(r.generatedOffset.generatedLine===s.generatedLine?r.generatedOffset.generatedColumn-1:0),originalLine:s.originalLine,originalColumn:s.originalColumn,name:a};this.__generatedMappings.push(c),"number"==typeof c.originalLine&&this.__originalMappings.push(c)}q(this.__generatedMappings,H.compareByGeneratedPositionsDeflated),q(this.__originalMappings,H.compareByOriginalPositions)},F.IndexedSourceMapConsumer=ne;var te={},re=S.SourceMapGenerator,oe=I,ie=/(\r?\n)/,se="$$$isSourceNode$$$";function ue(e,n,t,r,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==n?null:n,this.source=null==t?null:t,this.name=null==o?null:o,this[se]=!0,null!=r&&this.add(r)}ue.fromStringWithSourceMap=function(e,n,t){var r=new ue,o=e.split(ie),i=0,s=function(){return e()+(e()||"");function e(){return i<o.length?o[i++]:void 0}},u=1,a=0,c=null;return n.eachMapping((function(e){if(null!==c){if(!(u<e.generatedLine)){var n=(t=o[i]||"").substr(0,e.generatedColumn-a);return o[i]=t.substr(e.generatedColumn-a),a=e.generatedColumn,l(c,n),void(c=e)}l(c,s()),u++,a=0}for(;u<e.generatedLine;)r.add(s()),u++;var t;a<e.generatedColumn&&(r.add((t=o[i]||"").substr(0,e.generatedColumn)),o[i]=t.substr(e.generatedColumn),a=e.generatedColumn);c=e}),this),i<o.length&&(c&&l(c,s()),r.add(o.splice(i).join(""))),n.sources.forEach((function(e){var o=n.sourceContentFor(e);null!=o&&(null!=t&&(e=oe.join(t,e)),r.setSourceContent(e,o))})),r;function l(e,n){if(null===e||void 0===e.source)r.add(n);else{var o=t?oe.join(t,e.source):e.source;r.add(new ue(e.originalLine,e.originalColumn,o,n,e.name))}}},ue.prototype.add=function(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[se]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},ue.prototype.prepend=function(e){if(Array.isArray(e))for(var n=e.length-1;n>=0;n--)this.prepend(e[n]);else{if(!e[se]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},ue.prototype.walk=function(e){for(var n,t=0,r=this.children.length;t<r;t++)(n=this.children[t])[se]?n.walk(e):""!==n&&e(n,{source:this.source,line:this.line,column:this.column,name:this.name})},ue.prototype.join=function(e){var n,t,r=this.children.length;if(r>0){for(n=[],t=0;t<r-1;t++)n.push(this.children[t]),n.push(e);n.push(this.children[t]),this.children=n}return this},ue.prototype.replaceRight=function(e,n){var t=this.children[this.children.length-1];return t[se]?t.replaceRight(e,n):"string"==typeof t?this.children[this.children.length-1]=t.replace(e,n):this.children.push("".replace(e,n)),this},ue.prototype.setSourceContent=function(e,n){this.sourceContents[oe.toSetString(e)]=n},ue.prototype.walkSourceContents=function(e){for(var n=0,t=this.children.length;n<t;n++)this.children[n][se]&&this.children[n].walkSourceContents(e);var r=Object.keys(this.sourceContents);for(n=0,t=r.length;n<t;n++)e(oe.fromSetString(r[n]),this.sourceContents[r[n]])},ue.prototype.toString=function(){var e="";return this.walk((function(n){e+=n})),e},ue.prototype.toStringWithSourceMap=function(e){var n={code:"",line:1,column:0},t=new re(e),r=!1,o=null,i=null,s=null,u=null;return this.walk((function(e,a){n.code+=e,null!==a.source&&null!==a.line&&null!==a.column?(o===a.source&&i===a.line&&s===a.column&&u===a.name||t.addMapping({source:a.source,original:{line:a.line,column:a.column},generated:{line:n.line,column:n.column},name:a.name}),o=a.source,i=a.line,s=a.column,u=a.name,r=!0):r&&(t.addMapping({generated:{line:n.line,column:n.column}}),o=null,r=!1);for(var c=0,l=e.length;c<l;c++)10===e.charCodeAt(c)?(n.line++,n.column=0,c+1===l?(o=null,r=!1):r&&t.addMapping({source:a.source,original:{line:a.line,column:a.column},generated:{line:n.line,column:n.column},name:a.name})):n.column++})),this.walkSourceContents((function(e,n){t.setSourceContent(e,n)})),{code:n.code,map:t}},te.SourceNode=ue;var ae=y.SourceMapGenerator=S.SourceMapGenerator;function ce(e,n){const{sourceMap:t,filename:r,breakLineCode:o,needIndent:i}=n,u={source:e.loc.source,filename:r,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:i,indentLevel:0};function a(e,n){var t,r;u.code+=e,u.map&&(n&&n.loc&&n.loc!==s&&(t=n.loc.start,r=function(e){switch(e.type){case 3:return e.value;case 5:return e.index.toString();case 4:return e.key;case 9:case 8:case 7:return e.value;default:return}}(n),u.map.addMapping({name:r,source:u.filename,original:{line:t.line,column:t.column-1},generated:{line:u.line,column:u.column-1}})),function(e,n,t=n.length){let r=0,o=-1;for(let e=0;e<t;e++)10===n.charCodeAt(e)&&(r++,o=e);e.offset+=t,e.line+=r,e.column=-1===o?e.column+t:t-o}(u,e))}function c(e,n=!0){const t=n?o:"";a(i?t+" ".repeat(e):t)}return t&&(u.map=new ae,u.map.setSourceContent(r,u.source)),{context:()=>u,push:a,indent:function(e=!0){const n=++u.indentLevel;e&&c(n)},deindent:function(e=!0){const n=--u.indentLevel;e&&c(n)},newline:function(){c(u.indentLevel)},helper:e=>`_${e}`,needIndent:()=>u.needIndent}}function le(e,n){const{helper:t}=e;switch(n.type){case 0:!function(e,n){n.body?le(e,n.body):e.push("null")}(e,n);break;case 1:!function(e,n){const{helper:t,needIndent:r}=e;if(n.cases.length>1){e.push(`${t("plural")}([`),e.indent(r());const o=n.cases.length;for(let t=0;t<o&&(le(e,n.cases[t]),t!==o-1);t++)e.push(", ");e.deindent(r()),e.push("])")}}(e,n);break;case 2:!function(e,n){const{helper:t,needIndent:r}=e;e.push(`${t("normalize")}([`),e.indent(r());const o=n.items.length;for(let t=0;t<o&&(le(e,n.items[t]),t!==o-1);t++)e.push(", ");e.deindent(r()),e.push("])")}(e,n);break;case 6:!function(e,n){const{helper:t}=e;e.push(`${t("linked")}(`),le(e,n.key),n.modifier&&(e.push(", "),le(e,n.modifier)),e.push(")")}(e,n);break;case 8:case 7:e.push(JSON.stringify(n.value),n);break;case 5:e.push(`${t("interpolate")}(${t("list")}(${n.index}))`,n);break;case 4:e.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(n.key)}))`,n);break;case 9:case 3:e.push(JSON.stringify(n.value),n)}}y.SourceMapConsumer=F.SourceMapConsumer,y.SourceNode=te.SourceNode;function pe(t,r={}){const o=e({},r),i=_(o).parse(t);return A(i,o),((e,t={})=>{const r=n(t.mode)?t.mode:"normal",o=n(t.filename)?t.filename:"message.intl",i=t.needIndent?t.needIndent:"arrow"!==r,s=e.helpers||[],u=ce(e,{mode:r,filename:o,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===r?";":"\n",needIndent:i});u.push("normal"===r?"function __msg__ (ctx) {":"(ctx) => {"),u.indent(i),s.length>0&&(u.push(`const { ${s.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),u.newline()),u.push("return "),le(u,e),u.deindent(i),u.push("}");const{code:a,map:c}=u.context();return{ast:e,code:a,map:c?c.toJSON():void 0}})(i,o)}export{t as CompileErrorCodes,g as ERROR_DOMAIN,s as LocationStub,pe as baseCompile,o as createCompileError,a as createLocation,_ as createParser,u as createPosition,i as defaultOnError,r as errorMessages};
6
+ const e=Object.assign,t=e=>"string"==typeof e,n={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15},r={[n.EXPECTED_TOKEN]:"Expected token: '{0}'",[n.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[n.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[n.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[n.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[n.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[n.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[n.EMPTY_PLACEHOLDER]:"Empty placeholder",[n.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[n.INVALID_LINKED_FORMAT]:"Invalid linked format",[n.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[n.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[n.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[n.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'"};function c(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 o(e){throw e}const s={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0}};function u(e,t,n){return{line:e,column:t,offset:n}}function a(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const i=String.fromCharCode(8232),l=String.fromCharCode(8233);function f(e){const t=e;let n=0,r=1,c=1,o=0;const s=e=>"\r"===t[e]&&"\n"===t[e+1],u=e=>t[e]===l,a=e=>t[e]===i,f=e=>s(e)||(e=>"\n"===t[e])(e)||u(e)||a(e),d=e=>s(e)||u(e)||a(e)?"\n":t[e];function p(){return o=0,f(n)&&(r++,c=0),s(n)&&n++,n++,c++,t[n]}return{index:()=>n,line:()=>r,column:()=>c,peekOffset:()=>o,charAt:d,currentChar:()=>d(n),currentPeek:()=>d(n+o),next:p,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;)p();o=0}}}const d=void 0;function p(e,t={}){const n=!1!==t.location,r=f(e),c=()=>r.index(),o=()=>u(r.line(),r.column(),r.index()),s=o(),i=c(),l={currentType:14,offset:i,startLoc:s,endLoc:s,lastType:14,lastOffset:i,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},p=()=>l,{onError:E}=t;function L(e,t,r){e.endLoc=o(),e.currentType=t;const c={type:t};return n&&(c.loc=a(e.startLoc,e.endLoc)),null!=r&&(c.value=r),c}const k=e=>L(e,14);function h(e,t){return e.currentChar()===t?(e.next(),t):(o(),"")}function N(e){let t="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)t+=e.currentPeek(),e.peek();return t}function _(e){const t=N(e);return e.skipToPeek(),t}function T(e){if(e===d)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function C(e,t){const{currentType:n}=t;if(2!==n)return!1;N(e);const r=function(e){if(e===d)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function P(e){N(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function x(e,t=!0){const n=(t=!1,r="",c=!1)=>{const o=e.currentPeek();return"{"===o?"%"!==r&&t:"@"!==o&&o?"%"===o?(e.peek(),n(t,"%",!0)):"|"===o?!("%"!==r&&!c)||!(" "===r||"\n"===r):" "===o?(e.peek(),n(!0," ",c)):"\n"!==o||(e.peek(),n(!0,"\n",c)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function y(e,t){const n=e.currentChar();return n===d?d:t(n)?(e.next(),n):null}function m(e){return y(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function I(e){return y(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function O(e){return y(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function S(e){let t="",n="";for(;t=I(e);)n+=t;return n}function A(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return b(e,t,4);case"U":return b(e,t,6);default:return o(),""}}function b(e,t,n){h(e,t);let r="";for(let t=0;t<n;t++){const t=O(e);if(!t){o(),e.currentChar();break}r+=t}return`\\${t}${r}`}function v(e){_(e);const t=h(e,"|");return _(e),t}function D(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&o(),e.next(),n=L(t,2,"{"),_(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&o(),e.next(),n=L(t,3,"}"),t.braceNest--,t.braceNest>0&&_(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&o(),n=U(e,t)||k(t),t.braceNest=0,n;default:let r=!0,c=!0,s=!0;if(P(e))return t.braceNest>0&&o(),n=L(t,1,v(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return o(),t.braceNest=0,g(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;N(e);const r=T(e.currentPeek());return e.resetPeek(),r}(e,t))return n=L(t,5,function(e){_(e);let t="",n="";for(;t=m(e);)n+=t;return e.currentChar()===d&&o(),n}(e)),_(e),n;if(c=C(e,t))return n=L(t,6,function(e){_(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${S(e)}`):t+=S(e),e.currentChar()===d&&o(),t}(e)),_(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;N(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=L(t,7,function(e){_(e),h(e,"'");let t="",n="";const r=e=>"'"!==e&&"\n"!==e;for(;t=y(e,r);)n+="\\"===t?A(e):t;const c=e.currentChar();return"\n"===c||c===d?(o(),"\n"===c&&(e.next(),h(e,"'")),n):(h(e,"'"),n)}(e)),_(e),n;if(!r&&!c&&!s)return n=L(t,13,function(e){_(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;t=y(e,r);)n+=t;return n}(e)),o(),n.value,_(e),n}return n}function U(e,t){const{currentType:n}=t;let r=null;const c=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||"\n"!==c&&" "!==c||o(),c){case"@":return e.next(),r=L(t,8,"@"),t.inLinked=!0,r;case".":return _(e),e.next(),L(t,9,".");case":":return _(e),e.next(),L(t,10,":");default:return P(e)?(r=L(t,1,v(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;N(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;N(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(_(e),U(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;N(e);const r=T(e.currentPeek());return e.resetPeek(),r}(e,t)?(_(e),L(t,12,function(e){let t="",n="";for(;t=m(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?T(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||" "===t||!t)&&("\n"===t?(e.peek(),r()):T(t))},c=r();return e.resetPeek(),c}(e,t)?(_(e),"{"===c?D(e,t)||r:L(t,11,function(e){const t=(n=!1,r)=>{const c=e.currentChar();return"{"!==c&&"%"!==c&&"@"!==c&&"|"!==c&&c?" "===c?r:"\n"===c?(r+=c,e.next(),t(n,r)):(r+=c,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&o(),t.braceNest=0,t.inLinked=!1,g(e,t))}}function g(e,t){let n={type:14};if(t.braceNest>0)return D(e,t)||k(t);if(t.inLinked)return U(e,t)||k(t);const r=e.currentChar();switch(r){case"{":return D(e,t)||k(t);case"}":return o(),e.next(),L(t,3,"}");case"@":return U(e,t)||k(t);default:if(P(e))return n=L(t,1,v(e)),t.braceNest=0,t.inLinked=!1,n;if(x(e))return L(t,0,function(e){let t="";for(;;){const n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if("%"===n){if(!x(e))break;t+=n,e.next()}else if(" "===n||"\n"===n)if(x(e))t+=n,e.next();else{if(P(e))break;t+=n,e.next()}else t+=n,e.next()}return t}(e));if("%"===r)return e.next(),L(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=l;return l.lastType=e,l.lastOffset=t,l.lastStartLoc=n,l.lastEndLoc=s,l.offset=c(),l.startLoc=o(),r.currentChar()===d?L(l,14):g(r,l)},currentOffset:c,currentPosition:o,context:p}}const E="parser",L=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function k(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function h(t={}){const n=!1!==t.location,{onError:r}=t;function c(e,t,r){const c={type:e,start:t,end:t};return n&&(c.loc={start:r,end:r}),c}function o(e,t,r,c){e.end=t,c&&(e.type=c),n&&e.loc&&(e.loc.end=r)}function s(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 u(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 a(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 i(e,t){const n=e.context(),{lastOffset:r,lastStartLoc:s}=n,u=c(9,r,s);return u.value=t.replace(L,k),e.nextToken(),o(u,e.currentOffset(),e.currentPosition()),u}function l(e){const t=e.context(),n=c(6,t.offset,t.startLoc);let r=e.nextToken();if(9===r.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:r,lastStartLoc:s}=n,u=c(8,r,s);return 12!==t.type?(n.lastStartLoc,u.value="",o(u,r,s),{nextConsumeToken:t,node:u}):(null==t.value&&(n.lastStartLoc,N(t)),u.value=t.value||"",o(u,e.currentOffset(),e.currentPosition()),{node:u})}(e);n.modifier=t.node,r=t.nextConsumeToken||e.nextToken()}switch(10!==r.type&&(t.lastStartLoc,N(r)),r=e.nextToken(),2===r.type&&(r=e.nextToken()),r.type){case 11:null==r.value&&(t.lastStartLoc,N(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 5:null==r.value&&(t.lastStartLoc,N(r)),n.key=a(e,r.value||"");break;case 6:null==r.value&&(t.lastStartLoc,N(r)),n.key=u(e,r.value||"");break;case 7:null==r.value&&(t.lastStartLoc,N(r)),n.key=i(e,r.value||"");break;default:t.lastStartLoc;const s=e.context(),l=c(7,s.offset,s.startLoc);return l.value="",o(l,s.offset,s.startLoc),n.key=l,o(n,s.offset,s.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&&(t.lastStartLoc,N(c)),n.items.push(s(e,c.value||""));break;case 6:null==c.value&&(t.lastStartLoc,N(c)),n.items.push(u(e,c.value||""));break;case 5:null==c.value&&(t.lastStartLoc,N(c)),n.items.push(a(e,c.value||""));break;case 7:null==c.value&&(t.lastStartLoc,N(c)),n.items.push(i(e,c.value||""));break;case 8:const o=l(e);n.items.push(o.node),r=o.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function d(e){const t=e.context(),{offset:n,startLoc:r}=t,s=f(e);return 14===t.currentType?s:function(e,t,n,r){const s=e.context();let u=0===r.items.length;const a=c(1,t,n);a.cases=[],a.cases.push(r);do{const t=f(e);u||(u=0===t.items.length),a.cases.push(t)}while(14!==s.currentType);return o(a,e.currentOffset(),e.currentPosition()),a}(e,n,r,s)}return{parse:function(r){const s=p(r,e({},t)),u=s.context(),a=c(0,u.offset,u.startLoc);return n&&a.loc&&(a.loc.source=r),a.body=d(s),14!==u.currentType&&(u.lastStartLoc,r[u.offset]),o(a,s.currentOffset(),s.currentPosition()),a}}}function N(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function _(e,t){for(let n=0;n<e.length;n++)T(e[n],t)}function T(e,t){switch(e.type){case 1:_(e.cases,t),t.helper("plural");break;case 2:_(e.items,t);break;case 6:T(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function C(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&&T(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function P(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?P(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&&(P(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 n=0;n<c&&(P(e,t.items[n]),n!==c-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),P(e,t.key),t.modifier&&(e.push(", "),P(e,t.modifier)),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 x(n,r={}){const c=e({},r),o=h(c).parse(n);return C(o,c),((e,n={})=>{const r=t(n.mode)?n.mode:"normal",c=t(n.filename)?n.filename:"message.intl",o=!!n.sourceMap,s=null!=n.breakLineCode?n.breakLineCode:"arrow"===r?";":"\n",u=n.needIndent?n.needIndent:"arrow"!==r,a=e.helpers||[],i=function(e,t){const{sourceMap:n,filename:r,breakLineCode:c,needIndent:o}=t,s={source:e.loc.source,filename:r,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:c,needIndent:o,indentLevel:0};function u(e,t){s.code+=e}function a(e,t=!0){const n=t?c:"";u(o?n+" ".repeat(e):n)}return{context:()=>s,push:u,indent:function(e=!0){const t=++s.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&a(t)},newline:function(){a(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}(e,{mode:r,filename:c,sourceMap:o,breakLineCode:s,needIndent:u});i.push("normal"===r?"function __msg__ (ctx) {":"(ctx) => {"),i.indent(u),a.length>0&&(i.push(`const { ${a.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),i.newline()),i.push("return "),P(i,e),i.deindent(u),i.push("}");const{code:l,map:f}=i.context();return{ast:e,code:l,map:f?f.toJSON():void 0}})(o,c)}export{n as CompileErrorCodes,E as ERROR_DOMAIN,s as LocationStub,x as baseCompile,c as createCompileError,a as createLocation,h as createParser,u as createPosition,o as defaultOnError,r as errorMessages};
@@ -1,10 +1,9 @@
1
1
  /*!
2
- * message-compiler v9.2.0-beta.3
3
- * (c) 2021 kazuya kawaguchi
2
+ * message-compiler v9.2.0-beta.32
3
+ * (c) 2022 kazuya kawaguchi
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { format, assign, isString } from '@intlify/shared';
7
- import { SourceMapGenerator } from 'source-map';
8
7
 
9
8
  const CompileErrorCodes = {
10
9
  // tokenizer error codes
@@ -429,49 +428,44 @@ function createTokenizer(source, options = {}) {
429
428
  return num;
430
429
  }
431
430
  function readText(scnr) {
432
- const fn = (buf) => {
431
+ let buf = '';
432
+ while (true) {
433
433
  const ch = scnr.currentChar();
434
434
  if (ch === "{" /* BraceLeft */ ||
435
435
  ch === "}" /* BraceRight */ ||
436
436
  ch === "@" /* LinkedAlias */ ||
437
+ ch === "|" /* Pipe */ ||
437
438
  !ch) {
438
- return buf;
439
+ break;
439
440
  }
440
441
  else if (ch === "%" /* Modulo */) {
441
442
  if (isTextStart(scnr)) {
442
443
  buf += ch;
443
444
  scnr.next();
444
- return fn(buf);
445
445
  }
446
446
  else {
447
- return buf;
447
+ break;
448
448
  }
449
449
  }
450
- else if (ch === "|" /* Pipe */) {
451
- return buf;
452
- }
453
450
  else if (ch === CHAR_SP || ch === CHAR_LF) {
454
451
  if (isTextStart(scnr)) {
455
452
  buf += ch;
456
453
  scnr.next();
457
- return fn(buf);
458
454
  }
459
455
  else if (isPluralStart(scnr)) {
460
- return buf;
456
+ break;
461
457
  }
462
458
  else {
463
459
  buf += ch;
464
460
  scnr.next();
465
- return fn(buf);
466
461
  }
467
462
  }
468
463
  else {
469
464
  buf += ch;
470
465
  scnr.next();
471
- return fn(buf);
472
466
  }
473
- };
474
- return fn('');
467
+ }
468
+ return buf;
475
469
  }
476
470
  function readNamedIdentifier(scnr) {
477
471
  skipSpaces(scnr);
@@ -1180,12 +1174,6 @@ function createCodeGenerator(ast, options) {
1180
1174
  const context = () => _context;
1181
1175
  function push(code, node) {
1182
1176
  _context.code += code;
1183
- if (_context.map) {
1184
- if (node && node.loc && node.loc !== LocationStub) {
1185
- addMapping(node.loc.start, getMappingName(node));
1186
- }
1187
- advancePositionWithSource(_context, code);
1188
- }
1189
1177
  }
1190
1178
  function _newline(n, withBreakLine = true) {
1191
1179
  const _breakLineCode = withBreakLine ? breakLineCode : '';
@@ -1204,24 +1192,6 @@ function createCodeGenerator(ast, options) {
1204
1192
  }
1205
1193
  const helper = (key) => `_${key}`;
1206
1194
  const needIndent = () => _context.needIndent;
1207
- function addMapping(loc, name) {
1208
- _context.map.addMapping({
1209
- name,
1210
- source: _context.filename,
1211
- original: {
1212
- line: loc.line,
1213
- column: loc.column - 1
1214
- },
1215
- generated: {
1216
- line: _context.line,
1217
- column: _context.column - 1
1218
- }
1219
- });
1220
- }
1221
- if (sourceMap) {
1222
- _context.map = new SourceMapGenerator();
1223
- _context.map.setSourceContent(filename, _context.source);
1224
- }
1225
1195
  return {
1226
1196
  context,
1227
1197
  push,
@@ -1360,42 +1330,7 @@ const generate = (ast, options = {} // eslint-disable-line
1360
1330
  code,
1361
1331
  map: map ? map.toJSON() : undefined // eslint-disable-line @typescript-eslint/no-explicit-any
1362
1332
  };
1363
- };
1364
- function getMappingName(node) {
1365
- switch (node.type) {
1366
- case 3 /* Text */:
1367
- return node.value;
1368
- case 5 /* List */:
1369
- return node.index.toString();
1370
- case 4 /* Named */:
1371
- return node.key;
1372
- case 9 /* Literal */:
1373
- return node.value;
1374
- case 8 /* LinkedModifier */:
1375
- return node.value;
1376
- case 7 /* LinkedKey */:
1377
- return node.value;
1378
- default:
1379
- return undefined;
1380
- }
1381
- }
1382
- function advancePositionWithSource(pos, source, numberOfCharacters = source.length) {
1383
- let linesCount = 0;
1384
- let lastNewLinePos = -1;
1385
- for (let i = 0; i < numberOfCharacters; i++) {
1386
- if (source.charCodeAt(i) === 10 /* newline char code */) {
1387
- linesCount++;
1388
- lastNewLinePos = i;
1389
- }
1390
- }
1391
- pos.offset += numberOfCharacters;
1392
- pos.line += linesCount;
1393
- pos.column =
1394
- lastNewLinePos === -1
1395
- ? pos.column + numberOfCharacters
1396
- : numberOfCharacters - lastNewLinePos;
1397
- return pos;
1398
- }
1333
+ };
1399
1334
 
1400
1335
  function baseCompile(source, options = {}) {
1401
1336
  const assignedOptions = assign({}, options);