import{u as C,a as g,r as S,A as _,j as s,N as $,F as a,au as k,B as b,f,aw as D,S as L,L as p,ax as T}from"./index-VJpwYvBU.js";import{D as q}from"./DeviceImage-DAL8fj7m.js";import{D as N}from"./DebouncedInput-Bm_sFuTC.js";import{u as w}from"./useSearch-yONxWjVC.js";import"./envs-CRUy-_iG.js";import"./index-RbRX26AQ.js";import"./defineProperty-CegpTSss.js";function P(){const{t}=C("common"),d=g(e=>e.devices),m=g(e=>e.recentActivity),[h,o,x]=w(),[u,l,j]=w(),r=S.useMemo(()=>{const e=[];for(let i=0;i<_.length;i++){const n=m[i],I=d[i];for(const v in n){const c=I.find(A=>A.friendly_name===v);c!==void 0&&(o.length===0||c.friendly_name.toLowerCase().includes(o))&&e.push({sourceIdx:i,device:c,activity:n[v],highlighted:l.length>0&&c.friendly_name.toLowerCase().includes(l)})}}return e.sort((i,n)=>n.activity.timestamp-i.activity.timestamp),e},[m,d,o,l]);return s.jsxs(s.Fragment,{children:[s.jsxs($,{children:[s.jsxs("div",{className:"join",children:[s.jsxs("label",{className:"input input-sm join-item",children:[s.jsx(a,{icon:k}),s.jsx(N,{onChange:x,placeholder:t(e=>e.search,{ns:"common"}),value:h,disabled:r.length===0})]}),s.jsx(b,{item:"",onClick:x,className:"btn btn-sm btn-square btn-warning btn-outline join-item",title:t(e=>e.clear,{ns:"common"}),disabled:h.length===0,children:s.jsx(a,{icon:f})})]}),s.jsxs("div",{className:"join me-1",children:[s.jsxs("label",{className:"input input-sm join-item",children:[s.jsx(a,{icon:D}),s.jsx(N,{onChange:j,placeholder:t(e=>e.highlight,{ns:"common"}),value:u,disabled:r.length===0})]}),s.jsx(b,{item:"",onClick:j,className:"btn btn-sm btn-square btn-warning btn-outline join-item",title:t(e=>e.clear,{ns:"common"}),disabled:u==="",children:s.jsx(a,{icon:f})})]})]}),s.jsx("div",{className:"flex flex-col mb-5",children:s.jsx("ul",{className:"list bg-base-100",children:r.map(e=>s.jsxs("li",{className:`list-row p-2 ${e.highlighted?"bg-accent text-accent-content":""}`,children:[s.jsx("div",{className:"size-10",children:s.jsx(q,{device:e.device,disabled:e.device.disabled,noIndicator:!0})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(L,{idx:e.sourceIdx,autoHide:!0,namePostfix:" –",className:"me-1"}),s.jsx(p,{to:`/device/${e.sourceIdx}/${e.device.ieee_address}/info`,className:"link link-hover font-semibold truncate",children:e.device.friendly_name})]}),s.jsx("div",{className:"text-xs font-semibold min-w-0",children:s.jsxs("p",{className:"text-xs text-base-content/70 truncate",children:["[",new Date(e.activity.timestamp).toLocaleString(),"] ",e.activity.desc]})})]}),s.jsx(p,{to:`/device/${e.sourceIdx}/${e.device.ieee_address}/info`,className:"btn btn-square btn-ghost",children:s.jsx(a,{icon:T})})]},`${e.device.friendly_name}-${e.sourceIdx}-${e.activity}`))})})]})}export{P as default};
