"use strict";(()=>{var wt=Object.defineProperty,Lt=Object.defineProperties;var vt=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var tt=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var $=(e,t,a)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,y=(e,t)=>{for(var a in t||(t={}))tt.call(t,a)&&$(e,a,t[a]);if(P)for(var a of P(t))et.call(t,a)&&$(e,a,t[a]);return e},C=(e,t)=>Lt(e,vt(t));var E=(e,t)=>{var a={};for(var r in e)tt.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(e!=null&&P)for(var r of P(e))t.indexOf(r)<0&&et.call(e,r)&&(a[r]=e[r]);return a};async function Bt(e,t={}){let a=new URL(e,"https://app.navattic.com");for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&a.searchParams.set(o,t[o]);let r;try{r=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json"}})}catch(o){return{error:o.message,success:!1}}let n=await r.json();return r.ok?{data:n,success:!0}:{error:n.error,success:!1}}async function rt(e,t="POST",a){let r=new URL(e,"https://app.navattic.com"),n;try{n=await fetch(r,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(u){return{error:u.message,success:!1}}let o=await n.json();return n.ok?{data:o,success:!0}:{error:o.error,success:!1}}async function L(e){return Bt("/api/visitors/config",{key:e})}async function Ut(e){return rt("/api/visitors/identify","PUT",e)}async function nt(e){return rt("/api/visitors/config/page","PUT",e)}var at=navigator.sendBeacon&&navigator.sendBeacon.bind(navigator);function Vt(e,t){if(at){let a=new URL(e,"https://app.navattic.com"),r=new Blob([t],{type:"application/json"});try{return at(a.toString(),r)}catch{}return!1}else return!1}function ot(e){let t=JSON.stringify(e);return Vt("/api/visitors/identify",t)||Ut(e).then(()=>!0).catch(()=>!1)}var Qt="__NAVATTIC_FLOW__";var ut,st;st=Symbol.species,ut=Symbol.toStringTag;var V=class V{constructor(t){this.storage=new Map;this.keys=[];this[st]=V;this[ut]="Storage";this.defaultView=t}dispatchStorageEvent(t={}){if(!this.defaultView)return;let{key:a=null,oldValue:r=null,newValue:n=null,bubbles:o,cancelable:u,composed:i}=t,s={key:a,oldValue:r,newValue:n,url:this.defaultView.location?.href??null,bubbles:o,cancelable:u,composed:i};this.defaultView.dispatchEvent(new StorageEvent("storage",s))}get length(){return this.storage.size}clear(){this.storage.clear(),this.keys.splice(0,this.keys.length),this.dispatchStorageEvent()}getItem(t){return this.storage.get(t)??null}key(t){return t>=this.keys.length?null:this.keys[t]}removeItem(t){if(!this.storage.has(t))return;let a=this.storage.get(t);this.storage.delete(t);let r=this.keys.indexOf(t);r>-1&&this.keys.splice(r,1),this.dispatchStorageEvent({key:t,oldValue:a})}setItem(t,a){let r=!this.storage.has(t),n=this.getItem(t);this.storage.set(t,a),r&&this.keys.push(t),this.dispatchStorageEvent({key:t,oldValue:n,newValue:a})}},v=V,pt=(a=>(a[a.LOCAL=0]="LOCAL",a[a.SESSION=1]="SESSION",a))(pt||{}),it=(e,t=globalThis.window)=>{if(!t){if(typeof globalThis.window>"u")return;t=globalThis.window}let a=`__nv_proxy_storage_${pt[e]}`,r=t[a];if(r)return r;try{let n=e==1?t.sessionStorage:t.localStorage;if(!n)throw new Error;return t[a]=n,n}catch{let o=new v(t),u=new Proxy(o,{get:(i,s)=>s in i?i[s]:i.getItem(String(s)),has:(i,s)=>s in i||i.getItem(String(s))!==null,set:(i,s,p)=>s in i||typeof p=="object"||typeof p=="function"?!1:(i.setItem(String(s),String(p)),!0)});return t[a]=u,u}},B=e=>({PREFIX:Qt,localStorage:it(0,e),sessionStorage:it(1,e)}),_=ct(globalThis.window);function ct(e){let t=B(e),a=o=>o==="SESSION"?t.sessionStorage:t.localStorage,r=(o,u)=>{let s=a(u).getItem(`${t.PREFIX}${o}`);if(!s)return null;try{return JSON.parse(s)}catch{return s}},n=(o,u,i)=>{a(i).setItem(`${t.PREFIX}${o}`,JSON.stringify(u))};return{localStorage:t.localStorage,sessionStorage:t.sessionStorage,getCompletions:()=>r("__COMPLETIONS__"),setCompletions:o=>n("__COMPLETIONS__",o)}}var b=_.localStorage?_.localStorage:B(globalThis).localStorage,M=_.sessionStorage?_.sessionStorage:B(globalThis).sessionStorage,U={length:0,clear:function(){M.clear(),b.clear()},getItem:function(e){return M.getItem(e)??b.getItem(e)},key:function(e){return M.key(e)??b.key(e)},removeItem:function(e){M.removeItem(e),b.removeItem(e)},setItem:function(e,t){M.setItem(e,t),b.setItem(e,t)}};Object.defineProperty(U,"length",{get:()=>M.length+b.length});function lt(e=["debug:navattic"],t=globalThis.console){let r={enabled:(typeof e=="string"?[e]:e).some(o=>U.getItem(o))};return jt(r,t)}function jt(e,t=globalThis.console){return new Proxy(t,{get:(...r)=>{let[n,o]=r,u=Object.getOwnPropertyDescriptor(n,o);if(u&&!u.configurable){if("value"in u){if(!u.writable)return u.value}else if(u===void 0)return}let i=n[o];return typeof i=="function"?e.enabled?i.bind(n):()=>{}:o in Ot?()=>{}:i}})}var Ot={__proto__:null,assert:!0,clear:!0,count:!0,countReset:!0,debug:!0,dir:!0,dirxml:!0,error:!0,group:!0,groupCollapsed:!0,groupEnd:!0,info:!0,log:!0,table:!0,time:!0,timeEnd:!0,timeLog:!0,timeStamp:!0,trace:!0,warn:!0},St=(n,r=globalThis.console)=>{var o=n,{pre:e,post:t}=o,a=E(o,["pre","post"]);return e||t?new Proxy(r,{get:(...u)=>{let[i,s]=u,p=Object.getOwnPropertyDescriptor(i,s);if(p&&!p.configurable){if("value"in p){if(!p.writable)return p.value}else if(p===void 0)return}let c=i[s];return typeof c=="function"?s==="time"||s==="timeEnd"||s==="timeLog"||s==="timeStamp"?(S,...d)=>{c.apply(i,[[e||[],S||[]].flat().join(" "),...d,...t?[t].flat():[]])}:(...S)=>{c.apply(i,[...e?[e].flat():[],...S,...t?[t].flat():[]])}:c}}):new Proxy(r,{get:(...u)=>{let[i,s]=u,p=Object.getOwnPropertyDescriptor(i,s);if(p&&!p.configurable){if("value"in p){if(!p.writable)return p.value}else if(p===void 0)return}let c=i[s];if(typeof c=="function"){if(!a[s])return c.bind(i);let{pre:S,post:d}=a[s];return s==="time"||s==="timeEnd"||s==="timeLog"||s==="timeStamp"?(F,...Rt)=>{c.apply(i,[[S||[],F||[]].flat().join(" "),...Rt,...d?[d].flat():[]])}:(...F)=>{c.apply(i,[...S?[S].flat():[],...F,...d?[d].flat():[]])}}return c}})};var Wt="[navattic]",Ht="debug:navattic:sdk",I=St({pre:Wt}),g=lt(Ht,I);var N=(e,t)=>{for(let a of t){let r=e[a.function];typeof r=="function"?r.call(e,...a.arguments):console.warn("Navattic tracking function not found: "+a.function)}};var Gt="nv_date_format";var he=`[${Gt}]`;var yt="navattic-embed";var Q="_mkto_trk",j="hubspotutk";var h="nv_uid";var O=(e,t,a={})=>{let{timeout:r=100,retries:n=10}=a;return new Promise((o,u)=>{let i=0,s=()=>{typeof t=="function"&&t(),o()},p=async()=>{if(i>=n){o();return}i++;try{await e()?s():setTimeout(p,r)}catch{setTimeout(p,r)}};p()})};var f={NAVATTIC_READY:"navattic:ready",NAVATTIC_EVENT:"navattic:event",IFRAME_FORM_SUBMISSION:"navattic:iframe-form-submission"};var W="hs-form-event:on-submission:success",gt=(e,t,a)=>{let{data:r}=e;if(!r)return;let{type:n,eventName:o}=r;if(n!=="hsFormCallback"||o!=="onFormSubmitted")return;let u=r.data.submissionValues;try{let i=Object.keys(u).map(s=>({name:s,value:u[s]}));t(i)}catch(i){t([]),a(i)}},dt=async(e,t,a,r)=>{try{let n=t.getFormFromEvent(e);if(!n)return;let u=(await n.getFormFieldValues()).map(({name:i,value:s})=>({name:Kt(i),value:s}));a(u)}catch(n){a([]),r(n)}},Kt=e=>e.includes("/")?e.split("/")[1]:e;var H=(e,t)=>{let a=t||document;a.readyState==="complete"||a.readyState==="interactive"?setTimeout(e,0):a.addEventListener("DOMContentLoaded",e)};function G(e){let t={},a=(r,n)=>{for(let o in r){let u=r[o],i=n?n+"__"+o:o;u&&typeof u=="object"?a(u,i):t[i]=u}};return a(e,""),t}function It(e){return Object.entries(G(e)).filter(([t,a])=>a!=null).reduce((t,[a,r])=>C(y({},t),{[a]:r}),{})}function mt(e){try{let t=new URL(e);return t.search="",t.toString().slice(0,191)}catch{return""}}var bt=(e,t)=>(...a)=>t(e,...a);function Mt(e){let t=/event\s*:\s*(["'])([^"']*)\1/,a=e.match(t);return a?a[2]:null}var A,K=["captcha","card","cc","ccn","credit","cvv","password","payable","pin","pw","receivable","routing","secret","security","ssn","token","account"],Ct=["email","name","phone","phoneNumber","firstName","lastName","fullName","title","username","website","domain","company"],At=Ct.map(e=>e.toLowerCase()),Yt=["password","hidden","submit"];function qt(e){let t=e instanceof HTMLFormElement,a=e.tagName;if(!(t||a==="FORM"))return{success:!1,error:"Invalid form"};let n=zt(e),o=$t(n),u=Y(n);return{success:!0,data:o,identificationFields:u}}function ht(e){A&&A();let t=async o=>{let u=qt(o);if(!u.success)return;let{data:i,identificationFields:s}=u,p={path:window.location.pathname,referrer:document.referrer,title:document.title,url:window.location.href,host:window.location.host};try{await e({context:{page:p},name:o.getAttribute("name")||o.id,method:o.method,action:o.action,formData:i,identificationFields:s})}catch{}},a=async o=>{try{let u=o.target;if(typeof u.requestSubmit=="function"){o.preventDefault(),o.stopPropagation(),await t(u);let i=u.querySelector("button[type=submit]"),s=o.currentTarget;setTimeout(()=>{i?u.requestSubmit(i):u.requestSubmit(),s?.addEventListener("submit",a,{capture:!0,once:!0})},0)}else await t(u),o.currentTarget?.addEventListener("submit",a,{capture:!0,once:!0})}catch{}};document.addEventListener("submit",a,{capture:!0,once:!0});let r=async o=>{let u={path:window.location.pathname,referrer:document.referrer,title:document.title,url:window.location.href,host:window.location.host};gt(o,async i=>{let s=i.reduce((c,{name:S,value:d})=>(c[S]={value:d,id:"",label:"",name:S,type:"text",tagName:"INPUT"},c),{}),p=Y(s);try{await e({context:{page:u},name:"Hubspot form",method:"POST",action:"https://hsforms.com",formData:s,identificationFields:p})}catch{}},i=>{console.error("Navattic: Error handling legacy Hubspot form submission",i)})};window.addEventListener("message",r);let n=async o=>{let u={path:window.location.pathname,referrer:document.referrer,title:document.title,url:window.location.href,host:window.location.host};dt(o,window.HubspotFormsV4,async i=>{let s=i.reduce((c,{name:S,value:d})=>(c[S]={value:d,id:"",label:"",name:S,type:"text",tagName:"INPUT"},c),{}),p=Y(s);try{await e({context:{page:u},name:"Hubspot form",method:"POST",action:"https://hsforms.com",formData:s,identificationFields:p})}catch{}},i=>{console.error("Navattic: Error handling new Hubspot form submission",i)})};return window.addEventListener(W,n),setTimeout(()=>{document.querySelectorAll("iframe").forEach(u=>{let i=u.contentDocument;i&&H(()=>{i.addEventListener("submit",a,{capture:!0,once:!0})},i)})},3e3),A=()=>{document.removeEventListener("submit",a,{capture:!0}),window.removeEventListener("message",r),window.removeEventListener(W,n),document.querySelectorAll("iframe").forEach(u=>{let i=u.contentDocument;i&&H(()=>{i.removeEventListener("submit",a,{capture:!0})},i)})},A}function zt(e){let t={},a=Array.from(e.elements);for(let r of a){if(!r.value||!["INPUT","SELECT","TEXTAREA"].includes(r.tagName)||["checkbox","radio"].includes(r.type)&&!r.checked||Yt.includes(r.type)||r.name&&K.some(i=>r.name.toLowerCase().includes(i))||r.id&&K.some(i=>r.id.toLowerCase().includes(i)))continue;let n=Zt(r,a);if(n&&K.some(i=>n.toLowerCase().includes(i)))continue;let o=r.id||Xt(r,a.indexOf(r)),u=[r.name,n,o].filter(Boolean);for(let i of u)if(!t[i]){t[i]={id:o,label:n,name:r.name,type:r.type,tagName:r.tagName,value:r.value};break}}return t}function Zt(e,t){let a;if(e.labels&&e.labels.length){let[r,...n]=Array.from(e.labels);a=x(r)}if(!a){let r=[e.previousElementSibling,e.nextElementSibling].filter(n=>n?.tagName==="LABEL"&&x(n));r.length&&(a=x(r[0]))}if(!a){let r=Jt(e,n=>{let o=n.querySelectorAll("label").length>0,u=t.every(i=>i===e||!n.contains(i));return o&&u});r&&r.tagName!=="FORM"&&(a=x(r.querySelector("label")))}return a?.replace(" ","")||""}function x(e){return e?.innerText?.trim()||e?.textContent?.trim()}function Jt(e,t){let a=e;for(;a&&!(t(a)||(a=a.parentElement,!a||a.tagName==="FORM")););return a}function Xt(e,t){let a=e.tagName.toLowerCase(),r=e.type,n=e.id?`#${e.id}`:"",o=e.className?`.${e.className}`:"";return`${a}_${t}_${[r,n,o].filter(Boolean).join("_")}`}function $t(e){let t={};for(let[a,r]of Object.entries(e))t[a]=r.value;return t}function Y(e){let t={},a=ee(e),r=a.length===1;for(let[n,o]of Object.entries(e)){if(r&&a[0]===n){t.email=o.value;continue}let i=[o.name,o.label,o.id].filter(Boolean).map(p=>p?.toLowerCase()).find(p=>p&&At.includes(p)&&!t[p]);if(!i)continue;let s=Ct[At.indexOf(i)];s!=="email"&&o.value&&(t[s]=o.value)}return t.email||t.firstName&&t.lastName?t:{}}function te(e){let t=document.createElement("input");return t.type="email",t.required=!0,t.value=String(e),t.checkValidity()}function ee(e){return Object.entries(e).filter(([t,a])=>a.type==="email"||a.name?.toLowerCase()?.includes("email")||a.label?.toLowerCase()?.includes("email")||a.id?.toLowerCase()?.includes("email")?te(a.value):!1).map(([t])=>t)}function kt(){A&&A()}function ae(e){return e.src.includes("navattic.com")||e.src.includes("capture.localhost")||e.id===yt||e.hasAttribute("data-navattic-demo-id")}function q(){let e=[...document.querySelectorAll("iframe")].filter(ae),t=[];for(let a of document.querySelectorAll("navattic-lightbox")){let r=a.shadowRoot;if(r){let n=r.querySelector("iframe");n&&t.push(n)}}return[...e,...t]}function Tt(e,t){e.contentWindow?.postMessage({kind:t.kind,attributes:t.attributes,properties:t.properties},"*")}var k=(a=>(a[a.Auto="SCRIPT_AUTO"]="Auto",a[a.Manual="SCRIPT_MANUAL"]="Manual",a))(k||{});function Ft(e,t,a){return{name:e.replace("company.","").replace("user.",""),object:e.startsWith("company")?"COMPANY_ACCOUNT":"END_USER",source:"IDENTIFY",value:t,captureMethod:a}}function D(e){for(var t=1;t"u")){u=D({},t,u),typeof u.expires=="number"&&(u.expires=new Date(Date.now()+u.expires*864e5)),u.expires&&(u.expires=u.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in u)u[s]&&(i+="; "+s,u[s]!==!0&&(i+="="+u[s].split(";")[0]));return document.cookie=n+"="+e.write(o,n)+i}}function r(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var o=document.cookie?document.cookie.split("; "):[],u={},i=0;i2?t.slice(-2).join("."):e}var se={cookie:{sameSite:"lax"}},w=class{id(t=se){let a=this.getId();if(a)return Et(a,t),a;let r=this.new();return this.setId(r,t),r}hasId(){return!!this.getId()}getId(){return T.get(h)}setId(t,a){Et(t,a)}new(){return X()}clear(){T.remove(h)}},Et=(e,t)=>{let a={expires:365,domain:ue(),path:"/"};t.cookie.sameSite==="lax"?T.set(h,e,a):T.set(h,e,C(y({},a),{sameSite:"none",secure:!0}))};var _t={saveMethod:"demo"},pe={autoFormSubmissionTracking:!0,crmCookieTracking:!1,domainCookieTracking:!1,trackQueryParams:!1,trackSegment:!1,trackRudderstack:!1,pushToGA4:!1},m=class{constructor(t,a=null){this.queue=new Set;this.frameIsReady=!1;this.ga4EventNamesRegistered=new Set;this.version="0550392717278c822715b029a69ff1d99bac67fe";this.previousCookieValues=new Map;this.locationSearch="";this.collectForms=()=>{let a=[window.location.hostname,"hsforms.com","mktoweb.com"];ht(async r=>{g.info("Form submission detected",r);let n=!r.action;if(r.action){let u=new URL(r.action);n=a.some(i=>u.hostname.endsWith(i))}if(n){let o=r.identificationFields,{email:u}=o,i=E(o,["email"]),s=this.visitorStore.email?y({},i):y({email:u},i);this.identifyAuto(s)}})};this.stopTracking=()=>{kt()};this.identify=async(t,a=_t)=>{this.saveTraits(t,a,k.Manual)};this.identifyAuto=async t=>{let a=!this.frameIsReady&&this.config.domainCookieTracking?"api":"demo";this.saveTraits(t,{saveMethod:a},k.Auto)};this.saveTraits=async(t,a=_t,r=k.Manual)=>{let n=It(t),o=Object.entries(n).map(([u,i])=>Ft(u,i,r));if(a.saveMethod==="api")try{this.sendIdentifyEventApi(o,a)}catch(u){g.error("Failed to send identify event via API",u),this.sendEventThroughDemo({kind:"navattic:identify",attributes:n,properties:o})}else this.sendEventThroughDemo({kind:"navattic:identify",attributes:n,properties:o})};this.identifyAnonymous=async t=>{this.sendEventThroughDemo({kind:"navattic:identifyAnonymousUser",attributes:{id:t}})};this.sendEventThroughDemo=t=>{if(this.frameIsReady){let a=q();if(a.length===0){this.queue.add(t);return}for(let r of a)this.sendEvents(r,[t])}else this.queue.add(t)};this.sendIdentifyEventApi=async(t,a)=>{if(this.key===null)throw new Error("No key provided for identify event. Can't send identify event");let r=a&&a.cookieSameSite?{cookie:{sameSite:a.cookieSameSite}}:void 0,n=this.user.id(r);if(!n)throw new Error("No user id found. Cannot send identify event");let o={uid:n,key:this.key,properties:t};ot(o)?g.info("Identify event sent successfully"):console.error("Failed to send identify event")};this.sendEvents=(t,a)=>{for(let r of a)Tt(t,r)};this.flushQueue=()=>{let t=q();if(t.length===0)return;let a=Array.from(this.queue);this.queue.clear();for(let r of t)this.sendEvents(r,a)};this.trackCRMCookies=()=>{((a,r)=>{setInterval(()=>{let n=Object.fromEntries(document.cookie.split(";").map(u=>u.trim()).map(u=>u.split("="))),o=Object.fromEntries(Object.entries(n).filter(([u,i])=>this.previousCookieValues.get(u)!==i&&a.includes(u)?(this.previousCookieValues.set(u,i),!0):!1));Object.keys(o).length>0&&r({changes:o,cookies:n})},1e3)})([j,Q],({changes:a})=>{let r=a[Q],n=a[j];this.saveTraits({marketoCookie:r,hubspotCookie:n},{saveMethod:"demo"})})};this.trackQueryParams=()=>{(a=>{setInterval(()=>{let r=window.location.search;this.locationSearch!==r&&(this.locationSearch=r,a(r))},1e3)})(a=>{let r=new URLSearchParams(a);r.size>0&&this.saveTraits(Object.fromEntries(r),{saveMethod:"demo"})})};this.onEvent=t=>{let a=t.toString(),r=Mt(a);if(r)if(this.ga4EventNamesRegistered.has(r)){g.info(`Callback already registered to the event ${r}. Skipping.`);return}else this.ga4EventNamesRegistered.add(r);else g.info(`Callback ${a} does not contain an event name. Skipping.`);let n=o=>{o.data.kind==="navattic:event"&&t(o.data)};window.addEventListener("message",n)};this.attachSegment=()=>{let t=()=>typeof window.analytics<"u"&&typeof window.analytics.ready=="function";O(t,()=>{t()&&window.analytics.ready(()=>{let r=window.analytics,n=r.user().traits();this.identifyAuto(n),r.on("invoke",()=>{let o=r.user().traits();this.identifyAuto(o)}),r.on("identify",(o,u)=>{this.identifyAuto(u)}),r.on("reset",()=>{this.reset()})})},{timeout:1e3,retries:10})};this.attachRudderstack=()=>{let t=()=>typeof window.rudderanalytics<"u"&&typeof window.rudderanalytics.ready=="function";O(t,()=>{t()&&window.rudderanalytics.ready(()=>{let r=window.rudderanalytics,n=r.getUserTraits();this.identifyAuto(n),r.identify=bt(r.identify,(o,...u)=>{let i=u[1]||{};return typeof i=="object"&&Object.keys(i).length>0&&this.identifyAuto(i),o(...u)})})},{timeout:1e3,retries:10})};this.attachGA4=()=>{let t="navattic_event",a=r=>{if(window.dataLayer){let n=this.flatten(r);window.dataLayer.push({event:t,data:n}),g.debug("Pushed event to GA4",n)}else{g.debug("Skipped pushing event to GA4: no dataLayer");return}};window.dataLayer?(this.onEvent(a),this.ga4EventNamesRegistered.add(t),g.info("Automatic GA4 event listener: added")):g.info("Automatic GA4 event listener: skipped")};this.reset=()=>{this.user.clear()};this.flatten=t=>G(t);this.forceFrameReady=()=>{this.frameIsReady=!0};this.visitorStore={},this.user=new w,this.key=a,this.config=t,document.readyState!=="loading"?(g.info("Document already loaded. Attaching event listeners."),this.initHandlers()):(g.info("Document loading. Attaching event listeners for when loaded."),document.addEventListener("DOMContentLoaded",this.initHandlers.bind(this)))}initHandlers(){this.config.autoFormSubmissionTracking&&this.collectForms(),this.config.crmCookieTracking&&this.trackCRMCookies(),this.config.trackQueryParams&&this.trackQueryParams(),this.config.trackSegment&&this.attachSegment(),this.config.trackRudderstack&&this.attachRudderstack(),this.config.pushToGA4&&this.attachGA4();let t=r=>{(r.data.kind===f.NAVATTIC_READY||!this.frameIsReady&&r.data.kind===f.NAVATTIC_EVENT)&&(this.config.domainCookieTracking&&this.identifyAnonymous(this.user.id()),g.info(`Navattic frame is ready (via ${r.data.kind})`),this.frameIsReady=!0,this.flushQueue())};window.addEventListener("message",t);let a=r=>{if(r.data.kind===f.IFRAME_FORM_SUBMISSION){g.debug("iframe form submission detected",r.data);let{fields:n}=r.data;if(Object.keys(n).length===0)return;this.identifyAuto(n)}};window.addEventListener("message",a)}get isLegacy(){return this.key===null}};if(document.currentScript?.hasAttribute("data-init")&&!window.navatticTracking){let e=y(y({},pe),window.navatticTrackingConfig);window.navatticTracking=new m(e)}async function ft(e){if(!e)throw new Error("No key found. SDK can not be initialized");if(window.navatticTracking!==void 0)return ce(e);if(window.navattic instanceof m)if(window.navattic.isLegacy)I.warn("An old version of Navattic JS was found. Overwriting with new version."),window.navattic=void 0;else{I.warn("Navattic JS already installed. Skipping installation.");return}let a=await L(e);if(!a.success){I.error("Error fetching SDK config",a.error);return}let r=a.data.config,n=window.navatticTrackingConfig??{},o=y(y({},r),n);window.navattic=new m(o,e),window.navatticQueue===void 0?I.warn("SDK not set up correctly. Missing