!function(){"use strict";class e{constructor(e){this.queue=[],this.flushTimer=null,this.options=e,this.startFlushTimer(),"undefined"!=typeof window&&(window.addEventListener("pagehide",()=>this.flush()),window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()}))}push(e){this.queue.push(e),this.log("Event queued:",e.type,e.name),this.queue.length>=this.options.batchSize&&this.flush()}async flush(){if(0===this.queue.length)return;const e=[...this.queue];this.queue=[],this.log("Flushing",e.length,"events");try{await this.options.onFlush(e),this.log("Flush successful")}catch(t){this.queue=[...e,...this.queue],this.log("Flush failed, re-queued events:",t)}}startFlushTimer(){this.flushTimer&&clearInterval(this.flushTimer),this.flushTimer=setInterval(()=>{this.flush()},this.options.flushInterval)}destroy(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}log(...e){this.options.debug&&console.log("[Apollo]",...e)}}class t{constructor(e){this.options=e}sendBeacon(e){const t=this.options.endpoint,n=JSON.stringify(e);if(navigator.sendBeacon)return navigator.sendBeacon(t,n);try{const e=new XMLHttpRequest;return e.open("POST",t,!1),e.setRequestHeader("Content-Type","application/json"),e.send(n),e.status>=200&&e.status<300}catch{return!1}}async sendBatch(e){if(0===e.length)return;if(1===e.length&&"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon)return void(this.sendBeacon(e[0])||await this.fetchPost(this.options.endpoint,e[0]));const t=this.options.endpoint.replace("/collect","/collect/batch");await this.fetchPost(t,{events:e})}async identify(e){const t=this.options.endpoint.replace("/collect","/identify");await this.fetchPost(t,e)}async alias(e){const t=this.options.endpoint.replace("/collect","/alias");await this.fetchPost(t,e)}async session(e){const t=this.options.endpoint.replace("/collect","/session");await this.fetchPost(t,e)}async fetchPost(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0});if(!n.ok)throw new Error(`Transport error: ${n.status}`)}}const n="identifiers",o="_apollo_";class i{constructor(e={}){this.dbPromise=null,this.options=e}async set(e,t){const n=[];n.push(this.setCookie(e,t,365)),n.push(this.setLocalStorage(e,t)),n.push(this.setIndexedDB(e,t));const o=await Promise.allSettled(n);if(this.options.debug){const e=o.filter(e=>"fulfilled"===e.status).length;console.log(`[Apollo:Storage] Wrote to ${e}/3 storage mechanisms`)}}async get(e){const t=this.getCookie(e);if(t)return this.syncToBackups(e,t),{value:t,source:"cookie"};const n=this.getLocalStorage(e);if(n)return this.log(`Recovered ${e} from localStorage`),await this.set(e,n),{value:n,source:"localStorage"};const o=await this.getIndexedDB(e);return o?(this.log(`Recovered ${e} from IndexedDB`),await this.set(e,o),{value:o,source:"indexedDB"}):{value:null,source:null}}async delete(e){const t=[];t.push(this.deleteCookie(e)),t.push(this.deleteLocalStorage(e)),t.push(this.deleteIndexedDB(e)),await Promise.allSettled(t)}setCookie(e,t,n){return Promise.resolve().then(()=>{try{const i=new Date(Date.now()+24*n*60*60*1e3).toUTCString();let a=`${o}${e}=${encodeURIComponent(t)}`;a+=`; expires=${i}`,a+="; path=/",a+="; secure",a+="; samesite=Lax",this.options.domain&&(a+=`; domain=${this.options.domain}`),document.cookie=a}catch(e){this.log("Cookie write failed:",e)}})}getCookie(e){try{const t=`${o}${e}=`,n=document.cookie.split(";");for(const e of n){const n=e.trim();if(n.startsWith(t))return decodeURIComponent(n.substring(t.length))}}catch(e){}return null}deleteCookie(e){return this.setCookie(e,"",-1)}setLocalStorage(e,t){return Promise.resolve().then(()=>{try{localStorage.setItem(`${o}${e}`,JSON.stringify({value:t,timestamp:Date.now()}))}catch(e){this.log("localStorage write failed:",e)}})}getLocalStorage(e){try{const t=localStorage.getItem(`${o}${e}`);if(t)return JSON.parse(t).value}catch(e){}return null}deleteLocalStorage(e){return Promise.resolve().then(()=>{try{localStorage.removeItem(`${o}${e}`)}catch(e){}})}async getDB(){return this.dbPromise||(this.dbPromise=new Promise((e,t)=>{try{const o=indexedDB.open("apollo_storage",1);o.onerror=()=>{this.dbPromise=null,t(o.error)},o.onsuccess=()=>{e(o.result)},o.onupgradeneeded=e=>{const t=e.target.result;t.objectStoreNames.contains(n)||t.createObjectStore(n,{keyPath:"key"})}}catch(e){this.dbPromise=null,t(e)}})),this.dbPromise}async setIndexedDB(e,t){try{const o=await this.getDB();return new Promise((i,a)=>{const r=o.transaction(n,"readwrite");r.objectStore(n).put({key:e,value:t,timestamp:Date.now()}),r.oncomplete=()=>i(),r.onerror=()=>a(r.error)})}catch(e){this.log("IndexedDB write failed:",e)}}async getIndexedDB(e){try{const t=await this.getDB();return new Promise(o=>{const i=t.transaction(n,"readonly").objectStore(n).get(e);i.onsuccess=()=>o(i.result?.value??null),i.onerror=()=>o(null)})}catch(e){return null}}async deleteIndexedDB(e){try{const t=await this.getDB();return new Promise(o=>{const i=t.transaction(n,"readwrite");i.objectStore(n).delete(e),i.oncomplete=()=>o(),i.onerror=()=>o()})}catch(e){}}syncToBackups(e,t){this.setLocalStorage(e,t),this.setIndexedDB(e,t)}log(...e){this.options.debug&&console.log("[Apollo:Storage]",...e)}}const a="did",r="tmp_";class s{constructor(e){this.cachedDeviceId=null,this.fingerprintLoaded=!1,this.fingerprintPromise=null,this.onAlias=null,this.preconnectInjected=!1,this.options=e,this.ingestUrl=e.ingestUrl||"https://data.meingpt.com",this.storage=new i({domain:e.cookieDomain,debug:e.debug}),this.injectPreconnect(),e.eager||this.scheduleFingerprintLoad()}setAliasCallback(e){this.onAlias=e}async getDeviceId(){if(this.cachedDeviceId)return this.cachedDeviceId;const e=await this.storage.get(a);if(e.value)return this.cachedDeviceId=e.value,"cookie"!==e.source&&this.log(`Device ID recovered from ${e.source}:`,e.value),this.isTemporaryId(e.value)&&!this.fingerprintLoaded&&this.upgradeToFingerprint(e.value),e.value;const t=this.generateTemporaryId();return this.cachedDeviceId=t,await this.storage.set(a,t),this.log("Generated temporary device ID:",t),this.fingerprintPromise||this.options.eager||this.loadFingerprintNow(),t}async getFingerprintId(){return this.cachedDeviceId&&!this.isTemporaryId(this.cachedDeviceId)?this.cachedDeviceId:this.fingerprintPromise?this.fingerprintPromise:this.loadFingerprintNow()}isReady(){return this.fingerprintLoaded&&!this.isTemporaryId(this.cachedDeviceId||"")}async refresh(){return this.cachedDeviceId=null,this.fingerprintLoaded=!1,this.fingerprintPromise=null,await this.storage.delete(a),this.loadFingerprintNow()}injectPreconnect(){this.preconnectInjected||"undefined"==typeof document||(this.preconnectInjected=!0,[{rel:"preconnect",href:this.ingestUrl},{rel:"dns-prefetch",href:this.ingestUrl}].forEach(({rel:e,href:t})=>{const n=document.createElement("link");n.rel=e,n.href=t,n.crossOrigin="anonymous",document.head.appendChild(n)}),this.log("Injected preconnect hints for",this.ingestUrl))}scheduleFingerprintLoad(){const e=this.options.loadDelay??0,t=()=>{!this.cachedDeviceId||this.isTemporaryId(this.cachedDeviceId)?this.loadFingerprintNow():this.log("Already have real device ID, skipping fingerprint load")};e>0?setTimeout(t,e):"undefined"!=typeof globalThis&&"requestIdleCallback"in globalThis?globalThis.requestIdleCallback(t,{timeout:5e3}):"complete"===document.readyState?setTimeout(t,100):globalThis.addEventListener("load",()=>setTimeout(t,100),{once:!0})}loadFingerprintNow(){return this.fingerprintPromise||(this.fingerprintPromise=this.loadAndIdentify()),this.fingerprintPromise}async loadAndIdentify(){const e=this.cachedDeviceId;try{const t=await this.loadFingerprintScript(),n=await t.load({apiKey:this.options.apiKey,scriptUrlPattern:[`${this.ingestUrl}/fp-agent?apiKey=&version=&loaderVersion=`],endpoint:[`${this.ingestUrl}/fp-result`]}),o=(await n.get()).visitorId;return this.fingerprintLoaded=!0,this.log("FingerprintJS loaded, visitor ID:",o),e&&this.isTemporaryId(e)&&e!==o?await this.upgradeDeviceId(e,o):e&&!this.isTemporaryId(e)||(this.cachedDeviceId=o,await this.storage.set(a,o)),o}catch(e){return this.log("FingerprintJS load failed:",e),this.fingerprintLoaded=!0,this.cachedDeviceId||this.generateTemporaryId()}}async loadFingerprintScript(){if(!this.options.apiKey)throw new Error("FingerprintJS API key not provided");if(window.FingerprintJS)return window.FingerprintJS;const e=`${this.ingestUrl}/fp-agent?apiKey=${this.options.apiKey}`;return new Promise((t,n)=>{const o=document.createElement("script");o.src=e,o.async=!0,o.defer=!0,o.onload=()=>{window.FingerprintJS?t(window.FingerprintJS):n(new Error("FingerprintJS not available after script load"))},o.onerror=()=>n(new Error("Failed to load script")),document.head.appendChild(o)})}async upgradeDeviceId(e,t){if(this.log(`Upgrading device ID: ${e} → ${t}`),this.cachedDeviceId=t,await this.storage.set(a,t),this.onAlias)try{await this.onAlias(e,t),this.log("Alias event sent")}catch(e){this.log("Failed to send alias event:",e)}}upgradeToFingerprint(e){this.loadFingerprintNow().catch(()=>{})}generateTemporaryId(){const e=new Uint8Array(16);return crypto.getRandomValues(e),r+Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}isTemporaryId(e){return e.startsWith(r)}log(...e){this.options.debug&&console.log("[Apollo:Fingerprint]",...e)}}const c={path:"/",secure:!0,sameSite:"Lax"};function l(e,t,n,o={}){const i={...c,...o},a=new Date;a.setTime(a.getTime()+24*n*60*60*1e3);let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r+=`; expires=${a.toUTCString()}`,r+=`; path=${i.path}`,i.domain&&(r+=`; domain=${i.domain}`),i.secure&&(r+="; secure"),i.sameSite&&(r+=`; samesite=${i.sameSite}`),document.cookie=r}function u(e){const t=encodeURIComponent(e)+"=",n=document.cookie.split(";");for(const e of n){let n=e.trim();if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length))}return null}function d(e){const t=u("_apollo_sid");if(t)return t;const n="sess_"+Math.random().toString(36).substring(2,15)+Date.now().toString(36);let o=`_apollo_sid=${encodeURIComponent(n)}; path=/`;return e&&(o+=`; domain=${e}`),o+="; secure; samesite=Lax",document.cookie=o,n}function p(e){const t=new URLSearchParams(window.location.search),n=t.get("utm_source"),o=t.get("utm_medium"),i=t.get("utm_campaign"),a={domain:e};n&&!u("_apollo_src")&&l("_apollo_src",n,365,a),o&&!u("_apollo_med")&&l("_apollo_med",o,365,a),i&&!u("_apollo_cmp")&&l("_apollo_cmp",i,365,a)}const g={clicks:!0,scrollDepth:!0,navigation:!0,outboundLinks:!0};function m(apollo,e={}){const t={...g,...e},n=[];return t.clicks&&n.push(function(apollo,e){const t=t=>{const n=t.target?.closest("[data-apollo]");if(!n)return;const o=n.getAttribute("data-apollo")||"click",i=n.tagName.toLowerCase(),a=n.textContent?.trim().slice(0,100),r=n.getAttribute("href");apollo.track(o,{element:i,text:a,href:r}),e&&console.log("[Apollo:AutoCapture] Click:",o)};return document.addEventListener("click",t,{capture:!0}),()=>document.removeEventListener("click",t,{capture:!0})}(apollo,t.debug)),t.scrollDepth&&n.push(function(apollo,e){const t=[25,50,75,90];let n=0;let o=!1;const i=()=>{o||(window.requestAnimationFrame(()=>{(()=>{const o=document.documentElement.scrollHeight-window.innerHeight;if(o<=0)return;const i=Math.round(window.scrollY/o*100);for(const o of t)i>=o&&nwindow.removeEventListener("scroll",i)}(apollo,t.debug)),t.navigation&&n.push(function(apollo,e){let t=location.pathname;const n=history.pushState;history.pushState=function(...o){n.apply(this,o),location.pathname!==t&&(t=location.pathname,apollo.page({path:t}),e&&console.log("[Apollo:AutoCapture] Navigation:",t))};const o=history.replaceState;history.replaceState=function(...n){o.apply(this,n),location.pathname!==t&&(t=location.pathname,apollo.page({path:t}),e&&console.log("[Apollo:AutoCapture] Navigation:",t))};const i=()=>{location.pathname!==t&&(t=location.pathname,apollo.page({path:t}),e&&console.log("[Apollo:AutoCapture] Popstate:",t))};return window.addEventListener("popstate",i),()=>{history.pushState=n,history.replaceState=o,window.removeEventListener("popstate",i)}}(apollo,t.debug)),t.outboundLinks&&n.push(function(apollo,e){const t=location.hostname,n=n=>{const o=n.target?.closest("a");if(!o)return;const i=o.getAttribute("href");if(i)try{const n=new URL(i,location.origin);if(n.hostname===t||!n.hostname||"javascript:"===n.protocol)return;const a=o.textContent?.trim().slice(0,100);apollo.track("outbound_link",{url:n.href,hostname:n.hostname,text:a,path:location.pathname}),e&&console.log("[Apollo:AutoCapture] Outbound link:",n.hostname)}catch{}};return document.addEventListener("click",n,{capture:!0}),()=>document.removeEventListener("click",n,{capture:!0})}(apollo,t.debug)),()=>{n.forEach(e=>e())}}const h={"meingpt.com":[{pattern:/^\/demo\/?$/,contentType:"conversion",pageIntent:"demo_request"},{pattern:/^\/contact\/?$/,contentType:"conversion",pageIntent:"contact"},{pattern:/^\/pilot-program\/?$/,contentType:"conversion",pageIntent:"pilot_request"},{pattern:/^\/pricing\/?$/,contentType:"pricing",pageIntent:"pricing_evaluation"},{pattern:/^\/prices-and-services\/?$/,contentType:"pricing",pageIntent:"pricing_evaluation"},{pattern:/^\/ai-assistants\/?$/,contentType:"product",contentCategory:"assistants"},{pattern:/^\/ai-workflows\/?$/,contentType:"product",contentCategory:"workflows"},{pattern:/^\/ai-tools\/?$/,contentType:"product",contentCategory:"tools"},{pattern:/^\/ai-content-hub\/?$/,contentType:"hub",persona:"content_creator"},{pattern:/^\/ai-sales-hub\/?$/,contentType:"hub",persona:"sales"},{pattern:/^\/ai-developer-hub\/?$/,contentType:"hub",persona:"developer"},{pattern:/^\/blog\/([^/]+)\/?$/,contentType:"blog",extractSlug:!0},{pattern:/^\/blog\/?$/,contentType:"blog_index"},{pattern:/^\/case-studies\/([^/]+)\/?$/,contentType:"case_study",extractSlug:!0},{pattern:/^\/case-studies\/?$/,contentType:"case_study_index"},{pattern:/^\/integrations\/([^/]+)\/?$/,contentType:"integration",extractSlug:!0},{pattern:/^\/integrations\/?$/,contentType:"integration_index"},{pattern:/^\/resources\/?$/,contentType:"resources"},{pattern:/^\/ai-academy\/?$/,contentType:"education",contentCategory:"academy"},{pattern:/^\/security\/?$/,contentType:"trust",contentCategory:"security"},{pattern:/^\/customers\/?$/,contentType:"trust",contentCategory:"social_proof"},{pattern:/^\/partners\/?$/,contentType:"company",pageIntent:"partnership"},{pattern:/^\/career\/?$/,contentType:"company",pageIntent:"career"},{pattern:/^\/events\/([^/]+)\/?$/,contentType:"event",extractSlug:!0},{pattern:/^\/events\/?$/,contentType:"event_index"},{pattern:/^\/booking-confirmed\/?$/,contentType:"confirmation",contentCategory:"booking"},{pattern:/^\/submission-successful\/?$/,contentType:"confirmation",contentCategory:"form"},{pattern:/^\/terms-and-conditions\/?$/,contentType:"legal",contentCategory:"terms"}],"docs.meingpt.com":[{pattern:/^\/api/,contentType:"docs",contentCategory:"api",persona:"developer"},{pattern:/^\/entwickler/,contentType:"docs",contentCategory:"api",persona:"developer"},{pattern:/^\/enterprise/,contentType:"docs",contentCategory:"enterprise",persona:"enterprise_buyer"},{pattern:/^\/datenschutz/,contentType:"docs",contentCategory:"security"},{pattern:/^\/security/,contentType:"docs",contentCategory:"security"},{pattern:/^\/privacy/,contentType:"docs",contentCategory:"security"},{pattern:/^\/prompting/,contentType:"docs",contentCategory:"prompting"},{pattern:/^\/ki-prompting/,contentType:"docs",contentCategory:"prompting"},{pattern:/^\/plattform/,contentType:"docs",contentCategory:"platform"},{pattern:/^\/platform/,contentType:"docs",contentCategory:"platform"}]};function f(e=location.href,t=location.hostname){const n=new URL(e),o=function(e){return e.replace(/^www\./,"")}(t),{language:i,pathWithoutLang:a}=(r=n.pathname).startsWith("/en/")||"/en"===r?{language:"en",pathWithoutLang:r.replace(/^\/en/,"")||"/"}:{language:"de",pathWithoutLang:r};var r;const s=h[o]||[];for(const e of s){const t=a.match(e.pattern);if(t)return{contentType:e.contentType,contentCategory:e.contentCategory||null,language:i,pageIntent:e.pageIntent||null,persona:e.persona||null,slug:e.extractSlug&&t[1]?t[1]:null}}return{contentType:null,contentCategory:null,language:i,pageIntent:null,persona:null,slug:null}}const v="_apollo_journey";function y(){try{if(sessionStorage.getItem(v))return;const e={entryPage:location.pathname,entryReferrer:document.referrer||"",pages:[],startTime:Date.now()};sessionStorage.setItem(v,JSON.stringify(e)),sessionStorage.setItem("_apollo_session_start",Date.now().toString())}catch(e){}}function w(e){try{const t=sessionStorage.getItem(v);if(!t)return y(),w(e);const n=JSON.parse(t),o=n.pages[n.pages.length-1];if(o?.path===e)return;n.pages.push({path:e,timestamp:Date.now()}),n.pages.length>50&&(n.pages=n.pages.slice(-50)),sessionStorage.setItem(v,JSON.stringify(n))}catch(e){}}function b(){try{const e=sessionStorage.getItem(v);return e?JSON.parse(e):null}catch(e){return null}}const _="_apollo_visits",I="_apollo_first_visit",T="_apollo_last_visit",S={returnVisits:!0,timeOnPage:!0,scrollDepth:!0,rageClicks:!0,intentSignals:!0,copyEvents:!0,tabFocus:!0,outboundClicks:!1,sessionJourney:!0,fileDownloads:!0,formSubmissions:!0,errorPages:!0};let k=null;function C(){const e=new URLSearchParams(location.search);return{utmSource:e.get("utm_source")||u("_apollo_src")||void 0,utmMedium:e.get("utm_medium")||u("_apollo_med")||void 0,utmCampaign:e.get("utm_campaign")||u("_apollo_cmp")||void 0,utmTerm:e.get("utm_term")||void 0,utmContent:e.get("utm_content")||void 0,ref:e.get("ref")||void 0}}function E(e,t,n){if(!k)return n&&console.warn("[Apollo:Engagement] No beacon context available, skipping event:",e),!1;const o=k.getDeviceId(),i=k.getSessionId();if(!o)return n&&console.warn("[Apollo:Engagement] No device ID available, skipping beacon event:",e),!1;const a=f(),r=A(),s={type:"track",name:e,properties:{...t,siteTag:"External",title:document.title,path:location.pathname},context:{deviceId:o,sessionId:i,timestamp:(new Date).toISOString(),url:location.href,referrer:document.referrer||void 0,userAgent:navigator.userAgent,screen:{width:screen.width,height:screen.height},viewport:{width:window.innerWidth,height:window.innerHeight},language:a.language,contentType:a.contentType||void 0,contentCategory:a.contentCategory||void 0,pageIntent:a.pageIntent||void 0,persona:a.persona||void 0,visitNumber:r.visitNumber,isReturning:r.isReturning},attribution:C()};if(navigator.sendBeacon){const t=navigator.sendBeacon(k.endpoint,JSON.stringify(s));return n&&console.log("[Apollo:Engagement] Beacon sent:",e,t?"✓":"✗"),t}return!1}function L(apollo,e={}){const t={...S,...e},n=[];t.beaconContext&&(k=t.beaconContext);const o=A();return function(){try{const e=Date.now().toString(),t=parseInt(localStorage.getItem(_)||"0",10);localStorage.setItem(_,(t+1).toString()),localStorage.getItem(I)||localStorage.setItem(I,e),localStorage.setItem(T,e)}catch(e){}}(),t.timeOnPage&&n.push(function(e,t){let n=Date.now(),o=0,i=!document.hidden;const a=f(),r=()=>{document.hidden?(i&&(o+=Date.now()-n),i=!1):(n=Date.now(),i=!0)},s=()=>{i&&(o+=Date.now()-n);const e=Math.round(o/1e3);e>1&&(E("page_engagement",{time_seconds:e,content_type:a.contentType,content_category:a.contentCategory,language:a.language,page_intent:a.pageIntent},t),t&&console.log("[Apollo:Engagement] Time on page:",e,"seconds"))};return document.addEventListener("visibilitychange",r),window.addEventListener("beforeunload",s),window.addEventListener("pagehide",s),()=>{document.removeEventListener("visibilitychange",r),window.removeEventListener("beforeunload",s),window.removeEventListener("pagehide",s)}}(0,t.debug)),t.scrollDepth&&n.push(function(e,t){let n=0;const o={0:0,25:0,50:0,75:0,90:0};let i=0,a=Date.now();const r=f(),s=()=>{const e=Date.now();o[i]=(o[i]||0)+(e-a),n>0&&(E("scroll_engagement",{max_depth_percent:n,content_type:r.contentType,content_category:r.contentCategory,language:r.language,time_at_top:Math.round((o[0]||0)/1e3),time_at_25:Math.round((o[25]||0)/1e3),time_at_50:Math.round((o[50]||0)/1e3),time_at_75:Math.round((o[75]||0)/1e3),time_at_90:Math.round((o[90]||0)/1e3)},t),t&&console.log("[Apollo:Engagement] Max scroll:",n+"%"))};let c=!1;const l=()=>{c||(window.requestAnimationFrame(()=>{(()=>{const e=document.documentElement.scrollHeight-window.innerHeight;if(e<=0)return;const t=Math.round(window.scrollY/e*100);n=Math.max(n,t);const r=Date.now(),s=r-a;o[i]=(o[i]||0)+s,i=t>=90?90:t>=75?75:t>=50?50:t>=25?25:0,a=r})(),c=!1}),c=!0)};return window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("beforeunload",s),window.addEventListener("pagehide",s),()=>{window.removeEventListener("scroll",l),window.removeEventListener("beforeunload",s),window.removeEventListener("pagehide",s)}}(0,t.debug)),t.rageClicks&&n.push(function(apollo,e){const t=[];let n=0;const o=o=>{const i=Date.now();for(t.push({x:o.clientX,y:o.clientY,time:i});t.length>0&&i-t[0].time>500;)t.shift();if(t.length>=3){const a=t.filter(e=>Math.hypot(e.x-o.clientX,e.y-o.clientY)<30);if(a.length>=3&&i-n>1e3){n=i;const r=o.target,s=f();apollo.track("rage_click",{element_tag:r.tagName.toLowerCase(),element_text:r.textContent?.trim().slice(0,50)||"",element_class:r.className?.toString().slice(0,100)||"",click_count:a.length,page_path:location.pathname,content_type:s.contentType,language:s.language}),e&&console.log("[Apollo:Engagement] Rage click detected:",{clicks:a.length,element:r.tagName}),t.length=0}}};return document.addEventListener("click",o,{capture:!0}),()=>{document.removeEventListener("click",o,{capture:!0})}}(apollo,t.debug)),t.intentSignals&&n.push(function(apollo,e){const t=t=>{const n=t.target,o=function(e){if(!e)return{};const t={},n=["data-intent","data-feature","data-plan","data-trust","data-cta"];for(const o of n){const n=e.closest(`[${o}]`);n&&(t[o.replace("data-","")]=n.getAttribute(o)||"")}return t}(n);if(o.intent){const t=f(),i=A();apollo.track("intent_signal",{intent_type:o.intent,...o,page_path:location.pathname,content_type:t.contentType,language:t.language,visit_number:i.visitNumber,is_returning:i.isReturning,element_tag:n.tagName.toLowerCase(),element_text:n.textContent?.trim().slice(0,50)||""}),e&&console.log("[Apollo:Engagement] Intent signal:",o.intent)}};return document.addEventListener("click",t,{capture:!0}),()=>{document.removeEventListener("click",t,{capture:!0})}}(apollo,t.debug)),t.copyEvents&&n.push(function(apollo,e){const t=()=>{const t=window.getSelection()?.toString();if(t&&t.length>10){const n=f();apollo.track("content_copied",{text_length:t.length,text_preview:t.slice(0,100),page_path:location.pathname,content_type:n.contentType,language:n.language}),e&&console.log("[Apollo:Engagement] Content copied:",{length:t.length,preview:t.slice(0,50)+"..."})}};return document.addEventListener("copy",t),()=>document.removeEventListener("copy",t)}(apollo,t.debug)),t.tabFocus&&n.push(function(apollo,e){let t=null,n=null;const o=()=>{t=Date.now(),n=location.pathname},i=()=>{if(t&&n){const o=Math.round((Date.now()-t)/1e3);if(o>=5&&o<=300){const t=f();apollo.track("tab_return",{away_seconds:o,page_path:n,content_type:t.contentType,language:t.language}),e&&console.log("[Apollo:Engagement] Tab return:",{awaySeconds:o,page:n})}}t=null,n=null};return window.addEventListener("blur",o),window.addEventListener("focus",i),()=>{window.removeEventListener("blur",o),window.removeEventListener("focus",i)}}(apollo,t.debug)),t.outboundClicks&&n.push(function(apollo,e){const t=t=>{const n=t.target.closest("a[href]");if(!n)return;const o=n.getAttribute("href");if(o&&o.startsWith("http"))try{const t=new URL(o);if(t.hostname.includes("meingpt.com"))return;const i=f();apollo.track("outbound_click",{destination_host:t.hostname,destination_url:o.slice(0,200),link_text:n.textContent?.trim().slice(0,50)||"",page_path:location.pathname,content_type:i.contentType,language:i.language}),e&&console.log("[Apollo:Engagement] Outbound click:",{host:t.hostname,text:n.textContent?.trim().slice(0,30)})}catch{}};return document.addEventListener("click",t,{capture:!0}),()=>document.removeEventListener("click",t,{capture:!0})}(apollo,t.debug)),t.sessionJourney&&n.push(function(e,t){y(),w(location.pathname);const n=()=>{const e=b(),n=function(){const e=b();if(!e)return{pagesViewed:1,sessionDuration:0,entryPage:location.pathname,currentPage:location.pathname};const t=Date.now()-e.startTime;return{pagesViewed:e.pages.length||1,sessionDuration:t,entryPage:e.entryPage,currentPage:e.pages[e.pages.length-1]?.path||location.pathname}}();n.pagesViewed>0&&(E("session_summary",{pages_viewed:n.pagesViewed,session_duration_seconds:Math.round(n.sessionDuration/1e3),entry_page:n.entryPage,exit_page:location.pathname,entry_referrer:e?.entryReferrer||"",journey_path:e?.pages.map(e=>e.path).join(" → ")||location.pathname},t),t&&console.log("[Apollo:Engagement] Session summary:",{pages:n.pagesViewed,duration:Math.round(n.sessionDuration/1e3)+"s",entry:n.entryPage,exit:location.pathname}))};return window.addEventListener("beforeunload",n),window.addEventListener("pagehide",n),()=>{window.removeEventListener("beforeunload",n),window.removeEventListener("pagehide",n)}}(0,t.debug)),t.fileDownloads&&n.push(function(apollo,e){const t=["pdf","doc","docx","xls","xlsx","ppt","pptx","zip","rar","gz","tar","csv","txt","rtf","odt","ods","odp"],n=n=>{const o=n.target.closest("a[href]");if(!o)return;const i=o.getAttribute("href");if(!i)return;const a=o.hasAttribute("download"),r=i.split(".").pop()?.toLowerCase().split("?")[0]||"",s=t.includes(r);if(!a&&!s)return;let c="";try{c=new URL(i,location.origin).pathname.split("/").pop()||i}catch{c=i.split("/").pop()||i}const l=f();apollo.track("file_download",{file_name:c.slice(0,100),file_extension:r,file_url:i.slice(0,200),page_path:location.pathname,content_type:l.contentType,language:l.language,link_text:o.textContent?.trim().slice(0,50)||""}),e&&console.log("[Apollo:Engagement] File download:",{file:c,extension:r})};return document.addEventListener("click",n,{capture:!0}),()=>document.removeEventListener("click",n,{capture:!0})}(apollo,t.debug)),t.formSubmissions&&n.push(function(apollo,e){const t=new WeakMap,n=n=>{const o=n.target;if(!o||!("form"in o))return;const i=o,a=i.form;if(!a)return;if(!t.has(a)){t.set(a,{startTime:Date.now(),fieldsInteracted:new Set});const n=f(),o=a.id||a.name||a.getAttribute("data-form");let i;i="string"==typeof o?o||"unnamed":o&&"object"==typeof o&&"value"in o&&String(o.value)||"unnamed",apollo.track("form_start",{form_id:i,form_action:a.action?.slice(0,100)||"",page_path:location.pathname,content_type:n.contentType,language:n.language}),e&&console.log("[Apollo:Engagement] Form start:",i)}const r=i.name||i.id||i.type;t.get(a).fieldsInteracted.add(r)},o=n=>{const o=n.target;if(!o)return;const i=t.get(o),a=f(),r=o.id||o.name||o.getAttribute("data-form");let s;s="string"==typeof r?r||"unnamed":r&&"object"==typeof r&&"value"in r&&String(r.value)||"unnamed";const c=i?Date.now()-i.startTime:0,l=i?.fieldsInteracted.size||0;apollo.track("form_submit",{form_id:s,form_action:o.action?.slice(0,100)||"",fields_completed:l,time_spent_seconds:Math.round(c/1e3),page_path:location.pathname,content_type:a.contentType,language:a.language}),e&&console.log("[Apollo:Engagement] Form submit:",{form:s,fields:l,timeSpent:Math.round(c/1e3)+"s"}),t.delete(o)},i=()=>{document.querySelectorAll("form").forEach(n=>{const o=t.get(n);if(!o)return;let i;const a=n.id||n.name||n.getAttribute("data-form");i="string"==typeof a?a||"unnamed":a&&"object"==typeof a&&"value"in a&&String(a.value)||"unnamed";const r=Date.now()-o.startTime;E("form_abandon",{form_id:i,fields_completed:o.fieldsInteracted.size,time_spent_seconds:Math.round(r/1e3)},e),e&&console.log("[Apollo:Engagement] Form abandon:",{form:i,fields:o.fieldsInteracted.size})})};return document.addEventListener("focusin",n,{capture:!0}),document.addEventListener("submit",o,{capture:!0}),window.addEventListener("beforeunload",i),window.addEventListener("pagehide",i),()=>{document.removeEventListener("focusin",n,{capture:!0}),document.removeEventListener("submit",o,{capture:!0}),window.removeEventListener("beforeunload",i),window.removeEventListener("pagehide",i)}}(apollo,t.debug)),t.errorPages&&n.push(function(apollo,e){const t=setTimeout(()=>{if(!(()=>{const e=document.title.toLowerCase(),t=document.querySelector("h1")?.textContent?.toLowerCase()||"",n=document.body.className.toLowerCase(),o=location.pathname.toLowerCase();return["404","not found","page not found","nicht gefunden","seite nicht gefunden"].some(i=>e.includes(i)||t.includes(i)||n.includes(i)||o.includes("/404"))})())return;const t=f();apollo.track("page_not_found",{requested_path:location.pathname,referrer:document.referrer||"",referrer_host:document.referrer?new URL(document.referrer).hostname:"",page_title:document.title,language:t.language}),e&&console.log("[Apollo:Engagement] 404 page detected:",{path:location.pathname,referrer:document.referrer})},100);return()=>{clearTimeout(t)}}(apollo,t.debug)),window.__apolloEngagement=o,()=>{n.forEach(e=>e())}}function A(){try{const e=Date.now(),t=parseInt(localStorage.getItem(_)||"0",10),n=localStorage.getItem(I),o=localStorage.getItem(T),i=n?parseInt(n,10):e,a=o?parseInt(o,10):e;return{visitNumber:t+1,daysSinceFirstVisit:Math.floor((e-i)/864e5),daysSinceLastVisit:Math.floor((e-a)/864e5),isReturning:t>0}}catch(e){return{visitNumber:1,daysSinceFirstVisit:0,daysSinceLastVisit:0,isReturning:!1}}}function D(){return window.__apolloEngagement||null}const P=new Map;function x(e){return"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function $(e){return"string"==typeof e&&e.length>1&&e.length<100&&/^[a-zA-ZÀ-ÿ\s'-]+$/.test(e)}function F(e){const{apollo:apollo,debug:t}=e,n=window.fetch,o=new URLSearchParams(location.search),i=o.get("apollo_id")||o.get("apollo_device_id");return t&&i&&console.log("[Apollo:Fillout] Found apollo_id in URL:",i),window.fetch=async(e,o)=>{const a="string"==typeof e?e:e instanceof URL?e.href:e.url;if(!a.includes("api.fillout.com/v1/flow/"))return n(e,o);let r=null;try{r=o?.body?JSON.parse(o.body):null}catch{return n(e,o)}const s=a.match(/\/flow\/([^/]+)\//),c=s?.[1]||"unknown";try{if(a.includes("/init")&&r){const e=r,n={flowId:c,sessionToken:e.sessionToken,apolloDeviceId:i||void 0,startTime:Date.now(),stepCount:0,capturedFields:{}};P.set(e.sessionToken,n),t&&console.log("[Apollo:Fillout] Form started:",c),apollo.track("form_started",{formId:c,formPlatform:"fillout",domain:e.domain})}if(a.includes("/continue")&&r){const e=r,n=P.get(e.sessionToken);if(n){n.stepCount++,n.lastStepId=e.stepId,n.submissionId=e.model.globals?.submissionId;const o=function(e){const t={};for(const[n,o]of Object.entries(e))if("urlParams"!==n&&"globals"!==n&&"stepHistory"!==n&&"calculations"!==n&&"quiz"!==n&&"object"==typeof o&&null!==o)for(const[e,n]of Object.entries(o))if("object"==typeof n&&null!==n&&"value"in n){const o=n.value;null!==o&&""!==o&&(t[e]=o)}return t}(e.model);Object.assign(n.capturedFields,o);const i=function(e){const t={};for(const[n,o]of Object.entries(e)){const e=n.toLowerCase(),i="string"==typeof o?o.trim():null;i&&0!==i.length&&(t.email||(e.includes("email")||e.includes("e-mail")||e.includes("mail"),x(o)&&(t.email=i)),t.name||(e.includes("name")||e.includes("vorname")||e.includes("nachname"))&&$(o)&&(t.name=i),t.company||(e.includes("company")||e.includes("unternehmen")||e.includes("firma")||e.includes("organization")||e.includes("organisation")||e.includes("arbeitgeber"))&&(t.company=i),t.jobTitle||(e.includes("title")||e.includes("position")||e.includes("rolle")||e.includes("job")||e.includes("beruf")||e.includes("funktion"))&&(t.jobTitle=i),t.department||(e.includes("department")||e.includes("abteilung")||e.includes("bereich")||e.includes("team"))&&(t.department=i),t.phone||(e.includes("phone")||e.includes("telefon")||e.includes("tel")||e.includes("mobile")||e.includes("handy"))&&(t.phone=i))}return t}(n.capturedFields);i.email&&!n.email&&(n.email=i.email,n.name=i.name,t&&console.log("[Apollo:Fillout] Detected user:",i),apollo.identify(n.email,{email:n.email,name:i.name,company:i.company,jobTitle:i.jobTitle,department:i.department,phone:i.phone,source:"fillout_form",formId:c,submissionId:n.submissionId}));const a=e.model.stepHistory?.path||[];t&&console.log("[Apollo:Fillout] Step completed:",e.stepId,"Fields:",Object.keys(o)),apollo.track("form_step_completed",{formId:c,formPlatform:"fillout",stepId:e.stepId,stepNumber:a.length,submissionId:n.submissionId,timeOnStepSeconds:e.metadata?.timeToCompleteInSeconds})}}}catch(e){t&&console.error("[Apollo:Fillout] Error processing request:",e)}const l=await n(e,o);try{const e=l.clone(),n=await e.json();if(n.isComplete||n.showThankYouPage){const e=r?.sessionToken,n=e?P.get(e):null;if(n){const o=(Date.now()-n.startTime)/1e3;t&&console.log("[Apollo:Fillout] Form completed!",{submissionId:n.submissionId,email:n.email,totalSteps:n.stepCount,totalTimeSeconds:o}),apollo.track("form_completed",{formId:n.flowId,formPlatform:"fillout",submissionId:n.submissionId,email:n.email,totalSteps:n.stepCount,totalTimeSeconds:o,fieldsCollected:Object.keys(n.capturedFields).length}),P.delete(e)}}}catch{}return l},t&&console.log("[Apollo:Fillout] Interceptor active - tracking form events"),()=>{window.fetch=n,P.clear()}}function N(apollo,e){const t=()=>{for(const[,t]of P.entries()){const n=(Date.now()-t.startTime)/1e3;apollo.track("form_abandoned",{formId:t.flowId,formPlatform:"fillout",submissionId:t.submissionId,lastStepId:t.lastStepId,stepsCompleted:t.stepCount,totalTimeSeconds:n}),e&&console.log("[Apollo:Fillout] Form abandoned:",t.flowId)}};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}var R,j=-1,M=function(e){addEventListener("pageshow",function(t){t.persisted&&(j=t.timeStamp,e(t))},!0)},O=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart=0?o="back-forward-cache":n&&(document.prerendering||U()>0?o="prerender":document.wasDiscarded?o="restore":n.type&&(o=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:o}},q=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var o=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return o.observe(Object.assign({type:e,buffered:!0},n||{})),o}}catch(e){}},J=function(e,t,n,o){var i,a;return function(r){t.value>=0&&(r||o)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},V=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},W=function(e){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e()})},z=function(e){var t=!1;return function(){t||(e(),t=!0)}},H=-1,K=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Y=function(e){"hidden"===document.visibilityState&&H>-1&&(H="visibilitychange"===e.type?e.timeStamp:0,G())},X=function(){addEventListener("visibilitychange",Y,!0),addEventListener("prerenderingchange",Y,!0)},G=function(){removeEventListener("visibilitychange",Y,!0),removeEventListener("prerenderingchange",Y,!0)},Q=function(){return H<0&&(H=K(),X(),M(function(){setTimeout(function(){H=K(),X()},0)})),{get firstHiddenTime(){return H}}},Z=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},ee=[1800,3e3],te=function(e,t){t=t||{},Z(function(){var n,o=Q(),i=B("FCP"),a=q("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTimet.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var o={id:e.interactionId,latency:e.duration,entries:[e]};ue.set(o.id,o),le.push(o)}le.sort(function(e,t){return t.latency-e.latency}),le.length>10&&le.splice(10).forEach(function(e){return ue.delete(e.id)})}}},me=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=z(e),"hidden"===document.visibilityState?e():(n=t(e),W(e)),n},he=[200,500],fe=[2500,4e3],ve={},ye=[800,1800],we=function e(t){document.prerendering?Z(function(){return e(t)}):"complete"!==document.readyState?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},be=function(e,t){t=t||{};var n=B("TTFB"),o=J(e,n,ye,t.reportAllChanges);we(function(){var i=O();i&&(n.value=Math.max(i.responseStart-U(),0),n.entries=[i],o(!0),M(function(){n=B("TTFB",0),(o=J(e,n,ye,t.reportAllChanges))(!0)}))})};function _e(e){const{beaconContext:t,siteTag:n,debug:o}=e,i=[],a=e=>{const t=function(e){return{name:e.name,value:e.value,rating:e.rating,delta:e.delta,id:e.id,navigationType:e.navigationType||"unknown"}}(e);i.push(t),o&&console.log("[Apollo] Web Vital:",t.name,t.value,`(${t.rating})`)};!function(e,t){t=t||{},Z(function(){var n,o=Q(),i=B("LCP"),a=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach(function(e){e.startTimeo.value&&(o.value=i,o.entries=a,n())},s=q("layout-shift",r);s&&(n=J(e,o,ne,t.reportAllChanges),W(function(){r(s.takeRecords()),n(!0)}),M(function(){i=0,o=B("CLS",0),n=J(e,o,ne,t.reportAllChanges),V(function(){return n()})}),setTimeout(n,0))}))}(a,{reportAllChanges:!0}),te(a),be(a);const r=()=>{const e=t.getDeviceId(),a=t.getSessionId();if(!e||0===i.length)return void(o&&console.log("[Apollo] Web Vitals: No metrics to send or no device ID"));const r={deviceId:e,sessionId:a,url:window.location.href,urlPath:window.location.pathname,siteTag:n,metrics:[...i],timestamp:(new Date).toISOString()},s=t.endpoint.replace("/v1/collect","/v1/performance"),c=navigator.sendBeacon(s,JSON.stringify(r));o&&console.log("[Apollo] Web Vitals sent:",{success:c,metrics:i.map(e=>`${e.name}: ${e.value}`)})},s=()=>{"hidden"===document.visibilityState&&r()};document.addEventListener("visibilitychange",s);const c=()=>{r()};return window.addEventListener("pagehide",c),()=>{document.removeEventListener("visibilitychange",s),window.removeEventListener("pagehide",c)}}const Ie="https://data.meingpt.com";!function(n,o){const i=o.currentScript,a=i?.getAttribute("data-site-id"),r=i?.hasAttribute("data-debug")||!1,c=i?.getAttribute("data-endpoint"),l=c||`${Ie}/v1/collect`,g=i?.getAttribute("data-cookie-domain")||function(){const e=location.hostname;if(e.endsWith("meingpt.com"))return".meingpt.com";if(e.endsWith("selectcode.de"))return".selectcode.de";const t=e.split(".");return t.length>=2?"."+t.slice(-2).join("."):e}(),h=!0!==i?.hasAttribute("data-no-engagement"),v=!0!==i?.hasAttribute("data-no-web-vitals"),y=[];let w,b,_,I=!1,T=null,S="External";async function k(){if(a)return a;try{const e=await fetch(`${Ie}/v1/site`,{method:"GET",headers:{"Content-Type":"application/json"}});if(e.ok)return(await e.json()).t||"External"}catch{}return"External"}b=new t({endpoint:l,debug:r});const C=new s({apiKey:"vuUdFy9Ec32NEQRyOTOs",ingestUrl:Ie,cookieDomain:g,debug:r});C.setAliasCallback(async(e,t)=>{try{await b.alias({previousId:e,deviceId:t}),r&&console.log("[Apollo] Alias sent:",e,"→",t)}catch(e){r&&console.error("[Apollo] Alias error:",e)}});const E={track:(e,t)=>{I?x("track",e,t):y.push(["track",e,t])},page:e=>{I?x("page",null,e):y.push(["page",null,e])},identify:(e,t)=>{I?$(e,t):y.push(["identify",e,t])},flush:async()=>{_&&await _.flush()}};function A(){const e=new URLSearchParams(location.search);return{utmSource:e.get("utm_source")||u("_apollo_src")||void 0,utmMedium:e.get("utm_medium")||u("_apollo_med")||void 0,utmCampaign:e.get("utm_campaign")||u("_apollo_cmp")||void 0,utmTerm:e.get("utm_term")||void 0,utmContent:e.get("utm_content")||void 0,ref:e.get("ref")||void 0}}function P(){const e=f(),t=D();return{deviceId:T,sessionId:w,timestamp:(new Date).toISOString(),url:location.href,referrer:o.referrer||void 0,userAgent:navigator.userAgent,screen:{width:screen.width,height:screen.height},viewport:{width:n.innerWidth,height:n.innerHeight},language:e.language,contentType:e.contentType||void 0,contentCategory:e.contentCategory||void 0,pageIntent:e.pageIntent||void 0,persona:e.persona||void 0,slug:e.slug||void 0,visitNumber:t?.visitNumber,isReturning:t?.isReturning}}function x(e,t,n){const i={type:e,name:t||e,properties:{...n,siteTag:S,title:o.title,path:location.pathname},context:P(),attribution:A()};_.push(i),r&&console.log("[Apollo] Event:",e,t,n)}async function $(e,t){try{const n=t?.tenantId??t?.orgId,o=t?.tenantName??t?.orgName,i=t?{...t}:void 0;i&&(delete i.tenantId,delete i.tenantName,delete i.orgId,delete i.orgName),await b.identify({deviceId:T,userId:e,tenantId:n,tenantName:o,traits:i}),r&&console.log("[Apollo] Identify:",e,n?`(tenant: ${n})`:"")}catch(e){r&&console.error("[Apollo] Identify error:",e)}}async function R(){try{const t=function(){const e=new URLSearchParams(location.search);return{gclid:e.get("gclid")||void 0,fbclid:e.get("fbclid")||void 0,li_fat_id:e.get("li_fat_id")||void 0,msclkid:e.get("msclkid")||void 0}}();w=d(g),p(g);const[n,i]=await Promise.all([k(),C.getDeviceId()]);S=n,T=i,async function(e,t){if(function(e){return Boolean(e.gclid||e.fbclid||e.li_fat_id||e.msclkid)}(t))try{await b.session({device_id:e,click_ids:t,url:location.href,user_agent:navigator.userAgent}),r&&console.log("[Apollo] Click IDs stored:",t),function(){const e=new URL(location.href),t=["gclid","fbclid","li_fat_id","msclkid"];let n=!1;for(const o of t)e.searchParams.has(o)&&(e.searchParams.delete(o),n=!0);n&&history.replaceState(history.state,"",e.toString())}()}catch(e){r&&console.error("[Apollo] Failed to store click IDs:",e)}}(T,t),_=new e({batchSize:25,flushInterval:5e3,onFlush:e=>b.sendBatch(e),debug:r}),I=!0,r&&console.log("[Apollo] Initialized",{deviceId:T,sessionId:w,siteTag:S});for(const[e,t,n]of y)"identify"===e?await $(t,n):x(e,t,n);y.length=0,E.page(),m(E,{clicks:!0,scrollDepth:!0,navigation:!0,debug:r});const a={getDeviceId:()=>T,getSessionId:()=>w,endpoint:l};h&&(L(E,{debug:r,beaconContext:a}),r&&console.log("[Apollo] Engagement tracking enabled (all modules)")),v&&(_e({beaconContext:a,siteTag:S,debug:r}),r&&console.log("[Apollo] Web Vitals tracking enabled")),("on.meingpt.com"===location.hostname||null!==o.querySelector('script[src*="fillout"]')||null!==o.querySelector("[data-fillout]"))&&(F({apollo:E,debug:r}),N(E,r),r&&console.log("[Apollo] Fillout form tracking enabled"))}catch(e){console.error("[Apollo] Initialization error:",e)}}n.apollo=E,"loading"===o.readyState?o.addEventListener("DOMContentLoaded",R):R()}(window,document)}();