import{M as k}from"./assets/modal-CuTXJcYB.js";import{g as C,s as U}from"./assets/getCookie-CrwTE5-D.js";import{H as N}from"./assets/http-client-D4foVYuJ.js";import{U as u,A as P,b as S,c as T,C as A,P as R,F as q,W as B,G as H,d as F,e as _,f as V,h as c,V as D}from"./assets/constants-TsWXPT9T.js";import{r as j,a as z,s as Y}from"./assets/affiliate-9KeZEInw.js";class x{constructor(){this.init()}init(){this.initializeElements(),this.bindEvents()}initializeElements(){this.sidebarHeader=document.getElementById("c-sidebar_header"),this.headerElements=document.querySelectorAll(".js-header"),this.headerDropdowns=document.querySelectorAll(".js-header-dropdown"),this.headerMobileDropdowns=document.querySelectorAll(".js-header-dropdown-mobile"),this.langButtons=document.querySelectorAll(".js-header-locale-button"),this.langDropdowns=document.querySelectorAll(".js-header-lang-dropdown"),this.searchMenuItemWrapper=document.querySelector(".search-menu-item-wrapper"),this.menu=document.querySelector(".menu"),this.burgerTrigger=document.getElementById("js-burger-trigger"),this.headerNavMobile=document.querySelector(".js-header-nav-mobile"),this.headerMobileItems=document.querySelectorAll(".js-header-mobile")}bindEvents(){var e;document.body.addEventListener("click",this.onBodyClick.bind(this)),window.addEventListener("resize",this.onResize.bind(this)),(e=this.burgerTrigger)==null||e.addEventListener("click",this.onBurgerClick.bind(this)),this.langDropdowns.forEach(s=>s.previousElementSibling.addEventListener("click",this.onLocaleButtonClick.bind(this))),this.headerElements.forEach(s=>s.querySelector("p").addEventListener("click",this.onHeaderClick.bind(this,s))),this.headerMobileItems.forEach(s=>s.addEventListener("click",this.onHeaderMobileClick.bind(this,s)))}closeHeaderElements(){this.langDropdowns.forEach(e=>e.classList.add("hidden")),this.langButtons.forEach(e=>e.classList.remove("active")),this.headerElements.forEach(e=>e.classList.remove("active")),this.headerDropdowns.forEach(e=>e.classList.remove("active"))}onBodyClick(e){var s;this.closeHeaderElements(),this.searchMenuItemWrapper&&(this.searchMenuItemWrapper.classList.remove("search-menu-item--open"),this.searchMenuItemWrapper.style.visibility="hidden"),document.body.classList.remove("stop-scroll"),(s=this.menu)==null||s.classList.remove("menu-mobile-with-search")}onResize(){var e,s;this.closeHeaderElements(),(e=this.burgerTrigger)==null||e.classList.remove("on"),(s=this.headerNavMobile)==null||s.classList.remove("active")}onLocaleButtonClick(e){e.stopPropagation(),this.langDropdowns.forEach(s=>s.classList.toggle("hidden")),this.langButtons.forEach(s=>s.classList.toggle("active")),this.headerElements.forEach(s=>s.classList.remove("active")),this.headerDropdowns.forEach(s=>s.classList.remove("active"))}onBurgerClick(e){var s,o;e.preventDefault(),(s=this.burgerTrigger)==null||s.classList.toggle("on"),(o=this.headerNavMobile)==null||o.classList.toggle("active")}onHeaderClick(e,s){var a;s.stopPropagation();const o=e.classList.contains("active");this.headerElements.forEach(n=>n.classList.remove("active")),this.headerDropdowns.forEach(n=>n.classList.remove("active")),this.langDropdowns.forEach(n=>n.classList.add("hidden")),this.langButtons.forEach(n=>n.classList.remove("active")),o||(e.classList.add("active"),(a=e.querySelector(".js-header-dropdown"))==null||a.classList.add("active"))}onHeaderMobileClick(e,s){var a;s.stopPropagation();const o=e.classList.contains("active");this.headerMobileItems.forEach(n=>n.classList.remove("active")),this.headerMobileDropdowns.forEach(n=>n.classList.remove("active")),this.langDropdowns.forEach(n=>n.classList.add("hidden")),this.langButtons.forEach(n=>n.classList.remove("active")),o||(e.classList.add("active"),(a=e.querySelector(".js-header-dropdown-mobile"))==null||a.classList.add("active"))}}document.addEventListener("DOMContentLoaded",()=>{new x});const y="show_free_locations_modal";document.addEventListener("DOMContentLoaded",function(){let e=C(y)==="true";if(!e){const s=document.querySelector("body"),o=new k({selectorClass:"free-locations-modal",isCloseButton:!1});s.addEventListener("mouseleave",function(){e||(e=!0,U({name:y,value:"true",days:365*2,domain:SiteConfig.cookieDomain}),window.matchMedia("(min-width: 992px)").matches&&o.openModal())})}});function l(t){try{const e=localStorage.getItem(t);return e===null?null:JSON.parse(e)}catch{return null}}function m(t,e){try{const s=JSON.stringify(e);return localStorage.setItem(t,s),!0}catch{return!1}}function G(t,e){const{viewedServicePopupData:s,userType:o,countryCode:a}=e;return t.filter(n=>{const i={expiration:n.expired_at>A,country:n.country===a||n.country===T,displayType:!(n.display_type===S.ONCE&&n.isShown),notViewed:!s.includes(n.id),userType:u.NUM[n.type]===P.ALL||u.NUM[n.type]===o};return i.expiration&&i.country&&i.displayType&&i.notViewed&&i.userType})}function W(t,e){return t.sort((s,o)=>{const a=(n,i,p)=>n===p&&i!==p?-1:i===p&&n!==p?1:0;return e===u.PREMIUM?a(s.type,o.type,2):e===u.PUBLIC?a(s.type,o.type,1):a(s.type,o.type,0)}),t.sort((s,o)=>s.display_type!==o.display_type?o.display_type-s.display_type:0),t.sort((s,o)=>s.platform!==o.platform?s.platform===R.SITE?-1:1:0),t.sort((s,o)=>s.popup_type!==o.popup_type?o.popup_type-s.popup_type:0),t}function K(t){const e=new Intl.Locale(document.documentElement.lang||q).language;for(const s of t){const o=s.translate[e]||s.translate.en||s.translate[T];if(o!=null&&o.title&&(o!=null&&o.description))return{...s,translate:o}}return!1}const $="/wp-content/themes/planetvpn/assets/images/icons/status_apps_alert.svg",X="/wp-content/themes/planetvpn/assets/images/icons/status_apps_close.svg",w=".status-app-modal__blur-overlay",O=".status-app-btn",J=".status-app-modal__close-icon",Z=".status-app-modal__button",Q="custom-modal",ee="iframe#launcher",te="https://s3.amazonaws.com/cdn.freevpnplanet.com/frontend/popups/v2/site.json",I="Status Apps",se="Got it";let h=I,f=F;const r=l(c)||[],M=l(D)||[];document.addEventListener("DOMContentLoaded",()=>{oe(),setTimeout(ne,B)});const oe=async()=>{const t=l(_);if(t&&!(Date.now()-t.timestamp>=H)){f=t.data.country_code;return}try{const e=await N.getGeoLocation();f=e.country_code,ue(_,e)}catch(e){console.error("Error fetching geo location:",e)}},ne=()=>{var t;r!=null&&r.length?A>((t=r[0])==null?void 0:t.popupUpdate)?g():r!=null&&r.length&&v(r):g()},g=async()=>{try{const e=await(await fetch(te)).json();e!=null&&e.length?v(e):b()}catch(t){console.error("Error fetching service data:",t)}},v=t=>{const e=C("userAccess")||u.PUBLIC;let o=G(t,{viewedServicePopupData:M,userType:e,countryCode:f});if(o.length){o=W(o,e),ae(o);const a=K(o);ie(a)}else b()},ae=t=>{const e=t.map(s=>({...s,popupUpdate:V}));e.length&&m(c,e)},ie=t=>{t&&(re(t),ce(),L("addClass"),setTimeout(()=>{d("show")},100))},re=t=>{const e=document.querySelector(".status-app-modal__content");if(!e)return;const s=`