const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Bind-2vU4MEda.js","./index-vDL8KyrI.js","./index-KcXdcCUK.css","./DevicePicker-CGedN3DH.js","./SelectField-apZm61cq.js","./EndpointPicker-DOVgHugJ.js","./Clusters-1Agu340f.js","./DevConsole-BqxayO7F.js","./InputField-B5sOh_uD.js","./ClusterSinglePicker-DrJuGiNl.js","./TextareaField-DY32r12P.js","./DeviceInfo-BJ5kiv6l.js","./capitalize-Cw1mPDhM.js","./_createCompounder-Bmfmbzn9.js","./snakeCase-B_0CeYWc.js","./DeviceControlEditName-BXFSFs5f.js","./CheckboxField-m1WCeVZk.js","./Availability-D-8394Wg.js","./DeviceImage-BpknBFw1.js","./index-C4Y7ujGQ.js","./DisplayValue-CvjefE6V.js","./LastSeen-BB0rwxhg.js","./VendorLink-Q4mHbr9a.js","./PowerSource-DFW6CjuU.js","./DeviceSettings-chmhK32L.js","./SettingsList-D3Urvwh_.js","./DeviceSpecificSettings-gQVInXHA.js","./Feature-Dn8iv4tk.js","./Exposes-CoSxWFf1.js","./Groups-SEucKOeq.js","./Reporting-O9YIpID9.js","./Scene-CAO-8z4N.js","./RecallRemove-DchDgS_I.js","./DashboardFeatureWrapper-CotxeSO1.js","./State-BlQwMyRC.js"])))=>i.map(i=>d[i]);
import{r as t,b as p,j as e,L as x,P as v,F as n,f as j,a as f,e as b,u as g,N as r,g as y,h,i as N,k as E,l as T,m as w,n as D,o as L,p as P,q as $,v as A,_ as l}from"./index-vDL8KyrI.js";const I=t.memo(i=>{const{devices:u,currentDevice:a,tab:m="info"}=i,[d,s]=t.useState(""),{t:c}=p("common"),_=t.useMemo(()=>u.filter(o=>o.type!=="Coordinator"&&o.friendly_name.toLowerCase().includes(d.toLowerCase())&&o.ieee_address!==(a==null?void 0:a.ieee_address)).map(o=>e.jsx("li",{children:e.jsx(x,{to:`/device/${o.ieee_address}/${m}`,onClick:()=>s(""),className:"dropdown-item",children:o.friendly_name})},o.ieee_address)),[u,a,d,m]);return e.jsxs(v,{name:"header-device-selector",buttonChildren:`${a?`${a.friendly_name} (${a.ieee_address})`:c("unknown_device")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(n,{icon:j}),e.jsx("input",{type:"search",placeholder:c("type_to_filter"),onChange:o=>s(o.target.value),value:d})]},"search"),_]})}),R=t.lazy(async()=>await l(()=>import("./Bind-2vU4MEda.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),C=t.lazy(async()=>await l(()=>import("./Clusters-1Agu340f.js"),__vite__mapDeps([6,1,2]),import.meta.url)),O=t.lazy(async()=>await l(()=>import("./DevConsole-BqxayO7F.js"),__vite__mapDeps([7,1,2,8,9,4,5,10]),import.meta.url)),S=t.lazy(async()=>await l(()=>import("./DeviceInfo-BJ5kiv6l.js"),__vite__mapDeps([11,1,2,12,13,14,15,16,8,17,10,18,19,20,21,22,23]),import.meta.url)),z=t.lazy(async()=>await l(()=>import("./DeviceSettings-chmhK32L.js"),__vite__mapDeps([24,1,2,25,16,8,4]),import.meta.url)),V=t.lazy(async()=>await l(()=>import("./DeviceSpecificSettings-gQVInXHA.js"),__vite__mapDeps([26,1,2,27,20,13,12]),import.meta.url)),k=t.lazy(async()=>await l(()=>import("./Exposes-CoSxWFf1.js"),__vite__mapDeps([28,1,2,27,20,13,12]),import.meta.url)),M=t.lazy(async()=>await l(()=>import("./Groups-SEucKOeq.js"),__vite__mapDeps([29,1,2,5,4]),import.meta.url)),F=t.lazy(async()=>await l(()=>import("./Reporting-O9YIpID9.js"),__vite__mapDeps([30,1,2,8,9,4,5]),import.meta.url)),G=t.lazy(async()=>await l(()=>import("./Scene-CAO-8z4N.js"),__vite__mapDeps([31,1,2,32,33,27,20,13,12,8,4]),import.meta.url)),B=t.lazy(async()=>await l(()=>import("./State-BlQwMyRC.js"),__vite__mapDeps([34,1,2]),import.meta.url));function q(){const{t:i}=p(["devicePage","common"]),u=f(o=>o.devices),{deviceId:a,tab:m}=b(),d=g(),s=a?u.find(o=>o.ieee_address===a):void 0;t.useEffect(()=>{s&&(m?s.type==="Coordinator"&&d("/settings/about",{replace:!0}):d(s.type==="Coordinator"?"/settings/about":`/device/${s.ieee_address}/info`,{replace:!0}))},[m,s,d]);const c=({isActive:o})=>o?"tab tab-active":"tab",_=t.useMemo(()=>{if(!s)return e.jsx("div",{className:"flex-auto justify-center items-center",children:i("common:unknown_device")});switch(m){case"info":return e.jsx(S,{device:s});case"exposes":return e.jsx(k,{device:s});case"bind":return e.jsx(R,{device:s});case"reporting":return e.jsx(F,{device:s});case"settings":return e.jsx(z,{device:s});case"settings-specific":return e.jsx(V,{device:s});case"state":return e.jsx(B,{device:s});case"clusters":return e.jsx(C,{device:s});case"groups":return e.jsx(M,{device:s});case"scene":return e.jsx(G,{device:s});case"dev-console":return e.jsx(O,{device:s})}},[s,m,i]);return e.jsxs(e.Fragment,{children:[e.jsx(I,{devices:u,currentDevice:s,tab:m}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(r,{to:`/device/${a}/info`,className:c,children:[e.jsx(n,{icon:y,className:"me-2"}),i("about")]}),e.jsxs(r,{to:`/device/${a}/exposes`,className:c,children:[e.jsx(n,{icon:h,className:"me-2"}),i("exposes")]}),e.jsxs(r,{to:`/device/${a}/bind`,className:c,children:[e.jsx(n,{icon:N,className:"me-2"}),i("bind")]}),e.jsxs(r,{to:`/device/${a}/reporting`,className:c,children:[e.jsx(n,{icon:E,className:"me-2"}),i("reporting")]}),e.jsxs(r,{to:`/device/${a}/settings`,className:c,children:[e.jsx(n,{icon:T,className:"me-2"}),i("settings")]}),e.jsxs(r,{to:`/device/${a}/settings-specific`,className:c,children:[e.jsx(n,{icon:w,className:"me-2"}),i("settings_specific")]}),e.jsxs(r,{to:`/device/${a}/state`,className:c,children:[e.jsx(n,{icon:D,className:"me-2"}),i("state")]}),e.jsxs(r,{to:`/device/${a}/clusters`,className:c,children:[e.jsx(n,{icon:L,className:"me-2"}),i("clusters")]}),e.jsxs(r,{to:`/device/${a}/groups`,className:c,children:[e.jsx(n,{icon:P,className:"me-2"}),i("groups")]}),e.jsxs(r,{to:`/device/${a}/scene`,className:c,children:[e.jsx(n,{icon:$,className:"me-2"}),i("scene")]}),e.jsxs(r,{to:`/device/${a}/dev-console`,className:c,children:[e.jsx(n,{icon:A,className:"me-2"}),i("dev_console")]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:_})]})]})}export{q as default};
