diff --git a/lib/countly.min.js b/lib/countly.min.js index 3e8ea582..abdc1c04 100644 --- a/lib/countly.min.js +++ b/lib/countly.min.js @@ -1,158 +1,158 @@ -(function(la,L){"object"===typeof exports&&"undefined"!==typeof module?L(exports):"function"===typeof define&&define.amd?define(["exports"],L):(la="undefined"!==typeof globalThis?globalThis:la||self,L(la.Countly=la.Countly||{}))})(this,function(la){function L(l){"@babel/helpers - typeof";return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(k){return typeof k}:function(k){return k&&"function"==typeof Symbol&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},L(l)} -function zb(l,k){for(var q=0;q=l?Qa++:Qa=l;return Qa}function t(l,k,q){if(k&&Object.keys(k).length){if("undefined"!==typeof k[l])return k[l]}else if("undefined"!==typeof p[l])return p[l];return q}function jb(l,k,q){for(var v in p.i)p.i[v].tracking_crashes&&p.i[v].recordError(l,k,q)}function za(l){var k=[],q;for(q in l)k.push(q+"="+encodeURIComponent(l[q]));return k.join("&")}function ta(l){return"string"===typeof l&&"/"===l.substring(l.length-1)?l.substring(0,l.length-1):l}function Aa(l,k){for(var q={},v,G=0,Q=k.length;Gv){var V={},Ba=0,ma;for(ma in l)Bak&&(G=l.substring(0,k),v(c.DEBUG,q+", Key: [ "+l+" ] is longer than accepted length. It will be truncated."));return G}function A(l,k,q){x&&(null===l||"undefined"=== -typeof l?Da()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+k+"] event to nonexisting element"):"undefined"!==typeof l.addEventListener?l.addEventListener(k,q,!1):l.attachEvent("on"+k,q))}function Ra(l){return l?"undefined"!==typeof l.target?l.target:l.srcElement:window.event.srcElement}function ua(l){if(l)return l;(l=navigator.userAgent)||(l=kb());return l}function kb(l){if(l)return l;l="";navigator.userAgentData&&(l=navigator.userAgentData.brands.map(function(k){return k.brand+ -":"+k.version}).join(),l+=navigator.userAgentData.mobile?" mobi ":" ",l+=navigator.userAgentData.platform);return l}function Cb(l){if(!l){if(navigator.userAgentData&&navigator.userAgentData.mobile)return"phone";l=ua()}l=l.toLowerCase();var k="desktop",q=/(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(l)? -k="tablet":q.test(l)&&(k="phone");return k}function Db(l){var k=/(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(l)return k.test(l);l=k.test(ua());k=k.test(kb());return l||k}function lb(l){"undefined"===typeof l.pageY&&"number"===typeof l.clientX&&document.documentElement&&(l.pageX=l.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l.pageY=l.clientY+document.body.scrollTop+document.documentElement.scrollTop);return l}function Sa(){var l=document;return Math.max(Math.max(l.body.scrollHeight,l.documentElement.scrollHeight),Math.max(l.body.offsetHeight,l.documentElement.offsetHeight),Math.max(l.body.clientHeight, -l.documentElement.clientHeight))}function mb(){var l=document;return Math.max(Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),Math.max(l.body.offsetWidth,l.documentElement.offsetWidth),Math.max(l.body.clientWidth,l.documentElement.clientWidth))}function Eb(){var l=document;return Math.min(Math.min(l.body.clientHeight,l.documentElement.clientHeight),Math.min(l.body.offsetHeight,l.documentElement.offsetHeight),window.innerHeight)}function Fb(l,k,q,v,G,Q){l=document.createElement(l);var O; -l.setAttribute(k,q);l.setAttribute(v,G);k=function(){O||Q();O=!0};Q&&(l.onreadystatechange=k,l.onload=k);document.getElementsByTagName("head")[0].appendChild(l)}function Gb(l,k){Fb("script","type","text/javascript","src",l,k)}function Ta(l,k){Fb("link","rel","stylesheet","href",l,k)}function Hb(){if(x){var l=document.getElementById("cly-loader");if(!l){var k=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText= +(function(ma,L){"object"===typeof exports&&"undefined"!==typeof module?L(exports):"function"===typeof define&&define.amd?define(["exports"],L):(ma="undefined"!==typeof globalThis?globalThis:ma||self,L(ma.Countly=ma.Countly||{}))})(this,function(ma){function L(l){"@babel/helpers - typeof";return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(k){return typeof k}:function(k){return k&&"function"==typeof Symbol&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},L(l)} +function zb(l,k){for(var q=0;q=l?Pa++:Pa=l;return Pa}function u(l,k,q){if(k&&Object.keys(k).length){if("undefined"!==typeof k[l])return k[l]}else if("undefined"!==typeof p[l])return p[l];return q}function ib(l,k,q){for(var t in p.i)p.i[t].tracking_crashes&&p.i[t].recordError(l,k,q)}function jb(l,k){var q=[],t;for(t in l)q.push(t+"="+encodeURIComponent(l[t]));var C=q.join("&");return k?Cb(C,k).then(function(O){return C+="&checksum256="+O}):Promise.resolve(C)}function ta(l){return"string"===typeof l&&"/"===l.substring(l.length- +1)?l.substring(0,l.length-1):l}function za(l,k){for(var q={},t,C=0,O=k.length;Ct){var W={},Aa=0,na;for(na in l)Aak&&(C=l.substring(0,k),t(c.DEBUG,q+", Key: [ "+l+" ] is longer than accepted length. It will be truncated.")); +return C}function Cb(l,k){l=(new TextEncoder).encode(l+k);return crypto.subtle.digest("SHA-256",l).then(function(q){return Array.from(new Uint8Array(q)).map(function(t){return t.toString(16).padStart(2,"0")}).join("")})}function A(l,k,q){x&&(null===l||"undefined"===typeof l?Ca()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+k+"] event to nonexisting element"):"undefined"!==typeof l.addEventListener?l.addEventListener(k,q,!1):l.attachEvent("on"+k,q))}function Qa(l){return l? +"undefined"!==typeof l.target?l.target:l.srcElement:window.event.srcElement}function ua(l){if(l)return l;(l=navigator.userAgent)||(l=kb());return l}function kb(l){if(l)return l;l="";navigator.userAgentData&&(l=navigator.userAgentData.brands.map(function(k){return k.brand+":"+k.version}).join(),l+=navigator.userAgentData.mobile?" mobi ":" ",l+=navigator.userAgentData.platform);return l}function Db(l){if(!l){if(navigator.userAgentData&&navigator.userAgentData.mobile)return"phone";l=ua()}l=l.toLowerCase(); +var k="desktop",q=/(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(l)?k="tablet":q.test(l)&&(k="phone");return k}function Eb(l){var k=/(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(l)return k.test(l);l=k.test(ua());k=k.test(kb());return l||k}function lb(l){"undefined"===typeof l.pageY&&"number"===typeof l.clientX&&document.documentElement&&(l.pageX=l.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l.pageY=l.clientY+document.body.scrollTop+document.documentElement.scrollTop);return l}function Ra(){var l=document;return Math.max(Math.max(l.body.scrollHeight,l.documentElement.scrollHeight),Math.max(l.body.offsetHeight,l.documentElement.offsetHeight),Math.max(l.body.clientHeight, +l.documentElement.clientHeight))}function mb(){var l=document;return Math.max(Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),Math.max(l.body.offsetWidth,l.documentElement.offsetWidth),Math.max(l.body.clientWidth,l.documentElement.clientWidth))}function Fb(){var l=document;return Math.min(Math.min(l.body.clientHeight,l.documentElement.clientHeight),Math.min(l.body.offsetHeight,l.documentElement.offsetHeight),window.innerHeight)}function Gb(l,k,q,t,C,O){l=document.createElement(l);var Q; +l.setAttribute(k,q);l.setAttribute(t,C);k=function(){Q||O();Q=!0};O&&(l.onreadystatechange=k,l.onload=k);document.getElementsByTagName("head")[0].appendChild(l)}function Hb(l,k){Gb("script","type","text/javascript","src",l,k)}function Sa(l,k){Gb("link","rel","stylesheet","href",l,k)}function Ib(){if(x){var l=document.getElementById("cly-loader");if(!l){var k=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.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%;}}":q.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%;}}")); -k.appendChild(q);l=document.createElement("div");l.setAttribute("id","cly-loader");document.body.onload=function(){if(p.showLoaderProtection)Da()&&console.warn("[WARNING] [Countly] showloader, Loader is already on");else try{document.body.appendChild(l)}catch(v){Da()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+v)}}}l.style.display="block"}}function Da(){return p&&p.debug&&"undefined"!==typeof console?!0:!1}function Ib(){if(x){p.showLoaderProtection=!0; -var l=document.getElementById("cly-loader");l&&(l.style.display="none")}}function Wb(l){var k=document.createElement("script"),q=document.createElement("script");k.async=!0;q.async=!0;k.src=p.customSourceBoomerang||Jb.BOOMERANG_SRC;q.src=p.customSourceCountlyBoomerang||Jb.CLY_BOOMERANG_SRC;document.getElementsByTagName("head")[0].appendChild(k);document.getElementsByTagName("head")[0].appendChild(q);var v=!1,G=!1;k.onload=function(){v=!0};q.onload=function(){G=!0};var Q=0,O=setInterval(function(){Q+= -50;if(v&&G||1500<=Q){if(p.debug){var V="BoomerangJS loaded:["+v+"], countly_boomerang loaded:["+G+"].";v&&G?console.log("[DEBUG] "+V):console.warn("[WARNING] "+V+" Initializing without APM.")}p.init(l);clearInterval(O)}},50)}var M={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},Xb=Object.values(M),c={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},Jb={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"},T=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message"}),Kb=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,x="undefined"!==typeof window,p=globalThis.Countly||{}, -Qa=0,Tb=function(l,k,q){k&&zb(l.prototype,k);q&&zb(l,q);Object.defineProperty(l,"prototype",{writable:!1});return l}(function q(k){function v(a,d){if(f.ignore_visitor)b(c.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);Xb.includes(a.key)||(a.key=z(a.key,f.maxKeyLength,"add_cly_event",b));a.segmentation=aa(a.segmentation,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"add_cly_event",b);a=Aa(a,["key","count","sum","dur","segmentation"]);a.timestamp= -ib();var e=new Date;a.hour=e.getHours();a.dow=e.getDay();a.id=d||gb();a.key===M.VIEW?a.pvid=Ea||"":a.cvid=ha||"";J.push(a);w("cly_event",J);b(c.INFO,"With event ID: ["+a.id+"], successfully adding the last event:",a)}else b(c.ERROR,"Adding event failed. Event must have a key property")}function G(a,d,e,h,m){b(c.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var g={method:"rc",av:f.app_version};a&&(g.keys=JSON.stringify(a));d&&(g.omit_keys=JSON.stringify(d));var n;"legacy"===h&& -(g.method="fetch_remote_config");0===e&&(g.oi=0);1===e&&(g.oi=1);"function"===typeof m&&(n=m);f.check_consent("sessions")&&(g.metrics=JSON.stringify(Ua()));f.check_consent("remote-config")?(Fa(g),ba("fetch_remote_config_explicit",f.url+Va,g,function(r,u,I){if(!r){try{var C=JSON.parse(I);if(g.keys||g.omit_keys)for(var na in C)R[na]=C[na];else R=C;w("cly_remote_configs",R)}catch(Ga){b(c.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+Ga)}n&&(b(c.INFO,"fetch_remote_config_explicit, Callback function is provided"), -n(r,R))}},!0)):(b(c.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),n&&n(Error("Remote config requires explicit consent"),R))}function Q(){b(c.INFO,"checkIgnore, Checking if user or visit should be ignored");f.ignore_prefetch&&x&&"undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState&&(f.ignore_visitor=!0,b(c.DEBUG,"checkIgnore, Ignoring visit due to prerendering"));f.ignore_bots&&Db()&&(f.ignore_visitor=!0,b(c.DEBUG,"checkIgnore, Ignoring visit due to bot"))} -function O(){0a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color;u.style.backgroundColor=7>a.trigger_bg_color.length?"#"+a.trigger_bg_color:a.trigger_bg_color;u.className="countly-feedback-sticker "+a.trigger_position+"-"+a.trigger_size;u.id="countly-feedback-sticker-"+a._id;g.appendChild(n);u.appendChild(g);u.appendChild(r);document.body.appendChild(u);var I=document.getElementById("smileyPathInStickerSvg"); -I&&(I.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);A(document.getElementById("countly-feedback-sticker-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block";document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(C){b(c.ERROR,"Somethings went wrong while element injecting process: "+ -C)}else b(c.WARNING,"processWidget, window object is not available. Not processing widget.")}function Ba(){var a;if("undefined"!==typeof f.onload&&0Wa&&H.shift(),H.push(a),w("cly_queue",H,!0)):b(c.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)}function Xa(){Ba();if(f.ignore_visitor)Ya=!1,b(c.WARNING,"User opt_out, no heartbeat");else{Ya=!0;Za&&"undefined"!==typeof p.q&&0$a&&(f.session_duration(a-ja),ja=a,0nb&&(ab=!1,a=H[0],a.rr=H.length,b(c.DEBUG,"Processing request",a),w("cly_queue",H,!0),f.test_mode||ba("send_request_queue",f.url+ob,a,function(d,e){d?nb=F()+bb:H.shift();w("cly_queue",H,!0);ab=!0},!1));setTimeout(Xa,cb)}}function wa(){if("undefined"===typeof p||"undefined"===typeof p.i)b(c.DEBUG,"Countly is not finished initialization yet, will process the queue after initialization is done"); +var r=document.createElement("span");r.innerText=a.trigger_button_text;var v=document.createElement("div");v.style.color=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color;v.style.backgroundColor=7>a.trigger_bg_color.length?"#"+a.trigger_bg_color:a.trigger_bg_color;v.className="countly-feedback-sticker "+a.trigger_position+"-"+a.trigger_size;v.id="countly-feedback-sticker-"+a._id;g.appendChild(n);v.appendChild(g);v.appendChild(r);document.body.appendChild(v);var G=document.getElementById("smileyPathInStickerSvg"); +G&&(G.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);A(document.getElementById("countly-feedback-sticker-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block";document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(N){b(c.ERROR,"Somethings went wrong while element injecting process: "+ +N)}else b(c.WARNING,"processWidget, window object is not available. Not processing widget.")}function Aa(){var a;if("undefined"!==typeof f.onload&&0Va&&H.shift(),H.push(a),w("cly_queue",H,!0)):b(c.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)}function Wa(){Aa();if(f.ignore_visitor)Xa=!1,b(c.WARNING,"User opt_out, no heartbeat");else{Xa=!0;Ya&&"undefined"!==typeof p.q&&0Za&&(f.session_duration(a-ka),ka=a,0nb&&($a=!1,a=H[0],a.rr=H.length,b(c.DEBUG,"Processing request",a),w("cly_queue",H,!0),f.test_mode||ca("send_request_queue",f.url+ob,a,function(d,e){d?nb=F()+ab:H.shift();w("cly_queue",H,!0);$a=!0},!1));setTimeout(Wa,bb)}}function wa(){if("undefined"===typeof p||"undefined"===typeof p.i)b(c.DEBUG,"Countly is not finished initialization yet, will process the queue after initialization is done"); else{var a=p.q;p.q=[];for(var d=0;da))return b(c.ERROR,"Http response status code:["+a+"] is not within the expected range"), -!1;try{var e=JSON.parse(d);return"[object Object]"!==Object.prototype.toString.call(e)?(b(c.ERROR,"Http response is not JSON Object"),!1):!!e.result}catch(h){return b(c.ERROR,"Http response is not JSON: "+h),!1}}function rb(a,d){if(!(200<=a&&300>a))return b(c.ERROR,"Http response status code:["+a+"] is not within the expected range"),!1;try{var e=JSON.parse(d);return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)?!0:(b(c.ERROR,"Http response is not JSON Object nor JSON Array"), -!1)}catch(h){return b(c.ERROR,"Http response is not JSON: "+h),!1}}function Ob(){x?Ma=Math.max(Ma,window.scrollY,document.body.scrollTop,document.documentElement.scrollTop):b(c.WARNING,"processScroll, window object is not available. Not processing scroll.")}function tb(){if(!x)b(c.WARNING,"processScrollView, window object is not available. Not processing scroll view.");else if(Na){Na=!1;var a=Sa(),d=mb(),e=Eb();f.check_consent("scrolls")&&(a={type:"scroll",y:Ma+e,width:d,height:a,view:f.getViewUrl()}, -a=aa(a,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processScrollView",b),f.track_domains&&(a.domain=window.location.hostname),v({key:M.ACTION,segmentation:a}))}}function Pb(a){w("cly_token",a)}function Qb(a,d,e){var h=new Date;h.setTime(h.getTime()+864E5*e);e="; expires="+h.toGMTString();document.cookie=a+"="+d+e+"; path=/"}function y(a,d,e){if("none"===f.storage||"object"!==L(f.storage)&&!x)b(c.DEBUG,"Storage is disabled. Value with key: ["+a+"] won't be retrieved");else{e||(a=f.app_key+ +function qb(a){if(!x)return!1;a=a||document.referrer;var d=!1;if("undefined"===typeof a||0===a.length)b(c.DEBUG,"Invalid referrer:["+a+"], ignoring.");else{var e=Lb.exec(a);if(e)if(e[11])if(e[11]===window.location.hostname)b(c.DEBUG,"Referrer is current host:["+a+"], ignoring.");else if(da&&da.length)for(d=!0,e=0;ea))return b(c.ERROR,"Http response status code:["+ +a+"] is not within the expected range"),!1;try{var e=JSON.parse(d);return"[object Object]"!==Object.prototype.toString.call(e)?(b(c.ERROR,"Http response is not JSON Object"),!1):!!e.result}catch(h){return b(c.ERROR,"Http response is not JSON: "+h),!1}}function rb(a,d){if(!(200<=a&&300>a))return b(c.ERROR,"Http response status code:["+a+"] is not within the expected range"),!1;try{var e=JSON.parse(d);return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)?!0:(b(c.ERROR,"Http response is not JSON Object nor JSON Array"), +!1)}catch(h){return b(c.ERROR,"Http response is not JSON: "+h),!1}}function Pb(){x?La=Math.max(La,window.scrollY,document.body.scrollTop,document.documentElement.scrollTop):b(c.WARNING,"processScroll, window object is not available. Not processing scroll.")}function tb(){if(!x)b(c.WARNING,"processScrollView, window object is not available. Not processing scroll view.");else if(Ma){Ma=!1;var a=Ra(),d=mb(),e=Fb();f.check_consent("scrolls")&&(a={type:"scroll",y:La+e,width:d,height:a,view:f.getViewUrl()}, +a=ba(a,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processScrollView",b),f.track_domains&&(a.domain=window.location.hostname),t({key:M.ACTION,segmentation:a}))}}function Qb(a){w("cly_token",a)}function Rb(a,d,e){var h=new Date;h.setTime(h.getTime()+864E5*e);e="; expires="+h.toGMTString();document.cookie=a+"="+d+e+"; path=/"}function y(a,d,e){if("none"===f.storage||"object"!==L(f.storage)&&!x)b(c.DEBUG,"Storage is disabled. Value with key: ["+a+"] won't be retrieved");else{e||(a=f.app_key+ "/"+a,f.namespace&&(a=ta(f.namespace)+"/"+a));if("object"===L(f.storage)&&"function"===typeof f.storage.getItem){var h=f.storage.getItem(a);return a.endsWith("cly_id")?h:f.deserialize(h)}void 0===d&&(d=ra);if(d)h=localStorage.getItem(a);else if("localstorage"!==f.storage)a:{d=a+"=";e=document.cookie.split(";");h=0;for(var m=e.length;hwindow.innerHeight?"landscape":"portrait")}})};this.report_conversion=function(a,d){b(c.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!");this.recordDirectAttribution(a,d)};this.recordDirectAttribution=function(a,d){b(c.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+ -a+"] and the user ID: ["+d+"]");this.check_consent("attribution")&&(a=a||y("cly_cmp_id")||"cly_organic",(d=d||y("cly_cmp_uid"))?N({campaign_id:a,campaign_user:d}):N({campaign_id:a}))};this.user_details=function(a){b(c.INFO,"user_details, Trying to add user details: ",a);this.check_consent("users")&&(wa(),O(),b(c.INFO,"user_details, flushed the event queue"),a.name=z(a.name,f.maxValueSize,"user_details",b),a.username=z(a.username,f.maxValueSize,"user_details",b),a.email=z(a.email,f.maxValueSize,"user_details", -b),a.organization=z(a.organization,f.maxValueSize,"user_details",b),a.phone=z(a.phone,f.maxValueSize,"user_details",b),a.picture=z(a.picture,4096,"user_details",b),a.gender=z(a.gender,f.maxValueSize,"user_details",b),a.byear=z(a.byear,f.maxValueSize,"user_details",b),a.custom=aa(a.custom,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"user_details",b),N({user_details:JSON.stringify(Aa(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var Y={},fa=function(a, -d,e){f.check_consent("users")&&(Y[a]||(Y[a]={}),"$push"===e||"$pull"===e||"$addToSet"===e?(Y[a][e]||(Y[a][e]=[]),Y[a][e].push(d)):Y[a][e]=d)};this.userData={set:function(a,d){b(c.INFO,"[userData] set, Setting user's custom property value: ["+d+"] under the key: ["+a+"]");a=z(a,f.maxKeyLength,"userData set",b);d=z(d,f.maxValueSize,"userData set",b);Y[a]=d},unset:function(a){b(c.INFO,"[userData] unset, Resetting user's custom property with key: ["+a+"] ");Y[a]=""},set_once:function(a,d){b(c.INFO,"[userData] set_once, Setting user's unique custom property value: ["+ -d+"] under the key: ["+a+"] ");a=z(a,f.maxKeyLength,"userData set_once",b);d=z(d,f.maxValueSize,"userData set_once",b);fa(a,d,"$setOnce")},increment:function(a){b(c.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+a+"] by one");a=z(a,f.maxKeyLength,"userData increment",b);fa(a,1,"$inc")},increment_by:function(a,d){b(c.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+a+"] by: ["+d+"]");a=z(a,f.maxKeyLength,"userData increment_by", -b);d=z(d,f.maxValueSize,"userData increment_by",b);fa(a,d,"$inc")},multiply:function(a,d){b(c.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+a+"] by: ["+d+"]");a=z(a,f.maxKeyLength,"userData multiply",b);d=z(d,f.maxValueSize,"userData multiply",b);fa(a,d,"$mul")},max:function(a,d){b(c.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+d+"] under the key: ["+a+"]");a=z(a,f.maxKeyLength,"userData max",b);d=z(d,f.maxValueSize, -"userData max",b);fa(a,d,"$max")},min:function(a,d){b(c.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+d+"] under the key: ["+a+"]");a=z(a,f.maxKeyLength,"userData min",b);d=z(d,f.maxValueSize,"userData min",b);fa(a,d,"$min")},push:function(a,d){b(c.INFO,"[userData] push, Pushing a value: ["+d+"] under the key: ["+a+"] to user's custom property array");a=z(a,f.maxKeyLength,"userData push",b);d=z(d,f.maxValueSize,"userData push",b);fa(a,d,"$push")},push_unique:function(a, -d){b(c.INFO,"[userData] push_unique, Pushing a unique value: ["+d+"] under the key: ["+a+"] to user's custom property array");a=z(a,f.maxKeyLength,"userData push_unique",b);d=z(d,f.maxValueSize,"userData push_unique",b);fa(a,d,"$addToSet")},pull:function(a,d){b(c.INFO,"[userData] pull, Removing the value: ["+d+"] under the key: ["+a+"] from user's custom property array");fa(a,d,"$pull")},save:function(){b(c.INFO,"[userData] save, Saving changes to user's custom property");f.check_consent("users")&& -(wa(),O(),b(c.INFO,"user_details, flushed the event queue"),N({user_details:JSON.stringify({custom:Y})}));Y={}}};this.report_trace=function(a){b(c.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var d="type name stz etz apm_metrics apm_attr".split(" "),e=0;ewindow.innerHeight?"landscape":"portrait")}})};this.report_conversion=function(a,d){b(c.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!");this.recordDirectAttribution(a,d)};this.recordDirectAttribution=function(a,d){b(c.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+ +a+"] and the user ID: ["+d+"]");this.check_consent("attribution")&&(a=a||y("cly_cmp_id")||"cly_organic",(d=d||y("cly_cmp_uid"))?P({campaign_id:a,campaign_user:d}):P({campaign_id:a}))};this.user_details=function(a){b(c.INFO,"user_details, Trying to add user details: ",a);this.check_consent("users")&&(wa(),Q(),b(c.INFO,"user_details, flushed the event queue"),a.name=z(a.name,f.maxValueSize,"user_details",b),a.username=z(a.username,f.maxValueSize,"user_details",b),a.email=z(a.email,f.maxValueSize,"user_details", +b),a.organization=z(a.organization,f.maxValueSize,"user_details",b),a.phone=z(a.phone,f.maxValueSize,"user_details",b),a.picture=z(a.picture,4096,"user_details",b),a.gender=z(a.gender,f.maxValueSize,"user_details",b),a.byear=z(a.byear,f.maxValueSize,"user_details",b),a.custom=ba(a.custom,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"user_details",b),P({user_details:JSON.stringify(za(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var Z={},ha=function(a, +d,e){f.check_consent("users")&&(Z[a]||(Z[a]={}),"$push"===e||"$pull"===e||"$addToSet"===e?(Z[a][e]||(Z[a][e]=[]),Z[a][e].push(d)):Z[a][e]=d)};this.userData={set:function(a,d){b(c.INFO,"[userData] set, Setting user's custom property value: ["+d+"] under the key: ["+a+"]");a=z(a,f.maxKeyLength,"userData set",b);d=z(d,f.maxValueSize,"userData set",b);Z[a]=d},unset:function(a){b(c.INFO,"[userData] unset, Resetting user's custom property with key: ["+a+"] ");Z[a]=""},set_once:function(a,d){b(c.INFO,"[userData] set_once, Setting user's unique custom property value: ["+ +d+"] under the key: ["+a+"] ");a=z(a,f.maxKeyLength,"userData set_once",b);d=z(d,f.maxValueSize,"userData set_once",b);ha(a,d,"$setOnce")},increment:function(a){b(c.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+a+"] by one");a=z(a,f.maxKeyLength,"userData increment",b);ha(a,1,"$inc")},increment_by:function(a,d){b(c.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+a+"] by: ["+d+"]");a=z(a,f.maxKeyLength,"userData increment_by", +b);d=z(d,f.maxValueSize,"userData increment_by",b);ha(a,d,"$inc")},multiply:function(a,d){b(c.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+a+"] by: ["+d+"]");a=z(a,f.maxKeyLength,"userData multiply",b);d=z(d,f.maxValueSize,"userData multiply",b);ha(a,d,"$mul")},max:function(a,d){b(c.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+d+"] under the key: ["+a+"]");a=z(a,f.maxKeyLength,"userData max",b);d=z(d,f.maxValueSize, +"userData max",b);ha(a,d,"$max")},min:function(a,d){b(c.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+d+"] under the key: ["+a+"]");a=z(a,f.maxKeyLength,"userData min",b);d=z(d,f.maxValueSize,"userData min",b);ha(a,d,"$min")},push:function(a,d){b(c.INFO,"[userData] push, Pushing a value: ["+d+"] under the key: ["+a+"] to user's custom property array");a=z(a,f.maxKeyLength,"userData push",b);d=z(d,f.maxValueSize,"userData push",b);ha(a,d,"$push")},push_unique:function(a, +d){b(c.INFO,"[userData] push_unique, Pushing a unique value: ["+d+"] under the key: ["+a+"] to user's custom property array");a=z(a,f.maxKeyLength,"userData push_unique",b);d=z(d,f.maxValueSize,"userData push_unique",b);ha(a,d,"$addToSet")},pull:function(a,d){b(c.INFO,"[userData] pull, Removing the value: ["+d+"] under the key: ["+a+"] from user's custom property array");ha(a,d,"$pull")},save:function(){b(c.INFO,"[userData] save, Saving changes to user's custom property");f.check_consent("users")&& +(wa(),Q(),b(c.INFO,"user_details, flushed the event queue"),P({user_details:JSON.stringify({custom:Z})}));Z={}}};this.report_trace=function(a){b(c.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var d="type name stz etz apm_metrics apm_attr".split(" "),e=0;e=f.maxBreadcrumbCount;)sa.shift(),b(c.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");sa.push(a)}};this.fetch_remote_config=function(a,d,e){var h=null,m=null,g=null;a&&(e||"function"!==typeof a?Array.isArray(a)&& -(h=a):g=a);d&&(e||"function"!==typeof d?Array.isArray(d)&&(m=d):g=d);g||"function"!==typeof e||(g=e);this.useExplicitRcApi?(b(c.INFO,"fetch_remote_config, Fetching remote config"),G(h,m,this.rcAutoOptinAb?1:0,null,g)):(b(c.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),G(h,m,null,"legacy",g))};this.enrollUserToAb=function(a){b(c.INFO,"enrollUserToAb, Providing AB test keys to opt in for");a&&Array.isArray(a)&&0!==a.length?(a={method:"ab",keys:JSON.stringify(a),av:f.app_version}, -Fa(a),ba("enrollUserToAb",this.url+Va,a,function(d,e,h){if(!d)try{var m=JSON.parse(h);b(c.DEBUG,"enrollUserToAb, Parsed the response's result: ["+m.result+"]")}catch(g){b(c.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+g)}},!0)):b(c.ERROR,"enrollUserToAb, No keys provided")};this.get_remote_config=function(a){b(c.INFO,"get_remote_config, Getting remote config from storage");return"undefined"!==typeof a?R[a]:R};this.stop_time=function(){b(c.INFO,"stop_time, Stopping tracking duration"); -pa&&(pa=!1,vb=F()-ja,Ia=F()-Ha)};this.start_time=function(){b(c.INFO,"start_time, Starting tracking duration");pa||(pa=!0,ja=F()-vb,Ha=F()-Ia,Ia=0,Ca())};this.track_sessions=function(){function a(){document[e]||!document.hasFocus()?f.stop_time():f.start_time()}function d(){Pa>=Oa&&f.start_time();Pa=0}if(x){b(c.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();A(window,"beforeunload",function(){wa();O();f.end_session()});var e="hidden";A(window,"focus",a); +(h=a):g=a);d&&(e||"function"!==typeof d?Array.isArray(d)&&(m=d):g=d);g||"function"!==typeof e||(g=e);this.useExplicitRcApi?(b(c.INFO,"fetch_remote_config, Fetching remote config"),C(h,m,this.rcAutoOptinAb?1:0,null,g)):(b(c.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),C(h,m,null,"legacy",g))};this.enrollUserToAb=function(a){b(c.INFO,"enrollUserToAb, Providing AB test keys to opt in for");a&&Array.isArray(a)&&0!==a.length?(a={method:"ab",keys:JSON.stringify(a),av:f.app_version}, +Ea(a),ca("enrollUserToAb",this.url+Ua,a,function(d,e,h){if(!d)try{var m=JSON.parse(h);b(c.DEBUG,"enrollUserToAb, Parsed the response's result: ["+m.result+"]")}catch(g){b(c.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+g)}},!0)):b(c.ERROR,"enrollUserToAb, No keys provided")};this.get_remote_config=function(a){b(c.INFO,"get_remote_config, Getting remote config from storage");return"undefined"!==typeof a?S[a]:S};this.stop_time=function(){b(c.INFO,"stop_time, Stopping tracking duration"); +pa&&(pa=!1,vb=F()-ka,Ha=F()-Ga)};this.start_time=function(){b(c.INFO,"start_time, Starting tracking duration");pa||(pa=!0,ka=F()-vb,Ga=F()-Ha,Ha=0,Ba())};this.track_sessions=function(){function a(){document[e]||!document.hasFocus()?f.stop_time():f.start_time()}function d(){Oa>=Na&&f.start_time();Oa=0}if(x){b(c.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();A(window,"beforeunload",function(){wa();Q();f.end_session()});var e="hidden";A(window,"focus",a); A(window,"blur",a);A(window,"pageshow",a);A(window,"pagehide",a);"onfocusin"in document&&(A(window,"focusin",a),A(window,"focusout",a));e in document?document.addEventListener("visibilitychange",a):"mozHidden"in document?(e="mozHidden",document.addEventListener("mozvisibilitychange",a)):"webkitHidden"in document?(e="webkitHidden",document.addEventListener("webkitvisibilitychange",a)):"msHidden"in document&&(e="msHidden",document.addEventListener("msvisibilitychange",a));A(window,"mousemove",d);A(window, -"click",d);A(window,"keydown",d);A(window,"scroll",d);setInterval(function(){Pa++;Pa>=Oa&&f.stop_time()},6E4)}else b(c.WARNING,"track_sessions, window object is not available. Not tracking sessions.")};this.track_pageview=function(a,d,e){if(x||a)if(b(c.INFO,"track_pageview, Tracking page views"),b(c.VERBOSE,"track_pageview, last view is:["+X+"], current view ID is:["+ha+"], previous view ID is:["+Ea+"]"),X&&wb&&(b(c.DEBUG,"track_pageview, Scroll registry triggered"),tb(),Na=!0,Ma=0),ma(),Ea=ha,ha= -gb(),(a=z(a,f.maxKeyLength,"track_pageview",b))&&Array.isArray(a)&&(d=a,a=null),a||(a=this.getViewName()),void 0===a||""===a)b(c.ERROR,"track_pageview, No page name to track (it is either undefined or empty string). No page view can be tracked.");else if(null===a)b(c.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else{if(d&&d.length)for(var h=0;h