jQuery(function(s){jQuery("body").on("click","a.dlm_insert_download",function(){return tb_show(dlm_id_strings.insert_download,"media-upload.php?type=add_download&from=wpdlm01&TB_iframe=true&height=200"),!1}),jQuery("body").on("click",".dlm-extension-filtering a",function(e){e.preventDefault();const t=jQuery(this).attr("id"),n=jQuery(".dlm_extensions .feature-list > .feature-block").not(".free-extension"),o=jQuery(".dlm_extensions .feature-list > .feature-block.free-extension"),i=jQuery(this).parents(".dlm-extension-filtering").find("li").not(jQuery(this).parent());jQuery(this).parent().addClass("active-section"),i.removeClass("active-section"),"free-extensions"===t?(o.show(),n.hide()):("pro-extensions"===t?o.hide():o.show(),n.show())}),s(document).on("click","#dlm-protect-file",function(e){e.preventDefault();const n=s(this).data(),o=s(this),i=o.text(),t={action:"protect_file"===n.action?"dlm_protect_file":"dlm_unprotect_file",_ajax_nonce:n.nonce,user_id:n.user_id,file:n.file,attachment_id:n.post_id};o.attr("disabled","disabled"),o.text("Please wait..."),s.post(ajaxurl,t,function(e){if(e.success){o.text(e.data.text),e.data.url&&(o.parents(".attachment-info").find("#attachment-details-two-column-copy-link").val(e.data.url),jQuery("#attachment_url").val(e.data.url));const t="protect_file"===n.action?"unprotect_file":"protect_file";o.data("action",t),setTimeout(function(){var e="protect_file"==t?"Protect File":"Unprotect File";o.text(e),o.removeAttr("disabled")},3e3)}else o.text(e.data),setTimeout(function(){o.text(i),o.removeAttr("disabled")},3e3)})}),jQuery(".dlm-dropdown-select-settings").on("click",function(e){e.stopPropagation(),jQuery(this).parent().find(".dlm-dropdown-select-settings__body").toggleClass("dlm-dropdown-select-settings__body--open")}),jQuery('.dlm-dropdown-select-wrapper__settings input[type="checkbox"]').on("change",function(e){e.stopPropagation(),e.preventDefault();const t=jQuery(this).parents(".dlm-dropdown-select-wrapper__settings").find('input[type="checkbox"]'),n=jQuery(this).parents(".dlm-dropdown-select-wrapper").attr("id");let o=[];Object.values(t).forEach(e=>{($element=jQuery(e)).is(":checked")&&o.push($element.val())});e={action:"dlm_save_dropdown_select_settings_"+n,_ajax_nonce:dlm_ajax_nonce,options:o};jQuery.post(ajaxurl,e,function(e){e.success&&jQuery(document).trigger("dlm_after_dropdown_select_save_"+n,[e,o])})})}),jQuery(document).ready(function(){void 0!==wp.media&&(wp.media.view.Attachment.Library=wp.media.view.Attachment.Library.extend({className:function(){let e="attachment";return"undefined"!==this.model.get("dlmCustomClass")&&(e+=" "+this.model.get("dlmCustomClass")),"undefined"!==this.model.get("customClass")&&(e+=" "+this.model.get("customClass")),jQuery(document).trigger("dlm_custom_attachment_class",[this.model,e]),e}}))});