PageSourceSearch

https://www.mangalmay.org/_next/static/chunks/pages/admin/Components/FileUpload-568a19947785d9ef.js

js mangalmay.org collected 2026-10-04 00:14:46 UTC 6,875 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3782],{17963:(e,t,a)=>{"use strict";a.d(t,{A:()=>c});var r=a(3576),s=a(65699),l=a(14232);let i=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((e,t,a)=>!!e&&a.indexOf(e)===t).join(" ")};var n=a(62701),o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let d=(0,l.forwardRef)((e,t)=>{var{color:a="currentColor",size:d=24,strokeWidth:c=2,absoluteStrokeWidth:p,className:h="",children:m,iconNode:u}=e,g=(0,s._)(e,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return(0,l.createElement)("svg",(0,r._)((0,n._)((0,r._)({ref:t},o),{width:d,height:d,stroke:a,strokeWidth:p?24*Number(c)/Number(d):c,className:i("lucide",h)}),g),[...u.map(e=>{let[t,a]=e;return(0,l.createElement)(t,a)}),...Array.isArray(m)?m:[m]])}),c=(e,t)=>{let a=(0,l.forwardRef)((a,n)=>{var{className:o}=a,c=(0,s._)(a,["className"]);return(0,l.createElement)(d,(0,r._)({ref:n,iconNode:t,className:i("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),o)},c))});return a.displayName="".concat(e),a}},18264:(e,t,a)=>{"use strict";a.r(t),a.d(t,{uploadImages:()=>s});var r=a(54196);async function s(e){let t=new FormData;for(let a of Array.isArray(e)?e:[e])t.append("files",a);try{let a=await fetch("".concat(r.Qs,"upload/"),{method:"POST",body:t,credentials:"include"}),s=await a.json();if(!a.ok)throw Error(s.message||"Image upload failed");let l=s.data.fileUrls.map(e=>{try{return new URL(e).pathname}catch(a){let t=e.split("/");return"/"+t.slice(-2).join("/")}});return Array.isArray(e)?l:l[0]}catch(e){throw console.error("Upload error:",e),e}}},19823:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>p});var r=a(37876),s=a(14232),l=a(70948),i=a(21355),n=a(76965),o=a(76158),d=a(28249),c=a(18264);function p(e){let{onFilesUploaded:t,maxFiles:a=5,acceptedTypes:p="image/*,.pdf,.doc,.docx,.txt,.xlsx,.xls,.ppt,.pptx"}=e,[h,m]=(0,s.useState)([]),[u,g]=(0,s.useState)(!1),[y,f]=(0,s.useState)(!1),x=e=>{let t=Array.from(e).slice(0,a-h.length).filter(e=>{let t=e.size<=0xa00000,a=p.split(",").some(t=>{var a;return"image/*"===t.trim()?e.type.startsWith("image/"):(null==(a=t.trim())?void 0:a.startsWith("."))?e.name.toLowerCase().endsWith(t.trim()):e.type===t.trim()});return t&&a});m(e=>[...e,...t])},w=e=>{e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?f(!0):"dragleave"===e.type&&f(!1)},b=async()=>{if(0!==h.length){g(!0);try{let e=await (0,c.uploadImages)(h),a=h.map((t,a)=>({filename:t.name,url:Array.isArray(e)?e[a]:e,type:t.type,size:t.size}));t(a),m([])}catch(e){console.error("Upload failed:",e),alert("Upload failed. Please try again.")}finally{g(!1)}}};return(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsxs)("div",{className:"relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ".concat(y?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-gray-400"),onDragEnter:w,onDragLeave:w,onDragOver:w,onDrop:e=>{e.preventDefault(),e.stopPropagation(),f(!1),e.dataTransfer.files&&e.dataTransfer.files[0]&&x(e.dataTransfer.files)},children:[(0,r.jsx)("input",{type:"file",multiple:!0,accept:p,onChange:e=>x(e.target.files),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:u||h.length>=a}),(0,r.jsx)(o.A,{className:"mx-auto h-12 w-12 text-gray-400 mb-4"}),(0,r.jsx)("p",{className:"text-lg font-medium text-gray-900 mb-2",children:"Drop files here or click to browse"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"Support for images, PDFs, and documents up to 10MB each"}),(0,r.jsxs)("p",{className:"text-xs text-gray-400 mt-1",children:["Maximum ",a," files (",h.length,"/",a," selected)"]})]}),h.length>0&&(0,r.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,r.jsx)("h4",{className:"font-medium text-gray-900",children:"Selected Files:"}),h.map((e,t)=>{var a;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(null==(a=e.type)?void 0:a.startsWith("image/"))?(0,r.jsx)(l.A,{className:"w-4 h-4"}):a.includes("pdf")?(0,r.jsx)(i.A,{className:"w-4 h-4"}):(0,r.jsx)(n.A,{className:"w-4 h-4"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900 truncate max-w-xs",children:e.name}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:(e=>{if(0===e)return"0 Bytes";let t=Math.floor(Math.log(e)/Math.log(1024));return Number.parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]})(e.size)})]})]}),(0,r.jsx)("button",{onClick:()=>{m(e=>e.filter((e,a)=>a!==t))},className:"p-1 hover:bg-gray-200 rounded-full transition-colors",disabled:u,children:(0,r.jsx)(d.A,{className:"w-4 h-4 text-gray-500"})})]},t)}),(0,r.jsx)("button",{onClick:b,disabled:u||0===h.length,className:"w-full mt-4 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed transition-colors",children:u?"Uploading...":"Upload ".concat(h.length," file").concat(1!==h.length?"s":"")})]})]})}},21355:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(17963).A)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},28249:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(17963).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
1],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},28636:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/Components/FileUpload",function(){return a(19823)}])},54196:(e,t,a)=>{"use strict";a.d(t,{CY:()=>l,Ir:()=>s,Qs:()=>r});let r="https://sea-lion-app-zhe9q.ondigitalocean.app/api/",s="https://mangalmay.sfo3.cdn.digitaloceanspaces.com",l="https://www.mangalmay.org/"},70948:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(17963).A)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},76158:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(17963).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},76965:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(17963).A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=28636)),_N_E=e.O()}]);

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.