countly-sdk-web 23.6.2 → 23.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 23.6.3
2
+ - You can now add segmentation while presenting a widget with 'present_feedback_widget'
3
+
1
4
  ## 23.6.2
2
5
  - Adding app version information to every request
3
6
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Codacy Badge](https://app.codacy.com/project/badge/Grade/79582b7ee7ca4021a3950376402fac00)](https://www.codacy.com/gh/Countly/countly-sdk-web/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Countly/countly-sdk-web&utm_campaign=Badge_Grade)
1
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/79582b7ee7ca4021a3950376402fac00)](https://app.codacy.com/gh/Countly/countly-sdk-web/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
2
2
  [![npm version](https://badge.fury.io/js/countly-sdk-web.svg)](https://badge.fury.io/js/countly-sdk-web)
3
3
  [![js delivr](https://data.jsdelivr.com/v1/package/npm/countly-sdk-web/badge)](https://www.jsdelivr.com/package/npm/countly-sdk-web)
4
4
 
Binary file
@@ -30,30 +30,27 @@
30
30
  }
31
31
 
32
32
  // Decide which which widget to show. Here the first rating widget is selected.
33
- var i = countlyPresentableFeedback.length - 1;
34
- var countlyFeedbackWidget = countlyPresentableFeedback[0];
35
- while (i--) {
36
- // You can change 'rating' to 'nps' or 'survey'. Or you can create your own logic here.
37
- if (countlyPresentableFeedback[i].type === 'rating') {
38
- countlyFeedbackWidget = countlyPresentableFeedback[i];
39
- break;
40
- }
33
+ const widgetType = "rating";
34
+ const countlyFeedbackWidget = countlyPresentableFeedback.find(widget => widget.type === widgetType);
35
+ if (!countlyFeedbackWidget) {
36
+ console.error(`[Countly] No ${widgetType} widget found`);
37
+ return;
41
38
  }
42
39
 
43
40
  // Define the element ID and the class name (optional)
44
- var selectorId = "";
45
- var selectorClass = "";
41
+ const selectorId = "";
42
+ const selectorClass = "";
43
+
44
+ // Define the segmentation (optional)
45
+ const segmentation = { page: "home_page" };
46
46
 
47
47
  // Display the feedback widget to the end user
48
- Countly.present_feedback_widget(countlyFeedbackWidget, selectorId, selectorClass);
48
+ Countly.present_feedback_widget(countlyFeedbackWidget, selectorId, selectorClass, segmentation);
49
49
  }
50
50
 
51
-
52
51
  //=================================================
53
52
  // Fetching and reporting feedback widgets manually
54
53
  //=================================================
55
- var CountlyFeedbackWidget;
56
- var CountlyWidgetData;
57
54
  // an example of getting the widget list, using it to get widget data and then recording data for it manually. widgetType can be 'nps', 'survey' or 'rating'
58
55
  function getFeedbackWidgetListAndDoThings(widgetType) {
59
56
  // get the widget list
@@ -66,43 +63,36 @@
66
63
  }
67
64
 
68
65
  // find the widget object with the given widget type. This or a similar implementation can be used while using fetchAndDisplayWidget() as well
69
- var i = feedbackList.length - 1;
70
- while (i--) {
71
- if (feedbackList[i].type === widgetType) {
72
- CountlyFeedbackWidget = feedbackList[i];
73
- break;
74
- }
66
+ const countlyFeedbackWidget = feedbackList.find(widget => widget.type === widgetType);
67
+ if (!countlyFeedbackWidget) {
68
+ console.error(`[Countly] No ${widgetType} widget found`);
69
+ return;
75
70
  }
76
71
 
77
- // if the widget object is found
78
- if (CountlyFeedbackWidget) {
79
- // Get data with the widget object
80
- Countly.getFeedbackWidgetData(CountlyFeedbackWidget,
81
- // callback function, 1st param is the feedback widget data
82
- function (feedbackData, err) {
83
- if (err) { // error handling
84
- console.log(err);
85
- return;
86
- }
87
-
88
- CountlyWidgetData = feedbackData;
89
- // record data according to the widget type
90
- if (CountlyWidgetData.type === 'nps') {
91
- Countly.reportFeedbackWidgetManually(CountlyFeedbackWidget, CountlyWidgetData, { rating: 3, comment: "comment" });
92
- } else if (CountlyWidgetData.type === 'survey') {
93
- var widgetResponse = {};
94
- // form the key/value pairs according to data
95
- widgetResponse["answ-" + CountlyWidgetData.questions[0].id] = CountlyWidgetData.questions[0].type === "rating" ? 3 : "answer";
96
- Countly.reportFeedbackWidgetManually(CountlyFeedbackWidget, CountlyWidgetData, widgetResponse);
97
- } else if (CountlyWidgetData.type === 'rating') {
98
- Countly.reportFeedbackWidgetManually(CountlyFeedbackWidget, CountlyWidgetData, { rating: 3, comment: "comment", email: "email", contactMe: true });
99
- }
72
+ // Get data with the widget object
73
+ Countly.getFeedbackWidgetData(CountlyFeedbackWidget,
74
+ // callback function, 1st param is the feedback widget data
75
+ function (feedbackData, err) {
76
+ if (err) { // error handling
77
+ console.error(err);
78
+ return;
100
79
  }
101
80
 
102
- );
103
- } else {
104
- console.error("The widget type you are looking for does not exist")
105
- }
81
+ const CountlyWidgetData = feedbackData;
82
+ // record data according to the widget type
83
+ if (CountlyWidgetData.type === 'nps') {
84
+ Countly.reportFeedbackWidgetManually(CountlyFeedbackWidget, CountlyWidgetData, { rating: 3, comment: "comment" });
85
+ } else if (CountlyWidgetData.type === 'survey') {
86
+ var widgetResponse = {};
87
+ // form the key/value pairs according to data
88
+ widgetResponse["answ-" + CountlyWidgetData.questions[0].id] = CountlyWidgetData.questions[0].type === "rating" ? 3 : "answer";
89
+ Countly.reportFeedbackWidgetManually(CountlyFeedbackWidget, CountlyWidgetData, widgetResponse);
90
+ } else if (CountlyWidgetData.type === 'rating') {
91
+ Countly.reportFeedbackWidgetManually(CountlyFeedbackWidget, CountlyWidgetData, { rating: 3, comment: "comment", email: "email", contactMe: true });
92
+ }
93
+ }
94
+
95
+ );
106
96
  })
107
97
  }
108
98
  </script>
@@ -3,7 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "countly-sdk-web": "^23.6.2"
6
+ "countly-sdk-web": "^23.6.3"
7
7
  },
8
8
  "devDependencies": {
9
9
  "react": "^18.2.0",
package/lib/countly.js CHANGED
@@ -194,7 +194,7 @@
194
194
  */
195
195
  Countly.onload = Countly.onload || [];
196
196
 
197
- var SDK_VERSION = "23.6.2";
197
+ var SDK_VERSION = "23.6.3";
198
198
  var SDK_NAME = "javascript_native_web";
199
199
 
200
200
  // Using this on document.referrer would return an array with 15 elements in it. The 12th element (array[11]) would be the path we are looking for. Others would be things like password and such (use https://regex101.com/ to check more)
@@ -3064,11 +3064,14 @@
3064
3064
  /**
3065
3065
  * Present the feedback widget in webview
3066
3066
  * @param {Object} presentableFeedback - Current presentable feedback
3067
- * @param {String} id - DOM id to append the feedback widget
3068
- * @param {String} className - Class name to append the feedback widget
3067
+ * @param {String} [id] - DOM id to append the feedback widget (optional, in case not used pass undefined)
3068
+ * @param {String} [className] - Class name to append the feedback widget (optional, in case not used pass undefined)
3069
+ * @param {Object} [feedbackWidgetSegmentation] - Segmentation object to be passed to the feedback widget (optional)
3069
3070
  * */
3070
- this.present_feedback_widget = function(presentableFeedback, id, className) {
3071
+ this.present_feedback_widget = function(presentableFeedback, id, className, feedbackWidgetSegmentation) {
3072
+ // TODO: feedbackWidgetSegmentation implementation only assumes we want to send segmentation data. Change it if we add more data to the custom object.
3071
3073
  log(logLevelEnums.INFO, "present_feedback_widget, Presenting the feedback widget by appending to the element with ID: [ " + id + " ] and className: [ " + className + " ]");
3074
+
3072
3075
  if (!this.check_consent(featureEnums.FEEDBACK)) {
3073
3076
  return;
3074
3077
  }
@@ -3081,6 +3084,12 @@
3081
3084
  return;
3082
3085
  }
3083
3086
 
3087
+ log(logLevelEnums.INFO, "present_feedback_widget, Adding segmentation to feedback widgets:[" + JSON.stringify(feedbackWidgetSegmentation) + "]");
3088
+ if (!feedbackWidgetSegmentation || typeof feedbackWidgetSegmentation !== "object" || Object.keys(feedbackWidgetSegmentation).length === 0) {
3089
+ log(logLevelEnums.DEBUG, "present_feedback_widget, Segmentation is not an object or empty");
3090
+ feedbackWidgetSegmentation = null;
3091
+ }
3092
+
3084
3093
  try {
3085
3094
  var url = this.url;
3086
3095
 
@@ -3125,6 +3134,11 @@
3125
3134
  url += "&platform=" + this.platform;
3126
3135
  url += "&app_version=" + this.app_version;
3127
3136
  url += "&sdk_version=" + SDK_VERSION;
3137
+ if (feedbackWidgetSegmentation) {
3138
+ var customObjectToSendWithTheWidget = {};
3139
+ customObjectToSendWithTheWidget.sg = feedbackWidgetSegmentation;
3140
+ url += "&custom=" + JSON.stringify(customObjectToSendWithTheWidget);
3141
+ }
3128
3142
  // Origin is passed to the popup so that it passes it back in the postMessage event
3129
3143
  // Only web SDK passes origin and web
3130
3144
  url += "&origin=" + passedOrigin;
@@ -1,150 +1,151 @@
1
- (function(m,ta){"function"===typeof define&&define.amd?define([],function(){return ta(m.Countly)}):"object"===typeof module&&module.exports?module.exports=ta(m.Countly):m.Countly=ta(m.Countly)})("undefined"!==typeof window?window:this,function(m){function ta(h){var p=document.createElement("script"),t=document.createElement("script");p.async=!0;t.async=!0;p.src=m.customSourceBoomerang||mb.BOOMERANG_SRC;t.src=m.customSourceCountlyBoomerang||mb.CLY_BOOMERANG_SRC;document.getElementsByTagName("head")[0].appendChild(p);
2
- document.getElementsByTagName("head")[0].appendChild(t);var A=!1,B=!1;p.onload=function(){A=!0};t.onload=function(){B=!0};var M=0,U=setInterval(function(){M+=50;if(A&&B||1500<=M){if(m.debug){var R="BoomerangJS loaded:["+A+"], countly_boomerang loaded:["+B+"].";A&&B?console.log("[DEBUG] "+R):console.warn("[WARNING] "+R+" Initializing without APM.")}m.init(h);clearInterval(U)}},50)}function nb(h){var p=[];if("undefined"!==typeof h.options)for(var t=0;t<h.options.length;t++)h.options[t].selected&&p.push(h.options[t].value);
3
- return p.join(", ")}function Xa(){var h=ob("xxxxxxxx","[x]");var p=Date.now().toString();return h+p}function Ya(){return ob("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx","[xy]")}function ob(h,p){var t=(new Date).getTime();return h.replace(new RegExp(p,"g"),function(A){var B=(t+16*Math.random())%16|0;return("x"===A?B:B&3|8).toString(16)})}function E(){return Math.floor((new Date).getTime()/1E3)}function Za(){var h=(new Date).getTime();Ha>=h?Ha++:Ha=h;return Ha}function r(h,p,t){if(p&&Object.keys(p).length){if("undefined"!==
4
- typeof p[h])return p[h]}else if("undefined"!==typeof m[h])return m[h];return t}function $a(h,p,t){for(var A in m.i)m.i[A].tracking_crashes&&m.i[A].recordError(h,p,t)}function pb(h){var p=[],t;for(t in h)p.push(t+"="+encodeURIComponent(h[t]));return p.join("&")}function na(h){return"string"===typeof h&&"/"===h.substring(h.length-1)?h.substring(0,h.length-1):h}function ua(h,p){for(var t={},A,B=0,M=p.length;B<M;B++)A=p[B],"undefined"!==typeof h[A]&&(t[A]=h[A]);return t}function Y(h,p,t,A,B,M){var U=
5
- {};if(h){if(Object.keys(h).length>A){var R={},va=0,Z;for(Z in h)va<A&&(R[Z]=h[Z],va++);h=R}for(var G in h)A=x(G,p,B,M),R=x(h[G],t,B,M),U[A]=R}return U}function x(h,p,t,A){var B=h;"number"===typeof h&&(h=h.toString());"string"===typeof h&&h.length>p&&(B=h.substring(0,p),A(d.DEBUG,t+", Key: [ "+h+" ] is longer than accepted length. It will be truncated."));return B}function oa(h){if(h)return h;h=navigator.userAgent;!h&&navigator.userAgentData&&(h=navigator.userAgentData.brands.map(function(p){return p.brand+
6
- ":"+p.version}).join(),h+=navigator.userAgentData.mobile?" mobi ":" ",h+=navigator.userAgentData.platform);return h}function qb(h){if(!h){if(navigator.userAgentData.mobile)return"phone";h=oa()}h=h.toLowerCase();var p="desktop",t=/(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(h)?
7
- p="tablet":t.test(h)&&(p="phone");return p}function rb(h){return/(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)/.test(h||
8
- oa())}function ab(h){"undefined"===typeof h.pageY&&"number"===typeof h.clientX&&document.documentElement&&(h.pageX=h.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,h.pageY=h.clientY+document.body.scrollTop+document.documentElement.scrollTop);return h}function Ia(){var h=document;return Math.max(Math.max(h.body.scrollHeight,h.documentElement.scrollHeight),Math.max(h.body.offsetHeight,h.documentElement.offsetHeight),Math.max(h.body.clientHeight,h.documentElement.clientHeight))}
9
- function bb(){var h=document;return Math.max(Math.max(h.body.scrollWidth,h.documentElement.scrollWidth),Math.max(h.body.offsetWidth,h.documentElement.offsetWidth),Math.max(h.body.clientWidth,h.documentElement.clientWidth))}function sb(){var h=document;return Math.min(Math.min(h.body.clientHeight,h.documentElement.clientHeight),Math.min(h.body.offsetHeight,h.documentElement.offsetHeight),window.innerHeight)}function tb(h,p,t,A,B,M){h=document.createElement(h);var U;h.setAttribute(p,t);h.setAttribute(A,
10
- B);p=function(){U||M();U=!0};M&&(h.onreadystatechange=p,h.onload=p);document.getElementsByTagName("head")[0].appendChild(h)}function ub(h,p){tb("script","type","text/javascript","src",h,p)}function Ja(h,p){tb("link","rel","stylesheet","href",h,p)}function vb(){var h=document.getElementById("cly-loader");if(!h){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.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%;}}":
11
- t.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%;}}"));
12
- p.appendChild(t);h=document.createElement("div");h.setAttribute("id","cly-loader");document.body.onload=function(){if(m.showLoaderProtection)wa()&&console.warn("[WARNING] [Countly] showloader, Loader is already on");else try{document.body.appendChild(h)}catch(A){wa()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+A)}}}h.style.display="block"}function wa(){return m&&m.debug&&"undefined"!==typeof console?!0:!1}function wb(){m.showLoaderProtection=!0;var h=document.getElementById("cly-loader");
13
- h&&(h.style.display="none")}if("undefined"!==typeof window){m=m||{};m.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");var I={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},Hb=Object.values(I),d={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},mb={BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/boomerang.min.js",
14
- CLY_BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/countly_boomerang.js"},P=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message"});m.q=m.q||[];m.onload=m.onload||[];var xb=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,yb=!0;m.CountlyClass=
15
- function(h){function p(a,c){if(f.ignore_visitor)b(d.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);Hb.includes(a.key)||(a.key=x(a.key,f.maxKeyLength,"add_cly_event",b));a.segmentation=Y(a.segmentation,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"add_cly_event",b);a=ua(a,["key","count","sum","dur","segmentation"]);a.timestamp=Za();var e=new Date;a.hour=e.getHours();a.dow=e.getDay();a.id=c||Xa();a.key===I.VIEW?a.pvid=xa||"":a.cvid=fa||"";J.push(a);
16
- u("cly_event",J);b(d.INFO,"With event ID: ["+a.id+"], successfully adding the last event:",a)}else b(d.ERROR,"Adding event failed. Event must have a key property")}function t(a,c,e,k,l){b(d.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var g={method:"rc",av:f.app_version};a&&(g.keys=JSON.stringify(a));c&&(g.omit_keys=JSON.stringify(c));var n;"legacy"===k&&(g.method="fetch_remote_config");0===e&&(g.oi=0);1===e&&(g.oi=1);"function"===typeof l&&(n=l);f.check_consent("sessions")&&
17
- (g.metrics=JSON.stringify(Ka()));f.check_consent("remote-config")?(Z(g),aa("fetch_remote_config_explicit",f.url+La,g,function(q,v,K){if(q)b(d.ERROR,"fetch_remote_config_explicit, An error occurred: "+q);else{try{var S=JSON.parse(K);if(g.keys||g.omit_keys)for(var L in S)O[L]=S[L];else O=S;u("cly_remote_configs",O)}catch(pa){b(d.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+pa)}n&&(b(d.INFO,"fetch_remote_config_explicit, Callback function is provided"),n(q,O))}},!0)):
18
- (b(d.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),n&&n(Error("Remote config requires explicit consent"),O))}function A(){f.ignore_prefetch&&"undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState&&(f.ignore_visitor=!0);f.ignore_bots&&rb()&&(f.ignore_visitor=!0)}function B(){0<J.length&&(b(d.DEBUG,"Flushing events"),G({events:JSON.stringify(J)}),J=[],u("cly_event",J))}function M(a,c){if(document.getElementById("countly-feedback-sticker-"+
19
- a._id))b(d.ERROR,"Widget with same ID exists");else try{var e=document.createElement("div");e.className="countly-iframe-wrapper";e.id="countly-iframe-wrapper-"+a._id;var k=document.createElement("span");k.className="countly-feedback-close-icon";k.id="countly-feedback-close-icon-"+a._id;k.innerText="x";var l=document.createElement("iframe");l.name="countly-feedback-iframe";l.id="countly-feedback-iframe";l.src=f.url+"/feedback?widget_id="+a._id+"&app_key="+f.app_key+"&device_id="+f.device_id+"&sdk_version=23.6.2";
1
+ (function(n,ta){"function"===typeof define&&define.amd?define([],function(){return ta(n.Countly)}):"object"===typeof module&&module.exports?module.exports=ta(n.Countly):n.Countly=ta(n.Countly)})("undefined"!==typeof window?window:this,function(n){function ta(h){var p=document.createElement("script"),u=document.createElement("script");p.async=!0;u.async=!0;p.src=n.customSourceBoomerang||ob.BOOMERANG_SRC;u.src=n.customSourceCountlyBoomerang||ob.CLY_BOOMERANG_SRC;document.getElementsByTagName("head")[0].appendChild(p);
2
+ document.getElementsByTagName("head")[0].appendChild(u);var A=!1,B=!1;p.onload=function(){A=!0};u.onload=function(){B=!0};var L=0,T=setInterval(function(){L+=50;if(A&&B||1500<=L){if(n.debug){var R="BoomerangJS loaded:["+A+"], countly_boomerang loaded:["+B+"].";A&&B?console.log("[DEBUG] "+R):console.warn("[WARNING] "+R+" Initializing without APM.")}n.init(h);clearInterval(T)}},50)}function pb(h){var p=[];if("undefined"!==typeof h.options)for(var u=0;u<h.options.length;u++)h.options[u].selected&&p.push(h.options[u].value);
3
+ return p.join(", ")}function Za(){var h=qb("xxxxxxxx","[x]");var p=Date.now().toString();return h+p}function $a(){return qb("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx","[xy]")}function qb(h,p){var u=(new Date).getTime();return h.replace(new RegExp(p,"g"),function(A){var B=(u+16*Math.random())%16|0;return("x"===A?B:B&3|8).toString(16)})}function E(){return Math.floor((new Date).getTime()/1E3)}function ab(){var h=(new Date).getTime();Ia>=h?Ia++:Ia=h;return Ia}function r(h,p,u){if(p&&Object.keys(p).length){if("undefined"!==
4
+ typeof p[h])return p[h]}else if("undefined"!==typeof n[h])return n[h];return u}function bb(h,p,u){for(var A in n.i)n.i[A].tracking_crashes&&n.i[A].recordError(h,p,u)}function rb(h){var p=[],u;for(u in h)p.push(u+"="+encodeURIComponent(h[u]));return p.join("&")}function oa(h){return"string"===typeof h&&"/"===h.substring(h.length-1)?h.substring(0,h.length-1):h}function ua(h,p){for(var u={},A,B=0,L=p.length;B<L;B++)A=p[B],"undefined"!==typeof h[A]&&(u[A]=h[A]);return u}function Y(h,p,u,A,B,L){var T=
5
+ {};if(h){if(Object.keys(h).length>A){var R={},va=0,Z;for(Z in h)va<A&&(R[Z]=h[Z],va++);h=R}for(var G in h)A=x(G,p,B,L),R=x(h[G],u,B,L),T[A]=R}return T}function x(h,p,u,A){var B=h;"number"===typeof h&&(h=h.toString());"string"===typeof h&&h.length>p&&(B=h.substring(0,p),A(d.DEBUG,u+", Key: [ "+h+" ] is longer than accepted length. It will be truncated."));return B}function pa(h){if(h)return h;h=navigator.userAgent;!h&&navigator.userAgentData&&(h=navigator.userAgentData.brands.map(function(p){return p.brand+
6
+ ":"+p.version}).join(),h+=navigator.userAgentData.mobile?" mobi ":" ",h+=navigator.userAgentData.platform);return h}function sb(h){if(!h){if(navigator.userAgentData.mobile)return"phone";h=pa()}h=h.toLowerCase();var p="desktop",u=/(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(h)?
7
+ p="tablet":u.test(h)&&(p="phone");return p}function tb(h){return/(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)/.test(h||
8
+ pa())}function cb(h){"undefined"===typeof h.pageY&&"number"===typeof h.clientX&&document.documentElement&&(h.pageX=h.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,h.pageY=h.clientY+document.body.scrollTop+document.documentElement.scrollTop);return h}function Ja(){var h=document;return Math.max(Math.max(h.body.scrollHeight,h.documentElement.scrollHeight),Math.max(h.body.offsetHeight,h.documentElement.offsetHeight),Math.max(h.body.clientHeight,h.documentElement.clientHeight))}
9
+ function db(){var h=document;return Math.max(Math.max(h.body.scrollWidth,h.documentElement.scrollWidth),Math.max(h.body.offsetWidth,h.documentElement.offsetWidth),Math.max(h.body.clientWidth,h.documentElement.clientWidth))}function ub(){var h=document;return Math.min(Math.min(h.body.clientHeight,h.documentElement.clientHeight),Math.min(h.body.offsetHeight,h.documentElement.offsetHeight),window.innerHeight)}function vb(h,p,u,A,B,L){h=document.createElement(h);var T;h.setAttribute(p,u);h.setAttribute(A,
10
+ B);p=function(){T||L();T=!0};L&&(h.onreadystatechange=p,h.onload=p);document.getElementsByTagName("head")[0].appendChild(h)}function wb(h,p){vb("script","type","text/javascript","src",h,p)}function Ka(h,p){vb("link","rel","stylesheet","href",h,p)}function xb(){var h=document.getElementById("cly-loader");if(!h){var p=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css";u.styleSheet?u.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%;}}":
11
+ u.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%;}}"));
12
+ p.appendChild(u);h=document.createElement("div");h.setAttribute("id","cly-loader");document.body.onload=function(){if(n.showLoaderProtection)wa()&&console.warn("[WARNING] [Countly] showloader, Loader is already on");else try{document.body.appendChild(h)}catch(A){wa()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+A)}}}h.style.display="block"}function wa(){return n&&n.debug&&"undefined"!==typeof console?!0:!1}function yb(){n.showLoaderProtection=!0;var h=document.getElementById("cly-loader");
13
+ h&&(h.style.display="none")}if("undefined"!==typeof window){n=n||{};n.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");var I={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},Jb=Object.values(I),d={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},ob={BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/boomerang.min.js",
14
+ CLY_BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/countly_boomerang.js"},P=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message"});n.q=n.q||[];n.onload=n.onload||[];var zb=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,Ab=!0;n.CountlyClass=
15
+ function(h){function p(a,c){if(f.ignore_visitor)b(d.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);Jb.includes(a.key)||(a.key=x(a.key,f.maxKeyLength,"add_cly_event",b));a.segmentation=Y(a.segmentation,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"add_cly_event",b);a=ua(a,["key","count","sum","dur","segmentation"]);a.timestamp=ab();var e=new Date;a.hour=e.getHours();a.dow=e.getDay();a.id=c||Za();a.key===I.VIEW?a.pvid=xa||"":a.cvid=fa||"";J.push(a);
16
+ v("cly_event",J);b(d.INFO,"With event ID: ["+a.id+"], successfully adding the last event:",a)}else b(d.ERROR,"Adding event failed. Event must have a key property")}function u(a,c,e,k,l){b(d.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var g={method:"rc",av:f.app_version};a&&(g.keys=JSON.stringify(a));c&&(g.omit_keys=JSON.stringify(c));var m;"legacy"===k&&(g.method="fetch_remote_config");0===e&&(g.oi=0);1===e&&(g.oi=1);"function"===typeof l&&(m=l);f.check_consent("sessions")&&
17
+ (g.metrics=JSON.stringify(La()));f.check_consent("remote-config")?(Z(g),aa("fetch_remote_config_explicit",f.url+Ma,g,function(q,t,K){if(q)b(d.ERROR,"fetch_remote_config_explicit, An error occurred: "+q);else{try{var N=JSON.parse(K);if(g.keys||g.omit_keys)for(var ka in N)O[ka]=N[ka];else O=N;v("cly_remote_configs",O)}catch(ya){b(d.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+ya)}m&&(b(d.INFO,"fetch_remote_config_explicit, Callback function is provided"),m(q,O))}},
18
+ !0)):(b(d.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),m&&m(Error("Remote config requires explicit consent"),O))}function A(){f.ignore_prefetch&&"undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState&&(f.ignore_visitor=!0);f.ignore_bots&&tb()&&(f.ignore_visitor=!0)}function B(){0<J.length&&(b(d.DEBUG,"Flushing events"),G({events:JSON.stringify(J)}),J=[],v("cly_event",J))}function L(a,c){if(document.getElementById("countly-feedback-sticker-"+
19
+ a._id))b(d.ERROR,"Widget with same ID exists");else try{var e=document.createElement("div");e.className="countly-iframe-wrapper";e.id="countly-iframe-wrapper-"+a._id;var k=document.createElement("span");k.className="countly-feedback-close-icon";k.id="countly-feedback-close-icon-"+a._id;k.innerText="x";var l=document.createElement("iframe");l.name="countly-feedback-iframe";l.id="countly-feedback-iframe";l.src=f.url+"/feedback?widget_id="+a._id+"&app_key="+f.app_key+"&device_id="+f.device_id+"&sdk_version=23.6.3";
20
20
  document.body.appendChild(e);e.appendChild(k);e.appendChild(l);y(document.getElementById("countly-feedback-close-icon-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="none";document.getElementById("cfbg").style.display="none"});if(c){var g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.id="feedback-sticker-svg";g.setAttribute("aria-hidden","true");g.setAttribute("data-prefix","far");g.setAttribute("data-icon","grin");g.setAttribute("class",
21
- "svg-inline--fa fa-grin fa-w-16");g.setAttribute("role","img");g.setAttribute("xmlns","http://www.w3.org/2000/svg");g.setAttribute("viewBox","0 0 496 512");var n=document.createElementNS("http://www.w3.org/2000/svg","path");n.id="smileyPathInStickerSvg";n.setAttribute("fill","white");n.setAttribute("d","M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm105.6-151.4c-25.9 8.3-64.4 13.1-105.6 13.1s-79.6-4.8-105.6-13.1c-9.9-3.1-19.4 5.4-17.7 15.3 7.9 47.1 71.3 80 123.3 80s115.3-32.9 123.3-80c1.6-9.8-7.7-18.4-17.7-15.3zM168 240c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32z");
22
- var q=document.createElement("span");q.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(q);document.body.appendChild(v);var K=document.getElementById("smileyPathInStickerSvg");
23
- K&&(K.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);y(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(S){b(d.ERROR,"Somethings went wrong while element injecting process: "+
24
- S)}}function U(){var a;if("undefined"!==typeof f.onload&&0<f.onload.length){for(a=0;a<f.onload.length;a++)if("function"===typeof f.onload[a])f.onload[a](f);f.onload=[]}}function R(){if(V){var a={name:V};f.check_consent("views")&&(p({key:I.VIEW,dur:ka?E()-ya:za,segmentation:a},fa),V=null)}}function va(){if(ha){var a=w("cly_session");if(!a||parseInt(a)<=E())T=!1,f.begin_session(!Aa);u("cly_session",E()+60*Ba)}}function Z(a){a.app_key=f.app_key;a.device_id=f.device_id;a.sdk_name="javascript_native_web";
25
- a.sdk_version="23.6.2";a.t=C;a.av=f.app_version;var c=zb();if(a.metrics){var e=JSON.parse(a.metrics);e._ua||(e._ua=c,a.metrics=JSON.stringify(e))}else a.metrics=JSON.stringify({_ua:c});f.check_consent("location")?(f.country_code&&(a.country_code=f.country_code),f.city&&(a.city=f.city),null!==f.ip_address&&(a.ip_address=f.ip_address)):a.location="";a.timestamp=Za();c=new Date;a.hour=c.getHours();a.dow=c.getDay()}function G(a){f.ignore_visitor?b(d.WARNING,"User is opt_out will ignore the request: "+
26
- a):f.app_key&&f.device_id?(Z(a),F.length>Ma&&F.shift(),F.push(a),u("cly_queue",F,!0)):b(d.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)}function Na(){U();if(f.ignore_visitor)Oa=!1,b(d.WARNING,"User opt_out, no heartbeat");else{Oa=!0;var a=0;if(Pa&&"undefined"!==typeof m.q&&0<m.q.length){var c=m.q;m.q=[];for(a=0;a<c.length;a++){var e=c[a];b(d.DEBUG,"Processing queued call",e);if("function"===typeof e)e();else if(Array.isArray(e)&&0<e.length){var k=f,l=0;m.i[e[l]]&&(k=m.i[e[l]],l++);
27
- if("function"===typeof k[e[l]])k[e[l]].apply(k,e.slice(l+1));else if(0===e[l].indexOf("userData.")){var g=e[l].replace("userData.","");"function"===typeof k.userData[g]&&k.userData[g].apply(k,e.slice(l+1))}else"function"===typeof m[e[l]]&&m[e[l]].apply(m,e.slice(l+1))}}}T&&Aa&&ka&&(a=E(),a-ia>Qa&&(f.session_duration(a-ia),ia=a,0<f.hcErrorCount&&u(P.errorCount,f.hcErrorCount),0<f.hcWarningCount&&u(P.warningCount,f.hcWarningCount)));0<J.length&&!f.test_mode_eq&&(J.length<=Ca?(G({events:JSON.stringify(J)}),
28
- J=[]):(a=J.splice(0,Ca),G({events:JSON.stringify(a)})),u("cly_event",J));!H&&0<F.length&&Ra&&E()>cb&&(Ra=!1,a=F[0],a.rr=F.length,b(d.DEBUG,"Processing request",a),u("cly_queue",F,!0),f.test_mode||aa("send_request_queue",f.url+db,a,function(n,q){b(d.DEBUG,"Request Finished",q,n);n?(cb=E()+Sa,b(d.ERROR,"Request error: ",n)):F.shift();u("cly_queue",F,!0);Ra=!0},!1));setTimeout(Na,Ta)}}function eb(){var a=w("cly_id");return a?(C=w("cly_id_type"),a):Ya()}function zb(){return f.metrics._ua||oa()}function Ka(){var a=
29
- JSON.parse(JSON.stringify(f.metrics||{}));a._app_version=a._app_version||f.app_version;a._ua=a._ua||oa();if(screen.width){var c=screen.width?parseInt(screen.width):0,e=screen.height?parseInt(screen.height):0;if(0!==c&&0!==e){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)c=Math.round(c*window.devicePixelRatio),e=Math.round(e*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var k=c;c=e;e=k}a._resolution=a._resolution||""+c+"x"+e}}window.devicePixelRatio&&
30
- (a._density=a._density||window.devicePixelRatio);c=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;"undefined"!==typeof c&&(a._locale=a._locale||c);fb()&&(a._store=a._store||document.referrer);b(d.DEBUG,"Got metrics",a);return a}function fb(a){a=a||document.referrer;var c=!1;if("undefined"===typeof a||0===a.length)b(d.DEBUG,"Invalid referrer:["+a+"], ignoring.");else{var e=xb.exec(a);if(e)if(e[11])if(e[11]===window.location.hostname)b(d.DEBUG,"Referrer is current host:["+
31
- a+"], ignoring.");else if(ba&&ba.length)for(c=!0,e=0;e<ba.length;e++){if(0<=a.indexOf(ba[e])){b(d.DEBUG,"Referrer in ignore list:["+a+"], ignoring.");c=!1;break}}else b(d.DEBUG,"Valid referrer:["+a+"]"),c=!0;else b(d.DEBUG,"No path found in referrer:["+a+"], ignoring.");else b(d.DEBUG,"Referrer is corrupt:["+a+"], ignoring.")}return c}function b(a,c){if(f.debug&&"undefined"!==typeof console){arguments[2]&&"object"===typeof arguments[2]&&(arguments[2]=JSON.stringify(arguments[2]));Pa||(c="["+f.app_key+
21
+ "svg-inline--fa fa-grin fa-w-16");g.setAttribute("role","img");g.setAttribute("xmlns","http://www.w3.org/2000/svg");g.setAttribute("viewBox","0 0 496 512");var m=document.createElementNS("http://www.w3.org/2000/svg","path");m.id="smileyPathInStickerSvg";m.setAttribute("fill","white");m.setAttribute("d","M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm105.6-151.4c-25.9 8.3-64.4 13.1-105.6 13.1s-79.6-4.8-105.6-13.1c-9.9-3.1-19.4 5.4-17.7 15.3 7.9 47.1 71.3 80 123.3 80s115.3-32.9 123.3-80c1.6-9.8-7.7-18.4-17.7-15.3zM168 240c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32z");
22
+ var q=document.createElement("span");q.innerText=a.trigger_button_text;var t=document.createElement("div");t.style.color=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color;t.style.backgroundColor=7>a.trigger_bg_color.length?"#"+a.trigger_bg_color:a.trigger_bg_color;t.className="countly-feedback-sticker "+a.trigger_position+"-"+a.trigger_size;t.id="countly-feedback-sticker-"+a._id;g.appendChild(m);t.appendChild(g);t.appendChild(q);document.body.appendChild(t);var K=document.getElementById("smileyPathInStickerSvg");
23
+ K&&(K.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);y(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(d.ERROR,"Somethings went wrong while element injecting process: "+
24
+ N)}}function T(){var a;if("undefined"!==typeof f.onload&&0<f.onload.length){for(a=0;a<f.onload.length;a++)if("function"===typeof f.onload[a])f.onload[a](f);f.onload=[]}}function R(){if(U){var a={name:U};f.check_consent("views")&&(p({key:I.VIEW,dur:la?E()-za:Aa,segmentation:a},fa),U=null)}}function va(){if(ha){var a=w("cly_session");if(!a||parseInt(a)<=E())S=!1,f.begin_session(!Ba);v("cly_session",E()+60*Ca)}}function Z(a){a.app_key=f.app_key;a.device_id=f.device_id;a.sdk_name="javascript_native_web";
25
+ a.sdk_version="23.6.3";a.t=C;a.av=f.app_version;var c=Bb();if(a.metrics){var e=JSON.parse(a.metrics);e._ua||(e._ua=c,a.metrics=JSON.stringify(e))}else a.metrics=JSON.stringify({_ua:c});f.check_consent("location")?(f.country_code&&(a.country_code=f.country_code),f.city&&(a.city=f.city),null!==f.ip_address&&(a.ip_address=f.ip_address)):a.location="";a.timestamp=ab();c=new Date;a.hour=c.getHours();a.dow=c.getDay()}function G(a){f.ignore_visitor?b(d.WARNING,"User is opt_out will ignore the request: "+
26
+ a):f.app_key&&f.device_id?(Z(a),F.length>Na&&F.shift(),F.push(a),v("cly_queue",F,!0)):b(d.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)}function Oa(){T();if(f.ignore_visitor)Pa=!1,b(d.WARNING,"User opt_out, no heartbeat");else{Pa=!0;var a=0;if(Qa&&"undefined"!==typeof n.q&&0<n.q.length){var c=n.q;n.q=[];for(a=0;a<c.length;a++){var e=c[a];b(d.DEBUG,"Processing queued call",e);if("function"===typeof e)e();else if(Array.isArray(e)&&0<e.length){var k=f,l=0;n.i[e[l]]&&(k=n.i[e[l]],l++);
27
+ if("function"===typeof k[e[l]])k[e[l]].apply(k,e.slice(l+1));else if(0===e[l].indexOf("userData.")){var g=e[l].replace("userData.","");"function"===typeof k.userData[g]&&k.userData[g].apply(k,e.slice(l+1))}else"function"===typeof n[e[l]]&&n[e[l]].apply(n,e.slice(l+1))}}}S&&Ba&&la&&(a=E(),a-ia>Ra&&(f.session_duration(a-ia),ia=a,0<f.hcErrorCount&&v(P.errorCount,f.hcErrorCount),0<f.hcWarningCount&&v(P.warningCount,f.hcWarningCount)));0<J.length&&!f.test_mode_eq&&(J.length<=Da?(G({events:JSON.stringify(J)}),
28
+ J=[]):(a=J.splice(0,Da),G({events:JSON.stringify(a)})),v("cly_event",J));!H&&0<F.length&&Sa&&E()>eb&&(Sa=!1,a=F[0],a.rr=F.length,b(d.DEBUG,"Processing request",a),v("cly_queue",F,!0),f.test_mode||aa("send_request_queue",f.url+fb,a,function(m,q){b(d.DEBUG,"Request Finished",q,m);m?(eb=E()+Ta,b(d.ERROR,"Request error: ",m)):F.shift();v("cly_queue",F,!0);Sa=!0},!1));setTimeout(Oa,Ua)}}function gb(){var a=w("cly_id");return a?(C=w("cly_id_type"),a):$a()}function Bb(){return f.metrics._ua||pa()}function La(){var a=
29
+ JSON.parse(JSON.stringify(f.metrics||{}));a._app_version=a._app_version||f.app_version;a._ua=a._ua||pa();if(screen.width){var c=screen.width?parseInt(screen.width):0,e=screen.height?parseInt(screen.height):0;if(0!==c&&0!==e){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)c=Math.round(c*window.devicePixelRatio),e=Math.round(e*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var k=c;c=e;e=k}a._resolution=a._resolution||""+c+"x"+e}}window.devicePixelRatio&&
30
+ (a._density=a._density||window.devicePixelRatio);c=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;"undefined"!==typeof c&&(a._locale=a._locale||c);hb()&&(a._store=a._store||document.referrer);b(d.DEBUG,"Got metrics",a);return a}function hb(a){a=a||document.referrer;var c=!1;if("undefined"===typeof a||0===a.length)b(d.DEBUG,"Invalid referrer:["+a+"], ignoring.");else{var e=zb.exec(a);if(e)if(e[11])if(e[11]===window.location.hostname)b(d.DEBUG,"Referrer is current host:["+
31
+ a+"], ignoring.");else if(ba&&ba.length)for(c=!0,e=0;e<ba.length;e++){if(0<=a.indexOf(ba[e])){b(d.DEBUG,"Referrer in ignore list:["+a+"], ignoring.");c=!1;break}}else b(d.DEBUG,"Valid referrer:["+a+"]"),c=!0;else b(d.DEBUG,"No path found in referrer:["+a+"], ignoring.");else b(d.DEBUG,"Referrer is corrupt:["+a+"], ignoring.")}return c}function b(a,c){if(f.debug&&"undefined"!==typeof console){arguments[2]&&"object"===typeof arguments[2]&&(arguments[2]=JSON.stringify(arguments[2]));Qa||(c="["+f.app_key+
32
32
  "] "+c);a||(a=d.DEBUG);for(var e="",k=2;k<arguments.length;k++)e+=arguments[k];e=a+"[Countly] "+c+e;a===d.ERROR?(console.error(e),qa.incrementErrorCount()):a===d.WARNING?(console.warn(e),qa.incrementWarningCount()):a===d.INFO?console.info(e):a===d.VERBOSE?console.log(e):console.debug(e)}}function aa(a,c,e,k,l){l=l||!1;try{b(d.DEBUG,"Sending XML HTTP request");var g=null;window.XMLHttpRequest?g=new window.XMLHttpRequest:window.ActiveXObject&&(g=new window.ActiveXObject("Microsoft.XMLHTTP"));e=e||{};
33
- var n=pb(e),q="GET";if(f.force_post||2E3<=n.length)q="POST";"GET"===q?g.open("GET",c+"?"+n,!0):(g.open("POST",c,!0),g.setRequestHeader("Content-type","application/x-www-form-urlencoded"));for(var v in f.headers)g.setRequestHeader(v,f.headers[v]);g.onreadystatechange=function(){4===this.readyState&&(b(d.DEBUG,a+" HTTP request completed ["+this.status+"]["+this.responseText+"]"),(l?Ab(this.status,this.responseText):Bb(this.status,this.responseText))?"function"===typeof k&&k(!1,e,this.responseText):
34
- (b(d.ERROR,a+" Failed Server XML HTTP request, ",this.status),"send_request_queue"===a&&qa.saveRequestCounters(this.status,this.responseText),"function"===typeof k&&k(!0,e,this.status,this.responseText)))};"GET"===q?g.send():g.send(n)}catch(K){b(d.ERROR,a+" Failed XML HTTP request: "+K),"function"===typeof k&&k(!0,e)}}function Bb(a,c){if(!(200<=a&&300>a))return b(d.ERROR,"Http response status code is not within the expected range:["+a+"]"),!1;try{var e=JSON.parse(c);return"[object Object]"!==Object.prototype.toString.call(e)?
35
- (b(d.ERROR,"Http response is not JSON Object"),!1):!!e.result}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Ab(a,c){if(!(200<=a&&300>a))return b(d.ERROR,"Http response status code is not within the expected range: "+a),!1;try{var e=JSON.parse(c);return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)?!0:(b(d.ERROR,"Http response is not JSON Object nor JSON Array"),!1)}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Cb(){Da=Math.max(Da,
36
- window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)}function gb(){if(Ea){Ea=!1;var a=Ia(),c=bb(),e=sb();f.check_consent("scrolls")&&(a={type:"scroll",y:Da+e,width:c,height:a,view:f.getViewUrl()},a=Y(a,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processScrollView",b),f.track_domains&&(a.domain=window.location.hostname),p({key:I.ACTION,segmentation:a}))}}function Db(a){u("cly_token",a)}function Eb(a,c,e){var k=new Date;k.setTime(k.getTime()+864E5*e);e="; expires="+
37
- k.toGMTString();document.cookie=a+"="+c+e+"; path=/"}function w(a,c,e){if("none"===f.storage)b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be retrieved");else{e||(a=f.app_key+"/"+a,f.namespace&&(a=na(f.namespace)+"/"+a));void 0===c&&(c=la);if(c)var k=localStorage.getItem(a);else if("localstorage"!==f.storage)a:{c=a+"=";e=document.cookie.split(";");k=0;for(var l=e.length;k<l;k++){for(var g=e[k];" "===g.charAt(0);)g=g.substring(1,g.length);if(0===g.indexOf(c)){k=g.substring(c.length,
38
- g.length);break a}}k=null}return a.endsWith("cly_id")?k:f.deserialize(k)}}function u(a,c,e,k){"none"===f.storage?b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be stored"):(k||(a=f.app_key+"/"+a,f.namespace&&(a=na(f.namespace)+"/"+a)),void 0===e&&(e=la),"undefined"!==typeof c&&null!==c&&(c=f.serialize(c),e?localStorage.setItem(a,c):"localstorage"!==f.storage&&Eb(a,c,30)))}function W(a,c,e){"none"===f.storage?b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be removed"):
39
- (e||(a=f.app_key+"/"+a,f.namespace&&(a=na(f.namespace)+"/"+a)),void 0===c&&(c=la),c?localStorage.removeItem(a):"localstorage"!==f.storage&&Eb(a,"",-1))}function Ib(){if(w(f.namespace+"cly_id",!1,!0)){u("cly_id",w(f.namespace+"cly_id",!1,!0));u("cly_id_type",w(f.namespace+"cly_id_type",!1,!0));u("cly_event",w(f.namespace+"cly_event",!1,!0));u("cly_session",w(f.namespace+"cly_session",!1,!0));var a=w(f.namespace+"cly_queue",!1,!0);Array.isArray(a)&&(a=a.filter(function(c){return c.app_key===f.app_key}),
40
- u("cly_queue",a));w(f.namespace+"cly_cmp_id",!1,!0)&&(u("cly_cmp_id",w(f.namespace+"cly_cmp_id",!1,!0)),u("cly_cmp_uid",w(f.namespace+"cly_cmp_uid",!1,!0)));w(f.namespace+"cly_ignore",!1,!0)&&u("cly_ignore",w(f.namespace+"cly_ignore",!1,!0));W("cly_id",!1,!0);W("cly_id_type",!1,!0);W("cly_event",!1,!0);W("cly_session",!1,!0);W("cly_queue",!1,!0);W("cly_cmp_id",!1,!0);W("cly_cmp_uid",!1,!0);W("cly_ignore",!1,!0)}}var f=this,Pa=!m.i,T=!1,db="/i",La="/o/sdk",Ta=r("interval",h,500),Ma=r("queue_size",
41
- h,1E3),F=[],J=[],O={},ma=[],ca={},ba=r("ignore_referrers",h,[]),hb=null,Aa=!0,ia,ib=0,V=null,ya=0,za=0,cb=0,Sa=r("fail_timeout",h,60),Fa=r("inactivity_time",h,20),Ga=0,Qa=r("session_update",h,60),Ca=r("max_events",h,100),ra=r("max_logs",h,null),ha=r("use_session_cookie",h,!0),Ba=r("session_cookie_timeout",h,30),Ra=!0,Oa=!1,H=r("offline_mode",h,!1),da={},ka=!0,Fb=E(),la=!0,sa=null,C=1,Ea=!1,Da=0,jb=!1,fa=null,xa=null,ja=null;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(a){b(d.ERROR,
42
- "Local storage test failed, Halting local storage support: "+a),la=!1}for(var D={},kb=0;kb<m.features.length;kb++)D[m.features[kb]]={};this.initialize=function(){this.serialize=r("serialize",h,m.serialize);this.deserialize=r("deserialize",h,m.deserialize);this.getViewName=r("getViewName",h,m.getViewName);this.getViewUrl=r("getViewUrl",h,m.getViewUrl);this.getSearchQuery=r("getSearchQuery",h,m.getSearchQuery);this.DeviceIdType=m.DeviceIdType;this.namespace=r("namespace",h,"");this.clearStoredId=r("clear_stored_id",
43
- h,!1);this.app_key=r("app_key",h,null);this.onload=r("onload",h,[]);this.utm=r("utm",h,{source:!0,medium:!0,campaign:!0,term:!0,content:!0});this.ignore_prefetch=r("ignore_prefetch",h,!0);this.rcAutoOptinAb=r("rc_automatic_optin_for_ab",h,!0);this.useExplicitRcApi=r("use_explicit_rc_api",h,!1);this.debug=r("debug",h,!1);this.test_mode=r("test_mode",h,!1);this.test_mode_eq=r("test_mode_eq",h,!1);this.metrics=r("metrics",h,{});this.headers=r("headers",h,{});this.url=na(r("url",h,""));this.app_version=
33
+ var m=rb(e),q="GET";if(f.force_post||2E3<=m.length)q="POST";"GET"===q?g.open("GET",c+"?"+m,!0):(g.open("POST",c,!0),g.setRequestHeader("Content-type","application/x-www-form-urlencoded"));for(var t in f.headers)g.setRequestHeader(t,f.headers[t]);g.onreadystatechange=function(){4===this.readyState&&(b(d.DEBUG,a+" HTTP request completed ["+this.status+"]["+this.responseText+"]"),(l?Cb(this.status,this.responseText):Db(this.status,this.responseText))?"function"===typeof k&&k(!1,e,this.responseText):
34
+ (b(d.ERROR,a+" Failed Server XML HTTP request, ",this.status),"send_request_queue"===a&&qa.saveRequestCounters(this.status,this.responseText),"function"===typeof k&&k(!0,e,this.status,this.responseText)))};"GET"===q?g.send():g.send(m)}catch(K){b(d.ERROR,a+" Failed XML HTTP request: "+K),"function"===typeof k&&k(!0,e)}}function Db(a,c){if(!(200<=a&&300>a))return b(d.ERROR,"Http response status code is not within the expected range:["+a+"]"),!1;try{var e=JSON.parse(c);return"[object Object]"!==Object.prototype.toString.call(e)?
35
+ (b(d.ERROR,"Http response is not JSON Object"),!1):!!e.result}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Cb(a,c){if(!(200<=a&&300>a))return b(d.ERROR,"Http response status code is not within the expected range: "+a),!1;try{var e=JSON.parse(c);return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)?!0:(b(d.ERROR,"Http response is not JSON Object nor JSON Array"),!1)}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Eb(){Ea=Math.max(Ea,
36
+ window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)}function ib(){if(Fa){Fa=!1;var a=Ja(),c=db(),e=ub();f.check_consent("scrolls")&&(a={type:"scroll",y:Ea+e,width:c,height:a,view:f.getViewUrl()},a=Y(a,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processScrollView",b),f.track_domains&&(a.domain=window.location.hostname),p({key:I.ACTION,segmentation:a}))}}function Fb(a){v("cly_token",a)}function Gb(a,c,e){var k=new Date;k.setTime(k.getTime()+864E5*e);e="; expires="+
37
+ k.toGMTString();document.cookie=a+"="+c+e+"; path=/"}function w(a,c,e){if("none"===f.storage)b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be retrieved");else{e||(a=f.app_key+"/"+a,f.namespace&&(a=oa(f.namespace)+"/"+a));void 0===c&&(c=ma);if(c)var k=localStorage.getItem(a);else if("localstorage"!==f.storage)a:{c=a+"=";e=document.cookie.split(";");k=0;for(var l=e.length;k<l;k++){for(var g=e[k];" "===g.charAt(0);)g=g.substring(1,g.length);if(0===g.indexOf(c)){k=g.substring(c.length,
38
+ g.length);break a}}k=null}return a.endsWith("cly_id")?k:f.deserialize(k)}}function v(a,c,e,k){"none"===f.storage?b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be stored"):(k||(a=f.app_key+"/"+a,f.namespace&&(a=oa(f.namespace)+"/"+a)),void 0===e&&(e=ma),"undefined"!==typeof c&&null!==c&&(c=f.serialize(c),e?localStorage.setItem(a,c):"localstorage"!==f.storage&&Gb(a,c,30)))}function V(a,c,e){"none"===f.storage?b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be removed"):
39
+ (e||(a=f.app_key+"/"+a,f.namespace&&(a=oa(f.namespace)+"/"+a)),void 0===c&&(c=ma),c?localStorage.removeItem(a):"localstorage"!==f.storage&&Gb(a,"",-1))}function Kb(){if(w(f.namespace+"cly_id",!1,!0)){v("cly_id",w(f.namespace+"cly_id",!1,!0));v("cly_id_type",w(f.namespace+"cly_id_type",!1,!0));v("cly_event",w(f.namespace+"cly_event",!1,!0));v("cly_session",w(f.namespace+"cly_session",!1,!0));var a=w(f.namespace+"cly_queue",!1,!0);Array.isArray(a)&&(a=a.filter(function(c){return c.app_key===f.app_key}),
40
+ v("cly_queue",a));w(f.namespace+"cly_cmp_id",!1,!0)&&(v("cly_cmp_id",w(f.namespace+"cly_cmp_id",!1,!0)),v("cly_cmp_uid",w(f.namespace+"cly_cmp_uid",!1,!0)));w(f.namespace+"cly_ignore",!1,!0)&&v("cly_ignore",w(f.namespace+"cly_ignore",!1,!0));V("cly_id",!1,!0);V("cly_id_type",!1,!0);V("cly_event",!1,!0);V("cly_session",!1,!0);V("cly_queue",!1,!0);V("cly_cmp_id",!1,!0);V("cly_cmp_uid",!1,!0);V("cly_ignore",!1,!0)}}var f=this,Qa=!n.i,S=!1,fb="/i",Ma="/o/sdk",Ua=r("interval",h,500),Na=r("queue_size",
41
+ h,1E3),F=[],J=[],O={},na=[],ca={},ba=r("ignore_referrers",h,[]),jb=null,Ba=!0,ia,kb=0,U=null,za=0,Aa=0,eb=0,Ta=r("fail_timeout",h,60),Ga=r("inactivity_time",h,20),Ha=0,Ra=r("session_update",h,60),Da=r("max_events",h,100),ra=r("max_logs",h,null),ha=r("use_session_cookie",h,!0),Ca=r("session_cookie_timeout",h,30),Sa=!0,Pa=!1,H=r("offline_mode",h,!1),da={},la=!0,Hb=E(),ma=!0,sa=null,C=1,Fa=!1,Ea=0,lb=!1,fa=null,xa=null,ja=null;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(a){b(d.ERROR,
42
+ "Local storage test failed, Halting local storage support: "+a),ma=!1}for(var D={},mb=0;mb<n.features.length;mb++)D[n.features[mb]]={};this.initialize=function(){this.serialize=r("serialize",h,n.serialize);this.deserialize=r("deserialize",h,n.deserialize);this.getViewName=r("getViewName",h,n.getViewName);this.getViewUrl=r("getViewUrl",h,n.getViewUrl);this.getSearchQuery=r("getSearchQuery",h,n.getSearchQuery);this.DeviceIdType=n.DeviceIdType;this.namespace=r("namespace",h,"");this.clearStoredId=r("clear_stored_id",
43
+ h,!1);this.app_key=r("app_key",h,null);this.onload=r("onload",h,[]);this.utm=r("utm",h,{source:!0,medium:!0,campaign:!0,term:!0,content:!0});this.ignore_prefetch=r("ignore_prefetch",h,!0);this.rcAutoOptinAb=r("rc_automatic_optin_for_ab",h,!0);this.useExplicitRcApi=r("use_explicit_rc_api",h,!1);this.debug=r("debug",h,!1);this.test_mode=r("test_mode",h,!1);this.test_mode_eq=r("test_mode_eq",h,!1);this.metrics=r("metrics",h,{});this.headers=r("headers",h,{});this.url=oa(r("url",h,""));this.app_version=
44
44
  r("app_version",h,"0.0");this.country_code=r("country_code",h,null);this.city=r("city",h,null);this.ip_address=r("ip_address",h,null);this.ignore_bots=r("ignore_bots",h,!0);this.force_post=r("force_post",h,!1);this.remote_config=r("remote_config",h,!1);this.ignore_visitor=r("ignore_visitor",h,!1);this.require_consent=r("require_consent",h,!1);this.track_domains=r("track_domains",h,!0);this.storage=r("storage",h,"default");this.enableOrientationTracking=r("enable_orientation_tracking",h,!0);this.maxKeyLength=
45
45
  r("max_key_length",h,128);this.maxValueSize=r("max_value_size",h,256);this.maxSegmentationValues=r("max_segmentation_values",h,100);this.maxBreadcrumbCount=r("max_breadcrumb_count",h,null);this.maxStackTraceLinesPerThread=r("max_stack_trace_lines_per_thread",h,30);this.maxStackTraceLineLength=r("max_stack_trace_line_length",h,200);this.heatmapWhitelist=r("heatmap_whitelist",h,[]);f.hcErrorCount=w(P.errorCount)||0;f.hcWarningCount=w(P.warningCount)||0;f.hcStatusCode=w(P.statusCode)||-1;f.hcErrorMessage=
46
- w(P.errorMessage)||"";ra&&!this.maxBreadcrumbCount?(this.maxBreadcrumbCount=ra,b(d.WARNING,"initialize, 'maxCrashLogs' is deprecated. Use 'maxBreadcrumbCount' instead!")):ra||this.maxBreadcrumbCount||(this.maxBreadcrumbCount=100);"cookie"===this.storage&&(la=!1);this.rcAutoOptinAb||this.useExplicitRcApi||(b(d.WARNING,"initialize, Auto opting is disabled, switching to explicit RC API"),this.useExplicitRcApi=!0);Array.isArray(ba)||(ba=[]);""===this.url&&(b(d.ERROR,"initialize, Please provide server URL"),
47
- this.ignore_visitor=!0);w("cly_ignore")&&(this.ignore_visitor=!0);Ib();F=w("cly_queue")||[];J=w("cly_event")||[];O=w("cly_remote_configs")||{};this.clearStoredId&&(w("cly_id")&&!g&&(this.device_id=w("cly_id"),b(d.DEBUG,"initialize, temporarily using the previous device ID to flush existing events"),C=w("cly_id_type"),C||(b(d.DEBUG,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED, for event flushing"),C=0),B(),this.device_id=void 0,C=1),b(d.INFO,"initialize, Clearing the device ID storage"),
46
+ w(P.errorMessage)||"";ra&&!this.maxBreadcrumbCount?(this.maxBreadcrumbCount=ra,b(d.WARNING,"initialize, 'maxCrashLogs' is deprecated. Use 'maxBreadcrumbCount' instead!")):ra||this.maxBreadcrumbCount||(this.maxBreadcrumbCount=100);"cookie"===this.storage&&(ma=!1);this.rcAutoOptinAb||this.useExplicitRcApi||(b(d.WARNING,"initialize, Auto opting is disabled, switching to explicit RC API"),this.useExplicitRcApi=!0);Array.isArray(ba)||(ba=[]);""===this.url&&(b(d.ERROR,"initialize, Please provide server URL"),
47
+ this.ignore_visitor=!0);w("cly_ignore")&&(this.ignore_visitor=!0);Kb();F=w("cly_queue")||[];J=w("cly_event")||[];O=w("cly_remote_configs")||{};this.clearStoredId&&(w("cly_id")&&!g&&(this.device_id=w("cly_id"),b(d.DEBUG,"initialize, temporarily using the previous device ID to flush existing events"),C=w("cly_id_type"),C||(b(d.DEBUG,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED, for event flushing"),C=0),B(),this.device_id=void 0,C=1),b(d.INFO,"initialize, Clearing the device ID storage"),
48
48
  localStorage.removeItem(this.app_key+"/cly_id"),localStorage.removeItem(this.app_key+"/cly_id_type"),localStorage.removeItem(this.app_key+"/cly_session"));A();if(window.name&&0===window.name.indexOf("cly:"))try{this.passed_data=JSON.parse(window.name.replace("cly:",""))}catch(q){b(d.ERROR,"initialize, Could not parse name: "+window.name+", error: "+q)}else if(location.hash&&0===location.hash.indexOf("#cly:"))try{this.passed_data=JSON.parse(location.hash.replace("#cly:",""))}catch(q){b(d.ERROR,"initialize, Could not parse hash: "+
49
- location.hash+", error: "+q)}if((this.passed_data&&this.passed_data.app_key&&this.passed_data.app_key===this.app_key||this.passed_data&&!this.passed_data.app_key&&Pa)&&this.passed_data.token&&this.passed_data.purpose){this.passed_data.token!==w("cly_old_token")&&(Db(this.passed_data.token),u("cly_old_token",this.passed_data.token));var a=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),a=this.heatmapWhitelist.map(function(q){return na(q)})):a=[this.url];a.includes(this.passed_data.url)&&
50
- "heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,vb(),ub(this.passed_data.url+"/views/heatmap.js",wb))}if(this.ignore_visitor)b(d.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");else{b(d.DEBUG,"initialize, app_key:["+this.app_key+"], url:["+this.url+"]");b(d.DEBUG,"initialize, device_id:["+r("device_id",h,void 0)+"]");b(d.DEBUG,"initialize, require_consent is enabled:["+this.require_consent+"]");try{b(d.DEBUG,"initialize, metric override:["+
49
+ location.hash+", error: "+q)}if((this.passed_data&&this.passed_data.app_key&&this.passed_data.app_key===this.app_key||this.passed_data&&!this.passed_data.app_key&&Qa)&&this.passed_data.token&&this.passed_data.purpose){this.passed_data.token!==w("cly_old_token")&&(Fb(this.passed_data.token),v("cly_old_token",this.passed_data.token));var a=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),a=this.heatmapWhitelist.map(function(q){return oa(q)})):a=[this.url];a.includes(this.passed_data.url)&&
50
+ "heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,xb(),wb(this.passed_data.url+"/views/heatmap.js",yb))}if(this.ignore_visitor)b(d.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");else{b(d.DEBUG,"initialize, app_key:["+this.app_key+"], url:["+this.url+"]");b(d.DEBUG,"initialize, device_id:["+r("device_id",h,void 0)+"]");b(d.DEBUG,"initialize, require_consent is enabled:["+this.require_consent+"]");try{b(d.DEBUG,"initialize, metric override:["+
51
51
  JSON.stringify(this.metrics)+"]"),b(d.DEBUG,"initialize, header override:["+JSON.stringify(this.headers)+"]"),b(d.DEBUG,"initialize, number of onload callbacks provided:["+this.onload.length+"]"),b(d.DEBUG,"initialize, utm tags:["+JSON.stringify(this.utm)+"]"),ba&&b(d.DEBUG,"initialize, referrers to ignore :["+JSON.stringify(ba)+"]")}catch(q){b(d.ERROR,"initialize, Could not stringify some config object values")}b(d.DEBUG,"initialize, app_version:["+this.app_version+"]");b(d.DEBUG,"initialize, provided location info; country_code:["+
52
52
  this.country_code+"], city:["+this.city+"], ip_address:["+this.ip_address+"]");""!==this.namespace&&b(d.DEBUG,"initialize, namespace given:["+this.namespace+"]");this.clearStoredId&&b(d.DEBUG,"initialize, clearStoredId flag set to:["+this.clearStoredId+"]");this.ignore_prefetch&&b(d.DEBUG,"initialize, ignoring pre-fetching and pre-rendering from counting as real website visits :["+this.ignore_prefetch+"]");this.test_mode&&b(d.WARNING,"initialize, test_mode:["+this.test_mode+"], request queue won't be processed");
53
53
  this.test_mode_eq&&b(d.WARNING,"initialize, test_mode_eq:["+this.test_mode_eq+"], event queue won't be processed");this.heatmapWhitelist&&b(d.DEBUG,"initialize, heatmap whitelist:["+JSON.stringify(this.heatmapWhitelist)+"], these domains will be whitelisted");"default"!==this.storage&&b(d.DEBUG,"initialize, storage is set to:["+this.storage+"]");this.ignore_bots&&b(d.DEBUG,"initialize, ignore traffic from bots :["+this.ignore_bots+"]");this.force_post&&b(d.DEBUG,"initialize, forced post method for all requests:["+
54
54
  this.force_post+"]");this.remote_config&&b(d.DEBUG,"initialize, remote_config callback provided:["+!!this.remote_config+"]");"boolean"===typeof this.rcAutoOptinAb&&b(d.DEBUG,"initialize, automatic RC optin is enabled:["+this.rcAutoOptinAb+"]");this.useExplicitRcApi||b(d.WARNING,"initialize, will use legacy RC API. Consider enabling new API during init with use_explicit_rc_api flag");this.track_domains&&b(d.DEBUG,"initialize, tracking domain info:["+this.track_domains+"]");this.enableOrientationTracking&&
55
- b(d.DEBUG,"initialize, enableOrientationTracking:["+this.enableOrientationTracking+"]");ha||b(d.WARNING,"initialize, use_session_cookie is enabled:["+ha+"]");H&&b(d.DEBUG,"initialize, offline_mode:["+H+"], user info won't be send to the servers");H&&b(d.DEBUG,"initialize, stored remote configs:["+JSON.stringify(O)+"]");b(d.DEBUG,"initialize, 'getViewName' callback override provided:["+(this.getViewName!==m.getViewName)+"]");b(d.DEBUG,"initialize, 'getSearchQuery' callback override provided:["+(this.getSearchQuery!==
56
- m.getSearchQuery)+"]");128!==this.maxKeyLength&&b(d.DEBUG,"initialize, maxKeyLength set to:["+this.maxKeyLength+"] characters");256!==this.maxValueSize&&b(d.DEBUG,"initialize, maxValueSize set to:["+this.maxValueSize+"] characters");100!==this.maxSegmentationValues&&b(d.DEBUG,"initialize, maxSegmentationValues set to:["+this.maxSegmentationValues+"] key/value pairs");100!==this.maxBreadcrumbCount&&b(d.DEBUG,"initialize, maxBreadcrumbCount for custom logs set to:["+this.maxBreadcrumbCount+"] entries");
57
- 30!==this.maxStackTraceLinesPerThread&&b(d.DEBUG,"initialize, maxStackTraceLinesPerThread set to:["+this.maxStackTraceLinesPerThread+"] lines");200!==this.maxStackTraceLineLength&&b(d.DEBUG,"initialize, maxStackTraceLineLength set to:["+this.maxStackTraceLineLength+"] characters");500!==Ta&&b(d.DEBUG,"initialize, interval for heartbeats set to:["+Ta+"] milliseconds");1E3!==Ma&&b(d.DEBUG,"initialize, queue_size set to:["+Ma+"] items max");60!==Sa&&b(d.DEBUG,"initialize, fail_timeout set to:["+Sa+"] seconds of wait time after a failed connection to server");
58
- 20!==Fa&&b(d.DEBUG,"initialize, inactivity_time set to:["+Fa+"] minutes to consider a user as inactive after no observable action");60!==Qa&&b(d.DEBUG,"initialize, session_update set to:["+Qa+"] seconds to check if extending a session is needed while the user is active");100!==Ca&&b(d.DEBUG,"initialize, max_events set to:["+Ca+"] events to send in one batch");ra&&b(d.WARNING,"initialize, max_logs set to:["+ra+"] breadcrumbs to store for crash logs max, deprecated ");30!==Ba&&b(d.DEBUG,"initialize, session_cookie_timeout set to:["+
59
- Ba+"] minutes to expire a cookies session");b(d.INFO,"initialize, Countly initialized");a=null;g=f.getSearchQuery();var c=!1,e={};if(g){g=g.substring(1).split("&");for(var k=0;k<g.length;k++){var l=g[k].split("=");"cly_id"===l[0]?u("cly_cmp_id",l[1]):"cly_uid"===l[0]?u("cly_cmp_uid",l[1]):"cly_device_id"===l[0]?a=l[1]:0===(l[0]+"").indexOf("utm_")&&this.utm[l[0].replace("utm_","")]&&(e[l[0].replace("utm_","")]=l[1],c=!0)}}var g="[CLY]_temp_id"===w("cly_id");k=r("device_id",h,void 0);"number"===typeof k&&
60
- (k=k.toString());w("cly_id")&&!g?(this.device_id=w("cly_id"),b(d.INFO,"initialize, Set the stored device ID"),C=w("cly_id_type"),C||(b(d.INFO,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED"),C=0)):null!==a?(b(d.INFO,"initialize, Device ID set by URL"),this.device_id=a,C=3):k?(b(d.INFO,"initialize, Device ID set by developer"),this.device_id=k,h&&Object.keys(h).length?void 0!==h.device_id&&(C=0):void 0!==m.device_id&&(C=0)):H||g?(this.device_id="[CLY]_temp_id",
61
- C=2,H&&g?b(d.INFO,"initialize, Temp ID set, continuing offline mode from previous app session"):H&&!g?b(d.INFO,"initialize, Temp ID set, entering offline mode"):(H=!0,b(d.INFO,"initialize, Temp ID set, enabling offline mode"))):(b(d.INFO,"initialize, Generating the device ID"),this.device_id=r("device_id",h,eb()),h&&Object.keys(h).length?void 0!==h.device_id&&(C=0):void 0!==m.device_id&&(C=0));u("cly_id",this.device_id);u("cly_id_type",C);if(c){ja={};for(var n in this.utm)e[n]?(this.userData.set("utm_"+
62
- n,e[n]),ja[n]=e[n]):this.userData.unset("utm_"+n);this.userData.save()}U();setTimeout(function(){Na();f.remote_config&&f.fetch_remote_config(f.remote_config)},1);document.documentElement.setAttribute("data-countly-useragent",oa());qa.sendInstantHCRequest()}};this.halt=function(){b(d.WARNING,"halt, Resetting Countly");m.i=void 0;Pa=!m.i;T=!1;db="/i";La="/o/sdk";Ta=500;Ma=1E3;F=[];J=[];O={};ma=[];ca={};ba=[];hb=null;Aa=!0;ib=0;V=null;cb=za=ya=0;Sa=60;Fa=20;Ga=0;Qa=60;Ca=100;ra=null;ha=!0;Ba=30;Ra=!0;
63
- H=Oa=!1;da={};ka=!0;Fb=E();la=!0;sa=null;C=1;Ea=!1;Da=0;jb=!1;ja=xa=fa=null;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(c){b(d.ERROR,"halt, Local storage test failed, will fallback to cookies"),la=!1}m.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");D={};for(var a=0;a<m.features.length;a++)D[m.features[a]]={};f.app_key=void 0;f.device_id=void 0;f.onload=void 0;
55
+ b(d.DEBUG,"initialize, enableOrientationTracking:["+this.enableOrientationTracking+"]");ha||b(d.WARNING,"initialize, use_session_cookie is enabled:["+ha+"]");H&&b(d.DEBUG,"initialize, offline_mode:["+H+"], user info won't be send to the servers");H&&b(d.DEBUG,"initialize, stored remote configs:["+JSON.stringify(O)+"]");b(d.DEBUG,"initialize, 'getViewName' callback override provided:["+(this.getViewName!==n.getViewName)+"]");b(d.DEBUG,"initialize, 'getSearchQuery' callback override provided:["+(this.getSearchQuery!==
56
+ n.getSearchQuery)+"]");128!==this.maxKeyLength&&b(d.DEBUG,"initialize, maxKeyLength set to:["+this.maxKeyLength+"] characters");256!==this.maxValueSize&&b(d.DEBUG,"initialize, maxValueSize set to:["+this.maxValueSize+"] characters");100!==this.maxSegmentationValues&&b(d.DEBUG,"initialize, maxSegmentationValues set to:["+this.maxSegmentationValues+"] key/value pairs");100!==this.maxBreadcrumbCount&&b(d.DEBUG,"initialize, maxBreadcrumbCount for custom logs set to:["+this.maxBreadcrumbCount+"] entries");
57
+ 30!==this.maxStackTraceLinesPerThread&&b(d.DEBUG,"initialize, maxStackTraceLinesPerThread set to:["+this.maxStackTraceLinesPerThread+"] lines");200!==this.maxStackTraceLineLength&&b(d.DEBUG,"initialize, maxStackTraceLineLength set to:["+this.maxStackTraceLineLength+"] characters");500!==Ua&&b(d.DEBUG,"initialize, interval for heartbeats set to:["+Ua+"] milliseconds");1E3!==Na&&b(d.DEBUG,"initialize, queue_size set to:["+Na+"] items max");60!==Ta&&b(d.DEBUG,"initialize, fail_timeout set to:["+Ta+"] seconds of wait time after a failed connection to server");
58
+ 20!==Ga&&b(d.DEBUG,"initialize, inactivity_time set to:["+Ga+"] minutes to consider a user as inactive after no observable action");60!==Ra&&b(d.DEBUG,"initialize, session_update set to:["+Ra+"] seconds to check if extending a session is needed while the user is active");100!==Da&&b(d.DEBUG,"initialize, max_events set to:["+Da+"] events to send in one batch");ra&&b(d.WARNING,"initialize, max_logs set to:["+ra+"] breadcrumbs to store for crash logs max, deprecated ");30!==Ca&&b(d.DEBUG,"initialize, session_cookie_timeout set to:["+
59
+ Ca+"] minutes to expire a cookies session");b(d.INFO,"initialize, Countly initialized");a=null;g=f.getSearchQuery();var c=!1,e={};if(g){g=g.substring(1).split("&");for(var k=0;k<g.length;k++){var l=g[k].split("=");"cly_id"===l[0]?v("cly_cmp_id",l[1]):"cly_uid"===l[0]?v("cly_cmp_uid",l[1]):"cly_device_id"===l[0]?a=l[1]:0===(l[0]+"").indexOf("utm_")&&this.utm[l[0].replace("utm_","")]&&(e[l[0].replace("utm_","")]=l[1],c=!0)}}var g="[CLY]_temp_id"===w("cly_id");k=r("device_id",h,void 0);"number"===typeof k&&
60
+ (k=k.toString());w("cly_id")&&!g?(this.device_id=w("cly_id"),b(d.INFO,"initialize, Set the stored device ID"),C=w("cly_id_type"),C||(b(d.INFO,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED"),C=0)):null!==a?(b(d.INFO,"initialize, Device ID set by URL"),this.device_id=a,C=3):k?(b(d.INFO,"initialize, Device ID set by developer"),this.device_id=k,h&&Object.keys(h).length?void 0!==h.device_id&&(C=0):void 0!==n.device_id&&(C=0)):H||g?(this.device_id="[CLY]_temp_id",
61
+ C=2,H&&g?b(d.INFO,"initialize, Temp ID set, continuing offline mode from previous app session"):H&&!g?b(d.INFO,"initialize, Temp ID set, entering offline mode"):(H=!0,b(d.INFO,"initialize, Temp ID set, enabling offline mode"))):(b(d.INFO,"initialize, Generating the device ID"),this.device_id=r("device_id",h,gb()),h&&Object.keys(h).length?void 0!==h.device_id&&(C=0):void 0!==n.device_id&&(C=0));v("cly_id",this.device_id);v("cly_id_type",C);if(c){ja={};for(var m in this.utm)e[m]?(this.userData.set("utm_"+
62
+ m,e[m]),ja[m]=e[m]):this.userData.unset("utm_"+m);this.userData.save()}T();setTimeout(function(){Oa();f.remote_config&&f.fetch_remote_config(f.remote_config)},1);document.documentElement.setAttribute("data-countly-useragent",pa());qa.sendInstantHCRequest()}};this.halt=function(){b(d.WARNING,"halt, Resetting Countly");n.i=void 0;Qa=!n.i;S=!1;fb="/i";Ma="/o/sdk";Ua=500;Na=1E3;F=[];J=[];O={};na=[];ca={};ba=[];jb=null;Ba=!0;kb=0;U=null;eb=Aa=za=0;Ta=60;Ga=20;Ha=0;Ra=60;Da=100;ra=null;ha=!0;Ca=30;Sa=!0;
63
+ H=Pa=!1;da={};la=!0;Hb=E();ma=!0;sa=null;C=1;Fa=!1;Ea=0;lb=!1;ja=xa=fa=null;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(c){b(d.ERROR,"halt, Local storage test failed, will fallback to cookies"),ma=!1}n.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");D={};for(var a=0;a<n.features.length;a++)D[n.features[a]]={};f.app_key=void 0;f.device_id=void 0;f.onload=void 0;
64
64
  f.utm=void 0;f.ignore_prefetch=void 0;f.debug=void 0;f.test_mode=void 0;f.test_mode_eq=void 0;f.metrics=void 0;f.headers=void 0;f.url=void 0;f.app_version=void 0;f.country_code=void 0;f.city=void 0;f.ip_address=void 0;f.ignore_bots=void 0;f.force_post=void 0;f.rcAutoOptinAb=void 0;f.useExplicitRcApi=void 0;f.remote_config=void 0;f.ignore_visitor=void 0;f.require_consent=void 0;f.track_domains=void 0;f.storage=void 0;f.enableOrientationTracking=void 0;f.maxKeyLength=void 0;f.maxValueSize=void 0;f.maxSegmentationValues=
65
65
  void 0;f.maxBreadcrumbCount=void 0;f.maxStackTraceLinesPerThread=void 0;f.maxStackTraceLineLength=void 0};this.group_features=function(a){b(d.INFO,"group_features, Grouping features");if(a)for(var c in a)D[c]?b(d.WARNING,"group_features, Feature name ["+c+"] is already reserved"):"string"===typeof a[c]?D[c]={features:[a[c]]}:a[c]&&Array.isArray(a[c])&&a[c].length?D[c]={features:a[c]}:b(d.ERROR,"group_features, Incorrect feature list for ["+c+"] value: ["+a[c]+"]");else b(d.ERROR,"group_features, Incorrect features:["+
66
66
  a+"]")};this.check_consent=function(a){b(d.INFO,"check_consent, Checking if consent is given for specific feature:["+a+"]");if(!this.require_consent)return b(d.INFO,"check_consent, require_consent is off, no consent is necessary"),!0;if(D[a])return!(!D[a]||!D[a].optin);b(d.ERROR,"check_consent, No feature available for ["+a+"]");return!1};this.get_device_id_type=function(){b(d.INFO,"check_device_id_type, Retrieving the current device id type.["+C+"]");switch(C){case 1:var a=f.DeviceIdType.SDK_GENERATED;
67
67
  break;case 3:case 0:a=f.DeviceIdType.DEVELOPER_SUPPLIED;break;case 2:a=f.DeviceIdType.TEMPORARY_ID;break;default:a=-1}return a};this.get_device_id=function(){b(d.INFO,"get_device_id, Retrieving the device id: ["+f.device_id+"]");return f.device_id};this.check_any_consent=function(){b(d.INFO,"check_any_consent, Checking if any consent is given");if(!this.require_consent)return b(d.INFO,"check_any_consent, require_consent is off, no consent is necessary"),!0;for(var a in D)if(D[a]&&D[a].optin)return!0;
68
- b(d.INFO,"check_any_consent, No consents given");return!1};this.add_consent=function(a){b(d.INFO,"add_consent, Adding consent for ["+a+"]");if(Array.isArray(a))for(var c=0;c<a.length;c++)this.add_consent(a[c]);else D[a]?D[a].features?(D[a].optin=!0,this.add_consent(D[a].features)):!0!==D[a].optin&&(D[a].optin=!0,Gb(),setTimeout(function(){"sessions"===a&&da.begin_session?(f.begin_session.apply(f,da.begin_session),da.begin_session=null):"views"===a&&da.track_pageview&&(V=null,f.track_pageview.apply(f,
69
- da.track_pageview),da.track_pageview=null)},1)):b(d.ERROR,"add_consent, No feature available for ["+a+"]")};this.remove_consent=function(a){b(d.INFO,"remove_consent, Removing consent for ["+a+"]");this.remove_consent_internal(a,!0)};this.remove_consent_internal=function(a,c){c=c||!1;if(Array.isArray(a))for(var e=0;e<a.length;e++)this.remove_consent_internal(a[e],c);else D[a]?D[a].features?this.remove_consent_internal(D[a].features,c):(D[a].optin=!1,c&&!1!==D[a].optin&&Gb()):b(d.WARNING,"remove_consent, No feature available for ["+
70
- a+"]")};var Ua,Gb=function(){Ua&&(clearTimeout(Ua),Ua=null);Ua=setTimeout(function(){for(var a={},c=0;c<m.features.length;c++)a[m.features[c]]=!0===D[m.features[c]].optin?!0:!1;G({consent:JSON.stringify(a)});b(d.DEBUG,"Consent update request has been sent to the queue.")},1E3)};this.enable_offline_mode=function(){b(d.INFO,"enable_offline_mode, Enabling offline mode");this.remove_consent_internal(m.features,!1);H=!0;this.device_id="[CLY]_temp_id";f.device_id=this.device_id;C=2};this.disable_offline_mode=
71
- function(a){if(H){b(d.INFO,"disable_offline_mode, Disabling offline mode");H=!1;a&&this.device_id!==a?(this.device_id=a,f.device_id=this.device_id,C=0,u("cly_id",this.device_id),u("cly_id_type",0),b(d.INFO,"disable_offline_mode, Changing id to: "+this.device_id)):(this.device_id=eb(),"[CLY]_temp_id"===this.device_id&&(this.device_id=Ya()),f.device_id=this.device_id,this.device_id!==w("cly_id")&&(u("cly_id",this.device_id),u("cly_id_type",1)));a=!1;if(0<F.length)for(var c=0;c<F.length;c++)"[CLY]_temp_id"===
72
- F[c].device_id&&(F[c].device_id=this.device_id,a=!0);a&&u("cly_queue",F,!0)}else b(d.WARNING,"disable_offline_mode, Countly was not in offline mode.")};this.begin_session=function(a,c){b(d.INFO,"begin_session, Starting the session. There was an ongoing session: ["+T+"]");a&&b(d.INFO,"begin_session, Heartbeats are disabled");c&&b(d.INFO,"begin_session, Session starts irrespective of session cookie");if(this.check_consent("sessions")){if(!T){this.enableOrientationTracking&&(this.report_orientation(),
73
- y(window,"resize",function(){f.report_orientation()}));ia=E();T=!0;Aa=!a;var e=w("cly_session");b(d.VERBOSE,"begin_session, Session state, forced: ["+c+"], useSessionCookie: ["+ha+"], seconds to expire: ["+(e-ia)+"], expired: ["+(parseInt(e)<=E())+"] ");if(c||!ha||!e||parseInt(e)<=E())b(d.INFO,"begin_session, Session started"),null===sa&&(sa=!0),e={begin_session:1},e.metrics=JSON.stringify(Ka()),G(e);u("cly_session",E()+60*Ba)}}else da.begin_session=arguments};this.session_duration=function(a){b(d.INFO,
74
- "session_duration, Reporting session duration");this.check_consent("sessions")&&T&&(b(d.INFO,"session_duration, Session extended: ",a),G({session_duration:a}),va())};this.end_session=function(a,c){b(d.INFO,"end_session, Ending the current session. There was an on going session:["+T+"]");this.check_consent("sessions")&&T&&(a=a||E()-ia,R(),!ha||c?(b(d.INFO,"end_session, Session ended"),G({end_session:1,session_duration:a})):this.session_duration(a),T=!1)};this.change_id=function(a,c){b(d.INFO,"change_id, Changing the ID");
75
- c&&b(d.INFO,"change_id, Will merge the IDs");if(!a||"string"!==typeof a||0===a.length)b(d.ERROR,"change_id, The provided ID: ["+a+"] is not a valid ID");else if(H)b(d.WARNING,"change_id, Offline mode was on, initiating disabling sequence instead."),this.disable_offline_mode(a);else if(this.device_id!=a){c||(B(),this.end_session(null,!0),ca={},this.remove_consent_internal(m.features,!1));var e=this.device_id;this.device_id=a;f.device_id=this.device_id;C=0;u("cly_id",this.device_id);u("cly_id_type",
76
- 0);b(d.INFO,"change_id, Changing ID from:["+e+"] to ["+a+"]");c?G({old_device_id:e}):this.begin_session(!Aa,!0);this.remote_config&&(O={},u("cly_remote_configs",O),this.fetch_remote_config(this.remote_config))}};this.add_event=function(a){b(d.INFO,"add_event, Adding event: ",a);switch(a.key){case I.NPS:var c=this.check_consent("feedback");break;case I.SURVEY:c=this.check_consent("feedback");break;case I.STAR_RATING:c=this.check_consent("star-rating");break;case I.VIEW:c=this.check_consent("views");
68
+ b(d.INFO,"check_any_consent, No consents given");return!1};this.add_consent=function(a){b(d.INFO,"add_consent, Adding consent for ["+a+"]");if(Array.isArray(a))for(var c=0;c<a.length;c++)this.add_consent(a[c]);else D[a]?D[a].features?(D[a].optin=!0,this.add_consent(D[a].features)):!0!==D[a].optin&&(D[a].optin=!0,Ib(),setTimeout(function(){"sessions"===a&&da.begin_session?(f.begin_session.apply(f,da.begin_session),da.begin_session=null):"views"===a&&da.track_pageview&&(U=null,f.track_pageview.apply(f,
69
+ da.track_pageview),da.track_pageview=null)},1)):b(d.ERROR,"add_consent, No feature available for ["+a+"]")};this.remove_consent=function(a){b(d.INFO,"remove_consent, Removing consent for ["+a+"]");this.remove_consent_internal(a,!0)};this.remove_consent_internal=function(a,c){c=c||!1;if(Array.isArray(a))for(var e=0;e<a.length;e++)this.remove_consent_internal(a[e],c);else D[a]?D[a].features?this.remove_consent_internal(D[a].features,c):(D[a].optin=!1,c&&!1!==D[a].optin&&Ib()):b(d.WARNING,"remove_consent, No feature available for ["+
70
+ a+"]")};var Va,Ib=function(){Va&&(clearTimeout(Va),Va=null);Va=setTimeout(function(){for(var a={},c=0;c<n.features.length;c++)a[n.features[c]]=!0===D[n.features[c]].optin?!0:!1;G({consent:JSON.stringify(a)});b(d.DEBUG,"Consent update request has been sent to the queue.")},1E3)};this.enable_offline_mode=function(){b(d.INFO,"enable_offline_mode, Enabling offline mode");this.remove_consent_internal(n.features,!1);H=!0;this.device_id="[CLY]_temp_id";f.device_id=this.device_id;C=2};this.disable_offline_mode=
71
+ function(a){if(H){b(d.INFO,"disable_offline_mode, Disabling offline mode");H=!1;a&&this.device_id!==a?(this.device_id=a,f.device_id=this.device_id,C=0,v("cly_id",this.device_id),v("cly_id_type",0),b(d.INFO,"disable_offline_mode, Changing id to: "+this.device_id)):(this.device_id=gb(),"[CLY]_temp_id"===this.device_id&&(this.device_id=$a()),f.device_id=this.device_id,this.device_id!==w("cly_id")&&(v("cly_id",this.device_id),v("cly_id_type",1)));a=!1;if(0<F.length)for(var c=0;c<F.length;c++)"[CLY]_temp_id"===
72
+ F[c].device_id&&(F[c].device_id=this.device_id,a=!0);a&&v("cly_queue",F,!0)}else b(d.WARNING,"disable_offline_mode, Countly was not in offline mode.")};this.begin_session=function(a,c){b(d.INFO,"begin_session, Starting the session. There was an ongoing session: ["+S+"]");a&&b(d.INFO,"begin_session, Heartbeats are disabled");c&&b(d.INFO,"begin_session, Session starts irrespective of session cookie");if(this.check_consent("sessions")){if(!S){this.enableOrientationTracking&&(this.report_orientation(),
73
+ y(window,"resize",function(){f.report_orientation()}));ia=E();S=!0;Ba=!a;var e=w("cly_session");b(d.VERBOSE,"begin_session, Session state, forced: ["+c+"], useSessionCookie: ["+ha+"], seconds to expire: ["+(e-ia)+"], expired: ["+(parseInt(e)<=E())+"] ");if(c||!ha||!e||parseInt(e)<=E())b(d.INFO,"begin_session, Session started"),null===sa&&(sa=!0),e={begin_session:1},e.metrics=JSON.stringify(La()),G(e);v("cly_session",E()+60*Ca)}}else da.begin_session=arguments};this.session_duration=function(a){b(d.INFO,
74
+ "session_duration, Reporting session duration");this.check_consent("sessions")&&S&&(b(d.INFO,"session_duration, Session extended: ",a),G({session_duration:a}),va())};this.end_session=function(a,c){b(d.INFO,"end_session, Ending the current session. There was an on going session:["+S+"]");this.check_consent("sessions")&&S&&(a=a||E()-ia,R(),!ha||c?(b(d.INFO,"end_session, Session ended"),G({end_session:1,session_duration:a})):this.session_duration(a),S=!1)};this.change_id=function(a,c){b(d.INFO,"change_id, Changing the ID");
75
+ c&&b(d.INFO,"change_id, Will merge the IDs");if(!a||"string"!==typeof a||0===a.length)b(d.ERROR,"change_id, The provided ID: ["+a+"] is not a valid ID");else if(H)b(d.WARNING,"change_id, Offline mode was on, initiating disabling sequence instead."),this.disable_offline_mode(a);else if(this.device_id!=a){c||(B(),this.end_session(null,!0),ca={},this.remove_consent_internal(n.features,!1));var e=this.device_id;this.device_id=a;f.device_id=this.device_id;C=0;v("cly_id",this.device_id);v("cly_id_type",
76
+ 0);b(d.INFO,"change_id, Changing ID from:["+e+"] to ["+a+"]");c?G({old_device_id:e}):this.begin_session(!Ba,!0);this.remote_config&&(O={},v("cly_remote_configs",O),this.fetch_remote_config(this.remote_config))}};this.add_event=function(a){b(d.INFO,"add_event, Adding event: ",a);switch(a.key){case I.NPS:var c=this.check_consent("feedback");break;case I.SURVEY:c=this.check_consent("feedback");break;case I.STAR_RATING:c=this.check_consent("star-rating");break;case I.VIEW:c=this.check_consent("views");
77
77
  break;case I.ORIENTATION:c=this.check_consent("users");break;case I.ACTION:c=this.check_consent("clicks")||this.check_consent("scrolls");break;default:c=this.check_consent("events")}c&&p(a)};this.start_event=function(a){a&&"string"===typeof a?(b(d.INFO,"start_event, Starting timed event with key: ["+a+"]"),a=x(a,f.maxKeyLength,"start_event",b),ca[a]?b(d.WARNING,"start_event, Timed event with key: ["+a+"] already started"):ca[a]=E()):b(d.WARNING,"start_event, you have to provide a valid string key instead of: ["+
78
78
  a+"]")};this.cancel_event=function(a){if(!a||"string"!==typeof a)return b(d.WARNING,"cancel_event, you have to provide a valid string key instead of: ["+a+"]"),!1;b(d.INFO,"cancel_event, Canceling timed event with key: ["+a+"]");a=x(a,f.maxKeyLength,"cancel_event",b);if(ca[a])return delete ca[a],b(d.INFO,"cancel_event, Timed event with key: ["+a+"] is canceled"),!0;b(d.WARNING,"cancel_event, Timed event with key: ["+a+"] was not found");return!1};this.end_event=function(a){a?(b(d.INFO,"end_event, Ending timed event"),
79
79
  "string"===typeof a&&(a=x(a,f.maxKeyLength,"end_event",b),a={key:a}),a.key?ca[a.key]?(a.dur=E()-ca[a.key],this.add_event(a),delete ca[a.key]):b(d.ERROR,"end_event, Timed event with key: ["+a.key+"] was not started"):b(d.ERROR,"end_event, Timed event must have a key property")):b(d.WARNING,"end_event, you have to provide a valid string key or event object instead of: ["+a+"]")};this.report_orientation=function(a){b(d.INFO,"report_orientation, Reporting orientation");this.check_consent("users")&&p({key:I.ORIENTATION,
80
80
  segmentation:{mode:a||(window.innerWidth>window.innerHeight?"landscape":"portrait")}})};this.report_conversion=function(a,c){b(d.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!");this.recordDirectAttribution(a,c)};this.recordDirectAttribution=function(a,c){b(d.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+a+"] and the user ID: ["+c+"]");this.check_consent("attribution")&&(a=a||w("cly_cmp_id")||
81
81
  "cly_organic",(c=c||w("cly_cmp_uid"))?G({campaign_id:a,campaign_user:c}):G({campaign_id:a}))};this.user_details=function(a){b(d.INFO,"user_details, Trying to add user details: ",a);this.check_consent("users")&&(B(),b(d.INFO,"user_details, flushed the event queue"),a.name=x(a.name,f.maxValueSize,"user_details",b),a.username=x(a.username,f.maxValueSize,"user_details",b),a.email=x(a.email,f.maxValueSize,"user_details",b),a.organization=x(a.organization,f.maxValueSize,"user_details",b),a.phone=x(a.phone,
82
- f.maxValueSize,"user_details",b),a.picture=x(a.picture,4096,"user_details",b),a.gender=x(a.gender,f.maxValueSize,"user_details",b),a.byear=x(a.byear,f.maxValueSize,"user_details",b),a.custom=Y(a.custom,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"user_details",b),G({user_details:JSON.stringify(ua(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var X={},ea=function(a,c,e){f.check_consent("users")&&(X[a]||(X[a]={}),"$push"===e||"$pull"===e||"$addToSet"===
83
- e?(X[a][e]||(X[a][e]=[]),X[a][e].push(c)):X[a][e]=c)};this.userData={set:function(a,c){b(d.INFO,"[userData] set, Setting user's custom property value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData set",b);c=x(c,f.maxValueSize,"userData set",b);X[a]=c},unset:function(a){b(d.INFO,"[userData] unset, Resetting user's custom property with key: ["+a+"] ");X[a]=""},set_once:function(a,c){b(d.INFO,"[userData] set_once, Setting user's unique custom property value: ["+c+"] under the key: ["+
82
+ f.maxValueSize,"user_details",b),a.picture=x(a.picture,4096,"user_details",b),a.gender=x(a.gender,f.maxValueSize,"user_details",b),a.byear=x(a.byear,f.maxValueSize,"user_details",b),a.custom=Y(a.custom,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"user_details",b),G({user_details:JSON.stringify(ua(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var W={},ea=function(a,c,e){f.check_consent("users")&&(W[a]||(W[a]={}),"$push"===e||"$pull"===e||"$addToSet"===
83
+ e?(W[a][e]||(W[a][e]=[]),W[a][e].push(c)):W[a][e]=c)};this.userData={set:function(a,c){b(d.INFO,"[userData] set, Setting user's custom property value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData set",b);c=x(c,f.maxValueSize,"userData set",b);W[a]=c},unset:function(a){b(d.INFO,"[userData] unset, Resetting user's custom property with key: ["+a+"] ");W[a]=""},set_once:function(a,c){b(d.INFO,"[userData] set_once, Setting user's unique custom property value: ["+c+"] under the key: ["+
84
84
  a+"] ");a=x(a,f.maxKeyLength,"userData set_once",b);c=x(c,f.maxValueSize,"userData set_once",b);ea(a,c,"$setOnce")},increment:function(a){b(d.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+a+"] by one");a=x(a,f.maxKeyLength,"userData increment",b);ea(a,1,"$inc")},increment_by:function(a,c){b(d.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+a+"] by: ["+c+"]");a=x(a,f.maxKeyLength,"userData increment_by",b);c=x(c,f.maxValueSize,
85
85
  "userData increment_by",b);ea(a,c,"$inc")},multiply:function(a,c){b(d.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+a+"] by: ["+c+"]");a=x(a,f.maxKeyLength,"userData multiply",b);c=x(c,f.maxValueSize,"userData multiply",b);ea(a,c,"$mul")},max:function(a,c){b(d.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData max",b);c=x(c,f.maxValueSize,"userData max",b);
86
86
  ea(a,c,"$max")},min:function(a,c){b(d.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData min",b);c=x(c,f.maxValueSize,"userData min",b);ea(a,c,"$min")},push:function(a,c){b(d.INFO,"[userData] push, Pushing a value: ["+c+"] under the key: ["+a+"] to user's custom property array");a=x(a,f.maxKeyLength,"userData push",b);c=x(c,f.maxValueSize,"userData push",b);ea(a,c,"$push")},push_unique:function(a,
87
87
  c){b(d.INFO,"[userData] push_unique, Pushing a unique value: ["+c+"] under the key: ["+a+"] to user's custom property array");a=x(a,f.maxKeyLength,"userData push_unique",b);c=x(c,f.maxValueSize,"userData push_unique",b);ea(a,c,"$addToSet")},pull:function(a,c){b(d.INFO,"[userData] pull, Removing the value: ["+c+"] under the key: ["+a+"] from user's custom property array");ea(a,c,"$pull")},save:function(){b(d.INFO,"[userData] save, Saving changes to user's custom property");f.check_consent("users")&&
88
- (B(),b(d.INFO,"user_details, flushed the event queue"),G({user_details:JSON.stringify({custom:X})}));X={}}};this.report_trace=function(a){b(d.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var c="type name stz etz apm_metrics apm_attr".split(" "),e=0;e<c.length;e++)if("apm_attr"!==c[e]&&"undefined"===typeof a[c[e]]){b(d.WARNING,"report_trace, APM trace don't have the property: "+c[e]);return}a.name=x(a.name,f.maxKeyLength,"report_trace",b);a.app_metrics=Y(a.app_metrics,
89
- f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"report_trace",b);c=ua(a,c);c.timestamp=a.stz;a=new Date;c.hour=a.getHours();c.dow=a.getDay();G({apm:JSON.stringify(c)});b(d.INFO,"report_trace, Successfully adding APM trace: ",c)}};this.track_errors=function(a){b(d.INFO,"track_errors, Started tracking errors");m.i[this.app_key].tracking_crashes=!0;window.cly_crashes||(window.cly_crashes=!0,hb=a,window.onerror=function q(e,k,l,g,n){if(void 0!==n&&null!==n)$a(n,!1);else{g=g||window.event&&window.event.errorCharacter;
90
- n="";"undefined"!==typeof e&&(n+=e+"\n");"undefined"!==typeof k&&(n+="at "+k);"undefined"!==typeof l&&(n+=":"+l);"undefined"!==typeof g&&(n+=":"+g);n+="\n";try{e=[];for(var v=q.caller;v;)e.push(v.name),v=v.caller;n+=e.join("\n")}catch(K){b(d.ERROR,"track_errors, Call stack generation experienced a problem: "+K)}$a(n,!1)}},window.addEventListener("unhandledrejection",function(e){$a(Error("Unhandled rejection (reason: "+(e.reason&&e.reason.stack?e.reason.stack:e.reason)+")."),!0)}))};this.log_error=
91
- function(a,c){b(d.INFO,"log_error, Logging errors");this.recordError(a,!0,c)};this.add_log=function(a){b(d.INFO,"add_log, Adding a new log of breadcrumbs: [ "+a+" ]");if(this.check_consent("crashes")){for(a=x(a,f.maxValueSize,"add_log",b);ma.length>=f.maxBreadcrumbCount;)ma.shift(),b(d.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");ma.push(a)}};this.fetch_remote_config=function(a,c,e){var k=null,l=null,g=null;a&&(e||"function"!==typeof a?Array.isArray(a)&&(k=a):g=a);
92
- c&&(e||"function"!==typeof c?Array.isArray(c)&&(l=c):g=c);g||"function"!==typeof e||(g=e);this.useExplicitRcApi?(b(d.INFO,"fetch_remote_config, Fetching remote config"),t(k,l,this.rcAutoOptinAb?1:0,null,g)):(b(d.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),t(k,l,null,"legacy",g))};this.enrollUserToAb=function(a){b(d.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},Z(a),
93
- aa("enrollUserToAb",this.url+La,a,function(c,e,k){if(c)b(d.ERROR,"enrollUserToAb, An error occurred: "+c);else try{var l=JSON.parse(k);b(d.DEBUG,"enrollUserToAb, Parsed the response's result: ["+l.result+"]")}catch(g){b(d.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+g)}},!0)):b(d.ERROR,"enrollUserToAb, No keys provided")};this.get_remote_config=function(a){b(d.INFO,"get_remote_config, Getting remote config from storage");return"undefined"!==typeof a?O[a]:O};this.stop_time=function(){b(d.INFO,
94
- "stop_time, Stopping tracking duration");ka&&(ka=!1,ib=E()-ia,za=E()-ya)};this.start_time=function(){b(d.INFO,"start_time, Starting tracking duration");ka||(ka=!0,ia=E()-ib,ya=E()-za,za=0,va())};this.track_sessions=function(){function a(){document[e]||!document.hasFocus()?f.stop_time():f.start_time()}function c(){Ga>=Fa&&f.start_time();Ga=0}b(d.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();y(window,"beforeunload",function(){B();f.end_session()});var e=
88
+ (B(),b(d.INFO,"user_details, flushed the event queue"),G({user_details:JSON.stringify({custom:W})}));W={}}};this.report_trace=function(a){b(d.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var c="type name stz etz apm_metrics apm_attr".split(" "),e=0;e<c.length;e++)if("apm_attr"!==c[e]&&"undefined"===typeof a[c[e]]){b(d.WARNING,"report_trace, APM trace don't have the property: "+c[e]);return}a.name=x(a.name,f.maxKeyLength,"report_trace",b);a.app_metrics=Y(a.app_metrics,
89
+ f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"report_trace",b);c=ua(a,c);c.timestamp=a.stz;a=new Date;c.hour=a.getHours();c.dow=a.getDay();G({apm:JSON.stringify(c)});b(d.INFO,"report_trace, Successfully adding APM trace: ",c)}};this.track_errors=function(a){b(d.INFO,"track_errors, Started tracking errors");n.i[this.app_key].tracking_crashes=!0;window.cly_crashes||(window.cly_crashes=!0,jb=a,window.onerror=function q(e,k,l,g,m){if(void 0!==m&&null!==m)bb(m,!1);else{g=g||window.event&&window.event.errorCharacter;
90
+ m="";"undefined"!==typeof e&&(m+=e+"\n");"undefined"!==typeof k&&(m+="at "+k);"undefined"!==typeof l&&(m+=":"+l);"undefined"!==typeof g&&(m+=":"+g);m+="\n";try{e=[];for(var t=q.caller;t;)e.push(t.name),t=t.caller;m+=e.join("\n")}catch(K){b(d.ERROR,"track_errors, Call stack generation experienced a problem: "+K)}bb(m,!1)}},window.addEventListener("unhandledrejection",function(e){bb(Error("Unhandled rejection (reason: "+(e.reason&&e.reason.stack?e.reason.stack:e.reason)+")."),!0)}))};this.log_error=
91
+ function(a,c){b(d.INFO,"log_error, Logging errors");this.recordError(a,!0,c)};this.add_log=function(a){b(d.INFO,"add_log, Adding a new log of breadcrumbs: [ "+a+" ]");if(this.check_consent("crashes")){for(a=x(a,f.maxValueSize,"add_log",b);na.length>=f.maxBreadcrumbCount;)na.shift(),b(d.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");na.push(a)}};this.fetch_remote_config=function(a,c,e){var k=null,l=null,g=null;a&&(e||"function"!==typeof a?Array.isArray(a)&&(k=a):g=a);
92
+ c&&(e||"function"!==typeof c?Array.isArray(c)&&(l=c):g=c);g||"function"!==typeof e||(g=e);this.useExplicitRcApi?(b(d.INFO,"fetch_remote_config, Fetching remote config"),u(k,l,this.rcAutoOptinAb?1:0,null,g)):(b(d.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),u(k,l,null,"legacy",g))};this.enrollUserToAb=function(a){b(d.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},Z(a),
93
+ aa("enrollUserToAb",this.url+Ma,a,function(c,e,k){if(c)b(d.ERROR,"enrollUserToAb, An error occurred: "+c);else try{var l=JSON.parse(k);b(d.DEBUG,"enrollUserToAb, Parsed the response's result: ["+l.result+"]")}catch(g){b(d.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+g)}},!0)):b(d.ERROR,"enrollUserToAb, No keys provided")};this.get_remote_config=function(a){b(d.INFO,"get_remote_config, Getting remote config from storage");return"undefined"!==typeof a?O[a]:O};this.stop_time=function(){b(d.INFO,
94
+ "stop_time, Stopping tracking duration");la&&(la=!1,kb=E()-ia,Aa=E()-za)};this.start_time=function(){b(d.INFO,"start_time, Starting tracking duration");la||(la=!0,ia=E()-kb,za=E()-Aa,Aa=0,va())};this.track_sessions=function(){function a(){document[e]||!document.hasFocus()?f.stop_time():f.start_time()}function c(){Ha>=Ga&&f.start_time();Ha=0}b(d.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();y(window,"beforeunload",function(){B();f.end_session()});var e=
95
95
  "hidden";y(window,"focus",a);y(window,"blur",a);y(window,"pageshow",a);y(window,"pagehide",a);"onfocusin"in document&&(y(window,"focusin",a),y(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));
96
- y(window,"mousemove",c);y(window,"click",c);y(window,"keydown",c);y(window,"scroll",c);setInterval(function(){Ga++;Ga>=Fa&&f.stop_time()},6E4)};this.track_pageview=function(a,c,e){b(d.INFO,"track_pageview, Tracking page views");b(d.VERBOSE,"track_pageview, last view is:["+V+"], current view ID is:["+fa+"], previous view ID is:["+xa+"]");V&&jb&&(b(d.DEBUG,"track_pageview, Scroll registry triggered"),gb(),Ea=!0,Da=0);R();xa=fa;fa=Xa();(a=x(a,f.maxKeyLength,"track_pageview",b))&&Array.isArray(a)&&(c=
96
+ y(window,"mousemove",c);y(window,"click",c);y(window,"keydown",c);y(window,"scroll",c);setInterval(function(){Ha++;Ha>=Ga&&f.stop_time()},6E4)};this.track_pageview=function(a,c,e){b(d.INFO,"track_pageview, Tracking page views");b(d.VERBOSE,"track_pageview, last view is:["+U+"], current view ID is:["+fa+"], previous view ID is:["+xa+"]");U&&lb&&(b(d.DEBUG,"track_pageview, Scroll registry triggered"),ib(),Fa=!0,Ea=0);R();xa=fa;fa=Za();(a=x(a,f.maxKeyLength,"track_pageview",b))&&Array.isArray(a)&&(c=
97
97
  a,a=null);a||(a=this.getViewName());if(void 0===a||""===a)b(d.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(d.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else{if(c&&c.length)for(var k=0;k<c.length;k++)try{if((new RegExp(c[k])).test(a)){b(d.INFO,"track_pageview, Ignoring the page: "+a);return}}catch(q){b(d.ERROR,"track_pageview, Problem with finding ignore list item: "+c[k]+
98
- ", error: "+q)}V=a;ya=E();b(d.VERBOSE,"track_pageview, last view is assigned:["+V+"], current view ID is:["+fa+"], previous view ID is:["+xa+"]");k={name:a,visit:1,view:f.getViewUrl()};k=Y(k,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"track_pageview",b);this.track_domains&&(k.domain=window.location.hostname);if(ha)if(T)sa&&(sa=!1,k.start=1);else{var l=w("cly_session");if(!l||parseInt(l)<=E())sa=!1,k.start=1}else"undefined"!==typeof document.referrer&&document.referrer.length&&(l=xb.exec(document.referrer))&&
99
- l[11]&&l[11]!==window.location.hostname&&(k.start=1);if(ja&&Object.keys(ja).length){b(d.INFO,"track_pageview, Adding fresh utm tags to segmentation:["+JSON.stringify(ja)+"]");for(var g in ja)"undefined"===typeof k["utm_"+g]&&(k["utm_"+g]=ja[g])}fb()&&(b(d.INFO,"track_pageview, Adding referrer to segmentation:["+document.referrer+"]"),k.referrer=document.referrer);if(e){e=Y(e,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"track_pageview",b);for(var n in e)"undefined"===typeof k[n]&&(k[n]=e[n])}this.check_consent("views")?
100
- p({key:I.VIEW,segmentation:k},fa):da.track_pageview=arguments}};this.track_view=function(a,c,e){b(d.INFO,"track_view, Initiating tracking page views");this.track_pageview(a,c,e)};this.track_clicks=function(a){b(d.INFO,"track_clicks, Starting to track clicks");a&&b(d.INFO,"track_clicks, Tracking the specified children:["+a+"]");a=a||document;var c=!0;y(a,"click",function(e){if(c){c=!1;ab(e);if("undefined"!==typeof e.pageX&&"undefined"!==typeof e.pageY){var k=Ia(),l=bb();f.check_consent("clicks")&&
101
- (e={type:"click",x:e.pageX,y:e.pageY,width:l,height:k,view:f.getViewUrl()},e=Y(e,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processClick",b),f.track_domains&&(e.domain=window.location.hostname),p({key:I.ACTION,segmentation:e}))}setTimeout(function(){c=!0},1E3)}})};this.track_scrolls=function(a){b(d.INFO,"track_scrolls, Starting to track scrolls");a&&b(d.INFO,"track_scrolls, Tracking the specified children");a=a||window;jb=Ea=!0;y(a,"scroll",Cb);y(a,"beforeunload",gb)};this.track_links=
102
- function(a){b(d.INFO,"track_links, Starting to track clicks to links");a&&b(d.INFO,"track_links, Tracking the specified children");a=a||document;y(a,"click",function(c){a:{var e=Va(c);var k;for(k="A";e;){if(e.nodeName.toUpperCase()===k)break a;e=e.parentElement}e=void 0}e&&(ab(c),f.check_consent("clicks")&&p({key:"linkClick",segmentation:{href:e.href,text:e.innerText,id:e.id,view:f.getViewUrl()}}))})};this.track_forms=function(a,c){function e(k){return k.name||k.id||k.type||k.nodeName}b(d.INFO,"track_forms, Starting to track form submissions. DOM object provided:["+
103
- !!a+"] Tracking hidden inputs :["+!!c+"]");a=a||document;y(a,"submit",function(k){k=Va(k);var l={id:k.attributes.id&&k.attributes.id.nodeValue,name:k.attributes.name&&k.attributes.name.nodeValue,action:k.attributes.action&&k.attributes.action.nodeValue,method:k.attributes.method&&k.attributes.method.nodeValue,view:f.getViewUrl()},g;if("undefined"!==typeof k.elements){for(var n=0;n<k.elements.length;n++)(g=k.elements[n])&&"password"!==g.type&&-1===g.className.indexOf("cly_user_ignore")&&("undefined"===
104
- typeof l["input:"+e(g)]&&(l["input:"+e(g)]=[]),"select"===g.nodeName.toLowerCase()?"undefined"!==typeof g.multiple?l["input:"+e(g)].push(nb(g)):l["input:"+e(g)].push(g.options[g.selectedIndex].value):"input"===g.nodeName.toLowerCase()?"undefined"!==typeof g.type?"checkbox"===g.type.toLowerCase()||"radio"===g.type.toLowerCase()?g.checked&&l["input:"+e(g)].push(g.value):("hidden"!==g.type.toLowerCase()||c)&&l["input:"+e(g)].push(g.value):l["input:"+e(g)].push(g.value):"textarea"===g.nodeName.toLowerCase()?
105
- l["input:"+e(g)].push(g.value):"undefined"!==typeof g.value&&l["input:"+e(g)].push(g.value));for(var q in l)l[q]&&"function"===typeof l[q].join&&(l[q]=l[q].join(", "))}f.check_consent("forms")&&p({key:"formSubmit",segmentation:l})})};this.collect_from_forms=function(a,c){b(d.INFO,"collect_from_forms, Starting to collect possible user data. DOM object provided:["+!!a+"] Submitting custom user property:["+!!c+"]");a=a||document;y(a,"submit",function(e){e=Va(e);var k={},l=!1,g;if("undefined"!==typeof e.elements){var n=
106
- {},q=a.getElementsByTagName("LABEL"),v;for(v=0;v<q.length;v++)q[v].htmlFor&&""!==q[v].htmlFor&&(n[q[v].htmlFor]=q[v].innerText||q[v].textContent||q[v].innerHTML);for(v=0;v<e.elements.length;v++)if((g=e.elements[v])&&"password"!==g.type&&-1===g.className.indexOf("cly_user_ignore"))if(q="","select"===g.nodeName.toLowerCase()?q="undefined"!==typeof g.multiple?nb(g):g.options[g.selectedIndex].value:"input"===g.nodeName.toLowerCase()?"undefined"!==typeof g.type?"checkbox"===g.type.toLowerCase()||"radio"===
107
- g.type.toLowerCase()?g.checked&&(q=g.value):q=g.value:q=g.value:"textarea"===g.nodeName.toLowerCase()?q=g.value:"undefined"!==typeof g.value&&(q=g.value),g.className&&-1!==g.className.indexOf("cly_user_")){var K=g.className.split(" ");for(g=0;g<K.length;g++)if(0===K[g].indexOf("cly_user_")){k[K[g].replace("cly_user_","")]=q;l=!0;break}}else if(g.type&&"email"===g.type.toLowerCase()||g.name&&-1!==g.name.toLowerCase().indexOf("email")||g.id&&-1!==g.id.toLowerCase().indexOf("email")||g.id&&n[g.id]&&
108
- -1!==n[g.id].toLowerCase().indexOf("email")||/[^@\s]+@[^@\s]+\.[^@\s]+/.test(q))k.email||(k.email=q),l=!0;else if(g.name&&-1!==g.name.toLowerCase().indexOf("username")||g.id&&-1!==g.id.toLowerCase().indexOf("username")||g.id&&n[g.id]&&-1!==n[g.id].toLowerCase().indexOf("username"))k.username||(k.username=q),l=!0;else if(g.name&&(-1!==g.name.toLowerCase().indexOf("tel")||-1!==g.name.toLowerCase().indexOf("phone")||-1!==g.name.toLowerCase().indexOf("number"))||g.id&&(-1!==g.id.toLowerCase().indexOf("tel")||
109
- -1!==g.id.toLowerCase().indexOf("phone")||-1!==g.id.toLowerCase().indexOf("number"))||g.id&&n[g.id]&&(-1!==n[g.id].toLowerCase().indexOf("tel")||-1!==n[g.id].toLowerCase().indexOf("phone")||-1!==n[g.id].toLowerCase().indexOf("number")))k.phone||(k.phone=q),l=!0;else if(g.name&&(-1!==g.name.toLowerCase().indexOf("org")||-1!==g.name.toLowerCase().indexOf("company"))||g.id&&(-1!==g.id.toLowerCase().indexOf("org")||-1!==g.id.toLowerCase().indexOf("company"))||g.id&&n[g.id]&&(-1!==n[g.id].toLowerCase().indexOf("org")||
110
- -1!==n[g.id].toLowerCase().indexOf("company")))k.organization||(k.organization=q),l=!0;else if(g.name&&-1!==g.name.toLowerCase().indexOf("name")||g.id&&-1!==g.id.toLowerCase().indexOf("name")||g.id&&n[g.id]&&-1!==n[g.id].toLowerCase().indexOf("name"))k.name||(k.name=""),k.name+=q+" ",l=!0}l&&(b(d.INFO,"collect_from_forms, Gathered user data",k),c?f.user_details({custom:k}):f.user_details(k))})};this.collect_from_facebook=function(a){"undefined"!==typeof FB&&FB&&FB.api?(b(d.INFO,"collect_from_facebook, Starting to collect possible user data"),
111
- FB.api("/me",function(c){var e={};c.name&&(e.name=c.name);c.email&&(e.email=c.email);"male"===c.gender?e.gender="M":"female"===c.gender&&(e.gender="F");if(c.birthday){var k=c.birthday.split("/").pop();k&&4===k.length&&(e.byear=k)}c.work&&c.work[0]&&c.work[0].employer&&c.work[0].employer.name&&(e.organization=c.work[0].employer.name);if(a){e.custom={};for(var l in a){k=a[l].split(".");for(var g=c,n=0;n<k.length&&(g=g[k[n]],"undefined"!==typeof g);n++);"undefined"!==typeof g&&(e.custom[l]=g)}}f.user_details(e)})):
112
- b(d.ERROR,"collect_from_facebook, Facebook SDK is not available")};this.opt_out=function(){b(d.INFO,"opt_out, Opting out the user");this.ignore_visitor=!0;u("cly_ignore",!0)};this.opt_in=function(){b(d.INFO,"opt_in, Opting in the user");u("cly_ignore",!1);this.ignore_visitor=!1;A();this.ignore_visitor||Oa||Na()};this.report_feedback=function(a){b(d.WARNING,"report_feedback, Deprecated function call! Use 'recordRatingWidgetWithID' or 'reportFeedbackWidgetManually' in place of this call. Call will be redirected to 'recordRatingWidgetWithID' now!");
98
+ ", error: "+q)}U=a;za=E();b(d.VERBOSE,"track_pageview, last view is assigned:["+U+"], current view ID is:["+fa+"], previous view ID is:["+xa+"]");k={name:a,visit:1,view:f.getViewUrl()};k=Y(k,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"track_pageview",b);this.track_domains&&(k.domain=window.location.hostname);if(ha)if(S)sa&&(sa=!1,k.start=1);else{var l=w("cly_session");if(!l||parseInt(l)<=E())sa=!1,k.start=1}else"undefined"!==typeof document.referrer&&document.referrer.length&&(l=zb.exec(document.referrer))&&
99
+ l[11]&&l[11]!==window.location.hostname&&(k.start=1);if(ja&&Object.keys(ja).length){b(d.INFO,"track_pageview, Adding fresh utm tags to segmentation:["+JSON.stringify(ja)+"]");for(var g in ja)"undefined"===typeof k["utm_"+g]&&(k["utm_"+g]=ja[g])}hb()&&(b(d.INFO,"track_pageview, Adding referrer to segmentation:["+document.referrer+"]"),k.referrer=document.referrer);if(e){e=Y(e,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"track_pageview",b);for(var m in e)"undefined"===typeof k[m]&&(k[m]=e[m])}this.check_consent("views")?
100
+ p({key:I.VIEW,segmentation:k},fa):da.track_pageview=arguments}};this.track_view=function(a,c,e){b(d.INFO,"track_view, Initiating tracking page views");this.track_pageview(a,c,e)};this.track_clicks=function(a){b(d.INFO,"track_clicks, Starting to track clicks");a&&b(d.INFO,"track_clicks, Tracking the specified children:["+a+"]");a=a||document;var c=!0;y(a,"click",function(e){if(c){c=!1;cb(e);if("undefined"!==typeof e.pageX&&"undefined"!==typeof e.pageY){var k=Ja(),l=db();f.check_consent("clicks")&&
101
+ (e={type:"click",x:e.pageX,y:e.pageY,width:l,height:k,view:f.getViewUrl()},e=Y(e,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processClick",b),f.track_domains&&(e.domain=window.location.hostname),p({key:I.ACTION,segmentation:e}))}setTimeout(function(){c=!0},1E3)}})};this.track_scrolls=function(a){b(d.INFO,"track_scrolls, Starting to track scrolls");a&&b(d.INFO,"track_scrolls, Tracking the specified children");a=a||window;lb=Fa=!0;y(a,"scroll",Eb);y(a,"beforeunload",ib)};this.track_links=
102
+ function(a){b(d.INFO,"track_links, Starting to track clicks to links");a&&b(d.INFO,"track_links, Tracking the specified children");a=a||document;y(a,"click",function(c){a:{var e=Wa(c);var k;for(k="A";e;){if(e.nodeName.toUpperCase()===k)break a;e=e.parentElement}e=void 0}e&&(cb(c),f.check_consent("clicks")&&p({key:"linkClick",segmentation:{href:e.href,text:e.innerText,id:e.id,view:f.getViewUrl()}}))})};this.track_forms=function(a,c){function e(k){return k.name||k.id||k.type||k.nodeName}b(d.INFO,"track_forms, Starting to track form submissions. DOM object provided:["+
103
+ !!a+"] Tracking hidden inputs :["+!!c+"]");a=a||document;y(a,"submit",function(k){k=Wa(k);var l={id:k.attributes.id&&k.attributes.id.nodeValue,name:k.attributes.name&&k.attributes.name.nodeValue,action:k.attributes.action&&k.attributes.action.nodeValue,method:k.attributes.method&&k.attributes.method.nodeValue,view:f.getViewUrl()},g;if("undefined"!==typeof k.elements){for(var m=0;m<k.elements.length;m++)(g=k.elements[m])&&"password"!==g.type&&-1===g.className.indexOf("cly_user_ignore")&&("undefined"===
104
+ typeof l["input:"+e(g)]&&(l["input:"+e(g)]=[]),"select"===g.nodeName.toLowerCase()?"undefined"!==typeof g.multiple?l["input:"+e(g)].push(pb(g)):l["input:"+e(g)].push(g.options[g.selectedIndex].value):"input"===g.nodeName.toLowerCase()?"undefined"!==typeof g.type?"checkbox"===g.type.toLowerCase()||"radio"===g.type.toLowerCase()?g.checked&&l["input:"+e(g)].push(g.value):("hidden"!==g.type.toLowerCase()||c)&&l["input:"+e(g)].push(g.value):l["input:"+e(g)].push(g.value):"textarea"===g.nodeName.toLowerCase()?
105
+ l["input:"+e(g)].push(g.value):"undefined"!==typeof g.value&&l["input:"+e(g)].push(g.value));for(var q in l)l[q]&&"function"===typeof l[q].join&&(l[q]=l[q].join(", "))}f.check_consent("forms")&&p({key:"formSubmit",segmentation:l})})};this.collect_from_forms=function(a,c){b(d.INFO,"collect_from_forms, Starting to collect possible user data. DOM object provided:["+!!a+"] Submitting custom user property:["+!!c+"]");a=a||document;y(a,"submit",function(e){e=Wa(e);var k={},l=!1,g;if("undefined"!==typeof e.elements){var m=
106
+ {},q=a.getElementsByTagName("LABEL"),t;for(t=0;t<q.length;t++)q[t].htmlFor&&""!==q[t].htmlFor&&(m[q[t].htmlFor]=q[t].innerText||q[t].textContent||q[t].innerHTML);for(t=0;t<e.elements.length;t++)if((g=e.elements[t])&&"password"!==g.type&&-1===g.className.indexOf("cly_user_ignore"))if(q="","select"===g.nodeName.toLowerCase()?q="undefined"!==typeof g.multiple?pb(g):g.options[g.selectedIndex].value:"input"===g.nodeName.toLowerCase()?"undefined"!==typeof g.type?"checkbox"===g.type.toLowerCase()||"radio"===
107
+ g.type.toLowerCase()?g.checked&&(q=g.value):q=g.value:q=g.value:"textarea"===g.nodeName.toLowerCase()?q=g.value:"undefined"!==typeof g.value&&(q=g.value),g.className&&-1!==g.className.indexOf("cly_user_")){var K=g.className.split(" ");for(g=0;g<K.length;g++)if(0===K[g].indexOf("cly_user_")){k[K[g].replace("cly_user_","")]=q;l=!0;break}}else if(g.type&&"email"===g.type.toLowerCase()||g.name&&-1!==g.name.toLowerCase().indexOf("email")||g.id&&-1!==g.id.toLowerCase().indexOf("email")||g.id&&m[g.id]&&
108
+ -1!==m[g.id].toLowerCase().indexOf("email")||/[^@\s]+@[^@\s]+\.[^@\s]+/.test(q))k.email||(k.email=q),l=!0;else if(g.name&&-1!==g.name.toLowerCase().indexOf("username")||g.id&&-1!==g.id.toLowerCase().indexOf("username")||g.id&&m[g.id]&&-1!==m[g.id].toLowerCase().indexOf("username"))k.username||(k.username=q),l=!0;else if(g.name&&(-1!==g.name.toLowerCase().indexOf("tel")||-1!==g.name.toLowerCase().indexOf("phone")||-1!==g.name.toLowerCase().indexOf("number"))||g.id&&(-1!==g.id.toLowerCase().indexOf("tel")||
109
+ -1!==g.id.toLowerCase().indexOf("phone")||-1!==g.id.toLowerCase().indexOf("number"))||g.id&&m[g.id]&&(-1!==m[g.id].toLowerCase().indexOf("tel")||-1!==m[g.id].toLowerCase().indexOf("phone")||-1!==m[g.id].toLowerCase().indexOf("number")))k.phone||(k.phone=q),l=!0;else if(g.name&&(-1!==g.name.toLowerCase().indexOf("org")||-1!==g.name.toLowerCase().indexOf("company"))||g.id&&(-1!==g.id.toLowerCase().indexOf("org")||-1!==g.id.toLowerCase().indexOf("company"))||g.id&&m[g.id]&&(-1!==m[g.id].toLowerCase().indexOf("org")||
110
+ -1!==m[g.id].toLowerCase().indexOf("company")))k.organization||(k.organization=q),l=!0;else if(g.name&&-1!==g.name.toLowerCase().indexOf("name")||g.id&&-1!==g.id.toLowerCase().indexOf("name")||g.id&&m[g.id]&&-1!==m[g.id].toLowerCase().indexOf("name"))k.name||(k.name=""),k.name+=q+" ",l=!0}l&&(b(d.INFO,"collect_from_forms, Gathered user data",k),c?f.user_details({custom:k}):f.user_details(k))})};this.collect_from_facebook=function(a){"undefined"!==typeof FB&&FB&&FB.api?(b(d.INFO,"collect_from_facebook, Starting to collect possible user data"),
111
+ FB.api("/me",function(c){var e={};c.name&&(e.name=c.name);c.email&&(e.email=c.email);"male"===c.gender?e.gender="M":"female"===c.gender&&(e.gender="F");if(c.birthday){var k=c.birthday.split("/").pop();k&&4===k.length&&(e.byear=k)}c.work&&c.work[0]&&c.work[0].employer&&c.work[0].employer.name&&(e.organization=c.work[0].employer.name);if(a){e.custom={};for(var l in a){k=a[l].split(".");for(var g=c,m=0;m<k.length&&(g=g[k[m]],"undefined"!==typeof g);m++);"undefined"!==typeof g&&(e.custom[l]=g)}}f.user_details(e)})):
112
+ b(d.ERROR,"collect_from_facebook, Facebook SDK is not available")};this.opt_out=function(){b(d.INFO,"opt_out, Opting out the user");this.ignore_visitor=!0;v("cly_ignore",!0)};this.opt_in=function(){b(d.INFO,"opt_in, Opting in the user");v("cly_ignore",!1);this.ignore_visitor=!1;A();this.ignore_visitor||Pa||Oa()};this.report_feedback=function(a){b(d.WARNING,"report_feedback, Deprecated function call! Use 'recordRatingWidgetWithID' or 'reportFeedbackWidgetManually' in place of this call. Call will be redirected to 'recordRatingWidgetWithID' now!");
113
113
  this.recordRatingWidgetWithID(a)};this.recordRatingWidgetWithID=function(a){b(d.INFO,"recordRatingWidgetWithID, Providing information about user with ID: [ "+a.widget_id+" ]");if(this.check_consent("star-rating"))if(a.widget_id)if(a.rating){var c={key:I.STAR_RATING,count:1,segmentation:{}};c.segmentation=ua(a,"widget_id contactMe platform app_version rating email comment".split(" "));c.segmentation.app_version||(c.segmentation.app_version=this.metrics._app_version||this.app_version);5<c.segmentation.rating?
114
114
  (b(d.WARNING,"recordRatingWidgetWithID, You have entered a rating higher than 5. Changing it back to 5 now."),c.segmentation.rating=5):1>c.segmentation.rating&&(b(d.WARNING,"recordRatingWidgetWithID, You have entered a rating lower than 1. Changing it back to 1 now."),c.segmentation.rating=1);b(d.INFO,"recordRatingWidgetWithID, Reporting Rating Widget: ",c);p(c)}else b(d.ERROR,"recordRatingWidgetWithID, Rating Widget must contain rating property");else b(d.ERROR,"recordRatingWidgetWithID, Rating Widget must contain widget_id property")};
115
115
  this.reportFeedbackWidgetManually=function(a,c,e){if(this.check_consent("feedback"))if(a&&c)if(a._id)if(H)b(d.ERROR,"reportFeedbackWidgetManually, Feedback Widgets can not be reported in offline mode");else{b(d.INFO,"reportFeedbackWidgetManually, Providing information about user with, provided result of the widget with ID: [ "+a._id+" ] and type: ["+a.type+"]");var k=[];c=a.type;if("nps"===c){if(e){if(!e.rating){b(d.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");return}e.rating=
116
116
  Math.round(e.rating);10<e.rating?(b(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 10. Changing it back to 10 now."),e.rating=10):0>e.rating&&(b(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 0. Changing it back to 0 now."),e.rating=0);k=["rating","comment"]}var l=I.NPS}else if("survey"===c){if(e){if(1>Object.keys(e).length){b(d.ERROR,"reportFeedbackWidgetManually, Widget should have answers to be reported");return}k=Object.keys(e)}l=
117
117
  I.SURVEY}else if("rating"===c){if(e){if(!e.rating){b(d.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");return}e.rating=Math.round(e.rating);5<e.rating?(b(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 5. Changing it back to 5 now."),e.rating=5):1>e.rating&&(b(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 1. Changing it back to 1 now."),e.rating=1);k=["rating","comment","email","contactMe"]}l=I.STAR_RATING}else{b(d.ERROR,
118
- "reportFeedbackWidgetManually, Widget has an unacceptable type");return}a={key:l,count:1,segmentation:{widget_id:a._id,platform:this.platform,app_version:this.metrics._app_version||this.app_version}};if(null===e)a.segmentation.closed=1;else{l=a.segmentation;if(k){for(var g,n=0,q=k.length;n<q;n++)g=k[n],"undefined"!==typeof e[g]&&(l[g]=e[g]);e=l}else e=void 0;a.segmentation=e}b(d.INFO,"reportFeedbackWidgetManually, Reporting "+c+": ",a);p(a)}else b(d.ERROR,"reportFeedbackWidgetManually, Feedback Widgets must contain _id property");
118
+ "reportFeedbackWidgetManually, Widget has an unacceptable type");return}a={key:l,count:1,segmentation:{widget_id:a._id,platform:this.platform,app_version:this.metrics._app_version||this.app_version}};if(null===e)a.segmentation.closed=1;else{l=a.segmentation;if(k){for(var g,m=0,q=k.length;m<q;m++)g=k[m],"undefined"!==typeof e[g]&&(l[g]=e[g]);e=l}else e=void 0;a.segmentation=e}b(d.INFO,"reportFeedbackWidgetManually, Reporting "+c+": ",a);p(a)}else b(d.ERROR,"reportFeedbackWidgetManually, Feedback Widgets must contain _id property");
119
119
  else b(d.ERROR,"reportFeedbackWidgetManually, Widget data and/or Widget object not provided. Aborting.")};this.show_feedback_popup=function(a){b(d.WARNING,"show_feedback_popup, Deprecated function call! Use 'presentRatingWidgetWithID' in place of this call. Call will be redirected now!");this.presentRatingWidgetWithID(a)};this.presentRatingWidgetWithID=function(a){b(d.INFO,"presentRatingWidgetWithID, Showing rating widget popup for the widget with ID: [ "+a+" ]");this.check_consent("star-rating")&&
120
- (H?b(d.ERROR,"presentRatingWidgetWithID, Cannot show ratingWidget popup in offline mode"):aa("presentRatingWidgetWithID,",this.url+"/o/feedback/widget",{widget_id:a,av:f.app_version},function(c,e,k){if(c)b(d.ERROR,"presentRatingWidgetWithID, An error occurred: "+c);else try{var l=JSON.parse(k);M(l,!1)}catch(g){b(d.ERROR,"presentRatingWidgetWithID, JSON parse failed: "+g)}},!0))};this.initialize_feedback_popups=function(a){b(d.WARNING,"initialize_feedback_popups, Deprecated function call! Use 'initializeRatingWidgets' in place of this call. Call will be redirected now!");
120
+ (H?b(d.ERROR,"presentRatingWidgetWithID, Cannot show ratingWidget popup in offline mode"):aa("presentRatingWidgetWithID,",this.url+"/o/feedback/widget",{widget_id:a,av:f.app_version},function(c,e,k){if(c)b(d.ERROR,"presentRatingWidgetWithID, An error occurred: "+c);else try{var l=JSON.parse(k);L(l,!1)}catch(g){b(d.ERROR,"presentRatingWidgetWithID, JSON parse failed: "+g)}},!0))};this.initialize_feedback_popups=function(a){b(d.WARNING,"initialize_feedback_popups, Deprecated function call! Use 'initializeRatingWidgets' in place of this call. Call will be redirected now!");
121
121
  this.initializeRatingWidgets(a)};this.initializeRatingWidgets=function(a){b(d.INFO,"initializeRatingWidgets, Initializing rating widget with provided widget IDs:[ "+a+"]");if(this.check_consent("star-rating")){a||(a=w("cly_fb_widgets"));for(var c=document.getElementsByClassName("countly-feedback-sticker");0<c.length;)c[0].remove();aa("initializeRatingWidgets,",this.url+"/o/feedback/multiple-widgets-by-id",{widgets:JSON.stringify(a),av:f.app_version},function(e,k,l){if(e)b(d.ERROR,"initializeRatingWidgets, An error occurred: "+
122
- e);else try{var g=JSON.parse(l);for(e=0;e<g.length;e++)if("true"===g[e].is_active){var n=g[e].target_devices,q=qb();if(n[q])if("string"===typeof g[e].hide_sticker&&(g[e].hide_sticker="true"===g[e].hide_sticker),"all"!==g[e].target_page||g[e].hide_sticker){var v=g[e].target_pages;for(k=0;k<v.length;k++){var K=v[k].substr(0,v[k].length-1)===window.location.pathname.substr(0,v[k].length-1),S=v[k]===window.location.pathname;(v[k].includes("*")&&K||S)&&!g[e].hide_sticker&&M(g[e],!0)}}else M(g[e],!0)}}catch(L){b(d.ERROR,
123
- "initializeRatingWidgets, JSON parse error: "+L)}},!0)}};this.enable_feedback=function(a){b(d.WARNING,"enable_feedback, Deprecated function call! Use 'enableRatingWidgets' in place of this call. Call will be redirected now!");this.enableRatingWidgets(a)};this.enableRatingWidgets=function(a){b(d.INFO,"enableRatingWidgets, Enabling rating widget with params:",a);this.check_consent("star-rating")&&(H?b(d.ERROR,"enableRatingWidgets, Cannot enable rating widgets in offline mode"):(u("cly_fb_widgets",a.popups||
124
- a.widgets),Ja(this.url+"/star-rating/stylesheets/countly-feedback-web.css"),a=a.popups||a.widgets,0<a.length?(document.body.insertAdjacentHTML("beforeend",'<div id="cfbg"></div>'),this.initializeRatingWidgets(a)):b(d.ERROR,"enableRatingWidgets, You should provide at least one widget id as param. Read documentation for more detail. https://resources.count.ly/plugins/feedback")))};this.get_available_feedback_widgets=function(a){b(d.INFO,"get_available_feedback_widgets, Getting the feedback list, callback function is provided:["+
125
- !!a+"]");this.check_consent("feedback")?H?b(d.ERROR,"get_available_feedback_widgets, Cannot enable feedback widgets in offline mode."):aa("get_available_feedback_widgets,",this.url+La,{method:"feedback",device_id:this.device_id,app_key:this.app_key,av:f.app_version},function(c,e,k){if(c)b(d.ERROR,"get_available_feedback_widgets, Error occurred while fetching feedbacks: "+c),a&&a(null,c);else try{var l=JSON.parse(k).result||[];a&&a(l,null)}catch(g){b(d.ERROR,"get_available_feedback_widgets, Error while parsing feedback widgets list: "+
126
- g),a&&a(null,g)}},!1):a&&a(null,Error("Consent for feedback not provided."))};this.getFeedbackWidgetData=function(a,c){if(a.type)if(b(d.INFO,"getFeedbackWidgetData, Retrieving data for: ["+JSON.stringify(a)+"], callback function is provided:["+!!c+"]"),this.check_consent("feedback"))if(H)b(d.ERROR,"getFeedbackWidgetData, Cannot enable feedback widgets in offline mode.");else{var e=this.url,k={widget_id:a._id,shown:1,sdk_version:"23.6.2",sdk_name:"javascript_native_web",platform:this.platform,app_version:this.app_version};
127
- if("nps"===a.type)e+="/o/surveys/nps/widget";else if("survey"===a.type)e+="/o/surveys/survey/widget";else if("rating"===a.type)e+="/o/surveys/rating/widget";else{b(d.ERROR,"getFeedbackWidgetData, Unknown type info: ["+a.type+"]");return}aa("getFeedbackWidgetData,",e,k,function(l,g,n){if(l)b(d.ERROR,"getFeedbackWidgetData, Error occurred while fetching feedbacks: "+l),c&&c(null,l);else try{var q=JSON.parse(n);c&&c(q,null)}catch(v){b(d.ERROR,"getFeedbackWidgetData, Error while parsing feedback widgets list: "+
128
- v),c&&c(null,v)}},!0)}else c&&c(null,Error("Consent for feedback not provided."));else b(d.ERROR,"getFeedbackWidgetData, Expected the provided widget object to have a type but got: ["+JSON.stringify(a)+"], aborting.")};this.present_feedback_widget=function(a,c,e){function k(z){document.getElementById("countly-surveys-wrapper-"+z._id).style.display="block";document.getElementById("csbg").style.display="block"}function l(z){if(!z.appearance.hideS){b(d.DEBUG,"present_feedback_widget, handling the sticker as it was not set to hidden");
122
+ e);else try{var g=JSON.parse(l);for(e=0;e<g.length;e++)if("true"===g[e].is_active){var m=g[e].target_devices,q=sb();if(m[q])if("string"===typeof g[e].hide_sticker&&(g[e].hide_sticker="true"===g[e].hide_sticker),"all"!==g[e].target_page||g[e].hide_sticker){var t=g[e].target_pages;for(k=0;k<t.length;k++){var K=t[k].substr(0,t[k].length-1)===window.location.pathname.substr(0,t[k].length-1),N=t[k]===window.location.pathname;(t[k].includes("*")&&K||N)&&!g[e].hide_sticker&&L(g[e],!0)}}else L(g[e],!0)}}catch(ka){b(d.ERROR,
123
+ "initializeRatingWidgets, JSON parse error: "+ka)}},!0)}};this.enable_feedback=function(a){b(d.WARNING,"enable_feedback, Deprecated function call! Use 'enableRatingWidgets' in place of this call. Call will be redirected now!");this.enableRatingWidgets(a)};this.enableRatingWidgets=function(a){b(d.INFO,"enableRatingWidgets, Enabling rating widget with params:",a);this.check_consent("star-rating")&&(H?b(d.ERROR,"enableRatingWidgets, Cannot enable rating widgets in offline mode"):(v("cly_fb_widgets",
124
+ a.popups||a.widgets),Ka(this.url+"/star-rating/stylesheets/countly-feedback-web.css"),a=a.popups||a.widgets,0<a.length?(document.body.insertAdjacentHTML("beforeend",'<div id="cfbg"></div>'),this.initializeRatingWidgets(a)):b(d.ERROR,"enableRatingWidgets, You should provide at least one widget id as param. Read documentation for more detail. https://resources.count.ly/plugins/feedback")))};this.get_available_feedback_widgets=function(a){b(d.INFO,"get_available_feedback_widgets, Getting the feedback list, callback function is provided:["+
125
+ !!a+"]");this.check_consent("feedback")?H?b(d.ERROR,"get_available_feedback_widgets, Cannot enable feedback widgets in offline mode."):aa("get_available_feedback_widgets,",this.url+Ma,{method:"feedback",device_id:this.device_id,app_key:this.app_key,av:f.app_version},function(c,e,k){if(c)b(d.ERROR,"get_available_feedback_widgets, Error occurred while fetching feedbacks: "+c),a&&a(null,c);else try{var l=JSON.parse(k).result||[];a&&a(l,null)}catch(g){b(d.ERROR,"get_available_feedback_widgets, Error while parsing feedback widgets list: "+
126
+ g),a&&a(null,g)}},!1):a&&a(null,Error("Consent for feedback not provided."))};this.getFeedbackWidgetData=function(a,c){if(a.type)if(b(d.INFO,"getFeedbackWidgetData, Retrieving data for: ["+JSON.stringify(a)+"], callback function is provided:["+!!c+"]"),this.check_consent("feedback"))if(H)b(d.ERROR,"getFeedbackWidgetData, Cannot enable feedback widgets in offline mode.");else{var e=this.url,k={widget_id:a._id,shown:1,sdk_version:"23.6.3",sdk_name:"javascript_native_web",platform:this.platform,app_version:this.app_version};
127
+ if("nps"===a.type)e+="/o/surveys/nps/widget";else if("survey"===a.type)e+="/o/surveys/survey/widget";else if("rating"===a.type)e+="/o/surveys/rating/widget";else{b(d.ERROR,"getFeedbackWidgetData, Unknown type info: ["+a.type+"]");return}aa("getFeedbackWidgetData,",e,k,function(l,g,m){if(l)b(d.ERROR,"getFeedbackWidgetData, Error occurred while fetching feedbacks: "+l),c&&c(null,l);else try{var q=JSON.parse(m);c&&c(q,null)}catch(t){b(d.ERROR,"getFeedbackWidgetData, Error while parsing feedback widgets list: "+
128
+ t),c&&c(null,t)}},!0)}else c&&c(null,Error("Consent for feedback not provided."));else b(d.ERROR,"getFeedbackWidgetData, Expected the provided widget object to have a type but got: ["+JSON.stringify(a)+"], aborting.")};this.present_feedback_widget=function(a,c,e,k){function l(z){document.getElementById("countly-surveys-wrapper-"+z._id).style.display="block";document.getElementById("csbg").style.display="block"}function g(z){if(!z.appearance.hideS){b(d.DEBUG,"present_feedback_widget, handling the sticker as it was not set to hidden");
129
129
  var Q=document.createElement("div");Q.innerText=z.appearance.text;Q.style.color=7>z.appearance.text_color.length?"#"+z.appearance.text_color:z.appearance.text_color;Q.style.backgroundColor=7>z.appearance.bg_color.length?"#"+z.appearance.bg_color:z.appearance.bg_color;Q.className="countly-feedback-sticker "+z.appearance.position+"-"+z.appearance.size;Q.id="countly-feedback-sticker-"+z._id;document.body.appendChild(Q);y(document.getElementById("countly-feedback-sticker-"+z._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+
130
130
  z._id).style.display="flex";document.getElementById("csbg").style.display="block"})}y(document.getElementById("countly-feedback-close-icon-"+z._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+z._id).style.display="none";document.getElementById("csbg").style.display="none"})}b(d.INFO,"present_feedback_widget, Presenting the feedback widget by appending to the element with ID: [ "+c+" ] and className: [ "+e+" ]");if(this.check_consent("feedback"))if(!a||"object"!==typeof a||
131
- Array.isArray(a))b(d.ERROR,"present_feedback_widget, Please provide at least one feedback widget object.");else try{var g=this.url;if("nps"===a.type)b(d.DEBUG,"present_feedback_widget, Widget type: nps."),g+="/feedback/nps";else if("survey"===a.type)b(d.DEBUG,"present_feedback_widget, Widget type: survey."),g+="/feedback/survey";else if("rating"===a.type)b(d.DEBUG,"present_feedback_widget, Widget type: rating."),g+="/feedback/rating";else{b(d.ERROR,"present_feedback_widget, Feedback widget only accepts nps, rating and survey types.");
132
- return}var n=window.origin||window.location.origin;if("rating"===a.type){b(d.DEBUG,"present_feedback_widget, Loading css for rating widget.");var q="ratings";Ja(this.url+"/star-rating/stylesheets/countly-feedback-web.css")}else b(d.DEBUG,"present_feedback_widget, Loading css for survey or nps."),Ja(this.url+"/surveys/stylesheets/countly-surveys.css"),q="surveys";g+="?widget_id="+a._id;g+="&app_key="+this.app_key;g+="&device_id="+this.device_id;g+="&sdk_name=javascript_native_web";g+="&platform="+
133
- this.platform;g+="&app_version="+this.app_version;g+="&sdk_version=23.6.2";g+="&origin="+n;g+="&widget_v=web";var v=document.createElement("iframe");v.src=g;v.name="countly-"+q+"-iframe";v.id="countly-"+q+"-iframe";var K=!1;v.onload=function(){K&&(document.getElementById("countly-"+q+"-wrapper-"+a._id).style.display="none",document.getElementById("csbg").style.display="none");K=!0;b(d.DEBUG,"present_feedback_widget, Loaded iframe.")};for(var S=document.getElementById("csbg");S;)S.remove(),S=document.getElementById("csbg"),
134
- b(d.DEBUG,"present_feedback_widget, Removing past overlay.");var L=document.getElementsByClassName("countly-"+q+"-wrapper");for(g=0;g<L.length;g++)L[g].remove(),b(d.DEBUG,"present_feedback_widget, Removed a wrapper.");L=document.createElement("div");L.className="countly-"+q+"-wrapper";L.id="countly-"+q+"-wrapper-"+a._id;"survey"===a.type&&(L.className=L.className+" "+a.appearance.position);var pa=document.body;g=!1;c&&(document.getElementById(c)?(pa=document.getElementById(c),g=!0):b(d.ERROR,"present_feedback_widget, Provided ID not found."));
135
- g||e&&(document.getElementsByClassName(e)[0]?pa=document.getElementsByClassName(e)[0]:b(d.ERROR,"present_feedback_widget, Provided class not found."));pa.insertAdjacentHTML("beforeend",'<div id="csbg"></div>');pa.appendChild(L);if("rating"===a.type){var lb=document.createElement("div");lb.className="countly-ratings-overlay";lb.id="countly-ratings-overlay-"+a._id;L.appendChild(lb);b(d.DEBUG,"present_feedback_widget, appended the rating overlay to wrapper");y(document.getElementById("countly-ratings-overlay-"+
136
- a._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+a._id).style.display="none"})}L.appendChild(v);b(d.DEBUG,"present_feedback_widget, Appended the iframe");y(window,"message",function(z){var Q={};try{Q=JSON.parse(z.data),b(d.DEBUG,"present_feedback_widget, Parsed response message "+Q)}catch(Jb){b(d.ERROR,"present_feedback_widget, Error while parsing message body "+Jb)}Q.close?(document.getElementById("countly-"+q+"-wrapper-"+a._id).style.display="none",document.getElementById("csbg").style.display=
137
- "none"):b(d.DEBUG,"present_feedback_widget, Closing signal not sent yet")});if("survey"===a.type){var N=!1;switch(a.showPolicy){case "afterPageLoad":"complete"===document.readyState?N||(N=!0,k(a)):y(document,"readystatechange",function(z){"complete"!==z.target.readyState||N||(N=!0,k(a))});break;case "afterConstantDelay":setTimeout(function(){N||(N=!0,k(a))},1E4);break;case "onAbandon":"complete"===document.readyState?y(document,"mouseleave",function(){N||(N=!0,k(a))}):y(document,"readystatechange",
138
- function(z){"complete"===z.target.readyState&&y(document,"mouseleave",function(){N||(N=!0,k(a))})});break;case "onScrollHalfwayDown":y(window,"scroll",function(){if(!N){var z=Math.max(window.scrollY,document.body.scrollTop,document.documentElement.scrollTop),Q=Ia();z>=Q/2&&(N=!0,k(a))}});break;default:N||(N=!0,k(a))}}else if("nps"===a.type)document.getElementById("countly-"+q+"-wrapper-"+a._id).style.display="block",document.getElementById("csbg").style.display="block";else if("rating"===a.type){var Wa=
139
- !1;"complete"===document.readyState?Wa||(Wa=!0,l(a)):y(document,"readystatechange",function(z){"complete"!==z.target.readyState||Wa||(Wa=!0,l(a))})}}catch(z){b(d.ERROR,"present_feedback_widget, Something went wrong while presenting the widget: "+z)}};this.recordError=function(a,c,e){b(d.INFO,"recordError, Recording error");if(this.check_consent("crashes")&&a){e=e||hb;var k="";"object"===typeof a?"undefined"!==typeof a.stack?k=a.stack:("undefined"!==typeof a.name&&(k+=a.name+":"),"undefined"!==typeof a.message&&
140
- (k+=a.message+"\n"),"undefined"!==typeof a.fileName&&(k+="in "+a.fileName+"\n"),"undefined"!==typeof a.lineNumber&&(k+="on "+a.lineNumber),"undefined"!==typeof a.columnNumber&&(k+=":"+a.columnNumber)):k=a+"";if(k.length>f.maxStackTraceLineLength*f.maxStackTraceLinesPerThread){b(d.DEBUG,"record_error, Error stack is too long will be truncated");a=k.split("\n");a.length>f.maxStackTraceLinesPerThread&&(a=a.splice(0,f.maxStackTraceLinesPerThread));k=0;for(var l=a.length;k<l;k++)a[k].length>f.maxStackTraceLineLength&&
141
- (a[k]=a[k].substring(0,f.maxStackTraceLineLength));k=a.join("\n")}c=!!c;a=Ka();k={_resolution:a._resolution,_error:k,_app_version:a._app_version,_run:E()-Fb,_not_os_specific:!0,_javascript:!0};if(l=navigator.battery||navigator.webkitBattery||navigator.mozBattery||navigator.msBattery)k._bat=Math.floor(100*l.level);"undefined"!==typeof navigator.onLine&&(k._online=!!navigator.onLine);k._background=!document.hasFocus();0<ma.length&&(k._logs=ma.join("\n"));ma=[];k._nonfatal=c;k._view=this.getViewName();
142
- "undefined"!==typeof e&&(e=Y(e,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"record_error",b),k._custom=e);try{var g=document.createElement("canvas").getContext("experimental-webgl");k._opengl=g.getParameter(g.VERSION)}catch(n){b(d.ERROR,"Could not get the experimental-webgl context: "+n)}c={};c.crash=JSON.stringify(k);c.metrics=JSON.stringify({_ua:a._ua});G(c)}};this.onStorageChange=function(a,c){b(d.DEBUG,"onStorageChange, Applying storage changes for key:",a);b(d.DEBUG,"onStorageChange, Applying storage changes for value:",
143
- c);switch(a){case "cly_queue":F=f.deserialize(c||"[]");break;case "cly_event":J=f.deserialize(c||"[]");break;case "cly_remote_configs":O=f.deserialize(c||"{}");break;case "cly_ignore":f.ignore_visitor=f.deserialize(c);break;case "cly_id":f.device_id=c;break;case "cly_id_type":C=f.deserialize(c)}};this._internals={store:u,getDocWidth:bb,getDocHeight:Ia,getViewportHeight:sb,get_page_coord:ab,get_event_target:Va,add_event_listener:y,createNewObjectFromProperties:ua,truncateObject:Y,truncateSingleValue:x,
144
- stripTrailingSlash:na,prepareParams:pb,sendXmlHttpRequest:aa,isResponseValid:Bb,getInternalDeviceIdType:function(){return C},getMsTimestamp:Za,getTimestamp:E,isResponseValidBroad:Ab,secureRandom:Xa,log:b,checkIfLoggingIsOn:wa,getMetrics:Ka,getUA:zb,prepareRequest:Z,generateUUID:Ya,sendEventsForced:B,isUUID:function(a){return/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-4[0-9a-fA-F]{3}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(a)},isReferrerUsable:fb,getId:eb,heartBeat:Na,toRequestQueue:G,reportViewDuration:R,loadJS:ub,
145
- loadCSS:Ja,getLastView:function(){return V},setToken:Db,getToken:function(){var a=w("cly_token");W("cly_token");return a},showLoader:vb,hideLoader:wb,setValueInStorage:u,getValueFromStorage:w,removeValueFromStorage:W,add_cly_events:p,processScrollView:gb,processScroll:Cb,currentUserAgentString:oa,userAgentDeviceDetection:qb,userAgentSearchBotDetection:rb,getRequestQueue:function(){return F},getEventQueue:function(){return J},clearQueue:function(){F=[];u("cly_queue",[]);J=[];u("cly_event",[])}};var qa=
146
- {sendInstantHCRequest:function(){var a=x(f.hcErrorMessage,1E3,"healthCheck",b);a={el:f.hcErrorCount,wl:f.hcWarningCount,sc:f.hcStatusCode,em:JSON.stringify(a)};a={hc:JSON.stringify(a),metrics:JSON.stringify({_app_version:f.app_version})};Z(a);aa("[healthCheck]",f.url+db,a,function(c,e,k,l){c?b(d.ERROR,"[healthCheck] An error occurred. Status: ["+k+"], response: ["+l+"]"):(b(d.INFO,"[healthCheck] Request was successful. Status: ["+k+"], response: ["+l+"]"),qa.resetAndSaveCounters())},!0)},resetAndSaveCounters:function(){qa.resetCounters();
147
- u(P.errorCount,f.hcErrorCount);u(P.warningCount,f.hcWarningCount);u(P.statusCode,f.hcStatusCode);u(P.errorMessage,f.hcErrorMessage)},incrementErrorCount:function(){f.hcErrorCount++},incrementWarningCount:function(){f.hcWarningCount++},resetCounters:function(){f.hcErrorCount=0;f.hcWarningCount=0;f.hcStatusCode=-1;f.hcErrorMessage=""},saveRequestCounters:function(a,c){f.hcStatusCode=a;f.hcErrorMessage=c;u(P.statusCode,f.hcStatusCode);u(P.errorMessage,f.hcErrorMessage)}};this.initialize()};m.init=function(h){h=
148
- h||{};if(m.loadAPMScriptsAsync&&yb)yb=!1,ta(h);else{var p=h.app_key||m.app_key;if(!m.i||!m.i[p]){h=new m.CountlyClass(h);if(!m.i){m.i={};for(var t in h)m[t]=h[t]}m.i[p]=h}return m.i[p]}};var Ha=0,y=function(h,p,t){null===h||"undefined"===typeof h?wa()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+p+"] event to nonexisting element"):"undefined"!==typeof h.addEventListener?h.addEventListener(p,t,!1):h.attachEvent("on"+p,t)},Va=function(h){return h?"undefined"!==typeof h.target?
149
- h.target:h.srcElement:window.event.srcElement};window.addEventListener("storage",function(h){var p=(h.key+"").split("/"),t=p.pop();p=p.pop();if(m.i&&m.i[p])m.i[p].onStorageChange(t,h.newValue)});m.serialize=function(h){"object"===typeof h&&(h=JSON.stringify(h));return h};m.deserialize=function(h){if(""===h)return h;try{h=JSON.parse(h)}catch(p){wa()&&console.warn("[WARNING] [Countly] deserialize, Could not parse the file:["+h+"], error: "+p)}return h};m.getViewName=function(){return window.location.pathname};
150
- m.getViewUrl=function(){return window.location.pathname};m.getSearchQuery=function(){return window.location.search};m.DeviceIdType={DEVELOPER_SUPPLIED:0,SDK_GENERATED:1,TEMPORARY_ID:2};return m}});
131
+ Array.isArray(a))b(d.ERROR,"present_feedback_widget, Please provide at least one feedback widget object.");else{b(d.INFO,"present_feedback_widget, Adding segmentation to feedback widgets:["+JSON.stringify(k)+"]");k&&"object"===typeof k&&0!==Object.keys(k).length||(b(d.DEBUG,"present_feedback_widget, Segmentation is not an object or empty"),k=null);try{var m=this.url;if("nps"===a.type)b(d.DEBUG,"present_feedback_widget, Widget type: nps."),m+="/feedback/nps";else if("survey"===a.type)b(d.DEBUG,"present_feedback_widget, Widget type: survey."),
132
+ m+="/feedback/survey";else if("rating"===a.type)b(d.DEBUG,"present_feedback_widget, Widget type: rating."),m+="/feedback/rating";else{b(d.ERROR,"present_feedback_widget, Feedback widget only accepts nps, rating and survey types.");return}var q=window.origin||window.location.origin;if("rating"===a.type){b(d.DEBUG,"present_feedback_widget, Loading css for rating widget.");var t="ratings";Ka(this.url+"/star-rating/stylesheets/countly-feedback-web.css")}else b(d.DEBUG,"present_feedback_widget, Loading css for survey or nps."),
133
+ Ka(this.url+"/surveys/stylesheets/countly-surveys.css"),t="surveys";m+="?widget_id="+a._id;m+="&app_key="+this.app_key;m+="&device_id="+this.device_id;m+="&sdk_name=javascript_native_web";m+="&platform="+this.platform;m+="&app_version="+this.app_version;m+="&sdk_version=23.6.3";if(k){var K={};K.sg=k;m+="&custom="+JSON.stringify(K)}m+="&origin="+q;m+="&widget_v=web";var N=document.createElement("iframe");N.src=m;N.name="countly-"+t+"-iframe";N.id="countly-"+t+"-iframe";var ka=!1;N.onload=function(){ka&&
134
+ (document.getElementById("countly-"+t+"-wrapper-"+a._id).style.display="none",document.getElementById("csbg").style.display="none");ka=!0;b(d.DEBUG,"present_feedback_widget, Loaded iframe.")};for(var ya=document.getElementById("csbg");ya;)ya.remove(),ya=document.getElementById("csbg"),b(d.DEBUG,"present_feedback_widget, Removing past overlay.");var X=document.getElementsByClassName("countly-"+t+"-wrapper");for(k=0;k<X.length;k++)X[k].remove(),b(d.DEBUG,"present_feedback_widget, Removed a wrapper.");
135
+ X=document.createElement("div");X.className="countly-"+t+"-wrapper";X.id="countly-"+t+"-wrapper-"+a._id;"survey"===a.type&&(X.className=X.className+" "+a.appearance.position);var Xa=document.body;k=!1;c&&(document.getElementById(c)?(Xa=document.getElementById(c),k=!0):b(d.ERROR,"present_feedback_widget, Provided ID not found."));k||e&&(document.getElementsByClassName(e)[0]?Xa=document.getElementsByClassName(e)[0]:b(d.ERROR,"present_feedback_widget, Provided class not found."));Xa.insertAdjacentHTML("beforeend",
136
+ '<div id="csbg"></div>');Xa.appendChild(X);if("rating"===a.type){var nb=document.createElement("div");nb.className="countly-ratings-overlay";nb.id="countly-ratings-overlay-"+a._id;X.appendChild(nb);b(d.DEBUG,"present_feedback_widget, appended the rating overlay to wrapper");y(document.getElementById("countly-ratings-overlay-"+a._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+a._id).style.display="none"})}X.appendChild(N);b(d.DEBUG,"present_feedback_widget, Appended the iframe");
137
+ y(window,"message",function(z){var Q={};try{Q=JSON.parse(z.data),b(d.DEBUG,"present_feedback_widget, Parsed response message "+Q)}catch(Lb){b(d.ERROR,"present_feedback_widget, Error while parsing message body "+Lb)}Q.close?(document.getElementById("countly-"+t+"-wrapper-"+a._id).style.display="none",document.getElementById("csbg").style.display="none"):b(d.DEBUG,"present_feedback_widget, Closing signal not sent yet")});if("survey"===a.type){var M=!1;switch(a.showPolicy){case "afterPageLoad":"complete"===
138
+ document.readyState?M||(M=!0,l(a)):y(document,"readystatechange",function(z){"complete"!==z.target.readyState||M||(M=!0,l(a))});break;case "afterConstantDelay":setTimeout(function(){M||(M=!0,l(a))},1E4);break;case "onAbandon":"complete"===document.readyState?y(document,"mouseleave",function(){M||(M=!0,l(a))}):y(document,"readystatechange",function(z){"complete"===z.target.readyState&&y(document,"mouseleave",function(){M||(M=!0,l(a))})});break;case "onScrollHalfwayDown":y(window,"scroll",function(){if(!M){var z=
139
+ Math.max(window.scrollY,document.body.scrollTop,document.documentElement.scrollTop),Q=Ja();z>=Q/2&&(M=!0,l(a))}});break;default:M||(M=!0,l(a))}}else if("nps"===a.type)document.getElementById("countly-"+t+"-wrapper-"+a._id).style.display="block",document.getElementById("csbg").style.display="block";else if("rating"===a.type){var Ya=!1;"complete"===document.readyState?Ya||(Ya=!0,g(a)):y(document,"readystatechange",function(z){"complete"!==z.target.readyState||Ya||(Ya=!0,g(a))})}}catch(z){b(d.ERROR,
140
+ "present_feedback_widget, Something went wrong while presenting the widget: "+z)}}};this.recordError=function(a,c,e){b(d.INFO,"recordError, Recording error");if(this.check_consent("crashes")&&a){e=e||jb;var k="";"object"===typeof a?"undefined"!==typeof a.stack?k=a.stack:("undefined"!==typeof a.name&&(k+=a.name+":"),"undefined"!==typeof a.message&&(k+=a.message+"\n"),"undefined"!==typeof a.fileName&&(k+="in "+a.fileName+"\n"),"undefined"!==typeof a.lineNumber&&(k+="on "+a.lineNumber),"undefined"!==
141
+ typeof a.columnNumber&&(k+=":"+a.columnNumber)):k=a+"";if(k.length>f.maxStackTraceLineLength*f.maxStackTraceLinesPerThread){b(d.DEBUG,"record_error, Error stack is too long will be truncated");a=k.split("\n");a.length>f.maxStackTraceLinesPerThread&&(a=a.splice(0,f.maxStackTraceLinesPerThread));k=0;for(var l=a.length;k<l;k++)a[k].length>f.maxStackTraceLineLength&&(a[k]=a[k].substring(0,f.maxStackTraceLineLength));k=a.join("\n")}c=!!c;a=La();k={_resolution:a._resolution,_error:k,_app_version:a._app_version,
142
+ _run:E()-Hb,_not_os_specific:!0,_javascript:!0};if(l=navigator.battery||navigator.webkitBattery||navigator.mozBattery||navigator.msBattery)k._bat=Math.floor(100*l.level);"undefined"!==typeof navigator.onLine&&(k._online=!!navigator.onLine);k._background=!document.hasFocus();0<na.length&&(k._logs=na.join("\n"));na=[];k._nonfatal=c;k._view=this.getViewName();"undefined"!==typeof e&&(e=Y(e,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"record_error",b),k._custom=e);try{var g=document.createElement("canvas").getContext("experimental-webgl");
143
+ k._opengl=g.getParameter(g.VERSION)}catch(m){b(d.ERROR,"Could not get the experimental-webgl context: "+m)}c={};c.crash=JSON.stringify(k);c.metrics=JSON.stringify({_ua:a._ua});G(c)}};this.onStorageChange=function(a,c){b(d.DEBUG,"onStorageChange, Applying storage changes for key:",a);b(d.DEBUG,"onStorageChange, Applying storage changes for value:",c);switch(a){case "cly_queue":F=f.deserialize(c||"[]");break;case "cly_event":J=f.deserialize(c||"[]");break;case "cly_remote_configs":O=f.deserialize(c||
144
+ "{}");break;case "cly_ignore":f.ignore_visitor=f.deserialize(c);break;case "cly_id":f.device_id=c;break;case "cly_id_type":C=f.deserialize(c)}};this._internals={store:v,getDocWidth:db,getDocHeight:Ja,getViewportHeight:ub,get_page_coord:cb,get_event_target:Wa,add_event_listener:y,createNewObjectFromProperties:ua,truncateObject:Y,truncateSingleValue:x,stripTrailingSlash:oa,prepareParams:rb,sendXmlHttpRequest:aa,isResponseValid:Db,getInternalDeviceIdType:function(){return C},getMsTimestamp:ab,getTimestamp:E,
145
+ isResponseValidBroad:Cb,secureRandom:Za,log:b,checkIfLoggingIsOn:wa,getMetrics:La,getUA:Bb,prepareRequest:Z,generateUUID:$a,sendEventsForced:B,isUUID:function(a){return/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-4[0-9a-fA-F]{3}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(a)},isReferrerUsable:hb,getId:gb,heartBeat:Oa,toRequestQueue:G,reportViewDuration:R,loadJS:wb,loadCSS:Ka,getLastView:function(){return U},setToken:Fb,getToken:function(){var a=w("cly_token");V("cly_token");return a},showLoader:xb,hideLoader:yb,setValueInStorage:v,
146
+ getValueFromStorage:w,removeValueFromStorage:V,add_cly_events:p,processScrollView:ib,processScroll:Eb,currentUserAgentString:pa,userAgentDeviceDetection:sb,userAgentSearchBotDetection:tb,getRequestQueue:function(){return F},getEventQueue:function(){return J},clearQueue:function(){F=[];v("cly_queue",[]);J=[];v("cly_event",[])}};var qa={sendInstantHCRequest:function(){var a=x(f.hcErrorMessage,1E3,"healthCheck",b);a={el:f.hcErrorCount,wl:f.hcWarningCount,sc:f.hcStatusCode,em:JSON.stringify(a)};a={hc:JSON.stringify(a),
147
+ metrics:JSON.stringify({_app_version:f.app_version})};Z(a);aa("[healthCheck]",f.url+fb,a,function(c,e,k,l){c?b(d.ERROR,"[healthCheck] An error occurred. Status: ["+k+"], response: ["+l+"]"):(b(d.INFO,"[healthCheck] Request was successful. Status: ["+k+"], response: ["+l+"]"),qa.resetAndSaveCounters())},!0)},resetAndSaveCounters:function(){qa.resetCounters();v(P.errorCount,f.hcErrorCount);v(P.warningCount,f.hcWarningCount);v(P.statusCode,f.hcStatusCode);v(P.errorMessage,f.hcErrorMessage)},incrementErrorCount:function(){f.hcErrorCount++},
148
+ incrementWarningCount:function(){f.hcWarningCount++},resetCounters:function(){f.hcErrorCount=0;f.hcWarningCount=0;f.hcStatusCode=-1;f.hcErrorMessage=""},saveRequestCounters:function(a,c){f.hcStatusCode=a;f.hcErrorMessage=c;v(P.statusCode,f.hcStatusCode);v(P.errorMessage,f.hcErrorMessage)}};this.initialize()};n.init=function(h){h=h||{};if(n.loadAPMScriptsAsync&&Ab)Ab=!1,ta(h);else{var p=h.app_key||n.app_key;if(!n.i||!n.i[p]){h=new n.CountlyClass(h);if(!n.i){n.i={};for(var u in h)n[u]=h[u]}n.i[p]=h}return n.i[p]}};
149
+ var Ia=0,y=function(h,p,u){null===h||"undefined"===typeof h?wa()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+p+"] event to nonexisting element"):"undefined"!==typeof h.addEventListener?h.addEventListener(p,u,!1):h.attachEvent("on"+p,u)},Wa=function(h){return h?"undefined"!==typeof h.target?h.target:h.srcElement:window.event.srcElement};window.addEventListener("storage",function(h){var p=(h.key+"").split("/"),u=p.pop();p=p.pop();if(n.i&&n.i[p])n.i[p].onStorageChange(u,h.newValue)});
150
+ n.serialize=function(h){"object"===typeof h&&(h=JSON.stringify(h));return h};n.deserialize=function(h){if(""===h)return h;try{h=JSON.parse(h)}catch(p){wa()&&console.warn("[WARNING] [Countly] deserialize, Could not parse the file:["+h+"], error: "+p)}return h};n.getViewName=function(){return window.location.pathname};n.getViewUrl=function(){return window.location.pathname};n.getSearchQuery=function(){return window.location.search};n.DeviceIdType={DEVELOPER_SUPPLIED:0,SDK_GENERATED:1,TEMPORARY_ID:2};
151
+ return n}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "countly-sdk-web",
3
- "version": "23.6.2",
3
+ "version": "23.6.3",
4
4
  "description": "Countly Web SDK",
5
5
  "main": "lib/countly.js",
6
6
  "directories": {
Binary file