import{C as d,a as r,b as i,n as m}from"./types-Cay-L1a6.js";const b={EXTERNAL_FEATURE_GROUP:r.externalFeatureGroup,FEATURE_GROUP:r.featureGroup,FEATURE_VIEW:r.featureView,TRAINING_DATASET:r.trainingDataset,MODEL:r.model,STORAGE_CONNECTOR:r.storageConnector},w={[r.storageConnector]:d.black,[r.featureGroup]:d.orange,[r.externalFeatureGroup]:d.blue,[r.featureView]:d.purple,[r.trainingDataset]:d.green,[r.model]:d.blueShade1,[r.experiment]:d.red,[r.link]:d.black},N=e=>{const a=u(e),n=[],c=[],s=new Set;h(a,e.upstream,n,c,s);const o=[],t=[],p=new Set;E(a,e.downstream,o,t,p);const l={nodes:n,links:c},f={nodes:o,links:t},y=l.nodes.length+f.nodes.length;return{root:a,upstream:l,downstream:f,count:y}},T=(e,a)=>({source:m(e),target:m(a),type:r.link,metaType:i.current}),u=e=>{var c,s;const a=o=>o.deleted?i.deleted:o.accessible?o.shared?i.shared:o.exceptionCause?i.faulty:i.current:i.notAccessible,n={id:e.node.artifact.id,name:e.node.artifact.name,deprecated:(c=e.node.artifact)==null?void 0:c.deprecated,version:e.node.artifact.version,project:"unknown",type:b[e.node.artifactType],metaType:a(e.node),artifact:{href:(s=e.node.artifact)==null?void 0:s.href},deleted:e.node.deleted,traversed:e.node.traversed};return e.node.accessible?n.project=e.node.artifact.featurestoreName:n.project=e.node.artifact.project,n},h=(e,a,n,c,s)=>{a.forEach(o=>{const t=u(o);s.has(`${t.id}_${t.type}`)||(s.add(`${t.id}_${t.type}`),n.push(t)),c.push(T(e,t)),h(t,o.upstream,n,c,s)})},E=(e,a,n,c,s)=>{a.forEach(o=>{const t=u(o);s.has(`${t.id}_${t.type}`)||(s.add(`${t.id}_${t.type}`),n.push(t));const p=T(e,t);c.push(p),E(t,o.downstream,n,c,s)})};export{N as b,w as c};
