"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[170],{3170:function(e,n,r){r.d(n,{S:function(){return re},M:function(){return pe}});var t=r(5893),o=r(791),i=r(5537),l=r(4433),c=r(1496),a=r(7357),u=r(8333),s=r(5861),f=r(5152),d=r(7294),v=r(7971),m="0xffe3",h="0xffe9",p=[{keys:"Ctrl + Alt + Delete",scans:[]},{keys:"Ctrl + Alt + F1",scans:[m,h,"0xffbe"]},{keys:"Ctrl + Alt + F2",scans:[m,h,"0xffbf"]},{keys:"Ctrl + Alt + F3",scans:[m,h,"0xffc0"]},{keys:"Ctrl + Alt + F4",scans:[m,h,"0xffc1"]},{keys:"Ctrl + Alt + F5",scans:[m,h,"0xffc2"]},{keys:"Ctrl + Alt + F6",scans:[m,h,"0xffc3"]},{keys:"Ctrl + Alt + F7",scans:[m,h,"0xffc4"]},{keys:"Ctrl + Alt + F8",scans:[m,h,"0xffc5"]},{keys:"Ctrl + Alt + F9",scans:[m,h,"0xffc6"]}],y=r(4427),b=r(3679),x=r(1706),g=r(4390),j=r(4685),w=r(4825),C=r(5722);function S(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);re.length)&&(n=e.length);for(var r=0,t=new Array(n);r=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function D(e){return function(e){if(Array.isArray(e))return Z(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return Z(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var T=function(e){var n=e.children,r=e.containedButtonProps,o=e.iconButtonProps,i=e.muiMenuProps,l=e.onButtonClick,c=e.onItemClick,u=e.variant,s=void 0===u?"icon":u,f=M(e,["children","containedButtonProps","iconButtonProps","muiMenuProps","onButtonClick","onItemClick","variant"]),v=(0,d.useState)(null),m=v[0],h=v[1],p=(0,d.useMemo)((function(){return Boolean(m)}),[m]),y=(0,d.useMemo)((function(){return n||("icon"===s?(0,t.jsx)(j.Z,{fontSize:null===o||void 0===o?void 0:o.size}):"Options")}),[n,null===o||void 0===o?void 0:o.size,s]),b=(0,d.useCallback)((function(){for(var e=arguments.length,n=new Array(e),r=0;r2?r-2:0),o=2;o0&&void 0!==arguments[0]?arguments[0]:{},n=e.initial,r=void 0===n?{}:n,o=r.actionProceedText,i=void 0===o?"":o,l=r.content,c=void 0===l?"":l,a=r.titleText,u=void 0===a?"":a,s=(0,d.useRef)(null),f=(0,d.useState)({actionProceedText:i,content:c,titleText:u}),v=f[0],m=f[1],h=(0,d.useCallback)((function(e){var n,r;return null===s||void 0===s||null===(n=s.current)||void 0===n||null===(r=n.setOpen)||void 0===r?void 0:r.call(null,e)}),[]),p=(0,d.useCallback)((function(e,n){return m({actionProceedText:"",content:(0,t.jsx)(N.Z,R({},n)),showActionArea:!1,showClose:!0,titleText:e})}),[]),y=(0,d.useMemo)((function(){return(0,t.jsx)(z.Z,R({},v,{ref:s}))}),[v]);return{confirmDialog:y,confirmDialogRef:s,setConfirmDialogOpen:h,setConfirmDialogProps:m,finishConfirm:p}};function $(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function q(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var J=function(e){e.getItemDisabled,e.items,e.onItemClick,e.renderItem;var n,r=e.serverName,o=e.serverState,i=e.serverUuid,l=G(e,["getItemDisabled","items","onItemClick","renderItem","serverName","serverState","serverUuid"]),c=L(),u=c.confirmDialog,s=c.setConfirmDialogOpen,f=c.setConfirmDialogProps,v=c.finishConfirm,m=(0,d.useMemo)((function(){return{"force-off":{colour:"red",description:(0,t.jsx)(t.Fragment,{children:"This is equal to pulling the power cord, which may cause data loss or system corruption."}),label:"Force off",path:"/command/stop-server/".concat(i,"?force=1")},"power-off":{description:(0,t.jsx)(t.Fragment,{children:"This is equal to pushing the power button. If the server doesn't respond to the corresponding signals, you may have to manually shut it down."}),label:"Power off",path:"/command/stop-server/".concat(i)},"power-on":{description:(0,t.jsx)(t.Fragment,{children:"This is equal to pushing the power button."}),label:"Power on",path:"/command/start-server/".concat(i)}}}),[i]);return(0,t.jsxs)(a.Z,{children:[(0,t.jsx)(T,q({getItemDisabled:function(e){var n=e.includes("on");return"running"===o===n},items:m,onItemClick:function(e,n){var o=n.colour,i=n.description,l=n.label,c=n.path,a=l.toLocaleLowerCase();f({actionProceedText:l,content:(0,t.jsx)(B.Ac,{children:i}),onProceedAppend:function(){f((function(e){return q({},e,{loading:!0})})),g.Z.put(c).then((function(){v("Success",{children:(0,t.jsxs)(t.Fragment,{children:["Successfully registered ",a," job on ",r,"."]})})})).catch((function(e){var n=(0,U.Z)(e);n.children=(0,t.jsxs)(t.Fragment,{children:["Failed to register ",a," job on ",r,"; CAUSE:"," ",n.children,"."]}),v("Error",n)}))},proceedColour:o,titleText:"".concat(l," server ").concat(r,"?")}),s(!0)},renderItem:function(e,n){var r,o=n.colour,i=n.label;return o&&(r=w.D[o]),(0,t.jsx)(B.Ac,{inheritColour:!0,color:r,children:i})}},l,{children:(0,t.jsx)(x.Z,{fontSize:null===l||void 0===l||null===(n=l.iconButtonProps)||void 0===n?void 0:n.size})})),u]})},K=r(2152),V=r(1081);function H(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r=0;r-=1)D.current.sendKey(e[r],0)}else D.current.sendCtrlAltDel();j(null)}}(r)},children:(0,t.jsx)(s.Z,{variant:"subtitle1",children:n})},n)}))})]})}),[g]),H=(0,d.useMemo)((function(){return(0,t.jsx)(a.Z,{children:(0,t.jsx)(v.Z,{onClick:function(){for(var e=arguments.length,r=new Array(e),t=0;t :first-child":{flexGrow:1}},children:[(0,t.jsx)(a.Z,{textAlign:"center",children:G}),b&&z&&(0,t.jsx)(ue.Z,{spacing:".3em",children:(0,t.jsx)(v.Z,{onClick:I,children:(0,t.jsx)(le.Z,{})})})]})]})};he.defaultProps=de;var pe=he},9370:function(e,n,r){function t(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r2&&void 0!==arguments[2]?arguments[2]:{}).ms,t=a(r)-e;return t<=n},s=function(e){var n,r=e,t=i(l([60,60].reduce((function(e,n){var t=r%n;return e.push(t),r=(r-t)/n,e}),[])).concat([r]),3),c=t[0],a=t[1],u=t[2],s=null!==(n=[{unit:"h",value:u},{unit:"m",value:a}].find((function(e){return e.value})))&&void 0!==n?n:{unit:"s",value:c};return function(e){for(var n=1;n