import{w as h,M as j,b as f,r as m,j as e,O as _,B as i,F as u,Q as p}from"./index-DtyjNqrf.js";import{C as b}from"./CheckboxField-DKhAwA85.js";import{I as k}from"./InputField-CYbmpJqW.js";const D=h.create(c=>{const{device:o,removeDevice:s}=c,t=j(),{t:n}=f(["zigbee","common"]),[a,r]=m.useState({block:!1,force:!1}),d=v=>{const{checked:x,name:l}=v.target;r({...a,[l]:x})};return e.jsx(_,{isOpen:t.visible,title:`${n("remove_device")} ${o.friendly_name}`,footer:e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"btn btn-neutral",onClick:t.remove,children:n("common:cancel")}),e.jsx(i,{className:"btn btn-error ms-1",onClick:async()=>{t.remove(),await s(o.ieee_address,a.force,a.block)},children:n("common:delete")})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(b,{label:n("force_remove"),name:"force",onChange:d,checked:a.force}),e.jsx("span",{className:"text-xs opacity-50",children:n("force_remove_notice")}),e.jsx(b,{label:n("block_join"),name:"block",onChange:d,checked:a.block})]})})}),g=h.create(c=>{const{homeassistantEnabled:o,name:s,renameDevice:t}=c,n=j(),{t:a}=f(["zigbee","common"]),[r,d]=m.useState(!1),[v,x]=m.useState(s);return m.useEffect(()=>{x(s)},[s]),e.jsx(_,{isOpen:n.visible,title:`${a("rename_device")} ${s}`,footer:e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"btn btn-neutral",onClick:n.remove,children:a("common:cancel")}),e.jsx(i,{className:"btn btn-primary ms-1",onClick:async()=>{n.remove(),await t(s,v,r)},children:a("rename_device")})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(k,{name:"friendly_name",label:a("common:friendly_name"),onChange:l=>x(l.target.value),value:v,type:"text"}),o&&e.jsx(b,{label:a("update_Home_assistant_entity_id"),name:"update_Home_assistant_entity_id",onChange:l=>d(l.target.checked),checked:r})]})})}),R=m.memo(c=>{const{homeassistantEnabled:o,name:s,renameDevice:t,style:n}=c,{t:a}=f("zigbee");return e.jsx(i,{className:`btn ${n}`,onClick:async()=>await h.show(g,{name:s,renameDevice:t,homeassistantEnabled:o}),title:a("rename_device"),children:e.jsx(u,{icon:p})})});export{R as D,D as R};
