Socket
Socket
Sign inDemoInstall

intl-messageformat-parser

Package Overview
Dependencies
Maintainers
4
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intl-messageformat-parser - npm Package Compare versions

Comparing version 3.2.4 to 3.2.5

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [3.2.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.4...intl-messageformat-parser@3.2.5) (2019-11-23)
### Bug Fixes
* **intl-messageformat-parser:** fix duplicate parse exports, fix [#290](https://github.com/formatjs/formatjs/issues/290) ([4e20dbd](https://github.com/formatjs/formatjs/commit/4e20dbd16f44df8c034066ba328d22be2fbc082e))
## [3.2.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.2.3...intl-messageformat-parser@3.2.4) (2019-11-21)

@@ -8,0 +19,0 @@

2

dist/index.js

@@ -11,3 +11,3 @@ "use strict";

function parse(input, opts) {
var els = parser_1.parse(input, opts);
var els = parser_1.pegParse(input, opts);
if (!opts || opts.normalizeHashtagInPlural !== false) {

@@ -14,0 +14,0 @@ normalize_1.normalizeHashtagInPlural(els);

@@ -43,3 +43,3 @@ "use strict";

var newValue = literalEl.value.replace(PLURAL_HASHTAG_REGEX, "$1{" + el.value + ", number}");
var newEls = parser_1.parse(newValue);
var newEls = parser_1.pegParse(newValue);
(_a = opt.value).splice.apply(_a, __spreadArrays([matchingLiteralElIndex, 1], newEls));

@@ -46,0 +46,0 @@ }

@@ -51,2 +51,2 @@ import { MessageFormatElement } from './types';

export declare type ParseFunction = (input: string, options?: IParseOptions) => MessageFormatElement[];
export declare const parse: ParseFunction;
export declare const pegParse: ParseFunction;

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).IntlMessageFormatParser={})}(this,function(Pt){"use strict";var e;function f(e){return e.type===Pt.TYPE.literal}function n(e){return e.type===Pt.TYPE.select}function u(e){return e.type===Pt.TYPE.plural}(e=Pt.TYPE||(Pt.TYPE={}))[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural";var a,o,t=(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Tt=function(){return(Tt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)},Ft=(o=Error,t(c,o),c.buildMessage=function(e,t){function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function a(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)});return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}return"Expected "+function(e){var t,r,n=e.map(a);if(n.sort(),0<n.length){for(r=t=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+((o=t)?'"'+n(o)+'"':"end of input")+" found.";var o},c);function c(e,t,r,n){var u=o.call(this)||this;return u.message=e,u.expected=t,u.found=r,u.location=n,u.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(u,c),u}var p=function(f,e){e=void 0!==e?e:{};var t,r,n,u,p={},a={start:rt},o=rt,c=function(e){return e.join("")},i=function(e){return Tt({type:Pt.TYPE.literal,value:e},Ct())},l=We("argumentElement"),h="{",A=Qe("{",!1),v="}",d=Qe("}",!1),s=function(e){return Tt({type:Pt.TYPE.argument,value:e},Ct())},g=We("numberSkeletonId"),m=/^['\/{}]/,y=Ve(["'","/","{","}"],!1,!1),b={type:"any"},E=We("numberSkeletonTokenOption"),x="/",C=Qe("/",!1),P=function(e){return e},T=We("numberSkeletonToken"),F=function(e,t){return{stem:e,options:t}},Y=function(e){return Tt({type:0,tokens:e},Ct())},w="::",k=Qe("::",!1),O=function(e){return e},S=function(e){return e.replace(/\s*$/,"")},j=",",_=Qe(",",!1),B="number",D=Qe("number",!1),N=function(e,t,r){return Tt({type:"number"===t?Pt.TYPE.number:"date"===t?Pt.TYPE.date:Pt.TYPE.time,style:r&&r[2],value:e},Ct())},z="'",I=Qe("'",!1),M=/^[^']/,R=Ve(["'"],!0,!1),Z=/^[^a-zA-Z'{}]/,L=Ve([["a","z"],["A","Z"],"'","{","}"],!0,!1),$=/^[a-zA-Z]/,H=Ve([["a","z"],["A","Z"]],!1,!1),U=function(e){return Tt({type:1,pattern:e},Ct())},q="date",G=Qe("date",!1),J="time",K=Qe("time",!1),Q="plural",V=Qe("plural",!1),W="selectordinal",X=Qe("selectordinal",!1),ee="offset:",te=Qe("offset:",!1),re=function(e,t,r,n){return Tt({type:Pt.TYPE.plural,pluralType:"plural"===t?"cardinal":"ordinal",value:e,offset:r?r[2]:0,options:n.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return r in e&&Ke('Duplicate option "'+r+'" in plural element: "'+Ge()+'"',Je()),e[r]={value:n,location:u},e},{})},Ct())},ne="select",ue=Qe("select",!1),ae=function(e,t){return Tt({type:Pt.TYPE.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return r in e&&Ke('Duplicate option "'+r+'" in select element: "'+Ge()+'"',Je()),e[r]={value:n,location:u},e},{})},Ct())},oe="=",ce=Qe("=",!1),ie=function(e,t){return Tt({id:e,value:t},Ct())},le=function(e,t){return Tt({id:e,value:t},Ct())},se=We("whitespace pattern"),fe=/^[\t-\r \x85\u200E\u200F\u2028\u2029]/,pe=Ve([["\t","\r"]," ","…","‎","‏","\u2028","\u2029"],!1,!1),he=We("syntax pattern"),Ae=/^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/,ve=Ve([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←","⑟"],["─","❵"],["➔","⯿"],["⸀","⹿"],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),de=We("optional whitespace"),ge=We("number"),me="-",ye=Qe("-",!1),be=function(e,t){return t?e?-t:t:0},Ee=We("double apostrophes"),xe="''",Ce=Qe("''",!1),Pe=function(){return"'"},Te=/^[{}]/,Fe=Ve(["{","}"],!1,!1),Ye=function(e,t){return e+t.replace("''","'")},we=/^[^{}]/,ke=Ve(["{","}"],!0,!1),Oe=We("argNameOrNumber"),Se=We("argNumber"),je="0",_e=Qe("0",!1),Be=function(){return 0},De=/^[1-9]/,Ne=Ve([["1","9"]],!1,!1),ze=/^[0-9]/,Ie=Ve([["0","9"]],!1,!1),Me=function(e){return parseInt(e.join(""),10)},Re=We("argName"),Ze=0,Le=0,$e=[{line:1,column:1}],He=0,Ue=[],qe=0;if(void 0!==e.startRule){if(!(e.startRule in a))throw new Error("Can't start parsing from rule \""+e.startRule+'".');o=a[e.startRule]}function Ge(){return f.substring(Le,Ze)}function Je(){return et(Le,Ze)}function Ke(e,t){throw function(e,t){return new Ft(e,[],"",t)}(e,t=void 0!==t?t:et(Le,Ze))}function Qe(e,t){return{type:"literal",text:e,ignoreCase:t}}function Ve(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function We(e){return{type:"other",description:e}}function Xe(e){var t,r=$e[e];if(r)return r;for(t=e-1;!$e[t];)t--;for(r={line:(r=$e[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return $e[e]=r}function et(e,t){var r=Xe(e),n=Xe(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function tt(e){Ze<He||(He<Ze&&(He=Ze,Ue=[]),Ue.push(e))}function rt(){return nt()}function nt(){var e,t;for(e=[],t=ut();t!==p;)e.push(t),t=ut();return e}function ut(){var e;return(e=function(){var e,t;e=Ze,(t=at())!==p&&(Le=e,t=i(t));return e=t}())===p&&(e=function(){var e,t,r,n,u;qe++,e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));e=t!==p?(r=vt(),r!==p?(n=bt())!==p?vt()!==p?(125===f.charCodeAt(Ze)?(u=v,Ze++):(u=p,0===qe&&tt(d)),u!==p?(Le=e,t=s(n)):(Ze=e,p)):(Ze=e,p):(Ze=e,p):(Ze=e,p)):(Ze=e,p);qe--,e===p&&(t=p,0===qe&&tt(l));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,u,a,o,c,i,l;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));e=t!==p?(r=vt(),r!==p?(n=bt())!==p?vt()!==p?(44===f.charCodeAt(Ze)?(u=j,Ze++):(u=p,0===qe&&tt(_)),u!==p?vt()!==p?(f.substr(Ze,6)===B?(a=B,Ze+=6):(a=p,0===qe&&tt(D)),a!==p?vt()!==p?(o=Ze,44===f.charCodeAt(Ze)?(c=j,Ze++):(c=p,0===qe&&tt(_)),(o=c!==p?(i=vt())!==p?(l=function(){var e,t,r;e=Ze,f.substr(Ze,2)===w?(t=w,Ze+=2):(t=p,0===qe&&tt(k));e=t!==p?(r=function(){var e,t,r;if(e=Ze,t=[],(r=it())!==p)for(;r!==p;)t.push(r),r=it();else t=p;t!==p&&(Le=e,t=Y(t));return e=t}(),r!==p?(Le=e,t=O(r)):(Ze=e,p)):(Ze=e,p);e===p&&(e=Ze,(t=at())!==p&&(Le=e,t=S(t)),e=t);return e}())!==p?c=[c,i,l]:(Ze=o,p):(Ze=o,p):(Ze=o,p))===p&&(o=null),o!==p?(c=vt())!==p?(125===f.charCodeAt(Ze)?(i=v,Ze++):(i=p,0===qe&&tt(d)),i!==p?(Le=e,t=N(n,a,o)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p):(Ze=e,p)):(Ze=e,p);return e}())===p&&(e=function(){var e,t,r,n,u,a,o,c,i,l;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));e=t!==p?(r=vt(),r!==p?(n=bt())!==p?vt()!==p?(44===f.charCodeAt(Ze)?(u=j,Ze++):(u=p,0===qe&&tt(_)),u!==p?vt()!==p?(f.substr(Ze,4)===q?(a=q,Ze+=4):(a=p,0===qe&&tt(G)),a===p&&(f.substr(Ze,4)===J?(a=J,Ze+=4):(a=p,0===qe&&tt(K))),a!==p?vt()!==p?(o=Ze,44===f.charCodeAt(Ze)?(c=j,Ze++):(c=p,0===qe&&tt(_)),(o=c!==p?(i=vt())!==p?(l=function(){var e,t,r;e=Ze,f.substr(Ze,2)===w?(t=w,Ze+=2):(t=p,0===qe&&tt(k));e=t!==p?(r=function(){var e,t,r,n;t=e=Ze,r=[],(n=lt())===p&&(n=st());if(n!==p)for(;n!==p;)r.push(n),(n=lt())===p&&(n=st());else r=p;t=r!==p?f.substring(t,Ze):r;t!==p&&(Le=e,t=U(t));return e=t}(),r!==p?(Le=e,t=O(r)):(Ze=e,p)):(Ze=e,p);e===p&&(e=Ze,(t=at())!==p&&(Le=e,t=S(t)),e=t);return e}())!==p?c=[c,i,l]:(Ze=o,p):(Ze=o,p):(Ze=o,p))===p&&(o=null),o!==p?(c=vt())!==p?(125===f.charCodeAt(Ze)?(i=v,Ze++):(i=p,0===qe&&tt(d)),i!==p?(Le=e,t=N(n,a,o)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p):(Ze=e,p)):(Ze=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,u,a,o,c,i,l,s;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));if(t!==p)if(vt()!==p)if((r=bt())!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(n=j,Ze++):(n=p,0===qe&&tt(_)),n!==p)if(vt()!==p)if(f.substr(Ze,6)===Q?(u=Q,Ze+=6):(u=p,0===qe&&tt(V)),u===p&&(f.substr(Ze,13)===W?(u=W,Ze+=13):(u=p,0===qe&&tt(X))),u!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(a=j,Ze++):(a=p,0===qe&&tt(_)),a!==p)if(vt()!==p)if(o=Ze,f.substr(Ze,7)===ee?(c=ee,Ze+=7):(c=p,0===qe&&tt(te)),(o=c!==p?(i=vt())!==p?(l=dt())!==p?c=[c,i,l]:(Ze=o,p):(Ze=o,p):(Ze=o,p))===p&&(o=null),o!==p)if((c=vt())!==p){if(i=[],(l=pt())!==p)for(;l!==p;)i.push(l),l=pt();else i=p;e=i!==p?(l=vt())!==p?(125===f.charCodeAt(Ze)?(s=v,Ze++):(s=p,0===qe&&tt(d)),s!==p?(Le=e,t=re(r,u,o,i)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,u,a,o,c,i;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));if(t!==p)if(vt()!==p)if((r=bt())!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(n=j,Ze++):(n=p,0===qe&&tt(_)),n!==p)if(vt()!==p)if(f.substr(Ze,6)===ne?(u=ne,Ze+=6):(u=p,0===qe&&tt(ue)),u!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(a=j,Ze++):(a=p,0===qe&&tt(_)),a!==p)if(vt()!==p){if(o=[],(c=ft())!==p)for(;c!==p;)o.push(c),c=ft();else o=p;e=o!==p?(c=vt())!==p?(125===f.charCodeAt(Ze)?(i=v,Ze++):(i=p,0===qe&&tt(d)),i!==p?(Le=e,t=ae(r,o)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;return e}()),e}function at(){var e,t,r;if(e=Ze,t=[],(r=gt())===p&&(r=mt())===p&&(r=yt()),r!==p)for(;r!==p;)t.push(r),(r=gt())===p&&(r=mt())===p&&(r=yt());else t=p;return t!==p&&(Le=e,t=c(t)),e=t}function ot(){var e,t,r,n,u;if(qe++,t=[],n=r=e=Ze,qe++,(u=ht())===p&&(m.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(y))),qe--,(r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p))!==p)for(;r!==p;)t.push(r),n=r=Ze,qe++,(u=ht())===p&&(m.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(y))),qe--,r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p);else t=p;return e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(g)),e}function ct(){var e,t,r;return qe++,e=Ze,47===f.charCodeAt(Ze)?(t=x,Ze++):(t=p,0===qe&&tt(C)),e=t!==p&&(r=ot())!==p?(Le=e,t=P(r)):(Ze=e,p),qe--,e===p&&(t=p,0===qe&&tt(E)),e}function it(){var e,t,r,n;if(qe++,e=Ze,vt()!==p)if((t=ot())!==p){for(r=[],n=ct();n!==p;)r.push(n),n=ct();e=r!==p?(Le=e,F(t,r)):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;return qe--,e===p&&(p,0===qe&&tt(T)),e}function lt(){var e,t,r,n;if(e=Ze,39===f.charCodeAt(Ze)?(t=z,Ze++):(t=p,0===qe&&tt(I)),t!==p){if(r=[],(n=gt())===p&&(M.test(f.charAt(Ze))?(n=f.charAt(Ze),Ze++):(n=p,0===qe&&tt(R))),n!==p)for(;n!==p;)r.push(n),(n=gt())===p&&(M.test(f.charAt(Ze))?(n=f.charAt(Ze),Ze++):(n=p,0===qe&&tt(R)));else r=p;e=r!==p?(39===f.charCodeAt(Ze)?(n=z,Ze++):(n=p,0===qe&&tt(I)),n!==p?t=[t,r,n]:(Ze=e,p)):(Ze=e,p)}else Ze=e,e=p;if(e===p)if(e=[],(t=gt())===p&&(Z.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(L))),t!==p)for(;t!==p;)e.push(t),(t=gt())===p&&(Z.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(L)));else e=p;return e}function st(){var e,t;if(e=[],$.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(H)),t!==p)for(;t!==p;)e.push(t),$.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(H));else e=p;return e}function ft(){var e,t,r,n,u;return e=Ze,e=vt()!==p&&(t=xt())!==p&&vt()!==p?(123===f.charCodeAt(Ze)?(r=h,Ze++):(r=p,0===qe&&tt(A)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Ze)?(u=v,Ze++):(u=p,0===qe&&tt(d)),u!==p?(Le=e,ie(t,n)):(Ze=e,p)):(Ze=e,p)):(Ze=e,p)}function pt(){var e,t,r,n,u;return e=Ze,e=vt()!==p&&(t=function(){var e,t,r,n;return t=e=Ze,61===f.charCodeAt(Ze)?(r=oe,Ze++):(r=p,0===qe&&tt(ce)),(e=(t=r!==p&&(n=dt())!==p?r=[r,n]:(Ze=t,p))!==p?f.substring(e,Ze):t)===p&&(e=xt()),e}())!==p&&vt()!==p?(123===f.charCodeAt(Ze)?(r=h,Ze++):(r=p,0===qe&&tt(A)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Ze)?(u=v,Ze++):(u=p,0===qe&&tt(d)),u!==p?(Le=e,le(t,n)):(Ze=e,p)):(Ze=e,p)):(Ze=e,p)}function ht(){var e;return qe++,fe.test(f.charAt(Ze))?(e=f.charAt(Ze),Ze++):(e=p,0===qe&&tt(pe)),qe--,e===p&&0===qe&&tt(se),e}function At(){var e;return qe++,Ae.test(f.charAt(Ze))?(e=f.charAt(Ze),Ze++):(e=p,0===qe&&tt(ve)),qe--,e===p&&0===qe&&tt(he),e}function vt(){var e,t,r;for(qe++,e=Ze,t=[],r=ht();r!==p;)t.push(r),r=ht();return e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(de)),e}function dt(){var e,t,r;return qe++,e=Ze,45===f.charCodeAt(Ze)?(t=me,Ze++):(t=p,0===qe&&tt(ye)),t===p&&(t=null),e=t!==p&&(r=Et())!==p?(Le=e,t=be(t,r)):(Ze=e,p),qe--,e===p&&(t=p,0===qe&&tt(ge)),e}function gt(){var e,t;return qe++,e=Ze,f.substr(Ze,2)===xe?(t=xe,Ze+=2):(t=p,0===qe&&tt(Ce)),t!==p&&(Le=e,t=Pe()),qe--,(e=t)===p&&(t=p,0===qe&&tt(Ee)),e}function mt(){var e,t,r,n,u,a;if(e=Ze,39===f.charCodeAt(Ze)?(t=z,Ze++):(t=p,0===qe&&tt(I)),t!==p)if(Te.test(f.charAt(Ze))?(r=f.charAt(Ze),Ze++):(r=p,0===qe&&tt(Fe)),r!==p){for(n=Ze,u=[],f.substr(Ze,2)===xe?(a=xe,Ze+=2):(a=p,0===qe&&tt(Ce)),a===p&&(M.test(f.charAt(Ze))?(a=f.charAt(Ze),Ze++):(a=p,0===qe&&tt(R)));a!==p;)u.push(a),f.substr(Ze,2)===xe?(a=xe,Ze+=2):(a=p,0===qe&&tt(Ce)),a===p&&(M.test(f.charAt(Ze))?(a=f.charAt(Ze),Ze++):(a=p,0===qe&&tt(R)));e=(n=u!==p?f.substring(n,Ze):u)!==p?(39===f.charCodeAt(Ze)?(u=z,Ze++):(u=p,0===qe&&tt(I)),u!==p?(Le=e,t=Ye(r,n)):(Ze=e,p)):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;return e}function yt(){var e,t;return e=Ze,we.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(ke)),e=t!==p?f.substring(e,Ze):t}function bt(){var e,t;return qe++,e=Ze,(t=Et())===p&&(t=xt()),e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(Oe)),e}function Et(){var e,t,r,n,u;if(qe++,e=Ze,48===f.charCodeAt(Ze)?(t=je,Ze++):(t=p,0===qe&&tt(_e)),t!==p&&(Le=e,t=Be()),(e=t)===p){if(t=e=Ze,De.test(f.charAt(Ze))?(r=f.charAt(Ze),Ze++):(r=p,0===qe&&tt(Ne)),r!==p){for(n=[],ze.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(Ie));u!==p;)n.push(u),ze.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(Ie));t=n!==p?r=[r,n]:(Ze=t,p)}else Ze=t,t=p;t!==p&&(Le=e,t=Me(t)),e=t}return qe--,e===p&&(t=p,0===qe&&tt(Se)),e}function xt(){var e,t,r,n,u;if(qe++,t=[],n=r=e=Ze,qe++,(u=ht())===p&&(u=At()),qe--,(r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p))!==p)for(;r!==p;)t.push(r),n=r=Ze,qe++,(u=ht())===p&&(u=At()),qe--,r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p);else t=p;return e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(Re)),e}function Ct(){return e&&e.captureLocation?{location:Je()}:{}}if((t=o())!==p&&Ze===f.length)return t;throw t!==p&&Ze<f.length&&tt({type:"end"}),r=Ue,n=He<f.length?f.charAt(He):null,u=He<f.length?et(He,He+1):et(He,He),new Ft(Ft.buildMessage(r,n),r,n,u)},h=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),u=0;for(t=0;t<r;t++)for(var a=arguments[t],o=0,c=a.length;o<c;o++,u++)n[u]=a[o];return n},A=/(^|[^\\])#/g;Pt.SyntaxError=Ft,Pt.createLiteralElement=function(e){return{type:Pt.TYPE.literal,value:e}},Pt.createNumberElement=function(e,t){return{type:Pt.TYPE.number,value:e,style:t}},Pt.isArgumentElement=function(e){return e.type===Pt.TYPE.argument},Pt.isDateElement=function(e){return e.type===Pt.TYPE.date},Pt.isDateTimeSkeleton=function(e){return 1===e.type},Pt.isLiteralElement=f,Pt.isNumberElement=function(e){return e.type===Pt.TYPE.number},Pt.isNumberSkeleton=function(e){return 0===e.type},Pt.isPluralElement=u,Pt.isSelectElement=n,Pt.isTimeElement=function(e){return e.type===Pt.TYPE.time},Pt.parse=function(e,t){var r=p(e,t);return t&&!1===t.normalizeHashtagInPlural||function s(e){e.forEach(function(l){(u(l)||n(l))&&Object.keys(l.options).forEach(function(e){for(var t,r=l.options[e],n=-1,u=void 0,a=0;a<r.value.length;a++){var o=r.value[a];if(f(o)&&A.test(o.value)){n=a,u=o;break}}if(u){var c=u.value.replace(A,"$1{"+l.value+", number}"),i=p(c);(t=r.value).splice.apply(t,h([n,1],i))}s(r.value)})})}(r),r},Object.defineProperty(Pt,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).IntlMessageFormatParser={})}(this,function(Pt){"use strict";var e;function f(e){return e.type===Pt.TYPE.literal}function n(e){return e.type===Pt.TYPE.select}function u(e){return e.type===Pt.TYPE.plural}(e=Pt.TYPE||(Pt.TYPE={}))[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural";var a,o,t=(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Tt=function(){return(Tt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)},Ft=(o=Error,t(c,o),c.buildMessage=function(e,t){function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function a(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)});return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}return"Expected "+function(e){var t,r,n=e.map(a);if(n.sort(),0<n.length){for(r=t=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+((o=t)?'"'+n(o)+'"':"end of input")+" found.";var o},c);function c(e,t,r,n){var u=o.call(this)||this;return u.message=e,u.expected=t,u.found=r,u.location=n,u.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(u,c),u}var p=function(f,e){e=void 0!==e?e:{};var t,r,n,u,p={},a={start:rt},o=rt,c=function(e){return e.join("")},i=function(e){return Tt({type:Pt.TYPE.literal,value:e},Ct())},l=We("argumentElement"),h="{",A=Qe("{",!1),v="}",d=Qe("}",!1),s=function(e){return Tt({type:Pt.TYPE.argument,value:e},Ct())},g=We("numberSkeletonId"),m=/^['\/{}]/,y=Ve(["'","/","{","}"],!1,!1),b={type:"any"},E=We("numberSkeletonTokenOption"),x="/",C=Qe("/",!1),P=function(e){return e},T=We("numberSkeletonToken"),F=function(e,t){return{stem:e,options:t}},Y=function(e){return Tt({type:0,tokens:e},Ct())},w="::",k=Qe("::",!1),O=function(e){return e},S=function(e){return e.replace(/\s*$/,"")},j=",",_=Qe(",",!1),B="number",D=Qe("number",!1),N=function(e,t,r){return Tt({type:"number"===t?Pt.TYPE.number:"date"===t?Pt.TYPE.date:Pt.TYPE.time,style:r&&r[2],value:e},Ct())},z="'",I=Qe("'",!1),M=/^[^']/,R=Ve(["'"],!0,!1),Z=/^[^a-zA-Z'{}]/,L=Ve([["a","z"],["A","Z"],"'","{","}"],!0,!1),$=/^[a-zA-Z]/,H=Ve([["a","z"],["A","Z"]],!1,!1),U=function(e){return Tt({type:1,pattern:e},Ct())},q="date",G=Qe("date",!1),J="time",K=Qe("time",!1),Q="plural",V=Qe("plural",!1),W="selectordinal",X=Qe("selectordinal",!1),ee="offset:",te=Qe("offset:",!1),re=function(e,t,r,n){return Tt({type:Pt.TYPE.plural,pluralType:"plural"===t?"cardinal":"ordinal",value:e,offset:r?r[2]:0,options:n.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return r in e&&Ke('Duplicate option "'+r+'" in plural element: "'+Ge()+'"',Je()),e[r]={value:n,location:u},e},{})},Ct())},ne="select",ue=Qe("select",!1),ae=function(e,t){return Tt({type:Pt.TYPE.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return r in e&&Ke('Duplicate option "'+r+'" in select element: "'+Ge()+'"',Je()),e[r]={value:n,location:u},e},{})},Ct())},oe="=",ce=Qe("=",!1),ie=function(e,t){return Tt({id:e,value:t},Ct())},le=function(e,t){return Tt({id:e,value:t},Ct())},se=We("whitespace pattern"),fe=/^[\t-\r \x85\u200E\u200F\u2028\u2029]/,pe=Ve([["\t","\r"]," ","…","‎","‏","\u2028","\u2029"],!1,!1),he=We("syntax pattern"),Ae=/^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/,ve=Ve([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←","⑟"],["─","❵"],["➔","⯿"],["⸀","⹿"],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),de=We("optional whitespace"),ge=We("number"),me="-",ye=Qe("-",!1),be=function(e,t){return t?e?-t:t:0},Ee=We("double apostrophes"),xe="''",Ce=Qe("''",!1),Pe=function(){return"'"},Te=/^[{}]/,Fe=Ve(["{","}"],!1,!1),Ye=function(e,t){return e+t.replace("''","'")},we=/^[^{}]/,ke=Ve(["{","}"],!0,!1),Oe=We("argNameOrNumber"),Se=We("argNumber"),je="0",_e=Qe("0",!1),Be=function(){return 0},De=/^[1-9]/,Ne=Ve([["1","9"]],!1,!1),ze=/^[0-9]/,Ie=Ve([["0","9"]],!1,!1),Me=function(e){return parseInt(e.join(""),10)},Re=We("argName"),Ze=0,Le=0,$e=[{line:1,column:1}],He=0,Ue=[],qe=0;if(void 0!==e.startRule){if(!(e.startRule in a))throw new Error("Can't start parsing from rule \""+e.startRule+'".');o=a[e.startRule]}function Ge(){return f.substring(Le,Ze)}function Je(){return et(Le,Ze)}function Ke(e,t){throw function(e,t){return new Ft(e,[],"",t)}(e,t=void 0!==t?t:et(Le,Ze))}function Qe(e,t){return{type:"literal",text:e,ignoreCase:t}}function Ve(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function We(e){return{type:"other",description:e}}function Xe(e){var t,r=$e[e];if(r)return r;for(t=e-1;!$e[t];)t--;for(r={line:(r=$e[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return $e[e]=r}function et(e,t){var r=Xe(e),n=Xe(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function tt(e){Ze<He||(He<Ze&&(He=Ze,Ue=[]),Ue.push(e))}function rt(){return nt()}function nt(){var e,t;for(e=[],t=ut();t!==p;)e.push(t),t=ut();return e}function ut(){var e;return(e=function(){var e,t;e=Ze,(t=at())!==p&&(Le=e,t=i(t));return e=t}())===p&&(e=function(){var e,t,r,n,u;qe++,e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));e=t!==p?(r=vt(),r!==p?(n=bt())!==p?vt()!==p?(125===f.charCodeAt(Ze)?(u=v,Ze++):(u=p,0===qe&&tt(d)),u!==p?(Le=e,t=s(n)):(Ze=e,p)):(Ze=e,p):(Ze=e,p):(Ze=e,p)):(Ze=e,p);qe--,e===p&&(t=p,0===qe&&tt(l));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,u,a,o,c,i,l;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));e=t!==p?(r=vt(),r!==p?(n=bt())!==p?vt()!==p?(44===f.charCodeAt(Ze)?(u=j,Ze++):(u=p,0===qe&&tt(_)),u!==p?vt()!==p?(f.substr(Ze,6)===B?(a=B,Ze+=6):(a=p,0===qe&&tt(D)),a!==p?vt()!==p?(o=Ze,44===f.charCodeAt(Ze)?(c=j,Ze++):(c=p,0===qe&&tt(_)),(o=c!==p?(i=vt())!==p?(l=function(){var e,t,r;e=Ze,f.substr(Ze,2)===w?(t=w,Ze+=2):(t=p,0===qe&&tt(k));e=t!==p?(r=function(){var e,t,r;if(e=Ze,t=[],(r=it())!==p)for(;r!==p;)t.push(r),r=it();else t=p;t!==p&&(Le=e,t=Y(t));return e=t}(),r!==p?(Le=e,t=O(r)):(Ze=e,p)):(Ze=e,p);e===p&&(e=Ze,(t=at())!==p&&(Le=e,t=S(t)),e=t);return e}())!==p?c=[c,i,l]:(Ze=o,p):(Ze=o,p):(Ze=o,p))===p&&(o=null),o!==p?(c=vt())!==p?(125===f.charCodeAt(Ze)?(i=v,Ze++):(i=p,0===qe&&tt(d)),i!==p?(Le=e,t=N(n,a,o)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p):(Ze=e,p)):(Ze=e,p);return e}())===p&&(e=function(){var e,t,r,n,u,a,o,c,i,l;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));e=t!==p?(r=vt(),r!==p?(n=bt())!==p?vt()!==p?(44===f.charCodeAt(Ze)?(u=j,Ze++):(u=p,0===qe&&tt(_)),u!==p?vt()!==p?(f.substr(Ze,4)===q?(a=q,Ze+=4):(a=p,0===qe&&tt(G)),a===p&&(f.substr(Ze,4)===J?(a=J,Ze+=4):(a=p,0===qe&&tt(K))),a!==p?vt()!==p?(o=Ze,44===f.charCodeAt(Ze)?(c=j,Ze++):(c=p,0===qe&&tt(_)),(o=c!==p?(i=vt())!==p?(l=function(){var e,t,r;e=Ze,f.substr(Ze,2)===w?(t=w,Ze+=2):(t=p,0===qe&&tt(k));e=t!==p?(r=function(){var e,t,r,n;t=e=Ze,r=[],(n=lt())===p&&(n=st());if(n!==p)for(;n!==p;)r.push(n),(n=lt())===p&&(n=st());else r=p;t=r!==p?f.substring(t,Ze):r;t!==p&&(Le=e,t=U(t));return e=t}(),r!==p?(Le=e,t=O(r)):(Ze=e,p)):(Ze=e,p);e===p&&(e=Ze,(t=at())!==p&&(Le=e,t=S(t)),e=t);return e}())!==p?c=[c,i,l]:(Ze=o,p):(Ze=o,p):(Ze=o,p))===p&&(o=null),o!==p?(c=vt())!==p?(125===f.charCodeAt(Ze)?(i=v,Ze++):(i=p,0===qe&&tt(d)),i!==p?(Le=e,t=N(n,a,o)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p)):(Ze=e,p):(Ze=e,p):(Ze=e,p)):(Ze=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,u,a,o,c,i,l,s;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));if(t!==p)if(vt()!==p)if((r=bt())!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(n=j,Ze++):(n=p,0===qe&&tt(_)),n!==p)if(vt()!==p)if(f.substr(Ze,6)===Q?(u=Q,Ze+=6):(u=p,0===qe&&tt(V)),u===p&&(f.substr(Ze,13)===W?(u=W,Ze+=13):(u=p,0===qe&&tt(X))),u!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(a=j,Ze++):(a=p,0===qe&&tt(_)),a!==p)if(vt()!==p)if(o=Ze,f.substr(Ze,7)===ee?(c=ee,Ze+=7):(c=p,0===qe&&tt(te)),(o=c!==p?(i=vt())!==p?(l=dt())!==p?c=[c,i,l]:(Ze=o,p):(Ze=o,p):(Ze=o,p))===p&&(o=null),o!==p)if((c=vt())!==p){if(i=[],(l=pt())!==p)for(;l!==p;)i.push(l),l=pt();else i=p;e=i!==p?(l=vt())!==p?(125===f.charCodeAt(Ze)?(s=v,Ze++):(s=p,0===qe&&tt(d)),s!==p?(Le=e,t=re(r,u,o,i)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,u,a,o,c,i;e=Ze,123===f.charCodeAt(Ze)?(t=h,Ze++):(t=p,0===qe&&tt(A));if(t!==p)if(vt()!==p)if((r=bt())!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(n=j,Ze++):(n=p,0===qe&&tt(_)),n!==p)if(vt()!==p)if(f.substr(Ze,6)===ne?(u=ne,Ze+=6):(u=p,0===qe&&tt(ue)),u!==p)if(vt()!==p)if(44===f.charCodeAt(Ze)?(a=j,Ze++):(a=p,0===qe&&tt(_)),a!==p)if(vt()!==p){if(o=[],(c=ft())!==p)for(;c!==p;)o.push(c),c=ft();else o=p;e=o!==p?(c=vt())!==p?(125===f.charCodeAt(Ze)?(i=v,Ze++):(i=p,0===qe&&tt(d)),i!==p?(Le=e,t=ae(r,o)):(Ze=e,p)):(Ze=e,p):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;else Ze=e,e=p;return e}()),e}function at(){var e,t,r;if(e=Ze,t=[],(r=gt())===p&&(r=mt())===p&&(r=yt()),r!==p)for(;r!==p;)t.push(r),(r=gt())===p&&(r=mt())===p&&(r=yt());else t=p;return t!==p&&(Le=e,t=c(t)),e=t}function ot(){var e,t,r,n,u;if(qe++,t=[],n=r=e=Ze,qe++,(u=ht())===p&&(m.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(y))),qe--,(r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p))!==p)for(;r!==p;)t.push(r),n=r=Ze,qe++,(u=ht())===p&&(m.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(y))),qe--,r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p);else t=p;return e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(g)),e}function ct(){var e,t,r;return qe++,e=Ze,47===f.charCodeAt(Ze)?(t=x,Ze++):(t=p,0===qe&&tt(C)),e=t!==p&&(r=ot())!==p?(Le=e,t=P(r)):(Ze=e,p),qe--,e===p&&(t=p,0===qe&&tt(E)),e}function it(){var e,t,r,n;if(qe++,e=Ze,vt()!==p)if((t=ot())!==p){for(r=[],n=ct();n!==p;)r.push(n),n=ct();e=r!==p?(Le=e,F(t,r)):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;return qe--,e===p&&(p,0===qe&&tt(T)),e}function lt(){var e,t,r,n;if(e=Ze,39===f.charCodeAt(Ze)?(t=z,Ze++):(t=p,0===qe&&tt(I)),t!==p){if(r=[],(n=gt())===p&&(M.test(f.charAt(Ze))?(n=f.charAt(Ze),Ze++):(n=p,0===qe&&tt(R))),n!==p)for(;n!==p;)r.push(n),(n=gt())===p&&(M.test(f.charAt(Ze))?(n=f.charAt(Ze),Ze++):(n=p,0===qe&&tt(R)));else r=p;e=r!==p?(39===f.charCodeAt(Ze)?(n=z,Ze++):(n=p,0===qe&&tt(I)),n!==p?t=[t,r,n]:(Ze=e,p)):(Ze=e,p)}else Ze=e,e=p;if(e===p)if(e=[],(t=gt())===p&&(Z.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(L))),t!==p)for(;t!==p;)e.push(t),(t=gt())===p&&(Z.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(L)));else e=p;return e}function st(){var e,t;if(e=[],$.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(H)),t!==p)for(;t!==p;)e.push(t),$.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(H));else e=p;return e}function ft(){var e,t,r,n,u;return e=Ze,e=vt()!==p&&(t=xt())!==p&&vt()!==p?(123===f.charCodeAt(Ze)?(r=h,Ze++):(r=p,0===qe&&tt(A)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Ze)?(u=v,Ze++):(u=p,0===qe&&tt(d)),u!==p?(Le=e,ie(t,n)):(Ze=e,p)):(Ze=e,p)):(Ze=e,p)}function pt(){var e,t,r,n,u;return e=Ze,e=vt()!==p&&(t=function(){var e,t,r,n;return t=e=Ze,61===f.charCodeAt(Ze)?(r=oe,Ze++):(r=p,0===qe&&tt(ce)),(e=(t=r!==p&&(n=dt())!==p?r=[r,n]:(Ze=t,p))!==p?f.substring(e,Ze):t)===p&&(e=xt()),e}())!==p&&vt()!==p?(123===f.charCodeAt(Ze)?(r=h,Ze++):(r=p,0===qe&&tt(A)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Ze)?(u=v,Ze++):(u=p,0===qe&&tt(d)),u!==p?(Le=e,le(t,n)):(Ze=e,p)):(Ze=e,p)):(Ze=e,p)}function ht(){var e;return qe++,fe.test(f.charAt(Ze))?(e=f.charAt(Ze),Ze++):(e=p,0===qe&&tt(pe)),qe--,e===p&&0===qe&&tt(se),e}function At(){var e;return qe++,Ae.test(f.charAt(Ze))?(e=f.charAt(Ze),Ze++):(e=p,0===qe&&tt(ve)),qe--,e===p&&0===qe&&tt(he),e}function vt(){var e,t,r;for(qe++,e=Ze,t=[],r=ht();r!==p;)t.push(r),r=ht();return e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(de)),e}function dt(){var e,t,r;return qe++,e=Ze,45===f.charCodeAt(Ze)?(t=me,Ze++):(t=p,0===qe&&tt(ye)),t===p&&(t=null),e=t!==p&&(r=Et())!==p?(Le=e,t=be(t,r)):(Ze=e,p),qe--,e===p&&(t=p,0===qe&&tt(ge)),e}function gt(){var e,t;return qe++,e=Ze,f.substr(Ze,2)===xe?(t=xe,Ze+=2):(t=p,0===qe&&tt(Ce)),t!==p&&(Le=e,t=Pe()),qe--,(e=t)===p&&(t=p,0===qe&&tt(Ee)),e}function mt(){var e,t,r,n,u,a;if(e=Ze,39===f.charCodeAt(Ze)?(t=z,Ze++):(t=p,0===qe&&tt(I)),t!==p)if(Te.test(f.charAt(Ze))?(r=f.charAt(Ze),Ze++):(r=p,0===qe&&tt(Fe)),r!==p){for(n=Ze,u=[],f.substr(Ze,2)===xe?(a=xe,Ze+=2):(a=p,0===qe&&tt(Ce)),a===p&&(M.test(f.charAt(Ze))?(a=f.charAt(Ze),Ze++):(a=p,0===qe&&tt(R)));a!==p;)u.push(a),f.substr(Ze,2)===xe?(a=xe,Ze+=2):(a=p,0===qe&&tt(Ce)),a===p&&(M.test(f.charAt(Ze))?(a=f.charAt(Ze),Ze++):(a=p,0===qe&&tt(R)));e=(n=u!==p?f.substring(n,Ze):u)!==p?(39===f.charCodeAt(Ze)?(u=z,Ze++):(u=p,0===qe&&tt(I)),u!==p?(Le=e,t=Ye(r,n)):(Ze=e,p)):(Ze=e,p)}else Ze=e,e=p;else Ze=e,e=p;return e}function yt(){var e,t;return e=Ze,we.test(f.charAt(Ze))?(t=f.charAt(Ze),Ze++):(t=p,0===qe&&tt(ke)),e=t!==p?f.substring(e,Ze):t}function bt(){var e,t;return qe++,e=Ze,(t=Et())===p&&(t=xt()),e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(Oe)),e}function Et(){var e,t,r,n,u;if(qe++,e=Ze,48===f.charCodeAt(Ze)?(t=je,Ze++):(t=p,0===qe&&tt(_e)),t!==p&&(Le=e,t=Be()),(e=t)===p){if(t=e=Ze,De.test(f.charAt(Ze))?(r=f.charAt(Ze),Ze++):(r=p,0===qe&&tt(Ne)),r!==p){for(n=[],ze.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(Ie));u!==p;)n.push(u),ze.test(f.charAt(Ze))?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(Ie));t=n!==p?r=[r,n]:(Ze=t,p)}else Ze=t,t=p;t!==p&&(Le=e,t=Me(t)),e=t}return qe--,e===p&&(t=p,0===qe&&tt(Se)),e}function xt(){var e,t,r,n,u;if(qe++,t=[],n=r=e=Ze,qe++,(u=ht())===p&&(u=At()),qe--,(r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p))!==p)for(;r!==p;)t.push(r),n=r=Ze,qe++,(u=ht())===p&&(u=At()),qe--,r=(n=u===p?void 0:(Ze=n,p))!==p?(f.length>Ze?(u=f.charAt(Ze),Ze++):(u=p,0===qe&&tt(b)),u!==p?n=[n,u]:(Ze=r,p)):(Ze=r,p);else t=p;return e=t!==p?f.substring(e,Ze):t,qe--,e===p&&(t=p,0===qe&&tt(Re)),e}function Ct(){return e&&e.captureLocation?{location:Je()}:{}}if((t=o())!==p&&Ze===f.length)return t;throw t!==p&&Ze<f.length&&tt({type:"end"}),r=Ue,n=He<f.length?f.charAt(He):null,u=He<f.length?et(He,He+1):et(He,He),new Ft(Ft.buildMessage(r,n),r,n,u)},h=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),u=0;for(t=0;t<r;t++)for(var a=arguments[t],o=0,c=a.length;o<c;o++,u++)n[u]=a[o];return n},A=/(^|[^\\])#/g;Pt.SyntaxError=Ft,Pt.createLiteralElement=function(e){return{type:Pt.TYPE.literal,value:e}},Pt.createNumberElement=function(e,t){return{type:Pt.TYPE.number,value:e,style:t}},Pt.isArgumentElement=function(e){return e.type===Pt.TYPE.argument},Pt.isDateElement=function(e){return e.type===Pt.TYPE.date},Pt.isDateTimeSkeleton=function(e){return 1===e.type},Pt.isLiteralElement=f,Pt.isNumberElement=function(e){return e.type===Pt.TYPE.number},Pt.isNumberSkeleton=function(e){return 0===e.type},Pt.isPluralElement=u,Pt.isSelectElement=n,Pt.isTimeElement=function(e){return e.type===Pt.TYPE.time},Pt.parse=function(e,t){var r=p(e,t);return t&&!1===t.normalizeHashtagInPlural||function s(e){e.forEach(function(l){(u(l)||n(l))&&Object.keys(l.options).forEach(function(e){for(var t,r=l.options[e],n=-1,u=void 0,a=0;a<r.value.length;a++){var o=r.value[a];if(f(o)&&A.test(o.value)){n=a,u=o;break}}if(u){var c=u.value.replace(A,"$1{"+l.value+", number}"),i=p(c);(t=r.value).splice.apply(t,h([n,1],i))}s(r.value)})})}(r),r},Pt.pegParse=p,Object.defineProperty(Pt,"__esModule",{value:!0})});
//# sourceMappingURL=intl-messageformat-parser.min.js.map

