import{H as f,bc as V,b0 as v,az as j,dK as b,aI as c,M as P,A as S,L as E,cj as T,o as k,E as C,p as N,dI as I,r as M,ao as e,aF as w,aP as F,aq as p,bU as u,ba as L,f as D,e as H}from"./app-k0jcl5PQ.js";const O={addVideo(a,t){return{key:"add:video:exchange",url:"{gateway}/v1/users/me/add-videos",data:{libraryId:a,objectId:t},type:f.POST,invalidationKeys:[`videos:${t}:`,"my:videos"]}}},n="shared.addVideo",d=E.encloseNamespace(n);function U(a){var r;const t=V(),m=v(),s=j(b.video(a.id)),[o,h]=c.useState(!1),[x,g]=c.useState(!1);c.useEffect(()=>{!s.data||x||y()},[(r=s.data)==null?void 0:r.id]);async function y(){var l;g(!0);try{const i=(l=s.data.libraries)==null?void 0:l.data.find(A=>A.typeId===P.ExchangeCollection);await m(O.addVideo(i==null?void 0:i.id,s.data.id)),h(!0),t.success({heading:T.Success,message:d("success",{video:s.data.name}),type:S.Success}),k.logUserAction({id:s.data.id,name:s.data.name},{actionType:M.Submit,descriptor:I.AddToWorkspace,location:N.Popup,entity:C.Video})}catch{t.error(d("error")),a.closePopup()}}return e.jsxs(w,{title:d("title"),closePopup:a.closePopup,showLoadingSpinner:!o,children:[o&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mx-auto w-75 mt-1 mb-2",children:e.jsx("img",{src:F.MyVideos.CONFETTI,className:"img-fluid",draggable:!1})}),e.jsx("div",{className:"text-center pb-3",children:e.jsx("h4",{className:"mb-2",children:e.jsx(p,{namespace:n,phrase:"added"})})})]}),e.jsxs(u,{children:[e.jsx(u.Cancel,{text:d("close"),onClick:a.closePopup,variant:"link"}),e.jsx(L,{appLink:{application:H.MY_VIDEOS,action:D.MyVideos.MY_VIDEOS},onClick:a.closePopup,className:"btn btn-dark",children:e.jsx(p,{namespace:n,phrase:"open"})})]})]})}export{U as AddVideoView};
//# sourceMappingURL=cDMTxNK5.chunk.js.map
