"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[898],{4594:function(e,n,t){var r=t(5893),o=t(6514),i=t(5113),a=t(4656),s=t(482),l=t(2994),c=t(7357),u=t(9890),p=t(7169),d=t(1363),f=t(6284);function v(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function m(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var g=function(e){return(0,r.jsx)(o.Z,{in:!0,children:(0,r.jsx)(i.Z,m({},e))})};n.Z=function(e){var n=e.componentsProps,t=e.extendRenderInput,o=e.label,i=e.messageBoxProps,h=e.renderInput,b=e.sx,y=x(e,["componentsProps","extendRenderInput","label","messageBoxProps","renderInput","sx"]),j=m({paper:{sx:{backgroundColor:p.lD}}},n),S=null!==h&&void 0!==h?h:function(e){var n=e.fullWidth,i=e.InputProps,a=e.InputLabelProps,s=e.inputProps,l={formControlProps:{fullWidth:n,ref:i.ref},inputLabelProps:a,inputProps:{className:i.className,endAdornment:i.endAdornment,inputProps:s,startAdornment:i.startAdornment},label:o};return null===t||void 0===t||t.call(null,l,e),(0,r.jsx)(f.Z,m({},l))},U=m(v({},"& .".concat(a.Z.root," .").concat(s.Z.endAdornment),v({right:"7px"},"& .".concat(l.Z.root),{color:p.s7})),b);return(0,r.jsxs)(c.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(u.Z,m({PaperComponent:g},y,{componentsProps:j,renderInput:S,sx:U})),(0,r.jsx)(d.Z,m({},i))]})}},8750:function(e,n,t){t.d(n,{Z:function(){return T}});var r=t(5893),o=t(1113),i=t(1496),a=t(2293),s=t(7357),l=t(2992),c=t(4799),u=t(7294),p=t(7169),d=t(4433),f=t(9029),v=t(7533),m=t(8462),x=t(7212),g=t(8619),h=[{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:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],b={width:"40em",height:"40em"},y=t(4390),j=t(582),S=t(4690),U=t(1770),I=t(7750),P=t(1883);function O(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function D(e){for(var n=1;n0)},ref:n})]})}},4427:function(e,n,t){var r=t(5893),o=t(2429),i=t(9309),a=t(7169);function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e){for(var n=1;n :first-child":{flexGrow:1},"& > :not(:last-child)":{marginRight:".5em"}},"&:hover\n .".concat(y.Z.root,"\n .").concat(j.Z.root,"\n .").concat(j.Z.notchedOutline),{borderColor:p.s7}),children:[(0,r.jsx)(b.Z,P({id:n,label:t},i)),(0,r.jsx)(U.Z,P({formControlProps:{fullWidth:!1},id:"".concat(n,"-nested-select"),selectItems:c},d))]}),(0,r.jsx)(S.Z,P({},l))]})};D.defaultProps=O;var Z=D,w=t(3679),C=t(3640),M=t(6727),k=t(1184),A=t(9),G=t(192),B=t(7750);function z(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function E(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 t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))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 W={inputLabelProps:{},isAllowTextInput:!1,labelId:"",messageBoxProps:{},sliderProps:{}},V={root:"".concat("SliderInputLabelDecorator","-root")},R=function(e){var n=e.isFocused,t=e.label,o=p.s7,i="solid",s="0",l="0 .6em 0 .4em",c="1px 0 0 0",u="0.3";return n&&(s="-1px",l="0 1em 0 1em",c="2px 0 0 0",u="1"),(0,r.jsxs)(a.Z,{className:V.root,sx:{display:"flex",flexDirection:"row",position:"absolute",top:s,width:"calc(100% - 6px)","> :last-child":{flexGrow:1}},children:[(0,r.jsx)(a.Z,{sx:{borderColor:o,borderStyle:i,borderWidth:c,content:'""',opacity:u,width:".6em"}}),(0,r.jsx)(B.Ac,{sx:{fontSize:".75em",margin:l,visibility:"hidden"},text:t}),(0,r.jsx)(a.Z,{sx:{borderColor:o,borderStyle:i,borderWidth:c,content:'""',opacity:u}})]})},_=function(e,n){var t=Number.parseFloat(e);return Number.isNaN(t)?n:t},Q=function(e){return T(e,Array)?e.map((function(e){return String(e)})):[String(e)]},q=function(e){var n,t=e.messageBoxProps,i=void 0===t?W.messageBoxProps:t,s=e.isAllowTextInput,l=void 0===s?W.isAllowTextInput:s,c=e.label,u=e.labelId,d=void 0===u?W.labelId:u,f=e.inputLabelProps,v=void 0===f?W.inputLabelProps:f,m=e.sliderProps,x=void 0===m?W.sliderProps:m,g=e.value,h=x.max,b=x.min,y=x.onChange,U=x.sx,I=x.valueLabelDisplay,P=g,O=(0,o.useState)({range:Q(g)}),D=O[0],Z=O[1],w=(0,o.useState)(!1),B=w[0],z=w[1],q=function(){z(!1)},H=function(){z(!0)},Y=function(){P=function(e,n){return T(n,Array)?e.map((function(e,t){return _(e,n[t])})):_(e[0],n)}(D.range,P),null===y||void 0===y||y.call(null,P)};return(0,r.jsxs)(C.Z,{sx:{display:"flex",flexDirection:"column","&:hover":(n={},F(n,"& .".concat(V.root," div"),{opacity:1}),F(n,"& .".concat(j.Z.notchedOutline),{borderColor:p.s7}),n)},children:[(0,r.jsx)(G.Z,N({className:B?M.Z.focused:"",id:d,shrink:!0},v,{children:c})),R({isFocused:B,label:c}),(0,r.jsxs)(a.Z,{sx:{alignItems:"center",display:"flex",flexDirection:"row","> :first-child":{flexGrow:1}},children:[(0,r.jsx)(k.ZP,{"aria-labelledby":d,max:h,min:b,onBlur:q,onChange:function(e,n){Z({range:Q(n)}),null===y||void 0===y||y.call(null,n)},onFocus:H,sx:N(F({color:p.s7,marginLeft:"1em",marginRight:"1em"},"& .".concat(k.TW.thumb),{borderRadius:p.n_,transform:"translate(-50%, -50%) rotate(45deg)"}),U),value:P,valueLabelDisplay:I}),D.range.map((function(e,n){return function(e){var n=e.key,t=e.isFocused,o=L(e,["key","isFocused"]);return(0,r.jsx)(A.Z,N({key:n,className:t?j.Z.focused:"",type:"number"},o))}({key:"slider-nested-text-input-".concat(n),inputProps:{max:h,min:b},isFocused:B,onBlur:q,onChange:function(){for(var e=arguments.length,t=new Array(e),r=0;re.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function oe(e,n){return X(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,s=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==t.return||t.return()}finally{if(s)throw o}}return i}}(e,n)||se(e,n)||ne()}function ie(e){return X(e)||ee(e)||se(e,i)||ne()}function ae(e){return function(e){if(Array.isArray(e))return K(e)}(e)||ee(e)||se(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.")}()}function se(e,n){if(e){if("string"===typeof e)return K(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?K(e,n):void 0}}var le,ce,ue=BigInt(0),pe=[{value:"B"},{value:"KiB"},{value:"MiB"},{value:"GiB"},{value:"TiB"}],de="GiB",fe=BigInt(65536),ve=BigInt(104857600),me={backgroundColor:p.Ej,color:p.lD,"&:hover":{backgroundColor:p.Ej}},xe=function(e,n){var t=n.onButtonClick;return(0,r.jsx)(m.Z,{disabled:void 0===t,onClick:t,sx:{minWidth:"unset",whiteSpace:"nowrap"},children:"Max: ".concat(e)})},ge=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.endAdornment,t=e.mainLabel,o=e.subLabel;return(0,r.jsxs)(a.Z,{sx:{alignItems:"center",display:"flex",flexDirection:"row",width:"100%","& > :first-child":{flexGrow:1}},children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:[t&&(0,r.jsx)(B.Ac,{inverted:!0,text:t}),o&&(0,r.jsx)(B.Ac,{inverted:!0,text:o})]}),n]})},he=function(e,n,t,r,o,i,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},l=s.includeAnvilUUIDs,c=void 0===l?[]:l,u=s.includeFileUUIDs,p=void 0===u?[]:u,d=s.includeStorageGroupUUIDs,f=void 0===d?[]:d,v=function(){return!0},m=function(){return!0},x=function(){return!0};c.length>0&&(v=function(e){return c.includes(e)}),p.length>0&&(m=function(e){return p.includes(e)}),f.length>0&&(x=function(e){return f.includes(e)});var g={},h=i.reduce((function(e,n,t){var r,i=null!==(r=o[t])&&void 0!==r?r:ue;return e.all+=i,""===n||(void 0===e[n]&&(e[n]=ue),e[n]+=i),e}),{all:ue}),b=e.reduce((function(e,s){var l=s.anvilUUID;if(v(l)){var c,u=s.anvilTotalCPUCores,p=s.anvilTotalAvailableMemory,d=s.files,f=s.fileUUIDs,b=s.storageGroups,y=[],j=ue,S=ue;if(b.forEach((function(e){var n=e.storageGroupUUID,t=e.storageGroupFree;x(n)&&(y.push(n),S+=t,t>j&&(j=t))})),[function(){return b.length>0},function(){return t<=u},function(){return r<=p},function(){return i.every((function(e,t){var r,i=null!==(r=o[t])&&void 0!==r?r:ue,a=!0,s=i<=j;return""!==e&&(a=y.includes(e),s=i<=n[e].storageGroupFree),a&&s}))},function(){return Object.entries(h).every((function(e){var t=oe(e,2),r=t[0],o=t[1];return"all"===r?o<=S:o<=n[r].storageGroupFree}))},function(){return a.every((function(e){return""===e||f.includes(e)}))}].every((function(e){return e()})))e.anvils.push(s),e.anvilUUIDs.push(l),e.maxCPUCores=Math.max(u,e.maxCPUCores),p>e.maxMemory&&(e.maxMemory=p),d.forEach((function(e){var n=e.fileUUID;m(n)&&(g[n]=!0)})),(c=e.storageGroupUUIDs).push.apply(c,ae(y)),e.maxVirtualDiskSizes.fill(j)}return e}),{anvils:[],anvilUUIDs:[],fileUUIDs:[],maxCPUCores:0,maxMemory:ue,maxVirtualDiskSizes:i.map((function(){return ue})),storageGroupUUIDs:[]});return b.fileUUIDs=Object.keys(g),i.forEach((function(e,t){""!==e&&(b.maxVirtualDiskSizes[t]=n[e].storageGroupFree)})),b},be=function(e){return e.filter((function(e){return""!==e}))},ye=function(e){return{fromUnit:"B",onSuccess:{string:e},precision:0,toUnit:"ibyte"}};(0,x.Bh)(fe,ye((function(e,n){le="".concat(e," ").concat(n)}))),(0,x.Bh)(ve,ye((function(e,n){ce="".concat(e," ").concat(n)})));var je=function(e){var n=e.dialogProps.open,t=e.onClose,i=(0,o.useState)([]),y=i[0],j=i[1],S=(0,o.useState)({}),I=S[0],P=S[1],O=(0,o.useState)({}),D=O[0],C=O[1],M=(0,o.useState)({}),k=M[0],A=M[1],G=(0,o.useState)({}),z=G[0],F=G[1],T=(0,o.useState)([]),N=T[0],L=T[1],E=(0,o.useState)([]),W=E[0],V=E[1],R=(0,o.useState)([]),_=R[0],Q=R[1],q=(0,o.useState)([]),K=q[0],X=q[1],ee=(0,o.useState)(""),ne=ee[0],se=ee[1],ye=(0,o.useState)(),je=ye[0],Se=ye[1],Ue=(0,o.useState)(1),Ie=Ue[0],Pe=Ue[1],Oe=(0,o.useState)(0),De=Oe[0],Ze=Oe[1],we=(0,o.useState)(),Ce=we[0],Me=we[1],ke=(0,o.useState)(ue),Ae=ke[0],Ge=ke[1],Be=(0,o.useState)(ue),ze=Be[0],Fe=Be[1],Te=(0,o.useState)(),Ne=Te[0],Le=Te[1],Ee=(0,o.useState)("0"),We=Ee[0],Ve=Ee[1],Re=(0,o.useState)(""),_e=Re[0],Qe=Re[1],qe=(0,o.useState)(de),He=qe[0],Ye=qe[1],Je=(0,o.useState)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.existingVirtualDisks,t=void 0===n?{stateIds:[],inputMaxes:[],inputSizeMessages:[],inputSizes:[],inputStorageGroupUUIDMessages:[],inputStorageGroupUUIDs:[],inputUnits:[],maxes:[],sizes:[]}:n,r=e.stateId,o=void 0===r?(0,u.Z)():r,i=e.inputMax,a=void 0===i?"0":i,s=e.inputSize,l=void 0===s?"":s,c=e.inputSizeMessage,p=void 0===c?void 0:c,d=e.inputStorageGroupUUID,f=void 0===d?"":d,v=e.inputStorageGroupUUIDMessage,m=void 0===v?void 0:v,x=e.inputUnit,g=void 0===x?de:x,h=e.max,b=void 0===h?ue:h,y=e.setVirtualDisks,j=e.size,S=void 0===j?ue:j,U=t.stateIds,I=t.inputMaxes,P=t.inputSizeMessages,O=t.inputSizes,D=t.inputStorageGroupUUIDMessages,Z=t.inputStorageGroupUUIDs,w=t.inputUnits,C=t.maxes,M=t.sizes;return U.push(o),I.push(a),P.push(p),O.push(l),D.push(m),Z.push(f),w.push(g),C.push(b),M.push(S),null===y||void 0===y||y.call(null,te({},t)),t}()),Ke=Je[0],Xe=Je[1],$e=(0,o.useState)(""),en=$e[0],nn=$e[1],tn=(0,o.useState)(),rn=tn[0],on=tn[1],an=(0,o.useState)(""),sn=an[0],ln=an[1],cn=(0,o.useState)()[0],un=(0,o.useState)(""),pn=un[0],dn=un[1],fn=(0,o.useState)(),vn=fn[0],mn=fn[1],xn=(0,o.useState)(null),gn=xn[0],hn=xn[1],bn=(0,o.useState)(),yn=bn[0],jn=bn[1],Sn=(0,o.useState)([]),Un=Sn[0],In=Sn[1],Pn=(0,o.useState)([]),On=Pn[0],Dn=Pn[1],Zn=(0,o.useState)([]),wn=Zn[0],Cn=Zn[1],Mn=(0,o.useState)(!1),kn=Mn[0],An=Mn[1],Gn=(0,o.useState)(!1),Bn=Gn[0],zn=Gn[1],Fn=(0,o.useState)(!1),Tn=Fn[0],Nn=Fn[1],Ln=(0,o.useState)(0),En=Ln[0],Wn=Ln[1],Vn={serverName:{defaults:{onSuccess:function(){Se(void 0)},value:ne},tests:[{onFailure:function(){Se({text:"The server name length must be 1 to 16 characters.",type:"warning"})},test:function(e){var n=e.value.length;return n>=1&&n<=16}},{onFailure:function(){Se({text:"The server name is expected to only contain alphanumeric, hyphen, or underscore characters.",type:"warning"})},test:function(e){var n=e.value;return/^[a-zA-Z0-9_-]+$/.test(n)}},{onFailure:function(){Se({text:"This server name already exists, please choose another name.",type:"warning"})},test:function(e){var n=e.value;return void 0===k[n]}}]},cpuCores:{defaults:{max:De,min:1,onSuccess:function(){Me(void 0)},value:Ie},tests:[{onFailure:function(){Me({text:"Non available.",type:"warning"})},test:J.X7},{onFailure:function(e){var n=e.displayMax,t=e.displayMin;Me({text:"The number of CPU cores is expected to be between ".concat(t," and ").concat(n,"."),type:"warning"})},test:J.SQ}]},memory:{defaults:{displayMax:"".concat(We," ").concat(He),displayMin:le,max:ze,min:fe,onSuccess:function(){Le(void 0)},value:Ae},tests:[{onFailure:function(){Le({text:"Non available.",type:"warning"})},test:J.X7},{onFailure:function(e){var n=e.displayMax,t=e.displayMin;Le({text:"Memory is expected to be between ".concat(t," and ").concat(n,"."),type:"warning"})},test:J.SQ}]},installISO:{defaults:{onSuccess:function(){on(void 0)},value:en},tests:[{test:J.HJ}]},anvil:{defaults:{onSuccess:function(){mn(void 0)},value:pn},tests:[{test:J.HJ}]},optimizeForOS:{defaults:{onSuccess:function(){jn(void 0)},value:null===gn||void 0===gn?void 0:gn.key},tests:[{test:J.HJ}]}};Ke.inputSizeMessages.forEach((function(e,n){Vn["vd".concat(n,"Size")]={defaults:{displayMax:"".concat(Ke.inputMaxes[n]," ").concat(Ke.inputUnits[n]),displayMin:ce,max:Ke.maxes[n],min:ve,onSuccess:function(){Ke.inputSizeMessages[n]=void 0},value:Ke.sizes[n]},onFinishBatch:function(){Xe(te({},Ke))},tests:[{onFailure:function(){Ke.inputSizeMessages[n]={text:"Non available.",type:"warning"}},test:J.X7},{onFailure:function(e){var t=e.displayMax,r=e.displayMin;Ke.inputSizeMessages[n]={text:"Virtual disk ".concat(n," size is expected to be between ").concat(r," and ").concat(t,"."),type:"warning"}},test:J.SQ}]},Vn["vd".concat(n,"StorageGroup")]={defaults:{onSuccess:function(){Ke.inputStorageGroupUUIDMessages[n]=void 0},value:Ke.inputStorageGroupUUIDs[n]},onFinishBatch:function(){Xe(te({},Ke))},tests:[{test:J.HJ}]}}));var Rn,_n,Qn,qn,Hn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.allAnvils,t=void 0===n?y:n,r=e.cpuCores,o=void 0===r?Ie:r,i=e.fileUUIDs,a=void 0===i?[en,sn]:i,s=e.includeAnvilUUIDs,l=void 0===s?be([pn]):s,c=e.includeFileUUIDs,u=e.includeStorageGroupUUIDs,p=e.inputMemoryUnit,d=void 0===p?He:p,f=e.memory,v=void 0===f?Ae:f,m=e.storageGroupUUIDMapToData,g=void 0===m?z:m,h=e.virtualDisks,b=void 0===h?Ke:h,j=he(t,g,o,v,b.sizes,b.inputStorageGroupUUIDs,a,{includeAnvilUUIDs:l,includeFileUUIDs:c,includeStorageGroupUUIDs:u}),S=j.anvilUUIDs,U=j.fileUUIDs,I=j.maxCPUCores,P=j.maxMemory,O=j.maxVirtualDiskSizes,D=j.storageGroupUUIDs;Ze(I),Fe(P);var Z=[];b.maxes=O,b.maxes.forEach((function(e,n){(0,x.Bh)(e,{fromUnit:"B",onSuccess:{string:function(e,t){b.inputMaxes[n]=e,Z[n]="".concat(e," ").concat(t)}},toUnit:b.inputUnits[n]})})),Xe(te({},b)),In(S),Dn(U),Cn(D);var w="";return(0,x.Bh)(P,{fromUnit:"B",onSuccess:{string:function(e,n){Ve(e),w="".concat(e," ").concat(n)}},toUnit:d}),{formattedMaxMemory:w,formattedMaxVDSizes:Z,maxCPUCores:I,maxMemory:P,maxVirtualDiskSizes:O}},Yn=(0,o.useCallback)(Hn,[]),Jn=function(){for(var e=arguments.length,n=new Array(e),t=0;t0&&void 0!==arguments[0]?arguments[0]:{},n=e.cmValue,t=void 0===n?ue:n,r=e.cmUnit,o=void 0===r?He:r;Ge(t);var i=Hn({inputMemoryUnit:o,memory:t}),a=i.formattedMaxMemory,s=i.maxMemory;Jn({inputs:{memory:{displayMax:a,max:s,value:t}}})},Xn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.value,t=void 0===n?_e:n,r=e.unit,o=void 0===r?He:r;t!==_e&&Qe(t),o!==He&&Ye(o),(0,x.KY)(t,o,(function(e){return Kn({cmValue:e,cmUnit:o})}),(function(){return Kn({cmUnit:o})}))},$n=function(e){nn(e),Hn({fileUUIDs:[e,sn]})},et=function(e){ln(e),Hn({fileUUIDs:[en,e]})},nt=function(e){var n=be([e]);dn(e),Hn({includeAnvilUUIDs:n})};return(0,o.useEffect)((function(){d.Z.get("/anvil",{params:{anvilUUIDs:"all",isForProvisionServer:!0}}).then((function(e){var n=e.data,t=function(e){var n={},t=e.reduce((function(e,t){var o=t.anvilUUID,i=t.anvilName,s=t.anvilTotalMemory,l=t.anvilTotalAllocatedMemory,c=t.anvilTotalAvailableMemory,u=t.hosts,p=t.servers,d=t.storageGroups,f=t.files,v=d.reduce((function(n,t){var a=te({},t,{anvilUUID:o,anvilName:i,storageGroupSize:BigInt(t.storageGroupSize),storageGroupFree:BigInt(t.storageGroupFree),humanizedStorageGroupFree:""});return(0,x.Bh)(t.storageGroupFree,{fromUnit:"B",onSuccess:{string:function(e,n){a.humanizedStorageGroupFree="".concat(e," ").concat(n)}},precision:0,toUnit:"ibyte"}),n.anvilStorageGroupUUIDs.push(t.storageGroupUUID),n.anvilStorageGroups.push(a),e.storageGroups.push(a),e.storageGroupSelectItems.push({displayValue:ge({endAdornment:(0,r.jsx)(B.Ac,{inverted:!0,text:"~".concat(a.humanizedStorageGroupFree," free")}),mainLabel:t.storageGroupName,subLabel:i}),value:t.storageGroupUUID}),e.storageGroupUUIDMapToData[t.storageGroupUUID]=a,n}),{anvilStorageGroups:[],anvilStorageGroupUUIDs:[]}),m=v.anvilStorageGroups,g=v.anvilStorageGroupUUIDs,h=[];f.forEach((function(e){var t=e.fileUUID;h.push(t),n[t]=e}));var b=te({},t,{anvilTotalMemory:BigInt(s),anvilTotalAllocatedMemory:BigInt(l),anvilTotalAvailableMemory:BigInt(c),humanizedAnvilTotalAvailableMemory:"",hosts:u.map((function(e){return te({},e,{hostMemory:BigInt(e.hostMemory)})})),servers:p.map((function(n){var t=n.serverMemory,r=n.serverName,o=te({},re(n,["serverMemory","serverName"]),{serverMemory:BigInt(t),serverName:r});return e.serverNameMapToData[r]=o,o})),storageGroupUUIDs:g,storageGroups:m,fileUUIDs:h});return(0,x.Bh)(c,{fromUnit:"B",onSuccess:{string:function(e,n){b.humanizedAnvilTotalAvailableMemory="".concat(e," ").concat(n)}},precision:0,toUnit:"ibyte"}),e.anvils.push(b),e.anvilSelectItems.push({displayValue:ge({endAdornment:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",width:"8rem"},children:[(0,r.jsx)(B.Ac,{inverted:!0,text:"CPU: ".concat(b.anvilTotalCPUCores," cores")}),(0,r.jsx)(B.Ac,{inverted:!0,text:"Memory: ~".concat(b.humanizedAnvilTotalAvailableMemory)})]}),mainLabel:b.anvilName,subLabel:b.anvilDescription}),value:o}),e.anvilUUIDMapToData[o]=b,e}),{anvils:[],anvilSelectItems:[],anvilUUIDMapToData:{},files:[],fileSelectItems:[],fileUUIDMapToData:{},serverNameMapToData:{},storageGroups:[],storageGroupSelectItems:[],storageGroupUUIDMapToData:{}});return Object.values(n).forEach((function(e){t.files.push(e),t.fileSelectItems.push({displayValue:e.fileName,value:e.fileUUID}),t.fileUUIDMapToData[e.fileUUID]=e})),t}(n.anvils),o=t.anvils,i=t.anvilSelectItems,s=t.anvilUUIDMapToData,l=t.fileSelectItems,c=t.fileUUIDMapToData,u=t.serverNameMapToData,p=t.storageGroupSelectItems,d=t.storageGroupUUIDMapToData;j(o),P(s),C(c),A(u),F(d),L(i),V(l),X(p),Yn({allAnvils:o,storageGroupUUIDMapToData:d}),Q(Object.entries(n.oses).map((function(e){var n=oe(e,2);return{key:n[0],label:n[1]}}))),An(!0)}))}),[Yn]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{fullWidth:!0,maxWidth:"sm",open:n,PaperComponent:w.s_,PaperProps:{sx:{overflow:"visible"}},children:[(0,r.jsxs)(w.V9,{children:[(0,r.jsx)(B.z,{text:"Provision a Server"}),(0,r.jsx)(g.Z,{onClick:t,sx:{backgroundColor:p.hM,color:p.lD,"&:hover":{backgroundColor:p.hM}},children:(0,r.jsx)(c.Z,{})})]}),kn?(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",maxHeight:"50vh",overflowY:"scroll",paddingTop:".6em","& > :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(b.Z,{id:"ps-server-name",label:"Server name",inputProps:{onChange:function(e){var n=e.target.value;se(n),Jn({inputs:{serverName:{value:n}}})},value:ne},inputLabelProps:{isNotifyRequired:0===ne.length},messageBoxProps:je})}),(Rn="ps-cpu-cores",_n="CPU cores",Qn=Ie,qn={messageBoxProps:Ce,sliderProps:{onChange:function(e){var n=e;if(n!==Ie){Pe(n);var t=Hn({cpuCores:n}).maxCPUCores;Jn({inputs:{cpuCores:{max:t,value:n}}})}},max:De,min:1}},(0,r.jsx)(H,te({isAllowTextInput:!0,label:_n,labelId:"".concat(Rn,"-label"),value:Qn},qn))),(0,r.jsx)(Z,{id:"ps-memory",label:"Memory",messageBoxProps:Ne,inputWithLabelProps:{inputProps:{endAdornment:xe("".concat(We," ").concat(He),{onButtonClick:function(){Qe(We),Kn({cmValue:ze})}}),onChange:function(e){var n=e.target.value;Xn({value:n})},type:"number",value:_e},inputLabelProps:{isNotifyRequired:Ae===ue}},selectItems:pe,selectWithLabelProps:{selectProps:{onChange:function(e){var n=e.target.value;Xn({unit:n})},value:He}}}),Ke.stateIds.map((function(e,n){return function(e,n,t,o,i,s,l,c){var u=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return e[t][r]},p=function(r,o){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n;e[r][i]=o,t(te({},e))},d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ue;p("sizes",t);var r=s({virtualDisks:e}),o=r.formattedMaxVDSizes,i=r.maxVirtualDiskSizes;c({inputs:$({},"vd".concat(n,"Size"),{displayMax:"".concat(o[n]),max:i[n],value:t})})},f=function(e){var n=e.value,t=void 0===n?u("inputSizes"):n,r=e.unit,o=void 0===r?u("inputUnits"):r;t!==u("inputSizes")&&p("inputSizes",t),o!==u("inputUnits")&&p("inputUnits",o),(0,x.KY)(t,o,(function(e){return d(e)}),(function(){return d()}))},v=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u("inputStorageGroupUUIDs");n!==u("inputStorageGroupUUIDs")&&p("inputStorageGroupUUIDs",n),s({virtualDisks:e})};return(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column","& > :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(Z,{id:"ps-virtual-disk-size-".concat(n),label:"Disk size",messageBoxProps:u("inputSizeMessages"),inputWithLabelProps:{inputProps:{endAdornment:xe("".concat(u("inputMaxes")," ").concat(u("inputUnits")),{onButtonClick:function(){p("inputSizes",u("inputMaxes")),d(u("maxes"))}}),onChange:function(e){var n=e.target.value;f({value:n})},type:"number",value:u("inputSizes")},inputLabelProps:{isNotifyRequired:u("sizes")===ue}},selectItems:pe,selectWithLabelProps:{selectProps:{onChange:function(e){var n=e.target.value;f({unit:n})},value:u("inputUnits")}}})}),(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(U.Z,{id:"ps-storage-group-".concat(n),label:"Storage group",disableItem:function(e){return!(i.includes(e)&&u("sizes")<=l[e].storageGroupFree)},inputLabelProps:{isNotifyRequired:0===u("inputStorageGroupUUIDs").length},messageBoxProps:u("inputStorageGroupUUIDMessages"),selectItems:o,selectProps:{onChange:function(e){var n=e.target.value;v(n)},onClearIndicatorClick:function(){return v("")},renderValue:function(e){var n,t=null!==(n=l[e])&&void 0!==n?n:{},r=t.anvilName,o=void 0===r?"?":r,i=t.storageGroupName,a=void 0===i?"Unknown (".concat(e,")"):i;return"".concat(a," (").concat(o,")")},value:u("inputStorageGroupUUIDs")}})})]},"ps-virtual-disk-".concat(u("stateIds")))}(Ke,n,Xe,K,wn,Hn,z,Jn)})),(0,r.jsx)(U.Z,{disableItem:function(e){return e===sn},hideItem:function(e){return!On.includes(e)},id:"ps-install-image",inputLabelProps:{isNotifyRequired:0===en.length},label:"Install ISO",messageBoxProps:rn,selectItems:W,selectProps:{onChange:function(e){var n=e.target.value;$n(n)},onClearIndicatorClick:function(){return $n("")},value:en}}),(0,r.jsx)(U.Z,{disableItem:function(e){return e===en},hideItem:function(e){return!On.includes(e)},id:"ps-driver-image",label:"Driver ISO",messageBoxProps:cn,selectItems:W,selectProps:{onChange:function(e){var n=e.target.value;et(n)},onClearIndicatorClick:function(){return et("")},value:sn}}),(0,r.jsx)(U.Z,{disableItem:function(e){return!Un.includes(e)},id:"ps-anvil",inputLabelProps:{isNotifyRequired:0===pn.length},label:"Anvil node",messageBoxProps:vn,selectItems:N,selectProps:{onChange:function(e){var n=e.target.value;nt(n)},onClearIndicatorClick:function(){return nt("")},renderValue:function(e){var n,t=(null!==(n=I[e])&&void 0!==n?n:{}).anvilName;return void 0===t?"Unknown ".concat(e):t},value:pn}}),(0,r.jsx)(f.Z,{id:"ps-optimize-for-os",extendRenderInput:function(e){var n=e.inputLabelProps;(void 0===n?{}:n).isNotifyRequired=null===gn},isOptionEqualToValue:function(e,n){return e.key===n.key},label:"Optimize for OS",messageBoxProps:yn,noOptionsText:"No matching OS",onChange:function(e,n){hn(n)},openOnFocus:!0,options:_,renderOption:function(e,n){return(0,o.createElement)("li",te({},e,{key:"ps-optimize-for-os-".concat(n.key),children:[n.label," (",n.key,")"]}))},value:gn})]}):(0,r.jsx)(Y.Z,{}),(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",marginTop:"1em","& > :not(:first-child)":{marginTop:"1em"}},children:[En>0&&(0,r.jsx)(h.Z,{isAllowClose:!0,text:"Provision server job registered. You can provision another server, or exit; it won't affect the registered job."}),Tn?(0,r.jsx)(Y.Z,{mt:0}):(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",width:"100%"},children:(0,r.jsx)(m.Z,{disabled:!Jn({isIgnoreOnCallbacks:!0}),onClick:function(){zn(!0)},sx:me,children:"Provision"})})]})]}),Bn&&(0,r.jsx)(v.Z,{actionProceedText:"Provision",content:(0,r.jsxs)(s.ZP,{container:!0,columns:8,direction:"column",children:[(0,r.jsx)(s.ZP,{direction:"row",item:!0,xs:8,children:(0,r.jsxs)(B.Ac,{children:["Server ",(0,r.jsx)(B.Q0,{text:ne})," will be created on anvil node"," ",(0,r.jsx)(B.Q0,{text:I[pn].anvilName})," ","with the following properties:"]})}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"CPU"})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:Ie})," core(s)"]})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:De})," core(s) available"]})})]}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Memory"})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsx)(B.Ac,{children:(0,r.jsxs)(B.Q0,{children:[_e," ",He]})})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:"".concat(We," ").concat(He)})," ","available"]})})]}),Ke.stateIds.map((function(e,n){var t=Ke.inputMaxes[n],o=Ke.inputSizes[n],i=Ke.inputUnits[n],a=z[Ke.inputStorageGroupUUIDs[n]].storageGroupName;return(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsxs)(B.Ac,{children:["Disk ",(0,r.jsx)(B.Q0,{text:n})]})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:"".concat(o," ").concat(i)})," on"," ",a]})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:"".concat(t," ").concat(i)})," ","available"]})})]},"ps-virtual-disk-".concat(e,"-summary"))})),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Install ISO"})}),(0,r.jsx)(s.ZP,{item:!0,xs:6,children:(0,r.jsx)(B.Ac,{children:(0,r.jsx)(B.Q0,{children:D[en].fileName})})})]}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Driver ISO"})}),(0,r.jsx)(s.ZP,{item:!0,xs:6,children:(0,r.jsx)(B.Ac,{children:D[sn]?(0,r.jsx)(B.Q0,{children:D[sn].fileName}):"none"})})]}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Optimize for OS"})}),(0,r.jsx)(s.ZP,{item:!0,xs:6,children:(0,r.jsx)(B.Ac,{text:"".concat(null===gn||void 0===gn?void 0:gn.label)})})]})]}),dialogProps:{open:Bn},onCancelAppend:function(){zn(!1)},onProceedAppend:function(){var e={serverName:ne,cpuCores:Ie,memory:Ae.toString(),virtualDisks:Ke.stateIds.map((function(e,n){return{storageSize:Ke.sizes[n].toString(),storageGroupUUID:Ke.inputStorageGroupUUIDs[n]}})),installISOFileUUID:en,driverISOFileUUID:sn,anvilUUID:pn,optimizeForOS:null===gn||void 0===gn?void 0:gn.key};Nn(!0),d.Z.post("/server",e).then((function(){Nn(!1),Wn(En+1)})),zn(!1)},proceedButtonProps:{sx:me},titleText:"Provision ".concat(ne,"?")})]})}},2519:function(e,n,t){t.d(n,{Z:function(){return D}});var r=t(5893),o=t(5603),i=t(8128),a=t(3640),s=t(7294),l=t(1363),c=t(4427),u=t(9),p=t(192),d=t(5537),f=t(9558),v=t(6239),m=t(7021),x=t(1057),g=t(4799),h=t(3213),b=t(7169);function y(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function j(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var U=function(e){var n=e.onClearIndicatorClick,t=S(e,["onClearIndicatorClick"]),i=t.sx,a=t.value,l=S(t,["sx","value"]),c=(0,s.useMemo)((function(){var e;return j((y(e={},"& .".concat(o.Z.icon),{color:b.s7}),y(e,"& .".concat(f.Z.root),{marginRight:".8em"}),y(e,"& .".concat(v.Z.root),{color:b.s7,visibility:"hidden"}),y(e,"&:hover .".concat(f.Z.root," .").concat(v.Z.root,",\n &.").concat(m.Z.focused," .").concat(f.Z.root," .").concat(v.Z.root),{visibility:"visible"}),e),i)}),[i]),u=(0,s.useMemo)((function(){return String(a).length>0&&n&&(0,r.jsx)(x.Z,{position:"end",children:(0,r.jsx)(g.Z,{onClick:n,children:(0,r.jsx)(d.Z,{fontSize:"small"})})})}),[n,a]);return(0,r.jsx)(h.Z,j({endAdornment:u,value:a},l,{sx:c}))};function I(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function P(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var D=function(e){var n=e.id,t=e.label,d=e.selectItems,f=e.checkItem,v=e.disableItem,m=e.formControlProps,x=e.hideItem,g=e.inputLabelProps,h=void 0===g?{}:g,b=e.isReadOnly,y=void 0!==b&&b,j=e.messageBoxProps,S=void 0===j?{}:j,D=e.name,Z=e.onBlur,w=e.onChange,C=e.onFocus,M=e.required,k=e.selectProps,A=void 0===k?{}:k,G=A.multiple,B=A.sx,z=e.value,F=e.isCheckableItems,T=void 0===F?G:F,N=O(e.selectProps,["multiple","sx"]),L=(0,s.useMemo)((function(){return y?P(I({},"& .".concat(o.Z.icon),{visibility:"hidden"}),B):B}),[y,B]),E=(0,s.useCallback)((function(e){return T&&(0,r.jsx)(i.Z,{checked:null===f||void 0===f?void 0:f.call(null,e)})}),[f,T]),W=(0,s.useCallback)((function(e,t){return(0,r.jsxs)(c.Z,{disabled:null===v||void 0===v?void 0:v.call(null,e),sx:{display:(null===x||void 0===x?void 0:x.call(null,e))?"none":void 0},value:e,children:[E(e),t]},"".concat(n,"-").concat(e))}),[E,v,x,n]),V=(0,s.useMemo)((function(){return"".concat(n,"-select-element")}),[n]),R=(0,s.useMemo)((function(){return(0,r.jsx)(u.Z,{id:n,label:t})}),[n,t]),_=(0,s.useMemo)((function(){return t&&(0,r.jsx)(p.Z,P({htmlFor:V,isNotifyRequired:M},h,{children:t}))}),[h,M,t,V]),Q=(0,s.useMemo)((function(){return d.map((function(e){var n="string"===typeof e?{value:e}:e,t=n.value,r=n.displayValue;return W(t,void 0===r?t:r)}))}),[W,d]);return(0,r.jsxs)(a.Z,P({fullWidth:!0},m,{children:[_,(0,r.jsx)(U,P({id:V,input:R,multiple:G,name:D,onBlur:Z,onChange:w,onFocus:C,readOnly:y,value:z},N,{sx:L,children:Q})),(0,r.jsx)(l.Z,P({},S))]}))}},5737:function(e,n,t){t.d(n,{Bh:function(){return o},KY:function(){return i},MU:function(){return a}});var r=t(4490),o=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.fromUnit,o=n.onFailure,i=n.onSuccess,a=n.precision,s=n.toUnit,l=(0,r.gO)(e,{fromUnit:t,precision:a,toUnit:s});if(l){var c=l.value,u=l.unit;try{var p,d,f;null===i||void 0===i||null===(p=i.bigint)||void 0===p||p.call(null,BigInt(c),u),null===i||void 0===i||null===(d=i.number)||void 0===d||d.call(null,parseFloat(c),u),null===i||void 0===i||null===(f=i.string)||void 0===f||f.call(null,c,u)}catch(v){null===o||void 0===o||o.call(null,v,c,u)}}else null===o||void 0===o||o.call(null)},i=function(e,n,t,r){o(e,{fromUnit:n,onFailure:r,onSuccess:{bigint:t},precision:0,toUnit:"B"})},a=function(e){return(0,r._d)(e,{toUnit:"ibyte"})}}}]);