@camstack/addon-admin-ui 1.2.525 → 1.2.526

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/assets/{AddonAssetIcon-DwYI7EBR.js → AddonAssetIcon-Bk09xHqf.js} +1 -1
  3. package/dist/assets/Addons-BwXNg54C.js +5 -0
  4. package/dist/assets/{AdminPage-BVK_kyJp.js → AdminPage-CYSYefaL.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-Bu-9skyU.js → AdminSectionedPage-B4MRvqE8.js} +1 -1
  6. package/dist/assets/AiProfiles-CRZH6xR0.js +3 -0
  7. package/dist/assets/BrokerEditorDialog-D9rZCGl9.js +1 -0
  8. package/dist/assets/Build-BJaqr-_Y.js +40 -0
  9. package/dist/assets/{Calendars-NM9x_lTF.js → Calendars-D4ed6Nqc.js} +1 -1
  10. package/dist/assets/{Cluster-C104ZPJk.js → Cluster-Dkt_tVUy.js} +1 -1
  11. package/dist/assets/{ComposedDeviceEditDialog-3vtEogq6.js → ComposedDeviceEditDialog-DJ5mqI6C.js} +1 -1
  12. package/dist/assets/{CompositionBlockEditor-DYg72AlP.js → CompositionBlockEditor-BEondavu.js} +2 -2
  13. package/dist/assets/{CompositionEditorPage-D1auHftj.js → CompositionEditorPage-4rHclFIA.js} +1 -1
  14. package/dist/assets/{Data-D4jDqmcs.js → Data-pZe3A7Va.js} +2 -2
  15. package/dist/assets/DeviceDetail-3jKJ80IC.js +2 -0
  16. package/dist/assets/{DeviceDoActionFields-CLlHGMoV.js → DeviceDoActionFields-1jte2ge2.js} +1 -1
  17. package/dist/assets/{Devices-mrHggHWa.js → Devices-Bq4yRli5.js} +1 -1
  18. package/dist/assets/{EmbedPlayerPage-HIM7BXTf.js → EmbedPlayerPage-DlIQigBi.js} +1 -1
  19. package/dist/assets/{History-9T3cw528.js → History-DTt-NAMR.js} +1 -1
  20. package/dist/assets/{Identity-vSPkTQS9.js → Identity-C3GHYP7_.js} +1 -1
  21. package/dist/assets/IntegrationDetail-EOwq3jVG.js +1 -0
  22. package/dist/assets/{IntegrationHub-BLWPwX2F.js → IntegrationHub-8GCewFBs.js} +1 -1
  23. package/dist/assets/Integrations-BocurtE0.js +1 -0
  24. package/dist/assets/Integrations-Bt3Im7Mh.js +1 -0
  25. package/dist/assets/Library-DTn9Nkjs.js +1 -0
  26. package/dist/assets/Locations-chgnzdWz.js +3 -0
  27. package/dist/assets/{Logs-BNUawZoE.js → Logs-BxTfJ-wk.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-BxH91O-B.js → MaskShapeCanvas-DBEbXuH2.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-DZKfaecb.js → MotionZonesSettings-D3Xxjf5N.js} +1 -1
  30. package/dist/assets/{MyAccess-BxcRYFsj.js → MyAccess-BTEJNJtS.js} +1 -1
  31. package/dist/assets/Network-plYS78UN.js +1 -0
  32. package/dist/assets/{NodeAddonsSettingsPanel-BcI9AigA.js → NodeAddonsSettingsPanel-Do_I93Mx.js} +1 -1
  33. package/dist/assets/Notifications-mslnotOB.js +1 -0
  34. package/dist/assets/Pipeline-Cjj8XOuS.js +1 -0
  35. package/dist/assets/{PrivacyMaskSettings-C1-GOEuN.js → PrivacyMaskSettings-CswE6pks.js} +1 -1
  36. package/dist/assets/{Recordings-BPIJtEGz.js → Recordings-BpB53ln_.js} +1 -1
  37. package/dist/assets/{RemoteGrid-BZbW8PeH.js → RemoteGrid-BjtzHkpg.js} +1 -1
  38. package/dist/assets/{ScanNetworkModal-BQ5OlzZX.js → ScanNetworkModal-BR3tzZcL.js} +1 -1
  39. package/dist/assets/{SceneMonitorEditor-C71RV5fL.js → SceneMonitorEditor-C2X6jZvS.js} +1 -1
  40. package/dist/assets/SessionsList-BOjlUhj5.js +2 -0
  41. package/dist/assets/{Showroom-Pcaz2yKE.js → Showroom-CHwcC6p6.js} +1 -1
  42. package/dist/assets/System-CiZ0xcyP.js +1 -0
  43. package/dist/assets/{Templates-ABoqOu9o.js → Templates-tilFwunF.js} +1 -1
  44. package/dist/assets/{Terminal-uL0eTf8i.js → Terminal-DiMnsE8i.js} +2 -2
  45. package/dist/assets/{Viewer-BzqHL8lA.js → Viewer-BwirleAM.js} +1 -1
  46. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Dbqn5c5X.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-w6FCrjgB.js} +1 -1
  47. package/dist/assets/{addon-icons-context-CzyObK2t.js → addon-icons-context-CHk3ePjj.js} +1 -1
  48. package/dist/assets/{archive-CDziWnvV.js → archive-BU_eXxQC.js} +1 -1
  49. package/dist/assets/{assignment-candidates-a6kHcvux.js → assignment-candidates-B4bOK7k8.js} +1 -1
  50. package/dist/assets/{authed-media-BcO83va1.js → authed-media-BYuQnqbF.js} +1 -1
  51. package/dist/assets/{bell-off-O7zrX-Mc.js → bell-off-DCQedZIx.js} +1 -1
  52. package/dist/assets/{board-model-sARab1AV.js → board-model-t0EX_kXW.js} +1 -1
  53. package/dist/assets/{boxes-svitF8K8.js → boxes-BZMO9uMf.js} +1 -1
  54. package/dist/assets/circle-slash-DFl97Cbx.js +1 -0
  55. package/dist/assets/client-F3l12jEi.js +674 -0
  56. package/dist/assets/{cloud-upload-B_uHg9Qk.js → cloud-upload-CApwQ18P.js} +1 -1
  57. package/dist/assets/crop-gfwPOF8e.js +1 -0
  58. package/dist/assets/{device-integration-icon-Bi5qhaK0.js → device-integration-icon-CXG5v8dp.js} +1 -1
  59. package/dist/assets/device-picker-model-Fpx4y0MY.js +1 -0
  60. package/dist/assets/dist-B2m_6_7g.js +674 -0
  61. package/dist/assets/{dist-C5kry-nn.js → dist-Hz1nnJDv.js} +1 -1
  62. package/dist/assets/{file-up-BnEcmi9q.js → file-up-cso0QIDs.js} +1 -1
  63. package/dist/assets/{format-DGQA45Ye.js → format-Csy9sDox.js} +1 -1
  64. package/dist/assets/{grip-vertical-DcUn4qSJ.js → grip-vertical-DqjjXK1h.js} +1 -1
  65. package/dist/assets/{hard-drive-download-CkT0au9p.js → hard-drive-download-D-ykdsm5.js} +1 -1
  66. package/dist/assets/{hostInit-Dc7Z_glr.js → hostInit-CTFssGi8.js} +1 -1
  67. package/dist/assets/i18n-BH0PY6IL.js +1 -0
  68. package/dist/assets/icons-B9uR9qKs.js +1 -0
  69. package/dist/assets/index-CQ7TjSgs.js +4 -0
  70. package/dist/assets/{key-vQtBGf1l.js → key-C_dbeH7F.js} +1 -1
  71. package/dist/assets/{key-round-CFwVAamk.js → key-round-CPg0Y5qN.js} +1 -1
  72. package/dist/assets/{layers-C-B3EC65.js → layers-Cb-ro1vb.js} +1 -1
  73. package/dist/assets/{linked-devices-model-DUYPy_9l.js → linked-devices-model-ZCUJsj_d.js} +1 -1
  74. package/dist/assets/{list-ordered-C_tb_5Gb.js → list-ordered-V6P5uujF.js} +1 -1
  75. package/dist/assets/{location-owned-usage-caVqSKq8.js → location-owned-usage-C6DcC3IT.js} +1 -1
  76. package/dist/assets/{log-in-D1R8-3xg.js → log-in-Cxvw8rxc.js} +1 -1
  77. package/dist/assets/{memory-stick-DTKZNNzT.js → memory-stick-Mm_iVwSZ.js} +1 -1
  78. package/dist/assets/{message-square-plus-_8_Z4yYf.js → message-square-plus-Bfam15lf.js} +1 -1
  79. package/dist/assets/{mf-entry-bootstrap-0-c9e86d7a.js → mf-entry-bootstrap-0-019f9c14.js} +2 -2
  80. package/dist/assets/{mic-off-S8b79RhQ.js → mic-off-CeSZf8K2.js} +1 -1
  81. package/dist/assets/{monitor-off-DktfIub5.js → monitor-off-U-RK64kw.js} +1 -1
  82. package/dist/assets/{monitor-smartphone-DiJ0euAC.js → monitor-smartphone-DezRerVw.js} +1 -1
  83. package/dist/assets/mount-Fpx4y0MY.js +1 -0
  84. package/dist/assets/{player-overlays-DyWZd37T.js → player-overlays-DgedyCX9.js} +1 -1
  85. package/dist/assets/{recycle-uEKrRpl_.js → recycle-Dkb1d-SV.js} +1 -1
  86. package/dist/assets/remoteEntry-DpkkaSO3.js +1 -0
  87. package/dist/assets/{ruler-Cf92fzAd.js → ruler-DzpBI-EP.js} +1 -1
  88. package/dist/assets/{scan-eye-_8TdtNzb.js → scan-eye-BmLTXsIf.js} +1 -1
  89. package/dist/assets/{scissors-B9AK1nLy.js → scissors-lBRCylhQ.js} +1 -1
  90. package/dist/assets/{search-x-CVEVpLBV.js → search-x-BRhrXpKx.js} +1 -1
  91. package/dist/assets/{send-CBO9g-_U.js → send-DVJoNc0-.js} +1 -1
  92. package/dist/assets/{settings-2-BSjF3kN4.js → settings-2-D6sp_FTm.js} +1 -1
  93. package/dist/assets/{shapes-BsX-8xUL.js → shapes-CQn3wvpk.js} +1 -1
  94. package/dist/assets/{sigma-veVH6AL2.js → sigma-CKK8bLRa.js} +1 -1
  95. package/dist/assets/speaker-BYorOPbN.js +1 -0
  96. package/dist/assets/src-B0EA_4Ed.js +67 -0
  97. package/dist/assets/{step-inspector-model-BW-W62sj.js → step-inspector-model-DEfajBM3.js} +1 -1
  98. package/dist/assets/{table-2-DfmXeNvT.js → table-2-BPB4V5Fg.js} +1 -1
  99. package/dist/assets/{timer-reset-D9i5HPty.js → timer-reset-Cu_VSXbl.js} +1 -1
  100. package/dist/assets/{unlink-Dsy3yrQn.js → unlink-BcrHT0zX.js} +1 -1
  101. package/dist/assets/{usb-taNjM8Y4.js → usb-DhXPqJtn.js} +1 -1
  102. package/dist/assets/{use-device-bound-caps-Dy9z5ssE.js → use-device-bound-caps-K47AcsQ5.js} +1 -1
  103. package/dist/assets/{use-scenes-feed-BMJYnt2p.js → use-scenes-feed-DQrMGL5E.js} +1 -1
  104. package/dist/assets/{use-stationary-objects-DKZYbXwz.js → use-stationary-objects-yu-O0RPa.js} +1 -1
  105. package/dist/assets/useEventInvalidation-Fpx4y0MY.js +1 -0
  106. package/dist/assets/{useNodeUrlSelection-BbrmxDID.js → useNodeUrlSelection-BuraZwll.js} +1 -1
  107. package/dist/assets/user-round-D6wDvac9.js +1 -0
  108. package/dist/assets/{user-x-LhbJK13A.js → user-x-DRSOzwTr.js} +1 -1
  109. package/dist/assets/{variable-BnqMYwWo.js → variable-cv0ONmJ-.js} +1 -1
  110. package/dist/assets/{video-BiqduAcp.js → video-5IaJhdjU.js} +1 -1
  111. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-_PsSzHuE.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BtgDin-X.js} +2 -2
  112. package/dist/index.html +9 -9
  113. package/dist/server/addon.js +27 -8
  114. package/package.json +1 -1
  115. package/dist/assets/Addons-D5S6sTN7.js +0 -5
  116. package/dist/assets/AiProfiles-BJhboAC6.js +0 -3
  117. package/dist/assets/BrokerEditorDialog-DsKGCg9y.js +0 -1
  118. package/dist/assets/Build-5sZQPjWb.js +0 -40
  119. package/dist/assets/DeviceDetail-8sreVV-i.js +0 -2
  120. package/dist/assets/IntegrationDetail-DwipvGcz.js +0 -1
  121. package/dist/assets/Integrations-9y5oqDxP.js +0 -1
  122. package/dist/assets/Integrations-ZJ4_tnkn.js +0 -1
  123. package/dist/assets/Library-Cdfp5QPG.js +0 -1
  124. package/dist/assets/Locations-BNiiWGXW.js +0 -3
  125. package/dist/assets/Network-7hIzFAXX.js +0 -1
  126. package/dist/assets/Notifications-dUvsPqSL.js +0 -1
  127. package/dist/assets/Pipeline-Bu7x636X.js +0 -1
  128. package/dist/assets/SessionsList-BF7BLjjI.js +0 -2
  129. package/dist/assets/System-BVsN5xi0.js +0 -1
  130. package/dist/assets/circle-slash-CORBdt2Z.js +0 -1
  131. package/dist/assets/client-DdGu3rlb.js +0 -674
  132. package/dist/assets/crop-AXhcNsdd.js +0 -1
  133. package/dist/assets/device-picker-model-DhYiPHjb.js +0 -1
  134. package/dist/assets/dist-CE4Thp2G.js +0 -674
  135. package/dist/assets/i18n-C-H4BlYV.js +0 -1
  136. package/dist/assets/icons-C7_2EHkF.js +0 -1
  137. package/dist/assets/index-CyYfrxyQ.js +0 -4
  138. package/dist/assets/mount-DhYiPHjb.js +0 -1
  139. package/dist/assets/remoteEntry-C0WZ_Eg2.js +0 -1
  140. package/dist/assets/speaker-JfimpXfG.js +0 -1
  141. package/dist/assets/src-DF4f-P3R.js +0 -67
  142. package/dist/assets/useEventInvalidation-DhYiPHjb.js +0 -1
  143. package/dist/assets/user-round-BioYT2Ju.js +0 -1
