/*! swap.js | Copyright © 2011-2025 CallRail Inc. | License: www.callrail.com/legal */(function(){"use strict";var Wrappers=function(){function e(){}return e.documentReferrer=function(){return document.referrer},e.documentURL=function(){return document.URL},e.documentTitle=function(){return document.title},e.documentCookie=function(e){return e?document.cookie=e:document.cookie},e.isDebug=function(){return Debug._isDebug||!1},e.windowLocation=function(){return window.location},e}(),Debug=function(){function e(){}return e._debugEnabled=function(){return!!Wrappers.windowLocation().href.match(/crl?dbg/)},e.logTrackerSwapped=function(t){t&&e._isDebug&&(e.swappedTrackers.includes(t)||e.swappedTrackers.push(t))},e.logDoneSwaps=function(t,r){e._isDebug&&(e.doneSwaps[t]=r)},e.doneSwaps={},e.foundTargets=[],e.swappedTrackers=[],e}(),Performance=function(){function e(){}return e.networkPerfData=function(){if(e._networkPerfData)return e._networkPerfData;if(e._networkPerfData={},window.performance)try{var t=window.performance.getEntriesByType("resource").filter((function(e){return e.name.match(/swap\.js/)}))[0];if(t){var r=t.encodedBodySize>0&&t.transferSize>0&&t.transferSize0?t.secureConnectionStart:t.connectEnd;e._networkPerfData={dns:t.domainLookupEnd-t.domainLookupStart,conn:n-t.connectStart,tls:t.connectEnd-n,wait:t.responseStart-t.requestStart,recv:t.responseEnd-t.responseStart}}}catch(e){}return e._networkPerfData},e.reset=function(t){e._networkPerfData={},t&&delete e._throttleQueue[t]},e.runtimePerfData=function(){return e._runtimePerfData},e.throttle=function(e,t,r){if(!window.performance)return!0;this._throttleQueue[e]||(this._throttleQueue[e]=[]);var a=this._throttleQueue[e];if(a.length>0){if(a[a.length-1].duration>16.5)return this._runtimePerfData[e]=a[a.length-1].duration,this._runtimePerfData["".concat(e,"_throttling")]=1,!0;if(a.length>=t&&a[0].startTime>window.performance.now()-6e4)return this._runtimePerfData["".concat(e,"_throttling")]=1,!0}var n=window.performance.now();r();var o=window.performance.now()-n;return a.push({startTime:n,duration:o}),a.length>t&&a.shift(),this._runtimePerfData[e]=o,!1},e._runtimePerfData={},e._throttleQueue={},e}(),Polyfills=function(){function e(){}return e.unescape=function(e){var t;try{t=decodeURIComponent(e)}catch(r){t=unescape(e)}return t},e.jsonify=function(e){var t=Array.prototype.toJSON;if(!t)return JSON.stringify(e);delete Array.prototype.toJSON;var r=JSON.stringify(e);return Array.prototype.toJSON=t,r},e.documentReady=function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},e.isEmptyObject=function(e){for(var t in e)return!1;return!0},e}(),Helpers=function(){function e(){}return e.post=function(e){var t=new XMLHttpRequest;return t.open("POST",e),t},e.postScript=function(t,r,a){var n=e.post(t);n.setRequestHeader("Content-Type","text/plain"),n.setRequestHeader("Accept","application/json"),n.onload=function(){var e=JSON.parse(n.response);a(e)},n.send(Polyfills.jsonify(r))},e.postCookies=function(t,r,a){var n=e.post(t);n.setRequestHeader("Content-Type","application/json"),n.onload=function(){var e=n.status;a(e)},n.send(Polyfills.jsonify(r))},e.parseCookieResponse=function(e,t,r){204!==e&&(window.crwpVer=0,Session.createCookie("calltrk_referrer",t),Session.createCookie("calltrk_landing",r))},e.postWordpressCookies=function(t,r){var a="/index.php?rest_route=/Calltrk/v1/store",n={calltrk_referrer:t,calltrk_landing:r,calltrk_session_id:Session.getSessionID(),domain:Session.nearestTLD(),duration:CallTrk.firstNamespace().cookie_duration};e.postCookies(a,n,(function(a){e.parseCookieResponse(a,t,r)}))},e}(),Storage=function(){function e(){}return e.hasCookie=function(t){return null!=Wrappers.documentCookie()&&!(e.cookieValues(t).length<1)},e.cookieValues=function(e){for(var t=e+"=",r=Wrappers.documentCookie().split(";"),a=[],n=0;n>r/4).toString(16)})):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},e.hasWordpressCookies=function(){return window.crwpVer>=1},e.wpProxy=function(){return 2===window.crwpVer},e.proxyPath=function(e){var t;try{t=new URL(e)}catch(r){(t=document.createElement("a")).href=e}return"/index.php?rest_route=/calltrk/sessions"+t.pathname},e.crossSubdomain=function(){var e=CallTrk.firstNamespace();return e&&e.cross_subdomain},e.cookieDuration=function(){return CallTrk.firstNamespace().cookie_duration},e.isMulti=function(){return!!CallTrk.firstNamespace().multiswap_id},e.namespaceIds=function(){var e=[];return CallTrk.eachNamespace((function(t){return e.push(t.id)})),e},e.nearestTLD=function(){if(CallTrkSwap._nearestTLD)return CallTrkSwap._nearestTLD;var t=Wrappers.documentCookie(),r=Wrappers.windowLocation().hostname,a=r.split(".");if(""===r)return"";for(var n=a.length-2;n>=0;--n){var o=a.slice(n).join(".");if(e.createCookie("calltrk_nearest_tld",o,3600,o),t!==Wrappers.documentCookie())return e.eraseCookie("calltrk_nearest_tld",o),CallTrkSwap._nearestTLD=o,o}},e.createCookie=function(t,r,a,n){var o="";if(null==a&&(a=e.cookieDuration()),a){var i=new Date;i.setTime(i.getTime()+24*a*60*60*1e3),o="; expires="+i.toUTCString()}var s=t+"="+encodeURIComponent(r)+o+"; path=/";e.crossSubdomain()&&!1!==n&&!n&&(n=e.nearestTLD()),n&&(s+="; domain="+n),s+="; samesite=Lax";var c=Storage.getItem(t);return c&&c==r?Wrappers.documentCookie(s):Storage.hasCookie(s)?Storage.setItem(t,r):(Storage.setItem(t,r),Wrappers.documentCookie(s)),s},e.eraseCookie=function(t,r){e.createCookie(t,"",-1,r),Storage.removeItem(t)},e.crDeleteOldCookies=function(){e.eraseCookie("calltrk_referrer"),e.eraseCookie("calltrk_landing"),e.eraseCookie("calltrk_session_id"),e.eraseCookie("calltrk_override_src")},e.readFreshCookie=function(e){var t=Storage.cookieValues(e);return t.length<=1&&Storage.setItem(e,t[0]),t[0]||null},e.readCookie=function(t){var r=Storage.getItem(t),a=Storage.cookieValues(t);return a.length<=1&&!r?(Storage.setItem(t,a[0]),a[0]||null):r?(0===a.length&&e.createCookie(t,r),r):(e.crossSubdomain()?e.eraseCookie(t,!1):e.eraseCookie(t,e.nearestTLD()),(a=Storage.cookieValues(t))[0]||null)},e.getSessionID=function(t){if(!t){if(CallTrkSwap._session_id)return CallTrkSwap._session_id;t="calltrk_session_id"}var r=e.readCookie(t);return r||CallTrk.eachNamespace((function(t){r||(r=e.readCookie("calltrk_session_id_"+t.id.toString()))})),r||(r=e.generateUUID(),e.createCookie(t,r)),CallTrkSwap._session_id=r,r},e.getFormCaptureCookie=function(t){if(!t){if(e._fcid)return e._fcid;t="calltrk_fcid"}var r=e.readCookie(t);return r||(r=e.generateUUID()),e.createCookie(t,r),e._fcid=r,r},e.createReferrerAndLandingCookies=function(t,r,a){void 0===a&&(a=!1),e._referrerAndLandingCookiesCreated&&!a||(e.hasWordpressCookies()?Helpers.postWordpressCookies(t,r):(e.createCookie("calltrk_referrer",t),e.createCookie("calltrk_landing",r)),e._referrerAndLandingCookiesCreated=!0)},e}(),Urls=function(){function e(){}return e.getCurrentReferrer=function(){var t=e.getURLParameter("utm_referrer");return t||(t=Wrappers.documentReferrer()),t||(t="direct"),t},e.getReferrerKey=function(t,r){var a;t=t||"direct";var n=/utm_medium=([cp]pc|paid_social|paid|.*_ad.*)/i;if(r.match(/ndclid=/i))a="nextdoor_paid";else if(t.match(/doubleclick/i)||r.match(/dclid=|wbraid=|gbraid=/i))a="google_paid";else if(t.match(/google/i)&&!t.match(/mail\.google\.com/i)){if(r.match(/gclid=/i))return"google_paid";a=t.match(/googleadservices/i)||r.match(/utm_(medium|source)=[cp]pc/i)||r.match(/(matchtype|adposition)=/i)?"google_paid":"google_organic"}else a=r.match(/gclid=/i)?t.match(/(\/|\.)youtube\./i)||r.match(/utm_source=.*youtube.*/i)?"youtube_paid":r.match(/msclkid=/i)?"bing_paid":"google_paid":r.match(/msclkid=/i)?t.match(/(\/|\.)duckduckgo\./i)||r.match(/utm_source=.*duckduckgo.*/i)?"duckduckgo_paid":"bing_paid":t.match(/(\/|\.)bing\./i)||r.match(/utm_source=.*bing.*/i)?r.match(n)||r.match(/msclkid=/i)?"bing_paid":"bing_organic":t.match(/msn\.com/i)?"bing_paid":t.match(/yahoo/i)&&!t.match(/mail\.yahoo\.com/i)?r.match(n)?"yahoo_paid":"yahoo_organic":r.match(/fb_ad_id=/i)?t.match(/(\/|\.)instagram\./i)||r.match(/utm_source=.*instagram.*/i)?"instagram_paid":"facebook_paid":r.match(/(fbclid=)/i)&&t.match(/(\/|\.)instagram\./i)?r.match(n)?"instagram_paid":"instagram_organic":t.match(/(\/|\.)facebook\./i)||r.match(/(fbclid=|utm_source=.*facebook.*)/i)?r.match(n)?"facebook_paid":"facebook_organic":t.match(/(\/|\.)instagram\./i)||r.match(/utm_source=.*instagram.*/i)?r.match(n)?"instagram_paid":"instagram_organic":t.match(/(\/|\.)duckduckgo\./i)||r.match(/utm_source=.*duckduckgo.*/i)?r.match(n)?"duckduckgo_paid":"duckduckgo_organic":t.match(/(\/|\.)nextdoor\./i)||r.match(/utm_source=.*nextdoor.*/i)?r.match(n)?"nextdoor_paid":"nextdoor_organic":t.match(/(\/|\.)linkedin\./i)||r.match(/utm_source=.*linkedin.*/i)?r.match(n)?"linkedin_paid":"linkedin_organic":r.match(/ttclid=/i)?"tiktok_paid":t.match(/(\/|\.)tiktok\./i)||r.match(/utm_source=.*tiktok.*/i)?r.match(n)?"tiktok_paid":"tiktok_organic":t.match(/(\/|\.)twitter\./i)||r.match(/utm_source=.*twitter.*/i)?r.match(n)?"twitter_paid":"twitter_organic":t.match(/(\/|\.)pinterest\./i)||r.match(/utm_source=.*pinterest.*/i)?r.match(n)?"pinterest_paid":"pinterest_organic":t.match(/(\/|\.)spotify\./i)||r.match(/utm_source=.*spotify.*/i)?r.match(n)?"spotify_paid":"spotify_organic":t.match(/(\/|\.)yelp\./i)||r.match(/utm_source=.*yelp.*/i)?r.match(n)||r.match(/utm_(medium|source|campaign)=yelp_ad/i)||r.match(/campaign_code=yelp_ad/i)?"yelp_paid":"yelp_organic":t.match(/(\/|\.)youtube\./i)||r.match(/utm_source=.*youtube.*/i)?r.match(n)?"youtube_paid":"youtube_organic":"direct"===t?r.match(n)&&r.match(/utm_source=.*google.*/i)?"google_paid":"direct":e.getReferrerDomain(t);return a},e.getReferrerDomain=function(e){var t=e.split("/")[2],r=t.split(".");return r.length>2?r[r.length-2]+"."+r[r.length-1]:t},e.getHostnameAndPath=function(){var e=document.createElement("a");e.href=Wrappers.windowLocation().href;var t=e.pathname;return 0!==t.indexOf("/")&&(t="/"+t),e.hostname+t},e.getURLParameter=function(e){var t=new RegExp("[?|&]"+e+"=([^&;]+?)(&|#|;|$)").exec(Wrappers.windowLocation().search)||[null,""];return decodeURIComponent(t[1].replace(/\+/g,"%20"))||null},e.urlContainsParam=function(e){var t="(\\?|&)"+e+"($|&|=)";return Wrappers.windowLocation().href.match(t)},e.param=function(t,r,a){if("string"==typeof t)return t;for(var n in r||(r=[]),t){var o=t[n];t.hasOwnProperty(n)&&o&&(a&&(n=a+"["+(Array.isArray(t)&&!Array.isArray(t[0])?"":n)+"]"),"object"!=typeof o?r.push(encodeURIComponent(n)+"="+encodeURIComponent(o)):e.param(o,r,n))}return a?void 0:r.join("&")},e}(),Dom=function(){function e(){}return e.injectCss=function(){var e=document.documentElement,t="crjs";e.classList?e.classList.add(t):e.className+=" "+t;var r=document.createElement("style");r.setAttribute("type","text/css");var a=".crjs .phoneswap { visibility: hidden; }";void 0!==r.textContent&&(r.textContent=a);var n=document.querySelector("head");n&&n.appendChild(r)},e.domEach=function(e,t){for(var r=document.querySelectorAll(e),a=0;a10&&(a=a.slice(a.length-10)),-1===n.indexOf(a)&&n.push(a);CallTrk.eachNamespace((function(t){t.exactTargetsIn(e,(function(e){n.push(e)}))}))}),t),n},e.startObserving=function(){e.observer||"undefined"==typeof MutationObserver||(e.observer=new MutationObserver(e.mutationCallback),e.observer.observe(document.body,{childList:!0,subtree:!0}))},e.stopObserving=function(){e.observer&&(e.observer.disconnect(),e.observer=void 0)},e.mutationCallback=function(t){for(var r=CallTrk.firstNamespace().session_observer,a=!1,n=0;n0)}r&&a&&Performance.throttle("session_observer",100,(function(){CallTrkSwap.checkSessionSwap(!1)}))},e.visibleParent=function(){var e;try{if(window.self===window.parent||window.self.document===(null===(e=window.top)||void 0===e?void 0:e.document))return!1}catch(e){return!1}return!0},e.waitingParent=function(){try{if("loading"===window.parent.document.readyState)return!0}catch(e){return!1}return!1},e.iframeAwareReady=function(t){e.readyRan=!1;var r=function(){e.readyRan||(e.readyRan=!0,Polyfills.documentReady(t))};if(!(e.visibleParent()&&e.waitingParent()))return r();window.addEventListener("message",(function(e){"calltrkReady"===e.data&&r()})),"loading"!==window.parent.document.readyState&&r(),setTimeout(r,2e3)},e.whenPageVisible=function(e){"prerender"!==document.visibilityState?e():document.addEventListener&&document.addEventListener("visibilitychange",e,!1)},e.iframeConflict=function(t){if(!e.visibleParent())return!1;var r=window.top&&window.top.CallTrk&&window.top.CallTrk._namespaces;return r&&r.indexOf(t.toString())>=0},e.broadcastReady=function(){var e=window.frames;if(0!==e.length)for(var t=0;t-1){var n=a.getIntegrationData(r);Object.assign(t,n)}})),t},IntegrationData.getInstanceIntegrationData=function(cookieCache,namespaceCookies,namespaceScripts){var multiswap=Session.isMulti(),params={google_content_cookies:IntegrationData.getGoogleContentExperimentCookies(cookieCache)},force_fetch=this.shouldForceFetchIntegrationData();for(var reportName in namespaceCookies){var cookie=namespaceCookies[reportName],value=void 0;!force_fetch&&multiswap&&void 0!==cookieCache[cookie]?params[reportName]=cookieCache[cookie]:multiswap?(value=force_fetch?Session.readFreshCookie(cookie):Session.readCookie(cookie),cookieCache[cookie]=value,null!==value&&(params[reportName]=value)):(value=Session.readFreshCookie(cookie),null!==value&&(params[reportName]=value))}for(var reportAs in namespaceScripts){var code=namespaceScripts[reportAs];try{var rc=eval(code);"object"!=typeof rc||Array.isArray(rc)||(rc=Urls.param(rc)),params[reportAs]=rc}catch(e){}}return params},IntegrationData.integrationRetry=function(e){var t=IntegrationData.getIntegrationData(e),r=CallTrk.firstNamespace();Polyfills.isEmptyObject(t)||(t.uuid=Session.getSessionID(),Session.isMulti()||(t.ids=e),Dom.getScript(r.icapURL(),t))},IntegrationData.shouldForceFetchIntegrationData=function(){var e,t=new Date;return(null==(e=Storage.getItem("integration-data-ttl"))||t.getTime()>e)&&(this.setIntegrationTTL(t),!0)},IntegrationData.setIntegrationTTL=function(e){var t=18e5,r=e.getTime()+t;return Storage.setItem("integration-data-ttl",r),r},IntegrationData}(),Replacer=function(){function e(){}return e.standardReplace=function(t,r,a,n){if(e._numberRegexCache||(e._numberRegexCache={}),!e._numberRegexCache[r]){var o=r.substring(0,3),i=r.substring(3,6),s=r.substring(6,10),c="(\\(?)"+o+"(\\))?"+e.CHAR_SEP+i+e.CHAR_SEP+s,l="$1"+a.substring(0,3)+"$2$3"+a.substring(3,6)+"$4"+a.substring(6,10);e._numberRegexCache[r]=[s,new RegExp(c,"g"),l]}var u=e._numberRegexCache[r];if(t.indexOf(u[0])>-1){if(Debug._isDebug){var p=t.match(u[1]);if(p){var d=p[0],g=d.replace(u[1],u[2]);Debug.doneSwaps[d]=g,n&&Debug.logTrackerSwapped(n)}}t=t.replace(u[1],u[2])}return t},e.replacementForPlainText=function(e,t){var r=t.substring(0,3),a=t.substring(3,6),n=t.substring(6,10),o="("+r+") "+a+"-"+n,i=r+"-"+a+"-"+n,s=r+"."+a+"."+n;return e=(e=(e=e.replace("###phone###",o)).replace("###phone-dashes###",i)).replace("###phone-dots###",s)},e.CHAR_SEP="([-. "+String.fromCharCode(160)+"]?)",e.NUM_REGEX=new RegExp("(\\(?)\\d{3}(\\))?"+e.CHAR_SEP+"\\d{3}"+e.CHAR_SEP+"\\d{4}\\b","g"),e.INTL_NUM_REGEX=/[(+]?[(+]?(?:[\d][ \-.()\u202F\u00A0]{0,2}){8,21}[\d]/g,e}(),NumberSwap=function(){function e(){}return e.adjustExactFormat=function(e){var t={advanced:{},simple:{}};for(var r in e)if(-1!==r.indexOf(",")){var a=r.split(","),n=decodeURIComponent(a[0]),o=decodeURIComponent(a[1]);if(Array.isArray(e[r])){var i=Replacer.replacementForPlainText(o,e[r][0]);t.advanced[i]=["."===e[r][1][0]?n:o,e[r][1]]}else t.advanced[n]=[o,e[r]]}else t.simple[r]=e[r];return t},e}(),OverrideSource=function(){function e(e,t,r,a){this.sources=e,this.landingParam=t,this.landingPageParam=r,this.namespace=a}return e.prototype.apply=function(){this.sources&&this.applyPaidSources(),this.landingParam&&this.applyLandingPage()},e.prototype.applyPaidSources=function(){var e=Urls.getReferrerKey(Wrappers.documentReferrer(),Wrappers.documentURL());["google_paid","yahoo_paid","bing_paid"].includes(e)&&(this.resetSession(e)&&(this.namespace.referrer_key=e))},e.prototype.applyLandingPage=function(){var e=this.landingPageParam,t=Urls.getReferrerKey(Wrappers.documentReferrer(),Wrappers.documentURL());if(Urls.urlContainsParam(e)&&this.resetSession(t)){var r=Urls.getReferrerKey(this.namespace.referrer,this.namespace.landing);this.namespace.referrer_key=r}},e.prototype.resetSession=function(e){return Session.readCookie("calltrk_override_src")!==e&&(Session.crDeleteOldCookies(),this.namespace.global.deleteReferrer(),this.namespace.global.deleteLanding(),this.namespace.referrer=Wrappers.documentReferrer(),this.namespace.landing=Wrappers.documentURL(),Session.createReferrerAndLandingCookies(this.namespace.referrer,this.namespace.landing,!0),Session.createCookie("calltrk_override_src",e),!0)},e}(),PageMetadata=function(){function e(){this.og={},this.title=Wrappers.documentTitle();var e=document.querySelectorAll("meta[property^=\"og:\"]");this.og=Array.from(e).reduce((function(e,t){var r,a=null===(r=t.getAttribute("property"))||void 0===r?void 0:r.replace("og:",""),n=t.getAttribute("content");return a&&n&&(e[a]=n),e}),{})}return e.prototype.toPayload=function(){return{title:this.title,og:this.og}},e}(),PhoneNumbers=function(){function e(){}return e.defaultNumberFormat=function(e){return"object"==typeof e&&null!==e&&(e=e.national_string),e},e}(),Poll=function(){function e(){}return e.pollSessionURL=function(){var e=CallTrk.firstNamespace();return e.buildURL("poll_session",{multiswap_id:e.multiswap_id,host:e.swap_session_host,uuid:Session.getSessionID(),multiswap_token:e.multiswap_token})},e.pollSession=function(){e.pollUnwatch();var t=CallTrk.firstNamespace(),r={},a=Date.now(),n=.9*t.session_poll_interval;setTimeout(e.pollWatch,t.session_poll_interval),CallTrkSwap.lastPoll&&a-CallTrkSwap.lastPoll0){for(var n="",o=0,i=a;o-1){var o=Replacer.replacementForPlainText(n?t:e[0],n?e:e[1]);Debug.logDoneSwaps(this.target,o),Debug.logTrackerSwapped(null===(r=this.tracker)||void 0===r?void 0:r.id),this.string=this.string.replace(this.target,o)}}else"object"==typeof e&&null!==e?this.string=this.iterateMatches(e,"numberObjectReplace"):"^"===this.target.charAt(0)?this.string=this.iterateMatches(e,"octoReplace"):this.string=Replacer.standardReplace(this.string,this.target,e,null===(a=this.tracker)||void 0===a?void 0:a.id);return this.string},e.scan=function(t,r,a,n,o){return new e(t,r,o).scan(a,n)},e.stringTargets=function(e){return e&&e.match(Replacer.NUM_REGEX)||[]},e.intlStringTargets=function(e){return e&&e.match(Replacer.INTL_NUM_REGEX)||[]},e.prototype.escapeRegExp=function(e){return e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")},e.prototype.findFormat=function(e,t){for(var r in t)if(this.isSameFormat(e,t[r]))return r;return null},e.prototype.isSameFormat=function(e,t){return new RegExp(t.slice(1,-1)).test(e)},e}(),CallTrkSwap=function(){function CallTrkSwap(e){this.callback_scripts={},Object.assign(this,e),window.CallTrk.pushNamespace("namespace_"+this.id,this),this.state=new NamespaceState(this,CallTrkSwap),this.settings=this.state.settings}return Object.defineProperty(CallTrkSwap.prototype,"_perfData",{get:function(){return Performance.networkPerfData()},enumerable:!1,configurable:!0}),CallTrkSwap.log=function(e,t){Wrappers.isDebug()&&(t||(t=e,e="swap"),CallTrkSwap._log.push(e.toString()+": "+t))},CallTrkSwap.prototype.log=function(e){CallTrkSwap.log(this.id,e)},CallTrkSwap.prototype.hasFormsOrChat=function(){return this.chat_or_form_exists},CallTrkSwap.prototype.run=function(){this.referrer=this.getReferrer(),this.landing=this.getLanding(),this.referrer_key=Urls.getReferrerKey(this.referrer,this.landing),Session.createReferrerAndLandingCookies(this.referrer,this.landing),new OverrideSource(this.settings.trump_sources,this.settings.trump_landing_param,this.settings.trump_landing_page_param,this.state).apply(),this.getWidgetScripts(),this.runCallbackScripts()},CallTrkSwap.prototype.runCallbackScripts=function(){for(var _i=0,_a=Object.entries(this.callback_scripts);_i<_a.length;_i++){var _b=_a[_i];_b[0];var script=_b[1];eval(script)}},CallTrkSwap.prototype.exactTargetsIn=function(e,t){for(var r=0;r=0&&t(this.session_exact_targets[r])}},CallTrkSwap.swapCleanup=function(){delete Replacer._numberRegexCache,CallTrk.eachNamespace((function(e){e._storedSwapCache=null}))},CallTrkSwap.mergeStoredSwaps=function(e){var t=e.global;CallTrk.eachNamespace((function(r){t&&r.mergeStoredSwaps(t),e[r.id]&&r.mergeStoredSwaps(e[r.id])}))},CallTrkSwap.mergeUnassignedSwaps=function(e){var t=e.global;CallTrk.eachNamespace((function(r){t&&r.mergeUnassignedSwaps(t),e[r.id]&&r.mergeUnassignedSwaps(e[r.id])}))},CallTrkSwap.prototype.mergeStoredSwaps=function(e){var t=this.getStoredSwaps();for(var r in e)e[r]?t[r]=e[r]:t[r]&&delete t[r];this.assigns(t)},CallTrkSwap.prototype.mergeUnassignedSwaps=function(e){var t=this.getUnassignedSwaps();for(var r in e)if(e[r]){var a=t.indexOf(r);a>-1&&t.splice(a,1)}else-1===t.lastIndexOf(r)&&t.push(r);this.unassigns(t)},CallTrkSwap.prototype.getStoredSwaps=function(){var e=this.assigns();return e||{}},CallTrkSwap.prototype.getUnassignedSwaps=function(){var e=this.unassigns();return e||[]},CallTrkSwap.prototype.unassigns=function(e){return e?CallTrkSwap._unassigns=e:CallTrkSwap._unassigns},CallTrkSwap.prototype.assigns=function(e){var t=this.id+"-assigns-"+Session.getSessionID();return e?Storage.setItem(t,e):Storage.getItem(t)},CallTrkSwap.prototype.swapString=function(e,t){var r=this;return this._storedSwapCache||(this._storedSwapCache=NumberSwap.adjustExactFormat(this.getStoredSwaps())),["advanced","simple"].forEach((function(a){for(var n in r._storedSwapCache[a]){var o=r._storedSwapCache[a][n];e=ScanString.scan(e,n,o,void 0,t)}}),this),e},CallTrkSwap.swapOccured=function(){var e=new Event("callTrkSwapOccured");window.dispatchEvent(e)},CallTrkSwap.startSourceSwap=function(e){e=e||document.body;var t=CallTrkSwap.matchingSourceTrackers(),r=function(e,r){for(var a=e,n=0,o=t;n0},CallTrkSwap.swapEntry=function(){var e=CallTrkSwap;e.startSwaps(),window.Squarespace&&window.Squarespace.onInitialize&&window.Squarespace.onInitialize(window.Y,(function(){e.startSwaps()}))},CallTrkSwap.startSwaps=function(){document.removeEventListener&&document.removeEventListener("visibilitychange",CallTrkSwap.swapEntry,!1),Dom.iframeAwareReady((function(){var e=CallTrkSwap;Debug.doneSwaps={},Debug.foundTargets=[],e.startSourceSwap(),e.checkSessionSwap(!0),e.checkFormsOrChat(),Dom.broadcastReady()}))},CallTrkSwap.prototype.buildURL=function(e,t){var r=this.endpoints[e];for(var a in t)r=r.replace("$"+a,t[a]);return this.force_https&&!r.match(/https:/)&&(r="https:"+r),Session.wpProxy()&&(r=Session.proxyPath(r)),r&&r.indexOf("app.calltrk")&&r.indexOf("form_capture")&&(r=r.replace("app.calltrk","trk.calltrk")),r},CallTrkSwap.prototype.getIntegrationData=function(e){var t=this.data_collection_config.cookies,r=this.data_collection_config.scripts;return IntegrationData.getInstanceIntegrationData(e,t,r)},CallTrkSwap.prototype.icapURL=function(){return this.buildURL("integration_retry",{multiswap_id:this.multiswap_id,multiswap_token:this.multiswap_token,version:"12",host:this.swap_session_host})},CallTrkSwap.prototype.swapSessionURL=function(){return this.buildURL("multiswap_session",{multiswap_id:this.multiswap_id,host:this.swap_session_host,version:"12",multiswap_token:this.multiswap_token})},CallTrkSwap.prototype.getReferrer=function(){if(CallTrkSwap._referrer)return CallTrkSwap._referrer;var e=Session.readCookie("calltrk_referrer");return e||(e=Urls.getCurrentReferrer()),CallTrkSwap._referrer=e,e},CallTrkSwap.prototype.getLanding=function(){if(CallTrkSwap._landing)return CallTrkSwap._landing;var e=Session.readCookie("calltrk_landing");return e||(e=Wrappers.documentURL()),CallTrkSwap._landing=e,e},CallTrkSwap.prototype.getSecondScript=function(e,t,r){if(!this.settings.is_bot){var a={cid:Urls.getURLParameter("cid"),uuid:Session.getSessionID(),ref:this.getCurrentReferrer(),landing:Wrappers.documentURL(),user_agent:navigator.userAgent,record_pageview:t&&!Dom.iframeConflict(this.id),domless:r,swaps:[],all_formats:!0};if(this.settings.page_metadata){var n=new PageMetadata;a.meta=n.toPayload()}Session.isMulti()||(a.ids=Session.namespaceIds());var o=IntegrationData.getIntegrationData();Object.assign(a,o);var i={};for(var s in e){var c=e[s]||"",l=c;"object"==typeof c&&(l=c.national_string),l||(i[s]=null),a.swaps.push(s+"="+l)}Object.keys(i).length&&this.mergeUnassignedSwaps(i),a.perf=Performance.networkPerfData(),Performance.reset();var u=this.swapSessionURL().replace(/\.js$/,".json");Helpers.postScript(u,a,(function(e){CallTrkSwap.parseSessionSwap(e)}))}},CallTrkSwap.parseSessionSwap=function(e){!0===e.domless?CallTrkSwap.swapCallback(e.a):!0===e.number_assignment&&(CallTrkSwap.mergeStoredSwaps(e.a),CallTrkSwap.mergeUnassignedSwaps(e.a),CallTrkSwap.startSessionSwap(e.r)),Dom.makePhoneSwapVisible(),!0===e.integration_retry&&IntegrationData.integrationRetry(e.integration_retries)},CallTrkSwap.prototype.getWidgetScripts=function(){var e=this,t=function(t){e.endpoints[t]&&-1===CallTrk.appendedScripts.indexOf(t)&&(Dom.getScript(e.endpoints[t],{},!0),CallTrk.appendedScripts.push(t))};Polyfills.documentReady((function(){e.endpoints.click_to_contact&&Dom.getScript(e.endpoints.click_to_contact,{},!0),e.endpoints.chat&&Dom.getScript(e.endpoints.chat,{},!0),e.endpoints.contact&&!e.endpoints.chat&&Dom.getScript(e.endpoints.contact,{},!0),e.endpoints.external_chats&&Dom.getScript(e.endpoints.external_chats,{},!0),t("custom_forms"),t("external_forms")}))},CallTrkSwap.firstNamespace=function(){return CallTrk.firstNamespace()},CallTrkSwap.generateUUID=function(){return Session.generateUUID()},CallTrkSwap.getSessionID=function(){for(var e=[],t=0;t