const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-DUPFbo5z.js","./index-DtyjNqrf.js","./envs-DFlyG_dH.js","./index-EwioJBcA.css","./RecallRemove-C7or_UUw.js","./DashboardFeatureWrapper-CWbT-TyR.js","./Feature-VsMzzVJz.js","./DisplayValue-B5Rw3jLu.js","./_createCompounder-CbLsIfEE.js","./capitalize-C89IAw35.js","./InputField-CYbmpJqW.js","./SelectField-DfdnxD7O.js","./DevicePicker-_CY2TskL.js","./EndpointPicker-Bik90BnT.js","./DeviceCard-Bz1iBm0H.js","./LastSeen-CvhRQlEh.js","./format-6Yb6jWnA.js","./Lqi-CoNVuBvb.js","./PowerSource-DgFKG_xU.js","./snakeCase-DmoQhYQA.js","./DeviceImage-D-FjKeE6.js","./index-Q3KOJDn9.js","./GroupSettings-8js0C39v.js","./SettingsList-m7AYDAw4.js","./CheckboxField-DKhAwA85.js","./NumberField-DVRroIAm.js"])))=>i.map(i=>d[i]);
import{r as n,b as g,j as e,L as f,P as j,F as m,f as v,u as b,d as h,a as _,N as p,o as N,k as w,_ as x}from"./index-DtyjNqrf.js";import"./envs-DFlyG_dH.js";const y=n.memo(u=>{const{groups:r,currentGroup:t,tab:o="devices"}=u,[c,l]=n.useState(""),{t:s}=g("common"),d=n.useMemo(()=>r.filter(a=>a.friendly_name.toLowerCase().includes(c.toLowerCase())&&a.id!==t?.id).map(a=>e.jsx("li",{children:e.jsx(f,{to:`/group/${a.id}/${o}`,onClick:()=>l(""),className:"dropdown-item",children:a.friendly_name})},a.id)),[r,c,t,o]);return e.jsxs(j,{name:"header-group-selector",buttonChildren:`${t?`#${t.id} - ${t.friendly_name}`:s("unknown_group")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(m,{icon:v}),e.jsx("input",{type:"search",placeholder:s("type_to_filter"),onChange:a=>l(a.target.value),value:c})]},"search"),d]})}),T=n.lazy(async()=>await x(()=>import("./Devices-DUPFbo5z.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url)),$=n.lazy(async()=>await x(()=>import("./GroupSettings-8js0C39v.js"),__vite__mapDeps([22,1,2,3,23,24,10,25,11]),import.meta.url));function G(){const u=b(),{t:r}=g(["groups","common"]),{groupId:t,tab:o}=h(),c=_(i=>i.groups),l=Number.parseInt(t,10),s=t?c.find(i=>i.id===l):void 0;n.useEffect(()=>{!o&&s&&u(`/group/${s.id}/devices`,{replace:!0})},[o,s,u]);const d=({isActive:i})=>i?"tab tab-active":"tab",a=n.useMemo(()=>{if(!s)return e.jsx("div",{className:"flex-auto justify-center items-center",children:r("common:unknown_group")});switch(o){case"devices":return e.jsx(T,{group:s});case"settings":return e.jsx($,{group:s})}},[o,s,r]);return e.jsxs(e.Fragment,{children:[e.jsx(y,{groups:c,currentGroup:s,tab:o}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${t}/devices`,className:d,children:[e.jsx(m,{icon:N,className:"me-2"}),r("common:devices")]}),e.jsxs(p,{to:`/group/${t}/settings`,className:d,children:[e.jsx(m,{icon:w,className:"me-2"}),r("settings")]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:a})]})}export{G as default};
