File: //opt/netdata/usr/local/local/share/netdata/web/v3/8707.da311907875fb144a4e2.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"b06348a4787b660201b18f5fa878e4faccd4b679"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eebdb550-4648-4de7-b6ad-dffbce22ec04",e._sentryDebugIdIdentifier="sentry-dbid-eebdb550-4648-4de7-b6ad-dffbce22ec04")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[8707],{68453(e,t,n){n.d(t,{A:()=>re});var o=n(96540),r=n(38429);const s={snapshot:null,index:0,elapsedMs:0,totalMs:0,paused:!1,transitioning:!1,loopCount:0},a="HYDRATE",i="REHYDRATE",l="TICK",d="PAUSE",c="RESUME",u="NEXT",p="PREV",h="JUMP",x="DISMISS",m=e=>({type:a,snapshot:e}),f=e=>({type:i,snapshot:e}),g=e=>({type:l,elapsedMs:e}),y=()=>({type:d}),w=()=>({type:c}),b=()=>({type:u}),v=()=>({type:p}),M=e=>({type:h,index:e}),I=()=>({type:x}),C=(e,t)=>e?.entries?.[t]?.durationMs??0,j=(e,t)=>{switch(t.type){case a:return{...s,snapshot:t.snapshot,totalMs:C(t.snapshot,0)};case i:{const n=t.snapshot,o=n?.entries||[],r=Math.min(e.index,Math.max(0,o.length-1)),s=o[r]?.id===e.snapshot?.entries?.[e.index]?.id;return{...e,snapshot:n,index:r,elapsedMs:s?e.elapsedMs:0,totalMs:C(n,r)}}case l:return e.paused?e:t.elapsedMs>=e.totalMs?j(e,b()):{...e,elapsedMs:t.elapsedMs};case d:return{...e,paused:!0};case c:return{...e,paused:!1};case u:{const t=(e.snapshot?.entries||[]).length-1;if(e.index<t){const t=e.index+1;return{...e,index:t,elapsedMs:0,totalMs:C(e.snapshot,t)}}return e.snapshot?.loop?{...e,index:0,elapsedMs:0,totalMs:C(e.snapshot,0),loopCount:e.loopCount+1}:{...e,paused:!0}}case p:{const t=Math.max(0,e.index-1);return{...e,index:t,elapsedMs:0,totalMs:C(e.snapshot,t)}}case h:{const n=e.snapshot?.entries||[],o=Math.max(0,n.length-1),r=Math.min(Math.max(0,t.index),o);return{...e,index:r,elapsedMs:0,totalMs:C(e.snapshot,r)}}case x:return{...s};default:return e}},k=j;var T=n(54148);var E=n(96957),F=n(94567),S=n(63474),_=n(45706),R=n(87398),N=(n(98992),n(3949),n(74848));const A=e=>{let{active:t,durationMs:n,scrollSpeed:s,children:a}=e;const i=(0,o.useRef)(null);return(0,o.useEffect)(()=>{if(!t||!i.current)return;let e=!1,o=0,r=null,a="";const l=[],d=()=>{if(e)return;const t=i.current?.querySelector('[data-testid="dashboardGrid"]');if(!t)return void(o=requestAnimationFrame(d));const c=t.scrollHeight-t.clientHeight;if(c<=0)return void(o=requestAnimationFrame(d));r=t,a=t.style.overflow,t.style.overflow="hidden",t.scrollTop=0;const u=s?c/s*1e3:n;Array.from(t.children).forEach(e=>{const t=e.animate([{transform:"translateY(0)"},{transform:`translateY(-${c}px)`}],{duration:u,easing:"linear",fill:"forwards"});l.push(t)})};return o=requestAnimationFrame(d),()=>{e=!0,cancelAnimationFrame(o),l.forEach(e=>e.cancel()),r&&(r.style.overflow=a)}},[t,n,s]),(0,N.jsx)(r.Flex,{ref:i,flex:"1",width:"100%",height:"100%",overflow:"hidden",position:"relative",children:a})},$=e=>{let{dashboardId:t,spaceId:n,roomId:s,entry:a,active:i,durationMs:l}=e;const d=(0,_.A)(t,{spaceId:n,roomId:s,skipIfLoaded:!0}),c=(0,R.eg)();return(0,o.useEffect)(()=>{if(!i||!a?.timeRange)return;const e=c?.getRoot?.();e?.moveX&&e.moveX(a.timeRange.after/1e3,a.timeRange.before/1e3)},[i,a?.timeRange?.after,a?.timeRange?.before,c]),d?(0,N.jsx)(r.Flex,{"data-testid":"entry-loading",column:!0,flex:"1",width:"100%",height:"100%",children:(0,N.jsx)(S.O2,{})}):"scroll"===a?.mode?(0,N.jsx)(A,{active:i,durationMs:l,scrollSpeed:a?.scrollSpeed,children:(0,N.jsx)(F.J,{id:t,roomId:s,isOnTV:!0})}):(0,N.jsx)(r.Flex,{flex:"1",width:"100%",height:"100%",overflow:"hidden",position:"relative",children:(0,N.jsx)(F.J,{id:t,roomId:s,isOnTV:!0})})};var L=n(882);const B=(0,L.default)(r.Text).withConfig({displayName:"titleCard__Eyebrow",componentId:"sc-1c91sxd-0"})(["font-size:24px;letter-spacing:4px;text-transform:uppercase;color:",";"],(0,r.getColor)("textLite")),P=(0,L.default)(r.Text).withConfig({displayName:"titleCard__Title",componentId:"sc-1c91sxd-1"})(["font-size:clamp(64px,10vw,160px);font-weight:700;line-height:1.05;text-align:center;color:",";"],(0,r.getColor)("text")),D=(0,L.default)(r.Text).withConfig({displayName:"titleCard__Counter",componentId:"sc-1c91sxd-2"})(["font-size:20px;color:",";"],(0,r.getColor)("textLite")),z=e=>{let{index:t,total:n,upNext:o}=e;return(0,N.jsxs)(r.Flex,{flex:"1",width:"100%",height:"100%",column:!0,alignItems:"center",justifyContent:"center",gap:4,padding:[4,6],background:"mainBackground",children:[(0,N.jsx)(B,{children:"Up next"}),(0,N.jsx)(P,{children:o}),(0,N.jsxs)(D,{children:[t+1," of ",n]})]})},q=T.r$.fade,H=T.r$.titleCard/3,O=(0,L.keyframes)(["from{opacity:0}to{opacity:1}"]),U=(0,L.keyframes)(["from{opacity:1}to{opacity:0}"]),K=(0,L.default)(r.Flex).attrs({position:"absolute",top:"0",left:"0",width:"100%",height:"100%"}).withConfig({displayName:"transition__Layer",componentId:"sc-167y0wu-0"})(["animation:"," ","ms ease-out forwards;"],e=>"in"===e.state?O:U,e=>e.duration||q),V=(0,L.default)(r.Flex).attrs({position:"absolute",top:"0",left:"0",width:"100%",height:"100%",zIndex:10}).withConfig({displayName:"transition__TitleCardLayer",componentId:"sc-167y0wu-1"})(["animation:"," ","ms ease-out forwards;opacity:0;"],O,H),X=(0,L.default)(r.Flex).attrs({position:"relative",flex:"1",width:"100%",height:"100%"}).withConfig({displayName:"transition__Stack",componentId:"sc-167y0wu-2"})([""]),Y=e=>{let{kind:t,index:n,total:r,transitioning:s,incoming:a,outgoing:i,incomingKey:l,outgoingKey:d,upNext:c}=e;const[u,p]=(0,o.useState)("incoming");if((0,o.useEffect)(()=>{if("titleCard"!==t||!s)return void p("incoming");p("outgoing");const e=window.setTimeout(()=>p("hold"),H),n=window.setTimeout(()=>p("incoming"),2*H);return()=>{window.clearTimeout(e),window.clearTimeout(n)}},[t,s,l]),"cut"===t)return(0,N.jsx)(X,{children:a});if("titleCard"===t){const e=s&&"outgoing"===u,t=s&&("outgoing"===u||"hold"===u),o=!s||"incoming"===u;return(0,N.jsxs)(X,{children:[e&&i&&(0,N.jsx)(K,{state:"out",duration:H,children:i},d),t&&(0,N.jsx)(V,{children:(0,N.jsx)(z,{index:n,total:r,upNext:c})},`title-${l}`),o&&(0,N.jsx)(K,{state:"in",duration:H,children:a},l)]})}return(0,N.jsxs)(X,{children:[s&&i&&(0,N.jsx)(K,{state:"out",children:i},d),(0,N.jsx)(K,{state:"in",children:a},l)]})};var J=n(80221);const Z="netdataPlaylistPinNext",G=(0,L.default)(r.Flex).attrs({position:"absolute",top:3,left:"50%",gap:2,padding:[1,2],alignItems:"center",background:"tooltip",round:2,border:{side:"all",color:"border"},zIndex:5}).withConfig({displayName:"hud__Ambient",componentId:"sc-1y5tk1w-0"})(["transform:translateX(-50%);backdrop-filter:blur(8px);opacity:",";transition:opacity 200ms ease;pointer-events:",";"],e=>e.visible?1:0,e=>e.visible?"auto":"none"),W=(0,L.default)(r.Flex).attrs({position:"absolute",bottom:3,left:"50%",gap:2,padding:[2,3],alignItems:"center",background:"tooltip",round:2,border:{side:"all",color:"border"},zIndex:10}).withConfig({displayName:"hud__Controls",componentId:"sc-1y5tk1w-1"})(["transform:translateX(-50%);backdrop-filter:blur(8px);opacity:",";transition:opacity 200ms ease;pointer-events:",";"],e=>e.visible?1:0,e=>e.visible?"auto":"none"),Q=(0,L.default)(r.Box).attrs({width:"1px",height:"16px",background:"separator"}).withConfig({displayName:"hud__Divider",componentId:"sc-1y5tk1w-2"})([""]),ee=()=>{try{return"true"===localStorage.getItem(Z)}catch{return!1}},te=e=>{let{playlistName:t,currentDashboardName:n,currentTimeRange:s,index:a,total:i,elapsedMs:l,totalMs:d,paused:c,nextDashboardName:u,remainingMs:p,onTogglePause:h,onNext:x,onPrev:m,onClose:f,onToggleFullscreen:g,showClose:y,showFullscreen:w}=e;const[b,v]=(0,o.useState)(!1),[M,I]=(0,o.useState)(ee),C=(0,o.useRef)(0);(0,o.useEffect)(()=>{const e=()=>{v(!0),window.clearTimeout(C.current),C.current=window.setTimeout(()=>v(!1),3e3)};return window.addEventListener("mousemove",e),window.addEventListener("keydown",e),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("keydown",e),window.clearTimeout(C.current)}},[]);const j=d>0?Math.min(100,l/d*100):0,k=Math.max(0,Math.round((p??0)/1e3)),T=b||M,E=Boolean(u)&&i>1;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(G,{visible:T,children:[(0,N.jsx)(r.Text,{color:"text",whiteSpace:"nowrap",children:t}),n&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(r.TextSmall,{color:"textLite",whiteSpace:"nowrap",children:"\xb7"}),(0,N.jsx)(r.Text,{color:"text",whiteSpace:"nowrap",children:n})]}),(0,J.I)(s)&&(0,N.jsxs)(r.TextSmall,{color:"textLite",whiteSpace:"nowrap",children:["\xb7 ",(0,J.j)(s)]}),(0,N.jsxs)(r.TextSmall,{color:"textLite",whiteSpace:"nowrap",children:["\xb7 ",a+1," / ",i]}),(0,N.jsx)(r.Box,{width:"160px",height:"2px",background:"separator",round:!0,overflow:"hidden",flex:!1,children:(0,N.jsx)(r.Box,{width:`${j}%`,height:"100%",background:"primary"})}),E&&(0,N.jsx)(r.Collapsible,{open:M,direction:"horizontal",overflow:"hidden",children:(0,N.jsxs)(r.Flex,{gap:2,alignItems:"center",padding:[0,0,0,1],flex:!1,children:[(0,N.jsx)(Q,{}),(0,N.jsx)(r.TextSmall,{color:"textLite",whiteSpace:"nowrap",children:"Up next"}),(0,N.jsx)(r.Text,{color:"text",whiteSpace:"nowrap",children:u}),(0,N.jsxs)(r.TextSmall,{color:"textLite",whiteSpace:"nowrap",children:["\xb7 ",k,"s"]})]})}),E&&(0,N.jsx)(r.Collapsible,{open:b,direction:"horizontal",overflow:"hidden",children:(0,N.jsx)(r.IconButton,{icon:"pin_element",width:"10px",height:"10px",padding:[.5],flavour:M?"default":"borderless",tooltip:M?"Unpin up-next":"Pin up-next",onClick:()=>{const e=!M;I(e);try{localStorage.setItem(Z,String(e))}catch{}}})})]}),(0,N.jsxs)(W,{visible:b,"data-testid":"playback-controls",children:[(0,N.jsx)(r.IconButton,{icon:"chevron_left",onClick:m,tooltip:"Previous"}),(0,N.jsx)(r.IconButton,{icon:c?"play_solid":"pause_solid",onClick:h,tooltip:c?"Play":"Pause"}),(0,N.jsx)(r.IconButton,{icon:"chevron_right",onClick:x,tooltip:"Next"}),w&&(0,N.jsx)(r.IconButton,{icon:"expand",onClick:g,tooltip:"Fullscreen"}),y&&(0,N.jsx)(r.IconButton,{icon:"x",onClick:f,tooltip:"Close"})]})]})},ne=e=>{let{onClose:t}=e;return(0,N.jsxs)(r.Flex,{flex:"1",column:!0,alignItems:"center",justifyContent:"center",gap:3,background:"mainBackground",children:[(0,N.jsx)(r.H3,{children:"Playlist is no longer available"}),(0,N.jsx)(r.Text,{children:"The playlist you were viewing was deleted or cannot be loaded."}),t&&(0,N.jsx)(r.Button,{onClick:t,children:"Close"})]})},oe=e=>e?.timeRange?`${e.timeRange.after}:${e.timeRange.before}`:"default",re=e=>{let{playlist:t,spaceId:n,roomId:a,mode:i,onClose:l,onLoopAdvance:d}=e;const{state:c,pause:u,resume:p,next:h,prev:x,rehydrate:C}=(e=>{const[t,n]=(0,o.useReducer)(k,s),r=(0,o.useRef)(0),a=(0,o.useRef)(0),i=(0,o.useRef)(0),l=(0,o.useRef)(null);(0,o.useEffect)(()=>{e&&(n(m(e)),r.current=performance.now(),a.current=0,l.current=null)},[e?.playlistId]),(0,o.useEffect)(()=>{const e=t=>{const o=t-r.current-a.current;n(g(Math.max(0,Math.floor(o)))),i.current=requestAnimationFrame(e)};return i.current=requestAnimationFrame(e),()=>cancelAnimationFrame(i.current)},[t.index,t.paused,t.snapshot?.playlistId,t.loopCount]),(0,o.useEffect)(()=>{const e=null!==l.current&&l.current!==t.index;l.current=t.index;const n=e&&T.r$[t.snapshot?.transition]||0;r.current=performance.now()+n,a.current=0},[t.index,t.loopCount]);const d=(0,o.useCallback)(()=>{a.current+=performance.now()-r.current-t.elapsedMs,n(y())},[t.elapsedMs]),c=(0,o.useCallback)(()=>{r.current=performance.now()-t.elapsedMs,a.current=0,n(w())},[t.elapsedMs]),u=(0,o.useCallback)(()=>n(b()),[]),p=(0,o.useCallback)(()=>n(v()),[]),h=(0,o.useCallback)(e=>n(M(e)),[]),x=(0,o.useCallback)(e=>n(f(e)),[]),C=(0,o.useCallback)(()=>n(I()),[]);return{state:t,dispatch:n,pause:d,resume:c,next:u,prev:p,jump:h,rehydrate:x,dismiss:C}})(t),[j,F]=(0,o.useState)(!1),[S,_]=(0,o.useState)(null),R=(0,o.useRef)(null),A=c.snapshot,L=A?.entries||[],B=L[c.index],P=(c.index+1)%Math.max(L.length,1),D=L[P],z=(0,E.fz)(B?.dashboardId),q=(0,E.fz)(D?.dashboardId);(0,o.useEffect)(()=>{c.loopCount>0&&t&&C(t)},[c.loopCount]),(0,o.useEffect)(()=>{c.loopCount>0&&d?.(c.loopCount)},[c.loopCount,d]),(0,o.useEffect)(()=>{if(!A)return;const e=R.current;if(R.current=c.index,null===e||e===c.index)return;const t=A.entries?.[e];if(!t)return;_(t),F(!0);const n=T.r$[A.transition]||0,o=window.setTimeout(()=>{F(!1),_(null)},n);return()=>window.clearTimeout(o)},[c.index,c.loopCount,A]);const H=(0,o.useMemo)(()=>!(!B||!D||L.length<2)&&(!(c.totalMs-c.elapsedMs>T.Oy)&&oe(B)===oe(D)),[B,D,L.length,c.totalMs,c.elapsedMs]);if((e=>{let{togglePause:t,next:n,prev:r,toggleFullscreen:s,onEsc:a}=e;(0,o.useEffect)(()=>{const e=e=>{" "===e.key||"Space"===e.code?(t?.(),e.preventDefault()):"ArrowRight"===e.key?n?.():"ArrowLeft"===e.key?r?.():"f"===e.key||"F"===e.key?s?.():"Escape"===e.key&&a?.()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,n,r,s,a])})({togglePause:()=>c.paused?p():u(),next:h,prev:x,toggleFullscreen:()=>{"layer"===i&&(document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen())},onEsc:"layer"===i?l:()=>C(t)}),!t&&!A)return(0,N.jsx)(ne,{onClose:l});if(0===L.length)return(0,N.jsx)(r.Flex,{flex:"1",alignItems:"center",justifyContent:"center",children:"Add dashboards to play this playlist."});const O=(0,N.jsx)($,{dashboardId:B.dashboardId,spaceId:n,roomId:a,entry:B,active:!0,durationMs:B.durationMs},`entry-${c.index}`),U=S?(0,N.jsx)($,{dashboardId:S.dashboardId,spaceId:n,roomId:a,entry:S,active:!1,durationMs:S.durationMs},`outgoing-${S.id}`):null,K=H?(0,N.jsx)($,{dashboardId:D.dashboardId,spaceId:n,roomId:a,entry:D,active:!1,durationMs:D.durationMs},`prefetch-${P}`):null;return(0,N.jsxs)(r.Flex,{flex:"1",width:"100%",height:"100%",position:"relative",background:"mainBackground",children:[K&&(0,N.jsx)(r.Flex,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",style:{visibility:"hidden"},children:K}),(0,N.jsx)(Y,{kind:A.transition,index:c.index,total:L.length,transitioning:j,incoming:O,outgoing:U,incomingKey:`layer-${B.dashboardId}-${c.index}`,outgoingKey:S?`layer-out-${S.dashboardId}-${S.id}`:null,upNext:z?.name||B.dashboardId}),(0,N.jsx)(te,{playlistName:A.name,currentDashboardName:z?.name||B?.dashboardId,currentTimeRange:B?.timeRange,index:c.index,total:L.length,elapsedMs:c.elapsedMs,totalMs:c.totalMs,paused:c.paused,nextDashboardName:q?.name||D?.dashboardId,remainingMs:Math.max(0,c.totalMs-c.elapsedMs),onTogglePause:()=>c.paused?p():u(),onNext:h,onPrev:x,onClose:"layer"===i?l:void 0,onToggleFullscreen:"layer"===i?()=>document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen():void 0,showClose:"layer"===i,showFullscreen:"layer"===i})]})}},54148(e,t,n){n.d(t,{Bb:()=>a,CA:()=>s,Ez:()=>l,HR:()=>x,Oy:()=>h,Zg:()=>o,hO:()=>d,iH:()=>u,lR:()=>i,r$:()=>p,sV:()=>c,w0:()=>r});const o="dashboards",r="playlist",s="room",a="/",i=4e4,l="fade",d="static",c={after:-9e5,before:0},u=["cut","fade","titleCard"],p={cut:0,fade:1500,titleCard:2400},h=2e3,x=e=>`TV Mode - Playlist ${e}`},591(e,t,n){n.d(t,{W9:()=>d,ng:()=>l,yp:()=>c});n(98992),n(54520),n(72577),n(81454);var o=n(96540),r=n(49163),s=n(54148);const a=e=>{if(!e)return null;const{id:t,name:n,value:o={},scope:r,type:s,entity:a,path:i,roomID:l,version:d}=e;return{playlistId:t,name:n,entries:o.entries||[],transition:o.transition||"fade",loop:!1!==o.loop,createdAt:o.createdAt,updatedAt:o.updatedAt,raw:{scope:r,type:s,entity:a,path:i,roomID:l,version:d}}},i=()=>(0,r._)({params:{type:[s.Zg],entity:[s.w0]}}),l=()=>{const e=i();return(0,o.useMemo)(()=>e.map(a).filter(Boolean),[e])},d=e=>{const t=i();return(0,o.useMemo)(()=>{const n=t.find(t=>t.id===e);return n?a(n):null},[t,e])},c=e=>{const t=i();return(0,o.useMemo)(()=>t.find(t=>t.id===e)||null,[t,e])}},80221(e,t,n){n.d(t,{I:()=>a,j:()=>s});const o=36e5,r=864e5,s=e=>{if(!e)return"default";const t=Math.abs(e.after);return t<o?`${Math.round(t/6e4)}m`:t<r?`${Math.round(t/o)}h`:`${Math.round(t/r)}d`},a=e=>Boolean(e)&&(0!==e.after||0!==e.before)}}]);