Spaces:
Sleeping
Sleeping
var qe=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var u=(e,n,t)=>(qe(e,n,"read from private field"),t?t.call(e):n.get(e)),S=(e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)},W=(e,n,t,r)=>(qe(e,n,"write to private field"),r?r.call(e,t):n.set(e,t),t);var je=(e,n,t,r)=>({set _(o){W(e,n,o,t)},get _(){return u(e,n,r)}}),ee=(e,n,t)=>(qe(e,n,"access private method"),t);import{r as _,p as Xt,q as Kt,c as H,s as vn,_ as Qt,K as bn,b as Zt,n as Jt,u as fe,v as er,w as nr,T as tr,C as rr,D as or,x as sr,W as ir,y as ar,R as we,k as De,z as ze,B as dn,j as m,E as He,l as Hn,m as be,F as cr,G as lr,H as dr,I as hr,J as ur,M as yn}from"./index-bf3ffc0f.js";/* empty css */import{u as tn,s as fr,c as pr,g as mr,a as gr,b as Wn,d as wr,e as $e,f as hn,r as Un,N as Oe,H as Re,P as We,D as qn,M as Yn,C as Xn,h as Kn,T as Qn,A as Zn,B as Jn,i as et,j as nt,k as tt,l as rt,m as ot,n as st,o as vr,p as br,q as yr,E as kr,G as Er,t as it,v as Nr,w as at,x as ct,R as _r,y as xr,z as Cr,F as Ir,I as Sr,J as $r,K as jr,L as Tr}from"./stripPrefix-9e0e3f0d.js";import{g as lt,Z as Or,a as Lr,G as Pr}from"./routes-17d4ed4d.js";import{u as dt}from"./index-68d29b47.js";import{L as Mr,A as Br,S as Fr}from"./LeftArrow-9f6b70a1.js";var Gr=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],ht=_.forwardRef(function(e,n){var t,r=e.prefixCls,o=r===void 0?"rc-switch":r,s=e.className,i=e.checked,a=e.defaultChecked,c=e.disabled,l=e.loadingIcon,d=e.checkedChildren,h=e.unCheckedChildren,f=e.onClick,p=e.onChange,g=e.onKeyDown,v=Xt(e,Gr),w=dt(!1,{value:i,defaultValue:a}),y=Kt(w,2),b=y[0],k=y[1];function x(N,V){var T=b;return c||(T=N,k(T),p==null||p(T,V)),T}function L(N){N.which===bn.LEFT?x(!1,N):N.which===bn.RIGHT&&x(!0,N),g==null||g(N)}function E(N){var V=x(!b,N);f==null||f(V,N)}var P=H(o,s,(t={},vn(t,"".concat(o,"-checked"),b),vn(t,"".concat(o,"-disabled"),c),t));return _.createElement("button",Qt({},v,{type:"button",role:"switch","aria-checked":b,disabled:c,className:P,ref:n,onKeyDown:L,onClick:E}),l,_.createElement("span",{className:"".concat(o,"-inner")},_.createElement("span",{className:"".concat(o,"-inner-checked")},d),_.createElement("span",{className:"".concat(o,"-inner-unchecked")},h)))});ht.displayName="Switch";const Vr=e=>{const{componentCls:n,trackHeightSM:t,trackPadding:r,trackMinWidthSM:o,innerMinMarginSM:s,innerMaxMarginSM:i,handleSizeSM:a,calc:c}=e,l=`${n}-inner`,d=fe(c(a).add(c(r).mul(2)).equal()),h=fe(c(i).mul(2).equal());return{[n]:{[`&${n}-small`]:{minWidth:o,height:t,lineHeight:fe(t),[`${n}-inner`]:{paddingInlineStart:i,paddingInlineEnd:s,[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${h})`,marginInlineEnd:`calc(100% - ${d} + ${h})`},[`${l}-unchecked`]:{marginTop:c(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${n}-handle`]:{width:a,height:a},[`${n}-loading-icon`]:{top:c(c(a).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${n}-checked`]:{[`${n}-inner`]:{paddingInlineStart:s,paddingInlineEnd:i,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${h})`,marginInlineEnd:`calc(-100% + ${d} - ${h})`}},[`${n}-handle`]:{insetInlineStart:`calc(100% - ${fe(c(a).add(r).equal())})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:c(e.marginXXS).div(2).equal(),marginInlineEnd:c(e.marginXXS).mul(-1).div(2).equal()}},[`&${n}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:c(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:c(e.marginXXS).div(2).equal()}}}}}}},Rr=e=>{const{componentCls:n,handleSize:t,calc:r}=e;return{[n]:{[`${n}-loading-icon${e.iconCls}`]:{position:"relative",top:r(r(t).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${n}-checked ${n}-loading-icon`]:{color:e.switchColor}}}},Ar=e=>{const{componentCls:n,trackPadding:t,handleBg:r,handleShadow:o,handleSize:s,calc:i}=e,a=`${n}-handle`;return{[n]:{[a]:{position:"absolute",top:t,insetInlineStart:t,width:s,height:s,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:r,borderRadius:i(s).div(2).equal(),boxShadow:o,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${n}-checked ${a}`]:{insetInlineStart:`calc(100% - ${fe(i(s).add(t).equal())})`},[`&:not(${n}-disabled):active`]:{[`${a}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${n}-checked ${a}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},Dr=e=>{const{componentCls:n,trackHeight:t,trackPadding:r,innerMinMargin:o,innerMaxMargin:s,handleSize:i,calc:a}=e,c=`${n}-inner`,l=fe(a(i).add(a(r).mul(2)).equal()),d=fe(a(s).mul(2).equal());return{[n]:{[c]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:s,paddingInlineEnd:o,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${c}-checked, ${c}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none"},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${l} - ${d})`,marginInlineEnd:`calc(100% - ${l} + ${d})`},[`${c}-unchecked`]:{marginTop:a(t).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${n}-checked ${c}`]:{paddingInlineStart:o,paddingInlineEnd:s,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${l} + ${d})`,marginInlineEnd:`calc(-100% + ${l} - ${d})`}},[`&:not(${n}-disabled):active`]:{[`&:not(${n}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:a(r).mul(2).equal(),marginInlineEnd:a(r).mul(-1).mul(2).equal()}},[`&${n}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:a(r).mul(-1).mul(2).equal(),marginInlineEnd:a(r).mul(2).equal()}}}}}},zr=e=>{const{componentCls:n,trackHeight:t,trackMinWidth:r}=e;return{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},er(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:r,height:t,lineHeight:`${fe(t)}`,verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${n}-disabled)`]:{background:e.colorTextTertiary}}),nr(e)),{[`&${n}-checked`]:{background:e.switchColor,[`&:hover:not(${n}-disabled)`]:{background:e.colorPrimaryHover}},[`&${n}-loading, &${n}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${n}-rtl`]:{direction:"rtl"}})}},Hr=e=>{const{fontSize:n,lineHeight:t,controlHeight:r,colorWhite:o}=e,s=n*t,i=r/2,a=2,c=s-a*2,l=i-a*2;return{trackHeight:s,trackHeightSM:i,trackMinWidth:c*2+a*4,trackMinWidthSM:l*2+a*2,trackPadding:a,handleBg:o,handleSize:c,handleSizeSM:l,handleShadow:`0 2px 4px 0 ${new tr("#00230b").setAlpha(.2).toRgbString()}`,innerMinMargin:c/2,innerMaxMargin:c+a+a*2,innerMinMarginSM:l/2,innerMaxMarginSM:l+a+a*2}},Wr=Zt("Switch",e=>{const n=Jt(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[zr(n),Dr(n),Ar(n),Rr(n),Vr(n)]},Hr);var Ur=globalThis&&globalThis.__rest||function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]]);return t};const ut=_.forwardRef((e,n)=>{const{prefixCls:t,size:r,disabled:o,loading:s,className:i,rootClassName:a,style:c,checked:l,value:d,defaultChecked:h,defaultValue:f,onChange:p}=e,g=Ur(e,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[v,w]=dt(!1,{value:l??d,defaultValue:h??f}),{getPrefixCls:y,direction:b,switch:k}=_.useContext(rr),x=_.useContext(or),L=(o??x)||s,E=y("switch",t),P=_.createElement("div",{className:`${E}-handle`},s&&_.createElement(ar,{className:`${E}-loading-icon`})),[N,V,T]=Wr(E),oe=sr(r),pe=H(k==null?void 0:k.className,{[`${E}-small`]:oe==="small",[`${E}-loading`]:s,[`${E}-rtl`]:b==="rtl"},i,a,V,T),I=Object.assign(Object.assign({},k==null?void 0:k.style),c),O=function(){w(arguments.length<=0?void 0:arguments[0]),p==null||p.apply(void 0,arguments)};return N(_.createElement(ir,{component:"Switch"},_.createElement(ht,Object.assign({},g,{checked:v,onChange:O,prefixCls:E,className:pe,style:I,disabled:L,ref:n,loadingIcon:P}))))});ut.__ANT_SWITCH=!0;const qr=ut;var Q;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Q||(Q={}));function Yr({color:e,dimensions:n,lineWidth:t}){return we.createElement("path",{stroke:e,strokeWidth:t,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`})}function Xr({color:e,radius:n}){return we.createElement("circle",{cx:n,cy:n,r:n,fill:e})}const Kr={[Q.Dots]:"#91919a",[Q.Lines]:"#eee",[Q.Cross]:"#e2e2e2"},Qr={[Q.Dots]:1,[Q.Lines]:1,[Q.Cross]:6},Zr=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ft({id:e,variant:n=Q.Dots,gap:t=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:a,className:c}){const l=_.useRef(null),{transform:d,patternId:h}=tn(Zr,fr),f=i||Kr[n],p=r||Qr[n],g=n===Q.Dots,v=n===Q.Cross,w=Array.isArray(t)?t:[t,t],y=[w[0]*d[2]||1,w[1]*d[2]||1],b=p*d[2],k=v?[b,b]:y,x=g?[b/s,b/s]:[k[0]/s,k[1]/s];return we.createElement("svg",{className:pr(["react-flow__background",c]),style:{...a,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:l,"data-testid":"rf__background"},we.createElement("pattern",{id:h+e,x:d[0]%y[0],y:d[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${x[0]},-${x[1]})`},g?we.createElement(Xr,{color:f,radius:b/s}):we.createElement(Yr,{dimensions:k,color:f,lineWidth:o})),we.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`}))}ft.displayName="Background";var Jr=_.memo(ft);async function eo(e,n){e||(e="ClimateGPT-13B"),Wn(e);const t=`${mr()}/${n}`,r=await fetch(t,{});return r.status===404||r.status===401?{nodes:[],edges:[]}:(await r.json()).graph}async function no(e,n){Wn(e);const t=`${gr()}/${n}`,r=await fetch(t,{});return r.status===404||r.status===401?{nodes:[],edges:[]}:(await r.json()).graph}const to="_container_icmxu_8",ro="_topBar_icmxu_19",oo="_vcModeOn_icmxu_32",so="_labelContainer_icmxu_36",io="_nodeType_icmxu_41",ao="_nodeLabel_icmxu_47",co="_nodeTypeLarge_icmxu_54",lo="_topBarIsVCUnknown_icmxu_68",ho="_bottomBarIsVCUnknown_icmxu_70",uo="_topBarIsVCNone_icmxu_73",fo="_bottomBarIsVCNone_icmxu_77",po="_zoomedOutFar_icmxu_82",mo="_icon_icmxu_82",go="_badge_icmxu_87",wo="_iconContainer_icmxu_94",vo="_vcNone_icmxu_105",bo="_containerIsPill_icmxu_119",yo="_displayType_icmxu_123",ko="_displayTypeZoomed_icmxu_127",Eo="_bottomBar_icmxu_70",No="_clickableArea_icmxu_142",_o="_flex_icmxu_145",xo="_benchmark_icmxu_149",Co="_active_icmxu_174",Io="_benchmarkVc_icmxu_179",So="_benchmarkNone_icmxu_182",$o="_vcTrusted_icmxu_191",jo="_vcUntrusted_icmxu_193",To="_vcUnknown_icmxu_195",C={"selected-node":"_selected-node_icmxu_5",container:to,topBar:ro,vcModeOn:oo,labelContainer:so,nodeType:io,nodeLabel:ao,nodeTypeLarge:co,topBarIsVCUnknown:lo,bottomBarIsVCUnknown:ho,topBarIsVCNone:uo,bottomBarIsVCNone:fo,zoomedOutFar:po,icon:mo,badge:go,iconContainer:wo,vcNone:vo,containerIsPill:bo,displayType:yo,displayTypeZoomed:ko,bottomBar:Eo,clickableArea:No,flex:_o,benchmark:xo,active:Co,benchmarkVc:Io,benchmarkNone:So,vcTrusted:$o,vcUntrusted:jo,vcUnknown:To},Oo={DataIcon:qn,ModelIcon:Yn,ComputationIcon:Xn,DocumentIcon:Kn,TokenIcon:Qn,AttributionIcon:Zn,BenchmarkIcon:Jn,Benchmark_resultIcon:et,CertificateIcon:nt,CodeIcon:tt,DatabaseIcon:rt,DatasetIcon:ot,Media_fileIcon:st},Lo=e=>Oo[e]||null,Po=({top:e,bottom:n})=>({"--node-color-top":e,"--node-color-bottom":n}),Mo=e=>e.transform[2]>=Or,Bo=e=>e.transform[2]>=Lr,Fo=({id:e,data:n})=>{const{nodeColor:t,label:r,icon:o,sourcePosition:s,displayType:i,typeLabel:a,governanceNodes:c,isSourceForConnection:l,isTargetForConnection:d,benchmarks:h}=n;wr();const f=De(),p=ze(),[g,v]=dn(),w=p.nodeCid,{graphState:y,vcsToGraph:b,governanceFilter:k,setGovernanceFilter:x,sinks:L,activeSink:E}=$e(M=>({graphState:M.graphState,vcsToGraph:M.vcsToGraph,governanceFilter:M.governanceFilter,setGovernanceFilter:M.setGovernanceFilter,sinks:M.sinks,activeSink:M.activeSink})),P=E?L[E]:null,N=P?P.nodes.has(e)||E===e:!1,V=new Map(h==null?void 0:h.map(M=>[M.id,hn(M.id,b)])),T=Un(Array.from(V.values())),oe=h?h.find(M=>M.id===w):!1,pe=M=>{let de=1;return P&&!w&&(de=N?1:.1),P&&w&&(P.nodes.has(w)||E===w?N?oe?de=1:de=.5:de=.1:de=oe?1:.1),!P&&w&&(de=oe?1:.1),k?{opacity:k.find(qt=>c.some(Yt=>Yt.id===qt))?1:.2}:{opacity:de}},I={"vc-off":{top:t,bottom:"white"},"vc-on":{top:Oe[T],bottom:Oe[T]}},O=y==="vc-on",J={...Po(I[y])},R=H(C.container,{[C.vcModeOn]:O,[C.vcTrusted]:O&&T==="trusted",[C.vcUntrusted]:O&&T==="untrusted",[C.vcUnknown]:O&&T==="unknown",[C.vcNone]:O&&T==="none"}),se=H(C.topBar,{[C.topBarIsVCUnknown]:T==="unknown"&&y==="vc-on",[C.topBarIsVCNone]:T==="none"&&y==="vc-on"}),$=H(C.bottomBar,{[C.bottomBarIsVCUnknown]:T==="unknown"&&y==="vc-on",[C.bottomBarIsVCNone]:T==="none"&&y==="vc-on"});H(C.zoomedOut,{});const j=Lo(o),Y=r.replace(/.{1,20}/g,`$& | |
`);_.useEffect(()=>{w&&x(null)},[w]);const X={top:"30px"},D=tn(Mo);tn(Bo);const[me,wn]=_.useState(!0);return m.jsxs(He.div,{style:J,className:R,animate:{...pe()},initial:{opacity:0},transition:{duration:1},children:[m.jsxs("div",{className:C.clickableArea,children:[m.jsxs("div",{className:se,children:[m.jsx("span",{className:C.iconContainer,children:j&&m.jsx(j,{className:C.icon})}),m.jsxs("div",{className:C.labelContainer,children:[m.jsx("div",{className:C.nodeType,style:{visibility:D?"visible":"hidden"},children:i}),m.jsx("div",{className:C.nodeLabel,style:{visibility:D?"visible":"hidden"},children:Y}),m.jsx("div",{className:C.nodeTypeLarge,style:{display:D?"none":"flex"},children:i})]})]}),m.jsx("div",{className:$,style:{display:me?"block":"none"},children:h==null?void 0:h.map((M,de)=>{const ke=V.get(M.id);return m.jsx("div",{"data-benchmark":M.id,style:{"--node-color-top":O?Oe[ke]:t},className:H(C.benchmark,{[C.active]:w===M.id,[C.benchmarkVc]:O,[C.benchmarkTrusted]:O&&ke==="trusted",[C.benchmarkUntrusted]:O&&ke==="untrusted",[C.benchmarkUnknown]:O&&ke==="unknown",[C.benchmarkNone]:O&&ke==="none"}),onClick:()=>{w!==M.id&&f(lt(`${p.owner}/${p.repo}`)+"/"+M.id+`?${g.toString()}`)},children:M.data.label},M.id)})})]}),d&&m.jsx(Re,{type:"target",position:We.Left,id:"left",style:X}),l&&m.jsx(Re,{type:"source",position:s,id:"source",style:X})]})},Go=_.memo(Fo),Vo="_edge_1ljkl_4",Ro="_icon_1ljkl_9",Ao="_iconVisible_1ljkl_16",Do={edge:Vo,icon:Ro,iconVisible:Ao};function zo(e){var x,L,E,P;const n=ze(),{governanceFilter:t,graphState:r,sinks:o,activeSink:s,getNodeFromFullGraph:i}=$e(N=>({governanceFilter:N.governanceFilter,graphState:N.graphState,sinks:N.sinks,activeSink:N.activeSink,getNodeFromFullGraph:N.getNodeFromFullGraph})),a=s?o[s]:null,c=a?a.edges.has(e.id)||s===e.id:!1;let l=n.nodeCid;if(l){const N=i(l);l=(x=N==null?void 0:N.data.model)!=null&&x.id?`${N.data.model.id}-benchmarks`:l}const[d]=vr(e),{vcsToGraph:h}=$e(N=>({vcsToGraph:N.vcsToGraph}));let f=br(e.id,h);if((L=e.data)!=null&&L.benchmarks){const N=new Map(e.data.benchmarks.map(V=>[V,hn(V,h)]));f=Un(Array.from(N.values()))}const p=r==="vc-on",g=p?kr[f]:"#475569",v={...e.style},w=t,y=((P=(E=e.data)==null?void 0:E.benchmarks)==null?void 0:P.includes(l))||l===e.target||l===e.source,b=l&&!y||w;v.stroke=g,f==="none"&&p&&(v.strokeDasharray="5");let k=1;return a&&!l&&(k=c?1:.05),a&&l&&(a.nodes.has(l)||s==l?c?y?k=1:k=.5:k=.05:k=b?.05:1),!a&&l&&(k=b?.05:1),w&&(k=.05),m.jsx(He.g,{className:Do.edge,animate:{opacity:k},initial:{opacity:0},transition:{duration:1},children:m.jsx(yr,{path:d,style:v})})}const Ho="_container_mx72m_1",Wo="_dim_mx72m_9",Uo="_sidebar_mx72m_12",qo="_switchContainer_mx72m_21",Yo="_modelFilterContainer_mx72m_32",Xo="_graphNameHeader_mx72m_40",Ko="_graphNameHeaderImg_mx72m_63",Ee={container:Ho,dim:Wo,sidebar:Uo,switchContainer:qo,modelFilterContainer:Yo,graphNameHeader:Xo,graphNameHeaderImg:Ko},Qo="_legendContainer_132y0_1",Zo="_switchContainer_132y0_18",Jo="_isActive_132y0_34",es="_clipContainer_132y0_38",ns="_contentContainer_132y0_42",ts="_icon_132y0_56",rs="_iconLabel_132y0_60",os="_icons_132y0_70",ss="_switchLabel_132y0_83",B={legendContainer:Qo,switchContainer:Zo,isActive:Jo,clipContainer:es,contentContainer:ns,icon:ts,iconLabel:rs,icons:os,switchLabel:ss},is=({className:e})=>m.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"#26D958"})}),as=({className:e})=>m.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 33 33",children:m.jsx("circle",{cx:"16.3206",cy:"16",r:"15",fill:"white",stroke:"#475569",strokeWidth:"2",strokeDasharray:"15 5"})}),cs=({className:e})=>m.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 33",children:m.jsx("circle",{cx:"16",cy:"16.5285",r:"16",fill:"#E2E8F0"})}),ls=({className:e})=>m.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 33",children:m.jsx("circle",{cx:"16",cy:"16.9263",r:"16",fill:"#FF6682"})}),ds=({selected:e,onClick:n})=>{const t=H(B.legendContainer,{[B.isActive]:e});return H(B.pill,{[B.isActive]:!0}),H(B.secondLabel,{[B.secondLabelActive]:e}),m.jsxs(m.Fragment,{children:[m.jsx("div",{className:t,children:m.jsxs("div",{className:B.icons,children:[m.jsxs("span",{className:B.iconLabel,children:["Trusted",m.jsx(is,{className:B.icon})]}),m.jsxs("span",{className:B.iconLabel,children:["Untrusted ",m.jsx(ls,{className:B.icon})]}),m.jsxs("span",{className:B.iconLabel,children:["Unknown ",m.jsx(cs,{className:B.icon})]}),m.jsxs("span",{className:B.iconLabel,children:["None ",m.jsx(as,{className:B.icon})]})]})}),m.jsxs("div",{className:B.switchContainer,children:[m.jsx("div",{className:B.clipContainer,children:m.jsx("div",{className:B.contentContainer,children:m.jsx("span",{className:B.switchLabel,children:"Verified Certificate View"})})}),m.jsx(Hn,{theme:{components:{Switch:{handleSize:8,trackPadding:5,trackHeight:18,trackMinWidth:33,colorPrimary:be.darkBlue,colorTextQuaternary:"#CECECF",colorPrimaryBorder:"rgb(0, 0, 0)",colorPrimaryHover:be.violet,handleBg:"rgb(255, 255, 255)",colorTextTertiary:"rgba(30, 30, 30, 0.45)",colorText:"rgba(110, 110, 110, 0.88)",colorTextLightSolid:"rgb(225, 225, 225)",colorWhite:"rgb(255, 255, 255)",opacityLoading:1}}},children:m.jsx(qr,{defaultChecked:e,onChange:n})})]})]})},hs="_container_1e22t_5",us="_topBar_1e22t_18",fs="_vcModeOn_1e22t_35",ps="_selectedNode_1e22t_41",ms="_topBarIsVCNone_1e22t_45",gs="_bottomBarIsVCUnknown_1e22t_49",ws="_bottomBarIsVCNone_1e22t_56",vs="_badge_1e22t_65",bs="_iconContainer_1e22t_73",ys="_icon_1e22t_73",ks="_clickableArea_1e22t_94",Es="_flex_1e22t_100",ne={container:hs,topBar:us,vcModeOn:fs,selectedNode:ps,topBarIsVCNone:ms,bottomBarIsVCUnknown:gs,bottomBarIsVCNone:ws,badge:vs,iconContainer:bs,icon:ys,clickableArea:ks,flex:Es},Ns={DataIcon:qn,ModelIcon:Yn,ComputationIcon:Xn,DocumentIcon:Kn,TokenIcon:Qn,AttributionIcon:Zn,BenchmarkIcon:Jn,Benchmark_resultIcon:et,CertificateIcon:nt,CodeIcon:tt,DatabaseIcon:rt,DatasetIcon:ot,Media_fileIcon:st},_s=e=>Ns[e]||null,xs=({top:e,bottom:n})=>({"--node-color-top":e,"--node-color-bottom":n}),Cs=({id:e,data:n})=>{const{nodeColor:t,icon:r,sourcePosition:o,governanceNodes:s,isSourceForConnection:i,isTargetForConnection:a}=n,c=De(),l=ze(),[d,h]=dn(),f=l.nodeCid,{graphState:p,vcsToGraph:g,governanceFilter:v,setGovernanceFilter:w,sinks:y,activeSink:b,getNodeFromFullGraph:k}=$e($=>({graphState:$.graphState,vcsToGraph:$.vcsToGraph,governanceFilter:$.governanceFilter,setGovernanceFilter:$.setGovernanceFilter,sinks:$.sinks,activeSink:$.activeSink,getNodeFromFullGraph:$.getNodeFromFullGraph})),x=b?y[b]:null,L=x?x.nodes.has(e)||b===e:!1,E=f===e,P=hn(e,g),N=$=>{var Y;let j=1;if(x&&!f&&(j=L?1:.1),x&&f){const X=k(f),D=(Y=X==null?void 0:X.data.model)!=null&&Y.id?`${X.data.model.id}-benchmarks`:f;x.nodes.has(D)||b===D?L?D===$?j=1:j=.5:j=.1:j=D!==$?.1:1}return!x&&f&&(j=f!==$?.1:1),v?{opacity:v.find(D=>s.some(me=>me.id===D))?1:.2}:{opacity:j}},V=$=>{$.altKey?h(j=>({...j,sourceNode:e})):E||c(lt(`${l.owner}/${l.repo}`)+"/"+e+`?${d.toString()}`)},T={"vc-off":{top:t,bottom:"white"},"vc-on":{top:Oe[P],bottom:Oe[P]}},oe={...xs(T[p])},pe=H(ne.container,{[ne.selectedNode]:E,[ne.vcModeOn]:p==="vc-on"}),I=H(ne.topBar,{[ne.topBarIsVCUnknown]:P==="unknown"&&p==="vc-on",[ne.topBarIsVCNone]:P==="none"&&p==="vc-on"}),O=_s(r),J=$=>{const j=[...v||[]],Y=j.indexOf($);Y>-1?j.splice(Y,1):j.push($),j.length===0?w(null):w(j)},R=()=>{w(null)};_.useEffect(()=>{f&&w(null)},[f]);const se={top:"50%"};return m.jsxs(He.div,{style:oe,className:pe,animate:{...N(e)},initial:{opacity:0},transition:{duration:1},children:[m.jsx("div",{className:"popup-container"}),m.jsx("div",{className:ne.badge,children:s.length>0&&m.jsx(Er,{governanceNodes:s,onGovernanceSelect:J,onGovernanceClose:R,governanceFilter:v})}),m.jsx("div",{className:ne.clickableArea,onClick:V,children:m.jsx("div",{className:I,children:m.jsx("span",{className:ne.iconContainer,children:O&&m.jsx(O,{className:ne.icon})})})}),a&&m.jsx(Re,{type:"target",position:We.Left,id:"left",style:se}),i&&m.jsx(Re,{type:"source",position:o,id:"source",style:se})]})},Is=_.memo(Cs);var Ss="\0",ge="\0",kn="",A,ve,z,Pe,_e,xe,U,te,he,re,ue,ie,ae,Ce,Ie,ce,K,Me,rn,Dn;let $s=(Dn=class{constructor(n){S(this,Me);S(this,A,!0);S(this,ve,!1);S(this,z,!1);S(this,Pe,void 0);S(this,_e,()=>{});S(this,xe,()=>{});S(this,U,{});S(this,te,{});S(this,he,{});S(this,re,{});S(this,ue,{});S(this,ie,{});S(this,ae,{});S(this,Ce,0);S(this,Ie,0);S(this,ce,void 0);S(this,K,void 0);n&&(W(this,A,n.hasOwnProperty("directed")?n.directed:!0),W(this,ve,n.hasOwnProperty("multigraph")?n.multigraph:!1),W(this,z,n.hasOwnProperty("compound")?n.compound:!1)),u(this,z)&&(W(this,ce,{}),W(this,K,{}),u(this,K)[ge]={})}isDirected(){return u(this,A)}isMultigraph(){return u(this,ve)}isCompound(){return u(this,z)}setGraph(n){return W(this,Pe,n),this}graph(){return u(this,Pe)}setDefaultNodeLabel(n){return W(this,_e,n),typeof n!="function"&&W(this,_e,()=>n),this}nodeCount(){return u(this,Ce)}nodes(){return Object.keys(u(this,U))}sources(){var n=this;return this.nodes().filter(t=>Object.keys(u(n,te)[t]).length===0)}sinks(){var n=this;return this.nodes().filter(t=>Object.keys(u(n,re)[t]).length===0)}setNodes(n,t){var r=arguments,o=this;return n.forEach(function(s){r.length>1?o.setNode(s,t):o.setNode(s)}),this}setNode(n,t){return u(this,U).hasOwnProperty(n)?(arguments.length>1&&(u(this,U)[n]=t),this):(u(this,U)[n]=arguments.length>1?t:u(this,_e).call(this,n),u(this,z)&&(u(this,ce)[n]=ge,u(this,K)[n]={},u(this,K)[ge][n]=!0),u(this,te)[n]={},u(this,he)[n]={},u(this,re)[n]={},u(this,ue)[n]={},++je(this,Ce)._,this)}node(n){return u(this,U)[n]}hasNode(n){return u(this,U).hasOwnProperty(n)}removeNode(n){var t=this;if(u(this,U).hasOwnProperty(n)){var r=o=>t.removeEdge(u(t,ie)[o]);delete u(this,U)[n],u(this,z)&&(ee(this,Me,rn).call(this,n),delete u(this,ce)[n],this.children(n).forEach(function(o){t.setParent(o)}),delete u(this,K)[n]),Object.keys(u(this,te)[n]).forEach(r),delete u(this,te)[n],delete u(this,he)[n],Object.keys(u(this,re)[n]).forEach(r),delete u(this,re)[n],delete u(this,ue)[n],--je(this,Ce)._}return this}setParent(n,t){if(!u(this,z))throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t=ge;else{t+="";for(var r=t;r!==void 0;r=this.parent(r))if(r===n)throw new Error("Setting "+t+" as parent of "+n+" would create a cycle");this.setNode(t)}return this.setNode(n),ee(this,Me,rn).call(this,n),u(this,ce)[n]=t,u(this,K)[t][n]=!0,this}parent(n){if(u(this,z)){var t=u(this,ce)[n];if(t!==ge)return t}}children(n=ge){if(u(this,z)){var t=u(this,K)[n];if(t)return Object.keys(t)}else{if(n===ge)return this.nodes();if(this.hasNode(n))return[]}}predecessors(n){var t=u(this,he)[n];if(t)return Object.keys(t)}successors(n){var t=u(this,ue)[n];if(t)return Object.keys(t)}neighbors(n){var t=this.predecessors(n);if(t){const o=new Set(t);for(var r of this.successors(n))o.add(r);return Array.from(o.values())}}isLeaf(n){var t;return this.isDirected()?t=this.successors(n):t=this.neighbors(n),t.length===0}filterNodes(n){var t=new this.constructor({directed:u(this,A),multigraph:u(this,ve),compound:u(this,z)});t.setGraph(this.graph());var r=this;Object.entries(u(this,U)).forEach(function([i,a]){n(i)&&t.setNode(i,a)}),Object.values(u(this,ie)).forEach(function(i){t.hasNode(i.v)&&t.hasNode(i.w)&&t.setEdge(i,r.edge(i))});var o={};function s(i){var a=r.parent(i);return a===void 0||t.hasNode(a)?(o[i]=a,a):a in o?o[a]:s(a)}return u(this,z)&&t.nodes().forEach(i=>t.setParent(i,s(i))),t}setDefaultEdgeLabel(n){return W(this,xe,n),typeof n!="function"&&W(this,xe,()=>n),this}edgeCount(){return u(this,Ie)}edges(){return Object.values(u(this,ie))}setPath(n,t){var r=this,o=arguments;return n.reduce(function(s,i){return o.length>1?r.setEdge(s,i,t):r.setEdge(s,i),i}),this}setEdge(){var n,t,r,o,s=!1,i=arguments[0];typeof i=="object"&&i!==null&&"v"in i?(n=i.v,t=i.w,r=i.name,arguments.length===2&&(o=arguments[1],s=!0)):(n=i,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],s=!0)),n=""+n,t=""+t,r!==void 0&&(r=""+r);var a=Te(u(this,A),n,t,r);if(u(this,ae).hasOwnProperty(a))return s&&(u(this,ae)[a]=o),this;if(r!==void 0&&!u(this,ve))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),u(this,ae)[a]=s?o:u(this,xe).call(this,n,t,r);var c=js(u(this,A),n,t,r);return n=c.v,t=c.w,Object.freeze(c),u(this,ie)[a]=c,En(u(this,he)[t],n),En(u(this,ue)[n],t),u(this,te)[t][a]=c,u(this,re)[n][a]=c,je(this,Ie)._++,this}edge(n,t,r){var o=arguments.length===1?Ye(u(this,A),arguments[0]):Te(u(this,A),n,t,r);return u(this,ae)[o]}edgeAsObj(){const n=this.edge(...arguments);return typeof n!="object"?{label:n}:n}hasEdge(n,t,r){var o=arguments.length===1?Ye(u(this,A),arguments[0]):Te(u(this,A),n,t,r);return u(this,ae).hasOwnProperty(o)}removeEdge(n,t,r){var o=arguments.length===1?Ye(u(this,A),arguments[0]):Te(u(this,A),n,t,r),s=u(this,ie)[o];return s&&(n=s.v,t=s.w,delete u(this,ae)[o],delete u(this,ie)[o],Nn(u(this,he)[t],n),Nn(u(this,ue)[n],t),delete u(this,te)[t][o],delete u(this,re)[n][o],je(this,Ie)._--),this}inEdges(n,t){var r=u(this,te)[n];if(r){var o=Object.values(r);return t?o.filter(s=>s.v===t):o}}outEdges(n,t){var r=u(this,re)[n];if(r){var o=Object.values(r);return t?o.filter(s=>s.w===t):o}}nodeEdges(n,t){var r=this.inEdges(n,t);if(r)return r.concat(this.outEdges(n,t))}},A=new WeakMap,ve=new WeakMap,z=new WeakMap,Pe=new WeakMap,_e=new WeakMap,xe=new WeakMap,U=new WeakMap,te=new WeakMap,he=new WeakMap,re=new WeakMap,ue=new WeakMap,ie=new WeakMap,ae=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,ce=new WeakMap,K=new WeakMap,Me=new WeakSet,rn=function(n){delete u(this,K)[u(this,ce)[n]][n]},Dn);function En(e,n){e[n]?e[n]++:e[n]=1}function Nn(e,n){--e[n]||delete e[n]}function Te(e,n,t,r){var o=""+n,s=""+t;if(!e&&o>s){var i=o;o=s,s=i}return o+kn+s+kn+(r===void 0?Ss:r)}function js(e,n,t,r){var o=""+n,s=""+t;if(!e&&o>s){var i=o;o=s,s=i}var a={v:o,w:s};return r&&(a.name=r),a}function Ye(e,n){return Te(e,n.v,n.w,n.name)}var un=$s,Ts="2.1.13",Os={Graph:un,version:Ts},Ls=un,Ps={write:Ms,read:Gs};function Ms(e){var n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Bs(e),edges:Fs(e)};return e.graph()!==void 0&&(n.value=structuredClone(e.graph())),n}function Bs(e){return e.nodes().map(function(n){var t=e.node(n),r=e.parent(n),o={v:n};return t!==void 0&&(o.value=t),r!==void 0&&(o.parent=r),o})}function Fs(e){return e.edges().map(function(n){var t=e.edge(n),r={v:n.v,w:n.w};return n.name!==void 0&&(r.name=n.name),t!==void 0&&(r.value=t),r})}function Gs(e){var n=new Ls(e.options).setGraph(e.value);return e.nodes.forEach(function(t){n.setNode(t.v,t.value),t.parent&&n.setParent(t.v,t.parent)}),e.edges.forEach(function(t){n.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),n}var Vs=Rs;function Rs(e){var n={},t=[],r;function o(s){n.hasOwnProperty(s)||(n[s]=!0,r.push(s),e.successors(s).forEach(o),e.predecessors(s).forEach(o))}return e.nodes().forEach(function(s){r=[],o(s),r.length&&t.push(r)}),t}var G,le,Be,on,Fe,sn,Se,Ve,zn;let As=(zn=class{constructor(){S(this,Be);S(this,Fe);S(this,Se);S(this,G,[]);S(this,le,{})}size(){return u(this,G).length}keys(){return u(this,G).map(function(n){return n.key})}has(n){return u(this,le).hasOwnProperty(n)}priority(n){var t=u(this,le)[n];if(t!==void 0)return u(this,G)[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return u(this,G)[0].key}add(n,t){var r=u(this,le);if(n=String(n),!r.hasOwnProperty(n)){var o=u(this,G),s=o.length;return r[n]=s,o.push({key:n,priority:t}),ee(this,Fe,sn).call(this,s),!0}return!1}removeMin(){ee(this,Se,Ve).call(this,0,u(this,G).length-1);var n=u(this,G).pop();return delete u(this,le)[n.key],ee(this,Be,on).call(this,0),n.key}decrease(n,t){var r=u(this,le)[n];if(t>u(this,G)[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+u(this,G)[r].priority+" New: "+t);u(this,G)[r].priority=t,ee(this,Fe,sn).call(this,r)}},G=new WeakMap,le=new WeakMap,Be=new WeakSet,on=function(n){var t=u(this,G),r=2*n,o=r+1,s=n;r<t.length&&(s=t[r].priority<t[s].priority?r:s,o<t.length&&(s=t[o].priority<t[s].priority?o:s),s!==n&&(ee(this,Se,Ve).call(this,n,s),ee(this,Be,on).call(this,s)))},Fe=new WeakSet,sn=function(n){for(var t=u(this,G),r=t[n].priority,o;n!==0&&(o=n>>1,!(t[o].priority<r));)ee(this,Se,Ve).call(this,n,o),n=o},Se=new WeakSet,Ve=function(n,t){var r=u(this,G),o=u(this,le),s=r[n],i=r[t];r[n]=i,r[t]=s,o[i.key]=n,o[s.key]=t},zn);var pt=As,Ds=pt,mt=Hs,zs=()=>1;function Hs(e,n,t,r){return Ws(e,String(n),t||zs,r||function(o){return e.outEdges(o)})}function Ws(e,n,t,r){var o={},s=new Ds,i,a,c=function(l){var d=l.v!==i?l.v:l.w,h=o[d],f=t(l),p=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+l+" Weight: "+f);p<h.distance&&(h.distance=p,h.predecessor=i,s.decrease(d,p))};for(e.nodes().forEach(function(l){var d=l===n?0:Number.POSITIVE_INFINITY;o[l]={distance:d},s.add(l,d)});s.size()>0&&(i=s.removeMin(),a=o[i],a.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(c);return o}var Us=mt,qs=Ys;function Ys(e,n,t){return e.nodes().reduce(function(r,o){return r[o]=Us(e,o,n,t),r},{})}var gt=Xs;function Xs(e){var n=0,t=[],r={},o=[];function s(i){var a=r[i]={onStack:!0,lowlink:n,index:n++};if(t.push(i),e.successors(i).forEach(function(d){r.hasOwnProperty(d)?r[d].onStack&&(a.lowlink=Math.min(a.lowlink,r[d].index)):(s(d),a.lowlink=Math.min(a.lowlink,r[d].lowlink))}),a.lowlink===a.index){var c=[],l;do l=t.pop(),r[l].onStack=!1,c.push(l);while(i!==l);o.push(c)}}return e.nodes().forEach(function(i){r.hasOwnProperty(i)||s(i)}),o}var Ks=gt,Qs=Zs;function Zs(e){return Ks(e).filter(function(n){return n.length>1||n.length===1&&e.hasEdge(n[0],n[0])})}var Js=ni,ei=()=>1;function ni(e,n,t){return ti(e,n||ei,t||function(r){return e.outEdges(r)})}function ti(e,n,t){var r={},o=e.nodes();return o.forEach(function(s){r[s]={},r[s][s]={distance:0},o.forEach(function(i){s!==i&&(r[s][i]={distance:Number.POSITIVE_INFINITY})}),t(s).forEach(function(i){var a=i.v===s?i.w:i.v,c=n(i);r[s][a]={distance:c,predecessor:s}})}),o.forEach(function(s){var i=r[s];o.forEach(function(a){var c=r[a];o.forEach(function(l){var d=c[s],h=i[l],f=c[l],p=d.distance+h.distance;p<f.distance&&(f.distance=p,f.predecessor=h.predecessor)})})}),r}function wt(e){var n={},t={},r=[];function o(s){if(t.hasOwnProperty(s))throw new an;n.hasOwnProperty(s)||(t[s]=!0,n[s]=!0,e.predecessors(s).forEach(o),delete t[s],r.push(s))}if(e.sinks().forEach(o),Object.keys(n).length!==e.nodeCount())throw new an;return r}class an extends Error{constructor(){super(...arguments)}}var vt=wt;wt.CycleException=an;var _n=vt,ri=oi;function oi(e){try{_n(e)}catch(n){if(n instanceof _n.CycleException)return!1;throw n}return!0}var bt=si;function si(e,n,t){Array.isArray(n)||(n=[n]);var r=e.isDirected()?a=>e.successors(a):a=>e.neighbors(a),o=t==="post"?ii:ai,s=[],i={};return n.forEach(a=>{if(!e.hasNode(a))throw new Error("Graph does not have node: "+a);o(a,r,i,s)}),s}function ii(e,n,t,r){for(var o=[[e,!1]];o.length>0;){var s=o.pop();s[1]?r.push(s[0]):t.hasOwnProperty(s[0])||(t[s[0]]=!0,o.push([s[0],!0]),yt(n(s[0]),i=>o.push([i,!1])))}}function ai(e,n,t,r){for(var o=[e];o.length>0;){var s=o.pop();t.hasOwnProperty(s)||(t[s]=!0,r.push(s),yt(n(s),i=>o.push(i)))}}function yt(e,n){for(var t=e.length;t--;)n(e[t],t,e);return e}var ci=bt,li=di;function di(e,n){return ci(e,n,"post")}var hi=bt,ui=fi;function fi(e,n){return hi(e,n,"pre")}var pi=un,mi=pt,gi=wi;function wi(e,n){var t=new pi,r={},o=new mi,s;function i(c){var l=c.v===s?c.w:c.v,d=o.priority(l);if(d!==void 0){var h=n(c);h<d&&(r[l]=s,o.decrease(l,h))}}if(e.nodeCount()===0)return t;e.nodes().forEach(function(c){o.add(c,Number.POSITIVE_INFINITY),t.setNode(c)}),o.decrease(e.nodes()[0],0);for(var a=!1;o.size()>0;){if(s=o.removeMin(),r.hasOwnProperty(s))t.setEdge(s,r[s]);else{if(a)throw new Error("Input graph is not connected: "+e);a=!0}e.nodeEdges(s).forEach(i)}return t}var vi={components:Vs,dijkstra:mt,dijkstraAll:qs,findCycles:Qs,floydWarshall:Js,isAcyclic:ri,postorder:li,preorder:ui,prim:gi,tarjan:gt,topsort:vt},xn=Os,Z={Graph:xn.Graph,json:Ps,alg:vi,version:xn.version};let bi=class{constructor(){let n={};n._next=n._prev=n,this._sentinel=n}dequeue(){let n=this._sentinel,t=n._prev;if(t!==n)return Cn(t),t}enqueue(n){let t=this._sentinel;n._prev&&n._next&&Cn(n),n._next=t._next,t._next._prev=n,t._next=n,n._prev=t}toString(){let n=[],t=this._sentinel,r=t._prev;for(;r!==t;)n.push(JSON.stringify(r,yi)),r=r._prev;return"["+n.join(", ")+"]"}};function Cn(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function yi(e,n){if(e!=="_next"&&e!=="_prev")return n}var ki=bi;let Ei=Z.Graph,Ni=ki;var _i=Ci;let xi=()=>1;function Ci(e,n){if(e.nodeCount()<=1)return[];let t=Si(e,n||xi);return Ii(t.graph,t.buckets,t.zeroIdx).flatMap(o=>e.outEdges(o.v,o.w))}function Ii(e,n,t){let r=[],o=n[n.length-1],s=n[0],i;for(;e.nodeCount();){for(;i=s.dequeue();)Xe(e,n,t,i);for(;i=o.dequeue();)Xe(e,n,t,i);if(e.nodeCount()){for(let a=n.length-2;a>0;--a)if(i=n[a].dequeue(),i){r=r.concat(Xe(e,n,t,i,!0));break}}}return r}function Xe(e,n,t,r,o){let s=o?[]:void 0;return e.inEdges(r.v).forEach(i=>{let a=e.edge(i),c=e.node(i.v);o&&s.push({v:i.v,w:i.w}),c.out-=a,cn(n,t,c)}),e.outEdges(r.v).forEach(i=>{let a=e.edge(i),c=i.w,l=e.node(c);l.in-=a,cn(n,t,l)}),e.removeNode(r.v),s}function Si(e,n){let t=new Ei,r=0,o=0;e.nodes().forEach(a=>{t.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let c=t.edge(a.v,a.w)||0,l=n(a),d=c+l;t.setEdge(a.v,a.w,d),o=Math.max(o,t.node(a.v).out+=l),r=Math.max(r,t.node(a.w).in+=l)});let s=$i(o+r+3).map(()=>new Ni),i=r+1;return t.nodes().forEach(a=>{cn(s,i,t.node(a))}),{graph:t,buckets:s,zeroIdx:i}}function cn(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}function $i(e){const n=[];for(let t=0;t<e;t++)n.push(t);return n}let kt=Z.Graph;var F={addBorderNode:Gi,addDummyNode:Et,asNonCompoundGraph:Ti,buildLayerMatrix:Mi,intersectRect:Pi,mapValues:Hi,maxRank:Nt,normalizeRanks:Bi,notime:Ai,partition:Vi,pick:zi,predecessorWeights:Li,range:xt,removeEmptyRanks:Fi,simplify:ji,successorWeights:Oi,time:Ri,uniqueId:_t,zipObject:fn};function Et(e,n,t,r){let o;do o=_t(r);while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function ji(e){let n=new kt().setGraph(e.graph());return e.nodes().forEach(t=>n.setNode(t,e.node(t))),e.edges().forEach(t=>{let r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),n}function Ti(e){let n=new kt({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(t=>{e.children(t).length||n.setNode(t,e.node(t))}),e.edges().forEach(t=>{n.setEdge(t,e.edge(t))}),n}function Oi(e){let n=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(o=>{r[o.w]=(r[o.w]||0)+e.edge(o).weight}),r});return fn(e.nodes(),n)}function Li(e){let n=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(o=>{r[o.v]=(r[o.v]||0)+e.edge(o).weight}),r});return fn(e.nodes(),n)}function Pi(e,n){let t=e.x,r=e.y,o=n.x-t,s=n.y-r,i=e.width/2,a=e.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");let c,l;return Math.abs(s)*i>Math.abs(o)*a?(s<0&&(a=-a),c=a*o/s,l=a):(o<0&&(i=-i),c=i,l=i*s/o),{x:t+c,y:r+l}}function Mi(e){let n=xt(Nt(e)+1).map(()=>[]);return e.nodes().forEach(t=>{let r=e.node(t),o=r.rank;o!==void 0&&(n[o][r.order]=t)}),n}function Bi(e){let n=Math.min(...e.nodes().map(t=>{let r=e.node(t).rank;return r===void 0?Number.MAX_VALUE:r}));e.nodes().forEach(t=>{let r=e.node(t);r.hasOwnProperty("rank")&&(r.rank-=n)})}function Fi(e){let n=Math.min(...e.nodes().map(s=>e.node(s).rank)),t=[];e.nodes().forEach(s=>{let i=e.node(s).rank-n;t[i]||(t[i]=[]),t[i].push(s)});let r=0,o=e.graph().nodeRankFactor;Array.from(t).forEach((s,i)=>{s===void 0&&i%o!==0?--r:s!==void 0&&r&&s.forEach(a=>e.node(a).rank+=r)})}function Gi(e,n,t,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),Et(e,"border",o,n)}function Nt(e){return Math.max(...e.nodes().map(n=>{let t=e.node(n).rank;return t===void 0?Number.MIN_VALUE:t}))}function Vi(e,n){let t={lhs:[],rhs:[]};return e.forEach(r=>{n(r)?t.lhs.push(r):t.rhs.push(r)}),t}function Ri(e,n){let t=Date.now();try{return n()}finally{console.log(e+" time: "+(Date.now()-t)+"ms")}}function Ai(e,n){return n()}let Di=0;function _t(e){var n=++Di;return toString(e)+n}function xt(e,n,t=1){n==null&&(n=e,e=0);let r=s=>s<n;t<0&&(r=s=>n<s);const o=[];for(let s=e;r(s);s+=t)o.push(s);return o}function zi(e,n){const t={};for(const r of n)e[r]!==void 0&&(t[r]=e[r]);return t}function Hi(e,n){let t=n;return typeof n=="string"&&(t=r=>r[n]),Object.entries(e).reduce((r,[o,s])=>(r[o]=t(s,o),r),{})}function fn(e,n){return e.reduce((t,r,o)=>(t[r]=n[o],t),{})}let Wi=_i,Ui=F.uniqueId;var qi={run:Yi,undo:Ki};function Yi(e){(e.graph().acyclicer==="greedy"?Wi(e,t(e)):Xi(e)).forEach(r=>{let o=e.edge(r);e.removeEdge(r),o.forwardName=r.name,o.reversed=!0,e.setEdge(r.w,r.v,o,Ui("rev"))});function t(r){return o=>r.edge(o).weight}}function Xi(e){let n=[],t={},r={};function o(s){r.hasOwnProperty(s)||(r[s]=!0,t[s]=!0,e.outEdges(s).forEach(i=>{t.hasOwnProperty(i.w)?n.push(i):o(i.w)}),delete t[s])}return e.nodes().forEach(o),n}function Ki(e){e.edges().forEach(n=>{let t=e.edge(n);if(t.reversed){e.removeEdge(n);let r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}})}let Qi=F;var Zi={run:Ji,undo:na};function Ji(e){e.graph().dummyChains=[],e.edges().forEach(n=>ea(e,n))}function ea(e,n){let t=n.v,r=e.node(t).rank,o=n.w,s=e.node(o).rank,i=n.name,a=e.edge(n),c=a.labelRank;if(s===r+1)return;e.removeEdge(n);let l,d,h;for(h=0,++r;r<s;++h,++r)a.points=[],d={width:0,height:0,edgeLabel:a,edgeObj:n,rank:r},l=Qi.addDummyNode(e,"edge",d,"_d"),r===c&&(d.width=a.width,d.height=a.height,d.dummy="edge-label",d.labelpos=a.labelpos),e.setEdge(t,l,{weight:a.weight},i),h===0&&e.graph().dummyChains.push(l),t=l;e.setEdge(t,o,{weight:a.weight},i)}function na(e){e.graph().dummyChains.forEach(n=>{let t=e.node(n),r=t.edgeLabel,o;for(e.setEdge(t.edgeObj,r);t.dummy;)o=e.successors(n)[0],e.removeNode(n),r.points.push({x:t.x,y:t.y}),t.dummy==="edge-label"&&(r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height),n=o,t=e.node(n)})}var Ue={longestPath:ta,slack:ra};function ta(e){var n={};function t(r){var o=e.node(r);if(n.hasOwnProperty(r))return o.rank;n[r]=!0;var s=Math.min(...e.outEdges(r).map(i=>i==null?Number.POSITIVE_INFINITY:t(i.w)-e.edge(i).minlen));return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}e.sources().forEach(t)}function ra(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}var oa=Z.Graph,Ae=Ue.slack,Ct=sa;function sa(e){var n=new oa({directed:!1}),t=e.nodes()[0],r=e.nodeCount();n.setNode(t,{});for(var o,s;ia(n,e)<r;)o=aa(n,e),s=n.hasNode(o.v)?Ae(e,o):-Ae(e,o),ca(n,e,s);return n}function ia(e,n){function t(r){n.nodeEdges(r).forEach(o=>{var s=o.v,i=r===s?o.w:s;!e.hasNode(i)&&!Ae(n,o)&&(e.setNode(i,{}),e.setEdge(r,i,{}),t(i))})}return e.nodes().forEach(t),e.nodeCount()}function aa(e,n){return n.edges().reduce((r,o)=>{let s=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(s=Ae(n,o)),s<r[0]?[s,o]:r},[Number.POSITIVE_INFINITY,null])[1]}function ca(e,n,t){e.nodes().forEach(r=>n.node(r).rank+=t)}var la=Ct,In=Ue.slack,da=Ue.longestPath,ha=Z.alg.preorder,ua=Z.alg.postorder,fa=F.simplify,pa=ye;ye.initLowLimValues=mn;ye.initCutValues=pn;ye.calcCutValue=It;ye.leaveEdge=$t;ye.enterEdge=jt;ye.exchangeEdges=Tt;function ye(e){e=fa(e),da(e);var n=la(e);mn(n),pn(n,e);for(var t,r;t=$t(n);)r=jt(n,e,t),Tt(n,e,t,r)}function pn(e,n){var t=ua(e,e.nodes());t=t.slice(0,t.length-1),t.forEach(r=>ma(e,n,r))}function ma(e,n,t){var r=e.node(t),o=r.parent;e.edge(t,o).cutvalue=It(e,n,t)}function It(e,n,t){var r=e.node(t),o=r.parent,s=!0,i=n.edge(t,o),a=0;return i||(s=!1,i=n.edge(o,t)),a=i.weight,n.nodeEdges(t).forEach(c=>{var l=c.v===t,d=l?c.w:c.v;if(d!==o){var h=l===s,f=n.edge(c).weight;if(a+=h?f:-f,wa(e,t,d)){var p=e.edge(t,d).cutvalue;a+=h?-p:p}}}),a}function mn(e,n){arguments.length<2&&(n=e.nodes()[0]),St(e,{},1,n)}function St(e,n,t,r,o){var s=t,i=e.node(r);return n[r]=!0,e.neighbors(r).forEach(a=>{n.hasOwnProperty(a)||(t=St(e,n,t,a,r))}),i.low=s,i.lim=t++,o?i.parent=o:delete i.parent,t}function $t(e){return e.edges().find(n=>e.edge(n).cutvalue<0)}function jt(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var s=e.node(r),i=e.node(o),a=s,c=!1;s.lim>i.lim&&(a=i,c=!0);var l=n.edges().filter(d=>c===Sn(e,e.node(d.v),a)&&c!==Sn(e,e.node(d.w),a));return l.reduce((d,h)=>In(n,h)<In(n,d)?h:d)}function Tt(e,n,t,r){var o=t.v,s=t.w;e.removeEdge(o,s),e.setEdge(r.v,r.w,{}),mn(e),pn(e,n),ga(e,n)}function ga(e,n){var t=e.nodes().find(o=>!n.node(o).parent),r=ha(e,t);r=r.slice(1),r.forEach(o=>{var s=e.node(o).parent,i=n.edge(o,s),a=!1;i||(i=n.edge(s,o),a=!0),n.node(o).rank=n.node(s).rank+(a?i.minlen:-i.minlen)})}function wa(e,n,t){return e.hasEdge(n,t)}function Sn(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}var va=Ue,Ot=va.longestPath,ba=Ct,ya=pa,ka=Ea;function Ea(e){switch(e.graph().ranker){case"network-simplex":$n(e);break;case"tight-tree":_a(e);break;case"longest-path":Na(e);break;default:$n(e)}}var Na=Ot;function _a(e){Ot(e),ba(e)}function $n(e){ya(e)}var xa=Ca;function Ca(e){let n=Sa(e);e.graph().dummyChains.forEach(t=>{let r=e.node(t),o=r.edgeObj,s=Ia(e,n,o.v,o.w),i=s.path,a=s.lca,c=0,l=i[c],d=!0;for(;t!==o.w;){if(r=e.node(t),d){for(;(l=i[c])!==a&&e.node(l).maxRank<r.rank;)c++;l===a&&(d=!1)}if(!d){for(;c<i.length-1&&e.node(l=i[c+1]).minRank<=r.rank;)c++;l=i[c]}e.setParent(t,l),t=e.successors(t)[0]}})}function Ia(e,n,t,r){let o=[],s=[],i=Math.min(n[t].low,n[r].low),a=Math.max(n[t].lim,n[r].lim),c,l;c=t;do c=e.parent(c),o.push(c);while(c&&(n[c].low>i||a>n[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)s.push(c);return{path:o.concat(s.reverse()),lca:l}}function Sa(e){let n={},t=0;function r(o){let s=t;e.children(o).forEach(r),n[o]={low:s,lim:t++}}return e.children().forEach(r),n}let ln=F;var $a={run:ja,cleanup:La};function ja(e){let n=ln.addDummyNode(e,"root",{},"_root"),t=Ta(e),r=Math.max(...Object.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,e.edges().forEach(i=>e.edge(i).minlen*=o);let s=Oa(e)+1;e.children().forEach(i=>Lt(e,n,o,s,r,t,i)),e.graph().nodeRankFactor=o}function Lt(e,n,t,r,o,s,i){let a=e.children(i);if(!a.length){i!==n&&e.setEdge(n,i,{weight:0,minlen:t});return}let c=ln.addBorderNode(e,"_bt"),l=ln.addBorderNode(e,"_bb"),d=e.node(i);e.setParent(c,i),d.borderTop=c,e.setParent(l,i),d.borderBottom=l,a.forEach(h=>{Lt(e,n,t,r,o,s,h);let f=e.node(h),p=f.borderTop?f.borderTop:h,g=f.borderBottom?f.borderBottom:h,v=f.borderTop?r:2*r,w=p!==g?1:o-s[i]+1;e.setEdge(c,p,{weight:v,minlen:w,nestingEdge:!0}),e.setEdge(g,l,{weight:v,minlen:w,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,c,{weight:0,minlen:o+s[i]})}function Ta(e){var n={};function t(r,o){var s=e.children(r);s&&s.length&&s.forEach(i=>t(i,o+1)),n[r]=o}return e.children().forEach(r=>t(r,1)),n}function Oa(e){return e.edges().reduce((n,t)=>n+e.edge(t).weight,0)}function La(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,e.edges().forEach(t=>{var r=e.edge(t);r.nestingEdge&&e.removeEdge(t)})}let Pa=F;var Ma=Ba;function Ba(e){function n(t){let r=e.children(t),o=e.node(t);if(r.length&&r.forEach(n),o.hasOwnProperty("minRank")){o.borderLeft=[],o.borderRight=[];for(let s=o.minRank,i=o.maxRank+1;s<i;++s)jn(e,"borderLeft","_bl",t,o,s),jn(e,"borderRight","_br",t,o,s)}}e.children().forEach(n)}function jn(e,n,t,r,o,s){let i={width:0,height:0,rank:s,borderType:n},a=o[n][s-1],c=Pa.addDummyNode(e,"border",i,t);o[n][s]=c,e.setParent(c,r),a&&e.setEdge(a,c,{weight:1})}var Fa={adjust:Ga,undo:Va};function Ga(e){let n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&Pt(e)}function Va(e){let n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&Ra(e),(n==="lr"||n==="rl")&&(Aa(e),Pt(e))}function Pt(e){e.nodes().forEach(n=>Tn(e.node(n))),e.edges().forEach(n=>Tn(e.edge(n)))}function Tn(e){let n=e.width;e.width=e.height,e.height=n}function Ra(e){e.nodes().forEach(n=>Ke(e.node(n))),e.edges().forEach(n=>{let t=e.edge(n);t.points.forEach(Ke),t.hasOwnProperty("y")&&Ke(t)})}function Ke(e){e.y=-e.y}function Aa(e){e.nodes().forEach(n=>Qe(e.node(n))),e.edges().forEach(n=>{let t=e.edge(n);t.points.forEach(Qe),t.hasOwnProperty("x")&&Qe(t)})}function Qe(e){let n=e.x;e.x=e.y,e.y=n}let Da=F;var za=Ha;function Ha(e){let n={},t=e.nodes().filter(a=>!e.children(a).length),r=Math.max(...t.map(a=>e.node(a).rank)),o=Da.range(r+1).map(()=>[]);function s(a){if(n[a])return;n[a]=!0;let c=e.node(a);o[c.rank].push(a),e.successors(a).forEach(s)}return t.sort((a,c)=>e.node(a).rank-e.node(c).rank).forEach(s),o}let Wa=F.zipObject;var Ua=qa;function qa(e,n){let t=0;for(let r=1;r<n.length;++r)t+=Ya(e,n[r-1],n[r]);return t}function Ya(e,n,t){let r=Wa(t,t.map((l,d)=>d)),o=n.flatMap(l=>e.outEdges(l).map(d=>({pos:r[d.w],weight:e.edge(d).weight})).sort((d,h)=>d.pos-h.pos)),s=1;for(;s<t.length;)s<<=1;let i=2*s-1;s-=1;let a=new Array(i).fill(0),c=0;return o.forEach(l=>{let d=l.pos+s;a[d]+=l.weight;let h=0;for(;d>0;)d%2&&(h+=a[d+1]),d=d-1>>1,a[d]+=l.weight;c+=l.weight*h}),c}var Xa=Ka;function Ka(e,n=[]){return n.map(t=>{let r=e.inEdges(t);if(r.length){let o=r.reduce((s,i)=>{let a=e.edge(i),c=e.node(i.v);return{sum:s.sum+a.weight*c.order,weight:s.weight+a.weight}},{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:t}})}let Qa=F;var Za=Ja;function Ja(e,n){let t={};e.forEach((o,s)=>{let i=t[o.v]={indegree:0,in:[],out:[],vs:[o.v],i:s};o.barycenter!==void 0&&(i.barycenter=o.barycenter,i.weight=o.weight)}),n.edges().forEach(o=>{let s=t[o.v],i=t[o.w];s!==void 0&&i!==void 0&&(i.indegree++,s.out.push(t[o.w]))});let r=Object.values(t).filter(o=>!o.indegree);return ec(r)}function ec(e){let n=[];function t(o){return s=>{s.merged||(s.barycenter===void 0||o.barycenter===void 0||s.barycenter>=o.barycenter)&&nc(o,s)}}function r(o){return s=>{s.in.push(o),--s.indegree===0&&e.push(s)}}for(;e.length;){let o=e.pop();n.push(o),o.in.reverse().forEach(t(o)),o.out.forEach(r(o))}return n.filter(o=>!o.merged).map(o=>Qa.pick(o,["vs","i","barycenter","weight"]))}function nc(e,n){let t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}let tc=F;var rc=oc;function oc(e,n){let t=tc.partition(e,d=>d.hasOwnProperty("barycenter")),r=t.lhs,o=t.rhs.sort((d,h)=>h.i-d.i),s=[],i=0,a=0,c=0;r.sort(sc(!!n)),c=On(s,o,c),r.forEach(d=>{c+=d.vs.length,s.push(d.vs),i+=d.barycenter*d.weight,a+=d.weight,c=On(s,o,c)});let l={vs:s.flat(!0)};return a&&(l.barycenter=i/a,l.weight=a),l}function On(e,n,t){let r;for(;n.length&&(r=n[n.length-1]).i<=t;)n.pop(),e.push(r.vs),t++;return t}function sc(e){return(n,t)=>n.barycenter<t.barycenter?-1:n.barycenter>t.barycenter?1:e?t.i-n.i:n.i-t.i}let ic=Xa,ac=Za,cc=rc;var lc=Mt;function Mt(e,n,t,r){let o=e.children(n),s=e.node(n),i=s?s.borderLeft:void 0,a=s?s.borderRight:void 0,c={};i&&(o=o.filter(f=>f!==i&&f!==a));let l=ic(e,o);l.forEach(f=>{if(e.children(f.v).length){let p=Mt(e,f.v,t,r);c[f.v]=p,p.hasOwnProperty("barycenter")&&hc(f,p)}});let d=ac(l,t);dc(d,c);let h=cc(d,r);if(i&&(h.vs=[i,h.vs,a].flat(!0),e.predecessors(i).length)){let f=e.node(e.predecessors(i)[0]),p=e.node(e.predecessors(a)[0]);h.hasOwnProperty("barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+f.order+p.order)/(h.weight+2),h.weight+=2}return h}function dc(e,n){e.forEach(t=>{t.vs=t.vs.flatMap(r=>n[r]?n[r].vs:r)})}function hc(e,n){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight):(e.barycenter=n.barycenter,e.weight=n.weight)}let uc=Z.Graph,fc=F;var pc=mc;function mc(e,n,t){let r=gc(e),o=new uc({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(s=>e.node(s));return e.nodes().forEach(s=>{let i=e.node(s),a=e.parent(s);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(o.setNode(s),o.setParent(s,a||r),e[t](s).forEach(c=>{let l=c.v===s?c.w:c.v,d=o.edge(l,s),h=d!==void 0?d.weight:0;o.setEdge(l,s,{weight:e.edge(c).weight+h})}),i.hasOwnProperty("minRank")&&o.setNode(s,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),o}function gc(e){for(var n;e.hasNode(n=fc.uniqueId("_root")););return n}var wc=vc;function vc(e,n,t){let r={},o;t.forEach(s=>{let i=e.parent(s),a,c;for(;i;){if(a=e.parent(i),a?(c=r[a],r[a]=i):(c=o,o=i),c&&c!==i){n.setEdge(c,i);return}i=a}})}let bc=za,yc=Ua,kc=lc,Ec=pc,Nc=wc,_c=Z.Graph,Ge=F;var xc=Cc;function Cc(e){let n=Ge.maxRank(e),t=Ln(e,Ge.range(1,n+1),"inEdges"),r=Ln(e,Ge.range(n-1,-1,-1),"outEdges"),o=bc(e);Pn(e,o);let s=Number.POSITIVE_INFINITY,i;for(let a=0,c=0;c<4;++a,++c){Ic(a%2?t:r,a%4>=2),o=Ge.buildLayerMatrix(e);let l=yc(e,o);l<s&&(c=0,i=Object.assign({},o),s=l)}Pn(e,i)}function Ln(e,n,t){return n.map(function(r){return Ec(e,r,t)})}function Ic(e,n){let t=new _c;e.forEach(function(r){let o=r.graph().root,s=kc(r,o,t,n);s.vs.forEach((i,a)=>r.node(i).order=a),Nc(r,t,s.vs)})}function Pn(e,n){Object.values(n).forEach(t=>t.forEach((r,o)=>e.node(r).order=o))}let Sc=Z.Graph,Le=F;var $c={positionX:Oc,findType1Conflicts:Bt,findType2Conflicts:Ft,addConflict:gn,hasConflict:Gt,verticalAlignment:Vt,horizontalCompaction:Rt,alignCoordinates:Dt,findSmallestWidthAlignment:At,balance:zt};function Bt(e,n){let t={};function r(o,s){let i=0,a=0,c=o.length,l=s[s.length-1];return s.forEach((d,h)=>{let f=jc(e,d),p=f?e.node(f).order:c;(f||d===l)&&(s.slice(a,h+1).forEach(g=>{e.predecessors(g).forEach(v=>{let w=e.node(v),y=w.order;(y<i||p<y)&&!(w.dummy&&e.node(g).dummy)&&gn(t,v,g)})}),a=h+1,i=p)}),s}return n.reduce(r),t}function Ft(e,n){let t={};function r(s,i,a,c,l){let d;Le.range(i,a).forEach(h=>{d=s[h],e.node(d).dummy&&e.predecessors(d).forEach(f=>{let p=e.node(f);p.dummy&&(p.order<c||p.order>l)&&gn(t,f,d)})})}function o(s,i){let a=-1,c,l=0;return i.forEach((d,h)=>{if(e.node(d).dummy==="border"){let f=e.predecessors(d);f.length&&(c=e.node(f[0]).order,r(i,l,h,a,c),l=h,a=c)}r(i,l,i.length,c,s.length)}),i}return n.reduce(o),t}function jc(e,n){if(e.node(n).dummy)return e.predecessors(n).find(t=>e.node(t).dummy)}function gn(e,n,t){if(n>t){let o=n;n=t,t=o}let r=e[n];r||(e[n]=r={}),r[t]=!0}function Gt(e,n,t){if(n>t){let r=n;n=t,t=r}return!!e[n]&&e[n].hasOwnProperty(t)}function Vt(e,n,t,r){let o={},s={},i={};return n.forEach(a=>{a.forEach((c,l)=>{o[c]=c,s[c]=c,i[c]=l})}),n.forEach(a=>{let c=-1;a.forEach(l=>{let d=r(l);if(d.length){d=d.sort((f,p)=>i[f]-i[p]);let h=(d.length-1)/2;for(let f=Math.floor(h),p=Math.ceil(h);f<=p;++f){let g=d[f];s[l]===l&&c<i[g]&&!Gt(t,l,g)&&(s[g]=l,s[l]=o[l]=o[g],c=i[g])}}})}),{root:o,align:s}}function Rt(e,n,t,r,o){let s={},i=Tc(e,n,t,o),a=o?"borderLeft":"borderRight";function c(h,f){let p=i.nodes(),g=p.pop(),v={};for(;g;)v[g]?h(g):(v[g]=!0,p.push(g),p=p.concat(f(g))),g=p.pop()}function l(h){s[h]=i.inEdges(h).reduce((f,p)=>Math.max(f,s[p.v]+i.edge(p)),0)}function d(h){let f=i.outEdges(h).reduce((g,v)=>Math.min(g,s[v.w]-i.edge(v)),Number.POSITIVE_INFINITY),p=e.node(h);f!==Number.POSITIVE_INFINITY&&p.borderType!==a&&(s[h]=Math.max(s[h],f))}return c(l,i.predecessors.bind(i)),c(d,i.successors.bind(i)),Object.keys(r).forEach(h=>s[h]=s[t[h]]),s}function Tc(e,n,t,r){let o=new Sc,s=e.graph(),i=Lc(s.nodesep,s.edgesep,r);return n.forEach(a=>{let c;a.forEach(l=>{let d=t[l];if(o.setNode(d),c){var h=t[c],f=o.edge(h,d);o.setEdge(h,d,Math.max(i(e,l,c),f||0))}c=l})}),o}function At(e,n){return Object.values(n).reduce((t,r)=>{let o=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([a,c])=>{let l=Pc(e,a)/2;o=Math.max(c+l,o),s=Math.min(c-l,s)});const i=o-s;return i<t[0]&&(t=[i,r]),t},[Number.POSITIVE_INFINITY,null])[1]}function Dt(e,n){let t=Object.values(n),r=Math.min(...t),o=Math.max(...t);["u","d"].forEach(s=>{["l","r"].forEach(i=>{let a=s+i,c=e[a];if(c===n)return;let l=Object.values(c),d=r-Math.min(...l);i!=="l"&&(d=o-Math.max(...l)),d&&(e[a]=Le.mapValues(c,h=>h+d))})})}function zt(e,n){return Le.mapValues(e.ul,(t,r)=>{if(n)return e[n.toLowerCase()][r];{let o=Object.values(e).map(s=>s[r]).sort((s,i)=>s-i);return(o[1]+o[2])/2}})}function Oc(e){let n=Le.buildLayerMatrix(e),t=Object.assign(Bt(e,n),Ft(e,n)),r={},o;["u","d"].forEach(i=>{o=i==="u"?n:Object.values(n).reverse(),["l","r"].forEach(a=>{a==="r"&&(o=o.map(h=>Object.values(h).reverse()));let c=(i==="u"?e.predecessors:e.successors).bind(e),l=Vt(e,o,t,c),d=Rt(e,o,l.root,l.align,a==="r");a==="r"&&(d=Le.mapValues(d,h=>-h)),r[i+a]=d})});let s=At(e,r);return Dt(r,s),zt(r,e.graph().align)}function Lc(e,n,t){return(r,o,s)=>{let i=r.node(o),a=r.node(s),c=0,l;if(c+=i.width/2,i.hasOwnProperty("labelpos"))switch(i.labelpos.toLowerCase()){case"l":l=-i.width/2;break;case"r":l=i.width/2;break}if(l&&(c+=t?l:-l),l=0,c+=(i.dummy?n:e)/2,c+=(a.dummy?n:e)/2,c+=a.width/2,a.hasOwnProperty("labelpos"))switch(a.labelpos.toLowerCase()){case"l":l=a.width/2;break;case"r":l=-a.width/2;break}return l&&(c+=t?l:-l),l=0,c}}function Pc(e,n){return e.node(n).width}let Ht=F,Mc=$c.positionX;var Bc=Fc;function Fc(e){e=Ht.asNonCompoundGraph(e),Gc(e),Object.entries(Mc(e)).forEach(([n,t])=>e.node(n).x=t)}function Gc(e){let n=Ht.buildLayerMatrix(e),t=e.graph().ranksep,r=0;n.forEach(o=>{const s=o.reduce((i,a)=>{const c=e.node(a).height;return i>c?i:c},0);o.forEach(i=>e.node(i).y=r+s/2),r+=s+t})}let Mn=qi,Bn=Zi,Vc=ka,Rc=F.normalizeRanks,Ac=xa,Dc=F.removeEmptyRanks,Fn=$a,zc=Ma,Gn=Fa,Hc=xc,Wc=Bc,q=F,Uc=Z.Graph;var qc=Yc;function Yc(e,n){let t=n&&n.debugTiming?q.time:q.notime;t("layout",()=>{let r=t(" buildLayoutGraph",()=>ol(e));t(" runLayout",()=>Xc(r,t)),t(" updateInputGraph",()=>Kc(e,r))})}function Xc(e,n){n(" makeSpaceForEdgeLabels",()=>sl(e)),n(" removeSelfEdges",()=>pl(e)),n(" acyclic",()=>Mn.run(e)),n(" nestingGraph.run",()=>Fn.run(e)),n(" rank",()=>Vc(q.asNonCompoundGraph(e))),n(" injectEdgeLabelProxies",()=>il(e)),n(" removeEmptyRanks",()=>Dc(e)),n(" nestingGraph.cleanup",()=>Fn.cleanup(e)),n(" normalizeRanks",()=>Rc(e)),n(" assignRankMinMax",()=>al(e)),n(" removeEdgeLabelProxies",()=>cl(e)),n(" normalize.run",()=>Bn.run(e)),n(" parentDummyChains",()=>Ac(e)),n(" addBorderSegments",()=>zc(e)),n(" order",()=>Hc(e)),n(" insertSelfEdges",()=>ml(e)),n(" adjustCoordinateSystem",()=>Gn.adjust(e)),n(" position",()=>Wc(e)),n(" positionSelfEdges",()=>gl(e)),n(" removeBorderNodes",()=>fl(e)),n(" normalize.undo",()=>Bn.undo(e)),n(" fixupEdgeLabelCoords",()=>hl(e)),n(" undoCoordinateSystem",()=>Gn.undo(e)),n(" translateGraph",()=>ll(e)),n(" assignNodeIntersects",()=>dl(e)),n(" reversePoints",()=>ul(e)),n(" acyclic.undo",()=>Mn.undo(e))}function Kc(e,n){e.nodes().forEach(t=>{let r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,r.rank=o.rank,n.children(t).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(t=>{let r=e.edge(t),o=n.edge(t);r.points=o.points,o.hasOwnProperty("x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}let Qc=["nodesep","edgesep","ranksep","marginx","marginy"],Zc={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Jc=["acyclicer","ranker","rankdir","align"],el=["width","height"],Vn={width:0,height:0},nl=["minlen","weight","width","height","labeloffset"],tl={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},rl=["labelpos"];function ol(e){let n=new Uc({multigraph:!0,compound:!0}),t=Je(e.graph());return n.setGraph(Object.assign({},Zc,Ze(t,Qc),q.pick(t,Jc))),e.nodes().forEach(r=>{let o=Je(e.node(r));const s=Ze(o,el);Object.keys(Vn).forEach(i=>{s[i]===void 0&&(s[i]=Vn[i])}),n.setNode(r,s),n.setParent(r,e.parent(r))}),e.edges().forEach(r=>{let o=Je(e.edge(r));n.setEdge(r,Object.assign({},tl,Ze(o,nl),q.pick(o,rl)))}),n}function sl(e){let n=e.graph();n.ranksep/=2,e.edges().forEach(t=>{let r=e.edge(t);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function il(e){e.edges().forEach(n=>{let t=e.edge(n);if(t.width&&t.height){let r=e.node(n.v),s={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};q.addDummyNode(e,"edge-proxy",s,"_ep")}})}function al(e){let n=0;e.nodes().forEach(t=>{let r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Math.max(n,r.maxRank))}),e.graph().maxRank=n}function cl(e){e.nodes().forEach(n=>{let t=e.node(n);t.dummy==="edge-proxy"&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))})}function ll(e){let n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,s=e.graph(),i=s.marginx||0,a=s.marginy||0;function c(l){let d=l.x,h=l.y,f=l.width,p=l.height;n=Math.min(n,d-f/2),t=Math.max(t,d+f/2),r=Math.min(r,h-p/2),o=Math.max(o,h+p/2)}e.nodes().forEach(l=>c(e.node(l))),e.edges().forEach(l=>{let d=e.edge(l);d.hasOwnProperty("x")&&c(d)}),n-=i,r-=a,e.nodes().forEach(l=>{let d=e.node(l);d.x-=n,d.y-=r}),e.edges().forEach(l=>{let d=e.edge(l);d.points.forEach(h=>{h.x-=n,h.y-=r}),d.hasOwnProperty("x")&&(d.x-=n),d.hasOwnProperty("y")&&(d.y-=r)}),s.width=t-n+i,s.height=o-r+a}function dl(e){e.edges().forEach(n=>{let t=e.edge(n),r=e.node(n.v),o=e.node(n.w),s,i;t.points?(s=t.points[0],i=t.points[t.points.length-1]):(t.points=[],s=o,i=r),t.points.unshift(q.intersectRect(r,s)),t.points.push(q.intersectRect(o,i))})}function hl(e){e.edges().forEach(n=>{let t=e.edge(n);if(t.hasOwnProperty("x"))switch((t.labelpos==="l"||t.labelpos==="r")&&(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset;break}})}function ul(e){e.edges().forEach(n=>{let t=e.edge(n);t.reversed&&t.points.reverse()})}function fl(e){e.nodes().forEach(n=>{if(e.children(n).length){let t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),s=e.node(t.borderLeft[t.borderLeft.length-1]),i=e.node(t.borderRight[t.borderRight.length-1]);t.width=Math.abs(i.x-s.x),t.height=Math.abs(o.y-r.y),t.x=s.x+t.width/2,t.y=r.y+t.height/2}}),e.nodes().forEach(n=>{e.node(n).dummy==="border"&&e.removeNode(n)})}function pl(e){e.edges().forEach(n=>{if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function ml(e){var n=q.buildLayerMatrix(e);n.forEach(t=>{var r=0;t.forEach((o,s)=>{var i=e.node(o);i.order=s+r,(i.selfEdges||[]).forEach(a=>{q.addDummyNode(e,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:s+ ++r,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function gl(e){e.nodes().forEach(n=>{var t=e.node(n);if(t.dummy==="selfedge"){var r=e.node(t.e.v),o=r.x+r.width/2,s=r.y,i=t.x-o,a=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*i/3,y:s-a},{x:o+5*i/6,y:s-a},{x:o+i,y:s},{x:o+5*i/6,y:s+a},{x:o+2*i/3,y:s+a}],t.label.x=t.x,t.label.y=t.y}})}function Ze(e,n){return q.mapValues(q.pick(e,n),Number)}function Je(e){var n={};return e&&Object.entries(e).forEach(([t,r])=>{typeof t=="string"&&(t=t.toLowerCase()),n[t]=r}),n}let wl=F,vl=Z.Graph;var bl={debugOrdering:yl};function yl(e){let n=wl.buildLayerMatrix(e),t=new vl({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{t.setNode(r,{label:r}),t.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>t.setEdge(r.v,r.w,{},r.name)),n.forEach((r,o)=>{let s="layer"+o;t.setNode(s,{rank:"same"}),r.reduce((i,a)=>(t.setEdge(i,a,{style:"invis"}),a))}),t}var kl="1.0.4",Ne={graphlib:Z,layout:qc,debug:bl,util:{time:F.time,notime:F.notime},version:kl};function El(e,n){let t=[],r=[e];for(;r&&r.length;){let o=[];for(const s of r){const i=n.node(s);(i==null?void 0:i.type)==="Benchmark_Result"&&t.push(s),((i==null?void 0:i.type)!=="Model"||e===s)&&o.push(...n.successors(s))}r=o}return t}const Rn={data:{width:200,height:84},computation:{width:60,height:60},default:{width:150,height:88}};function Nl(e,n,t){var l;if(e.length===0)return{nodes:[],edges:[],sinks:{},graph:new Ne.graphlib.Graph,noBenchmarkNodes:[],noBenchmarkEdges:[],noBenchmarkGraph:new Ne.graphlib.Graph,graphName:""};let r=Pr[t];r||(r={label:t,url:"",sourceNodes:[],filterNodes:[]});const o=new Ne.graphlib.Graph;o.setGraph({rankdir:"LR",nodesep:30,ranksep:300,align:"UL"});for(const d of e){const h=Rn[d.data.displayType]||Rn.default;o.setNode(d.id,{...h,label:d.data.label,type:(l=d.data.enrichments.asset_hub)==null?void 0:l.asset_type})}for(const d of n)o.setEdge(d.source,d.target,{label:d.id});const s=xl(o),i=e.filter(d=>s.hasNode(d.id)),a=n.filter(d=>s.hasEdge(d.source,d.target)),c=_l(s,r.filterNodes);for(const[d,h]of Object.entries(c)){const f=El(d,o),p=e.find(g=>g.id===d);if(f.length){const g=`${d}-benchmarks`;s.setNode(g,{type:"Benchmarks",label:"Benchmarks",width:200,height:60+f.length*40}),s.setEdge(d,g,{label:`${g}-edge`,weight:.5,minlen:10});const v=e.filter(b=>f.includes(b.id));for(const b of v)b.data.model=p;p.data.benchmarks=v;const w={id:g,type:"BenchmarkNode",position:{x:0,y:0},data:{label:p.data.label,nodeColor:cr.benchmark,icon:"BenchmarkIcon",displayType:"Benchmarks",typeLabel:"Benchmark_Result",governanceNodes:[],isSourceForConnection:!1,isTargetForConnection:!0,properties:{},enrichments:{},nodeType:"data",registeredBy:"",benchmarks:v}},y={id:`${g}-edge`,source:d,target:g,animated:!1,markerEnd:{type:it.Arrow,strokeWidth:0,color:be.black},style:{stroke:be.black,strokeWidth:2},type:"CustomEdge",data:{benchmarks:f}};i.push(w),a.push(y),h.nodes.add(g),h.edges.add(`${g}-edge`)}}return{nodes:e,edges:n,sinks:c,graph:o,noBenchmarkGraph:s,noBenchmarkNodes:i,noBenchmarkEdges:a,graphName:t}}function Wt(e,n,t,r=30,o=300,s=!0){if(n.length===0)return console.log("no nodes to layout"),0;const i=t.getState().nodeInternals;Ne.layout(e,{minlen:10});for(const c of n){const l=e.node(c.id),d=i.get(c.id);d&&(l.width=d.width??l.width,l.height=d.height??l.height)}const a=new Map;for(const c of n){const l=e.node(c.id),d=a.get(l.rank);d?d.push(c):a.set(l.rank,[c]),s||(c.data.sourcePosition=We.Right,c.data.rank=l.rank,c.position={x:l.x-l.width/2,y:l.y-l.height/2})}if(s){const c=new Map,l=new Map;let d=0;for(const[p,g]of a){g.sort((y,b)=>{const k=e.node(y.id),x=e.node(b.id);return k.y-x.y});let v=0,w=0;for(const y of g){const b=e.node(y.id);v+=b.height,w=Math.max(w,b.width)}v+=(g.length-1)*r,d=Math.max(d,v),c.set(p,v),l.set(p,w)}let h=0;const f=Array.from(a.entries());f.sort((p,g)=>p[0]-g[0]);for(const[p,g]of f){const v=c.get(p)||0,w=l.get(p)||0,y=(d-v)/2;let b=0;for(const[k,x]of g.entries()){const L=e.node(x.id);x.position={x:h+w/2-L.width/2,y:b+y},b+=L.height+r}h+=w+o}}}function _l(e,n=[]){var o;const t=n.length>0?n:e.sinks(),r={};for(const s of t){const i=e.node(s);if(((o=i.type)==null?void 0:o.toLowerCase())!=="model")continue;r[s]={nodes:new Set,edges:new Set,label:i.label};let a=e.predecessors(s);if(a)for(const c of a){const l=e.edge(c,s);l&&r[s].edges.add(l.label)}for(;a&&a.length;){let c=[];for(const l of a){r[s].nodes.add(l);const d=e.predecessors(l);if(d&&d.length){for(const h of d){const f=e.edge(h,l);f&&r[s].edges.add(f.label)}c.push(...d)}}a=c}}return r}function xl(e){const n=new Ne.graphlib.Graph;n.setGraph(e.graph());for(const i of e.nodes())n.setNode(i,e.node(i));for(const i of e.edges())n.setEdge(i,e.edge(i));const t=new Set,r=new Set;let o=e.nodes().filter(i=>{const a=e.node(i);return(a==null?void 0:a.type)==="Benchmark_Result"});for(;o&&o.length;){let i=[];for(const a of o)if(e.node(a).type!=="Model"&&!t.has(a)){t.add(a);const l=e.successors(a);for(const d of l)r.add(d);i.push(...e.predecessors(a))}o=i}for(const i of t){let a=!0,c=e.successors(i);for(const l of c)if(!t.has(l)){a=!1;break}a&&n.removeNode(i)}for(const i of r)t.has(i)&&r.delete(i);const s=Ne.graphlib.alg.components(n);s.sort((i,a)=>a.length-i.length);for(const i of s)if(i.filter(a=>r.has(a)).length)for(const a of i)n.removeNode(a);return n}const Cl={CustomNode:xr,BenchmarkNode:Go,ComputationNode:Is},Il={CustomEdge:zo},Sl={hidden:{x:"100%",transition:{ease:"circIn",duration:.4}},visible:{x:0,transition:{ease:"circOut",duration:.4}}};function $l(){const e=hr(),[n]=_.useState(e);return m.jsx(_.Suspense,{fallback:m.jsx("div",{children:"Suspense"}),children:n})}const jl=()=>{const{graphName:e,nodes:n,edges:t,getNodeById:r,graphState:o,setGraphState:s,governanceFilter:i,activeSink:a,pretty:c,getNodeFromFullGraph:l,hasMeasured:d,onNodesChange:h,onEdgesChange:f,noBenchmarksGraph:p}=$e(I=>({nodes:I.nodes,edges:I.edges,graphState:I.graphState,setGraphState:I.setGraphState,onNodesChange:I.onNodesChange,onEdgesChange:I.onEdgesChange,getNodeById:I.getNodeById,setGovernanceFilter:I.setGovernanceFilter,governanceFilter:I.governanceFilter,activeSink:I.activeSink,pretty:I.pretty,setPretty:I.setPretty,getNodeFromFullGraph:I.getNodeFromFullGraph,hasMeasured:I.hasMeasured,noBenchmarksGraph:I.noBenchmarksGraph,setNodes:I.setNodes,graphName:I.graphName}));lr();const g=_.useRef(null),v=De(),w=ze(),[y]=dn(),b=w.nodeCid,{setCenter:k,fitView:x}=Nr(),L=at(),E=ct();_.useEffect(()=>{L&&x({duration:1e3})},[n.length,L]);const P=!!w.nodeCid;_.useEffect(()=>{i&&N()},[i]);const N=()=>{b&&v(`/explorer/lineage/${w.owner}/${w.repo}?${y.toString()}`)};_.useEffect(()=>{const O=l(b||"");if(O&&d){let J;if(O.data.typeLabel==="Benchmark_Result"){const R=O.data.model;R&&(J=r(`${R.id}-benchmarks`))}else J=r(b||"");if(J){const R=E.getState().nodeInternals.get(J.id);if(J.type==="BenchmarkNode"){const se=document.querySelector(`[data-id="${J.id}"]`);if(se){const $=se.querySelector(`[data-benchmark="${O.id}"]`),j=R.position.x,Y=R.position.y+$.offsetTop+$.offsetHeight/2,X=R.width||0,me=j+300+X/2/.95,wn=Y/.95;k(me,wn,{zoom:.95,duration:1500})}}else{const se=R.position.x,$=R.position.y,j=R.width||0,Y=R.height||0,D=se+300+j/2/.95,me=$+Y/2/.95;k(D,me,{zoom:.95,duration:1500})}}}},[b,k,E,d,n]);const V=()=>{s(o==="vc-off"?"vc-on":"vc-off")},T=e.startsWith("https://")?e:`https://huggingface.co/${e}`,oe=e.length>30?e.slice(0,30)+"...":e,pe="/carousel-one.png";return m.jsx(m.Fragment,{children:m.jsxs("div",{ref:g,className:H(Ee.container,{[Ee.dim]:!!a}),children:[m.jsx(_r,{nodes:n,edges:t,onNodesChange:I=>{p&&n.length&&Wt(p,n,E,30,250,c),h(I)},onEdgesChange:f,onPaneClick:N,snapToGrid:!1,defaultViewport:{x:0,y:0,zoom:.75},minZoom:.05,attributionPosition:"bottom-right",nodeTypes:Cl,edgeTypes:Il,nodesDraggable:!1,nodesConnectable:!1,edgesFocusable:!1,children:m.jsx(Jr,{gap:12,size:1})}),m.jsx(dr,{initial:!1,mode:"wait",children:m.jsx(He.div,{className:Ee.sidebar,initial:"hidden",animate:"visible",exit:"hidden",variants:Sl,children:m.jsx($l,{})},P?"drawer-visible":"drawer-hidden")}),m.jsxs("a",{className:Ee.graphNameHeader,target:"_blank",href:T,children:[m.jsx("div",{className:Ee.graphNameHeaderImg,children:m.jsx("img",{src:pe,alt:""})}),m.jsx("span",{children:oe})]}),m.jsx("div",{className:Ee.switchContainer,children:m.jsx(ds,{selected:o==="vc-on",onClick:V})})]})})},An="#000000",Tl=(e,n)=>n.find(({node:t})=>t.id===e),Ol=(e,n)=>!!n.find(({edge:t})=>t.target_id===e.id&&t.label!=="subject"),Ll=(e,n)=>!!n.find(({edge:t})=>t.source_id===e.id),Ut=(e,n,t)=>{var h,f;const r=e.enrichments||{},o=e.node.properties.nodeType||"unknown",s=o==="computation"?"":((h=e.enrichments.asset_hub)==null?void 0:h.asset_type)||"",{iconId:i,displayType:a,color:c}=Cr(s||o),l=(f=r.asset_hub)!=null&&f.asset_name?r.asset_hub.asset_name:o;return{id:e.node.id,type:o==="computation"?"ComputationNode":"CustomNode",data:{label:l,nodeColor:c,icon:i,displayType:a,typeLabel:s,governanceNodes:Pl(e,"governance",n,t),isSourceForConnection:Ll(e.node,n),isTargetForConnection:Ol(e.node,n),properties:e.node.properties,sourcePosition:We.Right,enrichments:r,nodeType:o,registeredBy:"CHECK API"},position:{x:0,y:0}}},Pl=(e,n,t,r)=>t.filter(({edge:i})=>i.target_id===e.node.id).map(({edge:i})=>{const a=Tl(i.source_id,r);return a&&a.node.properties.nodeType===n?Ut(a,t,r):null}).filter(i=>!!i);function Ml(e,n){return e.filter(({node:s})=>s.properties.nodeType!=="governance").map(s=>Ut(s,n,e)).filter(s=>!!s)}function Bl(e){return e.map(({edge:t})=>({id:t.id,source:t.source_id,target:t.target_id,animated:!1,markerEnd:{type:it.Arrow,strokeWidth:0,color:An},style:{stroke:An,strokeWidth:2},type:"CustomEdge"})).filter(Boolean)}async function Fl(e){const n=await Ir(),t=new Map;for(const r of n)t.set(r.did,r);return t}const en=new Map;async function Gl(e){let n=[];const t=new Set;for(const{node:i}of e)if(i.properties.vcRegistrationsJcs)for(const a of i.properties.vcRegistrationsJcs)t.has(a)||(t.add(a),n.push((async()=>{if(en.has(a))return[a,en.get(a)];const c=await Sr(`text/${$r(a,"urn:cid:")}`);return[a,await c.json()]})()));const r=await Promise.all(n);for(const[i,a]of r)en.set(i,a);const o=new Map(r),s=await Fl();for(const[i,a]of o){const c=s.get(a.credential.issuer);let l="unknown";c&&(l=c.status),a.issuerStatus=l}return o}function Vl(e,n){const t=new Map(n.nodes.map(s=>[s.node.id,s])),r=new Map;for(const s of n.edges){const i=r.get(s.edge.source_id)||[],a=r.get(s.edge.target_id)||[];i.push(s),a.push(s),r.set(s.edge.source_id,i),r.set(s.edge.target_id,a)}const o=new Map;for(const[s,i]of e){const a=i.credential.credentialSubject.id,c=t.get(a),l=r.get(a);if(c){const d=[],h=[c];if(c.node.properties.nodeType==="computation")for(const f of l)d.push(f),f.edge.target_id===a&&h.push(t.get(f.edge.source_id)),f.edge.source_id===a&&h.push(t.get(f.edge.target_id));o.set(s,{edges:d,nodes:h,vc:i})}}return o}const Rl="_searchWrapper_b490g_6",Al="_logo_b490g_38",Dl="_searchBar_b490g_56",nn={"lineage-page-container":"_lineage-page-container_b490g_1",searchWrapper:Rl,logo:Al,searchBar:Dl};function ed(){const[e,n]=_.useState(null),t=De();return m.jsx(Hn,{theme:{components:{Button:{colorPrimary:"rgb(0, 0, 100)",colorBgContainer:be.grey600,colorText:be.grey600,defaultBorderColor:"rgb(0, 0, 0)",colorPrimaryHover:be.grey600}}},children:m.jsxs(jr,{children:[m.jsxs("div",{className:nn.searchWrapper,children:[m.jsxs("button",{onClick:()=>t("/"),children:[m.jsx(Mr,{}),"Back"]}),m.jsx("div",{className:nn.logo,children:m.jsx(Br,{})}),m.jsx(Fr,{className:nn.searchBar,onSearch:()=>{},isLandingPage:!1})]}),m.jsx(zl,{searchedOrUploadedGraph:e,navigate:t})]})})}function zl({searchedOrUploadedGraph:e,navigate:n}){const t=at(),r=ct(),{vcGraph:o,edges:s,nodes:i,noBenchmarkEdges:a,noBenchmarkNodes:c,sinks:l,noBenchmarkGraph:d,graph:h,graphName:f,manifestNotFound:p}=ur();_.useEffect(()=>{p&&n("/not-found")},[p]);const{setVcsToGraph:g,setNodes:v,setEdges:w,setSinkMap:y,setAllNodes:b,setHasMeasured:k,setNoBenchmarksGraph:x,setGraphName:L}=$e(E=>({setGraphName:E.setGraphName,setNodes:E.setNodes,setEdges:E.setEdges,setVcsToGraph:E.setVcsToGraph,setSinkMap:E.setSinkMap,setAllNodes:E.setAllNodes,setHasMeasured:E.setHasMeasured,setNoBenchmarksGraph:E.setNoBenchmarksGraph}));return _.useEffect(()=>{o.then(E=>g(E))},[o]),_.useEffect(()=>{b(i)},[i]),_.useEffect(()=>{t&&k(!0)},[t]),_.useEffect(()=>{e!==null&&(v(e.noBenchmarkNodes),w(e.noBenchmarkEdges),x(e.noBenchmarkGraph),e.sinks&&y(e.sinks),L(e.graphName))},[e]),_.useEffect(()=>{e===null&&(Wt(d,c,r),v(c),w(a),x(d),l&&y(l),L(f))},[a,c,l,d,r,f,e]),m.jsx(jl,{})}async function nd({request:e,params:n}){const t=new URL(e.url),o=t.searchParams.get("search");let s=null,i=null;if(o?(i=o,Tr(o),s=await no(o,"integrity.json")):(i=t.pathname.split("/").slice(3).join("/"),s=await eo(i,"integrity.json")),s.nodes.length===0||s.edges.length===0)return yn({manifestNotFound:!0});const a=Ml(s.nodes,s.edges),c=Bl(s.edges),l=Nl(a,c,i),d=(async()=>{const h=await Gl(s.nodes);return Vl(h,s)})();return yn({graph:l.graph,vcGraph:d,nodes:l.nodes,edges:l.edges,noBenchmarkNodes:l.noBenchmarkNodes,noBenchmarkEdges:l.noBenchmarkEdges,sinks:l.sinks,noBenchmarkGraph:l.noBenchmarkGraph,graphName:l.graphName})}export{ed as Component,nd as loader}; | |