@camstack/addon-admin-ui 1.2.475 → 1.2.477

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 (136) hide show
  1. package/dist/assets/{AddonAssetIcon-BNfqkJPr.js → AddonAssetIcon-B_-30Ezl.js} +1 -1
  2. package/dist/assets/Addons-CbHidHOJ.js +5 -0
  3. package/dist/assets/{AdminPage-UX2_-EVb.js → AdminPage-3JxWocN3.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-CJhCo7eS.js → AdminSectionedPage-DtiHBXGC.js} +1 -1
  5. package/dist/assets/AiProfiles-7FToWDqj.js +3 -0
  6. package/dist/assets/{BrokerForm-B1b0ZQq_.js → BrokerForm-D5-q8F_8.js} +1 -1
  7. package/dist/assets/Build-DwW5kYsa.js +40 -0
  8. package/dist/assets/{Calendars-CPP5G4iE.js → Calendars-BhMRY6EV.js} +1 -1
  9. package/dist/assets/{Cluster-DxeRVsUO.js → Cluster-z11q6anB.js} +1 -1
  10. package/dist/assets/CompositionBlockEditor-CElNVsCR.js +1 -0
  11. package/dist/assets/CompositionEditorPage-NzgZB76B.js +1 -0
  12. package/dist/assets/Data-D_U-HkwO.js +2 -0
  13. package/dist/assets/{DeviceDetail-DKGhhLVK.js → DeviceDetail-D89wXQHP.js} +2 -2
  14. package/dist/assets/{DeviceDoActionFields-CVBUVXjq.js → DeviceDoActionFields-Bj4gX0r-.js} +1 -1
  15. package/dist/assets/{Devices-D9OmxxCE.js → Devices-BnhDZU3y.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-u5jZuoCz.js → EmbedPlayerPage-Ccf5hGui.js} +1 -1
  17. package/dist/assets/{HelperWizard-Dape3GuD.js → HelperWizard-CrXHYd19.js} +2 -2
  18. package/dist/assets/History-BsJBR2zt.js +1 -0
  19. package/dist/assets/Identity-B_6I_sCY.js +1 -0
  20. package/dist/assets/IntegrationDetail-B9L7AfYy.js +1 -0
  21. package/dist/assets/IntegrationHub-CSaA690G.js +1 -0
  22. package/dist/assets/Integrations-B-KtSB_m.js +1 -0
  23. package/dist/assets/Integrations-CMW4LOX-.js +1 -0
  24. package/dist/assets/{Library-DUWYOPjU.js → Library-3dGkOQB5.js} +1 -1
  25. package/dist/assets/Locations-Bh5GRDCv.js +3 -0
  26. package/dist/assets/{Logs-CPgxOarw.js → Logs-diqSxXEc.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-Cmq6IidK.js → MaskShapeCanvas-UFmJUhUS.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-CnZg9FTF.js → MotionZonesSettings-BTxe4DbF.js} +1 -1
  29. package/dist/assets/{MyAccess-BKLOlMok.js → MyAccess-BqulMSGv.js} +1 -1
  30. package/dist/assets/{Network-BT4UeK8H.js → Network-C8Gpb2Vn.js} +1 -1
  31. package/dist/assets/{NodeAddonsSettingsPanel-75hJ0AJM.js → NodeAddonsSettingsPanel-Dq6sGWkR.js} +1 -1
  32. package/dist/assets/Notifications-C5w5t75z.js +1 -0
  33. package/dist/assets/Pipeline-CjumfHMc.js +1 -0
  34. package/dist/assets/{PrivacyMaskSettings-BFWSAVsy.js → PrivacyMaskSettings-D6kokNvH.js} +1 -1
  35. package/dist/assets/Recordings-DE76fgEt.js +1 -0
  36. package/dist/assets/{ScanNetworkModal-hCwvBDMd.js → ScanNetworkModal-DXzDOpxk.js} +1 -1
  37. package/dist/assets/{SceneMonitorEditor-BVdAyhJk.js → SceneMonitorEditor-CrDKfkgT.js} +1 -1
  38. package/dist/assets/SessionsList-Ca-zN1Fi.js +2 -0
  39. package/dist/assets/{Showroom-DlUMfmmX.js → Showroom-B9HZ38O5.js} +1 -1
  40. package/dist/assets/{System-xDNpG66Z.js → System-CHEbMPI_.js} +1 -1
  41. package/dist/assets/{Terminal-BKTT8qvq.js → Terminal-CWFZuQLg.js} +3 -3
  42. package/dist/assets/{Viewer-Cu8oX6VE.js → Viewer-DwNVIy-u.js} +1 -1
  43. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-20B8V9NZ.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-QiJARN9B.js} +1 -1
  44. package/dist/assets/{addon-icons-context-BuuVE9Wr.js → addon-icons-context-lrP_33gc.js} +1 -1
  45. package/dist/assets/{archive-CfJx72Ya.js → archive-Brq5E-qM.js} +1 -1
  46. package/dist/assets/{assignment-candidates-B51c4fCG.js → assignment-candidates-BcnFMc1B.js} +1 -1
  47. package/dist/assets/{authed-media-iyqNF0CO.js → authed-media-CnaIhiH3.js} +1 -1
  48. package/dist/assets/{bell-off-D1QNHdBJ.js → bell-off-CDjOfT8K.js} +1 -1
  49. package/dist/assets/{board-model-4EY3kgfH.js → board-model-gmvqxkjB.js} +1 -1
  50. package/dist/assets/{boxes-DomeSuUE.js → boxes-0ut2NdHU.js} +1 -1
  51. package/dist/assets/circle-slash-CaxGVwz5.js +1 -0
  52. package/dist/assets/client-DvJxGh2F.js +358 -0
  53. package/dist/assets/{cloud-upload-J0OXIjbZ.js → cloud-upload-M9JxZe_d.js} +1 -1
  54. package/dist/assets/crop-eK4NEtXI.js +1 -0
  55. package/dist/assets/{device-integration-icon-BQEjbsKG.js → device-integration-icon-0oWIIjcP.js} +1 -1
  56. package/dist/assets/device-picker-model-CUPf26ML.js +1 -0
  57. package/dist/assets/{dist-DcarhQ77.js → dist-B9cEBPZ1.js} +1 -1
  58. package/dist/assets/{eraser-DdaeWuQ6.js → eraser-Bs0PJaPY.js} +1 -1
  59. package/dist/assets/{format-Bq6kzos8.js → format-CIO4xeN9.js} +1 -1
  60. package/dist/assets/{hard-drive-download-YerwrGPA.js → hard-drive-download-iRJR_Xj9.js} +1 -1
  61. package/dist/assets/{hostInit-B6UQXYd9.js → hostInit-DB6u6qxU.js} +1 -1
  62. package/dist/assets/i18n-xhwARoF0.js +1 -0
  63. package/dist/assets/icons-apbWMCU4.js +1 -0
  64. package/dist/assets/index-C3uCLHv0.js +4 -0
  65. package/dist/assets/index-D4ZlWCxy.css +2 -0
  66. package/dist/assets/{key-CunS-V0Z.js → key-Crd8m-SP.js} +1 -1
  67. package/dist/assets/{key-round-DcVl91E5.js → key-round-DG341WFZ.js} +1 -1
  68. package/dist/assets/{layers-BC3a28BZ.js → layers-BnsQ5ORI.js} +1 -1
  69. package/dist/assets/{linked-devices-model-CWqnVKj5.js → linked-devices-model-BoOq02QT.js} +1 -1
  70. package/dist/assets/{list-ordered-B_2hLh_-.js → list-ordered-BIo7AnFy.js} +1 -1
  71. package/dist/assets/{location-owned-usage-C3ukxAgd.js → location-owned-usage-IF2k-L3A.js} +1 -1
  72. package/dist/assets/{log-in-IPEzbjqk.js → log-in-D1BPSCDn.js} +1 -1
  73. package/dist/assets/{memory-stick-CUBeuzQu.js → memory-stick-CjPBCMfd.js} +1 -1
  74. package/dist/assets/{message-square-plus-DHiayOOs.js → message-square-plus-C4N5hy0x.js} +1 -1
  75. package/dist/assets/{mf-entry-bootstrap-0-976d3c1a.js → mf-entry-bootstrap-0-f45a46c2.js} +2 -2
  76. package/dist/assets/{mic-off-DX_Buyxi.js → mic-off-CgPfA49W.js} +1 -1
  77. package/dist/assets/{monitor-off-Czk3uiUL.js → monitor-off-Ib2v0VDF.js} +1 -1
  78. package/dist/assets/{monitor-smartphone-DhnI06Vd.js → monitor-smartphone-6w2T5Ht_.js} +1 -1
  79. package/dist/assets/mount-CUPf26ML.js +1 -0
  80. package/dist/assets/{player-overlays-DfIXPXfC.js → player-overlays-Dbv95cvz.js} +1 -1
  81. package/dist/assets/{recycle-CIxCuRlw.js → recycle-DcScXiTi.js} +1 -1
  82. package/dist/assets/remoteEntry-CVuKB7K_.js +1 -0
  83. package/dist/assets/{scan-eye-CNch-kOQ.js → scan-eye-CWOvobjP.js} +1 -1
  84. package/dist/assets/{scissors-DAqmNijF.js → scissors-NpyrGUBV.js} +1 -1
  85. package/dist/assets/{search-x-Bam8bduF.js → search-x-CKQw--aU.js} +1 -1
  86. package/dist/assets/{send-DTxEr1U2.js → send-402PlgqT.js} +1 -1
  87. package/dist/assets/{settings-2-Gykf_Jj2.js → settings-2-BbwQVFbm.js} +1 -1
  88. package/dist/assets/{speaker-vU_58Q4N.js → speaker-DCHkSyjS.js} +1 -1
  89. package/dist/assets/src-DntJrWmU.js +67 -0
  90. package/dist/assets/{step-inspector-model-COSP18Eo.js → step-inspector-model-CyqFN-LU.js} +1 -1
  91. package/dist/assets/table-2-CTZnEliG.js +1 -0
  92. package/dist/assets/{timer-reset-BfVqeFHK.js → timer-reset-DZ3bTFWu.js} +1 -1
  93. package/dist/assets/{ungroup-BzhYEwYi.js → ungroup-3fOR8xo7.js} +1 -1
  94. package/dist/assets/{unlink-DcrSLSGi.js → unlink-vu-wpZmU.js} +1 -1
  95. package/dist/assets/{usb-CCxf9eVL.js → usb-CGOBq5r2.js} +1 -1
  96. package/dist/assets/{use-scenes-feed-CCy-Tx5-.js → use-scenes-feed-D80maECB.js} +1 -1
  97. package/dist/assets/{use-stationary-objects-rfvEUY5Q.js → use-stationary-objects-DBEa50KS.js} +1 -1
  98. package/dist/assets/useEventInvalidation-CUPf26ML.js +1 -0
  99. package/dist/assets/{useNodeUrlSelection-BDqOR0oD.js → useNodeUrlSelection-DGV2ltbG.js} +1 -1
  100. package/dist/assets/user-round-CmncOV9r.js +1 -0
  101. package/dist/assets/{user-x-DNQnP84p.js → user-x-CjUfhy0O.js} +1 -1
  102. package/dist/assets/{video-FHJCba2c.js → video-D7jv0spx.js} +1 -1
  103. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BBtNcF2c.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CglCXJMd.js} +2 -2
  104. package/dist/index.html +10 -10
  105. package/dist/server/addon.js +1 -1
  106. package/package.json +1 -1
  107. package/dist/assets/Addons-BQclhgQv.js +0 -5
  108. package/dist/assets/AiProfiles-zhlwR2_B.js +0 -3
  109. package/dist/assets/Build-DMVYWc57.js +0 -40
  110. package/dist/assets/CompositionCreateForm-ZntjBNdS.js +0 -1
  111. package/dist/assets/CompositionEditorPage-CpvZY109.js +0 -1
  112. package/dist/assets/Data-NzOvsB8O.js +0 -2
  113. package/dist/assets/History-D-T-XA80.js +0 -1
  114. package/dist/assets/Identity-DmBhBZsL.js +0 -1
  115. package/dist/assets/IntegrationDetail-0C2a7iSq.js +0 -1
  116. package/dist/assets/IntegrationHub-DdxMGRIt.js +0 -1
  117. package/dist/assets/Integrations-aOO9hE39.js +0 -1
  118. package/dist/assets/Integrations-eKDwugCV.js +0 -1
  119. package/dist/assets/Locations-D4YphIdu.js +0 -3
  120. package/dist/assets/Notifications-B7JOfwPI.js +0 -1
  121. package/dist/assets/Pipeline-DKfkLPEM.js +0 -1
  122. package/dist/assets/Recordings-OmewxCzq.js +0 -1
  123. package/dist/assets/SessionsList-CTsz8qck.js +0 -2
  124. package/dist/assets/circle-slash-CPzLe6ak.js +0 -1
  125. package/dist/assets/client-fa7ANI4X.js +0 -358
  126. package/dist/assets/crop-4oyysRxn.js +0 -1
  127. package/dist/assets/device-picker-model-CsITnnp7.js +0 -1
  128. package/dist/assets/i18n-l_m6iBJW.js +0 -1
  129. package/dist/assets/icons-BBOyPCCy.js +0 -1
  130. package/dist/assets/index-B4dcSKZt.css +0 -2
  131. package/dist/assets/index-Ctkts88E.js +0 -4
  132. package/dist/assets/mount-CsITnnp7.js +0 -1
  133. package/dist/assets/remoteEntry-isS_YRZd.js +0 -1
  134. package/dist/assets/src-Cy_bal4g.js +0 -67
  135. package/dist/assets/useEventInvalidation-CsITnnp7.js +0 -1
  136. package/dist/assets/user-round-D6lnAuWE.js +0 -1
