@camstack/addon-admin-ui 1.2.359 → 1.2.360

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 (120) hide show
  1. package/dist/assets/AddonAssetIcon-YfrTWCUl.js +1 -0
  2. package/dist/assets/Addons-CBnmHNZd.js +4 -0
  3. package/dist/assets/{AdminTabs-DuLpA_8U.js → AdminTabs-FluZSCkZ.js} +1 -1
  4. package/dist/assets/AiProfiles-C55fwqpv.js +3 -0
  5. package/dist/assets/{BrokerForm-vR5vp9pG.js → BrokerForm-DNKfcMGY.js} +1 -1
  6. package/dist/assets/Build-B-W3MTQ_.js +40 -0
  7. package/dist/assets/{Calendars-BAfITRKB.js → Calendars-C6AaPr2m.js} +1 -1
  8. package/dist/assets/Cluster-CcgeafgM.js +11 -0
  9. package/dist/assets/ClusterStepModel-Dt5sbcMn.js +1 -0
  10. package/dist/assets/CompositionEditor-BvxzNcTs.js +1 -0
  11. package/dist/assets/{CompositionEditorPage-ihWkePvk.js → CompositionEditorPage-DWnecyHu.js} +1 -1
  12. package/dist/assets/Data-1Pmkjzqu.js +1 -0
  13. package/dist/assets/DetectionIntelligence-BAjtF-QJ.js +1 -0
  14. package/dist/assets/DeviceDetail-jUxcl2dt.js +2 -0
  15. package/dist/assets/{DeviceDoActionFields-jPhLDyIK.js → DeviceDoActionFields-DEzN9bNr.js} +1 -1
  16. package/dist/assets/{Devices-DuxxmFoU.js → Devices-Fd7nZ5MC.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-CQnqlYuw.js → EmbedPlayerPage-mgkKggkq.js} +1 -1
  18. package/dist/assets/Events-Cf6mlR2q.js +1 -0
  19. package/dist/assets/Identity-6bcQFaXB.js +1 -0
  20. package/dist/assets/IntegrationDetail-ua-c941Y.js +1 -0
  21. package/dist/assets/IntegrationHub-Blksb596.js +1 -0
  22. package/dist/assets/Integrations-C2jeLxC2.js +1 -0
  23. package/dist/assets/Integrations-DHz0PMI_.js +1 -0
  24. package/dist/assets/Locations-Bz7z6CMI.js +3 -0
  25. package/dist/assets/{Logs-DTPkeYTB.js → Logs-D4FH_1l6.js} +1 -1
  26. package/dist/assets/{MotionZonesSettings-40HbSg1J.js → MotionZonesSettings-CM4WOcjH.js} +1 -1
  27. package/dist/assets/MyAccess-CrOZJPf0.js +2 -0
  28. package/dist/assets/Network-Dv-UU8In.js +1 -0
  29. package/dist/assets/NodeAddonsSettingsPanel-CB1W9PlU.js +1 -0
  30. package/dist/assets/Notifications-ho1y5DBh.js +1 -0
  31. package/dist/assets/Plates-bNeRAg3c.js +1 -0
  32. package/dist/assets/{PrivacyMaskSettings-9mlw-Sg2.js → PrivacyMaskSettings-KIOBPGgQ.js} +1 -1
  33. package/dist/assets/ReauthDialog-DSMlzJbr.js +1 -0
  34. package/dist/assets/Recordings-BDpqJ0d4.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-BNO2YlFt.js → ScanNetworkModal-aJXdvOqO.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-DNVt27Re.js → SceneMonitorEditor-GovIClCv.js} +1 -1
  37. package/dist/assets/Scenes-DloxAJU0.js +1 -0
  38. package/dist/assets/{Showroom-Wabt30G9.js → Showroom-q5YYwjHY.js} +1 -1
  39. package/dist/assets/System-kbKQ9CVD.js +1 -0
  40. package/dist/assets/{Terminal-BHChlbCq.js → Terminal-DKuH4tew.js} +3 -3
  41. package/dist/assets/{Viewer-g5WkF6mO.js → Viewer-BrFwktMa.js} +1 -1
  42. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DLbVZskO.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CvwQbyB5.js} +1 -1
  43. package/dist/assets/{archive-DeR3e4g-.js → archive-Bxuu4XK_.js} +1 -1
  44. package/dist/assets/{authed-media-BbuEbo96.js → authed-media-D6c7tYnN.js} +1 -1
  45. package/dist/assets/{boxes-DxeTkSiW.js → boxes-C8EKsJcH.js} +1 -1
  46. package/dist/assets/circle-slash-D2xNyylo.js +1 -0
  47. package/dist/assets/client-CwOJLD7X.js +357 -0
  48. package/dist/assets/crop-B560YMk7.js +1 -0
  49. package/dist/assets/{debounced-invalidate-ueTCIG9w.js → debounced-invalidate-DK6oGBoA.js} +1 -1
  50. package/dist/assets/{device-integration-icon-VoQAb7ud.js → device-integration-icon-WPgnLRa8.js} +1 -1
  51. package/dist/assets/device-picker-model-nn4N-kW_.js +1 -0
  52. package/dist/assets/dist-Ch_VwWyv.js +357 -0
  53. package/dist/assets/dist-DdkYqeyJ.js +1 -0
  54. package/dist/assets/{face-bbox-9UgDdk6i.js → face-bbox-CYI0m13N.js} +1 -1
  55. package/dist/assets/{hard-drive-download-BT7-6QED.js → hard-drive-download-CHmTG4FF.js} +1 -1
  56. package/dist/assets/{hostInit-ClxKYeCF.js → hostInit-DtbkNESn.js} +1 -1
  57. package/dist/assets/index-CArA6N_R.js +4 -0
  58. package/dist/assets/index-wxcbK3CM.css +2 -0
  59. package/dist/assets/{layers-D1ITEDh9.js → layers-DUTpUvYV.js} +1 -1
  60. package/dist/assets/{location-owned-usage-CuOFoDFT.js → location-owned-usage-wj2Taghd.js} +1 -1
  61. package/dist/assets/{mf-entry-bootstrap-0-11b8c94f.js → mf-entry-bootstrap-0-e3bab662.js} +2 -2
  62. package/dist/assets/monitor-smartphone-BcbZNX7w.js +1 -0
  63. package/dist/assets/mount-nn4N-kW_.js +1 -0
  64. package/dist/assets/notification-schedule-field-BTiUXVHy.js +1 -0
  65. package/dist/assets/octagon-alert-CMJcW8DR.js +1 -0
  66. package/dist/assets/{player-overlays-D4lg_avJ.js → player-overlays-rpfoGg2b.js} +1 -1
  67. package/dist/assets/remoteEntry-DgvAVxEY.js +1 -0
  68. package/dist/assets/{send-CYTiWXyC.js → send-DhJPA58A.js} +1 -1
  69. package/dist/assets/{settings-2-DVqttbaa.js → settings-2-BrRBQaWp.js} +1 -1
  70. package/dist/assets/src-BQ0U3gDQ.js +67 -0
  71. package/dist/assets/{use-scenes-feed-DDyjv_py.js → use-scenes-feed-BDMkIMNT.js} +1 -1
  72. package/dist/assets/{use-stationary-objects-CVWdxB6H.js → use-stationary-objects-CxogUU2-.js} +1 -1
  73. package/dist/assets/useEventInvalidation-nn4N-kW_.js +1 -0
  74. package/dist/assets/{useNodeUrlSelection-B7A_j1Pf.js → useNodeUrlSelection-B4wkx7sG.js} +1 -1
  75. package/dist/assets/user-round-CsrOPzWq.js +1 -0
  76. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DAsOC5_y.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BLSzSrXB.js} +2 -2
  77. package/dist/index.html +8 -8
  78. package/dist/server/addon.js +1623 -131
  79. package/package.json +1 -1
  80. package/dist/assets/Addons-CT8L2vyo.js +0 -4
  81. package/dist/assets/AiProfiles-CTbojLmC.js +0 -3
  82. package/dist/assets/Build-T0bVOVm2.js +0 -40
  83. package/dist/assets/Capabilities-5d9c-qIi.js +0 -1
  84. package/dist/assets/Cluster-Cwf8NoIJ.js +0 -11
  85. package/dist/assets/ClusterStepModel-fLIN5mzx.js +0 -1
  86. package/dist/assets/CompositionEditor-BXhIV8ny.js +0 -1
  87. package/dist/assets/Data-BmX1alwx.js +0 -1
  88. package/dist/assets/DetectionIntelligence-DpBsLHgH.js +0 -1
  89. package/dist/assets/DeviceDetail-BRNXK1Kz.js +0 -2
  90. package/dist/assets/Events-DfExfS75.js +0 -1
  91. package/dist/assets/Identity-DCfqnA4h.js +0 -1
  92. package/dist/assets/IntegrationDetail-Dd60p889.js +0 -1
  93. package/dist/assets/IntegrationHub-DngIfTmF.js +0 -1
  94. package/dist/assets/Integrations-BdHOOiI6.js +0 -1
  95. package/dist/assets/Integrations-Cp0oAlu0.js +0 -1
  96. package/dist/assets/Locations-DpJZyPIg.js +0 -3
  97. package/dist/assets/MyAccess-D8iNKV18.js +0 -2
  98. package/dist/assets/Network-BLc315ea.js +0 -1
  99. package/dist/assets/NodeAddonsSettingsPanel-Chf6UF37.js +0 -1
  100. package/dist/assets/Notifications-BwJGQAHc.js +0 -1
  101. package/dist/assets/Plates-BVbnPKtB.js +0 -1
  102. package/dist/assets/Recordings-dLgNG6pd.js +0 -1
  103. package/dist/assets/Scenes-BK7AuUWi.js +0 -1
  104. package/dist/assets/Secrets-BY2ERPhf.js +0 -1
  105. package/dist/assets/Settings-DE3NmAqr.js +0 -1
  106. package/dist/assets/circle-slash-CttzF2br.js +0 -1
  107. package/dist/assets/client-BqN2lVYf.js +0 -357
  108. package/dist/assets/crop-BEmkkd3b.js +0 -1
  109. package/dist/assets/device-picker-model-BhRduRsY.js +0 -1
  110. package/dist/assets/dist-9DPeVlno.js +0 -1
  111. package/dist/assets/dist-CxwXQGCF.js +0 -357
  112. package/dist/assets/index-B6zMUwLj.js +0 -4
  113. package/dist/assets/index-oTBzRcZ2.css +0 -2
  114. package/dist/assets/mount-BhRduRsY.js +0 -1
  115. package/dist/assets/notification-schedule-field-BQpApjQQ.js +0 -1
  116. package/dist/assets/remoteEntry-D_Bq2yl7.js +0 -1
  117. package/dist/assets/src-DtOnHh9r.js +0 -67
  118. package/dist/assets/unlink-ZWAv-UAl.js +0 -1
  119. package/dist/assets/useEventInvalidation-BhRduRsY.js +0 -1
  120. package/dist/assets/user-round-D1OVtUFE.js +0 -1
