@camstack/addon-admin-ui 1.2.678 → 1.2.679

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/assets/Addons-CcHG87CO.js +5 -0
  3. package/dist/assets/{AdminPage-BEQJlUNo.js → AdminPage-DhtpNaF0.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-C7Nx9jJl.js → AdminSectionedPage-dteNFZvo.js} +1 -1
  5. package/dist/assets/{AiProfiles-D4eTx94W.js → AiProfiles-DW84QaSf.js} +2 -2
  6. package/dist/assets/{BootstrapSettingsForm-C8SgY-gH.js → BootstrapSettingsForm-DTx2a3Sd.js} +1 -1
  7. package/dist/assets/Build-DGxdI3Hj.js +42 -0
  8. package/dist/assets/{Calendars-CngFbuGP.js → Calendars-CI5dIFem.js} +1 -1
  9. package/dist/assets/{CameraGrids-BI3PYGPr.js → CameraGrids-Cz0cgj4f.js} +1 -1
  10. package/dist/assets/Cluster-DdwOin66.js +1 -0
  11. package/dist/assets/CompositionBlockEditor-qlSsElYl.js +2 -0
  12. package/dist/assets/{CompositionEditorPage-C56ErWVZ.js → CompositionEditorPage-CpW6nXF5.js} +1 -1
  13. package/dist/assets/Data-B0cMYuLm.js +2 -0
  14. package/dist/assets/DeviceDetail-9y3dyWK7.js +2 -0
  15. package/dist/assets/{Devices-ByKU7OhR.js → Devices-Bk_TfLmI.js} +1 -1
  16. package/dist/assets/{EmbedDevicePage-CUljYRrr.js → EmbedDevicePage-CPlOvLlu.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-BM7zhcWx.js → EmbedPlayerPage-liQI6d7f.js} +1 -1
  18. package/dist/assets/{History-BCQ4IrRD.js → History-B1Q1JGWF.js} +1 -1
  19. package/dist/assets/Identity-DaP-TPKs.js +1 -0
  20. package/dist/assets/{InstancesTable-CriEfrMJ.js → InstancesTable-DMhlGx4D.js} +1 -1
  21. package/dist/assets/{IntegrationDetail-BCP8mmgO.js → IntegrationDetail-CGzj8QFi.js} +1 -1
  22. package/dist/assets/{Integrations-C30eE4UB.js → Integrations-CeWGYtB9.js} +1 -1
  23. package/dist/assets/{Integrations-Bqcvm_Qf.js → Integrations-DNctwKoS.js} +2 -2
  24. package/dist/assets/Library-4XVNGSe-.js +1 -0
  25. package/dist/assets/Locations-B8Y1S0hz.js +3 -0
  26. package/dist/assets/{Logs-DKDr8AuB.js → Logs-BhRCuJzg.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-DbmWEEiO.js → MaskShapeCanvas-BN-PRLjb.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-BzScgedh.js → MotionZonesSettings-D9Prrwl-.js} +1 -1
  29. package/dist/assets/{MyAccess-CzfNmMJl.js → MyAccess-Bxvq6s1N.js} +1 -1
  30. package/dist/assets/{Network-CAbg7ZpT.js → Network-DiPGmTrB.js} +1 -1
  31. package/dist/assets/{NodeAddonsSettingsPanel-DTkQMaBn.js → NodeAddonsSettingsPanel-C3eW6HeG.js} +1 -1
  32. package/dist/assets/Notifications-DZlP-xpq.js +1 -0
  33. package/dist/assets/Pipeline-BOej0Ruf.js +1 -0
  34. package/dist/assets/{PrivacyMaskSettings-DgBQuyh9.js → PrivacyMaskSettings-uNqMIBUf.js} +1 -1
  35. package/dist/assets/{Recordings-BlCEAKse.js → Recordings-DRXSsvRE.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-D5OLGtBI.js → SceneMonitorEditor-Dd67GOFm.js} +1 -1
  37. package/dist/assets/{ServerShell-CSTjFsEJ.js → ServerShell-9-brnTiy.js} +1 -1
  38. package/dist/assets/{SessionsList-C1Ao7w_G.js → SessionsList-ChVQOhw4.js} +2 -2
  39. package/dist/assets/{Showroom-DCYRjXXW.js → Showroom-Ccc-k5Zm.js} +1 -1
  40. package/dist/assets/{StorageLocationsTable-BfwKi6fr.js → StorageLocationsTable-Dge2NowU.js} +1 -1
  41. package/dist/assets/{System-BvNJMfpW.js → System-DRor4yxP.js} +1 -1
  42. package/dist/assets/{Terminal-DQ5u6n8f.js → Terminal-rDJpyrDe.js} +2 -2
  43. package/dist/assets/{TerminalPanel-DC4Fs74K.js → TerminalPanel-CcQHLEGZ.js} +1 -1
  44. package/dist/assets/{TrainingProviders-D6bLgYi2.js → TrainingProviders-BOGrjW0M.js} +1 -1
  45. package/dist/assets/{Viewer-BmamcoHc.js → Viewer-Dk4V-7Im.js} +1 -1
  46. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DcrAwx-L.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BlbUc9gS.js} +1 -1
  47. package/dist/assets/{action-draft-Dr5Q1lmk.js → action-draft-DgC3sdIv.js} +1 -1
  48. package/dist/assets/{ai-page.helpers-AOJOCF6H.js → ai-page.helpers-BGxGEY-d.js} +1 -1
  49. package/dist/assets/{assignment-candidates-BYfez7Z_.js → assignment-candidates-BaRiMeKr.js} +1 -1
  50. package/dist/assets/{authed-media-DaaHSoAj.js → authed-media-DYlVx7_x.js} +1 -1
  51. package/dist/assets/{board-model-COsjkU2L.js → board-model-C2Tzni7-.js} +1 -1
  52. package/dist/assets/client-B0p6WiZb.js +1120 -0
  53. package/dist/assets/{command-vocab-wRSfGsbG.js → command-vocab-DNAnc4zd.js} +1 -1
  54. package/dist/assets/{device-detail-CT3Wq2MX.js → device-detail-DfSFMzI_.js} +1 -1
  55. package/dist/assets/{device-integration-icon-CK7ULj84.js → device-integration-icon-D2nTH-29.js} +1 -1
  56. package/dist/assets/device-picker-model-D943WJVm.js +1 -0
  57. package/dist/assets/{dist-BnzMSUv0.js → dist-BZGaAsKc.js} +1 -1
  58. package/dist/assets/dist-auYATUda.js +1120 -0
  59. package/dist/assets/{format-Fw8MrMCF.js → format-YT7IgtG9.js} +1 -1
  60. package/dist/assets/{hostInit-BHV5j57a.js → hostInit-Cm3R_dPt.js} +1 -1
  61. package/dist/assets/i18n-NPZM0HGc.js +1 -0
  62. package/dist/assets/icons-f0SVFd9I.js +1 -0
  63. package/dist/assets/index-Bjvuymkk.js +4 -0
  64. package/dist/assets/{linked-devices-model-BRVCcL_i.js → linked-devices-model-D6oZ-Tkf.js} +1 -1
  65. package/dist/assets/{mf-entry-bootstrap-0-65134e91.js → mf-entry-bootstrap-0-76eadad6.js} +2 -2
  66. package/dist/assets/mount-D943WJVm.js +1 -0
  67. package/dist/assets/{notification-rule-status-tbLfUZee.js → notification-rule-status-BRCNbkxe.js} +1 -1
  68. package/dist/assets/{player-overlays-8aC2r-sd.js → player-overlays-ClFSGefV.js} +1 -1
  69. package/dist/assets/remoteEntry-CUYE4uFU.js +1 -0
  70. package/dist/assets/src-DwclSIv9.js +279 -0
  71. package/dist/assets/{sso-popup-C_VTtoWT.js → sso-popup-Bxcrh_Ga.js} +1 -1
  72. package/dist/assets/{step-inspector-model-UadKxnLr.js → step-inspector-model-CdoST47D.js} +1 -1
  73. package/dist/assets/{use-scenes-feed-D3bzrMKu.js → use-scenes-feed-D64cvW6x.js} +1 -1
  74. package/dist/assets/{use-stationary-objects-Yw5gdlLl.js → use-stationary-objects-CVtFtIWB.js} +1 -1
  75. package/dist/assets/{useAdminDeviceRemoval-WQ4NaouA.js → useAdminDeviceRemoval-D_RkWyKn.js} +1 -1
  76. package/dist/assets/useEventInvalidation-D943WJVm.js +1 -0
  77. package/dist/assets/{useNodeUrlSelection-BSpn8JLz.js → useNodeUrlSelection-BrRsjvMi.js} +1 -1
  78. package/dist/assets/useTemplateSave-CGO3W8km.js +1 -0
  79. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CTvMo-Za.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-i9bg-dgj.js} +2 -2
  80. package/dist/index.html +8 -8
  81. package/dist/server/addon.js +1500 -1078
  82. package/package.json +2 -2
  83. package/dist/assets/Addons-DKOUsYsk.js +0 -5
  84. package/dist/assets/Build-BuGJWdUz.js +0 -42
  85. package/dist/assets/Cluster-DMkIzva9.js +0 -1
  86. package/dist/assets/CompositionBlockEditor-BlkVIJir.js +0 -2
  87. package/dist/assets/Data-D-7IMZzp.js +0 -2
  88. package/dist/assets/DeviceDetail-CATQ56bt.js +0 -2
  89. package/dist/assets/Identity-D60Odj5F.js +0 -1
  90. package/dist/assets/Library-BbXKoa8Z.js +0 -1
  91. package/dist/assets/Locations-DM8nnzTd.js +0 -3
  92. package/dist/assets/Notifications-BnUmb5Cg.js +0 -1
  93. package/dist/assets/Pipeline-SaA7yA5Z.js +0 -1
  94. package/dist/assets/client-LrzN1ATZ.js +0 -1119
  95. package/dist/assets/device-picker-model-BaM_HHUO.js +0 -1
  96. package/dist/assets/dist-p9ea9Hzu.js +0 -1119
  97. package/dist/assets/i18n-DWjQ9UFE.js +0 -1
  98. package/dist/assets/icons-Dfx79nBH.js +0 -1
  99. package/dist/assets/index-BsPM4J54.js +0 -4
  100. package/dist/assets/mount-BaM_HHUO.js +0 -1
  101. package/dist/assets/remoteEntry-DuqtB7i9.js +0 -1
  102. package/dist/assets/src-D5UhvHcp.js +0 -279
  103. package/dist/assets/useEventInvalidation-BaM_HHUO.js +0 -1
  104. package/dist/assets/useTemplateSave-CVoxjtyr.js +0 -1
