(()=>{var e={1669:e=>{"use strict";e.exports=jQuery},4975:()=>{const e=document.getElementById("edd-emails__add"),t=document.querySelector(".edd-emails__add-new__overlay");e&&(e.addEventListener("click",(e=>{e.preventDefault(),"none"===t.style.display?t.removeAttribute("style"):t.style.display="none"})),document.addEventListener("click",(a=>{e!==a.target&&"none"!==t.style.display&&"none"!==t.style.display&&setTimeout((function(){a.target.closest(".edd-emails__add-new")||a.target.closest(".edd-emails__add-new__overlay")||(t.style.display="none")}),100)})));const a=document.querySelectorAll("button.edd-emails__add-new");a&&a.forEach((e=>{e.addEventListener("click",(a=>{a.preventDefault(),e.classList.contains("edd-promo-notice__trigger")?setTimeout((function(){t.style.display="none"}),5e3):window.location.href=EDDAdminEmails.link+"&email="+e.getAttribute("data-value")}))}))},9971:()=>{const e=document.getElementById("edd-email-status-filter"),t=document.getElementById("edd-email-recipient-filter"),a=document.getElementById("edd-email-sender-filter"),n=document.getElementById("edd-email-context-filter"),d=document.getElementById("edd-email-clear-filters"),s=document.getElementById("no-items");function i(i){const o=document.querySelectorAll("table.email_templates tbody tr:not(#no-items)");if(!o||!(e||t||a))return;const r=e?e.value:"",c=t?t.value:"",u=a?a.value:"",m=n?n.value:"";d.style.display="none",(r||c||u||m)&&(d.style.display="inline-block"),o.forEach((e=>{e.style="",e.classList.remove("edd-hidden","alternate"),r&&r!==e.getAttribute("data-status")&&l(e),c&&c!==e.getAttribute("data-recipient")&&l(e),u&&u!==e.getAttribute("data-sender")&&l(e),m&&m!==e.getAttribute("data-context")&&l(e)}));let y=document.querySelectorAll('[data-type="item"]:not(.edd-hidden)');y.forEach(((e,t)=>{t%2==0&&e.classList.add("alternate")})),0===y.length?s.style="table-row":s.style.display="none"}function l(e){e.style.display="none",e.classList.add("edd-hidden")}e&&e.addEventListener("change",i),t&&t.addEventListener("change",i),a&&a.addEventListener("change",i),n&&n.addEventListener("change",i),d&&d.addEventListener("click",(d=>{d.preventDefault(),e&&(e.value=""),t&&(t.value=""),a&&(a.value=""),n&&(n.value=""),i()}))}},t={};function a(n){var d=t[n];if(void 0!==d)return d.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,a),s.exports}(()=>{"use strict";function e(e,t){if(!e)return;const a=e.jquery?e[0]:e;a&&"disabled"in a&&(a.disabled=t)}function t(e){const t=new URLSearchParams;return Object.keys(e).forEach((function(a){const n=e[a];null!=n&&t.append(a,String(n))})),t}a(9971),a(4975),a(1669)(document).ready((function(a){a(".edd-email-manager__action").on("click",(function(n){n.preventDefault();const d=a(this),s=d.attr("data-action");let i="",l="",o="",r="";if(d.attr("disabled"))return;switch(s){case"enable":l="edd-button-toggle--active",o="disable",r="inactive";break;case"disable":i="edd-button-toggle--active",o="enable",r="active";break;default:return}const c={action:"edd_update_email_status",nonce:EDDAdminEmails.nonce,email_id:d.attr("data-id"),status:d.attr("data-status"),button:s},u={hadActiveClass:d.hasClass("edd-button-toggle--active"),action:d.attr("data-action"),status:d.attr("data-status")};!async function(a){const{url:n,data:d,$busy:s,applyOptimistic:i,revert:l,onResponse:o,debug:r}=a;e(s,!0);try{i&&i();const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},credentials:"same-origin",body:t(d)});if(!e.ok)throw new Error("Network response was not ok");const a=await e.json();return r&&console.log(a),a&&a.success||l&&l(),o&&o(a),a}catch{l&&l()}finally{e(s,!1)}}({url:EDDAdminEmails.ajaxurl,data:c,$busy:d,applyOptimistic(){d.removeClass(i).addClass(l),d.attr("data-action",o),d.attr("data-status",r)},revert:function(){d.toggleClass("edd-button-toggle--active",u.hadActiveClass),d.attr("data-action",u.action),d.attr("data-status",u.status)},debug:EDDAdminEmails.debug})}))}))})()})();