(()=>{var e={89:()=>{!function(){if(!wpconsent.geolocation.enabled)return;if("undefined"!=typeof wpconsentPreferences)return;const e=document.getElementById("wpconsent-container");e.style.display="none";const t=wpconsent.geolocation.api_url;fetch(t).then((e=>e.json())).then((t=>{if(t.show_banner)e.style.display="block";else{const e={essential:!0,statistics:!0,marketing:!0};WPConsent.setCookie("wpconsent_preferences",JSON.stringify(e),0),WPConsent.unlockScripts(e)}})).catch((t=>{e.classList.add("wpconsent-banner-visible")}))}()},308:()=>{document.addEventListener("DOMContentLoaded",(function(){WPConsent.shadowRoot.querySelectorAll(".wpconsent-language-picker").forEach((e=>{const t=e.querySelector(".wpconsent-language-switch-button"),n=e.querySelectorAll(".wpconsent-language-item");t.addEventListener("click",(t=>{t.stopPropagation(),e.classList.toggle("active")})),n.forEach((t=>{t.addEventListener("click",(async o=>{o.preventDefault();const s=t.getAttribute("data-language");await async function(e,t=null){try{const n=await fetch(`/wp-json/wpconsent/v1/language/${e}`),o=await n.json();if(o){const n={".wpconsent-banner-message":"banner_message",".wpconsent-accept-all":"accept_button_text",".wpconsent-cancel-all":"cancel_button_text",".wpconsent-preferences-all":"preferences_button_text","#wpconsent-preferences-title":"preferences_panel_title",".wpconsent_preferences_panel_description p":"preferences_panel_description",".wpconsent-cookie-policy-title":"cookie_policy_title",".wpconsent-cookie-policy-text":"cookie_policy_text",".wpconsent-save-preferences":"save_preferences_button_text",".wpconsent-close-preferences":"close_button_text"};Object.entries(o.categories).forEach((([e,t])=>{o[e+"_name"]=t.name,o[e+"_description"]=t.description,n[`.wpconsent-cookie-category-${e} .wpconsent-cookie-category-text label`]=e+"_name",n[`.wpconsent-cookie-category-${e} .wpconsent-preferences-accordion-content > p`]=e+"_description"})),Object.entries(n).forEach((([e,t])=>{WPConsent.shadowRoot.querySelectorAll(e).forEach((e=>{e&&o[t]&&(e.innerHTML=o[t])}))})),t&&t.forEach((t=>{t.getAttribute("data-language")===e?t.classList.add("active"):t.classList.remove("active")}))}return!0}catch(e){return console.error("Error fetching translations:",e),!1}}(s,n),e.classList.remove("active")}))})),document.addEventListener("click",(t=>{e.contains(t.target)||e.classList.remove("active")}))}))}))},981:()=>{window.addEventListener("wpconsent_consent_saved",(function(e){if(!wpconsent.records_of_consent||"0"===wpconsent.records_of_consent)return;const t=wpconsent.api_url+"/log-consent",n=wpconsent.nonce,o={"Content-Type":"application/json"};n&&(o["X-WP-Nonce"]=n),fetch(t,{method:"POST",headers:o,body:JSON.stringify({consent_data:JSON.stringify(e.detail)}),credentials:"same-origin",keepalive:!0}).then((function(e){if(!e.ok)throw new Error("Network response was not ok");return e.json()})).catch((function(e){console.error("Error logging consent:",e)}))}))},799:()=>{window.WPConsent={acceptAll:function(){this.savePreferences({essential:!0,statistics:!0,marketing:!0}),this.closePreferences()},savePreferences:function(e){const t=this.getCookie("wpconsent_preferences");let n=!1;(t&&JSON.stringify(t)!==JSON.stringify(e)||wpconsent.default_allow&&(!e.essential||!e.statistics||!e.marketing))&&(this.clearCookies(),n=!0),this.setCookie("wpconsent_preferences",JSON.stringify(e),wpconsent.consent_duration),this.hideBanner(),this.closePreferences(),this.unlockScripts(e),this.unlockIframes(e);const o=this.shadowRoot?.querySelector("#wpconsent-consent-floating");o&&(o.style.display="block"),this.updateWordPressConsent(e),window.dispatchEvent(new CustomEvent("wpconsent_consent_saved",{detail:e})),t&&window.dispatchEvent(new CustomEvent("wpconsent_consent_updated",{detail:e})),n&&(Object.defineProperty(document,"cookie",{get:function(){return""},set:function(e){}}),window.location.reload())},showPreferences:function(){const e=this.shadowRoot?.querySelector("#wpconsent-preferences-modal");if(e){e.style.display="flex",this.setupFocusTrap(e);const t=this.shadowRoot?.querySelector("#wpconsent-preferences-title");t&&setTimeout((()=>{t.focus({preventScroll:!0}),this.lastFocusedElement=t}),100);const n=this.getCookie("wpconsent_preferences");if(n)try{const e=JSON.parse(n);this.shadowRoot.querySelectorAll('#wpconsent-preferences-modal input[type="checkbox"]').forEach((t=>{const n=t.value;n in e&&(t.checked=e[n])}))}catch(e){console.error("Error parsing WPConsent preferences:",e)}}},closePreferences:function(){const e=this.shadowRoot?.querySelector("#wpconsent-preferences-modal");e&&(e.style.display="none",this.removeFocusTrap(),this.previouslyFocusedElement&&(this.previouslyFocusedElement.focus({preventScroll:!0}),this.previouslyFocusedElement=null))},showBanner:function(){const e=this.shadowRoot?.querySelector("#wpconsent-banner-holder");e&&(e.classList.add("wpconsent-banner-visible"),this.setupFocusTrap(e))},hideBanner:function(){const e=this.shadowRoot?.querySelector("#wpconsent-banner-holder");e&&(e.classList.remove("wpconsent-banner-visible"),this.removeFocusTrap(),this.previouslyFocusedElement&&(this.previouslyFocusedElement.focus({preventScroll:!0}),this.previouslyFocusedElement=null))},setCookie:function(e,t,n){let o="";if(n>0){const e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),o="expires="+e.toUTCString()+";"}document.cookie=e+"="+t+";"+o+"path=/"},getCookie:function(e){const t=`; ${document.cookie}`.split(`; ${e}=`);if(2===t.length)return t.pop().split(";").shift()},hasConsent:function(e){const t=this.getCookie("wpconsent_preferences");if(!t)return!1;try{const n=JSON.parse(t);return"essential"===e||!0===n[e]}catch(e){return console.error("Error parsing WPConsent preferences:",e),!1}},unlockScripts:function(e){document.querySelectorAll('script[type="text/plain"]').forEach((t=>{const n=t.getAttribute("data-wpconsent-category");if(e[n]){const e=document.createElement("script");t.getAttributeNames().forEach((n=>{"type"!==n&&e.setAttribute(n,t.getAttribute(n))}));const n=t.getAttribute("data-wpconsent-src");n?e.src=n:e.text=t.text,t.parentNode.replaceChild(e,t)}})),document.dispatchEvent(new CustomEvent("wpconsent_consent_processed",{detail:e}))},unlockIframes:function(e){document.querySelectorAll("iframe[data-wpconsent-src]").forEach((t=>{const n=t.getAttribute("data-wpconsent-category");if(e[n]){const e=t.getAttribute("data-wpconsent-src");e&&(t.src=e),t.removeAttribute("data-wpconsent-src"),t.removeAttribute("data-wpconsent-name"),t.removeAttribute("data-wpconsent-category")}})),document.querySelectorAll(".wpconsent-iframe-placeholder").forEach((t=>{const n=t.getAttribute("data-wpconsent-category");if(e[n]){const e=t.querySelector(".wpconsent-iframe-thumbnail"),n=t.querySelector(".wpconsent-iframe-overlay-content");e&&e.remove(),n&&n.remove(),t.classList.remove("wpconsent-iframe-placeholder")}}))},init:function(){this.initWordPress();const e=document.getElementById("wpconsent-container"),t=document.getElementById("wpconsent-template");if(this.shadowRoot=e.shadowRoot,!this.shadowRoot){this.shadowRoot=e.attachShadow({mode:"open"});const n=t.content.cloneNode(!0);this.shadowRoot.appendChild(n),t.remove(),this.loadExternalCSS(e),this.initializeEventListeners(),this.initializeAccordions(),this.initializeKeyboardHandlers()}const n=this.getCookie("wpconsent_preferences");if(n){let e={};try{e=JSON.parse(n),this.unlockScripts(e),this.unlockIframes(e)}catch(e){console.error("Error parsing WPConsent preferences:",e)}const t=this.shadowRoot.querySelector("#wpconsent-consent-floating");t&&(t.style.display="block")}else this.showBanner(),wpconsent.default_allow&&(this.unlockScripts({essential:!0,statistics:!0,marketing:!0}),this.unlockIframes({essential:!0,statistics:!0,marketing:!0}))},loadExternalCSS:async function(e){try{const t=`${wpconsent.css_url}?ver=${wpconsent.css_version}`,n=await fetch(t),o=await n.text(),s=document.createElement("style");s.textContent=o,this.shadowRoot.appendChild(s),e.style.display="block"}catch(e){console.error("Failed to load WPConsent styles:",e)}},initializeEventListeners:function(){this.shadowRoot.querySelectorAll(".wpconsent-accept-all").forEach((e=>e.addEventListener("click",(()=>this.acceptAll())))),this.shadowRoot.querySelector("#wpconsent-cancel-all")?.addEventListener("click",(()=>{this.savePreferences({essential:!0,statistics:!1,marketing:!1})})),this.shadowRoot.querySelector("#wpconsent-banner-close")?.addEventListener("click",(()=>this.hideBanner())),this.shadowRoot.querySelector("#wpconsent-preferences-all")?.addEventListener("click",(()=>this.showPreferences()));const e=this.shadowRoot.querySelector("#wpconsent-consent-floating");e&&e.addEventListener("click",(()=>this.showPreferences())),document.addEventListener("click",(e=>{const t=e.target.closest(".wpconsent-iframe-accept-button");if(t){const e=t.getAttribute("data-category");if(e){let t={};try{t=JSON.parse(this.getCookie("wpconsent_preferences")||"{}")}catch(e){console.error("Failed to parse wpconsent_preferences cookie:",e)}const n={...t,essential:!0,[e]:!0};this.savePreferences(n)}}})),this.shadowRoot.querySelector(".wpconsent-preferences-header-close")?.addEventListener("click",(()=>this.closePreferences())),this.shadowRoot.querySelector(".wpconsent-save-preferences")?.addEventListener("click",(()=>{const e=this.shadowRoot.querySelectorAll('#wpconsent-preferences-modal input[type="checkbox"]'),t=Array.from(e).filter((e=>e.checked)).map((e=>e.value));this.savePreferences({essential:!0,statistics:t.includes("statistics"),marketing:t.includes("marketing")})})),this.shadowRoot.querySelector(".wpconsent-close-preferences")?.addEventListener("click",(()=>this.closePreferences())),window.addEventListener("wpconsent_consent_saved",(function(e){if("function"!=typeof gtag)return;const t=e.detail;gtag("consent","update",{ad_storage:t.marketing?"granted":"denied",analytics_storage:t.statistics?"granted":"denied",ad_user_data:t.marketing?"granted":"denied",ad_personalization:t.marketing?"granted":"denied",security_storage:"granted",functionality_storage:"granted"})}))},initializeAccordions(){const e=this.shadowRoot.querySelectorAll(".wpconsent-preferences-accordion-item");e.forEach((t=>{const n=t.querySelector(".wpconsent-preferences-accordion-header"),o=t.querySelector(".wpconsent-preferences-accordion-content");n&&o&&n.addEventListener("click",(n=>{if(n.target.closest(".wpconsent-preferences-checkbox-toggle"))return;const s=t.classList.contains("active");e.forEach((e=>{if(e!==t){e.classList.remove("active");const t=e.querySelector(".wpconsent-preferences-accordion-content");t&&(t.style.maxHeight=null)}})),t.classList.toggle("active"),o.style.maxHeight=s?null:o.scrollHeight+"px"}))}))},initializeKeyboardHandlers:function(){document.addEventListener("keydown",(e=>{"Tab"===e.key?this.handleTabKey(e):"Escape"===e.key&&this.handleEscapeKey(e)}))},handleEscapeKey:function(e){const t=this.shadowRoot?.querySelector("#wpconsent-preferences-modal"),n=this.shadowRoot?.querySelector("#wpconsent-banner-holder");t&&"flex"===t.style.display?this.closePreferences():n&&n.classList.contains("wpconsent-banner-visible")&&this.hideBanner()},handleTabKey:function(e){const t=this.shadowRoot?.querySelector("#wpconsent-banner-holder"),n=this.shadowRoot?.querySelector("#wpconsent-preferences-modal"),o=t&&t.classList.contains("wpconsent-banner-visible"),s=n&&"flex"===n.style.display;if(!o&&!s)return;const c=s?n:t,r=this.getFocusableElements(c);if(0===r.length)return;e.preventDefault();const i=r[0],a=r[r.length-1];let l;this.lastFocusedElement&&r.includes(this.lastFocusedElement)?l=this.lastFocusedElement:(l=i,this.lastFocusedElement=l);const d=r.indexOf(l);let p;p=e.shiftKey?d<=0?a:r[d-1]:d>=r.length-1?i:r[d+1],p.focus({preventScroll:!0}),this.lastFocusedElement=p},setupFocusTrap:function(e){this.previouslyFocusedElement=document.activeElement,this.lastFocusedElement=null},removeFocusTrap:function(){this.lastFocusedElement=null},setInitialFocus:function(e){const t=this.getFocusableElements(e);t.length>0&&setTimeout((()=>{t[0].focus({preventScroll:!0}),this.lastFocusedElement=t[0]}),100)},getFocusableElements:function(e){return Array.from(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter((t=>{let n=t;for(;n&&n!==e;){const e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility||"0"===e.opacity||n.disabled||"true"===n.getAttribute("aria-hidden"))return!1;n=n.parentElement}return!0}))},isElementInContainer:function(e,t){return!(!e||!t)&&(t.shadowRoot?t.shadowRoot.contains(e):t.contains(e))},clearCookies:function(){for(var e=document.cookie.split("; "),t=0;t0;){var o=encodeURIComponent(e[t].split(";")[0].split("=")[0])+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain="+n.join(".")+" ;path=",s=location.pathname.split("/");for(document.cookie=o+"/";s.length>0;)document.cookie=o+s.join("/"),s.pop();n.shift()}},initWordPress:function(){window.wp_consent_type=wpconsent.consent_type;let e=new CustomEvent("wp_consent_type_defined");document.dispatchEvent(e)},updateWordPressConsent:function(e){"function"==typeof wp_set_consent&&(wp_set_consent("functional","allow"),wp_set_consent("preferences","allow"),wp_set_consent("statistics",e.statistics?"allow":"deny"),wp_set_consent("statistics-anonymous",e.statistics?"allow":"deny"),wp_set_consent("marketing",e.marketing?"allow":"deny"))}},document.addEventListener("DOMContentLoaded",(()=>WPConsent.init()))}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var c=t[o]={exports:{}};return e[o](c,c.exports,n),c.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(799),n(981),n(89),n(308)})()})();