!function(){var e={111:function(e,t,n){"use strict";n.r(t);var s=n(446),i=function(e,t){void 0===t&&(t=100),e.fadeTo(t,0,(function(){e.slideUp(t,(function(){e.remove()}))}))};jQuery((function(e){var t=function(t,n,i,r){if(!n.prop("disabled")){t.preventDefault(),e(".wp-smush-error").remove(),e(".smush-stats-wrapper").hide();var o="grid";"smush_restore_image"===i&&(o=e(document).find("div.media-modal.wp-core-ui").length>0||window.location.search.indexOf("item")>-1?"grid":"list");var a={action:i,attachment_id:n.data("id"),mode:o,_nonce:n.data("nonce")};!function(e){var t=e.parent();t.css({opacity:"0.5"}),t.find("a").prop("disabled",!0)}(n),n.html(''+wp_smush_msgs[r]+""),e.post(ajaxurl,a,(function(e){!function(e){var t=e.parent();t.css({opacity:"1"}),t.find("a").prop("disabled",!1)}(n),e.success&&void 0!==e.data?(void 0!==this.data&&this.data.indexOf("nextgen")>-1||"restore"===r?n.parents().eq(1).html(e.data.stats):n.parents().eq(1).html(e.data),void 0!==e.data&&"restore"===r&&s.Z.updateImageStats(e.data.new_size)):e.data&&e.data.error_msg&&n.parent().append(e.data.error_msg)}))}},n=function(e){var t=jQuery(".bulk-smush-wrapper .wp-smush-bulk-wrapper, #wp-smush-pending-to-smush-text"),n=jQuery(".bulk-smush-wrapper .wp-smush-all-done, .bulk-smush-wrapper .wp-smush-pagespeed-recommendation, #smush-box-bulk-upgrade, #wp-smush-all-smushed-text");if(t.length&&n.length)if(0===e)t.addClass("sui-hidden"),n.removeClass("sui-hidden");else{t.removeClass("sui-hidden"),n.addClass("sui-hidden");var s=jQuery(".sui-summary-smush .sui-summary-details .sui-tooltip");if(s.length){var i=1===e?"singular":"plural",r=s.data(i).replace("{count}",e);s.attr("data-tooltip",r)}}jQuery(".wp-smush-total-count").text(e)},r=function(t){e(t).length>0&&e("html, body").animate({scrollTop:e(t).offset().top-100},"slow")};if(e("#all-image-sizes").on("change",(function(){e('input[name^="wp-smush-image_sizes"]').prop("checked",!0)})),e("#wp-smush-update-api-status").on("click",(function(t){t.preventDefault(),e(this).addClass("sui-button-onload"),e.post(ajaxurl,{action:"recheck_api_status"},(function(){location.reload()}))})),e("body").on("click","a.smush-stats-details",(function(t){if(e(this).prop("disabled"))return!1;t.preventDefault();var n=e(this).find(".stats-toggle");e(this).parents().eq(1).find(".smush-stats-wrapper").slideToggle(),n.text("+"==n.text()?"-":"+")})),e("body").on("click",".wp-smush-send:not(.wp-smush-resmush)",(function(t){t.preventDefault(),new s.Z(e(this),!1)})),e("body").on("click",".wp-smush-remove-skipped",(function(t){t.preventDefault();var n=e(this);e.post(ajaxurl,{action:"remove_from_skip_list",id:n.attr("data-id")}).done((function(e){e.success&&void 0!==e.data.links&&(n.parent().parent().find(".smush-status").text(wp_smush_msgs.not_processed),t.target.closest(".smush-status-links").innerHTML=e.data.links)}))})),e("body").on("click",".wp-smush-nextgen-send",(function(t){t.preventDefault(),new s.Z(e(this),!1,"nextgen")})),e("body").on("click",".wp-smush-nextgen-bulk",(function(t){if(t.preventDefault(),e(".wp-smush-resmush-notice").remove(),"undefined"==typeof wp_smushit_data||0===wp_smushit_data.unsmushed.length&&0===wp_smushit_data.resmush.length)return!1;jQuery(".wp-smush-all, .wp-smush-scan").prop("disabled",!0),e(".wp-smush-notice.wp-smush-remaining").hide(),new s.Z(e(this),!0,"nextgen")})),e("body").on("click",".wp-smush-action.wp-smush-restore",(function(n){var s=e(this);t(n,s,"smush_restore_image","restore")})),e("body").on("click",".wp-smush-action.wp-smush-resmush",(function(n){t(n,e(this),"smush_resmush_image","smushing")})),e("body").on("click",".wp-smush-action.wp-smush-nextgen-restore",(function(n){t(n,e(this),"smush_restore_nextgen_image","restore")})),e("body").on("click",".wp-smush-action.wp-smush-nextgen-resmush",(function(n){t(n,e(this),"smush_resmush_nextgen_image","smushing")})),e(".wp-smush-scan").on("click",(function(t){t.preventDefault(),function(t){var i=e(".wp-smush-scan");i.addClass("sui-button-onload");var r=i.data("type");r=void 0===r?"media":r,e(".wp-smush-all").removeAttr("data-smush");var o=e(".sui-notice-top.sui-notice-success");o.slideUp(100,(function(){o.remove()})),e(".wp-smush-all").prop("disabled",!0),e(".wp-smush-settings-changed").hide();var a={action:"scan_for_resmush",type:r,get_ui:!0,process_settings:t,wp_smush_options_nonce:jQuery("#wp_smush_options_nonce").val()};e.get(ajaxurl,a,(function(t){if(void 0!==t.data){if(void 0!==t.data.resmush_ids){wp_smushit_data.resmush=t.data.resmush_ids,"undefined"!=typeof wp_smushit_data&&(wp_smushit_data.count_smushed=void 0!==t.data.count_smushed?t.data.count_smushed:wp_smushit_data.count_smushed,wp_smushit_data.count_supersmushed=void 0!==t.data.count_supersmushed?t.data.count_supersmushed:wp_smushit_data.count_supersmushed,wp_smushit_data.count_images=void 0!==t.data.count_image?t.data.count_image:wp_smushit_data.count_images,wp_smushit_data.size_before=void 0!==t.data.size_before?t.data.size_before:wp_smushit_data.size_before,wp_smushit_data.size_after=void 0!==t.data.size_after?t.data.size_after:wp_smushit_data.size_after,wp_smushit_data.savings_resize=void 0!==t.data.savings_resize?t.data.savings_resize:wp_smushit_data.savings_resize,wp_smushit_data.savings_conversion=void 0!==t.data.savings_conversion?t.data.savings_conversion:wp_smushit_data.savings_conversion,wp_smushit_data.count_resize=void 0!==t.data.count_resize?t.data.count_resize:wp_smushit_data.count_resize,wp_smushit_data.unsmushed=void 0!==t.data.unsmushed?t.data.unsmushed:wp_smushit_data.unsmushed),"nextgen"===r&&(wp_smushit_data.bytes=parseInt(wp_smushit_data.size_before)-parseInt(wp_smushit_data.size_after));var i=e(".bulk-smush-wrapper .sui-notice:not(.smush-upsell-notice)");i.length>0&&(i.addClass("sui-hidden"),e(".wp-smush-pagespeed-recommendation").addClass("sui-hidden")),e(".wp-smush-resmush-notice").remove(),e(".wp-smush-bulk-wrapper").removeClass("sui-hidden")}if(void 0!==t.data.content&&e("#wp-smush-bulk-content").html(t.data.content),void 0!==t.data.notice){var o="success";void 0!==t.data.noticeType&&(o=t.data.noticeType),window.SUI.openNotice("wp-smush-ajax-notice","

"+t.data.notice+"

",{type:o,icon:"check-tick"})}if(e("div.smush-final-log").hide(),void 0!==t.data.super_smush&&t.data.super_smush){var a=jQuery(".wp-smush-enable-lossy");a.length>0&&a.remove(),"undefined"!==t.data.super_smush_stats&&e(".super-smush-attachments .wp-smush-stats").html(t.data.super_smush_stats)}s.Z.updateStats(r);var u=t.data.count||0;s.Z.updateRemainingCount(u),n(u)}})).always((function(){jQuery(".bulk-smush-wrapper .wp-smush-bulk-progress-bar-wrapper").addClass("sui-hidden"),i.removeClass("sui-button-onload").addClass("smush-button-check-success");var t=i.find(".wp-smush-default-text"),n=i.find(".wp-smush-completed-text");t.addClass("sui-hidden-important"),n.removeClass("sui-hidden"),setTimeout((function(){i.removeClass("smush-button-check-success"),t.removeClass("sui-hidden-important"),n.addClass("sui-hidden")}),2e3),e(".wp-smush-all").prop("disabled",!1)}))}(!1)})),e("#wp-smush-welcome-box .smush-dismiss-welcome").on("click",(function(t){t.preventDefault();var n=e(this).parents().eq(1);i(n);e.post(ajaxurl,{action:"dismiss_welcome_notice"})})),e("body").on("click",".wp-smush-notice .icon-fi-close",(function(t){t.preventDefault();var n=e(this).parent();i(n)})),e("input[name=wp-smush-keep_data]").on("change",(function(e){var t="keep_data-true"===e.target.id?"keep_data-false":"keep_data-true";e.target.parentNode.classList.add("active"),document.getElementById(t).parentNode.classList.remove("active")})),e("button#wp-smush-save-settings").on("click",(function(t){t.preventDefault();var n="",s=e('input[name="setting-type"]');s.length>0&&(n=s.val());var i=e(this);if(i.parent().find("span.sui-icon-loader.sui-loading").removeClass("sui-hidden"),""!=n&&"network"==n){var r={action:"save_settings",wp_smush_options_nonce:e("#wp_smush_options_nonce").val()};r=jQuery.param(r)+"&"+jQuery("form#wp-smush-settings-form").serialize(),jQuery.post(ajaxurl,r).done((function(){return jQuery("form#wp-smush-settings-form").trigger("submit"),!0}))}else{e(".wp-smush-hex-notice").hide(),i.prop("disabled",!0).addClass("button-grey"),void 0!==i.attr("data-msg")&&i.attr("data-msg").length>0?i.html(i.attr("data-msg")):i.html(wp_smush_msgs.checking);var o=i.data("type");o=void 0===o?"media":o;var a={action:"scan_for_resmush",wp_smush_options_nonce:jQuery("#wp_smush_options_nonce").val(),type:o};a=jQuery.param(a)+"&"+jQuery("form#wp-smush-settings-form").serialize(),jQuery.post(ajaxurl,a).done((function(){return jQuery("form#wp-smush-settings-form").trigger("submit"),!0}))}})),e("body").on("click",".wp-smush-skip-resmush",(function(t){t.preventDefault();var n=jQuery(this),r=n.parents().eq(1),o=n.parent();i(o),e(".sui-notice-top.sui-notice-success").remove(),r.find(".wp-smush-all").attr("data-smush","skip_resmush"),wp_smushit_data.count_smushed=parseInt(wp_smushit_data.count_smushed)+wp_smushit_data.resmush.length,wp_smushit_data.count_supersmushed=parseInt(wp_smushit_data.count_supersmushed)+wp_smushit_data.resmush.length,wp_smushit_data.count_smushed===wp_smushit_data.count_total&&(e(".wp-smush-notice.wp-smush-all-done, .wp-smush-pagespeed-recommendation").removeClass("sui-hidden"),e(".wp-smush-bulk-wrapper ").addClass("sui-hidden")),e(".wp-smush-resmush-notice").remove();var a=e(".wp-smush-scan").data("type");a=void 0===a?"media":a;var u=(void 0!==wp_smushit_data.count_smushed?wp_smushit_data.count_smushed:0)/wp_smushit_data.count_total*100;u=WP_Smush.helpers.precise_round(u,1),e(".wp-smush-images-percent").html(u);var l=jQuery(".bulk-smush-wrapper .wp-smush-progress-inner");if(!(l.length<1)){l.css("width",u+"%"),e(".wp-smush-bulk-wrapper").removeClass("sui-hidden"),e(".wp-smush-bulk-wrapper .sui-notice").removeClass("sui-hidden");var d={action:"delete_resmush_list",type:a};e.post(ajaxurl,d,(function(t){if(t.success&&void 0!==t.data.stats){var n=t.data.stats;"undefined"!=typeof wp_smushit_data&&(wp_smushit_data.count_images=void 0!==n.count_images?parseInt(wp_smushit_data.count_images)+n.count_images:wp_smushit_data.count_images,wp_smushit_data.size_before=void 0!==n.size_before?parseInt(wp_smushit_data.size_before)+n.size_before:wp_smushit_data.size_before,wp_smushit_data.size_after=void 0!==n.size_after?parseInt(wp_smushit_data.size_after)+n.size_after:wp_smushit_data.size_after,wp_smushit_data.savings_resize=void 0!==n.savings_resize?parseInt(wp_smushit_data.savings_resize)+n.savings_resize:wp_smushit_data.savings_resize,wp_smushit_data.savings_conversion=void 0!==n.savings_conversion?parseInt(wp_smushit_data.savings_conversion)+n.savings_conversion:wp_smushit_data.savings_conversion,void 0!==wp_smushit_data.savings_dir_smush&&void 0!==wp_smushit_data.savings_dir_smush.orig_size&&(wp_smushit_data.size_before=void 0!==wp_smushit_data.savings_dir_smush?parseInt(wp_smushit_data.size_before)+parseInt(wp_smushit_data.savings_dir_smush.orig_size):wp_smushit_data.size_before,wp_smushit_data.size_after=void 0!==wp_smushit_data.savings_dir_smush?parseInt(wp_smushit_data.size_after)+parseInt(wp_smushit_data.savings_dir_smush.image_size):wp_smushit_data.size_after),wp_smushit_data.count_resize=void 0!==n.count_resize?parseInt(wp_smushit_data.count_resize)+n.count_resize:wp_smushit_data.count_resize);var i=e(".bulk-smush-wrapper .wp-smush-remaining-count");i.length&&void 0!==wp_smushit_data.unsmushed&&i.html(wp_smushit_data.unsmushed.length),void 0===wp_smushit_data.unsmushed&&0!==wp_smushit_data.unsmushed.length||(e(".wp-smush-bulk-wrapper .sui-notice").removeClass("sui-hidden"),e(".sui-notice-success.wp-smush-all-done").addClass("sui-hidden")),s.Z.updateStats()}}))}})),e("a.wp-smush-lossy-enable").on("click",(function(e){e.preventDefault(),r("#column-wp-smush-lossy")})),e(".wp-smush-resize-enable").on("click",(function(e){e.preventDefault(),r("#column-wp-smush-resize")})),window.location.hash){var o=window.location.hash.substring(1);"enable-resize"===o?r("#column-wp-smush-resize"):"enable-lossy"===o&&r("#column-wp-smush-lossy")}if(e("body").on("click",".wp-smush-trigger-bulk",(function(t){t.preventDefault(),void 0!==t.target.dataset.type&&"nextgen"===t.target.dataset.type?e(".wp-smush-nextgen-bulk").click():e(".wp-smush-all").click(),e("span.sui-notice-dismiss").click()})),e("body").on("click","#bulk-smush-top-notice-close",(function(t){t.preventDefault(),e(this).parent().parent().slideUp("slow")})),e(".wp-smush-setting-row .toggle-checkbox").focus((function(){e(this).keypress((function(t){32==t.keyCode&&(t.preventDefault(),e(this).find(".toggle-checkbox").click())}))})),e("body").on("blur",".wp-smush-resize-input",(function(){!function(e,t,n){var s=e.find("#wp-smush-resize, #wp-smush-resize-quick-setup");if(!n)var i=e.find("#wp-smush-resize_width, #quick-setup-resize_width"),r=e.find(".sui-notice-info.wp-smush-update-width");if(!t)var o=e.find("#wp-smush-resize_height, #quick-setup-resize_height"),a=e.find(".sui-notice-info.wp-smush-update-height");var u=!1,l=!1;!s.is(":checked")||void 0===wp_smushit_data.resize_sizes||void 0===wp_smushit_data.resize_sizes.width||(!n&&void 0!==i&&parseInt(wp_smushit_data.resize_sizes.width)>parseInt(i.val())?(i.parent().addClass("sui-form-field-error"),r.show("slow"),u=!0):(i.parent().removeClass("sui-form-field-error"),r.hide(),o.hasClass("error")&&a.show("slow")),!t&&void 0!==o&&parseInt(wp_smushit_data.resize_sizes.height)>parseInt(o.val())?(o.parent().addClass("sui-form-field-error"),u||a.show("slow"),l=!0):(o.parent().removeClass("sui-form-field-error"),a.hide(),i.hasClass("error")&&r.show("slow")))}(e(this).parents().eq(4),!1,!1)})),e("body").on("click","#wp-smush-resize, #wp-smush-resize-quick-setup",(function(){var t=e(this),n=e(".wp-smush-resize-settings-wrap");t.is(":checked")?n.show():n.hide()})),e("body").on("click","#wp-smush-detection",(function(){var t=e(this),n=e(".smush-highlighting-notice"),s=e(".smush-highlighting-warning");t.is(":checked")?n.length>0?n.show():s.show():(n.hide(),s.hide())})),e("#wp-smush-png_to_jpg").click((function(){var t=e(this),n=e(".wp-smush-png_to_jpg-wrap");t.is(":checked")?n.show():n.hide()})),e("#wp-smush-revalidate-member").on("click",(function(t){t.preventDefault();var n=e(this).parents().eq(1);n.addClass("loading-notice"),e.get(ajaxurl,{action:"smush_show_warning"},(function(e){n.removeClass("loading-notice").addClass("loaded-notice"),0==e?(n.attr("data-message",wp_smush_msgs.membership_valid),i(n,1e3)):(n.attr("data-message",wp_smush_msgs.membership_invalid),setTimeout((function(){n.removeClass("loaded-notice")}),1e3))}))})),e("li.smush-dir-savings").length>0){e.get(ajaxurl,{action:"get_dir_smush_stats"},(function(t){e("li.smush-dir-savings .sui-icon-loader").hide(),t.success||void 0===t.data.message?void 0===t.data||void 0===t.data.dir_smush?(e("li.smush-dir-savings span.wp-smush-stats").append(wp_smush_msgs.ajax_error),e("li.smush-dir-savings span.wp-smush-stats span").hide()):function(t){if(void 0!==t.dir_smush){var n=e("li.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-human"),s=e("li.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-percent");t.dir_smush.bytes>0?(e(".wp-smush-dir-link").addClass("sui-hidden"),e("li.smush-dir-savings .wp-smush-stats-label-message").hide(),n.length>0?n.html(t.dir_smush.human):t.dir_smush.bytes,t.dir_smush.percent>0&&(e("li.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-sep").removeClass("sui-hidden"),s.length>0?s.html(t.dir_smush.percent+"%"):t.dir_smush.percent)):e(".wp-smush-dir-link").removeClass("sui-hidden")}if(void 0!==t.combined_stats&&t.combined_stats.length>0){var i=t.combined_stats,r=i.smushed/i.total_count*100;(r=WP_Smush.helpers.precise_round(r,1))&&e("div.wp-smush-count-total span.wp-smush-images-percent").html(r),i.total_count&&e("span.wp-smush-count-total span.wp-smush-total-optimised").html(i.total_count),i.savings&&e("span.wp-smush-savings span.wp-smush-stats-human").html(i.savings),i.percent&&e("span.wp-smush-savings span.wp-smush-stats-percent").html(i.percent)}}(t.data):e("div.wp-smush-scan-result div.content").prepend(t.data.message)}))}e("span.dismiss-recommendation").on("click",(function(t){t.preventDefault();var n=e(this).parent();n.hide("slow",(function(){n.remove()})),e.ajax({type:"POST",url:ajaxurl,data:{action:"hide_pagespeed_suggestion"}})})),e("#smush-updated-dialog").length&&window.SUI.openModal("smush-updated-dialog","wpbody-content",void 0,!1);var a=a||{};a.KeyCode={TAB:9,RETURN:13,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},e('#smush-box-tutorials div[role="link"]').on("click",(function(e){var t=null!==e.target?e.target:e.srcElement;t&&window.open(t.getAttribute("data-href"),"_blank")})).on("keydown",(function(t){var n=function(t){var n=e(i).data("tutorial"),s=e('#smush-box-tutorials [data-tutorial="'.concat("next"===t?n+1:n-1,'"]'));if(!s.length){var r=e("#smush-box-tutorials .wp-smush-tutorial-item");s=r["next"===t?0:r.length-1]}s.focus()},s=t.which||t.keyCode,i=null!==t.target?t.target:t.srcElement;switch(s){case a.KeyCode.RETURN:i&&window.open(i.getAttribute("data-href"),"_blank");break;case a.KeyCode.LEFT:n("prev");break;case a.KeyCode.RIGHT:n("next")}}))}))},447:function(){!function(){"use strict";WP_Smush.restore={modal:document.getElementById("smush-restore-images-dialog"),contentContainer:document.getElementById("smush-bulk-restore-content"),settings:{slide:"start",success:0,errors:[]},items:[],success:[],errors:[],currentStep:0,totalSteps:0,init:function(){this.modal&&(this.settings={slide:"start",success:0,errors:[]},this.resetModalWidth(),this.renderTemplate(),window.SUI.openModal("smush-restore-images-dialog","wpbody-content",void 0,!1))},renderTemplate:function(){var e=WP_Smush.onboarding.template("smush-bulk-restore")(this.settings);e&&(this.contentContainer.innerHTML=e),this.bindSubmit()},resetModalWidth:function(){this.modal.style.maxWidth="460px",this.modal.querySelector(".sui-box").style.maxWidth="460px"},bindSubmit:function(){var e=this.modal.querySelector('button[id="smush-bulk-restore-button"]'),t=this;e&&e.addEventListener("click",(function(e){e.preventDefault(),t.resetModalWidth(),t.settings={slide:"progress"},t.errors=[],t.renderTemplate(),t.initScan()}))},cancel:function(){"start"===this.settings.slide||"finish"===this.settings.slide?window.SUI.closeModal():(this.updateProgressBar(!0),window.location.reload())},updateProgressBar:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=0;0100&&(t=100),this.modal.querySelector(".sui-progress-text span").innerHTML=t+"%",this.modal.querySelector(".sui-progress-bar span").style.width=t+"%";var n=this.modal.querySelector(".sui-progress-state-text");n.innerHTML=t>=90?"Finalizing...":e?"Cancelling...":this.currentStep+"/"+this.totalSteps+" images restored"},initScan:function(){var e=this,t=document.getElementById("_wpnonce"),n=new XMLHttpRequest;n.open("POST",ajaxurl+"?action=get_image_count",!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onload=function(){if(200===n.status){var t=JSON.parse(n.response);void 0!==t.data.items&&(e.items=t.data.items,e.totalSteps=t.data.items.length,e.step())}else window.console.log("Request failed. Returned status of "+n.status)},n.send("_ajax_nonce="+t.value)},step:function(){var e=this,t=this,n=document.getElementById("_wpnonce");if(0/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g,variable:"data"};return function(s){return _.templateSettings=n,(t=t||_.template(document.getElementById(e).innerHTML))(s)}}))}()},413:function(e,t,n){"use strict";n.r(t);var s,i=n(446);s=jQuery,WP_Smush.bulk={init:function(){s(".wp-smush-all").on("click",(function(e){e.preventDefault(),s(".sui-notice-top.sui-notice-success").remove();var t=document.getElementById("bulk_smush_warning");t.classList.add("sui-hidden");var n=s(".wp-smush-bulk-progress-bar-wrapper");if(n.removeClass("wp-smush-exceed-limit"),n.find(".sui-progress-block .wp-smush-all").addClass("sui-hidden"),n.find(".sui-progress-block .wp-smush-cancel-bulk").removeClass("sui-hidden"),t&&document.getElementById("bulk-smush-resume-button").classList.add("sui-hidden"),s(".wp-resmush.wp-smush-action, .wp-smush-scan, .wp-smush-all:not(.sui-progress-close), a.wp-smush-lossy-enable, button.wp-smush-resize-enable, button#wp-smush-save-settings").prop("disabled",!0),void 0===window.wp_smushit_data||0===window.wp_smushit_data.unsmushed.length&&0===window.wp_smushit_data.resmush.length)return!1;s(".wp-smush-remaining").addClass("sui-hidden"),n.find(".sui-progress-block i.sui-icon-info").removeClass("sui-icon-info").addClass("sui-loading").addClass("sui-icon-loader"),new i.Z(s(this),!0)})),s("body").on("click",".smush-ignore-image",(function(e){e.preventDefault();var t=s(this);t.prop("disabled",!0),t.attr("data-tooltip"),t.removeClass("sui-tooltip"),s.post(ajaxurl,{action:"ignore_bulk_image",id:t.attr("data-id")}).done((function(n){t.is("a")&&n.success&&void 0!==n.data.links&&(t.parent().parent().find(".smush-status").text(wp_smush_msgs.ignored),e.target.closest(".smush-status-links").innerHTML=n.data.links)}))}));var e=document.getElementById("smush-box-bulk-upgrade");!e||window.wp_smushit_data.unsmushed.length||window.wp_smushit_data.resmush.length||e.classList.remove("sui-hidden")}},WP_Smush.bulk.init()},140:function(e,t,n){"use strict";n.r(t);var s,i=n(445),r=function(e,t){e=parseInt(e),t=parseInt(t);var n=!1,s=0,i=0,r={scan:function(){var n=e-t;0!==t?o(n):jQuery.post(ajaxurl,{action:"directory_smush_start"},(function(){return o(n)}))},cancel:function(){return n=!0,jQuery.post(ajaxurl,{action:"directory_smush_cancel"})},getProgress:function(){if(n)return 0;var s=e-t;return Math.min(Math.round(100*parseInt(e-s)/e),99)},onFinishStep:function(n){jQuery(".wp-smush-progress-dialog .sui-progress-state-text").html(t-s+"/"+e+" "+window.wp_smush_msgs.progress_smushed),WP_Smush.directory.updateProgressBar(n)},onFinish:function(){WP_Smush.directory.updateProgressBar(100),window.location.href=window.wp_smush_msgs.directory_url+"&scan=done"},limitReached:function(){var e=jQuery("#wp-smush-progress-dialog");e.addClass("wp-smush-exceed-limit"),e.find("#cancel-directory-smush").attr("data-tooltip",window.wp_smush_msgs.bulk_resume),e.find(".sui-icon-close").removeClass("sui-icon-close").addClass("sui-icon-play"),e.find("#cancel-directory-smush").attr("id","cancel-directory-smush-disabled")},resume:function(){var e=jQuery("#wp-smush-progress-dialog"),t=e.find("#cancel-directory-smush-disabled");e.removeClass("wp-smush-exceed-limit"),e.find(".sui-icon-play").removeClass("sui-icon-play").addClass("sui-icon-close"),t.attr("data-tooltip","Cancel"),t.attr("id","cancel-directory-smush"),r.scan()}},o=function n(o){o>=0?(t=e-o,jQuery.post(ajaxurl,{action:"directory_smush_check_step",step:t},(function(e){void 0!==e.success&&e.success?(void 0!==e.data&&void 0!==e.data.skipped&&!0===e.data.skipped&&i++,t++,o-=1,r.onFinishStep(r.getProgress()),n(o)):void 0!==e.data.error&&"dir_smush_limit_exceeded"===e.data.error?r.limitReached():(s++,t++,o-=1,r.onFinishStep(r.getProgress()),n(o))}))):jQuery.post(ajaxurl,{action:"directory_smush_finish",items:e-(s+i),failed:s,skipped:i},(function(e){return r.onFinish(e)}))};return r};s=jQuery,WP_Smush.directory={selected:[],tree:[],wp_smush_msgs:[],init:function(){var e=this,t=s("#wp-smush-progress-dialog"),n=0,i=0;void 0!==window.wp_smushit_data.dir_smush&&(n=window.wp_smushit_data.dir_smush.totalSteps,i=window.wp_smushit_data.dir_smush.currentScanStep),this.scanner=new r(n,i),this.wp_smush_msgs=window.wp_smush_msgs||{},s("button.wp-smush-browse, a.wp-smush-dir-link").on("click",(function(t){t.preventDefault(),s(t.currentTarget).hasClass("wp-smush-browse")&&(s("div.wp-smush-scan-result div.wp-smush-notice").hide(),s("div.wp-smush-info").remove()),window.SUI.openModal("wp-smush-list-dialog",t.currentTarget,s("#wp-smush-list-dialog .sui-box-header [data-modal-close]")[0],!0),e.initFileTree()})),s(".wp-smush-select-dir").on("click",(function(t){if(t.preventDefault(),!s(this).prop("disabled")){var n=s(this);s("div.wp-smush-list-dialog div.sui-box-body").css({opacity:"0.8"}),s("div.wp-smush-list-dialog div.sui-box-body a").off("click"),n.prop("disabled",!0),n.parent().find(".add-dir-loader").addClass("sui-icon-loader sui-loading");var i=e.tree.getSelectedNodes(),o=[];i.forEach((function(e){o.push(e.key)}));var a={action:"image_list",smush_path:o,image_list_nonce:s('input[name="image_list_nonce"]').val()};s.post(ajaxurl,a,(function(t){window.SUI.closeModal(),t.success?(e.scanner=new r(t.data,0),e.showProgressDialog(t.data),e.scanner.scan()):window.SUI.openNotice("wp-smush-ajax-notice",t.data.message,{type:"warning"})}))}})),t.on("click","#cancel-directory-smush, .sui-dialog-close, .wp-smush-cancel-dir",(function(t){t.preventDefault(),s(this).parent().find(".add-dir-loader").addClass("sui-icon-loader sui-loading"),e.scanner.cancel().done((function(){return window.location.href=e.wp_smush_msgs.directory_url}))})),t.on("click",".sui-icon-play, .wp-smush-resume-scan",(function(t){t.preventDefault(),e.scanner.resume()}))},initFileTree:function(){var e=this,t=s("button.wp-smush-select-dir"),n={type:"GET",url:ajaxurl,data:{action:"smush_get_directory_list",list_nonce:s('input[name="list_nonce"]').val()},cache:!1};Object.entries(e.tree).length>0||(e.tree=(0,i.createTree)(".wp-smush-list-dialog .content",{autoCollapse:!0,clickFolderMode:3,checkbox:!0,debugLevel:0,selectMode:3,tabindex:"0",keyboard:!0,quicksearch:!0,source:n,lazyLoad:function(i,r){r.result=new Promise((function(e,t){n.data.dir=r.node.key,s.ajax(n).done((function(t){return e(t)})).fail(t)})),r.result.then(t.html(e.wp_smush_msgs.add_dir))},loadChildren:function(e,t){return t.node.fixSelection3AfterClick()},select:function(){return t.prop("disabled",!+e.tree.getSelectedNodes().length)},init:function(){return t.prop("disabled",!0)}}))},showProgressDialog:function(e){s(".wp-smush-progress-dialog .sui-progress-state-text").html("0/"+e+" "+self.wp_smush_msgs.progress_smushed),window.SUI.openModal("wp-smush-progress-dialog","dialog-close-div",void 0,!1)},updateProgressBar:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e>100&&(e=100),s(".sui-progress-block .sui-progress-text span").text(e+"%"),s(".sui-progress-block .sui-progress-bar span").width(e+"%"),e>=90&&s(".sui-progress-state .sui-progress-state-text").text("Finalizing..."),t&&s(".sui-progress-state .sui-progress-state-text").text("Cancelling...")}},WP_Smush.directory.init()},65:function(){!function(){"use strict";WP_Smush.helpers={init:function(){},formatBytes:function(e,t){var n=1024,s=["KB","MB","GB","TB","PB"];if(Math.abs(e)=n&&i=0?1:-1;return e=e>100?100:e,Math.round(e*Math.pow(10,t)+.001*n)/Math.pow(10,t)},showErrorNotice:function(e){if(void 0!==e){var t="

".concat(e,"

");SUI.openNotice("wp-smush-ajax-notice",t,{type:"error",icon:"info"});var n=document.querySelector(".sui-button-onload");n&&n.classList.remove("sui-button-onload")}},resetSettings:function(){var e=document.getElementById("wp_smush_reset"),t=new XMLHttpRequest;t.open("POST",ajaxurl+"?action=reset_settings",!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onload=function(){if(200===t.status){var e=JSON.parse(t.response);void 0!==e.success&&e.success&&(window.location.href=wp_smush_msgs.smush_url)}else window.console.log("Request failed. Returned status of "+t.status)},t.send("_ajax_nonce="+e.value)}},WP_Smush.helpers.init()}()},206:function(){!function(e){"use strict";if(e("#wp-smush-s3support-alert").length){var t={type:"warning",icon:"info",dismiss:{show:!0,label:wp_smush_msgs.noticeDismiss,tooltip:wp_smush_msgs.noticeDismissTooltip}};window.SUI.openNotice("wp-smush-s3support-alert",e("#wp-smush-s3support-alert").data("message"),t)}function n(t){var n=e(t.currentTarget).closest(".smush-notice");n.fadeTo(100,0,(function(){return n.slideUp(100,(function(){return n.remove()}))}))}e("#wp-smush-s3support-alert").on("click","button",(function(){e.post(ajaxurl,{action:"dismiss_s3support_alert"})})),e("#wp-smush-api-message button.sui-button-icon").on("click",(function(t){t.preventDefault();var n=e("#wp-smush-api-message");n.slideUp("slow",(function(){n.remove()})),e.post(ajaxurl,{action:"hide_api_message"})})),e(".smush-notice .smush-notice-act").on("click",(function(e){n(e)})),e(".smush-notice .smush-notice-dismiss").on("click",(function(t){n(t),e.post(ajaxurl,{action:"dismiss_upgrade_notice"})})),e(".wp-smush-update-info").on("click",".notice-dismiss",(function(t){t.preventDefault(),n(t),e.post(ajaxurl,{action:"dismiss_update_info"})}))}(jQuery)},579:function(){!function(){"use strict";WP_Smush.onboarding={membership:"free",onboardingModal:document.getElementById("smush-onboarding-dialog"),scanFilesModal:document.getElementById("checking-files-dialog"),settings:{first:!0,last:!1,slide:"start",value:!1},selection:{auto:!0,lossy:!0,strip_exif:!0,original:!1,lazy_load:!0,usage:!1},contentContainer:document.getElementById("smush-onboarding-content"),onboardingSlides:["start","auto","lossy","strip_exif","original","lazy_load","usage"],touchX:null,touchY:null,init:function(){if(this.onboardingModal){var e=document.getElementById("smush-onboarding");this.membership=e.dataset.type,"pro"!==this.membership&&(this.onboardingSlides=["start","auto","strip_exif","lazy_load","usage"],this.selection.lossy=!1),"false"===e.dataset.tracking&&this.onboardingSlides.pop(),this.renderTemplate();var t=this.onboardingModal.querySelector(".smush-onboarding-skip-link");t&&t.addEventListener("click",this.skipSetup),window.SUI.openModal("smush-onboarding-dialog","checking-files-dialog",void 0,!1)}},handleTouchStart:function(e){var t=e.touches[0];this.touchX=t.clientX,this.touchY=t.clientY},handleTouchMove:function(e){if(this.touchX&&this.touchY){var t=e.touches[0].clientX,n=e.touches[0].clientY,s=this.touchX-t,i=this.touchY-n;Math.abs(s)>Math.abs(i)&&(s>0?!1===WP_Smush.onboarding.settings.last&&WP_Smush.onboarding.next(null,"next"):!1===WP_Smush.onboarding.settings.first&&WP_Smush.onboarding.next(null,"prev")),this.touchX=null,this.touchY=null}},renderTemplate:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"none",n=this.onboardingModal.querySelector('input[type="checkbox"]');n&&(this.selection[n.id]=n.checked);var s=WP_Smush.onboarding.template("smush-onboarding"),i=s(this.settings);i&&(this.contentContainer.innerHTML=i,"none"===t?this.contentContainer.classList.add("loaded"):(this.contentContainer.classList.remove("loaded"),this.contentContainer.classList.add(t),setTimeout((function(){e.contentContainer.classList.add("loaded"),e.contentContainer.classList.remove(t)}),600))),this.onboardingModal.addEventListener("touchstart",this.handleTouchStart,!1),this.onboardingModal.addEventListener("touchmove",this.handleTouchMove,!1),this.bindSubmit()},bindSubmit:function(){var e=this.onboardingModal.querySelector('button[type="submit"]'),t=this;e&&e.addEventListener("click",(function(e){e.preventDefault();var n=t.onboardingModal.querySelector('input[type="checkbox"]');n&&(t.selection[n.id]=n.checked);var s=document.getElementById("smush_quick_setup_nonce"),i=new XMLHttpRequest;i.open("POST",ajaxurl+"?action=smush_setup",!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onload=function(){200===i.status?WP_Smush.onboarding.showScanDialog():window.console.log("Request failed. Returned status of "+i.status)},i.send("smush_settings="+JSON.stringify(t.selection)+"&_ajax_nonce="+s.value)}))},next:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.onboardingSlides.indexOf(this.settings.slide),s=0;s=t?"next"===t?n+1:n-1:null!==e&&e.classList.contains("next")?n+1:n-1;var i=null!==e&&e.classList.contains("next")?"fadeInRight":"fadeInLeft";this.settings={first:0===s,last:s+1===this.onboardingSlides.length,slide:this.onboardingSlides[s],value:this.selection[this.onboardingSlides[s]]},this.renderTemplate(i)},goTo:function(e){var t=this.onboardingSlides.indexOf(e);this.settings={first:0===t,last:t+1===this.onboardingSlides.length,slide:e,value:this.selection[e]},this.renderTemplate()},skipSetup:function(){var e=document.getElementById("smush_quick_setup_nonce"),t=new XMLHttpRequest;t.open("POST",ajaxurl+"?action=skip_smush_setup&_ajax_nonce="+e.value),t.onload=function(){200===t.status?WP_Smush.onboarding.showScanDialog():window.console.log("Request failed. Returned status of "+t.status)},t.send()},showScanDialog:function(){window.SUI.closeModal(),window.SUI.openModal("checking-files-dialog","wpbody-content",void 0,!1);var e=document.getElementById("wp_smush_options_nonce");setTimeout((function(){var t=new XMLHttpRequest;t.open("POST",ajaxurl+"?action=scan_for_resmush",!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onload=function(){var e=document.querySelector("#smush-onboarding-dialog");e.parentNode.removeChild(e),window.SUI.closeModal(),200===t.status?setTimeout((function(){location.reload()}),1e3):window.console.log("Request failed. Returned status of "+t.status)},t.send("type=media&get_ui=false&process_settings=false&wp_smush_options_nonce="+e.value)}),3e3)},hideUpgradeModal:function(){var e=new XMLHttpRequest;e.open("POST",ajaxurl+"?action=hide_new_features"),e.send()}},WP_Smush.onboarding.template=_.memoize((function(e){var t,n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g,variable:"data"};return function(s){return _.templateSettings=n,(t=t||_.template(document.getElementById(e).innerHTML))(s)}})),window.addEventListener("load",(function(){return WP_Smush.onboarding.init()}))}()},110:function(){!function(){"use strict";WP_Smush.CDN={cdnEnableButton:document.getElementById("smush-enable-cdn"),cdnDisableButton:document.getElementById("smush-cancel-cdn"),cdnStatsBox:document.querySelector(".smush-cdn-stats"),init:function(){var e=this;this.cdnEnableButton&&this.cdnEnableButton.addEventListener("click",(function(t){t.currentTarget.classList.add("sui-button-onload"),e.toggle_cdn(!0)})),this.cdnDisableButton&&this.cdnDisableButton.addEventListener("click",(function(t){t.preventDefault(),t.currentTarget.classList.add("sui-button-onload"),e.toggle_cdn(!1)})),this.updateStatsBox()},toggle_cdn:function(e){var t=document.getElementsByName("wp_smush_options_nonce"),n=new XMLHttpRequest;n.open("POST",ajaxurl+"?action=smush_toggle_cdn",!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onload=function(){if(200===n.status){var e=JSON.parse(n.response);void 0!==e.success&&e.success?location.reload():void 0!==e.data.message&&WP_Smush.helpers.showErrorNotice(e.data.message)}else WP_Smush.helpers.showErrorNotice("Request failed. Returned status of "+n.status)},n.send("param="+e+"&_ajax_nonce="+t[0].value)},updateStatsBox:function(){var e=this;if(void 0!==this.cdnStatsBox&&this.cdnStatsBox&&window.location.search.includes("view=cdn")){this.toggleElements();var t=new XMLHttpRequest;t.open("POST",ajaxurl+"?action=get_cdn_stats",!0),t.onload=function(){if(200===t.status){var n=JSON.parse(t.response);void 0!==n.success&&n.success?e.toggleElements():void 0!==n.data.message&&WP_Smush.helpers.showErrorNotice(n.data.message)}else WP_Smush.helpers.showErrorNotice("Request failed. Returned status of "+t.status)},t.send()}},toggleElements:function(){for(var e=this.cdnStatsBox.querySelector(".sui-icon-loader"),t=this.cdnStatsBox.querySelectorAll(".wp-smush-stats > :not(.sui-icon-loader)"),n=0;n span > span").style.backgroundColor=e,document.querySelector(".sui-colorpicker-hex .sui-colorpicker-value > input").value=e},toggle_lazy_load:function(e){var t=document.getElementsByName("wp_smush_options_nonce"),n=new XMLHttpRequest;n.open("POST",ajaxurl+"?action=smush_toggle_lazy_load",!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onload=function(){if(200===n.status){var e=JSON.parse(n.response);void 0!==e.success&&e.success?location.reload():void 0!==e.data.message&&(WP_Smush.helpers.showErrorNotice(e.data.message),document.querySelector(".sui-button-onload").classList.remove("sui-button-onload"))}else WP_Smush.helpers.showErrorNotice("Request failed. Returned status of "+n.status),document.querySelector(".sui-button-onload").classList.remove("sui-button-onload")},n.send("param="+e+"&_ajax_nonce="+t[0].value)},addLoaderIcon:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"spinner";e||(e=wp.media({title:"Select or upload an icon",button:{text:"Select icon"},multiple:!1})).on("select",(function(){var n=e.state().get("selection").first().toJSON(),s=document.getElementById("smush-"+t+"-icon-preview");s.style.backgroundImage='url("'+n.url+'")',s.style.display="block",document.getElementById("smush-"+t+"-icon-file").setAttribute("value",n.id),document.getElementById("smush-upload-"+t).style.display="none";var i=document.getElementById("smush-remove-"+t);i.querySelector("span").innerHTML=n.filename,i.style.display="block"})),e.open()},removeLoaderIcon:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"spinner",t=document.getElementById("smush-"+e+"-icon-preview");t.style.backgroundImage="",t.style.display="none",document.getElementById("smush-upload-"+e).style.display="block",document.getElementById("smush-remove-"+e).style.display="none",document.getElementById("smush-"+e+"-icon-file").setAttribute("value","")},remove:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"spinner",n=document.getElementsByName("wp_smush_options_nonce"),s=new XMLHttpRequest;s.open("POST",ajaxurl+"?action=smush_remove_icon",!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.send("id="+e+"&type="+t+"&_ajax_nonce="+n[0].value)}},WP_Smush.Lazyload.init()}()},446:function(e,t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"media";s(this,e),this.errors=[];var o=jQuery(".bulk-smush-wrapper .sui-progress-state-text");return this.smushed=parseInt(o.find("span:first-child").html()),this.total=parseInt(o.find("span:last-child").html()),this.skip_resmush=!(void 0===t.data("smush")||!t.data("smush")),this.button=jQuery(t[0]),this.is_bulk=!!n(i)&&i,this.url=ajaxurl,this.log=jQuery(".smush-final-log"),this.deferred=jQuery.Deferred(),this.deferred.errors=[],this.setIds(),this.is_bulk_resmush=0=0?"&":"?")+jQuery.param(t)),e}},{key:"membershipValidity",value:function(e){var t=jQuery("#wp-smush-invalid-member");void 0!==e&&void 0!==e.show_warning&&t.length>0&&(e.show_warning?t.show():t.hide())}},{key:"ajax",value:function(e,t,n,s){var i=jQuery.param({is_bulk_resmush:e,attachment_id:t,_nonce:s});return jQuery.ajax({type:"GET",data:i,url:n,timeout:wp_smushit_data.timeout,dataType:"json"})}},{key:"setProSavings",value:function(){var e=wp_smushit_data.savings_percent>0?wp_smushit_data.savings_percent:0,t=wp_smushit_data.savings_bytes>0?wp_smushit_data.savings_bytes:0,n=2.22058824;e>49&&(n=1.22054412),e>0&&(e*=n,t*=n),wp_smushit_data.pro_savings={percent:WP_Smush.helpers.precise_round(e,1),savings_bytes:WP_Smush.helpers.formatBytes(t,1)}}},{key:"updateStats",value:function(t){var n=void 0!==t&&"nextgen"===t,s=0;wp_smushit_data.savings_bytes=parseInt(wp_smushit_data.size_before)-parseInt(wp_smushit_data.size_after);var i=WP_Smush.helpers.formatBytes(wp_smushit_data.savings_bytes,1),r=jQuery(".wp-smush-savings .wp-smush-stats-human");n?r.html(i):(r.html(WP_Smush.helpers.getFormatFromString(i)),jQuery(".sui-summary-large.wp-smush-stats-human").html(WP_Smush.helpers.getSizeFromString(i))),wp_smushit_data.savings_percent=WP_Smush.helpers.precise_round(parseInt(wp_smushit_data.savings_bytes)/parseInt(wp_smushit_data.size_before)*100,1),isNaN(wp_smushit_data.savings_percent)||jQuery(".wp-smush-savings .wp-smush-stats-percent").html(wp_smushit_data.savings_percent),void 0!==wp_smushit_data.savings_bytes&&void 0!==wp_smushit_data.savings_resize&&(s=parseInt(wp_smushit_data.savings_bytes)-parseInt(wp_smushit_data.savings_resize))>0&&jQuery("li.super-smush-attachments span.smushed-savings").html(WP_Smush.helpers.formatBytes(s,1)),n?jQuery(".sui-summary-details span.wp-smush-total-optimised").html(wp_smushit_data.count_images):jQuery("span.smushed-items-count span.wp-smush-count-total span.wp-smush-total-optimised").html(wp_smushit_data.count_images),jQuery("span.smushed-items-count span.wp-smush-count-resize-total span.wp-smush-total-optimised").html(wp_smushit_data.count_resize);var o=jQuery("li.super-smush-attachments .smushed-count");o.length&&void 0!==wp_smushit_data.count_supersmushed&&o.html(wp_smushit_data.count_supersmushed);var a=jQuery(".smush-conversion-savings");if(a.length>0&&void 0!==wp_smushit_data.savings_conversion&&""!==wp_smushit_data.savings_conversion){var u=a.find(".wp-smush-stats");u.length>0&&u.html(WP_Smush.helpers.formatBytes(wp_smushit_data.savings_conversion,1))}var l=jQuery(".smush-resize-savings");if(l.length>0&&void 0!==wp_smushit_data.savings_resize&&""!==wp_smushit_data.savings_resize){var d=parseInt(wp_smushit_data.savings_resize),c=l.find(".wp-smush-stats"),h=l.find(".wp-smush-stats-label-message");d>0&&c.length>0&&(h.length>0&&h.hide(),c.html(WP_Smush.helpers.formatBytes(wp_smushit_data.savings_resize,1)))}if(e.setProSavings(),void 0!==wp_smushit_data.pro_savings){var p=jQuery(".smush-avg-pro-savings");if(p.length>0){var f=p.find(".wp-smush-stats-percent"),m=p.find(".wp-smush-stats-human");f.length>0&&void 0!==wp_smushit_data.pro_savings.percent&&""!==wp_smushit_data.pro_savings.percent&&f.html(wp_smushit_data.pro_savings.percent),m.length>0&&void 0!==wp_smushit_data.pro_savings.savings_bytes&&""!==wp_smushit_data.pro_savings.savings_bytes&&m.html(wp_smushit_data.pro_savings.savings_bytes)}}if(jQuery(".smush-sidenav .wp-smush-remaining-count").length){var g=0;void 0!==wp_smushit_data.unsmushed&&wp_smushit_data.unsmushed.length>0&&(g+=wp_smushit_data.unsmushed.length),void 0!==wp_smushit_data.resmush&&wp_smushit_data.resmush.length>0&&(g+=wp_smushit_data.resmush.length),e.updateRemainingCount(g)}}},{key:"updateImageStats",value:function(e){if(0!==e){var t=jQuery(".attachment-info .file-size");if(t.contents().filter((function(){return 3===this.nodeType})).text()!==" "+e){var n=t.contents().filter((function(){return 1===this.nodeType})).text();t.html(""+n+" "+e)}}}},{key:"updateRemainingCount",value:function(e){var t=jQuery(".wp-smush-remaining-count");t.length&&t.html(e);var n=jQuery(".smush-sidenav .wp-smush-remaining-count"),s=jQuery(".smush-sidenav .smush-bulk .sui-icon-check-tick");n.length&&s.length&&(e>0?(n.removeClass("sui-hidden"),s.addClass("sui-hidden")):(jQuery(".sui-summary-smush .smush-stats-icon").addClass("sui-hidden"),s.removeClass("sui-hidden"),n.addClass("sui-hidden")))}},{key:"updateLocalizedStats",value:function(e,t){void 0!==window.wp_smushit_data&&("media"===t?(wp_smushit_data.count_images=parseInt(wp_smushit_data.count_images)+parseInt(e.count),e.is_lossy&&(wp_smushit_data.count_supersmushed=parseInt(wp_smushit_data.count_supersmushed)+1),wp_smushit_data.savings_resize=void 0!==e.savings_resize.bytes?parseInt(wp_smushit_data.savings_resize)+parseInt(e.savings_resize.bytes):parseInt(wp_smushit_data.savings_resize),wp_smushit_data.count_resize=void 0!==e.savings_resize.bytes?parseInt(wp_smushit_data.count_resize)+1:wp_smushit_data.count_resize,wp_smushit_data.savings_conversion=void 0!==e.savings_conversion&&void 0!==e.savings_conversion.bytes?parseInt(wp_smushit_data.savings_conversion)+parseInt(e.savings_conversion.bytes):parseInt(wp_smushit_data.savings_conversion)):"directory_smush"===t?wp_smushit_data.count_images=parseInt(wp_smushit_data.count_images)+1:"nextgen"===t&&(wp_smushit_data.count_supersmushed=parseInt(wp_smushit_data.count_supersmushed)+1,wp_smushit_data.count_images=parseInt(wp_smushit_data.count_images)+parseInt(e.count)),e.size_before>e.size_after&&(wp_smushit_data.size_before=void 0!==e.size_before?parseInt(wp_smushit_data.size_before)+parseInt(e.size_before):parseInt(wp_smushit_data.size_before),wp_smushit_data.size_after=void 0!==e.size_after?parseInt(wp_smushit_data.size_after)+parseInt(e.size_after):parseInt(wp_smushit_data.size_after)),void 0!==e.savings_resize&&(wp_smushit_data.size_before=void 0!==e.savings_resize.size_before?parseInt(wp_smushit_data.size_before)+parseInt(e.savings_resize.size_before):parseInt(wp_smushit_data.size_before),wp_smushit_data.size_after=void 0!==e.savings_resize.size_after?parseInt(wp_smushit_data.size_after)+parseInt(e.savings_resize.size_after):parseInt(wp_smushit_data.size_after)),void 0!==e.savings_conversion&&(wp_smushit_data.size_before=void 0!==e.savings_conversion.size_before?parseInt(wp_smushit_data.size_before)+parseInt(e.savings_conversion.size_before):parseInt(wp_smushit_data.size_before),wp_smushit_data.size_after=void 0!==e.savings_conversion.size_after?parseInt(wp_smushit_data.size_after)+parseInt(e.savings_conversion.size_after):parseInt(wp_smushit_data.size_after)))}},{key:"prepareErrorRow",value:function(e,t,n,s,i){var r='
'+(void 0===n?'':n)+''+("undefined"===t||void 0===t?"undefined":t)+''+e+"
";return"media"===i&&(r=r+'
'),r+="
"}},{key:"updateSmushIds",value:function(e){if(void 0!==wp_smushit_data.unsmushed&&wp_smushit_data.unsmushed.length>0){var t=wp_smushit_data.unsmushed.indexOf(e);t>-1&&wp_smushit_data.unsmushed.splice(t,1)}if(void 0!==wp_smushit_data.resmush&&wp_smushit_data.resmush.length>0){var n=wp_smushit_data.resmush.indexOf(e);n>-1&&wp_smushit_data.resmush.splice(n,1)}}}],(o=[{key:"setIds",value:function(){var e=[];"object"===n(e=0=jQuery("div.smush-final-log .smush-bulk-error-row").length&&jQuery("div.smush-final-log").hide(),jQuery(".bulk-smush-wrapper .wp-smush-bulk-progress-bar-wrapper, #wp-smush-running-notice").removeClass("sui-hidden"))}},{key:"singleStart",value:function(){this.is_bulk||(this.button.html(''+window.wp_smush_msgs.smushing+""),this.status.removeClass("error"))}},{key:"enableButton",value:function(){this.button.prop("disabled",!1),jQuery(".wp-smush-all").prop("disabled",!1),jQuery("button.wp-smush-scan, a.wp-smush-lossy-enable, button.wp-smush-resize-enable, button#wp-smush-save-settings").prop("disabled",!1)}},{key:"singleDone",value:function(){if(!this.is_bulk){var t=this;this.button.html(window.wp_smush_msgs.all_done),this.request.done((function(n){if(void 0!==n.data){var s=t.status.parent();e.membershipValidity(n.data),n.success?s.html(n.data):(t.status.addClass("error"),t.status.html(n.data.error_msg),t.button.html(window.smush_vars.strings.stats_label)),e.updateImageStats(n.data.new_size)}t.enableButton()})).fail((function(e){t.status.html(e.data),t.status.addClass("error"),t.enableButton()}))}}},{key:"syncStats",value:function(){var t=jQuery("div.wp-smush-bulk-progress-bar-wrapper div.wp-smush-count.tc"),n=t.html();t.html(window.wp_smush_msgs.sync_stats),jQuery.ajax({type:"GET",url:this.url,data:{action:"get_stats"},success:function(t){t&&void 0!==t&&(t=t.data,jQuery.extend(wp_smushit_data,{count_images:t.count_images,count_smushed:t.count_smushed,count_total:t.count_total,count_resize:t.count_resize,count_supersmushed:t.count_supersmushed,savings_bytes:t.savings_bytes,savings_conversion:t.savings_conversion,savings_resize:t.savings_resize,size_before:t.size_before,size_after:t.size_after}),e.updateStats(this.smush_type))}}).always((function(){return t.html(n)}))}},{key:"bulkDone",value:function(){if(this.is_bulk){this.enableButton();var e=jQuery(".sui-summary-smush .smush-stats-icon");if(0===this.ids.length)e.addClass("sui-hidden"),jQuery(".bulk-smush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation").removeClass("sui-hidden"),jQuery(".wp-smush-bulk-wrapper").addClass("sui-hidden"),jQuery(".wp-smush-bulk-progress-bar-wrapper").addClass("sui-hidden"),document.getElementById("smush-box-bulk-upgrade")&&(document.getElementById("smush-box-bulk-upgrade").classList.remove("sui-hidden"),document.getElementById("wp-smush-all-smushed-text").classList.remove("sui-hidden"),document.getElementById("wp-smush-pending-to-smush-text").classList.add("sui-hidden"));else{e.removeClass("sui-icon-loader sui-loading sui-hidden").addClass("sui-icon-info sui-warning");var t=jQuery(".bulk-smush-wrapper .wp-smush-resmush-notice");t.length>0?t.show():jQuery(".bulk-smush-wrapper .wp-smush-remaining").removeClass("sui-hidden")}jQuery(".wp-resmush.wp-smush-action, .wp-smush-scan").removeProp("disabled")}}},{key:"freeExceeded",value:function(){var e=jQuery(".wp-smush-bulk-progress-bar-wrapper");e.addClass("wp-smush-exceed-limit"),e.find(".sui-progress-block .wp-smush-cancel-bulk").addClass("sui-hidden"),e.find(".sui-progress-block .wp-smush-all").removeClass("sui-hidden"),e.find("i.sui-icon-loader").addClass("sui-icon-info").removeClass("sui-icon-loader").removeClass("sui-loading"),document.getElementById("bulk-smush-resume-button").classList.remove("sui-hidden"),document.getElementById("smush-box-bulk-upgrade")&&document.getElementById("smush-box-bulk-upgrade").classList.remove("sui-hidden")}},{key:"updateProgress",value:function(t){if(this.is_bulk_resmush||this.is_bulk){var n=0;t&&void 0!==t.data&&void 0!==t.data.stats&&e.updateLocalizedStats(t.data.stats,this.smush_type),this.is_bulk_resmush?(t.success&&(wp_smushit_data.resmush.length>0?jQuery(".wp-smush-images-remaining").html(wp_smushit_data.resmush.length):0===wp_smushit_data.resmush.length&&0===this.ids.length&&(jQuery(".bulk-resmush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation").removeClass("sui-hidden"),jQuery(".wp-smush-resmush-wrap, .wp-smush-bulk-progress-bar-wrapper").addClass("sui-hidden"))),void 0!==this.ids&&void 0!==this.total&&this.total>0&&(n=(this.smushed+this.errors.length)/this.total*100)):n=(this.smushed+this.errors.length)/this.total*100,0===this.ids.length&&("nextgen"!==this.smush_type&&this.syncStats(),jQuery(".bulk-smush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation").removeClass("sui-hidden"),jQuery(".wp-smush-bulk-wrapper").addClass("sui-hidden")),void 0!==this.ids&&e.updateRemainingCount(this.ids.length),this._updateProgress(this.smushed+this.errors.length,WP_Smush.helpers.precise_round(n,1)),0===this.ids.length&&"nextgen"!==this.smush_type||e.updateStats(this.smush_type)}}},{key:"_updateProgress",value:function(e,t){(this.is_bulk||this.is_bulk_resmush)&&(jQuery("span.wp-smush-images-percent").html(t+"%"),jQuery(".bulk-smush-wrapper .wp-smush-progress-inner").css("width",t+"%"),jQuery(".bulk-smush-wrapper .sui-progress-state-text").find("span:first-child").html(e).find("span:last-child").html(this.total))}},{key:"continue",value:function(){var e=this.button.attr("continue_smush");return void 0===e&&(e=!0),"false"!==e&&e||(e=!1),e&&this.ids.length>0&&this.is_bulk}},{key:"callAjax",value:function(){if(0!==r&&void 0!==r&&10>performance.now()-r)return this.freeExceeded(),this.deferred;var t="";this.current_id=this.is_bulk?this.ids.shift():this.button.data("id"),e.updateSmushIds(this.current_id);var n=this.button.parent().find("#_wp_smush_nonce");n&&(t=n.val());var s=this;return this.request=e.ajax(this.is_bulk_resmush,this.current_id,this.url,t).done((function(t){if(void 0===t.success||void 0!==t.success&&!1===t.success&&void 0!==t.data&&"limit_exceeded"!==t.data.error){s.errors.push(s.current_id);var n=e.prepareErrorRow(t.data.error_message,t.data.file_name,t.data.thumbnail,s.current_id,s.smush_type);s.log.show(),s.errors.length>5?jQuery(".smush-bulk-errors-actions").removeClass("sui-hidden"):s.log.find(".smush-bulk-errors").append(n)}else void 0!==t.success&&t.success&&s.smushed++;e.membershipValidity(t.data),void 0!==t.data&&"limit_exceeded"===t.data.error&&"resolved"!==s.deferred.state()?(document.getElementById("bulk_smush_warning").classList.remove("sui-hidden"),s.button.attr("continue_smush",!1),wp_smushit_data.unsmushed.unshift(s.current_id),s.ids.unshift(s.current_id),r=performance.now(),s.freeExceeded()):s.is_bulk?s.updateProgress(t):0===s.ids.length&&s.syncStats(),s.singleDone()})).always((function(){s.continue()&&s.is_bulk?s.callAjax():s.deferred.resolve()})),this.deferred.errors=this.errors,this.deferred}},{key:"run",value:function(){this.is_bulk&&this.ids.length>0&&this.callAjax(),this.is_bulk||this.callAjax()}},{key:"bindDeferredEvents",value:function(){var e=this;this.deferred.done((function(){if(e.button.removeAttr("continue_smush"),e.errors.length){var t=window.wp_smush_msgs.error_in_bulk.replace("{{errors}}",e.errors.length).replace("{{total}}",e.total).replace("{{smushed}}",e.smushed);jQuery(".wp-smush-all-done").addClass("sui-notice-warning").removeClass("sui-notice-success").find("p").html(t)}e.bulkDone(),jQuery(".wp-smush-all:not(.wp-smush-finished), .wp-smush-scan").prop("disabled",!1)}))}},{key:"cancelAjax",value:function(){var e=this;jQuery(".wp-smush-cancel-bulk").on("click",(function(){e.button.attr("continue_smush",!1),e.syncStats(),e.request.abort(),e.enableButton(),e.button.removeClass("wp-smush-started"),wp_smushit_data.unsmushed.unshift(e.current_id),jQuery(".wp-smush-bulk-wrapper").removeClass("sui-hidden"),jQuery(".wp-smush-bulk-progress-bar-wrapper").addClass("sui-hidden")}))}}])&&i(t.prototype,o),a&&i(t,a),e}();t.Z=o},442:function(){!function(){"use strict";WP_Smush.WebP={nonceField:document.getElementsByName("wp_smush_options_nonce"),toggleModuleButton:document.getElementById("smush-toggle-webp-button"),recheckStatusButton:document.getElementById("smush-webp-recheck"),recheckStatusLink:document.getElementById("smush-webp-recheck-link"),applyHtaccessButton:document.getElementById("smush-webp-apply-htaccess"),removeHtaccessButton:document.getElementById("smush-webp-remove-htaccess"),selectedServer:"",serverSelector:null,serverInstructions:[],init:function(){var e=this,t=this;if(t.serverSelector=document.getElementById("webp-server-type"),t.serverSelector){t.selectedServer=t.serverSelector.value,jQuery(t.serverSelector).on("change",(function(e){var n=e.currentTarget.value;t.hideCurrentInstructions(),t.showServerInstructions(n),t.selectedServer=n}));for(var n=document.querySelectorAll(".webp-server-instructions"),s=0;s");window.SUI.openNotice("wp-smush-webp-delete-all-error-notice",r,{type:"error",icon:"info",autoclose:{show:!1}})}},i.send("_ajax_nonce="+this.nonceField[0].value)},writeHtaccess:function(e,t){var n=this;e.preventDefault();var s=e.currentTarget;s.classList.add("sui-button-onload");var i=new XMLHttpRequest;i.open("POST",ajaxurl+"?action=smush_webp_write_htaccess_rules",!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onload=function(){s.classList.remove("sui-button-onload");var e,t=!1,r=JSON.parse(i.response);200===i.status?void 0!==r.success&&r.success&&location.reload():t=window.wp_smush_msgs.generic_ajax_error,r&&r.data&&r.data.message&&(t=r.data.message,e="warning"),t&&n.showNotice(t,e)};var r="apply"===t?"apply":"remove",o=document.getElementsByName("wp_smush_options_nonce");i.send("write_action="+r+"&_ajax_nonce="+o[0].value)},runScan:function(){var e=new XMLHttpRequest,t=document.getElementsByName("wp_smush_options_nonce");return e.open("POST",ajaxurl+"?action=scan_for_resmush",!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.send("_ajax_nonce="+t[0].value),e},showNotice:function(e,t){if(void 0!==e){var n="

".concat(e,"

"),s={type:t||"error",icon:"info",dismiss:{show:!0,label:window.wp_smush_msgs.noticeDismiss,tooltip:window.wp_smush_msgs.noticeDismissTooltip},autoclose:{show:!1}};window.SUI.openNotice("wp-smush-ajax-notice",n,s)}},maybeShowDeleteAllSuccessNotice:function(){if(document.getElementById("wp-smush-webp-delete-all-notice")){var e="

".concat(document.getElementById("wp-smush-webp-delete-all-notice").dataset.message,"

");window.SUI.openNotice("wp-smush-webp-delete-all-notice",e,{type:"success",icon:"check-tick",dismiss:{show:!0}})}},hideCurrentInstructions:function(){this.serverInstructions[this.selectedServer]&&this.serverInstructions[this.selectedServer].classList.add("sui-hidden")},showServerInstructions:function(e){void 0!==this.serverInstructions[e]&&this.serverInstructions[e].classList.remove("sui-hidden")}},WP_Smush.WebP.init()}()},445:function(e,t,n){var s,i,r;i=[n(755),n(860)],void 0===(r="function"==typeof(s=function(e){"use strict";if(!e.ui||!e.ui.fancytree){var t,n,s=null,i=new RegExp(/\.|\//),r=/[&<>"'/]/g,o=/[<>"'/]/g,a="$recursive_request",u={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},l={16:!0,17:!0,18:!0},d={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},c={16:"shift",17:"ctrl",18:"alt",91:"meta",93:"meta"},h={0:"",1:"left",2:"middle",3:"right"},p="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),f={},m="columns types".split(" "),g="checkbox expanded extraClasses folder icon iconTooltip key lazy partsel radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),v={},y={},_={active:!0,children:!0,data:!0,focus:!0};for(t=0;t=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[r,0].concat(l))),o&&!n){for(s=0,i=l.length;s=0;s--)"paging"===(i=this.children[s]).statusNodeType&&this.removeChild(i);this.partload=!1},appendSibling:function(e){return this.addNode(e,"after")},applyCommand:function(e,t){return this.tree.applyCommand(e,this,t)},applyPatch:function(t){if(null===t)return this.remove(),N(this);var n,s,i={children:!0,expanded:!0,parent:!0};for(n in t)t.hasOwnProperty(n)&&(s=t[n],i[n]||e.isFunction(s)||(v[n]?this[n]=s:this.data[n]=s));return t.hasOwnProperty("children")&&(this.removeChildren(),t.children&&this._setChildren(t.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),t.hasOwnProperty("expanded")?this.setExpanded(t.expanded):N(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,n){return e.addNode(this.toDict(!0,n),t)},countChildren:function(e){var t,n,s,i=this.children;if(!i)return 0;if(s=i.length,!1!==e)for(t=0,n=s;t=4&&(Array.prototype.unshift.call(arguments,this.toString()),b("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){var t=e?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(t,this)},error:function(e){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),b("error",arguments))},findAll:function(t){t=e.isFunction(t)?t:D(t);var n=[];return this.visit((function(e){t(e)&&n.push(e)})),n},findFirst:function(t){t=e.isFunction(t)?t:D(t);var n=null;return this.visit((function(e){if(t(e))return n=e,!1})),n},findRelatedNode:function(e,t){return this.tree.findRelatedNode(this,e,t)},_changeSelectStatusAttrs:function(e){var t=!1,n=this.tree.options,i=s.evalOption("unselectable",this,this,n,!1),r=s.evalOption("unselectableStatus",this,this,n,void 0);switch(i&&null!=r&&(e=r),e){case!1:t=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:t=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:t=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:w(!1,"invalid state: "+e)}return t&&this.renderStatus(),t},fixSelection3AfterClick:function(e){var t=this.isSelected();this.visit((function(e){if(e._changeSelectStatusAttrs(t),e.radiogroup)return"skip"})),this.fixSelection3FromEndNodes(e)},fixSelection3FromEndNodes:function(e){var t=this.tree.options;function n(e){var i,r,o,a,u,l,d,c,h=e.children;if(h&&h.length){for(l=!0,d=!1,i=0,r=h.length;i=0},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(e){this.tree.options.debugLevel>=3&&(Array.prototype.unshift.call(arguments,this.toString()),b("info",arguments))},isActive:function(){return this.tree.activeNode===this},isBelowOf:function(e){return this.getIndexHier(".",5)>e.getIndexHier(".",5)},isChildOf:function(e){return this.parent&&this.parent===e},isDescendantOf:function(t){if(!t||t.tree!==this.tree)return!1;for(var n=this.parent;n;){if(n===t)return!0;n===n.parent&&e.error("Recursive parent link: "+n),n=n.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var e=this.parent;return!e||e.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var e=this.parent;return!e||e.children[e.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||void 0!==this.hasChildren()},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartsel:function(){return!this.selected&&!!this.partsel},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return void 0===this.hasChildren()},isVisible:function(){var e,t,n=this.tree.enableFilter,s=this.getParentList(!1,!1);if(n&&!this.match&&!this.subMatchCount)return this.debug("isVisible: HIDDEN ("+n+", "+this.match+", "+this.match+")"),!1;for(e=0,t=s.length;e