var m=Object.defineProperty;var a=(o,r)=>m(o,"name",{value:r,configurable:!0});import{e as l,E as f,I as u}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{p as i}from"./bin.js";import{g as $}from"../packem_shared/osv-bloom-0Vu8YRhg.js";var d=Object.defineProperty,n=a((o,r)=>d(o,"name",{value:r,configurable:!0}),"s");const c=n(o=>{if(!o)return"never";const r=Date.parse(o);if(Number.isNaN(r))return o;const t=Date.now()-r;if(t<0)return o;const e=Math.floor(t/6e4);if(e<1)return"just now";if(e<60)return`${e}m ago`;const s=Math.floor(e/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`},"formatRelative"),p=n(o=>o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`,"formatBytes"),g=n(async({options:o,workspaceRoot:r})=>{if(!r)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const t=await $(r,o.cacheDir);if(o.format==="json"){process.stdout.write(`${JSON.stringify(t,void 0,2)}
`);return}if(i.info(`Cache: ${t.cacheDir}`),!t.present){i.warn(`No osv-bloom filter yet. Run ${l("vis advisories bloom sync")} to populate.`);return}if(t.manifest){const{manifest:e}=t;i.info(`Built:  ${e.builtAtRfc3339} (${c(e.builtAtRfc3339)})`),i.info(`Fetch:  ${t.fetchedAtIso??f("—")} (${c(t.fetchedAtIso)})`),i.info(`Filter: ${u(p(e.bloomByteLen))}   m=${e.bloomMBits.toLocaleString()} bits   k=${String(e.bloomKHashes)}`),i.info(`Set:    ${e.entryCount.toLocaleString()} entries from ${e.advisoryCount.toLocaleString()} advisories (target FPR ${e.targetFpr})`),i.info(f(`Digest: ${e.setDigestSha256}`))}else i.warn("filter.bin present but manifest.json missing — `vis advisories bloom sync` will rewrite the cache.")},"execute"),y=g;export{y as advisoriesBloomStatusExecute};
