intl-messageformat-parser
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.5.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.4.0...intl-messageformat-parser@3.5.0) (2019-12-02) | ||
### Features | ||
* **intl-messageformat-parser:** add support for unit-width ([dc4a054](https://github.com/formatjs/formatjs/commit/dc4a0547115e59198439579aadc3180b6953664d)) | ||
# [3.4.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@3.3.1...intl-messageformat-parser@3.4.0) (2019-12-01) | ||
@@ -8,0 +19,0 @@ |
@@ -251,2 +251,18 @@ "use strict"; | ||
continue; | ||
// https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h | ||
case 'unit-width-narrow': | ||
result.currencyDisplay = 'narrowSymbol'; | ||
result.unitDisplay = 'narrow'; | ||
continue; | ||
case 'unit-width-short': | ||
result.currencyDisplay = 'code'; | ||
result.unitDisplay = 'short'; | ||
continue; | ||
case 'unit-width-full-name': | ||
result.currencyDisplay = 'name'; | ||
result.unitDisplay = 'long'; | ||
continue; | ||
case 'unit-width-iso-code': | ||
result.currencyDisplay = 'symbol'; | ||
continue; | ||
} | ||
@@ -253,0 +269,0 @@ // Precision |
@@ -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(Ct){"use strict";var e;function f(e){return e.type===Ct.TYPE.literal}function n(e){return e.type===Ct.TYPE.select}function a(e){return e.type===Ct.TYPE.plural}(e=Ct.TYPE||(Ct.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 u,i,t=(u=function(e,t){return(u=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}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),kt=function(){return(kt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},Ft=(i=Error,t(o,i),o.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 a(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 u(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?a(e[0])+"-"+a(e[1]):a(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(u);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 "+((i=t)?'"'+n(i)+'"':"end of input")+" found.";var i},o);function o(e,t,r,n){var a=i.call(this)||this;return a.message=e,a.expected=t,a.found=r,a.location=n,a.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a,o),a}var p=function(f,e){e=void 0!==e?e:{};var t,r,n,a,p={},u={start:rt},i=rt,o=function(e){return e.join("")},c=function(e){return kt({type:Ct.TYPE.literal,value:e},xt())},s=Xe("argumentElement"),h="{",g=Ve("{",!1),m="}",d=Ve("}",!1),l=function(e){return kt({type:Ct.TYPE.argument,value:e},xt())},v=Xe("numberSkeletonId"),y=/^['\/{}]/,A=We(["'","/","{","}"],!1,!1),b={type:"any"},E=Xe("numberSkeletonTokenOption"),w="/",x=Ve("/",!1),C=function(e){return e},k=Xe("numberSkeletonToken"),F=function(e,t){return{stem:e,options:t}},D=function(e){return kt({type:0,tokens:e},xt())},P="::",T=Ve("::",!1),S=function(e){return e},Y=function(e){return e.replace(/\s*$/,"")},O=",",j=Ve(",",!1),R="number",B=Ve("number",!1),Z=function(e,t,r){return kt({type:"number"===t?Ct.TYPE.number:"date"===t?Ct.TYPE.date:Ct.TYPE.time,style:r&&r[2],value:e},xt())},z="'",N=Ve("'",!1),_=/^[^']/,M=We(["'"],!0,!1),L=/^[^a-zA-Z'{}]/,$=We([["a","z"],["A","Z"],"'","{","}"],!0,!1),q=/^[a-zA-Z]/,H=We([["a","z"],["A","Z"]],!1,!1),I=function(e){return kt({type:1,pattern:e},xt())},U="date",G=Ve("date",!1),K="time",Q=Ve("time",!1),V="plural",W=Ve("plural",!1),X="selectordinal",J=Ve("selectordinal",!1),ee="offset:",te=Ve("offset:",!1),re=function(e,t,r,n){return kt({type:Ct.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,a=t.location;return r in e&&Qe('Duplicate option "'+r+'" in plural element: "'+Ge()+'"',Ke()),e[r]={value:n,location:a},e},{})},xt())},ne="select",ae=Ve("select",!1),ue=function(e,t){return kt({type:Ct.TYPE.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&Qe('Duplicate option "'+r+'" in select element: "'+Ge()+'"',Ke()),e[r]={value:n,location:a},e},{})},xt())},ie="=",oe=Ve("=",!1),ce=function(e,t){return kt({id:e,value:t},xt())},se=function(e,t){return kt({id:e,value:t},xt())},le=Xe("whitespace pattern"),fe=/^[\t-\r \x85\u200E\u200F\u2028\u2029]/,pe=We([["\t","\r"]," "," ","","","\u2028","\u2029"],!1,!1),he=Xe("syntax pattern"),ge=/^[!-\/:-@[-\^`{-~\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]/,me=We([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←",""],["─","❵"],["➔","⯿"],["⸀",""],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),de=Xe("optional whitespace"),ve=Xe("number"),ye="-",Ae=Ve("-",!1),be=function(e,t){return t?e?-t:t:0},Ee=Xe("double apostrophes"),we="''",xe=Ve("''",!1),Ce=function(){return"'"},ke=/^[{}]/,Fe=We(["{","}"],!1,!1),De=function(e,t){return e+t.replace("''","'")},Pe=/^[^{}]/,Te=We(["{","}"],!0,!1),Se=Xe("argNameOrNumber"),Ye=Xe("argNumber"),Oe="0",je=Ve("0",!1),Re=function(){return 0},Be=/^[1-9]/,Ze=We([["1","9"]],!1,!1),ze=/^[0-9]/,Ne=We([["0","9"]],!1,!1),_e=function(e){return parseInt(e.join(""),10)},Me=Xe("argName"),Le=0,$e=0,qe=[{line:1,column:1}],He=0,Ie=[],Ue=0;if(void 0!==e.startRule){if(!(e.startRule in u))throw new Error("Can't start parsing from rule \""+e.startRule+'".');i=u[e.startRule]}function Ge(){return f.substring($e,Le)}function Ke(){return et($e,Le)}function Qe(e,t){throw function(e,t){return new Ft(e,[],"",t)}(e,t=void 0!==t?t:et($e,Le))}function Ve(e,t){return{type:"literal",text:e,ignoreCase:t}}function We(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Xe(e){return{type:"other",description:e}}function Je(e){var t,r=qe[e];if(r)return r;for(t=e-1;!qe[t];)t--;for(r={line:(r=qe[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return qe[e]=r}function et(e,t){var r=Je(e),n=Je(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function tt(e){Le<He||(He<Le&&(He=Le,Ie=[]),Ie.push(e))}function rt(){return nt()}function nt(){var e,t;for(e=[],t=at();t!==p;)e.push(t),t=at();return e}function at(){var e;return(e=function(){var e,t;e=Le,(t=ut())!==p&&($e=e,t=c(t));return e=t}())===p&&(e=function(){var e,t,r,n,a;Ue++,e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));e=t!==p?(r=mt(),r!==p?(n=bt())!==p?mt()!==p?(125===f.charCodeAt(Le)?(a=m,Le++):(a=p,0===Ue&&tt(d)),a!==p?($e=e,t=l(n)):(Le=e,p)):(Le=e,p):(Le=e,p):(Le=e,p)):(Le=e,p);Ue--,e===p&&(t=p,0===Ue&&tt(s));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,a,u,i,o,c,s;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));e=t!==p?(r=mt(),r!==p?(n=bt())!==p?mt()!==p?(44===f.charCodeAt(Le)?(a=O,Le++):(a=p,0===Ue&&tt(j)),a!==p?mt()!==p?(f.substr(Le,6)===R?(u=R,Le+=6):(u=p,0===Ue&&tt(B)),u!==p?mt()!==p?(i=Le,44===f.charCodeAt(Le)?(o=O,Le++):(o=p,0===Ue&&tt(j)),(i=o!==p?(c=mt())!==p?(s=function(){var e,t,r;e=Le,f.substr(Le,2)===P?(t=P,Le+=2):(t=p,0===Ue&&tt(T));e=t!==p?(r=function(){var e,t,r;if(e=Le,t=[],(r=ct())!==p)for(;r!==p;)t.push(r),r=ct();else t=p;t!==p&&($e=e,t=D(t));return e=t}(),r!==p?($e=e,t=S(r)):(Le=e,p)):(Le=e,p);e===p&&(e=Le,(t=ut())!==p&&($e=e,t=Y(t)),e=t);return e}())!==p?o=[o,c,s]:(Le=i,p):(Le=i,p):(Le=i,p))===p&&(i=null),i!==p?(o=mt())!==p?(125===f.charCodeAt(Le)?(c=m,Le++):(c=p,0===Ue&&tt(d)),c!==p?($e=e,t=Z(n,u,i)):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p):(Le=e,p)):(Le=e,p);return e}())===p&&(e=function(){var e,t,r,n,a,u,i,o,c,s;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));e=t!==p?(r=mt(),r!==p?(n=bt())!==p?mt()!==p?(44===f.charCodeAt(Le)?(a=O,Le++):(a=p,0===Ue&&tt(j)),a!==p?mt()!==p?(f.substr(Le,4)===U?(u=U,Le+=4):(u=p,0===Ue&&tt(G)),u===p&&(f.substr(Le,4)===K?(u=K,Le+=4):(u=p,0===Ue&&tt(Q))),u!==p?mt()!==p?(i=Le,44===f.charCodeAt(Le)?(o=O,Le++):(o=p,0===Ue&&tt(j)),(i=o!==p?(c=mt())!==p?(s=function(){var e,t,r;e=Le,f.substr(Le,2)===P?(t=P,Le+=2):(t=p,0===Ue&&tt(T));e=t!==p?(r=function(){var e,t,r,n;t=e=Le,r=[],(n=st())===p&&(n=lt());if(n!==p)for(;n!==p;)r.push(n),(n=st())===p&&(n=lt());else r=p;t=r!==p?f.substring(t,Le):r;t!==p&&($e=e,t=I(t));return e=t}(),r!==p?($e=e,t=S(r)):(Le=e,p)):(Le=e,p);e===p&&(e=Le,(t=ut())!==p&&($e=e,t=Y(t)),e=t);return e}())!==p?o=[o,c,s]:(Le=i,p):(Le=i,p):(Le=i,p))===p&&(i=null),i!==p?(o=mt())!==p?(125===f.charCodeAt(Le)?(c=m,Le++):(c=p,0===Ue&&tt(d)),c!==p?($e=e,t=Z(n,u,i)):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p):(Le=e,p)):(Le=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,a,u,i,o,c,s,l;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));if(t!==p)if(mt()!==p)if((r=bt())!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(n=O,Le++):(n=p,0===Ue&&tt(j)),n!==p)if(mt()!==p)if(f.substr(Le,6)===V?(a=V,Le+=6):(a=p,0===Ue&&tt(W)),a===p&&(f.substr(Le,13)===X?(a=X,Le+=13):(a=p,0===Ue&&tt(J))),a!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(u=O,Le++):(u=p,0===Ue&&tt(j)),u!==p)if(mt()!==p)if(i=Le,f.substr(Le,7)===ee?(o=ee,Le+=7):(o=p,0===Ue&&tt(te)),(i=o!==p?(c=mt())!==p?(s=dt())!==p?o=[o,c,s]:(Le=i,p):(Le=i,p):(Le=i,p))===p&&(i=null),i!==p)if((o=mt())!==p){if(c=[],(s=pt())!==p)for(;s!==p;)c.push(s),s=pt();else c=p;e=c!==p?(s=mt())!==p?(125===f.charCodeAt(Le)?(l=m,Le++):(l=p,0===Ue&&tt(d)),l!==p?($e=e,t=re(r,a,i,c)):(Le=e,p)):(Le=e,p):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,a,u,i,o,c;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));if(t!==p)if(mt()!==p)if((r=bt())!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(n=O,Le++):(n=p,0===Ue&&tt(j)),n!==p)if(mt()!==p)if(f.substr(Le,6)===ne?(a=ne,Le+=6):(a=p,0===Ue&&tt(ae)),a!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(u=O,Le++):(u=p,0===Ue&&tt(j)),u!==p)if(mt()!==p){if(i=[],(o=ft())!==p)for(;o!==p;)i.push(o),o=ft();else i=p;e=i!==p?(o=mt())!==p?(125===f.charCodeAt(Le)?(c=m,Le++):(c=p,0===Ue&&tt(d)),c!==p?($e=e,t=ue(r,i)):(Le=e,p)):(Le=e,p):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;return e}()),e}function ut(){var e,t,r;if(e=Le,t=[],(r=vt())===p&&(r=yt())===p&&(r=At()),r!==p)for(;r!==p;)t.push(r),(r=vt())===p&&(r=yt())===p&&(r=At());else t=p;return t!==p&&($e=e,t=o(t)),e=t}function it(){var e,t,r,n,a;if(Ue++,t=[],n=r=e=Le,Ue++,(a=ht())===p&&(y.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(A))),Ue--,(r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p))!==p)for(;r!==p;)t.push(r),n=r=Le,Ue++,(a=ht())===p&&(y.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(A))),Ue--,r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p);else t=p;return e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(v)),e}function ot(){var e,t,r;return Ue++,e=Le,47===f.charCodeAt(Le)?(t=w,Le++):(t=p,0===Ue&&tt(x)),e=t!==p&&(r=it())!==p?($e=e,t=C(r)):(Le=e,p),Ue--,e===p&&(t=p,0===Ue&&tt(E)),e}function ct(){var e,t,r,n;if(Ue++,e=Le,mt()!==p)if((t=it())!==p){for(r=[],n=ot();n!==p;)r.push(n),n=ot();e=r!==p?($e=e,F(t,r)):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;return Ue--,e===p&&(p,0===Ue&&tt(k)),e}function st(){var e,t,r,n;if(e=Le,39===f.charCodeAt(Le)?(t=z,Le++):(t=p,0===Ue&&tt(N)),t!==p){if(r=[],(n=vt())===p&&(_.test(f.charAt(Le))?(n=f.charAt(Le),Le++):(n=p,0===Ue&&tt(M))),n!==p)for(;n!==p;)r.push(n),(n=vt())===p&&(_.test(f.charAt(Le))?(n=f.charAt(Le),Le++):(n=p,0===Ue&&tt(M)));else r=p;e=r!==p?(39===f.charCodeAt(Le)?(n=z,Le++):(n=p,0===Ue&&tt(N)),n!==p?t=[t,r,n]:(Le=e,p)):(Le=e,p)}else Le=e,e=p;if(e===p)if(e=[],(t=vt())===p&&(L.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt($))),t!==p)for(;t!==p;)e.push(t),(t=vt())===p&&(L.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt($)));else e=p;return e}function lt(){var e,t;if(e=[],q.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt(H)),t!==p)for(;t!==p;)e.push(t),q.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt(H));else e=p;return e}function ft(){var e,t,r,n,a;return e=Le,e=mt()!==p&&(t=wt())!==p&&mt()!==p?(123===f.charCodeAt(Le)?(r=h,Le++):(r=p,0===Ue&&tt(g)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Le)?(a=m,Le++):(a=p,0===Ue&&tt(d)),a!==p?($e=e,ce(t,n)):(Le=e,p)):(Le=e,p)):(Le=e,p)}function pt(){var e,t,r,n,a;return e=Le,e=mt()!==p&&(t=function(){var e,t,r,n;return t=e=Le,61===f.charCodeAt(Le)?(r=ie,Le++):(r=p,0===Ue&&tt(oe)),(e=(t=r!==p&&(n=dt())!==p?r=[r,n]:(Le=t,p))!==p?f.substring(e,Le):t)===p&&(e=wt()),e}())!==p&&mt()!==p?(123===f.charCodeAt(Le)?(r=h,Le++):(r=p,0===Ue&&tt(g)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Le)?(a=m,Le++):(a=p,0===Ue&&tt(d)),a!==p?($e=e,se(t,n)):(Le=e,p)):(Le=e,p)):(Le=e,p)}function ht(){var e;return Ue++,fe.test(f.charAt(Le))?(e=f.charAt(Le),Le++):(e=p,0===Ue&&tt(pe)),Ue--,e===p&&0===Ue&&tt(le),e}function gt(){var e;return Ue++,ge.test(f.charAt(Le))?(e=f.charAt(Le),Le++):(e=p,0===Ue&&tt(me)),Ue--,e===p&&0===Ue&&tt(he),e}function mt(){var e,t,r;for(Ue++,e=Le,t=[],r=ht();r!==p;)t.push(r),r=ht();return e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(de)),e}function dt(){var e,t,r;return Ue++,e=Le,45===f.charCodeAt(Le)?(t=ye,Le++):(t=p,0===Ue&&tt(Ae)),t===p&&(t=null),e=t!==p&&(r=Et())!==p?($e=e,t=be(t,r)):(Le=e,p),Ue--,e===p&&(t=p,0===Ue&&tt(ve)),e}function vt(){var e,t;return Ue++,e=Le,f.substr(Le,2)===we?(t=we,Le+=2):(t=p,0===Ue&&tt(xe)),t!==p&&($e=e,t=Ce()),Ue--,(e=t)===p&&(t=p,0===Ue&&tt(Ee)),e}function yt(){var e,t,r,n,a,u;if(e=Le,39===f.charCodeAt(Le)?(t=z,Le++):(t=p,0===Ue&&tt(N)),t!==p)if(ke.test(f.charAt(Le))?(r=f.charAt(Le),Le++):(r=p,0===Ue&&tt(Fe)),r!==p){for(n=Le,a=[],f.substr(Le,2)===we?(u=we,Le+=2):(u=p,0===Ue&&tt(xe)),u===p&&(_.test(f.charAt(Le))?(u=f.charAt(Le),Le++):(u=p,0===Ue&&tt(M)));u!==p;)a.push(u),f.substr(Le,2)===we?(u=we,Le+=2):(u=p,0===Ue&&tt(xe)),u===p&&(_.test(f.charAt(Le))?(u=f.charAt(Le),Le++):(u=p,0===Ue&&tt(M)));e=(n=a!==p?f.substring(n,Le):a)!==p?(39===f.charCodeAt(Le)?(a=z,Le++):(a=p,0===Ue&&tt(N)),a!==p?($e=e,t=De(r,n)):(Le=e,p)):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;return e}function At(){var e,t;return e=Le,Pe.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt(Te)),e=t!==p?f.substring(e,Le):t}function bt(){var e,t;return Ue++,e=Le,(t=Et())===p&&(t=wt()),e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(Se)),e}function Et(){var e,t,r,n,a;if(Ue++,e=Le,48===f.charCodeAt(Le)?(t=Oe,Le++):(t=p,0===Ue&&tt(je)),t!==p&&($e=e,t=Re()),(e=t)===p){if(t=e=Le,Be.test(f.charAt(Le))?(r=f.charAt(Le),Le++):(r=p,0===Ue&&tt(Ze)),r!==p){for(n=[],ze.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(Ne));a!==p;)n.push(a),ze.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(Ne));t=n!==p?r=[r,n]:(Le=t,p)}else Le=t,t=p;t!==p&&($e=e,t=_e(t)),e=t}return Ue--,e===p&&(t=p,0===Ue&&tt(Ye)),e}function wt(){var e,t,r,n,a;if(Ue++,t=[],n=r=e=Le,Ue++,(a=ht())===p&&(a=gt()),Ue--,(r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p))!==p)for(;r!==p;)t.push(r),n=r=Le,Ue++,(a=ht())===p&&(a=gt()),Ue--,r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p);else t=p;return e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(Me)),e}function xt(){return e&&e.captureLocation?{location:Ke()}:{}}if((t=i())!==p&&Le===f.length)return t;throw t!==p&&Le<f.length&&tt({type:"end"}),r=Ie,n=He<f.length?f.charAt(He):null,a=He<f.length?et(He,He+1):et(He,He),new Ft(Ft.buildMessage(r,n),r,n,a)},h=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var u=arguments[t],i=0,o=u.length;i<o;i++,a++)n[a]=u[i];return n},g=/(^|[^\\])#/g;var c=function(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},s=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;var l=/^\.(?:(0+)(\+|#+)?)?$/g,m=/^(@+)?(\+|#+)?$/g;function d(e){var n={};return e.replace(m,function(e,t,r){return"string"!=typeof r?(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length):"+"===r?n.minimumSignificantDigits=t.length:"#"===t[0]?n.maximumSignificantDigits=t.length:(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length+("string"==typeof r?r.length:0)),""}),n}function v(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":return{currencySign:"accounting"};case"sign-always":return{signDisplay:"always"};case"sign-accounting-always":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":return{signDisplay:"never"}}}function y(e){var t=v(e);return t||{}}Ct.SyntaxError=Ft,Ct.convertNumberSkeletonToNumberFormatOptions=function(e){for(var n={},t=0,r=e;t<r.length;t++){var a=r[t];switch(a.stem){case"percent":n.style="percent";continue;case"currency":n.style="currency",n.currency=a.options[0];continue;case"group-off":n.useGrouping=!1;continue;case"precision-integer":n.maximumFractionDigits=0;continue;case"measure-unit":n.style="unit",n.unit=a.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":n.notation="compact",n.compactDisplay="short";continue;case"compact-long":n.notation="compact",n.compactDisplay="long";continue;case"scientific":n=c(c(c({},n),{notation:"scientific"}),a.options.reduce(function(e,t){return c(c({},e),y(t))},{}));continue;case"engineering":n=c(c(c({},n),{notation:"engineering"}),a.options.reduce(function(e,t){return c(c({},e),y(t))},{}));continue;case"notation-simple":n.notation="standard";continue}if(l.test(a.stem)){if(1<a.options.length)throw new RangeError("Fraction-precision stems only accept a single optional option");a.stem.replace(l,function(e,t,r){return"."===e?n.maximumFractionDigits=0:"+"===r?n.minimumFractionDigits=r.length:"#"===t[0]?n.maximumFractionDigits=t.length:(n.minimumFractionDigits=t.length,n.maximumFractionDigits=t.length+("string"==typeof r?r.length:0)),""}),a.options.length&&(n=c(c({},n),d(a.options[0])))}else if(m.test(a.stem))n=c(c({},n),d(a.stem));else{var u=v(a.stem);u&&(n=c(c({},n),u))}}return n},Ct.createLiteralElement=function(e){return{type:Ct.TYPE.literal,value:e}},Ct.createNumberElement=function(e,t){return{type:Ct.TYPE.number,value:e,style:t}},Ct.isArgumentElement=function(e){return e.type===Ct.TYPE.argument},Ct.isDateElement=function(e){return e.type===Ct.TYPE.date},Ct.isDateTimeSkeleton=function(e){return!(!e||"object"!=typeof e||1!==e.type)},Ct.isLiteralElement=f,Ct.isNumberElement=function(e){return e.type===Ct.TYPE.number},Ct.isNumberSkeleton=function(e){return!(!e||"object"!=typeof e||0!==e.type)},Ct.isPluralElement=a,Ct.isSelectElement=n,Ct.isTimeElement=function(e){return e.type===Ct.TYPE.time},Ct.parse=function(e,t){var r=p(e,t);return t&&!1===t.normalizeHashtagInPlural||function l(e){e.forEach(function(s){(a(s)||n(s))&&Object.keys(s.options).forEach(function(e){for(var t,r=s.options[e],n=-1,a=void 0,u=0;u<r.value.length;u++){var i=r.value[u];if(f(i)&&g.test(i.value)){n=u,a=i;break}}if(a){var o=a.value.replace(g,"$1{"+s.value+", number}"),c=p(o);(t=r.value).splice.apply(t,h([n,1],c))}l(r.value)})})}(r),r},Ct.parseDateTimeSkeleton=function(e){var r={};return e.replace(s,function(e){var t=e.length;switch(e[0]){case"G":r.era=4===t?"long":5===t?"narrow":"short";break;case"y":r.year=2===t?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":r.month=["numeric","2-digit","short","long","narrow"][t-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":r.day=["numeric","2-digit"][t-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":r.weekday=4===t?"short":5===t?"narrow":"short";break;case"e":if(t<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"c":if(t<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"a":r.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":r.hourCycle="h12",r.hour=["numeric","2-digit"][t-1];break;case"H":r.hourCycle="h23",r.hour=["numeric","2-digit"][t-1];break;case"K":r.hourCycle="h11",r.hour=["numeric","2-digit"][t-1];break;case"k":r.hourCycle="h24",r.hour=["numeric","2-digit"][t-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":r.minute=["numeric","2-digit"][t-1];break;case"s":r.second=["numeric","2-digit"][t-1];break;case"S":case"A":throw new RangeError("`S/A` (second) pattenrs are not supported, use `s` instead");case"z":r.timeZoneName=t<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) pattenrs are not supported, use `z` instead")}return""}),r},Ct.pegParse=p,Object.defineProperty(Ct,"__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(Ct){"use strict";var e;function f(e){return e.type===Ct.TYPE.literal}function n(e){return e.type===Ct.TYPE.select}function a(e){return e.type===Ct.TYPE.plural}(e=Ct.TYPE||(Ct.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 i,u,t=(i=function(e,t){return(i=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}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),kt=function(){return(kt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},Dt=(u=Error,t(o,u),o.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 a(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 i(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?a(e[0])+"-"+a(e[1]):a(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(i);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 "+((u=t)?'"'+n(u)+'"':"end of input")+" found.";var u},o);function o(e,t,r,n){var a=u.call(this)||this;return a.message=e,a.expected=t,a.found=r,a.location=n,a.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a,o),a}var p=function(f,e){e=void 0!==e?e:{};var t,r,n,a,p={},i={start:rt},u=rt,o=function(e){return e.join("")},c=function(e){return kt({type:Ct.TYPE.literal,value:e},xt())},s=Xe("argumentElement"),h="{",g=Ve("{",!1),m="}",d=Ve("}",!1),l=function(e){return kt({type:Ct.TYPE.argument,value:e},xt())},y=Xe("numberSkeletonId"),v=/^['\/{}]/,A=We(["'","/","{","}"],!1,!1),b={type:"any"},w=Xe("numberSkeletonTokenOption"),E="/",x=Ve("/",!1),C=function(e){return e},k=Xe("numberSkeletonToken"),D=function(e,t){return{stem:e,options:t}},F=function(e){return kt({type:0,tokens:e},xt())},P="::",T=Ve("::",!1),S=function(e){return e},Y=function(e){return e.replace(/\s*$/,"")},O=",",j=Ve(",",!1),R="number",B=Ve("number",!1),Z=function(e,t,r){return kt({type:"number"===t?Ct.TYPE.number:"date"===t?Ct.TYPE.date:Ct.TYPE.time,style:r&&r[2],value:e},xt())},z="'",N=Ve("'",!1),_=/^[^']/,M=We(["'"],!0,!1),L=/^[^a-zA-Z'{}]/,$=We([["a","z"],["A","Z"],"'","{","}"],!0,!1),q=/^[a-zA-Z]/,H=We([["a","z"],["A","Z"]],!1,!1),I=function(e){return kt({type:1,pattern:e},xt())},U="date",G=Ve("date",!1),K="time",Q=Ve("time",!1),V="plural",W=Ve("plural",!1),X="selectordinal",J=Ve("selectordinal",!1),ee="offset:",te=Ve("offset:",!1),re=function(e,t,r,n){return kt({type:Ct.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,a=t.location;return r in e&&Qe('Duplicate option "'+r+'" in plural element: "'+Ge()+'"',Ke()),e[r]={value:n,location:a},e},{})},xt())},ne="select",ae=Ve("select",!1),ie=function(e,t){return kt({type:Ct.TYPE.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&Qe('Duplicate option "'+r+'" in select element: "'+Ge()+'"',Ke()),e[r]={value:n,location:a},e},{})},xt())},ue="=",oe=Ve("=",!1),ce=function(e,t){return kt({id:e,value:t},xt())},se=function(e,t){return kt({id:e,value:t},xt())},le=Xe("whitespace pattern"),fe=/^[\t-\r \x85\u200E\u200F\u2028\u2029]/,pe=We([["\t","\r"]," "," ","","","\u2028","\u2029"],!1,!1),he=Xe("syntax pattern"),ge=/^[!-\/:-@[-\^`{-~\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]/,me=We([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←",""],["─","❵"],["➔","⯿"],["⸀",""],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),de=Xe("optional whitespace"),ye=Xe("number"),ve="-",Ae=Ve("-",!1),be=function(e,t){return t?e?-t:t:0},we=Xe("double apostrophes"),Ee="''",xe=Ve("''",!1),Ce=function(){return"'"},ke=/^[{}]/,De=We(["{","}"],!1,!1),Fe=function(e,t){return e+t.replace("''","'")},Pe=/^[^{}]/,Te=We(["{","}"],!0,!1),Se=Xe("argNameOrNumber"),Ye=Xe("argNumber"),Oe="0",je=Ve("0",!1),Re=function(){return 0},Be=/^[1-9]/,Ze=We([["1","9"]],!1,!1),ze=/^[0-9]/,Ne=We([["0","9"]],!1,!1),_e=function(e){return parseInt(e.join(""),10)},Me=Xe("argName"),Le=0,$e=0,qe=[{line:1,column:1}],He=0,Ie=[],Ue=0;if(void 0!==e.startRule){if(!(e.startRule in i))throw new Error("Can't start parsing from rule \""+e.startRule+'".');u=i[e.startRule]}function Ge(){return f.substring($e,Le)}function Ke(){return et($e,Le)}function Qe(e,t){throw function(e,t){return new Dt(e,[],"",t)}(e,t=void 0!==t?t:et($e,Le))}function Ve(e,t){return{type:"literal",text:e,ignoreCase:t}}function We(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Xe(e){return{type:"other",description:e}}function Je(e){var t,r=qe[e];if(r)return r;for(t=e-1;!qe[t];)t--;for(r={line:(r=qe[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return qe[e]=r}function et(e,t){var r=Je(e),n=Je(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function tt(e){Le<He||(He<Le&&(He=Le,Ie=[]),Ie.push(e))}function rt(){return nt()}function nt(){var e,t;for(e=[],t=at();t!==p;)e.push(t),t=at();return e}function at(){var e;return(e=function(){var e,t;e=Le,(t=it())!==p&&($e=e,t=c(t));return e=t}())===p&&(e=function(){var e,t,r,n,a;Ue++,e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));e=t!==p?(r=mt(),r!==p?(n=bt())!==p?mt()!==p?(125===f.charCodeAt(Le)?(a=m,Le++):(a=p,0===Ue&&tt(d)),a!==p?($e=e,t=l(n)):(Le=e,p)):(Le=e,p):(Le=e,p):(Le=e,p)):(Le=e,p);Ue--,e===p&&(t=p,0===Ue&&tt(s));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,a,i,u,o,c,s;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));e=t!==p?(r=mt(),r!==p?(n=bt())!==p?mt()!==p?(44===f.charCodeAt(Le)?(a=O,Le++):(a=p,0===Ue&&tt(j)),a!==p?mt()!==p?(f.substr(Le,6)===R?(i=R,Le+=6):(i=p,0===Ue&&tt(B)),i!==p?mt()!==p?(u=Le,44===f.charCodeAt(Le)?(o=O,Le++):(o=p,0===Ue&&tt(j)),(u=o!==p?(c=mt())!==p?(s=function(){var e,t,r;e=Le,f.substr(Le,2)===P?(t=P,Le+=2):(t=p,0===Ue&&tt(T));e=t!==p?(r=function(){var e,t,r;if(e=Le,t=[],(r=ct())!==p)for(;r!==p;)t.push(r),r=ct();else t=p;t!==p&&($e=e,t=F(t));return e=t}(),r!==p?($e=e,t=S(r)):(Le=e,p)):(Le=e,p);e===p&&(e=Le,(t=it())!==p&&($e=e,t=Y(t)),e=t);return e}())!==p?o=[o,c,s]:(Le=u,p):(Le=u,p):(Le=u,p))===p&&(u=null),u!==p?(o=mt())!==p?(125===f.charCodeAt(Le)?(c=m,Le++):(c=p,0===Ue&&tt(d)),c!==p?($e=e,t=Z(n,i,u)):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p):(Le=e,p)):(Le=e,p);return e}())===p&&(e=function(){var e,t,r,n,a,i,u,o,c,s;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));e=t!==p?(r=mt(),r!==p?(n=bt())!==p?mt()!==p?(44===f.charCodeAt(Le)?(a=O,Le++):(a=p,0===Ue&&tt(j)),a!==p?mt()!==p?(f.substr(Le,4)===U?(i=U,Le+=4):(i=p,0===Ue&&tt(G)),i===p&&(f.substr(Le,4)===K?(i=K,Le+=4):(i=p,0===Ue&&tt(Q))),i!==p?mt()!==p?(u=Le,44===f.charCodeAt(Le)?(o=O,Le++):(o=p,0===Ue&&tt(j)),(u=o!==p?(c=mt())!==p?(s=function(){var e,t,r;e=Le,f.substr(Le,2)===P?(t=P,Le+=2):(t=p,0===Ue&&tt(T));e=t!==p?(r=function(){var e,t,r,n;t=e=Le,r=[],(n=st())===p&&(n=lt());if(n!==p)for(;n!==p;)r.push(n),(n=st())===p&&(n=lt());else r=p;t=r!==p?f.substring(t,Le):r;t!==p&&($e=e,t=I(t));return e=t}(),r!==p?($e=e,t=S(r)):(Le=e,p)):(Le=e,p);e===p&&(e=Le,(t=it())!==p&&($e=e,t=Y(t)),e=t);return e}())!==p?o=[o,c,s]:(Le=u,p):(Le=u,p):(Le=u,p))===p&&(u=null),u!==p?(o=mt())!==p?(125===f.charCodeAt(Le)?(c=m,Le++):(c=p,0===Ue&&tt(d)),c!==p?($e=e,t=Z(n,i,u)):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p)):(Le=e,p):(Le=e,p):(Le=e,p)):(Le=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,a,i,u,o,c,s,l;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));if(t!==p)if(mt()!==p)if((r=bt())!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(n=O,Le++):(n=p,0===Ue&&tt(j)),n!==p)if(mt()!==p)if(f.substr(Le,6)===V?(a=V,Le+=6):(a=p,0===Ue&&tt(W)),a===p&&(f.substr(Le,13)===X?(a=X,Le+=13):(a=p,0===Ue&&tt(J))),a!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(i=O,Le++):(i=p,0===Ue&&tt(j)),i!==p)if(mt()!==p)if(u=Le,f.substr(Le,7)===ee?(o=ee,Le+=7):(o=p,0===Ue&&tt(te)),(u=o!==p?(c=mt())!==p?(s=dt())!==p?o=[o,c,s]:(Le=u,p):(Le=u,p):(Le=u,p))===p&&(u=null),u!==p)if((o=mt())!==p){if(c=[],(s=pt())!==p)for(;s!==p;)c.push(s),s=pt();else c=p;e=c!==p?(s=mt())!==p?(125===f.charCodeAt(Le)?(l=m,Le++):(l=p,0===Ue&&tt(d)),l!==p?($e=e,t=re(r,a,u,c)):(Le=e,p)):(Le=e,p):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,a,i,u,o,c;e=Le,123===f.charCodeAt(Le)?(t=h,Le++):(t=p,0===Ue&&tt(g));if(t!==p)if(mt()!==p)if((r=bt())!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(n=O,Le++):(n=p,0===Ue&&tt(j)),n!==p)if(mt()!==p)if(f.substr(Le,6)===ne?(a=ne,Le+=6):(a=p,0===Ue&&tt(ae)),a!==p)if(mt()!==p)if(44===f.charCodeAt(Le)?(i=O,Le++):(i=p,0===Ue&&tt(j)),i!==p)if(mt()!==p){if(u=[],(o=ft())!==p)for(;o!==p;)u.push(o),o=ft();else u=p;e=u!==p?(o=mt())!==p?(125===f.charCodeAt(Le)?(c=m,Le++):(c=p,0===Ue&&tt(d)),c!==p?($e=e,t=ie(r,u)):(Le=e,p)):(Le=e,p):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;else Le=e,e=p;return e}()),e}function it(){var e,t,r;if(e=Le,t=[],(r=yt())===p&&(r=vt())===p&&(r=At()),r!==p)for(;r!==p;)t.push(r),(r=yt())===p&&(r=vt())===p&&(r=At());else t=p;return t!==p&&($e=e,t=o(t)),e=t}function ut(){var e,t,r,n,a;if(Ue++,t=[],n=r=e=Le,Ue++,(a=ht())===p&&(v.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(A))),Ue--,(r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p))!==p)for(;r!==p;)t.push(r),n=r=Le,Ue++,(a=ht())===p&&(v.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(A))),Ue--,r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p);else t=p;return e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(y)),e}function ot(){var e,t,r;return Ue++,e=Le,47===f.charCodeAt(Le)?(t=E,Le++):(t=p,0===Ue&&tt(x)),e=t!==p&&(r=ut())!==p?($e=e,t=C(r)):(Le=e,p),Ue--,e===p&&(t=p,0===Ue&&tt(w)),e}function ct(){var e,t,r,n;if(Ue++,e=Le,mt()!==p)if((t=ut())!==p){for(r=[],n=ot();n!==p;)r.push(n),n=ot();e=r!==p?($e=e,D(t,r)):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;return Ue--,e===p&&(p,0===Ue&&tt(k)),e}function st(){var e,t,r,n;if(e=Le,39===f.charCodeAt(Le)?(t=z,Le++):(t=p,0===Ue&&tt(N)),t!==p){if(r=[],(n=yt())===p&&(_.test(f.charAt(Le))?(n=f.charAt(Le),Le++):(n=p,0===Ue&&tt(M))),n!==p)for(;n!==p;)r.push(n),(n=yt())===p&&(_.test(f.charAt(Le))?(n=f.charAt(Le),Le++):(n=p,0===Ue&&tt(M)));else r=p;e=r!==p?(39===f.charCodeAt(Le)?(n=z,Le++):(n=p,0===Ue&&tt(N)),n!==p?t=[t,r,n]:(Le=e,p)):(Le=e,p)}else Le=e,e=p;if(e===p)if(e=[],(t=yt())===p&&(L.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt($))),t!==p)for(;t!==p;)e.push(t),(t=yt())===p&&(L.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt($)));else e=p;return e}function lt(){var e,t;if(e=[],q.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt(H)),t!==p)for(;t!==p;)e.push(t),q.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt(H));else e=p;return e}function ft(){var e,t,r,n,a;return e=Le,e=mt()!==p&&(t=Et())!==p&&mt()!==p?(123===f.charCodeAt(Le)?(r=h,Le++):(r=p,0===Ue&&tt(g)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Le)?(a=m,Le++):(a=p,0===Ue&&tt(d)),a!==p?($e=e,ce(t,n)):(Le=e,p)):(Le=e,p)):(Le=e,p)}function pt(){var e,t,r,n,a;return e=Le,e=mt()!==p&&(t=function(){var e,t,r,n;return t=e=Le,61===f.charCodeAt(Le)?(r=ue,Le++):(r=p,0===Ue&&tt(oe)),(e=(t=r!==p&&(n=dt())!==p?r=[r,n]:(Le=t,p))!==p?f.substring(e,Le):t)===p&&(e=Et()),e}())!==p&&mt()!==p?(123===f.charCodeAt(Le)?(r=h,Le++):(r=p,0===Ue&&tt(g)),r!==p&&(n=nt())!==p?(125===f.charCodeAt(Le)?(a=m,Le++):(a=p,0===Ue&&tt(d)),a!==p?($e=e,se(t,n)):(Le=e,p)):(Le=e,p)):(Le=e,p)}function ht(){var e;return Ue++,fe.test(f.charAt(Le))?(e=f.charAt(Le),Le++):(e=p,0===Ue&&tt(pe)),Ue--,e===p&&0===Ue&&tt(le),e}function gt(){var e;return Ue++,ge.test(f.charAt(Le))?(e=f.charAt(Le),Le++):(e=p,0===Ue&&tt(me)),Ue--,e===p&&0===Ue&&tt(he),e}function mt(){var e,t,r;for(Ue++,e=Le,t=[],r=ht();r!==p;)t.push(r),r=ht();return e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(de)),e}function dt(){var e,t,r;return Ue++,e=Le,45===f.charCodeAt(Le)?(t=ve,Le++):(t=p,0===Ue&&tt(Ae)),t===p&&(t=null),e=t!==p&&(r=wt())!==p?($e=e,t=be(t,r)):(Le=e,p),Ue--,e===p&&(t=p,0===Ue&&tt(ye)),e}function yt(){var e,t;return Ue++,e=Le,f.substr(Le,2)===Ee?(t=Ee,Le+=2):(t=p,0===Ue&&tt(xe)),t!==p&&($e=e,t=Ce()),Ue--,(e=t)===p&&(t=p,0===Ue&&tt(we)),e}function vt(){var e,t,r,n,a,i;if(e=Le,39===f.charCodeAt(Le)?(t=z,Le++):(t=p,0===Ue&&tt(N)),t!==p)if(ke.test(f.charAt(Le))?(r=f.charAt(Le),Le++):(r=p,0===Ue&&tt(De)),r!==p){for(n=Le,a=[],f.substr(Le,2)===Ee?(i=Ee,Le+=2):(i=p,0===Ue&&tt(xe)),i===p&&(_.test(f.charAt(Le))?(i=f.charAt(Le),Le++):(i=p,0===Ue&&tt(M)));i!==p;)a.push(i),f.substr(Le,2)===Ee?(i=Ee,Le+=2):(i=p,0===Ue&&tt(xe)),i===p&&(_.test(f.charAt(Le))?(i=f.charAt(Le),Le++):(i=p,0===Ue&&tt(M)));e=(n=a!==p?f.substring(n,Le):a)!==p?(39===f.charCodeAt(Le)?(a=z,Le++):(a=p,0===Ue&&tt(N)),a!==p?($e=e,t=Fe(r,n)):(Le=e,p)):(Le=e,p)}else Le=e,e=p;else Le=e,e=p;return e}function At(){var e,t;return e=Le,Pe.test(f.charAt(Le))?(t=f.charAt(Le),Le++):(t=p,0===Ue&&tt(Te)),e=t!==p?f.substring(e,Le):t}function bt(){var e,t;return Ue++,e=Le,(t=wt())===p&&(t=Et()),e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(Se)),e}function wt(){var e,t,r,n,a;if(Ue++,e=Le,48===f.charCodeAt(Le)?(t=Oe,Le++):(t=p,0===Ue&&tt(je)),t!==p&&($e=e,t=Re()),(e=t)===p){if(t=e=Le,Be.test(f.charAt(Le))?(r=f.charAt(Le),Le++):(r=p,0===Ue&&tt(Ze)),r!==p){for(n=[],ze.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(Ne));a!==p;)n.push(a),ze.test(f.charAt(Le))?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(Ne));t=n!==p?r=[r,n]:(Le=t,p)}else Le=t,t=p;t!==p&&($e=e,t=_e(t)),e=t}return Ue--,e===p&&(t=p,0===Ue&&tt(Ye)),e}function Et(){var e,t,r,n,a;if(Ue++,t=[],n=r=e=Le,Ue++,(a=ht())===p&&(a=gt()),Ue--,(r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p))!==p)for(;r!==p;)t.push(r),n=r=Le,Ue++,(a=ht())===p&&(a=gt()),Ue--,r=(n=a===p?void 0:(Le=n,p))!==p?(f.length>Le?(a=f.charAt(Le),Le++):(a=p,0===Ue&&tt(b)),a!==p?n=[n,a]:(Le=r,p)):(Le=r,p);else t=p;return e=t!==p?f.substring(e,Le):t,Ue--,e===p&&(t=p,0===Ue&&tt(Me)),e}function xt(){return e&&e.captureLocation?{location:Ke()}:{}}if((t=u())!==p&&Le===f.length)return t;throw t!==p&&Le<f.length&&tt({type:"end"}),r=Ie,n=He<f.length?f.charAt(He):null,a=He<f.length?et(He,He+1):et(He,He),new Dt(Dt.buildMessage(r,n),r,n,a)},h=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var i=arguments[t],u=0,o=i.length;u<o;u++,a++)n[a]=i[u];return n},g=/(^|[^\\])#/g;var c=function(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},s=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;var l=/^\.(?:(0+)(\+|#+)?)?$/g,m=/^(@+)?(\+|#+)?$/g;function d(e){var n={};return e.replace(m,function(e,t,r){return"string"!=typeof r?(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length):"+"===r?n.minimumSignificantDigits=t.length:"#"===t[0]?n.maximumSignificantDigits=t.length:(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length+("string"==typeof r?r.length:0)),""}),n}function y(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":return{currencySign:"accounting"};case"sign-always":return{signDisplay:"always"};case"sign-accounting-always":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":return{signDisplay:"never"}}}function v(e){var t=y(e);return t||{}}Ct.SyntaxError=Dt,Ct.convertNumberSkeletonToNumberFormatOptions=function(e){for(var n={},t=0,r=e;t<r.length;t++){var a=r[t];switch(a.stem){case"percent":n.style="percent";continue;case"currency":n.style="currency",n.currency=a.options[0];continue;case"group-off":n.useGrouping=!1;continue;case"precision-integer":n.maximumFractionDigits=0;continue;case"measure-unit":n.style="unit",n.unit=a.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":n.notation="compact",n.compactDisplay="short";continue;case"compact-long":n.notation="compact",n.compactDisplay="long";continue;case"scientific":n=c(c(c({},n),{notation:"scientific"}),a.options.reduce(function(e,t){return c(c({},e),v(t))},{}));continue;case"engineering":n=c(c(c({},n),{notation:"engineering"}),a.options.reduce(function(e,t){return c(c({},e),v(t))},{}));continue;case"notation-simple":n.notation="standard";continue;case"unit-width-narrow":n.currencyDisplay="narrowSymbol",n.unitDisplay="narrow";continue;case"unit-width-short":n.currencyDisplay="code",n.unitDisplay="short";continue;case"unit-width-full-name":n.currencyDisplay="name",n.unitDisplay="long";continue;case"unit-width-iso-code":n.currencyDisplay="symbol";continue}if(l.test(a.stem)){if(1<a.options.length)throw new RangeError("Fraction-precision stems only accept a single optional option");a.stem.replace(l,function(e,t,r){return"."===e?n.maximumFractionDigits=0:"+"===r?n.minimumFractionDigits=r.length:"#"===t[0]?n.maximumFractionDigits=t.length:(n.minimumFractionDigits=t.length,n.maximumFractionDigits=t.length+("string"==typeof r?r.length:0)),""}),a.options.length&&(n=c(c({},n),d(a.options[0])))}else if(m.test(a.stem))n=c(c({},n),d(a.stem));else{var i=y(a.stem);i&&(n=c(c({},n),i))}}return n},Ct.createLiteralElement=function(e){return{type:Ct.TYPE.literal,value:e}},Ct.createNumberElement=function(e,t){return{type:Ct.TYPE.number,value:e,style:t}},Ct.isArgumentElement=function(e){return e.type===Ct.TYPE.argument},Ct.isDateElement=function(e){return e.type===Ct.TYPE.date},Ct.isDateTimeSkeleton=function(e){return!(!e||"object"!=typeof e||1!==e.type)},Ct.isLiteralElement=f,Ct.isNumberElement=function(e){return e.type===Ct.TYPE.number},Ct.isNumberSkeleton=function(e){return!(!e||"object"!=typeof e||0!==e.type)},Ct.isPluralElement=a,Ct.isSelectElement=n,Ct.isTimeElement=function(e){return e.type===Ct.TYPE.time},Ct.parse=function(e,t){var r=p(e,t);return t&&!1===t.normalizeHashtagInPlural||function l(e){e.forEach(function(s){(a(s)||n(s))&&Object.keys(s.options).forEach(function(e){for(var t,r=s.options[e],n=-1,a=void 0,i=0;i<r.value.length;i++){var u=r.value[i];if(f(u)&&g.test(u.value)){n=i,a=u;break}}if(a){var o=a.value.replace(g,"$1{"+s.value+", number}"),c=p(o);(t=r.value).splice.apply(t,h([n,1],c))}l(r.value)})})}(r),r},Ct.parseDateTimeSkeleton=function(e){var r={};return e.replace(s,function(e){var t=e.length;switch(e[0]){case"G":r.era=4===t?"long":5===t?"narrow":"short";break;case"y":r.year=2===t?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":r.month=["numeric","2-digit","short","long","narrow"][t-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":r.day=["numeric","2-digit"][t-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":r.weekday=4===t?"short":5===t?"narrow":"short";break;case"e":if(t<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"c":if(t<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"a":r.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":r.hourCycle="h12",r.hour=["numeric","2-digit"][t-1];break;case"H":r.hourCycle="h23",r.hour=["numeric","2-digit"][t-1];break;case"K":r.hourCycle="h11",r.hour=["numeric","2-digit"][t-1];break;case"k":r.hourCycle="h24",r.hour=["numeric","2-digit"][t-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":r.minute=["numeric","2-digit"][t-1];break;case"s":r.second=["numeric","2-digit"][t-1];break;case"S":case"A":throw new RangeError("`S/A` (second) pattenrs are not supported, use `s` instead");case"z":r.timeZoneName=t<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) pattenrs are not supported, use `z` instead")}return""}),r},Ct.pegParse=p,Object.defineProperty(Ct,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=intl-messageformat-parser.min.js.map |
@@ -248,2 +248,18 @@ var __assign = (this && this.__assign) || function () { | ||
continue; | ||
// https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h | ||
case 'unit-width-narrow': | ||
result.currencyDisplay = 'narrowSymbol'; | ||
result.unitDisplay = 'narrow'; | ||
continue; | ||
case 'unit-width-short': | ||
result.currencyDisplay = 'code'; | ||
result.unitDisplay = 'short'; | ||
continue; | ||
case 'unit-width-full-name': | ||
result.currencyDisplay = 'name'; | ||
result.unitDisplay = 'long'; | ||
continue; | ||
case 'unit-width-iso-code': | ||
result.currencyDisplay = 'symbol'; | ||
continue; | ||
} | ||
@@ -250,0 +266,0 @@ // Precision |
{ | ||
"name": "intl-messageformat-parser", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Parses ICU Message strings into an AST via JavaScript.", | ||
@@ -49,6 +49,6 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@formatjs/intl-unified-numberformat": "^2.1.8" | ||
"@formatjs/intl-unified-numberformat": "^2.2.0" | ||
}, | ||
"homepage": "https://github.com/formatjs/formatjs", | ||
"gitHead": "3ea32d0792af5e0757bede58b8b6235202ea74f2" | ||
"gitHead": "60a1c098bf125dc99e40fef92cd8675efa4f6ac9" | ||
} |
@@ -288,2 +288,18 @@ import {NumberSkeletonToken} from './types'; | ||
continue; | ||
// https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h | ||
case 'unit-width-narrow': | ||
result.currencyDisplay = 'narrowSymbol'; | ||
result.unitDisplay = 'narrow'; | ||
continue; | ||
case 'unit-width-short': | ||
result.currencyDisplay = 'code'; | ||
result.unitDisplay = 'short'; | ||
continue; | ||
case 'unit-width-full-name': | ||
result.currencyDisplay = 'name'; | ||
result.unitDisplay = 'long'; | ||
continue; | ||
case 'unit-width-iso-code': | ||
result.currencyDisplay = 'symbol'; | ||
continue; | ||
} | ||
@@ -290,0 +306,0 @@ // Precision |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
839067
12334