@@ -1 +0,0 @@
1
- import{K as e,Q as t,S as n,W as r,b as i,o as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{ct as l,ft as u,gt as d,ht as f,st as p,vt as m}from"./player-overlays-D4lg_avJ.js";import{Ac as h,Cc as g,Cd as _,Dc as v,Ec as y,Fc as b,Fd as x,Fu as S,Mc as C,Nc as w,Oc as T,Pc as E,Sf as D,Sn as O,Tc as k,Xn as A,bn as j,gn as M,jc as N,jn as P,kc as F,ou as I,ta as L,ud as R,vn as z,wc as ee,wu as B,xd as V,xf as H,xn as U,yn as W,yu as G}from"./src-DtOnHh9r.js";import{t as K}from"./crop-BEmkkd3b.js";import{a as q,c as J,f as te,i as ne,l as re,m as Y,n as X,o as ie,p as ae,r as oe,s as se,t as ce,u as le}from"./debounced-invalidate-ueTCIG9w.js";import{n as ue,r as Z,t as de}from"./face-bbox-9UgDdk6i.js";import{pi as fe}from"./client-BqN2lVYf.js";import{t as pe}from"./AdminPage-BSFohA3i.js";import{n as me,r as he}from"./authed-media-BbuEbo96.js";var ge=m(`badge-check`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);t();var Q=[[`plateGallery`]];function _e({vehicleId:e}){let t=a(),{data:r,isLoading:i}=h({vehicleId:e}),o=C();function c(n){o.mutate({vehicleId:e,sampleId:n.id},{onSettled:()=>{t.invalidateQueries({queryKey:Q})}})}return i?n(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,children:[s(x,{className:`h-3.5 w-3.5 animate-spin`}),`Loading plates…`]}):!r||r.length===0?s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No plates yet.`}):s(`div`,{className:`mt-2 grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-6`,children:r.map(e=>n(`div`,{className:`group relative overflow-hidden rounded-md border border-border bg-surface`,children:[n(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[e.base64?s(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:e.text,className:`h-full w-full object-cover`}):s(`div`,{className:`flex h-full w-full items-center justify-center text-foreground-subtle`,children:s(D,{className:`h-6 w-6`})}),s(`button`,{type:`button`,onClick:()=>c(e),disabled:o.isPending,className:`absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100 disabled:cursor-not-allowed`,"aria-label":`Remove plate sample`,children:s(B,{className:`h-4 w-4 text-white`})})]}),s(`p`,{className:`truncate px-1.5 py-1 text-center font-mono text-[11px] font-semibold tracking-wide text-foreground`,title:e.text,children:e.text})]},e.id))})}function ve({vehicle:e,expanded:t,onToggle:r}){let c=a(),[l,u]=o(``),[m,h]=o(!1),[g,y]=o(!1),b=w(),S=v();function C(){u(e.name),h(!0)}function T(){h(!1),u(``)}function E(){let t=l.trim();if(!t||t===e.name){T();return}b.mutate({id:e.id,name:t},{onSettled:()=>{c.invalidateQueries({queryKey:Q}),T()}})}function k(){S.mutate({id:e.id},{onSettled:()=>{c.invalidateQueries({queryKey:Q}),y(!1)}})}return n(`div`,{className:`rounded-md border border-border bg-surface`,children:[n(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[s(`div`,{className:`h-8 w-12 shrink-0 overflow-hidden rounded border border-border bg-surface-hover`,children:s(ue,{mediaId:e.coverMediaId,base64:e.coverBase64,alt:e.name,className:`h-full w-full object-cover`,placeholder:s(`div`,{className:`flex h-full w-full items-center justify-center`,children:s(D,{className:`h-4 w-4 text-foreground-subtle`})})})}),s(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:m?n(i,{children:[s(I,{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&E(),e.key===`Escape`&&T()},className:`h-6 text-xs`,autoFocus:!0}),s(`button`,{type:`button`,onClick:E,disabled:b.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Confirm rename`,children:s(H,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:T,className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel rename`,children:s(B,{className:`h-3.5 w-3.5`})})]}):s(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name})}),s(A,{variant:`default`,className:`text-[10px]`,children:e.sampleCount}),!m&&n(`div`,{className:`flex items-center gap-1`,children:[s(`button`,{type:`button`,onClick:C,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground`,"aria-label":`Rename`,children:s(_,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:()=>y(!0),className:`p-1 rounded hover:bg-danger/10 text-foreground-subtle hover:text-danger`,"aria-label":`Delete`,children:s(p,{className:`h-3.5 w-3.5`})})]}),s(`button`,{type:`button`,onClick:r,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":t?`Collapse`:`Expand`,children:s(t?d:f,{className:`h-3.5 w-3.5`})})]}),t&&s(`div`,{className:`border-t border-border px-3 pb-3 pt-2`,children:s(_e,{vehicleId:e.id})}),s(M,{open:g,onOpenChange:e=>!e&&y(!1),children:n(z,{children:[n(U,{children:[s(O,{children:`Delete vehicle`}),n(W,{children:[`Delete `,s(`strong`,{children:e.name}),` and all its plate samples? This cannot be undone.`]})]}),n(j,{children:[s(P,{variant:`secondary`,onClick:()=>y(!1),children:`Cancel`}),n(P,{variant:`danger`,onClick:k,disabled:S.isPending,children:[S.isPending?s(x,{className:`h-3.5 w-3.5 animate-spin`}):null,`Delete`]})]})]})})]})}function ye(){let e=a(),[t,r]=o(``),i=k();function c(){let n=t.trim();n&&i.mutate({name:n},{onSettled:()=>{e.invalidateQueries({queryKey:Q}),r(``)}})}return n(`div`,{className:`flex items-center gap-2 pt-2`,children:[s(I,{placeholder:`New vehicle name…`,value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},className:`h-7 text-xs flex-1`}),n(P,{variant:`primary`,size:`sm`,onClick:c,disabled:i.isPending||!t.trim(),children:[i.isPending?s(x,{className:`h-3.5 w-3.5 animate-spin`}):s(V,{className:`h-3.5 w-3.5`}),`Add`]})]})}function be(){let{data:e,isLoading:t}=N(),[r,i]=o(null);function a(e){i(t=>t===e?null:e)}return t?n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin`}),`Loading vehicles…`]}):n(`div`,{className:`space-y-2`,children:[(!e||e.length===0)&&s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No vehicles enrolled yet. Add one below.`}),e?.map(e=>s(ve,{vehicle:e,expanded:r===e.id,onToggle:()=>a(e.id)},e.id)),s(ye,{})]})}function xe(e){return e==null?null:e.cropUrl!==void 0&&e.cropUrl.length>0?e.cropUrl:e.base64!==void 0&&e.base64.length>0?`data:image/jpeg;base64,${e.base64}`:null}t();var Se=[[`plateGallery`]];function Ce({plateIds:e,vehicles:t,onDone:r}){let i=a(),c=g(),l=k(),[u,d]=o(``),[f,p]=o(!1),[m,h]=o(null),_=e!==null&&e.length>0,v=e?.length??0;function y(){p(!1),d(``),h(null)}function b(){y(),r()}function S(t){!e||e.length===0||c.mutate({plateIds:[...e],vehicleId:t},{onSettled:()=>{i.invalidateQueries({queryKey:Se}),b()}})}function C(){!e||!u.trim()||l.mutate({name:u.trim()},{onSuccess:e=>{e?.id&&S(e.id)},onError:()=>{i.invalidateQueries({queryKey:Se}),b()}})}let w=c.isPending||l.isPending;return s(M,{open:_,onOpenChange:e=>!e&&b(),children:n(z,{children:[n(U,{children:[s(O,{children:v>1?`Assign ${String(v)} plates to vehicle`:`Assign plate to vehicle`}),s(W,{children:`Select an existing vehicle or create a new one.`})]}),s(`div`,{className:`space-y-1 max-h-56 overflow-y-auto`,children:t.map(e=>n(`button`,{type:`button`,onClick:()=>h(e.id),className:`w-full rounded-md px-3 py-2 text-left text-xs transition-colors ${m===e.id?`bg-primary/12 text-primary`:`hover:bg-surface-hover text-foreground`}`,children:[s(`span`,{className:`font-medium`,children:e.name}),n(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.sampleCount,` plates`]})]},e.id))}),f?s(`div`,{className:`flex items-center gap-2 pt-2 border-t border-border`,children:s(I,{placeholder:`New vehicle name…`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()},autoFocus:!0,className:`flex-1`})}):s(`button`,{type:`button`,onClick:()=>{h(null),p(!0)},className:`mt-2 w-full rounded-md border border-dashed border-border px-3 py-2 text-left text-xs text-foreground-subtle hover:border-primary hover:text-primary transition-colors`,children:`+ New vehicle…`}),n(j,{children:[s(P,{variant:`secondary`,onClick:b,disabled:w,children:`Cancel`}),f?n(P,{variant:`primary`,onClick:C,disabled:w||!u.trim(),children:[w&&s(x,{className:`h-3.5 w-3.5 animate-spin`}),`Create & assign`]}):n(P,{variant:`primary`,onClick:()=>m&&S(m),disabled:w||!m,children:[w&&s(x,{className:`h-3.5 w-3.5 animate-spin`}),`Assign`,v>1?` ${String(v)}`:``]})]})]})})}t();var we=[[`plateGallery`]];function Te(e){let[t,n]=o(null),[r,i]=o(null),[a,s]=o(!1);return c(()=>{if(n(null),i(null),s(!1),e===void 0)return;let t=!1,r=null;return(async()=>{try{let i=await me(he(e));if(t)return;r=URL.createObjectURL(i),n(r)}catch{t||s(!0)}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),c(()=>{if(!t)return;let e=new Image;return e.onload=()=>i({width:e.naturalWidth,height:e.naturalHeight}),e.onerror=()=>s(!0),e.src=t,()=>{e.onload=null,e.onerror=null}},[t]),{frameSrc:t,naturalWidth:r?.width??null,naturalHeight:r?.height??null,failed:a}}function Ee(e){let t=e.filter(e=>e.url.length>0);return t.length===0?null:t.find(e=>/crop|plate/i.test(e.kind))??t[0]}function $({label:e,value:t,mono:r}){return n(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-border/60 last:border-0`,children:[s(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:e}),s(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-foreground ${r?`font-mono`:``}`,title:t,children:t})]})}function De({box:e}){return s(`div`,{className:`pointer-events-none absolute rounded-[3px] border-2 border-primary shadow-[0_0_0_9999px_rgba(0,0,0,0.28)]`,style:{left:`${String(e.x*100)}%`,top:`${String(e.y*100)}%`,width:`${String(e.width*100)}%`,height:`${String(e.height*100)}%`},children:s(`span`,{className:`absolute -top-4 left-0 rounded bg-primary px-1 text-[9px] font-semibold uppercase tracking-wide text-white`,children:`Plate`})})}function Oe({plate:e,cameraName:t,onClose:i,onAssign:l,onUnassign:d,onDelete:f,actionsPending:m}){let h=a(),{data:g,isFetching:v}=T({plateId:e?.plateId??``},{enabled:e!==null}),y=ee(),[b,C]=o(`frame`),[w,E]=o(!1),[D,O]=o(``),{frameSrc:k,naturalWidth:A,naturalHeight:j,failed:N}=Te(e?.keyFrameMediaId);c(()=>{E(!1),O(``),C(`frame`)},[e?.plateId]);let F=r(()=>{let t=Ee(g??[]);return t?t.url:xe(e)},[g,e]),L=r(()=>!e?.plateBbox||A===null||j===null?null:de(e.plateBbox,A,j),[e?.plateBbox,A,j]);if(e===null)return null;let V=e.keyFrameMediaId!==void 0&&!N,U=V&&b===`frame`,W=e.assigned?e.vehicleName??`Assigned`:e.recognizedVehicleId?`${e.vehicleName??`Recognized`} (suggested)`:`Unassigned`,G=`${String(Math.round(e.score*100))}%${e.corrected?` · corrected`:``}`;function q(){e&&(O(e.text),E(!0))}function J(){if(!e)return;let t=D.trim().toUpperCase();if(!t||t===e.text){E(!1);return}y.mutate({plateId:e.plateId,text:t},{onSettled:()=>{h.invalidateQueries({queryKey:we}),E(!1)}})}return s(M,{open:!0,onOpenChange:e=>!e&&i(),children:n(z,{width:`lg`,placement:`sheet-on-mobile`,"aria-label":`Plate detail`,className:`flex h-[92dvh] flex-col gap-0 overflow-hidden p-0 bottom-0 left-0 right-0 top-auto w-full max-w-full translate-x-0 translate-y-0 rounded-b-none md:bottom-auto md:left-1/2 md:right-auto md:top-1/2 md:h-auto md:w-[calc(100vw-2rem)] md:max-w-xl md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-lg md:max-h-[calc(100dvh-2rem)]`,children:[n(`header`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[n(`div`,{className:`min-w-0`,children:[s(`div`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`Plate detail`}),s(`div`,{className:`mt-0.5 truncate text-[11px] text-foreground-subtle`,children:t})]}),s(`button`,{type:`button`,onClick:i,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:s(B,{className:`h-4 w-4`})})]}),n(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-3`,children:[V&&n(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5 text-xs`,children:[n(`button`,{type:`button`,onClick:()=>C(`frame`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${b===`frame`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(R,{className:`h-3.5 w-3.5`}),` Full frame`]}),n(`button`,{type:`button`,onClick:()=>C(`crop`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${b===`crop`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(K,{className:`h-3.5 w-3.5`}),` Crop`]})]}),U&&k?s(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:s(X,{src:k,alt:`Full frame with detected plate`,fit:`natural`,className:`w-full`,overlay:L?s(De,{box:L}):void 0})}):F?n(`div`,{className:`relative aspect-[2/1] w-full overflow-hidden rounded-lg border border-border bg-background`,children:[s(X,{src:F,alt:`Detected plate`,className:`h-full w-full`}),v&&s(`div`,{className:`absolute right-2 top-2 rounded-full bg-black/50 p-1 text-white`,children:s(x,{className:`h-3.5 w-3.5 animate-spin`})})]}):n(`div`,{className:`flex aspect-[2/1] w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-border bg-warning/5 text-foreground-subtle`,children:[s(u,{className:`h-8 w-8 text-warning/70`}),s(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-warning/80`,children:`No image`}),s(`span`,{className:`px-6 text-center text-[10px] text-foreground-subtle`,children:`The crop media for this plate could not be resolved. Safe to delete.`})]}),s(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-2`,children:n(`div`,{className:`flex items-center justify-between gap-3`,children:[s(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:`Plate text`}),w?n(`div`,{className:`flex min-w-0 flex-1 items-center justify-end gap-1.5`,children:[s(I,{value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Enter`&&J(),e.key===`Escape`&&E(!1)},className:`h-7 max-w-[10rem] text-right font-mono text-xs uppercase`,autoFocus:!0}),s(`button`,{type:`button`,onClick:J,disabled:y.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Save corrected text`,children:y.isPending?s(x,{className:`h-3.5 w-3.5 animate-spin`}):s(H,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:()=>E(!1),className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel`,children:s(B,{className:`h-3.5 w-3.5`})})]}):n(`button`,{type:`button`,onClick:q,className:`group flex min-w-0 items-center gap-1.5`,title:`Correct the OCR reading`,children:[s(`span`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`—`}),s(_,{className:`h-3 w-3 shrink-0 text-foreground-subtle group-hover:text-foreground`})]})]})}),n(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-1`,children:[s($,{label:`Camera`,value:t}),s($,{label:`Captured`,value:ae(e.timestamp)}),s($,{label:`Confidence`,value:G}),s($,{label:`Vehicle`,value:W}),s($,{label:`Track`,value:e.trackId,mono:!0})]})]}),n(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:[e.assigned?n(P,{variant:`secondary`,onClick:()=>d(e.plateId),disabled:m,children:[s(Z,{className:`h-3.5 w-3.5`}),` Detach`]}):n(P,{variant:`primary`,onClick:()=>l(e.plateId),disabled:m,children:[s(S,{className:`h-3.5 w-3.5`}),` Assign`]}),n(P,{variant:`secondary`,onClick:()=>f(e.plateId),disabled:m,children:[s(p,{className:`h-3.5 w-3.5`}),` Delete`]})]})]})})}t();var ke=[[`plateGallery`]],Ae=500,je=120;function Me({plate:e,cameraName:t,nowMs:r,selected:i,onToggleSelect:o,onAssign:c,onOpenDetail:d}){let f=a(),m=E(),h=y(),g=()=>{f.invalidateQueries({queryKey:ke})},_=()=>d(e.plateId),v=xe(e);return n(`div`,{className:`relative flex flex-col overflow-hidden rounded-md border bg-surface ${i?`border-primary ring-1 ring-primary`:`border-border`}`,children:[n(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[v===null?n(`button`,{type:`button`,onClick:_,className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-warning/5 text-foreground-subtle`,title:`No crop image — the plate's crop media is missing. Safe to delete.`,children:[s(u,{className:`h-7 w-7 text-warning/70`}),s(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}):s(`img`,{src:v,alt:`Plate ${e.text} from ${t}`,onClick:_,className:`h-full w-full cursor-zoom-in object-cover`}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o(e.plateId)},className:`absolute left-0 top-0 z-10 rounded-br-md bg-black/50 p-1.5 text-white hover:bg-black/70`,"aria-label":i?`Deselect`:`Select`,children:i?s(Y,{className:`h-4 w-4 text-primary`}):s(l,{className:`h-4 w-4`})}),e.corrected&&n(`span`,{className:`absolute right-0 top-0 z-10 flex items-center gap-0.5 rounded-bl-md bg-primary/80 px-1 py-0.5 text-[8px] font-semibold uppercase tracking-wide text-white`,title:`Manually corrected`,children:[s(ge,{className:`h-3 w-3`}),` Fixed`]})]}),n(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[s(`p`,{className:`truncate font-mono text-xs font-bold tracking-wide text-foreground`,title:e.text,children:e.text||`—`}),s(`p`,{className:`truncate text-[10px] text-foreground-subtle`,title:t,children:t}),s(`p`,{className:`truncate text-[10px] text-foreground-subtle`,children:te(e.timestamp,r)}),e.vehicleName&&s(`p`,{className:`truncate text-[10px] font-medium text-primary`,title:e.vehicleName,children:e.vehicleName})]}),n(`div`,{className:`mt-1 flex items-center gap-0.5 border-t border-border/60 px-1 py-0.5`,children:[e.assigned?s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m.mutate({plateId:e.plateId},{onSettled:g})},disabled:m.isPending,className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-warning/10 hover:text-warning disabled:opacity-40`,"aria-label":`Detach plate`,title:`Detach`,children:m.isPending?s(x,{className:`h-4 w-4 animate-spin`}):s(Z,{className:`h-4 w-4`})}):s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c(e.plateId)},className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-primary/10 hover:text-primary`,"aria-label":`Assign plate to vehicle`,title:`Assign to vehicle`,children:s(S,{className:`h-4 w-4`})}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h.mutate({plateId:e.plateId},{onSettled:g})},disabled:h.isPending,className:`ml-auto rounded p-1.5 text-foreground-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40`,"aria-label":`Delete plate`,title:`Delete plate`,children:h.isPending?s(x,{className:`h-4 w-4 animate-spin`}):s(p,{className:`h-4 w-4`})})]})]})}var Ne=[{label:`All`,value:`all`},{label:`Unassigned`,value:`unassigned`},{label:`Assigned`,value:`assigned`}];function Pe(e,t){return t===`unassigned`?e.filter(e=>!e.assigned):t===`assigned`?e.filter(e=>e.assigned):e}function Fe(){let e=a(),[t,c]=o(`all`),[l,u]=o(se),[d,f]=o(new Set),[m,h]=o(new Set),[g,_]=o(null),[v,C]=o(null),{data:w,isLoading:T}=F({limit:Ae,includeCrops:!1},{refetchInterval:3e4}),{data:D=[]}=N(),{data:O}=L({isCamera:!0,projection:`slim`}),k=E(),A=b(),j=y(),M=Date.now(),I=w??[],R=r(()=>{let e=new Map;for(let t of O??[])e.set(t.id,t.name);return e},[O]),z=e=>R.get(e)??`Camera #${String(e)}`,ee=r(()=>J(I).map(e=>({id:e,name:z(e)})).sort((e,t)=>e.name.localeCompare(t.name)),[I,R]),V=r(()=>re(le(Pe(I,t),l),d),[I,t,l,d]),H=ie(V,je,r(()=>JSON.stringify([t,l.fromMs,l.toMs,[...d].sort((e,t)=>e-t)]),[t,l.fromMs,l.toMs,d])),U=r(()=>new Map(I.map(e=>[e.plateId,e])),[I]),W=v===null?null:U.get(v)??null,G=()=>{e.invalidateQueries({queryKey:ke})},K=()=>h(new Set);function te(e){h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let Y=[...m],X=A.isPending||j.isPending,ae=k.isPending||j.isPending;function ce(){Y.length!==0&&A.mutate({plateIds:Y},{onSettled:()=>{G(),K()}})}function ue(){Y.length!==0&&Promise.allSettled(Y.map(e=>j.mutateAsync({plateId:e}))).then(()=>{G(),K()})}function de(e){C(null),_([e])}function fe(e){k.mutate({plateId:e},{onSettled:G}),C(null)}function pe(e){j.mutate({plateId:e},{onSettled:G}),C(null)}let me=V.length!==I.length;return n(`div`,{className:`relative space-y-3`,children:[n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[s(`div`,{className:`flex items-center gap-1`,children:Ne.map(e=>s(`button`,{type:`button`,onClick:()=>c(e.value),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:e.label},e.value))}),s(oe,{onChange:u}),s(ne,{cameras:ee,selected:d,onChange:f}),!T&&s(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:me?`${String(V.length)} of ${String(I.length)} plates`:`${String(V.length)} plate${V.length===1?``:`s`}`})]}),m.size>0&&n(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[n(`span`,{className:`text-xs font-medium text-foreground`,children:[m.size,` selected`]}),n(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[n(P,{variant:`primary`,onClick:()=>_(Y),disabled:X,children:[s(S,{className:`h-3.5 w-3.5`}),` Assign`]}),n(P,{variant:`secondary`,onClick:ce,disabled:X,children:[A.isPending?s(x,{className:`h-3.5 w-3.5 animate-spin`}):s(Z,{className:`h-3.5 w-3.5`}),` `,`Detach`]}),n(P,{variant:`secondary`,onClick:ue,disabled:X,children:[s(p,{className:`h-3.5 w-3.5`}),` Delete`]}),s(P,{variant:`ghost`,onClick:K,disabled:X,children:s(B,{className:`h-3.5 w-3.5`})})]})]}),T&&n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin`}),` Loading plates…`]}),!T&&V.length===0&&s(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:I.length>0?`No plates match the current filters.`:`No plates recognized yet.`}),!T&&V.length>0&&n(i,{children:[s(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(9rem,1fr))] gap-2`,children:H.pageItems.map(e=>s(Me,{plate:e,cameraName:z(e.deviceId),nowMs:M,selected:m.has(e.plateId),onToggleSelect:te,onAssign:e=>_([e]),onOpenDetail:C},e.plateId))}),s(q,{currentPage:H.page,totalItems:H.totalItems,pageSize:H.pageSize,onPageChange:H.setPage,itemNoun:`plates`})]}),s(Oe,{plate:W,cameraName:W?z(W.deviceId):``,onClose:()=>C(null),onAssign:de,onUnassign:fe,onDelete:pe,actionsPending:ae}),s(Ce,{plateIds:g,vehicles:D,onDone:()=>{_(null),K()}})]})}t();var Ie=[[`plateGallery`]],Le=2e3;function Re(){let t=a(),n=e(t);n.current=t;let r=e(void 0);r.current||=ce({delayMs:Le,invalidate:()=>{n.current.invalidateQueries({queryKey:Ie})}}),c(()=>()=>r.current?.cancel(),[]),G(fe.PipelineAnalyticsPlateGalleryChanged,()=>{r.current?.trigger()})}function ze(){return Re(),s(pe,{icon:D,title:`Plates`,subtitle:`Manage enrolled vehicles and assign recognized license plates to them.`,children:n(`section`,{className:`space-y-3`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Vehicles`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`Enrolled vehicle identities used for plate recognition. Expand a row to view or remove plate samples.`}),s(be,{})]}),n(`div`,{className:`pt-4 border-t border-border`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Recent recognized plates`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`License plates read by the detection pipeline. Assign them to a vehicle, correct the OCR text, or delete.`}),s(Fe,{})]})]})})}export{ze as PlatesPage};
@@ -1 +0,0 @@
1
- import{I as e,Q as t,S as n,W as r,b as i,o as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{J as l,_t as u,at as d,st as f,vt as p}from"./player-overlays-D4lg_avJ.js";import{Bc as m,Fd as h,Hc as g,Hn as _,Lc as v,Ln as y,Mn as b,Nt as x,Pt as S,Qc as C,Rc as w,Uc as T,Vc as E,Wc as D,Wd as O,Wf as k,Xo as A,Yc as j,Zc as M,Zd as N,Zs as P,al as ee,ar as F,cl as te,cr as I,dl as ne,el as re,ff as ie,hu as L,if as ae,il as oe,kn as R,ll as se,ls as ce,nl as le,of as z,ol as ue,rl as de,sl as fe,ta as B,tc as pe,tl as me,ts as he,ul as ge,vu as V,wu as H,xs as _e,zc as ve,zu as U}from"./src-DtOnHh9r.js";import{c as ye,i as be,l as xe,n as Se,o as Ce,r as we,s as Te,t as Ee,u as De}from"./location-owned-usage-CuOFoDFT.js";import{t as Oe}from"./settings-2-DVqttbaa.js";import{pi as W}from"./client-BqN2lVYf.js";import{w as ke}from"./index-B6zMUwLj.js";import{t as Ae}from"./AdminPage-BSFohA3i.js";import{n as je}from"./authed-media-BbuEbo96.js";import{t as Me}from"./AdminTabs-DuLpA_8U.js";import{t as G}from"./format-size-DIxKXxtj.js";var Ne=p(`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`}]]),Pe=p(`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`}]]);t();var Fe=[{value:`all`,label:`All`},{value:`recording`,label:`Recordings`},{value:`events`,label:`Events`}],Ie={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},Le={columnKey:`at`,dir:`desc`};function Re(e){return new Date(e).toLocaleString()}function ze(){let[e,t]=o(`all`),{data:a,isLoading:c,isError:l}=ve({},{refetchOnWindowFocus:!1}),{data:u,isLoading:d,isError:f}=ce({},{refetchOnWindowFocus:!1}),{data:p}=B({isCamera:!0,projection:`slim`}),m=r(()=>{let e=new Map;for(let t of p??[])e.set(t.id,t.name);return e},[p]),g=r(()=>{let t=[...a??[],...u??[]];return(e===`all`?t:t.filter(t=>t.domain===e)).toSorted((e,t)=>t.at-e.at)},[a,u,e]),_=r(()=>{let t=[];return l&&e!==`events`&&t.push(`Recordings`),f&&e!==`recording`&&t.push(`Events`),t},[l,f,e]),v=r(()=>[{key:`at`,header:`When`,nowrap:!0,sortValue:e=>e.at,render:e=>s(`span`,{className:`text-foreground-subtle tabular-nums`,children:Re(e.at)})},{key:`domain`,header:`Domain`,sortValue:e=>e.domain,render:e=>s(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${Ie[e.domain]}`,children:e.domain})},{key:`op`,header:`Operation`,sortValue:e=>e.op,render:e=>s(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:`Reason`,sortValue:e=>e.reason,render:e=>s(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:`Camera`,sortValue:e=>e.deviceId===null?`cluster`:m.get(e.deviceId)??`#${String(e.deviceId)}`,render:e=>e.deviceId===null?s(`span`,{className:`text-foreground-subtle`,children:`cluster`}):s(`span`,{className:`text-foreground`,children:m.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:`Items`,align:`right`,nowrap:!0,sortValue:e=>e.itemsAffected,render:e=>s(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:`Reclaimed`,align:`right`,nowrap:!0,sortValue:e=>e.bytesReclaimed,render:e=>s(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?G(e.bytesReclaimed):`—`})}],[m]),y=c||d;return n(`div`,{className:`flex flex-col gap-4`,children:[s(`div`,{className:`flex items-center gap-1`,children:Fe.map(n=>s(`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))}),y&&g.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(h,{className:`h-4 w-4 animate-spin`}),`Loading activity…`]}):g.length===0?_.length>0?s(R,{icon:U,title:`Activity could not be read`,description:`The ${_.join(` and `)} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`}):s(R,{icon:k,title:`No activity yet`,description:`Prune, delete and rescan operations across recordings and events show up here.`}):n(i,{children:[_.length>0&&n(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[s(U,{className:`h-3 w-3 shrink-0`}),_.join(` and `),` did not answer — rows from`,` `,_.length===1?`that domain`:`those domains`,` are missing below.`]}),s(x,{columns:v,rows:g,rowKey:e=>e.id,minWidthPx:720,mobileMode:`scroll`,maxBodyHeight:S,defaultSort:Le})]})]})}t();function Be(){let e=B({isCamera:!0,projection:`slim`}),t=r(()=>(e.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[e.data]),[i,a]=o(null),c=i??t[0]?.id??null;return!e.isLoading&&t.length===0?s(R,{icon:u,title:`No cameras`,description:`Add a camera first.`}):n(`div`,{className:`space-y-3`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Per-camera recording & retention`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`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.`})]}),n(`div`,{className:`flex items-center gap-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),s(`select`,{value:c??``,onChange:e=>a(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:t.map(e=>s(`option`,{value:e.id,children:e.name},e.id))})]}),c!==null&&s(y,{deviceId:c,children:s(ke,{deviceId:c,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},c)]})}t();function Ve({types:e}){let t=a(),i=_(),{data:c}=C({}),l=M(),u=r(()=>l.data??[],[l.data]),{data:d}=w({},{refetchOnWindowFocus:!1}),f=r(()=>Ee(c??[],d?.locations),[c,d?.locations]),[p,m]=o(null),[h,g]=o(null),v=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},y=ne({onSuccess:v}),b=j({onSuccess:v}),x=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]),S=async(e,t)=>{xe(t)&&!await i({title:`Disable "${e.displayName}"?`,message:`${ye(t).consequence}\n\nNothing is deleted — set the location back to Read-only or Active to bring its footage back.`,confirmLabel:`Disable`,variant:`danger`})||y.mutate(Te(e,{mode:t}))},T=async e=>{if(await i({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`}))try{await b.mutateAsync({id:e.id})}catch(t){await i({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`})&&b.mutate({id:e.id,force:!0})}},E=e.map(e=>u.find(t=>t.id===e)).filter(e=>e!==void 0);return n(`div`,{className:`space-y-3`,children:[E.length===0?s(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):E.map(e=>s(Se,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:x.get(e.id)??[],onAdd:e=>m(e),onEdit:e=>g(e),onDelete:e=>{T(e)},ownedBytesById:f,onSetMode:(e,t)=>{S(e,t)}},e.id)),p!==null&&s(De,{initialType:p,onClose:()=>m(null),onCreated:()=>{v(),m(null)}}),h!==null&&s(Ce,{location:h,onClose:()=>g(null),onSaved:()=>{v(),g(null)}})]})}t();var He=`pipeline-analytics`;function Ue(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 We(){let e=a(),{nodes:t}=L(),{data:i,isLoading:o}=F({addonId:He}),c=Ue(i),l=I({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:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),s(`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:[o?s(h,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:He,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=>s(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&s(h,{className:`h-4 w-4 animate-spin text-primary`})]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),s(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),s(Ve,{types:[`eventMedia`]})]})]})}t();var Ge=[[`pipelineAnalytics`]],Ke=1440*60*1e3;function qe(e,t){return t.get(e)??`Removed camera #${String(e)}`}var Je=[{days:1,label:`1 day`},{days:7,label:`7 days`},{days:30,label:`30 days`},{days:90,label:`90 days`}];function Ye(){let t=a(),i=_(),[c,u]=o(30),[d,p]=o(null),{data:m,isLoading:g}=he({},{refetchOnWindowFocus:!1}),{data:v}=B({isCamera:!0,projection:`slim`}),y=r(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),b=e(()=>{t.invalidateQueries({queryKey:Ge})},[t]),S=_e({onSuccess:b}),C=A(),w=e(async()=>{await i({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`})&&S.mutate({olderThanMs:Date.now()-c*Ke,reason:`retention`})},[i,S,c]),T=e(async e=>{let t=qe(e.deviceId,y);if(await i({title:`Delete all events for ${t}?`,message:`Permanently deletes ${String(e.rows)} event${e.rows===1?``:`s`} (${G(e.bytes)} of media) for this camera. This cannot be undone.`,confirmLabel:`Delete events`,variant:`danger`})){p(null);try{let n=await C.mutateAsync({deviceId:e.deviceId});b();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){p(`0 events deleted for ${t}. Media still listed (${G(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}p(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){p(e instanceof Error?e.message:String(e))}}},[i,C,y,b]),E=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:qe(e.deviceId,y)})},{key:`rows`,header:`Events`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:`Media`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:G(e.bytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`button`,{onClick:()=>{T(e)},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:`Delete all events for this camera`,children:[s(f,{className:`h-3 w-3`}),`Delete`]})}],[y,T,C.isPending]);return g&&!m?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(h,{className:`h-4 w-4 animate-spin`}),`Loading event-store footprint…`]}):m?n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[s(l,{label:`Total events`,icon:s(z,{className:`h-3 w-3`}),footer:`across ${String(m.devices.length)} camera${m.devices.length===1?``:`s`}`,children:m.totalRows.toLocaleString()}),s(l,{label:`Event media on disk`,children:G(m.totalBytes)})]}),n(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[s(`span`,{className:`text-foreground-subtle`,children:`Prune events older than`}),s(`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:Je.map(e=>s(`option`,{value:e.days,children:e.label},e.days))}),n(`button`,{onClick:()=>{w()},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-amber-500/10 hover:text-amber-500 disabled:opacity-50`,children:[S.isPending?s(h,{className:`h-3 w-3 animate-spin`}):s(Pe,{className:`h-3 w-3`}),`Prune now`]})]}),m.devices.length===0?s(R,{icon:z,title:`No stored events`,description:`No camera has persisted events yet.`}):s(x,{columns:E,rows:[...m.devices],rowKey:e=>e.deviceId,minWidthPx:480}),d===null?null:s(`p`,{className:d.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:d})]}):s(R,{icon:z,title:`No event data`,description:`Pipeline analytics has not reported any event-store footprint yet.`})}function Xe(){return n(`div`,{className:`flex flex-col gap-8`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Event store`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`What the durable event store occupies, per camera, with fleet-wide prune-by-age and delete-all-events.`}),s(`div`,{className:`mt-3`,children:s(Ye,{})})]}),n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node & folders`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that writes event crops, and the storage location they land in.`}),s(`div`,{className:`mt-3`,children:s(We,{})})]})]})}function Ze(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 Qe(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function $e(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`${Qe(e)} · ${o}`}function et(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 tt(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 nt=[`high`,`mid`,`low`],rt=[{value:1,label:`Real time (1×)`},{value:2,label:`2×`},{value:4,label:`4×`},{value:8,label:`8×`},{value:16,label:`16×`}],it=10080*60*1e3;function at(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 ot({onClose:e,onCreated:t}){let i=B({isCamera:!0,projection:`slim`}),a=r(()=>(i.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[i.data]),[c,l]=o(``),[u,d]=o(`high`),[f,p]=o(at(60)),[m,h]=o(at(0)),[_,v]=o(1),[y,b]=o(!0),[x,S]=o(``),[C,w]=o(null),T=c===``?a[0]?.id??null:c,E=new Date(f).getTime(),D=new Date(m).getTime(),O=Number.isFinite(E)&&Number.isFinite(D)&&E<D,k=g({onSuccess:()=>{t(),e()},onError:e=>w(e instanceof Error?e.message:String(e))});return s(`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:[s(N,{className:`h-3.5 w-3.5`}),`New export`]}),s(`button`,{onClick:e,className:`text-foreground-subtle hover:text-foreground`,children:s(H,{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:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),s(`select`,{value:T??``,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:a.map(e=>s(`option`,{value:e.id,children:e.name},e.id))})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Profile`}),s(`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:nt.map(e=>s(`option`,{value:e,children:e},e))})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`From`}),s(`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:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`To`}),s(`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:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Speed`}),s(`select`,{value:_,onChange:e=>v(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:rt.map(e=>s(`option`,{value:e.value,children:e.label},e.value))})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Title (optional)`}),s(`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:[s(`input`,{type:`checkbox`,checked:y,disabled:_!==1,onChange:e=>b(e.target.checked),className:`accent-primary`}),`Include audio`,_===1?``:` (real-time only)`]}),!O&&s(`p`,{className:`text-[11px] text-danger`,children:`"From" must be before "To".`}),C&&s(`p`,{className:`text-[11px] text-danger`,children:C})]}),n(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[s(`button`,{onClick:e,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground`,children:`Cancel`}),s(`button`,{onClick:()=>{if(T===null||!O)return;w(null);let e=x.trim();k.mutate({deviceId:T,profile:u,fromMs:E,toMs:D,options:{includeAudio:y,maxLifeMs:it,deleteAfterDownload:!1,..._===1?{}:{speed:_},...e.length>0?{title:e}:{}}})},disabled:T===null||!O||k.isPending,className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:k.isPending?`Queuing…`:`Create export`})]})]})})}t();var st=[[`recordingExport`]],ct={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 lt(){let{data:e,isLoading:t}=D({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:n}=V(W.RecordingExportProgress,e=>e.exportId),{map:i}=V(W.RecordingExportCompleted,e=>e.exportId),{map:a}=V(W.RecordingExportFailed,e=>e.exportId);return{rows:r(()=>tt(e??[],n,i,a),[e,n,i,a]),isLoading:t}}function ut(e){let[t,n]=o(()=>Date.now());return c(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function dt(){let t=a(),[i,c]=o(!1),l=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},u=_(),p=d().trpcClient,m=ut(6e4),{rows:g,isLoading:v}=lt(),{data:y}=B({isCamera:!0,projection:`slim`}),b=r(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),S=e(()=>{t.invalidateQueries({queryKey:st})},[t]),C=E({onSuccess:S}),w=T({onSuccess:S}),[D,O]=o(null),k=e(async e=>{O(e.id);try{let{url:t}=await p.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await je(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),S()}finally{O(null)}},[p,S]),A=e(async e=>{await u({title:`Cancel this export?`,message:`Stops the render. The partial file is discarded.`,confirmLabel:`Cancel export`,variant:`danger`})&&C.mutate({exportId:e.id})},[u,C]),j=e(async e=>{await u({title:`Delete this export?`,message:`Permanently removes the rendered file and its history row.`,confirmLabel:`Delete`,variant:`danger`})&&w.mutate({exportId:e.id})},[u,w]),M=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:b.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:`Range`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:$e(e.fromMs,e.toMs)})},{key:`variant`,header:`Variant`,render:e=>s(`span`,{className:`text-foreground-subtle`,children:Ze(e.options)})},{key:`state`,header:`State`,render:e=>{let t=ct[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&&s(h,{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`?s(`span`,{className:`text-foreground-subtle`,children:`—`}):s(`span`,{className:`text-foreground-subtle tabular-nums`,children:et(e.expiresAt,m)})},{key:`size`,header:`Size`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:G(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:()=>{k(e)},disabled:D===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:[D===e.id?s(h,{className:`h-3 w-3 animate-spin`}):s(ae,{className:`h-3 w-3`}),`Download`]}),r&&n(`button`,{onClick:()=>{A(e)},disabled:C.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:[s(ie,{className:`h-3 w-3`}),`Cancel`]}),i&&s(`button`,{onClick:()=>{j(e)},disabled:w.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:s(f,{className:`h-3 w-3`})})]})}}],[b,m,D,C.isPending,w.isPending,k,A,j]);return v&&g.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(h,{className:`h-4 w-4 animate-spin`}),`Loading exports…`]}):n(`div`,{className:`space-y-3`,children:[s(`div`,{className:`flex justify-end`,children:n(`button`,{onClick:()=>c(!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:[s(N,{className:`h-3.5 w-3.5`}),`New export`]})}),g.length===0?s(R,{icon:N,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.`}):s(x,{columns:M,rows:g,rowKey:e=>e.id,minWidthPx:720}),i&&s(ot,{onClose:()=>c(!1),onCreated:l})]})}var ft=`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`;t();var pt=`storage-migration`,mt=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function ht(e){return[`${e.orphansReclaimed} orphan rows (${G(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${G(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${G(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function gt(){let e=b(pt);return e===`pending`?null:e===`unknown`?s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`Could not check whether storage cleanup is installed on this hub.`}):e===`present`?s(_t,{}):null}function _t(){let e=_(),[t,r]=o(!1),[i,a]=o(null),c=de({},{refetchInterval:2e3}),l=c.data??null,u=l!==null&&mt.has(l.phase),d=le(),p=me(),m=async()=>{if(await e({title:`Run storage cleanup?`,message:t?`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`:`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`,confirmLabel:`Run cleanup`,variant:`danger`})){a(null);try{await d.mutateAsync({includeDebugMedia:t}),await c.refetch()}catch(e){a(e instanceof Error?e.message:String(e))}}},g=async()=>{if(l&&await e({title:`Cancel cleanup?`,message:`Stops after the current step. Work already done stays done.`,confirmLabel:`Cancel cleanup`,variant:`danger`}))try{await p.mutateAsync({jobId:l.jobId}),await c.refetch()}catch{}};return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Cleanup`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`One pass over leftover analytics (database + files) and ghost footage rows on frozen locations. Does not time out — progress updates here until it finishes.`}),n(`label`,{className:`mt-3 flex items-start gap-2 text-[11px] text-foreground`,children:[s(`input`,{type:`checkbox`,checked:t,disabled:u,onChange:e=>{r(e.target.checked)},className:`mt-0.5 h-3.5 w-3.5 accent-primary`}),s(`span`,{children:`Also remove debug media (motion stills and track filmstrips)`})]}),n(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[n(`button`,{type:`button`,disabled:u||d.isPending,onClick:()=>{m()},className:ft,children:[(u||d.isPending)&&s(h,{className:`h-3 w-3 animate-spin`}),s(f,{className:`h-3 w-3`}),`Run cleanup`]}),u&&s(`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:`Cancel`})]}),i&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:i}),l&&n(`div`,{className:`mt-3 space-y-1 rounded-md border border-border px-2.5 py-2`,children:[n(`p`,{className:`text-xs text-foreground`,children:[`Phase: `,s(`span`,{className:`font-medium`,children:l.phase}),u&&s(h,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),l.detail&&s(`p`,{className:`text-[11px] text-foreground-subtle`,children:l.detail}),s(`p`,{className:`text-[11px] text-foreground-subtle`,children:ht(l)}),l.error&&s(`p`,{className:`text-[11px] text-danger`,children:l.error})]})]})}t();var vt=2e3;function yt(){let e=_(),t=a(),r=pe(),i=P(void 0,{refetchInterval:e=>e.state.data?.state===`running`?vt:!1}),o=i.data,l=o?.state===`running`,u=l||r.isPending;c(()=>{o?.state!==`done`||o.finishedAtMs===null||(t.invalidateQueries({queryKey:[[`recording`]]}),t.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[o?.state,o?.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 i.refetch())},f=l?o.total>0?`Reconciling ${String(o.completed)}/${String(o.total)}…`:`Reconciling…`:r.isPending?`Reconciling…`:`Reconcile from disk`;return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Disk reconcile`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Deletes database rows whose files are gone. Enrolled identities stay.`}),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?s(h,{className:`h-3.5 w-3.5 animate-spin`}):s(O,{className:`h-3.5 w-3.5`}),f]}),o?.state===`done`?n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Last run: `,String(o.completed),` camera(s) — dropped `,String(o.tracks),` tracks,`,` `,String(o.events),` events, `,String(o.mediaDropped),` media`,o.failed.length>0?`, ${String(o.failed.length)} failed (${o.failed.join(`, `)})`:``,`.`]}):null,o?.state===`error`&&o.error!==null?n(`p`,{className:`text-[11px] text-destructive`,children:[`Reconcile failed: `,o.error]}):null]})]})}var K=1e3,q=60*K,J=60*q;function Y(e){return e.toLocaleString(`en-US`)}function bt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=J){let t=Math.floor(e/J),n=Math.round(e%J/q);return`${t.toString()}h ${n.toString()}m`}if(e>=q){let t=Math.floor(e/q),n=Math.round(e%q/K);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/K)).toString()}s`}function xt(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${Y(e.filesMoved)} files`:`${Y(e.filesMoved)} / ${Y(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?`${G(e.bytesMoved/t*K)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${bt(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${G(e.bytesMoved)} moved`,rate:a,eta:s}}function St(e){let t=xt(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}t();var Ct=`storage-migration`,X=[{id:`recordings`,label:`Recordings`,locationType:`recordings`},{id:`recordingsLow`,label:`Low-res recordings`,locationType:`recordingsLow`},{id:`eventMedia`,label:`Event media`,locationType:`eventMedia`}],wt=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function Tt(){let e=b(Ct);return e===`pending`?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(h,{className:`h-4 w-4 animate-spin`}),`Checking whether storage migration is installed…`]}):e===`unknown`?s(R,{icon:U,title:`Couldn't check whether storage migration is installed`,description:`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.`}):e===`absent`?s(R,{icon:Ne,title:`Storage migration not installed`,description:`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.`}):s(Et,{})}function Et(){let e=_(),{data:t}=C({}),[i,a]=o({}),[c,l]=o({}),[u,d]=o(null),[f,p]=o(null),m=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]),g=r(()=>{let e=new Map;for(let n of t??[]){if(n.enabled===!1)continue;let t=e.get(n.type);t?t.push(n.id):e.set(n.type,[n.id])}let n=new Map;for(let[t,r]of e)r.length===1&&n.set(t,r[0]);return n},[t]),v=ge({},{refetchInterval:2e3}),y=v.data??null,b=y!==null&&wt.has(y.phase),x=r(()=>{let e={};for(let t of X){let n=i[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i]),S=r(()=>{let e={};for(let t of X){if(!i[t.id])continue;let n=c[t.id]??g.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i,c,g]),w=r(()=>({destinations:x??{},...S?{sources:S}:{}}),[x,S]),T=fe(w,{enabled:!1,retry:!1}),E=se(),D=re(),O=async()=>{if(!x)return;p(null);let e=await T.refetch();if(e.error){p(e.error instanceof Error?e.error.message:String(e.error));return}d(e.data??null)},k=async()=>{if(x&&await e({title:`Start storage migration?`,message:`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:`Start migration`,variant:`danger`})){p(null);try{await E.mutateAsync(w),d(null),await v.refetch()}catch(e){p(e instanceof Error?e.message:String(e))}}},A=async()=>{if(y&&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 D.mutateAsync({jobId:y.jobId}),await v.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:[s(Ne,{className:`h-3.5 w-3.5`}),`Storage migration`]}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`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.`}),s(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:X.map(e=>{let t=m.get(e.locationType)??[],r=g.get(e.locationType)??``;return n(`div`,{className:`space-y-2`,children:[s(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e.label}),n(`div`,{className:`space-y-1`,children:[n(`label`,{htmlFor:`migration-from-${e.id}`,className:`text-[10px] text-foreground-subtle`,children:[e.label,` from`]}),s(`select`,{id:`migration-from-${e.id}`,value:c[e.id]??r,onChange:t=>{let n=t.target.value;l(t=>({...t,[e.id]:n}))},disabled:b,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:t.map(e=>n(`option`,{value:e.id,children:[e.displayName,e.enabled===!1?` (read-only)`:``]},e.id))})]}),n(`div`,{className:`space-y-1`,children:[n(`label`,{htmlFor:`migration-dest-${e.id}`,className:`text-[10px] text-foreground-subtle`,children:[e.label,` to`]}),n(`select`,{id:`migration-dest-${e.id}`,value:i[e.id]??``,onChange:t=>{let n=t.target.value;a(t=>({...t,[e.id]:n}))},disabled:b,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:[s(`option`,{value:``,children:`— skip —`}),t.map(e=>s(`option`,{value:e.id,children:e.displayName},e.id))]})]})]},e.id)})}),f&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:f}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[n(`button`,{type:`button`,onClick:()=>{O()},disabled:!x||T.isFetching||b,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:[T.isFetching&&s(h,{className:`h-3 w-3 animate-spin`}),`Plan`]}),n(`button`,{type:`button`,onClick:()=>{k()},disabled:!x||E.isPending||b,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:[E.isPending&&s(h,{className:`h-3 w-3 animate-spin`}),`Start migration`]})]}),u&&s(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:u.moves.length===0?s(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:`Nothing to move — selected destinations match the current defaults.`}):u.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}`))}),y&&n(`div`,{className:`mt-4 border-t border-border pt-3`,children:[n(`div`,{className:`flex items-center justify-between`,children:[s(`h4`,{className:`text-xs font-semibold text-foreground`,children:`Migration status`}),b&&n(`button`,{type:`button`,onClick:()=>{A()},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:[s(H,{className:`h-3 w-3`}),`Cancel`]})]}),n(`p`,{className:`mt-1 text-xs text-foreground`,children:[`Phase: `,s(`span`,{className:`font-medium`,children:y.phase}),b&&s(h,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),y.error&&s(`p`,{className:`mt-1 text-[11px] text-danger`,children:y.error}),y.pausedParticipants.length>0&&n(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[`Paused: `,y.pausedParticipants.join(`, `)]}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:y.moves.map(e=>s(Dt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),s(Ot,{})]}),s(kt,{running:b}),s(jt,{})]})}function Dt({move:e}){let t=e.progress===null?null:xt(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&&s(`div`,{className:`h-1 w-full overflow-hidden rounded bg-border`,children:s(`div`,{className:`h-full bg-primary`,style:{width:`${(t.fraction*100).toFixed(1)}%`}})}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:St(e.progress)})]})]})}function Ot(){let{data:e}=ee({});return!e||e.length===0?null:n(`div`,{className:`mt-4 border-t border-border pt-3`,children:[s(`h4`,{className:`text-xs font-semibold text-foreground`,children:`Migration history`}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:e.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:[s(`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 kt({running:e}){let t=_(),r=te({},{staleTime:1/0,refetchOnWindowFocus:!1}),i=oe(),[a,c]=o(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:[n(`div`,{className:`flex items-start justify-between gap-2`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Left on the old location`}),n(`div`,{className:`flex shrink-0 items-center gap-2`,children:[s(`span`,{className:`text-[10px] text-foreground-subtle`,children:r.dataUpdatedAt>0?`Measured ${new Date(r.dataUpdatedAt).toLocaleTimeString()}`:`Measured — never`}),s(`button`,{type:`button`,onClick:()=>{r.refetch()},disabled:r.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:r.isFetching?`Counting…`:`Refresh`})]})]}),s(`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(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:`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.`}),a&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:a}),s(`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,s(`span`,{className:`ml-2 text-foreground-subtle`,children:At(t)})]}),s(`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 At(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 · ${G(e.bytes)}`}function jt(){let{data:e}=ue({},{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:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Movers running outside a migration`}),s(`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]}),s(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:St({filesMoved:e.job.filesMoved,filesTotal:e.job.filesTotal,bytesMoved:e.job.bytesMoved,startedAt:e.job.startedAt,observedAt:e.observedAt})})]},e.job.jobId))})]})}function Mt(){return n(`div`,{className:`flex flex-col gap-4`,children:[s(gt,{}),s(yt,{}),n(`section`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Move storage`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Copy recordings, low-res recordings or event media to a new location, verify, then repoint the default. Applies to every camera.`}),s(`div`,{className:`mt-3`,children:s(Tt,{})})]})]})}t();var Nt=`recorder`;function Pt(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 Ft(){let e=a(),{nodes:t}=L(),{data:i,isLoading:o}=F({addonId:Nt}),c=Pt(i,`recordingNodeId`,`hub`),l=I({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:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),s(`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:[o?s(h,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:Nt,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=>s(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&s(h,{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`,` `,s(`span`,{className:`font-medium`,children:c}),`. If the auto-derived host doesn't work, set the recorder's`,s(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),s(`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.`}),s(Ve,{types:[`recordings`,`recordingsLow`]})]})]})}function Z(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function It(e,t){let n=Z(e);return n.length===0?`default root`:n.map(e=>t.get(e)??e).join(` + `)}function Lt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:It(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Z(e).includes(n));return i===void 0?null:{label:It(i,t),exact:!1}}t();var Rt=[[`recording`]],zt=[{value:`retention`,label:`Retention policy`},{value:`quota`,label:`Quota / disk pressure`},{value:`operator`,label:`Operator`}],Bt={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Q={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function Vt(e){return e==null?`—`:new Date(e).toLocaleString()}function Ht(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 Ut(){let t=a(),i=_(),[c,u]=o(`retention`),{data:d,isLoading:p}=w({},{refetchOnWindowFocus:!1}),{data:g}=B({isCamera:!0,projection:`slim`}),{data:y}=C({}),b=r(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.name);return e},[g]),S=r(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.displayName);return e},[y]),T=r(()=>{let e=y??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[y]),E=r(()=>d?.locations??[],[d?.locations]),D=r(()=>Lt(E,S,T),[E,S,T]),k=r(()=>be(E),[E]),A=e(()=>{t.invalidateQueries({queryKey:Rt})},[t]),j=m({onSuccess:A}),M=v({onSuccess:A}),N=e(async e=>{await i({title:`Prune ${b.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`})&&j.mutate({deviceId:e.deviceId,reason:c})},[i,j,c,b]),P=e(async e=>{await i({title:`Delete all footage for ${b.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${G(e.usedBytes)} of recorded footage for this camera. This cannot be undone.`,confirmLabel:`Delete ${G(e.usedBytes)}`,variant:`danger`})&&M.mutate({deviceId:e.deviceId})},[i,M,b]),ee=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:b.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:`Disk`,nowrap:!0,render:()=>D===null?s(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:D.exact?`text-foreground`:`text-foreground-subtle`,title:D.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:[D.label,!D.exact&&s(`span`,{className:`ml-1 text-foreground-subtle`,children:`(default)`})]})},{key:`used`,header:`Used`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:G(e.usedBytes)})},{key:`oldest`,header:`Oldest footage`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums text-foreground-subtle`,title:`The oldest segment the ARCHIVE holds for this camera — the per-camera answer to 'is retention actually holding?'.`,children:Vt(e.oldestMs)})},{key:`actions`,header:``,align:`right`,render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[n(`button`,{onClick:()=>{N(e)},disabled:j.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:[s(Pe,{className:`h-3 w-3`}),`Prune`]}),n(`button`,{onClick:()=>{P(e)},disabled:M.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:[s(f,{className:`h-3 w-3`}),`Delete`]})]})}],[b,D,N,P,j.isPending,M.isPending]);if(p&&!d)return n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(h,{className:`h-4 w-4 animate-spin`}),`Loading storage usage…`]});if(!d)return s(R,{icon:O,title:`No storage data`,description:`The recording node has not reported any storage usage yet.`});let F=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:[s(l,{label:`Total used`,icon:s(O,{className:`h-3 w-3`}),footer:`${String(F)} camera${F===1?``:`s`} on ${d.nodeId}`,children:G(d.totalUsedBytes)}),k!==null&&k.severity!==null&&s(l,{label:`Free on recordings volumes`,icon:s(O,{className:`h-3 w-3`}),footer:`across ${String(k.knownVolumes)} volume${k.knownVolumes===1?``:`s`} of ${G(k.totalBytes)}`+(k.unknownVolumes>0?` · ${String(k.unknownVolumes)} did not report capacity`:``),children:s(`span`,{className:`tabular-nums ${Q[k.severity]}`,children:G(k.freeBytes)})}),E.map(e=>{let t=we(e),r=e.locationId??e.root??`default`;return s(l,{label:`Disk: ${Ht(e,S)}`,footer:t===null?`${G(e.usedBytes)} of recordings · volume capacity unknown`:`${G(t.freeBytes)} free of ${G(t.totalBytes)} · ${G(e.usedBytes)} recordings (${$(t.recordingsFraction)})`,children:t===null?s(`span`,{className:`tabular-nums`,children:G(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:[s(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:s(`div`,{className:`h-full rounded ${Bt[t.severity]}`,style:{width:$(t.fraction)}})}),s(`span`,{className:`tabular-nums text-xs ${Q[t.severity]}`,children:$(t.fraction)})]})},r)})]}),n(`section`,{className:`flex items-center gap-2 text-xs`,children:[s(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:`Prune reason`}),s(`select`,{id:`prune-reason`,value:c,onChange:e=>{let t=zt.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:zt.map(e=>s(`option`,{value:e.value,children:e.label},e.value))})]}),F===0?s(R,{icon:O,title:d.devicesRead===`unavailable`?`Per-camera usage unavailable`:`No recorded footage`,description:d.devicesRead===`unavailable`?`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.`:`No camera has recorded footage on this node yet.`}):s(x,{columns:ee,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Wt(){return n(`div`,{className:`flex flex-col gap-8`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Footage on disk`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`What recorded footage occupies, per camera and per volume, with prune-by-policy and delete-all-footage.`}),s(`div`,{className:`mt-3`,children:s(Ut,{})})]}),n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Recording node & folders`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records and serves playback, and the storage locations footage is written to.`}),s(`div`,{className:`mt-3`,children:s(Ft,{})})]})]})}function Gt(){return s(Ae,{icon:N,title:`Recordings`,subtitle:`Recorded footage and the durable event store — what each occupies, where it is written, and the operations that move or reconcile both.`,children:s(Me,{tabs:[{id:`storage`,label:`Recordings`,icon:O,content:s(Wt,{})},{id:`events`,label:`Events`,icon:z,content:s(Xe,{})},{id:`cameras`,label:`Cameras`,icon:u,content:s(Be,{})},{id:`exports`,label:`Export`,icon:N,content:s(dt,{})},{id:`activity`,label:`Activity`,icon:k,content:s(ze,{})},{id:`management`,label:`Management`,icon:Oe,content:s(Mt,{})}]})})}export{Gt as RecordingsPage};
@@ -1 +0,0 @@
1
- import{Q as e,S as t,W as n,X as r,q as i,x as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{c as o,f as s,l as c,u as l}from"./player-overlays-D4lg_avJ.js";import{An as u,Nt as d,Pt as f,Sn as p,Tn as m,Xn as h,_n as g,gn as _,jn as v,t as y,ta as b,vn as x,xd as S,xn as C,yn as w}from"./src-DtOnHh9r.js";import{Q as T}from"./index-B6zMUwLj.js";import{t as E}from"./AdminPage-BSFohA3i.js";import{t as D}from"./use-scenes-feed-DDyjv_py.js";e();function O(e){return e.states.length===0?3:e.latched?0:e.verdict===`diverged`?1:e.verdict===`unknown`?2:4}function k(e){let t=[e.divergedAt,e.restoredAt].filter(e=>typeof e==`number`);return t.length===0?null:Math.max(...t)}function A(e,t){let n=new Map(e.map(e=>[e.deviceId,e.deviceName])),r=[];for(let e of t)for(let t of e.monitors)r.push({deviceId:e.deviceId,deviceName:n.get(e.deviceId)??`Camera ${e.deviceId}`,monitor:t});return r.toSorted((e,t)=>{let n=O(e.monitor)-O(t.monitor);if(n!==0)return n;let r=k(e.monitor)??-1,i=k(t.monitor)??-1;if(r!==i)return i-r;let a=e.deviceName.localeCompare(t.deviceName);return a===0?e.monitor.label.localeCompare(t.monitor.label):a})}var j={alarm:`danger`,ok:`success`,unknown:`default`};function M(e,t){let n=k(e);return n===null?`—`:`${l(Math.max(0,t-n))} ago`}function N(){let e=b({isCamera:!0,projection:`slim`}),l=n(()=>(e.data??[]).map(e=>({deviceId:e.id,deviceName:e.name})).sort((e,t)=>e.deviceName.localeCompare(t.deviceName)),[e.data]),O=n(()=>l.map(e=>e.deviceId),[l]),k=D(O),N=n(()=>A(l,k.results),[l,k.results]),[P,F]=i(null),[I,L]=i(null),R=Date.now(),z=l.find(e=>e.deviceId===P)?.deviceName??``;return t(E,{icon:T,title:`Scenes`,subtitle:`A scene watches one region of one camera and tells you when it stops looking like the picture you captured — a wheelie bin, a gate, a parking space.`,actions:t(v,{onClick:()=>L(O[0]??null),disabled:l.length===0,children:[a(S,{className:`mr-1 h-3.5 w-3.5`}),`New scene`]}),children:[k.unreachableCount>0?t(`p`,{className:`text-xs text-warning`,children:[k.unreachableCount,` camera`,k.unreachableCount===1?``:`s`,` could not be asked about scenes. Those cameras are missing from this list — this is not the same as having no scenes.`]}):null,a(m,{variant:`flat`,className:`p-0`,children:a(d,{columns:[{key:`label`,header:`Scene`,render:e=>a(`span`,{className:`font-medium`,children:e.monitor.label})},{key:`camera`,header:`Camera`,nowrap:!0,render:e=>e.deviceName},{key:`state`,header:`State`,nowrap:!0,render:e=>{let t=o(e.monitor);return a(h,{variant:j[t.tone],children:t.text})}},{key:`status`,header:`What it says`,render:e=>a(`span`,{className:`text-xs text-muted-foreground`,children:s(e.monitor,R)})},{key:`coverage`,header:`Variants`,render:e=>a(`span`,{className:`text-xs text-muted-foreground`,children:c(e.monitor)})},{key:`transition`,header:`Last change`,align:`right`,nowrap:!0,render:e=>a(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:M(e.monitor,R)})},{key:`actions`,header:``,align:`right`,nowrap:!0,render:e=>a(v,{variant:`ghost`,onClick:()=>F(e.deviceId),children:`Open`})}],rows:N,rowKey:e=>`${e.deviceId}:${e.monitor.id}`,minWidthPx:880,bordered:!1,mobileMode:`scroll`,maxBodyHeight:f,emptyMessage:k.isLoading?`Loading scenes…`:`No scenes yet. Press “New scene”, pick a camera, then draw a box around the thing you want watched.`})}),a(_,{open:I!==null,onOpenChange:e=>!e&&L(null),children:t(x,{width:`sm`,children:[t(C,{children:[a(p,{children:`Which camera?`}),a(w,{children:`A scene lives on one camera. Pick the one that can see the thing.`})]}),t(`div`,{className:`mt-3 flex items-center gap-2`,children:[a(u,{value:I===null?``:String(I),onChange:e=>L(Number(e.target.value)),"aria-label":`Camera`,options:l.map(e=>({value:String(e.deviceId),label:e.deviceName}))}),a(v,{onClick:()=>{F(I),L(null)},disabled:I===null,children:`Continue`})]})]})}),a(_,{open:P!==null,onOpenChange:e=>!e&&F(null),children:t(x,{width:`lg`,scroll:`body`,children:[t(C,{children:[t(p,{children:[`Scenes — `,z]}),a(w,{children:`Draw a box, name it, then capture what “normal” looks like. Daylight is enough — the night reference is optional, and “Settings” on each scene tunes how fussy and how often it checks.`})]}),a(g,{className:`mt-3`,children:P===null?null:a(r,{fallback:a(`p`,{className:`text-xs text-muted-foreground`,children:`Loading the editor…`}),children:a(y,{deviceId:P})})})]})})]})}export{N as ScenesPage};
@@ -1 +0,0 @@
1
- import{Q as e,S as t,W as n,b as r,q as i,x as a,z as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Bd as s,Hn as c,Nd as l,Un as u,Vn as d,ao as f,co as p,io as m,jn as h,lo as g,no as _,oo as v,rd as y,ro as b,so as x,tu as S,uo as C,zu as w}from"./src-DtOnHh9r.js";import{ir as T}from"./client-BqN2lVYf.js";import{t as E}from"./AdminPage-BSFohA3i.js";e();var D={"config-file":`Key file (config.yaml keychain.keyFile)`,"previous-config-file":`Previous key file (keychain.previousKeyFile)`,platform:`OS keychain (desktop app)`,"default-file":`Default key file on the data volume`};function O(e){return e===null?`—`:new Date(e).toLocaleString()}function k({status:e}){let n=e.keychain.state===`locked`,i=e.keySource??e.configuredSource;return t(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-4`,children:[t(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-danger/10 px-2 py-0.5 text-xs font-medium text-danger`,children:[a(l,{className:`h-3 w-3`}),`Locked — `,e.keychain.state===`locked`?e.keychain.reason:``]}):t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-success/10 px-2 py-0.5 text-xs font-medium text-success`,children:[a(y,{className:`h-3 w-3`}),`Unlocked`]}),t(`span`,{className:`text-xs text-foreground-subtle`,children:[e.secretCount,` stored values`]})]}),t(`dl`,{className:`grid grid-cols-1 gap-x-6 gap-y-1 text-xs sm:grid-cols-2`,children:[a(`dt`,{className:`text-foreground-subtle`,children:`Master key source`}),a(`dd`,{className:`text-foreground`,children:D[i.kind]}),i.path!==void 0&&t(r,{children:[a(`dt`,{className:`text-foreground-subtle`,children:`Key path`}),a(`dd`,{className:`break-all font-mono text-foreground`,children:i.path})]}),a(`dt`,{className:`text-foreground-subtle`,children:`Fingerprint`}),a(`dd`,{className:`font-mono text-foreground`,children:e.fingerprint??`—`}),a(`dt`,{className:`text-foreground-subtle`,children:`Recovery key downloaded`}),a(`dd`,{className:`text-foreground`,children:O(e.recoveryKeyDownloadedAt)})]}),i.sharesBackupWithDatabase&&t(`p`,{className:`flex items-start gap-1.5 rounded-md border border-warning/40 bg-warning/10 p-2 text-xs text-foreground`,children:[a(w,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),`The master key is on the data volume, next to the database it protects. CamStack's own backups leave it out, but a backup of the whole data directory (an appdata tar) carries both. Point `,a(`code`,{className:`font-mono`,children:`keychain.keyFile`}),` in config.yaml at a file outside the data volume, keep the old one as`,` `,a(`code`,{className:`font-mono`,children:`keychain.previousKeyFile`}),`, restart, then rotate.`]}),e.rotationPending&&a(`p`,{className:`rounded-md border border-primary/40 bg-primary/5 p-2 text-xs text-foreground`,children:`The configured master key is not the one in use yet. Rotate to move onto it.`}),!n&&e.recoveryKeyDownloadedAt===null&&a(`p`,{className:`rounded-md border border-warning/40 bg-warning/10 p-2 text-xs text-foreground`,children:`No recovery copy of the master key has been taken. Without the key, the stored values cannot be recovered.`})]})}function A({entry:e}){let t=p(),[n,r]=i(null);return o(()=>{if(n===null)return;let e=setTimeout(()=>r(null),S);return()=>clearTimeout(e)},[n]),n===null?a(h,{size:`sm`,variant:`ghost`,disabled:t.isPending,onClick:()=>{t.mutate({ref:e.ref},{onSuccess:e=>r(e.value)})},children:`Reveal`}):a(`button`,{type:`button`,className:`font-mono text-xs break-all text-left`,onClick:()=>r(null),children:n})}var j={"in-use":`text-success`,orphan:`text-warning`,unknown:`text-foreground-subtle`};function M(){let e=C({}),r=f({}),i=m({limit:50}),o=_(),l=g(),p=v(),y=b(),S=x(),w=c(),D=d(),M=u(),N=()=>{e.refetch(),r.refetch(),i.refetch()},P=n(()=>(r.data??[]).filter(e=>e.usage===`orphan`).map(e=>e.ref),[r.data]),F=e.data?.keychain.state===`locked`,I=async()=>{if(!await w({title:`Download the recovery key`,message:`This shows the MASTER key. Anyone holding it and a copy of the database can read every secret. Store it in a password manager, not on this machine.`,confirmLabel:`Show the key`,variant:`warning`}))return;let e=await y.mutateAsync({});await M({title:`Recovery key (fingerprint ${e.fingerprint})`,message:`Copy it now. It is not shown again until you ask for it again (audited).`,defaultValue:e.key,readOnly:!0,confirmLabel:`Done`}),N()},L=async()=>{if(await w({title:`Rotate the master key`,message:`The data key is re-wrapped under the configured master key; no value is re-encrypted. The previous wrap is kept until you purge it.`,confirmLabel:`Rotate`,variant:`warning`})){try{await D({title:`Rotated`,message:`New fingerprint ${(await l.mutateAsync({})).fingerprint}. Take a new recovery copy.`})}catch(e){await D({title:`Rotation refused`,message:e instanceof Error?e.message:String(e),variant:`danger`})}N()}},R=async()=>{await M({title:`Reset the keychain`,message:`Every stored value is archived (unreadable without the lost key) and every secret field reads "not set". Type RESET KEYCHAIN to confirm.`,confirmLabel:`Reset`,validate:e=>e===`RESET KEYCHAIN`?null:`Type the confirmation exactly`})===`RESET KEYCHAIN`&&(await S.mutateAsync({confirm:T}),N())};return t(E,{icon:s,title:`Secrets`,subtitle:`Passwords, tokens and keys, encrypted in the hub keychain. Values never leave the hub except through an audited reveal.`,actions:t(`div`,{className:`flex flex-wrap gap-2`,children:[a(h,{size:`sm`,variant:`outline`,disabled:F,onClick:()=>void I(),children:`Download recovery key`}),a(h,{size:`sm`,variant:`outline`,disabled:F,onClick:()=>void L(),children:`Rotate master key`}),(e.data?.retiredWraps??0)>0&&t(h,{size:`sm`,variant:`outline`,onClick:()=>p.mutate({},{onSuccess:N}),children:[`Purge `,e.data?.retiredWraps,` retired key wrap(s)`]}),F&&a(h,{size:`sm`,variant:`danger`,onClick:()=>void R(),children:`Reset keychain`})]}),children:[e.data!==void 0&&a(k,{status:e.data}),t(`div`,{className:`space-y-2 rounded-lg border border-border bg-surface p-4`,children:[t(`div`,{className:`flex items-center justify-between`,children:[a(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Stored values`}),t(h,{size:`sm`,variant:`outline`,disabled:P.length===0||o.isPending,onClick:()=>o.mutate({refs:P},{onSuccess:N}),children:[`Delete `,P.length,` orphan(s)`]})]}),r.data===void 0?a(`p`,{className:`text-xs text-foreground-subtle`,children:`Loading…`}):r.data.length===0?a(`p`,{className:`text-xs text-foreground-subtle`,children:`No value is stored in the keychain yet.`}):a(`div`,{className:`overflow-x-auto`,children:t(`table`,{className:`w-full text-xs`,children:[a(`thead`,{className:`text-left text-foreground-subtle`,children:t(`tr`,{children:[a(`th`,{className:`py-1 pr-3`,children:`Owner`}),a(`th`,{className:`py-1 pr-3`,children:`Scope`}),a(`th`,{className:`py-1 pr-3`,children:`Field`}),a(`th`,{className:`py-1 pr-3`,children:`Updated`}),a(`th`,{className:`py-1 pr-3`,children:`Last read`}),a(`th`,{className:`py-1 pr-3`,children:`Usage`}),a(`th`,{className:`py-1`,children:`Value`})]})}),a(`tbody`,{children:r.data.map(e=>t(`tr`,{className:`border-t border-border align-top`,children:[a(`td`,{className:`py-1 pr-3 font-mono`,children:e.owner}),a(`td`,{className:`py-1 pr-3 font-mono`,children:e.scope}),a(`td`,{className:`py-1 pr-3 font-mono break-all`,children:e.fieldPath}),a(`td`,{className:`py-1 pr-3`,children:O(e.updatedAt)}),a(`td`,{className:`py-1 pr-3`,children:O(e.lastReadAt)}),a(`td`,{className:`py-1 pr-3 ${j[e.usage]}`,children:e.usage}),a(`td`,{className:`py-1`,children:!F&&a(A,{entry:e})})]},e.ref))})]})})]}),t(`div`,{className:`space-y-2 rounded-lg border border-border bg-surface p-4`,children:[a(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Audit`}),a(`ul`,{className:`space-y-0.5 text-xs`,children:(i.data??[]).map(e=>t(`li`,{className:`flex flex-wrap gap-x-2`,children:[a(`span`,{className:`text-foreground-subtle`,children:O(e.at)}),a(`span`,{className:`font-medium text-foreground`,children:e.action}),a(`span`,{className:`font-mono text-foreground-subtle`,children:e.actor}),e.ref!==null&&a(`span`,{className:`font-mono break-all text-foreground-subtle`,children:e.ref})]},e.id))})]})]})}export{M as SecretsPage};
@@ -1 +0,0 @@
1
- import{Q as e,S as t,o as n,q as r,x as i,z as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Tn as o,Xn as s,_l as c,hd as l,hu as u,jd as d,jn as f,ml as p,od as m,ou as h,yl as g}from"./src-DtOnHh9r.js";import{t as _}from"./AdminPage-BSFohA3i.js";import{t as v}from"./NodeAddonsSettingsPanel-Chf6UF37.js";e();var y=[[`system`]];function b(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function x(){let e=n(),u=c(),m=g(),_=p(),[v,x]=r(``),[S,C]=r(``),[w,T]=r(null),E=u.data?.location??null;a(()=>{x(E===null?``:b(E.latitude)),C(E===null?``:b(E.longitude))},[E]);let D=async()=>{await e.invalidateQueries({queryKey:y})},O=async e=>{e.preventDefault();let t=Number(v),n=Number(S);if(v.trim()===``||S.trim()===``){T(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){T(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){T(`Longitude must be between -180 and 180 decimal degrees.`);return}T(null),await m.mutateAsync({latitude:t,longitude:n}),await D()},k=async()=>{T(null),await m.mutateAsync(null),await D()},A=async()=>{T(null),await _.mutateAsync(),await D()},j=m.isPending||_.isPending||u.isLoading;return t(o,{className:`space-y-3`,children:[t(`div`,{className:`flex items-start justify-between gap-3`,children:[t(`div`,{className:`flex items-start gap-2`,children:[i(d,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),i(`div`,{children:i(`h3`,{className:`text-sm font-medium`,children:`Site location`})})]}),E===null?i(s,{variant:`warning`,children:`Not configured`}):i(s,{variant:E.source===`operator-set`?`success`:`info`,children:E.source===`operator-set`?`Set by you`:`Derived from IP`})]}),E?.label!==void 0&&E.label!==``?t(`p`,{className:`text-xs text-muted-foreground`,children:[`Detected near `,E.label,`.`]}):null,E===null&&u.data?.derivationAttemptedAt!==null?t(`p`,{className:`text-xs text-warning`,children:[`Automatic detection from the public IP did not succeed`,u.data?.derivationError!==null&&u.data?.derivationError!==void 0?`: ${u.data.derivationError}`:`.`,` `,`It is not retried on its own — enter the coordinates, or press Detect.`]}):null,t(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:O,children:[t(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:`Latitude`}),i(h,{className:`w-40`,value:v,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>x(e.target.value),"aria-label":`Latitude`})]}),t(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:`Longitude`}),i(h,{className:`w-40`,value:S,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>C(e.target.value),"aria-label":`Longitude`})]}),i(f,{type:`submit`,disabled:j,children:`Save`}),t(f,{type:`button`,variant:`ghost`,disabled:j,onClick:A,children:[i(l,{className:`h-3.5 w-3.5 mr-1`}),`Detect from IP`]}),E===null?null:i(f,{type:`button`,variant:`ghost`,disabled:j,onClick:k,children:`Clear`})]}),w===null?null:i(`p`,{className:`text-xs text-danger`,children:w}),i(`p`,{className:`text-xs text-muted-foreground`,children:`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`})]})}function S(){let{nodes:e,isLoading:n}=u(),r=e.find(e=>e.isHub&&e.isOnline),a=r?.addons.map(e=>e.addonId)??[];return t(_,{children:[i(x,{}),n?i(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):r?a.length===0?i(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):i(v,{nodeId:r.id,addonIds:a,level:`global`}):t(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[i(m,{className:`h-8 w-8 opacity-30`}),i(`p`,{children:`No online hub node found.`}),i(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})]})}export{S as SettingsPage};
@@ -1 +0,0 @@
1
- import{vt as e}from"./player-overlays-D4lg_avJ.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};