1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32917],{919:(e,t,s)=>{s.d(t,{A:()=>l});let l=(0,s(45105).A)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},21786:(e,t,s)=>{s.d(t,{A:()=>l});let l=(0,s(45105).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"}]])},32917:(e,t,s)=>{s.r(t),s.d(t,{GovernanceDocumentsContent:()=>_,default:()=>F});var l=s(95155),a=s(12115),n=s(20063),r=s(25563),i=s(919),c=s(9582),o=s(26983),d=s(65229),u=s(92001),x=s(46701),m=s(21786),p=s(86651),h=s(63581),b=s(89715),f=s(71360),g=s(90960),j=s(81656),v=s(80011),y=s(95706),N=s(3998),w=s(88376),k=s(18332);let C=["Policy","Standard","Procedure","Guideline","Framework","Audit Report","Other"],A=["EU_AI_ACT","NIST_AI_RMF","ISO_42001","ISO_27001","GDPR","SOX_404","HIPAA","FDA_SAMD","SOC2","PCI_DSS","CCPA_CPRA","DORA"];function D(e){return e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(1)," KB"):"".concat((e/1048576).toFixed(1)," MB")}function S(e){let{open:t,onClose:s,onUploaded:n}=e,[r,c]=(0,a.useState)(null),[o,p]=(0,a.useState)(""),[h,b]=(0,a.useState)(""),[f,j]=(0,a.useState)("Policy"),[v,y]=(0,a.useState)([]),[w,S]=(0,a.useState)(!1),[_,F]=(0,a.useState)(0),[P,M]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[U,I]=(0,a.useState)(!1),[O,X]=(0,a.useState)(!1),H=(0,a.useRef)(null),R=(0,a.useCallback)(()=>{c(null),p(""),b(""),j("Policy"),y([]),F(0),M(null),z(null),I(!1)},[]),q=(0,a.useCallback)(()=>{w||(R(),s())},[w,R,s]),B=e=>{let t=(e=>{var t;if(e.size>0x3200000)return"File too large (".concat(D(e.size),"). Maximum size is 50MB.");let s=null==(t=e.name.split(".").pop())?void 0:t.toLowerCase();return s&&["pdf","docx","txt","md"].includes(s)?null:"Unsupported file type (.".concat(s,"). Accepted: PDF, DOCX, TXT, MD.")})(e);if(t)return void M(t);c(e),M(null),o||p(e.name.replace(/\.[^.]+$/,""))},E=async()=>{var e,t,l,a;if(!r||!o.trim())return void M("File and title are required.");S(!0),F(10),M(null),z(null),I(!1);try{let l=new FormData;l.append("file",r),l.append("title",o.trim()),l.append("description",h.trim()),l.append("document_type",f),l.append("frameworks",v.join(","));let a=setInterval(()=>{F(e=>Math.min(e+10,90))},500),i=await g.default.post("/governance/documents",l,{headers:{"Content-Type":void 0},timeout:12e4});clearInterval(a),F(100);let c=null!=(t=null==(e=i.data)?void 0:e.relevance_warning)?t:null;c?(z(c),I(!0),n()):setTimeout(()=>{R(),n(),s()},500)}catch(e){if((null==e||null==(l=e.response)?void 0:l.status)===422){let t=null==(a=e.response.data)?void 0:a.detail;M("object"==typeof t&&null!==t&&"message"in t?t.message:"string"==typeof t?t:"This file was rejected: it does not appear to be a policy document.")}else M(e instanceof Error?e.message:"Upload failed. Please try again.")}finally{S(!1)}};return t?(0,l.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm",onClick:q}),(0,l.jsxs)("div",{className:"relative w-full max-w-2xl bg-white shadow-xl max-h-[90vh] overflow-y-auto",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold text-slate-900",children:"Upload Governance Document"}),(0,l.jsx)("button",{onClick:q,disabled:w,className:"p-1 text-slate-400 hover:text-slate-600 disabled:opacity-50",children:(0,l.jsx)(d.A,{className:"w-5 h-5"})})]}),(0,l.jsxs)("div",{className:"p-4 space-y-4",children:[(0,l.jsxs)("div",{onDrop:e=>{e.preventDefault(),X(!1);let t=e.dataTransfer.files[0];t&&B(t)},onDragOver:e=>{e.preventDefault(),X(!0)},onDragLeave:()=>X(!1),onClick:()=>{var e;return null==(e=H.current)?void 0:e.click()},className:"border-2 border-dashed p-8 text-center cursor-pointer transition-colors ".concat(O?"border-blue-500 bg-blue-50":r?"border-green-400 bg-green-50":"border-slate-300 hover:border-slate-400 hover:bg-slate-50"),children:[(0,l.jsx)("input",{ref:H,type:"file",accept:".pdf,.docx,.txt,.md",onChange:e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];s&&B(s)},className:"hidden"}),r?(0,l.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,l.jsx)(u.A,{className:"w-8 h-8 text-green-600"}),(0,l.jsxs)("div",{className:"text-left",children:[(0,l.jsx)("p",{className:"font-medium text-slate-900",children:r.name}),(0,l.jsx)("p",{className:"text-sm text-slate-500",children:D(r.size)})]}),(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),c(null)},className:"p-1 text-slate-400 hover:text-red-500",children:(0,l.jsx)(d.A,{className:"w-4 h-4"})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x.A,{className:"w-10 h-10 mx-auto text-slate-400 mb-2"}),(0,l.jsx)("p",{className:"text-slate-600 font-medium",children:"Drag & drop a file here, or click to browse"}),(0,l.jsx)("p",{className:"text-sm text-slate-400 mt-1",children:"PDF, DOCX, TXT, or MD up to 50MB"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:["Title ",(0,l.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,l.jsx)("input",{type:"text",value:o,onChange:e=>p(e.target.value),placeholder:"e.g., AI Ethics Policy v2.0",className:"w-full px-3 py-2 border border-slate-300 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Description"}),(0,l.jsx)("textarea",{value:h,onChange:e=>b(e.target.value),placeholder:"Brief description of the document...",rows:2,className:"w-full px-3 py-2 border border-slate-300 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Document Type"}),(0,l.jsx)("select",{value:f,onChange:e=>j(e.target.value),className:"w-full px-3 py-2 border border-slate-300 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white",children:C.map(e=>(0,l.jsx)("option",{value:e,children:e},e))})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:"Applicable Frameworks"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:A.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>{y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:"px-2.5 py-1 text-xs font-medium border transition-colors ".concat(v.includes(e)?"bg-blue-100 text-blue-700 border-blue-300":"bg-white text-slate-600 border-slate-300 hover:bg-slate-50"),children:e.replace(/_/g," ")},e))})]}),P&&(0,l.jsx)(k.Fc,{variant:"destructive",title:"Upload rejected",children:(0,l.jsx)("p",{className:"text-sm",children:P})}),T&&U&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)(k.Fc,{variant:"warning",title:"Industry applicability notice",children:(0,l.jsx)("p",{className:"text-sm",children:T})}),(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsx)(N.$,{size:"sm",variant:"outline",onClick:()=>{R(),s()},children:"Acknowledge & Close"})})]}),w&&(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-1",children:[(0,l.jsx)("span",{children:"Uploading & processing..."}),(0,l.jsxs)("span",{children:[_,"%"]})]}),(0,l.jsx)("div",{className:"w-full h-2 bg-slate-200 overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-blue-600 transition-all duration-300",style:{width:"".concat(_,"%")}})})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-3 p-4 border-t border-slate-200 bg-slate-50",children:[(0,l.jsx)(N.$,{variant:"outline",size:"sm",onClick:q,disabled:w,children:"Cancel"}),(0,l.jsx)(N.$,{size:"sm",onClick:E,disabled:!r||!o.trim()||w,children:w?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i.A,{className:"w-4 h-4 animate-spin mr-1.5"}),"Processing..."]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(m.A,{className:"w-4 h-4 mr-1.5"}),"Upload & Process"]})})]})]})]}):null}function _(){let e=(0,n.useRouter)(),{user:t}=(0,y.As)(),[s,d]=(0,a.useState)([]),[u,x]=(0,a.useState)(!0),[j,v]=(0,a.useState)(!0),[k,A]=(0,a.useState)(null),[_,F]=(0,a.useState)(""),[P,M]=(0,a.useState)(""),[T,z]=(0,a.useState)(""),[U,I]=(0,a.useState)(!1),[O,X]=(0,a.useState)(null),H=(0,a.useCallback)(async()=>{v(!0);try{let e={};P&&(e.document_type=P),T&&(e.status_filter=T),_&&(e.search=_);let t=await g.default.get("/governance/documents",{params:e});d(t.data.items),x(void 0===t.data.has_data?t.data.items.length>0:t.data.has_data),A(null)}catch(e){A("Failed to load documents. The service may be unavailable."),d([]),x(!1)}finally{v(!1)}},[P,T,_]);(0,a.useEffect)(()=>{H()},[H]);let R=async e=>{try{await g.default.delete("/governance/documents/".concat(e)),d(t=>t.filter(t=>t.id!==e)),X(null)}catch(e){A("Failed to delete document.")}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-6",children:[(0,l.jsxs)("div",{className:"relative flex-1 min-w-[240px]",children:[(0,l.jsx)(p.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}
1),(0,l.jsx)("input",{type:"text",value:_,onChange:e=>F(e.target.value),placeholder:"Search documents...",className:"w-full pl-9 pr-3 py-2 border border-slate-300 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(h.A,{className:"w-4 h-4 text-slate-400"}),(0,l.jsxs)("select",{value:P,onChange:e=>M(e.target.value),className:"px-3 py-2 border border-slate-300 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:[(0,l.jsx)("option",{value:"",children:"All Types"}),C.map(e=>(0,l.jsx)("option",{value:e,children:e},e))]}),(0,l.jsxs)("select",{value:T,onChange:e=>z(e.target.value),className:"px-3 py-2 border border-slate-300 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:[(0,l.jsx)("option",{value:"",children:"All Status"}),(0,l.jsx)("option",{value:"Pending",children:"Pending"}),(0,l.jsx)("option",{value:"Processing",children:"Processing"}),(0,l.jsx)("option",{value:"Complete",children:"Complete"}),(0,l.jsx)("option",{value:"Failed",children:"Failed"})]})]}),(0,l.jsxs)(N.$,{size:"sm",onClick:()=>I(!0),children:[(0,l.jsx)(m.A,{className:"w-4 h-4 mr-1.5"}),"Upload Document"]})]}),k&&(0,l.jsx)("div",{className:"p-3 mb-4 bg-red-50 border border-red-200 text-sm text-red-700",children:k}),j&&(0,l.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,l.jsx)(i.A,{className:"w-8 h-8 animate-spin text-blue-600"})}),!j&&!u&&(0,l.jsx)(w.X,{icon:(0,l.jsx)(b.A,{className:"w-10 h-10 text-slate-300"}),title:"No compliance documents yet",description:"Upload your AI governance policies, vendor contracts, or audit artifacts to start building your evidence vault.",action:{label:"Upload Document",onClick:()=>I(!0)}}),!j&&u&&0===s.length&&(0,l.jsx)("div",{className:"text-center py-12 text-sm text-slate-500",children:"No documents match the current filters."}),!j&&s.length>0&&(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:s.map(t=>{var s;let a=function(e){switch(e){case"Complete":return{bg:"bg-green-100",text:"text-green-700",icon:r.A};case"Processing":return{bg:"bg-blue-100",text:"text-blue-700",icon:i.A};case"Failed":return{bg:"bg-red-100",text:"text-red-700",icon:c.A};default:return{bg:"bg-yellow-100",text:"text-yellow-700",icon:o.A}}}(t.status),n=a.icon;return(0,l.jsx)("div",{className:"bg-white border border-slate-200 hover:border-slate-300 hover:shadow-sm transition-all cursor-pointer",onClick:()=>e.push("/app/comply/documents/".concat(t.id)),children:(0,l.jsxs)("div",{className:"p-4",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-mono font-bold bg-slate-100 text-slate-600",children:(s=t.mime_type)?s.includes("pdf")?"PDF":s.includes("word")||s.includes("docx")?"DOCX":s.includes("markdown")?"MD":"TXT":"TXT"}),(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium ".concat(function(e){switch(e){case"Policy":case"Procedure":return"bg-blue-100 text-blue-700";case"Standard":return"bg-purple-100 text-purple-700";case"Guideline":return"bg-teal-100 text-teal-700";case"Framework":return"bg-orange-100 text-orange-700";case"Audit Report":return"bg-red-100 text-red-700";default:return"bg-slate-100 text-slate-700"}}(t.document_type)),children:t.document_type})]}),(0,l.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs font-medium ".concat(a.bg," ").concat(a.text),children:[(0,l.jsx)(n,{className:"w-3 h-3 ".concat("Processing"===t.status?"animate-spin":"")}),t.status]})]}),(0,l.jsx)("h3",{className:"font-semibold text-slate-900 text-sm line-clamp-1 mb-0.5",children:t.title}),(0,l.jsxs)("p",{className:"text-xs text-slate-500 line-clamp-1 mb-2",children:[t.filename," \xb7 ",D(t.size_bytes)]}),t.description&&(0,l.jsx)("p",{className:"text-xs text-slate-500 line-clamp-2 mb-3",children:t.description}),t.frameworks.length>0&&(0,l.jsxs)("div",{className:"flex flex-wrap gap-1 mb-3",children:[t.frameworks.slice(0,3).map(e=>(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-50 text-blue-600 border border-blue-200",children:e.replace(/_/g," ")},e)),t.frameworks.length>3&&(0,l.jsxs)("span",{className:"px-1.5 py-0.5 text-[10px] text-slate-500",children:["+",t.frameworks.length-3," more"]})]}),t.topics.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-1 mb-3",children:t.topics.slice(0,4).map(e=>(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] bg-slate-100 text-slate-600",children:e},e))}),(0,l.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-slate-100",children:[(0,l.jsx)("span",{className:"text-[11px] text-slate-400",children:new Date(t.uploaded_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[t.entity_count>0&&(0,l.jsxs)("span",{className:"text-[11px] text-slate-500",children:[t.entity_count," entities"]}),t.findings_count>0&&(0,l.jsxs)("span",{className:"text-[11px] text-orange-600 font-medium",children:[t.findings_count," findings"]}),(0,l.jsx)("button",{onClick:e=>{e.stopPropagation(),X(t.id)},className:"p-1 text-slate-400 hover:text-red-500",title:"Delete document",children:(0,l.jsx)(f.A,{className:"w-3.5 h-3.5"})})]})]})]})},t.id)})}),(0,l.jsx)(S,{open:U,onClose:()=>I(!1),onUploaded:H}),O&&(0,l.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm",onClick:()=>X(null)}),(0,l.jsxs)("div",{className:"relative bg-white shadow-xl p-6 max-w-sm w-full",children:[(0,l.jsx)("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:"Delete Document?"}),(0,l.jsx)("p",{className:"text-sm text-slate-600 mb-4",children:"This action cannot be undone. The document and all processing results will be permanently removed."}),(0,l.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,l.jsx)("button",{onClick:()=>X(null),className:"px-4 py-2 text-sm font-medium text-slate-700 border border-slate-300 hover:bg-slate-100",children:"Cancel"}),(0,l.jsx)("button",{onClick:()=>R(O),className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700",children:"Delete"})]})]})]})]})}function F(){return(0,l.jsx)(j.PageShell,{title:"Compliance Documents",subtitle:"Compliance Documents â part of the Comply suite",helpContent:v.nc.complyDocuments,icon:(0,l.jsx)(b.A,{className:"w-5 h-5 text-blue-500"}),children:(0,l.jsx)(_,{})})}},46701:(e,t,s)=>{s.d(t,{A:()=>l});let l=(0,s(45105).A)("FileUp",[["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:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]])},63581:(e,t,s)=>{s.d(t,{A:()=>l});let l=(0,s(45105).A)("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]])},89715:(e,t,s)=>{s.d(t,{A:()=>l});let l=(0,s(45105).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"}]])},92001:(e,t,s)=>{s.d(t,{A:()=>l});let l=(0,s(45105).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"}]])}}]);
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.