import{e8 as u,e1 as k,s as p,k as C,l as $,aT as N,o as f,w as j,j as s,E as w,a9 as l}from"./app-BgLa5dit.js";const D={videos:{texts:e=>e.isBulk?{title:"Bulk delete videos",description:`Are you sure you want to bulk delete <strong>${e.objectCount} videos</strong> from <strong>${e.partnerName}</strong>?`,button:"Delete all",success:`<strong>${e.objectCount} videos</strong> have been successfully removed from the content partner.`,error:"Failed to remove videos from content partner."}:{title:"Delete video",description:`Are you sure you want to delete <strong>${e.objectName}</strong> from the content partner <strong>${e.partnerName}</strong>?`,button:"Delete",success:`<strong>${e.objectName}</strong> has been successfully removed from the content partner <strong>${e.partnerName}</strong>.`,error:"Failed to remove video from content partner."},requests:{getObject:p.video,deleteObjects:u.removeVideosFromPartnerProfile}},series:{texts:e=>e.isBulk?{title:"Bulk delete series",description:`Are you sure you want to bulk delete <strong>${e.objectCount} series</strong> from <strong>${e.partnerName}</strong>?`,button:"Delete all",success:`<strong>${e.objectCount} series</strong> have been successfully removed from the content partner.`,error:"Failed to remove series from content partner."}:{title:"Delete series",description:`Are you sure you want to delete <strong>${e.objectName}</strong> from the content partner <strong>${e.partnerName}</strong>?`,button:"Delete",success:`<strong>${e.objectName}</strong> has been successfully removed from the content partner <strong>${e.partnerName}</strong>.`,error:"Failed to remove series from content partner."},requests:{getObject:k.series,deleteObjects:(e,t)=>u.removeSeriesFromPartnerProfile(e,t[0])}}};function q(e){var g,b;const t=D[e.type],h=C(),i=$(),[v,d]=N.useState(!1),n=e.objectIds.length>1,a=f(u.getContentPartner(e.contentPartnerId)),o=f(!n&&t.requests.getObject(j.first(e.objectIds))),r=t.texts({isBulk:n,objectCount:e.objectIds.length,objectName:(g=o==null?void 0:o.data)==null?void 0:g.name,partnerName:(b=a.data)==null?void 0:b.name});async function y(){d(!0);const x=j.chunk(e.objectIds,25).map(c=>t.requests.deleteObjects(e.contentPartnerId,c));try{await Promise.all(x.map(c=>h(c))),i.success(r.success)}catch{i.error(r.error)}finally{d(!1),e.closePopup()}}const P=n?!a.data:!a.data||!o.data,m=e.type==="series"&&n;return s.jsxs(w,{title:r.title,closePopup:e.closePopup,showLoadingSpinner:P,children:[s.jsx("p",{dangerouslySetInnerHTML:{__html:m?"Bulk deletion of series is not supported at the moment.":r.description}}),s.jsxs(l,{children:[s.jsx(l.Cancel,{variant:"link text-dark",text:"Cancel",onClick:e.closePopup}),s.jsx(l.Submit,{type:"button",variant:"danger",text:r.button,onClick:y,showSpinner:v,disabled:m})]})]})}export{q as ContentPartnerDeleteObjectsView};
//# sourceMappingURL=DSZqI6t-.chunk.js.map
