@camstack/addon-admin-ui 1.2.637 → 1.2.639
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/CHANGELOG.md +18 -0
- package/dist/assets/Addons-Dx78Opef.js +5 -0
- package/dist/assets/{AdminPage-_ITsYONa.js → AdminPage-2JBGQLIE.js} +1 -1
- package/dist/assets/{AdminSectionedPage-Xr_hesYw.js → AdminSectionedPage-C1pmv0FK.js} +1 -1
- package/dist/assets/{AiProfiles-YERCq98T.js → AiProfiles--KmMlsXe.js} +2 -2
- package/dist/assets/BootstrapSettingsForm-CIsZGzFZ.js +1 -0
- package/dist/assets/{Build-BmlbmwZw.js → Build-BASEhzU2.js} +3 -3
- package/dist/assets/{Calendars-Bg6sl6iG.js → Calendars-OJ569lr8.js} +1 -1
- package/dist/assets/{CameraGrids-BWF-BVdJ.js → CameraGrids-bGypmfNv.js} +1 -1
- package/dist/assets/{Cluster-BsLfi42d.js → Cluster-xmSclQJj.js} +1 -1
- package/dist/assets/{CompositionBlockEditor-C0mH1XDD.js → CompositionBlockEditor-CnUybhVt.js} +2 -2
- package/dist/assets/{CompositionEditorPage-5iKEcr6R.js → CompositionEditorPage-tNB_nWa4.js} +1 -1
- package/dist/assets/{Data-DSMQmnZv.js → Data-CkIhJKyt.js} +2 -2
- package/dist/assets/DeviceDetail-CwPSGcyX.js +2 -0
- package/dist/assets/{Devices-DQ8VksMo.js → Devices-B_JxtDSO.js} +1 -1
- package/dist/assets/{EmbedDevicePage-DOj0N5Mn.js → EmbedDevicePage-BEsiC3Ji.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-J9i3kCrj.js → EmbedPlayerPage-CJ-OAShs.js} +1 -1
- package/dist/assets/History-NfIRmbvF.js +1 -0
- package/dist/assets/Identity-DXZthsyb.js +1 -0
- package/dist/assets/InstancesTable-nABHZip5.js +1 -0
- package/dist/assets/IntegrationDetail-CIzLTh8V.js +1 -0
- package/dist/assets/{Integrations-DK9ZlSbS.js → Integrations-B2XGssEG.js} +1 -1
- package/dist/assets/Integrations-D7o4sE5f.js +1 -0
- package/dist/assets/{Library-CVdwKZBw.js → Library-CaT2azRV.js} +1 -1
- package/dist/assets/Locations-BYtDEb4x.js +3 -0
- package/dist/assets/{Logs-qlrqjJUI.js → Logs-DT2Ox42b.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-C_kXMOhj.js → MaskShapeCanvas-RlZ4d0a7.js} +1 -1
- package/dist/assets/{MotionZonesSettings-CarcYpLx.js → MotionZonesSettings-KoMlizSC.js} +1 -1
- package/dist/assets/{MyAccess-sO6455Tp.js → MyAccess-CH3uyB60.js} +1 -1
- package/dist/assets/{Network-B-NGzfdC.js → Network-D1hvb3Tq.js} +1 -1
- package/dist/assets/NodeAddonsSettingsPanel-NB4K9Q4n.js +2 -0
- package/dist/assets/{Notifications-BhHrfZKJ.js → Notifications-BVBG239c.js} +1 -1
- package/dist/assets/{Pipeline-C9_jNGPl.js → Pipeline-CKeCcVen.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-BCxCYZMd.js → PrivacyMaskSettings-aCnSRq7y.js} +1 -1
- package/dist/assets/Recordings-NNFY-1xb.js +1 -0
- package/dist/assets/{RemoteGrid-CDLuEg4n.js → RemoteGrid-CMkmGrme.js} +1 -1
- package/dist/assets/{ScanSubnetEditor-L1fLOCgh.js → ScanSubnetEditor-6KWBt_fT.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-C6ytHNuF.js → SceneMonitorEditor-CwyjL62o.js} +1 -1
- package/dist/assets/SessionsList-C_zPZPI3.js +2 -0
- package/dist/assets/{Showroom-DGD_uw5N.js → Showroom-B6QUTw-1.js} +1 -1
- package/dist/assets/StorageLocationsTable-CKU5xAJT.js +1 -0
- package/dist/assets/System-BNp1ioax.js +1 -0
- package/dist/assets/{Templates-B1e69LSo.js → Templates-CzmmWIzy.js} +1 -1
- package/dist/assets/{Terminal-BzbVWqvg.js → Terminal-B_FeRhL_.js} +5 -3
- package/dist/assets/{TrainingProviders-CF4NFH__.js → TrainingProviders-DMWfdXLj.js} +1 -1
- package/dist/assets/{Viewer-XTh3fjp9.js → Viewer-B0T6GwVF.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BezlQnHO.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DTDLz2J2.js} +1 -1
- package/dist/assets/{action-draft-DztPBE6P.js → action-draft-DSQBnDW-.js} +1 -1
- package/dist/assets/{addon-icons-context-Bb2eBZv3.js → addon-icons-context-Cm53PqtJ.js} +1 -1
- package/dist/assets/{ai-page.helpers-B1a9LT5I.js → ai-page.helpers-0Z4OXnZk.js} +1 -1
- package/dist/assets/{assignment-candidates-DtwDORE1.js → assignment-candidates-B4hBGnZ3.js} +1 -1
- package/dist/assets/{authed-media-C0rONCq5.js → authed-media-D-4z8nC1.js} +1 -1
- package/dist/assets/{board-model-DB92Pi_O.js → board-model-DEAHfd9r.js} +1 -1
- package/dist/assets/{client-mnldOm50.js → client-CPDk6pn1.js} +1 -1
- package/dist/assets/{create-composition-xpQJ_im0.js → create-composition-0LOakWST.js} +2 -2
- package/dist/assets/device-detail-CHNd95pV.js +1 -0
- package/dist/assets/{device-integration-icon-DSKbNj0K.js → device-integration-icon-D3Au9jvv.js} +1 -1
- package/dist/assets/device-picker-model-DYxGr61P.js +1 -0
- package/dist/assets/{dist-jfEaRcCl.js → dist-DyqBsIQ2.js} +1 -1
- package/dist/assets/{dist-AhzFc2N5.js → dist-XKLso7Rq.js} +1 -1
- package/dist/assets/{format-B0YD4Zes.js → format-CJg95CNX.js} +1 -1
- package/dist/assets/{hostInit-Cc2xXBkZ.js → hostInit-oo1ZyLOz.js} +1 -1
- package/dist/assets/i18n-O-Eprd0i.js +1 -0
- package/dist/assets/{icons-B5aMnrp4.js → icons-nWHUbmTy.js} +1 -1
- package/dist/assets/index-CvjoMaRn.js +4 -0
- package/dist/assets/index-DfRr-2Rp.css +2 -0
- package/dist/assets/{linked-devices-model-DMdglvhv.js → linked-devices-model-DGicNR1u.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-aa99f5e1.js → mf-entry-bootstrap-0-9d1ca313.js} +2 -2
- package/dist/assets/mount-DYxGr61P.js +1 -0
- package/dist/assets/{notification-rule-status-DfiT5MFH.js → notification-rule-status-BPOiB8zG.js} +1 -1
- package/dist/assets/{player-overlays-BZByYYB8.js → player-overlays-07i-D-5F.js} +1 -1
- package/dist/assets/remoteEntry-DsRIWyYU.js +1 -0
- package/dist/assets/src-BvCFog8l.js +169 -0
- package/dist/assets/{sso-popup-CcJP5NlL.js → sso-popup-DiEJ5hpi.js} +1 -1
- package/dist/assets/step-inspector-model-3TP_ESk4.js +1 -0
- package/dist/assets/{use-scenes-feed-3gS-l6TV.js → use-scenes-feed-B-tjAlpJ.js} +1 -1
- package/dist/assets/{use-stationary-objects-6FuPeLm0.js → use-stationary-objects--JCnM10a.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-Ds-ZvGNc.js → useAdminDeviceRemoval-B94_56fb.js} +1 -1
- package/dist/assets/useEventInvalidation-DYxGr61P.js +1 -0
- package/dist/assets/{useNodeUrlSelection-DAoFJ0Oq.js → useNodeUrlSelection-Ce8teHJ6.js} +1 -1
- package/dist/assets/{useTemplateSave-DZcYOuHu.js → useTemplateSave-yRpPJOJG.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-ZzcWUaNn.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-4dsdFHTN.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +8 -7
- package/package.json +2 -2
- package/dist/assets/Addons-BlKy1u2u.js +0 -5
- package/dist/assets/Authentication-CWHj8Czl.js +0 -1
- package/dist/assets/DeviceDetail-kBF3z5wo.js +0 -2
- package/dist/assets/History-BFkKRlW8.js +0 -1
- package/dist/assets/Identity-5sx8SWa4.js +0 -1
- package/dist/assets/InstancesTable-BagVOERb.js +0 -1
- package/dist/assets/IntegrationDetail-ByG-grc8.js +0 -1
- package/dist/assets/Integrations-BReJ0gq9.js +0 -1
- package/dist/assets/Locations-CDUPDAGA.js +0 -3
- package/dist/assets/NodeAddonsSettingsPanel-BtSyXQ4v.js +0 -1
- package/dist/assets/Recordings-DTwvvqkz.js +0 -1
- package/dist/assets/SessionsList-WhsG7RxJ.js +0 -2
- package/dist/assets/StorageLocationsTable-CV0MMZ6R.js +0 -1
- package/dist/assets/System-CUM8c-ad.js +0 -1
- package/dist/assets/device-detail-rao8xQIi.js +0 -1
- package/dist/assets/device-picker-model-CLxwtH6P.js +0 -1
- package/dist/assets/i18n-ByFr51sS.js +0 -1
- package/dist/assets/index-CcY1r6e1.css +0 -2
- package/dist/assets/index-D5GcZJtC.js +0 -4
- package/dist/assets/mount-CLxwtH6P.js +0 -1
- package/dist/assets/remoteEntry-BFXSwA_z.js +0 -1
- package/dist/assets/src-DKRp5NPI.js +0 -169
- package/dist/assets/step-inspector-model-DrTK6qqE.js +0 -1
- package/dist/assets/useEventInvalidation-CLxwtH6P.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,J as t,K as n,R as r,S as i,V as a,W as o,Y as s,et as c,i as l,j as u,o as d,p as f,t as p}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{gt as m}from"./player-overlays-BZByYYB8.js";import{Ls as h,Rs as g}from"./client-mnldOm50.js";import{Oa as _,Xi as v,Zi as y,fo as ee,ji as b,jt as te,sa as ne}from"./src-DKRp5NPI.js";import{t as re}from"./useTranslation-BJr-n0es.js";import{F as x,N as ie,P as ae,lt as S}from"./index-D5GcZJtC.js";c();var C=u(function({addonId:e,schema:s,serverValues:c,onImmediateSave:l,onStateChange:u,onAction:d,disabled:f},p){let m=x({schema:s,serverValues:c,onImmediateSave:r(t=>l(e,t),[e,l]),onDeferredSave:r(()=>{},[])});o(p,()=>({flush:()=>{let e={};for(let t of m.pendingKeys)e[t]=m.values[t];return m.handleDiscard(m.pendingKeys),e},discard:()=>m.resetAll()}),[m]);let h=m.pendingKeys,g=h.join(`|`),_=n(()=>h.map(e=>`${e}=${JSON.stringify(m.values[e])}`).join(`,`),[h,m.values]),v=t(u);a(()=>{v.current=u},[u]),a(()=>{let t={};for(let e of h)t[e]=m.values[e];v.current({addonId:e,pendingKeys:h,pendingValues:t})},[e,g,_]);let y=n(()=>{if(d)return(t,n,r)=>d(e,t,n,r)},[e,d]);return i(S,{schema:s,values:m.values,onChange:m.handleChange,disabled:f,onAction:y})});function w(e){return`perNode`in e&&e.perNode===!0}function T(e,t){if(e.type===`group`){let n=E(e.fields,t);return n.length>0?{...e,fields:n}:null}if(e.type===`sub-tabs`){let n=e.tabs.map(e=>({...e,fields:E(e.fields,t)})).filter(e=>e.fields.length>0);return n.length>0?{...e,tabs:n}:null}return w(e)===(t===`perNode`)?e:null}function E(e,t){let n=[];for(let r of e){let e=T(r,t);e!==null&&n.push(e)}return n}function oe(e,t){let n=[];for(let r of e.sections){let e=E(r.fields,t);e.length!==0&&n.push({...r,fields:e})}return{...e,sections:n}}function D(e,t){return t===void 0?!0:t===`perNode`?e===`node`:e!==`node`}function se(e){let t=e.allowSectionIds?new Set(e.allowSectionIds):null,n=e.omitSectionIds?new Set(e.omitSectionIds):null,r=new Set,i=[];for(let a of e.declarations){if(!D(a.scope,e.fieldScope)||e.capability!==void 0&&a.cap!==e.capability)continue;let o=a.sectionIds.filter(e=>r.has(e)||(r.add(e),t!==null&&!t.has(e))?!1:n===null||!n.has(e));o.length>0&&i.push({cap:a.cap,scope:a.scope,sectionIds:o})}return i}function ce(e){let t=[],n=new Map,r={};for(let{declaration:i,form:a}of e){let e=new Set(i.sectionIds),o=a.sections.filter(t=>e.has(t.id));t.push(...o);for(let e of a.tabs??[])n.has(e.id)||n.set(e.id,e);for(let e of g({sections:o}).keys()){let t=r[e]??[];t.push({cap:i.cap,scope:i.scope}),r[e]=t}}return{form:{...n.size>0?{tabs:[...n.values()]}:{},sections:t},keyTargets:r}}function le(e,t){let n=new Map,r=[];for(let[i,a]of Object.entries(e)){let e=t[i];if(e===void 0||e.length===0){r.push(i);continue}for(let t of e){let e=`${t.cap}\u0000${t.scope}`,r=n.get(e)??{target:t,patch:{}};r.patch[i]=a,n.set(e,r)}}return{groups:[...n.values()].map(e=>({...e.target,patch:e.patch})),unowned:r}}function ue(e,t){let n=e??`general`;return t?.[n]??n}function O(e){return typeof e!=`object`||!e||!(`key`in e)?null:typeof e.key==`string`?e.key:null}function k(e,t){let n=t.fieldKeys===void 0?null:new Set(t.fieldKeys),r=[];for(let i of e){let e=n===null?i.fields:i.fields.filter(e=>{let t=O(e);return t!==null&&n.has(t)});e.length!==0&&r.push({...i,fields:e,...t.tabAliases===void 0?{}:{tab:ue(i.tab,t.tabAliases)},...t.hideSectionChrome===!0?{title:``,description:void 0}:{}})}return r}c();function A(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>A(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function j(e,t){return{...e,fields:e.fields.map(e=>A(e,t))}}function de(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>j(e,t))},values:t}}function M({nodeId:a,addonIds:o,level:c,deviceId:u,capability:g,sectionIds:b,omitSectionIds:x,fieldKeys:S,hideSectionChrome:C,tabAliases:w,tabLabelOverrides:T,sectionTab:E,fieldScope:D,emptyMessage:O,extraTabs:A,schemaTabExtras:j,title:M,description:N,selfTabbed:pe,activeTab:me,onActiveTabChange:he}){let{t:P}=re(),F=d(),I=m().trpcClient,ge=y(),_e=v(),ve=ee(),ye=_(),L=pe===!0||!!(A&&A.length>0),[be,xe]=s(null);if(c===`device`&&!u)throw Error(`NodeAddonsSettingsPanel: deviceId is required when level === "device"`);let R=a??`hub`,z=l({queries:o.map(e=>({queryKey:[[`addonSettings`,c===`global`?`listScopedSettings`:`getDeviceSettings`],{addonId:e,nodeId:R,deviceId:u??null,cap:g??null,scope:D??null,sections:[b??null,x??null]}],queryFn:async()=>{if(c===`global`){let t=await I.addonSettings.listScopedSettings.query({addonId:e,nodeId:R});if(t===null)return{addonId:e,result:null,keyTargets:{}};let n=se({declarations:t,...D===void 0?{}:{fieldScope:D},...g===void 0?{}:{capability:g},...b===void 0?{}:{allowSectionIds:b},...x===void 0?{}:{omitSectionIds:x}}),r=await Promise.all(n.map(async t=>{let n=await I.addonSettings.getScopedSettings.query({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:R}:{}});return n===null?null:{declaration:t,form:n}})),i=r.filter(e=>e!==null);if(i.length!==r.length)return{addonId:e,result:null,keyTargets:{}};let a=ce(i);return{addonId:e,result:a.form,keyTargets:a.keyTargets}}let t=await I.addonSettings.getDeviceSettings.query({addonId:e,deviceId:u,nodeId:R});return{addonId:e,result:t!==null&&D!==void 0?oe(t,D):t,keyTargets:{}}},placeholderData:f}))}),Se=z.some(e=>e.isLoading),B=z.map(e=>{if(!e.data)return`-`;if(e.data.result===null)return`${e.data.addonId}:n`;let t=[];for(let n of e.data.result.sections){t.push(`s:${n.id}:${n.tab??`general`}`);for(let e of n.fields){if(!(`key`in e))continue;let n=`options`in e&&Array.isArray(e.options)?e.options.map(e=>e.value).join(`,`):``,r=e.value,i=r===void 0?``:typeof r==`string`?r:JSON.stringify(r);t.push(`f:${e.key}:${n}:${i}`)}}return`${e.data.addonId}:${t.join(`|`)}`}).join(`||`),V=n(()=>{let e=new Set;for(let t of z){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(ue(t.tab,w))}return[...e]},[w,B+`::`+z.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),H=n(()=>new Map((A??[]).map(e=>[e.id,e])),[A]),U=n(()=>{if(!L)return[];let e=[...new Set([...V,...(A??[]).map(e=>e.id),...(j??[]).map(e=>e.tabId)])],t=e=>{let t=H.get(e);if(t?.order!==void 0)return t.order;let n=h[e];return n?n.order:50};return e.toSorted((e,n)=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})},[L,V,A,H,j]),Ce=n(()=>{let e=new Map,t=e=>h[e]?.label??e.charAt(0).toUpperCase()+e.slice(1);for(let n of V)e.set(n,t(n));for(let n of j??[])e.has(n.tabId)||e.set(n.tabId,t(n.tabId));for(let t of A??[])e.set(t.id,t.label);for(let[t,n]of Object.entries(T??{}))e.set(t,n);return e},[V,A,j,T]),W=me===void 0?be:me,G=L?W&&U.includes(W)?W:U[0]??null:null,we=e=>{xe(e),he?.(e)},Te=G!==null&&H.has(G),K=L?G&&!Te?G:void 0:E,{data:Ee}=ne(void 0),De=n(()=>{let e=new Map;for(let t of Ee??[]){let n=t.manifest?.id;if(!n)continue;let r=t.manifest?.name??t.manifest?.packageDisplayName??n;e.set(n,r)}return e},[Ee]),q=t(new Map),J=n(()=>{let e=b?new Set(b):null,t=x?new Set(x):null,n=n=>!(e!==null&&!e.has(n)||t!==null&&t.has(n)),r=[];for(let e of z){if(!e.data)continue;e.data.result!==null&&q.current.set(e.data.addonId,{result:e.data.result,keyTargets:e.data.keyTargets});let t=q.current.get(e.data.addonId)??null;if(t===null)continue;let{result:i,keyTargets:a}=t,{schema:o,values:s}=de(i),c={...S===void 0?{}:{fieldKeys:S},...C===void 0?{}:{hideSectionChrome:C},...w===void 0?{}:{tabAliases:w}},l=k(o.sections.filter(e=>n(e.id)),c);if(l.length===0)continue;let u={...i,sections:k(i.sections.filter(e=>n(e.id)),c)},d={...o,sections:l};r.push({addonId:e.data.addonId,schemaWithValues:u,schema:d,serverValues:s,keyTargets:a})}return r},[B,b,x,S,C,w]),Oe=n(()=>z.flatMap(e=>c===`global`&&e.data!==void 0&&e.data.result===null&&!q.current.has(e.data.addonId)?[e.data.addonId]:[]),[B,c]),[Y,ke]=s(new Map),Ae=r(e=>{ke(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),X=t(new Map),je=r(e=>t=>{t?X.current.set(e,t):X.current.delete(e)},[]),Z=r(async(e,t)=>{if(c!==`global`){await _e.mutateAsync({addonId:e,deviceId:u,nodeId:R,patch:t});return}let{groups:n,unowned:r}=le(t,J.find(t=>t.addonId===e)?.keyTargets??{});if(r.length>0)throw Error(`${e}: no scoped setting declares ${r.join(`, `)}`);let i=(await Promise.allSettled(n.map(t=>ge.mutateAsync({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:R}:{},patch:t.patch})))).flatMap((e,t)=>{let r=n[t];if(e.status!==`rejected`||r===void 0)return[];let i=e.reason instanceof Error?e.reason.message:String(e.reason);return[`${r.cap}/${r.scope}: ${i}`]});if(i.length>0)throw F.invalidateQueries({queryKey:[[`addonSettings`]]}),Error(`${e}: not saved to ${i.join(`; `)}`)},[c,J,ge,_e,F,R,u]),Me=r(async(e,t)=>{await Z(e,t),F.invalidateQueries({queryKey:[[`addonSettings`]]})},[Z,F]),Ne=r(async(e,t,n,r)=>{let i=R;try{switch(t){case`reprobe-hwaccel`:await ve.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await ye.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await I.addons.custom.mutate({addonId:e,action:t,input:r});return F.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[ve,ye,R,F,I]),Pe=r((e,t)=>{Me(e,t)},[Me]),Q=p({mutationFn:async()=>{let e=[];for(let t of J){let n=Y.get(t.addonId);!n||n.pendingKeys.length===0||e.push({addonId:t.addonId,patch:n.pendingValues})}return e.length===0?{saved:[]}:{saved:await Promise.all(e.map(async({addonId:e,patch:t})=>(await Z(e,t),e)))}},onSuccess:({saved:e})=>{for(let t of e)X.current.get(t)?.discard();F.invalidateQueries({queryKey:[[`addonSettings`]]})}}),Fe=r(()=>{for(let e of X.current.values())e.discard()},[]),Ie=n(()=>{let e=0;for(let t of J){let n=Y.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[J,Y]),Le=n(()=>{let e=new Map;for(let t of J){let n=Y.get(t.addonId);if(!n||n.pendingKeys.length===0)continue;let r=new Set(n.pendingKeys);for(let n of t.schema.sections){let t=n.tab??`general`;for(let i of n.fields)`key`in i&&r.has(i.key)&&e.set(t,(e.get(t)??0)+1)}}return e},[J,Y]);if(Se)return i(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let $=G&&Te?H.get(G):void 0,Re=Oe.length>0?i(`div`,{className:`space-y-1 text-[11px] text-foreground-subtle`,role:`status`,children:Oe.map(e=>i(`div`,{children:P(`settings.nodeAddonsSettingsPanel.addonUnavailable`,`{{name}} not available.`,{name:De.get(e)??e})},e))}):null;if(!L&&J.length===0)return Re===null?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:O??P(`settings.nodeAddonsSettingsPanel.noAddonsIn`,{scope:o.length>0?`[${o.join(`, `)}]`:P(`settings.nodeAddonsSettingsPanel.theCurrentSelection`,`the current selection`),level:c})}):Re;let ze=Q.isPending;return e(`div`,{className:`space-y-4`,children:[(M||N)&&e(`div`,{className:`border-b border-border pb-2`,children:[M&&i(`h2`,{className:`text-sm font-semibold text-foreground`,children:M}),N&&i(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:N})]}),J.length>0||L?Re:null,L&&i(ie,{tabs:U.map(e=>({id:e,label:Ce.get(e)??e})),activeId:G,onChange:we,pendingByTab:Le}),Q.isError&&e(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[P(`settings.nodeAddonsSettingsPanel.saveFailed`,`Save failed:`),` `,String(Q.error?.message??Q.error)]}),i(te,{tabKey:$?`extra:${G??``}`:`tab:${G??``}`,children:$?$.content:(()=>{let t=K?J.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===K).length,0):0,n=!!K&&t<=1,r=J.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>K?(e.tab??`general`)===K:!0).map(e=>n?{...e,title:``,description:void 0}:e)}})).filter(e=>e.renderedWithValues.sections.length>0).toSorted((e,t)=>{let n=e=>{let t=1/0;for(let n of e)typeof n.order==`number`&&n.order<t&&(t=n.order);return t},r=n(e.renderedWithValues.sections),i=n(t.renderedWithValues.sections);return r===i?0:r-i}),a=(j??[]).filter(e=>e.tabId===K),o=a.filter(e=>(e.placement??`before`)===`before`),s=a.filter(e=>e.placement===`after`);return r.length===0&&a.length===0?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:O??P(`settings.nodeAddonsSettingsPanel.nothingToConfigureHereFor`,`Nothing to configure here for this node.`)}):e(`div`,{className:`space-y-6`,children:[o.map((e,t)=>i(`div`,{children:e.content},`extra-before-${t}`)),r.length>0&&i(fe,{entries:r,paneStates:Y,displayNames:De,disabled:ze,setPaneRef:je,onPaneStateChange:Ae,onImmediateSave:Pe,onAction:Ne,inline:L||!!E}),s.map((e,t)=>i(`div`,{children:e.content},`extra-after-${t}`))]})})()}),!Se&&i(ae,{pendingCount:Ie,onSave:()=>Q.mutate(),onDiscard:Fe,saving:ze})]})}function fe({entries:t,paneStates:r,displayNames:o,disabled:c,setPaneRef:l,onPaneStateChange:u,onImmediateSave:d,onAction:f,inline:p}){let m=n(()=>[...t].toSorted((e,t)=>{let n=o.get(e.addonId)??e.addonId,r=o.get(t.addonId)??t.addonId;return n.localeCompare(r)}),[t,o]),[h,g]=s(m[0]?.addonId??``);a(()=>{m.length!==0&&(m.find(e=>e.addonId===h)||g(m[0].addonId))},[m,h]);let _=m.find(e=>e.addonId===h)??m[0];if(!_)return null;let v=n(()=>f?(e,t,n,r)=>f(e,t,n,r):void 0,[f]),y=e=>i(C,{ref:l(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:d,onStateChange:u,onAction:v,disabled:c},e.addonId);return m.length===1||p?i(`div`,{className:`flex flex-col gap-4`,children:m.map(y)}):e(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:m.map(t=>{let n=o.get(t.addonId)??t.addonId,a=t.addonId===_.addonId,s=(r.get(t.addonId)?.pendingKeys.length??0)>0;return e(b,{variant:`unstyled`,type:`button`,onClick:()=>g(t.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[n,s&&i(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},t.addonId)})}),i(`div`,{className:`space-y-2`,children:m.map(e=>i(`div`,{style:e.addonId===_.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{k as n,M as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o,o as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Di as l,Ki as u,Kt as d,Sa as f,St as p,Tr as m,Vr as h,Y as g,Yt as _,ct as v,ei as y,gt as b,li as x,mi as S,ut as C,xa as w}from"./player-overlays-BZByYYB8.js";import{Js as T}from"./client-mnldOm50.js";import{n as E,t as D}from"./scissors-BgY-d4kD.js";import{Au as O,Br as k,Cu as A,Du as j,Eu as M,Hr as N,Ir as P,Ko as F,Ll as I,Lr as L,Nl as ee,Of as te,Ou as ne,Qc as re,Rr as ie,Tu as ae,Un as R,Vr as oe,Wn as se,Xr as z,Yi as B,Zi as V,Zr as ce,ad as le,af as H,cd as ue,dd as de,el as fe,fd as pe,hi as me,id as he,il as ge,jf as U,ji as W,ku as _e,ld as ve,nd as ye,od as be,ol as xe,rd as Se,sd as Ce,td as we,ud as Te,wu as Ee}from"./src-DKRp5NPI.js";import{t as G}from"./i18n-ByFr51sS.js";import{t as K}from"./useTranslation-BJr-n0es.js";import{Br as De,D as Oe,x as ke}from"./index-D5GcZJtC.js";import{t as Ae}from"./AdminSectionedPage-Xr_hesYw.js";import{n as je}from"./authed-media-C0rONCq5.js";import{t as q}from"./format-size-DIxKXxtj.js";import{n as Me,r as Ne,t as Pe}from"./StorageLocationsTable-CV0MMZ6R.js";o();var Fe=[{value:`all`,labelKey:`common.all`},{value:`recording`,labelKey:`recordings.activitySection.domainRecordings`},{value:`events`,labelKey:`common.events`}],Ie={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},Le={columnKey:`at`,dir:`desc`};function Re(e){return new Date(e).toLocaleString()}function ze(){let{t:n,i18n:i}=K(),[o,s]=a(`all`),{data:l,isLoading:u,isError:f}=ae({},{refetchOnWindowFocus:!1}),{data:p,isLoading:h,isError:g}=ge({},{refetchOnWindowFocus:!1}),{data:_}=F({isCamera:!0,projection:`slim`}),v=t(()=>{let e=new Map;for(let t of _??[])e.set(t.id,t.name);return e},[_]),y=t(()=>{let e=[...l??[],...p??[]];return(o===`all`?e:e.filter(e=>e.domain===o)).toSorted((e,t)=>t.at-e.at)},[l,p,o]),b=t(()=>{let e=[];return f&&o!==`events`&&e.push(n(`recordings.activitySection.domainRecordings`)),g&&o!==`recording`&&e.push(n(`common.events`)),e},[f,g,o,n]),x=t(()=>new Intl.ListFormat(i.language,{type:`conjunction`}).format(b),[b,i.language]),S=t(()=>[{key:`at`,header:n(`recordings.activitySection.when`,`When`),nowrap:!0,sortValue:e=>e.at,render:e=>r(`span`,{className:`text-foreground-subtle tabular-nums`,children:Re(e.at)})},{key:`domain`,header:n(`recordings.activitySection.domain`,`Domain`),sortValue:e=>e.domain,render:e=>r(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${Ie[e.domain]}`,children:e.domain})},{key:`op`,header:n(`recordings.activitySection.operation`,`Operation`),sortValue:e=>e.op,render:e=>r(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:n(`recordings.activitySection.reason`,`Reason`),sortValue:e=>e.reason,render:e=>r(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:n(`recordings.activitySection.camera`,`Camera`),sortValue:e=>e.deviceId===null?`cluster`:v.get(e.deviceId)??`#${String(e.deviceId)}`,render:e=>e.deviceId===null?r(`span`,{className:`text-foreground-subtle`,children:n(`common.cluster`)}):r(`span`,{className:`text-foreground`,children:v.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:n(`recordings.activitySection.items`,`Items`),align:`right`,nowrap:!0,sortValue:e=>e.itemsAffected,render:e=>r(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:n(`recordings.activitySection.reclaimed`,`Reclaimed`),align:`right`,nowrap:!0,sortValue:e=>e.bytesReclaimed,render:e=>r(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?q(e.bytesReclaimed):`—`})}],[v,n]),C=u||h;return e(`div`,{className:`flex flex-col gap-4`,children:[r(`div`,{className:`flex items-center gap-1`,children:Fe.map(e=>r(W,{variant:`unstyled`,onClick:()=>s(e.value),className:`rounded px-2 py-1 text-xs font-medium ${o===e.value?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-muted`}`,children:n(e.labelKey)},e.value))}),C&&y.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(m,{className:`h-4 w-4 animate-spin`}),n(`recordings.activitySection.loadingActivity`,`Loading activity…`)]}):y.length===0?b.length>0?r(z,{icon:d,title:n(`recordings.activitySection.activityCouldNotBeRead`,`Activity could not be read`),description:n(`recordings.activitySection.theOpsLogDidNot`,`The {{value1}} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`,{value1:x})}):r(z,{icon:w,title:n(`recordings.activitySection.noActivityYet`,`No activity yet`),description:n(`recordings.activitySection.pruneDeleteAndRescanOperations`,`Prune, delete and rescan operations across recordings and events show up here.`)}):e(c,{children:[b.length>0&&e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[r(d,{className:`h-3 w-3 shrink-0`}),n(`recordings.activitySection.domainsMissing`,{count:b.length,names:x})]}),r(R,{columns:S,rows:y,rowKey:e=>e.id,minWidthPx:720,maxBodyHeight:se,defaultSort:Le})]})]})}o();function Be(){let{t:n}=K(),i=F({isCamera:!0,projection:`slim`}),o=t(()=>(i.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[i.data]),[s,c]=a(null),l=s??o[0]?.id??null;return!i.isLoading&&o.length===0?r(z,{icon:u,title:n(`recordings.cameraRecordingSettingsSection.noCameras`,`No cameras`),description:n(`recordings.cameraRecordingSettingsSection.addACameraFirst`,`Add a camera first.`)}):e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:n(`recordings.cameraRecordingSettingsSection.perCameraRecordingRetention`,`Per-camera recording & retention`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`recordings.cameraRecordingSettingsSection.recordingModeScheduleBandsAnd`,`Recording mode, schedule bands and the retention policy for one camera — the same controls as the camera's own Recording tab. Retention is one policy over footage and analytics; per-camera event deletion lives on the Events tab.`)})]}),e(`div`,{className:`flex items-center gap-2`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:n(`recordings.cameraRecordingSettingsSection.camera`,`Camera`)}),r(C,{wrapperClassName:`inline-block w-auto`,value:l??``,onChange:e=>c(Number(e.target.value)),children:o.map(e=>r(`option`,{value:e.id,children:e.name},e.id))})]}),l!==null&&r(me,{deviceId:l,children:r(Oe,{deviceId:l,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},l)]})}function Ve({types:e}){return r(Pe,{kinds:e})}o();var He=`pipeline-analytics`,Ue=`pipeline-analytics`;function We(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 Ge(){let{t:n}=K(),i=s(),{nodes:a}=te(),{data:o,isLoading:c}=B({addonId:He,cap:Ue,scope:`cluster`}),l=We(o),u=V({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getScopedSettings`]]})}}),d=t(()=>{let e=a.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,l,...e])].filter(Boolean)},[a,l]);return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:n(`pipeline.clusterEventsTab.postProcessingNode`,`Post-processing node`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterEventsTab.theSingleNodeThatRuns`,`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`)}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[c?r(m,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(C,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:He,cap:Ue,scope:`cluster`,patch:{postProcessingNodeId:e.target.value}})},disabled:u.isPending,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterEventsTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(m,{className:`h-4 w-4 animate-spin text-primary`})]})]}),e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:n(`pipeline.clusterEventsTab.eventsFolder`,`Events folder`)}),r(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterEventsTab.whereEventCropsFullFrames`,`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`)}),r(Ve,{types:[`eventMedia`]})]})]})}o();var Ke=[[`pipelineAnalytics`]],qe=1440*60*1e3;function Je(e,t){return t.get(e)??G.t(`recordings.eventsManagementSection.removedCamera`,{id:String(e)})}var Ye=[{days:1},{days:7},{days:30},{days:90}];function Xe(){let{t:i}=K(),o=s(),c=v(),[l,u]=a(30),[d,f]=a(null),{data:p,isLoading:h}=fe({},{refetchOnWindowFocus:!1}),{data:y}=F({isCamera:!0,projection:`slim`}),b=t(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),x=n(()=>{o.invalidateQueries({queryKey:Ke})},[o]),w=xe({onSuccess:x}),T=re(),E=n(async()=>{await c({title:i(`recordings.eventsManagementSection.pruneTitle`,{count:l}),message:i(`recordings.eventsManagementSection.permanentlyDeletesEveryEventMotion`,`Permanently deletes every event (motion / object / audio) older than the cutoff across all cameras, and their media. This cannot be undone.`),confirmLabel:i(`recordings.eventsManagementSection.pruneEvents`,`Prune events`),variant:`danger`})&&w.mutate({olderThanMs:Date.now()-l*qe,reason:`retention`})},[c,w,l,i]),O=n(async e=>{let t=Je(e.deviceId,b);if(await c({title:i(`recordings.eventsManagementSection.deleteAllEventsFor`,`Delete all events for {{label}}?`,{label:t}),message:i(`recordings.eventsManagementSection.deleteRowsMessage`,{count:e.rows,size:q(e.bytes)}),confirmLabel:i(`recordings.eventsManagementSection.deleteEvents`,`Delete events`),variant:`danger`})){f(null);try{let n=await T.mutateAsync({deviceId:e.deviceId});x();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){f(`0 events deleted for ${t}. Media still listed (${q(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}f(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){f(e instanceof Error?e.message:String(e))}}},[c,T,b,x,i]),k=t(()=>[{key:`camera`,header:i(`recordings.eventsManagementSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:Je(e.deviceId,b)})},{key:`rows`,header:i(`recordings.eventsManagementSection.events`,`Events`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:i(`recordings.eventsManagementSection.media`,`Media`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:q(e.bytes)})},{key:`actions`,header:``,align:`right`,render:t=>e(W,{variant:`unstyled`,onClick:()=>{O(t)},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:i(`recordings.eventsManagementSection.deleteAllEventsForThis`,`Delete all events for this camera`),children:[r(_,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})}],[b,O,T.isPending,i]);return h&&!p?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(m,{className:`h-4 w-4 animate-spin`}),i(`recordings.eventsManagementSection.loadingEventStoreFootprint`,`Loading event-store footprint…`)]}):p?e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[r(g,{label:i(`recordings.eventsManagementSection.totalEvents`,`Total events`),icon:r(S,{className:`h-3 w-3`}),footer:`across ${String(p.devices.length)} camera${p.devices.length===1?``:`s`}`,children:p.totalRows.toLocaleString()}),r(g,{label:i(`recordings.eventsManagementSection.eventMediaOnDisk`,`Event media on disk`),children:q(p.totalBytes)})]}),e(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[r(`span`,{className:`text-foreground-subtle`,children:i(`recordings.eventsManagementSection.pruneEventsOlderThan`,`Prune events older than`)}),r(C,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>u(Number(e.target.value)),children:Ye.map(e=>r(`option`,{value:e.days,children:i(`recordings.eventsManagementSection.ageDays`,{count:e.days})},e.days))}),e(W,{variant:`unstyled`,onClick:()=>{E()},disabled:w.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:[w.isPending?r(m,{className:`h-3 w-3 animate-spin`}):r(D,{className:`h-3 w-3`}),i(`recordings.eventsManagementSection.pruneNow`,`Prune now`)]})]}),p.devices.length===0?r(z,{icon:S,title:i(`recordings.eventsManagementSection.noStoredEvents`,`No stored events`),description:i(`recordings.eventsManagementSection.noCameraHasPersistedEvents`,`No camera has persisted events yet.`)}):r(R,{columns:k,rows:[...p.devices],rowKey:e=>e.deviceId,minWidthPx:480}),d===null?null:r(`p`,{className:d.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:d})]}):r(z,{icon:S,title:i(`recordings.eventsManagementSection.noEventData`,`No event data`),description:i(`recordings.eventsManagementSection.pipelineAnalyticsHasNotReported`,`Pipeline analytics has not reported any event-store footprint yet.`)})}function Ze(){let{t}=K();return e(`div`,{className:`flex flex-col gap-8`,children:[e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.eventsSection.eventStore`,`Event store`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.eventsSection.whatTheDurableEventStore`,`What the durable event store occupies, per camera, with fleet-wide prune-by-age and delete-all-events.`)}),r(`div`,{className:`mt-3`,children:r(Xe,{})})]}),e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.eventsSection.postProcessingNodeFolders`,`Post-processing node & folders`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.eventsSection.theSingleNodeThatWrites`,`The single node that writes event crops, and the storage location they land in.`)}),r(`div`,{className:`mt-3`,children:r(Ge,{})})]})]})}function Qe(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 $e(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function et(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`${$e(e)} · ${o}`}function tt(e,t){let n=e-t;if(n<=0)return G.t(`helpers.exportFormat.expired`);let r=Math.floor(n/6e4);if(r<60)return G.t(`helpers.exportFormat.inMinutes`,{n:String(r)});let i=Math.floor(r/60);return i<24?G.t(`helpers.exportFormat.inHours`,{n:String(i)}):G.t(`helpers.exportFormat.inDays`,{n:String(Math.floor(i/24))})}function nt(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})}o();var rt=[`high`,`mid`,`low`],it=[{value:1,labelKey:`recordings.newExportModal.speedRealTime`},{value:2,labelKey:null},{value:4,labelKey:null},{value:8,labelKey:null},{value:16,labelKey:null}],at=10080*60*1e3;function ot(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 st({onClose:n,onCreated:i}){let{t:o}=K(),s=F({isCamera:!0,projection:`slim`}),c=t(()=>(s.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[s.data]),[l,u]=a(``),[d,p]=a(`high`),[m,h]=a(ot(60)),[g,_]=a(ot(0)),[v,b]=a(1),[x,S]=a(!0),[w,T]=a(``),[E,D]=a(null),O=l===``?c[0]?.id??null:l,A=new Date(m).getTime(),j=new Date(g).getTime(),M=Number.isFinite(A)&&Number.isFinite(j)&&A<j,I=ne({onSuccess:()=>{i(),n()},onError:e=>D(e instanceof Error?e.message:String(e))});return r(P,{open:!0,onOpenChange:e=>!e&&n(),children:e(ie,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(oe,{children:e(N,{className:`flex items-center gap-1.5`,children:[r(y,{className:`h-3.5 w-3.5`}),o(`recordings.newExportModal.newExport`,`New export`)]})}),e(L,{className:`space-y-3`,children:[e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.camera`,`Camera`)}),r(C,{value:O??``,onChange:e=>u(Number(e.target.value)),className:`w-full`,children:c.map(e=>r(`option`,{value:e.id,children:e.name},e.id))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.profile`,`Profile`)}),r(C,{value:d,onChange:e=>p(e.target.value),className:`w-full`,children:rt.map(e=>r(`option`,{value:e,children:e},e))})]})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.from`,`From`)}),r(H,{type:`datetime-local`,value:m,onChange:e=>h(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.to`,`To`)}),r(H,{type:`datetime-local`,value:g,onChange:e=>_(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.speed`,`Speed`)}),r(C,{value:v,onChange:e=>b(Number(e.target.value)),className:`w-full`,children:it.map(e=>r(`option`,{value:e.value,children:e.labelKey===null?`${e.value}×`:o(e.labelKey)},e.value))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.titleOptional`,`Title (optional)`)}),r(H,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:o(`recordings.newExportModal.eGCourierAtThe`,`e.g. courier at the gate`),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle`})]})]}),e(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[r(f,{checked:x,disabled:v!==1,onChange:e=>S(e.target.checked),className:`accent-primary`}),o(v===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!M&&r(`p`,{className:`text-[11px] text-danger`,children:o(`recordings.newExportModal.fromMustBeBeforeTo`,`"From" must be before "To".`)}),E&&r(`p`,{className:`text-[11px] text-danger`,children:E})]}),e(k,{children:[r(W,{variant:`outline`,size:`sm`,onClick:n,children:o(`common.cancel`,`Cancel`)}),r(W,{size:`sm`,onClick:()=>{if(O===null||!M)return;D(null);let e=w.trim();I.mutate({deviceId:O,profile:d,fromMs:A,toMs:j,options:{includeAudio:x,maxLifeMs:at,deleteAfterDownload:!1,...v===1?{}:{speed:v},...e.length>0?{title:e}:{}}})},disabled:O===null||!M||I.isPending,children:I.isPending?o(`recordings.newExportModal.queuing`,`Queuing…`):o(`recordings.newExportModal.createExport`,`Create export`)})]})]})})}o();var ct=[[`recordingExport`]],lt={queued:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.queued`},rendering:{cls:`bg-primary/10 text-primary`,labelKey:`recordings.exportsSection.rendering`,spin:!0},ready:{cls:`bg-success/10 text-success`,labelKey:`recordings.exportsSection.ready`},failed:{cls:`bg-danger/10 text-danger`,labelKey:`recordings.exportsSection.failed`},expired:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.expired`},deleted:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.deleted`}};function ut(){let{data:e,isLoading:n}=O({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:r}=U(T.RecordingExportProgress,e=>e.exportId),{map:i}=U(T.RecordingExportCompleted,e=>e.exportId),{map:a}=U(T.RecordingExportFailed,e=>e.exportId);return{rows:t(()=>nt(e??[],r,i,a),[e,r,i,a]),isLoading:n}}function dt(e){let[t,n]=a(()=>Date.now());return i(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function ft(){let{t:i}=K(),o=s(),[c,u]=a(!1),d=()=>{o.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},f=v(),p=b().trpcClient,h=dt(6e4),{rows:g,isLoading:S}=ut(),{data:C}=F({isCamera:!0,projection:`slim`}),w=t(()=>{let e=new Map;for(let t of C??[])e.set(t.id,t.name);return e},[C]),T=n(()=>{o.invalidateQueries({queryKey:ct})},[o]),E=j({onSuccess:T}),D=_e({onSuccess:T}),[O,k]=a(null),A=n(async e=>{k(e.id);try{let{url:t}=await p.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await je(t),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.options.title??e.id}.mp4`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),T()}finally{k(null)}},[p,T]),M=n(async e=>{await f({title:i(`recordings.exportsSection.cancelThisExport`,`Cancel this export?`),message:i(`recordings.exportsSection.stopsTheRenderThePartial`,`Stops the render. The partial file is discarded.`),confirmLabel:i(`recordings.exportsSection.cancelExport`,`Cancel export`),variant:`danger`})&&E.mutate({exportId:e.id})},[f,E,i]),N=n(async e=>{await f({title:i(`recordings.exportsSection.deleteThisExport`,`Delete this export?`),message:i(`recordings.exportsSection.permanentlyRemovesTheRenderedFile`,`Permanently removes the rendered file and its history row.`),confirmLabel:i(`common.delete`,`Delete`),variant:`danger`})&&D.mutate({exportId:e.id})},[f,D,i]),P=t(()=>[{key:`camera`,header:i(`recordings.exportsSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:w.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:i(`recordings.exportsSection.range`,`Range`),nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:et(e.fromMs,e.toMs)})},{key:`variant`,header:i(`recordings.exportsSection.variant`,`Variant`),render:e=>r(`span`,{className:`text-foreground-subtle`,children:Qe(e.options)})},{key:`state`,header:i(`recordings.exportsSection.state`,`State`),render:t=>{let n=lt[t.state];return e(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${n.cls}`,children:[n.spin&&r(m,{className:`h-2.5 w-2.5 animate-spin`}),i(n.labelKey),t.state===`rendering`&&t.progressPct!==null&&e(`span`,{className:`tabular-nums`,children:[t.progressPct,`%`]})]})}},{key:`expiry`,header:i(`recordings.exportsSection.expires`,`Expires`),nowrap:!0,render:e=>e.state===`deleted`?r(`span`,{className:`text-foreground-subtle`,children:`—`}):r(`span`,{className:`text-foreground-subtle tabular-nums`,children:tt(e.expiresAt,h)})},{key:`size`,header:i(`recordings.exportsSection.size`,`Size`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:q(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:t=>{let n=t.state===`ready`,a=t.state===`queued`||t.state===`rendering`,o=t.state!==`deleted`;return e(`div`,{className:`flex items-center justify-end gap-1`,children:[n&&e(W,{variant:`unstyled`,onClick:()=>{A(t)},disabled:O===t.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-primary/10 hover:text-foreground disabled:opacity-50`,title:i(`recordings.exportsSection.downloadMp4`,`Download MP4`),children:[O===t.id?r(m,{className:`h-3 w-3 animate-spin`}):r(x,{className:`h-3 w-3`}),i(`recordings.exportsSection.download`,`Download`)]}),a&&e(W,{variant:`unstyled`,onClick:()=>{M(t)},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:i(`recordings.exportsSection.cancelRender`,`Cancel render`),children:[r(l,{className:`h-3 w-3`}),i(`common.cancel`,`Cancel`)]}),o&&r(W,{variant:`unstyled`,onClick:()=>{N(t)},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:i(`recordings.exportsSection.deleteExport`,`Delete export`),children:r(_,{className:`h-3 w-3`})})]})}}],[w,h,O,E.isPending,D.isPending,A,M,N,i]);return S&&g.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(m,{className:`h-4 w-4 animate-spin`}),i(`recordings.exportsSection.loadingExports`,`Loading exports…`)]}):e(`div`,{className:`space-y-3`,children:[r(`div`,{className:`flex justify-end`,children:e(W,{variant:`unstyled`,onClick:()=>u(!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:[r(y,{className:`h-3.5 w-3.5`}),i(`recordings.exportsSection.newExport`,`New export`)]})}),g.length===0?r(z,{icon:y,title:i(`recordings.exportsSection.noExportsYet`,`No exports yet`),description:i(`recordings.exportsSection.createOneHereNewExport`,`Create one here (New export) or from a camera's timeline in the viewer. Rendered clips show up here to download or manage.`)}):r(R,{columns:P,rows:g,rowKey:e=>e.id,minWidthPx:720}),c&&r(st,{onClose:()=>u(!1),onCreated:d})]})}var pt=`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`;o();var mt=`storage-migration`,ht=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function gt(e){return[`${e.orphansReclaimed} orphan rows (${q(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${q(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${q(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function _t(){let{t:e}=K(),t=ce(mt);return t===`pending`?null:t===`unknown`?r(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:e(`recordings.cleanupSection.couldNotCheckWhetherStorage`,`Could not check whether storage cleanup is installed on this hub.`)}):t===`present`?r(vt,{}):null}function vt(){let{t}=K(),n=v(),[i,o]=a(!1),[s,c]=a(null),l=le({},{refetchInterval:2e3}),u=l.data??null,d=u!==null&&ht.has(u.phase),p=he(),h=Se(),g=async()=>{if(await n({title:t(`recordings.cleanupSection.runStorageCleanup`,`Run storage cleanup?`),message:i?t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd`,`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`):t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd2`,`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`),confirmLabel:t(`recordings.cleanupSection.runCleanup`,`Run cleanup`),variant:`danger`})){c(null);try{await p.mutateAsync({includeDebugMedia:i}),await l.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}},y=async()=>{if(u&&await n({title:t(`recordings.cleanupSection.cancelCleanup`,`Cancel cleanup?`),message:t(`recordings.cleanupSection.stopsAfterTheCurrentStep`,`Stops after the current step. Work already done stays done.`),confirmLabel:t(`recordings.cleanupSection.cancelCleanup2`,`Cancel cleanup`),variant:`danger`}))try{await h.mutateAsync({jobId:u.jobId}),await l.refetch()}catch{}};return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.cleanupSection.cleanup`,`Cleanup`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.cleanupSection.onePassOverLeftoverAnalytics`,`One pass over leftover analytics (database + files) and ghost footage rows on frozen locations. Does not time out — progress updates here until it finishes.`)}),e(`label`,{className:`mt-3 flex items-start gap-2 text-[11px] text-foreground`,children:[r(f,{checked:i,disabled:d,onChange:e=>{o(e.target.checked)},className:`mt-0.5 h-3.5 w-3.5 accent-primary`}),r(`span`,{children:t(`recordings.cleanupSection.alsoRemoveDebugMediaMotion`,`Also remove debug media (motion stills and track filmstrips)`)})]}),e(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[e(W,{variant:`unstyled`,type:`button`,disabled:d||p.isPending,onClick:()=>{g()},className:pt,children:[(d||p.isPending)&&r(m,{className:`h-3 w-3 animate-spin`}),r(_,{className:`h-3 w-3`}),t(`recordings.cleanupSection.runCleanup`,`Run cleanup`)]}),d&&r(W,{variant:`unstyled`,type:`button`,onClick:()=>{y()},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:t(`common.cancel`,`Cancel`)})]}),s&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:s}),u&&e(`div`,{className:`mt-3 space-y-1 rounded-md border border-border px-2.5 py-2`,children:[e(`p`,{className:`text-xs text-foreground`,children:[t(`recordings.cleanupSection.phase`,`Phase:`),` `,r(`span`,{className:`font-medium`,children:u.phase}),d&&r(m,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),u.detail&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:u.detail}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:gt(u)}),u.error&&r(`p`,{className:`text-[11px] text-danger`,children:u.error})]})]})}o();var yt=2e3;function bt(){let{t}=K(),n=v(),a=s(),o=I(),c=ee(void 0,{refetchInterval:e=>e.state.data?.state===`running`?yt:!1}),l=c.data,u=l?.state===`running`,d=u||o.isPending;i(()=>{l?.state!==`done`||l.finishedAtMs===null||(a.invalidateQueries({queryKey:[[`recording`]]}),a.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[l?.state,l?.finishedAtMs,a]);let f=async()=>{await n({title:t(`recordings.diskReconcileSection.reconcileStorageFromDisk`,`Reconcile storage from disk?`),message:t(`recordings.diskReconcileSection.makesTheDatabaseMatchThe`,`Makes the database match the filesystem: recordings index, tracks, events and media whose files are gone. Favourited tracks without files are deleted. Snapshot-less motion/audio events are deleted. Enrolled identities stay. This cannot be undone.`),confirmLabel:t(`recordings.diskReconcileSection.reconcile`,`Reconcile`),variant:`warning`})&&(await o.mutateAsync(),await c.refetch())},p=u?l.total>0?`Reconciling ${String(l.completed)}/${String(l.total)}…`:`Reconciling…`:o.isPending?`Reconciling…`:`Reconcile from disk`;return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.diskReconcileSection.diskReconcile`,`Disk reconcile`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.diskReconcileSection.deletesDatabaseRowsWhoseFiles`,`Deletes database rows whose files are gone. Enrolled identities stay.`)}),e(`div`,{className:`mt-3 flex flex-col gap-2`,children:[e(W,{variant:`unstyled`,type:`button`,onClick:()=>void f(),disabled:d,className:`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[d?r(m,{className:`h-3.5 w-3.5 animate-spin`}):r(h,{className:`h-3.5 w-3.5`}),p]}),l?.state===`done`?e(`p`,{className:`text-[11px] text-foreground-subtle`,children:[t(`recordings.diskReconcileSection.lastRun`,`Last run:`),` `,t(`recordings.diskReconcileSection.summary`,{completed:String(l.completed),tracks:String(l.tracks),events:String(l.events),media:String(l.mediaDropped)}),l.failed.length>0?t(`recordings.diskReconcileSection.failed`,`, {{value1}} failed ({{value2}})`,{value1:String(l.failed.length),value2:l.failed.join(`, `)}):``,`.`]}):null,l?.state===`error`&&l.error!==null?e(`p`,{className:`text-[11px] text-destructive`,children:[t(`recordings.diskReconcileSection.reconcileFailed`,`Reconcile failed:`),` `,l.error]}):null]})]})}var J=1e3,Y=60*J,X=60*Y;function Z(e){return e.toLocaleString(`en-US`)}function xt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=X){let t=Math.floor(e/X),n=Math.round(e%X/Y);return`${t.toString()}h ${n.toString()}m`}if(e>=Y){let t=Math.floor(e/Y),n=Math.round(e%Y/J);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/J)).toString()}s`}function St(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${Z(e.filesMoved)} files`:`${Z(e.filesMoved)} / ${Z(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?`${q(e.bytesMoved/t*J)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${xt(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${q(e.bytesMoved)} moved`,rate:a,eta:s}}function Ct(e){let t=St(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}o();var wt=`storage-migration`,Q=[{id:`recordings`,labelKey:`recordings.storageMigrationSection.classRecordings`,locationType:`recordings`},{id:`recordingsLow`,labelKey:`recordings.storageMigrationSection.classRecordingsLow`,locationType:`recordingsLow`},{id:`eventMedia`,labelKey:`recordings.storageMigrationSection.classEventMedia`,locationType:`eventMedia`}],Tt=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function Et(){let{t}=K(),n=ce(wt);return n===`pending`?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(m,{className:`h-4 w-4 animate-spin`}),t(`migration.storageMigrationSection.checkingWhetherStorageMigrationIs`,`Checking whether storage migration is installed…`)]}):n===`unknown`?r(z,{icon:d,title:t(`migration.storageMigrationSection.couldnTCheckWhetherStorage`,`Couldn't check whether storage migration is installed`),description:t(`migration.storageMigrationSection.theCapabilityRegistryDidNot`,`The capability registry did not answer, so this panel has nothing to report either way — it is not a statement that the capability is missing. Reload to ask again.`)}):n===`absent`?r(z,{icon:E,title:t(`migration.storageMigrationSection.storageMigrationNotInstalled`,`Storage migration not installed`),description:t(`migration.storageMigrationSection.theCapabilityRegistryAnsweredNo`,`The capability registry answered: no addon in this cluster provides storage-migration. Once one is deployed, this panel moves recordings, low-res recordings and event media to new storage locations in one coordinated, verified operation.`)}):r(Dt,{})}function Dt(){let{t:n}=K(),i=v(),{data:o}=we({}),[s,c]=a({}),[l,u]=a({}),[d,f]=a(null),[h,g]=a(null),_=t(()=>{let e=new Map;for(let t of o??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[o]),y=t(()=>{let e=new Map;for(let t of o??[]){if(t.enabled===!1)continue;let n=e.get(t.type);n?n.push(t.id):e.set(t.type,[t.id])}let t=new Map;for(let[n,r]of e)r.length===1&&t.set(n,r[0]);return t},[o]),b=pe({},{refetchInterval:2e3}),x=b.data??null,S=x!==null&&Tt.has(x.phase),w=t(()=>{let e={};for(let t of Q){let n=s[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s]),T=t(()=>{let e={};for(let t of Q){if(!s[t.id])continue;let n=l[t.id]??y.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s,l,y]),D=t(()=>({destinations:w??{},...T?{sources:T}:{}}),[w,T]),O=ve(D,{enabled:!1,retry:!1}),k=de(),A=ye(),j=async()=>{if(!w)return;g(null);let e=await O.refetch();if(e.error){g(e.error instanceof Error?e.error.message:String(e.error));return}f(e.data??null)},M=async()=>{if(w&&await i({title:n(`migration.storageMigrationSection.startStorageMigration`,`Start storage migration?`),message:n(`migration.storageMigrationSection.copiesTheSelectedClassesFrom`,`Copies the selected classes from the chosen source to the destination, verifies, then either makes the destination the default (if the source was) or disables the source. Safe to re-run if interrupted.`),confirmLabel:n(`migration.storageMigrationSection.startMigration`,`Start migration`),variant:`danger`})){g(null);try{await k.mutateAsync(D),f(null),await b.refetch()}catch(e){g(e instanceof Error?e.message:String(e))}}},N=async()=>{if(x&&await i({title:n(`migration.storageMigrationSection.cancelMigration`,`Cancel migration?`),message:n(`migration.storageMigrationSection.stopsTheInProgressMigration`,`Stops the in-progress migration. Data already moved and verified stays at the destination; anything already repointed is not reverted.`),confirmLabel:n(`migration.storageMigrationSection.cancelMigration2`,`Cancel migration`),variant:`danger`}))try{await A.mutateAsync({jobId:x.jobId}),await b.refetch()}catch{}};return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[e(`h3`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[r(E,{className:`h-3.5 w-3.5`}),n(`migration.storageMigrationSection.storageMigration`,`Storage migration`)]}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.moveRecordingsLowResRecordings`,`Move recordings, low-res recordings and/or event media from one location to another: copies via the recorder / pipeline-analytics movers, verifies, then either repoints the default (when the source was the default) or disables the source (when it was not). Skip a class with an empty destination.`)}),r(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:Q.map(t=>{let i=_.get(t.locationType)??[],a=y.get(t.locationType)??``;return e(`div`,{className:`space-y-2`,children:[r(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:n(t.labelKey)}),e(`div`,{className:`space-y-1`,children:[r(`label`,{htmlFor:`migration-from-${t.id}`,className:`text-[10px] text-foreground-subtle`,children:n(`recordings.storageMigrationSection.classFrom`,{label:n(t.labelKey)})}),r(C,{id:`migration-from-${t.id}`,value:l[t.id]??a,onChange:e=>{let n=e.target.value;u(e=>({...e,[t.id]:n}))},disabled:S,className:`w-full`,children:i.map(t=>e(`option`,{value:t.id,children:[t.displayName,t.enabled===!1?` (${n(`recordings.storageMigrationSection.readOnly`)})`:``]},t.id))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{htmlFor:`migration-dest-${t.id}`,className:`text-[10px] text-foreground-subtle`,children:n(`recordings.storageMigrationSection.classTo`,{label:n(t.labelKey)})}),e(C,{id:`migration-dest-${t.id}`,value:s[t.id]??``,onChange:e=>{let n=e.target.value;c(e=>({...e,[t.id]:n}))},disabled:S,className:`w-full`,children:[r(`option`,{value:``,children:n(`migration.storageMigrationSection.skip`,`— skip —`)}),i.map(e=>r(`option`,{value:e.id,children:e.displayName},e.id))]})]})]},t.id)})}),h&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:h}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[e(W,{variant:`unstyled`,type:`button`,onClick:()=>{j()},disabled:!w||O.isFetching||S,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:[O.isFetching&&r(m,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.plan`,`Plan`)]}),e(W,{variant:`unstyled`,type:`button`,onClick:()=>{M()},disabled:!w||k.isPending||S,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:[k.isPending&&r(m,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.startMigration`,`Start migration`)]})]}),d&&r(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:d.moves.length===0?r(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.nothingToMoveSelectedDestinations`,`Nothing to move — selected destinations match the current defaults.`)}):d.moves.map(t=>e(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground`,children:[t.storageClass,`: `,t.fromLocationId,` → `,t.toLocationId]},`${t.storageClass}-${t.toLocationId}`))}),x&&e(`div`,{className:`mt-4 border-t border-border pt-3`,children:[e(`div`,{className:`flex items-center justify-between`,children:[r(`h4`,{className:`text-xs font-semibold text-foreground`,children:n(`migration.storageMigrationSection.migrationStatus`,`Migration status`)}),S&&e(W,{variant:`unstyled`,type:`button`,onClick:()=>{N()},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:[r(p,{className:`h-3 w-3`}),n(`common.cancel`,`Cancel`)]})]}),e(`p`,{className:`mt-1 text-xs text-foreground`,children:[n(`migration.storageMigrationSection.phase`,`Phase:`),` `,r(`span`,{className:`font-medium`,children:x.phase}),S&&r(m,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),x.error&&r(`p`,{className:`mt-1 text-[11px] text-danger`,children:x.error}),x.pausedParticipants.length>0&&e(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[n(`migration.storageMigrationSection.paused`,`Paused:`),` `,x.pausedParticipants.join(`, `)]}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:x.moves.map(e=>r(Ot,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),r(kt,{})]}),r(At,{running:S}),r(Mt,{})]})}function Ot({move:t}){let{t:n}=K(),i=t.progress===null?null:St(t.progress);return e(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[e(`div`,{className:`flex items-center justify-between`,children:[e(`span`,{className:`text-foreground`,children:[t.storageClass,`: `,t.fromLocationId,` → `,t.toLocationId]}),e(`span`,{className:`text-foreground-subtle`,children:[t.state??n(`common.pending`),t.error?` (${t.error})`:``]})]}),t.progress!==null&&e(`div`,{className:`mt-1 space-y-1`,children:[i!==null&&i.fraction!==null&&r(`div`,{className:`h-1 w-full overflow-hidden rounded bg-border`,children:r(`div`,{className:`h-full bg-primary`,style:{width:`${(i.fraction*100).toFixed(1)}%`}})}),r(`p`,{className:`text-[10px] text-foreground-subtle`,children:Ct(t.progress)})]})]})}function kt(){let{t}=K(),{data:n}=Ce({});return!n||n.length===0?null:e(`div`,{className:`mt-4 border-t border-border pt-3`,children:[r(`h4`,{className:`text-xs font-semibold text-foreground`,children:t(`migration.storageMigrationSection.migrationHistory`,`Migration history`)}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:n.map(t=>e(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:[r(`span`,{className:`font-medium text-foreground`,children:t.phase}),` · `,Object.entries(t.destinations).filter(e=>typeof e[1]==`string`).map(([e,t])=>`${e} → ${t}`).join(`, `),` · `,new Date(t.startedAt).toLocaleString()]},t.jobId))})]})}function At({running:t}){let{t:n}=K(),i=v(),o=Te({},{staleTime:1/0,refetchOnWindowFocus:!1}),s=be(),[c,l]=a(null),u=o.data??[];if(u.length===0)return null;let d=async e=>{if(await i({title:n(`migration.storageMigrationSection.drainRemaining`,`Drain remaining {{storageClass}}?`,{storageClass:e.storageClass}),message:`Moves what is still on ${e.fromLocationId} to ${e.toLocationId}. Nothing is paused and no default is changed — this is the second half of a migration, run on its own. It is resumable: cancelling leaves everything readable from both locations.`,confirmLabel:n(`migration.storageMigrationSection.drainRemaining2`,`Drain remaining`),variant:`danger`})){l(null);try{await s.mutateAsync({classes:[e.storageClass]}),await o.refetch()}catch(e){l(e instanceof Error?e.message:String(e))}}};return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[e(`div`,{className:`flex items-start justify-between gap-2`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:n(`migration.storageMigrationSection.leftOnTheOldLocation`,`Left on the old location`)}),e(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r(`span`,{className:`text-[10px] text-foreground-subtle`,children:o.dataUpdatedAt>0?n(`migration.storageMigrationSection.measured`,`Measured {{value1}}`,{value1:new Date(o.dataUpdatedAt).toLocaleTimeString()}):n(`migration.storageMigrationSection.measuredNever`,`Measured — never`)}),r(W,{variant:`unstyled`,type:`button`,onClick:()=>{o.refetch()},disabled:o.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:o.isFetching?n(`migration.storageMigrationSection.counting`,`Counting…`):n(`common.refresh`,`Refresh`)})]})]}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.aMigrationRepointsFirstAnd`,`A migration repoints first and drains behind. If the drain was cancelled, failed, or was interrupted by a restart, the data below is still on the source — readable, but not where the defaults now point. Draining moves it; it changes no default and pauses nothing.`)}),r(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.thisCountIsTakenOn`,`This count is taken on demand: measuring it walks the whole media collection, so it is not refreshed on a timer. Press Refresh after a drain finishes.`)}),c&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:c}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:u.map(i=>e(`div`,{className:`flex items-center justify-between gap-2 px-2.5 py-1.5 text-[11px]`,children:[e(`span`,{className:`text-foreground`,children:[i.storageClass,`: `,i.fromLocationId,` → `,i.toLocationId,r(`span`,{className:`ml-2 text-foreground-subtle`,children:jt(i)})]}),r(W,{variant:`unstyled`,type:`button`,onClick:()=>{d(i)},disabled:t||s.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:n(`migration.storageMigrationSection.drainRemaining2`,`Drain remaining`)})]},`${i.storageClass}-${i.fromLocationId}`))})]})}function jt(e){if(e.items===null)return G.t(`recordings.storageMigrationSection.residueUnknown`);let t=e.items.toLocaleString(`en-US`);return e.bytes===null?G.t(`recordings.storageMigrationSection.residueRows`,{count:e.items,items:t}):G.t(`recordings.storageMigrationSection.residueSegments`,{count:e.items,items:t,size:q(e.bytes)})}function Mt(){let{t}=K(),{data:n}=ue({},{refetchInterval:2e3}),i=(n??[]).filter(e=>e.migrationJobId===null&&e.job.state===`running`);return i.length===0?null:e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(`migration.storageMigrationSection.moversRunningOutsideAMigration`,`Movers running outside a migration`)}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:i.map(t=>e(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[e(`div`,{className:`text-foreground`,children:[t.lane,`: `,t.job.fromLocationId,` → `,t.job.toLocationId]}),r(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:Ct({filesMoved:t.job.filesMoved,filesTotal:t.job.filesTotal,bytesMoved:t.job.bytesMoved,startedAt:t.job.startedAt,observedAt:t.observedAt})})]},t.job.jobId))})]})}function Nt(){let{t}=K();return e(`div`,{className:`flex flex-col gap-4`,children:[r(_t,{}),r(bt,{}),e(`section`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.recordingsManagementSection.moveStorage`,`Move storage`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.recordingsManagementSection.copyRecordingsLowResRecordings`,`Copy recordings, low-res recordings or event media to a new location, verify, then repoint the default. Applies to every camera.`)}),r(`div`,{className:`mt-3`,children:r(Et,{})})]})]})}o();var Pt=`recorder`,Ft=`recording`;function It(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 Lt(){let{t:n}=K(),i=s(),{nodes:a}=te(),{data:o,isLoading:c}=B({addonId:Pt,cap:Ft,scope:`cluster`}),l=It(o,`recordingNodeId`,`hub`),u=V({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getScopedSettings`]]})}}),d=t(()=>{let e=a.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,l,...e])].filter(Boolean)},[a,l]);return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:n(`pipeline.clusterRecordingTab.recordingNode`,`Recording node`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterRecordingTab.theSingleNodeThatRecords`,`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`)}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[c?r(m,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(C,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:Pt,cap:Ft,scope:`cluster`,patch:{recordingNodeId:e.target.value}})},disabled:u.isPending,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterRecordingTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(m,{className:`h-4 w-4 animate-spin text-primary`})]}),l!==`hub`&&r(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:r(De,{i18nKey:`pipeline.clusterRecordingTab.hubOnlyNote`,values:{node:l},components:{b:r(`span`,{className:`font-medium`})}})})]}),e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:n(`pipeline.clusterRecordingTab.recordingsFolders`,`Recordings folders`)}),r(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterRecordingTab.whereRecordingsAreStoredMulti`,`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`)}),r(Ve,{types:[`recordings`,`recordingsLow`]})]})]})}function Rt(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function zt(e,t){let n=Rt(e);return n.length===0?G.t(`helpers.cameraDisk.defaultRoot`):n.map(e=>t.get(e)??e).join(` + `)}function Bt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:zt(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Rt(e).includes(n));return i===void 0?null:{label:zt(i,t),exact:!1}}o();var Vt=[[`recording`]],Ht=[{value:`retention`,labelKey:`recordings.storageSection.pruneRetention`},{value:`quota`,labelKey:`recordings.storageSection.pruneQuota`},{value:`operator`,labelKey:`recordings.storageSection.pruneOperator`}],Ut={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Wt={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function Gt(e){return e==null?`—`:new Date(e).toLocaleString()}function Kt(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(` + `):G.t(`recordings.storageSection.defaultRoot`):e.root}function qt(){let{t:i}=K(),o=s(),c=v(),[l,u]=a(`retention`),{data:d,isLoading:f}=Ee({},{refetchOnWindowFocus:!1}),{data:p}=F({isCamera:!0,projection:`slim`}),{data:y}=we({}),b=t(()=>{let e=new Map;for(let t of p??[])e.set(t.id,t.name);return e},[p]),x=t(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.displayName);return e},[y]),S=t(()=>{let e=y??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[y]),w=t(()=>d?.locations??[],[d?.locations]),T=t(()=>Bt(w,x,S),[w,x,S]),E=t(()=>Ne(w),[w]),O=n(()=>{o.invalidateQueries({queryKey:Vt})},[o]),k=M({onSuccess:O}),j=A({onSuccess:O}),N=n(async e=>{await c({title:i(`recordings.storageSection.prune`,`Prune {{label}}?`,{label:b.get(e.deviceId)??`#${String(e.deviceId)}`}),message:i(`recordings.storageSection.appliesTheRetentionPolicyNow`,`Applies the retention policy now (reason: {{reason}}). Footage beyond the policy is permanently deleted.`,{reason:l}),confirmLabel:i(`recordings.storageSection.pruneNow`,`Prune now`),variant:`danger`})&&k.mutate({deviceId:e.deviceId,reason:l})},[c,k,l,b,i]),P=n(async e=>{await c({title:i(`recordings.storageSection.deleteAllFootageFor`,`Delete all footage for {{label}}?`,{label:b.get(e.deviceId)??`#${String(e.deviceId)}`}),message:i(`recordings.storageSection.permanentlyDeletesOfRecordedFootage`,`Permanently deletes {{value1}} of recorded footage for this camera. This cannot be undone.`,{value1:q(e.usedBytes)}),confirmLabel:i(`recordings.storageSection.delete`,`Delete {{value1}}`,{value1:q(e.usedBytes)}),variant:`danger`})&&j.mutate({deviceId:e.deviceId})},[c,j,b,i]),I=t(()=>[{key:`camera`,header:i(`recordings.storageSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:b.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:i(`recordings.storageSection.disk`,`Disk`),nowrap:!0,render:()=>T===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`span`,{className:T.exact?`text-foreground`:`text-foreground-subtle`,title:T.exact?i(`recordings.storageSection.theOnlyRecordingsVolumeOn`,`The only recordings volume on this node — this camera can only be here.`):i(`recordings.storageSection.theRecordingsDefaultThisNode`,`The recordings DEFAULT. This node has several recordings volumes and the per-camera placement is not reported by recording.getStorageUsage, so this is where footage lands by default rather than a per-camera fact.`),children:[T.label,!T.exact&&r(`span`,{className:`ml-1 text-foreground-subtle`,children:i(`recordings.storageSection.default`,`(default)`)})]})},{key:`used`,header:i(`recordings.storageSection.used`,`Used`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:q(e.usedBytes)})},{key:`oldest`,header:i(`recordings.storageSection.oldestFootage`,`Oldest footage`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums text-foreground-subtle`,title:i(`recordings.storageSection.theOldestSegmentTheArchive`,`The oldest segment the ARCHIVE holds for this camera — the per-camera answer to 'is retention actually holding?'.`),children:Gt(e.oldestMs)})},{key:`actions`,header:``,align:`right`,render:t=>e(`div`,{className:`flex items-center justify-end gap-1`,children:[e(W,{variant:`unstyled`,onClick:()=>{N(t)},disabled:k.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:i(`recordings.storageSection.applyRetentionPolicyNow`,`Apply retention policy now`),children:[r(D,{className:`h-3 w-3`}),i(`recordings.storageSection.prune2`,`Prune`)]}),e(W,{variant:`unstyled`,onClick:()=>{P(t)},disabled:j.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:i(`recordings.storageSection.deleteAllFootage`,`Delete all footage`),children:[r(_,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})]})}],[b,T,N,P,k.isPending,j.isPending,i]);if(f&&!d)return e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(m,{className:`h-4 w-4 animate-spin`}),i(`recordings.storageSection.loadingStorageUsage`,`Loading storage usage…`)]});if(!d)return r(z,{icon:h,title:i(`recordings.storageSection.noStorageData`,`No storage data`),description:i(`recordings.storageSection.theRecordingNodeHasNot`,`The recording node has not reported any storage usage yet.`)});let L=d.devices.length;return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[r(g,{label:i(`recordings.storageSection.totalUsed`,`Total used`),icon:r(h,{className:`h-3 w-3`}),footer:`${String(L)} camera${L===1?``:`s`} on ${d.nodeId}`,children:q(d.totalUsedBytes)}),E!==null&&E.severity!==null&&r(g,{label:i(`recordings.storageSection.freeOnRecordingsVolumes`,`Free on recordings volumes`),icon:r(h,{className:`h-3 w-3`}),footer:`across ${String(E.knownVolumes)} volume${E.knownVolumes===1?``:`s`} of ${q(E.totalBytes)}`+(E.unknownVolumes>0?` · ${String(E.unknownVolumes)} did not report capacity`:``),children:r(`span`,{className:`tabular-nums ${Wt[E.severity]}`,children:q(E.freeBytes)})}),w.map(t=>{let n=Me(t),a=t.locationId??t.root??`default`;return r(g,{label:i(`recordings.storageSection.disk2`,`Disk: {{label}}`,{label:Kt(t,x)}),footer:n===null?`${q(t.usedBytes)} of recordings · volume capacity unknown`:`${q(n.freeBytes)} free of ${q(n.totalBytes)} · ${q(t.usedBytes)} recordings (${$(n.recordingsFraction)})`,children:n===null?r(`span`,{className:`tabular-nums`,children:q(t.usedBytes)}):e(`div`,{className:`flex items-center gap-2`,title:i(`recordings.storageSection.volumeFillEverythingOnThe`,`Volume fill — everything on the disk, not only recordings. Warn at 85%, critical at 95%.`),children:[r(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:r(`div`,{className:`h-full rounded ${Ut[n.severity]}`,style:{width:$(n.fraction)}})}),r(`span`,{className:`tabular-nums text-xs ${Wt[n.severity]}`,children:$(n.fraction)})]})},a)})]}),e(`section`,{className:`flex items-center gap-2 text-xs`,children:[r(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:i(`recordings.storageSection.pruneReason`,`Prune reason`)}),r(C,{wrapperClassName:`inline-block w-auto`,id:`prune-reason`,value:l,onChange:e=>{let t=Ht.find(t=>t.value===e.target.value);t&&u(t.value)},children:Ht.map(e=>r(`option`,{value:e.value,children:i(e.labelKey)},e.value))})]}),L===0?r(z,{icon:h,title:d.devicesRead===`unavailable`?i(`recordings.storageSection.perCameraUsageUnavailable`,`Per-camera usage unavailable`):i(`recordings.storageSection.noRecordedFootage`,`No recorded footage`),description:d.devicesRead===`unavailable`?i(`recordings.storageSection.thisRecordingNodeHasNo`,`This recording node has no footage ledger, so it refused to answer the per-camera table rather than report what it happens to hold in memory. The disk totals above are unaffected.`):i(`recordings.storageSection.noCameraHasRecordedFootage`,`No camera has recorded footage on this node yet.`)}):r(R,{columns:I,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Jt(){let{t}=K();return e(`div`,{className:`flex flex-col gap-8`,children:[e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.recordingsStorageSection.footageOnDisk`,`Footage on disk`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.recordingsStorageSection.whatRecordedFootageOccupiesPer`,`What recorded footage occupies, per camera and per volume, with prune-by-policy and delete-all-footage.`)}),r(`div`,{className:`mt-3`,children:r(qt,{})})]}),e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.recordingsStorageSection.recordingNodeFolders`,`Recording node & folders`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.recordingsStorageSection.theSingleNodeThatRecords`,`The single node that records and serves playback, and the storage locations footage is written to.`)}),r(`div`,{className:`mt-3`,children:r(Lt,{})})]})]})}function Yt(){let{t:e}=K(),t=ke(`/recordings`,{t:e,isAdmin:!0})??{icon:y,title:e(`nav.recordings`,`Recordings`)};return r(Ae,{icon:t.icon,title:t.title,subtitle:e(`recordings.recordedFootageAndTheDurable`,`Recorded footage and the durable event store — what each occupies, where it is written, and the operations that move or reconcile both.`),defaultSection:`storage`,sectionsLabel:`${t.title} sections`,sections:[{id:`storage`,label:e(`recordings.recordings`,`Recordings`),content:r(Jt,{})},{id:`events`,label:e(`recordings.events`,`Events`),content:r(Ze,{})},{id:`cameras`,label:e(`recordings.cameras`,`Cameras`),content:r(Be,{})},{id:`exports`,label:e(`recordings.export`,`Export`),content:r(ft,{})},{id:`activity`,label:e(`recordings.activity`,`Activity`),content:r(ze,{})},{id:`management`,label:e(`recordings.management`,`Management`),content:r(Nt,{})}]})}export{Yt as RecordingsPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,et as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Aa as o,Cn as s,D as c,Ni as l,Sa as u,St as d,Tr as f,Yt as p,ct as m,lt as h,ri as g,ut as _,wa as v,wn as y}from"./player-overlays-BZByYYB8.js";import{a as b,c as x,f as S,o as C}from"./video-BV-3O_ZC.js";import{Br as w,Ci as T,Ct as ee,Dt as te,Fn as E,Hr as D,Ht as O,Ir as k,Ko as A,Lr as j,Mi as M,Nf as N,Nn as P,Pn as F,Rr as I,St as L,Ti as R,Ud as z,Un as B,Vn as V,Vr as H,Wn as U,af as W,ar as ne,cr as G,fr as K,ji as q,kt as re,of as J,sr as ie}from"./src-DKRp5NPI.js";import{t as Y}from"./i18n-ByFr51sS.js";import{t as X}from"./useTranslation-BJr-n0es.js";import{Br as ae,I as oe,n as se}from"./index-D5GcZJtC.js";a();function ce({id:t,title:r,icon:i,description:a,actions:o,tone:s=`default`,notice:l=null,onDismissNotice:u,children:d}){return n(V,{headingId:`access-${t}`,title:r,icon:i,actions:o,testId:`access-${t}`,children:e(`div`,{className:`${c} space-y-3`,children:[n(`div`,{className:v(`text-[11px] leading-relaxed`,s===`danger`?`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-foreground`:`text-foreground-subtle`),children:a}),l!==null&&n(ue,{notice:l,onDismiss:u}),d]})})}var le={success:{icon:l,line:`border-success/30 text-foreground`,mark:`text-success`},danger:{icon:b,line:`border-danger/40 text-danger`,mark:`text-danger`}};function ue({notice:t,onDismiss:r}){let{t:i}=X(),a=le[t.tone],o=a.icon;return e(`div`,{role:t.tone===`danger`?`alert`:`status`,className:v(`flex items-start gap-2 rounded-md border bg-surface px-3 py-2 text-[11px]`,a.line),children:[n(o,{className:v(`mt-0.5 h-3.5 w-3.5 shrink-0`,a.mark),"aria-hidden":!0}),n(`span`,{className:`min-w-0 flex-1`,children:t.message}),r!==void 0&&n(J,{type:`button`,variant:`ghost`,size:`sm`,icon:d,"aria-label":i(`access.accessSection.dismiss`,`Dismiss`),onClick:r,className:`-my-1 h-5 w-5`})]})}function Z(){let{data:e}=z();return t(()=>{let t=new Map;for(let n of e??[])t.set(n.id,n.username);return t},[e])}function de(e,t=null){return e===null?t:{tone:`danger`,message:e}}var fe={active:`access.credentialColumns.statusActive`,expired:`access.credentialColumns.statusExpired`,revoked:`access.credentialColumns.statusRevoked`,current:`access.credentialColumns.statusCurrent`};function pe(e){return Y.t(fe[e])}var me={active:`success`,expired:`warning`,revoked:`default`,current:`info`},he={current:0,active:1,expired:2,revoked:3};function ge(e,t){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:n.toLocaleString()}function _e({status:e}){return n(R,{variant:me[e],className:`text-[10px]`,children:pe(e)})}function ve({row:t,action:r}){if(!r.isAvailable(t))return null;let i=r.icon,a=r.busyId===t.id;return e(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r.onRun(t),disabled:r.disabled,"aria-label":Y.t(`access.credentialColumns.actionOn`,{action:r.label,name:t.name}),className:r.tone===`neutral`?void 0:`text-danger hover:bg-danger/10`,children:[a?n(f,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(i,{className:`h-3 w-3`,"aria-hidden":!0}),r.label]})}function ye(t){return[{key:`name`,header:Y.t(`access.credentialColumns.name`,`Name`),sortValue:e=>e.name.toLowerCase(),render:t=>e(`div`,{className:`min-w-0 max-w-[18rem]`,children:[n(`div`,{className:`truncate font-medium text-foreground`,title:t.name,children:t.name}),t.detail!==null&&n(`div`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,title:t.detail,children:t.detail})]})},t.hideOwner?null:{key:`owner`,header:Y.t(`access.credentialColumns.owner`,`Owner`),sortValue:e=>e.ownerName.toLowerCase(),render:e=>e.ownerName},{key:`kind`,header:Y.t(`access.credentialColumns.kindScope`,`Kind / scope`),sortValue:e=>e.kind.toLowerCase(),nowrap:!1,render:t=>e(`div`,{className:`min-w-[8rem] max-w-[16rem]`,children:[n(`div`,{className:`text-foreground`,children:t.kind}),t.scope!==null&&n(`div`,{className:`line-clamp-2 text-[10px] text-foreground-subtle`,title:t.scope,children:t.scope})]})},{key:`status`,header:Y.t(`access.credentialColumns.status`,`Status`),sortValue:e=>he[e.status],render:e=>n(_e,{status:e.status})},{key:`created`,header:Y.t(`access.credentialColumns.created`,`Created`),sortValue:e=>e.createdAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ge(e.createdAt,`—`)})},{key:`lastUsed`,header:Y.t(`access.credentialColumns.lastUsed`,`Last used`),sortValue:e=>e.lastUsedAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ge(e.lastUsedAt,Y.t(`access.credentialColumns.never`))})},{key:`expires`,header:Y.t(`access.credentialColumns.expires`,`Expires`),sortValue:e=>e.expiresAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ge(e.expiresAt,t.expiresNone)})},t.action===null?null:{key:`actions`,header:``,align:`right`,notSortableReason:Y.t(`access.credentialColumns.actionsHeader`),render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[...t.extraActions??[],t.action].map(t=>t===null?null:n(ve,{row:e,action:t},t.label))})}].filter(e=>e!==null)}a();var be=6,xe={"current-session":`access.bulk.skipCurrentSession`,"not-active":`access.bulk.skipNotActive`};function Se(e){let t=xe[e];return t===void 0?e:Y.t(t)}function Ce(e,t){return Y.t(t.key,{count:e})}function Q(e,t){return Y.t(`access.bulk.countOf`,{count:e,noun:Ce(e,t)})}function we(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return[...t.entries()].map(([e,t])=>Y.t(`access.bulk.statusCount`,{count:t,status:pe(e).toLowerCase()})).join(`, `)}function Te(e,t){let n=e.slice(0,be).map(e=>`• ${e.name} — ${e.ownerName}`),r=e.length>be?[Y.t(`access.bulk.previewMore`,{count:e.length-be})]:[];return[Y.t(`access.bulk.previewIntro`,{what:Q(e.length,t),breakdown:we(e)}),``,...n,...r].join(`
|
|
2
|
-
`)}async function Ee(e,t,n){let r=String(t.length),i=await e({title:Y.t(`access.bulk.confirmTitle`,{what:Q(t.length,n)}),message:Te(t,n),label:Y.t(`access.bulk.confirmLabel`,{expected:r}),placeholder:r,confirmLabel:Y.t(`access.bulk.confirmButton`,{expected:r}),variant:`danger`,validate:e=>e.trim()===r?null:Y.t(`access.bulk.confirmMismatch`,{expected:r,noun:Ce(2,n)})});return i!==null&&i.trim()===r}function De(e,t){let n=h(),r=N.auth.revokeCredentials.useMutation(),[a,o]=i(null);return{run:async i=>{if(i.length===0||!await Ee(n,i,e))return!1;o(null);try{let t=await r.mutateAsync({ids:i.map(e=>e.id),confirmCount:i.length}),n=t.skipped.map(e=>Se(e.reason));return o({tone:`success`,message:n.length>0?Y.t(`access.bulk.revokedSkipped`,{what:Q(t.revoked.length,e),count:n.length,reasons:[...new Set(n)].join(`, `)}):Y.t(`access.bulk.revoked`,{what:Q(t.revoked.length,e)})}),!0}catch(e){return o({tone:`danger`,message:Y.t(`access.bulk.revokeFailed`,{error:e instanceof Error?e.message:Y.t(`access.bulk.requestFailed`)})}),!1}finally{t()}},busy:r.isPending,outcome:a,dismiss:()=>o(null)}}function Oe(e,t,n){let r=h(),[a,o]=i(!1),[s,c]=i(null);return{run:async i=>{if(i.length===0||!await Ee(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:Y.t(`access.bulk.requestFailed`)}`)}return o(!1),n(),a.length===0?(c({tone:`success`,message:Y.t(`access.bulk.revoked`,{what:Q(s,e)})}),!0):(c({tone:`danger`,message:Y.t(a.length>3?`access.bulk.eachPartialMore`:`access.bulk.eachPartial`,{what:Q(s,e),count:a.length,details:a.slice(0,3).join(`; `)})}),s>0)},busy:a,outcome:s,dismiss:()=>c(null)}}a();var ke={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}]},Ae={status:`access.credentialTable.groupStatus`,owner:`access.credentialTable.groupOwner`,kind:`access.credentialTable.groupKind`},je=e=>e.status!==`current`,Me=[`active`,`current`];function Ne({rows:r,label:a,isLoading:o,loadError:s,emptyText:c,hideOwner:l=!1,expiresNone:u,action:d,extraActions:p,bulk:m,defaultStatus:h=Me}){let{t:g}=X(),[_]=i(()=>h.length===0?{search:``,facets:[]}:{search:``,facets:[],groups:{status:[...h]}}),v=P(r,ke,_),[y,b]=i(()=>new Set),x=u??g(`access.credentialColumns.never`),S=t(()=>ye({hideOwner:l,expiresNone:x,action:d??null,...p===void 0?{}:{extraActions:p}}),[l,x,d,p,g]),C=t(()=>m===void 0?()=>!1:e=>je(e)&&m.isSelectable(e),[m]),w=t(()=>v.rows.filter(e=>y.has(e.id)&&C(e)),[v.rows,y,C]);return o?e(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[n(f,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),g(`access.credentialTable.loading`,{label:a})]}):s===null?e(`div`,{className:`space-y-3`,children:[n(F,{state:v.state,facets:v.facets,groups:v.groups.filter(e=>!(l&&e.id===`owner`)).map(e=>({...e,label:Ae[e.id]===void 0?e.id:g(Ae[e.id]),...e.id===`status`?{facetLabel:e=>pe(e)}:{}})),labels:{searchPlaceholder:g(`access.credentialTable.searchPlaceholder`,{label:a}),searchLabel:g(`access.credentialTable.searchLabel`,{label:a}),facetsLabel:g(`access.credentialTable.facetsLabel`,{label:a}),clearLabel:g(`access.credentialTable.clearFilters`)},onSearch:v.setSearch,onToggleFacet:v.toggleFacet,onToggleGroupFacet:v.toggleGroupFacet,onClear:v.clear}),m!==void 0&&n(Pe,{bulk:m,shown:v.rows.filter(C),targets:w,onSelect:b}),n(B,{columns:S,rows:v.rows,rowKey:e=>e.id,minWidthPx:l?760:860,maxBodyHeight:U,defaultSort:{columnKey:`created`,dir:`desc`},pageSize:25,paginationLabels:{navLabel:g(`access.credentialTable.pagesLabel`,{label:a}),previous:g(`access.credentialTable.previousPage`),next:g(`access.credentialTable.nextPage`),range:(e,t,n)=>g(`access.credentialTable.range`,{from:e,to:t,total:n})},emptyMessage:v.active?g(`access.credentialTable.noMatchTheFilters`,`No {{label}} match the filters.`,{label:a}):c,rowClassName:e=>e.status===`revoked`||e.status===`expired`?`opacity-70`:void 0,...m===void 0?{}:{selection:{selected:y,onChange:b,isSelectable:C,rowLabel:e=>g(`access.credentialTable.rowLabel`,{name:e.name,owner:e.ownerName}),pageLabel:g(`access.credentialTable.pageLabel`,{noun:Ce(1,m.noun)})}}})]}):n(T,{title:g(`access.credentialTable.couldNotLoad`,`Could not load {{label}}`,{label:a}),message:s})}function Pe({bulk:t,shown:r,targets:i,onSelect:a}){let{t:o}=X(),{revoke:s,noun:c}=t,l=(t.quickSelect??[]).map(e=>({...e,rows:r.filter(e.match)})).filter(e=>e.rows.length>0),u=async()=>{await s.run(i)&&a(new Set)};return e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`bulk-bar`,children:[r.length>0&&n(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(new Set(r.map(e=>e.id))),children:o(`access.credentialTable.selectAllShown`,{count:r.length})}),l.map(t=>e(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(new Set(t.rows.map(e=>e.id))),children:[t.label,` (`,String(t.rows.length),`)`]},t.label)),i.length>0&&e(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[n(`span`,{className:`text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:o(`access.credentialTable.selectedLabel`,{what:Q(i.length,c)})}),e(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>a(new Set),children:[n(d,{className:`h-3 w-3`,"aria-hidden":!0}),o(`access.credentialTable.clearSelection`,`Clear selection`)]}),e(q,{type:`button`,variant:`danger`,size:`sm`,disabled:s.busy,onClick:()=>void u(),children:[s.busy?n(f,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(p,{className:`h-3 w-3`,"aria-hidden":!0}),o(`access.credentialTable.revoke`,{what:Q(i.length,c)})]})]})]})}var Fe=(e,t)=>t===null?`—`:e.get(t)??t;function Ie(e,t){return e!=null&&e<=t?`expired`:`active`}function Le(e,t,n){return{id:e.id,name:n.client(e.client),detail:e.ip,ownerId:e.userId,ownerName:Fe(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 Re(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 ze=`All permissions`,Be=`View link`,Ve=`Scoped`,He={"grid-view":`Grid`,"events-view":`Events`};function Ue(e,t){return e.map(e=>t.get(e)??`#${String(e)}`).join(`, `)}function We(e){return e!==`*`&&e.type===`share-view`&&`grant`in e}function Ge(e,t,n){return e===`*`?ze:We(e)?`${`${He[e.grant.kind]} view${e.grant.talk===!0?` + talk`:``}`}: ${Ue(e.grant.deviceIds,t)}`:n(e)}function Ke(e){return e.includes(`*`)?ze:e.some(We)?Be:Ve}function qe(e,t,n,r){return{id:e.id,name:e.label,detail:null,ownerId:e.subjectId,ownerName:Fe(t,e.subjectId),kind:Ke(e.scopes),scope:n,status:e.revokedAt===null?Ie(e.expiresAt,r):`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Je(e){return`${e.provider}\u0000${e.subject}`}function Ye(e,t){return{id:Je(e),name:e.label??e.subject,detail:e.issuer,ownerId:e.userId,ownerName:Fe(t,e.userId),kind:e.provider,scope:null,status:`active`,createdAt:e.linkedAt,lastUsedAt:null,expiresAt:null}}var Xe=40,Ze=[{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`}],Qe=[{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`}],$e=[{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 et(e,t){return e.find(e=>e.test.test(t))?.name??null}function tt(e){return e.length<=Xe?e:`${e.slice(0,Xe)}…`}function nt(e){if(e===null||e.trim().length===0)return{label:Y.t(`helpers.sessionClient.unknownDevice`),raw:null};let t=e.trim(),n=et($e,t);if(n!==null)return{label:n,raw:t};let r=et(Ze,t),i=et(Qe,t);return r!==null&&i!==null?{label:Y.t(`helpers.sessionClient.browserOnSystem`,{browser:r,system:i}),raw:t}:r===null?{label:tt(t),raw:t}:{label:r,raw:t}}var rt={password:`helpers.sessionClient.method.password`,passkey:`helpers.sessionClient.method.passkey`,sso:`helpers.sessionClient.method.sso`,handoff:`helpers.sessionClient.method.handoff`,"cli-approval":`helpers.sessionClient.method.cliApproval`,exchange:`helpers.sessionClient.method.exchange`};function it(e){let t=rt[e];return t===void 0?e:Y.t(t)}function at(e){if(e==null)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}function ot({token:t,label:r,onClose:i}){let{t:a}=X();return n(k,{open:!0,onOpenChange:e=>!e&&i(),children:e(I,{width:`md`,scroll:`body`,children:[n(H,{children:n(D,{children:a(`auth.tokenModals.token`,`Token: {{label}}`,{label:r})})}),e(j,{className:`space-y-3`,children:[n(`div`,{className:`rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning`,children:a(`auth.tokenModals.copyThisTokenNowOnce`,`Copy this token now. Once you close this dialog the secret cannot be displayed again.`)}),n(`div`,{className:`select-all break-all rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:t})]}),e(w,{children:[n(E,{value:t,label:a(`common.copy`,`Copy`),srLabel:`token`}),n(q,{type:`button`,variant:`primary`,size:`sm`,onClick:i,children:a(`auth.tokenModals.done`,`Done`)})]})]})})}var st={token:`newToken`,scoped:`newScoped`,admin:`newAdmin`};a();var ct=80,$=86400,lt=[{value:`1`,seconds:$},{value:`7`,seconds:7*$},{value:`30`,seconds:30*$},{value:`90`,seconds:90*$},{value:`never`,seconds:`never`}],ut={type:`device-multiselect`,key:`cameras`,deviceFilter:{types:[`camera`]},maxItems:64},dt={type:`capability`,target:``,access:[`view`,`create`]};function ft({open:a,users:c,onClose:l,onSubmit:d,submitting:p,formError:m,awaitingProof:h}){let{t:v}=X(),b=o(),{user:x}=oe(),C=x?.isAdmin===!0,w=C?null:x?.scopes??[],[T,te]=i(`scopes`),[E,D]=i(x?.id??``),[O,k]=i(``),[A,j]=i([dt]),[N,P]=i([]),[F,I]=i(`grid-view`),[R,z]=i(!1),[B,V]=i(`30`);r(()=>{a||(te(`scopes`),D(x?.id??``),k(``),j([dt]),P([]),I(`grid-view`),z(!1),V(`30`))},[a,x?.id]),r(()=>{T!==`view-link`&&B===`never`&&V(`30`)},[T,B]);let H=t(()=>lt.filter(e=>e.seconds!==`never`||T===`view-link`).map(e=>({value:e.value,label:e.seconds===`never`?v(`access.createTokenModal.never`,`Never (until revoked)`):v(`access.createTokenModal.days`,{count:Number(e.value)})})),[T,v]),U=O.trim(),J=T===`scopes`?ee(A,b):null,Y=N.map(Number).filter(e=>Number.isInteger(e)&&e>=0),se=lt.find(e=>e.value===B)?.seconds??30*$,ce=()=>T===`all`?[`*`]:T===`view-link`?[{type:`share-view`,grant:{kind:F,deviceIds:Y,...R?{talk:!0}:{}}}]:A,le=U.length>0&&U.length<=ct&&!p&&!h&&(T===`all`?C:T===`view-link`?Y.length>0:A.length>0&&J===null),ue=()=>{if(!le)return;let e=C&&T!==`all`&&E!==``&&E!==x?.id;d({scopes:ce(),expiresIn:se,label:U,...e?{subjectId:E}:{}})},Z=T===`all`,de=Z?y:s;return n(re,{open:a,onClose:l,title:v(`access.createTokenModal.createToken`,`Create token`),icon:Z?y:S,error:m,width:`md`,testId:`create-token-dialog`,footer:e(q,{type:`button`,variant:Z?`danger`:`primary`,size:`sm`,onClick:ue,disabled:!le,"data-testid":`create-token-submit`,children:[p||h?n(f,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}):n(de,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),v(`access.createTokenModal.issueToken`,`Issue token`)]}),children:e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`space-y-1`,children:[n(K,{children:v(`access.createTokenModal.whatItMayDo`,`What it may do`)}),n(ne,{appearance:`pills`,value:T,onValueChange:e=>{(e===`scopes`||e===`view-link`||e===`all`)&&te(e)},children:e(ie,{"aria-label":v(`access.createTokenModal.whatItMayDo`,`What it may do`),children:[e(G,{value:`scopes`,"data-testid":`token-reach-scopes`,children:[n(s,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),v(`access.createTokenModal.reachScopes`,`Scopes`)]}),e(G,{value:`view-link`,"data-testid":`token-reach-view-link`,children:[n(g,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),v(`access.createTokenModal.reachViewLink`,`View link`)]}),C?e(G,{value:`all`,"data-testid":`token-reach-all`,children:[n(y,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),v(`access.createTokenModal.reachAll`,`All permissions`)]}):null]})})]}),Z?n(`div`,{className:`space-y-1 rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px] leading-relaxed text-foreground`,"data-testid":`admin-token-warning`,children:n(`p`,{children:n(ae,{i18nKey:`auth.adminTokenNoticeShort`,components:{strong:n(`strong`,{})}})})}):null,C&&T!==`all`&&c.length>1?e(`div`,{className:`space-y-1`,children:[n(K,{htmlFor:`token-user`,children:v(`access.createTokenModal.onBehalfOfUser`,`On behalf of user`)}),n(_,{id:`token-user`,value:E,onChange:e=>D(e.target.value),options:c.map(e=>({value:e.id,label:e.username}))})]}):null,e(`div`,{className:`space-y-1`,children:[n(K,{htmlFor:`token-name`,children:v(`access.createTokenModal.label`,`Label`)}),n(W,{id:`token-name`,value:O,maxLength:ct,required:!0,onChange:e=>k(e.target.value),placeholder:T===`view-link`?`kitchen-wall`:`nightly-backup`,autoFocus:!0})]}),T===`scopes`?e(`div`,{className:`space-y-1`,children:[n(K,{children:v(`access.createTokenModal.scopes`,`Scopes`)}),n(L,{value:A,onChange:j,clampToParent:w}),J&&n(`p`,{className:`text-[10px] text-danger`,children:J}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:v(`access.createTokenModal.eachScopePicksACap`,`Each scope picks a (cap or addon) target + one or more access flavours. The token can access ONLY what's listed.`)})]}):null,T===`view-link`?e(`div`,{className:`space-y-2`,"data-testid":`token-view-link`,children:[e(`div`,{className:`space-y-1`,children:[n(K,{children:v(`access.createTokenModal.cameras`,`Cameras`)}),n(M,{field:{...ut,label:v(`access.createTokenModal.cameras`,`Cameras`)},value:N,onChange:e=>P(Array.isArray(e)?e.filter(e=>typeof e==`string`):[])})]}),e(`div`,{className:`space-y-1`,children:[n(K,{htmlFor:`token-view-kind`,children:v(`access.createTokenModal.viewKind`,`Shows`)}),n(_,{id:`token-view-kind`,value:F,onChange:e=>I(e.target.value===`events-view`?`events-view`:`grid-view`),options:[{value:`grid-view`,label:v(`access.createTokenModal.viewGrid`,`Live grid`)},{value:`events-view`,label:v(`access.createTokenModal.viewEvents`,`Events`)}]})]}),F===`grid-view`?e(`label`,{className:`flex items-start gap-2 text-sm text-foreground`,children:[n(u,{className:`mt-0.5`,checked:R,onChange:e=>z(e.target.checked),"data-testid":`token-view-talk`}),n(`span`,{children:v(`access.createTokenModal.talk`,`Allow talk-back on these cameras`)})]}):null]}):null,e(`div`,{className:`space-y-1`,children:[n(K,{htmlFor:`token-lifetime`,children:v(`access.createTokenModal.expires`,`Expires after`)}),n(_,{id:`token-lifetime`,value:B,onChange:e=>V(e.target.value),options:H})]})]})})}a();var pt={key:`access.nouns.token`};function mt(e){return typeof e==`object`&&!!e&&`kind`in e}function ht(e,t){let n=e.access===void 0?``:` [${e.access.join(`, `)}]`;return e.type===`device`?`device:[${mt(e.selector)?O(e.selector,t):`?`}]${n}`:e.type===`addon-routes`?`${t(`access.tokensSection.everyAddonRoutes`,`every addon's routes`)}${n}`:`${e.type}:${e.target??``}${n}`}function gt({headerOwnsCreate:a=!1,createRequested:s=!1,onCreateConsumed:c,ownOnly:l=!1}){let{t:u}=X(),d=o(),{user:f}=oe(),h=m(),g=N.useUtils(),_=Z(),{data:v}=z(),y=t(()=>v??[],[v]),{data:b}=A({}),x=t(()=>{let e=new Map;for(let t of b??[])e.set(t.id,t.name);return e},[b]),C=N.auth.listTokens.useQuery(void 0),{requestProof:w,dialog:T}=se(`Creating a token with all permissions`),{state:ee,openNew:E,close:D}=te({newKey:st.token}),[O,k]=i(null),[j,M]=i(null),[P,F]=i(!1),[I,L]=i(null),[R,B]=i(null);r(()=>{s&&(E(),c?.())},[s,E,c]);let V=()=>{g.auth.listTokens.invalidate(),g.auth.listAuthAudit.invalidate()},H=N.auth.mintToken.useMutation({onSuccess:({token:e,record:t})=>{V(),D(),M(null),F(!1),L({token:e,label:t.label})},onError:e=>{M(`Create failed: ${e.message}`),F(!1)}}),U=N.auth.revokeToken.useMutation({onSuccess:()=>{B(null),V()},onError:e=>{B(null),k(`Revoke failed: ${e.message}`)}}),W=De(pt,V),ne=Date.now(),G=(C.data??[]).filter(e=>!l||e.subjectId===f?.id).map(e=>qe(e,_,e.scopes.includes(`*`)?null:e.scopes.map(e=>Ge(e,x,e=>ht(e,d))).join(`, `),ne)),K=async e=>{await h({title:u(`access.tokensSection.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:e.kind===`All permissions`?u(`access.tokensSection.everyScriptUsingItLoses`,`Every script using it loses access immediately. This cannot be undone.`):u(`access.tokensSection.stopsWorking`,`Whoever holds it loses access immediately. This cannot be undone.`),confirmLabel:u(`access.tokensSection.revoke2`,`Revoke`),variant:`danger`})&&(k(null),B(e.id),U.mutate({id:e.id}))},re=e=>{(async()=>{k(null),M(null);let t;if(e.scopes.includes(`*`)){F(!0);let e=await w();if(F(!1),e===null)return;t=e}H.mutate({scopes:[...e.scopes],expiresIn:e.expiresIn,label:e.label,...e.subjectId===void 0?{}:{subjectId:e.subjectId},...t===void 0?{}:{reauthToken:t}})})()};return e(`div`,{"data-testid":`tokens`,children:[T,n(ce,{notice:de(O,W.outcome),onDismissNotice:()=>{k(null),W.dismiss()},id:l?`my-tokens`:`tokens`,title:l?u(`access.tokensSection.myTokens`,`My tokens`):u(`access.tokensSection.tokens`,`Tokens`),icon:S,actions:a?void 0:e(q,{size:`sm`,type:`button`,"data-testid":`tokens-new`,onClick:E,children:[n(S,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),u(`system.access.newToken`,`New token`)]}),description:u(`access.tokensSection.oneFormat`,`Every token is its scopes: a few permissions for a script, all permissions for an admin script, or a view of some cameras for a share link. Revoking one stops it on its next use.`),children:n(Ne,{rows:G,label:u(`common.tokensLabel`),isLoading:C.isLoading,loadError:C.isError?C.error?.message??`Request failed`:null,emptyText:u(`access.tokensSection.noTokens`,`No tokens.`),action:{label:u(`access.tokensSection.revoke2`,`Revoke`),icon:p,isAvailable:e=>e.status===`active`,onRun:e=>void K(e),busyId:R,disabled:W.busy||R!==null},...f?.isAdmin===!0?{bulk:{revoke:W,noun:pt,isSelectable:e=>e.status===`active`}}:{}})}),n(ft,{open:ee.mode===`new`,users:y.map(e=>({id:e.id,username:e.username})),onClose:()=>{D(),M(null),F(!1)},submitting:H.isPending,formError:j,awaitingProof:P,onSubmit:re}),I&&n(ot,{token:I.token,label:I.label,onClose:()=>L(null)})]})}var _t=864e5,vt={qr:`QR (by an admin)`,self:`Self-enrolled`},yt={ios:`iOS`,android:`Android`,web:`Web`,other:`Other`};function bt(e){return e.status===`revoked`}function xt(e){return e.status!==`revoked`}function St(e,t=`—`){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function Ct(e,t){return e===null||Number.isNaN(e)?null:Math.floor((e-t)/_t)}function wt(e,t){let n=Ct(e,t);return n===null?`unknown`:n<0?`expired`:n<30?`soon`:`ok`}function Tt(e,t){let n=Ct(e,t);return n===null?Y.t(`helpers.certificateModel.unknown`):n===0?Y.t(`helpers.certificateModel.today`):n>0?Y.t(`helpers.certificateModel.inDays`,{count:n}):Y.t(`helpers.certificateModel.daysAgo`,{count:-n})}function Et(e){if(e===null)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Dt(e){return e===null||e.length===0?`—`:e.length<=17?e:`${e.slice(0,8)}…${e.slice(-8)}`}function Ot(e){return e.length<=10?e:`${e.slice(0,10)}…`}function kt(e){if(!e.online)return{allowed:!1,reason:Y.t(`helpers.certificateModel.nodeOffline`)};if(e.isHub&&e.https.kind===`served`){if(e.https.status.mode===`uploaded`)return{allowed:!1,reason:Y.t(`helpers.certificateModel.uploadedCert`)};if(e.https.status.mode===`disabled`)return{allowed:!1,reason:Y.t(`helpers.certificateModel.tlsDisabled`)}}return{allowed:!0,reason:null}}var At={prepare:`helpers.certificateModel.stage.prepare`,issue:`helpers.certificateModel.stage.issue`,install:`helpers.certificateModel.stage.install`,reconnect:`helpers.certificateModel.stage.reconnect`,confirm:`helpers.certificateModel.stage.confirm`};function jt(e){if(e.ok)return{tone:`success`,message:Y.t(`helpers.certificateModel.renewed`,{nodeId:e.nodeId,serial:Ot(e.newSerial)})};let t=e.keptPreviousLeaf?Y.t(`helpers.certificateModel.keptPrevious`):Y.t(`helpers.certificateModel.maybeNoCert`);return{tone:`danger`,message:Y.t(`helpers.certificateModel.renewalFailed`,{nodeId:e.nodeId,stage:Y.t(At[e.stage]),reason:e.reason,kept:t})}}function Mt(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 Nt=11;function Pt(e,t){let n=e.slice(0,Nt);return t===null?n:`${n} · ${t}`}function Ft(e){return{id:e.id,name:e.deviceName,detail:Pt(e.fingerprint,e.lastUsedFrom),ownerId:e.userId,ownerName:e.username??e.userId,kind:yt[e.platform],scope:vt[e.enrolledVia],status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function It(e,t){return{id:e.id,name:e.deviceName,detail:null,ownerId:null,ownerName:t,kind:yt[e.platform],scope:null,status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Lt({sessions:t,isLoading:r,loadError:i,emptyText:a,onRevoke:o,revokingId:s}){let{t:c}=X();return r?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[n(f,{className:`h-3.5 w-3.5 animate-spin`}),c(`auth.sessionsList.loadingSessions`,`Loading sessions…`)]}):i===null?t.length===0?n(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center`,children:a}):n(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:t.map(e=>n(Rt,{session:e,revoking:s===e.id,onRevoke:()=>o(e)},e.id))}):e(`div`,{className:`text-[11px] text-danger`,children:[c(`auth.sessionsList.couldNotLoadSessions`,`Could not load sessions:`),` `,i]})}function Rt({session:t,revoking:r,onRevoke:i}){let{t:a}=X(),o=nt(t.client);return e(`li`,{"data-testid":`session-row`,className:`flex items-start gap-3 px-3 py-2 text-xs`,children:[n(C,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),e(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[n(`span`,{className:`font-medium text-foreground truncate`,title:o.raw??void 0,children:o.label}),t.current&&n(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:a(`auth.sessionsList.thisDevice`,`This device`)})]}),e(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[n(`span`,{children:it(t.method)}),n(`span`,{className:`font-mono`,children:t.ip??a(`auth.sessionsList.ipUnknown`,`IP unknown`)}),n(`span`,{children:a(`auth.sessionsList.lastActive`,{when:at(t.lastUsedAt)})}),n(`span`,{children:a(`auth.sessionsList.expires`,{when:at(t.expiresAt)})})]})]}),!t.current&&e(q,{variant:`unstyled`,onClick:i,disabled:r,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[r?n(f,{className:`h-3 w-3 animate-spin`}):n(x,{className:`h-3 w-3`}),a(`auth.sessionsList.signOut`,`Sign out`)]})]})}export{Le as C,ce as D,Oe as E,de as O,Re as S,De as T,nt as _,xt as a,Je as b,Tt as c,St as d,kt as f,st as g,gt as h,bt as i,Z as k,jt as l,Ot as m,Ft as n,Mt as o,Dt as p,It as r,Et as s,Lt as t,wt as u,it as v,Ne as w,Ye as x,at as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,et as a,o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Gn as s,Sn as c,St as l,Tr as u,Vr as d,ct as f,ii as p}from"./player-overlays-BZByYYB8.js";import{ys as m}from"./client-mnldOm50.js";import{t as h}from"./chevron-down-CBb-F8DT.js";import{t as g}from"./archive-ChKlYFY2.js";import{t as _}from"./eraser-B3lnG9yK.js";import{t as v}from"./hard-drive-download-C6N6tovA.js";import{$i as y,$u as b,Ti as x,Xs as S,ed as C,ji as w,of as T,td as ee,wu as te}from"./src-DKRp5NPI.js";import{t as E}from"./i18n-ByFr51sS.js";import{t as D}from"./useTranslation-BJr-n0es.js";import{Y as O,ot as k}from"./index-D5GcZJtC.js";import{t as A}from"./format-size-DIxKXxtj.js";import{t as ne}from"./InstancesTable-BagVOERb.js";a();var re=`forceDeleteLocation`;function ie({row:e}){let{t}=D(),r=f(),i=o(),a=y(),s=async()=>{if(await r({title:t(`system.storage.forceDeleteTitle`,`Force delete "{{name}}"?`,{name:e.name}),message:t(`system.storage.forceDeleteNote`,`Removes the record only, without checking what is on the location. Anything still stored there becomes unreachable — index rows naming it stop resolving, and playback of those segments goes silently black rather than erroring.`),confirmLabel:t(`system.storage.forceDelete`,`Force delete`),variant:`danger`}))try{await a.mutateAsync({addonId:e.addonId,action:re,input:{id:e.id}}),await i.invalidateQueries({queryKey:[O]}),await i.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}catch(n){k({title:t(`providerInstances.deleteFailed`,`Could not delete`),message:`${e.name}: ${n instanceof Error?n.message:String(n)}`,severity:`critical`})}};return n(T,{icon:c,variant:`ghost`,size:`sm`,disabled:a.isPending,"aria-label":t(`system.storage.forceDeleteRow`,`Force delete {{name}}`,{name:e.name}),onClick:()=>void s()})}function ae(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function oe(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function j({drain:t}){let{t:r}=D();if(t.kind===`idle`)return null;if(t.kind===`unreported`)return n(`span`,{"data-testid":`drain-unreported`,className:`text-[10px] text-foreground-subtle`,title:r(`storage.drainProgressLine.thisLocationIsDrainingThe`,`This location is draining. The hub has not reported how much is left yet — either the drain has just been set, or this hub predates the drain-progress report.`),children:r(`storage.drainProgressLine.drainingRemainingNotReportedYet`,`Draining · remaining not reported yet`)});if(t.kind===`drained`)return n(`span`,{"data-testid":`drain-done`,className:`text-[10px] text-success`,title:r(`storage.drainProgressLine.everythingThatWasHereHas`,`Everything that was here has been moved. The location is still in drain mode — it receives no new writes until you change that.`),children:r(`storage.drainProgressLine.drainedNothingLeftToMove`,`Drained · nothing left to move`)});let i=t.drainedFraction===null?null:Math.round(t.drainedFraction*100);return e(`span`,{"data-testid":`drain-progress`,className:`flex items-center gap-1.5 text-[10px] text-foreground-subtle tabular-nums`,children:[i!==null&&n(`span`,{"data-testid":`drain-bar`,className:`inline-block h-1 w-10 rounded-full bg-border overflow-hidden`,role:`progressbar`,"aria-label":r(`storage.drainProgressLine.drainProgress`,`Drain progress`),"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:n(`span`,{className:`block h-full bg-warning`,style:{width:`${i}%`}})}),e(`span`,{children:[r(`storage.drainProgressLine.left`,{size:ae(t.bytesRemaining)}),i!==null&&` · ${r(`storage.drainProgressLine.moved`,{percent:i})}`]}),t.estimatedEmptyAtMs===null?n(`span`,{"data-testid":`drain-eta-absent`,title:r(`storage.drainProgressLine.theDrainIsPacedBy`,`The drain is paced by how fast this class of data is still growing, and that has not been observed yet. There is no date to give.`),children:r(`storage.drainProgressLine.emptyTimeNotKnownYet`,`· empty time not known yet`)}):e(`span`,{"data-testid":`drain-eta`,children:[`·`,` `,r(`storage.drainProgressLine.empty`,{when:oe(t.estimatedEmptyAtMs)})]})]})}var M=[`ok`,`warn`,`critical`];function N(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function P(e){return Math.min(1,Math.max(0,e))}function F(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=P((n-t)/n);return{fraction:r,severity:N(r),recordingsFraction:P(e.usedBytes/n),freeBytes:t,totalBytes:n}}function se(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=F(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||M.indexOf(e.severity)>M.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}function I(e){return Math.min(1,Math.max(0,e))}function L(e){return Math.round(I(e)*1e3)/10}function R(e){return`${String(Math.round(I(e)*100))}%`}function ce(e,t,n={}){let{totalBytes:r,availableBytes:i}=e;if(r===null||r<=0||i===null){let e=n.ownedBytes===void 0||n.ownedBytes===null||!Number.isFinite(n.ownedBytes)||n.ownedBytes<0?null:A(n.ownedBytes);return{kind:`unknown`,owned:e,summary:e===null?E.t(`helpers.locationCapacityBar.unknownSummary`):E.t(`helpers.locationCapacityBar.unknownSummaryOwned`,{size:e})}}let a=Math.min(Math.max(i,0),r),o=r-a,s=t===null||t<=0?0:t,c=Math.min(s,a),l=s>a,u=a-c,d=n.ownedBytes,f=d==null||!Number.isFinite(d)||d<0?null:Math.min(d,o),p=o-(f??0),m=F({usedBytes:f??o,availableBytes:a,totalBytes:r}),h=m===null?I(o/r):m.fraction,g=m===null?N(h):m.severity,_=f===null?null:m===null?I(f/r):m.recordingsFraction,v=n.cap??null,y=v===null?null:I((c+v.bytes)/r),b=v!==null&&f!==null&&f>v.bytes,x={total:A(r),freeTotal:A(a),freeTotalPercent:R(a/r),used:A(p),usedPercent:R(p/r),free:A(u),freePercent:R(u/r),reserve:s===0?null:E.t(`helpers.locationCapacityBar.reserveKept`,{size:A(s)}),owned:f===null||_===null?null:E.t(`helpers.locationCapacityBar.ownedOfRecordings`,{size:A(f),percent:R(_)}),cap:v===null?null:v.reason===`drain`?E.t(`helpers.locationCapacityBar.capDrain`,{size:A(v.bytes)}):E.t(`helpers.locationCapacityBar.capCap`,{size:A(v.bytes)})},S=[E.t(`helpers.locationCapacityBar.summaryFree`,{free:x.freeTotal,total:x.total,percent:x.freeTotalPercent}),x.owned===null?null:E.t(`helpers.locationCapacityBar.summaryOwned`,{owned:x.owned}),x.reserve===null?null:l?E.t(`helpers.locationCapacityBar.summaryReserveShort`,{reserve:x.reserve}):x.reserve,x.cap===null?null:b?E.t(`helpers.locationCapacityBar.summaryCapBelow`,{cap:x.cap}):x.cap].filter(e=>e!==null).join(` · `),C=[];return c>0&&C.push({segment:`reserve`,label:E.t(`helpers.locationCapacityBar.legendKeptFree`),value:A(s),alarming:l}),x.owned!==null&&C.push({segment:`owned`,label:E.t(`helpers.locationCapacityBar.legendCamstack`),value:x.owned,alarming:!1}),C.push({segment:`used`,label:f===null?E.t(`helpers.locationCapacityBar.legendUsed`):E.t(`helpers.locationCapacityBar.legendOtherData`),value:`${x.used} (${x.usedPercent})`,alarming:g===`critical`}),C.push({segment:`free`,label:E.t(`helpers.locationCapacityBar.legendFree`),value:`${x.free} (${x.freePercent})`,alarming:l}),v!==null&&C.push({segment:`cap`,label:v.reason===`drain`?E.t(`helpers.locationCapacityBar.legendDrainTarget`):E.t(`helpers.locationCapacityBar.legendCap`),value:E.t(`helpers.locationCapacityBar.legendCapValue`,{size:A(v.bytes)}),alarming:b}),{kind:`known`,severity:g,legend:C,segments:{reservePercent:L(c/r),ownedPercent:f===null?null:L(f/r),usedPercent:L(p/r),freePercent:L(u/r),capPercent:y===null?null:L(y)},labels:x,reserveExceedsFree:l,capBelowOwned:b,summary:S}}function z(e){return m(e)}function B(e){return e===`active`}var V=[{mode:`active`,get label(){return E.t(`helpers.locationMode.activeLabel`)},get consequence(){return E.t(`helpers.locationMode.activeConsequence`)},requiresConfirmation:!1},{mode:`readonly`,get label(){return E.t(`helpers.locationMode.readonlyLabel`)},get consequence(){return E.t(`helpers.locationMode.readonlyConsequence`)},requiresConfirmation:!1},{mode:`drain`,get label(){return E.t(`helpers.locationMode.drainLabel`)},get consequence(){return E.t(`helpers.locationMode.drainConsequence`)},requiresConfirmation:!1},{mode:`disabled`,get label(){return E.t(`helpers.locationMode.disabledLabel`)},get consequence(){return E.t(`helpers.locationMode.disabledConsequence`)},requiresConfirmation:!0}];function H(e){return V.find(t=>t.mode===e)??V[0]}function le(e){return H(e).requiresConfirmation}var ue=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function U(e,t,n){return B(n)||!B(z(e))||t.some(t=>t.id!==e.id&&B(z(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:ue}}function de(e,t){return{active:U(e,t,`active`).reason,readonly:U(e,t,`readonly`).reason,drain:U(e,t,`drain`).reason,disabled:U(e,t,`disabled`).reason}}var W=1024**3;function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function fe(e){let t=G(e.minFreeGb);if(t!==null)return{unit:`gb`,value:t};let n=G(e.minFreePercent);return n===null?{unit:`percent`,value:null}:{unit:`percent`,value:n}}function pe(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*W;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function me(e,t){let n=G(e.maxUsedGb);return n===null||n<0?null:{bytes:n*W,reason:t===`drain`?`drain`:`legacy`}}var K={ok:`bg-primary`,warn:`bg-warning`,critical:`bg-danger`},q={reserve:`bg-danger/40`,owned:`bg-foreground/50`,free:`bg-border`,cap:`bg-foreground`};function he(e,t){return e===`used`?K[t]:q[e]}function J({location:t,ownedBytes:r}){let{t:i}=D(),a=t.capacity??null,o=pe(fe(t.config),a?.totalBytes??null),s=ce({totalBytes:a?.totalBytes??null,availableBytes:a?.availableBytes??null},o,{ownedBytes:r??null,cap:me(t.config,z(t))});return s.kind===`unknown`?n(`div`,{className:`text-[10px] text-foreground-subtle italic`,title:s.summary,children:s.owned===null?i(`storage.locationCapacityBar.capacityUnknown`,`Capacity unknown`):i(`storage.locationCapacityBar.capacityUnknownCamstackHolds`,`Capacity unknown · CamStack holds {{owned}}`,{owned:s.owned})}):e(`div`,{className:`mt-1 space-y-1`,title:s.summary,children:[e(`div`,{className:`relative flex h-2 w-full max-w-md overflow-hidden rounded-full bg-border`,children:[s.segments.reservePercent>0&&n(`div`,{className:q.reserve,style:{width:`${String(s.segments.reservePercent)}%`}}),s.segments.ownedPercent!==null&&n(`div`,{className:q.owned,style:{width:`${String(s.segments.ownedPercent)}%`}}),n(`div`,{className:K[s.severity],style:{width:`${String(s.segments.usedPercent)}%`}}),n(`div`,{className:q.free,style:{width:`${String(s.segments.freePercent)}%`}}),s.segments.capPercent!==null&&n(`div`,{className:`absolute inset-y-0 w-px ${s.capBelowOwned?`bg-danger`:q.cap}`,style:{left:`${String(s.segments.capPercent)}%`}})]}),n(`ul`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:s.legend.map(t=>e(`li`,{className:`flex items-center gap-1`,children:[n(`span`,{"aria-hidden":`true`,className:`inline-block h-2 w-2 shrink-0 rounded-sm ${he(t.segment,s.severity)}`}),e(`span`,{className:`text-[10px] tabular-nums ${t.alarming?`text-danger`:`text-foreground-subtle`}`,children:[t.label,` `,t.value]})]},t.segment))})]})}var ge={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},_e={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},ve=`storage.discardLocation`,Y=`storage.discardLocationStatus`,ye=`storage.discardLocationCancel`;function be(e){return ge[e]??null}function xe(e){return _e[e]??null}function Se(e){return!B(z(e))}function Ce(e,t){return be(e.type)===null||!Se(e)?!1:t.some(t=>t.id!==e.id&&B(z(t)))}var we=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function X(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Z(e){return typeof e==`string`?e:null}function Te(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.running!=`boolean`)return null;let n=t.phase;if(typeof n!=`string`||!we.has(n))return null;let r=X(t.camerasTotal),i=X(t.camerasDone),a=X(t.foldersRemoved),o=X(t.dbRowsDeleted),s=X(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:Z(t.locationId),jobId:Z(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:Z(t.detail)??``,startedAtMs:X(t.startedAtMs),finishedAtMs:X(t.finishedAtMs),error:Z(t.error)}}function Ee(e){if(e.phase===`complete`)return 100;if(e.phase===`cancelled`||e.phase===`error`||e.phase===`idle`)return e.camerasTotal>0?Math.min(99,Math.round(e.camerasDone/e.camerasTotal*100)):0;if(e.camerasTotal>0){let t=e.camerasDone/e.camerasTotal*85;return e.phase===`wiping-db`?Math.min(95,Math.round(t+8)):e.phase===`cascading`?Math.min(99,Math.round(t+12)):Math.min(85,Math.round(t))}return e.phase===`scanning`?2:5}var De=2e3;function Oe({location:e,siblings:t}){return Ce(e,t)?n(ke,{location:e}):null}function ke({location:t}){let{t:a}=D(),o=f(),s=y(),c=xe(t.type),[d,p]=i(null),[m,h]=i(null),[g,v]=i(!1);if(r(()=>{if(c===null)return;let e=!1,t=async()=>{try{let t=await s.mutateAsync({addonId:c,action:Y,input:{}});if(e)return;p(Te(t))}catch{}};t();let n=setInterval(()=>void t(),De);return()=>{e=!0,clearInterval(n)}},[c,t.id]),c===null)return null;let b=d!==null&&d.locationId===t.id,x=b&&d.running,S=b&&d.phase!==`idle`,C=async()=>{if(await o({title:a(`storage.locationDiscardControl.discardLeftoversOn`,`Discard leftovers on "{{displayName}}"?`,{displayName:t.displayName}),message:a(`storage.locationDiscardControl.permanentlyDeletesLeftoverFilesAnd`,`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`),confirmLabel:a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`),variant:`danger`})){h(null),v(!0);try{await s.mutateAsync({addonId:c,action:ve,input:{locationId:t.id}}),p(Te(await s.mutateAsync({addonId:c,action:Y,input:{}})))}catch(e){h(e instanceof Error?e.message:String(e))}finally{v(!1)}}},T=async()=>{try{await s.mutateAsync({addonId:c,action:ye,input:{}})}catch(e){h(e instanceof Error?e.message:String(e))}};return e(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[x?e(w,{variant:`unstyled`,type:`button`,onClick:()=>void T(),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10`,children:[n(l,{className:`h-3 w-3`}),a(`common.cancel`,`Cancel`)]}):e(w,{variant:`unstyled`,type:`button`,onClick:()=>void C(),disabled:g,title:a(`storage.locationDiscardControl.permanentlyDeleteLeftoverFilesOn`,`Permanently delete leftover files on this location. Other locations are not affected.`),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10 disabled:opacity-50`,children:[g?n(u,{className:`h-3 w-3 animate-spin`}):n(_,{className:`h-3 w-3`}),a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`)]}),S&&d!==null&&e(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:n(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${Ee(d)}%`}})}),e(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[d.phase,d.camerasTotal>0?` · ${a(`storage.locationDiscardControl.camsProgress`,{done:d.camerasDone,total:d.camerasTotal})}`:``,d.dbRowsDeleted>0?` · ${a(`storage.locationDiscardControl.rowsDeleted`,{count:d.dbRowsDeleted})}`:``,d.detail?` · ${d.detail}`:``]})]}),(m||b&&d?.error)&&n(`p`,{className:`text-[10px] text-danger leading-tight`,children:m??d?.error})]})}a();var Ae={active:s,readonly:g,drain:v,disabled:p},je={active:`border-success/30 text-success hover:bg-success/10`,readonly:`border-border text-foreground-subtle hover:text-foreground hover:bg-primary/10`,drain:`border-warning/40 text-warning hover:bg-warning/10`,disabled:`border-danger/40 text-danger hover:bg-danger/10`};function Me({mode:t,open:r,onToggle:i}){let{t:a}=D(),o=H(t),s=Ae[t];return e(w,{variant:`unstyled`,type:`button`,"aria-expanded":r,"aria-label":a(`storage.locationModeSelector.locationState`,`Location state`),onClick:i,title:o.consequence,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${je[t]}`,children:[n(s,{className:`h-3 w-3`}),o.label,n(h,{className:`h-3 w-3 ${r?`rotate-180`:``}`})]})}function Ne({mode:t,blockedReasons:i,onSelect:a,onDismiss:o}){let{t:s}=D();return r(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[o]),e(`div`,{className:`w-full basis-full rounded-lg border border-border bg-background p-1`,role:`group`,"aria-label":s(`storage.locationModeSelector.locationStateChoices`,`Location state choices`),children:[e(`div`,{className:`flex items-center justify-between px-2 py-1`,children:[n(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:s(`storage.locationModeSelector.locationState`,`Location state`)}),n(w,{variant:`unstyled`,type:`button`,"aria-label":s(`storage.locationModeSelector.closeLocationStateChoices`,`Close location state choices`),onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:n(l,{className:`h-3 w-3`})})]}),V.map(r=>{let c=i[r.mode],l=c!==``,u=Ae[r.mode],d=r.mode===t;return e(w,{variant:`unstyled`,type:`button`,role:`radio`,"aria-checked":d,"aria-label":r.label,disabled:l,onClick:()=>{l||(o(),d||a(r.mode))},className:`flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left ${l?`cursor-not-allowed opacity-60`:d?`bg-primary/10`:`hover:bg-primary/5`}`,children:[e(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-foreground`,children:[n(u,{className:`h-3 w-3`}),r.label,d&&n(`span`,{className:`text-[9px] uppercase text-primary`,children:s(`common.current`)})]}),n(`span`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:r.consequence}),l&&n(`span`,{className:`text-[10px] leading-snug text-warning`,children:c})]},r.mode)})]})}function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Fe(e){if(!Pe(e))return null;let t=e.locationId;if(typeof t!=`string`||t.length===0)return null;let n=Q(e.startedAtMs),r=Q(e.startBytes),i=Q(e.bytesRemaining);return n===null||r===null||i===null||typeof e.drained!=`boolean`?null:{locationId:t,startedAtMs:n,startBytes:r,bytesRemaining:i,drained:e.drained,estimatedEmptyAtMs:Q(e.estimatedEmptyAtMs)}}function Ie(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){let e=Fe(n);e!==null&&t.set(e.locationId,e)}return t}function Le(e){if(e.startBytes<=0||e.bytesRemaining>e.startBytes)return null;let t=e.startBytes-e.bytesRemaining;return Math.min(1,Math.max(0,t/e.startBytes))}function Re(e,t){return e?t===void 0?{kind:`unreported`}:t.drained||t.bytesRemaining<=0?{kind:`drained`}:{kind:`draining`,bytesRemaining:t.bytesRemaining,drainedFraction:Le(t),estimatedEmptyAtMs:t.estimatedEmptyAtMs}:{kind:`idle`}}function ze(e){return e.mode===`drain`?!0:e.config.readOnly===!0}var Be=[`recordings`,`recordingsLow`];function Ve(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function He(e,t){if(t===void 0||!Be.includes(e.type))return null;let n=t.find(t=>Ve(t).includes(e.id));return n===void 0||!Number.isFinite(n.usedBytes)||n.usedBytes<0?null:n.usedBytes}function Ue(e,t){let n=new Map;for(let r of e){let e=He(r,t);e!==null&&n.set(r.id,e)}return n}a();var We=[];function $(){let e=ee({}),n=te({},{refetchOnWindowFocus:!1}),r=b({},{refetchOnWindowFocus:!1}),i=e.data??We,a=t(()=>Ue(i,n.data?.locations),[i,n.data?.locations]),o=t(()=>Ie(r.data),[r.data]);return t(()=>({locations:i,ownedBytesById:a,drainOf:e=>Re(ze(e),o.get(e.id))}),[i,a,o])}a();function Ge({row:t}){let{t:r}=D(),a=f(),s=o(),c=$(),[l,u]=i(!1),d=S({onSuccess:()=>{s.invalidateQueries({queryKey:[O]}),s.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),u(!1)},onError:e=>k({title:r(`system.storage.modeFailed`,`Could not change the state`),message:`${t.name}: ${e.message}`,severity:`critical`})}),p=c.locations.find(e=>e.id===t.id);if(p===void 0)return null;let m=c.locations.filter(e=>e.type===p.type),h=z(p),g=c.drainOf(p),_=async e=>{le(e)&&!await a({title:r(`system.storage.disable`,`Disable "{{displayName}}"?`,{displayName:p.displayName}),message:r(`system.storage.nothingIsDeletedSetThe`,`{{consequence}} Nothing is deleted — set the location back to Read-only or Active to bring its footage back.`,{consequence:H(e).consequence}),confirmLabel:r(`common.disable`,`Disable`),variant:`danger`})||d.mutate({addonId:t.addonId,id:t.id,values:{mode:e}})};return e(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 rounded-lg border border-border bg-surface p-3`,children:[e(`div`,{className:`min-w-0 flex-1 basis-60`,children:[n(J,{location:p,ownedBytes:c.ownedBytesById.get(p.id)??null}),g.kind!==`idle`&&n(j,{drain:g})]}),e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[n(Oe,{location:p,siblings:m}),n(Me,{mode:h,open:l,onToggle:()=>u(e=>!e)})]}),l&&n(Ne,{mode:h,blockedReasons:de(p,m),onSelect:e=>void _(e),onDismiss:()=>u(!1)})]})}function Ke({row:t}){let r=$();if(t.kind!==`instance`)return null;let i=r.locations.find(e=>e.id===t.id);if(i===void 0)return null;let a=r.drainOf(i);return e(`div`,{className:`min-w-48`,children:[n(J,{location:i,ownedBytes:r.ownedBytesById.get(i.id)??null}),a.kind!==`idle`&&n(j,{drain:a})]})}function qe({row:e}){let t=$();if(e.kind!==`instance`)return null;let r=t.locations.find(t=>t.id===e.id);if(r===void 0)return null;let i=z(r);return n(x,{variant:i===`active`?`success`:i===`disabled`?`danger`:`default`,children:H(i).label})}function Je(e){return[{key:`capacity`,header:e.capacity,notSortableReason:e.capacity,render:e=>n(Ke,{row:e})},{key:`mode`,header:e.mode,nowrap:!0,notSortableReason:e.mode,render:e=>n(qe,{row:e})}]}function Ye(e,t,n){return!(n===`single`||t.length<=1||B(z(e))&&t.filter(e=>B(z(e))).length<=1)}a();var Xe=`storage`;function Ze({kinds:e}){let{t:r}=D(),{locations:i}=$(),a=C({}).data,o=e=>{let t=i.find(t=>t.id===e.id),n=a?.find(e=>e.id===t?.type);return t===void 0||n===void 0?!1:Ye(t,i.filter(e=>e.type===t.type),n.cardinality)},s=t(()=>Je({capacity:r(`system.storage.colCapacity`,`Capacity`),mode:r(`system.storage.colMode`,`State`)}),[r]),c=t(()=>e===void 0?void 0:t=>t.kind===`instance`&&t.kindId!==void 0&&e.includes(t.kindId),[e]);return n(ne,{functionCap:Xe,icon:d,title:r(`system.storage.title`,`Storage locations`),subtitle:r(`system.storage.subtitle`,`Where recordings, event media, artifacts and backups are kept. Each location is one kind on one provider; the state decides whether it takes writes, is only read, drains or is left alone.`),emptyTitle:r(`system.storage.emptyTitle`,`No storage locations yet`),emptyDescription:r(`system.storage.noStorageLocationsDeclaredBy`,`No storage locations declared by any installed addon.`),addLabel:r(`system.storage.addLocation`,`Add location`),extraColumns:s,lead:e=>n(Ge,{row:e}),canDelete:o,rowActions:e=>o(e)?n(ie,{row:e}):null,...c===void 0?{}:{rowFilter:c}})}export{F as n,se as r,Ze as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,a,et as o,o as s,t as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{En as u,Fi as d,Pi as f,Sa as p,Tr as m,br as h,gt as g,mn as _,ut as v,zn as y}from"./player-overlays-BZByYYB8.js";import{As as b}from"./client-mnldOm50.js";import{n as x,t as S}from"./ruler-Buxogset.js";import{Ci as C,Gr as w,Hn as T,Of as E,Sd as ee,Ti as D,Vn as O,Xr as k,_f as A,af as j,gd as te,ji as M,m as ne,vf as N,vn as P,yd as F,yf as I}from"./src-DKRp5NPI.js";import{t as L}from"./i18n-ByFr51sS.js";import{t as R}from"./useTranslation-BJr-n0es.js";import{Hr as z,T as B,Ur as V,x as H}from"./index-D5GcZJtC.js";import{t as U}from"./AdminSectionedPage-Xr_hesYw.js";import{t as W}from"./AdminPage-_ITsYONa.js";import{t as G}from"./NodeAddonsSettingsPanel-BtSyXQ4v.js";import{i as K,r as q,t as J}from"./Authentication-CWHj8Czl.js";o();var re={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`},Y={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 X({entry:t,actions:r}){let i=t.name.toLowerCase(),a=re[i]??`border-primary`,o=Y[i]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=r?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&n(m,{className:`h-3 w-3 animate-spin text-primary`})]}),n(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?n(ie,{entry:t,actions:r,activeProvider:s,isPending:c}):n(ae,{entry:t,actions:r,isPending:c})]})}function ie({entry:t,actions:r,activeProvider:i,isPending:a}){let{t:o}=R();if(!r)return n(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[n(f,{className:`h-3 w-3 text-green-400 shrink-0`}),n(`span`,{className:`font-medium`,children:i.addonName}),n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[n(`div`,{className:`space-y-1`,children:t.providers.map(i=>{let o=i.active;return e(M,{variant:`unstyled`,type:`button`,disabled:a||o,onClick:()=>r.onSelectSingleton(t.name,i.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:i.addonName}),o&&n(`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`})]},i.addonId)})}),t.perNode&&t.perNode.length>0&&n(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(i=>{let c=i.hasOverride&&i.resolvedActive?i.resolvedActive:s,l=[{value:s,label:i.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:i.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...i.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?r.onClearNodeSingleton(t.name,i.nodeId):r.onSelectNodeSingleton(t.name,i.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[i.nodeId,i.hasOverride&&n(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let r=c===t.value;return e(M,{variant:`unstyled`,type:`button`,disabled:d||r,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${r?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${r?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:t.label}),r&&t.value!==s&&n(`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`})]},t.value)})]},i.nodeId)})})]})}function ae({entry:t,actions:r,isPending:i}){let{t:a}=R();if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!r)return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[n(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,n)=>{let i=n?[...new Set([...o,e])]:o.filter(t=>t!==e);r.onToggleCollection(t.name,i)};return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${i?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[n(p,{checked:t.active,disabled:i,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),n(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function Z({capabilities:e,actions:t}){let{t:r}=R();return e.length===0?n(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:r(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):n(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>n(X,{entry:e,actions:t},e.name))})}var oe=[`capabilities`,`listCapabilities`];function se(e){return e===`singleton`||e===`collection`}function ce(e){let t=e.indexOf(`@`);return t===-1?L.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function le(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:ce(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ue(){let{t:r}=R(),o=g(),[s,l]=i(null),[u,p]=i(null),m=a({queryKey:oe,queryFn:()=>o.trpcClient.capabilities.listCapabilities.query()}),h=t(()=>{let e=(m.data??[]).flatMap(e=>se(e.mode)?[le(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]},[m.data]),v=t(()=>h.filter(e=>e.mode===`singleton`),[h]),y=t(()=>h.filter(e=>e.mode===`collection`),[h]),b=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:r(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToSet`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),x=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToSetOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),S=c({mutationFn:e=>o.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:r(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToClearOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),w=c({mutationFn:e=>o.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:r(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),T={onSelectSingleton:(e,t)=>b.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>x.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>S.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>w.mutate({capName:e,enabledAddonIds:t}),pendingCapability:s};return e(W,{embedded:!0,icon:_,title:r(`system.capabilities.capabilities`,`Capabilities`),subtitle:r(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[u&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${u.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[u.kind===`success`?n(f,{className:`h-3.5 w-3.5 shrink-0`}):n(d,{className:`h-3.5 w-3.5 shrink-0`}),n(`span`,{children:u.message})]}),m.isLoading&&n(`div`,{className:`flex items-center justify-center py-16`,children:n(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),m.isError&&!m.isLoading&&n(C,{title:r(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:m.error instanceof Error?m.error.message:r(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void m.refetch()}),!m.isLoading&&!m.isError&&h.length===0&&n(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:r(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!m.isLoading&&!m.isError&&h.length>0&&e(`div`,{className:`space-y-6`,children:[v.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),n(Z,{capabilities:v,actions:T})]}),y.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),n(Z,{capabilities:y,actions:T})]})]})]})}var de={escape:`Esc`,enter:`Enter`};function fe(e,t){let n=I(e),r=de[n.key]??n.key.toUpperCase();return t===`mac`?`${n.alt?`⌥`:``}${n.shift?`⇧`:``}${n.mod?`⌘`:``}${r}`:[...n.mod?[`Ctrl`]:[],...n.alt?[`Alt`]:[],...n.shift?[`Shift`]:[],r].join(`+`)}function pe(){let{t}=R(),r=A(),i=N();return n(O,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:x,testId:`settings-hotkeys`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.settings.hotkeys.description`,`The shortcuts active on this page. They cannot be changed.`)}),r.length===0?n(k,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):r.map(e=>n(T,{label:e.label??t(`systemPage.settings.hotkeys.unnamed`,`Shortcut`),children:n(`kbd`,{className:`rounded-md border border-border bg-surface px-1.5 py-0.5 font-mono text-xs text-foreground`,children:fe(e.combo,i)})},`${e.scope}|${e.combo}`))]})})}o();var me=[[`system`]];function Q(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function he(){let{t}=R(),a=s(),o=F(),c=ee(),l=te(),[u,d]=i(``),[f,p]=i(``),[m,g]=i(null),_=o.data?.location??null;r(()=>{d(_===null?``:Q(_.latitude)),p(_===null?``:Q(_.longitude))},[_]);let v=async()=>{await a.invalidateQueries({queryKey:me})},b=async e=>{e.preventDefault();let t=Number(u),n=Number(f);if(u.trim()===``||f.trim()===``){g(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){g(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){g(`Longitude must be between -180 and 180 decimal degrees.`);return}g(null),await c.mutateAsync({latitude:t,longitude:n}),await v()},x=async()=>{g(null),await c.mutateAsync(null),await v()},S=async()=>{g(null),await l.mutateAsync(),await v()},C=c.isPending||l.isPending||o.isLoading;return e(w,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[n(h,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),n(`div`,{children:n(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),_===null?n(D,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):n(D,{variant:_.source===`operator-set`?`success`:`info`,children:_.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),_?.label!==void 0&&_.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:_.label})}):null,_===null&&o.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),o.data?.derivationError!==null&&o.data?.derivationError!==void 0?`: ${o.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:b,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),n(j,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),n(j,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),n(M,{type:`submit`,disabled:C,children:t(`common.save`,`Save`)}),e(M,{type:`button`,variant:`ghost`,disabled:C,onClick:S,children:[n(y,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),_===null?null:n(M,{type:`button`,variant:`ghost`,disabled:C,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),m===null?null:n(`p`,{className:`text-xs text-danger`,children:m}),n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}o();function ge(e){return b.some(t=>t===e)}function $(e){return P.some(t=>t===e)}function _e(){let{t}=R(),r=ne(),[a,o]=i(!1),[s,c]=i(null),l=e=>{o(!0),c(null),r.update(e).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>o(!1))},u=r.status!==`ok`||!r.writable||a;return n(O,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:S,testId:`settings-units`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.units.description`,`How readings are shown to you, on every device you sign in on. Stored values do not change.`)}),r.status===`error`&&n(C,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),r.status===`ok`&&!r.writable&&n(C,{message:t(`systemPage.myAccess.units.unreadable`,`The saved unit preferences are in a format this version cannot read, so they are left untouched.`)}),s!==null&&n(C,{message:s}),n(T,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:n(v,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:r.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;$(t)&&l({temperature:t})},options:[{value:`celsius`,label:t(`systemPage.myAccess.units.celsius`,`Celsius (°C)`)},{value:`fahrenheit`,label:t(`systemPage.myAccess.units.fahrenheit`,`Fahrenheit (°F)`)}]})}),n(T,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:n(v,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:r.value.system,disabled:u,onChange:e=>{let t=e.target.value;ge(t)&&l({system:t})},options:[{value:`metric`,label:t(`systemPage.myAccess.units.metric`,`Metric (km/h, hPa, mm)`)},{value:`imperial`,label:t(`systemPage.myAccess.units.imperial`,`Imperial (mph, inHg, in)`)}]})})]})})}var ve=`system-config`;function ye(){let{t}=R(),{nodes:r,isLoading:i}=E(),a=r.find(e=>e.isHub&&e.isOnline),o=(a?.addons.map(e=>e.addonId)??[]).filter(e=>e!==ve);return e(W,{embedded:!0,children:[n(he,{}),i?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?e(l,{children:[n(K,{omitSectionIds:[J],emptyMessage:t(`admin.system.settings.bootstrapUnavailable`,`Not available — the addon that owns the server settings did not answer.`)}),o.length===0?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):n(G,{nodeId:a.id,addonIds:o,level:`global`,omitSectionIds:[J,q]})]}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[n(u,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),n(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]}),e(`section`,{"aria-labelledby":`settings-per-user`,className:`mt-3 sm:mt-4 space-y-3 sm:space-y-4`,children:[n(`h2`,{id:`settings-per-user`,className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:t(`systemPage.settings.perUser`,`Your settings`)}),n(_e,{}),n(pe,{})]})]})}function be(){let{t:e}=R(),t=H(`/system/settings`,{t:e,isAdmin:!0})??{icon:u,title:e(`system.systemNav`,`System`)},{search:r,hash:i}=V();return new URLSearchParams(r).get(`tab`)===`secrets`?n(z,{replace:!0,to:`${B(r)}${i}`}):n(U,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:n(ye,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:n(ue,{})}]})}export{be as SystemPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,K as n,R as r,S as i,Y as a,d as o,et as s,k as c,u as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ea as d,Wt as f,it as p,mt as m,wa as h}from"./player-overlays-BZByYYB8.js";import{Ci as g,Fu as _,Hr as v,Ir as y,Iu as b,Lr as x,Mu as S,Nf as C,Pu as w,Rr as T,T as E,Td as D,Vr as O,Zr as k,an as A,ji as j,ju as M,on as N,r as P,x as F}from"./src-DKRp5NPI.js";import{t as I}from"./i18n-ByFr51sS.js";import{n as L,t as R}from"./useTranslation-BJr-n0es.js";import{C as z,K as B}from"./index-D5GcZJtC.js";import{n as V,r as H,t as U,v as W}from"./RemoteGrid-CDLuEg4n.js";s();function G({i18n:t,defaultNS:r,children:i}){let a=n(()=>({i18n:t,defaultNS:r}),[t,r]);return e(L.Provider,{value:a},i)}s();function K({deviceId:e,button:n,sources:r,current:o,placement:s}){let{t:c}=R(),l=b(),[d,p]=a(!1),[m,g]=a(null);if(r.length===0)return null;let _=o===``?c(`remote.sourceSelect.label`):o,S=r.filter(e=>e.kind===`digits`),C=r.filter(e=>e.kind!==`digits`),w=async t=>{g(null);try{let n=await l.mutateAsync({deviceId:e,command:`selectSource`,source:t.name,repeat:1});if(n.status===`refused`){g(c(`remote.test.refused.${n.reason}`,{detail:n.detail??``}));return}if(n.status===`not-routed`){g(c(`remote.sourceSelect.notRouted`));return}p(!1)}catch(e){g(e instanceof Error?e.message:String(e))}};return t(u,{children:[t(j,{type:`button`,size:`sm`,variant:`secondary`,"aria-label":_,title:_,"data-testid":`remote-grid-button-${n.id}`,"data-widget":`source_select`,className:h(`z-10 h-full min-w-0 overflow-hidden border border-border px-2`,V(n.shape),H(n.tone)),style:s,onClick:()=>{g(null),p(!0)},children:[i(f,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),i(`span`,{className:`min-w-0 truncate text-xs`,children:_})]}),d&&i(y,{open:!0,onOpenChange:e=>!e&&p(!1),children:t(T,{width:`sm`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(O,{children:i(v,{children:c(`remote.sourceSelect.title`)})}),t(x,{className:`space-y-3`,"data-testid":`source-picker`,children:[i(q,{title:c(`remote.sourceSelect.channels`),sources:S,current:o,busy:l.isPending,onPick:e=>void w(e)}),i(q,{title:c(`remote.sourceSelect.inputs`),sources:C,current:o,busy:l.isPending,onPick:e=>void w(e)}),m!==null&&i(`p`,{role:`alert`,className:`text-xs text-danger`,"data-testid":`source-picker-failure`,children:m})]})]})})]})}function q({title:e,sources:n,current:r,busy:a,onPick:o}){return n.length===0?null:t(`section`,{className:`space-y-1`,children:[i(`h3`,{className:`text-xs font-medium uppercase tracking-wide text-foreground-muted`,children:e}),i(`ul`,{className:`space-y-1`,children:n.map(e=>i(`li`,{children:t(j,{type:`button`,variant:e.name===r?`secondary`:`ghost`,size:`sm`,disabled:a,className:`w-full justify-start gap-2`,"data-testid":`source-pick-${e.id}`,onClick:()=>o(e),children:[e.kind===`digits`&&i(`span`,{className:`w-10 shrink-0 text-right tabular-nums text-foreground-muted`,children:e.number}),i(`span`,{className:`min-w-0 truncate`,children:e.name})]})},e.id))})]})}s();function J({deviceId:e,deviceName:n}){let{t:r}=R(),o=k(`remote`),s=w({deviceId:e},{enabled:o===`present`}),[c,l]=a(!1);return o!==`present`||(s.data?.commands.length??0)===0&&(s.data?.sources.length??0)===0?null:t(`div`,{className:`flex flex-wrap items-center justify-center gap-1`,children:[t(j,{size:`sm`,variant:`outline`,onClick:()=>l(!0),"data-testid":`hero-remote`,children:[i(P,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),r(`remote.hero.open`)]}),c&&i(Y,{deviceId:e,deviceName:n,onClose:()=>l(!1)})]})}function Y({deviceId:e,deviceName:n,onClose:r}){let{t:o}=R(),s=S({deviceId:e}),c=D({kind:`remote`}),l=w({deviceId:e}),u=_(),d=M({deviceId:e}),[f,p]=a(null),m=s.data?.layoutTemplateId??null,h=(c.data??[]).find(e=>e.id===m),b=h===void 0?null:W(h.payload),C=new Set((l.data?.commands??[]).map(e=>e.role)),E=async t=>{let n=b?.buttons.find(e=>e.id===t)?.role;if(!(n===void 0||!C.has(n))){p(null);try{let t=await u.mutateAsync({deviceId:e,role:n,repeat:1});t.status===`refused`&&p(o(`remote.test.refused.${t.reason}`,{detail:t.detail??``}))}catch(e){p(e instanceof Error?e.message:String(e))}}};return i(y,{open:!0,onOpenChange:e=>!e&&r(),children:t(T,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(O,{children:i(v,{children:o(`remote.hero.title`,{name:n})})}),t(x,{className:`space-y-3`,children:[s.status===`error`?i(g,{title:o(`remote.dialog.unreadable`),message:s.error?.message??``,onRetry:()=>void s.refetch()}):b===null?i(`p`,{className:`text-xs text-foreground-muted`,children:o(`remote.hero.noLayout`)}):i(`div`,{className:`mx-auto w-full max-w-xs`,"data-testid":`remote-press`,children:i(U,{grid:b,label:o(`remote.hero.title`,{name:n}),boundRoles:C,onSelect:e=>void E(e),renderWidget:(t,n)=>i(K,{deviceId:e,button:t,sources:l.data?.sources??[],current:d.data?.source??``,placement:n})})}),f!==null&&i(`p`,{role:`alert`,className:`text-xs text-danger`,children:f})]})]})})}s();var X=c({});function Z({value:e,children:t}){return i(X.Provider,{value:e,children:t})}s();var Q={"off-while-running":{title:`Turn off while running?`,message:`The device is running. Cutting its power now interrupts what it is doing.`,confirm:`Turn off`},unlock:{title:`Unlock?`,message:`The lock will open.`,confirm:`Unlock`},install:{title:`Install the update?`,message:`The device may restart and be unavailable for a while.`,confirm:`Install`},press:{title:`Run it now?`,message:`The device acts as soon as you confirm.`,confirm:`Run`}},$=e=>e===`off-while-running`?`deviceHero.model.confirmOff`:`deviceHero.model.confirm.${e}`;function ee(){let{t:e,i18n:t}=R(),r=t.language;return n(()=>{let t=t=>({title:e(`${$(t)}.title`,Q[t].title),message:e(`${$(t)}.message`,Q[t].message),confirm:e(`${$(t)}.confirm`,Q[t].confirm)});return{noValue:e(`deviceHero.model.noValue`,`–`),callFailed:e(`deviceHero.model.callFailed`,`The device did not accept the command`),historyTooltip:e(`deviceHero.utility.history.tooltip`,`Opens the history of this device.`),consumables:{label:e(`deviceHero.utility.consumables.label`,`Consumables`),low:t=>e(`deviceHero.utility.consumables.low`,`{{count}} low`,{count:t}),ok:e(`deviceHero.utility.consumables.ok`,`OK`),tooltip:e(`deviceHero.utility.consumables.tooltip`,`Shows the level of each consumable and which ones need attention.`)},power:{label:e(`deviceHero.utility.power.label`,`Power source`),on:e(`deviceHero.utility.power.on`,`On`),off:e(`deviceHero.utility.power.off`,`Off`),tooltip:e(`deviceHero.utility.power.tooltip`,`Opens a menu to cut or restore the power feeding this device, or to restart it.`),tooltipReadOnly:e(`deviceHero.utility.power.tooltipReadOnly`,`Whether the power source feeding this device is on. Your session cannot change it.`)},confirm:{"off-while-running":t(`off-while-running`),unlock:t(`unlock`),install:t(`install`),press:t(`press`)}}},[e,r])}s();function te(e){let[t]=a(()=>new o({defaultOptions:{queries:{retry:!1,staleTime:5e3}}}));return e??t}function ne({deviceId:e,canActuate:n,fallback:o,onDrawn:s,defaultHistoryOpen:c}){let{t:l,i18n:d}=R(),f=ee(),[p,m]=a(c===!0),h=E(e),g=B(h.presence,h.list),_=r(()=>m(!0),[]);return t(u,{children:[i(A,{deviceId:e,canActuate:n,lang:N(d.language),labels:f,renderRemote:t=>i(J,{deviceId:e,deviceName:t}),fallback:o??null,...g?{onOpenHistory:_}:{},...s===void 0?{}:{onDrawn:s}}),p?i(y,{open:!0,onOpenChange:e=>!e&&m(!1),children:t(T,{width:`xl`,scroll:`body`,children:[i(O,{children:i(v,{children:l(`deviceModule.history`,`History`)})}),i(x,{className:`mt-3`,children:i(F,{deviceId:e})})]})}):null]})}function re({deviceId:e,trpcClient:t,theme:r,locale:a,canActuate:o=!1,defaultHistoryOpen:s,queryClient:c,fallback:u,onDrawn:f,onOpenDevice:h,onOpenCamera:g,onClose:_,onNavigate:v}){let y=te(c),b=n(()=>I.cloneInstance({lng:a}),[a]),x=n(()=>z(b.t.bind(b)),[b]),S=n(()=>({onOpenDevice:h,onOpenCamera:g,onClose:_,onNavigate:v}),[h,g,_,v]);return i(`div`,{className:r,"data-theme":r,"data-testid":`device-detail-module`,children:i(G,{i18n:b,children:i(d,{t:x,children:i(m,{client:t,children:i(C.Provider,{client:t,queryClient:y,children:i(l,{client:y,children:i(p,{children:i(Z,{value:S,children:i(ne,{deviceId:e,canActuate:o,fallback:u,onDrawn:f,defaultHistoryOpen:s})})})})})})})})})}export{J as n,re as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./src-DKRp5NPI.js";
|