let roiId=undefined,roiCt=1;const roiStorageKey="roi_tracking",ROI_GetRIDFromParam=()=>{const t=new URL(window.location.href),n=t.searchParams.get("rid");return!!n?n:undefined},ROI_GetRctypeFromParam=()=>{const t=new URL(window.location.href),n=t.searchParams.get("ridct");return!!n?n:roiCt},ROI_GetRIDFromLocalStorage=()=>{const n=localStorage.getItem(roiStorageKey);if(!!!n)return undefined;const t=JSON.parse(n);return t.rid},ROI_GetRctypeFromLocalStorage=()=>{const n=localStorage.getItem(roiStorageKey);if(!!!n)return roiCt;const t=JSON.parse(n);return t.roiCt?roiCt=t.roiCt:roiCt},ROI_SetRIDInLocalStorage=n=>{if(!!n){ROI_SetRctype();const t={rid:n,createdAt:new Date,roiCt};localStorage.setItem(roiStorageKey,JSON.stringify(t))}},ROI_SetRID=()=>{const n=ROI_GetRIDFromParam(),t=ROI_GetRIDFromLocalStorage();if(!!n&&t!==n){roiId=n;ROI_SetRIDInLocalStorage(n);return}if(!!t){roiId=t;return}roId=undefined;return},ROI_SetRctype=()=>{const n=ROI_GetRctypeFromParam(),t=ROI_GetRctypeFromLocalStorage();if(!!n&&t!==n){roiCt=n;ROI_GetRctypeFromLocalStorage();return}if(!!t){roiCt=t;return}return roiCt},ROI_WebActivityTracker=async(n=window.location.href)=>{if(!!roiId){ROI_SetRctype();const{host:r}=new URL(n),i=new XMLHttpRequest,t=new URL(n);t.searchParams.delete("rid");t.searchParams.delete("ridct");const u=t.origin+t.pathname+t.search+t.hash,f={token:roiId,domain:r,link:u,apiKey:"539dda23-054b-4a1d-a9d7-875b08b3c001",contactType:roiCt};i.open("POST","https://api.roi-ai.app/WebActivityTracking/log",!0);i.setRequestHeader("Content-Type","application/json");i.setRequestHeader("Accept","application/json");i.send(JSON.stringify(f))}};document.addEventListener("DOMContentLoaded",function(){ROI_SetRID();ROI_WebActivityTracker();let n=window.location.href;document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{n!==window.location.href&&(ROI_WebActivityTracker(),n=window.location.href)})},!0)});window.addEventListener("popstate",function(n){n.state===null?(n.preventDefault(),n.stopImmediatePropagation()):ROI_WebActivityTracker(n.currentTarget.window.location.href)});window.addEventListener("pushstate",function(n){ROI_WebActivityTracker(n.currentTarget.window.location.href)})