dsql-admin/dsql-app/.local_dist/server/chunks/7640.js
Benjamin Toby a7dfd48284 Updates
2024-12-09 10:39:09 +01:00

1 line
29 KiB
JavaScript

"use strict";exports.id=7640,exports.ids=[7640],exports.modules={30671:(e,a)=>{Object.defineProperty(a,"M",{enumerable:!0,get:function(){return function e(a,t){return t in a?a[t]:"then"in a&&"function"==typeof a.then?a.then(a=>e(a,t)):"function"==typeof a&&"default"===t?a:void 0}}})},99486:(e,a,t)=>{t.d(a,{A:()=>o});var l=t(8732);t(82015);var i=t(55158),s=t(83158),n=t(82544);let r=(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 o({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)(r,{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)(d,{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"]})]})]})})]})})}},82747:(e,a,t)=>{t.d(a,{A:()=>N});var l=t(8732),i=t(82015),s=t.n(i),n=t(63715),r=t(32415),d=t(82544);let o=(0,d.A)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var c=t(58150);function m({folderName:e,folder:a,user:t}){let i=`${a?a+"/":""}${e}`,[d,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:[d&&(0,l.jsx)(r.A,{}),(0,l.jsx)(o,{opacity:.5}),(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)(c.A,{})})]},e)}var u=t(55158),p=t(62506),h=t(1133);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.jsx)("div",{className:"cursor-pointer hover:opacity-80",children:(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)(p.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 y=t(17855);let w=(0,d.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 j({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)(y.A,{size:20,color:"green"}):(0,l.jsx)(w,{color:"black",size:20})})}function b({mediaObject:e,setTargetMedia:a,folder:t,staticHost:i}){let[n,d]=s().useState(!!e?.private),[o,c]=s().useState(e);o.media_thumbnail_path?o.media_thumbnail_path:o.media_thumbnail_url;let m=o.media_path?`${i}/${o.media_path}`:o.media_url;return(0,l.jsxs)("div",{className:"media-card card col min-h-[200px]",onClick:e=>{if(!(e.target.closest("button")||e.target.closest(".button"))){if(o.media_type?.match(/file/i)&&!o.private){window.open(m,"__blank");return}o.media_type?.match(/file/i)&&o.private||(a(o),(0,u.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:o?.private?{outline:"5px solid var(--sec-color-light)",borderColor:"var(--sec-color-lighter)"}:{},children:[n&&(0,l.jsx)(r.A,{}),(0,l.jsx)(f,{mediaObject:o,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:o.media_name}),(0,l.jsx)("div",{className:"flex-wrap w-full",children:(0,l.jsxs)(p.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,h.A)({mediaObject:o,fileName:m?.match(/[^\/]+$/)?.[0]||"",setLoading:d})},children:(0,l.jsx)("span",{children:"Download"})}),(0,l.jsx)(g,{mediaObject:o,staticHost:i}),(0,l.jsx)(x.A,{mediaObject:o,setLoading:d})]})})]}),(0,l.jsx)(j,{mediaObject:o,setLoading:d})]})}t(99730);let v=(0,d.A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function N({media:e,setTargetMedia:a,folders:t,folder:i,staticHost:n,user:r}){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)(m,{folder:i,folderName:e,user:r},e)),e&&e[0]&&e.map(e=>(0,l.jsx)(b,{mediaObject:e,setTargetMedia:a,folder:i,staticHost:n},e.id))]}),!e?.[0]&&(0,l.jsx)(A,{})]})})}function A(){return(0,l.jsxs)("div",{className:"button outlined gray dashed w-full p-10 flex-col",onClick:e=>{(0,u.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"text-slate-400",children:"No Media Added."}),(0,l.jsx)(v,{}),(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),r=t(63715),d=t(55158),o=t(32415);function c({folder:e}){let[a,t]=n().useState(!1),[s,c]=n().useState(!1);return(0,i.jsxs)(d.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)(o.A,{}),(0,i.jsxs)("form",{onSubmit:a=>{a.preventDefault(),window.clearTimeout(l),t(!0);let i=a.target;(0,r.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,r.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"})]})]})]})}},81156:(e,a,t)=>{t.d(a,{A:()=>x});var l=t(8732),i=t(82015),s=t.n(i),n=t(63715),r=t(86152),d=t(55158),o=t(32415),c=t(17855);let m=(0,t(82544).A)("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);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)(c.A,{}):(0,l.jsx)(m,{})})}var p=t(58150);function h({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:(0,l.jsx)(p.A,{size:16})}),!i&&(0,l.jsx)(u,{mediaObject:e})]})}function f({fileObject:e,newFile:a,setNewFile:t}){return(0,l.jsxs)("div",{className:"border border-slate-300 rounded min-h-[100px] flex-col w-full overflow-hidden h-full bg-slate-200 relative p-2",children:[(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)(p.A,{size:16})}),(0,l.jsx)(u,{mediaObject:e})]})}function x({newMedia:e,setNewMedia:a,newFile:t,setNewFile:i,newVideo:c,setNewVideo:m,folder:u}){let p=e?.[0]?"images":t?.[0]?"files":"videos",x=p?.match(/image/i)?e:p?.match(/file/i)?t:c,g=p?.match(/image/i)?a:p?.match(/file/i)?i:m,[y,w]=s().useState(!1);return(0,l.jsxs)(d.Ay,{title:"new-media-popup",closePopupDispatch:()=>{a(null),i(null),m(null)},children:[y&&(0,l.jsx)(o.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)=>p?.match(/image/i)?(0,l.jsx)(h,{imageObject:e,newMedia:x,setNewMedia:g},a+1):p?.match(/video/i)?(0,l.jsx)(h,{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"+(y?" pointer-events-none opacity-40":""),onClick:e=>{w(!0);let a=p?.match(/image/i)?{type:p,folder:u,media:x.map(e=>({imageBase64:e.imageBase64,imageName:e.imageName,imageSize:e.imageSize,private:e.private}))}:{type:p,folder:u,media:x.map(e=>({fileBase64:e.fileBase64,fileName:e.fileName,fileSize:e.fileSize,fileType:e.fileType,private:e.private,video:!!p?.match(/video/i)}))};(0,n.A)("/api/addUserMedia",{method:"post",body:a},!0).then(e=>{e.success?(0,r.A)().then(()=>{window.location.reload()}):(alert("Image Upload Failed"),console.log(e),setTimeout(()=>{w(!1)},1e3))})},children:"Upload Media"})]})}},98009:(e,a,t)=>{t.d(a,{A:()=>f});var l=t(8732),i=t(82015),s=t.n(i),n=t(63715),r=t(86152),d=t(55158),o=t(32415),c=t(62506),m=t(1133);t(99730);let u=(0,t(82544).A)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var 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,y="number"==typeof g&&g>=0,w=(()=>{if(!y)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})(),j=(()=>{if(!y)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})(),[b,v]=s().useState(!!e?.private),[N,A]=s().useState(!1),[k,_]=s().useState(f),M=s().useRef();return(0,l.jsxs)(d.Ay,{title:"target-media-popup",noContainer:!0,fullPage:!0,closePopupDispatch:()=>{A(!1),t(null)},children:[b&&(0,l.jsx)(o.A,{}),!N&&(0,l.jsx)(o.A,{}),e&&(0,l.jsxs)(s().Fragment,{children:[(0,l.jsxs)("div",{className:"self-center h-screen py-4",children:[k?x?(0,l.jsx)("video",{src:k,className:"w-full h-full object-cover",controls:!0,muted:!0,autoPlay:!0,loop:!0,onCanPlay:()=>{A(!0)},style:N?void 0:{display:"none"}}):(0,l.jsx)("img",{src:k,alt:e.media_name,className:"bg-slate-200 rounded w-full h-full object-contain",ref:M,onLoad:e=>{A(!0)},style:N?void 0:{display:"none"}}):(0,l.jsx)(l.Fragment,{}),j&&(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(j)},children:(0,l.jsx)(u,{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-1 bg-white dark:bg-slate-900 rounded z-20 hidden lg:flex flex-col items-stretch min-w-[200px]",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,r.A)().then(()=>{window.location.reload()}):alert("Media deletion Failed! Please try again.")})},className:"more-padding",children:"Delete"}),!e?.private&&(0,l.jsxs)(s().Fragment,{children:[(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:()=>r,F:()=>d});var l=t(8732);t(82015);var i=t(63715),s=t(86152),n=t(62506);function r({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)(d,{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 d({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:()=>r,PB:()=>d,fs:()=>o});var l=t(8732),i=t(58150),s=t(82015),n=t.n(s);function r({children:e,title:a,data:t,fullPage:s,wrapperClasses:r,closePopupDispatch:d,wrapperStyle:c,noContainer:m}){return s?(0,l.jsxs)("div",{className:"popup-bg overflow-hidden "+(r||""),"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=>{o(),d&&d()},children:(0,l.jsx)(i.A,{color:"white",size:20})}),(0,l.jsx)("div",{className:"popup-canceller",onClick:e=>{o(),d&&d()}})]}):(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=>{o(),d&&d()},children:(0,l.jsx)("span",{className:"font-normal",children:"✖"})})]}),m&&(0,l.jsx)("button",{className:"gray popup-cancel-button",onClick:e=>{o(),d&&d()},children:(0,l.jsx)("span",{className:"font-normal",children:"✖"})}),(0,l.jsx)("div",{className:"popup-canceller",onClick:e=>{o(),d&&d()}})]})}function d(e,a){let t=document.querySelector(`[data-popupid='${e}']`);t&&(t.style.display="flex",a&&a(t))}function o(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<s.length;e++){let a=s[e];if(a.type?.match(/sheet/))console.log(URL.createObjectURL(a));else{let e=await (0,i.A)({inputFile:a});l.push(e)}}e(l),setTimeout(()=>{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<s.length;e++){let a=s[e];if(a.type?.match(/sheet/))console.log(URL.createObjectURL(a));else{let e=await (0,i.A)({imageInputFile:a,maxWidth:1800});l.push(e)}}e(l),setTimeout(()=>{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<s.length;e++){let a=s[e];if(a.type?.match(/sheet/))console.log(URL.createObjectURL(a));else{let e=await (0,i.A)({inputFile:a});l.push(e)}}e(l),setTimeout(()=>{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)},62506:(e,a,t)=>{t.d(a,{A:()=>n});var l=t(8732),i=t(82015),s=t.n(i);function n({children:e,column:a,className:t}){let i=s().useRef();return(0,l.jsx)("div",{className:"items-stretch gap-0"+(a?" flex-col":" flex-wrap xl:flex-nowrap")+(t?" "+t:""),ref:i,children:e})}},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(),r=s?i:URL.createObjectURL(n),d=document.createElement("a");d.href=r,d.download=a,d.style.display="none",document.body.appendChild(d),d.click(),URL.revokeObjectURL(r),document.body.removeChild(d),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"),r=e.type,d=a||null,o=URL.createObjectURL(e),c=new Image;return c.src=o,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),d){let e=d/c.naturalWidth;n.width=c.naturalWidth<d?c.naturalWidth:d,n.height=c.naturalWidth<d?c.naturalHeight:c.naturalHeight*e}else n.width=c.naturalWidth,n.height=c.naturalHeight;let a=n.getContext("2d");a?.drawImage(c,0,0,n.width,n.height);let t=n.toDataURL(r,.95);i&&document.querySelectorAll("[data-imagepreview='image']").forEach(e=>{e.src=t}),e(t)}}),l=await new Promise((e,a)=>{n.toBlob(a=>{e(a?.size)},r,.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}}}},23293:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},92441:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},6070:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},34637:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},29743:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},10643:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},66916:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},83158:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},17855:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},66918:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},10321:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},25294:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).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"}]])},58150:(e,a,t)=>{t.d(a,{A:()=>l});let l=(0,t(82544).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},9455:(e,a)=>{var t;Object.defineProperty(a,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))}};