1(()=>{try{let D=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Q=new D.Error().stack;Q&&(D._sentryDebugIds=D._sentryDebugIds||{},D._sentryDebugIds[Q]="7bcfc9a7-b4b6-4e60-9a19-b1fb8a0667d6",D._sentryDebugIdIdentifier="sentry-dbid-7bcfc9a7-b4b6-4e60-9a19-b1fb8a0667d6")}catch{}{let D=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};D.SENTRY_RELEASE={id:"26.7.0-8250.g744dbdf5f076c"}}(self.webpackChunkaiven=self.webpackChunkaiven||[]).push([[699],{39519:(D,Q,r)=>{r.r(Q),r.d(Q,{default:()=>Pt});var t=r(74848),V=r(96540),A=r(81133),E=r(76013),f=r(59335),Ge=r(62954),We=r.n(Ge),Ke=r(92506),o=r(47435),Ve=r(58213),he=r(87065),ke=r(65479),ze=r(24333),Ye=r(4314),ne=r(60727),R=(e=>(e.SourceTop="source-top",e.SourceLeft="source-left",e.SourceRight="source-right",e.SourceBottom="source-bottom",e.TargetTop="target-top",e.TargetLeft="target-left",e.TargetRight="target-right",e.TargetBottom="target-bottom",e))(R||{});const se=({sourceHandlePositions:e,targetHandlePositions:n})=>(0,t.jsx)(t.Fragment,{children:Object.values(R).map(s=>{const i=s.split("-")[0],a=s.split("-")[1],u=i==="source"?e:n;return(0,t.jsx)(A.h7,{type:i,position:a,style:{visibility:u?.includes(a)?"visible":"hidden"},id:s},s)})});var Ue=r(36023),Qe=r(90632);const Xe=({data:{title:e},zIndex:n,selected:s})=>(0,t.jsx)(o.Box.Flex,{paddingTop:"6",alignItems:"flex-start",justifyContent:"center",padding:"5",backgroundColor:"muted",borderWidth:1,borderColor:s?"intense":"default",borderRadius:5,height:"full",style:{zIndex:n},children:(0,t.jsx)(o.Typography.LargeHeading,{children:e})});var Ze=r(73323),Je=r(25413),xe=r(75652),ve=r(7770),X=r(66463),qe=r(94220),fe=r(76485);const me=(0,V.createContext)({serviceIntegrationEndpointsForSelectedProjects:[]}),_e=()=>{const e=(0,V.useContext)(me);if(!e)throw new Error("useDataFlowContext must be used within a DataFlowProvider");return e};var je=r(81736),Z=r(66288),et=r(5188),ye=r(18477);const ie="data-flow-service-integration-details",tt=({data:{endpointName:e,serviceType:n,integration:s,sourceHandlePosition:i,targetHandlePosition:a,isSource:u},id:c,zIndex:d,selected:p})=>{const h=(0,X.C)({serviceType:n,variant:"default"}),l=(0,je.A)(),{getState:j}=(0,A.PI)(),{serviceIntegrationEndpointsForSelectedProjects:S}=_e(),T=S?.find(x=>x.endpoint_name===e),N="autoscaling"in(T?.user_config??{})?(0,Ze.A)(T?.user_config,"autoscaling.0",{}):T?.user_config,y=u?s.source_project:s.dest_project;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(se,{sourceHandlePositions:i?[i]:[],targetHandlePositions:a?[a]:[]}),(0,t.jsxs)(o.Box.Flex,{"data-testid":"endpoint-node",alignItems:"center",gap:"5",padding:"5",backgroundColor:"body",borderWidth:1,borderColor:p?"intense":"default",borderRadius:5,height:"full",style:{zIndex:d},children:[(0,t.jsx)(o.Avatar,{image:h}),(0,t.jsxs)(o.Box.Flex,{flexDirection:"column",gap:"2",children:[(0,t.jsx)(o.Tooltip,{content:e,children:(0,t.jsx)(o.Typography.DefaultStrong,{children:(0,ye.il)(e,20)})}),(0,t.jsxs)(o.Box.Flex,{gap:"2",alignItems:"center",children:[(0,t.jsx)(o.Chip,{text:"External integration"}),(0,t.jsxs)(o.Popover,{placement:o.PositionerPlacement.right,offset:15,analyticsId:(0,f._A)(ie,"details-popover"),children:[(0,t.jsx)(o.Popover.Trigger,{children:(0,t.jsx)("div",{style:{position:"relative"},children:(0,t.jsx)(o.Button.Icon,{tooltip:"Show details",icon:xe.A,analyticsId:(0,f._A)(ie,"open-details"),onClick:()=>j().addSelectedNodes([c]),dense:!0})})}),(0,t.jsx)(o.Popover.Panel,{children:(0,t.jsxs)(o.Box.Flex,{flexDirection:"column",alignItems:"flex-start",gap:"3",padding:"5",style:{width:"350px"},children:[(0,t.jsxs)(o.Box.Flex,{flexDirection:"row",gap:"3",alignItems:"center",children:[(0,t.jsx)(o.Avatar,{image:h}),(0,t.jsx)(o.Box,{style:{wordBreak:"break-all"},children:(0,t.jsx)(o.Typography.DefaultStrong,{children:e})})]}),(0,t.jsxs)(o.Box,{children:[(0,t.jsx)(o.Typography.SmallStrong,{children:"Project"}),(0,t.jsx)(o.Typography.Small,{children:y})]}),N&&(0,t.jsx)(o.Box.Flex,{flexDirection:"column",gap:"3",children:Object.keys(N).filter(x=>!fe.MQ.includes(x)).map(x=>
1{const O=fe.VY[x]??(0,Je.A)((0,et.Gt)(x));return x==="service_account_credentials"?(0,t.jsxs)(o.Box,{children:[(0,t.jsx)(o.Typography.SmallStrong,{children:O}),(0,t.jsx)(o.Textarea,{rows:4,id:`externalGoogleCloudLogging-service-account-credentials-ro-${x}`,value:N.service_account_credentials??"",readOnly:!0})]},x):N[x]?(0,t.jsxs)(o.Box,{children:[(0,t.jsx)(o.Typography.SmallStrong,{children:O}),(0,t.jsx)(o.Typography.Small,{children:(0,qe.U)({configKey:x,configValue:N[x]})})]},x):null})}),(0,t.jsx)(o.Link.Button.Ghost,{dense:!0,icon:ve.A,analyticsId:(0,f._A)(ie,"open-endpoint"),href:(0,Z.F4)({projectName:y,endpointType:s.integration_type,accountId:l,endpointName:e}),target:"_blank",children:"Open endpoint"})]})})]})]})]})]})]})},ot=({data:{title:e,imageSrc:n},zIndex:s,selected:i})=>(0,t.jsxs)(o.Box.Flex,{alignItems:"center",justifyContent:"center",padding:"5",gap:"5",backgroundColor:"body",borderWidth:1,borderColor:i?"intense":"default",borderRadius:5,height:"full",style:{zIndex:s},children:[(0,t.jsx)(o.Avatar,{image:n}),(0,t.jsx)(o.Typography.SmallStrong,{children:e})]});var re=r(75841),ae=r(18162);const nt=({sourceX:e,sourceY:n,targetX:s,targetY:i},a)=>{const u=(e+s)/2,c=(n+i)/2,d=u,p=c+a,h=`M ${e} ${n} Q ${d} ${p} ${s} ${i}`,l=.5,j=(1-l)*(1-l)*e+2*(1-l)*l*d+l*l*s,S=(1-l)*(1-l)*n+2*(1-l)*l*p+l*l*i;return[h,j,S]},st=(e,n)=>{switch(e){case"success":return n?"var(--aquarium-text-color-success-intense)":"var(--aquarium-text-color-success-muted)";case"warning":return n?"var(--aquarium-text-color-warning-intense)":"var(--aquarium-text-color-warning-muted)";case"neutral":return n?"var(--aquarium-text-color-intense)":"var(--aquarium-text-color-muted)"}},Se="data-flow",it=({id:e,sourceX:n,sourceY:s,targetX:i,targetY:a,sourcePosition:u,targetPosition:c,data:d,selected:p})=>{const h=d?.isSelfConnecting??!1,l=d?.isBidirectional??!1;let j,S=0,T=0;const N={sourceX:n,sourceY:s,sourcePosition:u,targetX:i,targetY:a,targetPosition:c};if(h){const w=(n-i)*.6,b=50;j=`M ${n-5} ${s} A ${w} ${b} 0 1 0 ${i+2} ${a}`,S=(n+i)/2,T=s-30-b}else l?[j,S,T]=nt(N,n<i?50:-50):[j,S,T]=(0,E.Fp)(N);const y=d?.integration,x=(0,X.C)({serviceType:y?.source_service_type??"",variant:"default"}),O=(0,X.C)({serviceType:y?.dest_service_type??"",variant:"default"}),{getState:F}=(0,A.PI)();if(!y)return null;const B=(0,ae.xy)(y),M=(0,ae.v9)(y).toUpperCase();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.tE,{id:e,path:j,style:{stroke:st(B,!!p)}}),(0,t.jsx)(A.rV,{children:(0,t.jsx)(o.Box,{borderWidth:1,borderColor:p?B==="neutral"?"intense":`${B}-intense`:"transparent",borderRadius:2,style:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${T}px)`,pointerEvents:"all",cursor:"pointer"},children:(0,t.jsxs)(o.Popover,{analyticsId:(0,f._A)(Se,"edge-status-popover"),children:[(0,t.jsx)(o.Popover.Trigger,{children:(0,t.jsx)(re.A,{analyticsId:(0,f._A)(Se,"edge-status-chip"),onClick:()=>F().addSelectedEdges([e]),children:(0,t.jsx)(o.StatusChip,{status:B,text:M})})}),(0,t.jsx)(o.Popover.Panel,{children:(0,t.jsxs)(o.Box.Flex,{flexDirection:"column",alignItems:"flex-start",gap:"3",padding:"5",style:{width:"20rem"},children:[(0,t.jsx)(o.AvatarStack,{images:[x,O]}),(0,t.jsx)(o.Typography.Small,{children:y?.description}),(0,t.jsxs)(o.Box.Flex,{gap:"3",children:[(0,t.jsx)(o.StatusChip,{status:B,text:M,dense:!0}),(0,t.jsx)(o.Chip,{text:(0,ae.n4)(d?.integration?.dest_service_type??"")?"External integration":"Aiven solution",dense:!0})]})]})})]})})})]})};var Ie=r(80681),Ae=r(74865),rt=r(16193),at=r(96056),dt=r(2007);const lt="data-flow--service-integrations-modal",ct=({projectName:e,serviceName:n,onClose:s,refreshServices:i})=>{(0,dt.hZ)({projectName:e});const a=()=>{i(),s()};return(0,t.jsx)(o.Modal,{title:`Integrations for ${n}`,open:!0,onClose:s,analyticsId:lt,size:"full",children:(0,t.jsx)(at.g,{projectName:e,serviceName:n,onIntegrationEnabled:a,onIntegrationDisabled:a,hideHeader:!0})})};var Ne=r(44761),gt=r(99232),Te=r(61651),q=r(56074),we=r(99280),ut=r(27725),_=r(69548),pt=(e=>(e.ServiceIntegrations="service-integrations",e.DataIntegrations="data-integrations",e.ClickhouseManageDataIntegrations="clickhouse-manage-integrations",e))(pt||{});const U="data-flow-service-node-details",ht=({data:{service:e,sourceHandlePositions:n,targetHandlePositions:s,refreshServices:i},id:a,zIndex:u,selected:c})=>{const d=(0,je.A)(),{getState:p}=(0,A.PI)(),h=(0,X.C)({service:e}),l=(0,ut.kv)(e),{data:j}=(0,gt.A)({accountId:d,projectName:e.project_name,serviceTypeName:e.service_type,servicePlanId:e.plan,kind:(0,we.Pm)(e)}),{planName:S,planDetails:T}=(0,we.J4)(e);let N=T;if(j?.kind==="plan"&&j.plan.is_cluster_plan){const I=(0,Te.hP)(j.plan.regions?.[e.cloud_name??""]?.node_groups);I&&(N=(0,Te.h3)(I))}
1const{cloud_description:y,cloud_name:x}=e,[O,F]=(0,V.useState)(!1),[B,M]=(0,V.useState)(!1),w=()=>{p().addSelectedNodes([a]),F(!1)},b=y?`${y} (${x})`:x,k=e.service_type===q.C0.ClickHouse?{"service-integrations":"Add service integrations","data-integrations":"Add data integrations","clickhouse-manage-integrations":"Manage data integrations"}:{"service-integrations":"Add service integrations","data-integrations":"Add data integrations"};return d?(0,t.jsxs)(o.Box,{height:"full",onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:[(0,t.jsx)(se,{sourceHandlePositions:n,targetHandlePositions:s}),(0,t.jsxs)(o.Box.Flex,{"data-testid":"service-node",backgroundColor:"body",borderWidth:1,borderColor:c?"intense":"default",borderRadius:5,height:"full",padding:"5",gap:"2",alignItems:"center",justifyContent:"space-between",style:{zIndex:u,overflow:"hidden "},children:[(0,t.jsxs)(o.Box.Flex,{flex:1,gap:"5",alignItems:"center",style:{overflow:"hidden"},children:[(0,t.jsx)(o.Avatar,{image:h}),(0,t.jsxs)(o.Box.Flex,{flexDirection:"column",gap:"2",style:{overflow:"hidden"},children:[(0,t.jsx)(o.Typography.DefaultStrong,{className:_.gY,children:e.service_name}),(0,t.jsxs)(o.Box.Flex,{gap:"3",flexDirection:"row",alignItems:"center",children:[(0,t.jsx)(Ae.A,{service:e,projectName:e.project_name,onClick:w}),(0,t.jsx)(Ne.A,{service:e}),(0,t.jsxs)(o.Popover,{placement:o.PositionerPlacement.right,offset:15,analyticsId:(0,f._A)(U,"details-popover"),children:[(0,t.jsx)(o.Popover.Trigger,{children:(0,t.jsx)("div",{style:{position:"relative"},children:(0,t.jsx)(o.Button.Icon,{tooltip:"Show details",icon:xe.A,analyticsId:(0,f._A)(U,"open-details"),onClick:w,dense:!0})})}),(0,t.jsx)(o.Popover.Panel,{children:(0,t.jsxs)(o.Box.Flex,{flexDirection:"column",alignItems:"flex-start",gap:"3",padding:"5",style:{width:"350px"},children:[(0,t.jsxs)(o.Box.Flex,{flexDirection:"row",gap:"3",alignItems:"center",children:[(0,t.jsx)(o.Avatar,{image:h}),(0,t.jsx)(o.Box,{style:{wordBreak:"break-all"},children:(0,t.jsx)(o.Typography.DefaultStrong,{children:e.service_name})})]}),(0,t.jsxs)(o.Box.Flex,{gap:"3",flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap",children:[(0,t.jsx)(Ae.A,{service:e,projectName:e.project_name}),(0,t.jsx)(o.StatusChip,{dense:!0,text:l}),(0,t.jsx)(Ne.A,{service:e})]}),(0,t.jsxs)(o.Box,{children:[(0,t.jsx)(o.Typography.SmallStrong,{children:"Project"}),(0,t.jsx)(o.Typography.Small,{children:e.project_name})]}),(0,t.jsxs)(o.Box,{children:[(0,t.jsx)(o.Typography.SmallStrong,{children:"Plan"}),(0,t.jsxs)(o.Typography.Small,{children:[S," (",N,")"]})]}),(0,t.jsxs)(o.Box,{children:[(0,t.jsx)(o.Typography.SmallStrong,{children:"Cloud"}),(0,t.jsx)(o.Typography.Small,{children:b})]}),e.tags&&(0,t.jsx)(o.Box,{children:(0,t.jsx)(rt.A,{tagKeyValues:Object.entries(e.tags),flexWrap:"wrap",colGap:"4",rowGap:"2",alignContent:"center",showAll:!0})}),(0,t.jsx)(o.Link.Button.Ghost,{dense:!0,icon:ve.A,analyticsId:(0,f._A)(U,"open-service-overview"),href:(0,Z.eF)({projectName:e.project_name,serviceName:e.service_name,accountId:d}),target:"_blank",children:"Open service"})]})})]})]})]})]}),(c||O)&&(0,t.jsx)(o.Box.Flex,{className:_.vx,justifyContent:"center",alignItems:"center",children:[q.C0.Flink,q.C0.ClickHouse].includes(e.service_type)?(0,t.jsxs)(o.DropdownMenu,{placement:"right",onOpenChange:I=>{I&&w()},analyticsId:(0,f._A)(U,"integration-menu"),onAction:I=>{I==="service-integrations"&&M(!0),I==="data-integrations"&&(e.service_type===q.C0.Flink?window.open((0,Z.Ol)({projectName:e.project_name,accountId:d,serviceName:e.service_name}),"_blank"):window.open((0,Z.vq)({projectName:e.project_name,accountId:d,serviceName:e.service_name}),"_blank")),I==="clickhouse-manage-integrations"&&window.open((0,Z.vq)({projectName:e.project_name,accountId:d,serviceName:e.service_name}),"_blank")},children:[(0,t.jsx)(o.DropdownMenu.Trigger,{children:(0,t.jsx)(re.A,{analyticsId:(0,f._A)(U,"add-integrations"),className:_.ei,"aria-label":"Add integration",children:(0,t.jsx)(o.InlineIcon,{icon:Ie.A})})}),(0,t.jsx)(o.DropdownMenu.Items,{children:Object.entries(k).map(([I,P])=>(0,t.jsx)(o.DropdownMenu.Item,{children:P},I))})]}):(0,t.jsx)(o.Tooltip,{content:"Add integration",placement:"top",children:(0,t.jsx)(re.A,{analyticsId:(0,f._A)(U,"add-integrations"),className:_.ei,"aria-label":"Add integration",onClick:()=>{w(),M(!0)},children:(0,t.jsx)(o.InlineIcon,{icon:Ie.A})})})}),B&&(0,t.jsx)(ct,{projectName:e.project_name,serviceName:e.service_name,onClose:()=>M(!1),refreshServices:i})]})]}):null},Ce=({data:{title:e,description:n,truncateTitle:s=!1,chipText:i,serviceType:a,sourceHandlePosition:u,targetHandlePosition:c},zIndex:d,selected:p})=>{const h=(0,X.C)({serviceType:a,variant:"default"});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(se,{sourceHandlePositions:u?[u]:[],targetHandlePositions:c?[c]:[]}),(0,t.jsxs)(o.Box.Flex,{"data-testid":"simple-service-node",alignItems:"center",gap:"5",padding:"5",backgroundColor:"body",borderWidth:1,borderColor:p?"intense":"default",borderRadius:5,height:"full",style:{zIndex:d},children:[(0,t.jsx)(o.Avatar,{image:h}),(0,t.jsxs)(o.Box.Flex,{flexDirection:"column",gap:"2",children:[s?(0,t.jsx)(o.Tooltip,{content:e,children:(0,t.jsx)(o.Typography.DefaultStrong,{children:(0,ye.il)(e,20)})}):(0,t.jsx)(o.Typography.DefaultStrong,{children:e}),(0,t.jsx)(o.Typography.Small,{children:n}),(0,t.jsx)(o.Box,{children:i&&(0,t.jsx)(o.Chip,{text:i})})]})]})]})},De=(e,n=500,s=500)=>{switch(e.type){case m.ServiceNode:return{height:75,width:300};case m.SimpleServiceNode:return{height:75,width:300};case m.EndpointNode:return{height:75,width:300};case m.TopicNode:return{height:50,width:200};case m.GroupNode:return{height:200,width:300};default:return{height:n,width:s}}},Ee=e=>e.map(n=>{const s=De(n);switch(n.type){case m.SimpleServiceNode:return{...n,style:s};case m.ServiceNode:return{...n,style:s};case m.EndpointNode:return{...n,style:s};case m.TopicNode:return{...n,style:s};case m.GroupNode:return{...n,style:s};default:return{...n}}}),Be=e=>e.map(n=>({animated:!0,...n})),be=async({elk:e,nodes:n,edges:s,options:i={}})=>{const a=i?.["elk.direction"]==="RIGHT",u={id:"root",layoutOptions:i,children:n.map(c=>{const{width:d,height:p}=De(c);return{...c,targetHandlePosition:a?"left":"top",sourceHandlePosition:a?"right":"bottom",width:d,height:p}}),edges:s};return e.layout(u).then(c=>({nodes:c.children?.map(d=>({...d,position:{x:d.x??0,y:d.y??0}}))??[],edges:c.edges,height:c.height,width:c.width,x:c.x,y:c.y}))};var Vt=r(75575),m=(e=>(e.SimpleServiceNode="simpleServiceNode",e.ServiceNode="serviceNode",e.EndpointNode="endpointNode",e.TopicNode="topicNode",e.GroupNode="groupNode",e.DataFlowGroupNode="dataFlowGroupNode",e))(m||{}),Fe=(e=>(e.ServiceIntegrationEdge="serviceIntegrationEdge",e))(Fe||{});const xt={serviceNode:ht,simpleServiceNode:Ce,endpointNode:tt,topicNode:Ce,groupNode:ot,dataFlowGroupNode:Xe},vt={serviceIntegrationEdge:it},$=({initialNodes:e=[],initialEdges:n=[],interactive:s=!1,children:i,analyticsId:a,analyticsContexts:u,onClick:c,...d})=>(0,t.jsx)(Ue.tH,{beforeCapture:p=>{p.setTag("react.error.boundary.id","DataFlow")},fallback:(0,t.jsx)(o.Alert,{type:"error",children:"Unexpected problem with the data visualization. Please try again."}),children:(0,t.jsx)(A.Gc,{defaultNodes:Ee(e),defaultEdges:Be(n),nodeTypes:xt,edgeTypes:vt,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:s,panOnDrag:s,preventScrolling:s,onClick:(0,Qe.vE)(c,{analyticsContexts:u,anal
1yticsId:a}),minZoom:0,...d,children:i})});$.Controls=A.H2,$.MiniMap=A.of,$.Background=A.VS,$.Panel=A.Zk;var ft=r(90955),mt=r(20706),Pe=r(99767),H=r(90169);const de=E.yX.Right,le=E.yX.Left,jt=[H.Bau.FLINK,H.Bau.FLINK_EXTERNAL_BIGQUERY,H.Bau.FLINK_EXTERNAL_POSTGRESQL,H.Bau.FLINK_EXTERNAL_KAFKA,H.Bau.KAFKA_MIRRORMAKER,H.Bau.KAFKA_CONNECT],yt=e=>jt.includes(e.integration_type),St=[H.Bau.DATASOURCE,H.Bau.DASHBOARD],L=e=>St.includes(e.integration_type),ce=({service:e,parentId:n=void 0,draggable:s=!0,refreshServices:i})=>({id:`${e.project_name}/${e.service_name}`,type:m.ServiceNode,position:{x:0,y:0},data:{service:e,refreshServices:i},parentId:n,extent:n?"parent":void 0,draggable:s}),It=e=>{const n=i=>L(i)?i.dest_endpoint_id??`${i.dest_project}/${i.dest_service}`:i.source_endpoint_id??`${i.source_project}/${i.source_service}`,s=i=>L(i)?i.source_endpoint_id??`${i.source_project}/${i.source_service}`:i.dest_endpoint_id??`${i.dest_project}/${i.dest_service}`;return{id:e.service_integration_id??"",source:n(e),target:s(e),sourceHandle:R.SourceRight,targetHandle:R.TargetLeft,type:Fe.ServiceIntegrationEdge,animated:!yt(e),data:{integration:e}}},At=(e,n)=>{const s=n==="source",i=s?e.source_project:e.dest_project,a=s?e.source_service:e.dest_service,u=s?e.source_service_type:e.dest_service_type,d=L(e)?!s:s;return{id:`${i}/${a}`,type:m.SimpleServiceNode,position:{x:0,y:0},data:{title:a,serviceType:u,sourceHandlePosition:d?de:void 0,targetHandlePosition:d?void 0:le,chipText:i,truncateTitle:!0}}},Re=(e,n)=>{const s=n==="source",i=s?e.source_endpoint_id:e.dest_endpoint_id,a=s?e.source_endpoint:e.dest_endpoint,u=s?e.source_service_type:e.dest_service_type,d=L(e)?!s:s;return{id:i??"",type:m.EndpointNode,position:{x:0,y:0},data:{endpointName:a,serviceType:u,integration:e,sourceHandlePosition:d?de:void 0,targetHandlePosition:d?void 0:le,isSource:s}}},Nt=(e,n,s)=>{if(e.service_integration_id&&!n.some(i=>i.id===e.service_integration_id)){const i=It(e);s.some(a=>a.id===i.source)&&s.some(a=>a.id===i.target)&&n.push(i)}},$e=({selectedProjectNames:e,integration:n,servicesForSelectedProjects:s,nodes:i,direction:a,refreshServices:u})=>{const c=a==="source",d=c?n.source_project:n.dest_project,p=c?n.source_service:n.dest_service;if(p&&!i.find(h=>h.id===`${d}/${p}`))if(!e.includes(d))i.push(At(n,a));else{const h=s?.find(l=>l.service_name===p);h&&i.push(ce({service:h,refreshServices:u}))}},Tt=({selectedProjectNames:e,integration:n,servicesForSelectedProjects:s,nodes:i,refreshServices:a})=>{$e({selectedProjectNames:e,integration:n,servicesForSelectedProjects:s,nodes:i,direction:"source",refreshServices:a}),$e({selectedProjectNames:e,integration:n,servicesForSelectedProjects:s,nodes:i,direction:"dest",refreshServices:a})},wt=(e,n)=>{e.source_endpoint_id&&!n.find(s=>s.id===e.source_endpoint_id)&&n.push(Re(e,"source")),e.dest_endpoint_id&&!n.find(s=>s.id===e.source_endpoint_id)&&n.push(Re(e,"dest"))},Ct=({selectedProjectNames:e,servicesForSelectedProjects:n,filteredServices:s,refreshServices:i})=>{const a={id:"without-integration-parent",type:m.DataFlowGroupNode,data:{title:"Services without integrations"},position:{x:0,y:0},draggable:!1},u=s.filter(l=>l.service_integrations.length===0).map(l=>ce({service:l,parentId:"without-integration-parent",draggable:!1,refreshServices:i})),c=s.filter(l=>l.service_integrations.length>0),d=c.map(l=>ce({service:l,refreshServices:i})),{edges:p,nodes:h}=c.map(l=>l.service_integrations).reduce((l,j)=>(j.forEach(S=>{Tt({selectedProjectNames:e,integration:S,servicesForSelectedProjects:n,nodes:l.nodes,refreshServices:i}),wt(S,l.nodes),Nt(S,l.edges,l.nodes)}),l),{edges:[],nodes:[...d??[]]})??{edges:[],nodes:[...d??[]]};return{edges:p,nodes:h,servicesNodesWithoutIntegrations:u,serviceNodesWithoutIntegrationsGroupNode:a}};var Dt=r(72952);const Et=({serviceIntegrationEndpointsForSelectedProjects:e,children:n})=>(0,t.jsx)(me.Provider,{value:{serviceIntegrationEndpointsForSelectedProjects:e},children:n}),Bt=({serviceIntegrationEndpointsForSelectedProjects:e,...n})=>(0,t.jsx)(A.Ln,{children:(0,t.jsx)(Et,{serviceIntegrationEndpointsForSelectedProjects:e,children:(0,t.jsx)(Ft,{...n})})}),He=new(We()),Le={"elk.algorithm":"layered","elk.direction":"RIGHT","elk.edgeRouting":"POLYLINE"},bt={...Le,"elk.layered.spacing.nodeNodeBetweenLayers":"200","elk.spacing.nodeNode":"80","elk.spacing.componentComponent":"150"},ge=e=>(0,t.jsx)(o.Box,{borderColor:"muted",borderRadius:"4px",borderWidth:1,backgroundColor:"body",children:e.children}),Ft=({refreshServices:e,refreshServicesLoading:n,selectedProjectNames:s,filteredServices:i,servicesForSelectedProjects:a,isLoadingDataFlow:u,analyticsId:c,analyticsContexts:d,toggleFullscreen:p,fullscreen:h})=>{const[l,j]=(0,A.ck)([]),[S,T]=(0,A.fM)([]),[N,y]=(0,V.useState)(),{fitView:x,getNodes:O}=(0,A.VH)(),[F,B]=(0,V.useState)(!1);if((0,V.useLayoutEffect)(()=>{let w=!0;if(!s.length||!a||!i)return;const{edges:b,nodes:k,servicesNodesWithoutIntegrations:I,serviceNodesWithoutIntegrationsGroupNode:P}=Ct({selectedProjectNames:s,servicesForSelectedProjects:a,filteredServices:i,refreshServices:e});return Promise.all([be({elk:He,nodes:k,edges:b,options:bt}),be({elk:He,nodes:I,edges:[],options:Le})]).then(([{nodes:G,edges:Oe,width:Rt,y:$t},{nodes:Me,height:Ht,width:Lt}])=>{P.position={x:(Rt??12)+200,y:$t??12},P.style={...P.style,width:Lt??0,height:(Ht??0)+130};const ue=[...G.map(v=>{if(v.type===m.ServiceNode){const C=v,W=G.filter(g=>g.type===m.ServiceNode&&g.data.service.service_integrations.length>0).map(g=>g).filter(({id:g})=>g!==C.id).find(g=>g.data.service.service_integrations.some(J=>C.data.service.service_integrations.some(({source_service:Wt,dest_service:Kt})=>J.source_service===Kt&&J.dest_service===Wt))),ee=g=>L(g)?g.dest_service:g.source_service,z=g=>L(g)?g.dest_project:g.source_project,K=g=>L(g)?g.source_service:g.dest_service,Y=g=>L(g)?g.source_project:g.dest_project,Mt=C.data.service.service_integrations.some(g=>ee(g)===C.data.service.service_name&&K(g)!==W?.data.service.service_name&&s.includes(z(g))),Gt=C.data.service.service_integrations.some(g=>K(g)===C.data.service.service_name&&ee(g)!==W?.data.service.service_name&&s.includes(Y(g)));let te=Mt?[de]:[],oe=Gt?[le]:[];if(W){const g=C.position.x>=W.position.x?E.yX.Left:E.yX.Right;te.includes(g)||(te=[...te,g]);const J=C.position.x>=W.position.x?E.yX.Left:E.yX.Right;oe.includes(J)||(oe=[...oe,J])}return{...C,data:{...C.data,sourceHandlePositions:te,targetHandlePositions:oe}}}return v}),...Me.length>0?[P]:[],...Me.map(v=>({...v,position:{...v.position,y:v.position.y+130}}))],Ot=[...Oe.map(v=>{const C=Oe.some(({id:z,source:K,target:Y})=>z!==v.id&&K===v.target&&Y===v.source);let pe=v.sourceHandle,W=v.targetHandle;if(C){const z=ue.find(Y=>Y.id===v.source),K=ue.find(Y=>Y.id===v.target);pe=z&&"sourceHandlePositions"in z.data&&z.data.sourceHandlePositions?.includes(E.yX.Left)?R.SourceLeft:R.SourceRight,W=K&&"targetHandlePositions"in K.data&&K.data.targetHandlePositions?.includes(E.yX.Right)?R.TargetRight:R.TargetLeft}const ee=v.source===v.target;return{...v,sourceHandle:pe,targetHandle:W,data:{...v.data,isBidirectional:C,isSelfConnecting:ee}}})];w&&(j(Ee(ue)),T(Be(Ot)),y(void 0))}).catch(G=>
1{(0,Pe.PT)(`Something went wrong while creating the data flow. ${G}`),y("Something went wrong while creating the data flow.")}),()=>{w=!1}},[i,a,s,x,T,j,e]),u)return(0,t.jsx)(ft.A,{});const M=()=>{const w=(0,E.Jo)(O()),b=w.width,k=w.height,I=(0,E.R4)(w,b,k,.5,2,0),P=document.querySelector(".react-flow__viewport");P&&(0,Ke.ZR)(P,{backgroundColor:"#fff",width:b,height:k,style:{width:String(b),height:String(k),transform:`translate(${I.x}px, ${I.y}px) scale(${I.zoom})`},quality:1}).then(G=>{(0,mt.P)("aiven-data-flow.png",G)}).catch(G=>{(0,Pe.PT)(`Something went wrong while downloading the image. ${G}`),y("Something went wrong while downloading the image.")}).finally(()=>{B(!1)})};return s.length?!a.length&&!n?(0,t.jsx)(ne.pp,{title:"Selected projects have no services",primaryAction:{text:"Refresh services",loading:n,onClick:e},image:Dt.A}):a&&a.length&&i&&!i.length?(0,t.jsx)(ne.pp,{title:"No services found matching the filter criteria"}):(0,t.jsx)(o.Section,{analyticsId:f.v$,children:(0,t.jsxs)(o.Box,{style:{height:h?"calc(100vh - 15rem)":"calc(100vh - 38rem)",minHeight:"45rem"},children:[!!N&&(0,t.jsx)(o.Alert,{type:"error",analyticsId:(0,f._A)(c,"elk-error"),analyticsContexts:d,onDismiss:()=>y(void 0),children:N}),(0,t.jsxs)($,{nodes:l,edges:S,interactive:!0,nodesConnectable:!1,analyticsId:(0,f._A)(c,"diagram"),analyticsContexts:d,children:[(0,t.jsx)($.Panel,{position:"top-right",children:(0,t.jsxs)(o.Box.Flex,{gap:"3",children:[(0,t.jsx)(ge,{children:(0,t.jsx)(o.Button.Icon,{analyticsId:(0,f._A)(c,"download-image"),analyticsContexts:d,icon:F?he.A:Ve.A,"aria-label":"Download image",onClick:()=>{B(!0),setTimeout(()=>{M()},200)},tooltip:F?"Preparing diagram for download...":"Download the diagram as image",disabled:F})}),(0,t.jsx)(ge,{children:(0,t.jsx)(o.Button.Icon,{analyticsId:(0,f._A)(c,"refresh"),analyticsContexts:d,icon:n?he.A:Ye.A,"aria-label":"Refresh services",onClick:()=>{e()},tooltip:n?"Refreshing services":"Refresh services"})}),(0,t.jsx)(ge,{children:(0,t.jsx)(o.Button.Icon,{analyticsId:(0,f._A)(c,"fullscreen"),analyticsContexts:d,icon:h?ze.A:ke.A,"aria-label":`Toggle fullscreen ${h?"off":"on"}`,onClick:()=>{p()},tooltip:`Toggle fullscreen ${h?"off":"on"}`})})]})}),(0,t.jsx)($.MiniMap,{nodeColor:"var(--aquarium-border-color-primary-muted)",ariaLabel:"Data flow minimap",pannable:!0,zoomable:!0}),(0,t.jsx)($.Controls,{showInteractive:!1})]})]})}):(0,t.jsx)(ne.pp,{title:"Select projects to visualize the data flow"})},Pt=Bt},69548:D=>{D.exports={gY:"aiven-69548-gY","ServiceNode-service-name":"aiven-69548-gY",vx:"aiven-69548-vx","ServiceNode-add-integration":"aiven-69548-vx",ei:"aiven-69548-ei","ServiceNode-add-integration-button":"aiven-69548-ei"}}}]);})();
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.