'),i.parents("#slide-"+i.data("slideId")).find(".ms-delete-status").remove(),i.parents("#slide-"+i.data("slideId")).find(".delete-slide").focus(),e.ajax({url:metaslider.ajaxurl,data:s,type:"POST",error:function(e){$slide=i.parents("#slide-"+i.data("slideId")),$slide.removeClass("ms-restoring").addClass("ms-deleted"),$slide.find(".ms-delete-overlay").remove(),e.responseJSON?alert(e.responseJSON.data.message):alert("There was an error with the server and the action could not be completed.")},success:function(t){$slide=i.parents("#slide-"+i.data("slideId")),$slide.addClass("ms-restored"),$slide.removeClass("ms-deleting").find(".undo-delete-slide, .trash-view-restore").remove(),$slide.find(".ms-delete-overlay").remove(),e("#slide-"+i.data("slideId")+" h4").after(''+metaslider.restored_language+""),e("#slide-"+i.data("slideId")).find(".row-actions.trash-btns").html("");var s=$slide.find(".thumb").css("background-image").replace(/^url\(["']?/,"").replace(/["']?\)$/,"");s=window.location.href===s?"":s}})})),e(".metaslider").on("click",".trash-view-permanent",(function(t){t.preventDefault();var i=e(this),s={action:"permanent_delete_slide",_wpnonce:metaslider.permanent_delete_slide_nonce,slide_id:i.data("slideId")};i.parents("#slide-"+i.data("slideId")).removeClass("ms-restored").addClass("ms-deleting").append('
'),i.parents("#slide-"+i.data("slideId")).find(".ms-delete-status").remove(),e.ajax({url:metaslider.ajaxurl,data:s,type:"POST",error:function(e){alert(e.responseJSON.data.message),$slide=i.parents("#slide-"+i.data("slideId")),$slide.removeClass("ms-deleting"),$slide.find(".ms-delete-overlay").remove()},success:function(t){setTimeout((function(){$slide=i.parents("#slide-"+i.data("slideId")),$slide.addClass("ms-deleted").removeClass("ms-deleting").find(".metaslider-ui-controls").append('");var t=$slide.find(".thumb").css("background-image").replace(/^url\(["']?/,"").replace(/["']?\)$/,"");t=window.location.href===t?"":t,"none"==e(".restore-slide-link").css("display")&&e(".restore-slide-link").css("display","inline")}),1e3)}})}));var w=function(t){return new Promise((function(i,s){var a=e("input.width").val(),n=e("input.height").val(),l=t.attr("data-width"),d=t.attr("data-height"),r=t.closest("tr"),o=r.data("crop_changed"),c=parseInt(e("select.cropMultiply").val()),m=parseInt(e("select.cropMultiply").attr("data-value"));if(l!=a||d!=n||o||c!==m){t.attr("data-width",a),t.attr("data-height",n);var u={action:"resize_image_slide",slider_id:window.parent.metaslider_slider_id,slide_id:t.attr("data-slide_id"),_wpnonce:metaslider.resize_nonce};e.ajax({type:"POST",data:u,async:!1,cache:!1,url:metaslider.ajaxurl,success:function(e){o&&r.data("crop_changed",!1),e.data&&e.data.thumbnail_url_small&&t.closest("tr.slide").trigger("metaslider/attachment/updated",e.data),i(e)},error:function(e){s(e)}})}else i("No resizing needed.")}))};e(".metaslider").on("resizeSlides","table#metaslider-slides-list",(function(t){e("tr.slide input[name='resize_slide_id']",this).each((function(){w(e(this))}))})),e(".metaslider").on("click","tr.slide button.recrop_image",(function(i){var s,a=e(this),n=a.closest("tr").find("input[name='resize_slide_id']");a.attr("disabled",!0),(s=n,new Promise((function(t,i){var a=s.attr("data-slide_id"),n=s.closest("tr"),l=n.find(".crop_position").val();if(l.length>0){var d={action:"crop_position_image_slide",slide_id:a,crop_position:l,_wpnonce:metaslider.resize_nonce};e.ajax({type:"POST",data:d,async:!1,cache:!1,url:metaslider.ajaxurl,success:function(e){n.data("crop_changed",!0),t(e)},error:function(e){i(e)}})}else t("Can't save new crop position.")}))).then((function(e){return console.log("New crop position saved"),w(n)})).then((function(e){setTimeout((function(){a.attr("disabled",!1),t&&t.notifySuccess("metaslider/slide-updated",t.__("Crop position saved and image cropped","ml-slider"),!0)}),1e3)})).catch((function(e){console.error("There was an error when saving crop position or cropping the image:",e),e instanceof Error&&e.message.includes("crop_position_single_slide_image")&&console.error("There was an error when trying to save new crop position:",e),setTimeout((function(){t&&t.notifyError("metaslider/slide-update-failed",t.__("There was an error when saving crop position or cropping the image","ml-slider"),!0)}),1e3)}))}));var y=function(){e(".tipsy-tooltip").tipsy({className:"msTipsy",live:!1,delayIn:500,html:!0,gravity:"e"}),e(".tipsy-tooltip-top").tipsy({live:!1,delayIn:500,html:!0,gravity:"s"}),e(".tipsy-tooltip-bottom").tipsy({live:!1,delayIn:500,html:!0,gravity:"n"}),e(".tipsy-tooltip-bottom-toolbar").tipsy({live:!1,delayIn:500,html:!0,gravity:"n",offset:2})};y();const b=e("#metaslider-slides-list");if(b.length){const e={childList:!0,subtree:!0};new MutationObserver((function(e,t){for(const t of e)"childList"===t.type&&t.addedNodes.length>0&&y()})).observe(b[0],e)}if(e("#sampleslider-btn").on("click",(function(){window.location.href=e("#sampleslider-options").val()})),window.location.href.indexOf("withcaption")>-1&&e("input[value='override']").attr("checked",!0).trigger("click"),e("#quickstart-browse-button").click((function(){window.create_slides.open()})),e("#slideshows-list").length&&e("#search_slideshow-search-input").length){var x=e("#search_slideshow-search-input").val();""!=x&&e("#slideshows-list .pagination-links a").each((function(){this.href=this.href+"&s="+x}))}"disabled"==e('select[name="settings[smartCrop]"]').val()?e('input[name="settings[smoothHeight]"]').closest("tr").show():e('input[name="settings[smoothHeight]"]').closest("tr").hide(),e('select[name="settings[smartCrop]"]').change((function(){"disabled"==e(this).val()?e('input[name="settings[smoothHeight]"]').closest("tr").show():(e('input[name="settings[smoothHeight]"]').closest("tr").hide(),e('input[name="settings[smoothHeight]"]').prop("checked",!1))})),e(document).on("click",".ml-legacy-notice .notice-dismiss",(function(){var t={action:"legacy_notification",notif_status:"hide",_wpnonce:metaslider.legacy_notification_nonce};e.ajax({url:metaslider.ajaxurl,data:t,type:"POST",error:function(e){console.log("Something went wrong:"+e)},success:function(e){console.log(e)}})})),e(".copy-shortcode").click((function(){var t=e(this).text();if(window.isSecureContext)navigator.clipboard.writeText(t);else{var i=e("");e("body").append(i),i.val(t).select(),document.execCommand("Copy"),i.remove()}e(this).next(".copy-message").fadeIn().delay(1e3).fadeOut()}));window.metaslider.after_adding_slide_success=function(t){var i=e(".metaslider table#metaslider-slides-list");"last"===window.metaslider.newSlideOrder?i.append(t.html):i.prepend(t.html),e("html, body").animate({scrollTop:"last"===window.metaslider.newSlideOrder?e(e("#slide-"+t.slide_id)).offset().top:0},2e3);var s=window.metaslider.app.MetaSlider;e(".media-modal-close").click(),setTimeout((function(){s&&s.notifySuccess("metaslider/slides-created",s.__("1 slide added successfully","ml-slider"),!0),setTimeout((function(){s&&s.triggerEvent("metaslider/save")}),1e3)}),1e3)},window.metaslider.after_importing_slides_success=function(t){if(t){var i=e(".metaslider table#metaslider-slides-list");t.forEach((function(e){"last"===window.metaslider.newSlideOrder?i.prepend(e.html):i.append(e.html)})),e("#loading-add-sample-slides-notice").hide();var s=window.metaslider.app.MetaSlider;setTimeout((function(){if(s){const e=1==t.length?s.__("1 slide added successfully","ml-slider"):s.__("%s slides added successfully");s.notifySuccess("metaslider/slides-created",s.sprintf(e,t.length),!0)}setTimeout((function(){s&&s.triggerEvent("metaslider/save")}),1e3)}),1e3)}else console.error("No data found!")};var k=function(i){var s=t&&t.__("Device options are enabled for this slide. Adjust using the Device tab.","ml-slider"),a=e("#metaslider-slides-list #"+i+" .mobile-checkbox:checked"),n='',l=e("#metaslider-slides-list #"+i+" .slide-details .mobile_setting_enabled");a.length>0?0==l.length&&e("#metaslider-slides-list #"+i+" .slide-details").append(n):l.remove()};e("#metaslider-slides-list > tbody > tr").each((function(){var t=e(this).attr("id");k(t)})),e(".metaslider").on("click",".mobile-checkbox",(function(){var t=e(this).attr("name").replace(/[^0-9]/g,"");k("slide-"+t)})),e(".slidethumb").each((function(){var t=1,i=e(this);setInterval((function(){t=i.find(":nth-child("+t+")").fadeOut().next().length?t+1:1,i.find(":nth-child("+t+")").fadeIn()}),2e3)}));-1!==window.location.href.indexOf("metaslider_add_sample_slides_after")&&setTimeout((function(){t&&t.triggerEvent("metaslider/save")}),1e3),e(".open-modal").on("click",(function(){event.preventDefault();let t=e(this).data("id");e("#modal-"+t).fadeIn(),e("#overlay-"+t).fadeIn()})),e(".close-modal, .modal-overlay").on("click",(function(){let t=e(this).data("id")||e(this).attr("id").replace("overlay-","");e("#modal-"+t).fadeOut(),e("#overlay-"+t).fadeOut()})),e(".metaslider").on("click","button.hide-slide input[type=checkbox]",(function(e){e.stopPropagation()})),e(".metaslider").on("click","button.hide-slide",(function(t){t.stopPropagation(),e(this).find("input[type=checkbox]").trigger("click"),e(this).closest("tr.slide").toggleClass("slide-is-hidden",e(this).find("input[type=checkbox]").is(":checked"))})),e(".metaslider button.hide-slide input[type=checkbox]").each((function(t){e(this).closest("tr.slide").toggleClass("slide-is-hidden",e(this).is(":checked"))}));e(".ms-settings-box").each((function(){var t=e(this),i=!!t.hasClass("ms-on"),s=t.find(".ms-settings-box-inner");i?s.show():s.hide()})),e(".disabled-checkbox, .disabled-text").each((function(){e(this).attr("disabled",!0)})),e(".ms-loading-settings").remove(),e(".ms-settings-table").fadeIn(),e(".ms-highlight").on("click",(function(t){t.preventDefault();var i=e(this).parents(".ms-settings-box"),s=!!i.hasClass("ms-on"),a=i.find(".ms-settings-box-inner");i.removeClass("ms-on ms-off"),s?(a.hide(),i.addClass("ms-off")):(a.show(),i.addClass("ms-on"))}))}));var MetaSlider_Helpers={capitalize:function(e){return e.replace(/\b\w/g,(function(e){return e.toUpperCase()}))}};