Blame view

bower_components/l20n/dist/compat/web/l20n.min.js 30.7 KB
79ec939f   Renato De Donato   info position + a...
1
  "use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}!function(){function a(a){for(var b=this,c=arguments.length,d=Array(c>1?c-1:0),e=1;c>e;e++)d[e-1]=arguments[e];var f=d.shift();a["*"]&&a["*"].slice().forEach(function(a){return a.apply(b,d)}),a[f]&&a[f].slice().forEach(function(a){return a.apply(b,d)})}function b(a,b,c){b in a||(a[b]=[]),a[b].push(c)}function c(a,b,c){var d=a[b],e=d.indexOf(c);-1!==e&&d.splice(e,1)}function d(a,b){Array.from(this.ctxs.keys()).forEach(function(c){return c.emit(a,b)})}function e(a,b,c){this.name="L10nError",this.message=a,this.id=b,this.lang=c}function f(a,b){return new Promise(function(c,d){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType(a),f.open("GET",b,!0),"application/json"===a&&(f.responseType="json"),f.addEventListener("load",function(a){200===a.target.status||0===a.target.status?c(a.target.response||a.target.responseText):d(new e("Not found: "+b))}),f.addEventListener("error",d),f.addEventListener("timeout",d);try{f.send(null)}catch(g){if("NS_ERROR_FILE_NOT_FOUND"!==g.name)throw g;d(new e("Not found: "+b))}})}function g(a,b,c){var d=b.replace("{locale}",c.code),e=b.endsWith(".json")?"json":"text";return ea[c.src](c.code,a,d,e)}function h(a,b,c,d){if("string"==typeof d)return[{},d];if(na.has(d))throw new e("Cyclic reference detected");na.add(d);var f=void 0;try{f=m({},a,b,c,d.value,d.index)}finally{na.delete(d)}return f}function i(a,b,c,d){if(ja.indexOf(d)>-1)return[{},a._getMacro(b,d)];if(c&&c.hasOwnProperty(d)){if("string"==typeof c[d]||"number"==typeof c[d]&&!isNaN(c[d]))return[{},c[d]];throw new e("Arg must be a string or a number: "+d)}if("__proto__"===d)throw new e("Illegal id: "+d);var f=a._getEntity(b,d);if(f)return h(a,b,c,f);throw new e("Unknown reference: "+d)}function j(a,b,c,d,f){var g=void 0,h=void 0;try{var j=i(b,c,d,f);g=j[0],h=j[1]}catch(k){return[{error:k},la+"{{ "+f+" }}"+ma]}if("number"==typeof h){var l=b._getNumberFormatter(c);return[g,l.format(h)]}if("string"==typeof h){if(h.length>=ka)throw new e("Too many characters in placeable ("+h.length+", max allowed is "+ka+")");return[g,la+h+ma]}return[{},la+"{{ "+f+" }}"+ma]}function k(a,b,c,d,e){return e.reduce(function(e,f){var g=e[0],h=e[1];if("string"==typeof f)return[g,h+f];var i=j(a,b,c,d,f.name),k=i[1];return[g,h+k]},[a,""])}function l(a,b,c,d,e){var f=void 0;f="call"===e[0].type&&"prop"===e[0].expr.type&&"cldr"===e[0].expr.expr.name?"plural":e[0].name;var g=i(a,b,c,f)[1];if("function"!=typeof g)return g;var h=e[0].args?i(a,b,c,e[0].args[0].name)[1]:void 0;if("plural"===f){if(0===h&&"zero"in d)return"zero";if(1===h&&"one"in d)return"one";if(2===h&&"two"in d)return"two"}return g(h)}function m(a,b,c,d,f,g){if(!f)return[a,f];if("string"==typeof f||"boolean"==typeof f||"number"==typeof f)return[a,f];if(Array.isArray(f))return k(a,b,c,d,f);if(g){var h=l(b,c,d,f,g);if(h in f)return m(a,b,c,d,f[h])}var i=f.__default||"other";if(i in f)return m(a,b,c,d,f[i]);throw new e("Unresolvable value")}function n(a,b){return-1!==b.indexOf(a)}function o(a,b,c){return typeof a==typeof b&&a>=b&&c>=a}function p(a){var b=oa[a.replace(/-.*$/,"")];return b in pa?pa[b]:function(){return"other"}}function q(a,b,c){var d=this,f=new Set;return a.forEach(function(a,e){if(!c||void 0===c[e]){var g=Array.isArray(a)?a[0]:a;f.add(g),c[e]=b===d._formatValue?g:{value:g,attrs:null}}}),this._env.emit("notfounderror",new e('"'+Array.from(f).join(", ")+'" not found in any language',f),this),c}function r(a,b){if("string"==typeof a)return b(a);var c=Object.create(null);if(a.value&&(c.value=s(a.value,b)),a.index&&(c.index=a.index),a.attrs){c.attrs=Object.create(null);for(var d in a.attrs)c.attrs[d]=r(a.attrs[d],b)}return c}function s(a,b){if("string"==typeof a)return b(a);if(a.type)return a;for(var c=Array.isArray(a)?[]:Object.create(null),d=Object.keys(a),e=0,f=void 0;f=d[e];e++)c[f]=s(a[f],b);return c}function t(a,b){var c=null;return function(){if(c)return c;var d=/[a-zA-Z]/g,e=/[aeiouAEIOU]/g,f=/[^\W0-9_]+/g,g=/(%[EO]?\w|\{\s*.+?\s*\}|&[#\w]+;|<\s*.+?\s*>)/,h={"fr-x-psaccent":"ȦƁƇḒḖƑƓĦĪĴĶĿḾȠǾƤɊŘŞŦŬṼẆẊẎẐ[\\]^_`ȧƀƈḓḗƒɠħīĵķŀḿƞǿƥɋřşŧŭṽẇẋẏẑ","ar-x-psbidi":"∀ԐↃpƎɟפHIſӼ˥WNOԀÒᴚS⊥∩ɅMXʎZ[\\]ᵥ_,ɐqɔpǝɟƃɥıɾʞʅɯuodbɹsʇnʌʍxʎz"},i={"fr-x-psaccent":function(a){return a.replace(e,function(a){return a+a.toLowerCase()})},"ar-x-psbidi":function(a){return a.replace(f,function(a){return"‮"+a+"‬"})}},j=function(a,b){return b.replace(d,function(b){return a.charAt(b.charCodeAt(0)-65)})},k=function(b){return j(h[a],i[a](b))},l=function(a,b){if(!b)return b;var c=b.split(g),d=c.map(function(b){return g.test(b)?b:a(b)});return d.join("")};return c={name:k(b),process:function(a){return l(k,a)}}}}function u(a,b,c){var d=Array.from(b).some(function(a){var b=(a[0],a[1]);return b.has(c)});d||a.forEach(function(b,d){return d.startsWith(c)?a.delete(d):null})}function v(a,b){return b.lang=a,b}function w(){return"loading"!==document.readyState?Promise.resolve():new Promise(function(a){document.addEventListener("readystatechange",function b(){document.removeEventListener("readystatechange",b),a()})})}function x(a){var b=a.split("-")[0];return["ar","he","fa","ps","ur"].indexOf(b)>=0?"rtl":"ltr"}function y(a,b,c){for(var d=void 0,e=0;e<c.length;e++){var f=c[e];if(-1!==b.indexOf(f)){d=f;break}}return d&&d!==a?[d,a]:[a]}function z(a){for(var b=Object.create(null),c=null,d=null,e=a.querySelectorAll('meta[name="availableLanguages"],meta[name="defaultLanguage"],meta[name="appVersion"]'),f=e,g=Array.isArray(f),h=0,f=g?f:f[Symbol.iterator]();;){var i;if(g){if(h>=f.length)break;i=f[h++]}else{if(h=f.next(),h.done)break;i=h.value}var j=i,k=j.getAttribute("name"),l=j.getAttribute("content").trim();switch(k){case"availableLanguages":b=A(b,l);break;case"defaultLanguage":var m=B(l),n=m[0],o=m[1];c=n,n in b||(b[n]=o);break;case"appVersion":d=l}}return{defaultLang:c,availableLangs:b,appVersion:d}}function A(a,b){return b.split(",").reduce(function(a,b){var c=B(b),d=c[0],e=c[1];return a[d]=e,a},a)}function B(a){var b=a.trim().split(":"),c=b[0],d=b[1];return[c,parseInt(d)]}function C(a,b,c,d,e,f,g){var h=Object.keys(d).concat(e||[]).concat(Object.keys(ra)),i=y(c,h,g),j=i.map(function(a){return{code:a,src:F(b,d,e,a)}});return D(f,i)||a(j),j}function D(a,b){return a.length===b.length&&a.every(function(a,c){return a===b[c]})}function E(a,b){for(var c=0,d=void 0;d=b[c];c++)if(d.target===a)return d;return null}function F(a,b,c,d){if(c&&c[d]){var e=E(a,c[d]);if(e&&(!(d in b)||parseInt(e.revision)>b[d]))return"extra"}return d in ra&&!(d in b)?"pseudo":"app"}function G(){return navigator.mozApps&&navigator.mozApps.getAdditionalLanguages?navigator.mozApps.getAdditionalLanguages().catch(function(){return[]}):Promise.resolve([])}function H(a,b){var c=this,d=this.languages||[];return this.languages=Promise.all([a,d]).then(function(a){var d=a[0],e=a[1];return C(c.broadcast.bind(c,"translateDocument"),c.appVersion,c.defaultLanguage,c.availableLanguages,d,e,b)})}function I(a,b){var c=b.value;if("string"==typeof c)if(va.test(c)){var d=a.ownerDocument.createElement("template");d.innerHTML=c,J(a,d.content)}else a.textContent=c;for(var e in b.attrs){var f=O(e);L({name:f},a)&&a.setAttribute(f,b.attrs[e])}}function J(a,b){for(var c=b.ownerDocument.createDocumentFragment(),d=void 0,e=void 0,f=void 0;f=b.childNodes[0];)if(b.removeChild(f),f.nodeType!==f.TEXT_NODE){var g=N(f),h=M(a,f,g);if(h)J(h,f),c.appendChild(h);else if(K(f)){var i=f.ownerDocument.createElement(f.nodeName);J(i,f),c.appendChild(i)}else c.appendChild(b.ownerDocument.createTextNode(f.textContent))}else c.appendChild(f);if(a.textContent="",a.appendChild(c),b.attributes)for(d=0,e;e=b.attributes[d];d++)L(e,a)&&a.setAttribute(e.name,e.value)}function K(a){return-1!==wa.elements.indexOf(a.tagName.toLowerCase())}function L(a,b){var c=a.name.toLowerCase(),d=b.tagName.toLowerCase();if(-1!==wa.attributes.global.indexOf(c))return!0;if(!wa.attributes[d])return!1;if(-1!==wa.attributes[d].indexOf(c))return!0;if("input"===d&&"value"===c){var e=b.type.toLowerCase();if("submit"===e||"button"===e||"reset"===e)return!0}return!1}function M(a,b,c){for(var d=0,e=0,f=void 0;f=a.children[e];e++)if(f.nodeType===f.ELEMENT_NODE&&f.tagName===b.tagName){if(d===c)return f;d++}return null}function N(a){for(var b=0,c=void 0;c=a.previousElementSibling;)c.tagName===a.tagName&&b++;return b}function O(a){return"ariaValueText"===a?"aria-valuetext":a.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()}).replace(/^-/,"")}function P(a){return Array.prototype.map.call(a.querySelectorAll('link[rel="localization"]'),function(a){return a.getAttribute("href")})}function Q(a,b,c){a.setAttribute("data-l10n-id",b),c&&a.setAttribute("data-l10n-args",JSON.stringify(c))}function R(a){return{id:a.getAttribute("data-l10n-id"),args:JSON.parse(a.getAttribute("data-l10n-args"))}}function S(a){var b=Array.from(a.querySelectorAll("[data-l10n-id]"));return"function"==typeof a.hasAttribute&&a.hasAttribute("data-l10n-id")&&b.push(a),b}function T(a,b,c){for(var d=new Set,e=c,f=Array.isArray(e),g=0,e=f?e:e[Symbol.iterator]();;){var h;if(f){if(g>=e.length)break;h=e[g++]}else{if(g=e.next(),g.done)break;h=g.value}var i=h;switch(i.type){case"attributes":d.add(i.target);break;case"childList":for(var j=i.addedNodes,k=Array.isArray(j),l=0,j=k?j:j[Symbol.iterator]();;){var m;if(k){if(l>=j.length)break;m=j[l++]}else{if(l=j.next(),l.done)break;m=l.value}var n=m;n.nodeType===n.ELEMENT_NODE&&(n.childElementCount?S(n).forEach(d.add.bind(d)):n.hasAttribute("data-l10n-id")&&d.add(n))}}}0!==d.size&&W(a,b,Array.from(d))}function U(a,b,c){return W(a,b,S(c))}function V(a,b,c){var d=c.map(function(a){var b=a.getAttribute("data-l10n-id"),c=a.getAttribute("data-l10n-args");return c?[b,JSON.parse(c.replace(xa,function(a){return ya[a]}))]:b});return a._resolveEntities(b,d)}function W(a,b,c){return V(a,b,c).then(function(b){return X(a,c,b)})}function X(a,b,c){a._disconnect();for(var d=0;d<b.length;d++)I(b[d],c[d]);a._observe()}function Y(a,b){return{getName:function(){return a._interactive.then(function(a){return a.method("getName",b)})},processString:function(c){return a._interactive.then(function(a){return a.method("processString",b,c)})}}}function Z(a,b){return a._observe(),b.method("registerView",b.id,P(a._doc.head)).then(function(){return b})}function $(a){var b=this;return this._interactive.then(function(a){return a.method("resolvedLanguages")}).then(function(c){return T(b,c,a)})}function _(a,b){var c=a._doc.documentElement;if(Aa.has(c))return U(a,b,c).then(function(){return ca(c,b)});var d=b[0].code===c.getAttribute("lang")?Promise.resolve():U(a,b,c).then(function(){return ba(c,b)});return d.then(function(){aa(c,b),Aa.set(c,!0)})}function aa(a,b){var c=b.map(function(a){return a.code});a.setAttribute("langs",c.join(" "))}function ba(a,b){var c=b[0].code;a.setAttribute("lang",c),a.setAttribute("dir",x(c))}function ca(a,b){ba(a,b),aa(a,b),a.parentNode.dispatchEvent(new CustomEvent("DOMRetranslated",{bubbles:!1,cancelable:!1}))}var da=function(){function c(d){_classCallCheck(this,c),this.id=this,this.remote=d;var e={};this.on=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return b.apply(void 0,[e].concat(c))},this.emit=function(){for(var b=arguments.length,c=Array(b),d=0;b>d;d++)c[d]=arguments[d];return a.apply(void 0,[e].concat(c))}}return c.prototype.method=function(a){for(var b,c=arguments.length,d=Array(c>1?c-1:0),e=1;c>e;e++)d[e-1]=arguments[e];return(b=this.remote)[a].apply(b,d)},c}();e.prototype=Object.create(Error.prototype),e.prototype.constructor=e;var ea={extra:function(a,b,c,d){return navigator.mozApps.getLocalizationResource(a,b,c,d)},app:function(a,b,c,d){switch(d){case"text":return f("text/plain",c);case"json":return f("application/json",c);default:throw new e("Unknown file type: "+d)}}},fa=100,ga={parse:function(a,b){return this._source=b,this._index=0,this._length=b.length,this.entries=Object.create(null),this.emit=a,this.getResource()},getResource:function(){for(this.getWS();this._index<this._length;){try{this.getEntry()}catch(a){if(!(a instanceof e))throw a;if(this.getJunkEntry(),!this.emit)throw a}this._index<this._length&&this.getWS()}return this.entries},getEntry:function(){if("<"===this._source[this._index]){++this._index;var a=this.getIdentifier();return"["===this._source[this._index]?(++this._index,this.getEntity(a,this.getItemList(this.getExpression,"]"))):this.getEntity(a)}if(this._source.startsWith("/*",this._index))return this.getComment();throw this.error("Invalid entry")},getEntity:function(a,b){if(!this.getRequiredWS())throw this.error("Expected white space");var c=this._source[this._index],d=this.getValue(c,void 0===b),e=void 0;if(void 0===d){if(">"===c)throw this.error('Expected ">"');e=this.getAttributes()}else{var f=this.getRequiredWS();if(">"!==this._source[this._index]){if(!f)throw this.error('Expected ">"');e=this.getAttributes()}}if(++this._index,a in this.entries)throw this.error('Duplicate entry ID "'+a,"duplicateerror");e||b||"string"!=typeof d?this.entries[a]={value:d,attrs:e,index:b}:this.entries[a]=d},getValue:function(){var a=arguments.length<=0||void 0===arguments[0]?this._source[this._index]:arguments[0],b=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];switch(a){case"'":case'"':return this.getString(a,1);case"{":return this.getHash()}if(!b)throw this.error("Unknown value type")},getWS:function(){for(var a=this._source.charCodeAt(this._index);32===a||10===a||9===a||13===a;)a=this._source.charCodeAt(++this._index)},getRequiredWS:function(){for(var a=this._index,b=this._source.charCodeAt(a);32===b||10===b||9===b||13===b;)b=this._source.charCodeAt(++this._index);return this._index!==a},getIdentifier:function(){var a=this._index,b=this._source.charCodeAt(this._index);if(!(b>=97&&122>=b||b>=65&&90>=b||95===b))throw this.error("Identifier has to start with [a-zA-Z_]");for(b=this._source.charCodeAt(++this._index);b>=97&&122>=b||b>=65&&90>=b||b>=48&&57>=b||95===b;)b=this._source.charCodeAt(++this._index);return this._source.slice(a,this._index)},getUnicodeChar:function(){for(var a=0;4>a;a++){var b=this._source.charCodeAt(++this._index);if(!(b>96&&103>b||b>64&&71>b||b>47&&58>b))throw this.error("Illegal unicode escape sequence")}return this._index++,String.fromCharCode(parseInt(this._source.slice(this._index-4,this._index),16))},stringRe:/"|'|{{|\\/g,getString:function(a,b){var c=[],d=0;this._index+=b;for(var e=this._index,f=e,g="";;){this.stringRe.lastIndex=this._index;var h=this.stringRe.exec(this._source);if(!h)throw this.error("Unclosed string literal");if('"'===h[0]||"'"===h[0]){if(h[0]!==a){this._index+=b;continue}this._index=h.index+b;break}if("{{"!==h[0]){if("\\"===h[0]){this._index=h.index+1;var i=this._source[this._index];if("u"===i)g+=this._source.slice(f,h.index)+this.getUnicodeChar();else if(i===a||"\\"===i)g+=this._source.slice(f,h.index)+i,this._index++;else{if(!this._source.startsWith("{{",this._index))throw this.error("Illegal escape sequence");g+=this._source.slice(f,h.index)+"{{",this._index+=2}f=this._index}}else{if(d>fa-1)throw this.error("Too many placeables, maximum allowed is "+fa);d++,(h.index>f||g.length>0)&&(c.push(g+this._source.slice(f,h.index)),g=""),this._index=h.index+2,this.getWS(),c.push(this.getExpression()),this.getWS(),this._index+=2,f=this._index}}return 0===c.length?g+this._source.slice(f,this._index-b):((this._index-b>f||g.length>0)&&c.push(g+this._source.slice(f,this._index-b)),c)},getAttributes:function(){for(var a=Object.create(null);;){this.getAttribute(a);var b=this.getRequiredWS(),c=this._source.charAt(this._index);if(">"===c)break;if(!b)throw this.error('Expected ">"')}return a},getAttribute:function(a){var b=this.getIdentifier(),c=void 0;if("["===this._source[this._index]&&(++this._index,this.getWS(),c=this.getItemList(this.getExpression,"]")),this.getWS(),":"!==this._source[this._index])throw this.error('Expected ":"');++this._index,this.getWS();var d=this.getValue();if(b in a)throw this.error('Duplicate attribute "'+b,"duplicateerror");c||"string"!=typeof d?a[b]={value:d,index:c}:a[b]=d},getHash:function(){var a=Object.create(null);++this._index,this.getWS();for(var b=void 0;;){var c=this.getHashItem(),d=c[0],e=c[1],f=c[2];if(a[d]=e,f){if(b)throw this.error("Default item redefinition forbidden");b=d}this.getWS();var g=","===this._source[this._index];if(g&&(++this._index,this.getWS()),"}"===this._source[this._index]){++this._index;break}if(!g)throw this.error('Expected "}"')}return b&&(a.__default=b),a},getHashItem:function(){var a=!1;"*"===this._source[this._index]&&(++this._index,a=!0);var b=this.getIdentifier();if(this.getWS(),":"!==this._source[this._index])throw this.error('Expected ":"');return++this._index,this.getWS(),[b,this.getValue(),a]},getComment:function(){this._index+=2;var a=this._index,b=this._source.indexOf("*/",a);if(-1===b)throw this.error("Comment without a closing tag");this._index=b+2},getExpression:function(){for(var a=this.getPrimaryExpression();;){var b=this._source[this._index];if("."===b||"["===b)++this._index,a=this.getPropertyExpression(a,"["===b);else{if("("!==b)break;++this._index,a=this.getCallExpression(a)}}return a},getPropertyExpression:function(a,b){var c=void 0;if(b){if(this.getWS(),c=this.getExpression(),this.getWS(),"]"!==this._source[this._index])throw this.error('Expected "]"');++this._index}else c=this.getIdentifier();return{type:"prop",expr:a,prop:c,cmpt:b}},getCallExpression:function(a){return this.getWS(),{type:"call",expr:a,args:this.getItemList(this.getExpression,")")}},getPrimaryExpression:function(){var a=this._source[this._index];switch(a){case"$":return++this._index,{type:"var",name:this.getIdentifier()};case"@":return++this._index,{type:"glob",name:this.getIdentifier()};default:return{type:"id",name:this.getIdentifier()}}},getItemList:function(a,b){var c=[],d=!1;for(this.getWS(),this._source[this._index]===b&&(++this._index,d=!0);!d;){c.push(a.call(this)),this.getWS();var e=this._source.charAt(this._index);switch(e){case",":++this._index,this.getWS();break;case b:++this._index,d=!0;break;default:throw this.error('Expected "," or "'+b+'"')}}return c},getJunkEntry:function(){var a=this._index,b=this._source.indexOf("<",a),c=this._source.indexOf("/*",a);-1===b&&(b=this._length),-1===c&&(c=this._length);var d=Math.min(b,c);this._index=d},error:function(a){var b=arguments.length<=1||void 0===arguments[1]?"parsererror":arguments[1],c=this._index,d=this._source.lastIndexOf("<",c-1),f=this._source.lastIndexOf(">",c-1);d=f>d?f+1:d;var g=this._source.slice(d,c+10),h=a+" at pos "+c+": `"+g+"`",i=new e(h);return this.emit&&this.emit(b,i),i}},ha=100,ia={patterns:null,entryIds:null,emit:null,init:function(){this.patterns={comment:/^\s*#|^\s*$/,entity:/^([^=\s]+)\s*=\s*(.*)$/,multiline:/[^\\]\\$/,index:/\{\[\s*(\w+)(?:\(([^\)]*)\))?\s*\]\}/i,unicode:/\\u([0-9a-fA-F]{1,4})/g,entries:/[^\r\n]+/g,controlChars:/\\([\\\n\r\t\b\f\{\}\"\'])/g,placeables:/\{\{\s*([^\s]*?)\s*\}\}/}},parse:function(a,b){this.patterns||this.init(),this.emit=a;var c={},d=b.match(this.patterns.entries);if(!d)return c;for(var e=0;e<d.length;e++){var f=d[e];if(!this.patterns.comment.test(f)){for(;this.patterns.multiline.test(f)&&e<d.length;)f=f.slice(0,-1)+d[++e].trim();var g=f.match(this.patterns.entity);if(g)try{this.parseEntity(g[1],g[2],c)}catch(h){if(!this.emit)throw h}}}return c},parseEntity:function(a,b,c){var d,e,f=a.indexOf("[");-1!==f?(d=a.substr(0,f),e=a.substring(f+1,a.length-1)):(d=a,e=null);var g=d.split(".");if(g.length>2)throw this.error('Error in ID: "'+d+'". Nested attributes are not supported.');var h;if(g.length>1){if(d=g[0],h=g[1],"$"===h[0])throw this.error('Attribute can\'t start with "$"')}else h=null;this.setEntityValue(d,h,e,this.unescapeString(b),c)},setEntityValue:function(a,b,c,d,e){var f=d.indexOf("{{")>-1?this.parseString(d):d,g="string"==typeof f,h=e,i="string"==typeof e[a];if(e[a]||!b&&!c&&g||(e[a]=Object.create(null),i=!1),b){if(i){var j=e[a];e[a]=Object.create(null),e[a].value=j}e[a].attrs||(e[a].attrs=Object.create(null)),e[a].attrs||g||(e[a].attrs[b]=Object.create(null)),h=e[a].attrs,a=b}if(c){if(i=!1,"string"==typeof h[a]){var j=h[a];h[a]=Object.create(null),h[a].index=this.parseIndex(j),h[a].value=Object.create(null)}h=h[a].value,a=c,g=!0}if(!g||e[a]&&!i)h[a]||(h[a]=Object.create(null)),h[a].value=f;else{if(a in h)throw this.error();h[a]=f}},parseString:function(a){var b=a.split(this.patterns.placeables),c=[],d=b.length,e=(d-1)/2;if(e>=ha)throw this.error("Too many placeables ("+e+", max allowed is "+ha+")");for(var f=0;f<b.length;f++)0!==b[f].length&&(f%2===1?c.push({type:"idOrVar",name:b[f]}):c.push(b[f]));return c},unescapeString:function(a){return-1!==a.lastIndexOf("\\")&&(a=a.replace(this.patterns.controlChars,"$1")),a.replace(this.patterns.unicode,function(a,b){return String.fromCodePoint(parseInt(b,16))})},parseIndex:function(a){var b=a.match(this.patterns.index);if(!b)throw new e("Malformed index");return b[2]?[{type:"call",expr:{type:"prop",expr:{type:"glob",name:"cldr"},prop:"plural",cmpt:!1},args:[{type:"idOrVar",name:b[2]}]}]:[{type:"idOrVar",name:b[1]}]},error:function(a){var b=arguments.length<=1||void 0===arguments[1]?"parsererror":arguments[1],c=new e(a);return this.emit&&this.emit(b,c),c}},ja=["plural"],ka=2500,la="⁨",ma="⁩",na=new WeakSet,oa={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3},pa={0:function(){return"other"},1:function(a){return o(a%100,3,10)?"few":0===a?"zero":o(a%100,11,99)?"many":2===a?"two":1===a?"one":"other"},2:function(a){return 0!==a&&a%10===0?"many":2===a?"two":1===a?"one":"other"},3:function(a){return 1===a?"one":"other"},4:function(a){return o(a,0,1)?"one":"other"},5:function(a){return o(a,0,2)&&2!==a?"one":"other"},6:function(a){return 0===a?"zero":a%10===1&&a%100!==11?"one":"other"},7:function(a){return 2===a?"two":1===a?"one":"other"},8:function(a){return o(a,3,6)?"few":o(a,7,10)?"many":2===a?"two":1===a?"one":"other"},9:function(a){return 0===a||1!==a&&o(a%100,1,19)?"few":1===a?"one":"other"},10:function(a){return o(a%10,2,9)&&!o(a%100,11,19)?"few":a%10!==1||o(a%100,11,19)?"other":"one"},11:function(a){return o(a%10,2,4)&&!o(a%100,12,14)?"few":a%10===0||o(a%10,5,9)||o(a%100,11,14)?"many":a%10===1&&a%100!==11?"one":"other"},12:function(a){return o(a,2,4)?"few":1===a?"one":"other"},13:function(a){return o(a%10,2,4)&&!o(a%100,12,14)?"few":1!==a&&o(a%10,0,1)||o(a%10,5,9)||o(a%100,12,14)?"many":1===a?"one":"other"},14:function(a){return o(a%100,3,4)?"few":a%100===2?"two":a%100===1?"one":"other"},15:function(a){return 0===a||o(a%100,2,10)?"few":o(a%100,11,19)?"many":1===a?"one":"other"},16:function(a){return a%10===1&&11!==a?"one":"other"},17:function(a){return 3===a?"few":0===a?"zero":6===a?"many":2===a?"two":1===a?"one":"other"},18:function(a){return 0===a?"zero":o(a,0,2)&&0!==a&&2!==a?"one":"other"},19:function(a){return o(a,2,10)?"few":o(a,0,1)?"one":"other"},20:function(a){return!o(a%10,3,4)&&a%10!==9||o(a%100,10,19)||o(a%100,70,79)||o(a%100,90,99)?a%1e6===0&&0!==a?"many":a%10!==2||n(a%100,[12,72,92])?a%10!==1||n(a%100,[11,71,91])?"other":"one":"two":"few"},21:function(a){return 0===a?"zero":1===a?"one":"other"},22:function(a){return o(a,0,1)||o(a,11,99)?"one":"other"},23:function(a){return o(a%10,1,2)||a%20===0?"one":"other"},24:function(a){return o(a,3,10)||o(a,13,19)?"few":n(a,[2,12])?"two":n(a,[1,11])?"one":"other"}},qa=function(){function a(b){_classCallCheck(this,a),this._env=b,this._numberFormatters=null}return a.prototype._formatTuple=function(a,b,c,d,e){try{return h(this,a,b,c)}catch(f){return f.id=e?d+"::"+e:d,f.lang=a,this._env.emit("resolveerror",f,this),[{error:f},f.id]}},a.prototype._formatEntity=function(a,b,c,d){var e=this._formatTuple(a,b,c,d),f=e[1],g={value:f,attrs:null};if(c.attrs){g.attrs=Object.create(null);for(var h in c.attrs){var i=this._formatTuple(a,b,c.attrs[h],d,h),j=i[1];g.attrs[h]=j}}return g},a.prototype._formatValue=function(a,b,c,d){return this._formatTuple(a,b,c,d)[1]},a.prototype.fetch=function(a){if(0===a.length)return Promise.resolve(a);var b=Array.from(this._env._resLists.get(this));return Promise.all(b.map(this._env._getResource.bind(this._env,a[0]))).then(function(){return a})},a.prototype._resolve=function(a,b,c,d){var f=this,g=a[0];if(!g)return q.call(this,b,c,d);var h=!1,i=b.map(function(a,b){if(d&&void 0!==d[b])return d[b];var i=Array.isArray(a)?a:[a,void 0],j=i[0],k=i[1],l=f._getEntity(g,j);return l?c.call(f,g,k,l,j):(f._env.emit("notfounderror",new e('"'+j+'" not found in '+g.code,j,g),f),void(h=!0))});return h?this.fetch(a.slice(1)).then(function(a){return f._resolve(a,b,c,i)}):i},a.prototype.resolveEntities=function(a,b){var c=this;return this.fetch(a).then(function(a){return c._resolve(a,b,c._formatEntity)})},a.prototype.resolveValues=function(a,b){var c=this;return this.fetch(a).then(function(a){return c._resolve(a,b,c._formatValue)})},a.prototype._getEntity=function(a,b){for(var c=this._env._resCache,d=Array.from(this._env._resLists.get(this)),f=0,g=void 0;g=d[f];f++){var h=c.get(g+a.code+a.src);if(!(h instanceof e)&&b in h)return h[b]}return void 0},a.prototype._getNumberFormatter=function(a){if(this._numberFormatters||(this._numberFormatters=new Map),!this._numberFormatters.has(a)){var b=Intl.NumberFormat(a,{useGrouping:!1});return this._numberFormatters.set(a,b),b}return this._numberFormatters.get(a)},a.prototype._getMacro=function(a,b){switch(b){case"plural":return p(a.code);default:return void 0}},a}(),ra=Object.defineProperties(Object.create(null),{"fr-x-psaccent":{enumerable:!0,get:t("fr-x-psaccent","Runtime Accented")},"ar-x-psbidi":{enumerable:!0,get:t("ar-x-psbidi","Runtime Bidi")}}),sa={properties:ia,l20n:ga},ta=function(){function d(e,f){_classCallCheck(this,d),this.defaultLang=e,this.fetchResource=f,this._resLists=new Map,this._resCache=new Map;var g={};this.emit=a.bind(this,g),this.addEventListener=b.bind(this,g),this.removeEventListener=c.bind(this,g)}return d.prototype.createContext=function(a){var b=new qa(this);return this._resLists.set(b,new Set(a)),b},d.prototype.destroyContext=function(a){var b=this,c=this._resLists,d=c.get(a);c.delete(a),d.forEach(function(a){return u(b._resCache,c,a)})},d.prototype._parse=function(a,b,c){var d=this,e=sa[a];if(!e)return c;var f=function(a,c){return d.emit(a,v(b,c))};return e.parse.call(e,f,c)},d.prototype._create=function(a,b){if("pseudo"!==a.src)return b;var c=Object.create(null);for(var d in b)c[d]=r(b[d],ra[a.code].process);return c},d.prototype._getResource=function(a,b){var c=this,d=this._resCache,e=b+a.code+a.src;if(d.has(e))return d.get(e);var f=b.substr(b.lastIndexOf(".")+1),g=function(b){var g=c._parse(f,a,b);d.set(e,c._create(a,g))},h=function(b){b.lang=a,c.emit("fetcherror",b),d.set(e,b)},i="pseudo"===a.src?{code:this.defaultLang,src:"app"}:a,j=this.fetchResource(b,i).then(g,h);return d.set(e,j),j},d}();"function"!=typeof NodeList||NodeList.prototype[Symbol.iterator]||(NodeList.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);var ua=function(){function a(b,c,d){var e=this;_classCallCheck(this,a),this.fetchResource=b,this.broadcast=c,this.ctxs=new Map,this.interactive=w().then(function(){return e.init(d)})}return a.prototype.init=function(a){var b=this,c=z(document.head);return this.defaultLanguage=c.defaultLang,this.availableLanguages=c.availableLangs,this.appVersion=c.appVersion,this.env=new ta(this.defaultLanguage,function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return b.fetchResource.apply(b,[b.appVersion].concat(c))}),this.requestLanguages(a)},a.prototype.registerView=function(a,b){var c=this;return this.interactive.then(function(){return c.ctxs.set(a,c.env.createContext(b)),!0})},a.prototype.unregisterView=function(a){return this.ctxs.delete(a)},a.prototype.resolveEntities=function(a,b,c){return this.ctxs.get(a).resolveEntities(b,c)},a.prototype.formatValues=function(a,b){var c=this;return this.languages.then(function(d){return c.ctxs.get(a).resolveValues(d,b)})},a.prototype.resolvedLanguages=function(){return this.languages},a.prototype.requestLanguages=function(a){return H.call(this,G(),a)},a.prototype.getName=function(a){return ra[a].name},a.prototype.processString=function(a,b){return ra[a].process(b)},a.prototype.handleEvent=function(a){return H.call(this,a.detail||G(),navigator.languages)},a}(),va=/<|&#?\w+;/,wa={elements:["a","em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","ruby","rt","rp","bdi","bdo","span","br","wbr"],attributes:{global:["title","aria-label","aria-valuetext","aria-moz-hint"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]}},xa=/[&<>]/g,ya={"&":"&amp;","<":"&lt;",">":"&gt;"},za={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:["data-l10n-id","data-l10n-args"]},Aa=new WeakMap,Ba=function(){function a(b,c){var d=this;_classCallCheck(this,a),this._doc=c,this.pseudo={"fr-x-psaccent":Y(this,"fr-x-psaccent"),"ar-x-psbidi":Y(this,"ar-x-psbidi")},this._interactive=w().then(function(){return Z(d,b)});var e=new MutationObserver($.bind(this));this._observe=function(){return e.observe(c,za)},this._disconnect=function(){return e.disconnect()};var f=function(a){return _(d,a)};b.on("translateDocument",f),this.ready=this._interactive.then(function(a){return a.method("resolvedLanguages")}).then(f)}return a.prototype.requestLanguages=function(a,b){return this._interactive.then(function(c){return c.method("requestLanguages",a,b)})},a.prototype._resolveEntities=function(a,b){return this._interactive.then(function(c){return c.method("resolveEntities",c.id,a,b)})},a.prototype.formatValue=function(a,b){return this._interactive.then(function(c){return c.method("formatValues",c.id,[[a,b]])}).then(function(a){return a[0]})},a.prototype.formatValues=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];return this._interactive.then(function(a){return a.method("formatValues",a.id,b)})},a.prototype.translateFragment=function(a){var b=this;return this._interactive.then(function(a){return a.method("resolvedLanguages")}).then(function(c){return U(b,c,a)})},a}();Ba.prototype.setAttributes=Q,Ba.prototype.getAttributes=R;var Ca=new ua(g,d,navigator.languages);window.addEventListener("languagechange",Ca),document.addEventListener("additionallanguageschange",Ca),document.l10n=new Ba(new da(Ca),document)}();