1!function(e){"use strict";const n=e&&e.CdpIngestionEndpoint||"https://cdp-ingestion-staging.inchcape-web.au/events";let t=null,o=!1,s=null;const a=[];function i(e){if(e&&void 0!==e.analytics)if(window.ketchConsent=Object.assign({},window.ketchConsent,e),s=!0===e.analytics,console.log("[CDP Debug] applyConsent: analytics =",s),s)for(o||(o=!0,import("https://cdn.jsdelivr.net/npm/@thumbmarkjs/thumbmarkjs/dist/thumbmark.esm.js").then(e=>e.getFingerprint()).then(e=>{t=e,window.CdpUserId=e,window.SubaruCdpUserId=e,window.dispatchEvent(new CustomEvent("CdpUserIdReady",{detail:e})),window.dispatchEvent(new CustomEvent("SubaruCdpUserIdReady",{detail:e})),console.log("[CDP Debug] ThumbmarkJS generated visitorId:",t)}).catch(e=>{console.error("[CDP Debug] ThumbmarkJS error:",e)}));a.length;){const e=a.shift();c(e.rawEvent,e.currentState)}else a.length=0}function r(e,n){!1!==s?null!==s?c(e,n):a.length<50&&(a.push({rawEvent:e,currentState:n}),console.log("[CDP Debug] sendEvent: buffered until consent resolves (",a.length,"pending)")):console.log("[CDP Debug] sendEvent: dropped - no analytics consent")}function c(o,s){const a=function(n,o){console.log("[CDP Debug] buildPayload: Raw event received:",n);const s=new Date,a=Object.assign({},n||{});!a.page&&o&&o.page&&(a.page=o.page,console.log("[CDP Debug] buildPayload: Copied page from currentState:",o.page)),!a.user&&o&&o.user&&(a.user=o.user,console.log("[CDP Debug] buildPayload: Copied user from currentState:",o.user)),a.dvce_created_tstamp||(a.dvce_created_tstamp=s.toISOString()),t&&(a.user_id=t),a.session_id||(a.session_id=function(){try{const e="wa_session_id",n=sessionStorage.getItem(e);if(n)return console.log("[CDP Debug] getSessionId: Using existing session:",n),n;const t=crypto.randomUUID?crypto.randomUUID():String(Date.now())+"-"+Math.random();return sessionStorage.setItem(e,t),console.log("[CDP Debug] getSessionId: Created new session:",t),t}catch(e){const n="sess-"+Date.now()+"-"+Math.random();return console.log("[CDP Debug] getSessionId: SessionStorage disabled, using fallback:",n),n}}());let i=!1;a.user&&(i=!!(a.user.encryptedEmail||a.user.encryptedFirstName||a.user.encryptedLastName));const r=function(e){try{if(window.ketchConsent&&void 0!==window.ketchConsent[e])return console.log("[CDP Debug] checkUserConsentByCategory:",e,"=",window.ketchConsent[e],"(from ketchConsent object)"),window.ketchConsent[e];if(window.ketch&&"function"==typeof window.ketch.hasConsent){const n=window.ketch.hasConsent(e);return console.log("[CDP Debug] checkUserConsentByCategory:",e,"=",n,"(from SDK)"),n}return console.log("[CDP Debug] checkUserConsentByCategory: Ketch consent not available for",e),!1}catch(n){return console.log("[CDP Debug] checkUserConsentByCategory: Error checking consent for",e,":",n),!1}}("functional");return i&&!r&&a.user&&(console.log("[CDP Debug] buildPayload: Removing encrypted fields due to lack of consent"),delete a.user.encryptedEmail,delete a.user.encryptedFirstName,delete a.user.encryptedLastName,i=!1),a.has_encrypted_user_data=i&&r,console.log("[CDP Debug] buildPayload: hasEncryptedData:",i,"hasFunctionalConsent:",r,"has_encrypted_user_data:",a.has_encrypted_user_data),a.domain_userid=function(){try{const e="inchcape_uid";let n=localStorage.getItem(e);return n?(console.log("[CDP Debug] getDomainUserId: Found existing domain user ID:",n),n):(n="inch_uid_"+(crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+"-"+Math.random().toString(36).substr(2,9)),localStorage.setItem(e,n),console.log("[CDP Debug] getDomainUserId: Generated new domain user ID:",n),n)}catch(e){const n="inch_uid_"+(crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+"-"+Math.random().toString(36).substr(2,9));return console.log("[CDP Debug] getDomainUserId: localStorage disabled, using fallback:",n),n}}(),e.CdpExperiments&&!a.experiments&&(a.experiments={...e.CdpExperiments}),window.ketchConsent?(a.ketch_consent=window.ketchConsent,console.log("[CDP Debug] buildPayload: Added ketchConsent to payload:",window.ketchConsent)):console.log("[CDP Debug] buildPayload: ketchConsent not available"),console.log("[CDP Debug] buildPayload: Final payload:",a),a}(o,s),i=JSON.stringify(a);if(console.log("[CDP Debug] JSON string:",i),navigator.sendBeacon){const e=new Blob([i],{type:"text/plain"}),t=navigator.sendBeacon(n,e);return void console.log("[CDP Debug] sendEvent: Sent via sendBeacon (text/plain) to",n,"Success:",t)}console.log("[CDP Debug] sendEvent: Using fetch fallback to",n);try{fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:i,keepalive:!0}
1).catch(e=>{console.error("[CDP Debug] sendEvent: Fetch failed:",e)})}catch(e){console.error("[CDP Debug] sendEvent: Exception during fetch:",e)}}window.ketchConsent&&void 0!==window.ketchConsent.analytics&&i(window.ketchConsent),"function"==typeof e.ketch?e.ketch("on","consent",function(e){i(e&&e.purposes||null)}):console.log("[CDP Debug] Ketch not available - events stay buffered until consent arrives"),window.digitalData=window.digitalData||{},digitalData.events=window.digitalData.events||[],digitalData.currentState=window.digitalData.currentState||{},window.dataLayer=window.dataLayer||[];const d=e.digitalData;d.events=d.events||[];const l=d.events.push;d.events.push=function(...e){console.log("[CDP Debug] digitalData.events.push intercepted with",e.length,"item(s):",e);const n=l.apply(this,e);return e.forEach(e=>{try{r(e,d.currentState)}catch(e){console.error("[CDP Debug] failed to send event",e)}}),n},console.log("[CDP Debug] CDP script initialized. Endpoint:",n),e.sendAnalyticsEvent=r}(window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.