@ansible/ansible-ui-framework 2.4.2656 → 2.4.2657

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -43068,7 +43068,7 @@ function Bde(e) {
43068
43068
  zl,
43069
43069
  {
43070
43070
  "data-cy": `${g}-form-group`,
43071
- id: `${g}-form-group`,
43071
+ id: `${g}-form-group-toggle`,
43072
43072
  isDisabled: i || a || _,
43073
43073
  ref: j,
43074
43074
  onClick: E,
package/index.umd.cjs CHANGED
@@ -513,7 +513,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
513
513
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IP(e,t){if(e){if(typeof e=="string")return Rx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rx(e,t)}}function Rx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Joe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(l){a=!0,s=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function Qoe(e){if(Array.isArray(e))return e}var ese=typeof qx=="function"?qx:qx.default,tse="file-invalid-type",nse="file-too-large",rse="file-too-small",ise="too-many-files",ase=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:tse,message:"File type must be ".concat(r)}},FP=function(t){return{code:nse,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},NP=function(t){return{code:rse,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},ose={code:ise,message:"Too many files"};function $P(e,t){var n=e.type==="application/x-moz-file"||ese(e,t);return[n,n?null:ase(t)]}function qP(e,t,n){if(Ba(e.size))if(Ba(t)&&Ba(n)){if(e.size>n)return[!1,FP(n)];if(e.size<t)return[!1,NP(t)]}else{if(Ba(t)&&e.size<t)return[!1,NP(t)];if(Ba(n)&&e.size>n)return[!1,FP(n)]}return[!0,null]}function Ba(e){return e!=null}function sse(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,a=e.multiple,o=e.maxFiles,s=e.validator;return!a&&t.length>1||a&&o>=1&&t.length>o?!1:t.every(function(l){var c=$P(l,n),u=Rl(c,1),d=u[0],f=qP(l,r,i),h=Rl(f,1),g=h[0],p=s?s(l):null;return d&&g&&!p})}function of(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function sf(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function RP(e){e.preventDefault()}function lse(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function cse(e){return e.indexOf("Edge/")!==-1}function use(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return lse(e)||cse(e)}function Nr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];return t.some(function(s){return!of(r)&&s&&s.apply(void 0,[r].concat(a)),of(r)})}}function dse(){return"showOpenFilePicker"in window}function fse(e){if(Ba(e)){var t=Object.entries(e).filter(function(n){var r=Rl(n,2),i=r[0],a=r[1],o=!0;return zP(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),o=!1),(!Array.isArray(a)||!a.every(BP))&&(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(n,r){var i=Rl(r,2),a=i[0],o=i[1];return MP(MP({},n),{},LP({},a,o))},{});return[{description:"Files",accept:t}]}return e}function hse(e){if(Ba(e))return Object.entries(e).reduce(function(t,n){var r=Rl(n,2),i=r[0],a=r[1];return[].concat(DP(t),[i],DP(a))},[]).filter(function(t){return zP(t)||BP(t)}).join(",")}function gse(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function mse(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function zP(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function BP(e){return/^.*\.[\w]+$/.test(e)}var pse=["children"],yse=["open"],vse=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],bse=["refKey","onChange","onClick"];function xse(e){return wse(e)||Sse(e)||WP(e)||_se()}function _se(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
514
514
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sse(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wse(e){if(Array.isArray(e))return Bx(e)}function zx(e,t){return kse(e)||Ese(e,t)||WP(e,t)||Cse()}function Cse(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
515
515
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WP(e,t){if(e){if(typeof e=="string")return Bx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bx(e,t)}}function Bx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ese(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(l){a=!0,s=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function kse(e){if(Array.isArray(e))return e}function VP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VP(Object(n),!0).forEach(function(r){Wx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wx(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lf(e,t){if(e==null)return{};var n=Tse(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Tse(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Vx=v.forwardRef(function(e,t){var n=e.children,r=lf(e,pse),i=HP(r),a=i.open,o=lf(i,yse);return v.useImperativeHandle(t,function(){return{open:a}},[a]),v.createElement(v.Fragment,null,n(pt(pt({},o),{},{open:a})))});Vx.displayName="Dropzone";var UP={disabled:!1,getFilesFromEvent:Noe,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Vx.defaultProps=UP,Vx.propTypes={children:nt.func,accept:nt.objectOf(nt.arrayOf(nt.string)),multiple:nt.bool,preventDropOnDocument:nt.bool,noClick:nt.bool,noKeyboard:nt.bool,noDrag:nt.bool,noDragEventsBubbling:nt.bool,minSize:nt.number,maxSize:nt.number,maxFiles:nt.number,disabled:nt.bool,getFilesFromEvent:nt.func,onFileDialogCancel:nt.func,onFileDialogOpen:nt.func,useFsAccessApi:nt.bool,autoFocus:nt.bool,onDragEnter:nt.func,onDragLeave:nt.func,onDragOver:nt.func,onDrop:nt.func,onDropAccepted:nt.func,onDropRejected:nt.func,onError:nt.func,validator:nt.func};var Ux={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function HP(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=pt(pt({},UP),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,l=t.maxFiles,c=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,h=t.onDropAccepted,g=t.onDropRejected,p=t.onFileDialogCancel,y=t.onFileDialogOpen,x=t.useFsAccessApi,b=t.autoFocus,S=t.preventDropOnDocument,w=t.noClick,_=t.noKeyboard,E=t.noDrag,k=t.noDragEventsBubbling,T=t.onError,j=t.validator,A=v.useMemo(function(){return hse(n)},[n]),O=v.useMemo(function(){return fse(n)},[n]),P=v.useMemo(function(){return typeof y=="function"?y:GP},[y]),D=v.useMemo(function(){return typeof p=="function"?p:GP},[p]),M=v.useRef(null),I=v.useRef(null),V=v.useReducer(Ose,Ux),K=zx(V,2),H=K[0],z=K[1],$=H.isFocused,U=H.isFileDialogActive,Q=v.useRef(typeof window<"u"&&window.isSecureContext&&x&&dse()),re=function(){!Q.current&&U&&setTimeout(function(){if(I.current){var ie=I.current.files;ie.length||(z({type:"closeDialog"}),D())}},300)};v.useEffect(function(){return window.addEventListener("focus",re,!1),function(){window.removeEventListener("focus",re,!1)}},[I,U,D,Q]);var te=v.useRef([]),ne=function(ie){M.current&&M.current.contains(ie.target)||(ie.preventDefault(),te.current=[])};v.useEffect(function(){return S&&(document.addEventListener("dragover",RP,!1),document.addEventListener("drop",ne,!1)),function(){S&&(document.removeEventListener("dragover",RP),document.removeEventListener("drop",ne))}},[M,S]),v.useEffect(function(){return!r&&b&&M.current&&M.current.focus(),function(){}},[M,b,r]);var ce=v.useCallback(function(G){T?T(G):console.error(G)},[T]),de=v.useCallback(function(G){G.preventDefault(),G.persist(),Y(G),te.current=[].concat(xse(te.current),[G.target]),sf(G)&&Promise.resolve(i(G)).then(function(ie){if(!(of(G)&&!k)){var Se=ie.length,ke=Se>0&&sse({files:ie,accept:A,minSize:o,maxSize:a,multiple:s,maxFiles:l,validator:j}),Re=Se>0&&!ke;z({isDragAccept:ke,isDragReject:Re,isDragActive:!0,type:"setDraggedFiles"}),c&&c(G)}}).catch(function(ie){return ce(ie)})},[i,c,ce,k,A,o,a,s,l,j]),ue=v.useCallback(function(G){G.preventDefault(),G.persist(),Y(G);var ie=sf(G);if(ie&&G.dataTransfer)try{G.dataTransfer.dropEffect="copy"}catch{}return ie&&d&&d(G),!1},[d,k]),W=v.useCallback(function(G){G.preventDefault(),G.persist(),Y(G);var ie=te.current.filter(function(ke){return M.current&&M.current.contains(ke)}),Se=ie.indexOf(G.target);Se!==-1&&ie.splice(Se,1),te.current=ie,!(ie.length>0)&&(z({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),sf(G)&&u&&u(G))},[M,u,k]),J=v.useCallback(function(G,ie){var Se=[],ke=[];G.forEach(function(Re){var Qe=$P(Re,A),ft=zx(Qe,2),zt=ft[0],jt=ft[1],Ct=qP(Re,o,a),Ht=zx(Ct,2),Ne=Ht[0],_t=Ht[1],$n=j?j(Re):null;if(zt&&Ne&&!$n)Se.push(Re);else{var Gt=[jt,_t];$n&&(Gt=Gt.concat($n)),ke.push({file:Re,errors:Gt.filter(function(Yi){return Yi})})}}),(!s&&Se.length>1||s&&l>=1&&Se.length>l)&&(Se.forEach(function(Re){ke.push({file:Re,errors:[ose]})}),Se.splice(0)),z({acceptedFiles:Se,fileRejections:ke,isDragReject:ke.length>0,type:"setFiles"}),f&&f(Se,ke,ie),ke.length>0&&g&&g(ke,ie),Se.length>0&&h&&h(Se,ie)},[z,s,A,o,a,l,f,h,g,j]),fe=v.useCallback(function(G){G.preventDefault(),G.persist(),Y(G),te.current=[],sf(G)&&Promise.resolve(i(G)).then(function(ie){of(G)&&!k||J(ie,G)}).catch(function(ie){return ce(ie)}),z({type:"reset"})},[i,J,ce,k]),N=v.useCallback(function(){if(Q.current){z({type:"openDialog"}),P();var G={multiple:s,types:O};window.showOpenFilePicker(G).then(function(ie){return i(ie)}).then(function(ie){J(ie,null),z({type:"closeDialog"})}).catch(function(ie){gse(ie)?(D(ie),z({type:"closeDialog"})):mse(ie)?(Q.current=!1,I.current?(I.current.value=null,I.current.click()):ce(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ce(ie)});return}I.current&&(z({type:"openDialog"}),P(),I.current.value=null,I.current.click())},[z,P,D,x,J,ce,O,s]),Ce=v.useCallback(function(G){!M.current||!M.current.isEqualNode(G.target)||(G.key===" "||G.key==="Enter"||G.keyCode===32||G.keyCode===13)&&(G.preventDefault(),N())},[M,N]),oe=v.useCallback(function(){z({type:"focus"})},[]),ve=v.useCallback(function(){z({type:"blur"})},[]),Me=v.useCallback(function(){w||(use()?setTimeout(N,0):N())},[w,N]),be=function(ie){return r?null:ie},L=function(ie){return _?null:be(ie)},R=function(ie){return E?null:be(ie)},Y=function(ie){k&&ie.stopPropagation()},he=v.useMemo(function(){return function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ie=G.refKey,Se=ie===void 0?"ref":ie,ke=G.role,Re=G.onKeyDown,Qe=G.onFocus,ft=G.onBlur,zt=G.onClick,jt=G.onDragEnter,Ct=G.onDragOver,Ht=G.onDragLeave,Ne=G.onDrop,_t=lf(G,vse);return pt(pt(Wx({onKeyDown:L(Nr(Re,Ce)),onFocus:L(Nr(Qe,oe)),onBlur:L(Nr(ft,ve)),onClick:be(Nr(zt,Me)),onDragEnter:R(Nr(jt,de)),onDragOver:R(Nr(Ct,ue)),onDragLeave:R(Nr(Ht,W)),onDrop:R(Nr(Ne,fe)),role:typeof ke=="string"&&ke!==""?ke:"presentation"},Se,M),!r&&!_?{tabIndex:0}:{}),_t)}},[M,Ce,oe,ve,Me,de,ue,W,fe,_,E,r]),se=v.useCallback(function(G){G.stopPropagation()},[]),ee=v.useMemo(function(){return function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ie=G.refKey,Se=ie===void 0?"ref":ie,ke=G.onChange,Re=G.onClick,Qe=lf(G,bse),ft=Wx({accept:A,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:be(Nr(ke,fe)),onClick:be(Nr(Re,se)),tabIndex:-1},Se,I);return pt(pt({},ft),Qe)}},[I,n,s,fe,r]);return pt(pt({},H),{},{isFocused:$&&!r,getRootProps:he,getInputProps:ee,rootRef:M,inputRef:I,open:be(N)})}function Ose(e,t){switch(t.type){case"focus":return pt(pt({},e),{},{isFocused:!0});case"blur":return pt(pt({},e),{},{isFocused:!1});case"openDialog":return pt(pt({},Ux),{},{isFileDialogActive:!0});case"closeDialog":return pt(pt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return pt(pt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return pt(pt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"reset":return pt({},Ux);default:return e}}function GP(){}function Ase(e){const{t}=De(),n=fc(),{onDrop:r}=e,i=v.useCallback(s=>{if(!s||s.length===0)return;const l=s[0],c=new FileReader;c.onload=()=>{const u=c.result;if(typeof u=="string"){const d={variant:"success",title:t("File uploaded"),timeout:!0};n.addAlert(d),r(u)}},c.onerror=()=>{const u={variant:"danger",title:t("Failed to upload file"),children:t("Unable to upload")};n.addAlert(u)},c.readAsText(l)},[t,n,r]),{getRootProps:a,getInputProps:o}=HP({onDrop:i,noClick:!0,accept:e.accept??{"application/json":[".json"],"text/yaml":[".yaml",".yml"]}});return m.jsxs("div",{id:"code-editor-dropzone",...a({disabled:!0}),style:{width:"100%",height:"100%"},children:[m.jsx("input",{id:"code-editor-dropzone-input",...o(),ref:e.inputRef}),e.children]})}function jse(e){return m.jsx(C.Icon,{size:e.size??"md",children:m.jsx(pe.AngleDownIcon,{"data-cy":"expandable",style:{transform:e.isExpanded?"rotate(0deg)":e.direction==="left"?"rotate(90deg)":"rotate(-90deg)",transition:"transform 0.2s",alignSelf:"center"},onClick:()=>e.setExpanded(!e.isExpanded),"aria-label":e.isExpanded?Ml("Collapse"):Ml("Expand")})})}function Dse(e,t,n="txt"){const r=new Blob(t.split("/n"),{type:"text/plain"}),i=document.createElement("a");i.href=URL.createObjectURL(r),i.download=e+"."+n,document.body.appendChild(i),i.click(),document.body.removeChild(i)}function zl(e){const{children:t,helperText:n,helperTextInvalid:r,isRequired:i,labelHelp:a,labelHelpTitle:o,label:s,fullWidth:l}=e;return m.jsxs(C.FormGroup,{id:`${e.fieldId}-form-group`,fieldId:e.fieldId,label:m.jsxs(m.Fragment,{children:[e.icon,s]}),labelIcon:a?m.jsx(uc,{title:o,help:a}):void 0,labelInfo:e.additionalControls,isRequired:i,"data-cy":`${e.fieldId}-form-group`,style:{gridColumn:l?"span 12":void 0},children:[t,(n||r)&&m.jsx(C.FormHelperText,{children:m.jsx(C.HelperText,{children:m.jsx(C.HelperTextItem,{variant:r?"error":void 0,children:r||n})})})]})}function Pse(e){const{t}=De(),{name:n,format:r,disableCopy:i,disableUpload:a,disableDownload:o,disableExpand:s,validate:l,isArray:c}=e,u=Br(e),{formState:{isSubmitting:d,isValidating:f},setError:h,getValues:g,clearErrors:p,control:y}=Dr(),b=ca().dataEditorFormat??"yaml",[S,w]=v.useState(b),[_,E]=v.useState(!e.defaultCollapsed),[k,T]=v.useState(()=>{const re=g(n);return typeof re=="string"?re:$r(re,b)}),j=fc(),{writeToClipboard:A}=h5(),O=v.useCallback(()=>A($r(mi(g(n),c),S)),[g,c,S,n,A]),P=v.useCallback(re=>{T($r(mi(re,c),S))},[c,S]),D=v.useRef(null),M=v.useCallback(()=>{var re;return(re=D.current)==null?void 0:re.click()},[]),I=v.useCallback(()=>{const re=n||"data",te=S==="json"?"json":"yaml";Dse(re,$r(mi(g(n),c),S),te),j.addAlert({variant:"success",title:t("File downloaded"),timeout:!0})},[j,g,c,S,n,t]);v.useLayoutEffect(()=>{const re=$r(mi(g(n),c),S);T(re)},[g,c,S,n]);const[V,K]=v.useState(!1),H=C7({name:n});v.useEffect(()=>{V||T($r(mi(H,c),S))},[V,H,c,S]);const{setValue:z,formState:{defaultValues:$}}=Dr(),U=Ll(e.label,e.isRequired),Q=is($,e.name);return m.jsx(es,{name:n,control:y,shouldUnregister:!0,render:({field:{value:re,name:te,onChange:ne},fieldState:{error:ce}})=>{var ue;function de(W){try{const J=mi(W,c);switch(r){case"object":ne(J);return;default:ne($r(J,r));break}p(te)}catch(J){J instanceof Error&&h(te,{message:J.message})}}return m.jsxs(zl,{fieldId:u,icon:!s&&m.jsx(jse,{isExpanded:_,setExpanded:E}),label:e.label,labelHelpTitle:e.labelHelpTitle??e.label,labelHelp:e.labelHelp,additionalControls:m.jsx(KP,{handleCopy:!i&&O,handleUpload:!a&&M,handleDownload:!o&&I,language:S,setLanguage:w,children:e.additionalControls}),helperText:e.helperText,helperTextInvalid:!(l&&f)&&((ue=ce==null?void 0:ce.message)==null?void 0:ue.split(`
516
- `)),isRequired:e.isRequired,children:[_&&m.jsxs("div",{style:{display:"flex"},children:[m.jsx(Ase,{onDrop:P,isDisabled:d||e.isReadOnly,inputRef:D,children:m.jsx(Eoe,{"data-cy":u,id:u,name:te,language:S,value:k,onChange:de,setError:W=>{W?h(te,{message:W}):p(te)},isReadOnly:e.isReadOnly||d,className:e.isReadOnly?"pf-v5-c-form-control pf-m-disabled":"pf-v5-c-form-control",onFocus:()=>K(!0),onBlur:()=>K(!1)})}),m.jsx(_r,{actions:[{label:t("Undo changes"),type:Je.Button,selection:ze.None,onClick:()=>{z(e.name,Q),T(""),setTimeout(()=>{T($r(mi(Q,c),S))},0)},isHidden:()=>!e.enableUndo||sD(re,Q)},{label:t("Reset to default"),type:Je.Button,selection:ze.None,onClick:()=>{z(e.name,e.defaultValue),T(""),setTimeout(()=>{T($r(mi(e.defaultValue,c),S))},0)},isHidden:()=>!e.enableReset||sD(re,e.defaultValue)}],position:"right"})]}),!_&&m.jsx("div",{className:"pf-v5-c-form-control"})]})},rules:{required:U,validate:e.validate}})}function YP(e){const{t}=De(),{handleCopy:n,handleDownload:r,handleUpload:i}=e;return!n&&!r&&!i?m.jsx(m.Fragment,{}):m.jsxs(C.Flex,{spaceItems:{default:"spaceItemsMd"},children:[n&&m.jsx(C.FlexItem,{children:m.jsx(cc,{id:"copy-button","data-cy":"copy-button","aria-label":t("Copy to clipboard"),type:"button",onClick:n,children:m.jsx(C.Icon,{size:"md",children:m.jsx(pe.CopyIcon,{})})})}),i&&m.jsx(C.FlexItem,{children:m.jsx(cc,{id:"upload-button","data-cy":"upload-button","aria-label":t("Upload from file"),type:"button",onClick:i,children:m.jsx(C.Icon,{size:"md",children:m.jsx(pe.UploadIcon,{})})})}),r&&m.jsx(C.FlexItem,{children:m.jsx(cc,{id:"download-button","data-cy":"download-button","aria-label":t("Download file"),type:"button",onClick:r,children:m.jsx(C.Icon,{size:"md",children:m.jsx(pe.DownloadIcon,{})})})})]})}function KP(e){const{t}=De(),{handleCopy:n,handleDownload:r,handleUpload:i,language:a,setLanguage:o}=e;return m.jsxs(C.Flex,{spaceItems:{default:"spaceItemsLg"},children:[m.jsx(C.FlexItem,{children:e.children}),m.jsx(YP,{handleCopy:n,handleDownload:r,handleUpload:i}),m.jsx(C.FlexItem,{align:{default:"alignRight"},children:m.jsxs(C.ToggleGroup,{isCompact:!0,children:[m.jsx(C.ToggleGroupItem,{id:"toggle-yaml","data-cy":"toggle-yaml","aria-label":t("Toggle to YAML"),isSelected:a==="yaml",text:"YAML",type:"button",onChange:()=>o("yaml")}),m.jsx(C.ToggleGroupItem,{id:"toggle-json","data-cy":"toggle-json","aria-label":t("Toggle to JSON"),isSelected:a==="json",text:"JSON",type:"button",onChange:()=>o("json")})]})})]})}function mi(e,t){const n=t?[]:{};if(e==null)return n;const i=()=>{try{e=fP.load(e)}catch(a){return a instanceof Error||a instanceof jx?new Error(a.message):{}}};if(typeof e=="string")try{e=JSON.parse(e)}catch{i()}return t?Array.isArray(e)?e:[]:Array.isArray(e)?{}:e}function $r(e,t){if(e==null)return"";if(e instanceof Error)return e.message;switch(t){case"json":return JSON.stringify(e,null,2);case"yaml":try{const n=fP.dump(e).trimEnd();switch(n){case"null":case"{}":case"[]":return"";default:return n}}catch(n){return n instanceof Error||n instanceof jx?n.message:""}default:return""}}function Mse(e){const{additionalControls:t,footer:n,helperText:r,isDisabled:i,isReadOnly:a,isRequired:o,label:s,labelHelp:l,labelHelpTitle:c,name:u,options:d,placeholderText:f,validate:h}=e,g=Br(e),{t:p}=De(),{control:y,setValue:x,getValues:b,formState:{isSubmitting:S,isValidating:w,defaultValues:_}}=Dr(),[E,k]=v.useState(!1),T=v.useCallback(()=>k(!E),[E]),[j]=gt(),A=Ll(e.label,e.isRequired),O=is(_,e.name);v.useEffect(()=>{b(e.name)||d.length===1&&o&&x(e.name,d[0].value)},[b,o,d,e.name,x]);const P=(D,M)=>m.jsx(C.MenuToggle,{"data-cy":`${g}-form-group`,id:`${g}-form-group`,isDisabled:i||a||S,ref:D,onClick:T,isExpanded:E,isFullWidth:!0,children:M??f});return m.jsx(es,{name:u,control:y,defaultValue:e.defaultValue,shouldUnregister:!0,render:({field:{onChange:D,value:M},fieldState:{error:I}})=>{const V=(z,$)=>{const U=d.find(Q=>Q.value===$);U&&(D(U.value),e.onChange&&e.onChange(U.value)),k(!1)},K=I!=null&&I.message?h&&w?j.validating:I==null?void 0:I.message:void 0,H=d.find(z=>z.value===M);return m.jsx(zl,{fieldId:g,label:s,labelHelpTitle:c??s,labelHelp:l,additionalControls:t,helperText:r,helperTextInvalid:K,isRequired:o,children:m.jsxs("div",{style:{display:"flex"},children:[m.jsx(C.Select,{"aria-describedby":`${g}-form-group-select`,"data-cy":g,id:g,isOpen:E,itemID:g,onOpenChange:z=>k(z),onSelect:V,ouiaId:"menu-select",shouldFocusToggleOnSelect:!0,toggle:z=>P(z,H==null?void 0:H.label),children:m.jsxs(m.Fragment,{children:[m.jsx(C.SelectList,{children:d.map(z=>{const $=xr(z);return m.jsx(C.SelectOption,{id:$,value:z.value,label:z.label,description:z.description,"data-cy":$,children:z.label},z.label)})}),n&&m.jsx(C.MenuFooter,{children:n})]})}),m.jsx(_r,{actions:[{label:p("Undo changes"),type:Je.Button,selection:ze.None,onClick:()=>{x(e.name,O)},isHidden:()=>!e.enableUndo||M===O},{label:p("Reset to default"),type:Je.Button,selection:ze.None,onClick:()=>{x(e.name,e.defaultValue)},isHidden:()=>!e.enableReset||M===e.defaultValue}],variant:C.ButtonVariant.control,position:"right"})]})})},rules:{required:A,validate:h}})}function Lse(e){const{name:t,helperText:n,validate:r,additionalControls:i,label:a,labelHelp:o,labelHelpTitle:s,labelOn:l,labelOff:c}=e,{control:u,formState:{isSubmitting:d,isValidating:f}}=Dr(),h=Br(e);return m.jsx(es,{name:t,control:u,shouldUnregister:!0,render:({field:{onChange:g,value:p},fieldState:{error:y}})=>{const x=r&&f||y==null?void 0:y.message;return m.jsx(zl,{fieldId:h,"data-cy":h+"-form-group",label:a,labelHelpTitle:s??a,labelHelp:o,helperText:n,helperTextInvalid:x,additionalControls:i,children:m.jsx(C.Switch,{"data-cy":h+"-toggle","aria-label":a,isChecked:p,onChange:b=>g(b),isDisabled:d,label:l,labelOff:c})})}})}function Ise(e){const{type:t,name:n,label:r,labelHelpTitle:i,labelHelp:a,additionalControls:o,placeholder:s,button:l,helperText:c,isDisabled:u,isReadOnly:d,isRequired:f,validate:h,minLength:g,maxLength:p,min:y,max:x,pattern:b,selectTitle:S,selectOpen:w,selectValue:_,autoFocus:E,autoComplete:k,disableAutoResize:T}=e,j=Br(e),{control:A,setValue:O,formState:{isSubmitting:P,isValidating:D}}=Dr(),[M,I]=v.useState(!1),[V]=gt(),K=Ll(e.label,e.isRequired);return m.jsx(es,{name:n,control:A,shouldUnregister:!0,render:({field:{onChange:H,value:z,name:$},fieldState:{error:U}})=>{const Q=U!=null&&U.message?h&&D?V.validating:U==null?void 0:U.message:void 0;function re(te){H(te.trimStart())}return m.jsx(zl,{fieldId:j,label:r,labelHelpTitle:i??r,labelHelp:a,additionalControls:o,helperText:c,helperTextInvalid:Q,isRequired:f,fullWidth:!0,children:m.jsxs(C.InputGroup,{children:[m.jsx(C.InputGroupItem,{isFill:!0,children:m.jsx(C.TextArea,{id:j,placeholder:s,onChange:(te,ne)=>re(ne),value:z??"","aria-describedby":j?`${j}-form-group`:void 0,validated:Q?"error":void 0,type:t==="password"?M?"text":"password":t,readOnlyVariant:d?"default":void 0,isDisabled:u,autoFocus:E,autoComplete:k||"off","data-cy":j,autoResize:T===void 0?!0:!T,rows:1,resizeOrientation:"vertical"})}),t==="password"&&m.jsx(C.Button,{variant:"control",onClick:()=>I(!M),isDisabled:u||d,children:M?m.jsx(pe.EyeIcon,{}):m.jsx(pe.EyeSlashIcon,{})}),S&&m.jsx(C.Button,{ouiaId:`lookup-${$}-button`,variant:"control",onClick:()=>w==null?void 0:w(te=>{if(_){const ne=_(te);O($,ne,{shouldValidate:!0})}},S),"aria-label":"Options menu",isDisabled:u||P,children:m.jsx(pe.SearchIcon,{})}),l]})})},rules:{required:K,validate:h,minLength:typeof r=="string"&&typeof g=="number"?{value:g,message:`${Ir(r.toLocaleLowerCase())} must be at least ${g} characters.`}:g,maxLength:typeof r=="string"&&typeof p=="number"?{value:p,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${p} characters.`}:p,min:typeof r=="string"&&(typeof y=="number"||typeof y=="string")?{value:y,message:`${Ir(r.toLocaleLowerCase())} must be less than ${y}.`}:g,max:typeof r=="string"&&(typeof x=="number"||typeof x=="string")?{value:x,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${x}.`}:g,pattern:b}})}function Fse(e){const{type:t,name:n,label:r,labelHelpTitle:i,labelHelp:a,additionalControls:o,placeholder:s,button:l,helperText:c,isDisabled:u,isReadOnly:d,isRequired:f,validate:h,minLength:g,maxLength:p,min:y,max:x,pattern:b,selectTitle:S,selectOpen:w,selectValue:_,autoFocus:E,autoComplete:k,fullWidth:T}=e,j=Br(e),{t:A}=De(),{control:O,setValue:P,formState:{isSubmitting:D,isValidating:M,defaultValues:I}}=Dr(),[V,K]=v.useState(!1),[H]=gt(),z=Ll(e.label,e.isRequired),$=is(I,e.name);return m.jsx(es,{name:n,control:O,shouldUnregister:e.shouldUnregister!==!1,defaultValue:e.defaultValue,render:({field:{onChange:U,value:Q,name:re},fieldState:{error:te}})=>{const ne=te!=null&&te.message?h&&M?H.validating:te==null?void 0:te.message:void 0;let ce=Q;switch(t){case"datetime-local":if(Q){const ue=new Date(Q);ce=new Date(ue.getTime()-ue.getTimezoneOffset()*6e4).toISOString().slice(0,16)}break}function de(ue){switch(e.type){case"datetime-local":{U(new Date(ue).toISOString());break}case"number":{let W=Number(ue);if(ue===""||isNaN(W)){P(re,null),U(null);return}x!==void 0&&W>Number(x)&&(W=Number(x)),y!==void 0&&W<Number(y)&&(W=Number(y)),P(re,W),U(W);break}default:U(ue.trimStart())}}return m.jsx(zl,{fieldId:j,label:r,labelHelpTitle:i??r,labelHelp:a,additionalControls:o,helperText:c,helperTextInvalid:ne,isRequired:f,fullWidth:T,children:m.jsxs(C.InputGroup,{children:[m.jsx(C.InputGroupItem,{isFill:!0,children:m.jsx(C.TextInput,{id:j,placeholder:s,onChange:(ue,W)=>de(W),value:ce??"","aria-describedby":j?`${j}-form-group`:void 0,validated:ne?"error":void 0,type:t==="password"?V?"text":"password":t,readOnlyVariant:d?"default":void 0,isDisabled:u,autoFocus:E,autoComplete:k||"off","data-cy":j})}),t==="password"&&m.jsx(C.Button,{variant:"control",onClick:()=>K(!V),isDisabled:u||d,children:V?m.jsx(pe.EyeIcon,{}):m.jsx(pe.EyeSlashIcon,{})}),S&&m.jsx(C.Button,{ouiaId:`lookup-${re}-button`,variant:"control",onClick:()=>w==null?void 0:w(ue=>{if(_){const W=_(ue);P(re,W,{shouldValidate:!0})}},S),"aria-label":"Options menu",isDisabled:u||D,children:m.jsx(pe.SearchIcon,{"data-cy":"lookup-button"})}),l,m.jsx(_r,{actions:[{label:A("Undo changes"),type:Je.Button,selection:ze.None,onClick:()=>{P(e.name,$)},isHidden:()=>!e.enableUndo||Q===$},{label:A("Reset to default"),type:Je.Button,selection:ze.None,onClick:()=>{P(e.name,e.defaultValue)},isHidden:()=>!e.enableReset||Q===e.defaultValue}],variant:C.ButtonVariant.control,position:"right"})]})})},rules:{required:z,validate:h,minLength:typeof r=="string"&&typeof g=="number"?{value:g,message:`${Ir(r.toLocaleLowerCase())} must be at least ${g} characters.`}:g,maxLength:typeof r=="string"&&typeof p=="number"?{value:p,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${p} characters.`}:p,min:typeof r=="string"&&(typeof y=="number"||typeof y=="string")?{value:y,message:`${Ir(r.toLocaleLowerCase())} must be greater or equal to ${y}.`}:g,max:typeof r=="string"&&(typeof x=="number"||typeof x=="string")?{value:x,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${x}.`}:x,pattern:b}})}const Hx=v.createContext({isOpen:!1,setState:()=>({})});function cf(){return v.useContext(Hx)}function ZP(e){const t=Xt("xl"),[n,r]=v.useState(()=>t),i=v.useCallback(a=>{a.isOpen!==void 0&&r(a.isOpen)},[]);return v.useEffect(()=>i({isOpen:t}),[t,i]),m.jsx(Hx.Provider,{value:{isOpen:n,setState:i},children:e.children})}function XP(){const e=ht.useNavigate(),t=Xt("xl"),n=cf();return v.useCallback(i=>{e(i),t||n.setState({isOpen:!n.isOpen})},[e,t,n])}const Gx=v.createContext([{},()=>{}]);function Nse(){return v.useContext(Gx)[0]}function $se(){return v.useContext(Gx)}function qse(e){const[t,n]=v.useState({}),r=v.useCallback(a=>{n(JP("",a))},[]),i=v.useMemo(()=>[t,r],[t,r]);return m.jsx(Gx.Provider,{value:i,children:e.children})}function JP(e,t){const n={};return t.forEach(r=>{const i=(e+"/"+r.path).replace("//","/");"id"in r&&typeof r.id=="string"&&(n[r.id]=i),"children"in r&&Object.assign(n,JP(i,r.children))}),n}const QP=v.createContext({notificationsDrawerOpen:!1,setNotificationsDrawerOpen:()=>{throw new Error("PageNotificationsContext not implemented")},notificationGroups:{},setNotificationGroups:()=>{throw new Error("PageNotificationsContext not implemented")}});function uf(){return v.useContext(QP)}function Rse(e){const[t,n]=v.useState(!1),[r,i]=v.useState({});return m.jsx(QP.Provider,{value:{notificationGroups:r,setNotificationGroups:i,notificationsDrawerOpen:t,setNotificationsDrawerOpen:n},children:e.children})}function zse(e){const{t}=De(),{notificationsDrawerOpen:n,setNotificationsDrawerOpen:r}=uf(),i=v.useRef(null);function a(){var s;r(!1),(s=i.current)==null||s.focus()}const{notificationGroups:o}=uf();return m.jsx(C.Drawer,{isExpanded:n,onExpand:()=>r(!0),children:m.jsx(C.DrawerContent,{panelContent:m.jsx(C.DrawerPanelContent,{children:m.jsxs(C.NotificationDrawer,{"data-cy":"notifications-drawer",children:[m.jsx(C.NotificationDrawerHeader,{title:t("Notifications"),children:m.jsx(C.DrawerCloseButton,{onClick:a})}),m.jsx(C.NotificationDrawerBody,{children:m.jsx(C.NotificationDrawerGroupList,{children:Object.values(o).map((s,l)=>m.jsx(Wse,{group:s},l))})})]})}),children:m.jsx(Bse,{children:e.children})})})}const Bse=Ae(C.DrawerContentBody)`
516
+ `)),isRequired:e.isRequired,children:[_&&m.jsxs("div",{style:{display:"flex"},children:[m.jsx(Ase,{onDrop:P,isDisabled:d||e.isReadOnly,inputRef:D,children:m.jsx(Eoe,{"data-cy":u,id:u,name:te,language:S,value:k,onChange:de,setError:W=>{W?h(te,{message:W}):p(te)},isReadOnly:e.isReadOnly||d,className:e.isReadOnly?"pf-v5-c-form-control pf-m-disabled":"pf-v5-c-form-control",onFocus:()=>K(!0),onBlur:()=>K(!1)})}),m.jsx(_r,{actions:[{label:t("Undo changes"),type:Je.Button,selection:ze.None,onClick:()=>{z(e.name,Q),T(""),setTimeout(()=>{T($r(mi(Q,c),S))},0)},isHidden:()=>!e.enableUndo||sD(re,Q)},{label:t("Reset to default"),type:Je.Button,selection:ze.None,onClick:()=>{z(e.name,e.defaultValue),T(""),setTimeout(()=>{T($r(mi(e.defaultValue,c),S))},0)},isHidden:()=>!e.enableReset||sD(re,e.defaultValue)}],position:"right"})]}),!_&&m.jsx("div",{className:"pf-v5-c-form-control"})]})},rules:{required:U,validate:e.validate}})}function YP(e){const{t}=De(),{handleCopy:n,handleDownload:r,handleUpload:i}=e;return!n&&!r&&!i?m.jsx(m.Fragment,{}):m.jsxs(C.Flex,{spaceItems:{default:"spaceItemsMd"},children:[n&&m.jsx(C.FlexItem,{children:m.jsx(cc,{id:"copy-button","data-cy":"copy-button","aria-label":t("Copy to clipboard"),type:"button",onClick:n,children:m.jsx(C.Icon,{size:"md",children:m.jsx(pe.CopyIcon,{})})})}),i&&m.jsx(C.FlexItem,{children:m.jsx(cc,{id:"upload-button","data-cy":"upload-button","aria-label":t("Upload from file"),type:"button",onClick:i,children:m.jsx(C.Icon,{size:"md",children:m.jsx(pe.UploadIcon,{})})})}),r&&m.jsx(C.FlexItem,{children:m.jsx(cc,{id:"download-button","data-cy":"download-button","aria-label":t("Download file"),type:"button",onClick:r,children:m.jsx(C.Icon,{size:"md",children:m.jsx(pe.DownloadIcon,{})})})})]})}function KP(e){const{t}=De(),{handleCopy:n,handleDownload:r,handleUpload:i,language:a,setLanguage:o}=e;return m.jsxs(C.Flex,{spaceItems:{default:"spaceItemsLg"},children:[m.jsx(C.FlexItem,{children:e.children}),m.jsx(YP,{handleCopy:n,handleDownload:r,handleUpload:i}),m.jsx(C.FlexItem,{align:{default:"alignRight"},children:m.jsxs(C.ToggleGroup,{isCompact:!0,children:[m.jsx(C.ToggleGroupItem,{id:"toggle-yaml","data-cy":"toggle-yaml","aria-label":t("Toggle to YAML"),isSelected:a==="yaml",text:"YAML",type:"button",onChange:()=>o("yaml")}),m.jsx(C.ToggleGroupItem,{id:"toggle-json","data-cy":"toggle-json","aria-label":t("Toggle to JSON"),isSelected:a==="json",text:"JSON",type:"button",onChange:()=>o("json")})]})})]})}function mi(e,t){const n=t?[]:{};if(e==null)return n;const i=()=>{try{e=fP.load(e)}catch(a){return a instanceof Error||a instanceof jx?new Error(a.message):{}}};if(typeof e=="string")try{e=JSON.parse(e)}catch{i()}return t?Array.isArray(e)?e:[]:Array.isArray(e)?{}:e}function $r(e,t){if(e==null)return"";if(e instanceof Error)return e.message;switch(t){case"json":return JSON.stringify(e,null,2);case"yaml":try{const n=fP.dump(e).trimEnd();switch(n){case"null":case"{}":case"[]":return"";default:return n}}catch(n){return n instanceof Error||n instanceof jx?n.message:""}default:return""}}function Mse(e){const{additionalControls:t,footer:n,helperText:r,isDisabled:i,isReadOnly:a,isRequired:o,label:s,labelHelp:l,labelHelpTitle:c,name:u,options:d,placeholderText:f,validate:h}=e,g=Br(e),{t:p}=De(),{control:y,setValue:x,getValues:b,formState:{isSubmitting:S,isValidating:w,defaultValues:_}}=Dr(),[E,k]=v.useState(!1),T=v.useCallback(()=>k(!E),[E]),[j]=gt(),A=Ll(e.label,e.isRequired),O=is(_,e.name);v.useEffect(()=>{b(e.name)||d.length===1&&o&&x(e.name,d[0].value)},[b,o,d,e.name,x]);const P=(D,M)=>m.jsx(C.MenuToggle,{"data-cy":`${g}-form-group`,id:`${g}-form-group-toggle`,isDisabled:i||a||S,ref:D,onClick:T,isExpanded:E,isFullWidth:!0,children:M??f});return m.jsx(es,{name:u,control:y,defaultValue:e.defaultValue,shouldUnregister:!0,render:({field:{onChange:D,value:M},fieldState:{error:I}})=>{const V=(z,$)=>{const U=d.find(Q=>Q.value===$);U&&(D(U.value),e.onChange&&e.onChange(U.value)),k(!1)},K=I!=null&&I.message?h&&w?j.validating:I==null?void 0:I.message:void 0,H=d.find(z=>z.value===M);return m.jsx(zl,{fieldId:g,label:s,labelHelpTitle:c??s,labelHelp:l,additionalControls:t,helperText:r,helperTextInvalid:K,isRequired:o,children:m.jsxs("div",{style:{display:"flex"},children:[m.jsx(C.Select,{"aria-describedby":`${g}-form-group-select`,"data-cy":g,id:g,isOpen:E,itemID:g,onOpenChange:z=>k(z),onSelect:V,ouiaId:"menu-select",shouldFocusToggleOnSelect:!0,toggle:z=>P(z,H==null?void 0:H.label),children:m.jsxs(m.Fragment,{children:[m.jsx(C.SelectList,{children:d.map(z=>{const $=xr(z);return m.jsx(C.SelectOption,{id:$,value:z.value,label:z.label,description:z.description,"data-cy":$,children:z.label},z.label)})}),n&&m.jsx(C.MenuFooter,{children:n})]})}),m.jsx(_r,{actions:[{label:p("Undo changes"),type:Je.Button,selection:ze.None,onClick:()=>{x(e.name,O)},isHidden:()=>!e.enableUndo||M===O},{label:p("Reset to default"),type:Je.Button,selection:ze.None,onClick:()=>{x(e.name,e.defaultValue)},isHidden:()=>!e.enableReset||M===e.defaultValue}],variant:C.ButtonVariant.control,position:"right"})]})})},rules:{required:A,validate:h}})}function Lse(e){const{name:t,helperText:n,validate:r,additionalControls:i,label:a,labelHelp:o,labelHelpTitle:s,labelOn:l,labelOff:c}=e,{control:u,formState:{isSubmitting:d,isValidating:f}}=Dr(),h=Br(e);return m.jsx(es,{name:t,control:u,shouldUnregister:!0,render:({field:{onChange:g,value:p},fieldState:{error:y}})=>{const x=r&&f||y==null?void 0:y.message;return m.jsx(zl,{fieldId:h,"data-cy":h+"-form-group",label:a,labelHelpTitle:s??a,labelHelp:o,helperText:n,helperTextInvalid:x,additionalControls:i,children:m.jsx(C.Switch,{"data-cy":h+"-toggle","aria-label":a,isChecked:p,onChange:b=>g(b),isDisabled:d,label:l,labelOff:c})})}})}function Ise(e){const{type:t,name:n,label:r,labelHelpTitle:i,labelHelp:a,additionalControls:o,placeholder:s,button:l,helperText:c,isDisabled:u,isReadOnly:d,isRequired:f,validate:h,minLength:g,maxLength:p,min:y,max:x,pattern:b,selectTitle:S,selectOpen:w,selectValue:_,autoFocus:E,autoComplete:k,disableAutoResize:T}=e,j=Br(e),{control:A,setValue:O,formState:{isSubmitting:P,isValidating:D}}=Dr(),[M,I]=v.useState(!1),[V]=gt(),K=Ll(e.label,e.isRequired);return m.jsx(es,{name:n,control:A,shouldUnregister:!0,render:({field:{onChange:H,value:z,name:$},fieldState:{error:U}})=>{const Q=U!=null&&U.message?h&&D?V.validating:U==null?void 0:U.message:void 0;function re(te){H(te.trimStart())}return m.jsx(zl,{fieldId:j,label:r,labelHelpTitle:i??r,labelHelp:a,additionalControls:o,helperText:c,helperTextInvalid:Q,isRequired:f,fullWidth:!0,children:m.jsxs(C.InputGroup,{children:[m.jsx(C.InputGroupItem,{isFill:!0,children:m.jsx(C.TextArea,{id:j,placeholder:s,onChange:(te,ne)=>re(ne),value:z??"","aria-describedby":j?`${j}-form-group`:void 0,validated:Q?"error":void 0,type:t==="password"?M?"text":"password":t,readOnlyVariant:d?"default":void 0,isDisabled:u,autoFocus:E,autoComplete:k||"off","data-cy":j,autoResize:T===void 0?!0:!T,rows:1,resizeOrientation:"vertical"})}),t==="password"&&m.jsx(C.Button,{variant:"control",onClick:()=>I(!M),isDisabled:u||d,children:M?m.jsx(pe.EyeIcon,{}):m.jsx(pe.EyeSlashIcon,{})}),S&&m.jsx(C.Button,{ouiaId:`lookup-${$}-button`,variant:"control",onClick:()=>w==null?void 0:w(te=>{if(_){const ne=_(te);O($,ne,{shouldValidate:!0})}},S),"aria-label":"Options menu",isDisabled:u||P,children:m.jsx(pe.SearchIcon,{})}),l]})})},rules:{required:K,validate:h,minLength:typeof r=="string"&&typeof g=="number"?{value:g,message:`${Ir(r.toLocaleLowerCase())} must be at least ${g} characters.`}:g,maxLength:typeof r=="string"&&typeof p=="number"?{value:p,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${p} characters.`}:p,min:typeof r=="string"&&(typeof y=="number"||typeof y=="string")?{value:y,message:`${Ir(r.toLocaleLowerCase())} must be less than ${y}.`}:g,max:typeof r=="string"&&(typeof x=="number"||typeof x=="string")?{value:x,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${x}.`}:g,pattern:b}})}function Fse(e){const{type:t,name:n,label:r,labelHelpTitle:i,labelHelp:a,additionalControls:o,placeholder:s,button:l,helperText:c,isDisabled:u,isReadOnly:d,isRequired:f,validate:h,minLength:g,maxLength:p,min:y,max:x,pattern:b,selectTitle:S,selectOpen:w,selectValue:_,autoFocus:E,autoComplete:k,fullWidth:T}=e,j=Br(e),{t:A}=De(),{control:O,setValue:P,formState:{isSubmitting:D,isValidating:M,defaultValues:I}}=Dr(),[V,K]=v.useState(!1),[H]=gt(),z=Ll(e.label,e.isRequired),$=is(I,e.name);return m.jsx(es,{name:n,control:O,shouldUnregister:e.shouldUnregister!==!1,defaultValue:e.defaultValue,render:({field:{onChange:U,value:Q,name:re},fieldState:{error:te}})=>{const ne=te!=null&&te.message?h&&M?H.validating:te==null?void 0:te.message:void 0;let ce=Q;switch(t){case"datetime-local":if(Q){const ue=new Date(Q);ce=new Date(ue.getTime()-ue.getTimezoneOffset()*6e4).toISOString().slice(0,16)}break}function de(ue){switch(e.type){case"datetime-local":{U(new Date(ue).toISOString());break}case"number":{let W=Number(ue);if(ue===""||isNaN(W)){P(re,null),U(null);return}x!==void 0&&W>Number(x)&&(W=Number(x)),y!==void 0&&W<Number(y)&&(W=Number(y)),P(re,W),U(W);break}default:U(ue.trimStart())}}return m.jsx(zl,{fieldId:j,label:r,labelHelpTitle:i??r,labelHelp:a,additionalControls:o,helperText:c,helperTextInvalid:ne,isRequired:f,fullWidth:T,children:m.jsxs(C.InputGroup,{children:[m.jsx(C.InputGroupItem,{isFill:!0,children:m.jsx(C.TextInput,{id:j,placeholder:s,onChange:(ue,W)=>de(W),value:ce??"","aria-describedby":j?`${j}-form-group`:void 0,validated:ne?"error":void 0,type:t==="password"?V?"text":"password":t,readOnlyVariant:d?"default":void 0,isDisabled:u,autoFocus:E,autoComplete:k||"off","data-cy":j})}),t==="password"&&m.jsx(C.Button,{variant:"control",onClick:()=>K(!V),isDisabled:u||d,children:V?m.jsx(pe.EyeIcon,{}):m.jsx(pe.EyeSlashIcon,{})}),S&&m.jsx(C.Button,{ouiaId:`lookup-${re}-button`,variant:"control",onClick:()=>w==null?void 0:w(ue=>{if(_){const W=_(ue);P(re,W,{shouldValidate:!0})}},S),"aria-label":"Options menu",isDisabled:u||D,children:m.jsx(pe.SearchIcon,{"data-cy":"lookup-button"})}),l,m.jsx(_r,{actions:[{label:A("Undo changes"),type:Je.Button,selection:ze.None,onClick:()=>{P(e.name,$)},isHidden:()=>!e.enableUndo||Q===$},{label:A("Reset to default"),type:Je.Button,selection:ze.None,onClick:()=>{P(e.name,e.defaultValue)},isHidden:()=>!e.enableReset||Q===e.defaultValue}],variant:C.ButtonVariant.control,position:"right"})]})})},rules:{required:z,validate:h,minLength:typeof r=="string"&&typeof g=="number"?{value:g,message:`${Ir(r.toLocaleLowerCase())} must be at least ${g} characters.`}:g,maxLength:typeof r=="string"&&typeof p=="number"?{value:p,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${p} characters.`}:p,min:typeof r=="string"&&(typeof y=="number"||typeof y=="string")?{value:y,message:`${Ir(r.toLocaleLowerCase())} must be greater or equal to ${y}.`}:g,max:typeof r=="string"&&(typeof x=="number"||typeof x=="string")?{value:x,message:`${Ir(r.toLocaleLowerCase())} cannot be greater than ${x}.`}:x,pattern:b}})}const Hx=v.createContext({isOpen:!1,setState:()=>({})});function cf(){return v.useContext(Hx)}function ZP(e){const t=Xt("xl"),[n,r]=v.useState(()=>t),i=v.useCallback(a=>{a.isOpen!==void 0&&r(a.isOpen)},[]);return v.useEffect(()=>i({isOpen:t}),[t,i]),m.jsx(Hx.Provider,{value:{isOpen:n,setState:i},children:e.children})}function XP(){const e=ht.useNavigate(),t=Xt("xl"),n=cf();return v.useCallback(i=>{e(i),t||n.setState({isOpen:!n.isOpen})},[e,t,n])}const Gx=v.createContext([{},()=>{}]);function Nse(){return v.useContext(Gx)[0]}function $se(){return v.useContext(Gx)}function qse(e){const[t,n]=v.useState({}),r=v.useCallback(a=>{n(JP("",a))},[]),i=v.useMemo(()=>[t,r],[t,r]);return m.jsx(Gx.Provider,{value:i,children:e.children})}function JP(e,t){const n={};return t.forEach(r=>{const i=(e+"/"+r.path).replace("//","/");"id"in r&&typeof r.id=="string"&&(n[r.id]=i),"children"in r&&Object.assign(n,JP(i,r.children))}),n}const QP=v.createContext({notificationsDrawerOpen:!1,setNotificationsDrawerOpen:()=>{throw new Error("PageNotificationsContext not implemented")},notificationGroups:{},setNotificationGroups:()=>{throw new Error("PageNotificationsContext not implemented")}});function uf(){return v.useContext(QP)}function Rse(e){const[t,n]=v.useState(!1),[r,i]=v.useState({});return m.jsx(QP.Provider,{value:{notificationGroups:r,setNotificationGroups:i,notificationsDrawerOpen:t,setNotificationsDrawerOpen:n},children:e.children})}function zse(e){const{t}=De(),{notificationsDrawerOpen:n,setNotificationsDrawerOpen:r}=uf(),i=v.useRef(null);function a(){var s;r(!1),(s=i.current)==null||s.focus()}const{notificationGroups:o}=uf();return m.jsx(C.Drawer,{isExpanded:n,onExpand:()=>r(!0),children:m.jsx(C.DrawerContent,{panelContent:m.jsx(C.DrawerPanelContent,{children:m.jsxs(C.NotificationDrawer,{"data-cy":"notifications-drawer",children:[m.jsx(C.NotificationDrawerHeader,{title:t("Notifications"),children:m.jsx(C.DrawerCloseButton,{onClick:a})}),m.jsx(C.NotificationDrawerBody,{children:m.jsx(C.NotificationDrawerGroupList,{children:Object.values(o).map((s,l)=>m.jsx(Wse,{group:s},l))})})]})}),children:m.jsx(Bse,{children:e.children})})})}const Bse=Ae(C.DrawerContentBody)`
517
517
  max-height: 100%;
518
518
  `;function Wse(e){const{t}=De(),[n,r]=v.useState(!0);return m.jsx(C.NotificationDrawerGroup,{title:e.group.title,isExpanded:n,count:e.group.notifications.length,onExpand:(i,a)=>r(a),children:m.jsxs(C.NotificationDrawerList,{isHidden:!n,children:[e.group.notifications.map((i,a)=>m.jsx(Vse,{notification:i},a)),e.group.notifications.length===0&&m.jsxs(C.EmptyState,{variant:C.EmptyStateVariant.full,children:[m.jsx(C.EmptyStateHeader,{headingLevel:"h2",titleText:t("No notifications")}),m.jsx(C.EmptyStateBody,{children:t("There are currently no notifications.")})]})]})})}function Vse(e){const t=e.notification.variant==="info"?void 0:e.notification.variant,n=ht.useNavigate(),{setNotificationsDrawerOpen:r}=uf(),i=e.notification.timestamp?new Date(e.notification.timestamp):void 0,a=i?`${i.toLocaleDateString()} ${i.toLocaleTimeString()}`:void 0;return m.jsxs(C.NotificationDrawerListItem,{variant:e.notification.variant,onClick:()=>{n(e.notification.to),r(!1)},children:[m.jsx(C.NotificationDrawerListItemHeader,{title:e.notification.title,variant:t}),m.jsx(C.NotificationDrawerListItemBody,{timestamp:a,children:e.notification.description})]})}function Use(e){return m.jsx(u1,{children:m.jsx(t2,{defaultRefreshInterval:e.defaultRefreshInterval,children:m.jsx(qse,{children:m.jsx(Xj,{children:m.jsx(d5,{children:m.jsx(ZP,{children:m.jsx(Rse,{children:m.jsx(cI,{children:e.children})})})})})})})})}function eM(e){const[t]=gt();return m.jsx(f5,{message:t.errorText,children:m.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",maxHeight:"100%"},children:e.children})})}function Hse(e){const t=Xt("sm");return m.jsxs(C.Masthead,{display:{default:"inline"},style:{borderBottom:"1px solid #fff4",paddingRight:0},children:[m.jsx(tM,{}),t&&m.jsx(C.MastheadMain,{children:m.jsx(C.MastheadBrand,{component:n=>m.jsx(ht.Link,{...n,to:"/"}),children:e.brand})}),m.jsx(C.MastheadContent,{style:{marginLeft:0,minHeight:0},children:m.jsx(C.Toolbar,{id:"toolbar","data-cy":"toolbar",inset:{default:"insetNone"},style:{padding:0},children:m.jsx(C.ToolbarContent,{children:e.children})})})]})}function tM(){const e=cf();return m.jsx(C.MastheadToggle,{onClick:()=>e.setState({isOpen:!e.isOpen}),children:m.jsx(C.PageToggleButton,{"data-cy":"nav-toggle",variant:"plain","aria-label":"Global navigation",children:m.jsx(pe.BarsIcon,{})})})}function Gse(){const{setNotificationsDrawerOpen:e,notificationGroups:t}=uf(),n=Object.values(t).reduce((r,i)=>r+i.notifications.length,0);return m.jsx(C.NotificationBadge,{"data-cy":"notification-badge",variant:n===0?"read":"unread",count:n,onClick:()=>e(r=>!r)})}function Yse(){const[e,t]=v.useContext(la);return e.activeTheme==="dark"?m.jsx(C.Button,{"data-cy":"settings-icon",variant:"plain",onClick:()=>t({...e,theme:"light"}),children:m.jsx(pe.MoonIcon,{})}):m.jsx(C.Button,{"data-cy":"theme-icon",variant:"plain",onClick:()=>t({...e,theme:"dark"}),children:m.jsx(pe.SunIcon,{})})}function nM(e){const{navigation:t}=e,n=cf();return m.jsx(C.PageSidebar,{isSidebarOpen:n.isOpen,className:"bg-lighten",children:m.jsxs(C.PageSidebarBody,{children:[e.contextSwitcher,m.jsx(C.Nav,{"data-cy":"page-navigation",className:"side-nav",children:m.jsx(C.NavList,{children:m.jsx(df,{baseRoute:e.basename??"",items:t})})})]})})}function df(e){return m.jsx(m.Fragment,{children:e.items.filter(t=>"hidden"in t?t.hidden!==!0:!0).map((t,n)=>m.jsx(Kse,{item:t,baseRoute:e.baseRoute},t.id??t.label??n))})}function Kse(e){var u,d;const{item:t}=e,[n,r]=v.useState(()=>localStorage.getItem("default-nav-expanded")==="true"||localStorage.getItem((t.id??t.label)+"-expanded")==="true"),i=f=>{r(f),localStorage.setItem((t.id??t.label)+"-expanded",f?"true":"false")};let a;if("id"in e.item)a=e.item.id;else if("children"in e.item){const f=e.item.children.find(h=>h.path==="");f&&"id"in f&&(a=f.id)}a||(a=(u=e.item.label)==null?void 0:u.split(" ").join("-").toLowerCase());const o=XP();let s=e.baseRoute+"/"+t.path;if(s=s.replace("//","/"),t.path==="/"&&"children"in t)return m.jsx(df,{items:t.children,baseRoute:""});const l="children"in t&&((d=t.children)==null?void 0:d.find(f=>f.label)),c={fontSize:"small",opacity:.5,textAlign:"left"};if(!l&&"label"in t){let f=(process.env.ROUTE_PREFIX??"")+s;f=f.replace("//","/");const h=t.href?!1:location.pathname.startsWith(f);return m.jsxs(C.NavItem,{id:a,href:t.href||s,isActive:h,className:h?"bg-lighten":void 0,onClick:()=>t.href?window.open(t.href,"_blank"):o(s),target:t.href?"_blank":"","data-cy":a,style:{display:"flex",alignItems:"stretch",flexDirection:"column"},children:[m.jsxs(C.Flex,{children:[m.jsx(C.FlexItem,{grow:{default:"grow"},children:t.label}),"badge"in t&&t.badge&&m.jsx(C.FlexItem,{children:m.jsx(C.Label,{isCompact:!0,variant:"outline",color:t.badgeColor,children:t.badge})}),"href"in t&&t.href&&m.jsx("span",{className:"pf-v5-c-nav__toggle",children:m.jsx("span",{className:"pf-v5-c-nav__toggle-icon",children:m.jsx(pe.ExternalLinkAltIcon,{})})})]}),t.subtitle&&m.jsx("div",{style:c,children:t.subtitle})]})}return!l||t.label===void 0?null:t.label?m.jsx(C.NavExpandable,{buttonProps:{id:a},title:m.jsxs("div",{children:[m.jsx("div",{style:{textAlign:"left"},children:t.label}),t.subtitle&&m.jsx("div",{style:c,children:t.subtitle})]}),isExpanded:n,onExpand:(f,h)=>i(h),children:m.jsx(df,{items:t.children,baseRoute:s})}):m.jsx(df,{items:t.children,baseRoute:s})}function Zse(e){const{navigation:t,masthead:n}=e,r=v.useMemo(()=>[{path:e.basename??"/",element:m.jsx(C.Page,{header:n,sidebar:m.jsx(nM,{navigation:t,basename:e.basename,contextSwitcher:e.contextSwitcher}),children:m.jsx(zse,{children:m.jsxs("div",{style:{maxHeight:"100%",overflow:"hidden",height:"100%",display:"flex",flexDirection:"column"},children:[e.banner,m.jsx("div",{style:{flexGrow:1,overflow:"hidden"},children:m.jsx(ht.Outlet,{})})]})})}),children:t.filter(({href:o})=>!o)},{path:"*",element:m.jsx(h7,{})}],[n,t,e.banner,e.basename,e.contextSwitcher]),[i,a]=$se();return v.useEffect(()=>a(r),[r,a]),m.jsx(ht.Routes,{children:r.map(rM)})}function rM(e){var t;return m.jsx(ht.Route,{path:e.path,element:e.element,children:(t=e.children)==null?void 0:t.map(rM)},e.path)}function Xse(e){return e.replace(/^\//,"")}function iM(e,t){for(const n of e){if("id"in n&&n.id===t)return n;if("children"in n){const r=iM(n.children,t);if(r)return r}}}function aM(e,t){for(let n=0;n<e.length;n++){const r=e[n];if("id"in r&&r.id===t)return e.splice(n,1),r;if("children"in r){const i=aM(r.children,t);if(i)return i}}}function oM(e,t,n){for(const r of e)if("id"in r&&r.id===t){const i=r;"children"in r||(i.children=[]),i.children.push(n);return}else"children"in r&&oM(r.children,t,n)}function sM(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if("id"in i&&i.id===t){e.splice(r+1,0,n);return}else"children"in i&&sM(i.children,t,n)}}function lM(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if("id"in i&&i.id===t){e.splice(r,0,n);return}else"children"in i&&lM(i.children,t,n)}}function cM(){const e=Nse();return v.useCallback((t,n)=>{let r=e[t]??"";const i=n==null?void 0:n.params,a=n==null?void 0:n.query;return r&&(i&&(r=Object.keys(i).reduce((o,s)=>{let l=i[s];if(l==null)return o;l=encodeURIComponent(l.toString());const c=":"+s,u=new RegExp(c+"(?!.*"+c+")","g");return o.replace(u,l)},r)),a&&(r=`${r}?${Object.keys(a).map(o=>{let s=a[o];return s===void 0?"":(s=encodeURIComponent(s.toString()),`${o}=${s}`)}).join("&").replace("/&&/g","&")}`)),r},[e])}function Jse(){const e=ht.useNavigate(),t=cM();return v.useCallback((n,r)=>{const i=t(n,r);i&&e(i)},[e,t])}function Qse(e){const{loading:t}=e,[n,r]=v.useState((e==null?void 0:e.initialTabIndex)??0),i=v.useCallback((l,c)=>r(c),[r]),a=v.Children.toArray(e.children),o=a.map((l,c)=>{if(v.isValidElement(l)&&l.type===Yx){const u=l.props.label;return m.jsx(C.Tab,{title:u||m.jsx(C.Skeleton,{width:"60px"}),eventKey:c},u??c)}return l}),s=a[n];return t?m.jsx(C.Tabs,{style:{flexShrink:0,backgroundColor:"var(--pf-v5-c-tabs__link--BackgroundColor)"},children:m.jsx(Yx,{children:m.jsx(C.PageSection,{variant:"light",children:m.jsx(C.Skeleton,{})})})}):m.jsxs(m.Fragment,{children:[m.jsx(C.Tabs,{activeKey:n,onSelect:i,inset:{default:"insetSm"},isBox:!0,style:{flexShrink:0,backgroundColor:"var(--pf-v5-c-tabs__link--BackgroundColor)"},children:o}),s]})}function Yx(e){return m.jsx(m.Fragment,{children:e.children})}function ele(e,t,n,r){return(i,a)=>{e(o=>{r?r(o):i(o.map(s=>t(s)))},a?a.map(o=>n(o)):[])}}function tle(e,t,n,r){return(i,a)=>{e(o=>{r?r(o):i(t(o))},a?n(a):void 0)}}function nle(){const[e,t]=v.useState(!0);return v.useEffect(()=>()=>{t(!1)},[]),e}function rle(){const e=v.useRef({isMounted:!0});return v.useEffect(()=>()=>{e.current.isMounted=!1},[]),e}function uM(){const e=nle(),[t,n]=v.useState(e?window.location:void 0),r=v.useCallback(()=>{n(window.location)},[]);v.useEffect(()=>{if(e)return t||r(),window.addEventListener("popstate",r),()=>{window.removeEventListener("popstate",r)}},[e,t,r]);const i=v.useCallback(o=>{window.history.replaceState(null,"",o),r()},[r]),a=v.useCallback(o=>{window.history.replaceState(null,"",o),r()},[r]);return{location:t,push:i,update:a}}function dM(){var i,a;const e=uM(),t=((i=e.location)==null?void 0:i.pathname)||"/",n=v.useMemo(()=>{var s;let o=(s=e.location)==null?void 0:s.search;return o&&o.includes("?specPath=")?o=o.substring(0,o.indexOf("?specPath=")):o&&o.includes("&specPath=")&&(o=o.substring(0,o.indexOf("&specPath="))),new URLSearchParams(o??"/")},[(a=e.location)==null?void 0:a.search]),r=v.useCallback(o=>{const s=o.toString();s?e.update("?"+s):e.update(t)},[e,t]);return[n,r]}const fM=v.createContext({});function Wa(){return v.useContext(fM)}function ile(e,t){return!e.hidden||!e.hidden(t)?e:null}function pi(e){return(e==null?void 0:e.substeps)!==void 0}function ale(e){const{steps:t,onSubmit:n}=e,[r,i]=v.useState(!1),[a,o]=v.useState(null),[s,l]=v.useState({}),[c,u]=v.useState(e.stepDefaults??{}),[d,f]=v.useState({}),[h,g]=v.useState(),[p,y]=v.useState(!1),[x,b]=dM(),S=v.useMemo(()=>ole(t),[t]);v.useEffect(()=>{if(process.env.NODE_ENV==="development")for(const k in e.stepDefaults)t.find(T=>T.id===k)||console.warn(`PageWizardProvider: defaultValue key '${k}' not found in steps.`)},[e.stepDefaults,t]),v.useEffect(()=>{const k=ff(t,s);a||!k.length||(k[0].substeps?o(k[0].substeps[0]):o(k[0]))},[a,t,s]);const w=v.useCallback(async(k={})=>{var P;const T=hM(t,{...s,...k});if(a===null)return Promise.resolve();if(!pi(a)&&a.validate&&await a.validate(k,s),(a==null?void 0:a.id)===((P=T[T.length-1])==null?void 0:P.id)){y(!0);try{await n(s)}catch(D){g(D instanceof Error?D:new Error(Ml("An error occurred.")))}finally{y(!1)}return}const A=T.findIndex(D=>D.id===(a==null?void 0:a.id)),O=pi(T[A+1])?T[A+2]:T[A+1];return b(new URLSearchParams("")),l(D=>({...D,...k})),u(D=>({...D,[a==null?void 0:a.id]:k})),o(O),Promise.resolve()},[a,t,n,b,s,g]),_=v.useCallback(()=>{const k=ff(S,s),T=k.findIndex(A=>A.id===(a==null?void 0:a.id)),j=pi(k[T-1])?k[T-2]:k[T-1];b(new URLSearchParams("")),o(j)},[a==null?void 0:a.id,S,b,s]),E=v.useMemo(()=>({wizardData:s,setWizardData:l,stepData:c,setStepData:u,steps:e.steps,visibleSteps:ff(t,s),visibleStepsFlattened:hM(t,s),activeStep:a,setActiveStep:o,stepError:d,setStepError:f,submitError:h,setSubmitError:g,isToggleExpanded:r,setToggleExpanded:i,onNext:w,onBack:_,isSubmitting:p}),[s,l,c,u,e.steps,t,a,o,d,f,h,g,r,i,w,_,p]);return m.jsx(fM.Provider,{value:E,children:e.children})}function ole(e){return e.reduce((t,n)=>(t.push(n),pi(n)&&t.push(...n.substeps),t),[])}function ff(e,t){return e.filter(n=>ile(n,t))}function hM(e,t){return ff(e,t).reduce((r,i)=>(r.push(i),pi(i)&&r.push(...i.substeps),r),[])}function gM(e){const{t}=De(),{activeStep:n,visibleStepsFlattened:r,setSubmitError:i}=Wa(),a=(n==null?void 0:n.id)===r[r.length-1].id,o=t(a?"Finish":"Next"),s=pi(r[0])?(n==null?void 0:n.id)===r[1].id:(n==null?void 0:n.id)===r[0].id,l=s?"pf-v5-c-button pf-m-disabled":"pf-v5-c-button pf-m-secondary";return m.jsxs("footer",{className:"pf-v5-c-wizard__footer border-top bg-lighten","data-cy":"wizard-footer",children:[n!==null&&"inputs"in n?m.jsx(cx,{style:{minWidth:10},children:o}):m.jsx("button",{"data-cy":"wizard-next",className:"pf-v5-c-button pf-m-primary",type:"submit",onClick:()=>{var c;i(void 0),(c=e.onNext)==null||c.call(e)},children:o}),m.jsx("button",{type:"button","data-cy":"wizard-back",className:l,disabled:s,onClick:()=>{var c;i(void 0),(c=e.onBack)==null||c.call(e)},children:t("Back")}),m.jsx("div",{"data-cy":"wizard-cancel",className:"pf-v5-c-wizard__footer-cancel",children:m.jsx("button",{className:"pf-v5-c-button pf-m-link",type:"button",onClick:e.onCancel,children:t("Cancel")})})]})}function sle({onCancel:e,disableGrid:t,errorAdapter:n,isVertical:r,singleColumn:i}){const a=ht.useNavigate(),{activeStep:o,stepData:s,onNext:l,onBack:c,submitError:u,isSubmitting:d}=Wa(),f=v.useCallback(()=>{e?e():a(-1)},[a,e]);return d?m.jsx(C.Bullseye,{children:m.jsx(C.Spinner,{})}):m.jsxs(eM,{children:[m.jsx(cle,{error:u}),o!==null&&("inputs"in o?m.jsxs(W7,{onSubmit:l,footer:m.jsx(gM,{onBack:c,onCancel:f}),defaultValue:s[o.id],errorAdapter:n,disableGrid:t,isVertical:r,singleColumn:i,isWizard:!0,children:[m.jsx(lle,{}),o.inputs]},o.id):m.jsxs("div",{"data-cy":`wizard-section-${o.id}`,style:{display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden"},children:[m.jsx(C.PageSection,{"aria-label":Ml("Wizard step content"),hasOverflowScroll:!0,isFilled:!0,variant:"light",children:o==null?void 0:o.element}),m.jsx(gM,{onNext:()=>void l({}),onBack:c,onCancel:f})]}))]})}function lle(){const{activeStep:e,setStepError:t}=Wa(),{errors:n}=nx(),r=JSON.stringify(n);return v.useEffect(()=>{Object.keys(n).length===0?t({}):e&&t({[e.id]:n})},[n,e,t,r]),null}function cle(e){const{t}=De(),n=e.error;if(!e.error)return null;if(!(e.error instanceof Error))return typeof e.error=="string"?m.jsx(C.Alert,{variant:"danger",title:e.error}):m.jsx(C.Alert,{variant:"danger",title:t("An error occurred.")});if("message"in e.error&&!n.json)return m.jsx(C.Alert,{variant:"danger",title:e.error.message});if(n.json)return m.jsx(C.Alert,{variant:"danger",title:n.message,isInline:!0,children:Object.values(n.json).map((r,i)=>m.jsx("div",{children:r},i))})}const yi={wizardClose:"pf-v5-c-wizard__close",wizardHeader:"pf-v5-c-wizard__header",wizardTitle:"pf-v5-c-wizard__title",wizardTitleText:"pf-v5-c-wizard__title-text",wizardToggle:"pf-v5-c-wizard__toggle",wizardToggleIcon:"pf-v5-c-wizard__toggle-icon",wizardToggleList:"pf-v5-c-wizard__toggle-list",wizardToggleListItem:"pf-v5-c-wizard__toggle-list-item",wizardToggleNum:"pf-v5-c-wizard__toggle-num"};function qr(...e){const t=[],n={}.hasOwnProperty;return e.filter(Boolean).forEach(r=>{const i=typeof r;if(i==="string"||i==="number")t.push(r);else if(Array.isArray(r)&&r.length){const a=qr(...r);a&&t.push(a)}else if(i==="object")for(const a in r)n.call(r,a)&&r[a]&&t.push(a)}),t.join(" ")}const ule=Ae.div`
519
519
  background-color: var(--pf-v5-global--BackgroundColor--light-100);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "A framework for building applications using PatternFly.",
4
- "version": "2.4.2656",
4
+ "version": "2.4.2657",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",