class CountryBlocker{load(e){let t=e.countries,o=e.type;if(!t||0===t.length)return;let n=t.map(e=>e.code);this.blockCountry(n,o,e)}blockCountry(e,t,o){fetch("/browsing_context_suggestions.json").then(e=>{if(!e.ok)throw Error("Network response was not ok. Check if Geolocation app is installed. "+e.status);return e.json()}).then(n=>{let l=n.detected_values;if(!l){console.log("I cannot detect a country.");return}let r=o.redirect_url,c="blacklist"===t,s=l.country.handle.toLowerCase(),i=e.includes(s);(c&&i||!c&&!i)&&(this.#a(),r&&URL.canParse(r)&&(r=r.replace(/\/$/,"")+"/",window.location.href!==r&&window.location.href!==r+"/"&&window.location.replace(r)))}).catch(e=>{console.log("I cannot detect a country."),console.error("Fetch error:",e.message)})}#a(){let e=document.createElement("div");e.id="security-overflow";let t="You cannot access our site from your current region.",o="grey",n="white";if(window.Shopify&&window.Shopify.SecurityKingCountryBlocker){let l=window.Shopify.SecurityKingCountryBlocker;l.blocker_message.length>0&&(t=l.blocker_message),l.background_color.length>0&&(o=l.background_color),l.text_color.length>0&&(n=l.text_color)}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor=o,e.style.zIndex="99999999",e.style.textAlign="center",e.style.display="flex",e.style.flexDirection="column",e.style.justifyContent="center";let r=document.createElement("h1");r.innerText="403",r.style.marginBottom="10px",r.style.color=n;let c=document.createElement("p");c.innerText=t,c.style.fontSize="1.5em",c.style.margin=0,c.style.color=n,e.appendChild(r),e.appendChild(c),document.body.innerHTML="",document.body.insertBefore(e,document.body.firstChild),document.body.style.overflow="hidden"}}window.addEventListener("DOMContentLoaded",()=>{let e=document.getElementById("country-block-app-data");if(!(e&&e.textContent.length>0)||window.contentBlockLoaded)return;window.contentBlockLoaded=!0;let t=JSON.parse(e.textContent);new CountryBlocker().load(t.countryBlocker)});