(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.apiFetch;var o=e.n(t);const n=async(e,t)=>{if(e&&!function(e){const t=`; ${document.cookie}`.split(`; ${e}=`);return 2===t.length?t.pop().split(";").shift():null}(`pbb_conversion_${t}`)&&location.search.includes("iframe=true")){const e=Number(sessionStorage.getItem("pbb_logs"));await o()({path:"/pbb/v1/popup/logs",method:"PUT",data:{id:e,converted:!0,refferer:window.parent.document.referrer}}).then(e=>{"success"===e.status?function(e,t,o){let n=`${e}=${t}; path=/`;if(o){const e=new Date;e.setTime(e.getTime()+60*o*60*1e3),n+=`; expires=${e.toUTCString()}`}document.cookie=n}(`pbb_conversion_${t}`,"true",8760):console.error("Error updating conversion count:",e.message)})}};var r;r="advanced-image",window.addEventListener("load",()=>{window[`__POPUPKIT_${r.toUpperCase()}_INIT`]||(window[`__POPUPKIT_${r.toUpperCase()}_INIT`]=!0,(()=>{const e=document.querySelectorAll(".popupkit-image");for(const t of e){const e=JSON.parse(t.getAttribute("data-settings")),{istrackConversion:o}=e||{};o&&t.addEventListener("click",()=>{const e=t.closest(".popup-builder-modal"),r=e?.id.replace("popup-builder-","");n(o,r)})}})())})})();