const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-BCjt1muK.js","./index-DjbVAZHL.js","./envs-CRUy-_iG.js","./index-DeQqyExs.css","./RecallRemove-7D_NDzYK.js","./DashboardFeatureWrapper-O5P5TMzv.js","./startCase-SXH8nyJo.js","./DisplayValue-e_yVQGok.js","./isObject--vsEa_js.js","./_createCompounder-CI5okWsL.js","./isObjectLike-DlSfHoCn.js","./index-RfvTmd0Z.js","./InputField-D1U5kSs2.js","./extends-CF3RwP-h.js","./react-select.esm-189R5gw4.js","./defineProperty-CegpTSss.js","./floating-ui.dom-CFVCCol6.js","./DevicePicker-CtoMuVoS.js","./EndpointPicker-ByksWRBx.js","./SelectField-XDAy-a1R.js","./useColumnCount-BxxtEcEj.js","./DeviceCard-DKc-PXhO.js","./LastSeen-TlG8TNPK.js","./TimeAgo-B6rAagzx.js","./Lqi-_D0pWzA-.js","./PowerSource-DwoxK9gS.js","./snakeCase-Dg4N4ThO.js","./DeviceImage-Bsu1Hk6P.js","./index-BzinHeAr.js","./Exposes-DMm4OtyA.js","./FeatureWrapper-DrakfNcb.js","./GroupSettings-Bltgt1uM.js","./InfoAlert-CmtOpoKi.js","./SettingsList-BXEgH0vS.js","./CheckboxField-h2bgaDmU.js","./NumberField-QiXHex0z.js"])))=>i.map(i=>d[i]);
import{dq as l,dG as j,dB as b,dD as h,a as N,dm as e,a0 as v,V as E,dE as S,dj as $,dF as y,R as T,S as p,o as x,bX as f,aX as A,aa as _}from"./index-DjbVAZHL.js";import{a as w}from"./react-select.esm-189R5gw4.js";import"./envs-CRUy-_iG.js";import"./defineProperty-CegpTSss.js";import"./extends-CF3RwP-h.js";import"./floating-ui.dom-CFVCCol6.js";const P=l.memo(({currentSourceIdx:t,currentGroup:i,tab:o="devices"})=>{const{t:n}=j("common"),m=b(s=>s.groups),r=h(),d=l.useCallback(s=>{s&&r(s.link)},[r]),u=l.useMemo(()=>{const s=[];for(let a=0;a<N.length;a++)for(const c of m[a])a===t&&c.id===i?.id||s.push({value:c.friendly_name,label:e.jsxs(e.Fragment,{children:[e.jsx(v,{idx:a,autoHide:!0,namePostfix:" – "})," ",c.friendly_name]}),name:`${a} ${c.friendly_name}`,link:`/group/${a}/${c.id}/${o}`});return s.sort((a,c)=>a.name.localeCompare(c.name)),s},[m,t,i,o]);return e.jsx(w,{unstyled:!0,placeholder:i&&t!==void 0?e.jsxs(e.Fragment,{children:[e.jsx(v,{idx:t,autoHide:!0,namePostfix:" – "})," ",i.friendly_name]}):n(s=>s.select_group),"aria-label":n(s=>s.select_group),options:u,isSearchable:!0,onChange:d,className:"min-w-48 sm:w-auto me-2",classNames:E})}),C=l.lazy(async()=>await _(()=>import("./Devices-BCjt1muK.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,22,23,24,25,26,27,28]),import.meta.url)),I=l.lazy(async()=>await _(()=>import("./Exposes-DMm4OtyA.js"),__vite__mapDeps([29,1,2,3,6,7,8,9,10,11,30]),import.meta.url)),L=l.lazy(async()=>await _(()=>import("./GroupSettings-Bltgt1uM.js"),__vite__mapDeps([31,1,2,3,32,33,34,12,35,19]),import.meta.url));function k(t,i,o){const n=`${t}-${o.id}`;switch(i){case"devices":return e.jsx(C,{sourceIdx:t,group:o},n);case"exposes":return e.jsx(I,{sourceIdx:t,group:o},n);case"settings":return e.jsx(L,{sourceIdx:t,group:o},n)}}const g=({isActive:t})=>t?"tab tab-active":"tab";function z(){const t=h(),{t:i}=j(["groups","common"]),{sourceIdx:o,groupId:n,tab:m}=S(),[r,d]=$(o),u=Number.parseInt(n,10),s=b(y(a=>n?a.groups[r].find(c=>c.id===u):void 0));return l.useEffect(()=>{o&&d&&s?m||t(`/group/${o}/${s.id}/devices`,{replace:!0}):t("/groups",{replace:!0})},[o,d,m,s,t]),e.jsxs(e.Fragment,{children:[e.jsx(T,{children:e.jsx(P,{currentSourceIdx:r,currentGroup:s,tab:m})}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${r}/${n}/devices`,className:g,children:[e.jsx(x,{icon:f,className:"me-2"}),i(a=>a.devices,{ns:"common"})]}),e.jsxs(p,{to:`/group/${r}/${n}/exposes`,className:g,children:[e.jsx(x,{icon:f,className:"me-2"}),i(a=>a.exposes,{ns:"common"})]}),e.jsxs(p,{to:`/group/${r}/${n}/settings`,className:g,children:[e.jsx(x,{icon:A,className:"me-2"}),i(a=>a.settings)]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:m&&s?k(r,m,s):e.jsx("div",{className:"flex-auto justify-center items-center",children:i(a=>a.unknown_group,{ns:"common"})})})]})}export{z as default};
