@camstack/addon-admin-ui 1.2.427 → 1.2.428
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/{AddonAssetIcon-BgXfFdy2.js → AddonAssetIcon-Cs_blBpK.js} +1 -1
- package/dist/assets/Addons-2xWF73cR.js +4 -0
- package/dist/assets/{AdminPage-C0Zxs_ot.js → AdminPage-DuuyDIsY.js} +1 -1
- package/dist/assets/{AdminSectionedPage-D2kYQhvu.js → AdminSectionedPage-C3VHg80L.js} +1 -1
- package/dist/assets/AiProfiles-DmHcVlS2.js +3 -0
- package/dist/assets/BrokerForm-Dqhjsi3Y.js +1 -0
- package/dist/assets/Build-CBYP1fT5.js +40 -0
- package/dist/assets/Calendars-C926x7b_.js +1 -0
- package/dist/assets/Cluster-OZlA14uV.js +1 -0
- package/dist/assets/ClusterStepModel-DHbwIGAW.js +1 -0
- package/dist/assets/CompositionEditor-vP3JcV2R.js +1 -0
- package/dist/assets/{CompositionEditorPage-CDyW_Buu.js → CompositionEditorPage-Acq7iapA.js} +1 -1
- package/dist/assets/Data-7BoejvKA.js +1 -0
- package/dist/assets/DeviceDetail-ByM0856T.js +2 -0
- package/dist/assets/DeviceDoActionFields-BDJsvRNX.js +1 -0
- package/dist/assets/{Devices-CHeb_BTk.js → Devices-PIrWjfhq.js} +1 -1
- package/dist/assets/EmbedPlayerPage-RXOmf2F3.js +1 -0
- package/dist/assets/Identity-C-tztwfa.js +1 -0
- package/dist/assets/IntegrationDetail-DugB7cv6.js +1 -0
- package/dist/assets/IntegrationHub-BePMbmC5.js +1 -0
- package/dist/assets/Integrations-Dj3nT9ZT.js +1 -0
- package/dist/assets/Integrations-OH5z-t03.js +1 -0
- package/dist/assets/Library-DDNti2te.js +1 -0
- package/dist/assets/Locations-OL9_NoSi.js +3 -0
- package/dist/assets/Logs-DIeXeCqI.js +1 -0
- package/dist/assets/{MotionZonesSettings-DjvGw8j4.js → MotionZonesSettings-CfTOerul.js} +1 -1
- package/dist/assets/MyAccess-iJP3JQIS.js +2 -0
- package/dist/assets/Network-DYssxNiN.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-mmtEgDbu.js +1 -0
- package/dist/assets/Notifications-DEcxFWp3.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-IK6ytyM8.js → PrivacyMaskSettings-CJUKFEIs.js} +1 -1
- package/dist/assets/Recordings-lygSYEJj.js +1 -0
- package/dist/assets/ScanNetworkModal-C2oJlLfj.js +1 -0
- package/dist/assets/{SceneMonitorEditor-V_pHxg3U.js → SceneMonitorEditor-D1S-D2V9.js} +1 -1
- package/dist/assets/SessionsList-CIN4GdSm.js +2 -0
- package/dist/assets/{Showroom-Cw-6ZdvC.js → Showroom-W2yJvb8s.js} +1 -1
- package/dist/assets/System-ChWpOOqN.js +1 -0
- package/dist/assets/{Terminal-D-YHBrHK.js → Terminal-CrFum1tE.js} +5 -5
- package/dist/assets/{Viewer-BmXiweP2.js → Viewer-YBzeS3RA.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-wt87pCBz.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CE2IIKhe.js} +1 -1
- package/dist/assets/{addon-icons-context-CvwUgMRr.js → addon-icons-context-D6glxUQF.js} +1 -1
- package/dist/assets/{archive-Bwv0mNo-.js → archive-kvflMCgL.js} +1 -1
- package/dist/assets/{authed-media-0TPg9TTZ.js → authed-media-CSlndmzS.js} +1 -1
- package/dist/assets/{bell-off-D2KzCQW2.js → bell-off-BYnwGeiH.js} +1 -1
- package/dist/assets/{boxes-BXQUMgws.js → boxes-Dx4USyB3.js} +1 -1
- package/dist/assets/circle-slash-D5mo-8G0.js +1 -0
- package/dist/assets/client-CMlUvfoK.js +358 -0
- package/dist/assets/{cloud-upload-BsULjxPu.js → cloud-upload-82x5w5u8.js} +1 -1
- package/dist/assets/crop-Dev61hIh.js +1 -0
- package/dist/assets/{device-integration-icon-CCoHGEQZ.js → device-integration-icon-bTnWrYe0.js} +1 -1
- package/dist/assets/device-picker-model-DlnG_8P7.js +1 -0
- package/dist/assets/{dist-DQtBl_2T.js → dist--5X8Gy0U.js} +1 -1
- package/dist/assets/{dist-DWoekMi0.js → dist-Dod19ois.js} +13 -13
- package/dist/assets/{eraser-DB7_WMyf.js → eraser-B8Awx5Sj.js} +1 -1
- package/dist/assets/{file-up-DuqaeMYR.js → file-up-LqDVgVVa.js} +1 -1
- package/dist/assets/{hard-drive-download-CKj8xKOz.js → hard-drive-download-C24D80x2.js} +1 -1
- package/dist/assets/{history-V8RQKQAb.js → history-DZsORyBG.js} +1 -1
- package/dist/assets/{hostInit-CdxLRG1l.js → hostInit-D2EmEDvv.js} +1 -1
- package/dist/assets/i18n-vggiB6gm.js +1 -0
- package/dist/assets/{icons-CEMmjIEL.js → icons-D5RaCH1q.js} +1 -1
- package/dist/assets/index-BgQGn3LX.js +4 -0
- package/dist/assets/index-BndCgmxf.css +2 -0
- package/dist/assets/{key-Bj5-ZBrb.js → key-DLwSBrPM.js} +1 -1
- package/dist/assets/{key-round-B2I1YisX.js → key-round-CYflkUyd.js} +1 -1
- package/dist/assets/{layers-BARFkXZ5.js → layers-C1wzFfr1.js} +1 -1
- package/dist/assets/linked-devices-model-CCTQ_gka.js +1 -0
- package/dist/assets/{list-ordered-9lF0Gp3K.js → list-ordered-CFeS9o_w.js} +1 -1
- package/dist/assets/location-owned-usage-DSLiI6RY.js +1 -0
- package/dist/assets/{log-in-CjtrIfG3.js → log-in-Be_RcxDr.js} +1 -1
- package/dist/assets/{memory-stick-B26_SbtH.js → memory-stick-4BwYEagi.js} +1 -1
- package/dist/assets/{message-square-plus-COMrVZEZ.js → message-square-plus-D7BNG3h7.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-ec37d41a.js → mf-entry-bootstrap-0-9df0d08c.js} +2 -2
- package/dist/assets/{mic-off-DBIqFVjg.js → mic-off-e162Bcfu.js} +1 -1
- package/dist/assets/{monitor-off-CTQMySOs.js → monitor-off-CARYfHC4.js} +1 -1
- package/dist/assets/{monitor-smartphone-iBd_3nPv.js → monitor-smartphone-lsNgnRRZ.js} +1 -1
- package/dist/assets/mount-DlnG_8P7.js +1 -0
- package/dist/assets/notification-schedule-field-DWpT_5Vh.js +1 -0
- package/dist/assets/{octagon-alert-DMjnTemh.js → octagon-alert-h80nyWRM.js} +1 -1
- package/dist/assets/{player-overlays-DWMIy1MJ.js → player-overlays-Cda8wso6.js} +1 -1
- package/dist/assets/{recycle-BCVF0r6Y.js → recycle-0MLWppmT.js} +1 -1
- package/dist/assets/remoteEntry-V_83-NrI.js +1 -0
- package/dist/assets/{scan-eye-DRXP3PgB.js → scan-eye-DVK8MF3K.js} +1 -1
- package/dist/assets/{scissors-DUFtPb9T.js → scissors-Cz3GoeOd.js} +1 -1
- package/dist/assets/{search-x-B3nve3vV.js → search-x-i_A-Upbe.js} +1 -1
- package/dist/assets/{send-P2KlabIu.js → send-B5VKcNUH.js} +1 -1
- package/dist/assets/{settings-2-reEhyiKz.js → settings-2-ZQsYJ0Zb.js} +1 -1
- package/dist/assets/{speaker-DSNMuvS8.js → speaker-Cl8DZGk_.js} +1 -1
- package/dist/assets/{src-BLkInT8U.js → src-eoSUZcV-.js} +8 -8
- package/dist/assets/{timer-reset-CsRTbSzh.js → timer-reset-A5ofAkBW.js} +1 -1
- package/dist/assets/{ungroup-BLeVa8__.js → ungroup-t0yDnzVf.js} +1 -1
- package/dist/assets/{unlink-DeNvF8r-.js → unlink-C1ZpCxl3.js} +1 -1
- package/dist/assets/{usb-CFseVsQJ.js → usb-DmUPajSy.js} +1 -1
- package/dist/assets/{use-scenes-feed-C8frh3hQ.js → use-scenes-feed-BQlYhRMq.js} +1 -1
- package/dist/assets/{use-stationary-objects-DNayAuMq.js → use-stationary-objects-BWM4vE0E.js} +1 -1
- package/dist/assets/useEventInvalidation-DlnG_8P7.js +1 -0
- package/dist/assets/{useNodeUrlSelection-BsLRiUy8.js → useNodeUrlSelection-CTxv9Em7.js} +1 -1
- package/dist/assets/user-round-BTaID248.js +1 -0
- package/dist/assets/{user-x-CpaZ5HO0.js → user-x-DRcPeM9C.js} +1 -1
- package/dist/assets/{video--MLJeLNU.js → video-tLHyNE3q.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-1Do_dc2z.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DOOXjnRq.js} +2 -2
- package/dist/index.html +11 -10
- package/dist/server/addon.js +27 -3
- package/package.json +1 -1
- package/dist/assets/Addons-BTWw53aT.js +0 -4
- package/dist/assets/AiProfiles-Ca7zuVMp.js +0 -3
- package/dist/assets/BrokerForm-6-BwPs-g.js +0 -1
- package/dist/assets/Build-BsduavcU.js +0 -40
- package/dist/assets/Calendars-DVTk_2iT.js +0 -1
- package/dist/assets/Cluster-BPJ4maiI.js +0 -1
- package/dist/assets/ClusterStepModel-CjuZ-oml.js +0 -1
- package/dist/assets/CompositionEditor-DJcmWU2U.js +0 -1
- package/dist/assets/Data-CLLvqZwG.js +0 -1
- package/dist/assets/DeviceDetail-BKw1gufS.js +0 -2
- package/dist/assets/DeviceDoActionFields-R-ZYIdMv.js +0 -1
- package/dist/assets/EmbedPlayerPage-B4y0Q0wO.js +0 -1
- package/dist/assets/Identity-NOlTR-3q.js +0 -1
- package/dist/assets/IntegrationDetail-CcZkPlbN.js +0 -1
- package/dist/assets/IntegrationHub-CuW7-WRy.js +0 -1
- package/dist/assets/Integrations-ACdx4iPR.js +0 -1
- package/dist/assets/Integrations-DjnhmLye.js +0 -1
- package/dist/assets/Library-B3iyoKdK.js +0 -1
- package/dist/assets/Locations-Cs1VwmXB.js +0 -3
- package/dist/assets/Logs-BMc6WXCH.js +0 -1
- package/dist/assets/MyAccess-BfUfTXrv.js +0 -2
- package/dist/assets/Network-F2lAIcbT.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-D3ux_JIo.js +0 -1
- package/dist/assets/Notifications-Cp3qo_EC.js +0 -1
- package/dist/assets/Recordings-D91q74Ga.js +0 -1
- package/dist/assets/ScanNetworkModal-DjU-xM4X.js +0 -1
- package/dist/assets/SessionsList-DQ7kj8fX.js +0 -2
- package/dist/assets/System-DLLa4weE.js +0 -1
- package/dist/assets/circle-slash-DpUtlEnB.js +0 -1
- package/dist/assets/client-CjyKfSu1.js +0 -358
- package/dist/assets/crop-BtQBZ9jm.js +0 -1
- package/dist/assets/device-picker-model-1Z6p3UkP.js +0 -1
- package/dist/assets/index-D66JvELZ.js +0 -4
- package/dist/assets/index-dmZ34NAY.css +0 -2
- package/dist/assets/location-owned-usage-CNXQ-Obv.js +0 -1
- package/dist/assets/mount-1Z6p3UkP.js +0 -1
- package/dist/assets/notification-schedule-field-D8dd67dT.js +0 -1
- package/dist/assets/remoteEntry-RwWzzVu_.js +0 -1
- package/dist/assets/useEventInvalidation-1Z6p3UkP.js +0 -1
- package/dist/assets/user-round-BB0VDRnJ.js +0 -1
|
@@ -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{Hr as l,It as u,Kr as d,Nr as f,Nt as p,Qi as m,Y as h,ai as g,ar as _,dt as v,ot as y,wi as b,yr as x}from"./player-overlays-DWMIy1MJ.js";import{n as S,t as C}from"./scissors-DUFtPb9T.js";import{wi as w}from"./client-CjyKfSu1.js";import{$c as T,Ac as E,An as D,Bc as O,Bn as k,Bs as A,Dc as j,Dn as M,Ec as ee,En as te,Gc as ne,Ht as N,Jc as re,Kc as ie,Kn as ae,Mc as oe,Nc as se,Oc as ce,Qc as le,Rc as ue,Rn as P,Tn as de,Uc as fe,Ut as pe,Vc as F,Vn as I,Wc as me,Ws as he,Xc as ge,Yc as _e,Zc as ve,Zn as L,_r as R,du as z,el as ye,hs as be,jc as xe,jn as Se,kc as Ce,kn as we,ls as Te,ma as B,mr as V,mu as H,ps as Ee,qc as De,ss as Oe}from"./src-BLkInT8U.js";import{t as ke}from"./useTranslation-Bc5yH9V9.js";import{D as Ae,S as je}from"./index-D66JvELZ.js";import{t as Me}from"./AdminSectionedPage-D2kYQhvu.js";import{n as Ne}from"./authed-media-0TPg9TTZ.js";import{t as U}from"./format-size-DIxKXxtj.js";import{c as Pe,i as Fe,l as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve,u as He}from"./location-owned-usage-CNXQ-Obv.js";t();var Ue=[{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`},Ge={columnKey:`at`,dir:`desc`};function Ke(e){return new Date(e).toLocaleString()}function qe(){let[e,t]=o(`all`),{data:a,isLoading:c,isError:l}=ce({},{refetchOnWindowFocus:!1}),{data:u,isLoading:d,isError:f}=Ee({},{refetchOnWindowFocus:!1}),{data:h}=B({isCamera:!0,projection:`slim`}),g=r(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.name);return e},[h]),v=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]),y=r(()=>{let t=[];return l&&e!==`events`&&t.push(`Recordings`),f&&e!==`recording`&&t.push(`Events`),t},[l,f,e]),b=r(()=>[{key:`at`,header:`When`,nowrap:!0,sortValue:e=>e.at,render:e=>s(`span`,{className:`text-foreground-subtle tabular-nums`,children:Ke(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`:g.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:g.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?U(e.bytesReclaimed):`—`})}],[g]),x=c||d;return n(`div`,{className:`flex flex-col gap-4`,children:[s(`div`,{className:`flex items-center gap-1`,children:Ue.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))}),x&&v.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(_,{className:`h-4 w-4 animate-spin`}),`Loading activity…`]}):v.length===0?y.length>0?s(P,{icon:p,title:`Activity could not be read`,description:`The ${y.join(` and `)} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`}):s(P,{icon:m,title:`No activity yet`,description:`Prune, delete and rescan operations across recordings and events show up here.`}):n(i,{children:[y.length>0&&n(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[s(p,{className:`h-3 w-3 shrink-0`}),y.join(` and `),` did not answer — rows from`,` `,y.length===1?`that domain`:`those domains`,` are missing below.`]}),s(N,{columns:b,rows:v,rowKey:e=>e.id,minWidthPx:720,mobileMode:`scroll`,maxBodyHeight:pe,defaultSort:Ge})]})]})}t();function Je(){let e=B({isCamera:!0,projection:`slim`}),t=r(()=>(e.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[e.data]),[i,a]=o(null),c=i??t[0]?.id??null;return!e.isLoading&&t.length===0?s(P,{icon:b,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(ae,{deviceId:c,children:s(Ae,{deviceId:c,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},c)]})}t();function W({types:e}){let t=a(),i=L(),{data:c}=F({}),l=O(),u=r(()=>l.data??[],[l.data]),{data:d}=j({},{refetchOnWindowFocus:!1}),f=r(()=>Ve(c??[],d?.locations),[c,d?.locations]),[p,m]=o(null),[h,g]=o(null),_=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},v=ye({onSuccess:_}),y=ue({onSuccess:_}),b=r(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[c]),x=async(e,t)=>{Ie(t)&&!await i({title:`Disable "${e.displayName}"?`,message:`${Pe(t).consequence}\n\nNothing is deleted — set the location back to Read-only or Active to bring its footage back.`,confirmLabel:`Disable`,variant:`danger`})||v.mutate(Be(e,{mode:t}))},S=async e=>{if(await i({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`}))try{await y.mutateAsync({id:e.id})}catch(t){await i({title:`Delete anyway?`,message:`${t instanceof Error?t.message:String(t)}\n\nForcing removes the record only. Anything still on that location becomes unreachable.`,confirmLabel:`Force delete`,variant:`danger`})&&y.mutate({id:e.id,force:!0})}},C=e.map(e=>u.find(t=>t.id===e)).filter(e=>e!==void 0);return n(`div`,{className:`space-y-3`,children:[C.length===0?s(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):C.map(e=>s(Le,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:b.get(e.id)??[],onAdd:e=>m(e),onEdit:e=>g(e),onDelete:e=>{S(e)},ownedBytesById:f,onSetMode:(e,t)=>{x(e,t)}},e.id)),p!==null&&s(He,{initialType:p,onClose:()=>m(null),onCreated:()=>{_(),m(null)}}),h!==null&&s(Re,{location:h,onClose:()=>g(null),onSaved:()=>{_(),g(null)}})]})}t();var G=`pipeline-analytics`;function Ye(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 Xe(){let e=a(),{nodes:t}=z(),{data:i,isLoading:o}=V({addonId:G}),c=Ye(i),l=R({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(_,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:G,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(_,{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(W,{types:[`eventMedia`]})]})]})}t();var Ze=[[`pipelineAnalytics`]],Qe=1440*60*1e3;function $e(e,t){return t.get(e)??`Removed camera #${String(e)}`}var et=[{days:1,label:`1 day`},{days:7,label:`7 days`},{days:30,label:`30 days`},{days:90,label:`90 days`}];function tt(){let t=a(),i=L(),[c,l]=o(30),[f,p]=o(null),{data:m,isLoading:g}=Te({},{refetchOnWindowFocus:!1}),{data:v}=B({isCamera:!0,projection:`slim`}),y=r(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),b=e(()=>{t.invalidateQueries({queryKey:Ze})},[t]),x=be({onSuccess:b}),S=Oe(),w=e(async()=>{await i({title:`Prune events older than ${String(c)} day${c===1?``:`s`}?`,message:`Permanently deletes every event (motion / object / audio) older than the cutoff across all cameras, and their media. This cannot be undone.`,confirmLabel:`Prune events`,variant:`danger`})&&x.mutate({olderThanMs:Date.now()-c*Qe,reason:`retention`})},[i,x,c]),T=e(async e=>{let t=$e(e.deviceId,y);if(await i({title:`Delete all events for ${t}?`,message:`Permanently deletes ${String(e.rows)} event${e.rows===1?``:`s`} (${U(e.bytes)} of media) for this camera. This cannot be undone.`,confirmLabel:`Delete events`,variant:`danger`})){p(null);try{let n=await S.mutateAsync({deviceId:e.deviceId});b();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){p(`0 events deleted for ${t}. Media still listed (${U(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}p(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){p(e instanceof Error?e.message:String(e))}}},[i,S,y,b]),E=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:$e(e.deviceId,y)})},{key:`rows`,header:`Events`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:`Media`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:U(e.bytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`button`,{onClick:()=>{T(e)},disabled:S.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:`Delete all events for this camera`,children:[s(u,{className:`h-3 w-3`}),`Delete`]})}],[y,T,S.isPending]);return g&&!m?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(_,{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(h,{label:`Total events`,icon:s(d,{className:`h-3 w-3`}),footer:`across ${String(m.devices.length)} camera${m.devices.length===1?``:`s`}`,children:m.totalRows.toLocaleString()}),s(h,{label:`Event media on disk`,children:U(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=>l(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:et.map(e=>s(`option`,{value:e.days,children:e.label},e.days))}),n(`button`,{onClick:()=>{w()},disabled:x.isPending,className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs font-medium text-foreground-subtle hover:bg-warning/10 hover:text-warning disabled:opacity-50`,children:[x.isPending?s(_,{className:`h-3 w-3 animate-spin`}):s(C,{className:`h-3 w-3`}),`Prune now`]})]}),m.devices.length===0?s(P,{icon:d,title:`No stored events`,description:`No camera has persisted events yet.`}):s(N,{columns:E,rows:[...m.devices],rowKey:e=>e.deviceId,minWidthPx:480}),f===null?null:s(`p`,{className:f.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:f})]}):s(P,{icon:d,title:`No event data`,description:`Pipeline analytics has not reported any event-store footprint yet.`})}function nt(){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(tt,{})})]}),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(Xe,{})})]})]})}function rt(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 it(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function at(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`${it(e)} · ${o}`}function ot(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 st(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 ct=[`high`,`mid`,`low`],lt=[{value:1,label:`Real time (1×)`},{value:2,label:`2×`},{value:4,label:`4×`},{value:8,label:`8×`},{value:16,label:`16×`}],ut=10080*60*1e3;function dt(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 ft({onClose:e,onCreated:t}){let i=B({isCamera:!0,projection:`slim`}),a=r(()=>(i.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[i.data]),[c,l]=o(``),[u,d]=o(`high`),[p,m]=o(dt(60)),[h,g]=o(dt(0)),[_,v]=o(1),[y,b]=o(!0),[x,S]=o(``),[C,w]=o(null),T=c===``?a[0]?.id??null:c,E=new Date(p).getTime(),O=new Date(h).getTime(),A=Number.isFinite(E)&&Number.isFinite(O)&&E<O,j=xe({onSuccess:()=>{t(),e()},onError:e=>w(e instanceof Error?e.message:String(e))});return s(de,{open:!0,onOpenChange:t=>!t&&e(),children:n(M,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[s(D,{children:n(Se,{className:`flex items-center gap-1.5`,children:[s(f,{className:`h-3.5 w-3.5`}),`New export`]})}),n(te,{className:`space-y-3`,children:[n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),s(`select`,{value:T??``,onChange:e=>l(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:a.map(e=>s(`option`,{value:e.id,children:e.name},e.id))})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Profile`}),s(`select`,{value:u,onChange:e=>d(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:ct.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:p,onChange:e=>m(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:h,onChange:e=>g(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Speed`}),s(`select`,{value:_,onChange:e=>v(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:lt.map(e=>s(`option`,{value:e.value,children:e.label},e.value))})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Title (optional)`}),s(`input`,{type:`text`,value:x,onChange:e=>S(e.target.value),placeholder:`e.g. courier at the gate`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle`})]})]}),n(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[s(`input`,{type:`checkbox`,checked:y,disabled:_!==1,onChange:e=>b(e.target.checked),className:`accent-primary`}),`Include audio`,_===1?``:` (real-time only)`]}),!A&&s(`p`,{className:`text-[11px] text-danger`,children:`"From" must be before "To".`}),C&&s(`p`,{className:`text-[11px] text-danger`,children:C})]}),n(we,{children:[s(k,{variant:`outline`,size:`sm`,onClick:e,children:`Cancel`}),s(k,{size:`sm`,onClick:()=>{if(T===null||!A)return;w(null);let e=x.trim();j.mutate({deviceId:T,profile:u,fromMs:E,toMs:O,options:{includeAudio:y,maxLifeMs:ut,deleteAfterDownload:!1,..._===1?{}:{speed:_},...e.length>0?{title:e}:{}}})},disabled:T===null||!A||j.isPending,children:j.isPending?`Queuing…`:`Create export`})]})]})})}t();var pt=[[`recordingExport`]],mt={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 ht(){let{data:e,isLoading:t}=se({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:n}=H(w.RecordingExportProgress,e=>e.exportId),{map:i}=H(w.RecordingExportCompleted,e=>e.exportId),{map:a}=H(w.RecordingExportFailed,e=>e.exportId);return{rows:r(()=>st(e??[],n,i,a),[e,n,i,a]),isLoading:t}}function gt(e){let[t,n]=o(()=>Date.now());return c(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function _t(){let t=a(),[i,c]=o(!1),d=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},p=L(),m=y().trpcClient,h=gt(6e4),{rows:v,isLoading:b}=ht(),{data:x}=B({isCamera:!0,projection:`slim`}),S=r(()=>{let e=new Map;for(let t of x??[])e.set(t.id,t.name);return e},[x]),C=e(()=>{t.invalidateQueries({queryKey:pt})},[t]),w=E({onSuccess:C}),T=oe({onSuccess:C}),[D,O]=o(null),k=e(async e=>{O(e.id);try{let{url:t}=await m.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await Ne(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),C()}finally{O(null)}},[m,C]),A=e(async e=>{await p({title:`Cancel this export?`,message:`Stops the render. The partial file is discarded.`,confirmLabel:`Cancel export`,variant:`danger`})&&w.mutate({exportId:e.id})},[p,w]),j=e(async e=>{await p({title:`Delete this export?`,message:`Permanently removes the rendered file and its history row.`,confirmLabel:`Delete`,variant:`danger`})&&T.mutate({exportId:e.id})},[p,T]),M=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:S.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:`Range`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:at(e.fromMs,e.toMs)})},{key:`variant`,header:`Variant`,render:e=>s(`span`,{className:`text-foreground-subtle`,children:rt(e.options)})},{key:`state`,header:`State`,render:e=>{let t=mt[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(_,{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:ot(e.expiresAt,h)})},{key:`size`,header:`Size`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:U(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:e=>{let t=e.state===`ready`,r=e.state===`queued`||e.state===`rendering`,i=e.state!==`deleted`;return n(`div`,{className:`flex items-center justify-end gap-1`,children:[t&&n(`button`,{onClick:()=>{k(e)},disabled:D===e.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-primary/10 hover:text-foreground disabled:opacity-50`,title:`Download MP4`,children:[D===e.id?s(_,{className:`h-3 w-3 animate-spin`}):s(l,{className:`h-3 w-3`}),`Download`]}),r&&n(`button`,{onClick:()=>{A(e)},disabled:w.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(g,{className:`h-3 w-3`}),`Cancel`]}),i&&s(`button`,{onClick:()=>{j(e)},disabled:T.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(u,{className:`h-3 w-3`})})]})}}],[S,h,D,w.isPending,T.isPending,k,A,j]);return b&&v.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(_,{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(f,{className:`h-3.5 w-3.5`}),`New export`]})}),v.length===0?s(P,{icon:f,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:M,rows:v,rowKey:e=>e.id,minWidthPx:720}),i&&s(ft,{onClose:()=>c(!1),onCreated:d})]})}var vt=`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 yt=`storage-migration`,bt=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function xt(e){return[`${e.orphansReclaimed} orphan rows (${U(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${U(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${U(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function St(){let e=I(yt);return e===`pending`?null:e===`unknown`?s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`Could not check whether storage cleanup is installed on this hub.`}):e===`present`?s(Ct,{}):null}function Ct(){let e=L(),[t,r]=o(!1),[i,a]=o(null),c=ie({},{refetchInterval:2e3}),l=c.data??null,d=l!==null&&bt.has(l.phase),f=ne(),p=me(),m=async()=>{if(await e({title:`Run storage cleanup?`,message:t?`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`:`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`,confirmLabel:`Run cleanup`,variant:`danger`})){a(null);try{await f.mutateAsync({includeDebugMedia:t}),await c.refetch()}catch(e){a(e instanceof Error?e.message:String(e))}}},h=async()=>{if(l&&await e({title:`Cancel cleanup?`,message:`Stops after the current step. Work already done stays done.`,confirmLabel:`Cancel cleanup`,variant:`danger`}))try{await p.mutateAsync({jobId:l.jobId}),await c.refetch()}catch{}};return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Cleanup`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`One pass over leftover analytics (database + files) and ghost footage rows on frozen locations. Does not time out — progress updates here until it finishes.`}),n(`label`,{className:`mt-3 flex items-start gap-2 text-[11px] text-foreground`,children:[s(`input`,{type:`checkbox`,checked:t,disabled:d,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:d||f.isPending,onClick:()=>{m()},className:vt,children:[(d||f.isPending)&&s(_,{className:`h-3 w-3 animate-spin`}),s(u,{className:`h-3 w-3`}),`Run cleanup`]}),d&&s(`button`,{type:`button`,onClick:()=>{h()},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}),d&&s(_,{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:xt(l)}),l.error&&s(`p`,{className:`text-[11px] text-danger`,children:l.error})]})]})}t();var wt=2e3;function Tt(){let e=L(),t=a(),r=he(),i=A(void 0,{refetchInterval:e=>e.state.data?.state===`running`?wt:!1}),o=i.data,l=o?.state===`running`,u=l||r.isPending;c(()=>{o?.state!==`done`||o.finishedAtMs===null||(t.invalidateQueries({queryKey:[[`recording`]]}),t.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[o?.state,o?.finishedAtMs,t]);let d=async()=>{await e({title:`Reconcile storage from disk?`,message:`Makes the database match the filesystem: recordings index, tracks, events and media whose files are gone. Favourited tracks without files are deleted. Snapshot-less motion/audio events are deleted. Enrolled identities stay. This cannot be undone.`,confirmLabel:`Reconcile`,variant:`warning`})&&(await r.mutateAsync(),await i.refetch())},f=l?o.total>0?`Reconciling ${String(o.completed)}/${String(o.total)}…`:`Reconciling…`:r.isPending?`Reconciling…`:`Reconcile from disk`;return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Disk reconcile`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Deletes database rows whose files are gone. Enrolled identities stay.`}),n(`div`,{className:`mt-3 flex flex-col gap-2`,children:[n(`button`,{type:`button`,onClick:()=>void d(),disabled:u,className:`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[u?s(_,{className:`h-3.5 w-3.5 animate-spin`}):s(x,{className:`h-3.5 w-3.5`}),f]}),o?.state===`done`?n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Last run: `,String(o.completed),` camera(s) — dropped `,String(o.tracks),` tracks,`,` `,String(o.events),` events, `,String(o.mediaDropped),` media`,o.failed.length>0?`, ${String(o.failed.length)} failed (${o.failed.join(`, `)})`:``,`.`]}):null,o?.state===`error`&&o.error!==null?n(`p`,{className:`text-[11px] text-destructive`,children:[`Reconcile failed: `,o.error]}):null]})]})}var K=1e3,q=60*K,J=60*q;function Y(e){return e.toLocaleString(`en-US`)}function Et(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=J){let t=Math.floor(e/J),n=Math.round(e%J/q);return`${t.toString()}h ${n.toString()}m`}if(e>=q){let t=Math.floor(e/q),n=Math.round(e%q/K);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/K)).toString()}s`}function Dt(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${Y(e.filesMoved)} files`:`${Y(e.filesMoved)} / ${Y(e.filesTotal)} files`,r=e.filesTotal===null||e.filesTotal===0?null:Math.min(1,e.filesMoved/e.filesTotal),i=t>0&&e.filesMoved>0,a=i?`${U(e.bytesMoved/t*K)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${Et(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${U(e.bytesMoved)} moved`,rate:a,eta:s}}function Ot(e){let t=Dt(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}t();var kt=`storage-migration`,X=[{id:`recordings`,label:`Recordings`,locationType:`recordings`},{id:`recordingsLow`,label:`Low-res recordings`,locationType:`recordingsLow`},{id:`eventMedia`,label:`Event media`,locationType:`eventMedia`}],At=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function jt(){let e=I(kt);return e===`pending`?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(_,{className:`h-4 w-4 animate-spin`}),`Checking whether storage migration is installed…`]}):e===`unknown`?s(P,{icon:p,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(P,{icon:S,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(Mt,{})}function Mt(){let e=L(),{data:t}=F({}),[i,a]=o({}),[c,l]=o({}),[u,d]=o(null),[f,p]=o(null),m=r(()=>{let e=new Map;for(let n of t??[]){let t=e.get(n.type);t?t.push(n):e.set(n.type,[n])}return e},[t]),h=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]),g=T({},{refetchInterval:2e3}),y=g.data??null,b=y!==null&&At.has(y.phase),x=r(()=>{let e={};for(let t of X){let n=i[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i]),C=r(()=>{let e={};for(let t of X){if(!i[t.id])continue;let n=c[t.id]??h.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i,c,h]),w=r(()=>({destinations:x??{},...C?{sources:C}:{}}),[x,C]),E=ge(w,{enabled:!1,retry:!1}),D=le(),O=fe(),k=async()=>{if(!x)return;p(null);let e=await E.refetch();if(e.error){p(e.error instanceof Error?e.error.message:String(e.error));return}d(e.data??null)},A=async()=>{if(x&&await e({title:`Start storage migration?`,message:`Copies the selected classes from the chosen source to the destination, verifies, then either makes the destination the default (if the source was) or disables the source. Safe to re-run if interrupted.`,confirmLabel:`Start migration`,variant:`danger`})){p(null);try{await D.mutateAsync(w),d(null),await g.refetch()}catch(e){p(e instanceof Error?e.message:String(e))}}},j=async()=>{if(y&&await e({title:`Cancel migration?`,message:`Stops the in-progress migration. Data already moved and verified stays at the destination; anything already repointed is not reverted.`,confirmLabel:`Cancel migration`,variant:`danger`}))try{await O.mutateAsync({jobId:y.jobId}),await g.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(S,{className:`h-3.5 w-3.5`}),`Storage migration`]}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Move recordings, low-res recordings and/or event media from one location to another: copies via the recorder / pipeline-analytics movers, verifies, then either repoints the default (when the source was the default) or disables the source (when it was not). Skip a class with an empty destination.`}),s(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:X.map(e=>{let t=m.get(e.locationType)??[],r=h.get(e.locationType)??``;return n(`div`,{className:`space-y-2`,children:[s(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e.label}),n(`div`,{className:`space-y-1`,children:[n(`label`,{htmlFor:`migration-from-${e.id}`,className:`text-[10px] text-foreground-subtle`,children:[e.label,` from`]}),s(`select`,{id:`migration-from-${e.id}`,value:c[e.id]??r,onChange:t=>{let n=t.target.value;l(t=>({...t,[e.id]:n}))},disabled:b,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:t.map(e=>n(`option`,{value:e.id,children:[e.displayName,e.enabled===!1?` (read-only)`:``]},e.id))})]}),n(`div`,{className:`space-y-1`,children:[n(`label`,{htmlFor:`migration-dest-${e.id}`,className:`text-[10px] text-foreground-subtle`,children:[e.label,` to`]}),n(`select`,{id:`migration-dest-${e.id}`,value:i[e.id]??``,onChange:t=>{let n=t.target.value;a(t=>({...t,[e.id]:n}))},disabled:b,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:[s(`option`,{value:``,children:`— skip —`}),t.map(e=>s(`option`,{value:e.id,children:e.displayName},e.id))]})]})]},e.id)})}),f&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:f}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[n(`button`,{type:`button`,onClick:()=>{k()},disabled:!x||E.isFetching||b,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[E.isFetching&&s(_,{className:`h-3 w-3 animate-spin`}),`Plan`]}),n(`button`,{type:`button`,onClick:()=>{A()},disabled:!x||D.isPending||b,className:`inline-flex items-center gap-1.5 rounded bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[D.isPending&&s(_,{className:`h-3 w-3 animate-spin`}),`Start migration`]})]}),u&&s(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:u.moves.length===0?s(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:`Nothing to move — selected destinations match the current defaults.`}):u.moves.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]},`${e.storageClass}-${e.toLocationId}`))}),y&&n(`div`,{className:`mt-4 border-t border-border pt-3`,children:[n(`div`,{className:`flex items-center justify-between`,children:[s(`h4`,{className:`text-xs font-semibold text-foreground`,children:`Migration status`}),b&&n(`button`,{type:`button`,onClick:()=>{j()},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(v,{className:`h-3 w-3`}),`Cancel`]})]}),n(`p`,{className:`mt-1 text-xs text-foreground`,children:[`Phase: `,s(`span`,{className:`font-medium`,children:y.phase}),b&&s(_,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),y.error&&s(`p`,{className:`mt-1 text-[11px] text-danger`,children:y.error}),y.pausedParticipants.length>0&&n(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[`Paused: `,y.pausedParticipants.join(`, `)]}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:y.moves.map(e=>s(Nt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),s(Pt,{})]}),s(Ft,{running:b}),s(Lt,{})]})}function Nt({move:e}){let t=e.progress===null?null:Dt(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:Ot(e.progress)})]})]})}function Pt(){let{data:e}=re({});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 Ft({running:e}){let t=L(),r=ve({},{staleTime:1/0,refetchOnWindowFocus:!1}),i=De(),[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:It(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 It(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 · ${U(e.bytes)}`}function Lt(){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:Ot({filesMoved:e.job.filesMoved,filesTotal:e.job.filesTotal,bytesMoved:e.job.bytesMoved,startedAt:e.job.startedAt,observedAt:e.observedAt})})]},e.job.jobId))})]})}function Rt(){return n(`div`,{className:`flex flex-col gap-4`,children:[s(St,{}),s(Tt,{}),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(jt,{})})]})]})}t();var zt=`recorder`;function Bt(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 Vt(){let e=a(),{nodes:t}=z(),{data:i,isLoading:o}=V({addonId:zt}),c=Bt(i,`recordingNodeId`,`hub`),l=R({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(_,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:zt,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(_,{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(W,{types:[`recordings`,`recordingsLow`]})]})]})}function Ht(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Z(e,t){let n=Ht(e);return n.length===0?`default root`:n.map(e=>t.get(e)??e).join(` + `)}function Ut(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Z(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Ht(e).includes(n));return i===void 0?null:{label:Z(i,t),exact:!1}}t();var Wt=[[`recording`]],Gt=[{value:`retention`,label:`Retention policy`},{value:`quota`,label:`Quota / disk pressure`},{value:`operator`,label:`Operator`}],Kt={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Q={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function qt(e){return e==null?`—`:new Date(e).toLocaleString()}function Jt(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 Yt(){let t=a(),i=L(),[c,l]=o(`retention`),{data:d,isLoading:f}=j({},{refetchOnWindowFocus:!1}),{data:p}=B({isCamera:!0,projection:`slim`}),{data:m}=F({}),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 m??[])e.set(t.id,t.displayName);return e},[m]),y=r(()=>{let e=m??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[m]),b=r(()=>d?.locations??[],[d?.locations]),S=r(()=>Ut(b,v,y),[b,v,y]),w=r(()=>Fe(b),[b]),T=e(()=>{t.invalidateQueries({queryKey:Wt})},[t]),E=Ce({onSuccess:T}),D=ee({onSuccess:T}),O=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`})&&E.mutate({deviceId:e.deviceId,reason:c})},[i,E,c,g]),k=e(async e=>{await i({title:`Delete all footage for ${g.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${U(e.usedBytes)} of recorded footage for this camera. This cannot be undone.`,confirmLabel:`Delete ${U(e.usedBytes)}`,variant:`danger`})&&D.mutate({deviceId:e.deviceId})},[i,D,g]),A=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:()=>S===null?s(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:S.exact?`text-foreground`:`text-foreground-subtle`,title:S.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:[S.label,!S.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:U(e.usedBytes)})},{key:`oldest`,header:`Oldest footage`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums text-foreground-subtle`,title:`The oldest segment the ARCHIVE holds for this camera — the per-camera answer to 'is retention actually holding?'.`,children:qt(e.oldestMs)})},{key:`actions`,header:``,align:`right`,render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[n(`button`,{onClick:()=>{O(e)},disabled:E.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(C,{className:`h-3 w-3`}),`Prune`]}),n(`button`,{onClick:()=>{k(e)},disabled:D.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:`Delete all footage`,children:[s(u,{className:`h-3 w-3`}),`Delete`]})]})}],[g,S,O,k,E.isPending,D.isPending]);if(f&&!d)return n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(_,{className:`h-4 w-4 animate-spin`}),`Loading storage usage…`]});if(!d)return s(P,{icon:x,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(h,{label:`Total used`,icon:s(x,{className:`h-3 w-3`}),footer:`${String(M)} camera${M===1?``:`s`} on ${d.nodeId}`,children:U(d.totalUsedBytes)}),w!==null&&w.severity!==null&&s(h,{label:`Free on recordings volumes`,icon:s(x,{className:`h-3 w-3`}),footer:`across ${String(w.knownVolumes)} volume${w.knownVolumes===1?``:`s`} of ${U(w.totalBytes)}`+(w.unknownVolumes>0?` · ${String(w.unknownVolumes)} did not report capacity`:``),children:s(`span`,{className:`tabular-nums ${Q[w.severity]}`,children:U(w.freeBytes)})}),b.map(e=>{let t=ze(e),r=e.locationId??e.root??`default`;return s(h,{label:`Disk: ${Jt(e,v)}`,footer:t===null?`${U(e.usedBytes)} of recordings · volume capacity unknown`:`${U(t.freeBytes)} free of ${U(t.totalBytes)} · ${U(e.usedBytes)} recordings (${$(t.recordingsFraction)})`,children:t===null?s(`span`,{className:`tabular-nums`,children:U(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 ${Kt[t.severity]}`,style:{width:$(t.fraction)}})}),s(`span`,{className:`tabular-nums text-xs ${Q[t.severity]}`,children:$(t.fraction)})]})},r)})]}),n(`section`,{className:`flex items-center gap-2 text-xs`,children:[s(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:`Prune reason`}),s(`select`,{id:`prune-reason`,value:c,onChange:e=>{let t=Gt.find(t=>t.value===e.target.value);t&&l(t.value)},className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:Gt.map(e=>s(`option`,{value:e.value,children:e.label},e.value))})]}),M===0?s(P,{icon:x,title:d.devicesRead===`unavailable`?`Per-camera usage unavailable`:`No recorded footage`,description:d.devicesRead===`unavailable`?`This recording node has no footage ledger, so it refused to answer the per-camera table rather than report what it happens to hold in memory. The disk totals above are unaffected.`:`No camera has recorded footage on this node yet.`}):s(N,{columns:A,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Xt(){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(Yt,{})})]}),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(Vt,{})})]})]})}function Zt(){let{t:e}=ke(),t=je(`/recordings`,{t:e,isAdmin:!0})??{icon:f,title:e(`nav.recordings`,`Recordings`)};return s(Me,{icon:t.icon,title:t.title,subtitle:`Recorded footage and the durable event store — what each occupies, where it is written, and the operations that move or reconcile both.`,defaultSection:`storage`,sectionsLabel:`${t.title} sections`,sections:[{id:`storage`,label:`Recordings`,content:s(Xt,{})},{id:`events`,label:`Events`,content:s(nt,{})},{id:`cameras`,label:`Cameras`,content:s(Je,{})},{id:`exports`,label:`Export`,content:s(_t,{})},{id:`activity`,label:`Activity`,content:s(qe,{})},{id:`management`,label:`Management`,content:s(Rt,{})}]})}export{Zt as RecordingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,b 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{Hr as l,Nt as u,Q as d,Rr as f,Sn as p,ar as m,bi as h,dt as g,vi as _,yn as v}from"./player-overlays-DWMIy1MJ.js";import{Si as y}from"./client-CjyKfSu1.js";import{Ki as b,Sa as x,di as S,gi as C,hi as w,ia as T,ma as E,na as D,uo as O}from"./src-BLkInT8U.js";import{t as k}from"./useTranslation-Bc5yH9V9.js";import"./mount-1Z6p3UkP.js";import{F as A}from"./index-D66JvELZ.js";import{t as j}from"./BrokerForm-6-BwPs-g.js";n();var M=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],N=d(`/addon/import-alexa`),P=2e3;function F(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function I(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function L(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function R(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function z(e,t,n){let r=await fetch(`${N}${e}`,{method:`POST`,headers:R(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function B(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${N}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!I(i))throw Error(`Unexpected status response from server`);return i}async function V(e){try{await fetch(`${N}/login/cancel`,{method:`POST`,headers:R(),body:JSON.stringify({sessionId:e})})}catch{}}function H({brokerId:n,onResolved:i,onCancel:a}){let[l,d]=o(`amazon.it`),[p,h]=o(`Alexa account`),[g,_]=o({kind:`idle`}),y=t(!0);c(()=>(y.current=!0,()=>{y.current=!1}),[]);let b=t(null),x=t(null),S=e(()=>{x.current!==null&&(clearInterval(x.current),x.current=null)},[]),C=e(async e=>{S(),y.current&&_({kind:`committing`,sessionId:e});try{let t=await z(`/login/commit`,{sessionId:e,name:p.trim().length>0?p.trim():`Alexa account`,...n===void 0?{}:{brokerId:n}},L);b.current=null,i(t.brokerId)}catch(t){let n=t instanceof Error?t.message:String(t);y.current&&_({kind:`error`,message:n,sessionId:e})}},[n,p,i,S]),w=e((e,t)=>{S();let n=async()=>{try{let n=await B(e);if(n.phase===`captured`){S(),C(e);return}if(n.phase===`error`){S(),y.current&&_({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){S(),y.current&&_({kind:`idle`});return}y.current&&_({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);y.current&&_(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};x.current=setInterval(()=>{n()},P)},[S,C]);c(()=>()=>{S(),b.current!==null&&V(b.current)},[S]);let T=async()=>{S(),b.current!==null&&(V(b.current),b.current=null),_({kind:`starting`});try{let e=await z(`/login/start`,{amazonDomain:l},F);b.current=e.sessionId,_({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),w(e.sessionId,e.loginUrl)}catch(e){_({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},E=()=>{S(),b.current!==null&&(V(b.current),b.current=null),_({kind:`idle`})},D=()=>{E()},O=g.kind===`idle`,k=g.kind===`starting`,A=g.kind===`polling`,j=g.kind===`committing`,N=g.kind===`error`,I=k||A||j,R=g.kind===`polling`?g.phase:null,H=g.kind===`polling`?g.loginUrl:null,U=A&&R===`awaiting-login`,W=A&&(R===`starting`||R===null);return r(`div`,{className:`space-y-4`,children:[(O||N)&&r(`div`,{className:`space-y-3`,children:[n===void 0&&r(`div`,{className:`space-y-1`,children:[s(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),s(`input`,{id:`alexa-account-name`,type:`text`,value:p,onChange:e=>h(e.target.value),placeholder:`Alexa account`,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`})]}),r(`div`,{className:`space-y-1`,children:[s(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),s(`select`,{id:`alexa-amazon-region`,value:l,onChange:e=>d(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:M.map(e=>s(`option`,{value:e,children:e},e))})]})]}),N&&r(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[s(u,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),s(`span`,{children:g.message})]}),k&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(m,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(m,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),j&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(m,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&r(`div`,{className:`space-y-3`,children:[r(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[s(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),r(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[s(f,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),r(`div`,{className:`rounded border border-warning/30 bg-warning/10 px-3 py-2 text-[10px] text-warning`,children:[s(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,s(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),r(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[s(m,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),r(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[s(`button`,{type:`button`,onClick:I?E:a,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:I?`Cancel login`:`Back`}),r(`div`,{className:`flex items-center gap-2`,children:[N&&r(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[s(v,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&s(`button`,{type:`button`,onClick:()=>{T()},disabled:n===void 0&&p.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}n();var U=`alexa`;function W(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function G(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var K={connected:`bg-success/15 text-success`,connecting:`bg-warning/15 text-warning`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function q({kind:e,onResolved:t,onBack:n}){let[a,c]=o(e===U?`alexa-login`:`existing`),l=w({kind:e}),u=i(()=>W(l.data).filter(t=>t.kind===e),[l.data,e]),d=C(),f=i(()=>{for(let t of G(d.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[d.data,e]),[p,h]=o(null),[g,v]=o(``),y=S({}),b=()=>{p&&t(p)},x=async n=>{g.trim().length!==0&&t((await y.mutateAsync({kind:e,name:g.trim(),settings:n,...f===void 0?{}:{addonId:f}})).id)},T=e=>{e===`new`?h(null):y.reset(),c(e)};return r(`div`,{className:`space-y-4`,children:[r(`button`,{type:`button`,onClick:n,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[s(_,{className:`h-3.5 w-3.5`}),` Back`]}),r(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===U&&s(`button`,{type:`button`,onClick:()=>T(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),s(`button`,{type:`button`,onClick:()=>T(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),s(`button`,{type:`button`,onClick:()=>T(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===U?`Paste cookie`:`Create new`})]}),a===`alexa-login`&&s(H,{onResolved:t,onCancel:n}),a===`existing`&&r(`div`,{className:`space-y-3`,children:[l.isLoading&&r(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[s(m,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),l.isError&&r(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,l.error instanceof Error?l.error.message:`Unknown error`]}),!l.isLoading&&!l.isError&&u.length===0&&r(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,s(`span`,{className:`font-medium text-foreground`,children:e===U?`Login interactively`:`Create new`}),` `,`to register one.`]}),s(`div`,{className:`space-y-2`,children:u.map(e=>r(`button`,{type:`button`,onClick:()=>h(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${p===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[s(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),s(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${K[e.status]}`,children:e.status})]},e.id))}),u.length>0&&s(`div`,{className:`flex justify-end pt-1`,children:s(`button`,{type:`button`,onClick:b,disabled:!p,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),a===`new`&&r(`div`,{className:`space-y-3`,children:[r(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),s(`input`,{type:`text`,value:g,onChange:e=>v(e.target.value),placeholder:`My Home Assistant`,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`})]}),y.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:y.error instanceof Error?y.error.message:String(y.error)}),s(j,{kind:e,...f===void 0?{}:{addonId:f},onSubmit:e=>{x(e).catch(()=>{})},onCancel:n,submitLabel:y.isPending?`Creating…`:`Create broker`,disabled:y.isPending||g.trim().length===0}),g.trim().length===0&&s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}n();function J(e){return{status:e.status===`validated`||e.status===`rejected`||e.status===`inconclusive`||e.status===`unsupported`?e.status:e.success?`validated`:`rejected`,...e.error===void 0?{}:{error:e.error},...e.detail===void 0?{}:{detail:e.detail}}}var Y={validated:`border-success/30 bg-success/5 text-success`,rejected:`border-danger/30 bg-danger/5 text-danger`,inconclusive:`border-warning/30 bg-warning/5 text-warning`,unsupported:`border-border bg-surface text-foreground-subtle`};function X({addonId:e,configSchema:t,canTest:n=!0,initialName:i,initialConfig:a,submitLabel:c,hideName:l=!1,onSave:u,onBack:d}){let{t:f}=k(),[p,m]=o(i??``),[h,g]=o(a??{}),[_,v]=o(null),b=O({onSuccess:e=>v(J(e)),onError:e=>v({status:`inconclusive`,error:String(e)})});return r(`div`,{className:`space-y-4`,children:[!l&&r(`div`,{children:[s(`label`,{className:`block text-[11px] font-medium text-foreground mb-1`,children:f(`integrations.integrationName`)}),s(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:f(`integrations.integrationNamePlaceholder`),className:`w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:border-primary/50`})]}),t&&s(A,{schema:t,values:h,onChange:g}),_&&s(`div`,{className:`rounded-lg border px-3 py-2 text-xs ${Y[_.status]}`,children:(e=>{switch(e.status){case`validated`:return e.detail?`${f(`integrations.connectionSuccess`)} — ${e.detail}`:f(`integrations.connectionSuccess`);case`rejected`:return`${f(`integrations.errorPrefix`)} ${e.error??``}`;case`inconclusive`:return`${f(`integrations.connectionInconclusive`,{defaultValue:`Could not be checked:`})} ${e.error??``}`;case`unsupported`:return e.error??f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`})}})(_)}),r(`div`,{className:`flex items-center justify-between pt-2`,children:[s(`button`,{onClick:d,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:f(`integrations.back`)}),r(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>b.mutate({addonId:e,settings:h}),disabled:b.isPending||!n,title:n?void 0:f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`}),className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:b.isPending?f(`integrations.testing`):f(`integrations.testConnection`)}),s(`button`,{onClick:()=>u({name:p,config:h,secretKeys:[...y(t)]}),disabled:l?!1:!p.trim(),className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:c??f(`integrations.forward`)})]})]})]})}n();function Z({open:t,onClose:n,scope:a}){let c=b(),[u,d]=o(new Set),[f,_]=o(new Set),{data:v}=E({projection:`slim`}),y=i(()=>new Set((v??[]).map(e=>e.stableId)),[v]),x=e(async(e,t)=>{_(e=>new Set(e).add(t.stableId));try{await c.mutateAsync({addonId:e,candidate:t}),d(e=>new Set(e).add(t.stableId))}catch{}finally{_(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[c]),S=e((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,i=y.has(t.stableId),a=u.has(t.stableId)||i,o=f.has(t.stableId);return r(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[r(`div`,{className:`min-w-0`,children:[s(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&s(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),a?r(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[s(h,{className:`h-3.5 w-3.5`}),` `,i?`Already added`:`Added`]}):r(`button`,{type:`button`,onClick:()=>void x(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?s(m,{className:`h-3.5 w-3.5 animate-spin`}):s(l,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[u,f,y,x]);if(!t)return null;let C=a?`Scan network — ${a.label}`:`Scan network for devices`;return r(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[s(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n}),r(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[calc(90dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl`,children:[r(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(p,{className:`h-4 w-4 text-primary`}),s(`h2`,{className:`text-sm font-semibold text-foreground`,children:C})]}),s(`button`,{onClick:n,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:s(g,{className:`h-4 w-4`})})]}),a?s(ee,{scope:a,onAdopt:S,onReset:()=>d(new Set)}):s(Q,{onAdopt:S,onReset:()=>d(new Set)})]})]})}function Q({onAdopt:t,onReset:n}){let o=D(),l=e(()=>{n(),o.mutate({})},[o,n]);c(()=>{!o.isPending&&!o.data&&l()},[]);let u=i(()=>(o.data?.groups??[]).filter(e=>e.candidates.length>0),[o.data]),d=i(()=>u.reduce((e,t)=>e+t.candidates.length,0),[u]);return r(a,{children:[s(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:r(`button`,{onClick:l,disabled:o.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[s(v,{className:`h-3.5 w-3.5 ${o.isPending?`animate-spin`:``}`}),`Re-scan`]})}),r(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[o.isPending&&s(te,{label:`Scanning the local network…`}),!o.isPending&&o.isError&&s($,{}),!o.isPending&&o.data&&u.length===0&&s(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!o.isPending&&u.length>0&&r(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,d,` device`,d===1?``:`s`,` on the network.`]}),!o.isPending&&u.map(e=>r(`div`,{className:`space-y-1.5`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.label}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,e.candidates.length,`)`]})]}),e.candidates.map(n=>t(e.addonId,n))]},e.addonId))]})]})}function ee({scope:t,onAdopt:n,onReset:i}){let c=x({addonId:t.addonId}).data??null,[l,u]=o({}),d=T(),f=e(()=>{i(),d.mutate({addonId:t.addonId,params:l})},[d,t.addonId,l,i]),h=d.data?.candidates??[];return s(a,{children:r(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[c&&s(A,{schema:c,values:l,onChange:u}),r(`button`,{onClick:f,disabled:d.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[d.isPending?s(m,{className:`h-3.5 w-3.5 animate-spin`}):s(p,{className:`h-3.5 w-3.5`}),d.isPending?`Scanning…`:`Scan`]}),d.isError&&s($,{}),!d.isPending&&d.data&&h.length===0&&s(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!d.isPending&&h.length>0&&r(`div`,{className:`space-y-1.5`,children:[r(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,h.length,` device`,h.length===1?``:`s`,`.`]}),h.map(e=>n(t.addonId,e))]})]})})}function te({label:e}){return r(`div`,{className:`flex flex-col items-center py-12`,children:[s(m,{className:`h-6 w-6 animate-spin text-primary`}),s(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function $(){return r(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[s(u,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),s(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{X as n,q as r,Z as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,q as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{D as s,It as c,ar as l,cn as u,di as d,dt as f,ot as p}from"./player-overlays-DWMIy1MJ.js";import{i as m,o as h}from"./video--MLJeLNU.js";import{t as g}from"./key-round-B2I1YisX.js";import{t as _}from"./octagon-alert-DMjnTemh.js";import{An as v,Bn as y,Dn as b,Ht as x,Ln as S,Nl as C,Nt as w,On as T,Pt as E,Qn as D,Tn as ee,Ut as te,Vt as ne,Xl as re,Zl as ie,Zn as ae,ar as oe,gu as O,iu as k,jn as se,kn as ce,ma as le}from"./src-BLkInT8U.js";import{L as ue,a as de}from"./index-D66JvELZ.js";n();function A({id:e,title:t,icon:n,description:i,actions:a,tone:c=`default`,notice:l=null,onDismissNotice:u,children:d}){return o(ne,{headingId:`access-${e}`,title:t,icon:n,actions:a,testId:`access-${e}`,children:r(`div`,{className:`${s} space-y-3`,children:[o(`div`,{className:k(`text-[11px] leading-relaxed`,c===`danger`?`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-foreground`:`text-foreground-subtle`),children:i}),l!==null&&o(pe,{notice:l,onDismiss:u}),d]})})}var fe={success:{icon:d,line:`border-success/30 text-foreground`,mark:`text-success`},danger:{icon:_,line:`border-danger/40 text-danger`,mark:`text-danger`}};function pe({notice:e,onDismiss:t}){let n=fe[e.tone],i=n.icon;return r(`div`,{role:e.tone===`danger`?`alert`:`status`,className:k(`flex items-start gap-2 rounded-md border bg-surface px-3 py-2 text-[11px]`,n.line),children:[o(i,{className:k(`mt-0.5 h-3.5 w-3.5 shrink-0`,n.mark),"aria-hidden":!0}),o(`span`,{className:`min-w-0 flex-1`,children:e.message}),t!==void 0&&o(ie,{type:`button`,variant:`ghost`,size:`sm`,icon:f,"aria-label":`Dismiss`,onClick:t,className:`-my-1 h-5 w-5`})]})}function j(){let{data:e}=C();return i(()=>{let t=new Map;for(let n of e??[])t.set(n.id,n.username);return t},[e])}function M(e,t=null){return e===null?t:{tone:`danger`,message:e}}var N={active:`Active`,expired:`Expired`,revoked:`Revoked`,current:`This session`},me={active:`success`,expired:`warning`,revoked:`default`,current:`info`},he={current:0,active:1,expired:2,revoked:3};function P(e,t){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:n.toLocaleString()}function ge({status:e}){return o(oe,{variant:me[e],className:`text-[10px]`,children:N[e]})}function _e({row:e,action:t}){if(!t.isAvailable(e))return null;let n=t.icon,i=t.busyId===e.id;return r(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t.onRun(e),disabled:t.disabled,"aria-label":`${t.label} ${e.name}`,className:t.tone===`neutral`?void 0:`text-danger hover:bg-danger/10`,children:[i?o(l,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):o(n,{className:`h-3 w-3`,"aria-hidden":!0}),t.label]})}function ve(e){return[{key:`name`,header:`Name`,sortValue:e=>e.name.toLowerCase(),render:e=>r(`div`,{className:`min-w-0 max-w-[18rem]`,children:[o(`div`,{className:`truncate font-medium text-foreground`,title:e.name,children:e.name}),e.detail!==null&&o(`div`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,title:e.detail,children:e.detail})]})},e.hideOwner?null:{key:`owner`,header:`Owner`,sortValue:e=>e.ownerName.toLowerCase(),render:e=>e.ownerName},{key:`kind`,header:`Kind / scope`,sortValue:e=>e.kind.toLowerCase(),nowrap:!1,render:e=>r(`div`,{className:`min-w-[8rem] max-w-[16rem]`,children:[o(`div`,{className:`text-foreground`,children:e.kind}),e.scope!==null&&o(`div`,{className:`line-clamp-2 text-[10px] text-foreground-subtle`,title:e.scope,children:e.scope})]})},{key:`status`,header:`Status`,sortValue:e=>he[e.status],render:e=>o(ge,{status:e.status})},{key:`created`,header:`Created`,sortValue:e=>e.createdAt,render:e=>o(`span`,{className:`text-foreground-subtle`,children:P(e.createdAt,`—`)})},{key:`lastUsed`,header:`Last used`,sortValue:e=>e.lastUsedAt,render:e=>o(`span`,{className:`text-foreground-subtle`,children:P(e.lastUsedAt,`Never`)})},{key:`expires`,header:`Expires`,sortValue:e=>e.expiresAt,render:t=>o(`span`,{className:`text-foreground-subtle`,children:P(t.expiresAt,e.expiresNone)})},e.action===null?null:{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:t=>o(`div`,{className:`flex items-center justify-end gap-1`,children:[...e.extraActions??[],e.action].map(e=>e===null?null:o(_e,{row:t,action:e},e.label))})}].filter(e=>e!==null)}n();var F=6,I={"current-session":`your current session`,"not-active":`already gone`};function L(e,t){return`${String(e)} ${e===1?t.one:t.many}`}function ye(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return[...t.entries()].map(([e,t])=>`${String(t)} ${N[e].toLowerCase()}`).join(`, `)}function be(e,t){let n=e.slice(0,F).map(e=>`• ${e.name} — ${e.ownerName}`),r=e.length>F?[`…and ${String(e.length-F)} more`]:[];return[`${L(e.length,t)} (${ye(e)}) stop working at once. This cannot be undone.`,``,...n,...r].join(`
|
|
2
|
-
`)}async function R(e,t,n){let r=String(t.length),i=await e({title:`Revoke ${L(t.length,n)}?`,message:be(t,n),label:`Type ${r} to confirm`,placeholder:r,confirmLabel:`Revoke ${r}`,variant:`danger`,validate:e=>e.trim()===r?null:`Type ${r} — the number of ${n.many} selected`});return i!==null&&i.trim()===r}function z(e,t,n){let r=D(),i=O.auth.revokeCredentials.useMutation(),[o,s]=a(null);return{run:async a=>{if(a.length===0||!await R(r,a,t))return!1;s(null);try{let n=await i.mutateAsync({kind:e,ids:a.map(e=>e.id),confirmCount:a.length}),r=n.skipped.map(e=>I[e.reason]??e.reason);return s({tone:`success`,message:`Revoked ${L(n.revoked.length,t)}.`+(r.length>0?` Skipped ${String(r.length)}: ${[...new Set(r)].join(`, `)}.`:``)}),!0}catch(e){return s({tone:`danger`,message:`The revoke failed: ${e instanceof Error?e.message:`request failed`}. The list below is reloaded — check what is left.`}),!1}finally{n()}},busy:i.isPending,outcome:o,dismiss:()=>s(null)}}function xe(e,t){let n=D(),r=O.auth.revokeCredentials.useMutation(),[i,o]=a(null);return{run:async i=>{if(i.length===0||!await R(n,i,e))return!1;o(null);let a=i.filter(e=>e.kind===`Scoped`).map(e=>e.id),s=i.filter(e=>e.kind===`Admin`).map(e=>e.id);try{let t=[],n=[];if(a.length>0){let e=await r.mutateAsync({kind:`scoped-token`,ids:a,confirmCount:a.length});t.push(...e.revoked),n.push(...e.skipped)}if(s.length>0){let e=await r.mutateAsync({kind:`admin-token`,ids:s,confirmCount:s.length});t.push(...e.revoked),n.push(...e.skipped)}let i=n.map(e=>I[e.reason]??e.reason);return o({tone:`success`,message:`Revoked ${L(t.length,e)}.`+(i.length>0?` Skipped ${String(i.length)}: ${[...new Set(i)].join(`, `)}.`:``)}),!0}catch(e){return o({tone:`danger`,message:`The revoke failed: ${e instanceof Error?e.message:`request failed`}. The list below is reloaded — check what is left.`}),!1}finally{t()}},busy:r.isPending,outcome:i,dismiss:()=>o(null)}}function Se(e,t,n){let r=D(),[i,o]=a(!1),[s,c]=a(null);return{run:async i=>{if(i.length===0||!await R(r,i,e))return!1;c(null),o(!0);let a=[],s=0;for(let e of i)try{await t(e.id),s+=1}catch(t){a.push(`${e.name}: ${t instanceof Error?t.message:`request failed`}`)}return o(!1),n(),a.length===0?(c({tone:`success`,message:`Revoked ${L(s,e)}.`}),!0):(c({tone:`danger`,message:`Revoked ${L(s,e)}; ${String(a.length)} failed — ${a.slice(0,3).join(`; `)}${a.length>3?`; …`:``}. The list is reloaded — check what is left.`}),s>0)},busy:i,outcome:s,dismiss:()=>c(null)}}n();var Ce={searchText:e=>[e.name,e.detail??``,e.ownerName,e.kind,e.scope??``],facetGroups:[{id:`status`,value:e=>e.status},{id:`owner`,value:e=>e.ownerName},{id:`kind`,value:e=>e.kind}]},we={status:`Status`,owner:`Owner`,kind:`Kind`},Te=e=>e.status!==`current`,Ee=[`active`,`current`];function B({rows:e,label:t,isLoading:n,loadError:s,emptyText:c,hideOwner:u=!1,expiresNone:d=`Never`,action:f,extraActions:p,bulk:m,defaultStatus:h=Ee}){let[g]=a(()=>h.length===0?{search:``,facets:[]}:{search:``,facets:[],groups:{status:[...h]}}),_=w(e,Ce,g),[v,y]=a(()=>new Set),b=i(()=>ve({hideOwner:u,expiresNone:d,action:f??null,...p===void 0?{}:{extraActions:p}}),[u,d,f,p]),C=i(()=>m===void 0?()=>!1:e=>Te(e)&&m.isSelectable(e),[m]),T=i(()=>_.rows.filter(e=>v.has(e.id)&&C(e)),[_.rows,v,C]);return n?r(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[o(l,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Loading `,t,`…`]}):s===null?r(`div`,{className:`space-y-3`,children:[o(E,{state:_.state,facets:_.facets,groups:_.groups.filter(e=>!(u&&e.id===`owner`)).map(e=>({...e,label:we[e.id]??e.id,...e.id===`status`?{facetLabel:e=>N[e]??e}:{}})),labels:{searchPlaceholder:`Search ${t}…`,searchLabel:`Search ${t}`,facetsLabel:`Filter ${t}`,clearLabel:`Clear filters`},onSearch:_.setSearch,onToggleFacet:_.toggleFacet,onToggleGroupFacet:_.toggleGroupFacet,onClear:_.clear}),m!==void 0&&o(De,{bulk:m,shown:_.rows.filter(C),targets:T,onSelect:y}),o(x,{columns:b,rows:_.rows,rowKey:e=>e.id,minWidthPx:u?760:860,mobileMode:`scroll`,maxBodyHeight:te,defaultSort:{columnKey:`created`,dir:`desc`},pageSize:25,paginationLabels:{navLabel:`${t} pages`,previous:`Previous page`,next:`Next page`,range:(e,t,n)=>`${e}–${t} of ${n}`},emptyMessage:_.active?`No ${t} match the filters.`:c,rowClassName:e=>e.status===`revoked`||e.status===`expired`?`opacity-70`:void 0,...m===void 0?{}:{selection:{selected:v,onChange:y,isSelectable:C,rowLabel:e=>`Select ${e.name} (${e.ownerName})`,pageLabel:`Select every ${m.noun.one} on this page`}}})]}):o(S,{title:`Could not load ${t}`,message:s})}function De({bulk:e,shown:t,targets:n,onSelect:i}){let{revoke:a,noun:s}=e,u=(e.quickSelect??[]).map(e=>({...e,rows:t.filter(e.match)})).filter(e=>e.rows.length>0),d=async()=>{await a.run(n)&&i(new Set)};return r(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`bulk-bar`,children:[t.length>0&&r(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(new Set(t.map(e=>e.id))),children:[`Select all `,String(t.length),` shown`]}),u.map(e=>r(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(new Set(e.rows.map(e=>e.id))),children:[e.label,` (`,String(e.rows.length),`)`]},e.label)),n.length>0&&r(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[r(`span`,{className:`text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:[L(n.length,s),` selected`]}),r(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>i(new Set),children:[o(f,{className:`h-3 w-3`,"aria-hidden":!0}),`Clear selection`]}),r(y,{type:`button`,variant:`danger`,size:`sm`,disabled:a.busy,onClick:()=>void d(),children:[a.busy?o(l,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):o(c,{className:`h-3 w-3`,"aria-hidden":!0}),`Revoke `,L(n.length,s),`…`]})]})]})}var V=(e,t)=>t===null?`—`:e.get(t)??t;function H(e,t){return e!=null&&e<=t?`expired`:`active`}function Oe(e,t,n){return{id:e.id,name:n.client(e.client),detail:e.ip,ownerId:e.userId,ownerName:V(t,e.userId),kind:n.method(e.method),scope:null,status:e.current?`current`:`active`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function ke(e,t){return{id:e.id,name:e.integrationId,detail:null,ownerId:e.userId,ownerName:e.username,kind:e.integrationId,scope:t,status:e.revokedAt===null?`active`:`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:null}}var Ae=`Scoped`,U=`Admin`;function je(e,t,n,r,i){return{id:e.id,name:e.name,detail:`${e.tokenPrefix}…`,ownerId:t,ownerName:V(n,t),kind:Ae,scope:r,status:H(e.expiresAt,i),createdAt:e.createdAt,lastUsedAt:e.lastUsedAt??null,expiresAt:e.expiresAt??null}}function Me(e,t,n){return{id:e.id,name:e.name,detail:`${e.tokenPrefix}…`,ownerId:e.createdBy,ownerName:V(t,e.createdBy),kind:U,scope:`Full administrator`,status:e.revokedAt===null?H(e.expiresAt,n):`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}var Ne={"grid-view":`Grid`,"events-view":`Events`};function Pe(e,t){return e.map(e=>t.get(e)??`#${String(e)}`).join(`, `)}function Fe(e,t,n,r){let i=Ne[e.scope.kind];return{id:e.id,name:`${i} · ${String(e.scope.deviceIds.length)} camera${e.scope.deviceIds.length===1?``:`s`}`,detail:`${e.tokenPrefix}…`,ownerId:e.userId,ownerName:V(t,e.userId),kind:e.scope.talk===!0?`${i} + talk`:i,scope:Pe(e.scope.deviceIds,n),status:H(e.expiresAt,r),createdAt:e.createdAt,lastUsedAt:e.lastUsedAt??null,expiresAt:e.expiresAt}}function W(e){return`${e.provider}\u0000${e.subject}`}function Ie(e,t){return{id:W(e),name:e.label??e.subject,detail:e.issuer,ownerId:e.userId,ownerName:V(t,e.userId),kind:e.provider,scope:null,status:`active`,createdAt:e.linkedAt,lastUsedAt:null,expiresAt:null}}function Le(e,t){let n=e.allowedProviders;return{id:e.id,name:e.label,detail:`${e.tokenPrefix}…`,ownerId:e.userId??null,ownerName:V(t,e.userId??null),kind:e.isAdmin===!0?`Admin`:`Regular`,scope:n===void 0||n===`*`?`All providers`:n.join(`, `)||`All providers`,status:`active`,createdAt:e.createdAt??null,lastUsedAt:e.lastUsedAt??null,expiresAt:null}}var G=40,Re=[{test:/Electron\//,name:`CamStack desktop`},{test:/Edg(e|A|iOS)?\//,name:`Edge`},{test:/OPR\/|Opera/,name:`Opera`},{test:/Firefox\/|FxiOS\//,name:`Firefox`},{test:/Chrome\/|CriOS\//,name:`Chrome`},{test:/Version\/[\d.]+.*Safari\//,name:`Safari`}],ze=[{test:/iPhone/,name:`iPhone`},{test:/iPad/,name:`iPad`},{test:/Android/,name:`Android`},{test:/Mac OS X|Macintosh/,name:`macOS`},{test:/Windows/,name:`Windows`},{test:/CrOS/,name:`ChromeOS`},{test:/Linux/,name:`Linux`}],Be=[{test:/CFNetwork\/.*Darwin\//,name:`CamStack app on iOS`},{test:/^okhttp\//i,name:`CamStack app on Android`},{test:/^(node|undici)\b/i,name:`Script (Node.js)`},{test:/^curl\//i,name:`curl`}];function K(e,t){return e.find(e=>e.test.test(t))?.name??null}function Ve(e){return e.length<=G?e:`${e.slice(0,G)}…`}function q(e){if(e===null||e.trim().length===0)return{label:`Unknown device`,raw:null};let t=e.trim(),n=K(Be,t);if(n!==null)return{label:n,raw:t};let r=K(Re,t),i=K(ze,t);return r!==null&&i!==null?{label:`${r} on ${i}`,raw:t}:r===null?{label:Ve(t),raw:t}:{label:r,raw:t}}var He={password:`Password`,passkey:`Passkey`,sso:`Single sign-on`,handoff:`App hand-off`,exchange:`Session exchange`};function J(e){return He[e]??e}function Y(e){if(e==null)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}n();function X(e,t){return e instanceof Error&&e.message.length>0?e.message:t}function Ue(n){let i=p(),[s,c]=a(!1),[u,d]=a(``),[f,m]=a(null),[h,_]=a(null),x=t(null),S=e(e=>{x.current?.(e),x.current=null,c(!1),d(``),m(null),_(null)},[]),C=e(()=>new Promise(e=>{x.current?.(null),x.current=e,_(null),c(!0)}),[]),w=async()=>{m(`password`),_(null);try{let{reauthToken:e}=await i.reauthenticate({password:u});S(e)}catch(e){_(X(e,`Password is incorrect`)),m(null)}},E=async()=>{m(`passkey`),_(null);try{let{optionsJSON:e}=await i.reauthBeginPasskey(),t=await de({optionsJSON:e}),{reauthToken:n}=await i.reauthenticate({passkeyResponse:Object.fromEntries(Object.entries(t))});S(n)}catch(e){_(X(e,`Passkey verification failed`)),m(null)}};return{requestProof:C,dialog:o(ee,{open:s,onOpenChange:e=>!e&&S(null),children:r(b,{children:[r(v,{children:[o(se,{children:`Confirm it’s you`}),r(T,{children:[n,` needs your password or a passkey, even though you are signed in.`]})]}),r(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),u.length>0&&f===null&&w()},children:[o(re,{type:`password`,autoComplete:`current-password`,placeholder:`Current password`,value:u,onChange:e=>d(e.target.value),"aria-label":`Current password`}),h!==null&&o(`p`,{role:`alert`,className:`text-xs text-danger`,children:h}),r(ce,{className:`flex flex-wrap gap-2`,children:[r(y,{type:`button`,variant:`outline`,disabled:f!==null,onClick:()=>void E(),children:[f===`passkey`?o(l,{className:`h-4 w-4 animate-spin`}):o(g,{className:`h-4 w-4`}),`Use a passkey`]}),r(y,{type:`submit`,disabled:u.length===0||f!==null,children:[f===`password`&&o(l,{className:`h-4 w-4 animate-spin`}),`Confirm`]})]})]})]})})}}n();var Z={one:`share link`,many:`share links`};function Q(e){let t=ae(),n=O.useUtils(),r=O.auth.listShareTokens.useQuery({owner:e}),o=j(),{data:s}=le({isCamera:!0,projection:`slim`}),[l,u]=a(null),d=()=>void n.auth.listShareTokens.invalidate(),f=O.auth.revokeShareToken.useMutation({onSuccess:d,onError:e=>u(`Revoke failed: ${e.message}`)}),p=i(()=>{let e=new Map;for(let t of s??[])e.set(t.id,t.name);return e},[s]),m=Date.now(),h=(r.data??[]).map(e=>Fe(e,o,p,m)),g=async e=>{await t({title:`Revoke share link`,message:`Anyone holding this link to ${e.scope??e.name} loses access immediately. This cannot be undone.`,confirmLabel:`Revoke`,variant:`danger`})&&(u(null),f.mutate({id:e.id}))};return{rows:h,refresh:d,error:l,clearError:()=>u(null),isLoading:r.isLoading,loadError:r.isError?r.error?.message??`Request failed`:null,action:{label:`Revoke`,icon:c,isAvailable:()=>!0,onRun:e=>void g(e),busyId:f.isPending?f.variables?.id??null:null,disabled:f.isPending}}}function We(){let e=Q(`self`);return o(A,{notice:M(e.error),onDismissNotice:e.clearError,id:`my-share-links`,title:`Share links`,icon:u,description:`View-only links you created in the viewer app to share a grid or the events of some cameras. Revoking a link stops it working everywhere it was sent.`,children:o(B,{rows:e.rows,label:`share links`,isLoading:e.isLoading,loadError:e.loadError,emptyText:`You have no share links.`,hideOwner:!0,action:e.action})})}function Ge(){let{user:e}=ue();return e?.isAdmin?o(Ke,{}):null}function Ke(){let e=Q(`all`),t=z(`share-link`,Z,e.refresh);return o(A,{notice:M(e.error,t.outcome),onDismissNotice:()=>{e.clearError(),t.dismiss()},id:`share-links`,title:`Share links`,icon:u,description:`Every user's view-only share links. Revoking one stops it working for whoever it was sent to — a revoked link is deleted and cannot be restored.`,children:o(B,{rows:e.rows,label:`share links`,isLoading:e.isLoading,loadError:e.loadError,emptyText:`No user has any share links.`,action:{...e.action,disabled:e.action.disabled||t.busy},bulk:{revoke:t,noun:Z,isSelectable:()=>!0,quickSelect:[{label:`Select expired`,match:e=>e.status===`expired`}]}})})}var qe=864e5,Je={qr:`QR (by an admin)`,self:`Self-enrolled`},Ye={ios:`iOS`,android:`Android`,web:`Web`,other:`Other`};function Xe(e){return e.status===`revoked`}function Ze(e){return e.status!==`revoked`}function Qe(e,t=`—`){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function $e(e,t){return e===null||Number.isNaN(e)?null:Math.floor((e-t)/qe)}function et(e,t){let n=$e(e,t);return n===null?`unknown`:n<0?`expired`:n<30?`soon`:`ok`}function tt(e,t){let n=$e(e,t);if(n===null)return`Unknown`;if(n===0)return`today`;if(n>0)return`in ${String(n)} day${n===1?``:`s`}`;let r=-n;return`${String(r)} day${r===1?``:`s`} ago`}function nt(e){if(e===null)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function rt(e){return e===null||e.length===0?`—`:e.length<=17?e:`${e.slice(0,8)}…${e.slice(-8)}`}function $(e){return e.length<=10?e:`${e.slice(0,10)}…`}function it(e){if(!e.online)return{allowed:!1,reason:`The node is offline - it cannot be renewed now.`};if(e.isHub&&e.https.kind===`served`){if(e.https.status.mode===`uploaded`)return{allowed:!1,reason:`This certificate was uploaded by an operator. Replace it where it was uploaded (Network → Local access), or revert to the generated one there.`};if(e.https.status.mode===`disabled`)return{allowed:!1,reason:`TLS is disabled on the hub - there is no certificate.`}}return{allowed:!0,reason:null}}var at={prepare:`asking the node for a key`,issue:`issuing the new certificate`,install:`installing it on the node`,reconnect:`waiting for the node to reconnect`,confirm:`confirming the node presents the new certificate`};function ot(e){if(e.ok)return{tone:`success`,message:`${e.nodeId}: new cluster certificate ${$(e.newSerial)} installed; the previous one was revoked.`};let t=e.keptPreviousLeaf?`The node keeps its previous certificate - nothing was broken.`:`The node may be without a valid certificate: check it and renew again.`;return{tone:`danger`,message:`${e.nodeId}: renewal failed while ${at[e.stage]} - ${e.reason}. ${t}`}}function st(e,t){let n=Math.max(0,e-t),r=Math.ceil(n/1e3),i=Math.floor(r/60),a=r%60;return{expired:n===0,label:`${String(i)}:${String(a).padStart(2,`0`)}`}}var ct=11;function lt(e,t){let n=e.slice(0,ct);return t===null?n:`${n} · ${t}`}function ut(e){return{id:e.id,name:e.deviceName,detail:lt(e.fingerprint,e.lastUsedFrom),ownerId:e.userId,ownerName:e.username??e.userId,kind:Ye[e.platform],scope:Je[e.enrolledVia],status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function dt(e,t){return{id:e.id,name:e.deviceName,detail:null,ownerId:null,ownerName:t,kind:Ye[e.platform],scope:null,status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function ft({sessions:e,isLoading:t,loadError:n,emptyText:i,onRevoke:a,revokingId:s}){return t?r(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[o(l,{className:`h-3.5 w-3.5 animate-spin`}),`Loading sessions…`]}):n===null?e.length===0?o(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center`,children:i}):o(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:e.map(e=>o(pt,{session:e,revoking:s===e.id,onRevoke:()=>a(e)},e.id))}):r(`div`,{className:`text-[11px] text-danger`,children:[`Could not load sessions: `,n]})}function pt({session:e,revoking:t,onRevoke:n}){let i=q(e.client);return r(`li`,{"data-testid":`session-row`,className:`flex items-start gap-3 px-3 py-2 text-xs`,children:[o(m,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),r(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o(`span`,{className:`font-medium text-foreground truncate`,title:i.raw??void 0,children:i.label}),e.current&&o(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:`This device`})]}),r(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[o(`span`,{children:J(e.method)}),o(`span`,{className:`font-mono`,children:e.ip??`IP unknown`}),r(`span`,{children:[`Last active `,Y(e.lastUsedAt)]}),r(`span`,{children:[`Expires `,Y(e.expiresAt)]})]})]}),!e.current&&r(`button`,{onClick:n,disabled:t,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[t?o(l,{className:`h-3 w-3 animate-spin`}):o(h,{className:`h-3 w-3`}),`Sign out`]})]})}export{z as A,Le as C,Oe as D,ke as E,j as F,xe as M,A as N,je as O,M as P,Me as S,Ie as T,Ue as _,Ze as a,Y as b,tt as c,Qe as d,it as f,We as g,Ge as h,Xe as i,Se as j,B as k,ot as l,$ as m,ut as n,st as o,rt as p,dt as r,nt as s,ft as t,et as u,q as v,W as w,U as x,J as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,Q as t,S as n,W as r,a as i,b as a,o,q as s,t as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{$t as d,D as f,Ir as p,It as m,Nt as h,_i as g,ar as _,er as v,fi as y,ln as b,nr as x,on as S,ot as C,pi as ee,pr as te,un as ne,vi as re,wn as ie,yi as w,yn as T}from"./player-overlays-DWMIy1MJ.js";import{t as E}from"./key-round-B2I1YisX.js";import{t as ae}from"./octagon-alert-DMjnTemh.js";import{lr as oe}from"./client-CjyKfSu1.js";import{An as se,Bn as D,Co as ce,Dn as le,En as ue,Ft as O,Ht as k,Ln as de,On as fe,Pn as pe,Qn as me,So as he,Tn as ge,To as _e,Ul as A,Ut as j,Vt as M,Xl as N,Xn as P,Zn as F,_o as I,ar as L,bo as ve,cl as ye,du as be,en as xe,go as Se,ho as Ce,iu as R,jn as we,kn as Te,nn as Ee,ol as De,rl as Oe,rn as z,tn as B,vo as ke,wo as Ae,xo as je,yo as Me}from"./src-BLkInT8U.js";import{t as Ne}from"./useTranslation-Bc5yH9V9.js";import{S as Pe,T as Fe,Z as Ie}from"./index-D66JvELZ.js";import{t as Le}from"./AdminSectionedPage-D2kYQhvu.js";import{t as V}from"./AdminPage-C0Zxs_ot.js";import{t as Re}from"./NodeAddonsSettingsPanel-D3ux_JIo.js";import{t as ze}from"./AddonAssetIcon-BgXfFdy2.js";t();var Be={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},Ve={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function He({entry:e,actions:t}){let r=e.name.toLowerCase(),i=Be[r]??`border-primary`,a=Ve[r]??`bg-primary/5`,o=e.providers.find(e=>e.active),s=t?.pendingCapability===e.name;return n(`div`,{className:`rounded-lg border-t-2 border border-border ${i} ${a} p-3 space-y-2`,children:[n(`div`,{className:`flex items-center justify-between gap-2`,children:[n(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[e.name,s&&l(_,{className:`h-3 w-3 animate-spin text-primary`})]}),l(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${e.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:e.mode})]}),e.mode===`singleton`?l(Ue,{entry:e,actions:t,activeProvider:o,isPending:s}):l(We,{entry:e,actions:t,isPending:s})]})}function Ue({entry:e,actions:t,activeProvider:r,isPending:i}){if(!t)return l(`div`,{children:r?n(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[l(y,{className:`h-3 w-3 text-green-400 shrink-0`}),l(`span`,{className:`font-medium`,children:r.addonName}),l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No active provider`})});if(e.providers.length===0)return l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});let a=`__inherit__`;return n(`div`,{className:`space-y-2`,children:[l(`div`,{className:`space-y-1`,children:e.providers.map(r=>{let a=r.active;return n(`button`,{type:`button`,disabled:i||a,onClick:()=>t.onSelectSingleton(e.name,r.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${a?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[l(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${a?`border-green-400 bg-green-400`:`border-border`}`}),l(`span`,{className:`font-medium truncate`,children:r.addonName}),a&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},r.addonId)})}),e.perNode&&e.perNode.length>0&&l(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:e.perNode.map(r=>{let o=r.hasOverride&&r.resolvedActive?r.resolvedActive:a,s=[{value:a,label:`Inherit global${r.resolvedActive?` (${r.resolvedActive})`:``}`},...r.providers.map(e=>({value:e,label:e}))],c=n=>{n===a?t.onClearNodeSingleton(e.name,r.nodeId):t.onSelectNodeSingleton(e.name,r.nodeId,n)},u=i;return n(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[r.nodeId,r.hasOverride&&l(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:`override`})]}),s.map(e=>{let t=o===e.value;return n(`button`,{type:`button`,disabled:u||t,onClick:()=>c(e.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${t?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[l(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${t?`border-green-400 bg-green-400`:`border-border`}`}),l(`span`,{className:`font-medium truncate`,children:e.label}),t&&e.value!==a&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},e.value)})]},r.nodeId)})})]})}function We({entry:e,actions:t,isPending:r}){if(e.providers.length===0)return l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});if(!t)return l(`div`,{className:`space-y-1`,children:e.providers.map(e=>n(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[l(`span`,{className:`text-foreground-subtle`,children:e.addonName}),e.active&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},e.addonId))});let i=e.providers.filter(e=>e.active).map(e=>e.addonId),a=(n,r)=>{let a=r?[...new Set([...i,n])]:i.filter(e=>e!==n);t.onToggleCollection(e.name,a)};return l(`div`,{className:`space-y-1`,children:e.providers.map(e=>n(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${r?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[n(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[l(`input`,{type:`checkbox`,checked:e.active,disabled:r,onChange:t=>a(e.addonId,t.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),l(`span`,{className:`text-foreground truncate`,children:e.addonName})]}),e.active&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},e.addonId))})}function H({capabilities:e,actions:t}){return e.length===0?l(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:`No capabilities registered`}):l(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>l(He,{entry:e,actions:t},e.name))})}var Ge=[`capabilities`,`listCapabilities`];function Ke(e){return e===`singleton`||e===`collection`}function qe(e){let t=e.indexOf(`@`);return t===-1?`${e} (hub)`:`${e.slice(0,t)} (${e.slice(t+1)})`}function Je(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:qe(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function Ye(){let e=C(),[t,a]=s(null),[o,u]=s(null),f=i({queryKey:Ge,queryFn:()=>e.trpcClient.capabilities.listCapabilities.query()}),p=r(()=>{let e=(f.data??[]).flatMap(e=>Ke(e.mode)?[Je(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[f.data]),m=r(()=>p.filter(e=>e.mode===`singleton`),[p]),h=r(()=>p.filter(e=>e.mode===`collection`),[p]),g=c({mutationFn:t=>e.trpcClient.capabilities.setActiveSingleton.mutate({capability:t.capName,addonId:t.addonId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} → ${t.addonId} is now active.`}),await f.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to set ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),_=c({mutationFn:t=>e.trpcClient.capabilities.setActiveSingleton.mutate({capability:t.capName,addonId:t.addonId,nodeId:t.nodeId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await f.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to set ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),v=c({mutationFn:t=>e.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:t.capName,nodeId:t.nodeId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} @ ${t.nodeId} now inherits the global default.`}),await f.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to clear ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),b=c({mutationFn:t=>e.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:t.capName,enabledAddonIds:[...t.enabledAddonIds]}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName}: ${t.enabledAddonIds.length} provider(s) enabled.`}),await f.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to update ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),x={onSelectSingleton:(e,t)=>g.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>_.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>v.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>b.mutate({capName:e,enabledAddonIds:t}),pendingCapability:t};return n(V,{embedded:!0,icon:d,title:`Capabilities`,subtitle:`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`,children:[o&&n(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${o.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[o.kind===`success`?l(y,{className:`h-3.5 w-3.5 shrink-0`}):l(ee,{className:`h-3.5 w-3.5 shrink-0`}),l(`span`,{children:o.message})]}),f.isLoading&&l(`div`,{className:`flex items-center justify-center py-16`,children:l(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),f.isError&&!f.isLoading&&l(de,{title:`Failed to load capabilities`,message:f.error instanceof Error?f.error.message:`Unknown error`,onRetry:()=>void f.refetch()}),!f.isLoading&&!f.isError&&p.length===0&&l(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:`No capabilities registered.`}),!f.isLoading&&!f.isError&&p.length>0&&n(`div`,{className:`space-y-6`,children:[m.length>0&&n(`section`,{className:`space-y-2`,children:[l(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Singleton — pick one provider`}),l(H,{capabilities:m,actions:x})]}),h.length>0&&n(`section`,{className:`space-y-2`,children:[l(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Collection — enable a set`}),l(H,{capabilities:h,actions:x})]})]})]})}var U=[`locked`,`reset`,`shares-backup`,`recovery-key`,`rotation-pending`,`orphans`],Xe={"key-missing":`no master key could be loaded`,"wrong-key":`the master key does not match`,"key-file-unreadable":`the key file cannot be read`,"store-unavailable":`the keychain tables cannot be read`,"not-initialized":`still starting`,"decrypt-failed":`a value did not decrypt`};function Ze(e){return Xe[e]??e}function W(e,t,n){return`${e} ${e===1?t:n}`}function Qe({status:e,reset:t,pendingReentry:n,orphans:r}){let i=e.keychain.state===`locked`,a=e.keySource??e.configuredSource,o=[];return e.keychain.state===`locked`&&o.push({id:`locked`,tone:`danger`,title:`Keychain locked: ${Ze(e.keychain.reason)}`}),t!==null&&t.acknowledgedAt===null&&o.push({id:`reset`,tone:`danger`,title:n>0?`Keychain was reset: ${W(n,`field`,`fields`)} to re-enter`:`Keychain was reset: every archived field holds a value again`}),a.sharesBackupWithDatabase&&o.push({id:`shares-backup`,tone:`warning`,title:`The master key sits next to the database in whole-volume backups`}),!i&&e.recoveryKeyDownloadedAt===null&&o.push({id:`recovery-key`,tone:`warning`,title:`No recovery copy of the master key has been taken`}),!i&&e.rotationPending&&o.push({id:`rotation-pending`,tone:`info`,title:`The configured master key is not in use yet`}),!i&&r>0&&o.push({id:`orphans`,tone:`info`,title:`${W(r,`stored value`,`stored values`)} no setting points at`}),[...o].sort((e,t)=>U.indexOf(e.id)-U.indexOf(t.id))}var $e={dateStyle:`short`,timeStyle:`short`};function G(e){return e===null?`—`:new Date(e).toLocaleString(void 0,$e)}function K({value:e,copyValue:t,srLabel:r,maxWidthClass:i,className:a}){let o=t??e;return n(`span`,{className:R(`flex min-w-0 items-center gap-0.5`,i),children:[l(`span`,{className:R(`min-w-0 truncate font-mono`,a),title:o,children:e}),l(O,{value:o,srLabel:r,className:`h-6 shrink-0 px-1.5`})]})}t();var et=new Set([`reveal`,`download-recovery-key`,`rotate-master-key`,`reset`]),tt=[{key:`at`,header:`When`,render:e=>G(e.at)},{key:`action`,header:`Action`,render:e=>l(L,{variant:et.has(e.action)?`warning`:`default`,children:e.action})},{key:`actor`,header:`Actor`,render:e=>l(`span`,{className:`font-mono`,children:e.actor})},{key:`ref`,header:`Ref`,render:e=>e.ref===null?l(`span`,{className:`text-foreground-subtle`,children:`—`}):l(K,{value:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[22rem]`})},{key:`detail`,header:`Detail`,render:e=>l(`span`,{className:`text-foreground-muted`,children:e.detail??``})}];function nt({entries:e}){let[t,r]=s(0);if(e===void 0)return l(`p`,{className:`text-xs text-foreground-subtle`,children:`Loading…`});let i=Math.max(1,Math.ceil(e.length/25)),a=Math.min(t,i-1),o=a*25,c=e.slice(o,o+25);return n(`div`,{className:`space-y-2`,children:[l(k,{columns:tt,rows:c,rowKey:e=>e.id,minWidthPx:760,mobileMode:`scroll`,emptyMessage:`Nothing has been audited yet.`}),e.length>25&&n(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px] text-foreground-subtle`,children:[n(`span`,{children:[o+1,`–`,o+c.length,` of `,e.length,e.length>=500?` most recent`:``]}),n(`span`,{className:`inline-flex items-center gap-1`,children:[l(D,{size:`sm`,variant:`outline`,"aria-label":`Previous page`,disabled:a===0,onClick:()=>r(a-1),children:l(re,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),n(`span`,{className:`tabular-nums`,children:[a+1,` / `,i]}),l(D,{size:`sm`,variant:`outline`,"aria-label":`Next page`,disabled:a>=i-1,onClick:()=>r(a+1),children:l(g,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]})}function rt(e,t){switch(e){case`locked`:return l(D,{size:`sm`,variant:`danger`,disabled:t.busy,onClick:t.onReset,children:`Reset keychain`});case`reset`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onAcknowledgeReset,children:`Dismiss`});case`recovery-key`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onDownload,children:`Download`});case`rotation-pending`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onRotate,children:`Rotate`});case`orphans`:return l(D,{size:`sm`,variant:`outline`,onClick:t.onShowOrphans,children:`Review`});case`shares-backup`:return null}}function it(e,t){switch(e){case`locked`:return l(`p`,{children:`No value can be read or stored. If the master key is lost for good, Reset archives every stored value and starts a new keychain; every secret field then reads “not set”.`});case`reset`:return t.reset===null?null:l(at,{reset:t.reset,pending:t.pendingReentry});case`shares-backup`:return n(`p`,{children:[`CamStack’s own backups leave the key out, but a backup of the whole data directory (an appdata tar) carries both. Point `,l(`code`,{className:`font-mono`,children:`keychain.keyFile`}),` in config.yaml at a file outside the data volume, keep the old one as`,` `,l(`code`,{className:`font-mono`,children:`keychain.previousKeyFile`}),`, restart, then rotate.`]});case`recovery-key`:return l(`p`,{children:`Without a copy of the master key, the stored values cannot be recovered.`});case`rotation-pending`:return l(`p`,{children:`The keychain unlocked with a previous key. Rotate to move onto the configured one.`});case`orphans`:return null}}function at({reset:e,pending:t}){let r=e.actor===`trigger-file`?`the RESET_KEYCHAIN trigger file`:`an admin (${e.actor})`;return n(`div`,{className:`space-y-1.5`,children:[n(`p`,{children:[`Reset on `,G(e.at),` by `,r,`. `,e.archived,` stored value(s) were archived — unreadable without the lost master key. Everyone was signed out once.`]}),t.length>0&&l(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:t.map(e=>n(`li`,{className:`break-all`,children:[e.owner,` · `,e.scope,` · `,e.fieldPath]},e.ref))})]})}t();var ot=2,q={danger:{icon:ae,text:`text-danger`,border:`border-danger/40`},warning:{icon:h,text:`text-warning`,border:`border-warning/40`},info:{icon:te,text:`text-info`,border:`border-border`}};function st({notices:e,renderAction:t,renderDetail:r}){let[i,a]=s(!1),o=e[0];if(o===void 0)return null;let c=e.length>ot,u=c&&!i?e.slice(0,1):e,d=e.length-u.length;return n(`section`,{"aria-label":`Keychain notices`,className:R(`rounded-lg border bg-surface`,q[o.tone].border),children:[l(`ul`,{className:`divide-y divide-border`,children:u.map(e=>l(ct,{notice:e,action:t(e.id),detail:r(e.id)},e.id))}),c&&l(`div`,{className:`border-t border-border px-3 py-1`,children:n(D,{size:`sm`,variant:`ghost`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[l(w,{className:R(`h-3.5 w-3.5 transition-transform`,i&&`rotate-180`),"aria-hidden":!0}),i?`Show less`:`${d} more`]})})]})}function ct({notice:e,action:t,detail:r}){let[i,a]=s(!1),o=q[e.tone],c=o.icon,u=r!=null,d=`keychain-notice-${e.id}`;return n(`li`,{className:`px-3 py-2`,children:[n(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[n(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-xs text-foreground`,children:[l(c,{className:R(`mt-0.5 h-3.5 w-3.5 shrink-0`,o.text),"aria-hidden":!0}),l(`span`,{className:`min-w-0 break-words`,children:e.title})]}),n(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 pl-5 sm:pl-0`,children:[u&&l(D,{size:`sm`,variant:`ghost`,"aria-expanded":i,"aria-controls":d,onClick:()=>a(e=>!e),children:`Details`}),t]})]}),u&&i&&l(`div`,{id:d,className:`mt-2 pl-5 text-xs text-foreground-muted`,children:r})]})}var lt={"config-file":`Key file (config.yaml)`,"previous-config-file":`Previous key file`,platform:`OS keychain`,"default-file":`Default key file (data volume)`},ut=8;function dt({status:e,busy:t,onDownload:r,onRotate:i,onPurge:a}){let o=e.keychain.state===`locked`,s=e.keySource??e.configuredSource;return l(M,{headingId:`keychain-status`,title:`Keychain`,icon:E,actions:n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.retiredWraps>0&&n(D,{size:`sm`,variant:`ghost`,disabled:t||o,onClick:a,children:[`Purge `,e.retiredWraps,` retired wrap`,e.retiredWraps===1?``:`s`]}),l(D,{size:`sm`,variant:`outline`,disabled:t||o,onClick:i,children:`Rotate key`}),l(D,{size:`sm`,variant:`outline`,disabled:t||o,onClick:r,children:`Download recovery key`})]}),children:n(`dl`,{className:`${f} grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2 xl:grid-cols-4`,children:[n(J,{label:`State`,children:[o?n(L,{variant:`danger`,className:`gap-1`,children:[l(x,{className:`h-3 w-3`,"aria-hidden":!0}),`Locked`]}):n(L,{variant:`success`,className:`gap-1`,children:[l(S,{className:`h-3 w-3`,"aria-hidden":!0}),`Unlocked`]}),n(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.secretCount,` stored`]})]}),n(J,{label:`Key source`,children:[l(`span`,{className:`block`,children:lt[s.kind]}),s.path!==void 0&&l(K,{value:s.path,srLabel:`key path`})]}),l(J,{label:`Fingerprint`,children:e.fingerprint===null?l(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:`inline-flex items-center gap-0.5`,children:[l(`span`,{className:`font-mono`,title:e.fingerprint,children:e.fingerprint.slice(0,ut)}),l(O,{value:e.fingerprint,srLabel:`fingerprint`})]})}),l(J,{label:`Recovery key`,children:e.recoveryKeyDownloadedAt===null?l(L,{variant:`warning`,children:`Not taken`}):n(`span`,{children:[`Taken `,G(e.recoveryKeyDownloadedAt)]})})]})})}function J({label:e,children:t}){return n(`div`,{className:`min-w-0 text-xs`,children:[l(`dt`,{className:`text-foreground-subtle`,children:e}),l(`dd`,{className:`mt-0.5 min-w-0 text-foreground`,children:t})]})}t();var ft=1e3;function pt({revealed:e,onClose:t}){let[r,i]=s(A);u(()=>{if(e===null)return;let n=Date.now();i(A);let r=setTimeout(t,A),a=setInterval(()=>i(Math.max(0,A-(Date.now()-n))),ft);return()=>{clearTimeout(r),clearInterval(a)}},[e,t]);let o=Math.ceil(r/1e3);return l(ge,{open:e!==null,onOpenChange:e=>!e&&t(),children:l(le,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:e!==null&&n(a,{children:[n(se,{children:[l(we,{className:`break-all`,children:e.entry.fieldPath}),n(fe,{className:`break-all`,children:[e.entry.owner,` · `,e.entry.scope]})]}),l(ue,{children:l(`pre`,{"data-testid":`revealed-value`,className:`whitespace-pre-wrap break-all rounded-md border border-border bg-background p-3 font-mono text-xs text-foreground`,children:e.value})}),n(Te,{className:`flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`This reveal is recorded in the keychain audit. Hides in `,o,`s.`]}),n(`div`,{className:`flex justify-end gap-2`,children:[l(O,{value:e.value,label:`Copy`,srLabel:`revealed value`}),l(D,{size:`sm`,variant:`outline`,onClick:t,children:`Hide`})]})]})]})})})}var Y={orphan:{label:`Orphan`,variant:`warning`,hint:`No setting points at this value any more.`,rank:0},unknown:{label:`Unavailable`,variant:`default`,hint:`Its owner's settings could not be read, so whether it is in use is unknown. Never deleted as an orphan.`,rank:1},"in-use":{label:`In use`,variant:`success`,hint:`A setting points at this value.`,rank:2}},mt=[{id:`all`,label:`All`},{id:`in-use`,label:`In use`},{id:`orphan`,label:`Orphans`},{id:`unknown`,label:`Unavailable`}],X=`system`;function Z(e){let{secrets:t,filter:r,onFilterChange:i,onDeleteOrphans:a,deleting:o,locked:s}=e;if(t===void 0)return l(`p`,{className:`text-xs text-foreground-subtle`,children:`Loading…`});let c=e=>e===`all`?t.length:t.filter(t=>t.usage===e).length,u=t.filter(e=>e.usage===`orphan`).map(e=>e.ref),d=r===`all`?t:t.filter(e=>e.usage===r);return n(`div`,{className:`space-y-2`,children:[n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[l(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":`Filter by usage`,children:mt.map(e=>n(D,{size:`sm`,variant:r===e.id?`secondary`:`ghost`,"aria-pressed":r===e.id,className:r===e.id?`ring-1 ring-border`:void 0,onClick:()=>i(e.id),children:[e.label,l(`span`,{className:`text-foreground-subtle tabular-nums`,children:c(e.id)})]},e.id))}),u.length>0&&n(D,{size:`sm`,variant:`outline`,className:`ml-auto`,disabled:o||s,onClick:()=>a(u),children:[l(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Delete `,u.length,` orphan`,u.length===1?``:`s`]})]}),l(k,{columns:gt(e),rows:d,rowKey:e=>e.ref,minWidthPx:860,mobileMode:`scroll`,maxBodyHeight:j,defaultSort:{columnKey:`owner`,dir:`asc`},emptyMessage:t.length===0?`No value is stored in the keychain yet.`:`No stored value matches this filter.`})]})}function ht({owner:e}){return n(`span`,{className:`flex items-center gap-2`,children:[l(ze,{addonId:e,fallback:e===X?ne:ie,tileClassName:`bg-surface-hover text-foreground-subtle`,size:`sm`}),l(`span`,{className:`font-medium`,children:e===X?`Hub (system)`:e})]})}function gt({locked:e,onReveal:t,revealing:r}){return[{key:`owner`,header:`Owner`,render:e=>l(ht,{owner:e.owner}),sortValue:e=>e.owner},{key:`scope`,header:`Scope`,render:e=>l(`span`,{className:`block max-w-[11rem] truncate font-mono`,title:e.scope,children:e.scope}),sortValue:e=>e.scope},{key:`field`,header:`Field`,render:e=>l(K,{value:e.fieldPath,copyValue:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[16rem]`}),sortValue:e=>e.fieldPath},{key:`updated`,header:`Updated`,render:e=>G(e.updatedAt),sortValue:e=>e.updatedAt},{key:`last-read`,header:`Last read`,render:e=>G(e.lastReadAt),sortValue:e=>e.lastReadAt},{key:`status`,header:`Status`,render:e=>l(L,{variant:Y[e.usage].variant,title:Y[e.usage].hint,children:Y[e.usage].label}),sortValue:e=>Y[e.usage].rank},{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:i=>n(D,{size:`sm`,variant:`ghost`,disabled:e||r,"aria-label":`Reveal ${i.fieldPath}`,title:e?`The keychain is locked`:`Reveal (audited)`,onClick:()=>t(i),children:[l(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Reveal`]})}]}function _t(e){return e instanceof Error?e.message:String(e)}function vt(e){let t=F(),n=P(),r=me(),i=I(),a=Ae(),o=ve(),s=je(),c=Ce(),l=Se(),u=async(t,r)=>{try{await r()}catch(e){await n({title:t,message:_t(e),variant:`danger`})}e()};return{busy:i.isPending||a.isPending||o.isPending||s.isPending,deleting:l.isPending,download:async()=>{await t({title:`Download the recovery key`,message:`This shows the MASTER key. Anyone holding it and a copy of the database can read every secret. Store it in a password manager, not on this machine.`,confirmLabel:`Show the key`,variant:`warning`})&&await u(`Download refused`,async()=>{let e=await i.mutateAsync({});await r({title:`Recovery key (fingerprint ${e.fingerprint})`,message:`Copy it now. It is not shown again until you ask for it again (audited).`,defaultValue:e.key,readOnly:!0,confirmLabel:`Done`})})},rotate:async()=>{await t({title:`Rotate the master key`,message:`The data key is re-wrapped under the configured master key; no value is re-encrypted. The previous wrap is kept until you purge it.`,confirmLabel:`Rotate`,variant:`warning`})&&await u(`Rotation refused`,async()=>{await n({title:`Rotated`,message:`New fingerprint ${(await a.mutateAsync({})).fingerprint}. Take a new recovery copy.`})})},purge:async()=>{await t({title:`Purge retired key wraps`,message:`Copies of the data key wrapped under a previous master key are deleted. After this, the previous master key opens nothing.`,confirmLabel:`Purge`,variant:`warning`})&&await u(`Purge refused`,async()=>{await o.mutateAsync({})})},reset:async()=>{await r({title:`Reset the keychain`,message:`Every stored value is archived (unreadable without the lost key) and every secret field reads "not set". A new session signing key signs everyone out. Type RESET KEYCHAIN to confirm.`,confirmLabel:`Reset`,validate:e=>e===`RESET KEYCHAIN`?null:`Type the confirmation exactly`})===`RESET KEYCHAIN`&&await u(`Reset refused`,async()=>{await s.mutateAsync({confirm:oe})})},acknowledgeReset:async()=>{await u(`Could not dismiss`,async()=>{await c.mutateAsync({})})},deleteOrphans:async e=>{await t({title:`Delete ${e.length} orphaned value${e.length===1?``:`s`}`,message:`No setting points at these values any more. The hub checks each one again before deleting; anything found in use is kept.`,confirmLabel:`Delete`,variant:`danger`})&&await u(`Delete refused`,async()=>{let t=await l.mutateAsync({refs:[...e]});t.kept.length>0&&await n({title:`Some values were kept`,message:`${t.deleted.length} deleted; ${t.kept.length} kept because they are in use again or their owner could not be read.`})})}}}t();var Q=`view`;function yt(){let[e,t]=Ie();return[e.get(Q)===`audit`?`audit`:`values`,n=>{let r=new URLSearchParams(e);n===`values`?r.delete(Q):r.set(Q,n),t(r,{replace:!0})}]}function bt(){let t=_e({}),i=Me({}),a=ke({limit:500}),o=he({}),c=ce(),u=P(),[d,f]=yt(),[p,m]=s(`all`),[h,g]=s(null),_=vt(()=>{t.refetch(),i.refetch(),a.refetch(),o.refetch()}),v=t.data?.keychain.state===`locked`,y=r(()=>(i.data??[]).filter(e=>e.usage===`orphan`).length,[i.data]),b=r(()=>t.data===void 0?[]:Qe({status:t.data,reset:o.data?.reset??null,pendingReentry:o.data?.pendingReentry.length??0,orphans:y}),[t.data,o.data,y]),x={reset:o.data?.reset??null,pendingReentry:o.data?.pendingReentry??[],busy:_.busy,onReset:()=>void _.reset(),onAcknowledgeReset:()=>void _.acknowledgeReset(),onDownload:()=>void _.download(),onRotate:()=>void _.rotate(),onShowOrphans:()=>{m(`orphan`),f(`values`)}},S=async e=>{try{g({entry:e,value:(await c.mutateAsync({ref:e.ref})).value}),i.refetch()}catch(e){await u({title:`Reveal refused`,message:Fe(e),variant:`danger`})}},C=e(()=>g(null),[]);return n(V,{embedded:!0,icon:E,title:`Secrets`,subtitle:`Passwords, tokens and keys, encrypted in the hub keychain. Values leave the hub only through an audited reveal.`,children:[l(st,{notices:b,renderAction:e=>rt(e,x),renderDetail:e=>it(e,x)}),t.data!==void 0&&l(dt,{status:t.data,busy:_.busy,onDownload:x.onDownload,onRotate:x.onRotate,onPurge:()=>void _.purge()}),n(xe,{value:d,onValueChange:e=>f(e===`audit`?`audit`:`values`),children:[n(Ee,{children:[l(z,{value:`values`,children:`Stored values`}),l(z,{value:`audit`,children:`Audit`})]}),l(B,{value:`values`,children:l(Z,{secrets:i.data,locked:v,filter:p,onFilterChange:m,onReveal:e=>void S(e),revealing:c.isPending,onDeleteOrphans:e=>void _.deleteOrphans(e),deleting:_.deleting})}),l(B,{value:`audit`,children:l(nt,{entries:a.data})})]}),l(pt,{revealed:h,onClose:C})]})}t();var xt=[[`system`]];function $(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function St(){let e=o(),t=De(),r=ye(),i=Oe(),[a,c]=s(``),[d,f]=s(``),[p,m]=s(null),h=t.data?.location??null;u(()=>{c(h===null?``:$(h.latitude)),f(h===null?``:$(h.longitude))},[h]);let g=async()=>{await e.invalidateQueries({queryKey:xt})},_=async e=>{e.preventDefault();let t=Number(a),n=Number(d);if(a.trim()===``||d.trim()===``){m(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){m(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){m(`Longitude must be between -180 and 180 decimal degrees.`);return}m(null),await r.mutateAsync({latitude:t,longitude:n}),await g()},y=async()=>{m(null),await r.mutateAsync(null),await g()},b=async()=>{m(null),await i.mutateAsync(),await g()},x=r.isPending||i.isPending||t.isLoading;return n(pe,{className:`space-y-3`,children:[n(`div`,{className:`flex items-start justify-between gap-3`,children:[n(`div`,{className:`flex items-start gap-2`,children:[l(v,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),l(`div`,{children:l(`h3`,{className:`text-sm font-medium`,children:`Site location`})})]}),h===null?l(L,{variant:`warning`,children:`Not configured`}):l(L,{variant:h.source===`operator-set`?`success`:`info`,children:h.source===`operator-set`?`Set by you`:`Derived from IP`})]}),h?.label!==void 0&&h.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:[`Detected near `,h.label,`.`]}):null,h===null&&t.data?.derivationAttemptedAt!==null?n(`p`,{className:`text-xs text-warning`,children:[`Automatic detection from the public IP did not succeed`,t.data?.derivationError!==null&&t.data?.derivationError!==void 0?`: ${t.data.derivationError}`:`.`,` `,`It is not retried on its own — enter the coordinates, or press Detect.`]}):null,n(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:_,children:[n(`label`,{className:`flex flex-col gap-1 text-xs`,children:[l(`span`,{className:`text-muted-foreground`,children:`Latitude`}),l(N,{className:`w-40`,value:a,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>c(e.target.value),"aria-label":`Latitude`})]}),n(`label`,{className:`flex flex-col gap-1 text-xs`,children:[l(`span`,{className:`text-muted-foreground`,children:`Longitude`}),l(N,{className:`w-40`,value:d,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>f(e.target.value),"aria-label":`Longitude`})]}),l(D,{type:`submit`,disabled:x,children:`Save`}),n(D,{type:`button`,variant:`ghost`,disabled:x,onClick:b,children:[l(T,{className:`h-3.5 w-3.5 mr-1`}),`Detect from IP`]}),h===null?null:l(D,{type:`button`,variant:`ghost`,disabled:x,onClick:y,children:`Clear`})]}),p===null?null:l(`p`,{className:`text-xs text-danger`,children:p}),l(`p`,{className:`text-xs text-muted-foreground`,children:`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`})]})}function Ct(){let{nodes:e,isLoading:t}=be(),r=e.find(e=>e.isHub&&e.isOnline),i=r?.addons.map(e=>e.addonId)??[];return n(V,{embedded:!0,children:[l(St,{}),t?l(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):r?i.length===0?l(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):l(Re,{nodeId:r.id,addonIds:i,level:`global`}):n(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[l(b,{className:`h-8 w-8 opacity-30`}),l(`p`,{children:`No online hub node found.`}),l(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})]})}function wt(){let{t:e}=Ne(),t=Pe(`/system/settings`,{t:e,isAdmin:!0})??{icon:b,title:e(`system.systemNav`,`System`)};return l(Le,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:`Settings`,content:l(Ct,{})},{id:`secrets`,label:`Secrets`,content:l(bt,{}),ownedParams:[`view`]},{id:`capabilities`,label:`Capabilities`,content:l(Ye,{})}]})}export{wt as SystemPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e}from"./player-overlays-DWMIy1MJ.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};
|