@@ -1 +0,0 @@
1
- import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o,o as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Cn as l,Di as u,On as d,Si as f,bn as p,dt as m,fn as h,kn as g,or as _,ot as v,un as y,xi as b,yi as x}from"./player-overlays-DfIXPXfC.js";import{At as S,Ha as ee,Nt as C,Qu as w,at as T,ci as E,do as D,eo as O,is as te,jt as k,ls as A,od as j,r as M,ss as N}from"./src-Cy_bal4g.js";import{t as P}from"./i18n-l_m6iBJW.js";import{t as F}from"./useTranslation-BJr-n0es.js";import{fr as I,mr as ne,sr as L}from"./index-Ctkts88E.js";import{t as R}from"./AdminPage-UX2_-EVb.js";import"./useEventInvalidation-CsITnnp7.js";import{t as re}from"./device-integration-icon-BQEjbsKG.js";import{n as z,r as B,t as ie}from"./ScanNetworkModal-hCwvBDMd.js";o();function V(e=!0){i(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e])}o();function ae(e,t){let[n,r]=a(!1);return i(()=>{if(!e){r(!1);return}r(!1);let n=setTimeout(()=>r(!0),t);return()=>clearTimeout(n)},[e,t]),n}o();function H({providerId:t,onImport:n,onSkip:o}){let{t:s}=F(),[c,l]=a(new Set),d=O(),p=d.data,m=d.isPending||!d.data&&!d.isError;i(()=>{t&&(d.isPending||d.data||d.mutate({addonId:t}))},[t,d]);function h(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}if(m)return e(`div`,{className:`flex flex-col items-center py-12`,children:[r(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent`}),r(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:s(`integrations.searchingDevices`)})]});let g=p??[];return e(`div`,{className:`space-y-4`,children:[r(`p`,{className:`text-xs text-foreground-subtle`,children:g.length>0?s(`integrations.foundDevices`,{count:g.length}):s(`integrations.noDevicesFound`)}),g.length>0&&r(`div`,{className:`space-y-1.5 max-h-64 overflow-y-auto`,children:g.map(t=>{let n=t.stableId,i=t.suggestedName??n,a=c.has(n),o=t.alreadyOnboarded===!0;return e(`button`,{onClick:()=>{o||h(n)},disabled:o,title:o?s(`integrations.alreadyAddedHint`,{defaultValue:`Already added as "{{name}}" — re-adding would overwrite its settings.`,name:t.onboardedName??i}):void 0,className:`flex w-full items-center gap-3 rounded-lg border p-3 text-left transition-colors ${o?`border-border bg-surface opacity-60 cursor-not-allowed`:a?`border-primary/40 bg-primary/5`:`border-border bg-surface hover:border-foreground-subtle/30`}`,children:[r(`div`,{className:`flex h-5 w-5 items-center justify-center rounded border flex-shrink-0 ${a&&!o?`border-primary bg-primary`:`border-border`}`,children:a&&!o&&r(f,{className:`h-3 w-3 text-primary-foreground`})}),r(u,{className:`h-3.5 w-3.5 text-foreground-subtle flex-shrink-0`}),r(`span`,{className:`text-xs font-medium text-foreground truncate`,children:i}),o&&r(`span`,{className:`ml-auto flex-shrink-0 rounded bg-surface-muted px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle`,children:s(`integrations.alreadyAdded`,{defaultValue:`Already added`})})]},n)})}),e(`div`,{className:`flex items-center justify-between pt-2`,children:[r(`button`,{onClick:o,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:s(`integrations.skip`)}),g.length>0&&e(`button`,{onClick:()=>n(Array.from(c)),disabled:c.size===0,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:[s(`integrations.importSelected`),` (`,c.size,`)`]})]})]})}o();function U({onSelect:n,onClose:i,pendingAddonId:o=null}){let{t:s}=F(),c=I(),[l,u]=a(``),{data:d,isLoading:f}=N(),p=t(()=>{let e=d??[],t=l.trim().toLowerCase();return t.length===0?e:e.filter(e=>`${e.name} ${e.description??``} ${e.addonId}`.toLowerCase().includes(t))},[d,l]);if(f)return r(`div`,{className:`grid grid-cols-2 gap-2 p-2`,children:[1,2,3,4].map(e=>r(`div`,{className:`h-24 rounded-lg bg-surface animate-pulse`},e))});let m=o!==null;return e(`div`,{className:`space-y-3`,"data-testid":`provider-picker`,children:[e(`div`,{className:`relative`,children:[r(h,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),r(w,{type:`search`,value:l,onChange:e=>u(e.target.value),placeholder:s(`integrations.searchProviders`,`Search integrations…`),className:`pl-8`,"data-testid":`provider-picker-search`,"aria-label":s(`integrations.searchProviders`,`Search integrations…`)})]}),r(`div`,{className:`grid grid-cols-2 gap-2`,children:p.map(t=>{let a=t.instanceMode===`unique`&&t.existingInstances.length>0,l=o===t.addonId,u=m;return e(`button`,{type:`button`,disabled:u,"data-testid":`provider-pick-${t.addonId}`,onClick:()=>{if(!u)if(a){let e=t.existingInstances[0].id;i(),c(`/integrations/${e}`)}else n(t.addonId,t.instanceMode,t.discoveryMode,t.name,t.kind,t.brokerKind,t.mode,t.canTest)},className:`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-3 text-center text-xs hover:border-primary/50 hover:bg-surface-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed disabled:hover:border-border`,children:[t.iconUrl?r(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg flex-shrink-0`,style:{backgroundColor:`${t.color}15`},children:r(`img`,{src:t.iconUrl,alt:``,className:`h-5 w-5`})}):r(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg flex-shrink-0`,style:{backgroundColor:`${t.color}15`},children:r(`span`,{className:`text-sm`,style:{color:t.color},children:`◉`})}),r(`p`,{className:`w-full truncate text-xs font-semibold text-foreground`,children:t.name}),t.description?r(`p`,{className:`w-full line-clamp-2 text-[10px] text-foreground-subtle`,children:t.description}):null,l?r(_,{className:`h-4 w-4 animate-spin text-primary`}):a?e(`span`,{className:`flex items-center gap-1 text-[10px] font-medium text-foreground-subtle`,children:[r(y,{className:`h-3 w-3`}),s(`integrations.manage`)]}):null]},t.addonId)})}),p.length===0&&r(`div`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:(d??[]).length===0?s(`integrations.noProviders`):s(`integrations.noProvidersMatch`,`No integrations match your search.`)})]})}o();function oe(e){let t=e=>{if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`)return{...e,fields:e.fields.map(e=>t(e))};let{value:n,...r}=e;return r};return{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>({...e,fields:e.fields.map(t)}))}}var W=2e4;function se({open:n,onClose:o}){let{t:l}=F(),u=I(),d=s(),[f,p]=a(`picker`),[h,g]=a(null),[v,y]=a(null),[b,x]=a(`manual`),[S,C]=a(null),[w,T]=a(``),[D,k]=a(null),[A,j]=a(null),[M,N]=a(!1),{data:P}=E({addonId:h??``,nodeId:`hub`},{enabled:h!=null}),ne=t(()=>P?oe(P):null,[P]),L=te({onSuccess:()=>d.invalidateQueries({queryKey:[[`integrations`]]})}),R=O(),re=R.data;i(()=>{f!==`discovery`||!v||!h||R.isPending||R.data||R.mutate({addonId:h})},[f,v,h,R]);let ie=ee({onSuccess:()=>d.invalidateQueries({queryKey:[[`deviceManager`]]})});function se(e,t,n,r,i,a,o,s){if(!L.isPending){if(g(e),N(s),x(n),T(r),j(null),o===`broker`){if(!a){j(`Addon '${e}' declares mode 'broker' but no brokerKind in its manifest`);return}C(a),p(`broker`);return}if(o===`account`){p(`config`);return}G(e,r)}}async function G(e,t){try{let n=await L.mutateAsync({addonId:e,name:t,settings:{}});o(),J(),u(`/integrations/${n.id}?add=1`)}catch{}}async function ce(e){if(h)try{let t=await L.mutateAsync({addonId:h,name:e.name,settings:e.config,secretKeys:[...e.secretKeys]});y(t.id),k(t.id),b===`auto`||b===`both`?p(`discovery`):q(t.id,{openAdd:!0})}catch{}}async function le(e){if(h)try{let t=await L.mutateAsync({addonId:h,name:w,settings:{brokerId:e}});k(t.id),y(t.id),q(t.id)}catch{}}async function K(e){if(h){for(let t of e){let e=re?.find(e=>e.stableId===t);e&&await ie.mutateAsync({addonId:h,candidate:e,...D===null?{}:{integrationId:D}})}q()}}function q(e,t){let n=e??v??h;o(),J(),n&&u(t?.openAdd===!0?`/integrations/${n}?add=1`:`/integrations/${n}`)}function J(){p(`picker`),g(null),y(null),x(`manual`),C(null),T(``),k(null),j(null),N(!1)}function Y(){o(),J()}V(n);let X=L.isPending,Z=ae(X,W);if(!n)return null;let ue={picker:l(`integrations.newIntegration`),config:l(`integrations.configureIntegration`),discovery:l(`integrations.importDevices`),broker:l(`integrations.connectBroker`,{defaultValue:`Connect a broker`})},Q=X?h:null,$=L.error,de=X&&!Z;return e(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[r(`div`,{className:`absolute inset-0 bg-black/60`,onClick:de?void 0:Y}),e(`div`,{className:`relative z-10 w-full max-w-lg max-h-[calc(85dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl flex flex-col overflow-hidden`,children:[e(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 flex-shrink-0`,children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:ue[f]}),r(`button`,{onClick:Y,disabled:de,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:r(m,{className:`h-4 w-4`})})]}),e(`div`,{className:`px-5 py-4 flex-1 overflow-y-auto overscroll-contain`,children:[$&&!X&&r(`div`,{className:`mb-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:$ instanceof Error?$.message:String($)}),f===`picker`&&e(c,{children:[A&&r(`div`,{className:`mb-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:A}),r(U,{onSelect:se,onClose:Y,pendingAddonId:Q})]}),f===`config`&&h&&r(z,{addonId:h,configSchema:ne??null,canTest:M,onSave:ce,onBack:()=>p(`picker`)}),f===`broker`&&S&&r(B,{kind:S,onResolved:e=>{le(e)},onBack:()=>p(`picker`)}),f===`discovery`&&v&&r(H,{providerId:v,onImport:K,onSkip:q})]}),X&&e(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-2 rounded-xl bg-background/85 backdrop-blur-sm px-6 text-center`,children:[r(_,{className:`h-6 w-6 animate-spin text-primary`}),r(`p`,{className:`text-xs font-medium text-foreground`,children:l(`integrations.creating`,{defaultValue:`Creating integration…`})}),!Z&&r(`p`,{className:`text-[10px] text-foreground-subtle`,children:l(`integrations.creatingHint`,{defaultValue:`Waiting for the addon to restart and register`})}),Z&&e(c,{children:[r(`p`,{className:`text-[10px] text-foreground-subtle max-w-xs`,children:l(`integrations.creatingOverdue`,{defaultValue:`This is taking longer than expected. The integration may already have been created — close this dialog and refresh to check.`})}),r(`button`,{onClick:Y,className:`mt-1 rounded-md border border-border bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors`,children:l(`integrations.closeAndRefresh`,{defaultValue:`Close`})})]})]})]})]})}function G({integration:t,expanded:n,onToggleExpand:i}){let{t:a}=F();return e(`div`,{className:`flex items-center gap-2.5`,children:[r(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i(t.addonId)},"aria-label":n?a(`integrations.integrationColumns.collapse`,`Collapse`):a(`integrations.integrationColumns.expand`,`Expand`),"aria-expanded":n,className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded text-foreground-subtle transition-colors hover:bg-surface-hover hover:text-foreground`,children:r(n?b:x,{className:`h-3.5 w-3.5`})}),r(L,{type:t.addonId,size:`sm`}),e(`div`,{className:`flex min-w-0 flex-col`,children:[r(`span`,{className:`truncate text-xs font-semibold text-foreground`,children:t.name}),r(`span`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.addonId})]})]})}function ce(e){let{isExpanded:t,onToggleExpand:n}=e;return[{key:`name`,header:P.t(`integrations.integrationColumns.integration`,`Integration`),headerClassName:`w-[55%]`,cell:e=>r(G,{integration:e,expanded:t(e),onToggleExpand:n})},{key:`devices`,header:P.t(`integrations.integrationColumns.devices`,`Devices`),headerClassName:`w-[15%]`,cellClassName:`text-[11px] text-foreground-subtle`,cell:e=>P.t(`integrations.integrationColumns.deviceCount`,{count:e.deviceCount})},{key:`status`,header:P.t(`integrations.integrationColumns.status`,`Status`),headerClassName:`w-[15%]`,cell:e=>r(T,{status:e.status})}]}o();function le(e){if(!e.enabled)return`disabled`;switch(e.processState){case`running`:return`running`;default:return`stopped`}}var K=`expand`;function q(){let{t:i}=F(),o=I(),s=v(),[u]=ne(),[f,m]=a(!1),h=n(()=>m(!0),[]),_=n(()=>m(!1),[]),[y,b]=a(!1),x=n(()=>b(!0),[]),ee=n(()=>b(!1),[]);M([`integrations`],[`integration.enabled`,`integration.disabled`,`integration.deleted`,`provider.started`,`provider.stopped`,`addon.installed`,`addon.uninstalled`,`addon.started`,`addon.stopped`,`addon.updated`]),M([`deviceManager`],[`device.registered`,`device.unregistered`,`device.online`,`device.offline`,`device.disabled`,`device.enabled`]);let{data:w,isLoading:T,refetch:E}=A(void 0),{data:O,isLoading:te,refetch:N}=D({projection:`slim`}),P=t(()=>O??[],[O]),L=t(()=>w??[],[w]),z=t(()=>{let e=new Map;for(let t of P)e.set(t.id,{id:t.id,name:t.name??t.stableId??`#${String(t.id)}`});return e},[P]),B=t(()=>k(w),[w]),V=t(()=>{let e=new Map;for(let t of C(P)){let n=B(t);if(n.kind!==`resolved`)continue;let r=n.integration.id;e.set(r,(e.get(r)??0)+1)}return e},[P,B]),ae=t(()=>L.map(e=>({id:e.id,addonId:e.addonId,name:e.name,enabled:e.enabled,status:le(e),deviceCount:V.get(e.id)??0})),[L,V]),H=u.get(K),U=n(e=>{let t=new URLSearchParams(window.location.search);t.get(K)===e?t.delete(K):t.set(K,e);let n=t.toString(),r=`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`;window.history.replaceState(window.history.state,``,r),window.dispatchEvent(new PopStateEvent(`popstate`))},[]),oe=n(e=>o(`/integrations/${e.id}`),[o]),W=n(e=>z.get(e)??null,[z]),G=n(e=>o(`/devices/${String(e)}`),[o]),q=n(e=>r(S,{context:`integration-detail`,devices:P,trpc:s.trpcClient,integrationOf:B,forceIntegrationId:e.id,urlScope:`nested`,lsKey:`integrations:nested:${e.addonId}`,resolveIntegrationIcon:re,resolveParent:W,onNavigate:G}),[P,s.trpcClient,B,W,G]),J=n(e=>H===e.addonId,[H]),Y=t(()=>ce({isExpanded:J,onToggleExpand:U}),[J,U]),X=n(e=>`${e.name} ${e.addonId}`,[]),Z=n(e=>e.addonId,[]),ue=n(()=>{E(),N()},[E,N]),Q=T||te,$=L.length>0;return e(R,{icon:d,title:i(`nav.integrations`,`Integrations`),actions:e(c,{children:[r(`button`,{onClick:ue,disabled:Q,className:`flex items-center gap-1 rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,title:i(`common.refresh`,`Refresh`),children:r(p,{className:j(`h-3.5 w-3.5`,Q&&`animate-spin`)})}),e(`button`,{onClick:x,className:`flex items-center gap-1.5 rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,title:i(`integrations.scanTheLocalNetworkFor`,`Scan the local network for devices`),children:[r(l,{className:`h-3.5 w-3.5`}),i(`integrations.scanNetwork`,`Scan network`)]}),e(`button`,{onClick:h,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-sm`,children:[r(g,{className:`h-3.5 w-3.5`}),i(`integrations.newIntegration`,`New Integration`)]})]}),children:[Q&&r(`div`,{className:`space-y-2`,children:[1,2,3].map(e=>r(`div`,{className:`h-12 rounded-lg border border-border bg-surface animate-pulse`},e))}),!Q&&!$&&e(`div`,{className:`flex flex-col items-center py-20 text-foreground-subtle`,children:[r(`p`,{className:`text-sm`,children:i(`integrations.noIntegrationsConfigured`,`No integrations configured.`)}),r(`p`,{className:`text-xs mt-1`,children:i(`integrations.clickNewIntegrationToConnect`,`Click "New Integration" to connect cameras and devices.`)})]}),!Q&&$&&r(S,{mode:`generic`,items:ae,getKey:Z,getSearchText:X,columns:Y,onRowClick:oe,isExpanded:J,renderExpanded:q,searchPlaceholder:i(`integrations.search`,{defaultValue:`Search integrations…`}),emptyLabel:i(`integrations.empty`,{defaultValue:`No integrations found.`})}),r(se,{open:f,onClose:_}),r(ie,{open:y,onClose:ee})]})}export{q as IntegrationsPage};
@@ -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{$i as c,Di as l,Fn as u,Gi as d,Hr as f,Ht as p,It as m,Lr as h,Mi as g,O as _,Pi as v,Pr as y,Ri as b,Rt as x,Ur as S,V as C,bn as w,cn as T,dt as E,ea as D,ei as O,en as k,fi as A,gr as j,k as M,kn as N,lr as P,pn as F,pt as I,rn as L,rr as R,ta as ee,tr as te,ur as z,ut as ne,xi as re,yi as B,z as V,zt as ie}from"./player-overlays-DfIXPXfC.js";import{Ur as ae,Vr as H,vn as oe}from"./client-fa7ANI4X.js";import{t as se}from"./boxes-DomeSuUE.js";import{n as ce,r as le,t as ue}from"./speaker-vU_58Q4N.js";import{t as U}from"./user-round-D6lnAuWE.js";import{$u as de,Ao as fe,Cn as W,Co as pe,Gn as G,Gr as K,Ia as me,Io as he,Jr as q,L as ge,La as _e,Oo as ve,Qr as ye,Qu as J,Ra as be,So as xe,To as Se,Ur as Ce,Va as we,Wn as Te,_o as Ee,_r as De,bt as Oe,do as ke,ed as Ae,fr as je,gr as Me,ho as Ne,jo as Pe,ko as Fe,mn as Ie,mo as Le,mr as Re,pn as ze,po as Be,pr as Ve,qu as He,vr as Ue,wo as We}from"./src-Cy_bal4g.js";import{t as Y}from"./i18n-l_m6iBJW.js";import{t as X}from"./useTranslation-BJr-n0es.js";import{fr as Ge,m as Ke,mr as qe,ur as Z}from"./index-Ctkts88E.js";import{t as Je}from"./AdminSectionedPage-CJhCo7eS.js";import{a as Ye,n as Xe,r as Ze}from"./linked-devices-model-CWqnVKj5.js";a();var Qe={camera:l,hub:ce,container:se,light:z,siren:L,switch:ie,sensor:ee,thermostat:p,climate:D,button:A,"event-emitter":ne,update:le,notifier:b,script:F,automation:I,lock:R,cover:v,valve:S,humidifier:f,"water-heater":y,fan:h,"media-player":ue,"alarm-panel":T,control:k,presence:U,weather:O,vacuum:g,"lawn-mower":x,image:j,smoke:c};function Q({type:e,className:t}){return n(Qe[e]??A,{"aria-hidden":`true`,className:t??`h-3.5 w-3.5 shrink-0 text-foreground-subtle`})}function $e({online:e,deviceName:t}){return n(`span`,{className:e?`inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-success`:`inline-block h-1.5 w-1.5 shrink-0 rounded-full border border-foreground-subtle`,role:`img`,"aria-label":Y.t(`locations.deviceGlyphs.aria`,{name:t,state:e?Y.t(`common.online`):Y.t(`common.offline`)}),title:e?Y.t(`common.online`):Y.t(`common.offline`)})}function et({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}=X(),[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(je,{open:t,onOpenChange:e=>e?void 0:p(),children:e(Re,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"aria-label":a,children:[n(De,{children:n(Ue,{children:a})}),e(Ve,{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(ge,{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(Me,{children:[n(K,{variant:`ghost`,onClick:p,children:m(`locations.addDialog.cancel`)}),n(K,{disabled:h.length===0||d,onClick:()=>f(h),children:m(`locations.addDialog.confirm`,{count:h.length})})]})]})})}a();function tt({room:e,cameras:r,fleet:i}){let{t:a}=X(),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(rt,{camera:e,byId:o},e.id))})}function nt(e){return{id:e.deviceId,name:e.parentName===null?e.name:`${e.parentName} · ${e.name}`,type:e.type,location:e.location}}function rt({camera:t,byId:r}){let{t:a}=X(),s=o(),c=Ge(),[l,u]=i(!1),[d,f]=i(null),p=_e({deviceId:t.id}),m=Ze({status:p.status,data:p.data,error:p.error===null||p.error===void 0?null:p.error}),h=be(),g=m.kind===`present`?m:null,v=me({deviceId:t.id,slotRef:g?.slot.slotRef??``},{enabled:l&&g!==null}),y=g===null?[]:Xe(g.slot,g.value),b=y.map(e=>e.deviceId),x=(v.data?.candidates??[]).map(nt),S=new Set(x.map(e=>e.id)),C=b.filter(e=>!S.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}}}),w=[...x,...C],T=(v.data?.candidates??[]).filter(e=>e.suggested).map(e=>e.deviceId),E=async e=>{if(g!==null){f(null);try{await h.mutateAsync({deviceId:t.id,slotRef:g.slot.slotRef,value:Ye(g.value,e)}),await p.refetch(),await s.invalidateQueries({queryKey:[[`deviceManager`]]}),u(!1)}catch(e){f(e instanceof Error?e.message:String(e))}}},D=[{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(Q,{type:i.type}),n(Z,{to:`/devices/${String(t.deviceId)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:o}),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:t=>{let i=r.get(t.deviceId);return i===void 0?n(`span`,{className:`text-xs text-foreground-subtle`,children:`—`}):e(`span`,{className:`flex items-center gap-1.5`,children:[n($e,{online:i.online,deviceName:i.name}),n(`span`,{className:`text-xs text-foreground-muted`,children:i.online?a(`common.online`):a(`common.offline`)})]})}}];return e(`section`,{className:`min-w-0 ${_}`,"data-testid":`camera-links-${String(t.id)}`,children:[e(`header`,{className:`${M} flex min-h-9 items-center gap-1.5`,children:[n(Q,{type:t.type}),n(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:t.name}),e(K,{variant:`ghost`,size:`sm`,onClick:()=>c(Ke(t.id)),children:[n(P,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`locations.links.edit`)]}),n(K,{variant:`outline`,size:`sm`,disabled:g===null,onClick:()=>u(!0),"aria-label":a(`locations.links.addNamed`,{camera:t.name}),children:a(`locations.room.add`)})]}),m.kind===`pending`&&n(`p`,{role:`status`,className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.loading`)}),m.kind===`unknown`&&n(`p`,{role:`alert`,className:`px-3 py-3 text-xs text-warning sm:px-4`,children:a(`locations.links.unreadable`,{reason:m.reason})}),m.kind===`absent`&&n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.unsupported`)}),d!==null&&n(`p`,{role:`alert`,className:`px-3 pt-2 text-xs text-danger break-words sm:px-4`,children:d}),g!==null&&(y.length===0?n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.none`)}):n(W,{columns:D,rows:y,rowKey:e=>String(e.deviceId),bordered:!1,minWidthPx:360})),n(et,{open:l,title:a(`locations.links.pickTitle`,{camera:t.name}),items:w,listState:v.status===`error`?`failed`:v.data===void 0?`pending`:`answered`,lockedIds:b,lockedNote:a(`locations.links.alreadyLinked`),suggestions:t.location===null?null:{heading:a(`locations.links.suggested`,{room:t.location}),ids:T},busy:h.isPending,onConfirm:e=>void E(e),onClose:()=>u(!1)})]})}a();function it({name:t,description:a,busy:o,onSave:s}){let{t:c}=X(),[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(G,{htmlFor:`location-description-${t}`,className:`block`,children:c(`locations.locationDescriptionField.whatIsThere`,`What is there`)}),n(`textarea`,{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 ${V}`,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 at(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0||n.description.length===0?null:n.description}var ot=` none`;function st({name:t,zones:r,zoneKey:i,busy:a,onChange:o}){let{t:s}=X();if(r.length===0)return null;let c=[{value:ot,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(G,{htmlFor:`location-zone-${t}`,children:s(`locations.locationZoneField.zone`,`Zone`)}),n(He,{id:`location-zone-${t}`,value:i??ot,disabled:a,onChange:e=>{let t=e.target.value;if(t===ot){o(null);return}let n=r.find(e=>e.zoneKey===t);n!==void 0&&o(n.label)},options:c})]})}function ct(e,t){return e.find(e=>e.locationKeys.includes(t))?.zoneKey??null}function lt({name:e,icon:t,busy:r,onPick:i}){return n(Ae,{value:t,onPick:i,fallbackGlyph:te,clearGlyph:d,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 ut(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0?null:ae(n.icon)??`map-pin`}function $(e){if(e==null)return null;let t=e.trim();return t.length===0?null:t.toLowerCase()}function dt(e,t){let n=$(t);return n===null?[]:e.filter(e=>$(e.location)===n)}function ft(e,t){let n=dt(e,t),r=new Set(n.map(e=>e.id));return n.filter(e=>e.parentDeviceId===null||!r.has(e.parentDeviceId))}function pt(e,t){let n=$(e.location);return n===null||new Set(t.map(e=>$(e))).has(n)?null:e.location?.trim()??null}function mt(e,t){let n=$(e.location);return n!==null&&t.has(n)}function ht(e,t){let n=new Set(t.map(e=>$(e))),r=new Set(e.filter(e=>mt(e,n)).map(e=>e.id));return e.filter(e=>!(mt(e,n)||e.parentDeviceId!==null&&r.has(e.parentDeviceId)))}function gt(e,t){return ht(e,t).filter(e=>e.parentDeviceId===null)}function _t(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 vt(e,t){return _t(e,t).length}function yt(e,t){return e.filter(e=>!e.isCamera&&e.parentDeviceId===t)}function bt(e,t){return t.map(t=>({name:t,members:ft(e,t)}))}function xt(e){return`${e.kind}:${String(e.device.id)}`}function St(e,t,n){return e.flatMap(e=>{let r=yt(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 Ct({name:r,members:a,devices:o,busy:c,icon:l,description:d,onRename:f,onDelete:p,onRebuildLinks:h,onAddDevices:g,onPickIcon:v,onSaveDescription:y,zones:b,zoneKey:x,onChangeZone:S}){let{t:C}=X(),[T,D]=i(!1),[O,k]=i(r),A=ze(a,t(()=>({searchText:e=>[e.name,...yt(o,e.id).map(e=>e.name)],facetValue:e=>e.type}),[o])),[j,N]=i(()=>new Set),P=e=>N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),F=t(()=>St(A.rows,o,j),[A.rows,o,j]),I=[{key:`name`,header:C(`locations.columns.device`),notSortableReason:C(`locations.columns.noSort`),render:e=>e.kind===`member`?n(wt,{row:e,onToggle:()=>P(e.device.id)}):n(Tt,{row:e})},{key:`type`,header:C(`locations.columns.type`),notSortableReason:C(`locations.columns.noSort`),render:e=>n(`span`,{className:`text-xs text-foreground-muted`,children:e.device.type})},{key:`status`,header:C(`locations.columns.status`),notSortableReason:C(`locations.columns.noSort`),render:t=>e(`span`,{className:`flex items-center gap-1.5`,children:[n($e,{online:t.device.online,deviceName:t.device.name}),n(`span`,{className:`text-xs text-foreground-muted`,children:t.device.online?C(`common.online`):C(`common.offline`)})]})}],L=()=>{k(r),D(!1)},R=async()=>{let e=O.trim();if(e.length===0||e===r){L();return}await f(e),D(!1)},ee=[{id:`rename`,label:C(`locations.locationCard.rename`,`Rename`),icon:u,disabled:c,onClick:()=>{k(r),D(!0)}},{id:`rebuild-links`,label:C(`locations.locationCard.rebuildLinkedDevices`,`Rebuild linked devices`),icon:w,separatorBefore:!0,disabled:c,onClick:()=>void h()},{id:`delete`,label:C(`common.delete`,`Delete`),icon:m,danger:!0,separatorBefore:!0,disabled:c,onClick:()=>void p()}];return e(`section`,{className:`min-w-0 ${_}`,children:[e(`header`,{className:`${M} flex min-h-9 items-center gap-1.5`,children:[n(lt,{name:r,icon:l,busy:c,onPick:v}),T?e(s,{children:[n(J,{value:O,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&R(),e.key===`Escape`&&L()},"aria-label":C(`locations.locationCard.rename2`,`Rename {{name}}`,{name:r}),className:`min-w-0 flex-1`,autoFocus:!0}),n(K,{type:`button`,size:`sm`,onClick:()=>void R(),children:C(`common.save`,`Save`)}),n(de,{type:`button`,variant:`ghost`,icon:E,onClick:L,"aria-label":C(`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(K,{type:`button`,variant:`outline`,size:`sm`,disabled:c,onClick:g,"aria-label":C(`locations.room.addTo`,{room:r}),children:C(`locations.room.add`)}),n(Oe,{items:ee,title:C(`locations.locationCard.actionsFor`,`Actions for {{name}}`,{name:r}),triggerClassName:`p-1`})]})]}),n(st,{name:r,zones:b,zoneKey:x,busy:c,onChange:S}),n(it,{name:r,description:d,busy:c,onSave:y}),a.length>0&&n(`div`,{className:`border-b border-border px-3 py-1.5 sm:px-4 sm:py-2`,children:n(Ie,{state:A.state,facets:A.facets,labels:{searchPlaceholder:C(`locations.filter.searchPlaceholder`),searchLabel:C(`locations.room.searchLabel`,{room:r}),facetsLabel:C(`locations.filter.typesLabel`),clearLabel:C(`locations.filter.clear`)},onSearch:A.setSearch,onToggleFacet:A.toggleFacet,onClear:A.clear})}),a.length===0?n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:C(`locations.locationCard.nothingHereYetAssignA`,`Nothing here yet — assign a device from the table below.`)}):n(W,{columns:I,rows:F,rowKey:xt,bordered:!1,minWidthPx:360,emptyMessage:C(`locations.filter.noMatch`)})]})}function wt({row:t,onToggle:r}){let{t:i}=X(),{device:a,accessories:o,open:s}=t,c=s?re:B;return e(`span`,{className:`flex items-center gap-1.5`,children:[o.length>0?e(K,{type:`button`,variant:`ghost`,onClick:r,"aria-expanded":s,"aria-label":i(s?`locations.locationCard.collapseAccessories`:`locations.locationCard.expandAccessories`,{count:o.length,name:a.name}),className:`h-auto shrink-0 gap-0.5 p-0.5 text-foreground-subtle hover:text-foreground`,children:[n(c,{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(Q,{type:a.type}),n(Z,{to:`/devices/${String(a.id)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:a.name})]})}function Tt({row:t}){let{device:r}=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(Q,{type:r.type,className:`h-3 w-3 shrink-0 text-foreground-subtle`}),n(Z,{to:`/devices/${String(r.id)}`,className:`min-w-0 truncate text-xs text-foreground-muted hover:underline`,children:r.name})]})}a();function Et({zones:e,busy:t,onRename:r,onDelete:a,onPickIcon:o}){let{t:s}=X(),[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(W,{columns:[{key:`icon`,header:s(`locations.siteZonesPanel.icon`,`Icon`),width:`w-12`,notSortableReason:`An icon has no order`,render:e=>n(lt,{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(J,{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(K,{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(K,{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(m,{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 Dt({busy:t,onCreate:r}){let{t:a}=X(),[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(J,{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(K,{size:`sm`,type:`submit`,disabled:c.trim().length===0||t,children:[n(N,{className:`h-3.5 w-3.5`}),a(`common.add`,`Add`)]}),n(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":a(`locations.newLocationButton.cancelNewLocation`,`Cancel new location`),children:n(E,{className:`h-3.5 w-3.5`})})]}):e(K,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-location-button`,children:[n(N,{className:`h-3.5 w-3.5`}),a(`locations.newLocationButton.newLocation`,`New location`)]})}a();function Ot({busy:t,onCreate:r}){let{t:a}=X(),[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(J,{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(K,{size:`sm`,type:`submit`,disabled:c.trim().length===0||t,children:[n(N,{className:`h-3.5 w-3.5`}),a(`common.add`,`Add`)]}),n(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":a(`locations.newZoneButton.cancelNewZone`,`Cancel new zone`),children:n(E,{className:`h-3.5 w-3.5`})})]}):e(K,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-zone-button`,children:[n(N,{className:`h-3.5 w-3.5`}),a(`locations.newZoneButton.newZone`,`New zone`)]})}a();function kt(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 At({rooms:e,unassignedCount:r,value:i,unassignedValue:a,onChange:o}){let{t:s}=X(),c=t(()=>kt(e,r,a,s(`locations.roomPicker.unassigned`)),[e,r,a,s]);return n(`div`,{className:`max-w-sm`,"data-testid":`room-select`,children:n(q,{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 jt={searchText:e=>[e.name],facetValue:e=>e.type};function Mt({rows:r,fleet:a,locations:o,busy:s,emptyMessage:c,onAssign:l}){let{t:u}=X(),[d,f]=i([]),[p,m]=i(``),h=ze(r,jt),g=h.rows,_=t(()=>g.map(e=>e.id),[g]),v=t(()=>d.filter(e=>_.includes(e)),[d,_]),y=g.length>0&&v.length===g.length,b=t(()=>{let e=new Map;for(let t of r)e.set(t.id,vt(a,t.id));return e},[r,a]),x=v.reduce((e,t)=>e+(b.get(t)??0),0),S=e=>f(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),w=()=>f(y?[]:_),T=()=>{p.length===0||v.length===0||(l(v,p),f([]),m(``))},E=o.map(e=>({value:e,label:e})),D=[{key:`select`,width:`w-8`,headerRender:()=>n(Te,{checked:y,onChange:w,"aria-label":y?u(`locations.unassignedTable.clearSelection`,`Clear selection`):u(`locations.unassignedTable.selectAllUnassignedDevices`,`Select all unassigned devices`)}),render:e=>n(Te,{checked:v.includes(e.id),onChange:()=>S(e.id),"aria-label":u(`locations.unassignedTable.select`,`Select {{name}}`,{name:e.name})})},{key:`name`,header:u(`locations.unassignedTable.device`,`Device`),sortValue:e=>e.name.toLowerCase(),render:t=>{let r=pt(t,o);return e(`span`,{className:`flex items-center gap-1.5`,children:[n(Q,{type:t.type}),n(Z,{to:`/devices/${String(t.id)}`,className:`truncate text-xs text-foreground hover:underline`,children:t.name}),r!==null&&n(ye,{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:t=>e(`span`,{className:`flex items-center gap-1.5`,children:[n($e,{online:t.online,deviceName:t.name}),n(`span`,{className:`text-xs text-foreground-muted`,children:t.online?u(`common.online`):u(`common.offline`)})]})},{key:`followers`,header:u(`locations.unassignedTable.accessoriesInTowCount`,`Accessories in tow`),align:`right`,sortValue:e=>b.get(e.id)??0,render:e=>n(`span`,{className:`tabular-nums text-xs text-foreground-muted`,children:b.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(He,{"aria-label":u(`locations.unassignedTable.locationFor`,`Location for {{name}}`,{name:e.name}),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:`—`},...E]})}];return e(`section`,{className:`space-y-2`,children:[e(`header`,{className:`flex flex-wrap items-baseline gap-2`,children:[n(`h2`,{className:C,children:u(`locations.unassignedTable.notInARoom`,`Not in a room`)}),n(`p`,{className:V,children:u(`locations.unassignedTable.topLevelDevicesOnlyAccessories`,`Top-level devices only — accessories move with their parent.`)})]}),r.length>0&&n(Ie,{state:h.state,facets:h.facets,labels:{searchPlaceholder:u(`locations.filter.searchPlaceholder`),searchLabel:u(`locations.unassigned.searchLabel`),facetsLabel:u(`locations.filter.typesLabel`),clearLabel:u(`locations.filter.clear`)},onSearch:h.setSearch,onToggleFacet:h.toggleFacet,onClear:h.clear}),v.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:v.length}),x>0&&` · ${u(`locations.unassignedTable.accessoriesInTowCount`,{count:x})}`]}),n(He,{"aria-label":u(`locations.unassignedTable.assignSelectedDevicesTo`,`Assign selected devices to`),value:p,onChange:e=>m(e.target.value),className:`w-auto min-w-[10rem]`,options:[{value:``,label:u(`locations.unassignedTable.assignTo2`,`Assign to…`)},...E]}),n(K,{type:`button`,size:`sm`,onClick:T,disabled:s||p.length===0,children:u(`locations.unassignedTable.assign`,`Assign`)}),n(K,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>f([]),children:u(`locations.unassignedTable.clear`,`Clear`)})]}),n(W,{columns:D,rows:g,rowKey:e=>e.id,minWidthPx:720,emptyMessage:h.active?u(`locations.filter.noMatch`):c})]})}function Nt(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.role!==void 0&&e.role!==null?{role:e.role}:{},name:e.name}}function Pt(e,t){let n=t.map(Nt),r=[];for(let i of t)i.isCamera&&i.location===e&&r.push({deviceId:i.id,name:i.name,ids:oe({selfId:i.id,selfLocation:i.location,candidates:n})});return{entries:r}}var Ft=`device-manager:linked-devices`;function It(e){return{deviceId:e.deviceId,slotRef:Ft,value:{slot:`linked-devices`,deviceIds:[...e.ids]}}}a();var Lt=`__unassigned__`;function Rt(){let{t:r}=X(),a=o(),s=Ce(),{data:c,isLoading:l}=Ne(),{data:u}=Le(),{data:d}=Be(),{data:f}=Ee(),{data:p,isLoading:m}=ke({projection:`slim`}),h=()=>{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`]]})},g=we({onSuccess:h}),_=xe({onSuccess:h}),v=ve({onSuccess:h}),y=We({onSuccess:h}),b=fe({onSuccess:h}),x=Fe({onSuccess:h}),S=he({onSuccess:h}),C=pe({onSuccess:h}),w=Se({onSuccess:h}),T=Pe({onSuccess:h}),E=be(),D=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})),[p]),O=c??[],k=t(()=>bt(D,O),[D,O]),[A,j]=qe(),M=A.get(`tab`),N=M===`zones`||M===`camera-links`?M:`locations`,P=A.get(`room`),F=t(()=>gt(D,O),[D,O]),I=P===Lt,L=I?null:P!==null&&k.some(e=>e.name===P)?P:k[0]?.name??null,R=L===null?null:k.find(e=>e.name===L)??null,ee=I?Lt:L??`__unassigned__`,z=L??k[0]?.name??null,ne=t(()=>k.map(e=>({name:e.name,count:e.members.length})),[k]),re=e=>{j(t=>{let n=new URLSearchParams(t);return n.set(`room`,e),n},{replace:!0})},B=l||m,V=v.isPending||_.isPending||g.isPending||b.isPending,ie=async e=>{await g.mutateAsync({name:e})},ae=async(e,t)=>{let n=t.trim();n.length===0||n===e||await y.mutateAsync({from:e,to:n})},oe=async e=>{let t=Pt(e,D);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 E.mutateAsync(It(e))}catch(t){i.push(`• ${e.name}: ${t instanceof Error?t.message:String(t)}`)}h(),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`})},se=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 _.mutateAsync({name:e,cascade:!0})},ce=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 C.mutateAsync({name:e})},le=async(e,t)=>{await b.mutateAsync({location:e,icon:t})},ue=async(e,t)=>{await x.mutateAsync({location:e,description:t})},U=f??[],de=async(e,t)=>{await T.mutateAsync({location:e,zone:t})},W=(e,t)=>{for(let n of e)v.mutate({deviceId:n,location:t})},[G,K]=i(null),me=t(()=>D.filter(e=>e.parentDeviceId===null).map(e=>({id:e.id,name:e.name,type:e.type,location:e.location})),[D]),q=n(At,{rooms:ne,...N===`locations`?{unassignedCount:F.length}:{},value:N===`locations`?ee:z??``,unassignedValue:Lt,onChange:re}),ge=e(`div`,{className:`flex flex-col gap-3`,"data-testid":`locations-section`,children:[B&&n(`p`,{className:`text-xs text-foreground-subtle`,children:r(`locations.loadingLocationsAndDevices`,`Loading locations and devices…`)}),q,I||R===null?n(Mt,{rows:F,fleet:D,locations:O,busy:V,emptyMessage:B?r(`common.loading`,`Loading…`):r(`locations.everyTopLevelDeviceHas`,`Every top-level device has a room.`),onAssign:W}):n(Ct,{name:R.name,members:R.members,devices:D,busy:V,icon:ut(u,H(R.name)),onPickIcon:e=>le(R.name,e),description:at(d,H(R.name)),onSaveDescription:e=>ue(R.name,e),zones:U,zoneKey:ct(U,H(R.name)),onChangeZone:e=>de(R.name,e),onRename:e=>ae(R.name,e),onDelete:()=>se(R.name,dt(D,R.name).length),onRebuildLinks:()=>oe(R.name),onAddDevices:()=>K(R.name)},R.name),O.length===0&&!B&&n(`p`,{className:`text-xs text-foreground-subtle`,children:r(`locations.noLocationsYetAddFrontDoor`,`No locations yet. Add Front door, Hall, Kitchen…`)}),n(et,{open:G!==null,title:r(`locations.room.addDialogTitle`,{room:G??``}),items:me,listState:m?`pending`:`answered`,lockedIds:G===null?[]:(k.find(e=>e.name===G)?.members??[]).map(e=>e.id),lockedNote:r(`locations.room.alreadyHere`),suggestions:{heading:r(`locations.room.suggestedUnassigned`),ids:F.map(e=>e.id)},busy:v.isPending,onConfirm:e=>{G!==null&&W(e,G),K(null)},onClose:()=>K(null)})]}),_e=e(`div`,{className:`flex flex-col gap-3`,"data-testid":`camera-links-tab`,children:[q,n(tt,{room:z,cameras:z===null?[]:dt(D,z).filter(e=>e.isCamera),fleet:D})]});return n(Je,{icon:te,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:N===`zones`?n(Ot,{busy:S.isPending,onCreate:e=>S.mutateAsync({name:e})}):n(Dt,{busy:g.isPending,onCreate:ie}),sections:[{id:`locations`,label:r(`locations.locations`,`Locations`),content:ge},{id:`camera-links`,label:r(`locations.cameraLinks`,`Camera links`),content:_e},{id:`zones`,label:r(`locations.zones`,`Zones`),content:n(Et,{zones:U,busy:V,onRename:(e,t)=>w.mutateAsync({from:e,to:t}),onDelete:ce,onPickIcon:(e,t)=>S.mutateAsync({name:e,icon:t})})}]})}export{Rt as LocationsPage};