import{r as p,b as g,j as s,L as i,F as f,aP as j}from"./index-DtyjNqrf.js";import{F as b,g as h}from"./Feature-VsMzzVJz.js";import{L as u}from"./LastSeen-CvhRQlEh.js";import{L as w}from"./Lqi-CoNVuBvb.js";import{P as N}from"./PowerSource-DgFKG_xU.js";import{D as y}from"./DeviceImage-D-FjKeE6.js";const D=p.memo(({onChange:o,onRead:n,device:e,endpoint:r,deviceState:a,lastSeenConfig:m,features:c,featureWrapperClass:d,children:x})=>{const{t}=g(["zigbee","devicePage"]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"card-body p-2",children:[s.jsxs("div",{className:"flex flex-row items-center gap-3 w-full",children:[s.jsx("div",{className:"flex-none h-11 w-11 overflow-visible",children:s.jsx(y,{disabled:!1,device:e,otaState:a.update?.state})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs(i,{to:`/device/${e.ieee_address}/info`,className:"link link-hover",children:[e.friendly_name,r?` (${t("endpoint")}: ${r})`:""]}),e.description&&s.jsx("div",{className:"text-xs opacity-50 truncate",title:e.description,children:e.description})]})]}),s.jsxs("div",{className:"text-sm w-full p-2",children:[c.map(l=>(!r||!l.endpoint||l.endpoint===r)&&s.jsx(b,{feature:l,device:e,deviceState:a,onChange:o,onRead:n,featureWrapperClass:d,minimal:!0,parentFeatures:[]},h(l))),s.jsxs("div",{className:"flex flex-row items-center gap-1 mt-3",children:[s.jsx("div",{className:"grow-1"}),s.jsxs(i,{to:`/device/${e.ieee_address}/exposes`,className:"btn btn-xs",children:[t("devicePage:exposes")," ",s.jsx(f,{icon:j,size:"lg"})]})]})]})]}),s.jsxs("div",{className:"flex flex-row flex-wrap gap-1 mx-2 mb-2 justify-around items-center",children:[s.jsx("span",{className:"badge badge-soft badge-ghost cursor-default",title:t("last_seen"),children:s.jsx(u,{lastSeen:a.last_seen,config:m})}),s.jsx("span",{className:"badge badge-soft badge-ghost cursor-default",title:t("lqi"),children:s.jsx(w,{value:a.linkquality})}),s.jsx("span",{className:"badge badge-soft badge-ghost cursor-default",title:t("power"),children:s.jsx(N,{device:e,batteryPercent:a.battery,batteryState:a.battery_state,batteryLow:a.battery_low,showLevel:!0})}),x]})]})});export{D};
