@camstack/addon-admin-ui 1.2.117 → 1.2.118

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 (103) hide show
  1. package/dist/assets/{AddLocationWizard-Bob-o0Kv.js → AddLocationWizard-Bf2d5QJC.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-BRZ5wnDA.js → AddonCollectionPage-BKFXFcwj.js} +1 -1
  3. package/dist/assets/Addons-BE4c7Eft.js +1 -0
  4. package/dist/assets/{AdminTabs-DVhMhCwB.js → AdminTabs-CW5SZp7Y.js} +1 -1
  5. package/dist/assets/AiProfiles-DtrI9DHP.js +3 -0
  6. package/dist/assets/{BrokerForm-DUIN2thN.js → BrokerForm-BGjBv1to.js} +1 -1
  7. package/dist/assets/Build-mA9Ywcki.js +32 -0
  8. package/dist/assets/{Capabilities-Dy5fksAD.js → Capabilities-DVGShQpV.js} +1 -1
  9. package/dist/assets/{CapabilityBadges-KzSV_NH7.js → CapabilityBadges-B_jIPQNS.js} +1 -1
  10. package/dist/assets/Cluster-CZGyMZZq.js +11 -0
  11. package/dist/assets/{Data-DujVsgdF.js → Data-DuyRytLu.js} +1 -1
  12. package/dist/assets/{DetectionIntelligence-CM7P-dMx.js → DetectionIntelligence-tpYFIJC0.js} +1 -1
  13. package/dist/assets/{DeviceAggregateSection-Bsi6p5YO.js → DeviceAggregateSection-BhDnF-0R.js} +1 -1
  14. package/dist/assets/{DeviceDetail-DQMiHdyF.js → DeviceDetail-B_T4KUCH.js} +2 -2
  15. package/dist/assets/{Devices-BJcC70V3.js → Devices-19N1vFVC.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-CSY1rShh.js → EmbedPlayerPage-uNDQHMOY.js} +1 -1
  17. package/dist/assets/{Events-BTAz2irZ.js → Events-CeYY81EE.js} +1 -1
  18. package/dist/assets/{FormBuilder-Cl04f_JD.js → FormBuilder-Bw_BfLct.js} +1 -1
  19. package/dist/assets/{Identity-DwP0DWZT.js → Identity-ChUC1Yzb.js} +1 -1
  20. package/dist/assets/{IntegrationDetail-DrtquA7G.js → IntegrationDetail-uhUiJaKD.js} +1 -1
  21. package/dist/assets/{Integrations-D3WabD9o.js → Integrations-CDpK4Iya.js} +1 -1
  22. package/dist/assets/{Integrations-sedJLouZ.js → Integrations-DasmVT6a.js} +1 -1
  23. package/dist/assets/{Logs-CprZOubd.js → Logs-QkSAbBaP.js} +1 -1
  24. package/dist/assets/{MotionZonesSettings-CJ739aet.js → MotionZonesSettings-DEJj0tIr.js} +1 -1
  25. package/dist/assets/{MyAccess-eCoyemMZ.js → MyAccess-Dq5B9DXE.js} +1 -1
  26. package/dist/assets/{Network-GD5AYiiW.js → Network-CdFVF0Bh.js} +1 -1
  27. package/dist/assets/{NodeAddonsSettingsPanel-BKGrAKXv.js → NodeAddonsSettingsPanel-BpV4vZ3y.js} +1 -1
  28. package/dist/assets/{NodeInferenceDevices-BCYhY7nQ.js → NodeInferenceDevices-fUGmh21X.js} +1 -1
  29. package/dist/assets/Notifications-BXPxGe8Q.js +1 -0
  30. package/dist/assets/{Pipeline-Jv-H2NAp.js → Pipeline-Dul0Xxvp.js} +1 -1
  31. package/dist/assets/{Plates-DNXJ0ZGd.js → Plates-vm8v4CX0.js} +1 -1
  32. package/dist/assets/{PrivacyMaskSettings-0i9ff8gY.js → PrivacyMaskSettings-Dyh3C1Gc.js} +1 -1
  33. package/dist/assets/{ProviderIcon-O1y41-9_.js → ProviderIcon-BXczeeUa.js} +1 -1
  34. package/dist/assets/Recordings-BqpIOzrs.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-Bkpvy3_p.js → ScanNetworkModal-D3jJwqnQ.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-CRrYOWn_.js → SceneMonitorEditor-CMdf9veT.js} +1 -1
  37. package/dist/assets/{Scenes-5wMKZRPv.js → Scenes-DC0f71cu.js} +1 -1
  38. package/dist/assets/{Settings-DWYKhvBB.js → Settings-BpKwlBs0.js} +1 -1
  39. package/dist/assets/{Showroom-CUXHrY5P.js → Showroom-DqOzeQMg.js} +1 -1
  40. package/dist/assets/{Terminal-BlZVC9iW.js → Terminal-BDB9l80Z.js} +1 -1
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CAribm2M.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-B3MkFUBK.js} +1 -1
  42. package/dist/assets/{bell-ring-BLQ-V73q.js → bell-ring-DXlqoV-n.js} +1 -1
  43. package/dist/assets/{boxes-Dypj31sZ.js → boxes-D5TGZrSv.js} +1 -1
  44. package/dist/assets/circle-check-big-THS7TOUg.js +1 -0
  45. package/dist/assets/{circle-x-B3MSB8Og.js → circle-x-zj-Y8V0g.js} +1 -1
  46. package/dist/assets/clock-sO6o_mjY.js +1 -0
  47. package/dist/assets/{copy-D55okrt8.js → copy-DVYoqFlk.js} +1 -1
  48. package/dist/assets/{debounced-invalidate-Bq_-Ngtg.js → debounced-invalidate-DKj6sAUn.js} +1 -1
  49. package/dist/assets/{dist-BKLAovWG.js → dist-D_qQ3ZLb.js} +1 -1
  50. package/dist/assets/{dist-vBVTdcJV.js → dist-NbQ5dxwG.js} +12 -12
  51. package/dist/assets/{download-DPaR139q.js → download-BifPfhIt.js} +1 -1
  52. package/dist/assets/{face-bbox-Dl112HSj.js → face-bbox-DaCckiPf.js} +1 -1
  53. package/dist/assets/{hostInit-BEpzKY8C.js → hostInit-C203P4lS.js} +1 -1
  54. package/dist/assets/index-lupFu8MS.js +4 -0
  55. package/dist/assets/{key-round-DUZWZ_rI.js → key-round-9MDNzuSJ.js} +1 -1
  56. package/dist/assets/{layers-Czk9MtAZ.js → layers-ZG2sPM2X.js} +1 -1
  57. package/dist/assets/{mf-entry-bootstrap-0-bb1142ed.js → mf-entry-bootstrap-0-81aebfb2.js} +2 -2
  58. package/dist/assets/{pencil-DtuLbgSG.js → pencil-CZejwlRX.js} +1 -1
  59. package/dist/assets/play-Dj5XCwJ4.js +1 -0
  60. package/dist/assets/{player-overlays-Bx-E68JT.js → player-overlays-9UuGjKRi.js} +1 -1
  61. package/dist/assets/plus-DyGAblLU.js +1 -0
  62. package/dist/assets/power-DoFXllOi.js +1 -0
  63. package/dist/assets/{radio-B_dQ98Hi.js → radio-DNUWRE34.js} +1 -1
  64. package/dist/assets/{refresh-cw-DsTF0HtQ.js → refresh-cw-DTXYyRHZ.js} +1 -1
  65. package/dist/assets/remoteEntry-Bds4bwsC.js +1 -0
  66. package/dist/assets/rotate-ccw-Dp-SmUgt.js +1 -0
  67. package/dist/assets/rotate-cw-CHNi--Cf.js +1 -0
  68. package/dist/assets/{send-BP6R0rRO.js → send-B7H6pAaP.js} +1 -1
  69. package/dist/assets/{server-D37fa07L.js → server-BxzOan8u.js} +1 -1
  70. package/dist/assets/{shield-B6cq5CW6.js → shield-CEP1YgoU.js} +1 -1
  71. package/dist/assets/square-De580U5i.js +1 -0
  72. package/dist/assets/{square-check-big-Jbtwig6c.js → square-check-big-Cx7mXraC.js} +1 -1
  73. package/dist/assets/{src-Hd2A_xp6.js → src-DbUPImmO.js} +12 -12
  74. package/dist/assets/{src-BoA1cQeV.js → src-eNwyjio2.js} +3 -3
  75. package/dist/assets/{star-f_-GYi1D.js → star-Bf7LBoXR.js} +1 -1
  76. package/dist/assets/{undo-2-S6HqaEGy.js → undo-2-Cx6lwzFn.js} +1 -1
  77. package/dist/assets/{use-scenes-feed-C5C2RGwJ.js → use-scenes-feed-C2I8IX9W.js} +1 -1
  78. package/dist/assets/useEventInvalidation-C3I3KCPD.js +1 -0
  79. package/dist/assets/useNodeUrlSelection-ClAXDXQJ.js +1 -0
  80. package/dist/assets/{video-CxvKF_Ar.js → video-Bdo0_RSo.js} +1 -1
  81. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B11mjU62.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CA7Bimee.js} +2 -2
  82. package/dist/assets/{wifi-B9yskYca.js → wifi-sJIjMU2Y.js} +1 -1
  83. package/dist/assets/{zap-8iaR87i8.js → zap-CRMTcuGs.js} +1 -1
  84. package/dist/index.html +5 -5
  85. package/dist/server/addon.js +55 -8
  86. package/package.json +1 -1
  87. package/dist/assets/Addons-C7ugoYzx.js +0 -1
  88. package/dist/assets/AiProfiles-BOumh8Sy.js +0 -3
  89. package/dist/assets/Build-CKeeP86Z.js +0 -32
  90. package/dist/assets/Cluster-BviBUX6y.js +0 -11
  91. package/dist/assets/Notifications-f42HlHqJ.js +0 -1
  92. package/dist/assets/Recordings-BLl9b2uJ.js +0 -1
  93. package/dist/assets/circle-check-big-xsZd2yKi.js +0 -1
  94. package/dist/assets/clock-BtMlIKiK.js +0 -1
  95. package/dist/assets/index-C5g8h6ZU.js +0 -4
  96. package/dist/assets/play-BJCc4fGn.js +0 -1
  97. package/dist/assets/plus-D5JVg6nA.js +0 -1
  98. package/dist/assets/power-BjgBAjFq.js +0 -1
  99. package/dist/assets/remoteEntry-BWuMimQ_.js +0 -1
  100. package/dist/assets/rotate-ccw-CFqgYAHl.js +0 -1
  101. package/dist/assets/rotate-cw-D7RHGKK4.js +0 -1
  102. package/dist/assets/square-CZw5Ock3.js +0 -1
  103. package/dist/assets/useEventInvalidation-2W9yFdBU.js +0 -1
