import{g as c,r as d}from"./api-DZ3cXm1m.js";const s=window.bulkWhoisPrivacyConfig||{};function a(e,t){const n=document.getElementById("bulkWhoisResult");n&&(n.style.display="block",n.className=`mt-2 alert alert-${t} py-2 small`,n.textContent=e)}async function r(e){const t=e==="enable"?s.translations.confirmEnable:s.translations.confirmDisable;if(!confirm(t))return;const n=document.getElementById("bulkWhoisEnableBtn"),i=document.getElementById("bulkWhoisDisableBtn");n.disabled=!0,i.disabled=!0,a(s.translations.processing,"info");try{const o=await fetch(s.routes.bulkWhoisPrivacy,{method:"POST",headers:{Authorization:`Bearer ${c()}`,Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({action:e})});if(o.status===401&&await d())return n.disabled=!1,i.disabled=!1,r(e);const l=await o.json();l.success?a(l.message,"success"):a(l.message||"Operation failed","danger")}catch{a("Network error. Please try again.","danger")}finally{n.disabled=!1,i.disabled=!1}}document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("bulkWhoisEnableBtn"),t=document.getElementById("bulkWhoisDisableBtn");e&&e.addEventListener("click",function(){r("enable")}),t&&t.addEventListener("click",function(){r("disable")})});
