var SignalsSDK;(()=>{"use strict";var e={};e.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),(()=>{let t,n;var r="object",i=function(){},o="u">typeof process?process:{},a=(o.env&&o.env.NODE_ENV,"u">typeof document);function s(e,t){return t.charAt(0)[e]()+t.slice(1)}a&&window.location.hostname,null!=o.versions&&o.versions.node,"u">typeof Deno&&Deno.core,"object"==typeof self&&self.constructor&&self.constructor.name,a&&"nodejs"===window.name||"u">typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var l=s.bind(null,"toUpperCase"),u=s.bind(null,"toLowerCase");function c(e,t){void 0===t&&(t=!0);var n,r=null===e?l("null"):"object"==typeof e?f((n=e).constructor)?n.constructor.name:null:Object.prototype.toString.call(e).slice(8,-1);return t?u(r):r}function d(e,t){return typeof t===e}var f=d.bind(null,"function"),h=d.bind(null,"string"),p=d.bind(null,"undefined");function v(e,t){if("object"!=typeof t||null===t)return!1;if(t instanceof e)return!0;var n,r,i=c(new e(""));if((n=t)instanceof Error||h(n.message)&&n.constructor&&"number"===c(r=n.constructor.stackTraceLimit)&&!isNaN(r))for(;t;){if(c(t)===i)return!0;t=Object.getPrototypeOf(t)}return!1}function m(e,t){var n,r,i=e instanceof Element||e instanceof HTMLDocument;return i&&t?(n=e,void 0===(r=t)&&(r=""),n&&n.nodeName===r.toUpperCase()):i}function g(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}d.bind(null,"boolean"),d.bind(null,"symbol"),v.bind(null,TypeError),v.bind(null,SyntaxError),g(m,"form"),g(m,"button"),g(m,"input"),g(m,"select");var w="__global__",y=typeof self===r&&self.self===self&&self||typeof e.g===r&&e.g.global===e.g&&e.g||void 0;y[w]||(y[w]={});var b=function(){if(void 0!==b)return b;var e="cookiecookie";try{I(e,e),b=-1!==document.cookie.indexOf(e),b?I(e,"",-1):delete y[w][e]}catch(e){b=!1}return b}();function I(e,t,n,r,i,o){if("u">typeof window){var a=arguments.length>1;return!1===b&&(a?y[w][e]=t:y[w][e]),a?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var E={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},T={button:!0,fieldset:!0,reset:!0,submit:!0},S={checkbox:!0,radio:!0},k=/^\s+|\s+$/g,U=Array.prototype.slice,F=Object.prototype.toString,D="Invalid form";function A(e,t){var n=null,r=e.type;if("select-one"===r)return e.options.length&&(n=e.options[e.selectedIndex].value),n;if("select-multiple"===r){n=[];for(var i=0,o=e.options.length;i-1||(void 0===(t=n[2])&&(t=""),-1!==t.indexOf("localhost")||-1!==t.indexOf("127.0.0.1")))}(t)||!t?q(t,e):t;for(var i=/([^&=]+)=?([^&]*)/g;n=i.exec(t);){var o=L(n[1]),a=L(n[2]);"[]"===o.substring(o.length-2)?(r[o=o.substring(0,o.length-2)]||(r[o]=[])).push(a):r[o]=""===a||a}for(var s in r){var l=s.split("[");l.length>1&&(function(e,t,n){for(var r=t.length-1,i=0;itypeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),B=new Uint8Array(16),W=[];for(let e=0;e<256;++e)W.push((e+256).toString(16).slice(1));let Z=function(e,n,r){if(M&&!n&&!e)return M();var i=e,o=r;let a=(i=i||{}).random??i.rng?.()??function(){if(!t){if("u"= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n){if((o=o||0)<0||o+16>n.length)throw RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);for(let e=0;e<16;++e)n[o+e]=a[e];return n}return function(e,t=0){return(W[e[t+0]]+W[e[t+1]]+W[e[t+2]]+W[e[t+3]]+"-"+W[e[t+4]]+W[e[t+5]]+"-"+W[e[t+6]]+W[e[t+7]]+"-"+W[e[t+8]]+W[e[t+9]]+"-"+W[e[t+10]]+W[e[t+11]]+W[e[t+12]]+W[e[t+13]]+W[e[t+14]]+W[e[t+15]]).toLowerCase()}(a)};function K(e,t){for(let n of t)for(let t of e.keys())if(t.match(n)){let n=e.get(t);if("string"==typeof n&&""!==n)return n}}function J(e,t,n){for(let r of n)for(let n of e.querySelectorAll("input, textarea"))for(let e of t)if(n.hasAttribute(e)){let t=n.getAttribute(e);if(t?.match(r)){let e=n.value;if("string"==typeof e&&""!==e)return e}}}let Q=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/,G=e=>"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function X(e){let t=(G(e)&&"ownerDocument"in e?e.ownerDocument:window.document).defaultView;return e instanceof t.HTMLFormElement}class Y{instance;constructor(e){this.instance=e;const t=(e,t,n)=>{e.querySelectorAll(t).forEach(n),new MutationObserver(e=>{for(let r of e)for(let e of r.addedNodes)G(e)&&(e.matches(t)&&n(e),e.querySelectorAll(t).forEach(n))}).observe(e.body,{childList:!0,subtree:!0})},n=e=>{(function(e=document){return new Promise(t=>{"complete"===e.readyState||"interactive"===e.readyState?t():e.addEventListener("DOMContentLoaded",()=>t())})})(e).then(()=>t(e,"form",e=>e.addEventListener("submit",this.onSubmit.bind(this)))).catch(()=>{})};n(document),t(document,"iframe",e=>{let t=e.contentDocument;t&&n(t)})}onSubmit(e){if(null!=e.target&&X(e.target)){var t,n,r;let i,o=K(new FormData(t=e.target),[/^email$/i,/email/i])??J(t,["autocomplete"],[/^email$/])??J(t,["placeholder"],[/email/i])??function(e,t){for(let n of t)for(let t of e.querySelectorAll("input, textarea")){let e=t.value;if("string"==typeof e&&e.match(n))return e}}(t,[Q]),a=K(i=new FormData(n=e.target),[/^name$/i])??(""!==(r=[J(n,["autocomplete"],[/^given-name$/])??K(i,[/first.*name/i,/fname/i,/given.*name/i])??J(n,["placeholder"],[/first.*name/i,/given.*name/i]),J(n,["autocomplete"],[/^family-name$/])??K(i,[/last.*name/i,/lname/i,/surname/i])??J(n,["placeholder"],[/last.*name/i,/surname/i])].filter(e=>null!=e).join(" "))?r:null)??J(n,["autocomplete"],[/^name$/])??J(n,["placeholder"],[/name/i]);this.instance.form({...null!=o?{email:o}:{},...null!=a?{name:a}:{}})}}}var ee="EventListener";function et(e){return function(t,n,r,o){var s=r||i,l=o||!1;if(!a)return s;var u=en(n),c=en(t,!0);if(!c.length)throw Error("noElements");if(!u.length)throw Error("noEvent");var d=[];return function e(t){t&&(d=[]);for(var n=t?"add"+ee:"remove"+ee,r=0;r-1?",":" ").map(function(e){return e.trim()});if(NodeList.prototype.isPrototypeOf(e)){for(var n,r=[],i=e.length>>>0;i--;)r[i]=e[i];return r}var o=(n=e)?"array"===c(n)?n:[n]:[];return t?o.map(function(e){return h(e)?en(e,!0):e}).flat():o}var er=et("Event");function ei(e,t){var n,r;return a&&f(window[e])?(n=window[e],void 0===(r=window)&&(r=null),f(n)?function(){n.apply(r,arguments),t.apply(r,arguments)}:t):window[e]=t}et(),ei.bind(null,"onerror"),ei.bind(null,"onload");var eo="u"{r.apply(history,e),this.onPageChange()};const i=history.replaceState;history.replaceState=(...e)=>{i.apply(history,e),this.onReplaceState()},window.addEventListener("popstate",()=>this.onPageChange()),this.activityTracker=function(e){var t,n,r=e.onIdle,i=e.onWakeUp,o=e.onHeartbeat,a=e.timeout,s=void 0===a?1e4:a,l=e.throttle,u=!1,c=!1,d=new Date,f=function(){return clearTimeout(t)};function h(e){f(),o&&!u&&o(el(d),e),i&&u&&(u=!1,i(el(n),e),d=new Date),t=setTimeout(function(){u=!0,r&&(n=new Date,r(el(d),e))},s)}var p=function(e,t){void 0===t&&(t={});var n=function(e,t){var n=this,r=!1;return function(i){r||(e.call(n,i),r=!0,setTimeout(function(){return r=!1},t))}}(e,t.throttle||1e4),r=[];function i(){return r=[function(e){if(eo)return!1;var t=eo||ea in document?ea:["webkit","moz","ms","o"].reduce(function(e,t){var n=t+"Hidden";return!e&&n in document?n:e},null),n="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return e(!!document[t])},i=function(){return document.addEventListener(n,r)};return i(),function(){return document.removeEventListener(n,r),i}}(function(e){e||n({type:"tabVisible"})})].concat(es.map(function(e){return er(document,e,n)})).concat(er(window,"load",n)).concat(er(window,"scroll",n,{capture:!0,passive:!0})),o}function o(){r.map(function(e){return e()})}return i(),function(){return o(),i}}(h,{throttle:void 0===l?2e3:l});return{disable:function(){c=!0,u=!1,f();var e=p();return function(){return c=!1,d=new Date,h({type:"load"}),e()}},getStatus:function(){return{isIdle:u,isDisabled:c,active:u?0:el(d,c),idle:u?el(n,c):0}}}}({onIdle:e=>{this.onPageFocus(e)},onHeartbeat:null!=this.heartbeatInterval?e=>{this.onPageFocus(e)}:void 0,onWakeUp:()=>{this.aggregateFocusTime+=this.currentFocusTime,this.currentFocusTime=0},timeout:1e3*this.idleTimeout,throttle:null!=this.heartbeatInterval?1e3*this.heartbeatInterval:void 0}),window.addEventListener("beforeunload",()=>{this.onLeavingPageFocus()}),this.onPageChange()}resetActivityTracker(){this.aggregateFocusTime=0,this.currentFocusTime=0,this.activityTracker.disable()()}onPageFocus(e){e>=0&&e<=525?(this.currentFocusTime=e,this.instance.pageFocus(this.aggregateFocusTime+this.currentFocusTime)):(this.instance.pageFocus(this.aggregateFocusTime),this.resetActivityTracker())}onLeavingPageFocus(){if(this.currentUrl){let e=this.activityTracker.getStatus();e.isIdle||this.onPageFocus(e.active)}}onPageChange(){this.onLeavingPageFocus(),this.currentUrl=new URL(window.location.href),this.instance.page(),this.resetActivityTracker()}onReplaceState(){let e=new URL(window.location.href);(null==this.currentUrl||this.currentUrl.hostname!==e.hostname||this.currentUrl.pathname!==e.pathname||this.currentUrl.search!==e.search)&&this.onPageChange()}}function ec(e){let t=document.createElement("input");if(t.type="email",t.required=!0,t.value=e,!("function"==typeof t.checkValidity?t.checkValidity():/\S+@\S+\.\S+/.test(e)))return!1;let n=e.split("@")[0];return!(null==n||/\*{3,}$/.test(n))}function ed(e,t,n=["string"]){return Object.fromEntries(Object.entries(e).filter(([e,r])=>t.includes(e)&&n.includes(typeof r)))}class ef{siteId;userId;sessionId;apiHost;strictDomain;pageTracker=null;formTracker=null;static version="0.2.15";lastPageViewEvent=null;constructor(e,{apiHost:t="https://api.cr-relay.com",autoTracking:n=!0,userId:r,strictDomain:i=!1}={}){this.siteId=e,this.apiHost=t,this.strictDomain=i,this.userId=r??this.initializeUserId(),this.sessionId=this.initializeSessionId();try{this.identifyWithQueryParams()}catch(e){console.error("Failed to identify the visitor with query params")}n&&(this.pageTracker=new eu(this),this.formTracker=new Y(this))}initializeStoredId(e,t,n){let r,i=I(e),o=""!==i?i:t;return I(e,o,n,"/",r=this.strictDomain?C(window.location.href):"."+C(window.location.href).split(".").slice(-2).join("."),!1),o}initializeSessionId(){return this.initializeStoredId("signals-sdk-session-id",Z(),1800)}initializeUserId(){return this.initializeStoredId("signals-sdk-user-id",Z(),31536e3)}identifyWithQueryParams(){let e,t=new URLSearchParams(window.location.search),n=t.get("cr_email"),r=t.get("cr_e"),i=t.get("utm_id"),o=t=>{try{let n=atob(t);ec(n)&&(e=n)}catch(e){}};null!=n&&ec(n)?e=n:null!=r?o(r):null!=i&&o(i),null!=e&&this.identify({email:e})}traceApiUrl(e){return new URL(`v1/site/${e}/batch`,this.apiHost)}async sendEvent(e){let t=this.traceApiUrl(this.siteId).toString(),n=JSON.stringify([e]);try{if(navigator.sendBeacon&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(t,n))return;await fetch(t,{method:"POST",body:n,keepalive:!0,headers:{"Content-Type":"application/json"}})}catch(e){console.warn("Failed to send web visit event:",e)}}page(e){let t={eventType:"page_view",url:"string"==typeof e?e:e?.url??window.location.href,userId:this.userId,sessionId:this.sessionId,sdkVersion:ef.version,pageViewId:Z()};this.lastPageViewEvent=t,this.sendEvent(t)}pageFocus(e){if(null==this.lastPageViewEvent)return;let t={eventType:"page_focus",pageViewId:this.lastPageViewEvent.pageViewId,focusTime:e,url:this.lastPageViewEvent.url,userId:this.userId,sessionId:this.sessionId,sdkVersion:ef.version};this.sendEvent(t)}identify(e){let t={eventType:"identity",userId:this.userId,sessionId:this.sessionId,sdkVersion:ef.version,...ed(e,["email","name"])};this.sendEvent(t)}identifyWithVector(){if(void 0===window.vector)return;let e=JSON.stringify({userId:this.userId});window.vector.partnerId=e,window.vector.identify(e)}form(e){let t=X(e)?function(e,t){if(void 0===t&&(t={trim:!1}),!e||!e.elements)throw Error(D);for(var n,r={},i=[],o={},a=0,s=e.elements.length;a0?i:null}(e,n=i[u],t);null!=d&&(r[n]=d)}return r}(e):e,n={eventType:"form",url:window.location.href,userId:this.userId,sessionId:this.sessionId,sdkVersion:ef.version,...ed(t,["email","name"])};this.sendEvent(n)}}!function(e,t){if("string"!=typeof e||""===e)throw Error("siteId is required");if(void 0!==window.signals&&window.signals instanceof ef)throw Error("SignalsSDK already loaded");null==t&&(t={});let n=new ef(e,t);if(Array.isArray(window.signals))for(let[e,t]of window.signals)try{n[e](...t)}catch(t){console.warn(`Error calling ${e}`,t)}window.signals=n,function(){try{if(window.vector)return;let e={q:[],load:function(t){e.q.push(["load",[t]])},identify:function(t){e.q.push(["identify",[t]])},on:function(t,n){e.q.push(["on",[t,n]])}};window.vector=e;let t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://cdn.vector.co/pixel.js";let n=document.getElementsByTagName("script")[0];n?.parentNode&&n.parentNode.insertBefore(t,n),e.loaded=!0}catch(e){console.error("Error loading Vector:",e)}}()}(null!=window.signals&&"_siteId"in window.signals?window.signals._siteId:null!=(n=document.currentScript?.getAttribute("src"))?n.split("/").at(-2):"",null!=window.signals&&"_opts"in window.signals?window.signals._opts:void 0)})(),SignalsSDK={}})();vector.load("d67e77a3-01ec-40c0-8f86-7cc56331de9a");window.signals.identifyWithVector();