@odigos/ui-kit 0.0.231 → 0.0.232

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 (69) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/chunks/index-Bbukn13F.js +77 -0
  3. package/lib/chunks/{index-tFZXUKvO.js → index-Cw4LkdaE.js} +1 -1
  4. package/lib/chunks/index-D7sjsMOG.js +145 -0
  5. package/lib/chunks/{ui-components-CvK0mvVN.js → ui-components-of0mjGMv.js} +438 -426
  6. package/lib/components/_v2/cards/section-card/index.d.ts +11 -0
  7. package/lib/components/_v2/drop-down/index.d.ts +1 -1
  8. package/lib/components/_v2/search/index.d.ts +2 -0
  9. package/lib/components/_v2/segment/index.d.ts +1 -0
  10. package/lib/components/_v2/typography/index.d.ts +20 -1
  11. package/lib/components/_v2/warning-modal/index.d.ts +5 -5
  12. package/lib/components/v2.js +1 -1
  13. package/lib/components.js +1 -1
  14. package/lib/constants/strings/index.d.ts +6 -0
  15. package/lib/constants.js +1 -1
  16. package/lib/containers/_v2/_forms/data-stream-form/index.d.ts +6 -0
  17. package/lib/containers/_v2/_forms/data-stream-form/merge-warning.d.ts +11 -0
  18. package/lib/containers/_v2/_forms/index.d.ts +1 -0
  19. package/lib/containers/_v2/_modals/add-data-stream-modal/index.d.ts +8 -0
  20. package/lib/containers/_v2/_modals/edit-data-stream-modal/index.d.ts +8 -0
  21. package/lib/containers/_v2/_modals/index.d.ts +2 -0
  22. package/lib/containers/_v2/index.d.ts +2 -0
  23. package/lib/containers/_v2/overview/columns/column/empty-add.d.ts +7 -0
  24. package/lib/containers/_v2/overview/columns/column/head.d.ts +14 -0
  25. package/lib/containers/_v2/overview/columns/column/index.d.ts +12 -0
  26. package/lib/containers/_v2/overview/columns/column/list-item.d.ts +17 -0
  27. package/lib/containers/_v2/overview/columns/column/namespace-divider.d.ts +7 -0
  28. package/lib/containers/_v2/overview/columns/column/source-visual-state.d.ts +9 -0
  29. package/lib/containers/_v2/overview/columns/index.d.ts +11 -0
  30. package/lib/containers/_v2/overview/data-stream-select/index.d.ts +12 -0
  31. package/lib/containers/_v2/overview/drawers/index.d.ts +31 -0
  32. package/lib/containers/_v2/overview/filters/index.d.ts +2 -0
  33. package/lib/containers/_v2/overview/index.d.ts +14 -0
  34. package/lib/containers/_v2/overview/multi-source-control/index.d.ts +7 -0
  35. package/lib/containers/_v2/overview/search/builder.d.ts +25 -0
  36. package/lib/containers/_v2/overview/search/index.d.ts +7 -0
  37. package/lib/containers/source-drawer/index.d.ts +2 -2
  38. package/lib/containers/v2.js +334 -33
  39. package/lib/containers.js +122 -198
  40. package/lib/contexts/data-stream-form-context.d.ts +60 -0
  41. package/lib/contexts/index.d.ts +1 -0
  42. package/lib/contexts.js +1 -1
  43. package/lib/functions.js +1 -1
  44. package/lib/hooks/useOnClickOutside.d.ts +1 -0
  45. package/lib/hooks.js +1 -1
  46. package/lib/icons/common/index.d.ts +1 -0
  47. package/lib/icons/common/star-icon/index.d.ts +2 -0
  48. package/lib/icons.js +1 -1
  49. package/lib/mock-data/index.d.ts +1 -0
  50. package/lib/mock-data/sources/index.d.ts +1 -0
  51. package/lib/snippets/_v2/cancel-modal/index.d.ts +4 -1
  52. package/lib/snippets/_v2/delete-modal/index.d.ts +3 -1
  53. package/lib/snippets/_v2/rich-title/index.d.ts +1 -0
  54. package/lib/snippets/v2.js +1 -1
  55. package/lib/snippets.js +1 -1
  56. package/lib/store.js +1 -1
  57. package/lib/theme/palettes/index.d.ts +10 -0
  58. package/lib/theme.js +1 -1
  59. package/lib/types/actions/index.d.ts +2 -0
  60. package/lib/types/config/index.d.ts +2 -0
  61. package/lib/types/destinations/index.d.ts +1 -0
  62. package/lib/types/instrumentation-rules/index.d.ts +2 -0
  63. package/lib/types/sources/index.d.ts +44 -0
  64. package/lib/types.js +1 -1
  65. package/lib/visuals/index.d.ts +1 -0
  66. package/lib/visuals/visual-purple-rings/index.d.ts +7 -0
  67. package/lib/visuals.js +1 -1
  68. package/package.json +11 -11
  69. package/lib/chunks/index-DAOWyONO.js +0 -145
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,forwardRef as i,useState as l,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{c as h,F as g,d as b,e as f,f as y,I as v,h as C,i as S,j as w,K as k,T,k as A,l as N,m as I,n as D,o as E,B as $,a as R,p as x,q as O,r as P,N as F,s as M,t as L,v as V,S as B,w as z,x as _,y as U,z as j,E as X,G as H,H as W,J as G,L as K,M as Y,O as q,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as ie,_ as le,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ye,ab as ve,ac as Ce,ad as Se,ae as we,b as ke,af as Te,ag as Ae,ah as Ne,ai as Ie,aj as De,ak as Ee,al as $e,am as Re,an as xe,ao as Oe,ap as Pe,aq as Fe,ar as Me,as as Le,at as Ve,au as Be,av as ze,aw as _e,ax as Ue,ay as je,az as Xe,aA as He,aB as We,aC as Ge,aD as Ke,aE as Ye,aF as qe,aG as Je,aH as Qe,aI as Ze,aJ as et,D as tt,aK as at,aL as nt,aM as ot,aN as it,aO as lt,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as yt,a$ as vt,b0 as Ct,b1 as St,b2 as wt,b3 as kt,b4 as Tt,b5 as At,b6 as Nt,b7 as It,b8 as Dt,b9 as Et,ba as $t,bb as Rt,u as xt,bc as Ot,bd as Pt,be as Ft,bf as Mt,bg as Lt,bh as Vt,g as Bt,bi as zt,A as _t,bj as Ut,bk as jt,bl as Xt,bm as Ht,bn as Wt,bo as Gt,bp as Kt,bq as Yt,br as qt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as ia,bB as la,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as ya,bO as va,bP as Ca,bQ as Sa,bR as wa,bS as ka,bT as Ta,bU as Aa,bV as Na,bW as Ia,bX as Da,bY as Ea,bZ as $a,b_ as Ra,b$ as xa,c0 as Oa,c1 as Pa,c2 as Fa,c3 as Ma,c4 as La,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as ja}from"../chunks/ui-components-CvK0mvVN.js";import{TrashIcon as Xa,PlusIcon as Ha,BookIcon as Wa,VSquareIcon as Ga,XSquareIcon as Ka,DeleteIcon as Ya,EditIcon as qa,GoLogo as Ja,JavaLogo as Qa,ChevronRightIcon as Za,ActionIcon as en,DestinationIcon as tn,ChevronUpIcon as an,ChevronDownIcon as nn,VIcon as on,XIcon as ln,InstrumentationRuleIcon as sn,SourceIcon as rn,NamespacesIcon as cn,SettingsIcon as dn,SamplingIcon as un,ExclamationTriangleIcon as pn,ExclamationCircleIcon as mn,KeyIcon as hn,DiagnoseIcon as gn,DownloadIcon as bn,TerminalIcon as fn,RefreshIcon as yn,ConnectionsIcon as vn,OdigosLogo as Cn,ArrowRightIcon as Sn,PipelineCollectorIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as An,GatewayIcon as Nn,YamlIcon as In}from"../icons.js";import{S as Dn,D as En,A as $n,P as Rn,a as xn,b as On,R as Pn,c as Fn,O as Mn,d as Ln,e as Vn,f as Bn,W as zn,g as _n,C as Un,h as jn,i as Xn,U as Hn}from"../chunks/index-DAOWyONO.js";import{Y as Wn}from"../chunks/index-tFZXUKvO.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Gn=[{id:"CREDIT_CARD",label:"Credit card"}],Kn=[{id:h.CollectContainerAttributes,label:"Collect container attributes"},{id:h.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:h.CollectWorkloadId,label:"Collect workload ID"},{id:h.CollectClusterId,label:"Collect cluster ID"}],Yn=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],qn=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Yn}],Jn=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Yn}],Qn=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:C.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:C.Number}],Zn=h.UrlTemplatizationRulesGroups,eo=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],to=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:C.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number}],ao=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:x.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:x.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],no={[O.K8sAttributes]:({value:o,setValue:i,formErrors:l})=>(n(()=>{o[h.CollectContainerAttributes]||o[h.CollectReplicaSetAttributes]||o[h.CollectWorkloadId]||o[h.CollectClusterId]||o[h.LabelsAttributes]?.length||o[h.AnnotationsAttributes]?.length||(i(h.CollectContainerAttributes,!0),i(h.CollectReplicaSetAttributes,!0),i(h.CollectWorkloadId,!0),i(h.CollectClusterId,!0),i(h.LabelsAttributes,[]),i(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Kn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>i(a,e)}),t(y,{errorMessage:l[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:qn,values:o[h.LabelsAttributes]||[],setValues:e=>i(h.LabelsAttributes,e),errorMessage:l[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:Jn,values:o[h.AnnotationsAttributes]||[],setValues:e=>i(h.AnnotationsAttributes,e),errorMessage:l[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:o,formErrors:i})=>{const l=m();return e(a,{children:[t(T,{label:"Overwrite existing values",labelAlign:A.Left,labelColor:l.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[h.OverwriteExistingValues]||!1,onChange:e=>o(h.OverwriteExistingValues,e)}),t(w,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[h.ClusterAttributes]||[],setValues:e=>o(h.ClusterAttributes,e),errorMessage:i[h.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(N,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[h.AttributeNamesToDelete]||[],setValues:e=>a(h.AttributeNamesToDelete,e),errorMessage:n[h.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(w,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[h.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(h.Renames,t)},errorMessage:n[h.Renames]}),[O.PiiMasking]:({value:a,setValue:o,formErrors:i})=>(n(()=>{a[h.PiiCategories]?.length||o(h.PiiCategories,Gn.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Gn.map(({id:e,label:n})=>t(f,{label:n,value:a[h.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[h.PiiCategories]||[],i=t?[...n,e]:n.filter(t=>t!==e);o(h.PiiCategories,i)}},e))}),t(y,{errorMessage:i[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.FallbackSamplingRatio],i=S(e[h.FallbackSamplingRatio])?"":String(e[h.FallbackSamplingRatio]);return t(v,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:i,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.SamplingPercentage],i=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:i,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.EndpointsFilters],i=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Qn,values:i,setValues:e=>{a(h.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.ServicesNameFilters],i=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:to,values:i,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.AttributeFilters],i=(e[h.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const o=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n[o]?.operation,expectedValue:n[o]?.expectedValue,jsonPath:n[o]?.jsonPath}});return t(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:ao,values:i,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:i,jsonPath:l})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:i}}};return l&&(s.condition[n].jsonPath=l),s}))},errorMessage:o})},[O.URLTemplatization]:({value:n,setValue:i,formErrors:l})=>{const s=m(),r=n[Zn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>i(Zn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(o,{children:[t(I,{}),e(g,{$gap:12,children:[e(D,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${n+1}`}),t(E,{leftIcon:()=>t(Xa,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(v,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),t(w,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:eo,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(N,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),t(y,{errorMessage:l[Zn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Ha,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},oo=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const i=no[e];return i?t(i,{value:a,setValue:n,formErrors:o}):null},io=()=>{const a=m(),{selectedOption:n,genericForm:o}=P();if(!o||!n)return t(F,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(M,{size:L.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:i.disabled,setSelected:e=>l("disabled",e)}),t(Dn,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:i.signals||[],setSelectedSignals:e=>l("signals",e),errorMessage:s.signals}),t(v,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:i.name||"",onChange:({target:{value:e}})=>l("name",e),errorMessage:s.name}),t(oo,{actionType:n.type,value:i.fields,setValue:(e,t)=>l(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes||"",onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},lo=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:i,formErrors:l})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||_(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),y=f?f.value:m;return t(En,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:l[b],dropdownOptions:g,value:y||"",setValue:e=>i(b,e)},b)}),so=p(D)`
1
+ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as i,forwardRef as o,useState as l,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m,keyframes as h}from"styled-components";import{ae as g,y as b,af as f,ag as y,ah as v,ai as S,aj as C,ak as w,al as k,am as T,j as x,l as A,an as I,W as N,F as $,m as D,B as E,a as R,ao as O,ap as P,aq as M,N as L,n as F,p as z,ar as V,S as _,as as B,at as X,au as j,av as U,R as W,aw as H,ax as G,ay as K,az as q,o as Y,aA as J,q as Q,aB as Z,aC as ee,aD as te,aE as ae,aF as ne,aG as ie,aH as oe,x as le,aI as se,aJ as re,aK as ce,aL as de,z as ue,a5 as pe,aM as me,aN as he,aO as ge,aP as be,aQ as fe,aR as ye,aS as ve,aT as Se,aU as Ce,aV as we,s as ke,aW as Te,aX as xe,aY as Ae,aZ as Ie,a_ as Ne,b as $e,a$ as De,b0 as Ee,b1 as Re,b2 as Oe,L as Pe,b3 as Me,b4 as Le,$ as Fe,b5 as ze,a3 as Ve,b6 as _e,a4 as Be,b7 as Xe,b8 as je,b9 as Ue,ba as We,k as He,bb as Ge,bc as Ke,bd as qe,be as Ye,bf as Je,E as Qe,bg as Ze,bh as et,bi as tt,bj as at,bk as nt,e as it,bl as ot,D as lt,bm as st,bn as rt,bo as ct,bp as dt,bq as ut,br as pt,H as mt,bs as ht,bt as gt,bu as bt,bv as ft,bw as yt,bx as vt,by as St,bz as Ct,bA as wt,bB as kt,bC as Tt,bD as xt,bE as At,bF as It,bG as Nt,bH as $t,bI as Dt,bJ as Et,bK as Rt,bL as Ot,bM as Pt,bN as Mt,u as Lt,d as Ft,bO as zt,bP as Vt,bQ as _t,bR as Bt,bS as Xt,g as jt,bT as Ut,A as Wt,bU as Ht,t as Gt,v as Kt,bV as qt,bW as Yt,bX as Jt,bY as Qt,bZ as Zt,b_ as ea,b$ as ta,a6 as aa,c0 as na,c1 as ia,c2 as oa,c3 as la,c4 as sa,w as ra,c5 as ca,c6 as da,c7 as ua,c8 as pa,c as ma,c9 as ha,ca as ga,cb as ba,cc as fa,O as ya,cd as va,ce as Sa,cf as Ca,cg as wa,ch as ka,ci as Ta,cj as xa,ck as Aa,cl as Ia,cm as Na,cn as $a,a9 as Da,a8 as Ea,co as Ra,cp as Oa,cq as Pa,cr as Ma,cs as La,ct as Fa,cu as za,cv as Va,cw as _a,cx as Ba,cy as Xa,cz as ja,r as Ua,cA as Wa,cB as Ha,cC as Ga,cD as Ka,cE as qa,cF as Ya,cG as Ja,cH as Qa,cI as Za,cJ as en,cK as tn,cL as an,cM as nn,cN as on,cO as ln,cP as sn,cQ as rn,cR as cn,cS as dn,cT as un,cU as pn,cV as mn,cW as hn,cX as gn,cY as bn,cZ as fn,c_ as yn,c$ as vn,d0 as Sn,d1 as Cn,d2 as wn,d3 as kn,d4 as Tn,d5 as xn,d6 as An,d7 as In}from"../chunks/ui-components-of0mjGMv.js";import{TrashIcon as Nn,PlusIcon as $n,BookIcon as Dn,VSquareIcon as En,XSquareIcon as Rn,DeleteIcon as On,EditIcon as Pn,GoLogo as Mn,JavaLogo as Ln,ChevronRightIcon as Fn,ActionIcon as zn,DestinationIcon as Vn,ChevronUpIcon as _n,ChevronDownIcon as Bn,VIcon as Xn,XIcon as jn,InstrumentationRuleIcon as Un,SourceIcon as Wn,NamespacesIcon as Hn,SettingsIcon as Gn,SamplingIcon as Kn,ExclamationTriangleIcon as qn,ExclamationCircleIcon as Yn,KeyIcon as Jn,DiagnoseIcon as Qn,DownloadIcon as Zn,TerminalIcon as ei,RefreshIcon as ti,ConnectionsIcon as ai,OdigosLogo as ni,ArrowRightIcon as ii,FilterIcon as oi,RefreshLeftArrowIcon as li,DataStreamIcon as si,PipelineCollectorIcon as ri,PodIcon as ci,ArrowDownSquareIcon as di,ArrowUpSquareIcon as ui,GatewayIcon as pi,YamlIcon as mi}from"../icons.js";import{S as hi,D as gi,A as bi,P as fi,a as yi,b as vi,R as Si,c as Ci,O as wi,d as ki,e as Ti,f as xi,W as Ai,g as Ii,C as Ni,h as $i,i as Di,U as Ei}from"../chunks/index-D7sjsMOG.js";import{S as Ri}from"../chunks/index-Bbukn13F.js";import{Y as Oi}from"../chunks/index-Cw4LkdaE.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Pi=[{id:"CREDIT_CARD",label:"Credit card"}],Mi=[{id:g.CollectContainerAttributes,label:"Collect container attributes"},{id:g.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:g.CollectWorkloadId,label:"Collect workload ID"},{id:g.CollectClusterId,label:"Collect cluster ID"}],Li=[{id:T.Pod,label:T.Pod},{id:T.Namespace,label:T.Namespace},{id:T.Node,label:T.Node}],Fi=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Li}],zi=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Li}],Vi=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:C.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:C.Number}],_i=g.UrlTemplatizationRulesGroups,Bi=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],Xi=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:C.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number}],ji=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:O.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:O.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],Ui={[P.K8sAttributes]:({value:i,setValue:o,formErrors:l})=>(n(()=>{i[g.CollectContainerAttributes]||i[g.CollectReplicaSetAttributes]||i[g.CollectWorkloadId]||i[g.CollectClusterId]||i[g.LabelsAttributes]?.length||i[g.AnnotationsAttributes]?.length||(o(g.CollectContainerAttributes,!0),o(g.CollectReplicaSetAttributes,!0),o(g.CollectWorkloadId,!0),o(g.CollectClusterId,!0),o(g.LabelsAttributes,[]),o(g.AnnotationsAttributes,[]))},[]),e(a,{children:[t(b,{$gap:6,children:Mi.map(({id:a,label:n})=>e(b,{children:[t(y,{label:n,value:i[a]||!1,onChange:e=>o(a,e)}),t(v,{errorMessage:l[a]})]},a))}),t(k,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Fi,values:i[g.LabelsAttributes]||[],setValues:e=>o(g.LabelsAttributes,e),errorMessage:l[g.LabelsAttributes]}),t(k,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:zi,values:i[g.AnnotationsAttributes]||[],setValues:e=>o(g.AnnotationsAttributes,e),errorMessage:l[g.AnnotationsAttributes]})]})),[P.AddClusterInfo]:({value:n,setValue:i,formErrors:o})=>{const l=m();return e(a,{children:[t(x,{label:"Overwrite existing values",labelAlign:A.Left,labelColor:l.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[g.OverwriteExistingValues]||!1,onChange:e=>i(g.OverwriteExistingValues,e)}),t(k,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[g.ClusterAttributes]||[],setValues:e=>i(g.ClusterAttributes,e),errorMessage:o[g.ClusterAttributes]})]})},[P.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(I,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[g.AttributeNamesToDelete]||[],setValues:e=>a(g.AttributeNamesToDelete,e),errorMessage:n[g.AttributeNamesToDelete]}),[P.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(k,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[g.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(g.Renames,t)},errorMessage:n[g.Renames]}),[P.PiiMasking]:({value:a,setValue:i,formErrors:o})=>(n(()=>{a[g.PiiCategories]?.length||i(g.PiiCategories,Pi.map(({id:e})=>e))},[]),e(b,{$gap:12,children:[t(f,{label:"Attributes to mask"}),t(b,{$gap:6,children:Pi.map(({id:e,label:n})=>t(y,{label:n,value:a[g.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[g.PiiCategories]||[],o=t?[...n,e]:n.filter(t=>t!==e);i(g.PiiCategories,o)}},e))}),t(v,{errorMessage:o[g.PiiCategories]})]})),[P.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[g.FallbackSamplingRatio],o=w(e[g.FallbackSamplingRatio])?"":String(e[g.FallbackSamplingRatio]);return t(S,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(g.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:i})},[P.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[g.SamplingPercentage],o=w(e[g.SamplingPercentage])?"":String(e[g.SamplingPercentage]);return t(S,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(g.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:i})},[P.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[g.EndpointsFilters],o=e[g.EndpointsFilters]||[];return t(k,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Vi,values:o,setValues:e=>{a(g.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:i})},[P.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[g.ServicesNameFilters],o=e[g.ServicesNameFilters]||[];return t(k,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:Xi,values:o,setValues:e=>{a(g.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:i})},[P.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[g.AttributeFilters],o=(e[g.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const i=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:i,operation:n[i]?.operation,expectedValue:n[i]?.expectedValue,jsonPath:n[i]?.jsonPath}});return t(k,{name:"attributeFilters",limitFieldsPerRow:2,columns:ji,values:o,setValues:e=>{a(g.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:i,expectedValue:o,jsonPath:l})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:i,expectedValue:o}}};return l&&(s.condition[n].jsonPath=l),s}))},errorMessage:i})},[P.URLTemplatization]:({value:n,setValue:o,formErrors:l})=>{const s=m(),r=n[_i]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>o(_i,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(i,{children:[t(N,{}),e(b,{$gap:12,children:[e($,{$justifyContent:"space-between",$alignItems:"center",children:[t(f,{label:`Rule Group ${n+1}`}),t(D,{leftIcon:()=>t(Nn,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:E.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(S,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),t(k,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Bi,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(I,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),t(v,{errorMessage:l[_i]})]},`url-templatization-group-${n}`)),t(D,{variant:R.Secondary,label:"Add rule group",leftIcon:$n,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(N,{})]})}},Wi=({actionType:e,value:a,setValue:n,formErrors:i})=>{if(!e)return null;const o=Ui[e];return o?t(o,{value:a,setValue:n,formErrors:i}):null},Hi=()=>{const a=m(),{selectedOption:n,genericForm:i}=M();if(!i||!n)return t(L,{title:"No active form"});const{formData:o,handleFormChange:l,formErrors:s}=i;return e(b,{$gap:24,children:[e($,{$gap:12,$justifyContent:"space-between",children:[t(F,{size:z.XXS,children:n.docsDescription}),t(D,{label:"Docs",leftIcon:Dn,variant:R.Text,size:E.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(_,{options:[{icon:En,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Rn,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>l("disabled",e)}),t(hi,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:o.signals||[],setSelectedSignals:e=>l("signals",e),errorMessage:s.signals}),t(S,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:o.name||"",onChange:({target:{value:e}})=>l("name",e),errorMessage:s.name}),t(Wi,{actionType:n.type,value:o.fields,setValue:(e,t)=>l(`fields.${e}`,t),formErrors:s}),t(B,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes||"",onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},Gi=({signals:e,fields:a,disabled:n,formData:i,handleFormChange:o,formErrors:l})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||X(a,e,i.fields)))return null;const b=c,f=i.fields.find(e=>e.key===b),y=f?f.value:m;return t(gi,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:l[b],dropdownOptions:g,value:y||"",setValue:e=>o(b,e)},b)}),Ki=p($)`
2
2
  position: sticky;
3
3
  bottom: 4px;
4
4
  align-self: center;
@@ -9,17 +9,17 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
9
9
  background-color: ${({theme:e})=>e.v2.colors.black[500]};
10
10
  box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
11
11
  z-index: 1;
12
- `,ro=i(({testConnection:a,isEdit:o},i)=>{const r=m(),{activeForm:c,genericForm:d,validateFormData:u,thisUnsavedDestination:p,addUnsavedDestination:h,updateUnsavedDestination:b,deleteUnsavedDestination:f}=U(),[y,C]=l(p?.testResult),[S,w]=l(!!p);n(()=>{p?(C(p.testResult),w(!0)):(C(void 0),w(!1))},[p]);const k=async()=>{if(!c?.option.testConnectionSupported||!d)return;const e=await a(K(d.formData));return C(e),e};return s(i,()=>({testConnection:k,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,d,a]),d&&c?e(g,{$gap:24,style:{minHeight:"100%"},children:[e(D,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(j,{status:X.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(j,{status:X.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(E,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:S}),t(Dn,{title:"This connection will monitor:",allowedSignals:G(c.option.supportedSignals),selectedSignals:W(d.formData.exportedSignals),setSelectedSignals:e=>d.handleFormChange("exportedSignals",{logs:e.includes(H.Logs),metrics:e.includes(H.Metrics),traces:e.includes(H.Traces)}),disabled:S,errorMessage:d.formErrors.exportedSignals}),t(v,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:d.formData.name,onChange:({target:{value:e}})=>d.handleFormChange("name",e),disabled:S,errorMessage:d.formErrors.name}),t(lo,{signals:W(d.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:d.formData,handleFormChange:(e,t)=>{d.handleFormChange("fields",d.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:d.formErrors}),!o&&e(so,{$gap:8,$justifyContent:"center",children:[p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:Ya,variant:R.Secondary,textColor:r.v2.colors.red[500],onClick:()=>f(c.unsavedIdx)})}),(!p||p.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:R.Secondary,onClick:k})}),p&&t("div",S?{style:{width:"150px"},children:t(E,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:qa,variant:R.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(E,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;b(c.unsavedIdx,{formData:t,testResult:e},a)}}})}),!p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;h({formData:t,testResult:e},a)}}})})]})]}):t(F,{title:"No active form"})});ro.displayName="AddDestinationForm";const co=[{id:Y.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Y.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Y.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],uo=[{id:Y.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Y.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Y.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],po=["*"],mo=[{id:Q.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Q.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Q.DbQuery,label:"Collect DB query",tooltip:""},{id:Q.Messaging,label:"Collect messaging",tooltip:""}],ho={[te.Java]:[new ee("","")],[te.Golang]:[new Z("")]},go={[ae.CodeAttributes]:({value:o,setValue:i,formErrors:l})=>{const s=m(),c=l.codeAttributes,d=r(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!c){const e={[Y.FilePath]:!0,[Y.Function]:!0,[Y.LineNumber]:!0,[Y.Column]:null,[Y.Namespace]:null,[Y.StackTrace]:null};i("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(Y).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});i("codeAttributes",n)};return e(a,{children:[e(g,{$gap:12,children:[t(M,{size:L.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:co.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]}),e(g,{$gap:12,children:[t(M,{size:L.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:uo.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]})]})},[ae.CustomInstrumentation]:({value:o,setValue:i,formErrors:l})=>{const s=l.customInstrumentations,c=r(()=>(o?.customInstrumentations?.[te.Golang]||[]).map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=r(()=>(o?.customInstrumentations?.[te.Java]||[]).map(e=>new ee(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||s||i("customInstrumentations",{[te.Golang]:ho[te.Golang],[te.Java]:ho[te.Java]})},[]),e(a,{children:[e(g,{children:[e(D,{$gap:8,children:[t(Ja,{}),t(b,{label:"Golang custom probes"})]}),t(w,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:c,setValues:e=>{const t={};t[te.Golang]=e.map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[te.Java]=d,i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[t(Qa,{}),t(b,{label:"Java custom probes"})]}),t(w,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[te.Golang]=c,t[te.Java]=e.map(e=>new ee(e.className,e.methodName)),i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ae.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const i=o.headersCollection,l=r(()=>e?.headersCollection?.[J.HeaderKeys]||[],[e]),s=e=>{const t={[J.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{l.length||i||s(po)},[]),t(N,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:s,errorMessage:i})},[ae.PayloadCollection]:({value:a,setValue:o,formErrors:i})=>{const l=m(),s=i.payloadCollection,c=r(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!c.length&&!s){const e={[Q.HttpRequest]:{},[Q.HttpResponse]:{},[Q.DbQuery]:{},[Q.Messaging]:{}};o("payloadCollection",e)}},[]);return e(g,{$gap:12,children:[t(M,{size:L.XS,color:l.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:mo.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:c.includes(e),onChange:t=>((e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n={[Q.HttpRequest]:a.includes(Q.HttpRequest)?{}:null,[Q.HttpResponse]:a.includes(Q.HttpResponse)?{}:null,[Q.DbQuery]:a.includes(Q.DbQuery)?{}:null,[Q.Messaging]:a.includes(Q.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(y,{errorMessage:s})]})},[ae.UnknownType]:null},bo=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const i=go[e];return i?t(i,{value:a,setValue:n,formErrors:o}):null},fo=()=>{const a=m(),{selectedOption:n,genericForm:o}=ne();if(!o||!n)return t(F,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(M,{size:L.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[t(M,{size:L.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(oe,{label:ie[e],leftIcon:le(e),status:X.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:i.disabled,setSelected:e=>l("disabled",e)}),t(v,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:i.ruleName,onChange:({target:{value:e}})=>l("ruleName",e),errorMessage:s.ruleName}),t(bo,{ruleType:n.type,value:i,setValue:(e,t)=>l(e,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes,onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},yo=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],vo=p.div`
12
+ `,qi=o(({testConnection:a,isEdit:i},o)=>{const r=m(),{activeForm:c,genericForm:d,validateFormData:u,thisUnsavedDestination:p,addUnsavedDestination:h,updateUnsavedDestination:g,deleteUnsavedDestination:f}=j(),[y,v]=l(p?.testResult),[C,w]=l(!!p);n(()=>{p?(v(p.testResult),w(!0)):(v(void 0),w(!1))},[p]);const k=async()=>{if(!c?.option.testConnectionSupported||!d)return;const e=await a(q(d.formData));return v(e),e};return s(o,()=>({testConnection:k,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,d,a]),d&&c?e(b,{$gap:24,style:{minHeight:"100%"},children:[e($,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(U,{status:W.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(U,{status:W.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(D,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Dn,variant:R.Text,size:E.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(_,{options:[{icon:En,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Rn,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:C}),t(hi,{title:"This connection will monitor:",allowedSignals:K(c.option.supportedSignals),selectedSignals:G(d.formData.exportedSignals),setSelectedSignals:e=>d.handleFormChange("exportedSignals",{logs:e.includes(H.Logs),metrics:e.includes(H.Metrics),traces:e.includes(H.Traces)}),disabled:C,errorMessage:d.formErrors.exportedSignals}),t(S,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:d.formData.name,onChange:({target:{value:e}})=>d.handleFormChange("name",e),disabled:C,errorMessage:d.formErrors.name}),t(Gi,{signals:G(d.formData.exportedSignals),fields:c.dynamicFields,disabled:C,formData:d.formData,handleFormChange:(e,t)=>{d.handleFormChange("fields",d.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:d.formErrors}),!i&&e(Ki,{$gap:8,$justifyContent:"center",children:[p&&t("div",{style:{width:"150px"},children:t(D,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:On,variant:R.Secondary,textColor:r.v2.colors.red[500],onClick:()=>f(c.unsavedIdx)})}),(!p||p.option.testConnectionSupported&&!C)&&t("div",{style:{width:"150px"},children:t(D,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:R.Secondary,onClick:k})}),p&&t("div",C?{style:{width:"150px"},children:t(D,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Pn,variant:R.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(D,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;g(c.unsavedIdx,{formData:t,testResult:e},a)}}})}),!p&&t("div",{style:{width:"150px"},children:t(D,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;h({formData:t,testResult:e},a)}}})})]})]}):t(L,{title:"No active form"})});qi.displayName="AddDestinationForm";const Yi=[{id:J.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:J.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:J.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Ji=[{id:J.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:J.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:J.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Qi=["*"],Zi=[{id:ee.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:ee.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:ee.DbQuery,label:"Collect DB query",tooltip:""},{id:ee.Messaging,label:"Collect messaging",tooltip:""}],eo={[ne.Java]:[new ae("","")],[ne.Golang]:[new te("")]},to={[ie.CodeAttributes]:({value:i,setValue:o,formErrors:l})=>{const s=l.codeAttributes,c=r(()=>Object.entries(i.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]);n(()=>{if(!c.length&&!s){const e={[J.FilePath]:!0,[J.Function]:!0,[J.LineNumber]:!0,[J.Column]:null,[J.Namespace]:null,[J.StackTrace]:null};o("codeAttributes",e)}},[]);const d=(e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n=Object.values(J).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});o("codeAttributes",n)};return e(a,{children:[e(b,{$gap:12,children:[t(F,{size:z.XS,color:Y.Secondary,nowrap:!0,children:"Recommended data to collect"}),t(b,{$gap:6,children:Yi.map(({id:e,label:a,tooltip:n})=>t(Q,{text:n,withIcon:!0,children:t(y,{label:a,value:c.includes(e),onChange:t=>d(e,t)})},e))}),t(v,{errorMessage:s})]}),e(b,{$gap:12,children:[t(F,{size:z.XS,color:Y.Secondary,nowrap:!0,children:"Verbose data to collect"}),t(b,{$gap:6,children:Ji.map(({id:e,label:a,tooltip:n})=>t(Q,{text:n,withIcon:!0,children:t(y,{label:a,value:c.includes(e),onChange:t=>d(e,t)})},e))}),t(v,{errorMessage:s})]})]})},[ie.CustomInstrumentation]:({value:i,setValue:o,formErrors:l})=>{const s=l.customInstrumentations,c=r(()=>(i?.customInstrumentations?.[ne.Golang]||[]).map(e=>new te(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[i]),d=r(()=>(i?.customInstrumentations?.[ne.Java]||[]).map(e=>new ae(e.className,e.methodName)),[i]);return n(()=>{i?.customInstrumentations||s||o("customInstrumentations",{[ne.Golang]:eo[ne.Golang],[ne.Java]:eo[ne.Java]})},[]),e(a,{children:[e(b,{children:[e($,{$gap:8,children:[t(Mn,{}),t(f,{label:"Golang custom probes"})]}),t(k,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:c,setValues:e=>{const t={};t[ne.Golang]=e.map(e=>new te(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[ne.Java]=d,o("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(b,{children:[e($,{$gap:8,children:[t(Ln,{}),t(f,{label:"Java custom probes"})]}),t(k,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[ne.Golang]=c,t[ne.Java]=e.map(e=>new ae(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ie.HeadersCollection]:({value:e,setValue:a,formErrors:i})=>{const o=i.headersCollection,l=r(()=>e?.headersCollection?.[Z.HeaderKeys]||[],[e]),s=e=>{const t={[Z.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{l.length||o||s(Qi)},[]),t(I,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:s,errorMessage:o})},[ie.PayloadCollection]:({value:a,setValue:i,formErrors:o})=>{const l=o.payloadCollection,s=r(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!s.length&&!l){const e={[ee.HttpRequest]:{},[ee.HttpResponse]:{},[ee.DbQuery]:{},[ee.Messaging]:{}};i("payloadCollection",e)}},[]);return e(b,{$gap:12,children:[t(F,{size:z.XS,color:Y.Secondary,nowrap:!0,children:"Type of data to collect"}),t(b,{$gap:6,children:Zi.map(({id:e,label:a,tooltip:n})=>t(Q,{text:n,withIcon:!0,children:t(y,{label:a,value:s.includes(e),onChange:t=>((e,t)=>{const a=t?[...s,e]:s.filter(t=>t!==e),n={[ee.HttpRequest]:a.includes(ee.HttpRequest)?{}:null,[ee.HttpResponse]:a.includes(ee.HttpResponse)?{}:null,[ee.DbQuery]:a.includes(ee.DbQuery)?{}:null,[ee.Messaging]:a.includes(ee.Messaging)?{}:null};i("payloadCollection",n)})(e,t)})},e))}),t(v,{errorMessage:l})]})},[ie.UnknownType]:null},ao=({ruleType:e,value:a,setValue:n,formErrors:i})=>{if(!e)return null;const o=to[e];return o?t(o,{value:a,setValue:n,formErrors:i}):null},no=()=>{const a=m(),{selectedOption:n,genericForm:i}=oe();if(!i||!n)return t(L,{title:"No active form"});const{formData:o,handleFormChange:l,formErrors:s}=i;return e(b,{$gap:24,children:[e($,{$gap:12,$justifyContent:"space-between",children:[t(F,{size:z.XXS,children:n.docsDescription}),t(D,{label:"Docs",leftIcon:Dn,variant:R.Text,size:E.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e($,{$gap:12,children:[t(F,{size:z.XS,color:Y.Secondary,nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(le,{label:se[e],leftIcon:re(e),status:W.Default,useSecondaryTone:!0},e))]}),t(_,{options:[{icon:En,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Rn,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>l("disabled",e)}),t(S,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:o.ruleName,onChange:({target:{value:e}})=>l("ruleName",e),errorMessage:s.ruleName}),t(ao,{ruleType:n.type,value:o,setValue:(e,t)=>l(e,t),formErrors:s}),t(B,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes,onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},io=()=>{const{pendingMerge:e,confirmMerge:a,cancelMerge:n}=ce();if(!e)return null;const{existingName:i,editingName:o}=e;return t(de,{isOpen:!0,onClose:n,title:"Merge with existing Data Stream?",description:ue.DATA_STREAM_MERGE_WARNING(o,i),approveButton:{"data-id":"data-stream-merge-confirm",label:"Merge",variant:R.Primary,onClick:a},denyButton:{"data-id":"data-stream-merge-cancel",label:"Cancel",variant:R.Secondary,onClick:n}})},oo=({autoFocus:a})=>{const{dataStreams:n}=pe(),{genericForm:i,excludeName:o,editingName:l}=ce(),{formData:s,formErrors:c,handleFormChange:d}=i,u=s.name,p=r(()=>n.find(e=>e.name===u&&e.name!==o),[n,u,o]);return e(b,{$width:"100%",$gap:12,children:[t(S,{name:"data-stream-name",label:ue.STREAM_NAME,placeholder:ue.NAME_YOUR_STREAM_PLACEHOLDER,tooltip:ue.STREAM_DESCRIPTION,required:!0,autoFocus:a,value:u,onChange:e=>d("name",e.target.value),errorMessage:c.name}),p&&t(U,{status:W.Warning,message:ue.DATA_STREAM_MERGE_WARNING(l,p.name),fullWidth:!0})]})},lo=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],so=p.div`
13
13
  display: flex;
