(function(b){var a=function(c,h){var f;var d;var g;var i=function(){b.fn.extend({getPath:function(){var w,x,o=this;while(o.length){var p=o[0];var k=p.localName||p.nodeName.toLowerCase();var q=p.className;if(q&&typeof q!=="string"){q=""}if(q){q=q.replace(/\s{2,}/g," ");q=q.trim()}if(!k){break}k=k.toLowerCase();if(k=="html"){break}if(k=="body"){break}if(k=="#document"){break}if(q&&k=="body"){var v=q.split(" ");v=v.filter(function(z,y){if(z.match(/visualstyles_active|visualstyles_padded|com_|view-|layout-|-layout|task-|-task|itemid-/g)){return false}else{return true}});if(v.length){k+="."+v.join(".")}}else{if(q){var v=q.split(" ");v=v.filter(function(z,y){if(z.match(/vs-highlight/g)||z.match(/vs-pre-highlight/g)||b.isNumeric(z)||z.match(/(\[|\]|\.|\:|\,|\=)/g)){return false}else{return true}});if(v.length){k+="."+v.join(".")}}}var u=o.parent();var l=k.replace(/(@)/g,"\\$1");var s=u.children(l);if(s.length>1){var n=u.children();var r=n.index(p)+1;if(r>=1){k+=":nth-child("+r+")"}}w='<span class="vs-label-badge-primary vs-xs-small">'+k+"</span>"+(w?'<span class="vs-label-badge-default">></span>'+w:"");x=k+(x?">"+x:"");o=u}var t=b("#vs_state").val();if(t){x+=":"+t;w+='<span class="vs-label-badge-warning vs-xs-small">:'+t+"</span>"}var m={selector:x,html:w};return m}})};var e=function(){var k=b.Deferred(function(l){b.ajax({type:"POST",url:jrealtimeBaseURI+"index.php?option=com_jrealtimeanalytics&task=stream.saveEntity&format=json",dataType:"json",context:this,async:true,data:{resource:"heatmapclick",clicked_element:d,nowpage:b(location).attr("href")}}).done(function(m,o,n){if(m.storing&&m.storing.length){l.reject(m,o);return false}l.resolve(m)}).fail(function(n,p,o){var m=p[0].toUpperCase()+p.slice(1);l.reject("-"+m+"- "+o)})}).promise();k.then(function(l){if(!!parseInt(c.enable_debug)){console.log(l)}},function(l,m){b.each(l.storing,function(n,o){h.showDebugMsgs(o.corefile,o.details)})})};this.startListening=function(){b("body").on("click.jrealtimeEvents",function(l){f=l.target;var n=b(f).width();if(n>c.heatmap_max_valid_width){return}var m=b(f).height();if(m>c.heatmap_max_valid_height){return}if(c.heatmap_css_selectors_exclusion&&c.heatmap_css_selectors_exclusion.trim()!==""&&b(f).closest(c.heatmap_css_selectors_exclusion).length>0){return}g=b(f).getPath();d=g.selector;var k=parseInt(c.heatmap_timeout)||200;setTimeout(function(){e()},k)})};(function j(){i()}).call(this)};window.JRealtimeHeatmap=a;new a()})(jQuery);