(()=>{"use strict";var o={120:(e,t,o)=>{o.d(t,{Kd:()=>function(e,t,o,r){e&&e.style.setProperty(t,o,r)}});o=wp.i18n;o.__,o._x,o._n,o._nx}},r={};function a(e){var t=r[e];return void 0!==t||(t=r[e]={exports:{}},o[e](t,t.exports,a)),t.exports}a.d=(e,t)=>{for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var _;_=a(120),document.addEventListener("DOMContentLoaded",function(){var o,e=document.querySelector("#tutor-email-settings-form")||document.querySelector("#tutor-mailer-form");e&&(e.querySelectorAll("input").forEach(function(e){e.addEventListener("input",function(e){var e=e.target,t=e.name,o=e.value,e=document.querySelector(".template-preview iframe");if(e){var r=e.contentWindow.document,a=r.querySelector(".tutor-email-logo img"),l=r.querySelector(".tutor-email-header"),c=r.querySelector(".tutor-email-content"),n=r.querySelector(".tutor-email-footer"),i=r.querySelector(".tutor-email-footer-text"),u=r.querySelector(".tutor-email-heading"),d=r.querySelector(".tutor-email-buttons"),s=r.querySelector(".tutor-email-button"),m=r.querySelector(".tutor-email-button-bordered");switch(t){case"email_logo_position":(0,_.Kd)(a.parentElement,"text-align",o);break;case"email_logo_height":(0,_.Kd)(a,"height",o+"px");break;case"email_logo_alt_text":a.setAttribute("alt",o);break;case"email_template_button_position":(0,_.Kd)(d,"text-align",o);break;case"email_template_colors[header_background_color]":(0,_.Kd)(l,"background-color",o);break;case"email_template_colors[header_divider_color]":(0,_.Kd)(l,"border-color",o);break;case"email_template_colors[body_background_color]":(0,_.Kd)(c,"background-color",o),(0,_.Kd)(n,"background-color",o);break;case"email_template_colors[email_title_color]":(0,_.Kd)(u,"color",o);break;case"email_template_colors[email_text_color]":(0,_.Kd)(c,"color",o);break;case"email_template_colors[email_short_code_color]":r.querySelectorAll("strong").forEach(function(e){(0,_.Kd)(e,"color",o)});break;case"email_template_colors[footnote_color]":(0,_.Kd)(i,"color",o);break;case"email_template_colors[primary_button_color]":(0,_.Kd)(s,"--primary-button-color",o);break;case"email_template_colors[primary_button_hover_color]":(0,_.Kd)(s,"--primary-button-hover-color",o);break;case"email_template_colors[primary_button_text_color]":(0,_.Kd)(s,"color",o,"important");break;case"email_template_colors[secondary_button_color]":(0,_.Kd)(m,"--secondary-button-color",o);break;case"email_template_colors[secondary_button_hover_color]":(0,_.Kd)(m,"--secondary-button-hover-color",o);break;case"email_template_colors[secondary_button_text_color]":(0,_.Kd)(m,"color",o,"important")}}})}),null!=(e=document.querySelector(".tutor-thumbnail-uploader"))&&e.addEventListener("tutor_settings_media_selected",function(e){var t=document.querySelector(".template-preview iframe");t&&t.contentWindow.document.querySelector(".tutor-email-logo img").setAttribute("src",e.detail.attachment.url)}),o=document.querySelector(".tutor-email-colors"),document.querySelector(".tutor-color-restore-button").addEventListener("click",function(e){var t=JSON.parse(e.target.dataset.defaults);o.querySelectorAll("input[type=color]").forEach(function(e){e.value=t[e.dataset.picker],e.dispatchEvent(new Event("input"))})}),jQuery(document).on("input","input.email-logo-url",function(){var e=jQuery(this),t=e.val(),e=e.parent().parent().find(".thumbnail-preview img").eq(0);e&&e.attr("src",t)})),jQuery(".tutor-card-collapse-button").click(function(e){jQuery(this).find("i").hasClass("tutor-icon-angle-up")?jQuery(this).find("i").removeClass("tutor-icon-angle-up").addClass("tutor-icon-angle-down"):jQuery(this).find("i").removeClass("tutor-icon-angle-down").addClass("tutor-icon-angle-up"),jQuery(e.target.closest(".tutor-card")).find(".tutor-card-body").slideToggle()})})})();