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