@@ -1 +0,0 @@
1
- import{I as e,Q as t,S as n,W as r,o as i,q as a,x as o,z as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as c,q as l}from"./player-overlays-Bx-E68JT.js";import{Ao as u,Bo as d,Bs as f,Do as p,Eo as m,Ga as h,Go as g,Ho as _,Hr as v,Jo as y,Ko as b,Mo as x,No as S,Oo as C,Po as w,Sa as T,Vo as E,Wo as D,Xo as O,Ya as k,Yo as A,Zo as j,Zt as M,_n as N,bn as ee,ca as te,fa as ne,ga as re,ia as P,ko as ie,on as ae,qo as oe,tt as F,un as I}from"./src-BoA1cQeV.js";import{Vt as L}from"./src-Hd2A_xp6.js";import{t as se}from"./circle-x-B3MSB8Og.js";import{t as ce}from"./download-DPaR139q.js";import{a as R,i as le,n as ue,r as de,t as fe}from"./AddLocationWizard-Bob-o0Kv.js";import{C as z,G as B,K as V,M as H,O as U,V as W,o as G,r as pe}from"./index-C5g8h6ZU.js";import{t as me}from"./AdminPage-CCD07UMs.js";import{r as he}from"./authed-media-BPd_L9jr.js";import{t as ge}from"./DeviceAggregateSection-Bsi6p5YO.js";import{t as _e}from"./AdminTabs-DVhMhCwB.js";import{t as K}from"./format-size-DIxKXxtj.js";var ve=V(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),ye=V(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),be=V(`settings-2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);t();function xe(){let e=v({isCamera:!0,projection:`slim`}),t=r(()=>(e.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[e.data]),[i,s]=a(null),c=i??t[0]?.id??null;return!e.isLoading&&t.length===0?o(M,{icon:W,title:`No cameras`,description:`Add a camera first.`}):n(`div`,{className:`space-y-3`,children:[n(`div`,{className:`flex items-center gap-2`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),o(`select`,{value:c??``,onChange:e=>s(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:t.map(e=>o(`option`,{value:e.id,children:e.name},e.id))})]}),c!==null&&o(ae,{deviceId:c,children:o(ge,{deviceId:c,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},c)]})}t();var Se=[`high`,`mid`,`low`],Ce=[{value:1,label:`Real time (1×)`},{value:2,label:`2×`},{value:4,label:`4×`},{value:8,label:`8×`},{value:16,label:`16×`}],we=10080*60*1e3;function q(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 Te({onClose:e,onCreated:t}){let i=v({isCamera:!0,projection:`slim`}),s=r(()=>(i.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[i.data]),[c,l]=a(``),[u,d]=a(`high`),[f,p]=a(q(60)),[m,h]=a(q(0)),[g,_]=a(1),[y,b]=a(!0),[x,S]=a(``),[w,T]=a(null),E=c===``?s[0]?.id??null:c,D=new Date(f).getTime(),O=new Date(m).getTime(),k=Number.isFinite(D)&&Number.isFinite(O)&&D<O,A=C({onSuccess:()=>{t(),e()},onError:e=>T(e instanceof Error?e.message:String(e))});return o(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:e,children:n(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[n(`h2`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[o(U,{className:`h-3.5 w-3.5`}),`New export`]}),o(`button`,{onClick:e,className:`text-foreground-subtle hover:text-foreground`,children:o(pe,{className:`h-4 w-4`})})]}),n(`div`,{className:`p-4 space-y-3`,children:[n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),o(`select`,{value:E??``,onChange:e=>l(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=>o(`option`,{value:e.id,children:e.name},e.id))})]}),n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Profile`}),o(`select`,{value:u,onChange:e=>d(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:Se.map(e=>o(`option`,{value:e,children:e},e))})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`From`}),o(`input`,{type:`datetime-local`,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`})]}),n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`To`}),o(`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`})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Speed`}),o(`select`,{value:g,onChange:e=>_(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:Ce.map(e=>o(`option`,{value:e.value,children:e.label},e.value))})]}),n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Title (optional)`}),o(`input`,{type:`text`,value:x,onChange:e=>S(e.target.value),placeholder:`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`})]})]}),n(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[o(`input`,{type:`checkbox`,checked:y,disabled:g!==1,onChange:e=>b(e.target.checked),className:`accent-primary`}),`Include audio`,g===1?``:` (real-time only)`]}),!k&&o(`p`,{className:`text-[11px] text-danger`,children:`"From" must be before "To".`}),w&&o(`p`,{className:`text-[11px] text-danger`,children:w})]}),n(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[o(`button`,{onClick:e,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground`,children:`Cancel`}),o(`button`,{onClick:()=>{if(E===null||!k)return;T(null);let e=x.trim();A.mutate({deviceId:E,profile:u,fromMs:D,toMs:O,options:{includeAudio:y,maxLifeMs:we,deleteAfterDownload:!1,...g===1?{}:{speed:g},...e.length>0?{title:e}:{}}})},disabled:E===null||!k||A.isPending,className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:A.isPending?`Queuing…`:`Create export`})]})]})})}function Ee(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 De(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function Oe(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`${De(e)} · ${o}`}function ke(e,t){let n=e-t;if(n<=0)return`expired`;let r=Math.floor(n/6e4);if(r<60)return`in ${String(r)}m`;let i=Math.floor(r/60);return i<24?`in ${String(i)}h`:`in ${String(Math.floor(i/24))}d`}function Ae(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})}t();var je=[[`recordingExport`]],Me={queued:{cls:`bg-muted text-foreground-subtle`,label:`queued`},rendering:{cls:`bg-primary/10 text-primary`,label:`rendering`,spin:!0},ready:{cls:`bg-success/10 text-success`,label:`ready`},failed:{cls:`bg-danger/10 text-danger`,label:`failed`},expired:{cls:`bg-muted text-foreground-subtle`,label:`expired`},deleted:{cls:`bg-muted text-foreground-subtle`,label:`deleted`}};function Ne(){let{data:e,isLoading:t}=u({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:n}=f(L.RecordingExportProgress,e=>e.exportId),{map:i}=f(L.RecordingExportCompleted,e=>e.exportId),{map:a}=f(L.RecordingExportFailed,e=>e.exportId);return{rows:r(()=>Ae(e??[],n,i,a),[e,n,i,a]),isLoading:t}}function Pe(e){let[t,n]=a(()=>Date.now());return s(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Fe(){let t=i(),[s,l]=a(!1),u=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},d=I(),f=c().trpcClient,m=Pe(6e4),{rows:h,isLoading:g}=Ne(),{data:_}=v({isCamera:!0,projection:`slim`}),y=r(()=>{let e=new Map;for(let t of _??[])e.set(t.id,t.name);return e},[_]),b=e(()=>{t.invalidateQueries({queryKey:je})},[t]),x=p({onSuccess:b}),S=ie({onSuccess:b}),[C,w]=a(null),T=e(async e=>{w(e.id);try{let{url:t}=await f.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await he(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),b()}finally{w(null)}},[f,b]),E=e(async e=>{await d({title:`Cancel this export?`,message:`Stops the render. The partial file is discarded.`,confirmLabel:`Cancel export`,variant:`danger`})&&x.mutate({exportId:e.id})},[d,x]),D=e(async e=>{await d({title:`Delete this export?`,message:`Permanently removes the rendered file and its history row.`,confirmLabel:`Delete`,variant:`danger`})&&S.mutate({exportId:e.id})},[d,S]),O=r(()=>[{key:`camera`,header:`Camera`,render:e=>o(`span`,{className:`text-foreground`,children:y.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:`Range`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:Oe(e.fromMs,e.toMs)})},{key:`variant`,header:`Variant`,render:e=>o(`span`,{className:`text-foreground-subtle`,children:Ee(e.options)})},{key:`state`,header:`State`,render:e=>{let t=Me[e.state];return n(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${t.cls}`,children:[t.spin&&o(z,{className:`h-2.5 w-2.5 animate-spin`}),t.label,e.state===`rendering`&&e.progressPct!==null&&n(`span`,{className:`tabular-nums`,children:[e.progressPct,`%`]})]})}},{key:`expiry`,header:`Expires`,nowrap:!0,render:e=>e.state===`deleted`?o(`span`,{className:`text-foreground-subtle`,children:`—`}):o(`span`,{className:`text-foreground-subtle tabular-nums`,children:ke(e.expiresAt,m)})},{key:`size`,header:`Size`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:K(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:e=>{let t=e.state===`ready`,r=e.state===`queued`||e.state===`rendering`,i=e.state!==`deleted`;return n(`div`,{className:`flex items-center justify-end gap-1`,children:[t&&n(`button`,{onClick:()=>{T(e)},disabled:C===e.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:`Download MP4`,children:[C===e.id?o(z,{className:`h-3 w-3 animate-spin`}):o(ce,{className:`h-3 w-3`}),`Download`]}),r&&n(`button`,{onClick:()=>{E(e)},disabled:x.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:`Cancel render`,children:[o(se,{className:`h-3 w-3`}),`Cancel`]}),i&&o(`button`,{onClick:()=>{D(e)},disabled:S.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:`Delete export`,children:o(G,{className:`h-3 w-3`})})]})}}],[y,m,C,x.isPending,S.isPending,T,E,D]);return g&&h.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(z,{className:`h-4 w-4 animate-spin`}),`Loading exports…`]}):n(`div`,{className:`space-y-3`,children:[o(`div`,{className:`flex justify-end`,children:n(`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:[o(U,{className:`h-3.5 w-3.5`}),`New export`]})}),h.length===0?o(M,{icon:U,title:`No exports yet`,description:`Create one here (New export) or from a camera's timeline in the viewer. Rendered clips show up here to download or manage.`}):o(F,{columns:O,rows:h,rowKey:e=>e.id,minWidthPx:720}),s&&o(Te,{onClose:()=>l(!1),onCreated:u})]})}function Ie(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Le(e,t){let n=Ie(e);return n.length===0?`default root`:n.map(e=>t.get(e)??e).join(` + `)}function Re(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Le(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Ie(e).includes(n));return i===void 0?null:{label:Le(i,t),exact:!1}}var ze=[`ok`,`warn`,`critical`];function Be(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function Ve(e){return Math.min(1,Math.max(0,e))}function He(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=Ve((n-t)/n);return{fraction:r,severity:Be(r),recordingsFraction:Ve(e.usedBytes/n),freeBytes:t,totalBytes:n}}function Ue(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=He(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||ze.indexOf(e.severity)>ze.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}t();var We=[[`recording`]],Ge=[{value:`retention`,label:`Retention policy`},{value:`quota`,label:`Quota / disk pressure`},{value:`operator`,label:`Operator`}],Ke={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},qe={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function J(e){return`${String(Math.round(e*100))}%`}function Je(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(` + `):`default root`:e.root}function Ye(){let t=i(),s=I(),[c,u]=a(`retention`),{data:d,isLoading:f}=x({},{refetchOnWindowFocus:!1}),{data:p}=v({isCamera:!0,projection:`slim`}),{data:h}=_({}),g=r(()=>{let e=new Map;for(let t of p??[])e.set(t.id,t.name);return e},[p]),y=r(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.displayName);return e},[h]),b=r(()=>(h??[]).find(e=>e.type===`recordings`&&e.isDefault)?.id??null,[h]),S=r(()=>d?.locations??[],[d?.locations]),C=r(()=>Re(S,y,b),[S,y,b]),T=r(()=>Ue(S),[S]),E=e(()=>{t.invalidateQueries({queryKey:We})},[t]),D=w({onSuccess:E}),O=m({onSuccess:E}),k=e(async e=>{await s({title:`Prune ${g.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Applies the retention policy now (reason: ${c}). Footage beyond the policy is permanently deleted.`,confirmLabel:`Prune now`,variant:`danger`})&&D.mutate({deviceId:e.deviceId,reason:c})},[s,D,c,g]),A=e(async e=>{await s({title:`Delete all footage for ${g.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${K(e.usedBytes)} of recorded footage for this camera. This cannot be undone.`,confirmLabel:`Delete ${K(e.usedBytes)}`,variant:`danger`})&&O.mutate({deviceId:e.deviceId})},[s,O,g]),j=r(()=>[{key:`camera`,header:`Camera`,render:e=>o(`span`,{className:`text-foreground`,children:g.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:`Disk`,nowrap:!0,render:()=>C===null?o(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:C.exact?`text-foreground`:`text-foreground-subtle`,title:C.exact?`The only recordings volume on this node — this camera can only be here.`:`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&&o(`span`,{className:`ml-1 text-foreground-subtle`,children:`(default)`})]})},{key:`used`,header:`Used`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:K(e.usedBytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[n(`button`,{onClick:()=>{k(e)},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:`Apply retention policy now`,children:[o(ye,{className:`h-3 w-3`}),`Prune`]}),n(`button`,{onClick:()=>{A(e)},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:`Delete all footage`,children:[o(G,{className:`h-3 w-3`}),`Delete`]})]})}],[g,C,k,A,D.isPending,O.isPending]);if(f&&!d)return n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(z,{className:`h-4 w-4 animate-spin`}),`Loading storage usage…`]});if(!d)return o(M,{icon:R,title:`No storage data`,description:`The recording node has not reported any storage usage yet.`});let N=d.devices.length;return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[o(l,{label:`Total used`,icon:o(R,{className:`h-3 w-3`}),footer:`${String(N)} camera${N===1?``:`s`} on ${d.nodeId}`,children:K(d.totalUsedBytes)}),T!==null&&T.severity!==null&&o(l,{label:`Free on recordings volumes`,icon:o(R,{className:`h-3 w-3`}),footer:`across ${String(T.knownVolumes)} volume${T.knownVolumes===1?``:`s`} of ${K(T.totalBytes)}`+(T.unknownVolumes>0?` · ${String(T.unknownVolumes)} did not report capacity`:``),children:o(`span`,{className:`tabular-nums ${qe[T.severity]}`,children:K(T.freeBytes)})}),S.map(e=>{let t=He(e),r=e.locationId??e.root??`default`;return o(l,{label:`Disk: ${Je(e,y)}`,footer:t===null?`${K(e.usedBytes)} of recordings · volume capacity unknown`:`${K(t.freeBytes)} free of ${K(t.totalBytes)} · ${K(e.usedBytes)} recordings (${J(t.recordingsFraction)})`,children:t===null?o(`span`,{className:`tabular-nums`,children:K(e.usedBytes)}):n(`div`,{className:`flex items-center gap-2`,title:`Volume fill — everything on the disk, not only recordings. Warn at 85%, critical at 95%.`,children:[o(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:o(`div`,{className:`h-full rounded ${Ke[t.severity]}`,style:{width:J(t.fraction)}})}),o(`span`,{className:`tabular-nums text-xs ${qe[t.severity]}`,children:J(t.fraction)})]})},r)})]}),n(`section`,{className:`flex items-center gap-2 text-xs`,children:[o(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:`Prune reason`}),o(`select`,{id:`prune-reason`,value:c,onChange:e=>{let t=Ge.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:Ge.map(e=>o(`option`,{value:e.value,children:e.label},e.value))})]}),N===0?o(M,{icon:R,title:`No recorded footage`,description:`No camera has recorded footage on this node yet.`}):o(F,{columns:j,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}t();var Xe=[{value:`all`,label:`All`},{value:`recording`,label:`Recordings`},{value:`events`,label:`Events`}],Ze={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`};function Qe(e){return new Date(e).toLocaleString()}function $e(){let[e,t]=a(`all`),{data:i,isLoading:s}=S({},{refetchOnWindowFocus:!1}),{data:c,isLoading:l}=re({},{refetchOnWindowFocus:!1}),{data:u}=v({isCamera:!0,projection:`slim`}),d=r(()=>{let e=new Map;for(let t of u??[])e.set(t.id,t.name);return e},[u]),f=r(()=>{let t=[...i??[],...c??[]];return(e===`all`?t:t.filter(t=>t.domain===e)).toSorted((e,t)=>t.at-e.at)},[i,c,e]),p=r(()=>[{key:`at`,header:`When`,nowrap:!0,render:e=>o(`span`,{className:`text-foreground-subtle tabular-nums`,children:Qe(e.at)})},{key:`domain`,header:`Domain`,render:e=>o(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${Ze[e.domain]}`,children:e.domain})},{key:`op`,header:`Operation`,render:e=>o(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:`Reason`,render:e=>o(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:`Camera`,render:e=>e.deviceId===null?o(`span`,{className:`text-foreground-subtle`,children:`cluster`}):o(`span`,{className:`text-foreground`,children:d.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:`Items`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:`Reclaimed`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?K(e.bytesReclaimed):`—`})}],[d]),m=s||l;return n(`div`,{className:`flex flex-col gap-4`,children:[o(`div`,{className:`flex items-center gap-1`,children:Xe.map(n=>o(`button`,{onClick:()=>t(n.value),className:`rounded px-2 py-1 text-xs font-medium ${e===n.value?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-muted`}`,children:n.label},n.value))}),m&&f.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(z,{className:`h-4 w-4 animate-spin`}),`Loading activity…`]}):f.length===0?o(M,{icon:B,title:`No activity yet`,description:`Prune, delete and rescan operations across recordings and events show up here.`}):o(F,{columns:p,rows:f,rowKey:e=>e.id,minWidthPx:720})]})}t();function et({types:e}){let t=i(),s=I(),{data:c}=_({}),l=E(),u=r(()=>l.data??[],[l.data]),[f,p]=a(null),[m,h]=a(null),g=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},v=j({onSuccess:g}),y=d({onSuccess:g}),b=r(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[c]),x=e=>{e.isDefault||v.mutate(le(e,{isDefault:!0}))},S=(e,t)=>{v.mutate(le(e,{enabled:t}))},C=async e=>{if(e.isDefault){await s({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another as default first.`,confirmLabel:`OK`,variant:`warning`});return}if(await s({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`}))try{await y.mutateAsync({id:e.id})}catch(t){await s({title:`Delete anyway?`,message:`${t instanceof Error?t.message:String(t)}\n\nForcing removes the record only. Anything still on that location becomes unreachable.`,confirmLabel:`Force delete`,variant:`danger`})&&y.mutate({id:e.id,force:!0})}},w=e.map(e=>u.find(t=>t.id===e)).filter(e=>e!==void 0);return n(`div`,{className:`space-y-3`,children:[w.length===0?o(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):w.map(e=>o(de,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:b.get(e.id)??[],onAdd:e=>p(e),onEdit:e=>h(e),onDelete:e=>{C(e)},onSetDefault:e=>x(e),onToggleEnabled:(e,t)=>S(e,t)},e.id)),f!==null&&o(fe,{initialType:f,onClose:()=>p(null),onCreated:()=>{g(),p(null)}}),m!==null&&o(ue,{location:m,onClose:()=>h(null),onSaved:()=>{g(),h(null)}})]})}t();var tt=`pipeline-analytics`;function nt(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 rt(){let e=i(),{data:t}=P(void 0),{data:a,isLoading:s}=N({addonId:tt}),c=nt(a),l=ee({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),u=r(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,c,...e])].filter(Boolean)},[t,c]);return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`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.`}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[s?o(z,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):o(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:tt,patch:{postProcessingNodeId:e.target.value}})},disabled:l.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:u.map(e=>o(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&o(z,{className:`h-4 w-4 animate-spin text-primary`})]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),o(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),o(et,{types:[`eventMedia`]})]})]})}t();var it=`recorder`;function at(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 ot(){let e=i(),{data:t}=P(void 0),{data:a,isLoading:s}=N({addonId:it}),c=at(a,`recordingNodeId`,`hub`),l=ee({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),u=r(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,c,...e])].filter(Boolean)},[t,c]);return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[s?o(z,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):o(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:it,patch:{recordingNodeId:e.target.value}})},disabled:l.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:u.map(e=>o(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&o(z,{className:`h-4 w-4 animate-spin text-primary`})]}),c!==`hub`&&n(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,o(`span`,{className:`font-medium`,children:c}),`. If the auto-derived host doesn't work, set the recorder's`,o(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),o(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`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.`}),o(et,{types:[`recordings`,`recordingsLow`]})]})]})}t();var st=2e3;function ct(){let e=I(),t=i(),r=k(),a=h(void 0,{refetchInterval:e=>e.state.data?.state===`running`?st:!1}),c=a.data,l=c?.state===`running`,u=l||r.isPending;s(()=>{c?.state!==`done`||c.finishedAtMs===null||(t.invalidateQueries({queryKey:[[`recording`]]}),t.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[c?.state,c?.finishedAtMs,t]);let d=async()=>{await e({title:`Reconcile storage from disk?`,message:`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:`Reconcile`,variant:`warning`})&&(await r.mutateAsync(),await a.refetch())},f=l?c.total>0?`Reconciling ${String(c.completed)}/${String(c.total)}…`:`Reconciling…`:r.isPending?`Reconciling…`:`Reconcile from disk`;return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Disk reconcile`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Makes the database match the filesystem for recordings, tracks, events and media. Rows whose files are gone are deleted, including snapshot-less motion events. Enrolled identities stay. The walk runs on the hub; you can leave this page.`}),n(`div`,{className:`mt-3 flex flex-col gap-2`,children:[n(`button`,{type:`button`,onClick:()=>void d(),disabled:u,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:[u?o(z,{className:`h-3.5 w-3.5 animate-spin`}):o(R,{className:`h-3.5 w-3.5`}),f]}),c?.state===`done`?n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Last run: `,String(c.completed),` camera(s) — dropped `,String(c.tracks),` tracks,`,` `,String(c.events),` events, `,String(c.mediaDropped),` media`,c.failed.length>0?`, ${String(c.failed.length)} failed (${c.failed.join(`, `)})`:``,`.`]}):null,c?.state===`error`&&c.error!==null?n(`p`,{className:`text-[11px] text-destructive`,children:[`Reconcile failed: `,c.error]}):null]})]})}t();var lt=[[`pipelineAnalytics`]],ut=1440*60*1e3,dt=[{days:1,label:`1 day`},{days:7,label:`7 days`},{days:30,label:`30 days`},{days:90,label:`90 days`}];function ft(){let t=i(),s=I(),[c,u]=a(30),{data:d,isLoading:f}=ne({},{refetchOnWindowFocus:!1}),{data:p}=v({isCamera:!0,projection:`slim`}),m=r(()=>{let e=new Map;for(let t of p??[])e.set(t.id,t.name);return e},[p]),h=e(()=>{t.invalidateQueries({queryKey:lt})},[t]),g=T({onSuccess:h}),_=te({onSuccess:h}),y=e(async()=>{await s({title:`Prune events older than ${String(c)} day${c===1?``:`s`}?`,message:`Permanently deletes every event (motion / object / audio) older than the cutoff across all cameras, and their media. This cannot be undone.`,confirmLabel:`Prune events`,variant:`danger`})&&g.mutate({olderThanMs:Date.now()-c*ut,reason:`retention`})},[s,g,c]),b=e(async e=>{await s({title:`Delete all events for ${m.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${String(e.rows)} event${e.rows===1?``:`s`} (${K(e.bytes)} of media) for this camera. This cannot be undone.`,confirmLabel:`Delete events`,variant:`danger`})&&_.mutate({deviceId:e.deviceId})},[s,_,m]),x=r(()=>[{key:`camera`,header:`Camera`,render:e=>o(`span`,{className:`text-foreground`,children:m.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`rows`,header:`Events`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:`Media`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:K(e.bytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`button`,{onClick:()=>{b(e)},disabled:_.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:`Delete all events for this camera`,children:[o(G,{className:`h-3 w-3`}),`Delete`]})}],[m,b,_.isPending]);return f&&!d?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(z,{className:`h-4 w-4 animate-spin`}),`Loading event-store footprint…`]}):d?n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[o(l,{label:`Total events`,icon:o(H,{className:`h-3 w-3`}),footer:`across ${String(d.devices.length)} camera${d.devices.length===1?``:`s`}`,children:d.totalRows.toLocaleString()}),o(l,{label:`Event media on disk`,children:K(d.totalBytes)})]}),n(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[o(`span`,{className:`text-foreground-subtle`,children:`Prune events older than`}),o(`select`,{value:c,onChange:e=>u(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:dt.map(e=>o(`option`,{value:e.days,children:e.label},e.days))}),n(`button`,{onClick:()=>{y()},disabled:g.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-amber-500/10 hover:text-amber-500 disabled:opacity-50`,children:[g.isPending?o(z,{className:`h-3 w-3 animate-spin`}):o(ye,{className:`h-3 w-3`}),`Prune now`]})]}),d.devices.length===0?o(M,{icon:H,title:`No stored events`,description:`No camera has persisted events yet.`}):o(F,{columns:x,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]}):o(M,{icon:H,title:`No event data`,description:`Pipeline analytics has not reported any event-store footprint yet.`})}var Y=1e3,X=60*Y,Z=60*X;function Q(e){return e.toLocaleString(`en-US`)}function pt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=Z){let t=Math.floor(e/Z),n=Math.round(e%Z/X);return`${t.toString()}h ${n.toString()}m`}if(e>=X){let t=Math.floor(e/X),n=Math.round(e%X/Y);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/Y)).toString()}s`}function mt(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${Q(e.filesMoved)} files`:`${Q(e.filesMoved)} / ${Q(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?`${K(e.bytesMoved/t*Y)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${pt(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${K(e.bytesMoved)} moved`,rate:a,eta:s}}function ht(e){let t=mt(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}t();var gt=`storage-migration`;function _t(){let{data:e}=P(void 0);return(e??[]).some(e=>e.addons.some(e=>e.capabilities.includes(gt)))}var $=[{id:`recordings`,label:`Recordings`,locationType:`recordings`},{id:`recordingsLow`,label:`Low-res recordings`,locationType:`recordingsLow`},{id:`eventMedia`,label:`Event media`,locationType:`eventMedia`}],vt=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function yt(){return _t()?o(bt,{}):o(M,{icon:ve,title:`Storage migration not installed`,description:`This system doesn't advertise the storage-migration capability yet. Once it's deployed, this panel moves recordings, low-res recordings and event media to new storage locations in one coordinated, verified operation.`})}function bt(){let e=I(),{data:t}=_({}),[i,s]=a({}),[c,l]=a(null),[u,d]=a(null),f=r(()=>{let e=new Map;for(let n of t??[]){let t=e.get(n.type);t?t.push(n):e.set(n.type,[n])}return e},[t]),p=O({},{refetchInterval:2e3}),m=p.data??null,h=m!==null&&vt.has(m.phase),g=r(()=>{let e={};for(let t of $){let n=i[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i]),v=oe({destinations:g??{}},{enabled:!1,retry:!1}),y=A(),b=D(),x=async()=>{if(!g)return;d(null);let e=await v.refetch();if(e.error){d(e.error instanceof Error?e.error.message:String(e.error));return}l(e.data??null)},S=async()=>{if(g&&await e({title:`Start storage migration?`,message:`Pauses the affected writers, copies the data to the new locations, verifies it, then repoints the defaults. Safe to re-run if interrupted.`,confirmLabel:`Start migration`,variant:`danger`})){d(null);try{await y.mutateAsync({destinations:g}),l(null),await p.refetch()}catch(e){d(e instanceof Error?e.message:String(e))}}},C=async()=>{if(m&&await e({title:`Cancel migration?`,message:`Stops the in-progress migration. Data already moved and verified stays at the destination; anything already repointed is not reverted.`,confirmLabel:`Cancel migration`,variant:`danger`}))try{await b.mutateAsync({jobId:m.jobId}),await p.refetch()}catch{}};return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[n(`h3`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[o(ve,{className:`h-3.5 w-3.5`}),`Storage migration`]}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Move recordings, low-res recordings and/or event media to new storage locations in one coordinated operation: pauses the writers, copies via the recorder / pipeline-analytics movers, verifies, then repoints the defaults. Always applies to every camera — destinations are global defaults per storage class, so migration can't be scoped to a subset of cameras. This is the only supported way to move a storage location's data — the Storage tab no longer offers a per-location "Relocate" action.`}),o(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:$.map(e=>{let t=f.get(e.locationType)??[];return n(`div`,{className:`space-y-1`,children:[o(`label`,{htmlFor:`migration-dest-${e.id}`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e.label}),n(`select`,{id:`migration-dest-${e.id}`,value:i[e.id]??``,onChange:t=>{let n=t.target.value;s(t=>({...t,[e.id]:n}))},disabled:h,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:[o(`option`,{value:``,children:`— unchanged —`}),t.map(e=>o(`option`,{value:e.id,children:e.displayName},e.id))]})]},e.id)})}),u&&o(`p`,{className:`mt-2 text-[11px] text-danger`,children:u}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[n(`button`,{type:`button`,onClick:()=>{x()},disabled:!g||v.isFetching||h,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:[v.isFetching&&o(z,{className:`h-3 w-3 animate-spin`}),`Plan`]}),n(`button`,{type:`button`,onClick:()=>{S()},disabled:!g||y.isPending||h,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:[y.isPending&&o(z,{className:`h-3 w-3 animate-spin`}),`Start migration`]})]}),c&&o(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:c.moves.length===0?o(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:`Nothing to move — selected destinations match the current defaults.`}):c.moves.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]},`${e.storageClass}-${e.toLocationId}`))})]}),m&&n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[n(`div`,{className:`flex items-center justify-between`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Migration status`}),h&&n(`button`,{type:`button`,onClick:()=>{C()},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:[o(pe,{className:`h-3 w-3`}),`Cancel`]})]}),n(`p`,{className:`mt-1 text-xs text-foreground`,children:[`Phase: `,o(`span`,{className:`font-medium`,children:m.phase}),h&&o(z,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),m.error&&o(`p`,{className:`mt-1 text-[11px] text-danger`,children:m.error}),m.pausedParticipants.length>0&&n(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[`Paused: `,m.pausedParticipants.join(`, `)]}),o(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:m.moves.map(e=>o(xt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),o(St,{running:h}),o(wt,{})]})}function xt({move:e}){let t=e.progress===null?null:mt(e.progress);return n(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[n(`div`,{className:`flex items-center justify-between`,children:[n(`span`,{className:`text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]}),n(`span`,{className:`text-foreground-subtle`,children:[e.state??`pending`,e.error?` (${e.error})`:``]})]}),e.progress!==null&&n(`div`,{className:`mt-1 space-y-1`,children:[t!==null&&t.fraction!==null&&o(`div`,{className:`h-1 w-full overflow-hidden rounded bg-border`,children:o(`div`,{className:`h-full bg-primary`,style:{width:`${(t.fraction*100).toFixed(1)}%`}})}),o(`p`,{className:`text-[10px] text-foreground-subtle`,children:ht(e.progress)})]})]})}function St({running:e}){let t=I(),r=y({},{refetchInterval:1e4}),i=g(),[s,c]=a(null),l=r.data??[];if(l.length===0)return null;let u=async e=>{if(await t({title:`Drain remaining ${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:`Drain remaining`,variant:`danger`})){c(null);try{await i.mutateAsync({classes:[e.storageClass]}),await r.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}};return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Left on the old location`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`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.`}),s&&o(`p`,{className:`mt-2 text-[11px] text-danger`,children:s}),o(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:l.map(t=>n(`div`,{className:`flex items-center justify-between gap-2 px-2.5 py-1.5 text-[11px]`,children:[n(`span`,{className:`text-foreground`,children:[t.storageClass,`: `,t.fromLocationId,` → `,t.toLocationId,o(`span`,{className:`ml-2 text-foreground-subtle`,children:Ct(t)})]}),o(`button`,{type:`button`,onClick:()=>{u(t)},disabled:e||i.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:`Drain remaining`})]},`${t.storageClass}-${t.fromLocationId}`))})]})}function Ct(e){if(e.items===null)return`amount unknown — the archive could not be read`;let t=e.items.toLocaleString(`en-US`);return e.bytes===null?`${t} rows`:`${t} segments · ${K(e.bytes)}`}function wt(){let{data:e}=b({},{refetchInterval:2e3}),t=(e??[]).filter(e=>e.migrationJobId===null&&e.job.state===`running`);return t.length===0?null:n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Movers running outside a migration`}),o(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:t.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[n(`div`,{className:`text-foreground`,children:[e.lane,`: `,e.job.fromLocationId,` → `,e.job.toLocationId]}),o(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:ht({filesMoved:e.job.filesMoved,filesTotal:e.job.filesTotal,bytesMoved:e.job.bytesMoved,startedAt:e.job.startedAt,observedAt:e.observedAt})})]},e.job.jobId))})]})}function Tt(){return n(`div`,{className:`flex flex-col gap-8`,children:[n(`div`,{children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Recording`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The cluster recording node and recordings folders.`}),n(`div`,{className:`mt-3 flex flex-col gap-6`,children:[o(ot,{}),o(ct,{})]})]}),n(`div`,{children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Events`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The cluster post-processing node, the events folder, and the durable event-store footprint with retention and per-camera deletion.`}),n(`div`,{className:`mt-3 flex flex-col gap-6`,children:[o(rt,{}),o(ft,{})]})]}),n(`div`,{children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Migration`}),o(`div`,{className:`mt-3`,children:o(yt,{})})]})]})}function Et(){return o(me,{icon:U,title:`Recordings`,subtitle:`Recording node & storage, event-store management, exported clips, and an activity log.`,children:o(_e,{tabs:[{id:`storage`,label:`Storage`,icon:R,content:o(Ye,{})},{id:`cameras`,label:`Cameras`,icon:W,content:o(xe,{})},{id:`exports`,label:`Export`,icon:U,content:o(Fe,{})},{id:`activity`,label:`Activity`,icon:B,content:o($e,{})},{id:`management`,label:`Management`,icon:be,content:o(Tt,{})}]})})}export{Et as RecordingsPage};
@@ -1 +0,0 @@
1
- import{K as e}from"./index-C5g8h6ZU.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
@@ -1 +0,0 @@
1
- import{K as e}from"./index-C5g8h6ZU.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};