(function(){function yt(n){const i={purchaseId:null,totalAmount:null,rawTotalAmount:null,taxAmount:null,rawTaxAmount:null,shippingAmount:null,rawShippingAmount:null,currency:null,discountAmount:null,rawDiscountAmount:null,couponCode:null,items:[],timeOffset:new Date-t.startTime};return n.actionField&&(n.actionField.id&&(i.purchaseId=n.actionField.id),i.totalAmount=r.tryGetFloat(n.actionField.revenue),i.rawTotalAmount=n.actionField.revenue+"",n.actionField.tax&&(i.taxAmount=r.tryGetFloat(n.actionField.tax),i.rawTaxAmount=n.actionField.tax+""),n.actionField.shipping&&(i.shippingAmount=r.tryGetFloat(n.actionField.shipping),i.rawShippingAmount=n.actionField.shipping+""),n.actionField.coupon&&(i.couponCode=n.actionField.coupon.toString())),n.products&&n.products.length>0&&n.products.forEach(function(n){if(n){const t={id:null,name:null,price:null,rawPrice:null,quantity:null,discount:null,brand:null,variant:null,category:null};n.id&&(t.id=n.id);n.name&&(t.name=n.name);t.price=r.tryGetFloat(n.price);t.rawPrice=n.price+"";n.brand&&(t.brand=n.brand);n.category&&(t.category=n.category);n.variant&&(t.variant=n.variant);t.quantity=r.tryGetInt(n.quantity);i.items.push(t)}}),i}function pt(n){const i={purchaseId:null,totalAmount:null,rawTotalAmount:null,taxAmount:null,rawTaxAmount:null,shippingAmount:null,rawShippingAmount:null,currency:null,discountAmount:null,couponCode:null,items:[],timeOffset:new Date-t.startTime};return n.transaction_id&&(i.purchaseId=n.transaction_id),i.totalAmount=r.tryGetFloat(n.value),i.rawTotalAmount=n.value+"",n.tax&&(i.rawTaxAmount=n.tax+"",i.taxAmount=r.tryGetFloat(n.tax)),n.shipping&&(i.rawShippingAmount=n.shipping+"",i.shippingAmount=r.tryGetFloat(n.shipping)),n.currency&&(i.currency=n.currency),n.coupon&&(i.couponCode=n.coupon.toString()),n.items&&n.items.length>0&&n.items.forEach(function(n){if(n){const t={id:null,name:null,price:null,rawPrice:null,quantity:null,discount:null,brand:null,variant:null,category:null};n.item_id&&(t.id=n.item_id+"");n.item_name&&(t.name=n.item_name+"");t.price=r.tryGetFloat(n.price);t.rawPrice=n.price+"";t.quantity=r.tryGetInt(n.quantity);n.item_brand&&(t.brand=n.item_brand+"");n.item_category&&(t.category=n.item_category+"");n.item_variant&&(t.variant=n.item_variant+"");i.items.push(t)}}),i}function h(){if(window.historianqueue&&window.historianqueue.length){for(let t=0;t1)for(let t=0;t864e5?(n("Session started more than 24 hours ago - will not re-use existing session"),!1):!0}function dt(){const r={sessionId:i.id,pageId:t.id,mouseflow:null,hotjar:null};if(window.mouseflow&&mouseflow.isRecording()&&window.mouseflow.websiteId&&window.mouseflow.getSessionId()&&window.mouseflow.getPageViewId()&&(n("Integration: Active Mouseflow script detected"),r.mouseflow={siteId:window.mouseflow.websiteId,sessionId:window.mouseflow.getSessionId(),pageId:window.mouseflow.getPageViewId()}),!r.mouseflow&&!r.hotjar){n("Integration: No integrations detected.");return}e.sendIntegrations(r)}function gt(){n("StopRecorder: Stopping recording page");document.removeEventListener("click",it.click,!0);rt.forEach(function(n){window.clearInterval(n)});n("StopRecorder: Recording of page stopped")}function ni(){const i=localStorage.getItem(f.processedPurchaseIds);if(i){const t=JSON.parse(i);Array.isArray(t)&&(n("InitializePurchaseIds: found "+t.length+" purchase-ids from previous pageviews/sessions"),t.forEach(function(n){s.push(n)}))}}function ti(){document.addEventListener("click",it.click,!0);n("BindEventHandlers: EventHandlers attached")}function ii(){const i=window.setInterval(function(){const i=document.location.href;i!==t.url&&(n("document.location changed from: "+t.url+" to "+i),ft())},50);rt.push(i)}function ri(){i.id=l();i.startTime=new Date;i.userAgent=navigator.userAgent;i.deviceInfo=fi();i.siteId=a;i.trackingInformation=et();document.referrer&&(n("createNewSession: found referrer: "+document.referrer),i.referrer=document.referrer);const t=st();t&&(n("createNewSession: setting previouSessionId to "+t.id),i.previousSessionId=t.id);n("createNewSession: creating new session id: "+i.id);e.sendSession(i);hi(i.id,i.startTime)}function ft(){n("startNewPageView: starting new pageview");t.id=l();t.url=window.location.href;t.canonicalUrl=ui();t.startTime=new Date;t.previousPageId=oi();t.trackingInformation=ei();document.referrer&&(t.referrer=document.referrer);n("startNewPageView: started new PageView(starttime: "+t.startTime+")\nid: "+t.id+"\nsession id: "+i.id+"\nurl: "+t.url+"\ncanonicalUrl: "+t.canonicalUrl+"\npreviousPageId: "+t.previousPageId+"\nreferrer: "+t.referrer);si(t.id);e.sendPageView(i.id,t);dt()}function ui(){const n=document.querySelector("link[rel='canonical']");return n?n.getAttribute("href"):null}function fi(){const n={hasTouch:!1,availWidth:null,availHeight:null,width:null,height:null};return n.hasTouch=!!(window.ontouchstart||window.navigator&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0)),window.screen&&(n.screenAvailWidth=window.screen.availWidth,n.screenAvailHeight=window.screen.availHeight,n.screenWidth=window.screen.width,n.screenHeight=window.screen.height),n}function l(){return window.crypto&&window.crypto.randomUUID?window.crypto.randomUUID().replace(/-/g,""):window.crypto&&!!Uint8Array?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(n){return(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16)}).replace(/-/g,""):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const t=Math.random()*16|0,i=n=="x"?t:t&3|8;return i.toString(16).replace(/-/g,"")})}function ei(){if(document.referrer){const t=g.some(n=>{const t=new RegExp(n,"i");return document.referrer.match(t)});if(!t)return n("Referrer is not from any recorded domain (referrer: "+document.referrer+")"),et()}return null}function et(){const n={utm:null,hasFbclid:!1,hasGclid:!1};r.getQueryStringParameterByName("fbclid")&&(n.hasFbclid=!0);r.getQueryStringParameterByName("gclid")&&(n.hasGclid=!0);const t=r.getQueryStringParameterByName("utm_source"),i=r.getQueryStringParameterByName("utm_medium"),u=r.getQueryStringParameterByName("utm_content"),f=r.getQueryStringParameterByName("utm_campaign"),e=r.getQueryStringParameterByName("utm_term");return n.utm={source:t,medium:i,content:u,campaign:f,term:e},n}function oi(){return localStorage.getItem(f.pageViewId)}function si(n){localStorage.setItem(f.pageViewId,n)}function ot(n){return window.location.href.indexOf(n)>-1}function hi(t,i){try{ai(t,i);ci(t,i)}catch(r){n("SaveExistingSessionToBrowserStorage: Failed setting session info in browser storage: "+JSON.stringify(r),!0)}}function st(){try{const n=li();if(n)return n}catch(t){n("GetExistingSessionInfoFromBrowserStorage: Failed fetching existing-session info from localstorage: "+JSON.stringify(t),!0)}try{const n=vi();if(n)return n}catch(t){n("GetExistingSessionInfoFromBrowserStorage: Failed fetching existing-session info from cookie: "+JSON.stringify(t),!0)}return null}function ci(n,t){if(localStorage.setItem){const i=n+"|"+t.toISOString();localStorage.setItem(f.existingSessionInfo,i)}}function li(){if(!localStorage.getItem)return null;const n=localStorage.getItem(f.existingSessionInfo);if(!n)return null;const t=n.split("|");return{id:t[0],startTime:new Date(t[1])}}function ai(n,t){const i=n+"|"+t.toISOString();yi(d.existingSessionInfo,i)}function vi(){const n=pi(d.existingSessionInfo);if(!n)return null;const t=n.split("|");return{id:t[0],startTime:new Date(t[1])}}function yi(n,t,i){const r=i?"; expires="+i.toUTCString():"";document.cookie=n+"="+(t||"")+r+"; path=/"}function pi(n){if(!document.cookie)return null;const t=n+"=",i=document.cookie.split(";");for(let n=0;n-1?(n("Legacy browser detected. CssSelectors will always be resolved to null."),function(){return null}):function(n){function r(n,t,i){function c(n){const t=n.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(n){return"$"+n}):[]}function l(n){return"#"+a(n)}function a(n){if(/^-?[a-zA-Z_][a-zA-Z0-9_-]*$/.test(n))return n;const t=/^(?:[0-9]|-[0-9-]?)/.test(n),i=n.length-1;return n.replace(/./g,function(n,r){return t&&0===r||!function(n){return!!/[a-zA-Z0-9_-]/.test(n)||n.charCodeAt(0)>=160}(n)?function(n,t){return"\\"+function(n){let t=n.charCodeAt(0).toString(16);return 1===t.length&&(t="0"+t),t}(n)+(t?"":" ")}(n,r===i):n})}if(n.nodeType!==Node.ELEMENT_NODE)return null;const f=n.getAttribute("id");if(t){if(f)return{value:l(f),optimized:!0};const t=n.nodeName.toLowerCase();if("body"===t||"head"===t||"html"===t)return{value:n.nodeName.toLowerCase(),optimized:!0}}const r=n.nodeName.toLowerCase();if(f)return{value:r.toLowerCase()+l(f),optimized:!0};const o=n.parentNode;if(!o||o.nodeType===Node.DOCUMENT_NODE)return{value:r.toLowerCase(),optimized:!0};const s=c(n);let v=!1,u=!1,h=-1;const y=o.children;for(let t=0;(-1===h||!u)&&t ")}}let b,k=!1;const d={existingSessionInfo:"__hst_s"},f={queueKey:"__hst_q",pageViewId:"__hst_p",existingSessionInfo:"__hst_s",processedPurchaseIds:"__hst_c"},a="c1889e2b732946d88ffa07c893f65bc2",o=!0||ot("hst_force"),g=["simplyorganized.dk"],nt=[],tt=[],v=20,ht=!1||ot("hst_debug"),ct=new Date,y=[],n=function(n,t){const i="("+(new Date-ct)+") "+n;y.push(i);ht&&console.log(i);t&&e.sendLog(a,window.location.href,y.join("\n"))},p="1.0.39",lt="(Googlebot\\/|Googlebot-Mobile|Googlebot-Image|Googlebot-News|Googlebot-Video|AdsBot-Google([^-]|$)|AdsBot-Google-Mobile|Feedfetcher-Google|Mediapartners-Google|Mediapartners \\(Googlebot\\)|APIs-Google|bingbot|Slurp|[wW]get|LinkedInBot|Python-urllib|python-requests|aiohttp|httpx|libwww-perl|httpunit|nutch|Go-http-client|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|BIGLOTRON|Teoma|convera|seekbot|Gigabot|Gigablast|exabot|ia_archiver|GingerCrawler|webmon |HTTrack|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|findlink|msrbot|panscient|yacybot|AISearchBot|ips-agent|tagoobot|MJ12bot|woriobot|yanga|buzzbot|mlbot|YandexBot|YandexImages|YandexAccessibilityBot|YandexMobileBot|YandexMetrika|YandexTurbo|YandexImageResizer|YandexVideo|YandexAdNet|YandexBlogs|YandexCalendar|YandexDirect|YandexFavicons|YaDirectFetcher|YandexForDomain|YandexMarket|YandexMedia|YandexMobileScreenShotBot|YandexNews|YandexOntoDB|YandexPagechecker|YandexPartner|YandexRCA|YandexSearchShop|YandexSitelinks|YandexSpravBot|YandexTracker|YandexVertis|YandexVerticals|YandexWebmaster|YandexScreenshotBot|purebot|Linguee Bot|CyberPatrol|voilabot|Baiduspider|citeseerxbot|spbot|twengabot|postrank|TurnitinBot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|Ahrefs(Bot|SiteAudit)|fuelbot|CrunchBot|IndeedBot|mappydata|woobot|ZoominfoBot|PrivacyAwareBot|Multiviewbot|SWIMGBot|Grobbot|eright|Apercite|semanticbot|Aboundex|domaincrawler|wbsearchbot|summify|CCBot|edisterbot|seznambot|ec2linkfinder|gslfbot|aiHitBot|intelium_bot|facebookexternalhit|Yeti|RetrevoPageAnalyzer|lb-spider|Sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|OrangeBot\\/|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|S[eE][mM]rushBot|yoozBot|lipperhey|Y!J|Domain Re-Animator Bot|AddThis|Screaming Frog SEO Spider|MetaURI|Scrapy|Livelap[bB]ot|OpenHoseBot|CapsuleChecker|collection@infegy.com|IstellaBot|DeuSu\\/|betaBot|Cliqzbot\\/|MojeekBot\\/|netEstate NE Crawler|SafeSearch microdata crawler|Gluten Free Crawler\\/|Sonic|Sysomos|Trove|deadlinkchecker|Slack-ImgProxy|Embedly|RankActiveLinkBot|iskanie|SafeDNSBot|SkypeUriPreview|Veoozbot|Slackbot|redditbot|datagnionbot|Google-Adwords-Instant|adbeat_bot|WhatsApp|contxbot|pinterest.com.bot|electricmonk|GarlikCrawler|BingPreview\\/|vebidoobot|FemtosearchBot|Yahoo Link Preview|MetaJobBot|DomainStatsBot|mindUpBot|Daum\\/|Jugendschutzprogramm-Crawler|Xenu Link Sleuth|Pcore-HTTP|moatbot|KosmioBot|[pP]ingdom|AppInsights|PhantomJS|Gowikibot|PiplBot|Discordbot|TelegramBot|Jetslide|newsharecounts|James BOT|Bark[rR]owler|TinEye|SocialRankIOBot|trendictionbot|Ocarinabot|epicbot|Primalbot|DuckDuckGo-Favicons-Bot|GnowitNewsbot|Leikibot|LinkArchiver|YaK\\/|PaperLiBot|Digg Deeper|dcrawl|Snacktory|AndersPinkBot|Fyrebot|EveryoneSocialBot|Mediatoolkitbot|Luminator-robots|ExtLinksBot|SurveyBot|NING\\/|okhttp|Nuzzel|omgili|PocketParser|YisouSpider|um-LN|ToutiaoSpider|MuckRack|Jamie's Spider|AHC\\/|NetcraftSurveyAgent|Laserlikebot|^Apache-HttpClient|AppEngine-Google|Jetty|Upflow|Thinklab|Traackr.com|Twurly|Mastodon|http_get|DnyzBot|botify|007ac9 Crawler|BehloolBot|BrandVerity|check_http|BDCbot|ZumBot|EZID|ICC-Crawler|ArchiveBot|^LCC |filterdb.iss.net\\/crawler|BLP_bbot|BomboraBot|Buck\\/|Companybook-Crawler|Genieo|magpie-crawler|MeltwaterNews|Moreover|newspaper\\/|ScoutJet|(^| )sentry\\/|StorygizeBot|UptimeRobot|OutclicksBot|seoscanners|Hatena|Google Web Preview|MauiBot|AlphaBot|SBL-BOT|IAS crawler|adscanner|Netvibes|acapbot|Baidu-YunGuanCe|bitlybot|blogmuraBot|Bot.AraTurka.com|bot-pge.chlooe.com|BoxcarBot|BTWebClient|ContextAd Bot|Digincore bot|Disqus|Feedly|Fetch\\/|Fever|Flamingo_SearchEngine|FlipboardProxy|g2reader-bot|G2 Web Services|imrbot|K7MLWCBot|Kemvibot|Landau-Media-Spider|linkapediabot|vkShare|Siteimprove.com|BLEXBot\\/|DareBoost|ZuperlistBot\\/|Miniflux\\/|Feedspot|Diffbot\\/|SEOkicks|tracemyfile|Nimbostratus-Bot|zgrab|PR-CY.RU|AdsTxtCrawler|Datafeedwatch|Zabbix|TangibleeBot|google-xrawler|axios|Amazon CloudFront|Pulsepoint|CloudFlare-AlwaysOnline|Google-Structured-Data-Testing-Tool|WordupInfoSearch|WebDataStats|HttpUrlConnection|Seekport Crawler|ZoomBot|VelenPublicWebCrawler|MoodleBot|jpg-newsbot|outbrain|W3C_Validator|Validator\\.nu|W3C-checklink|W3C-mobileOK|W3C_I18n-Checker|FeedValidator|W3C_CSS_Validator|W3C_Unicorn|Google-PhysicalWeb|Blackboard|ICBot\\/|BazQux|Twingly|Rivva|Experibot|awesomecrawler|Dataprovider.com|GroupHigh\\/|theoldreader.com|AnyEvent|Uptimebot\\.org|Nmap Scripting Engine|2ip.ru|Clickagy|Caliperbot|MBCrawler|online-webceo-bot|B2B Bot|AddSearchBot|Google Favicon|HubSpot|Chrome-Lighthouse|HeadlessChrome|CheckMarkNetwork\\/|www\\.uptime\\.com|Streamline3Bot\\/|serpstatbot\\/|MixnodeCache\\/|^curl|SimpleScraper|RSSingBot|Jooblebot|fedoraplanet|Friendica|NextCloud|Tiny Tiny RSS|RegionStuttgartBot|Bytespider|Datanyze|Google-Site-Verification|TrendsmapResolver|tweetedtimes|NTENTbot|Gwene|SimplePie|SearchAtlas|Superfeedr|feedbot|UT-Dorkbot|Amazonbot|SerendeputyBot|Eyeotabot|officestorebot|Neticle Crawler|SurdotlyBot|LinkisBot|AwarioSmartBot|AwarioRssBot|RyteBot|FreeWebMonitoring SiteChecker|AspiegelBot|NAVER Blog Rssbot|zenback bot|SentiBot|Domains Project\\/|Pandalytics|VKRobot|bidswitchbot|tigerbot|NIXStatsbot|Atom Feed Robot|Curebot|PagePeeker\\/|Vigil\\/|rssbot\\/|startmebot\\/|JobboerseBot|seewithkids|NINJA bot|Cutbot|BublupBot|BrandONbot|RidderBot|Taboolabot|Dubbotbot|FindITAnswersbot|infoobot|Refindbot|BlogTraffic\\/\\d\\.\\d+ Feed-Fetcher|SeobilityBot|Cincraw|Dragonbot|VoluumDSP-content-bot|FreshRSS|BitBot|^PHP-Curl-Class|Google-Certificates-Bridge|centurybot|Viber|e\\.ventures Investment Crawler|evc-batch|PetalBot|virustotal|(^| )PTST\\/|minicrawler|Cookiebot|trovitBot|seostar\\.co|IonCrawl)",it={click:function(i){const u=i.x&&i.y&&i.screenX&&i.screenY;if(u){const f=(new Date-t.startTime)/1e3;if(f>10800){n("EventListener.Click: Stopping recorder - PageView lasted more than 3 hours");gt();return}const r=wt(i);n('EventListener.Click: Clicked on "'+r.cssSelector+'"');e.sendClick(r)}}},rt=[],i={id:null,scriptVersion:p,startTime:null,referrer:null,userAgent:null,deviceInfo:null,siteId:null,trackingInformation:null,previousSessionId:null},t={id:null,url:null,canonicalUrl:null,startTime:null,referrer:null,previousPageId:null,trackingInformation:null};let at,vt;let ut;const w=[];const s=[],u={};u.init=function(t){try{if(n("Init: Script version: "+p),k){n("Init: Script already initialized - stopping duplicate script initialization",!0);return}if(k=!0,!o){n("Init: site is not recording, stopping script.");return}const r=g.some(function(n){const t=new RegExp("w?"+n,"ig");return window.location.hostname.match(t)});if(!r){n("Init: recording script for site ("+a+') should not record domain "'+window.location.hostname+'", stopping script.');return}const u=new RegExp(lt,"i"),f=u.test(navigator.userAgent);if(f){n("Init: bot or crawler detected, stopping script");return}b=t;b.unidentifiableDomNodeConditions=t.unidentifiableDomNodeConditions||[];at={};vt={};ut=wi();const i=window.location.pathname;if(nt.length){if(nt.indexOf(i)===-1){n('Init: Whitelist active and current page "'+i+'" is not in whitelist. Stopping script.');return}n('Init: Whitelist active and current page "'+i+'" is whitelisted')}if(tt.length){if(tt.indexOf(i)>-1){n('Init: Blacklist active and current page "'+i+'" is blacklisted. Stopping script.');return}n('Init: Blacklist active and current page "'+i+'" is not blacklisted.')}if(ni(),v){n("Init: Delaying recorder starting by "+v+"ms");window.setTimeout(function(){document.readyState==="complete"||document.readyState==="loaded"||document.readyState==="interactive"?(c(),h()):(n("Init: document not ready, awaiting DOM ready. Current document.readyState: "+document.readyState),window.addEventListener("DOMContentLoaded",function(){n("Init: finished awaiting DOM ready, document is ready.");c();h()}))},v);return}document.readyState==="complete"||document.readyState==="loaded"||document.readyState==="interactive"?(c(),h()):(n("Init: document not ready, awaiting DOM ready. Current document.readyState: "+document.readyState),window.addEventListener("DOMContentLoaded",function(){n("Init: finished awaiting DOM ready, document is ready.");c();h()}))}catch(i){n("Init: error occured\n"+i,!0)}};u.ecommercePurchase=function(r){if(n("EcommercePurchase: Ecommerce conversion called"),!o){n("EcommercePurchase: Script not running: purchase event was not processed");return}if(!r){n("EcommercePurchase: Cannot handle ecommerce call: Argument is null",!0);return}if(!t.id){const t=50;n("EcommercePurchase: PageView not ready - waiting "+t+" ms and retrying ecommerce purchase");window.setTimeout(function(){u.ecommercePurchase(r)},t);return}let h=null;try{if(r.purchase&&r.purchase.actionField&&(n("EcommercePurchase: Ecommerce call with EnhancedEcommerce(UA) template detected"),h=yt(r.purchase)),r.transaction_id&&r.value&&(n("EcommercePurchase: Ecommerce call with Ecommerce(GA4) template detected"),h=pt(r)),!h){n("EcommercePurchase: Cannot handle ecommerce call: Order could not be mapped, skipping sending of order",!0);n(r,!0);return}if(h.purchaseId&&s.includes(h.purchaseId+"")){n('EcommercePurchase: Skipping transmission of duplicate purchaseId. Already transmitted conversion for purchaseId "'+h.purchaseId+'"');return}n("EcommercePurchase: Ecommerce conversion successfully mapped");n("EcommercePurchase: Transmitting ecommerce conversion");h.id=l();h.sessionId=i.id;h.pageId=t.id;t.previousPageId||n("EcommercePurchase called with empty PreviousPageId. PurchaseId "+h.purchaseId,!0);e.sendEcommerceConversion(h);s.push(h.purchaseId+"");localStorage.setItem(f.processedPurchaseIds,JSON.stringify(s))}catch(c){n("EcommercePurchase: Ecommerce conversion failed with unexpected error: "+JSON.stringify(c),!0)}};u.ecommerce={};u.ecommerce.addToCart=function(u){if(n("AddToCart: addToCart called"),!o){n("AddToCart: Script not running: addToCart event was not processed");return}if(!u){n("AddToCart: Cannot handle ecommerce addToCart call: Argument is null",!0);return}const f={cartItems:[],timeOffset:new Date-t.startTime,sessionId:i.id,pageId:t.id};try{if(u.add&&u.add.products?(n("AddToCart: addToCart call with EnhancedEcommerce(UA) template detected"),u.add.products.forEach(function(n){f.cartItems.push({id:n.id,name:n.name,price:r.tryGetFloat(n.price),quantity:r.tryGetInt(n.quantity),brand:n.brand,category:n.category,variant:n.variant})})):u.items&&(n("AddToCart: addToCart call with Ecommerce(GA4) template detected"),u.items.forEach(function(n){f.cartItems.push({id:n.item_id,name:n.item_name,price:r.tryGetFloat(n.price),quantity:r.tryGetInt(n.quantity),brand:n.item_brand,category:n.item_category,variant:n.item_variant})})),!f.cartItems.length){n("AddToCart: Cannot handle addToCart call: could not map argument, skipping sending of cart",!0);n(u,!0);return}n("AddToCart: Ecommerce addToCart successfully mapped");n("AddToCart: Transmitting ecommerce addToCart event");e.sendAddToCartEvent(f)}catch(s){n("AddToCart: Ecommerce addToCart failed with unexpected error: "+JSON.stringify(s),!0)}};u.ecommerce.removeFromCart=function(u){if(n("RemoveFromCart: removeFromCart called"),!o){n("RemoveFromCart: Script not running - removeFromCart event was not processed");return}if(!u){n("RemoveFromCart: Cannot handle removeFromCart call: Argument is null",!0);return}const f={cartItems:[],timeOffset:new Date-t.startTime,sessionId:i.id,pageId:t.id};try{if(u.add&&u.remove.products?(n("RemoveFromCart: removeFromCart call with EnhancedEcommerce(UA) template detected"),u.remove.products.forEach(function(n){f.cartItems.push({id:n.id,name:n.name,price:r.tryGetFloat(n.price),quantity:r.tryGetInt(n.quantity),brand:n.brand,category:n.category,variant:n.variant})})):u.items&&(n("RemoveFromCart: removeFromCart call with Ecommerce(GA4) template detected"),u.items.forEach(function(n){f.cartItems.push({id:n.item_id,name:n.item_name,price:r.tryGetFloat(n.price),quantity:r.tryGetInt(n.quantity),brand:n.item_brand,category:n.item_category,variant:n.item_variant})})),!f.cartItems.length){n("RemoveFromCart: Cannot handle removeFromCart call: could not map argument, skipping sending of cart. Ecommerce obj: "+JSON.stringify(u),!0);return}n("RemoveFromCart: removeFromCart successfully mapped");n("RemoveFromCart: Transmitting removeFromCart event");e.sendRemoveFromCartEvent(f)}catch(s){n("RemoveFromCart: removeFromCart failed with unexpected error: "+JSON.stringify(s),!0)}};u.ecommerce.clearCart=function(){if(n("ClearCart: Ecommerce clearCart called"),!o){n("ClearCart: Script not running: clearCart event was not processed");return}const r={timeOffset:new Date-t.startTime,sessionId:i.id,pageId:t.id};n("ClearCart: Transmitting Ecommerce clearCart event");e.sendClearCartEvent(r)};u.ecommerce.purchase=u.ecommercePurchase;u.printAllLogs=function(){y.forEach(function(n){console.log("Historian:"+n)})};u.version=p;u.tagPageVariable=function(r,u){if(n("TagPageVariable: Tagging page with variable"),!o){n("TagPageVariable: Script not running: skipping tagging of page variable");return}const f={sessionId:i.id,pageId:t.id,timeOffset:new Date-t.startTime,key:r,value:u};e.sendPageVariable(f)};u.tagSessionVariable=function(t,r){if(n('TagSessionVariable: Tagging session with "'+t+'": "'+r+'"'),!o){n("TagSessionVariable: Script not running: skipping tagging of session variable");return}const u={sessionId:i.id,key:t,value:r};e.sendSessionVariable(u)};const e=function(){function a(){function n(n){switch(n){case i.SESSION:return 1;case i.PAGEVIEW:return 2;case i.ECOMMERCE_CONVERSION:return 3;case i.CLICK:case i.ECOMMERCE_ADD_TO_CART:case i.ECOMMERCE_REMOVE_FROM_CART:case i.ECOMMERCE_CLEAR_CART:case i.IMAGE_EXPOSURE:case i.INTEGRATIONS:case i.TAG_SESSION_VARIABLE:case i.TAG_PAGEVIEW_VARIABLE:return 4;default:return 5}}const r=t.sort(function(t,i){return n(t.type)-n(i.type)})[0],u=t.indexOf(r);return t.splice(u,1),r}function r(){if(!e&&!s&&t.length){e=!0;u=a();n("API: Processing API queue item. "+t.length+" other items remaining in queue");const i=JSON.stringify(u.dto),f=h+u.url,v=function(){e=!1;u=null;c=new Date;o=[];const i=20;n("API: Finished processing API queue item.");t.length&&(n("API: "+t.length+" items in queue, processing queue again in "+i+"ms"),window.setTimeout(r,i))},y=function(h){const a=!s;n('API: Failed transmitting to endpoint: "'+f+'" (http status: "'+h+'") requeuing DTO: '+i,a);o.push(new Date);t.unshift(u);e=!1;u=null;let l=100;new Date-c>1e3&&(l+=o.length*500);l>15e3&&(l=15e3);window.setTimeout(r,l)};l(i,f,v,y)}}function l(n,t,i,r,u){const f=new XMLHttpRequest;f.open("POST",t,!0);f.timeout=u||2500;f.setRequestHeader("Content-Type","text/plain");f.successCallback=i;f.errorCallback=r;f.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&(this.successCallback&&this.status===200?this.successCallback():this.errorCallback&&this.status!==200&&this.errorCallback(this.status))};f.send(n)}const h="https://historian-api.azurewebsites.net",i={SESSION:1,PAGEVIEW:2,CLICK:3,ECOMMERCE_CONVERSION:4,ECOMMERCE_ADD_TO_CART:5,ECOMMERCE_REMOVE_FROM_CART:6,ECOMMERCE_CLEAR_CART:7,TAG_SESSION_VARIABLE:8,TAG_PAGEVIEW_VARIABLE:9,IMAGE_EXPOSURE:10,INTEGRATIONS:11,LOG_ENTRY:12};let o=[],c=new Date;const t=[];let u=null,e=!1,s=!1;return function(){window.addEventListener("pagehide",function(){if(s=!0,n('"pagehide" EventListener triggered'),u&&t.unshift(u),t.length){n("PageHide: Saving "+t.length+" items from API queue to localStorage");const i=localStorage.getItem(f.queueKey);if(i){n('PageHide: Existing queue detected in localstorage key "'+f.queueKey+'". Extending set of items saved in localstorage');const r=JSON.parse(i);n('PageHide: Existing queue detected in localstorage key "'+f.queueKey+'" consists of '+r.length+" items");for(let n=0;n