(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[817],{2026:function(e,t,n){"use strict";var r=n(7892),o=n(5893);t.Z=(0,r.Z)((0,o.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check")},2852:function(e,t,n){"use strict";var r=n(3366),o=n(7462),i=n(7294),a=n(6010),c=n(7192),s=n(1796),l=n(8216),d=n(1964),u=n(3616),h=n(1496),f=n(9632),x=n(5893);const g=["className","color","edge","size","sx"],m=(0,h.ZP)("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.edge&&t[`edge${(0,l.Z)(n.edge)}`],t[`size${(0,l.Z)(n.size)}`]]}})((({ownerState:e})=>(0,o.Z)({display:"inline-flex",width:58,height:38,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"}},"start"===e.edge&&{marginLeft:-8},"end"===e.edge&&{marginRight:-8},"small"===e.size&&{width:40,height:24,padding:7,[`& .${f.Z.thumb}`]:{width:16,height:16},[`& .${f.Z.switchBase}`]:{padding:4,[`&.${f.Z.checked}`]:{transform:"translateX(16px)"}}}))),v=(0,h.ZP)(d.Z,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.switchBase,{[`& .${f.Z.input}`]:t.input},"default"!==n.color&&t[`color${(0,l.Z)(n.color)}`]]}})((({theme:e})=>({position:"absolute",top:0,left:0,zIndex:1,color:"light"===e.palette.mode?e.palette.common.white:e.palette.grey[300],transition:e.transitions.create(["left","transform"],{duration:e.transitions.duration.shortest}),[`&.${f.Z.checked}`]:{transform:"translateX(20px)"},[`&.${f.Z.disabled}`]:{color:"light"===e.palette.mode?e.palette.grey[100]:e.palette.grey[600]},[`&.${f.Z.checked} + .${f.Z.track}`]:{opacity:.5},[`&.${f.Z.disabled} + .${f.Z.track}`]:{opacity:"light"===e.palette.mode?.12:.2},[`& .${f.Z.input}`]:{left:"-100%",width:"300%"}})),(({theme:e,ownerState:t})=>(0,o.Z)({"&:hover":{backgroundColor:(0,s.Fq)(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"default"!==t.color&&{[`&.${f.Z.checked}`]:{color:e.palette[t.color].main,"&:hover":{backgroundColor:(0,s.Fq)(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${f.Z.disabled}`]:{color:"light"===e.palette.mode?(0,s.$n)(e.palette[t.color].main,.62):(0,s._j)(e.palette[t.color].main,.55)}},[`&.${f.Z.checked} + .${f.Z.track}`]:{backgroundColor:e.palette[t.color].main}}))),p=(0,h.ZP)("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(e,t)=>t.track})((({theme:e})=>({height:"100%",width:"100%",borderRadius:7,zIndex:-1,transition:e.transitions.create(["opacity","background-color"],{duration:e.transitions.duration.shortest}),backgroundColor:"light"===e.palette.mode?e.palette.common.black:e.palette.common.white,opacity:"light"===e.palette.mode?.38:.3}))),b=(0,h.ZP)("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(e,t)=>t.thumb})((({theme:e})=>({boxShadow:e.shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"}))),j=i.forwardRef((function(e,t){const n=(0,u.Z)({props:e,name:"MuiSwitch"}),{className:i,color:s="primary",edge:d=!1,size:h="medium",sx:j}=n,Z=(0,r.Z)(n,g),w=(0,o.Z)({},n,{color:s,edge:d,size:h}),_=(e=>{const{classes:t,edge:n,size:r,color:i,checked:a,disabled:s}=e,d={root:["root",n&&`edge${(0,l.Z)(n)}`,`size${(0,l.Z)(r)}`],switchBase:["switchBase",`color${(0,l.Z)(i)}`,a&&"checked",s&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},u=(0,c.Z)(d,f.H,t);return(0,o.Z)({},t,u)})(w),y=(0,x.jsx)(b,{className:_.thumb,ownerState:w});return(0,x.jsxs)(m,{className:(0,a.Z)(_.root,i),sx:j,ownerState:w,children:[(0,x.jsx)(v,(0,o.Z)({type:"checkbox",icon:y,checkedIcon:y,ref:t,ownerState:w},Z,{classes:(0,o.Z)({},_,{root:_.switchBase})})),(0,x.jsx)(p,{className:_.track,ownerState:w})]})}));t.Z=j},6069:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/anvil",function(){return n(1692)}])},1939:function(e,t,n){"use strict";var r=n(5893),o=n(7357),i=n(7169);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l="Decorator",d={ok:"".concat(l,"-ok"),warning:"".concat(l,"-warning"),error:"".concat(l,"-error"),off:"".concat(l,"-off")};t.Z=function(e){var t,n=e.colour,l=e.sx,u=s(e,["colour","sx"]);return(0,r.jsx)(o.Z,c({},u,{className:d[n],sx:c((t={borderRadius:i.n_,height:"100%",width:"1.4em"},a(t,"&.".concat(d.ok),{backgroundColor:i.Ej}),a(t,"&.".concat(d.warning),{backgroundColor:i.Wd}),a(t,"&.".concat(d.error),{backgroundColor:i.hM}),a(t,"&.".concat(d.off),{backgroundColor:i.s7}),t),l)}))}},1692:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Je}});var r=n(5893),o=n(1496),i=n(7357),a=n(9008),c=n(1163),s=n(7294),l=n(7169),d={uuid:"",setAnvilUuid:function(){return null}},u=(0,s.createContext)(d),h=function(e){var t=e.children,n=(0,s.useState)(""),o=n[0],i=n[1];return(0,r.jsx)(u.Provider,{value:{uuid:o,setAnvilUuid:function(e){i(e)}},children:t})},f=n(3679),x=n(1905),g=n(2852),m=n(2416),v=new Map([["optimal","Optimal"],["not_ready","Not Ready"],["degraded","Degraded"]]),p=n(1939),b=n(8336);var j={anvilName:"".concat("SelectedAnvil","-anvilName")},Z=(0,o.ZP)(i.Z)((function(){return e={display:"flex",flexDirection:"row",width:"100%"},t="& .".concat(j.anvilName),n={paddingLeft:0},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e;var e,t,n})),w=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";default:return"error"}},_=function(e){return!(-1===e.hosts.findIndex((function(e){return"offline"!==e.state})))},y=function(e){var t=e.list,n=(0,s.useContext)(u).uuid,o=t.findIndex((function(e){return e.anvil_uuid===n}));return(0,r.jsx)(Z,{children:""!==n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{p:1,children:(0,r.jsx)(p.Z,{colour:w(t[o].anvil_state)})}),(0,r.jsxs)(i.Z,{p:1,flexGrow:1,className:j.anvilName,children:[(0,r.jsx)(m.z,{text:t[o].anvil_name}),(0,r.jsx)(m.z,{text:v.get(t[o].anvil_state)||"State unavailable"})]}),(0,r.jsx)(i.Z,{p:1,children:(0,r.jsx)(g.Z,{checked:_(t[o]),onChange:function(){return(0,b.Z)("".concat("/cgi-bin","/set_power"),{anvil_uuid:t[o].anvil_uuid,is_on:!_(t[o])})}})})]})})},k=n(8462),A=n(7720),N=n(891),S=function(e){var t=e.anvil;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.Ac,{text:t.anvil_name}),(0,r.jsx)(m.Ac,{text:v.get(t.anvil_state)||"State unavailable"})]})};function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.hosts[1].link.link_speed?1:0;e.bond_speed=e.hosts[t].link.link_speed,e.bond_state=e.hosts[t].link.link_state})),n},ie=n(3144),ae=n(2749);function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nl.li?(0,r.jsxs)(i.Z,{className:Ye.container,children:[(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(R,{list:v}),(0,r.jsx)(ee,{anvil:v.anvils})]}),(0,r.jsx)(i.Z,{className:Ye.server,children:(0,r.jsx)(Me,{anvil:v.anvils})}),(0,r.jsx)(i.Z,{className:Ye.child,children:(0,r.jsx)(He,{})}),(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(xe,{}),(0,r.jsx)(I,{}),(0,r.jsx)(re,{})]})]}):(0,r.jsxs)(i.Z,{className:Ye.container,children:[(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(Me,{anvil:v.anvils}),(0,r.jsx)(R,{list:v}),(0,r.jsx)(ee,{anvil:v.anvils})]}),(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(xe,{}),(0,r.jsx)(He,{}),(0,r.jsx)(I,{}),(0,r.jsx)(re,{})]})]})),e}),[v,t]),j=(0,s.useMemo)((function(){return p?(0,r.jsx)(f.s_,{sx:{marginLeft:{xs:"1em",sm:"auto"},marginRight:{xs:"1em",sm:"auto"},marginTop:"calc(50vh - 10em)",maxWidth:{xs:void 0,sm:"60%",md:"50%",lg:"40%"},minWidth:"fit-content"},children:(0,r.jsx)(F.Z,{sx:{margin:"2em 2.4em"}})}):b}),[b,p]);return(0,s.useEffect)((function(){""===d&&g((null===n||void 0===n?void 0:n.toString())||"")}),[d,n,g]),(0,r.jsxs)(qe,{children:[(0,r.jsx)(a.default,{children:(0,r.jsx)("title",{children:"Anvil"})}),(0,r.jsxs)(h,{children:[(0,r.jsx)(G.Z,{}),j]})]})}},8600:function(e){"use strict";const t=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],n=["B","kiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],o=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],i=(e,t,n)=>{let r=e;return"string"===typeof t||Array.isArray(t)?r=e.toLocaleString(t,n):!0!==t&&void 0===n||(r=e.toLocaleString(void 0,n)),r};e.exports=(e,a)=>{if(!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const c=(a=Object.assign({bits:!1,binary:!1},a)).bits?a.binary?o:r:a.binary?n:t;if(a.signed&&0===e)return` 0 ${c[0]}`;const s=e<0,l=s?"-":a.signed?"+":"";let d;if(s&&(e=-e),void 0!==a.minimumFractionDigits&&(d={minimumFractionDigits:a.minimumFractionDigits}),void 0!==a.maximumFractionDigits&&(d=Object.assign({maximumFractionDigits:a.maximumFractionDigits},d)),e<1){return l+i(e,a.locale,d)+" "+c[0]}const u=Math.min(Math.floor(a.binary?Math.log(e)/Math.log(1024):Math.log10(e)/3),c.length-1);e/=Math.pow(a.binary?1024:1e3,u),d||(e=e.toPrecision(3));return l+i(Number(e),a.locale,d)+" "+c[u]}}},function(e){e.O(0,[738,688,7,643,536,369,315,818,141,892,149,774,888,179],(function(){return t=6069,e(e.s=t);var t}));var t=e.O();_N_E=t}]);