"use strict";exports.id=7665,exports.ids=[7665],exports.modules={73413:(e,a,t)=>{t.d(a,{A:()=>r});var l=t(8732);t(82015);var i=t(55158),s=t(83158),n=t(12697),o=t(10067);function r({user:e}){return(0,l.jsx)(i.Ay,{title:"choose-media-type-popoup",noContainer:!0,wrapperClasses:"items-center",wrapperStyle:{alignItems:"center"},children:(0,l.jsxs)("div",{className:"paper items-center max-w-2xl m-auto z-50 p-4 xl:p-10",children:[(0,l.jsxs)("h4",{className:"m-0 text-center text-lg leading-tight",children:["What kind of Media do you",(0,l.jsx)("br",{}),"want to upload?"]}),(0,l.jsx)("span",{children:"Please Select the media type to upload."}),(0,l.jsxs)("div",{className:"w-full grid grid-cols-1 lg:grid-cols-2 gap-6 items-stretch",children:[(0,l.jsxs)("div",{className:"card cursor-pointer",onClick:a=>{if(e?.verification_status?.toString().match(/1/)){let e=document.getElementById("upload_image_input");e?.click()}else alert("Please Verify to Add Media");setTimeout(()=>{(0,i.fs)()},500)},children:[(0,l.jsx)(s.A,{size:50,className:"text-primary"}),(0,l.jsxs)("div",{className:"content",children:[(0,l.jsx)("span",{className:"title",children:"Images"}),(0,l.jsx)("span",{className:"text-sm",children:"General image formats like JPEG, PNG, SVG, WEBP, etc."})]})]}),(0,l.jsxs)("div",{className:"card cursor-pointer",onClick:a=>{e?.verification_status?.toString().match(/1/)?document.getElementById("upload_file_input")?.click():alert("Please Verify to Add Media"),(0,i.fs)()},children:[(0,l.jsx)(n.A,{size:50,className:"text-secondary"}),(0,l.jsxs)("div",{className:"content",children:[(0,l.jsx)("span",{className:"title",children:"Files"}),(0,l.jsx)("span",{className:"text-sm",children:"Other documents type. Like PDF, XLSX, CSV, etc."})]})]})]}),(0,l.jsx)("div",{className:"w-full grid grid-cols-1 lg:grid-cols-2 gap-6 items-stretch",children:(0,l.jsxs)("div",{className:"card cursor-pointer",onClick:a=>{e?.verification_status?.toString().match(/1/)?document.getElementById("upload_video_input")?.click():alert("Please Verify to Add Media"),(0,i.fs)()},children:[(0,l.jsx)(o.A,{size:55,className:"text-slate-600"}),(0,l.jsxs)("div",{className:"content",children:[(0,l.jsx)("span",{className:"title",children:"Videos"}),(0,l.jsxs)("span",{className:"text-sm",children:["Video Files. ",(0,l.jsx)("b",{children:"MP4"})," for now. These files can be streamed. Max 200mb"]})]})]})})]})})}},2628:(e,a,t)=>{t.d(a,{A:()=>N});var l=t(8732),i=t(82015),s=t.n(i),n=t(63715),o=t(8203),r=t(77627),d=t(32415);function c({folderName:e,folder:a,user:t}){let i=`${a?a+"/":""}${e}`,[c,m]=s().useState(!1);return(0,l.jsxs)("a",{href:`/admin/${t?.id}/media/${i}`,className:"card col items-center justify-center",onClick:e=>{if(e.target.closest("button"))return e.preventDefault()},children:[c&&(0,l.jsx)(d.A,{}),(0,l.jsx)(o.A,{sx:{fontSize:100},className:"opacity-20"}),(0,l.jsx)("span",{className:"absolute top-4 left-4 text-xs bg-slate-200 dark:bg-slate-700 px-2 py-0.5 rounded-full",children:"Folder"}),(0,l.jsx)("span",{className:"",children:e}),(0,l.jsx)("button",{className:"plain-text absolute top-2 right-2",onClick:e=>{window.confirm("Delete this Folder and all its contents?")&&(m(!0),window.confirm("NOTE: this folder and all its contents will be permanently lost. Continue?")?(0,n.A)("/api/deleteMediaFolder",{method:"post",body:{folder:i}},!0).then(e=>{e.success&&window.location.reload()}):m(!1))},children:(0,l.jsx)(r.A,{className:"opacity-30"})})]},e)}var m=t(55158),u=t(62506),p=t(1133),h=t(89095);function f({mediaObject:e,staticHost:a}){let t=e.media_thumbnail_path?e?.private?e.media_thumbnail_url:`${a}${e.media_thumbnail_path}`:e.media_thumbnail_url,i=e.media_path?e?.private?e.media_url:`${a}${e.media_path}`:e.media_url;return(0,l.jsx)(s().Fragment,{children:e.media_type?.match(/file/i)?(0,l.jsxs)("div",{className:"cursor-pointer hover:opacity-80",children:[(0,l.jsx)(h.A,{sx:{fontSize:100},className:"opacity-10"}),(0,l.jsx)("span",{className:"info w-auto small gray absolute top-4 right-4",children:e.media_type.replace(/.*\//,"").toUpperCase()})]}):e.media_type?.match(/video/i)?(0,l.jsx)("video",{src:i,className:"w-full h-60 object-cover",controls:!0,muted:!0,autoPlay:!0,loop:!0}):(0,l.jsx)("img",{src:t,alt:e.media_name,className:"w-full h-60 object-cover bg-slate-200 rounded",onError:a=>{e?.private||(0,n.A)("/api/purgeDb",{method:"post",body:{paradigm:"user_media",payload:e}},!0).then(e=>{e.success?window.location.reload():(console.log(e),console.log(t),console.log(i))})}})})}var x=t(49140);function g({mediaObject:e,staticHost:a}){return(e.media_thumbnail_path?e.media_thumbnail_path:e.media_thumbnail_url,e.media_path?e.media_path:e.media_url,e?.private)?(0,l.jsx)(s().Fragment,{}):(0,l.jsxs)("div",{className:"dropdown-wrapper w-full xl:w-auto",children:[(0,l.jsx)("button",{className:"outlined secondary small-text w-full hidden xl:flex bg-secondary/10",children:"Copy Link"}),(0,l.jsx)("div",{className:"dropdown mobile-transform gap-2 w-full",children:(0,l.jsxs)(u.A,{column:!0,className:"w-full mb-2 xl:mb-0",children:[(0,l.jsx)("button",{className:"gray outlined normal-weight more-padding",onClick:a=>{navigator.clipboard.writeText(e.media_url||"").then(()=>{alert(`Media url ${e.media_url} Copied to clipboard`)})},children:"Copy Full Link"}),!e?.media_type?.match(/file|video/i)&&(0,l.jsx)("button",{className:"gray outlined normal-weight more-padding",onClick:a=>{navigator.clipboard.writeText(e.media_thumbnail_url||"").then(()=>{alert(`Media url ${e.media_thumbnail_url} Copied to clipboard`)})},children:"Copy Thumbnail Link"})]})})]})}var j=t(17855),w=t(46760);function b({mediaObject:e,setLoading:a}){let[t,i]=s().useState(!1);return e?.media_type?.match(/video/i)?null:(0,l.jsx)("button",{className:"light-gray p-2 w-8 h-8 rounded-full absolute top-4 left-4 bg-white"+(e?.private?" ":" text-slate-400 fill-slate-400"),style:{backgroundColor:"white"},onClick:t=>{let l=e.private?"This media is private: Make it public?":"Make this media Private?";window.confirm(l)&&(a(!0),(0,n.A)("/api/media/addPrivateMedia",{method:"post",body:{...e}},!0).then(e=>{e.success?window.location.reload():window.alert("Action Failed!"),setTimeout(()=>{a(!1)},1e3)}).catch(e=>{console.log(e)}))},children:e?.private?(0,l.jsx)(j.A,{size:20,color:"green"}):(0,l.jsx)(w.A,{color:"black",size:20})})}function y({mediaObject:e,setTargetMedia:a,folder:t,staticHost:i}){let[n,o]=s().useState(!!e?.private),[r,c]=s().useState(e);r.media_thumbnail_path?r.media_thumbnail_path:r.media_thumbnail_url;let h=r.media_path?`${i}/${r.media_path}`:r.media_url;return(0,l.jsxs)("div",{className:"media-card card col",onClick:e=>{if(!(e.target.closest("button")||e.target.closest(".button"))){if(r.media_type?.match(/file/i)&&!r.private){window.open(h,"__blank");return}r.media_type?.match(/file/i)&&r.private||(a(r),(0,m.PB)("target-media-popup"))}},onMouseEnter:e=>{e.target.closest(".media-card").style.zIndex="10"},onMouseLeave:e=>{e.target.closest(".media-card").style.zIndex="0"},style:r?.private?{outline:"5px solid var(--sec-color-light)",borderColor:"var(--sec-color-lighter)"}:{},children:[n&&(0,l.jsx)(d.A,{}),(0,l.jsx)(f,{mediaObject:r,staticHost:i}),(0,l.jsxs)("div",{className:"flex-col items-center xl:items-start flex-wrap w-full mt-auto",children:[(0,l.jsx)("span",{className:"w-full",style:{wordBreak:"break-all"},children:r.media_name}),(0,l.jsx)("div",{className:"flex-wrap w-full",children:(0,l.jsxs)(u.A,{className:"flex-wrap w-full items-stretch",children:[(0,l.jsx)("button",{className:"secondary small-text relative w-full xl:w-auto mb-2 xl:mb-0",onClick:e=>{(0,p.A)({mediaObject:r,fileName:h?.match(/[^\/]+$/)?.[0]||"",setLoading:o})},children:(0,l.jsx)("span",{children:"Download"})}),(0,l.jsx)(g,{mediaObject:r,staticHost:i}),(0,l.jsx)(x.A,{mediaObject:r,setLoading:o})]})})]}),(0,l.jsx)(b,{mediaObject:r,setLoading:o})]})}t(99730);var v=t(19196);function N({media:e,setTargetMedia:a,folders:t,folder:i,staticHost:n,user:o}){return(0,l.jsx)(s().Fragment,{children:(0,l.jsxs)("section",{className:"paper overflow-visible",children:[(0,l.jsx)("h2",{className:"text-xl m-0",children:"Media List"}),(0,l.jsxs)("div",{className:"w-full gap-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 items-stretch",children:[t&&t[0]&&t.map(e=>(0,l.jsx)(c,{folder:i,folderName:e,user:o},e)),e&&e[0]&&e.map(e=>(0,l.jsx)(y,{mediaObject:e,setTargetMedia:a,folder:i,staticHost:n},e.id))]}),!e?.[0]&&(0,l.jsx)(_,{})]})})}function _(){return(0,l.jsxs)("div",{className:"button outlined gray dashed w-full p-10 flex-col",onClick:e=>{(0,m.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"text-slate-400",children:"No Media Added."}),(0,l.jsx)(v.A,{color:"inherit",sx:{fontSize:80},className:"opacity-40 text-gray-500"}),(0,l.jsx)("span",{className:"",children:"Add Media"})]})}},30180:(e,a,t)=>{let l;t.d(a,{A:()=>c});var i=t(8732),s=t(82015),n=t.n(s),o=t(63715),r=t(55158),d=t(32415);function c({folder:e}){let[a,t]=n().useState(!1),[s,c]=n().useState(!1);return(0,i.jsxs)(r.Ay,{title:"add-folder-popoup",children:[(0,i.jsx)("h4",{className:"m-0",children:"Add A New Folder"}),(0,i.jsxs)("div",{className:"flex-col w-full relative",children:[a&&(0,i.jsx)(d.A,{}),(0,i.jsxs)("form",{onSubmit:a=>{a.preventDefault(),window.clearTimeout(l),t(!0);let i=a.target;(0,o.A)("/api/addNewMediaFolder",{method:"post",body:{name:(e?`${e}/`:"")+i["new-folder-name"].value}},!0).then(e=>{e.success?window.location.reload():t(!1)})},className:"w-full flex flex-col items-stretch gap-2",children:[s&&(0,i.jsx)("span",{className:"text-xs text-orange-700 bg-orange-100 flex items-center justify-center rounded px-2 py-1",children:"Folder Already Exists. Please Change the name."}),(0,i.jsx)("input",{type:"text",name:"new-folder-name",id:"new-folder-name",placeholder:"New Folder Name",className:"w-full"+(s?" warning":""),onChange:a=>{a.target.value=a.target.value.toLocaleLowerCase().replace(/ /g,"-"),window.clearTimeout(l),l=setTimeout(()=>{(0,o.A)(`/api/checkExistingFolder?name=${a.target.value}${e?"&folder="+e:""}`).then(e=>{a.target.value?.match(/./)&&e?.success?(c(!0),alert("Folder Already Exists")):c(!1)})},500)}}),(0,i.jsx)("button",{children:"Add New Folder"})]})]})]})}},90194:(e,a,t)=>{t.d(a,{A:()=>x});var l=t(8732),i=t(82015),s=t.n(i),n=t(63715),o=t(86152),r=t(55158),d=t(32415),c=t(48557),m=t(43857);function u({mediaObject:e}){let[a,t]=i.useState(!1);return i.useEffect(()=>{e.private=a},[a]),(0,l.jsx)("button",{className:"light-gray p-2 w-8 h-8 rounded-full absolute top-2 left-2 bg-white"+(a?" ":" text-slate-400 fill-slate-400"),style:{backgroundColor:"white"},onClick:e=>{t(e=>!e)},children:a?(0,l.jsx)(m.A,{fontSize:"small",color:"secondary"}):(0,l.jsx)(c.A,{fontSize:"small",className:"fill-inherit text-inherit"})})}function p({imageObject:e,newMedia:a,setNewMedia:t,video:i}){let s=e.imageBase64Full||e.fileBase64Full,n=e.imageName||e.fileName;return(0,l.jsxs)("div",{className:"border border-slate-300 rounded max-h-44 flex-col w-full overflow-hidden h-full bg-slate-200 relative p-2",children:[i?(0,l.jsx)("video",{src:s,className:"w-full h-full object-contain",muted:!0,autoPlay:!0,controls:!0}):(0,l.jsx)("img",{src:s,alt:n,className:"w-full h-full object-contain"}),(0,l.jsx)("input",{type:"text",defaultValue:n,onInput:a=>{let t=a.target.value?.replace(/ /g,"-");e.fileName&&(e.fileName=t),e.imageName&&(e.imageName=t)},className:"absolute bottom-1 text-sm left-2 px-2 py-1",style:{width:"calc(100% - 15px)"}}),(0,l.jsx)("button",{className:"outlined bg-white absolute top-2 right-2 p-1 w-8 h-8 rounded-full",style:{backgroundColor:"white",borderColor:"var(--slate-200)"},onClick:l=>{let i=a.findIndex(a=>a.imageBase64===e.imageBase64||a.fileBase64===e.fileBase64);a.splice(i,1),t([...a])},children:"✖"}),!i&&(0,l.jsx)(u,{mediaObject:e})]})}var h=t(89095);function f({fileObject:e,newFile:a,setNewFile:t}){return(0,l.jsxs)("div",{className:"border border-slate-300 rounded max-h-44 flex-col w-full overflow-hidden h-full bg-slate-200 relative p-2",children:[(0,l.jsx)(h.A,{sx:{fontSize:100},className:"opacity-20"}),(0,l.jsx)("input",{type:"text",defaultValue:e.fileName,onInput:a=>{e.fileName=a.target.value?.replace(/ /g,"-")},className:"absolute bottom-1 text-sm left-2 px-2 py-1",style:{width:"calc(100% - 15px)"}}),(0,l.jsx)("button",{className:"outlined bg-white absolute top-2 right-2 p-1 w-8 h-8 rounded-full",style:{backgroundColor:"white",borderColor:"var(--slate-200)"},onClick:l=>{let i=a.findIndex(a=>a.fileBase64===e.fileBase64);a.splice(i,1),t([...a])},children:"✖"}),(0,l.jsx)(u,{mediaObject:e})]})}function x({newMedia:e,setNewMedia:a,newFile:t,setNewFile:i,newVideo:c,setNewVideo:m,folder:u}){let h=e?.[0]?"images":t?.[0]?"files":"videos",x=h?.match(/image/i)?e:h?.match(/file/i)?t:c,g=h?.match(/image/i)?a:h?.match(/file/i)?i:m,[j,w]=s().useState(!1);return(0,l.jsxs)(r.Ay,{title:"new-media-popup",closePopupDispatch:()=>{a(null),i(null),m(null)},children:[j&&(0,l.jsx)(d.A,{screen:!0}),(0,l.jsx)("h4",{className:"m-0",children:"Upload New Media"}),(0,l.jsx)("div",{className:"grid grid-cols-2 gap-4 w-full",children:x&&x[0]&&x.map((e,a)=>h?.match(/image/i)?(0,l.jsx)(p,{imageObject:e,newMedia:x,setNewMedia:g},a+1):h?.match(/video/i)?(0,l.jsx)(p,{imageObject:e,newMedia:x,setNewMedia:g,video:!0},a+1):(0,l.jsx)(f,{fileObject:e,newFile:x,setNewFile:g},a+1))}),x&&x[0]&&(0,l.jsx)("button",{className:"py-3 w-full relative z-50"+(j?" pointer-events-none opacity-40":""),onClick:e=>{w(!0);let a=h?.match(/image/i)?{type:h,folder:u,media:x.map(e=>({imageBase64:e.imageBase64,imageName:e.imageName,imageSize:e.imageSize,private:e.private}))}:{type:h,folder:u,media:x.map(e=>({fileBase64:e.fileBase64,fileName:e.fileName,fileSize:e.fileSize,fileType:e.fileType,private:e.private,video:!!h?.match(/video/i)}))};(0,n.A)("/api/addUserMedia",{method:"post",body:a},!0).then(e=>{e.success?(0,o.A)().then(()=>{window.location.reload()}):(alert("Image Upload Failed"),console.log(e),setTimeout(()=>{w(!1)},1e3))})},children:"Upload Media"})]})}},70161:(e,a,t)=>{t.d(a,{A:()=>f});var l=t(8732),i=t(82015),s=t.n(i),n=t(63715),o=t(86152),r=t(55158),d=t(32415),c=t(62506),m=t(1133);t(99730);var u=t(41431),p=t(6070),h=t(49140);function f({targetMedia:e,staticHost:a,setTargetMedia:t,media:i}){e?.media_thumbnail_path?e?.media_thumbnail_path:e?.media_thumbnail_url;let f=e?.media_path?`${a}/${e?.media_path}`:e?.media_url,x=!!e?.media_type?.match(/video/i),g=e?i.findIndex(a=>a.id==e.id):null,j="number"==typeof g&&g>=0,w=(()=>{if(!j)return null;let e=i[g+1];return e?e?.media_type?.match(/image/i)?e:i.slice(g+1).find(e=>!!e.media_type?.match(/image/i))||null:null})(),b=(()=>{if(!j)return null;let e=i[g-1];return e?e?.media_type?.match(/image/i)?e:i.slice(0,g-1).findLast(e=>!!e.media_type?.match(/image/i))||null:null})(),[y,v]=s().useState(!!e?.private),[N,_]=s().useState(!1),[A,C]=s().useState(f),k=s().useRef();return(0,l.jsxs)(r.Ay,{title:"target-media-popup",noContainer:!0,fullPage:!0,closePopupDispatch:()=>{_(!1),t(null)},children:[y&&(0,l.jsx)(d.A,{}),!N&&(0,l.jsx)(d.A,{}),e&&(0,l.jsxs)(s().Fragment,{children:[(0,l.jsxs)("div",{className:"self-center h-screen py-4",children:[A?x?(0,l.jsx)("video",{src:A,className:"w-full h-full object-cover",controls:!0,muted:!0,autoPlay:!0,loop:!0,onCanPlay:()=>{_(!0)},style:N?void 0:{display:"none"}}):(0,l.jsx)("img",{src:A,alt:e.media_name,className:"bg-slate-200 rounded w-full h-full object-contain",ref:k,onLoad:e=>{_(!0)},style:N?void 0:{display:"none"}}):(0,l.jsx)(l.Fragment,{}),b&&(0,l.jsx)("div",{className:"absolute left-5 md:left-10 z-[100] cursor-pointer p-5 bg-slate-800/40 rounded-full",onClick:e=>{t(null),t(b)},children:(0,l.jsx)(u.A,{color:"white"})}),w&&(0,l.jsx)("div",{className:"absolute right-5 md:right-10 z-[100] cursor-pointer p-5 bg-slate-800/40 rounded-full",onClick:e=>{t(null),t(w)},children:(0,l.jsx)(p.A,{color:"white"})})]}),(0,l.jsx)("span",{className:"info gray absolute top-5 left-5 w-auto mr-5",style:{backgroundColor:"white"},children:e.media_path?.replace(/.*\//,"")}),(0,l.jsx)("div",{className:"absolute bottom-6 left-6 p-2 bg-white dark:bg-slate-900 rounded z-20 hidden lg:flex flex-col items-stretch",children:(0,l.jsxs)(c.A,{column:!0,children:[(0,l.jsx)(h.F,{mediaObject:e,setLoading:v}),(0,l.jsx)("button",{className:"outlined secondary more-padding",onClick:a=>{(0,m.A)({mediaObject:e,fileName:e.media_url?.match(/[^\/]+$/)?.[0]||"",setLoading:v})},children:"Download"}),(0,l.jsx)("button",{onClick:a=>{window.confirm("Delete this media?")&&(0,n.A)("/api/deleteUserMedia",{method:"post",body:e},!0).then(e=>{e.success?(0,o.A)().then(()=>{window.location.reload()}):alert("Media deletion Failed! Please try again.")})},className:"more-padding",children:"Delete"}),(0,l.jsx)("button",{className:"outlined gray w-full bg-white more-padding",onClick:a=>{navigator.clipboard.writeText(e.media_url||"").then(()=>{alert(`Media url ${e.media_url} Copied to clipboard`)})},children:"Copy Full Image Link"}),(0,l.jsx)("button",{className:"outlined gray w-full more-padding",onClick:a=>{navigator.clipboard.writeText(e.media_thumbnail_url||"").then(()=>{alert(`Media url ${e.media_thumbnail_url} Copied to clipboard`)})},style:{borderTop:"1px solid #0b8862"},children:"Copy Image Thumbnail Link"})]})})]})]})}},49140:(e,a,t)=>{t.d(a,{A:()=>o,F:()=>r});var l=t(8732);t(82015);var i=t(63715),s=t(86152),n=t(62506);function o({mediaObject:e,setLoading:a}){return(0,l.jsxs)("div",{className:"dropdown-wrapper w-full xl:w-auto",children:[(0,l.jsx)("button",{className:"outlined gray small-text hidden xl:flex",children:"More"}),(0,l.jsx)("div",{className:"dropdown mobile-transform gap-2 w-full",children:(0,l.jsxs)(n.A,{column:!0,className:"w-full mb-2 xl:mb-0",children:[(0,l.jsx)(r,{mediaObject:e,setLoading:a}),(0,l.jsx)("button",{className:"outlined gray normal-weight more-padding w-full xl:w-auto",onClick:a=>{window.confirm("Delete this media?")&&(0,i.A)("/api/deleteUserMedia",{method:"post",body:e},!0).then(e=>{e.success?(0,s.A)().then(()=>{window.location.reload()}):alert("Media deletion Failed! Please try again.")})},children:"Delete"})]})})]})}function r({mediaObject:e,setLoading:a}){return(0,l.jsx)("button",{onClick:t=>{let l=window.prompt("Rename media",e.media_name);l&&window.confirm(`Rename "${e.media_name}" to "${l}"`)&&(a(!0),(0,i.A)("/api/renameMedia",{method:"post",body:{mediaObject:e,newName:l.replace(/ /g,"-"),newThumbnailName:l.replace(/ /g,"-")+"_thumbnail"}},!0).then(e=>{e.success?window.location.reload():(window.alert(e.msg),setTimeout(()=>{a(!1)},1e3))}))},className:"outlined gray normal-weight more-padding",children:"Rename"})}},55158:(e,a,t)=>{t.d(a,{Ay:()=>o,PB:()=>r,fs:()=>d});var l=t(8732),i=t(58150),s=t(82015),n=t.n(s);function o({children:e,title:a,data:t,fullPage:s,wrapperClasses:o,closePopupDispatch:r,wrapperStyle:c,noContainer:m}){return s?(0,l.jsxs)("div",{className:"popup-bg overflow-hidden "+(o||""),"data-popupid":a||null,style:c,children:[m?(0,l.jsx)(n().Fragment,{children:e}):(0,l.jsx)("div",{className:"relative w-full h-full z-50","data-data":t?JSON.stringify(t):"",children:e}),(0,l.jsx)("button",{className:"popup-cancel-button fixed outlined gray",onClick:e=>{d(),r&&r()},children:(0,l.jsx)(i.A,{color:"white",size:20})}),(0,l.jsx)("div",{className:"popup-canceller",onClick:e=>{d(),r&&r()}})]}):(0,l.jsxs)("div",{className:"popup-bg","data-popupid":a||null,children:[m?(0,l.jsx)(n().Fragment,{children:e}):(0,l.jsxs)("div",{className:"popup-content-container minimal-scrollbars","data-data":t?JSON.stringify(t):"",children:[e,(0,l.jsx)("button",{className:"outlined gray popup-cancel-button",onClick:e=>{d(),r&&r()},children:(0,l.jsx)("span",{className:"font-normal",children:"✖"})})]}),m&&(0,l.jsx)("button",{className:"gray popup-cancel-button",onClick:e=>{d(),r&&r()},children:(0,l.jsx)("span",{className:"font-normal",children:"✖"})}),(0,l.jsx)("div",{className:"popup-canceller",onClick:e=>{d(),r&&r()}})]})}function r(e,a){let t=document.querySelector(`[data-popupid='${e}']`);t&&(t.style.display="flex",a&&a(t))}function d(e){document.querySelectorAll("[data-popupid]").forEach(e=>{e.style.display="none"}),e&&e()}},31700:(e,a,t)=>{t.d(a,{A:()=>s});var l=t(8732);t(82015);var i=t(83147);function s({setNewFile:e,setLoading:a}){return(0,l.jsx)("div",{children:(0,l.jsx)("input",{type:"file",name:"upload_file_input",id:"upload_file_input",className:"hidden",accept:".xlsx,.pdf,.csv,.json",multiple:!0,onChange:async t=>{a&&a(!0);let l=[],s=t.target.files;if(s?.length){for(let e=0;e{a&&a(!1)},200)}else window.alert("No Files selected")}})})}},83531:(e,a,t)=>{t.d(a,{A:()=>s});var l=t(8732);t(82015);var i=t(79100);function s({setNewMedia:e,setLoading:a}){return(0,l.jsx)("div",{children:(0,l.jsx)("input",{type:"file",name:"upload_image_input",id:"upload_image_input",className:"hidden",accept:"image/*",multiple:!0,onChange:async t=>{a&&a(!0);let l=[],s=t.target.files;if(s?.length){for(let e=0;e{a&&a(!1)},200)}else window.alert("No Files selected")}})})}},65693:(e,a,t)=>{t.d(a,{A:()=>s});var l=t(8732);t(82015);var i=t(83147);function s({setNewVideo:e,setLoading:a}){return(0,l.jsx)("div",{children:(0,l.jsx)("input",{type:"file",name:"upload_video_input",id:"upload_video_input",className:"hidden",accept:".mp4",multiple:!0,onChange:async t=>{a&&a(!0);let l=[],s=t.target.files;if(s?.length){for(let e=0;e{a&&a(!1)},200)}else window.alert("No Videos selected")}})})}},24671:(e,a,t)=>{t.d(a,{A:()=>i});var l=t(8732);function i(e){return(0,l.jsxs)("a",{href:"/email-verification",className:"card w-full items-center justify-center py-4 gap-2",children:[(0,l.jsx)("img",{src:"/images/warning.png",alt:"Down Arrow",width:25,className:""}),(0,l.jsx)("span",{children:"Your Account is not verified. Please verify your account."})]})}t(82015)},1133:(e,a,t)=>{t.d(a,{A:()=>i});var l=t(99730);async function i({mediaObject:e,fileName:a,setLoading:t}){let i;t&&t(!0);let s=!!(e?.private||e?.media_url?.match(/^\@/));i=s?await (0,l.A)({url:e.media_url||""}):await fetch("/api/fetch-media?url="+e.media_url);let n=s?i:await i.blob(),o=s?i:URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=a,r.style.display="none",document.body.appendChild(r),r.click(),URL.revokeObjectURL(o),document.body.removeChild(r),setTimeout(()=>{t&&t(!1)},500)}},99730:(e,a,t)=>{t.d(a,{A:()=>l});async function l({url:e}){return new Promise((a,t)=>{fetch("/api/media/getPrivateMedia",{method:"POST",body:JSON.stringify({path:e}),headers:{"x-csrf-auth":localStorage.getItem("csrf")}}).then(e=>e.blob()).then(e=>{a(URL.createObjectURL(e))})})}},79100:(e,a,t)=>{t.d(a,{A:()=>l});async function l({imageInputFile:e,maxWidth:a}){let t,l,i=document.querySelector("[data-imagepreview='image']"),s=e.name.replace(/\..*/,""),n=document.createElement("canvas"),o=e.type,r=a||null,d=URL.createObjectURL(e),c=new Image;return c.src=d,t=await new Promise((e,a)=>{c.onerror=function(){URL.revokeObjectURL(this.src),console.log("Cannot load image")},c.onload=function(){if(URL.revokeObjectURL(this.src),r){let e=r/c.naturalWidth;n.width=c.naturalWidth{e.src=t}),e(t)}}),l=await new Promise((e,a)=>{n.toBlob(a=>{e(a?.size)},o,.95)}),{imageBase64:t.replace(/.*?base64,/,""),imageBase64Full:t,imageName:s,imageSize:l}}},83147:(e,a,t)=>{t.d(a,{A:()=>l});async function l({inputFile:e}){try{let a=e.name.replace(/\..*/,""),t=await new Promise((a,t)=>{var l=new FileReader;l.readAsDataURL(e),l.onload=function(){a(l.result)},l.onerror=function(e){console.log("Error: ",e.message)}});return{fileBase64:t.replace(/.*?base64,/,""),fileBase64Full:t,fileName:a,fileSize:e.size,fileType:e.type}}catch(a){return console.log("Image Processing Error! =>",a.message),{fileBase64:null,fileBase64Full:null,fileName:e.name,fileSize:null,fileType:null}}}}};