import{T as h,dC as p,dG as u,dq as t,dm as o,N as C,B as d}from"./index-DjbVAZHL.js";import{C as f}from"./CheckboxField-h2bgaDmU.js";const g=h.create(({sourceIdx:l,device:r,removeDevice:m})=>{const s=p(),{t:a}=u(["zigbee","common"]),[n,k]=t.useState({block:!1,force:!1}),i=t.useCallback(e=>{const{checked:c,name:v}=e.target;k(x=>({...x,[v]:c}))},[]),b=t.useCallback(async()=>{s.remove(),await m(l,r.ieee_address,n.force,n.block)},[l,s,m,r.ieee_address,n]);return t.useEffect(()=>{const e=c=>{c.key==="Escape"&&(c.preventDefault(),s.remove())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s]),o.jsx(C,{isOpen:s.visible,title:`${a(e=>e.remove_device)} ${r.friendly_name}`,footer:o.jsxs(o.Fragment,{children:[o.jsx(d,{className:"btn btn-neutral",onClick:s.remove,children:a(e=>e.cancel,{ns:"common"})}),o.jsx(d,{className:"btn btn-error ms-1",onClick:b,children:a(e=>e.delete,{ns:"common"})})]}),children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(f,{label:a(e=>e.force_remove),name:"force",onChange:i,checked:n.force}),o.jsx("span",{className:"text-xs opacity-50",children:a(e=>e.force_remove_notice)}),o.jsx(f,{label:a(e=>e.block_join),name:"block",onChange:i,checked:n.block})]})})});export{g as R};
