Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
91 KiB

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[808],{4173:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/manage-element",function(){return t(8938)}])},4594:function(e,n,t){"use strict";var r=t(5893),o=t(6514),i=t(5113),a=t(4656),u=t(482),c=t(2994),l=t(7357),s=t(9890),d=t(7169),f=t(1363),p=t(6284);function m(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){m(e,n,t[n])}))}return e}function v(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var y=function(e){return(0,r.jsx)(o.Z,{in:!0,children:(0,r.jsx)(i.Z,h({},e))})};n.Z=function(e){var n=e.componentsProps,t=e.extendRenderInput,o=e.label,i=e.messageBoxProps,b=e.renderInput,g=e.sx,j=v(e,["componentsProps","extendRenderInput","label","messageBoxProps","renderInput","sx"]),x=h({paper:{sx:{backgroundColor:d.lD}}},n),w=null!==b&&void 0!==b?b:function(e){var n=e.fullWidth,i=e.InputProps,a=e.InputLabelProps,u=e.inputProps,c={formControlProps:{fullWidth:n,ref:i.ref},inputLabelProps:a,inputProps:{className:i.className,endAdornment:i.endAdornment,inputProps:u,startAdornment:i.startAdornment},label:o};return null===t||void 0===t||t.call(null,c,e),(0,r.jsx)(p.Z,h({},c))},O=h(m({},"& .".concat(a.Z.root," .").concat(u.Z.endAdornment),m({right:"7px"},"& .".concat(c.Z.root),{color:d.s7})),g);return(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(s.Z,h({PaperComponent:y},j,{componentsProps:x,renderInput:w,sx:O})),(0,r.jsx)(f.Z,h({},i))]})}},2545:function(e,n,t){"use strict";var r=t(5893),o=t(7294),i=t(157);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var u=(0,o.forwardRef)((function(e,n){var t=e.scrollContent,u=(0,o.useMemo)((function(){return t?".5em":void 0}),[t]);return(0,r.jsx)(i.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){a(e,n,t[n])}))}return e}({dialogProps:{PaperProps:{sx:{minWidth:{xs:"90%",md:"50em"}}}},formContent:!0,scrollBoxProps:{paddingRight:u,paddingTop:".3em"}},e,{ref:n}))}));u.displayName="FormDialog",n.Z=u},4629:function(e,n,t){"use strict";var r=t(5893),o=t(7357),i=t(7294),a=t(4188),u=t(4825),c=t(4690),l=t(7504),s=t(9099),d=t(7869),f=t(6284),p=t(2152),m=t(7987),h=t(8859),v=t(2749);function y(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function b(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function g(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){b(e,n,t[n])}))}return e}function j(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function x(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||O(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||O(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 O(e,n){if(e){if("string"===typeof e)return y(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)?y(e,n):void 0}}var P={width:"100%"},I="gate-input",k="".concat(I,"-credential-id"),Z="".concat(I,"-credential-passphrase"),S="access",A=(0,i.forwardRef)((function(e,n){var t,y,b=e.formContainer,O=void 0===b||b,I=e.gridProps,A=void 0===I?{}:I,T=A.columns,M=void 0===T?{xs:1,sm:2}:T,F=(A.layout,A.spacing),C=void 0===F?"1em":F,U=e.identifierId,N=void 0===U?k:U,R=e.identifierInputTestBatchBuilder,E=void 0===R?m.Gn:R,B=e.identifierLabel,D=e.identifierOutlinedInputWithLabelProps,q=void 0===D?{}:D,_=q.formControlProps,L=void 0===_?{}:_,H=q.inputProps,$=e.onIdentifierBlurAppend,V=e.onSubmit,G=e.onSubmitAppend,z=e.passphraseId,W=void 0===z?Z:z,Q=e.passphraseLabel,K=e.passphraseOutlinedInputWithLabelProps,X=void 0===K?{}:K,Y=X.formControlProps,J=void 0===Y?{}:Y,ee=X.inputProps,ne=e.submitLabel,te=e.allowSubmit,re=void 0===te?O:te,oe=j(e.gridProps,["columns","layout","spacing"]),ie=j(e.identifierOutlinedInputWithLabelProps,["formControlProps","inputProps"]),ae=j(e.passphraseOutlinedInputWithLabelProps,["formControlProps","inputProps"]),ue=L.sx,ce=j(L,["sx"]),le=J.sx,se=j(J,["sx"]),de=(0,i.useRef)({}),fe=(0,i.useRef)({}),pe=(0,i.useRef)({}),me=x((0,v.Z)(!1),2),he=me[0],ve=me[1],ye=(0,h.Z)([k,Z],pe),be=ye.buildFinishInputTestBatchFunction,ge=ye.buildInputFirstRenderFunction,je=ye.buildInputUnmountFunction,xe=ye.isFormInvalid,we=ye.setMessage,Oe=(0,i.useMemo)((function(){return null!==V&&void 0!==V?V:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r,o=n[0];o.preventDefault(),we(S),ve(!0);var i=o.target,a=i.elements,u=a.namedItem(k),c=u.value,l=a.namedItem(Z),s=l.value;null===G||void 0===G||(r=G).call.apply(r,[null,c,s,function(e){we(S,e)},ve].concat(w(n)))}}),[V,G,ve,we]),Pe=(0,i.useMemo)((function(){return he?(0,r.jsx)(p.Z,{mt:0}):(0,r.jsx)(c.Z,{row:!0,sx:{justifyContent:"flex-end"},children:(0,r.jsx)(u.Z,{disabled:xe,type:"submit",children:ne})})}),[xe,he,ne]),Ie=(0,i.useMemo)((function(){var e={};return re&&(e["gate-cell-message-group"]={children:(0,r.jsx)(d.Z,{count:1,ref:pe}),sm:2},e["gate-cell-submit"]={children:Pe,sm:2}),e}),[re,Pe]),ke=(0,i.useMemo)((function(){var e={};return O&&(e.component="form",e.onSubmit=Oe),e}),[O,Oe]);return(0,i.useImperativeHandle)(n,(function(){return{get:function(){var e,n;return{identifier:null!==(t=null===(e=de.current.getValue)||void 0===e?void 0:e.call(null))&&void 0!==t?t:"",passphrase:null!==(y=null===(n=fe.current.getValue)||void 0===n?void 0:n.call(null))&&void 0!==y?y:""}},messageGroup:g({},pe.current),setIsSubmitting:function(e){ve(e)}}})),(0,r.jsx)(o.Z,g({},ke,{children:(0,r.jsx)(l.Z,g({columns:M,layout:g({"gate-input-cell-credential-id":{children:(0,r.jsx)(s.Z,{input:(0,r.jsx)(f.Z,g({formControlProps:g({},ce,{sx:g({},P,ue)}),id:N,inputProps:H,label:B},ie)),inputTestBatch:E(B,(function(){we(N)}),{onFinishBatch:be(N)},(function(e){we(N,{children:e})})),onBlurAppend:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;null===$||void 0===$||(r=$).call.apply(r,[null].concat(w(n)))},onFirstRender:ge(N),onUnmount:je(N),ref:de,required:!0})},"gate-input-cell-credential-passphrase":{children:(0,r.jsx)(s.Z,{input:(0,r.jsx)(f.Z,g({formControlProps:g({},se,{sx:g({},P,le)}),id:W,inputProps:ee,label:Q,type:a.Z.password},ae)),inputTestBatch:(0,m.Gn)(Q,(function(){we(W)}),{onFinishBatch:be(W)},(function(e){we(W,{children:e})})),onFirstRender:ge(W),onUnmount:je(W),ref:fe,required:!0})}},Ie),spacing:C},oe))}))}));A.displayName="GateForm",n.ZP=A},6632:function(e,n,t){"use strict";var r=t(7294);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 i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){o(e,n,t[n])}))}return e}function a(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}n.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.actionProceedText,t=void 0===n?"":n,o=e.content,u=void 0===o?"":o,c=e.titleText,l=void 0===c?"":c,s=a(e,["actionProceedText","content","titleText"]);return(0,r.useState)(i({actionProceedText:t,content:u,titleText:l},s))}},8938:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return br}});var r=t(5893),o=t(9008),i=t(1163),a=t(7294),u=t(4390);function c(e,n){return null!=n&&"undefined"!==typeof Symbol&&n[Symbol.hasInstance]?n[Symbol.hasInstance](e):e instanceof n}var l=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.fallbackValue,r=void 0===t?"":t,o=n.joinSeparator,i=void 0===o?"":o,a=n.limit,u=void 0===a?1:a;return c(e,Array)?e.slice(0,u).join(i):null!==e&&void 0!==e?e:r},s=t(7504),d=t(1770),f=t(5521),p=t(7357),m=t(2029),h=t(4594),v=t(1496),y=t(4386),b=t(4188),g=t(4690),j=t(9099),x=t(6284),w=t(3679),O=t(7783),P=t(480),I=t(2852),k=t(7169),Z=t(7750);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 A(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){S(e,n,t[n])}))}return e}var T=(0,v.ZP)(P.Z)({height:"3.5em",marginLeft:0,width:"100%"}),M=function(e){var n=e.baseInputProps,t=e.checked,o=e.formControlLabelProps,i=e.id,u=e.label,c=e.name,l=e.onChange,s=e.switchProps,d=(0,a.useMemo)((function(){return"string"===typeof u?(0,r.jsx)(Z.Ac,{inheritColour:!0,color:"".concat(k.s7,"AF"),children:u}):(0,r.jsx)(r.Fragment,{children:u})}),[u]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T,A({componentsProps:{typography:{flexGrow:1}},control:(0,r.jsx)(I.Z,A({checked:t,edge:"end",name:c,onChange:l},s)),label:d,labelPlacement:"start"},o)),(0,r.jsx)("input",A({checked:t,hidden:!0,id:i,readOnly:!0},n))]})};function F(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function C(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function U(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return F(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 F(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var N=["1","on"],R="-",E={boolean:function(e){var n=e.id,t=e.isChecked,o=void 0!==t&&t,i=e.label,a=e.name,u=void 0===a?n:a;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(M,{checked:o,id:n,label:i,name:u}),valueType:"boolean"},"".concat(n,"-wrapper"))},select:function(e){var n=e.id,t=e.isRequired,o=e.label,i=e.name,a=void 0===i?n:i,u=e.selectOptions,c=void 0===u?[]:u,l=e.value,s=void 0===l?"":l;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(O.Z,{id:n,label:o,name:a,selectItems:c,value:s}),required:t},"".concat(n,"-wrapper"))},string:function(e){var n=e.id,t=e.isRequired,o=e.isSensitive,i=void 0!==o&&o,a=e.label,u=void 0===a?"":a,c=e.name,l=void 0===c?n:c,s=e.value;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:n,inputProps:{inputProps:{"data-sensitive":i}},label:u,name:l,value:s,type:i?b.Z.password:void 0}),required:t},"".concat(n,"-wrapper"))}},B=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.join(R)},D=(0,v.ZP)(g.Z)({margin:".4em 0"}),q=function(e){var n=e.fenceId,t=e.fenceParameterTooltipProps,o=e.fenceTemplate,i=e.previousFenceName,u=e.previousFenceParameters,c=(0,a.useMemo)((function(){var e;if(o&&n){var a=o[n].parameters,c={};u&&(c=Object.entries(u).reduce((function(e,t){var r=U(t,2),o=r[0],i=r[1];return e[B(n,o)]=i,e}),{}));var l=Object.entries(a).sort((function(e,n){return U(e,1)[0]>U(n,1)[0]?1:-1})).reduce((function(e,o){var i=U(o,2),a=i[0],u=i[1],l=u.content_type,s=u.default,d=u.deprecated,f=u.description,m=u.options,h=u.required;if(!("1"===String(d))){var v,b,g=e.optional,j=e.required,x=null!==(v=E[l])&&void 0!==v?v:E.string,w=B(n,a),O=null!==(b=c[w])&&void 0!==b?b:s,P="1"===String(h),I=/passw/i.test(a),k=x({id:w,isChecked:N.includes(O),isRequired:P,isSensitive:I,label:a,selectOptions:m,value:O}),S=(0,r.jsx)(y.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){C(e,n,t[n])}))}return e}({componentsProps:{tooltip:{sx:{maxWidth:{md:"62.6em"}}}},disableInteractive:!0,placement:"top-start",title:(0,r.jsx)(Z.Ac,{children:f})},t,{children:(0,r.jsx)(p.Z,{children:k})}),"".concat(w,"-tooltip"));P?j.push(S):g.push(S)}return e}),{optional:[],required:[E.string({id:B(n,"name"),isRequired:!0,label:"Fence device name",value:i})]}),s=l.optional,d=l.required;e=(0,r.jsxs)(g.Z,{sx:{"& > div:first-child":{marginTop:0},"& > div":{marginBottom:0}},children:[(0,r.jsx)(w.TZ,{expandInitially:!0,header:"Required parameters",children:(0,r.jsx)(D,{children:d})}),(0,r.jsx)(w.TZ,{header:"Optional parameters",children:(0,r.jsx)(D,{children:s})})]})}return e}),[n,t,o,i,u]);return(0,r.jsx)(r.Fragment,{children:c})},_=t(2152);function L(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function H(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function $(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return L(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 L(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var V=function(e){var n=e.fenceTemplate,t=e.loading,o=(0,a.useState)(null),i=o[0],u=o[1],c=(0,a.useMemo)((function(){return n?Object.entries(n).sort((function(e,n){return $(e,1)[0]>$(n,1)[0]?1:-1})).map((function(e){var n=$(e,2),t=n[0],r=n[1].description;return{fenceDescription:"string"===typeof r?r:"No description.",fenceId:t,label:t}})):[]}),[n]),l=(0,a.useMemo)((function(){return(0,r.jsx)(h.Z,{id:"add-fence-select-type",isOptionEqualToValue:function(e,n){return e.fenceId===n.fenceId},label:"Fence device type",onChange:function(e,n){u(n)},openOnFocus:!0,options:c,renderOption:function(e,n,t){var o=n.fenceDescription,i=n.fenceId,a=t.selected;return(0,r.jsxs)(p.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){H(e,n,t[n])}))}return e}({component:"li",sx:{display:"flex",flexDirection:"column","& > *":{width:"100%"}}},e,{children:[(0,r.jsx)(Z.Ac,{inverted:!0,sx:{fontSize:"1.2em",fontWeight:a?400:void 0},children:i}),(0,r.jsx)(Z.Ac,{selected:!1,children:o})]}))},sx:{marginTop:".3em"},value:i})}),[c,i]),s=(0,a.useMemo)((function(){return(0,r.jsx)(q,{fenceId:null===i||void 0===i?void 0:i.fenceId,fenceTemplate:n})}),[n,i]),d=(0,a.useMemo)((function(){return t?(0,r.jsx)(_.Z,{}):(0,r.jsxs)(g.Z,{children:[l,s]})}),[l,s,t]);return(0,r.jsx)(r.Fragment,{children:d})},G=t(157),z=function(e){var n=e.fenceId,t=e.fenceTemplate,o=e.loading,i=e.previousFenceName,u=e.previousFenceParameters,c=(0,a.useMemo)((function(){return o?(0,r.jsx)(_.Z,{}):(0,r.jsx)(q,{fenceId:n,fenceTemplate:t,previousFenceName:i,previousFenceParameters:u})}),[t,n,o,i,u]);return(0,r.jsx)(r.Fragment,{children:c})},W=t(6125),Q=t(1905),K=t(1081),X=t(2749);function Y(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function J(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ee(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){J(e,n,t[n])}))}return e}function ne(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Y(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 Y(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var te=function(e){return e?"1":"0"},re=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=ne(t,1),i=o[0].target,a=i.elements;return Object.values(a).reduce((function(n,t){var r=t.id,o=new RegExp("^(fence[^-]+)".concat(R,"([^\\s]+)$")),i=r.match(o);if(i){var a=ne(i,3),u=a[1],c=a[2];n.fenceAgent=u;var l=t,s=l.checked,d=l.dataset.sensitive,f=l.value;"name"===c&&(n.fenceName=f);var p=e[u].parameters[c],m=(void 0===p?{}:p).content_type,h=void 0===m?"string":m;n.parameterInputs[r]={isParameterSensitive:"true"===d,parameterId:c,parameterType:h,parameterValue:"boolean"===h?te(s):f}}return n}),{fenceAgent:"",fenceName:"",parameterInputs:{}})},oe=function(e){return(0,r.jsx)(W.Z,{listItems:e,listItemProps:{sx:{padding:0}},renderListItem:function(e,n){var t,o=n.isParameterSensitive,i=n.parameterId,a=n.parameterValue;return t=a?o?(0,r.jsx)(Z.PJ,{monospaced:!0,children:a}):(0,r.jsx)(p.Z,{sx:{maxWidth:"100%",overflowX:"scroll"},children:(0,r.jsx)(Z.$_,{lineHeight:2.8,whiteSpace:"nowrap",children:a})}):(0,r.jsx)(Z.KI,{children:"none"}),(0,r.jsxs)(g.Z,{fullWidth:!0,growFirst:!0,height:"2.8em",maxWidth:"100%",row:!0,children:[(0,r.jsx)(Z.Ac,{children:i}),t]},"confirm-".concat(e))}})},ie=function(){var e=(0,K.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useState)({actionProceedText:"",content:"",titleText:""}),i=o[0],c=o[1],l=(0,a.useState)({actionProceedText:"",content:"",titleText:""}),s=l[0],f=l[1],p=ne((0,X.Z)(void 0),2),h=p[0],v=p[1],y=(0,a.useState)(!1),b=y[0],j=y[1],x=ne((0,X.Z)(!0),2),O=x[0],P=x[1],I=(0,Q.Z)("".concat(m.Z,"/fence"),{refreshInterval:6e4}),k=I.data,S=I.isLoading,A=(0,a.useMemo)((function(){return(0,r.jsx)(W.Z,{allowEdit:!0,allowItemButton:b,edit:b,header:!0,listItems:k,onAdd:function(){var e;f({actionProceedText:"Add",content:(0,r.jsx)(V,{fenceTemplate:h}),onSubmitAppend:function(e){var t;if(h){var o=re(h,e);c({actionProceedText:"Add",content:oe(o.parameterInputs),titleText:(0,r.jsxs)(Z.z,{children:["Add a"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:o.fenceAgent})," ","fence device with the following parameters?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:"Add a fence device"}),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){j((function(e){return!e}))},onItemClick:function(e){var o,i=e.fenceAgent,a=e.fenceName,u=e.fenceParameters;f({actionProceedText:"Update",content:(0,r.jsx)(z,{fenceId:i,fenceTemplate:h,previousFenceName:a,previousFenceParameters:u}),onSubmitAppend:function(e){var t;if(h){var o=re(h,e);c({actionProceedText:"Update",content:oe(o.parameterInputs),titleText:(0,r.jsxs)(Z.z,{children:["Update"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:o.fenceName})," ","fence device with the following parameters?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:(0,r.jsxs)(Z.z,{children:["Update fence device"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:a})," ","parameters"]})}),null===(o=t.current.setOpen)||void 0===o||o.call(null,!0)},renderListItem:function(e,n){var t=n.fenceAgent,o=n.fenceName,i=n.fenceParameters;return(0,r.jsxs)(g.Z,{row:!0,children:[(0,r.jsx)(Z.Ac,{children:o}),(0,r.jsx)(Z.Ac,{children:Object.entries(i).reduce((function(e,n){var t=ne(n,2),o=t[0],i=t[1],a=(0,r.jsxs)(r.Fragment,{children:[o,'="']});return a=/passw/i.test(o)?(0,r.jsxs)(r.Fragment,{children:[a,(0,r.jsx)(Z.PJ,{inline:!0,children:i})]}):(0,r.jsxs)(r.Fragment,{children:[a,i]}),(0,r.jsxs)(r.Fragment,{children:[e," ",a,'"']})}),t)})]})}})}),[k,h,b]),T=(0,a.useMemo)((function(){return O||S?(0,r.jsx)(_.Z,{}):A}),[S,O,A]);return e&&u.Z.get("/fence/template").then((function(e){var n=e.data;v(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){P(!1)})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Manage fence devices"})}),T]}),(0,r.jsx)(G.Z,ee({dialogProps:{PaperProps:{sx:{minWidth:{xs:"90%",md:"50em"}}}},formContent:!0,scrollBoxProps:{padding:".3em .5em"},scrollContent:!0},s,{ref:t})),(0,r.jsx)(G.Z,ee({scrollBoxProps:{paddingRight:"1em"},scrollContent:!0},i,{ref:n}))]})},ae=t(7987);function ue(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function ce(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function le(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){ce(e,n,t[n])}))}return e}function se(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return ue(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 ue(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var de,fe="an-host-input",pe="".concat(fe,"-cell"),me="IPMI IP",he=(ce(de={},"fence",(function(e,n){var t=n.dataset,r=t.hostId,o=void 0===r?"":r,i=t.fenceId,a=void 0===i?"":i,u=t.fenceName,c=void 0===u?"":u,l=n.value,s=e.hostConfig.hosts[o],d=s.fences,f=void 0===d?{}:d;f[a]={fenceName:c,fencePort:l},s.fences=f})),ce(de,"host",(function(e,n){var t=n.dataset,r=t.hostId,o=void 0===r?"":r,i=t.hostNumber,a=void 0===i?"":i,u=t.hostType,c=void 0===u?"":u,l=Number.parseInt(a,10);e.hostConfig.hosts[o]={hostNumber:l,hostType:c}})),ce(de,"ipmi",(function(e,n){var t=n.dataset.hostId,r=void 0===t?"":t,o=n.value;e.hostConfig.hosts[r].ipmiIp=o})),ce(de,"network",(function(e,n){var t=n.dataset,r=t.hostId,o=void 0===r?"":r,i=t.networkId,a=void 0===i?"":i,u=t.networkNumber,c=void 0===u?"":u,l=t.networkType,s=void 0===l?"":l,d=n.value,f=e.hostConfig.hosts[o],p=f.networks,m=void 0===p?{}:p,h=Number.parseInt(c,10);m[a]={networkIp:d,networkNumber:h,networkType:s},f.networks=m})),ce(de,"ups",(function(e,n){var t=n.checked,r=n.dataset,o=r.hostId,i=void 0===o?"":o,a=r.upsId,u=void 0===a?"":a,c=r.upsName,l=void 0===c?"":c,s=e.hostConfig.hosts[i],d=s.upses,f=void 0===d?{}:d;f[u]={isUsed:t,upsName:l},s.upses=f})),de),ve={xs:1,sm:2,md:3},ye=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.buildInputUnmountFunction,u=n.setMessage,c=e.hostId,l=e.hostNumber,d=e.hostType,f=e.previous,p=void 0===f?{}:f,m=p.fences,h=void 0===m?{}:m,v=p.ipmiIp,y=p.networks,b=void 0===y?{}:y,O=p.upses,P=void 0===O?{}:O,I=e.hostLabel,k=void 0===I?"".concat(d," ").concat(l):I,S=(0,a.useMemo)((function(){return Object.entries(h)}),[h]),A=(0,a.useMemo)((function(){return Object.entries(b)}),[b]),T=(0,a.useMemo)((function(){return Object.entries(P)}),[P]),F=(0,a.useMemo)((function(){return Boolean(T.length)}),[T.length]),C=(0,a.useMemo)((function(){return"".concat(fe,"-").concat(c)}),[c]),U=(0,a.useMemo)((function(){return function(e){return"".concat(fe,"-").concat(e,"-ipmi-ip")}(c)}),[c]),N=(0,a.useMemo)((function(){return"".concat(pe,"-").concat(c,"-ipmi-ip")}),[c]),R=(0,a.useMemo)((function(){return S.reduce((function(e,n){var i=se(n,2),a=i[0],l=i[1],s=l.fenceName,d=l.fencePort,f="".concat(pe,"-").concat(c,"-").concat(a,"-port"),p=function(e,n){return"".concat(fe,"-").concat(e,"-").concat(n,"-port")}(c,a),m="Port on ".concat(s);return e[f]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"fence","data-host-id":c,"data-fence-id":a,"data-fence-name":s},id:p,label:m,value:d}),inputTestBatch:(0,ae.Gn)("".concat(c," ").concat(m),(function(){u(p)}),{onFinishBatch:t(p)},(function(e){u(p,{children:e})})),onFirstRender:o(p),required:!0})},e}),{})}),[t,o,S,c,u]),E=(0,a.useMemo)((function(){return A.reduce((function(e,n){var a=se(n,2),l=a[0],s=a[1],d=s.networkIp,f=s.networkNumber,p=s.networkType,m="".concat(pe,"-").concat(c,"-").concat(l,"-ip"),h=function(e,n){return"".concat(fe,"-").concat(e,"-").concat(n,"-ip")}(c,l),v="".concat(p.toUpperCase()," ").concat(f," IP");return e[m]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"network","data-host-id":c,"data-network-id":l,"data-network-number":f,"data-network-type":p},id:h,label:v,value:d}),inputTestBatch:(0,ae._)("".concat(c," ").concat(v),(function(){u(h)}),{onFinishBatch:t(h)},(function(e){u(h,{children:e})})),onFirstRender:o(h),onUnmount:i(h),required:!0})},e}),{})}),[A,c,t,o,i,u]),B=(0,a.useMemo)((function(){return T.reduce((function(e,n){var t=se(n,2),o=t[0],i=t[1],a=i.isUsed,u=i.upsName,l="".concat(pe,"-").concat(c,"-").concat(o,"-power-host"),s=function(e,n){return"".concat(fe,"-").concat(e,"-").concat(n,"-power-host")}(c,o),d="Uses ".concat(u);return e[l]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(M,{baseInputProps:{"data-handler":"ups","data-host-id":c,"data-ups-id":o,"data-ups-name":u},checked:a,id:s,label:d}),valueType:"boolean"})},e}),{})}),[c,T]),D=(0,a.useMemo)((function(){return F&&(0,r.jsx)(s.Z,{columns:ve,layout:B,spacing:"1em"})}),[F,B]);return(0,r.jsxs)(w.Lg,{mv:0,children:[(0,r.jsx)(w.CH,{children:(0,r.jsx)(Z.Ac,{children:k})}),(0,r.jsxs)(w.bc,{children:[(0,r.jsx)("input",{hidden:!0,id:C,readOnly:!0,"data-handler":"host","data-host-id":c,"data-host-number":l,"data-host-type":d}),(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(s.Z,{columns:ve,layout:le({},E,ce({},N,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"ipmi","data-host-id":c},id:U,label:me,value:v}),inputTestBatch:(0,ae._)("".concat(c," ").concat(me),(function(){u(U)}),{onFinishBatch:t(U)},(function(e){u(U,{children:e})})),onFirstRender:o(U),onUnmount:i(U),required:!0})}),R),spacing:"1em"}),D]})]})]})};function be(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function ge(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return be(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 be(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var je="".concat("an-host-config-input","-group"),xe="".concat(je,"-cell"),we={node1:{hostNumber:1,hostType:"node"},node2:{hostNumber:2,hostType:"node"}},Oe=function(e){var n=e.formUtils,t=e.knownFences,o=void 0===t?{}:t,i=e.knownUpses,u=void 0===i?{}:i,c=e.networkListEntries,l=e.previous,d=(void 0===l?{}:l).hosts,f=void 0===d?we:d,p=(0,a.useMemo)((function(){return Object.entries(f)}),[f]),m=(0,a.useMemo)((function(){return Object.values(o)}),[o]),h=(0,a.useMemo)((function(){return Object.values(u)}),[u]),v=(0,a.useMemo)((function(){return p.reduce((function(e,t){var o=ge(t,2),i=o[0],a=o[1],u=a.fences,l=void 0===u?{}:u,s=a.hostNumber,d=a.hostType,f=a.ipmiIp,p=a.networks,v=void 0===p?{}:p,y=a.upses,b=void 0===y?{}:y,g=m.reduce((function(e,n){var t=n.fenceName,r=l[t],o=(void 0===r?{}:r).fencePort,i=void 0===o?"":o;return e[t]={fenceName:t,fencePort:i},e}),{}),j=c.reduce((function(e,n){var t=ge(n,2),r=t[0],o=t[1],i=o.networkNumber,a=o.networkType,u=v[r],c=(void 0===u?{}:u).networkIp,l=void 0===c?"":c;return e[r]={networkIp:l,networkNumber:i,networkType:a},e}),{}),x=h.reduce((function(e,n){var t=n.upsName,r=b[t],o=(void 0===r?{}:r).isUsed,i=void 0===o||o;return e[t]={isUsed:i,upsName:t},e}),{});return e["".concat(xe,"-").concat(i)]={children:(0,r.jsx)(ye,{formUtils:n,hostId:i,hostNumber:s,hostType:d,previous:{fences:g,ipmiIp:f,networks:j,upses:x}}),md:3,sm:2},e}),{})}),[n,p,m,h,c]);return(0,r.jsx)(s.Z,{columns:{xs:1,sm:2,md:3},layout:v,spacing:"1em"})},Pe="an-id-input",Ie="".concat(Pe,"-domain"),ke="".concat(Pe,"-prefix"),Ze="".concat(Pe,"-sequence"),Se="Domain name",Ae="Prefix",Te="Sequence",Me=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,a=e.previous,u=void 0===a?{}:a,c=u.domain,l=u.prefix,d=u.sequence;return(0,r.jsx)(s.Z,{columns:{xs:1,sm:2,md:3},layout:{"an-id-input-cell-prefix":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:ke,label:Ae,value:l}),inputTestBatch:(0,ae.Gn)(Ae,(function(){i(ke)}),{onFinishBatch:t(ke)},(function(e){i(ke,{children:e})})),onFirstRender:o(ke),required:!0})},"an-id-input-cell-domain":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Ie,label:Se,value:c}),inputTestBatch:(0,ae.Gn)(Se,(function(){i(Ie)}),{onFinishBatch:t(Ie)},(function(e){i(Ie,{children:e})})),onFirstRender:o(Ie),required:!0})},"an-id-input-cell-sequence":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Ze,label:Te,value:d}),inputTestBatch:(0,ae.qY)(Te,(function(){i(Ze)}),{onFinishBatch:t(Ze)},(function(e){i(Ze,{children:e})})),onFirstRender:o(Ze),required:!0,valueType:"number"})}},spacing:"1em"})},Fe=t(5934),Ce=t(3106),Ue=t(1706);function Ne(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Re(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ee(e){return function(e){if(Array.isArray(e))return Ne(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 Ne(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 Ne(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 Be="an-network-input",De="".concat(Be,"-cell"),qe={gateway:function(e,n){var t=n.dataset.networkId,r=void 0===t?"":t,o=n.value;e.networkConfig.networks[r].networkGateway=o},minip:function(e,n){var t=n.dataset.networkId,r=void 0===t?"":t,o=n.value;e.networkConfig.networks[r].networkMinIp=o},network:function(e,n){var t=n.dataset,r=t.networkId,o=void 0===r?"":r,i=t.networkNumber,a=void 0===i?"":i,u=t.networkType,c=void 0===u?"":u,l=e.networkConfig.networks,s=Number.parseInt(a,10);l[o]={networkNumber:s,networkType:c}},subnetmask:function(e,n){var t=n.dataset.networkId,r=void 0===t?"":t,o=n.value;e.networkConfig.networks[r].networkSubnetMask=o}},_e=function(e){var n,t=e.formUtils,o=t.buildFinishInputTestBatchFunction,i=t.buildInputFirstRenderFunction,u=t.buildInputUnmountFunction,c=t.setMessage,l=e.inputGatewayLabel,d=void 0===l?"Gateway":l,f=e.inputMinIpLabel,p=void 0===f?"IP address":f,m=e.inputSubnetMaskLabel,h=void 0===m?"Subnet mask":m,v=e.networkId,y=e.networkNumber,b=e.networkType,g=e.networkTypeOptions,P=e.onClose,I=e.onNetworkTypeChange,k=e.previous,Z=void 0===k?{}:k,S=Z.gateway,A=Z.minIp,T=Z.subnetMask,M=e.readonlyNetworkName,F=e.showCloseButton,C=e.showGateway,U=(0,a.useMemo)((function(){return"".concat(Ce.Z[b]," ").concat(y)}),[y,b]),N=(0,a.useMemo)((function(){return"".concat(De,"-").concat(v,"-gateway")}),[v]),R=(0,a.useMemo)((function(){return"".concat(De,"-").concat(v,"-ip")}),[v]),E=(0,a.useMemo)((function(){return"".concat(De,"-").concat(v,"-subnet-mask")}),[v]),B=(0,a.useMemo)((function(){return"".concat(Be,"-").concat(v)}),[v]),D=(0,a.useMemo)((function(){return function(e){return"".concat(Be,"-").concat(e,"-gateway")}(v)}),[v]),q=(0,a.useMemo)((function(){return function(e){return"".concat(Be,"-").concat(e,"-min-ip")}(v)}),[v]),_=(0,a.useMemo)((function(){return function(e){return"".concat(Be,"-").concat(e,"-network-type")}(v)}),[v]),L=(0,a.useMemo)((function(){return function(e){return"".concat(Be,"-").concat(e,"-subnet-mask")}(v)}),[v]),H=(0,a.useMemo)((function(){return C?void 0:"none"}),[C]),$=(0,a.useMemo)((function(){return F&&(0,r.jsx)(Ue.Z,{mapPreset:"close",iconProps:{fontSize:"small"},onClick:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;null===P||void 0===P||(r=P).call.apply(r,[null,{networkId:v,networkType:b}].concat(Ee(n)))},sx:{padding:".2em",position:"absolute",right:"-.6rem",top:"-.2rem"}})}),[F,v,b,P]),V=(0,a.useMemo)((function(){var e;return C&&D&&(e=(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"gateway","data-network-id":v},id:D,label:d,value:S}),inputTestBatch:(0,ae._)("".concat(U," ").concat(d),(function(){c(D)}),{onFinishBatch:o(D)},(function(e){c(D,{children:e})})),onFirstRender:i(D),onUnmount:u(D),required:C})),e}),[C,D,v,d,S,U,o,i,u,c]);return(0,r.jsxs)(w.Lg,{mv:0,children:[(0,r.jsxs)(w.CH,{children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(O.Z,{id:_,isReadOnly:M,onChange:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;null===I||void 0===I||(r=I).call.apply(r,[null,{networkId:v,networkType:b}].concat(Ee(n)))},selectItems:g,selectProps:{renderValue:function(){return U}},value:b})}),$]}),(0,r.jsxs)(w.bc,{children:[(0,r.jsx)("input",{hidden:!0,id:B,readOnly:!0,"data-handler":"network","data-network-id":v,"data-network-number":y,"data-network-type":b}),(0,r.jsx)(s.Z,{layout:(n={},Re(n,R,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"minip","data-network-id":v},id:q,label:p,value:A}),inputTestBatch:(0,ae._)("".concat(U," ").concat(p),(function(){c(q)}),{onFinishBatch:o(q)},(function(e){c(q,{children:e})})),onFirstRender:i(q),onUnmount:u(q),required:!0})}),Re(n,E,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"subnetmask","data-network-id":v},id:L,label:h,value:T}),inputTestBatch:(0,ae._)("".concat(U," ").concat(h),(function(){c(L)}),{onFinishBatch:o(L)},(function(e){c(L,{children:e})})),onFirstRender:i(L),onUnmount:u(L),required:!0})}),Re(n,N,{children:V,display:H}),n),spacing:"1em"})]})]})},Le=t(6607);function He(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function $e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ve(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){$e(e,n,t[n])}))}return e}function Ge(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return He(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 He(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ze="an-network-config-input",We="".concat(ze,"-cell"),Qe="".concat(ze,"-dns"),Ke="".concat(ze,"-mtu"),Xe="".concat(ze,"-ntp"),Ye=Object.entries(Ce.Z),Je=function(e){return"ifn"===e},en=function(e){var n=e.formUtils,t=e.networkListEntries,o=e.previous,i=void 0===o?{}:o,u=i.dnsCsv,c=void 0===u?"8.8.8.8,8.8.4.4":u,l=i.mtu,d=i.ntpCsv,f=e.setNetworkList,p=n.buildFinishInputTestBatchFunction,m=n.buildInputFirstRenderFunction,h=n.setMessage,v=n.setMessageRe,y=(0,a.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.input,o=void 0===r?t:r,i=n.end,a=void 0===i?t.length:i,u=a-1,c=0;return o.every((function(n,t){return Ge(n,2)[1].networkType===e&&(c+=1),t<u})),c}),[t]),b=(0,a.useMemo)((function(){return Ye.map((function(e){var n=Ge(e,2),t=n[0];return{displayValue:n[1],value:t}}))}),[]),g=(0,a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.networkMinIp,t=void 0===n?"":n,r=e.networkSubnetMask,o=void 0===r?"":r,i=e.networkType,a=void 0===i?"ifn":i,u=e.networkGateway,c=void 0===u?Je(a)?"":void 0:u,l=e.networkNumber,s=void 0===l?y(a)+1:l;return{network:{networkGateway:c,networkMinIp:t,networkNumber:s,networkSubnetMask:o,networkType:a},networkId:(0,Fe.Z)()}}),[y]),w=(0,a.useCallback)((function(e,n){return f((0,Le.ZP)(e,n))}),[f]),O=(0,a.useCallback)((function(e,n){var r=e.networkId,o=e.networkType,i=n.target.value,a=String(i),u=!1,c=0,l=t.reduce((function(e,n){var t=Ge(n,2),i=t[0],l=t[1],s=l.networkNumber,d=l.networkType;i===r&&(u=!0,d=a,v(RegExp(i)));var f=d===a;return f&&(c+=1),u?(f?s=c:d===o&&(s-=1),e[i]=Ve({},l,{networkNumber:s,networkType:d})):e[i]=l,e}),{});f(l)}),[t,v,f]),P=(0,a.useCallback)((function(e){var n=e.networkId,r=e.networkType,o=!1,i=0,a=t.reduce((function(e,t){var a=Ge(t,2),u=a[0],c=a[1];u===n?o=!0:(c.networkType===r&&(i+=1),e[u]=o?Ve({},c,{networkNumber:i}):c);return e}),{});f(a)}),[t,f]),I=(0,a.useMemo)((function(){var e={};return e=t.reduce((function(e,t){var o=Ge(t,2),i=o[0],a=o[1],u=a.networkGateway,c=a.networkMinIp,l=a.networkNumber,s=a.networkSubnetMask,d=a.networkType,f="".concat(We,"-").concat(i),p=1===l,m=Je(d),h="mn"===d||!p;return e[f]={children:(0,r.jsx)(_e,{formUtils:n,networkId:i,networkNumber:l,networkType:d,networkTypeOptions:b,onClose:P,onNetworkTypeChange:O,previous:{gateway:u,minIp:c,subnetMask:s},readonlyNetworkName:!h,showCloseButton:h,showGateway:m}),md:3,sm:2},e}),e)}),[n,t,b,P,O]);return(0,r.jsx)(s.Z,{columns:{xs:1,sm:2,md:3},layout:Ve({},I,{"an-network-config-cell-add-network":{children:(0,r.jsx)(Ue.Z,{mapPreset:"add",onClick:function(){var e=g(),n=e.network,t=e.networkId;w(t,n)}}),display:"flex",justifyContent:"center",md:3,sm:2},"an-network-config-input-cell-dns":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Qe,label:"DNS",value:c}),inputTestBatch:(0,ae.dg)("DNS",(function(){h(Qe)}),{onFinishBatch:p(Qe)},(function(e){h(Qe,{children:e})})),onFirstRender:m(Qe),required:!0})},"an-network-config-input-cell-ntp":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Xe,label:"NTP",value:d}),inputTestBatch:(0,ae.dg)("NTP",(function(){h(Xe)}),{onFinishBatch:p(Xe)},(function(e){h(Xe,{children:e})})),onFirstRender:m(Xe)})},"an-network-config-input-cell-mtu":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Ke,inputProps:{placeholder:"1500"},label:"MTU",value:l}),inputTestBatch:(0,ae.qY)("MTU",(function(){h(Ke)}),{onFinishBatch:p(Ke)},(function(e){h(Ke,{children:e})})),onFirstRender:m(Ke),valueType:"number"})}}),spacing:"1em"})};function nn(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var tn={bcn1:{networkMinIp:"10.201.0.0",networkNumber:1,networkSubnetMask:"255.255.0.0",networkType:"bcn"},sn1:{networkMinIp:"10.101.0.0",networkNumber:1,networkSubnetMask:"255.255.0.0",networkType:"sn"},ifn1:{networkMinIp:"",networkNumber:1,networkSubnetMask:"",networkType:"ifn"}},rn=function(e){var n=e.formUtils,t=e.knownFences,o=e.knownUpses,i=e.previous,u=void 0===i?{}:i,c=u.hostConfig,l=u.networkConfig,s=void 0===l?{}:l,d=nn(e.previous,["hostConfig","networkConfig"]),f=s.networks,p=void 0===f?tn:f,m=(0,a.useState)(p),h=m[0],v=m[1],y=(0,a.useMemo)((function(){return Object.entries(h)}),[h]);return(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(Me,{formUtils:n,previous:d}),(0,r.jsx)(en,{formUtils:n,networkListEntries:y,previous:s,setNetworkList:v}),(0,r.jsx)(Oe,{formUtils:n,knownFences:t,knownUpses:o,networkListEntries:y,previous:c})]})},on=function(e){var n=e.formUtils,t=e.knownFences,o=e.knownUpses,i=e.previous;return(0,r.jsx)(rn,{formUtils:n,knownFences:t,knownUpses:o,previous:i})},an=t(2545),un=t(7869);function cn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function ln(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function sn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){ln(e,n,t[n])}))}return e}function dn(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return cn(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 cn(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var fn="run-manifest-input",pn="".concat(fn,"-host"),mn="".concat(fn,"-an-description"),hn="".concat(fn,"-an-password"),vn="".concat(fn,"-an-confirm-password"),yn="Description",bn="Password",gn="Confirm password",jn="--",xn=(0,v.ZP)(Z.$_)({justifyContent:"end"}),wn=function(e){return"".concat(pn,"-").concat(e)},On=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,u=e.knownFences,c=void 0===u?{}:u,l=e.knownHosts,d=void 0===l?{}:l,f=e.knownUpses,p=void 0===f?{}:f,m=e.previous,h=void 0===m?{}:m,v=h.domain,y=h.hostConfig,w=void 0===y?{}:y,P=h.networkConfig,I=void 0===P?{}:P,k=(0,a.useRef)({}),S=w.hosts,A=void 0===S?{}:S,T=I.dnsCsv,M=I.mtu,F=I.networks,C=void 0===F?{}:F,U=I.ntpCsv,N=void 0===U?jn:U,R=(0,a.useMemo)((function(){return Object.entries(A)}),[A]),E=(0,a.useMemo)((function(){return Object.entries(c)}),[c]),B=(0,a.useMemo)((function(){return Object.entries(d)}),[d]),D=(0,a.useMemo)((function(){return Object.entries(p)}),[p]),q=(0,a.useMemo)((function(){return Object.entries(C)}),[C]),_=(0,a.useMemo)((function(){return B.map((function(e){var n=dn(e,2)[1];return{displayValue:n.hostName,value:n.hostUUID}}))}),[B]),L=(0,a.useMemo)((function(){return R.reduce((function(e,n){var a=dn(n,2),u=a[0],c=a[1],l=c.hostName,s=c.hostNumber,d=c.hostType,f=e.headers,p=e.hosts,m=e.hostNames,h="".concat(d).concat(s);f["run-manifest-column-header-cell-".concat(u)]={children:(0,r.jsx)(Z.Ac,{children:h})};var y=wn(u),b="".concat(h," host");return p["run-manifest-host-cell-".concat(u)]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(O.Z,{id:y,label:b,selectItems:_,value:""}),inputTestBatch:(0,ae.Gn)(b,(function(){i(y)}),{onFinishBatch:t(y)},(function(e){i(y,{children:e})})),onFirstRender:o(y),required:!0})},m["run-manifest-new-host-name-cell-".concat(u)]={children:(0,r.jsxs)(Z.$_,{children:[l,".",v]})},e}),{headers:{"run-manifest-column-header-cell-offset":{}},hosts:{"run-manifest-host-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"Uses host"})}},hostNames:{"run-manifest-new-host-name-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"New hostname"})}}})}),[v,t,o,R,_,i]),H=L.headers,$=L.hosts,V=L.hostNames,G=(0,a.useMemo)((function(){return q.reduce((function(e,n){var t=dn(n,2),o=t[0],i=t[1],a=i.networkGateway,u=i.networkNumber,c=i.networkType,l=e.gateway,s=e.hostNetworks,d="run-manifest-host-network-cell-".concat(o),f="".concat(c.toUpperCase()).concat(u);s["".concat(d,"-header")]={children:(0,r.jsx)(Z.Ac,{children:f})},R.forEach((function(e){var n=dn(e,2),t=n[0],i=n[1].networks,a=(void 0===i?{}:i)[o],u=(void 0===a?{}:a).networkIp,c=void 0===u?jn:u;s["".concat(d,"-").concat(t,"-ip")]={children:(0,r.jsx)(Z.$_,{children:c})}}));var p="run-manifest-gateway-cell";return a&&!l[p]&&(l[p]={children:(0,r.jsx)(xn,{children:a})}),e}),{gateway:{"run-manifest-gateway-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"Gateway"})}},hostNetworks:{}})}),[R,q]),z=G.gateway,W=G.hostNetworks,Q=(0,a.useMemo)((function(){return E.reduce((function(e,n){var t=dn(n,2),o=t[0],i=t[1].fenceName,a="run-manifest-fence-cell-".concat(o);return e["".concat(a,"-header")]={children:(0,r.jsxs)(Z.Ac,{children:["Port on ",i]})},R.forEach((function(n){var t=dn(n,2),o=t[0],u=t[1].fences,c=(void 0===u?{}:u)[i],l=(void 0===c?{}:c).fencePort,s=void 0===l?jn:l;e["".concat(a,"-").concat(o,"-port")]={children:(0,r.jsx)(Z.$_,{children:s})}})),e}),{})}),[R,E]),K=(0,a.useMemo)((function(){return D.reduce((function(e,n){var t=dn(n,2),o=t[0],i=t[1].upsName,a="run-manifest-ups-cell-".concat(o);return e["".concat(a,"-header")]={children:(0,r.jsxs)(Z.Ac,{children:["Uses ",i]})},R.forEach((function(n){var t=dn(n,2),o=t[0],u=t[1].upses,c=(void 0===u?{}:u)[i],l=(void 0===c?{}:c).isUsed,s=void 0!==l&&l;e["".concat(a,"-").concat(o,"-is-used")]={children:(0,r.jsx)(Z.$_,{children:s?"yes":"no"})}})),e}),{})}),[R,D]),X=(0,a.useMemo)((function(){var e=(0,ae.Gn)(gn,(function(){i(vn)}),{onFinishBatch:t(vn)},(function(e){i(vn,{children:e})})),n=o(vn);return e.tests.push({onFailure:function(){i(vn,{children:(0,r.jsx)(r.Fragment,{children:"Confirm password must match password."})})},test:function(e){var n,t=e.value;return(null===(n=k.current.getValue)||void 0===n?void 0:n.call(null))===t}}),{inputTestBatch:e,onFirstRender:n}}),[t,o,i]);return(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(s.Z,{columns:{xs:1,sm:2},layout:{"run-manifest-input-cell-an-description":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:mn,label:yn}),inputTestBatch:(0,ae.Gn)(yn,(function(){i(mn)}),{onFinishBatch:t(mn)},(function(e){i(mn,{children:e})})),onFirstRender:o(mn),required:!0}),sm:2},"run-manifest-input-cell-an-password":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:hn,label:bn,type:b.Z.password}),inputTestBatch:(0,ae.Gn)(bn,(function(){i(hn)}),{onFinishBatch:t(hn)},(function(e){i(hn,{children:e})})),onFirstRender:o(hn),ref:k,required:!0})},"run-manifest-input-cell-an-confirm-password":{children:(0,r.jsx)(j.Z,sn({input:(0,r.jsx)(x.Z,{id:vn,label:gn,type:b.Z.password}),required:!0},X))}},spacing:"1em"}),(0,r.jsx)(s.Z,{alignItems:"center",columns:{xs:R.length+1},layout:sn({},H,$,V,W,Q,K),columnSpacing:"1em",rowSpacing:"0.4em"}),(0,r.jsx)(s.Z,{columns:{xs:2},layout:sn({},z,{"run-manifest-dns-csv-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"DNS"})},"run-manifest-dns-csv-cell":{children:(0,r.jsx)(xn,{children:T})},"run-manifest-ntp-csv-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"NTP"})},"run-manifest-ntp-csv-cell":{children:(0,r.jsx)(xn,{children:N})},"run-manifest-mtu-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"MTU"})},"run-manifest-mtu-cell":{children:(0,r.jsx)(xn,{children:M})}}),spacing:"0.4em"})]})},Pn=t(6632),In=t(8859);function kn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Zn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Sn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Zn(e,n,t[n])}))}return e}function An(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||Mn(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tn(e){return function(e){if(Array.isArray(e))return kn(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Mn(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 Mn(e,n){if(e){if("string"===typeof e)return kn(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)?kn(e,n):void 0}}var Fn=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=An(n,1),o=r[0].target,i=o.elements,a=i.namedItem(Ie),u=a.value,c=i.namedItem(ke),l=c.value,s=i.namedItem(Ze),d=s.value,f=i.namedItem(Qe),p=f.value,m=i.namedItem(Ke),h=m.value,v=i.namedItem(Xe),y=v.value,b=Number.parseInt(h,10),g=Number.parseInt(d,10);return Object.values(i).reduce((function(e,n){var t=n.id;if(RegExp("^".concat(fe)).test(t)){var r,o=n,i=o.dataset.handler;null===(r=he[void 0===i?"":i])||void 0===r||r.call(null,e,o)}else if(RegExp("^".concat(Be)).test(t)){var a,u=n,c=u.dataset.handler;null===(a=qe[void 0===c?"":c])||void 0===a||a.call(null,e,u)}return e}),{domain:u,hostConfig:{hosts:{}},networkConfig:{dnsCsv:p,mtu:b,networks:{},ntpCsv:y},prefix:l,sequence:g})},Cn=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=An(t,1),i=o[0].target,a=i.elements,u=a.namedItem(mn),c=u.value,l=a.namedItem(hn),s=l.value,d=Object.entries(e).reduce((function(e,n){var t=An(n,2),r=t[0],o=t[1],i=o.hostNumber,u=o.hostType,c=wn(r),l=a.namedItem(c).value;return e[r]={hostNumber:i,hostType:u,hostUuid:l},e}),{});return{description:c,hosts:d,password:s}},Un=function(){var e=(0,K.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=(0,a.useRef)({}),c=(0,a.useRef)({}),l=An((0,Pn.Z)(),2),s=l[0],f=l[1],p=An((0,X.Z)(void 0),2),h=p[0],v=p[1],y=(0,a.useState)(!1),b=y[0],j=y[1],x=An((0,X.Z)(!0),2),O=x[0],P=x[1],I=An((0,X.Z)(!0),2),k=I[0],S=I[1],A=An((0,X.Z)(!0),2),T=A[0],M=A[1],F=An((0,X.Z)(!1),2),C=F[0],U=F[1],N=An((0,X.Z)(void 0),2),R=N[0],E=N[1],B=An((0,X.Z)(void 0),2),D=B[0],q=B[1],L=(0,Q.Z)("".concat(m.Z,"/manifest"),{refreshInterval:6e4}),H=L.data,$=L.isLoading,V=(0,In.Z)([Ie,ke,Ze,Qe,Ke,Xe],c),z=V.isFormInvalid,Y=V.setMessage,J=(0,In.Z)([vn,mn,hn],c),ee=J.isFormInvalid,ne=(0,a.useMemo)((function(){return null!==R&&void 0!==R?R:{}}),[R]),te=ne.hostConfig,re=(void 0===te?{}:te).hosts,oe=void 0===re?{}:re,ie=ne.name,ae=ne.uuid,ue=(0,a.useMemo)((function(){return null!==D&&void 0!==D?D:{}}),[D]),ce=ue.domain,le=ue.fences,se=ue.prefix,de=ue.sequence,fe=ue.upses,pe=(0,a.useCallback)((function(e){var n=e.body,t=e.getErrorMsg,r=e.method,o=e.successMsg,i=e.url;U(!0),u.Z[r](i,n).then((function(){Y("api",{children:o})})).catch((function(e){var n=(0,d.Z)(e);n.children=t(n.children),Y("api",n)})).finally((function(){U(!1)}))}),[U,Y]),me=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(rn,{formUtils:V,knownFences:le,knownUpses:fe,previous:{domain:ce,prefix:se,sequence:de}}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Fn.apply(void 0,Tn(t));f({actionProceedText:"Add",content:(0,r.jsx)(r.Fragment,{}),onProceedAppend:function(){pe({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add install manifest. ",e]})},method:"post",successMsg:"Successfully added install manifest",url:"/manifest"})},titleText:"Add install manifest?"}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Add an install manifest"}}),[V,le,fe,ce,se,de,f,pe]),he=(0,a.useMemo)((function(){return{actionProceedText:"Edit",content:(0,r.jsx)(on,{formUtils:V,knownFences:le,knownUpses:fe,previous:R}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Fn.apply(void 0,Tn(t));f({actionProceedText:"Edit",content:(0,r.jsx)(r.Fragment,{}),onProceedAppend:function(){pe({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update install manifest. ",e]})},method:"put",successMsg:"Successfully updated install manifest ".concat(ie),url:"/manifest/".concat(ae)})},titleText:"Update install manifest ".concat(ie,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},loading:k,titleText:"Update install manifest ".concat(ie)}}),[V,le,fe,R,k,ie,f,pe,ae]),ve=(0,a.useMemo)((function(){return{actionProceedText:"Run",content:(0,r.jsx)(On,{formUtils:J,knownFences:le,knownHosts:h,knownUpses:fe,previous:R}),loading:k,onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Cn.apply(void 0,[oe].concat(Tn(t)));f({actionProceedText:"Run",content:(0,r.jsx)(r.Fragment,{}),onProceedAppend:function(){pe({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to run install manifest. ",e]})},method:"put",successMsg:"Successfully ran install manifest ".concat(ie),url:"/command/run-manifest/".concat(ae)})},titleText:"Run install manifest ".concat(ie,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Run install manifest ".concat(ie)}}),[J,le,h,fe,R,k,ie,oe,f,pe,ae]),ye=(0,a.useCallback)((function(e,n){S(!0),u.Z.get("manifest/".concat(e)).then((function(n){var t=n.data;t.uuid=e,E(t)})).catch((function(e){(0,d.Z)(e)})).finally((function(){S(!1),null===n||void 0===n||n.call(null)}))}),[S,E]),be=(0,a.useMemo)((function(){return(0,r.jsx)(W.Z,{allowEdit:!0,allowItemButton:b,edit:b,header:!0,listEmpty:"No manifest(s) registered.",listItems:H,onAdd:function(){var e;null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){j((function(e){return!e}))},onItemClick:function(e){var n,t=e.manifestName,r=e.manifestUUID;E({name:t,uuid:r}),null===(n=o.current.setOpen)||void 0===n||n.call(null,!0),ye(r)},renderListItem:function(e,n){var t=n.manifestName;return(0,r.jsxs)(g.Z,{fullWidth:!0,row:!0,children:[(0,r.jsx)(Ue.Z,{disabled:b,mapPreset:"play",onClick:function(){var n;E({name:t,uuid:e}),null===(n=i.current.setOpen)||void 0===n||n.call(null,!0),ye(e)},variant:"normal"}),(0,r.jsx)(Z.Ac,{children:t})]})}})}),[ye,b,H,E]),ge=(0,a.useMemo)((function(){return O||T||$?(0,r.jsx)(_.Z,{}):be}),[O,$,T,be]),je=(0,a.useMemo)((function(){return(0,r.jsx)(un.Z,{count:1,defaultMessageType:"warning",ref:c})}),[]);return e&&(u.Z.get("/manifest/template").then((function(e){var n=e.data;q(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){M(!1)})),u.Z.get("/host",{params:{types:"node"}}).then((function(e){var n=e.data;v(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){P(!1)}))),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Manage manifests"})}),ge]}),(0,r.jsx)(an.Z,Sn({},me,{disableProceed:z,loadingAction:C,preActionArea:je,ref:t,scrollContent:!0})),(0,r.jsx)(an.Z,Sn({},he,{disableProceed:z,loadingAction:C,preActionArea:je,ref:o,scrollContent:!0})),(0,r.jsx)(an.Z,Sn({},ve,{disableProceed:ee,loadingAction:C,preActionArea:je,ref:i,scrollContent:!0})),(0,r.jsx)(G.Z,Sn({closeOnProceed:!0},s,{ref:n}))]})},Nn=Un,Rn="common-ups-input-ip-address",En="common-ups-input-host-name",Bn="IP address",Dn="Host name",qn=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,a=e.previous,u=void 0===a?{}:a,c=u.upsIPAddress,l=u.upsName;return(0,r.jsx)(s.Z,{columns:{xs:1,sm:2},layout:{"common-ups-input-cell-host-name":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:En,label:Dn,value:l}),inputTestBatch:(0,ae.Gn)(Dn,(function(){i(En)}),{onFinishBatch:t(En)},(function(e){i(En,{children:e})})),onFirstRender:o(En),required:!0})},"common-ups-input-cell-ip-address":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Rn,label:Bn,value:c}),inputTestBatch:(0,ae._)(Bn,(function(){i(Rn)}),{onFinishBatch:t(Rn)},(function(e){i(Rn,{children:e})})),onFirstRender:o(Rn),required:!0})}},spacing:"1em"})},_n=t(5741);function Ln(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Hn(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Ln(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 Ln(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var $n="add-ups-select-ups-type-id",Vn=function(e){var n=e.formUtils,t=e.loading,o=e.previous,i=void 0===o?{}:o,u=e.upsTemplate,c=n.buildInputFirstRenderFunction,l=n.setValidity,s=i.upsTypeId,d=void 0===s?"":s,f=(0,K.Z)(),p=(0,a.useState)(d),m=p[0],h=p[1],v=(0,a.useMemo)((function(){return u?Object.entries(u).map((function(e){var n,t=Hn(e,2),o=t[0],i=t[1],a=i.brand,u=i.description,c=i.links[0];if(c){var l=c.linkHref,s=c.linkLabel;n=(0,r.jsx)(_n.Z,{href:l,onClick:function(e){e.stopPropagation()},sx:{display:"inline-flex",color:k.E5},target:"_blank",children:s})}return{displayValue:(0,r.jsxs)(g.Z,{spacing:0,children:[(0,r.jsx)(Z.Ac,{inverted:!0,children:a}),(0,r.jsxs)(Z.Ac,{inverted:!0,children:[u," (",n,")"]})]}),value:o}})):[]}),[u]),y=(0,a.useMemo)((function(){return u&&(0,r.jsx)(O.Z,{formControlProps:{sx:{marginTop:".3em"}},id:$n,label:"UPS type",onChange:function(e){var n=e.target.value,t=String(n);l($n,!0),h(t)},required:!0,selectItems:v,selectProps:{onClearIndicatorClick:function(){l($n,!1),h("")},renderValue:function(e){var n=String(e);return u[n].brand}},value:m})}),[u,v,m,l]),b=(0,a.useMemo)((function(){return t?(0,r.jsx)(_.Z,{}):(0,r.jsxs)(g.Z,{children:[y,m&&(0,r.jsx)(qn,{formUtils:n,previous:i})]})}),[n,m,t,y,i]);return(0,a.useEffect)((function(){f&&c($n)({isValid:Boolean(m)})}),[c,m,f]),b},Gn="edit-ups-input-ups-uuid",zn=function(e){var n=e.formUtils,t=e.loading,o=e.previous,i=e.upsTemplate,u=e.upsUUID;return(0,a.useMemo)((function(){return t?(0,r.jsx)(_.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Vn,{formUtils:n,previous:o,upsTemplate:i}),(0,r.jsx)("input",{hidden:!0,id:Gn,readOnly:!0,value:u})]})}),[n,t,o,i,u])};function Wn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Qn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Kn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Qn(e,n,t[n])}))}return e}function Xn(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Wn(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 Wn(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Yn=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o,i=Xn(t,1),a=i[0].target,u=a.elements,c=u.namedItem(En),l=c.value,s=u.namedItem(Rn),d=s.value,f=u.namedItem($n),p="",m="",h="";f&&(p=(o=e[h=f.value]).agent,m=o.brand);var v=u.namedItem(Gn),y="";v&&(y=v.value);return{upsAgent:p,upsBrand:m,upsIPAddress:d,upsName:l,upsTypeId:h,upsUUID:y}},Jn=function(e){var n=e.upsBrand,t=e.upsIPAddress,o=e.upsName,i=e.upsUUID,a={"ups-brand":{label:"Brand",value:n},"ups-name":{label:"Host name",value:o},"ups-ip-address":{label:"IP address",value:t}};return(0,r.jsx)(W.Z,{listItems:a,listItemProps:{sx:{padding:0}},renderListItem:function(e,n){var t=n.label,o=n.value;return(0,r.jsxs)(g.Z,{fullWidth:!0,growFirst:!0,row:!0,children:[(0,r.jsx)(Z.Ac,{children:t}),(0,r.jsx)(Z.$_,{children:o})]},"confirm-ups-".concat(i,"-").concat(e))}})},et=function(){var e=(0,K.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=Xn((0,Pn.Z)(),2),c=i[0],l=i[1],s=Xn((0,Pn.Z)(),2),f=s[0],p=s[1],h=(0,a.useState)(!1),v=h[0],y=h[1],b=Xn((0,X.Z)(!0),2),j=b[0],x=b[1],O=Xn((0,X.Z)(void 0),2),P=O[0],I=O[1],k=(0,Q.Z)("".concat(m.Z,"/ups"),{refreshInterval:6e4}),S=k.data,A=k.isLoading,T=(0,In.Z)([Rn,En,$n],o),M=T.isFormInvalid,F=(0,a.useCallback)((function(e){var t,o,i=e.upsAgent,a=e.upsIPAddress,u=e.upsName,c=e.upsUUID,s=null!==(o=null===(t=Object.entries(null!==P&&void 0!==P?P:{}).find((function(e){var n=Xn(e,2)[1].agent;return i===n})))||void 0===t?void 0:t[0])&&void 0!==o?o:"";return{actionProceedText:"Update",content:(0,r.jsx)(zn,{formUtils:T,previous:{upsIPAddress:a,upsName:u,upsTypeId:s},upsTemplate:P,upsUUID:c}),onSubmitAppend:function(e){var t;if(P){var o=Yn(P,e),i=o.upsName;l({actionProceedText:"Update",content:Jn(o),titleText:(0,r.jsxs)(Z.z,{children:["Update"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:i})," ","with the following data?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:(0,r.jsxs)(Z.z,{children:["Update UPS"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:u})]})}}),[T,l,P]),C=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(Vn,{formUtils:T,upsTemplate:P}),onSubmitAppend:function(e){var t;if(P){var o=Yn(P,e),i=o.upsBrand;l({actionProceedText:"Add",content:Jn(o),titleText:(0,r.jsxs)(Z.z,{children:["Add a"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:i})," UPS with the following data?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:"Add a UPS"}}),[T,l,P]),U=(0,a.useMemo)((function(){return(0,r.jsx)(W.Z,{allowEdit:!0,allowItemButton:v,edit:v,header:!0,listEmpty:"No Ups(es) registered.",listItems:S,onAdd:function(){var e;p(C),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){y((function(e){return!e}))},onItemClick:function(e){var n;p(F(e)),null===(n=t.current.setOpen)||void 0===n||n.call(null,!0)},renderListItem:function(e,n){var t=n.upsAgent,o=n.upsIPAddress,i=n.upsName;return(0,r.jsxs)(g.Z,{fullWidth:!0,row:!0,children:[(0,r.jsx)(Z.Ac,{children:i}),(0,r.jsxs)(Z.Ac,{children:['agent="',t,'"']}),(0,r.jsxs)(Z.Ac,{children:['ip="',o,'"']})]})}})}),[C,F,v,p,S]),N=(0,a.useMemo)((function(){return j||A?(0,r.jsx)(_.Z,{}):U}),[j,A,U]);return e&&u.Z.get("/ups/template").then((function(e){var n=e.data;I(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){x(!1)})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Manage UPSes"})}),N]}),(0,r.jsx)(an.Z,Kn({},f,{ref:t,preActionArea:(0,r.jsx)(un.Z,{count:1,defaultMessageType:"warning",ref:o}),proceedButtonProps:{disabled:M}})),(0,r.jsx)(G.Z,Kn({},c,{ref:n}))]})},nt=t(5697),tt=t(2186),rt=t(4799),ot=t(4825),it=t(4629),at=t(575),ut=t(4568),ct=t(3640),lt=t(476),st=t(8061);function dt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function ft(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function pt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){ft(e,n,t[n])}))}return e}function mt(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function ht(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return dt(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 dt(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var vt=function(e){var n=e.formControlProps,t=e.formControlLabelProps,o=e.formLabelProps,i=e.id,u=e.label,c=e.onChange,l=e.radioItems,s=e.radioProps,d=(void 0===s?{}:s).sx,f=e.radioGroupProps,p=mt(e.radioProps,["sx"]),m=(0,a.useMemo)((function(){return"string"===typeof u?(0,r.jsx)(Z.Ac,{children:u}):u}),[u]),h=(0,a.useMemo)((function(){return Object.entries(l).map((function(e){var n=ht(e,2),o=n[0],a=n[1],u=a.label,c=a.value,l="string"===typeof u?(0,r.jsx)(Z.Ac,{children:u}):u;return(0,r.jsx)(P.Z,pt({control:(0,r.jsx)(at.Z,pt({},p,{sx:pt(ft({},"&.".concat(ut.Z.root),{color:k.s7}),d)})),value:c,label:l},t),"".concat(i,"-").concat(o))}))}),[t,i,l,d,p]);return(0,r.jsxs)(ct.Z,pt({},n,{children:[(0,r.jsx)(lt.Z,pt({},o,{children:m})),(0,r.jsx)(st.Z,pt({onChange:c,row:!0},f,{children:h}))]}))},yt=t(3144);function bt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function gt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function jt(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return bt(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 bt(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var xt="Alteeve enterprise key",wt="Host name",Ot="RedHat password",Pt="RedHat user",It="enterpriseKey",kt="hostName",Zt="redhatPassword",St="redhatUser",At={xs:1,sm:2},Tt=function(){var e=(0,yt.Z)().protect,n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=(0,a.useRef)({}),c=(0,a.useRef)({}),l=(0,a.useRef)({}),f=(0,a.useState)(),m=f[0],h=f[1],v=(0,a.useState)(),y=v[0],O=v[1],P=jt((0,X.Z)(void 0,e),2),I=P[0],S=P[1],A=jt((0,X.Z)("",e),2),T=A[0],M=A[1],F=(0,a.useState)(""),C=F[0],U=F[1],N=(0,a.useState)(!0),R=N[0],E=N[1],B=(0,a.useState)(!1),D=B[0],q=B[1],L=(0,a.useState)(!0),H=L[0],$=L[1],V=(0,a.useState)(!0),z=V[0],W=V[1],Q=(0,a.useState)(!1),K=Q[0],Y=Q[1],J=(0,a.useState)(!0),ee=J[0],ne=J[1],te=(0,a.useState)(!1),re=te[0],oe=te[1],ie=(0,a.useState)(!1),ue=ie[0],ce=ie[1],le=(0,a.useState)(!1),se=le[0],de=le[1],fe=(0,a.useState)(!1),pe=fe[0],me=fe[1],he=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,kt,e)}),[]),ve=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,It,e)}),[]),ye=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,Zt,e)}),[]),be=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,St,e)}),[]),ge=(0,a.useCallback)((function(e){var n;return null===(n=l.current.setMessage)||void 0===n?void 0:n.call(null,"submitPrepareHost",e)}),[]),je=(0,a.useMemo)((function(){var e;return gt(e={},It,(0,ae.$e)(xt,(function(){ve()}),void 0,(function(e){ve({children:e,type:"warning"})}))),gt(e,kt,(0,ae.Ye)(wt,(function(){he()}),void 0,(function(e){he({children:e,type:"warning"})}))),gt(e,Zt,(0,ae.Gn)(Ot,(function(){ye()}),void 0,(function(e){ye({children:e,type:"warning"})}))),gt(e,St,(0,ae.Gn)(Pt,(function(){be()}),void 0,(function(e){be({children:e,type:"warning"})}))),e}),[ve,he,ye,be]),xe=(0,a.useMemo)((function(){return(0,ae.LT)(je)}),[je]),we=(0,a.useMemo)((function(){return se?void 0:"none"}),[se]),Oe=(0,a.useMemo)((function(){return(0,r.jsx)(it.ZP,{allowSubmit:ee,gridProps:{wrapperBoxProps:{sx:{display:K?"flex":"none"}}},identifierInputTestBatchBuilder:ae._,identifierLabel:"Host IP address",onIdentifierBlurAppend:function(e){var n=e.target.value;if(y){var t=n!==y;ne(t),oe(!t),de(!t)}},onSubmitAppend:function(e,n,t,r){var i={ipAddress:e,password:n};u.Z.put("/command/inquire-host",i).then((function(r){var i=r.data,a=i.hostName,u=i.hostOS,c=i.hostUUID,l=i.isConnected,s=i.isInetConnected,d=i.isOSRegistered;if(l){var f;null===(f=o.current.setValue)||void 0===f||f.call(null,a);var p=xe({inputs:gt({},kt,{value:a})});q(p),s&&/rhel/i.test(u)&&!d&&de(!0),O(e),S(n),M(c),ne(!1),oe(!0)}else t({children:"Failed to establish a connection with the given host credentials.",type:"error"})})).catch((function(e){var n=(0,d.Z)(e);null===t||void 0===t||t.call(null,n)})).finally((function(){r(!1)}))},passphraseLabel:"Host root password",submitLabel:"Test access"})}),[K,ee,y,S,M,xe]),Pe=(0,a.useMemo)((function(){return(0,r.jsx)(s.Z,{columns:At,layout:{"preparehost-host-name":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-host-name-input",inputProps:{onBlur:function(e){var n=e.target.value,t=xe({inputs:gt({},kt,{value:n})});q(t)},onFocus:function(){he()}},label:wt}),ref:o})},"preparehost-enterprise-key":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-enterprise-key-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=xe({inputs:gt({},It,{value:n})});E(t)}},onFocus:function(){ve()}},label:xt}),ref:t})}},spacing:"1em",wrapperBoxProps:{sx:{display:re?void 0:"none"}}})}),[re,ve,he,xe]),Ie=(0,a.useMemo)((function(){return(0,r.jsx)(s.Z,{columns:At,layout:{"preparehost-redhat-user":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-redhat-user-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=xe({inputs:gt({},St,{value:n})});W(t)}},onFocus:function(){be()}},label:Pt}),ref:c})},"preparehost-redhat-password":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-redhat-password-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=xe({inputs:gt({},Zt,{value:n})});$(t)}},onFocus:function(){ye()},onPasswordVisibilityAppend:function(e){ce(e!==b.Z.password)},type:b.Z.password},label:Ot}),ref:i})}},spacing:"1em",wrapperBoxProps:{sx:{display:we}}})}),[we,ye,be,xe]),ke=(0,a.useMemo)((function(){return(0,r.jsx)(p.Z,{sx:{display:re?void 0:"none"},children:(0,r.jsx)(un.Z,{count:1,ref:l})})}),[re]),Ze=(0,a.useMemo)((function(){return pe?(0,r.jsx)(_.Z,{mt:0}):(0,r.jsx)(g.Z,{row:!0,sx:{display:re?"flex":"none",justifyContent:"flex-end"},children:(0,r.jsx)(ot.Z,{disabled:!D||!R||!z||!H,onClick:function(){var e,r,a,u,l,s=null===(e=i.current.getValue)||void 0===e?void 0:e.call(null);h({enterpriseKey:(null===(r=t.current.getValue)||void 0===r?void 0:r.call(null))||"none; using community version",hostName:(null===(a=o.current.getValue)||void 0===a?void 0:a.call(null))||"",redhatPassword:s||"none",redhatPasswordHidden:(null===s||void 0===s?void 0:s.replace(/./g,"*"))||"none",redhatUser:(null===(u=c.current.getValue)||void 0===u?void 0:u.call(null))||"none"}),ge(),null===(l=n.current.setOpen)||void 0===l||l.call(null,!0)},children:"Prepare host"})})}),[R,D,H,z,re,pe,ge]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Prepare a host to include in Anvil!"})}),(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(vt,{id:"preparehost-host-type",label:"Host type",onChange:function(e,n){U(n),Y(!0)},radioItems:{node:{label:"Node",value:"node"},dr:{label:"Disaster Recovery (DR) host",value:"dr"}}}),Oe,Pe,Ie,ke,Ze]})]}),(0,r.jsx)(G.Z,{actionProceedText:"Prepare",closeOnProceed:!0,content:(0,r.jsx)(s.Z,{calculateItemBreakpoints:function(e){return{xs:e%2===0?1:2}},columns:3,layout:{"preparehost-confirm-host-type-label":{children:(0,r.jsx)(Z.Ac,{children:"Host type"})},"preparehost-confirm-host-type-value":{children:(0,r.jsx)(Z.$_,{children:"dr"===C?"Disaster Recovery (DR)":"Node"})},"preparehost-confirm-host-name-label":{children:(0,r.jsx)(Z.Ac,{children:"Host name"})},"preparehost-confirm-host-name-value":{children:(0,r.jsx)(Z.$_,{children:null===m||void 0===m?void 0:m.hostName})},"preparehost-confirm-enterprise-key-label":{children:(0,r.jsx)(Z.Ac,{children:"Alteeve enterprise key"})},"preparehost-confirm-enterprise-key-value":{children:(0,r.jsx)(Z.$_,{children:null===m||void 0===m?void 0:m.enterpriseKey})},"preparehost-confirm-redhat-user-label":{children:(0,r.jsx)(Z.Ac,{children:"RedHat user"}),sx:{display:we}},"preparehost-confirm-redhat-user-value":{children:(0,r.jsx)(Z.$_,{children:null===m||void 0===m?void 0:m.redhatUser}),sx:{display:we}},"preparehost-confirm-redhat-password-label":{children:(0,r.jsx)(Z.Ac,{children:"RedHat password"}),sx:{display:we}},"preparehost-confirm-redhat-password-value":{children:(0,r.jsxs)(g.Z,{row:!0,sx:{height:"100%",maxWidth:"100%"},children:[(0,r.jsx)(Z.$_,{sx:{flexGrow:1,maxWidth:"calc(100% - 3em)",overflowX:"scroll"},children:ue?null===m||void 0===m?void 0:m.redhatPassword:null===m||void 0===m?void 0:m.redhatPasswordHidden}),(0,r.jsx)(rt.Z,{onClick:function(){ce((function(e){return!e}))},sx:{color:k.s7,padding:0},children:ue?(0,r.jsx)(nt.Z,{}):(0,r.jsx)(tt.Z,{})})]}),sx:{display:we}}},spacing:".6em"}),onCancelAppend:function(){ce(!1)},onProceedAppend:function(){var e,n,r,a;me(!0),u.Z.put("/host/prepare",{enterpriseUUID:null===(e=t.current.getValue)||void 0===e?void 0:e.call(null),hostIPAddress:y,hostName:null===(n=o.current.getValue)||void 0===n?void 0:n.call(null),hostPassword:I,hostType:C,hostUUID:T,redhatPassword:null===(r=i.current.getValue)||void 0===r?void 0:r.call(null),redhatUser:null===(a=c.current.getValue)||void 0===a?void 0:a.call(null)}).then((function(){ge({children:"Successfully initiated prepare host."}),setTimeout((function(){ge()}),5e3)})).catch((function(e){var n=(0,d.Z)(e,{onResponseErrorAppend:function(e){var n;return 400===e.status&&(n={children:"The API found invalid values. Did you forget to fill in one of the RedHat fields?",type:"warning"}),n}});ge(n)})).finally((function(){me(!1)}))},ref:n,titleText:"Confirm host preparation"})]})},Mt=t(8187),Ft=t(8461);function Ct(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Ut(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Nt(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Ct(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 Ct(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Rt=function(e){var n=e.expectUUID,t=void 0!==n&&n,o=e.hostUUID,c=(0,yt.Z)().protect,s=(0,i.useRouter)(),f=s.isReady,p=s.query.host_uuid,m=Nt((0,X.Z)(void 0,c),2),h=m[0],v=m[1],y=Nt((0,X.Z)(void 0,c),2),b=y[0],O=y[1],P=Nt((0,X.Z)(!0,c),2),I=P[0],k=P[1],S=Nt((0,X.Z)(void 0,c),2),A=S[0],T=S[1],M=(0,a.useMemo)((function(){return o!==A}),[o,A]),F=(0,a.useMemo)((function(){return Boolean(o)&&M}),[o,M]),C=(0,a.useMemo)((function(){return(0,r.jsx)(w.V9,{children:(0,r.jsxs)(Z.z,{children:["Prepare network on ",null===h||void 0===h?void 0:h.shortHostName]})})}),[h]),U=(0,a.useMemo)((function(){var e;return e=I?(0,r.jsx)(_.Z,{mt:0}):b?(0,r.jsx)(Mt.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Ut(e,n,t[n])}))}return e}({},b)):(0,r.jsxs)(r.Fragment,{children:[C,(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{maxWidth:"20em"}},id:"prepare-network-host-name",label:"Host name",value:null===h||void 0===h?void 0:h.hostName}),required:!0}),(0,r.jsx)(Ft.Z,{hostDetail:h}),(0,r.jsx)(g.Z,{row:!0,justifyContent:"flex-end",children:(0,r.jsx)(ot.Z,{children:"Prepare network"})})]})]}),e}),[h,b,I,C]),N=(0,a.useCallback)((function(e){k(!0),I&&u.Z.get("/host/".concat(e)).then((function(e){var n=e.data;T(n.hostUUID),v(n)})).catch((function(e){var n=(0,d.Z)(e).children;O({children:"Failed to get target host information; cannot continue. ".concat(n),type:"error"})})).finally((function(){k(!1)}))}),[k,I,T,v,O]);return(0,a.useEffect)((function(){t?F&&N(o):f&&!b&&(p?N(l(p)):(O({children:"No host UUID provided; cannot continue.",type:"error"}),k(!1)))}),[b,N,o,t,f,p,O,v,k,F]),(0,r.jsx)(w.s_,{children:U})},Et=t(5316),Bt=t(1073);function Dt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function qt(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var _t=function(e){var n=e.label,t=qt(e,["label"]),o=(0,a.useMemo)((function(){return"string"===typeof n?(0,r.jsx)(Z.Ac,{inheritColour:!0,children:n}):n}),[n]);return(0,r.jsx)(Et.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Dt(e,n,t[n])}))}return e}({},t,{label:o,sx:Dt({borderRadius:k.n_,color:k.s7,padding:".4em .8em",textTransform:"none"},"&.".concat(Bt.Z.selected),{color:k.Ej})}))},Lt=function(e){var n=e.changingTabId,t=e.children,o=e.retain,i=void 0!==o&&o,u=e.tabId,c=(0,a.useMemo)((function(){return n===u}),[n,u]),l=(0,a.useMemo)((function(){return i?(0,r.jsx)(p.Z,{sx:{display:c?"initial":"none"},children:t}):c&&t}),[t,c,i]);return(0,r.jsx)(r.Fragment,{children:l})},Ht=t(2734),$t=t(8396),Vt=t(7023),Gt=t(852);function zt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Wt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Qt(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function Kt(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return zt(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 zt(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Xt="1.8em",Yt=function(e){var n,t,o=e.orientation,i=e.variant,u=void 0===i?"fullWidth":i,c=Qt(e,["orientation","variant"]),l=(0,Ht.Z)(),s=(0,a.useCallback)((function(e){return l.breakpoints.up(e)}),[l]),d=(0,$t.Z)(s("xs")),f=(0,$t.Z)(s("sm")),p=(0,$t.Z)(s("md")),m=(0,$t.Z)(s("lg")),h=(0,$t.Z)(s("xl")),v=(0,a.useMemo)((function(){return[["xs",d],["sm",f],["md",p],["lg",m],["xl",h]]}),[m,p,f,h,d]),y=(0,a.useMemo)((function(){var e;return"object"===typeof o?v.some((function(n){var t=Kt(n,2),r=t[0],i=t[1];return i&&o[r]&&(e=o[r]),!i})):e=o,e}),[v,o]);return(0,r.jsx)(Vt.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Wt(e,n,t[n])}))}return e}({},c,{orientation:y,variant:u,sx:(t={minHeight:"1em"},Wt(t,"&.".concat(Gt.Z.vertical),(n={minHeight:Xt},Wt(n,"& .".concat(Bt.Z.root),{alignItems:"flex-start",minHeight:Xt,paddingLeft:"2em"}),Wt(n,"& .".concat(Gt.Z.indicator),{right:"initial"}),n)),Wt(t,"& .".concat(Bt.Z.root),{minHeight:"1em"}),Wt(t,"& .".concat(Gt.Z.indicator),{backgroundColor:k.Ej,borderRadius:k.n_}),t)}))};function Jt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function er(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function nr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){er(e,n,t[n])}))}return e}function tr(e,n){return function(e){if(Array.isArray(e))return e}(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,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Jt(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 Jt(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var rr,or="prepare-host",ir="prepare-network",ar="manage-fence",ur="manage-ups",cr="manage-manifest",lr=(er(rr={},or,"Prepare Host"),er(rr,ir,"Prepare Network"),er(rr,ar,"Manage Fence Devices"),er(rr,ur,"Manage UPSes"),er(rr,cr,"Manage Manifests"),rr),sr="Loading",dr={md:8,sm:6,xs:1},fr={md:6,sm:4,xs:1},pr=function(){return(0,r.jsx)(s.Z,{columns:dr,layout:{"preparehost-left-column":{},"preparehost-center-column":nr({children:(0,r.jsx)(Tt,{})},fr)}})},mr=function(){var e=(0,K.Z)(),n=(0,yt.Z)().protect,t=tr((0,X.Z)(void 0,n),2),o=t[0],i=t[1],c=(0,a.useState)(!1),l=c[0],f=c[1],p=(0,a.useMemo)((function(){var e;if(o){var n=Object.entries(o);e=(0,r.jsx)(Yt,{onChange:function(e,n){f(n)},orientation:"vertical",value:l,children:n.map((function(e){var n=tr(e,2),t=n[0],o=n[1].shortHostName;return(0,r.jsx)(_t,{label:o,value:t},"".concat(ir,"-").concat(t))}))})}else e=(0,r.jsx)(_.Z,{mt:0});return e}),[o,l]);return e&&u.Z.get("/host",{params:{types:"node,dr"}}).then((function(e){var n=e.data;i(n),f(Object.keys(n)[0])})).catch((function(e){(0,d.Z)(e)})),(0,r.jsx)(s.Z,{columns:dr,layout:{"preparenetwork-left-column":{children:(0,r.jsx)(w.s_,{children:p}),sm:2},"preparenetwork-center-column":nr({children:(0,r.jsx)(Rt,{expectUUID:!0,hostUUID:l||void 0})},fr)}})},hr=function(){return(0,r.jsx)(s.Z,{columns:dr,layout:{"managefence-left-column":{},"managefence-center-column":nr({children:(0,r.jsx)(ie,{})},fr)}})},vr=function(){return(0,r.jsx)(s.Z,{columns:dr,layout:{"manageups-left-column":{},"manageups-center-column":nr({children:(0,r.jsx)(et,{})},fr)}})},yr=function(){return(0,r.jsx)(s.Z,{columns:dr,layout:{"managemanifest-left-column":{},"managemanifest-center-column":nr({children:(0,r.jsx)(Nn,{})},fr)}})},br=function(){var e=(0,i.useRouter)(),n=e.isReady,t=e.query.step,u=(0,a.useState)(!1),c=u[0],s=u[1],d=(0,a.useState)(sr),p=d[0],m=d[1];return(0,a.useEffect)((function(){if(n){var e=l(t,{fallbackValue:or});lr[e]||(e=or),p===sr&&m(lr[e]),c||s(e)}}),[n,c,p,t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.default,{children:(0,r.jsx)("title",{children:p})}),(0,r.jsx)(f.Z,{}),(0,r.jsx)(w.s_,{children:(0,r.jsxs)(Yt,{onChange:function(e,n){s(n),m(lr[n])},orientation:{xs:"vertical",sm:"horizontal"},value:c,children:[(0,r.jsx)(_t,{label:"Prepare host",value:or}),(0,r.jsx)(_t,{label:"Prepare network",value:ir}),(0,r.jsx)(_t,{label:"Manage fence devices",value:ar}),(0,r.jsx)(_t,{label:"Manage UPSes",value:ur}),(0,r.jsx)(_t,{label:"Manage manifests",value:cr})]})}),(0,r.jsx)(Lt,{changingTabId:c,tabId:or,children:(0,r.jsx)(pr,{})}),(0,r.jsx)(Lt,{changingTabId:c,tabId:ir,children:(0,r.jsx)(mr,{})}),(0,r.jsx)(Lt,{changingTabId:c,tabId:ar,children:(0,r.jsx)(hr,{})}),(0,r.jsx)(Lt,{changingTabId:c,tabId:ur,children:(0,r.jsx)(vr,{})}),(0,r.jsx)(Lt,{changingTabId:c,tabId:cr,children:(0,r.jsx)(yr,{})})]})}}},function(e){e.O(0,[382,923,894,182,536,644,676,305,746,203,899,140,903,692,774,888,179],(function(){return n=4173,e(e.s=n);var n}));var n=e.O();_N_E=n}]);