function k({title:d="Confirm action",body:i="Are you sure?",ok:v="Yes, proceed",cancel:g="Keep it",danger:r=!0}={}){return new Promise(a=>{const e=document.getElementById("sched-confirm");if(!e){a(window.confirm(`${d}

${i}`));return}const l=document.getElementById("sched-confirm-title"),m=document.getElementById("sched-confirm-body"),t=document.getElementById("sched-confirm-ok"),c=document.getElementById("sched-confirm-cancel"),s=document.getElementById("sched-confirm-icon");l&&(l.textContent=d),m&&(m.textContent=i),t&&(t.textContent=v),c&&(c.textContent=g),t&&(t.classList.remove("bg-accent-coral","bg-wa-deep"),t.classList.add(r?"bg-accent-coral":"bg-wa-deep")),s&&(s.classList.remove("bg-accent-coral/15","text-accent-coral","bg-wa-deep/10","text-wa-deep"),s.classList.add(...r?["bg-accent-coral/15","text-accent-coral"]:["bg-wa-deep/10","text-wa-deep"]));const o=n=>{e.classList.add("hidden"),e.classList.remove("flex"),t?.removeEventListener("click",f),c?.removeEventListener("click",E),e.removeEventListener("click",u),document.removeEventListener("keydown",L),a(n)},f=()=>o(!0),E=()=>o(!1),u=n=>{n.target===e&&o(!1)},L=n=>{n.key==="Escape"?o(!1):n.key==="Enter"&&o(!0)};t?.addEventListener("click",f),c?.addEventListener("click",E),e.addEventListener("click",u),document.addEventListener("keydown",L),e.classList.remove("hidden"),e.classList.add("flex"),c?.focus()})}export{k as s};