@@ -1,3 +0,0 @@
1
- import{C as e,K as t,S as n,V as r,Y as i,et as a,o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Jn as c,O as l,Oa as u,Qi as d,Rr as f,Ua as p,V as m,ct as h,dt as g,en as _,k as v,kr as y,lr as b,rr as x,wt as S,z as C}from"./player-overlays-8aC2r-sd.js";import{In as w,gs as T,vs as E}from"./client-LrzN1ATZ.js";import{t as D}from"./chevron-down-CBb-F8DT.js";import{$f as O,$s as k,A,Ar as j,Ca as M,Da as N,Fi as P,Gf as F,Js as I,Ks as ee,Li as L,Ls as te,Ni as R,Ns as ne,Pi as z,Qs as re,Ri as B,Rs as ie,Tn as V,Vs as ae,Xi as H,Ys as oe,as as se,ba as U,br as ce,cs as le,ec as ue,ep as W,is as de,ma as fe,oa as G,oc as pe,oi as K,qs as me,rs as he,si as ge,tc as _e,tp as ve,xa as q,xr as ye,yp as be,zi as xe,zs as Se}from"./src-D5UhvHcp.js";import{t as J}from"./i18n-DWjQ9UFE.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import{h as Ce,hi as we,pi as Te,ui as X}from"./index-BsPM4J54.js";import{t as Ee}from"./AdminSectionedPage-C7Nx9jJl.js";import{c as De,n as Oe,r as ke}from"./linked-devices-model-BRVCcL_i.js";a();function Z(e){return{id:e.id,name:e.name,type:e.type,stableId:e.stableId??``,parentDeviceId:e.parentDeviceId,location:e.location,...e.role!==void 0&&e.role!==null?{role:e.role}:{},...e.primaryChildEntityId!==void 0&&e.primaryChildEntityId!==null?{primaryChildEntityId:e.primaryChildEntityId}:{},...e.primaryChildPreference!==void 0&&e.primaryChildPreference!==null?{primaryChildPreference:e.primaryChildPreference}:{}}}function Q(e){if(e==null)return null;let t=e.trim();return t.length===0?null:t.toLowerCase()}function Ae(e,t){let n=Q(t);return n===null?[]:e.filter(e=>Q(e.location)===n)}function je(e,t){let n=Ae(e,t),r=new Set(n.map(e=>e.id));return n.filter(e=>e.parentDeviceId===null||!r.has(e.parentDeviceId))}function Me(e,t){let n=Q(e.location);return n===null||new Set(t.map(e=>Q(e))).has(n)?null:e.location?.trim()??null}function Ne(e,t){let n=Q(e.location);return n!==null&&t.has(n)}function Pe(e,t){let n=new Set(t.map(e=>Q(e))),r=new Set(e.filter(e=>Ne(e,n)).map(e=>e.id));return e.filter(e=>!(Ne(e,n)||e.parentDeviceId!==null&&r.has(e.parentDeviceId)))}function Fe(e,t){return Pe(e,t).filter(e=>e.parentDeviceId===null)}function Ie(e,t){let n=new Map;for(let t of e){if(t.parentDeviceId===null)continue;let e=n.get(t.parentDeviceId);e?e.push(t):n.set(t.parentDeviceId,[t])}let r=[],i=new Set([t]),a=[t];for(;a.length>0;){let e=[];for(let t of a)for(let a of n.get(t)??[])i.has(a.id)||(i.add(a.id),r.push(a),e.push(a.id));a=e}return r}function Le(e,t){return Ie(e,t).length}function Re(e,t){return e.filter(e=>!e.isCamera&&e.parentDeviceId===t)}function ze(e,t){return t.map(t=>({name:t,members:je(e,t)}))}function $({type:e,role:t,className:r}){return n(be(e,t),{"aria-hidden":`true`,className:r??`h-3.5 w-3.5 shrink-0 text-foreground-subtle`})}function Be({device:t}){let r=q(Z(t),`compact`);if(t.online)return n(`span`,{"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-success`,"data-status":`online`});let i=J.t(`common.offline`);return e(`span`,{className:`flex items-center gap-1.5`,children:[n(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full border border-foreground-subtle`,"data-status":`offline`,role:`img`,"aria-label":J.t(`locations.deviceGlyphs.aria`,{name:r,state:i}),title:i}),n(`span`,{className:`text-xs text-foreground-muted`,children:i})]})}function Ve({open:t,title:a,items:o,listState:s,lockedIds:c,lockedNote:l,suggestions:u=null,busy:d=!1,onConfirm:f,onClose:p}){let{t:m}=Y(),[h,g]=i([]);r(()=>{t||g([])},[t]);let _=new Map(o.map(e=>[e.id,e.name])),v=(u?.ids??[]).filter(e=>_.has(e)&&!c.includes(e)),y=e=>g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return n(R,{open:t,onOpenChange:e=>e?void 0:p(),children:e(P,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"aria-label":a,children:[n(B,{children:n(xe,{children:a})}),e(z,{className:`flex flex-col gap-3 p-2 sm:p-4`,children:[t&&u!==null&&v.length>0&&e(`section`,{"aria-label":u.heading,className:`flex flex-col gap-1`,children:[n(`h3`,{className:`text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:u.heading}),n(`div`,{className:`flex flex-wrap gap-1`,children:v.map(e=>n(`button`,{type:`button`,"aria-pressed":h.includes(e),className:`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors ${h.includes(e)?`border-primary/50 bg-primary/15 text-primary`:`border-border bg-surface text-foreground-subtle hover:bg-surface-hover`}`,onClick:()=>y(e),children:_.get(e)},e))})]}),t&&n(A,{devices:o,listState:s,value:h,onChange:e=>g(e),noun:`device`,emptyLabel:m(`locations.addDialog.nonePicked`),showAll:!0,lockedIds:c,lockedNote:l,testId:`quick-add-picker`})]}),e(L,{children:[n(F,{variant:`ghost`,onClick:p,children:m(`locations.addDialog.cancel`)}),n(F,{disabled:h.length===0||d,onClick:()=>f(h),children:m(`locations.addDialog.confirm`,{count:h.length})})]})]})})}a();function He({room:e,cameras:r,fleet:i}){let{t:a}=Y(),o=t(()=>new Map(i.map(e=>[e.id,e])),[i]);return e===null?n(`p`,{className:`text-xs text-foreground-subtle`,children:a(`locations.links.noRoom`)}):n(`div`,{className:`flex flex-col gap-3`,"data-testid":`camera-links-section`,children:r.length===0?n(`p`,{className:`text-xs text-foreground-subtle`,"data-testid":`camera-links-empty`,children:a(`locations.links.noCameras`,{room:e})}):r.map(e=>n(We,{camera:e,byId:o},e.id))})}function Ue(e){return{id:e.deviceId,name:e.name,type:e.type,location:e.location}}function We({camera:t,byId:r}){let{t:a}=Y(),s=q(Z(t),`full`),c=o(),u=Te(),[d,p]=i(!1),[m,h]=i(null),g=de({deviceId:t.id}),_=ke({status:g.status,data:g.data,error:g.error===null||g.error===void 0?null:g.error}),y=se(),b=_.kind===`present`?_:null,x=he({deviceId:t.id,slotRef:b?.slot.slotRef??``},{enabled:d&&b!==null}),S=b===null?[]:Oe(b.slot,b.value),C=S.map(e=>e.deviceId),w=(x.data?.candidates??[]).map(Ue),T=new Set(w.map(e=>e.id)),E=C.filter(e=>!T.has(e)).map(e=>{let t=r.get(e);return{id:e,name:t?.name??`#${String(e)}`,...t===void 0?{}:{type:t.type,location:t.location}}}),D=[...w,...E],O=(x.data?.candidates??[]).filter(e=>e.suggested).map(e=>e.deviceId),k=async e=>{if(b!==null){h(null);try{await y.mutateAsync({deviceId:t.id,slotRef:b.slot.slotRef,value:De(b.value,e)}),await g.refetch(),await c.invalidateQueries({queryKey:[[`deviceManager`]]}),p(!1)}catch(e){h(e instanceof Error?e.message:String(e))}}},A=[{key:`device`,header:a(`locations.columns.device`),notSortableReason:a(`locations.columns.noSort`),render:t=>{let i=r.get(t.deviceId),o=t.name??i?.name??`#${String(t.deviceId)}`;return e(`span`,{className:`flex items-center gap-1.5`,children:[i!==void 0&&n($,{type:i.type,role:i.role}),n(X,{to:`/devices/${String(t.deviceId)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:i===void 0?o:n(H,{device:Z(i),form:`compact`})}),t.implied&&n(`span`,{className:`text-[10px] text-foreground-subtle`,children:a(`locations.links.implied`)})]})}},{key:`type`,header:a(`locations.columns.type`),notSortableReason:a(`locations.columns.noSort`),render:e=>n(`span`,{className:`text-xs text-foreground-muted`,children:r.get(e.deviceId)?.type??`—`})},{key:`status`,header:a(`locations.columns.status`),notSortableReason:a(`locations.columns.noSort`),render:e=>{let t=r.get(e.deviceId);return t===void 0?n(`span`,{className:`text-xs text-foreground-subtle`,children:`—`}):n(Be,{device:t})}}];return e(`section`,{className:`min-w-0 ${l}`,"data-testid":`camera-links-${String(t.id)}`,children:[e(`header`,{className:`${v} flex min-h-9 items-center gap-1.5`,children:[n($,{type:t.type,role:t.role}),n(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:n(H,{device:Z(t),form:`full`})}),e(F,{variant:`ghost`,size:`sm`,onClick:()=>u(Ce(t.id)),children:[n(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`locations.links.edit`)]}),n(F,{variant:`outline`,size:`sm`,disabled:b===null,onClick:()=>p(!0),"aria-label":a(`locations.links.addNamed`,{camera:s}),children:a(`locations.room.add`)})]}),_.kind===`pending`&&n(`p`,{role:`status`,className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.loading`)}),_.kind===`unknown`&&n(`p`,{role:`alert`,className:`px-3 py-3 text-xs text-warning sm:px-4`,children:a(`locations.links.unreadable`,{reason:_.reason})}),_.kind===`absent`&&n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.unsupported`)}),m!==null&&n(`p`,{role:`alert`,className:`px-3 pt-2 text-xs text-danger break-words sm:px-4`,children:m}),b!==null&&(S.length===0?n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.none`)}):n(j,{columns:A,rows:S,rowKey:e=>String(e.deviceId),bordered:!1,minWidthPx:360})),n(Ve,{open:d,title:a(`locations.links.pickTitle`,{camera:s}),items:D,listState:x.status===`error`?`failed`:x.data===void 0?`pending`:`answered`,lockedIds:C,lockedNote:a(`locations.links.alreadyLinked`),suggestions:t.location===null?null:{heading:a(`locations.links.suggested`,{room:t.location}),ids:O},busy:y.isPending,onConfirm:e=>void k(e),onClose:()=>p(!1)})]})}a();function Ge({name:t,description:a,busy:o,onSave:s}){let{t:c}=Y(),[l,u]=i(a??``);return r(()=>{u(a??``)},[a]),e(`div`,{className:`border-t border-border px-3 py-2 sm:px-4`,children:[n(ge,{htmlFor:`location-description-${t}`,className:`block`,children:c(`locations.locationDescriptionField.whatIsThere`,`What is there`)}),n(K,{id:`location-description-${t}`,value:l,onChange:e=>u(e.target.value),onBlur:()=>{let e=l.trim();e!==(a??``)&&s(e.length===0?null:e)},disabled:o,rows:2,maxLength:400,placeholder:c(`locations.locationDescriptionField.surfacesBoundariesWhatIsNormally`,`Surfaces, boundaries, what is normally parked or stored here.`),className:`mt-1 w-full resize-y rounded-md border border-border bg-surface px-2.5 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-inset focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50`}),n(`p`,{className:`mt-1 ${C}`,children:c(`locations.locationDescriptionField.givenToTheAiWith`,`Given to the AI with the pictures, so it knows what it is looking at. Describe the PLACE, not what happens in it — events change, the ground does not.`)})]})}function Ke(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0||n.description.length===0?null:n.description}var qe=` none`;function Je({name:t,zones:r,zoneKey:i,busy:a,onChange:o}){let{t:s}=Y();if(r.length===0)return null;let c=[{value:qe,label:s(`locations.locationZoneField.none`,`— none —`)},...r.map(e=>({value:e.zoneKey,label:e.label}))];return e(`div`,{className:`flex items-center gap-2 border-t border-border px-3 py-1.5 sm:px-4 sm:py-2`,children:[n(ge,{htmlFor:`location-zone-${t}`,children:s(`locations.locationZoneField.zone`,`Zone`)}),n(g,{id:`location-zone-${t}`,value:i??qe,disabled:a,onChange:e=>{let t=e.target.value;if(t===qe){o(null);return}let n=r.find(e=>e.zoneKey===t);n!==void 0&&o(n.label)},options:c})]})}function Ye(e,t){return e.find(e=>e.locationKeys.includes(t))?.zoneKey??null}function Xe({name:e,icon:t,busy:r,onPick:i}){return n(ve,{value:t,onPick:i,fallbackGlyph:y,clearGlyph:u,labels:{trigger:`Change the icon of ${e}`,panel:`Icon for ${e}`,searchPlaceholder:`Search icons`,clear:`No icon`,noMatches:`No icon matches that`},disabled:r})}function Ze(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0?null:E(n.icon)??`map-pin`}function Qe(e){return`${e.kind}:${String(e.device.id)}`}function $e(e,t,n){return e.flatMap(e=>{let r=Re(t,e.id),i=n.has(e.id),a={kind:`member`,device:e,accessories:r,open:i};return!i||r.length===0?[a]:[a,...r.map(t=>({kind:`accessory`,device:t,parent:e}))]})}a();function et({name:r,members:a,devices:o,busy:u,icon:d,description:f,onRename:p,onDelete:m,onRebuildLinks:h,onAddDevices:g,onPickIcon:y,onSaveDescription:x,zones:C,zoneKey:w,onChangeZone:T}){let{t:E}=Y(),[D,k]=i(!1),[A,M]=i(r),N=ce(a,t(()=>({searchText:e=>[e.name,...Re(o,e.id).map(e=>e.name)],facetValue:e=>e.type}),[o])),[P,I]=i(()=>new Set),ee=e=>I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),L=t(()=>$e(N.rows,o,P),[N.rows,o,P]),te=[{key:`name`,header:E(`locations.columns.device`),notSortableReason:E(`locations.columns.noSort`),render:e=>e.kind===`member`?n(tt,{row:e,onToggle:()=>ee(e.device.id)}):n(nt,{row:e})},{key:`type`,header:E(`locations.columns.type`),notSortableReason:E(`locations.columns.noSort`),render:e=>n(`span`,{className:`text-xs text-foreground-muted`,children:e.device.type})},{key:`status`,header:E(`locations.columns.status`),notSortableReason:E(`locations.columns.noSort`),render:e=>n(Be,{device:e.device})}],R=()=>{M(r),k(!1)},ne=async()=>{let e=A.trim();if(e.length===0||e===r){R();return}await p(e),k(!1)},z=[{id:`rename`,label:E(`locations.locationCard.rename`,`Rename`),icon:b,disabled:u,onClick:()=>{M(r),k(!0)}},{id:`rebuild-links`,label:E(`locations.locationCard.rebuildLinkedDevices`,`Rebuild linked devices`),icon:c,separatorBefore:!0,disabled:u,onClick:()=>void h()},{id:`delete`,label:E(`common.delete`,`Delete`),icon:_,danger:!0,separatorBefore:!0,disabled:u,onClick:()=>void m()}];return e(`section`,{className:`min-w-0 ${l}`,children:[e(`header`,{className:`${v} flex min-h-9 items-center gap-1.5`,children:[n(Xe,{name:r,icon:d,busy:u,onPick:y}),D?e(s,{children:[n(O,{value:A,onChange:e=>M(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ne(),e.key===`Escape`&&R()},"aria-label":E(`locations.locationCard.rename2`,`Rename {{name}}`,{name:r}),className:`min-w-0 flex-1`,autoFocus:!0}),n(F,{type:`button`,size:`sm`,onClick:()=>void ne(),children:E(`common.save`,`Save`)}),n(W,{type:`button`,variant:`ghost`,icon:S,onClick:R,"aria-label":E(`locations.locationCard.cancelRename`,`Cancel rename`)})]}):e(s,{children:[n(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:r}),n(F,{type:`button`,variant:`outline`,size:`sm`,disabled:u,onClick:g,"aria-label":E(`locations.room.addTo`,{room:r}),children:E(`locations.room.add`)}),n(V,{items:z,title:E(`locations.locationCard.actionsFor`,`Actions for {{name}}`,{name:r}),triggerClassName:`p-1`})]})]}),n(Je,{name:r,zones:C,zoneKey:w,busy:u,onChange:T}),n(Ge,{name:r,description:f,busy:u,onSave:x}),a.length>0&&n(`div`,{className:`border-b border-border px-3 py-1.5 sm:px-4 sm:py-2`,children:n(ye,{state:N.state,facets:N.facets,labels:{searchPlaceholder:E(`locations.filter.searchPlaceholder`),searchLabel:E(`locations.room.searchLabel`,{room:r}),facetsLabel:E(`locations.filter.typesLabel`),clearLabel:E(`locations.filter.clear`)},onSearch:N.setSearch,onToggleFacet:N.toggleFacet,onClear:N.clear})}),a.length===0?n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:E(`locations.locationCard.nothingHereYetAssignA`,`Nothing here yet — assign a device from the table below.`)}):n(j,{columns:te,rows:L,rowKey:Qe,bordered:!1,minWidthPx:360,emptyMessage:E(`locations.filter.noMatch`)})]})}function tt({row:t,onToggle:r}){let{t:i}=Y(),{device:a,accessories:o,open:s}=t,c=q(Z(a),`compact`),l=s?D:d;return e(`span`,{className:`flex items-center gap-1.5`,children:[o.length>0?e(F,{type:`button`,variant:`ghost`,onClick:r,"aria-expanded":s,"aria-label":i(s?`locations.locationCard.collapseAccessories`:`locations.locationCard.expandAccessories`,{count:o.length,name:c}),className:`h-auto shrink-0 gap-0.5 p-0.5 text-foreground-subtle hover:text-foreground`,children:[n(l,{className:`h-3 w-3`}),n(`span`,{className:`text-[10px] tabular-nums`,children:o.length})]}):n(`span`,{"aria-hidden":`true`,className:`w-[1.35rem] shrink-0`}),n($,{type:a.type,role:a.role}),n(X,{to:`/devices/${String(a.id)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:n(H,{device:Z(a),form:`compact`})})]})}function nt({row:t}){let{device:r,parent:i}=t;return e(`span`,{className:`flex items-center gap-1.5 pl-6`,children:[n(`span`,{"aria-hidden":`true`,className:`text-[10px] text-foreground-subtle`,children:`└`}),n($,{type:r.type,role:r.role,className:`h-3 w-3 shrink-0 text-foreground-subtle`}),n(X,{to:`/devices/${String(r.id)}`,className:`min-w-0 truncate text-xs text-foreground-muted hover:underline`,children:n(H,{device:Z(r),form:`nested`,parent:Z(i)})})]})}a();function rt({zones:e,busy:t,onRename:r,onDelete:a,onPickIcon:o}){let{t:s}=Y(),[c,l]=i(null),[u,d]=i(``),f=async e=>{let t=u.trim();l(null),!(t.length===0||t===e)&&await r(e,t)};return n(j,{columns:[{key:`icon`,header:s(`locations.siteZonesPanel.icon`,`Icon`),width:`w-12`,notSortableReason:`An icon has no order`,render:e=>n(Xe,{name:e.label,icon:e.icon,busy:t,onPick:t=>o(e.label,t)})},{key:`name`,header:s(`locations.siteZonesPanel.zone`,`Zone`),sortValue:e=>e.label.toLowerCase(),render:e=>c===e.label?n(O,{value:u,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&f(e.label),t.key===`Escape`&&l(null)},onBlur:()=>void f(e.label),"aria-label":s(`locations.siteZonesPanel.rename`,`Rename {{label}}`,{label:e.label}),autoFocus:!0}):n(F,{type:`button`,variant:`ghost`,size:`sm`,className:`px-0`,onClick:()=>{d(e.label),l(e.label)},disabled:t,title:s(`locations.siteZonesPanel.renameTheZone`,`Rename the zone`),children:e.label})},{key:`rooms`,header:s(`locations.siteZonesPanel.rooms`,`Rooms`),align:`right`,sortValue:e=>e.locationKeys.length,render:e=>n(`span`,{className:`tabular-nums text-foreground-subtle`,children:e.locationKeys.length===0?s(`common.empty`):s(`common.rooms`,{count:e.locationKeys.length})})},{key:`actions`,header:s(`locations.siteZonesPanel.actions`,`Actions`),align:`right`,notSortableReason:`Actions have no order`,render:e=>n(F,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void a(e.label),disabled:t,"aria-label":s(`locations.siteZonesPanel.delete`,`Delete {{label}}`,{label:e.label}),title:s(`locations.siteZonesPanel.deleteTheZoneTheRooms`,`Delete the zone — the rooms in it are kept`),children:n(_,{className:`h-3.5 w-3.5`})})}],rows:e,rowKey:e=>e.zoneKey,emptyMessage:s(`locations.siteZonesPanel.noZonesYetAZone`,`No zones yet. A zone groups rooms — “Night zone” for the bedrooms — and shows up before them in the app’s camera filter.`)})}a();function it({busy:t,onCreate:r}){let{t:a}=Y(),[o,s]=i(!1),[c,l]=i(``),u=()=>{l(``),s(!1)},d=async()=>{let e=c.trim();e.length!==0&&(await r(e),u())};return o?e(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d()},children:[n(O,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:a(`locations.newLocationButton.frontDoorHallKitchen`,`Front door, Hall, Kitchen…`),"aria-label":a(`locations.newLocationButton.newLocationName`,`New location name`),className:`min-w-[12rem] flex-1`,autoFocus:!0}),e(F,{size:`sm`,type:`submit`,disabled:c.trim().length===0||t,children:[n(x,{className:`h-3.5 w-3.5`}),a(`common.add`,`Add`)]}),n(F,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":a(`locations.newLocationButton.cancelNewLocation`,`Cancel new location`),children:n(S,{className:`h-3.5 w-3.5`})})]}):e(F,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-location-button`,children:[n(x,{className:`h-3.5 w-3.5`}),a(`locations.newLocationButton.newLocation`,`New location`)]})}a();function at({busy:t,onCreate:r}){let{t:a}=Y(),[o,s]=i(!1),[c,l]=i(``),u=()=>{l(``),s(!1)},d=async()=>{let e=c.trim();e.length!==0&&(await r(e),u())};return o?e(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d()},children:[n(O,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:a(`locations.newZoneButton.zonaGiornoZonaNotte`,`Zona giorno, Night zone…`),"aria-label":a(`locations.newZoneButton.newZoneName`,`New zone name`),className:`min-w-[12rem] flex-1`,autoFocus:!0}),e(F,{size:`sm`,type:`submit`,disabled:c.trim().length===0||t,children:[n(x,{className:`h-3.5 w-3.5`}),a(`common.add`,`Add`)]}),n(F,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":a(`locations.newZoneButton.cancelNewZone`,`Cancel new zone`),children:n(S,{className:`h-3.5 w-3.5`})})]}):e(F,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-zone-button`,children:[n(x,{className:`h-3.5 w-3.5`}),a(`locations.newZoneButton.newZone`,`New zone`)]})}a();function ot(e,t,n,r){let i=e.map(e=>({value:e.name,label:`${e.name} · ${String(e.count)}`}));return t===void 0?i:[...i,{value:n,label:`${r} · ${String(t)}`}]}function st({rooms:e,unassignedCount:r,value:i,unassignedValue:a,onChange:o}){let{t:s}=Y(),c=t(()=>ot(e,r,a,s(`locations.roomPicker.unassigned`)),[e,r,a,s]);return n(`div`,{className:`max-w-sm`,"data-testid":`room-select`,children:n(G,{mode:`single`,singleDisplay:`field`,label:s(`locations.roomPicker.label`),placeholder:s(`locations.roomPicker.placeholder`),options:c,value:i,onChange:o,searchable:!0,testId:`room-select-control`,optionTestIdPrefix:`room-option`})})}a();var ct={searchText:e=>[e.name],facetValue:e=>e.type};function lt({rows:r,fleet:a,locations:o,busy:s,emptyMessage:c,onAssign:l}){let{t:u}=Y(),d=N(),f=M(),h=e=>d===null?e.name:U(Z(e),`compact`,d,f),[_,v]=i([]),[y,b]=i(``),x=ce(r,ct),S=x.rows,w=t(()=>S.map(e=>e.id),[S]),T=t(()=>_.filter(e=>w.includes(e)),[_,w]),E=S.length>0&&T.length===S.length,D=t(()=>{let e=new Map;for(let t of r)e.set(t.id,Le(a,t.id));return e},[r,a]),O=T.reduce((e,t)=>e+(D.get(t)??0),0),k=e=>v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),A=()=>v(E?[]:w),P=()=>{y.length===0||T.length===0||(l(T,y),v([]),b(``))},I=o.map(e=>({value:e,label:e})),ee=[{key:`select`,width:`w-8`,headerRender:()=>n(p,{checked:E,onChange:A,"aria-label":E?u(`locations.unassignedTable.clearSelection`,`Clear selection`):u(`locations.unassignedTable.selectAllUnassignedDevices`,`Select all unassigned devices`)}),render:e=>n(p,{checked:T.includes(e.id),onChange:()=>k(e.id),"aria-label":u(`locations.unassignedTable.select`,`Select {{name}}`,{name:h(e)})})},{key:`name`,header:u(`locations.unassignedTable.device`,`Device`),sortValue:e=>e.name.toLowerCase(),render:t=>{let r=Me(t,o);return e(`span`,{className:`flex items-center gap-1.5`,children:[n($,{type:t.type,role:t.role}),n(X,{to:`/devices/${String(t.id)}`,className:`truncate text-xs text-foreground hover:underline`,children:n(H,{device:Z(t),form:`compact`})}),r!==null&&n(fe,{variant:`warning`,children:u(`locations.unassignedTable.unknownRoom`,{room:r})})]})}},{key:`type`,header:u(`locations.unassignedTable.type`,`Type`),sortValue:e=>e.type,render:e=>n(`span`,{className:`text-xs text-foreground-muted`,children:e.type})},{key:`status`,header:u(`locations.unassignedTable.status`,`Status`),sortValue:e=>+!!e.online,render:e=>n(Be,{device:e})},{key:`followers`,header:u(`locations.unassignedTable.accessoriesInTowCount`,`Accessories in tow`),align:`right`,sortValue:e=>D.get(e.id)??0,render:e=>n(`span`,{className:`tabular-nums text-xs text-foreground-muted`,children:D.get(e.id)??0})},{key:`assign`,header:u(`locations.unassignedTable.assignTo`,`Assign to`),align:`right`,notSortableReason:`This column is a control, not a value.`,render:e=>n(g,{"aria-label":u(`locations.unassignedTable.locationFor`,`Location for {{name}}`,{name:h(e)}),value:``,disabled:s||o.length===0,onChange:t=>{let n=t.target.value;n.length!==0&&l([e.id],n)},className:`max-w-[11rem]`,options:[{value:``,label:`—`},...I]})}];return e(`section`,{className:`space-y-2`,children:[e(`header`,{className:`flex flex-wrap items-baseline gap-2`,children:[n(`h2`,{className:m,children:u(`locations.unassignedTable.notInARoom`,`Not in a room`)}),n(`p`,{className:C,children:u(`locations.unassignedTable.topLevelDevicesOnlyAccessories`,`Top-level devices only — accessories move with their parent.`)})]}),r.length>0&&n(ye,{state:x.state,facets:x.facets,labels:{searchPlaceholder:u(`locations.filter.searchPlaceholder`),searchLabel:u(`locations.unassigned.searchLabel`),facetsLabel:u(`locations.filter.typesLabel`),clearLabel:u(`locations.filter.clear`)},onSearch:x.setSearch,onToggleFacet:x.toggleFacet,onClear:x.clear}),T.length>0&&e(`div`,{role:`group`,"aria-label":u(`locations.unassignedTable.bulkAssignment`,`Bulk assignment`),className:`flex flex-wrap items-center gap-2 rounded border border-primary/40 bg-primary/5 px-2 py-1.5`,children:[e(`span`,{className:`text-xs text-foreground`,children:[u(`locations.unassignedTable.selected`,{count:T.length}),O>0&&` · ${u(`locations.unassignedTable.accessoriesInTowCount`,{count:O})}`]}),n(g,{"aria-label":u(`locations.unassignedTable.assignSelectedDevicesTo`,`Assign selected devices to`),value:y,onChange:e=>b(e.target.value),className:`w-auto min-w-[10rem]`,options:[{value:``,label:u(`locations.unassignedTable.assignTo2`,`Assign to…`)},...I]}),n(F,{type:`button`,size:`sm`,onClick:P,disabled:s||y.length===0,children:u(`locations.unassignedTable.assign`,`Assign`)}),n(F,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>v([]),children:u(`locations.unassignedTable.clear`,`Clear`)})]}),n(j,{columns:ee,rows:S,rowKey:e=>e.id,minWidthPx:720,emptyMessage:x.active?u(`locations.filter.noMatch`):c})]})}function ut(e){return{id:e.id,parentDeviceId:e.parentDeviceId,location:e.location,type:e.type,stableId:e.stableId??``,...e.primaryChildEntityId===void 0?{}:{primaryChildEntityId:e.primaryChildEntityId},...e.primaryChildPreference===void 0?{}:{primaryChildPreference:e.primaryChildPreference},...e.role!==void 0&&e.role!==null?{role:e.role}:{},name:e.name}}function dt(e,t){let n=t.map(ut),r=[];for(let i of t)i.isCamera&&i.location===e&&r.push({deviceId:i.id,name:i.name,ids:w({selfId:i.id,selfLocation:i.location,candidates:n})});return{entries:r}}var ft=`device-manager:linked-devices`;function pt(e){return{deviceId:e.deviceId,slotRef:ft,value:{slot:`linked-devices`,deviceIds:[...e.ids]}}}a();var mt=`__unassigned__`;function ht(){let{t:r}=Y(),a=o(),s=h(),{data:c,isLoading:l}=Se(),{data:u}=ie(),{data:d}=te(),{data:f}=ae(),{data:p,isLoading:m}=ne({projection:`slim`}),g=()=>{a.invalidateQueries({queryKey:[[`deviceManager`,`listLocations`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listLocationIcons`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listLocationDescriptions`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listSiteZones`]]})},_=le({onSuccess:g}),v=ee({onSuccess:g}),b=re({onSuccess:g}),x=I({onSuccess:g}),S=ue({onSuccess:g}),C=k({onSuccess:g}),w=pe({onSuccess:g}),E=me({onSuccess:g}),D=oe({onSuccess:g}),O=_e({onSuccess:g}),A=se(),j=t(()=>(p??[]).map(e=>({id:e.id,name:e.name,location:e.location??null,type:String(e.type),isCamera:e.isCamera,parentDeviceId:e.parentDeviceId,online:e.online,role:e.role??null,stableId:e.stableId,primaryChildEntityId:e.primaryChildEntityId??null,primaryChildPreference:e.primaryChildPreference??null})),[p]),M=c??[],N=t(()=>ze(j,M),[j,M]),[P,F]=we(),L=P.get(`tab`),R=L===`zones`||L===`camera-links`?L:`locations`,z=P.get(`room`),B=t(()=>Fe(j,M),[j,M]),V=z===mt,H=V?null:z!==null&&N.some(e=>e.name===z)?z:N[0]?.name??null,U=H===null?null:N.find(e=>e.name===H)??null,ce=V?mt:H??`__unassigned__`,W=H??N[0]?.name??null,de=t(()=>N.map(e=>({name:e.name,count:e.members.length})),[N]),fe=e=>{F(t=>{let n=new URLSearchParams(t);return n.set(`room`,e),n},{replace:!0})},G=l||m,K=b.isPending||v.isPending||_.isPending||S.isPending,he=async e=>{await _.mutateAsync({name:e})},ge=async(e,t)=>{let n=t.trim();n.length===0||n===e||await x.mutateAsync({from:e,to:n})},ve=async e=>{let t=dt(e,j);if(t.entries.length===0){await s({title:r(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:r(`locations.noCameraIsAssignedTo`,`No camera is assigned to “{{room}}”.`,{room:e}),confirmLabel:`OK`});return}let n=t.entries.map(e=>r(`locations.rebuildEntry`,{name:e.name,count:e.ids.length})).join(`
2
- `);if(!await s({title:r(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:r(`locations.replaceTheLinkedDeviceList`,`Replace the linked-device list of every camera in “{{room}}” with what the room contains? {{lines}} Anything linked by hand that is not in this room is lost.`,{room:e,lines:n}),confirmLabel:r(`locations.rebuild`,`Rebuild`),variant:`danger`}))return;let i=[];for(let e of t.entries)try{await A.mutateAsync(pt(e))}catch(t){i.push(`• ${e.name}: ${t instanceof Error?t.message:String(t)}`)}g(),i.length>0&&await s({title:r(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:r(`locations.notRebuilt`,`Not rebuilt: {{value1}}`,{value1:i.join(`
3
- `)}),confirmLabel:`OK`})},q=async(e,t)=>{let n=t>0?` ${String(t)} device(s) will become unassigned.`:``;await s({title:r(`locations.deleteLocation`,`Delete location`),message:r(`locations.deleteTheLocation`,`Delete the location “{{name}}”?{{extra}}`,{name:e,extra:n}),confirmLabel:r(`common.delete`,`Delete`),variant:`danger`})&&await v.mutateAsync({name:e,cascade:!0})},ye=async e=>{await s({title:r(`locations.deleteZone`,`Delete zone`),message:r(`locations.deleteTheZoneTheRooms`,`Delete the zone “{{name}}”? The rooms in it are kept.`,{name:e}),confirmLabel:r(`common.delete`,`Delete`),variant:`danger`})&&await E.mutateAsync({name:e})},be=async(e,t)=>{await S.mutateAsync({location:e,icon:t})},xe=async(e,t)=>{await C.mutateAsync({location:e,description:t})},J=f??[],Ce=async(e,t)=>{await O.mutateAsync({location:e,zone:t})},Te=(e,t)=>{for(let n of e)b.mutate({deviceId:n,location:t})},[X,De]=i(null),Oe=t(()=>j.filter(e=>e.parentDeviceId===null).map(e=>({id:e.id,name:e.name,type:e.type,location:e.location})),[j]),ke=n(st,{rooms:de,...R===`locations`?{unassignedCount:B.length}:{},value:R===`locations`?ce:W??``,unassignedValue:mt,onChange:fe}),Z=e(`div`,{className:`flex flex-col gap-3`,"data-testid":`locations-section`,children:[G&&n(`p`,{className:`text-xs text-foreground-subtle`,children:r(`locations.loadingLocationsAndDevices`,`Loading locations and devices…`)}),ke,V||U===null?n(lt,{rows:B,fleet:j,locations:M,busy:K,emptyMessage:G?r(`common.loading`,`Loading…`):r(`locations.everyTopLevelDeviceHas`,`Every top-level device has a room.`),onAssign:Te}):n(et,{name:U.name,members:U.members,devices:j,busy:K,icon:Ze(u,T(U.name)),onPickIcon:e=>be(U.name,e),description:Ke(d,T(U.name)),onSaveDescription:e=>xe(U.name,e),zones:J,zoneKey:Ye(J,T(U.name)),onChangeZone:e=>Ce(U.name,e),onRename:e=>ge(U.name,e),onDelete:()=>q(U.name,Ae(j,U.name).length),onRebuildLinks:()=>ve(U.name),onAddDevices:()=>De(U.name)},U.name),M.length===0&&!G&&n(`p`,{className:`text-xs text-foreground-subtle`,children:r(`locations.noLocationsYetAddFrontDoor`,`No locations yet. Add Front door, Hall, Kitchen…`)}),n(Ve,{open:X!==null,title:r(`locations.room.addDialogTitle`,{room:X??``}),items:Oe,listState:m?`pending`:`answered`,lockedIds:X===null?[]:(N.find(e=>e.name===X)?.members??[]).map(e=>e.id),lockedNote:r(`locations.room.alreadyHere`),suggestions:{heading:r(`locations.room.suggestedUnassigned`),ids:B.map(e=>e.id)},busy:b.isPending,onConfirm:e=>{X!==null&&Te(e,X),De(null)},onClose:()=>De(null)})]}),Q=e(`div`,{className:`flex flex-col gap-3`,"data-testid":`camera-links-tab`,children:[ke,n(He,{room:W,cameras:W===null?[]:Ae(j,W).filter(e=>e.isCamera),fleet:j})]});return n(Ee,{icon:y,title:r(`locations.locations`,`Locations`),subtitle:r(`locations.roomsAndAreasOfThe`,`Rooms and areas of the site. Assign any device here — storage disks are under Data → Storage.`),defaultSection:`locations`,sectionsLabel:`Locations sections`,actions:R===`zones`?n(at,{busy:w.isPending,onCreate:e=>w.mutateAsync({name:e})}):n(it,{busy:_.isPending,onCreate:he}),sections:[{id:`locations`,label:r(`locations.locations`,`Locations`),content:Z},{id:`camera-links`,label:r(`locations.cameraLinks`,`Camera links`),content:Q},{id:`zones`,label:r(`locations.zones`,`Zones`),content:n(rt,{zones:J,busy:K,onRename:(e,t)=>D.mutateAsync({from:e,to:t}),onDelete:ye,onPickIcon:(e,t)=>w.mutateAsync({name:e,icon:t})})}]})}export{ht as LocationsPage};