1(()=>{"use strict";const t=class{constructor(t){this.apiUrl=r9GeolocData.geolocationUrl,this.formToken=t,this.geolocationData=null,this.apiUrl,this.formToken,this.init()}async init(){try{const t=await fetch(this.apiUrl,{headers:{"X-CSRF":this.formToken}});if(t.status,!t.ok)return void this.dispatchErrorEvent(new Error(`Geolocation API responded with ${t.status}`));const o=await t.text();if(!o||!o.trim())return void this.dispatchErrorEvent(new Error("Geolocation API returned empty response"));this.geolocationData=JSON.parse(o),this.geolocationData,this.isIpEUGeoCompliant(this.geolocationData),this.dispatchSuccessEvent(this.geolocationData)}catch(t){this.dispatchErrorEvent(t)}}dispatchErrorEvent(t){document.dispatchEvent(new CustomEvent("r9.geolocation.error",{detail:{error:t}}))}dispatchSuccessEvent(t){document.dispatchEvent(new CustomEvent("r9.geolocation.success",{detail:{ipLocation:t,isEUGeoIpCompliant:this.isIpEUGeoCompliant(t)}}))}isIpEUGeoCompliant(t){return!!(t.cc&&r9GeolocData.euGeoIpCCL&&r9GeolocData.euGeoIpCCL.includes(t.cc.toLowerCase()))||this.isUsPrivacyRegionCompliant(t)}isUsPrivacyRegionCompliant(t){if(!t.cc||"us"!==t.cc.toLowerCase()||!r9GeolocData.usPrivacyRegions)return!1;const o=(t.regionName||"").toLowerCase();return r9GeolocData.usPrivacyRegions.split(",").some(t=>t.trim()===o)}},o=new class{constructor(t){this.formTokenUrl=t,this.formToken=null}async setup(){return await this.setupFormToken()}setupFormToken(){return fetch(this.formTokenUrl,{method:"POST",headers:{"Content-Type":"application/json"}}).then(t=>200!==t.status?(console.warn("[r9-geolocation] CSRF token request failed",t.status),Promise.reject(new Error(`CSRF token request failed with ${t.status}`))):t.json()).then(t=>(this.formToken=t,t)).catch(t=>(console.warn("[r9-geolocation] CSRF token error",t),Promise.reject(t)))}}(r9GeolocData.formTokenUrl);function e(){o.setup().then(o=>{new t(o)}).catch(()=>{console.warn("[r9-geolocation] CSRF token unavailable, dispatching error"),document.dispatchEvent(new CustomEvent("r9.geolocation.error",{detail:{error:"CSRF token unavailable"}}))})}document.addEventListener("r9.analytics.session.success",()=>{e()}),document.addEventListener("r9.analytics.session.error",()=>{e()})})(); 2//# sourceMappingURL=r9-geolocation.bundle.js.map
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.