import{u as y,w as I,r as n,f as L,b9 as E,bb as T,bc as P,j as e,L as k,bW as w,q as F,be as B}from"./index-CK33qGU_.js";import{d as M,e as O,f as R}from"./index-DnFHOcek.js";import{R as $}from"./RedirectInProject-DugBRkJr.js";import{S as G}from"./StorageConnectorsForm-wdrPaifm.js";import{g as N,a as q,h as Q}from"./utils-LzNCUvhl.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./storage-connector-BuEuJyVA.js";import"./Project-j3KdDsvH.js";import"./ButtonWithRole-NHXEosto.js";import"./alertManagerConfig.selectors-BX2JGYEL.js";import"./__-BIxbRvwe.js";import"./useDownload-hrjXceJg.js";import"./useProject-BzBQtp4J.js";import"./length-fOfC3W0h.js";import"./complement-M2aUPqXA.js";import"./FileUploaderButton-Bppadu35.js";import"./dumbPluralize-CcxDsNiu.js";import"./PrimaryIconButton-DQUEhx3G.js";import"./zipObj-DQ8OxaYj.js";import"./git-C8OLuEaG.js";import"./NoData-CuLyR2Bg.js";import"./useCopyToClipboard-_4vnCVip.js";import"./Anchor-HBBcGDu5.js";import"./flip-BOjSlIdl.js";import"./props-DsctD44O.js";const lt=()=>{const{connectorName:r,id:s,fsId:o}=y(),[g,i]=I(),[c,{error:f,isLoading:p,isSuccess:S}]=M(),[m,{isLoading:d,isSuccess:C}]=O(),{currentData:t,isFetching:b}=R({pId:+s,fsId:+o,id:r}),D=n.useCallback(async l=>{const{storageConnectorType:u}=l,j=L(E("type",q(u)),N(u))(l);await c({pId:+s,fsId:+o,id:r,data:j}).unwrap()},[c,s,r,o]),x=n.useCallback(()=>m({pId:+s,fsId:+o,id:r}),[m,o,s,r]),a=t==null?void 0:t.storageConnectorType,h=n.useMemo(()=>Q(a)(t),[t,a]);return T(`${P.editStorageConnector} - ${t==null?void 0:t.name}`),b?e.jsx(k,{}):t?S||C?e.jsx($,{to:F.storageConnector.list,params:{fsId:o}}):e.jsxs(e.Fragment,{children:[e.jsx(G,{error:f,isLoading:p||d,isDisabled:p,onSubmit:D,initialProtocol:a,initialData:h,onDelete:i,isEdit:!0}),e.jsx(B,{title:`Delete ${t.name}`,secondaryText:"Once you delete a storage connector, there is no going back. Please be certain.",isOpen:g,onClose:i,mainButtonProps:{children:"Delete storage connector",onClick:x,isLoading:d},secondaryButtonProps:{children:"Back",onClick:i}})]}):e.jsx(w,{})};export{lt as default};