@@ -1,2 +0,2 @@

import { parse as pegParse } from './parser';
import { pegParse } from './parser';
import { normalizeHashtagInPlural } from './normalize';

@@ -3,0 +3,0 @@ export * from './types';

@@ -140,2 +140,4 @@

export declare const pegParse: ParseFunction;
export declare interface PluralElement extends BaseElement<TYPE.plural> {

@@ -142,0 +144,0 @@ options: Record<ValidPluralRule, PluralOrSelectOption>;

@@ -9,3 +9,3 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {

import { isPluralElement, isLiteralElement, isSelectElement, } from './types';
import { parse } from './parser';
import { pegParse } from './parser';
var PLURAL_HASHTAG_REGEX = /(^|[^\\])#/g;

@@ -42,3 +42,3 @@ /**

var newValue = literalEl.value.replace(PLURAL_HASHTAG_REGEX, "$1{" + el.value + ", number}");
var newEls = parse(newValue);
var newEls = pegParse(newValue);
(_a = opt.value).splice.apply(_a, __spreadArrays([matchingLiteralElIndex, 1], newEls));

@@ -45,0 +45,0 @@ }

@@ -51,2 +51,2 @@ import { MessageFormatElement } from './types';

export declare type ParseFunction = (input: string, options?: IParseOptions) => MessageFormatElement[];
export declare const parse: ParseFunction;
export declare const pegParse: ParseFunction;
{
"name": "intl-messageformat-parser",
"version": "3.2.4",
"version": "3.2.5",
"description": "Parses ICU Message strings into an AST via JavaScript.",

@@ -48,3 +48,3 @@ "main": "dist/index.js",

"homepage": "https://github.com/formatjs/formatjs",
"gitHead": "b506d5e1cb2c0f7266e728088dae409046a6094e"
"gitHead": "8b0baec8eda5002715cf893274fe59782fc2d371"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc