(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[490],{78262:function(e,t,n){"use strict";n.d(t,{Z:function(){return A}});var r=n(63366),l=n(87462),o=n(67294),s=n(63961),i=n(94780),a=n(92996),c=n(98216),d=n(11994),u=n(16628),p=n(90629),h=n(71657),m=n(90948),x=n(1588),g=n(34867);function getDialogUtilityClass(e){return(0,g.Z)("MuiDialog",e)}let f=(0,x.Z)("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),Z=o.createContext({});var j=n(84808),v=n(2734),b=n(85893);let w=["aria-describedby","aria-labelledby","BackdropComponent","BackdropProps","children","className","disableEscapeKeyDown","fullScreen","fullWidth","maxWidth","onBackdropClick","onClose","open","PaperComponent","PaperProps","scroll","TransitionComponent","transitionDuration","TransitionProps"],y=(0,m.ZP)(j.Z,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),useUtilityClasses=e=>{let{classes:t,scroll:n,maxWidth:r,fullWidth:l,fullScreen:o}=e,s={root:["root"],container:["container",`scroll${(0,c.Z)(n)}`],paper:["paper",`paperScroll${(0,c.Z)(n)}`,`paperWidth${(0,c.Z)(String(r))}`,l&&"paperFullWidth",o&&"paperFullScreen"]};return(0,i.Z)(s,getDialogUtilityClass,t)},P=(0,m.ZP)(d.Z,{name:"MuiDialog",slot:"Root",overridesResolver:(e,t)=>t.root})({"@media print":{position:"absolute !important"}}),k=(0,m.ZP)("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.container,t[`scroll${(0,c.Z)(n.scroll)}`]]}})(({ownerState:e})=>(0,l.Z)({height:"100%","@media print":{height:"auto"},outline:0},"paper"===e.scroll&&{display:"flex",justifyContent:"center",alignItems:"center"},"body"===e.scroll&&{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}})),C=(0,m.ZP)(p.Z,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`scrollPaper${(0,c.Z)(n.scroll)}`],t[`paperWidth${(0,c.Z)(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(({theme:e,ownerState:t})=>(0,l.Z)({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"}},"paper"===t.scroll&&{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"},"body"===t.scroll&&{display:"inline-block",verticalAlign:"middle",textAlign:"left"},!t.maxWidth&&{maxWidth:"calc(100% - 64px)"},"xs"===t.maxWidth&&{maxWidth:"px"===e.breakpoints.unit?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${f.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:"calc(100% - 64px)"}}},t.maxWidth&&"xs"!==t.maxWidth&&{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`,[`&.${f.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t.maxWidth]+64)]:{maxWidth:"calc(100% - 64px)"}}},t.fullWidth&&{width:"calc(100% - 64px)"},t.fullScreen&&{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${f.paperScrollBody}`]:{margin:0,maxWidth:"100%"}})),S=o.forwardRef(function(e,t){let n=(0,h.Z)({props:e,name:"MuiDialog"}),i=(0,v.Z)(),c={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{"aria-describedby":d,"aria-labelledby":m,BackdropComponent:x,BackdropProps:g,children:f,className:j,disableEscapeKeyDown:S=!1,fullScreen:A=!1,fullWidth:M=!1,maxWidth:_="sm",onBackdropClick:T,onClose:E,open:F,PaperComponent:I=p.Z,PaperProps:D={},scroll:O="paper",TransitionComponent:R=u.Z,transitionDuration:W=c,TransitionProps:B}=n,N=(0,r.Z)(n,w),U=(0,l.Z)({},n,{disableEscapeKeyDown:S,fullScreen:A,fullWidth:M,maxWidth:_,scroll:O}),L=useUtilityClasses(U),H=o.useRef(),V=(0,a.Z)(m),$=o.useMemo(()=>({titleId:V}),[V]);return(0,b.jsx)(P,(0,l.Z)({className:(0,s.Z)(L.root,j),closeAfterTransition:!0,components:{Backdrop:y},componentsProps:{backdrop:(0,l.Z)({transitionDuration:W,as:x},g)},disableEscapeKeyDown:S,onClose:E,open:F,ref:t,onClick:e=>{H.current&&(H.current=null,T&&T(e),E&&E(e,"backdropClick"))},ownerState:U},N,{children:(0,b.jsx)(R,(0,l.Z)({appear:!0,in:F,timeout:W,role:"presentation"},B,{children:(0,b.jsx)(k,{className:(0,s.Z)(L.container),onMouseDown:e=>{H.current=e.target===e.currentTarget},ownerState:U,children:(0,b.jsx)(C,(0,l.Z)({as:I,elevation:24,role:"dialog","aria-describedby":d,"aria-labelledby":V},D,{className:(0,s.Z)(L.paper,D.className),ownerState:U,children:(0,b.jsx)(Z.Provider,{value:$,children:f})}))})}))}))});var A=S},14453:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/config",function(){return n(8603)}])},73393:function(e,t,n){"use strict";var r=n(85893),l=n(90948),o=n(67294),s=n(25934),i=n(19467),a=n(55238),c=n(81796);let d=(0,l.ZP)(a.Z)({justifyContent:"flex-end",width:"100%"});t.Z=e=>{let{actions:t=[],loading:n}=e,l=(0,o.useMemo)(()=>t.map(e=>(0,r.jsx)(i.Z,{...e,children:e.children},(0,s.Z)())),[t]);return n?(0,r.jsx)(c.Z,{mt:0}):(0,r.jsx)(d,{row:!0,spacing:".5em",children:l})}},56597:function(e,t,n){"use strict";var r=n(85893),l=n(5616),o=n(67294),s=n(56211),i=n(55238),a=n(4121),c=n(84154);let d=(0,o.forwardRef)((e,t)=>{let{actionCancelText:n="Cancel",actionProceedText:d,children:u,closeOnProceed:p=!1,contentContainerProps:h,dialogProps:m,disableProceed:x,loading:g,loadingAction:f=!1,onActionAppend:Z,onCancelAppend:j,onProceedAppend:v,openInitially:b,preActionArea:w,proceedButtonProps:y,proceedColour:P="blue",scrollContent:k=!1,scrollBoxProps:C,showActionArea:S=!0,showCancel:A,showClose:M,titleText:_,wide:T,content:E=u}=e,F=(0,o.useRef)(null),I=(0,o.useMemo)(()=>(0,a.Z)(E,c.Ac),[E]),D=(0,o.useMemo)(()=>(0,o.createElement)(k?s.VZ:l.Z,C,I),[I,C,k]),O=(0,o.useMemo)(()=>S&&(0,r.jsx)(s.ux,{cancelProps:{children:n,onClick:function(){for(var e=arguments.length,t=Array(e),n=0;n({setOpen:e=>{var t;return null===(t=F.current)||void 0===t?void 0:t.setOpen(e)}}),[]),(0,r.jsx)(s.Js,{dialogProps:m,header:_,loading:g,openInitially:b,ref:F,showClose:M,wide:T,children:(0,r.jsxs)(i.Z,{...h,children:[D,w,O]})})});d.displayName="ConfirmDialog",t.Z=d},56211:function(e,t,n){"use strict";n.d(t,{ux:function(){return Dialog_DialogActionGroup},VZ:function(){return Z},Js:function(){return v}});var r=n(85893),l=n(78262),o=n(67294),s=n(37260),i=n(81796);let a=(0,o.createContext)(void 0),c=(0,o.forwardRef)((e,t)=>{let{children:n,dialogProps:c={},loading:d,openInitially:u=!1,wide:p}=e,{open:h,PaperProps:m={},...x}=c,{sx:g,...f}=m,[Z,j]=(0,o.useState)(u),v=(0,o.useMemo)(()=>null!=h?h:Z,[Z,h]),b=(0,o.useMemo)(()=>d?(0,r.jsx)(i.Z,{mt:0}):n,[n,d]),w=(0,o.useMemo)(()=>({minWidth:p?{xs:"calc(100%)",md:"50em"}:null,overflow:"visible",...g}),[g,p]);return(0,o.useImperativeHandle)(t,()=>({open:v,setOpen:j}),[v]),(0,r.jsx)(l.Z,{open:v,PaperComponent:s.s_,PaperProps:{...f,sx:w},...x,children:(0,r.jsx)(a.Provider,{value:{open:v,setOpen:j},children:b})})});c.displayName="Dialog";var d=n(73393);let handleAction=function(e){let{handlers:{base:t,origin:n}}=e;for(var r=arguments.length,l=Array(r>1?r-1:0),o=1;o{let{cancelProps:t,closeOnProceed:n,loading:l=!1,onCancel:s=handleAction,onProceed:i=handleAction,proceedColour:c,proceedProps:u,showCancel:p=!0,cancelChildren:h=null==t?void 0:t.children,proceedChildren:m=null==u?void 0:u.children}=e,x=(0,o.useContext)(a),g=(0,o.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r{null==x||x.setOpen(!1)},origin:null==t?void 0:t.onClick}},...n)},[null==t?void 0:t.onClick,x,s]),f=(0,o.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r{n&&(null==x||x.setOpen(!1))},origin:null==u?void 0:u.onClick}},...t)},[n,x,i,null==u?void 0:u.onClick]),Z=(0,o.useMemo)(()=>{let e=[{background:c,...u,children:m,onClick:f}];return p&&e.unshift({...t,children:h,onClick:g}),(0,r.jsx)(d.Z,{actions:e,loading:l})},[h,g,t,l,m,c,f,u,p]);return Z},u=n(83221),p=n(4121),h=n(84154),Dialog_DialogHeader=e=>{let{children:t,showClose:n}=e,l=(0,o.useContext)(a),i=(0,o.useMemo)(()=>(0,p.Z)(t,h.z),[t]),c=(0,o.useMemo)(()=>n&&(0,r.jsx)(u.Z,{mapPreset:"close",onClick:()=>{null==l||l.setOpen(!1)},size:"small"}),[l,n]);return(0,r.jsxs)(s.V9,{children:[i,c]})},m=n(90948),x=n(5616);let g=(0,m.ZP)(x.Z)({overflowY:"scroll",paddingRight:".4em"}),f=(0,m.ZP)(g)({maxHeight:"60vh"});var Z=f;let j=(0,o.forwardRef)((e,t)=>{let{children:n,dialogProps:l,header:o,loading:s,openInitially:i,showClose:a,wide:d}=e;return(0,r.jsxs)(c,{dialogProps:l,loading:s,openInitially:i,ref:t,wide:d,children:[(0,r.jsx)(Dialog_DialogHeader,{showClose:a,children:o}),n]})});j.displayName="DialogWithHeader";var v=j},87038:function(e,t,n){"use strict";var r=n(85893),l=n(67294),o=n(56597);let s=(0,l.forwardRef)((e,t)=>{let{children:n,contentContainerProps:s,dialogProps:i,onSubmitAppend:a,proceedButtonProps:c,scrollBoxProps:d,scrollContent:u,...p}=e,h=(0,l.useMemo)(()=>({...s,component:"form",onSubmit:function(){for(var e=arguments.length,t=Array(e),n=0;n({...d,sx:u?{overflowX:"hidden",paddingTop:".6em",...null==d?void 0:d.sx}:null==d?void 0:d.sx}),[d,u]);return(0,r.jsx)(o.Z,{dialogProps:i,contentContainerProps:h,proceedButtonProps:{...c,type:"submit"},scrollContent:u,scrollBoxProps:m,wide:!0,...p,ref:t,children:n})});s.displayName="FormDialog",t.Z=s},15079:function(e,t,n){"use strict";var r=n(85893),l=n(97212),o=n(78462),s=n(5616),i=n(55238),a=n(84154),c=n(5744);let renderEntryValueWithMono=e=>{let{entry:t}=e;return(0,r.jsx)(a.$_,{whiteSpace:"nowrap",children:String(t)})},renderEntryValueWithPassword=e=>{let{entry:t,key:n}=e;return/passw/i.test(n)?(0,r.jsx)(a.PJ,{revealButtonProps:{sx:{marginRight:0,padding:0}},monospaced:!0,textLineHeight:null,children:String(t)}):renderEntryValueWithMono(e)},buildEntryList=e=>{let{depth:t=0,entries:n,getEntryLabel:s,getListProps:i,getListItemProps:a,listKey:c,maxDepth:d,renderEntry:u,renderEntryValue:p,skip:h}=e,m=[];Object.entries(n).forEach(e=>{let[n,o]=e,i="form-summary-entry-".concat(n),c=null!==o&&"object"==typeof o,x=c?null:o,g={depth:t,entry:x,key:n};h(e=>{let{key:t}=e;return!/confirm/i.test(t)},g)&&m.push((0,r.jsx)(l.ZP,{sx:{paddingLeft:"".concat(t,"em")},...null==a?void 0:a.call(null,g),children:u({depth:t,entry:x,getLabel:s,key:n,nest:c,renderValue:p})},i)),c&&t{let{entries:t,getEntryLabel:n=e=>{let{cap:t,key:n}=e;return t(n)},getListProps:l,getListItemProps:o,hasPassword:d,maxDepth:u=3,renderEntry:p=e=>{let{depth:t,entry:n,getLabel:l,key:o,nest:d,renderValue:u}=e;return(0,r.jsxs)(i.Z,{fullWidth:!0,growFirst:!0,row:!0,maxWidth:"100%",children:[(0,r.jsx)(a.Ac,{children:l({cap:c.Z,depth:t,entry:n,key:o})}),(0,r.jsx)(s.Z,{sx:{maxWidth:"100%",overflowX:"scroll"},children:!d&&u({depth:t,entry:n,key:o})})]})},renderEntryValue:h=e=>{let{entry:t}=e;return["",null,void 0].some(e=>t===e)?(0,r.jsx)(a.Ac,{children:"none"}):d?renderEntryValueWithPassword(e):renderEntryValueWithMono(e)},skip:m=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r{let{calculateItemBreakpoints:t=()=>({xs:1}),layout:n,wrapperBoxProps:i,...a}=e,c=(0,l.useMemo)(()=>{let e=Object.entries(n);return e.map((e,n)=>{let[r,s]=e;return s?(0,l.createElement)(o.ZP,{...t(n,r),key:r,item:!0,...s}):void 0})},[t,n]);return(0,r.jsx)(s.Z,{...i,children:(0,r.jsx)(o.ZP,{container:!0,...a,children:c})})}},21405:function(e,t,n){"use strict";n.d(t,{Z:function(){return components_Header}});var r=n(85893),l=n(41098),o=n(90948),s=n(42293),i=n(5616),a=n(82589),c=n(54799),d=n(67294),u=n(6010),p=n(25709),h=n(13540),m=n(77533),x=n(78462),g=n(97212),f=n(98619);let Z=[{text:"Anvil",image:"/pngs/anvil_icon_on.png",uri:"/manage-element"},{text:"Files",image:"/pngs/files_on.png",uri:"/file-manager"},{text:"Configure",image:"/pngs/configure_icon_on.png",uri:"/config"},{text:"Mail",image:"/pngs/email_on.png",uri:"/mail-config"},{text:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],j={width:"40em",height:"40em"};var v=n(67645),b=n(57632),w=n(55238),y=n(41247),P=n(84154),k=n(34819);let C="AnvilDrawer",S={actionIcon:"".concat(C,"-actionIcon"),list:"".concat(C,"-list")},A=(0,o.ZP)(m.ZP)(()=>({["& .".concat(S.list)]:{width:"200px"},["& .".concat(S.actionIcon)]:{fontSize:"2.3em",color:u.of}}));var components_AnvilDrawer=e=>{let{open:t,setOpen:n}=e,{getSessionUser:l}=(0,k.Z)(),o=l();return(0,r.jsx)(A,{BackdropProps:{invisible:!0},anchor:"left",open:t,onClose:()=>n(!t),children:(0,r.jsx)("div",{role:"presentation",children:(0,r.jsxs)(x.Z,{className:S.list,children:[(0,r.jsx)(g.ZP,{children:(0,r.jsx)(P.Ac,{children:o?(0,r.jsxs)(r.Fragment,{children:["Welcome, ",o.name]}):"Unregistered"})}),(0,r.jsx)(b.Z,{}),(0,r.jsx)(f.Z,{component:"a",href:"/index.html",children:(0,r.jsxs)(w.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(p.Z,{className:S.actionIcon}),(0,r.jsx)(P.Ac,{children:"Dashboard"})]})}),Z.map(e=>(0,r.jsx)(f.Z,{component:"a",href:e.uri,children:(0,r.jsxs)(w.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)("img",{alt:e.text,src:e.image,...j}),(0,r.jsx)(P.Ac,{children:e.text})]})},"anvil-drawer-".concat(e.image))),(0,r.jsx)(f.Z,{onClick:()=>{v.Z.put("/auth/logout").then(()=>{window.location.replace("/login")}).catch(e=>{(0,y.Z)(e)})},children:(0,r.jsxs)(w.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(h.Z,{className:S.actionIcon}),(0,r.jsx)(P.Ac,{children:"Logout"})]})})]})})})},M=n(83909),_=n(66354);let T="Header",E={input:"".concat(T,"-input"),barElement:"".concat(T,"-barElement"),iconBox:"".concat(T,"-iconBox"),searchBar:"".concat(T,"-searchBar"),icons:"".concat(T,"-icons")},F=(0,o.ZP)(s.Z)(e=>{let{theme:t}=e;return{paddingTop:t.spacing(.5),paddingBottom:t.spacing(.5),paddingLeft:t.spacing(3),paddingRight:t.spacing(3),borderBottom:"solid 1px",borderBottomColor:u.hM,position:"static",["& .".concat(E.input)]:{height:"2.8em",width:"30vw",backgroundColor:t.palette.secondary.main,borderRadius:u.n_},["& .".concat(E.barElement)]:{padding:0},["& .".concat(E.iconBox)]:{[t.breakpoints.down("sm")]:{display:"none"}},["& .".concat(E.searchBar)]:{[t.breakpoints.down("sm")]:{flexGrow:1,paddingLeft:"15vw"}},["& .".concat(E.icons)]:{paddingLeft:".1em",paddingRight:".1em"}}});var components_Header=()=>{let e=(0,d.useRef)({}),t=(0,d.useRef)({}),[n,o]=(0,d.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(F,{children:(0,r.jsxs)(i.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:[(0,r.jsx)(w.Z,{row:!0,children:(0,r.jsx)(a.Z,{onClick:()=>o(!n),children:(0,r.jsx)("img",{alt:"",src:"/pngs/logo.png",width:"160",height:"40"})})}),(0,r.jsx)(w.Z,{className:E.iconBox,row:!0,spacing:0,children:(0,r.jsx)(i.Z,{children:(0,r.jsx)(c.Z,{onClick:e=>{var n,r;let{currentTarget:l}=e;null===(n=t.current.setAnchor)||void 0===n||n.call(null,l),null===(r=t.current.setOpen)||void 0===r||r.call(null,!0)},sx:{color:u.of,padding:"0 .1rem"},children:(0,r.jsx)(M.Z,{icon:l.Z,ref:e})})})})]})}),(0,r.jsx)(components_AnvilDrawer,{open:n,setOpen:o}),(0,r.jsx)(_.Z,{onFetchSuccessAppend:t=>{var n;null===(n=e.current.indicate)||void 0===n||n.call(null,Object.keys(t).length>0)},ref:t})]})}},69836:function(e,t,n){"use strict";var r=n(85893),l=n(43800),o=n(23795),s=n(6010),i=n(55238);t.Z=e=>{let{children:t,sx:n,...a}=e;return(0,r.jsx)(o.Z,{underline:"hover",variant:"subtitle1",...a,sx:{color:s.lD,textDecorationColor:s.s7,...n},children:(0,r.jsxs)(i.Z,{row:!0,children:[t,(0,r.jsx)(l.Z,{sx:{marginLeft:".3em"}})]})})}},32576:function(e,t,n){"use strict";var r=n(85893),l=n(67294),o=n(84070),s=n(15079);t.Z=e=>{let{list:t={}}=e,[n,i]=(0,l.useState)({}),a=(0,l.useMemo)(()=>Object.keys(t),[t]),c=(0,l.useMemo)(()=>Object.keys(n),[n]),d=(0,l.useMemo)(()=>c.length===a.length,[c.length,a.length]),u=(0,l.useMemo)(()=>c.length>0,[c.length]),p=(0,l.useMemo)(()=>a.length>1,[a.length]),h=(0,l.useCallback)(e=>{let{confirmDialogProps:t={},formSummaryProps:l={},getConfirmDialogTitle:o,onProceedAppend:i,renderEntry:a}=e;return{actionProceedText:"Delete",content:(0,r.jsx)(s.Z,{entries:n,maxDepth:0,renderEntry:a,...l}),onProceedAppend:i,proceedColour:"red",titleText:o(c.length),...t}},[n,c.length]),m=(0,l.useCallback)(e=>!!n[e],[n]),x=(0,l.useCallback)(()=>i({}),[]),g=(0,l.useCallback)(e=>i(a.reduce((t,n)=>(e&&(t[n]=e),t),{})),[a]),f=(0,l.useCallback)((e,t)=>i((0,o.ZP)(e,t||void 0)),[]);return{buildDeleteDialogProps:h,checklist:n,checks:c,getCheck:m,hasAllChecks:d,hasChecks:u,multipleItems:p,resetChecks:x,setAllChecks:g,setCheck:f}}},58839:function(e,t,n){"use strict";var r=n(67294);t.Z=function(){let{actionProceedText:e="",content:t="",titleText:n="",...l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.useState)({actionProceedText:e,content:t,titleText:n,...l})}},96867:function(e,t,n){"use strict";var r=n(67294),l=n(67645),o=n(84070),s=n(41247);t.Z=(e,t)=>{var n;let[i,a]=(0,r.useState)(!1),[c,d]=(0,r.useState)({}),u=(0,r.useCallback)(e=>{var n,r;return null==t?void 0:null===(r=t.current)||void 0===r?void 0:null===(n=r.setMessage)||void 0===n?void 0:n.call(null,"api",e)},[t]),p=(0,r.useCallback)((e,n)=>{var r,l;null==t||null===(l=t.current)||void 0===l||null===(r=l.setMessage)||void 0===r||r.call(null,String(e),n)},[t]),h=(0,r.useCallback)((e,n)=>{var r,l;null==t||null===(l=t.current)||void 0===l||null===(r=l.setMessageRe)||void 0===r||r.call(null,e,n)},[t]),m=(0,r.useCallback)((e,t)=>{d((0,o.ZP)(e,t))},[]),x=(0,r.useCallback)((e,t)=>{d((0,o.Um)(e,t))},[]),g=(0,r.useCallback)(e=>{p(e),m(e)},[p,m]),f=(0,r.useCallback)(e=>{h(e),x(e)},[h,x]),Z=(0,r.useCallback)(e=>t=>{m(e,t)},[m]),j=(0,r.useCallback)(e=>t=>{let{isValid:n}=t;m(e,n)},[m]),v=(0,r.useCallback)(e=>()=>{g(e)},[g]),b=(0,r.useCallback)(e=>{let{body:r,getErrorMsg:o,msgKey:i="api",method:c,onError:d,onSuccess:u,setMsg:p=null==t?void 0:null===(n=t.current)||void 0===n?void 0:n.setMessage,successMsg:h,url:m}=e;a(!0),l.Z.request({data:r,method:c,url:m}).then(()=>{null==p||p.call(null,i,{children:h,type:"info"}),null==u||u.call(null)}).catch(e=>{let t=(0,s.Z)(e);t.children=o(t.children),null==p||p.call(null,i,t),null==d||d.call(null)}).finally(()=>{a(!1)})},[t,a]),w=(0,r.useMemo)(()=>Object.values(c).some(e=>!e),[c]);return{buildFinishInputTestBatchFunction:Z,buildInputFirstRenderFunction:j,buildInputUnmountFunction:v,formValidity:c,isFormInvalid:w,isFormSubmitting:i,setApiMessage:u,setFormValidity:d,setMessage:p,setMessageRe:h,setValidity:m,setValidityRe:x,submitForm:b,unsetKey:g,unsetKeyRe:f}}},84070:function(e,t,n){"use strict";n.d(t,{Um:function(){return buildRegExpObjectStateSetterCallback}});let defaultObjectStatePropSetter=function(){for(var e=arguments.length,t=Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:{};return r=>{let l={};return Object.keys(r).forEach(o=>{e.test(o)?n(r,l,o,t):l[o]=r[o]}),l}};t.ZP=function(e,t){let{guard:n=()=>!0,set:r=defaultObjectStatePropSetter}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l=>{let{[e]:o,...s}=l,i={...s};return n(l,e,t)&&r(l,i,e,t),i}}},5813:function(e,t){"use strict";t.default={bcn:"Back-Channel Network",ifn:"Internet-Facing Network",mn:"Migration Network",sn:"Storage Network"}},5744:function(e,t,n){"use strict";var r=n(48403),l=n.n(r);t.Z=e=>{let t=e.replace(/([a-z\d])([A-Z])/g,"$1 $2");return l()(t)}},4121:function(e,t,n){"use strict";var r=n(67294);t.Z=(e,t)=>"string"==typeof e?(0,r.createElement)(t,null,e):e},8603:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return config}});var r=n(85893),l=n(48263),o=n(9008),s=n.n(o),i=n(67294),a=n(98436),c=n(56597),d=n(21405),u=n(64666),p=n(5813),h=n(94121),m=n(67645);let buildMessageSetter=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,setter=n=>{var r;null===(r=t.current.setMessage)||void 0===r||r.call(null,e,n)};return n&&(n[r]=setter),setter};var lib_buildMapToMessageSetter=(e,t)=>{let n={};return e instanceof Array?e.reduce((e,n)=>(buildMessageSetter(n,t,e),e),n):Object.entries(e).reduce((e,n)=>{let[r,l]=n;return buildMessageSetter(l,t,e,r),e},n)},x=n(84070),g=n(58843),f=n(35348),Z=n(84154),components_CheckboxWithLabel=e=>{let{checkboxProps:t,checked:n,formControlLabelProps:l,label:o,onChange:s}=e,a=(0,i.useMemo)(()=>"string"==typeof o?(0,r.jsx)(Z.Ac,{children:o}):o,[o]);return(0,r.jsx)(g.Z,{...l,control:(0,r.jsx)(f.Z,{...t,checked:n,onChange:s}),label:a})},j=n(55238),v=n(37039),b=n(41247),w=n(83221),y=n(92917),P=n(21642),k=n(55675),C=n(50233);let S={dbPort:"dbPort",ipAddress:"ipAddress",password:"password",sshPort:"sshPort",user:"user"},A={ipAddress:"IP address",password:"Password",ping:"Ping"},M=(0,i.forwardRef)((e,t)=>{let{formGridColumns:n=2}=e,l=(0,i.useRef)({}),o=(0,i.useRef)({}),s=(0,i.useRef)({}),a=(0,i.useRef)({}),d=(0,i.useRef)({}),u=(0,i.useRef)({}),[p,g]=(0,i.useState)({}),[f,M]=(0,i.useState)(!0),[_,T]=(0,i.useState)(!1),E=(0,i.useCallback)(e=>t=>{let{isValid:n}=t;g((0,x.ZP)(e,n))},[]),F=(0,i.useCallback)(e=>t=>{g((0,x.ZP)(e,t))},[]),I=(0,i.useCallback)(e=>{var t;null===(t=u.current.setMessage)||void 0===t||t.call(null,"api",e)},[]),D=(0,i.useMemo)(()=>Object.values(p).some(e=>!e),[p]),O=(0,i.useMemo)(()=>lib_buildMapToMessageSetter(S,u),[]);return(0,r.jsx)(c.Z,{actionProceedText:"Add",content:(0,r.jsx)(v.Z,{columns:{xs:1,sm:n},layout:{"add-peer-ip-address":{children:(0,r.jsx)(j.Z,{row:!0,spacing:".3em",children:(0,r.jsx)(y.Z,{input:(0,r.jsx)(k.Z,{id:"add-peer-ip-address-input",inputProps:{readOnly:!0,onFocus:e=>{e.target.readOnly=!1}},label:A.ipAddress}),inputTestBatch:(0,C._)(A.ipAddress,()=>{O.ipAddress()},{onFinishBatch:F(S.ipAddress)},e=>{O.ipAddress({children:e})}),onFirstRender:E(S.ipAddress),ref:o,required:!0})})},"add-peer-password":{children:(0,r.jsx)(y.Z,{input:(0,r.jsx)(k.Z,{id:"add-peer-password-input",label:A.password,type:h.Z.password}),inputTestBatch:(0,C.Gn)(A.password,()=>{O.password()},{onFinishBatch:F(S.password)},e=>{O.password({children:e})}),onFirstRender:E(S.password),ref:s,required:!0})},"add-peer-is-ping":{children:(0,r.jsx)(components_CheckboxWithLabel,{checked:f,label:A.ping,onChange:(e,t)=>{M(t)}}),sx:{display:"flex"}},"add-peer-message-group":{children:(0,r.jsx)(P.Z,{count:1,defaultMessageType:"warning",ref:u}),sm:n}},spacing:"1em"}),dialogProps:{PaperProps:{sx:{minWidth:"16em"}}},loadingAction:_,onActionAppend:()=>{I()},onProceedAppend:()=>{var e,t,n,r,i;T(!0),m.Z.post("/host/connection",{ipAddress:null===(e=o.current.getValue)||void 0===e?void 0:e.call(null),isPing:f,password:null===(t=s.current.getValue)||void 0===t?void 0:t.call(null),port:null===(n=l.current.getValue)||void 0===n?void 0:n.call(null),sshPort:null===(r=a.current.getValue)||void 0===r?void 0:r.call(null),user:null===(i=d.current.getValue)||void 0===i?void 0:i.call(null)}).then(()=>{I({children:"Successfully initiated the peer addition. You can continue to edit the field(s) to add another peer.",type:"info"})}).catch(e=>{let t=(0,b.Z)(e);t.children="Failed to add the given peer. ".concat(t.children),I(t)}).finally(()=>{T(!1)})},proceedButtonProps:{disabled:D},ref:t,titleText:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Z.z,{children:"Add a peer"}),(0,r.jsx)(w.Z,{mapPreset:"close",onClick:()=>{if(t&&"current"in t){var e;null===(e=t.current.setOpen)||void 0===e||e.call(null,!1)}},variant:"redcontained"})]})})});M.displayName="AddPeerDialog";var _=n(63071),T=n(68917),E=n(37260),F=n(27036),I=n(50594),D=n(6010);let O={small:Z.KI,medium:Z.Ac},R={size:"small",stateMap:new Map([[!1,(0,r.jsx)(I.Z,{sx:{color:D.Wd}},"state-false")],[!0,(0,r.jsx)(F.Z,{sx:{color:D.Ej}},"state-true")]])},State=e=>{let{label:t,size:n=R.size,state:l,stateMap:o=R.stateMap}=e,s=o.get(l);return(0,r.jsxs)(j.Z,{row:!0,spacing:".3em",children:[s&&(0,i.cloneElement)(s,{fontSize:n}),(0,i.createElement)(O[n],{},t)]})};State.defaultProps=R;var StrikerConfig_ConfigPeersForm=e=>{let{refreshInterval:t=6e4}=e,n=(0,i.useRef)({}),o=(0,i.useRef)({}),[s,d]=(0,i.useState)(void 0),[h,x]=(0,i.useState)({actionProceedText:"",content:"",titleText:""}),[g,f]=(0,i.useState)({}),[v,w]=(0,i.useState)(!1),[y,P]=(0,i.useState)({}),k=(0,i.useMemo)(()=>s&&(0,r.jsx)(l.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(T.Z,{...s})}),[s]),{isLoading:C}=(0,u.Z)("".concat(a.Z,"/host/connection"),{refreshInterval:t,onError:e=>{d({children:"Failed to get connection data. Error: ".concat(e),type:"error"})},onSuccess:e=>{let{local:{inbound:{ipAddress:t,port:n,user:r},peer:l}}=e;f(e=>Object.entries(t).reduce((t,l)=>{let[o,{networkLinkNumber:s,networkNumber:i,networkType:a}]=l;return t[o]={...e[o],dbPort:n,dbUser:r,ipAddress:o,networkLinkNumber:s,networkNumber:i,networkType:a},t},{})),P(e=>Object.entries(l).reduce((t,n)=>{let[r,{hostUUID:l,isPing:o,port:s,user:i}]=n,a="".concat(i,"@").concat(r,":").concat(s);return t[a]={...e[a],dbPort:s,dbUser:i,hostUUID:l,ipAddress:r,isPingTest:o},t},{}))}});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(E.TZ,{header:"Configure striker peers",loading:C,children:(0,r.jsxs)(l.ZP,{columns:{xs:1,sm:2},container:!0,spacing:"1em",children:[(0,r.jsx)(l.ZP,{item:!0,xs:1,children:(0,r.jsx)(_.Z,{header:"Inbound connections",listEmpty:(0,r.jsx)(Z.Ac,{align:"center",children:"No inbound connections found."}),listItemKeyPrefix:"config-peers-inbound-connection",listItems:g,renderListItem:(e,t)=>{let{dbPort:n,dbUser:l,networkNumber:o,networkType:s}=t;return(0,r.jsxs)(j.Z,{spacing:0,sx:{width:"100%"},children:[(0,r.jsx)(Z.$_,{children:"".concat(l,"@").concat(e,":").concat(n)}),(0,r.jsx)(Z.KI,{children:"".concat(p.default[s]," ").concat(o)})]})}})}),(0,r.jsx)(l.ZP,{item:!0,xs:1,children:(0,r.jsx)(_.Z,{header:"Peer connections",allowEdit:!0,edit:v,listEmpty:(0,r.jsx)(Z.Ac,{align:"center",children:"No peer connections found."}),listItemKeyPrefix:"config-peers-peer-connection",listItems:y,onAdd:()=>{var e;null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:()=>{let e=Object.entries(y),t=e.reduce((e,t)=>{let[,{hostUUID:n,isChecked:r}]=t;return r&&e.local.push(n),e},{local:[]}),n=t.local.length;if(n>0){var r;x({actionProceedText:"Delete",content:"The peer relationship between this striker and the selected ".concat(n," host(s) will terminate. The removed peer(s) can be re-added later."),onProceedAppend:()=>{m.Z.delete("/host/connection",{data:t}).catch(e=>{let t=(0,b.Z)(e);t.children="Failed to delete peer connection(s). ".concat(t.children),d(t)})},proceedColour:"red",titleText:"Delete ".concat(n," peer(s) from this striker?")}),null===(r=o.current.setOpen)||void 0===r||r.call(null,!0)}},onEdit:()=>{w(e=>!e)},onItemCheckboxChange:(e,t,n)=>{y[e].isChecked=n,P(e=>({...e}))},renderListItem:(e,t)=>{let{isPingTest:n=!1}=t;return(0,r.jsx)(j.Z,{row:!0,spacing:0,children:(0,r.jsxs)(j.Z,{spacing:0,children:[(0,r.jsx)(Z.$_,{children:e}),(0,r.jsx)(State,{label:"Ping",state:n})]})})}})}),k]})}),(0,r.jsx)(M,{ref:n}),(0,r.jsx)(c.Z,{closeOnProceed:!0,...h,ref:o})]})},W=n(57632),B=n(69836),N=n(32576),StrikerConfig_ManageChangedSSHKeysForm=e=>{let{mitmExternalHref:t="https://en.wikipedia.org/wiki/Man-in-the-middle_attack",refreshInterval:n=6e4}=e,l=(0,i.useRef)({}),[o,s]=(0,i.useState)(),[d,p]=(0,i.useState)({}),[h,x]=(0,i.useState)({actionProceedText:"",content:"",titleText:""}),{checks:g,getCheck:f,hasAllChecks:v,hasChecks:w,setAllChecks:y,setCheck:P}=(0,N.Z)({list:d}),k=(0,i.useMemo)(()=>o&&(0,r.jsx)(T.Z,{...o}),[o]),C=(0,i.useMemo)(()=>Object.keys(d).length>1,[d]),{isLoading:S}=(0,u.Z)("".concat(a.Z,"/ssh-key/conflict"),{onError:e=>{s({children:"Failed to fetch SSH key conflicts. Error: ".concat(e),type:"error"})},onSuccess:e=>{p(t=>Object.values(e).reduce((e,n)=>(Object.values(n).forEach(n=>{let{hostName:r,hostUUID:l,ipAddress:o,stateUUID:s}=n;e[s]={...t[s],hostName:r,hostUUID:l,ipAddress:o}}),e),{}))},refreshInterval:n});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(E.TZ,{header:"Manage changed SSH keys",loading:S,children:[(0,r.jsxs)(j.Z,{spacing:".2em",children:[(0,r.jsx)(Z.Ac,{children:"The identity of the following targets have unexpectedly changed."}),(0,r.jsxs)(T.Z,{type:"warning",isAllowClose:!0,children:["If you haven't rebuilt the listed targets, then you could be experiencing a"," ",(0,r.jsx)(B.Z,{href:t,sx:{display:"inline-flex"},target:"_blank",children:'"Man In The Middle"'})," ","attack. Please verify the targets have changed for a known reason before proceeding to remove the broken keys."]}),(0,r.jsx)(_.Z,{header:(0,r.jsxs)(j.Z,{row:!0,spacing:".3em",sx:{width:"100%","& > :not(:last-child)":{display:{xs:"none",sm:"flex"}},"& > :last-child":{display:{xs:"initial",sm:"none"},marginLeft:0}},children:[(0,r.jsxs)(j.Z,{row:!0,spacing:".3em",sx:{flexBasis:"calc(50% + 1em)"},children:[(0,r.jsx)(Z.Ac,{children:"Host name"}),(0,r.jsx)(W.Z,{sx:{flexGrow:1}})]}),(0,r.jsxs)(j.Z,{row:!0,spacing:".3em",sx:{flexGrow:1},children:[(0,r.jsx)(Z.Ac,{children:"IP address"}),(0,r.jsx)(W.Z,{sx:{flexGrow:1}})]}),(0,r.jsx)(W.Z,{sx:{flexGrow:1}})]}),allowCheckAll:C,allowCheckItem:!0,allowDelete:!0,allowEdit:!1,disableDelete:!w,edit:!0,getListCheckboxProps:()=>({checked:v}),listEmpty:(0,r.jsx)(Z.Ac,{align:"center",children:"No conflicting keys found."}),listItems:d,onAllCheckboxChange:(e,t)=>{y(t)},onDelete:()=>{var e;let t=g.reduce((e,t)=>{let n=f(t);if(!n)return e;let{hostUUID:r}=d[t];return e[r]||(e[r]=[]),e[r].push(t),e},{});x({actionProceedText:"Delete",content:"Resolve ".concat(g.length," SSH key conflicts. Please make sure the identity change(s) are expected to avoid MITM attacks."),onProceedAppend:()=>{m.Z.delete("/ssh-key/conflict",{data:t}).catch(e=>{let t=(0,b.Z)(e);t.children="Failed to delete selected SSH key conflicts. ".concat(t.children),s(t)})},proceedColour:"red",titleText:"Delete ".concat(g.length," conflicting SSH keys?")}),null===(e=l.current.setOpen)||void 0===e||e.call(null,!0)},onItemCheckboxChange:(e,t,n)=>{P(e,n)},renderListItem:(e,t)=>{let{hostName:n,ipAddress:l}=t;return(0,r.jsxs)(j.Z,{spacing:0,sm:"row",sx:{width:"100%","& > *":{flexBasis:"50%"}},xs:"column",children:[(0,r.jsx)(Z.Ac,{children:n}),(0,r.jsx)(Z.Ac,{children:l})]})},renderListItemCheckboxState:e=>f(e)})]}),k]}),(0,r.jsx)(c.Z,{closeOnProceed:!0,...h,ref:l})]})};let U="common-user-input-confirm-password",L="common-user-input-name",H="common-user-input-password",V="Username",$="Password";var StrikerConfig_CommonUserInputGroup=e=>{let{formUtils:{buildFinishInputTestBatchFunction:t,buildInputFirstRenderFunction:n,setMessage:l,setValidity:o},previous:{name:s}={},readOnlyUserName:a,requirePassword:c=!1,showPasswordField:d}=e,u=(0,i.useRef)({}),p=(0,i.useRef)({}),[m,x]=(0,i.useState)(c),g=(0,i.useMemo)(()=>d?{"common-user-input-cell-password":{children:(0,r.jsx)(y.Z,{input:(0,r.jsx)(k.Z,{id:H,label:$,type:h.Z.password}),inputTestBatch:(0,C.Gn)($,()=>{l(H)},{onFinishBatch:t(H)},e=>{l(H,{children:e})}),onBlurAppend:e=>{var t;let{target:{value:n}}=e;x(n.length>0),o(U,n===(null===(t=p.current.getValue)||void 0===t?void 0:t.call(null)))},onFirstRender:n(H),ref:u,required:c})},"common-user-input-cell-confirm-password":{children:(0,r.jsx)(y.Z,{input:(0,r.jsx)(k.Z,{id:U,inputProps:{readOnly:!m},label:"Confirm password",type:h.Z.password}),inputTestBatch:{defaults:{onSuccess:()=>{l(U)}},onFinishBatch:t(U),tests:[{test:C.HJ},{onFailure:()=>{l(U,{children:"The passwords do not match."})},test:e=>{var t;let{value:n}=e;return n===(null===(t=u.current.getValue)||void 0===t?void 0:t.call(null))}}]},onFirstRender:n(U),ref:p,required:m})}}:void 0,[t,n,m,c,l,o,d]);return(0,r.jsx)(v.Z,{columns:{xs:1,sm:2,md:3},layout:{"common-user-input-cell-name":{children:(0,r.jsx)(y.Z,{input:(0,r.jsx)(k.Z,{id:L,inputProps:{readOnly:a},label:V,value:s}),inputTestBatch:(0,C.Gn)(V,()=>{l(L)},{onFinishBatch:t(L)},e=>{l(L,{children:e})}),onFirstRender:n(L),required:!0}),md:1,sm:2},...g},spacing:"1em"})},G=n(87038),z=n(15079),K=n(58839),q=n(96867);let getFormEntries=function(){for(var e=arguments.length,t=Array(e),n=0;n{let e=(0,i.useRef)({}),t=(0,i.useRef)({}),n=(0,i.useRef)({}),l=(0,i.useRef)({}),[o,s]=(0,K.Z)(),[d,p]=(0,i.useState)(!1),[h,m]=(0,i.useState)({children:"No users found."}),[x,g]=(0,i.useState)(),{data:f,isLoading:j}=(0,u.Z)("".concat(a.Z,"/user"),{onError:e=>{m((0,b.Z)(e))}}),v=(0,q.Z)([U,L,H],l),{isFormInvalid:w,isFormSubmitting:y,submitForm:k}=v,{buildDeleteDialogProps:C,checks:S,getCheck:A,hasChecks:M,setCheck:F}=(0,N.Z)({list:f}),{userName:I,userUUID:D}=(0,i.useMemo)(()=>null!=x?x:{},[x]),O=(0,i.useMemo)(()=>({actionProceedText:"Add",content:(0,r.jsx)(StrikerConfig_CommonUserInputGroup,{formUtils:v,requirePassword:!0,showPasswordField:!0}),onSubmitAppend:function(){for(var e,n=arguments.length,l=Array(n),o=0;o{k({body:i,getErrorMsg:e=>(0,r.jsxs)(r.Fragment,{children:["Add user failed. ",e]}),method:"post",successMsg:"Created user ".concat(i.userName,"."),url:"/user"})},titleText:"Add the following new user?"}),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},titleText:"Add a web interface user"}),[v,s,k]),R=(0,i.useMemo)(()=>({actionProceedText:"Edit",content:(0,r.jsx)(StrikerConfig_CommonUserInputGroup,{formUtils:v,previous:{name:I},readOnlyUserName:"admin"===I,showPasswordField:!0}),onSubmitAppend:function(){for(var e,n=arguments.length,l=Array(n),o=0;o{k({body:i,getErrorMsg:e=>(0,r.jsxs)(r.Fragment,{children:["Update user failed. ",e]}),method:"put",successMsg:"Updated user ".concat(I),url:"/user/".concat(D)})},titleText:"Update user ".concat(I," with the following?")}),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},titleText:"Edit user ".concat(I)}),[v,s,k,I,D]),W=(0,i.useMemo)(()=>(0,r.jsx)(P.Z,{count:1,defaultMessageType:"warning",ref:l}),[]),B=(0,i.useMemo)(()=>{var e;return(null==f?void 0:null===(e=f.current)||void 0===e?void 0:e.userName)==="admin"},[f]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(E.TZ,{header:"Manage users",loading:j,children:(0,r.jsx)(_.Z,{allowAddItem:B,allowDelete:B,allowEdit:!0,allowItemButton:d,disableDelete:!M,edit:d,getListItemCheckboxProps:(e,t)=>{let{userName:n}=t;return{disabled:"admin"===n}},header:!0,listEmpty:(0,r.jsx)(T.Z,{...h}),listItems:f,onAdd:()=>{var t;null===(t=e.current.setOpen)||void 0===t||t.call(null,!0)},onDelete:()=>{var e;s(C({confirmDialogProps:{onProceedAppend:()=>{k({body:{uuids:S},getErrorMsg:e=>(0,r.jsxs)(r.Fragment,{children:["Delete user(s) failed. ",e]}),method:"delete",url:"/user"})}},formSummaryProps:{renderEntry:e=>{let{key:t}=e;return(0,r.jsx)(Z.Ac,{children:null==f?void 0:f[t].userName})}},getConfirmDialogTitle:e=>"Delete the following ".concat(e," users?")})),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:()=>p(e=>!e),onItemCheckboxChange:(e,t,n)=>F(e,n),onItemClick:e=>{if(d){var t;g(e),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},renderListItemCheckboxState:e=>A(e),renderListItem:(e,t)=>{let{userName:n}=t;return(0,r.jsx)(Z.Ac,{children:n})}})}),(0,r.jsx)(G.Z,{...O,disableProceed:w,loadingAction:y,preActionArea:W,ref:e}),(0,r.jsx)(G.Z,{...R,disableProceed:w,loadingAction:y,preActionArea:W,ref:n}),(0,r.jsx)(c.Z,{closeOnProceed:!0,...o,ref:t})]})},StrikerConfig_ComplexOperationsPanel=()=>(0,r.jsxs)(E.s_,{children:[(0,r.jsx)(StrikerConfig_ConfigPeersForm,{}),(0,r.jsx)(StrikerConfig_ManageChangedSSHKeysForm,{}),(0,r.jsx)(StrikerConfig_ManageUsersForm,{})]}),X=n(72852),Y=n(19467),J=n(81796);let StretchedButton=e=>(0,r.jsx)(Y.Z,{...e,sx:{width:"100%"}});var StrikerConfig_SimpleOperationsPanel=e=>{let{installTarget:t="disabled",onSubmit:n,title:o}=e,[s,a]=(0,i.useState)(),c=(0,i.useMemo)(()=>o?(0,r.jsx)(Z.z,{sx:{textAlign:"center"},children:o}):(0,r.jsx)(J.Z,{mt:0}),[o]),d=(0,i.useMemo)(()=>s&&(0,r.jsx)(l.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(T.Z,{...s,onClose:()=>{a(void 0)}})}),[s,a]);return(0,r.jsxs)(E.s_,{children:[(0,r.jsx)(E.V9,{children:c}),(0,r.jsxs)(l.ZP,{columns:{xs:1,sm:2},container:!0,spacing:"1em",children:[(0,r.jsx)(l.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsxs)(j.Z,{row:!0,children:[(0,r.jsx)(Z.Ac,{sx:{flexGrow:1},children:"Install target"}),(0,r.jsx)(X.Z,{checked:"enabled"===t,edge:"end",onChange:(e,t)=>{let l="disable",s="Disable";t&&(l="enable",s="Enable"),null==n||n.call(null,{actionProceedText:s,content:(0,r.jsxs)(Z.Ac,{children:["Would you like to ",l,' "Install target" on this striker? It\'ll take a few moments to complete.']}),onProceedAppend:()=>{m.Z.put("/host/local",{isEnableInstallTarget:t},{params:{handler:"install-target"}}).catch(e=>{let t=(0,b.Z)(e);t.children="Failed to ".concat(l,' "Install target". ').concat(t.children),a(t)})},titleText:"".concat(s,' "Install target" on ').concat(o,"?")})}})]})}),(0,r.jsx)(l.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(StretchedButton,{onClick:()=>{null==n||n.call(null,{actionProceedText:"Update",content:(0,r.jsx)(Z.Ac,{children:"Would you like to update the operating system on this striker? It'll be placed into maintenance mode until the update completes."}),onProceedAppend:()=>{m.Z.put("/command/update-system").catch(e=>{let t=(0,b.Z)(e);t.children="Failed to initiate system update. ".concat(t.children),a(t)})},titleText:"Update operating system on ".concat(o,"?")})},children:"Update system"})}),(0,r.jsx)(l.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(StretchedButton,{href:"/init?re=1",children:"Reconfigure striker"})}),(0,r.jsx)(l.ZP,{item:!0,xs:1,children:(0,r.jsx)(StretchedButton,{onClick:()=>{null==n||n.call(null,{actionProceedText:"Reboot",content:(0,r.jsx)(Z.Ac,{children:"Would you like to reboot this striker?"}),onProceedAppend:()=>{m.Z.put("/command/reboot-host").catch(e=>{let t=(0,b.Z)(e);t.children="Failed to initiate system reboot. ".concat(t.children),a(t)})},titleText:"Reboot ".concat(o,"?")})},children:"Reboot"})}),(0,r.jsx)(l.ZP,{item:!0,xs:1,children:(0,r.jsx)(StretchedButton,{onClick:()=>{null==n||n.call(null,{actionProceedText:"Shutdown",content:(0,r.jsx)(Z.Ac,{children:"Would you like to shutdown this striker?"}),onProceedAppend:()=>{m.Z.put("/command/poweroff-host").catch(e=>{let t=(0,b.Z)(e);t.children="Failed to initiate system shutdown. ".concat(t.children),a(t)})},titleText:"Shutdown ".concat(o,"?")})},children:"Shutdown"})}),d]})]})},config=e=>{let{refreshInterval:t=6e4}=e,[n,o]=(0,i.useState)(!1),[p,h]=(0,i.useState)({actionProceedText:"",closeOnProceed:!0,content:"",dialogProps:{open:n},onCancelAppend:()=>{o(!1)},onProceedAppend:()=>{o(!1)},titleText:""}),[m,x]=(0,i.useState)(),[g,f]=(0,i.useState)(""),{data:Z,isLoading:j}=(0,u.Z)("".concat(a.Z,"/host/local"),{onError:()=>{f("Unknown")},onSuccess:e=>{let{installTarget:t,shortHostName:n}=e;x(t),f(n)},refreshInterval:t});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s(),{children:(0,r.jsx)("title",{children:j?"Loading...":"".concat(null==Z?void 0:Z.shortHostName," Config")})}),(0,r.jsx)(d.Z,{}),(0,r.jsxs)(l.ZP,{container:!0,columns:{xs:1,md:3,lg:4},children:[(0,r.jsx)(l.ZP,{item:!0,xs:1,children:(0,r.jsx)(StrikerConfig_SimpleOperationsPanel,{installTarget:m,onSubmit:e=>{let{onProceedAppend:t,...n}=e;h(e=>({...e,...n,onProceedAppend:function(){for(var e=arguments.length,n=Array(e),r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase();if(!("string"==typeof n&&o.test(n)))throw TypeError("Stringified UUID is invalid");return n},esm_browser_v4=function(e,t,n){var o=(e=e||{}).random||(e.rng||function(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(l)})();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var s=0;s<16;++s)t[n+s]=o[s];return t}return esm_browser_stringify(o)}}},function(e){e.O(0,[494,804,416,263,461,203,775,675,556,774,888,179],function(){return e(e.s=14453)}),_N_E=e.O()}]);