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
104 KiB
1 lines
104 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},8610:function(e,n,t){"use strict";var r=t(5893),o=t(8216),i=t(7212),a=t(8462),u=t(7357),c=t(4690),l=t(7750);function s(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 d(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function f(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){d(e,n,t[n])}))}return e}function p(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 s(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 s(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 m=function(e){var n=e.replace(/([a-z\d])([A-Z])/g,"$1 $2").toLowerCase();return(0,o.Z)(n)},h=function(e){var n=e.entry;return(0,r.jsx)(l.$_,{whiteSpace:"nowrap",children:String(n)})},v=function(e){var n=e.depth,t=void 0===n?0:n,o=e.entries,u=e.getEntryLabel,c=e.getListProps,l=e.getListItemProps,s=e.listKey,d=e.maxDepth,m=e.renderEntry,h=e.renderEntryValue,y=[];Object.entries(o).forEach((function(e){var n=p(e,2),o=n[0],a=n[1],c="form-summary-entry-".concat(o),s=null!==a&&"object"===typeof a,b=s?null:a;y.push((0,r.jsx)(i.ZP,f({sx:{paddingLeft:"".concat(t,"em")}},null===l||void 0===l?void 0:l.call(null,{depth:t,entry:b,key:o}),{children:m({depth:t,entry:b,getLabel:u,key:o,nest:s,renderValue:h})}),c)),s&&t<d&&y.push(v({depth:t+1,entries:a,getEntryLabel:u,listKey:o,maxDepth:d,renderEntry:m,renderEntryValue:h}))}));var b="form-summary-list-".concat(null!==s&&void 0!==s?s:"root");return(0,r.jsx)(a.Z,f({dense:!0,disablePadding:!0},null===c||void 0===c?void 0:c.call(null,{depth:t,entries:o,key:s}),{children:y}),b)};n.Z=function(e){var n=e.entries,t=e.getEntryLabel,o=void 0===t?function(e){return(0,e.cap)(e.key)}:t,i=e.getListProps,a=e.getListItemProps,s=e.hasPassword,d=e.maxDepth,f=void 0===d?3:d,p=e.renderEntry,y=void 0===p?function(e){var n=e.depth,t=e.entry,o=e.getLabel,i=e.key,a=e.nest,s=e.renderValue;return(0,r.jsxs)(c.Z,{fullWidth:!0,growFirst:!0,row:!0,maxWidth:"100%",children:[(0,r.jsx)(l.Ac,{children:o({cap:m,depth:n,entry:t,key:i})}),(0,r.jsx)(u.Z,{sx:{maxWidth:"100%",overflowX:"scroll"},children:!a&&s({depth:n,entry:t,key:i})})]})}:p,b=e.renderEntryValue;return v({entries:n,getEntryLabel:o,getListProps:i,getListItemProps:a,maxDepth:f,renderEntry:y,renderEntryValue:void 0===b?function(e){var n=e.entry;return["",null,void 0].some((function(e){return n===e}))?(0,r.jsx)(l.Ac,{children:"none"}):s?function(e){var n=e.entry,t=e.key;return/passw/i.test(t)?(0,r.jsx)(l.PJ,{revealButtonProps:{sx:{marginRight:0,padding:0}},monospaced:!0,textLineHeight:null,children:String(n)}):h(e)}(e):h(e)}:b})}},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 k={width:"100%"},P="gate-input",I="".concat(P,"-credential-id"),Z="".concat(P,"-credential-passphrase"),S="access",A=(0,i.forwardRef)((function(e,n){var t,y,b=e.formContainer,O=void 0===b||b,P=e.gridProps,A=void 0===P?{}:P,M=A.columns,T=void 0===M?{xs:1,sm:2}:M,F=(A.layout,A.spacing),C=void 0===F?"1em":F,U=e.identifierId,E=void 0===U?I:U,N=e.identifierInputTestBatchBuilder,R=void 0===N?m.Gn:N,B=e.identifierLabel,D=e.identifierOutlinedInputWithLabelProps,L=void 0===D?{}:D,q=L.formControlProps,_=void 0===q?{}:q,H=L.inputProps,V=e.onIdentifierBlurAppend,$=e.onSubmit,G=e.onSubmitAppend,z=e.passphraseId,W=void 0===z?Z:z,Q=e.passphraseLabel,K=e.passphraseOutlinedInputWithLabelProps,J=void 0===K?{}:K,X=J.formControlProps,Y=void 0===X?{}:X,ee=J.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=_.sx,ce=j(_,["sx"]),le=Y.sx,se=j(Y,["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)([I,Z],pe),be=ye.buildFinishInputTestBatchFunction,ge=ye.buildInputFirstRenderFunction,je=ye.buildInputUnmountFunction,xe=ye.isFormInvalid,we=ye.setMessage,Oe=(0,i.useMemo)((function(){return null!==$&&void 0!==$?$: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(I),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)))}}),[$,G,ve,we]),ke=(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]),Pe=(0,i.useMemo)((function(){var e={};return re&&(e["gate-cell-message-group"]={children:(0,r.jsx)(d.Z,{count:1,defaultMessageType:"warning",ref:pe}),sm:2},e["gate-cell-submit"]={children:ke,sm:2}),e}),[re,ke]),Ie=(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({},Ie,{children:(0,r.jsx)(l.Z,g({columns:T,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({},k,ue)}),id:E,inputProps:H,label:B},ie)),inputTestBatch:R(B,(function(){we(E)}),{onFinishBatch:be(E)},(function(e){we(E,{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===V||void 0===V||(r=V).call.apply(r,[null].concat(w(n)))},onFirstRender:ge(E),onUnmount:je(E),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({},k,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})}},Pe),spacing:C},oe))}))}));A.displayName="GateForm",n.ZP=A},3906:function(e,n,t){"use strict";var r=t(5893),o=t(7294),i=t(6607),a=t(8610);function u(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(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){u(e,n,t[n])}))}return e}n.Z=function(e){var n=e.list,t=void 0===n?{}:n,u=(0,o.useState)({}),l=u[0],s=u[1],d=(0,o.useMemo)((function(){return Object.keys(t)}),[t]),f=(0,o.useMemo)((function(){return Object.keys(l)}),[l]),p=(0,o.useMemo)((function(){return f.length===d.length}),[f.length,d.length]),m=(0,o.useMemo)((function(){return f.length>0}),[f.length]),h=(0,o.useMemo)((function(){return d.length>1}),[d.length]),v=(0,o.useCallback)((function(e){var n=e.confirmDialogProps,t=void 0===n?{}:n,o=e.formSummaryProps,i=void 0===o?{}:o,u=e.getConfirmDialogTitle,s=e.onProceedAppend,d=e.renderEntry;return c({actionProceedText:"Delete",content:(0,r.jsx)(a.Z,c({entries:l,maxDepth:0,renderEntry:d},i)),onProceedAppend:s,proceedColour:"red",titleText:u(f.length)},t)}),[l,f.length]),y=(0,o.useCallback)((function(e){return l[e]}),[l]),b=(0,o.useCallback)((function(e){return s(d.reduce((function(n,t){return e&&(n[t]=e),n}),{}))}),[d]),g=(0,o.useCallback)((function(e,n){return s((0,i.ZP)(e,n||void 0))}),[]);return{buildDeleteDialogProps:v,checklist:l,checks:f,getCheck:y,hasAllChecks:p,hasChecks:m,multipleItems:h,setAllChecks:b,setCheck:g}}},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 Cr}});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(2029),m=t(7357),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),k=t(480),P=t(2852),I=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 M=(0,v.ZP)(k.Z)({height:"3.5em",marginLeft:0,width:"100%"}),T=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(I.s7,"AF"),children:u}):(0,r.jsx)(r.Fragment,{children:u})}),[u]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(M,A({componentsProps:{typography:{flexGrow:1}},control:(0,r.jsx)(P.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))]})},F=t(7987);function C(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 U(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(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 C(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 C(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=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,r=n.setMessage,o=e.id,i=e.label,a=t(o),u=function(){r(o)};return"ip"===i.toLowerCase()?(0,F._)(i,u,{onFinishBatch:a},(function(e){r(o,{children:e})})):{defaults:{onSuccess:u},onFinishBatch:a,tests:[{test:F.HJ}]}},B=function(e){var n=e.formUtils,t=e.id,o=e.isRequired,i=e.label,a=void 0===i?"":i,u=e.name,c=void 0===u?t:u,l=e.value,s=n.buildFinishInputTestBatchFunction,d=n.buildInputFirstRenderFunction,f=n.setMessage;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:t,label:a,name:c,value:l}),inputTestBatch:(0,F.qY)(a,(function(){f(t)}),{onFinishBatch:s(t)},(function(e){f(t,{children:e})})),onFirstRender:d(t),required:o,valueType:"number"},"".concat(t,"-wrapper"))},D={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)(T,{checked:o,id:n,label:i,name:u}),valueType:"boolean"},"".concat(n,"-wrapper"))},integer:B,second:B,select:function(e){var n=e.formUtils,t=e.id,o=e.isRequired,i=e.label,a=e.name,u=void 0===a?t:a,c=e.selectOptions,l=void 0===c?[]:c,s=e.value,d=void 0===s?"":s,f=n.buildFinishInputTestBatchFunction,p=n.buildInputFirstRenderFunction,m=n.setMessage;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(O.Z,{id:t,label:i,name:u,selectItems:l,value:d}),inputTestBatch:{defaults:{onSuccess:function(){m(t)}},onFinishBatch:f(t),tests:[{test:F.HJ}]},onFirstRender:p(t),required:o},"".concat(t,"-wrapper"))},string:function(e){var n,t=e.formUtils,o=e.id,i=e.isRequired,a=e.isSensitive,u=void 0!==a&&a,c=e.label,l=void 0===c?"":c,s=e.name,d=void 0===s?o:s,f=e.value,p=t.buildInputFirstRenderFunction;return u&&(n=b.Z.password),(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:o,label:l,name:d,type:n,value:f}),inputTestBatch:R({formUtils:t,id:o,label:l}),onFirstRender:p(o),required:i},"".concat(o,"-wrapper"))}},L=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.join("-")},q=(0,v.ZP)(g.Z)({margin:".4em 0"}),_=function(e){var n=e.fenceId,t=e.fenceParameterTooltipProps,o=e.fenceTemplate,i=e.formUtils,u=e.previousFenceName,c=e.previousFenceParameters,l=i.buildFinishInputTestBatchFunction,s=i.buildInputFirstRenderFunction,d=i.setMessage,f=(0,a.useMemo)((function(){var e;if(o&&n){var a=o[n].parameters,f={};c&&(f=Object.entries(c).reduce((function(e,t){var r=E(t,2),o=r[0],i=r[1];return e[L(n,o)]=i,e}),{}));var p=Object.entries(a).sort((function(e,n){return E(e,1)[0]>E(n,1)[0]?1:-1})).reduce((function(e,o){var a=E(o,2),u=a[0],c=a[1],l=c.content_type,s=c.default,d=c.deprecated,p=c.description,h=c.options,v=c.required;if("1"===String(d))return e;var b,g,j=e.optional,x=e.required,w=null!==(b=D[l])&&void 0!==b?b:D.string,O=L(n,u),k=null!==(g=f[O])&&void 0!==g?g:s,P="1"===String(v),I=/passw/i.test(u),S=w({formUtils:i,id:O,isChecked:N.includes(k),isRequired:P,isSensitive:I,label:u,selectOptions:h,value:k}),A=(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){U(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:p})},t,{children:(0,r.jsx)(m.Z,{children:S})}),"".concat(O,"-tooltip"));return P?x.push(A):j.push(A),e}),{optional:[],required:[]}),h=p.optional,v=p.required,b=L(n,"name"),O="Fence device name";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.jsxs)(q,{children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:b,label:O,name:b,value:u}),inputTestBatch:(0,F.Gn)(O,(function(){d(b)}),{onFinishBatch:l(b)},(function(e){d(b,{children:e})})),onFirstRender:s(b),required:!0},"".concat(b,"-wrapper")),v]})}),(0,r.jsx)(w.TZ,{header:"Optional parameters",children:(0,r.jsx)(q,{children:h})})]})}return e}),[l,s,n,t,o,i,u,c,d]);return(0,r.jsx)(r.Fragment,{children:f})},H=t(2152),V=t(1081);function $(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 G(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function z(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 $(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 $(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 W="add-fence-input-agent",Q=function(e){var n=e.fenceTemplate,t=e.formUtils,o=e.loading,i=t.setValidity,u=(0,V.Z)(),c=(0,a.useState)(null),l=c[0],s=c[1],d=(0,a.useMemo)((function(){return n?Object.entries(n).sort((function(e,n){return z(e,1)[0]>z(n,1)[0]?1:-1})).map((function(e){var n=z(e,2),t=n[0],r=n[1].description;return{fenceDescription:"string"===typeof r?r:"No description.",fenceId:t,label:t}})):[]}),[n]),f=(0,a.useMemo)((function(){return(0,r.jsx)(h.Z,{id:W,isOptionEqualToValue:function(e,n){return e.fenceId===n.fenceId},label:"Fence device type",onChange:function(e,n){i(W,null!==n),s(n)},openOnFocus:!0,options:d,renderOption:function(e,n,t){var o=n.fenceDescription,i=n.fenceId,a=t.selected;return(0,r.jsxs)(m.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){G(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:l})}),[d,l,i]),p=(0,a.useMemo)((function(){return(0,r.jsx)(_,{fenceId:null===l||void 0===l?void 0:l.fenceId,fenceTemplate:n,formUtils:t})}),[n,null===l||void 0===l?void 0:l.fenceId,t]),v=(0,a.useMemo)((function(){return o?(0,r.jsx)(H.Z,{}):(0,r.jsxs)(g.Z,{children:[f,p]})}),[f,p,o]);return(0,a.useEffect)((function(){u&&i(W,null!==l)}),[l,u,i]),(0,r.jsx)(r.Fragment,{children:v})},K=t(157),J=function(e){var n=e.fenceId,t=e.fenceTemplate,o=e.formUtils,i=e.loading,u=e.previousFenceName,c=e.previousFenceParameters,l=(0,a.useMemo)((function(){return i?(0,r.jsx)(H.Z,{}):(0,r.jsx)(_,{fenceId:n,fenceTemplate:t,formUtils:o,previousFenceName:u,previousFenceParameters:c})}),[t,n,o,i,u,c]);return(0,r.jsx)(r.Fragment,{children:l})},X=t(2545),Y=t(8610),ee=t(6125),ne=t(7869),te=t(1905),re=t(3906),oe=t(6632),ie=t(8859),ae=t(2749);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=function(e){var n=e.id,t=new RegExp("^(fence[^-]+)".concat("-","([^\\s]+)$")),r=n.match(t);if(!r)throw Error("Not target input element");return r},fe=function(e,n,t){if("name"===e)throw n.name=t,Error("Not child parameter")},pe=function(e){if(!e)throw Error("Not parameter specification")},me=function(e,n){if([n,"",null,void 0].some((function(n){return e===n})))throw Error("Skippable parameter value")},he=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=se(t,1),i=o[0].target,a=i.elements;return Object.values(a).reduce((function(n,t){try{var r=se(de(t),3),o=r[1],i=r[2];n.agent=o;var a=t,u=a.checked,c=a.value;fe(i,n,c);var l=e[o].parameters[i];pe(l);var s=l.content_type,d=l.default,f=c;"boolean"===s&&(f=u?"1":""),me(f,d),n.parameters[i]=f}catch(p){return n}return n}),{agent:"",name:"",parameters:{}})},ve=function(){var e=(0,V.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=se((0,oe.Z)(),2),c=i[0],l=i[1],s=se((0,oe.Z)(),2),f=s[0],m=s[1],h=se((0,ae.Z)(void 0),2),v=h[0],y=h[1],b=(0,a.useState)(!1),j=b[0],x=b[1],O=se((0,ae.Z)(!0),2),k=O[0],P=O[1],I=(0,te.Z)("".concat(p.Z,"/fence"),{refreshInterval:6e4}),S=I.data,A=I.isLoading,M=(0,ie.Z)([W],o),T=M.isFormInvalid,F=M.isFormSubmitting,C=M.submitForm,U=(0,re.Z)({list:S}),E=U.buildDeleteDialogProps,N=U.checks,R=U.getCheck,B=U.hasChecks,D=U.setCheck,L=(0,a.useCallback)((function(e){var n=e.cap,t=e.depth,r=e.key;return 0===t?n(r):r}),[]),q=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:j,disableDelete:!B,edit:j,header:!0,listItems:S,onAdd:function(){var e;m({actionProceedText:"Add",content:(0,r.jsx)(Q,{fenceTemplate:v,formUtils:M}),onSubmitAppend:function(e){var t;if(v){var o=he(v,e),i=o.agent,a=o.name;l({actionProceedText:"Add",content:(0,r.jsx)(Y.Z,{entries:o,hasPassword:!0,getEntryLabel:L}),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add fence device. ",e]})},method:"post",successMsg:"Added fence device ".concat(a),url:"/fence"})},titleText:(0,r.jsxs)(Z.z,{children:["Add a"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:i})," ","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)},onDelete:function(){var e;l(E({getConfirmDialogTitle:function(e){return"Delete ".concat(e," fence device(s)?")},onProceedAppend:function(){C({body:{uuids:N},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to delete fence device(s). ",e]})},method:"delete",url:"/fence"})},renderEntry:function(e){var n=e.key;return(0,r.jsx)(Z.Ac,{children:null===S||void 0===S?void 0:S[n].fenceName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){x((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){D(e,t)},onItemClick:function(e){var o,i=e.fenceAgent,a=e.fenceName,u=e.fenceParameters,c=e.fenceUUID;m({actionProceedText:"Update",content:(0,r.jsx)(J,{fenceId:i,fenceTemplate:v,formUtils:M,previousFenceName:a,previousFenceParameters:u}),onSubmitAppend:function(e){var t;if(v){var o=he(v,e);l({actionProceedText:"Update",content:(0,r.jsx)(Y.Z,{entries:o,hasPassword:!0,getEntryLabel:L}),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update fence device. ",e]})},method:"put",successMsg:"Updated fence device ".concat(a),url:"/fence/".concat(c)})},titleText:(0,r.jsxs)(Z.z,{children:["Update"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:a})," ","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)},renderListItemCheckboxState:function(e){return R(e)},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=se(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)})]})}})}),[E,N,S,v,M,R,L,B,j,D,l,m,C]),_=(0,a.useMemo)((function(){return k||A?(0,r.jsx)(H.Z,{}):q}),[A,k,q]),$=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:o})}),[]);return e&&u.Z.get("/fence/template").then((function(e){var n=e.data;y(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"})}),_]}),(0,r.jsx)(X.Z,le({dialogProps:{PaperProps:{sx:{minWidth:{xs:"90%",md:"50em"}}}},scrollBoxProps:{padding:".3em .5em"}},f,{disableProceed:T,loadingAction:F,preActionArea:$,ref:t,scrollContent:!0})),(0,r.jsx)(K.Z,le({closeOnProceed:!0,scrollBoxProps:{paddingRight:"1em"}},c,{ref:n,scrollContent:!0}))]})};function ye(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 be(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ge(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){be(e,n,t[n])}))}return e}function je(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 ye(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 ye(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 xe,we="an-host-input",Oe="".concat(we,"-cell"),ke="IPMI IP",Pe=(be(xe={},"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})),be(xe,"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}})),be(xe,"ipmi",(function(e,n){var t=n.dataset.hostId,r=void 0===t?"":t,o=n.value;e.hostConfig.hosts[r].ipmiIp=o})),be(xe,"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})),be(xe,"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})),xe),Ie={xs:1,sm:2,md:3},Ze=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,k=void 0===O?{}:O,P=e.hostLabel,I=void 0===P?"".concat(d," ").concat(l):P,S=(0,a.useMemo)((function(){return Object.entries(h)}),[h]),A=(0,a.useMemo)((function(){return Object.entries(b)}),[b]),M=(0,a.useMemo)((function(){return Object.entries(k)}),[k]),C=(0,a.useMemo)((function(){return Boolean(M.length)}),[M.length]),U=(0,a.useMemo)((function(){return"".concat(we,"-").concat(c)}),[c]),E=(0,a.useMemo)((function(){return function(e){return"".concat(we,"-").concat(e,"-ipmi-ip")}(c)}),[c]),N=(0,a.useMemo)((function(){return"".concat(Oe,"-").concat(c,"-ipmi-ip")}),[c]),R=(0,a.useMemo)((function(){return S.reduce((function(e,n){var i=je(n,2),a=i[0],l=i[1],s=l.fenceName,d=l.fencePort,f="".concat(Oe,"-").concat(c,"-").concat(a,"-port"),p=function(e,n){return"".concat(we,"-").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,F.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]),B=(0,a.useMemo)((function(){return A.reduce((function(e,n){var a=je(n,2),l=a[0],s=a[1],d=s.networkIp,f=s.networkNumber,p=s.networkType,m="".concat(Oe,"-").concat(c,"-").concat(l,"-ip"),h=function(e,n){return"".concat(we,"-").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,F._)("".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]),D=(0,a.useMemo)((function(){return M.reduce((function(e,n){var t=je(n,2),o=t[0],i=t[1],a=i.isUsed,u=i.upsName,l="".concat(Oe,"-").concat(c,"-").concat(o,"-power-host"),s=function(e,n){return"".concat(we,"-").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)(T,{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,M]),L=(0,a.useMemo)((function(){return C&&(0,r.jsx)(s.Z,{columns:Ie,layout:D,spacing:"1em"})}),[C,D]);return(0,r.jsxs)(w.Lg,{mv:0,children:[(0,r.jsx)(w.CH,{children:(0,r.jsx)(Z.Ac,{children:I})}),(0,r.jsxs)(w.bc,{children:[(0,r.jsx)("input",{hidden:!0,id:U,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:Ie,layout:ge({},B,be({},N,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"ipmi","data-host-id":c},id:E,label:ke,value:v}),inputTestBatch:(0,F._)("".concat(c," ").concat(ke),(function(){u(E)}),{onFinishBatch:t(E)},(function(e){u(E,{children:e})})),onFirstRender:o(E),onUnmount:i(E),required:!0})}),R),spacing:"1em"}),L]})]})]})};function Se(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 Ae(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 Se(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 Se(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 Me="".concat("an-host-config-input","-group"),Te="".concat(Me,"-cell"),Fe={node1:{hostNumber:1,hostType:"node"},node2:{hostNumber:2,hostType:"node"}},Ce=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?Fe: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=Ae(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=Ae(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(Te,"-").concat(i)]={children:(0,r.jsx)(Ze,{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"})},Ue="an-id-input",Ee="".concat(Ue,"-domain"),Ne="".concat(Ue,"-prefix"),Re="".concat(Ue,"-sequence"),Be="Domain name",De="Prefix",Le="Sequence",qe=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:Ne,label:De,value:l}),inputTestBatch:(0,F.Gn)(De,(function(){i(Ne)}),{onFinishBatch:t(Ne)},(function(e){i(Ne,{children:e})})),onFirstRender:o(Ne),required:!0})},"an-id-input-cell-domain":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Ee,label:Be,value:c}),inputTestBatch:(0,F.Gn)(Be,(function(){i(Ee)}),{onFinishBatch:t(Ee)},(function(e){i(Ee,{children:e})})),onFirstRender:o(Ee),required:!0})},"an-id-input-cell-sequence":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Re,label:Le,value:d}),inputTestBatch:(0,F.qY)(Le,(function(){i(Re)}),{onFinishBatch:t(Re)},(function(e){i(Re,{children:e})})),onFirstRender:o(Re),required:!0,valueType:"number"})}},spacing:"1em"})},_e=t(5934),He=t(3106),Ve=t(1706);function $e(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,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ze(e){return function(e){if(Array.isArray(e))return $e(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 $e(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 $e(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 We="an-network-input",Qe="".concat(We,"-cell"),Ke={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}},Je=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,k=e.onClose,P=e.onNetworkTypeChange,I=e.previous,Z=void 0===I?{}:I,S=Z.gateway,A=Z.minIp,M=Z.subnetMask,T=e.readonlyNetworkName,C=e.showCloseButton,U=e.showGateway,E=(0,a.useMemo)((function(){return"".concat(He.Z[b]," ").concat(y)}),[y,b]),N=(0,a.useMemo)((function(){return"".concat(Qe,"-").concat(v,"-gateway")}),[v]),R=(0,a.useMemo)((function(){return"".concat(Qe,"-").concat(v,"-ip")}),[v]),B=(0,a.useMemo)((function(){return"".concat(Qe,"-").concat(v,"-subnet-mask")}),[v]),D=(0,a.useMemo)((function(){return"".concat(We,"-").concat(v)}),[v]),L=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-gateway")}(v)}),[v]),q=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-min-ip")}(v)}),[v]),_=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-network-type")}(v)}),[v]),H=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-subnet-mask")}(v)}),[v]),V=(0,a.useMemo)((function(){return U?void 0:"none"}),[U]),$=(0,a.useMemo)((function(){return C&&(0,r.jsx)(Ve.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===k||void 0===k||(r=k).call.apply(r,[null,{networkId:v,networkType:b}].concat(ze(n)))},sx:{padding:".2em",position:"absolute",right:"-.6rem",top:"-.2rem"}})}),[C,v,b,k]),G=(0,a.useMemo)((function(){var e;return U&&L&&(e=(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"gateway","data-network-id":v},id:L,label:d,value:S}),inputTestBatch:(0,F._)("".concat(E," ").concat(d),(function(){c(L)}),{onFinishBatch:o(L)},(function(e){c(L,{children:e})})),onFirstRender:i(L),onUnmount:u(L),required:U})),e}),[U,L,v,d,S,E,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:T,onChange: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(ze(n)))},selectItems:g,selectProps:{renderValue:function(){return E}},value:b})}),$]}),(0,r.jsxs)(w.bc,{children:[(0,r.jsx)("input",{hidden:!0,id:D,readOnly:!0,"data-handler":"network","data-network-id":v,"data-network-number":y,"data-network-type":b}),(0,r.jsx)(s.Z,{layout:(n={},Ge(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,F._)("".concat(E," ").concat(p),(function(){c(q)}),{onFinishBatch:o(q)},(function(e){c(q,{children:e})})),onFirstRender:i(q),onUnmount:u(q),required:!0})}),Ge(n,B,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"subnetmask","data-network-id":v},id:H,label:h,value:M}),inputTestBatch:(0,F._)("".concat(E," ").concat(h),(function(){c(H)}),{onFinishBatch:o(H)},(function(e){c(H,{children:e})})),onFirstRender:i(H),onUnmount:u(H),required:!0})}),Ge(n,N,{children:G,display:V}),n),spacing:"1em"})]})]})},Xe=t(6607);function Ye(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 en(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function nn(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){en(e,n,t[n])}))}return e}function tn(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 Ye(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 Ye(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 rn="an-network-config-input",on="".concat(rn,"-cell"),an="".concat(rn,"-dns"),un="".concat(rn,"-mtu"),cn="".concat(rn,"-ntp"),ln=Object.entries(He.Z),sn=function(e){return"ifn"===e},dn=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 tn(n,2)[1].networkType===e&&(c+=1),t<u})),c}),[t]),b=(0,a.useMemo)((function(){return ln.map((function(e){var n=tn(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?sn(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,_e.Z)()}}),[y]),w=(0,a.useCallback)((function(e,n){return f((0,Xe.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=tn(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]=nn({},l,{networkNumber:s,networkType:d})):e[i]=l,e}),{});f(l)}),[t,v,f]),k=(0,a.useCallback)((function(e){var n=e.networkId,r=e.networkType,o=!1,i=0,a=t.reduce((function(e,t){var a=tn(t,2),u=a[0],c=a[1];u===n?o=!0:(c.networkType===r&&(i+=1),e[u]=o?nn({},c,{networkNumber:i}):c);return e}),{});f(a)}),[t,f]),P=(0,a.useMemo)((function(){var e={};return e=t.reduce((function(e,t){var o=tn(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(on,"-").concat(i),p=1===l,m=sn(d),h="mn"===d||!p;return e[f]={children:(0,r.jsx)(Je,{formUtils:n,networkId:i,networkNumber:l,networkType:d,networkTypeOptions:b,onClose:k,onNetworkTypeChange:O,previous:{gateway:u,minIp:c,subnetMask:s},readonlyNetworkName:!h,showCloseButton:h,showGateway:m}),md:3,sm:2},e}),e)}),[n,t,b,k,O]);return(0,r.jsx)(s.Z,{columns:{xs:1,sm:2,md:3},layout:nn({},P,{"an-network-config-cell-add-network":{children:(0,r.jsx)(Ve.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:an,label:"DNS",value:c}),inputTestBatch:(0,F.dg)("DNS",(function(){h(an)}),{onFinishBatch:p(an)},(function(e){h(an,{children:e})})),onFirstRender:m(an),required:!0})},"an-network-config-input-cell-ntp":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:cn,label:"NTP",value:d}),inputTestBatch:(0,F.dg)("NTP",(function(){h(cn)}),{onFinishBatch:p(cn)},(function(e){h(cn,{children:e})})),onFirstRender:m(cn)})},"an-network-config-input-cell-mtu":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:un,inputProps:{placeholder:"1500"},label:"MTU",value:l}),inputTestBatch:(0,F.qY)("MTU",(function(){h(un)}),{onFinishBatch:p(un)},(function(e){h(un,{children:e})})),onFirstRender:m(un),valueType:"number"})}}),spacing:"1em"})};function fn(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 pn={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"}},mn=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=fn(e.previous,["hostConfig","networkConfig"]),f=s.networks,p=void 0===f?pn: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)(qe,{formUtils:n,previous:d}),(0,r.jsx)(dn,{formUtils:n,networkListEntries:y,previous:s,setNetworkList:v}),(0,r.jsx)(Ce,{formUtils:n,knownFences:t,knownUpses:o,networkListEntries:y,previous:c})]})},hn=function(e){var n=e.formUtils,t=e.knownFences,o=e.knownUpses,i=e.previous;return(0,r.jsx)(mn,{formUtils:n,knownFences:t,knownUpses:o,previous:i})};function vn(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 yn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function bn(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){yn(e,n,t[n])}))}return e}function gn(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 vn(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 vn(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 jn="run-manifest-input",xn="".concat(jn,"-host"),wn="".concat(jn,"-an-description"),On="".concat(jn,"-an-password"),kn="".concat(jn,"-an-confirm-password"),Pn="Description",In="Password",Zn="Confirm password",Sn="--",An=(0,v.ZP)(Z.$_)({justifyContent:"end"}),Mn=function(e){return"".concat(xn,"-").concat(e)},Tn=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,k=h.networkConfig,P=void 0===k?{}:k,I=(0,a.useRef)({}),S=w.hosts,A=void 0===S?{}:S,M=P.dnsCsv,T=P.mtu,C=P.networks,U=void 0===C?{}:C,E=P.ntpCsv,N=void 0===E?Sn:E,R=(0,a.useMemo)((function(){return Object.entries(A)}),[A]),B=(0,a.useMemo)((function(){return Object.entries(c)}),[c]),D=(0,a.useMemo)((function(){return Object.entries(d)}),[d]),L=(0,a.useMemo)((function(){return Object.entries(p)}),[p]),q=(0,a.useMemo)((function(){return Object.entries(U)}),[U]),_=(0,a.useMemo)((function(){return D.map((function(e){var n=gn(e,2)[1];return{displayValue:n.hostName,value:n.hostUUID}}))}),[D]),H=(0,a.useMemo)((function(){return R.reduce((function(e,n){var a=gn(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=Mn(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,F.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]),V=H.headers,$=H.hosts,G=H.hostNames,z=(0,a.useMemo)((function(){return q.reduce((function(e,n){var t=gn(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=gn(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?Sn: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)(An,{children:a})}),e}),{gateway:{"run-manifest-gateway-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"Gateway"})}},hostNetworks:{}})}),[R,q]),W=z.gateway,Q=z.hostNetworks,K=(0,a.useMemo)((function(){return B.reduce((function(e,n){var t=gn(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=gn(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?Sn:l;e["".concat(a,"-").concat(o,"-port")]={children:(0,r.jsx)(Z.$_,{children:s})}})),e}),{})}),[R,B]),J=(0,a.useMemo)((function(){return L.reduce((function(e,n){var t=gn(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=gn(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,L]),X=(0,a.useMemo)((function(){var e=(0,F.Gn)(Zn,(function(){i(kn)}),{onFinishBatch:t(kn)},(function(e){i(kn,{children:e})})),n=o(kn);return e.tests.push({onFailure:function(){i(kn,{children:(0,r.jsx)(r.Fragment,{children:"Confirm password must match password."})})},test:function(e){var n,t=e.value;return(null===(n=I.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:wn,label:Pn}),inputTestBatch:(0,F.Gn)(Pn,(function(){i(wn)}),{onFinishBatch:t(wn)},(function(e){i(wn,{children:e})})),onFirstRender:o(wn),required:!0}),sm:2},"run-manifest-input-cell-an-password":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:On,label:In,type:b.Z.password}),inputTestBatch:(0,F.Gn)(In,(function(){i(On)}),{onFinishBatch:t(On)},(function(e){i(On,{children:e})})),onFirstRender:o(On),ref:I,required:!0})},"run-manifest-input-cell-an-confirm-password":{children:(0,r.jsx)(j.Z,bn({input:(0,r.jsx)(x.Z,{id:kn,label:Zn,type:b.Z.password}),required:!0},X))}},spacing:"1em"}),(0,r.jsx)(s.Z,{alignItems:"center",columns:{xs:R.length+1},layout:bn({},V,$,G,Q,K,J),columnSpacing:"1em",rowSpacing:"0.4em"}),(0,r.jsx)(s.Z,{columns:{xs:2},layout:bn({},W,{"run-manifest-dns-csv-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"DNS"})},"run-manifest-dns-csv-cell":{children:(0,r.jsx)(An,{children:M})},"run-manifest-ntp-csv-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"NTP"})},"run-manifest-ntp-csv-cell":{children:(0,r.jsx)(An,{children:N})},"run-manifest-mtu-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"MTU"})},"run-manifest-mtu-cell":{children:(0,r.jsx)(An,{children:T})}}),spacing:"0.4em"})]})};function Fn(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 Cn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Un(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){Cn(e,n,t[n])}))}return e}function En(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)||Rn(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 Nn(e){return function(e){if(Array.isArray(e))return Fn(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Rn(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 Rn(e,n){if(e){if("string"===typeof e)return Fn(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)?Fn(e,n):void 0}}var Bn=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=En(n,1),o=r[0].target,i=o.elements,a=i.namedItem(Ee),u=a.value,c=i.namedItem(Ne),l=c.value,s=i.namedItem(Re),d=s.value,f=i.namedItem(an),p=f.value,m=i.namedItem(un),h=m.value,v=i.namedItem(cn),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(we)).test(t)){var r,o=n,i=o.dataset.handler;null===(r=Pe[void 0===i?"":i])||void 0===r||r.call(null,e,o)}else if(RegExp("^".concat(We)).test(t)){var a,u=n,c=u.dataset.handler;null===(a=Ke[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})},Dn=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=En(t,1),i=o[0].target,a=i.elements,u=a.namedItem(wn),c=u.value,l=a.namedItem(On),s=l.value,d=Object.entries(e).reduce((function(e,n){var t=En(n,2),r=t[0],o=t[1],i=o.hostNumber,u=o.hostType,c=Mn(r),l=a.namedItem(c).value;return e[r]={hostNumber:i,hostType:u,hostUuid:l},e}),{});return{description:c,hosts:d,password:s}},Ln=function(){var e=(0,V.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=(0,a.useRef)({}),c=(0,a.useRef)({}),l=En((0,oe.Z)(),2),s=l[0],f=l[1],m=En((0,ae.Z)(void 0),2),h=m[0],v=m[1],y=(0,a.useState)(!1),b=y[0],j=y[1],x=En((0,ae.Z)(!0),2),O=x[0],k=x[1],P=En((0,ae.Z)(!0),2),I=P[0],S=P[1],A=En((0,ae.Z)(!0),2),M=A[0],T=A[1],F=En((0,ae.Z)(!1),2),C=F[0],U=F[1],E=En((0,ae.Z)(void 0),2),N=E[0],R=E[1],B=En((0,ae.Z)(void 0),2),D=B[0],L=B[1],q=(0,te.Z)("".concat(p.Z,"/manifest"),{refreshInterval:6e4}),_=q.data,$=q.isLoading,G=(0,ie.Z)([Ee,Ne,Re,an,un,cn],c),z=G.isFormInvalid,W=G.setMessage,Q=(0,ie.Z)([kn,wn,On],c),J=Q.isFormInvalid,Y=(0,re.Z)({list:_}),ue=Y.buildDeleteDialogProps,ce=Y.checks,le=Y.getCheck,se=Y.hasChecks,de=Y.setCheck,fe=(0,a.useMemo)((function(){return null!==N&&void 0!==N?N:{}}),[N]),pe=fe.hostConfig,me=(void 0===pe?{}:pe).hosts,he=void 0===me?{}:me,ve=fe.name,ye=fe.uuid,be=(0,a.useMemo)((function(){return null!==D&&void 0!==D?D:{}}),[D]),ge=be.domain,je=be.fences,xe=be.prefix,we=be.sequence,Oe=be.upses,ke=(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.request({data:n,method:r,url:i}).then((function(){W("api",{children:o,type:"info"})})).catch((function(e){var n=(0,d.Z)(e);n.children=t(n.children),W("api",n)})).finally((function(){U(!1)}))}),[U,W]),Pe=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(mn,{formUtils:G,knownFences:je,knownUpses:Oe,previous:{domain:ge,prefix:xe,sequence:we}}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Bn.apply(void 0,Nn(t));f({actionProceedText:"Add",content:(0,r.jsx)(r.Fragment,{}),onProceedAppend:function(){ke({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"}}),[G,je,Oe,ge,xe,we,f,ke]),Ie=(0,a.useMemo)((function(){return{actionProceedText:"Edit",content:(0,r.jsx)(hn,{formUtils:G,knownFences:je,knownUpses:Oe,previous:N}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Bn.apply(void 0,Nn(t));f({actionProceedText:"Edit",content:(0,r.jsx)(r.Fragment,{}),onProceedAppend:function(){ke({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(ve),url:"/manifest/".concat(ye)})},titleText:"Update install manifest ".concat(ve,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},loading:I,titleText:"Update install manifest ".concat(ve)}}),[G,je,Oe,N,I,ve,f,ke,ye]),Ze=(0,a.useMemo)((function(){return{actionProceedText:"Run",content:(0,r.jsx)(Tn,{formUtils:Q,knownFences:je,knownHosts:h,knownUpses:Oe,previous:N}),loading:I,onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Dn.apply(void 0,[he].concat(Nn(t)));f({actionProceedText:"Run",content:(0,r.jsx)(r.Fragment,{}),onProceedAppend:function(){ke({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(ve),url:"/command/run-manifest/".concat(ye)})},titleText:"Run install manifest ".concat(ve,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Run install manifest ".concat(ve)}}),[Q,je,h,Oe,N,I,ve,he,f,ke,ye]),Se=(0,a.useCallback)((function(e,n){S(!0),u.Z.get("manifest/".concat(e)).then((function(n){var t=n.data;t.uuid=e,R(t)})).catch((function(e){(0,d.Z)(e)})).finally((function(){S(!1),null===n||void 0===n||n.call(null)}))}),[S,R]),Ae=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:b,disableDelete:!se,edit:b,header:!0,listEmpty:"No manifest(s) registered.",listItems:_,onAdd:function(){var e;null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e;f(ue({onProceedAppend:function(){ke({body:{uuids:ce},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Delete manifest(s) failed. ",e]})},method:"delete",url:"/manifest"})},getConfirmDialogTitle:function(e){return"Delete ".concat(e," manifest(s)?")},renderEntry:function(e){var n=e.key;return(0,r.jsx)(Z.Ac,{children:null===_||void 0===_?void 0:_[n].manifestName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){j((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){de(e,t)},onItemClick:function(e){var n,t=e.manifestName,r=e.manifestUUID;R({name:t,uuid:r}),null===(n=o.current.setOpen)||void 0===n||n.call(null,!0),Se(r)},renderListItemCheckboxState:function(e){return le(e)},renderListItem:function(e,n){var t=n.manifestName;return(0,r.jsxs)(g.Z,{fullWidth:!0,row:!0,children:[(0,r.jsx)(Ve.Z,{disabled:b,mapPreset:"play",onClick:function(){var n;R({name:t,uuid:e}),null===(n=i.current.setOpen)||void 0===n||n.call(null,!0),Se(e)},variant:"normal"}),(0,r.jsx)(Z.Ac,{children:t})]})}})}),[ue,ce,le,Se,se,b,_,de,f,R,ke]),Me=(0,a.useMemo)((function(){return O||M||$?(0,r.jsx)(H.Z,{}):Ae}),[O,$,M,Ae]),Te=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:c})}),[]);return e&&(u.Z.get("/manifest/template").then((function(e){var n=e.data;L(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){T(!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(){k(!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"})}),Me]}),(0,r.jsx)(X.Z,Un({},Pe,{disableProceed:z,loadingAction:C,preActionArea:Te,ref:t,scrollContent:!0})),(0,r.jsx)(X.Z,Un({},Ie,{disableProceed:z,loadingAction:C,preActionArea:Te,ref:o,scrollContent:!0})),(0,r.jsx)(X.Z,Un({},Ze,{disableProceed:J,loadingAction:C,preActionArea:Te,ref:i,scrollContent:!0})),(0,r.jsx)(K.Z,Un({closeOnProceed:!0},s,{ref:n}))]})},qn=Ln,_n="common-ups-input-ip-address",Hn="common-ups-input-host-name",Vn="IP address",$n="Host name",Gn=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:Hn,label:$n,value:l}),inputTestBatch:(0,F.Gn)($n,(function(){i(Hn)}),{onFinishBatch:t(Hn)},(function(e){i(Hn,{children:e})})),onFirstRender:o(Hn),required:!0})},"common-ups-input-cell-ip-address":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:_n,label:Vn,value:c}),inputTestBatch:(0,F._)(Vn,(function(){i(_n)}),{onFinishBatch:t(_n)},(function(e){i(_n,{children:e})})),onFirstRender:o(_n),required:!0})}},spacing:"1em"})},zn=t(5741);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){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 Kn="add-ups-select-ups-type-id",Jn=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,V.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=Qn(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)(zn.Z,{href:l,onClick:function(e){e.stopPropagation()},sx:{display:"inline-flex",color:I.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:Kn,label:"UPS type",onChange:function(e){var n=e.target.value,t=String(n);l(Kn,!0),h(t)},required:!0,selectItems:v,selectProps:{onClearIndicatorClick:function(){l(Kn,!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)(H.Z,{}):(0,r.jsxs)(g.Z,{children:[y,m&&(0,r.jsx)(Gn,{formUtils:n,previous:i})]})}),[n,m,t,y,i]);return(0,a.useEffect)((function(){f&&c(Kn)({isValid:Boolean(m)})}),[c,m,f]),b},Xn="edit-ups-input-ups-uuid",Yn=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)(H.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Jn,{formUtils:n,previous:o,upsTemplate:i}),(0,r.jsx)("input",{hidden:!0,id:Xn,readOnly:!0,value:u})]})}),[n,t,o,i,u])};function et(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 nt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function tt(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){nt(e,n,t[n])}))}return e}function rt(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 et(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 et(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 ot=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=rt(t,1),a=i[0].target,u=a.elements,c=u.namedItem(Hn),l=c.value,s=u.namedItem(_n),d=s.value,f=u.namedItem(Kn),p="",m="",h="";f&&(p=(o=e[h=f.value]).agent,m=o.brand);var v=u.namedItem(Xn),y="";v&&(y=v.value);return{agent:p,brand:m,ipAddress:d,name:l,typeId:h,uuid:y}},it=function(e){var n=e.brand,t=e.ipAddress,o=e.name,i=e.uuid,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)(ee.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))}})},at=function(){var e=(0,V.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=rt((0,oe.Z)(),2),c=i[0],l=i[1],s=rt((0,oe.Z)(),2),f=s[0],m=s[1],h=(0,a.useState)(!1),v=h[0],y=h[1],b=rt((0,ae.Z)(!0),2),j=b[0],x=b[1],O=rt((0,ae.Z)(void 0),2),k=O[0],P=O[1],I=(0,te.Z)("".concat(p.Z,"/ups"),{refreshInterval:6e4}),S=I.data,A=I.isLoading,M=(0,ie.Z)([_n,Hn,Kn],o),T=M.isFormInvalid,F=M.isFormSubmitting,C=M.submitForm,U=(0,re.Z)({list:S}),E=U.buildDeleteDialogProps,N=U.checks,R=U.getCheck,B=U.hasChecks,D=U.setCheck,L=(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!==k&&void 0!==k?k:{}).find((function(e){var n=rt(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)(Yn,{formUtils:M,previous:{upsIPAddress:a,upsName:u,upsTypeId:s},upsTemplate:k,upsUUID:c}),onSubmitAppend:function(e){var t;if(k){var o=ot(k,e),i=o.name;l({actionProceedText:"Update",content:it(o),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update UPS. ",e]})},method:"put",successMsg:"Successfully updated UPS ".concat(u),url:"/ups/".concat(c)})},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})]})}}),[M,l,C,k]),q=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(Jn,{formUtils:M,upsTemplate:k}),onSubmitAppend:function(e){var t;if(k){var o=ot(k,e),i=o.brand,a=o.name;l({actionProceedText:"Add",content:it(o),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add UPS. ",e]})},method:"post",successMsg:"Successfully added UPS ".concat(a),url:"/ups"})},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"}}),[M,l,C,k]),_=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:v,disableDelete:!B,edit:v,header:!0,listEmpty:"No Ups(es) registered.",listItems:S,onAdd:function(){var e;m(q),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e;l(E({getConfirmDialogTitle:function(e){return"Delete ".concat(e," UPSes?")},onProceedAppend:function(){C({body:{uuids:N},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to delete UPS(es). ",e]})},method:"delete",url:"/ups"})},renderEntry:function(e){var n=e.key;return(0,r.jsx)(Z.Ac,{children:null===S||void 0===S?void 0:S[n].upsName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){y((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){D(e,t)},onItemClick:function(e){var n;m(L(e)),null===(n=t.current.setOpen)||void 0===n||n.call(null,!0)},renderListItemCheckboxState:function(e){return R(e)},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,'"']})]})}})}),[q,E,L,N,R,B,v,D,l,m,C,S]),$=(0,a.useMemo)((function(){return j||A?(0,r.jsx)(H.Z,{}):_}),[j,A,_]),G=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:o})}),[]);return e&&u.Z.get("/ups/template").then((function(e){var n=e.data;P(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"})}),$]}),(0,r.jsx)(X.Z,tt({},f,{disableProceed:T,loadingAction:F,preActionArea:G,ref:t})),(0,r.jsx)(K.Z,tt({closeOnProceed:!0},c,{ref:n}))]})},ut=t(5697),ct=t(2186),lt=t(4799),st=t(4825),dt=t(4629),ft=t(575),pt=t(4568),mt=t(3640),ht=t(476),vt=t(8061);function yt(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 bt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function gt(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){bt(e,n,t[n])}))}return e}function jt(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 xt(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 yt(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 yt(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 wt=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=jt(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=xt(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)(k.Z,gt({control:(0,r.jsx)(ft.Z,gt({},p,{sx:gt(bt({},"&.".concat(pt.Z.root),{color:I.s7}),d)})),value:c,label:l},t),"".concat(i,"-").concat(o))}))}),[t,i,l,d,p]);return(0,r.jsxs)(mt.Z,gt({},n,{children:[(0,r.jsx)(ht.Z,gt({},o,{children:m})),(0,r.jsx)(vt.Z,gt({onChange:c,row:!0},f,{children:h}))]}))},Ot=t(3144);function kt(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 Pt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function It(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 kt(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 kt(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 Zt="Alteeve enterprise key",St="Host name",At="RedHat password",Mt="RedHat user",Tt="enterpriseKey",Ft="hostName",Ct="redhatPassword",Ut="redhatUser",Et={xs:1,sm:2},Nt=function(){var e=(0,Ot.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)(),p=f[0],h=f[1],v=(0,a.useState)(),y=v[0],O=v[1],k=It((0,ae.Z)(void 0,e),2),P=k[0],S=k[1],A=It((0,ae.Z)("",e),2),M=A[0],T=A[1],C=(0,a.useState)(""),U=C[0],E=C[1],N=(0,a.useState)(!0),R=N[0],B=N[1],D=(0,a.useState)(!1),L=D[0],q=D[1],_=(0,a.useState)(!0),V=_[0],$=_[1],G=(0,a.useState)(!0),z=G[0],W=G[1],Q=(0,a.useState)(!1),J=Q[0],X=Q[1],Y=(0,a.useState)(!0),ee=Y[0],te=Y[1],re=(0,a.useState)(!1),oe=re[0],ie=re[1],ue=(0,a.useState)(!1),ce=ue[0],le=ue[1],se=(0,a.useState)(!1),de=se[0],fe=se[1],pe=(0,a.useState)(!1),me=pe[0],he=pe[1],ve=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,Ft,e)}),[]),ye=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,Tt,e)}),[]),be=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,Ct,e)}),[]),ge=(0,a.useCallback)((function(e){var n;null===(n=l.current.setMessage)||void 0===n||n.call(null,Ut,e)}),[]),je=(0,a.useCallback)((function(e){var n;return null===(n=l.current.setMessage)||void 0===n?void 0:n.call(null,"submitPrepareHost",e)}),[]),xe=(0,a.useMemo)((function(){var e;return Pt(e={},Tt,(0,F.$e)(Zt,(function(){ye()}),void 0,(function(e){ye({children:e,type:"warning"})}))),Pt(e,Ft,(0,F.Ye)(St,(function(){ve()}),void 0,(function(e){ve({children:e,type:"warning"})}))),Pt(e,Ct,(0,F.Gn)(At,(function(){be()}),void 0,(function(e){be({children:e,type:"warning"})}))),Pt(e,Ut,(0,F.Gn)(Mt,(function(){ge()}),void 0,(function(e){ge({children:e,type:"warning"})}))),e}),[ye,ve,be,ge]),we=(0,a.useMemo)((function(){return(0,F.LT)(xe)}),[xe]),Oe=(0,a.useMemo)((function(){return de?void 0:"none"}),[de]),ke=(0,a.useMemo)((function(){return(0,r.jsx)(dt.ZP,{allowSubmit:ee,gridProps:{wrapperBoxProps:{sx:{display:J?"flex":"none"}}},identifierInputTestBatchBuilder:F._,identifierLabel:"Host IP address",onIdentifierBlurAppend:function(e){var n=e.target.value;if(y){var t=n!==y;te(t),ie(!t),fe(!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=we({inputs:Pt({},Ft,{value:a})});q(p),s&&/rhel/i.test(u)&&!d&&fe(!0),O(e),S(n),T(c),te(!1),ie(!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"})}),[J,ee,y,S,T,we]),Pe=(0,a.useMemo)((function(){return(0,r.jsx)(s.Z,{columns:Et,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=we({inputs:Pt({},Ft,{value:n})});q(t)},onFocus:function(){ve()}},label:St}),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=we({inputs:Pt({},Tt,{value:n})});B(t)}},onFocus:function(){ye()}},label:Zt}),ref:t})}},spacing:"1em",wrapperBoxProps:{sx:{display:oe?void 0:"none"}}})}),[oe,ye,ve,we]),Ie=(0,a.useMemo)((function(){return(0,r.jsx)(s.Z,{columns:Et,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=we({inputs:Pt({},Ut,{value:n})});W(t)}},onFocus:function(){ge()}},label:Mt}),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=we({inputs:Pt({},Ct,{value:n})});$(t)}},onFocus:function(){be()},onPasswordVisibilityAppend:function(e){le(e!==b.Z.password)},type:b.Z.password},label:At}),ref:i})}},spacing:"1em",wrapperBoxProps:{sx:{display:Oe}}})}),[Oe,be,ge,we]),Ze=(0,a.useMemo)((function(){return(0,r.jsx)(m.Z,{sx:{display:oe?void 0:"none"},children:(0,r.jsx)(ne.Z,{count:1,ref:l})})}),[oe]),Se=(0,a.useMemo)((function(){return me?(0,r.jsx)(H.Z,{mt:0}):(0,r.jsx)(g.Z,{row:!0,sx:{display:oe?"flex":"none",justifyContent:"flex-end"},children:(0,r.jsx)(st.Z,{disabled:!L||!R||!z||!V,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"}),je(),null===(l=n.current.setOpen)||void 0===l||l.call(null,!0)},children:"Prepare host"})})}),[R,L,V,z,oe,me,je]);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)(wt,{id:"preparehost-host-type",label:"Host type",onChange:function(e,n){E(n),X(!0)},radioItems:{node:{label:"Subnode",value:"node"},dr:{label:"Disaster Recovery (DR) host",value:"dr"}}}),ke,Pe,Ie,Ze,Se]})]}),(0,r.jsx)(K.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"===U?"Disaster Recovery (DR)":"Subnode"})},"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===p||void 0===p?void 0:p.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===p||void 0===p?void 0:p.enterpriseKey})},"preparehost-confirm-redhat-user-label":{children:(0,r.jsx)(Z.Ac,{children:"RedHat user"}),sx:{display:Oe}},"preparehost-confirm-redhat-user-value":{children:(0,r.jsx)(Z.$_,{children:null===p||void 0===p?void 0:p.redhatUser}),sx:{display:Oe}},"preparehost-confirm-redhat-password-label":{children:(0,r.jsx)(Z.Ac,{children:"RedHat password"}),sx:{display:Oe}},"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:ce?null===p||void 0===p?void 0:p.redhatPassword:null===p||void 0===p?void 0:p.redhatPasswordHidden}),(0,r.jsx)(lt.Z,{onClick:function(){le((function(e){return!e}))},sx:{color:I.s7,padding:0},children:ce?(0,r.jsx)(ut.Z,{}):(0,r.jsx)(ct.Z,{})})]}),sx:{display:Oe}}},spacing:".6em"}),onCancelAppend:function(){le(!1)},onProceedAppend:function(){var e,n,r,a;he(!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:P,hostType:U,hostUUID:M,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(){je({children:"Successfully initiated prepare host."}),setTimeout((function(){je()}),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}});je(n)})).finally((function(){he(!1)}))},ref:n,titleText:"Confirm host preparation"})]})},Rt=t(8187),Bt=t(8461);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 Lt(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){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){Lt(e,n,t[n])}))}return e}function _t(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)||$t(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 Vt(e){return function(e){if(Array.isArray(e))return Dt(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||$t(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 $t(e,n){if(e){if("string"===typeof e)return Dt(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)?Dt(e,n):void 0}}var Gt="prepare-network-host-name-input",zt="prepare-network-netconf-input-group",Wt="Host name",Qt=function(e){for(var n=e.netconf,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];var i,a=Ht(r,1),u=a[0].target,c=u.elements,l=c.namedItem(Gt),s=l.value,d=qt({hostName:s},null===(i=n.get)||void 0===i?void 0:i.call(null));return d},Kt=function(e){var n=e.networks,t=void 0===n?[]:n,r=_t(e,["networks"]),o=t.reduce((function(e,n){var t=n.interfaces,r=n.ipAddress,o=n.name,i=void 0===o?"":o,a=n.type,u=n.typeCount,c=n.subnetMask,l="".concat(a).concat(u),s=t.reduce((function(e,n,t){if(n){var r=n.networkInterfaceName;e["link".concat(t+1)]=r}return e}),{});return e[l]=qt({name:i,network:"".concat(r,"/").concat(c)},s),e}),{});return qt({},r,{networks:o})},Jt=function(e){var n=e.expectUUID,t=void 0!==n&&n,o=e.hostUUID,c=(0,i.useRouter)(),s=c.isReady,f=c.query.host_uuid,p=(0,a.useRef)({}),m=(0,a.useRef)({}),h=(0,a.useRef)({}),v=Ht((0,oe.Z)(),2),y=v[0],b=v[1],O=Ht((0,ae.Z)(void 0),2),k=O[0],P=O[1],I=Ht((0,ae.Z)(void 0),2),S=I[0],A=I[1],M=Ht((0,ae.Z)(!0),2),T=M[0],C=M[1],U=Ht((0,ae.Z)(void 0),2),E=U[0],N=U[1],R=(0,ie.Z)([Gt,zt],h),B=R.buildFinishInputTestBatchFunction,D=R.buildInputFirstRenderFunction,L=R.isFormInvalid,q=R.setMessage,_=R.setValidity,V=R.submitForm,$=(0,a.useMemo)((function(){return o!==E}),[o,E]),G=(0,a.useMemo)((function(){return Boolean(o)&&$}),[o,$]),z=(0,a.useMemo)((function(){return(0,r.jsx)(w.V9,{children:(0,r.jsxs)(Z.z,{children:["Prepare network on ",null===k||void 0===k?void 0:k.shortHostName]})})}),[k]),W=(0,a.useMemo)((function(){return(0,r.jsx)(Bt.Z,{expectHostDetail:!0,hostDetail:k,ref:m,toggleSubmitDisabled:function(e){_(zt,e)}})}),[k,_]),Q=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:h})}),[]),J=(0,a.useMemo)((function(){var e;return e=T?(0,r.jsx)(H.Z,{mt:0}):S?(0,r.jsx)(Rt.Z,qt({},S)):(0,r.jsxs)(r.Fragment,{children:[z,(0,r.jsxs)(g.Z,{component:"form",onSubmit:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var i,a=Ht(n,1),u=a[0];u.preventDefault();var c=Qt.apply(void 0,[{netconf:m.current}].concat(Vt(n)));b({actionProceedText:"Prepare",content:(0,r.jsx)(Y.Z,{entries:Kt(c),getEntryLabel:function(e){var n=e.cap,t=e.key;return/^(dns|[a-z]+n\d+)/.test(t)?t.toUpperCase():n(t)}}),onProceedAppend:function(){var e;V({body:c,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to prepare network. ",e]})},method:"put",setMsg:null===m||void 0===m||null===(e=m.current)||void 0===e?void 0:e.setMessage,successMsg:"Initiated prepare network on ".concat(null===k||void 0===k?void 0:k.shortHostName),url:"/host/".concat(o,"?handler=subnode-network")})},titleText:"Prepare ".concat(null===k||void 0===k?void 0:k.shortHostName," network?")}),null===(i=p.current.setOpen)||void 0===i||i.call(null,!0)},children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{maxWidth:"20em"}},id:Gt,label:Wt,value:null===k||void 0===k?void 0:k.hostName}),inputTestBatch:(0,F.Gn)(Wt,(function(){q(Gt)}),{onFinishBatch:B(Gt)},(function(e){q(Gt,{children:e})})),onFirstRender:D(Gt),required:!0}),Q,W,(0,r.jsx)(g.Z,{row:!0,justifyContent:"flex-end",children:(0,r.jsx)(st.Z,{disabled:L,type:"submit",children:"Prepare network"})})]})]}),e}),[T,S,z,null===k||void 0===k?void 0:k.hostName,null===k||void 0===k?void 0:k.shortHostName,B,D,Q,W,L,b,V,o,q]),X=(0,a.useCallback)((function(e){C(!0),T&&u.Z.get("/host/".concat(e)).then((function(e){var n=e.data;N(n.hostUUID),P(n)})).catch((function(e){var n=(0,d.Z)(e).children;A({children:"Failed to get target host information; cannot continue. ".concat(n),type:"error"})})).finally((function(){C(!1)}))}),[C,T,N,P,A]);return(0,a.useEffect)((function(){t?G&&X(o):s&&!S&&(f?X(l(f)):(A({children:"No host UUID provided; cannot continue.",type:"error"}),C(!1)))}),[S,X,o,t,s,f,A,P,C,G]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.s_,{children:J}),(0,r.jsx)(K.Z,qt({closeOnProceed:!0,scrollContent:!0},y,{ref:p}))]})},Xt=t(5316),Yt=t(1073);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,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 tr=function(e){var n=e.label,t=nr(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)(Xt.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){er(e,n,t[n])}))}return e}({},t,{label:o,sx:er({borderRadius:I.n_,color:I.s7,padding:".4em .8em",textTransform:"none"},"&.".concat(Yt.Z.selected),{color:I.Ej})}))},rr=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)(m.Z,{sx:{display:c?"initial":"none"},children:t}):c&&t}),[t,c,i]);return(0,r.jsx)(r.Fragment,{children:l})},or=t(2734),ir=t(8396),ar=t(7023),ur=t(852);function cr(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 lr(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function sr(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 dr(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 cr(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 cr(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 fr="1.8em",pr=function(e){var n,t,o=e.orientation,i=e.variant,u=void 0===i?"fullWidth":i,c=sr(e,["orientation","variant"]),l=(0,or.Z)(),s=(0,a.useCallback)((function(e){return l.breakpoints.up(e)}),[l]),d=(0,ir.Z)(s("xs")),f=(0,ir.Z)(s("sm")),p=(0,ir.Z)(s("md")),m=(0,ir.Z)(s("lg")),h=(0,ir.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=dr(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)(ar.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){lr(e,n,t[n])}))}return e}({},c,{orientation:y,variant:u,sx:(t={minHeight:"1em"},lr(t,"&.".concat(ur.Z.vertical),(n={minHeight:fr},lr(n,"& .".concat(Yt.Z.root),{alignItems:"flex-start",minHeight:fr,paddingLeft:"2em"}),lr(n,"& .".concat(ur.Z.indicator),{right:"initial"}),n)),lr(t,"& .".concat(Yt.Z.root),{minHeight:"1em"}),lr(t,"& .".concat(ur.Z.indicator),{backgroundColor:I.Ej,borderRadius:I.n_}),t)}))};function mr(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 hr(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function vr(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){hr(e,n,t[n])}))}return e}function yr(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 mr(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 mr(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 br,gr="prepare-host",jr="prepare-network",xr="manage-fence",wr="manage-ups",Or="manage-manifest",kr=(hr(br={},gr,"Prepare Host"),hr(br,jr,"Prepare Network"),hr(br,xr,"Manage Fence Devices"),hr(br,wr,"Manage UPSes"),hr(br,Or,"Manage Manifests"),br),Pr="Loading",Ir={md:8,sm:6,xs:1},Zr={md:6,sm:4,xs:1},Sr=function(){return(0,r.jsx)(s.Z,{columns:Ir,layout:{"preparehost-left-column":{},"preparehost-center-column":vr({children:(0,r.jsx)(Nt,{})},Zr)}})},Ar=function(){var e=(0,V.Z)(),n=(0,Ot.Z)().protect,t=yr((0,ae.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)(pr,{onChange:function(e,n){f(n)},orientation:"vertical",value:l,children:n.map((function(e){var n=yr(e,2),t=n[0],o=n[1].shortHostName;return(0,r.jsx)(tr,{label:o,value:t},"".concat(jr,"-").concat(t))}))})}else e=(0,r.jsx)(H.Z,{mt:0});return e}),[o,l]);return e&&u.Z.get("/host",{params:{types:["dr","node"]}}).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:Ir,layout:{"preparenetwork-left-column":{children:(0,r.jsx)(w.s_,{children:p}),sm:2},"preparenetwork-center-column":vr({children:(0,r.jsx)(Jt,{expectUUID:!0,hostUUID:l||void 0})},Zr)}})},Mr=function(){return(0,r.jsx)(s.Z,{columns:Ir,layout:{"managefence-left-column":{},"managefence-center-column":vr({children:(0,r.jsx)(ve,{})},Zr)}})},Tr=function(){return(0,r.jsx)(s.Z,{columns:Ir,layout:{"manageups-left-column":{},"manageups-center-column":vr({children:(0,r.jsx)(at,{})},Zr)}})},Fr=function(){return(0,r.jsx)(s.Z,{columns:Ir,layout:{"managemanifest-left-column":{},"managemanifest-center-column":vr({children:(0,r.jsx)(qn,{})},Zr)}})},Cr=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)(Pr),p=d[0],m=d[1];return(0,a.useEffect)((function(){if(n){var e=l(t,{fallbackValue:gr});kr[e]||(e=gr),p===Pr&&m(kr[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)(pr,{onChange:function(e,n){s(n),m(kr[n])},orientation:{xs:"vertical",sm:"horizontal"},value:c,children:[(0,r.jsx)(tr,{label:"Prepare host",value:gr}),(0,r.jsx)(tr,{label:"Prepare network",value:jr}),(0,r.jsx)(tr,{label:"Manage fence devices",value:xr}),(0,r.jsx)(tr,{label:"Manage UPSes",value:wr}),(0,r.jsx)(tr,{label:"Manage manifests",value:Or})]})}),(0,r.jsx)(rr,{changingTabId:c,tabId:gr,children:(0,r.jsx)(Sr,{})}),(0,r.jsx)(rr,{changingTabId:c,tabId:jr,children:(0,r.jsx)(Ar,{})}),(0,r.jsx)(rr,{changingTabId:c,tabId:xr,children:(0,r.jsx)(Mr,{})}),(0,r.jsx)(rr,{changingTabId:c,tabId:wr,children:(0,r.jsx)(Tr,{})}),(0,r.jsx)(rr,{changingTabId:c,tabId:Or,children:(0,r.jsx)(Fr,{})})]})}}},function(e){e.O(0,[382,483,894,182,614,644,676,195,62,780,899,140,903,692,774,888,179],(function(){return n=4173,e(e.s=n);var n}));var n=e.O();_N_E=n}]); |