@camstack/addon-admin-ui 1.2.702 → 1.2.703

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 (108) hide show
  1. package/CHANGELOG.md +8 -2
  2. package/dist/assets/{AccessSection-CNgvvC6Q.js → AccessSection-BGohJFsQ.js} +1 -1
  3. package/dist/assets/Addons-BDlFntTI.js +5 -0
  4. package/dist/assets/{AdminPage-BkxgjFWW.js → AdminPage-fCxxHmc-.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-bGVBepbw.js → AdminSectionedPage-DDqDbMM3.js} +1 -1
  6. package/dist/assets/AiProfiles-BFi1Kn6N.js +3 -0
  7. package/dist/assets/Archive-ChqpFwH8.js +1 -0
  8. package/dist/assets/{BootstrapSettingsForm-jBRoUiPn.js → BootstrapSettingsForm-BLWj6csX.js} +1 -1
  9. package/dist/assets/{Build-BoiB-nPA.js → Build-DfHu8hDx.js} +4 -4
  10. package/dist/assets/{Calendars-BBTnm6OG.js → Calendars-Cxw9P8Uq.js} +1 -1
  11. package/dist/assets/Cluster-BwIvlnpz.js +1 -0
  12. package/dist/assets/{CompositionBlockEditor-BloGManS.js → CompositionBlockEditor-DyGQ4aIz.js} +2 -2
  13. package/dist/assets/{CompositionEditorPage-C5pNxu2M.js → CompositionEditorPage-DRISSQzb.js} +1 -1
  14. package/dist/assets/Data-B1NgedRI.js +2 -0
  15. package/dist/assets/DeviceDetail-BzGdZ7Q_.js +1 -0
  16. package/dist/assets/{Devices-BJRvDHiT.js → Devices-CdmWPr7S.js} +1 -1
  17. package/dist/assets/EmbedDevicePage-CfSj9caC.js +1 -0
  18. package/dist/assets/{EmbedPlayerPage-BsxSpEcY.js → EmbedPlayerPage-DEP8gdti.js} +1 -1
  19. package/dist/assets/History-Bg9tQAqJ.js +1 -0
  20. package/dist/assets/Identity-Oyg78Wgg.js +1 -0
  21. package/dist/assets/InstancesTable-CItURWVx.js +1 -0
  22. package/dist/assets/IntegrationDetail-B05HfycS.js +1 -0
  23. package/dist/assets/{Integrations-BUOpFqfh.js → Integrations-Bpw7S0et.js} +2 -2
  24. package/dist/assets/{Integrations-Dpb2V2yu.js → Integrations-wpQtKhSO.js} +1 -1
  25. package/dist/assets/Library-afeuqgc6.js +1 -0
  26. package/dist/assets/Locations-DPd9tJpI.js +3 -0
  27. package/dist/assets/Logs-DSnFwEPX.js +1 -0
  28. package/dist/assets/{MaskShapeCanvas-D57fCIme.js → MaskShapeCanvas-DATKwWoi.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-w1kFM_O4.js → MotionZonesSettings-BrUyigty.js} +1 -1
  30. package/dist/assets/{MyAccess-D87gqxHt.js → MyAccess-DTWeghN4.js} +1 -1
  31. package/dist/assets/{Network-L7e5c9RP.js → Network-CzBJb8Ro.js} +1 -1
  32. package/dist/assets/{NewExportModal-CHwUJ26P.js → NewExportModal-DC6qeg0K.js} +1 -1
  33. package/dist/assets/NodeAddonsSettingsPanel-DwR6THxT.js +1 -0
  34. package/dist/assets/Notifications-8WkrgioY.js +1 -0
  35. package/dist/assets/{PanelContent-PhbemYUY.js → PanelContent-Cqel4gq_.js} +2 -2
  36. package/dist/assets/Pipeline-Dlg9wnRY.js +1 -0
  37. package/dist/assets/{PrivacyMaskSettings-BS29zGkX.js → PrivacyMaskSettings-jcKOGH_r.js} +1 -1
  38. package/dist/assets/{SceneMonitorEditor-CosxkmPM.js → SceneMonitorEditor-HfoxsYJf.js} +1 -1
  39. package/dist/assets/SessionsList-CIOmkBhu.js +2 -0
  40. package/dist/assets/{Showroom-0iJ0CCe5.js → Showroom-BgfY_eRn.js} +1 -1
  41. package/dist/assets/StorageLocationsTable-CbwL3VQY.js +1 -0
  42. package/dist/assets/System-DXC-3shW.js +2 -0
  43. package/dist/assets/{TemplateEditorDialog-8D78AUfO.js → TemplateEditorDialog-DXIGdBCR.js} +1 -1
  44. package/dist/assets/{Terminal-Cvw2rPrb.js → Terminal-Di7l31qa.js} +5 -5
  45. package/dist/assets/{TrainingProviders-DcThiLnE.js → TrainingProviders-aXqehRmF.js} +1 -1
  46. package/dist/assets/{Viewer-BUfnqb0c.js → Viewer-C71XpHjW.js} +1 -1
  47. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CNNET8uz.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DRUBvLQE.js} +1 -1
  48. package/dist/assets/{action-draft-BTVZLATm.js → action-draft-qcGhRMv4.js} +1 -1
  49. package/dist/assets/{ai-page.helpers-qxf7BP-v.js → ai-page.helpers-CEBa_im9.js} +1 -1
  50. package/dist/assets/{assignment-candidates-d-6NU8po.js → assignment-candidates-DdSU1Zo6.js} +1 -1
  51. package/dist/assets/{authed-media-Bqh0pB9D.js → authed-media-BZy-JJ_o.js} +1 -1
  52. package/dist/assets/{board-model-CPA2IZpg.js → board-model-DIWwdMST.js} +1 -1
  53. package/dist/assets/{camera-block-model-CJ0e2m0o.js → camera-block-model-Bq_R4oG5.js} +1 -1
  54. package/dist/assets/{client-Cng2SeYA.js → client-DLuByuRa.js} +1 -1
  55. package/dist/assets/{command-vocab-BzBhzE7i.js → command-vocab-CvGdlD2o.js} +1 -1
  56. package/dist/assets/{device-integration-icon-VMxiVsqd.js → device-integration-icon-Dd9uw4UF.js} +1 -1
  57. package/dist/assets/device-picker-model-PIGdnO_G.js +1 -0
  58. package/dist/assets/{dist-D7Gew3v3.js → dist-CDyYOITf.js} +1 -1
  59. package/dist/assets/{dist-CxrdebAP.js → dist-CFXBYJXQ.js} +1 -1
  60. package/dist/assets/{format-BopmTOzZ.js → format-CrKdqqCK.js} +1 -1
  61. package/dist/assets/{hostInit-DuH1KOuD.js → hostInit-CYHcdoYA.js} +1 -1
  62. package/dist/assets/i18n-CLov6T90.js +1 -0
  63. package/dist/assets/{icons-bi-mcO5N.js → icons-BLtyw4fH.js} +1 -1
  64. package/dist/assets/index-CFJEFXwr.js +6 -0
  65. package/dist/assets/{linked-devices-model-Bnz1douR.js → linked-devices-model-BPZYWQoj.js} +1 -1
  66. package/dist/assets/{mf-entry-bootstrap-0-ddbe056c.js → mf-entry-bootstrap-0-129d9964.js} +2 -2
  67. package/dist/assets/mount-PIGdnO_G.js +1 -0
  68. package/dist/assets/{notification-rule-status-ai5zWyzt.js → notification-rule-status-DeN2cEgy.js} +1 -1
  69. package/dist/assets/{player-overlays-fpbPSPqT.js → player-overlays-CgADEsQt.js} +1 -1
  70. package/dist/assets/remoteEntry-Cc7yyabb.js +1 -0
  71. package/dist/assets/{src-eL0OacoB.js → src-CA2_9YJD.js} +20 -20
  72. package/dist/assets/{sso-popup-Za4GwQBP.js → sso-popup-BXELI2t0.js} +1 -1
  73. package/dist/assets/{step-inspector-model-BAgxIyNV.js → step-inspector-model-BFq40l6S.js} +1 -1
  74. package/dist/assets/{use-scenes-feed-BTNdL7JV.js → use-scenes-feed-DyQPnSjQ.js} +1 -1
  75. package/dist/assets/{useAdminDeviceRemoval-COlTnaF7.js → useAdminDeviceRemoval-CKwvXhAP.js} +1 -1
  76. package/dist/assets/useEventInvalidation-PIGdnO_G.js +1 -0
  77. package/dist/assets/{useNodeUrlSelection-DhtJZEtx.js → useNodeUrlSelection-cFOr6zMH.js} +1 -1
  78. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-R-1W8c6C.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-HQVwzuiB.js} +2 -2
  79. package/dist/index.html +8 -8
  80. package/dist/server/addon.js +10 -3
  81. package/package.json +2 -2
  82. package/dist/assets/Addons-Dtx3xcZ2.js +0 -5
  83. package/dist/assets/AiProfiles-BLj-ic5N.js +0 -3
  84. package/dist/assets/Archive-y1aPYCx8.js +0 -1
  85. package/dist/assets/Cluster-DN0Cwciw.js +0 -1
  86. package/dist/assets/Data-LT-PQ05n.js +0 -2
  87. package/dist/assets/DeviceDetail-DAvmtNN2.js +0 -1
  88. package/dist/assets/EmbedDevicePage-CyKS-rmB.js +0 -1
  89. package/dist/assets/History-BPF9alct.js +0 -1
  90. package/dist/assets/Identity-dLFVHYZR.js +0 -1
  91. package/dist/assets/InstancesTable-LVQWfz07.js +0 -1
  92. package/dist/assets/IntegrationDetail-C_vN9X7q.js +0 -1
  93. package/dist/assets/Library-D4-BDy54.js +0 -1
  94. package/dist/assets/Locations-DGZ_lrp3.js +0 -3
  95. package/dist/assets/Logs-CUV00qxb.js +0 -1
  96. package/dist/assets/NodeAddonsSettingsPanel-Kqe8X8RH.js +0 -1
  97. package/dist/assets/Notifications-CucZNxjj.js +0 -1
  98. package/dist/assets/Pipeline-9O3YfaWk.js +0 -1
  99. package/dist/assets/SessionsList-OHo3GJ72.js +0 -2
  100. package/dist/assets/StorageLocationsTable-DqTWO4k1.js +0 -1
  101. package/dist/assets/System-DZXA2QSs.js +0 -2
  102. package/dist/assets/device-detail-Cg2Zt8FL.js +0 -1
  103. package/dist/assets/device-picker-model-B-FI9413.js +0 -1
  104. package/dist/assets/i18n--GTAj4mB.js +0 -1
  105. package/dist/assets/index-DbXFHmBJ.js +0 -6
  106. package/dist/assets/mount-B-FI9413.js +0 -1
  107. package/dist/assets/remoteEntry-g0NfB_lk.js +0 -1
  108. package/dist/assets/useEventInvalidation-B-FI9413.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{Hr as c,Ia as l,Nr as u,O as d,Qa as f,Tt as p,V as m,Yn as h,aa as g,ct as _,ft as v,ir as y,k as b,tn as x,ur as S,z as C}from"./player-overlays-fpbPSPqT.js";import{Bn as w,mc as T,zs as E}from"./client-Cng2SeYA.js";import{t as D}from"./chevron-down-CBb-F8DT.js";import{An as O,Cp as k,Dr as A,Fa as j,Gi as M,Ha as N,Hp as P,Ia as F,Ji as I,M as L,Ra as R,Sp as z,Tc as ee,Tr as B,Ui as V,Wi as H,Yi as U,Zs as te,_c as ne,bc as re,bs as ie,da as W,dc as ae,fc as oe,gi as G,hi as se,ic as ce,ka as le,mc as ue,mp as K,nc as de,oc as fe,pc as pe,qi as me,rc as he,vc as ge,wp as _e,ws as ve,xa as ye,xs as be,yc as xe,ys as Se,zr as q}from"./src-eL0OacoB.js";import{t as J}from"./i18n--GTAj4mB.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import{J as Ce,Si as we,wi as Te,yi as X}from"./index-DbXFHmBJ.js";import{t as Ee}from"./AdminSectionedPage-bGVBepbw.js";import{c as De,n as Oe,r as ke}from"./linked-devices-model-Bnz1douR.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(P(e,t),{"aria-hidden":`true`,className:r??`h-3.5 w-3.5 shrink-0 text-foreground-subtle`})}function Be({device:t}){let r=F(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(V,{open:t,onOpenChange:e=>e?void 0:p(),children:e(M,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"aria-label":a,children:[n(I,{children:n(U,{children:a})}),e(H,{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(L,{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 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=F(Z(t),`full`),l=o(),u=we(),[f,p]=i(!1),[m,h]=i(null),g=ie({deviceId:t.id}),_=ke({status:g.status,data:g.data,error:g.error===null||g.error===void 0?null:g.error}),v=be(),y=_.kind===`present`?_:null,x=Se({deviceId:t.id,slotRef:y?.slot.slotRef??``},{enabled:f&&y!==null}),S=y===null?[]:Oe(y.slot,y.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(y!==null){h(null);try{await v.mutateAsync({deviceId:t.id,slotRef:y.slot.slotRef,value:De(y.value,e)}),await g.refetch(),await l.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(W,{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 ${d}`,"data-testid":`camera-links-${String(t.id)}`,children:[e(`header`,{className:`${b} 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(W,{device:Z(t),form:`full`})}),e(K,{variant:`ghost`,size:`sm`,onClick:()=>u(Ce(t.id)),children:[n(c,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`locations.links.edit`)]}),n(K,{variant:`outline`,size:`sm`,disabled:y===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}),y!==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(q,{columns:A,rows:S,rowKey:e=>String(e.deviceId),bordered:!1,minWidthPx:360})),n(Ve,{open:f,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:v.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(G,{htmlFor:`location-description-${t}`,className:`block`,children:c(`locations.locationDescriptionField.whatIsThere`,`What is there`)}),n(se,{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(G,{htmlFor:`location-zone-${t}`,children:s(`locations.locationZoneField.zone`,`Zone`)}),n(v,{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(_e,{value:t,onPick:i,fallbackGlyph:u,clearGlyph:l,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:T(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:c,icon:l,description:u,onRename:f,onDelete:m,onRebuildLinks:g,onAddDevices:_,onPickIcon:v,onSaveDescription:y,zones:C,zoneKey:w,onChangeZone:T}){let{t:E}=Y(),[D,j]=i(!1),[M,N]=i(r),P=B(a,t(()=>({searchText:e=>[e.name,...Re(o,e.id).map(e=>e.name)],facetValue:e=>e.type}),[o])),[F,I]=i(()=>new Set),L=e=>I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),R=t(()=>$e(P.rows,o,F),[P.rows,o,F]),ee=[{key:`name`,header:E(`locations.columns.device`),notSortableReason:E(`locations.columns.noSort`),render:e=>e.kind===`member`?n(tt,{row:e,onToggle:()=>L(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})}],V=()=>{N(r),j(!1)},H=async()=>{let e=M.trim();if(e.length===0||e===r){V();return}await f(e),j(!1)},U=[{id:`rename`,label:E(`locations.locationCard.rename`,`Rename`),icon:S,disabled:c,onClick:()=>{N(r),j(!0)}},{id:`rebuild-links`,label:E(`locations.locationCard.rebuildLinkedDevices`,`Rebuild linked devices`),icon:h,separatorBefore:!0,disabled:c,onClick:()=>void g()},{id:`delete`,label:E(`common.delete`,`Delete`),icon:x,danger:!0,separatorBefore:!0,disabled:c,onClick:()=>void m()}];return e(`section`,{className:`min-w-0 ${d}`,children:[e(`header`,{className:`${b} flex min-h-9 items-center gap-1.5`,children:[n(Xe,{name:r,icon:l,busy:c,onPick:v}),D?e(s,{children:[n(z,{value:M,onChange:e=>N(e.target.value),onKeyDown:e=>{e.key===`Enter`&&H(),e.key===`Escape`&&V()},"aria-label":E(`locations.locationCard.rename2`,`Rename {{name}}`,{name:r}),className:`min-w-0 flex-1`,autoFocus:!0}),n(K,{type:`button`,size:`sm`,onClick:()=>void H(),children:E(`common.save`,`Save`)}),n(k,{type:`button`,variant:`ghost`,icon:p,onClick:V,"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(K,{type:`button`,variant:`outline`,size:`sm`,disabled:c,onClick:_,"aria-label":E(`locations.room.addTo`,{room:r}),children:E(`locations.room.add`)}),n(O,{items:U,title:E(`locations.locationCard.actionsFor`,`Actions for {{name}}`,{name:r}),triggerClassName:`p-1`})]})]}),n(Je,{name:r,zones:C,zoneKey:w,busy:c,onChange:T}),n(Ge,{name:r,description:u,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(A,{state:P.state,facets:P.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:P.setSearch,onToggleFacet:P.toggleFacet,onClear:P.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(q,{columns:ee,rows:R,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=F(Z(a),`compact`),l=s?D:g;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: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(W,{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(W,{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(q,{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(z,{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(x,{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(z,{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(y,{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(p,{className:`h-3.5 w-3.5`})})]}):e(K,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-location-button`,children:[n(y,{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(z,{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(y,{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(p,{className:`h-3.5 w-3.5`})})]}):e(K,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-zone-button`,children:[n(y,{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(ye,{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(),p=R(),h=e=>d===null?e.name:j(Z(e),`compact`,d,p),[g,_]=i([]),[y,b]=i(``),x=B(r,ct),S=x.rows,w=t(()=>S.map(e=>e.id),[S]),T=t(()=>g.filter(e=>w.includes(e)),[g,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=>_(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),M=()=>_(E?[]:w),P=()=>{y.length===0||T.length===0||(l(T,y),_([]),b(``))},F=o.map(e=>({value:e,label:e})),I=[{key:`select`,width:`w-8`,headerRender:()=>n(f,{checked:E,onChange:M,"aria-label":E?u(`locations.unassignedTable.clearSelection`,`Clear selection`):u(`locations.unassignedTable.selectAllUnassignedDevices`,`Select all unassigned devices`)}),render:e=>n(f,{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(W,{device:Z(t),form:`compact`})}),r!==null&&n(le,{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(v,{"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:`—`},...F]})}];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(A,{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(v,{"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…`)},...F]}),n(K,{type:`button`,size:`sm`,onClick:P,disabled:s||y.length===0,children:u(`locations.unassignedTable.assign`,`Assign`)}),n(K,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>_([]),children:u(`locations.unassignedTable.clear`,`Clear`)})]}),n(q,{columns:I,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=_(),{data:c,isLoading:l}=ce(),{data:d}=he(),{data:f}=de(),{data:p}=fe(),{data:m,isLoading:h}=te({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`]]})},v=ve({onSuccess:g}),y=ae({onSuccess:g}),b=ne({onSuccess:g}),x=pe({onSuccess:g}),S=xe({onSuccess:g}),C=ge({onSuccess:g}),w=ee({onSuccess:g}),T=oe({onSuccess:g}),D=ue({onSuccess:g}),O=re({onSuccess:g}),k=be(),A=t(()=>(m??[]).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})),[m]),j=c??[],M=t(()=>ze(A,j),[A,j]),[N,P]=Te(),F=N.get(`tab`),I=F===`zones`||F===`camera-links`?F:`locations`,L=N.get(`room`),R=t(()=>Fe(A,j),[A,j]),z=L===mt,B=z?null:L!==null&&M.some(e=>e.name===L)?L:M[0]?.name??null,V=B===null?null:M.find(e=>e.name===B)??null,H=z?mt:B??`__unassigned__`,U=B??M[0]?.name??null,ie=t(()=>M.map(e=>({name:e.name,count:e.members.length})),[M]),W=e=>{P(t=>{let n=new URLSearchParams(t);return n.set(`room`,e),n},{replace:!0})},G=l||h,se=b.isPending||y.isPending||v.isPending||S.isPending,le=async e=>{await v.mutateAsync({name:e})},K=async(e,t)=>{let n=t.trim();n.length===0||n===e||await x.mutateAsync({from:e,to:n})},me=async e=>{let t=dt(e,A);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 k.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`})},_e=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 y.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 T.mutateAsync({name:e})},Se=async(e,t)=>{await S.mutateAsync({location:e,icon:t})},q=async(e,t)=>{await C.mutateAsync({location:e,description:t})},J=p??[],Ce=async(e,t)=>{await O.mutateAsync({location:e,zone:t})},we=(e,t)=>{for(let n of e)b.mutate({deviceId:n,location:t})},[X,De]=i(null),Oe=t(()=>A.filter(e=>e.parentDeviceId===null).map(e=>({id:e.id,name:e.name,type:e.type,location:e.location})),[A]),ke=n(st,{rooms:ie,...I===`locations`?{unassignedCount:R.length}:{},value:I===`locations`?H:U??``,unassignedValue:mt,onChange:W}),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,z||V===null?n(lt,{rows:R,fleet:A,locations:j,busy:se,emptyMessage:G?r(`common.loading`,`Loading…`):r(`locations.everyTopLevelDeviceHas`,`Every top-level device has a room.`),onAssign:we}):n(et,{name:V.name,members:V.members,devices:A,busy:se,icon:Ze(d,E(V.name)),onPickIcon:e=>Se(V.name,e),description:Ke(f,E(V.name)),onSaveDescription:e=>q(V.name,e),zones:J,zoneKey:Ye(J,E(V.name)),onChangeZone:e=>Ce(V.name,e),onRename:e=>K(V.name,e),onDelete:()=>_e(V.name,Ae(A,V.name).length),onRebuildLinks:()=>me(V.name),onAddDevices:()=>De(V.name)},V.name),j.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:h?`pending`:`answered`,lockedIds:X===null?[]:(M.find(e=>e.name===X)?.members??[]).map(e=>e.id),lockedNote:r(`locations.room.alreadyHere`),suggestions:{heading:r(`locations.room.suggestedUnassigned`),ids:R.map(e=>e.id)},busy:b.isPending,onConfirm:e=>{X!==null&&we(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:U,cameras:U===null?[]:Ae(A,U).filter(e=>e.isCamera),fleet:A})]});return n(Ee,{icon:u,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:I===`zones`?n(at,{busy:w.isPending,onCreate:e=>w.mutateAsync({name:e})}):n(it,{busy:v.isPending,onCreate:le}),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:se,onRename:(e,t)=>D.mutateAsync({from:e,to:t}),onDelete:ye,onPickIcon:(e,t)=>w.mutateAsync({name:e,icon:t})})}]})}export{ht as LocationsPage};
@@ -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}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Qa as s,Vn as c,Za as l,_i as u,fa as d,ft as f,mn as p,sa as m,zr as h}from"./player-overlays-fpbPSPqT.js";import{Ec as g,Xs as _}from"./client-Cng2SeYA.js";import{t as v}from"./layers-BH9u1mrE.js";import{t as y}from"./timer-reset-5221y6Jb.js";import{Af as b,Df as x,Ir as S,Nf as C,Qi as w,Sp as T,Zi as E,mp as D,mr as O,qp as k,wa as A}from"./src-eL0OacoB.js";import{t as j}from"./useTranslation-BJr-n0es.js";import{a as M,b as N,i as P,wi as F}from"./index-DbXFHmBJ.js";import{t as I}from"./AdminSectionedPage-bGVBepbw.js";import{t as L}from"./InstancesTable-LVQWfz07.js";import{t as R}from"./AdminPage-BkxgjFWW.js";o();var z=[12e4,3e5,6e5,18e5],B={"request-census":`Counts every tRPC call by TRANSPORT PLANE — http, ws, mesh — and by procedure, caller, address and user-agent. Subscriptions are counted apart from calls, so a long-lived stream cannot pass for a storm. Arm it, then restart: the deadline is persisted, so the window is still running when clients reconnect.`};function V(){let{t}=j(),n=b({},{refetchInterval:5e3}),i=C(),[o,s]=a(null),c=(e,t)=>{s(e),i.mutate({patch:{diagnostics:[{id:e,armMs:t}]}},{onSettled:()=>{s(null),n.refetch()}})},u=n.data?.activeWindows??[],d=(n.data?.channels??[]).filter(e=>e.kind!==`debug`),f=n.data?.activeChannels??[],p=(e,t,r)=>{s(e),i.mutate({patch:{channels:[{channel:e,armMs:t,deviceIds:r}]}},{onSettled:()=>{s(null),n.refetch()}})};return e(R,{embedded:!0,icon:l,title:t(`logging.diagnostics.title`,`Diagnostics`),subtitle:t(`logging.diagnostics.subtitle`,`Diagnostics are armed for a window, never switched on. Each carries a deadline and expires by itself — one left running is an incident of its own.`),children:[n.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(h,{className:`h-3.5 w-3.5 animate-spin`}),t(`common.loading`,`Loading…`)]}):r(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:u.map(e=>r(U,{window:e,busy:o===e.id,onArm:t=>c(e.id,t)},e.id))}),r(`h3`,{className:`mt-6 text-sm font-medium text-foreground`,children:t(`logging.diagnostics.channels`,`Component channels`)}),r(`p`,{className:`mb-2 max-w-3xl text-[11px] text-foreground-subtle`,children:t(`logging.diagnostics.channelsSubtitle`,`Declared by the addons that own them — this list is not maintained by hand. Arming a channel opens a window with a deadline; it closes by itself.`)}),d.length===0?r(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`logging.diagnostics.noChannels`,`No addon on this cluster declares a log channel, or none could be reached right now.`)}):r(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:d.map(e=>r(H,{channel:e,state:f.find(t=>t.channel===e.name),busy:o===e.name,onArm:(t,n)=>p(e.name,t,n)},e.name))})]})}function H({channel:t,state:n,busy:i,onArm:o}){let{t:s}=j(),[c,l]=a(``),u=n?.armed===!0,f=()=>{let e=c.split(/[\s,+]+/).filter(e=>/^\d+$/.test(e)).map(e=>Number(e));return e.length>0?e:null};return e(`div`,{className:`flex flex-col gap-2 p-3 lg:flex-row lg:items-center lg:justify-between`,children:[e(`div`,{className:`min-w-0`,children:[e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),u?e(`span`,{className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold text-warning`,children:[r(y,{className:`h-3 w-3`}),s(`logging.diagnostics.expiresIn`,`expires in {{left}}`,{left:W(n?.remainingMs??0)})]}):r(`span`,{className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,children:s(`logging.diagnostics.disarmed`,`disarmed`)}),u&&n?.deviceIds!==null&&n?.deviceIds!==void 0&&e(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[r(d,{className:`h-3 w-3`}),n.deviceIds.join(`, `)]}),!t.perDevice&&r(`span`,{className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,children:s(`logging.diagnostics.notPerCamera`,`not filterable per camera`)})]}),r(`p`,{className:`mt-0.5 max-w-2xl text-[11px] text-foreground-subtle`,children:t.description})]}),e(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1`,children:[t.perDevice&&r(T,{type:`text`,inputMode:`numeric`,value:c,disabled:i,onChange:e=>l(e.target.value),placeholder:s(`logging.diagnostics.camerasPlaceholder`,`all cameras`),className:`w-28 rounded border border-border bg-surface px-2 py-1 text-[11px] text-foreground`}),z.map(e=>r(D,{variant:`unstyled`,type:`button`,disabled:i,onClick:()=>o(e,f()),className:`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-50`,children:W(e)},e)),r(D,{variant:`unstyled`,type:`button`,disabled:i||!u,onClick:()=>o(0,null),className:`rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-40`,children:s(`logging.diagnostics.disarm`,`Disarm`)})]})]})}function U({window:t,busy:n,onArm:i}){let{t:a}=j();return e(`div`,{className:`flex flex-col gap-2 p-3 lg:flex-row lg:items-center lg:justify-between`,children:[e(`div`,{className:`min-w-0`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:t.id}),t.armed?e(`span`,{className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold text-warning`,children:[r(y,{className:`h-3 w-3`}),a(`logging.diagnostics.expiresIn`,`expires in {{left}}`,{left:W(t.remainingMs)})]}):r(`span`,{className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,children:a(`logging.diagnostics.disarmed`,`disarmed`)}),t.armed&&!t.persisted&&r(`span`,{className:`text-[10px] text-warning`,children:a(`logging.diagnostics.notPersisted`,`not persisted — will not survive a restart`)})]}),r(`p`,{className:`mt-0.5 max-w-2xl text-[11px] text-foreground-subtle`,children:B[t.id]??``})]}),e(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1`,children:[z.map(e=>r(D,{variant:`unstyled`,type:`button`,disabled:n,onClick:()=>i(e),className:`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-50`,children:W(e)},e)),r(D,{variant:`unstyled`,type:`button`,disabled:n||!t.armed,onClick:()=>i(0),className:`rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-40`,children:a(`logging.diagnostics.disarm`,`Disarm`)})]})]})}function W(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:r===0?`${n}m`:`${n}m ${r}s`}function G(){let{t:e}=j();return r(L,{functionCap:`log-destination`,icon:c,title:e(`system.logging.destinations`,`Destinations`),subtitle:e(`system.logging.everyRegisteredLogDestinationEntries`,`Every registered log destination. Entries are fanned to all enabled destinations at once — enabling one does not disable another.`),emptyTitle:e(`system.logging.noLogDestinationsRegistered`,`No log destinations registered`),emptyDescription:e(`system.logging.thisShouldNotHappenThe`,`This should not happen — the console and rotated-file destinations are builtins. If the list is empty, the node is still booting.`),defaultKindLabel:e(`system.logging.kindDestination`,`Log destination`),addLabel:e(`system.logging.addDestination`,`Add destination`),install:{capability:`log-destination`,label:e(`system.logging.installDestination`,`Install a destination`)}})}o();var K=[`debug`,`info`,`warn`,`error`],q=``,J=``;function Y(){let{t:n}=j(),[i,o]=a(q),[s,c]=a(J),{nodes:l}=k(),u=t(()=>l.map(e=>({id:e.id,label:e.name||e.id})),[l]),d=b({...i===q?{}:{scopeNodeId:i},...s===J?{}:{scopeComponent:s}},{refetchInterval:15e3}),p=C(),m=d.data,g=p.isPending||d.isFetching,_=(m?.channels??[]).filter(e=>e.kind!==`debug`),y=(e,t)=>{p.mutate({...e.nodeId===null?{}:{scopeNodeId:e.nodeId},...e.component===null?{}:{scopeComponent:e.component},patch:{level:t}},{onSuccess:()=>void d.refetch()})};return r(R,{embedded:!0,icon:v,title:n(`logging.levels.title`,`Levels`),subtitle:n(`logging.levels.subtitle`,`Cluster → node, most specific wins. The floor gates what reaches the log destinations; the in-memory viewer keeps every line either way.`),actions:e(`div`,{className:`flex flex-wrap items-center gap-3`,children:[e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[n(`logging.levels.scope`,`Scope`),e(f,{wrapperClassName:`inline-block w-auto`,value:i,disabled:s!==J,onChange:e=>o(e.target.value),children:[r(`option`,{value:q,children:n(`logging.levels.cluster`,`Cluster`)}),u.map(e=>r(`option`,{value:e.id,children:e.label},e.id))]})]}),e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[n(`logging.levels.component`,`Component`),e(f,{wrapperClassName:`inline-block w-auto`,value:s,onChange:e=>c(e.target.value),children:[r(`option`,{value:J,children:n(`logging.levels.noComponent`,`None`)}),_.map(e=>r(`option`,{value:e.name,children:e.name},e.name))]})]})]}),children:d.isLoading||m===void 0?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(h,{className:`h-3.5 w-3.5 animate-spin`}),n(`common.loading`,`Loading…`)]}):e(`div`,{className:`space-y-3`,children:[r(Z,{level:m.effective.level,source:m.effective.levelSource,persisted:m.persisted}),r(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:m.explicit.layers.map(e=>r(Q,{layer:e,inForce:e.scope===m.effective.levelSource,busy:g,onSet:t=>y(e,t),onClear:()=>y(e,null)},`${e.scope}:${e.nodeId??e.component??`cluster`}`))}),s!==J&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:_.find(e=>e.name===s)?.description??``}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`logging.levels.componentNote`,`A component is a log channel an addon declared. Its level is cluster-wide and beats both the node and the cluster layer.`)}),r(X,{days:m.opsLogRetentionDays,busy:g,onSet:e=>p.mutate({patch:{opsLogRetentionDays:e}},{onSuccess:()=>void d.refetch()})})]})})}function X({days:t,busy:n,onSet:i}){let{t:a}=j();return e(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-1`,children:[e(`label`,{className:`flex items-center justify-between gap-3`,children:[r(`span`,{className:`text-xs font-medium`,children:a(`logging.levels.opsLogRetention`,`Retention audit trail`)}),e(`span`,{className:`flex items-center gap-1.5`,children:[r(T,{type:`number`,min:0,max:3650,step:1,defaultValue:t,disabled:n,onBlur:e=>{let n=Number.parseInt(e.target.value,10);Number.isFinite(n)&&n!==t&&i(n)},className:`w-20 rounded border border-border bg-surface px-2 py-1 text-xs`}),r(`span`,{className:`text-[11px] text-foreground-subtle`,children:a(`common.days`,`days`)})]})]}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:a(`logging.levels.opsLogRetentionNote`,`How long the record of what retention deleted is kept. Cluster-wide, and deliberately longer than any camera window — it is the history of the sweep, not of the camera, and it is what makes a storage leak explainable after the fact. 0 keeps it forever.`)})]})}function Z({level:t,source:n,persisted:i}){let{t:a}=j();return e(`div`,{className:`rounded-lg border border-border bg-surface p-3`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-xs text-foreground-subtle`,children:a(`logging.levels.effective`,`In force here`)}),r(`span`,{className:`rounded bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary`,children:t}),r(`span`,{className:`text-[11px] text-foreground-subtle`,children:n==="default"?a(`logging.levels.fromDefault`,`nothing is set anywhere — this is the default`):a(`logging.levels.fromLayer`,`decided by the {{source}} layer`,{source:n})})]}),!i&&r(`p`,{className:`mt-1 text-[11px] text-warning`,children:a(`logging.levels.notPersisted`,`The settings store could not be read or written — what you see is live, but it would not survive a restart.`)})]})}function Q({layer:t,inForce:n,busy:i,onSet:a,onClear:o}){let{t:s}=j();return e(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[e(`div`,{className:`min-w-0`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:t.scope===`cluster`?s(`logging.levels.cluster`,`Cluster`):t.scope===`component`?t.component??``:t.nodeId??``}),n&&e(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[r(m,{className:`h-3 w-3`}),s(`logging.levels.inForce`,`in force`)]})]}),r(`p`,{className:`mt-0.5 text-[11px] text-foreground-subtle`,children:t.level===null?s(`logging.levels.inherits`,`inherits — nothing set at this layer`):s(`logging.levels.setHere`,`set here: {{level}}`,{level:t.level})})]}),e(`div`,{className:`flex shrink-0 items-center gap-1`,children:[K.map(e=>r(D,{variant:`unstyled`,type:`button`,disabled:i,onClick:()=>a(e),className:`rounded px-2 py-1 text-[11px] font-medium transition-colors disabled:opacity-50 ${t.level===e?`bg-primary text-primary-foreground`:`border border-border text-foreground-subtle hover:text-foreground`}`,children:e},e)),r(D,{variant:`unstyled`,type:`button`,disabled:i||t.level===null,onClick:o,className:`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-40`,children:s(`logging.levels.clear`,`Clear`)})]})]})}function $(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${String(r).padStart(2,`0`)}s`}function ee(e,t){return{windowMs:Math.max(0,e.untilMs-t),capMs:Math.max(0,e.capAtMs-t)}}function te(e,t){let n=new Set(e.map(e=>e.channel));return t.filter(e=>n.has(e))}o();var ne=[_.Camera],re=8,ie=1e3,ae=15e3;function oe(){let{t:o}=j(),c=b({},{refetchInterval:15e3}),l=x(),[d,f]=a([]),[m,_]=a([]),[v,C]=a([]),[T,k]=a(()=>Date.now()),[M,N]=a([]),P=t(()=>(c.data?.channels??[]).filter(e=>e.kind===`debug`),[c.data]),F=n((e,t,n)=>{l.mutate({action:e,channels:t,deviceIds:n},{onSuccess:e=>{f(e.watches),N(e.lapsed)}})},[]);i(()=>{let e=setInterval(()=>k(Date.now()),ie);return()=>clearInterval(e)},[]),i(()=>{F(`list`,[],[]);let e=setInterval(()=>F(`list`,[],[]),ae);return()=>clearInterval(e)},[F]);let I=te(d,m).join(`|`);i(()=>{if(I===``)return;let e=setInterval(()=>F(`rearm`,I.split(`|`),[]),g);return()=>clearInterval(e)},[I,F]);let L=m.length>0&&v.length>0&&!l.isPending,z=[...new Set(d.flatMap(e=>e.deviceIds))],B=(e,t)=>_(n=>t?[...n,e]:n.filter(t=>t!==e));return e(R,{embedded:!0,icon:u,title:o(`logging.watch.title`,`Watch`),subtitle:o(`logging.watch.subtitle`,`Switch a debug channel on for chosen devices and read it live. A watch lasts 10 minutes, is renewed while this page stays open, and ends by itself after 60 minutes at most.`),children:[r(S,{headingId:`log-watch-setup`,title:o(`logging.watch.setup`,`Channels and devices`),children:c.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(h,{className:`h-3.5 w-3.5 animate-spin`}),o(`common.loading`,`Loading…`)]}):P.length===0?r(`p`,{className:`text-[11px] text-foreground-subtle`,children:o(`logging.watch.noChannels`,`No addon on this cluster offers a debug channel, or none could be reached right now.`)}):e(`div`,{className:`space-y-3 p-3`,children:[r(`div`,{className:`space-y-2`,children:P.map(t=>e(`label`,{className:`flex items-start gap-2`,children:[r(s,{checked:m.includes(t.name),onChange:e=>B(t.name,e.target.checked)}),e(`span`,{className:`min-w-0`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),r(`span`,{className:`block text-[11px] text-foreground-subtle`,children:t.description})]})]},t.name))}),e(`div`,{className:`flex flex-col gap-1`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:o(`logging.watch.devices`,`Devices`)}),r(A,{multiple:!0,pick:`device`,noun:`camera`,fixedTypes:ne,maxItems:re,recentKey:`log-watch-devices`,testId:`log-watch-devices`,value:w(v),onChange:e=>C(E(e))})]}),e(`div`,{className:`flex flex-wrap gap-2`,children:[r(D,{type:`button`,disabled:!L,onClick:()=>F(`start`,m,v),children:o(`logging.watch.start`,`Start watching`)}),e(D,{type:`button`,variant:`secondary`,disabled:d.length===0||l.isPending,onClick:()=>F(`stop`,d.map(e=>e.channel),[]),children:[r(p,{className:`mr-1 h-3.5 w-3.5`}),o(`logging.watch.stop`,`Stop`)]})]}),l.isError&&r(`p`,{className:`text-[11px] text-destructive`,children:l.error.message}),M.length>0&&r(`p`,{className:`text-[11px] text-warning`,children:o(`logging.watch.lapsed`,`Already ended, not renewed: {{names}}. Start again to continue.`,{names:M.join(`, `)})})]})}),d.length>0&&e(S,{headingId:`log-watch-live`,title:o(`logging.watch.live`,`Live`),children:[r(`div`,{className:`divide-y divide-border`,children:d.map(t=>{let n=ee(t,T);return e(`div`,{className:`flex flex-wrap items-center gap-2 p-3`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:t.channel}),e(`span`,{className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold text-warning`,children:[r(y,{className:`h-3 w-3`}),o(`logging.watch.endsIn`,`ends in {{left}}`,{left:$(n.windowMs)})]}),r(`span`,{className:`text-[11px] text-foreground-subtle`,children:o(`logging.watch.capIn`,`hard stop in {{left}}`,{left:$(n.capMs)})}),e(`span`,{className:`text-[11px] text-foreground-subtle`,children:[`#`,t.deviceIds.join(`, #`)]})]},t.channel)})}),z.map(e=>r(`div`,{className:`border-t border-border`,children:r(O,{deviceId:e,limit:200,maxHeight:`max-h-80`,showScope:!0,showFilters:!1})},e))]})]})}function se(){let[e]=F(),t=e.get(`deviceId`),n=t===null?void 0:Number(t);return r(R,{embedded:!0,children:r(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:r(O,{deviceId:n!==void 0&&Number.isFinite(n)?n:void 0,limit:500,maxHeight:`max-h-[calc(100vh-310px)]`,showFilters:!0,showOriginFilter:!0,columns:{available:[`integration`,`device`],defaultVisible:[`integration`,`device`]}})})})}function ce(){let{t:e}=j(),t=N(`/system/logs`,{t:e,isAdmin:!0})??{icon:c,title:e(`system.logs`,`Logs`)};return r(I,{icon:t.icon,title:t.title,defaultSection:`viewer`,sectionsLabel:`${t.title} sections`,sections:[{id:`viewer`,label:e(`admin.system.logs.viewer`,`Viewer`),content:r(se,{})},{id:M.logging.tab,label:e(`admin.system.logs.destinations`,`Destinations`),content:r(G,{}),ownedParams:P},{id:`levels`,label:e(`admin.system.logs.levels`,`Levels`),content:r(Y,{})},{id:`watch`,label:e(`admin.system.logs.watch`,`Watch`),content:r(oe,{})},{id:`diagnostics`,label:e(`admin.system.logs.diagnostics`,`Diagnostics`),content:r(V,{})}]})}export{ce as LogsPage};
@@ -1 +0,0 @@
1
- import{C as e,J as t,K as n,R as r,S as i,V as a,W as o,Y as s,et as c,i as l,j as u,o as d,p as f,t as p}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{yt as m}from"./player-overlays-fpbPSPqT.js";import{$c as h,el as g}from"./client-Cng2SeYA.js";import{Mo as _,_s as v,at as y,do as ee,eo as te,mp as b,to as ne}from"./src-eL0OacoB.js";import{t as re}from"./useTranslation-BJr-n0es.js";import{M as ie,N as ae,P as x,Vt as S}from"./index-DbXFHmBJ.js";import{n as oe,t as se}from"./settings-section-shape-DbQZZpNL.js";c();var C=u(function({addonId:e,schema:s,serverValues:c,onImmediateSave:l,onStateChange:u,onAction:d,disabled:f},p){let m=x({schema:s,serverValues:c,onImmediateSave:r(t=>l(e,t),[e,l]),onDeferredSave:r(()=>{},[])});o(p,()=>({flush:()=>{let e={};for(let t of m.pendingKeys)e[t]=m.values[t];return m.handleDiscard(m.pendingKeys),e},discard:()=>m.resetAll()}),[m]);let h=m.pendingKeys,g=h.join(`|`),_=n(()=>h.map(e=>`${e}=${JSON.stringify(m.values[e])}`).join(`,`),[h,m.values]),v=t(u);a(()=>{v.current=u},[u]),a(()=>{let t={};for(let e of h)t[e]=m.values[e];v.current({addonId:e,pendingKeys:h,pendingValues:t})},[e,g,_]);let y=n(()=>{if(d)return(t,n,r)=>d(e,t,n,r)},[e,d]);return i(S,{schema:s,values:m.values,onChange:m.handleChange,disabled:f,onAction:y})});function w(e){return`perNode`in e&&e.perNode===!0}function T(e,t){if(e.type===`group`){let n=E(e.fields,t);return n.length>0?{...e,fields:n}:null}if(e.type===`sub-tabs`){let n=e.tabs.map(e=>({...e,fields:E(e.fields,t)})).filter(e=>e.fields.length>0);return n.length>0?{...e,tabs:n}:null}return w(e)===(t===`perNode`)?e:null}function E(e,t){let n=[];for(let r of e){let e=T(r,t);e!==null&&n.push(e)}return n}function ce(e,t){let n=[];for(let r of e.sections){let e=E(r.fields,t);e.length!==0&&n.push({...r,fields:e})}return{...e,sections:n}}function D(e,t){return t===void 0?!0:t===`perNode`?e===`node`:e!==`node`}function le(e){let t=e.allowSectionIds?new Set(e.allowSectionIds):null,n=e.omitSectionIds?new Set(e.omitSectionIds):null,r=new Set,i=[];for(let a of e.declarations){if(!D(a.scope,e.fieldScope)||e.capability!==void 0&&a.cap!==e.capability)continue;let o=a.sectionIds.filter(e=>r.has(e)||(r.add(e),t!==null&&!t.has(e))?!1:n===null||!n.has(e));o.length>0&&i.push({cap:a.cap,scope:a.scope,sectionIds:o})}return i}function ue(e){let t=[],n=new Map,r={};for(let{declaration:i,form:a}of e){let e=new Set(i.sectionIds),o=a.sections.filter(t=>e.has(t.id));t.push(...o);for(let e of a.tabs??[])n.has(e.id)||n.set(e.id,e);for(let e of g({sections:o}).keys()){let t=r[e]??[];t.push({cap:i.cap,scope:i.scope}),r[e]=t}}return{form:{...n.size>0?{tabs:[...n.values()]}:{},sections:t},keyTargets:r}}function de(e,t){let n=new Map,r=[];for(let[i,a]of Object.entries(e)){let e=t[i];if(e===void 0||e.length===0){r.push(i);continue}for(let t of e){let e=`${t.cap}\u0000${t.scope}`,r=n.get(e)??{target:t,patch:{}};r.patch[i]=a,n.set(e,r)}}return{groups:[...n.values()].map(e=>({...e.target,patch:e.patch})),unowned:r}}c();function O(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>O(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function k(e,t){return{...e,fields:e.fields.map(e=>O(e,t))}}function fe(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>k(e,t))},values:t}}function A({nodeId:a,addonIds:o,level:c,deviceId:u,capability:g,omitCapabilities:b,sectionIds:x,omitSectionIds:S,fieldKeys:C,omitFieldKeys:w,hideSectionChrome:T,tabAliases:E,tabLabelOverrides:D,sectionTab:O,fieldScope:k,emptyMessage:A,extraTabs:j,schemaTabExtras:M,title:N,description:P,selfTabbed:me,activeTab:he,onActiveTabChange:ge}){let{t:F}=re(),I=d(),L=m().trpcClient,_e=ne(),ve=te(),ye=v(),be=_(),R=me===!0||!!(j&&j.length>0),[xe,Se]=s(null);if(c===`device`&&!u)throw Error(`NodeAddonsSettingsPanel: deviceId is required when level === "device"`);let z=a??`hub`,B=l({queries:o.map(e=>({queryKey:[[`addonSettings`,c===`global`?`listScopedSettings`:`getDeviceSettings`],{addonId:e,nodeId:z,deviceId:u??null,cap:g??null,omitCaps:b??null,scope:k??null,sections:[x??null,S??null]}],queryFn:async()=>{if(c===`global`){let t=await L.addonSettings.listScopedSettings.query({addonId:e,nodeId:z});if(t===null)return{addonId:e,result:null,keyTargets:{}};let n=new Set(b??[]),r=le({declarations:t.filter(e=>!n.has(e.cap)),...k===void 0?{}:{fieldScope:k},...g===void 0?{}:{capability:g},...x===void 0?{}:{allowSectionIds:x},...S===void 0?{}:{omitSectionIds:S}}),i=await Promise.all(r.map(async t=>{let n=await L.addonSettings.getScopedSettings.query({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:z}:{}});return n===null?null:{declaration:t,form:n}})),a=i.filter(e=>e!==null);if(a.length!==i.length)return{addonId:e,result:null,keyTargets:{}};let o=ue(a);return{addonId:e,result:o.form,keyTargets:o.keyTargets}}let t=await L.addonSettings.getDeviceSettings.query({addonId:e,deviceId:u,nodeId:z});return{addonId:e,result:t!==null&&k!==void 0?ce(t,k):t,keyTargets:{}}},placeholderData:f}))}),Ce=B.some(e=>e.isLoading),V=B.map(e=>{if(!e.data)return`-`;if(e.data.result===null)return`${e.data.addonId}:n`;let t=[];for(let n of e.data.result.sections){t.push(`s:${n.id}:${n.tab??`general`}`);for(let e of n.fields){if(!(`key`in e))continue;let n=`options`in e&&Array.isArray(e.options)?e.options.map(e=>e.value).join(`,`):``,r=e.value,i=r===void 0?``:typeof r==`string`?r:JSON.stringify(r);t.push(`f:${e.key}:${n}:${i}`)}}return`${e.data.addonId}:${t.join(`|`)}`}).join(`||`),H=n(()=>{let e=new Set;for(let t of B){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(oe(t.tab,E))}return[...e]},[E,V+`::`+B.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),U=n(()=>new Map((j??[]).map(e=>[e.id,e])),[j]),W=n(()=>{if(!R)return[];let e=[...new Set([...H,...(j??[]).map(e=>e.id),...(M??[]).map(e=>e.tabId)])],t=e=>{let t=U.get(e);if(t?.order!==void 0)return t.order;let n=h[e];return n?n.order:50};return e.toSorted((e,n)=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})},[R,H,j,U,M]),we=n(()=>{let e=new Map,t=e=>h[e]?.label??e.charAt(0).toUpperCase()+e.slice(1);for(let n of H)e.set(n,t(n));for(let n of M??[])e.has(n.tabId)||e.set(n.tabId,t(n.tabId));for(let t of j??[])e.set(t.id,t.label);for(let[t,n]of Object.entries(D??{}))e.set(t,n);return e},[H,j,M,D]),G=he===void 0?xe:he,K=R?G&&W.includes(G)?G:W[0]??null:null,Te=e=>{Se(e),ge?.(e)},Ee=K!==null&&U.has(K),q=R?K&&!Ee?K:void 0:O,{data:De}=ee(void 0),Oe=n(()=>{let e=new Map;for(let t of De??[]){let n=t.manifest?.id;if(!n)continue;let r=t.manifest?.name??t.manifest?.packageDisplayName??n;e.set(n,r)}return e},[De]),J=t(new Map),Y=n(()=>{let e=x?new Set(x):null,t=S?new Set(S):null,n=n=>!(e!==null&&!e.has(n)||t!==null&&t.has(n)),r=[];for(let e of B){if(!e.data)continue;e.data.result!==null&&J.current.set(e.data.addonId,{result:e.data.result,keyTargets:e.data.keyTargets});let t=J.current.get(e.data.addonId)??null;if(t===null)continue;let{result:i,keyTargets:a}=t,{schema:o,values:s}=fe(i),c={...C===void 0?{}:{fieldKeys:C},...w===void 0?{}:{omitFieldKeys:w},...T===void 0?{}:{hideSectionChrome:T},...E===void 0?{}:{tabAliases:E}},l=se(o.sections.filter(e=>n(e.id)),c);if(l.length===0)continue;let u={...i,sections:se(i.sections.filter(e=>n(e.id)),c)},d={...o,sections:l};r.push({addonId:e.data.addonId,schemaWithValues:u,schema:d,serverValues:s,keyTargets:a})}return r},[V,x,S,C,w,T,E]),ke=n(()=>B.flatMap(e=>c===`global`&&e.data!==void 0&&e.data.result===null&&!J.current.has(e.data.addonId)?[e.data.addonId]:[]),[V,c]),[X,Ae]=s(new Map),je=r(e=>{Ae(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),Z=t(new Map),Me=r(e=>t=>{t?Z.current.set(e,t):Z.current.delete(e)},[]),Q=r(async(e,t)=>{if(c!==`global`){await ve.mutateAsync({addonId:e,deviceId:u,nodeId:z,patch:t});return}let{groups:n,unowned:r}=de(t,Y.find(t=>t.addonId===e)?.keyTargets??{});if(r.length>0)throw Error(`${e}: no scoped setting declares ${r.join(`, `)}`);let i=(await Promise.allSettled(n.map(t=>_e.mutateAsync({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:z}:{},patch:t.patch})))).flatMap((e,t)=>{let r=n[t];if(e.status!==`rejected`||r===void 0)return[];let i=e.reason instanceof Error?e.reason.message:String(e.reason);return[`${r.cap}/${r.scope}: ${i}`]});if(i.length>0)throw I.invalidateQueries({queryKey:[[`addonSettings`]]}),Error(`${e}: not saved to ${i.join(`; `)}`)},[c,Y,_e,ve,I,z,u]),Ne=r(async(e,t)=>{await Q(e,t),I.invalidateQueries({queryKey:[[`addonSettings`]]})},[Q,I]),Pe=r(async(e,t,n,r)=>{let i=z;try{switch(t){case`reprobe-hwaccel`:await ye.mutateAsync({nodeId:i}),I.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await be.mutateAsync({nodeId:i}),I.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await L.addons.custom.mutate({addonId:e,action:t,input:r});return I.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[ye,be,z,I,L]),Fe=r((e,t)=>{Ne(e,t)},[Ne]),$=p({mutationFn:async()=>{let e=[];for(let t of Y){let n=X.get(t.addonId);!n||n.pendingKeys.length===0||e.push({addonId:t.addonId,patch:n.pendingValues})}return e.length===0?{saved:[]}:{saved:await Promise.all(e.map(async({addonId:e,patch:t})=>(await Q(e,t),e)))}},onSuccess:({saved:e})=>{for(let t of e)Z.current.get(t)?.discard();I.invalidateQueries({queryKey:[[`addonSettings`]]})}}),Ie=r(()=>{for(let e of Z.current.values())e.discard()},[]),Le=n(()=>{let e=0;for(let t of Y){let n=X.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[Y,X]),Re=n(()=>{let e=new Map;for(let t of Y){let n=X.get(t.addonId);if(!n||n.pendingKeys.length===0)continue;let r=new Set(n.pendingKeys);for(let n of t.schema.sections){let t=n.tab??`general`;for(let i of n.fields)`key`in i&&r.has(i.key)&&e.set(t,(e.get(t)??0)+1)}}return e},[Y,X]);if(Ce)return i(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let ze=K&&Ee?U.get(K):void 0,Be=ke.length>0?i(`div`,{className:`space-y-1 text-[11px] text-foreground-subtle`,role:`status`,children:ke.map(e=>i(`div`,{children:F(`settings.nodeAddonsSettingsPanel.addonUnavailable`,`{{name}} not available.`,{name:Oe.get(e)??e})},e))}):null;if(!R&&Y.length===0)return Be===null?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:A??F(`settings.nodeAddonsSettingsPanel.noAddonsIn`,{scope:o.length>0?`[${o.join(`, `)}]`:F(`settings.nodeAddonsSettingsPanel.theCurrentSelection`,`the current selection`),level:c})}):Be;let Ve=$.isPending;return e(`div`,{className:`space-y-4`,children:[(N||P)&&e(`div`,{className:`border-b border-border pb-2`,children:[N&&i(`h2`,{className:`text-sm font-semibold text-foreground`,children:N}),P&&i(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:P})]}),Y.length>0||R?Be:null,R&&i(ie,{tabs:W.map(e=>({id:e,label:we.get(e)??e})),activeId:K,onChange:Te,pendingByTab:Re}),$.isError&&e(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[F(`settings.nodeAddonsSettingsPanel.saveFailed`,`Save failed:`),` `,String($.error?.message??$.error)]}),i(y,{tabKey:ze?`extra:${K??``}`:`tab:${K??``}`,children:ze?ze.content:(()=>{let t=q?Y.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===q).length,0):0,n=!!q&&t<=1,r=Y.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>q?(e.tab??`general`)===q:!0).map(e=>n?{...e,title:``,description:void 0}:e)}})).filter(e=>e.renderedWithValues.sections.length>0).toSorted((e,t)=>{let n=e=>{let t=1/0;for(let n of e)typeof n.order==`number`&&n.order<t&&(t=n.order);return t},r=n(e.renderedWithValues.sections),i=n(t.renderedWithValues.sections);return r===i?0:r-i}),a=(M??[]).filter(e=>e.tabId===q),o=a.filter(e=>(e.placement??`before`)===`before`),s=a.filter(e=>e.placement===`after`);return r.length===0&&a.length===0?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:A??F(`settings.nodeAddonsSettingsPanel.nothingToConfigureHereFor`,`Nothing to configure here for this node.`)}):e(`div`,{className:`space-y-6`,children:[o.map((e,t)=>i(`div`,{children:e.content},`extra-before-${t}`)),r.length>0&&i(pe,{entries:r,paneStates:X,displayNames:Oe,disabled:Ve,setPaneRef:Me,onPaneStateChange:je,onImmediateSave:Fe,onAction:Pe,inline:R||!!O}),s.map((e,t)=>i(`div`,{children:e.content},`extra-after-${t}`))]})})()}),!Ce&&i(ae,{pendingCount:Le,onSave:()=>$.mutate(),onDiscard:Ie,saving:Ve})]})}function pe({entries:t,paneStates:r,displayNames:o,disabled:c,setPaneRef:l,onPaneStateChange:u,onImmediateSave:d,onAction:f,inline:p}){let m=n(()=>[...t].toSorted((e,t)=>{let n=o.get(e.addonId)??e.addonId,r=o.get(t.addonId)??t.addonId;return n.localeCompare(r)}),[t,o]),[h,g]=s(m[0]?.addonId??``);a(()=>{m.length!==0&&(m.find(e=>e.addonId===h)||g(m[0].addonId))},[m,h]);let _=m.find(e=>e.addonId===h)??m[0];if(!_)return null;let v=n(()=>f?(e,t,n,r)=>f(e,t,n,r):void 0,[f]),y=e=>i(C,{ref:l(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:d,onStateChange:u,onAction:v,disabled:c},e.addonId);return m.length===1||p?i(`div`,{className:`flex flex-col gap-4`,children:m.map(y)}):e(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:m.map(t=>{let n=o.get(t.addonId)??t.addonId,a=t.addonId===_.addonId,s=(r.get(t.addonId)?.pendingKeys.length??0)>0;return e(b,{variant:`unstyled`,type:`button`,onClick:()=>g(t.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[n,s&&i(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},t.addonId)})}),i(`div`,{className:`space-y-2`,children:m.map(e=>i(`div`,{style:e.addonId===_.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{A as t};