function getIPROSessionId(){return window.sessionStorage.getItem("ipro-session-tracker")}function setIPROSessionId(e){return window.sessionStorage.getItem("ipro-session-tracker")||window.sessionStorage.setItem("ipro-session-tracker",e),!0}function setCookie(e,t){let i=new Date("2100"),o=i.getTime()+36e6;i.setTime(o);let n="; expires="+i.toUTCString();document.cookie=e+"="+(t||"")+n+"; path=/"}function getCookie(e){let t=e+"=",i=decodeURIComponent(document.cookie).split(";");for(let e=0;e{t.addEventListener("submit",(function(t){let i=[...t.currentTarget.elements].filter((e=>"submit"!==e.type)).map((e=>({[e.getAttribute("name")]:"file"===e.type?"":e.value}))),a={};a.ipro_session_id=e,a.cnt_logger_ip=r,a.url=window.location.href,a.userAgent=navigator.userAgent,a.language=navigator.language,a.datetime=(new Date).toLocaleString("en-US"),a.is_client=1,a.marketo_cookie=getCookie("_mkto_trk"),a.hubspot_cookie=getCookie("hubspotutk"),a.ipro_pixel_cookie=n,a.ipro_pixel_client_cookie=o,a.form_data=i,a.script_version=s,a.client_pixel_id=d,a.request_type="form_data_submit";let p={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(p.Authorization="Bearer "+l),fetch("https://platform.intentpro.io/api/ipro/pixel/submitData",{method:"POST",headers:p,body:JSON.stringify(a)}).then((function(e){return e.json()})).then((function(e){})).catch((function(e){}))}),{signal:p.signal})}))},g=async function(){if(t){let t=window.location.href;if(t!=c){if(c=t,T(),!i){const e=await fetch("https://api.ipify.org/?format=json"),t=await e.json();i=!0,r=t.ip}let a={};a.ipro_session_id=e,a.cnt_logger_ip=r,a.url=window.location.href,a.userAgent=navigator.userAgent,a.language=navigator.language,a.datetime=(new Date).toLocaleString("en-US"),a.is_client=1,a.marketo_cookie=getCookie("_mkto_trk"),a.hubspot_cookie=getCookie("hubspotutk"),a.ipro_pixel_cookie=n,a.ipro_pixel_client_cookie=o,a.script_version=s,a.client_pixel_id=d,a.request_type="page_visit";let p={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(p.Authorization="Bearer "+l);const u=await fetch("https://platform.intentpro.io/api/ipro/pixel/submitData",{method:"POST",headers:p,body:JSON.stringify(a)}),_=await u.json();_.data.should_open_popup&&v(_.data.popup_html)}}},m=null,y=null,f=null,h=null,k=null,x=null,w=null,O=null,P=null,I=null,S=null,A=null,E=!1,T=function(){m=null,y=null,f=null,h=null,k=null,x=null,w=null,O=null,P=null,I=null,S=null,A=null,E=!1,document.getElementById("IPRO-POPUP-CONTAINER").innerHTML=""},v=function(e){T(),document.getElementById("IPRO-POPUP-CONTAINER").innerHTML=e,setTimeout((()=>{C()}),1e3)},C=function(){m=document.getElementById("FIRST-POPUP"),y=document.getElementById("SECOND-POPUP"),f=document.getElementById("IPRO-OPEN-POPUP-WIDGET"),h=document.getElementById("SECOND-POPUP-ACTION-BTN"),k=document.getElementById("IPRO-POPUP-ACTION-URL"),x=document.getElementById("FIRST-POPUP-CLOSE-BTN"),w=document.getElementById("SECOND-POPUP-CLOSE-BTN"),O=document.getElementById("OPEN-POPUP-BTN"),P=document.getElementById("FIRST-POPUP-ACTION-BTN"),I=document.getElementById("IPRO-EMAIL-INPUT"),S=document.getElementById("IPRO-SUBMIT-EMAIL-BTN"),A=document.getElementById("IPRO-EMAIL-ERROR-MSG"),x.addEventListener("click",(()=>{b()})),w.addEventListener("click",(()=>{N()})),O.addEventListener("click",(()=>{B()})),P.addEventListener("click",(()=>{L()})),h.addEventListener("click",(()=>{j()})),S.addEventListener("click",(()=>{R()}))},b=async function(){m.style.display="none",y.style.display="none",f.style.display="block";let t={ipro_session_id:e,cnt_logger_ip:r,url:window.location.href,ipro_pixel_cookie:n,ipro_pixel_client_cookie:o,script_version:s,client_pixel_id:d},i={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(i.Authorization="Bearer "+l);let a="";a=E?"https://platform.intentpro.io/api/ipro/pixel/popup-track/reclose":"https://platform.intentpro.io/api/ipro/pixel/popup-track/page1-close";const p=await fetch(a,{method:"POST",headers:i,body:JSON.stringify(t)});await p.json()},N=async function(){m.style.display="none",y.style.display="none",f.style.display="block";let t={ipro_session_id:e,cnt_logger_ip:r,url:window.location.href,ipro_pixel_cookie:n,ipro_pixel_client_cookie:o,script_version:s,client_pixel_id:d},i={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(i.Authorization="Bearer "+l);const a=await fetch("https://platform.intentpro.io/api/ipro/pixel/popup-track/page2-close",{method:"POST",headers:i,body:JSON.stringify(t)});await a.json()},B=async function(){E=!0,y.style.display="none",m.style.display="flex",f.style.display="none";let t={ipro_session_id:e,cnt_logger_ip:r,url:window.location.href,ipro_pixel_cookie:n,ipro_pixel_client_cookie:o,script_version:s,client_pixel_id:d},i={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(i.Authorization="Bearer "+l);const a=await fetch("https://platform.intentpro.io/api/ipro/pixel/popup-track/reopen",{method:"POST",headers:i,body:JSON.stringify(t)});await a.json()},L=async function(){m.style.display="none",y.style.display="flex";let t={ipro_session_id:e,cnt_logger_ip:r,url:window.location.href,ipro_pixel_cookie:n,ipro_pixel_client_cookie:o,script_version:s,client_pixel_id:d},i={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(i.Authorization="Bearer "+l);const a=await fetch("https://platform.intentpro.io/api/ipro/pixel/popup-track/page1-click",{method:"POST",headers:i,body:JSON.stringify(t)});await a.json()},j=async function(){let t=k.href;window.open(t,"_blank");let i={ipro_session_id:e,cnt_logger_ip:r,url:window.location.href,ipro_pixel_cookie:n,ipro_pixel_client_cookie:o,script_version:s,client_pixel_id:d},a={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(a.Authorization="Bearer "+l);const p=await fetch("https://platform.intentpro.io/api/ipro/pixel/popup-track/page2-click",{method:"POST",headers:a,body:JSON.stringify(i)});await p.json()},R=async function(){let t=I.value;if(""===t||!U(t))return A.style.display="block",!1;A.style.display="none",I.value="",m.style.display="none",y.style.display="none",f.style.display="block";let i={ipro_session_id:e,cnt_logger_ip:r,url:window.location.href,ipro_pixel_cookie:n,ipro_pixel_client_cookie:o,script_version:s,client_pixel_id:d,email_id:t},a={Accept:"application/json","Content-Type":"Application/json"};""!=l&&(a.Authorization="Bearer "+l);const p=await fetch("https://platform.intentpro.io/api/ipro/pixel/popup-track/email",{method:"POST",headers:a,body:JSON.stringify(i)});await p.json()},U=e=>String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);window.onload=function(i){docReady((function(){u(),prepareFrame(),function(){let e=document.createElement("div");e.id="IPRO-POPUP-CONTAINER",document.body.appendChild(e)}(),document.addEventListener("DOMSubtreeModified",(async function(e){await g()})),(e=getIPROSessionId())||(e=create_UUID()),setIPROSessionId(e),(o=getCookieLocalStorageItem("ipro_pixel_client_trk"))||(o=create_UUID()),checkAndSetCookieLocalStorage("ipro_pixel_client_trk",o),window.addEventListener("message",(async function(e){t=!0,"https://platform.intentpro.io"===e.origin&&(n=e.data.iProCookie,l=e.data.token,await g())}),!1),a=document.getElementsByTagName("form"),_(a)}))}}();