@camstack/addon-admin-ui 1.2.651 → 1.2.652
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 +9 -0
- package/dist/assets/{Addons-B8ltQOv0.js → Addons-DFygon8k.js} +1 -1
- package/dist/assets/{AdminPage-j7wlZJaX.js → AdminPage-2H7qegiH.js} +1 -1
- package/dist/assets/{AdminSectionedPage-Bff3Jex6.js → AdminSectionedPage-CWRY6TXK.js} +1 -1
- package/dist/assets/{AiProfiles-BKV84wBr.js → AiProfiles-Ct9zcHWG.js} +1 -1
- package/dist/assets/{BootstrapSettingsForm-BybQlvQs.js → BootstrapSettingsForm-DJLxKYKT.js} +1 -1
- package/dist/assets/{Build-RULxbWDd.js → Build-_MNk-gsH.js} +1 -1
- package/dist/assets/{Calendars-CG2avL1-.js → Calendars-BrFMMXU3.js} +1 -1
- package/dist/assets/{CameraGrids-dfX8bLpt.js → CameraGrids-7RfsBtg8.js} +1 -1
- package/dist/assets/{Cluster-ddOQtA0z.js → Cluster-qdUn0ZWi.js} +1 -1
- package/dist/assets/{CompositionBlockEditor-E9dJvNcn.js → CompositionBlockEditor-tW-fi9fY.js} +1 -1
- package/dist/assets/{CompositionEditorPage-CIYtKsgd.js → CompositionEditorPage-BdKITJdB.js} +1 -1
- package/dist/assets/{Data-40hNsswQ.js → Data-Dq99cYIc.js} +1 -1
- package/dist/assets/DeviceDetail-DZKwQsDf.js +2 -0
- package/dist/assets/{Devices-D82RrdaQ.js → Devices-B4o5FkKs.js} +1 -1
- package/dist/assets/{EmbedDevicePage-DCqyPvjt.js → EmbedDevicePage-BCz48kwT.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-CoUvRfeW.js → EmbedPlayerPage-DROVGJUa.js} +1 -1
- package/dist/assets/{History-LROTE-3F.js → History-DjSpw_q0.js} +1 -1
- package/dist/assets/{Identity-B59zHLA3.js → Identity-DRR4EhOw.js} +1 -1
- package/dist/assets/InstancesTable-fZ0yNacw.js +1 -0
- package/dist/assets/{IntegrationDetail-rOO7_tpX.js → IntegrationDetail-BWYrpCeb.js} +1 -1
- package/dist/assets/IntegrationWizard-DyIJiQjm.js +1 -0
- package/dist/assets/{Integrations-D9I8f_dT.js → Integrations-BzdMNme3.js} +1 -1
- package/dist/assets/{Integrations-CqTN93AE.js → Integrations-Dx5lzGGq.js} +1 -1
- package/dist/assets/{Library-BIn-La3n.js → Library-kH7Xd3gC.js} +1 -1
- package/dist/assets/{Locations-Dhv1Kc76.js → Locations-CPNRVIjp.js} +1 -1
- package/dist/assets/{Logs-q8mnPoZt.js → Logs-BCSHF0Hz.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-C5CA5ArA.js → MaskShapeCanvas-g7yAssct.js} +1 -1
- package/dist/assets/{MotionZonesSettings-CuEdW4kg.js → MotionZonesSettings-BvqGObrA.js} +1 -1
- package/dist/assets/{MyAccess-BuMfiAQv.js → MyAccess-Bfdi856H.js} +1 -1
- package/dist/assets/{Network-Cb8igqGd.js → Network-CmZhSVsi.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-Epb11fvO.js → NodeAddonsSettingsPanel-DwqvYEao.js} +1 -1
- package/dist/assets/{Notifications-Dqd_UOOG.js → Notifications-DA1lIKUt.js} +1 -1
- package/dist/assets/{Pipeline-BmIjO9-D.js → Pipeline-r-8l7hZO.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-CRGHDdXy.js → PrivacyMaskSettings-C43hww2R.js} +1 -1
- package/dist/assets/{Recordings-DwV6-ANm.js → Recordings-B50SML_Q.js} +1 -1
- package/dist/assets/{RemoteGrid-JW_jcrRL.js → RemoteGrid-Dv8u1cRv.js} +1 -1
- package/dist/assets/{ScanSubnetEditor-Bp0ZzAGR.js → ScanSubnetEditor-lUmamDRT.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-Q7jXeGpo.js → SceneMonitorEditor-DA76cNih.js} +1 -1
- package/dist/assets/{SessionsList-CmpxjyUF.js → SessionsList-CSmzdfK6.js} +1 -1
- package/dist/assets/{Showroom-B3_xGKQA.js → Showroom-YNNYBt4x.js} +1 -1
- package/dist/assets/{StorageLocationsTable-BvMGBanJ.js → StorageLocationsTable-CIQLMsJC.js} +1 -1
- package/dist/assets/{System-JVEKqDtH.js → System-r539bm4J.js} +1 -1
- package/dist/assets/{Templates-CjBsCi25.js → Templates-B6Nl1xgU.js} +1 -1
- package/dist/assets/{Terminal-BvsE40TJ.js → Terminal-CdDnVDQl.js} +1 -1
- package/dist/assets/{TrainingProviders-CqyzYHwE.js → TrainingProviders-DJ09cRpJ.js} +1 -1
- package/dist/assets/{Viewer-Cz5LM-ZD.js → Viewer-UkANt4yY.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-GRzbN4aL.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Brm6yYA2.js} +1 -1
- package/dist/assets/{action-draft-BVTi9xo9.js → action-draft-B0YtvIK8.js} +1 -1
- package/dist/assets/{ai-page.helpers-DNcaXg8W.js → ai-page.helpers-D6ZZMriu.js} +1 -1
- package/dist/assets/{assignment-candidates-Brt1TfBJ.js → assignment-candidates-D-v7rj2f.js} +1 -1
- package/dist/assets/{authed-media-BDz2D3wE.js → authed-media-CYJ67W1F.js} +1 -1
- package/dist/assets/{board-model-fGSLbQlQ.js → board-model-Bk9dOlXr.js} +1 -1
- package/dist/assets/client-CxoliObn.js +1114 -0
- package/dist/assets/{command-vocab-GNKqYgCN.js → command-vocab-Xm353Fi-.js} +1 -1
- package/dist/assets/{create-composition-DTVI2eEi.js → create-composition-BEPdO8PM.js} +1 -1
- package/dist/assets/{device-detail-BRYKrKpX.js → device-detail-DUYt5dz3.js} +1 -1
- package/dist/assets/{device-integration-icon-BaZamKTr.js → device-integration-icon-96PtuBb0.js} +1 -1
- package/dist/assets/device-picker-model-CIZB_MPl.js +1 -0
- package/dist/assets/{dist-Cv10wXXS.js → dist-Dur6bHcC.js} +1 -1
- package/dist/assets/dist-_n5SMWsj.js +1114 -0
- package/dist/assets/{format-CD_iudtm.js → format-BxjElxwq.js} +1 -1
- package/dist/assets/{hostInit-C7q5ZVa2.js → hostInit-BopdhKYk.js} +1 -1
- package/dist/assets/i18n-C__Kv-sS.js +1 -0
- package/dist/assets/{icons-DGI91n0_.js → icons-Djs5qMrO.js} +1 -1
- package/dist/assets/{index-BKgdp64z.js → index-hhTXvvOB.js} +3 -3
- package/dist/assets/{linked-devices-model-DdmaPBcx.js → linked-devices-model-Bb6B3YVg.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-72008839.js → mf-entry-bootstrap-0-207caf94.js} +2 -2
- package/dist/assets/mount-CIZB_MPl.js +1 -0
- package/dist/assets/{notification-rule-status-DorPFV4O.js → notification-rule-status-DEk79oDE.js} +1 -1
- package/dist/assets/{player-overlays-BhrNQiuF.js → player-overlays-DilQz9uf.js} +1 -1
- package/dist/assets/remoteEntry-PV_ZlxYI.js +1 -0
- package/dist/assets/src-BgJM3bf_.js +252 -0
- package/dist/assets/{step-inspector-model-CCXeB8Qp.js → step-inspector-model-Ce7VAyE-.js} +1 -1
- package/dist/assets/{use-scenes-feed-BlDgjdbB.js → use-scenes-feed-0Xrve4u9.js} +1 -1
- package/dist/assets/{use-stationary-objects-X5LldesX.js → use-stationary-objects-DY7wIMD2.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-DPzuxsjZ.js → useAdminDeviceRemoval-CPedVydD.js} +1 -1
- package/dist/assets/useEventInvalidation-CIZB_MPl.js +1 -0
- package/dist/assets/{useNodeUrlSelection-qjXl6qTX.js → useNodeUrlSelection-CIiBKiPN.js} +1 -1
- package/dist/assets/{useTemplateSave-msQZOGf6.js → useTemplateSave-Cfew9nvB.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Pzb2Fskx.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CMPo2XXm.js} +2 -2
- package/dist/index.html +7 -7
- package/dist/server/addon.js +86 -9
- package/package.json +2 -2
- package/dist/assets/DeviceDetail-DIOgBXBE.js +0 -2
- package/dist/assets/InstancesTable-I61ipsWQ.js +0 -1
- package/dist/assets/IntegrationWizard-D-DvT_nc.js +0 -1
- package/dist/assets/client-D5elicir.js +0 -1114
- package/dist/assets/device-picker-model-DoO_DpCX.js +0 -1
- package/dist/assets/dist-B6ZlvtdW.js +0 -1114
- package/dist/assets/i18n-BNkA6jrS.js +0 -1
- package/dist/assets/mount-DoO_DpCX.js +0 -1
- package/dist/assets/remoteEntry-C0hl0rQE.js +0 -1
- package/dist/assets/src-B_Sz8ZXm.js +0 -252
- package/dist/assets/useEventInvalidation-DoO_DpCX.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,x as ee}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Fa as te,K as ne,Ma as re,U as ie,X as ae,Yt as oe,cn as se,gt as ce,hr as le,n as ue,ri as de,z as c}from"./player-overlays-BhrNQiuF.js";import{n as fe,t as pe}from"./mic-off-BIQ5bbUV.js";import{MaskShapeCanvas as me}from"./MaskShapeCanvas-C5CA5ArA.js";s();var l=`Microphone`,u=`The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.`;function he(e){let t=e.supportsAudioMute===!0,n=t?e.audioEnabled:null,r=e.pendingOn??null;return{label:l,supported:t,on:n===null?null:r??n,available:t&&n!==null,costWhenOff:u}}function ge(e){return!e.available||e.on===null?null:{enabled:!e.on}}var d=120,_e=`privacy-mask`,f=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,p=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function m(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function ve(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function ye(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function h({deviceId:s}){let l=te(),u=ne(ce().trpcClient,s),[h,g]=o(null),[_,v]=o(!1),[y,b]=o(!1),[x,S]=o(null),[C,w]=o(null),[T,E]=o(!1),[D,O]=o(!1),[k,A]=o(null),[j,M]=o(null),[N,P]=o(null),[F,I]=o(null),[L,R]=o(null),z=t(!1);a(()=>{if(!u)return;let e=!1;return z.current=!1,g(null),v(!1),b(!1),S(null),w(null),O(!1),A(null),M(null),P(null),I(null),R(null),(async()=>{try{let t=await u.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(g(t),z.current)return;let n=await u.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);if(n.regions===null){b(!0),P(n.audioEnabled);return}z.current=!0;let r={enabled:n.enabled,regions:n.regions};w(r),S(r),P(n.audioEnabled)}catch(t){if(e)return;ie(t)?v(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[u]);let B=n(()=>x!==null&&C!==null&&(x.enabled!==C.enabled||!ye(x.regions,C.regions)),[x,C]),V=x?x.regions.length:0,H=h?h.maxRegions:0,U=t(0);a(()=>{U.current=H},[H]);let W=H>0&&V>=H,be=r(()=>{S(e=>e&&{...e,enabled:!e.enabled})},[]),G=r(e=>{A(typeof e==`number`?e:null)},[]),K=n(()=>x?x.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:l(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:e.id})})):[],[x,l]),q=r((e,t)=>{let n=m(t);n&&S(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),J=r(e=>{let t=m(e);t&&(M(null),S(e=>{if(!e)return e;let n=U.current;if(n>0&&e.regions.length>=n)return e;let r=ve(e.regions),i={id:r,enabled:!0,shape:t};return A(r),{...e,regions:[...e.regions,i]}}))},[]),Y=r(e=>{O(!0),A(null),M(e)},[]),xe=r(e=>{O(!0),M(null),A(e)},[]),Se=r(e=>{A(t=>t===e?null:t),S(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),Ce=r(()=>{M(null),A(null),C&&S({enabled:C.enabled,regions:C.regions})},[C]),we=r(async()=>{if(!(!u||!x)){E(!0);try{await u.privacyMask?.setMask({patch:{enabled:x.enabled,regions:[...x.regions]}});let e=await u.privacyMask?.getStatus({});if(e&&e.regions!==null){let t={enabled:e.enabled,regions:e.regions};w(t),S(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{E(!1)}}},[u,x]),X=he({supportsAudioMute:h===null?null:h.supportsAudioMute,audioEnabled:N,pendingOn:F}),Z=r(async()=>{let e=ge(X);if(!(!u||e===null)){I(e.enabled),R(null);try{await u.privacyMask?.setAudioEnabled(e);let t=await u.privacyMask?.getStatus({});t&&P(t.audioEnabled)}catch(e){console.error(`Privacy microphone write failed — reverting`,e),R(e instanceof Error?e.message:String(e))}finally{I(null)}}},[u,X]),Te=r(()=>{O(e=>(e&&(M(null),A(null)),!e))},[]),Q=h?.supportedShapes??[];ue(n(()=>D&&!_&&h&&x?{id:_e,order:d,node:i(me,{transparent:!0,items:K,supportedShapes:Q,polygonVertices:h.polygonVertices,selectedId:k,onSelect:G,onShapeChange:q,onDrawComplete:J,drawingKind:j})}:null,[D,_,h,x,K,Q,k,G,q,J,j]));let Ee=h?.supportedShapes.includes(`rect`)??!1,De=h?.supportedShapes.includes(`polygon`)??!1,$=h!==null&&(h.maxRegions<=0||h.supportedShapes.length===0),Oe=!_&&!$&&!y&&h!==null&&x!==null;return u?i(ae,{title:l(`uiLibrary.privacyMaskSettings.title`,`Privacy Mask`),icon:i(de,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:e(`div`,{className:`flex flex-col gap-3`,children:[_||$?i(`p`,{className:`${c} leading-relaxed`,children:l(`uiLibrary.privacyMaskSettings.unsupported`,`This camera doesn't support an on-board privacy mask.`)}):y?i(`p`,{className:`${c} leading-relaxed`,children:l(`uiLibrary.privacyMaskSettings.unreadable`,`This camera hasn't answered, so what it currently masks is unknown — the editor stays closed rather than showing an empty frame you could save over. A battery camera answers once it wakes; otherwise check that it is reachable.`)}):Oe?e(ee,{children:[i(`p`,{className:`${c} leading-relaxed`,children:i(re,{uiKey:`uiLibrary.privacyMaskSettings.help`,fallback:`Toggle <0>Edit mask</0> to draw blanked-out zones on the live frame, then <1>Save</1> to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`,components:[i(`strong`,{className:`text-foreground`},`edit`),i(`strong`,{className:`text-foreground`},`save`)]})}),e(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[i(`button`,{type:`button`,onClick:Te,disabled:T,"aria-pressed":D,className:D?p:f,children:D?l(`uiLibrary.privacyMaskSettings.doneEditing`,`Done editing`):l(`uiLibrary.privacyMaskSettings.editMask`,`Edit mask`)}),i(`button`,{type:`button`,onClick:be,disabled:T,"aria-pressed":x.enabled,className:x.enabled?p:f,children:x.enabled?l(`uiLibrary.privacyMaskSettings.maskOn`,`Mask on`):l(`uiLibrary.privacyMaskSettings.maskOff`,`Mask off`)}),Ee&&i(`button`,{type:`button`,onClick:()=>Y(`rect`),disabled:T||W,"aria-pressed":j===`rect`,className:j===`rect`?p:f,title:W?l(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):l(`uiLibrary.privacyMaskSettings.addRect`,`Add a rectangle zone`),children:l(`uiLibrary.privacyMaskSettings.rectButton`,`+ Rect`)}),De&&i(`button`,{type:`button`,onClick:()=>Y(`polygon`),disabled:T||W,"aria-pressed":j===`polygon`,className:j===`polygon`?p:f,title:W?l(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):l(`uiLibrary.privacyMaskSettings.addPolygon`,`Add a polygon zone`),children:l(`uiLibrary.privacyMaskSettings.polygonButton`,`+ Polygon`)}),i(`span`,{className:`${c} ml-1 tabular-nums`,children:l(`uiLibrary.privacyMaskSettings.zoneCount`,`{{active}} / {{max}} zones`,{active:V,max:H})}),i(`span`,{className:`flex-1`}),i(`button`,{type:`button`,onClick:Ce,disabled:T||!B,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:l(`uiLibrary.privacyMaskSettings.revert`,`Revert`)}),i(`button`,{type:`button`,onClick:()=>void we(),disabled:T||!B,className:p,children:T?l(`uiLibrary.privacyMaskSettings.saving`,`Saving…`):l(`uiLibrary.privacyMaskSettings.save`,`Save`)})]}),V>0?i(`div`,{className:`flex flex-col gap-1`,children:x.regions.map(t=>{let n=k===t.id,r=t.shape.kind===`polygon`?fe:se;return e(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${n?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[e(`button`,{type:`button`,onClick:()=>xe(t.id),disabled:T,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[i(r,{className:`h-3.5 w-3.5 shrink-0`}),i(`span`,{children:l(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:t.id})}),i(`span`,{className:`text-foreground-faint capitalize`,children:t.shape.kind})]}),i(`button`,{type:`button`,onClick:()=>Se(t.id),disabled:T,"aria-label":l(`uiLibrary.privacyMaskSettings.deleteZoneN`,`Delete zone {{id}}`,{id:t.id}),title:l(`uiLibrary.privacyMaskSettings.deleteZone`,`Delete zone`),className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:i(oe,{className:`h-3.5 w-3.5`})})]},t.id)})}):null]}):i(`p`,{className:`${c} leading-relaxed`,children:l(`uiLibrary.privacyMaskSettings.loading`,`Loading the camera's privacy mask…`)}),X.supported&&e(`div`,{className:`flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2`,children:[i(`button`,{type:`button`,role:`switch`,"aria-label":X.label,"aria-checked":X.on===!0,disabled:!X.available||F!==null,onClick:()=>void Z(),title:X.on===null?l(`uiLibrary.privacyMaskSettings.micTitleUnknown`,`Microphone — state unknown; the camera did not answer.`):X.on?l(`uiLibrary.privacyMaskSettings.micTitleOn`,`The camera is capturing sound. Turning it off: {{cost}}`,{cost:X.costWhenOff}):l(`uiLibrary.privacyMaskSettings.micTitleOff`,`The camera is silent. {{cost}}`,{cost:X.costWhenOff}),className:X.on===!1||X.on===null?f:p,children:e(`span`,{className:`inline-flex items-center gap-1.5`,children:[X.on===!1?i(pe,{className:`h-3.5 w-3.5`}):i(le,{className:`h-3.5 w-3.5`}),X.on===null?l(`uiLibrary.privacyMaskSettings.micUnknown`,`Microphone unknown`):X.on?l(`uiLibrary.privacyMaskSettings.micOn`,`Microphone on`):l(`uiLibrary.privacyMaskSettings.micOff`,`Microphone off`)]})}),i(`p`,{className:`text-[10px] text-foreground-subtle flex-1 leading-relaxed`,children:L===null?X.on===null?l(`uiLibrary.privacyMaskSettings.micNotReported`,`The camera did not report its microphone, so this state is unknown.`):X.costWhenOff:l(`uiLibrary.privacyMaskSettings.writeFailed`,`Write failed: {{reason}}`,{reason:L})})]})]})}):null}export{h as PrivacyMaskSettings};
|
|
1
|
+
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,x as ee}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Fa as te,K as ne,Ma as re,U as ie,X as ae,Yt as oe,cn as se,gt as ce,hr as le,n as ue,ri as de,z as c}from"./player-overlays-DilQz9uf.js";import{n as fe,t as pe}from"./mic-off-BIQ5bbUV.js";import{MaskShapeCanvas as me}from"./MaskShapeCanvas-g7yAssct.js";s();var l=`Microphone`,u=`The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.`;function he(e){let t=e.supportsAudioMute===!0,n=t?e.audioEnabled:null,r=e.pendingOn??null;return{label:l,supported:t,on:n===null?null:r??n,available:t&&n!==null,costWhenOff:u}}function ge(e){return!e.available||e.on===null?null:{enabled:!e.on}}var d=120,_e=`privacy-mask`,f=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,p=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function m(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function ve(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function ye(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function h({deviceId:s}){let l=te(),u=ne(ce().trpcClient,s),[h,g]=o(null),[_,v]=o(!1),[y,b]=o(!1),[x,S]=o(null),[C,w]=o(null),[T,E]=o(!1),[D,O]=o(!1),[k,A]=o(null),[j,M]=o(null),[N,P]=o(null),[F,I]=o(null),[L,R]=o(null),z=t(!1);a(()=>{if(!u)return;let e=!1;return z.current=!1,g(null),v(!1),b(!1),S(null),w(null),O(!1),A(null),M(null),P(null),I(null),R(null),(async()=>{try{let t=await u.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(g(t),z.current)return;let n=await u.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);if(n.regions===null){b(!0),P(n.audioEnabled);return}z.current=!0;let r={enabled:n.enabled,regions:n.regions};w(r),S(r),P(n.audioEnabled)}catch(t){if(e)return;ie(t)?v(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[u]);let B=n(()=>x!==null&&C!==null&&(x.enabled!==C.enabled||!ye(x.regions,C.regions)),[x,C]),V=x?x.regions.length:0,H=h?h.maxRegions:0,U=t(0);a(()=>{U.current=H},[H]);let W=H>0&&V>=H,be=r(()=>{S(e=>e&&{...e,enabled:!e.enabled})},[]),G=r(e=>{A(typeof e==`number`?e:null)},[]),K=n(()=>x?x.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:l(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:e.id})})):[],[x,l]),q=r((e,t)=>{let n=m(t);n&&S(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),J=r(e=>{let t=m(e);t&&(M(null),S(e=>{if(!e)return e;let n=U.current;if(n>0&&e.regions.length>=n)return e;let r=ve(e.regions),i={id:r,enabled:!0,shape:t};return A(r),{...e,regions:[...e.regions,i]}}))},[]),Y=r(e=>{O(!0),A(null),M(e)},[]),xe=r(e=>{O(!0),M(null),A(e)},[]),Se=r(e=>{A(t=>t===e?null:t),S(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),Ce=r(()=>{M(null),A(null),C&&S({enabled:C.enabled,regions:C.regions})},[C]),we=r(async()=>{if(!(!u||!x)){E(!0);try{await u.privacyMask?.setMask({patch:{enabled:x.enabled,regions:[...x.regions]}});let e=await u.privacyMask?.getStatus({});if(e&&e.regions!==null){let t={enabled:e.enabled,regions:e.regions};w(t),S(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{E(!1)}}},[u,x]),X=he({supportsAudioMute:h===null?null:h.supportsAudioMute,audioEnabled:N,pendingOn:F}),Z=r(async()=>{let e=ge(X);if(!(!u||e===null)){I(e.enabled),R(null);try{await u.privacyMask?.setAudioEnabled(e);let t=await u.privacyMask?.getStatus({});t&&P(t.audioEnabled)}catch(e){console.error(`Privacy microphone write failed — reverting`,e),R(e instanceof Error?e.message:String(e))}finally{I(null)}}},[u,X]),Te=r(()=>{O(e=>(e&&(M(null),A(null)),!e))},[]),Q=h?.supportedShapes??[];ue(n(()=>D&&!_&&h&&x?{id:_e,order:d,node:i(me,{transparent:!0,items:K,supportedShapes:Q,polygonVertices:h.polygonVertices,selectedId:k,onSelect:G,onShapeChange:q,onDrawComplete:J,drawingKind:j})}:null,[D,_,h,x,K,Q,k,G,q,J,j]));let Ee=h?.supportedShapes.includes(`rect`)??!1,De=h?.supportedShapes.includes(`polygon`)??!1,$=h!==null&&(h.maxRegions<=0||h.supportedShapes.length===0),Oe=!_&&!$&&!y&&h!==null&&x!==null;return u?i(ae,{title:l(`uiLibrary.privacyMaskSettings.title`,`Privacy Mask`),icon:i(de,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:e(`div`,{className:`flex flex-col gap-3`,children:[_||$?i(`p`,{className:`${c} leading-relaxed`,children:l(`uiLibrary.privacyMaskSettings.unsupported`,`This camera doesn't support an on-board privacy mask.`)}):y?i(`p`,{className:`${c} leading-relaxed`,children:l(`uiLibrary.privacyMaskSettings.unreadable`,`This camera hasn't answered, so what it currently masks is unknown — the editor stays closed rather than showing an empty frame you could save over. A battery camera answers once it wakes; otherwise check that it is reachable.`)}):Oe?e(ee,{children:[i(`p`,{className:`${c} leading-relaxed`,children:i(re,{uiKey:`uiLibrary.privacyMaskSettings.help`,fallback:`Toggle <0>Edit mask</0> to draw blanked-out zones on the live frame, then <1>Save</1> to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`,components:[i(`strong`,{className:`text-foreground`},`edit`),i(`strong`,{className:`text-foreground`},`save`)]})}),e(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[i(`button`,{type:`button`,onClick:Te,disabled:T,"aria-pressed":D,className:D?p:f,children:D?l(`uiLibrary.privacyMaskSettings.doneEditing`,`Done editing`):l(`uiLibrary.privacyMaskSettings.editMask`,`Edit mask`)}),i(`button`,{type:`button`,onClick:be,disabled:T,"aria-pressed":x.enabled,className:x.enabled?p:f,children:x.enabled?l(`uiLibrary.privacyMaskSettings.maskOn`,`Mask on`):l(`uiLibrary.privacyMaskSettings.maskOff`,`Mask off`)}),Ee&&i(`button`,{type:`button`,onClick:()=>Y(`rect`),disabled:T||W,"aria-pressed":j===`rect`,className:j===`rect`?p:f,title:W?l(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):l(`uiLibrary.privacyMaskSettings.addRect`,`Add a rectangle zone`),children:l(`uiLibrary.privacyMaskSettings.rectButton`,`+ Rect`)}),De&&i(`button`,{type:`button`,onClick:()=>Y(`polygon`),disabled:T||W,"aria-pressed":j===`polygon`,className:j===`polygon`?p:f,title:W?l(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):l(`uiLibrary.privacyMaskSettings.addPolygon`,`Add a polygon zone`),children:l(`uiLibrary.privacyMaskSettings.polygonButton`,`+ Polygon`)}),i(`span`,{className:`${c} ml-1 tabular-nums`,children:l(`uiLibrary.privacyMaskSettings.zoneCount`,`{{active}} / {{max}} zones`,{active:V,max:H})}),i(`span`,{className:`flex-1`}),i(`button`,{type:`button`,onClick:Ce,disabled:T||!B,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:l(`uiLibrary.privacyMaskSettings.revert`,`Revert`)}),i(`button`,{type:`button`,onClick:()=>void we(),disabled:T||!B,className:p,children:T?l(`uiLibrary.privacyMaskSettings.saving`,`Saving…`):l(`uiLibrary.privacyMaskSettings.save`,`Save`)})]}),V>0?i(`div`,{className:`flex flex-col gap-1`,children:x.regions.map(t=>{let n=k===t.id,r=t.shape.kind===`polygon`?fe:se;return e(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${n?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[e(`button`,{type:`button`,onClick:()=>xe(t.id),disabled:T,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[i(r,{className:`h-3.5 w-3.5 shrink-0`}),i(`span`,{children:l(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:t.id})}),i(`span`,{className:`text-foreground-faint capitalize`,children:t.shape.kind})]}),i(`button`,{type:`button`,onClick:()=>Se(t.id),disabled:T,"aria-label":l(`uiLibrary.privacyMaskSettings.deleteZoneN`,`Delete zone {{id}}`,{id:t.id}),title:l(`uiLibrary.privacyMaskSettings.deleteZone`,`Delete zone`),className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:i(oe,{className:`h-3.5 w-3.5`})})]},t.id)})}):null]}):i(`p`,{className:`${c} leading-relaxed`,children:l(`uiLibrary.privacyMaskSettings.loading`,`Loading the camera's privacy mask…`)}),X.supported&&e(`div`,{className:`flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2`,children:[i(`button`,{type:`button`,role:`switch`,"aria-label":X.label,"aria-checked":X.on===!0,disabled:!X.available||F!==null,onClick:()=>void Z(),title:X.on===null?l(`uiLibrary.privacyMaskSettings.micTitleUnknown`,`Microphone — state unknown; the camera did not answer.`):X.on?l(`uiLibrary.privacyMaskSettings.micTitleOn`,`The camera is capturing sound. Turning it off: {{cost}}`,{cost:X.costWhenOff}):l(`uiLibrary.privacyMaskSettings.micTitleOff`,`The camera is silent. {{cost}}`,{cost:X.costWhenOff}),className:X.on===!1||X.on===null?f:p,children:e(`span`,{className:`inline-flex items-center gap-1.5`,children:[X.on===!1?i(pe,{className:`h-3.5 w-3.5`}):i(le,{className:`h-3.5 w-3.5`}),X.on===null?l(`uiLibrary.privacyMaskSettings.micUnknown`,`Microphone unknown`):X.on?l(`uiLibrary.privacyMaskSettings.micOn`,`Microphone on`):l(`uiLibrary.privacyMaskSettings.micOff`,`Microphone off`)]})}),i(`p`,{className:`text-[10px] text-foreground-subtle flex-1 leading-relaxed`,children:L===null?X.on===null?l(`uiLibrary.privacyMaskSettings.micNotReported`,`The camera did not report its microphone, so this state is unknown.`):X.costWhenOff:l(`uiLibrary.privacyMaskSettings.writeFailed`,`Write failed: {{reason}}`,{reason:L})})]})]})}):null}export{h as PrivacyMaskSettings};
|
|
@@ -1 +1 @@
|
|
|
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{Da as l,Ea as u,Ei as d,Er as f,Kt as p,St as m,Vr as h,Y as g,Yt as _,ci as v,ct as y,ei as b,gt as x,pi as S,qi as C,ut as w,ya as T}from"./player-overlays-BhrNQiuF.js";import{uc as E}from"./client-D5elicir.js";import{t as D}from"./scissors-Bbq6WhOK.js";import{$c as O,$u as k,Al as A,Ci as j,Cu as M,El as N,Ff as P,Gc as ee,Gn as te,Gr as ne,Hi as F,If as re,Jr as ie,Ju as ae,Lo as I,Qu as oe,Su as se,Ur as ce,Wi as L,Wn as R,Wr as le,Xu as ue,Yr as de,Yu as fe,Zc as pe,Zu as me,_u as he,ad as ge,ai as z,bu as _e,ed as ve,gu as ye,id as be,nd as xe,nf as B,qc as Se,qr as Ce,rd as we,td as Te,uf as V,vu as Ee,xu as De,yu as Oe,zf as H}from"./src-B_Sz8ZXm.js";import{t as U}from"./i18n-BNkA6jrS.js";import{t as W}from"./useTranslation-BJr-n0es.js";import{D as ke,Kr as Ae,x as je}from"./index-BKgdp64z.js";import{t as Me}from"./AdminSectionedPage-Bff3Jex6.js";import{n as Ne}from"./authed-media-BDz2D3wE.js";import{t as G}from"./format-size-DIxKXxtj.js";import{n as Pe,r as Fe,t as Ie}from"./StorageLocationsTable-BvMGBanJ.js";o();var Le=[{value:`all`,labelKey:`common.all`},{value:`recording`,labelKey:`recordings.activitySection.domainRecordings`},{value:`events`,labelKey:`common.events`}],Re={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},ze={columnKey:`at`,dir:`desc`};function Be(e){return new Date(e).toLocaleString()}function Ve(){let{t:n,i18n:i}=W(),[o,s]=a(`all`),{data:l,isLoading:d,isError:m}=Ee({},{refetchOnWindowFocus:!1}),{data:h,isLoading:g,isError:_}=pe({},{refetchOnWindowFocus:!1}),{data:v}=I({isCamera:!0,projection:`slim`}),y=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),b=t(()=>{let e=[...l??[],...h??[]];return(o===`all`?e:e.filter(e=>e.domain===o)).toSorted((e,t)=>t.at-e.at)},[l,h,o]),x=t(()=>{let e=[];return m&&o!==`events`&&e.push(n(`recordings.activitySection.domainRecordings`)),_&&o!==`recording`&&e.push(n(`common.events`)),e},[m,_,o,n]),S=t(()=>new Intl.ListFormat(i.language,{type:`conjunction`}).format(x),[x,i.language]),C=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:Be(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 ${Re[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`:y.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:y.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?G(e.bytesReclaimed):`—`})}],[y,n]),w=d||g;return e(`div`,{className:`flex flex-col gap-4`,children:[r(`div`,{className:`flex items-center gap-1`,children:Le.map(e=>r(B,{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))}),w&&b.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{className:`h-4 w-4 animate-spin`}),n(`recordings.activitySection.loadingActivity`,`Loading activity…`)]}):b.length===0?x.length>0?r(z,{icon:p,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:S})}):r(z,{icon:u,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:[x.length>0&&e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[r(p,{className:`h-3 w-3 shrink-0`}),n(`recordings.activitySection.domainsMissing`,{count:x.length,names:S})]}),r(R,{columns:C,rows:b,rowKey:e=>e.id,minWidthPx:720,maxBodyHeight:te,defaultSort:ze})]})]})}o();function He(){let{t:n}=W(),i=I({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:C,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(w,{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(j,{deviceId:l,children:r(ke,{deviceId:l,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},l)]})}function K({types:e}){return r(Ie,{kinds:e})}o();var q=`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}=W(),i=s(),{nodes:a}=re(),{data:o,isLoading:c}=F({addonId:q,cap:Ue,scope:`cluster`}),l=We(o),u=L({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(f,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(w,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:q,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(f,{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(K,{types:[`eventMedia`]})]})]})}o();var Ke=[[`pipelineAnalytics`]],qe=1440*60*1e3;function Je(e,t){return t.get(e)??U.t(`recordings.eventsManagementSection.removedCamera`,{id:String(e)})}var Ye=[{days:1},{days:7},{days:30},{days:90}];function Xe(){let{t:i}=W(),o=s(),c=y(),[l,u]=a(30),[d,p]=a(null),{data:m,isLoading:h}=Se({},{refetchOnWindowFocus:!1}),{data:v}=I({isCamera:!0,projection:`slim`}),b=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),x=n(()=>{o.invalidateQueries({queryKey:Ke})},[o]),C=O({onSuccess:x}),T=ee(),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`})&&C.mutate({olderThanMs:Date.now()-l*qe,reason:`retention`})},[c,C,l,i]),k=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:G(e.bytes)}),confirmLabel:i(`recordings.eventsManagementSection.deleteEvents`,`Delete events`),variant:`danger`})){p(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){p(`0 events deleted for ${t}. Media still listed (${G(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}p(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){p(e instanceof Error?e.message:String(e))}}},[c,T,b,x,i]),A=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:G(e.bytes)})},{key:`actions`,header:``,align:`right`,render:t=>e(B,{variant:`unstyled`,onClick:()=>{k(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,k,T.isPending,i]);return h&&!m?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{className:`h-4 w-4 animate-spin`}),i(`recordings.eventsManagementSection.loadingEventStoreFootprint`,`Loading event-store footprint…`)]}):m?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(m.devices.length)} camera${m.devices.length===1?``:`s`}`,children:m.totalRows.toLocaleString()}),r(g,{label:i(`recordings.eventsManagementSection.eventMediaOnDisk`,`Event media on disk`),children:G(m.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(w,{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(B,{variant:`unstyled`,onClick:()=>{E()},disabled:C.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:[C.isPending?r(f,{className:`h-3 w-3 animate-spin`}):r(D,{className:`h-3 w-3`}),i(`recordings.eventsManagementSection.pruneNow`,`Prune now`)]})]}),m.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:A,rows:[...m.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}=W();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 U.t(`helpers.exportFormat.expired`);let r=Math.floor(n/6e4);if(r<60)return U.t(`helpers.exportFormat.inMinutes`,{n:String(r)});let i=Math.floor(r/60);return i<24?U.t(`helpers.exportFormat.inHours`,{n:String(i)}):U.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}=W(),s=I({isCamera:!0,projection:`slim`}),c=t(()=>(s.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[s.data]),[u,d]=a(``),[f,p]=a(`high`),[m,h]=a(ot(60)),[g,_]=a(ot(0)),[v,y]=a(1),[x,S]=a(!0),[C,T]=a(``),[E,D]=a(null),O=u===``?c[0]?.id??null:u,k=new Date(m).getTime(),A=new Date(g).getTime(),j=Number.isFinite(k)&&Number.isFinite(A)&&k<A,M=De({onSuccess:()=>{i(),n()},onError:e=>D(e instanceof Error?e.message:String(e))});return r(ce,{open:!0,onOpenChange:e=>!e&&n(),children:e(ne,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(ie,{children:e(de,{className:`flex items-center gap-1.5`,children:[r(b,{className:`h-3.5 w-3.5`}),o(`recordings.newExportModal.newExport`,`New export`)]})}),e(le,{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(w,{value:O??``,onChange:e=>d(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(w,{value:f,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(V,{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(V,{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(w,{value:v,onChange:e=>y(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(V,{type:`text`,value:C,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(l,{checked:x,disabled:v!==1,onChange:e=>S(e.target.checked),className:`accent-primary`}),o(v===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!j&&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(Ce,{children:[r(B,{variant:`outline`,size:`sm`,onClick:n,children:o(`common.cancel`,`Cancel`)}),r(B,{size:`sm`,onClick:()=>{if(O===null||!j)return;D(null);let e=C.trim();M.mutate({deviceId:O,profile:f,fromMs:k,toMs:A,options:{includeAudio:x,maxLifeMs:at,deleteAfterDownload:!1,...v===1?{}:{speed:v},...e.length>0?{title:e}:{}}})},disabled:O===null||!j||M.isPending,children:M.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}=M({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:r}=H(E.RecordingExportProgress,e=>e.exportId),{map:i}=H(E.RecordingExportCompleted,e=>e.exportId),{map:a}=H(E.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}=W(),o=s(),[c,l]=a(!1),u=()=>{o.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},p=y(),m=x().trpcClient,h=dt(6e4),{rows:g,isLoading:S}=ut(),{data:C}=I({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=_e({onSuccess:T}),D=se({onSuccess:T}),[O,k]=a(null),A=n(async e=>{k(e.id);try{let{url:t}=await m.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await Ne(t),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.options.title??e.id}.mp4`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),T()}finally{k(null)}},[m,T]),j=n(async e=>{await p({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})},[p,E,i]),M=n(async e=>{await p({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})},[p,D,i]),N=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(f,{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?`—`:G(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(B,{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(f,{className:`h-3 w-3 animate-spin`}):r(v,{className:`h-3 w-3`}),i(`recordings.exportsSection.download`,`Download`)]}),a&&e(B,{variant:`unstyled`,onClick:()=>{j(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(d,{className:`h-3 w-3`}),i(`common.cancel`,`Cancel`)]}),o&&r(B,{variant:`unstyled`,onClick:()=>{M(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,j,M,i]);return S&&g.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{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(B,{variant:`unstyled`,onClick:()=>l(!0),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground`,children:[r(b,{className:`h-3.5 w-3.5`}),i(`recordings.exportsSection.newExport`,`New export`)]})}),g.length===0?r(z,{icon:b,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:N,rows:g,rowKey:e=>e.id,minWidthPx:720}),c&&r(st,{onClose:()=>l(!1),onCreated:u})]})}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 (${G(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${G(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${G(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function _t(){let{t:e}=W(),t=P(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}=W(),n=y(),[i,o]=a(!1),[s,c]=a(null),u=oe({},{refetchInterval:2e3}),d=u.data??null,p=d!==null&&ht.has(d.phase),m=me(),h=ue(),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 m.mutateAsync({includeDebugMedia:i}),await u.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}},v=async()=>{if(d&&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:d.jobId}),await u.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(l,{checked:i,disabled:p,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(B,{variant:`unstyled`,type:`button`,disabled:p||m.isPending,onClick:()=>{g()},className:pt,children:[(p||m.isPending)&&r(f,{className:`h-3 w-3 animate-spin`}),r(_,{className:`h-3 w-3`}),t(`recordings.cleanupSection.runCleanup`,`Run cleanup`)]}),p&&r(B,{variant:`unstyled`,type:`button`,onClick:()=>{v()},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}),d&&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:d.phase}),p&&r(f,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),d.detail&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:d.detail}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:gt(d)}),d.error&&r(`p`,{className:`text-[11px] text-danger`,children:d.error})]})]})}o();var yt=2e3;function bt(){let{t}=W(),n=y(),a=s(),o=A(),c=N(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 p=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())},m=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(B,{variant:`unstyled`,type:`button`,onClick:()=>void p(),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(f,{className:`h-3.5 w-3.5 animate-spin`}):r(h,{className:`h-3.5 w-3.5`}),m]}),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?`${G(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:`${G(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}=W(),n=P(wt);return n===`pending`?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{className:`h-4 w-4 animate-spin`}),t(`migration.storageMigrationSection.checkingWhetherStorageMigrationIs`,`Checking whether storage migration is installed…`)]}):n===`unknown`?r(z,{icon:p,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:T,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}=W(),i=y(),{data:o}=ae({}),[s,c]=a({}),[l,u]=a({}),[d,p]=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]),v=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=ge({},{refetchInterval:2e3}),x=b.data??null,S=x!==null&&Tt.has(x.phase),C=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]),E=t(()=>{let e={};for(let t of Q){if(!s[t.id])continue;let n=l[t.id]??v.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s,l,v]),D=t(()=>({destinations:C??{},...E?{sources:E}:{}}),[C,E]),O=xe(D,{enabled:!1,retry:!1}),k=be(),A=fe(),j=async()=>{if(!C)return;g(null);let e=await O.refetch();if(e.error){g(e.error instanceof Error?e.error.message:String(e.error));return}p(e.data??null)},M=async()=>{if(C&&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),p(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(T,{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=v.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(w,{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(w,{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(B,{variant:`unstyled`,type:`button`,onClick:()=>{j()},disabled:!C||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(f,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.plan`,`Plan`)]}),e(B,{variant:`unstyled`,type:`button`,onClick:()=>{M()},disabled:!C||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(f,{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(B,{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(m,{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(f,{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}=W(),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}=W(),{data:n}=ve({});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}=W(),i=y(),o=we({},{staleTime:1/0,refetchOnWindowFocus:!1}),s=k(),[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(B,{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(B,{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 U.t(`recordings.storageMigrationSection.residueUnknown`);let t=e.items.toLocaleString(`en-US`);return e.bytes===null?U.t(`recordings.storageMigrationSection.residueRows`,{count:e.items,items:t}):U.t(`recordings.storageMigrationSection.residueSegments`,{count:e.items,items:t,size:G(e.bytes)})}function Mt(){let{t}=W(),{data:n}=Te({},{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}=W();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}=W(),i=s(),{nodes:a}=re(),{data:o,isLoading:c}=F({addonId:Pt,cap:Ft,scope:`cluster`}),l=It(o,`recordingNodeId`,`hub`),u=L({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(f,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(w,{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(f,{className:`h-4 w-4 animate-spin text-primary`})]}),l!==`hub`&&r(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:r(Ae,{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(K,{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?U.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(` + `):U.t(`recordings.storageSection.defaultRoot`):e.root}function qt(){let{t:i}=W(),o=s(),c=y(),[l,u]=a(`retention`),{data:d,isLoading:p}=he({},{refetchOnWindowFocus:!1}),{data:m}=I({isCamera:!0,projection:`slim`}),{data:v}=ae({}),b=t(()=>{let e=new Map;for(let t of m??[])e.set(t.id,t.name);return e},[m]),x=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.displayName);return e},[v]),S=t(()=>{let e=v??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[v]),C=t(()=>d?.locations??[],[d?.locations]),T=t(()=>Bt(C,x,S),[C,x,S]),E=t(()=>Fe(C),[C]),O=n(()=>{o.invalidateQueries({queryKey:Vt})},[o]),k=Oe({onSuccess:O}),A=ye({onSuccess:O}),j=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]),M=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:G(e.usedBytes)}),confirmLabel:i(`recordings.storageSection.delete`,`Delete {{value1}}`,{value1:G(e.usedBytes)}),variant:`danger`})&&A.mutate({deviceId:e.deviceId})},[c,A,b,i]),N=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:G(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(B,{variant:`unstyled`,onClick:()=>{j(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(B,{variant:`unstyled`,onClick:()=>{M(t)},disabled:A.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,j,M,k.isPending,A.isPending,i]);if(p&&!d)return e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{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 P=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(P)} camera${P===1?``:`s`} on ${d.nodeId}`,children:G(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 ${G(E.totalBytes)}`+(E.unknownVolumes>0?` · ${String(E.unknownVolumes)} did not report capacity`:``),children:r(`span`,{className:`tabular-nums ${Wt[E.severity]}`,children:G(E.freeBytes)})}),C.map(t=>{let n=Pe(t),a=t.locationId??t.root??`default`;return r(g,{label:i(`recordings.storageSection.disk2`,`Disk: {{label}}`,{label:Kt(t,x)}),footer:n===null?`${G(t.usedBytes)} of recordings · volume capacity unknown`:`${G(n.freeBytes)} free of ${G(n.totalBytes)} · ${G(t.usedBytes)} recordings (${$(n.recordingsFraction)})`,children:n===null?r(`span`,{className:`tabular-nums`,children:G(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(w,{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))})]}),P===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:N,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Jt(){let{t}=W();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}=W(),t=je(`/recordings`,{t:e,isAdmin:!0})??{icon:b,title:e(`nav.recordings`,`Recordings`)};return r(Me,{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(He,{})},{id:`exports`,label:e(`recordings.export`,`Export`),content:r(ft,{})},{id:`activity`,label:e(`recordings.activity`,`Activity`),content:r(Ve,{})},{id:`management`,label:e(`recordings.management`,`Management`),content:r(Nt,{})}]})}export{Yt as RecordingsPage};
|
|
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{Da as l,Ea as u,Ei as d,Er as f,Kt as p,St as m,Vr as h,Y as g,Yt as _,ci as v,ct as y,ei as b,gt as x,pi as S,qi as C,ut as w,ya as T}from"./player-overlays-DilQz9uf.js";import{uc as E}from"./client-CxoliObn.js";import{t as D}from"./scissors-Bbq6WhOK.js";import{$c as O,$u as k,Al as A,Ci as j,Cu as M,El as N,Ff as P,Gc as ee,Gn as te,Gr as ne,Hi as F,If as re,Jr as ie,Ju as ae,Lo as I,Qu as oe,Su as se,Ur as ce,Wi as L,Wn as R,Wr as le,Xu as ue,Yr as de,Yu as fe,Zc as pe,Zu as me,_u as he,ad as ge,ai as z,bu as _e,ed as ve,gu as ye,id as be,nd as xe,nf as B,qc as Se,qr as Ce,rd as we,td as Te,uf as V,vu as Ee,xu as De,yu as Oe,zf as H}from"./src-BgJM3bf_.js";import{t as U}from"./i18n-C__Kv-sS.js";import{t as W}from"./useTranslation-BJr-n0es.js";import{D as ke,Kr as Ae,x as je}from"./index-hhTXvvOB.js";import{t as Me}from"./AdminSectionedPage-CWRY6TXK.js";import{n as Ne}from"./authed-media-CYJ67W1F.js";import{t as G}from"./format-size-DIxKXxtj.js";import{n as Pe,r as Fe,t as Ie}from"./StorageLocationsTable-CIQLMsJC.js";o();var Le=[{value:`all`,labelKey:`common.all`},{value:`recording`,labelKey:`recordings.activitySection.domainRecordings`},{value:`events`,labelKey:`common.events`}],Re={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},ze={columnKey:`at`,dir:`desc`};function Be(e){return new Date(e).toLocaleString()}function Ve(){let{t:n,i18n:i}=W(),[o,s]=a(`all`),{data:l,isLoading:d,isError:m}=Ee({},{refetchOnWindowFocus:!1}),{data:h,isLoading:g,isError:_}=pe({},{refetchOnWindowFocus:!1}),{data:v}=I({isCamera:!0,projection:`slim`}),y=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),b=t(()=>{let e=[...l??[],...h??[]];return(o===`all`?e:e.filter(e=>e.domain===o)).toSorted((e,t)=>t.at-e.at)},[l,h,o]),x=t(()=>{let e=[];return m&&o!==`events`&&e.push(n(`recordings.activitySection.domainRecordings`)),_&&o!==`recording`&&e.push(n(`common.events`)),e},[m,_,o,n]),S=t(()=>new Intl.ListFormat(i.language,{type:`conjunction`}).format(x),[x,i.language]),C=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:Be(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 ${Re[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`:y.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:y.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?G(e.bytesReclaimed):`—`})}],[y,n]),w=d||g;return e(`div`,{className:`flex flex-col gap-4`,children:[r(`div`,{className:`flex items-center gap-1`,children:Le.map(e=>r(B,{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))}),w&&b.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{className:`h-4 w-4 animate-spin`}),n(`recordings.activitySection.loadingActivity`,`Loading activity…`)]}):b.length===0?x.length>0?r(z,{icon:p,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:S})}):r(z,{icon:u,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:[x.length>0&&e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[r(p,{className:`h-3 w-3 shrink-0`}),n(`recordings.activitySection.domainsMissing`,{count:x.length,names:S})]}),r(R,{columns:C,rows:b,rowKey:e=>e.id,minWidthPx:720,maxBodyHeight:te,defaultSort:ze})]})]})}o();function He(){let{t:n}=W(),i=I({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:C,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(w,{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(j,{deviceId:l,children:r(ke,{deviceId:l,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},l)]})}function K({types:e}){return r(Ie,{kinds:e})}o();var q=`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}=W(),i=s(),{nodes:a}=re(),{data:o,isLoading:c}=F({addonId:q,cap:Ue,scope:`cluster`}),l=We(o),u=L({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(f,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(w,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:q,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(f,{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(K,{types:[`eventMedia`]})]})]})}o();var Ke=[[`pipelineAnalytics`]],qe=1440*60*1e3;function Je(e,t){return t.get(e)??U.t(`recordings.eventsManagementSection.removedCamera`,{id:String(e)})}var Ye=[{days:1},{days:7},{days:30},{days:90}];function Xe(){let{t:i}=W(),o=s(),c=y(),[l,u]=a(30),[d,p]=a(null),{data:m,isLoading:h}=Se({},{refetchOnWindowFocus:!1}),{data:v}=I({isCamera:!0,projection:`slim`}),b=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),x=n(()=>{o.invalidateQueries({queryKey:Ke})},[o]),C=O({onSuccess:x}),T=ee(),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`})&&C.mutate({olderThanMs:Date.now()-l*qe,reason:`retention`})},[c,C,l,i]),k=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:G(e.bytes)}),confirmLabel:i(`recordings.eventsManagementSection.deleteEvents`,`Delete events`),variant:`danger`})){p(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){p(`0 events deleted for ${t}. Media still listed (${G(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}p(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){p(e instanceof Error?e.message:String(e))}}},[c,T,b,x,i]),A=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:G(e.bytes)})},{key:`actions`,header:``,align:`right`,render:t=>e(B,{variant:`unstyled`,onClick:()=>{k(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,k,T.isPending,i]);return h&&!m?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{className:`h-4 w-4 animate-spin`}),i(`recordings.eventsManagementSection.loadingEventStoreFootprint`,`Loading event-store footprint…`)]}):m?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(m.devices.length)} camera${m.devices.length===1?``:`s`}`,children:m.totalRows.toLocaleString()}),r(g,{label:i(`recordings.eventsManagementSection.eventMediaOnDisk`,`Event media on disk`),children:G(m.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(w,{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(B,{variant:`unstyled`,onClick:()=>{E()},disabled:C.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:[C.isPending?r(f,{className:`h-3 w-3 animate-spin`}):r(D,{className:`h-3 w-3`}),i(`recordings.eventsManagementSection.pruneNow`,`Prune now`)]})]}),m.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:A,rows:[...m.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}=W();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 U.t(`helpers.exportFormat.expired`);let r=Math.floor(n/6e4);if(r<60)return U.t(`helpers.exportFormat.inMinutes`,{n:String(r)});let i=Math.floor(r/60);return i<24?U.t(`helpers.exportFormat.inHours`,{n:String(i)}):U.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}=W(),s=I({isCamera:!0,projection:`slim`}),c=t(()=>(s.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[s.data]),[u,d]=a(``),[f,p]=a(`high`),[m,h]=a(ot(60)),[g,_]=a(ot(0)),[v,y]=a(1),[x,S]=a(!0),[C,T]=a(``),[E,D]=a(null),O=u===``?c[0]?.id??null:u,k=new Date(m).getTime(),A=new Date(g).getTime(),j=Number.isFinite(k)&&Number.isFinite(A)&&k<A,M=De({onSuccess:()=>{i(),n()},onError:e=>D(e instanceof Error?e.message:String(e))});return r(ce,{open:!0,onOpenChange:e=>!e&&n(),children:e(ne,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(ie,{children:e(de,{className:`flex items-center gap-1.5`,children:[r(b,{className:`h-3.5 w-3.5`}),o(`recordings.newExportModal.newExport`,`New export`)]})}),e(le,{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(w,{value:O??``,onChange:e=>d(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(w,{value:f,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(V,{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(V,{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(w,{value:v,onChange:e=>y(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(V,{type:`text`,value:C,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(l,{checked:x,disabled:v!==1,onChange:e=>S(e.target.checked),className:`accent-primary`}),o(v===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!j&&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(Ce,{children:[r(B,{variant:`outline`,size:`sm`,onClick:n,children:o(`common.cancel`,`Cancel`)}),r(B,{size:`sm`,onClick:()=>{if(O===null||!j)return;D(null);let e=C.trim();M.mutate({deviceId:O,profile:f,fromMs:k,toMs:A,options:{includeAudio:x,maxLifeMs:at,deleteAfterDownload:!1,...v===1?{}:{speed:v},...e.length>0?{title:e}:{}}})},disabled:O===null||!j||M.isPending,children:M.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}=M({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:r}=H(E.RecordingExportProgress,e=>e.exportId),{map:i}=H(E.RecordingExportCompleted,e=>e.exportId),{map:a}=H(E.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}=W(),o=s(),[c,l]=a(!1),u=()=>{o.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},p=y(),m=x().trpcClient,h=dt(6e4),{rows:g,isLoading:S}=ut(),{data:C}=I({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=_e({onSuccess:T}),D=se({onSuccess:T}),[O,k]=a(null),A=n(async e=>{k(e.id);try{let{url:t}=await m.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await Ne(t),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.options.title??e.id}.mp4`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),T()}finally{k(null)}},[m,T]),j=n(async e=>{await p({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})},[p,E,i]),M=n(async e=>{await p({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})},[p,D,i]),N=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(f,{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?`—`:G(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(B,{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(f,{className:`h-3 w-3 animate-spin`}):r(v,{className:`h-3 w-3`}),i(`recordings.exportsSection.download`,`Download`)]}),a&&e(B,{variant:`unstyled`,onClick:()=>{j(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(d,{className:`h-3 w-3`}),i(`common.cancel`,`Cancel`)]}),o&&r(B,{variant:`unstyled`,onClick:()=>{M(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,j,M,i]);return S&&g.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{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(B,{variant:`unstyled`,onClick:()=>l(!0),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground`,children:[r(b,{className:`h-3.5 w-3.5`}),i(`recordings.exportsSection.newExport`,`New export`)]})}),g.length===0?r(z,{icon:b,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:N,rows:g,rowKey:e=>e.id,minWidthPx:720}),c&&r(st,{onClose:()=>l(!1),onCreated:u})]})}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 (${G(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${G(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${G(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function _t(){let{t:e}=W(),t=P(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}=W(),n=y(),[i,o]=a(!1),[s,c]=a(null),u=oe({},{refetchInterval:2e3}),d=u.data??null,p=d!==null&&ht.has(d.phase),m=me(),h=ue(),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 m.mutateAsync({includeDebugMedia:i}),await u.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}},v=async()=>{if(d&&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:d.jobId}),await u.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(l,{checked:i,disabled:p,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(B,{variant:`unstyled`,type:`button`,disabled:p||m.isPending,onClick:()=>{g()},className:pt,children:[(p||m.isPending)&&r(f,{className:`h-3 w-3 animate-spin`}),r(_,{className:`h-3 w-3`}),t(`recordings.cleanupSection.runCleanup`,`Run cleanup`)]}),p&&r(B,{variant:`unstyled`,type:`button`,onClick:()=>{v()},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}),d&&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:d.phase}),p&&r(f,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),d.detail&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:d.detail}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:gt(d)}),d.error&&r(`p`,{className:`text-[11px] text-danger`,children:d.error})]})]})}o();var yt=2e3;function bt(){let{t}=W(),n=y(),a=s(),o=A(),c=N(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 p=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())},m=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(B,{variant:`unstyled`,type:`button`,onClick:()=>void p(),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(f,{className:`h-3.5 w-3.5 animate-spin`}):r(h,{className:`h-3.5 w-3.5`}),m]}),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?`${G(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:`${G(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}=W(),n=P(wt);return n===`pending`?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{className:`h-4 w-4 animate-spin`}),t(`migration.storageMigrationSection.checkingWhetherStorageMigrationIs`,`Checking whether storage migration is installed…`)]}):n===`unknown`?r(z,{icon:p,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:T,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}=W(),i=y(),{data:o}=ae({}),[s,c]=a({}),[l,u]=a({}),[d,p]=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]),v=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=ge({},{refetchInterval:2e3}),x=b.data??null,S=x!==null&&Tt.has(x.phase),C=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]),E=t(()=>{let e={};for(let t of Q){if(!s[t.id])continue;let n=l[t.id]??v.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s,l,v]),D=t(()=>({destinations:C??{},...E?{sources:E}:{}}),[C,E]),O=xe(D,{enabled:!1,retry:!1}),k=be(),A=fe(),j=async()=>{if(!C)return;g(null);let e=await O.refetch();if(e.error){g(e.error instanceof Error?e.error.message:String(e.error));return}p(e.data??null)},M=async()=>{if(C&&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),p(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(T,{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=v.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(w,{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(w,{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(B,{variant:`unstyled`,type:`button`,onClick:()=>{j()},disabled:!C||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(f,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.plan`,`Plan`)]}),e(B,{variant:`unstyled`,type:`button`,onClick:()=>{M()},disabled:!C||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(f,{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(B,{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(m,{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(f,{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}=W(),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}=W(),{data:n}=ve({});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}=W(),i=y(),o=we({},{staleTime:1/0,refetchOnWindowFocus:!1}),s=k(),[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(B,{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(B,{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 U.t(`recordings.storageMigrationSection.residueUnknown`);let t=e.items.toLocaleString(`en-US`);return e.bytes===null?U.t(`recordings.storageMigrationSection.residueRows`,{count:e.items,items:t}):U.t(`recordings.storageMigrationSection.residueSegments`,{count:e.items,items:t,size:G(e.bytes)})}function Mt(){let{t}=W(),{data:n}=Te({},{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}=W();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}=W(),i=s(),{nodes:a}=re(),{data:o,isLoading:c}=F({addonId:Pt,cap:Ft,scope:`cluster`}),l=It(o,`recordingNodeId`,`hub`),u=L({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(f,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(w,{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(f,{className:`h-4 w-4 animate-spin text-primary`})]}),l!==`hub`&&r(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:r(Ae,{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(K,{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?U.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(` + `):U.t(`recordings.storageSection.defaultRoot`):e.root}function qt(){let{t:i}=W(),o=s(),c=y(),[l,u]=a(`retention`),{data:d,isLoading:p}=he({},{refetchOnWindowFocus:!1}),{data:m}=I({isCamera:!0,projection:`slim`}),{data:v}=ae({}),b=t(()=>{let e=new Map;for(let t of m??[])e.set(t.id,t.name);return e},[m]),x=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.displayName);return e},[v]),S=t(()=>{let e=v??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[v]),C=t(()=>d?.locations??[],[d?.locations]),T=t(()=>Bt(C,x,S),[C,x,S]),E=t(()=>Fe(C),[C]),O=n(()=>{o.invalidateQueries({queryKey:Vt})},[o]),k=Oe({onSuccess:O}),A=ye({onSuccess:O}),j=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]),M=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:G(e.usedBytes)}),confirmLabel:i(`recordings.storageSection.delete`,`Delete {{value1}}`,{value1:G(e.usedBytes)}),variant:`danger`})&&A.mutate({deviceId:e.deviceId})},[c,A,b,i]),N=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:G(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(B,{variant:`unstyled`,onClick:()=>{j(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(B,{variant:`unstyled`,onClick:()=>{M(t)},disabled:A.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,j,M,k.isPending,A.isPending,i]);if(p&&!d)return e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(f,{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 P=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(P)} camera${P===1?``:`s`} on ${d.nodeId}`,children:G(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 ${G(E.totalBytes)}`+(E.unknownVolumes>0?` · ${String(E.unknownVolumes)} did not report capacity`:``),children:r(`span`,{className:`tabular-nums ${Wt[E.severity]}`,children:G(E.freeBytes)})}),C.map(t=>{let n=Pe(t),a=t.locationId??t.root??`default`;return r(g,{label:i(`recordings.storageSection.disk2`,`Disk: {{label}}`,{label:Kt(t,x)}),footer:n===null?`${G(t.usedBytes)} of recordings · volume capacity unknown`:`${G(n.freeBytes)} free of ${G(n.totalBytes)} · ${G(t.usedBytes)} recordings (${$(n.recordingsFraction)})`,children:n===null?r(`span`,{className:`tabular-nums`,children:G(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(w,{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))})]}),P===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:N,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Jt(){let{t}=W();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}=W(),t=je(`/recordings`,{t:e,isAdmin:!0})??{icon:b,title:e(`nav.recordings`,`Recordings`)};return r(Me,{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(He,{})},{id:`exports`,label:e(`recordings.export`,`Export`),content:r(ft,{})},{id:`activity`,label:e(`recordings.activity`,`Activity`),content:r(Ve,{})},{id:`management`,label:e(`recordings.management`,`Management`),content:r(Nt,{})}]})}export{Yt as RecordingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,S as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{ka as i}from"./player-overlays-BhrNQiuF.js";import{Ar as a,Ca as o,Mr as s,Or as c,Sa as l,Ur as u,Wr as d,jr as f,kr as p,va as m,ya as h}from"./client-D5elicir.js";import{t as g}from"./grip-vertical-C89CQZwo.js";import{Df as _,nf as ee}from"./src-B_Sz8ZXm.js";import{t as v}from"./useTranslation-BJr-n0es.js";r();function y(){return{columns:3,rows:4,buttons:[]}}var b=e=>({status:`refused`,reason:e}),x=e=>({status:`ok`,grid:e});function S(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var C=d;function w(e,t){return t.row>=e.row&&t.col>=e.col&&t.row+t.rowSpan<=e.row+e.rowSpan&&t.col+t.colSpan<=e.col+e.colSpan}function T(e){return e.groups??[]}function E(e,t){return T(e).find(e=>e.id===t)}function te(e,t){return e.buttons.filter(e=>e.groupId===t)}function D(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function O(e,t){let{groupId:n,...r}=t;for(let n of T(e))if(C(n,t))return n.frame===`divider`||!w(n,t)?`overlap`:{...r,groupId:n.id};return r}function k(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!S(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&C(e,t)))return`overlap`;let r=O(e,t);return typeof r==`string`?r:null}function A(e,t){let n=k(e,t,t.id);if(n!==null)return b(n);let r=O(e,t);return typeof r==`string`?b(r):x({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function j(e,t){return e.buttons.find(e=>e.id===t)}function ne(e){let t=new Set(e.buttons.map(e=>e.id));for(let n=e.buttons.length+1;;n+=1)if(!t.has(`b${n}`))return`b${n}`}function re(e){for(let t=0;t<e.rows;t+=1)for(let n=0;n<e.columns;n+=1){let r={id:``,row:t,col:n,rowSpan:1,colSpan:1,role:`power`};if(!T(e).some(e=>C(e,r))&&k(e,r,null)===null)return{row:t,col:n}}return null}function ie(e,t){if(e.buttons.length>=200)return b(`outside`);let n=re(e);if(n===null)return b(`outside`);let r=O(e,{id:ne(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?b(r):x({...e,buttons:[...e.buttons,r]})}function M(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,row:n,col:r})}function ae(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):M(e,t,i.row+n,i.col+r)}function oe(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,rowSpan:n,colSpan:r})}function se(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let i=n.icon===void 0?r.icon:n.icon??void 0,a=n.label===void 0?r.label:n.label??void 0,o=a===void 0||a.trim()===``?void 0:a,{icon:s,label:c,...l}=r,u={...l,role:n.role??r.role,...i===void 0?{}:{icon:i},...o===void 0?{}:{label:o}};return x({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function ce(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let{shape:i,tone:a,showLegend:o,...s}=r,c=n.shape===void 0?r.shape:n.shape??void 0,l=n.tone===void 0?r.tone:n.tone??void 0,u=n.showLegend===void 0?r.showLegend:n.showLegend,d={...s,...c===void 0?{}:{shape:c},...l===void 0?{}:{tone:l},...u===!0?{showLegend:u}:{}};return x({...e,buttons:e.buttons.map(e=>e.id===t?d:e)})}function le(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var N=e=>e.ok?x(e.layout):b(e.reason);function ue(e,t,n,r){return N(c(e,t,{row:n,col:r}))}function de(e,t,n){return N(p(e,t,{keepButtons:n}))}function fe(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return x(D(e,T(e).map(e=>e.id===t?o:e)))}function pe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function P(e){let t=new Set,n=T(e);for(let r of n){if(!pe(r))continue;let i=r.row;e.buttons.some(e=>e.row<=i&&i<e.row+e.rowSpan)||n.some(e=>e!==r&&e.row<=i&&i<e.row+e.rowSpan)||t.add(i)}return t}function F(e){let t=P(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function I(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{size:i,hideTitle:a,...o}=r,s=n.size??r.size,c=n.hideTitle??r.hideTitle,l={...o,...s===`normal`?{size:s}:{},...c===!0?{hideTitle:c}:{}};return x(D(e,T(e).map(e=>e.id===t?l:e)))}function L(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return b(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!S(i,e))||T(e).some(e=>!S(i,e))?b(`would-drop-buttons`):x(i)}function R(e){let t=u.safeParse(e);return t.success?t.data:null}function z(e){let t=u.safeParse(e);return t.success?t.data:y()}var B=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function me(e){return e.startsWith(`power`)?`power`:e.startsWith(`volume`)||e===`mute`?`volume`:e.startsWith(`channel`)?`channel`:e.startsWith(`digit_`)?`digits`:[`up`,`down`,`left`,`right`,`ok`,`back`,`home`,`menu`,`exit`].includes(e)?`navigation`:[`play`,`pause`,`play_pause`,`stop`,`next`,`previous`,`fast_forward`,`rewind`].includes(e)?`playback`:`other`}function he(e){return m.filter(t=>me(t)===e)}function ge(e){let t=h(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function _e(e){return h(e)!==null&&!l(e)}function ve(e,t,n){let r={columns:e,rows:t,buttons:[]};for(let e of n){let t={id:e.id,row:e.row,col:e.col,rowSpan:e.rowSpan??1,colSpan:e.colSpan??1,role:e.role,...e.icon===void 0?{}:{icon:e.icon},...e.label===void 0?{}:{label:e.label},...e.tone===void 0?{}:{tone:e.tone},...e.showLegend===!0?{showLegend:!0}:{}},n=k(r,t,null);if(n!==null||r.buttons.some(t=>t.id===e.id))throw Error(`layout button "${e.id}": ${n??`duplicate id`}`);r={...r,buttons:[...r.buttons,t]}}return r}var V=`"/></svg>`,ye={title:`Apple Music`,slug:`applemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple Music</title><path d="`+this.path+V},path:`M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043a5.022 5.022 0 00-1.877-.726 10.496 10.496 0 00-1.564-.15c-.04-.003-.083-.01-.124-.013H5.986c-.152.01-.303.017-.455.026-.747.043-1.49.123-2.193.4-1.336.53-2.3 1.452-2.865 2.78-.192.448-.292.925-.363 1.408-.056.392-.088.785-.1 1.18 0 .032-.007.062-.01.093v12.223c.01.14.017.283.027.424.05.815.154 1.624.497 2.373.65 1.42 1.738 2.353 3.234 2.801.42.127.856.187 1.293.228.555.053 1.11.06 1.667.06h11.03a12.5 12.5 0 001.57-.1c.822-.106 1.596-.35 2.295-.81a5.046 5.046 0 001.88-2.207c.186-.42.293-.87.37-1.324.113-.675.138-1.358.137-2.04-.002-3.8 0-7.595-.003-11.393zm-6.423 3.99v5.712c0 .417-.058.827-.244 1.206-.29.59-.76.962-1.388 1.14-.35.1-.706.157-1.07.173-.95.045-1.773-.6-1.943-1.536a1.88 1.88 0 011.038-2.022c.323-.16.67-.25 1.018-.324.378-.082.758-.153 1.134-.24.274-.063.457-.23.51-.516a.904.904 0 00.02-.193c0-1.815 0-3.63-.002-5.443a.725.725 0 00-.026-.185c-.04-.15-.15-.243-.304-.234-.16.01-.318.035-.475.066-.76.15-1.52.303-2.28.456l-2.325.47-1.374.278c-.016.003-.032.01-.048.013-.277.077-.377.203-.39.49-.002.042 0 .086 0 .13-.002 2.602 0 5.204-.003 7.805 0 .42-.047.836-.215 1.227-.278.64-.77 1.04-1.434 1.233-.35.1-.71.16-1.075.172-.96.036-1.755-.6-1.92-1.544-.14-.812.23-1.685 1.154-2.075.357-.15.73-.232 1.108-.31.287-.06.575-.116.86-.177.383-.083.583-.323.6-.714v-.15c0-2.96 0-5.922.002-8.882 0-.123.013-.25.042-.37.07-.285.273-.448.546-.518.255-.066.515-.112.774-.165.733-.15 1.466-.296 2.2-.444l2.27-.46c.67-.134 1.34-.27 2.01-.403.22-.043.442-.088.663-.106.31-.025.523.17.554.482.008.073.012.148.012.223.002 1.91.002 3.822 0 5.732z`,source:`https://www.apple.com/itunes/marketing-on-music/identity-guidelines.html#apple-music-icon`,hex:`FA243C`},be={title:`Apple TV`,slug:`appletv`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple TV</title><path d="`+this.path+V},path:`M20.57 17.735h-1.815l-3.34-9.203h1.633l2.02 5.987c.075.231.273.9.586 2.012l.297-.997.33-1.006 2.094-6.004H24zm-5.344-.066a5.76 5.76 0 0 1-1.55.207c-1.23 0-1.84-.693-1.84-2.087V9.646h-1.063V8.532h1.121V7.081l1.476-.602v2.062h1.707v1.113H13.38v5.805c0 .446.074.75.214.932.14.182.396.264.75.264.207 0 .495-.041.883-.115zm-7.29-5.343c.017 1.764 1.55 2.358 1.567 2.366-.017.042-.248.842-.808 1.658-.487.71-.99 1.418-1.79 1.435-.783.016-1.03-.462-1.93-.462-.89 0-1.17.445-1.913.478-.758.025-1.344-.775-1.838-1.484-.998-1.451-1.765-4.098-.734-5.88.51-.89 1.426-1.451 2.416-1.46.75-.016 1.468.512 1.93.512.461 0 1.327-.627 2.234-.536.38.016 1.452.157 2.136 1.154-.058.033-1.278.743-1.27 2.219M6.468 7.988c.404-.495.685-1.18.61-1.864-.585.025-1.294.388-1.723.883-.38.437-.71 1.138-.619 1.806.652.05 1.328-.338 1.732-.825Z`,source:`https://en.wikipedia.org/wiki/File:Apple_TV_(logo).svg`,hex:`000000`},xe={title:`Crunchyroll`,slug:`crunchyroll`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Crunchyroll</title><path d="`+this.path+V},path:`M2.909 13.436C2.914 7.61 7.642 2.893 13.468 2.898c5.576.005 10.137 4.339 10.51 9.819q.021-.351.022-.706C24.007 5.385 18.64.006 12.012 0S.007 5.36 0 11.988 5.36 23.994 11.988 24q.412 0 .815-.027c-5.526-.338-9.9-4.928-9.894-10.538Zm16.284.155a4.1 4.1 0 0 1-4.095-4.103 4.1 4.1 0 0 1 2.712-3.855 8.95 8.95 0 0 0-4.187-1.037 9.007 9.007 0 1 0 8.997 9.016q-.001-.847-.15-1.651a4.1 4.1 0 0 1-3.278 1.63Z`,source:`https://www.crunchyroll.com`,hex:`FF5E00`},Se={title:`DAZN`,slug:`dazn`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>DAZN</title><path d="`+this.path+V},path:`M14.774 8.291l.772-2.596.79 2.596zm3.848 2.268l-2.025-6.128c-.045-.135-.097-.224-.154-.266-.059-.041-.152-.063-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581l1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661-.036.177-.093.32-.174.43a.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z`,source:`https://media.dazn.com/en/assets/`,hex:`F8F8F5`},Ce={title:`Kodi`,slug:`kodi`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Kodi</title><path d="`+this.path+V},path:`M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z`,source:`https://kodi.tv`,hex:`17B2E7`},we={title:`Max`,slug:`max`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Max</title><path d="`+this.path+V},path:`M1.769 0A1.77 1.77 0 0 0 0 1.769V22.23A1.77 1.77 0 0 0 1.769 24H22.23A1.77 1.77 0 0 0 24 22.231V1.77A1.77 1.77 0 0 0 22.231 0zm12.485 3.28a4.301 4.301 0 0 1 4.3 4.302 4.301 4.301 0 0 1-1.993 3.63 6.085 6.085 0 0 1 1.054 3.422 6.085 6.085 0 0 1-6.085 6.085 6.085 6.085 0 0 1-6.085-6.085 6.085 6.085 0 0 1 4.66-5.916 4.301 4.301 0 0 1-.152-1.136 4.301 4.301 0 0 1 4.301-4.301zm0 1.849a2.453 2.453 0 0 0-2.453 2.453 2.453 2.453 0 0 0 2.453 2.453 2.453 2.453 0 0 0 2.453-2.453 2.453 2.453 0 0 0-2.453-2.453zm-2.724 5.268a4.237 4.237 0 0 0-4.237 4.237 4.237 4.237 0 0 0 4.237 4.237 4.237 4.237 0 0 0 4.237-4.237 4.237 4.237 0 0 0-4.237-4.237zm.032 2.54a1.781 1.781 0 1 1 0 3.562 1.781 1.781 0 0 1 0-3.562Z`,source:`https://cycling74.com`,hex:`525252`},Te={title:`Netflix`,slug:`netflix`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Netflix</title><path d="`+this.path+V},path:`m5.398 0 8.348 23.602c2.346.059 4.856.398 4.856.398L10.113 0H5.398zm8.489 0v9.172l4.715 13.33V0h-4.715zM5.398 1.5V24c1.873-.225 2.81-.312 4.715-.398V14.83L5.398 1.5z`,source:`https://brand.netflix.com/en/assets/logos`,hex:`E50914`,guidelines:`https://brand.netflix.com/en/assets/logos`},Ee={title:`NOW`,slug:`now`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NOW</title><path d="`+this.path+V},path:`M8.8009 11.9974c0-.974.7878-1.7634 1.7596-1.7634.9718 0 1.7596.7895 1.7596 1.7634 0 .9738-.7878 1.7634-1.7596 1.7634-.9718 0-1.7596-.7896-1.7596-1.7634zm13.0277-2.896l-1.2166 2.4524-.7878-2.3188-.0015-.0003c-.1566-.4505-.5822-.7737-1.0829-.7737-.399 0-.7505.2054-.956.517-.5255.8015-1.0497 1.6094-1.5735 2.414l-.2785-1.956c-.0963-.6296-.6807-1.0587-1.3048-.9624-.6249.096-1.0538.6778-.958 1.304l.0488.328c-.6427-1.0749-1.8162-1.7945-3.1575-1.7945-1.353 0-2.5352.7324-3.174 1.823l.07-.3434c.1223-.6008-.2645-1.1873-.864-1.31-.5993-.1223-1.1848.265-1.307.8659l-.4763 2.3382-1.752-2.7177c-.198-.3042-.5399-.5053-.9284-.5053-.5317 0-.976.3765-1.084.879l-1.0217 5.012c-.1223.6007.257 1.1846.8575 1.3121.0747.0159.1556.0235.2291.024.5139.0036.9763-.3579 1.0844-.892l.4763-2.3383c.5924.9217 1.1845 1.844 1.779 2.7641.196.2777.5281.4662.9018.4662.5462 0 1.0002-.398 1.0915-.9219l.469-2.302c.2292 1.815 1.7755 3.2187 3.6488 3.2187 1.7257 0 3.1736-1.191 3.5705-2.7972l.2613 1.759c.0736.579.5474 1.0371 1.1411 1.0371.4272 0 .7756-.2445.9972-.5841l1.8844-2.8942.905 2.6645c.1622.4752.5808.8138 1.0961.8138.4788 0 .855-.288 1.0609-.7155l2.402-4.845c.2834-.568.0528-1.2551-.5123-1.5403-.5647-.285-1.2558-.0524-1.5379.5196Z`,source:`https://www.nowtv.com`,hex:`001211`},De={title:`Paramount+`,slug:`paramountplus`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Paramount+</title><path d="`+this.path+V},path:`M16.347 21.373c.057-.084.151-.314-.025-.74l-.53-1.428c-.073-.182.084-.293.19-.173 0 0 1.004 1.157 1.264 1.64l.495.822c.425.028 1.6.06 2.732.06a3.26 3.26 0 0 1-.316-.364c-1.93-2.392-3.154-3.724-3.166-3.737-.391-.426-.572-.508-.87-.643a4.82 4.82 0 0 1-.138-.065v.364c0 .047-.057.073-.086.022l-2.846-5.001a1.598 1.598 0 0 0-.508-.587l-.277-.194-1.354 3.123c.212 0 .354.216.27.409l-1.25 2.893h1.147c.443 0 .883.087 1.294.255l.302.125s-.913 1.878-.913 2.867c0 .181.028.362.075.534h2.104l-.096-.595s1.266.294 2.502.413M12 2.437c-6.627 0-12 5.373-12 12 0 2.669.873 5.133 2.346 7.126.503-.218.783-.542.983-.791l2.234-2.858a.467.467 0 0 1 .179-.138l.336-.146 3.674-4.659.534-.417 1.094-1.524a.482.482 0 0 1 .101-.102l.478-.347a.34.34 0 0 1 .398-.004l.578.407c.308.216.557.504.726.84l2.322 4.077c.051.09.09.129.182.174.454.227.732.268 1.33.913.277.304 1.495 1.666 3.203 3.784.236.318.538.588.963.783A11.948 11.948 0 0 0 24 14.437c0-6.627-5.373-12-12-12M3.236 15.1l-.778-.253-.48.662v-.818l-.778-.253.778-.253v-.818l.48.662.778-.253-.48.662Zm-.185 2.676-.252.778-.253-.778h-.818l.661-.481-.253-.777.663.48.66-.48-.252.777.662.481Zm.156-6.195.253.778-.661-.48-.663.48.253-.778-.66-.48h.817l.253-.778.252.777h.818Zm1.314-1.76L4.04 9.16l-.778.253.48-.661-.48-.663.778.254.48-.662v.818l.778.253-.777.252Zm2.045-2.862-.253.777-.252-.777h-.818l.662-.48-.253-.778.661.48.661-.48-.252.777.662.48Zm2.577-1.313-.48.661V5.49l-.779-.254.778-.253v-.817l.48.66.78-.253-.481.663.48.66zm3.265-.75.253.778-.661-.48-.662.48.252-.777-.66-.481h.818L12 3.637l.252.778h.818zm2.93.595v.816l-.481-.661-.777.252.48-.662-.48-.662.777.253.48-.66v.817l.779.252zm5.426 8.285.778.253.48-.662v.818l.778.253-.778.253v.818l-.48-.662-.778.253.48-.662zm-3.077-6.04-.253-.777h-.818l.662-.48-.253-.778.662.48.662-.48-.254.778.662.48h-.818zm1.792 2.086v-.818l-.777-.252.777-.253V7.68l.481.662.777-.254-.48.663.48.66-.777-.252zm1.469 1.278.253-.777.254.777h.816l-.66.481.252.778-.662-.48-.661.48.253-.778-.662-.48zm.506 6.676-.253.778-.253-.778h-.817l.662-.481-.253-.777.66.48.663-.48-.253.777.661.481zm-12.08-.615.76-1.588c.024-.048-.032-.108-.067-.067l-.664.668c-.313.329-.847 1.25-.95 1.421l-.808 1.335a.109.109 0 0 1 .1.162l-.739 1.238c-.18.309.145.523.189.452 1.157-1.868 1.832-1.719 1.832-1.719l.387-.897c.022-.047-.001-.1-.05-.12-.12-.05-.316-.27.01-.885z`,source:`https://www.paramount.com/brand/paramount-plus`,hex:`0064FF`},Oe={title:`Plex`,slug:`plex`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Plex</title><path d="`+this.path+V},path:`M3.987 8.409c-.96 0-1.587.28-2.12.933v-.72H0v8.88s.038.018.127.037c.138.03.821.187 1.331-.249.441-.377.542-.814.542-1.318v-1.283c.533.573 1.147.813 2 .813 1.84 0 3.253-1.493 3.253-3.48 0-2.12-1.36-3.613-3.266-3.613Zm16.748 5.595.406.591c.391.614.894.906 1.492.908.621-.012 1.064-.562 1.226-.755 0 0-.307-.27-.686-.72-.517-.614-1.214-1.755-1.24-1.803l-1.198 1.779Zm-3.205-1.955c0-2.08-1.52-3.64-3.52-3.64s-3.467 1.587-3.467 3.573a3.48 3.48 0 0 0 3.507 3.52c1.413 0 2.626-.84 3.253-2.293h-2.04l-.093.093c-.427.4-.72.533-1.227.533-.787 0-1.373-.506-1.453-1.266h4.986c.04-.214.054-.307.054-.52Zm-7.671-.219c0 .769.11 1.701.868 2.722l.056.069c-.306.526-.742.88-1.248.88-.399 0-.814-.211-1.138-.579a2.177 2.177 0 0 1-.538-1.441V6.409H9.86l-.001 5.421Zm9.283 3.46h-2.39l2.247-3.332-2.247-3.335h2.39l2.248 3.335-2.248 3.332Zm1.593-1.286Zm-17.162-.342c-.933 0-1.68-.773-1.68-1.72s.76-1.666 1.68-1.666c.92 0 1.68.733 1.68 1.68 0 .946-.733 1.706-1.68 1.706Zm18.361-1.974L24 8.622h-2.391l-.87 1.293 1.195 1.773Zm-9.404-.466c.16-.706.72-1.133 1.493-1.133.773 0 1.373.467 1.507 1.133h-3Z`,source:`https://brand.plex.tv`,hex:`EBAF00`,guidelines:`https://brand.plex.tv`},ke={title:`Sky`,slug:`sky`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Sky</title><path d="`+this.path+V},path:`M7.387 13.656c0 1.423-.933 2.454-2.823 2.675-1.35.147-3.337-.025-4.294-.148-.025-.147-.074-.343-.074-.49 0-1.252.663-1.522 1.3-1.522.664 0 1.694.123 2.455.123.834 0 1.104-.295 1.104-.565 0-.368-.343-.515-1.006-.638l-1.767-.343C.785 12.453 0 11.423 0 10.343c0-1.325.933-2.454 2.798-2.65 1.398-.148 3.116.024 4.049.122.024.172.049.32.049.491 0 1.252-.663 1.522-1.276 1.522-.491 0-1.227-.099-2.086-.099-.884 0-1.227.246-1.227.54 0 .32.343.442.883.54l1.718.32c1.742.294 2.479 1.3 2.479 2.527m3.092 1.521c0 .761-.295 1.203-1.792 1.203-.196 0-.368-.025-.54-.05V6.22c0-.76.27-1.57 1.767-1.57.196 0 .393.024.565.049zm6.085 3.927c.197.098.59.22 1.105.245.859.025 1.325-.319 1.693-1.08L24 7.913a2.5 2.5 0 0 0-.957-.22c-.589 0-1.399.122-1.914 1.325l-1.497 3.534-2.945-4.81c-.196-.05-.662-.148-1.006-.148-1.03 0-1.62.393-2.233 1.031l-2.871 3.141 2.306 3.632c.418.663.982 1.006 1.89 1.006.589 0 1.104-.147 1.325-.245l-2.773-4.196 1.963-2.086 3.24 5.08Z`,source:`https://www.skysports.com`,hex:`0072C9`},Ae={title:`Spotify`,slug:`spotify`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Spotify</title><path d="`+this.path+V},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},je={title:`Twitch`,slug:`twitch`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitch</title><path d="`+this.path+V},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},Me={title:`YouTube`,slug:`youtube`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="`+this.path+V},path:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,source:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`,hex:`FF0000`,guidelines:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`},Ne={title:`YouTube Music`,slug:`youtubemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube Music</title><path d="`+this.path+V},path:`M12 0C5.376 0 0 5.376 0 12s5.376 12 12 12 12-5.376 12-12S18.624 0 12 0zm0 19.104c-3.924 0-7.104-3.18-7.104-7.104S8.076 4.896 12 4.896s7.104 3.18 7.104 7.104-3.18 7.104-7.104 7.104zm0-13.332c-3.432 0-6.228 2.796-6.228 6.228S8.568 18.228 12 18.228s6.228-2.796 6.228-6.228S15.432 5.772 12 5.772zM9.684 15.54V8.46L15.816 12l-6.132 3.54z`,source:`https://partnermarketinghub.withgoogle.com/#/brands`,hex:`FF0000`},Pe=`app:`,H=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),U=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),W=[H(`netflix`,`Netflix`,Te),H(`youtube`,`YouTube`,Me),U(`primevideo`,`Prime Video`,`prime`),U(`disneyplus`,`Disney+`,`D+`),H(`spotify`,`Spotify`,Ae),H(`plex`,`Plex`,Oe),H(`appletv`,`Apple TV`,be),H(`dazn`,`DAZN`,Se),U(`raiplay`,`RaiPlay`,`Rai`),U(`mediasetinfinity`,`Mediaset Infinity`,`MI`),H(`now`,`NOW`,Ee),H(`twitch`,`Twitch`,je),H(`max`,`Max`,we),H(`paramountplus`,`Paramount+`,De),H(`crunchyroll`,`Crunchyroll`,xe),H(`sky`,`Sky`,ke),H(`youtubemusic`,`YouTube Music`,Ne),H(`applemusic`,`Apple Music`,ye),H(`kodi`,`Kodi`,Ce)],Fe=new Map(W.map(e=>[e.key,e]));function Ie(e){return`${Pe}${e}`}function G(e){if(!(e===void 0||!e.startsWith(`app:`)))return Fe.get(e.slice(4))}function Le(e){if(!/^[0-9a-fA-F]{6}$/.test(e))return null;let t=t=>{let n=Number.parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(0)+.7152*t(2)+.0722*t(4)}var Re=.011,ze=.91,K=2.2;function q(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Be(e){if(e.kind!==`glyph`)return null;let t=Le(e.hex);return t===null?null:q(t,Re)>=K&&q(t,ze)>=K?`#${e.hex}`:null}function Ve({brand:e}){if(e.mark.kind===`lettermark`)return n(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let t=Be(e.mark);return n(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:t===null?void 0:{fill:t},children:n(`path`,{d:e.mark.path})})}function He(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function J(e,t){return f(e,He(t))}function Y(e){switch(e){case`rect`:return`rounded-sm`;case`rounded`:return`rounded-xl`;case`round`:return`aspect-square h-full w-auto justify-self-center rounded-full`;case`pill`:return`rounded-full`;default:return``}}function X(e){switch(e){case`accent`:return`border-primary bg-primary text-primary-foreground hover:bg-primary/90`;case`danger`:return`border-danger bg-danger-fill text-danger-on hover:bg-danger-fill/90`;case`red`:return`border-danger/40 bg-danger/15 text-danger hover:bg-danger/25`;case`green`:return`border-success/40 bg-success/15 text-success hover:bg-success/25`;case`yellow`:return`border-warning/40 bg-warning/15 text-warning hover:bg-warning/25`;case`blue`:return`border-info/40 bg-info/15 text-info hover:bg-info/25`;default:return``}}function Ue(e){switch(e){case`panel`:return`rounded-lg border border-border bg-surface/40`;case`dpad`:return`rounded-3xl border border-border bg-surface`;case`rocker-v`:case`rocker-h`:return`rounded-full border border-border bg-surface`;case`keypad`:return`rounded-lg border border-border-subtle bg-surface/60`;default:return``}}function We(e){return e===`divider`}function Ge(e,t){let n=Math.min(Math.max(t.row,0),e.rows-1),r=Math.min(Math.max(t.col,0),e.columns-1),i=Math.min(Math.max(t.row+t.rowSpan,n+1),e.rows),a=Math.min(Math.max(t.col+t.colSpan,r+1),e.columns);return{row:n,col:r,rowSpan:i-n,colSpan:a-r}}var Ke=`2.75rem`,Z=`1.25rem`,qe=`1rem`;function Je(e){let t=new Set;for(let n of e.buttons)for(let e=n.row;e<n.row+n.rowSpan;e+=1)for(let r=n.col;r<n.col+n.colSpan;r+=1)t.add(`${e}:${r}`);return t}var Q=new Set([`red`,`green`,`yellow`,`blue`]);function Ye(e,t){return e.label??G(e.icon)?.label??t}function Xe(e){return e.label===void 0||G(e.icon)!==void 0?!1:e.showLegend===!0||e.tone===void 0||!Q.has(e.tone)}function Ze(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Q.has(e.tone)))return a(e.role)}function Qe({button:t,compact:r}){let i=_(),a=G(t.icon),o=Ze(t),c=t.icon===void 0?s(t.role):void 0,l=o===void 0||a!==void 0||c!==void 0?void 0:i(o),u=Xe(t)?t.label:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[a!==void 0&&n(Ve,{brand:a}),l!==void 0&&n(l,{className:`h-4 w-4`,"aria-hidden":!0}),c!==void 0&&n(`span`,{className:`text-sm font-medium`,children:c}),u!==void 0&&(!r||t.showLegend===!0)&&n(`span`,{className:`max-w-full truncate text-[11px]`,children:u})]})}function $(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function $e({group:t,selected:r,dragging:a,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=v(),f=We(t.frame),p=!s||o||t.hideTitle===!0?void 0:t.title;return e(`div`,{"data-testid":`remote-group-${t.id}`,"data-frame":t.frame,className:i(`relative -m-0.5 flex`,Ue(t.frame),a&&`opacity-40`,r&&`ring-2 ring-primary`),style:$(t),children:[f?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),p!==void 0&&n(`span`,{className:`truncate`,children:p}),p!==void 0&&n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):p!==void 0&&n(`span`,{className:`absolute -top-1.5 left-3 max-w-[70%] truncate bg-background-elevated px-1 text-[10px] uppercase leading-none tracking-wide text-foreground-muted`,children:p}),s&&n(`button`,{type:`button`,"aria-label":d(`remote.layout.groupHandle`,{name:t.title??t.componentId}),"aria-pressed":r,"data-testid":`remote-group-handle-${t.id}`,className:`absolute -right-1 -top-2.5 z-20 flex h-4 w-4 touch-none cursor-grab items-center justify-center rounded-full border border-border bg-surface-hover text-foreground-muted hover:text-foreground`,onClick:c,onPointerDown:l,onKeyDown:u,children:n(g,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function et({grid:r,label:a,selectedId:s=null,onSelect:c,boundRoles:l,showEmptyCells:u=!1,compact:d=!1,gridRef:f,selectedGroupId:p=null,onSelectGroup:m,onItemPointerDown:h,onItemKeyDown:g,drag:_=null,renderWidget:y}){let{i18n:b}=v(),x=h!==void 0,S=_!==null,C=Je(r),w=P(r),T=[];if(u||S)for(let e=0;e<r.rows;e+=1)for(let t=0;t<r.columns;t+=1)(S||!C.has(`${e}:${t}`)&&!w.has(e))&&T.push({row:e,col:t});let E=_?.preview??null;return e(`div`,{role:`group`,"aria-label":a,"data-testid":`remote-grid`,ref:f,className:i(`grid gap-1.5`,d?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${r.columns}, minmax(0, 1fr))`,...w.size===0?{}:{gridTemplateRows:Array.from({length:r.rows},(e,t)=>w.has(t)?qe:d?Z:Ke).join(` `)}},children:[T.map(({row:e,col:t})=>n(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:i(`rounded-md border border-dashed`,S?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${t+1}`}},`e${e}:${t}`)),(r.groups??[]).map(e=>n($e,{group:e,selected:e.id===p,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:d,editable:x,onSelect:m===void 0?void 0:()=>m(e.id),onPointerDown:h===void 0?void 0:t=>h({kind:`group`,id:e.id},t),onKeyDown:g===void 0?void 0:t=>g({kind:`group`,id:e.id},t)},e.id)),r.buttons.map(e=>{if(y!==void 0&&o(e.role))return n(t,{children:y(e,$(e))},e.id);let r=e.id===s,a=l===void 0||l.has(e.role),u=_?.item.kind===`button`&&_.item.id===e.id,f={kind:`button`,id:e.id},p=Ye(e,J(e.role,b.language));return n(ee,{type:`button`,size:`sm`,variant:a?`secondary`:`outline`,"aria-pressed":c===void 0?void 0:r,"aria-label":p,title:p,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:i(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,d&&`px-0`,Y(e.shape),X(e.tone),x&&`touch-none`,u&&`opacity-40`,r&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:$(e),onClick:c===void 0?void 0:()=>c(e.id),onPointerDown:h===void 0?void 0:e=>h(f,e),onKeyDown:g===void 0?void 0:e=>g(f,e),children:n(Qe,{button:e,compact:d})},e.id)}),E!==null&&n(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":E.valid,className:i(`pointer-events-none z-30 rounded-md border-2 border-dashed`,E.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:$(Ge(r,E.rect))})]})}export{ae as A,oe as C,ce as D,se as E,fe as O,le as S,F as T,he as _,W as a,M as b,B as c,R as d,de as f,_e as g,ge as h,J as i,I as k,ie as l,E as m,Y as n,Ie as o,y as p,X as r,G as s,et as t,ve as u,z as v,L as w,ue as x,te as y};
|
|
1
|
+
import{C as e,H as t,S as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{ka as i}from"./player-overlays-DilQz9uf.js";import{Ar as a,Ca as o,Mr as s,Or as c,Sa as l,Ur as u,Wr as d,jr as f,kr as p,va as m,ya as h}from"./client-CxoliObn.js";import{t as g}from"./grip-vertical-C89CQZwo.js";import{Df as _,nf as ee}from"./src-BgJM3bf_.js";import{t as v}from"./useTranslation-BJr-n0es.js";r();function y(){return{columns:3,rows:4,buttons:[]}}var b=e=>({status:`refused`,reason:e}),x=e=>({status:`ok`,grid:e});function S(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var C=d;function w(e,t){return t.row>=e.row&&t.col>=e.col&&t.row+t.rowSpan<=e.row+e.rowSpan&&t.col+t.colSpan<=e.col+e.colSpan}function T(e){return e.groups??[]}function E(e,t){return T(e).find(e=>e.id===t)}function te(e,t){return e.buttons.filter(e=>e.groupId===t)}function D(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function O(e,t){let{groupId:n,...r}=t;for(let n of T(e))if(C(n,t))return n.frame===`divider`||!w(n,t)?`overlap`:{...r,groupId:n.id};return r}function k(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!S(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&C(e,t)))return`overlap`;let r=O(e,t);return typeof r==`string`?r:null}function A(e,t){let n=k(e,t,t.id);if(n!==null)return b(n);let r=O(e,t);return typeof r==`string`?b(r):x({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function j(e,t){return e.buttons.find(e=>e.id===t)}function ne(e){let t=new Set(e.buttons.map(e=>e.id));for(let n=e.buttons.length+1;;n+=1)if(!t.has(`b${n}`))return`b${n}`}function re(e){for(let t=0;t<e.rows;t+=1)for(let n=0;n<e.columns;n+=1){let r={id:``,row:t,col:n,rowSpan:1,colSpan:1,role:`power`};if(!T(e).some(e=>C(e,r))&&k(e,r,null)===null)return{row:t,col:n}}return null}function ie(e,t){if(e.buttons.length>=200)return b(`outside`);let n=re(e);if(n===null)return b(`outside`);let r=O(e,{id:ne(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?b(r):x({...e,buttons:[...e.buttons,r]})}function M(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,row:n,col:r})}function ae(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):M(e,t,i.row+n,i.col+r)}function oe(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,rowSpan:n,colSpan:r})}function se(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let i=n.icon===void 0?r.icon:n.icon??void 0,a=n.label===void 0?r.label:n.label??void 0,o=a===void 0||a.trim()===``?void 0:a,{icon:s,label:c,...l}=r,u={...l,role:n.role??r.role,...i===void 0?{}:{icon:i},...o===void 0?{}:{label:o}};return x({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function ce(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let{shape:i,tone:a,showLegend:o,...s}=r,c=n.shape===void 0?r.shape:n.shape??void 0,l=n.tone===void 0?r.tone:n.tone??void 0,u=n.showLegend===void 0?r.showLegend:n.showLegend,d={...s,...c===void 0?{}:{shape:c},...l===void 0?{}:{tone:l},...u===!0?{showLegend:u}:{}};return x({...e,buttons:e.buttons.map(e=>e.id===t?d:e)})}function le(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var N=e=>e.ok?x(e.layout):b(e.reason);function ue(e,t,n,r){return N(c(e,t,{row:n,col:r}))}function de(e,t,n){return N(p(e,t,{keepButtons:n}))}function fe(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return x(D(e,T(e).map(e=>e.id===t?o:e)))}function pe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function P(e){let t=new Set,n=T(e);for(let r of n){if(!pe(r))continue;let i=r.row;e.buttons.some(e=>e.row<=i&&i<e.row+e.rowSpan)||n.some(e=>e!==r&&e.row<=i&&i<e.row+e.rowSpan)||t.add(i)}return t}function F(e){let t=P(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function I(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{size:i,hideTitle:a,...o}=r,s=n.size??r.size,c=n.hideTitle??r.hideTitle,l={...o,...s===`normal`?{size:s}:{},...c===!0?{hideTitle:c}:{}};return x(D(e,T(e).map(e=>e.id===t?l:e)))}function L(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return b(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!S(i,e))||T(e).some(e=>!S(i,e))?b(`would-drop-buttons`):x(i)}function R(e){let t=u.safeParse(e);return t.success?t.data:null}function z(e){let t=u.safeParse(e);return t.success?t.data:y()}var B=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function me(e){return e.startsWith(`power`)?`power`:e.startsWith(`volume`)||e===`mute`?`volume`:e.startsWith(`channel`)?`channel`:e.startsWith(`digit_`)?`digits`:[`up`,`down`,`left`,`right`,`ok`,`back`,`home`,`menu`,`exit`].includes(e)?`navigation`:[`play`,`pause`,`play_pause`,`stop`,`next`,`previous`,`fast_forward`,`rewind`].includes(e)?`playback`:`other`}function he(e){return m.filter(t=>me(t)===e)}function ge(e){let t=h(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function _e(e){return h(e)!==null&&!l(e)}function ve(e,t,n){let r={columns:e,rows:t,buttons:[]};for(let e of n){let t={id:e.id,row:e.row,col:e.col,rowSpan:e.rowSpan??1,colSpan:e.colSpan??1,role:e.role,...e.icon===void 0?{}:{icon:e.icon},...e.label===void 0?{}:{label:e.label},...e.tone===void 0?{}:{tone:e.tone},...e.showLegend===!0?{showLegend:!0}:{}},n=k(r,t,null);if(n!==null||r.buttons.some(t=>t.id===e.id))throw Error(`layout button "${e.id}": ${n??`duplicate id`}`);r={...r,buttons:[...r.buttons,t]}}return r}var V=`"/></svg>`,ye={title:`Apple Music`,slug:`applemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple Music</title><path d="`+this.path+V},path:`M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043a5.022 5.022 0 00-1.877-.726 10.496 10.496 0 00-1.564-.15c-.04-.003-.083-.01-.124-.013H5.986c-.152.01-.303.017-.455.026-.747.043-1.49.123-2.193.4-1.336.53-2.3 1.452-2.865 2.78-.192.448-.292.925-.363 1.408-.056.392-.088.785-.1 1.18 0 .032-.007.062-.01.093v12.223c.01.14.017.283.027.424.05.815.154 1.624.497 2.373.65 1.42 1.738 2.353 3.234 2.801.42.127.856.187 1.293.228.555.053 1.11.06 1.667.06h11.03a12.5 12.5 0 001.57-.1c.822-.106 1.596-.35 2.295-.81a5.046 5.046 0 001.88-2.207c.186-.42.293-.87.37-1.324.113-.675.138-1.358.137-2.04-.002-3.8 0-7.595-.003-11.393zm-6.423 3.99v5.712c0 .417-.058.827-.244 1.206-.29.59-.76.962-1.388 1.14-.35.1-.706.157-1.07.173-.95.045-1.773-.6-1.943-1.536a1.88 1.88 0 011.038-2.022c.323-.16.67-.25 1.018-.324.378-.082.758-.153 1.134-.24.274-.063.457-.23.51-.516a.904.904 0 00.02-.193c0-1.815 0-3.63-.002-5.443a.725.725 0 00-.026-.185c-.04-.15-.15-.243-.304-.234-.16.01-.318.035-.475.066-.76.15-1.52.303-2.28.456l-2.325.47-1.374.278c-.016.003-.032.01-.048.013-.277.077-.377.203-.39.49-.002.042 0 .086 0 .13-.002 2.602 0 5.204-.003 7.805 0 .42-.047.836-.215 1.227-.278.64-.77 1.04-1.434 1.233-.35.1-.71.16-1.075.172-.96.036-1.755-.6-1.92-1.544-.14-.812.23-1.685 1.154-2.075.357-.15.73-.232 1.108-.31.287-.06.575-.116.86-.177.383-.083.583-.323.6-.714v-.15c0-2.96 0-5.922.002-8.882 0-.123.013-.25.042-.37.07-.285.273-.448.546-.518.255-.066.515-.112.774-.165.733-.15 1.466-.296 2.2-.444l2.27-.46c.67-.134 1.34-.27 2.01-.403.22-.043.442-.088.663-.106.31-.025.523.17.554.482.008.073.012.148.012.223.002 1.91.002 3.822 0 5.732z`,source:`https://www.apple.com/itunes/marketing-on-music/identity-guidelines.html#apple-music-icon`,hex:`FA243C`},be={title:`Apple TV`,slug:`appletv`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple TV</title><path d="`+this.path+V},path:`M20.57 17.735h-1.815l-3.34-9.203h1.633l2.02 5.987c.075.231.273.9.586 2.012l.297-.997.33-1.006 2.094-6.004H24zm-5.344-.066a5.76 5.76 0 0 1-1.55.207c-1.23 0-1.84-.693-1.84-2.087V9.646h-1.063V8.532h1.121V7.081l1.476-.602v2.062h1.707v1.113H13.38v5.805c0 .446.074.75.214.932.14.182.396.264.75.264.207 0 .495-.041.883-.115zm-7.29-5.343c.017 1.764 1.55 2.358 1.567 2.366-.017.042-.248.842-.808 1.658-.487.71-.99 1.418-1.79 1.435-.783.016-1.03-.462-1.93-.462-.89 0-1.17.445-1.913.478-.758.025-1.344-.775-1.838-1.484-.998-1.451-1.765-4.098-.734-5.88.51-.89 1.426-1.451 2.416-1.46.75-.016 1.468.512 1.93.512.461 0 1.327-.627 2.234-.536.38.016 1.452.157 2.136 1.154-.058.033-1.278.743-1.27 2.219M6.468 7.988c.404-.495.685-1.18.61-1.864-.585.025-1.294.388-1.723.883-.38.437-.71 1.138-.619 1.806.652.05 1.328-.338 1.732-.825Z`,source:`https://en.wikipedia.org/wiki/File:Apple_TV_(logo).svg`,hex:`000000`},xe={title:`Crunchyroll`,slug:`crunchyroll`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Crunchyroll</title><path d="`+this.path+V},path:`M2.909 13.436C2.914 7.61 7.642 2.893 13.468 2.898c5.576.005 10.137 4.339 10.51 9.819q.021-.351.022-.706C24.007 5.385 18.64.006 12.012 0S.007 5.36 0 11.988 5.36 23.994 11.988 24q.412 0 .815-.027c-5.526-.338-9.9-4.928-9.894-10.538Zm16.284.155a4.1 4.1 0 0 1-4.095-4.103 4.1 4.1 0 0 1 2.712-3.855 8.95 8.95 0 0 0-4.187-1.037 9.007 9.007 0 1 0 8.997 9.016q-.001-.847-.15-1.651a4.1 4.1 0 0 1-3.278 1.63Z`,source:`https://www.crunchyroll.com`,hex:`FF5E00`},Se={title:`DAZN`,slug:`dazn`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>DAZN</title><path d="`+this.path+V},path:`M14.774 8.291l.772-2.596.79 2.596zm3.848 2.268l-2.025-6.128c-.045-.135-.097-.224-.154-.266-.059-.041-.152-.063-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581l1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661-.036.177-.093.32-.174.43a.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z`,source:`https://media.dazn.com/en/assets/`,hex:`F8F8F5`},Ce={title:`Kodi`,slug:`kodi`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Kodi</title><path d="`+this.path+V},path:`M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z`,source:`https://kodi.tv`,hex:`17B2E7`},we={title:`Max`,slug:`max`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Max</title><path d="`+this.path+V},path:`M1.769 0A1.77 1.77 0 0 0 0 1.769V22.23A1.77 1.77 0 0 0 1.769 24H22.23A1.77 1.77 0 0 0 24 22.231V1.77A1.77 1.77 0 0 0 22.231 0zm12.485 3.28a4.301 4.301 0 0 1 4.3 4.302 4.301 4.301 0 0 1-1.993 3.63 6.085 6.085 0 0 1 1.054 3.422 6.085 6.085 0 0 1-6.085 6.085 6.085 6.085 0 0 1-6.085-6.085 6.085 6.085 0 0 1 4.66-5.916 4.301 4.301 0 0 1-.152-1.136 4.301 4.301 0 0 1 4.301-4.301zm0 1.849a2.453 2.453 0 0 0-2.453 2.453 2.453 2.453 0 0 0 2.453 2.453 2.453 2.453 0 0 0 2.453-2.453 2.453 2.453 0 0 0-2.453-2.453zm-2.724 5.268a4.237 4.237 0 0 0-4.237 4.237 4.237 4.237 0 0 0 4.237 4.237 4.237 4.237 0 0 0 4.237-4.237 4.237 4.237 0 0 0-4.237-4.237zm.032 2.54a1.781 1.781 0 1 1 0 3.562 1.781 1.781 0 0 1 0-3.562Z`,source:`https://cycling74.com`,hex:`525252`},Te={title:`Netflix`,slug:`netflix`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Netflix</title><path d="`+this.path+V},path:`m5.398 0 8.348 23.602c2.346.059 4.856.398 4.856.398L10.113 0H5.398zm8.489 0v9.172l4.715 13.33V0h-4.715zM5.398 1.5V24c1.873-.225 2.81-.312 4.715-.398V14.83L5.398 1.5z`,source:`https://brand.netflix.com/en/assets/logos`,hex:`E50914`,guidelines:`https://brand.netflix.com/en/assets/logos`},Ee={title:`NOW`,slug:`now`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NOW</title><path d="`+this.path+V},path:`M8.8009 11.9974c0-.974.7878-1.7634 1.7596-1.7634.9718 0 1.7596.7895 1.7596 1.7634 0 .9738-.7878 1.7634-1.7596 1.7634-.9718 0-1.7596-.7896-1.7596-1.7634zm13.0277-2.896l-1.2166 2.4524-.7878-2.3188-.0015-.0003c-.1566-.4505-.5822-.7737-1.0829-.7737-.399 0-.7505.2054-.956.517-.5255.8015-1.0497 1.6094-1.5735 2.414l-.2785-1.956c-.0963-.6296-.6807-1.0587-1.3048-.9624-.6249.096-1.0538.6778-.958 1.304l.0488.328c-.6427-1.0749-1.8162-1.7945-3.1575-1.7945-1.353 0-2.5352.7324-3.174 1.823l.07-.3434c.1223-.6008-.2645-1.1873-.864-1.31-.5993-.1223-1.1848.265-1.307.8659l-.4763 2.3382-1.752-2.7177c-.198-.3042-.5399-.5053-.9284-.5053-.5317 0-.976.3765-1.084.879l-1.0217 5.012c-.1223.6007.257 1.1846.8575 1.3121.0747.0159.1556.0235.2291.024.5139.0036.9763-.3579 1.0844-.892l.4763-2.3383c.5924.9217 1.1845 1.844 1.779 2.7641.196.2777.5281.4662.9018.4662.5462 0 1.0002-.398 1.0915-.9219l.469-2.302c.2292 1.815 1.7755 3.2187 3.6488 3.2187 1.7257 0 3.1736-1.191 3.5705-2.7972l.2613 1.759c.0736.579.5474 1.0371 1.1411 1.0371.4272 0 .7756-.2445.9972-.5841l1.8844-2.8942.905 2.6645c.1622.4752.5808.8138 1.0961.8138.4788 0 .855-.288 1.0609-.7155l2.402-4.845c.2834-.568.0528-1.2551-.5123-1.5403-.5647-.285-1.2558-.0524-1.5379.5196Z`,source:`https://www.nowtv.com`,hex:`001211`},De={title:`Paramount+`,slug:`paramountplus`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Paramount+</title><path d="`+this.path+V},path:`M16.347 21.373c.057-.084.151-.314-.025-.74l-.53-1.428c-.073-.182.084-.293.19-.173 0 0 1.004 1.157 1.264 1.64l.495.822c.425.028 1.6.06 2.732.06a3.26 3.26 0 0 1-.316-.364c-1.93-2.392-3.154-3.724-3.166-3.737-.391-.426-.572-.508-.87-.643a4.82 4.82 0 0 1-.138-.065v.364c0 .047-.057.073-.086.022l-2.846-5.001a1.598 1.598 0 0 0-.508-.587l-.277-.194-1.354 3.123c.212 0 .354.216.27.409l-1.25 2.893h1.147c.443 0 .883.087 1.294.255l.302.125s-.913 1.878-.913 2.867c0 .181.028.362.075.534h2.104l-.096-.595s1.266.294 2.502.413M12 2.437c-6.627 0-12 5.373-12 12 0 2.669.873 5.133 2.346 7.126.503-.218.783-.542.983-.791l2.234-2.858a.467.467 0 0 1 .179-.138l.336-.146 3.674-4.659.534-.417 1.094-1.524a.482.482 0 0 1 .101-.102l.478-.347a.34.34 0 0 1 .398-.004l.578.407c.308.216.557.504.726.84l2.322 4.077c.051.09.09.129.182.174.454.227.732.268 1.33.913.277.304 1.495 1.666 3.203 3.784.236.318.538.588.963.783A11.948 11.948 0 0 0 24 14.437c0-6.627-5.373-12-12-12M3.236 15.1l-.778-.253-.48.662v-.818l-.778-.253.778-.253v-.818l.48.662.778-.253-.48.662Zm-.185 2.676-.252.778-.253-.778h-.818l.661-.481-.253-.777.663.48.66-.48-.252.777.662.481Zm.156-6.195.253.778-.661-.48-.663.48.253-.778-.66-.48h.817l.253-.778.252.777h.818Zm1.314-1.76L4.04 9.16l-.778.253.48-.661-.48-.663.778.254.48-.662v.818l.778.253-.777.252Zm2.045-2.862-.253.777-.252-.777h-.818l.662-.48-.253-.778.661.48.661-.48-.252.777.662.48Zm2.577-1.313-.48.661V5.49l-.779-.254.778-.253v-.817l.48.66.78-.253-.481.663.48.66zm3.265-.75.253.778-.661-.48-.662.48.252-.777-.66-.481h.818L12 3.637l.252.778h.818zm2.93.595v.816l-.481-.661-.777.252.48-.662-.48-.662.777.253.48-.66v.817l.779.252zm5.426 8.285.778.253.48-.662v.818l.778.253-.778.253v.818l-.48-.662-.778.253.48-.662zm-3.077-6.04-.253-.777h-.818l.662-.48-.253-.778.662.48.662-.48-.254.778.662.48h-.818zm1.792 2.086v-.818l-.777-.252.777-.253V7.68l.481.662.777-.254-.48.663.48.66-.777-.252zm1.469 1.278.253-.777.254.777h.816l-.66.481.252.778-.662-.48-.661.48.253-.778-.662-.48zm.506 6.676-.253.778-.253-.778h-.817l.662-.481-.253-.777.66.48.663-.48-.253.777.661.481zm-12.08-.615.76-1.588c.024-.048-.032-.108-.067-.067l-.664.668c-.313.329-.847 1.25-.95 1.421l-.808 1.335a.109.109 0 0 1 .1.162l-.739 1.238c-.18.309.145.523.189.452 1.157-1.868 1.832-1.719 1.832-1.719l.387-.897c.022-.047-.001-.1-.05-.12-.12-.05-.316-.27.01-.885z`,source:`https://www.paramount.com/brand/paramount-plus`,hex:`0064FF`},Oe={title:`Plex`,slug:`plex`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Plex</title><path d="`+this.path+V},path:`M3.987 8.409c-.96 0-1.587.28-2.12.933v-.72H0v8.88s.038.018.127.037c.138.03.821.187 1.331-.249.441-.377.542-.814.542-1.318v-1.283c.533.573 1.147.813 2 .813 1.84 0 3.253-1.493 3.253-3.48 0-2.12-1.36-3.613-3.266-3.613Zm16.748 5.595.406.591c.391.614.894.906 1.492.908.621-.012 1.064-.562 1.226-.755 0 0-.307-.27-.686-.72-.517-.614-1.214-1.755-1.24-1.803l-1.198 1.779Zm-3.205-1.955c0-2.08-1.52-3.64-3.52-3.64s-3.467 1.587-3.467 3.573a3.48 3.48 0 0 0 3.507 3.52c1.413 0 2.626-.84 3.253-2.293h-2.04l-.093.093c-.427.4-.72.533-1.227.533-.787 0-1.373-.506-1.453-1.266h4.986c.04-.214.054-.307.054-.52Zm-7.671-.219c0 .769.11 1.701.868 2.722l.056.069c-.306.526-.742.88-1.248.88-.399 0-.814-.211-1.138-.579a2.177 2.177 0 0 1-.538-1.441V6.409H9.86l-.001 5.421Zm9.283 3.46h-2.39l2.247-3.332-2.247-3.335h2.39l2.248 3.335-2.248 3.332Zm1.593-1.286Zm-17.162-.342c-.933 0-1.68-.773-1.68-1.72s.76-1.666 1.68-1.666c.92 0 1.68.733 1.68 1.68 0 .946-.733 1.706-1.68 1.706Zm18.361-1.974L24 8.622h-2.391l-.87 1.293 1.195 1.773Zm-9.404-.466c.16-.706.72-1.133 1.493-1.133.773 0 1.373.467 1.507 1.133h-3Z`,source:`https://brand.plex.tv`,hex:`EBAF00`,guidelines:`https://brand.plex.tv`},ke={title:`Sky`,slug:`sky`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Sky</title><path d="`+this.path+V},path:`M7.387 13.656c0 1.423-.933 2.454-2.823 2.675-1.35.147-3.337-.025-4.294-.148-.025-.147-.074-.343-.074-.49 0-1.252.663-1.522 1.3-1.522.664 0 1.694.123 2.455.123.834 0 1.104-.295 1.104-.565 0-.368-.343-.515-1.006-.638l-1.767-.343C.785 12.453 0 11.423 0 10.343c0-1.325.933-2.454 2.798-2.65 1.398-.148 3.116.024 4.049.122.024.172.049.32.049.491 0 1.252-.663 1.522-1.276 1.522-.491 0-1.227-.099-2.086-.099-.884 0-1.227.246-1.227.54 0 .32.343.442.883.54l1.718.32c1.742.294 2.479 1.3 2.479 2.527m3.092 1.521c0 .761-.295 1.203-1.792 1.203-.196 0-.368-.025-.54-.05V6.22c0-.76.27-1.57 1.767-1.57.196 0 .393.024.565.049zm6.085 3.927c.197.098.59.22 1.105.245.859.025 1.325-.319 1.693-1.08L24 7.913a2.5 2.5 0 0 0-.957-.22c-.589 0-1.399.122-1.914 1.325l-1.497 3.534-2.945-4.81c-.196-.05-.662-.148-1.006-.148-1.03 0-1.62.393-2.233 1.031l-2.871 3.141 2.306 3.632c.418.663.982 1.006 1.89 1.006.589 0 1.104-.147 1.325-.245l-2.773-4.196 1.963-2.086 3.24 5.08Z`,source:`https://www.skysports.com`,hex:`0072C9`},Ae={title:`Spotify`,slug:`spotify`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Spotify</title><path d="`+this.path+V},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},je={title:`Twitch`,slug:`twitch`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitch</title><path d="`+this.path+V},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},Me={title:`YouTube`,slug:`youtube`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="`+this.path+V},path:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,source:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`,hex:`FF0000`,guidelines:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`},Ne={title:`YouTube Music`,slug:`youtubemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube Music</title><path d="`+this.path+V},path:`M12 0C5.376 0 0 5.376 0 12s5.376 12 12 12 12-5.376 12-12S18.624 0 12 0zm0 19.104c-3.924 0-7.104-3.18-7.104-7.104S8.076 4.896 12 4.896s7.104 3.18 7.104 7.104-3.18 7.104-7.104 7.104zm0-13.332c-3.432 0-6.228 2.796-6.228 6.228S8.568 18.228 12 18.228s6.228-2.796 6.228-6.228S15.432 5.772 12 5.772zM9.684 15.54V8.46L15.816 12l-6.132 3.54z`,source:`https://partnermarketinghub.withgoogle.com/#/brands`,hex:`FF0000`},Pe=`app:`,H=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),U=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),W=[H(`netflix`,`Netflix`,Te),H(`youtube`,`YouTube`,Me),U(`primevideo`,`Prime Video`,`prime`),U(`disneyplus`,`Disney+`,`D+`),H(`spotify`,`Spotify`,Ae),H(`plex`,`Plex`,Oe),H(`appletv`,`Apple TV`,be),H(`dazn`,`DAZN`,Se),U(`raiplay`,`RaiPlay`,`Rai`),U(`mediasetinfinity`,`Mediaset Infinity`,`MI`),H(`now`,`NOW`,Ee),H(`twitch`,`Twitch`,je),H(`max`,`Max`,we),H(`paramountplus`,`Paramount+`,De),H(`crunchyroll`,`Crunchyroll`,xe),H(`sky`,`Sky`,ke),H(`youtubemusic`,`YouTube Music`,Ne),H(`applemusic`,`Apple Music`,ye),H(`kodi`,`Kodi`,Ce)],Fe=new Map(W.map(e=>[e.key,e]));function Ie(e){return`${Pe}${e}`}function G(e){if(!(e===void 0||!e.startsWith(`app:`)))return Fe.get(e.slice(4))}function Le(e){if(!/^[0-9a-fA-F]{6}$/.test(e))return null;let t=t=>{let n=Number.parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(0)+.7152*t(2)+.0722*t(4)}var Re=.011,ze=.91,K=2.2;function q(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Be(e){if(e.kind!==`glyph`)return null;let t=Le(e.hex);return t===null?null:q(t,Re)>=K&&q(t,ze)>=K?`#${e.hex}`:null}function Ve({brand:e}){if(e.mark.kind===`lettermark`)return n(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let t=Be(e.mark);return n(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:t===null?void 0:{fill:t},children:n(`path`,{d:e.mark.path})})}function He(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function J(e,t){return f(e,He(t))}function Y(e){switch(e){case`rect`:return`rounded-sm`;case`rounded`:return`rounded-xl`;case`round`:return`aspect-square h-full w-auto justify-self-center rounded-full`;case`pill`:return`rounded-full`;default:return``}}function X(e){switch(e){case`accent`:return`border-primary bg-primary text-primary-foreground hover:bg-primary/90`;case`danger`:return`border-danger bg-danger-fill text-danger-on hover:bg-danger-fill/90`;case`red`:return`border-danger/40 bg-danger/15 text-danger hover:bg-danger/25`;case`green`:return`border-success/40 bg-success/15 text-success hover:bg-success/25`;case`yellow`:return`border-warning/40 bg-warning/15 text-warning hover:bg-warning/25`;case`blue`:return`border-info/40 bg-info/15 text-info hover:bg-info/25`;default:return``}}function Ue(e){switch(e){case`panel`:return`rounded-lg border border-border bg-surface/40`;case`dpad`:return`rounded-3xl border border-border bg-surface`;case`rocker-v`:case`rocker-h`:return`rounded-full border border-border bg-surface`;case`keypad`:return`rounded-lg border border-border-subtle bg-surface/60`;default:return``}}function We(e){return e===`divider`}function Ge(e,t){let n=Math.min(Math.max(t.row,0),e.rows-1),r=Math.min(Math.max(t.col,0),e.columns-1),i=Math.min(Math.max(t.row+t.rowSpan,n+1),e.rows),a=Math.min(Math.max(t.col+t.colSpan,r+1),e.columns);return{row:n,col:r,rowSpan:i-n,colSpan:a-r}}var Ke=`2.75rem`,Z=`1.25rem`,qe=`1rem`;function Je(e){let t=new Set;for(let n of e.buttons)for(let e=n.row;e<n.row+n.rowSpan;e+=1)for(let r=n.col;r<n.col+n.colSpan;r+=1)t.add(`${e}:${r}`);return t}var Q=new Set([`red`,`green`,`yellow`,`blue`]);function Ye(e,t){return e.label??G(e.icon)?.label??t}function Xe(e){return e.label===void 0||G(e.icon)!==void 0?!1:e.showLegend===!0||e.tone===void 0||!Q.has(e.tone)}function Ze(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Q.has(e.tone)))return a(e.role)}function Qe({button:t,compact:r}){let i=_(),a=G(t.icon),o=Ze(t),c=t.icon===void 0?s(t.role):void 0,l=o===void 0||a!==void 0||c!==void 0?void 0:i(o),u=Xe(t)?t.label:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[a!==void 0&&n(Ve,{brand:a}),l!==void 0&&n(l,{className:`h-4 w-4`,"aria-hidden":!0}),c!==void 0&&n(`span`,{className:`text-sm font-medium`,children:c}),u!==void 0&&(!r||t.showLegend===!0)&&n(`span`,{className:`max-w-full truncate text-[11px]`,children:u})]})}function $(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function $e({group:t,selected:r,dragging:a,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=v(),f=We(t.frame),p=!s||o||t.hideTitle===!0?void 0:t.title;return e(`div`,{"data-testid":`remote-group-${t.id}`,"data-frame":t.frame,className:i(`relative -m-0.5 flex`,Ue(t.frame),a&&`opacity-40`,r&&`ring-2 ring-primary`),style:$(t),children:[f?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),p!==void 0&&n(`span`,{className:`truncate`,children:p}),p!==void 0&&n(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):p!==void 0&&n(`span`,{className:`absolute -top-1.5 left-3 max-w-[70%] truncate bg-background-elevated px-1 text-[10px] uppercase leading-none tracking-wide text-foreground-muted`,children:p}),s&&n(`button`,{type:`button`,"aria-label":d(`remote.layout.groupHandle`,{name:t.title??t.componentId}),"aria-pressed":r,"data-testid":`remote-group-handle-${t.id}`,className:`absolute -right-1 -top-2.5 z-20 flex h-4 w-4 touch-none cursor-grab items-center justify-center rounded-full border border-border bg-surface-hover text-foreground-muted hover:text-foreground`,onClick:c,onPointerDown:l,onKeyDown:u,children:n(g,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function et({grid:r,label:a,selectedId:s=null,onSelect:c,boundRoles:l,showEmptyCells:u=!1,compact:d=!1,gridRef:f,selectedGroupId:p=null,onSelectGroup:m,onItemPointerDown:h,onItemKeyDown:g,drag:_=null,renderWidget:y}){let{i18n:b}=v(),x=h!==void 0,S=_!==null,C=Je(r),w=P(r),T=[];if(u||S)for(let e=0;e<r.rows;e+=1)for(let t=0;t<r.columns;t+=1)(S||!C.has(`${e}:${t}`)&&!w.has(e))&&T.push({row:e,col:t});let E=_?.preview??null;return e(`div`,{role:`group`,"aria-label":a,"data-testid":`remote-grid`,ref:f,className:i(`grid gap-1.5`,d?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${r.columns}, minmax(0, 1fr))`,...w.size===0?{}:{gridTemplateRows:Array.from({length:r.rows},(e,t)=>w.has(t)?qe:d?Z:Ke).join(` `)}},children:[T.map(({row:e,col:t})=>n(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:i(`rounded-md border border-dashed`,S?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${t+1}`}},`e${e}:${t}`)),(r.groups??[]).map(e=>n($e,{group:e,selected:e.id===p,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:d,editable:x,onSelect:m===void 0?void 0:()=>m(e.id),onPointerDown:h===void 0?void 0:t=>h({kind:`group`,id:e.id},t),onKeyDown:g===void 0?void 0:t=>g({kind:`group`,id:e.id},t)},e.id)),r.buttons.map(e=>{if(y!==void 0&&o(e.role))return n(t,{children:y(e,$(e))},e.id);let r=e.id===s,a=l===void 0||l.has(e.role),u=_?.item.kind===`button`&&_.item.id===e.id,f={kind:`button`,id:e.id},p=Ye(e,J(e.role,b.language));return n(ee,{type:`button`,size:`sm`,variant:a?`secondary`:`outline`,"aria-pressed":c===void 0?void 0:r,"aria-label":p,title:p,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:i(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,d&&`px-0`,Y(e.shape),X(e.tone),x&&`touch-none`,u&&`opacity-40`,r&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:$(e),onClick:c===void 0?void 0:()=>c(e.id),onPointerDown:h===void 0?void 0:e=>h(f,e),onKeyDown:g===void 0?void 0:e=>g(f,e),children:n(Qe,{button:e,compact:d})},e.id)}),E!==null&&n(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":E.valid,className:i(`pointer-events-none z-30 rounded-md border-2 border-dashed`,E.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:$(Ge(r,E.rect))})]})}export{ae as A,oe as C,ce as D,se as E,fe as O,le as S,F as T,he as _,W as a,M as b,B as c,R as d,de as f,_e as g,ge as h,J as i,I as k,ie as l,E as m,Y as n,Ie as o,y as p,X as r,G as s,et as t,ve as u,z as v,L as w,ue as x,te as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t,Y as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{V as i,Yn as a}from"./player-overlays-
|
|
1
|
+
import{C as e,S as t,Y as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{V as i,Yn as a}from"./player-overlays-DilQz9uf.js";import{a as o}from"./client-CxoliObn.js";import{Qd as s,Sc as c,nf as l,pc as u,uf as d}from"./src-BgJM3bf_.js";import{t as f}from"./useTranslation-BJr-n0es.js";function p(e){let t=new Map;for(let n of e)t.set(n.stableId,n);let n=e=>{let n=e.parentStableId;if(n===void 0||n===e.stableId)return null;let r=t.get(n);if(r===void 0)return null;let i=new Set([e.stableId]),a=r;for(;a!==void 0;){if(i.has(a.stableId))return null;i.add(a.stableId),a=a.parentStableId===void 0?void 0:t.get(a.parentStableId)}return r},r=new Map,i=[];for(let t of e){let e=n(t);if(e===null){i.push(t);continue}let a=r.get(e.stableId)??[];a.push(t),r.set(e.stableId,a)}let a=e=>({candidate:e,children:(r.get(e.stableId)??[]).map(a)});return i.map(a)}function m(e){return e.flatMap(e=>[e.candidate,...m(e.children)])}function h(e){return e.setupIntegration===!0||e.prefilledConfig.setupIntegration===!0}function g(e,t,n){let r={};for(let[e,n]of Object.entries(t.prefilledConfig))e!==`setupIntegration`&&(r[e]=typeof n==`string`&&e===`host`?n.trim():n);let i=n?.trim()??``;return{addonId:e,name:i.length>0?o(i):t.suggestedName,config:r,...t.stableId===void 0?{}:{originStableId:t.stableId}}}function _(e,t,n){return h(t)?g(e,t,n):null}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){if(!v(e)||!v(e.integrationSeed))return null;let t=e.integrationSeed,n=t.addonId,r=t.name,i=t.config;if(typeof n!=`string`||n.length===0||typeof r!=`string`||!v(i))return null;let a={};for(let[e,t]of Object.entries(i))a[e]=t;let o=t.originStableId;return{addonId:n,name:r,config:a,...typeof o==`string`&&o.length>0?{originStableId:o}:{}}}r();var b=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/;function x(e){let t=b.exec(e.trim());if(t===null)return{ok:!1,reason:`format`};let n=[t[1],t[2],t[3],t[4]].map(e=>Number(e));if(n.some(e=>e>255))return{ok:!1,reason:`format`};let r=Number(t[5]);return r>32?{ok:!1,reason:`format`}:r<22?{ok:!1,reason:`prefix`}:{ok:!0,cidr:`${n.join(`.`)}/${r}`}}function S(){let{t:r}=f(),o=u(),p=c({onSuccess:()=>void o.refetch()}),[m,h]=n(``),[g,_]=n(null),v=o.data?.subnets??[],y=async e=>{try{return await p.mutateAsync({subnets:[...e]}),!0}catch{return _(r(`integrations.scanNetworkModal.subnets.saveFailed`,`The network list could not be saved.`)),!1}},b=async()=>{let e=x(m);if(!e.ok){_(e.reason===`prefix`?r(`integrations.scanNetworkModal.subnets.errorPrefix`,`A network larger than a /22 cannot be scanned.`):r(`integrations.scanNetworkModal.subnets.errorFormat`,`Enter a network like 192.0.2.0/24.`));return}if(v.includes(e.cidr)){_(r(`integrations.scanNetworkModal.subnets.errorDuplicate`,`Already in the list.`));return}_(null),await y([...v,e.cidr])&&h(``)};return e(`section`,{className:`space-y-2`,"data-testid":`scan-subnets`,children:[t(`h3`,{className:i,children:r(`integrations.scanNetworkModal.subnets.title`,`Extra networks to scan`)}),t(`p`,{className:`text-xs text-foreground-muted`,children:v.length===0?r(`integrations.scanNetworkModal.subnets.none`,`Only this hub's own networks are scanned.`):r(`integrations.scanNetworkModal.subnets.hint`,`Every scan covers this hub's own networks and these.`)}),v.length>0&&t(`div`,{className:`flex flex-wrap gap-1.5`,children:v.map(e=>t(s,{label:e,testId:`scan-subnet-${e}`,onRemove:()=>void y(v.filter(t=>t!==e))},e))}),e(`div`,{className:`flex items-start gap-2`,children:[e(`div`,{className:`min-w-0 flex-1`,children:[t(d,{value:m,onChange:e=>{h(e.target.value),_(null)},onKeyDown:e=>{e.key===`Enter`&&b()},placeholder:`192.0.2.0/24`,state:g===null?`default`:`error`,"aria-label":r(`integrations.scanNetworkModal.subnets.title`,`Extra networks to scan`),"data-testid":`scan-subnet-input`}),g!==null&&t(`p`,{className:`mt-1 text-xs text-danger`,children:g})]}),e(l,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p.isPending||m.trim().length===0,"data-testid":`scan-subnet-add`,children:[t(a,{className:`h-3.5 w-3.5`}),r(`integrations.scanNetworkModal.subnets.add`,`Add network`)]})]})]})}export{g as a,y as i,_ as n,p as o,h as r,m as s,S as t};
|