var PrintElements=function(){"use strict";var e=function(e){e.classList.contains("x-print-preserve-print")||e.classList.add("x-print-no-print")},t=function(e,t){e.classList.remove("x-print-no-print"),e.classList.add("x-print-preserve-print"),t||e.classList.add("x-print-preserve-ancestor")},r=function(e){e.classList.remove("x-print-no-print"),e.classList.remove("x-print-preserve-print"),e.classList.remove("x-print-preserve-ancestor")},n=function(e,t){for(var r=e.previousElementSibling;r;)t(r),r=r.previousElementSibling;for(r=e.nextElementSibling;r;)t(r),r=r.nextElementSibling},i=function(r,i){t(r,i),n(r,e)},o=function(e,t){r(e),n(e,r)},a=function(e,t){var r=e;for(t(r,!0),r=r.parentElement;r&&"BODY"!==r.nodeName;)t(r,!1),r=r.parentElement};return{print:function(e){for(var t=0;t<e.length;t++)a(e[t],i);window.print(),setTimeout(()=>{for(t=0;t<e.length;t++)a(e[t],o)},1e3)}}}();function xSocialShare(){if(document.querySelector("body > .brx-body.iframe"))return;let e=function(e){e.querySelectorAll(".brxe-xsocialshare").forEach(e=>{let t=window.screen.width/2-310,r=window.screen.height/2-350,n="width=600,height=600,scrollbars=yes,left="+t+",top="+r+",screenX="+t+",screenY="+r+",toolbar=no,menubar=no,location=no,directories=no",i=document.body,o=e.getAttribute("data-x-social"),a=o?JSON.parse(o):{},l=!1;null!=a.isLooping&&(l=!0);let s="true"===e.getAttribute("data-x-popup");s&&e.querySelectorAll(".x-social-share_link:not(.email):not(.print):not(.copy):not(.mastodon)").forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),window.open(e.getAttribute("href"),"popupWindow",n)})}),e.querySelectorAll(".x-social-share_link.mastodon").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault();let t=e.currentTarget.getAttribute("data-src"),r=prompt("Enter your Mastodon domain","");if(""==r||null==r)return;r.endsWith("/")&&(r=r.slice(0,-1)),r.startsWith("https://")&&(r=r.slice(8));let i="https://"+r+"/share?text="+t;s?window.open(i,"popupWindow",n):window.open(i,"_blank")})}),e.querySelectorAll(".x-social-share_link.copy").forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),null!=navigator.clipboard?navigator.clipboard.writeText(e.getAttribute("data-copy-url")).then(()=>{e.querySelector(".x-social-share_label")&&""!=e.dataset.copiedLabel&&(e.querySelector(".x-social-share_label").innerHTML=e.dataset.copiedLabel)},()=>{console.log("BricksExtras: Copy to clipboard failed. This feature is available only in with HTTPS")}):console.log("BricksExtras: Copy to clipboard failed. This feature is available only in with HTTPS")})}),e.querySelectorAll(".x-social-share_link.print").forEach(t=>{t.getAttribute("data-x-hide-print")&&e.setAttribute("data-x-hide-print","true"),t.getAttribute("data-print-exact")&&(document.documentElement.style.setProperty("print-color-adjust","exact"),document.documentElement.style.setProperty("-webkit-print-color-adjust","exact")),t.addEventListener("click",e=>{e.preventDefault();let r=t.getAttribute("data-print-selector");r&&(i=document.querySelector(r),l&&(i=t.closest(r))),PrintElements.print([i])})})})};e(document),xExtrasRegisterAJAXHandler("doExtrasSocialShare"),window.doExtrasSocialShare=e}document.addEventListener("DOMContentLoaded",function(e){bricksIsFrontend&&xSocialShare()});