import{u as E,c as y,r as n,p as I,bA as L,bC as k,bD as T,j as o,L as P,ck as F,s as B,bE as M}from"./index-dP1W1_bd.js";import{d as O,e as R,f as $}from"./index-DG59sqU_.js";import{R as w}from"./RedirectInProject-CQTAnW03.js";import{S as N}from"./StorageConnectorsForm-ChdFvoOV.js";import{g as A,a as G,h as Q}from"./utils-3BV3J1PE.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./storage-connector-BuEuJyVA.js";import"./Project-CsYwwOpN.js";import"./ButtonWithRole-CF64B_Or.js";import"./alertManagerConfig.selectors-B_R5cvew.js";import"./__-BIxbRvwe.js";import"./useDownload-C3yCvYJa.js";import"./useProject-CXVt1xnE.js";import"./length-BzpOfCdE.js";import"./complement-D_Q2yZKt.js";import"./index-MHdXqM53.js";import"./FileUploaderButton-frSujVRY.js";import"./uniq-98MdbBvs.js";import"./uniqBy-6mvKp2Ip.js";import"./dumbPluralize-CcxDsNiu.js";import"./CardActionButton-BtCnEqTK.js";import"./utils-UGwNsahk.js";import"./useKeyPress-OcDHupLZ.js";import"./zipObj-DEkcXp9d.js";import"./symmetricDifference-mJT60wVA.js";import"./git-C8OLuEaG.js";import"./NoData-DLZ_8GEo.js";import"./useCopyToClipboard-DTBM3H3Z.js";import"./Anchor-B_lGyhCa.js";import"./flip-etQOAW1x.js";const Ct=()=>{const{connectorName:r,id:s,fsId:e}=E(),[g,i]=y(),[c,{error:f,isLoading:p,isSuccess:S}]=O(),[m,{isLoading:d,isSuccess:C}]=R(),{currentData:t,isFetching:D}=$({pId:+s,fsId:+e,id:r}),b=n.useCallback(async l=>{const{storageConnectorType:u}=l,j=I(L("type",G(u)),A(u))(l);await c({pId:+s,fsId:+e,id:r,data:j}).unwrap()},[c,s,r,e]),x=n.useCallback(()=>m({pId:+s,fsId:+e,id:r}),[m,e,s,r]),a=t==null?void 0:t.storageConnectorType,h=n.useMemo(()=>Q(a)(t),[t,a]);return k(`${T.editStorageConnector} - ${t==null?void 0:t.name}`),D?o.jsx(P,{}):t?S||C?o.jsx(w,{to:B.storageConnector.list,params:{fsId:e}}):o.jsxs(o.Fragment,{children:[o.jsx(N,{error:f,isLoading:p||d,isDisabled:p,onSubmit:b,initialProtocol:a,initialData:h,onDelete:i,isEdit:!0}),o.jsx(M,{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}})]}):o.jsx(F,{})};export{Ct as default};
