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-d6499a22.js";import{R as w}from"./RedirectInProject-0591395a.js";import{S as N}from"./StorageConnectorsForm-8176d809.js";import{g as U,a as G,h as Q}from"./utils-2832fe88.js";import"./Project-92985c5d.js";import"./index-ddf2d065.js";import"./FileUploaderButton-c4f1b533.js";import"./useDownload-7167ff3b.js";import"./useCurrentProject-b23444be.js";import"./useProject-0d0fdeb3.js";import"./PrimaryIconButton-fd23494f.js";import"./zipObj-e651182a.js";import"./dumbPluralize-86a9b9d6.js";import"./git-d9965c1a.js";import"./NoData-789df290.js";import"./index-da50fbe6.js";import"./file-utils-b5704e1c.js";import"./alertManagerConfig.selectors-c57f191b.js";import"./props-01648cd9.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};
