import{u as I,l as T,ig as E,ih as L,ii as b,r as n,W as P,cT as k,aX as F,aY as $,j as t,a_ as B,ce as M,e as O,a$ as R}from"./index-4a12e52c.js";import{R as w}from"./RedirectInProject-cc1d89e5.js";import{S as N}from"./StorageConnectorsForm-400967fe.js";import{g as U,a as G,h as Q}from"./utils-5c74f234.js";import"./Project-7ea6ff24.js";import"./index-91a459dc.js";import"./FileUploaderButton-546aa096.js";import"./useDownload-e87fcc63.js";import"./useCurrentProject-9bb1c6a4.js";import"./useProject-04893095.js";import"./PrimaryIconButton-0a56fae1.js";import"./zipObj-078ddbe7.js";import"./dumbPluralize-86a9b9d6.js";import"./git-d9965c1a.js";import"./NoData-430a62e8.js";import"./index-1b686e0d.js";import"./file-utils-37d8d953.js";import"./alertManagerConfig.selectors-c57f191b.js";import"./props-d543ba26.js";const ie=()=>{const{connectorName:s,id:r,fsId:o}=I(),[g,a]=T(),[c,{error:S,isLoading:p,isSuccess:f}]=E(),[d,{isLoading:m,isSuccess:C}]=L(),{currentData:e,isFetching:D}=b({pId:+r,fsId:+o,id:s}),h=n.useCallback(async l=>{const{storageConnectorType:u}=l,y=P(k("type",G(u)),U(u))(l);await c({pId:+r,fsId:+o,id:s,data:y}).unwrap()},[c,r,s,o]),x=n.useCallback(()=>d({pId:+r,fsId:+o,id:s}),[d,o,r,s]),i=e==null?void 0:e.storageConnectorType,j=n.useMemo(()=>Q(i)(e),[e,i]);return F(`${$.editStorageConnector} - ${e==null?void 0:e.name}`),D?t.jsx(B,{}):e?f||C?t.jsx(w,{to:O.storageConnector.list,params:{fsId:o}}):t.jsxs(t.Fragment,{children:[t.jsx(N,{error:S,isLoading:p||m,isDisabled:p,onSubmit:h,initialProtocol:i,initialData:j,onDelete:a,isEdit:!0}),t.jsx(R,{title:`Delete ${e.name}`,secondaryText:"Once you delete a storage connector, there is no going back. Please be certain.",isOpen:g,onClose:a,mainButtonProps:{children:"Delete storage connector",onClick:x,isLoading:m},secondaryButtonProps:{children:"Back",onClick:a}})]}):t.jsx(M,{})};export{ie as default};
