(()=>{{const a=document.querySelectorAll(".archive-dropdown-toggle"),r=document.querySelectorAll(".region-toggle");function e(e){const r=e.target,i=r.getAttribute("aria-expanded");e.target.classList.contains("archive-dropdown-toggle")&&a.forEach((e=>{e.setAttribute("aria-expanded","false")})),"false"===i&&document.addEventListener("click",t),r.setAttribute("aria-expanded","false"===i?"true":"false"),r.style.setProperty("--sibling-list-width",r.nextElementSibling.clientWidth+"px")}function t(e){e.target.closest(".archive-dropdown")||a.forEach((e=>{e.setAttribute("aria-expanded","false")}))}a&&a.forEach((t=>{t.addEventListener("click",e)})),r&&r.forEach((t=>{t.addEventListener("click",e)}))}})();; (()=>{{let e=!1,t=!1;const n=()=>{new window.wk.content(window.wallkitPostData.data).checkAccess().then((e=>{e?.allowed&&o()})).catch((e=>{console.log("Wallkit access check error:",e)}))},o=()=>{const e=document.querySelector("#ch-wk-original-content"),t=document.querySelector(".entry-content"),n=document.querySelector(".article-sidebar-left");e&&(t.innerHTML=e.innerHTML),e&&n&&t.appendChild(n)},c=()=>{const e=document.querySelector(".nav-menu .wk–sign-in");e.classList.remove("wk–sign-in"),e.classList.remove("wk-call"),e.closest("li").classList.add("menu-item-my-account"),e.innerText="My Account"},s=()=>{fetch(window.CHWallkitSettings.restBase+"authenticate",{method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({email:window.wk.sdk.methods.user.email,token:window.wk.authentication.token.token,fbToken:window.wk.authentication.firebaseToken.token})}).then((e=>e.json())).then((n=>{n?.success&&(e&&(window.location.href=window.location.href+"#respond"),window.location.href.toString().includes("my-account")||t?window.location.reload():c())}))},i=e=>{e.preventDefault(),window.wk.events.subscribe("wk-event-logout",(()=>{window.location.href=e.target.href})),window.wk.sdk.methods.logout()},a=()=>{document.querySelectorAll("#autorenew-toggle").forEach((e=>{e.addEventListener("click",(e=>{e.target.dataset.subscriptionId&&window.wk.sdk.methods.changeUserSubscriptionAutorenewStatus(e.target.dataset.subscriptionId,e.target.checked)}))}))},r=()=>{const e=document.querySelector(".js-save-account-details");e&&e.addEventListener("click",(()=>{const e=document.querySelector("#account_first_name").value,t=document.querySelector("#account_last_name").value,n={};e&&(n.first_name=e),t&&(n.last_name=t),window.Wallkit.updateUser(n)}))},d=document.querySelector(".js-comment-login");d&&d.addEventListener("click",(()=>{e=!0})),document.querySelector(".comments-wrapper")&&(t=!0),document.addEventListener("ch-wk-ready",(()=>{document.querySelectorAll(".js-logout a").forEach((e=>{e.addEventListener("click",i)})),n(),a(),r(),window.wk.events.subscribe("success-auth",n),window.wk.events.subscribe("success-auth",s)}));let l=100,w=1;const u=()=>{if(!(w>20))if(void 0===window.wk?.events)setTimeout(u,l),l+=100,w++;else{const e=new Event("ch-wk-ready");document.dispatchEvent(e)}};u()}})();;