1import{b as S,a2 as B,G as E,r as g,j as e,h as i,N as j,aS as C,H as c,n as w}from"./index-C8XSz261.js";import{A as I}from"./AlertModal-BzxAyYUs.js";import{T as P}from"./TextButton-C-eudnuM.js";import{H as D}from"./HorizontalProgressBar-DxWzBtSE.js";import{u as U,a as N,b as T,c as F}from"./uploadStore-B24H32_A.js";import{F as K}from"./ArrowsPointingInIcon-DtkvFOx8.js";import{F as L}from"./BoltIcon-T2Pr94DT.js";import"./CoreModal-ByS-G2fX.js";import"./render-0HlhCVFK.js";import"./open-closed-cVqbYH_P.js";import"./index-CWWmca4P.js";const Z=()=>{var v;const r=S(),{isWhiteLabel:p}=B(),{isCurrentlySpoofing:d}=E(),l=U(),s=N(),m=T(),a=F(),u=s.length>0,M=u;g.useEffect(()=>{const o=t=>{u&&t.preventDefault()};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}},[u]),g.useEffect(()=>{if(!a){const o=s.find(t=>t.progress===0);o&&l.startUpload(o.key)}},[s,a,l]);const[x,f]=g.useState(null);if(!M)return null;const k=o=>{if(o.progress===1&&o.episodeID){const t=p&&!d?"moments":"start";r(`/${o.feedID}/episode/${o.episodeID}/${t}`)}};return e.jsxs("div",{className:"absolute bottom-0 right-0 w-full border border-shade-700 bg-shade-900 md:bottom-20 md:right-8 md:mb-2 md:w-fit md:rounded-lg",style:{zIndex:60},children:[e.jsx($,{}
1),e.jsxs("div",{className:c("flex flex-col gap-4 rounded-md p-4 shadow-md",m?"hidden":""),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{variant:"h4",className:"text-lg font-bold text-shade-100",children:"Uploads"}),e.jsx(j,{tooltipText:"Minimize Upload Center",tooltipPosition:"left",children:e.jsx(K,{className:"w-4 cursor-pointer text-shade-200/50",onClick:l.minimizeUploadCenter})})]}),e.jsx("div",{className:"flex max-h-[50vh] w-full flex-col divide-y divide-shade-800 overflow-y-auto",children:s.map(o=>{const{key:t,fileName:z,progress:b}=o,A=C(z),y=Math.floor(b*100),h=t===a,n=b===1;return e.jsxs("div",{className:c("flex items-center justify-between gap-8 py-4",!h&&!n&&"opacity-70"),children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{tooltipText:n?"Upload complete":h?"Uploading":"Queued",children:e.jsx("div",{className:c("h-3 w-3 rounded-full",n?"bg-green-500":h?"bg-yellow-500":"bg-shade-400")})}),e.jsx(i,{variant:"p",className:"text-sm font-normal",children:A})]}),y<100&&e.jsx(D,{progress:y,color:"bg-yellow-600"})]})}),n?e.jsx(w,{title:"Create Clips",icon:e.jsx(L,{}),onClick:()=>k(o),isSecondary:!0}):!n&&e.jsx(P,{title:"Cancel",onClick:()=>f(t)})]},t)})}),e.jsx(i,{variant:"p",className:"rounded-md bg-yellow-50 p-2 text-xs text-yellow-700 dark:bg-yellow-700/30 dark:text-yellow-100",children:"Please do not close or refresh tab, uploads will be cancelled"})]}),e.jsx(I,{isOpen:x!==null,closeModal:()=>f(null),modalTitle:"Cancel upload?",modalBody:e.jsxs(i,{variant:"p",children:["Are you sure you want to cancel uploading"," ",e.jsx("span",{className:"font-medium",children:C(((v=s.find(o=>o.key===x))==null?void 0:v.fileName)||"")})," to Momento?"]}),modalButtonSection:e.jsx(w,{title:"Cancel upload",onClick:()=>{l.cancelUpload(String(x)),f(null)},bgColor:"bg-red-600",hoverBgColor:"hover:bg-red-700"}),cancelButtonText:"Never mind"})]})},$=()=>{const r=T(),p=U(),d=N(),l=d.reduce((m,a)=>m+a.progress,0),s=Math.floor(l/d.length*100);return r?e.jsx(j,{tooltipText:"Expand Upload Center",tooltipPosition:"left",children:e.jsx("div",{className:c("flex cursor-pointer items-center justify-center rounded bg-shade-800 p-2 px-4 text-sm text-shade-200",r?"":"hidden"),onClick:p.maximizeUploadCenter,children:e.jsxs(i,{variant:"p",children:["Uploading... ",s,"%"]})})}):null};export{Z as default}; 2//# sourceMappingURL=UploadCenter-CA7CzyRK.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.