const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Bind-Dj7BlJ9c.js","./index-BeDhuS24.js","./envs-DFlyG_dH.js","./index-sQ1gk-WC.css","./DevicePicker-DIWryjuN.js","./SelectField-CgXiODUe.js","./EndpointPicker-Cni8eLro.js","./Clusters-PG0HopAK.js","./DevConsole-DeRbEIDK.js","./InputField-E2g5qJCn.js","./ClusterSinglePicker-BavLYJxh.js","./TextareaField-DAyUngHz.js","./DeviceInfo-Ll9Bxn4L.js","./snakeCase-DF3cbatb.js","./_createCompounder-HA4t3BbU.js","./DeviceControlEditName-D6ss-GnK.js","./CheckboxField-BhwpagjA.js","./Availability-Dg28cVsy.js","./DeviceImage-CGx5yo8m.js","./index-CIWfMo3U.js","./DisplayValue-y4u-p3TF.js","./LastSeen-Tt-X3bir.js","./format-LeabZw87.js","./VendorLink-B_MZftSG.js","./PowerSource-M8I2qqUm.js","./DeviceSettings-B8rSL_p0.js","./SettingsList-wPZC4AYF.js","./NumberField-CH6-YRbT.js","./DeviceSpecificSettings-DRSJ44yr.js","./Feature-B18PTY7Z.js","./Exposes-CVaHXwu-.js","./Groups-C16FRyjr.js","./Reporting-CUO_xgvP.js","./Scene-C7Y19gU0.js","./RecallRemove-BT61_xFm.js","./DashboardFeatureWrapper-QO-XFtKk.js","./State-B0esCQUT.js"])))=>i.map(i=>d[i]);
import{r as t,b as p,j as e,L as v,P as x,F as r,f as j,a as f,d as b,u as g,N as n,e as y,g as h,h as N,i as E,k as T,l as w,m as D,n as L,o as P,p as $,q as A,_ as l}from"./index-BeDhuS24.js";import"./envs-DFlyG_dH.js";const I=t.memo(i=>{const{devices:u,currentDevice:a,tab:m="info"}=i,[d,s]=t.useState(""),{t:o}=p("common"),_=t.useMemo(()=>u.filter(c=>c.type!=="Coordinator"&&c.friendly_name.toLowerCase().includes(d.toLowerCase())&&c.ieee_address!==a?.ieee_address).map(c=>e.jsx("li",{children:e.jsx(v,{to:`/device/${c.ieee_address}/${m}`,onClick:()=>s(""),className:"dropdown-item",children:c.friendly_name})},c.ieee_address)),[u,a,d,m]);return e.jsxs(x,{name:"header-device-selector",buttonChildren:`${a?`${a.friendly_name} (${a.ieee_address})`:o("unknown_device")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(r,{icon:j}),e.jsx("input",{type:"search",placeholder:o("type_to_filter"),onChange:c=>s(c.target.value),value:d})]},"search"),_]})}),R=t.lazy(async()=>await l(()=>import("./Bind-Dj7BlJ9c.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),C=t.lazy(async()=>await l(()=>import("./Clusters-PG0HopAK.js"),__vite__mapDeps([7,1,2,3]),import.meta.url)),O=t.lazy(async()=>await l(()=>import("./DevConsole-DeRbEIDK.js"),__vite__mapDeps([8,1,2,3,9,10,5,6,11]),import.meta.url)),S=t.lazy(async()=>await l(()=>import("./DeviceInfo-Ll9Bxn4L.js"),__vite__mapDeps([12,1,2,3,13,14,15,16,9,17,11,18,19,20,21,22,23,24]),import.meta.url)),z=t.lazy(async()=>await l(()=>import("./DeviceSettings-B8rSL_p0.js"),__vite__mapDeps([25,1,2,3,26,16,9,27,5]),import.meta.url)),V=t.lazy(async()=>await l(()=>import("./DeviceSpecificSettings-DRSJ44yr.js"),__vite__mapDeps([28,1,2,3,29,20,14]),import.meta.url)),k=t.lazy(async()=>await l(()=>import("./Exposes-CVaHXwu-.js"),__vite__mapDeps([30,1,2,3,29,20,14]),import.meta.url)),M=t.lazy(async()=>await l(()=>import("./Groups-C16FRyjr.js"),__vite__mapDeps([31,1,2,3,6,5]),import.meta.url)),F=t.lazy(async()=>await l(()=>import("./Reporting-CUO_xgvP.js"),__vite__mapDeps([32,1,2,3,9,10,5,6]),import.meta.url)),G=t.lazy(async()=>await l(()=>import("./Scene-C7Y19gU0.js"),__vite__mapDeps([33,1,2,3,34,35,29,20,14,9,5]),import.meta.url)),B=t.lazy(async()=>await l(()=>import("./State-B0esCQUT.js"),__vite__mapDeps([36,1,2,3]),import.meta.url));function H(){const{t:i}=p(["devicePage","common"]),u=f(c=>c.devices),{deviceId:a,tab:m}=b(),d=g(),s=a?u.find(c=>c.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 o=({isActive:c})=>c?"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(n,{to:`/device/${a}/info`,className:o,children:[e.jsx(r,{icon:y,className:"me-2"}),i("about")]}),e.jsxs(n,{to:`/device/${a}/exposes`,className:o,children:[e.jsx(r,{icon:h,className:"me-2"}),i("exposes")]}),e.jsxs(n,{to:`/device/${a}/bind`,className:o,children:[e.jsx(r,{icon:N,className:"me-2"}),i("bind")]}),e.jsxs(n,{to:`/device/${a}/reporting`,className:o,children:[e.jsx(r,{icon:E,className:"me-2"}),i("reporting")]}),e.jsxs(n,{to:`/device/${a}/settings`,className:o,children:[e.jsx(r,{icon:T,className:"me-2"}),i("settings")]}),e.jsxs(n,{to:`/device/${a}/settings-specific`,className:o,children:[e.jsx(r,{icon:w,className:"me-2"}),i("settings_specific")]}),e.jsxs(n,{to:`/device/${a}/state`,className:o,children:[e.jsx(r,{icon:D,className:"me-2"}),i("state")]}),e.jsxs(n,{to:`/device/${a}/clusters`,className:o,children:[e.jsx(r,{icon:L,className:"me-2"}),i("clusters")]}),e.jsxs(n,{to:`/device/${a}/groups`,className:o,children:[e.jsx(r,{icon:P,className:"me-2"}),i("groups")]}),e.jsxs(n,{to:`/device/${a}/scene`,className:o,children:[e.jsx(r,{icon:$,className:"me-2"}),i("scene")]}),e.jsxs(n,{to:`/device/${a}/dev-console`,className:o,children:[e.jsx(r,{icon:A,className:"me-2"}),i("dev_console")]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:_})]})]})}export{H as default};
