(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5301:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(5075)}])},5741:function(e,r,n){"use strict";var t=n(5893),o=n(1714),i=n(122),c=n(7169),a=n(4690);function s(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function u(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}r.Z=function(e){var r=e.children,n=e.sx,s=l(e,["children","sx"]);return(0,t.jsx)(i.Z,u({underline:"hover",variant:"subtitle1"},s,{sx:u({color:c.lD,textDecorationColor:c.s7},n),children:(0,t.jsxs)(a.Z,{row:!0,children:[r,(0,t.jsx)(o.Z,{sx:{marginLeft:".3em"}})]})}))}},5075:function(e,r,n){"use strict";n.r(r);var t=n(5893),o=n(9008),i=n(1163),c=n(7294),a=n(7357),s=n(7720),u=n(2428),l=n(2029),f=n(7169),v=n(5094),d=n(1200),h=n(5521),m=n(1706),p=n(5741),b=n(9),x=n(3679),y=n(1905),g=n(4968),j=n(2152),w=n(9370);function O(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n *":{width:{xs:"20em",md:"24em"}},"& > :not(:last-child)":{marginRight:"2em"}},children:e.map((function(e){var n=e.anvilName,o=e.anvilUUID,i=e.isScreenshotStale,c=e.loading,a=e.screenshot,s=e.serverName,u=e.serverState,l=e.serverUUID,f=e.timestamp;return(0,t.jsx)(v.M,{externalPreview:a,externalTimestamp:f,headerEndAdornment:[(0,t.jsx)(p.Z,{href:"/server?uuid=".concat(l,"&server_name=").concat(s,"&server_state=").concat(u),children:s},"server_list_to_server_".concat(l)),(0,t.jsx)(p.Z,{href:"/anvil?anvil_uuid=".concat(o),sx:{opacity:.7},children:n},"server_list_server_".concat(l,"_to_anvil_").concat(o))],isExternalLoading:c,isExternalPreviewStale:i,isFetchPreview:!1,isShowControls:!1,isUseInnerPanel:!0,onClickPreview:function(){r.push("/server?uuid=".concat(l,"&server_name=").concat(s,"&server_state=").concat(u,"&vnc=1"))},serverState:u,serverUUID:l},"server-preview-".concat(l))}))})},E=function(e,r){return""===r?{exclude:e,include:[]}:e.reduce((function(e,n){return n.serverName.includes(r)?e.include.push(n):e.exclude.push(n),e}),{exclude:[],include:[]})};r.default=function(){var e=(0,c.useRef)(!0),r=(0,i.useRouter)(),n=(0,c.useState)([]),v=n[0],p=n[1],O=(0,c.useState)([]),S=O[0],U=O[1],D=(0,c.useState)([]),I=D[0],k=D[1],C=(0,c.useState)(""),A=C[0],N=C[1],R=(0,c.useState)(!1),T=R[0],L=R[1],F=function(){for(var r=arguments.length,n=new Array(r),t=0;t0&&void 0!==arguments[0]?arguments[0]:[],n=r.map((function(r){var t,o=r.serverUUID,i=_({},r,{loading:!0,screenshot:(null===(t=v.find((function(e){return e.serverUUID===o})))||void 0===t?void 0:t.screenshot)||"",timestamp:0});return(0,d.Z)("".concat(l.Z,"/server/").concat(o,"?ss=1")).then((function(r){var t=r.screenshot,o=r.timestamp;if(0!==t.length){i.isScreenshotStale=!(0,w.Z$)(o,300),i.loading=!1,i.screenshot=t,i.timestamp=o;var c=Z(n);e.current&&p(c)}})).catch((function(){i.isScreenshotStale=!0})).finally((function(){i.loading=!1})),i}));p(n),F(n,A)},refreshInterval:6e4}).isLoading;return(0,c.useEffect)((function(){return function(){e.current=!1}}),[]),(0,t.jsxs)(a.Z,{children:[(0,t.jsx)(o.default,{children:(0,t.jsx)("title",{children:"Dashboard"})}),(0,t.jsx)(h.Z,{}),(0,t.jsx)(x.s_,{children:M?(0,t.jsx)(j.Z,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(x.V9,{children:[(0,t.jsx)(b.Z,{placeholder:"Search by server name",onChange:function(e){var r=e.target.value;N(r),F(v,r)},sx:{marginRight:".6em"},value:A}),(0,t.jsx)(m.Z,{onClick:function(){return L(!0)},children:(0,t.jsx)(u.Z,{})})]}),P(I,r),I.length>0&&(0,t.jsx)(s.Z,{sx:{backgroundColor:f.d}}),P(S,r)]})}),(0,t.jsx)(g.Z,{dialogProps:{open:T},onClose:function(){L(!1)}})]})}}},function(e){e.O(0,[382,438,894,182,434,485,433,62,195,987,157,825,94,774,888,179],(function(){return r=5301,e(e.s=r);var r}));var r=e.O();_N_E=r}]);