14
14
  flex-direction: column;
15
15
  gap: 24px;
16
- `,Co=p.div`
16
+ `,ro=p.div`
17
17
  display: contents;
18
18
  & > * {
19
19
  opacity: ${({$faded:e})=>e?.4:1};
20
20
  transition: opacity 0.2s ease;
21
21
  }
22
- `,So=({value:e})=>{const a=m();return t(oe,e?{status:X.Success,label:ge,leftIcon:Ga}:{label:be,leftIcon:Ka,backgroundColor:a.v2.colors.silver[500],textColor:a.v2.colors.white[500]})},wo=({value:e,onChange:a})=>{const n=m(),o=r(()=>[{icon:Ga,label:ge,value:!0,selectedBgColor:n.v2.colors.green[800]},{icon:Ka,label:be,value:!1,selectedBgColor:n.v2.colors.silver[500]}],[n]);return t(B,{size:fe.S,options:o,selected:e,setSelected:a??(()=>{}),disabled:!a})},ko=()=>{const e=se();switch(e.formType){case re.Create:return t(To,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(wo,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})});case re.View:return e.data?e.isEditing?t(To,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(wo,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})}):t(Ao,{data:e.data,renderAction:()=>t(So,{value:!e.data?.rule.disabled})}):null;case re.EditAutoNoisy:return t(No,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:he,sectionTitle:pe,sectionSubTitle:ue,presetLabel:de,customInputName:"sampling-auto-input-custom-percentage",percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(wo,{value:e.localEnabled,onChange:e.setLocalEnabled})});case re.EditAutoCostReduction:return t(No,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:me,sectionTitle:pe,sectionSubTitle:ue,presetLabel:de,customInputName:"sampling-cr-auto-input-custom-percentage",showModeToggle:!1,percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(wo,{value:e.localEnabled,onChange:e.setLocalEnabled})});case re.EditAutoHighlyRelevant:return t(vo,{children:t($n,{title:e.localEnabled?void 0:ce,summary:e.summary,renderAction:()=>t(wo,{value:e.localEnabled,onChange:e.setLocalEnabled})})})}},To=({category:a,formData:n,onChange:o,sourceOptions:i,namespaceOptions:l,renderAction:s})=>e(vo,{children:[t(On,{category:a,formState:n,renderAction:s}),e(Co,{$faded:!!n.disabled,children:[t(Pn,{category:a,formState:n,onChange:o}),t(Fn,{formState:n,onChange:o,sourceOptions:i,namespaceOptions:l}),t(Mn,{category:a,formState:n,onChange:o}),"highlyRelevant"===a&&t(Ln,{formState:n,onChange:o}),"highlyRelevant"===a&&t(Vn,{ruleType:n.ruleType,formState:n,onChange:o}),t(Bn,{category:a,formState:n,onChange:o})]})]}),Ao=({data:a,renderAction:n})=>e(vo,{children:[t(On,{readOnly:!0,summary:a.summary,renderAction:n}),t(Pn,{readOnly:!0,data:a}),t(Fn,{readOnly:!0,scopes:a.rule.sourceScopes??[]}),t(Mn,{readOnly:!0,data:a}),t(Bn,{readOnly:!0,data:a}),"highlyRelevant"===a.category&&t(Vn,{readOnly:!0,rule:a.rule})]}),No=({enabled:a,summary:n,inactiveTitle:o,sectionTitle:i,sectionSubTitle:l,presetLabel:s,customInputName:r,showModeToggle:d=!0,percentageMode:u,setPercentageMode:p,percentagePreset:m,setPercentagePreset:h,customPercentage:b,setCustomPercentage:f,renderAction:y})=>{const v=c(e=>p(e),[p]),C=c(e=>h(e),[h]),S=c(e=>f(e.target.value),[f]),w=!d||"sample"===u;return e(vo,{children:[t($n,{title:a?void 0:o,summary:n,renderAction:y}),t(Co,{$faded:!a,children:e(ye,{richTitle:{title:i,subTitle:l},children:[d&&t(g,{$alignItems:"flex-start",children:t(B,{size:fe.S,options:yo,selected:u,setSelected:v})}),w&&t(Rn,{description:s,options:xn,selected:m,onSelect:C,customName:r,customLabel:ve,customPlaceholder:"5%",customValue:b,onCustomChange:S})]})})]})},Io=p.div`
22
+ `,co=({value:e})=>{const a=m();return t(le,e?{status:W.Success,label:Ce,leftIcon:En}:{label:we,leftIcon:Rn,backgroundColor:a.v2.colors.silver[500],textColor:a.v2.colors.white[500]})},uo=({value:e,onChange:a})=>{const n=m(),i=r(()=>[{icon:En,label:Ce,value:!0,selectedBgColor:n.v2.colors.green[800]},{icon:Rn,label:we,value:!1,selectedBgColor:n.v2.colors.silver[500]}],[n]);return t(_,{size:ke.S,options:i,selected:e,setSelected:a??(()=>{}),disabled:!a})},po=()=>{const e=me();switch(e.formType){case he.Create:return t(mo,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(uo,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})});case he.View:return e.data?e.isEditing?t(mo,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(uo,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})}):t(ho,{data:e.data,renderAction:()=>t(co,{value:!e.data?.rule.disabled})}):null;case he.EditAutoNoisy:return t(go,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:Se,sectionTitle:ye,sectionSubTitle:fe,presetLabel:be,customInputName:"sampling-auto-input-custom-percentage",percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(uo,{value:e.localEnabled,onChange:e.setLocalEnabled})});case he.EditAutoCostReduction:return t(go,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:ve,sectionTitle:ye,sectionSubTitle:fe,presetLabel:be,customInputName:"sampling-cr-auto-input-custom-percentage",showModeToggle:!1,percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(uo,{value:e.localEnabled,onChange:e.setLocalEnabled})});case he.EditAutoHighlyRelevant:return t(so,{children:t(bi,{title:e.localEnabled?void 0:ge,summary:e.summary,renderAction:()=>t(uo,{value:e.localEnabled,onChange:e.setLocalEnabled})})})}},mo=({category:a,formData:n,onChange:i,sourceOptions:o,namespaceOptions:l,renderAction:s})=>e(so,{children:[t(vi,{category:a,formState:n,renderAction:s}),e(ro,{$faded:!!n.disabled,children:[t(Si,{category:a,formState:n,onChange:i}),t(Ci,{formState:n,onChange:i,sourceOptions:o,namespaceOptions:l}),t(wi,{category:a,formState:n,onChange:i}),"highlyRelevant"===a&&t(ki,{formState:n,onChange:i}),"highlyRelevant"===a&&t(Ti,{ruleType:n.ruleType,formState:n,onChange:i}),t(xi,{category:a,formState:n,onChange:i})]})]}),ho=({data:a,renderAction:n})=>e(so,{children:[t(vi,{readOnly:!0,summary:a.summary,renderAction:n}),t(Si,{readOnly:!0,data:a}),t(Ci,{readOnly:!0,scopes:a.rule.sourceScopes??[]}),t(wi,{readOnly:!0,data:a}),t(xi,{readOnly:!0,data:a}),"highlyRelevant"===a.category&&t(Ti,{readOnly:!0,rule:a.rule})]}),go=({enabled:a,summary:n,inactiveTitle:i,sectionTitle:o,sectionSubTitle:l,presetLabel:s,customInputName:r,showModeToggle:d=!0,percentageMode:u,setPercentageMode:p,percentagePreset:m,setPercentagePreset:h,customPercentage:g,setCustomPercentage:f,renderAction:y})=>{const v=c(e=>p(e),[p]),S=c(e=>h(e),[h]),C=c(e=>f(e.target.value),[f]),w=!d||"sample"===u;return e(so,{children:[t(bi,{title:a?void 0:i,summary:n,renderAction:y}),t(ro,{$faded:!a,children:e(Te,{richTitle:{title:o,subTitle:l},children:[d&&t(b,{$alignItems:"flex-start",children:t(_,{size:ke.S,options:lo,selected:u,setSelected:v})}),w&&t(fi,{description:s,options:yi,selected:m,onSelect:S,customName:r,customLabel:xe,customPlaceholder:"5%",customValue:g,onCustomChange:C})]})})]})},bo=p.div`
23
23
  display: flex;
24
24
  align-items: center;
25
25
  justify-content: space-between;
@@ -32,32 +32,32 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
32
32
  &:hover {
33
33
  background-color: ${({$isSelected:e,$purpleColors:t,theme:a})=>e?t?a.v2.colors.purple[700]:a.v2.colors.silver[600]:t?a.v2.colors.purple[800]:a.v2.colors.silver[700]};
34
34
  }
35
- `,Do=p.div`
35
+ `,fo=p.div`
36
36
  display: flex;
37
37
  align-items: center;
38
38
  justify-content: center;
39
39
  padding: 8px;
40
40
  border-radius: 8px;
