@camstack/addon-admin-ui 1.2.443 → 1.2.444

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 (143) hide show
  1. package/dist/assets/{AddonAssetIcon-BZ3nAoxI.js → AddonAssetIcon-Bu6mMt1C.js} +1 -1
  2. package/dist/assets/Addons-COIVGqm1.js +4 -0
  3. package/dist/assets/AdminPage-CQo22qlS.js +1 -0
  4. package/dist/assets/AdminSectionedPage-B-vU2e0-.js +1 -0
  5. package/dist/assets/AiProfiles-CU2eppU9.js +3 -0
  6. package/dist/assets/{BrokerForm-Ccq1Ih2O.js → BrokerForm-F3TuyGuz.js} +1 -1
  7. package/dist/assets/Build-kD_UpwAf.js +40 -0
  8. package/dist/assets/{Calendars-1uP96v-V.js → Calendars-BIK8tWWW.js} +1 -1
  9. package/dist/assets/Cluster-_ehM-rcf.js +1 -0
  10. package/dist/assets/ClusterStepModel-_rs8hojC.js +1 -0
  11. package/dist/assets/CompositionEditor-CAVyLS8E.js +1 -0
  12. package/dist/assets/{CompositionEditorPage-y89GyEA5.js → CompositionEditorPage-LHnmpaBG.js} +1 -1
  13. package/dist/assets/Data-CjKZYFLT.js +2 -0
  14. package/dist/assets/DeviceDetail-Bg0CFoFt.js +2 -0
  15. package/dist/assets/{DeviceDoActionFields-q6xVAIAa.js → DeviceDoActionFields-oa5LfgEc.js} +1 -1
  16. package/dist/assets/{Devices-AoATGKWU.js → Devices-poYGMM17.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-Du1J1yTM.js → EmbedPlayerPage-DHUkmfpi.js} +1 -1
  18. package/dist/assets/History-BemofISk.js +1 -0
  19. package/dist/assets/Identity-i5HDvKSk.js +1 -0
  20. package/dist/assets/IntegrationDetail-DhTGMtwY.js +1 -0
  21. package/dist/assets/IntegrationHub-yEjjqm-b.js +1 -0
  22. package/dist/assets/Integrations-Bx1K8v1_.js +1 -0
  23. package/dist/assets/Integrations-DM18WhBS.js +1 -0
  24. package/dist/assets/Library-BlINo2aE.js +1 -0
  25. package/dist/assets/Locations-ClflpavL.js +3 -0
  26. package/dist/assets/{Logs-D5P4nUT8.js → Logs-DCYNwky1.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-DImE8rL3.js → MaskShapeCanvas-CLIOU75o.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-0CuyxGPc.js → MotionZonesSettings-CnE1SA-E.js} +1 -1
  29. package/dist/assets/MyAccess-CfC5QQ3s.js +2 -0
  30. package/dist/assets/{Network-Cn22Onk0.js → Network-BQ4JNadZ.js} +1 -1
  31. package/dist/assets/{NodeAddonsSettingsPanel-D2a6eJdl.js → NodeAddonsSettingsPanel-Cxa0ELmc.js} +1 -1
  32. package/dist/assets/Notifications-CZCz5f4V.js +1 -0
  33. package/dist/assets/{PrivacyMaskSettings-iuZ15_7K.js → PrivacyMaskSettings-D9OU-0Bn.js} +1 -1
  34. package/dist/assets/Recordings-D2V7gQg4.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-DMI4Puj8.js → ScanNetworkModal-qXvq-PVn.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-BeQX-lOK.js → SceneMonitorEditor-Z1tONQgv.js} +1 -1
  37. package/dist/assets/SessionsList-DRTHtQFG.js +2 -0
  38. package/dist/assets/Showroom-DsWM4R62.js +1 -0
  39. package/dist/assets/System-BO2ViXLt.js +1 -0
  40. package/dist/assets/{Terminal-BISFdyS_.js → Terminal-DSlfvSeb.js} +3 -3
  41. package/dist/assets/{Viewer-C9JIf56u.js → Viewer-B9E-i-aL.js} +1 -1
  42. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-PnsnCmkC.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Bxpb3Ns6.js} +1 -1
  43. package/dist/assets/{addon-icons-context-Ci899mcp.js → addon-icons-context-HpTz6tFr.js} +1 -1
  44. package/dist/assets/{archive-LCkF1dZb.js → archive-BhX0MX1x.js} +1 -1
  45. package/dist/assets/{authed-media-D_mDMacH.js → authed-media-ajJETyPB.js} +1 -1
  46. package/dist/assets/{bell-off-GaaNTQY2.js → bell-off-2A9pKMoS.js} +1 -1
  47. package/dist/assets/{board-model-D4eidiUD.js → board-model-BVOHJW-k.js} +1 -1
  48. package/dist/assets/{boxes-C5tX31nL.js → boxes-DKovb6Yx.js} +1 -1
  49. package/dist/assets/circle-slash-ioY3pbkD.js +1 -0
  50. package/dist/assets/client-BOc9ypnl.js +358 -0
  51. package/dist/assets/{cloud-upload-VkAtqPMg.js → cloud-upload-CsCUf2VU.js} +1 -1
  52. package/dist/assets/crop-BbAQnCUc.js +1 -0
  53. package/dist/assets/{device-integration-icon-DQ-h2aqY.js → device-integration-icon-CkT2sHMd.js} +1 -1
  54. package/dist/assets/device-picker-model-CQpRlaca.js +1 -0
  55. package/dist/assets/{dist-D8lgrNhR.js → dist-Cj5HXsk2.js} +1 -1
  56. package/dist/assets/dist-Dw33BAaG.js +358 -0
  57. package/dist/assets/{eraser-fzzWtRJk.js → eraser-CNEtQPIU.js} +1 -1
  58. package/dist/assets/{hard-drive-download-BoCYHTOr.js → hard-drive-download-CwMKGnle.js} +1 -1
  59. package/dist/assets/{hostInit-Cez0g2jV.js → hostInit-CDGHjPjp.js} +1 -1
  60. package/dist/assets/i18n-DzruZdmx.js +1 -0
  61. package/dist/assets/icons-CDiKrupg.js +1 -0
  62. package/dist/assets/index-CcCgJ28N.css +2 -0
  63. package/dist/assets/index-DzDx8M2g.js +4 -0
  64. package/dist/assets/{key-B8BAPcXc.js → key-BX-E7v5U.js} +1 -1
  65. package/dist/assets/{key-round-BJ8BVDGZ.js → key-round-B4PhAHaZ.js} +1 -1
  66. package/dist/assets/{layers-CD_tu1Pc.js → layers-NfjCHzhF.js} +1 -1
  67. package/dist/assets/{linked-devices-model-BpLdQSS2.js → linked-devices-model-C2Gvr2Rq.js} +1 -1
  68. package/dist/assets/{list-ordered-CV8Mey9J.js → list-ordered-BU_60EAm.js} +1 -1
  69. package/dist/assets/{location-owned-usage-BWKIfwEv.js → location-owned-usage-Dive37hg.js} +1 -1
  70. package/dist/assets/{log-in-CssruFII.js → log-in-R8rfmtnj.js} +1 -1
  71. package/dist/assets/{memory-stick-CGxsa350.js → memory-stick-C-FtHTf2.js} +1 -1
  72. package/dist/assets/{message-square-plus-CBy6WJpr.js → message-square-plus-CTNIdqDb.js} +1 -1
  73. package/dist/assets/{mf-entry-bootstrap-0-c381d6e5.js → mf-entry-bootstrap-0-adac5fea.js} +2 -2
  74. package/dist/assets/{mic-off-DZ1gYAW7.js → mic-off-DbMF1Y3I.js} +1 -1
  75. package/dist/assets/{monitor-off-CLe0AluZ.js → monitor-off-CKeLNGdf.js} +1 -1
  76. package/dist/assets/{monitor-smartphone-ClAfVDzo.js → monitor-smartphone-DkSAqU6y.js} +1 -1
  77. package/dist/assets/mount-CQpRlaca.js +1 -0
  78. package/dist/assets/{notification-schedule-field-DZeBBmOz.js → notification-schedule-field-BxKX0BnZ.js} +1 -1
  79. package/dist/assets/player-overlays-CAMZYPzW.js +1 -0
  80. package/dist/assets/{recycle-zmChefCS.js → recycle-coHHb6k6.js} +1 -1
  81. package/dist/assets/remoteEntry-BM1N_mRj.js +1 -0
  82. package/dist/assets/{scan-eye-CMTwtxZj.js → scan-eye-C4uwlmDz.js} +1 -1
  83. package/dist/assets/{scissors-BlRdwWP1.js → scissors-D7cwr443.js} +1 -1
  84. package/dist/assets/{search-x-CbwcvDCN.js → search-x-Bslo2FkO.js} +1 -1
  85. package/dist/assets/{send-6r6Ib9OA.js → send-BlcnRlFD.js} +1 -1
  86. package/dist/assets/{settings-2-BcvvKclK.js → settings-2-BWuIEodd.js} +1 -1
  87. package/dist/assets/{speaker-CMJy4ydK.js → speaker-BzFTvxeb.js} +1 -1
  88. package/dist/assets/src-K7pIMCyE.js +67 -0
  89. package/dist/assets/{timer-reset-BdRlRB62.js → timer-reset-pzWKM4kj.js} +1 -1
  90. package/dist/assets/uPlot.esm-B6hGABOr.js +10 -0
  91. package/dist/assets/{ungroup-BpleWEEi.js → ungroup-COyVBHW5.js} +1 -1
  92. package/dist/assets/{unlink-DKyXFXyJ.js → unlink-CK2LhAFN.js} +1 -1
  93. package/dist/assets/{usb-6pnA3ol4.js → usb-D8FdL_8F.js} +1 -1
  94. package/dist/assets/{use-scenes-feed-DaSpiEjT.js → use-scenes-feed-BHhoT9GM.js} +1 -1
  95. package/dist/assets/{use-stationary-objects-CMuPPZiU.js → use-stationary-objects-BEzZKgd5.js} +1 -1
  96. package/dist/assets/useEventInvalidation-CQpRlaca.js +1 -0
  97. package/dist/assets/{useNodeUrlSelection-DKMh9oxh.js → useNodeUrlSelection-1qoQDGNg.js} +1 -1
  98. package/dist/assets/user-round-DvukaL-O.js +1 -0
  99. package/dist/assets/{user-x-BRy73Tug.js → user-x-6Zpsyjh-.js} +1 -1
  100. package/dist/assets/{video-C_Glztyb.js → video-CBDxZVQI.js} +1 -1
  101. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bwge-Brs.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-qIFS5MFb.js} +2 -2
  102. package/dist/index.html +11 -11
  103. package/dist/server/addon.js +17 -2
  104. package/package.json +1 -1
  105. package/dist/assets/Addons-BGWXApJO.js +0 -4
  106. package/dist/assets/AdminPage-BrNVYSyo.js +0 -1
  107. package/dist/assets/AdminSectionedPage-Dh0h99mU.js +0 -1
  108. package/dist/assets/AiProfiles-LVK8z9CZ.js +0 -3
  109. package/dist/assets/Build-C_Zu-Je3.js +0 -40
  110. package/dist/assets/Cluster-BnmZh2Nn.js +0 -1
  111. package/dist/assets/ClusterStepModel-B6c_UMsA.js +0 -1
  112. package/dist/assets/CompositionEditor-joJfcrqc.js +0 -1
  113. package/dist/assets/Data-DX8kzB-3.js +0 -2
  114. package/dist/assets/DeviceDetail-B8U3Yepm.js +0 -2
  115. package/dist/assets/Identity-BOfwyXgX.js +0 -1
  116. package/dist/assets/IntegrationDetail-DCQjP8LU.js +0 -1
  117. package/dist/assets/IntegrationHub-B-RxXA9_.js +0 -1
  118. package/dist/assets/Integrations-CzTceJFE.js +0 -1
  119. package/dist/assets/Integrations-WPdqnrXU.js +0 -1
  120. package/dist/assets/Library-B67zZRsd.js +0 -1
  121. package/dist/assets/Locations-HaHa_Fsr.js +0 -3
  122. package/dist/assets/MyAccess-CvUaUk6O.js +0 -2
  123. package/dist/assets/Notifications-DDmcZBvb.js +0 -1
  124. package/dist/assets/Recordings-DDufOAKc.js +0 -1
  125. package/dist/assets/SessionsList-DJQsiJpZ.js +0 -2
  126. package/dist/assets/Showroom-yw0GMHMG.js +0 -1
  127. package/dist/assets/System-CiRePLgR.js +0 -1
  128. package/dist/assets/circle-slash-DB409D2V.js +0 -1
  129. package/dist/assets/client-C7PU3uqv.js +0 -358
  130. package/dist/assets/crop-CpbGKQ8Q.js +0 -1
  131. package/dist/assets/device-picker-model-BtWCNPPD.js +0 -1
  132. package/dist/assets/dist-D10PjgBb.js +0 -358
  133. package/dist/assets/history-CRzL5JIS.js +0 -1
  134. package/dist/assets/i18n-DPnbeqSW.js +0 -1
  135. package/dist/assets/icons-C1hjXP2s.js +0 -1
  136. package/dist/assets/index-CN7xsFJi.css +0 -2
  137. package/dist/assets/index-P4Ykaww9.js +0 -4
  138. package/dist/assets/mount-BtWCNPPD.js +0 -1
  139. package/dist/assets/player-overlays-HaJLnfsi.js +0 -1
  140. package/dist/assets/remoteEntry-m6BFtz9i.js +0 -1
  141. package/dist/assets/src-DVZ_yCN-.js +0 -67
  142. package/dist/assets/useEventInvalidation-BtWCNPPD.js +0 -1
  143. package/dist/assets/user-round-DvLwlL_U.js +0 -1
