(()=>{"use strict";var t=function(){this.FromKargoAd=!1,this.KrakenBidID=null,this.PegasusBidContext=null,this.PegasusBidID=null,this.UTMID=null,this.UTMSource=null,this.UTMMedium=null,this.UTMCampaign=null,this.UTMSourcePlatform=null,this.UTMTerm=null,this.UTMContent=null,this.UTMCreativeFormat=null,this.UTMMarketingTactic=null,this.KargoSource=null,this.KrakenBidID=e("krg_imp_id"),this.KrakenBidID&&this.KrakenBidID.length<=38&&this.KrakenBidID.length>=36||(this.KrakenBidID=null),this.PegasusBidContext=e("krg_ctx"),this.PegasusBidContext||(this.PegasusBidContext=e("krg_p_ctx")),this.PegasusBidID=e("krg_p_id"),(this.KrakenBidID||this.PegasusBidContext||this.PegasusBidID)&&(this.FromKargoAd=!0),this.UTMSource=e("utm_source"),this.UTMSource&&"kargo"==this.UTMSource.toLowerCase()&&(this.FromKargoAd=!0),e("krg_src")&&(this.FromKargoAd=!0),this.KargoSource=e("krg_src"),this.UTMID=e("utm_id"),this.UTMMedium=e("utm_medium"),this.UTMCampaign=e("utm_campaign"),this.UTMSourcePlatform=e("utm_source_platform"),this.UTMTerm=e("utm_term"),this.UTMContent=e("utm_content"),this.UTMCreativeFormat=e("utm_creative_format"),this.UTMMarketingTactic=e("utm_marketing_tactic")};function e(t){var e=new URLSearchParams(window.location.search);if(e.get(t))return e.get(t);var i=new RegExp("".concat(t,"=([\\w-=]+)"));if(window.location.hash.includes(t)){var n=window.location.hash.match(i);if(n)return n[1]}return null}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i=15&&clearInterval(this.viewTimeTimer)},e.prototype.track=function(t,e){var i=this.newPayload(t,e);this.sendEvent(i)},e.prototype.encodePayload=function(t){return JSON.stringify(t)},e.prototype.sendEvent=function(t){""!=this.config.trackerURL&&(this.beaconTrack(t)||this.xhrTrack(t))},e.prototype.imageTrack=function(t,e){t.meta="x - i".concat(e);var i=document.createElement("img");i.style.cssText="display:none;",i.src="".concat(this.config.trackerURL,"?").concat(this.privacy.getConsentParams(),"&payload=").concat(btoa(JSON.stringify(t))),document.body.appendChild(i)},e.prototype.customImageTrack=function(t){var e=document.createElement("img");e.style.cssText="display:none;",e.width=0,e.height=0,e.src=t,document.body.appendChild(e)},e.prototype.beaconTrack=function(t){return t.meta="b",window.navigator.sendBeacon&&window.navigator.sendBeacon("".concat(this.config.trackerURL,"?").concat(this.privacy.getConsentParams()),this.encodePayload(t))},e.prototype.xhrTrack=function(t){t.meta="x";var e=this.imageTrack,i=new XMLHttpRequest;i.onreadystatechange=function(){4===i.readyState&&200!=i.status&&e(t,i.status)},i.open("POST","".concat(this.config.trackerURL,"?").concat(this.privacy.getConsentParams()),!0),i.withCredentials=!0,i.send(this.encodePayload(t))},e}();const s={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let c;const u=new Uint8Array(16);function h(){if(!c&&(c="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(u)}const l=[];for(let t=0;t<256;++t)l.push((t+256).toString(16).slice(1));const p=function(t,e,i){if(s.randomUUID&&!e&&!t)return s.randomUUID();const n=(t=t||{}).random||(t.rng||h)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){i=i||0;for(let t=0;t<16;++t)e[i+t]=n[t];return e}return function(t,e=0){return l[t[e+0]]+l[t[e+1]]+l[t[e+2]]+l[t[e+3]]+"-"+l[t[e+4]]+l[t[e+5]]+"-"+l[t[e+6]]+l[t[e+7]]+"-"+l[t[e+8]]+l[t[e+9]]+"-"+l[t[e+10]]+l[t[e+11]]+l[t[e+12]]+l[t[e+13]]+l[t[e+14]]+l[t[e+15]]}(n)};function d(t){for(var e=1;e0;)if(n=i.pop()+"."+n,f.set(e,"",this.getCookieOptions(n)),f.get(e))return void(g=f.withAttributes(this.getCookieOptions(n))).remove(e);this.config.enableFirstPartyCookie=!1}}return t.prototype.getClientID=function(){var t=this.getItem(m);return t||((t=localStorage.getItem("krg_pixel"))?(this.setItem(m,t),localStorage.removeItem("krg_pixel"),t):this.generateClientID())},t.prototype.generateClientID=function(){var t=p();return this.setItem(m,t),t},t.prototype.getItem=function(t,e){try{var i=this.config.enableFirstPartyCookie?this.getCookieStorage(t):this.getLocalStorage(t);if(i&&i.expiry){if(new Date>new Date(i.expiry))return this.removeItem(t),null;e&&this.setItem(t,i.value,e)}return i&&i.value?i.value:i}catch(t){return console.debug("error getting item with cookies enabled: ".concat(this.config.enableFirstPartyCookie),t),null}},t.prototype.getSessionStorage=function(t){try{var e=this.config.enableFirstPartyCookie?g.get(t):sessionStorage.getItem(t);return e?(e=this.config.enableFirstPartyCookie?this.decode(e.toString()):this.decode(e))&&e.expiry&&new Date>new Date(e.expiry)?(this.removeSessionStorage(t),null):e&&e.value?e.value:e:null}catch(t){return console.debug("error getting session storage with cookies enabled: ".concat(this.config.enableFirstPartyCookie),t),null}},t.prototype.getLocalStorage=function(t){var e=localStorage.getItem(y);return e?(e=this.decode(e),t==y?e:e[t]):null},t.prototype.getCookieStorage=function(t){var e=g.get(y);return e?(e=this.decode(e.toString()),t==y?e:e[t]):null},t.prototype.setItem=function(t,e,i){try{var n=this.calculateExpiry(i);return this.config.enableFirstPartyCookie?this.setCookieStorage(t,e,n):this.setLocalStorage(t,e,n)}catch(t){return console.debug("error setting item with cookies enabled: ".concat(this.config.enableFirstPartyCookie),t),null}},t.prototype.setSessionStorage=function(t,e,i){try{var n={value:e,expiry:this.calculateExpiry(i)};return this.config.enableFirstPartyCookie?g.set(t,this.encode(n),{expires:null}):sessionStorage.setItem(t,this.encode(n))}catch(t){return console.debug("error setting session storage with cookies enabled: ".concat(this.config.enableFirstPartyCookie),t),null}},t.prototype.setLocalStorage=function(t,e,i){var n=this.setObject(this.getLocalStorage(y),t,e,i);return localStorage.setItem(y,this.encode(n))},t.prototype.setCookieStorage=function(t,e,i){var n=this.setObject(this.getCookieStorage(y),t,e,i);return g.set(y,this.encode(n))},t.prototype.getCookieOptions=function(t){return"localhost"==window.location.host?{}:{domain:t,sameSite:"lax",expires:365}},t.prototype.setObject=function(t,e,i,n){var r;return t?t[e]={value:i,expiry:n}:((r={})[e]={value:i,expiry:n},t=r),t},t.prototype.encode=function(t){return JSON.stringify(t)},t.prototype.decode=function(t){return JSON.parse(t)},t.prototype.calculateExpiry=function(t){if(t){var e=new Date;return e.setSeconds(e.getSeconds()+t),e.toISOString()}},t.prototype.removeItem=function(t){try{var e;if(this.config.enableFirstPartyCookie){if(e=g.get(y))return e=this.removeItemFromObject(e,t),g.set(y,e),e}else if(e=localStorage.getItem(y))return e=this.removeItemFromObject(e,t),localStorage.setItem(y,e),e;return null}catch(t){return console.debug("error removing item with cookies enabled: ".concat(this.config.enableFirstPartyCookie),t),null}},t.prototype.removeSessionStorage=function(t){try{return this.config.enableFirstPartyCookie?g.remove(t):sessionStorage.removeItem(t)}catch(t){return console.debug("error removing session storage item with cookies enabled: ".concat(this.config.enableFirstPartyCookie),t),null}},t.prototype.removeItemFromObject=function(t,e){return delete(t=this.decode(t))[e],this.encode(t)},t}(),w="krg_px_session_id",k=function(){function t(t){this.storage=t}return t.prototype.getSessionID=function(){var t=this,e=this.storage.getSessionStorage(w);return e&&""!=e&&null!=e&&"string"==typeof e&&36==e.length||(e=p(),this.storage.setSessionStorage(w,e,1800)),this.timer||(this.timer=setInterval(function(){return t.persistSessionID(e)},5e3)),e},t.prototype.persistSessionID=function(t){this.storage.setSessionStorage(w,t,1800)},t}();var S=function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,s)}c((n=n.apply(t,e||[])).next())})},b=function(t,e){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]