import{u as y,ba as I,w as T,r,x as E,p as P,kk as w,bD as v,kl as N,kG as B,bG as F,bH as G,j as o,L as M,cE as O,bJ as $}from"./index-Cox3ZWL0.js";import{d as z,e as H,f as J}from"./index-DwNWquSM.js";import{D as Q}from"./DataSourceCreate-CdUyXgQn.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./form-_K_-Blw_.js";import"./flip-N5Tfpc8q.js";import"./index-B_EdXPH-.js";import"./sum-vCGMSauX.js";import"./countBy--o8yV8EI.js";import"./FeaturesForm-DNoDFZp2.js";import"./TagsForm-ChKTdobu.js";import"./useUpdateTdOrFvInfoService-aQ3jOLSd.js";import"./index-uwkRD1BL.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-DlTLF62i.js";import"./Project-CBPFwDml.js";import"./alertManagerConfig.selectors-D5v0uPxO.js";import"./defineProperty-Bl0iR0r2.js";import"./HumanizedCronExpression-CCEBWMyY.js";import"./index-CvEisYn5.js";import"./symmetricDifference-DM6mun8f.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-C9cjFU4I.js";import"./AlertForm-BH8pll6k.js";const Ct=()=>{const{connectorName:a,id:i,fsId:e}=y(),d=I(),[f,n]=T(),[m,{error:h,isLoading:l}]=z(),[g,{isLoading:u}]=H(),{currentData:t,isUninitialized:j,isFetching:C}=J({pId:+i,fsId:+e,id:a}),D=r.useCallback(()=>{d(E.project.storageConnector.list,{fsId:e})},[e,d]),k=r.useCallback(async(p,c)=>{const{storageConnectorType:b}=p,S=P(v("type",N(b)),w(b))(p);await m({pId:+i,fsId:+e,id:a,data:S}).unwrap().then(R=>{c==null||c(p)})},[m,i,e,a]),x=r.useCallback(()=>g({pId:+i,fsId:+e,id:a}).unwrap().then(D),[g,i,e,a,D]),s=t==null?void 0:t.storageConnectorType,L=r.useMemo(()=>B(s)(t),[t,s]);return F(`${G.editStorageConnector} - ${t==null?void 0:t.name}`),C&&!t||j?o.jsx(M,{}):!t&&!C?o.jsx(O,{}):o.jsxs(o.Fragment,{children:[o.jsx(Q,{error:h,isSaving:l||u,isDisabled:l,onSubmit:k,initialProtocol:s,initialData:L,onDelete:n,isEdit:!0}),o.jsx($,{title:`Delete ${t==null?void 0:t.name}`,secondaryText:"Once you delete a storage connector, there is no going back. Please be certain.",isOpen:f,onClose:n,mainButtonProps:{children:"Delete",onClick:x,isLoading:u,"data-test":"delete-ds"},secondaryButtonProps:{children:"Back",onClick:n}})]})};export{Ct as default};
