(function(b){function I(){if(y){var a={name:y,segment:ma};b.add_event({key:"[CLY]_view",dur:n()-A,segmentation:a});y=null}}function p(a){if(!b.ignore_visitor)if(!b.app_key||!b.device_id)i("app_key or device_id is missing");else{a.app_key=b.app_key;a.device_id=b.device_id;a.sdk_name=na;a.sdk_version=oa;b.country_code&&(a.country_code=b.country_code);b.city&&(a.city=b.city);null!==b.ip_address&&(a.ip_address=b.ip_address);a.timestamp=J();var c=new Date;a.hour=c.getHours();a.dow=c.getDay();q.length>
K&&q.shift();q.push(a);h("cly_queue",q,!0)}}function L(){if(!b.ignore_visitor){var a=0;if("undefined"!==typeof b.onload&&0<b.onload.length){for(a=0;a<b.onload.length;a++)if("function"===typeof b.onload[a])b.onload[a]();b.onload=[]}if("undefined"!==typeof b.q&&0<b.q.length){var c,f=b.q;b.q=[];for(a=0;a<f.length;a++)if(c=f[a],i("Processing queued call",c),"function"===typeof c)c();else if(c.constructor===Array&&0<c.length)if("undefined"!==typeof b[c[0]])b[c[0]].apply(null,c.slice(1));else{var e=c[0].replace("userData.",
"");"undefined"!==typeof b.userData[e]&&b.userData[e].apply(null,c.slice(1))}}w&&(M&&z)&&(a=n(),a-u>N&&(b.session_duration(a-u),u=a));0<r.length&&(r.length<=B?(p({events:JSON.stringify(r)}),r=[]):(a=r.splice(0,B),p({events:JSON.stringify(a)})),h("cly_event",r));0<q.length&&(O&&n()>V)&&(O=!1,a=q.shift(),i("Processing request",a),W(a,function(a,c){i("Request Finished",c,a);a&&(q.unshift(c),V=n()+P);h("cly_queue",q,!0);O=!0}));setTimeout(L,Q)}}function X(){return h("cly_id")||Y()}function Y(){var a=
(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var b=(a+16*Math.random())%16|0;a=Math.floor(a/16);return("x"==c?b:b&3|8).toString(16)})}function R(){var a={};a._app_version=b.app_version;a._ua=navigator.userAgent;if(screen.width){var c=screen.width?parseInt(screen.width):0,f=screen.height?parseInt(screen.height):0;if(0!==c&&0!==f){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)c=Math.round(c*window.devicePixelRatio),
f=Math.round(f*window.devicePixelRatio);else if(90===Math.abs(window.orientation))var e=c,c=f,f=e;a._resolution=""+c+"x"+f}}window.devicePixelRatio&&(a._density=window.devicePixelRatio);c=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;"undefined"!==typeof c&&(a._locale=c);if("undefined"!==typeof document.referrer&&document.referrer.length&&(c=Z.exec(document.referrer))&&c[11]&&c[11]!=window.location.hostname){c=!1;if(x&&x.length)for(f=0;f<x.length;f++)try{if(RegExp(x[f]).test(document.referrer)){i("Ignored:",
document.referrer);c=!0;break}}catch(g){}c||(a._store=document.referrer)}i("Got metrics",a);return a}function i(){b.debug&&"undefined"!==typeof console&&(arguments[1]&&"object"==typeof arguments[1]&&(arguments[1]=JSON.stringify(arguments[1])),console.log(Array.prototype.slice.call(arguments).join("\n")))}function n(){return Math.floor((new Date).getTime()/1E3)}function J(){var a=(new Date).getTime();C>=a?C++:C=a;return C}function D(a,c,b){if(a){var b=b||$,e="";"object"===typeof a?"undefined"!==typeof a.stack?
e=a.stack:("undefined"!==typeof a.name&&(e+=a.name+":"),"undefined"!==typeof a.message&&(e+=a.message+"\n"),"undefined"!==typeof a.fileName&&(e+="in "+a.fileName+"\n"),"undefined"!==typeof a.lineNumber&&(e+="on "+a.lineNumber),"undefined"!==typeof a.columnNumber&&(e+=":"+a.columnNumber)):e=a+"";c=c?!0:!1;a=R();e={_resolution:a._resolution,_error:e,_app_version:a._app_version,_run:n()-aa,_not_os_specific:!0};if(a=navigator.battery||navigator.webkitBattery||navigator.mozBattery||navigator.msBattery)e._bat=
Math.floor(100*a.level);"undefined"!==typeof navigator.onLine&&(e._online=navigator.onLine?!0:!1);e._background=document.hasFocus()?!1:!0;0<E.length&&(e._logs=E.join("\n"));E=[];e._nonfatal=c;e._view=(window.location.pathname||"")+(window.location.search||"")+(window.location.hash||"");"undefined"!==typeof b&&(e._custom=b);try{var g=document.createElement("canvas").getContext("experimental-webgl");e._opengl=g.getParameter(g.VERSION)}catch(d){}p({crash:JSON.stringify(e)})}}function W(a,c){try{i("Sending XML HTTP request");
var f=window.XMLHttpRequest?new window.XMLHttpRequest:window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null,e=ba(a),g="GET";2E3<=e.length?g="POST":b.force_post&&(g="POST");"GET"===g?f.open("GET",b.url+ca+"?"+e,!0):(f.open("POST",b.url+ca,!0),f.setRequestHeader("Content-type","application/x-www-form-urlencoded"));f.onreadystatechange=function(){4===this.readyState&&200<=this.status&&300>this.status?"function"===typeof c&&c(!1,a):4===this.readyState&&(i("Failed Server XML HTTP request",this.status),
"function"===typeof c&&c(!0,a))};"GET"==g?f.send():f.send(e)}catch(d){i("Failed XML HTTP request",d),"function"===typeof c&&c(!0,a)}}function ba(a){var c=[],b;for(b in a)c.push(b+"="+encodeURIComponent(a[b]));return c.join("&")}function da(a){return"/"==a.substr(a.length-1)?a.substr(0,a.length-1):a}function S(a,c){for(var b={},e,g=0;g<c.length;g++)e=c[g],"undefined"!==typeof a[e]&&(b[e]=a[e]);return b}function T(a){"undefined"==typeof a.pageY&&("number"==typeof a.clientX&&document.documentElement)&&
(a.pageX=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a.pageY=a.clientY+document.body.scrollTop+document.documentElement.scrollTop);return a}function ea(){var a=document;return Math.max(Math.max(a.body.scrollHeight,a.documentElement.scrollHeight),Math.max(a.body.offsetHeight,a.documentElement.offsetHeight),Math.max(a.body.clientHeight,a.documentElement.clientHeight))}function fa(){var a=document;return Math.max(Math.max(a.body.scrollWidth,a.documentElement.scrollWidth),Math.max(a.body.offsetWidth,
a.documentElement.offsetWidth),Math.max(a.body.clientWidth,a.documentElement.clientWidth))}function ga(a){h("cly_token",a)}function ha(a,c){var b=document.createElement("script"),e;b.setAttribute("type","text/javascript");b.setAttribute("src",a);c&&(b.onreadystatechange=b.onload=function(){e||c();e=!0});document.getElementsByTagName("head")[0].appendChild(b)}function ia(){var a=document.getElementById("cly-loader");if(!a){i("setting up loader");var a=document.head||document.getElementsByTagName("head")[0],
c=document.createElement("style");c.type="text/css";c.styleSheet?c.styleSheet.cssText="#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}":
c.appendChild(document.createTextNode("#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}"));
a.appendChild(c);a=document.createElement("div");a.setAttribute("id","cly-loader");document.body.appendChild(a)}a.style.display="block"}function ja(){var a=document.getElementById("cly-loader");a&&(a.style.display="none")}var oa="17.04",na="javascript_native_web",ka=!1,w=!1,ca="/i",Q=500,K=1E3,q=[],r=[],E=[],v={},x=[],$=null,M=!0,u,la=0,y=null,A=0,U=0,V=0,P=60,F=20,G=0,N=60,B=10,C=0,O=!0,ma,Z=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
pa=/(CountlySiteBot|nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO)/,z=!0,aa;b.init=function(a){if(!ka&&(aa=n(),ka=
!0,q=h("cly_queue")||[],v={},r=h("cly_event")||[],a=a||{},Q=a.interval||b.interval||Q,K=a.queue_size||b.queue_size||K,P=a.fail_timeout||b.fail_timeout||P,F=a.inactivity_time||b.inactivity_time||F,N=a.session_update||b.session_update||N,B=a.max_events||b.max_events||B,b.ignore_prefetch=a.ignore_prefetch||b.ignore_prefetch||!0,b.debug=a.debug||b.debug||!1,b.app_key=a.app_key||b.app_key||null,b.device_id=a.device_id||b.device_id||X(),b.url=da(a.url||b.url||""),b.app_version=a.app_version||b.app_version||
"0.0",b.country_code=a.country_code||b.country_code||null,b.city=a.city||b.city||null,b.ip_address=a.ip_address||b.ip_address||null,b.ignore_bots=a.ignore_bots||b.ignore_bots||!0,b.force_post=a.force_post||b.force_post||!1,b.q=b.q||[],b.onload=b.onload||[],b.ignore_visitor=a.ignore_visitor||b.ignore_visitor||!1,a.ignore_referrers&&a.ignore_referrers.constructor===Array?x=a.ignore_referrers:b.ignore_referrers&&b.ignore_referrers.constructor===Array&&(x=b.ignore_referrers),""===b.url&&(i("Please provide server URL"),
b.ignore_visitor=!0),b.ignore_prefetch&&("undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState)&&(b.ignore_visitor=!0),b.ignore_bots&&pa.test(navigator.userAgent)&&(b.ignore_visitor=!0),window.name&&0===window.name.indexOf("cly:")?b.passed_data=JSON.parse(window.name.replace("cly:","")):location.hash&&0===location.hash.indexOf("#cly:")&&(b.passed_data=JSON.parse(location.hash.replace("#cly:",""))),b.passed_data&&(b.passed_data.token&&b.passed_data.purpose)&&(b.passed_data.token!=
h("cly_old_token")&&(ga(b.passed_data.token),h("cly_old_token",b.passed_data.token)),"heatmap"===b.passed_data.purpose&&(b.ignore_visitor=!0,ia(),ha(b.url+"/views/heatmap.js",ja))),!b.ignore_visitor&&(i("Countly initialized"),b.onload.constructor!==Array&&(b.onload=[]),b.q.constructor!==Array&&(b.q=[]),L(),h("cly_id",b.device_id),location.search)))for(var a=location.search.substring(1).split("&"),c=0;c<a.length;c++){var f=a[c].split("=");"cly_id"==f[0]?h("cly_cmp_id",f[1]):"cly_uid"==f[0]&&h("cly_cmp_uid",
f[1])}};b.begin_session=function(a){w||(i("Session started"),u=n(),w=!0,M=a?!1:!0,a={begin_session:1},a.metrics=JSON.stringify(R()),p(a))};b.session_duration=function(a){w&&(i("Session extended",a),p({session_duration:a}))};b.end_session=function(a){w&&(a=a||n()-u,i("Ending session"),I(),w=!1,p({end_session:1,session_duration:a}))};b.change_id=function(a,c){if(b.device_id!=a){c||(b.end_session(),v={});var f=b.device_id;b.device_id=a;h("cly_id",b.device_id);i("Changing id");c?p({old_device_id:f}):
b.begin_session(!M)}};b.add_event=function(a){if(a.key){a.count||(a.count=1);var c=S(a,["key","count","sum","dur","segmentation"]);c.timestamp=J();var b=new Date;c.hour=b.getHours();c.dow=b.getDay();r.push(c);h("cly_event",r);i("Adding event: ",a)}else i("Event must have key property")};b.start_event=function(a){v[a]?i("Timed event with key "+a+" already started"):v[a]=n()};b.end_event=function(a){"string"==typeof a&&(a={key:a});a.key?v[a.key]?(a.dur=n()-v[a.key],b.add_event(a),delete v[a.key]):i("Timed event with key "+
a.key+" was not started"):i("Event must have key property")};b.user_details=function(a){i("Adding userdetails: ",a);p({user_details:JSON.stringify(S(a,"name username email organization phone picture gender byear custom".split(" ")))})};b.report_conversion=function(a,c){a=a||h("cly_cmp_id")||"cly_organic";c=c||h("cly_cmp_uid");a&&c?p({campaign_id:a,campaign_user:c}):a?p({campaign_id:a}):i("No campaign data found")};var s={},t=function(a,c,b){s[a]||(s[a]={});"$push"==b||"$pull"==b||"$addToSet"==b?(s[a][b]||
(s[a][b]=[]),s[a][b].push(c)):s[a][b]=c};b.userData={set:function(a,b){s[a]=b},set_once:function(a){t(a,1,"$setOnce")},increment:function(a){t(a,1,"$inc")},increment_by:function(a,b){t(a,b,"$inc")},multiply:function(a,b){t(a,b,"$mul")},max:function(a,b){t(a,b,"$max")},min:function(a,b){t(a,b,"$min")},push:function(a,b){t(a,b,"$push")},push_unique:function(a,b){t(a,b,"$addToSet")},pull:function(a,b){t(a,b,"$pull")},save:function(){p({user_details:JSON.stringify({custom:s})});s={}}};b.track_errors=
function(a){$=a;window.onerror=function(a,b,e,g,d){if("undefined"!==typeof d)D(d,!1);else{var g=g||window.event&&window.event.errorCharacter,j="";"undefined"!==typeof a&&(j+=a+"\n");"undefined"!==typeof b&&(j+="at "+b);"undefined"!==typeof e&&(j+=":"+e);"undefined"!==typeof g&&(j+=":"+g);j+="\n";try{for(var i=[],k=arguments.callee.caller;k;)i.push(k.name),k=k.caller;j+=i.join("\n")}catch(l){}D(j,!1)}}};b.log_error=function(a,b){D(a,!0,b)};b.add_log=function(a){E.push(a)};b.stop_time=function(){z&&
(z=!1,la=n()-u,U=n()-A)};b.start_time=function(){z||(z=!0,u=n()-la,A=n()-U,U=0)};b.track_sessions=function(){function a(){document[f]?b.stop_time():b.start_time()}function c(){G>=F&&b.start_time();G=0}b.begin_session();b.start_time();m(window,"beforeunload",function(){b.end_session()});m(window,"unload",function(){b.end_session()});var f="hidden";f in document?document.addEventListener("visibilitychange",a):(f="mozHidden")in document?document.addEventListener("mozvisibilitychange",a):(f="webkitHidden")in
document?document.addEventListener("webkitvisibilitychange",a):(f="msHidden")in document?document.addEventListener("msvisibilitychange",a):"onfocusin"in document?(m(window,"focusin",function(){b.start_time()}),m(window,"focusout",function(){b.stop_time()})):(m(window,"focus",function(){b.start_time()}),m(window,"blur",function(){b.stop_time()}),m(window,"pageshow",function(){b.start_time()}),m(window,"pagehide",function(){b.stop_time()}));m(window,"mousemove",c);m(window,"click",c);m(window,"keydown",
c);m(window,"scroll",c);setInterval(function(){G++;G>=F&&b.stop_time()},6E4)};b.track_pageview=function(a,c){I();a&&a.constructor===Array&&(c=a,a=null);a=a||window.location.pathname;if(c&&c.length)for(var f=0;f<c.length;f++)try{if(RegExp(c[f]).test(a)){i("Ignored:",a);return}}catch(e){}y=a;A=n();f={name:a,visit:1,domain:window.location.hostname};if("undefined"!==typeof document.referrer&&document.referrer.length){var g=Z.exec(document.referrer);g&&(g[11]&&g[11]!=window.location.hostname)&&(f.start=
1)}b.add_event({key:"[CLY]_view",segmentation:f})};b.track_view=function(a,c){b.track_pageview(a,c)};b.track_clicks=function(a){var a=a||document,c=!0;m(a,"click",function(a){if(c){c=!1;T(a);if("undefined"!==typeof a.pageX&&"undefined"!==typeof a.pageY){var e=ea(),g=fa();b.add_event({key:"[CLY]_action",segmentation:{type:"click",x:a.pageX,y:a.pageY,width:g,height:e,domain:window.location.hostname}})}setTimeout(function(){c=!0},1E3)}})};b.track_links=function(a){a=a||document;m(a,"click",function(a){var f=
H(a).closest("a");f&&(T(a),b.add_event({key:"linkClick",segmentation:{href:f.href,text:f.innerText,id:f.id,x:a.pageX,y:a.pageY}}),"undefined"!==typeof f.href&&"_blank"!==f.target&&!a.metaKey&&!a.altKey&&!a.ctrlKey&&!a.shiftKey&&0!==f.href.replace(window.location.href.split("#")[0],"").indexOf("#")&&b.end_session())})};b.track_forms=function(a){function c(a){return a.name||a.id||a.type||a.nodeName}a=a||document;m(a,"submit",function(a){var a=H(a),e={id:a.id,name:a.name,action:a.action,method:a.method},
g;if("undefined"!==typeof a.elements)for(var d=0;d<a.elements.length;d++)if((g=a.elements[d])&&"password"!=g.type)if("undefined"===typeof e["input:"+c(g)]&&(e["input:"+c(g)]=[]),"select"==g.nodeName.toLowerCase())if("undefined"!==typeof g.multiple){var j=[];if("undefined"!==typeof g.options)for(var i=0;i<g.options.length;i++)g.options[i].selected&&j.push(g.options[i].value);e["input:"+c(g)].push(j.join(", "))}else e["input:"+c(g)].push(g.options[g.selectedIndex].value);else"input"==g.nodeName.toLowerCase()?
"undefined"!==typeof g.type?"checkbox"==g.type.toLowerCase()||"radio"==g.type.toLowerCase()?g.checked&&e["input:"+c(g)].push(g.value):e["input:"+c(g)].push(g.value):e["input:"+c(g)].push(g.value):"textarea"==g.nodeName.toLowerCase()?e["input:"+c(g)].push(g.value):"undefined"!==typeof g.value&&e["input:"+c(g)].push(g.value);for(var k in e)"undefined"!=typeof e[k].join&&(e[k]=e[k].join(", "));b.add_event({key:"formSubmit",segmentation:e});b.end_session()})};b.collect_from_forms=function(a,c){a=a||document;
m(a,"submit",function(f){var f=H(f),e={},g=!1,d;if("undefined"!==typeof f.elements){var j={},h=a.getElementsByTagName("LABEL"),k;for(k=0;k<h.length;k++)h[k].htmlFor&&""!==h[k].htmlFor&&(j[h[k].htmlFor]=h[k].innerText||h[k].textContent||h[k].innerHTML);for(k=0;k<f.elements.length;k++)if((d=f.elements[k])&&"password"!=d.type&&-1==d.className.indexOf("cly_user_ignore")){var l="";if("select"==d.nodeName.toLowerCase())if("undefined"!==typeof d.multiple){l=[];if("undefined"!==typeof d.options)for(h=0;h<
d.options.length;h++)d.options[h].selected&&l.push(d.options[h].value);l=l.join(", ")}else l=d.options[d.selectedIndex].value;else"input"==d.nodeName.toLowerCase()?"undefined"!==typeof d.type?"checkbox"==d.type.toLowerCase()||"radio"==d.type.toLowerCase()?d.checked&&(l=d.value):l=d.value:l=d.value:"textarea"==d.nodeName.toLowerCase()?l=d.value:"undefined"!==typeof d.value&&(l=d.value);if(d.className&&-1!=d.className.indexOf("cly_user_")){d=d.className.split(" ");for(h=0;h<d.length;h++)if(0===d[h].indexOf("cly_user_")){e[d[h].replace("cly_user_",
"")]=l;g=!0;break}}else if(d.type&&"email"==d.type.toLowerCase()||d.name&&-1!=d.name.toLowerCase().indexOf("email")||d.id&&-1!=d.id.toLowerCase().indexOf("email")||d.id&&j[d.id]&&-1!=j[d.id].toLowerCase().indexOf("email")||/[^@\s]+@[^@\s]+\.[^@\s]+/.test(l))e.email||(e.email=l),g=!0;else if(d.name&&-1!=d.name.toLowerCase().indexOf("username")||d.id&&-1!=d.id.toLowerCase().indexOf("username")||d.id&&j[d.id]&&-1!=j[d.id].toLowerCase().indexOf("username"))e.username||(e.username=l),g=!0;else if(d.name&&
(-1!=d.name.toLowerCase().indexOf("tel")||-1!=d.name.toLowerCase().indexOf("phone")||-1!=d.name.toLowerCase().indexOf("number"))||d.id&&(-1!=d.id.toLowerCase().indexOf("tel")||-1!=d.id.toLowerCase().indexOf("phone")||-1!=d.id.toLowerCase().indexOf("number"))||d.id&&j[d.id]&&(-1!=j[d.id].toLowerCase().indexOf("tel")||-1!=j[d.id].toLowerCase().indexOf("phone")||-1!=j[d.id].toLowerCase().indexOf("number")))e.phone||(e.phone=l),g=!0;else if(d.name&&(-1!=d.name.toLowerCase().indexOf("org")||-1!=d.name.toLowerCase().indexOf("company"))||
d.id&&(-1!=d.id.toLowerCase().indexOf("org")||-1!=d.id.toLowerCase().indexOf("company"))||d.id&&j[d.id]&&(-1!=j[d.id].toLowerCase().indexOf("org")||-1!=j[d.id].toLowerCase().indexOf("company")))e.organization||(e.organization=l),g=!0;else if(d.name&&-1!=d.name.toLowerCase().indexOf("name")||d.id&&-1!=d.id.toLowerCase().indexOf("name")||d.id&&j[d.id]&&-1!=j[d.id].toLowerCase().indexOf("name"))e.name||(e.name=""),e.name+=l+" ",g=!0}}g&&(i("Gathered user data",e),c?b.user_details({custom:e}):b.user_details(e));
b.end_session()})};b.collect_from_facebook=function(a){FB&&FB.api&&FB.api("/me",function(c){var f={};c.name&&(f.name=c.name);c.email&&(f.email=c.email);"male"==c.gender?f.gender="M":"female"==c.gender&&(f.gender="F");if(c.birthday){var e=c.birthday.split("/").pop();e&&4==e.length&&(f.byear=e)}c.work&&(c.work[0]&&c.work[0].employer&&c.work[0].employer.name)&&(f.organization=c.work[0].employer.name);if(a){f.custom={};for(var g in a){for(var e=a[g].split("."),d=c,h=0;h<e.length&&!(d=d[e[h]],"undefined"===
typeof d);h++);"undefined"!==typeof d&&(f.custom[g]=d)}}b.user_details(f)})};Element.prototype.closest||(Element.prototype.closest=function(a){for(var b=this,a=a.toUpperCase();b;){if(b.nodeName.toUpperCase()==a)return b;b=b.parentElement}});var m=function(a,b,f){"undefined"!==typeof a.addEventListener?a.addEventListener(b,f,!1):a.attachEvent("on"+b,f)},H=function(a){return a?"undefined"!==typeof a.target?a.target:a.srcElement:window.event.srcElement},h=function(a,b,f){function e(a,b,c){var d=new Date;
d.setTime(d.getTime()+864E5*c);c="; expires="+d.toGMTString();document.cookie=a+"="+b+c+"; path=/"}var f=f||!1,g=!1,d;if("undefined"!==typeof localStorage){g=!0;try{localStorage.setItem("testLocal",!0)}catch(h){g=!1}}"undefined"!==typeof b&&null!==b&&("object"===typeof b&&(b=JSON.stringify(b)),g?localStorage.setItem(a,b):f||e(a,b,30));if("undefined"===typeof b){if(g)d=localStorage.getItem(a);else if(!f)a:{a+="=";b=document.cookie.split(";");f=0;for(g=b.length;f<g;f++){for(d=b[f];" "===d.charAt(0);)d=
d.substring(1,d.length);if(0===d.indexOf(a)){d=d.substring(a.length,d.length);break a}}d=null}try{d=JSON.parse(d)}catch(i){}return d}null===b&&(g?localStorage.removeItem(a):f||e(a,"",-1))};b._internals={store:h,getDocWidth:fa,getDocHeight:ea,get_page_coord:T,get_event_target:H,add_event:m,getProperties:S,stripTrailingSlash:da,prepareParams:ba,sendXmlHttpRequest:W,recordError:D,getMsTimestamp:J,getTimestamp:n,log:i,getMetrics:R,generateUUID:Y,getId:X,heartBeat:L,toRequestQueue:p,reportViewDuration:I,
loadJS:ha,getLastView:function(){return y},setToken:ga,getToken:function(){var a=h("cly_token");h("cly_token",null);return a},showLoader:ia,hideLoader:ja}})(window.Countly=window.Countly||{});
