(function(){"use strict";const Vr="glue_devmode",bs="devmode",Wr=typeof performance<"u"&&performance.now?performance.now():0;let fe=null;const vs=["#6366f1","#0ea5e9","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#f97316"];function Xd(){try{return localStorage.getItem(Vr)??localStorage.getItem(bs)}catch{return null}}function Gr(e){try{e===null?(localStorage.removeItem(Vr),localStorage.removeItem(bs)):localStorage.setItem(Vr,e)}catch{}}function Kr(e){if(e===null)return null;const t=e.trim().toLowerCase();return t===""||t==="false"||t==="0"||t==="off"?null:t==="true"||t==="1"||t==="on"||t==="*"?"*":new Set(t.split(",").map(n=>n.trim()).filter(Boolean))}function Yd(){let e=null;try{e=new URLSearchParams(window.location.search).get("devmode")}catch{}e!==null?(fe=Kr(e),Gr(fe===null?null:e)):fe=Kr(Xd())}Yd();function ze(e){return fe===null?!1:fe==="*"?!0:fe.has(e)}function Zd(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return vs[Math.abs(t)%vs.length]}function Qd(){if(!Wr&&Wr!==0)return"";const e=(typeof performance<"u"&&performance.now?performance.now():0)-Wr;return e<1e3?`+${Math.round(e)}ms`:`+${(e/1e3).toFixed(1)}s`}function Vt(e){return[`%c${e==="glue"?"glue":`glue·${e}`}%c ${Qd()}`,`background:${Zd(e)};color:#fff;border-radius:3px;padding:1px 5px;font-weight:600`,"color:#94a3b8;font-weight:400"]}function B(e){return{log(...t){if(!ze(e))return;const[n,r,o]=Vt(e);console.log(n,r,o,...t)},info(...t){if(!ze(e))return;const[n,r,o]=Vt(e);console.info(n,r,o,...t)},warn(...t){if(!ze(e))return;const[n,r,o]=Vt(e);console.warn(n,r,o,...t)},error(...t){if(!ze(e))return;const[n,r,o]=Vt(e);console.error(n,r,o,...t)},group(t,n=!1){if(!ze(e))return;const[r,o,i]=Vt(e);n?console.group(`${r} ${t}`,o,i):console.groupCollapsed(`${r} ${t}`,o,i)},groupEnd(){ze(e)&&console.groupEnd()},table(t,n){ze(e)&&console.table(t,n)},enabled(){return ze(e)}}}function ef(e){const t=e&&e.trim()?e:"true";fe=Kr(t),Gr(t),console.log("%cglue%c devmode ON"+(e?` (filter: ${e})`:""),"background:#6366f1;color:#fff;border-radius:3px;padding:1px 5px;font-weight:600","color:inherit")}function tf(){fe=null,Gr(null)}function nf(){return{enabled:fe!==null,filter:fe===null?"":fe==="*"?"*":[...fe].join(",")}}const Jr=["glue_sessions","glue_events","glue_user_profile"];function rf(e){if(e===null)return null;try{return JSON.parse(e)}catch{return e}}function of(){try{const e={},t={};try{for(const r of Object.keys(localStorage))(r.startsWith("glue_")||r.startsWith("utm_")||r.startsWith("temp_"))&&(e[r]=localStorage.getItem(r)??"")}catch{}try{for(const r of Object.keys(sessionStorage))(r.startsWith("glue_")||r.startsWith("utm_")||r.startsWith("temp_"))&&(t[r]=sessionStorage.getItem(r)??"")}catch{}console.group("%cglue%c state dump","background:#6366f1;color:#fff;border-radius:3px;padding:1px 5px;font-weight:600","color:inherit");const n={};for(const[r,o]of Object.entries(e))Jr.includes(r)||(n[r]={value:o,scope:"local"});for(const[r,o]of Object.entries(t))!Jr.includes(r)&&!(r in n)&&(n[r]={value:o,scope:"session"});Object.keys(n).length&&(console.groupCollapsed(`identity + attribution (${Object.keys(n).length} keys)`),console.table(n),console.groupEnd());for(const r of Jr){const o=rf(e[r]??t[r]??null);if(o===null)continue;const i=Array.isArray(o)?o:[o];console.groupCollapsed(`${r} (${i.length})`),console.table(i.slice(-25)),i.length>25&&console.log(`… ${i.length-25} older entries not shown`),console.groupEnd()}console.groupEnd()}catch(e){console.warn("glue: state dump failed",e)}}const C=B("glue");var sf=Object.defineProperty,af=(e,t,n)=>t in e?sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cf=(e,t,n)=>af(e,t+"",n);const lf=B("modules"),uf=1e4,df=5*60*1e3,ff=2,Ss=new Map;function Wt(e,t){return`${e}@${t}`}function gf(e,t){const n=Wt(e,t);let r=Ss.get(n);return r||(r={status:{name:e,version:t,state:"idle",attempts:0},promise:null,exports:void 0,failedAt:0},Ss.set(n,r)),r}function Xr(){const e=globalThis;return e.__glueModules||(e.__glueModules={}),e.__glueModules}class at extends Error{constructor(t,n){super(n),cf(this,"reason"),this.name="ModuleLoadError",this.reason=t}}function mf(e,t){const r=globalThis?.__glueConfig?.supabaseUrl;return typeof r!="string"||!r?null:`${r}/functions/v1/glue?module=${encodeURIComponent(e)}&v=${encodeURIComponent(t)}`}function pf(e,t){return new Promise((n,r)=>{if(typeof document>"u"||!document.head){r(new at("exception","document unavailable"));return}let o=!1;const i=document.createElement("script"),s=c=>{o||(o=!0,clearTimeout(a),i.onload=null,i.onerror=null,c?r(c):n())},a=setTimeout(()=>s(new at("timeout",`module load timed out after ${t}ms`)),t);i.src=e,i.async=!0,i.crossOrigin="anonymous",i.onload=()=>s(),i.onerror=()=>s(new at(navigator?.onLine===!1?"network":"csp",`module script failed: ${e}`)),document.head.appendChild(i)})}async function _f(e,t,n){const o=Xr()[Wt(e,t)];if(o)return o;const i=mf(e,t);if(!i)throw new at("disabled","no supabaseUrl configured for module loading");await pf(i,n);const s=Xr()[Wt(e,t)];if(!s){const a=Object.keys(Xr()).find(c=>c.startsWith(`${e}@`));throw new at(a?"version_mismatch":"exception",a?`module ${e} registered as ${a}, expected ${t}`:`module ${e}@${t} did not register`)}return s}function Yr(e,t,n={}){const r=gf(e,t);if(r.status.state==="loaded")return Promise.resolve(r.exports);if(r.promise)return r.promise;if(r.status.state==="failed"&&!(r.status.attempts<ff&&Date.now()-r.failedAt>=df))return Promise.reject(new at(r.status.reason??"exception",`module ${Wt(e,t)} unavailable`));r.status.state="loading",r.status.attempts+=1,r.status.reason=void 0;const o=typeof n.timeoutMs=="number"?n.timeoutMs:uf;return r.promise=_f(e,t,o).then(i=>(r.exports=i,r.status.state="loaded",r.status.at=Date.now(),r.promise=null,i)).catch(i=>{throw r.status.state="failed",r.status.reason=i instanceof at?i.reason:"exception",r.status.at=Date.now(),r.failedAt=Date.now(),r.promise=null,lf.warn(`module ${Wt(e,t)} failed (${r.status.reason})`),i}),r.promise}const Es="__dataglue_toolbar",hf=/^[A-Za-z0-9_-]{20,200}$/;function yf(e=typeof location>"u"?"":location.hash){if(!e)return null;const t=e.charAt(0)==="#"?e.slice(1):e;if(t.indexOf(Es)===-1)return null;for(const n of t.split("&")){const r=n.indexOf("=");if(r===-1||n.slice(0,r)!==Es)continue;let o=n.slice(r+1);try{o=decodeURIComponent(o)}catch{}return hf.test(o)?{token:o}:null}return null}const wf="toolbar",bf="1";let ks=!1;function vf(){if(ks||typeof window>"u"||typeof document>"u")return Promise.resolve();const e=yf();return e?(ks=!0,Yr(wf,bf).then(t=>t.start({token:e.token})).then(()=>{}).catch(t=>{C.warn("toolbar: could not start",t)})):Promise.resolve()}vf();let jn=null,ve=()=>!0;const qn=new Map,Zr=new Map,Qr=new Map;function Sf(e){ve=e}function Ef(){jn=null}function kf(){return jn||(jn=new URLSearchParams(window.location.search)),jn}function eo(e){try{return kf().get(e)}catch(t){return C.warn(`Failed to get URL parameter '${e}':`,t),null}}function P(e,t){try{const n=typeof t=="string"?t:JSON.stringify(t);if(!ve("sessionStorage")){Zr.set(e,n);return}sessionStorage.setItem(e,n)}catch(n){C.warn(`Failed to set sessionStorage item '${e}':`,n)}}function j(e){try{return ve("sessionStorage")?sessionStorage.getItem(e):Zr.get(e)??null}catch(t){return C.warn(`Failed to get sessionStorage item '${e}':`,t),null}}function Et(e){try{if(Zr.delete(e),!ve("sessionStorage"))return;sessionStorage.removeItem(e)}catch(t){C.warn(`Failed to remove sessionStorage item '${e}':`,t)}}function S(e,t){try{const n=typeof t=="string"?t:JSON.stringify(t);if(!ve("localStorage")){qn.set(e,n);return}localStorage.setItem(e,n)}catch(n){C.warn(`Failed to set localStorage item '${e}':`,n)}}function h(e){try{return ve("localStorage")?localStorage.getItem(e):qn.get(e)??null}catch(t){return C.warn(`Failed to get localStorage item '${e}':`,t),null}}function As(e){try{if(!ve("localStorage"))return[...qn.keys()].filter(n=>n.startsWith(e));const t=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r?.startsWith(e)&&t.push(r)}return t}catch{return[]}}function ne(e){try{if(qn.delete(e),!ve("localStorage"))return;localStorage.removeItem(e)}catch(t){C.warn(`Failed to remove localStorage item '${e}':`,t)}}let Hn=null,Gt=null;function G(e,t,n){try{if(!ve("cookie")){Qr.set(e,t);return}const r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3);const o="expires="+r.toUTCString(),i=window.location.protocol==="https:"?";Secure":"";document.cookie=`${encodeURIComponent(e)}=${encodeURIComponent(t)};${o};path=/;SameSite=Lax${i}`,Hn=null,Gt=null}catch(r){C.warn(`Failed to set cookie '${e}':`,r)}}function ge(e){try{if(!ve("cookie"))return Qr.get(e)??null;const t=document.cookie;if(t===Hn&&Gt)return Gt.get(e)??null;const n=new Map,r=t.split(";");for(const o of r){const i=o.trim(),s=i.indexOf("=");if(s===-1)continue;const a=decodeURIComponent(i.slice(0,s));n.has(a)||n.set(a,decodeURIComponent(i.slice(s+1)))}return Hn=t,Gt=n,n.get(e)??null}catch(t){return C.warn(`Failed to read cookie '${e}':`,t),null}}function to(e){try{if(Qr.delete(e),!ve("cookie"))return;document.cookie=`${encodeURIComponent(e)}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;SameSite=Lax`,Hn=null,Gt=null}catch(t){C.warn(`Failed to delete cookie '${e}':`,t)}}const Af=[{name:"chrome",regex:/Chrome/},{name:"safari",regex:/Safari/},{name:"firefox",regex:/Firefox/},{name:"ie",regex:/MSIE|Trident/}],Tf=[{name:"windows",regex:/Win/},{name:"mac",regex:/Mac/},{name:"linux",regex:/Linux/},{name:"android",regex:/Android/},{name:"ios",regex:/like Mac/}];function no(e){const t=e||(typeof navigator<"u"?navigator.userAgent:"");if(!t)return{browser:"unknown",os:"unknown"};const n=Af.find(({regex:o})=>o.test(t))?.name||"unknown",r=Tf.find(({regex:o})=>o.test(t))?.name||"unknown";return C.log("Browser detection:",{browser:n,os:r,userAgent:t}),{browser:n,os:r}}function Cf(){const{browser:e,os:t}=no();typeof document<"u"&&document.documentElement&&(document.documentElement.classList.add(`browser-${e}`,`os-${t}`),C.log("Added browser/OS classes:",{browser:e,os:t}))}/**
 * uuidv7: An experimental implementation of the proposed UUID Version 7
 *
 * @license Apache-2.0
 * @copyright 2021-2023 LiosK
 * @packageDocumentation
 */const Ts="0123456789abcdef";class ct{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new ct(t)}static fromFieldsV7(t,n,r,o){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(o)||t<0||n<0||r<0||o<0||t>0xffffffffffff||n>4095||r>1073741823||o>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=t/2**40,i[1]=t/2**32,i[2]=t/2**24,i[3]=t/2**16,i[4]=t/2**8,i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=o>>>24,i[13]=o>>>16,i[14]=o>>>8,i[15]=o,new ct(i)}static parse(t){var n;const o=(n=/^([0-9A-Fa-f]{8})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{12})$/.exec(t))===null||n===void 0?void 0:n.slice(1,6).join("");if(o){const i=new Uint8Array(16);for(let s=0;s<16;s+=4){const a=parseInt(o.substring(2*s,2*s+8),16);i[s+0]=a>>>24,i[s+1]=a>>>16,i[s+2]=a>>>8,i[s+3]=a}return new ct(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let n=0;n<this.bytes.length;n++)t+=Ts.charAt(this.bytes[n]>>>4),t+=Ts.charAt(this.bytes[n]&15),(n===3||n===5||n===7||n===9)&&(t+="-");return t}toJSON(){return this.toString()}getType(){return this.getVariant()}getVariant(){const t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(n=>n===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(n=>n===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new ct(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let n=0;n<16;n++){const r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class ro{constructor(t){this.random=t,this.timestamp=0,this.counter=0}static create(){return new ro(If())}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,n){let r=this.generateOrAbortCore(t,n);return r===void 0&&(this.timestamp=0,r=this.generateOrAbortCore(t,n)),r}generateOrAbortCore(t,n){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(n<0||n>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+n>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return ct.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){const t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,ct.ofInner(t)}}const If=()=>{if(typeof crypto<"u"&&typeof crypto.getRandomValues<"u")return new xf;if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");return{nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}};class xf{constructor(){this.buffer=new Uint32Array(8),this.cursor=65535}nextUint32(){return this.cursor>=this.buffer.length&&(crypto.getRandomValues(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}let Cs;const re=()=>Lf().toString(),Lf=()=>(Cs||(Cs=ro.create())).generate();var Mf=Object.defineProperty,Of=(e,t,n)=>t in e?Mf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Is=(e,t,n)=>Of(e,typeof t!="symbol"?t+"":t,n),xs=(e=>(e.COLLECTION_FAILED="COLLECTION_FAILED",e.GEOLOCATION_DENIED="GEOLOCATION_DENIED",e.GEOLOCATION_TIMEOUT="GEOLOCATION_TIMEOUT",e.STORAGE_ERROR="STORAGE_ERROR",e.PARSING_ERROR="PARSING_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.PERMISSION_DENIED="PERMISSION_DENIED",e))(xs||{});class Rf extends Error{constructor(t,n,r){super(n),Is(this,"code"),Is(this,"context"),this.code=t,this.context=r,this.name="AttributionError"}}const Ne=B("geo");function Ls(){const e=window.__glueConfig?.visitorIp;e&&(S("glue_user_ip",e),Ne.log("✓ IP address stored (from Cloudflare):",e))}async function Ms(){try{const e=await fetch("https://get.geojs.io/v1/ip/geo.json");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json(),n=`${t.country_code} | ${t.country} | ${t.city} | ${t.latitude}, ${t.longitude}`;S("glue_user_geolocation",n),!h("glue_user_ip")&&t.ip&&(S("glue_user_ip",t.ip),Ne.log("✓ IP address stored (from geojs fallback):",t.ip)),Ne.log("✓ Geolocation stored:",n)}catch(e){throw Ne.error("Failed to fetch geolocation data:",e),new Rf(xs.NETWORK_ERROR,"Failed to fetch geolocation data",{error:e instanceof Error?e.message:String(e)})}}function Nf(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"unknown"}}async function $f(e){const t=new AbortController,n=setTimeout(()=>t.abort(),5e3);try{const r=await fetch(e,{method:"GET",signal:t.signal});if(clearTimeout(n),!r.ok)return null;const o=await r.json();return{ip_address:o.ip_address,source_type:"ip_lookup",country_code:o.country_code,country_name:o.country_name,region:o.region,city:o.city,postal_code:o.postal_code,latitude:o.latitude,longitude:o.longitude,accuracy_radius:o.accuracy_radius,timezone:o.timezone,isp:o.isp,organization:o.organization,connection_type:o.connection_type}}catch(r){return clearTimeout(n),Ne.warn("Edge function geolocation failed:",r),null}}async function Df(){const e=new AbortController,t=setTimeout(()=>e.abort(),5e3);try{const n=await fetch("https://get.geojs.io/v1/ip/geo.json",{signal:e.signal});if(clearTimeout(t),!n.ok)return null;const r=await n.json();return{ip_address:r.ip,source_type:"fallback",country_code:r.country_code,country_name:r.country,region:r.region,city:r.city,latitude:r.latitude?parseFloat(r.latitude):void 0,longitude:r.longitude?parseFloat(r.longitude):void 0,timezone:r.timezone}}catch(n){return clearTimeout(t),Ne.warn("GeoJS fallback failed:",n),null}}async function Pf(e){const t=Nf();let n=null;if(e&&(n=await $f(e),n&&Ne.log("✓ Geolocation from edge function:",n.city,n.country_name)),n||(n=await Df(),n&&Ne.log("✓ Geolocation from geojs fallback:",n.city,n.country_name)),n){const r=n.timezone&&t!=="unknown"?n.timezone!==t:void 0;n.raw_data={browser_timezone:t,timezone_mismatch:r},r&&Ne.log("⚠ Timezone mismatch detected:",{ip_timezone:n.timezone,browser_timezone:t}),!h("glue_user_ip")&&n.ip_address&&S("glue_user_ip",n.ip_address)}return n}const Ff=Object.freeze(Object.defineProperty({__proto__:null,fetchAndStoreGeoLocation:Ms,getGeolocationWithFallback:Pf,storeCloudflareIP:Ls},Symbol.toStringTag,{value:"Module"})),oo=["none","essential","analytics","full"],Os={necessary:"essential",strictly_necessary:"essential",required:"essential",statistics:"analytics",performance:"analytics",marketing:"full",advertising:"full",all:"full"};function zn(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return oo.includes(t)?t:Object.prototype.hasOwnProperty.call(Os,t)?Os[t]:null}function io(e,t){const n=zn(e)??"none",r=zn(t)??"full";return oo.indexOf(n)>=oo.indexOf(r)}var Uf=Object.defineProperty,jf=(e,t,n)=>t in e?Uf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,so=(e,t,n)=>jf(e,typeof t!="symbol"?t+"":t,n);const Rs="glue_consent_state";class qf{constructor(t){so(this,"config"),so(this,"consentState"),so(this,"listeners",new Set),this.config=t,this.consentState=this.initializeConsentState(),Sf(n=>this.canUseStorage(n))}isConsentRequired(){return this.config.consent_required}getConsentLevel(){return this.config.consent_required?this.consentState.level:"full"}isFeatureAllowed(t){if(!this.config.consent_required)return!0;if(!this.config.features[t])return!1;const n=this.getConsentLevel();return n==="none"?!1:n==="essential"?t==="form_capture":!0}canUseStorage(t){if(!this.config.consent_required)return!0;if(this.getConsentLevel()==="none")return!1;switch(this.config.storage_mode){case"memory":return!1;case"cookieless":return t!=="cookie";case"full":default:return!0}}setConsent(t,n){const r=zn(t);if(r){if(this.consentState={level:r,timestamp:Date.now(),source:n},this.canUseStorage("localStorage"))try{localStorage.setItem(Rs,JSON.stringify(this.consentState))}catch{}this.listeners.forEach(o=>o(this.consentState))}}onConsentChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}getConfig(){return this.config}initializeConsentState(){if(!this.config.consent_required)return{level:"full",timestamp:Date.now(),source:"default"};if(this.config.respect_dnt&&this.shouldRespectDNT())return{level:"essential",timestamp:Date.now(),source:"default"};try{const n=localStorage.getItem(Rs);if(n){const r=JSON.parse(n),o=zn(r?.level);if(o&&r.timestamp)return{...r,level:o}}}catch{}const t=this.checkExternalConsent();return t||{level:"none",timestamp:Date.now(),source:"default"}}shouldRespectDNT(){return navigator.doNotTrack==="1"||window.doNotTrack==="1"||navigator.msDoNotTrack==="1"}checkExternalConsent(){if(this.config.external.mode==="none")return null;for(const t of this.config.external.providers){const n=this.parseProviderConsent(t);if(n)return n}for(const t of this.config.external.cookie_names){const n=ge(t);if(n)return this.parseGenericConsent(n)}return null}parseProviderConsent(t){switch(t.toLowerCase()){case"onetrust":return this.parseOneTrustConsent();case"cookiebot":return this.parseCookiebotConsent();case"cookieyes":return this.parseCookieYesConsent();case"termly":return this.parseTermlyConsent();default:return null}}parseOneTrustConsent(){const t=ge("OptanonConsent");if(!t)return null;const n=t.match(/groups=([^&]*)/)?.[1];if(!n)return null;const r=n.includes("C0002:1"),o=n.includes("C0004:1");let i="essential";return o?i="full":r&&(i="analytics"),{level:i,timestamp:Date.now(),source:"external"}}parseCookiebotConsent(){const t=ge("CookieConsent");if(!t)return null;try{const n=decodeURIComponent(t),r=n.includes("statistics:true"),o=n.includes("marketing:true");let i="essential";return o?i="full":r&&(i="analytics"),{level:i,timestamp:Date.now(),source:"external"}}catch{return null}}parseCookieYesConsent(){const t=ge("cookieyes-consent");if(!t)return null;const n=t.includes("analytics:yes"),r=t.includes("advertisement:yes");let o="essential";return r?o="full":n&&(o="analytics"),{level:o,timestamp:Date.now(),source:"external"}}parseTermlyConsent(){const t=ge("termly_consent");if(!t)return null;try{const n=JSON.parse(decodeURIComponent(t)),r=n.analytics===!0,o=n.marketing===!0||n.advertising===!0;let i="essential";return o?i="full":r&&(i="analytics"),{level:i,timestamp:Date.now(),source:"external"}}catch{return null}}parseGenericConsent(t){const n=t.toLowerCase();return n==="true"||n==="accept"||n==="all"||n==="1"?{level:"full",timestamp:Date.now(),source:"external"}:n==="false"||n==="decline"||n==="none"||n==="0"?{level:"essential",timestamp:Date.now(),source:"external"}:{level:"analytics",timestamp:Date.now(),source:"external"}}}let Bn=null;function Hf(e){return Bn=new qf(e),Bn}function lt(){return Bn}const Kt=e=>Bn?.isFeatureAllowed(e)??!0,zf=["glue_user_geolocation","glue_geo_cache"];function Bf(e){return!e||typeof e!="object"?!0:e.location!==!1}function ao(){const e=globalThis.__glueConfig?.tracking?.features;return Bf(e)&&Kt("geolocation")}function Vf(){let e=!1;for(const t of zf)h(t)!==null&&(ne(t),e=!0);return e}var Wf=Object.defineProperty,Gf=(e,t,n)=>t in e?Wf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>Gf(e,typeof t!="symbol"?t+"":t,n);function kt(){return parseInt(String(new Date().getTime()/1e3),10)}function Jt(e,t=null){const r=new RegExp(`(^|&|\\?)${e}=(.*?)($|&)`,"ig").exec(t||window.location.search);return r!==null&&r.length>1?r[2]:null}function Ns(e){let t="",n=null;try{t=window.localStorage.getItem(e)||""}catch{}if(!t){const r=window.document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));r&&r.length>1&&(t=r[2])}try{n=window.JSON.parse(t)}catch{}return n}function $s(e,t){const n=window.JSON.stringify(t);try{window.localStorage.setItem(e,n)}catch{window.document.cookie=`${e}=${n};path=/;`}}class xe{constructor(t,n=null,r=kt()){Y(this,"channel"),Y(this,"value"),Y(this,"timestamp"),this.channel=t,this.value=n,this.timestamp=r}getChannel(){return this.channel}getValue(){return this.value}getTimestamp(){return this.timestamp}updateTimestamp(){this.timestamp=kt()}toJSON(){return{c:this.channel.getId(),v:this.value,t:this.timestamp}}static fromJSON(t,n){if(!n||typeof n.c>"u"||typeof n.t>"u")throw new Error('Touchpoint.fromJSON: expected data in form of {"c":"id","v":"value","t":1234567890}');const r=t.getChannelById(n.c);if(!r)throw new Error(`Touchpoint.fromJSON: channel "${n.c}" not found in provided engine`);return new xe(r,n.v,n.t)}}class At{constructor(t,n,r={}){Y(this,"id"),Y(this,"label"),Y(this,"options"),this.id=t,this.label=n,this.options=r,typeof this.options.canOverwrite>"u"&&(this.options.canOverwrite=!1),typeof this.options.isFirstViewOnly>"u"&&(this.options.isFirstViewOnly=!1),typeof this.options.priority>"u"&&(this.options.priority=100)}getId(){return this.id}getLabel(){return this.label}execute(){return null}}class co extends At{constructor(t,n,r,o=null,i={}){super(t,n,i),Y(this,"matchPattern"),Y(this,"valueParamName"),this.matchPattern=r,this.valueParamName=o}execute(){let t=null;if(typeof this.matchPattern=="string")t=Jt(this.matchPattern)!==null;else if(this.matchPattern instanceof RegExp)t=window.location.search.match(this.matchPattern);else if(typeof this.matchPattern=="object"){const n=Object.keys(this.matchPattern),r=[];for(let o=0;o<n.length;o++){const i=this.matchPattern[n[o]],s=Jt(n[o]);r.push(typeof i=="boolean"?!!s===i:s===i)}t=r.indexOf(!1)===-1}if(t){let n=null;return typeof this.valueParamName=="string"&&(n=decodeURIComponent(Jt(this.valueParamName)||"")),new xe(this,n)}return null}}class Xt extends At{constructor(t,n,r,o={}){super(t,n,o),Y(this,"matchPattern"),this.matchPattern=r}execute(){let t=this.matchPattern;if((this.matchPattern instanceof RegExp||typeof this.matchPattern=="function")&&(t=[this.matchPattern]),Array.isArray(t)&&t.length>0)for(let n=0;n<t.length;n++){const r=t[n];if(r instanceof RegExp&&window.document.referrer.match(r)||typeof r=="function"&&r(window.document.referrer))return new xe(this)}return null}}const Ds=class ws extends At{execute(){for(let t=0;t<ws.searchEngineRules.length;t++){const n=ws.searchEngineRules[t];if(window.document.referrer.match(n.rule))return new xe(this,n.valueParam?Jt(n.valueParam):"")}return null}};Y(Ds,"searchEngineRules",[{rule:/(\.)?(google|googlesyndication|googleadservices|naver|bing|yahoo|yandex|daum|baidu|myway|ecosia|ask|dogpile|sogou|seznam|aolsvc|altavista|duckduckgo|mywebsearch|wow|webcrawler|infospace|blekko|docomo)(?=\.[a-z.]{2,5})/gi,valueParam:!1},{rule:/(\.)?(goo\.gl)/ig,valueParam:!1},{rule:/^android-app:\/\/com\.google\.android/ig,valueParam:!1}]);let Ps=Ds;class oe{constructor(t,n=100){Y(this,"touchpoint"),Y(this,"weight"),this.touchpoint=t,this.weight=n}getTouchpoint(){return this.touchpoint}getWeight(){return this.weight}}class Kf{constructor(t,n=[],r=1800,o="gktp"){Y(this,"model"),Y(this,"channelConfig"),Y(this,"cookieName"),Y(this,"visitDuration"),Y(this,"touchpointHistory"),Y(this,"lastTouchTimestamp"),this.model=t,this.channelConfig=n,this.cookieName=o,this.visitDuration=r,this.touchpointHistory=[],this.lastTouchTimestamp=0;const i=Ns(this.cookieName);i&&this.restoreFromData(i)}execute(){const t=kt();let n=null;for(let r=0;r<this.channelConfig.length;r++){const o=this.channelConfig[r];if(n=o.execute(),n){const s=this.touchpointHistory.length>0?this.touchpointHistory[this.touchpointHistory.length-1]:null;o.options.isFirstViewOnly&&t-this.lastTouchTimestamp<this.visitDuration?n=null:s&&s.getValue()===n.getValue()&&s.getChannel().getId()===n.getChannel().getId()?s.updateTimestamp():this.touchpointHistory.push(n);break}}return this.lastTouchTimestamp=t,$s(this.cookieName,this.saveToData()),n}getAttributionItems(){return this.model.execute(this.getTouchpointHistory())}getTouchpointHistory(){return this.touchpointHistory}getChannelById(t){for(let n=0;n<this.channelConfig.length;n++)if(this.channelConfig[n].getId()===t)return this.channelConfig[n];return null}restoreFromData(t){t&&(this.lastTouchTimestamp=t.lt,this.touchpointHistory=[],t.e.forEach(n=>{try{const r=xe.fromJSON(this,n);r&&this.touchpointHistory.push(r)}catch{}}))}saveToData(){return{e:this.touchpointHistory.map(t=>t.toJSON()),lt:this.lastTouchTimestamp}}}const Jf=Object.freeze(Object.defineProperty({__proto__:null,AttributionEngine:Kf,AttributionItem:oe,Channel:At,ReferrerMatchingChannel:Xt,SearchEngineChannel:Ps,Touchpoint:xe,URLMatchingChannel:co,getCurrentTime:kt,getQueryParam:Jt,storageRead:Ns,storageWrite:$s},Symbol.toStringTag,{value:"Module"})),me=B("attribution"),Xf=["tt_appInfo","tt_pixel_session_index","tt_sessionId"],Yf=["_fbp","_fbc"];function Fs(){me.group("TikTok Attribution");const e={};return Xf.forEach(t=>{try{const n=j(t);if(n&&n!=="null"&&n!==""){const r=`glue_${t}`;S(r,n),P(r,n),G(r,n,30),e[t]=n,me.log(`✓ ${t}:`,n)}else me.log(`⏭ ${t} not found (normal if TikTok Pixel not present)`)}catch(n){me.error(`Error collecting ${t}:`,n)}}),me.log(`✓ Collected ${Object.keys(e).length} TikTok attribution fields`),me.groupEnd(),e}function Us(){me.group("Facebook Attribution");const e={};return Yf.forEach(t=>{try{const n=ge(t);if(n&&n!=="null"&&n!==""){const r=`glue_fb_${t.substring(1)}`;S(r,n),P(r,n),G(r,n,30),e[t]=n,me.log(`✓ ${t}:`,n)}else me.log(`⏭ ${t} not found (normal if Facebook Pixel not present)`)}catch(n){me.error(`Error collecting ${t}:`,n)}}),me.log(`✓ Collected ${Object.keys(e).length} Facebook attribution fields`),me.groupEnd(),e}var Zf=Object.defineProperty,Qf=(e,t,n)=>t in e?Zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lo=(e,t,n)=>Qf(e,typeof t!="symbol"?t+"":t,n);const js=class Kd extends Xt{constructor(t="social",n="Social Media",r={}){super(t,n,Kd.socialPlatforms,r)}};lo(js,"socialPlatforms",[/(?:\/\/|\.)facebook\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)fb\.com(?:[\/:?#]|$)/i,/m\.facebook\.com/i,/(?:\/\/|\.)instagram\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)(?:twitter\.com|t\.co|x\.com)(?:[\/:?#]|$)/i,/(?:\/\/|\.)linkedin\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)lnkd\.in(?:[\/:?#]|$)/i,/(?:\/\/|\.)tiktok\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)reddit\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)redd\.it(?:[\/:?#]|$)/i,/(?:\/\/|\.)pinterest\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)pin\.it(?:[\/:?#]|$)/i,/(?:\/\/|\.)youtube\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)youtu\.be(?:[\/:?#]|$)/i,/(?:\/\/|\.)snapchat\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)tumblr\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)whatsapp\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)telegram\.org(?:[\/:?#]|$)/i,/(?:\/\/|\.)t\.me(?:[\/:?#]|$)/i,/wechat\.com/i,/weibo\.com/i,/(?:\/\/|\.)discord\.gg(?:[\/:?#]|$)/i,/(?:\/\/|\.)discord\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)slack\.com(?:[\/:?#]|$)/i,/(?:\/\/|\.)vk\.com(?:[\/:?#]|$)/i,/vkontakte\.ru/i,/qq\.com/i,/(?:\/\/|\.)line\.me(?:[\/:?#]|$)/i,/viber\.com/i,/medium\.com/i,/quora\.com/i,/twitch\.tv/i,/github\.com/i,/stackoverflow\.com/i,/gitlab\.com/i,/bitbucket\.org/i]);let uo=js;class fo extends At{execute(){const t=[{pattern:/[?&]gclid=/i,platform:"google_ads"},{pattern:/[?&]fbclid=/i,platform:"facebook_ads"},{pattern:/[?&]msclkid=/i,platform:"microsoft_ads"},{pattern:/[?&]ttclid=/i,platform:"tiktok_ads"},{pattern:/[?&]li_fat_id=/i,platform:"linkedin_ads"},{pattern:/[?&]twclid=/i,platform:"twitter_ads"},{pattern:/[?&]epik=/i,platform:"pinterest_ads"},{pattern:/[?&]ScCid=/i,platform:"snapchat_ads"},{pattern:/[?&]utm_medium=(cpc|ppc|paid|paidsocial)/i,platform:"paid_search"}];for(const n of t)if(window.location.search.match(n.pattern))return new xe(this,n.platform);return null}}const qs=class Jd extends Xt{execute(){const t=super.execute();return t||(window.location.search.match(/[?&]utm_medium=email/i)?new xe(this,"email_campaign"):null)}constructor(t="email",n="Email Marketing",r={}){super(t,n,Jd.emailPlatforms,r)}};lo(qs,"emailPlatforms",[/mail\.google\.com/i,/mail\.yahoo\.com/i,/outlook\.live\.com/i,/outlook\.office\.com/i,/mail\.aol\.com/i,/mailchimp\.com/i,/sendgrid\.net/i,/constantcontact\.com/i,/campaignmonitor\.com/i,/aweber\.com/i,/getresponse\.com/i,/activecampaign\.com/i,/klaviyo\.com/i,/hubspot\.com/i,/marketo\.com/i,/pardot\.com/i]);let go=qs;class mo extends At{execute(){return(!window.document.referrer||window.document.referrer==="")&&!window.location.search.match(/utm_/i)&&!window.location.search.match(/gclid|fbclid|ttclid|msclkid/i)?new xe(this,"direct"):null}}class Vn extends Ps{}lo(Vn,"searchEngineRules",[{rule:/(\.)?(google|googlesyndication|googleadservices)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(bing)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(yahoo)(?=\.[a-z.]{2,5})/gi,valueParam:"p"},{rule:/(\.)?(yandex)(?=\.[a-z.]{2,5})/gi,valueParam:"text"},{rule:/(\.)?(baidu)(?=\.[a-z.]{2,5})/gi,valueParam:"wd"},{rule:/(\.)?(duckduckgo)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(sogou)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(soso|so)(?=\.[a-z.]{2,5})/gi,valueParam:"w"},{rule:/(\.)?(360|haosou)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(naver)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(daum)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(docomo)(?=\.[a-z.]{2,5})/gi,valueParam:"MT"},{rule:/(\.)?(seznam)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(wp)(?=\.[a-z.]{2,5})/gi,valueParam:"szukaj"},{rule:/(\.)?(startpage)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(qwant)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(searx|searxng)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(swisscows)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(mojeek)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(ecosia)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(ask)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(aol|aolsvc)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(altavista)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(dogpile)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(mywebsearch)(?=\.[a-z.]{2,5})/gi,valueParam:"searchfor"},{rule:/(\.)?(wow)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(webcrawler)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(infospace)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(blekko)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(myway)(?=\.[a-z.]{2,5})/gi,valueParam:"searchfor"},{rule:/(\.)?(wolframalpha)(?=\.[a-z.]{2,5})/gi,valueParam:"i"},{rule:/(\.)?(brave)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(neeva)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(you)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(kagi)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(rambler)(?=\.[a-z.]{2,5})/gi,valueParam:"query"},{rule:/(\.)?(mail\.ru)(?=\.[a-z.]{2,5})/gi,valueParam:"q"},{rule:/(\.)?(goo\.gl)/ig,valueParam:!1},{rule:/^android-app:\/\/com\.google\.android/ig,valueParam:!1}]);function eg(){const e=[];return e.push(new fo("paid_ad","Paid Advertising",{canOverwrite:!0,priority:10})),e.push(new co("utm_campaign","UTM Campaign","utm_campaign","utm_campaign",{canOverwrite:!0,priority:20})),e.push(new uo("social","Social Media",{canOverwrite:!0,priority:30})),e.push(new go("email","Email Marketing",{canOverwrite:!0,priority:40})),e.push(new Vn("search","Search Engine",{canOverwrite:!1,priority:50})),e.push(new Xt("referral","Referral",/.+/,{canOverwrite:!1,priority:60})),e.push(new mo("direct","Direct",{canOverwrite:!1,isFirstViewOnly:!0,priority:100})),e}function tg(e){if(!e.is_enabled)return null;const t={canOverwrite:e.options.canOverwrite??!1,isFirstViewOnly:e.options.isFirstViewOnly??!1,priority:e.priority};switch(e.channel_type){case"url_matching":return new co(e.channel_id,e.channel_name,e.match_config.matchPattern||"",e.match_config.valueParamName||null,t);case"referrer_matching":return new Xt(e.channel_id,e.channel_name,e.match_config.referrerPatterns||[],t);case"search_engine":return new Vn(e.channel_id,e.channel_name,t);case"social_media":return new uo(e.channel_id,e.channel_name,t);case"paid_ad":return new fo(e.channel_id,e.channel_name,t);case"email":return new go(e.channel_id,e.channel_name,t);case"direct":return new mo(e.channel_id,e.channel_name,t);default:return null}}function ng(e,t){return[...t,...e].sort((r,o)=>{const i=r.options.priority??100,s=o.options.priority??100;return i-s})}const rg=Object.freeze(Object.defineProperty({__proto__:null,DirectChannel:mo,EmailMarketingChannel:go,ExtendedSearchEngineChannel:Vn,PaidAdChannel:fo,SocialMediaChannel:uo,collectFacebookAttribution:Us,collectTikTokAttribution:Fs,createChannelFromConfig:tg,createDefaultChannels:eg,mergeChannelConfigs:ng},Symbol.toStringTag,{value:"Module"})),H=B("attribution"),og=["email","fname","lname","first_name","last_name","full_name","name","mobile","phone","phone_number","work_phone","home_phone","address","address1","address2","street","city","state","zip","zipcode","postal_code","country","company","company_name","organization","job_title","title","department","industry","website","birthday","dob","age","gender","linkedin","twitter","facebook","instagram"],po=["utm_id","utm_source","utm_medium","utm_campaign","utm_term","utm_content","fbclid","gclid","gclsrc","wbraid","gbraid","dclid","msclkid","ttclid","li_fat_id","twclid","epik","ScCid","irclickid","adset_id","ad_id","adgroup_id","campaign_id","placement","comet_source","comet_ad_id","comet_campaign","comet_ad_group","comet_network","comet_keyword","comet_placement","comet_type","comet_custom"];function ig(e){const t=po.some(n=>n.startsWith("utm_")&&!!e.get(n));return t&&po.forEach(n=>{if(n.startsWith("utm_")&&!e.get(n)){const r=`glue_last_${n}`;ne(r),to(r)}}),po.forEach(n=>{const r=e.get(n);if(r){const o=`glue_initial_${n}`;h(o)||S(o,r);const i=`glue_last_${n}`;S(i,r),G(i,r,365),H.log(`✓ Captured ${n}: ${r} (first & last touch)`)}}),t}const sg={comet_source:"utm_source",comet_campaign:"utm_campaign",comet_keyword:"utm_term",comet_network:"utm_medium"},ag={comet_ad_id:"ad_id",comet_ad_group:"adgroup_id",comet_placement:"placement"},cg={fbclid:{source:"facebook",medium:"paid"},gclid:{source:"google",medium:"cpc"},gbraid:{source:"google",medium:"cpc"},wbraid:{source:"google",medium:"cpc"},dclid:{source:"google",medium:"display"},msclkid:{source:"bing",medium:"cpc"},ttclid:{source:"tiktok",medium:"paid"},li_fat_id:{source:"linkedin",medium:"paid"},twclid:{source:"twitter",medium:"paid"},epik:{source:"pinterest",medium:"paid"},ScCid:{source:"snapchat",medium:"paid"},irclickid:{source:"impact",medium:"affiliate"}},lg=[{pattern:/google\.[a-z.]+\/(search|url)/i,source:"google",medium:"organic"},{pattern:/bing\.com\/search/i,source:"bing",medium:"organic"},{pattern:/duckduckgo\.com/i,source:"duckduckgo",medium:"organic"},{pattern:/yahoo\.[a-z.]+\/search/i,source:"yahoo",medium:"organic"},{pattern:/baidu\.com/i,source:"baidu",medium:"organic"},{pattern:/yandex\.[a-z]+/i,source:"yandex",medium:"organic"},{pattern:/ecosia\.org/i,source:"ecosia",medium:"organic"},{pattern:/facebook\.com|fb\.com|fbcdn\.net/i,source:"facebook",medium:"social"},{pattern:/instagram\.com/i,source:"instagram",medium:"social"},{pattern:/(?:\/\/|\.)(?:twitter\.com|t\.co|x\.com)(?:[\/:?#]|$)/i,source:"twitter",medium:"social"},{pattern:/linkedin\.com|lnkd\.in/i,source:"linkedin",medium:"social"},{pattern:/tiktok\.com/i,source:"tiktok",medium:"social"},{pattern:/pinterest\.[a-z.]+/i,source:"pinterest",medium:"social"},{pattern:/snapchat\.com/i,source:"snapchat",medium:"social"},{pattern:/reddit\.com/i,source:"reddit",medium:"social"},{pattern:/youtube\.com|youtu\.be/i,source:"youtube",medium:"social"},{pattern:/threads\.net/i,source:"threads",medium:"social"},{pattern:/whatsapp\.com/i,source:"whatsapp",medium:"social"},{pattern:/telegram\.org|(?:\/\/|\.)t\.me(?:[\/:?#]|$)/i,source:"telegram",medium:"social"},{pattern:/mail\.google\.com/i,source:"gmail",medium:"email"},{pattern:/outlook\.(live|office)\.com/i,source:"outlook",medium:"email"},{pattern:/mail\.yahoo\.com/i,source:"yahoo_mail",medium:"email"},{pattern:/mail\.aol\.com/i,source:"aol_mail",medium:"email"},{pattern:/protonmail\.com|proton\.me/i,source:"protonmail",medium:"email"},{pattern:/news\.ycombinator\.com/i,source:"hackernews",medium:"referral"},{pattern:/medium\.com/i,source:"medium",medium:"referral"},{pattern:/substack\.com/i,source:"substack",medium:"referral"}],ug=[{pattern:/FBAN|FBAV/i,app:"facebook_app",source:"facebook"},{pattern:/Instagram/i,app:"instagram_app",source:"instagram"},{pattern:/musical_ly|Bytedance|TikTok/i,app:"tiktok_app",source:"tiktok"},{pattern:/LinkedInApp/i,app:"linkedin_app",source:"linkedin"},{pattern:/Twitter/i,app:"twitter_app",source:"twitter"},{pattern:/Snapchat/i,app:"snapchat_app",source:"snapchat"},{pattern:/Pinterest/i,app:"pinterest_app",source:"pinterest"},{pattern:/Line\//i,app:"line_app",source:"line"},{pattern:/Slack/i,app:"slack_app",source:"slack"},{pattern:/Discord/i,app:"discord_app",source:"discord"}];function dg(e){Object.entries(sg).forEach(([t,n])=>{const r=`glue_initial_${n}`,o=`glue_initial_${t}`,i=`glue_last_${t}`;if(!h(r)){const s=h(o)||h(i);s&&(S(r,s),e||(S(`glue_last_${n}`,s),G(`glue_last_${n}`,s,365)),H.log(`✓ Backfilled ${n} from ${t}: ${s}`))}})}function fg(){Object.entries(ag).forEach(([e,t])=>{const n=`glue_initial_${t}`,r=`glue_initial_${e}`,o=`glue_last_${e}`;if(!h(n)){const i=h(r)||h(o);i&&(S(n,i),S(`glue_last_${t}`,i),G(`glue_last_${t}`,i,365),H.log(`✓ Backfilled ${t} from ${e}: ${i}`))}})}function gg(){if(!h("glue_initial_utm_source")){for(const[e,t]of Object.entries(cg))if(h(`glue_initial_${e}`)||h(`glue_last_${e}`)){S("glue_initial_utm_source",t.source),S("glue_last_utm_source",t.source),G("glue_last_utm_source",t.source,365),S("glue_initial_utm_medium",t.medium),S("glue_last_utm_medium",t.medium),G("glue_last_utm_medium",t.medium,365),S("glue_attribution_derived_from",e),H.log(`✓ Derived source=${t.source}, medium=${t.medium} from ${e}`);return}}}function mg(){if(h("glue_initial_utm_source"))return;const e=document.referrer;if(e){try{const t=new URL(e).hostname,n=window.location.hostname;if(t===n)return}catch{return}for(const{pattern:t,source:n,medium:r}of lg)if(t.test(e)){S("glue_initial_utm_source",n),S("glue_last_utm_source",n),G("glue_last_utm_source",n,365),S("glue_initial_utm_medium",r),S("glue_last_utm_medium",r),G("glue_last_utm_medium",r,365),S("glue_attribution_derived_from","referrer"),H.log(`✓ Derived source=${n}, medium=${r} from referrer: ${e}`);return}try{const t=new URL(e).hostname.replace(/^www\./,"");S("glue_initial_utm_source",t),S("glue_last_utm_source",t),G("glue_last_utm_source",t,365),S("glue_initial_utm_medium","referral"),S("glue_last_utm_medium","referral"),G("glue_last_utm_medium","referral",365),S("glue_attribution_derived_from","referrer"),H.log(`✓ Derived source=${t}, medium=referral from unknown referrer`)}catch{}}}function pg(){if(/Twitter/i.test(navigator.userAgent))return;const e=h("glue_in_app_browser")==="twitter_app";e&&(ne("glue_in_app_browser"),Et("glue_in_app_browser"));const t=h("glue_attribution_derived_from")==="in_app_browser",n=e||h("glue_initial_utm_source")==="twitter"||h("glue_last_utm_source")==="twitter";!t||!n||(ne("glue_attribution_derived_from"),h("glue_initial_utm_source")==="twitter"&&(ne("glue_initial_utm_source"),ne("glue_initial_utm_medium")),h("glue_last_utm_source")==="twitter"&&(ne("glue_last_utm_source"),ne("glue_last_utm_medium"),to("glue_last_utm_source"),to("glue_last_utm_medium")),H.log("✓ Cleared legacy twitter_app false positive from storage"))}function _g(){const e=navigator.userAgent;for(const{pattern:t,app:n,source:r}of ug)if(t.test(e)){S("glue_in_app_browser",n),P("glue_in_app_browser",n),h("glue_initial_utm_source")?H.log(`✓ Detected in-app browser: ${n}`):(S("glue_initial_utm_source",r),S("glue_last_utm_source",r),G("glue_last_utm_source",r,365),S("glue_initial_utm_medium","social"),S("glue_last_utm_medium","social"),G("glue_last_utm_medium","social",365),S("glue_attribution_derived_from","in_app_browser"),H.log(`✓ Detected in-app browser: ${n}, derived source=${r}`));return}}function hg(){const e=h("glue_initial_utm_source"),t=document.referrer,n=window.location.pathname==="/"||window.location.pathname==="";let r;e?r="attributed":!t&&n?r="direct":!t&&!n?(r="dark_social",S("glue_initial_utm_source","dark_social"),S("glue_last_utm_source","dark_social"),G("glue_last_utm_source","dark_social",365),S("glue_initial_utm_medium","social"),S("glue_last_utm_medium","social"),G("glue_last_utm_medium","social",365),H.log("✓ Detected dark social traffic (no referrer, deep page)")):r="unknown",S("glue_traffic_type",r),P("glue_traffic_type",r),H.log(`✓ Traffic type: ${r}`)}function yg(){if(!["fbclid","gclid","ttclid","msclkid"].some(n=>h(`glue_initial_${n}`)||h(`glue_last_${n}`)))return;let t=!1;(h("glue_initial_fbclid")||h("glue_last_fbclid"))&&typeof window.fbq>"u"&&(t=!0),(h("glue_initial_gclid")||h("glue_last_gclid"))&&typeof window.gtag>"u"&&typeof window.dataLayer>"u"&&(t=!0),t&&(S("glue_adblocker_detected","true"),P("glue_adblocker_detected","true"),H.log("⚠️ Ad blocker likely active (click ID present but pixel not loaded)"))}function wg(e){H.group("Attribution Enrichment"),dg(e),fg(),gg(),pg(),_g(),mg(),hg(),yg(),H.groupEnd()}function bg(e){e.forEach((t,n)=>{if(n.startsWith("glue_")||og.includes(n)){const r=n.startsWith("glue_")?n:`glue_${n}`;S(r,t),P(r,t),G(r,t,30),H.log(`✓ PII data captured from query param - ${r}`)}})}function vg(e){const t=e.get("calendly");t&&(S("calendly",t),P("calendly",t),G("calendly",t,30),H.log("✓ Calendly parameter captured:",t))}function Sg(){const e=h("glue_user_id");if(e)return e;const t=re();return S("glue_user_id",t),G("glue_user_id",t,365),H.log("✓ New user ID generated:",t),t}function Eg(){if(!h("glue_user_geolocation"))return!1;const e=h("glue_geo_cache");if(!e)return!1;try{const{data:t,timestamp:n}=JSON.parse(e),r=Date.now()-n;return typeof t=="object"&&t!==null&&!Array.isArray(t)&&Object.keys(t).length>0&&Number.isFinite(n)&&r>=0&&r<864e5}catch{return!1}}function _o(){H.group("Capturing Visitor Context");const e=new URL(window.location.href),t=document.referrer,n=e.searchParams,r=no(navigator.userAgent);if(P("glue_url_current",e.href),t&&P("glue_url_last",t),P("glue_user_browser",JSON.stringify(r)),Sg(),!h("glue_user_firstseen")){const a=new Date().toISOString();S("glue_user_firstseen",a),H.log("✓ First visit captured:",a)}const o=ig(n);if(wg(o),bg(n),vg(n),h("glue_url_first")||(S("glue_url_first",e.href),H.log("✓ Entry URL captured:",e.href)),t&&!h("glue_user_referrer")){const a=new URL(t).hostname;S("glue_user_referrer",a),H.log("✓ Referrer captured:",a)}const i=new Date().toISOString();P("glue_session_start",i),ao()?Eg()?H.log("✓ Skipping geolocation fetch (fresh cache present)"):Ms().catch(a=>{H.error("Geolocation fetch failed:",a)}):H.log("✓ Skipping geolocation fetch (location capture is off)"),Fs(),Us();const s={userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,cookieEnabled:navigator.cookieEnabled,doNotTrack:navigator.doNotTrack==="1"?!0:navigator.doNotTrack==="0"?!1:null,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenResolution:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`};return H.log("✓ Visitor context captured successfully"),H.groupEnd(),s}const Tt=B("forms");function Wn(e,t=40){return e.length>t?`${e.slice(0,t)}…`:e}function kg(e,t){e.forEach(n=>{n instanceof HTMLInputElement?(n.value=t,n.setAttribute("value",t)):n instanceof HTMLElement&&(n.textContent=t)})}function Ag(e){const t=[],n=e.getAttribute("glue");n&&t.push(n);const r=e.getAttribute("data-field-reference");r&&t.push(r);const o=e.id;if(o){const a=o.match(/_glue_([^_\s]+)/);a&&t.push(a[1]);const c=o.match(/field_([^_\s]+)/);c&&t.push(c[1]);const l=o.match(/^glue_([^_\s]+)/);l&&t.push(l[1])}const i=e.getAttribute("name");if(i){const a=i.match(/_glue_([^_\s]+)/);a&&t.push(a[1])}return e.classList.forEach(a=>{const c=a.match(/_glue_([^_\s]+)/);c&&t.push(c[1]);const l=a.match(/field_([^_\s]+)/);l&&t.push(l[1])}),[...new Set(t)]}function Tg(){const e=new Map,t=["[glue]","[data-field-reference]",'[id*="_glue_"]','[id*="field_"]','[id^="glue_"]','[class*="_glue_"]','[class*="field_"]','[name*="_glue_"]'].join(", ");return document.querySelectorAll(t).forEach(r=>{const o=Ag(r);if(o.forEach(i=>{e.has(i)||e.set(i,[]),e.get(i).push(r)}),!(r instanceof HTMLInputElement)){const i=r.querySelectorAll("input");i.length>0&&o.forEach(s=>{i.forEach(a=>{e.get(s).includes(a)||e.get(s).push(a)})})}}),e}function ho(e,t,n){if(t==="null"||t==="")return 0;const r=n.get(e);return r&&r.length>0?(kg(r,t),r.length):0}function Cg(e){const t={temp_fname:"billing_first_name",temp_lname:"billing_last_name",temp_mobile:"billing_phone",temp_email:"billing_email"};Object.keys(t).forEach(n=>{const r=h(n)||j(n)||ge(n);if(r&&r!=="null"&&r!==""){const o=document.querySelector(`input[name="${t[n]}"]`);o&&(o.value=r,o.setAttribute("value",r),o.setAttribute("data-frmval",r),Tt.enabled()&&e.push({key:t[n],value:Wn(r),source:"billing-map",elements:1}))}})}function Hs(){const e=Tg(),t=Object.keys(localStorage),n=Object.keys(sessionStorage),r=[...new Set([...t,...n])],o=[],i=Tt.enabled();if(r.forEach(a=>{const c=h(a),l=j(a);if(c!==null&&c!=="null"&&c!==""){const u=ho(a,c,e);i&&u&&o.push({key:a,value:Wn(c),source:"localStorage",elements:u})}if(l!==null&&l!=="null"&&l!==""){const u=ho(a,l,e);i&&u&&o.push({key:a,value:Wn(l),source:"sessionStorage",elements:u})}}),document.cookie.split("; ").forEach(a=>{const[c,l]=a.split("=");if(c&&l&&l!=="null"&&l!==""){const u=ho(c,l,e);i&&u&&o.push({key:c,value:Wn(l),source:"cookie",elements:u})}}),Cg(o),i){const a=o.reduce((c,l)=>c+l.elements,0);Tt.group(`autofill — filled ${a} element(s) from ${o.length} key(s), ${e.size} mapped key(s) on page`),o.length&&Tt.table(o),e.size&&Tt.log("mapped keys:",[...e.keys()].join(", ")),Tt.groupEnd()}}const yo=B("ids"),zs="glue_user_id",wo="glue_session_id",bo="glue_session_last_activity",vo="glue_session_started_ms",Bs="glue_window_id",So="glue_window_claim",Gn="glue_page_view_id",Eo="glue_recording_id",Yt="glue_recording_seq",ko="glue_capture_sample",Ao=30*60*1e3,Ig=24*60*60*1e3,xg=5e3,Lg=15e3,Mg=5*60*1e3;let Zt=null;function Vs(){if(Zt)return Zt;Zt="memory";try{const e=`glue_probe_${Math.random().toString(36).slice(2)}`;P(e,"1");const t=typeof sessionStorage<"u"&&sessionStorage.getItem(e)==="1";Et(e),t&&(Zt="persistent")}catch{}return Zt}function Ws(){return Vs()==="memory"?{storage:"memory"}:{}}let Qt="";function Og(e){Qt=typeof e=="string"?e:""}function Rg(){if(Qt)return Qt;try{const e=globalThis?.__glueConfig?.workspaceId;typeof e=="string"&&(Qt=e)}catch{}return Qt}function Ng(){const e=h(zs);if(e)return e;const t=re();return S(zs,t),t}function To(){try{const e=h(So);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const r of Object.keys(t)){const o=Number(t[r]);Number.isFinite(o)&&(n[r]=o)}return n}catch{return{}}}function Gs(e){const t=Date.now();for(const n of Object.keys(e))t-e[n]>Mg&&delete e[n];try{Object.keys(e).length===0?ne(So):S(So,JSON.stringify(e))}catch{}}function Co(e){const t=To();t[e]=Date.now(),Gs(t)}function $g(e){const t=To();delete t[e],Gs(t)}let ce=null;function Io(){if(ce)return ce;const e=j(Bs);if(e){const t=To()[e];typeof t=="number"&&Date.now()-t<Lg?yo.log("duplicated tab detected, minting a new window_id"):ce=e}return ce||(ce=re(),P(Bs,ce),P(Gn,re())),Co(ce),ce}function Ks(){const e=j(Gn);if(e)return e;const t=re();return P(Gn,t),t}function xo(){const e=re();return P(Gn,e),e}function en(){return j(Eo)||null}function Lo(e){e?P(Eo,e):(Et(Eo),Et(Yt))}function Js(){const e=parseInt(j(Yt)||"0",10),t=Number.isFinite(e)&&e>=0?e:0;return P(Yt,String(t+1)),t}function Xs(){const e=parseInt(j(Yt)||"0",10);return Number.isFinite(e)&&e>=0?e:0}function Mo(e){if(!Number.isFinite(e))return;const t=Math.max(Xs(),Math.floor(e)+1);P(Yt,String(t))}const Kn=[];function Ys(e){return Kn.push(e),()=>{const t=Kn.indexOf(e);t>=0&&Kn.splice(t,1)}}function Dg(e){for(const t of Kn.slice())try{t(e)}catch(n){yo.warn("session rotation hook failed:",n)}}function Zs(){const e=parseInt(j(vo)||"0",10),t=parseInt(j(bo)||"0",10);return{started:Number.isFinite(e)?e:0,activity:Number.isFinite(t)?t:0}}function tn(e,t){const n=j(wo)||null,r=en(),o=re();return P(wo,o),P(vo,String(t)),P(bo,String(t)),Et(ko),n&&(xo(),Lo(null),yo.log(`session rotated (${e}):`,n,"->",o),Dg({session_id:o,previous_session_id:n,previous_recording_id:r,reason:e,at:t})),{session_id:o,started_at:t,last_activity:t,rotated:!0,reason:e}}function Oo(e="human",t=Date.now()){const n=j(wo);if(!n)return tn("new",t);const{started:r,activity:o}=Zs();return o&&t-o>Ao?tn("idle",t):r&&t-r>Ig?tn("max_length",t):(e==="human"&&P(bo,String(t)),r||P(vo,String(o||t)),{session_id:n,started_at:r||o||t,last_activity:e==="human"?t:o||t,rotated:!1,reason:null})}let Jn=null;function Qs(){typeof setTimeout=="function"&&(Jn&&clearTimeout(Jn),Jn=setTimeout(()=>{Jn=null;const{activity:e}=Zs();e&&Date.now()-e>Ao?tn("idle",Date.now()):Qs()},Ao*1.1))}function Pg(e="explicit"){return tn(e,Date.now())}function ut(){return{workspace_id:Rg(),glue_user_id:Ng(),session_id:Oo("passive").session_id,window_id:Io(),page_view_id:Ks(),recording_id:en()}}function Fg(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Ug(e){try{const t=JSON.parse(j(ko)||"null");return!t||typeof t!="object"?{v:e}:t.v!==e?{v:e}:t}catch{return{v:e}}}function Xn(e,t,n=""){const r=typeof t=="number"&&isFinite(t)?t:1;if(r>=1)return!0;if(r<=0)return!1;const o=Ug(n);if(typeof o[e]=="boolean")return o[e];const i=Oo("passive").session_id,s=Fg(`${e}:${i}`)/4294967296<r;o[e]=s,o.v=n;try{P(ko,JSON.stringify(o))}catch{}return s}let ea=!1;function Yn(){ea||typeof window>"u"||(ea=!0,Io(),Qs(),setInterval(()=>{ce&&Co(ce)},xg),window.addEventListener("pagehide",()=>{ce&&$g(ce)}),window.addEventListener("pageshow",e=>{e?.persisted&&(ce&&Co(ce),xo())}))}const $e=B("sync"),jg="plugins-4",ta="glue_pending_batches",na="glue_pending_batch_v2:",Zn=new Set;let ra=!1;const qg=20,Hg=2e5,zg=6,Ro=[1e3,4e3,16e3],Bg=.2,oa=1e4,ia=5*60*1e3,sa=6e4,Vg=1e4;let pe=null,No=null,dt=null,$o=null,nn=null,Se={},rn=0,aa=!1,De=null,Pe={device_fingerprint:!1,geolocation:!1,enhanced_context:!1,devtools_data_timestamp:0},_e={device_fingerprint:!1,geolocation:!1,enhanced_context:!1,devtools_data:!1};function Be(e){return na+e}function Ve(){if(De||(De=[]),!ra){ra=!0;try{const n=JSON.parse(h(ta)||"[]");if(Array.isArray(n)){for(const r of n)!r?.id||!r.payload||h(Be(r.id))||S(Be(r.id),JSON.stringify(r));n.every(r=>!r?.id||h(Be(r.id)))&&ne(ta)}}catch{$e.warn("legacy pending queue could not be migrated")}}const e=As(na),t=new Set;for(const n of e)try{const r=JSON.parse(h(n)||"null");if(!r||typeof r.id!="string"||!r.payload||pe?.workspaceId&&r.payload.workspace_id&&r.payload.workspace_id!==pe.workspaceId)continue;t.add(r.id),Zn.add(r.id),De.some(o=>o.id===r.id)||De.push(r)}catch{}return De=De.filter(n=>!Zn.has(n.id)||t.has(n.id)),De.sort((n,r)=>n.created_at-r.created_at)}function ca(e){Zn.has(e.id)&&!h(Be(e.id))||(S(Be(e.id),JSON.stringify(e)),h(Be(e.id))&&Zn.add(e.id))}function Wg(){const e=Ve();for(;e.length>qg||e.length>0&&JSON.stringify(e).length>Hg;){const t=e.shift();ne(Be(t.id)),$e.warn(`pending batch capacity reached: ${t.id} (${(t.payload.events||[]).length} events)`)}}function Gg(e){ne(Be(e.id)),De=(De||[]).filter(t=>t.id!==e.id)}function la(e){return(Array.isArray(e?.events)?e.events:[]).map(n=>n&&typeof n.event_id=="string"?n.event_id:"").filter(n=>n.length>0)}function Kg(){const e=new Set;for(const t of Ve())for(const n of la(t.payload))e.add(n);return e}function Jg(e){No=e}function Xg(e){const t=new Set,n=[];for(const r of e||[]){const o=r&&typeof r.event_id=="string"?r.event_id:"";if(o){if(t.has(o))continue;t.add(o)}n.push(r)}return n}function Yg(e){const t={};for(const n of Object.keys(e))n!=="devtools_data"&&(t[n]=e[n]);return JSON.parse(JSON.stringify(t))}function Zg(e,t){const n=re();e.batch_id=n,e.sent_at=new Date().toISOString(),e.attempt=1,e.sdk={version:jg,page_leave:t};const r={id:n,payload:Yg(e),attempt:0,status:"pending",created_at:Date.now(),next_at:Date.now(),unknown:0};return Ve().push(r),ca(r),Wg(),r}function ua(){const e=typeof window<"u"?window.__glueConfig?.ingestUrl:void 0;return typeof e=="string"&&/^https:\/\/[a-z0-9.-]+\/ingest$/i.test(e)?e:`${pe.supabaseUrl}/functions/v1/ingest-events`}function Qg(e,t,n){const r=e>=200&&e<300;return t?.ledger==="unavailable"||t?.accepted===!1?"failed":r&&t&&t.success===!0&&t.batch_id===n&&(t.accepted===!0||t.duplicate===!0)?"delivered":r?"unknown":"failed"}function em(e){return e===429?"throttled":e===0||e===408||e>=500?"transient":e>=400?"permanent":"transient"}function tm(e,t=Date.now()){if(!e)return null;const n=Number(e);if(Number.isFinite(n)&&n>=0)return Math.min(n*1e3,ia);const r=Date.parse(e);return Number.isNaN(r)?null:Math.min(Math.max(0,r-t),ia)}async function Do(e,t,n){let r=!1,o=null,i;const s=globalThis.AbortController;if(typeof s=="function"){const a=new s;i=a.signal,o=setTimeout(()=>{r=!0;try{a.abort()}catch{}},oa)}try{const a=await fetch(ua(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:n,...i?{signal:i}:{}});let c=null;try{c=await a.json()}catch{c=null}const l=Qg(a.status,c,e.id);if(l!=="failed")return{ack:l,failure:null,retryAfterMs:null};const u=em(a.status),d=tm(typeof a.headers?.get=="function"?a.headers.get("Retry-After"):null);return $e.error(`sync rejected (${a.status}, ${u})`,c),{ack:l,failure:u,retryAfterMs:d}}catch(a){return r?$e.warn(`sync request timed out after ${oa}ms`):$e.error("supabase sync error:",a),{ack:"failed",failure:"transient",retryAfterMs:null}}finally{o&&clearTimeout(o)}}let da=0;function nm(){return da}const rm=64e3;function om(e){try{if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return!1;const t=JSON.stringify(e),n=new Blob([t]).size;if(n>sa)return!1;const r=navigator.sendBeacon(ua(),new Blob([t],{type:"application/json"}));return r&&(da+=n),r}catch{return!1}}function fa(e){const t=e*Bg;return Math.max(0,Math.round(e-t+Math.random()*t*2))}function Qn(e,t){const n=typeof t=="string"?t:t.ack,r=typeof t=="string"?null:t.failure,o=typeof t=="string"?null:t.retryAfterMs;if(n==="delivered"){if(Gg(e),No)try{No(la(e.payload))}catch(i){$e.warn("delivered hook failed",i)}return}if(e.attempt+=1,n==="unknown"&&(e.unknown+=1),r&&(e.failure=r),r==="permanent")e.status="exhausted",e.next_at=null;else if(e.attempt>=zg)e.status="exhausted",e.next_at=null;else if(n==="blind")e.next_at=null;else if(r==="throttled")e.next_at=Date.now()+(o??fa(Ro[Ro.length-1]));else{const i=Ro[e.attempt-1];e.next_at=i===void 0?null:Date.now()+fa(i)}ca(e),im()}function im(){if($o||typeof setTimeout!="function")return;let e=1/0;for(const t of Ve())t.status!=="pending"||t.next_at===null||t.next_at<e&&(e=t.next_at);isFinite(e)&&($o=setTimeout(()=>{$o=null,er()},Math.max(0,e-Date.now())))}let Po=!1;async function er(e=!1){if(!(!pe||Po)){Po=!0;try{const t=Date.now();for(const n of Ve().slice()){if(n.status!=="pending"||!e&&(n.next_at===null||n.next_at>t))continue;const r={...n.payload,batch_id:n.id,attempt:n.attempt+1,sent_at:new Date().toISOString()};Qn(n,await Do(n,r,!1))}}finally{Po=!1}}}function sm(e){pe=e,!aa&&typeof window<"u"&&(aa=!0,window.addEventListener("pagehide",()=>{queueMicrotask(()=>{Fo(!0)})}),window.addEventListener("online",()=>{er(!0)})),er(!0)}function am(e){Se={...Se,...e}}function cm(e){const t=Date.now(),n={device_fingerprint:!!(Se.device_fingerprint&&!Pe.device_fingerprint&&!_e.device_fingerprint),geolocation:!!(Se.geolocation&&!Pe.geolocation&&!_e.geolocation),enhanced_context:!!(Se.enhanced_context&&!Pe.enhanced_context&&!_e.enhanced_context),devtools_data:!!(Se.devtools_data&&t-Pe.devtools_data_timestamp>=3e4&&!_e.devtools_data),devtools_data_timestamp:t};return n.device_fingerprint&&(e.device_fingerprint=Se.device_fingerprint),n.geolocation&&(e.geolocation=Se.geolocation),n.enhanced_context&&(e.enhanced_context=Se.enhanced_context),n.devtools_data&&(e.devtools_data=Se.devtools_data),n.device_fingerprint&&(_e.device_fingerprint=!0),n.geolocation&&(_e.geolocation=!0),n.enhanced_context&&(_e.enhanced_context=!0),n.devtools_data&&(_e.devtools_data=!0),n}function ga(e){e.device_fingerprint&&(Pe.device_fingerprint=!0),e.geolocation&&(Pe.geolocation=!0),e.enhanced_context&&(Pe.enhanced_context=!0),e.devtools_data&&(Pe.devtools_data_timestamp=Math.max(Pe.devtools_data_timestamp,e.devtools_data_timestamp))}function lm(e){e.device_fingerprint&&(_e.device_fingerprint=!1),e.geolocation&&(_e.geolocation=!1),e.enhanced_context&&(_e.enhanced_context=!1),e.devtools_data&&(_e.devtools_data=!1)}function um(e,t){const n=e,r=Kg(),o=Xg(n.events).filter(a=>!(a&&a.delivered===!0)).filter(a=>!(a&&typeof a.event_id=="string"&&r.has(a.event_id))),i={hostname:pe.hostname,profile:n.profile,sessions:n.sessions,events:o,touchpoints:Se.touchpoints};pe.workspaceId?i.workspace_id=pe.workspaceId:pe.workspaceApiKey&&(i.workspace_api_key=pe.workspaceApiKey);const s=Ws();return s.storage&&(i.meta=s),i}async function tr(e,t={}){if(!pe)return $e.warn("supabase sync not initialized"),!1;let n;try{const r=um(e,!!t.keepalive);n=cm(r);const o=Zg(r,!!t.keepalive);if(t.keepalive)return ma(o,r),ga(n),!0;const i=await Do(o,r,!1),s=i.ack;return Qn(o,i),s==="delivered"?(ga(n),$e.log(`synced batch ${o.id} (${s})`),!0):!1}catch(r){return $e.warn("could not queue tracking batch",r),!1}finally{n&&lm(n)}}function ma(e,t){const r=Ve().filter(o=>o.status==="pending").slice(-5);r.indexOf(e)===-1&&r.push(e);for(const o of r){const s={...o===e?t:o.payload,batch_id:o.id,attempt:o.attempt+1};if(!(new Blob([JSON.stringify(s)]).size>sa)){if(om(s)){Qn(o,"blind");continue}Do(o,s,!0).then(a=>Qn(o,a.ack==="failed"?"blind":a))}}}function dm(e,t=5e3){if(nn=e,rn||(rn=Date.now()),Date.now()-rn>=Vg){Fo();return}dt&&clearTimeout(dt),dt=setTimeout(()=>{dt=null;const n=nn;nn=null,rn=0,n&&tr(n())},t)}async function Fo(e=!1){dt&&(clearTimeout(dt),dt=null);const t=nn;if(nn=null,rn=0,!t){if(e){const n=Ve().slice(-1)[0];n&&ma(n,n.payload)}return!0}return tr(t(),{keepalive:e})}async function fm(e,t,n){return tr({profile:e,sessions:[t],events:[n]})}function gm(){const e=Date.now(),t=Ve().map(r=>({id:r.id,status:r.status,attempt:r.attempt,events:Array.isArray(r.payload.events)?r.payload.events.length:0,age_ms:e-r.created_at,...r.failure?{failure:r.failure}:{}})),n=t.filter(r=>r.status==="pending");return{pending:n.length,exhausted:t.length-n.length,events_pending:n.reduce((r,o)=>r+o.events,0),oldest_pending_age_ms:n.length?Math.max(...n.map(r=>r.age_ms)):0,batches:t}}function mm(){return pe!==null}const Z={initializeSupabaseSync:sm,onBatchDelivered:Jg,setExtendedData:am,syncToSupabase:tr,debouncedSync:dm,flushPendingSync:Fo,syncEvent:fm,drainPending:er,getDeliveryDiagnostics:gm,isSupabaseSyncEnabled:mm};function pm(e){const t=n=>{if(!n.isTrusted)return;const o=n.composedPath().find(c=>c instanceof Element)?.closest('a[href],button,[role="button"],input[type="submit"],input[type="button"]');if(!o||o.closest("[data-glue-ignore],[data-private]")||o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true")return;const i=o.getAttribute("href"),a={text:(o.getAttribute("aria-label")||o.getAttribute("data-framer-name")||o.textContent||"").trim().replace(/\s+/g," ").slice(0,200),id:o.id||void 0,element:o.tagName.toLowerCase(),path:location.pathname,keyboard:n.detail===0};if(i){try{const c=new URL(i,location.href);if(!["http:","https:","mailto:","tel:"].includes(c.protocol))return;c.username="",c.password="",a.href=c.href.slice(0,2048),a.link_type=c.protocol==="mailto:"?"email":c.protocol==="tel:"?"phone":o.hasAttribute("download")?"download":c.origin===location.origin?"internal":"outbound"}catch{return}e("link_click",a)}else e("button_click",a)};return document.addEventListener("click",t,{capture:!0,passive:!0}),()=>document.removeEventListener("click",t,!0)}function pa(e){const t=new URL(e);return t.origin+t.pathname+t.search+(/^#(?:\/|!)/.test(t.hash)?t.hash:"")}let Uo=Date.now(),nr=0,jo=0,qo=0,Ho=0,_a=0,on=Date.now(),Ct=!document.hidden,zo=!1,ha,ya=0,wa=0,ba=0,va=0,Sa=0,Ea=!1,It=[],Bo=0,ka=0,Vo=0,Aa=0,Ta=0,Ca=0,sn=[],an=[],Ia=0,xa=0,La=0,Ma=0,Oa=0,Wo,Go,Ra=0,Ko,Na=0,$a=0,Da=null,Pa=null,Fa=null,Ua=null;function _m(){if(Ea)return;Ea=!0;const e=ja(()=>{wa++,rr()},100);window.addEventListener("scroll",()=>{nr=Math.max(nr,window.scrollY),jo=Math.max(jo,window.scrollX),e()},{passive:!0}),document.addEventListener("visibilitychange",()=>{const t=Date.now(),n=t-on;Ct?qo+=n:Ho+=n,Ct=!document.hidden,on=t,_a++}),document.addEventListener("click",t=>{const n=Date.now();ya++,sn.push(n),sn.length>5&&sn.shift(),sn.filter(i=>n-i<500).length>=3&&(Aa++,sn.length=0);const o=t.target;o&&!hm(o)&&Ta++,rr()},{passive:!0}),document.addEventListener("keydown",t=>{const n=Date.now();if(ba++,Vo++,Bo>0){const r=n-Bo;r<2e3&&(It.push(r),It.length>20&&It.shift())}Bo=n,t.key==="Backspace"&&(ka++,an.push(n),an.length>5&&an.shift(),an.filter(o=>n-o<500).length>=3&&(Ca++,an.length=0)),rr()},{passive:!0}),document.addEventListener("touchstart",()=>{va++,rr()},{passive:!0}),document.addEventListener("mousemove",ja(()=>{Sa++},100),{passive:!0}),document.addEventListener("copy",()=>{Ia++},{passive:!0}),document.addEventListener("paste",()=>{xa++},{passive:!0}),document.addEventListener("cut",()=>{La++},{passive:!0}),window.addEventListener("beforeprint",()=>{Ma++}),document.addEventListener("contextmenu",()=>{Oa++},{passive:!0}),ym()}function hm(e){const t=["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL"],n=["button","link","checkbox","radio","tab","menuitem"];return!!(t.includes(e.tagName)||e.getAttribute("role")&&n.includes(e.getAttribute("role"))||e.onclick||e.getAttribute("onclick")||e.closest('a, button, [role="button"], [onclick]'))}function ym(){try{const e=performance.getEntriesByType("navigation")[0];if(e&&(Ko=e.responseStart-e.requestStart),"PerformanceObserver"in window){try{Da=new PerformanceObserver(t=>{const n=t.getEntries();Wo=n[n.length-1].startTime}),Da.observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{Pa=new PerformanceObserver(t=>{for(const n of t.getEntries())n.hadRecentInput||(Ra+=n.value)}),Pa.observe({type:"layout-shift",buffered:!0})}catch{}try{Fa=new PerformanceObserver(t=>{const n=t.getEntries()[0];Go=n.processingStart-n.startTime}),Fa.observe({type:"first-input",buffered:!0})}catch{}try{Ua=new PerformanceObserver(t=>{for(const n of t.getEntries())Na++,$a+=Math.max(0,n.duration-50)}),Ua.observe({type:"longtask",buffered:!0})}catch{}}}catch{}}function rr(){zo||(zo=!0,ha=Date.now())}function ja(e,t){let n=0;return(...r)=>{const o=Date.now();o-n>=t&&(n=o,e(...r))}}function qa(){const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return{effectiveType:e?.effectiveType,downlink:e?.downlink,rtt:e?.rtt,saveData:e?.saveData,type:e?.type,online:navigator.onLine}}function Ha(){const e=r=>{try{return window.matchMedia(r).matches}catch{return!1}};let t="no-preference";e("(prefers-color-scheme: dark)")?t="dark":e("(prefers-color-scheme: light)")&&(t="light");let n="no-preference";return e("(prefers-contrast: more)")?n="more":e("(prefers-contrast: less)")&&(n="less"),{colorScheme:t,reducedMotion:e("(prefers-reduced-motion: reduce)"),reducedData:e("(prefers-reduced-data: reduce)"),contrast:n,reducedTransparency:e("(prefers-reduced-transparency: reduce)"),forcedColors:e("(forced-colors: active)")}}function za(){const e=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight),t=window.innerHeight,n=e-t,r=n>0?Math.round(window.scrollY/n*100):0,o=n>0?Math.round(nr/n*100):0;return{scrollY:Math.round(window.scrollY),scrollX:Math.round(window.scrollX),maxScrollY:Math.round(nr),maxScrollX:Math.round(jo),scrollDepthPercent:Math.min(100,r),maxScrollDepthPercent:Math.min(100,o),documentHeight:e,viewportHeight:t}}function Ba(){const e=Date.now(),t=e-on,n=Ct?qo+t:qo,r=Ct?Ho:Ho+t;return{visibilityState:document.visibilityState,hasFocus:document.hasFocus(),timeVisible:n,timeHidden:r,visibilityChanges:_a,lastVisibleAt:Ct?e:on,lastHiddenAt:Ct?on:e}}function Va(){const t=Date.now()-Uo;let n,r,o,i;try{const s=performance.getEntriesByType("navigation")[0];s&&(n=Math.round(s.domContentLoadedEventEnd),r=Math.round(s.loadEventEnd));const a=performance.getEntriesByType("paint");for(const c of a)c.name==="first-paint"?o=Math.round(c.startTime):c.name==="first-contentful-paint"&&(i=Math.round(c.startTime))}catch{}return{pageLoadTime:t,timeOnPage:t,sessionStartTime:Uo,navigationStart:performance.timeOrigin||Uo,domContentLoaded:n,loadComplete:r,firstPaint:o,firstContentfulPaint:i}}function Wa(){return{hasInteracted:zo,firstInteractionTime:ha,clickCount:ya,scrollCount:wa,keyPressCount:ba,touchCount:va,mouseMovements:Sa}}function Ga(){const e=It.length>0?Math.round(It.reduce((t,n)=>t+n,0)/It.length):0;return{rageClicks:Aa,deadClicks:Ta,rapidBackspaces:Ca,typingCadence:e,backspaceRatio:Vo>0?Math.round(ka/Vo*100)/100:0,copyCount:Ia,pasteCount:xa,cutCount:La,printAttempts:Ma,contextMenuCount:Oa}}function Ka(){let e=0,t=0,n=0;try{const i=performance.getEntriesByType("resource");e=i.length;const s=window.location.hostname;for(const a of i){t+=a.transferSize||0;try{new URL(a.name).hostname!==s&&n++}catch{}}}catch{}let r,o;try{const i=performance.memory;i&&(r=i.usedJSHeapSize,o=i.jsHeapSizeLimit)}catch{}return{LCP:Wo?Math.round(Wo):void 0,FID:Go?Math.round(Go):void 0,CLS:Math.round(Ra*1e3)/1e3,INP:void 0,TTFB:Ko?Math.round(Ko):void 0,resourceCount:e,resourceTotalSize:t,thirdPartyRequests:n,longTaskCount:Na,totalBlockingTime:Math.round($a),usedJSHeapSize:r,jsHeapSizeLimit:o}}async function wm(){const e={},t=["notifications","geolocation","camera","microphone","clipboard-read"],n=["notifications","geolocation","camera","microphone","clipboard"];for(let r=0;r<t.length;r++)try{const o=await navigator.permissions.query({name:t[r]});e[n[r]]=o.state}catch{}return e}async function bm(){return new Promise(e=>{try{const t=document.createElement("div");t.className="adsbox ad-banner ad-placeholder pub_300x250 textAd",t.style.cssText="position:absolute;left:-9999px;width:1px;height:1px;",t.innerHTML="&nbsp;",document.body.appendChild(t),setTimeout(()=>{const n=t.offsetHeight===0||t.offsetWidth===0||t.clientHeight===0||window.getComputedStyle(t).display==="none"||window.getComputedStyle(t).visibility==="hidden";t.remove(),e(n)},50)}catch{e(!1)}})}async function vm(){try{if("storage"in navigator&&"estimate"in navigator.storage){const{quota:e}=await navigator.storage.estimate();return!!(e&&e<13e7)}return"webkitRequestFileSystem"in window?new Promise(e=>{window.webkitRequestFileSystem(0,1,()=>e(!1),()=>e(!0))}):null}catch{return null}}async function Sm(){const[e,t,n]=await Promise.all([wm(),bm(),vm()]);return{network:qa(),preferences:Ha(),scroll:za(),attention:Ba(),timing:Va(),interaction:Wa(),biometrics:Ga(),vitals:Ka(),permissions:e,adBlocker:t,incognito:n}}function Em(){return{network:qa(),preferences:Ha(),scroll:za(),attention:Ba(),timing:Va(),interaction:Wa(),biometrics:Ga(),vitals:Ka()}}function Ja(){const e=navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Xa(){return/Android/i.test(navigator.userAgent)}function Ya(){const e=navigator.userAgent;return/iPad|Android.*Tablet|Kindle|Silk|PlayBook/i.test(e)?"tablet":/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(e)||navigator.maxTouchPoints>0&&window.innerWidth<768?"mobile":navigator.maxTouchPoints>0&&window.innerWidth<1024?"tablet":"desktop"}function km(){return new Promise(e=>{if(!window.DeviceOrientationEvent){e(void 0);return}const t=n=>{window.removeEventListener("deviceorientation",t),e({alpha:n.alpha,beta:n.beta,gamma:n.gamma,absolute:n.absolute})};window.addEventListener("deviceorientation",t,{once:!0}),setTimeout(()=>{window.removeEventListener("deviceorientation",t),e(void 0)},500)})}function Am(){return new Promise(e=>{if(!window.DeviceMotionEvent){e(void 0);return}const t=n=>{window.removeEventListener("devicemotion",t),e({acceleration:{x:n.acceleration?.x??null,y:n.acceleration?.y??null,z:n.acceleration?.z??null},accelerationIncludingGravity:{x:n.accelerationIncludingGravity?.x??null,y:n.accelerationIncludingGravity?.y??null,z:n.accelerationIncludingGravity?.z??null},rotationRate:{alpha:n.rotationRate?.alpha??null,beta:n.rotationRate?.beta??null,gamma:n.rotationRate?.gamma??null},interval:n.interval})};window.addEventListener("devicemotion",t,{once:!0}),setTimeout(()=>{window.removeEventListener("devicemotion",t),e(void 0)},500)})}async function Za(){const e=Ja(),t=Xa(),n=Ya(),r=n==="mobile",o=n==="tablet";let i,s;return(r||o)&&([i,s]=await Promise.all([km(),Am()])),{isIOS:e,isAndroid:t,isMobile:r,isTablet:o,deviceType:n,deviceOrientation:i,deviceMotion:s}}const Qa={collectMobileData:Za,detectIOS:Ja,detectAndroid:Xa,detectDeviceType:Ya},Tm=Object.freeze(Object.defineProperty({__proto__:null,collectMobileData:Za,default:Qa},Symbol.toStringTag,{value:"Module"})),Jo=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],ec=["gclid","gclsrc","wbraid","gbraid","dclid","fbclid","ttclid","msclkid","li_fat_id","twclid","epik","ScCid","irclickid"],tc=[...Jo,...ec,"campaign_id","adset_id","ad_id","adgroup_id","placement","comet_source","comet_ad_id","comet_campaign","comet_ad_group","comet_network","comet_keyword","comet_placement","comet_type","comet_custom"],nc={gclid:["google","cpc"],gclsrc:["google","cpc"],wbraid:["google","cpc"],gbraid:["google","cpc"],dclid:["google","display"],fbclid:["facebook","paid_social"],ttclid:["tiktok","paid_social"],msclkid:["bing","cpc"],li_fat_id:["linkedin","paid_social"],twclid:["x","paid_social"],epik:["pinterest","paid_social"],ScCid:["snapchat","paid_social"],irclickid:["impact","affiliate"]},Cm={"google.":"google","bing.":"bing","yahoo.":"yahoo","duckduckgo.":"duckduckgo","baidu.":"baidu","yandex.":"yandex"};function Im(e){return/^fb\.\d\.\d+\.(.+)$/.exec(e)?.[1]}function xm(e,t=Date.now()){return`fb.1.${t}.${e}`}function rc(e,t){return Object.fromEntries(t.flatMap(n=>{const r=e.get(n)?.trim();return r?[[n,r]]:[]}))}function Lm(e,t){if(!e)return null;try{const n=new URL(e).hostname.toLowerCase();if(!n||n===t||n.endsWith(`.${t}`))return null;const r=Object.entries(Cm).find(([o])=>n.includes(o));return r?{source:r[1],medium:"organic",kind:"organic"}:{source:n.replace(/^www\./,""),medium:"referral",kind:"referral"}}catch{return null}}function Mm(){const e=h("glue_last_non_direct_acquisition");if(e)try{return JSON.parse(e)}catch{return}}function Om(e=90){const t=Mm();if(!t)return;const n=Date.parse(t.captured_at);if(!(!Number.isFinite(n)||Date.now()-n>e*864e5))return t}function oc(e=window.location.href,t=document.referrer){const n=new URL(e),r=rc(n.searchParams,Jo),o=rc(n.searchParams,tc.filter(d=>!Jo.includes(d))),i=ge("_fbp")||h("glue_fbp"),s=ge("_fbc")||h("glue_fbc");i&&(o.fbp=i),o.fbclid&&(!s||Im(s)!==o.fbclid)?o.fbc=xm(o.fbclid):s&&(o.fbc=s);let a=r.utm_source,c=r.utm_medium,l=a?"campaign":"direct";if(!a){const d=ec.find(w=>o[w]&&nc[w]);d&&([a,c]=nc[d],l="paid_click")}if(!a){const d=Lm(t,n.hostname.toLowerCase());d&&({source:a,medium:c,kind:l}=d)}const u={source:a||"direct",medium:c||"(none)",campaign:r.utm_campaign,kind:l,is_direct:!a,captured_at:new Date().toISOString(),landing_page:`${n.pathname}${n.search}${n.hash}`,referrer:t||void 0,utm:r,tracking:o};return P("glue_current_acquisition",JSON.stringify(u)),u.is_direct||(h("glue_first_acquisition")||S("glue_first_acquisition",JSON.stringify(u)),S("glue_last_non_direct_acquisition",JSON.stringify(u)),S("glue_last_non_direct_at",u.captured_at),u.tracking.fbp&&S("glue_fbp",u.tracking.fbp),u.tracking.fbc&&S("glue_fbc",u.tracking.fbc)),u}function Rm(e=window.location.href){const t=new URL(e).searchParams;return tc.some(n=>!!t.get(n))}function ic(e){return JSON.stringify({source:e.source,medium:e.medium,campaign:e.campaign,utm:e.utm,tracking:e.tracking})}const ie=B("journey"),N={sessions:null,events:null,sessionsDirty:!1,eventsDirty:!1,lastFlush:0},Nm=100;let Xo=null;function or(){Xo||(Xo=setTimeout(()=>{Xo=null,cn()},Nm))}function cn(){N.sessionsDirty&&N.sessions&&(S("glue_sessions",JSON.stringify(N.sessions)),N.sessionsDirty=!1),N.eventsDirty&&N.events&&(S("glue_events",JSON.stringify(N.events)),N.eventsDirty=!1),N.lastFlush=Date.now()}typeof window<"u"&&(window.addEventListener("beforeunload",cn),window.addEventListener("pagehide",cn));const Yo={maxEvents:1e3,maxSessions:100,autoTrackPageViews:!0,autoTrackClicks:!0,autoTrackFormSubmits:!0,autoSync:!1,syncInterval:6e4,piiCaptureEnabled:!0,formInjectionEnabled:!0},$m=100;let sc=!1,ac=!1;function ln(e="human"){const t=Oo(e),r=We().find(o=>o.session_id===t.session_id);return r||cc(t.session_id)}function Dm(){return cc(Pg("explicit").session_id)}function cc(e){const t=new URL(window.location.href),n=oc(),r=n.is_direct?Om():n,o=c=>n.utm[c]||n.tracking[c]||void 0,i={session_id:e,session_start:new Date().toISOString(),landing_page:`${t.pathname}${t.search}${t.hash}`,referrer:document.referrer,utm:{utm_source:o("utm_source"),utm_medium:o("utm_medium"),utm_campaign:o("utm_campaign"),utm_term:o("utm_term"),utm_content:o("utm_content"),utm_id:o("utm_id")},tracking:{gclid:o("gclid"),gclsrc:o("gclsrc"),wbraid:o("wbraid"),gbraid:o("gbraid"),dclid:o("dclid"),fbclid:o("fbclid"),fbc:o("fbc"),fbp:o("fbp"),ttclid:o("ttclid"),msclkid:o("msclkid"),li_fat_id:o("li_fat_id"),twclid:o("twclid"),epik:o("epik"),ScCid:o("ScCid"),irclickid:o("irclickid"),adset_id:o("adset_id"),ad_id:o("ad_id"),adgroup_id:o("adgroup_id"),campaign_id:o("campaign_id"),placement:o("placement"),comet_source:o("comet_source"),comet_ad_id:o("comet_ad_id"),comet_campaign:o("comet_campaign"),comet_ad_group:o("comet_ad_group"),comet_network:o("comet_network"),comet_keyword:o("comet_keyword"),comet_placement:o("comet_placement"),comet_type:o("comet_type"),comet_custom:o("comet_custom"),in_app_browser:h("glue_in_app_browser")||void 0,traffic_type:h("glue_traffic_type")||void 0,attribution_derived_from:h("glue_attribution_derived_from")||void 0,adblocker_detected:h("glue_adblocker_detected")||void 0},acquisition:n,conversion_attribution:r,pages_viewed:0,events_count:0,converted:!1};P("glue_session_start",i.session_start);const s=We();s.push(i);const a=Yo.maxSessions;return s.length>a&&s.splice(0,s.length-a),N.sessions=s,N.sessionsDirty=!0,or(),ie.log("New session started:",e),i}function lc(e){const t=j("glue_session_id");if(!t)return;const n=We(),r=n.findIndex(o=>o.session_id===t);if(r>=0){const o=n[r],i=new Date(o.session_start).getTime(),s=Date.now(),a=Math.floor((s-i)/1e3);n[r]={...o,...e,session_end:new Date().toISOString(),duration:a},N.sessions=n,N.sessionsDirty=!0,or(),ie.log("Session updated:",t)}}function We(){if(N.sessions!==null)return N.sessions;try{const e=h("glue_sessions");if(!e)return N.sessions=[],[];const t=JSON.parse(e);return N.sessions=Array.isArray(t)?t:[],N.sessions}catch(e){return ie.error("Error parsing sessions:",e),N.sessions=[],[]}}function Pm(){const e=Em();return{user_agent:navigator.userAgent,viewport:`${window.innerWidth}x${window.innerHeight}`,scroll_depth:e.scroll?.scrollDepthPercent,max_scroll_depth:e.scroll?.maxScrollDepthPercent,time_on_page:e.timing?.timeOnPage,visibility_state:e.attention?.visibilityState,has_focus:e.attention?.hasFocus,time_visible:e.attention?.timeVisible,interaction_count:(e.interaction?.clickCount||0)+(e.interaction?.scrollCount||0)+(e.interaction?.keyPressCount||0),network_type:e.network?.effectiveType,network_online:e.network?.online,color_scheme:e.preferences?.colorScheme,reduced_motion:e.preferences?.reducedMotion}}function uc(e){const t=e.properties;return e.event==="click"&&typeof t.x_pct=="number"&&typeof t.y_pct=="number"&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.vw=="number"&&typeof t.vh=="number"}function Fm(e){let t=0;for(let n=e.length-1;n>=0;n--)uc(e[n])&&(t++,t>$m&&e.splice(n,1))}const ir=[];function Zo(e){return ir.push(e),()=>{const t=ir.indexOf(e);t>=0&&ir.splice(t,1)}}function J(e,t={},n={}){const r=ln(n.activity??"human").session_id;e==="page_view"&&xo();const o=en(),i={event_id:re(),session_id:r,event:e,timestamp:new Date().toISOString(),properties:{...t,window_id:Io(),page_view_id:Ks(),...o?{recording_id:o}:{}},context:Pm()},s=un();s.push(i),uc(i)&&Fm(s);const a=Yo.maxEvents;s.length>a&&s.splice(0,s.length-a),N.events=s,N.eventsDirty=!0,or();const c=We(),l=c.findIndex(u=>u.session_id===r);if(l>=0&&(c[l].events_count=(c[l].events_count||0)+1,e==="page_view"&&(c[l].pages_viewed=(c[l].pages_viewed||0)+1),e==="form_submit"&&(c[l].converted=!0,c[l].conversion_event="form_submit"),N.sessions=c,N.sessionsDirty=!0),ie.enabled()){const u=i.properties&&Object.keys(i.properties).length?i.properties:void 0;ie.log(`event: ${e}`,...u?[u]:[],`(${i.event_id})`)}for(const u of ir)try{u(i)}catch(d){ie.warn("event hook failed:",d)}return Z.isSupabaseSyncEnabled()&&Z.debouncedSync(()=>sr(),1e4),i}function un(){if(N.events!==null)return N.events;try{const e=h("glue_events");if(!e)return N.events=[],[];const t=JSON.parse(e);return N.events=Array.isArray(t)?t:[],N.events}catch(e){return ie.error("Error parsing events:",e),N.events=[],[]}}function ft(){try{const n=h("glue_user_profile");if(n)return JSON.parse(n)}catch(n){ie.error("Error parsing user profile:",n)}const e=h("glue_user_id")||re();S("glue_user_id",e);const t={glue_user_id:e,traits:{},first_seen:h("glue_user_firstseen")||new Date().toISOString(),last_seen:new Date().toISOString(),identified:!1,context:{}};return S("glue_user_profile",JSON.stringify(t)),t}function gt(e){const t=ft(),n={...t,...e,last_seen:new Date().toISOString(),traits:{...t.traits,...e.traits||{}},context:{...t.context,...e.context||{}}};S("glue_user_profile",JSON.stringify(n)),ie.log("User profile updated")}function Um(e){e&&(gt({crm_id:e}),Z.isSupabaseSyncEnabled()&&Z.debouncedSync(()=>sr(),2e3))}function dc(e,t={}){const n=ft(),r=new Date().toISOString(),o=n.first_touch_traits||{...t,captured_at:r},i={...t,captured_at:r},s={...n.traits,...t};gt({email:e,traits:s,first_touch_traits:o,last_touch_traits:i,identified:!0,identified_at:n.identified_at||r}),J("user_identified",{email:e,traits_count:Object.keys(t).length}),Z.isSupabaseSyncEnabled()&&Z.debouncedSync(()=>sr()),ie.log("User identified:",e,"| Traits:",Object.keys(t))}let Ee=null;function jm(){Ee||(Ee={initial_utm_source:h("glue_initial_utm_source")||void 0,initial_utm_medium:h("glue_initial_utm_medium")||void 0,initial_utm_campaign:h("glue_initial_utm_campaign")||void 0,user_referrer:h("glue_user_referrer")||void 0,url_first:h("glue_url_first")||void 0,last_utm_source:h("glue_last_utm_source")||void 0,last_utm_medium:h("glue_last_utm_medium")||void 0,last_utm_campaign:h("glue_last_utm_campaign")||void 0});const e=We(),t=e[e.length-1];return{first_touch:{utm_source:Ee.initial_utm_source,utm_medium:Ee.initial_utm_medium,utm_campaign:Ee.initial_utm_campaign,referrer:Ee.user_referrer,landing_page:Ee.url_first},last_touch:{utm_source:Ee.last_utm_source,utm_medium:Ee.last_utm_medium,utm_campaign:Ee.last_utm_campaign,referrer:t?.referrer,landing_page:t?.landing_page}}}function sr(){const e=dn();return{...e,events:e.events.filter(t=>!t.delivered)}}function fc(e){if(!e||e.length===0)return;const t=new Set(e);let n=!1;for(const r of un())!r.delivered&&t.has(r.event_id)&&(r.delivered=!0,n=!0);n&&(N.eventsDirty=!0,or())}function dn(){const e=ft(),t=We(),n=un(),r=new Date(e.first_seen),o=new Date(e.last_seen),i=Math.floor((o.getTime()-r.getTime())/(1e3*60*60*24)),s=t.map(c=>({date:c.session_start.split("T")[0],source:c.utm.utm_source||"direct",medium:c.utm.utm_medium,campaign:c.utm.utm_campaign})),a=jm();return{profile:e,sessions:t,events:n,summary:{total_sessions:t.length,total_events:n.length,converted_sessions:t.filter(c=>c.converted).length,first_visit:e.first_seen,last_visit:e.last_seen,days_active:i,attribution:a,touchpoints:s}}}function qm(){N.sessions=[],N.events=[],N.sessionsDirty=!0,N.eventsDirty=!0,cn(),S("glue_user_profile",""),Ee=null,ie.log("Journey data cleared")}function Hm(){const e=j("glue_session_id");if(!e)return{session:void 0,events:[]};const n=We().find(o=>o.session_id===e),r=un().filter(o=>o.session_id===e);return{session:n,events:r}}function zm(){const e=dn();return JSON.stringify(e,null,2)}const Bm=new Set(["fname","lname","first_name","last_name","full_name","name","glue_fname","glue_lname","glue_first_name","glue_last_name","glue_full_name","glue_name","mobile","phone","phone_number","work_phone","home_phone","glue_mobile","glue_phone","glue_phone_number","glue_work_phone","glue_home_phone","address","address1","address2","street","city","state","zip","zipcode","postal_code","country","glue_address","glue_address1","glue_address2","glue_street","glue_city","glue_state","glue_zip","glue_zipcode","glue_postal_code","glue_country","company","company_name","organization","job_title","title","department","industry","glue_company","glue_company_name","glue_organization","glue_job_title","glue_title","glue_department","glue_industry","website","birthday","dob","age","gender","glue_website","glue_birthday","glue_dob","glue_age","glue_gender","linkedin","twitter","facebook","instagram","glue_linkedin","glue_twitter","glue_facebook","glue_instagram"]);function Vm(){const e=new URLSearchParams(window.location.search),t=e.get("email")||e.get("glue_email"),n={};let r=!1;if(e.forEach((o,i)=>{if(Bm.has(i)){const s=i.replace("glue_","");n[s]=o,r=!0}}),t&&t.includes("@"))dc(t,n),ie.log("Auto-identified from URL params:",t,"with traits:",Object.keys(n));else if(r){const o=ft();gt({traits:{...o.traits,...n}}),ie.log("Updated profile with PII from URL params (no email):",Object.keys(n))}}let gc=0,mc=-1,pc=-1;const Wm=50;let Qo=null;function Gm(){return Qo===null&&(Qo=Qa.detectDeviceType()),Qo}function Km(e){if(!e||!e.tagName)return"";const t=e.tagName.toLowerCase();let n=t;if(e.id)n=`${t}#${e.id}`;else{const r=typeof e.className=="string"?e.className.trim().split(/\s+/)[0]:"";if(r)n=`${t}.${r}`;else if(e.parentElement){let o=0;const i=e.parentElement.children;for(let s=0;s<i.length&&!(i[s].tagName===e.tagName&&(o++,i[s]===e));s++);n=`${t}:nth-of-type(${o})`}}return n.length>100?n.slice(0,100):n}function Jm(){document.addEventListener("click",e=>{const t=Date.now(),n=e.target,r=e.clientX,o=e.clientY,i=t-gc<Wm&&r===mc&&o===pc;if(e.isTrusted&&e.detail>0&&!i){gc=t,mc=r,pc=o;const s=window.innerWidth,a=window.innerHeight;J("click",{x_pct:Math.round(r/(s||1)*100),y_pct:Math.round(o/(a||1)*100),x:r,y:o,vw:s,vh:a,selector:Km(n),device_type:Gm()})}},{passive:!0})}let ei=!1,ti=!1;function Xm(){let e=!1;const t=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;const n=document.documentElement.scrollHeight-window.innerHeight;if(n>0){const r=Math.round(window.scrollY/n*100);!ei&&r>=50&&(ei=!0,J("scroll_depth_50",{percent:r})),!ti&&r>=75&&(ti=!0,J("scroll_depth_75",{percent:r}))}ei&&ti&&window.removeEventListener("scroll",t)}))};window.addEventListener("scroll",t,{passive:!0})}function Ym(){document.addEventListener("submit",e=>{const t=e.target;J("form_submit",{form_id:t.getAttribute("data-glue-form")||t.getAttribute("id")||t.getAttribute("name")||"",form_name:t.getAttribute("data-glue-form")||t.getAttribute("name")||t.getAttribute("id")||"",form_action:t.action})})}function Zm(){const e=()=>{cn(),lc({session_end:new Date().toISOString()})};window.addEventListener("beforeunload",e),document.addEventListener("visibilitychange",()=>{document.hidden&&e()})}function Qm(){if(ac)return;ac=!0;let e=window.location.href;const t=()=>{if(window.location.href===e)return;const o=e;e=window.location.href,pa(o)!==pa(e)&&(Ef(),queueMicrotask(()=>{const i=ln(),s=oc();Rm()&&(!i.acquisition||ic(s)!==ic(i.acquisition))&&(lc({session_end:new Date().toISOString()}),Dm()),J("page_view",{url:window.location.href,title:document.title,path:window.location.pathname,referrer:o,navigation_type:"spa"})}))},n=history.pushState,r=history.replaceState;history.pushState=function(...o){n.apply(this,o),t()},history.replaceState=function(...o){r.apply(this,o),t()},window.addEventListener("popstate",t)}function ep(e={}){if(sc)return;sc=!0;const t={...Yo,...e};Z.onBatchDelivered(fc),Og(window?.__glueConfig?.workspaceId),Yn(),ln(),t.autoTrackPageViews&&(J("page_view",{url:window.location.href,title:document.title,path:window.location.pathname,referrer:document.referrer}),Qm()),gt({context:{user_agent:navigator.userAgent,browser:navigator.userAgent.split(" ").pop(),os:navigator.platform,geolocation:h("glue_user_geolocation")||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:navigator.language}}),t.piiCaptureEnabled?Vm():ie.log("PII capture disabled via privacy settings"),t.autoTrackClicks&&pm(J),t.autoTrackClickMap&&Jm(),t.autoTrackScroll&&Xm(),t.autoTrackFormSubmits&&Ym(),Zm(),ie.log("Journey tracking initialized")}const he={initializeJourneyTracking:ep,trackEvent:J,identifyUser:dc,setCrmId:Um,getCurrentSession:ln,getCompleteUserData:dn,getPendingSyncData:sr,markEventsDelivered:fc,getUserProfile:ft,updateUserProfile:gt,getSessions:We,getEvents:un,getCurrentSessionJourney:Hm,exportJourneyData:zm,clearJourneyData:qm},ni=B("config-refresh"),_c=5*60*1e3,tp=60*1e3,np=1e4;let ar=null,hc=null,cr=null,yc=!1,wc=0,ri="";function rp(){return _c+(Math.random()*2-1)*tp}function op(){return`${ar.supabaseUrl}/functions/v1/glue?workspace-id=${encodeURIComponent(ar.workspaceId)}&config=1`}function ip(e){return!!(e&&typeof e.config_version=="string"&&e.tracking&&typeof e.tracking=="object"&&e.tracking.features&&typeof e.tracking.features=="object")}async function sp(){if(!ar)return null;let e=null,t;const n=globalThis.AbortController;if(typeof n=="function"){const r=new n;t=r.signal,e=setTimeout(()=>{try{r.abort()}catch{}},np)}try{const r=await fetch(op(),{method:"GET",credentials:"omit",...t?{signal:t}:{}});if(!r.ok)return null;const o=await r.json();return ip(o)?o:(ni.warn("config endpoint returned an unrecognised shape; keeping current configuration"),null)}catch{return null}finally{wc=Date.now(),e&&clearTimeout(e)}}async function bc(){const e=await sp();if(e&&e.config_version!==ri){ri=e.config_version,ni.log(`configuration changed: ${e.config_version}`);try{hc?.(e)}catch(t){ni.warn("config listener failed:",t)}}}function oi(){typeof setTimeout=="function"&&(cr&&clearTimeout(cr),cr=setTimeout(()=>{cr=null,typeof document>"u"||document.visibilityState!=="hidden"?bc().finally(oi):oi()},rp()))}function ap(e,t,n=""){!e.supabaseUrl||!e.workspaceId||(ar=e,hc=t,ri=n,oi(),!yc&&typeof document<"u"&&(yc=!0,document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Date.now()-wc>=_c&&bc()})))}const fn=[],cp=1500,lp=200,up="capture_all",dp=new Set(["performance_vitals","session_recording","console_logs","network_diagnostics"]),fp=new Set(["session_recording"]),gn=new Map;let ii={},vc={},mn="";function se(e){fn.some(t=>t.name===e.name)||fn.push(e)}function gp(){return fn.filter(e=>gn.get(e.name)?.state==="active").map(e=>e.name)}function mp(e){let t=gn.get(e.name);return t||(t={plugin:e,state:"idle",cleanup:null,extraCleanups:[],disposers:[],starting:null,configVersion:""},gn.set(e.name,t)),t}function pp(){let e=new Map,t=0;return{take(n,r=lp){const o=e.get(n)??0;return o>=r||t>=cp?!1:(e.set(n,o+1),t+=1,!0)},reset(){e=new Map,t=0}}}const si=pp();let Sc=!1;function _p(){Sc||(Sc=!0,Zo(e=>{e.event==="page_view"&&si.reset()}))}let Ec=!1;const ai=new Set;let ci=!1;function hp(){if(Ec||typeof window>"u")return;Ec=!0;const e=t=>{if(!ci){ci=!0;for(const n of Array.from(ai))try{n(t)}catch(r){C.warn("plugin leave handler failed:",r)}}};window.addEventListener("pagehide",()=>e("pagehide")),window.addEventListener("beforeunload",()=>e("beforeunload")),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?e("hidden"):ci=!1})}function yp(e){const{plugin:t}=e,n=t.feature,r=vc[n]??{},o=i=>(e.disposers.push(i),i);return{features:ii,config:r,configVersion:mn,track(i,s={}){if(si.take(i))try{J(i,s,{activity:dp.has(n)?"passive":"human"})}catch(a){C.warn(`plugin ${t.name} track failed:`,a)}},onEvent(i){return o(Zo(s=>{try{i(s)}catch(a){C.warn(`plugin ${t.name} onEvent failed:`,a)}}))},onNavigate(i){let s=typeof window<"u"?window.location.href:null;return o(Zo(a=>{if(a.event!=="page_view")return;const c=window.location.href,l={url:c,previousUrl:s};s=c;try{i(l)}catch(u){C.warn(`plugin ${t.name} onNavigate failed:`,u)}}))},onLeave(i){return hp(),ai.add(i),o(()=>ai.delete(i))},budget:si,route:()=>window.location.pathname,log:C,ids:ut,onCleanup(i){typeof i=="function"&&e.extraCleanups.push(i)},loadModule(i,s){return Yr(i,s)},sampled(){return Xn(n,r.sample_rate,mn)}}}async function li(e){if(e.state==="active")return!0;if(e.starting)return e.starting;e.state="starting";const t=yp(e);return e.starting=(async()=>{try{e.plugin.modules?.length&&await Promise.all(e.plugin.modules.map(r=>Yr(r.name,r.version)));const n=await e.plugin.init(t);return e.cleanup=typeof n=="function"?n:null,e.state="active",e.configVersion=mn,!0}catch(n){return C.warn(`plugin ${e.plugin.name} failed to initialise:`,n),e.state="failed",kc(e),!1}finally{e.starting=null}})(),e.starting}function kc(e){for(const t of e.extraCleanups.slice().reverse())try{t()}catch(n){C.warn(`plugin ${e.plugin.name} cleanup failed:`,n)}if(e.extraCleanups=[],e.cleanup)try{e.cleanup()}catch(t){C.warn(`plugin ${e.plugin.name} cleanup failed:`,t)}e.cleanup=null;for(const t of e.disposers.splice(0))try{t()}catch(n){C.warn(`plugin ${e.plugin.name} unsubscribe failed:`,n)}}function ui(e){const t=gn.get(e);return!t||t.state!=="active"&&t.state!=="failed"?!1:(kc(t),t.state="stopped",C.log(`capture plugin stopped: ${e}`),!0)}function wp(e,t){return t[up]===!1?!1:t[e.feature]===!0}async function Ac(e,t,n){ii=e??{},vc=t??{},mn=n??"",_p(),Yn(),bp();const r=[];for(const i of fn){const s=mp(i);if(!wp(i,ii)){s.state==="active"&&ui(i.name);continue}if(s.state==="active"){s.configVersion!==mn&&(ui(i.name),r.push(li(s)));continue}s.state!=="failed"&&r.push(li(s))}await Promise.all(r);const o=gp();o.length&&C.log("capture plugins active:",o.join(", "))}let Tc=!1;function bp(){Tc||(Tc=!0,Ys(()=>{for(const e of fn){if(!fp.has(e.feature))continue;const t=gn.get(e.name);!t||t.state!=="active"||(ui(e.name),li(t))}}))}let Cc=!1;function vp(e={},t={},n=""){const r=Ac(e,t,n);if(!Cc){Cc=!0;const o=globalThis?.__glueConfig;o?.supabaseUrl&&o?.workspaceId&&ap({supabaseUrl:o.supabaseUrl,workspaceId:o.workspaceId},i=>{Ac(i.tracking.features??{},i.tracking.featureConfig??{},i.config_version)},n)}return r}const Sp=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Ep=/^[0-9a-f]{24}$/i,kp=/^\d+$/;function lr(e,t){if(Array.isArray(t)){for(const r of t)if(!(!r||!r.pattern||!r.template))try{if(new RegExp(r.pattern).test(e))return String(r.template)}catch{}}const n=String(e||"/").split("/");for(let r=1;r<n.length;r++){const o=n[r];o&&(Sp.test(o)||Ep.test(o)||kp.test(o)||r>1&&o.length>=12)&&(n[r]=":id")}return n.join("/")||"/"}const Ic=1e3,Ap=5e3,Tp=6e4,Cp=1e3,xc=.5,di=40,Lc=50,Ip=500,xp=[25,50,75,100],Lp="[data-glue-section],section[id],article[id],h1[id],h2[id]",Ge=()=>Date.now(),pn={passive:!0},Mc={passive:!0,capture:!0};function _n(e,t=80){return String(e||"").replace(/\s+/g," ").trim().slice(0,t)}function Mp(e){if(typeof window>"u"||typeof document>"u")return;const t=document,n=e.config&&e.config.route_patterns,r=A=>lr(A,n),o=()=>t.visibilityState==="hidden",i=A=>$=>{try{A($)}catch(F){e.log.warn("engagement:",F)}},s=(A,$,F,Ie)=>A.addEventListener($,F,Ie);let a="",c="",l="",u=0,d=0,w=0,g=0,p=0,k=!1,m=0,_=[],v=0,f=0,b=0,I=0,E=!1,T=!1,M=!1,z=null,Ce=0,ae=null,y=null,x=null,L=null,D=0,O=new WeakSet;const q=new Map,R=[];let He=!1;const we=()=>{z!=null&&(clearInterval(z),z=null)},St=()=>{if(T||o())return;const A=Ge();A-p<=Ap?g+=Ic:!k&&A-p>=Tp&&(k=!0,e.track("idle_start",{path:a}))},be=()=>{if(!(z!=null||o()))try{z=setInterval(i(St),Ic)}catch{z=null}},Bt=()=>{const A=Ge();k&&(k=!1,e.track("idle_end",{path:a,idle_ms:Math.round(A-p)})),p=A},st=()=>Math.round(Ge()-u),d0=(A,$,F)=>{v>=di||(v+=1,e.track("section_view",{section_id:_n(A.getAttribute("data-glue-section")||A.id,120)||"section-"+v,section_label:f0(A),visible_ms:Math.round(Ge()-F),viewport_pct:Math.round($*100),order:v}))},f0=A=>{const $=A.getAttribute("data-glue-section-label")||A.getAttribute("aria-label");if($)return _n($);if(/^H[1-3]$/.test(A.tagName))return _n(A.textContent);let F=null;try{F=A.querySelector("h1,h2,h3")}catch{}return _n(F?F.textContent:"")},zd=()=>{if(!y||D>=di)return;let A;try{A=t.querySelectorAll(Lp)}catch{return}for(let $=0;$<A.length&&D<di;$++){const F=A[$];O.has(F)||(O.add(F),D+=1,y.observe(F))}},g0=()=>{D=0,O=new WeakSet,q.forEach(clearTimeout),q.clear(),y&&y.disconnect(),zd()},m0=()=>{if(typeof IntersectionObserver=="function")try{y=new IntersectionObserver(i(A=>{for(const $ of A){const F=$.target;if($.isIntersecting&&$.intersectionRatio>=xc){if(q.has(F))continue;const Ie=Ge(),Re=$.intersectionRatio;q.set(F,setTimeout(i(()=>{q.delete(F),y&&y.unobserve(F),d0(F,Re,Ie)}),Cp))}else q.has(F)&&(clearTimeout(q.get(F)),q.delete(F))}}),{threshold:[xc]})}catch{y=null}},Bd=()=>{const $=((t.documentElement||{}).scrollHeight||0)-(window.innerHeight||0);if($<=0)return;const F=window.scrollY||window.pageYOffset||0,Ie=Math.max(0,Math.min(100,Math.round(F/$*100)));Ie>m&&(m=Ie);for(const Re of xp)Ie<Re||_.indexOf(Re)>=0||(_.push(Re),e.track("scroll_depth",{percent:Re,path:a,route_template:r(a),ms_since_page:st()}))},p0=i(()=>{if(Bt(),He)return;He=!0;const A=()=>{He=!1;try{Bd()}catch{}};typeof requestAnimationFrame=="function"?requestAnimationFrame(A):setTimeout(A,50)}),Vd=()=>{const A=Ge();a=e.route(),c=a+(window.location.search||""),l=_n(t.title,200),u=A,p=A,d=0,w=o()?0:A,g=0,k=!1,m=0,_=[],v=0,f=0,b=0,I=0,E=!1,T=!1,Ce=0,we(),be(),g0(),Bd()},Wd=A=>{if(T)return;T=!0,we();const $=Ge();e.track("page_engaged",{path:a,route_template:r(a),title:l,engaged_ms:g,visible_ms:Math.round(d+(w?$-w:0)),total_ms:Math.round($-u),max_scroll_pct:m,scroll_milestones:_.slice(),sections_seen:v,clicks:b,keypresses:I,leave_reason:A})},_0=()=>{const A=ae||"push";return ae=null,A};try{const A=window.history,$=(F,Ie)=>{const Re=A[F];if(typeof Re!="function"||Re.__glueNav)return;const Gd=function(){return ae=Ie,Re.apply(this,arguments)};Gd.__glueNav=!0,A[F]=Gd};$("pushState","push"),$("replaceState","replace")}catch{}s(window,"hashchange",()=>{ae="hash"},pn),s(window,"popstate",i(()=>{ae="pop";const A=e.route(),$=R.lastIndexOf(A);$>=0&&$<R.length-1&&(R.length=$+1,e.track("back_navigation",{from_path:a,to_path:A}))}),pn),s(window,"pageshow",i(A=>{A&&A.persisted&&e.track("back_navigation",{from_path:null,to_path:e.route()})}),pn);for(const A of["pointerdown","pointermove","touchstart","wheel","keydown","click"]){const $=A==="keydown",F=A==="click";s(t,A,i(()=>{Bt(),$?I+=1:F&&(b+=1)}),Mc)}if(s(window,"scroll",p0,pn),s(t,"mouseout",i(A=>{if(!E&&!A.relatedTarget&&!((A.clientY==null?1:A.clientY)>0)){try{if(typeof window.matchMedia=="function"&&!window.matchMedia("(pointer: fine)").matches)return}catch{}E=!0,e.track("exit_intent",{ms_since_page:st(),max_scroll_pct:m})}}),Mc),s(t,"visibilitychange",i(()=>{const A=Ge();o()?(w&&(d+=A-w,w=0),we(),Ce=A,f<Lc&&(f+=1,e.track("tab_hidden",{path:a}))):(w=A,p=A,be(),f<Lc&&(f+=1,e.track("tab_visible",{path:a,hidden_ms:Ce?Math.round(A-Ce):0})))}),pn),typeof MutationObserver=="function")try{x=new MutationObserver(i(()=>{L==null&&(L=setTimeout(i(()=>{L=null,zd()}),Ip))})),x.observe(t.documentElement||t,{childList:!0,subtree:!0})}catch{x=null}return e.onNavigate(()=>{const A=e.route(),$=A+(window.location.search||"");if(M&&$===c)return;const F=M?a:null,Ie=F===null?"load":_0();Wd("navigate"),Vd(),R[R.length-1]!==A&&R.push(A),e.track("route_change",{from_path:F,to_path:A,route_template:r(A),method:Ie,title:l})}),e.onLeave(A=>Wd(A)),m0(),Vd(),M=!0,R.push(a),()=>{we(),y&&y.disconnect(),x&&x.disconnect()}}se({name:"engagement",feature:"engagement",init:Mp});const Op=40,Rp=800,Np=1e3,fi=30,$p=500,Dp="video,audio",Pp="input[type=search],input[name=q],input[name=s],input[name=query],input[name=search]",Fp="q,s,query,search".split(","),Up=[25,50,75],jp=[1e3,3e3,1e4],qp=()=>Date.now(),Ke={passive:!0},Oc={passive:!0,capture:!0};function Rc(e){return String(e.getAttribute("title")||e.getAttribute("aria-label")||e.getAttribute("data-title")||"").slice(0,120)}function Nc(e){const t=e&&e.nodeType===1?e:e&&e.parentElement,n=t&&t.closest&&t.closest("[data-glue-section],[id]");return n?String(n.getAttribute("data-glue-section")||n.id).slice(0,120):null}function Hp(e){if(typeof window>"u"||typeof document>"u")return;const t=document,n=y=>x=>{try{y(x)}catch(L){e.log.warn("content:",L)}},r=(y,x,L,D)=>y.addEventListener(x,L,D);let o=0,i=0,s=0,a=0,c=null,l=null,u=null,d=null;const w=[],g=new WeakMap,p=[],k=new WeakMap,m=()=>{try{const y=window.getSelection&&window.getSelection();return y?String(y.toString()||""):""}catch{return""}},_=()=>{try{const y=window.getSelection&&window.getSelection();return y?y.anchorNode||y.focusNode:null}catch{return null}};r(t,"copy",n(()=>{const y=m();if(!y)return;const x=qp();o>=fi||x-s<Np||(s=x,o+=1,e.track("text_copied",{chars:y.length,section_id:Nc(_()),path:e.route()}))}),Oc),r(t,"selectionchange",n(()=>{i>=fi||(clearTimeout(c),c=setTimeout(n(()=>{c=null;const y=m();y.length<Op||y.length===a||i>=fi||(a=y.length,i+=1,e.track("text_selected",{chars:y.length,section_id:Nc(_())}))}),Rp))}),Ke),r(window,"beforeprint",n(()=>e.track("print_intent",{path:e.route()})),Ke);try{const y=navigator;if(typeof y.share=="function"&&!y.share.__glueContent){const x=y.share,L=function(...D){const O=x.apply(this,D);try{O&&typeof O.then=="function"&&O.then(()=>e.track("share",{path:e.route(),target:"web_share"}),()=>{})}catch{}return O};L.__glueContent=!0,y.share=L}}catch{}const v=(y,x)=>{e.track("site_search",{query_length:y,results_path:x})},f=()=>{let y;try{y=new URLSearchParams(window.location.search||"")}catch{return}for(const x of Fp){const L=y.get(x);if(L==null)continue;const D=e.route()+"?"+x;if(D===d)return;d=D,v(L.length,e.route());return}};r(t,"submit",n(y=>{const x=y&&y.target;if(!x||x.tagName!=="FORM")return;let L=null;try{L=x.querySelector(Pp)}catch{}if(!L)return;let D=e.route();const O=x.getAttribute("action");if(O)try{D=new URL(O,window.location.href).pathname}catch{}v(String(L.value||"").length,D)}),Oc);const b=(y,x,L,D,O,q)=>{const R={provider:x,video_id:L.id,title:L.title||null,position_s:Math.round(D),duration_s:O>0&&O<1/0?Math.round(O):null};q!=null&&(R.percent=q),e.track(y,R)},I=(y,x,L,D)=>{if(!(D>0)||D===1/0)return;const O=L/D*100;for(const q of Up)O<q||x.seen.indexOf(q)>=0||(x.seen.push(q),b("video_progress",y,x,L,D,q))},E=y=>{if(g.has(y))return;const x=y.currentSrc||y.getAttribute("src")||"",L={id:y.id||(x?String(x).split("?")[0].split("/").pop():"")||"media",title:Rc(y),seen:[]};g.set(y,L);const D=()=>[Number(y.currentTime)||0,Number(y.duration)];r(y,"play",n(()=>b("video_play","html5",L,D()[0],D()[1])),Ke),r(y,"pause",n(()=>{y.ended||b("video_pause","html5",L,D()[0],D()[1])}),Ke),r(y,"timeupdate",n(()=>{const[O,q]=D();I("html5",L,O,q)}),Ke),r(y,"ended",n(()=>{const[,O]=D();L.seen.indexOf(100)>=0||(L.seen.push(100),b("video_complete","html5",L,O,O,100))}),Ke)},T=(y,x)=>{try{y.contentWindow&&y.contentWindow.postMessage(x,"*")}catch{}},M=y=>{if(k.has(y))return;const x=y.getAttribute&&y.getAttribute("src")||"";if(!x)return;let L;try{L=new URL(x,window.location.href)}catch{return}const D=L.hostname;let O,q;if(/(^|\.)player\.vimeo\.com$/i.test(D))O=L.pathname.split("/").pop()||"",q=()=>{for(const we of["play","pause","ended","timeupdate"])T(y,JSON.stringify({method:"addEventListener",value:we}))};else if(/(^|\.)youtube(-nocookie)?\.com$/i.test(D)&&L.pathname.indexOf("/embed/")===0){if(L.searchParams.get("enablejsapi")!=="1"&&!window.YT)return;O=L.pathname.slice(7),q=()=>{T(y,JSON.stringify({event:"listening",id:1,channel:"widget"})),T(y,JSON.stringify({event:"command",func:"addEventListener",args:["onStateChange"],id:1,channel:"widget"}))}}else return;const R={id:O.slice(0,64),title:Rc(y),seen:[],send:q};k.set(y,R),p.push(y);const He=n(()=>{R.open||q()});r(y,"load",He,Ke);for(const we of jp)w.push(setTimeout(He,we));q()},z=y=>{y.resent||!y.send||(y.resent=!0,y.send())},Ce=y=>{for(const x of p)try{if(x.contentWindow===y)return x}catch{}return null};r(window,"message",n(y=>{const x=String(y&&y.origin||""),L=x.indexOf("youtube")>=0,D=x.indexOf("vimeo")>=0;if(!L&&!D)return;let O=y.data;if(typeof O=="string")try{O=JSON.parse(O)}catch{return}if(!O||typeof O!="object")return;const q=Ce(y.source);if(!q)return;const R=k.get(q);if(!R)return;if(R.open=!0,L){const be=O.info;if(!be)return;const Bt=Number(be.currentTime)||0,st=Number(be.duration);be.playerState!=null&&be.playerState!==R.state&&(R.state=be.playerState,be.playerState===1?(z(R),b("video_play","youtube",R,Bt,st)):be.playerState===2?b("video_pause","youtube",R,Bt,st):be.playerState===0&&R.seen.indexOf(100)<0&&(R.seen.push(100),b("video_complete","youtube",R,st,st,100))),I("youtube",R,Bt,st);return}const He=O.data||{},we=Number(He.seconds)||0,St=Number(He.duration);if(O.event==="play"){if(R.state===1)return;R.state=1,z(R),b("video_play","vimeo",R,we,St)}else if(O.event==="pause"){if(R.state===2)return;R.state=2,b("video_pause","vimeo",R,we,St)}else if(O.event==="ended"){if(R.state=0,R.seen.indexOf(100)>=0)return;R.seen.push(100),b("video_complete","vimeo",R,St,St,100)}else O.event==="timeupdate"&&I("vimeo",R,we,St)}),Ke);const ae=()=>{try{const y=t.querySelectorAll(Dp);for(let x=0;x<y.length;x++)E(y[x])}catch{}try{const y=t.querySelectorAll("iframe");for(let x=0;x<y.length;x++)M(y[x])}catch{}};if(typeof MutationObserver=="function")try{l=new MutationObserver(n(()=>{u==null&&(u=setTimeout(n(()=>{u=null,ae()}),$p))})),l.observe(t.documentElement||t,{childList:!0,subtree:!0})}catch{l=null}return e.onNavigate(()=>{o=0,i=0,s=0,a=0,f(),ae()}),e.onLeave(()=>{clearTimeout(c),c=null}),ae(),f(),()=>{l&&l.disconnect(),clearTimeout(c);for(const y of w)clearTimeout(y);w.length=0}}se({name:"content",feature:"content",init:Hp});const zp=600,Bp=30,Vp=3,Wp=800,Gp=1e3,Kp=3,Jp=80,Xp=120,hn=300,$c='a[href],button,[role="button"],input[type="submit"],input[type="button"],summary,select,label,[onclick]',Yp=/\/functions\/v1\/(?:ingest-events|glue)\b|glue\.min\.js/,Dc=Symbol.for("glue.errorBus");function Zp(){if(typeof window>"u")return null;const e=window;let t=e[Dc];if(!t){const n=new Set;let r="",o=0;t={subs:n,sourced:!1,publish(i){const s=Date.now();if(!(i===r&&s-o<50)){r=i,o=s;for(const a of Array.from(n))try{a(i)}catch{}}}},e[Dc]=t}return t}function Pc(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function xt(e,t){return String(e??"").replace(/\s+/g," ").trim().slice(0,t)}function Qp(e){const t=String(e??"");if(!t)return"";try{const n=new URL(t,location.href);return(n.origin==="null"?"":n.origin)+n.pathname}catch{return t.split(/[?#]/)[0].slice(0,300)}}function e_(e){if(e instanceof Error)return xt(e.message||e.name||"Error",hn);if(e&&typeof e=="object")try{return xt(JSON.stringify(e),hn)}catch{return xt(String(e),hn)}return xt(e,hn)}function yn(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function t_(e){const t=typeof e.composedPath=="function"?e.composedPath():null;return t&&t.find(r=>r instanceof Element)||(e.target instanceof Element?e.target:null)}function n_(e){if(!e)return"";const t=e.closest($c)||e,n=t.getAttribute("aria-label")||t.getAttribute("data-framer-name")||t.textContent||"";return xt(n,Jp)}function r_(e){const t=[];let n=e;for(let r=0;n&&r<4&&n.nodeType===1;r++){const o=n.tagName.toLowerCase();if(o==="html"||o==="body")break;if(n.id&&/^[A-Za-z][\w-]*$/.test(n.id)){t.unshift(o+"#"+n.id);break}const i=(n.getAttribute("class")||"").trim().split(/\s+/).filter(a=>a&&a.length<=24)[0];let s=i?o+"."+i:o;if(!i){const a=n.parentElement;if(a){const c=Array.prototype.filter.call(a.children,l=>l.tagName===n.tagName);c.length>1&&(s+=":nth-of-type("+(c.indexOf(n)+1)+")")}}t.unshift(s),n=n.parentElement}return t.join(">").slice(0,Xp)}se({name:"frustration",feature:"frustration",init(e){if(typeof window>"u"||typeof document>"u")return;const t=[],n=new WeakMap;let r=0,o=0,i=0;const s=()=>{r=yn()},a=()=>{i=yn()};document.addEventListener("focusin",s,!0),window.addEventListener("popstate",a),window.addEventListener("hashchange",a),window.addEventListener("pagehide",a),t.push(()=>{document.removeEventListener("focusin",s,!0),window.removeEventListener("popstate",a),window.removeEventListener("hashchange",a),window.removeEventListener("pagehide",a)});try{if(typeof PerformanceObserver=="function"){const _=new PerformanceObserver(v=>{try{for(const f of v.getEntries())Yp.test(f.name||"")||(o=Math.max(o,f.startTime||yn()))}catch{}});_.observe({type:"resource",buffered:!1}),t.push(()=>{try{_.disconnect()}catch{}})}}catch{}const c=_=>{if(!_)return!1;if(_.closest($c))return!0;const v=n.get(_);if(v!==void 0)return v;let f=!1;try{f=window.getComputedStyle(_).cursor==="pointer"}catch{f=!1}return n.set(_,f),f};let l=[],u=!1,d=null,w=0;const g=_=>{try{if(!_.isTrusted)return;const v=t_(_);if(!v||v.closest("[data-glue-ignore],[data-private]"))return;const f=yn(),b=_.clientX||0,I=_.clientY||0,E=n_(v),T=r_(v);if(d={at:f,label:E,selector:T,fired:!1},l=l.filter(M=>f-M.at<=zp&&Math.hypot(M.x-b,M.y-I)<=Bp),l.length||(u=!1),l.push({at:f,x:b,y:I}),l.length>=Vp&&!u){u=!0;const M=window.innerWidth||1,z=window.innerHeight||1;e.track("rage_click",{count:l.length,target_label:E,selector:T,x_pct:Math.round(b/M*100),y_pct:Math.round(I/z*100),path:e.route()})}if(w>=Kp||!c(v))return;k(f,E,T)}catch(v){e.log.warn("frustration: click handler failed:",v)}},p=new Set;t.push(()=>{for(const _ of p)window.clearTimeout(_.timer),_.stop();p.clear()});const k=(_,v,f)=>{const b=location.href,I=document.activeElement;let E=!1,T=null;if(typeof MutationObserver=="function"){T=new MutationObserver(()=>{E=!0,T&&(T.disconnect(),T=null)});try{T.observe(document.documentElement||document,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}catch{T=null}}w++;const M={timer:0,stop:()=>{try{T&&T.disconnect()}catch{}}};M.timer=window.setTimeout(()=>{w=Math.max(0,w-1),p.delete(M),M.stop();try{if(E||location.href!==b||i>=_||o>=_||r>=_||document.activeElement!==I)return;e.track("dead_click",{target_label:v,selector:f,path:e.route()})}catch(z){e.log.warn("frustration: dead click check failed:",z)}},Wp),p.add(M)};document.addEventListener("click",g,{capture:!0,passive:!0}),t.push(()=>document.removeEventListener("click",g,!0));const m=Zp();if(m){const _=v=>{const f=d;!f||f.fired||yn()-f.at>Gp||(f.fired=!0,e.track("error_click",{target_label:f.label,selector:f.selector,error_hash:v}))};if(m.subs.add(_),t.push(()=>m.subs.delete(_)),!e.features.errors&&!m.sourced){m.sourced=!0;const v=b=>{try{if(b&&b.target&&b.target!==window&&b.target.tagName)return;const I=xt(b?.message||b?.error&&b.error.message||"Script error",hn),E=Qp(b?.filename||""),T=Number.isFinite(b?.lineno)?b.lineno:0;m.publish(Pc(I+"|"+E+"|"+T))}catch{}},f=b=>{try{const I=b&&"reason"in b?b.reason:b;m.publish(Pc("rejection|"+e_(I)))}catch{}};window.addEventListener("error",v,!0),window.addEventListener("unhandledrejection",f),t.push(()=>{m.sourced=!1,window.removeEventListener("error",v,!0),window.removeEventListener("unhandledrejection",f)})}}return t.push(e.onNavigate(()=>{l=[],u=!1,d=null})),()=>{for(const _ of t)try{_()}catch{}}}});const ur={enabled:!0,consoleEnabled:!0,networkEnabled:!0,performanceEnabled:!0,stateEnabled:!1,consoleLimits:{maxEntries:500},networkLimits:{maxRequests:200,maxBodySize:10240},performanceLimits:{sampleInterval:1e3,maxSamples:300},stateLimits:{maxChanges:200,maxStateSize:10240},sensitivePatterns:[/password/i,/token/i,/bearer/i,/api_key/i,/apikey/i,/secret/i,/credit_card/i,/creditcard/i,/card_number/i,/cardnumber/i,/ssn/i,/social_security/i,/auth/i],sanitizedHeaders:["authorization","cookie","x-api-key","x-auth-token","x-access-token","set-cookie"]},Fc=Symbol.for("glue.network"),mt="__glueNetworkWrapper";function gi(){if(typeof window>"u")return null;const e=window;let t=e[Fc];if(!t){const n=new Set,r=new Set;t={subs:n,producers:r,subscribe(o){return n.add(o),()=>{n.delete(o)}},emit(o){for(const i of Array.from(n))try{i(o)}catch{}},claim(o){for(const i of Array.from(r)){r.delete(i);try{i()}catch{}}return r.add(o),()=>{r.delete(o)}}},e[Fc]=t}return t}function o_(e){const t=[];return{entries:t,maxSize:e,push(n){t.length>=e&&t.shift(),t.push(n)},getAll(){return[...t]},clear(){t.length=0},size(){return t.length}}}let X,dr=ur,fr=!1,Fe=0,Lt=null,gr=null;const Uc=new WeakSet;function wn(e){if(!Lt||Uc.has(e))return;Uc.add(e);let t=!0;try{t=new URL(e.url,window.location.href).origin===window.location.origin}catch{}Lt.emit({kind:e.type,method:e.method,url:e.url,status:e.status||0,duration_ms:Math.max(0,Math.round(e.duration||0)),same_origin:t,error:e.error&&e.error.indexOf("HTTP ")!==0?e.error:void 0})}let bn,vn,Sn,En;function jc(){return`net_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function pt(e,t){const n={},r=t.map(o=>o.toLowerCase());for(const[o,i]of Object.entries(e))r.includes(o.toLowerCase())?n[o]="[REDACTED]":n[o]=i;return n}function mr(e){if(!e)return;const t=parseInt(e,10);return Number.isFinite(t)?t:void 0}function qc(e,t){const n=t.toLowerCase();for(const[r,o]of Object.entries(e))if(r.toLowerCase()===n)return o}function Hc(e){try{const t=new URL(e,window.location.origin);return["token","api_key","apikey","key","secret","password","auth"].forEach(r=>{t.searchParams.has(r)&&t.searchParams.set(r,"[REDACTED]")}),t.toString()}catch{return e}}function i_(){bn=XMLHttpRequest.prototype.open,vn=XMLHttpRequest.prototype.send,Sn=XMLHttpRequest.prototype.setRequestHeader;const e=new WeakMap,t=function(o,i,s,a,c){const l={id:jc(),method:o.toUpperCase(),url:Hc(i.toString()),startTime:Date.now(),requestHeaders:{},responseHeaders:{},type:"xhr"};return e.set(this,l),bn.call(this,o,i,s??!0,a,c)},n=function(o,i){const s=e.get(this);return s&&(s.requestHeaders[o]=i),Sn.call(this,o,i)},r=function(o){const i=e.get(this),s=dr.sanitizedHeaders||[];return i&&(i.requestSize=mr(qc(i.requestHeaders,"content-length")),this.addEventListener("loadend",()=>{i.endTime=Date.now(),i.duration=i.endTime-i.startTime,i.status=this.status,i.statusText=this.statusText;const a=this.getAllResponseHeaders();a&&a.split(`\r
`).forEach(c=>{const[l,...u]=c.split(": ");l&&(i.responseHeaders[l]=u.join(": "))}),i.responseSize=mr(this.getResponseHeader("content-length")),i.requestHeaders=pt(i.requestHeaders,s),i.responseHeaders=pt(i.responseHeaders,s),(this.status>=400||this.status===0)&&(i.error=this.status===0?"Network Error":`HTTP ${this.status}`,Fe++),X&&X.push(i),wn(i)}),this.addEventListener("error",()=>{i.endTime=Date.now(),i.duration=i.endTime-i.startTime,i.error="Network Error",i.requestHeaders=pt(i.requestHeaders,s),Fe++,X&&X.push(i),wn(i)}),this.addEventListener("timeout",()=>{i.endTime=Date.now(),i.duration=i.endTime-i.startTime,i.error="Timeout",i.requestHeaders=pt(i.requestHeaders,s),Fe++,X&&X.push(i),wn(i)})),vn.call(this,o)};t[mt]=bn,n[mt]=Sn,r[mt]=vn,XMLHttpRequest.prototype.open=t,XMLHttpRequest.prototype.setRequestHeader=n,XMLHttpRequest.prototype.send=r}function s_(){En=window.fetch;const e=async function(t,n){const r=dr.sanitizedHeaders||[],o=typeof t=="string"?t:t instanceof URL?t.toString():t.url,i=n?.method||(t instanceof Request?t.method:"GET"),s={id:jc(),method:i.toUpperCase(),url:Hc(o),startTime:Date.now(),requestHeaders:{},responseHeaders:{},type:"fetch"};n?.headers&&(n.headers instanceof Headers?n.headers.forEach((a,c)=>{s.requestHeaders[c]=a}):Array.isArray(n.headers)?n.headers.forEach(([a,c])=>{s.requestHeaders[a]=c}):Object.entries(n.headers).forEach(([a,c])=>{s.requestHeaders[a]=c})),s.requestSize=mr(qc(s.requestHeaders,"content-length"));try{const a=await En.call(window,t,n);return s.endTime=Date.now(),s.duration=s.endTime-s.startTime,s.status=a.status,s.statusText=a.statusText,a.headers.forEach((c,l)=>{s.responseHeaders[l]=c}),s.responseSize=mr(a.headers.get("content-length")),s.requestHeaders=pt(s.requestHeaders,r),s.responseHeaders=pt(s.responseHeaders,r),a.ok||(s.error=`HTTP ${a.status}`,Fe++),X&&X.push(s),wn(s),a}catch(a){throw s.endTime=Date.now(),s.duration=s.endTime-s.startTime,s.error=a?.message||"Network Error",s.requestHeaders=pt(s.requestHeaders,r),Fe++,X&&X.push(s),wn(s),a}};e[mt]=En,window.fetch=e}function a_(e){if(fr)return;dr={...ur,...e};const t=dr.networkLimits?.maxRequests||200;X=o_(t),Fe=0,Lt=gi(),gr=Lt?Lt.claim(()=>{}):null,i_(),s_(),fr=!0}function c_(){return X?X.getAll():[]}function l_(){return X?X.size():0}function u_(){return Fe}function d_(){X&&X.clear(),Fe=0}function f_(){fr&&(gr&&gr(),gr=null,Lt=null,bn&&(XMLHttpRequest.prototype.open=bn),vn&&(XMLHttpRequest.prototype.send=vn),Sn&&(XMLHttpRequest.prototype.setRequestHeader=Sn),En&&(window.fetch=En),X&&X.clear(),Fe=0,fr=!1)}const pr={init:a_,getRequests:c_,getCount:l_,getFailedCount:u_,clear:d_,destroy:f_},g_=300,m_=2e3,p_=20,__=20,h_=20,y_=50,w_=/^(?:img|script|link)$/,b_=/\/functions\/v1\/(?:ingest-events|glue)\b|glue\.min\.js/,zc=Symbol.for("glue.errorBus");function v_(){if(typeof window>"u")return null;const e=window;let t=e[zc];if(!t){const n=new Set;let r="",o=0;t={subs:n,sourced:!1,publish(i){const s=Date.now();if(!(i===r&&s-o<50)){r=i,o=s;for(const a of Array.from(n))try{a(i)}catch{}}}},e[zc]=t}return t}function mi(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function S_(e,t){return String(e??"").replace(/\s+/g," ").trim().slice(0,t)}function pi(e){const t=String(e??"");if(!t)return"";try{const n=new URL(t,typeof location<"u"?location.href:void 0);return(n.origin==="null"?"":n.origin)+n.pathname}catch{return t.split(/[?#]/)[0].slice(0,300)}}function Bc(e){try{return new URL(e,location.href).origin===location.origin}catch{return!0}}function _i(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function Vc(e,t){if(!t)return;const n=e&&typeof e=="object"?e.stack:void 0;if(typeof n!="string")return;const r=[];for(const o of n.split(`
`).slice(1,21)){const i=o.match(/(https?:\/\/[^\s)]+):(\d+):(\d+)/);if(i)try{r.push(`${new URL(i[1]).origin}/[script]:${i[2]}:${i[3]}`)}catch{}}return r.length?r.join(`
`).slice(0,m_):void 0}function Wc(e){const t=e&&typeof e=="object"?e.name:"";return/^(Error|TypeError|RangeError|ReferenceError|SyntaxError|URIError|EvalError)$/.test(t)?t:"Unhandled rejection"}se({name:"errors",feature:"errors",init(e){if(typeof window>"u")return;const t=v_(),n=e.config.capture_stack===!0,r=[];let o={},i=new Set;const s=(g,p)=>{const k=o[g]||0;return k>=p?!1:(o[g]=k+1,!0)},a=(g,p)=>{const k=g+":"+p;return i.has(k)?!1:(i.add(k),!0)},c=g=>b_.test(g),l=g=>{try{const p=g.target;if(p&&p!==window&&p.tagName){const E=String(p.tagName).toLowerCase();if(!w_.test(E))return;const T=pi(p.src||p.href||"");if(!T||c(T)||!a("resource_error",mi(E+"|"+T))||!s("resource_error",h_))return;e.track("resource_error",{tag:E,url:T,path:e.route()});return}const k=g,m=S_(k.message||k.error&&k.error.message||"Script error",g_),_=k.error?Wc(k.error):"Script error",v=pi(k.filename||""),f=Number.isFinite(k.lineno)?k.lineno:0,b=Number.isFinite(k.colno)?k.colno:0,I=mi(m+"|"+v+"|"+f);if(t&&t.publish(I),!a("js_error",I)||!s("js_error",p_))return;e.track("js_error",{message:_,source:v,line:f,col:b,error_hash:I,stack:Vc(k.error,n),path:e.route()})}catch(p){e.log.warn("errors: error handler failed:",p)}},u=g=>{try{const p=g&&"reason"in g?g.reason:g,k=Wc(p),m=mi("rejection|"+k);if(t&&t.publish(m),!a("unhandled_rejection",m)||!s("unhandled_rejection",__))return;e.track("unhandled_rejection",{reason:k,error_hash:m,stack:Vc(p,n),path:e.route()})}catch(p){e.log.warn("errors: rejection handler failed:",p)}};window.addEventListener("error",l,!0),window.addEventListener("unhandledrejection",u),r.push(()=>{window.removeEventListener("error",l,!0),window.removeEventListener("unhandledrejection",u)});const d=g=>{try{const p=g.url;if(c(p))return;const k=pi(p);if(!k)return;const m=g.status||0;if(!g.error&&m<400||!s("network_error",y_))return;e.track("network_error",{method:g.method||"GET",url:k,status:m,duration_ms:Math.max(0,Math.round(g.duration_ms||0)),kind:g.kind==="xhr"?"xhr":"fetch",same_origin:Bc(p)})}catch(p){e.log.warn("errors: network report failed:",p)}},w=e.config.wrap_network!==!1?gi():null;return w&&(r.push(w.subscribe(d)),w.producers.size||r.push(E_(w))),r.push(e.onNavigate(()=>{o={},i=new Set})),()=>{for(const g of r)try{g()}catch{}}}});function E_(e){const t=window,n=[];let r=!0;const o=(c,l,u,d,w,g)=>{r&&e.emit({kind:c,method:l,url:u,status:d,duration_ms:Math.max(0,Math.round(_i()-w)),same_origin:Bc(u),error:g})};if(typeof t.fetch=="function"){const c=t.fetch,l=function(u,d){let w="",g="GET";try{w=typeof u=="string"?u:u&&typeof u.url=="string"?u.url:String(u??""),g=String(d&&d.method||u&&u.method||"GET").toUpperCase()}catch{}const p=_i();let k;try{k=c.apply(this||t,arguments)}catch(m){throw w&&o("fetch",g,w,0,p,"Network Error"),m}return!w||!k||typeof k.then!="function"?k:k.then(m=>{try{m&&o("fetch",g,w,Number(m.status)||0,p)}catch{}return m},m=>{try{o("fetch",g,w,0,p,"Network Error")}catch{}throw m})};l[mt]=c,t.fetch=l,n.push(()=>{t.fetch===l&&(t.fetch=c)})}const i=t.XMLHttpRequest;if(typeof i=="function"&&i.prototype&&typeof i.prototype.open=="function"){const c=i.prototype,l=c.open,u=c.send,d=new WeakMap,w=function(p,k){try{d.set(this,{method:String(p||"GET").toUpperCase(),url:String(k||""),started:0})}catch{}return l.apply(this,arguments)},g=function(){try{const p=d.get(this);p&&p.url&&(p.started=_i(),this.addEventListener("load",()=>o("xhr",p.method,p.url,this.status,p.started)),this.addEventListener("error",()=>o("xhr",p.method,p.url,0,p.started,"Network Error")),this.addEventListener("timeout",()=>o("xhr",p.method,p.url,0,p.started,"Timeout")))}catch{}return u.apply(this,arguments)};w[mt]=l,g[mt]=u,c.open=w,c.send=g,n.push(()=>{c.open===w&&(c.open=l),c.send===g&&(c.send=u)})}const s=()=>{r=!1;for(const c of n)try{c()}catch{}n.length=0},a=e.claim(s);return()=>{a(),s()}}const k_=5e3,A_=1e3,T_=40,C_="web_vitals",I_="6.2.1",x_=["CLS","FCP","INP","LCP","TTFB"],L_=["INP","LCP"],M_=9e5,O_=1;function Le(e){const t=Number(e);return Number.isFinite(t)&&t>0?Math.round(t):null}function R_(){try{const e=navigator.userAgent||"";if(/tablet|ipad/i.test(e))return"tablet";if(/mobile|android|iphone/i.test(e))return"mobile"}catch{}return"desktop"}function Gc(){return{lcp:null,fcp:null,fid:null,cls:0,sessionValue:0,sessionStart:0,sessionLast:0,interactions:new Map}}function _t(e,t,n={}){try{if(typeof PerformanceObserver!="function")return null;const r=PerformanceObserver.supportedEntryTypes;if(Array.isArray(r)&&r.indexOf(e)===-1)return null;const o=new PerformanceObserver(i=>{try{t(i.getEntries())}catch{}});return o.observe({type:e,buffered:!0,...n}),()=>{try{o.disconnect()}catch{}}}catch{return null}}function N_(){try{if(typeof performance>"u")return null;const e=typeof performance.getEntriesByType=="function"?performance.getEntriesByType("navigation"):null,t=e&&e[0];if(t)return{ttfb:Le(t.responseStart),dcl:Le(t.domContentLoadedEventEnd),load:Le(t.loadEventEnd),type:t.type||"navigate"}}catch{}return null}function $_(e){if(!e.size)return null;const t=Array.from(e.values()).sort((r,o)=>o-r),n=Math.min(t.length-1,Math.floor(e.size/50));return Le(t[n])}function D_(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function P_(e,t){return!Number.isFinite(t)||t>=1?!0:t<=0?!1:D_(`performance_vitals:${e}`)/4294967295<t}function F_(){const t=[],n=[],r=_t("longtask",i=>{for(const s of i)t.push({duration_ms:Le(s.duration)??0,start_ms:Le(s.startTime)??0}),t.length>10&&t.shift()}),o=_t("resource",i=>{for(const s of i){const a=Le(s.duration)??0;if(a<500)continue;let c=String(s.name||"");const l=c.indexOf("?");l!==-1&&(c=c.slice(0,l)),n.push({url:c,duration_ms:a}),n.length>10&&n.shift()}});return{longTasks:()=>t.slice().sort((i,s)=>s.duration_ms-i.duration_ms).slice(0,5),slowResources:()=>n.slice().sort((i,s)=>s.duration_ms-i.duration_ms).slice(0,5),stop:()=>{r?.(),o?.()}}}function U_(e){try{return new TextEncoder().encode(JSON.stringify(e)).length}catch{return JSON.stringify(e??"").length}}function j_(e,t){if(typeof window>"u"||typeof e.loadModule!="function")return e.log.warn?.("performance_vitals: ctx.loadModule unavailable in this registry build — per-metric web_vital events disabled, summary unaffected"),()=>{};const n=e.config||{},r=Array.isArray(n.metrics)?n.metrics:x_,o=Array.isArray(n.attribution_metrics)?n.attribution_metrics:L_,i=typeof n.max_value_ms=="number"?n.max_value_ms:M_,s=typeof n.sample_rate=="number"?n.sample_rate:O_;let a=null,c=null,l=null;const u=e.onEvent(_=>{l=_.session_id||l;const v=_.properties||{};typeof v.window_id=="string"&&(a=v.window_id),typeof v.page_view_id=="string"&&(c=v.page_view_id)}),d=()=>{if(typeof e.ids=="function")try{const _=e.ids();a=_.window_id??a,c=_.page_view_id??c,l=_.session_id??l}catch{}},w=r.indexOf("INP")>-1||r.indexOf("LCP")>-1?F_():null,g=new Set,p=R_(),k=_=>{const v=`${_.metric}:${_.metric_id}`;if(g.has(v))return;if(g.add(v),typeof _.value=="number"&&_.value>=i){e.log.warn?.(`performance_vitals: dropping implausible ${_.metric} value`,_.value);return}if(d(),typeof e.sampled=="function"){if(!e.sampled())return}else if(!P_(l||"unknown",s))return;let f=null;if(o.indexOf(_.metric)>-1&&_.attribution){const E=_.attribution,T={};E.target&&(T.target=String(E.target).slice(0,200)),E.target_el&&(T.target_el=E.target_el),E.interaction_type&&(T.interaction_type=E.interaction_type),E.load_state&&(T.load_state=E.load_state),E.phases&&(T.phases=E.phases),E.lcp&&(T.lcp=E.lcp),E.cls&&(T.cls=E.cls),Object.keys(T).length&&(f=U_(T)<=2048?T:null)}const b=t(),I={metric:_.metric,value:_.value,rating:_.rating,delta:_.delta,metric_id:_.metric_id,nav_type:_.nav_type,path:b,route_template:lr(b,e.config&&e.config.route_patterns),window_id:a,page_view_id:c,device_type:p,attribution:f};if(w&&(_.metric==="INP"||_.metric==="LCP")){const E=w.longTasks(),T=w.slowResources();E.length&&(I.long_tasks=E),T.length&&(I.slow_resources=T)}e.track("web_vital",I)};let m=!1;return e.loadModule(C_,I_).then(_=>{if(m||!_||typeof _.startWebVitals!="function"){e.log.warn?.("performance_vitals: web_vitals module loaded without a usable API — falling back to summary only");return}_.startWebVitals({metrics:r,attributionMetrics:o,onReport:k})}).catch(_=>{e.log.warn?.("performance_vitals: web_vitals module failed to load, summary event unaffected",_)}),()=>{m=!0,u(),w?.stop()}}se({name:"vitals",feature:"performance_vitals",init(e){if(typeof window>"u")return;const t=[];let n=Gc(),r=location.pathname,o=!1,i=!1;const s=[_t("largest-contentful-paint",c=>{const l=c[c.length-1];l&&(n.lcp=Le(l.renderTime||l.startTime))}),_t("paint",c=>{for(const l of c)l.name==="first-contentful-paint"&&(n.fcp=Le(l.startTime))}),_t("first-input",c=>{const l=c[0];l&&n.fid===null&&(n.fid=Le(l.processingStart-l.startTime))}),_t("layout-shift",c=>{for(const l of c){if(l.hadRecentInput)continue;const u=l.startTime||0;n.sessionValue&&u-n.sessionLast<A_&&u-n.sessionStart<k_?n.sessionValue+=l.value:(n.sessionValue=l.value,n.sessionStart=u),n.sessionLast=u,n.sessionValue>n.cls&&(n.cls=n.sessionValue)}}),_t("event",c=>{for(const l of c){const u=l.interactionId;if(!u)continue;const d=n.interactions.get(u)||0;l.duration>d&&n.interactions.set(u,l.duration)}},{durationThreshold:T_})];for(const c of s)c&&t.push(c);const a=c=>{if(i)return;i=!0;const l=o?null:N_(),u=navigator.connection;e.track("web_vitals",{path:c,route_template:lr(c,e.config&&e.config.route_patterns),ttfb_ms:l?l.ttfb:null,fcp_ms:o?null:n.fcp,lcp_ms:o?null:n.lcp,cls:Math.round(n.cls*1e3)/1e3,inp_ms:$_(n.interactions),fid_ms:o?null:n.fid,dom_content_loaded_ms:l?l.dcl:null,load_ms:l?l.load:null,nav_type:o?"spa":l?l.type:"navigate",connection:u&&u.effectiveType||null,device_memory:navigator.deviceMemory??null})};return t.push(e.onNavigate(()=>{a(r),n=Gc(),o=!0,i=!1,r=location.pathname})),t.push(e.onLeave(()=>a(r))),t.push(j_(e,()=>r)),()=>{for(const c of t)try{c()}catch{}}}});const kn=B("forms"),hi=new Set;function Kc(e){return hi.add(e),()=>{hi.delete(e)}}function _r(e){for(const t of Array.from(hi))try{t(e)}catch(n){kn.warn("[FormFieldAnalytics] subscriber failed",n)}}const q_=/(pass(?:word|code)|\bpwd\b|\bcvv\b|\bcvc\b|\bcsc\b|security[\s_-]?code|card[\s_-]?(?:number|num|no)|cardnumber|credit|debit|\bexp(?:iry|iration)?[\s_-]?(?:date|month|year|mm|yy)?\b|\bssn\b|social[\s_-]?security|tax[\s_-]?(?:id|file)|\btfn\b|passport|licen[cs]e|medicare|driver|national[\s_-]?id|\bnric\b|\bdob\b|date[\s_-]?of[\s_-]?birth|birth[\s_-]?date|health|medical|diagnos|patient|\biban\b|\bswift\b|\bbsb\b|routing[\s_-]?number|account[\s_-]?number|sort[\s_-]?code|honeypot|honey[\s_-]?pot|\bhp[\s_-]?field\b|\bpin\b)/i,H_=/(compan(?:y|ies)|business|organi[sz]ation|organisation|street|address|city|suburb|state|country|user|account|file|domain|product|property|card|brand|project|event|role|title|bank|school|team|pet)[\s_-]?name/i;function z_(e){return[e.getAttribute("autocomplete"),e.getAttribute("name"),e.id,e.getAttribute("placeholder"),e.getAttribute("aria-label"),e.getAttribute("data-field-reference"),B_(e)].filter(Boolean).join(" ").toLowerCase().replace(/[_.\-]+/g," ")}function B_(e){try{const t=e.labels;if(t&&t[0])return t[0].textContent?.trim().slice(0,80)||"";const n=e.closest("label");return n&&n.textContent?.trim().slice(0,80)||""}catch{return""}}function V_(e){const t=e.tagName,n=(e.getAttribute("type")||(t==="TEXTAREA"?"textarea":"text")).toLowerCase(),r=(e.getAttribute("autocomplete")||"").toLowerCase();if(n==="password"||n==="hidden"||r.startsWith("cc-")||r==="new-password"||r==="current-password"||r==="one-time-code")return"other";const o=z_(e);if(q_.test(o))return"other";if(n==="email"||r.includes("email")||/\be-?mail\b/.test(o))return"email";if(n==="tel"||r.includes("tel")||/\b(phone|mobile|telephone|cell)\b/.test(o))return"phone";if(!H_.test(o)){if(r==="given-name"||/\b(first[\s_-]?name|fname|given[\s_-]?name|forename)\b/.test(o))return"first_name";if(r==="family-name"||/\b(last[\s_-]?name|lname|surname|family[\s_-]?name)\b/.test(o))return"last_name";if(r==="name"||/\b(full[\s_-]?name|your[\s_-]?name|name)\b/.test(o))return"full_name"}return t==="SELECT"?"select":t==="TEXTAREA"?"textarea":n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"||n==="range"?"number":["date","datetime-local","month","week","time"].includes(n)?"date":["text","search","url"].includes(n)?"text":"other"}let U={domIntelligence:!1,enabled:!1,trackFocusBlur:!0,trackTyping:!0,trackValidation:!0,trackAbandonment:!0,captureFieldLength:!0,detectAutofill:!0,hesitationMs:3e3,correctionThreshold:2},Me=new Map,Je=null,Xe=null,Jc=!1;const Xc=new WeakMap,Yc=new WeakMap,yi=new WeakMap;let W_=0,G_=0,ht=null;function K_(e){if(U={...U,...e},!U.enabled){kn.log("[FormFieldAnalytics] Disabled via config");return}An(),!Jc&&(Jc=!0,J_(),nh(),rh(),Zc(),U.domIntelligence&&lh(),kn.log("[FormFieldAnalytics] Initialized",U))}function An(e=document){(e instanceof HTMLFormElement?[e]:e.querySelectorAll("form")).forEach(n=>{const r=Mt(n),o=Array.from(n.querySelectorAll("input, textarea, select")).filter(ke),i=Me.get(r)||{form_id:r,form_name:uh(n),form_action:n.action||window.location.href,fields:new Map,field_order:[],started_at:null,completed:!1,abandoned:!1,total_fields:o.length,completed_fields:0,fields_with_errors:0,average_field_time:0,completion_rate:0};o.forEach(s=>{const a=s,c=Ye(a);i.fields.has(c)||i.fields.set(c,{field_id:c,field_name:a.name||c,field_type:a.type||"text",field_label:dh(a),form_id:r,first_focus:null,last_blur:null,total_focus_time:0,focus_count:0,character_count:0,backspace_count:0,paste_count:0,autocomplete_detected:!1,completed:!1,abandoned:!1,validation_errors:0,hesitation_time:0,correction_ratio:0,field_kind:V_(a),focused_at:null,corrections:0,corrections_reported:0,hesitation_reported:!1,deleting:!1,pending_reentry:!1,last_length:a.value?a.value.length:0})}),i.total_fields=i.fields.size,Me.set(r,i),kn.log(`[FormFieldAnalytics] Discovered form: ${r} with ${o.length} fields`)})}function J_(){document.addEventListener("focus",e=>{const t=e.target;!ke(t)||!U.enabled||U.trackFocusBlur&&X_(t)},!0),document.addEventListener("blur",e=>{const t=e.target;!ke(t)||!U.enabled||U.trackFocusBlur&&Y_(t)},!0),document.addEventListener("input",e=>{const t=e.target;!ke(t)||!U.enabled||U.trackTyping&&Z_(t)},!0),document.addEventListener("paste",e=>{const t=e.target;!ke(t)||!U.enabled||U.trackTyping&&Q_(t)},!0),document.addEventListener("keydown",e=>{const t=e.target;!ke(t)||!U.enabled||U.trackTyping&&(e.key==="Backspace"||e.key==="Delete")&&eh(t)},!0),document.addEventListener("change",e=>{const t=e.target;!ke(t)||!U.enabled||th(t)},!0)}function X_(e){const t=Ot(e);if(!t)return;const n=Ye(e),r=t.fields.get(n);if(!r)return;const o=Date.now();t.started_at||(t.started_at=o,J("form_started",{form_id:t.form_id,form_name:t.form_name,total_fields:t.total_fields})),ht||Zc(),r.first_focus||(r.first_focus=o,t.field_order.push(n)),r.focus_count++,yi.set(e,o),r.focused_at=o,r.last_blur!==null&&e.value.length>0&&(r.pending_reentry=!0),Je={element:e,interaction:r},Xe&&clearTimeout(Xe),Xe=setTimeout(()=>{Je&&Je.interaction.character_count===0&&(Je.interaction.hesitation_time=Date.now()-(Je.interaction.first_focus||Date.now()))},3e3),J("field_focus",{form_id:t.form_id,field_id:n,field_name:r.field_name,field_type:r.field_type,field_kind:r.field_kind,focus_count:r.focus_count}),Tn("focus",t,r,e),Si(t)}function Y_(e){const t=Ot(e);if(!t)return;const n=Ye(e),r=t.fields.get(n);if(!r)return;const o=Date.now(),i=yi.get(e);if(i!==void 0){const c=o-i;r.total_focus_time+=c,r.last_blur=o,yi.delete(e)}const s=r.completed,a=e.value.trim();r.completed=a.length>0,r.completed!==s&&(t.completed_fields+=r.completed?1:-1),!r.completed&&r.focus_count>0&&(r.abandoned=!0,J("field_abandoned",{form_id:t.form_id,form_name:t.form_name,field_id:n,field_name:r.field_name,focus_time:r.total_focus_time,focus_count:r.focus_count})),r.character_count>0&&(r.correction_ratio=r.backspace_count/r.character_count),Je&&Je.element===e&&(Je=null),Xe&&clearTimeout(Xe),J("field_blur",{form_id:t.form_id,field_id:n,field_name:r.field_name,field_kind:r.field_kind,completed:r.completed,character_count:r.character_count,focus_time:r.total_focus_time,correction_ratio:r.correction_ratio}),r.focused_at=null,r.corrections>=U.correctionThreshold&&r.corrections>r.corrections_reported&&(r.corrections_reported=r.corrections,Tn("correction",t,r,e,{corrections:r.corrections,final_length:e.value.length})),Tn("blur",t,r,e)}function Z_(e){const t=Ot(e);if(!t)return;const n=Ye(e),r=t.fields.get(n);if(!r)return;const o=Date.now();if(r.focused_at!==null){const s=o-r.focused_at;r.focused_at=null,s>=U.hesitationMs&&!r.hesitation_reported&&(r.hesitation_reported=!0,Tn("hesitation",t,r,e,{ms_to_first_input:s}))}const i=e.value.length;if(r.pending_reentry&&(r.pending_reentry=!1,r.corrections++),i<r.last_length?r.deleting||(r.deleting=!0,r.corrections++):i>r.last_length&&(r.deleting=!1),r.last_length=i,Tn("input",t,r,e,{length:i}),Xe&&(clearTimeout(Xe),Xe=null),U.captureFieldLength){const s=r.character_count;r.character_count=e.value.length,U.detectAutofill&&r.character_count-s>5&&(r.autocomplete_detected=!0,J("field_autofill_detected",{form_id:t.form_id,field_id:n,field_name:r.field_name,characters_added:r.character_count-s,detection:"length_jump_heuristic"}))}}function Q_(e){const t=Ot(e);if(!t)return;const n=Ye(e),r=t.fields.get(n);r&&(r.paste_count++,J("field_paste",{form_id:t.form_id,field_id:n,field_name:r.field_name,paste_count:r.paste_count}))}function eh(e){const t=Ot(e);if(!t)return;const n=Ye(e),r=t.fields.get(n);r&&r.backspace_count++}function th(e){if(!U.trackValidation)return;const t=Ot(e);if(!t)return;const n=Ye(e),r=t.fields.get(n);if(r&&e.validity&&!e.validity.valid){r.validation_errors===0&&t.fields_with_errors++,r.validation_errors++;const o=e.validity;J("field_validation_error",{form_id:t.form_id,field_id:n,field_name:r.field_name,error_type:ol(o),error_count:r.validation_errors})}}function nh(){document.addEventListener("submit",e=>{const t=e.target;if(!U.enabled)return;An(t);const n=Mt(t),r=Me.get(n);r&&(r.completed=!0,Ei(r),sh(t),Qc(r),J("form_completed",{form_id:r.form_id,form_name:r.form_name,total_fields:r.total_fields,completed_fields:r.completed_fields,completion_rate:r.completion_rate,fields_with_errors:r.fields_with_errors,average_field_time:r.average_field_time,time_to_complete:r.started_at?Date.now()-r.started_at:0,field_order:r.field_order}))})}function rh(){window.addEventListener("beforeunload",()=>{!U.enabled||!U.trackAbandonment||Me.forEach(e=>{!e.completed&&e.started_at&&(e.abandoned=!0,Ei(e),Qc(e),J("form_abandoned",{form_id:e.form_id,form_name:e.form_name,total_fields:e.total_fields,completed_fields:e.completed_fields,completion_rate:e.completion_rate,time_spent:Date.now()-e.started_at,last_field:e.field_order[e.field_order.length-1]}))})})}function Zc(){ht&&clearInterval(ht),ht=setInterval(()=>{if(!U.enabled)return;let e=!1;Me.forEach(t=>{t.started_at&&!t.completed&&(e=!0,Ei(t),J("form_progress",{form_id:t.form_id,completion_rate:t.completion_rate,completed_fields:t.completed_fields,total_fields:t.total_fields,time_elapsed:Date.now()-t.started_at}))}),!e&&ht&&(clearInterval(ht),ht=null)},3e4)}function Tn(e,t,n,r,o){_r({type:e,form_id:t.form_id,form_name:t.form_name,field_id:n.field_id,field_kind:n.field_kind,element:r,data:o})}function Qc(e){if(el.has(e.form_id)||!e.field_order.length)return;el.add(e.form_id);let t=0;e.fields.forEach(n=>{n.first_focus&&t++}),_r({type:"fill_order",form_id:e.form_id,form_name:e.form_name,data:{order:e.field_order.slice(0,60),last_field_id:e.field_order[e.field_order.length-1],fields_total:e.total_fields,fields_touched:t,completed:e.completed}})}const el=new Set,tl=new Map,nl=new Set;let wi=null;function oh(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return(t>>>0).toString(36)}function ih(e){return e?.trim()?"Validation message shown":""}function bi(e){if(e.getAttribute("role")==="alert")return!0;const t=typeof e.className=="string"?e.className:"";return/(^|[\s_-])(error|invalid|has-error|is-invalid|field-error|form-error)([\s_-]|$)/i.test(t)}function vi(e){let t=e,n=0;for(;t&&n++<12;){if(t.hidden||t.getAttribute&&t.getAttribute("aria-hidden")==="true")return!1;const r=t.style;if(r&&(r.display==="none"||r.visibility==="hidden"||r.opacity==="0"))return!1;t=t.parentElement}return!0}function rl(e){if(e.id){const r=document.querySelector(`[aria-describedby~="${CSS.escape(e.id)}"],[aria-errormessage="${CSS.escape(e.id)}"]`);if(r&&ke(r))return r}let t=e.parentElement,n=0;for(;t&&n++<4;){const r=Array.from(t.querySelectorAll("input,textarea,select")).filter(ke);if(r.length)return r[0];if(t.tagName==="FORM")break;t=t.parentElement}return null}function Cn(e,t,n){if(!U.enabled||!U.trackValidation)return;const r=t||(e?e.closest("form"):null);if(!r)return;An(r);const o=Me.get(Mt(r));if(!o)return;const i=e?Ye(e):void 0,s=ih(n),a=oh(`${i||""}:${n}`),c=`${o.form_id}:${a}`,l=Date.now(),u=tl.get(c);if(u!==void 0&&l-u<1e3)return;tl.set(c,l);const d=i?o.fields.get(i):void 0;_r({type:"validation_shown",form_id:o.form_id,form_name:o.form_name,field_id:i,field_kind:d?.field_kind,data:{message:s,message_hash:a}})}function sh(e,t){if(!U.trackValidation)return;const n=Array.from(e.querySelectorAll("input,textarea,select")).filter(ke);for(const r of n){const o=r.validity;o&&!o.valid&&Cn(r,e,r.validationMessage||ol(o)),r.getAttribute("aria-invalid")==="true"&&Cn(r,e,r.validationMessage||"aria-invalid")}}function ah(e){return Array.from(e.querySelectorAll('fieldset,[data-glue-step],[data-step],[data-step-index],[class*="step"],[class*="Step"]'))}function ch(e,t){const n=e.getAttribute("data-glue-step")||e.getAttribute("data-step")||e.getAttribute("aria-label");if(n&&n.trim())return n.trim().slice(0,80);const o=e.querySelector("legend,h1,h2,h3,h4,[data-step-label]")?.textContent?.trim();return o&&o.slice(0,80)||`Step ${t+1}`}function Si(e){if(!U.enabled)return;const t=Array.from(document.querySelectorAll("form"));for(const n of t){const r=Mt(n);if(e&&e.form_id!==r)continue;const o=ah(n);o.length<2||o.forEach((i,s)=>{const a=`${r}:${s}`;nl.has(a)||!vi(i)||(nl.add(a),_r({type:"step_view",form_id:r,form_name:Me.get(r)?.form_name||r,data:{step_index:s,step_label:ch(i,s)}}))})}}function lh(){if(typeof MutationObserver>"u"||wi)return;let e=null;wi=new MutationObserver(t=>{if(U.enabled)try{let n=!1;for(const r of t)if(r.type==="attributes"){const o=r.target;if(!o||o.nodeType!==1)continue;r.attributeName==="aria-invalid"?o.getAttribute("aria-invalid")==="true"&&ke(o)&&Cn(o,null,o.validationMessage||"aria-invalid"):bi(o)&&vi(o)&&Cn(rl(o),null,o.textContent||""),o.closest("form")&&(n=!0)}else r.addedNodes.forEach(o=>{if(o.nodeType!==1)return;const i=o;n=!0;const s=bi(i)?[i]:Array.from(i.querySelectorAll('[role="alert"],[class*="error"],[class*="invalid"]'));for(const a of s)bi(a)&&vi(a)&&Cn(rl(a),null,a.textContent||"");(i.tagName==="FORM"||i.querySelector("form"))&&An()});n&&e===null&&(e=setTimeout(()=>{e=null,Si()},150))}catch(n){kn.warn("[FormFieldAnalytics] DOM intelligence failed",n)}}),wi.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-invalid","class","style","hidden","aria-hidden"]}),Si()}function Ei(e){e.completion_rate=e.total_fields?e.completed_fields/e.total_fields*100:0;let t=0,n=0;e.fields.forEach(r=>{r.total_focus_time>0&&(t+=r.total_focus_time,n++)}),e.average_field_time=n>0?t/n:0}function ol(e){return e.valueMissing?"required":e.typeMismatch?"type_mismatch":e.patternMismatch?"pattern_mismatch":e.tooLong?"too_long":e.tooShort?"too_short":e.rangeUnderflow?"range_underflow":e.rangeOverflow?"range_overflow":e.stepMismatch?"step_mismatch":e.badInput?"bad_input":"unknown"}function ke(e){if(!["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.closest("[data-glue-ignore],[data-private]"))return!1;const t=(e.getAttribute("type")||"").toLowerCase(),n=e.getAttribute("name")||"";return!["password","hidden","submit","button","reset"].includes(t)&&!/^(?:_gbf_hp|cf-turnstile-response|g-recaptcha-response)$/i.test(n)&&!(e.getAttribute("autocomplete")||"").startsWith("cc-")}function Mt(e){let t=Xc.get(e);return t||(t=e.getAttribute("data-glue-form")||e.getAttribute("id")||e.getAttribute("name")||`form_${++W_}`,Xc.set(e,t)),t}function uh(e){return e.getAttribute("data-glue-form")||e.getAttribute("name")||e.getAttribute("id")||Mt(e)}function Ot(e){if(!U.enabled)return null;const t=e.closest("form");return t?(An(t),Me.get(Mt(t))||null):null}function Ye(e){let t=Yc.get(e);return t||(t=e.id||e.getAttribute("name")||`field_${++G_}`,Yc.set(e,t)),t}function dh(e){if(e.id){const n=e.labels?.[0];if(n)return n.textContent?.trim()||""}const t=e.closest("label");return t?t.textContent?.trim()||"":e.placeholder?e.placeholder:e.name||e.id||"Unknown field"}function fh(){return new Map(Me)}function gh(e){return Me.get(e)||null}se({name:"formIntelligence",feature:"form_intelligence",init(e){return Kc(t=>{const n={form_id:t.form_id,form_name:t.form_name},r=t.data||{};switch(t.type){case"hesitation":e.track("field_hesitation",{...n,field_id:t.field_id,field_kind:t.field_kind,ms_to_first_input:Math.round(r.ms_to_first_input||0)});break;case"correction":e.track("field_correction",{form_id:t.form_id,field_id:t.field_id,field_kind:t.field_kind,corrections:r.corrections||0,final_length:r.final_length||0});break;case"validation_shown":e.track("form_validation_shown",{form_id:t.form_id,field_id:t.field_id,message_hash:r.message_hash,message:r.message});break;case"step_view":e.track("form_step_view",{form_id:t.form_id,step_index:r.step_index,step_label:r.step_label});break;case"fill_order":e.track("form_fill_order",{form_id:t.form_id,order:r.order||[],last_field_id:r.last_field_id,fields_total:r.fields_total||0,fields_touched:r.fields_touched||0});break}})}});const mh=["email","phone","first_name","last_name","full_name"],ph=/^[^\s@]+@[^\s@]+\.[a-z]{2,}$/i,_h=1500,hh=200;function yh(){try{const e=window.glue?.privacy?.isFeatureAllowed;if(typeof e=="function")return e("form_capture")!==!1}catch{}return Kt("form_capture")}function wh(e,t){const n=t.trim().slice(0,hh);return n?e==="email"?ph.test(n)?n:null:e==="phone"?n.replace(/\D/g,"").length>=8?n:null:n.length>=2&&!/\d/.test(n)?n:null:null}se({name:"leadCapture",feature:"lead_capture",init(e){if(!e.features.lead_capture)return;const t=new Map,n=new Map,r=new Set;let o=!1;const i=u=>{const d=n.get(u);d&&(clearTimeout(d),n.delete(u))},s=u=>{const d=u.element,w=u.field_kind;if(!d||!w||mh.indexOf(w)===-1||o||r.has(u.form_id)||!yh())return;try{if(d.closest("[data-glue-ignore],[data-private]"))return}catch{return}const g=wh(w,String(d.value||""));if(!g)return;const p=`${u.form_id}:${u.field_id}`;t.get(p)!==g&&(t.set(p,g),e.track("lead_field_captured",{form_id:u.form_id,form_name:u.form_name,field_id:u.field_id,field_kind:w,value:g,valid:!0,path:e.route(),consent_basis:"site_privacy_policy"}))},a=Kc(u=>{const d=`${u.form_id}:${u.field_id}`;u.type==="input"?(i(d),n.set(d,setTimeout(()=>{n.delete(d),s(u)},_h))):u.type==="blur"&&(i(d),s(u))}),c=e.onNavigate(()=>{t.clear(),r.clear(),o=!1;for(const u of Array.from(n.keys()))i(u)}),l=e.onEvent(u=>{if(u.event!=="form_submitted"||u.properties?.source!=="server"&&!u.properties?.submission_id)return;const d=u.properties&&u.properties.form_id;typeof d=="string"&&d?r.add(d):o=!0;for(const w of Array.from(n.keys()))i(w)});return()=>{a(),l(),c();for(const u of Array.from(n.keys()))i(u)}}});const il=["dg_uid","dg_cid","dg_src","_dg"],bh=12e4,vh=1e3,Sh=50,Eh=/^[A-Za-z0-9._:-]{8,128}$/,kh=/^(.+)\.(\d{10,16})$/,Ah=/^(?:com|co|net|org|gov|edu|ac|id|or|ne|asn)$/;function Th(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function ki(){const e=h("glue_user_id");if(e)return e;try{const t=h("glue_user_profile");if(t)return JSON.parse(t).glue_user_id||null}catch{}return null}function sl(e){return String(e??"").trim().toLowerCase().replace(/^https?:\/\//,"").split("/")[0].replace(/^\*?\./,"")}function al(e){const t=e.split(".").filter(Boolean);if(t.length<=2)return t.join(".");const n=t[t.length-1],r=t[t.length-2];return t.slice(n.length===2&&Ah.test(r)?-3:-2).join(".")}function Ch(e){const t=sl(location.hostname),n=Array.isArray(e.domains)?e.domains.map(sl).filter(Boolean):[];if(n.length)return o=>o!==t&&n.some(i=>o===i||o.endsWith("."+i));const r=al(t);return o=>!!r&&o!==t&&al(o)===r}function Ih(e){try{const t=window.history,n=typeof History<"u"&&typeof History.prototype.replaceState=="function"?History.prototype.replaceState:t&&t.replaceState;if(!t||typeof n!="function")return;const r=location.search.slice(1).split("&").filter(o=>{if(!o)return!1;const i=o.split("=")[0];let s=i;try{s=decodeURIComponent(i.replace(/\+/g," "))}catch{}return il.indexOf(s)===-1});n.call(t,t.state,"",location.pathname+(r.length?"?"+r.join("&"):"")+location.hash)}catch(t){e.log.warn("identityLinks: could not strip params:",t)}}function cl(e,t){let n="";try{n=location.search}catch{return}if(!n||n.length<2)return;const r=new URLSearchParams(n),o=il.filter(a=>r.has(a));if(!o.length)return;const i=ki(),s=Date.now();for(const a of o){const c=(r.get(a)||"").trim(),l=a+"="+c;if(!c||t.has(l))continue;if(t.add(l),a==="dg_src"||a==="dg_cid"){if(c.length>128)continue;e.track("identity_link_param",{param:a,raw:c,adopted:!1});continue}let u=c,d,w=!0,g="url_param";if(a==="_dg"){const m=kh.exec(c);if(!m)continue;u=m[1],d=s-Number(m[2]),w=d>=0&&d<=bh,g="cross_domain"}if(!Eh.test(u))continue;const p=w&&!!i&&u!==i,k={param:a,value_hash:Th(u),adopted:p};d!==void 0&&(k.age_ms=d),e.track("identity_link_param",k),p&&e.track("identity_alias",{alias_glue_user_id:u,current_glue_user_id:i,source:g})}Ih(e)}function ll(e,t){return e.searchParams.set("_dg",t+"."+Date.now()),e.href}function ul(e,t){if(!e)return null;try{const n=new URL(e,location.href);return n.protocol!=="http:"&&n.protocol!=="https:"||n.searchParams.has("_dg")||!t(n.hostname.toLowerCase())?null:n}catch{return null}}function dl(e,t,n){const r=e.getAttribute(t)||"";e.setAttribute(t,n),setTimeout(()=>{try{e.getAttribute(t)===n&&e.setAttribute(t,r)}catch{}},vh)}function xh(e,t){let n=0;const r=(a,c)=>{n>=Sh||(n+=1,e.track("cross_domain_link",{to_host:a,element:c}))},o=a=>{try{if(!a.isTrusted||a.type==="auxclick"&&a.button!==1)return;const l=(typeof a.composedPath=="function"?a.composedPath():[a.target]).find(g=>g instanceof Element),u=l&&l.closest("a[href]");if(!u||u.closest("[data-glue-ignore]"))return;const d=ul(u.getAttribute("href"),t),w=d&&ki();if(!d||!w)return;dl(u,"href",ll(d,w)),r(d.hostname.toLowerCase(),"a")}catch(c){e.log.warn("identityLinks: click decoration failed:",c)}},i=a=>{try{if(!a.isTrusted)return;const c=a.target instanceof Element?a.target.closest("form"):null;if(!c||c.closest("[data-glue-ignore]"))return;const l=ul(c.getAttribute("action"),t),u=l&&ki();if(!l||!u)return;dl(c,"action",ll(l,u)),r(l.hostname.toLowerCase(),"form")}catch(c){e.log.warn("identityLinks: form decoration failed:",c)}},s={capture:!0,passive:!0};return document.addEventListener("click",o,s),document.addEventListener("auxclick",o,s),document.addEventListener("submit",i,s),()=>{document.removeEventListener("click",o,!0),document.removeEventListener("auxclick",o,!0),document.removeEventListener("submit",i,!0)}}se({name:"identityLinks",feature:"identity_links",init(e){if(typeof window>"u"||typeof document>"u")return;const t=new Set;cl(e,t);const n=e.onNavigate(()=>cl(e,t)),r=xh(e,Ch(e.config||{}));return()=>{n(),r()}}});const fl="glue_fp_uid",Lh=3e3,Mh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Oh=/^[0-9a-fA-F-]{8,64}$/,Rh=/^(?:com|co|net|org|gov|edu|ac|id|or|ne|asn)$/,gl=/(?:^|\.)(?:supabase\.(?:co|com|in|net)|vercel\.app|localhost)$/;let Ai="";try{const e=typeof document<"u"?document.currentScript:null;Ai=e&&typeof e.src=="string"&&e.src||""}catch{}function Nh(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function $h(){const e=h("glue_user_id");if(e)return e;try{const t=h("glue_user_profile");if(t)return JSON.parse(t).glue_user_id||null}catch{}return null}function ml(e){const t=e.split(".").filter(Boolean);if(t.length<2)return"";const n=t[t.length-1],r=t[t.length-2];return t.slice(n.length===2&&Rh.test(r)?-3:-2).join(".")}function Dh(e){const t=Ai?[Ai]:[],n=[];try{const r=document.querySelectorAll('script[src*="workspace-id="]');for(let o=0;o<r.length;o++){const i=r[o].src||"";i&&(i.indexOf(e)===-1?n:t).push(i)}}catch{}return t.concat(n)}function Ph(e){const t=ml(String(location.hostname||"").toLowerCase());if(!t||gl.test(t))return null;for(const n of Dh(e))try{const r=new URL(n,location.href),o=r.hostname.toLowerCase();if(r.protocol!=="https:"||gl.test(o)||ml(o)!==t)continue;return r.origin}catch{}return null}function Fh(e){let t=null,n=null;try{return t=new AbortController,n=setTimeout(()=>{try{t.abort()}catch{}},Lh),fetch(e,{method:"GET",credentials:"include",cache:"no-store",keepalive:!1,signal:t.signal}).then(r=>r&&r.ok?r.json():null).then(r=>{const o=r&&typeof r.uid=="string"?r.uid.trim():"";return Mh.test(o)?o:null}).catch(()=>null).then(r=>(clearTimeout(n),r))}catch{return n!==null&&clearTimeout(n),Promise.resolve(null)}}se({name:"firstPartyCookie",feature:"first_party_cookie",init(e){if(typeof window>"u"||typeof document>"u"||typeof fetch!="function"||typeof AbortController!="function")return;const t=window.__glueConfig,n=String(t&&t.workspaceId||"").trim();if(!Oh.test(n))return;const r=Ph(n);if(!r||j(fl))return;let o=!1;const i=r+"/?workspace-id="+encodeURIComponent(n)+"&uid=1";return Fh(i).then(s=>{if(o||!s)return;P(fl,s);const a=$h();a&&a===s||(e.track("identity_link_param",{param:"_dg_cookie",value_hash:Nh(s),adopted:!!a}),e.track("identity_alias",{alias_glue_user_id:s,current_glue_user_id:a,source:"first_party_cookie"}))}).catch(s=>e.log.warn("firstPartyCookie: uid lookup failed:",s)),()=>{o=!0}}});const pl="glue_click_id",_l="glue_first_touch",hl="dg_click",Uh="_dg_click",Ti=/^dg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,jh=6e4,qh=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],Hh=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid"];function zh(){const e=typeof crypto<"u"?crypto:null;return e&&typeof e.randomUUID=="function"?e.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function Bh(e){try{const t=window.history,n=typeof History<"u"&&typeof History.prototype.replaceState=="function"?History.prototype.replaceState:t&&t.replaceState;if(!t||typeof n!="function")return;const r=location.search.slice(1).split("&").filter(o=>{if(!o)return!1;let i=o.split("=")[0];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}return i!==hl});n.call(t,t.state,"",location.pathname+(r.length?"?"+r.join("&"):"")+location.hash)}catch(t){e.log.warn("clickId: could not strip dg_click:",t)}}function Vh(){try{return new URLSearchParams(location.search)}catch{return null}}function Wh(e,t){const n={},r={};if(e){for(const i of qh){const s=(e.get(i)||"").trim();s&&(n[i]=s.slice(0,200))}for(const i of Hh){const s=(e.get(i)||"").trim();s&&(r[i]=s.slice(0,200))}}t&&(r.dg_click=t);let o="";try{o=(document.referrer||"").slice(0,512)}catch{}return{utm:n,click_ids:r,referrer:o,landing_page:(location.origin+location.pathname).slice(0,512),captured_at:new Date().toISOString()}}se({name:"clickId",feature:"click_id",init(e){if(typeof window>"u")return;const t=Vh(),n=(t?.get(hl)||"").trim(),r=(ge(Uh)||"").trim(),o=(h(pl)||"").trim();let i=null,s=null;Ti.test(n)?(i=n,s="param"):Ti.test(r)&&(i=r,s="cookie"),i&&i!==o&&(S(pl,i),gt({traits:{click_id:i}}),e.track("click_id_captured",{click_id:i,source:s})),n&&Bh(e);const a=i||(Ti.test(o)?o:null);if(!h(_l)){const g=Wh(t,a);S(_l,JSON.stringify(g)),gt({traits:{first_touch:g}}),e.track("first_touch_captured",g)}let c=null,l=0;const u=()=>{const g=Date.now();return(!c||g-l>jh)&&(c=zh(),l=g),c},d=g=>(p={})=>{const k={event_id:u(),event_name:typeof p.eventName=="string"?p.eventName:void 0,external_id:typeof p.externalId=="string"?p.externalId:void 0,amount_minor:typeof p.amount=="number"?p.amount:void 0,currency:typeof p.currency=="string"?p.currency:void 0,invoice_id:typeof p.invoiceId=="string"?p.invoiceId:void 0,click_id:a||void 0,authoritative:!1};for(const m of Object.keys(k))k[m]===void 0&&delete k[m];return e.track(g,k),k.event_id},w={eventId:u,lead:d("lead"),sale:d("sale")};try{const g=window;g.glue&&typeof g.glue=="object"?g.glue.conversions=w:g.__glueConversions=w}catch(g){e.log.warn("clickId: could not expose window.glue.conversions:",g)}}});const Gh=120,Kh=5,yl=100,hr=10,Jh=200,Xh=2048,Yh=32,Zh=20,Qh=["id","name","type","role","title","alt","aria-label","href","class","data-glue-action","data-glue-section","data-testid","data-framer-name"],wl=/pass|token|secret|auth|card|ssn|email|phone/i,ey='a[href],button,[role="button"],input[type="submit"],input[type="button"],summary,select,label,[onclick]';function bl(e,t,n,r){const o=typeof e=="number"&&Number.isFinite(e)?Math.round(e):r;return Math.min(n,Math.max(t,o))}function vl(e){return Math.min(1,Math.max(0,e))}function Sl(e){return Math.round(e*100)/100}function yr(e,t){return String(e??"").replace(/\s+/g," ").trim().slice(0,t)}function In(e){return(e.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean)}function ty(e){const t=e.tagName.toLowerCase();if(t==="select"||t==="textarea"||e.getAttribute("contenteditable")==="true")return!0;if(t==="input"){const n=(e.getAttribute("type")||"text").toLowerCase();return!["button","submit","reset","checkbox","radio","image"].includes(n)}return!1}function ny(e){const t=e.parentNode;return t&&t.nodeType===11&&t.host?t.host:null}function ry(e){const t=ny(e);return t?{parent:t,crossedShadow:!0}:{parent:e.parentElement??null,crossedShadow:!1}}function Ci(e){const t=e;let r=(typeof t.composedPath=="function"?t.composedPath():[]).find(o=>o instanceof Element)??(e.target instanceof Element?e.target:null);return r?(r.namespaceURI==="http://www.w3.org/2000/svg"&&(r=r.closest("button, a")||r),r):null}function El(e){return e.closest(ey)||e.closest("[data-glue-action]")||null}function kl(e,t){if(!e||e.closest("[data-glue-ignore],[data-private]"))return!0;if(t&&t.length){for(const n of t)if(n)try{if(e.closest(n))return!0}catch{}}return!1}function oy(e){if(!e)return null;try{const t=new URL(e,location.href);return["http:","https:","mailto:","tel:"].includes(t.protocol)?(t.username="",t.password="",t.href.slice(0,Xh)):null}catch{return null}}function iy(e){const t=e.tagName==="A"?e:e.closest("a[href]");return t?oy(t.getAttribute("href")):null}function Al(e){let t=1,n=1,r=e;for(;r=r.previousElementSibling;)t++,r.tagName===e.tagName&&n++;return{nth_child:t,nth_of_type:n}}function sy(e){return ty(e)||!!e.closest("[data-glue-mask],[data-private]")}function Tl(e){if(sy(e))return"";let t="";for(const n of Array.from(e.childNodes))n.nodeType===3&&n.textContent&&(t+=n.textContent);return t.trim()}function Cl(e){let t="";for(const n of Array.from(e.children)){if(n.tagName!=="SPAN")continue;const r=Tl(n);t=`${t} ${r}`.trim(),n.children.length&&(t=`${t} ${Cl(n)}`.trim())}return t}function ay(e,t){const n=Tl(e),r=e.tagName==="A"||e.tagName==="BUTTON"?`${n} ${Cl(e)}`.trim():n;return yr(r,t)}function Il(e,t,n,r){const o={},i=s=>(t.has(s)||s.startsWith("data-glue-"))&&!n.has(s)&&!wl.test(s);if(r.dense)for(const s of t){if(n.has(s)||wl.test(s))continue;const a=e.getAttribute(s);o[s]=a==null?null:s==="class"?In(e).slice(0,hr).join(" "):yr(a,yl)}for(const s of Array.from(e.attributes))s.name in o||i(s.name)&&(o[s.name]=s.name==="class"?In(e).slice(0,hr).join(" "):yr(s.value,yl));return o}function cy(e){const n=e.closest("[data-glue-action]")?.getAttribute("data-glue-action");return n?yr(n,100):null}function ly(){try{return window.self!==window.top}catch{return!0}}function uy(e){try{return typeof e.getBoundingClientRect!="function"?null:e.getBoundingClientRect()}catch{return null}}function dy(e){let t=e;for(let n=0;t&&n<Zh;n++){try{const r=window.getComputedStyle(t).position;if(r==="fixed"||r==="sticky")return!0}catch{break}t=t.parentElement}return!1}function fy(e,t){const n=typeof window<"u"&&window.innerWidth||0,r=typeof window<"u"&&window.innerHeight||0,o=typeof window<"u"&&window.scrollX||0,i=typeof window<"u"&&window.scrollY||0,s=e,a=!!s&&typeof s.clientX=="number"&&(s.detail??0)>0;let c,l;a?(c=s.clientX,l=s.clientY):t?(c=t.left+t.width/2,l=t.top+t.height/2):(c=0,l=0);let u=.5,d=.5;return t&&t.width>0&&t.height>0&&(u=vl((c-t.left)/t.width),d=vl((l-t.top)/t.height)),{page_x:Math.round(c+o),page_y:Math.round(l+i),viewport_x:Math.round(c),viewport_y:Math.round(l),viewport_w:n,viewport_h:r,scroll_x:Math.round(o),scroll_y:Math.round(i),rel_x:Sl(u),rel_y:Sl(d)}}function xl(e,t){const n=e.tagName.toLowerCase(),r=t?In(e)[0]:void 0;let o=r?`${n}.${r}`:n;const i=e.parentElement;if(i){const s=Array.prototype.filter.call(i.children,a=>a.tagName===e.tagName);s.length>1&&(o+=`:nth-of-type(${s.indexOf(e)+1})`)}return o}function gy(e,t){const r=t.slice().reverse().map(o=>xl(o,!1));return r.push(xl(e,!0)),r.join(" > ").slice(0,Jh)}function my(e){const t=[],n=new Set([e]);let r=0,o=e;for(let i=0;i<Yh;i++){const{parent:s,crossedShadow:a}=ry(o);if(!s||n.has(s))break;const c=s.tagName?.toLowerCase();if(c==="body"||c==="html")break;n.add(s),a&&r++,t.push(s),o=s}return{chain:t,shadowDepth:r}}const py=new Set(["id","class","role"]);function _y(e,t,n){const{nth_child:r}=Al(e),o=new Set([...n,...py]);return{tag:e.tagName.toLowerCase(),id:e.id||null,role:e.getAttribute("role"),classes:In(e).slice(0,hr),nth_child:r,attrs:Il(e,t,o,{dense:!1})}}function Ii(e,t={}){if(!(e instanceof Element))return null;const n=t.config||{};if(kl(e,n.ignore_selectors))return null;const r=bl(n.text_chars,1,500,Gh),o=bl(n.ancestor_depth,0,10,Kh),i=new Set([...Qh,...n.attr_allow||[]]),s=new Set(n.attr_deny||[]),{chain:a,shadowDepth:c}=my(e),l=uy(e),{nth_child:u,nth_of_type:d}=Al(e);return{tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),text:ay(e,r),attrs:Il(e,i,s,{dense:!0}),classes:In(e).slice(0,hr),href:iy(e),selector:gy(e,a),nth_child:u,nth_of_type:d,ancestors:a.slice(0,o).map(w=>_y(w,i,s)),shadow_depth:c,in_iframe:ly(),action_id:cy(e),target_fixed:dy(e),el_w:l?Math.round(l.width):0,el_h:l?Math.round(l.height):0,...fy(t.event,l)}}const hy=new Set(["Enter"," ","Spacebar"]),yy='[role="button"],[tabindex]';function wy(e){try{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}catch{return null}}function Ll(e,t){return!e||!e.length?!1:e.some(n=>wy(n)?.test(t)??!1)}function by(e){const t=location.origin+location.pathname;return!(Ll(e.url_deny,t)||e.url_allow&&e.url_allow.length&&!Ll(e.url_allow,t))}se({name:"autocapture",feature:"autocapture_rich",init(e){if(typeof window>"u"||typeof document>"u")return;const t=(o,i)=>{try{const s=e.config||{};if(!by(s))return;const a=El(o);if(!a||kl(a,s.ignore_selectors))return;const c=Ii(a,{event:i,config:s});if(!c)return;e.track("autocapture_click",{el:c,path:e.route()})}catch(s){e.log.warn("autocapture: capture failed:",s)}},n=o=>{if(!o.isTrusted)return;const i=Ci(o);i&&t(i,o)},r=o=>{if(!o.isTrusted||!hy.has(o.key))return;const i=Ci(o);if(!i)return;const s=i.closest(yy);!s||s.closest("a,button")||t(s,o)};return document.addEventListener("click",n,{capture:!0,passive:!0}),document.addEventListener("keydown",r,{capture:!0,passive:!0}),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("keydown",r,!0)}}});const vy=600,Sy=30,Ey=3,ky=200,Ay=500,Ty=5,Ml="[data-glue-ignore],[data-private]";function Cy(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Iy(){try{return sessionStorage.getItem("glue_session_id")||""}catch{return""}}function xy(e,t,n){return t>=1?!0:t<=0?!1:n?Cy(`${e}:${n}`)/4294967296<t:!0}function Ol(e){try{const t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}catch{return null}}function Ly(e,t,n){const r=Array.isArray(n)?n:[];for(const i of r){const s=typeof i=="string"?Ol(i):null;if(s&&s.test(e))return!1}const o=Array.isArray(t)?t:[];if(!o.length)return!0;for(const i of o){const s=typeof i=="string"?Ol(i):null;if(s&&s.test(e))return!0}return!1}function Rl(e){const t=Ci(e);return t?El(t)||t:null}function Nl(e){return e.target_fixed?{...e,page_x:e.viewport_x,page_y:e.viewport_y}:e}se({name:"heatmaps",feature:"heatmaps",init(e){if(typeof window>"u"||typeof document>"u")return;const t=e.config||{},n=typeof t.sample_rate=="number"?t.sample_rate:1,r=Iy();if(!xy("heatmaps",n,r)){e.log.log("heatmaps: session sampled out (rate",n,")");return}if(!Ly(window.location.origin+window.location.pathname,t.url_allow,t.url_deny)){e.log.log("heatmaps: url excluded by url_allow/url_deny");return}const i=t.budgets||{},s=Number(i.max_clicks_per_page)>0?Number(i.max_clicks_per_page):ky,a=Number(i.max_moves_per_page)>0?Number(i.max_moves_per_page):Ay,c=!!t.capture_pointer_moves,l=Number(t.move_sample_hz)>0?Number(t.move_sample_hz):Ty,u=1e3/l,d=[];let w=[];const g=m=>{const _=Date.now();return w=w.filter(v=>_-v.at<=vy&&Math.hypot(v.x-m.clientX,v.y-m.clientY)<=Sy),w.push({at:_,x:m.clientX,y:m.clientY}),w.length>=Ey},p=()=>({path:e.route(),route_template:lr(e.route(),t.route_patterns)}),k=m=>{try{if(!m.isTrusted)return;const _=Rl(m);if(!_||_.closest(Ml))return;const v=Ii(_,{event:m,config:t});if(!v)return;const f=Nl(v),b=g(m);if(!e.budget.take("heatmap_click",s))return;e.track("heatmap_click",{...f,is_rageclick:b,...p()})}catch(_){e.log.warn("heatmaps: click handler failed:",_)}};if(document.addEventListener("click",k,{capture:!0,passive:!0}),d.push(()=>document.removeEventListener("click",k,!0)),c){let m=0;const _=v=>{try{const f=Date.now();if(f-m<u)return;m=f;const b=Rl(v);if(!b||b.closest(Ml))return;const I=Ii(b,{event:v,config:t});if(!I)return;const E=Nl(I);if(!e.budget.take("heatmap_pointermove",a))return;e.track("heatmap_pointermove",{...E,sample_hz:l,...p()})}catch(f){e.log.warn("heatmaps: pointermove handler failed:",f)}};document.addEventListener("mousemove",_,{capture:!0,passive:!0}),d.push(()=>document.removeEventListener("mousemove",_,!0))}return d.push(e.onNavigate(()=>{w=[]})),()=>{for(const m of d)try{m()}catch{}}}});const xi="surveys",Li="1",My=1e4,Oy=50,Mi=new Map;function Ry(e,t){return`${e}@${t}`}function Oi(){const e=window;return e.__glueModules||(e.__glueModules={}),e.__glueModules}function Ny(e,t){const n=Oi();return n[e]?Promise.resolve(n[e]):new Promise((r,o)=>{const i=Date.now(),s=()=>{const a=Oi()[e];if(a){r(a);return}if(Date.now()-i>=t){o(new Error(`surveys module load timed out: ${e}`));return}setTimeout(s,Oy)};s()})}function $y(e,t){return new Promise((n,r)=>{const o=document.createElement("script");o.src=e,o.crossOrigin="anonymous",o.async=!0;const i=setTimeout(()=>r(new Error("surveys module script load timed out")),t);o.onload=()=>{clearTimeout(i),n()},o.onerror=()=>{clearTimeout(i),r(new Error("surveys module script failed to load"))},(document.head||document.documentElement).appendChild(o)})}function Dy(e,t,n={}){if(typeof e.loadModule=="function")return e.loadModule(xi,Li);const r=Ry(xi,Li),o=Mi.get(r);if(o)return o;const i=n.timeoutMs??My,s=Oi(),a=s[r]?Promise.resolve(s[r]):(async()=>{const c=`${t.replace(/\/$/,"")}/functions/v1/glue?module=${xi}&v=${Li}`;return await $y(c,i),Ny(r,i)})();return Mi.set(r,a),a.catch(()=>Mi.delete(r)),a}const $l="glue_survey_sample";function Py(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}function Fy(e,t,n){const r=typeof t=="number"&&t>=0&&t<=1?t:1;if(r>=1)return!0;if(r<=0)return!1;const o=Uy();if(o&&o.v===n)return o.sampled;const i=Py("surveys:"+e)/4294967295<r;try{P($l,JSON.stringify({v:n,sampled:i}))}catch{}return i}function Uy(){try{const e=j($l);return e?JSON.parse(e):null}catch{return null}}const jy="glue_survey_session_shown";function qy(){const e=j(jy),t=e?parseInt(e,10):0;return Number.isFinite(t)?t:0}se({name:"surveys",feature:"surveys",init(e){if(typeof window>"u"||typeof document>"u"||!e.features.surveys)return;const t=e.config||{},n=typeof t.max_per_session=="number"?t.max_per_session:1,r="[data-glue-form], [data-glue-form-id]",o=n<=0||qy()>=n,i=window.__glueConfig||{},s=i.workspaceId,a=i.supabaseUrl;if(!s||!a)return;const c=ln(),l=String(i.tracking?.config_version||"unversioned");if(!Fy(c.session_id,typeof t.sample_rate=="number"?t.sample_rate:1,l))return;const u=h("glue_user_id")||"";if(!u)return;let d=!1,w=null,g=!1,p=null;const k=()=>{g||d||(g=!0,Dy(e,a).then(m=>{d||(w=m.start({features:e.features,config:t,track:e.track,onEvent:e.onEvent,onNavigate:e.onNavigate,onLeave:e.onLeave,route:e.route,log:e.log,workspaceId:s,glueUserId:u,sessionId:c.session_id,supabaseUrl:a,glue:{glue_user_id:u,session_id:c.session_id,utm:c.utm||{},tracking:c.tracking||{}}}))}).catch(m=>e.log.warn("surveys: module load failed:",m)))};return!o||document.querySelector(r)?k():document.documentElement&&(p=new MutationObserver(()=>{document.querySelector(r)&&(p?.disconnect(),p=null,k())}),p.observe(document.documentElement,{childList:!0,subtree:!0})),()=>{d=!0,p?.disconnect(),w&&w()}}});const Hy=0xfffffffffffffffn;function zy(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e);const t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|r&63):r>=55296&&r<56320&&n+1<e.length?(r=65536+(r-55296<<10)+(e.charCodeAt(++n)-56320),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)):t.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(t)}function By(e){const t=zy(e),n=t.length,r=(n+8>>6<<4)+16,o=new Uint32Array(r);for(let g=0;g<n;g++)o[g>>2]|=t[g]<<24-g%4*8;o[n>>2]|=128<<24-n%4*8,o[r-1]=n*8>>>0,o[r-2]=Math.floor(n*8/4294967296);let i=1732584193,s=4023233417,a=2562383102,c=271733878,l=3285377520;const u=new Uint32Array(80),d=(g,p)=>g<<p|g>>>32-p;for(let g=0;g<r;g+=16){for(let f=0;f<16;f++)u[f]=o[g+f];for(let f=16;f<80;f++)u[f]=d(u[f-3]^u[f-8]^u[f-14]^u[f-16],1);let p=i,k=s,m=a,_=c,v=l;for(let f=0;f<80;f++){let b,I;f<20?(b=k&m|~k&_,I=1518500249):f<40?(b=k^m^_,I=1859775393):f<60?(b=k&m|k&_|m&_,I=2400959708):(b=k^m^_,I=3395469782);const E=d(p,5)+b+v+I+u[f]>>>0;v=_,_=m,m=d(k,30)>>>0,k=p,p=E}i=i+p>>>0,s=s+k>>>0,a=a+m>>>0,c=c+_>>>0,l=l+v>>>0}const w=new Uint8Array(20);for(const[g,p]of[i,s,a,c,l].entries())w[g*4]=p>>>24,w[g*4+1]=p>>>16&255,w[g*4+2]=p>>>8&255,w[g*4+3]=p&255;return w}function Dl(e,t,n=""){const r=By(`${e}${t}${n}`);let o=0n;for(let i=0;i<8;i++)o=o<<8n|BigInt(r[i]);return o>>=4n,Number(o)/Number(Hy)}function Vy(e,t){if(t in e)return e[t];const n=t.split(".");let r=e;for(const o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return;return r}const wr=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null},Pl=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;if(typeof e=="string"){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null},ee=e=>String(e??"").toLowerCase(),br=e=>Array.isArray(e)?e:e==null?[]:[e];function Wy(e,t){if(e.type==="segment"||e.key==="segment"){const o=new Set(t.segments??[]),s=br(e.value).map(String).some(a=>o.has(a));return e.operator==="is_not"||e.operator==="not_in"?!s:s}const n=Vy(t.properties,e.key),r=e.value;switch(e.operator){case"is_set":return n!=null&&n!=="";case"is_not_set":return n==null||n==="";case"exact":case"in":return n==null?!1:br(r).some(o=>ee(o)===ee(n));case"is_not":case"not_in":return n==null?!0:!br(r).some(o=>ee(o)===ee(n));case"icontains":return n!=null&&ee(n).includes(ee(r));case"not_icontains":return!(n!=null&&ee(n).includes(ee(r)));case"starts_with":return n!=null&&ee(n).startsWith(ee(r));case"not_starts_with":return!(n!=null&&ee(n).startsWith(ee(r)));case"ends_with":return n!=null&&ee(n).endsWith(ee(r));case"not_ends_with":return!(n!=null&&ee(n).endsWith(ee(r)));case"regex":case"not_regex":{if(n==null)return e.operator==="not_regex";let o=!1;try{o=new RegExp(String(r)).test(String(n))}catch{o=!1}return e.operator==="regex"?o:!o}case"gt":case"gte":case"lt":case"lte":{const o=wr(n),i=wr(r);return o===null||i===null?!1:e.operator==="gt"?o>i:e.operator==="gte"?o>=i:e.operator==="lt"?o<i:o<=i}case"between":case"not_between":{const o=wr(n),[i,s]=br(r).map(wr);if(o===null||i===null||s===null)return!1;const a=o>=i&&o<=s;return e.operator==="between"?a:!a}case"is_date_before":case"is_date_after":{const o=Pl(n),i=Pl(r);return o===null||i===null?!1:e.operator==="is_date_before"?o<i:o>i}default:return!1}}function Gy(e){const t=[];let n=0;for(const r of e){const o=Math.max(0,Number(r.rollout_percentage)||0)/100;t.push({key:r.key,min:n,max:n+o}),n+=o}return t}function Ky(e,t){if(!e.variants.length)return null;const n=Dl(`${e.key}.`,t,"variant");for(const r of Gy(e.variants))if(n>=r.min&&n<r.max)return e.variants.find(o=>o.key===r.key)??null;return null}function Jy(e,t){const n={key:e.key,value:!1,variant:null,payload:null,reason:"inactive",condition_index:null,experiment_id:e.experiment_id??null};if(!e.active)return n;const r=t.persisted?.[e.key];if(e.ensure_experience_continuity&&r){const i=e.variants.find(s=>s.key===r)??null;if(i||r==="true")return{...n,value:i?i.key:!0,variant:i?.key??null,payload:i?.payload??e.payload??null,reason:"persisted"}}const o=e.release_conditions.length?e.release_conditions:[{properties:[],rollout_percentage:100}];for(const[i,s]of o.entries()){if(!s.properties.every(l=>Wy(l,t)))continue;const a=Math.min(100,Math.max(0,Number(s.rollout_percentage)||0));if(a<100&&Dl(`${e.key}.`,t.identifier,"")>a/100)continue;if(s.variant){const l=e.variants.find(u=>u.key===s.variant)??null;if(l)return{...n,value:l.key,variant:l.key,payload:l.payload??null,reason:"variant_override",condition_index:i}}const c=Ky(e,t.identifier);return e.variants.length&&!c?{...n,reason:"no_condition_match",condition_index:i}:{...n,value:c?c.key:!0,variant:c?.key??null,payload:c?.payload??e.payload??null,reason:"condition_rollout",condition_index:i}}return{...n,reason:"no_condition_match"}}function Xy(e,t){const n={};for(const r of e)n[r.key]=Jy(r,t);return n}const Fl="glue_flag_assignments",Ul="glue_flag_overrides",jl="glue_flag_properties",Yy="$feature_flag_called",ql=200;function Ri(e,t,n=!1){try{const r=n?window.sessionStorage?.getItem(e):h(e);if(!r)return t;const o=JSON.parse(r);return o&&typeof o=="object"?o:t}catch{return t}}function Ni(e,t,n=!1){try{const r=JSON.stringify(t);n?window.sessionStorage?.setItem(e,r):S(e,r)}catch{}}function Hl(e){const t={};for(const n of["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"]){const r=h(`${e}${n}`);r&&(t[n]=r)}return t}function Zy(e){const t=Hl("glue_last_"),n=Hl("glue_initial_"),r=h("glue_user_geolocation")||"",[o="",i="",s=""]=r.split("|").map(w=>w.trim()),a=h("glue_email")||"",c={};for(const w of["gclid","gbraid","wbraid","fbclid","ttclid","msclkid"]){const g=h(`glue_last_${w}`);g&&(c[w]=g)}const l=new Date,u=typeof location<"u"?location:{},d=typeof navigator<"u"?navigator:{};return{...t,...Object.fromEntries(Object.entries(n).map(([w,g])=>[`initial_${w}`,g])),...c,referrer:h("glue_user_referrer")||(typeof document<"u"?document.referrer:""),landing_url:h("glue_url_first")||"",url:{href:u.href,path:u.pathname,host:u.hostname,search:u.search,hash:u.hash},geo:{country_code:o,country:i,city:s},email:a,email_domain:a.includes("@")?a.split("@").pop():"",identified:!!a,device:{user_agent:d.userAgent||"",language:d.language||"",mobile:typeof window<"u"?window.innerWidth<768:!1,viewport_width:typeof window<"u"?window.innerWidth:0},returning:!!h("glue_url_first")&&h("glue_url_first")!==u.href,hour:l.getHours(),weekday:l.getDay(),...e}}const zl=new WeakMap;function Qy(e,t,n){const r=typeof location<"u"?location.pathname:"";for(const o of t){if(!o||typeof o.selector!="string")continue;if(o.path)try{if(!new RegExp(o.path).test(r))continue}catch{continue}let i=[];try{i=Array.from(document.querySelectorAll(o.selector))}catch{continue}for(const s of i.slice(0,50)){const a=zl.get(s)??new Set,c=`${e}:${o.selector}`;if(!a.has(c)){a.add(c),zl.set(s,a);try{if(typeof o.text=="string"&&(s.textContent=o.text),typeof o.html=="string"&&(s.innerHTML=o.html),o.attributes)for(const[l,u]of Object.entries(o.attributes))/^on/i.test(l)||typeof u=="string"&&/^\s*javascript:/i.test(u)||s.setAttribute(l,String(u));typeof o.css=="string"&&(s.style.cssText+=`;${o.css}`)}catch(l){n.warn(`flag ${e}: transform failed`,l)}}}}}function Bl(e){typeof document>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e())}se({name:"flags",feature:"flags",init(e){const t=Array.isArray(e.config?.definitions)?e.config.definitions.filter(m=>m&&typeof m.key=="string"):[],n=new Set;let r=Ri(Ul,{},!0),o=Ri(jl,{}),i=Ri(Fl,{}),s={},a={},c=new Set,l=!1;const u=()=>{const _={identifier:e.ids().glue_user_id,properties:Zy(o),segments:Array.isArray(o.segments)?o.segments:[],persisted:i};s=Xy(t,_),a={};let v=!1;for(const[f,b]of Object.entries(s)){const I=f in r?r[f]:b.value;if(a[f]=I,I!==!1){const E=typeof I=="string"?I:"true";i[f]!==E&&(i[f]=E,v=!0)}}if(v){const f=Object.keys(i);if(f.length>ql)for(const b of f.slice(0,f.length-ql))delete i[b];Ni(Fl,i)}for(const f of n)try{f({...a})}catch(b){e.log.warn("onFeatureFlags listener failed",b)}},d=m=>{const _=a[m];if(_===void 0||_===!1)return;const v=typeof _=="string"?_:"true",f=`${m}:${v}`;if(c.has(f))return;c.add(f);const b=t.find(I=>I.key===m);e.track(Yy,{flag_key:m,variant:v,experiment_id:b?.experiment_id??null,flag_version:b?.version??null,reason:m in r?"override":s[m]?.reason??null})},w=()=>{for(const m of t){const _=a[m.key];if(_===!1||_===void 0)continue;const v=m.variants.find(f=>f.key===_);if(v){if(v.redirect_url&&!l&&typeof location<"u")try{const f=new URL(v.redirect_url,location.href);if(/^https?:$/.test(f.protocol)&&f.href!==location.href){l=!0,d(m.key),!f.search&&location.search&&(f.search=location.search),location.replace(f.href);return}}catch{}v.transforms?.length&&(d(m.key),Qy(m.key,v.transforms,e.log))}}},g={getFeatureFlag:m=>{const _=a[m]??!1;return d(m),_},isFeatureEnabled:m=>g.getFeatureFlag(m)!==!1,getFeatureFlagPayload:m=>{const _=a[m];if(_===void 0||_===!1)return null;const v=t.find(b=>b.key===m),f=v?.variants.find(b=>b.key===_);return d(m),f?.payload??v?.payload??null},getAllFlags:()=>({...a}),getFlagDetails:m=>s[m]??null,onFeatureFlags:m=>{n.add(m);try{m({...a})}catch{}return()=>n.delete(m)},overrideFeatureFlags:m=>{r=m===!1?{}:{...m},Ni(Ul,r,!0),c=new Set,u()},setProperties:m=>{o={...o,...m},Ni(jl,o),u()},reload:()=>u()};u(),Bl(w);const p=window;if(p.glue&&typeof p.glue=="object"){p.glue.flags=g;for(const m of["getFeatureFlag","isFeatureEnabled","getFeatureFlagPayload","onFeatureFlags","overrideFeatureFlags"])typeof p.glue[m]!="function"&&(p.glue[m]=g[m])}const k=e.onNavigate(()=>{c=new Set,u(),Bl(w)});return e.log.log(`flags: ${t.length} definition(s), ${Object.values(a).filter(m=>m!==!1).length} on`),()=>{k(),n.clear(),p.glue&&p.glue.flags===g&&delete p.glue.flags}}});const ew=1,Vl=1,tw=30*60*1e3;function $i(e){const t=3e3*2**e,n=t/2,r=Math.min(tw,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}const Ue=B("replay-sync"),Di="replay-1",Wl="glue_replay_pending:",Gl=8,nw=1e6,rw=6e4,Kl=12;let Pi=Kl;const ow=6e4,iw=3,Jl=15e3,sw=5,Xl=5*60*1e3,aw=49152,cw=4096;let Rt=null,Ze=null,Fi=!1,Ui=null,Yl=!1,vr=[],Sr=0,Nt=!1,xn=aw;const je={};let Zl=0,Er=null;const lw=10;function kr(e){return Wl+e}function uw(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length;let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319&&n+1<e.length?(t+=4,n++):t+=3}return t}function $t(){Ze||(Ze=[]);for(const e of As(Wl))try{const t=JSON.parse(h(e)||"null");if(!t||typeof t.chunk_id!="string"||!t.payload)continue;Ze.some(n=>n.chunk_id===t.chunk_id)||Ze.push(t)}catch{}return Ze.sort((e,t)=>e.created_at-t.created_at)}function Ar(e){S(kr(e.chunk_id),JSON.stringify(e))}function Ql(e){ne(kr(e.chunk_id)),Ze=(Ze||[]).filter(t=>t.chunk_id!==e.chunk_id)}function Ln(e,t=1){je[e]=(je[e]||0)+t}function eu(e){return{workspace_id:e.workspace_id,hostname:Rt.hostname,glue_user_id:e.glue_user_id,session_id:e.session_id,window_id:e.window_id,recording_id:e.recording_id,schema_version:ew,sdk:{version:Di,page_leave:!1},client_ts:Date.now(),url:dw()}}function dw(){if(typeof location>"u")return null;const e=String(location.href||""),t=e.indexOf("?"),n=e.indexOf("#"),r=t===-1?n:n===-1?t:Math.min(t,n);return r===-1?e:e.slice(0,r)}function fw(){let e=1;try{const r=globalThis?.window?.__glueConfig?.tracking?.featureConfig?.session_recording?.sample_rate;typeof r=="number"&&isFinite(r)&&(e=r)}catch{}let t=!0;try{t=Xn("session_recording",e,gw())}catch{t=!0}return{sample_rate:e,sampled:t}}function gw(){try{const e=globalThis?.window?.__glueConfig;return String(e?.tracking?.config_version||e?.config_version||"")}catch{return""}}function mw(e,t){const n={},r=Ws();r.storage&&Object.assign(n,r),t&&Object.keys(je).length&&(n.drops={...je}),Object.keys(n).length&&(e.meta=n)}function pw(){const e=$t(),t=()=>e.reduce((n,r)=>n+r.bytes,0);for(;e.length>Gl||e.length>0&&t()>nw;){let n=e.findIndex(o=>o.status==="exhausted");n===-1&&(n=0);const[r]=e.splice(n,1);ne(kr(r.chunk_id)),Ln("queue_full"),Ue.warn(`replay pending capacity reached, dropped chunk ${r.chunk_id} (seq ${r.seq})`)}Ze=e}function tu(){return`${Rt.supabaseUrl}/functions/v1/ingest-replay`}function _w(e,t,n){if(e===409)return"conflict";const r=e>=200&&e<300;return r&&t&&t.success===!0&&t.chunk_id===n&&(t.accepted===!0||t.duplicate===!0)?"delivered":t?.ledger==="unavailable"||t?.accepted===!1?"failed":r?"unknown":"failed"}function hw(e,t=Date.now()){if(!e)return null;const n=Number(e);if(Number.isFinite(n)&&n>=0)return Math.min(n*1e3,Xl);const r=Date.parse(e);return Number.isNaN(r)?null:Math.min(Math.max(0,r-t),Xl)}function yw(e=Date.now()){return vr=vr.filter(t=>e-t<ow),vr.length>=Pi}function ww(){return Pi}function nu(){try{const t=globalThis?.window?.__glueConfig?.tracking?.featureConfig?.session_recording?.budgets?.session_chunks_per_minute;if(typeof t=="number"&&isFinite(t)&&t>0)return Math.floor(t)}catch{}return Kl}async function bw(e,t){let n=!1,r=null,o;const i=globalThis.AbortController;if(typeof i=="function"){const s=new i;o=s.signal,r=setTimeout(()=>{n=!0;try{s.abort()}catch{}},Jl)}vr.push(Date.now());try{const s=await fetch(tu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.payload),keepalive:t,...o?{signal:o}:{}});let a=null;try{a=await s.json()}catch{a=null}const c=_w(s.status,a,e.chunk_id),l=hw(typeof s.headers?.get=="function"?s.headers.get("Retry-After"):null),u=typeof a?.next_expected_seq=="number"?a.next_expected_seq:null;return{ack:c,status:s.status,nextExpectedSeq:u,retryAfterMs:l,payloadTooLarge:s.status===413||a?.error==="payload_too_large",maxBytes:typeof a?.max_bytes=="number"?a.max_bytes:null}}catch(s){return n?Ue.warn(`replay chunk request timed out after ${Jl}ms`):Ue.warn("replay chunk request failed:",s),{ack:"failed",status:0,nextExpectedSeq:null,retryAfterMs:null,payloadTooLarge:!1,maxBytes:null}}finally{r&&clearTimeout(r)}}function ru(){if(Ui||typeof setTimeout!="function")return;let e=1/0;for(const t of $t())t.status!=="pending"||t.next_at===null||t.next_at<e&&(e=t.next_at);isFinite(e)&&(Ui=setTimeout(()=>{Ui=null,Tr()},Math.max(0,e-Date.now())))}function vw(e,t){if(t.ack==="delivered"){Sr=0,t.nextExpectedSeq!==null&&t.nextExpectedSeq>e.seq+1&&(Ue.warn(`replay gap: collector expects seq ${t.nextExpectedSeq}, we sent ${e.seq}`),Mo(t.nextExpectedSeq-1)),Ql(e);return}if(t.ack==="conflict"){t.nextExpectedSeq!==null?Mo(t.nextExpectedSeq-1):Mo(e.seq),Ln("seq_conflict");const n=e.chunk_id,r=Js();e.seq=r,e.chunk_id=re(),e.payload.chunk.seq=r,e.payload.chunk.chunk_id=e.chunk_id,e.attempt+=1,e.next_at=Date.now()+$i(e.attempt),ne(kr(n)),Ar(e),ru();return}if(t.payloadTooLarge){xn=Math.max(cw,Math.floor(xn/2)),Ue.warn(`replay chunk too large, target halved to ${xn} bytes`),Ln("record_too_large"),Ql(e);return}t.status===429?(Sr+=1,Sr>=iw&&(Nt=!0,Ln("throttled"),Ue.warn("replay upload paused for the rest of this session after repeated throttling"))):t.status!==0&&(Sr=0),e.attempt+=1,e.attempt>=sw?(e.status="exhausted",e.next_at=null):t.ack==="blind"?e.next_at=null:t.status===429?e.next_at=Date.now()+(t.retryAfterMs??$i(e.attempt)):t.status>=400&&t.status<500&&t.status!==408?(e.status="exhausted",e.next_at=null):e.next_at=Date.now()+$i(e.attempt-1),Ar(e),ru()}function ou(e){Rt=e,Pi=e.chunksPerMinute&&e.chunksPerMinute>0?Math.floor(e.chunksPerMinute):nu(),!Yl&&typeof window<"u"&&(Yl=!0,window.addEventListener("pagehide",()=>{Sw()}),window.addEventListener("online",()=>{Tr(!0)})),Tr(!0)}function ji(e){if(!Rt)return Ue.warn("replay sync not initialized"),null;if(Nt)return Ln("throttled"),null;const t=ut();if(!t.recording_id)return Ue.warn("replay chunk dropped: no open recording"),null;const n=re(),r=Js(),o=typeof e.bytes=="number"&&e.bytes>=0?e.bytes:uw(typeof e.payload=="string"?e.payload:JSON.stringify(e.payload)),i=fw(),s={...eu(t),chunk:{chunk_id:n,seq:r,kind:e.kind,started_at:e.started_at,ended_at:e.ended_at??Date.now(),rel_start_ms:e.rel_start_ms??null,rel_end_ms:e.rel_end_ms??null,record_count:e.record_count??0,bytes:o,encoding:e.encoding??"json",checksum:e.checksum,payload:e.payload,sample_rate:i.sample_rate,sampled:i.sampled}};e.end&&(s.end=!0,s.end_reason=e.end_reason||"client_end",Er=t.recording_id),Zl+=1,mw(s,Zl%lw===0||!!e.end);const a={chunk_id:n,recording_id:t.recording_id,seq:r,bytes:o,attempt:0,status:"pending",created_at:Date.now(),next_at:Date.now(),payload:s};return $t().push(a),Ar(a),pw(),Tr(),a}async function Tr(e=!1){if(!(!Rt||Fi||Nt)){Fi=!0;try{const t=Date.now();for(const n of $t().slice())if(n.status==="pending"&&!(!e&&(n.next_at===null||n.next_at>t))){if(yw()){Ue.log("replay upload paced: client rate budget reached");break}if(vw(n,await bw(n,!1)),Nt)break}}finally{Fi=!1}}}function Sw(){if(!Rt||Nt)return;let e=rm-nm();const t=ut();function n(s){return s.length>rw||s.length>e||typeof navigator>"u"||typeof navigator.sendBeacon!="function"||!navigator.sendBeacon(tu(),new Blob([s],{type:"application/json"}))?!1:(e-=s.length,!0)}const r=$t().slice().reverse(),o=!!t.recording_id&&Er!==t.recording_id;let i=!1;for(const s of r){if(s.status!=="pending")continue;const a=o&&!i,c=JSON.stringify({...s.payload,sdk:{version:Di,page_leave:!0},...a?{end:!0,end_reason:"page_leave",meta:{...s.payload.meta||{},...Object.keys(je).length?{drops:{...je}}:{}}}:{}});try{if(!n(c))continue}catch{return}a&&(i=!0,Er=t.recording_id),s.attempt+=1,s.next_at=null,Ar(s)}if(o&&!i){const s=JSON.stringify({...eu(t),sdk:{version:Di,page_leave:!0},end:!0,end_reason:"page_leave",meta:Object.keys(je).length?{drops:{...je}}:void 0});try{n(s)&&(Er=t.recording_id)}catch{}}}function Ew(){return xn}function iu(){const e=$t(),t=e.filter(n=>n.status==="pending");return{pending:t.length,exhausted:e.length-t.length,bytes_pending:t.reduce((n,r)=>n+r.bytes,0),paused:Nt,chunk_target_bytes:xn,drops:{...je}}}const kw={chunk_bytes:49152,flush_ms:5e3,max_duration_ms:36e5,max_bytes:12582912,snapshot_interval_ms:3e5,idle_flush_ms:3e4,max_chunks:900,snapshot_bytes:2097152,max_body_bytes:524288,beacon_bytes:6e4,idle_ms:3e5,max_record_bytes:943718,compress_min_bytes:0,compress_max_bytes:524288},Aw={sample_rate:.2};function le(e,t,n,r){const o=typeof e=="number"?e:Number(e);return Number.isFinite(o)?Math.min(r,Math.max(n,Math.floor(o))):t}function Cr(e,t=50){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(typeof r!="string")continue;const o=r.trim();if(o&&n.push(o.slice(0,300)),n.length>=t)break}return n}function Tw(e){const t=e?.inputs;return{inputs:t==="sensitive"||t==="none"?t:"all",selectors:Cr(e?.selectors),unmask_selectors:Cr(e?.unmask_selectors)}}function Cw(e){const t=kw;return{chunk_bytes:le(e?.chunk_bytes,t.chunk_bytes,4096,262144),flush_ms:le(e?.flush_ms,t.flush_ms,500,6e4),idle_flush_ms:le(e?.idle_flush_ms,t.idle_flush_ms,1e3,3e5),max_duration_ms:le(e?.max_duration_ms,t.max_duration_ms,3e4,36e5),max_bytes:le(e?.max_bytes,t.max_bytes,65536,12582912),max_chunks:le(e?.max_chunks,t.max_chunks,4,900),snapshot_interval_ms:le(e?.snapshot_interval_ms,t.snapshot_interval_ms,3e4,18e5),snapshot_bytes:le(e?.snapshot_bytes,t.snapshot_bytes,65536,8388608),idle_ms:le(e?.idle_ms,t.idle_ms,5e3,18e5),max_record_bytes:le(e?.max_record_bytes,t.max_record_bytes,16384,4194304),max_body_bytes:le(e?.max_body_bytes,t.max_body_bytes,65536,524288),beacon_bytes:le(e?.beacon_bytes,t.beacon_bytes,4096,6e4),compress_min_bytes:le(e?.compress_min_bytes,t.compress_min_bytes,0,262144),compress_max_bytes:le(e?.compress_max_bytes,t.compress_max_bytes,4096,4194304)}}function Iw(e){const t=e&&typeof e=="object"?e:{},n=typeof t.sample_rate=="number"?t.sample_rate:Number(t.sample_rate);return{sample_rate:Number.isFinite(n)?Math.min(1,Math.max(0,n)):Aw.sample_rate,url_allow:Cr(t.url_allow),url_deny:Cr(t.url_deny),mask:Tw(t.mask),budgets:Cw(t.budgets),capture_canvas:t.capture_canvas===!0,capture_iframes:t.capture_iframes==="all"?"all":t.capture_iframes==="none"?"none":"same_origin"}}const su="recorder",qi="1",xw="session_recording",au="session_replay",Hi=new Map;function Lw(e){if(Hi.has(e))return Hi.get(e);let t=null;try{const n=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");t=new RegExp("^"+n+"$","i")}catch{t=null}return Hi.set(e,t),t}function Mw(e){try{const t=new URL(e);return t.origin+t.pathname}catch{return""}}function cu(e,t){for(const n of t){const r=Lw(n);if(r&&r.test(e))return!0}return!1}function Ow(e,t=[],n=[]){const r=Mw(e);return!(!r||n.length&&cu(r,n)||t.length&&!cu(r,t))}const lu=`${su}@${qi}`;function Ir(){return typeof window>"u"?null:window}function Rw(e){if(typeof window>"u")return;const t=Iw(e.config);if(!Kt(au)){e.log.log("replay: not allowed by privacy settings");return}if(!Ow(window.location.href,t.url_allow,t.url_deny)){e.log.log("replay: url excluded by workspace rules");return}if(!e.sampled()){e.log.log("replay: session not sampled");return}if(!Nw(e))return;let n=null,r=!1;return $w(e).then(o=>{if(r||!o)return;if(o.version!==qi){e.log.warn(`replay: recorder module version mismatch (${o.version})`);return}n=o.create({config:t,host:{ids:()=>e.ids(),enqueue:ji,chunkTargetBytes:Ew,onSessionRotated:Ys,storage:{get:j,set:P,remove:Et},recording:{getId:en,setId:Lo,peekSeq:Xs}},hostname:window.location.hostname,log:e.log,isAllowed:()=>Kt(au),storageMode:Vs()==="memory"?"memory":"full",onStopped:s=>{r||s!=="max_duration"&&s!=="session_rotated"||setTimeout(()=>{r||n?.start()},0)}}),n.start(),e.onCleanup(e.onNavigate(()=>n?.notifyNavigate())),e.onCleanup(e.onLeave(s=>n?.notifyLeave(s)));const i=Ir();i&&(i.glueReplay={start:()=>n?.start(),stop:s=>n?.stop(s??"manual"),pause:()=>n?.pause(),resume:()=>n?.resume(),flush:()=>n?.flush(),status:()=>n?.status()??{state:"idle"}})}).catch(o=>e.log.warn("replay: recorder module failed to load:",o)),()=>{r=!0;const o=Ir();o&&o.glueReplay&&delete o.glueReplay,n?.stop("feature_disabled"),n=null}}function Nw(e){const t=Ir()?.__glueConfig?.supabaseUrl;return t?(ou({supabaseUrl:String(t),hostname:typeof location<"u"?location.hostname:""}),Yn(),!0):(e.log.warn("replay: no supabaseUrl in __glueConfig; recorder not started"),!1)}async function $w(e){const t=Ir(),n=t?.__glueModules?.[lu];return n||(await e.loadModule(su,qi)??t?.__glueModules?.[lu]??null)}se({name:"sessionRecording",feature:xw,init:Rw});const Dw=4,zi=500,Bi=20,Pw=20,Fw=4096;function xr(e,t){return e.length>t?`${e.slice(0,t)}…[+${e.length-t} chars]`:e}function Uw(e){return typeof Node<"u"&&e instanceof Node}function jw(e){try{const t=String(e.tagName||e.nodeName||"node").toLowerCase(),n=e.id?`#${e.id}`:"";return`[DOMNode <${t}${n}>]`}catch{return"[DOMNode]"}}function Vi(e,t,n){if(e==null)return e;const r=typeof e;if(r==="string")return xr(e,zi);if(r==="number"||r==="boolean")return e;if(r==="bigint")return`${e}n`;if(r==="function")return`[Function: ${e.name||"anonymous"}]`;if(r==="symbol")return String(e);if(e instanceof Error)return{__type:"Error",name:e.name,message:xr(String(e.message??""),zi)};if(Uw(e))return jw(e);if(r!=="object")return String(e);const o=e;if(n.has(o))return"[Circular]";if(t>=Dw)return Array.isArray(o)?"[Array]":"[Object]";n.add(o);try{if(Array.isArray(o)){const c=o.slice(0,Bi).map(l=>Vi(l,t+1,n));return o.length>Bi&&c.push(`…[+${o.length-Bi} more]`),c}let i;try{i=Object.keys(o)}catch{return"[Unserializable]"}const s={};let a=0;for(const c of i){if(a>=Pw){s["…"]=`+${i.length-a} more`;break}let l;try{l=Object.getOwnPropertyDescriptor(o,c)}catch{s[c]="[Unreadable]",a++;continue}if(l&&(l.get||l.set)&&!("value"in l)){s[c]="[Getter]",a++;continue}let u;try{u=o[c]}catch{s[c]="[Unreadable]",a++;continue}s[c]=Vi(u,t+1,n),a++}return s}finally{n.delete(o)}}function qw(e){try{const t=JSON.stringify(e);return t?t.length:0}catch{return 1/0}}function uu(e,t=Fw){const n=Vi(e,0,new WeakSet),r=qw(n);return r<=t?n:{__truncated:!0,approx_bytes:r}}function Hw(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${xr(String(e.message??""),zi)}`;if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="object")try{return JSON.stringify(uu(e))}catch{return"[Unserializable]"}return String(e)}function du(e,t=2e3){const n=e.map(Hw).join(" ");return xr(n,t)}const fu=/^\s*at .*(\S+:\d+|\(native\))/m,zw=/^(eval@)?(\[native code])?$/;function gu(e){if(e.indexOf(":")===-1)return[e,void 0,void 0];const n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return n?[n[1],n[2]?Number(n[2]):void 0,n[3]?Number(n[3]):void 0]:[e,void 0,void 0]}function Bw(e){return e.split(`
`).filter(n=>!!n.match(fu)).map(n=>{let r=n;r.indexOf("(eval ")>-1&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let o=r.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=o.match(/ (\((.+):(\d+):(\d+)\)$)/);o=i?o.replace(i[0],""):o;const s=o.split(/\s+/).slice(1),[a,c,l]=gu(i?i[1]:s.pop()??"");return{functionName:s.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(a)>-1?void 0:a,lineNumber:c,columnNumber:l}})}function Vw(e){return e.split(`
`).filter(n=>!n.match(zw)).map(n=>{if(n.indexOf("@")===-1&&n.indexOf(":")===-1)return{functionName:n};const r=/((.*".+"[^@]*)?[^@]*)(?:@)/,o=n.match(r),i=o&&o[1]?o[1]:void 0,[s,a,c]=gu(n.replace(r,""));return{functionName:i,fileName:s,lineNumber:a,columnNumber:c}})}function Ww(e){return!e||!e.stack?[]:e.stack.match(fu)?Bw(e.stack):Vw(e.stack)}const Gw=2e3,Kw=20;function Wi(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36)}function Jw(e){const t=String(e??"");if(!t)return"";try{const n=new URL(t,typeof location<"u"?location.href:void 0);return(n.origin==="null"?"":n.origin)+n.pathname}catch{return t.split(/[?#]/)[0].slice(0,300)}}function Gi(e){if(typeof e!="string")return;const t=Ww({stack:e}).slice(0,Kw),n=[];for(const o of t)if(!(!o.fileName||typeof o.lineNumber!="number"||typeof o.columnNumber!="number"))try{const i=new URL(o.fileName).origin;n.push(`${i}/[script]:${o.lineNumber}:${o.columnNumber}`)}catch{}const r=n.join(`
`).slice(0,Gw);return n.length?r.split(`
`):void 0}function Xw(e){const t=e&&typeof e=="object"?e.name:"";return/^(Error|TypeError|RangeError|ReferenceError|SyntaxError|URIError|EvalError)$/.test(String(t))?String(t):"Unhandled rejection"}const mu="glue_diag_recording_started_ms",pu="glue_diag_seq";function _u(){const e=j(pu),t=parseInt(e||"0",10),n=Number.isFinite(t)&&t>=0?t:0;return P(pu,String(n+1)),n}function Ki(){en()||(Lo(re()),P(mu,String(Date.now())))}function Lr(e){const t=j(mu);if(!t)return null;const n=parseInt(t,10);return Number.isFinite(n)?e-n:null}const hu="__glueConsoleWrapper",yu="__glueConsoleLayer__";function wu(e){return typeof e=="function"}function bu(e){return wu(e)?e[yu]:void 0}function Yw(e,t,n){const r=e[t];if(!wu(r))return null;const o={next:r},s=n(function(...a){return o.next.apply(this,a)});return Object.defineProperties(s,{[hu]:{enumerable:!1,value:r},[yu]:{enumerable:!1,value:o}}),e[t]=s,()=>{if(e[t]===s){e[t]=o.next;return}let a=e[t],c=bu(a);for(;c;){if(c.next===s){c.next=o.next;return}a=c.next,c=bu(a)}}}const Ji={levels:["warn","error"],sampleRate:1,urlAllow:[],urlDeny:[],budgets:{maxPerSession:500,maxPerPage:200,messageChars:2e3,argsBytes:4096}},vu=["log","info","warn","error","debug"],Zw=/^%cglue/,Qw=/^(?:img|script|link)$/,eb=2e3,Su=500;function Eu(e){const t=[];return{push(n){t.length>=e&&t.shift(),t.push(n)},getAll(){return[...t]},clear(){t.length=0},size(){return t.length}}}let Ae=Ji,Qe=!1,ye="disabled",Mn=Eu(Su),Mr=null;const Xi={};let Or=0,On=0,Yi="",et=new Map;function ku(e){const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}function tb(){if(typeof location>"u")return!0;const e=location.origin+location.pathname;return Ae.urlDeny.some(t=>ku(t).test(e))?!1:Ae.urlAllow.length?Ae.urlAllow.some(t=>ku(t).test(e)):!0}function Zi(e){return Qe&&ye==="active"&&Ae.levels.includes(e)}function nb(e){e&&e!==Yi&&(Yi=e,On=0)}function rb(){return Or<Ae.budgets.maxPerSession&&On<Ae.budgets.maxPerPage}function ob(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return"[Unserializable]"}}function Au(e,t){t.timer!==null&&clearTimeout(t.timer),t.timer=setTimeout(()=>{et.delete(e)},eb)}function Qi(e,t,n,r){const o=ut();nb(o.page_view_id);const i=et.get(r.hash);if(i){i.record.repeat_count+=1,i.record.last_at=Date.now(),i.legacy.repeatCount=i.record.repeat_count,Au(r.hash,i);return}if(!rb())return;Ki();const s=ut(),a=Date.now(),c=re(),l={log_id:c,level:e,message:t,args_preview:n,repeat_count:1,first_at:a,last_at:a,rel_ms:Lr(a),seq:_u(),url:r.source,source:r.source,line:r.line,col:r.col,stack:r.stack,hash:r.hash,schema_version:Vl,session_id:s.session_id,window_id:s.window_id,page_view_id:s.page_view_id,recording_id:s.recording_id,workspace_id:s.workspace_id},u={id:c,level:e,message:t,args:Array.isArray(n)?n.map(ob):[],timestamp:a,stackTrace:r.stack?r.stack.join(`
`):void 0,url:r.source,lineNumber:r.line,columnNumber:r.col};Or+=1,On+=1,Mn.push(u);const d={record:l,legacy:u,timer:null};if(et.set(r.hash,d),Au(r.hash,d),Mr)try{Mr(l)}catch{}}function ib(e,t){if(!Zi(e)||typeof t[0]=="string"&&Zw.test(t[0]))return;const n=du(t,Ae.budgets.messageChars),r=uu(t.slice(0,10),Ae.budgets.argsBytes);let o,i,s,a;if(e==="error"){const l=t.find(u=>u instanceof Error);if(l){a=Gi(l.stack);const u=a&&a[0],d=u?u.match(/^(.*)\/\[script\]:(\d+):(\d+)$/):null;d&&(o=d[1],i=Number(d[2]),s=Number(d[3]))}}const c=Wi(`${e}|${n}|${o||""}|${i||0}`);Qi(e,n,r,{source:o,line:i,col:s,stack:a,hash:c})}function sb(e){const t=window;if(!t.console)return;const n=t.console[e];if(n&&n[hu]!==void 0)return;const r=Yw(t.console,e,o=>function(...i){try{ib(e,i)}catch{}return o.apply(this,i)});r&&(Xi[e]=r)}function ab(e){const t=Xi[e];t&&t(),delete Xi[e]}function Tu(e){if(!Zi("error"))return;const t=e.target;if(t&&t!==window&&t.tagName&&Qw.test(String(t.tagName).toLowerCase()))return;const n=e,r=String(n.message||n.error&&n.error.message||"Script error").slice(0,300),o=Jw(n.filename||""),i=Number.isFinite(n.lineno)?n.lineno:0,s=Number.isFinite(n.colno)?n.colno:0,a=Gi(n.error&&n.error.stack),c=Wi(`${r}|${o}|${i}`),l=du([r],Ae.budgets.messageChars);Qi("error",l,[{message:r,source:o,line:i,col:s}],{source:o,line:i,col:s,stack:a,hash:c})}function Cu(e){if(!Zi("error"))return;const t=e&&typeof e=="object"&&"reason"in e?e.reason:e,n=Xw(t),r=Gi(t&&typeof t=="object"?t.stack:void 0),o=Wi(`rejection|${n}`),i=`Unhandled rejection: ${n}`;Qi("error",i,[n],{stack:r,hash:o})}function cb(e,t,n="v0"){return Qe?ye:(Ae={...Ji,...e,budgets:{...Ji.budgets,...e?.budgets||{}}},Mr=t||null,Mn=Eu(Su),Or=0,On=0,Yi="",et=new Map,tb()?Xn("console_logs",Ae.sampleRate,n)?(ye="active",Qe=!0,vu.forEach(sb),typeof window<"u"&&(window.addEventListener("error",Tu,!0),window.addEventListener("unhandledrejection",Cu)),ye):(ye="sampled_out",Qe=!0,ye):(ye="disabled",Qe=!0,ye))}function lb(){Qe&&(ye==="active"&&(vu.forEach(ab),typeof window<"u"&&(window.removeEventListener("error",Tu,!0),window.removeEventListener("unhandledrejection",Cu))),et.forEach(e=>{e.timer!==null&&clearTimeout(e.timer)}),et.clear(),Qe=!1,ye="disabled",Mr=null)}function ub(){return Mn.getAll()}function db(){return Mn.size()}function fb(){return ye}function gb(){return Qe&&ye==="active"}function mb(){Mn.clear(),et.forEach(e=>{e.timer!==null&&clearTimeout(e.timer)}),et.clear(),Or=0,On=0}const Rr={init:cb,destroy:lb,getEntries:ub,getCount:db,getCaptureState:fb,isActive:gb,clear:mb};let Nr=null;function pb(){return Nr!==null||(Nr=typeof CompressionStream<"u"&&typeof Response<"u"&&typeof Blob<"u"),Nr}function _b(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode.apply(null,Array.from(e.subarray(r,r+32768)));return btoa(t)}async function hb(e,t,n){const r=new TextEncoder().encode(t),o={encoding:"json",payload:e,bytes:r.length};if(!pb()||r.length<n.compress_min_bytes||r.length>n.compress_max_bytes)return o;try{const i=new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")),s=new Uint8Array(await new Response(i).arrayBuffer());if(s.length*4/3>=r.length)return o;const a=_b(s);return{encoding:"gzip-base64",payload:a,bytes:a.length}}catch{return o}}var yb=Object.defineProperty,wb=(e,t,n)=>t in e?yb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bb=(e,t,n)=>wb(e,t+"",n);const Iu={flushMs:5e3,idleFlushMs:3e4,maxRecordsPerChunk:40,chunksPerMinute:12},vb=2,Sb=524288;class xu{constructor(){bb(this,"entries",[])}push(t){this.entries.push({record:t,capturedAt:Date.now()})}get length(){return this.entries.length}drain(){const t=this.entries;if(this.entries=[],!t.length){const n=Date.now();return{records:[],startedAt:n,endedAt:n}}return{records:t.map(n=>n.record),startedAt:t[0].capturedAt,endedAt:t[t.length-1].capturedAt}}clear(){this.entries=[]}}let Dt=!1,Lu=ji,yt=Iu,es,Pt=new xu,Ft=new xu,ts=null,ns=!0,$r="console",Rn=0,Mu=()=>iu().pending;function Eb(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}async function kb(e){try{if(typeof crypto<"u"&&crypto.subtle&&typeof TextEncoder<"u"){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return`sha256:${Array.from(new Uint8Array(n)).map(o=>o.toString(16).padStart(2,"0")).join("")}`}}catch{}return`sha256:${Eb(e).padEnd(64,"0")}`}function Ab(e){return{window_id:e.window_id,page_view_id:e.page_view_id,log_id:e.log_id,level:e.level,message:e.message,args_preview:e.args_preview,repeat_count:e.repeat_count,ts:e.first_at,last_ts:e.last_at,rel_ms:e.rel_ms,seq:e.seq,url:e.url,source:e.source,line:e.line,col:e.col,stack:e.stack,hash:e.hash}}function Tb(e){return{window_id:e.window_id,page_view_id:e.page_view_id,record_id:e.record_id,method:e.method,url:e.url,status:e.status,duration_ms:e.duration_ms,kind:e.kind,same_origin:e.same_origin,error:e.error,request_bytes:e.request_bytes,response_bytes:e.response_bytes,rel_ms:e.rel_ms,seq:e.seq,ts:e.ts}}async function Ou(e,t){if(!t.length)return;const{records:n,startedAt:r,endedAt:o}=t.drain();if(!n.length)return;Ki();const i=e==="console"?n.map(Ab):n.map(Tb),s=JSON.stringify(i),a=await hb(i,s,{compress_min_bytes:0,compress_max_bytes:Sb}),c=typeof a.payload=="string"?a.payload:s,l=await kb(c),u={kind:e,payload:a.payload,encoding:a.encoding,started_at:r,ended_at:o,rel_start_ms:Lr(r),rel_end_ms:Lr(o),record_count:i.length,bytes:a.bytes,checksum:l};!Lu(u)&&es&&es("send_failed",e)}function Ru(){const e=yt.chunksPerMinute>0?yt.chunksPerMinute:12;return Math.ceil(6e4/e)}function rs(){try{return Mu()>=Gl-vb}catch{return!1}}async function Cb(){if(!Dt||rs())return;const e=Ib();e&&($r=e==="console"?"network":"console",Rn=Date.now(),await Ou(e,e==="console"?Pt:Ft))}function Ib(){const e=Pt.length,t=Ft.length;return!e&&!t?null:$r==="console"?e?"console":"network":t?"network":"console"}function Dr(){if(ts!==null||!Dt)return;const e=ns?yt.flushMs:yt.idleFlushMs,t=Math.max(e,Ru()),n=Date.now()-Rn,r=Math.max(0,t-Math.max(0,n))||t;ts=setTimeout(()=>{ts=null,Cb().finally(()=>{(Pt.length||Ft.length)&&Dr()})},rs()?t*2:r)}function xb(){ns=typeof document<"u"?document.visibilityState!=="hidden":!0}function Nu(e,t){if(Date.now()-Rn<Ru()||rs()){Dr();return}Rn=Date.now(),$r=e==="console"?"network":"console",Ou(e,t)}function Lb(e){Dt&&(Pt.push(e),Pt.length>=yt.maxRecordsPerChunk?Nu("console",Pt):Dr())}function Mb(e){Dt&&(Ft.push(e),Ft.length>=yt.maxRecordsPerChunk?Nu("network",Ft):Dr())}function Ob(e={}){Dt||(Dt=!0,Lu=e.enqueue||ji,Mu=e.pendingChunks||(()=>iu().pending),$r="console",Rn=0,yt={...Iu,chunksPerMinute:Math.min(ww(),nu()),...e.budgets},es=e.onDrop,ns=typeof document<"u"?document.visibilityState!=="hidden":!0,typeof document<"u"&&document.addEventListener("visibilitychange",xb))}let Pr=ur,$u=!1,os=null,is=null,Nn=[],wt=[];const Rb=500,Fr=[],$n=new WeakMap;function Ut(){return typeof window<"u"?window.__glueConfig:void 0}function Du(e){return!!Ut()?.tracking?.features?.[e]}function Pu(e){return Ut()?.tracking?.featureConfig?.[e]||{}}function Fu(){return String(Ut()?.tracking?.config_version||Ut()?.config_version||"v0")}function Nb(){const t=Ut()?.supabaseUrl;t&&(ou({supabaseUrl:String(t),hostname:typeof location<"u"?location.hostname:""}),Yn())}let Dn="disabled",ss=0,Ur=0,as="",cs={maxPerSession:500,maxPerPage:200},Uu=[],ju=[],qu=!1;function jr(e,t,n){if(!(typeof t!="string"||!t))try{const r=typeof location<"u"?location.href:void 0,o=new URL(t,r),i=o.hostname.toLowerCase();if(!i)return;const s=n??(o.pathname||"/");if(e.some(a=>a.host===i&&a.pathPrefix===s))return;e.push({host:i,pathPrefix:s})}catch{}}function $b(){const e=[],t=Ut();jr(e,t?.supabaseUrl,"/functions/v1/"),jr(e,t?.ingestUrl);try{if(typeof document<"u"){const n=document.currentScript;n&&typeof n.src=="string"&&jr(e,n.src);const r=document.querySelectorAll("script[src]");for(let o=0;o<r.length;o++){const i=r[o].src||"";i.indexOf("workspace-id=")===-1&&i.indexOf("/functions/v1/glue")===-1||jr(e,i)}}}catch{}return e}function Db(e,t){const n=String(t||"").trim().toLowerCase().replace(/^\*\./,".");return n?n.charAt(0)==="."?e===n.slice(1)||e.endsWith(n):e===n:!1}function Pb(e){let t="",n="";try{const r=typeof location<"u"?location.href:void 0,o=new URL(String(e||""),r);t=o.hostname.toLowerCase(),n=o.pathname}catch{return!1}for(const r of Uu)if(r.host===t&&n.indexOf(r.pathPrefix)===0)return!0;for(const r of ju)if(Db(t,r))return!0;return!1}function Fb(e){const t=String(e||"");if(qu)return t;const n=t.indexOf("?");return n===-1?t:t.slice(0,n)}function Ub(){const e=ut();return e.page_view_id!==as&&(as=e.page_view_id,Ur=0),ss<cs.maxPerSession&&Ur<cs.maxPerPage}function jb(e){if(Dn!=="active"||Pb(e.url)||!Ub())return;ss+=1,Ur+=1,Ki();const t=ut(),n=Date.now(),r={record_id:re(),method:e.method,url:Fb(e.url),status:e.status,duration_ms:e.duration_ms,kind:e.kind,same_origin:e.same_origin,error:e.error,ts:n,rel_ms:Lr(n),seq:_u(),schema_version:Vl,session_id:t.session_id,window_id:t.window_id,page_view_id:t.page_view_id,recording_id:t.recording_id,workspace_id:t.workspace_id};Mb(r)}function qb(){if(!Du("network_diagnostics")){Dn="disabled";return}const t=Pu("network_diagnostics"),n=typeof t.sample_rate=="number"?t.sample_rate:1;if(!Xn("network_diagnostics",n,Fu())){Dn="sampled_out";return}const o=t.budgets||{};cs={maxPerSession:typeof o.max_per_session=="number"?o.max_per_session:500,maxPerPage:typeof o.max_per_page=="number"?o.max_per_page:200},ju=Array.isArray(t.deny_hosts)?t.deny_hosts.filter(s=>typeof s=="string"):[],qu=t.capture_query===!0,Uu=$b(),ss=0,Ur=0,as="",Dn="active";const i=gi();i&&i.subscribe(jb)}function Hb(){if(!Du("console_logs"))return;const t=Pu("console_logs");Rr.init({levels:t.levels||["warn","error"],sampleRate:typeof t.sample_rate=="number"?t.sample_rate:1,urlAllow:t.url_allow||[],urlDeny:t.url_deny||[],budgets:{maxPerSession:t.budgets?.max_per_session??500,maxPerPage:t.budgets?.max_per_page??200,messageChars:t.budgets?.message_chars??2e3,argsBytes:t.budgets?.args_bytes??4096}},n=>Lb(n),Fu())}function ls(){return`frust_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function us(e){Fr.length>=Rb&&Fr.shift(),Fr.push(e)}function zb(e){const t=e.target?.tagName||"unknown",n=Date.now();Nn=Nn.filter(o=>n-o.timestamp<1e3),Nn.push({timestamp:n,target:t});const r=Nn.filter(o=>o.target===t);if(r.length>=3){const o={id:ls(),type:"rage_click",timestamp:n,target:t,details:{clickCount:r.length,duration:n-r[0].timestamp}};us(o),Nn=[]}}function Bb(e){const t=$n.get(e);if(t!==void 0)return t;const n=e.hasAttribute("onclick"),r=e.classList.contains("btn")||e.classList.contains("button");if(n||r)return $n.set(e,!0),!0;if(Math.random()<.1)try{const i=window.getComputedStyle(e).cursor==="pointer";return $n.set(e,i),i}catch{return $n.set(e,!1),!1}return $n.set(e,!1),!1}function Vb(e){const t=e.target;if(!t)return;const n=t.tagName.toLowerCase();if(!["a","button","input","select","textarea"].includes(n)&&Bb(t)){const o={id:ls(),type:"dead_click",timestamp:Date.now(),target:`${n}${t.className?`.${t.className.split(" ").join(".")}`:""}`,details:{text:t.textContent?.slice(0,50)}};us(o)}}function Wb(){const e=Date.now();if(wt=wt.filter(t=>e-t<1e4),wt.push(e),wt.length>=3){const t={id:ls(),type:"error_cascade",timestamp:e,details:{errorCount:wt.length,duration:e-wt[0]}};us(t),wt=[]}}function Gb(e){zb(e),Vb(e)}function Kb(){Wb()}function Jb(e){$u||(Pr={...ur,...e},Pr.enabled&&(Pr.networkEnabled&&pr.init(Pr),document.addEventListener("click",Gb,!0),window.addEventListener("error",Kb),e?.consoleEnabled!==!1&&Hb(),e?.networkDiagEnabled!==!1&&qb(),(Rr.isActive()||Dn==="active")&&(Nb(),Ob()),$u=!0))}function bt(){return{consoleLogs:Rr.getEntries(),consoleLogCount:Rr.getCount(),networkRequests:pr.getRequests(),networkRequestCount:pr.getCount(),networkFailedCount:pr.getFailedCount(),performanceSamples:[],performanceSummary:{},longTasks:[],layoutShifts:[],stateChanges:[],stateStoreType:void 0,frustrationEvents:[...Fr]}}function Xb(e,t=3e4){os&&clearInterval(os),is=e,os=window.setInterval(()=>{if(is){const n=bt();is(n)}},t)}function Yb(e){window.OneTrust?.OnConsentChanged&&window.OneTrust.OnConsentChanged(()=>{const n=Hu();n&&e.setConsent(n,"external")}),window.addEventListener("consent.onetrust",()=>{const n=Hu();n&&e.setConsent(n,"external")}),window.addEventListener("CookiebotOnAccept",()=>{if(window.Cookiebot?.consent){const n=window.Cookiebot.consent;let r="essential";n.marketing?r="full":n.statistics&&(r="analytics"),e.setConsent(r,"external")}}),window.addEventListener("CookiebotOnDecline",()=>{e.setConsent("essential","external")}),window.addEventListener("cookieyes_consent_update",n=>{const r=n.detail||{};let o="essential";r.advertisement==="yes"?o="full":r.analytics==="yes"&&(o="analytics"),e.setConsent(o,"external")}),window.addEventListener("glue:consent",n=>{n.detail?.level&&e.setConsent(n.detail.level,"external")}),window.glue=window.glue||{};const t=window.glue;t.setConsent=n=>{e.setConsent(n.level,"api")},t.getConsent=()=>({level:e.getConsentLevel(),required:e.isConsentRequired()})}function Hu(){const e=document.cookie.match(/OptanonConsent=([^;]*)/)?.[1];if(!e)return null;const t=e.match(/groups=([^&]*)/)?.[1];if(!t)return null;const n=t.includes("C0002:1");return t.includes("C0004:1")?"full":n?"analytics":"essential"}const Zb={headline:"We value your privacy",description:"We use cookies and tracking technologies to improve your experience and analyze site traffic.",acceptAllLabel:"Accept All",analyticsLabel:"Analytics Only",essentialLabel:"Essential Only"},Qb=`
  #glue-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 999999;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
  }
  #glue-consent-banner * {
    box-sizing: border-box;
  }
  #glue-consent-banner.position-bottom { bottom: 0; }
  #glue-consent-banner.position-top { top: 0; }
  #glue-consent-banner.position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 500px;
    border-radius: 12px;
  }
  .glue-banner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999998;
  }
  .glue-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
  }
  .glue-banner-text {
    flex: 1;
    min-width: 280px;
  }
  .glue-banner-text h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.375rem 0;
    color: #111827;
  }
  .glue-banner-text p {
    font-size: 0.875rem;
    margin: 0;
    color: #6b7280;
    line-height: 1.4;
  }
  .glue-banner-text a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.875rem;
  }
  .glue-banner-text a:hover {
    text-decoration: underline;
  }
  .glue-banner-buttons {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
  }
  .glue-banner-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
  }
  .glue-banner-btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
  }
  .glue-banner-btn-primary:hover {
    background: #2563eb;
  }
  .glue-banner-btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
  }
  .glue-banner-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
  }
`;function ev(e,t){if(!document.getElementById("glue-consent-styles")){const a=document.createElement("style");a.id="glue-consent-styles",a.textContent=Qb+(e.style?.customCss||""),document.head.appendChild(a)}const n={...Zb,...e.content},r=e.position||"bottom";let o=null;r==="center"&&(o=document.createElement("div"),o.className="glue-banner-overlay",document.body.appendChild(o));const i=document.createElement("div");i.id="glue-consent-banner",i.className=`position-${r}`,e.style&&(e.style.backgroundColor&&(i.style.background=e.style.backgroundColor),e.style.borderRadius&&(i.style.borderRadius=e.style.borderRadius)),i.innerHTML=`
    <div class="glue-banner-content">
      <div class="glue-banner-text">
        <h4 style="${e.style?.textColor?`color: ${e.style.textColor}`:""}">${n.headline}</h4>
        <p style="${e.style?.textColor?`color: ${e.style.textColor}`:""}">${n.description}</p>
        ${n.privacyPolicyUrl?`<a href="${n.privacyPolicyUrl}" target="_blank" rel="noopener">Privacy Policy</a>`:""}
      </div>
      <div class="glue-banner-buttons">
        <button class="glue-banner-btn glue-banner-btn-secondary" data-consent="essential">
          ${n.essentialLabel}
        </button>
        <button class="glue-banner-btn glue-banner-btn-secondary" data-consent="analytics">
          ${n.analyticsLabel}
        </button>
        <button class="glue-banner-btn glue-banner-btn-primary" data-consent="full"
          style="${e.style?.buttonColor?`background: ${e.style.buttonColor}`:""}">
          ${n.acceptAllLabel}
        </button>
      </div>
    </div>
  `;const s=()=>{i.remove(),o?.remove()};i.querySelectorAll("[data-consent]").forEach(a=>{a.addEventListener("click",()=>{const c=a.getAttribute("data-consent");t.setConsent(c,"banner"),s()})}),document.body.appendChild(i)}const zu=new Set;function tv(e,t){const n=[...e].sort((r,o)=>r.priority-o.priority);for(const r of n)if(r.is_enabled&&nv(r.url_patterns))switch(r.load_timing){case"immediate":qr(r);break;case"after_consent":if(io(t.getConsentLevel(),r.consent_level_required))qr(r);else{const o=t.onConsentChange(i=>{io(i.level,r.consent_level_required)&&(qr(r),o())})}break;case"on_event":for(const o of r.trigger_events)window.addEventListener(o,()=>{io(t.getConsentLevel(),r.consent_level_required)&&qr(r)},{once:!0});break}}function qr(e){if(!zu.has(e.id)){if(zu.add(e.id),e.script_type==="url"&&e.script_url){const t=document.createElement("script");t.src=e.script_url,t.id=`glue-script-${e.id}`,e.async_load&&(t.async=!0),e.defer_load&&(t.defer=!0);for(const[n,r]of Object.entries(e.custom_attributes||{}))t.setAttribute(n,r);document.head.appendChild(t)}else if(e.script_type==="inline"&&e.script_content){const t=document.createElement("script");t.id=`glue-script-${e.id}`,t.textContent=e.script_content,document.head.appendChild(t)}}}function nv(e){if(!e||e.length===0)return!0;const t=window.location.href;return e.some(n=>{try{return new RegExp("^"+n.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$").test(t)}catch{return!1}})}var qe=(e=>(e.TRACKING_INITIALIZATION_FAILED="TRACKING_INITIALIZATION_FAILED",e.EVENT_SEND_FAILED="EVENT_SEND_FAILED",e.ELEMENT_NOT_FOUND="ELEMENT_NOT_FOUND",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.STORAGE_ERROR="STORAGE_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.VALIDATION_ERROR="VALIDATION_ERROR",e))(qe||{});class tt extends Error{constructor(t,n,r){super(n),this.code=t,this.context=r,this.name="AnalyticsError"}}const nt=B("analytics");function rv(e){try{const t=e.getAttribute("glue-event-category"),n=e.getAttribute("glue-event-action"),r=e.getAttribute("glue-event-label"),o=e.getAttribute("glue-event-value");if(!n){nt.warn("Analytics event missing required action attribute",e);return}if(typeof window.gtag!="function"){nt.warn("Google Analytics (gtag) not found. Event not sent:",{action:n,category:t,label:r,value:o});return}const i={action:n,...t&&{event_category:t},...r&&{event_label:r},...o&&{value:o}};window.gtag("event",i.action,{event_category:i.event_category,event_label:i.event_label,value:i.value}),nt.log("Analytics event sent:",i)}catch(t){const n=new tt(qe.EVENT_SEND_FAILED,"Failed to send analytics event",{element:e.tagName,error:t instanceof Error?t.message:String(t)});throw nt.error("Analytics event send failed:",n),n}}function ov(e={}){const n={...{trackLinks:!0,trackButtons:!0,trackSubmissions:!0,defaultCategory:"User Interaction",customSelector:"[glue-event-action]",attributePrefix:"glue-event"},...e},r=[],o=[];let i=0;try{const s=document.querySelectorAll(n.customSelector||"[glue-event-action]");return nt.log(`Found ${s.length} elements with analytics attributes`),s.forEach((a,c)=>{try{if(!a.hasAttribute("glue-event-action")){o.push(`Element ${c} missing required glue-event-action attribute`);return}const u=()=>{try{rv(a)}catch(d){nt.error("Click handler error:",d)}};a.addEventListener("click",u),i++,nt.log("Analytics tracking attached to element:",{tagName:a.tagName,action:a.getAttribute("glue-event-action"),category:a.getAttribute("glue-event-category")})}catch(l){const u=`Failed to attach tracking to element ${c}: ${l instanceof Error?l.message:String(l)}`;r.push(u),nt.error(u)}}),{success:r.length===0,elementsTracked:i,errors:r,warnings:o}}catch(s){const a=new tt(qe.TRACKING_INITIALIZATION_FAILED,"Failed to initialize analytics tracking",{error:s instanceof Error?s.message:String(s)});return r.push(a.message),{success:!1,elementsTracked:0,errors:r,warnings:o}}}function iv(){return ov()}const rt=B("analytics");function sv(e={}){const n={...{trackLinks:!0,trackButtons:!0,trackSubmissions:!0,defaultCategory:document.title||"Auto Analytics",customSelector:'a, button, input[type="submit"]',attributePrefix:"glue-event"},...e},r=[],o=[];let i=0;const s={links:0,buttons:0,submissions:0};try{let a="";const c=[];if(n.trackLinks&&c.push("a[href]"),n.trackButtons&&c.push("button"),n.trackSubmissions&&c.push('input[type="submit"]'),n.customSelector&&c.push(n.customSelector),a=c.join(", "),!a)return o.push("No element types configured for tracking"),{success:!0,elementsTracked:0,errors:r,warnings:o,configuredElements:s};const l=document.querySelectorAll(a),u=n.defaultCategory;return rt.log(`Processing ${l.length} elements for auto-analytics`),l.forEach((d,w)=>{try{if(d.hasAttribute("glue-event-action")){rt.log(`Element ${w} already has analytics configured, skipping`);return}if(d.hasAttribute("glue-event-category")||d.setAttribute("glue-event-category",u),!d.hasAttribute("glue-event-action")){const p=av(d);if(p)d.setAttribute("glue-event-action",p);else{o.push(`Could not generate action for element ${w}`);return}}if(!d.hasAttribute("glue-event-label")){const p=cv(d);d.setAttribute("glue-event-label",p)}if(!d.hasAttribute("glue-event-value")){const p=lv(d);d.setAttribute("glue-event-value",p)}const g=d.tagName.toLowerCase();g==="a"?s.links++:g==="button"?s.buttons++:g==="input"&&d instanceof HTMLInputElement&&d.type==="submit"&&s.submissions++,i++,rt.log(`Auto-analytics configured for ${g}:`,{category:d.getAttribute("glue-event-category"),action:d.getAttribute("glue-event-action"),label:d.getAttribute("glue-event-label"),value:d.getAttribute("glue-event-value")})}catch(g){const p=`Failed to configure element ${w}: ${g instanceof Error?g.message:String(g)}`;r.push(p),rt.error(p)}}),{success:r.length===0,elementsTracked:i,errors:r,warnings:o,configuredElements:s}}catch(a){const c=new tt(qe.TRACKING_INITIALIZATION_FAILED,"Failed to process auto-analytics",{error:a instanceof Error?a.message:String(a)});return r.push(c.message),{success:!1,elementsTracked:0,errors:r,warnings:o,configuredElements:s}}}function av(e){const t=e.tagName.toLowerCase();try{if(t==="a")return`Clicked link ${Hr(e)}`;if(t==="button")return`Clicked button ${Hr(e)}`;if(t==="input"&&e instanceof HTMLInputElement&&e.type==="submit")return`Clicked submit input ${e.name||e.value||"submit"}`;const n=Hr(e);return`Clicked ${t} ${n}`}catch(n){return rt.warn("Error generating action description:",n),`Clicked ${t}`}}function cv(e){try{const t=Hr(e);return t||(e instanceof HTMLInputElement&&e.name?e.name:e.id?e.id:e.tagName.toLowerCase())}catch(t){return rt.warn("Error generating element label:",t),e.tagName.toLowerCase()}}function lv(e){try{return e instanceof HTMLAnchorElement&&e.href?e.href:e instanceof HTMLInputElement&&e.type==="submit"?"Form Submit":e instanceof HTMLButtonElement?e.form||e.closest("form")?"Form Submit":"Button Click":"Element Interaction"}catch(t){return rt.warn("Error generating element value:",t),"Element Interaction"}}function Hr(e){try{const t=(e.innerText||e.textContent||"").trim(),n=50;return t.length>n?t.substring(0,n)+"...":t}catch(t){return rt.warn("Error extracting element text:",t),""}}function Bu(e){return sv(e)}const Vu=B("analytics");function uv(){try{const e=eo("gclid");e&&(G("gclid",e,30),typeof localStorage<"u"&&localStorage.removeItem("gclid"),Vu.log("GCLID captured and stored:",e))}catch(e){Vu.error("Error capturing GCLID:",e)}}const Q=B("forms"),Wu={enabled:!0,includeFullJourney:!1,fieldPrefix:"glue_",formSelector:"form",maxDataSize:1e4,fields:{userId:!0,sessionId:!0,totalSessions:!0,totalEvents:!0,daysActive:!0,firstTouch:!0,lastTouch:!0,journeyData:!1}};let V={...Wu},Oe=null;function Gu(){const e=dn(),t=h("glue_user_id")||"",n=j("glue_session_id")||"",r={glue_user_id:t,session_id:n,total_sessions:e.summary.total_sessions,total_events:e.summary.total_events,days_active:e.summary.days_active||0,converted_sessions:e.summary.converted_sessions,first_touch_source:e.summary.attribution.first_touch.utm_source,first_touch_medium:e.summary.attribution.first_touch.utm_medium,first_touch_campaign:e.summary.attribution.first_touch.utm_campaign,first_touch_referrer:e.summary.attribution.first_touch.referrer,last_touch_source:e.summary.attribution.last_touch.utm_source,last_touch_medium:e.summary.attribution.last_touch.utm_medium,last_touch_campaign:e.summary.attribution.last_touch.utm_campaign,last_touch_referrer:e.summary.attribution.last_touch.referrer};if(V.includeFullJourney)try{const o=JSON.stringify(e);o.length<=(V.maxDataSize||1e4)?r.journey_data=o:Q.warn("Journey data exceeds max size, skipping full journey injection")}catch(o){Q.error("Failed to stringify journey data:",o)}return r}function dv(e,t){const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n.setAttribute("data-glue-injected","true"),n}function fv(e){e.querySelectorAll('input[data-glue-injected="true"]').forEach(n=>n.remove())}function ds(e){if(!V.enabled){Q.log("Form journey injection disabled");return}try{fv(e);const t=Gu(),n=V.fieldPrefix||"glue_";let r=0;const o=(i,s,a=!0)=>{if(a&&s!==void 0&&s!==null&&s!==""){const c=`${n}${i}`;if(!e.querySelector(`[name="${c}"]`)){const u=dv(c,String(s));e.appendChild(u),r++,Q.log(`Injected field: ${c} = ${String(s).substring(0,50)}`)}}};V.fields?.userId&&o("user_id",t.glue_user_id),V.fields?.sessionId&&o("session_id",t.session_id),V.fields?.totalSessions&&o("total_sessions",t.total_sessions),V.fields?.totalEvents&&o("total_events",t.total_events),V.fields?.daysActive&&o("days_active",t.days_active),V.fields?.firstTouch&&(o("first_touch_source",t.first_touch_source),o("first_touch_medium",t.first_touch_medium),o("first_touch_campaign",t.first_touch_campaign),o("first_touch_referrer",t.first_touch_referrer)),V.fields?.lastTouch&&(o("last_touch_source",t.last_touch_source),o("last_touch_medium",t.last_touch_medium),o("last_touch_campaign",t.last_touch_campaign),o("last_touch_referrer",t.last_touch_referrer)),V.fields?.journeyData&&t.journey_data&&o("journey_data",t.journey_data),Q.log(`Form journey injection complete: ${r} fields added to form ${e.id||e.name||"unnamed"}`)}catch(t){Q.error("Failed to inject journey data into form:",t)}}function Ku(e={}){if(V={...Wu,...e},!V.enabled){Q.log("Form journey injection is disabled");return}const t=V.formSelector||"form",n=o=>{o.__glue_journey_injection_attached||(o.addEventListener("submit",i=>{Q.log("Form submit detected, injecting journey data..."),ds(o)}),o.__glue_journey_injection_attached=!0,Q.log(`Journey injection listener attached to form: ${o.id||o.name||"unnamed"}`))},r=document.querySelectorAll(t);r.forEach(n),Q.log(`Form journey injection setup complete: ${r.length} forms found`),typeof MutationObserver<"u"&&(Oe&&Oe.disconnect(),Oe=new MutationObserver(o=>{o.forEach(i=>{i.addedNodes.forEach(s=>{s instanceof HTMLFormElement&&s.matches(t)?n(s):s instanceof HTMLElement&&s.querySelectorAll(t).forEach(n)})})}),Oe.observe(document.body,{childList:!0,subtree:!0}),Q.log("MutationObserver active for dynamically added forms"))}function gv(e){try{const t=document.querySelector(e);return t?(ds(t),!0):(Q.error(`Form not found: ${e}`),!1)}catch(t){return Q.error("Failed to inject into specific form:",t),!1}}function mv(e){V={...V,...e},Q.log("Form injection config updated:",V)}function pv(){return{...V}}function _v(){V.enabled=!0,Ku(V),Q.log("Form journey injection enabled")}function hv(){V.enabled=!1,Oe&&(Oe.disconnect(),Oe=null),Q.log("Form journey injection disabled")}function yv(){Oe&&(Oe.disconnect(),Oe=null),V.enabled=!1,Q.log("Form journey injection cleaned up")}const jt={setupFormJourneyInjection:Ku,injectJourneyDataIntoForm:ds,injectIntoForm:gv,getJourneySummaryFields:Gu,updateConfig:mv,getConfig:pv,enable:_v,disable:hv,cleanup:yv},Te=B("forms"),Ju={selectors:['div[class^="temp_"] input'],autoSave:!0,storage:["cookies","sessionStorage"],debounceTime:300,updateVisitorContext:!0,validator:()=>!0};function Xu(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function Yu(e){try{const t=e.closest('div[class^="temp_"]');if(!t)return null;const n=t.className.match(/temp_([a-zA-Z0-9_-]+)/);return!n||!n[1]?null:`temp_${n[1]}`}catch(t){return Te.error("Error extracting storage key:",t),null}}function wv(e,t=Ju){const n=Date.now();try{const r=Yu(e);if(!r)return{element:e,key:"",value:e.value,lastSaved:n,success:!1,error:"Could not extract storage key from parent element"};const o=e.value;if(t.validator&&!t.validator(o,e))return{element:e,key:r,value:o,lastSaved:n,success:!1,error:"Input value failed validation"};const i=[];t.storage.forEach(a=>{try{switch(a){case"cookies":G(r,o,.5);break;case"sessionStorage":window.sessionStorage.setItem(r,o);break;case"localStorage":window.localStorage.setItem(r,o);break;default:throw new Error(`Unknown storage type: ${a}`)}}catch(c){const l=`Failed to save to ${a}: ${c instanceof Error?c.message:String(c)}`;i.push(l),Te.error(l)}}),e.isTracked=!0,e.lastSaved=n;const s=i.length===0;return s&&Te.log("Input data saved successfully:",{key:r,value:o.substring(0,20)+"..."}),{element:e,key:r,value:o,lastSaved:n,success:s,error:i.length>0?i.join("; "):void 0}}catch(r){const o=r instanceof Error?r.message:String(r);return Te.error("Error saving input data:",o),{element:e,key:"",value:e.value,lastSaved:n,success:!1,error:o}}}const Zu=new WeakSet;let Pn=null,fs=null;const zr=new Set;let gs=!1;function Qu(e){return Zu.has(e)?!1:(Zu.add(e),e.addEventListener("input",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{Pn()})})}),!0)}function ed(e){let t=0;return e instanceof HTMLInputElement&&Qu(e)&&t++,e.querySelectorAll("input").forEach(n=>{Qu(n)&&t++}),t}function bv(){if(fs||typeof MutationObserver>"u")return;const e=document.body||document.documentElement;e&&(fs=new MutationObserver(t=>{t.forEach(n=>{n.addedNodes.forEach(r=>{r instanceof Element&&zr.add(r)})}),!(gs||zr.size===0)&&(gs=!0,queueMicrotask(()=>{gs=!1;let n=0;zr.forEach(r=>{n+=ed(r)}),zr.clear(),n>0&&(Te.log(`Set up visitor context updates for ${n} new input elements`),Pn())}))}),fs.observe(e,{childList:!0,subtree:!0}))}function td(){Pn||(Pn=Xu(()=>{try{Hs()}catch(t){Te.error("Failed to update visitor context:",t)}},100));const e=()=>{const t=ed(document);bv(),Te.log(`Set up visitor context updates for ${t} new input elements`),t>0&&Pn()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}function vv(e={}){const t={...Ju,...e},n=[],r=[];let o=0;try{t.updateVisitorContext&&td();const i=t.selectors.join(", "),s=document.querySelectorAll(i);if(s.length===0)return Te.log(`No inputs found matching selectors: ${i}`),{success:!0,fieldsProcessed:0,fieldsSaved:[],errors:[]};Te.log(`Found ${s.length} inputs matching selectors`);const a=Xu(c=>{const l=wv(c,t);if(l.success){const u={name:c.name||c.id||`input_${o}`,value:l.value,type:c.type,selector:`[name="${c.name}"]`,persist:!0,storage:t.storage.includes("localStorage")?"localStorage":t.storage.includes("sessionStorage")?"sessionStorage":"cookies"};r.push(u)}else l.error&&n.push(l.error)},t.debounceTime||300);return s.forEach(c=>{try{const l=Yu(c);if(!l){n.push(`Could not extract storage key for input: ${c.name||c.type}`);return}const u=()=>{t.autoSave&&a(c)};c.addEventListener("input",u),c.isTracked=!0,o++,Te.log(`Attached listener to input with key: ${l}`)}catch(l){const u=`Failed to setup listener for input: ${l instanceof Error?l.message:String(l)}`;n.push(u),Te.error(u)}}),{success:n.length===0,fieldsProcessed:o,fieldsSaved:r,errors:n}}catch(i){const s=new tt(qe.TRACKING_INITIALIZATION_FAILED,"Failed to setup input listener",{error:i instanceof Error?i.message:String(i)});return n.push(s.message),{success:!1,fieldsProcessed:0,fieldsSaved:[],errors:n}}}function Sv(){return vv()}td();const W=B("forms");function Ev(e){const{key:t,value:n,exactMatch:r=!0,checkStorage:o=["params","localStorage","sessionStorage","cookies"]}=e;try{for(const i of o){let s=null;switch(i){case"params":s=eo(t);break;case"localStorage":s=h(t);break;case"sessionStorage":s=j(t);break;case"cookies":s=ge(t);break;default:W.warn(`Unknown storage type: ${i}`);continue}if(s!==null){const a=r?s===n:s.toLowerCase().includes(n.toLowerCase());if(W.log(`Condition check [${i}] ${t}=${s} ${a?"MATCHES":"NO MATCH"} expected ${n}`),a)return!0}}return!1}catch(i){return W.error(`Error checking condition for key ${t}:`,i),!1}}function kv(){try{const e=['[id*="glue_redirect_url"]','[class*="glue_redirect_url"]','[name="glue_redirect_url"]','[glue="redirect_url"]','input[name*="redirect"]','input[id*="redirect_url"]'],t=document.querySelectorAll(e.join(", "));return Array.from(t).filter(n=>n.tagName==="INPUT"&&typeof n.value=="string")}catch(e){return W.error("Error finding redirect inputs:",e),[]}}function Av(e,t){try{const n=t||kv();let r=0;return n.forEach(o=>{try{o.value=e,o.setAttribute("value",e),(o.hasAttribute("data-frmval")||o.closest("[data-frmval]"))&&o.setAttribute("data-frmval",e),r++,W.log(`Updated redirect input ${o.name||o.id||"unnamed"} with URL: ${e}`)}catch(i){W.error("Error updating redirect input:",i)}}),r}catch(n){return W.error("Error updating redirect inputs:",n),0}}function Tv(e){const t=[];try{W.log("processRedirectURL called");const n=e||window.glue_redirect_conditions;if(!n||!Array.isArray(n)){const o="Redirect conditions not defined or not an array";return t.push(o),W.error(o),{inputsUpdated:0,errors:t}}W.log("Checking conditions:",n);let r;for(const o of n)try{if(!o.key||!o.value||!o.redirectUrl){W.warn("Invalid condition structure:",o);continue}if(Ev(o)){r=o,W.log("Matched condition:",r);break}}catch(i){const s=`Error checking condition ${o.key}: ${i instanceof Error?i.message:String(i)}`;t.push(s),W.error(s)}if(r){const o=Av(r.redirectUrl);return o===0&&t.push("No redirect input elements found to update"),{inputsUpdated:o,matchedCondition:r,errors:t,redirectUrl:r.redirectUrl}}else return W.warn("No matching condition found for redirection"),{inputsUpdated:0,errors:t}}catch(n){const r=`Error processing redirect URL: ${n instanceof Error?n.message:String(n)}`;return t.push(r),W.error(r),{inputsUpdated:0,errors:t}}}function Cv(e={}){const{formSelector:t=".glue_redirect form, form.glue_redirect",preventDefaultSubmission:n=!0,logRedirections:r=!0}=e;try{const o=document.querySelectorAll(t);let i=0;return o.forEach(s=>{try{const a=c=>{try{const l=['[id*="glue_redirect_url"]','[class*="glue_redirect_url"]','[name="glue_redirect_url"]','[glue="redirect_url"]'];let u=null;for(const d of l)if(u=s.querySelector(d),!u&&s.parentElement&&(u=s.parentElement.querySelector(d)),u)break;if(u&&u.value.trim()){n&&c.preventDefault();const d=u.value.trim();r&&W.log(`Form redirection triggered to: ${d}`);try{new URL(d)}catch{W.warn("Redirect URL is not a full URL, treating as relative path")}window.location.href=d}else r&&W.log("No redirect URL found, allowing normal form submission")}catch(l){W.error("Error in form redirection handler:",l)}};s.addEventListener("submit",a),i++,W.log(`Attached redirection handler to form: ${s.id||s.className||"unnamed"}`)}catch(a){W.error("Error setting up form redirection handler:",a)}}),W.log(`Set up redirection handlers for ${i} forms`),i}catch(o){return W.error("Error in setupFormRedirection:",o),0}}function Iv(){return Tv()}function xv(){return Cv()}const qt=B("fillout"),Lv=new Set(["glue_user_id","glue_session_id","glue_user_firstseen","glue_session_start","glue_url_first","glue_url_current","glue_url_last","glue_referrer","glue_user_ip","glue_initial_utm_id","glue_last_utm_id","glue_initial_utm_source","glue_last_utm_source","glue_initial_utm_medium","glue_last_utm_medium","glue_initial_utm_campaign","glue_last_utm_campaign","glue_initial_utm_term","glue_last_utm_term","glue_initial_utm_content","glue_last_utm_content","glue_fb_fbp","glue_fb_fbc","glue_fb_fbclid","glue_initial_fbclid","glue_last_fbclid","glue_tt_clickid","glue_initial_ttclid","glue_last_ttclid","glue_gclid","glue_initial_gclid","glue_last_gclid","glue_initial_gclsrc","glue_last_gclsrc","glue_initial_wbraid","glue_last_wbraid","glue_initial_gbraid","glue_last_gbraid","glue_initial_dclid","glue_last_dclid","glue_msclkid","glue_initial_msclkid","glue_last_msclkid","glue_initial_li_fat_id","glue_last_li_fat_id","glue_initial_twclid","glue_last_twclid","glue_initial_epik","glue_last_epik","glue_initial_ScCid","glue_last_ScCid","glue_initial_irclickid","glue_last_irclickid","glue_initial_adset_id","glue_last_adset_id","glue_initial_ad_id","glue_last_ad_id","glue_initial_adgroup_id","glue_last_adgroup_id","glue_initial_campaign_id","glue_last_campaign_id","glue_initial_placement","glue_last_placement","glue_initial_comet_source","glue_last_comet_source","glue_initial_comet_ad_id","glue_last_comet_ad_id","glue_initial_comet_campaign","glue_last_comet_campaign","glue_initial_comet_ad_group","glue_last_comet_ad_group","glue_initial_comet_network","glue_last_comet_network","glue_initial_comet_keyword","glue_last_comet_keyword","glue_initial_comet_placement","glue_last_comet_placement","glue_initial_comet_type","glue_last_comet_type","glue_initial_comet_custom","glue_last_comet_custom","glue_in_app_browser","glue_traffic_type","glue_attribution_derived_from","glue_adblocker_detected"]),Mv="utm_";function nd(e,t=!1){return t||e.startsWith(Mv)?!0:Lv.has(e)}function rd(e,t,n){const r=`data-${t}`;e.forEach(o=>{o.setAttribute(r,n)})}function Ov(){const e=new Map;for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(n&&nd(n,!1)){const r=localStorage.getItem(n);r&&r!=="null"&&r!==""&&e.set(n,r)}}for(let t=0;t<sessionStorage.length;t++){const n=sessionStorage.key(t);if(n&&!e.has(n)&&nd(n,!1)){const r=sessionStorage.getItem(n);r&&r!=="null"&&r!==""&&e.set(n,r)}}return e}function Rv(e){const t=Ov();let n=0;return t.forEach((r,o)=>{rd(e,o,r),n++}),n}function Nv(e){const t=new URLSearchParams(window.location.search);if(!t.toString())return 0;let n=0;return t.forEach((r,o)=>{o.startsWith("glue_")||o.startsWith("utm_")||(rd(e,o,r),n++)}),n}function $v(e){qt.log("form info:",{form_id:e.getAttribute("data-fillout-id"),domain:e.getAttribute("data-fillout-domain"),total_attributes:e.attributes.length});const t=Array.from(e.attributes).filter(n=>n.name.startsWith("data-")&&!n.name.startsWith("data-fillout-")).reduce((n,r)=>(n[r.name]=r.value.length>50?`${r.value.substring(0,50)}...`:r.value,n),{});qt.table(t)}function od(){const e=document.querySelectorAll('[data-fillout-id]:not([data-fillout-id=""])');if(!e.length){qt.log("no Fillout forms on page, skipping data injection");return}const t=Rv(e),n=Nv(e);if(qt.enabled()){const r=Array.from(e).map(o=>o.getAttribute("data-fillout-id")).join(", ");qt.group(`injected ${t+n} data attributes (${t} stored, ${n} query) into ${e.length} form(s) [${r}]`),$v(e[0]),qt.groupEnd()}}const ue=B("integrations"),ms={endpoint:"",projectId:"",includeLocalStorage:!0,includeSessionStorage:!0,includeCookies:!0,includeParams:!0,excludeKeys:[],headers:{"Content-Type":"application/json"},timeout:1e4};async function Dv(e,t,n,r={}){const o=Date.now();try{if(!e||!t)throw new tt(qe.INVALID_CONFIGURATION,"Endpoint and project ID are required for console sync");const i=`${e.replace(/\/$/,"")}/${t}`,s={...ms,...r},a=new AbortController,c=setTimeout(()=>a.abort(),s.timeout);try{const l=await fetch(i,{method:"POST",headers:s.headers||{},body:JSON.stringify(n),signal:a.signal});clearTimeout(c);let u=null;try{u=await l.json()}catch{u=await l.text()}const d=Date.now()-o;return l.ok?(ue.log(`Data sent to server. Response status: ${l.status}, Time: ${d}ms`),{success:!0,status:l.status,response:u,syncTime:d}):(ue.error(`Console sync failed with status ${l.status}:`,u),{success:!1,status:l.status,response:u,error:`HTTP ${l.status}: ${l.statusText}`,syncTime:d})}finally{clearTimeout(c)}}catch(i){const s=Date.now()-o,a=i instanceof Error?i.message:String(i);return ue.error("Error sending data to server:",i),{success:!1,status:0,error:a,syncTime:s}}}function Pv(e={}){const t={...ms,...e},n=new Set(t.excludeKeys);try{const r={project_id:t.projectId,session_id:h("glue_user_id")??`session_${Date.now()}`,timestamp:Date.now(),url:window.location.href,user_agent:navigator.userAgent,localStorage:{},sessionStorage:{},cookies:{},params:{},custom:{}};if(t.includeLocalStorage)try{Object.keys(localStorage).forEach(i=>{if(!n.has(i)){const s=h(i);s!==null&&(r.localStorage[i]=s)}})}catch(o){ue.warn("Failed to collect localStorage data:",o)}if(t.includeSessionStorage)try{Object.keys(sessionStorage).forEach(i=>{if(!n.has(i)){const s=j(i);s!==null&&(r.sessionStorage[i]=s)}})}catch(o){ue.warn("Failed to collect sessionStorage data:",o)}if(t.includeCookies)try{document.cookie.split("; ").forEach(i=>{if(i.trim()){const[s,...a]=i.split("="),c=a.join("=");s&&!n.has(s)&&(r.cookies[s]=c||"")}})}catch(o){ue.warn("Failed to collect cookie data:",o)}if(t.includeParams)try{new URLSearchParams(window.location.search).forEach((i,s)=>{n.has(s)||(r.params[s]=i)})}catch(o){ue.warn("Failed to collect URL parameters:",o)}return r}catch(r){return ue.error("Error collecting sync data:",r),{project_id:t.projectId,session_id:`error_session_${Date.now()}`,timestamp:Date.now(),url:window.location.href,user_agent:navigator.userAgent,localStorage:{},sessionStorage:{},cookies:{},params:{},custom:{error:r instanceof Error?r.message:String(r)}}}}function Fv(){try{const e=document.querySelector('script[src*="glue.min.js"]');if(!e)return ue.warn("DataGlue script tag not found"),{};const t=e.getAttribute("project-id")||e.getAttribute("data-project-id")||window.glue_project_id,n=e.getAttribute("endpoint")||e.getAttribute("data-endpoint")||window.glue_endpoint;return{...t&&{projectId:t},...n&&{endpoint:n}}}catch(e){return ue.error("Error extracting configuration from script tag:",e),{}}}async function Uv(e={}){try{const t=Fv(),n={...ms,...t,...e};if(!n.projectId||!n.endpoint)throw new tt(qe.INVALID_CONFIGURATION,"Project ID and endpoint are required for console sync. Check script tag attributes.");const r=async a=>{try{ue.log(`Console sync triggered by: ${a}`);const c=Pv(n);return c.custom={...c.custom,trigger_event:a,trigger_timestamp:Date.now()},await Dv(n.endpoint,n.projectId,c,n)}catch(c){return ue.error(`Console sync failed for event ${a}:`,c),{success:!1,status:0,error:c instanceof Error?c.message:String(c),syncTime:0}}},i=(()=>{const a=()=>r("page_load"),c=l=>{l.target.tagName==="BUTTON"&&r("button_click")};return window.addEventListener("load",a),document.addEventListener("click",c),ue.log("Console sync event listeners attached"),()=>{window.removeEventListener("load",a),document.removeEventListener("click",c),ue.log("Console sync event listeners removed")}})(),s=await r("initialization");return window.consoleSyncCleanup=i,s}catch(t){return{success:!1,status:0,error:new tt(qe.TRACKING_INITIALIZATION_FAILED,"Failed to initialize console sync",{error:t instanceof Error?t.message:String(t)}).message,syncTime:0}}}async function jv(){return Uv()}const te=B("integrations"),id={endpoint:"",autoSync:!1,syncInterval:6e4,retryAttempts:3,retryDelay:1e3};let K={...id},Ht=null;function qv(e){if(K={...id,...e},!K.endpoint){te.warn("Profile sync endpoint not configured");return}te.log("Profile sync initialized with endpoint:",K.endpoint),K.autoSync&&sd()}function sd(){Ht&&clearInterval(Ht),Ht=setInterval(()=>{cd().catch(e=>{te.error("Auto-sync failed:",e)})},K.syncInterval),te.log("Auto-sync started with interval:",K.syncInterval)}function ad(){Ht&&(clearInterval(Ht),Ht=null,te.log("Auto-sync stopped"))}async function Hv(e,t={}){if(!K.endpoint)return te.warn("Cannot identify: endpoint not configured"),{success:!1,error:"Endpoint not configured"};const n=h("glue_user_id"),r=j("glue_session_id");if(!n||!r)return te.error("Cannot identify: missing glue_user_id or session_id"),{success:!1,error:"Missing required IDs"};const o={glue_user_id:n,email:e,traits:t,context:{session_id:r,utm_source:h("glue_initial_utm_source")||void 0,utm_medium:h("glue_initial_utm_medium")||void 0,utm_campaign:h("glue_initial_utm_campaign")||void 0,referrer:h("glue_user_referrer")||void 0,page:{url:window.location.href,title:document.title,path:window.location.pathname},visitor:{user_agent:navigator.userAgent,browser:navigator.userAgent.split(" ").pop(),os:navigator.platform,geolocation:h("glue_user_geolocation")||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:navigator.language}}};return Br(`${K.endpoint}/identify`,o)}async function zv(e,t={}){if(!K.endpoint)return te.warn("Cannot track: endpoint not configured"),{success:!1,error:"Endpoint not configured"};const n=h("glue_user_id"),r=j("glue_session_id");if(!n||!r)return te.error("Cannot track: missing glue_user_id or session_id"),{success:!1,error:"Missing required IDs"};const o=ft(),i={glue_user_id:n,session_id:r,email:o.email,event:e,properties:t,timestamp:Date.now(),context:{utm_source:h("glue_last_utm_source"),utm_medium:h("glue_last_utm_medium"),utm_campaign:h("glue_last_utm_campaign"),page:{url:window.location.href,title:document.title,path:window.location.pathname},referrer:document.referrer}};return Br(`${K.endpoint}/track`,i)}async function cd(){if(!K.endpoint)return te.warn("Cannot sync: endpoint not configured"),{success:!1,error:"Endpoint not configured"};const e=h("glue_user_id");if(!e)return te.error("Cannot sync: missing glue_user_id"),{success:!1,error:"Missing glue_user_id"};const t=dn(),n={glue_user_id:e,data:t,synced_at:new Date().toISOString(),merge_strategy:{profile:"keep_filled",traits:"keep_filled",events:"merge_all"}},r=await Br(`${K.endpoint}/sync`,n);return r.success&&J("data_synced",{sessions_count:t.sessions.length,events_count:t.events.length}),r}async function Br(e,t,n=1){try{te.log(`Sending request to ${e} (attempt ${n})`);const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return te.log("Request successful:",e),{success:!0,...o}}catch(r){return te.error(`Request failed (attempt ${n}):`,r),n<K.retryAttempts?(te.log(`Retrying in ${K.retryDelay}ms...`),await new Promise(o=>setTimeout(o,K.retryDelay)),Br(e,t,n+1)):{success:!1,error:r instanceof Error?r.message:String(r)}}}function Bv(e,t={}){if(!K.endpoint)return!1;const n=h("glue_user_id"),r=j("glue_session_id");if(!n||!r)return!1;const o=ft(),i={glue_user_id:n,session_id:r,email:o.email,event:e,properties:t,timestamp:Date.now(),context:{}},s=new Blob([JSON.stringify(i)],{type:"application/json"});return navigator.sendBeacon(`${K.endpoint}/track`,s)}function Vv(){return{...K}}function Wv(e){K={...K,...e},e.syncInterval&&K.autoSync&&(ad(),sd()),te.log("Sync config updated:",K)}const Fn={initializeProfileSync:qv,identify:Hv,track:zv,syncCompleteData:cd,trackBeacon:Bv,stopAutoSync:ad,getSyncConfig:Vv,updateSyncConfig:Wv},de=B("integrations");function ps(e,t,n,r){try{const o=e(t),i=n?o===n:o!==null;return r&&de.log(`[${r}] Retrieved [${o}] for key [${t}] - ${i?"PASS":"FAIL"}`),{key:t,expectedValue:n,actualValue:o,matchedStorage:i?r:void 0,passed:i}}catch(o){return de.error(`Error checking ${r||"storage"}:`,o),{key:t,expectedValue:n,actualValue:null,passed:!1}}}function Gv(e,t){try{const n=new URLSearchParams(window.location.search).get(e),r=t?n===t:n!==null;return de.log(`[URL] Retrieved [${n}] from URL for key [${e}] - ${r?"PASS":"FAIL"}`),{key:e,expectedValue:t,actualValue:n,matchedStorage:r?"params":void 0,passed:r}}catch(n){return de.error("Error checking URL parameters:",n),{key:e,expectedValue:t,actualValue:null,passed:!1}}}function Kv(e){const t=[],n=[],r=[];try{const{redirect:o,key:i,value:s,keys:a,access_denied:c,access_granted:l,selector:u,checkParams:d=!0,checkStorage:w=["localStorage","sessionStorage","cookies","params"],caseSensitive:g=!0}=e;if(!u)throw new tt(qe.INVALID_CONFIGURATION,"Selector is required for dynamic content configuration");const p=a||(i?[{key:i,value:s}]:[]);p.length===0&&de.warn("No conditions specified for dynamic content, granting access by default");let k=!0;const m=[];for(const v of p){const{key:f,value:b}=v;let I=!1;const E=g||!b?b:b.toLowerCase();for(const T of w){let M;switch(T){case"localStorage":M=ps(h,f,E,"LocalStorage");break;case"sessionStorage":M=ps(j,f,E,"SessionStorage");break;case"cookies":M=ps(ge,f,E,"Cookie");break;case"params":M=Gv(f,E);break;default:continue}if(!g&&b&&M.actualValue&&(M.passed=M.actualValue.toLowerCase()===E),m.push(M),M.passed){I=!0;break}}I||(k=!1)}de.log(`Access determination: ${k} for selector ${u}`);const _=document.querySelector(u);if(!_){const v=`Target element not found for selector: ${u}`;return t.push(v),de.error(v),{success:!1,elementsProcessed:0,grantedElements:[],deniedElements:[],errors:t}}if(k)_.style.display="block",l&&(_.innerHTML=l),n.push(u),de.log(`Access granted for selector: ${u}`);else if(c?(_.style.display="block",_.innerHTML=c):_.style.display="none",r.push(u),de.log(`Access denied for selector: ${u}`),o){de.log(`Redirecting to: ${o}`);try{window.location.replace(o)}catch(v){const f=`Failed to redirect to ${o}: ${v instanceof Error?v.message:String(v)}`;t.push(f),de.error(f)}}return{success:t.length===0,elementsProcessed:1,grantedElements:n,deniedElements:r,errors:t}}catch(o){const i=`Failed to process dynamic content configuration: ${o instanceof Error?o.message:String(o)}`;return t.push(i),de.error(i),{success:!1,elementsProcessed:0,grantedElements:[],deniedElements:[],errors:t}}}function ld(e){const t=Array.isArray(e)?e:[e];let n=0;const r=[],o=[],i=[];for(const s of t)try{const a=Kv(s);n+=a.elementsProcessed,r.push(...a.grantedElements),o.push(...a.deniedElements),i.push(...a.errors)}catch(a){const c=`Error processing configuration: ${a instanceof Error?a.message:String(a)}`;i.push(c),de.error(c)}return{success:i.length===0,elementsProcessed:n,grantedElements:r,deniedElements:o,errors:i}}function Jv(){document.querySelectorAll("[data-fillout-id]").length>0&&ud()}function ud(){const e=document.createElement("script");e.src="https://server.fillout.com/embed/v1/",e.onload=()=>{if(!C.enabled())return;const t=document.querySelector("[data-fillout-id]");if(t){C.group("Fillout form data after embed script load");const n={form_id:t.getAttribute("data-fillout-id"),attributes:Array.from(t.attributes).filter(r=>r.name.startsWith("data-")&&!r.name.startsWith("data-fillout-")).reduce((r,o)=>(r[o.name]=o.value,r),{})};C.table([n]),C.groupEnd()}},document.body.appendChild(e)}const _s=new WeakSet;function Xv(e){e.forEach(t=>_s.add(t))}function Yv(){if(typeof MutationObserver>"u"||!document.body)return;let e=!1;const t=()=>{e=!1;const r=document.querySelectorAll('[data-fillout-id]:not([data-fillout-id=""])');let o=!1;r.forEach(i=>{_s.has(i)||(_s.add(i),o=!0)}),o&&(C.log("Fillout: detected dynamically-injected form(s), decorating and rendering"),od(),ud())};new MutationObserver(()=>{e||(e=!0,queueMicrotask(t))}).observe(document.body,{childList:!0,subtree:!0})}function Zv(){try{const e=localStorage.getItem("glue_privacy_disable_pii")==="true",t=localStorage.getItem("glue_privacy_disable_form")==="true";return{capturePII:!e,injectJourney:!t}}catch(e){return C.warn("Unable to read privacy preferences:",e),{capturePII:!0,injectJourney:!0}}}window.glue=window.glue||{},window.glue.dynamicContent&&typeof window.glue.dynamicContent=="object"&&ld(window.glue.dynamicContent),window.glue.dynamicContent=function(e){ld(e)},window.glue.getVisitorContext=function(){return _o()},window.glue.setAttribution=function(e){e.utm_source!==void 0&&(S("glue_last_utm_source",e.utm_source),h("glue_initial_utm_source")||S("glue_initial_utm_source",e.utm_source)),e.utm_medium!==void 0&&(S("glue_last_utm_medium",e.utm_medium),h("glue_initial_utm_medium")||S("glue_initial_utm_medium",e.utm_medium)),e.utm_campaign!==void 0&&(S("glue_last_utm_campaign",e.utm_campaign),h("glue_initial_utm_campaign")||S("glue_initial_utm_campaign",e.utm_campaign)),e.utm_term!==void 0&&S("glue_last_utm_term",e.utm_term),e.utm_content!==void 0&&S("glue_last_utm_content",e.utm_content),e.gclid!==void 0&&S("glue_gclid",e.gclid),e.fbclid!==void 0&&S("glue_fbclid",e.fbclid),e.msclkid!==void 0&&S("glue_msclkid",e.msclkid),e.ttclid!==void 0&&S("glue_ttclid",e.ttclid),C.log("Attribution data set:",e)},window.glue.getAttribution=function(){return _o().attribution},window.glue.journey={track:(e,t)=>he.trackEvent(e,t),identify:(e,t)=>he.identifyUser(e,t),setCrmId:e=>he.setCrmId(e),getProfile:()=>he.getUserProfile(),getSessions:()=>he.getSessions(),getEvents:()=>he.getEvents(),getCompleteData:()=>he.getCompleteUserData(),exportData:()=>he.exportJourneyData(),clear:()=>he.clearJourneyData()},window.glue.sync={identify:(e,t)=>Fn.identify(e,t),track:(e,t)=>Fn.track(e,t),syncAll:()=>Fn.syncCompleteData(),config:e=>Fn.updateSyncConfig(e),sendToSupabase:()=>{const e=he.getPendingSyncData();return Z.syncToSupabase(e)}},window.glue.forms={enableJourneyInjection:()=>jt.enable(),disableJourneyInjection:()=>jt.disable(),injectIntoForm:e=>jt.injectIntoForm(e),getJourneySummary:()=>jt.getJourneySummaryFields(),config:e=>jt.updateConfig(e),getFormAnalytics:()=>Object.fromEntries(fh()),getFormById:e=>gh(e)},window.glue.storage={set:(e,t,n)=>{S(e,t),n&&G(e,t,n)},get:e=>h(e),remove:e=>{localStorage.removeItem(e),G(e,"",-1)},clear:()=>{localStorage.clear()},getSyncedAttributes:()=>{try{const e=h("glue_synced_attributes");return e?JSON.parse(e):{}}catch{return{}}},getCustomAttributes:()=>{try{const e=h("glue_custom_attributes");return e?JSON.parse(e):{}}catch{return{}}}},window.glue.devtools={getData:()=>bt(),getConsoleLogs:()=>bt().consoleLogs,getNetworkRequests:()=>bt().networkRequests,getPerformanceData:()=>{const e=bt();return{samples:e.performanceSamples,summary:e.performanceSummary,longTasks:e.longTasks,layoutShifts:e.layoutShifts}},getStateChanges:()=>bt().stateChanges,getFrustrationEvents:()=>bt().frustrationEvents},window.glue.debug={enable:e=>ef(e),disable:()=>tf(),status:()=>nf(),dump:()=>of()},window.glue.privacy={isRequired:()=>lt()?.isConsentRequired()??!1,getLevel:()=>lt()?.getConsentLevel()??"full",setConsent:e=>{lt()?.setConsent(e,"api")},isFeatureAllowed:e=>lt()?.isFeatureAllowed(e)??!0,onConsentChange:e=>lt()?.onConsentChange(e)??(()=>{})},window.glue.getAttribute=e=>h(`glue_attr_${e}`),window.glue.getAttributes=()=>{const e={};for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(n?.startsWith("glue_attr_")){const r=n.replace("glue_attr_","");e[r]=localStorage.getItem(n)||""}}return e},window.glue.onAttributeChange=e=>{const t=n=>{const r=n;e(r.detail.key,r.detail.value)};return window.addEventListener("glue:attribute",t),()=>window.removeEventListener("glue:attribute",t)};let dd=!1,fd=!1,gd=!1,md=!1;async function pd(){const e=window.__glueConfig,t=Zv(),n=document.currentScript||document.querySelector('script[src*="api.dataglue.io"]')||document.querySelector('script[src*="glue"]');let r=[],o=null,i=null,s=!1,a=["pageview","form_submit"],c=!0,l=!1,u="glue_",d=null,w=null,g=null;if(e){d=e.workspaceId,w=e.apiKey,g=e.supabaseUrl,s=e.autoSync!==void 0?e.autoSync:!1,c=e.injectJourney!==void 0?e.injectJourney:!0,Array.isArray(e.tracking?.events)&&(a=e.tracking.events.filter(T=>typeof T=="string"));const f=e.privacy??{consent_required:!1,default_consent_level:"full",storage_mode:"full",features:{fingerprinting:!0,geolocation:!0,form_capture:!0,session_replay:!0},banner:null,external:{mode:"none",providers:[],cookie_names:[]},respect_dnt:!1},b=lt()??Hf(f);C.log("Privacy manager initialized:",{consent_required:f.consent_required,consent_level:b.getConsentLevel()}),dd||(dd=!0,f.external.mode!=="none"&&(Yb(b),C.log("External banner listeners initialized")),f.banner&&b.getConsentLevel()==="none"&&(ev(f.banner,b),C.log("Consent banner displayed")),e.scripts&&e.scripts.length>0&&(tv(e.scripts,b),C.log("Conditional scripts loaded:",e.scripts.length)));const I=b.getConsentLevel(),E=I==="analytics"||I==="full";if(b.isConsentRequired()&&!E){fd||(fd=!0,b.onConsentChange(T=>{(T.level==="analytics"||T.level==="full")&&pd()})),C.log("Analytics tracking paused until analytics consent is granted");return}Ls()}if(md)return;md=!0;const p=lt();if(p?.isConsentRequired()&&!gd&&(gd=!0,p.onConsentChange(f=>{(f.level==="none"||f.level==="essential")&&window.location.reload()})),n){const f=n.getAttribute("modules");f&&(r=f.split(",")),o=n.getAttribute("endpoint"),i=n.getAttribute("profile-endpoint")||n.getAttribute("data-profile-endpoint");const b=n.getAttribute("auto-sync")||n.getAttribute("data-auto-sync");b!==null&&(s=b==="true");const I=n.getAttribute("track-events")||n.getAttribute("data-track-events");I&&(a=I.split(",").map(z=>z.trim()));const E=n.getAttribute("inject-journey")||n.getAttribute("data-inject-journey");E!==null&&(c=E!=="false");const T=n.getAttribute("inject-full-journey")||n.getAttribute("data-inject-full-journey");T!==null&&(l=T==="true");const M=n.getAttribute("journey-field-prefix")||n.getAttribute("data-journey-field-prefix");M&&(u=M),d||(d=n.getAttribute("workspace-id")||n.getAttribute("data-workspace-id")),w||(w=n.getAttribute("api-key")||n.getAttribute("data-api-key")),g||(g=n.getAttribute("supabase-url")||n.getAttribute("data-supabase-url"))}C.enabled()&&(C.group("boot",!0),C.log("config",{workspaceId:d,configSource:e?"__glueConfig (edge)":"script tag",autoSync:s,trackEvents:a,injectJourney:c,injectFullJourney:l,journeyFieldPrefix:u,modules:r,endpoint:o,profileEndpoint:i,capturePII:t.capturePII}),C.log("tip: glue.debug.dump() prints stored state · glue.debug.enable('forms,fillout') filters namespaces"),C.groupEnd()),!ao()&&Vf()&&C.log("Location capture is off: stored location removed"),eo(),_o(),Hs(),iv(),no(),Cf(),uv(),Sv(),Iv(),xv(),"requestIdleCallback"in window?requestIdleCallback(()=>{Bu(),C.log("Auto-analytics attributes applied (deferred)")},{timeout:2e3}):setTimeout(()=>{Bu(),C.log("Auto-analytics attributes applied (fallback)")},100),_m(),C.log("Enhanced context tracking initialized");let k=null,m=null,_=[];try{const{AttributionEngine:f}=await Promise.resolve().then(()=>Jf),{createDefaultChannels:b,createChannelFromConfig:I,mergeChannelConfigs:E}=await Promise.resolve().then(()=>rg),{createAttributionModel:T}=await Promise.resolve().then(()=>n0);if(e?.channels&&e?.attributionModel){const M=e.channels.map(I).filter(Boolean),z=b(),Ce=E(z,M),ae=T(e.attributionModel),y=new f(ae,Ce),x=y.execute();x&&C.log("Attribution touchpoint recognized:",x.getChannel().getLabel()),_=y.getTouchpointHistory().map(L=>({channel_id:L.getChannel().getId(),channel_name:L.getChannel().getLabel(),channel_type:"custom",channel_value:L.getValue(),timestamp:new Date(L.getTimestamp()*1e3).toISOString(),referrer:document.referrer,landing_page:window.location.pathname,utm_data:{},tracking_data:{},context:{}})),Z.setExtendedData({touchpoints:_})}}catch(f){C.error("Error initializing attribution:",f)}"requestIdleCallback"in window&&Kt("fingerprinting")&&requestIdleCallback(async()=>{try{const{getOrGenerateFingerprint:f}=await Promise.resolve().then(()=>a0),{generateDeviceFingerprint:b}=await Promise.resolve().then(()=>u0),{collectMobileData:I}=await Promise.resolve().then(()=>Tm);k=await f(async()=>{const E=await b(),T=await I();return T&&(E.mobile_data=T),E}),Z.setExtendedData({device_fingerprint:k}),C.log("Device fingerprint ready:",k.composite_id)}catch(f){C.error("Failed to generate fingerprint:",f)}},{timeout:3e3});const v=async()=>{try{const f=await Sm();Z.setExtendedData({enhanced_context:f}),C.log("Enhanced context collected:",{network:f.network.effectiveType,colorScheme:f.preferences.colorScheme,adBlocker:f.adBlocker})}catch(f){C.error("Failed to collect enhanced context:",f)}document.removeEventListener("click",v),document.removeEventListener("scroll",v)};if(document.addEventListener("click",v,{once:!0,passive:!0}),document.addEventListener("scroll",v,{once:!0,passive:!0}),setTimeout(v,5e3),"requestIdleCallback"in window&&ao()&&requestIdleCallback(async()=>{try{const{getGeolocationWithFallback:f}=await Promise.resolve().then(()=>Ff),b=h("glue_geo_cache");if(b)try{const{data:E,timestamp:T}=JSON.parse(b),M=Date.now()-T;if(typeof E=="object"&&E!==null&&!Array.isArray(E)&&Object.keys(E).length>0&&Number.isFinite(T)&&M>=0&&M<864e5){m=E,Z.setExtendedData({geolocation:m}),C.log("Using cached geolocation");return}}catch{}const I=g?`${g}/functions/v1/geolocate`:void 0;m=await f(I),m&&(S("glue_geo_cache",JSON.stringify({data:m,timestamp:Date.now()})),Z.setExtendedData({geolocation:m}),C.log("Geolocation data collected:",m?.city,m?.country_name))}catch(f){C.error("Failed to get geolocation:",f)}},{timeout:5e3}),d&&g){Z.initializeSupabaseSync({workspaceId:d,workspaceApiKey:w||void 0,hostname:window.location.hostname,supabaseUrl:g}),C.log("Supabase sync initialized for workspace:",d);try{const b=h("glue_user_id");if(b){const I=new URL(`${g}/functions/v1/ingest-events`);I.searchParams.set("workspace_id",d),I.searchParams.set("glue_user_id",b),I.searchParams.set("hostname",window.location.hostname),fetch(I.toString(),{method:"GET"}).then(E=>E.json()).then(E=>{E.pending_sync_data&&Object.keys(E.pending_sync_data).length>0&&(C.log("Received browser attributes from server:",E.pending_sync_data),Object.entries(E.pending_sync_data).forEach(([T,M])=>{const z=typeof M=="object"&&M.value!==void 0?M.value:M;if(typeof M=="object"&&M.expires_at&&new Date(M.expires_at)<new Date){C.log(`Skipping expired attribute: ${T}`);return}S(`glue_attr_${T}`,String(z)),window.dispatchEvent(new CustomEvent("glue:attribute",{detail:{key:T,value:z}}))}),S("glue_synced_attributes",JSON.stringify(E.pending_sync_data))),E.custom_attributes&&Object.keys(E.custom_attributes).length>0&&S("glue_custom_attributes",JSON.stringify(E.custom_attributes))}).catch(E=>{C.warn("Failed to fetch enrichment data:",E)})}}catch(b){C.warn("Two-way sync check failed:",b)}const f=e?.devtools||{enabled:!0};if(f.enabled!==!1){Jb({enabled:!0,networkEnabled:f.networkEnabled!==!1});let b="",I=!1;const E=`${g.replace(/\/$/,"")}/functions/v1/ingest-events`;Xb(async T=>{let M="";for(let y=T.networkRequests.length-1;y>=0;y--){const x=T.networkRequests[y];if(!x.url.startsWith(E)){M=x.id;break}}const z=T.frustrationEvents,Ce=z.length>0?z[z.length-1].id:"",ae=`${M}:${Ce}`;if(!(I||ae===":"||ae===b)){I=!0,Z.setExtendedData({devtools_data:T});try{await Z.syncToSupabase(he.getPendingSyncData())&&(b=ae)}catch(y){C.warn("DevTools snapshot sync failed:",y)}finally{Z.setExtendedData({devtools_data:null}),I=!1}}},31e3),C.log("DevTools collectors initialized (network + frustration)")}}he.initializeJourneyTracking({autoTrackPageViews:a.includes("pageview"),autoTrackClicks:a.includes("click"),autoTrackClickMap:a.includes("click_map"),autoTrackScroll:a.includes("scroll"),autoTrackFormSubmits:a.includes("form_submit"),autoSync:s&&Z.isSupabaseSyncEnabled(),piiCaptureEnabled:t.capturePII,formInjectionEnabled:t.injectJourney}),vp(e?.tracking?.features??{},e?.tracking?.featureConfig??{},e?.tracking?.config_version??""),K_({enabled:!0,domIntelligence:e?.tracking?.features?.form_intelligence===!0,trackFocusBlur:!0,trackTyping:!0,trackValidation:!0,trackAbandonment:!0,captureFieldLength:!0,detectAutofill:!0}),C.log("Form field analytics enabled"),i&&(Fn.initializeProfileSync({endpoint:i,autoSync:s,syncInterval:6e4,retryAttempts:3,retryDelay:1e3}),C.log("Profile sync enabled with endpoint:",i)),t.injectJourney&&c?jt.setupFormJourneyInjection({enabled:c,includeFullJourney:l,fieldPrefix:u,formSelector:"form",maxDataSize:1e4,fields:{userId:!0,sessionId:!0,totalSessions:!0,totalEvents:!0,daysActive:!0,firstTouch:!0,lastTouch:!0,journeyData:l}}):C.log("Form journey injection disabled via privacy settings"),C.log("Form journey injection initialized:",{enabled:c,includeFullJourney:l,fieldPrefix:u}),r.includes("formSearch")&&C.log("FormSearch module requested but not yet implemented in TypeScript version"),o&&jv(),Jv(),od(),Xv(document.querySelectorAll('[data-fillout-id]:not([data-fillout-id=""])')),Yv(),C.log("DataGlue TypeScript initialization complete")}pd().catch(e=>{console.error("DataGlue initialization failed:",e)});var Qv=Object.defineProperty,e0=(e,t,n)=>t in e?Qv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zt=(e,t,n)=>e0(e,typeof t!="symbol"?t+"":t,n);class vt{constructor(t=2592e3){zt(this,"touchpointLifetime"),this.touchpointLifetime=t}filterValidTouchpoints(t){const n=kt();return t.filter(r=>r.getTimestamp()>n-this.touchpointLifetime)}}class hs extends vt{execute(t=[]){const n=this.filterValidTouchpoints(t);let r=null;return n.forEach(o=>{(r===null||o.getChannel().options.canOverwrite)&&(r=o)}),r?[new oe(r,100)]:[]}}class _d extends vt{execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];const r=n[0];return[new oe(r,100)]}}class hd extends vt{execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];const r=100/n.length;return n.map(o=>new oe(o,r))}}class yd extends vt{constructor(t=2592e3,n=7){super(t),zt(this,"decayRate"),this.decayRate=n*86400}execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];const r=kt(),o=[];let i=0;return n.forEach(s=>{const a=r-s.getTimestamp(),c=Math.exp(-(Math.LN2/this.decayRate)*a);o.push(c),i+=c}),n.map((s,a)=>{const c=o[a]/i*100;return new oe(s,c)})}}class wd extends vt{constructor(t=2592e3,n=40,r=40,o=20){if(super(t),zt(this,"firstWeight"),zt(this,"lastWeight"),zt(this,"middleWeight"),this.firstWeight=n,this.lastWeight=r,this.middleWeight=o,n+r+o!==100)throw new Error("Position-based weights must sum to 100")}execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];if(n.length===1)return[new oe(n[0],100)];if(n.length===2)return[new oe(n[0],this.firstWeight),new oe(n[1],this.lastWeight+this.middleWeight)];const r=n.slice(1,-1),o=this.middleWeight/r.length,i=[];return i.push(new oe(n[0],this.firstWeight)),r.forEach(s=>{i.push(new oe(s,o))}),i.push(new oe(n[n.length-1],this.lastWeight)),i}}class bd extends vt{constructor(t=2592e3,n=[]){if(super(t),zt(this,"positionWeights"),this.positionWeights=n,n.reduce((o,i)=>o+i,0)!==100&&n.length>0)throw new Error("Custom position weights must sum to 100")}execute(t=[]){const n=this.filterValidTouchpoints(t);if(n.length===0)return[];if(this.positionWeights.length===0){const r=100/n.length;return n.map(o=>new oe(o,r))}if(n.length>this.positionWeights.length){const r=[];let o=0;for(let c=0;c<this.positionWeights.length;c++)r.push(new oe(n[c],this.positionWeights[c])),o+=this.positionWeights[c];const i=100-o,s=n.length-this.positionWeights.length,a=i/s;for(let c=this.positionWeights.length;c<n.length;c++)r.push(new oe(n[c],a));return r}return n.map((r,o)=>new oe(r,this.positionWeights[o]))}}function t0(e){const t=e.touchpoint_lifetime_days*86400;switch(e.model_type){case"last_touch":return new hs(t);case"first_touch":return new _d(t);case"linear":return new hd(t);case"time_decay":return new yd(t,e.config.decay_rate||7);case"position_based":return new wd(t,e.config.first_weight||40,e.config.last_weight||40,e.config.middle_weight||20);case"custom_weighted":return new bd(t,e.config.position_weights||[]);default:return new hs(t)}}const n0=Object.freeze(Object.defineProperty({__proto__:null,AttributionModel:vt,CustomWeightedAttributionModel:bd,FirstTouchAttributionModel:_d,LastTouchAttributionModel:hs,LinearAttributionModel:hd,PositionBasedAttributionModel:wd,TimeDecayAttributionModel:yd,createAttributionModel:t0},Symbol.toStringTag,{value:"Module"})),Un=B("fingerprint"),r0="glue_fingerprint_db",ot="fingerprints",o0=7*24*60*60*1e3;function ys(){return new Promise((e,t)=>{const n=indexedDB.open(r0,1);n.onerror=()=>t(n.error),n.onsuccess=()=>e(n.result),n.onupgradeneeded=r=>{const o=r.target.result;o.objectStoreNames.contains(ot)||o.createObjectStore(ot,{keyPath:"composite_id"})}})}async function vd(){try{const n=(await ys()).transaction(ot,"readonly").objectStore(ot);return new Promise(r=>{const o=n.getAll();o.onsuccess=()=>{const i=o.result;if(i&&i.length>0){const s=i.sort((a,c)=>c.timestamp-a.timestamp)[0];Date.now()-s.timestamp<o0?r(s.data):r(null)}else r(null)},o.onerror=()=>r(null)})}catch(e){return Un.error("error getting cached fingerprint:",e),null}}async function Sd(e){try{const r=(await ys()).transaction(ot,"readwrite").objectStore(ot),o={data:e,timestamp:Date.now(),composite_id:e.composite_id};r.put(o);const i=r.getAll();i.onsuccess=()=>{const s=i.result;s.length>3&&s.sort((l,u)=>u.timestamp-l.timestamp).slice(3).forEach(l=>{r.delete(l.composite_id)})}}catch(t){Un.error("error caching fingerprint:",t)}}async function i0(){try{(await ys()).transaction(ot,"readwrite").objectStore(ot).clear()}catch(e){Un.error("error clearing fingerprint cache:",e)}}async function s0(e){const t=await vd();if(t)return Un.log("using cached fingerprint (instant)"),t;Un.log("generating new fingerprint…");const n=await e();return await Sd(n),n}const a0=Object.freeze(Object.defineProperty({__proto__:null,cacheFingerprint:Sd,clearFingerprintCache:i0,getCachedFingerprint:vd,getOrGenerateFingerprint:s0},Symbol.toStringTag,{value:"Module"}));function it(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(36)}function Ed(){return{width:window.screen.width,height:window.screen.height,availWidth:window.screen.availWidth,availHeight:window.screen.availHeight,colorDepth:window.screen.colorDepth,pixelDepth:window.screen.pixelDepth,devicePixelRatio:window.devicePixelRatio||1,orientation:window.screen.orientation?.type||"unknown"}}function kd(){return{userAgent:navigator.userAgent,language:navigator.language,languages:Array.from(navigator.languages||[]),platform:navigator.platform,vendor:navigator.vendor||"unknown",cookieEnabled:navigator.cookieEnabled,doNotTrack:navigator.doNotTrack||null,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,timezoneOffset:new Date().getTimezoneOffset()}}function Ad(){return{hardwareConcurrency:navigator.hardwareConcurrency||0,deviceMemory:navigator.deviceMemory,maxTouchPoints:navigator.maxTouchPoints||0,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0}}async function Td(){try{if("getBattery"in navigator){const e=await navigator.getBattery();return{charging:e.charging,level:e.level,chargingTime:e.chargingTime,dischargingTime:e.dischargingTime}}}catch{}return null}function Cd(){try{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return null;e.width=200,e.height=50,t.textBaseline="top",t.font='14px "Arial"',t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(125,1,62,20),t.fillStyle="#069",t.fillText("DataGlue 🔍",2,15),t.fillStyle="rgba(102, 204, 0, 0.7)",t.fillText("DataGlue 🔍",4,17),t.globalCompositeOperation="multiply",t.fillStyle="rgb(255,0,255)",t.beginPath(),t.arc(50,25,20,0,Math.PI*2,!0),t.closePath(),t.fill(),t.fillStyle="rgb(0,255,255)",t.beginPath(),t.arc(70,25,20,0,Math.PI*2,!0),t.closePath(),t.fill();const n=e.toDataURL();return it(n)}catch{return null}}function Id(){try{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return null;const n=t.getExtension("WEBGL_debug_renderer_info"),r=n?t.getParameter(n.UNMASKED_VENDOR_WEBGL):"unknown",o=n?t.getParameter(n.UNMASKED_RENDERER_WEBGL):"unknown",i=t.getSupportedExtensions()?.join(",")||"",s=[t.getParameter(t.VERSION),t.getParameter(t.SHADING_LANGUAGE_VERSION),t.getParameter(t.MAX_TEXTURE_SIZE),t.getParameter(t.MAX_VERTEX_ATTRIBS),t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),t.getParameter(t.MAX_VARYING_VECTORS),t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS)].join("|"),a=`${r}|${o}|${i}|${s}`;return it(a)}catch{return null}}function xd(){return new Promise(e=>{try{const t=window.AudioContext||window.webkitAudioContext;if(!t){e(null);return}const n=new t,r=n.createOscillator(),o=n.createAnalyser(),i=n.createGain(),s=n.createScriptProcessor(4096,1,1);i.gain.value=0,r.type="triangle",r.connect(o),o.connect(s),s.connect(i),i.connect(n.destination),s.onaudioprocess=function(a){const c=a.outputBuffer.getChannelData(0),l=Array.from(c.slice(0,30)).map(u=>u.toFixed(6)).join(",");r.disconnect(),s.disconnect(),o.disconnect(),i.disconnect(),e(it(l))},r.start(0),setTimeout(()=>{try{r.stop()}catch{}e(null)},100)}catch{e(null)}})}function Ld(){const e=["monospace","sans-serif","serif"],t=["Arial","Verdana","Times New Roman","Courier New","Georgia","Palatino","Garamond","Bookman","Comic Sans MS","Trebuchet MS","Impact","Arial Black","Helvetica","Tahoma","Geneva","Lucida Sans","Lucida Console","Monaco","Consolas","Andale Mono","Century Gothic","Calibri","Cambria","Candara","Franklin Gothic","Futura","Optima","Segoe UI","Roboto","Ubuntu","Droid Sans","Open Sans","Lato","Montserrat","Raleway"],r=document.createElement("canvas").getContext("2d");if(!r)return[];const o="mmmmmmmmmmlli",i="72px",s=[],a={};return e.forEach(c=>{r.font=`${i} ${c}`,a[c]=r.measureText(o).width}),t.forEach(c=>{let l=!1;e.forEach(u=>{r.font=`${i} '${c}', ${u}`,r.measureText(o).width!==a[u]&&(l=!0)}),l&&s.push(c)}),s}function Md(){const e={localStorage:null,indexedDB:null,cookie:null};try{let t=localStorage.getItem("_glue_fpid");t||(t=Od(),localStorage.setItem("_glue_fpid",t)),e.localStorage=t}catch{}try{const t=document.cookie.match(/_glue_fpid=([^;]+)/);if(t)e.cookie=t[1];else{const n=Od();document.cookie=`_glue_fpid=${n};max-age=31536000;path=/`,e.cookie=n}}catch{}return e}function Od(){return`${Date.now()}-${Math.random().toString(36).substring(2,15)}`}async function c0(){const e=Ed(),t=kd(),n=Ad(),r=Md(),[o,i,s,a,c]=await Promise.all([Td(),Promise.resolve(Cd()),Promise.resolve(Id()),xd(),Hd()]),l=Ld(),u={screen:e,browser:t,hardware:n,canvas:i,webgl:s,audio:a,fonts:l,battery:o,storage:r},d=JSON.stringify(u),w=it(d),g=it([i,s,a,e.width,e.height,t.userAgent,l.join(","),c.mathHash,c.voiceHash,c.codecHash,c.gpu?.renderer,r.localStorage,r.cookie].filter(Boolean).join("|"));return{fingerprint_hash:w,canvas_hash:i,webgl_hash:s,audio_hash:a,screen_data:e,browser_data:t,hardware_data:n,font_list:l,battery_data:o,storage_ids:r,mobile_data:null,composite_id:g,raw_fingerprint:u,enhanced:c}}function l0(){try{const e=document.createElement("canvas"),t=e.getContext("2d");return!t||(t.fillText("test",0,0),e.toDataURL()==="data:,")}catch{return!0}}function Rd(){try{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return null;const n=t.getExtension("WEBGL_debug_renderer_info");return n?{vendor:t.getParameter(n.UNMASKED_VENDOR_WEBGL)||"unknown",renderer:t.getParameter(n.UNMASKED_RENDERER_WEBGL)||"unknown"}:null}catch{return null}}function Nd(){return new Promise(e=>{try{if(!("speechSynthesis"in window)){e(null);return}const t=()=>{const r=speechSynthesis.getVoices();if(r.length===0)return null;const o=r.map(i=>`${i.name}|${i.lang}|${i.localService?"l":"r"}`).sort().join(",");return{hash:it(o),count:r.length}};let n=t();if(n){e(n);return}speechSynthesis.onvoiceschanged=()=>{n=t(),e(n)},setTimeout(()=>e(t()),500)}catch{e(null)}})}async function $d(){try{if(!navigator.mediaDevices?.enumerateDevices)return null;const e=await navigator.mediaDevices.enumerateDevices(),t={audioinput:0,audiooutput:0,videoinput:0};for(const n of e)n.kind in t&&t[n.kind]++;return t}catch{return null}}function Dd(){const e=[Math.tan(-1e300),Math.sin(1),Math.cos(1),Math.exp(1),Math.log(2),Math.sqrt(2),Math.pow(Math.PI,-100),Math.acos(.123456789),Math.asin(.123456789),Math.atan(.123456789),Math.atan2(.123456789,.987654321),Math.sinh(1),Math.cosh(1),Math.tanh(1)];return it(e.map(t=>t.toString()).join("|"))}function Pd(){const e=document.createElement("video"),n=['video/mp4; codecs="avc1.42E01E"','video/mp4; codecs="avc1.4D401E"','video/mp4; codecs="avc1.64001E"','video/webm; codecs="vp8"','video/webm; codecs="vp9"','video/webm; codecs="av1"','video/ogg; codecs="theora"','audio/mp4; codecs="mp4a.40.2"','audio/webm; codecs="opus"','audio/ogg; codecs="vorbis"',"audio/wav","audio/flac"].map(r=>{const o=e.canPlayType(r);return o==="probably"?"2":o==="maybe"?"1":"0"}).join("");return it(n)}async function Fd(){const e={widevine:!1,playready:!1,fairplay:!1};if(!navigator.requestMediaKeySystemAccess)return e;const t=[{initDataTypes:["cenc"],audioCapabilities:[{contentType:'audio/mp4; codecs="mp4a.40.2"'}],videoCapabilities:[{contentType:'video/mp4; codecs="avc1.42E01E"'}]}];try{await navigator.requestMediaKeySystemAccess("com.widevine.alpha",t),e.widevine=!0}catch{}try{await navigator.requestMediaKeySystemAccess("com.microsoft.playready",t),e.playready=!0}catch{}try{await navigator.requestMediaKeySystemAccess("com.apple.fps.1_0",t),e.fairplay=!0}catch{}return e}function Ud(){return{bluetooth:"bluetooth"in navigator,usb:"usb"in navigator,serial:"serial"in navigator,midi:"requestMIDIAccess"in navigator,gamepad:"getGamepads"in navigator,xr:"xr"in navigator,payment:"PaymentRequest"in window,share:"share"in navigator,wakeLock:"wakeLock"in navigator,pdfViewer:navigator.pdfViewerEnabled??!1}}function jd(){return new Promise(e=>{const t=new Set;try{const n=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});n.createDataChannel(""),n.onicecandidate=r=>{if(!r.candidate){n.close(),e(Array.from(t));return}const o=r.candidate.candidate.match(/([0-9]{1,3}\.){3}[0-9]{1,3}|([a-f0-9]{1,4}:){7}[a-f0-9]{1,4}/gi);o&&o.forEach(i=>{!i.includes(".local")&&i!=="0.0.0.0"&&t.add(i)})},n.createOffer().then(r=>n.setLocalDescription(r)).catch(()=>e([])),setTimeout(()=>{n.close(),e(Array.from(t))},2e3)}catch{e([])}})}function qd(){const e={webdriver:!!navigator.webdriver,headless:!1,phantom:!1,selenium:!1,puppeteer:!1,playwright:!1,automationControlled:!1,chromeProtocol:!1,inconsistentUA:!1,noPlugins:!1,noLanguages:!1,suspiciousScreen:!1,missingAPIs:!1};e.headless=/HeadlessChrome/.test(navigator.userAgent)||navigator.webdriver===!0||!window.chrome?.runtime,e.phantom=!!(window.callPhantom||window._phantom||window.phantom),e.selenium=!!(window.__selenium_unwrapped||window.__webdriver_evaluate||window.__driver_evaluate||document.documentElement.getAttribute("selenium")||document.documentElement.getAttribute("webdriver")||document.documentElement.getAttribute("driver")),e.puppeteer=!!(window.__puppeteer_evaluation_script__||navigator.userAgent.includes("puppeteer")),e.playwright=!!(window.__playwright||window.__pw_manual),e.automationControlled=!!(navigator.webdriver||window.cdc_adoQpoasnfa76pfcZLmcfl_Array||window.cdc_adoQpoasnfa76pfcZLmcfl_Promise),e.chromeProtocol=!!(window.domAutomation||window.domAutomationController);const t=/Chrome/.test(navigator.userAgent)&&!/Edge|Edg/.test(navigator.userAgent);e.inconsistentUA=t&&!window.chrome,e.noPlugins=navigator.plugins.length===0,e.noLanguages=!navigator.languages||navigator.languages.length===0,e.suspiciousScreen=window.outerWidth===0||window.outerHeight===0||window.screen.width===0||window.screen.height===0,e.missingAPIs=typeof window.alert!="function"||typeof window.confirm!="function"||typeof window.prompt!="function";let n=0;return e.webdriver&&(n+=30),e.headless&&(n+=25),e.phantom&&(n+=40),e.selenium&&(n+=35),e.puppeteer&&(n+=35),e.playwright&&(n+=35),e.automationControlled&&(n+=30),e.chromeProtocol&&(n+=25),e.inconsistentUA&&(n+=15),e.noPlugins&&(n+=10),e.noLanguages&&(n+=10),e.suspiciousScreen&&(n+=20),e.missingAPIs&&(n+=20),{isBot:n>=30,confidence:Math.min(100,n),signals:e}}async function Hd(){const[e,t,n,r]=await Promise.all([Nd(),$d(),Fd(),jd()]);return{gpu:Rd()||void 0,voiceHash:e?.hash,voiceCount:e?.count,mediaDevices:t||void 0,mathHash:Dd(),codecHash:Pd(),drm:n,capabilities:Ud(),webrtcIPs:r.length>0?r:void 0,bot:qd()}}const u0=Object.freeze(Object.defineProperty({__proto__:null,collectBatteryData:Td,collectBrowserData:kd,collectEnhancedFingerprint:Hd,collectHardwareData:Ad,collectScreenData:Ed,detectBot:qd,detectFonts:Ld,generateAudioFingerprint:xd,generateCanvasFingerprint:Cd,generateDeviceFingerprint:c0,generateWebGLFingerprint:Id,getCodecFingerprint:Pd,getDRMSupport:Fd,getGPUInfo:Rd,getHardwareCapabilities:Ud,getMathFingerprint:Dd,getMediaDevicesCount:$d,getStorageIds:Md,getVoiceFingerprint:Nd,getWebRTCIPs:jd,isFingerprintingBlocked:l0},Symbol.toStringTag,{value:"Module"}))})();
