(function(){"use strict";function a(a){var b,c,d,e,f=Array.prototype.slice.call(arguments,1);for(b=0,c=f.length;c>b;b+=1)if(d=f[b])for(e in d)h.call(d,e)&&(a[e]=d[e]);return a}function b(a,b,c){this.locales=a,this.formats=b,this.pluralFn=c}function c(a){this.id=a}function d(a,b,c,d,e){this.id=a,this.useOrdinal=b,this.offset=c,this.options=d,this.pluralFn=e}function e(a,b,c,d){this.id=a,this.offset=b,this.numberFormat=c,this.string=d}function f(a,b){this.id=a,this.options=b}function g(a,b,c){var d="string"==typeof a?g.__parse(a):a;if(!d||"messageFormatPattern"!==d.type)throw new TypeError("A message must be provided as a String or AST.");c=this._mergeFormats(g.formats,c),j(this,"_locale",{value:this._resolveLocale(b)});var e=this._findPluralRuleFunction(this._locale),f=this._compilePattern(d,b,c,e),h=this;this.format=function(b){try{return h._format(f,b)}catch(c){throw c.variableId?new Error("The intl string context variable '"+c.variableId+"' was not provided to the string '"+a+"'"):c}}}var h=Object.prototype.hasOwnProperty,i=function(){try{return!!Object.defineProperty({},"a",{})}catch(a){return!1}}(),j=(!i&&!Object.prototype.__defineGetter__,i?Object.defineProperty:function(a,b,c){"get"in c&&a.__defineGetter__?a.__defineGetter__(b,c.get):(!h.call(a,b)||"value"in c)&&(a[b]=c.value)}),k=Object.create||function(a,b){function c(){}var d,e;c.prototype=a,d=new c;for(e in b)h.call(b,e)&&j(d,e,b[e]);return d},l=b;b.prototype.compile=function(a){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(a)},b.prototype.compileMessage=function(a){if(!a||"messageFormatPattern"!==a.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var b,c,d,e=a.elements,f=[];for(b=0,c=e.length;c>b;b+=1)switch(d=e[b],d.type){case"messageTextElement":f.push(this.compileMessageText(d));break;case"argumentElement":f.push(this.compileArgument(d));break;default:throw new Error("Message element does not have a valid type")}return f},b.prototype.compileMessageText=function(a){return this.currentPlural&&/(^|[^\\])#/g.test(a.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new e(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,a.value)):a.value.replace(/\\#/g,"#")},b.prototype.compileArgument=function(a){var b=a.format;if(!b)return new c(a.id);var e,g=this.formats,h=this.locales,i=this.pluralFn;switch(b.type){case"numberFormat":return e=g.number[b.style],{id:a.id,format:new Intl.NumberFormat(h,e).format};case"dateFormat":return e=g.date[b.style],{id:a.id,format:new Intl.DateTimeFormat(h,e).format};case"timeFormat":return e=g.time[b.style],{id:a.id,format:new Intl.DateTimeFormat(h,e).format};case"pluralFormat":return e=this.compileOptions(a),new d(a.id,b.ordinal,b.offset,e,i);case"selectFormat":return e=this.compileOptions(a),new f(a.id,e);default:throw new Error("Message element does not have a valid format type")}},b.prototype.compileOptions=function(a){var b=a.format,c=b.options,d={};this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===b.type?a:null;var e,f,g;for(e=0,f=c.length;f>e;e+=1)g=c[e],d[g.selector]=this.compileMessage(g.value);return this.currentPlural=this.pluralStack.pop(),d},c.prototype.format=function(a){return a||"number"==typeof a?"string"==typeof a?a:String(a):""},d.prototype.getOption=function(a){var b=this.options,c=b["="+a]||b[this.pluralFn(a-this.offset,this.useOrdinal)];return c||b.other},e.prototype.format=function(a){var b=this.numberFormat.format(a-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+b).replace(/\\#/g,"#")},f.prototype.getOption=function(a){var b=this.options;return b[a]||b.other};var m=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,c,d,e){this.message=a,this.expected=c,this.found=d,this.location=e,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,b)}function c(a){function c(){return e(Wa,Va)}function d(b){var c,d,e=Xa[b];if(e)return e;for(c=b-1;!Xa[c];)c--;for(e=Xa[c],e={line:e.line,column:e.column,seenCR:e.seenCR};b>c;)d=a.charAt(c),"\n"===d?(e.seenCR||e.line++,e.column=1,e.seenCR=!1):"\r"===d||"\u2028"===d||"\u2029"===d?(e.line++,e.column=1,e.seenCR=!0):(e.column++,e.seenCR=!1),c++;return Xa[b]=e,e}function e(a,b){var c=d(a),e=d(b);return{start:{offset:a,line:c.line,column:c.column},end:{offset:b,line:e.line,column:e.column}}}function f(a){Ya>Va||(Va>Ya&&(Ya=Va,Za=[]),Za.push(a))}function g(a,c,d,e){function f(a){var b=1;for(a.sort(function(a,b){return a.descriptionb.description?1:0});b1?g.slice(0,-1).join(", ")+" or "+g[a.length-1]:g[0],e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}return null!==c&&f(c),new b(null!==a?a:g(c,d),c,d,e)}function h(){var a;return a=i()}function i(){var a,b,c;for(a=Va,b=[],c=j();c!==G;)b.push(c),c=j();return b!==G&&(Wa=a,b=J(b)),a=b}function j(){var a;return a=l(),a===G&&(a=n()),a}function k(){var b,c,d,e,f,g;if(b=Va,c=[],d=Va,e=y(),e!==G?(f=D(),f!==G?(g=y(),g!==G?(e=[e,f,g],d=e):(Va=d,d=G)):(Va=d,d=G)):(Va=d,d=G),d!==G)for(;d!==G;)c.push(d),d=Va,e=y(),e!==G?(f=D(),f!==G?(g=y(),g!==G?(e=[e,f,g],d=e):(Va=d,d=G)):(Va=d,d=G)):(Va=d,d=G);else c=G;return c!==G&&(Wa=b,c=K(c)),b=c,b===G&&(b=Va,c=x(),b=c!==G?a.substring(b,Va):c),b}function l(){var a,b;return a=Va,b=k(),b!==G&&(Wa=a,b=L(b)),a=b}function m(){var b,c,d;if(b=B(),b===G){if(b=Va,c=[],M.test(a.charAt(Va))?(d=a.charAt(Va),Va++):(d=G,0===$a&&f(N)),d!==G)for(;d!==G;)c.push(d),M.test(a.charAt(Va))?(d=a.charAt(Va),Va++):(d=G,0===$a&&f(N));else c=G;b=c!==G?a.substring(b,Va):c}return b}function n(){var b,c,d,e,g,h,i,j,k;return b=Va,123===a.charCodeAt(Va)?(c=O,Va++):(c=G,0===$a&&f(P)),c!==G?(d=y(),d!==G?(e=m(),e!==G?(g=y(),g!==G?(h=Va,44===a.charCodeAt(Va)?(i=Q,Va++):(i=G,0===$a&&f(R)),i!==G?(j=y(),j!==G?(k=o(),k!==G?(i=[i,j,k],h=i):(Va=h,h=G)):(Va=h,h=G)):(Va=h,h=G),h===G&&(h=null),h!==G?(i=y(),i!==G?(125===a.charCodeAt(Va)?(j=S,Va++):(j=G,0===$a&&f(T)),j!==G?(Wa=b,c=U(e,h),b=c):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G),b}function o(){var a;return a=p(),a===G&&(a=q(),a===G&&(a=r(),a===G&&(a=s()))),a}function p(){var b,c,d,e,g,h,i;return b=Va,a.substr(Va,6)===V?(c=V,Va+=6):(c=G,0===$a&&f(W)),c===G&&(a.substr(Va,4)===X?(c=X,Va+=4):(c=G,0===$a&&f(Y)),c===G&&(a.substr(Va,4)===Z?(c=Z,Va+=4):(c=G,0===$a&&f($)))),c!==G?(d=y(),d!==G?(e=Va,44===a.charCodeAt(Va)?(g=Q,Va++):(g=G,0===$a&&f(R)),g!==G?(h=y(),h!==G?(i=D(),i!==G?(g=[g,h,i],e=g):(Va=e,e=G)):(Va=e,e=G)):(Va=e,e=G),e===G&&(e=null),e!==G?(Wa=b,c=_(c,e),b=c):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G),b}function q(){var b,c,d,e,g,h;return b=Va,a.substr(Va,6)===aa?(c=aa,Va+=6):(c=G,0===$a&&f(ba)),c!==G?(d=y(),d!==G?(44===a.charCodeAt(Va)?(e=Q,Va++):(e=G,0===$a&&f(R)),e!==G?(g=y(),g!==G?(h=w(),h!==G?(Wa=b,c=ca(h),b=c):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G),b}function r(){var b,c,d,e,g,h;return b=Va,a.substr(Va,13)===da?(c=da,Va+=13):(c=G,0===$a&&f(ea)),c!==G?(d=y(),d!==G?(44===a.charCodeAt(Va)?(e=Q,Va++):(e=G,0===$a&&f(R)),e!==G?(g=y(),g!==G?(h=w(),h!==G?(Wa=b,c=fa(h),b=c):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G),b}function s(){var b,c,d,e,g,h,i;if(b=Va,a.substr(Va,6)===ga?(c=ga,Va+=6):(c=G,0===$a&&f(ha)),c!==G)if(d=y(),d!==G)if(44===a.charCodeAt(Va)?(e=Q,Va++):(e=G,0===$a&&f(R)),e!==G)if(g=y(),g!==G){if(h=[],i=u(),i!==G)for(;i!==G;)h.push(i),i=u();else h=G;h!==G?(Wa=b,c=ia(h),b=c):(Va=b,b=G)}else Va=b,b=G;else Va=b,b=G;else Va=b,b=G;else Va=b,b=G;return b}function t(){var b,c,d,e;return b=Va,c=Va,61===a.charCodeAt(Va)?(d=ja,Va++):(d=G,0===$a&&f(ka)),d!==G?(e=B(),e!==G?(d=[d,e],c=d):(Va=c,c=G)):(Va=c,c=G),b=c!==G?a.substring(b,Va):c,b===G&&(b=D()),b}function u(){var b,c,d,e,g,h,j,k,l;return b=Va,c=y(),c!==G?(d=t(),d!==G?(e=y(),e!==G?(123===a.charCodeAt(Va)?(g=O,Va++):(g=G,0===$a&&f(P)),g!==G?(h=y(),h!==G?(j=i(),j!==G?(k=y(),k!==G?(125===a.charCodeAt(Va)?(l=S,Va++):(l=G,0===$a&&f(T)),l!==G?(Wa=b,c=la(d,j),b=c):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G),b}function v(){var b,c,d,e;return b=Va,a.substr(Va,7)===ma?(c=ma,Va+=7):(c=G,0===$a&&f(na)),c!==G?(d=y(),d!==G?(e=B(),e!==G?(Wa=b,c=oa(e),b=c):(Va=b,b=G)):(Va=b,b=G)):(Va=b,b=G),b}function w(){var a,b,c,d,e;if(a=Va,b=v(),b===G&&(b=null),b!==G)if(c=y(),c!==G){if(d=[],e=u(),e!==G)for(;e!==G;)d.push(e),e=u();else d=G;d!==G?(Wa=a,b=pa(b,d),a=b):(Va=a,a=G)}else Va=a,a=G;else Va=a,a=G;return a}function x(){var b,c;if($a++,b=[],ra.test(a.charAt(Va))?(c=a.charAt(Va),Va++):(c=G,0===$a&&f(sa)),c!==G)for(;c!==G;)b.push(c),ra.test(a.charAt(Va))?(c=a.charAt(Va),Va++):(c=G,0===$a&&f(sa));else b=G;return $a--,b===G&&(c=G,0===$a&&f(qa)),b}function y(){var b,c,d;for($a++,b=Va,c=[],d=x();d!==G;)c.push(d),d=x();return b=c!==G?a.substring(b,Va):c,$a--,b===G&&(c=G,0===$a&&f(ta)),b}function z(){var b;return ua.test(a.charAt(Va))?(b=a.charAt(Va),Va++):(b=G,0===$a&&f(va)),b}function A(){var b;return wa.test(a.charAt(Va))?(b=a.charAt(Va),Va++):(b=G,0===$a&&f(xa)),b}function B(){var b,c,d,e,g,h;if(b=Va,48===a.charCodeAt(Va)?(c=ya,Va++):(c=G,0===$a&&f(za)),c===G){if(c=Va,d=Va,Aa.test(a.charAt(Va))?(e=a.charAt(Va),Va++):(e=G,0===$a&&f(Ba)),e!==G){for(g=[],h=z();h!==G;)g.push(h),h=z();g!==G?(e=[e,g],d=e):(Va=d,d=G)}else Va=d,d=G;c=d!==G?a.substring(c,Va):d}return c!==G&&(Wa=b,c=Ca(c)),b=c}function C(){var b,c,d,e,g,h,i,j;return Da.test(a.charAt(Va))?(b=a.charAt(Va),Va++):(b=G,0===$a&&f(Ea)),b===G&&(b=Va,a.substr(Va,2)===Fa?(c=Fa,Va+=2):(c=G,0===$a&&f(Ga)),c!==G&&(Wa=b,c=Ha()),b=c,b===G&&(b=Va,a.substr(Va,2)===Ia?(c=Ia,Va+=2):(c=G,0===$a&&f(Ja)),c!==G&&(Wa=b,c=Ka()),b=c,b===G&&(b=Va,a.substr(Va,2)===La?(c=La,Va+=2):(c=G,0===$a&&f(Ma)),c!==G&&(Wa=b,c=Na()),b=c,b===G&&(b=Va,a.substr(Va,2)===Oa?(c=Oa,Va+=2):(c=G,0===$a&&f(Pa)),c!==G&&(Wa=b,c=Qa()),b=c,b===G&&(b=Va,a.substr(Va,2)===Ra?(c=Ra,Va+=2):(c=G,0===$a&&f(Sa)),c!==G?(d=Va,e=Va,g=A(),g!==G?(h=A(),h!==G?(i=A(),i!==G?(j=A(),j!==G?(g=[g,h,i,j],e=g):(Va=e,e=G)):(Va=e,e=G)):(Va=e,e=G)):(Va=e,e=G),d=e!==G?a.substring(d,Va):e,d!==G?(Wa=b,c=Ta(d),b=c):(Va=b,b=G)):(Va=b,b=G)))))),b}function D(){var a,b,c;if(a=Va,b=[],c=C(),c!==G)for(;c!==G;)b.push(c),c=C();else b=G;return b!==G&&(Wa=a,b=Ua(b)),a=b}var E,F=arguments.length>1?arguments[1]:{},G={},H={start:h},I=h,J=function(a){return{type:"messageFormatPattern",elements:a,location:c()}},K=function(a){var b,c,d,e,f,g="";for(b=0,d=a.length;d>b;b+=1)for(e=a[b],c=0,f=e.length;f>c;c+=1)g+=e[c];return g},L=function(a){return{type:"messageTextElement",value:a,location:c()}},M=/^[^ \t\n\r,.+={}#]/,N={type:"class",value:"[^ \\t\\n\\r,.+={}#]",description:"[^ \\t\\n\\r,.+={}#]"},O="{",P={type:"literal",value:"{",description:'"{"'},Q=",",R={type:"literal",value:",",description:'","'},S="}",T={type:"literal",value:"}",description:'"}"'},U=function(a,b){return{type:"argumentElement",id:a,format:b&&b[2],location:c()}},V="number",W={type:"literal",value:"number",description:'"number"'},X="date",Y={type:"literal",value:"date",description:'"date"'},Z="time",$={type:"literal",value:"time",description:'"time"'},_=function(a,b){return{type:a+"Format",style:b&&b[2],location:c()}},aa="plural",ba={type:"literal",value:"plural",description:'"plural"'},ca=function(a){return{type:a.type,ordinal:!1,offset:a.offset||0,options:a.options,location:c()}},da="selectordinal",ea={type:"literal",value:"selectordinal",description:'"selectordinal"'},fa=function(a){return{type:a.type,ordinal:!0,offset:a.offset||0,options:a.options,location:c()}},ga="select",ha={type:"literal",value:"select",description:'"select"'},ia=function(a){return{type:"selectFormat",options:a,location:c()}},ja="=",ka={type:"literal",value:"=",description:'"="'},la=function(a,b){return{type:"optionalFormatPattern",selector:a,value:b,location:c()}},ma="offset:",na={type:"literal",value:"offset:",description:'"offset:"'},oa=function(a){return a},pa=function(a,b){return{type:"pluralFormat",offset:a,options:b,location:c()}},qa={type:"other",description:"whitespace"},ra=/^[ \t\n\r]/,sa={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},ta={type:"other",description:"optionalWhitespace"},ua=/^[0-9]/,va={type:"class",value:"[0-9]",description:"[0-9]"},wa=/^[0-9a-f]/i,xa={type:"class",value:"[0-9a-f]i",description:"[0-9a-f]i"},ya="0",za={type:"literal",value:"0",description:'"0"'},Aa=/^[1-9]/,Ba={type:"class",value:"[1-9]",description:"[1-9]"},Ca=function(a){return parseInt(a,10)},Da=/^[^{}\\\0-\x1F \t\n\r]/,Ea={type:"class",value:"[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]",description:"[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]"},Fa="\\\\",Ga={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},Ha=function(){return"\\"},Ia="\\#",Ja={type:"literal",value:"\\#",description:'"\\\\#"'},Ka=function(){return"\\#"},La="\\{",Ma={type:"literal",value:"\\{",description:'"\\\\{"'},Na=function(){return"{"},Oa="\\}",Pa={type:"literal",value:"\\}",description:'"\\\\}"'},Qa=function(){return"}"},Ra="\\u",Sa={type:"literal",value:"\\u",description:'"\\\\u"'},Ta=function(a){return String.fromCharCode(parseInt(a,16))},Ua=function(a){return a.join("")},Va=0,Wa=0,Xa=[{line:1,column:1,seenCR:!1}],Ya=0,Za=[],$a=0;if("startRule"in F){if(!(F.startRule in H))throw new Error("Can't start parsing from rule \""+F.startRule+'".');I=H[F.startRule]}if(E=I(),E!==G&&Va===a.length)return E;throw E!==G&&Vac;c+=1)if(e=a[c],"string"!=typeof e){if(f=e.id,!b||!h.call(b,f))throw i=new Error("A value must be provided for: "+f),i.variableId=f,i;g=b[f],j+=e.options?this._format(e.getOption(g),b):e.format(g)}else j+=e;return j},g.prototype._mergeFormats=function(b,c){var d,e,f={};for(d in b)h.call(b,d)&&(f[d]=e=k(b[d]),c&&h.call(c,d)&&a(e,c[d]));return f},g.prototype._resolveLocale=function(a){"string"==typeof a&&(a=[a]),a=(a||[]).concat(g.defaultLocale);var b,c,d,e,f=g.__localeData__;for(b=0,c=a.length;c>b;b+=1)for(d=a[b].toLowerCase().split("-");d.length;){if(e=f[d.join("-")])return e.locale;d.pop()}var h=a.pop();throw new Error("No locale data has been added to IntlMessageFormat for: "+a.join(", ")+", or the default locale: "+h)};var o={locale:"en",pluralRuleFunction:function(a,b){var c=String(a).split("."),d=!c[1],e=Number(c[0])==a,f=e&&c[0].slice(-1),g=e&&c[0].slice(-2);return b?1==f&&11!=g?"one":2==f&&12!=g?"two":3==f&&13!=g?"few":"other":1==a&&d?"one":"other"}};n.__addLocaleData(o),n.defaultLocale="en";var p=n;this.IntlMessageFormat=p}).call(this); //# sourceMappingURL=intl-messageformat.min.js.map