jQuery((function(e){e(document).on("change",".sp-pagebuilder-control-padding",(function(o){var a="",s=e(this);e(this).closest(".sp-pagebuilder-paddings-list").find(">div").each((function(o){a+=e(this).find(".sp-pagebuilder-control-padding").val()+" "})),s.closest(".sp-pagebuilder-paddings-list").prev().val(e.trim(a))})),e(document).on("change",".sp-pagebuilder-control-margin",(function(o){var a="",s=e(this);e(this).closest(".sp-pagebuilder-margins-list").find(">div").each((function(o){a+=e(this).find(".sp-pagebuilder-control-margin").val()+" "})),s.closest(".sp-pagebuilder-margins-list").prev().val(e.trim(a))})),e(document).on("click",".sp-pagebuilder-btn-clear-media",(function(o){o.preventDefault();var a=e(this);a.siblings(".sp-pagebuilder-media-preview").addClass("sp-pagebuilder-media-no-image").removeAttr("src"),a.siblings("input").val("")}));var o={};e.fn.openPopupAlt=function(){e("#page-options").addClass("sp-pagebuilder-modal-overlay-after-open"),e("#page-options").find(".sp-pagebuilder-modal-content").addClass("sp-pagebuilder-modal-content-after-open"),e("body").addClass("sp-pagebuilder-modal-open"),e(".sp-pagebuilder-modal-alt .form-group").find(">input,>textarea,>select").each((function(){o[e(this).attr("id")]=e(this).val()}))},e.fn.closePopupAlt=function(a){var s=e.extend({reset:!1},a);return e("#page-options").addClass("sp-pagebuilder-modal-overlay-before-close"),e("#page-options").find(".sp-pagebuilder-modal-content").addClass("sp-pagebuilder-modal-content-before-close"),e("#page-options").removeClass("sp-pagebuilder-modal-overlay-before-close sp-pagebuilder-modal-overlay-after-open"),e("#page-options").find(".sp-pagebuilder-modal-content").removeClass("sp-pagebuilder-modal-content-before-close sp-pagebuilder-modal-content-after-open"),e("body").removeClass("sp-pagebuilder-modal-open"),s.reset&&e(".sp-pagebuilder-modal-alt .form-group").find(">input,>textarea,>select").each((function(){e(this).val(o[e(this).attr("id")]),"jform_og_image"==e(this).attr("id")&&""!=o[e(this).attr("id")]&&e(this).prev(".sppb-media-preview").removeClass("no-image").attr("src",pagebuilder_base+o[e(this).attr("id")])})),this},e("#btn-page-options").on("click",(function(o){o.preventDefault(),e().openPopupAlt()})),e(document).on("click",".sp-pagebuilder-modal-alt .sp-pagebuilder-modal-content-after-open",(function(o){o.target===this&&e().closePopupAlt({reset:!0})})),e(document).on("click","#btn-cancel-page-options",(function(o){o.preventDefault(),e().closePopupAlt({reset:!0})})),e(document).on("click","#btn-apply-page-options",(function(o){e().closePopupAlt()})),e(document).on("click",".sp-pagebuilder-fontawesome-icon-input",(function(o){o.preventDefault(),e(this).closest(".sp-pagebuilder-fontawesome-icon-chooser").toggleClass("open"),e(this).closest(".sp-pagebuilder-fontawesome-icon-chooser").hasClass("open")&&e(this).closest(".sp-pagebuilder-fontawesome-icon-chooser").find('input[type="text"]').focus()})),e(document).on("click",".sp-pagebuilder-fa-list-icon",(function(o){o.preventDefault();var a=e(this),s=a.closest(".sp-pagebuilder-fontawesome-icon-chooser");e(this).closest("ul").find(">li").removeClass("active"),a.addClass("active"),s.find(".sp-pagebuilder-fontawesome-icon-input>span").html('<i class="fa '+a.data("fontawesome_icon")+'"></i> '+a.data("fontawesome_icon_name")),s.find(".sp-pagebuilder-addon-input-fa").val(a.data("fontawesome_icon_name")),s.addClass("sp-pagebuilder-has-fa-icon").removeClass("open")})),e(document).on("keyup",'.sp-pagebuilder-fontawesome-dropdown input[type="text"]',(function(){var o=e(this).val(),a=new RegExp(".*?"+o+".*?","i");e(this).next(".sp-pagebuilder-fontawesome-icons").children().each((function(){var o=a.test(e("span",this).text());e(this).toggle(o)}))})),e(document).on("click",".sp-pagebuilder-remove-fa-icon",(function(o){o.stopPropagation(),o.preventDefault();var a=e(this).closest(".sp-pagebuilder-fontawesome-icon-chooser");a.removeClass("sp-pagebuilder-has-fa-icon"),a.find(".sp-pagebuilder-fontawesome-icon-input>span").html("--"+Joomla.JText._("COM_SPPAGEBUILDER_ADDON_ICON_SELECT")+"--"),a.find(".sp-pagebuilder-fontawesome-icons>li").removeClass("active"),a.find(".sp-pagebuilder-addon-input-fa").val("")})),e(".com_sppagebuilder #sp-pagebuilder-page-tools").length>0&&e(window).on("scroll",(function(){if(e(window).scrollTop()>220){var o=e(".com_sppagebuilder #sp-pagebuilder-page-tools > div");e(".com_sppagebuilder #sp-pagebuilder-page-tools").addClass("fixed-sp-page-tools"),e(".com_sppagebuilder #sp-pagebuilder-page-tools").css({height:o.outerHeight()})}else e(".com_sppagebuilder #sp-pagebuilder-page-tools").removeClass("fixed-sp-page-tools"),e(".com_sppagebuilder #sp-pagebuilder-page-tools").css({height:"auto"})}))}));