@odigos/ui-kit 0.0.238 → 0.0.239

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/chunks/{index-D6SlbWIi.js → index-B5PgIL40.js} +1 -1
  3. package/lib/chunks/index-Dy4pkeq6.js +145 -0
  4. package/lib/chunks/index-uXyrp4Xe.js +41 -0
  5. package/lib/chunks/ui-components-BPdnIOmj.js +2248 -0
  6. package/lib/components/_v2/cards/data-card/index.d.ts +6 -1
  7. package/lib/components/_v2/drawer/header/index.d.ts +2 -0
  8. package/lib/components/_v2/drawer/index.d.ts +1 -1
  9. package/lib/components/_v2/drop-data/index.d.ts +1 -2
  10. package/lib/components/_v2/icon-group/index.d.ts +10 -0
  11. package/lib/components/_v2/index.d.ts +1 -0
  12. package/lib/components/_v2/tag/index.d.ts +10 -0
  13. package/lib/components/_v2/typography/index.d.ts +2 -0
  14. package/lib/components/v2.js +1 -1
  15. package/lib/components.js +1 -1
  16. package/lib/constants/sources/index.d.ts +5 -0
  17. package/lib/constants/strings/index.d.ts +89 -0
  18. package/lib/constants.js +1 -1
  19. package/lib/containers/_v2/_drawers/edit-source-drawer/common/index.d.ts +1 -0
  20. package/lib/containers/_v2/_drawers/edit-source-drawer/common/pods-header.d.ts +8 -0
  21. package/lib/containers/_v2/_drawers/edit-source-drawer/helpers.d.ts +12 -0
  22. package/lib/containers/_v2/_drawers/edit-source-drawer/index.d.ts +19 -0
  23. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/containers-card/distro-override.d.ts +11 -0
  24. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/containers-card/index.d.ts +7 -0
  25. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/containers-card/popup-form.d.ts +15 -0
  26. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/containers-card/runtime-override.d.ts +10 -0
  27. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/health-card.d.ts +6 -0
  28. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/index.d.ts +10 -0
  29. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/main-card.d.ts +6 -0
  30. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/index.d.ts +6 -0
  31. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/pods-list/container-row.d.ts +9 -0
  32. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/pods-list/helpers.d.ts +16 -0
  33. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/pods-list/index.d.ts +12 -0
  34. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/pods-list/pod-row.d.ts +8 -0
  35. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/pods-list/process-row.d.ts +10 -0
  36. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/pods-list/row-header.d.ts +13 -0
  37. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/pods-card/pods-list/types.d.ts +18 -0
  38. package/lib/containers/_v2/_drawers/edit-source-drawer/overview/statuses-card.d.ts +8 -0
  39. package/lib/containers/_v2/_drawers/edit-source-drawer/peers/index.d.ts +11 -0
  40. package/lib/containers/_v2/_drawers/edit-source-drawer/pods/containers-card/index.d.ts +7 -0
  41. package/lib/containers/_v2/_drawers/edit-source-drawer/pods/containers-card/process-card.d.ts +3 -0
  42. package/lib/containers/_v2/_drawers/edit-source-drawer/pods/debug-commands.d.ts +6 -0
  43. package/lib/containers/_v2/_drawers/edit-source-drawer/pods/index.d.ts +7 -0
  44. package/lib/containers/_v2/_drawers/edit-source-drawer/pods/pod-card.d.ts +8 -0
  45. package/lib/containers/_v2/_drawers/index.d.ts +1 -0
  46. package/lib/containers/_v2/_forms/edit-source-form/index.d.ts +2 -0
  47. package/lib/containers/_v2/_forms/index.d.ts +1 -0
  48. package/lib/containers/_v2/_modals/index.d.ts +1 -0
  49. package/lib/containers/_v2/_modals/onboarding-done/background.d.ts +5 -0
  50. package/lib/containers/_v2/_modals/onboarding-done/index.d.ts +3 -0
  51. package/lib/containers/_v2/overview/drawers/index.d.ts +1 -3
  52. package/lib/containers/source-drawer/index.d.ts +1 -1
  53. package/lib/containers/v2.js +226 -121
  54. package/lib/containers.js +49 -19
  55. package/lib/contexts/action-form-context.d.ts +0 -1
  56. package/lib/contexts/destination-form-context.d.ts +0 -1
  57. package/lib/contexts/index.d.ts +1 -0
  58. package/lib/contexts/rule-form-context.d.ts +0 -1
  59. package/lib/contexts/source-edit-form-context.d.ts +17 -0
  60. package/lib/contexts.js +1 -1
  61. package/lib/functions/get-containers-icons/index.d.ts +3 -1
  62. package/lib/functions/get-virtual-service-icon/index.d.ts +1 -1
  63. package/lib/functions/get-workload-id/index.d.ts +2 -2
  64. package/lib/functions/index.d.ts +2 -0
  65. package/lib/functions/is-pod-injected-with-agent/index.d.ts +3 -0
  66. package/lib/functions/map-desired-status-to-condition-status/index.d.ts +2 -0
  67. package/lib/functions.js +1 -1
  68. package/lib/hooks.js +1 -1
  69. package/lib/icons/brand/index.d.ts +3 -0
  70. package/lib/icons/brand/odigos-logo-text-colored-central/index.d.ts +2 -0
  71. package/lib/icons/brand/odigos-logo-text-colored-community/index.d.ts +2 -0
  72. package/lib/icons/brand/odigos-logo-text-colored-enterprise/index.d.ts +2 -0
  73. package/lib/icons.js +1 -1
  74. package/lib/mock-data/profiling/index.d.ts +1 -1
  75. package/lib/mock-data/service-map/index.d.ts +1 -1
  76. package/lib/mock-data/sources/index.d.ts +1 -1
  77. package/lib/snippets/_v2/odigos-logo-text-by-tier/index.d.ts +2 -0
  78. package/lib/snippets/_v2/rich-title/index.d.ts +5 -0
  79. package/lib/snippets/_v2/wide-drawer/index.d.ts +7 -1
  80. package/lib/snippets/source-container/index.d.ts +1 -2
  81. package/lib/snippets/v2.js +1 -1
  82. package/lib/snippets.js +1 -1
  83. package/lib/store.js +1 -1
  84. package/lib/theme.js +1 -1
  85. package/lib/types/common/index.d.ts +28 -0
  86. package/lib/types/service-map/index.d.ts +2 -2
  87. package/lib/types/sources/index.d.ts +7 -3
  88. package/lib/types/workload/index.d.ts +178 -1
  89. package/lib/types.js +1 -1
  90. package/lib/visuals.js +1 -1
  91. package/package.json +1 -1
  92. package/lib/chunks/index-CCaTS6aq.js +0 -145
  93. package/lib/chunks/index-ChkHWnzu.js +0 -77
  94. package/lib/chunks/ui-components-rpRyPe3l.js +0 -2235
  95. /package/lib/containers/{source-drawer → _v2/_drawers/edit-source-drawer}/profiling/flame-graph-canvas.d.ts +0 -0
  96. /package/lib/containers/{source-drawer → _v2/_drawers/edit-source-drawer}/profiling/flamebearer.d.ts +0 -0
  97. /package/lib/containers/{source-drawer → _v2/_drawers/edit-source-drawer}/profiling/index.d.ts +0 -0
  98. /package/lib/containers/{source-drawer → _v2/_drawers/edit-source-drawer}/profiling/symbol-table.d.ts +0 -0
