import{hh as I,aX as f,az as A,aj as P,aZ as h,S as D,aI as u,v as d,f as o,e as i,g as l}from"./app-k0jcl5PQ.js";import{u as b}from"./DQeiaRoX.chunk.js";function k(a,c,t){const s=I(a&&"combine:uploads:service");return b(()=>a?s==null?void 0:s.getCollection():null,c,t)||[]}function S(a){const{hasPermissions:c}=f(),t=A(P.currentUser()),s=c(h.UploadVideo),n=I(s&&D.CombineUploads);let r=k(s,()=>{var e;t.data&&((e=a==null?void 0:a.onRemove)==null||e.call(a))},[t.data]);r=r==null?void 0:r.filter(e=>a!=null&&a.categoryId?e.categoryId===(a==null?void 0:a.categoryId):!e.categoryId);const g=u.useCallback(e=>{d.trigger({application:i.UPLOAD,action:o.Upload.CANCEL_UPLOAD,args:[e.id],params:{name:e.name,status:e.status}})},[]),m=u.useCallback(e=>{switch(e.status){case l.Errored:if(!e.pendingProcessId)return;n.retryItem(e);return;case l.Processing:d.trigger({application:i.VIDEOS,action:o.Videos.EDIT_VIDEO,args:[e.videoId]});return;case l.Uploading:n.editUpload(e);return}},[]),C=r==null?void 0:r.reduce((e,U)=>(e[U.videoId]=!0,e),{});return{uploadingVideos:r,onClickAlternate:m,onClickDelete:g,processingIds:C}}export{S as u};
//# sourceMappingURL=Cbx9Mhpo.chunk.js.map
