1import{s as z}from"./rolldown-runtime-aoxQmdZa.js";import{or as _,rr as N}from"./vendor-C44JUHxF.js";import{r as L}from"./apiBase-BqVXqfJu.js";import{c as l,d as P,n as U}from"./theme-Cmxze0rk.js";var a=z(_(),1),e=N(),t={bg:"#05070A",surface:"#0A0D12",surface2:"#11151C",hairline:"#1E2530",hairline2:"#262D39",gold:"#C9A961",goldSoft:"#8C7540",info:"#7FA5C8",infoGlow:"rgba(127,165,200,0.12)",platinum:"#EAECEF",ink2:"#C4CAD3",ink3:"#A8B0BC",ink4:"#6B7380",ink5:"#4A515D",up:"#5FBF8B"};function V({onClose:n,conversation:o,sessionId:s,onStatusMessage:f}){const[j,O]=(0,a.useState)(!0),[k,T]=(0,a.useState)(!0),[v,M]=(0,a.useState)(!0),[w,B]=(0,a.useState)(!0),[b,R]=(0,a.useState)(!0),[p,F]=(0,a.useState)(!1),[g,E]=(0,a.useState)(null),m=(0,a.useMemo)(()=>{const i=o||[],c=i.filter(r=>r.role==="user").length,h=i.filter(r=>r.role==="assistant").length,u=new Set;return i.forEach(r=>{Array.isArray(r.sources)&&r.sources.forEach(d=>u.add(d.url||d.id||d.title)),Array.isArray(r.citations)&&r.citations.forEach(d=>u.add(d.url||d.id))}),{total:i.length,user:c,asst:h,sources:u.size}},[o]),x=(0,a.useMemo)(()=>s||"ARN-"+new Date().toISOString().slice(0,10).replace(/-/g,"")+"-"+Math.random().toString(36).slice(2,6).toUpperCase(),[s]);function A(i){f&&f(i)}async function D(){F(!0),A("Preparing audit bundleâ¦");try{const i={session_id:x,generated:new Date().toISOString(),platform:"arenberg",includes:{pdf:j,jsonl:k,sources:v,actions:w,custody:b},messages:(o||[]).map(r=>({id:r.id||null,role:r.role,text:r.text||r.content||"",ts:r.ts||r.timestamp||null,sources:r.sources||r.citations||[]})),custody:b?I(x):null};let c=null;try{const r=await fetch(L("/api/arenberg/audit/export"),{method:"POST",headers:{"Content-Type":"application/json","X-Platform":"arenberg"},body:JSON.stringify(i)});if(r.ok){const d=await r.blob();c=URL.createObjectURL(d)}}catch{}if(!c){const r=new Blob([JSON.stringify(i,null,2)],{type:"application/json"});c=URL.createObjectURL(r)}const h=x+"-audit.json";E({url:c,name:h,generated:i.generated,stats:m});const u=document.createElement("a");u.href=c,u.download=h,u.click(),A("Audit bundle exported â "+h)}catch(i){A("Audit export failed: "+(i&&i.message?i.message:"unknown error"))}finally{F(!1)}}return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(W,{title:"AUDIT",subtitle:"Compliance export bundle",onClose:n}),(0,e.jsxs)("div",{style:{flex:1,overflow:"auto",padding:20,display:"flex",flexDirection:"column",gap:16},children:[(0,e.jsxs)("div",{style:{background:t.surface,border:"1px solid "+t.hairline,borderRadius:6,padding:16,display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:16},children:[(0,e.jsx)(S,{value:m.total,label:"Messages"}),(0,e.jsx)(S,{value:m.user,label:"Prompts"}),(0,e.jsx)(S,{value:m.asst,label:"Replies"}),(0,e.jsx)(S,{value:m.sources,label:"Sources",accent:t.info})]}),(0,e.jsx)(C,{label:"Bundle contents",children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsx)(y,{checked:j,onToggle:()=>O(!j),label:"Conversation (PDF, Arenberg-branded)",detail:"Immutable narrative snapshot with header + footer stamps"}),(0,e.jsx)(y,{checked:k,onToggle:()=>T(!k),label:"Full trail (JSONL)",detail:"One JSON per turn â raw data for independent review"}),(0,e.jsx)(y,{checked:v,onToggle:()=>M(!v),label:"Source manifest (SHA-256)",detail:"Hash of every referenced document, URL, article, vault file"}),(0,e.jsx)(y,{checked:w,onToggle:()=>B(!w),label:"Action log",detail:"Every tool call, module open/close, export â who did what, when"}),(0,e.jsx)(y,{checked:b,onToggle:()=>R(!b),label:"Chain of custody",detail:"Platform · user · MFA state · node · IP · timezone"})]})}),(0,e.jsx)(C,{label:"Chain of custody preview",children:(0,e.jsx)("pre",{style:{fontFamily:l,fontSize:10,color:t.ink3,background:t.surface,border:"1px solid "+t.hairline,borderRadius:6,padding:14,margin:0,whiteSpace:"pre-wrap",lineHeight:1.7},children:q(I(x))})}),g&&(0,e.jsx)(C,{label:"Latest export",children:(0,e.jsxs)("div",{style:{background:t.surface,border:"1px solid "+t.hairline,borderRadius:6,padding:12,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[(0,e.jsxs)("div",{style:{minWidth:0},children:[(0,e.jsx)("div",{style:{fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:11,color:t.platinum,fontWeight:600},children:g.name}),(0,e.jsx)("div",{style:{fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:9,color:t.ink4,marginTop:4,letterSpacing:".1em"}
1,children:new Date(g.generated).toLocaleString()})]}),(0,e.jsx)("a",{href:g.url,download:g.name,children:(0,e.jsx)(J,{label:"REDOWNLOAD"})})]})})]}),(0,e.jsxs)("div",{style:{flexShrink:0,padding:"14px 20px",borderTop:"1px solid "+t.hairline,display:"flex",alignItems:"center",gap:14,background:t.surface},children:[(0,e.jsxs)("div",{style:{flex:1,fontFamily:l,fontSize:9,color:t.ink4,letterSpacing:".1em"},children:[U.short," · SESSION ",x]}),(0,e.jsx)("button",{onClick:D,disabled:p,style:{padding:"10px 22px",background:p?t.surface2:t.info,border:"1px solid "+(p?t.hairline:t.info),color:p?t.ink4:"#05070A",fontFamily:l,fontSize:10,fontWeight:700,letterSpacing:".18em",borderRadius:4,cursor:p?"not-allowed":"pointer"},children:p?"SEALINGâ¦":"EXPORT BUNDLE"})]})]})}function W({title:n,subtitle:o,onClose:s}){return(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",borderBottom:"1px solid "+t.hairline,background:t.surface,flexShrink:0},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:14},children:[(0,e.jsx)("span",{style:{fontFamily:P,fontSize:20,color:t.platinum,letterSpacing:".04em"},children:n}),(0,e.jsx)("span",{style:{fontFamily:l,fontSize:9,color:t.info,letterSpacing:".2em",textTransform:"uppercase"},children:o})]}),(0,e.jsx)("button",{onClick:s,style:{background:"transparent",border:"1px solid "+t.hairline,borderRadius:4,padding:"4px 12px",cursor:"pointer",fontFamily:l,fontSize:9,color:t.ink3,letterSpacing:".08em"},children:"â CLOSE"})]})}function C({label:n,children:o}){return(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{style:{fontFamily:l,fontSize:8,letterSpacing:".26em",color:t.ink5,textTransform:"uppercase",marginBottom:8},children:n}),o]})}function S({value:n,label:o,accent:s}){return(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{style:{fontFamily:l,fontSize:26,fontWeight:700,color:s||t.platinum,letterSpacing:"-.01em"},children:n}),(0,e.jsx)("div",{style:{fontFamily:l,fontSize:8,color:t.ink4,letterSpacing:".22em",textTransform:"uppercase",marginTop:4},children:o})]})}function y({checked:n,onToggle:o,label:s,detail:f}){return(0,e.jsxs)("button",{onClick:o,style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 10px",textAlign:"left",background:"transparent",border:"1px solid "+t.hairline,borderRadius:5,cursor:"pointer",transition:"all .12s"},children:[(0,e.jsx)("div",{style:{width:14,height:14,flexShrink:0,marginTop:2,border:"1px solid "+(n?t.info:t.hairline2),background:n?t.info:"transparent",borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",color:"#05070A",fontSize:9,fontWeight:900},children:n?"â":""}),(0,e.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,e.jsx)("div",{style:{fontFamily:l,fontSize:10,color:n?t.platinum:t.ink2,fontWeight:600,letterSpacing:".04em"},children:s}),f&&(0,e.jsx)("div",{style:{fontFamily:"'Inter Tight', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",fontSize:10,color:t.ink4,marginTop:2},children:f})]})]})}function J({label:n,onClick:o}){return(0,e.jsx)("button",{onClick:o,style:{padding:"6px 12px",background:"transparent",border:"1px solid "+t.hairline,color:t.ink2,fontFamily:l,fontSize:9,letterSpacing:".12em",fontWeight:600,borderRadius:4,cursor:"pointer"},children:n})}function I(n){let o="anonymous";try{o=JSON.parse(localStorage.getItem("arenberg_session_v1")||"null")?"arenberg-user":"anonymous"}catch{}return{session_id:n,platform:"arenberg",user:o,mfa:!0,node:H(),timezone:Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:"UTC",user_agent:typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.
1slice(0,120):"unknown",generated:new Date().toISOString()}}function H(){try{const n=window&&window.location?window.location.hostname:"";return n?n.indexOf("eu")===0?"eu-west-1":n.indexOf("us")===0?"us-east-1":n:"unknown"}catch{return"unknown"}}function q(n){return Object.keys(n).map(o=>{const s=typeof n[o]=="string"?n[o]:JSON.stringify(n[o]);return o.padEnd(12)+" · "+s}).join(` 2`)}export{V 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.