import{R as g,o as w,p as a,l as x,k as m,j as t,E as P,a9 as i,aJ as o}from"./app-BgLa5dit.js";function y(e){const[u,r]=g.useState(!1),s=w(a.getMasterVideo(e.id)),l=x(),n=m();async function h(){r(!0);const c=()=>l.error(`Something went wrong while deleting <strong>${s.data.name}</strong>. Please try again.`),d=s.data.status===o.Published;try{d&&await n(a.updateVideoStatus(e.id,o.Archived,e.stage));try{await n(a.deleteVideo(e.id,e.stage)),l.success(`Successfully deleted <strong>${s.data.name}</strong>.`),e.closePopup()}catch{c(),d&&await n(a.updateVideoStatus(e.id,o.Published,e.stage)),e.closePopup()}}catch{c(),e.closePopup()}}return t.jsx(P,{title:"Delete video",closePopup:e.closePopup,showLoadingSpinner:!s.data,children:!!s.data&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{children:["Are you sure you want to delete ",t.jsx("strong",{children:s.data.name}),"?"]}),t.jsxs("p",{children:["This will ",t.jsx("strong",{children:"permanently"})," delete the video from ClickView and cannot be undone."]}),t.jsxs(i,{children:[t.jsx(i.Cancel,{onClick:e.closePopup}),t.jsx(i.Submit,{showSpinner:u,onClick:h,variant:"danger",text:"Delete video"})]})]})})}export{y as DeleteVideoView};
//# sourceMappingURL=BRbINHvw.chunk.js.map
