"use strict";var WPMailSMTP=window.WPMailSMTP||{};WPMailSMTP.Admin=WPMailSMTP.Admin||{},WPMailSMTP.Admin.Settings=WPMailSMTP.Admin.Settings||function(a,m,p){var n={pluginSettingsChanged:!1,init:function(){p(n.ready)},ready:function(){n.pageHolder=p(".wp-mail-smtp-tab-settings"),n.settingsForm=p(".wp-mail-smtp-connection-settings-form"),p("#screen-meta-links, #screen-meta").prependTo("#wp-mail-smtp-header-temp").show(),n.bindActions(),n.setJQueryConfirmDefaults(),n.initFlyoutMenu()},bindActions:function(){p(".wp-mail-smtp-mailer-image",n.settingsForm).on("click",function(){p(this).parents(".wp-mail-smtp-mailer").find("input").trigger("click")}),p(".wp-mail-smtp-mailer input",n.settingsForm).on("click",function(){var t=p(this);if(t.prop("disabled"))return t.hasClass("educate")&&n.education.upgradeMailer(t),!1;p(".wp-mail-smtp-mailer",n.settingsForm).removeClass("active"),p(this).parents(".wp-mail-smtp-mailer").addClass("active"),p(".wp-mail-smtp-mailer-option",n.settingsForm).addClass("hidden").removeClass("active"),p(".wp-mail-smtp-mailer-option-"+p(this).val(),n.settingsForm).addClass("active").removeClass("hidden")}),n.mailers.smtp.bindActions(),p("#wp-mail-smtp-pro-banner-dismiss",n.pageHolder).on("click",function(){p.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",task:"pro_banner_dismiss",nonce:wp_mail_smtp.nonce}}).always(function(){p("#wp-mail-smtp-pro-banner",n.pageHolder).fadeOut("fast")})}),p(".js-wp-mail-smtp-mailer-notice-dismiss",n.settingsForm).on("click",function(t){t.preventDefault();var e=p(this),i=e.parents(".inline-notice");if(e.hasClass("disabled"))return!1;p.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",nonce:wp_mail_smtp.nonce,task:"notice_dismiss",notice:i.data("notice"),mailer:i.data("mailer")},beforeSend:function(){e.addClass("disabled")}}).always(function(){i.fadeOut("fast",function(){e.removeClass("disabled")})})}),p("#wp-mail-smtp-debug .error-log-toggle").on("click",function(t){t.preventDefault(),p("#wp-mail-smtp-debug .error-log").slideToggle()}),p("#wp-mail-smtp-debug .error-log-copy").on("click",function(t){t.preventDefault();var e=p(this),i=p("#wp-mail-smtp-debug .error-log");i.is(":visible")||i.addClass("error-log-selection");t=a.createRange();t.selectNode(i[0]),m.getSelection().removeAllRanges(),m.getSelection().addRange(t),a.execCommand("Copy"),m.getSelection().removeAllRanges(),i.removeClass("error-log-selection"),e.addClass("error-log-copy-copied"),setTimeout(function(){e.removeClass("error-log-copy-copied")},1500)}),p(".js-wp-mail-smtp-provider-remove",n.settingsForm).on("click",function(){return confirm(wp_mail_smtp.text_provider_remove)}),p(".wp-mail-smtp-setting-copy",n.settingsForm).on("click",function(t){t.preventDefault(),p("#"+p(this).data("source_id")).get(0).select(),a.execCommand("Copy");var e=p(this).find(".dashicons");e.removeClass("dashicons-admin-page").addClass("wp-mail-smtp-dashicons-yes-alt-green wp-mail-smtp-success wp-mail-smtp-animate"),setTimeout(function(){e.removeClass("wp-mail-smtp-dashicons-yes-alt-green wp-mail-smtp-success wp-mail-smtp-animate").addClass("dashicons-admin-page")},1e3)}),p("#wp-mail-smtp-notice-bar").on("click",".dismiss",function(){var t=p(this).closest("#wp-mail-smtp-notice-bar");t.addClass("out"),setTimeout(function(){t.remove()},300),p.post(ajaxurl,{action:"wp_mail_smtp_notice_bar_dismiss",nonce:wp_mail_smtp.nonce})}),n.triggerExitNotice(),n.beforeSaveChecks(),p(".js-wp-mail-smtp-setting-mailer-radio-input",n.settingsForm).on("change",this.processMailerSettingsOnChange),p(".wp-mail-smtp-tab-tools-test #email-test-form").on("submit",function(){var t=p(this).find(".wp-mail-smtp-btn");t.attr("disabled",!0),t.find("span").hide(),t.find(".wp-mail-smtp-loading").show()}),p(".email_test_tab_removal_notice").on("click",".notice-dismiss",function(){var t=p(this);p.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",nonce:wp_mail_smtp.nonce,task:"email_test_tab_removal_notice_dismiss"},beforeSend:function(){t.prop("disabled",!0)}})}),p("#wp-mail-smtp-setting-gmail-one_click_setup_enabled-lite").on("click",function(t){t.preventDefault(),n.education.gmailOneClickSetupUpgrade()})},education:{upgradeMailer:function(t){var e=t.data("title").trim();n.education.upgradeModal(wp_mail_smtp.education.upgrade_title.replace(/%name%/g,e),wp_mail_smtp.education.upgrade_content.replace(/%name%/g,e),t.val())},gmailOneClickSetupUpgrade:function(){n.education.upgradeModal(wp_mail_smtp.education.gmail.one_click_setup_upgrade_title,wp_mail_smtp.education.gmail.one_click_setup_upgrade_content,"gmail-one-click-setup")},upgradeModal:function(t,e,i){p.alert({backgroundDismiss:!0,escapeKey:!0,animationBounce:1,type:"blue",closeIcon:!0,title:t,icon:'">'+wp_mail_smtp.education.upgrade_icon_lock+''+wp_mail_smtp.education.upgrade_bonus+wp_mail_smtp.education.upgrade_doc+""),this.$body.addClass("wp-mail-smtp-upgrade-mailer-education-modal")},buttons:{confirm:{text:wp_mail_smtp.education.upgrade_button,btnClass:"btn-confirm",keys:["enter"],action:function(){var t=/(\?)/.test(wp_mail_smtp.education.upgrade_url)?"&":"?",t=wp_mail_smtp.education.upgrade_url+t+"utm_content="+encodeURIComponent(i);m.open(t,"_blank")}}}})}},mailers:{smtp:{bindActions:function(){p("#wp-mail-smtp-setting-smtp-auth").on("change",function(){p("#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass").toggleClass("inactive")}),p("#wp-mail-smtp-setting-row-smtp-encryption input").on("change",function(){var t=p(this),e=p("#wp-mail-smtp-setting-smtp-port",n.settingsForm);"tls"===t.val()?(e.val("587"),p("#wp-mail-smtp-setting-row-smtp-autotls").addClass("inactive")):("ssl"===t.val()?e.val("465"):e.val("25"),p("#wp-mail-smtp-setting-row-smtp-autotls").removeClass("inactive"))})}}},triggerExitNotice:function(){var t=p(".wp-mail-smtp-page-general");p(m).on("beforeunload",function(){if(n.pluginSettingsChanged)return wp_mail_smtp.text_settings_not_saved}),p(":input:not( #wp-mail-smtp-setting-license-key, .wp-mail-smtp-not-form-input, #wp-mail-smtp-setting-gmail-one_click_setup_enabled )",t).on("change",function(){n.pluginSettingsChanged=!0}),p("form",t).on("submit",function(){n.pluginSettingsChanged=!1})},beforeSaveChecks:function(){n.settingsForm.on("submit",function(){if("mail"===p(".wp-mail-smtp-mailer input:checked",n.settingsForm).val()){var t=p(this);return p.alert({backgroundDismiss:!1,escapeKey:!1,animationBounce:1,type:"orange",icon:'">'+wp_mail_smtp.default_mailer_notice.icon_alt+'