1import{l as L,r as l,j as e,H as A,d as H,B as w,aa as d,ab as F,ac as I,ad as T,K as Y,F as _,ae as c,a1 as C}from"./index-D_A9ER9W.js";import{C as K}from"./circle-check-nS_LnVi6.js";import{U as S}from"./upload-CexgAVJQ.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Z=L("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"}]]),q=100*1024*1024,D="complaint-uploads";function R(){const[a,m]=l.useState([]),[u,$]=l.useState(""),[x,k]=l.useState(""),[h,f]=l.useState(""),[i,p]=l.useState(!1),[g,j]=l.useState(0),[M,b]=l.useState(!1),U=s=>s>1048576?`${(s/1048576).toFixed(2)} MB`:`${(s/1024).toFixed(1)} KB`,y=s=>{if(!s)return;const r=[];for(const t of Array.from(s)){if(t.size>q){c.error(`${t.name} exceeds 100MB limit`);continue}r.push({file:t,id:`${t.name}-${t.size}-${Math.random().toString(36).slice(2,8)}`})}m(t=>[...t,...r].slice(0,50))},z=s=>m(r=>r.filter(t=>t.id!==s)),B=async()=>{if(a.length===0){c.error("Please select at least one file");return}p(!0),j(0);try{const s=`complaint/${Date.now()}-${Math.random().toString(36).slice(2,10)}`,r=[];for(let o=0;o<a.length;o++){const n=a[o].file,E=n.name.replace(/[^a-zA-Z0-9._-]/g,"_"),N=`${s}/${o}-${E}`,{error:v}=await C.storage.from(D).upload(N,n,{contentType:n.type||"application/octet-stream",upsert:!1});if(v)throw v;r.push({path:N,name:n.name,size:n.size,type:n.type}),j(Math.round((o+1)/a.length*100))}const{error:t}=await C.functions.invoke("notify-complaint-upload",{body:{files:r,note:h,senderName:u,senderEmail:x}});if(t)throw t;b(!0),c.success("Files sent successfully"),m([]),f("")}catch(s){console.error(s),c.error((s==null?void 0:s.message)||"Upload failed")}finally{p(!1)}};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsxs(A,{children:[e.jsx("title",{children:"Confidential Upload | Fine Arts Academy"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),e.jsx(H,{}),e.jsx("main",{className:"pt-24 pb-16",children:e.jsxs("div",{className:"container mx-auto px-4 max-w-2xl",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground mb-2",children:"Confidential File Upload"}),e.jsx("p",{className:"text-muted-foreground mb-8",children:"Securely send files (up to 100MB each) directly to the academy. Your submission is confidential."}),M?e.jsxs("div",{className:"bg-card border rounded-lg p-8 text-center",children:[e.jsx(K,{className:"w-16 h-16 mx-auto text-primary mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Thank you"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Your files have been sent confidentially."}),e.jsx(w,{variant:"outline",onClick:()=>b(!1),children:"Send more files"})]}):e.jsxs("div",{className:"space-y-6 bg-card border rounded-lg p-6",children:[e.jsxs("div",{children:[e.jsx(d,{htmlFor:"name",children:"Your name (optional)"}),e.jsx(F,{id:"name",value:u,onChange:s=>$(s.target.value),maxLength:100})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"email",children:"Your email (optional)"}),e.jsx(F,{id:"email",type:"email",value:x,onChange:s=>k(s.target.value),maxLength:200})]}),e.jsxs("div",{children:[e.jsx(d,{htmlFor:"note",children:"Message (optional)"}),e.jsx(I,{id:"note",rows:4,value:h,onChange:s=>f(s.target.value),maxLength:2e3})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Files (max 100MB each)"}),e.jsxs("label",{className:"mt-2 flex flex-col items-center justify-center border-2 border-dashed border-border rounded-lg p-8 cursor-pointer hover:border-primary transition-colors",children:[e.jsx(S,{className:"w-10 h-10 text-muted-foreground mb-2"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to select files or folders"}),e.jsx("input",{type:"file",multiple:!0,webkitdirectory:"",directory:"",className:"hidden",onChange:s=>y(s.target.files)})]}),e.jsxs("label",{className:"mt-2 flex items-center justify-center border border-border rounded-lg p-3 cursor-pointer hover:border-primary transition-colors",children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),e.jsx("span",{className:"text-sm",children:"Or select individual files"}),e.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:s=>y(s.target.files)})]})]}),a.length>0&&e.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:a.map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-muted/40 rounded",children:[e.jsx(Z,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm truncate",children:s.file.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:U(s.file.size)})]}),!i&&e.jsx("button",{onClick:()=>z(s.id),className:"text-muted-foreground hover:text-foreground",children:e.jsx(T,{className:"w-4 h-4"})})]},s.id))}),i&&e.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full transition-all",style:{width:`${g}%`}})}),e.jsx(w,{onClick:B,disabled:i||a.length===0,className:"w-full",children:i?e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 mr-2 animate-spin"})," Uploading (",g,"%)"]}):`Send ${a.length||""} file(s)`})]})]})}),e.jsx(_,{})]})}
6export{R as default};
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.