UNPKG

countly-sdk-web

Version:
97 lines 111 kB
(function(Ia,Za){"object"===typeof exports&&"undefined"!==typeof module?Za(exports):"function"===typeof define&&define.amd?define(["exports"],Za):(Ia="undefined"!==typeof globalThis?globalThis:Ia||self,Za(Ia.Countly=Ia.Countly||{}))})(this,function(Ia){function Za(m,q,v){if("function"==typeof m?m===q:m.has(q))return 3>arguments.length?q:v;throw new TypeError("Private element is not present on this object");}function b(m,q){return m.get(Za(m,q))}function p(m,q,v){if(q.has(m))throw new TypeError("Cannot initialize the same private elements twice on an object"); q.set(m,v)}function k(m,q,v){return m.set(Za(m,q),v),v}function x(m,q,v){a:{var a=q;if("object"==typeof a&&a){var G=a[Symbol.toPrimitive];if(void 0!==G){a=G.call(a,"string");if("object"!=typeof a)break a;throw new TypeError("@@toPrimitive must return a primitive value.");}a=String(a)}}return(q="symbol"==typeof a?a:a+"")in m?Object.defineProperty(m,q,{value:v,enumerable:!0,configurable:!0,writable:!0}):m[q]=v,m}function U(m){"@babel/helpers - typeof";return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator? function(q){return typeof q}:function(q){return q&&"function"==typeof Symbol&&q.constructor===Symbol&&q!==Symbol.prototype?"symbol":typeof q},U(m)}function Lc(m){var q=[];if("undefined"!==typeof m.options)for(var v=0;v<m.options.length;v++)m.options[v].selected&&q.push(m.options[v].value);return q.join(", ")}function nc(){var m=Mc("xxxxxxxx","[x]");var q=Date.now().toString();return m+q}function oc(){return Mc("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx","[xy]")}function Mc(m,q){var v=(new Date).getTime(); return m.replace(new RegExp(q,"g"),function(a){var G=(v+16*Math.random())%16|0;return("x"===a?G:G&3|8).toString(16)})}function I(){return Math.floor((new Date).getTime()/1E3)}function $a(){var m=(new Date).getTime();Hb>=m?Hb++:Hb=m;return Hb}function w(m,q,v){if(q&&Object.keys(q).length){if("undefined"!==typeof q[m])return q[m]}else if("undefined"!==typeof t[m])return t[m];return v}function pc(m,q,v){for(var a in t.i)t.i[a].tracking_crashes&&t.i[a].recordError(m,q,v)}function qc(m,q){var v=[],a;for(a in m)v.push(a+ "="+encodeURIComponent(m[a]));var G=v.join("&");return q?Nc(G,q).then(function(c){return G+="&checksum256="+c}):Promise.resolve(G)}function Ja(m){return"string"===typeof m&&"/"===m.substring(m.length-1)?m.substring(0,m.length-1):m}function pb(m,q){for(var v={},a,G=0,c=q.length;G<c;G++)a=q[G],"undefined"!==typeof m[a]&&(v[a]=m[a]);return v}function ra(m,q,v,a,G,c){var d={};if(m){if(Object.keys(m).length>a){var g={},h=0,n;for(n in m)h<a&&(g[n]=m[n],h++);m=g}for(var l in m)a=C(l,q,G,c),g=C(m[l],v,G, c),d[a]=g}return d}function C(m,q,v,a){var G=m;"number"===typeof m&&(m=m.toString());"string"===typeof m&&m.length>q&&(G=m.substring(0,q),a(f.DEBUG,v+", Key: [ "+m+" ] is longer than accepted length. It will be truncated."));return G}function Nc(m,q){m=(new TextEncoder).encode(m+q);return crypto.subtle.digest("SHA-256",m).then(function(v){return Array.from(new Uint8Array(v)).map(function(a){return a.toString(16).padStart(2,"0")}).join("")})}function E(m,q,v){A&&(null===m||"undefined"===typeof m?Ib()&& console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+q+"] event to nonexisting element"):"undefined"!==typeof m.addEventListener?m.addEventListener(q,v,!1):m.attachEvent("on"+q,v))}function Jb(m){return m?"undefined"!==typeof m.target?m.target:m.srcElement:window.event.srcElement}function ab(m){if(m)return m;(m=navigator.userAgent)||(m=rc());return m}function rc(m){if(m)return m;m="";navigator.userAgentData&&(m=navigator.userAgentData.brands.map(function(q){return q.brand+":"+q.version}).join(), m+=navigator.userAgentData.mobile?" mobi ":" ",m+=navigator.userAgentData.platform);return m}function sc(m){if(!m){if(navigator.userAgentData&&navigator.userAgentData.mobile)return"phone";m=ab()}m=m.toLowerCase();var q="desktop",v=/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/;/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(m)? q="tablet":v.test(m)&&(q="phone");return q}function Oc(m){var q=/(CountlySiteBot|nuhk|Googlebot|GoogleSecurityScanner|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|contxbot|PingdomBot|BingPreview|HeadlessChrome|Lighthouse)/; if(m)return q.test(m);m=q.test(ab());q=q.test(rc());return m||q}function tc(m){"undefined"===typeof m.pageY&&"number"===typeof m.clientX&&document.documentElement&&(m.pageX=m.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,m.pageY=m.clientY+document.body.scrollTop+document.documentElement.scrollTop);return m}function Kb(){var m=document;return Math.max(Math.max(m.body.scrollHeight,m.documentElement.scrollHeight),Math.max(m.body.offsetHeight,m.documentElement.offsetHeight),Math.max(m.body.clientHeight, m.documentElement.clientHeight))}function uc(){var m=document;return Math.max(Math.max(m.body.scrollWidth,m.documentElement.scrollWidth),Math.max(m.body.offsetWidth,m.documentElement.offsetWidth),Math.max(m.body.clientWidth,m.documentElement.clientWidth))}function Pc(){var m=document;return Math.min(Math.min(m.body.clientHeight,m.documentElement.clientHeight),Math.min(m.body.offsetHeight,m.documentElement.offsetHeight),window.innerHeight)}function Qc(m,q,v,a,G,c){m=document.createElement(m);var d; m.setAttribute(q,v);m.setAttribute(a,G);q=function(){d||c();d=!0};c&&(m.onreadystatechange=q,m.onload=q);document.getElementsByTagName("head")[0].appendChild(m)}function Rc(m,q){Qc("script","type","text/javascript","src",m,q)}function Lb(m,q){Qc("link","rel","stylesheet","href",m,q)}function Sc(){if(A){var m=document.getElementById("cly-loader");if(!m){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.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%;}}":v.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%;}}")); q.appendChild(v);m=document.createElement("div");m.setAttribute("id","cly-loader");window.addEventListener("load",function(){if(t.showLoaderProtection)Ib()&&console.warn("[WARNING] [Countly] showLoader, Loader is already on");else try{document.body.appendChild(m)}catch(a){Ib()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+a)}})}m.style.display="block"}}function Ib(){return t&&t.debug&&"undefined"!==typeof console?!0:!1}function Tc(){if(A){t.showLoaderProtection= !0;var m=document.getElementById("cly-loader");m&&(m.style.display="none")}}function qd(m){var q=document.createElement("script"),v=document.createElement("script");q.async=!0;v.async=!0;q.src=t.customSourceBoomerang||Uc.BOOMERANG_SRC;v.src=t.customSourceCountlyBoomerang||Uc.CLY_BOOMERANG_SRC;document.getElementsByTagName("head")[0].appendChild(q);document.getElementsByTagName("head")[0].appendChild(v);var a=!1,G=!1;q.onload=function(){a=!0};v.onload=function(){G=!0};var c=0,d=setInterval(function(){c+= 50;if(a&&G||1500<=c){if(t.debug){var g="BoomerangJS loaded:["+a+"], countly_boomerang loaded:["+G+"].";a&&G?console.log("[DEBUG] "+g):console.warn("[WARNING] "+g+" Initializing without APM.")}t.init(m);clearInterval(d)}},50)}var R={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},rd=Object.values(R),f={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},Uc={BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/boomerang.min.js", CLY_BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/countly_boomerang.js"},Q=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message",backoffCount:"cly_hc_backoff_count",consecutiveBackoffCount:"cly_hc_consecutive_backoff_count"}),Vc=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/, A="undefined"!==typeof window,t=globalThis.Countly||{},Hb=0,qb=new WeakMap,Wc=new WeakMap,bb=new WeakMap,ca=new WeakMap,rb=new WeakMap,Ka=new WeakMap,cb=new WeakMap,L=new WeakMap,O=new WeakMap,V=new WeakMap,sa=new WeakMap,fa=new WeakMap,ha=new WeakMap,sb=new WeakMap,La=new WeakMap,la=new WeakMap,tb=new WeakMap,X=new WeakMap,Ma=new WeakMap,Na=new WeakMap,ub=new WeakMap,db=new WeakMap,Oa=new WeakMap,Da=new WeakMap,ma=new WeakMap,Pa=new WeakMap,eb=new WeakMap,fb=new WeakMap,N=new WeakMap,ia=new WeakMap, ta=new WeakMap,Mb=new WeakMap,ua=new WeakMap,Ea=new WeakMap,J=new WeakMap,Qa=new WeakMap,Ra=new WeakMap,vb=new WeakMap,va=new WeakMap,gb=new WeakMap,na=new WeakMap,wa=new WeakMap,oa=new WeakMap,wb=new WeakMap,M=new WeakMap,xb=new WeakMap,vc=new WeakMap,Sa=new WeakMap,hb=new WeakMap,ib=new WeakMap,jb=new WeakMap,xa=new WeakMap,Nb=new WeakMap,pa=new WeakMap,Fa=new WeakMap,Ta=new WeakMap,kb=new WeakMap,Ob=new WeakMap,lb=new WeakMap,mb=new WeakMap,yb=new WeakMap,zb=new WeakMap,Pb=new WeakMap,Qb=new WeakMap, nb=new WeakMap,Ua=new WeakMap,Rb=new WeakMap,K=new WeakMap,H=new WeakMap,Y=new WeakMap,Va=new WeakMap,ya=new WeakMap,za=new WeakMap,Sb=new WeakMap,Tb=new WeakMap,Ub=new WeakMap,Vb=new WeakMap,Wb=new WeakMap,Xb=new WeakMap,Yb=new WeakMap,wc=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,Xa=new WeakMap,Ab=new WeakMap,Bb=new WeakMap,Cb=new WeakMap,Zb=new WeakMap,$b=new WeakMap,ac=new WeakMap,Xc=new WeakMap,xc=new WeakMap,da=new WeakMap,yc=new WeakMap,ja=new WeakMap,qa=new WeakMap,zc=new WeakMap,Ac=new WeakMap, bc=new WeakMap,cc=new WeakMap,Bc=new WeakMap,Ha=new WeakMap,Yc=new WeakMap,dc=new WeakMap,Zc=new WeakMap,Cc=new WeakMap,$c=new WeakMap,ad=new WeakMap,ec=new WeakMap,Aa=new WeakMap,fc=new WeakMap,Dc=new WeakMap,gc=new WeakMap,bd=new WeakMap,Ec=new WeakMap,Ya=new WeakMap,W=new WeakMap,Db=new WeakMap,cd=new WeakMap,dd=new WeakMap,Ba=new WeakMap,hc=new WeakMap,ed=new WeakMap,Fc=new WeakMap,Eb=new WeakMap,Fb=new WeakMap,ic=new WeakMap,e=new WeakMap,ea=new WeakMap,Gc=new WeakMap,Hc=new WeakMap,jc=new WeakMap, kc=new WeakMap,Ic=new WeakMap,lc=new WeakMap,fd=new WeakMap,Jc=new WeakMap,gd=new WeakMap,hd=new WeakMap,id=new WeakMap,jd=new WeakMap,Kc=new WeakMap,B=new WeakMap,y=new WeakMap,Z=new WeakMap,kd=new WeakMap,ld=new WeakMap,md=new WeakMap,nd=new WeakMap,ka=new WeakMap,od=function(m,q,v){return Object.defineProperty(m,"prototype",{writable:!1}),m}(function v(q){var a=this;if(!(this instanceof v))throw new TypeError("Cannot call a class as a function");p(this,qb,void 0);p(this,Wc,void 0);p(this,bb,void 0); p(this,ca,void 0);p(this,rb,void 0);p(this,Ka,void 0);p(this,cb,void 0);p(this,L,void 0);p(this,O,void 0);p(this,V,void 0);p(this,sa,void 0);p(this,fa,void 0);p(this,ha,void 0);p(this,sb,void 0);p(this,La,void 0);p(this,la,void 0);p(this,tb,void 0);p(this,X,void 0);p(this,Ma,void 0);p(this,Na,void 0);p(this,ub,void 0);p(this,db,void 0);p(this,Oa,void 0);p(this,Da,void 0);p(this,ma,void 0);p(this,Pa,void 0);p(this,eb,void 0);p(this,fb,void 0);p(this,N,void 0);p(this,ia,void 0);p(this,ta,void 0);p(this, Mb,void 0);p(this,ua,void 0);p(this,Ea,void 0);p(this,J,void 0);p(this,Qa,void 0);p(this,Ra,void 0);p(this,vb,void 0);p(this,va,void 0);p(this,gb,void 0);p(this,na,void 0);p(this,wa,void 0);p(this,oa,void 0);p(this,wb,void 0);p(this,M,void 0);p(this,xb,void 0);p(this,vc,void 0);p(this,Sa,void 0);p(this,hb,void 0);p(this,ib,void 0);p(this,jb,void 0);p(this,xa,void 0);p(this,Nb,void 0);p(this,pa,void 0);p(this,Fa,void 0);p(this,Ta,void 0);p(this,kb,void 0);p(this,Ob,void 0);p(this,lb,void 0);p(this, mb,void 0);p(this,yb,void 0);p(this,zb,void 0);p(this,Pb,void 0);p(this,Qb,void 0);p(this,nb,void 0);p(this,Ua,void 0);p(this,Rb,void 0);p(this,K,void 0);p(this,H,void 0);p(this,Y,void 0);p(this,Va,void 0);p(this,ya,void 0);p(this,za,void 0);p(this,Sb,void 0);p(this,Tb,void 0);p(this,Ub,void 0);p(this,Vb,void 0);p(this,Wb,void 0);p(this,Xb,void 0);p(this,Yb,void 0);p(this,wc,void 0);p(this,Wa,void 0);p(this,Ga,void 0);p(this,Xa,void 0);p(this,Ab,void 0);p(this,Bb,void 0);p(this,Cb,void 0);p(this, Zb,void 0);p(this,$b,function(){if("[CLY]_temp_id"===a.device_id)b(e,a).call(a,f.INFO,"server_config, Device ID is temporary, not fetching server config");else if(b(wc,a))b(e,a).call(a,f.INFO,"server_config, SDK behavior sync is disabled, not fetching server config");else{b(e,a).call(a,f.INFO,"server_config, Fetching server config");var c={};c.app_key=a.app_key;c.device_id=a.device_id;c.sdk_version=b(oa,a);c.sdk_name=b(wa,a);c.t=b(J,a);c.timestamp=$a();var d=new Date;c.hour=d.getHours();c.dow=d.getDay(); c.av=a.app_version;c.method="sc";b(ea,a).call(a,"server_config",a.url+b(Ka,a),c,function(g,h,n){if(!g)try{var l=JSON.parse(n);b(e,a).call(a,f.INFO,"server_config, Config fetched successfully:["+JSON.stringify(l)+"]");l&&b(ac,a).call(a,l);b(y,a).call(a,"cly_config",JSON.stringify(l))}catch(r){b(e,a).call(a,f.ERROR,"server_config, Had an issue while parsing the response: "+r)}},!0,!0);setTimeout(function(){b($b,a).call(a)},36E5*b(Ob,a))}});p(this,ac,function(c){c&&c.c&&"object"===U(c.c)&&(c=c.c,c.hasOwnProperty("networking")&& k(Nb,a,c.networking),c.hasOwnProperty("tracking")&&k(lb,a,c.tracking),c.hasOwnProperty("rqs")&&k(pa,a,c.rqs),c.hasOwnProperty("eqs")&&k(Fa,a,c.eqs),c.hasOwnProperty("sui")&&k(Ta,a,c.sui),c.hasOwnProperty("czi")&&14<c.czi&&k(kb,a,1E3*c.czi),c.hasOwnProperty("ecz")&&(k(nb,a,c.ecz),!b(Xb,a)&&b(nb,a)&&b(Ha,a).call(a)),c.hasOwnProperty("cr")&&k(Ua,a,c.cr),c.hasOwnProperty("st")&&k(mb,a,c.st),c.hasOwnProperty("crt")&&k(zb,a,c.crt),c.hasOwnProperty("vt")&&k(yb,a,c.vt),c.hasOwnProperty("cet")&&k(Pb,a,c.cet), c.hasOwnProperty("lkl")&&k(K,a,c.lkl),c.hasOwnProperty("lvs")&&k(H,a,c.lvs),c.hasOwnProperty("lsv")&&k(Y,a,c.lsv),c.hasOwnProperty("lbc")&&k(Va,a,c.lbc),c.hasOwnProperty("ltlpt")&&k(ya,a,c.ltlpt),c.hasOwnProperty("ltl")&&k(za,a,c.ltl),c.hasOwnProperty("scui")&&k(Ob,a,Math.max(c.scui,4)),c.hasOwnProperty("lt")&&k(Qb,a,c.lt),c.hasOwnProperty("rcz")&&k(Rb,a,c.rcz),c.hasOwnProperty("bom")&&k(Sb,a,c.bom),c.hasOwnProperty("bom_at")&&k(Tb,a,c.bom_at),c.hasOwnProperty("bom_rqp")&&k(Ub,a,c.bom_rqp),c.hasOwnProperty("bom_ra")&& k(Vb,a,c.bom_ra),c.hasOwnProperty("bom_d")&&k(Wb,a,c.bom_d))});p(this,Xc,function(c){k(ha,a,w("ignore_referrers",c,[]));k(db,a,w("fail_timeout",c,60));k(Oa,a,w("inactivity_time",c,20));k(ma,a,w("use_session_cookie",c,!0));k(Pa,a,w("session_cookie_timeout",c,30));k(N,a,w("offline_mode",c,!1));k(wa,a,w("sdk_name",c,"javascript_native_web"));k(oa,a,w("sdk_version",c,"25.4.1"));k(cb,a,w("interval",c,500));a.getViewName=w("getViewName",c,t.getViewName);a.getViewUrl=w("getViewUrl",c,t.getViewUrl);a.getSearchQuery= w("getSearchQuery",c,t.getSearchQuery);a.DeviceIdType=t.DeviceIdType;a.namespace=w("namespace",c,"");a.clearStoredId=w("clear_stored_id",c,!1);a.onload=w("onload",c,[]);a.utm=w("utm",c,{source:!0,medium:!0,campaign:!0,term:!0,content:!0});a.ignore_prefetch=w("ignore_prefetch",c,!0);a.rcAutoOptinAb=w("rc_automatic_optin_for_ab",c,!0);a.useExplicitRcApi=w("use_explicit_rc_api",c,!1);a.debug=w("debug",c,!1);a.test_mode=w("test_mode",c,!1);a.test_mode_eq=w("test_mode_eq",c,!1);a.metrics=w("metrics",c, {});a.headers=w("headers",c,{});a.app_version=w("app_version",c,"0.0");a.country_code=w("country_code",c,null);a.city=w("city",c,null);a.ip_address=w("ip_address",c,null);a.ignore_bots=w("ignore_bots",c,!0);a.force_post=w("force_post",c,!1);a.remote_config=w("remote_config",c,!1);a.ignore_visitor=w("ignore_visitor",c,!1);a.track_domains=A?w("track_domains",c,!0):void 0;a.storage=w("storage",c,"default");a.enableOrientationTracking=A?w("enable_orientation_tracking",c,!0):void 0;a.heatmapWhitelist= w("heatmap_whitelist",c,[]);a.contentWhitelist=w("content_whitelist",c,[]);a.salt=w("salt",c,null);a.hcErrorCount=b(B,a).call(a,Q.errorCount)||0;a.hcWarningCount=b(B,a).call(a,Q.warningCount)||0;a.hcStatusCode=b(B,a).call(a,Q.statusCode)||-1;a.hcErrorMessage=b(B,a).call(a,Q.errorMessage)||"";a.hcBackoffCount=b(B,a).call(a,Q.backoffCount)||0;a.hcConsecutiveBackoffCount=b(B,a).call(a,Q.consecutiveBackoffCount)||0;k(Bb,a,!1);k(jb,a,w("crash_filter_callback",c,null));"cookie"===a.storage&&k(ua,a,!1); a.rcAutoOptinAb||a.useExplicitRcApi||(b(e,a).call(a,f.WARNING,"initialize, Auto opting is disabled, switching to explicit RC API"),a.useExplicitRcApi=!0);Array.isArray(b(ha,a))||k(ha,a,[]);""===a.url&&(b(e,a).call(a,f.ERROR,"initialize, Please provide server URL"),a.ignore_visitor=!0);b(B,a).call(a,"cly_ignore")&&(a.ignore_visitor=!0);b(Bc,a).call(a);if(A)if(window.name&&0===window.name.indexOf("cly:"))try{a.passed_data=JSON.parse(window.name.replace("cly:",""))}catch(D){b(e,a).call(a,f.ERROR,"initialize, Could not parse name: "+ window.name+", error: "+D)}else if(location.hash&&0===location.hash.indexOf("this.#cly:"))try{a.passed_data=JSON.parse(location.hash.replace("this.#cly:",""))}catch(D){b(e,a).call(a,f.ERROR,"initialize, Could not parse hash: "+location.hash+", error: "+D)}Array.isArray(a.contentWhitelist)&&(a.contentWhitelist.push(a.url),a.contentWhitelist=a.contentWhitelist.map(function(D){return Ja(D)}));if((a.passed_data&&a.passed_data.app_key&&a.passed_data.app_key===a.app_key||a.passed_data&&!a.passed_data.app_key&& b(bb,a))&&a.passed_data.token&&a.passed_data.purpose){a.passed_data.token!==b(B,a).call(a,"cly_old_token")&&(b(Jc,a).call(a,a.passed_data.token),b(y,a).call(a,"cly_old_token",a.passed_data.token));var d=[];Array.isArray(a.heatmapWhitelist)?(a.heatmapWhitelist.push(a.url),d=a.heatmapWhitelist.map(function(D){return Ja(D)})):d=[a.url];d.includes(a.passed_data.url)&&"heatmap"===a.passed_data.purpose&&(a.ignore_visitor=!0,Sc(),Rc(a.passed_data.url+"/views/heatmap.js",Tc))}if(a.ignore_visitor)b(e,a).call(a, f.WARNING,"initialize, ignore_visitor:["+a.ignore_visitor+"], this user will not be tracked");else{b(kd,a).call(a);k(L,a,b(B,a).call(a,"cly_queue")||[]);k(O,a,b(B,a).call(a,"cly_event")||[]);k(V,a,b(B,a).call(a,"cly_remote_configs")||{});d="[CLY]_temp_id"===b(B,a).call(a,"cly_id");a.clearStoredId&&(b(B,a).call(a,"cly_id")&&!d&&(a.device_id=b(B,a).call(a,"cly_id"),b(e,a).call(a,f.DEBUG,"initialize, temporarily using the previous device ID to flush existing events"),k(J,a,b(B,a).call(a,"cly_id_type")), b(J,a)||(b(e,a).call(a,f.DEBUG,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED, for event flushing"),k(J,a,0)),b(Aa,a).call(a),a.device_id=void 0,k(J,a,1)),b(e,a).call(a,f.INFO,"initialize, Clearing the device ID storage"),b(Z,a).call(a,"cly_id"),b(Z,a).call(a,"cly_id_type"),b(Z,a).call(a,"cly_session"),d=!1);"javascript_native_web"===b(wa,a)&&"25.4.1"===b(oa,a)?b(e,a).call(a,f.DEBUG,"initialize, SDK name:["+b(wa,a)+"], version:["+b(oa,a)+"]"):b(e, a).call(a,f.DEBUG,"initialize, SDK name:["+b(wa,a)+"], version:["+b(oa,a)+"], default name:[javascript_native_web] and default version:[25.4.1]");b(e,a).call(a,f.DEBUG,"initialize, stored server config:["+JSON.stringify(b(xa,a))+"]");b(e,a).call(a,f.DEBUG,"initialize, app_key:["+a.app_key+"], url:["+a.url+"]");b(e,a).call(a,f.DEBUG,"initialize, device_id:["+w("device_id",c,void 0)+"]");b(e,a).call(a,f.DEBUG,"initialize, require_consent is enabled:["+b(Ua,a)+"]");try{b(e,a).call(a,f.DEBUG,"initialize, metric override:["+ JSON.stringify(a.metrics)+"]"),b(e,a).call(a,f.DEBUG,"initialize, header override:["+JSON.stringify(a.headers)+"]"),b(e,a).call(a,f.DEBUG,"initialize, number of onload callbacks provided:["+a.onload.length+"]"),b(e,a).call(a,f.DEBUG,"initialize, utm tags:["+JSON.stringify(a.utm)+"]"),b(ha,a)&&b(e,a).call(a,f.DEBUG,"initialize, referrers to ignore :["+JSON.stringify(b(ha,a))+"]"),b(e,a).call(a,f.DEBUG,"initialize, salt given:["+!!a.salt+"]")}catch(D){b(e,a).call(a,f.ERROR,"initialize, Could not stringify some config object values")}b(e, a).call(a,f.DEBUG,"initialize, app_version:["+a.app_version+"]");b(e,a).call(a,f.DEBUG,"initialize, provided location info; country_code:["+a.country_code+"], city:["+a.city+"], ip_address:["+a.ip_address+"]");""!==a.namespace&&b(e,a).call(a,f.DEBUG,"initialize, namespace given:["+a.namespace+"]");a.clearStoredId&&b(e,a).call(a,f.DEBUG,"initialize, clearStoredId flag set to:["+a.clearStoredId+"]");a.ignore_prefetch&&b(e,a).call(a,f.DEBUG,"initialize, ignoring pre-fetching and pre-rendering from counting as real website visits :["+ a.ignore_prefetch+"]");a.test_mode&&b(e,a).call(a,f.WARNING,"initialize, test_mode:["+a.test_mode+"], request queue won't be processed");a.test_mode_eq&&b(e,a).call(a,f.WARNING,"initialize, test_mode_eq:["+a.test_mode_eq+"], event queue won't be processed");a.heatmapWhitelist&&b(e,a).call(a,f.DEBUG,"initialize, heatmap whitelist:["+JSON.stringify(a.heatmapWhitelist)+"], these domains will be whitelisted");"default"!==a.storage&&b(e,a).call(a,f.DEBUG,"initialize, storage is set to:["+a.storage+"]"); a.ignore_bots&&b(e,a).call(a,f.DEBUG,"initialize, ignore traffic from bots :["+a.ignore_bots+"]");a.force_post&&b(e,a).call(a,f.DEBUG,"initialize, forced post method for all requests:["+a.force_post+"]");a.remote_config&&b(e,a).call(a,f.DEBUG,"initialize, remote_config callback provided:["+!!a.remote_config+"]");"boolean"===typeof a.rcAutoOptinAb&&b(e,a).call(a,f.DEBUG,"initialize, automatic RC optin is enabled:["+a.rcAutoOptinAb+"]");a.useExplicitRcApi||b(e,a).call(a,f.WARNING,"initialize, will use legacy RC API. Consider enabling new API during init with use_explicit_rc_api flag"); a.track_domains&&b(e,a).call(a,f.DEBUG,"initialize, tracking domain info:["+a.track_domains+"]");a.enableOrientationTracking&&b(e,a).call(a,f.DEBUG,"initialize, enableOrientationTracking:["+a.enableOrientationTracking+"]");b(ma,a)||b(e,a).call(a,f.WARNING,"initialize, use_session_cookie is enabled:["+b(ma,a)+"]");b(N,a)&&b(e,a).call(a,f.DEBUG,"initialize, offline_mode:["+b(N,a)+"], user info won't be send to the servers");b(V,a)&&b(e,a).call(a,f.DEBUG,"initialize, stored remote configs:["+JSON.stringify(b(V, a))+"]");b(kb,a)&&b(e,a).call(a,f.DEBUG,"initialize, content_zone_timer_interval:["+b(kb,a)+"]");b(e,a).call(a,f.DEBUG,"initialize, 'getViewName' callback override provided:["+(a.getViewName!==t.getViewName)+"]");b(e,a).call(a,f.DEBUG,"initialize, 'getSearchQuery' callback override provided:["+(a.getSearchQuery!==t.getSearchQuery)+"]");128!==b(K,a)&&b(e,a).call(a,f.DEBUG,"initialize, maxKeyLength set to:["+b(K,a)+"] characters");256!==b(H,a)&&b(e,a).call(a,f.DEBUG,"initialize, maxValueSize set to:["+ b(H,a)+"] characters");100!==b(Y,a)&&b(e,a).call(a,f.DEBUG,"initialize, maxSegmentationValues set to:["+b(Y,a)+"] key/value pairs");100!==b(Va,a)&&b(e,a).call(a,f.DEBUG,"initialize, maxBreadcrumbCount for custom logs set to:["+b(Va,a)+"] entries");30!==b(ya,a)&&b(e,a).call(a,f.DEBUG,"initialize, maxStackTraceLinesPerThread set to:["+b(ya,a)+"] lines");200!==b(za,a)&&b(e,a).call(a,f.DEBUG,"initialize, maxStackTraceLineLength set to:["+b(za,a)+"] characters");500!==b(cb,a)&&b(e,a).call(a,f.DEBUG,"initialize, interval for heartbeats set to:["+ b(cb,a)+"] milliseconds");1E3!==b(pa,a)&&b(e,a).call(a,f.DEBUG,"initialize, queue_size set to:["+b(pa,a)+"] items max");60!==b(db,a)&&b(e,a).call(a,f.DEBUG,"initialize, fail_timeout set to:["+b(db,a)+"] seconds of wait time after a failed connection to server");20!==b(Oa,a)&&b(e,a).call(a,f.DEBUG,"initialize, inactivity_time set to:["+b(Oa,a)+"] minutes to consider a user as inactive after no observable action");60!==b(Ta,a)&&b(e,a).call(a,f.DEBUG,"initialize, session_update set to:["+b(Ta,a)+"] seconds to check if extending a session is needed while the user is active"); 100!==b(Fa,a)&&b(e,a).call(a,f.DEBUG,"initialize, max_events set to:["+b(Fa,a)+"] events to send in one batch");30!==b(Pa,a)&&b(e,a).call(a,f.DEBUG,"initialize, session_cookie_timeout set to:["+b(Pa,a)+"] minutes to expire a cookies session");var g=null,h=a.getSearchQuery(),n=!1,l={};if(h){0===h.indexOf("?")&&(h=h.substring(1));h=h.split("&");for(var r=0;r<h.length;r++){var u=h[r].split("=");"cly_id"===u[0]?b(y,a).call(a,"cly_cmp_id",u[1]):"cly_uid"===u[0]?b(y,a).call(a,"cly_cmp_uid",u[1]):"cly_device_id"=== u[0]?g=u[1]:0===(u[0]+"").indexOf("utm_")&&a.utm[u[0].replace("utm_","")]&&(l[u[0].replace("utm_","")]=u[1],n=!0)}}h=w("device_id",c,void 0);"number"===typeof h&&(h=h.toString());b(B,a).call(a,"cly_id")&&!d?(a.device_id=b(B,a).call(a,"cly_id"),b(e,a).call(a,f.INFO,"initialize, Set the stored device ID"),k(J,a,b(B,a).call(a,"cly_id_type")),b(J,a)||(b(e,a).call(a,f.INFO,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED"),k(J,a,0)),k(N,a,!1)):null!==g? (b(e,a).call(a,f.INFO,"initialize, Device ID set by URL"),a.device_id=g,k(J,a,3),k(N,a,!1)):h?(b(e,a).call(a,f.INFO,"initialize, Device ID set by developer"),a.device_id=h,c&&Object.keys(c).length?void 0!==c.device_id&&k(J,a,0):void 0!==t.device_id&&k(J,a,0),k(N,a,!1)):b(N,a)||d?(a.device_id="[CLY]_temp_id",k(J,a,2),b(N,a)&&d?b(e,a).call(a,f.INFO,"initialize, Temp ID set, continuing offline mode from previous app session"):b(N,a)&&!d?b(e,a).call(a,f.INFO,"initialize, Temp ID set, entering offline mode"): (k(N,a,!0),b(e,a).call(a,f.INFO,"initialize, Temp ID set, enabling offline mode"))):(b(e,a).call(a,f.INFO,"initialize, Generating the device ID"),a.device_id=w("device_id",c,b(hc,a).call(a)),c&&Object.keys(c).length?void 0!==c.device_id&&k(J,a,0):void 0!==t.device_id&&k(J,a,0));b(y,a).call(a,"cly_id",a.device_id);b(y,a).call(a,"cly_id_type",b(J,a));if(n){k(na,a,{});for(var z in a.utm)l[z]?(a.userData.set("utm_"+z,l[z]),b(na,a)[z]=l[z]):a.userData.unset("utm_"+z);a.userData.save()}b($b,a).call(a)}}); p(this,xc,function(){b(qb,a)&&(clearTimeout(b(qb,a)),k(qb,a,null));k(qb,a,setTimeout(function(){for(var c={},d=0;d<t.features.length;d++)!0===b(M,a)[t.features[d]].optin?c[t.features[d]]=!0:c[t.features[d]]=!1;b(W,a).call(a,{consent:JSON.stringify(c)});b(e,a).call(a,f.DEBUG,"Consent update request has been sent to the queue.")},1E3))});x(this,"halt",function(){b(e,a).call(a,f.WARNING,"halt, Resetting Countly");t.i=void 0;t.q=[];t.noHeartBeat=void 0;k(bb,a,!t.i);k(ca,a,!1);k(rb,a,"/i");k(Ka,a,"/o/sdk"); k(cb,a,500);k(pa,a,1E3);k(L,a,[]);k(O,a,[]);k(V,a,{});k(sa,a,[]);k(fa,a,{});k(ha,a,[]);k(sb,a,null);k(La,a,!0);k(tb,a,0);k(X,a,null);k(Ma,a,0);k(Na,a,0);k(ub,a,0);k(db,a,60);k(Oa,a,20);k(Da,a,0);k(Ta,a,60);k(Fa,a,100);k(ma,a,!0);k(Pa,a,30);k(eb,a,!0);k(fb,a,!1);k(N,a,!1);k(ia,a,{});k(ta,a,!0);k(Mb,a,I());k(ua,a,!0);k(Ea,a,null);k(J,a,1);k(Qa,a,!1);k(Ra,a,0);k(vb,a,!1);k(va,a,null);k(gb,a,null);k(na,a,null);k(xb,a,[]);try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal"), localStorage.removeItem("cly_old_token"),localStorage.removeItem("cly_cmp_id"),localStorage.removeItem("cly_cmp_uid"),localStorage.removeItem("cly_id"),localStorage.removeItem("cly_id_type"),localStorage.removeItem("cly_queue"),localStorage.removeItem("cly_session"),localStorage.removeItem("cly_remote_configs"),localStorage.removeItem("cly_event"),localStorage.removeItem("cly_ignore"),localStorage.removeItem("cly_fb_widgets"),localStorage.removeItem("cly_token"),localStorage.removeItem("cly_hc_error_count"), localStorage.removeItem("cly_hc_warning_count"),localStorage.removeItem("cly_hc_status_code"),localStorage.removeItem("cly_hc_error_message"),localStorage.removeItem("cly_hc_backoff_count"),localStorage.removeItem("cly_hc_consecutive_backoff_count")}catch(d){b(e,a).call(a,f.ERROR,"halt, Local storage test failed, will fallback to cookies"),k(ua,a,!1)}t.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");k(M,a,{}); for(var c=0;c<t.features.length;c++)b(M,a)[t.features[c]]={};a.app_key=void 0;a.device_id=void 0;a.onload=void 0;a.utm=void 0;a.ignore_prefetch=void 0;a.debug=void 0;a.test_mode=void 0;a.test_mode_eq=void 0;a.metrics=void 0;a.headers=void 0;a.url=void 0;a.app_version=void 0;a.country_code=void 0;a.city=void 0;a.ip_address=void 0;a.ignore_bots=void 0;a.force_post=void 0;a.rcAutoOptinAb=void 0;a.useExplicitRcApi=void 0;a.remote_config=void 0;a.ignore_visitor=void 0;k(Ua,a,void 0);a.track_domains=void 0; a.storage=void 0;a.enableOrientationTracking=void 0;a.salt=void 0;k(K,a,void 0);k(H,a,void 0);k(Y,a,void 0);k(Va,a,void 0);k(ya,a,void 0);k(za,a,void 0)});x(this,"group_features",function(c){b(e,a).call(a,f.INFO,"group_features, Grouping features");if(c)for(var d in c)b(M,a)[d]?b(e,a).call(a,f.WARNING,"group_features, Feature name ["+d+"] is already reserved"):"string"===typeof c[d]?b(M,a)[d]={features:[c[d]]}:c[d]&&Array.isArray(c[d])&&c[d].length?b(M,a)[d]={features:c[d]}:b(e,a).call(a,f.ERROR, "group_features, Incorrect feature list for ["+d+"] value: ["+c[d]+"]");else b(e,a).call(a,f.ERROR,"group_features, Incorrect features:["+c+"]")});x(this,"check_consent",function(c){b(e,a).call(a,f.INFO,"check_consent, Checking if consent is given for specific feature:["+c+"]");if(!b(Ua,a))return b(e,a).call(a,f.INFO,"check_consent, require_consent is off, no consent is necessary"),!0;if(b(M,a)[c])return!(!b(M,a)[c]||!b(M,a)[c].optin);b(e,a).call(a,f.ERROR,"check_consent, No feature available for ["+ c+"]");return!1});x(this,"get_device_id_type",function(){b(e,a).call(a,f.INFO,"check_device_id_type, Retrieving the current device id type.["+b(J,a)+"]");switch(b(J,a)){case 1:var c=a.DeviceIdType.SDK_GENERATED;break;case 3:case 0:c=a.DeviceIdType.DEVELOPER_SUPPLIED;break;case 2:c=a.DeviceIdType.TEMPORARY_ID;break;default:c=-1}return c});x(this,"get_device_id",function(){b(e,a).call(a,f.INFO,"get_device_id, Retrieving the device id: ["+a.device_id+"]");return a.device_id});x(this,"check_any_consent", function(){b(e,a).call(a,f.INFO,"check_any_consent, Checking if any consent is given");if(!b(Ua,a))return b(e,a).call(a,f.INFO,"check_any_consent, require_consent is off, no consent is necessary"),!0;for(var c in b(M,a))if(b(M,a)[c]&&b(M,a)[c].optin)return!0;b(e,a).call(a,f.INFO,"check_any_consent, No consents given");return!1});x(this,"add_consent",function(c){b(e,a).call(a,f.INFO,"add_consent, Adding consent for ["+c+"]");if(Array.isArray(c))for(var d=0;d<c.length;d++)a.add_consent(c[d]);else b(M, a)[c]?b(M,a)[c].features?(b(M,a)[c].optin=!0,a.add_consent(b(M,a)[c].features)):!0!==b(M,a)[c].optin&&(b(M,a)[c].optin=!0,b(xc,a).call(a),setTimeout(function(){"sessions"===c&&b(ia,a).begin_session?(a.begin_session.apply(a,b(ia,a).begin_session),b(ia,a).begin_session=null):"views"===c&&b(ia,a).track_pageview&&(k(X,a,null),a.track_pageview.apply(a,b(ia,a).track_pageview),b(ia,a).track_pageview=null)},1)):b(e,a).call(a,f.ERROR,"add_consent, No feature available for ["+c+"]")});x(this,"remove_consent", function(c){b(e,a).call(a,f.INFO,"remove_consent, Removing consent for ["+c+"]");a.remove_consent_internal(c,!0)});x(this,"remove_consent_internal",function(c,d){d=d||!1;if(Array.isArray(c))for(var g=0;g<c.length;g++)a.remove_consent_internal(c[g],d);else b(M,a)[c]?b(M,a)[c].features?a.remove_consent_internal(b(M,a)[c].features,d):(b(M,a)[c].optin=!1,d&&!1!==b(M,a)[c].optin&&b(xc,a).call(a)):b(e,a).call(a,f.WARNING,"remove_consent, No feature available for ["+c+"]")});x(this,"enable_offline_mode", function(){b(N,a)?b(e,a).call(a,f.WARNING,"enable_offline_mode, Countly is already in offline mode."):(b(e,a).call(a,f.INFO,"enable_offline_mode, Enabling offline mode"),a.remove_consent_internal(t.features,!1),k(N,a,!0),b(dc,a).call(a),a.device_id="[CLY]_temp_id",k(J,a,2))});x(this,"disable_offline_mode",function(c){if(b(N,a)){b(e,a).call(a,f.INFO,"disable_offline_mode, Disabling offline mode");k(N,a,!1);c&&a.device_id!==c?(a.device_id=c,k(J,a,0),b(y,a).call(a,"cly_id",a.device_id),b(y,a).call(a, "cly_id_type",0),b(e,a).call(a,f.INFO,"disable_offline_mode, Changing id to: "+a.device_id)):(a.device_id=b(hc,a).call(a),"[CLY]_temp_id"===a.device_id&&(a.device_id=oc()),a.device_id!==b(B,a).call(a,"cly_id")&&(b(y,a).call(a,"cly_id",a.device_id),b(y,a).call(a,"cly_id_type",1)));c=!1;if(0<b(L,a).length)for(var d=0;d<b(L,a).length;d++)"[CLY]_temp_id"===b(L,a)[d].device_id&&(b(L,a)[d].device_id=a.device_id,b(L,a)[d].t=b(J,a),c=!0);c&&b(y,a).call(a,"cly_queue",b(L,a),!0);b(wb,a)&&(b(ka,a).sendInstantHCRequest(), k(wb,a,!1));b($b,a).call(a);b(nb,a)&&(b(Ha,a).call(a),k(Xb,a,!0))}else b(e,a).call(a,f.WARNING,"disable_offline_mode, Countly was not in offline mode.")});x(this,"begin_session",function(c,d){if(b(mb,a))if(b(e,a).call(a,f.INFO,"begin_session, Starting the session. There was an ongoing session: ["+b(ca,a)+"]"),c&&b(e,a).call(a,f.INFO,"begin_session, Heartbeats are disabled"),d&&b(e,a).call(a,f.INFO,"begin_session, Session starts irrespective of session cookie"),a.check_consent("sessions")){if(!b(ca, a)){if(a.enableOrientationTracking){b(yc,a).call(a);var g;E(window,"resize",function(){clearTimeout(g);g=setTimeout(function(){b(yc,a).call(a)},200)})}k(la,a,I());k(ca,a,!0);k(La,a,!c);c=b(B,a).call(a,"cly_session");b(e,a).call(a,f.VERBOSE,"begin_session, Session state, forced: ["+d+"], useSessionCookie: ["+b(ma,a)+"], seconds to expire: ["+(c-b(la,a))+"], expired: ["+(parseInt(c)<=I())+"] ");if(d||!b(ma,a)||!c||parseInt(c)<=I())b(e,a).call(a,f.INFO,"begin_session, Session started"),null===b(Ea,a)&& k(Ea,a,!0),d={begin_session:1},d.metrics=JSON.stringify(b(Eb,a).call(a)),b(W,a).call(a,d);b(y,a).call(a,"cly_session",I()+60*b(Pa,a))}}else b(ia,a).begin_session=[c,d];else b(e,a).call(a,f.INFO,"begin_session, Session tracking is disabled by server config")});x(this,"session_duration",function(c){b(mb,a)?(b(e,a).call(a,f.INFO,"session_duration, Reporting session duration: ["+c+"]"),a.check_consent("sessions")&&(b(ca,a)?(b(e,a).call(a,f.INFO,"session_duration, Session extended: ["+c+"]"),b(W,a).call(a, {session_duration:c}),b(Ec,a).call(a)):b(e,a).call(a,f.DEBUG,"session_duration, No session was started"))):b(e,a).call(a,f.INFO,"session_duration, Session tracking is disabled by server config")});x(this,"end_session",function(c,d){b(mb,a)||d?(b(e,a).call(a,f.INFO,"end_session, Ending the current session. There was an on going session:["+b(ca,a)+"]"),a.check_consent("sessions")&&b(ca,a)&&(c=c||I()-b(la,a),b(gc,a).call(a),!b(ma,a)||d?(b(e,a).call(a,f.INFO,"end_session, Session ended"),b(W,a).call(a, {end_session:1,session_duration:c})):a.session_duration(c),k(ca,a,!1))):b(e,a).call(a,f.INFO,"end_session, Session tracking is disabled by server config")});x(this,"set_id",function(c){b(e,a).call(a,f.INFO,"set_id, Changing the device ID to:["+c+"]");null==c||""===c?b(e,a).call(a,f.WARNING,"set_id, The provided device is not a valid ID"):0===b(J,a)?a.change_id(c,!1):a.change_id(c,!0)});x(this,"change_id",function(c,d){b(e,a).call(a,f.INFO,"change_id, Changing the device ID to: ["+c+"] with merge:["+ d+"]");if(c&&"string"===typeof c&&0!==c.length)if(b(N,a))b(e,a).call(a,f.WARNING,"change_id, Offline mode was on, initiating disabling sequence instead."),a.disable_offline_mode(c);else if(a.device_id==c)b(e,a).call(a,f.DEBUG,"change_id, Provided device ID is equal to the current device ID. Aborting.");else{d||(b(Ba,a).call(a),b(Aa,a).call(a),a.end_session(null,!0),k(fa,a,{}),a.remove_consent_internal(t.features,!1));var g=a.device_id;a.device_id=c;a.device_id=a.device_id;k(J,a,0);b(y,a).call(a,"cly_id", a.device_id);b(y,a).call(a,"cly_id_type",0);b(e,a).call(a,f.INFO,"change_id, Changing ID from:["+g+"] to ["+c+"]");d?b(W,a).call(a,{old_device_id:g}):a.begin_session(!b(La,a),!0);a.remote_config&&(k(V,a,{}),b(y,a).call(a,"cly_remote_configs",b(V,a)),a.fetch_remote_config(a.remote_config))}else b(e,a).call(a,f.WARNING,"change_id, The provided device ID is not a valid ID")});x(this,"add_event",function(c){b(e,a).call(a,f.INFO,"add_event, Adding event: ",c);switch(c.key){case R.NPS:var d=a.check_consent("feedback"); break;case R.SURVEY:d=a.check_consent("feedback");break;case R.STAR_RATING:d=a.check_consent("star-rating");break;case R.VIEW:d=a.check_consent("views");break;case R.ORIENTATION:d=a.check_consent("users");break;case R.ACTION:d=a.check_consent("clicks")||a.check_consent("scrolls");break;default:d=b(Pb,a)?a.check_consent("events"):!1}d&&b(da,a).call(a,c)});x(this,"attempt_to_send_stored_requests",function(){b(e,a).call(a,f.INFO,"attemptToSendStoredRequests, Attempting to send stored requests");b(Ba, a).call(a);b(Aa,a).call(a)});x(this,"test_mode_rq",function(c){b(e,a).call(a,f.INFO,"test_mode_rq, Setting test mode to: ["+c+"]");a.test_mode=c});p(this,da,function(c,d){if(a.ignore_visitor||!b(lb,a))b(e,a).call(a,f.WARNING,"Not adding the event. Tracking is disabled by the server config:["+!b(lb,a)+"] or ignore_visitor is:["+a.ignore_visitor+"]");else if(c.key){c.count||(c.count=1);rd.includes(c.key)||(c.key=C(c.key,b(K,a),"add_cly_event",b(e,a)));c.segmentation=ra(c.segmentation,b(K,a),b(H,a), b(Y,a),"add_cly_event",b(e,a));c=pb(c,["key","count","sum","dur","segmentation"]);c.timestamp=$a();var g=new Date;c.hour=g.getHours();c.dow=g.getDay();c.id=d||nc();c.key===R.VIEW?c.pvid=b(gb,a)||"":c.cvid=b(va,a)||"";b(O,a).push(c);b(y,a).call(a,"cly_event",b(O,a));b(e,a).call(a,f.INFO,"With event ID: ["+c.id+"], successfully adding the last event:",c)}else b(e,a).call(a,f.ERROR,"Adding event failed. Event must have a key property")});x(this,"start_event",function(c){c&&"string"===typeof c?(b(e,a).call(a, f.INFO,"start_event, Starting timed event with key: ["+c+"]"),c=C(c,b(K,a),"start_event",b(e,a)),b(fa,a)[c]?b(e,a).call(a,f.WARNING,"start_event, Timed event with key: ["+c+"] already started"):b(fa,a)[c]=I()):b(e,a).call(a,f.WARNING,"start_event, you have to provide a valid string key instead of: ["+c+"]")});x(this,"cancel_event",function(c){if(!c||"string"!==typeof c)return b(e,a).call(a,f.WARNING,"cancel_event, you have to provide a valid string key instead of: ["+c+"]"),!1;b(e,a).call(a,f.INFO, "cancel_event, Canceling timed event with key: ["+c+"]");c=C(c,b(K,a),"cancel_event",b(e,a));if(b(fa,a)[c])return delete b(fa,a)[c],b(e,a).call(a,f.INFO,"cancel_event, Timed event with key: ["+c+"] is canceled"),!0;b(e,a).call(a,f.WARNING,"cancel_event, Timed event with key: ["+c+"] was not found");return!1});x(this,"end_event",function(c){c?(b(e,a).call(a,f.INFO,"end_event, Ending timed event"),"string"===typeof c&&(c=C(c,b(K,a),"end_event",b(e,a)),c={key:c}),c.key?b(fa,a)[c.key]?(c.dur=I()-b(fa, a)[c.key],a.add_event(c),delete b(fa,a)[c.key]):b(e,a).call(a,f.ERROR,"end_event, Timed event with key: ["+c.key+"] was not started"):b(e,a).call(a,f.ERROR,"end_event, Timed event must have a key property")):b(e,a).call(a,f.WARNING,"end_event, you have to provide a valid string key or event object instead of: ["+c+"]")});p(this,yc,function(c){b(e,a).call(a,f.INFO,"report_orientation, Reporting orientation");a.check_consent("users")&&b(da,a).call(a,{key:R.ORIENTATION,segmentation:{mode:c||(window.innerWidth> window.innerHeight?"landscape":"portrait")}})});x(this,"report_conversion",function(c,d){b(e,a).call(a,f.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!");a.recordDirectAttribution(c,d)});x(this,"recordDirectAttribution",function(c,d){b(e,a).call(a,f.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+c+"] and the user ID: ["+d+"]");a.check_consent("attribution")&&(c=c||b(B,a).call(a,"cly_cmp_id")|| "cly_organic",(d=d||b(B,a).call(a,"cly_cmp_uid"))?b(W,a).call(a,{campaign_id:c,campaign_user:d}):b(W,a).call(a,{campaign_id:c}))});x(this,"user_details",function(c){b(e,a).call(a,f.INFO,"user_details, Trying to add user details: ",c);a.check_consent("users")&&(b(Ba,a).call(a),b(Aa,a).call(a),b(e,a).call(a,f.INFO,"user_details, flushed the event queue"),c.name=C(c.name,b(H,a),"user_details",b(e,a)),c.username=C(c.username,b(H,a),"user_details",b(e,a)),c.email=C(c.email,b(H,a),"user_details",b(e,a)), c.organization=C(c.organization,b(H,a),"user_details",b(e,a)),c.phone=C(c.phone,b(H,a),"user_details",b(e,a)),c.picture=C(c.picture,4096,"user_details",b(e,a)),c.gender=C(c.gender,b(H,a),"user_details",b(e,a)),c.byear=C(c.byear,b(H,a),"user_details",b(e,a)),c.custom=ra(c.custom,b(K,a),b(H,a),b(Y,a),"user_details",b(e,a)),b(W,a).call(a,{user_details:JSON.stringify(pb(c,"name username email organization phone picture gender byear custom".split(" ")))}))});p(this,ja,{});p(this,qa,function(c,d,g){a.check_consent("users")&& (b(ja,a)[c]||(b(ja,a)[c]={}),"$push"===g||"$pull"===g||"$addToSet"===g?(b(ja,a)[c][g]||(b(ja,a)[c][g]=[]),b(ja,a)[c][g].push(d)):b(ja,a)[c][g]=d)});x(this,"userData",{set:function(c,d){b(e,a).call(a,f.INFO,"[userData] set, Setting user's custom property value: ["+d+"] under the key: ["+c+"]");c=C(c,b(K,a),"userData set",b(e,a));d=C(d,b(H,a),"userData set",b(e,a));b(ja,a)[c]=d},unset:function(c){b(e,a).call(a,f.INFO,"[userData] unset, Resetting user's custom property with key: ["+c+"] ");b(ja,a)[c]= ""},set_once:function(c,d){b(e,a).call(a,f.INFO,"[userData] set_once, Setting user's unique custom property value: ["+d+"] under the key: ["+c+"] ");c=C(c,b(K,a),"userData set_once",b(e,a));d=C(d,b(H,a),"userData set_once",b(e,a));b(qa,a).call(a,c,d,"$setOnce")},increment:function(c){b(e,a).call(a,f.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+c+"] by one");c=C(c,b(K,a),"userData increment",b(e,a));b(qa,a).call(a,c,1,"$inc")},increment_by:function(c,d){b(e, a).call(a,f.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+c+"] by: ["+d+"]");c=C(c,b(K,a),"userData increment_by",b(e,a));d=C(d,b(H,a),"userData increment_by",b(e,a));b(qa,a).call(a,c,d,"$inc")},multiply:function(c,d){b(e,a).call(a,f.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+c+"] by: ["+d+"]");c=C(c,b(K,a),"userData multiply",b(e,a));d=C(d,b(H,a),"userData multiply",b(e,a));b(qa,a).call(a,c,d,"$mul")},max:function(c, d){b(e,a).call(a,f.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+d+"] under the key: ["+c+"]");c=C(c,b(K,a),"userData max",b(e,a));d=C(d,b(H,a),"userData max",b(e,a));b(qa,a).call(a,c,d,"$max")},min:function(c,d){b(e,a).call(a,f.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+d+"] under the key: ["+c+"]");c=C(c,b(K,a),"userData min",b(e,a));d=C(d,b(H,a),"userData min",b(e,a));b(qa,a).call(a,c,d,"$min")},push:function(c, d){b(e,a).call(a,f.INFO,"[userData] push, Pushing a value: ["+d+"] under the key: ["+c+"] to user's custom property array");c=C(c,b(K,a),"userData push",b(e,a));d=C(d,b(H,a),"userData push",b(e,a));b(qa,a).call(a,c,d,"$push")},push_unique:function(c,d){b(e,a).call(a,f.INFO,"[userData] push_unique, Pushing a unique value: ["+d+"] under the key: ["+c+"] to user's custom property array");c=C(c,b(K,a),"userData push_unique",b(e,a));d=C(d,b(H,a),"userData push_unique",b(e,a));b(qa,a).call(a,c,d,"$addToSet")}, pull:function(c,d){b(e,a).call(a,f.INFO,"[userData] pull, Removing the value: ["+d+"] under the key: ["+c+"] from user's custom property array");b(qa,a).call(a,c,d,"$pull")},save:function(){b(e,a).call(a,f.INFO,"[userData] save, Saving changes to user's custom property");a.check_consent("users")&&(b(Ba,a).call(a),b(Aa,a).call(a),b(e,a).call(a,f.INFO,"user_details, flushed the event queue"),b(W,a).call(a,{user_details:JSON.stringify({custom:b(ja,a)})}));k(ja,a,{})}});x(this,"report_trace",function(c){b(e, a).call(a,f.INFO,"report_trace, Reporting performance trace");if(a.check_consent("apm")){for(var d="type name stz etz apm_metrics apm_attr".split(" "),g=0;g<d.length;g++)if("apm_attr"!==d[g]&&"undefined"===typeof c[d[g]]){b(e,a).call(a,f.WARNING,"report_trace, APM trace don't have the property: "+d[g]);return}c.name=C(c.name,b(K,a),"report_trace",b(e,a));c.app_metrics=ra(c.app_metrics,b(K,a),b(H,a),b(Y,a),"report_trace",b(e,a));d=pb(c,d);d.timestamp=c.stz;c=new Date;d.hour=c.getHours();d.dow=c.getDay(); b(W,a).call(a,{apm:JSON.stringify(d)});b(e,a).call(a,f.INFO,"report_trace, Successfully adding APM trace: ",d)}});x(this,"track_errors",function(c){A?b(zb,a)?(b(e,a).call(a,f.INFO,"track_errors, Started tracking errors"),t.i[a.app_key].tracking_crashes=!0,window.cly_crashes||(window.cly_crashes=!0,k(sb,a,c),window.addEventListener("error",function(d){if(d.error)pc(d.error,!1);else{var g=d.filename||"",h=d.lineno||0,n=d.colno||0;d=(d.message||"Unknown error")+"\n";g&&(d+="at "+g);h&&(d+=":"+h);n&& (d+=":"+n);d+="\n";pc(d+"",!1)}}),window.addEventListener("unhandledrejection",function(d){pc(Error("Unhandled rejection (reason: "+(d.reason&&d.reason.stack?d.reason.stack:d.reason)+")."),!0)}))):b(e,a).call(a,f.WARNING,"track_errors, Crash tracking is disabled by the server config. Not tracking errors."):b(e,a).call(a,f.WARNING,"track_errors, window object is not available. Not tracking errors.")});x(this,"log_error",function(c,d){b(e,a).call(a,f.INFO,"log_error, Logging errors");a.recordError(c, !0,d)});x(this,"add_log",function(c){b(e,a).call(a,f.INFO,"add_log, Adding a new log of breadcrumbs: [ "+c+" ]");if(a.check_consent("crashes")){for(c=C(c,b(H,a),"add_log",b(e,a));b(sa,a).length>=b(Va,a);)b(sa,a).shift(),b(e,a).call(a,f.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");b(sa,a).push(c)}});x(this,"fetch_remote_config",function(c,d,g){var h=null,n=null,l=null;c&&(g||"function"!==typeof c?Array.isArray(c)&&(h=c):l=c);d&&(g||"function"!==typeof d?Array.isArray(d)&& (n=d):l=d);l||"function"!==typeof g||(l=g);a.useExplicitRcApi?(b(e,a).call(a,f.INFO,"fetch_remote_config, Fetching remote config"),c=a.rcAutoOptinAb?1:0,b(zc,a).call(a,h,n,c,null,l)):(b(e,a).call(a,f.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),b(zc,a).call(a,h,n,null,"legacy",l))});p(this,zc,function(c,d,g,h,n){b(e,a).call(a,f.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var l={method:"rc",av:a.app_version};c&&(l.keys=JSON.stringify(c));d&&(l.omit_keys= JSON.stringify(d));var r;"legacy"===h&&(l.method="fetch_remote_config");0===g&&(l.oi=0);1===g&&(l.oi=1);"function"===typeof n&&(r=n);a.check_consent("sessions")&&(l.metrics=JSON.stringify(b(Eb,a).call(a)));a.check_consent("remote-config")?(b(Ya,a).call(a,l),b(ea,a).call(a,"fetch_remote_config_explicit",a.url+b(Ka,a),l,function(u,z,D){if(!u){try{var S=JSON.parse(D);if(l.keys||l.omit_keys)for(var T in S)b(V,a)[T]=S[T];else k(V,a,S);b(y,a).call(a,"cly_remote_configs",b(V,a))}catch(Ca){b(e,a).call(a, f.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+Ca)}r&&(b(e,a).call(a,f.INFO,"fetch_remote_config_explicit, Callback function is provided"),r(u,b(V,a)))}},!0)):(b(e,a).call(a,f.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),r&&r(Error("Remote config requires explicit consent"),b(V,a)))});x(this,"enrollUserToAb",function(c){b(e,a).call(a,f.INFO,"enrollUserToAb, Providing AB test keys to opt in for");c&&Array.isArray(c)&&0!==c.length? (c={method:"ab",keys:JSON.stringify(c),av:a.app_version},b(Ya,a).call(a,c),b(ea,a).call(a,"enrollUserToAb",a.url+b(Ka,a),c,function(d,g,h){if(!d)try{var n=JSON.parse(h);b(e,a).call(a,f.DEBUG,"enrollUserToAb, Parsed the response's result: ["+n.result+"]")}catch(l){b(e,a).call(a,f.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+l)}},!0)):b(e,a).call(a,f.ERROR,"enrollUserToAb, No keys provided")});x(this,"get_remote_config",function(c){b(e,a).call(a,f.INFO,"get_remote_config, Getting remote config from storage"); return"undefined"!==typeof c?b(V,a)[c]:b(V,a)});p(this,Ac,function(){b(e,a).call(a,f.INFO,"stop_time, Stopping tracking duration");b(ta,a)&&(k(ta,a,!1),k(tb,a,I()-b(la,a)),k(Na,a,I()-b(Ma,a)))});p(this,bc,function(){b(e,a).call(a,f.INFO,"start_time, Starting tracking duration");b(ta,a)||(k(ta,a,!0),k(la,a,I()-b(tb,a)),k(Ma,a,I()-b(Na,a)),k(Na,a,0),b(Ec,a).call(a))});x(this,"track_sessions",function(){if(A){b(e,a).call(a,f.INFO,"track_session, Starting tracking user session");a.begin_session();b(bc, a).call(a);E(window,"beforeunload",function(){b(Ba,a).call(a);b(Aa,a).call(a);a.end_session()});var c="hidden",d=function(){document[c]||!document.hasFocus()?b(Ac,a).call(a):b(bc,a).call(a)};E(window,"focus",d);E(window,"blur",d);E(window,"pageshow",d);E(window,"pagehide",d);"onfocusin"in document&&(E(window,"focusin",d),E(window,"focusout",d));c in document?document.addEventListener("visibilitychange",d):"mozHidden"in document?(c="mozHidden",document.addEventListener("mozvisibilitychange",d)):"webkitHidden"in document?(c="webkitHidden",document.addEventListener("webkitvisibilitychange",d)):"msHidden"in document&&(c="msHidden",document.addEventList