React.LS=function(){var Lang=function(defaultLangfile,defaultLang){var self=this;if(defaultLangfile){if(defaultLang){self.dLang=defaultLang;self.dLangFile=defaultLangfile}else{self.dLang=defaultLangfile;self.dLangFile=null}if(self.get_setting("lang",self.dLang)!=self.dLang){self.set_load_lang(self.get_setting("lang",defaultLang),self.get_setting("langfile",defaultLangfile))}}};Lang.prototype.dLangFile="";Lang.prototype.dLang="";Lang.prototype.pack=[];Lang.prototype.loadedfiles=[];Array.prototype.contains=function(obj){var i=this.length;while(i--){if(this[i]===obj){return true}}return false};Lang.prototype.ready=function(fn){if(document.readyState!="loading"){fn()}else{document.addEventListener("DOMContentLoaded",fn)}};Lang.prototype.currentLang=function(){var self=this;return self.get_setting("lang",self.dLang)};Lang.prototype.loadLangPack=function(callback,myLangFile){var self=this;if(!self.loadedfiles.contains(myLangFile)){self.loadJSON(function(response){var result=JSON.parse(response);if(self.pack){for(var i=0;i-1){clearTimeout(this.state.closePopupTimeout);this.state.closePopupTimeout=-1}}},_onLanguageSelected:function(lang,evt){evt.stopPropagation();this._processEvent({id:"clearClosePopupTimeout"});this._processEvent({id:"onPopupClosing"});this.setState({selectedLang:lang,popupOpened:false});this._processEvent({id:"onPopupClosed"});this._processEvent({id:"onLanguageChanged",selectedLang:lang});return false},_onClick:function(evt){evt.stopPropagation();if(this.state.popupOpened){this._processEvent({id:"onPopupClosing"});this.setState({popupOpened:false});this._processEvent({id:"onPopupClosed"})}else{this._processEvent({id:"onPopupOpening"});this.setState({popupOpened:true});this._processEvent({id:"onPopupOpened"})}return false},_onHover:function(enter,evt){var _this=this;var hoverTimeoutProp=this.props.hoverTimeout;evt.stopPropagation();if(enter){this._processEvent({id:"clearClosePopupTimeout"});if(!this.state.popupOpened){this._processEvent({id:"onPopupOpening"});this.setState({popupOpened:true});this._processEvent({id:"onPopupOpened"})}}else{if(this.state.closePopupTimeout<0){this.state.closePopupTimeout=setTimeout(function(){_this._processEvent({id:"onPopupClosing"});_this.setState({popupOpened:false});_this._processEvent({id:"onPopupClosed"})},hoverTimeoutProp)}}return false},render:function(){var _this=this;var itemsProp=this.props.items;var openMode=this.props.openMode;var gridColumnsProp=this.props.gridColumns;var showFlagsProp=this.props.showFlag;var langPerColumn=Math.round(itemsProp.length/gridColumnsProp);var selectedLang=this.state.selectedLang;var popupOpened=this.state.popupOpened;var liElements=[];var getTableColumns=function(){var myStyles={};myStyles.cursor="pointer";var tableColumns=[];for(var i=0;i0){tableColumns.push(liElements);liElements=[]}return tableColumns};var getSelectedLanguage=function(){var myStyles={};myStyles.cursor="pointer";var flagEl="";var caretEl="";caretEl=React.createElement("span",{className:"caret"});if(showFlagsProp){flagEl=React.createElement("img",{src:selectedLang.flagImg,alt:selectedLang.flagTitle})}if(openMode==="hover"){return React.createElement("a",{className:"rlsui-selected-locale dropdown-toggle",onMouseEnter:_this._onHover.bind(_this,true),onMouseLeave:_this._onHover.bind(_this,false),style:myStyles,id:"drop_rls","data-toggle":"dropdown","data-trigger":"mouseover","aria-haspopup":"true",role:"button","aria-expanded":"false"},flagEl," ",selectedLang.name,caretEl)}else{return React.createElement("a",{className:"rlsui-selected-locale dropdown-toggle",onClick:_this._onClick,style:myStyles,id:"drop_rls","data-toggle":"dropdown","data-trigger":"mouseover","aria-haspopup":"true",role:"button","aria-expanded":"false"},flagEl," ",selectedLang.name,caretEl)}};var getPopup=function(){var popupStyles={};if(!popupOpened){popupStyles.display="none"}if(openMode==="hover"){return React.createElement("ul",{className:"rlsui-language-container-scrollable dropdown-menu",onMouseEnter:_this._onHover.bind(_this,true),onMouseLeave:_this._onHover.bind(_this,false),"aria-labelledby":"drop_rls",role:"menu"},getTableColumns())}else{return React.createElement("ul",{className:"rlsui-language-container-scrollable dropdown-menu","aria-labelledby":"drop_rls",role:"menu"},getTableColumns())}};if(popupOpened){return React.createElement("li",{className:"react-language-selector-ui dropdown open"},getSelectedLanguage()," ",getPopup())}else{return React.createElement("li",{className:"react-language-selector-ui dropdown"},getSelectedLanguage()," ",getPopup())}}});return Lang}();