(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,a,o;return n=t,(a=[{key:"init",value:function(){var e=$("#table-backups");e.on("click",".deleteDialog",(function(e){e.preventDefault(),$(".delete-crud-entry").data("section",$(e.currentTarget).data("section")),$(".modal-confirm-delete").modal("show")})),e.on("click",".restoreBackup",(function(e){e.preventDefault(),$("#restore-backup-button").data("section",$(e.currentTarget).data("section")),$("#restore-backup-modal").modal("show")})),$(".delete-crud-entry").on("click",(function(t){t.preventDefault(),$(".modal-confirm-delete").modal("hide");var n=$(t.currentTarget).data("section");$httpClient.make().delete(n).then((function(t){var a=t.data;e.find("tbody tr").length<=1&&e.load(window.location.href+" #table-backups > *"),e.find('button[data-section="'.concat(n,'"]')).closest("tr").remove(),Botble.showSuccess(a.message)}))})),$("#restore-backup-button").on("click",(function(e){e.preventDefault();var t=$(e.currentTarget);Botble.showButtonLoading(t),$httpClient.make().get(t.data("section")).then((function(e){var n=e.data;t.closest(".modal").modal("hide"),Botble.showSuccess(n.message),window.location.reload()})).finally((function(){Botble.hideButtonLoading(t)}))})),$(document).on("click","#generate_backup",(function(e){e.preventDefault(),$("#name").val(""),$("#description").val(""),$("#create-backup-modal").modal("show")})),$("#create-backup-modal").on("click","#create-backup-button",(function(t){t.preventDefault();var n=$(t.currentTarget),a=n.closest("form");$httpClient.make().withButtonLoading(n).post(a.prop("action"),new FormData(a[0])).then((function(t){var n=t.data;e.find(".no-backup-row").remove(),e.find("tbody").append(n.data),Botble.showSuccess(n.message)})).finally((function(){n.closest(".modal").modal("hide")}))}))}}])&&e(n.prototype,a),o&&e(n,o),Object.defineProperty(n,"prototype",{writable:!1}),t}();$((function(){(new t).init()}))})();