@@ -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{Ht as l,Or as u,Pi as d,Vr as f,Y as p,Zr as m,ca as h,dt as g,fr as _,gt as v,mi as y,st as b,ti as x,zt as S}from"./player-overlays-DyWZd37T.js";import{Go as C}from"./client-DdGu3rlb.js";import{n as w,t as T}from"./scissors-B9AK1nLy.js";import{An as E,Au as D,Cr as O,Cu as k,Du as A,Eu as j,Fo as M,Fr as N,Fu as P,Hc as F,Ic as ee,Iu as te,Lu as ne,Mi as I,Mu as re,Nu as ie,Ou as ae,Pr as L,Pu as oe,Rc as se,Tr as ce,Wc as le,_l as ue,au as de,br as fe,cu as pe,ei as me,if as R,iu as z,jn as he,ju as ge,ki as B,ku as _e,lu as ve,ou as ye,ri as V,ru as be,su as xe,tf as H,uu as Se,wr as Ce,wu as U,xl as we,xr as Te,xu as Ee,yr as De}from"./src-DF4f-P3R.js";import{t as W}from"./i18n-C-H4BlYV.js";import{t as G}from"./useTranslation-BJr-n0es.js";import{T as Oe,k as ke,pr as Ae}from"./index-CyYfrxyQ.js";import{t as je}from"./AdminSectionedPage-Bu-9skyU.js";import{n as Me}from"./authed-media-BcO83va1.js";import{t as K}from"./format-size-DIxKXxtj.js";import{c as Ne,i as Pe,l as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be,u as Ve}from"./location-owned-usage-caVqSKq8.js";o();var He=[{value:`all`,labelKey:`common.all`},{value:`recording`,labelKey:`recordings.activitySection.domainRecordings`},{value:`events`,labelKey:`common.events`}],Ue={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},We={columnKey:`at`,dir:`desc`};function Ge(e){return new Date(e).toLocaleString()}function Ke(){let{t:n,i18n:i}=G(),[o,s]=a(`all`),{data:l,isLoading:u,isError:d}=de({},{refetchOnWindowFocus:!1}),{data:f,isLoading:p,isError:m}=F({},{refetchOnWindowFocus:!1}),{data:g}=M({isCamera:!0,projection:`slim`}),v=t(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.name);return e},[g]),y=t(()=>{let e=[...l??[],...f??[]];return(o===`all`?e:e.filter(e=>e.domain===o)).toSorted((e,t)=>t.at-e.at)},[l,f,o]),b=t(()=>{let e=[];return d&&o!==`events`&&e.push(n(`recordings.activitySection.domainRecordings`)),m&&o!==`recording`&&e.push(n(`common.events`)),e},[d,m,o,n]),x=t(()=>new Intl.ListFormat(i.language,{type:`conjunction`}).format(b),[b,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:Ge(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 ${Ue[e.domain]}`,children:e.domain})},{key:`op`,header:n(`recordings.activitySection.operation`,`Operation`),sortValue:e=>e.op,render:e=>r(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:n(`recordings.activitySection.reason`,`Reason`),sortValue:e=>e.reason,render:e=>r(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:n(`recordings.activitySection.camera`,`Camera`),sortValue:e=>e.deviceId===null?`cluster`:v.get(e.deviceId)??`#${String(e.deviceId)}`,render:e=>e.deviceId===null?r(`span`,{className:`text-foreground-subtle`,children:n(`common.cluster`)}):r(`span`,{className:`text-foreground`,children:v.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:n(`recordings.activitySection.items`,`Items`),align:`right`,nowrap:!0,sortValue:e=>e.itemsAffected,render:e=>r(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:n(`recordings.activitySection.reclaimed`,`Reclaimed`),align:`right`,nowrap:!0,sortValue:e=>e.bytesReclaimed,render:e=>r(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?K(e.bytesReclaimed):`—`})}],[v,n]),w=u||p;return e(`div`,{className:`flex flex-col gap-4`,children:[r(`div`,{className:`flex items-center gap-1`,children:He.map(e=>r(`button`,{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&&y.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(_,{className:`h-4 w-4 animate-spin`}),n(`recordings.activitySection.loadingActivity`,`Loading activity…`)]}):y.length===0?b.length>0?r(L,{icon:S,title:n(`recordings.activitySection.activityCouldNotBeRead`,`Activity could not be read`),description:n(`recordings.activitySection.theOpsLogDidNot`,`The {{value1}} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`,{value1:x})}):r(L,{icon:h,title:n(`recordings.activitySection.noActivityYet`,`No activity yet`),description:n(`recordings.activitySection.pruneDeleteAndRescanOperations`,`Prune, delete and rescan operations across recordings and events show up here.`)}):e(c,{children:[b.length>0&&e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[r(S,{className:`h-3 w-3 shrink-0`}),n(`recordings.activitySection.domainsMissing`,{count:b.length,names:x})]}),r(E,{columns:C,rows:y,rowKey:e=>e.id,minWidthPx:720,maxBodyHeight:he,defaultSort:We})]})]})}o();function qe(){let{t:n}=G(),i=M({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(L,{icon:d,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(`select`,{value:l??``,onChange:e=>c(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:o.map(e=>r(`option`,{value:e.id,children:e.name},e.id))})]}),l!==null&&r(me,{deviceId:l,children:r(ke,{deviceId:l,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},l)]})}o();function q({types:n}){let{t:i}=G(),o=s(),c=b(),{data:l}=U({}),u=k(),d=t(()=>u.data??[],[u.data]),{data:f}=z({},{refetchOnWindowFocus:!1}),p=t(()=>Be(l??[],f?.locations),[l,f?.locations]),[m,h]=a(null),[g,_]=a(null),v=()=>{o.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},y=ne({onSuccess:v}),x=Ee({onSuccess:v}),S=t(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[l]),C=async(e,t)=>{Fe(t)&&!await c({title:i(`pipeline.storageLocationsPanel.disable`,`Disable "{{displayName}}"?`,{displayName:e.displayName}),message:i(`pipeline.storageLocationsPanel.nothingIsDeletedSetThe`,`{{consequence}} Nothing is deleted — set the location back to Read-only or Active to bring its footage back.`,{consequence:Ne(t).consequence}),confirmLabel:i(`common.disable`,`Disable`),variant:`danger`})||y.mutate(ze(e,{mode:t}))},w=async e=>{if(await c({title:i(`pipeline.storageLocationsPanel.deleteLocation`,`Delete location "{{displayName}}"?`,{displayName:e.displayName}),message:i(`pipeline.storageLocationsPanel.removesTheRecordFilesOn`,`Removes the record; files on disk are untouched.`),confirmLabel:i(`common.delete`,`Delete`),variant:`danger`}))try{await x.mutateAsync({id:e.id})}catch(t){await c({title:i(`pipeline.storageLocationsPanel.deleteAnyway`,`Delete anyway?`),message:i(`pipeline.storageLocationsPanel.forcingNote`,{error:t instanceof Error?t.message:String(t)}),confirmLabel:i(`pipeline.storageLocationsPanel.forceDelete`,`Force delete`),variant:`danger`})&&x.mutate({id:e.id,force:!0})}},T=n.map(e=>d.find(t=>t.id===e)).filter(e=>e!==void 0);return e(`div`,{className:`space-y-3`,children:[T.length===0?r(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:i(`pipeline.storageLocationsPanel.noStorageLocationsDeclaredFor`,`No storage locations declared for this purpose.`)}):T.map(e=>r(Ie,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:S.get(e.id)??[],onAdd:e=>h(e),onEdit:e=>_(e),onDelete:e=>{w(e)},ownedBytesById:p,onSetMode:(e,t)=>{C(e,t)}},e.id)),m!==null&&r(Ve,{initialType:m,onClose:()=>h(null),onCreated:()=>{v(),h(null)}}),g!==null&&r(Le,{location:g,onClose:()=>_(null),onSaved:()=>{v(),_(null)}})]})}o();var Je=`pipeline-analytics`;function Ye(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function Xe(){let{t:n}=G(),i=s(),{nodes:a}=H(),{data:o,isLoading:c}=B({addonId:Je}),l=Ye(o),u=I({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),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(_,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(`select`,{value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:Je,patch:{postProcessingNodeId:e.target.value}})},disabled:u.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterEventsTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(_,{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(q,{types:[`eventMedia`]})]})]})}o();var Ze=[[`pipelineAnalytics`]],Qe=1440*60*1e3;function $e(e,t){return t.get(e)??W.t(`recordings.eventsManagementSection.removedCamera`,{id:String(e)})}var et=[{days:1},{days:7},{days:30},{days:90}];function tt(){let{t:i}=G(),o=s(),c=b(),[u,d]=a(30),[f,m]=a(null),{data:h,isLoading:g}=se({},{refetchOnWindowFocus:!1}),{data:v}=M({isCamera:!0,projection:`slim`}),y=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),S=n(()=>{o.invalidateQueries({queryKey:Ze})},[o]),C=le({onSuccess:S}),w=ee(),D=n(async()=>{await c({title:i(`recordings.eventsManagementSection.pruneTitle`,{count:u}),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()-u*Qe,reason:`retention`})},[c,C,u,i]),O=n(async e=>{let t=$e(e.deviceId,y);if(await c({title:i(`recordings.eventsManagementSection.deleteAllEventsFor`,`Delete all events for {{label}}?`,{label:t}),message:i(`recordings.eventsManagementSection.deleteRowsMessage`,{count:e.rows,size:K(e.bytes)}),confirmLabel:i(`recordings.eventsManagementSection.deleteEvents`,`Delete events`),variant:`danger`})){m(null);try{let n=await w.mutateAsync({deviceId:e.deviceId});S();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){m(`0 events deleted for ${t}. Media still listed (${K(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}m(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){m(e instanceof Error?e.message:String(e))}}},[c,w,y,S,i]),k=t(()=>[{key:`camera`,header:i(`recordings.eventsManagementSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:$e(e.deviceId,y)})},{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:K(e.bytes)})},{key:`actions`,header:``,align:`right`,render:t=>e(`button`,{onClick:()=>{O(t)},disabled:w.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:i(`recordings.eventsManagementSection.deleteAllEventsForThis`,`Delete all events for this camera`),children:[r(l,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})}],[y,O,w.isPending,i]);return g&&!h?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(_,{className:`h-4 w-4 animate-spin`}),i(`recordings.eventsManagementSection.loadingEventStoreFootprint`,`Loading event-store footprint…`)]}):h?e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[r(p,{label:i(`recordings.eventsManagementSection.totalEvents`,`Total events`),icon:r(x,{className:`h-3 w-3`}),footer:`across ${String(h.devices.length)} camera${h.devices.length===1?``:`s`}`,children:h.totalRows.toLocaleString()}),r(p,{label:i(`recordings.eventsManagementSection.eventMediaOnDisk`,`Event media on disk`),children:K(h.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(`select`,{value:u,onChange:e=>d(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:et.map(e=>r(`option`,{value:e.days,children:i(`recordings.eventsManagementSection.ageDays`,{count:e.days})},e.days))}),e(`button`,{onClick:()=>{D()},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(_,{className:`h-3 w-3 animate-spin`}):r(T,{className:`h-3 w-3`}),i(`recordings.eventsManagementSection.pruneNow`,`Prune now`)]})]}),h.devices.length===0?r(L,{icon:x,title:i(`recordings.eventsManagementSection.noStoredEvents`,`No stored events`),description:i(`recordings.eventsManagementSection.noCameraHasPersistedEvents`,`No camera has persisted events yet.`)}):r(E,{columns:k,rows:[...h.devices],rowKey:e=>e.deviceId,minWidthPx:480}),f===null?null:r(`p`,{className:f.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:f})]}):r(L,{icon:x,title:i(`recordings.eventsManagementSection.noEventData`,`No event data`),description:i(`recordings.eventsManagementSection.pipelineAnalyticsHasNotReported`,`Pipeline analytics has not reported any event-store footprint yet.`)})}function nt(){let{t}=G();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(tt,{})})]}),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(Xe,{})})]})]})}function rt(e){let t=[];return e.timelapse?t.push(`timelapse ${String(e.timelapse.everyMs/1e3)}s`):(t.push(`${String(e.speed??1)}×`),e.includeAudio&&t.push(`+ audio`)),t.join(` `)}function it(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function at(e,t){let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=r>0?`${String(r)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`:`${String(i)}:${String(a).padStart(2,`0`)}`;return`${it(e)} · ${o}`}function ot(e,t){let n=e-t;if(n<=0)return W.t(`helpers.exportFormat.expired`);let r=Math.floor(n/6e4);if(r<60)return W.t(`helpers.exportFormat.inMinutes`,{n:String(r)});let i=Math.floor(r/60);return i<24?W.t(`helpers.exportFormat.inHours`,{n:String(i)}):W.t(`helpers.exportFormat.inDays`,{n:String(Math.floor(i/24))})}function st(e,t,n,r){return e.map(e=>{if(e.state===`expired`||e.state===`deleted`)return e;let i=r.get(e.id);if(i)return{...e,state:`failed`,error:i.error,progressPct:null};let a=n.get(e.id);if(a)return{...e,state:`ready`,fileBytes:a.fileBytes,progressPct:100};let o=t.get(e.id);return o&&(e.state===`queued`||e.state===`rendering`)?{...e,state:`rendering`,progressPct:o.progressPct}:e})}o();var ct=[`high`,`mid`,`low`],lt=[{value:1,labelKey:`recordings.newExportModal.speedRealTime`},{value:2,labelKey:null},{value:4,labelKey:null},{value:8,labelKey:null},{value:16,labelKey:null}],ut=10080*60*1e3;function dt(e){let t=new Date(Date.now()-e*6e4),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function ft({onClose:n,onCreated:i}){let{t:o}=G(),s=M({isCamera:!0,projection:`slim`}),c=t(()=>(s.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[s.data]),[l,u]=a(``),[d,p]=a(`high`),[m,h]=a(dt(60)),[g,_]=a(dt(0)),[v,y]=a(1),[b,x]=a(!0),[S,C]=a(``),[w,T]=a(null),E=l===``?c[0]?.id??null:l,D=new Date(m).getTime(),k=new Date(g).getTime(),A=Number.isFinite(D)&&Number.isFinite(k)&&D<k,j=pe({onSuccess:()=>{i(),n()},onError:e=>T(e instanceof Error?e.message:String(e))});return r(De,{open:!0,onOpenChange:e=>!e&&n(),children:e(Te,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(Ce,{children:e(ce,{className:`flex items-center gap-1.5`,children:[r(f,{className:`h-3.5 w-3.5`}),o(`recordings.newExportModal.newExport`,`New export`)]})}),e(fe,{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(`select`,{value:E??``,onChange:e=>u(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,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(`select`,{value:d,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:ct.map(e=>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(`input`,{type:`datetime-local`,value:m,onChange:e=>h(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]}),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(`input`,{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(`select`,{value:v,onChange:e=>y(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:lt.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(`input`,{type:`text`,value:S,onChange:e=>C(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(`input`,{type:`checkbox`,checked:b,disabled:v!==1,onChange:e=>x(e.target.checked),className:`accent-primary`}),o(v===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!A&&r(`p`,{className:`text-[11px] text-danger`,children:o(`recordings.newExportModal.fromMustBeBeforeTo`,`"From" must be before "To".`)}),w&&r(`p`,{className:`text-[11px] text-danger`,children:w})]}),e(O,{children:[r(V,{variant:`outline`,size:`sm`,onClick:n,children:o(`common.cancel`,`Cancel`)}),r(V,{size:`sm`,onClick:()=>{if(E===null||!A)return;T(null);let e=S.trim();j.mutate({deviceId:E,profile:d,fromMs:D,toMs:k,options:{includeAudio:b,maxLifeMs:ut,deleteAfterDownload:!1,...v===1?{}:{speed:v},...e.length>0?{title:e}:{}}})},disabled:E===null||!A||j.isPending,children:j.isPending?o(`recordings.newExportModal.queuing`,`Queuing…`):o(`recordings.newExportModal.createExport`,`Create export`)})]})]})})}o();var pt=[[`recordingExport`]],mt={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 ht(){let{data:e,isLoading:n}=Se({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:r}=R(C.RecordingExportProgress,e=>e.exportId),{map:i}=R(C.RecordingExportCompleted,e=>e.exportId),{map:a}=R(C.RecordingExportFailed,e=>e.exportId);return{rows:t(()=>st(e??[],r,i,a),[e,r,i,a]),isLoading:n}}function gt(e){let[t,n]=a(()=>Date.now());return i(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function _t(){let{t:i}=G(),o=s(),[c,u]=a(!1),d=()=>{o.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},p=b(),h=g().trpcClient,v=gt(6e4),{rows:x,isLoading:S}=ht(),{data:C}=M({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:pt})},[o]),D=xe({onSuccess:T}),O=ve({onSuccess:T}),[k,A]=a(null),j=n(async e=>{A(e.id);try{let{url:t}=await h.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await Me(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{A(null)}},[h,T]),N=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`})&&D.mutate({exportId:e.id})},[p,D,i]),P=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`})&&O.mutate({exportId:e.id})},[p,O,i]),F=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:at(e.fromMs,e.toMs)})},{key:`variant`,header:i(`recordings.exportsSection.variant`,`Variant`),render:e=>r(`span`,{className:`text-foreground-subtle`,children:rt(e.options)})},{key:`state`,header:i(`recordings.exportsSection.state`,`State`),render:t=>{let n=mt[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(_,{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:ot(e.expiresAt,v)})},{key:`size`,header:i(`recordings.exportsSection.size`,`Size`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:K(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(`button`,{onClick:()=>{j(t)},disabled:k===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:[k===t.id?r(_,{className:`h-3 w-3 animate-spin`}):r(m,{className:`h-3 w-3`}),i(`recordings.exportsSection.download`,`Download`)]}),a&&e(`button`,{onClick:()=>{N(t)},disabled:D.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(y,{className:`h-3 w-3`}),i(`common.cancel`,`Cancel`)]}),o&&r(`button`,{onClick:()=>{P(t)},disabled:O.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(l,{className:`h-3 w-3`})})]})}}],[w,v,k,D.isPending,O.isPending,j,N,P,i]);return S&&x.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(_,{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(`button`,{onClick:()=>u(!0),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground`,children:[r(f,{className:`h-3.5 w-3.5`}),i(`recordings.exportsSection.newExport`,`New export`)]})}),x.length===0?r(L,{icon:f,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(E,{columns:F,rows:x,rowKey:e=>e.id,minWidthPx:720}),c&&r(ft,{onClose:()=>u(!1),onCreated:d})]})}var vt=`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`;o();var yt=`storage-migration`,bt=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function xt(e){return[`${e.orphansReclaimed} orphan rows (${K(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${K(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${K(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function St(){let{t:e}=G(),t=N(yt);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(Ct,{}):null}function Ct(){let{t}=G(),n=b(),[i,o]=a(!1),[s,c]=a(null),u=_e({},{refetchInterval:2e3}),d=u.data??null,f=d!==null&&bt.has(d.phase),p=ae(),m=A(),h=async()=>{if(await n({title:t(`recordings.cleanupSection.runStorageCleanup`,`Run storage cleanup?`),message:i?t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd`,`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`):t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd2`,`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`),confirmLabel:t(`recordings.cleanupSection.runCleanup`,`Run cleanup`),variant:`danger`})){c(null);try{await p.mutateAsync({includeDebugMedia:i}),await u.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}},g=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 m.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(`input`,{type:`checkbox`,checked:i,disabled:f,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(`button`,{type:`button`,disabled:f||p.isPending,onClick:()=>{h()},className:vt,children:[(f||p.isPending)&&r(_,{className:`h-3 w-3 animate-spin`}),r(l,{className:`h-3 w-3`}),t(`recordings.cleanupSection.runCleanup`,`Run cleanup`)]}),f&&r(`button`,{type:`button`,onClick:()=>{g()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children: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}),f&&r(_,{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:xt(d)}),d.error&&r(`p`,{className:`text-[11px] text-danger`,children:d.error})]})]})}o();var wt=2e3;function Tt(){let{t}=G(),n=b(),a=s(),o=we(),c=ue(void 0,{refetchInterval:e=>e.state.data?.state===`running`?wt:!1}),l=c.data,d=l?.state===`running`,f=d||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=d?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(`button`,{type:`button`,onClick:()=>void p(),disabled:f,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:[f?r(_,{className:`h-3.5 w-3.5 animate-spin`}):r(u,{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 Et(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 Dt(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?`${K(e.bytesMoved/t*J)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${Et(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${K(e.bytesMoved)} moved`,rate:a,eta:s}}function Ot(e){let t=Dt(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}o();var kt=`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`}],At=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function jt(){let{t}=G(),n=N(kt);return n===`pending`?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(_,{className:`h-4 w-4 animate-spin`}),t(`migration.storageMigrationSection.checkingWhetherStorageMigrationIs`,`Checking whether storage migration is installed…`)]}):n===`unknown`?r(L,{icon:S,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(L,{icon:w,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(Mt,{})}function Mt(){let{t:n}=G(),i=b(),{data:o}=U({}),[s,c]=a({}),[l,u]=a({}),[d,f]=a(null),[p,m]=a(null),h=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]),g=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]),y=te({},{refetchInterval:2e3}),x=y.data??null,S=x!==null&&At.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]),T=t(()=>{let e={};for(let t of Q){if(!s[t.id])continue;let n=l[t.id]??g.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s,l,g]),E=t(()=>({destinations:C??{},...T?{sources:T}:{}}),[C,T]),D=ie(E,{enabled:!1,retry:!1}),O=P(),k=j(),A=async()=>{if(!C)return;m(null);let e=await D.refetch();if(e.error){m(e.error instanceof Error?e.error.message:String(e.error));return}f(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`})){m(null);try{await O.mutateAsync(E),f(null),await y.refetch()}catch(e){m(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 k.mutateAsync({jobId:x.jobId}),await y.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(w,{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=h.get(t.locationType)??[],a=g.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(`select`,{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 rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,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(`select`,{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 rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,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)})}),p&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:p}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[e(`button`,{type:`button`,onClick:()=>{A()},disabled:!C||D.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:[D.isFetching&&r(_,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.plan`,`Plan`)]}),e(`button`,{type:`button`,onClick:()=>{M()},disabled:!C||O.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:[O.isPending&&r(_,{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(`button`,{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(v,{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(_,{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(Nt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),r(Pt,{})]}),r(Ft,{running:S}),r(Lt,{})]})}function Nt({move:t}){let{t:n}=G(),i=t.progress===null?null:Dt(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:Ot(t.progress)})]})]})}function Pt(){let{t}=G(),{data:n}=ge({});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 Ft({running:t}){let{t:n}=G(),i=b(),o=oe({},{staleTime:1/0,refetchOnWindowFocus:!1}),s=D(),[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(`button`,{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:It(i)})]}),r(`button`,{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 It(e){if(e.items===null)return W.t(`recordings.storageMigrationSection.residueUnknown`);let t=e.items.toLocaleString(`en-US`);return e.bytes===null?W.t(`recordings.storageMigrationSection.residueRows`,{count:e.items,items:t}):W.t(`recordings.storageMigrationSection.residueSegments`,{count:e.items,items:t,size:K(e.bytes)})}function Lt(){let{t}=G(),{data:n}=re({},{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:Ot({filesMoved:t.job.filesMoved,filesTotal:t.job.filesTotal,bytesMoved:t.job.bytesMoved,startedAt:t.job.startedAt,observedAt:t.observedAt})})]},t.job.jobId))})]})}function Rt(){let{t}=G();return e(`div`,{className:`flex flex-col gap-4`,children:[r(St,{}),r(Tt,{}),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(jt,{})})]})]})}o();var zt=`recorder`;function Bt(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function Vt(){let{t:n}=G(),i=s(),{nodes:a}=H(),{data:o,isLoading:c}=B({addonId:zt}),l=Bt(o,`recordingNodeId`,`hub`),u=I({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),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(_,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(`select`,{value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:zt,patch:{recordingNodeId:e.target.value}})},disabled:u.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterRecordingTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(_,{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(q,{types:[`recordings`,`recordingsLow`]})]})]})}function Ht(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Ut(e,t){let n=Ht(e);return n.length===0?W.t(`helpers.cameraDisk.defaultRoot`):n.map(e=>t.get(e)??e).join(` + `)}function Wt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Ut(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Ht(e).includes(n));return i===void 0?null:{label:Ut(i,t),exact:!1}}o();var Gt=[[`recording`]],Kt=[{value:`retention`,labelKey:`recordings.storageSection.pruneRetention`},{value:`quota`,labelKey:`recordings.storageSection.pruneQuota`},{value:`operator`,labelKey:`recordings.storageSection.pruneOperator`}],qt={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Jt={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function Yt(e){return e==null?`—`:new Date(e).toLocaleString()}function Xt(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(` + `):W.t(`recordings.storageSection.defaultRoot`):e.root}function Zt(){let{t:i}=G(),o=s(),c=b(),[d,f]=a(`retention`),{data:m,isLoading:h}=z({},{refetchOnWindowFocus:!1}),{data:g}=M({isCamera:!0,projection:`slim`}),{data:v}=U({}),y=t(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.name);return e},[g]),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(()=>m?.locations??[],[m?.locations]),w=t(()=>Wt(C,x,S),[C,x,S]),D=t(()=>Pe(C),[C]),O=n(()=>{o.invalidateQueries({queryKey:Gt})},[o]),k=ye({onSuccess:O}),A=be({onSuccess:O}),j=n(async e=>{await c({title:i(`recordings.storageSection.prune`,`Prune {{label}}?`,{label:y.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:d}),confirmLabel:i(`recordings.storageSection.pruneNow`,`Prune now`),variant:`danger`})&&k.mutate({deviceId:e.deviceId,reason:d})},[c,k,d,y,i]),N=n(async e=>{await c({title:i(`recordings.storageSection.deleteAllFootageFor`,`Delete all footage for {{label}}?`,{label:y.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:K(e.usedBytes)}),confirmLabel:i(`recordings.storageSection.delete`,`Delete {{value1}}`,{value1:K(e.usedBytes)}),variant:`danger`})&&A.mutate({deviceId:e.deviceId})},[c,A,y,i]),P=t(()=>[{key:`camera`,header:i(`recordings.storageSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:y.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:i(`recordings.storageSection.disk`,`Disk`),nowrap:!0,render:()=>w===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`span`,{className:w.exact?`text-foreground`:`text-foreground-subtle`,title:w.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:[w.label,!w.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:K(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:Yt(e.oldestMs)})},{key:`actions`,header:``,align:`right`,render:t=>e(`div`,{className:`flex items-center justify-end gap-1`,children:[e(`button`,{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(T,{className:`h-3 w-3`}),i(`recordings.storageSection.prune2`,`Prune`)]}),e(`button`,{onClick:()=>{N(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(l,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})]})}],[y,w,j,N,k.isPending,A.isPending,i]);if(h&&!m)return e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(_,{className:`h-4 w-4 animate-spin`}),i(`recordings.storageSection.loadingStorageUsage`,`Loading storage usage…`)]});if(!m)return r(L,{icon:u,title:i(`recordings.storageSection.noStorageData`,`No storage data`),description:i(`recordings.storageSection.theRecordingNodeHasNot`,`The recording node has not reported any storage usage yet.`)});let F=m.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(p,{label:i(`recordings.storageSection.totalUsed`,`Total used`),icon:r(u,{className:`h-3 w-3`}),footer:`${String(F)} camera${F===1?``:`s`} on ${m.nodeId}`,children:K(m.totalUsedBytes)}),D!==null&&D.severity!==null&&r(p,{label:i(`recordings.storageSection.freeOnRecordingsVolumes`,`Free on recordings volumes`),icon:r(u,{className:`h-3 w-3`}),footer:`across ${String(D.knownVolumes)} volume${D.knownVolumes===1?``:`s`} of ${K(D.totalBytes)}`+(D.unknownVolumes>0?` · ${String(D.unknownVolumes)} did not report capacity`:``),children:r(`span`,{className:`tabular-nums ${Jt[D.severity]}`,children:K(D.freeBytes)})}),C.map(t=>{let n=Re(t),a=t.locationId??t.root??`default`;return r(p,{label:i(`recordings.storageSection.disk2`,`Disk: {{label}}`,{label:Xt(t,x)}),footer:n===null?`${K(t.usedBytes)} of recordings · volume capacity unknown`:`${K(n.freeBytes)} free of ${K(n.totalBytes)} · ${K(t.usedBytes)} recordings (${$(n.recordingsFraction)})`,children:n===null?r(`span`,{className:`tabular-nums`,children:K(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 ${qt[n.severity]}`,style:{width:$(n.fraction)}})}),r(`span`,{className:`tabular-nums text-xs ${Jt[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(`select`,{id:`prune-reason`,value:d,onChange:e=>{let t=Kt.find(t=>t.value===e.target.value);t&&f(t.value)},className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:Kt.map(e=>r(`option`,{value:e.value,children:i(e.labelKey)},e.value))})]}),F===0?r(L,{icon:u,title:m.devicesRead===`unavailable`?i(`recordings.storageSection.perCameraUsageUnavailable`,`Per-camera usage unavailable`):i(`recordings.storageSection.noRecordedFootage`,`No recorded footage`),description:m.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(E,{columns:P,rows:[...m.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Qt(){let{t}=G();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(Zt,{})})]}),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(Vt,{})})]})]})}function $t(){let{t:e}=G(),t=Oe(`/recordings`,{t:e,isAdmin:!0})??{icon:f,title:e(`nav.recordings`,`Recordings`)};return r(je,{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(Qt,{})},{id:`events`,label:e(`recordings.events`,`Events`),content:r(nt,{})},{id:`cameras`,label:e(`recordings.cameras`,`Cameras`),content:r(qe,{})},{id:`exports`,label:e(`recordings.export`,`Export`),content:r(_t,{})},{id:`activity`,label:e(`recordings.activity`,`Activity`),content:r(Ke,{})},{id:`management`,label:e(`recordings.management`,`Management`),content:r(Rt,{})}]})}export{$t 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{Fi as l,Hr as u,Ht as d,Qr as f,Y as p,dt as m,gt as h,hi as g,kr as _,la as v,ni as y,pr as b,st as x,zt as S}from"./player-overlays-DgedyCX9.js";import{Go as C}from"./client-F3l12jEi.js";import{n as w,t as T}from"./scissors-lBRCylhQ.js";import{An as E,Au as D,Cr as O,Cu as k,Du as A,Eu as j,Fo as M,Fr as N,Fu as P,Hc as F,Ic as ee,Iu as te,Lu as ne,Mi as I,Mu as re,Nu as ie,Ou as ae,Pr as L,Pu as oe,Rc as se,Tr as ce,Wc as le,_l as ue,au as de,br as fe,cu as pe,ei as me,if as R,iu as z,jn as he,ju as ge,ki as B,ku as _e,lu as ve,ou as ye,ri as V,ru as be,su as xe,tf as H,uu as Se,wr as Ce,wu as U,xl as we,xr as Te,xu as Ee,yr as De}from"./src-B0EA_4Ed.js";import{t as W}from"./i18n-BH0PY6IL.js";import{t as G}from"./useTranslation-BJr-n0es.js";import{T as Oe,k as ke,pr as Ae}from"./index-CQ7TjSgs.js";import{t as je}from"./AdminSectionedPage-B4MRvqE8.js";import{n as Me}from"./authed-media-BYuQnqbF.js";import{t as K}from"./format-size-DIxKXxtj.js";import{c as Ne,i as Pe,l as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be,u as Ve}from"./location-owned-usage-C6DcC3IT.js";o();var He=[{value:`all`,labelKey:`common.all`},{value:`recording`,labelKey:`recordings.activitySection.domainRecordings`},{value:`events`,labelKey:`common.events`}],Ue={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},We={columnKey:`at`,dir:`desc`};function Ge(e){return new Date(e).toLocaleString()}function Ke(){let{t:n,i18n:i}=G(),[o,s]=a(`all`),{data:l,isLoading:u,isError:d}=de({},{refetchOnWindowFocus:!1}),{data:f,isLoading:p,isError:m}=F({},{refetchOnWindowFocus:!1}),{data:h}=M({isCamera:!0,projection:`slim`}),g=t(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.name);return e},[h]),_=t(()=>{let e=[...l??[],...f??[]];return(o===`all`?e:e.filter(e=>e.domain===o)).toSorted((e,t)=>t.at-e.at)},[l,f,o]),y=t(()=>{let e=[];return d&&o!==`events`&&e.push(n(`recordings.activitySection.domainRecordings`)),m&&o!==`recording`&&e.push(n(`common.events`)),e},[d,m,o,n]),x=t(()=>new Intl.ListFormat(i.language,{type:`conjunction`}).format(y),[y,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:Ge(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 ${Ue[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`:g.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:g.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?K(e.bytesReclaimed):`—`})}],[g,n]),w=u||p;return e(`div`,{className:`flex flex-col gap-4`,children:[r(`div`,{className:`flex items-center gap-1`,children:He.map(e=>r(`button`,{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&&_.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(b,{className:`h-4 w-4 animate-spin`}),n(`recordings.activitySection.loadingActivity`,`Loading activity…`)]}):_.length===0?y.length>0?r(L,{icon:S,title:n(`recordings.activitySection.activityCouldNotBeRead`,`Activity could not be read`),description:n(`recordings.activitySection.theOpsLogDidNot`,`The {{value1}} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`,{value1:x})}):r(L,{icon:v,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:[y.length>0&&e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[r(S,{className:`h-3 w-3 shrink-0`}),n(`recordings.activitySection.domainsMissing`,{count:y.length,names:x})]}),r(E,{columns:C,rows:_,rowKey:e=>e.id,minWidthPx:720,maxBodyHeight:he,defaultSort:We})]})]})}o();function qe(){let{t:n}=G(),i=M({isCamera:!0,projection:`slim`}),o=t(()=>(i.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[i.data]),[s,c]=a(null),u=s??o[0]?.id??null;return!i.isLoading&&o.length===0?r(L,{icon:l,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(`select`,{value:u??``,onChange:e=>c(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:o.map(e=>r(`option`,{value:e.id,children:e.name},e.id))})]}),u!==null&&r(me,{deviceId:u,children:r(ke,{deviceId:u,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},u)]})}o();function q({types:n}){let{t:i}=G(),o=s(),c=x(),{data:l}=U({}),u=k(),d=t(()=>u.data??[],[u.data]),{data:f}=z({},{refetchOnWindowFocus:!1}),p=t(()=>Be(l??[],f?.locations),[l,f?.locations]),[m,h]=a(null),[g,_]=a(null),v=()=>{o.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},y=ne({onSuccess:v}),b=Ee({onSuccess:v}),S=t(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[l]),C=async(e,t)=>{Fe(t)&&!await c({title:i(`pipeline.storageLocationsPanel.disable`,`Disable "{{displayName}}"?`,{displayName:e.displayName}),message:i(`pipeline.storageLocationsPanel.nothingIsDeletedSetThe`,`{{consequence}} Nothing is deleted — set the location back to Read-only or Active to bring its footage back.`,{consequence:Ne(t).consequence}),confirmLabel:i(`common.disable`,`Disable`),variant:`danger`})||y.mutate(ze(e,{mode:t}))},w=async e=>{if(await c({title:i(`pipeline.storageLocationsPanel.deleteLocation`,`Delete location "{{displayName}}"?`,{displayName:e.displayName}),message:i(`pipeline.storageLocationsPanel.removesTheRecordFilesOn`,`Removes the record; files on disk are untouched.`),confirmLabel:i(`common.delete`,`Delete`),variant:`danger`}))try{await b.mutateAsync({id:e.id})}catch(t){await c({title:i(`pipeline.storageLocationsPanel.deleteAnyway`,`Delete anyway?`),message:i(`pipeline.storageLocationsPanel.forcingNote`,{error:t instanceof Error?t.message:String(t)}),confirmLabel:i(`pipeline.storageLocationsPanel.forceDelete`,`Force delete`),variant:`danger`})&&b.mutate({id:e.id,force:!0})}},T=n.map(e=>d.find(t=>t.id===e)).filter(e=>e!==void 0);return e(`div`,{className:`space-y-3`,children:[T.length===0?r(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:i(`pipeline.storageLocationsPanel.noStorageLocationsDeclaredFor`,`No storage locations declared for this purpose.`)}):T.map(e=>r(Ie,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:S.get(e.id)??[],onAdd:e=>h(e),onEdit:e=>_(e),onDelete:e=>{w(e)},ownedBytesById:p,onSetMode:(e,t)=>{C(e,t)}},e.id)),m!==null&&r(Ve,{initialType:m,onClose:()=>h(null),onCreated:()=>{v(),h(null)}}),g!==null&&r(Le,{location:g,onClose:()=>_(null),onSaved:()=>{v(),_(null)}})]})}o();var Je=`pipeline-analytics`;function Ye(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function Xe(){let{t:n}=G(),i=s(),{nodes:a}=H(),{data:o,isLoading:c}=B({addonId:Je}),l=Ye(o),u=I({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),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(b,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(`select`,{value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:Je,patch:{postProcessingNodeId:e.target.value}})},disabled:u.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterEventsTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(b,{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(q,{types:[`eventMedia`]})]})]})}o();var Ze=[[`pipelineAnalytics`]],Qe=1440*60*1e3;function $e(e,t){return t.get(e)??W.t(`recordings.eventsManagementSection.removedCamera`,{id:String(e)})}var et=[{days:1},{days:7},{days:30},{days:90}];function tt(){let{t:i}=G(),o=s(),c=x(),[l,u]=a(30),[f,m]=a(null),{data:h,isLoading:g}=se({},{refetchOnWindowFocus:!1}),{data:_}=M({isCamera:!0,projection:`slim`}),v=t(()=>{let e=new Map;for(let t of _??[])e.set(t.id,t.name);return e},[_]),S=n(()=>{o.invalidateQueries({queryKey:Ze})},[o]),C=le({onSuccess:S}),w=ee(),D=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]),O=n(async e=>{let t=$e(e.deviceId,v);if(await c({title:i(`recordings.eventsManagementSection.deleteAllEventsFor`,`Delete all events for {{label}}?`,{label:t}),message:i(`recordings.eventsManagementSection.deleteRowsMessage`,{count:e.rows,size:K(e.bytes)}),confirmLabel:i(`recordings.eventsManagementSection.deleteEvents`,`Delete events`),variant:`danger`})){m(null);try{let n=await w.mutateAsync({deviceId:e.deviceId});S();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){m(`0 events deleted for ${t}. Media still listed (${K(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}m(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){m(e instanceof Error?e.message:String(e))}}},[c,w,v,S,i]),k=t(()=>[{key:`camera`,header:i(`recordings.eventsManagementSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:$e(e.deviceId,v)})},{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:K(e.bytes)})},{key:`actions`,header:``,align:`right`,render:t=>e(`button`,{onClick:()=>{O(t)},disabled:w.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:i(`recordings.eventsManagementSection.deleteAllEventsForThis`,`Delete all events for this camera`),children:[r(d,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})}],[v,O,w.isPending,i]);return g&&!h?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(b,{className:`h-4 w-4 animate-spin`}),i(`recordings.eventsManagementSection.loadingEventStoreFootprint`,`Loading event-store footprint…`)]}):h?e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[r(p,{label:i(`recordings.eventsManagementSection.totalEvents`,`Total events`),icon:r(y,{className:`h-3 w-3`}),footer:`across ${String(h.devices.length)} camera${h.devices.length===1?``:`s`}`,children:h.totalRows.toLocaleString()}),r(p,{label:i(`recordings.eventsManagementSection.eventMediaOnDisk`,`Event media on disk`),children:K(h.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(`select`,{value:l,onChange:e=>u(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:et.map(e=>r(`option`,{value:e.days,children:i(`recordings.eventsManagementSection.ageDays`,{count:e.days})},e.days))}),e(`button`,{onClick:()=>{D()},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(b,{className:`h-3 w-3 animate-spin`}):r(T,{className:`h-3 w-3`}),i(`recordings.eventsManagementSection.pruneNow`,`Prune now`)]})]}),h.devices.length===0?r(L,{icon:y,title:i(`recordings.eventsManagementSection.noStoredEvents`,`No stored events`),description:i(`recordings.eventsManagementSection.noCameraHasPersistedEvents`,`No camera has persisted events yet.`)}):r(E,{columns:k,rows:[...h.devices],rowKey:e=>e.deviceId,minWidthPx:480}),f===null?null:r(`p`,{className:f.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:f})]}):r(L,{icon:y,title:i(`recordings.eventsManagementSection.noEventData`,`No event data`),description:i(`recordings.eventsManagementSection.pipelineAnalyticsHasNotReported`,`Pipeline analytics has not reported any event-store footprint yet.`)})}function nt(){let{t}=G();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(tt,{})})]}),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(Xe,{})})]})]})}function rt(e){let t=[];return e.timelapse?t.push(`timelapse ${String(e.timelapse.everyMs/1e3)}s`):(t.push(`${String(e.speed??1)}×`),e.includeAudio&&t.push(`+ audio`)),t.join(` `)}function it(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function at(e,t){let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=r>0?`${String(r)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`:`${String(i)}:${String(a).padStart(2,`0`)}`;return`${it(e)} · ${o}`}function ot(e,t){let n=e-t;if(n<=0)return W.t(`helpers.exportFormat.expired`);let r=Math.floor(n/6e4);if(r<60)return W.t(`helpers.exportFormat.inMinutes`,{n:String(r)});let i=Math.floor(r/60);return i<24?W.t(`helpers.exportFormat.inHours`,{n:String(i)}):W.t(`helpers.exportFormat.inDays`,{n:String(Math.floor(i/24))})}function st(e,t,n,r){return e.map(e=>{if(e.state===`expired`||e.state===`deleted`)return e;let i=r.get(e.id);if(i)return{...e,state:`failed`,error:i.error,progressPct:null};let a=n.get(e.id);if(a)return{...e,state:`ready`,fileBytes:a.fileBytes,progressPct:100};let o=t.get(e.id);return o&&(e.state===`queued`||e.state===`rendering`)?{...e,state:`rendering`,progressPct:o.progressPct}:e})}o();var ct=[`high`,`mid`,`low`],lt=[{value:1,labelKey:`recordings.newExportModal.speedRealTime`},{value:2,labelKey:null},{value:4,labelKey:null},{value:8,labelKey:null},{value:16,labelKey:null}],ut=10080*60*1e3;function dt(e){let t=new Date(Date.now()-e*6e4),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function ft({onClose:n,onCreated:i}){let{t:o}=G(),s=M({isCamera:!0,projection:`slim`}),c=t(()=>(s.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[s.data]),[l,d]=a(``),[f,p]=a(`high`),[m,h]=a(dt(60)),[g,_]=a(dt(0)),[v,y]=a(1),[b,x]=a(!0),[S,C]=a(``),[w,T]=a(null),E=l===``?c[0]?.id??null:l,D=new Date(m).getTime(),k=new Date(g).getTime(),A=Number.isFinite(D)&&Number.isFinite(k)&&D<k,j=pe({onSuccess:()=>{i(),n()},onError:e=>T(e instanceof Error?e.message:String(e))});return r(De,{open:!0,onOpenChange:e=>!e&&n(),children:e(Te,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(Ce,{children:e(ce,{className:`flex items-center gap-1.5`,children:[r(u,{className:`h-3.5 w-3.5`}),o(`recordings.newExportModal.newExport`,`New export`)]})}),e(fe,{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(`select`,{value:E??``,onChange:e=>d(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,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(`select`,{value:f,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:ct.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(`input`,{type:`datetime-local`,value:m,onChange:e=>h(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]}),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(`input`,{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(`select`,{value:v,onChange:e=>y(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:lt.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(`input`,{type:`text`,value:S,onChange:e=>C(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(`input`,{type:`checkbox`,checked:b,disabled:v!==1,onChange:e=>x(e.target.checked),className:`accent-primary`}),o(v===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!A&&r(`p`,{className:`text-[11px] text-danger`,children:o(`recordings.newExportModal.fromMustBeBeforeTo`,`"From" must be before "To".`)}),w&&r(`p`,{className:`text-[11px] text-danger`,children:w})]}),e(O,{children:[r(V,{variant:`outline`,size:`sm`,onClick:n,children:o(`common.cancel`,`Cancel`)}),r(V,{size:`sm`,onClick:()=>{if(E===null||!A)return;T(null);let e=S.trim();j.mutate({deviceId:E,profile:f,fromMs:D,toMs:k,options:{includeAudio:b,maxLifeMs:ut,deleteAfterDownload:!1,...v===1?{}:{speed:v},...e.length>0?{title:e}:{}}})},disabled:E===null||!A||j.isPending,children:j.isPending?o(`recordings.newExportModal.queuing`,`Queuing…`):o(`recordings.newExportModal.createExport`,`Create export`)})]})]})})}o();var pt=[[`recordingExport`]],mt={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 ht(){let{data:e,isLoading:n}=Se({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:r}=R(C.RecordingExportProgress,e=>e.exportId),{map:i}=R(C.RecordingExportCompleted,e=>e.exportId),{map:a}=R(C.RecordingExportFailed,e=>e.exportId);return{rows:t(()=>st(e??[],r,i,a),[e,r,i,a]),isLoading:n}}function gt(e){let[t,n]=a(()=>Date.now());return i(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function _t(){let{t:i}=G(),o=s(),[c,l]=a(!1),p=()=>{o.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},h=x(),_=m().trpcClient,v=gt(6e4),{rows:y,isLoading:S}=ht(),{data:C}=M({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:pt})},[o]),D=xe({onSuccess:T}),O=ve({onSuccess:T}),[k,A]=a(null),j=n(async e=>{A(e.id);try{let{url:t}=await _.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await Me(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{A(null)}},[_,T]),N=n(async e=>{await h({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`})&&D.mutate({exportId:e.id})},[h,D,i]),P=n(async e=>{await h({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`})&&O.mutate({exportId:e.id})},[h,O,i]),F=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:at(e.fromMs,e.toMs)})},{key:`variant`,header:i(`recordings.exportsSection.variant`,`Variant`),render:e=>r(`span`,{className:`text-foreground-subtle`,children:rt(e.options)})},{key:`state`,header:i(`recordings.exportsSection.state`,`State`),render:t=>{let n=mt[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(b,{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:ot(e.expiresAt,v)})},{key:`size`,header:i(`recordings.exportsSection.size`,`Size`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:K(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(`button`,{onClick:()=>{j(t)},disabled:k===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:[k===t.id?r(b,{className:`h-3 w-3 animate-spin`}):r(f,{className:`h-3 w-3`}),i(`recordings.exportsSection.download`,`Download`)]}),a&&e(`button`,{onClick:()=>{N(t)},disabled:D.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(g,{className:`h-3 w-3`}),i(`common.cancel`,`Cancel`)]}),o&&r(`button`,{onClick:()=>{P(t)},disabled:O.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(d,{className:`h-3 w-3`})})]})}}],[w,v,k,D.isPending,O.isPending,j,N,P,i]);return S&&y.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(b,{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(`button`,{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(u,{className:`h-3.5 w-3.5`}),i(`recordings.exportsSection.newExport`,`New export`)]})}),y.length===0?r(L,{icon:u,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(E,{columns:F,rows:y,rowKey:e=>e.id,minWidthPx:720}),c&&r(ft,{onClose:()=>l(!1),onCreated:p})]})}var vt=`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`;o();var yt=`storage-migration`,bt=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function xt(e){return[`${e.orphansReclaimed} orphan rows (${K(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${K(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${K(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function St(){let{t:e}=G(),t=N(yt);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(Ct,{}):null}function Ct(){let{t}=G(),n=x(),[i,o]=a(!1),[s,c]=a(null),l=_e({},{refetchInterval:2e3}),u=l.data??null,f=u!==null&&bt.has(u.phase),p=ae(),m=A(),h=async()=>{if(await n({title:t(`recordings.cleanupSection.runStorageCleanup`,`Run storage cleanup?`),message:i?t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd`,`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`):t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd2`,`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`),confirmLabel:t(`recordings.cleanupSection.runCleanup`,`Run cleanup`),variant:`danger`})){c(null);try{await p.mutateAsync({includeDebugMedia:i}),await l.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}},g=async()=>{if(u&&await n({title:t(`recordings.cleanupSection.cancelCleanup`,`Cancel cleanup?`),message:t(`recordings.cleanupSection.stopsAfterTheCurrentStep`,`Stops after the current step. Work already done stays done.`),confirmLabel:t(`recordings.cleanupSection.cancelCleanup2`,`Cancel cleanup`),variant:`danger`}))try{await m.mutateAsync({jobId:u.jobId}),await l.refetch()}catch{}};return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.cleanupSection.cleanup`,`Cleanup`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.cleanupSection.onePassOverLeftoverAnalytics`,`One pass over leftover analytics (database + files) and ghost footage rows on frozen locations. Does not time out — progress updates here until it finishes.`)}),e(`label`,{className:`mt-3 flex items-start gap-2 text-[11px] text-foreground`,children:[r(`input`,{type:`checkbox`,checked:i,disabled:f,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(`button`,{type:`button`,disabled:f||p.isPending,onClick:()=>{h()},className:vt,children:[(f||p.isPending)&&r(b,{className:`h-3 w-3 animate-spin`}),r(d,{className:`h-3 w-3`}),t(`recordings.cleanupSection.runCleanup`,`Run cleanup`)]}),f&&r(`button`,{type:`button`,onClick:()=>{g()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:t(`common.cancel`,`Cancel`)})]}),s&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:s}),u&&e(`div`,{className:`mt-3 space-y-1 rounded-md border border-border px-2.5 py-2`,children:[e(`p`,{className:`text-xs text-foreground`,children:[t(`recordings.cleanupSection.phase`,`Phase:`),` `,r(`span`,{className:`font-medium`,children:u.phase}),f&&r(b,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),u.detail&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:u.detail}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:xt(u)}),u.error&&r(`p`,{className:`text-[11px] text-danger`,children:u.error})]})]})}o();var wt=2e3;function Tt(){let{t}=G(),n=x(),a=s(),o=we(),c=ue(void 0,{refetchInterval:e=>e.state.data?.state===`running`?wt:!1}),l=c.data,u=l?.state===`running`,d=u||o.isPending;i(()=>{l?.state!==`done`||l.finishedAtMs===null||(a.invalidateQueries({queryKey:[[`recording`]]}),a.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[l?.state,l?.finishedAtMs,a]);let f=async()=>{await n({title:t(`recordings.diskReconcileSection.reconcileStorageFromDisk`,`Reconcile storage from disk?`),message:t(`recordings.diskReconcileSection.makesTheDatabaseMatchThe`,`Makes the database match the filesystem: recordings index, tracks, events and media whose files are gone. Favourited tracks without files are deleted. Snapshot-less motion/audio events are deleted. Enrolled identities stay. This cannot be undone.`),confirmLabel:t(`recordings.diskReconcileSection.reconcile`,`Reconcile`),variant:`warning`})&&(await o.mutateAsync(),await c.refetch())},p=u?l.total>0?`Reconciling ${String(l.completed)}/${String(l.total)}…`:`Reconciling…`:o.isPending?`Reconciling…`:`Reconcile from disk`;return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.diskReconcileSection.diskReconcile`,`Disk reconcile`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.diskReconcileSection.deletesDatabaseRowsWhoseFiles`,`Deletes database rows whose files are gone. Enrolled identities stay.`)}),e(`div`,{className:`mt-3 flex flex-col gap-2`,children:[e(`button`,{type:`button`,onClick:()=>void f(),disabled:d,className:`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[d?r(b,{className:`h-3.5 w-3.5 animate-spin`}):r(_,{className:`h-3.5 w-3.5`}),p]}),l?.state===`done`?e(`p`,{className:`text-[11px] text-foreground-subtle`,children:[t(`recordings.diskReconcileSection.lastRun`,`Last run:`),` `,t(`recordings.diskReconcileSection.summary`,{completed:String(l.completed),tracks:String(l.tracks),events:String(l.events),media:String(l.mediaDropped)}),l.failed.length>0?t(`recordings.diskReconcileSection.failed`,`, {{value1}} failed ({{value2}})`,{value1:String(l.failed.length),value2:l.failed.join(`, `)}):``,`.`]}):null,l?.state===`error`&&l.error!==null?e(`p`,{className:`text-[11px] text-destructive`,children:[t(`recordings.diskReconcileSection.reconcileFailed`,`Reconcile failed:`),` `,l.error]}):null]})]})}var J=1e3,Y=60*J,X=60*Y;function Z(e){return e.toLocaleString(`en-US`)}function Et(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 Dt(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?`${K(e.bytesMoved/t*J)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${Et(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${K(e.bytesMoved)} moved`,rate:a,eta:s}}function Ot(e){let t=Dt(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}o();var kt=`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`}],At=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function jt(){let{t}=G(),n=N(kt);return n===`pending`?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(b,{className:`h-4 w-4 animate-spin`}),t(`migration.storageMigrationSection.checkingWhetherStorageMigrationIs`,`Checking whether storage migration is installed…`)]}):n===`unknown`?r(L,{icon:S,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(L,{icon:w,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(Mt,{})}function Mt(){let{t:n}=G(),i=x(),{data:o}=U({}),[s,c]=a({}),[l,u]=a({}),[d,f]=a(null),[p,m]=a(null),g=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]),_=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]),v=te({},{refetchInterval:2e3}),y=v.data??null,S=y!==null&&At.has(y.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]),T=t(()=>{let e={};for(let t of Q){if(!s[t.id])continue;let n=l[t.id]??_.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s,l,_]),E=t(()=>({destinations:C??{},...T?{sources:T}:{}}),[C,T]),D=ie(E,{enabled:!1,retry:!1}),O=P(),k=j(),A=async()=>{if(!C)return;m(null);let e=await D.refetch();if(e.error){m(e.error instanceof Error?e.error.message:String(e.error));return}f(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`})){m(null);try{await O.mutateAsync(E),f(null),await v.refetch()}catch(e){m(e instanceof Error?e.message:String(e))}}},N=async()=>{if(y&&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 k.mutateAsync({jobId:y.jobId}),await v.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(w,{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=g.get(t.locationType)??[],a=_.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(`select`,{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 rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,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(`select`,{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 rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,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)})}),p&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:p}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[e(`button`,{type:`button`,onClick:()=>{A()},disabled:!C||D.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:[D.isFetching&&r(b,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.plan`,`Plan`)]}),e(`button`,{type:`button`,onClick:()=>{M()},disabled:!C||O.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:[O.isPending&&r(b,{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}`))}),y&&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(`button`,{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(h,{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:y.phase}),S&&r(b,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),y.error&&r(`p`,{className:`mt-1 text-[11px] text-danger`,children:y.error}),y.pausedParticipants.length>0&&e(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[n(`migration.storageMigrationSection.paused`,`Paused:`),` `,y.pausedParticipants.join(`, `)]}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:y.moves.map(e=>r(Nt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),r(Pt,{})]}),r(Ft,{running:S}),r(Lt,{})]})}function Nt({move:t}){let{t:n}=G(),i=t.progress===null?null:Dt(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:Ot(t.progress)})]})]})}function Pt(){let{t}=G(),{data:n}=ge({});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 Ft({running:t}){let{t:n}=G(),i=x(),o=oe({},{staleTime:1/0,refetchOnWindowFocus:!1}),s=D(),[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(`button`,{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:It(i)})]}),r(`button`,{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 It(e){if(e.items===null)return W.t(`recordings.storageMigrationSection.residueUnknown`);let t=e.items.toLocaleString(`en-US`);return e.bytes===null?W.t(`recordings.storageMigrationSection.residueRows`,{count:e.items,items:t}):W.t(`recordings.storageMigrationSection.residueSegments`,{count:e.items,items:t,size:K(e.bytes)})}function Lt(){let{t}=G(),{data:n}=re({},{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:Ot({filesMoved:t.job.filesMoved,filesTotal:t.job.filesTotal,bytesMoved:t.job.bytesMoved,startedAt:t.job.startedAt,observedAt:t.observedAt})})]},t.job.jobId))})]})}function Rt(){let{t}=G();return e(`div`,{className:`flex flex-col gap-4`,children:[r(St,{}),r(Tt,{}),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(jt,{})})]})]})}o();var zt=`recorder`;function Bt(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function Vt(){let{t:n}=G(),i=s(),{nodes:a}=H(),{data:o,isLoading:c}=B({addonId:zt}),l=Bt(o,`recordingNodeId`,`hub`),u=I({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),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(b,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(`select`,{value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:zt,patch:{recordingNodeId:e.target.value}})},disabled:u.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterRecordingTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(b,{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(q,{types:[`recordings`,`recordingsLow`]})]})]})}function Ht(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Ut(e,t){let n=Ht(e);return n.length===0?W.t(`helpers.cameraDisk.defaultRoot`):n.map(e=>t.get(e)??e).join(` + `)}function Wt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Ut(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Ht(e).includes(n));return i===void 0?null:{label:Ut(i,t),exact:!1}}o();var Gt=[[`recording`]],Kt=[{value:`retention`,labelKey:`recordings.storageSection.pruneRetention`},{value:`quota`,labelKey:`recordings.storageSection.pruneQuota`},{value:`operator`,labelKey:`recordings.storageSection.pruneOperator`}],qt={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Jt={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function Yt(e){return e==null?`—`:new Date(e).toLocaleString()}function Xt(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(` + `):W.t(`recordings.storageSection.defaultRoot`):e.root}function Zt(){let{t:i}=G(),o=s(),c=x(),[l,u]=a(`retention`),{data:f,isLoading:m}=z({},{refetchOnWindowFocus:!1}),{data:h}=M({isCamera:!0,projection:`slim`}),{data:g}=U({}),v=t(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.name);return e},[h]),y=t(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.displayName);return e},[g]),S=t(()=>{let e=g??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[g]),C=t(()=>f?.locations??[],[f?.locations]),w=t(()=>Wt(C,y,S),[C,y,S]),D=t(()=>Pe(C),[C]),O=n(()=>{o.invalidateQueries({queryKey:Gt})},[o]),k=ye({onSuccess:O}),A=be({onSuccess:O}),j=n(async e=>{await c({title:i(`recordings.storageSection.prune`,`Prune {{label}}?`,{label:v.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,v,i]),N=n(async e=>{await c({title:i(`recordings.storageSection.deleteAllFootageFor`,`Delete all footage for {{label}}?`,{label:v.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:K(e.usedBytes)}),confirmLabel:i(`recordings.storageSection.delete`,`Delete {{value1}}`,{value1:K(e.usedBytes)}),variant:`danger`})&&A.mutate({deviceId:e.deviceId})},[c,A,v,i]),P=t(()=>[{key:`camera`,header:i(`recordings.storageSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:v.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:i(`recordings.storageSection.disk`,`Disk`),nowrap:!0,render:()=>w===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`span`,{className:w.exact?`text-foreground`:`text-foreground-subtle`,title:w.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:[w.label,!w.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:K(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:Yt(e.oldestMs)})},{key:`actions`,header:``,align:`right`,render:t=>e(`div`,{className:`flex items-center justify-end gap-1`,children:[e(`button`,{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(T,{className:`h-3 w-3`}),i(`recordings.storageSection.prune2`,`Prune`)]}),e(`button`,{onClick:()=>{N(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(d,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})]})}],[v,w,j,N,k.isPending,A.isPending,i]);if(m&&!f)return e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(b,{className:`h-4 w-4 animate-spin`}),i(`recordings.storageSection.loadingStorageUsage`,`Loading storage usage…`)]});if(!f)return r(L,{icon:_,title:i(`recordings.storageSection.noStorageData`,`No storage data`),description:i(`recordings.storageSection.theRecordingNodeHasNot`,`The recording node has not reported any storage usage yet.`)});let F=f.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(p,{label:i(`recordings.storageSection.totalUsed`,`Total used`),icon:r(_,{className:`h-3 w-3`}),footer:`${String(F)} camera${F===1?``:`s`} on ${f.nodeId}`,children:K(f.totalUsedBytes)}),D!==null&&D.severity!==null&&r(p,{label:i(`recordings.storageSection.freeOnRecordingsVolumes`,`Free on recordings volumes`),icon:r(_,{className:`h-3 w-3`}),footer:`across ${String(D.knownVolumes)} volume${D.knownVolumes===1?``:`s`} of ${K(D.totalBytes)}`+(D.unknownVolumes>0?` · ${String(D.unknownVolumes)} did not report capacity`:``),children:r(`span`,{className:`tabular-nums ${Jt[D.severity]}`,children:K(D.freeBytes)})}),C.map(t=>{let n=Re(t),a=t.locationId??t.root??`default`;return r(p,{label:i(`recordings.storageSection.disk2`,`Disk: {{label}}`,{label:Xt(t,y)}),footer:n===null?`${K(t.usedBytes)} of recordings · volume capacity unknown`:`${K(n.freeBytes)} free of ${K(n.totalBytes)} · ${K(t.usedBytes)} recordings (${$(n.recordingsFraction)})`,children:n===null?r(`span`,{className:`tabular-nums`,children:K(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 ${qt[n.severity]}`,style:{width:$(n.fraction)}})}),r(`span`,{className:`tabular-nums text-xs ${Jt[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(`select`,{id:`prune-reason`,value:l,onChange:e=>{let t=Kt.find(t=>t.value===e.target.value);t&&u(t.value)},className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:Kt.map(e=>r(`option`,{value:e.value,children:i(e.labelKey)},e.value))})]}),F===0?r(L,{icon:_,title:f.devicesRead===`unavailable`?i(`recordings.storageSection.perCameraUsageUnavailable`,`Per-camera usage unavailable`):i(`recordings.storageSection.noRecordedFootage`,`No recorded footage`),description:f.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(E,{columns:P,rows:[...f.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Qt(){let{t}=G();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(Zt,{})})]}),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(Vt,{})})]})]})}function $t(){let{t:e}=G(),t=Oe(`/recordings`,{t:e,isAdmin:!0})??{icon:u,title:e(`nav.recordings`,`Recordings`)};return r(je,{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(Qt,{})},{id:`events`,label:e(`recordings.events`,`Events`),content:r(nt,{})},{id:`cameras`,label:e(`recordings.cameras`,`Cameras`),content:r(qe,{})},{id:`exports`,label:e(`recordings.export`,`Export`),content:r(_t,{})},{id:`activity`,label:e(`recordings.activity`,`Activity`),content:r(Ke,{})},{id:`management`,label:e(`recordings.management`,`Management`),content:r(Rt,{})}]})}export{$t as RecordingsPage};
@@ -1 +1 @@
1
- import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ar as n,Dr as r,Er as i,Tr as a,or as o,sr as s,wr as c}from"./client-DdGu3rlb.js";import{t as l}from"./grip-vertical-DcUn4qSJ.js";import{Jd as u,Ud as d,ri as f}from"./src-DF4f-P3R.js";import{t as p}from"./useTranslation-BJr-n0es.js";function m(){return{columns:3,rows:4,buttons:[]}}var h=e=>({status:`refused`,reason:e}),g=e=>({status:`ok`,grid:e});function _(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var v=a;function y(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 b(e){return e.groups??[]}function x(e,t){return b(e).find(e=>e.id===t)}function S(e,t){return e.buttons.filter(e=>e.groupId===t)}function C(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function w(e,t){let{groupId:n,...r}=t;for(let n of b(e))if(v(n,t))return n.frame===`divider`||!y(n,t)?`overlap`:{...r,groupId:n.id};return r}function T(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!_(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&v(e,t)))return`overlap`;let r=w(e,t);return typeof r==`string`?r:null}function E(e,t){let n=T(e,t,t.id);if(n!==null)return h(n);let r=w(e,t);return typeof r==`string`?h(r):g({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function D(e,t){return e.buttons.find(e=>e.id===t)}function O(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 ee(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(!b(e).some(e=>v(e,r))&&T(e,r,null)===null)return{row:t,col:n}}return null}function k(e,t){if(e.buttons.length>=200)return h(`outside`);let n=ee(e);if(n===null)return h(`outside`);let r=w(e,{id:O(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?h(r):g({...e,buttons:[...e.buttons,r]})}function A(e,t,n,r){let i=D(e,t);return i===void 0?h(`unknown-button`):E(e,{...i,row:n,col:r})}function te(e,t,n,r){let i=D(e,t);return i===void 0?h(`unknown-button`):A(e,t,i.row+n,i.col+r)}function ne(e,t,n,r){let i=D(e,t);return i===void 0?h(`unknown-button`):E(e,{...i,rowSpan:n,colSpan:r})}function re(e,t,n){let r=D(e,t);if(r===void 0)return h(`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 g({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function ie(e,t,n){let r=D(e,t);if(r===void 0)return h(`unknown-button`);let{shape:i,tone:a,...o}=r,s=n.shape===void 0?r.shape:n.shape??void 0,c=n.tone===void 0?r.tone:n.tone??void 0,l={...o,...s===void 0?{}:{shape:s},...c===void 0?{}:{tone:c}};return g({...e,buttons:e.buttons.map(e=>e.id===t?l:e)})}function ae(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var j=e=>e.ok?g(e.layout):h(e.reason);function oe(e,t,n,r){return j(o(e,t,{row:n,col:r}))}function se(e,t,n){return j(s(e,t,{keepButtons:n}))}function ce(e,t,n){let r=x(e,t);if(r===void 0)return h(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return g(C(e,b(e).map(e=>e.id===t?o:e)))}function M(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return h(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!_(i,e))||b(e).some(e=>!_(i,e))?h(`would-drop-buttons`):g(i)}function N(e){let t=c.safeParse(e);return t.success?t.data:null}function P(e){let t=c.safeParse(e);return t.success?t.data:m()}var F=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function I(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 L(e){return i.filter(t=>I(t)===e)}function R(e){let t=r(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function z(e){return r(e)!==null&&!n(e)}function B(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}},n=T(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>`,H={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`},U={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`},W={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`},G={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`},le={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`},ue={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`},de={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`},fe={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`},pe={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`},me={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`},he={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`},ge={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`},_e={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`},ve={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`},ye={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`},be=`app:`,K=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),q=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),J=[K(`netflix`,`Netflix`,de),K(`youtube`,`YouTube`,ve),q(`primevideo`,`Prime Video`,`prime`),q(`disneyplus`,`Disney+`,`D+`),K(`spotify`,`Spotify`,ge),K(`plex`,`Plex`,me),K(`appletv`,`Apple TV`,U),K(`dazn`,`DAZN`,G),q(`raiplay`,`RaiPlay`,`Rai`),q(`mediasetinfinity`,`Mediaset Infinity`,`MI`),K(`now`,`NOW`,fe),K(`twitch`,`Twitch`,_e),K(`max`,`Max`,ue),K(`paramountplus`,`Paramount+`,pe),K(`crunchyroll`,`Crunchyroll`,W),K(`sky`,`Sky`,he),K(`youtubemusic`,`YouTube Music`,ye),K(`applemusic`,`Apple Music`,H),K(`kodi`,`Kodi`,le)],xe=new Map(J.map(e=>[e.key,e]));function Se(e){return`${be}${e}`}function Y(e){if(!(e===void 0||!e.startsWith(`app:`)))return xe.get(e.slice(4))}function Ce(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 we=.011,Te=.91,X=2.2;function Z(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Ee(e){if(e.kind!==`glyph`)return null;let t=Ce(e.hex);return t===null?null:Z(t,we)>=X&&Z(t,Te)>=X?`#${e.hex}`:null}function De({brand:e}){if(e.mark.kind===`lettermark`)return t(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let n=Ee(e.mark);return t(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:n===null?void 0:{fill:n},children:t(`path`,{d:e.mark.path})})}function Oe(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 ke(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 Ae(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 je(e){return e===`divider`}function Q(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}}function Me(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 Ne=new Set([`red`,`green`,`yellow`,`blue`]);function Pe(e,t){return e.label??Y(e.icon)?.label??t}function Fe(e,t){return t||Y(e.icon)!==void 0?!1:e.tone===void 0||!Ne.has(e.tone)}function Ie({button:n,name:r,compact:i}){let a=u(),o=Y(n.icon),s=n.icon===void 0||o!==void 0?void 0:a(n.icon),c=Fe(n,s!==void 0)?r:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[o!==void 0&&t(De,{brand:o}),s!==void 0&&t(s,{className:`h-4 w-4`,"aria-hidden":!0}),c!==void 0&&!i&&t(`span`,{className:`max-w-full truncate text-[11px]`,children:c})]})}function $(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function Le({group:n,selected:r,dragging:i,compact:a,editable:o,onSelect:s,onPointerDown:c,onKeyDown:u}){let{t:f}=p(),m=je(n.frame),h=a?void 0:n.title;return e(`div`,{"data-testid":`remote-group-${n.id}`,"data-frame":n.frame,className:d(`relative -m-0.5 flex`,Ae(n.frame),i&&`opacity-40`,r&&`ring-2 ring-primary`),style:$(n),children:[m?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),h!==void 0&&t(`span`,{className:`truncate`,children:h}),h!==void 0&&t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):h!==void 0&&t(`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:h}),o&&t(`button`,{type:`button`,"aria-label":f(`remote.layout.groupHandle`,{name:n.title??n.componentId}),"aria-pressed":r,"data-testid":`remote-group-handle-${n.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:s,onPointerDown:c,onKeyDown:u,children:t(l,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function Re({grid:n,label:r,selectedId:i=null,onSelect:a,boundRoles:o,showEmptyCells:s=!1,compact:c=!1,gridRef:l,selectedGroupId:u=null,onSelectGroup:m,onItemPointerDown:h,onItemKeyDown:g,drag:_=null}){let{t:v}=p(),y=h!==void 0,b=_!==null,x=Me(n),S=[];if(s||b)for(let e=0;e<n.rows;e+=1)for(let t=0;t<n.columns;t+=1)(b||!x.has(`${e}:${t}`))&&S.push({row:e,col:t});let C=_?.preview??null;return e(`div`,{role:`group`,"aria-label":r,"data-testid":`remote-grid`,ref:l,className:d(`grid gap-1.5`,c?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${n.columns}, minmax(0, 1fr))`},children:[S.map(({row:e,col:n})=>t(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:d(`rounded-md border border-dashed`,b?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${n+1}`}},`e${e}:${n}`)),(n.groups??[]).map(e=>t(Le,{group:e,selected:e.id===u,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:c,editable:y,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)),n.buttons.map(e=>{let n=e.id===i,r=o===void 0||o.has(e.role),s=_?.item.kind===`button`&&_.item.id===e.id,l={kind:`button`,id:e.id},u=Pe(e,v(`remote.role.${e.role}`,R(e.role)));return t(f,{type:`button`,size:`sm`,variant:r?`secondary`:`outline`,"aria-pressed":a===void 0?void 0:n,"aria-label":u,title:u,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:d(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,c&&`px-0`,Oe(e.shape),ke(e.tone),y&&`touch-none`,s&&`opacity-40`,n&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:$(e),onClick:a===void 0?void 0:()=>a(e.id),onPointerDown:h===void 0?void 0:e=>h(l,e),onKeyDown:g===void 0?void 0:e=>g(l,e),children:t(Ie,{button:e,name:u,compact:c})},e.id)}),C!==null&&t(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":C.valid,className:d(`pointer-events-none z-30 rounded-md border-2 border-dashed`,C.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:$(Q(n,C.rect))})]})}export{ie as C,re as S,te as T,A as _,F as a,ne as b,N as c,x as d,R as f,S as g,P as h,Y as i,se as l,L as m,J as n,k as o,z as p,Se as r,B as s,Re as t,m as u,oe as v,ce as w,M as x,ae as y};
1
+ import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ar as n,Dr as r,Er as i,Tr as a,or as o,sr as s,wr as c}from"./client-F3l12jEi.js";import{t as l}from"./grip-vertical-DqjjXK1h.js";import{Jd as u,Ud as d,ri as f}from"./src-B0EA_4Ed.js";import{t as p}from"./useTranslation-BJr-n0es.js";function m(){return{columns:3,rows:4,buttons:[]}}var h=e=>({status:`refused`,reason:e}),g=e=>({status:`ok`,grid:e});function _(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var v=a;function y(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 b(e){return e.groups??[]}function x(e,t){return b(e).find(e=>e.id===t)}function S(e,t){return e.buttons.filter(e=>e.groupId===t)}function C(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function w(e,t){let{groupId:n,...r}=t;for(let n of b(e))if(v(n,t))return n.frame===`divider`||!y(n,t)?`overlap`:{...r,groupId:n.id};return r}function T(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!_(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&v(e,t)))return`overlap`;let r=w(e,t);return typeof r==`string`?r:null}function E(e,t){let n=T(e,t,t.id);if(n!==null)return h(n);let r=w(e,t);return typeof r==`string`?h(r):g({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function D(e,t){return e.buttons.find(e=>e.id===t)}function O(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 ee(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(!b(e).some(e=>v(e,r))&&T(e,r,null)===null)return{row:t,col:n}}return null}function k(e,t){if(e.buttons.length>=200)return h(`outside`);let n=ee(e);if(n===null)return h(`outside`);let r=w(e,{id:O(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?h(r):g({...e,buttons:[...e.buttons,r]})}function A(e,t,n,r){let i=D(e,t);return i===void 0?h(`unknown-button`):E(e,{...i,row:n,col:r})}function te(e,t,n,r){let i=D(e,t);return i===void 0?h(`unknown-button`):A(e,t,i.row+n,i.col+r)}function ne(e,t,n,r){let i=D(e,t);return i===void 0?h(`unknown-button`):E(e,{...i,rowSpan:n,colSpan:r})}function re(e,t,n){let r=D(e,t);if(r===void 0)return h(`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 g({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function ie(e,t,n){let r=D(e,t);if(r===void 0)return h(`unknown-button`);let{shape:i,tone:a,...o}=r,s=n.shape===void 0?r.shape:n.shape??void 0,c=n.tone===void 0?r.tone:n.tone??void 0,l={...o,...s===void 0?{}:{shape:s},...c===void 0?{}:{tone:c}};return g({...e,buttons:e.buttons.map(e=>e.id===t?l:e)})}function ae(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var j=e=>e.ok?g(e.layout):h(e.reason);function oe(e,t,n,r){return j(o(e,t,{row:n,col:r}))}function se(e,t,n){return j(s(e,t,{keepButtons:n}))}function ce(e,t,n){let r=x(e,t);if(r===void 0)return h(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return g(C(e,b(e).map(e=>e.id===t?o:e)))}function M(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return h(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!_(i,e))||b(e).some(e=>!_(i,e))?h(`would-drop-buttons`):g(i)}function N(e){let t=c.safeParse(e);return t.success?t.data:null}function P(e){let t=c.safeParse(e);return t.success?t.data:m()}var F=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function I(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 L(e){return i.filter(t=>I(t)===e)}function R(e){let t=r(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function z(e){return r(e)!==null&&!n(e)}function B(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}},n=T(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>`,H={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`},U={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`},W={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`},G={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`},le={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`},ue={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`},de={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`},fe={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`},pe={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`},me={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`},he={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`},ge={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`},_e={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`},ve={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`},ye={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`},be=`app:`,K=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),q=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),J=[K(`netflix`,`Netflix`,de),K(`youtube`,`YouTube`,ve),q(`primevideo`,`Prime Video`,`prime`),q(`disneyplus`,`Disney+`,`D+`),K(`spotify`,`Spotify`,ge),K(`plex`,`Plex`,me),K(`appletv`,`Apple TV`,U),K(`dazn`,`DAZN`,G),q(`raiplay`,`RaiPlay`,`Rai`),q(`mediasetinfinity`,`Mediaset Infinity`,`MI`),K(`now`,`NOW`,fe),K(`twitch`,`Twitch`,_e),K(`max`,`Max`,ue),K(`paramountplus`,`Paramount+`,pe),K(`crunchyroll`,`Crunchyroll`,W),K(`sky`,`Sky`,he),K(`youtubemusic`,`YouTube Music`,ye),K(`applemusic`,`Apple Music`,H),K(`kodi`,`Kodi`,le)],xe=new Map(J.map(e=>[e.key,e]));function Se(e){return`${be}${e}`}function Y(e){if(!(e===void 0||!e.startsWith(`app:`)))return xe.get(e.slice(4))}function Ce(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 we=.011,Te=.91,X=2.2;function Z(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Ee(e){if(e.kind!==`glyph`)return null;let t=Ce(e.hex);return t===null?null:Z(t,we)>=X&&Z(t,Te)>=X?`#${e.hex}`:null}function De({brand:e}){if(e.mark.kind===`lettermark`)return t(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let n=Ee(e.mark);return t(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:n===null?void 0:{fill:n},children:t(`path`,{d:e.mark.path})})}function Oe(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 ke(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 Ae(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 je(e){return e===`divider`}function Q(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}}function Me(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 Ne=new Set([`red`,`green`,`yellow`,`blue`]);function Pe(e,t){return e.label??Y(e.icon)?.label??t}function Fe(e,t){return t||Y(e.icon)!==void 0?!1:e.tone===void 0||!Ne.has(e.tone)}function Ie({button:n,name:r,compact:i}){let a=u(),o=Y(n.icon),s=n.icon===void 0||o!==void 0?void 0:a(n.icon),c=Fe(n,s!==void 0)?r:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[o!==void 0&&t(De,{brand:o}),s!==void 0&&t(s,{className:`h-4 w-4`,"aria-hidden":!0}),c!==void 0&&!i&&t(`span`,{className:`max-w-full truncate text-[11px]`,children:c})]})}function $(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function Le({group:n,selected:r,dragging:i,compact:a,editable:o,onSelect:s,onPointerDown:c,onKeyDown:u}){let{t:f}=p(),m=je(n.frame),h=a?void 0:n.title;return e(`div`,{"data-testid":`remote-group-${n.id}`,"data-frame":n.frame,className:d(`relative -m-0.5 flex`,Ae(n.frame),i&&`opacity-40`,r&&`ring-2 ring-primary`),style:$(n),children:[m?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),h!==void 0&&t(`span`,{className:`truncate`,children:h}),h!==void 0&&t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):h!==void 0&&t(`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:h}),o&&t(`button`,{type:`button`,"aria-label":f(`remote.layout.groupHandle`,{name:n.title??n.componentId}),"aria-pressed":r,"data-testid":`remote-group-handle-${n.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:s,onPointerDown:c,onKeyDown:u,children:t(l,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function Re({grid:n,label:r,selectedId:i=null,onSelect:a,boundRoles:o,showEmptyCells:s=!1,compact:c=!1,gridRef:l,selectedGroupId:u=null,onSelectGroup:m,onItemPointerDown:h,onItemKeyDown:g,drag:_=null}){let{t:v}=p(),y=h!==void 0,b=_!==null,x=Me(n),S=[];if(s||b)for(let e=0;e<n.rows;e+=1)for(let t=0;t<n.columns;t+=1)(b||!x.has(`${e}:${t}`))&&S.push({row:e,col:t});let C=_?.preview??null;return e(`div`,{role:`group`,"aria-label":r,"data-testid":`remote-grid`,ref:l,className:d(`grid gap-1.5`,c?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${n.columns}, minmax(0, 1fr))`},children:[S.map(({row:e,col:n})=>t(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:d(`rounded-md border border-dashed`,b?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${n+1}`}},`e${e}:${n}`)),(n.groups??[]).map(e=>t(Le,{group:e,selected:e.id===u,dragging:_?.item.kind===`group`&&_.item.id===e.id,compact:c,editable:y,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)),n.buttons.map(e=>{let n=e.id===i,r=o===void 0||o.has(e.role),s=_?.item.kind===`button`&&_.item.id===e.id,l={kind:`button`,id:e.id},u=Pe(e,v(`remote.role.${e.role}`,R(e.role)));return t(f,{type:`button`,size:`sm`,variant:r?`secondary`:`outline`,"aria-pressed":a===void 0?void 0:n,"aria-label":u,title:u,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:d(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,c&&`px-0`,Oe(e.shape),ke(e.tone),y&&`touch-none`,s&&`opacity-40`,n&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:$(e),onClick:a===void 0?void 0:()=>a(e.id),onPointerDown:h===void 0?void 0:e=>h(l,e),onKeyDown:g===void 0?void 0:e=>g(l,e),children:t(Ie,{button:e,name:u,compact:c})},e.id)}),C!==null&&t(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":C.valid,className:d(`pointer-events-none z-30 rounded-md border-2 border-dashed`,C.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:$(Q(n,C.rect))})]})}export{ie as C,re as S,te as T,A as _,F as a,ne as b,N as c,x as d,R as f,S as g,P as h,Y as i,se as l,L as m,J as n,k as o,z as p,Se as r,B as s,Re as t,m as u,oe as v,ce as w,M as x,ae as y};
@@ -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,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Di as c,En as l,Fn as u,Zr as d,fr as f,gt as p,ki as m,kn as h,zt as g}from"./player-overlays-DyWZd37T.js";import{Vo as _,Wo as v}from"./client-DdGu3rlb.js";import{Co as y,Fo as b,Go as x,Is as S,Ma as C,Nr as w,Pi as T,To as E,di as D,fo as O,ri as k}from"./src-DF4f-P3R.js";import{t as A}from"./useTranslation-BJr-n0es.js";import{L as j}from"./index-CyYfrxyQ.js";import{n as M,t as N}from"./BrokerEditorDialog-DsKGCg9y.js";o();var P={connected:`success`,connecting:`warning`,disconnected:`default`,"auth-failed":`danger`,unreachable:`danger`,error:`danger`};function F({kind:t,value:n,onChange:i}){let{t:o}=A(),[s,c]=a(!1),l=C({kind:t}),d=M(l.data).filter(e=>e.kind===t);return e(`div`,{className:`space-y-2`,children:[l.isLoading&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(f,{className:`h-3.5 w-3.5 animate-spin`}),` `,o(`brokers.picker.loading`)]}),l.isError&&r(w,{message:o(`brokers.picker.loadFailed`,{message:l.error instanceof Error?l.error.message:o(`common.unknownError`)})}),!l.isLoading&&!l.isError&&d.length===0&&r(`p`,{className:`rounded-lg border border-border bg-surface px-3 py-4 text-center text-xs text-foreground-subtle`,children:o(`brokers.picker.none`)}),d.map(t=>e(`button`,{type:`button`,"aria-pressed":n===t.id,onClick:()=>i(t.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${n===t.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[r(`span`,{className:`text-xs font-semibold text-foreground`,children:t.name}),r(D,{variant:P[t.status],className:`text-[10px]`,children:t.status})]},t.id)),e(k,{variant:`outline`,size:`sm`,onClick:()=>c(!0),children:[r(u,{className:`h-3.5 w-3.5`}),` `,o(`brokers.picker.createNew`)]}),s&&r(N,{kind:t,onClose:()=>c(!1),onSaved:e=>{c(!1),i(e)}})]})}o();function I({kind:t,onResolved:n,onBack:i}){let{t:o}=A(),[s,l]=a(null);return e(`div`,{className:`space-y-4`,children:[e(k,{variant:`ghost`,size:`sm`,onClick:i,children:[r(c,{className:`h-3.5 w-3.5`}),` `,o(`common.back`)]}),r(F,{kind:t,value:s,onChange:l}),r(`div`,{className:`flex justify-end pt-1`,children:r(k,{variant:`primary`,size:`sm`,disabled:s===null,onClick:()=>s!==null&&n(s),children:o(`integrations.brokerStep.useThisBroker`,`Use this broker`)})})]})}o();function L(e){return{status:e.status===`validated`||e.status===`rejected`||e.status===`inconclusive`||e.status===`unsupported`?e.status:e.success?`validated`:`rejected`,...e.error===void 0?{}:{error:e.error},...e.detail===void 0?{}:{detail:e.detail}}}var R={validated:`border-success/30 bg-success/5 text-success`,rejected:`border-danger/30 bg-danger/5 text-danger`,inconclusive:`border-warning/30 bg-warning/5 text-warning`,unsupported:`border-border bg-surface text-foreground-subtle`};function z({addonId:t,configSchema:n,canTest:i=!0,initialName:o,initialConfig:s,submitLabel:c,hideName:l=!1,onSave:u,onBack:d}){let{t:f}=A(),[p,m]=a(o??``),[h,g]=a(s??{}),[y,b]=a(null),x=S({onSuccess:e=>b(L(e)),onError:e=>b({status:`inconclusive`,error:String(e)})}),C=T(),w=!i||y?.status===`validated`,E=!l&&p.trim().length===0,D=!E&&w;return e(`div`,{className:`space-y-4`,children:[!l&&e(`div`,{children:[r(`label`,{htmlFor:`integration-name`,className:`block text-[11px] font-medium text-foreground mb-1`,children:f(`integrations.integrationName`)}),r(`input`,{id:`integration-name`,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:f(`integrations.integrationNamePlaceholder`),"aria-invalid":E,"aria-describedby":E?`integration-name-error`:void 0,className:`w-full rounded-lg border bg-surface px-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none ${E?`border-danger focus:border-danger`:`border-border focus:border-primary/50`}`}),E&&r(`p`,{id:`integration-name-error`,"data-testid":`integration-name-error`,className:`mt-1 text-xs text-danger`,children:f(`integrations.nameRequired`,`Name is required`)})]}),n&&r(j,{schema:n,values:h,onChange:e=>{g(e),b(null)},onAction:async(e,r,a)=>{let o=await C.mutateAsync({addonId:t,action:e,input:a??{}});if(i&&typeof o==`object`&&o){let e=o;if(!(typeof e.token==`string`||typeof e.sslCertificate==`string`||typeof e.host==`string`))return o;let r={...h};for(let[t,n]of Object.entries(e))typeof n==`string`&&t!==`summary`&&(r[t]=n);let i=v(n,r);g(i),b(null),x.mutate({addonId:t,settings:i})}return o}}),y&&r(`div`,{className:`rounded-lg border px-3 py-2 text-xs ${R[y.status]}`,children:(e=>{switch(e.status){case`validated`:return e.detail?`${f(`integrations.connectionSuccess`)} — ${e.detail}`:f(`integrations.connectionSuccess`);case`rejected`:return`${f(`integrations.errorPrefix`)} ${e.error??``}`;case`inconclusive`:return`${f(`integrations.connectionInconclusive`,{defaultValue:`Could not be checked:`})} ${e.error??``}`;case`unsupported`:return e.error??f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`})}})(y)}),e(`div`,{className:`flex items-center justify-between pt-2`,children:[r(`button`,{onClick:d,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:f(`integrations.back`)}),e(`div`,{className:`flex items-center gap-2`,children:[r(`button`,{onClick:()=>x.mutate({addonId:t,settings:v(n,h)}),disabled:x.isPending||!i,title:i?void 0:f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`}),className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:x.isPending?f(`integrations.testing`):f(`integrations.testConnection`)}),e(`div`,{className:`flex flex-col items-end gap-1`,children:[E&&r(`p`,{"data-testid":`integration-name-submit-error`,className:`text-xs text-danger`,children:f(`integrations.nameRequiredSubmit`,`Enter a name before continuing.`)}),r(`button`,{onClick:()=>{E||u({name:p,config:v(n,h),secretKeys:[..._(n)]})},disabled:!D,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:c??f(`integrations.forward`)})]})]})]})]})}function B(e,t){if(t.prefilledConfig.setupIntegration!==!0)return null;let n=t.prefilledConfig.host;return typeof n!=`string`||n.trim().length===0?null:{addonId:e,name:t.suggestedName,config:{host:n.trim()}}}function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function H(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;return{addonId:n,name:r,config:a}}o();function U({open:i,onClose:o,scope:s,onSetupIntegration:c}){let{t:l}=A(),u=O(),[g,_]=a(new Set),[v,y]=a(new Set),{data:x}=b({projection:`slim`}),S=t(()=>new Set((x??[]).map(e=>e.stableId)),[x]),C=n(async(e,t)=>{let n=B(e,t);if(n!==null){c?.(n),o();return}y(e=>new Set(e).add(t.stableId));try{await u.mutateAsync({addonId:e,candidate:t}),_(e=>new Set(e).add(t.stableId))}catch{}finally{y(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[u,o,c]),w=n((t,n)=>{let i=typeof n.prefilledConfig.host==`string`?n.prefilledConfig.host:null,a=S.has(n.stableId),o=g.has(n.stableId)||a,s=v.has(n.stableId);return e(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[e(`div`,{className:`min-w-0`,children:[r(`p`,{className:`truncate text-xs font-medium text-foreground`,children:n.suggestedName}),i&&r(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:i})]}),o?e(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[r(m,{className:`h-3.5 w-3.5`}),` `,a?l(`integrations.scanNetworkModal.alreadyAdded`,`Already added`):l(`integrations.scanNetworkModal.added`,`Added`)]}):e(`button`,{type:`button`,onClick:()=>void C(t,n),disabled:s,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[s?r(f,{className:`h-3.5 w-3.5 animate-spin`}):r(d,{className:`h-3.5 w-3.5`}),l(`common.add`,`Add`)]})]},n.stableId)},[g,v,S,C,l]);if(!i)return null;let T=s?`Scan network — ${s.label}`:`Scan network for devices`;return e(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[r(`div`,{className:`absolute inset-0 bg-black/60`,onClick:o}),e(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[calc(90dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl`,children:[e(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(h,{className:`h-4 w-4 text-primary`}),r(`h2`,{className:`text-sm font-semibold text-foreground`,children:T})]}),r(`button`,{onClick:o,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:r(p,{className:`h-4 w-4`})})]}),s?r(G,{scope:s,onAdopt:w,onReset:()=>_(new Set)}):r(W,{onAdopt:w,onReset:()=>_(new Set)})]})]})}function W({onAdopt:a,onReset:o}){let{t:c}=A(),u=y(),d=n(()=>{o(),u.mutate({})},[u,o]);i(()=>{!u.isPending&&!u.data&&d()},[]);let f=t(()=>(u.data?.groups??[]).filter(e=>e.candidates.length>0),[u.data]),p=t(()=>f.reduce((e,t)=>e+t.candidates.length,0),[f]);return e(s,{children:[r(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:e(`button`,{onClick:d,disabled:u.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[r(l,{className:`h-3.5 w-3.5 ${u.isPending?`animate-spin`:``}`}),c(`integrations.scanNetworkModal.reScan`,`Re-scan`)]})}),e(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[u.isPending&&r(K,{label:c(`integrations.scanNetworkModal.scanningTheLocalNetwork`,`Scanning the local network…`)}),!u.isPending&&u.isError&&r(q,{}),!u.isPending&&u.data&&f.length===0&&r(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.noDevicesRespondedToThe`,`No devices responded to the scan.`)}),!u.isPending&&f.length>0&&r(`p`,{className:`text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.found`,{count:p})}),!u.isPending&&f.map(t=>e(`div`,{className:`space-y-1.5`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),e(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(e=>a(t.addonId,e))]},t.addonId))]})]})}function G({scope:t,onAdopt:i,onReset:o}){let{t:c}=A(),l=x({addonId:t.addonId}).data??null,[u,d]=a({}),p=E(),m=n(()=>{o(),p.mutate({addonId:t.addonId,params:u})},[p,t.addonId,u,o]),g=p.data?.candidates??[];return r(s,{children:e(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[l&&r(j,{schema:l,values:u,onChange:d}),e(`button`,{onClick:m,disabled:p.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[p.isPending?r(f,{className:`h-3.5 w-3.5 animate-spin`}):r(h,{className:`h-3.5 w-3.5`}),p.isPending?c(`integrations.scanNetworkModal.scanning`,`Scanning…`):c(`integrations.scanNetworkModal.scan`,`Scan`)]}),p.isError&&r(q,{}),!p.isPending&&p.data&&g.length===0&&r(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.noDevicesRespondedToThe`,`No devices responded to the scan.`)}),!p.isPending&&g.length>0&&e(`div`,{className:`space-y-1.5`,children:[r(`p`,{className:`text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.foundShort`,{count:g.length})}),g.map(e=>i(t.addonId,e))]})]})})}function K({label:t}){return e(`div`,{className:`flex flex-col items-center py-12`,children:[r(f,{className:`h-6 w-6 animate-spin text-primary`}),r(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:t})]})}function q(){let{t}=A();return e(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[r(g,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),r(`p`,{className:`text-xs text-destructive`,children:t(`integrations.scanNetworkModal.theScanFailedTryAgain`,`The scan failed. Try again.`)})]})}export{F as a,I as i,H as n,z as r,U as t};
1
+ import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ai as c,An as l,Dn as u,In as d,Oi as f,Qr as p,gt as m,pr as h,zt as g}from"./player-overlays-DgedyCX9.js";import{Vo as _,Wo as v}from"./client-F3l12jEi.js";import{Co as y,Fo as b,Go as x,Is as S,Ma as C,Nr as w,Pi as T,To as E,di as D,fo as O,ri as k}from"./src-B0EA_4Ed.js";import{t as A}from"./useTranslation-BJr-n0es.js";import{L as j}from"./index-CQ7TjSgs.js";import{n as M,t as N}from"./BrokerEditorDialog-D9rZCGl9.js";o();var P={connected:`success`,connecting:`warning`,disconnected:`default`,"auth-failed":`danger`,unreachable:`danger`,error:`danger`};function F({kind:t,value:n,onChange:i}){let{t:o}=A(),[s,c]=a(!1),l=C({kind:t}),u=M(l.data).filter(e=>e.kind===t);return e(`div`,{className:`space-y-2`,children:[l.isLoading&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(h,{className:`h-3.5 w-3.5 animate-spin`}),` `,o(`brokers.picker.loading`)]}),l.isError&&r(w,{message:o(`brokers.picker.loadFailed`,{message:l.error instanceof Error?l.error.message:o(`common.unknownError`)})}),!l.isLoading&&!l.isError&&u.length===0&&r(`p`,{className:`rounded-lg border border-border bg-surface px-3 py-4 text-center text-xs text-foreground-subtle`,children:o(`brokers.picker.none`)}),u.map(t=>e(`button`,{type:`button`,"aria-pressed":n===t.id,onClick:()=>i(t.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${n===t.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[r(`span`,{className:`text-xs font-semibold text-foreground`,children:t.name}),r(D,{variant:P[t.status],className:`text-[10px]`,children:t.status})]},t.id)),e(k,{variant:`outline`,size:`sm`,onClick:()=>c(!0),children:[r(d,{className:`h-3.5 w-3.5`}),` `,o(`brokers.picker.createNew`)]}),s&&r(N,{kind:t,onClose:()=>c(!1),onSaved:e=>{c(!1),i(e)}})]})}o();function I({kind:t,onResolved:n,onBack:i}){let{t:o}=A(),[s,c]=a(null);return e(`div`,{className:`space-y-4`,children:[e(k,{variant:`ghost`,size:`sm`,onClick:i,children:[r(f,{className:`h-3.5 w-3.5`}),` `,o(`common.back`)]}),r(F,{kind:t,value:s,onChange:c}),r(`div`,{className:`flex justify-end pt-1`,children:r(k,{variant:`primary`,size:`sm`,disabled:s===null,onClick:()=>s!==null&&n(s),children:o(`integrations.brokerStep.useThisBroker`,`Use this broker`)})})]})}o();function L(e){return{status:e.status===`validated`||e.status===`rejected`||e.status===`inconclusive`||e.status===`unsupported`?e.status:e.success?`validated`:`rejected`,...e.error===void 0?{}:{error:e.error},...e.detail===void 0?{}:{detail:e.detail}}}var R={validated:`border-success/30 bg-success/5 text-success`,rejected:`border-danger/30 bg-danger/5 text-danger`,inconclusive:`border-warning/30 bg-warning/5 text-warning`,unsupported:`border-border bg-surface text-foreground-subtle`};function z({addonId:t,configSchema:n,canTest:i=!0,initialName:o,initialConfig:s,submitLabel:c,hideName:l=!1,onSave:u,onBack:d}){let{t:f}=A(),[p,m]=a(o??``),[h,g]=a(s??{}),[y,b]=a(null),x=S({onSuccess:e=>b(L(e)),onError:e=>b({status:`inconclusive`,error:String(e)})}),C=T(),w=!i||y?.status===`validated`,E=!l&&p.trim().length===0,D=!E&&w;return e(`div`,{className:`space-y-4`,children:[!l&&e(`div`,{children:[r(`label`,{htmlFor:`integration-name`,className:`block text-[11px] font-medium text-foreground mb-1`,children:f(`integrations.integrationName`)}),r(`input`,{id:`integration-name`,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:f(`integrations.integrationNamePlaceholder`),"aria-invalid":E,"aria-describedby":E?`integration-name-error`:void 0,className:`w-full rounded-lg border bg-surface px-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none ${E?`border-danger focus:border-danger`:`border-border focus:border-primary/50`}`}),E&&r(`p`,{id:`integration-name-error`,"data-testid":`integration-name-error`,className:`mt-1 text-xs text-danger`,children:f(`integrations.nameRequired`,`Name is required`)})]}),n&&r(j,{schema:n,values:h,onChange:e=>{g(e),b(null)},onAction:async(e,r,a)=>{let o=await C.mutateAsync({addonId:t,action:e,input:a??{}});if(i&&typeof o==`object`&&o){let e=o;if(!(typeof e.token==`string`||typeof e.sslCertificate==`string`||typeof e.host==`string`))return o;let r={...h};for(let[t,n]of Object.entries(e))typeof n==`string`&&t!==`summary`&&(r[t]=n);let i=v(n,r);g(i),b(null),x.mutate({addonId:t,settings:i})}return o}}),y&&r(`div`,{className:`rounded-lg border px-3 py-2 text-xs ${R[y.status]}`,children:(e=>{switch(e.status){case`validated`:return e.detail?`${f(`integrations.connectionSuccess`)} — ${e.detail}`:f(`integrations.connectionSuccess`);case`rejected`:return`${f(`integrations.errorPrefix`)} ${e.error??``}`;case`inconclusive`:return`${f(`integrations.connectionInconclusive`,{defaultValue:`Could not be checked:`})} ${e.error??``}`;case`unsupported`:return e.error??f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`})}})(y)}),e(`div`,{className:`flex items-center justify-between pt-2`,children:[r(`button`,{onClick:d,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:f(`integrations.back`)}),e(`div`,{className:`flex items-center gap-2`,children:[r(`button`,{onClick:()=>x.mutate({addonId:t,settings:v(n,h)}),disabled:x.isPending||!i,title:i?void 0:f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`}),className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:x.isPending?f(`integrations.testing`):f(`integrations.testConnection`)}),e(`div`,{className:`flex flex-col items-end gap-1`,children:[E&&r(`p`,{"data-testid":`integration-name-submit-error`,className:`text-xs text-danger`,children:f(`integrations.nameRequiredSubmit`,`Enter a name before continuing.`)}),r(`button`,{onClick:()=>{E||u({name:p,config:v(n,h),secretKeys:[..._(n)]})},disabled:!D,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:c??f(`integrations.forward`)})]})]})]})]})}function B(e,t){if(t.prefilledConfig.setupIntegration!==!0)return null;let n=t.prefilledConfig.host;return typeof n!=`string`||n.trim().length===0?null:{addonId:e,name:t.suggestedName,config:{host:n.trim()}}}function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function H(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;return{addonId:n,name:r,config:a}}o();function U({open:i,onClose:o,scope:s,onSetupIntegration:u}){let{t:d}=A(),f=O(),[g,_]=a(new Set),[v,y]=a(new Set),{data:x}=b({projection:`slim`}),S=t(()=>new Set((x??[]).map(e=>e.stableId)),[x]),C=n(async(e,t)=>{let n=B(e,t);if(n!==null){u?.(n),o();return}y(e=>new Set(e).add(t.stableId));try{await f.mutateAsync({addonId:e,candidate:t}),_(e=>new Set(e).add(t.stableId))}catch{}finally{y(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[f,o,u]),w=n((t,n)=>{let i=typeof n.prefilledConfig.host==`string`?n.prefilledConfig.host:null,a=S.has(n.stableId),o=g.has(n.stableId)||a,s=v.has(n.stableId);return e(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[e(`div`,{className:`min-w-0`,children:[r(`p`,{className:`truncate text-xs font-medium text-foreground`,children:n.suggestedName}),i&&r(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:i})]}),o?e(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[r(c,{className:`h-3.5 w-3.5`}),` `,a?d(`integrations.scanNetworkModal.alreadyAdded`,`Already added`):d(`integrations.scanNetworkModal.added`,`Added`)]}):e(`button`,{type:`button`,onClick:()=>void C(t,n),disabled:s,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[s?r(h,{className:`h-3.5 w-3.5 animate-spin`}):r(p,{className:`h-3.5 w-3.5`}),d(`common.add`,`Add`)]})]},n.stableId)},[g,v,S,C,d]);if(!i)return null;let T=s?`Scan network — ${s.label}`:`Scan network for devices`;return e(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[r(`div`,{className:`absolute inset-0 bg-black/60`,onClick:o}),e(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[calc(90dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl`,children:[e(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(l,{className:`h-4 w-4 text-primary`}),r(`h2`,{className:`text-sm font-semibold text-foreground`,children:T})]}),r(`button`,{onClick:o,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:r(m,{className:`h-4 w-4`})})]}),s?r(G,{scope:s,onAdopt:w,onReset:()=>_(new Set)}):r(W,{onAdopt:w,onReset:()=>_(new Set)})]})]})}function W({onAdopt:a,onReset:o}){let{t:c}=A(),l=y(),d=n(()=>{o(),l.mutate({})},[l,o]);i(()=>{!l.isPending&&!l.data&&d()},[]);let f=t(()=>(l.data?.groups??[]).filter(e=>e.candidates.length>0),[l.data]),p=t(()=>f.reduce((e,t)=>e+t.candidates.length,0),[f]);return e(s,{children:[r(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:e(`button`,{onClick:d,disabled:l.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[r(u,{className:`h-3.5 w-3.5 ${l.isPending?`animate-spin`:``}`}),c(`integrations.scanNetworkModal.reScan`,`Re-scan`)]})}),e(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[l.isPending&&r(K,{label:c(`integrations.scanNetworkModal.scanningTheLocalNetwork`,`Scanning the local network…`)}),!l.isPending&&l.isError&&r(q,{}),!l.isPending&&l.data&&f.length===0&&r(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.noDevicesRespondedToThe`,`No devices responded to the scan.`)}),!l.isPending&&f.length>0&&r(`p`,{className:`text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.found`,{count:p})}),!l.isPending&&f.map(t=>e(`div`,{className:`space-y-1.5`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),e(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(e=>a(t.addonId,e))]},t.addonId))]})]})}function G({scope:t,onAdopt:i,onReset:o}){let{t:c}=A(),u=x({addonId:t.addonId}).data??null,[d,f]=a({}),p=E(),m=n(()=>{o(),p.mutate({addonId:t.addonId,params:d})},[p,t.addonId,d,o]),g=p.data?.candidates??[];return r(s,{children:e(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[u&&r(j,{schema:u,values:d,onChange:f}),e(`button`,{onClick:m,disabled:p.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[p.isPending?r(h,{className:`h-3.5 w-3.5 animate-spin`}):r(l,{className:`h-3.5 w-3.5`}),p.isPending?c(`integrations.scanNetworkModal.scanning`,`Scanning…`):c(`integrations.scanNetworkModal.scan`,`Scan`)]}),p.isError&&r(q,{}),!p.isPending&&p.data&&g.length===0&&r(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.noDevicesRespondedToThe`,`No devices responded to the scan.`)}),!p.isPending&&g.length>0&&e(`div`,{className:`space-y-1.5`,children:[r(`p`,{className:`text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.foundShort`,{count:g.length})}),g.map(e=>i(t.addonId,e))]})]})})}function K({label:t}){return e(`div`,{className:`flex flex-col items-center py-12`,children:[r(h,{className:`h-6 w-6 animate-spin text-primary`}),r(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:t})]})}function q(){let{t}=A();return e(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[r(g,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),r(`p`,{className:`text-xs text-destructive`,children:t(`integrations.scanNetworkModal.theScanFailedTryAgain`,`The scan failed. Try again.`)})]})}export{F as a,I as i,H as n,z as r,U as t};