!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Stone=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function d(){if(g){var a=document.getElementsByTagName("*"),b=null,c=null,d=0,e=0;for(d=0;d<a.length;d++)if(a[d].hasAttribute("stonejs")){for(a[d].hasAttribute("stonejs-orig-string")||a[d].setAttribute("stonejs-orig-string",a[d].innerHTML),b={},c=a[d].attributes,e=0;e<c.length;e++)0===c[e].name.indexOf("stonejs-param-")&&(b[c[e].name.substr(14)]=c[e].value);a[d].innerHTML=f(a[d].getAttribute("stonejs-orig-string"),b)}}}function e(a){g=Boolean(a),d()}var f=a("./gettext.js").gettext,g=!1;b.exports={enableDomScan:e,updateDomTranslation:d}},{"./gettext.js":2}],2:[function(a,b,c){"use strict";function d(a,b,c){var d=a;"string"==typeof b&&(c=b,b=void 0);var e=c||o;if(e&&n[e]&&n[e].messages&&n[e].messages[a]&&n[e].messages[a].length>0&&""!==n[e].messages[a][0]&&(d=n[e].messages[a][0]),b)for(var f in b)d=d.replace(new RegExp("{"+f+"}","g"),b[f]);return d}function e(a,b,c){this.toString=d.bind(this,a,b,c);for(var e=Object.getOwnPropertyNames(String.prototype),f=0;f<e.length;f++)"toString"!=e[f]&&("function"==typeof String.prototype[e[f]]?this[e[f]]=function(){var a=this.self.toString();return a[this.prop].apply(a,arguments)}.bind({self:this,prop:e[f]}):Object.defineProperty(this,e[f],{get:function(){return this.self.toString()[this.prop]}.bind({self:this,prop:e[f]}),enumerable:!1,configurable:!1}))}function f(a,b,c){return new e(a,b,c)}function g(){for(var a in n)delete n[a]}function h(){return Object.keys(n)}function i(a){for(var b in a)if(n[b]){n[b]["plural-forms"]=a[b]["plural-forms"];for(var c in a[b].messages)n[b].messages[c]=a[b].messages[c]}else n[b]=a[b]}function j(){return o}function k(a){o=a}function l(a){a||(a=m.extractLanguages());var b=Object.keys(n);k(m.findBestMatchingLocale(a,b))}var m=a("./helpers.js"),n={},o=null;b.exports={catalogs:n,LazyString:e,gettext:d,lazyGettext:f,clearCatalogs:g,addCatalogs:i,listCatalogs:h,getLocale:j,setLocale:k,setBestMatchingLocale:l}},{"./helpers.js":3}],3:[function(a,b,c){"use strict";function d(a,b){b=b||{};var c=null;try{c=new Event(a)}catch(b){c=document.createEvent("Event"),c.initEvent(a,!0,!1)}for(var d in b)c[d]=b[d];document.dispatchEvent(c)}function e(a){a=a.toLowerCase().replace(/-/g,"_");var b={lang:null,lect:null,q:1},c="";return a.indexOf(";")>-1?(c=a.split(";"),2==c.length&&c[1].match(/^q=(1|0\.[0-9]+)$/)&&(b.q=parseFloat(c[1].split("=")[1])),c=c[0]||""):c=a,c.indexOf("_")>-1?(c=c.split("_"),2==c.length?2==c[0].length&&(b.lang=c[0],2==c[1].length&&(b.lect=c[1])):2==c[0].length&&(b=c[0])):2==c.length&&(b.lang=c),b}function f(a){if(void 0===a&&(a=navigator.language||navigator.userLanguage||navigator.systemLanguage||navigator.browserLanguage),!a||""===a)return["en"];for(var b,c,d=[],f=a.split(","),g=0;g<f.length;g++)c=e(f[g]),c.lang&&d.push(c);if(0===d.length)return["en"];d=d.sort(function(a,b){return b.q-a.q});var h=[];for(g=0;g<d.length;g++)b=d[g].lang,d[g].lect&&(b+="_",b+=d[g].lect.toUpperCase()),h.push(b);return h}function g(a,b){function c(a,b,c){if(null===a)return null;for(var d=0;d<c.length;d++){if("*"==b&&c[d].lang===a)return c[d];if(c[d].lang===a&&c[d].lect===b)return c[d]}}Array.isArray(a)||(a=[a]);for(var d,f=[],g=0;g<b.length;g++)d=e(b[g]),d.cat=b[g],f.push(d);var h=[];for(g=0;g<a.length;g++)h.push(e(a[g]));var i=null,j=0;for(g=0;g<h.length&&(d=c(h[g].lang,h[g].lect,f),d&&!i?(i=d,j=g):d&&i&&d.lang===i.lang&&null===i.lect&&null!==d.lect&&(i=d,j=g),!(i&&i.lang&&i.lect));g++);for(g=0;g<h.length;g++)if((d=c(h[g].lang,null,f))&&(!i||i&&j>=g&&i.lang!==d.lang))return d.cat;for(g=0;g<h.length;g++)if((d=c(h[g].lang,h[g].lang,f))&&(!i||i&&j>=g&&i.lang!==d.lang))return d.cat;if(i)return i.cat;for(g=0;g<h.length;g++)if(d=c(h[g].lang,"*",f))return d.cat;for(g=0;g<a.length;g++)if(b.indexOf(a[g])>=0)return a[g];return"c"}b.exports={sendEvent:d,parseLanguageCode:e,extractLanguages:f,findBestMatchingLocale:g}},{}],4:[function(a,b,c){"use strict";function d(){return g.extractLanguages()[0]}function e(a){h.setLocale(a),i.updateDomTranslation(),g.sendEvent("stonejs-locale-changed")}function f(a){h.addCatalogs(a.catalog)}var g=a("./helpers.js"),h=a("./gettext.js"),i=a("./dom.js");document.addEventListener("stonejs-autoload-catalogs",f,!0),b.exports={LazyString:h.LazyString,gettext:h.gettext,lazyGettext:h.lazyGettext,clearCatalogs:h.clearCatalogs,addCatalogs:h.addCatalogs,getLocale:h.getLocale,setLocale:e,listCatalogs:h.listCatalogs,setBestMatchingLocale:h.setBestMatchingLocale,findBestMatchingLocale:g.findBestMatchingLocale,guessUserLanguage:d,enableDomScan:i.enableDomScan,updateDomTranslation:i.updateDomTranslation}},{"./dom.js":1,"./gettext.js":2,"./helpers.js":3}]},{},[4])(4)});