var ACF_Upload_Backend=function(){function e(){this.editingItem=null,this.removeNamesFromModal(),this.initEvents()}var t=e.prototype;return t.removeNamesFromModal=function(){var e=this.getModal();e&&e.querySelectorAll("input").forEach(function(e){e.removeAttribute("name")})},t.initEvents=function(){var t=this;document.addEventListener("click",function(e){t.onEditTrigger(e),t.onSave(e)})},t.onEditTrigger=function(e){var t=e.target.closest(".acfupload-edit-item");if(t){this.editingItem=t.closest(".cfup-file");var o=this.editingItem.querySelector(".cfup-details .cfup-name").innerHTML;this.getModal().querySelector(".acfupload-edit-modal-editing-item-name").innerHTML=o;var i=this.editingItem.querySelector(".cfup-custom-title").value;this.getModal().querySelector(".acfupload_custom_title_value").value=i;var a=this.editingItem.querySelector(".cfup-custom-description").value;this.getModal().querySelector(".acfupload_custom_description_value").value=decodeURIComponent(a)}},t.onSave=function(e){var t=e.target.closest(".acf-upload-save-item");if(t){var o=t.closest("#acfUploadItemEditModal").querySelector(".acfupload_custom_title_value").value;this.editingItem.querySelector(".cfup-custom-title").value=o;var i=t.closest("#acfUploadItemEditModal").querySelector(".acfupload_custom_description_value").value;this.editingItem.querySelector(".cfup-custom-description").value=i}},t.getModal=function(){return document.querySelector("#acfUploadItemEditModal")},e}();document.addEventListener("DOMContentLoaded",function(){new ACF_Upload_Backend});