@@ -1,77 +0,0 @@
1
- import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{forwardRef as i,useState as o,useRef as l,useImperativeHandle as r,useEffect as a,Children as s,Fragment as c,useLayoutEffect as d,useMemo as u,useCallback as h}from"react";import f,{useTheme as m}from"styled-components";import{y as p,z as g,T as v,G as y,H as b,J as x,K as w,E as S,L as k,n as $,M as C,O as T,j as z,Q as I,R as N,U as F,b as P,V as E,F as O,e as R,S as L,W as D,X as M,s as A,Y as B,Z as W,_ as X,$ as j,g as V,a0 as Y,x as H,a1 as _,a2 as U,a3 as J,a4 as K,a5 as Z,a6 as G,B as q,a as Q,a7 as ee,a8 as te,a9 as ne,aa as ie,ab as oe,ac as le,ad as re,ae,af as se,ag as ce,ah as de,ai as ue,N as he,aj as fe,t as me,ak as pe,al as ge,am as ve,an as ye,ao as be,ap as xe,aq as we,ar as Se,as as ke,at as $e}from"./ui-components-rpRyPe3l.js";import{Y as Ce}from"./index-D6SlbWIi.js";import{EditIcon as Te,TrashIcon as ze,RefreshIcon as Ie,SearchIcon as Ne,MinusIcon as Fe,PlusIcon as Pe,XIcon as Ee,ExpandIcon as Oe,CopyIcon as Re,DotIcon as Le,DownloadIcon as De,RefreshLeftArrowIcon as Me}from"../icons.js";const Ae=i(({children:i,width:a=640,title:s,titleTooltip:c,hideEditTitleFromEdit:d,icons:u,iconSrcs:h,isEdit:f=!1,isFormDirty:k=!1,isLastItem:$=!1,onClose:C,onEdit:T,onSave:z,onDelete:I,onCancel:N,tabs:F,headerActionButtons:P},E)=>{const O=m(),{drawerType:R,setDrawerType:L,setDrawerEntityId:D}=p();g({key:"Enter",active:f},()=>J());const[M,A]=o(!1),[B,W]=o(!1),X=l(null),j=R===S.Source,V=()=>{A(!1),W(!1)},Y=()=>{V(),T&&T(!1),L(null),D(null),C?.()};r(E,()=>({closeDrawer:Y}));const H=()=>{X.current?.clearTitle(),N&&N(),V()},_=()=>{const e=X.current?.isTitleDirty();k||e?W(!0):H()},U=()=>{A(!0)},J=()=>{z&&z(X.current?.getTitle()||"")},K=P||[];return T&&!f&&K.push({"data-id":"drawer-edit",variant:"tertiary",onClick:()=>T(!0),children:e(t,{children:[n(Te,{}),n(v,{size:14,family:"secondary",decoration:"underline",children:"Edit"})]})}),I&&!f&&K.push({"data-id":"drawer-delete",variant:"tertiary",onClick:U,children:e(t,{children:[n(ze,{}),n(v,{color:O.text.error,size:14,family:"secondary",decoration:"underline",children:j?y.UNINSTRUMENT:y.DELETE})]})}),e(t,{children:[n(b,{isOpen:!0,onClose:f?_:Y,closeOnEscape:!M&&!B,width:"number"==typeof a?`${a+64}px`:a,header:{icons:u,iconSrcs:h,title:s,titleTooltip:c,replaceTitleWith:!d&&f?n(Be,{ref:X,title:s}):void 0,actionButtons:K,tabs:F},footer:{isOpen:f,leftButtons:[{"data-id":"drawer-save",variant:"primary",onClick:J,children:y.SAVE},{"data-id":"drawer-cancel",variant:"secondary",onClick:_,children:y.CANCEL}],rightButtons:I?[{"data-id":"drawer-delete",variant:"tertiary",onClick:U,children:e(t,{children:[n(ze,{}),n(v,{size:14,color:O.text.error,family:"secondary",decoration:"underline",children:y.DELETE})]})}]:[]},children:i}),n(x,{isOpen:M,noOverlay:!0,name:`${R}${s?` (${s})`:""}`,type:R,isLastItem:$,onApprove:()=>{I&&I(),V()},onDeny:V}),n(w,{isOpen:B,noOverlay:!0,name:"edit mode",onApprove:H,onDeny:V})]})}),Be=i(({title:e},t)=>{const[i,l]=o(e);return a(()=>{l(e)},[e]),r(t,()=>({getTitle:()=>i||e,isTitleDirty:()=>i!==e,clearTitle:()=>l(e)})),n(k,{"data-id":"title",value:i,onChange:e=>l(e.target.value)})});Be.displayName=Be.name,Ae.displayName=Ae.name;const We=(e,t)=>{const{name:n,kind:i,namespace:o}=e,l=[{title:$.KIND,value:i},{title:$.NAME,value:n,tooltip:"Resource name"}];return t||(l.unshift({title:$.NAMESPACE,value:o}),l.push({type:C.Divider}),l.push({type:C.CopyText,value:`kubectl get ${i} ${n} -n ${o}`.toLowerCase()})),l},Xe=f.div`
2
- display: flex;
3
- flex-direction: column;
4
- gap: 24px;
5
- padding: 4px;
6
- `,je=({formData:e,handleFormChange:t})=>n(Xe,{children:n(k,{name:"sourceName",title:"Source name",tooltip:"This overrides the default service name that runs in your cluster.",placeholder:"Use a name that overrides the source name",value:e.otelServiceName,onChange:({target:{value:e}})=>t("otelServiceName",e)})}),Ve=({workloadOdigosHealthStatus:e})=>{if(!e)return null;const t=F(e?.status),i=T(e?.reasonEnum),o=e?.message;return n(z,{$alignItems:"center",$justifyContent:"center",children:n(I,{status:t,title:i,subtitle:o,withBackground:t!==N.Disabled,withBorder:!0,withIcon:!0,width:"calc(100% - 24px)"})})},Ye=({source:t,fetchSourceDescribe:i,onClickRestartPod:l})=>{const[r,c]=o(!1),[d,u]=o(null);return a(()=>{t&&i({namespace:t.namespace,name:t.name,kind:t.kind}).then(({data:e})=>{e?.describeSource?u(e.describeSource):c(!0)})},[t.namespace,t.name,t.kind]),d||r?n(O,{$gap:12,children:r?n(P,{$height:"70vh",children:n(R,{subTitle:"Could not fetch describe for this source"})}):d?.pods?.length?d.pods.map(({podName:i,nodeName:o,phase:r,agentInjected:a,runningLatestWorkloadRevision:c,containers:u,manifestYAML:h})=>{const f=r.status!==L.Success||D(u)?L.Error:L.Success,m=[];return m.push(n(M,{value:`kubectl get pod ${i.value} -n ${d?.namespace?.value||t.namespace}`.toLowerCase()},"copy-text")),m.push(n(A,{length:"100%",margin:"0"},"divider-1")),m.push(n(B,{title:o.name,tooltip:o.explain||"",value:{status:o.status||void 0,text:o.value}},"describe-row-1")),m.push(n(A,{length:"100%",margin:"0"},"divider-2")),m.push(n(B,{title:r.name,tooltip:r.explain||"",value:{status:r.status||void 0,text:r.value}},"describe-row-2")),m.push(n(A,{length:"100%",margin:"0"},"divider-3")),m.push(n(B,{title:a.name,tooltip:a.explain||"",value:{status:a.status||void 0,text:a.value}},"describe-row-3")),m.push(n(A,{length:"100%",margin:"0"},"divider-4")),c?.name&&(m.push(n(B,{title:c.name,tooltip:c.explain||void 0,value:{status:c.status||void 0,text:c.value}},"describe-row-4")),m.push(n(A,{length:"100%",margin:"0"},"divider-5"))),u.forEach(e=>{m.push(n(W,{...e},`pod-container-${e.containerName.value}`))}),h&&(m.push(n(A,{length:"100%",margin:"0"},"divider-6")),m.push(n(Ce,{yaml:h},"yaml-section-card"))),n(X,{title:`Pod: ${i.value}`,withExtend:!0,action:({hovered:o})=>e("div",{style:{position:"relative"},children:[n(I,{status:f,title:f,withIcon:!0,withBorder:!0},"status"),o&&n(j,{isOpen:!0,positionRight:"calc(100% + 12px)",actions:l?[{id:V(),label:"Restart",rightIcon:Ie,onClick:()=>l(d?.namespace?.value||t.namespace,i.value)}]:[]},"hover-actions")]}),children:s.toArray(m)},`pod-${i.value}`)}):n(P,{$height:"70vh",children:n(R,{subTitle:"Check if you have any running pods and try again"})})}):n(P,{$height:"70vh",children:n(E,{})})},He=f(z)`
7
- width: 100%;
8
- align-items: center;
9
- justify-content: space-between;
10
- `,_e=({source:t,fetchSourceLibraries:i})=>{const l=m(),[r,s]=o(!1),[d,u]=o(null);return a(()=>{t&&i({namespace:t.namespace,name:t.name,kind:t.kind}).then(({data:e})=>{e?.instrumentationInstanceComponents?u(Y(e.instrumentationInstanceComponents).sort((e,t)=>e.name.localeCompare(t.name))):s(!0)})},[t.namespace,t.name,t.kind]),d||r?n(O,{$gap:12,children:r?n(P,{$height:"70vh",children:n(R,{subTitle:"Could not fetch libraries for this source"})}):d?.length?n(X,{title:"Instrumented Libraries",children:d.map(({name:t,healthy:i,message:o,nonIdentifyingAttributes:r},a)=>e(c,{children:[e(O,{$gap:4,$width:"100%",children:[e(He,{$width:"100%",children:[n(v,{size:12,color:l.text.grey,children:t}),e(z,{$gap:4,children:[r.map(({key:e,value:i})=>_(i)&&U(i)&&"is_standard_lib"===e?n(I,{status:L.Default,title:"STANDARD",withBorder:!0},`${t}-${e}`):null),"boolean"==typeof i&&n(I,{status:i?L.Success:L.Error,title:i?"HEALTHY":"UNHEALTHY",withBorder:!0})]})]}),o&&n(v,{size:10,color:l.text.error,align:"right",children:o})]}),a!==d.length-1&&n(A,{length:"100%",margin:"0"})]},`library-${t}`))}):e(P,{$height:"70vh",$gap:12,children:[n(R,{title:"No libraries found",subTitle:""}),n(H,{type:L.Warning,message:"This feature is in early development, and has very limited support"})]})}):n(P,{$height:"70vh",children:n(E,{})})};function Ue(e,t){const n=e.names[t];if(null==n)return"";if("string"==typeof n)return n;if("object"==typeof n&&"name"in n){const e=n.name;if("string"==typeof e)return e}return"number"==typeof n||"boolean"==typeof n?String(n):""}function Je(e){const t=Math.abs(e);return t>=1e9?`${Ke(e/1e9)}s`:t>=1e6?`${Ke(e/1e6)}ms`:t>=1e3?`${Ke(e/1e3)}μs`:String(Math.round(e))}function Ke(e){return e.toFixed(2).replace(/\.?0+$/,"")}function Ze(e){const t=[];for(let n=0;n<e.levels.length;n++){const i=e.levels[n];let o=0;for(let e=0;e+3<i.length;e+=4){const l=i[e],r=i[e+1],a=i[e+2],s=i[e+3],c=o+l;t.push({level:n,offset:c,size:r,self:a,nameIndex:s}),o=c+r}}return t}function Ge(e){return`${e.level}:${e.offset}:${e.size}:${e.nameIndex}`}function qe(e,t){const n=t.trim().toLowerCase();return!n||e.toLowerCase().includes(n)}function Qe(e,t,n,i,o,l={}){if(0===e.levels.length||t<2||n<2)return null;const{zoomRoot:r=null,shouldKeepName:a,collapseRecursive:s=!1}=l,c=Ze(e);let d=r?function(e,t){const n=e.reduce((e,t)=>Math.max(e,t.level),t.level),i=new Map;for(const t of e){const e=i.get(t.level);e?e.push(t):i.set(t.level,[t])}const o=[t];for(let e=t.level+1;e<=n;e++){const t=o.filter(t=>t.level===e-1);if(0===t.length)break;const n=i.get(e);if(n?.length)for(const e of n)for(const n of t)if(e.offset>=n.offset&&e.offset+e.size<=n.offset+n.size){o.push(e);break}}return o}(c,r):c;if(0===d.length)return null;if(a&&(d=d.filter(t=>a(Ue(e,t.nameIndex))),0===d.length))return null;if(s&&(d=function(e,t){if(0===t.length)return t;const n=[...t].sort((e,t)=>e.level-t.level||e.offset-t.offset),i=new Map;for(const e of n){const t=i.get(e.level);t?t.push(e):i.set(e.level,[e])}const o=new Set;for(const t of n){const n=i.get(t.level+1);if(!n)continue;const l=n.filter(e=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);if(1!==l.length)continue;const r=l[0];r.size===t.size&&Ue(e,r.nameIndex)===Ue(e,t.nameIndex)&&o.add(Ge(r))}if(0===o.size)return n;const l=[];for(const e of n){if(o.has(Ge(e)))continue;let t=0;for(let n=0;n<e.level;n++){const l=i.get(n);if(!l)continue;const r=l.find(t=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);r&&o.has(Ge(r))&&t++}l.push({...e,level:e.level-t})}return l}(e,d),0===d.length))return null;const u=r?.level??0,h=r?.offset??0,f=r?.size??e.numTicks;if(f<=0)return null;const m=d.reduce((e,t)=>Math.max(e,t.level-u),0)+1,p=i??Number.POSITIVE_INFINITY,g=Math.max(1,Math.min(n/m,p)),v=o.trim(),y=g>8?1:0;return d.map(n=>{const i=n.level-u,o=(n.offset-h)/f*t,l=Math.max(n.size/f*t,1),r=i*g,a=Math.max(g-y,1),s=Ue(e,n.nameIndex);return{...n,x:o,y:r,w:l,h:a,name:s,matchesSearch:qe(s,v)}})}function et(e,t){let n=0;for(let t=0;t<e.length;t++)n=31*n+e.charCodeAt(t)>>>0;const i=t.v2.colors.black[500],o=[{fill:t.v2.colors.purple[300],text:i},{fill:t.v2.colors.green[300],text:i},{fill:t.v2.colors.red[300],text:i},{fill:t.v2.colors.blue[300],text:i},{fill:t.v2.colors.yellow[300],text:i}];return o[n%o.length]}var tt,nt;!function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(tt||(tt={})),function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(nt||(nt={}));function it(e,t){return t<=0?"0":(100*e/t).toFixed(e/t<.001?2:1)}function ot(e,t,n){for(const i of n)if(e>=i.x&&e<i.x+i.w&&t>=i.y&&t<i.y+i.h)return i;return null}function lt(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}const rt=({flamebearer:t,maxRowPx:i,searchQuery:r="",shouldKeepName:s,minHostHeight:c=200,onFullscreenChange:f,profilingSlots:p})=>{const g=m(),v=l(null),y=l(null),b=l({x:0,y:0}),x=l(t.numTicks),[w,S]=o({w:0,h:0}),[k,$]=o(""),[C,T]=o(null),[I,N]=o([]),[F,P]=o(!1),[E,O]=o(tt.Fit),[R,L]=o(nt.Fit),[D,M]=o(!1),A=Math.max(1,Math.min(Math.floor(w.w*E),8192)),B=Math.max(1,Math.min(Math.floor(w.h*R),8192)),W=I.length>0?I[I.length-1]:null,X=W?.size??t.numTicks;a(()=>{x.current!==t.numTicks&&(x.current=t.numTicks,N([]))},[t.numTicks]),d(()=>{const e=v.current;if(!e)return;const t=new ResizeObserver(()=>{const t=e.getBoundingClientRect();S({w:Math.floor(t.width),h:Math.floor(t.height)})});return t.observe(e),()=>t.disconnect()},[]),a(()=>{if(!F)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[F]),a(()=>(f?.(F),()=>{F&&f?.(!1)}),[F,f]);const j=u(()=>Qe(t,A,B,i,r,{zoomRoot:W,shouldKeepName:s,collapseRecursive:D}),[t,i,r,B,A,W,s,D]),V=u(()=>function(e){return[...e].sort((e,t)=>t.level-e.level)}(j?.length?r.trim()?j.filter(e=>e.matchesSearch):j:[]),[j,r]),Y=h(e=>{if(A<2||B<2)return;const n=e.currentTarget.getBoundingClientRect();if(n.width<1||n.height<1)return;const i=ot((e.clientX-n.left)/n.width*A,(e.clientY-n.top)/n.height*B,V);if(i){const e=Ge(i);T(e);const n=X>0?(100*i.size/X).toFixed(1):"0",o=t.numTicks>0?(100*i.size/t.numTicks).toFixed(1):"0";$(`${i.name}\ntotal ${Je(i.size)} (${n}% of view, ${o}% of profile) · self ${Je(i.self)}`)}else T(null),$("")},[V,t.numTicks,B,A,X]),H=h(e=>{Y(e)},[Y]),_=h(()=>{T(null),$("")},[]),U=h(e=>{b.current={x:e.clientX,y:e.clientY}},[]),ae=h(e=>{const{x:t,y:n}=b.current;if(Math.abs(e.clientX-t)>3||Math.abs(e.clientY-n)>3)return;if(A<2||B<2)return;const i=e.currentTarget.getBoundingClientRect();if(i.width<1||i.height<1)return;const o=ot((e.clientX-i.left)/i.width*A,(e.clientY-i.top)/i.height*B,V);if(!o)return;const l=function(e){return{level:e.level,offset:e.offset,size:e.size,self:e.self,nameIndex:e.nameIndex}}(o);N(e=>{const t=e.length>0?e[e.length-1]:null;return t&&function(e,t){return e.level===t.level&&e.offset===t.offset&&e.size===t.size&&e.nameIndex===t.nameIndex}(l,t)?e.slice(0,-1):[...e,l]})},[V,B,A]);d(()=>{const e=y.current;if(!e||A<2||B<2)return;const n="undefined"!=typeof window&&window.devicePixelRatio||1,i=Math.max(A,B),o=Math.min(n,16384/i);e.width=Math.floor(A*o),e.height=Math.floor(B*o),e.style.width=`${A}px`,e.style.height=`${B}px`;const l=e.getContext("2d");l&&(l.setTransform(o,0,0,o,0,0),l.clearRect(0,0,A,B),j?.length?function(e,t,n,i,o,l,r,a){const s=l.v2.colors.silver[900];e.fillStyle=s,e.fillRect(0,0,t,n);const c=o.trim().length>0;e.textRendering="optimizeLegibility";for(const t of i){const{x:n,y:i,w:o,h:r,name:s,size:d,matchesSearch:u}=t;if(c&&!u)continue;const{fill:h,text:f}=et(s,l);e.fillStyle=h,e.fillRect(n,i,o,r),e.strokeStyle="rgba(255,255,255,0.14)",e.lineWidth=1,e.beginPath(),e.moveTo(n+.5,i+.5),e.lineTo(n+o-.5,i+.5),e.stroke(),e.strokeStyle="rgba(0,0,0,0.45)",e.lineWidth=1,e.strokeRect(n+.5,i+.5,Math.max(o-1,0),Math.max(r-1,0));const m=it(d,a),p=`${s} (${Je(d)}, ${m}%)`,g=l.v2.text.size.xs,v=8,y=5,b=26,x=Math.min(g,Math.floor(r-2));if(o>=b&&x>=v){e.font=`${x}px ${l.font_family.primary}, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,e.textBaseline="middle",e.textAlign="left";let t=p;for(;t.length>2&&e.measureText(t).width>o-2*y;)t=`${t.slice(0,-2)}…`;e.measureText(t).width<=o-2*y&&(e.lineWidth=1,e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineJoin="round",e.miterLimit=1,e.strokeText(t,n+y,i+r/2),e.fillStyle=f,e.fillText(t,n+y,i+r/2))}}if(r)for(const t of i){if(Ge(t)!==r)continue;if(c&&!t.matchesSearch)continue;const{x:n,y:i,w:o,h:l}=t;e.strokeStyle="rgba(255,255,255,0.88)",e.lineWidth=2,e.strokeRect(n+1,i+1,Math.max(o-2,0),Math.max(l-2,0));break}}(l,A,B,j,r,g,C,t.numTicks):(l.fillStyle=g.v2.colors.silver[900],l.fillRect(0,0,A,B)))},[j,t.numTicks,C,r,B,A,g]);const se=h(()=>P(e=>!e),[]),ce=t.numTicks>0?Math.max(0,Math.min(100,Math.round(X/t.numTicks*100))):100,de=u(()=>function(e,t){const n=Ze(e),i=t?.offset??0,o=i+(t?.size??e.numTicks),l=(t?.level??-1)+1,r=t?.size??e.numTicks;let a=null;for(const e of n)e.level<l||e.offset<i||e.offset+e.size>o||e.size>=r||(!a||e.size>a.size||e.size===a.size&&e.level<a.level)&&(a=e);return a}(t,W),[t,W]),ue=null!==de,he=I.length>0,fe=W?Ue(t,W.nameIndex):"",me=h(()=>N([]),[]),pe=h(()=>N(e=>e.slice(0,-1)),[]),ge=h(()=>{de&&N(e=>[...e,de])},[de]);return e("div",{style:F?{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",gap:8,padding:16,background:g.v2.colors.silver[900]}:{flex:1,minHeight:c,minWidth:0,width:"100%",display:"flex",flexDirection:"column",gap:8,position:"relative"},children:[e(z,{$gap:8,$wrap:"nowrap",$justifyContent:"space-between",children:[n(J,{label:"Collapse recursive",tooltip:"Collapse straight-line recursion (parent → single same-name child of equal width) into a single bar. Helps deep recursive call chains fit on screen.",labelAlign:Z.Left,size:K.S,value:D,onChange:M}),e(z,{$gap:8,children:[e(z,{children:[n(G,{variant:Q.Secondary,size:q.S,label:"Reset zoom",leftIcon:Ne,onClick:me,disabled:!I.length}),n(G,{variant:Q.Secondary,size:q.S,iconSize:20,leftIcon:Fe,tooltip:"Zoom out",hideTooltipIcon:!0,disabled:!he,onClick:pe}),n("div",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:n(ee,{size:ne.XXS,color:te.Secondary,nowrap:!0,align:"center",children:`${ce}%`})}),n(G,{variant:Q.Secondary,size:q.S,iconSize:20,leftIcon:Pe,tooltip:"Zoom in",hideTooltipIcon:!0,disabled:!ue,onClick:ge})]}),e(z,{children:[n(ie,{text:"Horizontal width: stretch the canvas wider than the viewport so narrow stacks become hoverable / readable.",children:n(oe,{size:re.S,variant:le.Filled,options:[{value:tt.Fit,label:"W: Fit"},{value:tt.X10,label:"10x"}],selected:E,setSelected:O})}),n(ie,{text:"Vertical height: scale rows taller than the viewport for deep call stacks. Scroll vertically to navigate.",children:n(oe,{size:re.S,variant:le.Filled,options:[{value:nt.Fit,label:"H: Fit"},{value:nt.X10,label:"10x"}],selected:R,setSelected:L})})]}),n(G,{variant:Q.Secondary,size:q.S,iconSize:24,leftIcon:F?Ee:Oe,tooltip:F?"Exit fullscreen (Esc)":"Fullscreen",hideTooltipIcon:!0,onClick:se})]})]}),n(ie,{fullWidth:!0,keepAlive:!0,text:k,children:n("div",{ref:v,style:{flex:1,minWidth:0,width:"100%",height:F?"calc(100vh - 80px)":"calc(100vh - 370px)",position:"relative",overflowX:E>1?"auto":"hidden",overflowY:R>1?"auto":"hidden"},children:n("div",{style:{width:A||"100%",height:B||"100%",position:"relative"},children:n("canvas",{ref:y,style:{display:"block",position:"absolute",left:0,top:0,width:"100%",height:"100%",borderRadius:8,cursor:C?"pointer":"default"},onPointerDown:U,onPointerMove:H,onPointerLeave:_,onClick:ae})})})}),e(z,{$justifyContent:"space-between",children:[n(ee,W?{size:ne.XXXS,color:g.v2.colors.silver[300],children:`Zoomed: ${fe} • ${Je(X)} samples in view`}:{size:ne.XXXS,color:g.v2.colors.silver[300],children:"Click a frame to zoom into its subtree (pprof-style)."}),p&&n(ee,{size:ne.XXXS,color:g.v2.colors.silver[300],children:`${p.activeKeys.length} / ${p.maxSlots} profiling slots · ${lt(p.totalBytesUsed)} / ${lt(p.maxTotalBytesBudget)} budget · TTL ${p.slotTtlSeconds}s`})]})]})};var at,st;!function(e){e.Symbol="symbol",e.Self="self",e.Total="total"}(at||(at={})),function(e){e.FilterOutVoid="filter-out-void",e.OnlyWithReturnValues="only-with-return-values"}(st||(st={}));const ct=/^[A-Za-z_$][A-Za-z0-9_$]*(\[\])*$/;function dt(e,t){const n=function(e){return e.split(" ")[0]??""}(e);if(t.includes(st.FilterOutVoid)&&"void"===n)return!1;if(t.includes(st.OnlyWithReturnValues)){if(!(e.includes(" ")&&"void"!==n&&ct.test(n)))return!1}return!0}const ut={options:[{id:st.FilterOutVoid,label:"Filter out void symbols"},{id:st.OnlyWithReturnValues,label:"Only show functions with return values"}],filterRow:(e,t)=>dt(e.cells.find(e=>e.key===at.Symbol)?.rawValue?.toString()??"",t)},ht=({rows:e,languages:t,filters:i,onFiltersChange:o})=>{const l=u(()=>[{key:at.Symbol,label:"Symbol",flex:"0 0 160px",filterOverride:t?.includes(ae.Java)?ut:void 0,noFilter:!t?.includes(ae.Java)},{key:at.Self,label:"Self",tooltip:"Time spent in this function itself, excluding time in functions it calls.",textAlign:"right",noFilter:!0},{key:at.Total,label:"Total",tooltip:"Time spent in this function and all functions it calls (inclusive).",textAlign:"right",noFilter:!0}],[t]),r=u(()=>e.map(e=>({cells:[{key:at.Symbol,rawValue:e.name},{key:at.Self,rawValue:Je(e.self)},{key:at.Total,rawValue:Je(e.total)}]})),[e]);return n(se,{variant:ce.Data,maxHeight:"calc(100vh - 306px)",columns:l,rows:r,filters:i,onFiltersChange:o,rowActionsPushLeftPosition:"12px",getRowActions:e=>[{id:`copy-${e.cells[0].rawValue}`,label:"",rightIcon:Re,onClick:()=>{navigator.clipboard.writeText(e.cells[0].rawValue)}}]})};var ft;!function(e){e.Table="table",e.Flame="flame",e.Both="both"}(ft||(ft={}));const mt=f(O)`
11
- width: 100%;
12
- min-height: 0;
13
- flex: 1;
14
- border-radius: 16px;
15
- overflow: hidden;
16
- background: ${({theme:e})=>e.v2.colors.silver[800]};
17
- box-shadow: 0 2px 14.1px 0 rgba(0, 0, 0, 0.25);
18
- `,pt=f.div`
19
- display: flex;
20
- align-items: center;
21
- gap: 10px;
22
- flex-wrap: wrap;
23
- padding: 12px 12px 8px;
24
- background: ${({theme:e})=>e.v2.colors.silver[800]};
25
- border-radius: 16px 16px 0 0;
26
- `,gt=f(z)`
27
- flex-shrink: 0;
28
- align-items: center;
29
- gap: 4px;
30
- `,vt=f.div`
31
- display: flex;
32
- flex: 1;
33
- align-items: stretch;
34
- gap: ${({$gap:e})=>e}px;
35
- padding: 16px;
36
- min-height: 0;
37
- background: ${({theme:e})=>e.v2.colors.silver[800]};
38
- border-radius: 0 0 16px 16px;
39
- `,yt=f(O)`
40
- flex: ${({$splitWithFlame:e})=>e?"0 0 min(413px, 42%)":"1 1 auto"};
41
- width: ${({$splitWithFlame:e})=>e?"auto":"100%"};
42
- max-width: ${({$splitWithFlame:e})=>e?"none":"100%"};
43
- min-width: 0;
44
- min-height: 0;
45
- gap: 10px;
46
- `,bt=f(O)`
47
- flex: ${({$splitWithTable:e})=>e?"1":"1 1 auto"};
48
- width: ${({$splitWithTable:e})=>e?"auto":"100%"};
49
- min-width: 0;
50
- min-height: 0;
51
- gap: 10px;
52
- `,xt=f(z)`
53
- width: 100%;
54
- min-height: 32px;
55
- flex-shrink: 0;
56
- `,wt=({source:t,fetchProfilingSlots:i,enableProfiling:r,fetchSourceProfiling:s,onFlameFullscreenChange:d})=>{const f=m(),p=u(()=>({namespace:t.namespace,kind:t.kind,name:t.name}),[t.namespace,t.kind,t.name]),[g,v]=o(!0),[y,b]=o(null),[x,w]=o(null),[S,k]=o(0),[$,C]=o(ft.Both),[T,I]=o(""),[N,F]=o({}),E=l(null),O=h(async()=>{try{const e=[i()];g&&e.push(s(p));const[t,n]=await Promise.all(e);t&&b(t),n?.profileJson&&w(n.profileJson)}finally{k(e=>e+1)}},[i,s,p]);a(()=>{let e=!1;return(async()=>{await r(p),e||(await O(),e||(E.current=setInterval(O,3e3)))})(),()=>{e=!0,E.current&&clearInterval(E.current)}},[r,O,p]);const R=u(()=>function(e){if(!e?.trim())return null;try{const t=JSON.parse(e),n=t.flamebearer;return!n?.names?.length||!Array.isArray(n.levels)||"number"!=typeof n.numTicks||n.numTicks<=0?null:{flamebearer:n,units:t.metadata?.units}}catch{return null}}(x),[x]),L=u(()=>R?function(e){const t=new Map;for(let n=0;n<e.levels.length;n++){const i=e.levels[n];for(let n=0;n+3<i.length;n+=4){const o=i[n+1],l=i[n+2],r=Ue(e,i[n+3]);if(!r)continue;const a=t.get(r);(!a||o>a.total)&&t.set(r,{self:l,total:o})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)}(R.flamebearer):[],[R]),D=u(()=>{const e=T.trim().toLowerCase();return e?L.filter(t=>t.name.toLowerCase().includes(e)):L},[L,T]),M=$===ft.Table||$===ft.Both,A=$===ft.Flame||$===ft.Both,B=M&&A,W=t.detectedLanguages||t.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??""),X=u(()=>function(e,t){if(!t?.includes(ae.Java))return;const n=e?.[at.Symbol]?.filter(Boolean)??[];return 0!==n.length?e=>dt(e,n):void 0}(N,W),[N,W]);return S<2?n(P,{$height:"70vh",children:n(de,{withSpinner:!0})}):e(mt,{$gap:0,$width:"100%",children:[e(pt,{children:[n(ie,{text:"Live CPU profile collected from the workload agent. Search symbols, switch between the table and flame graph, or download a JSON snapshot.",withIcon:!0,children:n(gt,{children:n(ee,{size:ne.S,weight:500,color:te.Primary,nowrap:!0,children:"CPU Profiling"})})}),e(z,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[n("div",{style:{flex:"1 1 220px",minWidth:180},children:n(ue,{value:T,onChange:I,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:f.v2.colors.silver[900],emphasizeBackgroundColor:f.v2.colors.silver[800]})}),n(oe,{size:re.S,variant:le.Filled,options:[{value:ft.Table,label:"Top table"},{value:ft.Flame,label:"Flame graph"},{value:ft.Both,label:"Both"}],selected:$,setSelected:C}),n(G,g?{variant:Q.Secondary,size:q.S,label:"Live",tooltip:"Odigos profiler works in-memory and doesn't store any data on disk, to keep minimum memory footprint we store only last 10 minutes of data on demand",leftIcon:e=>n(Le,{...e,size:8,fill:f.v2.colors.green[500]})}:{variant:Q.Secondary,size:q.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>n(Le,{...e,size:8,fill:f.v2.colors.red[500]})})]})]}),n(vt,{$gap:M&&A?16:0,children:R?e(c,{children:[M&&e(yt,{$splitWithFlame:B,children:[n(xt,{$justifyContent:"flex-end",children:n(G,{variant:Q.Secondary,size:q.S,label:"Download snapshot",rightIcon:De,onClick:()=>{if(!x)return;const e=new Blob([x],{type:"application/json"}),n=URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.download=`cpu-profile-${t.namespace}-${t.kind}-${t.name}.json`,i.click(),URL.revokeObjectURL(n)},disabled:!x})}),n(ht,{rows:D,languages:W,filters:N,onFiltersChange:F})]}),A&&e(bt,{$splitWithTable:B,children:[e(xt,{$justifyContent:"space-between",children:[n(fe,{label:R?`Total in view ${Je(R.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:f.v2.colors.silver[750],textColor:f.v2.colors.silver[200],textSize:ne.XXS}),e(z,{$gap:12,children:[!g&&n(G,{variant:Q.Secondary,size:q.S,label:"Refresh",leftIcon:Ie,onClick:O}),n(J,{label:"Auto refresh",labelAlign:Z.Left,size:K.S,value:g,onChange:v})]})]}),n(rt,{flamebearer:R.flamebearer,maxRowPx:24,searchQuery:T,shouldKeepName:X,minHostHeight:280,onFullscreenChange:d,profilingSlots:y},$)]})]}):n(P,{children:n(he,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})})]})},St="70vh",kt=(e,t)=>e.serviceName.localeCompare(t.serviceName),$t=f(v)`
57
- cursor: ${({$clickable:e})=>e?"pointer":"default"};
58
- text-decoration: ${({$clickable:e})=>e?"underline":"none"};
59
- &:hover {
60
- opacity: ${({$clickable:e})=>e?.7:1};
61
- }
62
- `,Ct=f(z)`
63
- justify-content: flex-end;
64
- align-items: center;
65
- gap: 6px;
66
- cursor: pointer;
67
- `,Tt=({items:i,emptyMessage:o,keyPrefix:l,findSource:r,onNavigate:a})=>{const s=m();return i.length?n(t,{children:i.map(({serviceName:t},o)=>{const d=!!r(t);return e(c,{children:[n($t,{size:13,color:d?s.text.secondary:s.text.grey,$clickable:d,onClick:()=>a(t),children:t}),o!==i.length-1&&n(A,{length:"100%",margin:"0"})]},`${l}-${t}`)})}):n(v,{size:13,color:s.text.grey,children:o})},zt=({source:t,fetchPeerSources:i})=>{const l=m(),{setDrawerType:r,setDrawerEntityId:s}=p(),c=me(e=>e.sources),[d,u]=o(!1),[f,g]=o(!1),[y,b]=o(null),x=t.otelServiceName||t.name,w=h(()=>{x&&(g(!0),u(!1),i(x).then(({data:e})=>{e?.peerSources?b(e.peerSources):u(!0)}).finally(()=>g(!1)))},[x]);a(()=>{w()},[w]);const k=h(e=>c.find(t=>t.otelServiceName===e||t.name===e),[c]),$=h(e=>{const t=k(e);t&&(r(S.Source),s({namespace:t.namespace,name:t.name,kind:t.kind}))},[k,r,s]);if(!y&&!d&&f)return n(P,{$height:St,children:n(E,{})});if(d)return n(P,{$height:St,children:n(R,{subTitle:"Could not fetch peer sources"})});const C=y?.inbound?[...y.inbound].sort(kt):[],T=y?.outbound?[...y.outbound].sort(kt):[];return e(O,{$gap:12,children:[n(X,{title:"Inbound",titleBadge:C.length,description:`Services that send requests to ${x}`,children:n(Tt,{items:C,emptyMessage:"No inbound connections",keyPrefix:"inbound",findSource:k,onNavigate:$})}),n(X,{title:"Outbound",titleBadge:T.length,description:`Services that ${x} sends requests to`,children:n(Tt,{items:T,emptyMessage:"No outbound connections",keyPrefix:"outbound",findSource:k,onNavigate:$})}),e(Ct,{onClick:w,children:[n(Ie,{size:14}),n(v,{size:12,color:l.text.grey,decoration:"underline",children:"Refresh"})]})]})};var It;!function(e){e.Overview="Overview",e.Pods="Pods",e.Libraries="Libraries",e.PeerSources="Peer Sources",e.Profiling="Profiling"}(It||(It={}));const Nt=[xe.Deployment,xe.StatefulSet,xe.DaemonSet,xe.DeploymentConfig,xe.Rollout,xe.StaticPod],Ft=[xe.Deployment,xe.StatefulSet,xe.DaemonSet,xe.DeploymentConfig,xe.Rollout,xe.Pod],Pt=[ae.Python,ae.Go],Et=f.div`
68
- width: 100%;
69
- height: 100%;
70
- max-height: calc(100vh - 220px);
71
- overflow: overlay;
72
- overflow-y: auto;
73
- `,Ot=f.div`
74
- display: flex;
75
- flex-direction: column;
76
- gap: 12px;
77
- `;var Rt;!function(e){e.Workload="Workload",e.Pod="Pod"}(Rt||(Rt={}));const Lt=({persistSources:i,updateSource:r,restartWorkloads:s,fetchSourceById:c,fetchSourceDescribe:d,fetchSourceLibraries:h,fetchPeerSources:f,restartPod:m,recoverFromRollback:g,profilingEnabled:y,fetchProfilingSlots:b,enableProfiling:x,fetchSourceProfiling:w})=>{const{isVm:k}=pe(),C=me(e=>e.sources),{selectedStreamName:T}=ge(),{drawerType:z,drawerEntityId:I}=p(),F=u(()=>ve(C,T),[C,T]),P=l(null),E=z===S.Source,[O,R]=o(!1),[D,M]=o(!1),[A,B]=o(It.Overview),[W,j]=o(null),[V,Y]=o(!1);a(()=>{E&&I&&c(I).then(e=>j(e||null))},[E,I]);const{formData:_,handleFormChange:U,resetFormData:J,loadFormWithDrawerItem:K}=ye(),Z=u(()=>{if(I)return W&&JSON.stringify(be(W))===JSON.stringify(be(I))?W:F?.find(e=>JSON.stringify(be(e))===JSON.stringify(be(I)))},[I,F,W]);a(()=>{E&&Z?K(Z):J()},[E,Z]);const G=u(()=>{const e=Z?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===N.Loading,containers:Z?.containers||[]}},[Z]),q=u(()=>!!Z?.rollbackOccurred,[Z?.rollbackOccurred]),Q=u(()=>{const e=[{label:It.Overview,onClick:()=>B(It.Overview),selected:A===It.Overview}];return k||(Nt.includes(Z?.kind)&&e.push({label:It.Pods,onClick:()=>B(It.Pods),selected:A===It.Pods}),Z?.containers?.some(e=>Pt.includes(e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language))&&e.push({label:It.Libraries,onClick:()=>B(It.Libraries),selected:A===It.Libraries}),e.push({label:It.PeerSources,onClick:()=>B(It.PeerSources),selected:A===It.PeerSources}),y&&b&&x&&w&&e.push({label:It.Profiling,onClick:()=>B(It.Profiling),selected:A===It.Profiling})),e},[A,Z,k,y,b,x,w]),ee=Ft.includes(Z?.kind),[te,ne]=o({openFor:null,workloadId:void 0,podNamespace:void 0,podName:void 0});if(!Z)return null;return e(Ae,{ref:P,width:V?"95vw":A===It.Profiling?"80vw":void 0,onClose:()=>{B(It.Overview),j(null),Y(!1)},title:Z.otelServiceName||Z.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:$e(Z.containers),isEdit:O,isFormDirty:D,onEdit:A===It.Overview?e=>{R("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=_.otelServiceName!==Z.name?_.otelServiceName:"";U("otelServiceName",e),await r(I,{..._,otelServiceName:e}),j(null),M(!1),R(!1)},onDelete:A===It.Overview?async()=>{const{namespace:e,name:t,kind:n}=Z;i({[e]:[{namespace:e,name:t,kind:n||void 0,selected:!1,currentStreamName:T}]}),j(null),M(!1),R(!1),P.current?.closeDrawer()}:void 0,onCancel:()=>{M(!1),R(!1),U("otelServiceName",Z.otelServiceName||Z.name||"")},isLastItem:1===F.length,tabs:Q,headerActionButtons:k?[]:ee?[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>ne({openFor:Rt.Workload,workloadId:I}),children:e(t,{children:[n(Me,{}),n(v,{size:14,family:"secondary",decoration:"underline",children:"Restart"})]})}]:[],children:[A===It.Overview?O?n(Et,{children:n(je,{formData:_,handleFormChange:(...e)=>{M(!0),U(...e),U("currentStreamName",T)}})}):e(Ot,{children:[n(Ve,{workloadOdigosHealthStatus:Z.workloadOdigosHealthStatus}),q&&n(H,{type:L.Warning,message:$.ROLLBACK_OCCURRED_MESSAGE,action:{label:$.ROLLBACK_RECOVER,onClick:async()=>{await g(I);const e=await c(I);e&&j(e)}}}),n(we,{conditions:Z.conditions||[]}),n(X,{title:$.SOURCE_DETAILS,data:Z?We(Z,k):[]}),n(X,{title:k?$.DETECTED_PROCESSES:$.DETECTED_CONTAINERS,titleBadge:G.isLoading?N.Loading:G.containers.length,description:G.description||(k?$.DETECTED_PROCESSES_DESCRIPTION:$.DETECTED_CONTAINERS_DESCRIPTION),children:G.containers.map(e=>n(Se,{...e,callbackRuntimeOverride:e=>r(I,e)},`source-container-${e.containerName}`))}),Z.manifestYAML&&n(Ce,{title:`${Z.kind} YAML`,yaml:Z.manifestYAML,defaultOpen:!Z.instrumentationConfigYAML}),Z.instrumentationConfigYAML&&n(Ce,{title:"Instrumentation Config YAML",yaml:Z.instrumentationConfigYAML,defaultOpen:!Z.manifestYAML})]}):A===It.Pods?n(Ye,{source:Z,fetchSourceDescribe:d,onClickRestartPod:ee?(e,t)=>ne({openFor:Rt.Pod,podNamespace:e,podName:t}):void 0}):A===It.Libraries?n(_e,{source:Z,fetchSourceLibraries:h}):A===It.PeerSources?n(zt,{source:Z,fetchPeerSources:f}):A===It.Profiling&&y&&b&&x&&w?n(wt,{source:Z,fetchProfilingSlots:b,enableProfiling:x,fetchSourceProfiling:w,onFlameFullscreenChange:Y}):null,n(ke,{isOpen:!!te.openFor,title:`Rollout Restart ${te.openFor}`,description:`Are you sure you want to rollout restart this ${te.openFor?.toLowerCase()}?`,approveButton:{text:"Confirm",variant:L.Warning,onClick:()=>{te.openFor===Rt.Workload&&te.workloadId?s([te.workloadId]):te.openFor===Rt.Pod&&te.podNamespace&&te.podName&&m(te.podNamespace,te.podName),ne({openFor:null})}},denyButton:{text:"Go Back",onClick:()=>{ne({openFor:null})}}})]})};export{Ae as O,Lt as S,je as a};