UNPKG

@thrivestack/analytics-browser

Version:

ThriveStack Analytics Platform - Comprehensive web analytics tracking with privacy-first approach

1 lines 52.4 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ThriveStack={})}(this,function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((i=i.apply(e,t||[])).next())})}function i(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&s[0]?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],i=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function o(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r="3.4.2";function a(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function s(e){return!!e&&"function"==typeof e.then}function c(e,t){try{var n=e();s(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function l(e,t,o){return void 0===o&&(o=16),n(this,void 0,void 0,function(){var n,r,s,c;return i(this,function(i){switch(i.label){case 0:n=Array(e.length),r=Date.now(),s=0,i.label=1;case 1:return s<e.length?(n[s]=t(e[s],s),(c=Date.now())>=r+o?(r=c,[4,a(0)]):[3,3]):[3,4];case 2:i.sent(),i.label=3;case 3:return++s,[3,1];case 4:return[2,n]}})})}function u(e){e.then(void 0,function(){})}function d(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function h(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function m(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])}function f(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]}function p(e,t){return[e[0]^t[0],e[1]^t[1]]}function v(e){return e=p(e,[0,e[0]>>>1]),e=p(e=h(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=p(e=h(e,[3301882366,444984403]),[0,e[0]>>>1])}function g(e){return parseInt(e)}function y(e){return parseFloat(e)}function b(e,t){return"number"==typeof e&&isNaN(e)?t:e}function w(e){return e.reduce(function(e,t){return e+(t?1:0)},0)}function k(e,t){if(void 0===t&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function I(e){return e&&"object"==typeof e&&"message"in e?e:{message:e}}function S(e,t,o){var r=Object.keys(e).filter(function(e){return!function(e,t){for(var n=0,i=e.length;n<i;++n)if(e[n]===t)return!0;return!1}(o,e)}),a=l(r,function(n){return function(e,t){var n=new Promise(function(n){var i=Date.now();c(e.bind(null,t),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=Date.now()-i;if(!e[0])return n(function(){return{error:I(e[1]),duration:o}});var r=e[1];if(function(e){return"function"!=typeof e}(r))return n(function(){return{value:r,duration:o}});n(function(){return new Promise(function(e){var t=Date.now();c(r,function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var r=o+Date.now()-t;if(!n[0])return e({error:I(n[1]),duration:r});e({value:n[1],duration:r})})})})})});return u(n),function(){return n.then(function(e){return e()})}}(e[n],t)});return u(a),function(){return n(this,void 0,void 0,function(){var e,t,n,o;return i(this,function(i){switch(i.label){case 0:return[4,a];case 1:return[4,l(i.sent(),function(e){var t=e();return u(t),t})];case 2:return e=i.sent(),[4,Promise.all(e)];case 3:for(t=i.sent(),n={},o=0;o<r.length;++o)n[r[o]]=t[o];return[2,n]}})})}}function C(){var e=window,t=navigator;return w(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function L(){var e=window,t=navigator;return w(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,0===t.vendor.indexOf("Google"),"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function _(){var e=window,t=navigator;return w(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,0===t.vendor.indexOf("Apple"),"getStorageUpdates"in t,"WebKitMediaKeys"in e])>=4}function T(){var e=window;return w(["safari"in e,!("DeviceMotionEvent"in e),!("ongestureend"in e),!("standalone"in navigator)])>=3}function V(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function F(){var e=L(),t=function(){var e,t,n=window;return w(["buildID"in navigator,"MozAppearance"in(null!==(t=null===(e=document.documentElement)||void 0===e?void 0:e.style)&&void 0!==t?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}();if(!e&&!t)return!1;var n=window;return w(["onorientationchange"in n,"orientation"in n,e&&!("SharedWorker"in n),t&&/android/i.test(navigator.appVersion)])>=2}function x(e){var t=new Error(e);return t.name=e,t}function A(e,t,o){var r,s,c;return void 0===o&&(o=50),n(this,void 0,void 0,function(){var n,l;return i(this,function(i){switch(i.label){case 0:n=document,i.label=1;case 1:return n.body?[3,3]:[4,a(o)];case 2:return i.sent(),[3,1];case 3:l=n.createElement("iframe"),i.label=4;case 4:return i.trys.push([4,,10,11]),[4,new Promise(function(e,i){var o=!1,r=function(){o=!0,e()};l.onload=r,l.onerror=function(e){o=!0,i(e)};var a=l.style;a.setProperty("display","block","important"),a.position="absolute",a.top="0",a.left="0",a.visibility="hidden",t&&"srcdoc"in l?l.srcdoc=t:l.src="about:blank",n.body.appendChild(l);var s=function(){var e,t;o||("complete"===(null===(t=null===(e=l.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.readyState)?r():setTimeout(s,10))};s()})];case 5:i.sent(),i.label=6;case 6:return(null===(s=null===(r=l.contentWindow)||void 0===r?void 0:r.document)||void 0===s?void 0:s.body)?[3,8]:[4,a(o)];case 7:return i.sent(),[3,6];case 8:return[4,e(l,l.contentWindow)];case 9:return[2,i.sent()];case 10:return null===(c=l.parentNode)||void 0===c||c.removeChild(l),[7];case 11:return[2]}})})}function D(e){for(var t=function(e){for(var t,n,i="Unexpected syntax '".concat(e,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(e),r=o[1]||void 0,a={},s=/([.:#][\w-]+|\[.+?\])/gi,c=function(e,t){a[e]=a[e]||[],a[e].push(t)};;){var l=s.exec(o[2]);if(!l)break;var u=l[0];switch(u[0]){case".":c("class",u.slice(1));break;case"#":c("id",u.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(!d)throw new Error(i);c(d[1],null!==(n=null!==(t=d[4])&&void 0!==t?t:d[5])&&void 0!==n?n:"");break;default:throw new Error(i)}}return[r,a]}(e),n=t[0],i=t[1],o=document.createElement(null!=n?n:"div"),r=0,a=Object.keys(i);r<a.length;r++){var s=a[r],c=i[s].join(" ");"style"===s?W(o.style,c):o.setAttribute(s,c)}return o}function W(e,t){for(var n=0,i=t.split(";");n<i.length;n++){var o=i[n],r=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(o);if(r){var a=r[1],s=r[2],c=r[4];e.setProperty(a,s,c||"")}}}var Z=["monospace","sans-serif","serif"],R=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function E(e){return e.toDataURL()}var M,G;function N(){var e=this;return function(){if(void 0===G){var e=function(){var t=j();P(t)?G=setTimeout(e,2500):(M=t,G=void 0)};e()}}(),function(){return n(e,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return P(e=j())?M?[2,o([],M,!0)]:(n=document).fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement?[4,V()]:[3,2]:[3,2];case 1:t.sent(),e=j(),t.label=2;case 2:return P(e)||(M=e),[2,e]}var n})})}}function j(){var e=screen;return[b(y(e.availTop),null),b(y(e.width)-y(e.availWidth)-b(y(e.availLeft),0),null),b(y(e.height)-y(e.availHeight)-b(y(e.availTop),0),null),b(y(e.availLeft),null)]}function P(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Y(e){var t;return n(this,void 0,void 0,function(){var n,o,r,s,c,l,u;return i(this,function(i){switch(i.label){case 0:for(n=document,o=n.createElement("div"),r=new Array(e.length),s={},J(o),u=0;u<e.length;++u)"DIALOG"===(c=D(e[u])).tagName&&c.show(),J(l=n.createElement("div")),l.appendChild(c),o.appendChild(l),r[u]=c;i.label=1;case 1:return n.body?[3,3]:[4,a(50)];case 2:return i.sent(),[3,1];case 3:n.body.appendChild(o);try{for(u=0;u<e.length;++u)r[u].offsetParent||(s[e[u]]=!0)}finally{null===(t=o.parentNode)||void 0===t||t.removeChild(o)}return[2,s]}})})}function J(e){e.style.setProperty("display","block","important")}function X(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function H(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}function z(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function O(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function U(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var B=Math,Q=function(){return 0};var $={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var K={fonts:function(){return A(function(e,t){var n=t.document,i=n.body;i.style.fontSize="48px";var o=n.createElement("div"),r={},a={},s=function(e){var t=n.createElement("span"),i=t.style;return i.position="absolute",i.top="0",i.left="0",i.fontFamily=e,t.textContent="mmMwWLliI0O&1",o.appendChild(t),t},c=Z.map(s),l=function(){for(var e={},t=function(t){e[t]=Z.map(function(e){return function(e,t){return s("'".concat(e,"',").concat(t))}(t,e)})},n=0,i=R;n<i.length;n++){t(i[n])}return e}();i.appendChild(o);for(var u=0;u<Z.length;u++)r[Z[u]]=c[u].offsetWidth,a[Z[u]]=c[u].offsetHeight;return R.filter(function(e){return t=l[e],Z.some(function(e,n){return t[n].offsetWidth!==r[e]||t[n].offsetHeight!==a[e]});var t})})},domBlockers:function(e){var t=(void 0===e?{}:e).debug;return n(this,void 0,void 0,function(){var e,n,o,r,a;return i(this,function(i){switch(i.label){case 0:return _()||F()?(s=atob,e={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',s("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",s("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",s("LnNwb25zb3JpdA=="),".ylamainos",s("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",s("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",s("LmhlYWRlci1ibG9ja2VkLWFk"),s("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",s("I2FkXzMwMFgyNTA="),s("I2Jhbm5lcmZsb2F0MjI="),s("I2NhbXBhaWduLWJhbm5lcg=="),s("I0FkLUNvbnRlbnQ=")],adGuardChinese:[s("LlppX2FkX2FfSA=="),s("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",s("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),s("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",s("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",s("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",s("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),s("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),s("LmFkZ29vZ2xl"),s("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[s("YW1wLWF1dG8tYWRz"),s("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",s("I2FkX2ludmlld19hcmVh")],adGuardRussian:[s("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),s("LnJlY2xhbWE="),'div[id^="smi2adblock"]',s("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[s("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),s("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",s("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),s("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),s("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",s("I3Jla2xhbWk="),s("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),s("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),s("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[s("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",s("LndpZGdldF9wb19hZHNfd2lkZ2V0"),s("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",s("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[s("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),s("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",s("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",s("I3Jla2xhbW5pLWJveA=="),s("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",s("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[s("I2FkdmVydGVudGll"),s("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",s("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",s("LnNwb25zb3JsaW5rZ3J1ZW4="),s("I3dlcmJ1bmdza3k="),s("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),s("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[s("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",s("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[s("LnJla2xhbW9zX3RhcnBhcw=="),s("LnJla2xhbW9zX251b3JvZG9z"),s("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),s("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),s("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[s("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[s("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),s("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",s("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[s("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),s("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),s("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",s("LmFkX19tYWlu"),s("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[s("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[s("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),s("I2xpdmVyZUFkV3JhcHBlcg=="),s("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),s("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[s("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",s("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),s("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),s("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[s("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),s("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),s("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",s("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),s("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),s("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),s("ZGl2I3NrYXBpZWNfYWQ=")],ro:[s("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),s("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[s("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),s("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),s("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",s("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),s("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",s("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]},n=Object.keys(e),[4,Y((a=[]).concat.apply(a,n.map(function(t){return e[t]})))]):[2,void 0];case 1:return o=i.sent(),t&&function(e,t){for(var n="DOM blockers debug:\n```",i=0,o=Object.keys(e);i<o.length;i++){var r=o[i];n+="\n".concat(r,":");for(var a=0,s=e[r];a<s.length;a++){var c=s[a];n+="\n ".concat(t[c]?"🚫":"➡️"," ").concat(c)}}console.log("".concat(n,"\n```"))}(e,o),(r=n.filter(function(t){var n=e[t];return w(n.map(function(e){return o[e]}))>.6*n.length})).sort(),[2,r]}var s})})},fontPreferences:function(){return function(e,t){void 0===t&&(t=4e3);return A(function(n,i){var r=i.document,a=r.body,s=a.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",L()?a.style.zoom="".concat(1/i.devicePixelRatio):_()&&(a.style.zoom="reset");var c=r.createElement("div");return c.textContent=o([],Array(t/20|0),!0).map(function(){return"word"}).join(" "),a.appendChild(c),e(r,a)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}(function(e,t){for(var n={},i={},o=0,r=Object.keys($);o<r.length;o++){var a=r[o],s=$[a],c=s[0],l=void 0===c?{}:c,u=s[1],d=void 0===u?"mmMwWLliI0fiflO&1":u,h=e.createElement("span");h.textContent=d,h.style.whiteSpace="nowrap";for(var m=0,f=Object.keys(l);m<f.length;m++){var p=f[m],v=l[p];void 0!==v&&(h.style[p]=v)}n[a]=h,t.appendChild(e.createElement("br")),t.appendChild(h)}for(var g=0,y=Object.keys($);g<y.length;g++){i[a=y[g]]=n[a].getBoundingClientRect().width}return i})},audio:function(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(_()&&!T()&&!function(){var e=window;return w(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}())return-1;var n=new t(1,5e3,44100),i=n.createOscillator();i.type="triangle",i.frequency.value=1e4;var o=n.createDynamicsCompressor();o.threshold.value=-50,o.knee.value=40,o.ratio.value=12,o.attack.value=0,o.release.value=.25,i.connect(o),o.connect(n.destination),i.start(0);var r=function(e){var t=3,n=500,i=500,o=5e3,r=function(){},a=new Promise(function(a,c){var l=!1,d=0,h=0;e.oncomplete=function(e){return a(e.renderedBuffer)};var m=function(){setTimeout(function(){return c(x("timeout"))},Math.min(i,h+o-Date.now()))},f=function(){try{var i=e.startRendering();switch(s(i)&&u(i),e.state){case"running":h=Date.now(),l&&m();break;case"suspended":document.hidden||d++,l&&d>=t?c(x("suspended")):setTimeout(f,n)}}catch(e){c(e)}};f(),r=function(){l||(l=!0,h>0&&m())}});return[a,r]}(n),a=r[0],c=r[1],l=a.then(function(e){return function(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}(e.getChannelData(0).subarray(4500))},function(e){if("timeout"===e.name||"suspended"===e.name)return-3;throw e});return u(l),function(){return c(),l}},screenFrame:function(){var e=this,t=N();return function(){return n(e,void 0,void 0,function(){var e,n;return i(this,function(i){switch(i.label){case 0:return[4,t()];case 1:return e=i.sent(),[2,[(n=function(e){return null===e?null:k(e,10)})(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}},osCpu:function(){return navigator.oscpu},languages:function(){var e,t=navigator,n=[],i=t.language||t.userLanguage||t.browserLanguage||t.systemLanguage;if(void 0!==i&&n.push([i]),Array.isArray(t.languages))L()&&w([!("MediaSettingsRange"in(e=window)),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3||n.push(t.languages);else if("string"==typeof t.languages){var o=t.languages;o&&n.push(o.split(","))}return n},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return b(y(navigator.deviceMemory),void 0)},screenResolution:function(){var e=screen,t=function(e){return b(g(e),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n},hardwareConcurrency:function(){return b(g(navigator.hardwareConcurrency),void 0)},timezone:function(){var e,t=null===(e=window.Intl)||void 0===e?void 0:e.DateTimeFormat;if(t){var n=(new t).resolvedOptions().timeZone;if(n)return n}var i,o=(i=(new Date).getFullYear(),-Math.max(y(new Date(i,0,1).getTimezoneOffset()),y(new Date(i,6,1).getTimezoneOffset())));return"UTC".concat(o>=0?"+":"").concat(Math.abs(o))},sessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},localStorage:function(){try{return!!window.localStorage}catch(e){return!0}},indexedDB:function(){var e,t;if(!(C()||(e=window,t=navigator,w(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!C())))try{return!!window.indexedDB}catch(e){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var e=navigator.platform;return"MacIntel"===e&&_()&&!T()?function(){if("iPad"===navigator.platform)return!0;var e=screen,t=e.width/e.height;return w(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}()?"iPad":"iPhone":e},plugins:function(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var i=e[n];if(i){for(var o=[],r=0;r<i.length;++r){var a=i[r];o.push({type:a.type,suffixes:a.suffixes})}t.push({name:i.name,description:i.description,mimeTypes:o})}}return t}},canvas:function(){var e,t,n=!1,i=function(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}(),o=i[0],r=i[1];if(function(e,t){return!(!t||!e.toDataURL)}(o,r)){n=function(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}(r),function(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat(String.fromCharCode(55357,56835));t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}(o,r);var a=E(o);a!==E(o)?e=t="unstable":(t=a,function(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,i=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<i.length;n++){var o=i[n],r=o[0],a=o[1],s=o[2];t.fillStyle=r,t.beginPath(),t.arc(a,s,40,0,2*Math.PI,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,2*Math.PI,!0),t.arc(60,60,20,0,2*Math.PI,!0),t.fill("evenodd")}(o,r),e=E(o))}else e=t="";return{winding:n,geometry:e,text:t}},touchSupport:function(){var e,t=navigator,n=0;void 0!==t.maxTouchPoints?n=g(t.maxTouchPoints):void 0!==t.msMaxTouchPoints&&(n=t.msMaxTouchPoints);try{document.createEvent("TouchEvent"),e=!0}catch(t){e=!1}return{maxTouchPoints:n,touchEvent:e,touchStart:"ontouchstart"in window}},vendor:function(){return navigator.vendor||""},vendorFlavors:function(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var i=n[t],o=window[i];o&&"object"==typeof o&&e.push(i)}return e.sort()},cookiesEnabled:function(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=-1!==e.cookie.indexOf("cookietest=");return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch(e){return!1}},colorGamut:function(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}},invertedColors:function(){return!!X("inverted")||!X("none")&&void 0},forcedColors:function(){return!!H("active")||!H("none")&&void 0},monochrome:function(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=100;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}},contrast:function(){return z("no-preference")?0:z("high")||z("more")?1:z("low")||z("less")?-1:z("forced")?10:void 0},reducedMotion:function(){return!!O("reduce")||!O("no-preference")&&void 0},hdr:function(){return!!U("high")||!U("standard")&&void 0},math:function(){var e,t=B.acos||Q,n=B.acosh||Q,i=B.asin||Q,o=B.asinh||Q,r=B.atanh||Q,a=B.atan||Q,s=B.sin||Q,c=B.sinh||Q,l=B.cos||Q,u=B.cosh||Q,d=B.tan||Q,h=B.tanh||Q,m=B.exp||Q,f=B.expm1||Q,p=B.log1p||Q;return{acos:t(.12312423423423424),acosh:n(1e308),acoshPf:(e=1e154,B.log(e+B.sqrt(e*e-1))),asin:i(.12312423423423424),asinh:o(1),asinhPf:function(e){return B.log(e+B.sqrt(e*e+1))}(1),atanh:r(.5),atanhPf:function(e){return B.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:s(-1e300),sinh:c(1),sinhPf:function(e){return B.exp(e)-1/B.exp(e)/2}(1),cos:l(10.000000000123),cosh:u(1),coshPf:function(e){return(B.exp(e)+1/B.exp(e))/2}(1),tan:d(-1e300),tanh:h(1),tanhPf:function(e){return(B.exp(2*e)-1)/(B.exp(2*e)+1)}(1),exp:m(1),expm1:f(1),expm1Pf:function(e){return B.exp(e)-1}(1),log1p:p(10),log1pPf:function(e){return B.log(1+e)}(10),powPI:function(e){return B.pow(B.PI,e)}(-100)}},videoCard:function(){var e,t=document.createElement("canvas"),n=null!==(e=t.getContext("webgl"))&&void 0!==e?e:t.getContext("experimental-webgl");if(n&&"getExtension"in n){var i=n.getExtension("WEBGL_debug_renderer_info");if(i)return{vendor:(n.getParameter(i.UNMASKED_VENDOR_WEBGL)||"").toString(),renderer:(n.getParameter(i.UNMASKED_RENDERER_WEBGL)||"").toString()}}},pdfViewerEnabled:function(){return navigator.pdfViewerEnabled},architecture:function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}};function q(e){var t=function(e){if(F())return.4;if(_())return T()?.5:.3;var t=e.platform.value||"";if(/^Win/.test(t))return.6;if(/^Mac/.test(t))return.5;return.7}(e),n=function(e){return k(.99+.01*e,1e-4)}(t);return{score:t,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,"".concat(n))}}function ee(e){return JSON.stringify(e,function(e,n){return n instanceof Error?t({name:(i=n).name,message:i.message,stack:null===(o=i.stack)||void 0===o?void 0:o.split("\n")},i):n;var i,o},2)}function te(e){return function(e,t){t=t||0;var n,i=(e=e||"").length%16,o=e.length-i,r=[0,t],a=[0,t],s=[0,0],c=[0,0],l=[2277735313,289559509],u=[1291169091,658871167];for(n=0;n<o;n+=16)s=[255&e.charCodeAt(n+4)|(255&e.charCodeAt(n+5))<<8|(255&e.charCodeAt(n+6))<<16|(255&e.charCodeAt(n+7))<<24,255&e.charCodeAt(n)|(255&e.charCodeAt(n+1))<<8|(255&e.charCodeAt(n+2))<<16|(255&e.charCodeAt(n+3))<<24],c=[255&e.charCodeAt(n+12)|(255&e.charCodeAt(n+13))<<8|(255&e.charCodeAt(n+14))<<16|(255&e.charCodeAt(n+15))<<24,255&e.charCodeAt(n+8)|(255&e.charCodeAt(n+9))<<8|(255&e.charCodeAt(n+10))<<16|(255&e.charCodeAt(n+11))<<24],s=m(s=h(s,l),31),r=d(r=m(r=p(r,s=h(s,u)),27),a),r=d(h(r,[0,5]),[0,1390208809]),c=m(c=h(c,u),33),a=d(a=m(a=p(a,c=h(c,l)),31),r),a=d(h(a,[0,5]),[0,944331445]);switch(s=[0,0],c=[0,0],i){case 15:c=p(c,f([0,e.charCodeAt(n+14)],48));case 14:c=p(c,f([0,e.charCodeAt(n+13)],40));case 13:c=p(c,f([0,e.charCodeAt(n+12)],32));case 12:c=p(c,f([0,e.charCodeAt(n+11)],24));case 11:c=p(c,f([0,e.charCodeAt(n+10)],16));case 10:c=p(c,f([0,e.charCodeAt(n+9)],8));case 9:c=h(c=p(c,[0,e.charCodeAt(n+8)]),u),a=p(a,c=h(c=m(c,33),l));case 8:s=p(s,f([0,e.charCodeAt(n+7)],56));case 7:s=p(s,f([0,e.charCodeAt(n+6)],48));case 6:s=p(s,f([0,e.charCodeAt(n+5)],40));case 5:s=p(s,f([0,e.charCodeAt(n+4)],32));case 4:s=p(s,f([0,e.charCodeAt(n+3)],24));case 3:s=p(s,f([0,e.charCodeAt(n+2)],16));case 2:s=p(s,f([0,e.charCodeAt(n+1)],8));case 1:s=h(s=p(s,[0,e.charCodeAt(n)]),l),r=p(r,s=h(s=m(s,31),u))}return r=d(r=p(r,[0,e.length]),a=p(a,[0,e.length])),a=d(a,r),r=d(r=v(r),a=v(a)),a=d(a,r),("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}(function(e){for(var t="",n=0,i=Object.keys(e).sort();n<i.length;n++){var o=i[n],r=e[o],a=r.error?"error":JSON.stringify(r.value);t+="".concat(t?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(a)}return t}(e))}function ne(e){return void 0===e&&(e=50),function(e,t){void 0===t&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(e){return n.call(window,function(){return e()},{timeout:t})}):a(Math.min(e,t))}(e,2*e)}function ie(e,t){var o=Date.now();return{get:function(a){return n(this,void 0,void 0,function(){var n,s,c;return i(this,function(i){switch(i.label){case 0:return n=Date.now(),[4,e()];case 1:return s=i.sent(),c=function(e){var t,n=q(e);return{get visitorId(){return void 0===t&&(t=te(this.components)),t},set visitorId(e){t=e},confidence:n,components:e,version:r}}(s),(t||(null==a?void 0:a.debug))&&console.log("Copy the text below to get the debug data:\n\n```\nversion: ".concat(c.version,"\nuserAgent: ").concat(navigator.userAgent,"\ntimeBetweenLoadAndGet: ").concat(n-o,"\nvisitorId: ").concat(c.visitorId,"\ncomponents: ").concat(ee(s),"\n```")),[2,c]}})})}}}var oe={load:function(e){var t=void 0===e?{}:e,o=t.delayFallback,a=t.debug,s=t.monitoring,c=void 0===s||s;return n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return c&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(r,"/npm-monitoring"),!0),e.send()}catch(e){console.error(e)}}(),[4,ne(o)];case 1:return e.sent(),[2,ie(S(K,{debug:a},[]),a)]}})})},hashComponents:te,componentsToDebugString:ee};class re{constructor(e){"string"==typeof e&&(e={apiKey:e}),this.apiKey=e.apiKey,this.apiEndpoint=e.apiEndpoint||"https://azure.dev.app.thrivestack.ai/api",this.respectDoNotTrack=!1!==e.respectDoNotTrack,this.trackClicks=!1!==e.trackClicks,this.trackForms=!0===e.trackForms,this.enableConsent=!0===e.enableConsent,this.source=e.source||"",this.geoIpServiceUrl="https://ipinfo.io/json",this.ipAddress=null,this.locationInfo=null,this.eventQueue=[],this.queueTimer=null,this.batchSize=e.batchSize||10,this.batchInterval=e.batchInterval||2e3,this.interactionHistory=[],this.maxHistoryLength=20,this.consentCategories={functional:!0,analytics:!0===e.defaultConsent,marketing:!0===e.defaultConsent},this.userId=this.getUserIdFromCookie()||"",this.groupId=this.getGroupIdFromCookie()||"",this.deviceId=null,this.deviceIdReady=!1,this.fpPromise=null,this.sessionTimeout=e.sessionTimeout||18e5,this.debounceDelay=e.debounceDelay||2e3,this.sessionUpdateTimer=null,this.lastClickTime=null,this.debugMode=!1,this._hierarchyCache=new WeakMap,this.initializeDeviceId(),this.fetchIpAndLocationInfo(),this.setupSessionTracking(),this.shouldTrack()&&(this.autoCapturePageVisit(),this.trackClicks&&this.autoCaptureClickEvents(),this.trackForms&&this.autoCaptureFormEvents())}async initializeDeviceId(){try{const e=this.getDeviceIdFromCookie();if(e)return this.deviceId=e,this.deviceIdReady=!0,console.debug("Using existing device ID from cookie:",this.deviceId),void this.processQueueIfReady();console.debug("No existing device ID found, initializing FingerprintJS..."),await this.initFingerprintJS()}catch(e){console.warn("Failed to initialize device ID:",e instanceof Error?e.message:"Unknown error"),this.deviceId=this.generateRandomDeviceId(),this.deviceIdReady=!0,this.setDeviceIdCookie(this.deviceId),console.debug("Using fallback random device ID:",this.deviceId),this.processQueueIfReady()}}async initFingerprintJS(){try{const e=await oe.load(),t=await e.get();this.deviceId=t.visitorId,this.deviceIdReady=!0,this.setDeviceIdCookie(this.deviceId),console.debug("FingerprintJS initialized with device ID:",this.deviceId),this.processQueueIfReady()}catch(e){throw console.warn("Failed to initialize FingerprintJS:",e instanceof Error?e.message:"Unknown error"),this.deviceId=this.generateRandomDeviceId(),this.deviceIdReady=!0,this.setDeviceIdCookie(this.deviceId),console.debug("Using fallback random device ID:",this.deviceId),this.processQueueIfReady(),e}}generateRandomDeviceId(){return"device_"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}setDeviceIdCookie(e){if(!e)return;const t=new Date;t.setTime(t.getTime()+63072e6);const n=`thrivestack_device_id=${e};expires=${t.toUTCString()};path=/;SameSite=Lax`;try{document.cookie=n}catch(e){console.warn("Could not store device ID in cookie:",e)}}async fetchIpAndLocationInfo(){try{const e=this.getLocationInfoFromCookie();if(e)return this.ipAddress=e.ip||null,this.locationInfo={city:e.city||null,region:e.region||null,country:e.country||null,postal:e.postal||null,loc:e.loc||null,timezone:e.timezone||null},void console.debug("Using cached IP and location info from cookie");console.debug("No cached location data found, fetching from API...");const t=await fetch(this.geoIpServiceUrl);if(!t.ok)throw new Error(`HTTP error ${t.status}`);const n=await t.json();this.ipAddress=n.ip||null,this.locationInfo={city:n.city||null,region:n.region||null,country:n.country||null,postal:n.postal||null,loc:n.loc||null,timezone:n.timezone||null},this.setLocationInfoCookie(n)}catch(e){console.warn("Failed to fetch IP and location info:",e instanceof Error?e.message:"Unknown error"),this.ipAddress=null,this.locationInfo=null}}setLocationInfoCookie(e){if(!e)return;try{const t=btoa(JSON.stringify(e)),n=new Date;n.setTime(n.getTime()+864e5);const i=`thrivestack_location_info=${t};expires=${n.toUTCString()};path=/;SameSite=Lax`;document.cookie=i,console.debug("Location info cached in cookie")}catch(e){console.warn("Could not store location info in cookie:",e)}}getLocationInfoFromCookie(){const e="thrivestack_location_info";try{const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(0===i.indexOf(e+"=")){const e=i.substring(26),t=atob(e);return JSON.parse(t)}}}catch(e){console.warn("Could not read location info from cookie:",e),this.removeLocationInfoCookie()}return null}removeLocationInfoCookie(){try{document.cookie="thrivestack_location_info=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;SameSite=Lax"}catch(e){console.warn("Could not remove location info cookie:",e)}}async init(e="",t=""){try{e&&this.setUserId(e),t&&(this.source=t)}catch(e){console.error("Failed to initialize ThriveStack:",e)}}shouldTrack(){return!this.respectDoNotTrack||"1"!==navigator.doNotTrack&&"yes"!==navigator.doNotTrack&&"1"!==window.doNotTrack||(console.warn("User has enabled Do Not Track. Tracking is disabled."),!1)}isTrackingAllowed(e){return!!this.shouldTrack()&&(!this.enableConsent||!0===this.consentCategories[e])}setConsent(e,t){this.consentCategories.hasOwnProperty(e)&&(this.consentCategories[e]=t)}setUserId(e){this.userId=e,this.setUserIdCookie(e)}setGroupId(e){this.groupId=e,this.setGroupIdCookie(e)}setSource(e){this.source=e}setUserIdCookie(e){if(!e)return;const t=new Date;t.setTime(t.getTime()+31536e6);const n=`thrivestack_user_id=${encodeURIComponent(e)};expires=${t.toUTCString()};path=/;SameSite=Lax`;try{document.cookie=n}catch(e){console.warn("Could not store user ID in cookie:",e)}}getUserIdFromCookie(){const e="thrivestack_user_id",t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(0===i.indexOf(e+"=")){const e=i.substring(20);return decodeURIComponent(e)}}return null}setGroupIdCookie(e){if(!e)return;const t=new Date;t.setTime(t.getTime()+31536e6);const n=`thrivestack_group_id=${encodeURIComponent(e)};expires=${t.toUTCString()};path=/;SameSite=Lax`;try{document.cookie=n}catch(e){console.warn("Could not store group ID in cookie:",e)}}getGroupIdFromCookie(){const e="thrivestack_group_id",t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(0===i.indexOf(e+"=")){const e=i.substring(21);return decodeURIComponent(e)}}return null}queueEvent(e){Array.isArray(e)||(e=[e]),this.eventQueue.push(...e),this.deviceIdReady?this.processQueueIfReady():console.debug("Device ID not ready, keeping events in queue")}processQueueIfReady(){this.deviceIdReady&&0!==this.eventQueue.length&&(this.eventQueue.length>=this.batchSize?this.processQueue():this.queueTimer||(this.queueTimer=setTimeout(()=>this.processQueue(),this.batchInterval)))}processQueue(){if(0===this.eventQueue.length||!this.deviceIdReady)return;const e=[...this.eventQueue],t=e.map(e=>({...e,context:{...e.context,device_id:this.deviceId}}));this.eventQueue=[],this.queueTimer&&(clearTimeout(this.queueTimer),this.queueTimer=null),this.track(t).catch(t=>{console.error("Failed to send batch events:",t),this.eventQueue.unshift(...e)})}async track(e){if(!this.apiKey)throw Error("Initialize the ThriveStack instance before sending telemetry data.");const t=e.map(e=>this.cleanPIIFromEventData(e));let n=3;for(;n>0;)try{const e=await fetch(`${this.apiEndpoint}/track`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":`${this.apiKey}`},body:JSON.stringify(t)});if(!e.ok)throw Error(`HTTP error ${e.status}: ${await e.text()}`);return await e.json()}catch(e){if(n--,0===n)throw console.error("Failed to send telemetry after multiple attempts:",e instanceof Error?e.message:"Unknown error"),e;await new Promise(e=>setTimeout(e,1e3*(3-n)))}}async identify(e){if(!this.apiKey)throw Error("Initialize the ThriveStack instance before sending telemetry data.");try{let t="";if(Array.isArray(e)&&e.length>0){t=e[e.length-1].user_id||""}else{t=e.user_id||""}t&&this.setUserId(t);const n=await fetch(`${this.apiEndpoint}/identify`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":`${this.apiKey}`},body:JSON.stringify(e)});if(!n.ok)throw Error(`HTTP error ${n.status}: ${await n.text()}`);return await n.json()}catch(e){throw console.error("Failed to send identification data:",e instanceof Error?e.message:"Unknown error"),e}}async group(e){if(!this.apiKey)throw Error("Initialize the ThriveStack instance before sending telemetry data.");try{let t="";if(Array.isArray(e)&&e.length>0){t=e[e.length-1].group_id||""}else{t=e.group_id||""}t&&this.setGroupId(t);const n=await fetch(`${this.apiEndpoint}/group`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":`${this.apiKey}`},body:JSON.stringify(e)});if(!n.ok)throw Error(`HTTP error ${n.status}: ${await n.text()}`);return await n.json()}catch(e){throw console.error("Failed to send group data:",e instanceof Error?e.message:"Unknown error"),e}}getUtmParameters(){const e=new URLSearchParams(window.location.search);return{utm_campaign:e.get("utm_campaign")||null,utm_medium:e.get("utm_medium")||null,utm_source:e.get("utm_source")||null,utm_term:e.get("utm_term")||null,utm_content:e.get("utm_content")||null}}getDeviceId(){return this.deviceIdReady&&this.deviceId?this.deviceId:null}getDeviceIdFromCookie(){const e="thrivestack_device_id",t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(0===i.indexOf(e+"="))return i.substring(22)}return null}getSessionId(){const e="thrivestack_session";try{const t=document.cookie.split(";");let n=null;for(let i=0;i<t.length;i++){const o=t[i].trim();if(0===o.indexOf(e+"=")){n=o.substring(20);break}}if(!n)return this.createNewSession();try{const e=JSON.parse(atob(n));if(e.sessionId&&e.lastActivity){const t=new Date(e.lastActivity),n=new Date;return n.getTime()-t.getTime()<this.sessionTimeout?e.sessionId:(console.debug("Session expired, creating new session"),this.createNewSession())}return this.createNewSession()}catch(e){return console.debug("Migrating old session format to new format"),this.migrateOldSession(n)}}catch(e){return console.warn("Error getting session ID:",e),this.createNewSession()}}createNewSession(){const e="session_"+Math.random().toString(36).substring(2,15),t=(new Date).toISOString(),n={sessionId:e,startTime:t,lastActivity:t};return this.setSessionCookie(n),e}migrateOldSession(e){const t=(new Date).toISOString(),n={sessionId:e,startTime:t,lastActivity:t};return this.setSessionCookie(n),e}setSessionCookie(e){try{const t=`thrivestack_session=${btoa(JSON.stringify(e))};path=/;SameSite=Lax`;document.cookie=t}catch(e){console.warn("Could not store session in cookie:",e)}}updateSessionActivity(){this.sessionUpdateTimer&&clearTimeout(this.sessionUpdateTimer),this.sessionUpdateTimer=setTimeout(()=>{this.updateSessionActivityImmediate()},this.debounceDelay)}updateSessionActivityImmediate(){const e="thrivestack_session";try{const t=document.cookie.split(";");let n=null;for(let i=0;i<t.length;i++){const o=t[i].trim();if(0===o.indexOf(e+"=")){n=o.substring(20);break}}if(n)try{const e=JSON.parse(atob(n));e.lastActivity=(new Date).toISOString(),this.setSessionCookie(e)}catch(e){this.createNewSession()}else this.createNewSession()}catch(e){console.warn("Could not update session activity:",e)}}setupSessionTracking(){}hasThriveStackEventClass(e){if(!e||!e.className)return!1;return("string"==typeof e.className?e.className.split(/\s+/):Array.from(e.classList)).some(e=>e.includes("thrivestack-event"))}async capturePageVisit(){if(!this.isTrackingAllowed("functional"))return;const e=this.getDeviceId();e||console.debug("Device ID not ready, page visit will be queued");const t=this.isTrackingAllowed("marketing")?this.getUtmParameters():{},n=this.getSessionId();this.updateSessionActivity();const i=this.userId||this.getUserIdFromCookie()||"",o=this.groupId||this.getGroupIdFromCookie()||"",r=[{event_name:"page_visit",properties:{page_title:document.title,page_url:window.location.href,page_path:window.location.pathname,page_referrer:document.referrer||null,language:navigator.language||null,ip_address:this.ipAddress,city:this.locationInfo?.city||null,region:this.locationInfo?.region||null,country:this.locationInfo?.country||null,postal:this.locationInfo?.postal||null,loc:this.locationInfo?.loc||null,timezone:this.locationInfo?.timezone||null,...t},user_id:i,context:{group_id:o,device_id:e,session_id:n,source:this.source},timestamp:(new Date).toISOString()}];this.queueEvent(r),this.addToInteractionHistory("page_visit",r[0].properties)}addToInteractionHistory(e,t){const n={type:e,details:t,timestamp:(new Date).toISOString(),sequence:this.interactionHistory.length+1};this.interactionHistory.push(n),this.interactionHistory.length>this.maxHistoryLength&&this.interactionHistory.shift()}captureClickEvent(e){if(!this.isTrackingAllowed("analytics"))return;const t=e.target;if(!this.hasThriveStackEventClass(t))return void console.debug("Element does not have 'thrivestack-event' class, skipping click tracking");const n=Date.now();if(this.lastClickTime&&n-this.lastClickTime<300)return;this.lastClickTime=n;const i=t.getBoundingClientRect(),o=this.getDeviceId();o||console.debug("Device ID not ready, click event will be queued");const r=this.isTrackingAllowed("marketing")?this.getUtmParameters():{},a=this.getSessionId();this.updateSessionActivity();const s=this.userId||this.getUserIdFromCookie()||"",c=this.groupId||this.getGroupIdFromCookie()||"",l=[{event_name:"element_click",properties:{page_title:document.title,page_url:window.location.href,page_path:window.location.pathname,element_text:t.textContent?.trim()||null,element_tag:t.tagName||null,element_id:t.id||null,element_href:t.getAttribute("href")||null,element_aria_label:t.getAttribute("aria-label")||null,element_class:t.className||null,element_position_left:i.left||null,element_position_top:i.top||null,viewport_height:window.innerHeight,viewport_width:window.innerWidth,page_referrer:document.referrer||null,language:navigator.language||null,ip_address:this.ipAddress,city:this.locationInfo?.city||null,region:this.locationInfo?.region||null,country:this.locationInfo?.country||null,postal:this.locationInfo?.postal||null,loc:this.locationInfo?.loc||null,timezone:this.locationInfo?.timezone||null,...r},user_id:s,context:{group_id:c,device_id:o,session_id:a,source:this.source},timestamp:(new Date).toISOString()}];this.queueEvent(l),this.addToInteractionHistory("element_click",l[0].properties)}captureFormEvent(e,t){if(!this.isTrackingAllowed("analytics"))return;const n=e.target,i=this.getDeviceId();i||console.debug("Device ID not ready, form event will be queued");const o=this.getSessionId();this.updateSessionActivity();const r=this.userId||this.getUserIdFromCookie()||"",a=this.groupId||this.getGroupIdFromCookie()||"",s=n._trackingData||{filledFields:new Set},c=Array.from(n.elements).filter(e=>!["submit","button","reset"].includes(e.type)).length,l=Math.round(s.filledFields.size/Math.max(c,1)*100),u=[{event_name:`form_${t}`,properties:{page_title:document.title,page_url:window.location.href,form_id:n.id||null,form_name:n.name||null,form_action:n.action||null,form_fields:c,form_completion:l,interaction_time:s.startTime?Date.now()-s.startTime:null},user_id:r,context:{group_id:a,device_id:i,session_id:o,source:this.source},timestamp:(new Date).toISOString()}];this.queueEvent(u),this.addToInteractionHistory(`form_${t}`,u[0].properties)}autoCapturePageVisit(){window.addEventListener("load",()=>this.capturePageVisit()),window.addEventListener("popstate",()=>this.capturePageVisit());const e=history.pushState;history.pushState=(...t)=>{e.apply(history,t),this.capturePageVisit()};const t=history.replaceState;history.replaceState=(...e)=>{t.apply(history,e),this.capturePageVisit()}}autoCaptureClickEvents(){document.addEventListener("click",e=>this.captureClickEvent(e))}autoCaptureFormEvents(){document.addEventListener("submit",e=>{this.captureFormEvent(e,"submit")}),document.addEventListener("input",e=>{const t=e.target;if(t.form){const n=t.form;n._trackingData||(n._trackingData={startTime:Date.now(),filledFields:new Set});const i=e.target;""!==i.value.trim()?n._trackingData.filledFields.add(i.name||i.id):n._trackingData.filledFields.delete(i.name||i.id)}}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&document.querySelectorAll("form").forEach(e=>{if(e._trackingData&&e._trackingData.filledFields.size>0){const t={target:e};this.captureFormEvent(t,"abandoned")}})})}getElementHierarchy(e){if(this._hierarchyCache||(this._hierarchyCache=new WeakMap),this._hierarchyCache.has(e))return this._hierarchyCache.get(e)||"";let t=[],n=e;for(;n&&n!==document;){let e=n.tagName,i=n.id?`#${n.id}`:"",o=n.className&&"string"==typeof n.className?`.${n.className.trim().split(/\s+/).join(".")}`:"";t.unshift(`${e}${i}${o}`),n=n.parentElement}const i=t.join(" > ");return this._hierarchyCache.set(e,i),i}getElementSelector(e){let t=e.id?`#${e.id}`:"",n=e.className&&"string"==typeof e.className?`.${e.className.trim().split(/\s+/).join(".")}`:"";return`${e.tagName}${t}$