"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5311],{5311:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});var l=n(65043),s=n(89923),i=n(56629),a=n(53518),r=n(64159),o=n(21383),c=n(12848),d=n(77403),u=n(70579);const x=e=>{let{closeVersioningModalAndRefresh:t,modalOpen:n,selectedBucket:x,versioningInfo:h={},objectLockingEnabled:g}=e;const p=(0,o.jL)(),[f,m]=(0,l.useState)(!1),[b,j]=(0,l.useState)("Enabled"===(null===h||void 0===h?void 0:h.status)),[v,k]=(0,l.useState)(!(null===h||void 0===h||!h.excludeFolders)),[w,C]=(0,l.useState)((e=>{const t=null===e||void 0===e?void 0:e.excludedPrefixes;return t?t.map((e=>e.prefix)).join(","):""})(h));return(0,u.jsx)(s.ngX,{onClose:()=>t(!1),open:n,title:"Versioning on Bucket",children:(0,u.jsxs)(s.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,u.jsx)(s.dOG,{id:"activateVersioning",label:"Versioning Status",checked:b,onChange:e=>{j(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),b&&!g&&(0,u.jsxs)(l.Fragment,{children:[(0,u.jsx)(s.dOG,{id:"excludeFolders",label:"Exclude Folders",checked:v,onChange:e=>{k(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),(0,u.jsx)(c.A,{elements:w,label:"Excluded Prefixes",name:"excludedPrefixes",onChange:e=>{let t="";t=Array.isArray(e)?e.join(","):e,C(t)},withBorder:!0})]}),(0,u.jsxs)(s.azJ,{sx:d.Uz.modalButtonBar,children:[(0,u.jsx)(s.$nd,{id:"clear",type:"button",variant:"regular",color:"primary",onClick:()=>{C(""),k(!1),j(!1)},label:"Clear"}),(0,u.jsx)(s.$nd,{type:"submit",variant:"callAction",onClick:()=>{f||(m(!0),i.F.buckets.setBucketVersioning(x,{enabled:b,excludeFolders:!!b&&v,excludePrefixes:b?w.split(",").filter((e=>""!==e.trim())):[]}).then((()=>{m(!1),t(!0)})).catch((e=>{m(!1),p((0,r.C9)((0,a.S)(e.error)))})))},id:"saveTag",label:"Save"})]})]})})}},12848:(e,t,n)=>{n.d(t,{A:()=>o});var l=n(65043),s=n(33097),i=n.n(s),a=n(89923),r=n(70579);const o=e=>{let{elements:t,name:n,label:s,tooltip:o="",commonPlaceholder:c="",onChange:d,withBorder:u=!1}=e;const[x,h]=(0,l.useState)([""]),g=(0,l.createRef)();(0,l.useEffect)((()=>{if(1===x.length&&""===x[0]&&t&&""!==t){const e=t.split(",");e.push(""),h(e)}}),[t,x]),(0,l.useEffect)((()=>{if(x.length>1){const e=g.current;e&&e.scrollIntoView(!1)}}),[x,g]);const p=(0,l.useCallback)((e=>{d(e)}),[d]),f=(0,l.useRef)(!0);(0,l.useEffect)((()=>{if(f.current)return void(f.current=!1);const e=x.filter((e=>""!==e.trim())).join(",");p(e)}),[x]);const m=e=>{e.persist();let t=[...x];const n=i()(e.target,"dataset.index","0");t[parseInt(n)]=e.target.value,h(t)},b=x.map(((e,t)=>(0,r.jsx)(a.cl_,{id:`${n}-${t.toString()}`,label:"",name:`${n}-${t.toString()}`,value:x[t],onChange:m,index:t,placeholder:c,overlayIcon:t===x.length-1?(0,r.jsx)(a.REV,{}):null,overlayAction:()=>{(e=>{if(""!==e[e.length-1].trim()){const t=[...e];t.push(""),h(t)}})(x)}},`csv-multi-${n}-${t.toString()}`)));return(0,r.jsx)(l.Fragment,{children:(0,r.jsxs)(a.azJ,{sx:{display:"flex"},className:"inputItem",children:[(0,r.jsxs)(a.l1Y,{sx:{alignItems:"flex-start"},children:[(0,r.jsx)("span",{children:s}),""!==o&&(0,r.jsx)(a.azJ,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,r.jsx)(a.m_M,{tooltip:o,placement:"top",children:(0,r.jsx)(a.azJ,{className:o,children:(0,r.jsx)(a.NTw,{})})})})]}),(0,r.jsxs)(a.azJ,{withBorders:u,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[b,(0,r.jsx)("div",{ref:g})]})]})})}}}]);
//# sourceMappingURL=5311.33b9cf56.chunk.js.map