import{dG as g,F as v,dq as C,dm as o,o as r,B as F,cF as N}from"./index-D_pphaE2.js";import{s as w}from"./startCase-BsTKbnbP.js";import{g as $}from"./index-BhIhHSRV.js";function k(n){return n.type==="composite"&&(n.name==="color_xy"||n.name==="color_hs")}function q({children:n,feature:s,deviceValue:m,onRead:l,endpointSpecific:d,parentFeatures:c}){const{t:x}=g("zigbee"),b=s.unit,[y,e]=$(s.name,m,b),h=l!==void 0&&(!!(s.property&&s.access&v.GET)||k(s)),t=c[c.length-1],a=s.name==="state"?s.property:s.name;let p=s.label||w(a);t?.label&&s.name==="state"&&t.type!=="light"&&t.type!=="switch"&&(p=`${t.label} ${s.label.charAt(0).toLowerCase()}${s.label.slice(1)}`);const j=C.useCallback(i=>{i.property&&l?.({[i.property]:""})},[l]);return o.jsxs("div",{className:"list-row p-3",children:[o.jsx("div",{children:c.length>0&&s.type==="composite"&&e==="opacity-0"?null:o.jsx(r,{icon:y,className:e,size:"2xl"})}),o.jsxs("div",{children:[o.jsxs("div",{title:a,children:[p,!d&&s.endpoint?` (${x(i=>i.endpoint)}: ${s.endpoint})`:""]}),o.jsx("div",{className:"text-xs font-semibold opacity-60",children:s.description})]}),o.jsx("div",{className:"list-col-wrap flex flex-col gap-2",children:n}),h&&o.jsx(F,{item:s,onClick:j,className:"btn btn-xs btn-square btn-primary btn-soft",children:o.jsx(r,{icon:N})})]})}export{q as F};
