(()=>{function R(a){let g="seline_vid",f=a.token,o=a.apiHost??"https://api.seline.so",l=a.maskPatterns??[],v=a.skipPatterns??[],m=a.cookieOnIdentify??!1,p=localStorage.getItem(g),u={},S=null,r=sessionStorage.getItem("seline:referrer")?"":document.referrer;function P(){return localStorage.getItem("seline-do-not-track")==="1"}function b(){localStorage.setItem("seline-do-not-track","1")}function E(){let t=history.pushState;history.pushState=function(...i){t.apply(this,i),c()},addEventListener("popstate",c);function e(){!S&&document.visibilityState==="visible"&&c()}document.visibilityState!=="visible"?document.addEventListener("visibilitychange",e):c(),T()}function I(t=!1){a.autoPageView&&!t||(a.autoPageView=!0,E())}function w(t){let e=v.map(n=>new RegExp(`^${n.replace(/\*/g,"[^/]+")}$`)),i=l.map(n=>new RegExp(`^${n.replace(/\*/g,"[^/]+")}$`));if(e.some(n=>n.test(t)))return null;for(let n=0;n{if(e){let i=await e.json();i?.visitorId&&(p=i.visitorId,m&&localStorage.setItem(g,p))}})}function T(){document.addEventListener("click",t=>{let e=t.target;if(!e||(e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA")&&e.type!=="submit")return;for(;e&&!e?.hasAttribute("data-sln-event");)e=e.parentElement;if(!e)return;let i=e.getAttribute("data-sln-event");if(!i)return;let n={};for(let s of Array.from(e.attributes))s.name.startsWith("data-sln-event-")&&s.value&&(n[s.name.slice(15)]=s.value);if(e.tagName==="FORM"){let s=e,O=Array.from(s.elements);for(let d of O)d.type!=="password"&&d.name&&d.value&&(n[d.name]=d.value)}y(i,n)})}return{track:y,page:c,setUser:A,enableAutoPageView:I,doNotTrack:b}}if(!window.seline){let a=document.currentScript?.getAttribute("data-token"),g=document.currentScript?.getAttribute("data-skip-patterns")?.split(",")||[],f=document.currentScript?.getAttribute("data-mask-patterns")?.split(",")||[],o=document.currentScript?.getAttribute("data-auto-page-view")!=="false",l=document.currentScript?.getAttribute("data-api-host"),v=document.currentScript?.getAttribute("data-cookie-on-identify")==="true",m=R({token:a,skipPatterns:g,maskPatterns:f,autoPageView:o,apiHost:l,cookieOnIdentify:v});window.seline=m,o&&m.enableAutoPageView(!0)}})();