@@ -1 +0,0 @@
1
- import{$ as e,B as t,G as n,J as r,L as i,S as a,b 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-CEHpkaJP.js";import{Ei as l,Fr as u,It as d,Jr as f,Nt as p,Wr as m,Y as h,dt as g,ea as _,or as v,ot as y,si as b,xr as x}from"./player-overlays-HaJLnfsi.js";import{Pi as S}from"./client-C7PU3uqv.js";import{n as C,t as w}from"./scissors-BlRdwWP1.js";import{$c as T,An as E,Bc as D,Fc as O,Gc as k,Ic as A,Jc as j,Ks as M,Kt as N,Lc as ee,Mn as P,Nc as te,Nn as ne,On as re,Pc as ie,Pn as ae,Qc as oe,Rc as se,Un as F,Vn as I,Wn as ce,Xc as le,Xs as ue,Yn as de,Zc as fe,_u as pe,al as me,bu as L,el as he,er as R,hs as ge,il as _e,kn as ve,nl as ye,ol as be,ps as xe,qc as Se,qt as Ce,rl as we,sl as Te,tl as Ee,vr as z,xr as De,xs as Oe,ya as B,ys as ke,zc as Ae}from"./src-DVZ_yCN-.js";import{t as V}from"./i18n-DPnbeqSW.js";import{t as H}from"./useTranslation-D3Is_4B6.js";import{T as je,Z as Me,j as Ne}from"./index-P4Ykaww9.js";import{t as Pe}from"./AdminSectionedPage-Dh0h99mU.js";import{n as Fe}from"./authed-media-D_mDMacH.js";import{t as U}from"./format-size-DIxKXxtj.js";import{c as Ie,i as Le,l as Re,n as ze,o as Be,r as Ve,s as He,t as Ue,u as We}from"./location-owned-usage-BWKIfwEv.js";e();var Ge=[{value:`all`,labelKey:`common.all`},{value:`recording`,labelKey:`recordings.activitySection.domainRecordings`},{value:`events`,labelKey:`common.events`}],Ke={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},qe={columnKey:`at`,dir:`desc`};function Je(e){return new Date(e).toLocaleString()}function Ye(){let{t:e,i18n:t}=H(),[i,s]=r(`all`),{data:l,isLoading:u,isError:d}=O({},{refetchOnWindowFocus:!1}),{data:f,isLoading:m,isError:h}=ke({},{refetchOnWindowFocus:!1}),{data:g}=B({isCamera:!0,projection:`slim`}),y=n(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.name);return e},[g]),b=n(()=>{let e=[...l??[],...f??[]];return(i===`all`?e:e.filter(e=>e.domain===i)).toSorted((e,t)=>t.at-e.at)},[l,f,i]),x=n(()=>{let t=[];return d&&i!==`events`&&t.push(e(`recordings.activitySection.domainRecordings`)),h&&i!==`recording`&&t.push(e(`common.events`)),t},[d,h,i,e]),S=n(()=>new Intl.ListFormat(t.language,{type:`conjunction`}).format(x),[x,t.language]),C=n(()=>[{key:`at`,header:e(`recordings.activitySection.when`,`When`),nowrap:!0,sortValue:e=>e.at,render:e=>c(`span`,{className:`text-foreground-subtle tabular-nums`,children:Je(e.at)})},{key:`domain`,header:e(`recordings.activitySection.domain`,`Domain`),sortValue:e=>e.domain,render:e=>c(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${Ke[e.domain]}`,children:e.domain})},{key:`op`,header:e(`recordings.activitySection.operation`,`Operation`),sortValue:e=>e.op,render:e=>c(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:e(`recordings.activitySection.reason`,`Reason`),sortValue:e=>e.reason,render:e=>c(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:e(`recordings.activitySection.camera`,`Camera`),sortValue:e=>e.deviceId===null?`cluster`:y.get(e.deviceId)??`#${String(e.deviceId)}`,render:t=>t.deviceId===null?c(`span`,{className:`text-foreground-subtle`,children:e(`common.cluster`)}):c(`span`,{className:`text-foreground`,children:y.get(t.deviceId)??`#${String(t.deviceId)}`})},{key:`items`,header:e(`recordings.activitySection.items`,`Items`),align:`right`,nowrap:!0,sortValue:e=>e.itemsAffected,render:e=>c(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:e(`recordings.activitySection.reclaimed`,`Reclaimed`),align:`right`,nowrap:!0,sortValue:e=>e.bytesReclaimed,render:e=>c(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?U(e.bytesReclaimed):`—`})}],[y,e]),w=u||m;return a(`div`,{className:`flex flex-col gap-4`,children:[c(`div`,{className:`flex items-center gap-1`,children:Ge.map(t=>c(`button`,{onClick:()=>s(t.value),className:`rounded px-2 py-1 text-xs font-medium ${i===t.value?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-muted`}`,children:e(t.labelKey)},t.value))}),w&&b.length===0?a(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[c(v,{className:`h-4 w-4 animate-spin`}),e(`recordings.activitySection.loadingActivity`,`Loading activity…`)]}):b.length===0?x.length>0?c(I,{icon:p,title:e(`recordings.activitySection.activityCouldNotBeRead`,`Activity could not be read`),description:e(`recordings.activitySection.theOpsLogDidNot`,`The {{value1}} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`,{value1:S})}):c(I,{icon:_,title:e(`recordings.activitySection.noActivityYet`,`No activity yet`),description:e(`recordings.activitySection.pruneDeleteAndRescanOperations`,`Prune, delete and rescan operations across recordings and events show up here.`)}):a(o,{children:[x.length>0&&a(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[c(p,{className:`h-3 w-3 shrink-0`}),e(`recordings.activitySection.domainsMissing`,{count:x.length,names:S})]}),c(N,{columns:C,rows:b,rowKey:e=>e.id,minWidthPx:720,maxBodyHeight:Ce,defaultSort:qe})]})]})}e();function Xe(){let{t:e}=H(),t=B({isCamera:!0,projection:`slim`}),i=n(()=>(t.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[t.data]),[o,s]=r(null),u=o??i[0]?.id??null;return!t.isLoading&&i.length===0?c(I,{icon:l,title:e(`recordings.cameraRecordingSettingsSection.noCameras`,`No cameras`),description:e(`recordings.cameraRecordingSettingsSection.addACameraFirst`,`Add a camera first.`)}):a(`div`,{className:`space-y-3`,children:[a(`div`,{children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.cameraRecordingSettingsSection.perCameraRecordingRetention`,`Per-camera recording & retention`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.cameraRecordingSettingsSection.recordingModeScheduleBandsAnd`,`Recording mode, schedule bands and the retention policy for one camera — the same controls as the camera's own Recording tab. Retention is one policy over footage and analytics; per-camera event deletion lives on the Events tab.`)})]}),a(`div`,{className:`flex items-center gap-2`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e(`recordings.cameraRecordingSettingsSection.camera`,`Camera`)}),c(`select`,{value:u??``,onChange:e=>s(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:i.map(e=>c(`option`,{value:e.id,children:e.name},e.id))})]}),u!==null&&c(de,{deviceId:u,children:c(Ne,{deviceId:u,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},u)]})}e();function Ze({types:e}){let{t}=H(),i=s(),o=R(),{data:l}=j({}),u=Se(),d=n(()=>u.data??[],[u.data]),{data:f}=ie({},{refetchOnWindowFocus:!1}),p=n(()=>Ue(l??[],f?.locations),[l,f?.locations]),[m,h]=r(null),[g,_]=r(null),v=()=>{i.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},y=Te({onSuccess:v}),b=k({onSuccess:v}),x=n(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[l]),S=async(e,n)=>{Re(n)&&!await o({title:t(`pipeline.storageLocationsPanel.disable`,`Disable "{{displayName}}"?`,{displayName:e.displayName}),message:t(`pipeline.storageLocationsPanel.nothingIsDeletedSetThe`,`{{consequence}} Nothing is deleted — set the location back to Read-only or Active to bring its footage back.`,{consequence:Ie(n).consequence}),confirmLabel:t(`common.disable`,`Disable`),variant:`danger`})||y.mutate(He(e,{mode:n}))},C=async e=>{if(await o({title:t(`pipeline.storageLocationsPanel.deleteLocation`,`Delete location "{{displayName}}"?`,{displayName:e.displayName}),message:t(`pipeline.storageLocationsPanel.removesTheRecordFilesOn`,`Removes the record; files on disk are untouched.`),confirmLabel:t(`common.delete`,`Delete`),variant:`danger`}))try{await b.mutateAsync({id:e.id})}catch(n){await o({title:t(`pipeline.storageLocationsPanel.deleteAnyway`,`Delete anyway?`),message:t(`pipeline.storageLocationsPanel.forcingNote`,{error:n instanceof Error?n.message:String(n)}),confirmLabel:t(`pipeline.storageLocationsPanel.forceDelete`,`Force delete`),variant:`danger`})&&b.mutate({id:e.id,force:!0})}},w=e.map(e=>d.find(t=>t.id===e)).filter(e=>e!==void 0);return a(`div`,{className:`space-y-3`,children:[w.length===0?c(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:t(`pipeline.storageLocationsPanel.noStorageLocationsDeclaredFor`,`No storage locations declared for this purpose.`)}):w.map(e=>c(ze,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:x.get(e.id)??[],onAdd:e=>h(e),onEdit:e=>_(e),onDelete:e=>{C(e)},ownedBytesById:p,onSetMode:(e,t)=>{S(e,t)}},e.id)),m!==null&&c(We,{initialType:m,onClose:()=>h(null),onCreated:()=>{v(),h(null)}}),g!==null&&c(Be,{location:g,onClose:()=>_(null),onSaved:()=>{v(),_(null)}})]})}e();var W=`pipeline-analytics`;function Qe(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function $e(){let{t:e}=H(),t=s(),{nodes:r}=pe(),{data:i,isLoading:o}=z({addonId:W}),l=Qe(i),u=De({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),d=n(()=>{let e=r.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,l,...e])].filter(Boolean)},[r,l]);return a(`div`,{className:`flex flex-col gap-6`,children:[a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[c(`h3`,{className:`text-sm font-semibold text-foreground`,children:e(`pipeline.clusterEventsTab.postProcessingNode`,`Post-processing node`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`pipeline.clusterEventsTab.theSingleNodeThatRuns`,`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`)}),a(`div`,{className:`mt-3 flex items-center gap-2`,children:[o?c(v,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):c(`select`,{value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:W,patch:{postProcessingNodeId:e.target.value}})},disabled:u.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:d.map(t=>c(`option`,{value:t,children:t===`hub`?e(`pipeline.clusterEventsTab.hubDefault`,`hub (default)`):t},t))}),u.isPending&&c(v,{className:`h-4 w-4 animate-spin text-primary`})]})]}),a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[c(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:e(`pipeline.clusterEventsTab.eventsFolder`,`Events folder`)}),c(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:e(`pipeline.clusterEventsTab.whereEventCropsFullFrames`,`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`)}),c(Ze,{types:[`eventMedia`]})]})]})}e();var et=[[`pipelineAnalytics`]],tt=1440*60*1e3;function G(e,t){return t.get(e)??V.t(`recordings.eventsManagementSection.removedCamera`,{id:String(e)})}var nt=[{days:1},{days:7},{days:30},{days:90}];function rt(){let{t:e}=H(),t=s(),o=R(),[l,u]=r(30),[p,m]=r(null),{data:g,isLoading:_}=ge({},{refetchOnWindowFocus:!1}),{data:y}=B({isCamera:!0,projection:`slim`}),b=n(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),x=i(()=>{t.invalidateQueries({queryKey:et})},[t]),S=Oe({onSuccess:x}),C=xe(),T=i(async()=>{await o({title:e(`recordings.eventsManagementSection.pruneTitle`,{count:l}),message:e(`recordings.eventsManagementSection.permanentlyDeletesEveryEventMotion`,`Permanently deletes every event (motion / object / audio) older than the cutoff across all cameras, and their media. This cannot be undone.`),confirmLabel:e(`recordings.eventsManagementSection.pruneEvents`,`Prune events`),variant:`danger`})&&S.mutate({olderThanMs:Date.now()-l*tt,reason:`retention`})},[o,S,l,e]),E=i(async t=>{let n=G(t.deviceId,b);if(await o({title:e(`recordings.eventsManagementSection.deleteAllEventsFor`,`Delete all events for {{label}}?`,{label:n}),message:e(`recordings.eventsManagementSection.deleteRowsMessage`,{count:t.rows,size:U(t.bytes)}),confirmLabel:e(`recordings.eventsManagementSection.deleteEvents`,`Delete events`),variant:`danger`})){m(null);try{let e=await C.mutateAsync({deviceId:t.deviceId});x();let r=e.motion+e.object+e.audio;if(r===0&&t.bytes>0){m(`0 events deleted for ${n}. Media still listed (${U(t.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}m(`Deleted ${String(r)} event${r===1?``:`s`} for ${n}.`)}catch(e){m(e instanceof Error?e.message:String(e))}}},[o,C,b,x,e]),D=n(()=>[{key:`camera`,header:e(`recordings.eventsManagementSection.camera`,`Camera`),render:e=>c(`span`,{className:`text-foreground`,children:G(e.deviceId,b)})},{key:`rows`,header:e(`recordings.eventsManagementSection.events`,`Events`),align:`right`,nowrap:!0,render:e=>c(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:e(`recordings.eventsManagementSection.media`,`Media`),align:`right`,nowrap:!0,render:e=>c(`span`,{className:`tabular-nums`,children:U(e.bytes)})},{key:`actions`,header:``,align:`right`,render:t=>a(`button`,{onClick:()=>{E(t)},disabled:C.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:e(`recordings.eventsManagementSection.deleteAllEventsForThis`,`Delete all events for this camera`),children:[c(d,{className:`h-3 w-3`}),e(`common.delete`,`Delete`)]})}],[b,E,C.isPending,e]);return _&&!g?a(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[c(v,{className:`h-4 w-4 animate-spin`}),e(`recordings.eventsManagementSection.loadingEventStoreFootprint`,`Loading event-store footprint…`)]}):g?a(`div`,{className:`flex flex-col gap-6`,children:[a(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[c(h,{label:e(`recordings.eventsManagementSection.totalEvents`,`Total events`),icon:c(f,{className:`h-3 w-3`}),footer:`across ${String(g.devices.length)} camera${g.devices.length===1?``:`s`}`,children:g.totalRows.toLocaleString()}),c(h,{label:e(`recordings.eventsManagementSection.eventMediaOnDisk`,`Event media on disk`),children:U(g.totalBytes)})]}),a(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[c(`span`,{className:`text-foreground-subtle`,children:e(`recordings.eventsManagementSection.pruneEventsOlderThan`,`Prune events older than`)}),c(`select`,{value:l,onChange:e=>u(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:nt.map(t=>c(`option`,{value:t.days,children:e(`recordings.eventsManagementSection.ageDays`,{count:t.days})},t.days))}),a(`button`,{onClick:()=>{T()},disabled:S.isPending,className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs font-medium text-foreground-subtle hover:bg-warning/10 hover:text-warning disabled:opacity-50`,children:[S.isPending?c(v,{className:`h-3 w-3 animate-spin`}):c(w,{className:`h-3 w-3`}),e(`recordings.eventsManagementSection.pruneNow`,`Prune now`)]})]}),g.devices.length===0?c(I,{icon:f,title:e(`recordings.eventsManagementSection.noStoredEvents`,`No stored events`),description:e(`recordings.eventsManagementSection.noCameraHasPersistedEvents`,`No camera has persisted events yet.`)}):c(N,{columns:D,rows:[...g.devices],rowKey:e=>e.deviceId,minWidthPx:480}),p===null?null:c(`p`,{className:p.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:p})]}):c(I,{icon:f,title:e(`recordings.eventsManagementSection.noEventData`,`No event data`),description:e(`recordings.eventsManagementSection.pipelineAnalyticsHasNotReported`,`Pipeline analytics has not reported any event-store footprint yet.`)})}function it(){let{t:e}=H();return a(`div`,{className:`flex flex-col gap-8`,children:[a(`div`,{children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.eventsSection.eventStore`,`Event store`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.eventsSection.whatTheDurableEventStore`,`What the durable event store occupies, per camera, with fleet-wide prune-by-age and delete-all-events.`)}),c(`div`,{className:`mt-3`,children:c(rt,{})})]}),a(`div`,{children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.eventsSection.postProcessingNodeFolders`,`Post-processing node & folders`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.eventsSection.theSingleNodeThatWrites`,`The single node that writes event crops, and the storage location they land in.`)}),c(`div`,{className:`mt-3`,children:c($e,{})})]})]})}function at(e){let t=[];return e.timelapse?t.push(`timelapse ${String(e.timelapse.everyMs/1e3)}s`):(t.push(`${String(e.speed??1)}×`),e.includeAudio&&t.push(`+ audio`)),t.join(` `)}function ot(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function st(e,t){let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=r>0?`${String(r)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`:`${String(i)}:${String(a).padStart(2,`0`)}`;return`${ot(e)} · ${o}`}function ct(e,t){let n=e-t;if(n<=0)return V.t(`helpers.exportFormat.expired`);let r=Math.floor(n/6e4);if(r<60)return V.t(`helpers.exportFormat.inMinutes`,{n:String(r)});let i=Math.floor(r/60);return i<24?V.t(`helpers.exportFormat.inHours`,{n:String(i)}):V.t(`helpers.exportFormat.inDays`,{n:String(Math.floor(i/24))})}function lt(e,t,n,r){return e.map(e=>{if(e.state===`expired`||e.state===`deleted`)return e;let i=r.get(e.id);if(i)return{...e,state:`failed`,error:i.error,progressPct:null};let a=n.get(e.id);if(a)return{...e,state:`ready`,fileBytes:a.fileBytes,progressPct:100};let o=t.get(e.id);return o&&(e.state===`queued`||e.state===`rendering`)?{...e,state:`rendering`,progressPct:o.progressPct}:e})}e();var ut=[`high`,`mid`,`low`],dt=[{value:1,labelKey:`recordings.newExportModal.speedRealTime`},{value:2,labelKey:null},{value:4,labelKey:null},{value:8,labelKey:null},{value:16,labelKey:null}],ft=10080*60*1e3;function K(e){let t=new Date(Date.now()-e*6e4),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function pt({onClose:e,onCreated:t}){let{t:i}=H(),o=B({isCamera:!0,projection:`slim`}),s=n(()=>(o.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[o.data]),[l,d]=r(``),[f,p]=r(`high`),[m,h]=r(K(60)),[g,_]=r(K(0)),[v,y]=r(1),[b,x]=r(!0),[S,C]=r(``),[w,T]=r(null),D=l===``?s[0]?.id??null:l,O=new Date(m).getTime(),k=new Date(g).getTime(),A=Number.isFinite(O)&&Number.isFinite(k)&&O<k,j=se({onSuccess:()=>{t(),e()},onError:e=>T(e instanceof Error?e.message:String(e))});return c(re,{open:!0,onOpenChange:t=>!t&&e(),children:a(E,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[c(ne,{children:a(ae,{className:`flex items-center gap-1.5`,children:[c(u,{className:`h-3.5 w-3.5`}),i(`recordings.newExportModal.newExport`,`New export`)]})}),a(ve,{className:`space-y-3`,children:[a(`div`,{className:`grid grid-cols-2 gap-3`,children:[a(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`recordings.newExportModal.camera`,`Camera`)}),c(`select`,{value:D??``,onChange:e=>d(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:s.map(e=>c(`option`,{value:e.id,children:e.name},e.id))})]}),a(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`recordings.newExportModal.profile`,`Profile`)}),c(`select`,{value:f,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:ut.map(e=>c(`option`,{value:e,children:e},e))})]})]}),a(`div`,{className:`grid grid-cols-2 gap-3`,children:[a(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`recordings.newExportModal.from`,`From`)}),c(`input`,{type:`datetime-local`,value:m,onChange:e=>h(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]}),a(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`recordings.newExportModal.to`,`To`)}),c(`input`,{type:`datetime-local`,value:g,onChange:e=>_(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]})]}),a(`div`,{className:`grid grid-cols-2 gap-3`,children:[a(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`recordings.newExportModal.speed`,`Speed`)}),c(`select`,{value:v,onChange:e=>y(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:dt.map(e=>c(`option`,{value:e.value,children:e.labelKey===null?`${e.value}×`:i(e.labelKey)},e.value))})]}),a(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`recordings.newExportModal.titleOptional`,`Title (optional)`)}),c(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:i(`recordings.newExportModal.eGCourierAtThe`,`e.g. courier at the gate`),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle`})]})]}),a(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[c(`input`,{type:`checkbox`,checked:b,disabled:v!==1,onChange:e=>x(e.target.checked),className:`accent-primary`}),i(v===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!A&&c(`p`,{className:`text-[11px] text-danger`,children:i(`recordings.newExportModal.fromMustBeBeforeTo`,`"From" must be before "To".`)}),w&&c(`p`,{className:`text-[11px] text-danger`,children:w})]}),a(P,{children:[c(F,{variant:`outline`,size:`sm`,onClick:e,children:i(`common.cancel`,`Cancel`)}),c(F,{size:`sm`,onClick:()=>{if(D===null||!A)return;T(null);let e=S.trim();j.mutate({deviceId:D,profile:f,fromMs:O,toMs:k,options:{includeAudio:b,maxLifeMs:ft,deleteAfterDownload:!1,...v===1?{}:{speed:v},...e.length>0?{title:e}:{}}})},disabled:D===null||!A||j.isPending,children:j.isPending?i(`recordings.newExportModal.queuing`,`Queuing…`):i(`recordings.newExportModal.createExport`,`Create export`)})]})]})})}e();var mt=[[`recordingExport`]],ht={queued:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.queued`},rendering:{cls:`bg-primary/10 text-primary`,labelKey:`recordings.exportsSection.rendering`,spin:!0},ready:{cls:`bg-success/10 text-success`,labelKey:`recordings.exportsSection.ready`},failed:{cls:`bg-danger/10 text-danger`,labelKey:`recordings.exportsSection.failed`},expired:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.expired`},deleted:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.deleted`}};function gt(){let{data:e,isLoading:t}=D({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:r}=L(S.RecordingExportProgress,e=>e.exportId),{map:i}=L(S.RecordingExportCompleted,e=>e.exportId),{map:a}=L(S.RecordingExportFailed,e=>e.exportId);return{rows:n(()=>lt(e??[],r,i,a),[e,r,i,a]),isLoading:t}}function _t(e){let[n,i]=r(()=>Date.now());return t(()=>{let t=setInterval(()=>i(Date.now()),e);return()=>clearInterval(t)},[e]),n}function vt(){let{t:e}=H(),t=s(),[o,l]=r(!1),f=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},p=R(),h=y().trpcClient,g=_t(6e4),{rows:_,isLoading:x}=gt(),{data:S}=B({isCamera:!0,projection:`slim`}),C=n(()=>{let e=new Map;for(let t of S??[])e.set(t.id,t.name);return e},[S]),w=i(()=>{t.invalidateQueries({queryKey:mt})},[t]),T=ee({onSuccess:w}),E=Ae({onSuccess:w}),[D,O]=r(null),k=i(async e=>{O(e.id);try{let{url:t}=await h.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await Fe(t),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.options.title??e.id}.mp4`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),w()}finally{O(null)}},[h,w]),A=i(async t=>{await p({title:e(`recordings.exportsSection.cancelThisExport`,`Cancel this export?`),message:e(`recordings.exportsSection.stopsTheRenderThePartial`,`Stops the render. The partial file is discarded.`),confirmLabel:e(`recordings.exportsSection.cancelExport`,`Cancel export`),variant:`danger`})&&T.mutate({exportId:t.id})},[p,T,e]),j=i(async t=>{await p({title:e(`recordings.exportsSection.deleteThisExport`,`Delete this export?`),message:e(`recordings.exportsSection.permanentlyRemovesTheRenderedFile`,`Permanently removes the rendered file and its history row.`),confirmLabel:e(`common.delete`,`Delete`),variant:`danger`})&&E.mutate({exportId:t.id})},[p,E,e]),M=n(()=>[{key:`camera`,header:e(`recordings.exportsSection.camera`,`Camera`),render:e=>c(`span`,{className:`text-foreground`,children:C.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:e(`recordings.exportsSection.range`,`Range`),nowrap:!0,render:e=>c(`span`,{className:`tabular-nums`,children:st(e.fromMs,e.toMs)})},{key:`variant`,header:e(`recordings.exportsSection.variant`,`Variant`),render:e=>c(`span`,{className:`text-foreground-subtle`,children:at(e.options)})},{key:`state`,header:e(`recordings.exportsSection.state`,`State`),render:t=>{let n=ht[t.state];return a(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${n.cls}`,children:[n.spin&&c(v,{className:`h-2.5 w-2.5 animate-spin`}),e(n.labelKey),t.state===`rendering`&&t.progressPct!==null&&a(`span`,{className:`tabular-nums`,children:[t.progressPct,`%`]})]})}},{key:`expiry`,header:e(`recordings.exportsSection.expires`,`Expires`),nowrap:!0,render:e=>e.state===`deleted`?c(`span`,{className:`text-foreground-subtle`,children:`—`}):c(`span`,{className:`text-foreground-subtle tabular-nums`,children:ct(e.expiresAt,g)})},{key:`size`,header:e(`recordings.exportsSection.size`,`Size`),align:`right`,nowrap:!0,render:e=>c(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:U(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:t=>{let n=t.state===`ready`,r=t.state===`queued`||t.state===`rendering`,i=t.state!==`deleted`;return a(`div`,{className:`flex items-center justify-end gap-1`,children:[n&&a(`button`,{onClick:()=>{k(t)},disabled:D===t.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-primary/10 hover:text-foreground disabled:opacity-50`,title:e(`recordings.exportsSection.downloadMp4`,`Download MP4`),children:[D===t.id?c(v,{className:`h-3 w-3 animate-spin`}):c(m,{className:`h-3 w-3`}),e(`recordings.exportsSection.download`,`Download`)]}),r&&a(`button`,{onClick:()=>{A(t)},disabled:T.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,title:e(`recordings.exportsSection.cancelRender`,`Cancel render`),children:[c(b,{className:`h-3 w-3`}),e(`common.cancel`,`Cancel`)]}),i&&c(`button`,{onClick:()=>{j(t)},disabled:E.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:e(`recordings.exportsSection.deleteExport`,`Delete export`),children:c(d,{className:`h-3 w-3`})})]})}}],[C,g,D,T.isPending,E.isPending,k,A,j,e]);return x&&_.length===0?a(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[c(v,{className:`h-4 w-4 animate-spin`}),e(`recordings.exportsSection.loadingExports`,`Loading exports…`)]}):a(`div`,{className:`space-y-3`,children:[c(`div`,{className:`flex justify-end`,children:a(`button`,{onClick:()=>l(!0),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground`,children:[c(u,{className:`h-3.5 w-3.5`}),e(`recordings.exportsSection.newExport`,`New export`)]})}),_.length===0?c(I,{icon:u,title:e(`recordings.exportsSection.noExportsYet`,`No exports yet`),description:e(`recordings.exportsSection.createOneHereNewExport`,`Create one here (New export) or from a camera's timeline in the viewer. Rendered clips show up here to download or manage.`)}):c(N,{columns:M,rows:_,rowKey:e=>e.id,minWidthPx:720}),o&&c(pt,{onClose:()=>l(!1),onCreated:f})]})}var yt=`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`;e();var bt=`storage-migration`,xt=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function St(e){return[`${e.orphansReclaimed} orphan rows (${U(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${U(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${U(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function Ct(){let{t:e}=H(),t=ce(bt);return t===`pending`?null:t===`unknown`?c(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:e(`recordings.cleanupSection.couldNotCheckWhetherStorage`,`Could not check whether storage cleanup is installed on this hub.`)}):t===`present`?c(wt,{}):null}function wt(){let{t:e}=H(),t=R(),[n,i]=r(!1),[o,s]=r(null),l=T({},{refetchInterval:2e3}),u=l.data??null,f=u!==null&&xt.has(u.phase),p=oe(),m=fe(),h=async()=>{if(await t({title:e(`recordings.cleanupSection.runStorageCleanup`,`Run storage cleanup?`),message:n?e(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd`,`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`):e(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd2`,`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`),confirmLabel:e(`recordings.cleanupSection.runCleanup`,`Run cleanup`),variant:`danger`})){s(null);try{await p.mutateAsync({includeDebugMedia:n}),await l.refetch()}catch(e){s(e instanceof Error?e.message:String(e))}}},g=async()=>{if(u&&await t({title:e(`recordings.cleanupSection.cancelCleanup`,`Cancel cleanup?`),message:e(`recordings.cleanupSection.stopsAfterTheCurrentStep`,`Stops after the current step. Work already done stays done.`),confirmLabel:e(`recordings.cleanupSection.cancelCleanup2`,`Cancel cleanup`),variant:`danger`}))try{await m.mutateAsync({jobId:u.jobId}),await l.refetch()}catch{}};return a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.cleanupSection.cleanup`,`Cleanup`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.cleanupSection.onePassOverLeftoverAnalytics`,`One pass over leftover analytics (database + files) and ghost footage rows on frozen locations. Does not time out — progress updates here until it finishes.`)}),a(`label`,{className:`mt-3 flex items-start gap-2 text-[11px] text-foreground`,children:[c(`input`,{type:`checkbox`,checked:n,disabled:f,onChange:e=>{i(e.target.checked)},className:`mt-0.5 h-3.5 w-3.5 accent-primary`}),c(`span`,{children:e(`recordings.cleanupSection.alsoRemoveDebugMediaMotion`,`Also remove debug media (motion stills and track filmstrips)`)})]}),a(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[a(`button`,{type:`button`,disabled:f||p.isPending,onClick:()=>{h()},className:yt,children:[(f||p.isPending)&&c(v,{className:`h-3 w-3 animate-spin`}),c(d,{className:`h-3 w-3`}),e(`recordings.cleanupSection.runCleanup`,`Run cleanup`)]}),f&&c(`button`,{type:`button`,onClick:()=>{g()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:e(`common.cancel`,`Cancel`)})]}),o&&c(`p`,{className:`mt-2 text-[11px] text-danger`,children:o}),u&&a(`div`,{className:`mt-3 space-y-1 rounded-md border border-border px-2.5 py-2`,children:[a(`p`,{className:`text-xs text-foreground`,children:[e(`recordings.cleanupSection.phase`,`Phase:`),` `,c(`span`,{className:`font-medium`,children:u.phase}),f&&c(v,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),u.detail&&c(`p`,{className:`text-[11px] text-foreground-subtle`,children:u.detail}),c(`p`,{className:`text-[11px] text-foreground-subtle`,children:St(u)}),u.error&&c(`p`,{className:`text-[11px] text-danger`,children:u.error})]})]})}e();var Tt=2e3;function Et(){let{t:e}=H(),n=R(),r=s(),i=ue(),o=M(void 0,{refetchInterval:e=>e.state.data?.state===`running`?Tt:!1}),l=o.data,u=l?.state===`running`,d=u||i.isPending;t(()=>{l?.state!==`done`||l.finishedAtMs===null||(r.invalidateQueries({queryKey:[[`recording`]]}),r.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[l?.state,l?.finishedAtMs,r]);let f=async()=>{await n({title:e(`recordings.diskReconcileSection.reconcileStorageFromDisk`,`Reconcile storage from disk?`),message:e(`recordings.diskReconcileSection.makesTheDatabaseMatchThe`,`Makes the database match the filesystem: recordings index, tracks, events and media whose files are gone. Favourited tracks without files are deleted. Snapshot-less motion/audio events are deleted. Enrolled identities stay. This cannot be undone.`),confirmLabel:e(`recordings.diskReconcileSection.reconcile`,`Reconcile`),variant:`warning`})&&(await i.mutateAsync(),await o.refetch())},p=u?l.total>0?`Reconciling ${String(l.completed)}/${String(l.total)}…`:`Reconciling…`:i.isPending?`Reconciling…`:`Reconcile from disk`;return a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[c(`h3`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.diskReconcileSection.diskReconcile`,`Disk reconcile`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.diskReconcileSection.deletesDatabaseRowsWhoseFiles`,`Deletes database rows whose files are gone. Enrolled identities stay.`)}),a(`div`,{className:`mt-3 flex flex-col gap-2`,children:[a(`button`,{type:`button`,onClick:()=>void f(),disabled:d,className:`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[d?c(v,{className:`h-3.5 w-3.5 animate-spin`}):c(x,{className:`h-3.5 w-3.5`}),p]}),l?.state===`done`?a(`p`,{className:`text-[11px] text-foreground-subtle`,children:[e(`recordings.diskReconcileSection.lastRun`,`Last run:`),` `,e(`recordings.diskReconcileSection.summary`,{completed:String(l.completed),tracks:String(l.tracks),events:String(l.events),media:String(l.mediaDropped)}),l.failed.length>0?e(`recordings.diskReconcileSection.failed`,`, {{value1}} failed ({{value2}})`,{value1:String(l.failed.length),value2:l.failed.join(`, `)}):``,`.`]}):null,l?.state===`error`&&l.error!==null?a(`p`,{className:`text-[11px] text-destructive`,children:[e(`recordings.diskReconcileSection.reconcileFailed`,`Reconcile failed:`),` `,l.error]}):null]})]})}var q=1e3,J=60*q,Y=60*J;function X(e){return e.toLocaleString(`en-US`)}function Dt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=Y){let t=Math.floor(e/Y),n=Math.round(e%Y/J);return`${t.toString()}h ${n.toString()}m`}if(e>=J){let t=Math.floor(e/J),n=Math.round(e%J/q);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/q)).toString()}s`}function Ot(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${X(e.filesMoved)} files`:`${X(e.filesMoved)} / ${X(e.filesTotal)} files`,r=e.filesTotal===null||e.filesTotal===0?null:Math.min(1,e.filesMoved/e.filesTotal),i=t>0&&e.filesMoved>0,a=i?`${U(e.bytesMoved/t*q)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${Dt(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${U(e.bytesMoved)} moved`,rate:a,eta:s}}function kt(e){let t=Ot(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}e();var At=`storage-migration`,Z=[{id:`recordings`,labelKey:`recordings.storageMigrationSection.classRecordings`,locationType:`recordings`},{id:`recordingsLow`,labelKey:`recordings.storageMigrationSection.classRecordingsLow`,locationType:`recordingsLow`},{id:`eventMedia`,labelKey:`recordings.storageMigrationSection.classEventMedia`,locationType:`eventMedia`}],jt=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function Mt(){let{t:e}=H(),t=ce(At);return t===`pending`?a(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[c(v,{className:`h-4 w-4 animate-spin`}),e(`migration.storageMigrationSection.checkingWhetherStorageMigrationIs`,`Checking whether storage migration is installed…`)]}):t===`unknown`?c(I,{icon:p,title:e(`migration.storageMigrationSection.couldnTCheckWhetherStorage`,`Couldn't check whether storage migration is installed`),description:e(`migration.storageMigrationSection.theCapabilityRegistryDidNot`,`The capability registry did not answer, so this panel has nothing to report either way — it is not a statement that the capability is missing. Reload to ask again.`)}):t===`absent`?c(I,{icon:C,title:e(`migration.storageMigrationSection.storageMigrationNotInstalled`,`Storage migration not installed`),description:e(`migration.storageMigrationSection.theCapabilityRegistryAnsweredNo`,`The capability registry answered: no addon in this cluster provides storage-migration. Once one is deployed, this panel moves recordings, low-res recordings and event media to new storage locations in one coordinated, verified operation.`)}):c(Nt,{})}function Nt(){let{t:e}=H(),t=R(),{data:i}=j({}),[o,s]=r({}),[l,u]=r({}),[d,f]=r(null),[p,m]=r(null),h=n(()=>{let e=new Map;for(let t of i??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[i]),_=n(()=>{let e=new Map;for(let t of i??[]){if(t.enabled===!1)continue;let n=e.get(t.type);n?n.push(t.id):e.set(t.type,[t.id])}let t=new Map;for(let[n,r]of e)r.length===1&&t.set(n,r[0]);return t},[i]),y=be({},{refetchInterval:2e3}),b=y.data??null,x=b!==null&&jt.has(b.phase),S=n(()=>{let e={};for(let t of Z){let n=o[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[o]),w=n(()=>{let e={};for(let t of Z){if(!o[t.id])continue;let n=l[t.id]??_.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[o,l,_]),T=n(()=>({destinations:S??{},...w?{sources:w}:{}}),[S,w]),E=we(T,{enabled:!1,retry:!1}),D=me(),O=le(),k=async()=>{if(!S)return;m(null);let e=await E.refetch();if(e.error){m(e.error instanceof Error?e.error.message:String(e.error));return}f(e.data??null)},A=async()=>{if(S&&await t({title:e(`migration.storageMigrationSection.startStorageMigration`,`Start storage migration?`),message:e(`migration.storageMigrationSection.copiesTheSelectedClassesFrom`,`Copies the selected classes from the chosen source to the destination, verifies, then either makes the destination the default (if the source was) or disables the source. Safe to re-run if interrupted.`),confirmLabel:e(`migration.storageMigrationSection.startMigration`,`Start migration`),variant:`danger`})){m(null);try{await D.mutateAsync(T),f(null),await y.refetch()}catch(e){m(e instanceof Error?e.message:String(e))}}},M=async()=>{if(b&&await t({title:e(`migration.storageMigrationSection.cancelMigration`,`Cancel migration?`),message:e(`migration.storageMigrationSection.stopsTheInProgressMigration`,`Stops the in-progress migration. Data already moved and verified stays at the destination; anything already repointed is not reverted.`),confirmLabel:e(`migration.storageMigrationSection.cancelMigration2`,`Cancel migration`),variant:`danger`}))try{await O.mutateAsync({jobId:b.jobId}),await y.refetch()}catch{}};return a(`div`,{className:`flex flex-col gap-6`,children:[a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[a(`h3`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[c(C,{className:`h-3.5 w-3.5`}),e(`migration.storageMigrationSection.storageMigration`,`Storage migration`)]}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`migration.storageMigrationSection.moveRecordingsLowResRecordings`,`Move recordings, low-res recordings and/or event media from one location to another: copies via the recorder / pipeline-analytics movers, verifies, then either repoints the default (when the source was the default) or disables the source (when it was not). Skip a class with an empty destination.`)}),c(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:Z.map(t=>{let n=h.get(t.locationType)??[],r=_.get(t.locationType)??``;return a(`div`,{className:`space-y-2`,children:[c(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e(t.labelKey)}),a(`div`,{className:`space-y-1`,children:[c(`label`,{htmlFor:`migration-from-${t.id}`,className:`text-[10px] text-foreground-subtle`,children:e(`recordings.storageMigrationSection.classFrom`,{label:e(t.labelKey)})}),c(`select`,{id:`migration-from-${t.id}`,value:l[t.id]??r,onChange:e=>{let n=e.target.value;u(e=>({...e,[t.id]:n}))},disabled:x,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:n.map(t=>a(`option`,{value:t.id,children:[t.displayName,t.enabled===!1?` (${e(`recordings.storageMigrationSection.readOnly`)})`:``]},t.id))})]}),a(`div`,{className:`space-y-1`,children:[c(`label`,{htmlFor:`migration-dest-${t.id}`,className:`text-[10px] text-foreground-subtle`,children:e(`recordings.storageMigrationSection.classTo`,{label:e(t.labelKey)})}),a(`select`,{id:`migration-dest-${t.id}`,value:o[t.id]??``,onChange:e=>{let n=e.target.value;s(e=>({...e,[t.id]:n}))},disabled:x,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:[c(`option`,{value:``,children:e(`migration.storageMigrationSection.skip`,`— skip —`)}),n.map(e=>c(`option`,{value:e.id,children:e.displayName},e.id))]})]})]},t.id)})}),p&&c(`p`,{className:`mt-2 text-[11px] text-danger`,children:p}),a(`div`,{className:`mt-3 flex items-center gap-2`,children:[a(`button`,{type:`button`,onClick:()=>{k()},disabled:!S||E.isFetching||x,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[E.isFetching&&c(v,{className:`h-3 w-3 animate-spin`}),e(`migration.storageMigrationSection.plan`,`Plan`)]}),a(`button`,{type:`button`,onClick:()=>{A()},disabled:!S||D.isPending||x,className:`inline-flex items-center gap-1.5 rounded bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[D.isPending&&c(v,{className:`h-3 w-3 animate-spin`}),e(`migration.storageMigrationSection.startMigration`,`Start migration`)]})]}),d&&c(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:d.moves.length===0?c(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:e(`migration.storageMigrationSection.nothingToMoveSelectedDestinations`,`Nothing to move — selected destinations match the current defaults.`)}):d.moves.map(e=>a(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]},`${e.storageClass}-${e.toLocationId}`))}),b&&a(`div`,{className:`mt-4 border-t border-border pt-3`,children:[a(`div`,{className:`flex items-center justify-between`,children:[c(`h4`,{className:`text-xs font-semibold text-foreground`,children:e(`migration.storageMigrationSection.migrationStatus`,`Migration status`)}),x&&a(`button`,{type:`button`,onClick:()=>{M()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:[c(g,{className:`h-3 w-3`}),e(`common.cancel`,`Cancel`)]})]}),a(`p`,{className:`mt-1 text-xs text-foreground`,children:[e(`migration.storageMigrationSection.phase`,`Phase:`),` `,c(`span`,{className:`font-medium`,children:b.phase}),x&&c(v,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),b.error&&c(`p`,{className:`mt-1 text-[11px] text-danger`,children:b.error}),b.pausedParticipants.length>0&&a(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[e(`migration.storageMigrationSection.paused`,`Paused:`),` `,b.pausedParticipants.join(`, `)]}),c(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:b.moves.map(e=>c(Pt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),c(Ft,{})]}),c(It,{running:x}),c(Rt,{})]})}function Pt({move:e}){let{t}=H(),n=e.progress===null?null:Ot(e.progress);return a(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[a(`div`,{className:`flex items-center justify-between`,children:[a(`span`,{className:`text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]}),a(`span`,{className:`text-foreground-subtle`,children:[e.state??t(`common.pending`),e.error?` (${e.error})`:``]})]}),e.progress!==null&&a(`div`,{className:`mt-1 space-y-1`,children:[n!==null&&n.fraction!==null&&c(`div`,{className:`h-1 w-full overflow-hidden rounded bg-border`,children:c(`div`,{className:`h-full bg-primary`,style:{width:`${(n.fraction*100).toFixed(1)}%`}})}),c(`p`,{className:`text-[10px] text-foreground-subtle`,children:kt(e.progress)})]})]})}function Ft(){let{t:e}=H(),{data:t}=Ee({});return!t||t.length===0?null:a(`div`,{className:`mt-4 border-t border-border pt-3`,children:[c(`h4`,{className:`text-xs font-semibold text-foreground`,children:e(`migration.storageMigrationSection.migrationHistory`,`Migration history`)}),c(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:t.map(e=>a(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:[c(`span`,{className:`font-medium text-foreground`,children:e.phase}),` · `,Object.entries(e.destinations).filter(e=>typeof e[1]==`string`).map(([e,t])=>`${e} → ${t}`).join(`, `),` · `,new Date(e.startedAt).toLocaleString()]},e.jobId))})]})}function It({running:e}){let{t}=H(),n=R(),i=_e({},{staleTime:1/0,refetchOnWindowFocus:!1}),o=he(),[s,l]=r(null),u=i.data??[];if(u.length===0)return null;let d=async e=>{if(await n({title:t(`migration.storageMigrationSection.drainRemaining`,`Drain remaining {{storageClass}}?`,{storageClass:e.storageClass}),message:`Moves what is still on ${e.fromLocationId} to ${e.toLocationId}. Nothing is paused and no default is changed — this is the second half of a migration, run on its own. It is resumable: cancelling leaves everything readable from both locations.`,confirmLabel:t(`migration.storageMigrationSection.drainRemaining2`,`Drain remaining`),variant:`danger`})){l(null);try{await o.mutateAsync({classes:[e.storageClass]}),await i.refetch()}catch(e){l(e instanceof Error?e.message:String(e))}}};return a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[a(`div`,{className:`flex items-start justify-between gap-2`,children:[c(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(`migration.storageMigrationSection.leftOnTheOldLocation`,`Left on the old location`)}),a(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c(`span`,{className:`text-[10px] text-foreground-subtle`,children:i.dataUpdatedAt>0?t(`migration.storageMigrationSection.measured`,`Measured {{value1}}`,{value1:new Date(i.dataUpdatedAt).toLocaleTimeString()}):t(`migration.storageMigrationSection.measuredNever`,`Measured — never`)}),c(`button`,{type:`button`,onClick:()=>{i.refetch()},disabled:i.isFetching,className:`rounded border border-border px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`,children:i.isFetching?t(`migration.storageMigrationSection.counting`,`Counting…`):t(`common.refresh`,`Refresh`)})]})]}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`migration.storageMigrationSection.aMigrationRepointsFirstAnd`,`A migration repoints first and drains behind. If the drain was cancelled, failed, or was interrupted by a restart, the data below is still on the source — readable, but not where the defaults now point. Draining moves it; it changes no default and pauses nothing.`)}),c(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:t(`migration.storageMigrationSection.thisCountIsTakenOn`,`This count is taken on demand: measuring it walks the whole media collection, so it is not refreshed on a timer. Press Refresh after a drain finishes.`)}),s&&c(`p`,{className:`mt-2 text-[11px] text-danger`,children:s}),c(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:u.map(n=>a(`div`,{className:`flex items-center justify-between gap-2 px-2.5 py-1.5 text-[11px]`,children:[a(`span`,{className:`text-foreground`,children:[n.storageClass,`: `,n.fromLocationId,` → `,n.toLocationId,c(`span`,{className:`ml-2 text-foreground-subtle`,children:Lt(n)})]}),c(`button`,{type:`button`,onClick:()=>{d(n)},disabled:e||o.isPending,className:`shrink-0 rounded border border-border px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`,children:t(`migration.storageMigrationSection.drainRemaining2`,`Drain remaining`)})]},`${n.storageClass}-${n.fromLocationId}`))})]})}function Lt(e){if(e.items===null)return V.t(`recordings.storageMigrationSection.residueUnknown`);let t=e.items.toLocaleString(`en-US`);return e.bytes===null?V.t(`recordings.storageMigrationSection.residueRows`,{count:e.items,items:t}):V.t(`recordings.storageMigrationSection.residueSegments`,{count:e.items,items:t,size:U(e.bytes)})}function Rt(){let{t:e}=H(),{data:t}=ye({},{refetchInterval:2e3}),n=(t??[]).filter(e=>e.migrationJobId===null&&e.job.state===`running`);return n.length===0?null:a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[c(`h3`,{className:`text-sm font-semibold text-foreground`,children:e(`migration.storageMigrationSection.moversRunningOutsideAMigration`,`Movers running outside a migration`)}),c(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:n.map(e=>a(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[a(`div`,{className:`text-foreground`,children:[e.lane,`: `,e.job.fromLocationId,` → `,e.job.toLocationId]}),c(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:kt({filesMoved:e.job.filesMoved,filesTotal:e.job.filesTotal,bytesMoved:e.job.bytesMoved,startedAt:e.job.startedAt,observedAt:e.observedAt})})]},e.job.jobId))})]})}function zt(){let{t:e}=H();return a(`div`,{className:`flex flex-col gap-4`,children:[c(Ct,{}),c(Et,{}),a(`section`,{children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.recordingsManagementSection.moveStorage`,`Move storage`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.recordingsManagementSection.copyRecordingsLowResRecordings`,`Copy recordings, low-res recordings or event media to a new location, verify, then repoint the default. Applies to every camera.`)}),c(`div`,{className:`mt-3`,children:c(Mt,{})})]})]})}e();var Bt=`recorder`;function Vt(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function Ht(){let{t:e}=H(),t=s(),{nodes:r}=pe(),{data:i,isLoading:o}=z({addonId:Bt}),l=Vt(i,`recordingNodeId`,`hub`),u=De({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),d=n(()=>{let e=r.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,l,...e])].filter(Boolean)},[r,l]);return a(`div`,{className:`flex flex-col gap-6`,children:[a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[c(`h3`,{className:`text-sm font-semibold text-foreground`,children:e(`pipeline.clusterRecordingTab.recordingNode`,`Recording node`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`pipeline.clusterRecordingTab.theSingleNodeThatRecords`,`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`)}),a(`div`,{className:`mt-3 flex items-center gap-2`,children:[o?c(v,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):c(`select`,{value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:Bt,patch:{recordingNodeId:e.target.value}})},disabled:u.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:d.map(t=>c(`option`,{value:t,children:t===`hub`?e(`pipeline.clusterRecordingTab.hubDefault`,`hub (default)`):t},t))}),u.isPending&&c(v,{className:`h-4 w-4 animate-spin text-primary`})]}),l!==`hub`&&c(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:c(Me,{i18nKey:`pipeline.clusterRecordingTab.hubOnlyNote`,values:{node:l},components:{b:c(`span`,{className:`font-medium`})}})})]}),a(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[c(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:e(`pipeline.clusterRecordingTab.recordingsFolders`,`Recordings folders`)}),c(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:e(`pipeline.clusterRecordingTab.whereRecordingsAreStoredMulti`,`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`)}),c(Ze,{types:[`recordings`,`recordingsLow`]})]})]})}function Ut(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Wt(e,t){let n=Ut(e);return n.length===0?V.t(`helpers.cameraDisk.defaultRoot`):n.map(e=>t.get(e)??e).join(` + `)}function Gt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Wt(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Ut(e).includes(n));return i===void 0?null:{label:Wt(i,t),exact:!1}}e();var Kt=[[`recording`]],Q=[{value:`retention`,labelKey:`recordings.storageSection.pruneRetention`},{value:`quota`,labelKey:`recordings.storageSection.pruneQuota`},{value:`operator`,labelKey:`recordings.storageSection.pruneOperator`}],qt={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Jt={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function Yt(e){return e==null?`—`:new Date(e).toLocaleString()}function Xt(e,t){let n=e.locationIds??(e.locationId===null?[]:[e.locationId]),r=n.map(e=>t.get(e)).filter(e=>e!==void 0);return r.length>0?r.join(` + `):e.root===void 0?n.length>0?n.join(` + `):V.t(`recordings.storageSection.defaultRoot`):e.root}function Zt(){let{t:e}=H(),t=s(),o=R(),[l,u]=r(`retention`),{data:f,isLoading:p}=ie({},{refetchOnWindowFocus:!1}),{data:m}=B({isCamera:!0,projection:`slim`}),{data:g}=j({}),_=n(()=>{let e=new Map;for(let t of m??[])e.set(t.id,t.name);return e},[m]),y=n(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.displayName);return e},[g]),b=n(()=>{let e=g??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[g]),S=n(()=>f?.locations??[],[f?.locations]),C=n(()=>Gt(S,y,b),[S,y,b]),T=n(()=>Le(S),[S]),E=i(()=>{t.invalidateQueries({queryKey:Kt})},[t]),D=A({onSuccess:E}),O=te({onSuccess:E}),k=i(async t=>{await o({title:e(`recordings.storageSection.prune`,`Prune {{label}}?`,{label:_.get(t.deviceId)??`#${String(t.deviceId)}`}),message:e(`recordings.storageSection.appliesTheRetentionPolicyNow`,`Applies the retention policy now (reason: {{reason}}). Footage beyond the policy is permanently deleted.`,{reason:l}),confirmLabel:e(`recordings.storageSection.pruneNow`,`Prune now`),variant:`danger`})&&D.mutate({deviceId:t.deviceId,reason:l})},[o,D,l,_,e]),M=i(async t=>{await o({title:e(`recordings.storageSection.deleteAllFootageFor`,`Delete all footage for {{label}}?`,{label:_.get(t.deviceId)??`#${String(t.deviceId)}`}),message:e(`recordings.storageSection.permanentlyDeletesOfRecordedFootage`,`Permanently deletes {{value1}} of recorded footage for this camera. This cannot be undone.`,{value1:U(t.usedBytes)}),confirmLabel:e(`recordings.storageSection.delete`,`Delete {{value1}}`,{value1:U(t.usedBytes)}),variant:`danger`})&&O.mutate({deviceId:t.deviceId})},[o,O,_,e]),ee=n(()=>[{key:`camera`,header:e(`recordings.storageSection.camera`,`Camera`),render:e=>c(`span`,{className:`text-foreground`,children:_.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:e(`recordings.storageSection.disk`,`Disk`),nowrap:!0,render:()=>C===null?c(`span`,{className:`text-foreground-subtle`,children:`—`}):a(`span`,{className:C.exact?`text-foreground`:`text-foreground-subtle`,title:C.exact?e(`recordings.storageSection.theOnlyRecordingsVolumeOn`,`The only recordings volume on this node — this camera can only be here.`):e(`recordings.storageSection.theRecordingsDefaultThisNode`,`The recordings DEFAULT. This node has several recordings volumes and the per-camera placement is not reported by recording.getStorageUsage, so this is where footage lands by default rather than a per-camera fact.`),children:[C.label,!C.exact&&c(`span`,{className:`ml-1 text-foreground-subtle`,children:e(`recordings.storageSection.default`,`(default)`)})]})},{key:`used`,header:e(`recordings.storageSection.used`,`Used`),align:`right`,nowrap:!0,render:e=>c(`span`,{className:`tabular-nums`,children:U(e.usedBytes)})},{key:`oldest`,header:e(`recordings.storageSection.oldestFootage`,`Oldest footage`),align:`right`,nowrap:!0,render:t=>c(`span`,{className:`tabular-nums text-foreground-subtle`,title:e(`recordings.storageSection.theOldestSegmentTheArchive`,`The oldest segment the ARCHIVE holds for this camera — the per-camera answer to 'is retention actually holding?'.`),children:Yt(t.oldestMs)})},{key:`actions`,header:``,align:`right`,render:t=>a(`div`,{className:`flex items-center justify-end gap-1`,children:[a(`button`,{onClick:()=>{k(t)},disabled:D.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,title:e(`recordings.storageSection.applyRetentionPolicyNow`,`Apply retention policy now`),children:[c(w,{className:`h-3 w-3`}),e(`recordings.storageSection.prune2`,`Prune`)]}),a(`button`,{onClick:()=>{M(t)},disabled:O.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:e(`recordings.storageSection.deleteAllFootage`,`Delete all footage`),children:[c(d,{className:`h-3 w-3`}),e(`common.delete`,`Delete`)]})]})}],[_,C,k,M,D.isPending,O.isPending,e]);if(p&&!f)return a(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[c(v,{className:`h-4 w-4 animate-spin`}),e(`recordings.storageSection.loadingStorageUsage`,`Loading storage usage…`)]});if(!f)return c(I,{icon:x,title:e(`recordings.storageSection.noStorageData`,`No storage data`),description:e(`recordings.storageSection.theRecordingNodeHasNot`,`The recording node has not reported any storage usage yet.`)});let P=f.devices.length;return a(`div`,{className:`flex flex-col gap-6`,children:[a(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[c(h,{label:e(`recordings.storageSection.totalUsed`,`Total used`),icon:c(x,{className:`h-3 w-3`}),footer:`${String(P)} camera${P===1?``:`s`} on ${f.nodeId}`,children:U(f.totalUsedBytes)}),T!==null&&T.severity!==null&&c(h,{label:e(`recordings.storageSection.freeOnRecordingsVolumes`,`Free on recordings volumes`),icon:c(x,{className:`h-3 w-3`}),footer:`across ${String(T.knownVolumes)} volume${T.knownVolumes===1?``:`s`} of ${U(T.totalBytes)}`+(T.unknownVolumes>0?` · ${String(T.unknownVolumes)} did not report capacity`:``),children:c(`span`,{className:`tabular-nums ${Jt[T.severity]}`,children:U(T.freeBytes)})}),S.map(t=>{let n=Ve(t),r=t.locationId??t.root??`default`;return c(h,{label:e(`recordings.storageSection.disk2`,`Disk: {{label}}`,{label:Xt(t,y)}),footer:n===null?`${U(t.usedBytes)} of recordings · volume capacity unknown`:`${U(n.freeBytes)} free of ${U(n.totalBytes)} · ${U(t.usedBytes)} recordings (${$(n.recordingsFraction)})`,children:n===null?c(`span`,{className:`tabular-nums`,children:U(t.usedBytes)}):a(`div`,{className:`flex items-center gap-2`,title:e(`recordings.storageSection.volumeFillEverythingOnThe`,`Volume fill — everything on the disk, not only recordings. Warn at 85%, critical at 95%.`),children:[c(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:c(`div`,{className:`h-full rounded ${qt[n.severity]}`,style:{width:$(n.fraction)}})}),c(`span`,{className:`tabular-nums text-xs ${Jt[n.severity]}`,children:$(n.fraction)})]})},r)})]}),a(`section`,{className:`flex items-center gap-2 text-xs`,children:[c(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:e(`recordings.storageSection.pruneReason`,`Prune reason`)}),c(`select`,{id:`prune-reason`,value:l,onChange:e=>{let t=Q.find(t=>t.value===e.target.value);t&&u(t.value)},className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:Q.map(t=>c(`option`,{value:t.value,children:e(t.labelKey)},t.value))})]}),P===0?c(I,{icon:x,title:f.devicesRead===`unavailable`?e(`recordings.storageSection.perCameraUsageUnavailable`,`Per-camera usage unavailable`):e(`recordings.storageSection.noRecordedFootage`,`No recorded footage`),description:f.devicesRead===`unavailable`?e(`recordings.storageSection.thisRecordingNodeHasNo`,`This recording node has no footage ledger, so it refused to answer the per-camera table rather than report what it happens to hold in memory. The disk totals above are unaffected.`):e(`recordings.storageSection.noCameraHasRecordedFootage`,`No camera has recorded footage on this node yet.`)}):c(N,{columns:ee,rows:[...f.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Qt(){let{t:e}=H();return a(`div`,{className:`flex flex-col gap-8`,children:[a(`div`,{children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.recordingsStorageSection.footageOnDisk`,`Footage on disk`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.recordingsStorageSection.whatRecordedFootageOccupiesPer`,`What recorded footage occupies, per camera and per volume, with prune-by-policy and delete-all-footage.`)}),c(`div`,{className:`mt-3`,children:c(Zt,{})})]}),a(`div`,{children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`recordings.recordingsStorageSection.recordingNodeFolders`,`Recording node & folders`)}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:e(`recordings.recordingsStorageSection.theSingleNodeThatRecords`,`The single node that records and serves playback, and the storage locations footage is written to.`)}),c(`div`,{className:`mt-3`,children:c(Ht,{})})]})]})}function $t(){let{t:e}=H(),t=je(`/recordings`,{t:e,isAdmin:!0})??{icon:u,title:e(`nav.recordings`,`Recordings`)};return c(Pe,{icon:t.icon,title:t.title,subtitle:e(`recordings.recordedFootageAndTheDurable`,`Recorded footage and the durable event store — what each occupies, where it is written, and the operations that move or reconcile both.`),defaultSection:`storage`,sectionsLabel:`${t.title} sections`,sections:[{id:`storage`,label:e(`recordings.recordings`,`Recordings`),content:c(Qt,{})},{id:`events`,label:e(`recordings.events`,`Events`),content:c(it,{})},{id:`cameras`,label:e(`recordings.cameras`,`Cameras`),content:c(Xe,{})},{id:`exports`,label:e(`recordings.export`,`Export`),content:c(vt,{})},{id:`activity`,label:e(`recordings.activity`,`Activity`),content:c(Ye,{})},{id:`management`,label:e(`recordings.management`,`Management`),content:c(zt,{})}]})}export{$t as RecordingsPage};
@@ -1,2 +0,0 @@
1
- import{$ as e,B as t,G as n,J as r,L as i,S as a,q as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{D as c,It as l,Rr as u,cn as d,dt as f,oa as p,or as m,ot as h,pi as g,sn as _}from"./player-overlays-HaJLnfsi.js";import{a as v,i as y,s as b}from"./video-C_Glztyb.js";import{t as x}from"./key-round-BJ8BVDGZ.js";import{An as S,Bl as C,Bn as w,It as T,Kt as ee,Lt as E,Mn as D,N as te,Nn as O,On as k,P as A,Pn as j,Rt as M,Su as N,Un as P,V as F,Wt as I,Zl as L,an as R,cr as z,er as ne,et as B,jn as V,kn as H,ln as U,lr as re,nu as ie,on as W,qt as G,rn as ae,ru as K,tr as q,uu as J,ya as oe,z as se}from"./src-DVZ_yCN-.js";import{t as Y}from"./i18n-DPnbeqSW.js";import{t as X}from"./useTranslation-D3Is_4B6.js";import{V as ce,Z as le,n as Z,t as ue}from"./index-P4Ykaww9.js";e();function de({id:e,title:t,icon:n,description:r,actions:i,tone:o=`default`,notice:l=null,onDismissNotice:u,children:d}){return s(I,{headingId:`access-${e}`,title:t,icon:n,actions:i,testId:`access-${e}`,children:a(`div`,{className:`${c} space-y-3`,children:[s(`div`,{className:J(`text-[11px] leading-relaxed`,o===`danger`?`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-foreground`:`text-foreground-subtle`),children:r}),l!==null&&s(pe,{notice:l,onDismiss:u}),d]})})}var fe={success:{icon:g,line:`border-success/30 text-foreground`,mark:`text-success`},danger:{icon:y,line:`border-danger/40 text-danger`,mark:`text-danger`}};function pe({notice:e,onDismiss:t}){let{t:n}=X(),r=fe[e.tone],i=r.icon;return a(`div`,{role:e.tone===`danger`?`alert`:`status`,className:J(`flex items-start gap-2 rounded-md border bg-surface px-3 py-2 text-[11px]`,r.line),children:[s(i,{className:J(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.mark),"aria-hidden":!0}),s(`span`,{className:`min-w-0 flex-1`,children:e.message}),t!==void 0&&s(K,{type:`button`,variant:`ghost`,size:`sm`,icon:f,"aria-label":n(`access.accessSection.dismiss`,`Dismiss`),onClick:t,className:`-my-1 h-5 w-5`})]})}function me(){let{data:e}=C();return n(()=>{let t=new Map;for(let n of e??[])t.set(n.id,n.username);return t},[e])}function he(e,t=null){return e===null?t:{tone:`danger`,message:e}}var ge={active:`access.credentialColumns.statusActive`,expired:`access.credentialColumns.statusExpired`,revoked:`access.credentialColumns.statusRevoked`,current:`access.credentialColumns.statusCurrent`};function _e(e){return Y.t(ge[e])}var ve={active:`success`,expired:`warning`,revoked:`default`,current:`info`},ye={current:0,active:1,expired:2,revoked:3};function be(e,t){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:n.toLocaleString()}function xe({status:e}){return s(z,{variant:ve[e],className:`text-[10px]`,children:_e(e)})}function Se({row:e,action:t}){if(!t.isAvailable(e))return null;let n=t.icon,r=t.busyId===e.id;return a(P,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t.onRun(e),disabled:t.disabled,"aria-label":Y.t(`access.credentialColumns.actionOn`,{action:t.label,name:e.name}),className:t.tone===`neutral`?void 0:`text-danger hover:bg-danger/10`,children:[r?s(m,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):s(n,{className:`h-3 w-3`,"aria-hidden":!0}),t.label]})}function Ce(e){return[{key:`name`,header:Y.t(`access.credentialColumns.name`,`Name`),sortValue:e=>e.name.toLowerCase(),render:e=>a(`div`,{className:`min-w-0 max-w-[18rem]`,children:[s(`div`,{className:`truncate font-medium text-foreground`,title:e.name,children:e.name}),e.detail!==null&&s(`div`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,title:e.detail,children:e.detail})]})},e.hideOwner?null:{key:`owner`,header:Y.t(`access.credentialColumns.owner`,`Owner`),sortValue:e=>e.ownerName.toLowerCase(),render:e=>e.ownerName},{key:`kind`,header:Y.t(`access.credentialColumns.kindScope`,`Kind / scope`),sortValue:e=>e.kind.toLowerCase(),nowrap:!1,render:e=>a(`div`,{className:`min-w-[8rem] max-w-[16rem]`,children:[s(`div`,{className:`text-foreground`,children:e.kind}),e.scope!==null&&s(`div`,{className:`line-clamp-2 text-[10px] text-foreground-subtle`,title:e.scope,children:e.scope})]})},{key:`status`,header:Y.t(`access.credentialColumns.status`,`Status`),sortValue:e=>ye[e.status],render:e=>s(xe,{status:e.status})},{key:`created`,header:Y.t(`access.credentialColumns.created`,`Created`),sortValue:e=>e.createdAt,render:e=>s(`span`,{className:`text-foreground-subtle`,children:be(e.createdAt,`—`)})},{key:`lastUsed`,header:Y.t(`access.credentialColumns.lastUsed`,`Last used`),sortValue:e=>e.lastUsedAt,render:e=>s(`span`,{className:`text-foreground-subtle`,children:be(e.lastUsedAt,Y.t(`access.credentialColumns.never`))})},{key:`expires`,header:Y.t(`access.credentialColumns.expires`,`Expires`),sortValue:e=>e.expiresAt,render:t=>s(`span`,{className:`text-foreground-subtle`,children:be(t.expiresAt,e.expiresNone)})},e.action===null?null:{key:`actions`,header:``,align:`right`,notSortableReason:Y.t(`access.credentialColumns.actionsHeader`),render:t=>s(`div`,{className:`flex items-center justify-end gap-1`,children:[...e.extraActions??[],e.action].map(e=>e===null?null:s(Se,{row:t,action:e},e.label))})}].filter(e=>e!==null)}e();var we=6,Te={"current-session":`access.bulk.skipCurrentSession`,"not-active":`access.bulk.skipNotActive`};function Ee(e){let t=Te[e];return t===void 0?e:Y.t(t)}function De(e,t){return Y.t(t.key,{count:e})}function Q(e,t){return Y.t(`access.bulk.countOf`,{count:e,noun:De(e,t)})}function Oe(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return[...t.entries()].map(([e,t])=>Y.t(`access.bulk.statusCount`,{count:t,status:_e(e).toLowerCase()})).join(`, `)}function ke(e,t){let n=e.slice(0,we).map(e=>`• ${e.name} — ${e.ownerName}`),r=e.length>we?[Y.t(`access.bulk.previewMore`,{count:e.length-we})]:[];return[Y.t(`access.bulk.previewIntro`,{what:Q(e.length,t),breakdown:Oe(e)}),``,...n,...r].join(`
2
- `)}async function Ae(e,t,n){let r=String(t.length),i=await e({title:Y.t(`access.bulk.confirmTitle`,{what:Q(t.length,n)}),message:ke(t,n),label:Y.t(`access.bulk.confirmLabel`,{expected:r}),placeholder:r,confirmLabel:Y.t(`access.bulk.confirmButton`,{expected:r}),variant:`danger`,validate:e=>e.trim()===r?null:Y.t(`access.bulk.confirmMismatch`,{expected:r,noun:De(2,n)})});return i!==null&&i.trim()===r}function je(e,t){let n=q(),i=N.auth.revokeCredentials.useMutation(),[a,o]=r(null);return{run:async r=>{if(r.length===0||!await Ae(n,r,e))return!1;o(null);try{let t=await i.mutateAsync({ids:r.map(e=>e.id),confirmCount:r.length}),n=t.skipped.map(e=>Ee(e.reason));return o({tone:`success`,message:n.length>0?Y.t(`access.bulk.revokedSkipped`,{what:Q(t.revoked.length,e),count:n.length,reasons:[...new Set(n)].join(`, `)}):Y.t(`access.bulk.revoked`,{what:Q(t.revoked.length,e)})}),!0}catch(e){return o({tone:`danger`,message:Y.t(`access.bulk.revokeFailed`,{error:e instanceof Error?e.message:Y.t(`access.bulk.requestFailed`)})}),!1}finally{t()}},busy:i.isPending,outcome:a,dismiss:()=>o(null)}}function Me(e,t,n){let i=q(),[a,o]=r(!1),[s,c]=r(null);return{run:async r=>{if(r.length===0||!await Ae(i,r,e))return!1;c(null),o(!0);let a=[],s=0;for(let e of r)try{await t(e.id),s+=1}catch(t){a.push(`${e.name}: ${t instanceof Error?t.message:Y.t(`access.bulk.requestFailed`)}`)}return o(!1),n(),a.length===0?(c({tone:`success`,message:Y.t(`access.bulk.revoked`,{what:Q(s,e)})}),!0):(c({tone:`danger`,message:Y.t(a.length>3?`access.bulk.eachPartialMore`:`access.bulk.eachPartial`,{what:Q(s,e),count:a.length,details:a.slice(0,3).join(`; `)})}),s>0)},busy:a,outcome:s,dismiss:()=>c(null)}}e();var Ne={searchText:e=>[e.name,e.detail??``,e.ownerName,e.kind,e.scope??``],facetGroups:[{id:`status`,value:e=>e.status},{id:`owner`,value:e=>e.ownerName},{id:`kind`,value:e=>e.kind}]},Pe={status:`access.credentialTable.groupStatus`,owner:`access.credentialTable.groupOwner`,kind:`access.credentialTable.groupKind`},Fe=e=>e.status!==`current`,Ie=[`active`,`current`];function Le({rows:e,label:t,isLoading:i,loadError:o,emptyText:c,hideOwner:l=!1,expiresNone:u,action:d,extraActions:f,bulk:p,defaultStatus:h=Ie}){let{t:g}=X(),[_]=r(()=>h.length===0?{search:``,facets:[]}:{search:``,facets:[],groups:{status:[...h]}}),v=T(e,Ne,_),[y,b]=r(()=>new Set),x=u??g(`access.credentialColumns.never`),S=n(()=>Ce({hideOwner:l,expiresNone:x,action:d??null,...f===void 0?{}:{extraActions:f}}),[l,x,d,f,g]),C=n(()=>p===void 0?()=>!1:e=>Fe(e)&&p.isSelectable(e),[p]),D=n(()=>v.rows.filter(e=>y.has(e.id)&&C(e)),[v.rows,y,C]);return i?a(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(m,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),g(`access.credentialTable.loading`,{label:t})]}):o===null?a(`div`,{className:`space-y-3`,children:[s(E,{state:v.state,facets:v.facets,groups:v.groups.filter(e=>!(l&&e.id===`owner`)).map(e=>({...e,label:Pe[e.id]===void 0?e.id:g(Pe[e.id]),...e.id===`status`?{facetLabel:e=>_e(e)}:{}})),labels:{searchPlaceholder:g(`access.credentialTable.searchPlaceholder`,{label:t}),searchLabel:g(`access.credentialTable.searchLabel`,{label:t}),facetsLabel:g(`access.credentialTable.facetsLabel`,{label:t}),clearLabel:g(`access.credentialTable.clearFilters`)},onSearch:v.setSearch,onToggleFacet:v.toggleFacet,onToggleGroupFacet:v.toggleGroupFacet,onClear:v.clear}),p!==void 0&&s(Re,{bulk:p,shown:v.rows.filter(C),targets:D,onSelect:b}),s(ee,{columns:S,rows:v.rows,rowKey:e=>e.id,minWidthPx:l?760:860,maxBodyHeight:G,defaultSort:{columnKey:`created`,dir:`desc`},pageSize:25,paginationLabels:{navLabel:g(`access.credentialTable.pagesLabel`,{label:t}),previous:g(`access.credentialTable.previousPage`),next:g(`access.credentialTable.nextPage`),range:(e,t,n)=>g(`access.credentialTable.range`,{from:e,to:t,total:n})},emptyMessage:v.active?g(`access.credentialTable.noMatchTheFilters`,`No {{label}} match the filters.`,{label:t}):c,rowClassName:e=>e.status===`revoked`||e.status===`expired`?`opacity-70`:void 0,...p===void 0?{}:{selection:{selected:y,onChange:b,isSelectable:C,rowLabel:e=>g(`access.credentialTable.rowLabel`,{name:e.name,owner:e.ownerName}),pageLabel:g(`access.credentialTable.pageLabel`,{noun:De(1,p.noun)})}}})]}):s(w,{title:g(`access.credentialTable.couldNotLoad`,`Could not load {{label}}`,{label:t}),message:o})}function Re({bulk:e,shown:t,targets:n,onSelect:r}){let{t:i}=X(),{revoke:o,noun:c}=e,u=(e.quickSelect??[]).map(e=>({...e,rows:t.filter(e.match)})).filter(e=>e.rows.length>0),d=async()=>{await o.run(n)&&r(new Set)};return a(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`bulk-bar`,children:[t.length>0&&s(P,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(new Set(t.map(e=>e.id))),children:i(`access.credentialTable.selectAllShown`,{count:t.length})}),u.map(e=>a(P,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(new Set(e.rows.map(e=>e.id))),children:[e.label,` (`,String(e.rows.length),`)`]},e.label)),n.length>0&&a(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[s(`span`,{className:`text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:i(`access.credentialTable.selectedLabel`,{what:Q(n.length,c)})}),a(P,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(new Set),children:[s(f,{className:`h-3 w-3`,"aria-hidden":!0}),i(`access.credentialTable.clearSelection`,`Clear selection`)]}),a(P,{type:`button`,variant:`danger`,size:`sm`,disabled:o.busy,onClick:()=>void d(),children:[o.busy?s(m,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):s(l,{className:`h-3 w-3`,"aria-hidden":!0}),i(`access.credentialTable.revoke`,{what:Q(n.length,c)})]})]})]})}var ze=(e,t)=>t===null?`—`:e.get(t)??t;function Be(e,t){return e!=null&&e<=t?`expired`:`active`}function Ve(e,t,n){return{id:e.id,name:n.client(e.client),detail:e.ip,ownerId:e.userId,ownerName:ze(t,e.userId),kind:n.method(e.method),scope:null,status:e.current?`current`:`active`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function He(e,t){return{id:e.id,name:e.integrationId,detail:null,ownerId:e.userId,ownerName:e.username,kind:e.integrationId,scope:t,status:e.revokedAt===null?`active`:`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:null}}var Ue=`All permissions`,We=`View link`,Ge=`Scoped`,Ke={"grid-view":`Grid`,"events-view":`Events`};function qe(e,t){return e.map(e=>t.get(e)??`#${String(e)}`).join(`, `)}function Je(e){return e!==`*`&&e.type===`share-view`&&`grant`in e}function Ye(e,t,n){return e===`*`?Ue:Je(e)?`${`${Ke[e.grant.kind]} view${e.grant.talk===!0?` + talk`:``}`}: ${qe(e.grant.deviceIds,t)}`:n(e)}function Xe(e){return e.includes(`*`)?Ue:e.some(Je)?We:Ge}function Ze(e,t,n,r){return{id:e.id,name:e.label,detail:null,ownerId:e.subjectId,ownerName:ze(t,e.subjectId),kind:Xe(e.scopes),scope:n,status:e.revokedAt===null?Be(e.expiresAt,r):`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Qe(e){return`${e.provider}\u0000${e.subject}`}function $e(e,t){return{id:Qe(e),name:e.label??e.subject,detail:e.issuer,ownerId:e.userId,ownerName:ze(t,e.userId),kind:e.provider,scope:null,status:`active`,createdAt:e.linkedAt,lastUsedAt:null,expiresAt:null}}function et(e,t){let n=e.allowedProviders;return{id:e.id,name:e.label,detail:`${e.tokenPrefix}…`,ownerId:e.userId??null,ownerName:ze(t,e.userId??null),kind:e.isAdmin===!0?`Admin`:`Regular`,scope:n===void 0||n===`*`?`All providers`:n.join(`, `)||`All providers`,status:`active`,createdAt:e.createdAt??null,lastUsedAt:e.lastUsedAt??null,expiresAt:null}}var tt=40,nt=[{test:/Electron\//,name:`CamStack desktop`},{test:/Edg(e|A|iOS)?\//,name:`Edge`},{test:/OPR\/|Opera/,name:`Opera`},{test:/Firefox\/|FxiOS\//,name:`Firefox`},{test:/Chrome\/|CriOS\//,name:`Chrome`},{test:/Version\/[\d.]+.*Safari\//,name:`Safari`}],rt=[{test:/iPhone/,name:`iPhone`},{test:/iPad/,name:`iPad`},{test:/Android/,name:`Android`},{test:/Mac OS X|Macintosh/,name:`macOS`},{test:/Windows/,name:`Windows`},{test:/CrOS/,name:`ChromeOS`},{test:/Linux/,name:`Linux`}],it=[{test:/CFNetwork\/.*Darwin\//,name:`CamStack app on iOS`},{test:/^okhttp\//i,name:`CamStack app on Android`},{test:/^(node|undici)\b/i,name:`Script (Node.js)`},{test:/^curl\//i,name:`curl`}];function at(e,t){return e.find(e=>e.test.test(t))?.name??null}function ot(e){return e.length<=tt?e:`${e.slice(0,tt)}…`}function st(e){if(e===null||e.trim().length===0)return{label:Y.t(`helpers.sessionClient.unknownDevice`),raw:null};let t=e.trim(),n=at(it,t);if(n!==null)return{label:n,raw:t};let r=at(nt,t),i=at(rt,t);return r!==null&&i!==null?{label:Y.t(`helpers.sessionClient.browserOnSystem`,{browser:r,system:i}),raw:t}:r===null?{label:ot(t),raw:t}:{label:r,raw:t}}var ct={password:`helpers.sessionClient.method.password`,passkey:`helpers.sessionClient.method.passkey`,sso:`helpers.sessionClient.method.sso`,handoff:`helpers.sessionClient.method.handoff`,exchange:`helpers.sessionClient.method.exchange`};function lt(e){let t=ct[e];return t===void 0?e:Y.t(t)}function ut(e){if(e==null)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}e();function dt(e,t){return e instanceof Error&&e.message.length>0?e.message:t}function ft(e){let{t}=X(),n=h(),[c,l]=r(!1),[u,d]=r(``),[f,p]=r(null),[g,_]=r(null),v=o(null),y=i(e=>{v.current?.(e),v.current=null,l(!1),d(``),p(null),_(null)},[]),b=i(()=>new Promise(e=>{v.current?.(null),v.current=e,_(null),l(!0)}),[]),C=async()=>{p(`password`),_(null);try{let{reauthToken:e}=await n.reauthenticate({password:u});y(e)}catch(e){_(dt(e,`Password is incorrect`)),p(null)}},w=async()=>{p(`passkey`),_(null);try{let{optionsJSON:e}=await n.reauthBeginPasskey();if(!ue(e))throw Error(`passkey authentication options missing challenge`);let t=await Z({optionsJSON:e}),{reauthToken:r}=await n.reauthenticate({passkeyResponse:Object.fromEntries(Object.entries(t))});y(r)}catch(e){_(dt(e,`Passkey verification failed`)),p(null)}};return{requestProof:b,dialog:s(k,{open:c,onOpenChange:e=>!e&&y(null),children:a(S,{children:[a(O,{children:[s(j,{children:t(`auth.reauthDialog.confirmItSYou`,`Confirm it’s you`)}),s(V,{children:t(`auth.reauthDialog.needsPassword`,{action:e})})]}),a(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),u.length>0&&f===null&&C()},children:[s(ie,{type:`password`,autoComplete:`current-password`,placeholder:t(`auth.reauthDialog.currentPassword`,`Current password`),value:u,onChange:e=>d(e.target.value),"aria-label":t(`auth.reauthDialog.currentPassword`,`Current password`)}),g!==null&&s(`p`,{role:`alert`,className:`text-xs text-danger`,children:g}),a(D,{className:`flex flex-wrap gap-2`,children:[a(P,{type:`button`,variant:`outline`,disabled:f!==null,onClick:()=>void w(),children:[f===`passkey`?s(m,{className:`h-4 w-4 animate-spin`}):s(x,{className:`h-4 w-4`}),t(`auth.reauthDialog.useAPasskey`,`Use a passkey`)]}),a(P,{type:`submit`,disabled:u.length===0||f!==null,children:[f===`password`&&s(m,{className:`h-4 w-4 animate-spin`}),t(`common.confirm`,`Confirm`)]})]})]})]})})}}function pt({token:e,label:t,onClose:n}){let{t:r}=X();return s(k,{open:!0,onOpenChange:e=>!e&&n(),children:a(S,{width:`md`,scroll:`body`,children:[s(O,{children:s(j,{children:r(`auth.tokenModals.token`,`Token: {{label}}`,{label:t})})}),a(H,{className:`space-y-3`,children:[s(`div`,{className:`rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning`,children:r(`auth.tokenModals.copyThisTokenNowOnce`,`Copy this token now. Once you close this dialog the secret cannot be displayed again.`)}),s(`div`,{className:`select-all break-all rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:e})]}),a(D,{children:[s(M,{value:e,label:r(`common.copy`,`Copy`),srLabel:`token`}),s(P,{type:`button`,variant:`primary`,size:`sm`,onClick:n,children:r(`auth.tokenModals.done`,`Done`)})]})]})})}var mt={token:`newToken`,scoped:`newScoped`,admin:`newAdmin`};e();var ht=80,$=86400,gt=[{value:`1`,seconds:$},{value:`7`,seconds:7*$},{value:`30`,seconds:30*$},{value:`90`,seconds:90*$},{value:`never`,seconds:`never`}],_t={type:`device-multiselect`,key:`cameras`,label:`Cameras`,deviceFilter:{types:[`camera`]},maxItems:64},vt={type:`capability`,target:``,access:[`view`,`create`]};function yt({open:e,users:i,onClose:o,onSubmit:c,submitting:l,formError:f,awaitingProof:h}){let{t:g}=X(),v=p(),{user:y}=ce(),b=y?.isAdmin===!0,S=b?null:y?.scopes??[],[C,w]=r(`scopes`),[T,ee]=r(y?.id??``),[E,D]=r(``),[O,k]=r([vt]),[j,M]=r([]),[N,I]=r(`grid-view`),[z,ne]=r(!1),[B,V]=r(`30`);t(()=>{e||(w(`scopes`),ee(y?.id??``),D(``),k([vt]),M([]),I(`grid-view`),ne(!1),V(`30`))},[e,y?.id]),t(()=>{C!==`view-link`&&B===`never`&&V(`30`)},[C,B]);let H=n(()=>gt.filter(e=>e.seconds!==`never`||C===`view-link`).map(e=>({value:e.value,label:e.seconds===`never`?g(`access.createTokenModal.never`,`Never (until revoked)`):g(`access.createTokenModal.days`,{count:Number(e.value)})})),[C,g]),G=E.trim(),K=C===`scopes`?A(O,v):null,q=j.map(Number).filter(e=>Number.isInteger(e)&&e>=0),J=gt.find(e=>e.value===B)?.seconds??30*$,oe=()=>C===`all`?[`*`]:C===`view-link`?[{type:`share-view`,grant:{kind:N,deviceIds:q,...z?{talk:!0}:{}}}]:O,se=G.length>0&&G.length<=ht&&!l&&!h&&(C===`all`?b:C===`view-link`?q.length>0:O.length>0&&K===null),Y=()=>{if(!se)return;let e=b&&C!==`all`&&T!==``&&T!==y?.id;c({scopes:oe(),expiresIn:J,label:G,...e?{subjectId:T}:{}})},Z=C===`all`,ue=Z?d:_;return s(F,{open:e,onClose:o,title:g(`access.createTokenModal.createToken`,`Create token`),icon:Z?d:x,error:f,width:`md`,testId:`create-token-dialog`,footer:a(P,{type:`button`,variant:Z?`danger`:`primary`,size:`sm`,onClick:Y,disabled:!se,"data-testid":`create-token-submit`,children:[l||h?s(m,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}):s(ue,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),g(`access.createTokenModal.issueToken`,`Issue token`)]}),children:a(`div`,{className:`space-y-3`,children:[a(`div`,{className:`space-y-1`,children:[s(U,{children:g(`access.createTokenModal.whatItMayDo`,`What it may do`)}),s(ae,{appearance:`pills`,value:C,onValueChange:e=>{(e===`scopes`||e===`view-link`||e===`all`)&&w(e)},children:a(R,{"aria-label":g(`access.createTokenModal.whatItMayDo`,`What it may do`),children:[a(W,{value:`scopes`,"data-testid":`token-reach-scopes`,children:[s(_,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),g(`access.createTokenModal.reachScopes`,`Scopes`)]}),a(W,{value:`view-link`,"data-testid":`token-reach-view-link`,children:[s(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),g(`access.createTokenModal.reachViewLink`,`View link`)]}),b?a(W,{value:`all`,"data-testid":`token-reach-all`,children:[s(d,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),g(`access.createTokenModal.reachAll`,`All permissions`)]}):null]})})]}),Z?s(`div`,{className:`space-y-1 rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px] leading-relaxed text-foreground`,"data-testid":`admin-token-warning`,children:s(`p`,{children:s(le,{i18nKey:`auth.adminTokenNoticeShort`,components:{strong:s(`strong`,{})}})})}):null,b&&C!==`all`&&i.length>1?a(`div`,{className:`space-y-1`,children:[s(U,{htmlFor:`token-user`,children:g(`access.createTokenModal.onBehalfOfUser`,`On behalf of user`)}),s(L,{id:`token-user`,value:T,onChange:e=>ee(e.target.value),options:i.map(e=>({value:e.id,label:e.username}))})]}):null,a(`div`,{className:`space-y-1`,children:[s(U,{htmlFor:`token-name`,children:g(`access.createTokenModal.label`,`Label`)}),s(ie,{id:`token-name`,value:E,maxLength:ht,required:!0,onChange:e=>D(e.target.value),placeholder:C===`view-link`?`kitchen-wall`:`nightly-backup`,autoFocus:!0})]}),C===`scopes`?a(`div`,{className:`space-y-1`,children:[s(U,{children:g(`access.createTokenModal.scopes`,`Scopes`)}),s(te,{value:O,onChange:k,clampToParent:S}),K&&s(`p`,{className:`text-[10px] text-danger`,children:K}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:g(`access.createTokenModal.eachScopePicksACap`,`Each scope picks a (cap or addon) target + one or more access flavours. The token can access ONLY what's listed.`)})]}):null,C===`view-link`?a(`div`,{className:`space-y-2`,"data-testid":`token-view-link`,children:[a(`div`,{className:`space-y-1`,children:[s(U,{children:g(`access.createTokenModal.cameras`,`Cameras`)}),s(re,{field:_t,value:j,onChange:e=>M(Array.isArray(e)?e.filter(e=>typeof e==`string`):[])})]}),a(`div`,{className:`space-y-1`,children:[s(U,{htmlFor:`token-view-kind`,children:g(`access.createTokenModal.viewKind`,`Shows`)}),s(L,{id:`token-view-kind`,value:N,onChange:e=>I(e.target.value===`events-view`?`events-view`:`grid-view`),options:[{value:`grid-view`,label:g(`access.createTokenModal.viewGrid`,`Live grid`)},{value:`events-view`,label:g(`access.createTokenModal.viewEvents`,`Events`)}]})]}),N===`grid-view`?a(`label`,{className:`flex items-start gap-2 text-sm text-foreground`,children:[s(`input`,{type:`checkbox`,className:`mt-0.5`,checked:z,onChange:e=>ne(e.target.checked),"data-testid":`token-view-talk`}),s(`span`,{children:g(`access.createTokenModal.talk`,`Allow talk-back on these cameras`)})]}):null]}):null,a(`div`,{className:`space-y-1`,children:[s(U,{htmlFor:`token-lifetime`,children:g(`access.createTokenModal.expires`,`Expires after`)}),s(L,{id:`token-lifetime`,value:B,onChange:e=>V(e.target.value),options:H})]})]})})}e();var bt={key:`access.nouns.token`};function xt(e){return typeof e==`object`&&!!e&&`kind`in e}function St(e,t){let n=e.access===void 0?``:` [${e.access.join(`, `)}]`;return e.type===`device`?`device:[${xt(e.selector)?B(e.selector,t):`?`}]${n}`:e.type===`addon-routes`?`every addon's routes${n}`:`${e.type}:${e.target??``}${n}`}function Ct({headerOwnsCreate:e=!1,createRequested:i=!1,onCreateConsumed:o,ownOnly:c=!1}){let{t:u}=X(),d=p(),{user:f}=ce(),m=ne(),h=N.useUtils(),g=me(),{data:_}=C(),v=n(()=>_??[],[_]),{data:y}=oe({}),b=n(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),S=N.auth.listTokens.useQuery(void 0),{requestProof:w,dialog:T}=ft(`Creating a token with all permissions`),{state:ee,openNew:E,close:D}=se({newKey:mt.token}),[te,O]=r(null),[k,A]=r(null),[j,M]=r(!1),[F,I]=r(null),[L,R]=r(null);t(()=>{i&&(E(),o?.())},[i,E,o]);let z=()=>{h.auth.listTokens.invalidate(),h.auth.listAuthAudit.invalidate()},B=N.auth.mintToken.useMutation({onSuccess:({token:e,record:t})=>{z(),D(),A(null),M(!1),I({token:e,label:t.label})},onError:e=>{A(`Create failed: ${e.message}`),M(!1)}}),V=N.auth.revokeToken.useMutation({onSuccess:()=>{R(null),z()},onError:e=>{R(null),O(`Revoke failed: ${e.message}`)}}),H=je(bt,z),U=Date.now(),re=(S.data??[]).filter(e=>!c||e.subjectId===f?.id).map(e=>Ze(e,g,e.scopes.includes(`*`)?null:e.scopes.map(e=>Ye(e,b,e=>St(e,d))).join(`, `),U)),ie=async e=>{await m({title:u(`access.tokensSection.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:e.kind===`All permissions`?u(`access.tokensSection.everyScriptUsingItLoses`,`Every script using it loses access immediately. This cannot be undone.`):u(`access.tokensSection.stopsWorking`,`Whoever holds it loses access immediately. This cannot be undone.`),confirmLabel:u(`access.tokensSection.revoke2`,`Revoke`),variant:`danger`})&&(O(null),R(e.id),V.mutate({id:e.id}))},W=e=>{(async()=>{O(null),A(null);let t;if(e.scopes.includes(`*`)){M(!0);let e=await w();if(M(!1),e===null)return;t=e}B.mutate({scopes:[...e.scopes],expiresIn:e.expiresIn,label:e.label,...e.subjectId===void 0?{}:{subjectId:e.subjectId},...t===void 0?{}:{reauthToken:t}})})()};return a(`div`,{"data-testid":`tokens`,children:[T,s(de,{notice:he(te,H.outcome),onDismissNotice:()=>{O(null),H.dismiss()},id:c?`my-tokens`:`tokens`,title:c?u(`access.tokensSection.myTokens`,`My tokens`):u(`access.tokensSection.tokens`,`Tokens`),icon:x,actions:e?void 0:a(P,{size:`sm`,type:`button`,"data-testid":`tokens-new`,onClick:E,children:[s(x,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),u(`system.access.newToken`,`New token`)]}),description:u(`access.tokensSection.oneFormat`,`Every token is its scopes: a few permissions for a script, all permissions for an admin script, or a view of some cameras for a share link. Revoking one stops it on its next use.`),children:s(Le,{rows:re,label:u(`common.tokensLabel`),isLoading:S.isLoading,loadError:S.isError?S.error?.message??`Request failed`:null,emptyText:u(`access.tokensSection.noTokens`,`No tokens.`),action:{label:u(`access.tokensSection.revoke2`,`Revoke`),icon:l,isAvailable:e=>e.status===`active`,onRun:e=>void ie(e),busyId:L,disabled:H.busy||L!==null},...f?.isAdmin===!0?{bulk:{revoke:H,noun:bt,isSelectable:e=>e.status===`active`}}:{}})}),s(yt,{open:ee.mode===`new`,users:v.map(e=>({id:e.id,username:e.username})),onClose:()=>{D(),A(null),M(!1)},submitting:B.isPending,formError:k,awaitingProof:j,onSubmit:W}),F&&s(pt,{token:F.token,label:F.label,onClose:()=>I(null)})]})}var wt=864e5,Tt={qr:`QR (by an admin)`,self:`Self-enrolled`},Et={ios:`iOS`,android:`Android`,web:`Web`,other:`Other`};function Dt(e){return e.status===`revoked`}function Ot(e){return e.status!==`revoked`}function kt(e,t=`—`){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function At(e,t){return e===null||Number.isNaN(e)?null:Math.floor((e-t)/wt)}function jt(e,t){let n=At(e,t);return n===null?`unknown`:n<0?`expired`:n<30?`soon`:`ok`}function Mt(e,t){let n=At(e,t);return n===null?Y.t(`helpers.certificateModel.unknown`):n===0?Y.t(`helpers.certificateModel.today`):n>0?Y.t(`helpers.certificateModel.inDays`,{count:n}):Y.t(`helpers.certificateModel.daysAgo`,{count:-n})}function Nt(e){if(e===null)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Pt(e){return e===null||e.length===0?`—`:e.length<=17?e:`${e.slice(0,8)}…${e.slice(-8)}`}function Ft(e){return e.length<=10?e:`${e.slice(0,10)}…`}function It(e){if(!e.online)return{allowed:!1,reason:Y.t(`helpers.certificateModel.nodeOffline`)};if(e.isHub&&e.https.kind===`served`){if(e.https.status.mode===`uploaded`)return{allowed:!1,reason:Y.t(`helpers.certificateModel.uploadedCert`)};if(e.https.status.mode===`disabled`)return{allowed:!1,reason:Y.t(`helpers.certificateModel.tlsDisabled`)}}return{allowed:!0,reason:null}}var Lt={prepare:`helpers.certificateModel.stage.prepare`,issue:`helpers.certificateModel.stage.issue`,install:`helpers.certificateModel.stage.install`,reconnect:`helpers.certificateModel.stage.reconnect`,confirm:`helpers.certificateModel.stage.confirm`};function Rt(e){if(e.ok)return{tone:`success`,message:Y.t(`helpers.certificateModel.renewed`,{nodeId:e.nodeId,serial:Ft(e.newSerial)})};let t=e.keptPreviousLeaf?Y.t(`helpers.certificateModel.keptPrevious`):Y.t(`helpers.certificateModel.maybeNoCert`);return{tone:`danger`,message:Y.t(`helpers.certificateModel.renewalFailed`,{nodeId:e.nodeId,stage:Y.t(Lt[e.stage]),reason:e.reason,kept:t})}}function zt(e,t){let n=Math.max(0,e-t),r=Math.ceil(n/1e3),i=Math.floor(r/60),a=r%60;return{expired:n===0,label:`${String(i)}:${String(a).padStart(2,`0`)}`}}var Bt=11;function Vt(e,t){let n=e.slice(0,Bt);return t===null?n:`${n} · ${t}`}function Ht(e){return{id:e.id,name:e.deviceName,detail:Vt(e.fingerprint,e.lastUsedFrom),ownerId:e.userId,ownerName:e.username??e.userId,kind:Et[e.platform],scope:Tt[e.enrolledVia],status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Ut(e,t){return{id:e.id,name:e.deviceName,detail:null,ownerId:null,ownerName:t,kind:Et[e.platform],scope:null,status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Wt({sessions:e,isLoading:t,loadError:n,emptyText:r,onRevoke:i,revokingId:o}){let{t:c}=X();return t?a(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[s(m,{className:`h-3.5 w-3.5 animate-spin`}),c(`auth.sessionsList.loadingSessions`,`Loading sessions…`)]}):n===null?e.length===0?s(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center`,children:r}):s(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:e.map(e=>s(Gt,{session:e,revoking:o===e.id,onRevoke:()=>i(e)},e.id))}):a(`div`,{className:`text-[11px] text-danger`,children:[c(`auth.sessionsList.couldNotLoadSessions`,`Could not load sessions:`),` `,n]})}function Gt({session:e,revoking:t,onRevoke:n}){let{t:r}=X(),i=st(e.client);return a(`li`,{"data-testid":`session-row`,className:`flex items-start gap-3 px-3 py-2 text-xs`,children:[s(v,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),a(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[a(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[s(`span`,{className:`font-medium text-foreground truncate`,title:i.raw??void 0,children:i.label}),e.current&&s(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:r(`auth.sessionsList.thisDevice`,`This device`)})]}),a(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[s(`span`,{children:lt(e.method)}),s(`span`,{className:`font-mono`,children:e.ip??r(`auth.sessionsList.ipUnknown`,`IP unknown`)}),s(`span`,{children:r(`auth.sessionsList.lastActive`,{when:ut(e.lastUsedAt)})}),s(`span`,{children:r(`auth.sessionsList.expires`,{when:ut(e.expiresAt)})})]})]}),!e.current&&a(`button`,{onClick:n,disabled:t,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[t?s(m,{className:`h-3 w-3 animate-spin`}):s(b,{className:`h-3 w-3`}),r(`auth.sessionsList.signOut`,`Sign out`)]})]})}export{he as A,$e as C,je as D,Le as E,Me as O,Qe as S,Ve as T,ft as _,Ot as a,ut as b,Mt as c,kt as d,It as f,mt as g,Ct as h,Dt as i,me as j,de as k,Rt as l,Ft as m,Ht as n,zt as o,Pt as p,Ut as r,Nt as s,Wt as t,jt as u,st as v,He as w,et as x,lt as y};
@@ -1 +0,0 @@
1
- import{$ as e,J as t,S as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{M as i}from"./src-DVZ_yCN-.js";import{X as a,Y as o,z as s}from"./index-P4Ykaww9.js";e();function c({title:e,children:t}){return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:t})]})}function l({name:e,cssVar:t,hex:i}){return n(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:t?`var(${t})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[e,d]=t({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return n(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[n(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:n(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:n(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`onvif`,hex:`#3b82f6`}),r(l,{name:`hikvision`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:n(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),r(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),r(c,{title:`Inputs`,children:n(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[n(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),n(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),n(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),n(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),n(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),n(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),r(`div`,{children:n(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:n(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),n(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),n(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>r(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),r(c,{title:`Badges`,children:n(`div`,{className:`space-y-3`,children:[n(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(i,{status:e},e))})]}),n(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(a,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:n(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[n(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),n(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),n(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),n(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(o,{type:e,size:`lg`,showLabel:!0},e))})}),n(c,{title:`Form Builder Demo`,children:[r(s,{schema:u,values:e,onChange:d}),n(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(e,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:e,label:t,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[e];return n(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:t}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[e,n]=t(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>n(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:r(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
@@ -1 +0,0 @@
1
- import{$ as e,B as t,G as n,J as r,L as i,S as a,a as o,b as s,o as c,t as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{D as d,It as f,Nt as p,Rr as m,Tn as h,bi as g,bn as _,dn as v,en as y,hi as b,mi as x,mr as S,or as C,ot as w,rr as ee,sn as T,tr as te,un as E,xi as ne,yi as re}from"./player-overlays-HaJLnfsi.js";import{hr as ie}from"./client-C7PU3uqv.js";import{i as ae}from"./video-C_Glztyb.js";import{t as D}from"./key-round-BJ8BVDGZ.js";import{$n as O,An as oe,Ao as se,Bn as ce,Co as le,Do as ue,Eo as de,Kt as k,Ln as fe,Mn as pe,Nn as me,On as he,Oo as ge,Pn as _e,Rt as A,So as ve,To as ye,Un as j,Wt as M,Yl as N,_u as P,an as be,bo as xe,cr as F,er as Se,gl as Ce,in as I,jn as we,kn as Te,ko as Ee,nu as L,on as R,pl as De,qt as Oe,rn as ke,tr as Ae,ul as je,uu as z,wo as Me,xo as Ne}from"./src-DVZ_yCN-.js";import{t as B}from"./i18n-DPnbeqSW.js";import{t as V}from"./useTranslation-D3Is_4B6.js";import{T as Pe,Z as Fe,k as Ie,nt as Le}from"./index-P4Ykaww9.js";import{t as Re}from"./AdminSectionedPage-Dh0h99mU.js";import{t as H}from"./AdminPage-BrNVYSyo.js";import{t as ze}from"./NodeAddonsSettingsPanel-D2a6eJdl.js";import{t as Be}from"./AddonAssetIcon-BZ3nAoxI.js";e();var Ve={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},He={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function Ue({entry:e,actions:t}){let n=e.name.toLowerCase(),r=Ve[n]??`border-primary`,i=He[n]??`bg-primary/5`,o=e.providers.find(e=>e.active),s=t?.pendingCapability===e.name;return a(`div`,{className:`rounded-lg border-t-2 border border-border ${r} ${i} p-3 space-y-2`,children:[a(`div`,{className:`flex items-center justify-between gap-2`,children:[a(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[e.name,s&&u(C,{className:`h-3 w-3 animate-spin text-primary`})]}),u(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${e.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:e.mode})]}),e.mode===`singleton`?u(We,{entry:e,actions:t,activeProvider:o,isPending:s}):u(Ge,{entry:e,actions:t,isPending:s})]})}function We({entry:e,actions:t,activeProvider:n,isPending:r}){let{t:i}=V();if(!t)return u(`div`,{children:n?a(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[u(x,{className:`h-3 w-3 text-green-400 shrink-0`}),u(`span`,{className:`font-medium`,children:n.addonName}),u(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):u(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:i(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(e.providers.length===0)return u(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:i(`addons.capabilityMap.noProviders`,`No providers`)});let o=`__inherit__`;return a(`div`,{className:`space-y-2`,children:[u(`div`,{className:`space-y-1`,children:e.providers.map(n=>{let i=n.active;return a(`button`,{type:`button`,disabled:r||i,onClick:()=>t.onSelectSingleton(e.name,n.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${i?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[u(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${i?`border-green-400 bg-green-400`:`border-border`}`}),u(`span`,{className:`font-medium truncate`,children:n.addonName}),i&&u(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},n.addonId)})}),e.perNode&&e.perNode.length>0&&u(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:e.perNode.map(n=>{let s=n.hasOverride&&n.resolvedActive?n.resolvedActive:o,c=[{value:o,label:n.resolvedActive?i(`addons.capabilityMap.inheritGlobalWith`,{provider:n.resolvedActive}):i(`addons.capabilityMap.inheritGlobal`)},...n.providers.map(e=>({value:e,label:e}))],l=r=>{r===o?t.onClearNodeSingleton(e.name,n.nodeId):t.onSelectNodeSingleton(e.name,n.nodeId,r)},d=r;return a(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[n.nodeId,n.hasOverride&&u(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:i(`common.override`)})]}),c.map(e=>{let t=s===e.value;return a(`button`,{type:`button`,disabled:d||t,onClick:()=>l(e.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${t?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[u(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${t?`border-green-400 bg-green-400`:`border-border`}`}),u(`span`,{className:`font-medium truncate`,children:e.label}),t&&e.value!==o&&u(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},e.value)})]},n.nodeId)})})]})}function Ge({entry:e,actions:t,isPending:n}){let{t:r}=V();if(e.providers.length===0)return u(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:r(`addons.capabilityMap.noProviders`,`No providers`)});if(!t)return u(`div`,{className:`space-y-1`,children:e.providers.map(e=>a(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[u(`span`,{className:`text-foreground-subtle`,children:e.addonName}),e.active&&u(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},e.addonId))});let i=e.providers.filter(e=>e.active).map(e=>e.addonId),o=(n,r)=>{let a=r?[...new Set([...i,n])]:i.filter(e=>e!==n);t.onToggleCollection(e.name,a)};return u(`div`,{className:`space-y-1`,children:e.providers.map(e=>a(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${n?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[a(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[u(`input`,{type:`checkbox`,checked:e.active,disabled:n,onChange:t=>o(e.addonId,t.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),u(`span`,{className:`text-foreground truncate`,children:e.addonName})]}),e.active&&u(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},e.addonId))})}function U({capabilities:e,actions:t}){let{t:n}=V();return e.length===0?u(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:n(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):u(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>u(Ue,{entry:e,actions:t},e.name))})}var W=[`capabilities`,`listCapabilities`];function Ke(e){return e===`singleton`||e===`collection`}function qe(e){let t=e.indexOf(`@`);return t===-1?B.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function Je(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:qe(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function Ye(){let{t:e}=V(),t=w(),[i,s]=r(null),[c,d]=r(null),f=o({queryKey:W,queryFn:()=>t.trpcClient.capabilities.listCapabilities.query()}),p=n(()=>{let e=(f.data??[]).flatMap(e=>Ke(e.mode)?[Je(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[f.data]),m=n(()=>p.filter(e=>e.mode===`singleton`),[p]),h=n(()=>p.filter(e=>e.mode===`collection`),[p]),g=l({mutationFn:e=>t.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{s(e.capName),d(null)},onSuccess:async(t,n)=>{d({kind:`success`,message:e(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:n.capName,addonId:n.addonId})}),await f.refetch()},onError:(t,n)=>{d({kind:`error`,message:e(`system.capabilities.failedToSet`,{cap:n.capName,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),_=l({mutationFn:e=>t.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{s(e.capName),d(null)},onSuccess:async(e,t)=>{d({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await f.refetch()},onError:(t,n)=>{d({kind:`error`,message:e(`system.capabilities.failedToSetOnNode`,{cap:n.capName,node:n.nodeId,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),v=l({mutationFn:e=>t.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{s(e.capName),d(null)},onSuccess:async(t,n)=>{d({kind:`success`,message:e(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:n.capName,nodeId:n.nodeId})}),await f.refetch()},onError:(t,n)=>{d({kind:`error`,message:e(`system.capabilities.failedToClearOnNode`,{cap:n.capName,node:n.nodeId,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),S=l({mutationFn:e=>t.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{s(e.capName),d(null)},onSuccess:async(t,n)=>{d({kind:`success`,message:e(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:n.capName,length:n.enabledAddonIds.length})}),await f.refetch()},onError:(t,n)=>{d({kind:`error`,message:e(`system.capabilities.failedToUpdate`,{cap:n.capName,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),C={onSelectSingleton:(e,t)=>g.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>_.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>v.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>S.mutate({capName:e,enabledAddonIds:t}),pendingCapability:i};return a(H,{embedded:!0,icon:y,title:e(`system.capabilities.capabilities`,`Capabilities`),subtitle:e(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[c&&a(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${c.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[c.kind===`success`?u(x,{className:`h-3.5 w-3.5 shrink-0`}):u(b,{className:`h-3.5 w-3.5 shrink-0`}),u(`span`,{children:c.message})]}),f.isLoading&&u(`div`,{className:`flex items-center justify-center py-16`,children:u(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),f.isError&&!f.isLoading&&u(ce,{title:e(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:f.error instanceof Error?f.error.message:e(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void f.refetch()}),!f.isLoading&&!f.isError&&p.length===0&&u(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:e(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!f.isLoading&&!f.isError&&p.length>0&&a(`div`,{className:`space-y-6`,children:[m.length>0&&a(`section`,{className:`space-y-2`,children:[u(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:e(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),u(U,{capabilities:m,actions:C})]}),h.length>0&&a(`section`,{className:`space-y-2`,children:[u(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:e(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),u(U,{capabilities:h,actions:C})]})]})]})}var G=[`locked`,`reset`,`shares-backup`,`recovery-key`,`rotation-pending`,`orphans`],Xe={"key-missing":`helpers.keychainNotices.lockedKeyMissing`,"wrong-key":`helpers.keychainNotices.lockedWrongKey`,"key-file-unreadable":`helpers.keychainNotices.lockedKeyFileUnreadable`,"store-unavailable":`helpers.keychainNotices.lockedStoreUnavailable`,"not-initialized":`helpers.keychainNotices.lockedNotInitialized`,"decrypt-failed":`helpers.keychainNotices.lockedDecryptFailed`};function Ze(e){let t=Xe[e];return t===void 0?e:B.t(t)}function Qe({status:e,reset:t,pendingReentry:n,orphans:r}){let i=e.keychain.state===`locked`,a=e.keySource??e.configuredSource,o=[];return e.keychain.state===`locked`&&o.push({id:`locked`,tone:`danger`,title:B.t(`helpers.keychainNotices.locked`,{reason:Ze(e.keychain.reason)})}),t!==null&&t.acknowledgedAt===null&&o.push({id:`reset`,tone:`danger`,title:n>0?B.t(`helpers.keychainNotices.resetPending`,{count:n}):B.t(`helpers.keychainNotices.resetDone`)}),a.sharesBackupWithDatabase&&o.push({id:`shares-backup`,tone:`warning`,title:B.t(`helpers.keychainNotices.sharesBackup`)}),!i&&e.recoveryKeyDownloadedAt===null&&o.push({id:`recovery-key`,tone:`warning`,title:B.t(`helpers.keychainNotices.recoveryKey`)}),!i&&e.rotationPending&&o.push({id:`rotation-pending`,tone:`info`,title:B.t(`helpers.keychainNotices.rotationPending`)}),!i&&r>0&&o.push({id:`orphans`,tone:`info`,title:B.t(`helpers.keychainNotices.orphans`,{count:r})}),[...o].sort((e,t)=>G.indexOf(e.id)-G.indexOf(t.id))}var $e={dateStyle:`short`,timeStyle:`short`};function K(e){return e===null?`—`:new Date(e).toLocaleString(void 0,$e)}function q({value:e,copyValue:t,srLabel:n,maxWidthClass:r,className:i}){let o=t??e;return a(`span`,{className:z(`flex min-w-0 items-center gap-0.5`,r),children:[u(`span`,{className:z(`min-w-0 truncate font-mono`,i),title:o,children:e}),u(A,{value:o,srLabel:n,className:`h-6 shrink-0 px-1.5`})]})}e();var et=new Set([`reveal`,`download-recovery-key`,`rotate-master-key`,`reset`]);function tt(e){return[{key:`at`,header:e(`system.keychainAuditTable.colWhen`),render:e=>K(e.at)},{key:`action`,header:e(`system.keychainAuditTable.colAction`),render:e=>u(F,{variant:et.has(e.action)?`warning`:`default`,children:e.action})},{key:`actor`,header:e(`system.keychainAuditTable.colActor`),render:e=>u(`span`,{className:`font-mono`,children:e.actor})},{key:`ref`,header:e(`system.keychainAuditTable.colRef`),render:e=>e.ref===null?u(`span`,{className:`text-foreground-subtle`,children:`—`}):u(q,{value:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[22rem]`})},{key:`detail`,header:e(`system.keychainAuditTable.colDetail`),render:e=>u(`span`,{className:`text-foreground-muted`,children:e.detail??``})}]}function nt({entries:e}){let{t}=V(),[i,o]=r(0),s=n(()=>tt(t),[t]);if(e===void 0)return u(`p`,{className:`text-xs text-foreground-subtle`,children:t(`common.loading`,`Loading…`)});let c=Math.max(1,Math.ceil(e.length/25)),l=Math.min(i,c-1),d=l*25,f=e.slice(d,d+25);return a(`div`,{className:`space-y-2`,children:[u(k,{columns:s,rows:f,rowKey:e=>e.id,minWidthPx:760,emptyMessage:t(`secrets.keychainAuditTable.nothingHasBeenAuditedYet`,`Nothing has been audited yet.`)}),e.length>25&&a(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px] text-foreground-subtle`,children:[u(`span`,{children:t(e.length>=500?`system.keychainAuditTable.rangeRecent`:`system.keychainAuditTable.range`,{from:d+1,to:d+f.length,total:e.length})}),a(`span`,{className:`inline-flex items-center gap-1`,children:[u(j,{size:`sm`,variant:`outline`,"aria-label":t(`secrets.keychainAuditTable.previousPage`,`Previous page`),disabled:l===0,onClick:()=>o(l-1),children:u(g,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),a(`span`,{className:`tabular-nums`,children:[l+1,` / `,c]}),u(j,{size:`sm`,variant:`outline`,"aria-label":t(`secrets.keychainAuditTable.nextPage`,`Next page`),disabled:l>=c-1,onClick:()=>o(l+1),children:u(re,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]})}function rt(e,t){switch(e){case`locked`:return u(j,{size:`sm`,variant:`danger`,disabled:t.busy,onClick:t.onReset,children:B.t(`secrets.keychainNoticeContent.resetKeychain`,`Reset keychain`)});case`reset`:return u(j,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onAcknowledgeReset,children:B.t(`secrets.keychainNoticeContent.dismiss`,`Dismiss`)});case`recovery-key`:return u(j,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onDownload,children:B.t(`secrets.keychainNoticeContent.download`,`Download`)});case`rotation-pending`:return u(j,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onRotate,children:B.t(`secrets.keychainNoticeContent.rotate`,`Rotate`)});case`orphans`:return u(j,{size:`sm`,variant:`outline`,onClick:t.onShowOrphans,children:B.t(`secrets.keychainNoticeContent.review`,`Review`)});case`shares-backup`:return null}}function it(e,t){switch(e){case`locked`:return u(`p`,{children:B.t(`secrets.keychainNoticeContent.noValueCanBeRead`,`No value can be read or stored. If the master key is lost for good, Reset archives every stored value and starts a new keychain; every secret field then reads “not set”.`)});case`reset`:return t.reset===null?null:u(at,{reset:t.reset,pending:t.pendingReentry});case`shares-backup`:return u(`p`,{children:u(Fe,{i18nKey:`secrets.keychainNoticeContent.backupKeyFile`,components:{code:u(`code`,{className:`font-mono`})}})});case`recovery-key`:return u(`p`,{children:B.t(`secrets.keychainNoticeContent.withoutACopyOfThe`,`Without a copy of the master key, the stored values cannot be recovered.`)});case`rotation-pending`:return u(`p`,{children:B.t(`secrets.keychainNoticeContent.theKeychainUnlockedWithA`,`The keychain unlocked with a previous key. Rotate to move onto the configured one.`)});case`orphans`:return null}}function at({reset:e,pending:t}){let{t:n}=V(),r=e.actor===`trigger-file`?n(`secrets.keychainNoticeContent.resetByTrigger`):n(`secrets.keychainNoticeContent.resetByAdmin`,{actor:e.actor});return a(`div`,{className:`space-y-1.5`,children:[u(`p`,{children:n(`secrets.keychainNoticeContent.resetDetail`,{when:K(e.at),by:r,archived:e.archived})}),t.length>0&&u(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:t.map(e=>a(`li`,{className:`break-all`,children:[e.owner,` · `,e.scope,` · `,e.fieldPath]},e.ref))})]})}e();var ot=2,J={danger:{icon:ae,text:`text-danger`,border:`border-danger/40`},warning:{icon:p,text:`text-warning`,border:`border-warning/40`},info:{icon:S,text:`text-info`,border:`border-border`}};function st({notices:e,renderAction:t,renderDetail:n}){let{t:i}=V(),[o,s]=r(!1),c=e[0];if(c===void 0)return null;let l=e.length>ot,d=l&&!o?e.slice(0,1):e,f=e.length-d.length;return a(`section`,{"aria-label":i(`secrets.keychainNotices.keychainNotices`,`Keychain notices`),className:z(`rounded-lg border bg-surface`,J[c.tone].border),children:[u(`ul`,{className:`divide-y divide-border`,children:d.map(e=>u(ct,{notice:e,action:t(e.id),detail:n(e.id)},e.id))}),l&&u(`div`,{className:`border-t border-border px-3 py-1`,children:a(j,{size:`sm`,variant:`ghost`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[u(ne,{className:z(`h-3.5 w-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0}),o?i(`secrets.keychainNotices.showLess`,`Show less`):i(`secrets.keychainNotices.more`,`{{hidden}} more`,{hidden:f})]})})]})}function ct({notice:e,action:t,detail:n}){let{t:i}=V(),[o,s]=r(!1),c=J[e.tone],l=c.icon,d=n!=null,f=`keychain-notice-${e.id}`;return a(`li`,{className:`px-3 py-2`,children:[a(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[a(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-xs text-foreground`,children:[u(l,{className:z(`mt-0.5 h-3.5 w-3.5 shrink-0`,c.text),"aria-hidden":!0}),u(`span`,{className:`min-w-0 break-words`,children:e.title})]}),a(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 pl-5 sm:pl-0`,children:[d&&u(j,{size:`sm`,variant:`ghost`,"aria-expanded":o,"aria-controls":f,onClick:()=>s(e=>!e),children:i(`secrets.keychainNotices.details`,`Details`)}),t]})]}),d&&o&&u(`div`,{id:f,className:`mt-2 pl-5 text-xs text-foreground-muted`,children:n})]})}var lt={"config-file":`Key file (config.yaml)`,"previous-config-file":`Previous key file`,platform:`OS keychain`,"default-file":`Default key file (data volume)`},ut=8;function dt({status:e,busy:t,onDownload:n,onRotate:r,onPurge:i}){let{t:o}=V(),s=e.keychain.state===`locked`,c=e.keySource??e.configuredSource;return u(M,{headingId:`keychain-status`,title:o(`secrets.keychainStatusCard.keychain`,`Keychain`),icon:D,actions:a(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.retiredWraps>0&&u(j,{size:`sm`,variant:`ghost`,disabled:t||s,onClick:i,children:o(`secrets.keychainStatusCard.purge`,{count:e.retiredWraps})}),u(j,{size:`sm`,variant:`outline`,disabled:t||s,onClick:r,children:o(`secrets.keychainStatusCard.rotateKey`,`Rotate key`)}),u(j,{size:`sm`,variant:`outline`,disabled:t||s,onClick:n,children:o(`secrets.keychainStatusCard.downloadRecoveryKey`,`Download recovery key`)})]}),children:a(`dl`,{className:`${d} grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2 xl:grid-cols-4`,children:[a(Y,{label:o(`secrets.keychainStatusCard.state`,`State`),children:[s?a(F,{variant:`danger`,className:`gap-1`,children:[u(ee,{className:`h-3 w-3`,"aria-hidden":!0}),o(`secrets.keychainStatusCard.locked`,`Locked`)]}):a(F,{variant:`success`,className:`gap-1`,children:[u(T,{className:`h-3 w-3`,"aria-hidden":!0}),o(`secrets.keychainStatusCard.unlocked`,`Unlocked`)]}),u(`span`,{className:`ml-2 text-foreground-subtle`,children:o(`common.stored`,{count:e.secretCount})})]}),a(Y,{label:o(`secrets.keychainStatusCard.keySource`,`Key source`),children:[u(`span`,{className:`block`,children:lt[c.kind]}),c.path!==void 0&&u(q,{value:c.path,srLabel:`key path`})]}),u(Y,{label:o(`secrets.keychainStatusCard.fingerprint`,`Fingerprint`),children:e.fingerprint===null?u(`span`,{className:`text-foreground-subtle`,children:`—`}):a(`span`,{className:`inline-flex items-center gap-0.5`,children:[u(`span`,{className:`font-mono`,title:e.fingerprint,children:e.fingerprint.slice(0,ut)}),u(A,{value:e.fingerprint,srLabel:`fingerprint`})]})}),u(Y,{label:o(`secrets.keychainStatusCard.recoveryKey`,`Recovery key`),children:e.recoveryKeyDownloadedAt===null?u(F,{variant:`warning`,children:o(`secrets.keychainStatusCard.notTaken`,`Not taken`)}):u(`span`,{children:o(`secrets.keychainStatusCard.taken`,{when:K(e.recoveryKeyDownloadedAt)})})})]})})}function Y({label:e,children:t}){return a(`div`,{className:`min-w-0 text-xs`,children:[u(`dt`,{className:`text-foreground-subtle`,children:e}),u(`dd`,{className:`mt-0.5 min-w-0 text-foreground`,children:t})]})}e();var ft=1e3;function pt({revealed:e,onClose:n}){let{t:i}=V(),[o,c]=r(N);t(()=>{if(e===null)return;let t=Date.now();c(N);let r=setTimeout(n,N),i=setInterval(()=>c(Math.max(0,N-(Date.now()-t))),ft);return()=>{clearTimeout(r),clearInterval(i)}},[e,n]);let l=Math.ceil(o/1e3);return u(he,{open:e!==null,onOpenChange:e=>!e&&n(),children:u(oe,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:e!==null&&a(s,{children:[a(me,{children:[u(_e,{className:`break-all`,children:e.entry.fieldPath}),a(we,{className:`break-all`,children:[e.entry.owner,` · `,e.entry.scope]})]}),u(Te,{children:u(`pre`,{"data-testid":`revealed-value`,className:`whitespace-pre-wrap break-all rounded-md border border-border bg-background p-3 font-mono text-xs text-foreground`,children:e.value})}),a(pe,{className:`flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[u(`p`,{className:`text-[11px] text-foreground-subtle`,children:i(`secrets.revealDialog.recorded`,{seconds:l})}),a(`div`,{className:`flex justify-end gap-2`,children:[u(A,{value:e.value,label:i(`common.copy`,`Copy`),srLabel:`revealed value`}),u(j,{size:`sm`,variant:`outline`,onClick:n,children:i(`secrets.revealDialog.hide`,`Hide`)})]})]})]})})})}var X={orphan:{labelKey:`secrets.secretsTableState.usageOrphan`,variant:`warning`,hintKey:`secrets.secretsTableState.usageOrphanHint`,rank:0},unknown:{labelKey:`secrets.secretsTableState.usageUnknown`,variant:`default`,hintKey:`secrets.secretsTableState.usageUnknownHint`,rank:1},"in-use":{labelKey:`secrets.secretsTableState.usageInUse`,variant:`success`,hintKey:`secrets.secretsTableState.usageInUseHint`,rank:2}},mt=[{id:`all`,labelKey:`common.all`},{id:`in-use`,labelKey:`secrets.secretsTableState.usageInUse`},{id:`orphan`,labelKey:`secrets.secretsTableState.filterOrphans`},{id:`unknown`,labelKey:`secrets.secretsTableState.usageUnknown`}],Z=`system`;function ht(e){let{t}=V(),{secrets:n,filter:r,onFilterChange:i,onDeleteOrphans:o,deleting:s,locked:c}=e;if(n===void 0)return u(`p`,{className:`text-xs text-foreground-subtle`,children:t(`common.loading`,`Loading…`)});let l=e=>e===`all`?n.length:n.filter(t=>t.usage===e).length,d=n.filter(e=>e.usage===`orphan`).map(e=>e.ref),p=r===`all`?n:n.filter(e=>e.usage===r);return a(`div`,{className:`space-y-2`,children:[a(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[u(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":t(`secrets.secretsTable.filterByUsage`,`Filter by usage`),children:mt.map(e=>a(j,{size:`sm`,variant:r===e.id?`secondary`:`ghost`,"aria-pressed":r===e.id,className:r===e.id?`ring-1 ring-border`:void 0,onClick:()=>i(e.id),children:[t(e.labelKey),u(`span`,{className:`text-foreground-subtle tabular-nums`,children:l(e.id)})]},e.id))}),d.length>0&&a(j,{size:`sm`,variant:`outline`,className:`ml-auto`,disabled:s||c,onClick:()=>o(d),children:[u(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),t(`secrets.secretsTableState.deleteOrphans`,{count:d.length})]})]}),u(k,{columns:_t(e),rows:p,rowKey:e=>e.ref,minWidthPx:860,maxBodyHeight:Oe,defaultSort:{columnKey:`owner`,dir:`asc`},emptyMessage:n.length===0?t(`secrets.secretsTable.noValueIsStoredIn`,`No value is stored in the keychain yet.`):t(`secrets.secretsTable.noStoredValueMatchesThis`,`No stored value matches this filter.`)})]})}function gt({owner:e}){let{t}=V();return a(`span`,{className:`flex items-center gap-2`,children:[u(Be,{addonId:e,fallback:e===Z?v:h,tileClassName:`bg-surface-hover text-foreground-subtle`,size:`sm`}),u(`span`,{className:`font-medium`,children:e===Z?t(`secrets.secretsTable.hubSystem`,`Hub (system)`):e})]})}function _t({locked:e,onReveal:t,revealing:n}){return[{key:`owner`,header:B.t(`secrets.secretsTable.owner`,`Owner`),render:e=>u(gt,{owner:e.owner}),sortValue:e=>e.owner},{key:`scope`,header:B.t(`secrets.secretsTable.scope`,`Scope`),render:e=>u(`span`,{className:`block max-w-[11rem] truncate font-mono`,title:e.scope,children:e.scope}),sortValue:e=>e.scope},{key:`field`,header:B.t(`secrets.secretsTable.field`,`Field`),render:e=>u(q,{value:e.fieldPath,copyValue:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[16rem]`}),sortValue:e=>e.fieldPath},{key:`updated`,header:B.t(`secrets.secretsTable.updated`,`Updated`),render:e=>K(e.updatedAt),sortValue:e=>e.updatedAt},{key:`last-read`,header:B.t(`secrets.secretsTable.lastRead`,`Last read`),render:e=>K(e.lastReadAt),sortValue:e=>e.lastReadAt},{key:`status`,header:B.t(`secrets.secretsTable.status`,`Status`),render:e=>u(F,{variant:X[e.usage].variant,title:B.t(X[e.usage].hintKey),children:B.t(X[e.usage].labelKey)}),sortValue:e=>X[e.usage].rank},{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:r=>a(j,{size:`sm`,variant:`ghost`,disabled:e||n,"aria-label":B.t(`secrets.secretsTable.reveal`,`Reveal {{fieldPath}}`,{fieldPath:r.fieldPath}),title:e?B.t(`secrets.secretsTable.theKeychainIsLocked`,`The keychain is locked`):B.t(`secrets.secretsTable.revealAudited`,`Reveal (audited)`),onClick:()=>t(r),children:[u(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),B.t(`secrets.secretsTable.reveal2`,`Reveal`)]})}]}function vt(e){return e instanceof Error?e.message:String(e)}function yt(e){let{t}=V(),n=Se(),r=O(),i=Ae(),a=ve(),o=Ee(),s=ye(),c=de(),l=xe(),u=Ne(),d=async(t,n)=>{try{await n()}catch(e){await r({title:t,message:vt(e),variant:`danger`})}e()};return{busy:a.isPending||o.isPending||s.isPending||c.isPending,deleting:u.isPending,download:async()=>{await n({title:t(`secrets.useKeychainActions.downloadTitle`),message:t(`secrets.useKeychainActions.downloadMessage`),confirmLabel:t(`secrets.useKeychainActions.downloadConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.downloadRefused`),async()=>{let e=await a.mutateAsync({});await i({title:t(`secrets.useKeychainActions.recoveryTitle`,{fingerprint:e.fingerprint}),message:t(`secrets.useKeychainActions.recoveryMessage`),defaultValue:e.key,readOnly:!0,confirmLabel:t(`secrets.useKeychainActions.recoveryDone`)})})},rotate:async()=>{await n({title:t(`secrets.useKeychainActions.rotateTitle`),message:t(`secrets.useKeychainActions.rotateMessage`),confirmLabel:t(`secrets.useKeychainActions.rotateConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.rotateRefused`),async()=>{let e=await o.mutateAsync({});await r({title:t(`secrets.useKeychainActions.rotatedTitle`),message:t(`secrets.useKeychainActions.rotatedMessage`,{fingerprint:e.fingerprint})})})},purge:async()=>{await n({title:t(`secrets.useKeychainActions.purgeTitle`),message:t(`secrets.useKeychainActions.purgeMessage`),confirmLabel:t(`secrets.useKeychainActions.purgeConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.purgeRefused`),async()=>{await s.mutateAsync({})})},reset:async()=>{await i({title:t(`secrets.useKeychainActions.resetTitle`),message:t(`secrets.useKeychainActions.resetMessage`,{confirmation:`RESET KEYCHAIN`}),confirmLabel:t(`secrets.useKeychainActions.resetConfirm`),validate:e=>e===`RESET KEYCHAIN`?null:t(`secrets.useKeychainActions.resetMismatch`)})===`RESET KEYCHAIN`&&await d(t(`secrets.useKeychainActions.resetRefused`),async()=>{await c.mutateAsync({confirm:ie})})},acknowledgeReset:async()=>{await d(t(`secrets.useKeychainActions.dismissFailed`),async()=>{await l.mutateAsync({})})},deleteOrphans:async e=>{await n({title:t(`secrets.useKeychainActions.orphansTitle`,{count:e.length}),message:t(`secrets.useKeychainActions.orphansMessage`),confirmLabel:t(`secrets.useKeychainActions.orphansConfirm`),variant:`danger`})&&await d(t(`secrets.useKeychainActions.orphansRefused`),async()=>{let n=await u.mutateAsync({refs:[...e]});n.kept.length>0&&await r({title:t(`secrets.useKeychainActions.keptTitle`),message:t(`secrets.useKeychainActions.keptMessage`,{deleted:n.deleted.length,kept:n.kept.length})})})}}}e();var Q=`view`;function bt(){let[e,t]=Le();return[e.get(Q)===`audit`?`audit`:`values`,n=>{let r=new URLSearchParams(e);n===`values`?r.delete(Q):r.set(Q,n),t(r,{replace:!0})}]}function xt(){let{t:e}=V(),t=se({}),o=Me({}),s=le({limit:500}),c=ue({}),l=ge(),d=O(),[f,p]=bt(),[m,h]=r(`all`),[g,_]=r(null),v=yt(()=>{t.refetch(),o.refetch(),s.refetch(),c.refetch()}),y=t.data?.keychain.state===`locked`,b=n(()=>(o.data??[]).filter(e=>e.usage===`orphan`).length,[o.data]),x=n(()=>t.data===void 0?[]:Qe({status:t.data,reset:c.data?.reset??null,pendingReentry:c.data?.pendingReentry.length??0,orphans:b}),[t.data,c.data,b]),S={reset:c.data?.reset??null,pendingReentry:c.data?.pendingReentry??[],busy:v.busy,onReset:()=>void v.reset(),onAcknowledgeReset:()=>void v.acknowledgeReset(),onDownload:()=>void v.download(),onRotate:()=>void v.rotate(),onShowOrphans:()=>{h(`orphan`),p(`values`)}},C=async t=>{try{_({entry:t,value:(await l.mutateAsync({ref:t.ref})).value}),o.refetch()}catch(t){await d({title:e(`admin.system.secrets.revealRefused`,`Reveal refused`),message:Ie(t),variant:`danger`})}},w=i(()=>_(null),[]);return a(H,{embedded:!0,icon:D,title:e(`admin.system.secrets.secrets`,`Secrets`),subtitle:e(`admin.system.secrets.passwordsTokensAndKeysEncrypted`,`Passwords, tokens and keys, encrypted in the hub keychain. Values leave the hub only through an audited reveal.`),children:[u(st,{notices:x,renderAction:e=>rt(e,S),renderDetail:e=>it(e,S)}),t.data!==void 0&&u(dt,{status:t.data,busy:v.busy,onDownload:S.onDownload,onRotate:S.onRotate,onPurge:()=>void v.purge()}),a(ke,{value:f,onValueChange:e=>p(e===`audit`?`audit`:`values`),children:[a(be,{children:[u(R,{value:`values`,children:e(`admin.system.secrets.storedValues`,`Stored values`)}),u(R,{value:`audit`,children:e(`admin.system.secrets.audit`,`Audit`)})]}),u(I,{value:`values`,children:u(ht,{secrets:o.data,locked:y,filter:m,onFilterChange:h,onReveal:e=>void C(e),revealing:l.isPending,onDeleteOrphans:e=>void v.deleteOrphans(e),deleting:v.deleting})}),u(I,{value:`audit`,children:u(nt,{entries:s.data})})]}),u(pt,{revealed:g,onClose:w})]})}e();var St=[[`system`]];function $(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function Ct(){let{t:e}=V(),n=c(),i=De(),o=Ce(),s=je(),[l,d]=r(``),[f,p]=r(``),[m,h]=r(null),g=i.data?.location??null;t(()=>{d(g===null?``:$(g.latitude)),p(g===null?``:$(g.longitude))},[g]);let v=async()=>{await n.invalidateQueries({queryKey:St})},y=async e=>{e.preventDefault();let t=Number(l),n=Number(f);if(l.trim()===``||f.trim()===``){h(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){h(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){h(`Longitude must be between -180 and 180 decimal degrees.`);return}h(null),await o.mutateAsync({latitude:t,longitude:n}),await v()},b=async()=>{h(null),await o.mutateAsync(null),await v()},x=async()=>{h(null),await s.mutateAsync(),await v()},S=o.isPending||s.isPending||i.isLoading;return a(fe,{className:`space-y-3`,children:[a(`div`,{className:`flex items-start justify-between gap-3`,children:[a(`div`,{className:`flex items-start gap-2`,children:[u(te,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),u(`div`,{children:u(`h3`,{className:`text-sm font-medium`,children:e(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),g===null?u(F,{variant:`warning`,children:e(`settings.siteLocationCard.notConfigured`,`Not configured`)}):u(F,{variant:g.source===`operator-set`?`success`:`info`,children:g.source===`operator-set`?e(`settings.siteLocationCard.setByYou`,`Set by you`):e(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),g?.label!==void 0&&g.label!==``?u(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.siteLocationCard.detectedNear`,{place:g.label})}):null,g===null&&i.data?.derivationAttemptedAt!==null?a(`p`,{className:`text-xs text-warning`,children:[e(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),i.data?.derivationError!==null&&i.data?.derivationError!==void 0?`: ${i.data.derivationError}`:`.`,` `,e(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,a(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:y,children:[a(`label`,{className:`flex flex-col gap-1 text-xs`,children:[u(`span`,{className:`text-muted-foreground`,children:e(`settings.siteLocationCard.latitude`,`Latitude`)}),u(L,{className:`w-40`,value:l,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":e(`settings.siteLocationCard.latitude`,`Latitude`)})]}),a(`label`,{className:`flex flex-col gap-1 text-xs`,children:[u(`span`,{className:`text-muted-foreground`,children:e(`settings.siteLocationCard.longitude`,`Longitude`)}),u(L,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":e(`settings.siteLocationCard.longitude`,`Longitude`)})]}),u(j,{type:`submit`,disabled:S,children:e(`common.save`,`Save`)}),a(j,{type:`button`,variant:`ghost`,disabled:S,onClick:x,children:[u(_,{className:`h-3.5 w-3.5 mr-1`}),e(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),g===null?null:u(j,{type:`button`,variant:`ghost`,disabled:S,onClick:b,children:e(`settings.siteLocationCard.clear`,`Clear`)})]}),m===null?null:u(`p`,{className:`text-xs text-danger`,children:m}),u(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}function wt(){let{t:e}=V(),{nodes:t,isLoading:n}=P(),r=t.find(e=>e.isHub&&e.isOnline),i=r?.addons.map(e=>e.addonId)??[];return a(H,{embedded:!0,children:[u(Ct,{}),n?u(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:e(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):r?i.length===0?u(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:e(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):u(ze,{nodeId:r.id,addonIds:i,level:`global`}):a(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[u(E,{className:`h-8 w-8 opacity-30`}),u(`p`,{children:e(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),u(`p`,{className:`text-xs`,children:e(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]})]})}function Tt(){let{t:e}=V(),t=Pe(`/system/settings`,{t:e,isAdmin:!0})??{icon:E,title:e(`system.systemNav`,`System`)};return u(Re,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:u(wt,{})},{id:`secrets`,label:e(`system.system.secrets`,`Secrets`),content:u(xt,{}),ownedParams:[`view`]},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:u(Ye,{})}]})}export{Tt as SystemPage};
@@ -1 +0,0 @@
1
- import{ta as e}from"./player-overlays-HaJLnfsi.js";var t=e(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]);export{t};