const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B-P3N9PO2.js","./CEAqikhf2.js","./DsQIgu-4.js","./DrKWWDpL.js"])))=>i.map(i=>d[i]);
import{s as e}from"./DrKWWDpL.js";import{n as t,t as n}from"./DsQIgu-4.js";import{t as r}from"./DYP3EJMY.js";import{t as i}from"./DTkg6Mnx.js";import{O as a,k as o}from"./D-eE9s2f.js";import{r as s}from"./bG-fsHMS.js";var c=e(r(),1);t();var l=i(`brain-graph`);async function u(e){try{let{isAutoCaptureEnabled:t}=await n(async()=>{let{isAutoCaptureEnabled:e}=await import(`./B-P3N9PO2.js`);return{isAutoCaptureEnabled:e}},__vite__mapDeps([0,1,2,3]),import.meta.url);return t(e)}catch{return!1}}async function d(e,t,n,r,i,a,d){try{if(!await u(e))return;let l=await s(e),f=new Date().toISOString().replace(`T`,` `).slice(0,19),p=a.trim().toLowerCase(),m=p?(0,c.createHash)(`sha256`).update(p).digest(`hex`).substring(0,16):null;await l.insert(o).values({id:t,nodeType:n,label:r.substring(0,200),qualityScore:i,contentHash:m,metadataJson:d?JSON.stringify(d):null,lastActivityAt:f,createdAt:f,updatedAt:f}).onConflictDoUpdate({target:o.id,set:{label:r.substring(0,200),qualityScore:i,lastActivityAt:f,updatedAt:f,metadataJson:d?JSON.stringify(d):null}})}catch(e){l.warn({err:e},`upsertGraphNode failed`)}}async function f(e,t,n,r,i=1,o){try{if(!await u(e))return;let c=await s(e),l=new Date().toISOString().replace(`T`,` `).slice(0,19);await c.insert(a).values({fromId:t,toId:n,edgeType:r,weight:i,provenance:o??null,createdAt:l}).onConflictDoNothing()}catch(e){l.warn({err:e},`addGraphEdge failed`)}}async function p(e,t,n,r){try{await d(e,`task:${t}`,`task`,`${t}: ${n}`.substring(0,200),.7,n,r)}catch(e){l.warn({err:e},`ensureTaskNode failed`)}}export{p as n,d as r,f as t};