(function(b){var a=function(e){var i=b("input[data-role=filter]");var g=b("button[data-role=reset-filter]");function c(k){var m=b(this).parents("div.accordion-group").find("table.adminlist");var l=b(this).val().toLowerCase();var n=0;b("tbody tr",m).each(function(o,q){var p=b(q).text().toLowerCase();var p=b("td",q).filter(function(){return b(this).attr("data-nofilter")?false:true}).text().toLowerCase();if(!p){return true}if(p.indexOf(l)>=0){b(q).show();n++}else{b(q).hide()}b("span.event_occurences").text(n)});b(this).nextAll("span[data-role=badge-occurrences]").remove();if(l){var j=n>0?"bg-success":"bg-danger";b(this).nextAll("button.btn").after('<span data-role="badge-occurrences" class="badge '+j+' badge-occurrences">'+COM_JREALTIME_NUMRESULTS+n+"</span>")}return false}var f=function(){b('input[name="params\\[viewtype\\]"]').on("change",function(j){var k=b(this).val();b("*[data-switcher=1]").attr("disabled",true);b("#"+k).attr("disabled",false);b("*[data-switcher=1]").removeAttr("data-validation");var m=b("#"+k).attr("data-url");var l="";if(m){l=" url"}b("#"+k).attr("data-validation","required"+l)});b("#type").on("change",function(j){d("details");setTimeout(function(){Joomla.submitform("eventstats.changeEntity")},100)})};var d=function(l){var j=b("#"+l);var k=j.width()/2;b(j).prepend("<img/>").children("img").attr("src",jrealtimeBaseURI+"administrator/components/com_jrealtimeanalytics/images/loading.gif").css({position:"absolute",margin:"50px "+parseInt(k-64)+"px",width:"128px","z-index":"99999"})};(function h(){if(b('input[name="params\\[viewtype\\]"]').length){b('input[name="params\\[viewtype\\]"]').each(function(k,l){if(!b(l).prop("checked")){var m=b(l).val();b("#"+m).attr("disabled",true);b("#"+m).removeAttr("data-validation")}else{var j=b(l).val();var o=b("#"+j).attr("data-url");var n="";if(o){n=" url"}b("#"+j).attr("data-validation","required"+n)}})}i.on("click",function(){return false}).on("keyup",c);g.on("click",function(j){b(this).prevAll("input").val("").trigger("keyup");return false});f.call(this)}).call(this)};b(function(){window.JRealtimeEventstats=new a()})})(jQuery);