document.addEventListener("DOMContentLoaded",()=>{var r;const e=window.softwareLicensesConfig;if(!e)return;const o=((r=document.querySelector('meta[name="csrf-token"]'))==null?void 0:r.content)||"";document.querySelectorAll(".js-revoke-license").forEach(t=>{t.addEventListener("click",async()=>{if(!confirm(e.translations.confirm_revoke))return;const s=t.closest("tr").dataset.licenseId;(await fetch(e.routes.revoke.replace(":id",s),{method:"POST",headers:{"X-CSRF-TOKEN":o,Accept:"application/json"}})).ok?window.location.reload():alert(e.translations.request_failed)})}),document.querySelectorAll(".js-delete-license").forEach(t=>{t.addEventListener("click",async()=>{if(!confirm(e.translations.confirm_delete))return;const s=t.closest("tr").dataset.licenseId;(await fetch(e.routes.destroy.replace(":id",s),{method:"DELETE",headers:{"X-CSRF-TOKEN":o,Accept:"application/json"}})).ok?t.closest("tr").remove():alert(e.translations.request_failed)})})});
