(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)}])},5075:function(e,r,n){"use strict";n.r(r);var t=n(5893),c=n(9008),o=n(1163),i=n(7294),s=n(7357),a=n(7720),u=n(2428),l=n(2029),f=n(7169),v=n(7906),d=n(1200),h=n(5716),p=n(1706),m=n(5741),x=n(9),y=n(3679),_=n(1905),b=n(6350),j=n(2152);function g(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,c=e.anvilUUID,o=e.isScreenshotStale,i=e.screenshot,s=e.serverName,a=e.serverUUID;return(0,t.jsx)(v.M,{externalPreview:i,headerEndAdornment:[(0,t.jsx)(m.Z,{href:"/server?uuid=".concat(a,"&server_name=").concat(s),children:s},"server_list_to_server_".concat(a)),(0,t.jsx)(m.Z,{href:"/anvil?anvil_uuid=".concat(c),sx:{opacity:.7},children:n},"server_list_server_".concat(a,"_to_anvil_").concat(c))],isExternalPreviewStale:o,isFetchPreview:!1,isShowControls:!1,isUseInnerPanel:!0,onClickPreview:function(){r.push("/server?uuid=".concat(a,"&server_name=").concat(s,"&vnc=1"))},serverUUID:a},"server-preview-".concat(a))}))})},P=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,i.useRef)(!0),r=(0,o.useRouter)(),n=(0,i.useState)([]),v=n[0],m=n[1],g=(0,i.useState)([]),w=g[0],U=g[1],E=(0,i.useState)([]),I=E[0],A=E[1],C=(0,i.useState)(""),k=C[0],D=C[1],N=(0,i.useState)(!1),R=N[0],T=N[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,c=r.serverUUID,o=S({},r,{screenshot:(null===(t=v.find((function(e){return e.serverUUID===c})))||void 0===t?void 0:t.screenshot)||""});return(0,d.Z)("".concat(l.Z,"/server/").concat(c,"?ss")).then((function(r){var t=r.screenshot;o.screenshot=t,o.isScreenshotStale=!1;var c=Z(n);e.current&&m(c)})).catch((function(){o.isScreenshotStale=!0})),o}));m(n),F(n,k)},refreshInterval:6e4}).isLoading;return(0,i.useEffect)((function(){return function(){e.current=!1}}),[]),(0,t.jsxs)(s.Z,{children:[(0,t.jsx)(c.default,{children:(0,t.jsx)("title",{children:"Dashboard"})}),(0,t.jsx)(h.Z,{}),(0,t.jsx)(y.s_,{children:M?(0,t.jsx)(j.Z,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(y.V9,{children:[(0,t.jsx)(x.Z,{placeholder:"Search by server name",onChange:function(e){var r=e.target.value;D(r),F(v,r)},sx:{marginRight:".6em"},value:k}),(0,t.jsx)(p.Z,{onClick:function(){return T(!0)},children:(0,t.jsx)(u.Z,{})})]}),O(I,r),I.length>0&&(0,t.jsx)(a.Z,{sx:{backgroundColor:f.d}}),O(w,r)]})}),(0,t.jsx)(b.Z,{dialogProps:{open:R},onClose:function(){T(!1)}})]})}}},function(e){e.O(0,[738,688,7,643,536,369,142,315,818,141,892,149,906,774,888,179],(function(){return r=5301,e(e.s=r);var r}));var r=e.O();_N_E=r}]);