41
- background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
42
- `,Eo=({dataId:a,icon:n,title:o,description:i,withCarret:l,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:h,onCheckboxChange:b})=>{const y=m();return e(Io,{"data-id":a||`list-item-${o}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[e(g,{$gap:4,children:[e(D,{$gap:12,children:[b&&t(f,{partiallyChecked:h||!1,value:p||!1,onChange:e=>b(e)}),n&&t(Do,{children:t(n,{size:20})}),t(M,{size:L.XS,children:o})]}),i&&t(M,{size:L.XXXS,color:y.v2.colors.silver[200],children:i})]}),(l||c)&&e(D,{$gap:8,children:[c,l&&t(Za,{size:18})]})]})},$o=p.div`
41
+ background-color: ${({theme:e})=>e.v2.colors.white[500]+Ae["004"]};
42
+ `,yo=({dataId:a,icon:n,title:i,description:o,withCarret:l,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:m,onCheckboxChange:h})=>e(bo,{"data-id":a||`list-item-${i}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[e(b,{$gap:4,children:[e($,{$gap:12,children:[h&&t(y,{partiallyChecked:m||!1,value:p||!1,onChange:e=>h(e)}),n&&t(fo,{children:t(n,{size:20})}),t(F,{size:z.XS,children:i})]}),o&&t(F,{size:z.XXXS,color:Y.Secondary,children:o})]}),(l||c)&&e($,{$gap:8,children:[c,l&&t(Fn,{size:18})]})]}),vo=p.div`
43
43
  display: flex;
44
44
  align-items: center;
45
45
  gap: 8px;
46
46
  padding: 8px;
47
- `,Ro=({onClose:a,selectedConnectionIds:n,setSelectedConnectionIds:o,createAction:i,withOverlay:s})=>{const c=m(),[u,p]=l(""),h=d(null),{selectedOption:g,onSelectOption:b,genericForm:f,validateFormData:y,errorMessage:v}=P(),C=r(()=>(u?Se.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):Se).filter(e=>!!e),[u]),S=r(()=>(u?we.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):we).filter(e=>!!e),[u]),w=r(()=>{const a=(a,n)=>e($o,{children:[t(M,{size:L.XS,color:c.v2.colors.silver[200],children:a}),t(oe,{label:n.toString()})]},a),n=e=>{const a=g?.type===e.type;return t(Eo,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{h.current?.clearErrors(),b(e)}},e.type)};return[a("Attributes",C.length),...C.map(n),a("Samplers",S.length),...S.map(n)]},[c,g?.type,C.length,S.length,b]),k=r(()=>g?[t(io,{},g.type)]:[t(ke,{$height:"100%",children:t(F,{icon:en,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[g]);return t(zn,{ref:h,isOpen:!0,withOverlay:s,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=y();return e?Promise.resolve({error:e}):await i(t)},disableSave:!g||!f?.isFormDirty,isFormDirty:f?.isFormDirty,hideDirtyNote:!0,errorMessage:v,progress:{title:Te.CREATING_ACTION,subTitle:Te.CREATING_ACTION_SUBTITLE},header:{icon:en,title:Te.ADD_ACTION,subTitle:Te.ADD_ACTION_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:w},rightColumn:{width:"60%",list:k}})},xo=({destinationsByCategory:n,filters:o,setFilters:i})=>{const l=r(()=>Object.values(Ae).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=r(()=>{const e=Object.values(H).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(a,{children:[t(Ne,{placeholder:"Select category",options:l,values:o.categoryType?[o.categoryType]:[],setValues:e=>i({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:fe.S,options:s,selected:o.signalType,setSelected:e=>i({...o,signalType:e})})]})},Oo=p.div`
47
+ `,So=({onClose:a,selectedConnectionIds:n,setSelectedConnectionIds:i,createAction:o,withOverlay:s})=>{const[c,u]=l(""),p=d(null),{selectedOption:m,onSelectOption:h,genericForm:g,validateFormData:b,errorMessage:f}=M(),y=r(()=>(c?Ie.filter(e=>e?.label?.toLowerCase().includes(c.toLowerCase())):Ie).filter(e=>!!e),[c]),v=r(()=>(c?Ne.filter(e=>e?.label?.toLowerCase().includes(c.toLowerCase())):Ne).filter(e=>!!e),[c]),S=r(()=>{const a=(a,n)=>e(vo,{children:[t(F,{size:z.XS,color:Y.Secondary,children:a}),t(le,{label:n.toString()})]},a),n=e=>{const a=m?.type===e.type;return t(yo,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{p.current?.clearErrors(),h(e)}},e.type)};return[a("Attributes",y.length),...y.map(n),a("Samplers",v.length),...v.map(n)]},[m?.type,y.length,v.length,h]),C=r(()=>m?[t(Hi,{},m.type)]:[t($e,{$height:"100%",children:t(L,{icon:zn,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[m]);return t(Ai,{ref:p,isOpen:!0,withOverlay:s,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=b();return e?Promise.resolve({error:e}):await o(t)},disableSave:!m||!g?.isFormDirty,isFormDirty:g?.isFormDirty,hideDirtyNote:!0,errorMessage:f,progress:{title:ue.CREATING_ACTION,subTitle:ue.CREATING_ACTION_SUBTITLE},header:{icon:zn,title:ue.ADD_ACTION,subTitle:ue.ADD_ACTION_DESCRIPTION},connectionIds:n&&i?{value:n,setValue:i}:void 0,search:{value:c,onChange:u},leftColumn:{width:"40%",list:S},rightColumn:{width:"60%",list:C}})},Co=({destinationsByCategory:n,filters:i,setFilters:o})=>{const l=r(()=>Object.values(De).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=r(()=>{const e=Object.values(H).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(a,{children:[t(Ee,{placeholder:"Select category",options:l,values:i.categoryType?[i.categoryType]:[],setValues:e=>o({...i,categoryType:i.categoryType===e[0]?null:e[0]})}),t(_,{size:ke.S,options:s,selected:i.signalType,setSelected:e=>o({...i,signalType:e})})]})},wo=p.div`
48
48
  display: flex;
49
49
  flex-direction: column;
50
50
  padding: 8px;
51
51
  border-radius: 16px;
52
52
  border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
53
53
  background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
54
- `,Po=p.div`
54
+ `,ko=p.div`
55
55
  display: flex;
56
56
  align-items: center;
57
57
  justify-content: space-between;
58
58
  gap: 12px;
59
59
  padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
60
- `,Fo=({title:a,tooltip:n,list:o,noBgColor:i,purpleColors:s})=>{const[r,c]=l(!0);return e(Oo,{"data-id":`collapse-${a}`,$noBgColor:i,$purpleColors:s,children:[e(Po,{$isOpen:r,children:[e(D,{$gap:10,children:[t(M,{size:L.XS,children:a}),n&&t(q,{text:n,withIcon:!0}),t(oe,{label:o.length,status:s?X.Default:void 0})]}),t(Ie,{icon:r?an:nn,size:De.M,onClick:()=>c(e=>!e)})]}),r?t(g,{children:o.length?u.toArray(o):t(ke,{$padding:"12px 0",children:t(F,{})})}):null]})},Mo=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||G(e.supportedSignals).includes(a.signalType))):e,Lo=({option:e,formData:a,testResult:n,isSelected:o,onSelect:i})=>t(Eo,{icon:Re(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>i(),children:n&&t(oe,{status:n.succeeded?X.Success:X.Error,leftIcon:n.succeeded?on:ln})}),Vo=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:i}=U();return a?.length?t(Fo,{title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:a.map((a,n)=>t(Lo,{option:a,isSelected:o?.listType===e&&"number"!=typeof o?.unsavedIdx&&(null!=a.id&&""!==a.id?o?.option.id===a.id:o?.option.type===a.type),onSelect:()=>i({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t(Fo,{purpleColors:!0,title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:l},s)=>t(Lo,{option:a,formData:n,testResult:l,isSelected:o?.unsavedIdx===s&&o?.listType===e,onSelect:()=>i({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0};var Bo;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Bo||(Bo={}));const zo=(e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Bo.SELF_HOSTED?n.push(...e.items):e.name===Bo.MANAGED&&o.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=xe(n),o=e.items.findIndex(e=>e.type===t.type);if(-1!==o){const n=Oe(t.fields,{});Object.keys(n).length&&(e.items[o].fields=e.items[o].fields.map(e=>({...e,initialValue:n[e.name]})),a.push(e.items[o]))}}}),{[Ae.DETECTED]:a,[Ae.SELF_HOSTED]:n,[Ae.MANAGED]:o}},_o=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getDestinationCategories:d,getPotentialDestinations:u,initialInputs:p,testConnection:m,createDestination:h,updateDestination:g,withOverlay:b,disableAnimation:f})=>{const[y,v]=l(""),[C,S]=l({categoryType:null,signalType:null}),{destinations:w}=Pe(),{activeForm:k,genericForm:T,formErrorMessage:A,unsavedDestinations:N,setUnsavedDestinations:I}=U();n(()=>{p&&I(p)},[p]);const[D,E]=l(!0),[$,R]=l([]),[x,O]=l({[Ae.ALL]:[],[Ae.UNSAVED]:[],[Ae.EXISTS]:[],[Ae.DETECTED]:[],[Ae.SELF_HOSTED]:[],[Ae.MANAGED]:[]});n(()=>{const e=w.map(e=>{let t;for(const a of $){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const a=Oe(e.fields,{});return{id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:t?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:t?t.fields.map(e=>({...e,initialValue:a[e.name]??e.initialValue})):[]}});O(t=>({...t,[Ae.EXISTS]:e}))},[w,$]);const P=c(async()=>{try{E(!0);const[e,t]=await Promise.all([d(),u()]);e&&R(e.destinationCategories.categories),O(a=>({...a,...zo(e,t)}))}catch(e){}finally{E(!1)}},[]);n(()=>{P()},[]);const M=c(async()=>{const e=(await Promise.all(N.map(({option:e,formData:t})=>{const a=K(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(a.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e]))return g(e.id,a,i)}return h(a,i)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[N,i,h,g]),L=(({isFetching:e,destinationsByCategory:a,searchText:n,filters:o})=>{const{unsavedDestinations:i}=U();return{width:"40%",list:r(()=>{const l=[];i.length&&l.push(t(Vo,{listType:Ae.UNSAVED,unsavedDestinations:i},"unsaved"));for(const e of Object.values(Ae)){if(o.categoryType&&o.categoryType!==e)continue;const i=Mo(a[e],n,o);i.length&&l.push(t(Vo,{listType:e,destinationOptions:i},e))}return e&&l.push(t(ke,{children:t(Ee,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),l},[i,a,n,o,e])}})({isFetching:D,destinationsByCategory:x,searchText:y,filters:C}),V=(({testConnection:e})=>{const{activeForm:a}=U();return{width:"60%",list:a?[t(ro,{testConnection:e},a.option.type)]:[t(ke,{$height:"100%",children:t(F,{icon:tn,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}})({testConnection:m});return t(zn,{isOpen:!0,withOverlay:b,disableAnimation:f,onClose:e,onBack:a?()=>a(N):void 0,onNext:o?()=>o(N):void 0,nextIsSkip:!N.length,onSave:M,disableSave:!k&&!N.length,isFetching:D,errorMessage:A,isFormDirty:N.length>0||T?.isFormDirty,hideDirtyNote:!0,progress:{title:Te.CREATING_DESTINATION,subTitle:Te.CREATING_DESTINATION_SUBTITLE},header:{icon:tn,title:Te.ADD_DESTINATIONS,subTitle:Te.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:i&&s?{value:i,setValue:s}:void 0,search:{value:y,onChange:v},filters:t(xo,{destinationsByCategory:x,filters:C,setFilters:S}),leftColumn:L,rightColumn:V})},Uo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:i})=>{const[s,c]=l(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:b}=ne(),f=r(()=>s?Fe.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):Fe,[s]),y=r(()=>f.map(e=>{const a=p?.type===e.type;return t(Eo,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,f.length,m]),v=r(()=>p?[t(fo,{},p.type)]:[t(ke,{$height:"100%",children:t(F,{icon:sn,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(zn,{ref:u,isOpen:!0,withOverlay:i,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();return e?Promise.resolve({error:e}):await o(t)},disableSave:!p||!h?.isFormDirty,isFormDirty:h?.isFormDirty,hideDirtyNote:!0,errorMessage:b,progress:{title:Te.CREATING_INSTRUMENTATION_RULE,subTitle:Te.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:sn,title:Te.ADD_INSTRUMENTATION_RULE,subTitle:Te.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:s,onChange:c},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},jo=p.div``,Xo=p.div`
60
+ `,To=({title:a,tooltip:n,list:i,noBgColor:o,purpleColors:s})=>{const[r,c]=l(!0);return e(wo,{"data-id":`collapse-${a}`,$noBgColor:o,$purpleColors:s,children:[e(ko,{$isOpen:r,children:[e($,{$gap:10,children:[t(F,{size:z.XS,children:a}),n&&t(Q,{text:n,withIcon:!0}),t(le,{label:i.length,status:s?W.Default:void 0})]}),t(Re,{icon:r?_n:Bn,size:Oe.M,onClick:()=>c(e=>!e)})]}),r?t(b,{children:i.length?u.toArray(i):t($e,{$padding:"12px 0",children:t(L,{})})}):null]})},xo=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||K(e.supportedSignals).includes(a.signalType))):e,Ao=({option:e,formData:a,testResult:n,isSelected:i,onSelect:o})=>t(yo,{icon:Le(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:i,onClick:()=>o(),children:n&&t(le,{status:n.succeeded?W.Success:W.Error,leftIcon:n.succeeded?Xn:jn})}),Io=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:i,onChangeActiveForm:o}=j();return a?.length?t(To,{title:Me[e].TITLE,tooltip:Me[e].DESCRIPTION,list:a.map((a,n)=>t(Ao,{option:a,isSelected:i?.listType===e&&"number"!=typeof i?.unsavedIdx&&(null!=a.id&&""!==a.id?i?.option.id===a.id:i?.option.type===a.type),onSelect:()=>o({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t(To,{purpleColors:!0,title:Me[e].TITLE,tooltip:Me[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:l},s)=>t(Ao,{option:a,formData:n,testResult:l,isSelected:i?.unsavedIdx===s&&i?.listType===e,onSelect:()=>o({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0};var No;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(No||(No={}));const $o=(e,t)=>{const a=[],n=[],i=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===No.SELF_HOSTED?n.push(...e.items):e.name===No.MANAGED&&i.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=Fe(n),i=e.items.findIndex(e=>e.type===t.type);if(-1!==i){const n=ze(t.fields,{});Object.keys(n).length&&(e.items[i].fields=e.items[i].fields.map(e=>({...e,initialValue:n[e.name]})),a.push(e.items[i]))}}}),{[De.DETECTED]:a,[De.SELF_HOSTED]:n,[De.MANAGED]:i}},Do=({onClose:e,onBack:a,onNext:i,selectedConnectionIds:o,setSelectedConnectionIds:s,getDestinationCategories:d,getPotentialDestinations:u,initialInputs:p,testConnection:m,createDestination:h,updateDestination:g,withOverlay:b,disableAnimation:f})=>{const[y,v]=l(""),[S,C]=l({categoryType:null,signalType:null}),{destinations:w}=Ve(),{activeForm:k,genericForm:T,formErrorMessage:x,unsavedDestinations:A,setUnsavedDestinations:I}=j();n(()=>{p&&I(p)},[p]);const[N,$]=l(!0),[D,E]=l([]),[R,O]=l({[De.ALL]:[],[De.UNSAVED]:[],[De.EXISTS]:[],[De.DETECTED]:[],[De.SELF_HOSTED]:[],[De.MANAGED]:[]});n(()=>{const e=w.map(e=>{let t;for(const a of D){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const a=ze(e.fields,{});return{id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:t?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:t?t.fields.map(e=>({...e,initialValue:a[e.name]??e.initialValue})):[]}});O(t=>({...t,[De.EXISTS]:e}))},[w,D]);const P=c(async()=>{try{$(!0);const[e,t]=await Promise.all([d(),u()]);e&&E(e.destinationCategories.categories),O(a=>({...a,...$o(e,t)}))}catch(e){}finally{$(!1)}},[]);n(()=>{P()},[]);const M=c(async()=>{const e=(await Promise.all(A.map(({option:e,formData:t})=>{const a=q(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(a.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e]))return g(e.id,a,o)}return h(a,o)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[A,o,h,g]),F=(({isFetching:e,destinationsByCategory:a,searchText:n,filters:i})=>{const{unsavedDestinations:o}=j();return{width:"40%",list:r(()=>{const l=[];o.length&&l.push(t(Io,{listType:De.UNSAVED,unsavedDestinations:o},"unsaved"));for(const e of Object.values(De)){if(i.categoryType&&i.categoryType!==e)continue;const o=xo(a[e],n,i);o.length&&l.push(t(Io,{listType:e,destinationOptions:o},e))}return e&&l.push(t($e,{$height:"100%",children:t(Pe,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),l},[o,a,n,i,e])}})({isFetching:N,destinationsByCategory:R,searchText:y,filters:S}),z=(({testConnection:e})=>{const{activeForm:a}=j();return{width:"60%",list:a?[t(qi,{testConnection:e},a.option.type)]:[t($e,{$height:"100%",children:t(L,{icon:Vn,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}})({testConnection:m});return t(Ai,{isOpen:!0,withOverlay:b,disableAnimation:f,onClose:e,onBack:a?()=>a(A):void 0,onNext:i?()=>i(A):void 0,nextIsSkip:!A.length,onSave:M,disableSave:!k&&!A.length,isFetching:N,errorMessage:x,isFormDirty:A.length>0||T?.isFormDirty,hideDirtyNote:!0,progress:{title:ue.CREATING_DESTINATION,subTitle:ue.CREATING_DESTINATION_SUBTITLE},header:{icon:Vn,title:ue.ADD_DESTINATIONS,subTitle:ue.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:o&&s?{value:o,setValue:s}:void 0,search:{value:y,onChange:v},filters:t(Co,{destinationsByCategory:R,filters:S,setFilters:C}),leftColumn:F,rightColumn:z})},Eo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:i,withOverlay:o})=>{const[s,c]=l(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:b}=oe(),f=r(()=>s?_e.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):_e,[s]),y=r(()=>f.map(e=>{const a=p?.type===e.type;return t(yo,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,f.length,m]),v=r(()=>p?[t(no,{},p.type)]:[t($e,{$height:"100%",children:t(L,{icon:Un,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(Ai,{ref:u,isOpen:!0,withOverlay:o,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();return e?Promise.resolve({error:e}):await i(t)},disableSave:!p||!h?.isFormDirty,isFormDirty:h?.isFormDirty,hideDirtyNote:!0,errorMessage:b,progress:{title:ue.CREATING_INSTRUMENTATION_RULE,subTitle:ue.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:Un,title:ue.ADD_INSTRUMENTATION_RULE,subTitle:ue.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:s,onChange:c},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},Ro=p.div``,Oo=p.div`
61
61
  visibility: hidden;
62
62
 
63
63
  transition: visibility 0s;
@@ -65,19 +65,19 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
65
65
  transition-duration: 0s;
66
66
  }
67
67
 
68
- ${jo}:hover & {
68
+ ${Ro}:hover & {
69
69
  visibility: visible;
70
70
  }
71
- `,Ho=({workloadName:e,workloadKind:a,isChecked:n,onToggle:o,disabled:i,disabledReason:l})=>{const s=m(),r=()=>{};return t(jo,{children:t(Eo,{dataId:`source-${e}`,title:e,disabled:i,onClick:i?r:o,isChecked:n,onCheckboxChange:i?r:o,children:i&&l?t(oe,{label:l,status:X.Default,textSize:L.XXXS}):t(Xo,{children:t(oe,{label:a,status:X.Info,textSize:L.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},Wo=p.div``,Go=p.div`
71
+ `,Po=({workloadName:e,workloadKind:a,isChecked:n,onToggle:i,disabled:o,disabledReason:l})=>{const s=m(),r=()=>{};return t(Ro,{children:t(yo,{dataId:`source-${e}`,title:e,disabled:o,onClick:o?r:i,isChecked:n,onCheckboxChange:o?r:i,children:o&&l?t(le,{label:l,status:W.Default,textSize:z.XXXS}):t(Oo,{children:t(le,{label:a,status:W.Info,textSize:z.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},Mo=p.div``,Lo=p.div`
72
72
  visibility: ${({$visible:e})=>e?"visible":"hidden"};
73
73
 
74
74
  transition: visibility 0s;
75
75
  ${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
76
76
 
77
- ${Wo}:hover & {
77
+ ${Mo}:hover & {
78
78
  visibility: visible;
79
79
  }
80
- `,Ko=({clusterId:a,namespaceName:n,checkbox:o,isFutureApps:i,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const d=m(),u=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Wo,{children:t(Eo,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:o.partial,isChecked:o.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(D,{$gap:12,children:[t(Go,{$visible:s||i,children:t(q,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(T,{label:"Auto",size:_e.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(D,{$gap:8,children:[t(M,{variant:Ue.Span,size:L.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(oe,{label:`${l.sourced}/${l.total}`,status:s?X.Default:Be.Unknown,minWidth:"42px"})]})]})})})},Yo=({withCollapse:e,clusterId:a,clusterName:n,namespaces:o,selectedArea:i,setSelectedArea:l,handleSourceChange:s})=>{const c=r(()=>o.map(({name:e,totalWorkloads:o,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Ko,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:o},isActive:i.clusterId===a&&i.namespaceName===e,onActive:()=>l({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,o,i]);return e?t(Fo,{title:n,list:c,noBgColor:!0}):c},qo=({onClose:a,onBack:o,onNext:i,selectedConnectionIds:s,setSelectedConnectionIds:c,persistSources:d,getAllClusterSnapshots:u,fetchNamespacesWithWorkloads:p,withOverlay:h,disableAnimation:g})=>{const b=m(),{progress:f,resetProgress:y}=He(),{isFetching:v,setIsFetching:C,setSnapshots:S,formData:w,handleSourceChange:k,handleSelectAll:A,formDiff:N,isFormDirty:I}=We();n(()=>{let e=!1;C(!0);return(async()=>{try{if(u){const t=await u();!e&&t&&S(t)}else if(p){const t=await p();if(!e&&t.data?.length){const e={clusters:[{clusterId:qe,clusterName:Ye,namespaces:t.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]};S(e)}}}catch(e){}finally{e||C(!1)}})(),()=>{e=!0}},[]);const[E,$]=l(""),[R,x]=l(Ge.Namespace),[O,P]=l({showOnlySelected:!1}),[V,B]=l({clusterId:"",clusterName:"",namespaceName:""}),z=(({isFetching:a,formData:n,handleSourceChange:o,handleSelectAll:i,selectedArea:l,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const p=r(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>je(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Xe(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=r(()=>{let e=!1;for(const{visibleNamespaces:t}of p)for(const{totalWorkloads:a,selectedCount:n}of t)if(e=!0,n!==a)return!1;return e},[p]),{list:h,withFilterCount:g,filteredCount:b,totalCount:f}=r(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(Yo,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:l,setSelectedArea:s,handleSourceChange:o},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[p,l]);return{width:"60%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(M,{size:L.XS,nowrap:!0,children:"Namespaces"}),t(q,{text:g?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${g?`${b} / ${f}`:f}`,status:Be.Unknown})})]}),t(M,{"data-id":"namespaces-select-all",onClick:()=>i({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!h.length,size:L.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t(ke,{$height:"100%",children:t(Ee,{title:Te.FETCHING_NAMESPACES,subTitle:Te.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[t(ke,{$height:"100%",children:t(F,c?{icon:cn,title:"No matches",subTitle:`No namespace matched the filter '${c}'`}:{icon:cn,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}})({isFetching:v,formData:w,handleSourceChange:k,handleSelectAll:A,selectedArea:V,setSelectedArea:B,searchText:R===Ge.Namespace?E:"",searchBy:R,filters:O}),_=(({formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,searchText:l,searchBy:s,filters:c})=>{const{tier:d}=Me(),u=d===ze.Onprem,p=r(()=>i.value.namespaceName?a.find(({clusterId:e})=>e===i.value.clusterId)?.namespaces.find(({name:e})=>e===i.value.namespaceName):void 0,[a,i.value.clusterId,i.value.namespaceName]),m=r(()=>p?[...p.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Le(e,l,c)):[],[p,l,c]),h=r(()=>!!m.length&&m.every(({selected:e})=>e),[m]),g=r(()=>{if(!p)return[];const{clusterId:e}=i.value,{name:a}=p;return m.map(({name:o,selected:i,kind:l})=>{const s=!u&&Ve.has(l);return t(Ho,{workloadName:o,workloadKind:l,isChecked:!s&&(i||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:a,name:o,kind:l}}),disabled:s,disabledReason:"Enterprise only"},`${e}#${a}#${o}#${l}`)})},[m,p,i.value.clusterId]),{withFilterCount:b,filteredCount:f,totalCount:y}=r(()=>{const e=p?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,p]);return{width:"40%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(M,{size:L.XS,nowrap:!0,children:i.value.namespaceName?`${i.value.namespaceName} > Workloads`:"Workloads"}),t(q,{text:b?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${b?`${f} / ${y}`:y}`,status:Be.Unknown})})]}),t(M,{"data-id":"workloads-select-all",onClick:()=>o({clusterId:i.value.clusterId,namespaceName:i.value.namespaceName,boolean:!h,searchText:l,searchBy:s,filters:c}),disabled:!g.length,size:L.XS,children:(h?"Unselect":"Select")+" all"})]}),list:g.length?g:[t(ke,{$height:"100%",children:t(F,p?l?{icon:rn,title:"No matches",subTitle:`No sources matched the filter '${l}'`}:{icon:rn,title:"No sources",subTitle:"No sources found in this namespace"}:{icon:rn,title:Te.SELECT_NAMESPACE,subTitle:Te.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}})({formData:w,handleSourceChange:k,handleSelectAll:A,selectedArea:{value:V},searchText:R===Ge.Source?E:"",searchBy:R,filters:O});return t(zn,{isOpen:!0,withOverlay:h,disableAnimation:g,onClose:a?()=>{y(Ke.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(N):void 0,onNext:i?()=>i(N):void 0,nextIsSkip:!I,onSave:()=>d(N),header:{icon:rn,title:Te.ADD_SOURCE,subTitle:Te.ADD_SOURCES_DESCRIPTION},connectionIds:s&&c?{value:s,setValue:c}:void 0,search:{value:E,onChange:e=>{$(e),R===Ge.Namespace&&B({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ge.Namespace},{label:"Source",value:Ge.Source}],selected:R,setSelected:x}},filters:e(D,{$gap:8,children:[t(M,{size:L.XXXS,color:b.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{name:"filter-selected",size:_e.S,label:"Selected",value:O.showOnlySelected,onChange:e=>P(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:I,isFetching:v,progress:{title:Te.CREATING_SOURCES,subTitle:Te.CREATING_SOURCES_SUBTITLE,percentage:f[Ke.BulkInstrumenting]?.percentage||0},leftColumn:z,rightColumn:_})},Jo=({onClose:o,actionId:i,updateAction:s,deleteAction:d})=>{const u=m(),{actions:p}=Pe(),{selectedOption:h,loadAction:b,validateFormData:f,errorMessage:y,genericForm:v}=P(),[C,S]=l(!1),[w,T]=l(!1),[A,N]=l(null),I=C&&!!v?.isFormDirty,D=r(()=>p?.find(e=>Je(e)===i),[i,p]),E=r(()=>Se.find(({type:e})=>e===D?.type)??we.find(({type:e})=>e===D?.type)??null,[D?.type]);n(()=>{D&&b(D)},[D]);const $=c(()=>{D&&S(!0)},[D]),x=c(()=>{D&&(b(D),S(!1))},[D,b]),F=c(()=>{I?N("close"):o()},[I,o]),M=c(()=>{I?N("cancel"):x()},[I,x]),L=c(()=>{const e=A;N(null),"close"===e?(x(),o()):x()},[A,x,o]),V=c(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=f();e||(await s(D.id,t),S(!1))}},[D,f,s]),B=c(()=>{D&&T(!0)},[D]),z=c(async()=>{D&&(await d(D.id,D.type),o())},[D,d,o]);if(!D||!E)return null;const _=(e=>{const t=[],{type:a,fields:n}=e,o=e=>({status:e?X.Success:Be.Unknown,label:e?"True":"False",invertColors:!0});return a===O.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:o(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:o(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:o(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:o(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:a,from:o,fromSources:i},l)=>{const s=i?.length?i.join(", "):o||k.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:a,from:o,fromSources:i},l)=>{const s=i?.length?i.join(", "):o||k.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),a===O.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:o(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:a},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:a})})),a===O.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,a)=>{t.push({id:`del-attr-${a}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,a],n)=>{t.push({id:`rename-${n}`,title:e,label:a})}),a===O.PiiMasking&&n.piiCategories?.forEach((e,a)=>{t.push({id:`pii-${a}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.ErrorSampler&&t.push({id:"fallbackSamplingRatio",title:"Sampling Ratio",label:String(n.fallbackSamplingRatio??"-")}),a===O.ProbabilisticSampler&&t.push({id:"samplingPercentage",title:"Sampling Percentage",label:String(n.samplingPercentage??"-")}),a===O.LatencySampler&&n.endpointsFilters?.forEach(({serviceName:e,httpRoute:a,minimumLatencyThreshold:o,fallbackSamplingRatio:i},l)=>{const s=(n.endpointsFilters?.length??0)>1?`Endpoint #${l+1} `:"Endpoint ";t.push({id:`endpoint-${l}-service`,title:`${s}Service Name`,label:e}),t.push({id:`endpoint-${l}-route`,title:`${s}HTTP Route`,label:a}),t.push({id:`endpoint-${l}-latency`,title:`${s}Min. Latency`,label:String(o)}),t.push({id:`endpoint-${l}-fallback`,title:`${s}Fallback Sampling Ratio`,label:String(i)})}),a===O.ServiceNameSampler&&n.servicesNameFilters?.forEach(({serviceName:e,samplingRatio:a,fallbackSamplingRatio:o},i)=>{const l=(n.servicesNameFilters?.length??0)>1?`Filter #${i+1} `:"Filter ";t.push({id:`service-${i}-name`,title:`${l}Service Name`,label:e}),t.push({id:`service-${i}-ratio`,title:`${l}Sampling Ratio`,label:String(a)}),t.push({id:`service-${i}-fallback`,title:`${l}Fallback Sampling Ratio`,label:String(o)})}),a===O.SpanAttributeSampler&&n.attributeFilters?.forEach(({serviceName:e,attributeKey:a,fallbackSamplingRatio:o,condition:i},l)=>{const s=Object.keys(i)[0],r=i[s],c=(n.attributeFilters?.length??0)>1?`Filter #${l+1} `:"Filter ";t.push({id:`attr-${l}-service`,title:`${c}Service Name`,label:e}),t.push({id:`attr-${l}-key`,title:`${c}Attribute Key`,label:a}),t.push({id:`attr-${l}-fallback`,title:`${c}Fallback Sampling Ratio`,label:String(o)}),t.push({id:`attr-${l}-condition`,title:`${c}Condition`,label:s}),t.push({id:`attr-${l}-operation`,title:`${c}Operation`,label:r?.operation??"-"}),t.push({id:`attr-${l}-expected`,title:`${c}Expected Value`,label:String(r?.expectedValue??"-")}),"jsonCondition"===s&&t.push({id:`attr-${l}-jsonpath`,title:`${c}JSON Path`,label:r?.jsonPath??"-"})}),a===O.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,a)=>{const o=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${a+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${a}-ns`,title:`${o}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,i)=>{const l=[n.kind,n.name].filter(Boolean).join("/");l&&t.push({id:`group-${a}-wf-${i}`,title:`${o}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${a}-templates`,title:`${o}Templates`,label:i}),e.notes&&t.push({id:`group-${a}-notes`,title:`${o}Notes`,label:e.notes})}),t})(D);return e(a,{children:[t(Qe,{isOpen:!0,header:{icon:nt(D.type),title:E.label,onClose:F,actions:[{id:"edit-action-btn-edit",label:Ze.EDIT,icon:qa,active:C,onClick:$},{id:"edit-action-btn-delete",label:Ze.DELETE,icon:Xa,color:u.v2.colors.red[500],active:w,onClick:B}]},footer:{note:C&&y?{status:X.Error,message:y}:void 0,actions:C?[{"data-id":"edit-action-btn-cancel",label:Ze.CANCEL,variant:R.Secondary,onClick:M},{"data-id":"edit-action-btn-save",label:Ze.SAVE,variant:R.Primary,onClick:V}]:[]},children:t(et,{$padding:"4px 12px 12px",children:C&&h?t(io,{}):t(g,{$gap:16,children:e(tt,{bgTint:"1000",children:[e(tt,{bgTint:"900",children:[t(at,{conditions:D.conditions||[]}),t(tt,{bgTint:"800",cellsPerRow:2,items:(U=D,j=E,[{id:"type",title:Te.TYPE,label:j.label},{id:"status",title:Te.STATUS,badge:{status:U.disabled?Be.Unknown:X.Success,label:U.disabled?Te.DISABLED:Te.ENABLED}},{id:"signals",title:Te.SIGNALS_FOR_PROCESSING,label:U.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:U.name||"-"},{id:"notes",title:Te.NOTES,label:U.notes||"-"}])})]}),!!_?.length&&t(tt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(tt,{bgTint:"800",cellsPerRow:2,items:_})})]})})})}),t(_n,{target:"action",isOpen:w,onClose:()=>T(!1),onApprove:z}),t(Un,{isOpen:null!==A,onClose:()=>N(null),onApprove:L})]});var U,j},Qo=({onClose:a,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=m(),[p,h]=l(""),[g,b]=l({showOnlySelected:!1}),f=r(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&a}),[o.length,i.length,p,g]),y=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,C]=l(!1),[S,w]=l(void 0),{formData:k,handleFormChange:A,areFormValuesEqual:N,resetFormData:I}=ot(S||{rollout:{automaticRolloutDisabled:!1}}),E=r(()=>i.length>1||void 0!==S&&!N(S,k),[i.length,S,k]);return n(()=>{1===i.length?(async e=>{if(v)return;C(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};w(e),I(e)}C(!1)})(i[0]):w(void 0)},[i.length]),t(zn,{isOpen:!0,onClose:a,onSave:()=>d(k,i),header:{icon:dn,title:"Cluster Configuration"},connectionIds:{value:i,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(D,{$gap:8,children:[t(M,{size:L.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{size:_e.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:E,isFetching:v,leftColumn:{width:"35%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(M,{size:L.XS,children:"Clusters"}),t(oe,{label:f.length,status:Be.Unknown})]}),e(D,{$gap:8,children:[t(M,{size:L.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(oe,{label:`${i.length}/${f.length}`,status:Be.Unknown})]})]}),list:f.map(e=>t(Eo,{title:e.name,isChecked:i.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(M,{size:L.XS,children:"Configurations"}),list:[t(T,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:k.rollout?.automaticRolloutDisabled||!1,onChange:e=>A("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Zo=({onClose:o,destinationId:i,getDestinationCategories:s,testConnection:u,updateDestination:p,deleteDestination:h})=>{const b=m(),{destinations:f}=Pe(),{selectedStreamName:y}=lt(),{activeForm:v,loadDestination:C,validateFormData:S,formErrorMessage:w,genericForm:k}=U(),T=d(null),[A,N]=l(!1),[I,D]=l(!1),[E,$]=l(null),[O,P]=l(!0),[F,M]=l(null),L=A&&!!k?.isFormDirty,V=r(()=>st(f,y),[f,y]),B=r(()=>V?.find(e=>Je(e)===i),[i,V]);n(()=>{let e=!1;return P(!0),s().then(t=>{e||$(t?.destinationCategories.categories??[])}).catch(t=>{e||$([])}).finally(()=>{e||P(!1)}),()=>{e=!0}},[]),n(()=>{B&&E&&C(B,E)},[B,E]);const z=r(()=>B&&E?rt(E,B):[],[B,E]),j=c(()=>{B&&N(!0)},[B]),H=c(()=>{B&&E&&(C(B,E),N(!1))},[B,E,C]),G=c(()=>{L?M("close"):o()},[L,o]),Y=c(()=>{L?M("cancel"):H()},[L,H]),q=c(()=>{const e=F;M(null),"close"===e?(H(),o()):H()},[F,H,o]),J=c(async()=>{if(B){const{errorMessage:e,preparedFormData:t}=S();e||(await p(B.id,K(t)),N(!1))}},[B,S,p]),Q=c(()=>{B&&D(!0)},[B]),Z=c(async()=>{B&&(await h(B.id),o())},[B,h,o]);if(!B)return null;const{icon:ee,iconSrc:te}=Re(B.destinationType.type),ae=((e,t)=>{const a=[],n=it(e,t),o=n.map(e=>({name:e.key,value:e.value})),i=W(e.exportedSignals);let l=[];const s=()=>{l.length&&(a.push({kind:"cells",id:`cells-${a.length}`,items:l}),l=[])};return n.forEach(({key:e,name:n,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:m,customReadDataLabels:h}=c||{};if(m?.length&&_(m,i,o))return;const{type:g}=Oe(p,{type:""}),b=d||"password"===g;if(h?.length)h.forEach(({condition:t,...a},n)=>{t==r&&l.push({id:`${e}-custom-${n}`,title:a.title,label:a.value})});else if(r)if(b)l.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(u===x.MultiInput){const t=Oe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"list",id:e,title:n,items:t.map((t,a)=>({id:`${e}-${a}`,label:String(t)}))})}if(u===x.KeyValuePair){const t=Oe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"pairs",id:e,title:n,items:t.map((t,a)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${a}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}l.push({id:e,title:n,label:r})}else l.push({id:e,title:n,label:"-"})}),s(),a})(B,z);return e(a,{children:[t(Qe,{isOpen:!0,header:{icon:ee,iconSrc:te,title:B.name||B.destinationType.displayName,onClose:G,actions:[{id:"edit-destination-btn-edit",label:Ze.EDIT,icon:qa,active:A,onClick:j},{id:"edit-destination-btn-delete",label:Ze.DELETE,icon:Xa,color:b.v2.colors.red[500],active:I,onClick:Q}]},footer:{note:A&&w?{status:X.Error,message:w}:void 0,actions:A?[{"data-id":"edit-destination-btn-cancel",label:Ze.CANCEL,variant:R.Secondary,onClick:Y},...v?.option.testConnectionSupported?[{"data-id":"edit-destination-btn-test-connection",label:Ze.TEST_CONNECTION,variant:R.Secondary,onClick:()=>T.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:Ze.SAVE,variant:R.Primary,onClick:J}]:[]},children:t(et,{$padding:"4px 12px 12px",children:O?t(ke,{$height:"50vh",children:t(Ee,{withSpinner:!0})}):A&&v?t(ro,{ref:T,isEdit:!0,testConnection:u}):t(g,{$gap:16,children:e(tt,{bgTint:"1000",children:[e(tt,{bgTint:"900",children:[t(at,{conditions:B.conditions||[]}),t(tt,{bgTint:"800",cellsPerRow:2,items:(ne=B,[{id:"type",title:Te.TYPE,label:ne.destinationType.displayName},{id:"status",title:Te.STATUS,badge:{status:ne.disabled?Be.Unknown:X.Success,label:ne.disabled?Te.DISABLED:Te.ENABLED}},{id:"monitors",title:Te.MONITORS,label:W(ne.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:ne.name||"-"}])})]}),!!ae.length&&t(tt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:ae.map(e=>"cells"===e.kind?t(tt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(tt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(_n,{target:"destination",isOpen:I,onClose:()=>D(!1),onApprove:Z}),t(Un,{isOpen:null!==F,onClose:()=>M(null),onApprove:q})]});var ne},ei=({onClose:o,ruleId:i,updateInstrumentationRule:s,deleteInstrumentationRule:d})=>{const u=m(),{instrumentationRules:p}=Pe(),{addNotification:h}=dt(),{selectedOption:b,loadRule:f,validateFormData:y,errorMessage:v,genericForm:C}=ne(),[S,w]=l(!1),[k,T]=l(!1),[A,N]=l(null),I=S&&!!C?.isFormDirty,E=r(()=>p?.find(e=>Je(e)===i),[i,p]),$=r(()=>Fe.find(({type:e})=>e===E?.type)??null,[E?.type]);n(()=>{E&&f(E)},[E]);const x=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:ut.FORBIDDEN,message:ut.CANNOT_EDIT_RULE,crdType:Ge.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});w(!0)}},[E,h]),O=c(()=>{E&&(f(E),w(!1))},[E,f]),P=c(()=>{I?N("close"):o()},[I,o]),F=c(()=>{I?N("cancel"):O()},[I,O]),V=c(()=>{const e=A;N(null),"close"===e?(O(),o()):O()},[A,O,o]),B=c(async()=>{if(E){const{errorMessage:e,preparedFormData:t}=y();e||(await s(E.ruleId,t),w(!1))}},[E,y,s]),z=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:ut.FORBIDDEN,message:ut.CANNOT_DELETE_RULE,crdType:Ge.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});T(!0)}},[E,h]),_=c(async()=>{E&&(await d(E.ruleId),o())},[E,d,o]);if(!E||!$)return null;const U=((e,a)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,a])=>{a&&n.push(t(M,{size:L.XS,children:`• ${ct(e).toLowerCase()}`},e))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,a])=>{a&&n.push(t(M,{size:L.XS,children:`• ${ct(e).toLowerCase()}`},e))}),e.headersCollection?.[J.HeaderKeys]?.length&&e.headersCollection[J.HeaderKeys].forEach(e=>{e&&n.push(t(M,{size:L.XS,children:e},e))}),e.customInstrumentations&&(e.customInstrumentations[te.Java]?.forEach((e,o)=>{const i=new ee(e.className,e.methodName);if(i.Verify()){0===o&&n.push(t(M,{size:L.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();n.push(t(M,{size:L.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}}),e.customInstrumentations[te.Golang]?.forEach((e,o)=>{const i=new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===o&&n.push(t(M,{size:L.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();n.push(t(M,{size:L.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}})),n})(E,u);return e(a,{children:[t(Qe,{isOpen:!0,header:{icon:mt(E.type),title:$.label,onClose:P,actions:[{id:"edit-rule-btn-edit",label:Ze.EDIT,icon:qa,active:S,onClick:x},{id:"edit-rule-btn-delete",label:Ze.DELETE,icon:Xa,color:u.v2.colors.red[500],active:k,onClick:z}]},footer:{note:S&&v?{status:X.Error,message:v}:void 0,actions:S?[{"data-id":"edit-rule-btn-cancel",label:Ze.CANCEL,variant:R.Secondary,onClick:F},{"data-id":"edit-rule-btn-save",label:Ze.SAVE,variant:R.Primary,onClick:B}]:[]},children:t(et,{$padding:"4px 12px 12px",children:S&&b?t(fo,{}):t(g,{$gap:16,children:e(tt,{bgTint:"1000",children:[e(tt,{bgTint:"900",children:[t(at,{conditions:E.conditions||[]}),t(tt,{bgTint:"800",cellsPerRow:2,items:(j=E,H=$,[{id:"type",title:Te.TYPE,label:H.label},{id:"status",title:Te.STATUS,badge:{status:j.disabled?Be.Unknown:X.Success,label:j.disabled?Te.DISABLED:Te.ENABLED}},{id:"name",title:Te.NAME,label:j.ruleName||"-"},{id:"profile",title:Te.MANAGED_BY_PROFILE,label:j.profileName||"-"},{id:"notes",title:Te.NOTES,label:j.notes||"-"}])})]}),!!U.length&&t(tt,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(tt,{bgTint:"800",children:U})}),!!$.supportedLanguages.length&&t(tt,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(tt,{bgTint:"800",children:t(D,{$gap:12,$wrap:"wrap",children:$.supportedLanguages.map(e=>t(pt,{label:ie[e],leftIcon:le(e),flex:"0.5"},e))})})})]})})})}),t(_n,{target:"instrumentation rule",isOpen:k,onClose:()=>T(!1),onApprove:_}),t(Un,{isOpen:null!==A,onClose:()=>N(null),onApprove:V})]});var j,H},ti=p.div`
80
+ `,Fo=({clusterId:a,namespaceName:n,checkbox:i,isFutureApps:o,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const d=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Mo,{children:t(yo,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:i.partial,isChecked:i.all,onCheckboxChange:e=>d({auto:e,all:e}),children:e($,{$gap:12,children:[t(Lo,{$visible:s||o,children:t(Q,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(x,{label:"Auto",size:He.S,value:o,onChange:e=>d({auto:e,all:e||void 0})})})}),e($,{$gap:8,children:[t(F,{variant:Ge.Span,size:z.XXXS,color:Y.Secondary,align:"right",children:"Selected"}),t(le,{label:`${l.sourced}/${l.total}`,status:s?W.Default:Ue.Unknown,minWidth:"42px"})]})]})})})},zo=({withCollapse:e,clusterId:a,clusterName:n,namespaces:i,selectedArea:o,setSelectedArea:l,handleSourceChange:s})=>{const c=r(()=>i.map(({name:e,totalWorkloads:i,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Fo,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:i},isActive:o.clusterId===a&&o.namespaceName===e,onActive:()=>l({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,i,o]);return e?t(To,{title:n,list:c,noBgColor:!0}):c},Vo=({onClose:a,onBack:i,onNext:o,selectedConnectionIds:s,setSelectedConnectionIds:c,persistSources:d,getAllClusterSnapshots:u,fetchNamespacesWithWorkloads:p,withOverlay:m,disableAnimation:h})=>{const{progress:g,resetProgress:b}=Ye(),{isFetching:f,setIsFetching:y,setSnapshots:v,formData:S,handleSourceChange:C,handleSelectAll:w,formDiff:k,isFormDirty:T}=Je();n(()=>{let e=!1;y(!0);return(async()=>{try{if(u){const t=await u();!e&&t&&v(t)}else if(p){const t=await p();if(!e&&t.data?.length){const e={clusters:[{clusterId:tt,clusterName:et,namespaces:t.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]};v(e)}}}catch(e){}finally{e||y(!1)}})(),()=>{e=!0}},[]);const[A,I]=l(""),[N,D]=l(Qe.Namespace),[E,R]=l({showOnlySelected:!1}),[O,P]=l({clusterId:"",clusterName:"",namespaceName:""}),M=(({isFetching:a,formData:n,handleSourceChange:i,handleSelectAll:o,selectedArea:l,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const p=r(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ke(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...qe(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=r(()=>{let e=!1;for(const{visibleNamespaces:t}of p)for(const{totalWorkloads:a,selectedCount:n}of t)if(e=!0,n!==a)return!1;return e},[p]),{list:h,withFilterCount:g,filteredCount:b,totalCount:f}=r(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(zo,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:l,setSelectedArea:s,handleSourceChange:i},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[p,l]);return{width:"60%",header:e($,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e($,{$gap:8,children:[t(F,{size:z.XS,nowrap:!0,children:"Namespaces"}),t(Q,{text:g?ue.FILTERED_COUNT_TOOLTIP:void 0,children:t(le,{label:`${g?`${b} / ${f}`:f}`,status:Ue.Unknown})})]}),t(F,{"data-id":"namespaces-select-all",onClick:()=>o({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!h.length,size:z.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t($e,{$height:"100%",children:t(Pe,{title:ue.FETCHING_NAMESPACES,subTitle:ue.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[t($e,{$height:"100%",children:t(L,c?{icon:Hn,title:"No matches",subTitle:`No namespace matched the filter '${c}'`}:{icon:Hn,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}})({isFetching:f,formData:S,handleSourceChange:C,handleSelectAll:w,selectedArea:O,setSelectedArea:P,searchText:N===Qe.Namespace?A:"",searchBy:N,filters:E}),V=(({formData:a,handleSourceChange:n,handleSelectAll:i,selectedArea:o,searchText:l,searchBy:s,filters:c})=>{const{tier:d}=Be(),u=d===We.Onprem,p=r(()=>o.value.namespaceName?a.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.value.namespaceName):void 0,[a,o.value.clusterId,o.value.namespaceName]),m=r(()=>p?[...p.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Xe(e,l,c)):[],[p,l,c]),h=r(()=>!!m.length&&m.every(({selected:e})=>e),[m]),g=r(()=>{if(!p)return[];const{clusterId:e}=o.value,{name:a}=p;return m.map(({name:i,selected:o,kind:l})=>{const s=!u&&je.has(l);return t(Po,{workloadName:i,workloadKind:l,isChecked:!s&&(o||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:a,name:i,kind:l}}),disabled:s,disabledReason:"Enterprise only"},`${e}#${a}#${i}#${l}`)})},[m,p,o.value.clusterId]),{withFilterCount:b,filteredCount:f,totalCount:y}=r(()=>{const e=p?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,p]);return{width:"40%",header:e($,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e($,{$gap:8,children:[t(F,{size:z.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),t(Q,{text:b?ue.FILTERED_COUNT_TOOLTIP:void 0,children:t(le,{label:`${b?`${f} / ${y}`:y}`,status:Ue.Unknown})})]}),t(F,{"data-id":"workloads-select-all",onClick:()=>i({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!h,searchText:l,searchBy:s,filters:c}),disabled:!g.length,size:z.XS,children:(h?"Unselect":"Select")+" all"})]}),list:g.length?g:[t($e,{$height:"100%",children:t(L,p?l?{icon:Wn,title:"No matches",subTitle:`No sources matched the filter '${l}'`}:{icon:Wn,title:"No sources",subTitle:"No sources found in this namespace"}:{icon:Wn,title:ue.SELECT_NAMESPACE,subTitle:ue.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}})({formData:S,handleSourceChange:C,handleSelectAll:w,selectedArea:{value:O},searchText:N===Qe.Source?A:"",searchBy:N,filters:E});return t(Ai,{isOpen:!0,withOverlay:m,disableAnimation:h,onClose:a?()=>{b(Ze.BulkInstrumenting),a()}:void 0,onBack:i?()=>i(k):void 0,onNext:o?()=>o(k):void 0,nextIsSkip:!T,onSave:()=>d(k),header:{icon:Wn,title:ue.ADD_SOURCE,subTitle:ue.ADD_SOURCES_DESCRIPTION},connectionIds:s&&c?{value:s,setValue:c}:void 0,search:{value:A,onChange:e=>{I(e),N===Qe.Namespace&&P({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Qe.Namespace},{label:"Source",value:Qe.Source}],selected:N,setSelected:D}},filters:e($,{$gap:8,children:[t(F,{size:z.XXXS,color:Y.Secondary,nowrap:!0,children:"Show only:"}),t(x,{name:"filter-selected",size:He.S,label:"Selected",value:E.showOnlySelected,onChange:e=>R(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:T,isFetching:f,progress:{title:ue.CREATING_SOURCES,subTitle:ue.CREATING_SOURCES_SUBTITLE,percentage:g[Ze.BulkInstrumenting]?.percentage||0},leftColumn:M,rightColumn:V})},_o=({onClose:i,actionId:o,updateAction:s,deleteAction:d})=>{const u=m(),{actions:p}=Ve(),{selectedOption:h,loadAction:g,validateFormData:f,errorMessage:y,genericForm:v}=M(),[S,C]=l(!1),[w,k]=l(!1),[x,A]=l(null),I=S&&!!v?.isFormDirty,N=r(()=>p?.find(e=>at(e)===o),[o,p]),$=r(()=>Ie.find(({type:e})=>e===N?.type)??Ne.find(({type:e})=>e===N?.type)??null,[N?.type]);n(()=>{N&&g(N)},[N]);const D=c(()=>{N&&C(!0)},[N]),E=c(()=>{N&&(g(N),C(!1))},[N,g]),O=c(()=>{I?A("close"):i()},[I,i]),L=c(()=>{I?A("cancel"):E()},[I,E]),F=c(()=>{const e=x;A(null),"close"===e?(E(),i()):E()},[x,E,i]),z=c(async()=>{if(N){const{errorMessage:e,preparedFormData:t}=f();e||(await s(N.id,t),C(!1))}},[N,f,s]),V=c(()=>{N&&k(!0)},[N]),_=c(async()=>{N&&(await d(N.id,N.type),i())},[N,d,i]);if(!N||!$)return null;const B=(e=>{const t=[],{type:a,fields:n}=e,i=e=>({status:e?W.Success:Ue.Unknown,label:e?"True":"False",invertColors:!0});return a===P.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:i(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:i(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:i(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:i(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:a,from:i,fromSources:o},l)=>{const s=o?.length?o.join(", "):i||T.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:a,from:i,fromSources:o},l)=>{const s=o?.length?o.join(", "):i||T.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),a===P.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:i(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:a},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:a})})),a===P.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,a)=>{t.push({id:`del-attr-${a}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${a+1}`:""),label:e})}),a===P.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,a],n)=>{t.push({id:`rename-${n}`,title:e,label:a})}),a===P.PiiMasking&&n.piiCategories?.forEach((e,a)=>{t.push({id:`pii-${a}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${a+1}`:""),label:e})}),a===P.ErrorSampler&&t.push({id:"fallbackSamplingRatio",title:"Sampling Ratio",label:String(n.fallbackSamplingRatio??"-")}),a===P.ProbabilisticSampler&&t.push({id:"samplingPercentage",title:"Sampling Percentage",label:String(n.samplingPercentage??"-")}),a===P.LatencySampler&&n.endpointsFilters?.forEach(({serviceName:e,httpRoute:a,minimumLatencyThreshold:i,fallbackSamplingRatio:o},l)=>{const s=(n.endpointsFilters?.length??0)>1?`Endpoint #${l+1} `:"Endpoint ";t.push({id:`endpoint-${l}-service`,title:`${s}Service Name`,label:e}),t.push({id:`endpoint-${l}-route`,title:`${s}HTTP Route`,label:a}),t.push({id:`endpoint-${l}-latency`,title:`${s}Min. Latency`,label:String(i)}),t.push({id:`endpoint-${l}-fallback`,title:`${s}Fallback Sampling Ratio`,label:String(o)})}),a===P.ServiceNameSampler&&n.servicesNameFilters?.forEach(({serviceName:e,samplingRatio:a,fallbackSamplingRatio:i},o)=>{const l=(n.servicesNameFilters?.length??0)>1?`Filter #${o+1} `:"Filter ";t.push({id:`service-${o}-name`,title:`${l}Service Name`,label:e}),t.push({id:`service-${o}-ratio`,title:`${l}Sampling Ratio`,label:String(a)}),t.push({id:`service-${o}-fallback`,title:`${l}Fallback Sampling Ratio`,label:String(i)})}),a===P.SpanAttributeSampler&&n.attributeFilters?.forEach(({serviceName:e,attributeKey:a,fallbackSamplingRatio:i,condition:o},l)=>{const s=Object.keys(o)[0],r=o[s],c=(n.attributeFilters?.length??0)>1?`Filter #${l+1} `:"Filter ";t.push({id:`attr-${l}-service`,title:`${c}Service Name`,label:e}),t.push({id:`attr-${l}-key`,title:`${c}Attribute Key`,label:a}),t.push({id:`attr-${l}-fallback`,title:`${c}Fallback Sampling Ratio`,label:String(i)}),t.push({id:`attr-${l}-condition`,title:`${c}Condition`,label:s}),t.push({id:`attr-${l}-operation`,title:`${c}Operation`,label:r?.operation??"-"}),t.push({id:`attr-${l}-expected`,title:`${c}Expected Value`,label:String(r?.expectedValue??"-")}),"jsonCondition"===s&&t.push({id:`attr-${l}-jsonpath`,title:`${c}JSON Path`,label:r?.jsonPath??"-"})}),a===P.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,a)=>{const i=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${a+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${a}-ns`,title:`${i}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,o)=>{const l=[n.kind,n.name].filter(Boolean).join("/");l&&t.push({id:`group-${a}-wf-${o}`,title:`${i}Workload${(e.workloadFilters?.length??0)>1?` #${o+1}`:""}`,label:l})});const o=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");o&&t.push({id:`group-${a}-templates`,title:`${i}Templates`,label:o}),e.notes&&t.push({id:`group-${a}-notes`,title:`${i}Notes`,label:e.notes})}),t})(N);return e(a,{children:[t(nt,{isOpen:!0,header:{icon:rt(N.type),title:$.label,onClose:O,actions:[{id:"edit-action-btn-edit",label:it.EDIT,icon:Pn,active:S,onClick:D},{id:"edit-action-btn-delete",label:it.DELETE,icon:Nn,color:u.v2.colors.red[500],active:w,onClick:V}]},footer:{note:S&&y?{status:W.Error,message:y}:void 0,actions:S?[{"data-id":"edit-action-btn-cancel",label:it.CANCEL,variant:R.Secondary,onClick:L},{"data-id":"edit-action-btn-save",label:it.SAVE,variant:R.Primary,onClick:z}]:[]},children:t(ot,{$padding:"4px 12px 12px",children:S&&h?t(Hi,{}):t(b,{$gap:16,children:e(lt,{bgTint:"1000",children:[e(lt,{bgTint:"900",children:[t(st,{conditions:N.conditions||[]}),t(lt,{bgTint:"800",cellsPerRow:2,items:(X=N,j=$,[{id:"type",title:ue.TYPE,label:j.label},{id:"status",title:ue.STATUS,badge:{status:X.disabled?Ue.Unknown:W.Success,label:X.disabled?ue.DISABLED:ue.ENABLED}},{id:"signals",title:ue.SIGNALS_FOR_PROCESSING,label:X.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:ue.NAME,label:X.name||"-"},{id:"notes",title:ue.NOTES,label:X.notes||"-"}])})]}),!!B?.length&&t(lt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(lt,{bgTint:"800",cellsPerRow:2,items:B})})]})})})}),t(Ii,{target:"action",isOpen:w,onClose:()=>k(!1),onApprove:_}),t(Ni,{isOpen:null!==x,onClose:()=>A(null),onApprove:F})]});var X,j},Bo=({onClose:a,connections:i,selectedConnectionIds:o,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const[u,p]=l(""),[m,h]=l({showOnlySelected:!1}),g=r(()=>i.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),a=!m.showOnlySelected||m.showOnlySelected&&o.includes(e.id);return t&&a}),[i.length,o.length,u,m]),b=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[f,y]=l(!1),[v,S]=l(void 0),{formData:C,handleFormChange:w,areFormValuesEqual:k,resetFormData:T}=ct(v||{rollout:{automaticRolloutDisabled:!1}}),A=r(()=>o.length>1||void 0!==v&&!k(v,C),[o.length,v,C]);return n(()=>{1===o.length?(async e=>{if(f)return;y(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};S(e),T(e)}y(!1)})(o[0]):S(void 0)},[o.length]),t(Ai,{isOpen:!0,onClose:a,onSave:()=>d(C,o),header:{icon:Gn,title:"Cluster Configuration"},connectionIds:{value:o,setValue:s},search:{placeholder:"Search by cluster name",value:u,onChange:p},filters:e($,{$gap:8,children:[t(F,{size:z.XXXS,color:Y.Secondary,nowrap:!0,children:"Show only:"}),t(x,{size:He.S,label:"Selected",value:m.showOnlySelected,onChange:e=>h(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:f,leftColumn:{width:"35%",header:e($,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e($,{$gap:8,children:[t(F,{size:z.XS,children:"Clusters"}),t(le,{label:g.length,status:Ue.Unknown})]}),e($,{$gap:8,children:[t(F,{size:z.XXXS,color:Y.Secondary,align:"right",children:"Selected clusters"}),t(le,{label:`${o.length}/${g.length}`,status:Ue.Unknown})]})]}),list:g.map(e=>t(yo,{title:e.name,isChecked:o.includes(e.id),onClick:()=>b(e.id),onCheckboxChange:()=>b(e.id)},e.id))},rightColumn:{width:"65%",header:t(F,{size:z.XS,children:"Configurations"}),list:[t(x,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:C.rollout?.automaticRolloutDisabled||!1,onChange:e=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Xo=({onClose:i,destinationId:o,getDestinationCategories:s,testConnection:u,updateDestination:p,deleteDestination:h})=>{const g=m(),{destinations:f}=Ve(),{selectedStreamName:y}=pe(),{activeForm:v,loadDestination:S,validateFormData:C,formErrorMessage:w,genericForm:k}=j(),T=d(null),[x,A]=l(!1),[I,N]=l(!1),[$,D]=l(null),[E,P]=l(!0),[M,L]=l(null),F=x&&!!k?.isFormDirty,z=r(()=>ut(f,y),[f,y]),V=r(()=>z?.find(e=>at(e)===o),[o,z]);n(()=>{let e=!1;return P(!0),s().then(t=>{e||D(t?.destinationCategories.categories??[])}).catch(t=>{e||D([])}).finally(()=>{e||P(!1)}),()=>{e=!0}},[]),n(()=>{V&&$&&S(V,$)},[V,$]);const _=r(()=>V&&$?pt($,V):[],[V,$]),B=c(()=>{V&&A(!0)},[V]),U=c(()=>{V&&$&&(S(V,$),A(!1))},[V,$,S]),H=c(()=>{F?L("close"):i()},[F,i]),K=c(()=>{F?L("cancel"):U()},[F,U]),Y=c(()=>{const e=M;L(null),"close"===e?(U(),i()):U()},[M,U,i]),J=c(async()=>{if(V){const{errorMessage:e,preparedFormData:t}=C();e||(await p(V.id,q(t)),A(!1))}},[V,C,p]),Q=c(()=>{V&&N(!0)},[V]),Z=c(async()=>{V&&(await h(V.id),i())},[V,h,i]);if(!V)return null;const{icon:ee,iconSrc:te}=Le(V.destinationType.type),ae=((e,t)=>{const a=[],n=dt(e,t),i=n.map(e=>({name:e.key,value:e.value})),o=G(e.exportedSignals);let l=[];const s=()=>{l.length&&(a.push({kind:"cells",id:`cells-${a.length}`,items:l}),l=[])};return n.forEach(({key:e,name:n,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:m,customReadDataLabels:h}=c||{};if(m?.length&&X(m,o,i))return;const{type:g}=ze(p,{type:""}),b=d||"password"===g;if(h?.length)h.forEach(({condition:t,...a},n)=>{t==r&&l.push({id:`${e}-custom-${n}`,title:a.title,label:a.value})});else if(r)if(b)l.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(u===O.MultiInput){const t=ze(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"list",id:e,title:n,items:t.map((t,a)=>({id:`${e}-${a}`,label:String(t)}))})}if(u===O.KeyValuePair){const t=ze(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"pairs",id:e,title:n,items:t.map((t,a)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${a}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}l.push({id:e,title:n,label:r})}else l.push({id:e,title:n,label:"-"})}),s(),a})(V,_);return e(a,{children:[t(nt,{isOpen:!0,header:{icon:ee,iconSrc:te,title:V.name||V.destinationType.displayName,onClose:H,actions:[{id:"edit-destination-btn-edit",label:it.EDIT,icon:Pn,active:x,onClick:B},{id:"edit-destination-btn-delete",label:it.DELETE,icon:Nn,color:g.v2.colors.red[500],active:I,onClick:Q}]},footer:{note:x&&w?{status:W.Error,message:w}:void 0,actions:x?[{"data-id":"edit-destination-btn-cancel",label:it.CANCEL,variant:R.Secondary,onClick:K},...v?.option.testConnectionSupported?[{"data-id":"edit-destination-btn-test-connection",label:it.TEST_CONNECTION,variant:R.Secondary,onClick:()=>T.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:it.SAVE,variant:R.Primary,onClick:J}]:[]},children:t(ot,{$padding:"4px 12px 12px",children:E?t($e,{$height:"50vh",children:t(Pe,{withSpinner:!0})}):x&&v?t(qi,{ref:T,isEdit:!0,testConnection:u}):t(b,{$gap:16,children:e(lt,{bgTint:"1000",children:[e(lt,{bgTint:"900",children:[t(st,{conditions:V.conditions||[]}),t(lt,{bgTint:"800",cellsPerRow:2,items:(ne=V,[{id:"type",title:ue.TYPE,label:ne.destinationType.displayName},{id:"status",title:ue.STATUS,badge:{status:ne.disabled?Ue.Unknown:W.Success,label:ne.disabled?ue.DISABLED:ue.ENABLED}},{id:"monitors",title:ue.MONITORS,label:G(ne.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:ue.NAME,label:ne.name||"-"}])})]}),!!ae.length&&t(lt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:ae.map(e=>"cells"===e.kind?t(lt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(lt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(Ii,{target:"destination",isOpen:I,onClose:()=>N(!1),onApprove:Z}),t(Ni,{isOpen:null!==M,onClose:()=>L(null),onApprove:Y})]});var ne},jo=({onClose:i,ruleId:o,updateInstrumentationRule:s,deleteInstrumentationRule:d})=>{const u=m(),{instrumentationRules:p}=Ve(),{addNotification:h}=ht(),{selectedOption:g,loadRule:f,validateFormData:y,errorMessage:v,genericForm:S}=oe(),[C,w]=l(!1),[k,T]=l(!1),[x,A]=l(null),I=C&&!!S?.isFormDirty,N=r(()=>p?.find(e=>at(e)===o),[o,p]),D=r(()=>_e.find(({type:e})=>e===N?.type)??null,[N?.type]);n(()=>{N&&f(N)},[N]);const E=c(()=>{if(N){if(!N.mutable)return void h({type:W.Warning,title:gt.FORBIDDEN,message:gt.CANNOT_EDIT_RULE,crdType:Qe.InstrumentationRule,target:N.ruleId,hideFromHistory:!0});w(!0)}},[N,h]),O=c(()=>{N&&(f(N),w(!1))},[N,f]),P=c(()=>{I?A("close"):i()},[I,i]),M=c(()=>{I?A("cancel"):O()},[I,O]),L=c(()=>{const e=x;A(null),"close"===e?(O(),i()):O()},[x,O,i]),V=c(async()=>{if(N){const{errorMessage:e,preparedFormData:t}=y();e||(await s(N.ruleId,t),w(!1))}},[N,y,s]),_=c(()=>{if(N){if(!N.mutable)return void h({type:W.Warning,title:gt.FORBIDDEN,message:gt.CANNOT_DELETE_RULE,crdType:Qe.InstrumentationRule,target:N.ruleId,hideFromHistory:!0});T(!0)}},[N,h]),B=c(async()=>{N&&(await d(N.ruleId),i())},[N,d,i]);if(!N||!D)return null;const X=((e,a)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,a])=>{a&&n.push(t(F,{size:z.XS,children:`• ${mt(e).toLowerCase()}`},e))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,a])=>{a&&n.push(t(F,{size:z.XS,children:`• ${mt(e).toLowerCase()}`},e))}),e.headersCollection?.[Z.HeaderKeys]?.length&&e.headersCollection[Z.HeaderKeys].forEach(e=>{e&&n.push(t(F,{size:z.XS,children:e},e))}),e.customInstrumentations&&(e.customInstrumentations[ne.Java]?.forEach((e,i)=>{const o=new ae(e.className,e.methodName);if(o.Verify()){0===i&&n.push(t(F,{size:z.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=o.toString();n.push(t(F,{size:z.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}}),e.customInstrumentations[ne.Golang]?.forEach((e,i)=>{const o=new te(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(o.Verify()){0===i&&n.push(t(F,{size:z.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=o.toString();n.push(t(F,{size:z.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}})),n})(N,u);return e(a,{children:[t(nt,{isOpen:!0,header:{icon:ft(N.type),title:D.label,onClose:P,actions:[{id:"edit-rule-btn-edit",label:it.EDIT,icon:Pn,active:C,onClick:E},{id:"edit-rule-btn-delete",label:it.DELETE,icon:Nn,color:u.v2.colors.red[500],active:k,onClick:_}]},footer:{note:C&&v?{status:W.Error,message:v}:void 0,actions:C?[{"data-id":"edit-rule-btn-cancel",label:it.CANCEL,variant:R.Secondary,onClick:M},{"data-id":"edit-rule-btn-save",label:it.SAVE,variant:R.Primary,onClick:V}]:[]},children:t(ot,{$padding:"4px 12px 12px",children:C&&g?t(no,{}):t(b,{$gap:16,children:e(lt,{bgTint:"1000",children:[e(lt,{bgTint:"900",children:[t(st,{conditions:N.conditions||[]}),t(lt,{bgTint:"800",cellsPerRow:2,items:(j=N,U=D,[{id:"type",title:ue.TYPE,label:U.label},{id:"status",title:ue.STATUS,badge:{status:j.disabled?Ue.Unknown:W.Success,label:j.disabled?ue.DISABLED:ue.ENABLED}},{id:"name",title:ue.NAME,label:j.ruleName||"-"},{id:"profile",title:ue.MANAGED_BY_PROFILE,label:j.profileName||"-"},{id:"notes",title:ue.NOTES,label:j.notes||"-"}])})]}),!!X.length&&t(lt,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(lt,{bgTint:"800",children:X})}),!!D.supportedLanguages.length&&t(lt,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(lt,{bgTint:"800",children:t($,{$gap:12,$wrap:"wrap",children:D.supportedLanguages.map(e=>t(bt,{label:se[e],leftIcon:re(e),flex:"0.5"},e))})})})]})})})}),t(Ii,{target:"instrumentation rule",isOpen:k,onClose:()=>T(!1),onApprove:B}),t(Ni,{isOpen:null!==x,onClose:()=>A(null),onApprove:L})]});var j,U},Uo=p.div`
81
81
  display: flex;
82
82
  align-items: center;
83
83
  gap: 8px;
@@ -87,9 +87,9 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
87
87
  &:hover {
88
88
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
89
89
  }
90
- `,ai=p.div`
90
+ `,Wo=p.div`
91
91
  flex: 1;
92
- `,ni=({onClick:a})=>{const n=m().v2.colors.red[500];return e(ti,{"data-id":"sampling-view-btn-delete",onClick:a,children:[t(M,{size:L.XS,weight:500,color:n,children:ft}),t(Xa,{size:16,fill:n})]})};function oi(n){if(n.isEditing){const{onCancelEdit:o,onSave:i,onDelete:l,duplicateWarning:s}=n;return{children:e(a,{children:[t(ni,{onClick:l}),s&&t(j,{status:X.Warning,message:s.message,action:s.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:s.onViewRule}:void 0}),t(ai,{}),t(E,{"data-id":"sampling-view-edit-btn-cancel",label:ht,variant:R.Secondary,size:$.S,onClick:o}),t(E,{"data-id":"sampling-view-edit-btn-save",label:gt,variant:R.Primary,size:$.S,onClick:i,disabled:!!s})]})}}const{onDelete:o,onCancel:i,onEdit:l}=n;return{children:e(a,{children:[t(ni,{onClick:o}),t(ai,{}),t(E,{"data-id":"sampling-view-btn-cancel",label:ht,variant:R.Secondary,size:$.S,onClick:i}),t(E,{"data-id":"sampling-view-btn-edit",label:bt,variant:R.Primary,size:$.S,onClick:l})]})}}const ii={[re.EditAutoNoisy]:{title:Et,subTitle:Dt,cancelId:"sampling-edit-auto-rule-btn-cancel",saveId:"sampling-edit-auto-rule-btn-save"},[re.EditAutoCostReduction]:{title:It,subTitle:Nt,cancelId:"sampling-edit-cost-reduction-auto-rule-btn-cancel",saveId:"sampling-edit-cost-reduction-auto-rule-btn-save"},[re.EditAutoHighlyRelevant]:{title:At,subTitle:Tt,cancelId:"sampling-edit-highly-relevant-auto-rule-btn-cancel",saveId:"sampling-edit-highly-relevant-auto-rule-btn-save"}},li=({isOpen:e,title:a,subTitle:n,onClose:o,footer:i,renderBody:l})=>t(Qe,{isOpen:e,width:Rt,header:{icon:un,title:a,subTitle:n,onClose:o},footer:i,children:l?l():t(et,{$padding:"12px",children:t(ko,{})})}),si=({isOpen:e,onClose:a,onSubmit:o,validateForm:i,onNavigateToDuplicate:l})=>{const{category:s,formData:r,resetForm:d,duplicateWarning:u,setDuplicateWarning:p}=se(re.Create);n(()=>{e&&d()},[e]);const m=c(()=>{if(i){const e=i(r);if(e)return void p(e)}o(r)},[r,o,i,p]),h={note:u?{status:X.Warning,message:u.message,action:l?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>l(u.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:ht,variant:R.Secondary,size:$.S,onClick:a},{"data-id":"sampling-create-btn-submit",label:wt,variant:R.Primary,size:$.S,onClick:m,disabled:!!u}]};return t(li,{isOpen:e,title:kt[s],subTitle:vt[s],onClose:a,footer:h})},ri=({onClose:e,onDelete:a,onSaveEdit:n,validateForm:o,onNavigateToDuplicate:i})=>{const{data:l,isEditing:s,formData:d,handleEdit:u,handleCancelEdit:p,duplicateWarning:m,setDuplicateWarning:h}=se(re.View),g=l?.rule.name||St,b=s&&l?Ct[l.category]:`${g} preview`,f=c(()=>{if(l&&s){if(o){const e=o(d);if(e)return void h(e)}n(d,l.rule.ruleId,l.samplingId)}},[l,s,d,n,o,h]),y=c(()=>{l&&a(l.rule.ruleId,l.samplingId)},[l,a]),v=r(()=>{if(!l)return;const t=m?{message:m.message,onViewRule:i?()=>i(m.ruleId):void 0}:null;return oi(s?{isEditing:!0,onCancelEdit:p,onSave:f,onDelete:y,duplicateWarning:t}:{isEditing:!1,onDelete:y,onCancel:e,onEdit:u})},[l,s,m,p,f,y,u,e,i]);return t(li,{isOpen:!!l,title:b,subTitle:l?vt[l.category]:"",onClose:e,footer:v})},ci=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,resolvedPercentage:i}=se(re.EditAutoNoisy),l=c(()=>n(o,i),[n,o,i]);return t(pi,{formType:re.EditAutoNoisy,isOpen:e,onClose:a,onSave:l})},di=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,resolvedPercentage:i}=se(re.EditAutoCostReduction),l=c(()=>n(o,i),[n,o,i]);return t(pi,{formType:re.EditAutoCostReduction,isOpen:e,onClose:a,onSave:l})},ui=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o}=se(re.EditAutoHighlyRelevant),i=c(()=>n(o),[n,o]);return t(pi,{formType:re.EditAutoHighlyRelevant,isOpen:e,onClose:a,onSave:i})},pi=({formType:e,isOpen:a,onClose:n,onSave:o})=>{const i=ii[e];return t(li,{isOpen:a,title:i.title,subTitle:i.subTitle,onClose:n,footer:{actions:[{"data-id":i.cancelId,label:ht,variant:R.Secondary,size:$.S,onClick:n},{"data-id":i.saveId,label:$t,variant:R.Primary,size:$.S,onClick:o}]}})},mi=e=>{switch(e.formType){case re.Create:return t(yt,{formType:re.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(si,{...e})});case re.View:return t(yt,{formType:re.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(ri,{...e})});case re.EditAutoNoisy:return t(yt,{formType:re.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(ci,{...e})});case re.EditAutoCostReduction:return t(yt,{formType:re.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(di,{...e})});case re.EditAutoHighlyRelevant:return t(yt,{formType:re.EditAutoHighlyRelevant,enabled:e.enabled,children:t(ui,{...e})})}},hi=({token:n,isLoading:o,isEditing:i,onEdit:l,onCancel:s,onSave:r,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=xt(),h=!i||o||!c.newToken;return Ot({key:"Enter",active:!h},r),e(D,i?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(v,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(D,{$margin:o?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:o?t(Ee,{title:"Saving...",withGradient:!0}):e(a,{children:[t(E,{variant:R.Secondary,size:$.S,leftIcon:ln,onClick:s,disabled:o}),t(E,{variant:R.Primary,size:$.S,leftIcon:on,onClick:r,disabled:h})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(M,{size:L.XS,children:new Array(55).fill("•").join("")}),e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(m,{value:n}),t(Ie,{icon:qa,onClick:l})]})]})},gi=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:i}=Pt(),l=r(()=>i(e),[e]),s=r(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=r(()=>Ft(e,0)?X.Error:Ft(e,2592e6)?X.Warning:X.Success,[e]),d=r(()=>c===X.Success?on:c===X.Warning?pn:mn,[c]);return n(()=>{c===X.Success?a():c===X.Error&&o()},[c]),t(q,{text:s,children:t(oe,{leftIcon:d,label:l,status:c,invertColors:!0,useSecondaryTone:!0})})},bi=p.div`
92
+ `,Ho=({onClick:a})=>{const n=m().v2.colors.red[500];return e(Uo,{"data-id":"sampling-view-btn-delete",onClick:a,children:[t(F,{size:z.XS,weight:500,color:n,children:Ct}),t(Nn,{size:16,fill:n})]})};function Go(n){if(n.isEditing){const{onCancelEdit:i,onSave:o,onDelete:l,duplicateWarning:s}=n;return{children:e(a,{children:[t(Ho,{onClick:l}),s&&t(U,{status:W.Warning,message:s.message,action:s.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:s.onViewRule}:void 0}),t(Wo,{}),t(D,{"data-id":"sampling-view-edit-btn-cancel",label:yt,variant:R.Secondary,size:E.S,onClick:i}),t(D,{"data-id":"sampling-view-edit-btn-save",label:vt,variant:R.Primary,size:E.S,onClick:o,disabled:!!s})]})}}const{onDelete:i,onCancel:o,onEdit:l}=n;return{children:e(a,{children:[t(Ho,{onClick:i}),t(Wo,{}),t(D,{"data-id":"sampling-view-btn-cancel",label:yt,variant:R.Secondary,size:E.S,onClick:o}),t(D,{"data-id":"sampling-view-btn-edit",label:St,variant:R.Primary,size:E.S,onClick:l})]})}}const Ko={[he.EditAutoNoisy]:{title:Ot,subTitle:Rt,cancelId:"sampling-edit-auto-rule-btn-cancel",saveId:"sampling-edit-auto-rule-btn-save"},[he.EditAutoCostReduction]:{title:Et,subTitle:Dt,cancelId:"sampling-edit-cost-reduction-auto-rule-btn-cancel",saveId:"sampling-edit-cost-reduction-auto-rule-btn-save"},[he.EditAutoHighlyRelevant]:{title:$t,subTitle:Nt,cancelId:"sampling-edit-highly-relevant-auto-rule-btn-cancel",saveId:"sampling-edit-highly-relevant-auto-rule-btn-save"}},qo=({isOpen:e,title:a,subTitle:n,onClose:i,footer:o,renderBody:l})=>t(nt,{isOpen:e,width:Mt,header:{icon:Kn,title:a,subTitle:n,onClose:i},footer:o,children:l?l():t(ot,{$padding:"12px",children:t(po,{})})}),Yo=({isOpen:e,onClose:a,onSubmit:i,validateForm:o,onNavigateToDuplicate:l})=>{const{category:s,formData:r,resetForm:d,duplicateWarning:u,setDuplicateWarning:p}=me(he.Create);n(()=>{e&&d()},[e]);const m=c(()=>{if(o){const e=o(r);if(e)return void p(e)}i(r)},[r,i,o,p]),h={note:u?{status:W.Warning,message:u.message,action:l?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>l(u.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:yt,variant:R.Secondary,size:E.S,onClick:a},{"data-id":"sampling-create-btn-submit",label:At,variant:R.Primary,size:E.S,onClick:m,disabled:!!u}]};return t(qo,{isOpen:e,title:It[s],subTitle:kt[s],onClose:a,footer:h})},Jo=({onClose:e,onDelete:a,onSaveEdit:n,validateForm:i,onNavigateToDuplicate:o})=>{const{data:l,isEditing:s,formData:d,handleEdit:u,handleCancelEdit:p,duplicateWarning:m,setDuplicateWarning:h}=me(he.View),g=l?.rule.name||xt,b=s&&l?Tt[l.category]:`${g} preview`,f=c(()=>{if(l&&s){if(i){const e=i(d);if(e)return void h(e)}n(d,l.rule.ruleId,l.samplingId)}},[l,s,d,n,i,h]),y=c(()=>{l&&a(l.rule.ruleId,l.samplingId)},[l,a]),v=r(()=>{if(!l)return;const t=m?{message:m.message,onViewRule:o?()=>o(m.ruleId):void 0}:null;return Go(s?{isEditing:!0,onCancelEdit:p,onSave:f,onDelete:y,duplicateWarning:t}:{isEditing:!1,onDelete:y,onCancel:e,onEdit:u})},[l,s,m,p,f,y,u,e,o]);return t(qo,{isOpen:!!l,title:b,subTitle:l?kt[l.category]:"",onClose:e,footer:v})},Qo=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:i,resolvedPercentage:o}=me(he.EditAutoNoisy),l=c(()=>n(i,o),[n,i,o]);return t(tl,{formType:he.EditAutoNoisy,isOpen:e,onClose:a,onSave:l})},Zo=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:i,resolvedPercentage:o}=me(he.EditAutoCostReduction),l=c(()=>n(i,o),[n,i,o]);return t(tl,{formType:he.EditAutoCostReduction,isOpen:e,onClose:a,onSave:l})},el=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:i}=me(he.EditAutoHighlyRelevant),o=c(()=>n(i),[n,i]);return t(tl,{formType:he.EditAutoHighlyRelevant,isOpen:e,onClose:a,onSave:o})},tl=({formType:e,isOpen:a,onClose:n,onSave:i})=>{const o=Ko[e];return t(qo,{isOpen:a,title:o.title,subTitle:o.subTitle,onClose:n,footer:{actions:[{"data-id":o.cancelId,label:yt,variant:R.Secondary,size:E.S,onClick:n},{"data-id":o.saveId,label:Pt,variant:R.Primary,size:E.S,onClick:i}]}})},al=e=>{switch(e.formType){case he.Create:return t(wt,{formType:he.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(Yo,{...e})});case he.View:return t(wt,{formType:he.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(Jo,{...e})});case he.EditAutoNoisy:return t(wt,{formType:he.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(Qo,{...e})});case he.EditAutoCostReduction:return t(wt,{formType:he.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(Zo,{...e})});case he.EditAutoHighlyRelevant:return t(wt,{formType:he.EditAutoHighlyRelevant,enabled:e.enabled,children:t(el,{...e})})}},nl=({token:n,isLoading:i,isEditing:o,onEdit:l,onCancel:s,onSave:r,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=Lt(),h=!o||i||!c.newToken;return Ft({key:"Enter",active:!h},r),e($,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(S,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t($,{$margin:i?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:i?t(Pe,{title:"Saving...",withGradient:!0}):e(a,{children:[t(D,{variant:R.Secondary,size:E.S,leftIcon:jn,onClick:s,disabled:i}),t(D,{variant:R.Primary,size:E.S,leftIcon:Xn,onClick:r,disabled:h})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(F,{size:z.XS,children:new Array(55).fill("•").join("")}),e($,{$alignItems:"center",$justifyContent:"space-between",children:[t(m,{value:n}),t(Re,{icon:Pn,onClick:l})]})]})},il=({expiresAt:e,callbackValid:a,callbackExpired:i})=>{const{formatTimeAgo:o}=zt(),l=r(()=>o(e),[e]),s=r(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=r(()=>Vt(e,0)?W.Error:Vt(e,2592e6)?W.Warning:W.Success,[e]),d=r(()=>c===W.Success?Xn:c===W.Warning?qn:Yn,[c]);return n(()=>{c===W.Success?a():c===W.Error&&i()},[c]),t(Q,{text:s,children:t(le,{leftIcon:d,label:l,status:c,invertColors:!0,useSecondaryTone:!0})})},ol=p.div`
93
93
  display: flex;
94
94
  flex-direction: column;
95
95
  gap: 12px;
@@ -97,7 +97,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
97
97
  border-radius: 12px;
98
98
  border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
99
99
  background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
100
- `,fi=({children:e})=>{const a=m();return t(M,{size:L.XXXS,color:a.v2.colors.grey[150],children:e})},yi=({token:a,updateToken:n})=>{const[o,i]=l(!1),[s,r]=l(!1),[c,d]=l(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:h,resetFormData:b}=ot({newToken:""});return t(ye,{richTitle:{icon:hn,title:"Odigos Pro Token"},children:e(bi,{$isExpired:c,children:[e(D,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(fi,{children:"Issued for"}),t(M,{size:L.XS,children:a.name||"N/A"})]}),e(g,{$gap:4,children:[t(fi,{children:"Expiration"}),t(gi,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(D,{children:e(g,{children:[t(fi,{children:"Token"}),t(hi,{token:a.token,newToken:u.newToken,isLoading:s,isEditing:o,onEdit:()=>i(!0),onCancel:()=>(i(!1),r(!1),void p("newToken","")),onSave:()=>(async()=>{r(!0);const e=await n(u.newToken.trim());r(!1),e?.error?h("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:h,formErrors:m})]})})]})})},vi=p.div`
100
+ `,ll=({children:e})=>{const a=m();return t(F,{size:z.XXXS,color:a.v2.colors.grey[150],children:e})},sl=({token:a,updateToken:n})=>{const[i,o]=l(!1),[s,r]=l(!1),[c,d]=l(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:h,resetFormData:g}=ct({newToken:""});return t(Te,{richTitle:{icon:Jn,title:"Odigos Pro Token"},children:e(ol,{$isExpired:c,children:[e($,{$justifyContent:"space-between",children:[e(b,{$gap:4,children:[t(ll,{children:"Issued for"}),t(F,{size:z.XS,children:a.name||"N/A"})]}),e(b,{$gap:4,children:[t(ll,{children:"Expiration"}),t(il,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(b,{})]}),t($,{children:e(b,{children:[t(ll,{children:"Token"}),t(nl,{token:a.token,newToken:u.newToken,isLoading:s,isEditing:i,onEdit:()=>o(!0),onCancel:()=>(o(!1),r(!1),void p("newToken","")),onSave:()=>(async()=>{r(!0);const e=await n(u.newToken.trim());r(!1),e?.error?h("newToken",e.error):(o(!1),g())})(),formData:u,handleFormChange:p,handleErrorChange:h,formErrors:m})]})})]})})},rl=p.div`
101
101
  display: flex;
102
102
  flex-direction: column;
103
103
  align-items: center;
@@ -106,7 +106,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
106
106
  padding: 12px 24px;
107
107
  border-radius: 8px;
108
108
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
109
- `,Ci=({downloadDiagnose:a})=>{const n=m(),{progress:o}=He(),{namespaces:i}=Pe(),[s,r]=l(null),{formData:c,handleFormChange:d,resetFormData:u}=ot({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ye,{richTitle:{icon:gn,title:"Diagnose"},children:s?e(vi,{children:[t(Ee,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[Ke.DownloadingDiagnose]?.percentage,percentage:o[Ke.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[Ke.DownloadingDiagnose]?.percentage,visualIcon:bn,startedAt:s}),o[Ke.DownloadingDiagnose]?.list?.length&&t(g,{$width:"100%",children:o[Ke.DownloadingDiagnose].list.map(a=>e(D,{$gap:4,$alignItems:"center",children:[a.status===X.Success?t(on,{size:16}):a.status===X.Error?t(ln,{size:16}):t(Ee,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(g,{$gap:24,children:[t(M,{size:L.XXS,color:n.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e(g,{$gap:16,children:[e(D,{$gap:8,children:[t(f,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(D,{$gap:8,children:[t(f,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(D,{$gap:8,children:[t(f,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(Mt,{alignX:Vt.Left,alignY:Lt.Bottom,items:i.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:R.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(oe,{label:c.sourceWorkloadNamespaces.length,status:X.Default}):void 0}}),t(D,{$justifyContent:"flex-end",children:t(E,{label:"Download Diagnose",rightIcon:bn,variant:R.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},Si=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:i}=Me(),[s,r]=l(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ye,{richTitle:{icon:fn,title:"General Information"},children:t(tt,{cellsPerRow:2,items:[{id:Bt(),title:"Odigos Version",label:o},{id:Bt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:Bt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:Bt(),title:"Tier",label:i}]})})},wi=({isOpen:a,onClose:n,token:o,updateToken:i,fetchDescribeOdigos:l,downloadDiagnose:s})=>e(Qe,{isOpen:a,header:{icon:fn,title:"System Overview",onClose:n},children:[l&&t(Si,{fetchDescribeOdigos:l}),i&&o&&t(yi,{token:o,updateToken:i}),s&&t(Ci,{downloadDiagnose:s})]});var ki,Ti;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(ki||(ki={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Ti||(Ti={}));const Ai=[{key:Ti.Name,label:"Name"},{key:Ti.Type,label:"Type",textAlign:"right"},{key:Ti.Status,label:"Status"},{key:Ti.OdigosVersion,label:"Odigos Version"},{key:Ti.ConnectedSince,label:"Connected Since"},{key:Ti.LastActivity,label:"Last Activity"}],Ni=(e,t)=>{const a=e.find(e=>e.key===Ti.Id)?.rawValue;return t(a?.toString()||"")},Ii=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:o,onAddSource:i,onAddDestination:l,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Ti.Status)?.rawValue===X.Success)(e))return[{id:Bt(),label:"Delete Connection",rightIcon:Ya,onClick:()=>Ni(e,o)}];const d=Ni(e,e=>{const n=t.find(t=>t.id===e);return!!n&&zt(n.odigosVersion,a)}),u=Ni(e,e=>{const a=t.find(t=>t.id===e);return!!a&&zt(a.odigosVersion,n)}),p=[];return i&&p.push({id:Bt(),tooltip:u?Te.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:rn,disabled:!u,onClick:()=>Ni(e,i)}),l&&p.push({id:Bt(),tooltip:Te.ADD_DESTINATION,rightIcon:tn,onClick:()=>Ni(e,l)}),s&&p.push({id:Bt(),tooltip:Te.ADD_ACTION,rightIcon:en,onClick:()=>Ni(e,s)}),r&&p.push({id:Bt(),tooltip:Te.ADD_INSTRUMENTATION_RULE,rightIcon:sn,onClick:()=>Ni(e,r)}),c&&p.push({id:Bt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:dn,disabled:!d,onClick:()=>Ni(e,c)}),p}},Di=({tableRowsMaxHeight:a,connections:o,getConnections:i,onClickConnection:s,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:y,getPotentialDestinations:v,testConnection:C,createDestination:S,updateDestination:w,createAction:k,createInstrumentationRule:T})=>{const A=m(),{isVm:N}=Me(),{formatTimeAgo:I}=Pt(),[D,E]=l(!1),[x,O]=l(o||[]),P=c(async()=>{try{E(!0),O(await i()??[])}catch(e){}finally{E(!1)}},[]);n(()=>{x.length||P()},[]);const[F,M]=l(""),[L,V]=l(null),[B,z]=l([]),_=r(()=>L===ki.BulkConfig?u:L===ki.BulkSource?g:0,[L,u,g]),{supportedConnections:U,supportedConnectionIds:j}=r(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===X.Success,n=zt(e.odigosVersion,t);return a&&n}))(x,_);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x.length,_]);n(()=>{if(!L||L===ki.Delete)return;const e=B.filter(e=>!j.includes(e));e.length&&z(t=>t.filter(t=>!e.includes(t)))},[L,B.length,j.length]);const H=r(()=>x.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:Ti.Id,rawValue:e.id},{key:Ti.Name,rawValue:e.name},{key:Ti.Type,rawValue:e.type},{key:Ti.Status,rawValue:e.status,component:()=>(e=>{const a=e===X.Success?"Connection live":"Connection lost",n=e===X.Success?on:ln;return t(oe,{status:e,label:a,leftIcon:n})})(e.status)},{key:Ti.OdigosVersion,rawValue:e.odigosVersion},{key:Ti.ConnectedSince,rawValue:e.connectedAt?I(e.connectedAt):"-"},{key:Ti.LastActivity,rawValue:e.lastSeenAt?I(e.lastSeenAt):"-"}],onClick:e.status!==X.Success||L?void 0:()=>s(e),isSelected:B.includes(e.id),onSelect:()=>z(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>z(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==X.Success||L===ki.BulkConfig&&!zt(e.odigosVersion,u)||L===ki.BulkSource&&!zt(e.odigosVersion,g)})),[x,B,F,L,u,g]),W=r(()=>{const e=(e,t)=>{z([e]),V(t)};return Ii({connections:x,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,ki.Delete),onAddSource:!N&&b&&f?t=>e(t,ki.BulkSource):void 0,onAddDestination:!N&&y&&v&&S?t=>e(t,ki.BulkDestination):void 0,onAddAction:!N&&k?t=>e(t,ki.BulkAction):void 0,onAddInstrumentationRule:!N&&T?t=>e(t,ki.BulkInstrumentationRule):void 0,onEditConfiguration:!N&&p&&h?t=>e(t,ki.BulkConfig):void 0})},[N,x,u,p,h,g,b,f,y,v,S,k,T]),G=r(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:o,onAddInstrumentationRule:i,onManageConfigurations:l}=e,s=[];a&&s.push({id:Bt(),type:_t.Button,buttonProps:{variant:R.Primary,size:$.S,label:"Add Sources",rightIcon:rn,onClick:a}});const r=[n?{id:ki.BulkDestination,label:Te.ADD_DESTINATION,icon:tn}:null,o?{id:ki.BulkAction,label:Te.ADD_ACTION,icon:en}:null,i?{id:ki.BulkInstrumentationRule,label:Te.ADD_INSTRUMENTATION_RULE,icon:sn}:null,l?{id:ki.BulkConfig,label:"Manage Configurations",icon:dn}:null];return r.some(Boolean)&&s.push({id:Bt(),type:_t.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===ki.BulkSource?a?.():e===ki.BulkDestination?n?.():e===ki.BulkAction?o?.():e===ki.BulkInstrumentationRule?i?.():e===ki.BulkConfig&&l?.()}},dropDataProps:{alignX:Vt.Left,items:r}}),s.push({id:Bt(),type:_t.Button,buttonProps:{variant:R.Text,size:$.S,label:Ze.CANCEL,onClick:t}}),s})({onCancel:()=>z([]),onAddSource:!N&&b&&f?()=>V(ki.BulkSource):void 0,onAddDestination:!N&&y&&v&&S?()=>V(ki.BulkDestination):void 0,onAddAction:!N&&k?()=>V(ki.BulkAction):void 0,onAddInstrumentationRule:!N&&T?()=>V(ki.BulkInstrumentationRule):void 0,onManageConfigurations:!N&&p&&h?()=>V(ki.BulkConfig):void 0}),[N,p,h,b,f,y,v,S,k,T]);return t(Ut,{children:e(ye,{richTitle:{icon:vn,title:Te.CONNECTIONS,badge:{label:x.length.toString(),status:Be.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>M(e),width:"300px"},actions:[{id:Bt(),type:_t.Button,buttonProps:{variant:R.Secondary,size:$.S,leftIcon:yn,onClick:P,disabled:D}}],children:[t(jt,{variant:Xt.Pretty,maxHeight:a,headerBackgroundColor:A.v2.colors.silver[1e3],isLoading:D,withCheckboxes:!0,columns:Ai,rows:H,rowActionsPushRightPosition:L?`calc(${jn} - 24px)`:void 0,getRowActions:W}),L===ki.BulkConfig&&p&&h&&t(Qo,{onClose:()=>V(null),connections:U,selectedConnectionIds:B,setSelectedConnectionIds:z,getEffectiveConfig:p,onApply:h}),L===ki.BulkSource&&b&&f&&t(Ht,{selectedConnectionIds:B,children:t(qo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))})}),L===ki.BulkDestination&&y&&v&&C&&S&&w&&t(Wt,{children:t(_o,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getDestinationCategories:y,getPotentialDestinations:v,testConnection:e=>C(e,B),createDestination:e=>S(e,B),updateDestination:(e,t)=>w(e,t,B)})}),L===ki.BulkAction&&k&&t(Gt,{children:t(Ro,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createAction:e=>k(e,B)})}),L===ki.BulkInstrumentationRule&&T&&t(Kt,{children:t(Uo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createInstrumentationRule:e=>T(e,B)})}),t(_n,{target:"connection",isOpen:L===ki.Delete,onClose:()=>{z([]),V(null)},onApprove:async()=>{const e=B[0];e&&(await d(e),await P())}}),t(Yt,{isOpen:!!B.length&&!L,richTitle:{icon:Ga,title:"Selected Clusters",badge:{label:B.length}},actions:G})]})})},Ei=p.div`
109
+ `,cl=({downloadDiagnose:a})=>{const{progress:n}=Ye(),{namespaces:i}=Ve(),[o,s]=l(null),{formData:r,handleFormChange:c,resetFormData:d}=ct({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(Te,{richTitle:{icon:Qn,title:"Diagnose"},children:o?e(rl,{children:[t(Pe,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof n[Ze.DownloadingDiagnose]?.percentage,percentage:n[Ze.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof n[Ze.DownloadingDiagnose]?.percentage,visualIcon:Zn,startedAt:o}),n[Ze.DownloadingDiagnose]?.list?.length&&t(b,{$width:"100%",children:n[Ze.DownloadingDiagnose].list.map(a=>e($,{$gap:4,$alignItems:"center",children:[a.status===W.Success?t(Xn,{size:16}):a.status===W.Error?t(jn,{size:16}):t(Pe,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(F,{size:z.XXXS,color:Y.Secondary,children:a.label})]},a.label))})]}):e(b,{$gap:24,children:[t(F,{size:z.XXS,color:Y.Secondary,children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e(b,{$gap:16,children:[e($,{$gap:8,children:[t(y,{label:"Profiles",value:r.includeProfiles,onChange:e=>c("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(F,{size:z.XXXS,color:Y.Secondary,children:"Include pprof profiles"})]}),e($,{$gap:8,children:[t(y,{label:"Metrics",value:r.includeMetrics,onChange:e=>c("includeMetrics",e)}),t(F,{size:z.XXXS,color:Y.Secondary,children:"Include Prometheus metrics"})]}),e($,{$gap:8,children:[t(y,{label:"Source Workloads",value:r.includeSourceWorkloads,onChange:e=>{c("includeSourceWorkloads",e),e&&c("sourceWorkloadNamespaces",[])}}),t(F,{size:z.XXXS,color:Y.Secondary,children:"Include workload and pod manifests for instrumented sources"})]})]}),t(_t,{alignX:Xt.Left,alignY:Bt.Bottom,items:i.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:r.sourceWorkloadNamespaces,setSelectedIds:e=>c("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(r.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:R.Secondary,disabled:r.includeSourceWorkloads,leftIcon:r.sourceWorkloadNamespaces.length?()=>t(le,{label:r.sourceWorkloadNamespaces.length,status:W.Default}):void 0}}),t($,{$justifyContent:"flex-end",children:t(D,{label:"Download Diagnose",rightIcon:Zn,variant:R.Primary,onClick:async()=>{s(Date.now()),await a(r),s(null),d()},disabled:null!==o})})]})})},dl=({fetchDescribeOdigos:e})=>{const{platformType:a,version:i,tier:o}=Be(),[s,r]=l(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(Te,{richTitle:{icon:ei,title:"General Information"},children:t(lt,{cellsPerRow:2,items:[{id:jt(),title:"Odigos Version",label:i},{id:jt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:jt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:jt(),title:"Tier",label:o}]})})},ul=({isOpen:a,onClose:n,token:i,updateToken:o,fetchDescribeOdigos:l,downloadDiagnose:s})=>e(nt,{isOpen:a,header:{icon:ei,title:"System Overview",onClose:n},children:[l&&t(dl,{fetchDescribeOdigos:l}),o&&i&&t(sl,{token:i,updateToken:o}),s&&t(cl,{downloadDiagnose:s})]}),pl=({onClose:n,createDataStream:i})=>{const{addDataStreams:o,setSelectedStreamName:l}=pe(),{requestSubmit:s}=ce(),r=c(async e=>{i?await i(e):(o([e]),l(e.name)),n()},[i,o,l,n]),d=c(()=>s(r),[s,r]);return Ft({key:"Enter",active:!0},d),e(a,{children:[t(de,{isOpen:!0,onClose:n,title:ue.NAME_YOUR_STREAM,description:ue.STREAM_DESCRIPTION,approveButton:{"data-id":"add-stream-btn-done",label:it.DONE,variant:R.Primary,onClick:d},denyButton:{"data-id":"add-stream-btn-cancel",label:it.CANCEL,variant:R.Secondary,onClick:n},children:t(oo,{autoFocus:!0})}),t(io,{})]})},ml=({onClose:i,dataStreamName:o,updateDataStream:l})=>{const{genericForm:s,loadDataStream:r,requestSubmit:d}=ce();n(()=>{r(o)},[o]);const u=!!s?.isFormDirty,p=c(async e=>{await l(o,e),i()},[l,o,i]),m=c(()=>d(p),[d,p]);return Ft({key:"Enter",active:!0},m),e(a,{children:[t(de,{isOpen:!0,onClose:i,title:ue.RENAME_STREAM(o),description:ue.STREAM_DESCRIPTION,approveButton:{"data-id":"edit-stream-btn-save",label:it.SAVE,variant:R.Primary,onClick:m,disabled:!u},denyButton:{"data-id":"edit-stream-btn-cancel",label:it.CANCEL,variant:R.Secondary,onClick:i},children:t(oo,{autoFocus:!0})}),t(io,{})]})};var hl,gl;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(hl||(hl={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(gl||(gl={}));const bl=[{key:gl.Name,label:"Name"},{key:gl.Type,label:"Type",textAlign:"right"},{key:gl.Status,label:"Status"},{key:gl.OdigosVersion,label:"Odigos Version"},{key:gl.ConnectedSince,label:"Connected Since"},{key:gl.LastActivity,label:"Last Activity"}],fl=(e,t)=>{const a=e.find(e=>e.key===gl.Id)?.rawValue;return t(a?.toString()||"")},yl=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:i,onAddSource:o,onAddDestination:l,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===gl.Status)?.rawValue===W.Success)(e))return[{id:jt(),label:"Delete Connection",rightIcon:On,onClick:()=>fl(e,i)}];const d=fl(e,e=>{const n=t.find(t=>t.id===e);return!!n&&Ut(n.odigosVersion,a)}),u=fl(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Ut(a.odigosVersion,n)}),p=[];return o&&p.push({id:jt(),tooltip:u?ue.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:Wn,disabled:!u,onClick:()=>fl(e,o)}),l&&p.push({id:jt(),tooltip:ue.ADD_DESTINATION,rightIcon:Vn,onClick:()=>fl(e,l)}),s&&p.push({id:jt(),tooltip:ue.ADD_ACTION,rightIcon:zn,onClick:()=>fl(e,s)}),r&&p.push({id:jt(),tooltip:ue.ADD_INSTRUMENTATION_RULE,rightIcon:Un,onClick:()=>fl(e,r)}),c&&p.push({id:jt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:Gn,disabled:!d,onClick:()=>fl(e,c)}),p}},vl=({tableRowsMaxHeight:a,connections:i,getConnections:o,onClickConnection:s,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:y,getPotentialDestinations:v,testConnection:S,createDestination:C,updateDestination:w,createAction:k,createInstrumentationRule:T})=>{const x=m(),{isVm:A}=Be(),{formatTimeAgo:I}=zt(),[N,$]=l(!1),[D,O]=l(i||[]),P=c(async()=>{try{$(!0),O(await o()??[])}catch(e){}finally{$(!1)}},[]);n(()=>{D.length||P()},[]);const[M,L]=l(""),[F,z]=l(null),[V,_]=l([]),B=r(()=>F===hl.BulkConfig?u:F===hl.BulkSource?g:0,[F,u,g]),{supportedConnections:X,supportedConnectionIds:j}=r(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===W.Success,n=Ut(e.odigosVersion,t);return a&&n}))(D,B);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[D.length,B]);n(()=>{if(!F||F===hl.Delete)return;const e=V.filter(e=>!j.includes(e));e.length&&_(t=>t.filter(t=>!e.includes(t)))},[F,V.length,j.length]);const U=r(()=>D.filter(e=>!M||e.name.toLowerCase().includes(M.toLowerCase())).map(e=>({cells:[{key:gl.Id,rawValue:e.id},{key:gl.Name,rawValue:e.name},{key:gl.Type,rawValue:e.type},{key:gl.Status,rawValue:e.status,component:()=>(e=>{const a=e===W.Success?"Connection live":"Connection lost",n=e===W.Success?Xn:jn;return t(le,{status:e,label:a,leftIcon:n})})(e.status)},{key:gl.OdigosVersion,rawValue:e.odigosVersion},{key:gl.ConnectedSince,rawValue:e.connectedAt?I(e.connectedAt):"-"},{key:gl.LastActivity,rawValue:e.lastSeenAt?I(e.lastSeenAt):"-"}],onClick:e.status!==W.Success||F?void 0:()=>s(e),isSelected:V.includes(e.id),onSelect:()=>_(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>_(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==W.Success||F===hl.BulkConfig&&!Ut(e.odigosVersion,u)||F===hl.BulkSource&&!Ut(e.odigosVersion,g)})),[D,V,M,F,u,g]),H=r(()=>{const e=(e,t)=>{_([e]),z(t)};return yl({connections:D,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,hl.Delete),onAddSource:!A&&b&&f?t=>e(t,hl.BulkSource):void 0,onAddDestination:!A&&y&&v&&C?t=>e(t,hl.BulkDestination):void 0,onAddAction:!A&&k?t=>e(t,hl.BulkAction):void 0,onAddInstrumentationRule:!A&&T?t=>e(t,hl.BulkInstrumentationRule):void 0,onEditConfiguration:!A&&p&&h?t=>e(t,hl.BulkConfig):void 0})},[A,D,u,p,h,g,b,f,y,v,C,k,T]),G=r(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:i,onAddInstrumentationRule:o,onManageConfigurations:l}=e,s=[];a&&s.push({id:jt(),type:Wt.Button,buttonProps:{variant:R.Primary,size:E.S,label:"Add Sources",rightIcon:Wn,onClick:a}});const r=[n?{id:hl.BulkDestination,label:ue.ADD_DESTINATION,icon:Vn}:null,i?{id:hl.BulkAction,label:ue.ADD_ACTION,icon:zn}:null,o?{id:hl.BulkInstrumentationRule,label:ue.ADD_INSTRUMENTATION_RULE,icon:Un}:null,l?{id:hl.BulkConfig,label:"Manage Configurations",icon:Gn}:null];return r.some(Boolean)&&s.push({id:jt(),type:Wt.ButtonDropData,buttonProps:{variant:R.Secondary,size:E.S,label:"Bulk Operations",onClick:e=>{e===hl.BulkSource?a?.():e===hl.BulkDestination?n?.():e===hl.BulkAction?i?.():e===hl.BulkInstrumentationRule?o?.():e===hl.BulkConfig&&l?.()}},dropDataProps:{alignX:Xt.Left,items:r}}),s.push({id:jt(),type:Wt.Button,buttonProps:{variant:R.Text,size:E.S,label:it.CANCEL,onClick:t}}),s})({onCancel:()=>_([]),onAddSource:!A&&b&&f?()=>z(hl.BulkSource):void 0,onAddDestination:!A&&y&&v&&C?()=>z(hl.BulkDestination):void 0,onAddAction:!A&&k?()=>z(hl.BulkAction):void 0,onAddInstrumentationRule:!A&&T?()=>z(hl.BulkInstrumentationRule):void 0,onManageConfigurations:!A&&p&&h?()=>z(hl.BulkConfig):void 0}),[A,p,h,b,f,y,v,C,k,T]);return t(Ht,{children:e(Te,{richTitle:{icon:ai,title:ue.CONNECTIONS,badge:{label:D.length.toString(),status:Ue.Unknown}},search:{placeholder:"Search by cluster name",value:M,onChange:e=>L(e),width:"300px"},actions:[{id:jt(),type:Wt.Button,buttonProps:{variant:R.Secondary,size:E.S,leftIcon:ti,onClick:P,disabled:N}}],children:[t(Gt,{variant:Kt.Pretty,maxHeight:a,headerBackgroundColor:x.v2.colors.silver[1e3],isLoading:N,withCheckboxes:!0,columns:bl,rows:U,rowActionsPushRightPosition:F?`calc(${$i} - 24px)`:void 0,getRowActions:H}),F===hl.BulkConfig&&p&&h&&t(Bo,{onClose:()=>z(null),connections:X,selectedConnectionIds:V,setSelectedConnectionIds:_,getEffectiveConfig:p,onApply:h}),F===hl.BulkSource&&b&&f&&t(qt,{selectedConnectionIds:V,children:t(Vo,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:_,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))})}),F===hl.BulkDestination&&y&&v&&S&&C&&w&&t(Yt,{children:t(Do,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:_,getDestinationCategories:y,getPotentialDestinations:v,testConnection:e=>S(e,V),createDestination:e=>C(e,V),updateDestination:(e,t)=>w(e,t,V)})}),F===hl.BulkAction&&k&&t(Jt,{children:t(So,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:_,createAction:e=>k(e,V)})}),F===hl.BulkInstrumentationRule&&T&&t(Qt,{children:t(Eo,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:_,createInstrumentationRule:e=>T(e,V)})}),t(Ii,{target:"connection",isOpen:F===hl.Delete,onClose:()=>{_([]),z(null)},onApprove:async()=>{const e=V[0];e&&(await d(e),await P())}}),t(Zt,{isOpen:!!V.length&&!F,richTitle:{icon:En,title:"Selected Clusters",badge:{label:V.length}},actions:G})]})})},Sl=p.div`
110
110
  display: flex;
111
111
  align-items: center;
112
112
  justify-content: space-between;
@@ -115,26 +115,26 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
115
115
  width: calc(100% - 32px);
116
116
  border-radius: 16px;
117
117
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
118
- `,$i=p.div`
118
+ `,Cl=p.div`
119
119
  display: flex;
120
120
  align-items: center;
121
121
  justify-content: center;
122
122
  padding: 8px;
123
123
  border-radius: 8px;
124
- background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
125
- `,Ri=({setStep:a,onSave:n,sourcesPayload:o,destinationsPayload:i,disableAnimation:l})=>{const s=m(),c=()=>a(2),d=()=>a(3),u=r(()=>Object.values(o||{}).flatMap((a,n)=>a.map((a,o)=>{if(!a.selected)return null;const i=a.kind||Ge.Namespace,l=i===Ge.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(Ei,{children:[t(M,{nowrap:!0,children:l}),t(oe,{label:i,status:X.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${n}-${o}`)})).filter(Boolean),[o]),p=r(()=>i?.map((a,n)=>{const o=Re(a.option.type).icon;return e(Ei,{children:[e(D,{$gap:8,children:[o&&t($i,{children:t(o,{size:24})}),t(M,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(oe,{status:a.testResult.succeeded?X.Success:X.Error,leftIcon:a.testResult.succeeded?on:ln})]},`destination-${n}`)})||[],[i]);return t(zn,{isOpen:!0,disableAnimation:l,onBack:()=>a(3),onSave:n,header:{icon:Cn,title:Te.SUMMARY,subTitle:Te.REVIEW_SETUP},leftColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(rn,{size:24}),t(M,{nowrap:!0,children:Te.SELECTED_SOURCES}),t(oe,{label:u.length})]}),t(E,{"data-id":"summary-edit-sources",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:c})]}),list:u.length?u:[t(ke,{$height:"100%",children:t(F,{icon:rn,title:Te.NO_SOURCES_SELECTED,subTitle:Te.ADD_SOURCE_PROMPT,button:{leftIcon:Ha,label:Te.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(tn,{size:24}),t(M,{nowrap:!0,children:Te.SELECTED_DESTINATIONS}),t(oe,{label:p.length})]}),t(E,{"data-id":"summary-edit-destinations",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:d})]}),list:p.length?p:[t(ke,{"data-id":"summary-no-destinations",$height:"100%",children:t(F,{icon:tn,title:Te.NO_DESTINATIONS_SELECTED,subTitle:Te.ADD_DESTINATION_PROMPT,button:{leftIcon:Ha,label:Te.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},xi=p.div`
124
+ background-color: ${({theme:e})=>e.v2.colors.white[500]+Ae["004"]};
125
+ `,wl=({setStep:a,onSave:n,sourcesPayload:i,destinationsPayload:o,disableAnimation:l})=>{const s=m(),c=()=>a(2),d=()=>a(3),u=r(()=>Object.values(i||{}).flatMap((a,n)=>a.map((a,i)=>{if(!a.selected)return null;const o=a.kind||Qe.Namespace,l=o===Qe.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(Sl,{children:[t(F,{nowrap:!0,children:l}),t(le,{label:o,status:W.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${n}-${i}`)})).filter(Boolean),[i]),p=r(()=>o?.map((a,n)=>{const i=Le(a.option.type).icon;return e(Sl,{children:[e($,{$gap:8,children:[i&&t(Cl,{children:t(i,{size:24})}),t(F,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(le,{status:a.testResult.succeeded?W.Success:W.Error,leftIcon:a.testResult.succeeded?Xn:jn})]},`destination-${n}`)})||[],[o]);return t(Ai,{isOpen:!0,disableAnimation:l,onBack:()=>a(3),onSave:n,header:{icon:ni,title:ue.SUMMARY,subTitle:ue.REVIEW_SETUP},leftColumn:{width:"50%",header:e($,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e($,{$gap:8,children:[t(Wn,{size:24}),t(F,{nowrap:!0,children:ue.SELECTED_SOURCES}),t(le,{label:u.length})]}),t(D,{"data-id":"summary-edit-sources",leftIcon:Pn,variant:R.Secondary,size:E.S,onClick:c})]}),list:u.length?u:[t($e,{$height:"100%",children:t(L,{icon:Wn,title:ue.NO_SOURCES_SELECTED,subTitle:ue.ADD_SOURCE_PROMPT,button:{leftIcon:$n,label:ue.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:e($,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e($,{$gap:8,children:[t(Vn,{size:24}),t(F,{nowrap:!0,children:ue.SELECTED_DESTINATIONS}),t(le,{label:p.length})]}),t(D,{"data-id":"summary-edit-destinations",leftIcon:Pn,variant:R.Secondary,size:E.S,onClick:d})]}),list:p.length?p:[t($e,{"data-id":"summary-no-destinations",$height:"100%",children:t(L,{icon:Vn,title:ue.NO_DESTINATIONS_SELECTED,subTitle:ue.ADD_DESTINATION_PROMPT,button:{leftIcon:$n,label:ue.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},kl=p.div`
126
126
  position: relative;
127
127
  overflow: hidden;
128
128
  width: calc(100vw - ${({$paddingXAxis:e})=>e});
129
129
  height: calc(100vh - ${({$paddingYAxis:e})=>e});
130
130
  box-sizing: border-box;
131
- `,Oi=p.svg`
131
+ `,Tl=p.svg`
132
132
  position: absolute;
133
133
  top: 50%;
134
134
  left: 50%;
135
135
  transform: translate(-50%, -50%);
136
136
  z-index: -1;
137
- `,Pi=[{opacity:"0.1"},{offset:"0.31",opacity:"0.11"},{offset:"0.45",opacity:"0.14"},{offset:"0.56",opacity:"0.19"},{offset:"0.65",opacity:"0.26"},{offset:"0.73",opacity:"0.35"},{offset:"0.8",opacity:"0.46"},{offset:"0.86",opacity:"0.6"},{offset:"0.92",opacity:"0.76"},{offset:"0.98",opacity:"0.93"},{offset:"1"}],Fi=[{width:1440,height:900,pathOpacity:.1,path:"M719.992 1169.99C322.351 1169.99 0 847.64 0 450C0 52.3591 322.351 -269.992 719.992 -269.992C1117.63 -269.992 1439.98 52.3591 1439.98 450C1439.98 847.64 1117.63 1169.99 719.992 1169.99Z",gradientTransform:"translate(814.309 444.011) rotate(180) scale(718.904)",stops:[{opacity:"0.1"},{offset:"0.41",opacity:"0.11"},{offset:"0.56",opacity:"0.13"},{offset:"0.67",opacity:"0.18"},{offset:"0.75",opacity:"0.25"},{offset:"0.83",opacity:"0.33"},{offset:"0.89",opacity:"0.44"},{offset:"0.95",opacity:"0.56"},{offset:"1",opacity:"0.7"}]},{width:1343,height:900,pathOpacity:.3,path:"M671.344 1121.34C300.571 1121.34 0 820.773 0 450C0 79.2264 300.571 -221.345 671.344 -221.345C1042.12 -221.345 1342.69 79.2264 1342.69 450C1342.69 820.773 1042.12 1121.34 671.344 1121.34Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:Pi},{width:1163,height:900,pathOpacity:.5,path:"M581.31 1031.31C260.261 1031.31 0 771.048 0 449.999C0 128.951 260.261 -131.311 581.31 -131.311C902.358 -131.311 1162.62 128.951 1162.62 449.999C1162.62 771.048 902.358 1031.31 581.31 1031.31Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:Pi},{width:798,height:798,pathOpacity:.7,path:"M398.581 797.162C178.451 797.162 0 618.711 0 398.581C0 178.451 178.451 0 398.581 0C618.711 0 797.162 178.451 797.162 398.581C797.162 618.711 618.711 797.162 398.581 797.162Z",gradientTransform:"translate(445.003 392.441) rotate(180) scale(398.23)",stops:Pi}],Mi=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:i})=>{const[s,c]=l(window.innerWidth),d=r(()=>s/Fi[0].width,[s]);return n(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(xi,{$paddingXAxis:a,$paddingYAxis:o,children:[Fi.map(({width:a,height:n,pathOpacity:o,path:i,gradientTransform:l,stops:s},r)=>{const c=`purple-ring-${r}`;return e(Oi,{width:a*d,height:"100%",viewBox:`0 0 ${a} ${n}`,fill:"none",children:[t("path",{opacity:o,d:i,fill:`url(#${c})`}),t("defs",{children:t("radialGradient",{id:c,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:l,children:s.map(({offset:e,opacity:a},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},c)}),i]})},Li=p.div`
137
+ `,xl=[{opacity:"0.1"},{offset:"0.31",opacity:"0.11"},{offset:"0.45",opacity:"0.14"},{offset:"0.56",opacity:"0.19"},{offset:"0.65",opacity:"0.26"},{offset:"0.73",opacity:"0.35"},{offset:"0.8",opacity:"0.46"},{offset:"0.86",opacity:"0.6"},{offset:"0.92",opacity:"0.76"},{offset:"0.98",opacity:"0.93"},{offset:"1"}],Al=[{width:1440,height:900,pathOpacity:.1,path:"M719.992 1169.99C322.351 1169.99 0 847.64 0 450C0 52.3591 322.351 -269.992 719.992 -269.992C1117.63 -269.992 1439.98 52.3591 1439.98 450C1439.98 847.64 1117.63 1169.99 719.992 1169.99Z",gradientTransform:"translate(814.309 444.011) rotate(180) scale(718.904)",stops:[{opacity:"0.1"},{offset:"0.41",opacity:"0.11"},{offset:"0.56",opacity:"0.13"},{offset:"0.67",opacity:"0.18"},{offset:"0.75",opacity:"0.25"},{offset:"0.83",opacity:"0.33"},{offset:"0.89",opacity:"0.44"},{offset:"0.95",opacity:"0.56"},{offset:"1",opacity:"0.7"}]},{width:1343,height:900,pathOpacity:.3,path:"M671.344 1121.34C300.571 1121.34 0 820.773 0 450C0 79.2264 300.571 -221.345 671.344 -221.345C1042.12 -221.345 1342.69 79.2264 1342.69 450C1342.69 820.773 1042.12 1121.34 671.344 1121.34Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:xl},{width:1163,height:900,pathOpacity:.5,path:"M581.31 1031.31C260.261 1031.31 0 771.048 0 449.999C0 128.951 260.261 -131.311 581.31 -131.311C902.358 -131.311 1162.62 128.951 1162.62 449.999C1162.62 771.048 902.358 1031.31 581.31 1031.31Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:xl},{width:798,height:798,pathOpacity:.7,path:"M398.581 797.162C178.451 797.162 0 618.711 0 398.581C0 178.451 178.451 0 398.581 0C618.711 0 797.162 178.451 797.162 398.581C797.162 618.711 618.711 797.162 398.581 797.162Z",gradientTransform:"translate(445.003 392.441) rotate(180) scale(398.23)",stops:xl}],Il=({paddingXAxis:a="0px",paddingYAxis:i="0px",children:o})=>{const[s,c]=l(window.innerWidth),d=r(()=>s/Al[0].width,[s]);return n(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(kl,{$paddingXAxis:a,$paddingYAxis:i,children:[Al.map(({width:a,height:n,pathOpacity:i,path:o,gradientTransform:l,stops:s},r)=>{const c=`purple-ring-${r}`;return e(Tl,{width:a*d,height:"100%",viewBox:`0 0 ${a} ${n}`,fill:"none",children:[t("path",{opacity:i,d:o,fill:`url(#${c})`}),t("defs",{children:t("radialGradient",{id:c,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:l,children:s.map(({offset:e,opacity:a},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},c)}),o]})},Nl=p.div`
138
138
  display: flex;
139
139
  flex-direction: column;
140
140
  align-items: center;
@@ -145,7 +145,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
145
145
  width: 50vw;
146
146
  border-radius: 16px;
147
147
  background: ${({theme:e})=>e.v2.colors.silver[900]};
148
- `,Vi=p.div`
148
+ `,$l=p.div`
149
149
  display: flex;
150
150
  flex-direction: column;
151
151
  align-items: center;
@@ -155,48 +155,349 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
155
155
  & * {
156
156
  text-align: center;
157
157
  }
158
- `,Bi=({onStart:a})=>t(Qe,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ke,{$height:"100%",children:e(Li,{children:[e(Vi,{children:[t(M,{size:L.L,weight:500,children:Te.GET_STARTED_WITH}),t(Xn,{size:260}),t(M,{size:L.S,weight:400,children:Te.GET_STARTED_DESCRIPTION})]}),t(E,{"data-id":"onboarding-get-started",label:Ze.GET_STARTED,rightIcon:Sn,size:$.L,onClick:a})]})})}),zi=[{step:1,label:Te.INSTALLATION,forceDoneBadge:!0},{step:2,label:Te.SOURCES_SETUP},{step:3,label:Te.DESTINATIONS_SETUP},{step:4,label:Te.SUMMARY}],_i=p.div`
158
+ `,Dl=({onStart:a})=>t(nt,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t($e,{$height:"100%",children:e(Nl,{children:[e($l,{children:[t(F,{size:z.L,weight:500,children:ue.GET_STARTED_WITH}),t(Di,{size:260}),t(F,{size:z.S,weight:400,children:ue.GET_STARTED_DESCRIPTION})]}),t(D,{"data-id":"onboarding-get-started",label:it.GET_STARTED,rightIcon:ii,size:E.L,onClick:a})]})})}),El=[{step:1,label:ue.INSTALLATION,forceDoneBadge:!0},{step:2,label:ue.SOURCES_SETUP},{step:3,label:ue.DESTINATIONS_SETUP},{step:4,label:ue.SUMMARY}],Rl=p.div`
159
159
  display: flex;
160
160
  flex-direction: column;
161
161
  gap: 32px;
162
162
  padding: 64px;
163
- `,Ui=({pagePaddingXAxis:a,pagePaddingYAxis:n,fetchNamespacesWithWorkloads:o,persistSources:i,getDestinationCategories:s,getPotentialDestinations:r,testConnection:c,createDestination:d,updateDestination:u,onDone:p})=>{const[m,h]=l(1),[g,b]=l(!1),[f,y]=l(null),[v,C]=l(null),S=()=>h(e=>e+1),w=()=>h(e=>e-1);return e(Mi,{paddingXAxis:a,paddingYAxis:n,children:[e(_i,{children:[t(Xn,{}),t(qt,{currentStep:m,data:zi,gap:32})]}),t(Ht,{initialInputs:f,children:e(Wt,{children:[1===m&&t(Bi,{onStart:S}),2===m&&t(qo,{disableAnimation:!0,onBack:e=>{y(e),w()},onNext:e=>{y(e),S()},fetchNamespacesWithWorkloads:o,persistSources:i}),3===m&&t(_o,{disableAnimation:!0,onBack:e=>{C(e),w()},onNext:e=>{C(e),S()},getDestinationCategories:s,getPotentialDestinations:r,initialInputs:v,testConnection:c,createDestination:d,updateDestination:u}),4===m&&t(Ri,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!g){b(!0);try{const e=[];f&&e.push(i(f)),v&&e.push(...v.map(e=>d(e.formData)));const t=await Promise.allSettled(e),a=[];for(const e of t)"rejected"===e.status?a.push(e.reason?.message||String(e.reason)):e.value?.error&&a.push(e.value.error);if(a.length)return{error:a.join("\n")};p()}catch(e){return b(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:f,destinationsPayload:v})]})})]})};var ji;!function(e){e.Gateway="gateway",e.Node="node"}(ji||(ji={}));const Xi=({onClickDownloadDiagnose:a,onClickRefresh:n,loading:o,disabled:i})=>{const l=r(()=>{const e=[];return a&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Download Diagnose",leftIcon:bn,size:$.S,variant:R.Text,onClick:a,disabled:i}}),n&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:n,disabled:i,loading:o}}),e},[a,n,i,o]);return e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(Jt,{icon:wn,title:"Collectors Pipeline"}),t(Qt,{actions:l})]})},Hi=({pod:a,getExtendedPodInfo:o,onClose:i})=>{const{formatTimeAgo:s}=Pt(),[c,d]=l(null);n(()=>{a?o(a.namespace,a.name).then(e=>d(e??null)):d(null)},[a]);const u=r(()=>[{id:Bt(),title:"Node",label:c?.node??"-",withCopy:!0},{id:Bt(),title:"Status",badge:{status:Zt(c?.status),label:c?.status??"-"}}],[c]),p=r(()=>c?.containers?.map(e=>({id:Bt(),items:[{id:Bt(),title:"Container",label:e.name??"-"},{id:Bt(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:Bt(),title:"Ready",badge:{status:e.ready?X.Success:X.Error,leftIcon:e.ready?Ga:Ka,label:e.ready?"True":"False",invertColors:!0}},{id:Bt(),title:"Started",badge:{status:e.started?X.Success:X.Error,leftIcon:e.started?Ga:Ka,label:e.started?"True":"False",invertColors:!0}},{id:Bt(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Bt(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Bt(),title:"Restarts",label:e.restarts.toString()},{id:Bt(),title:"State Reason",label:e.stateReason??"-"},{id:Bt(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Bt(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return t(Qe,{isOpen:!!a,header:{icon:kn,title:"Pod Information",onClose:i},children:c?e(tt,{bgTint:"1000",richTitle:{icon:kn,title:c.name,withCopy:!0},children:[t(tt,{bgTint:"900",cellsPerRow:2,items:u}),e(tt,{bgTint:"900",richTitle:{icon:fn,title:"Kubectl Commands"},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(ea,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),t(ea,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),t(ea,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]}),t(tt,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:p.length?p.map(({id:e,items:a})=>t(tt,{bgTint:"800",cellsPerRow:2,items:a},e)):t(F,{title:"No containers",subTitle:"Pod has no containers"})}),t(Wn,{bgTint:"900",yaml:c.manifestYAML,defaultOpen:!0})]}):t(ke,{$height:"50vh",children:t(Ee,{withSpinner:!0})})})};var Wi;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Wi||(Wi={}));const Gi=[{key:Wi.PodName,label:"Pod Name"},{key:Wi.Status,label:"Status"},{key:Wi.Restarts,label:"Restarts"},{key:Wi.NodeName,label:"Node Name"},{key:Wi.Age,label:"Age"},{key:Wi.DockerImage,label:"Collector Version"}],Ki=({isLoading:a,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:i})=>{const s=m(),{formatTimeAgo:c}=Pt(),[d,u]=l(null),p=r(()=>o.map(a=>({onClick:()=>u(a),cells:[{key:Wi.PodName,rawValue:a.name},{key:Wi.Status,rawValue:a.status,component:()=>{return e=a.status,t(oe,{status:Zt(e),label:e});var e}},{key:Wi.Restarts,rawValue:a.restartsCount.toString()},{key:Wi.NodeName,rawValue:a.nodeName},{key:Wi.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(M,{children:"-"});const o=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),i=o>0?Math.round((n?.metricsDroppedRps??0)/o*100):0,l=i>0?X.Error:X.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?X.Error:X.Success;return e(D,{$gap:4,children:[t(q,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(oe,{status:l,label:`Receiver ${i}%`,leftIcon:l===X.Error?Tn:An,useSecondaryTone:!0,invertColors:!0})}),t(q,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(oe,{status:c,label:`Exporter ${r}%`,leftIcon:c===X.Error?Tn:An,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Wi.Age,rawValue:c(a.creationTimestamp)},{key:Wi.DockerImage,rawValue:a.image}]})),[o,s]);return e(tt,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:kn,title:"Pods"},children:[t(jt,{variant:Xt.Data,maxHeight:n,isLoading:a,columns:Gi,rows:p}),t(Hi,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})},Yi=({isOpen:e,onClose:a,title:n,yaml:o})=>t(Qe,{isOpen:e,header:{icon:Nn,title:n,onClose:a},children:t(Wn,{yaml:o,defaultOpen:!0})}),qi=e=>{switch(e){case ta.Healthy:return"All desired replicas are updated, available, and ready";case ta.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ta.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ta.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ta.Down:return"No available replicas";case ta.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var Ji;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Ji||(Ji={}));const Qi=p.div`
163
+ `,Ol=({pagePaddingXAxis:a,pagePaddingYAxis:n,fetchNamespacesWithWorkloads:i,persistSources:o,getDestinationCategories:s,getPotentialDestinations:r,testConnection:c,createDestination:d,updateDestination:u,onDone:p})=>{const[m,h]=l(1),[g,b]=l(!1),[f,y]=l(null),[v,S]=l(null),C=()=>h(e=>e+1),w=()=>h(e=>e-1);return e(Il,{paddingXAxis:a,paddingYAxis:n,children:[e(Rl,{children:[t(Di,{}),t(ea,{currentStep:m,data:El,gap:32})]}),t(qt,{initialInputs:f,children:e(Yt,{children:[1===m&&t(Dl,{onStart:C}),2===m&&t(Vo,{disableAnimation:!0,onBack:e=>{y(e),w()},onNext:e=>{y(e),C()},fetchNamespacesWithWorkloads:i,persistSources:o}),3===m&&t(Do,{disableAnimation:!0,onBack:e=>{S(e),w()},onNext:e=>{S(e),C()},getDestinationCategories:s,getPotentialDestinations:r,initialInputs:v,testConnection:c,createDestination:d,updateDestination:u}),4===m&&t(wl,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!g){b(!0);try{const e=[];f&&e.push(o(f)),v&&e.push(...v.map(e=>d(e.formData)));const t=await Promise.allSettled(e),a=[];for(const e of t)"rejected"===e.status?a.push(e.reason?.message||String(e.reason)):e.value?.error&&a.push(e.value.error);if(a.length)return{error:a.join("\n")};p()}catch(e){return b(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:f,destinationsPayload:v})]})})]})},Pl=e=>(e||[]).filter(e=>!!e.id).map(e=>String(e.id)),Ml=e=>{const t=new Set,a=[];return e.forEach(e=>{t.has(e.id)||(t.add(e.id),a.push(e))}),a},Ll=e=>{let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)&&(t+=e.length)}),e.onlyErrors&&t++,t},Fl=p.div`
164
+ position: relative;
165
+ display: inline-flex;
166
+ `,zl=p.button`
167
+ display: inline-flex;
168
+ align-items: center;
169
+ gap: 8px;
170
+ height: 32px;
171
+ padding: 0 12px;
172
+ border: none;
173
+ border-radius: 6px;
174
+ cursor: pointer;
175
+ background-color: ${({$isOpen:e,theme:t})=>e?t.v2.colors.silver[700]:t.v2.colors.silver[800]};
176
+ &:hover {
177
+ background-color: ${({theme:e})=>e.v2.colors.silver[700]};
178
+ }
179
+ `,Vl=p.div`
180
+ position: absolute;
181
+ top: calc(100% + 8px);
182
+ right: 0;
183
+ width: 380px;
184
+ max-width: 90vw;
185
+ z-index: ${({theme:e})=>e.v2.zIndex.popover};
186
+
187
+ display: flex;
188
+ flex-direction: column;
189
+ border-radius: 12px;
190
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
191
+ box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
192
+ `,_l=p.div`
193
+ display: flex;
194
+ flex-direction: column;
195
+ gap: 12px;
196
+ padding: 16px;
197
+ max-height: 60vh;
198
+ overflow-y: auto;
199
+ `,Bl=p.div`
200
+ display: flex;
201
+ align-items: center;
202
+ gap: 8px;
203
+ padding: 12px 16px;
204
+ border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
205
+ `,Xl=p.div`
206
+ display: flex;
207
+ align-items: center;
208
+ gap: 8px;
209
+ margin-left: auto;
210
+ `,jl=()=>{const a=m(),i=Ve(e=>e.sources),o=Ve(e=>e.namespaces),{selectedStreamName:s}=pe(),{getItemSS:c,setItemSS:u,removeItemSS:p}=la(),{namespaces:h,kinds:g,monitors:b,languages:f,onlyErrors:y,podsAgentInjectionStatus:v,setAll:S,clearAll:C,getEmptyState:w}=ta(),k=r(()=>aa(i,s),[i,s]);n(()=>{const e=c(na.OVERVIEW_FILTERS,w());S(e)},[]);const[T,A]=l({namespaces:h,kinds:g,monitors:b,languages:f,onlyErrors:y,podsAgentInjectionStatus:v}),[I,N]=l(Ll(T)),[$,O]=l(!1);n(()=>{if(!$){const e={namespaces:h,kinds:g,monitors:b,languages:f,onlyErrors:y,podsAgentInjectionStatus:v};A(e),N(Ll(e))}},[$,h,g,b,f,y,v]);const P=d(null);ia(P,()=>O(!1)),Ft({key:"Escape",active:$},()=>O(!1));const M=r(()=>Ml(o.map(({name:e})=>({id:e,label:e,withCheckbox:!0}))),[o]),L=r(()=>Ml(k.map(({kind:e})=>({id:e,label:e,withCheckbox:!0}))),[k]),V=r(()=>{const e=[];return k.forEach(({containers:t})=>{t?.forEach(t=>{const a=t.overrides?.runtimeInfo?.language??t.runtimeInfo?.language;a&&e.push({id:a,label:se[a]||String(a),withCheckbox:!0})})}),Ml(e).sort((e,t)=>e.id.localeCompare(t.id))},[k]),_=r(()=>oa.map(({id:e,value:t})=>({id:e,label:t,withCheckbox:!0})),[]),B=r(()=>{const e=[];return k.forEach(({podsAgentInjectionStatus:t})=>{const{reasonEnum:a,message:n}=t||{};a?e.push({id:a,label:mt(a)}):n&&e.push({id:n,label:n,withCheckbox:!0})}),Ml(e)},[k]),X=(e,t,a)=>{const n=t.filter(e=>a.includes(e.id));A(t=>{return{...t,[e]:(a=n,a.map(({id:e,label:t})=>({id:e,label:t})))};var a})},j=$?_n:Bn,U=r(()=>Pl(T.languages),[T.languages]);return e(Fl,{ref:P,children:[e(zl,{"data-id":"filters-trigger",$isOpen:$,type:"button",onClick:()=>O(e=>!e),children:[t(oi,{size:16,fill:a.v2.colors.white[500]}),t(F,{size:z.XS,weight:500,nowrap:!0,children:"Filters"}),I>0&&t(le,{label:I,status:Ue.Unknown,textSize:z.XXXS}),t(j,{size:16,fill:a.v2.colors.silver[200]})]}),$&&e(Vl,{children:[e(_l,{children:[t(Ee,{label:"Namespace",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!M.length,options:M,values:Pl(T.namespaces),setValues:e=>X("namespaces",M,e)}),t(Ee,{label:"Kind",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!L.length,options:L,values:Pl(T.kinds),setValues:e=>X("kinds",L,e)}),t(Ee,{label:"Programming Language",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!V.length,options:V,values:U,setValues:e=>X("languages",V,e)}),t(Ee,{label:"Monitors",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!_.length,options:_,values:Pl(T.monitors),setValues:e=>X("monitors",_,e)}),t(Ee,{label:"Agent Injection Status",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!B.length,options:B,values:Pl(T.podsAgentInjectionStatus),setValues:e=>X("podsAgentInjectionStatus",B,e)}),t(x,{label:"Show only sources with errors",size:He.L,value:!!T.onlyErrors,onChange:e=>A(t=>({...t,onlyErrors:e}))})]}),e(Bl,{children:[t(D,{"data-id":"filters-reset",size:E.S,variant:R.Text,label:"Reset",onClick:()=>{p(na.OVERVIEW_FILTERS),C(),A(w()),N(0),O(!1)},textColor:a.v2.colors.red[500]}),e(Xl,{children:[t(D,{"data-id":"filters-cancel",size:E.S,variant:R.Secondary,label:"Cancel",onClick:()=>O(!1)}),t(D,{"data-id":"filters-apply",size:E.S,variant:R.Primary,label:"Apply",onClick:()=>{u(na.OVERVIEW_FILTERS,T),S(T),N(Ll(T)),O(!1)}})]})]})]})]})},Ul=p.div`
211
+ position: relative;
212
+ width: ${({$width:e})=>e};
213
+ `,Wl=p.div`
214
+ position: absolute;
215
+ top: calc(100% + 8px);
216
+ left: 0;
217
+ width: fit-content;
218
+ max-width: 90vw;
219
+ z-index: ${({theme:e})=>e.v2.zIndex.popover};
220
+
221
+ display: flex;
222
+ flex-direction: column;
223
+ gap: 8px;
224
+ padding: 8px;
225
+ border-radius: 12px;
226
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
227
+ box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
228
+ `,Hl=p.div`
229
+ display: flex;
230
+ align-items: center;
231
+ overflow-x: auto;
232
+ `,Gl=p.div`
233
+ display: flex;
234
+ flex-direction: column;
235
+ gap: 0;
236
+ max-height: 320px;
237
+ overflow-y: auto;
238
+ `,Kl=p.div`
239
+ padding: 8px 12px 4px 12px;
240
+ `,ql=p.div`
241
+ display: flex;
242
+ align-items: center;
243
+ gap: 8px;
244
+ padding: 8px 12px;
245
+ border-radius: 6px;
246
+ cursor: pointer;
247
+ &:hover {
248
+ background-color: ${({theme:e})=>e.v2.colors.silver[700]};
249
+ }
250
+ `,Yl=p.div`
251
+ padding: 16px 8px;
252
+ `,Jl=({width:a="300px",preventPopup:n=!1})=>{const o=m(),{onClickNode:s}=sa(),{searchText:c,setSearchText:u}=ta(),{selectedStreamName:p}=pe(),h=Ve(e=>e.sources),g=Ve(e=>e.destinations),b=Ve(e=>e.actions),f=Ve(e=>e.instrumentationRules),y=d(null),[v,S]=l(!1),[C,w]=l("all"),k=!n&&(!!c||v),T=()=>{u(""),S(!1),w("all")};ia(y,()=>T()),Ft({key:"Escape",active:k},T);const{categories:x,searchResults:A}=r(()=>(({instrumentationRules:e,sources:t,actions:a,destinations:n,searchText:i,selectedCategory:o})=>{const l=i?e.filter(e=>e.type?.toLowerCase().includes(i)||e.ruleName?.toLowerCase().includes(i)):e,s=i?t.filter(e=>e.name?.toLowerCase().includes(i)||e.otelServiceName?.toLowerCase().includes(i)||e.namespace?.toLowerCase().includes(i)):t,r=i?a.filter(e=>e.type?.toLowerCase().includes(i)||e.name?.toLowerCase().includes(i)):a,c=i?n.filter(e=>e.destinationType.displayName?.toLowerCase().includes(i)||e.name?.toLowerCase().includes(i)):n,d=[{category:Qe.Source,label:"Sources",count:s.length,entities:[]},{category:Qe.Action,label:"Actions",count:r.length,entities:[]},{category:Qe.Destination,label:"Destinations",count:c.length,entities:[]},{category:Qe.InstrumentationRule,label:"Instrumentation Rules",count:l.length,entities:[]}];d.unshift({category:"all",label:"All",count:l.length+s.length+r.length+c.length,entities:[]});const u=d.filter(({count:e,category:t})=>!!e&&"all"!==t&&["all",t].includes(o)).map(e=>({...e,entities:e.category===Qe.InstrumentationRule?l:e.category===Qe.Source?s:e.category===Qe.Action?r:e.category===Qe.Destination?c:[]}));return{categories:d,searchResults:u}})({instrumentationRules:f,sources:aa(h,p),actions:b,destinations:ut(g,p),searchText:c,selectedCategory:C}),[f,h,b,g,p,c,C]),I=r(()=>x.filter(({count:e,category:t})=>!!e||"all"===t).map(({category:e,label:t,count:a})=>({value:e,label:a?`${t} (${a})`:t})),[x]),N=A.some(({entities:e})=>e.length>0);return e(Ul,{ref:y,$width:a,children:[t(ra,{value:c,onChange:e=>u(e.toLowerCase()),onFocus:()=>S(!0),width:"100%"}),k&&e(Wl,{children:[I.length>1&&t(Hl,{children:t(_,{size:ke.S,options:I,selected:C,setSelected:w})}),N?t(Gl,{children:A.map(({category:a,label:n,entities:l},r)=>{if(!l.length)return null;const c=da(a);return e(i,{children:[t(Kl,{children:t(F,{size:z.XXS,color:Y.Secondary,children:n})}),l.map((n,i)=>e(ql,{onClick:()=>{const e=at(n);s(null,{data:{type:a,id:e}}),T()},children:[c&&t(c,{size:16,fill:o.v2.colors.white[500]}),t(F,{size:z.XS,nowrap:!0,children:ca(n,a,{extended:!0})})]},`entity-${r}-${i}`))]},`category-list-${a}`)})}):t(Yl,{children:t(L,{hideIcon:!0,title:"No results",subTitle:c?`No matches for "${c}"`:"Start typing to search"})})]})]})},Ql=p.div`
253
+ position: relative;
254
+ display: flex;
255
+ align-items: center;
256
+ gap: 8px;
257
+ width: 100%;
258
+ height: 52px;
259
+ padding: 4px 16px;
260
+ box-sizing: border-box;
261
+ border-radius: 16px 16px 0 0;
262
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
263
+ `,Zl=p.div`
264
+ position: absolute;
265
+ bottom: 0;
266
+ left: 0;
267
+ height: 3px;
268
+ width: ${({$percent:e})=>`${e}%`};
269
+ background-color: ${({theme:e})=>e.v2.colors.purple[500]};
270
+ border-radius: 32px;
271
+ transition: width 0.3s;
272
+ `,es=({entityType:a,badge:n,badgeTooltip:i,isLoading:o,refetch:l,partiallySelected:s,allSelected:r,onSelectAll:c,progressPercent:d})=>{const{setCurrentModal:u}=ua();return e(Ql,{children:[e($,{$gap:8,style:{flex:1,minWidth:0},children:[c&&t(y,{size:pa.S,partiallyChecked:s,value:!!r,onChange:c}),t(F,{size:z.S,nowrap:!0,children:`${mt(a)}s`}),t(le,{label:n,tooltip:i,status:Ue.Unknown,textSize:z.XXXS})]}),e($,{children:[t(Re,{"data-id":`add-${a}`,icon:$n,onClick:()=>u(a)}),t(Re,{"data-id":`refresh-${a}`,icon:ti,onClick:l,disabled:o})]}),"number"==typeof d&&t(Zl,{$percent:d})]})},ts=p(b)`
273
+ align-items: center !important;
274
+ justify-content: center !important;
275
+ align-self: stretch;
276
+ min-height: 80px;
277
+ width: calc(100% - 32px);
278
+ padding: 16px;
279
+ gap: 4px;
280
+ border-radius: 12px;
281
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
282
+ cursor: pointer;
283
+
284
+ &:hover {
285
+ background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
286
+ }
287
+ `,as=({entityType:a,description:n})=>{const{setCurrentModal:i}=ua();return e(ts,{onClick:()=>i(a),children:[e($,{$gap:4,children:[t($n,{size:16}),t(F,{size:z.S,children:`Add ${mt(a)}`})]}),t(F,{size:z.XXS,align:"center",children:n})]})},ns=p.div`
288
+ display: flex;
289
+ align-items: center;
290
+ gap: 12px;
291
+ width: 100%;
292
+ height: 54px;
293
+ padding: 4px 8px;
294
+ box-sizing: border-box;
295
+ border-radius: 8px;
296
+ cursor: pointer;
297
+ opacity: ${({$faded:e})=>e?.5:1};
298
+
299
+ &:hover {
300
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
301
+ }
302
+ `,is=p.div`
303
+ display: flex;
304
+ align-items: center;
305
+ justify-content: center;
306
+ flex-shrink: 0;
307
+ width: 32px;
308
+ height: 32px;
309
+ padding: 0 8px;
310
+ box-sizing: border-box;
311
+ border-radius: 8px;
312
+ background-color: ${({theme:e})=>e.v2.colors.white[500]+Ae["004"]};
313
+ `,os=p.div`
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ width: 16px;
318
+ height: 16px;
319
+ padding: 1px;
320
+ box-sizing: border-box;
321
+ border-radius: 3.5px;
322
+ background-color: ${({theme:e})=>e.v2.colors.white[500]+Ae["004"]};
323
+ `,ls=p($)`
324
+ flex: 1;
325
+ min-width: 0;
326
+ `,ss=(a,n)=>{if(a&&a.length>1){const n=a.slice(0,4),i=a.length-4,o=n.slice(0,2),l=n.slice(2);return e(b,{$gap:1,children:[t($,{$gap:1,children:o.map((e,a)=>t(os,{children:t(e,{size:12})},`top-${a}`))}),l.length>0&&e($,{$gap:1,children:[l.map((e,a)=>t(os,{children:t(e,{size:12})},`bot-${a}`)),i>0&&t(os,{children:t(F,{size:z.XXXS,weight:500,children:`+${i}`})})]})]})}const i=a?.[0]||n;return t(is,{children:i?t(i,{size:20}):null})},rs=({entityId:a,entityType:n,title:i,status:o,faded:l,tooltip:s,throughput:c,icon:d,icons:u,iconSrc:p,isActive:h,raw:g})=>{const b=m(),f=n===Qe.Source,v="boolean"==typeof h,S=l||v&&!h,{setDrawerType:C,setDrawerEntityId:w}=ma(),{selectedSources:k,setSelectedSources:T}=ha(),x=g,A=f?x.namespace:"",I=r(()=>{if(!f)return-1;const e=k[A];return e?.length?e.findIndex(e=>e.name===x.name&&e.kind===x.kind):-1},[f,k,A,x.name,x.kind]),N=v&&!h?ba(W.Info,b):o?ba(o,b):void 0,D=f&&"object"==typeof a?`${a.namespace}-${a.name}-${a.kind}`:a;return e(ns,{"data-id":D,$faded:S,onClick:()=>{C(n),w(a)},children:[f&&t(y,{size:pa.S,value:-1!==I,onChange:()=>{const e={...k};e[A]||(e[A]=[]),-1===I?e[A].push(x):e[A].splice(I,1),T(e)}}),p?t(is,{children:t("img",{src:p,alt:i,width:20,height:20})}):ss(u,d),e(ls,{$gap:4,children:[t(ga,{size:z.XS,nowrap:!0,children:i}),t($,{$gap:6,$justifyContent:"flex-end",style:{marginLeft:"auto",flexShrink:0},children:c&&t(Q,{text:s||"Heads up! The data-flow metrics you see are calculated over 10-second intervals.",children:t(le,{label:c,status:o&&[W.Error,W.Warning].includes(o)?o:Ue.Unknown,leftIcon:N,textSize:z.XXXS})})})]})]})};function cs(e){const t=e.conditions?.some(({status:e})=>e===ya.Loading);return t?e:{...e,conditions:[{status:ya.Loading,type:"Pending",message:""}]}}function ds(e){const t=e.conditions?.filter(({status:e})=>e!==ya.Loading);return t?.length===e.conditions?.length?e:{...e,conditions:t?.length?t:[]}}const us=p.div`
327
+ position: absolute;
328
+ top: 0;
329
+ left: 0;
330
+ right: 0;
331
+ z-index: 1;
332
+ padding: 6px 12px;
333
+ border-radius: 12px 12px 0 0;
334
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
335
+ border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
336
+ pointer-events: none;
337
+ `,ps=p.div`
338
+ display: flex;
339
+ align-items: center;
340
+ gap: 8px;
341
+ padding: 4px 8px 0;
342
+ `,ms=p.div`
343
+ flex: 1;
344
+ height: 1px;
345
+ background: ${({theme:e})=>e.v2.colors.silver[700]};
346
+ `,hs=({namespace:e})=>{const a=m();return t(us,{children:t(F,{size:z.XXS,nowrap:!0,color:a.v2.colors.grey[300],children:e})})},gs=({namespace:a})=>{const n=m();return e(ps,{children:[t(ms,{}),t(F,{size:z.XXS,nowrap:!0,color:n.v2.colors.grey[300],children:a}),t(ms,{})]})},bs={[Qe.InstrumentationRule]:ue.NO_DATA_INSTRUMENTATION_RULES,[Qe.Source]:ue.NO_DATA_SOURCES,[Qe.Action]:ue.NO_DATA_ACTIONS,[Qe.Destination]:ue.NO_DATA_DESTINATIONS},fs=p.div`
347
+ display: flex;
348
+ flex-direction: column;
349
+ flex: 1 0 0;
350
+ min-width: 0;
351
+ ${({$isVm:e})=>e?"width: 45vw;":""}
352
+ `,ys=p.div`
353
+ display: flex;
354
+ flex-direction: column;
355
+ align-items: stretch;
356
+ width: 100%;
357
+ padding: 8px;
358
+ box-sizing: border-box;
359
+ border-radius: 0 0 16px 16px;
360
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
361
+ overflow: hidden;
362
+ `,vs=p.div`
363
+ position: relative;
364
+ display: flex;
365
+ flex-direction: column;
366
+ align-items: stretch;
367
+ width: 100%;
368
+ padding: ${4}px;
369
+ box-sizing: border-box;
370
+ border-radius: 12px;
371
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
372
+ height: ${({$height:e})=>e}px;
373
+ overflow: hidden;
374
+ `,Ss=(e,t,a,n)=>{const i=at(e);if(!i)return null;const o=t===Qe.Source;let l,s,r=!1,c=e;if(o){const t=function(e){const t=e.workloadOdigosHealthStatus?.status;switch(t){case fa.Failure:return{status:W.Error,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case fa.Notice:return{status:W.Warning,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case fa.Pending:case fa.Waiting:return{status:void 0,faded:!1,displaySource:cs(e)};case fa.Unsupported:case fa.Disabled:return{status:void 0,faded:!0,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};default:return{status:void 0,faded:!1,displaySource:ds(e)}}}(e);l=t.status,r=t.faded,s=t.tooltip,c=t.displaySource}else{const{priorotizedStatus:t,hasDisableds:a}=wa(e.conditions||[]);l=t,r=a}const d=ca(e,t,{extended:o,prioritizeDisplayName:!o});let u,p,m,h,g;switch(t){case Qe.Source:{u=xa(e),p=da(Qe.Source);const t=n?.get(ka(i));h=Ta(t);break}case Qe.Destination:{const t=Le(e.destinationType.type);p=t.icon,m=t.iconSrc;const a=n?.get(ka(i));h=Ta(a),g=!e.disabled;break}case Qe.Action:p=rt(e.type),g=!e.disabled;break;case Qe.InstrumentationRule:p=ft(e.type),g=!e.disabled}return{key:ka(i),entityId:i,namespace:o?e.namespace:void 0,raw:c,itemProps:{entityId:i,entityType:t,title:d,status:l,faded:r,tooltip:s,throughput:h,icon:p,icons:u,iconSrc:m,isActive:g,raw:c}}},Cs=({entityType:a,entities:i,unfilteredCount:o,metrics:s,loading:d,maxHeight:u,refetch:p})=>{const{isVm:m}=Be(),h=a===Qe.Source,g=i.length!==o,b=Ye(e=>h?e.progress[Ze.Instrumenting]?.percentage:void 0),f=Ye(e=>h?e.progress[Ze.Uninstrumenting]?.percentage:void 0),y=!h||void 0===b&&void 0===f?void 0:b||f||0,{selectedSources:v,setSelectedSources:S}=ha(),C=r(()=>h?Object.values(v).reduce((e,t)=>e+t.length,0):0,[h,v]),w=r(()=>{if(!s)return;const e=new Map,t=a===Qe.Source?s.sources:a===Qe.Destination?s.destinations:void 0;if(t)for(const a of t)e.set(va(a),a.throughput);return e},[s,a]),k=r(()=>i.map(e=>Ss(e,a,0,w)).filter(Boolean),[i,a,w,m]),[T,x]=l(""),{elements:A,indexToNamespace:I,multipleNs:N,dividerCount:$}=r(()=>{const e=[],a=[],n=new Set(k.map(e=>e.namespace).filter(Boolean)).size>1;n&&(a.push(""),e.push(t("div",{style:{height:24}},"ns-spacer")));let i=0,o="";for(const n of k)h&&n.namespace&&n.namespace!==o&&(""!==o&&(a.push(n.namespace),e.push(t(gs,{namespace:n.namespace},`ns-divider-${n.namespace}`)),i+=1),o=n.namespace),a.push(n.namespace||""),e.push(t(rs,{...n.itemProps},n.key));return{elements:e,indexToNamespace:a,multipleNs:n,dividerCount:i}},[k,h]);n(()=>{if(h&&I.length&&!T){const e=I.find(Boolean);e&&x(e)}},[h,I]);const D=c(e=>{if(!I.length)return;const t=I[Math.min(e,I.length-1)];t&&t!==T&&x(t)},[I,T]);if(m&&[Qe.InstrumentationRule,Qe.Action].includes(a))return null;const E=58*k.length+(N?28:0)+32*$,R=Math.max(0,u-52-16),O=Math.min(R,E)+8,P="number"==typeof y?`${y}%`:g?`${i.length}/${o}`:o;return e(fs,{$isVm:m,children:[t(es,{entityType:a,badge:P,badgeTooltip:g?ue.FILTERED_COUNT_TOOLTIP:void 0,isLoading:d,refetch:p,partiallySelected:C>0&&i?.length!==C,allSelected:C>0&&i?.length===C,onSelectAll:h?e=>{if(h)if(e){const e={};i?.forEach(t=>{const{namespace:a}=t;e[a]?e[a].push(t):e[a]=[t]}),S(e)}else S({})}:void 0,progressPercent:y}),t(ys,{children:i.length?e(vs,{$height:O,children:[N&&T&&t(hs,{namespace:T}),t(Sa,{gap:4,elements:A,onTopIndexChange:N?D:void 0})]}):d?t(Ca,{size:3}):t(as,{entityType:a,description:bs[a]??ue.TO_COLLECT_OTEL_DATA})})]})},ws=p.div`
375
+ width: 100%;
376
+ height: ${({$height:e})=>e||"auto"};
377
+ display: flex;
378
+ align-items: stretch;
379
+ gap: 16px;
380
+ `,ks=({height:a,metrics:n,refetchSources:i,refetchDestinations:o,refetchActions:l,refetchInstrumentationRules:s})=>{const c=ta(),{selectedStreamName:d}=pe(),{containerRef:u,containerHeight:p}=Aa(),m=Ve(e=>e.sources),h=Ve(e=>e.sourcesLoading),g=Ve(e=>e.destinations),b=Ve(e=>e.destinationsLoading),f=Ve(e=>e.actions),y=Ve(e=>e.actionsLoading),v=Ve(e=>e.instrumentationRules),S=Ve(e=>e.instrumentationRulesLoading),C=r(()=>aa(m,d),[m,d]),w=r(()=>ut(g,d),[g,d]),k=r(()=>Ia(C,c),[C,c]),T=r(()=>Na(w,c),[w,c]),x=r(()=>$a(f,c),[f,c]);return e(ws,{ref:u,$height:a,children:[t(Cs,{entityType:Qe.InstrumentationRule,entities:v,unfilteredCount:v.length,loading:S,maxHeight:p,refetch:s}),t(Cs,{entityType:Qe.Source,entities:k,unfilteredCount:C.length,metrics:n,loading:h,maxHeight:p,refetch:i}),t(Cs,{entityType:Qe.Action,entities:x,unfilteredCount:f.length,loading:y,maxHeight:p,refetch:l}),t(Cs,{entityType:Qe.Destination,entities:T,unfilteredCount:w.length,metrics:n,loading:b,maxHeight:p,refetch:o})]})},Ts=({effectiveConfig:n,fetchNamespacesWithWorkloads:i,persistSources:o,restartWorkloads:l,restartPod:s,recoverFromRollback:r,updateSource:c,fetchSourceById:d,fetchSourceDescribe:u,fetchSourceLibraries:p,fetchPeerSources:m,enableProfiling:h,fetchProfilingSlots:g,fetchSourceProfiling:b,getDestinationCategories:f,getPotentialDestinations:y,testConnection:v,createDestination:S,updateDestination:C,deleteDestination:w,createInstrumentationRule:k,updateInstrumentationRule:T,deleteInstrumentationRule:x,createAction:A,updateAction:I,deleteAction:N})=>{const{currentModal:$,setCurrentModal:D}=ua(),{drawerType:E,drawerEntityId:R,setDrawerType:O,setDrawerEntityId:P}=ma(),M=()=>{D(""),O(null),P(null)};return e(a,{children:[$===Qe.Source&&t(qt,{children:t(Vo,{onClose:M,fetchNamespacesWithWorkloads:i,persistSources:o,withOverlay:!0})}),$===Qe.Destination&&t(Yt,{children:t(Do,{onClose:M,getDestinationCategories:f,getPotentialDestinations:y,testConnection:v,createDestination:S,updateDestination:C,withOverlay:!0})}),$===Qe.InstrumentationRule&&t(Qt,{children:t(Eo,{onClose:M,createInstrumentationRule:k,withOverlay:!0})}),$===Qe.Action&&t(Jt,{children:t(So,{onClose:M,createAction:A,withOverlay:!0})}),E===Qe.Source&&R&&t(Ri,{persistSources:o,restartWorkloads:l,restartPod:s,recoverFromRollback:r,updateSource:c,fetchSourceById:d,fetchSourceDescribe:u,fetchSourceLibraries:p,fetchPeerSources:m,profilingEnabled:n?.profiling?.enabled||!1,enableProfiling:h,fetchSourceProfiling:b,fetchProfilingSlots:g}),E===Qe.Destination&&R&&t(Yt,{children:t(Xo,{onClose:M,destinationId:R,getDestinationCategories:f,testConnection:v,updateDestination:C,deleteDestination:w})}),E===Qe.InstrumentationRule&&R&&t(Qt,{children:t(jo,{onClose:M,ruleId:R,updateInstrumentationRule:T,deleteInstrumentationRule:x})}),E===Qe.Action&&R&&t(Jt,{children:t(_o,{onClose:M,actionId:R,updateAction:I,deleteAction:N})})]})},xs="multi-source-deselect",As="multi-source-restart",Is="multi-source-uninstrument",Ns="Selected sources",$s="Deselect",Ds="Restart",Es="Uninstrument",Rs="Rollout Restart Workloads",Os="Are you sure you want to rollout restart these workloads?",Ps="Go Back",Ms="Confirm",Ls=({restartWorkloads:i,persistSources:o})=>{const{selectedStreamName:s}=pe(),{selectedSources:d,setSelectedSources:u}=ha(),[p,m]=l(!1),[h,g]=l(!1),b=r(()=>Object.values(d).reduce((e,t)=>e+t.length,0),[d]),f=c(()=>{u({})},[u]),y=c(()=>m(!1),[]),v=c(()=>g(!1),[]);n(()=>{f()},[s,f]);const S=c(()=>{i(Object.values(d).flat().filter(e=>e.kind!==Da.StaticPod).map(Ea)),f()},[i,d,f]),C=c(()=>{o(Object.fromEntries(Object.entries(d).map(([e,t])=>[e,t.map(({namespace:e,name:t,kind:a})=>({namespace:e,name:t,kind:a||void 0,selected:!1,currentStreamName:s}))]))),f()},[o,d,s,f]),w=r(()=>[{id:xs,type:Wt.Button,buttonProps:{variant:R.Text,size:E.S,label:$s,onClick:f}},{id:As,type:Wt.Button,buttonProps:{variant:R.Secondary,size:E.S,label:Ds,leftIcon:li,onClick:()=>m(!0)}},{id:Is,type:Wt.Button,buttonProps:{variant:R.Primary,size:E.S,label:Es,leftIcon:Nn,onClick:()=>g(!0)}}],[f]);return e(a,{children:[t(Zt,{isOpen:b>0,richTitle:{icon:Wn,title:Ns,badge:{label:b}},actions:w}),t(de,{isOpen:p,title:Rs,description:Os,onClose:y,denyButton:{label:Ps,variant:R.Secondary,onClick:y},approveButton:{label:Ms,variant:R.Primary,onClick:()=>{S(),y()}}}),t(Ii,{isOpen:h,action:"uninstrument",target:`${b} source${1===b?"":"s"}`,onClose:v,onDeny:v,onApprove:C})]})},Fs=e=>`Data Stream: ${e}`,zs="Search streams...",Vs="No streams match",_s=p.div`
381
+ position: relative;
382
+ display: inline-flex;
383
+ `,Bs=p.div`
384
+ display: inline-flex;
385
+ align-items: center;
386
+ gap: 6px;
387
+ padding: 4px 8px;
388
+ border-radius: 8px;
389
+ cursor: pointer;
390
+ background-color: ${({$isOpen:e,theme:t})=>e?t.v2.colors.silver[800]:"transparent"};
391
+ &:hover {
392
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
393
+ }
394
+ `,Xs=p.div`
395
+ position: absolute;
396
+ top: calc(100% + 8px);
397
+ left: 0;
398
+ min-width: max(100%, 320px);
399
+ z-index: ${({theme:e})=>e.v2.zIndex.popover};
400
+
401
+ display: flex;
402
+ flex-direction: column;
403
+ gap: 8px;
404
+ padding: 8px;
405
+ border-radius: 12px;
406
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
407
+ box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
408
+ `,js=p.div`
409
+ display: flex;
410
+ align-items: center;
411
+ gap: 8px;
412
+ width: 100%;
413
+ `,Us=p.div`
414
+ display: flex;
415
+ flex-direction: column;
416
+ gap: 0;
417
+ max-height: 240px;
418
+ overflow-y: auto;
419
+ `,Ws=p.div`
420
+ display: flex;
421
+ align-items: center;
422
+ gap: 8px;
423
+ padding: 6px 8px;
424
+ border-radius: 6px;
425
+ cursor: pointer;
426
+ background-color: ${({$selected:e,theme:t})=>e?t.v2.colors.silver[600]:"transparent"};
427
+ &:hover {
428
+ background-color: ${({$selected:e,theme:t})=>e?t.v2.colors.silver[600]:t.v2.colors.silver[700]};
429
+ }
430
+ `,Hs=p.div`
431
+ flex: 1;
432
+ min-width: 0;
433
+ overflow: hidden;
434
+ text-overflow: ellipsis;
435
+ white-space: nowrap;
436
+ `,Gs=p.div`
437
+ display: flex;
438
+ align-items: center;
439
+ gap: 2px;
440
+ flex-shrink: 0;
441
+ `,Ks=p.div`
442
+ display: flex;
443
+ padding-top: 4px;
444
+ border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
445
+ `,qs=({updateDataStream:i,deleteDataStream:o,createDataStream:s})=>{const c=m(),{clearStore:u}=Ra(),{dataStreams:p,selectedStreamName:h,setSelectedStreamName:g}=pe(),b=d(null),[f,y]=l(!1),[v,S]=l(""),[C,w]=l(""),[k,T]=l(""),[x,A]=l(!1);ia(b,()=>y(!1)),n(()=>{f||S("")},[f]);const I=r(()=>{if(!v)return p;const e=v.toLowerCase();return p.filter(({name:t})=>t.toLowerCase().includes(e))},[p,v]),N=f?_n:Bn;return e(a,{children:[e(_s,{ref:b,children:[e(Bs,{"data-id":"data-stream-select",$isOpen:f,onClick:()=>y(e=>!e),children:[t(si,{size:24}),t(F,{size:z.S,weight:500,nowrap:!0,children:Fs(h)}),t(le,{label:p.length,status:Ue.Unknown,textSize:z.XXXS}),t(N,{size:20,fill:c.v2.colors.silver[200]})]}),f&&e(Xs,{children:[t(js,{children:t(ra,{value:v,onChange:S,placeholder:zs,width:"100%"})}),t(Us,{children:0===I.length?t(Ws,{children:t(F,{size:z.XS,color:Y.Secondary,children:Vs})}):I.map(({name:a})=>{const n=a===Pa;return e(Ws,{"data-id":`stream-row-${a}`,$selected:a===h,onClick:()=>(e=>{e!==h&&(u(),g(e)),y(!1)})(a),children:[t(Hs,{children:t(F,{size:z.XS,nowrap:!0,children:a})}),e(Gs,{children:[t(Re,{"data-id":`stream-edit-${a}`,icon:Pn,size:Oe.XS,onClick:e=>{e.stopPropagation(),y(!1),w(a)}}),!n&&t(Re,{"data-id":`stream-delete-${a}`,icon:Nn,size:Oe.XS,onClick:e=>{e.stopPropagation(),y(!1),T(a)}})]})]},`stream-${a}`)})}),t(Ks,{children:t(D,{"data-id":"add-stream-trigger",variant:R.Secondary,size:E.S,leftIcon:$n,label:`${it.NEW} ${ue.STREAM_NAME}`,fullWidth:!0,onClick:()=>{y(!1),u(),A(!0)}})})]})]}),x&&t(Oa,{defaultExcludeName:h,children:t(pl,{onClose:()=>A(!1),createDataStream:s})}),C&&t(Oa,{children:t(ml,{dataStreamName:C,onClose:()=>w(""),updateDataStream:i})}),t(Ii,{target:`${ue.STREAM_NAME.toLowerCase()} "${k}"`,isOpen:!!k,onClose:()=>T(""),onApprove:async()=>{const e=k;T(""),e&&await o(e)}})]})},Ys=h`
446
+ 0% {
447
+ background-position: 200% 50%;
448
+ }
449
+ 100% {
450
+ background-position: 0% 50%;
451
+ }
452
+ `,Js=p.div`
453
+ display: flex;
454
+ align-items: center;
455
+ justify-content: space-evenly;
456
+ width: calc(100% - 4px);
457
+ min-height: 12px;
458
+ padding: 2px;
459
+ border-radius: 12px;
460
+
461
+ background: ${({theme:e})=>`linear-gradient(90deg, ${e.v2.colors.pink[500]} 0%, ${e.v2.colors.purple[400]} 25%, ${e.v2.colors.green[500]} 50%, ${e.v2.colors.purple[400]} 75%, ${e.v2.colors.pink[500]} 100%)`};
462
+ background-size: 200% 100%;
463
+ animation: ${Ys} 15s linear infinite;
464
+ `,Qs=[Un,Wn,zn,Vn],Zs=({columnsMaxHeight:a,metrics:n,refetchSources:o,refetchDestinations:l,refetchActions:s,refetchInstrumentationRules:r,updateDataStream:c,deleteDataStream:d,createDataStream:u,...p})=>{const h=m();return e(Ht,{children:[e(Te,{customTitle:t(qs,{updateDataStream:c,deleteDataStream:d,createDataStream:u}),customSearch:t(Jl,{width:"420px"}),filters:t(jl,{}),children:[t(Js,{children:Qs.map((a,n)=>e(i,{children:[t(a,{size:24}),n<Qs.length-1&&t(Fn,{fill:h.v2.colors.white[500]+Ae["020"],size:24})]},a.name))}),t(ks,{height:a,metrics:n,refetchSources:o,refetchDestinations:l,refetchActions:s,refetchInstrumentationRules:r})]}),t(Ts,{...p}),t(Ls,{restartWorkloads:p.restartWorkloads,persistSources:p.persistSources})]})};var er;!function(e){e.Gateway="gateway",e.Node="node"}(er||(er={}));const tr=({onClickDownloadDiagnose:a,onClickRefresh:n,loading:i,disabled:o})=>{const l=r(()=>{const e=[];return a&&e.push({id:jt(),type:Wt.Button,buttonProps:{label:"Download Diagnose",leftIcon:Zn,size:E.S,variant:R.Text,onClick:a,disabled:o}}),n&&e.push({id:jt(),type:Wt.Button,buttonProps:{label:"Refresh",leftIcon:ti,size:E.S,variant:R.Text,onClick:n,disabled:o,loading:i}}),e},[a,n,o,i]);return e($,{$alignItems:"center",$justifyContent:"space-between",children:[t(Ma,{icon:ri,title:"Collectors Pipeline"}),t(La,{actions:l})]})},ar=({pod:a,getExtendedPodInfo:i,onClose:o})=>{const{formatTimeAgo:s}=zt(),[c,d]=l(null);n(()=>{a?i(a.namespace,a.name).then(e=>d(e??null)):d(null)},[a]);const u=r(()=>[{id:jt(),title:"Node",label:c?.node??"-",withCopy:!0},{id:jt(),title:"Status",badge:{status:Fa(c?.status),label:c?.status??"-"}}],[c]),p=r(()=>c?.containers?.map(e=>({id:jt(),items:[{id:jt(),title:"Container",label:e.name??"-"},{id:jt(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:jt(),title:"Ready",badge:{status:e.ready?W.Success:W.Error,leftIcon:e.ready?En:Rn,label:e.ready?"True":"False",invertColors:!0}},{id:jt(),title:"Started",badge:{status:e.started?W.Success:W.Error,leftIcon:e.started?En:Rn,label:e.started?"True":"False",invertColors:!0}},{id:jt(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:jt(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:jt(),title:"Restarts",label:e.restarts.toString()},{id:jt(),title:"State Reason",label:e.stateReason??"-"},{id:jt(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:jt(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return t(nt,{isOpen:!!a,header:{icon:ci,title:"Pod Information",onClose:o},children:c?e(lt,{bgTint:"1000",richTitle:{icon:ci,title:c.name,withCopy:!0},children:[t(lt,{bgTint:"900",cellsPerRow:2,items:u}),e(lt,{bgTint:"900",richTitle:{icon:ei,title:"Kubectl Commands"},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(za,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),t(za,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),t(za,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]}),t(lt,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:p.length?p.map(({id:e,items:a})=>t(lt,{bgTint:"800",cellsPerRow:2,items:a},e)):t(L,{title:"No containers",subTitle:"Pod has no containers"})}),t(Oi,{bgTint:"900",yaml:c.manifestYAML,defaultOpen:!0})]}):t($e,{$height:"50vh",children:t(Pe,{withSpinner:!0})})})};var nr;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(nr||(nr={}));const ir=[{key:nr.PodName,label:"Pod Name"},{key:nr.Status,label:"Status"},{key:nr.Restarts,label:"Restarts"},{key:nr.NodeName,label:"Node Name"},{key:nr.Age,label:"Age"},{key:nr.DockerImage,label:"Collector Version"}],or=({isLoading:a,tableRowsMaxHeight:n,pods:i,getExtendedPodInfo:o})=>{const s=m(),{formatTimeAgo:c}=zt(),[d,u]=l(null),p=r(()=>i.map(a=>({onClick:()=>u(a),cells:[{key:nr.PodName,rawValue:a.name},{key:nr.Status,rawValue:a.status,component:()=>{return e=a.status,t(le,{status:Fa(e),label:e});var e}},{key:nr.Restarts,rawValue:a.restartsCount.toString()},{key:nr.NodeName,rawValue:a.nodeName},{key:nr.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(F,{children:"-"});const i=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),o=i>0?Math.round((n?.metricsDroppedRps??0)/i*100):0,l=o>0?W.Error:W.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?W.Error:W.Success;return e($,{$gap:4,children:[t(Q,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(le,{status:l,label:`Receiver ${o}%`,leftIcon:l===W.Error?di:ui,useSecondaryTone:!0,invertColors:!0})}),t(Q,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(le,{status:c,label:`Exporter ${r}%`,leftIcon:c===W.Error?di:ui,useSecondaryTone:!0,invertColors:!0})})]})}},{key:nr.Age,rawValue:c(a.creationTimestamp)},{key:nr.DockerImage,rawValue:a.image}]})),[i,s]);return e(lt,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:ci,title:"Pods"},children:[t(Gt,{variant:Kt.Data,maxHeight:n,isLoading:a,columns:ir,rows:p}),t(ar,{pod:d,getExtendedPodInfo:o,onClose:()=>u(null)})]})},lr=({isOpen:e,onClose:a,title:n,yaml:i})=>t(nt,{isOpen:e,header:{icon:pi,title:n,onClose:a},children:t(Oi,{yaml:i,defaultOpen:!0})}),sr=e=>{switch(e){case Va.Healthy:return"All desired replicas are updated, available, and ready";case Va.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case Va.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case Va.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case Va.Down:return"No available replicas";case Va.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var rr;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(rr||(rr={}));const cr=p.div`
164
465
  flex: 0.5;
165
466
  padding: 12px;
166
467
  border-radius: 12px;
167
468
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
168
- `,Zi=({selectedTab:a,gatewayInfo:n,nodeCollectorInfo:o,isLoading:i})=>{const{formatTimeAgo:s}=Pt(),[c,d]=l(null),u=r(()=>(e=>{switch(e){case ji.Gateway:return"Deployment";case ji.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(a),[a]),p=r(()=>((e,t,a,n)=>{const o={status:Be.Disabled,label:"No rollouts yet"};let i=!1,l=null;switch(e){case ji.Gateway:i=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case ji.Node:i=a?.rolloutInProgress??!1,l=a?.lastRolloutAt??null;break;default:return o}return i?{status:X.Info,label:"Rollout in progress",rightIcon:yn,useSecondaryTone:!0}:l?{status:Be.Disabled,label:`Last Rollout: ${n(l)}`}:o})(a,n,o,s),[n,o,a,s]),m=r(()=>((e,t,a,n)=>{let o=n?X.Info:Be.Unknown,i=n?"Loading":ta.Unknown,l=n?"Fetching data...":qi(ta.Unknown);switch(e){case ji.Gateway:o=t?.status?Zt(t?.status):o,i=t?.status??i,l=t?.status?qi(t.status):l;break;case ji.Node:o=a?.status?Zt(a?.status):o,i=a?.status??i,l=a?.status?qi(a.status):l}return{status:o,title:i,description:l}})(a,n,o,i),[n,o,a,i]),h=r(()=>((e,t,a)=>{switch(e){case ji.Gateway:return[{gaugeWidth:128,min:0,max:t?.hpa?.max??0,current:t?.hpa?.current??0,title:"HPA Spec",primaryLabel:"Current replicas",secondaryLabel:"Max replicas"}];case ji.Node:return[{gaugeWidth:128,min:0,max:a?.nodes?.desired??0,current:a?.nodes?.ready??0,title:"Nodes",primaryLabel:"Ready nodes",secondaryLabel:"Desired nodes"}];default:return[]}})(a,n,o),[n,o,a]),g=r(()=>((e,t,a,n)=>{switch(e){case ji.Gateway:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${t?.resources?.requests.cpu}/${t?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${t?.resources?.requests.memory}/${t?.resources?.limits.memory}`,isLoading:n}]}];case ji.Node:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${a?.resources?.requests.cpu}/${a?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${a?.resources?.requests.memory}/${a?.resources?.limits.memory}`,isLoading:n}]}];default:return[]}})(a,n,o,i),[n,o,a,i]),b=r(()=>(a===ji.Gateway?n?.manifestYAML:o?.manifestYAML)??"",[n,o,a]),f=r(()=>(a===ji.Gateway?n?.configMapYAML:o?.configMapYAML)??"",[n,o,a]);return e(tt,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:Nn,title:u,badge:p},actions:[{id:Bt(),type:_t.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"View YAML",onClick:e=>d(e)},dropDataProps:{items:[{id:Ji.ManifestYaml,label:u,icon:In},{id:Ji.ConfigMapYaml,label:"ConfigMap",icon:In}]}}],children:[e(D,{$gap:16,children:[t("div",{children:t(aa,{...m})}),h.map(e=>t(Qi,{children:t("div",{children:t(na,{...e})})},e.title)),g.map(e=>t(oa,{...e},e.title))]}),t(Yi,{isOpen:c===Ji.ManifestYaml,onClose:()=>d(null),title:u,yaml:b}),t(Yi,{isOpen:c===Ji.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:f})]})},el=[{value:ji.Gateway,label:"Gateway"},{value:ji.Node,label:"Node Collector"}],tl=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{isVersionSupported:m,version:h}=Me(a),[b,f]=l(!1),[y,v]=l(ji.Gateway),[C,S]=l(null),[w,k]=l([]),[T,A]=l(null),[N,I]=l([]),D=c(async()=>{f(!0);try{switch(y){case ji.Gateway:S(await i()??null),k(await s()??[]);break;case ji.Node:A(await d()??null),I(await u()??[])}}catch(e){}f(!1)},[y]);n(()=>{D()},[D]);const E=r(()=>y===ji.Gateway?w:N,[w,N,y]);return e(Ut,{children:[t(Xi,{disabled:!m,loading:b,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e(ia,{children:[e(g,{children:[t(B,{variant:la.Underline,options:el,selected:y,setSelected:v}),t(Zi,{selectedTab:y,gatewayInfo:C,nodeCollectorInfo:T,isLoading:b})]}),t(Ki,{isLoading:b,tableRowsMaxHeight:o,pods:E,getExtendedPodInfo:p}),!m&&t(Hn,{minSupportedVersion:a,currentVersion:h||""})]})]})},al=p.div`
469
+ `,dr=({selectedTab:a,gatewayInfo:n,nodeCollectorInfo:i,isLoading:o})=>{const{formatTimeAgo:s}=zt(),[c,d]=l(null),u=r(()=>(e=>{switch(e){case er.Gateway:return"Deployment";case er.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(a),[a]),p=r(()=>((e,t,a,n)=>{const i={status:Ue.Disabled,label:"No rollouts yet"};let o=!1,l=null;switch(e){case er.Gateway:o=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case er.Node:o=a?.rolloutInProgress??!1,l=a?.lastRolloutAt??null;break;default:return i}return o?{status:W.Info,label:"Rollout in progress",rightIcon:ti,useSecondaryTone:!0}:l?{status:Ue.Disabled,label:`Last Rollout: ${n(l)}`}:i})(a,n,i,s),[n,i,a,s]),m=r(()=>((e,t,a,n)=>{let i=n?W.Info:Ue.Unknown,o=n?"Loading":Va.Unknown,l=n?"Fetching data...":sr(Va.Unknown);switch(e){case er.Gateway:i=t?.status?Fa(t?.status):i,o=t?.status??o,l=t?.status?sr(t.status):l;break;case er.Node:i=a?.status?Fa(a?.status):i,o=a?.status??o,l=a?.status?sr(a.status):l}return{status:i,title:o,description:l}})(a,n,i,o),[n,i,a,o]),h=r(()=>((e,t,a)=>{switch(e){case er.Gateway:return[{gaugeWidth:128,min:0,max:t?.hpa?.max??0,current:t?.hpa?.current??0,title:"HPA Spec",primaryLabel:"Current replicas",secondaryLabel:"Max replicas"}];case er.Node:return[{gaugeWidth:128,min:0,max:a?.nodes?.desired??0,current:a?.nodes?.ready??0,title:"Nodes",primaryLabel:"Ready nodes",secondaryLabel:"Desired nodes"}];default:return[]}})(a,n,i),[n,i,a]),g=r(()=>((e,t,a,n)=>{switch(e){case er.Gateway:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${t?.resources?.requests.cpu}/${t?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${t?.resources?.requests.memory}/${t?.resources?.limits.memory}`,isLoading:n}]}];case er.Node:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${a?.resources?.requests.cpu}/${a?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${a?.resources?.requests.memory}/${a?.resources?.limits.memory}`,isLoading:n}]}];default:return[]}})(a,n,i,o),[n,i,a,o]),b=r(()=>(a===er.Gateway?n?.manifestYAML:i?.manifestYAML)??"",[n,i,a]),f=r(()=>(a===er.Gateway?n?.configMapYAML:i?.configMapYAML)??"",[n,i,a]);return e(lt,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:pi,title:u,badge:p},actions:[{id:jt(),type:Wt.ButtonDropData,buttonProps:{variant:R.Secondary,size:E.S,label:"View YAML",onClick:e=>d(e)},dropDataProps:{items:[{id:rr.ManifestYaml,label:u,icon:mi},{id:rr.ConfigMapYaml,label:"ConfigMap",icon:mi}]}}],children:[e($,{$gap:16,children:[t("div",{children:t(_a,{...m})}),h.map(e=>t(cr,{children:t("div",{children:t(Ba,{...e})})},e.title)),g.map(e=>t(Xa,{...e},e.title))]}),t(lr,{isOpen:c===rr.ManifestYaml,onClose:()=>d(null),title:u,yaml:b}),t(lr,{isOpen:c===rr.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:f})]})},ur=[{value:er.Gateway,label:"Gateway"},{value:er.Node,label:"Node Collector"}],pr=({minSupportedVersion:a=0,tableRowsMaxHeight:i,getGatewayInfo:o,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{isVersionSupported:m,version:h}=Be(a),[g,f]=l(!1),[y,v]=l(er.Gateway),[S,C]=l(null),[w,k]=l([]),[T,x]=l(null),[A,I]=l([]),N=c(async()=>{f(!0);try{switch(y){case er.Gateway:C(await o()??null),k(await s()??[]);break;case er.Node:x(await d()??null),I(await u()??[])}}catch(e){}f(!1)},[y]);n(()=>{N()},[N]);const $=r(()=>y===er.Gateway?w:A,[w,A,y]);return e(Ht,{children:[t(tr,{disabled:!m,loading:g,onClickDownloadDiagnose:void 0,onClickRefresh:N}),e(ja,{children:[e(b,{children:[t(_,{variant:Ua.Underline,options:ur,selected:y,setSelected:v}),t(dr,{selectedTab:y,gatewayInfo:S,nodeCollectorInfo:T,isLoading:g})]}),t(or,{isLoading:g,tableRowsMaxHeight:i,pods:$,getExtendedPodInfo:p}),!m&&t(Ei,{minSupportedVersion:a,currentVersion:h||""})]})]})},mr=p.div`
169
470
  display: inline-flex;
170
471
  align-items: center;
171
472
  min-width: 0;
172
473
  overflow: hidden;
173
474
  white-space: pre;
174
475
  text-overflow: ellipsis;
175
- `,nl=p.div`
476
+ `,hr=p.div`
176
477
  display: flex;
177
478
  flex-direction: column;
178
479
  gap: 4px;
179
480
  min-width: 0;
180
481
  flex: 1;
181
482
  opacity: ${({$disabled:e})=>e?.4:1};
182
- `,ol=p(D)`
483
+ `,gr=p($)`
183
484
  flex-shrink: 0;
184
485
  gap: 6px;
185
486
  align-items: center;
186
487
  min-height: 22px;
187
- `;const il=[{key:"content",label:"Content",noSort:!0,noFilter:!0},{key:"badges",label:"Type",noSort:!0,noFilter:!0,flex:"0 0 128px"}],ll=[{value:"all",label:ca},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],sl=({title:a,items:n,isLoading:o,showTypeFilter:i,tableRowsMaxHeight:s,onRuleClick:d,onCreateRule:u,onEditRule:p,onDeleteRule:h})=>{const g=m(),[b,f]=l(""),[y,v]=l("all"),C=r(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,y,i);return e=function(e,t){if(!t.trim())return e;const a=t.toLowerCase();return e.filter(e=>{const t=e.name?.toLowerCase().includes(a),n=e.summary.map(e=>e.text).join("").toLowerCase();return t||n.includes(a)})}(e,b),e},[n,y,i,b]),S=r(()=>C.map(a=>{const n=a.typeBadge?function(e,t){const a=e.v2.colors;switch(t){case"Relevance":return{bg:a.blue[700],text:a.white[500]};case"Duration":return{bg:a.purple[700],text:a.white[500]};case"Error":return{bg:a.red[500],text:a.black[500]}}}(g,a.typeBadge):void 0;return{cells:[{key:"content",rawValue:a.summary.map(e=>e.text).join(""),component:()=>e(nl,{$disabled:a.disabled,children:[t(al,{children:t(sa,{parts:a.summary})}),a.name&&t(M,{size:L.XXS,color:g.v2.colors.silver[200],nowrap:!0,children:a.name})]})},{key:"badges",rawValue:a.typeBadge||"",component:()=>e(ol,{children:[a.disabled&&t(oe,{label:ra,textSize:L.XXXS,backgroundColor:g.v2.colors.grey[700],textColor:g.v2.colors.grey[300]}),a.typeBadge&&n&&t(oe,{label:a.typeBadge,textSize:L.XXXS,backgroundColor:n.bg,textColor:n.text})]})}],onClick:()=>d(a)}}),[C,g,d]),w=r(()=>{const e=e=>t(Ya,{...e,fill:g.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[g]),k=c(e=>{const t=S.indexOf(e);if(t<0)return[];const a=C[t];return a?[{id:"edit","data-id":"sampling-rule-action-edit",label:bt,leftIcon:qa,onClick:()=>p(a.ruleId,a.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:w,onClick:()=>h(a.ruleId,a.samplingId)}]:[]},[S,C,p,h,w]);return t(ye,{fullHeight:!0,richTitle:{icon:un,title:a,badge:{label:n.length,backgroundColor:g.v2.colors.silver[600],textColor:g.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:b,onChange:f,placeholder:"Search..",width:"500px",...i?{segment:{"data-id":"sampling-segment-type-filter",options:ll,selected:y,setSelected:v}}:{}},children:t(jt,{variant:Xt.Pretty,hideHeader:!0,maxHeight:s,isLoading:o,noDataProps:b.trim()?{hideIcon:!0,title:da,subTitle:ma(b)}:{hideIcon:!0,title:pa,button:{label:ua,onClick:u}},columns:il,rows:S,getRowActions:k})})},rl=a=>{const{workloads:o,samplingRules:i,k8sHealthProbesConfig:s,loading:u,tableRowsMaxHeight:p,fetchSamplingRules:m,createNoisyOperationRule:h,updateNoisyOperationRule:b,createHighlyRelevantOperationRule:f,updateHighlyRelevantOperationRule:y,createCostReductionRule:v,updateCostReductionRule:C,deleteSamplingRule:S,updateK8sHealthProbesConfig:w}=a,k=r(()=>o.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:`${e.namespace} / ${e.kind} / ${e.name}`})),[o]),T=r(()=>Array.from(new Set(o.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[o]),[A,N]=l(ha.Noisy),[I,x]=l(null),[O,P]=l(!1),[F,M]=l(!1),[L,V]=l(null),[z,_]=l(!1),[U,H]=l(!1),[W,G]=l(!1),K=r(()=>ga(s),[s]),Y=r(()=>ba(i),[i]),q=r(()=>fa(Y?.rule??null),[Y]),J=r(()=>ya(i),[i]),Q=r(()=>va(J?.rule??null),[J]),Z=d(I);Z.current=I,n(()=>{const e=Z.current;if(!e)return;const t=Ca(i,e);t?x(t):(x(null),P(!1))},[i]);const ee=r(()=>{const e=new Set;return Y&&e.add(Y.rule.ruleId),J&&e.add(J.rule.ruleId),e},[Y,J]),te=r(()=>Sa(i,A,ee),[i,A,ee]),ae=c(()=>M(!0),[]),ne=c(()=>M(!1),[]),oe=c(e=>{const t=i[0]?.id??"default";switch(Ia[A]){case"noisy":h(t,Ta(e));break;case"highlyRelevant":f(t,ka(e));break;case"costReduction":v(t,wa(e))}M(!1)},[i,A,h,f,v]),ie=c(e=>{const t=Aa(i,e);t&&(P(!1),x(t))},[i]),le=c(()=>{x(null),P(!1)},[]),se=c((e,t)=>{const a=I;if(a&&a.rule.ruleId===e&&a.samplingId===t)P(!0),x({...a});else for(const a of i){if(a.id!==t)continue;const n=[...a.noisyOperations.map(e=>({category:"noisy",rule:e})),...a.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...a.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(n)return P(!0),void x({category:n.category,rule:n.rule,samplingId:t,summary:Na(n.category,n.rule)})}},[I,i]),de=c((e,t,a)=>{const n=I?.category;if(n){switch(n){case"noisy":b(a,t,Ta(e));break;case"highlyRelevant":y(a,t,ka(e));break;case"costReduction":C(a,t,wa(e))}P(!1)}},[I,b,y,C]),ue=c((e,t)=>{V({ruleId:e,samplingId:t})},[]),pe=c(()=>{if(!L)return;const{ruleId:e,samplingId:t}=L,a=I?.category||Ia[A];S(t,e,a),x(null),P(!1),V(null)},[L,I,A,S]),ge=c(()=>V(null),[]),be=c((e,t)=>{w(e,t),_(!1)},[w]),fe=c(e=>{const t=i[0]?.id??"default",a=Y;a?y(a.samplingId,a.rule.ruleId,{name:a.rule.name,disabled:!e,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null,notes:a.rule.notes}):e&&f(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null}),H(!1)},[i,Y,f,y]),ye=c((e,t)=>{const a=i[0]?.id??"default",n=J;n?C(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,sourceScopes:[],operation:null,percentageAtMost:t,notes:n.rule.notes}):e&&v(a,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:[],operation:null,percentageAtMost:t}),G(!1)},[i,J,v,C]),ve=c(e=>{const t=Ia[A];let a=null;switch(t){case"noisy":{const n=Ta(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=ka(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=wa(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return a?{message:Ea,ruleId:a}:null},[i,A]),Ce=c(e=>{const t=I?.category,a=I?.rule.ruleId;if(!t)return null;let n=null;switch(t){case"noisy":{const o=Ta(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}case"highlyRelevant":{const o=ka(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation,error:o.error??!1,durationAtLeastMs:o.durationAtLeastMs},a);break}case"costReduction":{const o=wa(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}}return n?{message:Ea,ruleId:n}:null},[i,I]),Se=c(e=>{M(!1);for(const t of i){const a=[...t.noisyOperations.map(e=>({category:"noisy",rule:e})),...t.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...t.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(a)return P(!0),void x({category:a.category,rule:a.rule,samplingId:t.id,summary:Na(a.category,a.rule)})}},[i]),we=r(()=>{const e=[];return a.docsUrl&&e.push({id:Bt(),type:_t.Button,buttonProps:{"data-id":"sampling-btn-docs",label:$a,leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")}}),e.push({id:Bt(),type:_t.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:Ra,leftIcon:yn,size:$.S,variant:R.Text,onClick:m,loading:u}}),e.push({id:Bt(),type:_t.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:xa,rightIcon:Ha,size:$.S,variant:R.Primary,onClick:ae}}),e},[a.docsUrl,m,u,ae]);return e(Ut,{children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(Jt,{icon:un,title:Pa,subTitle:Oa}),t(Qt,{actions:we})]}),e(g,{$gap:12,children:[t(B,{variant:la.Underline,options:Fa,selected:A,setSelected:N}),e(D,{$justifyContent:"space-between",children:[t(j,{status:X.Default,message:Ma[A]}),a.docsUrl&&t(E,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")})]}),A===ha.Noisy?t($n,{title:he,summary:K,onEdit:()=>_(!0)}):A===ha.HighlyRelevant?t($n,{title:ce,summary:q,onEdit:()=>H(!0)}):A===ha.CostReduction?t($n,{title:me,summary:Q,onEdit:()=>G(!0)}):null,t(sl,{title:La[A],items:te,isLoading:u,showTypeFilter:A===ha.HighlyRelevant,tableRowsMaxHeight:p,onRuleClick:ie,onCreateRule:ae,onEditRule:se,onDeleteRule:ue})]}),t(mi,{formType:re.View,data:I,defaultEditMode:O,onClose:le,onDelete:ue,onSaveEdit:de,sourceOptions:k,namespaceOptions:T,validateForm:Ce,onNavigateToDuplicate:Se}),t(mi,{formType:re.Create,isOpen:F,category:Ia[A],onClose:ne,onSubmit:oe,sourceOptions:k,namespaceOptions:T,validateForm:ve,onNavigateToDuplicate:Se}),t(mi,{formType:re.EditAutoNoisy,isOpen:z,enabled:s?.enabled??!1,keepPercentage:s?.keepPercentage??0,onClose:()=>_(!1),onSave:be}),t(mi,{formType:re.EditAutoHighlyRelevant,isOpen:U,enabled:!!Y&&!Y.rule.disabled,onClose:()=>H(!1),onSave:fe}),t(mi,{formType:re.EditAutoCostReduction,isOpen:W,enabled:!!J&&!J.rule.disabled,dropPercentage:J?.rule.percentageAtMost??25,onClose:()=>G(!1),onSave:ye}),t(Va,{title:Ua,description:_a,isOpen:!!L,onClose:ge,onApprove:pe,approveLabel:za,denyLabel:Ba})]})},cl=p.div`
488
+ `;const br=[{key:"content",label:"Content",noSort:!0,noFilter:!0},{key:"badges",label:"Type",noSort:!0,noFilter:!0,flex:"0 0 128px"}],fr=[{value:"all",label:Ga},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],yr=({title:a,items:n,isLoading:i,showTypeFilter:o,tableRowsMaxHeight:s,onRuleClick:d,onCreateRule:u,onEditRule:p,onDeleteRule:h})=>{const g=m(),[b,f]=l(""),[y,v]=l("all"),S=r(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,y,o);return e=function(e,t){if(!t.trim())return e;const a=t.toLowerCase();return e.filter(e=>{const t=e.name?.toLowerCase().includes(a),n=e.summary.map(e=>e.text).join("").toLowerCase();return t||n.includes(a)})}(e,b),e},[n,y,o,b]),C=r(()=>S.map(a=>{const n=a.typeBadge?function(e,t){const a=e.v2.colors;switch(t){case"Relevance":return{bg:a.blue[700],text:a.white[500]};case"Duration":return{bg:a.purple[700],text:a.white[500]};case"Error":return{bg:a.red[500],text:a.black[500]}}}(g,a.typeBadge):void 0;return{cells:[{key:"content",rawValue:a.summary.map(e=>e.text).join(""),component:()=>e(hr,{$disabled:a.disabled,children:[t(mr,{children:t(Wa,{parts:a.summary})}),a.name&&t(F,{size:z.XXS,color:Y.Secondary,nowrap:!0,children:a.name})]})},{key:"badges",rawValue:a.typeBadge||"",component:()=>e(gr,{children:[a.disabled&&t(le,{label:Ha,textSize:z.XXXS,backgroundColor:g.v2.colors.grey[700],textColor:g.v2.colors.grey[300]}),a.typeBadge&&n&&t(le,{label:a.typeBadge,textSize:z.XXXS,backgroundColor:n.bg,textColor:n.text})]})}],onClick:()=>d(a)}}),[S,g,d]),w=r(()=>{const e=e=>t(On,{...e,fill:g.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[g]),k=c(e=>{const t=C.indexOf(e);if(t<0)return[];const a=S[t];return a?[{id:"edit","data-id":"sampling-rule-action-edit",label:St,leftIcon:Pn,onClick:()=>p(a.ruleId,a.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:w,onClick:()=>h(a.ruleId,a.samplingId)}]:[]},[C,S,p,h,w]);return t(Te,{fullHeight:!0,richTitle:{icon:Kn,title:a,badge:{label:n.length,backgroundColor:g.v2.colors.silver[600],textColor:g.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:b,onChange:f,placeholder:"Search..",width:"500px",...o?{segment:{"data-id":"sampling-segment-type-filter",options:fr,selected:y,setSelected:v}}:{}},children:t(Gt,{variant:Kt.Pretty,hideHeader:!0,maxHeight:s,isLoading:i,noDataProps:b.trim()?{hideIcon:!0,title:Ka,subTitle:Ja(b)}:{hideIcon:!0,title:Ya,button:{label:qa,onClick:u}},columns:br,rows:C,getRowActions:k})})},vr=a=>{const{workloads:i,samplingRules:o,k8sHealthProbesConfig:s,loading:u,tableRowsMaxHeight:p,fetchSamplingRules:m,createNoisyOperationRule:h,updateNoisyOperationRule:g,createHighlyRelevantOperationRule:f,updateHighlyRelevantOperationRule:y,createCostReductionRule:v,updateCostReductionRule:S,deleteSamplingRule:C,updateK8sHealthProbesConfig:w}=a,k=r(()=>i.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:`${e.namespace} / ${e.kind} / ${e.name}`})),[i]),T=r(()=>Array.from(new Set(i.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[i]),[x,A]=l(Qa.Noisy),[I,N]=l(null),[O,P]=l(!1),[M,L]=l(!1),[F,z]=l(null),[V,B]=l(!1),[X,j]=l(!1),[H,G]=l(!1),K=r(()=>Za(s),[s]),q=r(()=>en(o),[o]),Y=r(()=>tn(q?.rule??null),[q]),J=r(()=>an(o),[o]),Q=r(()=>nn(J?.rule??null),[J]),Z=d(I);Z.current=I,n(()=>{const e=Z.current;if(!e)return;const t=on(o,e);t?N(t):(N(null),P(!1))},[o]);const ee=r(()=>{const e=new Set;return q&&e.add(q.rule.ruleId),J&&e.add(J.rule.ruleId),e},[q,J]),te=r(()=>ln(o,x,ee),[o,x,ee]),ae=c(()=>L(!0),[]),ne=c(()=>L(!1),[]),ie=c(e=>{const t=o[0]?.id??"default";switch(pn[x]){case"noisy":h(t,cn(e));break;case"highlyRelevant":f(t,rn(e));break;case"costReduction":v(t,sn(e))}L(!1)},[o,x,h,f,v]),oe=c(e=>{const t=dn(o,e);t&&(P(!1),N(t))},[o]),le=c(()=>{N(null),P(!1)},[]),se=c((e,t)=>{const a=I;if(a&&a.rule.ruleId===e&&a.samplingId===t)P(!0),N({...a});else for(const a of o){if(a.id!==t)continue;const n=[...a.noisyOperations.map(e=>({category:"noisy",rule:e})),...a.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...a.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(n)return P(!0),void N({category:n.category,rule:n.rule,samplingId:t,summary:un(n.category,n.rule)})}},[I,o]),re=c((e,t,a)=>{const n=I?.category;if(n){switch(n){case"noisy":g(a,t,cn(e));break;case"highlyRelevant":y(a,t,rn(e));break;case"costReduction":S(a,t,sn(e))}P(!1)}},[I,g,y,S]),ce=c((e,t)=>{z({ruleId:e,samplingId:t})},[]),ue=c(()=>{if(!F)return;const{ruleId:e,samplingId:t}=F,a=I?.category||pn[x];C(t,e,a),N(null),P(!1),z(null)},[F,I,x,C]),pe=c(()=>z(null),[]),me=c((e,t)=>{w(e,t),B(!1)},[w]),be=c(e=>{const t=o[0]?.id??"default",a=q;a?y(a.samplingId,a.rule.ruleId,{name:a.rule.name,disabled:!e,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null,notes:a.rule.notes}):e&&f(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null}),j(!1)},[o,q,f,y]),fe=c((e,t)=>{const a=o[0]?.id??"default",n=J;n?S(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,sourceScopes:[],operation:null,percentageAtMost:t,notes:n.rule.notes}):e&&v(a,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:[],operation:null,percentageAtMost:t}),G(!1)},[o,J,v,S]),ye=c(e=>{const t=pn[x];let a=null;switch(t){case"noisy":{const n=cn(e);a=mn(o,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=rn(e);a=mn(o,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=sn(e);a=mn(o,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return a?{message:hn,ruleId:a}:null},[o,x]),Ce=c(e=>{const t=I?.category,a=I?.rule.ruleId;if(!t)return null;let n=null;switch(t){case"noisy":{const i=cn(e);n=mn(o,t,{sourceScopes:i.sourceScopes,operation:i.operation},a);break}case"highlyRelevant":{const i=rn(e);n=mn(o,t,{sourceScopes:i.sourceScopes,operation:i.operation,error:i.error??!1,durationAtLeastMs:i.durationAtLeastMs},a);break}case"costReduction":{const i=sn(e);n=mn(o,t,{sourceScopes:i.sourceScopes,operation:i.operation},a);break}}return n?{message:hn,ruleId:n}:null},[o,I]),we=c(e=>{L(!1);for(const t of o){const a=[...t.noisyOperations.map(e=>({category:"noisy",rule:e})),...t.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...t.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(a)return P(!0),void N({category:a.category,rule:a.rule,samplingId:t.id,summary:un(a.category,a.rule)})}},[o]),ke=r(()=>{const e=[];return a.docsUrl&&e.push({id:jt(),type:Wt.Button,buttonProps:{"data-id":"sampling-btn-docs",label:gn,leftIcon:Dn,size:E.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")}}),e.push({id:jt(),type:Wt.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:bn,leftIcon:ti,size:E.S,variant:R.Text,onClick:m,loading:u}}),e.push({id:jt(),type:Wt.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:fn,rightIcon:$n,size:E.S,variant:R.Primary,onClick:ae}}),e},[a.docsUrl,m,u,ae]);return e(Ht,{children:[e($,{$gap:12,$justifyContent:"space-between",children:[t(Ma,{icon:Kn,title:vn,subTitle:yn}),t(La,{actions:ke})]}),e(b,{$gap:12,children:[t(_,{variant:Ua.Underline,options:Sn,selected:x,setSelected:A}),e($,{$justifyContent:"space-between",children:[t(U,{status:W.Default,message:Cn[x]}),a.docsUrl&&t(D,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:Dn,size:E.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")})]}),x===Qa.Noisy?t(bi,{title:Se,summary:K,onEdit:()=>B(!0)}):x===Qa.HighlyRelevant?t(bi,{title:ge,summary:Y,onEdit:()=>j(!0)}):x===Qa.CostReduction?t(bi,{title:ve,summary:Q,onEdit:()=>G(!0)}):null,t(yr,{title:wn[x],items:te,isLoading:u,showTypeFilter:x===Qa.HighlyRelevant,tableRowsMaxHeight:p,onRuleClick:oe,onCreateRule:ae,onEditRule:se,onDeleteRule:ce})]}),t(al,{formType:he.View,data:I,defaultEditMode:O,onClose:le,onDelete:ce,onSaveEdit:re,sourceOptions:k,namespaceOptions:T,validateForm:Ce,onNavigateToDuplicate:we}),t(al,{formType:he.Create,isOpen:M,category:pn[x],onClose:ne,onSubmit:ie,sourceOptions:k,namespaceOptions:T,validateForm:ye,onNavigateToDuplicate:we}),t(al,{formType:he.EditAutoNoisy,isOpen:V,enabled:s?.enabled??!1,keepPercentage:s?.keepPercentage??0,onClose:()=>B(!1),onSave:me}),t(al,{formType:he.EditAutoHighlyRelevant,isOpen:X,enabled:!!q&&!q.rule.disabled,onClose:()=>j(!1),onSave:be}),t(al,{formType:he.EditAutoCostReduction,isOpen:H,enabled:!!J&&!J.rule.disabled,dropPercentage:J?.rule.percentageAtMost??25,onClose:()=>G(!1),onSave:fe}),t(de,{title:An,description:xn,isOpen:!!F,onClose:pe,denyButton:{label:Tn,variant:R.Secondary,onClick:pe},approveButton:{label:kn,variant:R.Primary,onClick:()=>{ue(),pe()}}})]})},Sr=p.div`
188
489
  display: flex;
189
490
  align-items: center;
190
491
  justify-content: space-between;
191
492
  padding: 0 12px;
192
- `,dl=({disabled:a,loading:n,tabs:o,selectedTab:i,setSelectedTab:s,onClickReset:c,onClickRefresh:d})=>{const[u,p]=l(!1),m=r(()=>{const e=[];return c&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Reset",leftIcon:Xa,size:$.S,variant:R.Text,onClick:()=>p(!0),disabled:a}}),d&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:d,disabled:a,loading:n}}),e},[a,n,d]);return e(cl,{children:[e(D,{$gap:12,$alignItems:"center",children:[t(Jt,{icon:dn,title:"Odigos Settings"}),t(Ne,{width:"350px",options:o,values:[i],setValues:e=>s(e[0]),disabled:a})]}),t(Qt,{actions:m}),t(Va,{isOpen:u,onClose:()=>p(!1),onDeny:()=>p(!1),onApprove:c,title:"Reset Settings",description:"Are you sure you want to reset the settings? This will clear the odigos-local-ui-config and reset the settings to the default values."})]})},ul=p(D)`
493
+ `,Cr=({disabled:a,loading:n,tabs:i,selectedTab:o,setSelectedTab:s,onClickReset:c,onClickRefresh:d})=>{const[u,p]=l(!1),m=r(()=>{const e=[];return c&&e.push({id:jt(),type:Wt.Button,buttonProps:{label:"Reset",leftIcon:Nn,size:E.S,variant:R.Text,onClick:()=>p(!0),disabled:a}}),d&&e.push({id:jt(),type:Wt.Button,buttonProps:{label:"Refresh",leftIcon:ti,size:E.S,variant:R.Text,onClick:d,disabled:a,loading:n}}),e},[a,n,d]);return e(Sr,{children:[e($,{$gap:12,$alignItems:"center",children:[t(Ma,{icon:Gn,title:"Odigos Settings"}),t(Ee,{width:"350px",options:i,values:[o],setValues:e=>s(e[0]),disabled:a})]}),t(La,{actions:m}),t(de,{isOpen:u,onClose:()=>p(!1),title:"Reset Settings",description:"Are you sure you want to reset the settings? This will clear the odigos-local-ui-config and reset the settings to the default values.",denyButton:{label:"Deny",variant:R.Secondary,onClick:()=>p(!1)},approveButton:{label:"Approve",variant:R.Primary,onClick:()=>{c?.(),p(!1)}}})]})},wr=p($)`
193
494
  flex: 1;
194
495
  min-height: 0;
195
496
  width: 100%;
196
497
  align-self: stretch;
197
- `,pl=p(g)`
498
+ `,kr=p(b)`
198
499
  flex: 1;
199
500
  min-height: 0;
200
501
  height: 100%;
201
502
  overflow-y: auto;
202
- `,ml=e=>"general"===e.name?0:"advanced"===e.name?2:1,hl=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:i,configYamlsLoading:s,effectiveConfig:c,effectiveConfigLoading:d,refetch:u,factoryReset:p,onSave:m,saveLoading:h})=>{const{isVersionSupported:b,version:f,isEnterprise:y}=Me(a),v=r(()=>{if(!c)return{};const{manifestYAML:e,provenance:t,...a}=c;return a},[c]),{formData:C,handleFormChange:S,getNestedValue:w,getFormDiff:k,isFormDirty:T}=ot(v);n(()=>{"{}"!==JSON.stringify(v)&&"{}"===JSON.stringify(C)&&S(void 0,void 0,v)},[v,C]);const A=r(()=>[...i].sort((e,t)=>ml(e)-ml(t)),[i]),N=r(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(c?.provenance),[c?.provenance]),I=r(()=>{const e=new Set;for(const t of i)for(const a of t.fields)a.componentType===x.Dropdown&&e.add(a.helmValuePath);return e},[i]),[D,E]=l(!1),O=r(()=>[{id:Bt(),type:_t.Button,buttonProps:{"data-id":"settings-save",variant:R.Primary,size:$.S,label:"Save Changes",leftIcon:on,loading:h,onClick:()=>E(!0)}},{id:Bt(),type:_t.Button,buttonProps:{"data-id":"settings-cancel",variant:R.Secondary,size:$.S,label:"Cancel",leftIcon:ln,onClick:()=>S(void 0,void 0,v)}}],[h,k,v,C,S]),P=r(()=>A.map(e=>({id:e.name,label:e.displayName})),[A]),M=r(()=>A.map(e=>e.name),[A]),{selectedSection:L,setSelectedSection:V,setSectionRef:B,setScrollContainerRef:z}=ja({sectionNames:M});return e(Ut,{$heightOffset:o,$gap:12,children:[t(dl,{disabled:!b,loading:s||d,tabs:P,selectedTab:L,setSelectedTab:V,onClickReset:p?()=>p().then(()=>u?.()):void 0,onClickRefresh:u?()=>u():void 0}),e(ia,{children:[!b&&t(Hn,{minSupportedVersion:a,currentVersion:f||""}),t(Yt,{isOpen:T,richTitle:{icon:dn,title:"Config Settings"},actions:O}),t(Va,{isOpen:D,title:"Save Changes via UI?",description:"We recommend updating via your Helm values.yaml to ensure changes are version-controlled and go through a proper review process.",onClose:()=>E(!1),approveLabel:"Save changes",onApprove:async()=>{const e=((e,t)=>{const a=(e,t,a)=>{for(let a=0;a<t.length-1;a++){const n=t[a];n in e&&"object"==typeof e[n]&&null!==e[n]||(e[n]={}),e=e[n]}e[t[t.length-1]]=a},n=JSON.parse(JSON.stringify(e));for(const e of t){const t=e.split(".");let o=n;for(const e of t){if(null==o||"object"!=typeof o){o=void 0;break}o=o[e]}"string"==typeof o&&a(n,t,o.replaceAll("-","_"))}return n})(k(v,C),I);await(m?.(e)),S(void 0,void 0,{})},denyLabel:"Keep editing",onDeny:()=>E(!1)}),e(ul,{$gap:24,$alignItems:"stretch",children:[t(pl,{ref:z,$gap:24,$width:"100%",children:i.length?A.map(a=>t(ye,{id:a.name,ref:e=>B(a.name,e),richTitle:{icon:dn,title:a.displayName},children:a.fields.map(a=>{if(a.isEnterpriseOnly&&!y)return null;const n=Oe(a.componentProps||"{}",{}),o=N[a.helmValuePath];return e(g,{$gap:4,children:[t(En,{componentType:a.componentType,inputType:n.type,name:a.helmValuePath,label:a.displayName,tooltip:a.description,badge:o?{status:"odigos-local-ui-config"===o?X.Warning:Be.Unknown,label:o,tooltip:`This field is reconciled from the following resource: ${o}`}:void 0,disabled:a.isHelmOnly||h,value:w("formData",a.helmValuePath),setValue:e=>S(a.helmValuePath,e),dropdownOptions:n.options?.map(e=>({id:e,value:e})),dropdownNoSearch:!0,dropdownNoCheckbox:!0},a.helmValuePath),a.isHelmOnly?t(j,{status:X.Info,smallIcon:!0,message:"This field can only be updated via Helm values.yaml file"}):null]},a.helmValuePath)})},a.name)):s?t(ke,{$height:"30vh",children:t(Ee,{withSpinner:!0})}):t(ye,{richTitle:{icon:dn,title:"Config Settings"},children:t(F,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),t(pl,{children:d&&!c?.manifestYAML?t(ke,{$height:"30vh",children:t(Ee,{withSpinner:!0})}):t(Wn,{title:"Effective Config YAML",yaml:c?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})]})};export{Ro as AddActionDrawer,io as AddActionForm,_o as AddDestinationDrawer,ro as AddDestinationForm,Uo as AddRuleDrawer,fo as AddRuleForm,qo as AddSourceDrawer,Di as CentralConnections,Jo as EditActionDrawer,Qo as EditConfigDrawer,Zo as EditDestinationDrawer,ei as EditRuleDrawer,Ui as Onboarding,tl as PipelineCollectors,mi as SamplingRuleDrawer,ko as SamplingRuleForm,rl as SamplingRules,hl as Settings,wi as SystemDrawer,el as TABS};
503
+ `,Tr=e=>"general"===e.name?0:"advanced"===e.name?2:1,xr=({minSupportedVersion:a=0,pageHeightOffset:i=0,configYamls:o,configYamlsLoading:s,effectiveConfig:c,effectiveConfigLoading:d,refetch:u,factoryReset:p,onSave:m,saveLoading:h})=>{const{isVersionSupported:g,version:f,isEnterprise:y}=Be(a),v=r(()=>{if(!c)return{};const{manifestYAML:e,provenance:t,...a}=c;return a},[c]),{formData:S,handleFormChange:C,getNestedValue:w,getFormDiff:k,isFormDirty:T}=ct(v);n(()=>{"{}"!==JSON.stringify(v)&&"{}"===JSON.stringify(S)&&C(void 0,void 0,v)},[v,S]);const x=r(()=>[...o].sort((e,t)=>Tr(e)-Tr(t)),[o]),A=r(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(c?.provenance),[c?.provenance]),I=r(()=>{const e=new Set;for(const t of o)for(const a of t.fields)a.componentType===O.Dropdown&&e.add(a.helmValuePath);return e},[o]),N=r(()=>o.flatMap(e=>e.fields.map(e=>({name:e.helmValuePath,value:w("formData",e.helmValuePath)}))),[o,S,w]),[$,D]=l(!1),P=async()=>{const e=((e,t)=>{const a=(e,t,a)=>{for(let a=0;a<t.length-1;a++){const n=t[a];n in e&&"object"==typeof e[n]&&null!==e[n]||(e[n]={}),e=e[n]}e[t[t.length-1]]=a},n=JSON.parse(JSON.stringify(e));for(const e of t){const t=e.split(".");let i=n;for(const e of t){if(null==i||"object"!=typeof i){i=void 0;break}i=i[e]}"string"==typeof i&&a(n,t,i.replaceAll("-","_"))}return n})(k(v,S),I);await(m?.(e)),C(void 0,void 0,{})},M=r(()=>[{id:jt(),type:Wt.Button,buttonProps:{"data-id":"settings-save",variant:R.Primary,size:E.S,label:"Save Changes",leftIcon:Xn,loading:h,onClick:()=>D(!0)}},{id:jt(),type:Wt.Button,buttonProps:{"data-id":"settings-cancel",variant:R.Secondary,size:E.S,label:"Cancel",leftIcon:jn,onClick:()=>C(void 0,void 0,v)}}],[h,k,v,S,C]),F=r(()=>x.map(e=>({id:e.name,label:e.displayName})),[x]),z=r(()=>x.map(e=>e.name),[x]),{selectedSection:V,setSelectedSection:_,setSectionRef:B,setScrollContainerRef:j}=In({sectionNames:z});return e(Ht,{$heightOffset:i,$gap:12,children:[t(Cr,{disabled:!g,loading:s||d,tabs:F,selectedTab:V,setSelectedTab:_,onClickReset:p?()=>p().then(()=>u?.()):void 0,onClickRefresh:u?()=>u():void 0}),e(ja,{children:[!g&&t(Ei,{minSupportedVersion:a,currentVersion:f||""}),t(Zt,{isOpen:T,richTitle:{icon:Gn,title:"Config Settings"},actions:M}),t(de,{isOpen:$,title:"Save Changes via UI?",description:"We recommend updating via your Helm values.yaml to ensure changes are version-controlled and go through a proper review process.",onClose:()=>D(!1),denyButton:{label:"Keep editing",variant:R.Secondary,onClick:()=>D(!1)},approveButton:{label:"Save changes",variant:R.Primary,onClick:()=>{P(),D(!1)}}}),e(wr,{$gap:24,$alignItems:"stretch",children:[t(kr,{ref:j,$gap:24,$width:"100%",children:o.length?x.map(a=>t(Te,{id:a.name,ref:e=>B(a.name,e),richTitle:{icon:Gn,title:a.displayName},children:a.fields.map(a=>{if(a.isEnterpriseOnly&&!y)return null;if(a.renderCondition&&!X(a.renderCondition,[],N))return null;const n=ze(a.componentProps||"{}",{}),i=A[a.helmValuePath];return e(b,{$gap:4,children:[t(gi,{componentType:a.componentType,inputType:n.type,name:a.helmValuePath,label:a.displayName,tooltip:a.description,badge:i?{status:"odigos-local-ui-config"===i?W.Warning:Ue.Unknown,label:i,tooltip:`This field is reconciled from the following resource: ${i}`}:void 0,disabled:a.isHelmOnly||h,value:w("formData",a.helmValuePath),setValue:e=>C(a.helmValuePath,e),dropdownOptions:n.options?.map(e=>({id:e,value:e})),dropdownNoSearch:!0,dropdownNoCheckbox:!0},a.helmValuePath),a.isHelmOnly?t(U,{status:W.Info,smallIcon:!0,message:"This field can only be updated via Helm values.yaml file"}):null]},a.helmValuePath)})},a.name)):s?t($e,{$height:"30vh",children:t(Pe,{withSpinner:!0})}):t(Te,{richTitle:{icon:Gn,title:"Config Settings"},children:t(L,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),t(kr,{children:d&&!c?.manifestYAML?t($e,{$height:"30vh",children:t(Pe,{withSpinner:!0})}):t(Oi,{title:"Effective Config YAML",yaml:c?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})]})};export{So as AddActionDrawer,Hi as AddActionForm,pl as AddDataStreamModal,Do as AddDestinationDrawer,qi as AddDestinationForm,Eo as AddRuleDrawer,no as AddRuleForm,Vo as AddSourceDrawer,vl as CentralConnections,oo as DataStreamForm,io as DataStreamMergeWarning,_o as EditActionDrawer,Bo as EditConfigDrawer,ml as EditDataStreamModal,Xo as EditDestinationDrawer,jo as EditRuleDrawer,Ol as Onboarding,Zs as Overview,pr as PipelineCollectors,al as SamplingRuleDrawer,po as SamplingRuleForm,vr as SamplingRules,xr as Settings,ul as SystemDrawer,ur as TABS};