1import{r as d,j as e}from"./QueryClientProvider-C1unof7P.js";import{a as w,u as S}from"./index-BoetV10O.js";import{L as T,aP as D,aQ as k}from"./api-D_7mmoRr.js";import{S as C}from"./saq-form-DMpNfLWw.js";import{C as F,a as L}from"./card-C8Jj20ZQ.js";import{B as E}from"./button-SBb9uHiR.js";import{S as q,a as I,b as z,c as R,d as A}from"./select-CleQDElR.js";import{u as G}from"./language-switcher-G6Qj2Bh4.js";import{F as K}from"./file-text-CG-n5alf.js";import{G as V}from"./globe-Dn4cxam-.js";import{F as B}from"./file-digit-81auil_x.js";import{c as M}from"./x-DiJda-Uu.js";import{C as O}from"./circle-check-Dk-4HkaE.js";import"./index-DIvvuVIC.js";import"./HydrationBoundary-COF4dBti.js";import"./queryClient-Dr4kDVsr.js";import"./label-CfOBxChx.js";import"./input-D7cklfu_.js";import"./switch-Q6MdTTRa.js";import"./progress-DOy4dGDf.js";import"./shield-check-B7x2lL_Q.js";import"./loader-circle-0h6imjBX.js";import"./triangle-alert-C3x2QYNQ.js";import"./send-CJPuHRho.js";import"./index-C2MTTiXP.js";import"./Combination-BUjfZZ_Z.js";import"./index-GvPTnkCo.js";const P=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],U=M("cloud-upload",P),_=[{code:"en",name:"English"},{code:"vi",name:"Tiếng Viá»t"},{code:"zh",name:"䏿"},{code:"tl",name:"Tagalog"},{code:"es",name:"Español"},{code:"bn",name:"বাà¦à¦²à¦¾"},{code:"id",name:"Bahasa Indonesia"},{code:"hi",name:"हिनà¥à¤¦à¥"}];function be(){const{user:p}=w(),r=p?.supplierId??0,{toast:a}=S(),{t}=G("supplier"),[l,x]=d.useState("en"),[c,n]=d.useState(!1),m=d.useRef(null),{data:i,isLoading:f}=T(r,{query:{enabled:!!r,queryKey:["/api/suppliers",r]}}),{data:o,refetch:v}=D(r,{query:{enabled:!!r,queryKey:["/api/suppliers",r,"evidence"]}}),h=k(),g=s=>{s.preventDefault(),n(!0)},y=()=>n(!1),b=s=>{s.preventDefault(),n(!1),s.dataTransfer.files&&s.dataTransfer.files[0]&&u(s.dataTransfer.files[0])},j=s=>{s.target.files&&s.target.files[0]&&u(s.target.files[0])},u=s=>{if(!["application/pdf","image/png","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(s.type)&&!s.name.endsWith(".docx")){a({title:t("survey.toast.invalidTypeTitle"),description:t("survey.toast.invalidTypeDesc"),variant:"destructive"});return}if(s.size>25*1024*1024){a({title:t("survey.toast.fileTooLargeTitle"),description:t("survey.toast.fileTooLargeDesc"),variant:"destructive"});return}h.mutate({id:r,data:{documentType:"OTHER",fileName:s.name,sizeKb:Math.round(s.size/1024)}},{onSuccess:()=>{a({title:t("survey.toast.uploadedTitle"),description:t("survey.toast.uploadedDesc",{name:s.name})}),v()}})};if(r===0)return e.jsx("div",{className:"p-8 text-center text-muted-foreground font-display",children:t("survey.signIn")});if(f)return e.jsx("div",{className:"p-8 text-center animate-pulse text-muted-foreground",children:t("survey.loading")});if(!i)return e.jsx("div",{className:"p-8 text-destructive",children:t("survey.notFound")});const N=i.surveys.find(s=>s.completionStatus==="DRAFT")||i.surveys[0];return e.jsxs("div",{className:"flex flex-col lg:flex-row h-[calc(100vh-64px)] overflow-hidden bg-muted/10",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 border-r border-border bg-background relative z-10",children:[e.jsxs("div",{className:"p-6 border-b border-border bg-card flex justify-between items-center shrink-0",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-display font-bold tracking-tight flex items-center gap-2",children:[e.jsx(K,{className:"w-5 h-5 text-primary"}),t("survey.title")]}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:t("survey.frameworkLine",{name:i.supplier.legalName})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs(q,{value:l,onValueChange:x,children:[e.jsx(I,{className:"w-[160px] rounded-none bg-background",children:e.jsx(z,{})}),e.jsx(R,{className:"rounded-none",children:_.map(s=>e.jsx(A,{value:s.code,children:s.name},s.code))})]})]})]}),l!=="en"&&e.jsx("div",{className:"bg-msl-sky/10 border-b border-msl-sky/20 p-3 text-sm text-center text-msl-sky font-medium font-display tracking-wide uppercase",children:t("survey.translationPreview")}),e.jsx("div",{className:"flex-1 overflow-hidden relative",children:e.jsx(C,{supplierId:r,initialResponses:N?.responses??null,containerClassName:"h-full border-none shadow-none",onSubmitted:()=>a({title:t("survey.toast.saqSubmittedTitle"),description:t("survey.toast.saqSubmittedDesc")}),header:e.jsx(e.Fragment,{})})})]}),e.jsxs("div",{className:"w-full lg:w-96 flex flex-col shrink-0 bg-muted/30",children:[e.jsxs("div",{className:"p-6 border-b border-border bg-card shrink-0",children:[e.jsxs("h2",{className:"text-lg font-display font-bold flex items-center gap-2",children:[e.jsx(B,{className:"w-5 h-5 text-primary"}),t("survey.evidenceVault")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t("survey.evidenceVaultDesc")})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[e.jsxs("div",{className:`border-2 border-dashed p-8 text-center transition-colors cursor-pointer ${c?"border-msl-signal bg-msl-signal/5":"border-border hover:border-primary hover:bg-muted/50"}`,onDragOver:g,onDragLeave:y,onDrop:b,onClick:()=>m.current?.click(),children:[e.jsx("input",{type:"file",ref:m,className:"hidden",accept:".pdf,.png,.docx",onChange:j}),e.jsx(U,{className:`w-8 h-8 mx-auto mb-4 ${c?"text-msl-signal":"text-muted-foreground"}`}),e.jsx("p",{className:"font-medium text-sm mb-1",children:t("survey.dragDrop")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("survey.dragDropFormats")}),e.jsx(E,{variant:"secondary",size:"sm",className:"mt-4 rounded-none w-full font-display pointer-events-none",children:t("survey.browseFiles")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"font-display text-sm font-bold uppercase tracking-wider text-muted-foreground",children:t("survey.uploadedEvidence")}),o&&o.length>0?e.jsx("div",{className:"space-y-2",children:o.map(s=>e.jsx(F,{className:"rounded-none border-border shadow-sm",children:e.jsxs(L,{className:"p-3 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",title:s.fileName,children:s.fileName}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[s.documentType.replace(/_/g," ")," ⢠",s.sizeKb,"KB"]})]}),e.jsx(O,{className:"w-4 h-4 text-msl-signal shrink-0 mt-0.5"})]})},s.id))}):e.jsx("div",{className:"text-center p-6 border border-dashed border-border bg-card text-xs text-muted-foreground",children:t("survey.noDocuments")})]})]})]})]})}export{be 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.