dsql-admin/dsql-app/.local_dist/static/chunks/4750-16db76b374e35273.js
Benjamin Toby 7a06e83a46 Updates
2024-12-08 20:56:57 +01:00

1 line
33 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4750],{65001:(e,l,a)=>{a.d(l,{A:()=>r});var t=a(74848);a(96540);var i=a(45165),o=a(1915),n=a(95737);let s=(0,n.A)("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]),d=(0,n.A)("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);function r(e){let{user:l}=e;return(0,t.jsx)(i.Ay,{title:"choose-media-type-popoup",noContainer:!0,wrapperClasses:"items-center",wrapperStyle:{alignItems:"center"},children:(0,t.jsxs)("div",{className:"paper items-center max-w-2xl m-auto z-50 p-4 xl:p-10",children:[(0,t.jsxs)("h4",{className:"m-0 text-center text-lg leading-tight",children:["What kind of Media do you",(0,t.jsx)("br",{}),"want to upload?"]}),(0,t.jsx)("span",{children:"Please Select the media type to upload."}),(0,t.jsxs)("div",{className:"w-full grid grid-cols-1 lg:grid-cols-2 gap-6 items-stretch",children:[(0,t.jsxs)("div",{className:"card cursor-pointer",onClick:e=>{var a;if(null==l?void 0:null===(a=l.verification_status)||void 0===a?void 0:a.toString().match(/1/)){let e=document.getElementById("upload_image_input");null==e||e.click()}else alert("Please Verify to Add Media");setTimeout(()=>{(0,i.fs)()},500)},children:[(0,t.jsx)(o.A,{size:50,className:"text-primary"}),(0,t.jsxs)("div",{className:"content",children:[(0,t.jsx)("span",{className:"title",children:"Images"}),(0,t.jsx)("span",{className:"text-sm",children:"General image formats like JPEG, PNG, SVG, WEBP, etc."})]})]}),(0,t.jsxs)("div",{className:"card cursor-pointer",onClick:e=>{var a,t;(null==l?void 0:null===(a=l.verification_status)||void 0===a?void 0:a.toString().match(/1/))?null===(t=document.getElementById("upload_file_input"))||void 0===t||t.click():alert("Please Verify to Add Media"),(0,i.fs)()},children:[(0,t.jsx)(s,{size:50,className:"text-secondary"}),(0,t.jsxs)("div",{className:"content",children:[(0,t.jsx)("span",{className:"title",children:"Files"}),(0,t.jsx)("span",{className:"text-sm",children:"Other documents type. Like PDF, XLSX, CSV, etc."})]})]})]}),(0,t.jsx)("div",{className:"w-full grid grid-cols-1 lg:grid-cols-2 gap-6 items-stretch",children:(0,t.jsxs)("div",{className:"card cursor-pointer",onClick:e=>{var a,t;(null==l?void 0:null===(a=l.verification_status)||void 0===a?void 0:a.toString().match(/1/))?null===(t=document.getElementById("upload_video_input"))||void 0===t||t.click():alert("Please Verify to Add Media"),(0,i.fs)()},children:[(0,t.jsx)(d,{size:55,className:"text-slate-600"}),(0,t.jsxs)("div",{className:"content",children:[(0,t.jsx)("span",{className:"title",children:"Videos"}),(0,t.jsxs)("span",{className:"text-sm",children:["Video Files. ",(0,t.jsx)("b",{children:"MP4"})," for now. These files can be streamed. Max 200mb"]})]})]})})]})})}},53301:(e,l,a)=>{a.d(l,{A:()=>A});var t=a(74848),i=a(96540),o=a(23698),n=a(96228),s=a(2436),d=a(620);function r(e){let{folderName:l,folder:a,user:r}=e,c="".concat(a?a+"/":"").concat(l),[u,m]=i.useState(!1);return(0,t.jsxs)("a",{href:"/admin/".concat(null==r?void 0:r.id,"/media/").concat(c),className:"card col items-center justify-center",onClick:e=>{if(e.target.closest("button"))return e.preventDefault()},children:[u&&(0,t.jsx)(d.A,{}),(0,t.jsx)(n.A,{sx:{fontSize:100},className:"opacity-20"}),(0,t.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,t.jsx)("span",{className:"",children:l}),(0,t.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,o.A)("/api/deleteMediaFolder",{method:"post",body:{folder:c}},!0).then(e=>{e.success&&window.location.reload()}):m(!1))},children:(0,t.jsx)(s.A,{className:"opacity-30"})})]},l)}var c=a(45165),u=a(60557),m=a(29084),h=a(3260);function p(e){var l,a;let{mediaObject:n,staticHost:s}=e,d=n.media_thumbnail_path?(null==n?void 0:n.private)?n.media_thumbnail_url:"".concat(s).concat(n.media_thumbnail_path):n.media_thumbnail_url,r=n.media_path?(null==n?void 0:n.private)?n.media_url:"".concat(s).concat(n.media_path):n.media_url;return(0,t.jsx)(i.Fragment,{children:(null===(l=n.media_type)||void 0===l?void 0:l.match(/file/i))?(0,t.jsxs)("div",{className:"cursor-pointer hover:opacity-80",children:[(0,t.jsx)(h.A,{sx:{fontSize:100},className:"opacity-10"}),(0,t.jsx)("span",{className:"info w-auto small gray absolute top-4 right-4",children:n.media_type.replace(/.*\//,"").toUpperCase()})]}):(null===(a=n.media_type)||void 0===a?void 0:a.match(/video/i))?(0,t.jsx)("video",{src:r,className:"w-full h-60 object-cover",controls:!0,muted:!0,autoPlay:!0,loop:!0}):(0,t.jsx)("img",{src:d,alt:n.media_name,className:"w-full h-60 object-cover bg-slate-200 rounded",onError:e=>{null!=n&&n.private||(0,o.A)("/api/purgeDb",{method:"post",body:{paradigm:"user_media",payload:n}},!0).then(e=>{e.success?window.location.reload():(console.log(e),console.log(d),console.log(r))})}})})}var v=a(98183);function f(e){var l;let{mediaObject:a,staticHost:o}=e;return(a.media_thumbnail_path?"".concat(o,"/").concat(a.media_thumbnail_path):a.media_thumbnail_url,a.media_path?"".concat(o,"/").concat(a.media_path):a.media_url,null==a?void 0:a.private)?(0,t.jsx)(i.Fragment,{}):(0,t.jsxs)("div",{className:"dropdown-wrapper w-full xl:w-auto",children:[(0,t.jsx)("button",{className:"outlined secondary small-text w-full hidden xl:flex bg-secondary/10",children:"Copy Link"}),(0,t.jsx)("div",{className:"dropdown mobile-transform gap-2 w-full",children:(0,t.jsxs)(u.A,{column:!0,className:"w-full mb-2 xl:mb-0",children:[(0,t.jsx)("button",{className:"gray outlined normal-weight more-padding",onClick:e=>{navigator.clipboard.writeText(a.media_url||"").then(()=>{alert("Media url ".concat(a.media_url," Copied to clipboard"))})},children:"Copy Full Link"}),!(null==a?void 0:null===(l=a.media_type)||void 0===l?void 0:l.match(/file|video/i))&&(0,t.jsx)("button",{className:"gray outlined normal-weight more-padding",onClick:e=>{navigator.clipboard.writeText(a.media_thumbnail_url||"").then(()=>{alert("Media url ".concat(a.media_thumbnail_url," Copied to clipboard"))})},children:"Copy Thumbnail Link"})]})})]})}var x=a(95737);let g=(0,x.A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),y=(0,x.A)("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);function w(e){var l;let{mediaObject:a,setLoading:n}=e,[s,d]=i.useState(!1);return(null==a?void 0:null===(l=a.media_type)||void 0===l?void 0:l.match(/video/i))?null:(0,t.jsx)("button",{className:"light-gray p-2 w-8 h-8 rounded-full absolute top-4 left-4 bg-white"+((null==a?void 0:a.private)?" ":" text-slate-400 fill-slate-400"),style:{backgroundColor:"white"},onClick:e=>{let l=a.private?"This media is private: Make it public?":"Make this media Private?";window.confirm(l)&&(n(!0),(0,o.A)("/api/media/addPrivateMedia",{method:"post",body:{...a}},!0).then(e=>{e.success?window.location.reload():window.alert("Action Failed!"),setTimeout(()=>{n(!1)},1e3)}).catch(e=>{console.log(e)}))},children:(null==a?void 0:a.private)?(0,t.jsx)(g,{size:20,color:"green"}):(0,t.jsx)(y,{color:"black",size:20})})}var j=a(20993);function b(e){let{mediaObject:l,setTargetMedia:a,folder:o,staticHost:n}=e,[s,r]=i.useState(null!=l&&!!l.private),[h,x]=i.useState(l);i.useEffect(()=>{var e;(null==l?void 0:l.private)&&l.media_thumbnail_url&&!(null===(e=h.media_type)||void 0===e?void 0:e.match(/file/i))?(0,j.A)({url:l.media_thumbnail_url}).then(e=>{x({...l,media_thumbnail_url:e}),r(!1)}).catch(e=>{console.log(e.message)}):s&&r(!1)},[]),h.media_thumbnail_path?"".concat(n,"/").concat(h.media_thumbnail_path):h.media_thumbnail_url;let g=h.media_path?"".concat(n,"/").concat(h.media_path):h.media_url;return(0,t.jsxs)("div",{className:"media-card card col",onClick:e=>{var l,t;if(!(e.target.closest("button")||e.target.closest(".button"))){if((null===(l=h.media_type)||void 0===l?void 0:l.match(/file/i))&&!h.private){window.open(g,"__blank");return}if((null===(t=h.media_type)||void 0===t?void 0:t.match(/file/i))&&h.private)return;a(h),(0,c.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:(null==h?void 0:h.private)?{outline:"5px solid var(--sec-color-light)",borderColor:"var(--sec-color-lighter)"}:{},children:[s&&(0,t.jsx)(d.A,{}),(0,t.jsx)(p,{mediaObject:h,staticHost:n}),(0,t.jsxs)("div",{className:"flex-col items-center xl:items-start flex-wrap w-full mt-auto",children:[(0,t.jsx)("span",{className:"w-full",style:{wordBreak:"break-all"},children:h.media_name}),(0,t.jsx)("div",{className:"flex-wrap w-full",children:(0,t.jsxs)(u.A,{className:"flex-wrap w-full items-stretch",children:[(0,t.jsx)("button",{className:"secondary small-text relative w-full xl:w-auto mb-2 xl:mb-0",onClick:e=>{var l;(0,m.A)({mediaObject:h,fileName:(null==g?void 0:null===(l=g.match(/[^\/]+$/))||void 0===l?void 0:l[0])||"",setLoading:r})},children:(0,t.jsx)("span",{children:"Download"})}),(0,t.jsx)(f,{mediaObject:h,staticHost:n}),(0,t.jsx)(v.A,{mediaObject:h,setLoading:r})]})})]}),(0,t.jsx)(w,{mediaObject:h,setLoading:r})]})}var N=a(64401);function A(e){let{media:l,setTargetMedia:a,folders:o,folder:n,staticHost:s,user:d}=e;return(0,t.jsx)(i.Fragment,{children:(0,t.jsxs)("section",{className:"paper overflow-visible",children:[(0,t.jsx)("h2",{className:"text-xl m-0",children:"Media List"}),(0,t.jsxs)("div",{className:"w-full gap-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 items-stretch",children:[o&&o[0]&&o.map(e=>(0,t.jsx)(r,{folder:n,folderName:e,user:d},e)),l&&l[0]&&l.map(e=>(0,t.jsx)(b,{mediaObject:e,setTargetMedia:a,folder:n,staticHost:s},e.id))]}),!(null==l?void 0:l[0])&&(0,t.jsx)(k,{})]})})}function k(){return(0,t.jsxs)("div",{className:"button outlined gray dashed w-full p-10 flex-col",onClick:e=>{(0,c.PB)("choose-media-type-popoup")},children:[(0,t.jsx)("span",{className:"text-slate-400",children:"No Media Added."}),(0,t.jsx)(N.A,{color:"inherit",sx:{fontSize:80},className:"opacity-40 text-gray-500"}),(0,t.jsx)("span",{className:"",children:"Add Media"})]})}},5531:(e,l,a)=>{let t;a.d(l,{A:()=>r});var i=a(74848),o=a(96540),n=a(23698),s=a(45165),d=a(620);function r(e){let{folder:l}=e,[a,r]=o.useState(!1),[c,u]=o.useState(!1);return(0,i.jsxs)(s.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:e=>{e.preventDefault(),window.clearTimeout(t),r(!0);let a=e.target;(0,n.A)("/api/addNewMediaFolder",{method:"post",body:{name:(l?"".concat(l,"/"):"")+a["new-folder-name"].value}},!0).then(e=>{e.success?window.location.reload():r(!1)})},className:"w-full flex flex-col items-stretch gap-2",children:[c&&(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"+(c?" warning":""),onChange:e=>{e.target.value=e.target.value.toLocaleLowerCase().replace(/ /g,"-"),window.clearTimeout(t),t=setTimeout(()=>{(0,n.A)("/api/checkExistingFolder?name=".concat(e.target.value).concat(l?"&folder="+l:"")).then(l=>{var a;(null===(a=e.target.value)||void 0===a?void 0:a.match(/./))&&(null==l?void 0:l.success)?(u(!0),alert("Folder Already Exists")):u(!1)})},500)}}),(0,i.jsx)("button",{children:"Add New Folder"})]})]})]})}},45332:(e,l,a)=>{a.d(l,{A:()=>v});var t=a(74848),i=a(96540),o=a(23698),n=a(17531),s=a(45165),d=a(620),r=a(84672),c=a(71070);function u(e){let{mediaObject:l}=e,[a,o]=i.useState(!1);return i.useEffect(()=>{l.private=a},[a]),(0,t.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=>{o(e=>!e)},children:a?(0,t.jsx)(c.A,{fontSize:"small",color:"secondary"}):(0,t.jsx)(r.A,{fontSize:"small",className:"fill-inherit text-inherit"})})}function m(e){let{imageObject:l,newMedia:a,setNewMedia:i,video:o}=e,n=l.imageBase64Full||l.fileBase64Full,s=l.imageName||l.fileName;return(0,t.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:[o?(0,t.jsx)("video",{src:n,className:"w-full h-full object-contain",muted:!0,autoPlay:!0,controls:!0}):(0,t.jsx)("img",{src:n,alt:s,className:"w-full h-full object-contain"}),(0,t.jsx)("input",{type:"text",defaultValue:s,onInput:e=>{var a;let t=null===(a=e.target.value)||void 0===a?void 0:a.replace(/ /g,"-");l.fileName&&(l.fileName=t),l.imageName&&(l.imageName=t)},className:"absolute bottom-1 text-sm left-2 px-2 py-1",style:{width:"calc(100% - 15px)"}}),(0,t.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:e=>{let t=a.findIndex(e=>e.imageBase64===l.imageBase64||e.fileBase64===l.fileBase64);a.splice(t,1),i([...a])},children:"✖"}),!o&&(0,t.jsx)(u,{mediaObject:l})]})}var h=a(3260);function p(e){let{fileObject:l,newFile:a,setNewFile:i}=e;return(0,t.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,t.jsx)(h.A,{sx:{fontSize:100},className:"opacity-20"}),(0,t.jsx)("input",{type:"text",defaultValue:l.fileName,onInput:e=>{var a;l.fileName=null===(a=e.target.value)||void 0===a?void 0:a.replace(/ /g,"-")},className:"absolute bottom-1 text-sm left-2 px-2 py-1",style:{width:"calc(100% - 15px)"}}),(0,t.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:e=>{let t=a.findIndex(e=>e.fileBase64===l.fileBase64);a.splice(t,1),i([...a])},children:"✖"}),(0,t.jsx)(u,{mediaObject:l})]})}function v(e){let{newMedia:l,setNewMedia:a,newFile:r,setNewFile:c,newVideo:u,setNewVideo:h,folder:v}=e,f=(null==l?void 0:l[0])?"images":(null==r?void 0:r[0])?"files":"videos",x=(null==f?void 0:f.match(/image/i))?l:(null==f?void 0:f.match(/file/i))?r:u,g=(null==f?void 0:f.match(/image/i))?a:(null==f?void 0:f.match(/file/i))?c:h,[y,w]=i.useState(!1);return i.useEffect(()=>{x&&x[0]&&(0,s.PB)("new-media-popup")},[l,r,u]),(0,t.jsxs)(s.Ay,{title:"new-media-popup",closePopupDispatch:()=>{a(null),c(null),h(null)},children:[y&&(0,t.jsx)(d.A,{screen:!0}),(0,t.jsx)("h4",{className:"m-0",children:"Upload New Media"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-4 w-full",children:x&&x[0]&&x.map((e,l)=>(null==f?void 0:f.match(/image/i))?(0,t.jsx)(m,{imageObject:e,newMedia:x,setNewMedia:g},l+1):(null==f?void 0:f.match(/video/i))?(0,t.jsx)(m,{imageObject:e,newMedia:x,setNewMedia:g,video:!0},l+1):(0,t.jsx)(p,{fileObject:e,newFile:x,setNewFile:g},l+1))}),x&&x[0]&&(0,t.jsx)("button",{className:"py-3 w-full relative z-50"+(y?" pointer-events-none opacity-40":""),onClick:e=>{w(!0);let l=(null==f?void 0:f.match(/image/i))?{type:f,folder:v,media:x.map(e=>({imageBase64:e.imageBase64,imageName:e.imageName,imageSize:e.imageSize,private:e.private}))}:{type:f,folder:v,media:x.map(e=>({fileBase64:e.fileBase64,fileName:e.fileName,fileSize:e.fileSize,fileType:e.fileType,private:e.private,video:!!(null==f?void 0:f.match(/video/i))}))};(0,o.A)("/api/addUserMedia",{method:"post",body:l},!0).then(e=>{e.success?(0,n.A)().then(()=>{window.location.reload()}):(alert("Image Upload Failed"),console.log(e),setTimeout(()=>{w(!1)},1e3))})},children:"Upload Media"})]})}},84003:(e,l,a)=>{a.d(l,{A:()=>v});var t=a(74848),i=a(96540),o=a(23698),n=a(17531),s=a(45165),d=a(620),r=a(60557),c=a(29084),u=a(20993);let m=(0,a(95737).A)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var h=a(18453),p=a(98183);function v(e){var l,a;let{targetMedia:v,staticHost:f,setTargetMedia:x,media:g}=e;(null==v?void 0:v.media_thumbnail_path)?"".concat(f,"/").concat(null==v?void 0:v.media_thumbnail_path):null==v||v.media_thumbnail_url;let y=(null==v?void 0:v.media_path)?"".concat(f,"/").concat(null==v?void 0:v.media_path):null==v?void 0:v.media_url,w=!!(null==v?void 0:null===(l=v.media_type)||void 0===l?void 0:l.match(/video/i)),j=v?g.findIndex(e=>e.id==v.id):null,b="number"==typeof j&&j>=0,N=(()=>{var e;if(!b)return null;let l=g[j+1];return l?(null==l?void 0:null===(e=l.media_type)||void 0===e?void 0:e.match(/image/i))?l:g.slice(j+1).find(e=>{var l;return null!==(l=e.media_type)&&void 0!==l&&!!l.match(/image/i)})||null:null})(),A=(()=>{var e;if(!b)return null;let l=g[j-1];return l?(null==l?void 0:null===(e=l.media_type)||void 0===e?void 0:e.match(/image/i))?l:g.slice(0,j-1).findLast(e=>{var l;return null!==(l=e.media_type)&&void 0!==l&&!!l.match(/image/i)})||null:null})(),[k,_]=i.useState(null!=v&&!!v.private),[M,C]=i.useState(!1),[z,L]=i.useState(y),S=i.useRef();return i.useEffect(()=>{(null==v?void 0:v.private)?(0,u.A)({url:v.media_url||""}).then(e=>{e&&(L(e),_(!1))}).catch(e=>{console.log(e.message)}):L((null==v?void 0:v.media_url)||"")},[v]),(0,t.jsxs)(s.Ay,{title:"target-media-popup",noContainer:!0,fullPage:!0,closePopupDispatch:()=>{C(!1),x(null)},children:[k&&(0,t.jsx)(d.A,{}),!M&&(0,t.jsx)(d.A,{}),v&&(0,t.jsxs)(i.Fragment,{children:[(0,t.jsxs)("div",{className:"self-center h-screen py-4",children:[z?w?(0,t.jsx)("video",{src:z,className:"w-full h-full object-cover",controls:!0,muted:!0,autoPlay:!0,loop:!0,onCanPlay:()=>{C(!0)},style:M?void 0:{display:"none"}}):(0,t.jsx)("img",{src:z,alt:v.media_name,className:"bg-slate-200 rounded w-full h-full object-contain",ref:S,onLoad:e=>{C(!0)},style:M?void 0:{display:"none"}}):(0,t.jsx)(t.Fragment,{}),A&&(0,t.jsx)("div",{className:"absolute left-5 md:left-10 z-[100] cursor-pointer p-5 bg-slate-800/40 rounded-full",onClick:e=>{x(null),x(A)},children:(0,t.jsx)(m,{color:"white"})}),N&&(0,t.jsx)("div",{className:"absolute right-5 md:right-10 z-[100] cursor-pointer p-5 bg-slate-800/40 rounded-full",onClick:e=>{x(null),x(N)},children:(0,t.jsx)(h.A,{color:"white"})})]}),(0,t.jsx)("span",{className:"info gray absolute top-5 left-5 w-auto mr-5",style:{backgroundColor:"white"},children:null===(a=v.media_path)||void 0===a?void 0:a.replace(/.*\//,"")}),(0,t.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,t.jsxs)(r.A,{column:!0,children:[(0,t.jsx)(p.F,{mediaObject:v,setLoading:_}),(0,t.jsx)("button",{className:"outlined secondary more-padding",onClick:e=>{var l,a;(0,c.A)({mediaObject:v,fileName:(null===(a=v.media_url)||void 0===a?void 0:null===(l=a.match(/[^\/]+$/))||void 0===l?void 0:l[0])||"",setLoading:_})},children:"Download"}),(0,t.jsx)("button",{onClick:e=>{window.confirm("Delete this media?")&&(0,o.A)("/api/deleteUserMedia",{method:"post",body:v},!0).then(e=>{e.success?(0,n.A)().then(()=>{window.location.reload()}):alert("Media deletion Failed! Please try again.")})},className:"more-padding",children:"Delete"}),(0,t.jsx)("button",{className:"outlined gray w-full bg-white more-padding",onClick:e=>{navigator.clipboard.writeText(v.media_url||"").then(()=>{alert("Media url ".concat(v.media_url," Copied to clipboard"))})},children:"Copy Full Image Link"}),(0,t.jsx)("button",{className:"outlined gray w-full more-padding",onClick:e=>{navigator.clipboard.writeText(v.media_thumbnail_url||"").then(()=>{alert("Media url ".concat(v.media_thumbnail_url," Copied to clipboard"))})},style:{borderTop:"1px solid #0b8862"},children:"Copy Image Thumbnail Link"})]})})]})]})}},98183:(e,l,a)=>{a.d(l,{A:()=>s,F:()=>d});var t=a(74848);a(96540);var i=a(23698),o=a(17531),n=a(60557);function s(e){let{mediaObject:l,setLoading:a}=e;return(0,t.jsxs)("div",{className:"dropdown-wrapper w-full xl:w-auto",children:[(0,t.jsx)("button",{className:"outlined gray small-text hidden xl:flex",children:"More"}),(0,t.jsx)("div",{className:"dropdown mobile-transform gap-2 w-full",children:(0,t.jsxs)(n.A,{column:!0,className:"w-full mb-2 xl:mb-0",children:[(0,t.jsx)(d,{mediaObject:l,setLoading:a}),(0,t.jsx)("button",{className:"outlined gray normal-weight more-padding w-full xl:w-auto",onClick:e=>{window.confirm("Delete this media?")&&(0,i.A)("/api/deleteUserMedia",{method:"post",body:l},!0).then(e=>{e.success?(0,o.A)().then(()=>{window.location.reload()}):alert("Media deletion Failed! Please try again.")})},children:"Delete"})]})})]})}function d(e){let{mediaObject:l,setLoading:a}=e;return(0,t.jsx)("button",{onClick:e=>{let t=window.prompt("Rename media",l.media_name);t&&window.confirm('Rename "'.concat(l.media_name,'" to "').concat(t,'"'))&&(a(!0),(0,i.A)("/api/renameMedia",{method:"post",body:{mediaObject:l,newName:t.replace(/ /g,"-"),newThumbnailName:t.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"})}},45165:(e,l,a)=>{a.d(l,{Ay:()=>n,PB:()=>s,fs:()=>d});var t=a(74848),i=a(76897),o=a(96540);function n(e){let{children:l,title:a,data:n,fullPage:s,wrapperClasses:r,closePopupDispatch:c,wrapperStyle:u,noContainer:m}=e;return s?(0,t.jsxs)("div",{className:"popup-bg overflow-hidden "+(r||""),"data-popupid":a||null,style:u,children:[m?(0,t.jsx)(o.Fragment,{children:l}):(0,t.jsx)("div",{className:"relative w-full h-full z-50","data-data":n?JSON.stringify(n):"",children:l}),(0,t.jsx)("button",{className:"popup-cancel-button fixed outlined gray",onClick:e=>{d(),c&&c()},children:(0,t.jsx)(i.A,{color:"white",size:20})}),(0,t.jsx)("div",{className:"popup-canceller",onClick:e=>{d(),c&&c()}})]}):(0,t.jsxs)("div",{className:"popup-bg","data-popupid":a||null,children:[m?(0,t.jsx)(o.Fragment,{children:l}):(0,t.jsxs)("div",{className:"popup-content-container minimal-scrollbars","data-data":n?JSON.stringify(n):"",children:[l,(0,t.jsx)("button",{className:"outlined gray popup-cancel-button",onClick:e=>{d(),c&&c()},children:(0,t.jsx)("span",{className:"font-normal",children:"✖"})})]}),m&&(0,t.jsx)("button",{className:"gray popup-cancel-button",onClick:e=>{d(),c&&c()},children:(0,t.jsx)("span",{className:"font-normal",children:"✖"})}),(0,t.jsx)("div",{className:"popup-canceller",onClick:e=>{d(),c&&c()}})]})}function s(e,l){let a=document.querySelector("[data-popupid='".concat(e,"']"));a&&(a.style.display="flex",l&&l(a))}function d(e){document.querySelectorAll("[data-popupid]").forEach(e=>{e.style.display="none"}),e&&e()}},11493:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(74848);a(96540);var i=a(95896);function o(e){let{setNewFile:l,setLoading:a}=e;return(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"file",name:"upload_file_input",id:"upload_file_input",className:"hidden",accept:".xlsx,.pdf,.csv,.json",multiple:!0,onChange:async e=>{a&&a(!0);let t=[],o=e.target.files;if(null==o?void 0:o.length){for(let e=0;e<o.length;e++){var n;let l=o[e];if(null===(n=l.type)||void 0===n?void 0:n.match(/sheet/))console.log(URL.createObjectURL(l));else{let e=await (0,i.A)({inputFile:l});t.push(e)}}l(t),setTimeout(()=>{a&&a(!1)},200)}else window.alert("No Files selected")}})})}},67764:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(74848);a(96540);var i=a(65113);function o(e){let{setNewMedia:l,setLoading:a}=e;return(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"file",name:"upload_image_input",id:"upload_image_input",className:"hidden",accept:"image/*",multiple:!0,onChange:async e=>{a&&a(!0);let t=[],o=e.target.files;if(null==o?void 0:o.length){for(let e=0;e<o.length;e++){var n;let l=o[e];if(null===(n=l.type)||void 0===n?void 0:n.match(/sheet/))console.log(URL.createObjectURL(l));else{let e=await (0,i.A)({imageInputFile:l,maxWidth:1800});t.push(e)}}l(t),setTimeout(()=>{a&&a(!1)},200)}else window.alert("No Files selected")}})})}},22154:(e,l,a)=>{a.d(l,{A:()=>o});var t=a(74848);a(96540);var i=a(95896);function o(e){let{setNewVideo:l,setLoading:a}=e;return(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"file",name:"upload_video_input",id:"upload_video_input",className:"hidden",accept:".mp4",multiple:!0,onChange:async e=>{a&&a(!0);let t=[],o=e.target.files;if(null==o?void 0:o.length){for(let e=0;e<o.length;e++){var n;let l=o[e];if(null===(n=l.type)||void 0===n?void 0:n.match(/sheet/))console.log(URL.createObjectURL(l));else{let e=await (0,i.A)({inputFile:l});t.push(e)}}l(t),setTimeout(()=>{a&&a(!1)},200)}else window.alert("No Videos selected")}})})}},55624:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(74848);function i(e){return(0,t.jsxs)("a",{href:"/email-verification",className:"card w-full items-center justify-center py-4 gap-2",children:[(0,t.jsx)("img",{src:"/images/warning.png",alt:"Down Arrow",width:25,className:""}),(0,t.jsx)("span",{children:"Your Account is not verified. Please verify your account."})]})}a(96540)},29084:(e,l,a)=>{a.d(l,{A:()=>i});var t=a(20993);async function i(e){var l;let a,{mediaObject:i,fileName:o,setLoading:n}=e;n&&n(!0);let s=!!((null==i?void 0:i.private)||(null==i?void 0:null===(l=i.media_url)||void 0===l?void 0:l.match(/^\@/)));a=s?await (0,t.A)({url:i.media_url||""}):await fetch("/api/fetch-media?url="+i.media_url);let d=s?a:await a.blob(),r=s?a:URL.createObjectURL(d),c=document.createElement("a");c.href=r,c.download=o,c.style.display="none",document.body.appendChild(c),c.click(),URL.revokeObjectURL(r),document.body.removeChild(c),setTimeout(()=>{n&&n(!1)},500)}},20993:(e,l,a)=>{a.d(l,{A:()=>t});async function t(e){let{url:l}=e;return new Promise((e,a)=>{fetch("/api/media/getPrivateMedia",{method:"POST",body:JSON.stringify({path:l}),headers:{"x-csrf-auth":localStorage.getItem("csrf")}}).then(e=>e.blob()).then(l=>{e(URL.createObjectURL(l))})})}},65113:(e,l,a)=>{a.d(l,{A:()=>t});async function t(e){let l,a,{imageInputFile:t,maxWidth:i}=e,o=document.querySelector("[data-imagepreview='image']"),n=t.name.replace(/\..*/,""),s=document.createElement("canvas"),d=t.type,r=i||null,c=URL.createObjectURL(t),u=new Image;return u.src=c,l=await new Promise((e,l)=>{u.onerror=function(){URL.revokeObjectURL(this.src),console.log("Cannot load image")},u.onload=function(){if(URL.revokeObjectURL(this.src),r){let e=r/u.naturalWidth;s.width=u.naturalWidth<r?u.naturalWidth:r,s.height=u.naturalWidth<r?u.naturalHeight:u.naturalHeight*e}else s.width=u.naturalWidth,s.height=u.naturalHeight;let l=s.getContext("2d");null==l||l.drawImage(u,0,0,s.width,s.height);let a=s.toDataURL(d,.95);o&&document.querySelectorAll("[data-imagepreview='image']").forEach(e=>{e.src=a}),e(a)}}),a=await new Promise((e,l)=>{s.toBlob(l=>{e(null==l?void 0:l.size)},d,.95)}),{imageBase64:l.replace(/.*?base64,/,""),imageBase64Full:l,imageName:n,imageSize:a}}},95896:(e,l,a)=>{a.d(l,{A:()=>t});async function t(e){let{inputFile:l}=e;try{let e=l.name.replace(/\..*/,""),a=await new Promise((e,a)=>{var t=new FileReader;t.readAsDataURL(l),t.onload=function(){e(t.result)},t.onerror=function(e){console.log("Error: ",e.message)}});return{fileBase64:a.replace(/.*?base64,/,""),fileBase64Full:a,fileName:e,fileSize:l.size,fileType:l.type}}catch(e){return console.log("Image Processing Error! =>",e.message),{fileBase64:null,fileBase64Full:null,fileName:l.name,fileSize:null,fileType:null}}}},3260:(e,l,a)=>{var t=a(24994);l.A=void 0;var i=t(a(44888)),o=a(74848);l.A=(0,i.default)([(0,o.jsx)("path",{d:"M5 5v14h14V5zm9 12H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z",opacity:".3"},"0"),(0,o.jsx)("path",{d:"M7 15h7v2H7zm0-4h10v2H7zm0-4h10v2H7zm12-4h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-.14 0-.27.01-.4.04-.39.08-.74.28-1.01.55-.18.18-.33.4-.43.64S3 4.72 3 5v14c0 .27.06.54.16.78s.25.45.43.64c.27.27.62.47 1.01.55.13.02.26.03.4.03h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-7-.25c.41 0 .75.34.75.75s-.34.75-.75.75-.75-.34-.75-.75.34-.75.75-.75M19 19H5V5h14z"},"1")],"AssignmentTwoTone")},34181:(e,l,a)=>{var t=a(24994);l.A=void 0;var i=t(a(44888)),o=a(74848);l.A=(0,i.default)([(0,o.jsx)("path",{d:"M22 15c0-1.66-1.34-3-3-3h-1.5v-.5C17.5 8.46 15.04 6 12 6c-.77 0-1.49.17-2.16.46L20.79 17.4c.73-.55 1.21-1.41 1.21-2.4M2 14c0 2.21 1.79 4 4 4h9.73l-8-8H6c-2.21 0-4 1.79-4 4",opacity:".3"},"0"),(0,o.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4c-1.33 0-2.57.36-3.65.97l1.49 1.49C10.51 6.17 11.23 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3 0 .99-.48 1.85-1.21 2.4l1.41 1.41c1.09-.92 1.8-2.27 1.8-3.81 0-2.64-2.05-4.78-4.65-4.96M3 5.27l2.77 2.77h-.42C2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h11.73l2 2 1.41-1.41L4.41 3.86zM7.73 10l8 8H6c-2.21 0-4-1.79-4-4s1.79-4 4-4z"},"1")],"CloudOffTwoTone")},2436:(e,l,a)=>{var t=a(24994);l.A=void 0;var i=t(a(44888)),o=a(74848);l.A=(0,i.default)((0,o.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}),"DeleteOutlineOutlined")},96228:(e,l,a)=>{var t=a(24994);l.A=void 0;var i=t(a(44888)),o=a(74848);l.A=(0,i.default)([(0,o.jsx)("path",{d:"M11.17 4H7v11h14V6h-7.83z",opacity:".3"},"0"),(0,o.jsx)("path",{d:"M21 4h-7l-2-2H7c-1.1 0-1.99.9-1.99 2L5 15c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 11H7V4h4.17l2 2H21z"},"1"),(0,o.jsx)("path",{d:"M3 6H1v13c0 1.1.9 2 2 2h17v-2H3z"},"2")],"FolderCopyTwoTone")},84672:(e,l,a)=>{var t=a(24994);l.A=void 0;var i=t(a(44888)),o=a(74848);l.A=(0,i.default)((0,o.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h2c0-1.66 1.34-3 3-3s3 1.34 3 3v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m0 12H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"}),"LockOpenOutlined")},71070:(e,l,a)=>{var t=a(24994);l.A=void 0;var i=t(a(44888)),o=a(74848);l.A=(0,i.default)([(0,o.jsx)("path",{d:"M18 11c.7 0 1.37.1 2 .29V10c0-1.1-.9-2-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h6.26c-.79-1.13-1.26-2.51-1.26-4 0-3.87 3.13-7 7-7M8.9 6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9z"},"0"),(0,o.jsx)("path",{d:"M18 13c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0 2c.83 0 1.5.67 1.5 1.5S18.83 18 18 18s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5m0 6c-1.03 0-1.94-.52-2.48-1.32.73-.42 1.57-.68 2.48-.68s1.75.26 2.48.68c-.54.8-1.45 1.32-2.48 1.32"},"1")],"LockPersonRounded")},64401:(e,l,a)=>{var t=a(24994);l.A=void 0;var i=t(a(44888)),o=a(74848);l.A=(0,i.default)([(0,o.jsx)("path",{d:"m13.17 6-.59-.59L11.17 4H6v12h16V6zm4.33 4.5L21 15H7l4.5-6 3.5 4.51z",opacity:".3"},"0"),(0,o.jsx)("path",{d:"M2 6H0v5h.01L0 20c0 1.1.9 2 2 2h18v-2H2zm5 9h14l-3.5-4.5-2.5 3.01L11.5 9zM22 4h-8l-2-2H6c-1.1 0-1.99.9-1.99 2L4 16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 12H6V4h5.17l1.41 1.41.59.59H22z"},"1")],"PermMediaTwoTone")},45014:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["path",{d:"M8 7h6",key:"1f0q6e"}],["path",{d:"M8 11h8",key:"vwpz6n"}]])},18453:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},59140:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},2894:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]])},79508:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},79753:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]])},1915:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]])},87273:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},5922:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("ShieldEllipsis",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]])},94909:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},76897:(e,l,a)=>{a.d(l,{A:()=>t});let t=(0,a(95737).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])}}]);