@camstack/addon-admin-ui 1.2.161 → 1.2.163
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.
- package/dist/assets/{AddonCollectionPage-DidOeHML.js → AddonCollectionPage-BS7Dz27s.js} +1 -1
- package/dist/assets/{Addons-DAphv28g.js → Addons-C1Xl01yI.js} +1 -1
- package/dist/assets/{AdminTabs-BuvG675m.js → AdminTabs-B1ahCroj.js} +1 -1
- package/dist/assets/{AiProfiles-D1dR_sqs.js → AiProfiles-CgNqwply.js} +1 -1
- package/dist/assets/{BrokerForm-CtbBzViq.js → BrokerForm-CXT-1grT.js} +1 -1
- package/dist/assets/{Build-Bbum-nbd.js → Build-CF_5wvIB.js} +1 -1
- package/dist/assets/{Capabilities-CsxF-Gn_.js → Capabilities-ky21T3-L.js} +1 -1
- package/dist/assets/{CapabilityBadges-DLUwjJr2.js → CapabilityBadges-B6R-69B1.js} +1 -1
- package/dist/assets/{Cluster-CxCe9uzt.js → Cluster-BS1Pnvb5.js} +2 -2
- package/dist/assets/Data-C1vtiQWy.js +1 -0
- package/dist/assets/{DetectionIntelligence-sbqjk-yr.js → DetectionIntelligence-gw8JM_s7.js} +1 -1
- package/dist/assets/{DeviceAggregateSection-DkMW7Y6S.js → DeviceAggregateSection-Cgg9yXVV.js} +1 -1
- package/dist/assets/{DeviceDetail-BFk09QwZ.js → DeviceDetail-KVft8pGO.js} +2 -2
- package/dist/assets/{Devices-XZJ7r7_6.js → Devices-BR9yImkx.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-N1Oosdec.js → EmbedPlayerPage-BqnzuuJJ.js} +1 -1
- package/dist/assets/{Events-7PpoZh7-.js → Events-D7f8th0T.js} +1 -1
- package/dist/assets/{FormBuilder-zSYeM7J8.js → FormBuilder-BCY0VVTw.js} +1 -1
- package/dist/assets/{Identity-DZjt_Wrn.js → Identity-CJ3VB4gp.js} +1 -1
- package/dist/assets/{IntegrationDetail-UUegoTAF.js → IntegrationDetail-DSdJARhO.js} +1 -1
- package/dist/assets/{Integrations-DNbOs-De.js → Integrations-BLmlzNdT.js} +1 -1
- package/dist/assets/{Integrations-DgYRJOFv.js → Integrations-BsF0VAxX.js} +1 -1
- package/dist/assets/{Locations-BTelaF3N.js → Locations-Bx-lUAgN.js} +1 -1
- package/dist/assets/{Logs-_-ID7Fdl.js → Logs-D_5kXML8.js} +1 -1
- package/dist/assets/{MotionZonesSettings-hZLAwZ2W.js → MotionZonesSettings-DbAzh16t.js} +1 -1
- package/dist/assets/{MyAccess-dn3KK8AG.js → MyAccess-BIeRspcV.js} +1 -1
- package/dist/assets/{Network-BupEsuu1.js → Network-BB_hWlpG.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-ATtf2WFw.js → NodeAddonsSettingsPanel-BHdHgghr.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-BjaoWmuP.js → NodeInferenceDevices-Cjs79AqN.js} +1 -1
- package/dist/assets/{Notifications-W8uDm8ag.js → Notifications-Bj4WZFS1.js} +1 -1
- package/dist/assets/{Pipeline-CHn2KqD1.js → Pipeline-C_4co0Qy.js} +1 -1
- package/dist/assets/{Plates-tj2bL1rV.js → Plates-DM2w0FFA.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-B8FJYDAv.js → PrivacyMaskSettings-DAUFZ6wz.js} +1 -1
- package/dist/assets/{ProviderIcon-CAViJ2Dr.js → ProviderIcon-SlSAmo8K.js} +1 -1
- package/dist/assets/Recordings-Cew5tVKL.js +1 -0
- package/dist/assets/{ScanNetworkModal-XNhTZKaX.js → ScanNetworkModal-C4kWKpKg.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-CjHRTg_l.js → SceneMonitorEditor-PVPsicEf.js} +1 -1
- package/dist/assets/{Scenes-C8wxTMOt.js → Scenes-CNOt2T2f.js} +1 -1
- package/dist/assets/{Settings-CkbRyWnS.js → Settings-CeHQraq8.js} +1 -1
- package/dist/assets/{Showroom-sQREXKKD.js → Showroom-BtLOmXtB.js} +1 -1
- package/dist/assets/StorageLocationsPanel-CcoxHvRg.js +1 -0
- package/dist/assets/{Terminal-YqbXnKWi.js → Terminal-BgvkGYxK.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BcpL5OWo.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BIxwxeXV.js} +1 -1
- package/dist/assets/{authed-media-C_PsHBLq.js → authed-media-BAedevEe.js} +1 -1
- package/dist/assets/{bell-off-C1SI77dR.js → bell-off-C8mLnRXC.js} +1 -1
- package/dist/assets/{bell-ring-CEOIAQ_I.js → bell-ring-c5zfrv54.js} +1 -1
- package/dist/assets/{boxes-BjoWl-1D.js → boxes-DwPF0OOw.js} +1 -1
- package/dist/assets/circle-check-big-N9Wdm89D.js +1 -0
- package/dist/assets/circle-dot-B3IVynlA.js +1 -0
- package/dist/assets/circle-slash-BMk1jZJL.js +1 -0
- package/dist/assets/{circle-x-CdNO4ICk.js → circle-x-mnKeyuxu.js} +1 -1
- package/dist/assets/clock-CcW1dzbK.js +1 -0
- package/dist/assets/{copy-zlgjIyja.js → copy-BJljNCIj.js} +1 -1
- package/dist/assets/{debounced-invalidate-zayf7SMn.js → debounced-invalidate-Bd0jUg5v.js} +1 -1
- package/dist/assets/{dist-Cw5oxpBU.js → dist-BUkDp1q9.js} +1 -1
- package/dist/assets/dist-DnSj1S0J.js +349 -0
- package/dist/assets/{download-LIPHDFGv.js → download-DKWtbX3y.js} +1 -1
- package/dist/assets/{face-bbox-CAtHizcF.js → face-bbox-CE9WFY08.js} +1 -1
- package/dist/assets/{flame-D_ZDAfQ6.js → flame-DlEW2_5F.js} +1 -1
- package/dist/assets/format-size-XZHqlvrA.js +1 -0
- package/dist/assets/{hard-drive-BEeZwDeK.js → hard-drive-BGe0Xa2S.js} +1 -1
- package/dist/assets/{hostInit-C55-jO9M.js → hostInit-DBSKfSb9.js} +1 -1
- package/dist/assets/{index-DQCNw_qF.js → index-BPlvNRqQ.js} +3 -3
- package/dist/assets/index-DdPyS5cO.css +2 -0
- package/dist/assets/{key-round-L0G7sh0Z.js → key-round-BEi5hYjS.js} +1 -1
- package/dist/assets/{layers-BkYY4MNu.js → layers-DN9gU-Qy.js} +1 -1
- package/dist/assets/location-owned-usage-CYLy2ZTx.js +1 -0
- package/dist/assets/{mf-entry-bootstrap-0-bf638123.js → mf-entry-bootstrap-0-8757f514.js} +2 -2
- package/dist/assets/{pencil-Cps28G9t.js → pencil-BaS0Brv_.js} +1 -1
- package/dist/assets/play-DwGiWNTU.js +1 -0
- package/dist/assets/{player-overlays-Du1iI4WG.js → player-overlays-jCIm4d2Z.js} +1 -1
- package/dist/assets/plus-C0eRBTtX.js +1 -0
- package/dist/assets/power-55ym5RXA.js +1 -0
- package/dist/assets/{radio-rt3AQulI.js → radio-C2QTpgVI.js} +1 -1
- package/dist/assets/{refresh-cw-DTN9sVzg.js → refresh-cw-CzirCoAP.js} +1 -1
- package/dist/assets/remoteEntry-CetTBajg.js +1 -0
- package/dist/assets/rotate-ccw-CwE6-YbM.js +1 -0
- package/dist/assets/rotate-cw-PVuE1uG_.js +1 -0
- package/dist/assets/{send-HigTgqVo.js → send-Sj6WWxa6.js} +1 -1
- package/dist/assets/{server-BXK4SJIE.js → server-Bqrer35G.js} +1 -1
- package/dist/assets/{shield-alert-Cg07ChHl.js → shield-alert-CPZ-U5et.js} +1 -1
- package/dist/assets/{shield-DX4_WDm1.js → shield-vxLd9qbA.js} +1 -1
- package/dist/assets/square-BTAghn1-.js +1 -0
- package/dist/assets/{square-check-big-ZG3qcTd3.js → square-check-big-8D7-wd7B.js} +1 -1
- package/dist/assets/{src-JHeBPIaR.js → src-BurbTgHr.js} +17 -17
- package/dist/assets/src-DSOXw8KA.js +349 -0
- package/dist/assets/{undo-2-B6Jfg7mO.js → undo-2-DWI4xJra.js} +1 -1
- package/dist/assets/{use-scenes-feed-C8d0V984.js → use-scenes-feed-DOkswLPM.js} +1 -1
- package/dist/assets/useEventInvalidation-xE7MyVTv.js +1 -0
- package/dist/assets/{useNodeUrlSelection-BbnkfJaA.js → useNodeUrlSelection-CrCodD7B.js} +1 -1
- package/dist/assets/user-round-BZ3OsbHY.js +1 -0
- package/dist/assets/{video-CTn28SZY.js → video-CPH2Cntr.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-dmY2bJ_7.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_--hiLzLBb.js} +2 -2
- package/dist/assets/{wifi-DlsXlPzT.js → wifi-Bt5dfVlv.js} +1 -1
- package/dist/assets/{zap-BP77MpPC.js → zap-SdZKZWs7.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/server/addon.js +368 -233
- package/package.json +1 -1
- package/dist/assets/AddLocationWizard-CIBAcYT0.js +0 -1
- package/dist/assets/Data-BmG_RLtJ.js +0 -1
- package/dist/assets/Recordings-tfYyBWxI.js +0 -1
- package/dist/assets/StorageLocationsPanel-BCrJ-KE-.js +0 -1
- package/dist/assets/circle-check-big-DYmHmeTq.js +0 -1
- package/dist/assets/circle-dot-DvdQwPzL.js +0 -1
- package/dist/assets/circle-slash-CC_EyKGU.js +0 -1
- package/dist/assets/clock-c2VrWbaA.js +0 -1
- package/dist/assets/dist-DIx7N8Rl.js +0 -349
- package/dist/assets/format-size-DIxKXxtj.js +0 -1
- package/dist/assets/hard-drive-download-DczrA-Ph.js +0 -1
- package/dist/assets/index-Dbhx40K_.css +0 -2
- package/dist/assets/play-DDyMYk4f.js +0 -1
- package/dist/assets/plus-BvgeGRAR.js +0 -1
- package/dist/assets/power-BEgQFTDk.js +0 -1
- package/dist/assets/remoteEntry-CSOuPVx0.js +0 -1
- package/dist/assets/rotate-ccw-Bb4xxMsL.js +0 -1
- package/dist/assets/rotate-cw-mNYvr-AK.js +0 -1
- package/dist/assets/square-BFKD6b_V.js +0 -1
- package/dist/assets/src-HONjyNN8.js +0 -349
- package/dist/assets/useEventInvalidation-CXT1xiua.js +0 -1
- package/dist/assets/user-round-C8ooFPmf.js +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,Q as t,S as n,W as r,a 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{at as l}from"./player-overlays-Du1iI4WG.js";import{Qo as u,g as d,sn as f,us as p,wn as m}from"./src-JHeBPIaR.js";import{t as h}from"./pencil-Cps28G9t.js";import{t as g}from"./plus-BvgeGRAR.js";import{t as _}from"./power-BEgQFTDk.js";import{C as v,J as y,L as b,o as x,r as S,w as C}from"./index-DQCNw_qF.js";import{t as w}from"./FormBuilder-zSYeM7J8.js";var T=y(`eraser`,[[`path`,{d:`m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21`,key:`182aya`}],[`path`,{d:`M22 21H7`,key:`t4ddhn`}],[`path`,{d:`m5 11 9 9`,key:`1mo9qw`}]]);t();function E(e){return e.enabled!==!1}function D(e){return e.config.readOnly===!0}function O(e,t){return D(e)?!1:!t.some(t=>t.id!==e.id&&t.config.readOnly!==!0)}function k(e,t,n){return!(n===`single`||t.length<=1||E(e)&&t.filter(e=>E(e)).length<=1)}function A(e,t){let n={...e.config};t.readOnly===!0?n={...n,readOnly:!0}:t.readOnly===!1&&(n={...n},delete n.readOnly);let r={id:e.id,type:e.type,displayName:t.displayName??e.displayName,providerId:e.providerId,config:n,isSystem:e.isSystem},i=e.nodeId===void 0?r:{...r,nodeId:e.nodeId},a=t.enabled??e.enabled;return a===void 0?i:{...i,enabled:a}}var j={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},M={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},N=`storage.discardLocation`,P=`storage.discardLocationStatus`,F=`storage.discardLocationCancel`;function I(e){return j[e]??null}function L(e){return M[e]??null}function R(e){return!E(e)||D(e)}function z(e,t){return I(e.type)===null||!R(e)?!1:t.some(t=>t.id!==e.id&&E(t)&&!D(t))}var B=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function V(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function H(e){return typeof e==`string`?e:null}function U(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.running!=`boolean`)return null;let n=t.phase;if(typeof n!=`string`||!B.has(n))return null;let r=V(t.camerasTotal),i=V(t.camerasDone),a=V(t.foldersRemoved),o=V(t.dbRowsDeleted),s=V(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:H(t.locationId),jobId:H(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:H(t.detail)??``,startedAtMs:V(t.startedAtMs),finishedAtMs:V(t.finishedAtMs),error:H(t.error)}}function W(e){if(e.phase===`complete`)return 100;if(e.phase===`cancelled`||e.phase===`error`||e.phase===`idle`)return e.camerasTotal>0?Math.min(99,Math.round(e.camerasDone/e.camerasTotal*100)):0;if(e.camerasTotal>0){let t=e.camerasDone/e.camerasTotal*85;return e.phase===`wiping-db`?Math.min(95,Math.round(t+8)):e.phase===`cascading`?Math.min(99,Math.round(t+12)):Math.min(85,Math.round(t))}return e.phase===`scanning`?2:5}var G=2e3;function K({location:e,siblings:t}){return z(e,t)?s(q,{location:e}):null}function q({location:e}){let t=f(),r=m(),i=L(e.type),[a,l]=o(null),[u,d]=o(null),[p,h]=o(!1);if(c(()=>{if(i===null)return;let e=!1,t=async()=>{try{let t=await r.mutateAsync({addonId:i,action:P,input:{}});if(e)return;l(U(t))}catch{}};t();let n=setInterval(()=>void t(),G);return()=>{e=!0,clearInterval(n)}},[i,e.id]),i===null)return null;let g=a!==null&&a.locationId===e.id,_=g&&a.running,v=g&&a.phase!==`idle`,y=async()=>{if(await t({title:`Discard leftovers on "${e.displayName}"?`,message:`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`,confirmLabel:`Discard leftovers`,variant:`danger`})){d(null),h(!0);try{await r.mutateAsync({addonId:i,action:N,input:{locationId:e.id}}),l(U(await r.mutateAsync({addonId:i,action:P,input:{}})))}catch(e){d(e instanceof Error?e.message:String(e))}finally{h(!1)}}},b=async()=>{try{await r.mutateAsync({addonId:i,action:F,input:{}})}catch(e){d(e instanceof Error?e.message:String(e))}};return n(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[_?n(`button`,{type:`button`,onClick:()=>void b(),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10`,children:[s(S,{className:`h-3 w-3`}),`Cancel`]}):n(`button`,{type:`button`,onClick:()=>void y(),disabled:p,title:`Permanently delete leftover files on this location. Other locations are not affected.`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10 disabled:opacity-50`,children:[p?s(C,{className:`h-3 w-3 animate-spin`}):s(T,{className:`h-3 w-3`}),`Discard leftovers`]}),v&&a!==null&&n(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:s(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${W(a)}%`}})}),n(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[a.phase,a.camerasTotal>0?` · ${a.camerasDone}/${a.camerasTotal} cam`:``,a.dbRowsDeleted>0?` · ${a.dbRowsDeleted} rows`:``,a.detail?` · ${a.detail}`:``]})]}),(u||g&&a?.error)&&s(`p`,{className:`text-[10px] text-danger leading-tight`,children:u??a?.error})]})}function J(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function Y({location:e}){let t=e.capacity;return t==null?null:n(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[J(t.availableBytes),` free of `,J(t.totalBytes)]})}function ee(e){let t=e.basePath;if(typeof t==`string`&&t.length>0)return t;let n=Object.keys(e);return n.length===0?``:n.join(`, `)}function te({location:e,onEdit:t,onDelete:r,onToggleEnabled:i,onToggleReadOnly:a,canSetReadOnly:o,canDelete:c,siblings:l=[]}){let u=ee(e.config),d=E(e),f=D(e);return n(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2 border-t border-border first:border-t-0 hover:bg-primary/5`,children:[n(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0 flex-1 basis-64`,children:[s(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e.providerId}),!d&&s(`span`,{className:`text-[10px] uppercase tracking-wide text-warning bg-warning/10 border border-warning/30 rounded px-1.5 py-0.5`,title:`Disabled — nothing new is written here. Existing data stays readable and is still pruned by age.`,children:`disabled`}),f&&s(`span`,{className:`text-[10px] uppercase tracking-wide text-warning bg-warning/10 border border-warning/30 rounded px-1.5 py-0.5`,title:`Drain mode — reads and age retention continue; nothing new is written here and disk-pressure eviction skips it`,children:`read-only`}),n(`div`,{className:`min-w-0`,children:[s(`div`,{className:`text-xs font-medium text-foreground truncate`,children:e.displayName}),n(`div`,{className:`flex flex-wrap items-center gap-x-2`,children:[u&&s(`span`,{className:`text-[10px] text-foreground-subtle truncate font-mono`,children:u}),s(Y,{location:e})]})]})]}),n(`div`,{className:`flex flex-wrap items-center gap-1 shrink-0`,children:[s(K,{location:e,siblings:l}),n(`button`,{type:`button`,role:`switch`,"aria-label":`Read-only drain`,"aria-checked":f,disabled:!o&&!f,onClick:()=>{!o&&!f||a(e,!f)},title:!o&&!f?`Blocked: this is the last writable location of its type — new footage would have nowhere to go.`:f?`Read-only (drain) — reads and age retention continue; nothing new is written here and disk-pressure eviction skips it. Click to allow writes again.`:`Writable — new data and disk-pressure eviction may use this location. Click to set drain (read-only).`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${!o&&!f?`border-border text-foreground-subtle cursor-not-allowed`:f?`border-warning/40 text-warning hover:bg-warning/10`:`border-border text-foreground-subtle hover:text-foreground hover:bg-primary/10`}`,children:[s(v,{className:`h-3 w-3`}),f?`Read-only`:`Writable`]}),n(`button`,{type:`button`,role:`switch`,"aria-label":`Writes enabled`,"aria-checked":d,onClick:()=>i(e,!d),title:d?`Enabled — balancing consumers may write new data here. Click to stop new writes.`:`Disabled — no new data is written here. Existing data stays readable. Click to enable.`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border disabled:cursor-not-allowed ${d?`border-success/30 text-success hover:bg-success/10`:`border-warning/40 text-warning hover:bg-warning/10`}`,children:[s(_,{className:`h-3 w-3`}),d?`Enabled`:`Disabled`]}),n(`button`,{onClick:()=>t(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle border border-border hover:text-foreground hover:bg-primary/10`,children:[s(h,{className:`h-3 w-3`}),`Edit`]}),c&&s(`button`,{onClick:()=>r(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,title:`Delete location`,children:s(x,{className:`h-3 w-3`})})]})]})}t();function ne({type:e,displayName:t,description:i,cardinality:a,locations:o,onAdd:c,onEdit:l,onDelete:u,onToggleEnabled:d,onToggleReadOnly:f}){let p=r(()=>{let e=[...o];return e.sort((e,t)=>{let n=e.enabled!==!1;return n===(t.enabled!==!1)?e.displayName.localeCompare(t.displayName):n?-1:1}),e},[o]);return n(`div`,{className:`rounded-lg border border-border bg-surface`,children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-3 py-2`,children:[n(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`flex items-center gap-2`,children:[s(`span`,{className:`text-sm font-semibold text-foreground capitalize`,children:t}),s(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e})]}),i&&s(`p`,{className:`text-[11px] text-foreground-subtle`,children:i}),a===`single`&&s(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:`Single — one location per type. Edit the existing entry; it can't be split.`})]}),a===`multi`&&n(`button`,{onClick:()=>c(e),className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90`,children:[s(g,{className:`h-3 w-3`}),`Add`]})]}),p.length===0?s(`div`,{className:`px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:a===`multi`?`No location registered. Click "Add" to register one.`:`No location registered yet — should be auto-seeded at next boot.`}):s(`div`,{children:p.map(e=>s(te,{location:e,cardinality:a,canDelete:k(e,p,a),onEdit:l,onDelete:u,onToggleEnabled:d,onToggleReadOnly:f,canSetReadOnly:!O(e,p),siblings:p},e.id))})]})}var re=new Set([`proc`,`sys`,`dev`,`run`,`boot`,`lost+found`,`snap`,`bin`,`sbin`,`lib`,`lib32`,`lib64`,`libx32`,`usr`,`etc`,`var`,`opt`,`tmp`,`srv`,`root`,`System`,`Library`,`Applications`,`cores`,`private`]),X=[`recordings`,`data`,`mnt`,`media`,`Volumes`];function Z(e){let t=X.findIndex(t=>t===`recordings`?e.startsWith(t):e===t);return t===-1?X.length:t}function ie(e){return e.filter(e=>!e.name.startsWith(`.`)&&!re.has(e.name)).toSorted((e,t)=>{let n=Z(e.name)-Z(t.name);return n===0?e.name.localeCompare(t.name):n}).map(e=>e.path)}t();function Q({nodeId:t,value:r,onChange:i}){let a=l().trpcClient,[u,d]=o([]),[f,p]=o(r),[m,h]=o(null),[g,_]=o(null),[v,y]=o(``),b=e(async(e,n)=>{_(null);try{let r=await a.filesystemBrowse.browse.query({nodeId:t,path:e});h(r),p(r.path),n&&i(r.path)}catch(e){_(e instanceof Error?e.message:`browse failed`)}},[a,t,i]);c(()=>{p(r),(async()=>{let e=await a.filesystemBrowse.browse.query({nodeId:t,path:`/`}).then(e=>e).catch(()=>null);if(e){d(ie(e.entries)),await b(r.startsWith(`/`)?r:`/`,!1);return}try{let e=await a.filesystemBrowse.listAllowedRoots.query({nodeId:t});d(e),await b(r&&e.some(e=>r.startsWith(e))?r:e[0]??``,!1)}catch(e){d([]),h(null),_(e instanceof Error&&/not available on node/i.test(e.message)?`This node can't be browsed remotely. Enter the path manually.`:e instanceof Error?e.message:`browse unavailable`)}})()},[t]);let x=async()=>{if(!(!v.trim()||!m)){_(null);try{let e=`${m.path.replace(/\/+$/,``)}/${v.trim()}`;await a.filesystemBrowse.createDir.mutate({nodeId:t,path:e}),y(``),await b(m.path,!0)}catch(e){_(e instanceof Error?e.message:`create failed`)}}},S=e=>`${(e/1e9).toFixed(1)} GB`;return n(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[s(`div`,{className:`flex flex-wrap gap-1`,children:u.map(e=>s(`button`,{onClick:()=>void b(e,!0),className:`rounded border border-border px-2 py-0.5 text-[10px] font-mono hover:border-primary/40`,children:e},e))}),s(`input`,{value:f,onChange:e=>{p(e.target.value),i(e.target.value)},placeholder:`/absolute/path`,className:`w-full rounded border border-border bg-background px-2 py-1 text-[11px] font-mono`}),m&&n(`div`,{className:`text-[10px] text-foreground-subtle`,children:[S(m.freeBytes),` free / `,S(m.totalBytes)]}),s(`div`,{className:`max-h-40 space-y-0.5 overflow-y-auto`,children:m?.entries.map(e=>n(`button`,{onClick:()=>void b(e.path,!0),className:`block w-full truncate rounded px-2 py-1 text-left text-xs hover:bg-primary/5`,children:[`📁 `,e.name]},e.path))}),n(`div`,{className:`flex gap-1`,children:[s(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`new folder`,className:`flex-1 rounded border border-border bg-background px-2 py-1 text-xs`}),s(`button`,{onClick:()=>void x(),className:`rounded border border-border px-2 py-1 text-xs hover:border-primary/40`,children:`Create`})]}),g&&s(`div`,{className:`text-[10px] text-red-400`,children:g})]})}t();function ae({location:e,onClose:t,onSaved:c}){let f=a(),m=l().trpcClient,[h,g]=o({...e.config}),[_,v]=o(e.displayName),[y,b]=o(null),[x,T]=o(!1),E=u(),D=r(()=>{let t=E.data;return Array.isArray(t)?t.find(t=>t.providerId===e.providerId)??null:null},[E.data,e.providerId]),k=p({onSuccess:()=>{f.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),c()}}),A=D?.shouldSaveDiskSpace===!0,j=D?.nodeLocal===!0,[M,N]=o(typeof e.nodeId==`string`?e.nodeId:`hub`),P=typeof h.basePath==`string`?h.basePath:``,F=e=>g(t=>({...t,basePath:e})),I=h.readOnly===!0,L=i({queryKey:[`storage`,`listLocations`,`ro-guard`],queryFn:()=>m.storage.listLocations.query({})}),R=(L.data??[]).filter(t=>t.type===e.type),z=L.data!==void 0&&O({id:e.id,config:h},R),B=e=>g(t=>{let n={...t};return delete n.readOnly,e?{...n,readOnly:!0}:n}),V=typeof h.maxUsedGb==`number`?h.maxUsedGb:``,H=e=>{let t=e.trim(),n=t===``?void 0:Number(t);g(e=>{let t={...e};return n===void 0||!Number.isFinite(n)||n<=0?delete t.maxUsedGb:t.maxUsedGb=n,t})},U=typeof h.minFreePercent==`number`?h.minFreePercent:``,W=e=>{let t=e.trim(),n=t===``?void 0:Number(t);g(e=>{let t={...e};return n===void 0||!Number.isFinite(n)?delete t.minFreePercent:t.minFreePercent=Math.min(100,Math.max(0,n)),t})},G=async()=>{T(!0),b(null);try{b(await(e=>m.storage.testConfig.query(e))({providerId:e.providerId,locationId:e.id,config:h}))}catch(e){b({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{T(!1)}};return s(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,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(`div`,{className:`space-y-0.5`,children:[n(`h2`,{className:`text-sm font-semibold text-foreground`,children:[`Edit `,e.displayName]}),n(`p`,{className:`text-xs text-foreground-subtle`,children:[s(`span`,{className:`font-mono`,children:e.id}),` ·`,` `,D?.displayName??e.providerId]})]}),s(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:s(S,{className:`h-4 w-4`})})]}),n(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),s(`input`,{type:`text`,value:_,onChange:e=>v(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),D&&s(w,{schema:D.configSchema,values:h,onChange:g}),n(`div`,{className:`space-y-1`,children:[n(`label`,{className:`flex items-center gap-2 text-xs ${z?`text-foreground-subtle cursor-not-allowed`:`text-foreground cursor-pointer`}`,children:[s(`input`,{type:`checkbox`,checked:I,disabled:z,onChange:e=>B(e.target.checked),className:`accent-primary`}),`Read-only (drain mode)`]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:z?`Blocked: this is the last writable location of its type — new footage would have nowhere to go.`:`Reads and age-based retention continue; nothing new is written here and disk-pressure eviction skips it. Use it to slowly decommission a disk.`})]}),j&&n(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),s(d,{selectedNodeId:M,onSelect:N,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),s(Q,{nodeId:M,value:P,onChange:F})]}),A&&n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Min free disk %`}),s(`input`,{type:`number`,min:0,max:100,value:U,placeholder:D?.minFreePercent==null?``:String(D.minFreePercent),onChange:e=>W(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`When free space on this volume drops below this %, the oldest data stored here is evicted to reclaim space.`,D?.minFreePercent==null?` Empty = use the default.`:` Empty = use the default (${D.minFreePercent}%).`]}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Max used (GB)`}),s(`input`,{type:`number`,min:1,value:V,placeholder:`unlimited`,onChange:e=>H(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Hard cap on the TOTAL bytes evictable data (recordings) may occupy on this location, independent of disk free space — oldest footage is evicted past it. Empty = unlimited.`})]}),!D&&!E.isLoading&&n(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Provider `,s(`code`,{className:`font-mono`,children:e.providerId}),` is no longer registered. Field schema unavailable; raw config is preserved on save.`]}),y&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${y.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:y.ok?`Connection OK.`:`Test failed: ${y.error??`unknown error`}`}),k.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:k.error instanceof Error?k.error.message:String(k.error)})]}),n(`div`,{className:`flex items-center justify-between gap-2 border-t border-border px-4 py-3`,children:[s(`button`,{onClick:t,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),n(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{G()},disabled:x||!D,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:x?`Testing…`:`Test connection`}),n(`button`,{onClick:()=>{k.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:_.trim(),config:h,nodeId:j?M:void 0})},disabled:k.isPending||_.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[k.isPending?s(C,{className:`h-3.5 w-3.5 animate-spin`}):null,k.isPending?`Saving…`:`Save`]})]})]})]})})}function oe(e){let t=e.trim().toLowerCase();return t.length===0?``:t.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function $(e,t){let n=oe(t);return`${e}:${n.length>0?n:`default`}`}t();function se({initialType:e,onClose:t,onCreated:i}){let c=a(),f=l().trpcClient,[m,h]=o(`picker`),[g,_]=o(e),[v,y]=o(null),[x,T]=o({}),[E,D]=o(``),[O,k]=o(null),[A,j]=o(!1),[M,N]=o(`hub`),[P,F]=o(null),[I,L]=o(!1),R=e=>T(t=>({...t,basePath:e})),z=typeof x.basePath==`string`?x.basePath:``,B=u(),V=r(()=>{let e=B.data;return Array.isArray(e)?e:[]},[B.data]),H=B.isLoading,U=p({onSuccess:()=>{c.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),i()}}),W=r(()=>O!==null&&O.length>0?O:$(g,E),[g,E,O]),G=async()=>{if(v){L(!0),F(null);try{F(await(e=>f.storage.testConfig.query(e))({providerId:v.providerId,config:x}))}catch(e){F({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{L(!1)}}};return s(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,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(`div`,{className:`space-y-0.5`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:{picker:`Add Location — Pick provider`,config:`Add Location — ${v?.displayName??``}`,naming:`Add Location — Name`}[m]}),n(`p`,{className:`text-xs text-foreground-subtle`,children:[`Type: `,s(`span`,{className:`font-mono`,children:g})]})]}),s(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:s(S,{className:`h-4 w-4`})})]}),m===`picker`&&n(`div`,{className:`p-4 space-y-2`,children:[H&&s(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading providers…`}),!H&&V.length===0&&n(`div`,{className:`rounded border border-border bg-background px-3 py-4 text-center text-xs text-foreground-subtle`,children:[`No storage-provider supports type "`,g,`". Install a compatible addon (e.g.`,` `,s(`code`,{className:`font-mono`,children:`remote-storage`}),`) to enable it.`]}),V.map(e=>n(`button`,{onClick:()=>{y(e),h(`config`)},className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background p-3 text-left hover:border-primary/40 hover:bg-primary/5 transition-colors`,children:[n(`div`,{className:`flex-1 min-w-0`,children:[s(`p`,{className:`text-xs font-semibold text-foreground`,children:e.displayName}),s(`p`,{className:`text-[10px] text-foreground-subtle font-mono mt-0.5 truncate`,children:e.providerId})]}),s(b,{className:`h-4 w-4 text-foreground-subtle flex-shrink-0`})]},e.providerId))]}),m===`config`&&v&&n(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[s(w,{schema:v.configSchema,values:x,onChange:T}),v.nodeLocal&&n(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),s(d,{selectedNodeId:M,onSelect:N,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),s(Q,{nodeId:M,value:z,onChange:R})]}),P&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${P.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:P.ok?`Connection OK.`:`Test failed: ${P.error??`unknown error`}`}),n(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>h(`picker`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),n(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{G()},disabled:I,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:I?`Testing…`:`Test connection`}),s(`button`,{onClick:()=>h(`naming`),className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:`Next`})]})]})]}),m===`naming`&&v&&n(`div`,{className:`p-4 space-y-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),s(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:`${g} on ${v.displayName}`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),n(`div`,{className:`space-y-1`,children:[n(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:[`Id`,` `,s(`span`,{className:`lowercase tracking-normal text-foreground-subtle`,children:`— auto-derived; override if needed`})]}),s(`input`,{type:`text`,value:W,onChange:e=>k(e.target.value),placeholder:$(g,E),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-1 focus:ring-primary`}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,s(`code`,{className:`font-mono`,children:`<type>:<slug>`}),`. Lowercase letters, digits, and hyphens only.`]})]}),n(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[s(`input`,{type:`checkbox`,checked:A,onChange:e=>j(e.target.checked),className:`accent-primary mt-0.5`}),n(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`text-xs font-medium text-foreground`,children:`Enable immediately`}),s(`div`,{className:`text-[10px] text-foreground-subtle`,children:`A disabled location receives no writes until enabled — reads and age-based retention still work, nothing new lands here. Leave this off to register the disk now and start using it later.`})]})]}),U.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:U.error instanceof Error?U.error.message:String(U.error)}),n(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>h(`config`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),n(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{_(e),y(null),T({}),D(``),k(null),j(!1),F(null),h(`picker`)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Reset`}),n(`button`,{onClick:()=>{v&&U.mutate({id:W,type:g,displayName:E.trim(),providerId:v.providerId,config:x,enabled:A,nodeId:v.nodeLocal?M:void 0})},disabled:U.isPending||E.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[U.isPending?s(C,{className:`h-3.5 w-3.5 animate-spin`}):null,U.isPending?`Saving…`:`Save`]})]})]})]})]})})}export{A as i,ae as n,ne as r,se as t};
|
|
@@ -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{Z as l}from"./player-overlays-Du1iI4WG.js";import{$n as u,Ln as d,Xo as f,Yo as p,Zo as m,ar as h,cr as g,er as _,ir as v,lr as y,nr as b,or as x,rr as S,sn as C,sr as w,tr as T,ur as E,us as D}from"./src-JHeBPIaR.js";import{t as O}from"./circle-slash-CC_EyKGU.js";import{t as k}from"./circle-x-CdNO4ICk.js";import{t as A}from"./clock-c2VrWbaA.js";import{t as j}from"./download-LIPHDFGv.js";import{i as M,n as N,r as P,t as F}from"./AddLocationWizard-CIBAcYT0.js";import{t as I}from"./hard-drive-download-DczrA-Ph.js";import{t as ee}from"./hard-drive-BEeZwDeK.js";import{t as te}from"./pencil-Cps28G9t.js";import{t as ne}from"./play-DDyMYk4f.js";import{t as re}from"./plus-BvgeGRAR.js";import{t as L}from"./rotate-cw-mNYvr-AK.js";import{F as R,J as z,K as ie,L as ae,o as B,r as V,w as H,z as oe}from"./index-DQCNw_qF.js";import{t as U}from"./AdminPage-CCD07UMs.js";import{i as W}from"./authed-media-C_PsHBLq.js";import{t as G}from"./AdminTabs-BuvG675m.js";import{t as K}from"./format-size-DIxKXxtj.js";var q=z(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),se=z(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ce=z(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),le=z(`calendar-clock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),ue=z(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]);t();function de(){let e=a(),t=C(),{data:i,isLoading:c,isError:l}=m({}),u=f(),d=r(()=>u.data??[],[u.data]),[h,g]=o(null),[_,v]=o(null),y=p({onSuccess:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}}),b=D({onSuccess:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}}),x=(e,t)=>{b.mutate(M(e,{enabled:t}))},S=(e,t)=>{b.mutate(M(e,{readOnly:t}))},w=async e=>{if(await t({title:`Delete location "${e.displayName}"?`,message:`This removes the location record. Files on disk are not deleted; the underlying directory or remote path stays untouched.`,confirmLabel:`Delete`,variant:`danger`}))try{await y.mutateAsync({id:e.id})}catch(n){await t({title:`Delete anyway?`,message:`${n instanceof Error?n.message:String(n)}\n\nForcing the delete removes the record only. Anything still on that location becomes unreachable — index rows naming it stop resolving, and playback of those segments goes silently black rather than erroring.`,confirmLabel:`Force delete`,variant:`danger`})&&y.mutate({id:e.id,force:!0})}},T=r(()=>{let e=new Map;for(let t of i??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[i]),E=c||u.isLoading,O=l||u.isError;return n(U,{children:[E&&s(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading locations…`}),O&&s(`div`,{className:`text-xs text-danger`,children:`Failed to load storage locations.`}),!E&&!O&&n(`div`,{className:`space-y-3`,children:[d.length===0&&s(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:`No storage locations declared by any installed addon.`}),d.map(e=>s(P,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:T.get(e.id)??[],onAdd:e=>g(e),onEdit:e=>v(e),onDelete:e=>{w(e)},onToggleEnabled:(e,t)=>x(e,t),onToggleReadOnly:(e,t)=>S(e,t)},e.id))]}),h!==null&&s(F,{initialType:h,onClose:()=>g(null),onCreated:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),g(null)}}),_!==null&&s(N,{location:_,onClose:()=>v(null),onSaved:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),v(null)}})]})}t();var fe=[[`backup`,`listDestinations`]],pe=[`backup`,`listArchives`];function me({destinationId:t,restoreSupported:i,onOpenRestoreWizard:c}){let l=a(),u=C(),{data:d,isLoading:f,isError:p}=S({destinationId:t}),m=d??[],h=_({onSuccess:()=>{l.invalidateQueries({queryKey:[[...pe]]}),l.invalidateQueries({queryKey:fe})}}),g=e(async e=>{await u({title:`Delete this archive?`,message:`Permanently deletes "${e.label??e.id}" and frees ${K(e.sizeBytes)}.`,confirmLabel:`Delete`,variant:`danger`})&&h.mutate({destinationId:t,backupId:e.id})},[u,t,h]),[v,y]=o(null),b=e(async e=>{y(e.id);try{let n=await W(he(t,e.id)),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.label??e.id}.tar.gz`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}finally{y(null)}},[t]),x=r(()=>[...m].toSorted((e,t)=>t.createdAt-e.createdAt),[m]);return f?s(`div`,{className:`text-xs text-foreground-subtle animate-pulse py-2`,children:`Loading archives…`}):p?s(`div`,{className:`text-xs text-danger py-2`,children:`Failed to read manifest for this destination`}):x.length===0?s(`div`,{className:`text-xs text-foreground-subtle italic py-2`,children:`No archives at this destination yet.`}):s(`div`,{className:`rounded border border-border bg-surface overflow-x-auto`,children:n(`table`,{className:`w-full text-xs min-w-[640px]`,children:[s(`thead`,{children:n(`tr`,{className:`text-foreground-subtle bg-background/30`,children:[s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`When`}),s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Label`}),s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Includes`}),s(`th`,{className:`text-right px-3 py-1.5 font-medium`,children:`Size`}),s(`th`,{className:`text-right px-3 py-1.5 font-medium w-52`,children:`Actions`})]})}),s(`tbody`,{children:x.map(e=>n(`tr`,{className:`border-t border-border hover:bg-primary/5`,children:[s(`td`,{className:`px-3 py-1.5 text-foreground tabular-nums`,children:ge(e.createdAt)}),s(`td`,{className:`px-3 py-1.5 text-foreground`,children:e.label??s(`span`,{className:`text-foreground-subtle italic`,children:`—`})}),s(`td`,{className:`px-3 py-1.5 text-foreground-subtle`,children:e.locations.join(`, `)}),s(`td`,{className:`px-3 py-1.5 text-foreground text-right tabular-nums`,children:K(e.sizeBytes)}),s(`td`,{className:`px-3 py-1.5`,children:n(`div`,{className:`flex items-center justify-end gap-1`,children:[n(`button`,{onClick:()=>{b(e)},disabled:v===e.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:text-foreground hover:bg-primary/10 disabled:opacity-50`,title:`Download archive`,children:[v===e.id?s(H,{className:`h-3 w-3 animate-spin`}):s(j,{className:`h-3 w-3`}),`Download`]}),i&&c&&n(`button`,{onClick:()=>c({destinationId:t,archiveId:e.id}),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-primary hover:bg-primary/10`,title:`Restore from this archive`,children:[s(L,{className:`h-3 w-3`}),`Restore`]}),s(`button`,{onClick:()=>{g(e)},disabled:h.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 archive`,children:h.isPending?s(H,{className:`h-3 w-3 animate-spin`}):s(B,{className:`h-3 w-3`})})]})})]},e.id))})]})})}function he(e,t){return l(`/api/backup/download/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}function ge(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}t();var J=[[`backup`,`listSchedules`]];function _e({onEdit:e,onOpenRestoreWizard:t}){let{data:i,isLoading:a,isError:c}=x(),l=i??[],u=v().data??[],d=r(()=>{let e=new Map;for(let t of u)e.set(t.id,t);return e},[u]),[f,p]=o(null),m=e=>{p(t=>t===e?null:e)};return a?s(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading backup entries…`}):c?s(`div`,{className:`text-xs text-danger`,children:`Failed to load backup entries`}):l.length===0?s(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-8 text-center`,children:s(`p`,{className:`text-xs text-foreground-subtle`,children:`No backup entries yet. Create one to schedule backups across one or more storage locations.`})}):s(`div`,{className:`rounded-lg border border-border bg-surface overflow-x-auto`,children:n(`table`,{className:`w-full text-xs min-w-[820px]`,children:[s(`thead`,{children:n(`tr`,{className:`text-foreground-subtle border-b border-border bg-background/40`,children:[s(`th`,{className:`text-left px-3 py-2 font-medium w-6`}),s(`th`,{className:`text-left px-3 py-2 font-medium`,children:`Entry`}),s(`th`,{className:`text-left px-3 py-2 font-medium w-20`,children:`Enabled`}),s(`th`,{className:`text-left px-3 py-2 font-medium`,children:`Locations`}),s(`th`,{className:`text-left px-3 py-2 font-medium w-24`,children:`Retention`}),s(`th`,{className:`text-left px-3 py-2 font-medium w-48`,children:`Schedule`}),s(`th`,{className:`text-right px-3 py-2 font-medium w-52`,children:`Actions`})]})}),s(`tbody`,{children:l.map(n=>s(ve,{row:n,destById:d,isOpen:f===n.id,onToggle:()=>m(n.id),onEdit:()=>e(n),...t?{onOpenRestoreWizard:t}:{}},n.id))})]})})}function ve({row:t,destById:l,isOpen:u,onToggle:d,onEdit:f,onOpenRestoreWizard:p}){let m=a(),h=C(),g=E({onSuccess:()=>{m.invalidateQueries({queryKey:J})}}),_=T({onSuccess:()=>{m.invalidateQueries({queryKey:J})}}),v=y({onMutate:()=>{m.invalidateQueries({queryKey:[[`backup`,`listRuns`]]})},onSuccess:()=>{m.invalidateQueries({queryKey:[[`backup`,`listArchives`]]}),m.invalidateQueries({queryKey:[[`backup`,`listDestinations`]]}),m.invalidateQueries({queryKey:[[`backup`,`listRuns`]]})}}),[b,x]=o(String(t.retentionCount));c(()=>{x(String(t.retentionCount))},[t.retentionCount]);let S=r(()=>({id:t.id,label:t.label,cron:t.cron,locationIds:[...t.locationIds],retentionCount:t.retentionCount,...t.dataSources?{dataSources:[...t.dataSources]}:{}}),[t]),w=e(e=>{g.mutate({...S,enabled:e})},[g,S]),D=e(()=>{let e=Number.parseInt(b,10);if(Number.isNaN(e)||e<1){x(String(t.retentionCount));return}e!==t.retentionCount&&g.mutate({...S,enabled:t.enabled,retentionCount:e})},[g,S,b,t.retentionCount,t.enabled]),O=e(()=>{t.locationIds.length!==0&&v.mutate({destinations:[...t.locationIds],...t.dataSources&&t.dataSources.length>0?{locations:[...t.dataSources]}:{},label:t.label,retentionCount:t.retentionCount})},[v,t]),k=e(async()=>{await h({title:`Delete backup entry?`,message:`"${t.label||t.id}" will stop running. Existing archives are kept.`,confirmLabel:`Delete`,variant:`warning`})&&_.mutate({id:t.id})},[h,_,t.id,t.label]),A=t.cron.trim().length>0,j=g.isPending||_.isPending;return n(i,{children:[n(`tr`,{className:`border-t border-border first:border-t-0 hover:bg-primary/5`,children:[s(`td`,{className:`px-2 py-2`,children:s(`button`,{onClick:d,className:`inline-flex items-center justify-center rounded p-1 text-foreground-subtle hover:bg-primary/10 hover:text-foreground`,title:u?`Hide archives`:`Show archives`,children:s(u?oe:ae,{className:`h-3.5 w-3.5`})})}),s(`td`,{className:`px-3 py-2`,children:n(`button`,{onClick:f,className:`text-left hover:underline focus:outline-none`,children:[s(`div`,{className:`text-foreground font-medium`,children:t.label||`(unnamed)`}),t.lastRunAt!==void 0&&n(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:[`last run `,new Date(t.lastRunAt).toLocaleString()]})]})}),s(`td`,{className:`px-3 py-2`,children:s(`label`,{className:`inline-flex items-center cursor-pointer`,children:s(`input`,{type:`checkbox`,className:`accent-primary`,checked:t.enabled,disabled:j,onChange:e=>w(e.target.checked)})})}),s(`td`,{className:`px-3 py-2`,children:n(`div`,{className:`flex flex-wrap gap-1`,children:[t.locationIds.length===0&&s(`span`,{className:`text-[11px] text-danger italic`,children:`No locations`}),t.locationIds.map(e=>s(`span`,{className:`inline-flex items-center rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-foreground`,title:e,children:l.get(e)?.displayName??e},e))]})}),s(`td`,{className:`px-3 py-2`,children:s(`input`,{type:`number`,min:1,max:1e3,value:b,disabled:j,onChange:e=>x(e.target.value),onBlur:D,onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&x(String(t.retentionCount))},className:`w-16 rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})}),s(`td`,{className:`px-3 py-2`,children:n(`button`,{onClick:f,className:`group flex flex-col items-start gap-0.5 text-left`,title:`Edit schedule`,children:[n(`span`,{className:`inline-flex items-center gap-1`,children:[s(le,{className:`h-3 w-3 text-foreground-subtle group-hover:text-foreground`}),s(`span`,{className:`font-mono text-[11px] text-foreground`,children:A?t.cron:`Manual`})]}),A&&t.nextRunAt!==void 0&&n(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`next `,new Date(t.nextRunAt).toLocaleString()]})]})}),s(`td`,{className:`px-3 py-2`,children:n(`div`,{className:`flex items-center justify-end gap-1.5`,children:[n(`button`,{onClick:O,disabled:v.isPending||t.locationIds.length===0,className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,title:`Run this entry now`,children:[v.isPending?s(H,{className:`h-3 w-3 animate-spin`}):s(ne,{className:`h-3 w-3`}),`Run now`]}),s(`button`,{onClick:f,className:`inline-flex items-center justify-center rounded border border-border p-1 text-foreground-subtle hover:text-foreground hover:bg-primary/5`,title:`Edit entry`,children:s(te,{className:`h-3 w-3`})}),s(`button`,{onClick:()=>{k()},disabled:j,className:`inline-flex items-center justify-center rounded border border-border p-1 text-foreground-subtle hover:text-danger hover:border-danger/40 disabled:opacity-50`,title:`Delete entry`,children:s(B,{className:`h-3 w-3`})})]})})]}),u&&s(`tr`,{className:`border-t border-border bg-background/30`,children:n(`td`,{colSpan:7,className:`px-4 py-3 space-y-4`,children:[t.locationIds.length===0&&s(`p`,{className:`text-xs text-foreground-subtle italic`,children:`This entry has no locations selected.`}),t.locationIds.map(e=>n(`div`,{className:`space-y-1.5`,children:[s(`div`,{className:`text-[11px] font-medium text-foreground-subtle`,children:l.get(e)?.displayName??e}),s(me,{destinationId:e,restoreSupported:l.get(e)?.restoreSupported??!0,...p?{onOpenRestoreWizard:p}:{}})]},e))]})})]})}t();var Y=[{id:`manual`,label:`Manual only`,cron:``},{id:`hourly`,label:`Every hour`,cron:`0 * * * *`,description:`On the hour`},{id:`every-3h`,label:`Every 3 hours`,cron:`0 */3 * * *`,description:`00:00, 03:00, 06:00, 09:00 …`},{id:`every-6h`,label:`Every 6 hours`,cron:`0 */6 * * *`,description:`00:00, 06:00, 12:00, 18:00`},{id:`daily-3am`,label:`Daily at 03:00`,cron:`0 3 * * *`,description:`Every night at 3 AM`},{id:`weekly-sun`,label:`Weekly Sunday 03:00`,cron:`0 3 * * 0`,description:`Sunday morning at 3 AM`}];function ye(e){let t=e.trim();for(let e of Y)if(e.cron===t)return e.id;return`custom`}function be({value:e,onChange:t,previewCount:r=5,disabled:i=!1}){let a=ye(e),[l,u]=o(a===`custom`);c(()=>{a!==`custom`&&u(!1)},[a]);let d=Ce(e,250),f=w({cron:d,count:r},{enabled:d.trim().length>0}),p=f.data??null,m=e=>{u(!1),t(e.cron)},h=l||a===`custom`;return n(`div`,{className:`space-y-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Schedule preset`}),n(`div`,{className:`flex flex-wrap gap-1.5`,children:[Y.map(e=>s(`button`,{type:`button`,onClick:()=>m(e),disabled:i,className:`rounded border px-2 py-1 text-[11px] transition-colors disabled:opacity-50 `+(!l&&a===e.id?`border-primary bg-primary/10 text-primary`:`border-border bg-background text-foreground-subtle hover:bg-primary/5 hover:text-foreground`),title:e.description??e.label,children:e.label},e.id)),s(`button`,{type:`button`,onClick:()=>{u(!0),e.trim().length===0&&t(`0 3 * * *`)},disabled:i,className:`rounded border px-2 py-1 text-[11px] transition-colors disabled:opacity-50 `+(h?`border-primary bg-primary/10 text-primary`:`border-border bg-background text-foreground-subtle hover:bg-primary/5 hover:text-foreground`),children:`Custom…`})]})]}),h&&n(`div`,{className:`space-y-1`,children:[s(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Cron expression (5-field POSIX)`}),s(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),disabled:i,placeholder:`0 3 * * *`,spellCheck:!1,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs font-mono text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary`}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,s(`span`,{className:`font-mono`,children:`minute hour day-of-month month day-of-week`}),` · all times server-local`]})]}),s(xe,{cron:d,preview:p,loading:f.isFetching})]})}function xe({cron:e,preview:t,loading:r}){return r&&t===null?n(`div`,{className:`flex items-center gap-2 rounded border border-border bg-background/40 px-3 py-2 text-[11px] text-foreground-subtle`,children:[s(H,{className:`h-3 w-3 animate-spin`}),`Validating…`]}):t===null?null:t.ok?t.nextRuns.length===0?s(`div`,{className:`rounded border border-border bg-background/40 px-3 py-2 text-[11px] text-foreground-subtle`,children:`No future runs match this expression.`}):n(`div`,{className:`space-y-1`,children:[s(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Next runs`}),s(`ul`,{className:`rounded border border-border bg-background/40 divide-y divide-border`,children:t.nextRuns.map((e,t)=>n(`li`,{className:`flex items-center justify-between px-3 py-1.5 text-[11px]`,children:[s(`span`,{className:`text-foreground tabular-nums`,children:new Date(e).toLocaleString()}),s(`span`,{className:`text-foreground-subtle text-[10px] tabular-nums`,children:Se(e)})]},`${e}-${t}`))})]}):s(`div`,{className:`rounded border border-danger/40 bg-danger/10 px-3 py-2 text-[11px] text-danger`,children:t.error??`Invalid cron expression`})}function Se(e){let t=e-Date.now();if(t<=0)return`now`;let n=Math.floor(t/1e3);if(n<60)return`in ${n}s`;let r=Math.floor(n/60);if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}function Ce(e,t){let[n,i]=o(e),a=r(()=>e,[e]);return c(()=>{let e=setTimeout(()=>i(a),t);return()=>clearTimeout(e)},[a,t]),n}t();var we=[[`backup`,`listSchedules`]];function Te({entry:e,onClose:t,onSaved:i}){let c=a(),l=v(),u=l.data??[],[d,f]=o(e?.label??``),[p,m]=o(e?.cron??`0 3 * * *`),[h,g]=o(e?.enabled??!0),[_,y]=o(String(e?.retentionCount??7)),[b,x]=o(new Set(e?.locationIds??[])),S=E({onSuccess:()=>{c.invalidateQueries({queryKey:we}),i()}}),C=e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},w=Number.parseInt(_,10),T=r(()=>d.trim().length>0&&b.size>0&&!Number.isNaN(w)&&w>=1&&w<=1e3,[d,b,w]),D=()=>{T&&S.mutate({...e?{id:e.id}:{},label:d.trim(),cron:p.trim(),enabled:h,locationIds:Array.from(b),retentionCount:w})},O=S.error instanceof Error?S.error.message:null;return s(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,children:n(`div`,{className:`w-full max-w-lg rounded-xl border border-border bg-surface shadow-2xl max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3 sticky top-0 bg-surface`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:e?`Edit backup entry`:`New backup entry`}),s(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:s(V,{className:`h-4 w-4`})})]}),n(`div`,{className:`p-4 space-y-4`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Name`}),s(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`Nightly offsite`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary`})]}),n(`div`,{className:`space-y-1.5`,children:[n(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:[`Locations (`,b.size,` selected)`]}),l.isLoading&&n(`div`,{className:`flex items-center gap-2 px-1 py-2 text-xs text-foreground-subtle`,children:[s(H,{className:`h-3.5 w-3.5 animate-spin`}),`Loading locations…`]}),!l.isLoading&&u.length===0&&s(`div`,{className:`rounded border border-border bg-background px-3 py-2 text-xs text-foreground-subtle italic`,children:"No `backups` storage locations configured. Add one in Settings → Storage first."}),u.length>0&&s(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-52 overflow-y-auto`,children:u.map(e=>n(`label`,{className:`flex items-center justify-between px-3 py-2 text-xs hover:bg-primary/5 cursor-pointer`,children:[n(`div`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:b.has(e.id),onChange:()=>C(e.id),className:`accent-primary`}),s(`span`,{className:`text-foreground`,children:e.displayName})]}),n(`div`,{className:`flex items-center gap-1.5`,children:[s(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-surface border border-border rounded px-1.5 py-0.5`,children:e.kind}),s(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:e.id})]})]},e.id))})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Retention (archives kept)`}),s(`input`,{type:`number`,min:1,max:1e3,value:_,onChange:e=>y(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Enabled`}),n(`label`,{className:`inline-flex items-center gap-2 py-1.5 cursor-pointer`,children:[s(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`accent-primary`}),s(`span`,{className:`text-xs text-foreground-subtle`,children:`Run on schedule`})]})]})]}),n(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[s(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Schedule`}),s(be,{value:p,onChange:m,disabled:S.isPending})]}),O&&s(`div`,{className:`rounded border border-danger/40 bg-danger/10 px-3 py-2 text-[11px] text-danger`,children:O})]}),n(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3 sticky bottom-0 bg-surface`,children:[s(`button`,{onClick:t,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),n(`button`,{onClick:D,disabled:!T||S.isPending,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[S.isPending&&s(H,{className:`h-3.5 w-3.5 animate-spin`}),e?`Save`:`Create entry`]})]})]})})}t();var Ee=2e3,De=5e3;function X(e){return e.state===`queued`||e.state===`running`}function Oe(e){if(e.state===`queued`)return{title:`Cancel queued backup run?`,message:`This run has not started. Cancelling removes it from the queue — nothing has been written, nothing is deleted.`,confirmLabel:`Cancel run`,variant:`warning`};let t=e.completedDestinationIds.length;return{title:`Stop this backup run?`,message:`The half-written staging archive is deleted and the destination currently uploading discards its partial copy. ${t>0?`${t===1?`The 1 destination`:`The ${t} destinations`} that already completed KEEP${t===1?`S`:``} the archive.`:`No destination has completed yet, so nothing will be kept.`}`,confirmLabel:`Stop run`,variant:`danger`}}function ke(){let t=C(),[n,r]=o(null),i=h(void 0,{refetchInterval:e=>(e.state.data??[]).some(X)?Ee:De}),a=u({onSettled:()=>{r(null),i.refetch()}}),c=e(async e=>{await t(Oe(e))&&(r(e.id),a.mutate({runId:e.id}))},[t,a]);return s(Ae,{queryState:i.isError?`error`:i.data===void 0?`pending`:`ready`,runs:i.data??[],cancelingId:n,onCancelRequest:e=>{c(e)},now:Date.now()})}function Ae({queryState:e,runs:t,cancelingId:r,onCancelRequest:i,now:a}){let o=e===`ready`&&t.some(X),c=t.filter(e=>e.state===`running`),l=t.filter(e=>e.state===`queued`),u=t.filter(e=>!X(e)),d=[...c,...l,...u];return n(`section`,{className:`rounded-lg border border-border bg-surface`,children:[n(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border`,children:[s(`h2`,{className:`text-xs font-semibold text-foreground`,children:`Runs`}),o&&n(`span`,{className:`inline-flex items-center gap-1 text-[10px] font-medium text-primary`,title:`A backup run is in progress`,children:[s(`span`,{className:`h-1.5 w-1.5 rounded-full bg-primary animate-pulse`}),`live`]}),s(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:`One run executes at a time — queued runs wait in line.`})]}),e===`pending`&&s(`div`,{className:`px-3 py-2.5 text-xs text-foreground-subtle animate-pulse`,children:`Checking for backup runs…`}),e===`error`&&s(`div`,{className:`px-3 py-2.5 text-xs text-danger`,children:`Could not read backup runs — the orchestrator did not answer.`}),e===`ready`&&t.length===0&&s(`div`,{className:`px-3 py-2.5 text-xs text-foreground-subtle italic`,children:`No backup runs yet. Runs appear here the moment one starts — manual or scheduled.`}),e===`ready`&&t.length>0&&s(`div`,{className:`overflow-x-auto`,children:n(`table`,{className:`w-full text-xs min-w-[720px]`,children:[s(`thead`,{children:n(`tr`,{className:`text-foreground-subtle bg-background/30`,children:[s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Run`}),s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`State`}),s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Progress`}),s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Destinations`}),s(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Timing`}),s(`th`,{className:`text-right px-3 py-1.5 font-medium w-28`,children:`Actions`})]})}),s(`tbody`,{children:d.map(e=>s(je,{run:e,canceling:r===e.id,onCancelRequest:i,now:a},e.id))})]})})]})}function je({run:e,canceling:t,onCancelRequest:r,now:i}){let a=X(e);return n(`tr`,{className:`border-t border-border hover:bg-primary/5 align-top`,children:[n(`td`,{className:`px-3 py-2`,children:[s(`div`,{className:`text-foreground`,children:e.label??s(`span`,{className:`text-foreground-subtle italic`,children:`manual`})}),s(`div`,{className:`text-[10px] text-foreground-subtle font-mono`,title:e.id,children:e.id.slice(0,8)})]}),n(`td`,{className:`px-3 py-2`,children:[s(Me,{run:e}),e.state===`failed`&&e.error!==void 0&&s(`div`,{className:`mt-1 text-[10px] text-danger max-w-56 truncate`,title:e.error,children:e.error})]}),s(`td`,{className:`px-3 py-2`,children:s(Ne,{run:e})}),s(`td`,{className:`px-3 py-2`,children:s(Pe,{run:e})}),s(`td`,{className:`px-3 py-2 text-foreground-subtle tabular-nums`,children:s(Fe,{run:e,now:i})}),s(`td`,{className:`px-3 py-2`,children:s(`div`,{className:`flex justify-end`,children:a&&n(`button`,{onClick:()=>r(e),disabled:t,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:e.state===`queued`?`Remove this run from the queue before it starts`:`Stop this run — the half-written archive is discarded`,children:[t?s(H,{className:`h-3 w-3 animate-spin`}):s(ce,{className:`h-3 w-3`}),e.state===`queued`?`Cancel`:`Stop`]})})})]})}function Me({run:e}){switch(e.state){case`queued`:return n(`span`,{className:`inline-flex items-center gap-1 rounded bg-foreground-subtle/10 px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle`,children:[s(A,{className:`h-3 w-3`}),`Queued`]});case`running`:return n(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:[s(H,{className:`h-3 w-3 animate-spin`}),e.phase===`uploading`?`Uploading`:`Building archive`]});case`succeeded`:return n(`span`,{className:`inline-flex items-center gap-1 rounded bg-success/10 px-1.5 py-0.5 text-[10px] font-medium text-success`,children:[s(R,{className:`h-3 w-3`}),`Succeeded`]});case`failed`:return n(`span`,{className:`inline-flex items-center gap-1 rounded bg-danger/10 px-1.5 py-0.5 text-[10px] font-medium text-danger`,children:[s(k,{className:`h-3 w-3`}),`Failed`]});case`cancelled`:return n(`span`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-300`,title:`Stopped before completing every destination — not a success`,children:[s(O,{className:`h-3 w-3`}),`Stopped`]})}}function Ne({run:e}){if(e.state===`queued`)return s(`span`,{className:`text-foreground-subtle`,children:e.queuePosition===void 0?s(`span`,{className:`italic`,children:`waiting its turn`}):n(`span`,{className:`inline-flex items-center gap-1`,children:[s(`span`,{className:e.queuePosition===1?`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`:`rounded bg-foreground-subtle/10 px-1.5 py-0.5 text-[10px] font-medium`,children:Ie(e.queuePosition)}),`in line`]})});if(e.state===`running`&&e.phase===`building`)return n(`span`,{className:`inline-flex items-center gap-1.5 text-foreground`,children:[s(I,{className:`h-3 w-3 text-primary`}),s(`span`,{className:`tabular-nums font-medium animate-pulse`,children:K(e.stagedBytes)}),s(`span`,{className:`text-foreground-subtle`,children:`staged so far`})]});if(e.state===`running`){let t=e.archiveSizeBytes;return n(`span`,{className:`inline-flex items-center gap-1.5 text-foreground`,children:[s(ue,{className:`h-3 w-3 text-primary`}),n(`span`,{className:`tabular-nums font-medium`,children:[K(e.uploadedBytes),t===void 0?``:` / ${K(t)}`]}),s(`span`,{className:`text-foreground-subtle`,children:`to current destination`})]})}let t=e.archiveSizeBytes??(e.stagedBytes>0?e.stagedBytes:void 0);return t===void 0?s(`span`,{className:`text-foreground-subtle italic`,children:`—`}):n(`span`,{className:`tabular-nums text-foreground`,children:[K(t),` archive`]})}function Pe({run:e}){let t=e.destinationIds.length,r=e.completedDestinationIds.length,i=e.failedDestinationIds.length;return t===0?s(`span`,{className:`text-foreground-subtle italic`,children:`not resolved yet`}):n(`div`,{className:`flex flex-col gap-0.5`,children:[n(`span`,{className:`text-foreground-subtle`,title:e.destinationIds.join(`, `),children:[t,` target`,t===1?``:`s`]}),n(`span`,{className:`inline-flex items-center gap-2 text-[10px]`,children:[r>0&&n(`span`,{className:`text-success`,title:`Kept their archive: ${e.completedDestinationIds.join(`, `)}`,children:[`✓ `,r,` completed`]}),i>0&&n(`span`,{className:`text-danger`,title:`Failed: ${e.failedDestinationIds.join(`, `)}`,children:[`✗ `,i,` failed`]})]})]})}function Fe({run:e,now:t}){return e.state===`queued`?n(`span`,{children:[`queued `,Z(t-e.requestedAt),` ago`]}):e.startedAt===void 0?s(`span`,{children:`—`}):e.finishedAt===void 0?n(`span`,{children:[`running for `,Z(t-e.startedAt)]}):n(`div`,{className:`flex flex-col gap-0.5`,children:[s(`span`,{children:Le(e.finishedAt)}),n(`span`,{className:`text-[10px]`,children:[`took `,Z(e.finishedAt-e.startedAt)]})]})}function Ie(e){if(e<=1)return`next`;let t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function Z(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h ${String(n%60).padStart(2,`0`)}m`}function Le(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}t();var Re=[[`backup`,`list`]];function Q({initialDestinationId:e,initialArchiveId:t,onClose:i,onScheduled:l}){let u=a(),[d,f]=o(e&&t?2:1),[p,m]=o(e),[h,_]=o(t),[y,x]=o(new Set),{data:C}=v(),w=C??[],{data:T,isLoading:E}=S({destinationId:p??``},{enabled:!!p}),D=T??[];c(()=>{if(p!==void 0)return;let e=w.filter(e=>e.restoreSupported);e.length===1&&m(e[0].id)},[p,w]);let{data:O}=b({destinationId:p??``,backupId:h??``},{enabled:!!p&&!!h}),k=r(()=>O?.locations??[],[O]);c(()=>{k.length!==0&&x(e=>e.size===0?new Set(k):e)},[k]);let A=g({onSuccess:()=>{u.invalidateQueries({queryKey:Re}),l(),i()}}),j=e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},M=!!p&&!!h,N=y.size>0,P=M&&N&&!A.isPending,F=()=>{!p||!h||A.mutate({destinationId:p,backupId:h,locations:[...y]})};return s(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:i,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(`div`,{className:`space-y-0.5`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Restore Backup`}),n(`p`,{className:`text-xs text-foreground-subtle`,children:[`Step `,d,` of 3 —`,` `,d===1?`pick source`:d===2?`pick locations`:`confirm`]})]}),s(`button`,{onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:s(V,{className:`h-4 w-4`})})]}),d===1&&s(ze,{destinations:w,destinationId:p,onPickDestination:e=>{m(e),_(void 0),x(new Set)},archives:D,archivesLoading:E,archiveId:h,onPickArchive:_}),d===2&&s(Be,{locations:k,picked:y,onToggle:j}),d===3&&s(Ve,{destinationName:w.find(e=>e.id===p)?.displayName??p??``,archive:D.find(e=>e.id===h),picked:[...y]}),n(`div`,{className:`flex justify-between gap-2 border-t border-border px-4 py-3`,children:[s(`div`,{children:d>1&&n(`button`,{onClick:()=>f(e=>e===3?2:1),className:`inline-flex items-center gap-1 rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:[s(ie,{className:`h-3 w-3`}),`Back`]})}),n(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:i,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),d<3?n(`button`,{disabled:d===1&&!M||d===2&&!N,onClick:()=>f(e=>e===1?2:3),className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[`Next`,s(se,{className:`h-3 w-3`})]}):n(`button`,{onClick:F,disabled:!P,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[A.isPending?s(H,{className:`h-3.5 w-3.5 animate-spin`}):s(L,{className:`h-3.5 w-3.5`}),`Schedule Restore`]})]})]})]})})}function ze({destinations:e,destinationId:t,onPickDestination:r,archives:i,archivesLoading:a,archiveId:o,onPickArchive:c}){let l=e.filter(e=>e.restoreSupported);return n(`div`,{className:`p-4 space-y-3`,children:[n(`div`,{className:`space-y-1.5`,children:[s(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Destination`}),n(`select`,{value:t??``,onChange:e=>r(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:[s(`option`,{value:``,disabled:!0,children:`Select destination…`}),l.map(e=>n(`option`,{value:e.id,children:[e.displayName,` (`,e.kind,`)`]},e.id))]})]}),n(`div`,{className:`space-y-1.5`,children:[s(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Archive`}),!t&&s(`div`,{className:`text-xs text-foreground-subtle italic`,children:`Pick a destination first.`}),t&&a&&s(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Reading archives…`}),t&&!a&&i.length===0&&s(`div`,{className:`text-xs text-foreground-subtle italic`,children:`No archives available at this destination.`}),t&&i.length>0&&s(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:i.map(e=>{let t=o===e.id;return n(`label`,{className:`flex items-center justify-between px-3 py-2 text-xs cursor-pointer ${t?`bg-primary/10`:`hover:bg-primary/5`}`,children:[n(`div`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`radio`,name:`archive`,checked:t,onChange:()=>c(e.id),className:`accent-primary`}),n(`div`,{children:[s(`div`,{className:`font-medium text-foreground`,children:e.label??e.id}),s(`div`,{className:`text-[10px] text-foreground-subtle`,children:new Date(e.createdAt).toLocaleString()})]})]}),s(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:K(e.sizeBytes)})]},e.id)})})]})]})}function Be({locations:e,picked:t,onToggle:r}){return e.length===0?s(`div`,{className:`p-4`,children:s(`div`,{className:`text-xs text-foreground-subtle`,children:`Loading archive manifest… If this persists, the archive may predate manifests — restoring will apply everything in the tarball.`})}):n(`div`,{className:`p-4 space-y-3`,children:[s(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:`Selected entries will overwrite live data on the next server restart. Unchecked entries stay current.`}),n(`div`,{className:`space-y-1.5`,children:[s(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Apply`}),s(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:e.map(e=>n(`label`,{className:`flex items-center gap-2 px-3 py-2 text-xs hover:bg-primary/5 cursor-pointer`,children:[s(`input`,{type:`checkbox`,checked:t.has(e),onChange:()=>r(e),className:`accent-primary`}),s(`span`,{className:`font-mono text-foreground`,children:e}),s(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:Ue(e)})]},e))})]})]})}function Ve({destinationName:e,archive:t,picked:r}){return n(`div`,{className:`p-4 space-y-3 text-xs`,children:[s(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-amber-700 dark:text-amber-300`,children:`Restore is applied at next server boot. Active connections will drop when you restart.`}),n(`dl`,{className:`space-y-1.5`,children:[s($,{term:`Destination`,value:e}),s($,{term:`Archive`,value:t?.label??t?.id??`—`}),t&&s($,{term:`Created`,value:`${new Date(t.createdAt).toLocaleString()} · ${K(t.sizeBytes)}`}),s($,{term:`Locations`,value:r.length>0?r.join(`, `):`— (full archive)`})]})]})}function $({term:e,value:t}){return n(`div`,{className:`flex justify-between gap-3`,children:[s(`dt`,{className:`text-foreground-subtle`,children:e}),s(`dd`,{className:`text-foreground font-mono text-right truncate`,children:t})]})}var He={db:`Database`,addons:`Addon configs`,"addons-data":`Addon data`,tls:`TLS certificates`,cache:`Cache`,data:`Top-level data`};function Ue(e){return He[e]??``}t();function We(){let e=C(),t=d(),[r,i]=o(null),[a,c]=o(!1),[l,u]=o(!1),[f,p]=o(void 0),m=async()=>{await e({title:`Restart server now?`,message:`Active connections will drop and the apply-backup hook will run before boot.`,confirmLabel:`Restart`,variant:`warning`})&&t.mutate({confirm:!0})};return n(U,{children:[n(`div`,{className:`flex items-center justify-end gap-2 flex-wrap`,children:[n(`button`,{onClick:()=>c(!0),className:`inline-flex items-center gap-1.5 rounded-lg bg-surface border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-primary/5 hover:border-primary/30`,children:[s(L,{className:`h-3.5 w-3.5`}),`Restore…`]}),n(`button`,{onClick:()=>p(null),className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[s(re,{className:`h-3.5 w-3.5`}),`New entry`]})]}),l&&s(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2.5 text-xs text-amber-700 dark:text-amber-300`,children:n(`div`,{className:`flex items-center justify-between gap-3`,children:[n(`div`,{className:`flex items-center gap-2`,children:[s(L,{className:`h-3.5 w-3.5`}),s(`span`,{children:`Restore scheduled. Restart the server to apply.`})]}),n(`button`,{onClick:()=>{m()},disabled:t.isPending,className:`inline-flex items-center gap-1.5 rounded bg-amber-500/20 px-2 py-1 font-medium text-amber-800 dark:text-amber-200 hover:bg-amber-500/30 disabled:opacity-50`,children:[t.isPending?s(H,{className:`h-3.5 w-3.5 animate-spin`}):s(L,{className:`h-3.5 w-3.5`}),`Restart Now`]})]})}),s(ke,{}),s(_e,{onEdit:e=>p(e),onOpenRestoreWizard:e=>i(e)}),f!==void 0&&s(Te,{entry:f,onClose:()=>p(void 0),onSaved:()=>p(void 0)}),(r||a)&&s(Q,{...r?{initialDestinationId:r.destinationId,initialArchiveId:r.archiveId}:{},onClose:()=>{i(null),c(!1)},onScheduled:()=>u(!0)})]})}function Ge(){return s(`div`,{className:`flex flex-col p-4`,children:s(G,{tabs:[{id:`storage`,label:`Storage`,icon:ee,content:s(de,{})},{id:`backup`,label:`Backup`,icon:q,content:s(We,{})}]})})}export{Ge as DataPage};
|
|
@@ -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,at as u}from"./player-overlays-Du1iI4WG.js";import{$a as d,$o as f,Aa as p,Fo as m,Ho as h,Io as g,Jr as _,Lo as v,Ro as y,Sn as b,Uo as x,Vo as S,Yt as C,Zo as w,Zs as T,as as E,cs as D,ec as O,es as k,ga as A,is as j,ls as ee,nc as M,ns as te,nt as N,os as ne,rn as re,ro as ie,rs as ae,rt as oe,sn as P,ss as se,ts as ce,wa as le,ya as ue,yn as de,zo as fe}from"./src-JHeBPIaR.js";import{Gt as F}from"./src-HONjyNN8.js";import{t as pe}from"./circle-x-CdNO4ICk.js";import{t as me}from"./download-LIPHDFGv.js";import{t as I}from"./hard-drive-BEeZwDeK.js";import{H as L,J as R,N as z,a as B,k as V,o as H,q as U,r as W,w as G}from"./index-DQCNw_qF.js";import{t as he}from"./AdminPage-CCD07UMs.js";import{i as ge}from"./authed-media-C_PsHBLq.js";import{t as _e}from"./DeviceAggregateSection-DkMW7Y6S.js";import{t as ve}from"./AdminTabs-BuvG675m.js";import{t as ye}from"./StorageLocationsPanel-BCrJ-KE-.js";import{t as K}from"./format-size-DIxKXxtj.js";var be=R(`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`}]]),xe=R(`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`}]]),Se=R(`settings-2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);t();var Ce=[{value:`all`,label:`All`},{value:`recording`,label:`Recordings`},{value:`events`,label:`Events`}],we={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},Te={columnKey:`at`,dir:`desc`};function Ee(e){return new Date(e).toLocaleString()}function De(){let[e,t]=o(`all`),{data:a,isLoading:c,isError:l}=h({},{refetchOnWindowFocus:!1}),{data:u,isLoading:d,isError:f}=le({},{refetchOnWindowFocus:!1}),{data:p}=_({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]),v=r(()=>{let t=[];return l&&e!==`events`&&t.push(`Recordings`),f&&e!==`recording`&&t.push(`Events`),t},[l,f,e]),y=r(()=>[{key:`at`,header:`When`,nowrap:!0,sortValue:e=>e.at,render:e=>s(`span`,{className:`text-foreground-subtle tabular-nums`,children:Ee(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 ${we[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?K(e.bytesReclaimed):`—`})}],[m]),b=c||d;return n(`div`,{className:`flex flex-col gap-4`,children:[s(`div`,{className:`flex items-center gap-1`,children:Ce.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))}),b&&g.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Loading activity…`]}):g.length===0?v.length>0?s(C,{icon:B,title:`Activity could not be read`,description:`The ${v.join(` and `)} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`}):s(C,{icon:U,title:`No activity yet`,description:`Prune, delete and rescan operations across recordings and events show up here.`}):n(i,{children:[v.length>0&&n(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[s(B,{className:`h-3 w-3 shrink-0`}),v.join(` and `),` did not answer — rows from`,` `,v.length===1?`that domain`:`those domains`,` are missing below.`]}),s(N,{columns:y,rows:g,rowKey:e=>e.id,minWidthPx:720,mobileMode:`scroll`,maxBodyHeight:oe,defaultSort:Te})]})]})}t();function Oe(){let e=_({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(C,{icon:L,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(re,{deviceId:c,children:s(_e,{deviceId:c,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},c)]})}t();var ke=`pipeline-analytics`;function Ae(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 je(){let e=a(),{nodes:t}=T(),{data:i,isLoading:o}=de({addonId:ke}),c=Ae(i),l=b({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(G,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:ke,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(G,{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(ye,{types:[`eventMedia`]})]})]})}t();var Me=[[`pipelineAnalytics`]],Ne=1440*60*1e3;function Pe(e,t){return t.get(e)??`Removed camera #${String(e)}`}var Fe=[{days:1,label:`1 day`},{days:7,label:`7 days`},{days:30,label:`30 days`},{days:90,label:`90 days`}];function Ie(){let t=a(),i=P(),[c,u]=o(30),[d,f]=o(null),{data:m,isLoading:h}=ue({},{refetchOnWindowFocus:!1}),{data:g}=_({isCamera:!0,projection:`slim`}),v=r(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.name);return e},[g]),y=e(()=>{t.invalidateQueries({queryKey:Me})},[t]),b=p({onSuccess:y}),x=A(),S=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`})&&b.mutate({olderThanMs:Date.now()-c*Ne,reason:`retention`})},[i,b,c]),w=e(async e=>{let t=Pe(e.deviceId,v);if(await i({title:`Delete all events for ${t}?`,message:`Permanently deletes ${String(e.rows)} event${e.rows===1?``:`s`} (${K(e.bytes)} of media) for this camera. This cannot be undone.`,confirmLabel:`Delete events`,variant:`danger`})){f(null);try{let n=await x.mutateAsync({deviceId:e.deviceId});y();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){f(`0 events deleted for ${t}. Media still listed (${K(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}f(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){f(e instanceof Error?e.message:String(e))}}},[i,x,v,y]),T=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:Pe(e.deviceId,v)})},{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:K(e.bytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`button`,{onClick:()=>{w(e)},disabled:x.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(H,{className:`h-3 w-3`}),`Delete`]})}],[v,w,x.isPending]);return h&&!m?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{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:K(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:Fe.map(e=>s(`option`,{value:e.days,children:e.label},e.days))}),n(`button`,{onClick:()=>{S()},disabled:b.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:[b.isPending?s(G,{className:`h-3 w-3 animate-spin`}):s(xe,{className:`h-3 w-3`}),`Prune now`]})]}),m.devices.length===0?s(C,{icon:z,title:`No stored events`,description:`No camera has persisted events yet.`}):s(N,{columns:T,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(C,{icon:z,title:`No event data`,description:`Pipeline analytics has not reported any event-store footprint yet.`})}function Le(){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(Ie,{})})]}),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(je,{})})]})]})}function Re(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 ze(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function Be(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`${ze(e)} · ${o}`}function Ve(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 He(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 Ue=[`high`,`mid`,`low`],We=[{value:1,label:`Real time (1×)`},{value:2,label:`2×`},{value:4,label:`4×`},{value:8,label:`8×`},{value:16,label:`16×`}],Ge=10080*60*1e3;function Ke(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 qe({onClose:e,onCreated:t}){let i=_({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(Ke(60)),[m,h]=o(Ke(0)),[g,y]=o(1),[b,x]=o(!0),[S,C]=o(``),[w,T]=o(null),E=c===``?a[0]?.id??null:c,D=new Date(f).getTime(),O=new Date(m).getTime(),k=Number.isFinite(D)&&Number.isFinite(O)&&D<O,A=v({onSuccess:()=>{t(),e()},onError:e=>T(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(V,{className:`h-3.5 w-3.5`}),`New export`]}),s(`button`,{onClick:e,className:`text-foreground-subtle hover:text-foreground`,children:s(W,{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:E??``,onChange:e=>l(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children: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:Ue.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:g,onChange:e=>y(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:We.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:S,onChange:e=>C(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:b,disabled:g!==1,onChange:e=>x(e.target.checked),className:`accent-primary`}),`Include audio`,g===1?``:` (real-time only)`]}),!k&&s(`p`,{className:`text-[11px] text-danger`,children:`"From" must be before "To".`}),w&&s(`p`,{className:`text-[11px] text-danger`,children:w})]}),n(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[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(E===null||!k)return;T(null);let e=S.trim();A.mutate({deviceId:E,profile:u,fromMs:D,toMs:O,options:{includeAudio:b,maxLifeMs:Ge,deleteAfterDownload:!1,...g===1?{}:{speed:g},...e.length>0?{title:e}:{}}})},disabled:E===null||!k||A.isPending,className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:A.isPending?`Queuing…`:`Create export`})]})]})})}t();var Je=[[`recordingExport`]],Ye={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 Xe(){let{data:e,isLoading:t}=fe({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:n}=O(F.RecordingExportProgress,e=>e.exportId),{map:i}=O(F.RecordingExportCompleted,e=>e.exportId),{map:a}=O(F.RecordingExportFailed,e=>e.exportId);return{rows:r(()=>He(e??[],n,i,a),[e,n,i,a]),isLoading:t}}function Ze(e){let[t,n]=o(()=>Date.now());return c(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Qe(){let t=a(),[i,c]=o(!1),l=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},d=P(),f=u().trpcClient,p=Ze(6e4),{rows:m,isLoading:h}=Xe(),{data:v}=_({isCamera:!0,projection:`slim`}),b=r(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),x=e(()=>{t.invalidateQueries({queryKey:Je})},[t]),S=g({onSuccess:x}),w=y({onSuccess:x}),[T,E]=o(null),D=e(async e=>{E(e.id);try{let{url:t}=await f.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await ge(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),x()}finally{E(null)}},[f,x]),O=e(async e=>{await d({title:`Cancel this export?`,message:`Stops the render. The partial file is discarded.`,confirmLabel:`Cancel export`,variant:`danger`})&&S.mutate({exportId:e.id})},[d,S]),k=e(async e=>{await d({title:`Delete this export?`,message:`Permanently removes the rendered file and its history row.`,confirmLabel:`Delete`,variant:`danger`})&&w.mutate({exportId:e.id})},[d,w]),A=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:Be(e.fromMs,e.toMs)})},{key:`variant`,header:`Variant`,render:e=>s(`span`,{className:`text-foreground-subtle`,children:Re(e.options)})},{key:`state`,header:`State`,render:e=>{let t=Ye[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(G,{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:Ve(e.expiresAt,p)})},{key:`size`,header:`Size`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:K(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:e=>{let t=e.state===`ready`,r=e.state===`queued`||e.state===`rendering`,i=e.state!==`deleted`;return n(`div`,{className:`flex items-center justify-end gap-1`,children:[t&&n(`button`,{onClick:()=>{D(e)},disabled:T===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:[T===e.id?s(G,{className:`h-3 w-3 animate-spin`}):s(me,{className:`h-3 w-3`}),`Download`]}),r&&n(`button`,{onClick:()=>{O(e)},disabled:S.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(pe,{className:`h-3 w-3`}),`Cancel`]}),i&&s(`button`,{onClick:()=>{k(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(H,{className:`h-3 w-3`})})]})}}],[b,p,T,S.isPending,w.isPending,D,O,k]);return h&&m.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{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(V,{className:`h-3.5 w-3.5`}),`New export`]})}),m.length===0?s(C,{icon:V,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(N,{columns:A,rows:m,rowKey:e=>e.id,minWidthPx:720}),i&&s(qe,{onClose:()=>c(!1),onCreated:l})]})}function $e(e){return e===null?`absent`:e.providers.length>0?`present`:`absent`}function et(e){let t=M.capabilities.getCapability.useQuery({name:e});return t.status===`pending`?`pending`:t.status===`error`?`unknown`:$e(t.data)}var tt=`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 nt=`storage-migration`,rt=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function it(e){return[`${e.orphansReclaimed} orphan rows (${K(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${K(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${K(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function at(){return et(nt)===`present`?s(ot,{}):null}function ot(){let e=P(),[t,r]=o(!1),[i,a]=o(null),c=te({},{refetchInterval:2e3}),l=c.data??null,u=l!==null&&rt.has(l.phase),d=ce(),f=k(),p=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))}}},m=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 f.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:()=>{p()},className:tt,children:[(u||d.isPending)&&s(G,{className:`h-3 w-3 animate-spin`}),s(H,{className:`h-3 w-3`}),`Run cleanup`]}),u&&s(`button`,{type:`button`,onClick:()=>{m()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:`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(G,{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:it(l)}),l.error&&s(`p`,{className:`text-[11px] text-danger`,children:l.error})]})]})}t();var st=2e3;function ct(){let e=P(),t=a(),r=ie(),i=d(void 0,{refetchInterval:e=>e.state.data?.state===`running`?st:!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 f=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())},p=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 f(),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(G,{className:`h-3.5 w-3.5 animate-spin`}):s(I,{className:`h-3.5 w-3.5`}),p]}),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 q=1e3,J=60*q,Y=60*J;function X(e){return e.toLocaleString(`en-US`)}function lt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=Y){let t=Math.floor(e/Y),n=Math.round(e%Y/J);return`${t.toString()}h ${n.toString()}m`}if(e>=J){let t=Math.floor(e/J),n=Math.round(e%J/q);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/q)).toString()}s`}function ut(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${X(e.filesMoved)} files`:`${X(e.filesMoved)} / ${X(e.filesTotal)} files`,r=e.filesTotal===null||e.filesTotal===0?null:Math.min(1,e.filesMoved/e.filesTotal),i=t>0&&e.filesMoved>0,a=i?`${K(e.bytesMoved/t*q)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${lt(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${K(e.bytesMoved)} moved`,rate:a,eta:s}}function dt(e){let t=ut(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}t();var ft=`storage-migration`,Z=[{id:`recordings`,label:`Recordings`,locationType:`recordings`},{id:`recordingsLow`,label:`Low-res recordings`,locationType:`recordingsLow`},{id:`eventMedia`,label:`Event media`,locationType:`eventMedia`}],pt=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function mt(){let e=et(ft);return e===`pending`?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Checking whether storage migration is installed…`]}):e===`unknown`?s(C,{icon:B,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(C,{icon:be,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(ht,{})}function ht(){let e=P(),{data:t}=w({}),[i,a]=o({}),[c,l]=o({}),[u,d]=o(null),[p,m]=o(null),h=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]),_=ee({},{refetchInterval:2e3}),v=_.data??null,y=v!==null&&pt.has(v.phase),b=r(()=>{let e={};for(let t of Z){let n=i[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i]),x=r(()=>{let e={};for(let t of Z){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]),S=r(()=>({destinations:b??{},...x?{sources:x}:{}}),[b,x]),C=ne(S,{enabled:!1,retry:!1}),T=D(),E=f(),O=async()=>{if(!b)return;m(null);let e=await C.refetch();if(e.error){m(e.error instanceof Error?e.error.message:String(e.error));return}d(e.data??null)},k=async()=>{if(b&&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`})){m(null);try{await T.mutateAsync(S),d(null),await _.refetch()}catch(e){m(e instanceof Error?e.message:String(e))}}},A=async()=>{if(v&&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 E.mutateAsync({jobId:v.jobId}),await _.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(be,{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:Z.map(e=>{let t=h.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:y,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:y,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)})}),p&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:p}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[n(`button`,{type:`button`,onClick:()=>{O()},disabled:!b||C.isFetching||y,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:[C.isFetching&&s(G,{className:`h-3 w-3 animate-spin`}),`Plan`]}),n(`button`,{type:`button`,onClick:()=>{k()},disabled:!b||T.isPending||y,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:[T.isPending&&s(G,{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}`))}),v&&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`}),y&&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(W,{className:`h-3 w-3`}),`Cancel`]})]}),n(`p`,{className:`mt-1 text-xs text-foreground`,children:[`Phase: `,s(`span`,{className:`font-medium`,children:v.phase}),y&&s(G,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),v.error&&s(`p`,{className:`mt-1 text-[11px] text-danger`,children:v.error}),v.pausedParticipants.length>0&&n(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[`Paused: `,v.pausedParticipants.join(`, `)]}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:v.moves.map(e=>s(gt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),s(_t,{})]}),s(vt,{running:y}),s(bt,{})]})}function gt({move:e}){let t=e.progress===null?null:ut(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:dt(e.progress)})]})]})}function _t(){let{data:e}=j({});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 vt({running:e}){let t=P(),r=se({},{staleTime:1/0,refetchOnWindowFocus:!1}),i=ae(),[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:yt(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 yt(e){if(e.items===null)return`amount unknown — the archive could not be read`;let t=e.items.toLocaleString(`en-US`);return e.bytes===null?`${t} rows`:`${t} segments · ${K(e.bytes)}`}function bt(){let{data:e}=E({},{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:dt({filesMoved:e.job.filesMoved,filesTotal:e.job.filesTotal,bytesMoved:e.job.bytesMoved,startedAt:e.job.startedAt,observedAt:e.observedAt})})]},e.job.jobId))})]})}function xt(){return n(`div`,{className:`flex flex-col gap-4`,children:[s(at,{}),s(ct,{}),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(mt,{})})]})]})}t();var St=`recorder`;function Ct(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 wt(){let e=a(),{nodes:t}=T(),{data:i,isLoading:o}=de({addonId:St}),c=Ct(i,`recordingNodeId`,`hub`),l=b({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(G,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:St,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(G,{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(ye,{types:[`recordings`,`recordingsLow`]})]})]})}function Tt(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Et(e,t){let n=Tt(e);return n.length===0?`default root`:n.map(e=>t.get(e)??e).join(` + `)}function Dt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Et(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Tt(e).includes(n));return i===void 0?null:{label:Et(i,t),exact:!1}}var Q=[`ok`,`warn`,`critical`];function Ot(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function kt(e){return Math.min(1,Math.max(0,e))}function At(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=kt((n-t)/n);return{fraction:r,severity:Ot(r),recordingsFraction:kt(e.usedBytes/n),freeBytes:t,totalBytes:n}}function jt(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=At(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||Q.indexOf(e.severity)>Q.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}t();var Mt=[[`recording`]],Nt=[{value:`retention`,label:`Retention policy`},{value:`quota`,label:`Quota / disk pressure`},{value:`operator`,label:`Operator`}],Pt={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Ft={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function It(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 Lt(){let t=a(),i=P(),[c,u]=o(`retention`),{data:d,isLoading:f}=S({},{refetchOnWindowFocus:!1}),{data:p}=_({isCamera:!0,projection:`slim`}),{data:h}=w({}),g=r(()=>{let e=new Map;for(let t of p??[])e.set(t.id,t.name);return e},[p]),v=r(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.displayName);return e},[h]),y=r(()=>{let e=h??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[h]),b=r(()=>d?.locations??[],[d?.locations]),T=r(()=>Dt(b,v,y),[b,v,y]),E=r(()=>jt(b),[b]),D=e(()=>{t.invalidateQueries({queryKey:Mt})},[t]),O=x({onSuccess:D}),k=m({onSuccess:D}),A=e(async e=>{await i({title:`Prune ${g.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Applies the retention policy now (reason: ${c}). Footage beyond the policy is permanently deleted.`,confirmLabel:`Prune now`,variant:`danger`})&&O.mutate({deviceId:e.deviceId,reason:c})},[i,O,c,g]),j=e(async e=>{await i({title:`Delete all footage for ${g.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${K(e.usedBytes)} of recorded footage for this camera. This cannot be undone.`,confirmLabel:`Delete ${K(e.usedBytes)}`,variant:`danger`})&&k.mutate({deviceId:e.deviceId})},[i,k,g]),ee=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:g.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:`Disk`,nowrap:!0,render:()=>T===null?s(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:T.exact?`text-foreground`:`text-foreground-subtle`,title:T.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:[T.label,!T.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:K(e.usedBytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[n(`button`,{onClick:()=>{A(e)},disabled:O.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,title:`Apply retention policy now`,children:[s(xe,{className:`h-3 w-3`}),`Prune`]}),n(`button`,{onClick:()=>{j(e)},disabled:k.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(H,{className:`h-3 w-3`}),`Delete`]})]})}],[g,T,A,j,O.isPending,k.isPending]);if(f&&!d)return n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Loading storage usage…`]});if(!d)return s(C,{icon:I,title:`No storage data`,description:`The recording node has not reported any storage usage yet.`});let M=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(I,{className:`h-3 w-3`}),footer:`${String(M)} camera${M===1?``:`s`} on ${d.nodeId}`,children:K(d.totalUsedBytes)}),E!==null&&E.severity!==null&&s(l,{label:`Free on recordings volumes`,icon:s(I,{className:`h-3 w-3`}),footer:`across ${String(E.knownVolumes)} volume${E.knownVolumes===1?``:`s`} of ${K(E.totalBytes)}`+(E.unknownVolumes>0?` · ${String(E.unknownVolumes)} did not report capacity`:``),children:s(`span`,{className:`tabular-nums ${Ft[E.severity]}`,children:K(E.freeBytes)})}),b.map(e=>{let t=At(e),r=e.locationId??e.root??`default`;return s(l,{label:`Disk: ${It(e,v)}`,footer:t===null?`${K(e.usedBytes)} of recordings · volume capacity unknown`:`${K(t.freeBytes)} free of ${K(t.totalBytes)} · ${K(e.usedBytes)} recordings (${$(t.recordingsFraction)})`,children:t===null?s(`span`,{className:`tabular-nums`,children:K(e.usedBytes)}):n(`div`,{className:`flex items-center gap-2`,title:`Volume fill — everything on the disk, not only recordings. Warn at 85%, critical at 95%.`,children:[s(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:s(`div`,{className:`h-full rounded ${Pt[t.severity]}`,style:{width:$(t.fraction)}})}),s(`span`,{className:`tabular-nums text-xs ${Ft[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=Nt.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:Nt.map(e=>s(`option`,{value:e.value,children:e.label},e.value))})]}),M===0?s(C,{icon:I,title:`No recorded footage`,description:`No camera has recorded footage on this node yet.`}):s(N,{columns:ee,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Rt(){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(Lt,{})})]}),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(wt,{})})]})]})}function zt(){return s(he,{icon:V,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(ve,{tabs:[{id:`storage`,label:`Recordings`,icon:I,content:s(Rt,{})},{id:`events`,label:`Events`,icon:z,content:s(Le,{})},{id:`cameras`,label:`Cameras`,icon:L,content:s(Oe,{})},{id:`exports`,label:`Export`,icon:V,content:s(Qe,{})},{id:`activity`,label:`Activity`,icon:U,content:s(De,{})},{id:`management`,label:`Management`,icon:Se,content:s(xt,{})}]})})}export{zt as RecordingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as e,S as t,W as n,o 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{Xo as o,Yo as s,Zo as c,sn as l,us as u}from"./src-JHeBPIaR.js";import{i as d,n as f,r as p,t as m}from"./AddLocationWizard-CIBAcYT0.js";e();function h({types:e}){let h=r(),g=l(),{data:_}=c({}),v=o(),y=n(()=>v.data??[],[v.data]),[b,x]=i(null),[S,C]=i(null),w=()=>{h.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},T=u({onSuccess:w}),E=s({onSuccess:w}),D=n(()=>{let e=new Map;for(let t of _??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[_]),O=(e,t)=>{T.mutate(d(e,{enabled:t}))},k=(e,t)=>{T.mutate(d(e,{readOnly:t}))},A=async e=>{if(await g({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`}))try{await E.mutateAsync({id:e.id})}catch(t){await g({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`})&&E.mutate({id:e.id,force:!0})}},j=e.map(e=>y.find(t=>t.id===e)).filter(e=>e!==void 0);return t(`div`,{className:`space-y-3`,children:[j.length===0?a(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):j.map(e=>a(p,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:D.get(e.id)??[],onAdd:e=>x(e),onEdit:e=>C(e),onDelete:e=>{A(e)},onToggleEnabled:(e,t)=>O(e,t),onToggleReadOnly:(e,t)=>k(e,t)},e.id)),b!==null&&a(m,{initialType:b,onClose:()=>x(null),onCreated:()=>{w(),x(null)}}),S!==null&&a(f,{location:S,onClose:()=>C(null),onSaved:()=>{w(),C(null)}})]})}export{h as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e}from"./index-DQCNw_qF.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e}from"./index-DQCNw_qF.js";var t=e(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e}from"./index-DQCNw_qF.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e}from"./index-DQCNw_qF.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};
|