@odigos/ui-kit 0.0.246 → 0.0.248

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.248](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.247...ui-kit-v0.0.248) (2026-06-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **add-source-drawer:** scope selected state to active data stream to prevent incorrect pre-selection ([#995](https://github.com/odigos-io/ui-kit/issues/995)) ([aba68bc](https://github.com/odigos-io/ui-kit/commit/aba68bc82f7d1e47f0cb35494844464e8ae18fe1))
9
+ * **table:** add text wrapping and min-width to table cell paragraphs ([#994](https://github.com/odigos-io/ui-kit/issues/994)) ([a81b867](https://github.com/odigos-io/ui-kit/commit/a81b867dc4f175817ea2e0f5c79ca1db5feabaa4))
10
+
11
+ ## [0.0.247](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.246...ui-kit-v0.0.247) (2026-06-11)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **actions:** remove unsupported signal in PiiMasking action: PROFILES ([#987](https://github.com/odigos-io/ui-kit/issues/987)) ([7692eb6](https://github.com/odigos-io/ui-kit/commit/7692eb65952f6d9cb99e3f942a0dd6f9570c12eb))
17
+ * refactor to use `box-sizing: border-box` ([#991](https://github.com/odigos-io/ui-kit/issues/991)) ([7911174](https://github.com/odigos-io/ui-kit/commit/79111746d70cc04caf535b3042c2eade491359d3))
18
+ * **settings:** improved YAML card background handling during scroll ([#989](https://github.com/odigos-io/ui-kit/issues/989)) ([5866997](https://github.com/odigos-io/ui-kit/commit/586699742f1c5a2b3717d8d68a1913dbefbbb55b))
19
+ * **source-scope:** replace SectionCard with DataCard for improved UI consistency ([#988](https://github.com/odigos-io/ui-kit/issues/988)) ([84e1c31](https://github.com/odigos-io/ui-kit/commit/84e1c319848f2eea1f8206d65fc85d58aeed3913))
20
+ * **table:** title text wrapping ([#990](https://github.com/odigos-io/ui-kit/issues/990)) ([4071faf](https://github.com/odigos-io/ui-kit/commit/4071fafafe41ca526e9d1e2a399ca35afcd371e5))
21
+
3
22
  ## [0.0.246](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.245...ui-kit-v0.0.246) (2026-06-09)
4
23
 
5
24
 
@@ -1,4 +1,4 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useMemo as n,useContext as o,createContext as a,Fragment as s}from"react";import{t as i,T as u,P as l,u as c,a as p,b as d,c as f}from"./ui-components-DNrEjxrR.js";import h from"styled-components";const m=a({platformType:l.K8s,tier:u.Community,version:"v0.0.0"}),v=({children:t,platformType:r,tier:o,version:a})=>{const s=n(()=>({platformType:r,tier:o,version:a}),[r,o,a]);return e(m.Provider,{value:s,children:t})},g=(e,t)=>!t||i(e)>=i(t),y=e=>{const t=o(m),r=g(t.version,e),n=t.platformType===l.Vm;return{...t,isVersionSupported:r,isVm:n,isEnterprise:t.tier===u.Onprem}};function x(){return{sources:[],namespaces:[],languages:[]}}function k(e){return!e||!e.sources?.length&&!e.namespaces?.length&&!e.languages?.length}function S(e){return e?{sources:e.sources?[...e.sources]:[],namespaces:e.namespaces?[...e.namespaces]:[],languages:e.languages?[...e.languages]:[]}:{sources:[],namespaces:[],languages:[]}}function A(e){return null==e||0===e}function T(e){return{name:"",notes:"",disabled:!1,ruleType:"Relevance",sourceScopes:{sources:[],namespaces:[],languages:[]},operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:"",durationPreset:"500",customDurationMs:"",keepErrors:!1,percentageMode:"costReduction"===e?"sample":"all",percentagePreset:"0",customPercentage:""}}function P(e){return k(e.sourceScopes)?null:e.sourceScopes}function R(e){return P(e)}function b(e){if("all"===e.percentageMode)return null;if("custom"===e.percentagePreset){const t=parseFloat(e.customPercentage);return isNaN(t)?null:t}return parseFloat(e.percentagePreset)}function M(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function D(e){return{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}}function I(e){return"all"===e.operationType?null:"httpServer"===e.operationType?D(e):"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function $(e){return"all"===e.operationType?null:"httpServer"===e.operationType?D(e):"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}function C(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:P(e),percentageAtMost:b(e),operation:I(e)}}function E(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:P(e),error:e.keepErrors,durationAtLeastMs:"Duration"===e.ruleType?M(e):null,percentageAtLeast:b(e),operation:$(e)}}function w(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:P(e),percentageAtMost:b(e)??0,operation:$(e)}}function L(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:R(e),operation:I(e),percentageAtMost:b(e),notes:e.notes||null}}function O(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:R(e),error:"Error"===e.ruleType,durationAtLeastMs:"Duration"===e.ruleType?M(e):null,operation:$(e),percentageAtLeast:b(e),notes:e.notes||null}}function N(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:R(e),operation:$(e),percentageAtMost:b(e)??0,notes:e.notes||null}}const H=["5000","1000","500","100","50"],K=["50","25","10","1","0.5","0.1","0"];function j(e){if(null==e)return{percentageMode:"all",percentagePreset:"0",customPercentage:""};const t=K.find(t=>Number(t)===e);return t?{percentageMode:"sample",percentagePreset:t,customPercentage:""}:{percentageMode:"sample",percentagePreset:"custom",customPercentage:String(e)}}function z(e){if(!e)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};const t=e;if(t.httpServer){return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""}}return t.kafkaConsumer?{operationType:"kafkaConsumer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaConsumer.kafkaTopic||""}:t.kafkaProducer?{operationType:"kafkaProducer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaProducer.kafkaTopic||""}:{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}function F(e){const t=T(),r=S(e.rule.sourceScopes);const n=function(e){return"highlyRelevant"!==e.category?"Relevance":e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance"}(e);let o,a,s={durationPreset:"500",customDurationMs:""},i=!1;switch(e.category){case"noisy":o=function(e){const t=e.rule.operation;if(!t)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};if(t.httpServer)return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""};if(t.httpClient)return{operationType:"httpClient",routeType:t.httpClient.templatedPathPrefix?"routePrefix":"route",route:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||"",serverAddress:t.httpClient.serverAddress||"",method:t.httpClient.method||"",kafkaTopic:""};return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}(e),a=A(u=e.rule.percentageAtMost)?{percentageMode:"all",percentagePreset:"0",customPercentage:""}:j(u);break;case"highlyRelevant":o=z(e.rule.operation),a=j(e.rule.percentageAtLeast),s=function(e){if(null==e)return{durationPreset:"500",customDurationMs:""};const t=H.find(t=>Number(t)===e);return t?{durationPreset:t,customDurationMs:""}:{durationPreset:"custom",customDurationMs:String(e)}}(e.rule.durationAtLeastMs),i=e.rule.error;break;case"costReduction":o=z(e.rule.operation),a=j(e.rule.percentageAtMost)}var u;return{...t,name:e.rule.name||"",notes:e.rule.notes||"",disabled:e.rule.disabled,ruleType:n,sourceScopes:r,...o,...s,keepErrors:i,...a}}var X;!function(e){e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"}(X||(X={}));const J=[X.Action,X.Endpoint,X.Scope,X.Duration],V=h.span`
1
+ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useMemo as n,useContext as o,createContext as a,Fragment as s}from"react";import{t as i,T as u,P as l,u as c,a as p,b as d,c as f}from"./ui-components-DNIrc4p5.js";import h from"styled-components";const m=a({platformType:l.K8s,tier:u.Community,version:"v0.0.0"}),v=({children:t,platformType:r,tier:o,version:a})=>{const s=n(()=>({platformType:r,tier:o,version:a}),[r,o,a]);return e(m.Provider,{value:s,children:t})},g=(e,t)=>!t||i(e)>=i(t),y=e=>{const t=o(m),r=g(t.version,e),n=t.platformType===l.Vm;return{...t,isVersionSupported:r,isVm:n,isEnterprise:t.tier===u.Onprem}};function x(){return{sources:[],namespaces:[],languages:[]}}function k(e){return!e||!e.sources?.length&&!e.namespaces?.length&&!e.languages?.length}function S(e){return e?{sources:e.sources?[...e.sources]:[],namespaces:e.namespaces?[...e.namespaces]:[],languages:e.languages?[...e.languages]:[]}:{sources:[],namespaces:[],languages:[]}}function A(e){return null==e||0===e}function T(e){return{name:"",notes:"",disabled:!1,ruleType:"Relevance",sourceScopes:{sources:[],namespaces:[],languages:[]},operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:"",durationPreset:"500",customDurationMs:"",keepErrors:!1,percentageMode:"costReduction"===e?"sample":"all",percentagePreset:"0",customPercentage:""}}function P(e){return k(e.sourceScopes)?null:e.sourceScopes}function R(e){return P(e)}function b(e){if("all"===e.percentageMode)return null;if("custom"===e.percentagePreset){const t=parseFloat(e.customPercentage);return isNaN(t)?null:t}return parseFloat(e.percentagePreset)}function M(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function D(e){return{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}}function I(e){return"all"===e.operationType?null:"httpServer"===e.operationType?D(e):"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function $(e){return"all"===e.operationType?null:"httpServer"===e.operationType?D(e):"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}function C(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:P(e),percentageAtMost:b(e),operation:I(e)}}function E(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:P(e),error:e.keepErrors,durationAtLeastMs:"Duration"===e.ruleType?M(e):null,percentageAtLeast:b(e),operation:$(e)}}function w(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:P(e),percentageAtMost:b(e)??0,operation:$(e)}}function L(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:R(e),operation:I(e),percentageAtMost:b(e),notes:e.notes||null}}function O(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:R(e),error:"Error"===e.ruleType,durationAtLeastMs:"Duration"===e.ruleType?M(e):null,operation:$(e),percentageAtLeast:b(e),notes:e.notes||null}}function N(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:R(e),operation:$(e),percentageAtMost:b(e)??0,notes:e.notes||null}}const H=["5000","1000","500","100","50"],K=["50","25","10","1","0.5","0.1","0"];function j(e){if(null==e)return{percentageMode:"all",percentagePreset:"0",customPercentage:""};const t=K.find(t=>Number(t)===e);return t?{percentageMode:"sample",percentagePreset:t,customPercentage:""}:{percentageMode:"sample",percentagePreset:"custom",customPercentage:String(e)}}function z(e){if(!e)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};const t=e;if(t.httpServer){return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""}}return t.kafkaConsumer?{operationType:"kafkaConsumer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaConsumer.kafkaTopic||""}:t.kafkaProducer?{operationType:"kafkaProducer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaProducer.kafkaTopic||""}:{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}function F(e){const t=T(),r=S(e.rule.sourceScopes);const n=function(e){return"highlyRelevant"!==e.category?"Relevance":e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance"}(e);let o,a,s={durationPreset:"500",customDurationMs:""},i=!1;switch(e.category){case"noisy":o=function(e){const t=e.rule.operation;if(!t)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};if(t.httpServer)return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""};if(t.httpClient)return{operationType:"httpClient",routeType:t.httpClient.templatedPathPrefix?"routePrefix":"route",route:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||"",serverAddress:t.httpClient.serverAddress||"",method:t.httpClient.method||"",kafkaTopic:""};return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}(e),a=A(u=e.rule.percentageAtMost)?{percentageMode:"all",percentagePreset:"0",customPercentage:""}:j(u);break;case"highlyRelevant":o=z(e.rule.operation),a=j(e.rule.percentageAtLeast),s=function(e){if(null==e)return{durationPreset:"500",customDurationMs:""};const t=H.find(t=>Number(t)===e);return t?{durationPreset:t,customDurationMs:""}:{durationPreset:"custom",customDurationMs:String(e)}}(e.rule.durationAtLeastMs),i=e.rule.error;break;case"costReduction":o=z(e.rule.operation),a=j(e.rule.percentageAtMost)}var u;return{...t,name:e.rule.name||"",notes:e.rule.notes||"",disabled:e.rule.disabled,ruleType:n,sourceScopes:r,...o,...s,keepErrors:i,...a}}var X;!function(e){e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"}(X||(X={}));const J=[X.Action,X.Endpoint,X.Scope,X.Duration],V=h.span`
2
2
  font-family: ${({theme:e,$isMono:t})=>t?e.font_family.secondary:e.font_family.primary};
3
3
  font-size: ${({theme:e})=>e.v2.text.size.xxs}px;
4
4
  line-height: 20px;
@@ -1,4 +1,4 @@
1
- import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as d,C as c,$ as u,ab as p,dQ as h,a2 as g,a3 as m,dR as v,dS as f,O as b,K as y,M as x,L as C,J as S,al as $,aj as k,aY as T,T as w,F as A,R as P,U as M,a5 as L,ay as O,dT as I,dU as D,aJ as z,dV as X,b as R,dW as N,a1 as H,c as B,dX as E,dY as V,dZ as q,d_ as j,d$ as G,e0 as J,e1 as U,a8 as K,e2 as F,e3 as W,e4 as Y,e5 as Z,e6 as Q,bO as _,e7 as ee,e8 as ae,e9 as te,ea as le,eb as re,ec as ne,ed as ie,ee as se,ef as oe,eg as de,eh as ce,az as ue,ei as pe,ej as he,ek as ge,el as me,em as ve,bB as fe,en as be,eo as ye,ep as xe,eq as Ce,er as Se,es as $e,et as ke,eu as Te,ev as we,n as Ae,ew as Pe,S as Me,ex as Le,aZ as Oe,ey as Ie,ez as De,eA as ze,eB as Xe,br as Re,ao as Ne,eC as He,eD as Be,eE as Ee,de as Ve,eF as qe,eG as je,eH as Ge,p as Je,d9 as Ue,W as Ke,eI as Fe,bc as We,aB as Ye,ac as Ze,f as Qe,aF as _e,dq as ea,bb as aa,bi as ta,ba as la,bR as ra,aS as na,eJ as ia}from"./ui-components-DNrEjxrR.js";import{jsx as sa,jsxs as oa,Fragment as da}from"react/jsx-runtime";import{y as ca,C as ua,z as pa,u as ha,A as ga,B as ma,D as va,E as fa,F as ba,G as ya,H as xa,i as Ca,m as Sa}from"./helpers-BFZzc68M.js";import{EditIcon as $a,OdigosLogoTextCentral as ka,OdigosLogoTextEnterprise as Ta,OdigosLogoTextCommunity as wa,OdigosLogoTextColoredCentral as Aa,OdigosLogoTextColoredEnterprise as Pa,OdigosLogoTextColoredCommunity as Ma,ArrowLeftIcon as La,ArrowRightIcon as Oa,VSquareIcon as Ia,VIcon as Da,CopyIcon as za,YamlIcon as Xa}from"../icons.js";import Ra,{useMemo as Na,useCallback as Ha,useState as Ba,useRef as Ea,useEffect as Va,forwardRef as qa,useImperativeHandle as ja}from"react";import Ga,{useTheme as Ja}from"styled-components";const Ua=({isOpen:t,onClose:l,onDeny:r,onApprove:n})=>sa(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:l,denyButton:{label:"Keep editing",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:"Discard changes",variant:a.Primary,onClick:()=>{n?.(),l()}}}),Ka=({isOpen:t,onClose:l,onDeny:r,onApprove:n,action:i="delete",target:s,description:o,overrideApproveButtonLabel:d,overrideDenyButtonLabel:c})=>{const u=i.charAt(0).toUpperCase()+i.substring(1),p=s?.endsWith("s")?"these":"this";return sa(e,{title:`${u}${s?` ${s}`:""}?`,description:o??`Are you sure you want to ${i}${s?` ${p} ${s}`:""}?`,isOpen:t,onClose:l,denyButton:{label:c??"Go back",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:d??u,variant:a.Primary,onClick:()=>{n?.(),l()}}})},Fa=({componentType:e,inputType:a,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C,setValue:S,errorMessage:$,warnMessage:k,helpMessage:T,dropdownOptions:w,dropdownNoSearch:A,dropdownNoCheckbox:P,timeUnits:M,timeDefaultUnit:L})=>{switch(e){case t.Input:return sa(p,{name:g,type:a,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",onChange:e=>{const t=e.target.value;S(a===h.Number?""===t?null:Number(t):t)},errorMessage:$,warnMessage:k,helpMessage:T},g);case t.MultiInput:return sa(u,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.KeyValuePair:return sa(d,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key",placeholder:"Key"},{keyName:"value",label:"Value",placeholder:"Value"}],values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.TextArea:return sa(o,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:C??"",onChange:e=>S(e.target.value),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Dropdown:return sa(s,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!A,options:w?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!P}))||[],values:C?[String(C)]:[],setValues:e=>S(e[0]),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Checkbox:return sa(i,{name:g,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Time:return sa(n,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",setValue:e=>S(e),units:M,defaultUnit:L,errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Toggle:return sa(l,{name:g,labelAlign:r.Right,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:T},g);default:return null}},Wa=Ga.div`
1
+ import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as d,C as c,$ as u,ab as p,dQ as h,a2 as g,a3 as m,dR as v,dS as f,O as b,K as y,M as x,L as C,J as S,al as $,aj as T,aY as k,T as w,F as A,R as P,U as M,a5 as L,ay as O,dT as I,dU as D,aJ as z,dV as X,b as R,dW as N,a1 as H,c as B,dX as E,dY as V,dZ as q,d_ as j,d$ as G,e0 as J,e1 as U,a8 as K,e2 as F,e3 as W,e4 as Y,e5 as Z,e6 as Q,bO as _,e7 as ee,e8 as ae,e9 as te,ea as le,eb as re,ec as ne,ed as ie,ee as se,ef as oe,eg as de,eh as ce,az as ue,ei as pe,ej as he,ek as ge,el as me,em as ve,bB as fe,en as be,eo as ye,ep as xe,eq as Ce,er as Se,es as $e,et as Te,eu as ke,ev as we,aS as Ae,n as Pe,ew as Me,S as Le,ex as Oe,aZ as Ie,ey as De,ez as ze,eA as Xe,eB as Re,br as Ne,ao as He,eC as Be,eD as Ee,eE as Ve,de as qe,eF as je,eG as Ge,eH as Je,p as Ue,d9 as Ke,W as Fe,eI as We,bc as Ye,aB as Ze,ac as Qe,f as _e,aF as ea,dq as aa,bb as ta,bi as la,ba as ra,bR as na,eJ as ia}from"./ui-components-DNIrc4p5.js";import{jsx as sa,jsxs as oa,Fragment as da}from"react/jsx-runtime";import{y as ca,C as ua,z as pa,u as ha,A as ga,B as ma,D as va,E as fa,F as ba,G as ya,H as xa,i as Ca,m as Sa}from"./helpers-LpbP8L0p.js";import{EditIcon as $a,OdigosLogoTextCentral as Ta,OdigosLogoTextEnterprise as ka,OdigosLogoTextCommunity as wa,OdigosLogoTextColoredCentral as Aa,OdigosLogoTextColoredEnterprise as Pa,OdigosLogoTextColoredCommunity as Ma,ArrowLeftIcon as La,ArrowRightIcon as Oa,VSquareIcon as Ia,VIcon as Da,CopyIcon as za,YamlIcon as Xa}from"../icons.js";import Ra,{useMemo as Na,useCallback as Ha,useState as Ba,useRef as Ea,useEffect as Va,forwardRef as qa,useImperativeHandle as ja}from"react";import Ga,{useTheme as Ja}from"styled-components";const Ua=({isOpen:t,onClose:l,onDeny:r,onApprove:n})=>sa(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:l,denyButton:{label:"Keep editing",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:"Discard changes",variant:a.Primary,onClick:()=>{n?.(),l()}}}),Ka=({isOpen:t,onClose:l,onDeny:r,onApprove:n,action:i="delete",target:s,description:o,overrideApproveButtonLabel:d,overrideDenyButtonLabel:c})=>{const u=i.charAt(0).toUpperCase()+i.substring(1),p=s?.endsWith("s")?"these":"this";return sa(e,{title:`${u}${s?` ${s}`:""}?`,description:o??`Are you sure you want to ${i}${s?` ${p} ${s}`:""}?`,isOpen:t,onClose:l,denyButton:{label:c??"Go back",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:d??u,variant:a.Primary,onClick:()=>{n?.(),l()}}})},Fa=({componentType:e,inputType:a,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C,setValue:S,errorMessage:$,warnMessage:T,helpMessage:k,dropdownOptions:w,dropdownNoSearch:A,dropdownNoCheckbox:P,timeUnits:M,timeDefaultUnit:L})=>{switch(e){case t.Input:return sa(p,{name:g,type:a,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",onChange:e=>{const t=e.target.value;S(a===h.Number?""===t?null:Number(t):t)},errorMessage:$,warnMessage:T,helpMessage:k},g);case t.MultiInput:return sa(u,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:T,helpMessage:k},g);case t.KeyValuePair:return sa(d,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key",placeholder:"Key"},{keyName:"value",label:"Value",placeholder:"Value"}],values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:T,helpMessage:k},g);case t.TextArea:return sa(o,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:C??"",onChange:e=>S(e.target.value),errorMessage:$,warnMessage:T,helpMessage:k},g);case t.Dropdown:return sa(s,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!A,options:w?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!P}))||[],values:C?[String(C)]:[],setValues:e=>S(e[0]),errorMessage:$,warnMessage:T,helpMessage:k},g);case t.Checkbox:return sa(i,{name:g,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:T,helpMessage:k},g);case t.Time:return sa(n,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",setValue:e=>S(e),units:M,defaultUnit:L,errorMessage:$,warnMessage:T,helpMessage:k},g);case t.Toggle:return sa(l,{name:g,labelAlign:r.Right,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:T,helpMessage:k},g);default:return null}},Wa=Ga.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: 24px;
@@ -10,7 +10,7 @@ import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as
10
10
  min-width: 0;
11
11
  white-space: pre;
12
12
  overflow-x: auto;
13
- `,Za=({title:e,summary:t,onEdit:l,renderAction:r})=>{const n=Na(()=>{const a=[];return e&&(a.push({text:e,variant:ca.Default}),a.push({text:" - ",variant:ca.Default})),a.push(...t),a},[e,t]);return oa(Wa,{children:[sa(Ya,{children:sa(ua,{parts:n})}),r&&r(),l&&sa(g,{"data-id":"sampling-btn-edit-auto-rule",label:v,rightIcon:$a,variant:a.Text,size:m.S,onClick:l})]})},Qa={[$.HttpRequest]:"HTTP request",[$.HttpResponse]:"HTTP response",[$.DbQuery]:"DB query",[$.Messaging]:"messaging"};function _a(e,a,t){return 1===e?a:t??`${a}s`}function et(e,a){const t=[],l=e.slice(0,3),r=e.slice(3);return l.forEach((e,l)=>{l>0&&t.push({text:", ",variant:ca.Default}),t.push({text:e,variant:a})}),r.length>0&&t.push({text:` + ${r.length} more`,variant:ca.Default,tooltipItems:r}),t}function at(e,a){switch(e){case b.CodeAttributes:return function(e){const a=Object.values(k).filter(a=>!!e.codeAttributes?.[a]).map(e=>T(e).toLowerCase());return a.length?[{text:"Collect",variant:ca.Action},{text:" ",variant:ca.Default},...et(a,ca.Endpoint)]:null}(a);case b.PayloadCollection:return function(e){const a=Object.values($).filter(a=>null!=e.payloadCollection?.[a]).map(e=>Qa[e]);return a.length?[{text:"Collect",variant:ca.Action},{text:" ",variant:ca.Default},...et(a,ca.Endpoint)]:null}(a);case b.HeadersCollection:return function(e){const a=(e.headersCollection?.[S.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!a.length)return null;const t=_a(a.length,"HTTP header");return[{text:`Collect ${a.length} ${t}`,variant:ca.Action},{text:"",variant:ca.Default,tooltipItems:a}]}(a);case b.CustomInstrumentation:return function(e){const a=(e.customInstrumentations?.[y.Java]??[]).map(e=>new x(e.className,e.methodName)).filter(e=>e.Verify()),t=(e.customInstrumentations?.[y.Golang]??[]).map(e=>new C(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify());if(!(a.length+t.length))return null;const l=[];a.length&&l.push(`${a.length} Java ${_a(a.length,"probe")}`),t.length&&l.push(`${t.length} Go ${_a(t.length,"probe")}`);const r=[...a.map(e=>`Java: ${e.toString()}`),...t.map(e=>`Go: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:ca.Action},{text:"",variant:ca.Default,tooltipItems:r}]}(a);default:return null}}const tt=({option:e,formState:a,renderAction:t})=>{const l=Na(()=>{const t=at(e?.type,a);return t?[...t,...pa(a.sourceScopes)]:[]},[e?.type,a]),r=0===l.length;return sa(Za,{title:r?f:"Instrumentation Rule Preview",summary:l,renderAction:t})},lt=({size:e=200,central:a=!1,useInline:t=!1})=>{const{tier:l}=ha();if(t){if(a)return sa(ka,{size:e});switch(l){case w.Community:return sa(wa,{size:e});case w.Onprem:return sa(Ta,{size:e});default:return null}}if(a)return sa(Aa,{size:e});switch(l){case w.Community:return sa(Ma,{size:e});case w.Onprem:return sa(Pa,{size:e});default:return null}},rt=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],nt=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],it=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],st=({description:e,options:a,selected:t,onSelect:l,customName:r,customLabel:n,customPlaceholder:i,customValue:s,onCustomChange:o,customInputType:d=h.Number,customMin:c,customMax:u})=>oa(A,{$gap:16,$alignItems:"flex-end",children:[oa(P,{$gap:6,children:[sa(M,{label:e}),sa(L,{options:a,selected:t,setSelected:l})]}),"custom"===t&&sa(p,{name:r,label:n,placeholder:i,type:d,value:s,onChange:o,width:160,min:c,max:u})]}),ot=()=>{},dt=e=>e.readOnly?sa(ct,{rule:e.rule}):sa(ut,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),ct=({rule:e})=>{const a=null!=e.durationAtLeastMs;return e.error?sa(O,{richTitle:{title:I},children:sa(l,{name:"sampling-view-toggle-keep-errors",onChange:ot,value:!0,size:z.S,label:D,labelAlign:r.Right})}):a?sa(O,{richTitle:{title:X},children:oa("div",{children:[sa(R,{size:B.XXXS,color:H.Secondary,children:N}),sa(R,{size:B.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},ut=({ruleType:e,formState:a,onChange:t})=>{const n=Ha(e=>t({durationPreset:e}),[t]),i=Ha(e=>t({customDurationMs:e.target.value}),[t]);return"Error"===e?sa(O,{richTitle:{title:I,subTitle:E},children:sa(l,{name:"sampling-toggle-keep-errors",value:!0,onChange:ot,size:z.S,label:D,labelAlign:r.Right})}):"Duration"===e?sa(O,{richTitle:{title:X,subTitle:V},children:sa(st,{description:N,options:it,selected:a.durationPreset,onSelect:n,customName:"sampling-input-custom-duration",customLabel:q,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:i})}):null},pt=Ga.div`
13
+ `,Za=({title:e,summary:t,onEdit:l,renderAction:r})=>{const n=Na(()=>{const a=[];return e&&(a.push({text:e,variant:ca.Default}),a.push({text:" - ",variant:ca.Default})),a.push(...t),a},[e,t]);return oa(Wa,{children:[sa(Ya,{children:sa(ua,{parts:n})}),r&&r(),l&&sa(g,{"data-id":"sampling-btn-edit-auto-rule",label:v,rightIcon:$a,variant:a.Text,size:m.S,onClick:l})]})},Qa={[$.HttpRequest]:"HTTP request",[$.HttpResponse]:"HTTP response",[$.DbQuery]:"DB query",[$.Messaging]:"messaging"};function _a(e,a,t){return 1===e?a:t??`${a}s`}function et(e,a){const t=[],l=e.slice(0,3),r=e.slice(3);return l.forEach((e,l)=>{l>0&&t.push({text:", ",variant:ca.Default}),t.push({text:e,variant:a})}),r.length>0&&t.push({text:` + ${r.length} more`,variant:ca.Default,tooltipItems:r}),t}function at(e,a){switch(e){case b.CodeAttributes:return function(e){const a=Object.values(T).filter(a=>!!e.codeAttributes?.[a]).map(e=>k(e).toLowerCase());return a.length?[{text:"Collect",variant:ca.Action},{text:" ",variant:ca.Default},...et(a,ca.Endpoint)]:null}(a);case b.PayloadCollection:return function(e){const a=Object.values($).filter(a=>null!=e.payloadCollection?.[a]).map(e=>Qa[e]);return a.length?[{text:"Collect",variant:ca.Action},{text:" ",variant:ca.Default},...et(a,ca.Endpoint)]:null}(a);case b.HeadersCollection:return function(e){const a=(e.headersCollection?.[S.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!a.length)return null;const t=_a(a.length,"HTTP header");return[{text:`Collect ${a.length} ${t}`,variant:ca.Action},{text:"",variant:ca.Default,tooltipItems:a}]}(a);case b.CustomInstrumentation:return function(e){const a=(e.customInstrumentations?.[y.Java]??[]).map(e=>new x(e.className,e.methodName)).filter(e=>e.Verify()),t=(e.customInstrumentations?.[y.Golang]??[]).map(e=>new C(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify());if(!(a.length+t.length))return null;const l=[];a.length&&l.push(`${a.length} Java ${_a(a.length,"probe")}`),t.length&&l.push(`${t.length} Go ${_a(t.length,"probe")}`);const r=[...a.map(e=>`Java: ${e.toString()}`),...t.map(e=>`Go: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:ca.Action},{text:"",variant:ca.Default,tooltipItems:r}]}(a);default:return null}}const tt=({option:e,formState:a,renderAction:t})=>{const l=Na(()=>{const t=at(e?.type,a);return t?[...t,...pa(a.sourceScopes)]:[]},[e?.type,a]),r=0===l.length;return sa(Za,{title:r?f:"Instrumentation Rule Preview",summary:l,renderAction:t})},lt=({size:e=200,central:a=!1,useInline:t=!1})=>{const{tier:l}=ha();if(t){if(a)return sa(Ta,{size:e});switch(l){case w.Community:return sa(wa,{size:e});case w.Onprem:return sa(ka,{size:e});default:return null}}if(a)return sa(Aa,{size:e});switch(l){case w.Community:return sa(Ma,{size:e});case w.Onprem:return sa(Pa,{size:e});default:return null}},rt=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],nt=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],it=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],st=({description:e,options:a,selected:t,onSelect:l,customName:r,customLabel:n,customPlaceholder:i,customValue:s,onCustomChange:o,customInputType:d=h.Number,customMin:c,customMax:u})=>oa(A,{$gap:16,$alignItems:"flex-end",children:[oa(P,{$gap:6,children:[sa(M,{label:e}),sa(L,{options:a,selected:t,setSelected:l})]}),"custom"===t&&sa(p,{name:r,label:n,placeholder:i,type:d,value:s,onChange:o,width:160,min:c,max:u})]}),ot=()=>{},dt=e=>e.readOnly?sa(ct,{rule:e.rule}):sa(ut,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),ct=({rule:e})=>{const a=null!=e.durationAtLeastMs;return e.error?sa(O,{richTitle:{title:I},children:sa(l,{name:"sampling-view-toggle-keep-errors",onChange:ot,value:!0,size:z.S,label:D,labelAlign:r.Right})}):a?sa(O,{richTitle:{title:X},children:oa("div",{children:[sa(R,{size:B.XXXS,color:H.Secondary,children:N}),sa(R,{size:B.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},ut=({ruleType:e,formState:a,onChange:t})=>{const n=Ha(e=>t({durationPreset:e}),[t]),i=Ha(e=>t({customDurationMs:e.target.value}),[t]);return"Error"===e?sa(O,{richTitle:{title:I,subTitle:E},children:sa(l,{name:"sampling-toggle-keep-errors",value:!0,onChange:ot,size:z.S,label:D,labelAlign:r.Right})}):"Duration"===e?sa(O,{richTitle:{title:X,subTitle:V},children:sa(st,{description:N,options:it,selected:a.durationPreset,onSelect:n,customName:"sampling-input-custom-duration",customLabel:q,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:i})}):null},pt=Ga.div`
14
14
  display: flex;
15
15
  gap: 32px;
16
16
  `,ht=Ga.div`
@@ -43,7 +43,7 @@ import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as
43
43
  align-items: flex-end;
44
44
  gap: 16px;
45
45
  margin-bottom: 12px;
46
- `,yt="Any",xt="Kafka topic",Ct=()=>sa("div",{style:{marginBottom:"8px"},children:sa(R,{size:B.XS,weight:500,children:"And"})}),St=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],$t=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],kt=[{id:"",label:yt},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}];const Tt=e=>e.readOnly?sa(wt,{data:e.data}):sa(At,{category:e.category,formState:e.formState,onChange:e.onChange}),wt=({data:e})=>{const a=Na(()=>function(e){if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:le,value:te},{id:"route",title:Y,value:a.httpServer.route||a.httpServer.routePrefix||re},{id:"method",title:ee,value:a.httpServer.method||yt}];if(a?.httpClient){const e=[{id:"type",title:le,value:ne}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:Y,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||re}),e.push({id:"method",title:ee,value:a.httpClient.method||yt}),e}return[{id:"type",title:le,value:ie}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:le,value:te},{id:"route",title:Y,value:a.httpServer.route||a.httpServer.routePrefix||re},{id:"method",title:ee,value:a.httpServer.method||yt}]:a?.kafkaConsumer?[{id:"type",title:le,value:se},{id:"topic",title:xt,value:a.kafkaConsumer.kafkaTopic||re}]:a?.kafkaProducer?[{id:"type",title:le,value:oe},{id:"topic",title:xt,value:a.kafkaProducer.kafkaTopic||re}]:[{id:"type",title:le,value:ie}]}(e),[e]);return sa(O,{richTitle:{title:j},children:sa(pt,{children:a.map(({id:e,title:a,value:t})=>oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,nowrap:!0,children:a}),sa(R,{size:B.XS,nowrap:!0,children:t})]},e))})})},At=({category:e,formState:t,onChange:l})=>{const r=Na(()=>"noisy"===e?St:$t,[e]),n=Ha(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),i=Ha(e=>a=>{a&&l({routeType:e,route:""})},[l]),s=Ha(e=>l({route:e.target.value}),[l]),o=Ha(e=>l({serverAddress:e.target.value}),[l]),d=Ha(e=>l({method:e[0]||""}),[l]),c=Ha(e=>l({kafkaTopic:e.target.value}),[l]),u="httpServer"===t.operationType||"httpClient"===t.operationType,h="kafkaConsumer"===t.operationType||"kafkaProducer"===t.operationType,g="httpClient"===t.operationType?W:Y,v="httpClient"===t.operationType?Z:Q;return oa(O,{richTitle:{title:`2. ${j}`,subTitle:G},children:[sa(P,{$alignItems:"flex-start",children:sa(L,{options:r,selected:t.operationType,setSelected:n})}),u&&oa(gt,{children:["httpClient"===t.operationType&&oa(bt,{children:[sa(p,{name:"sampling-input-server-address",label:U,placeholder:J,value:t.serverAddress,onChange:o}),sa(Ct,{})]}),oa(mt,{children:[oa(vt,{children:[sa(ft,{children:sa(K,{"data-id":"sampling-radio-route",value:"route"===t.routeType,onChange:i("route")})}),sa(p,{name:"sampling-input-route",label:g,placeholder:F,value:"route"===t.routeType?t.route:"",onChange:s,disabled:"route"!==t.routeType})]}),oa(vt,{children:[sa(ft,{children:sa(K,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===t.routeType,onChange:i("routePrefix")})}),sa(p,{name:"sampling-input-route-prefix",label:v,placeholder:F,value:"routePrefix"===t.routeType?t.route:"",onChange:s,disabled:"routePrefix"!==t.routeType})]})]}),oa(bt,{children:[sa(Ct,{}),sa(_,{label:ee,items:kt,selectedIds:[t.method||""],setSelectedIds:e=>d(e),buttonProps:{"data-id":"sampling-btn-method",label:kt.find(e=>e.id===t.method)?.label||yt,size:m.S,variant:a.Secondary}})]})]}),h&&sa(p,{name:"sampling-input-kafka-topic",label:ae,placeholder:"Type kafka topic",value:t.kafkaTopic,onChange:c,width:"320px"})]})},Pt=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Mt=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}];const Lt=e=>e.readOnly?sa(Ot,{data:e.data}):sa(It,{category:e.category,formState:e.formState,onChange:e.onChange}),Ot=({data:e})=>{const a=Na(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:ce,method:ge,description:pe,value:`${e.rule.percentageAtLeast}%`}:{title:ce,method:ve,description:null,value:null};case"noisy":return ga(e.rule.percentageAtMost)?{title:ce,method:me,description:null,value:null}:{title:ce,method:ge,description:he,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:ce,method:ge,description:he,value:`${e.rule.percentageAtMost}%`}}}(e),[e]),t=[{id:"method",title:ee,value:a.method},...null!=a.description?[{id:"value",title:a.description,value:a.value}]:[]];return sa(O,{richTitle:{title:a.title},children:sa(pt,{children:t.map(({id:e,title:a,value:t})=>oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,nowrap:!0,children:a}),sa(R,{size:B.XS,nowrap:!0,children:t})]},e))})})},It=({category:e,formState:a,onChange:t})=>{const l="highlyRelevant"===e,r=l?Mt:Pt,n=`${l?4:3}. ${ce}`,i=de[e],s=l?pe:he,o="noisy"===e?nt:rt,d=Ha(e=>t({percentageMode:e}),[t]),c=Ha(e=>t({percentagePreset:e}),[t]),u=Ha(e=>t({customPercentage:e.target.value}),[t]);return oa(O,{richTitle:{title:n,subTitle:i},children:["costReduction"!==e&&sa(P,{$alignItems:"flex-start",children:sa(L,{options:r,selected:a.percentageMode,setSelected:d})}),("costReduction"===e||"sample"===a.percentageMode)&&sa(st,{description:s,options:o,selected:a.percentagePreset,onSelect:c,customName:"sampling-input-custom-percentage",customLabel:ue,customPlaceholder:"5%",customValue:a.customPercentage,onCustomChange:u,customInputType:h.Decimal,customMin:0,customMax:100})]})},Dt=Ga.div`
46
+ `,yt="Any",xt="Kafka topic",Ct=()=>sa("div",{style:{marginBottom:"8px"},children:sa(R,{size:B.XS,weight:500,children:"And"})}),St=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],$t=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],Tt=[{id:"",label:yt},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}];const kt=e=>e.readOnly?sa(wt,{data:e.data}):sa(At,{category:e.category,formState:e.formState,onChange:e.onChange}),wt=({data:e})=>{const a=Na(()=>function(e){if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:le,value:te},{id:"route",title:Y,value:a.httpServer.route||a.httpServer.routePrefix||re},{id:"method",title:ee,value:a.httpServer.method||yt}];if(a?.httpClient){const e=[{id:"type",title:le,value:ne}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:Y,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||re}),e.push({id:"method",title:ee,value:a.httpClient.method||yt}),e}return[{id:"type",title:le,value:ie}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:le,value:te},{id:"route",title:Y,value:a.httpServer.route||a.httpServer.routePrefix||re},{id:"method",title:ee,value:a.httpServer.method||yt}]:a?.kafkaConsumer?[{id:"type",title:le,value:se},{id:"topic",title:xt,value:a.kafkaConsumer.kafkaTopic||re}]:a?.kafkaProducer?[{id:"type",title:le,value:oe},{id:"topic",title:xt,value:a.kafkaProducer.kafkaTopic||re}]:[{id:"type",title:le,value:ie}]}(e),[e]);return sa(O,{richTitle:{title:j},children:sa(pt,{children:a.map(({id:e,title:a,value:t})=>oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,nowrap:!0,children:a}),sa(R,{size:B.XS,nowrap:!0,children:t})]},e))})})},At=({category:e,formState:t,onChange:l})=>{const r=Na(()=>"noisy"===e?St:$t,[e]),n=Ha(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),i=Ha(e=>a=>{a&&l({routeType:e,route:""})},[l]),s=Ha(e=>l({route:e.target.value}),[l]),o=Ha(e=>l({serverAddress:e.target.value}),[l]),d=Ha(e=>l({method:e[0]||""}),[l]),c=Ha(e=>l({kafkaTopic:e.target.value}),[l]),u="httpServer"===t.operationType||"httpClient"===t.operationType,h="kafkaConsumer"===t.operationType||"kafkaProducer"===t.operationType,g="httpClient"===t.operationType?W:Y,v="httpClient"===t.operationType?Z:Q;return oa(O,{richTitle:{title:`2. ${j}`,subTitle:G},children:[sa(P,{$alignItems:"flex-start",children:sa(L,{options:r,selected:t.operationType,setSelected:n})}),u&&oa(gt,{children:["httpClient"===t.operationType&&oa(bt,{children:[sa(p,{name:"sampling-input-server-address",label:U,placeholder:J,value:t.serverAddress,onChange:o}),sa(Ct,{})]}),oa(mt,{children:[oa(vt,{children:[sa(ft,{children:sa(K,{"data-id":"sampling-radio-route",value:"route"===t.routeType,onChange:i("route")})}),sa(p,{name:"sampling-input-route",label:g,placeholder:F,value:"route"===t.routeType?t.route:"",onChange:s,disabled:"route"!==t.routeType})]}),oa(vt,{children:[sa(ft,{children:sa(K,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===t.routeType,onChange:i("routePrefix")})}),sa(p,{name:"sampling-input-route-prefix",label:v,placeholder:F,value:"routePrefix"===t.routeType?t.route:"",onChange:s,disabled:"routePrefix"!==t.routeType})]})]}),oa(bt,{children:[sa(Ct,{}),sa(_,{label:ee,items:Tt,selectedIds:[t.method||""],setSelectedIds:e=>d(e),buttonProps:{"data-id":"sampling-btn-method",label:Tt.find(e=>e.id===t.method)?.label||yt,size:m.S,variant:a.Secondary}})]})]}),h&&sa(p,{name:"sampling-input-kafka-topic",label:ae,placeholder:"Type kafka topic",value:t.kafkaTopic,onChange:c,width:"320px"})]})},Pt=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Mt=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}];const Lt=e=>e.readOnly?sa(Ot,{data:e.data}):sa(It,{category:e.category,formState:e.formState,onChange:e.onChange}),Ot=({data:e})=>{const a=Na(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:ce,method:ge,description:pe,value:`${e.rule.percentageAtLeast}%`}:{title:ce,method:ve,description:null,value:null};case"noisy":return ga(e.rule.percentageAtMost)?{title:ce,method:me,description:null,value:null}:{title:ce,method:ge,description:he,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:ce,method:ge,description:he,value:`${e.rule.percentageAtMost}%`}}}(e),[e]),t=[{id:"method",title:ee,value:a.method},...null!=a.description?[{id:"value",title:a.description,value:a.value}]:[]];return sa(O,{richTitle:{title:a.title},children:sa(pt,{children:t.map(({id:e,title:a,value:t})=>oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,nowrap:!0,children:a}),sa(R,{size:B.XS,nowrap:!0,children:t})]},e))})})},It=({category:e,formState:a,onChange:t})=>{const l="highlyRelevant"===e,r=l?Mt:Pt,n=`${l?4:3}. ${ce}`,i=de[e],s=l?pe:he,o="noisy"===e?nt:rt,d=Ha(e=>t({percentageMode:e}),[t]),c=Ha(e=>t({percentagePreset:e}),[t]),u=Ha(e=>t({customPercentage:e.target.value}),[t]);return oa(O,{richTitle:{title:n,subTitle:i},children:["costReduction"!==e&&sa(P,{$alignItems:"flex-start",children:sa(L,{options:r,selected:a.percentageMode,setSelected:d})}),("costReduction"===e||"sample"===a.percentageMode)&&sa(st,{description:s,options:o,selected:a.percentagePreset,onSelect:c,customName:"sampling-input-custom-percentage",customLabel:ue,customPlaceholder:"5%",customValue:a.customPercentage,onCustomChange:u,customInputType:h.Decimal,customMin:0,customMax:100})]})},Dt=Ga.div`
47
47
  display: flex;
48
48
  align-items: flex-end;
49
49
  gap: 16px;
@@ -53,7 +53,7 @@ import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as
53
53
  `,Xt=Ga.div`
54
54
  flex: 1;
55
55
  min-width: 0;
56
- `;function Rt(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":ke[e.category]}const Nt=e=>e.readOnly?sa(Ht,{data:e.data}):sa(Bt,{formState:e.formState,onChange:e.onChange}),Ht=({data:e})=>{const a=Na(()=>[{id:"name",title:be,value:e.rule.name||fe},{id:"type",title:ye,value:Rt(e)}],[e]),t=e.rule.notes||re;return oa(O,{children:[sa(pt,{children:a.map(({id:e,title:a,value:t})=>oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,nowrap:!0,children:a}),sa(R,{size:B.XS,nowrap:!0,children:t})]},e))}),oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,children:xe}),sa(R,{size:B.XS,children:t})]})]})},Bt=({formState:e,onChange:a})=>{const t=Ha(e=>a({name:e.target.value}),[a]),l=Ha(e=>a({notes:e.target.value}),[a]);return sa(O,{children:oa(Dt,{children:[sa(zt,{children:sa(p,{name:"sampling-input-rule-name",label:be,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:Ce,value:e.name,onChange:t})}),sa(Xt,{children:sa(p,{name:"sampling-input-note",label:xe,tooltip:$e,placeholder:Se,value:e.notes,onChange:l})})]})})},Et=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Vt=({formState:e,onChange:a})=>{const t=Ha(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return sa(O,{richTitle:{title:`3. ${ye}`,subTitle:Te},children:sa(P,{$alignItems:"flex-start",children:sa(L,{options:Et,selected:e.ruleType,setSelected:t})})})},qt=e=>{const a=Na(()=>{if(e.readOnly)return e.summary;switch(e.category){case"noisy":return fa(xa(e.formState));case"highlyRelevant":return va(ya(e.formState));case"costReduction":return ma(ba(e.formState))}},[e]);if(e.readOnly)return sa(Za,{title:we,summary:a,renderAction:e.renderAction});const t=1===a.length&&"default"===a[0].variant;return sa(Za,{title:t?f:we,summary:t?[]:a,renderAction:e.renderAction})},jt=Ga.div`
56
+ `;function Rt(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Te[e.category]}const Nt=e=>e.readOnly?sa(Ht,{data:e.data}):sa(Bt,{formState:e.formState,onChange:e.onChange}),Ht=({data:e})=>{const a=Na(()=>[{id:"name",title:be,value:e.rule.name||fe},{id:"type",title:ye,value:Rt(e)}],[e]),t=e.rule.notes||re;return oa(O,{children:[sa(pt,{children:a.map(({id:e,title:a,value:t})=>oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,nowrap:!0,children:a}),sa(R,{size:B.XS,nowrap:!0,children:t})]},e))}),oa(ht,{children:[sa(R,{size:B.XXXS,color:H.Secondary,children:xe}),sa(R,{size:B.XS,children:t})]})]})},Bt=({formState:e,onChange:a})=>{const t=Ha(e=>a({name:e.target.value}),[a]),l=Ha(e=>a({notes:e.target.value}),[a]);return sa(O,{children:oa(Dt,{children:[sa(zt,{children:sa(p,{name:"sampling-input-rule-name",label:be,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:Ce,value:e.name,onChange:t})}),sa(Xt,{children:sa(p,{name:"sampling-input-note",label:xe,tooltip:$e,placeholder:Se,value:e.notes,onChange:l})})]})})},Et=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Vt=({formState:e,onChange:a})=>{const t=Ha(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return sa(O,{richTitle:{title:`3. ${ye}`,subTitle:ke},children:sa(P,{$alignItems:"flex-start",children:sa(L,{options:Et,selected:e.ruleType,setSelected:t})})})},qt=e=>{const a=Na(()=>{if(e.readOnly)return e.summary;switch(e.category){case"noisy":return fa(xa(e.formState));case"highlyRelevant":return va(ya(e.formState));case"costReduction":return ma(ba(e.formState))}},[e]);if(e.readOnly)return sa(Za,{title:we,summary:a,renderAction:e.renderAction});const t=1===a.length&&"default"===a[0].variant;return sa(Za,{title:t?f:we,summary:t?[]:a,renderAction:e.renderAction})},jt=Ga.div`
57
57
  display: flex;
58
58
  flex-wrap: wrap;
59
59
  gap: 8px;
@@ -101,7 +101,7 @@ import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as
101
101
  border-radius: 999px;
102
102
  background-color: ${({theme:e})=>e.v2.colors.silver[700]};
103
103
  border: 1px solid ${({theme:e})=>e.v2.colors.silver[600]};
104
- `,Yt={[Re.JavaScript]:"Node.js",[Re.DotNet]:".NET",[Re.Php]:"PHP",[Re.Java]:"Java",[Re.Go]:"Go",[Re.Python]:"Python",[Re.Ruby]:"Ruby",[Re.Rust]:"Rust"},Zt=[Re.Python,Re.Java,Re.JavaScript,Re.DotNet,Re.Php,Re.Ruby,Re.Go],Qt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function _t(e){const a=Yt[e];return a||e.charAt(0).toUpperCase()+e.slice(1)}function el(e){return null!=e?`${e}. ${Ge}`:Ge}const al=({readOnly:e,...a})=>sa(e?rl:nl,{...a}),tl=({title:e,count:a,children:t})=>oa(P,{$gap:6,children:[oa(A,{$gap:8,$alignItems:"center",children:[sa(R,{size:B.XS,color:H.Primary,nowrap:!0,children:e}),a>1&&oa(R,{size:B.XXS,color:H.Secondary,nowrap:!0,children:["(",qe,")"]})]}),sa(Kt,{children:t})]}),ll=()=>{const e=Ja();return sa(Ft,{children:sa(Wt,{children:sa(R,{size:B.XXS,color:e.v2.colors.white[500],nowrap:!0,children:je})})})},rl=({scopes:e,titleNumber:a})=>{const t=el(a);if(Ca(e))return sa(O,{richTitle:{title:t},children:sa(Ae,{status:Me.Default,message:Pe,fullWidth:!0})});const l=e.sources??[],r=e.namespaces??[],n=e.languages??[],i=[];return l.length&&i.push({kind:"sources",node:sa(tl,{title:Le,count:l.length,children:l.map((e,a)=>{const t=[e.namespace,e.kind,e.name].filter(Boolean),l=t.length?t.join(" / "):Ie;return sa(Oe,{label:l},`src-${a}-${l}`)})})}),r.length&&i.push({kind:"namespaces",node:sa(tl,{title:De,count:r.length,children:r.map((e,a)=>sa(Oe,{label:e},`ns-${a}-${e}`))})}),n.length&&i.push({kind:"languages",node:sa(tl,{title:ze,count:n.length,children:n.map((e,a)=>{const t=Ne(e);return sa(Oe,{label:_t(e),leftIcon:t},`lang-${a}-${e}`)})})}),sa(O,{richTitle:{title:t,subTitle:i.length>1?Xe:void 0},children:sa(Ut,{children:i.map((e,a)=>oa(Ra.Fragment,{children:[a>0&&sa(ll,{}),e.node]},e.kind))})})},nl=({scopes:e,onChange:a,sourceOptions:t=[],namespaceOptions:l=[],supportedLanguages:r,titleNumber:n,dataIdPrefix:s="source-scope",slim:o})=>{const d=e??Sa(),[c,u]=Ba(()=>(e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all")(d)),{sources:p,namespaces:h,languages:g}=d,m=p.length>0||h.length>0||g.length>0,v=Na(()=>Qt.map(e=>"language"===e.value&&0===r?.length?null:{...e,disabled:"all"===e.value&&m}).filter(Boolean),[m]),f=Na(()=>p.map(e=>{return a=e.namespace,t=e.kind,l=e.name,`${a}/${t}/${l}`;var a,t,l}),[p]),b=Na(()=>[...h],[h]),y=Na(()=>new Set(g),[g]),x=Ha(e=>{u(e)},[]),C=Ha(e=>{const t=e.map(e=>function(e){const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}}(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));a({...d,sources:t})},[d,a]),S=Ha(e=>{a({...d,namespaces:e})},[d,a]),$=Ha(e=>{const t=d.languages,l=t.includes(e)?t.filter(a=>a!==e):[...t,e];a({...d,languages:l})},[d,a]),k=!m&&"all"===c,T=(r||Zt).map(e=>({id:e,label:Yt[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:Ne(e)}));return oa(O,{richTitle:o?{title:el(n),titleSize:B.XS,titleColor:H.Secondary,tooltip:He}:{title:el(n),subTitle:He,subTitleWrap:!0},backgroundColor:o?"transparent":void 0,padding:o?0:void 0,children:[sa(Ae,k?{status:Me.Default,message:Pe,fullWidth:!0,smallIcon:!0}:{status:Me.Info,message:Xe,fullWidth:!0,smallIcon:!0}),sa(P,{$alignItems:"flex-start",children:sa(L,{options:v,selected:c,setSelected:x})}),"source"===c&&sa(Be,{multiple:!0,"data-id":`${s}-autocomplete-source`,options:t,value:f,onSelect:C,placeholder:Ee}),"namespace"===c&&sa(Be,{multiple:!0,"data-id":`${s}-autocomplete-namespace`,options:l,value:b,onSelect:S,placeholder:"Search namespace"}),"language"===c&&T.length>0&&sa(jt,{children:T.map(({id:e,label:a,Icon:t})=>{const l=y.has(e);return oa(Gt,{$selected:l,onClick:()=>$(e),children:[sa(i,{name:`${s}-lang-${e}`,size:Ve.S,value:l,onChange:()=>$(e)}),sa(Jt,{children:sa(t,{size:20})}),sa(R,{size:B.XS,nowrap:!0,children:a})]},e)})})]})},il=(e,a)=>!a?.length||!!a?.find(a=>a===e),sl=({title:e="Signals",required:a,errorMessage:t,allowedSignals:l,selectedSignals:r,setSelectedSignals:n,disabled:s})=>{const[o,d]=Ba(1===r.length),c=Ea(JSON.stringify(r));Va(()=>{let e=Je(r).filter(e=>il(e,l));e.length||(e=Ue.filter(({id:e})=>il(e,l)).map(({id:e})=>e));const a=JSON.stringify(e);c.current!==a&&(c.current=a,n(e),d(1===e.length))},[l,r]);return oa(P,{$gap:12,children:[sa(M,{label:e,required:a}),sa(A,{$gap:12,children:Ue.map(e=>{const a=il(e.id,l),t=((e,a)=>!!a?.find(a=>a===e))(e.id,r);return a?sa(i,{label:e.value,disabled:s||!a||o&&t,value:t,onChange:a=>((e,a)=>{const t=e,l=a?[...r,t]:r.filter(e=>e!==t);n(l),d(1===l.length)})(e.id,a)},e.id):null})}),sa(Ke,{errorMessage:t})]})},ol=({minSupportedVersion:a,currentVersion:t})=>sa(e,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>sa(Fe,{scale:2.4,icon:()=>sa("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:sa("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${a} or later.\nCurrent version: ${t}.`}),dl=Ga.div`
104
+ `,Yt={[Ne.JavaScript]:"Node.js",[Ne.DotNet]:".NET",[Ne.Php]:"PHP",[Ne.Java]:"Java",[Ne.Go]:"Go",[Ne.Python]:"Python",[Ne.Ruby]:"Ruby",[Ne.Rust]:"Rust"},Zt=[Ne.Python,Ne.Java,Ne.JavaScript,Ne.DotNet,Ne.Php,Ne.Ruby,Ne.Go],Qt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function _t(e){const a=Yt[e];return a||e.charAt(0).toUpperCase()+e.slice(1)}function el(e){return null!=e?`${e}. ${Je}`:Je}const al=({readOnly:e,...a})=>sa(e?rl:nl,{...a}),tl=({title:e,count:a,children:t})=>oa(P,{$gap:6,children:[oa(A,{$gap:8,$alignItems:"center",children:[sa(R,{size:B.XS,color:H.Primary,nowrap:!0,children:e}),a>1&&oa(R,{size:B.XXS,color:H.Secondary,nowrap:!0,children:["(",je,")"]})]}),sa(Kt,{children:t})]}),ll=()=>{const e=Ja();return sa(Ft,{children:sa(Wt,{children:sa(R,{size:B.XXS,color:e.v2.colors.white[500],nowrap:!0,children:Ge})})})},rl=({scopes:e,titleNumber:a})=>{const t=el(a);if(Ca(e))return sa(Ae,{bgTint:"900",richTitle:{title:t},withCollapse:!0,collapseIsDefaultOpen:!0,children:sa(Pe,{status:Le.Default,message:Me,fullWidth:!0})});const l=e.sources??[],r=e.namespaces??[],n=e.languages??[],i=[];return l.length&&i.push({kind:"sources",node:sa(tl,{title:Oe,count:l.length,children:l.map((e,a)=>{const t=[e.namespace,e.kind,e.name].filter(Boolean),l=t.length?t.join(" / "):De;return sa(Ie,{label:l},`src-${a}-${l}`)})})}),r.length&&i.push({kind:"namespaces",node:sa(tl,{title:ze,count:r.length,children:r.map((e,a)=>sa(Ie,{label:e},`ns-${a}-${e}`))})}),n.length&&i.push({kind:"languages",node:sa(tl,{title:Xe,count:n.length,children:n.map((e,a)=>{const t=He(e);return sa(Ie,{label:_t(e),leftIcon:t},`lang-${a}-${e}`)})})}),sa(Ae,{bgTint:"900",richTitle:{title:t,subTitle:i.length>1?Re:void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:sa(Ae,{bgTint:"800",children:sa(Ut,{children:i.map((e,a)=>oa(Ra.Fragment,{children:[a>0&&sa(ll,{}),e.node]},e.kind))})})})},nl=({scopes:e,onChange:a,sourceOptions:t=[],namespaceOptions:l=[],supportedLanguages:r,titleNumber:n,dataIdPrefix:s="source-scope",slim:o})=>{const d=e??Sa(),[c,u]=Ba(()=>(e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all")(d)),{sources:p,namespaces:h,languages:g}=d,m=p.length>0||h.length>0||g.length>0,v=Na(()=>Qt.map(e=>"language"===e.value&&0===r?.length?null:{...e,disabled:"all"===e.value&&m}).filter(Boolean),[m]),f=Na(()=>p.map(e=>{return a=e.namespace,t=e.kind,l=e.name,`${a}/${t}/${l}`;var a,t,l}),[p]),b=Na(()=>[...h],[h]),y=Na(()=>new Set(g),[g]),x=Ha(e=>{u(e)},[]),C=Ha(e=>{const t=e.map(e=>function(e){const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}}(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));a({...d,sources:t})},[d,a]),S=Ha(e=>{a({...d,namespaces:e})},[d,a]),$=Ha(e=>{const t=d.languages,l=t.includes(e)?t.filter(a=>a!==e):[...t,e];a({...d,languages:l})},[d,a]),T=!m&&"all"===c,k=(r||Zt).map(e=>({id:e,label:Yt[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:He(e)}));return oa(O,{richTitle:o?{title:el(n),titleSize:B.XS,titleColor:H.Secondary,tooltip:Be}:{title:el(n),subTitle:Be,subTitleWrap:!0},backgroundColor:o?"transparent":void 0,padding:o?0:void 0,children:[sa(Pe,T?{status:Le.Default,message:Me,fullWidth:!0,smallIcon:!0}:{status:Le.Info,message:Re,fullWidth:!0,smallIcon:!0}),sa(P,{$alignItems:"flex-start",children:sa(L,{options:v,selected:c,setSelected:x})}),"source"===c&&sa(Ee,{multiple:!0,"data-id":`${s}-autocomplete-source`,options:t,value:f,onSelect:C,placeholder:Ve}),"namespace"===c&&sa(Ee,{multiple:!0,"data-id":`${s}-autocomplete-namespace`,options:l,value:b,onSelect:S,placeholder:"Search namespace"}),"language"===c&&k.length>0&&sa(jt,{children:k.map(({id:e,label:a,Icon:t})=>{const l=y.has(e);return oa(Gt,{$selected:l,onClick:()=>$(e),children:[sa(i,{name:`${s}-lang-${e}`,size:qe.S,value:l,onChange:()=>$(e)}),sa(Jt,{children:sa(t,{size:20})}),sa(R,{size:B.XS,nowrap:!0,children:a})]},e)})})]})},il=(e,a)=>!a?.length||!!a?.find(a=>a===e),sl=({title:e="Signals",required:a,errorMessage:t,allowedSignals:l,selectedSignals:r,setSelectedSignals:n,disabled:s})=>{const[o,d]=Ba(1===r.length),c=Ea(JSON.stringify(r));Va(()=>{let e=Ue(r).filter(e=>il(e,l));e.length||(e=Ke.filter(({id:e})=>il(e,l)).map(({id:e})=>e));const a=JSON.stringify(e);c.current!==a&&(c.current=a,n(e),d(1===e.length))},[l,r]);return oa(P,{$gap:12,children:[sa(M,{label:e,required:a}),sa(A,{$gap:12,children:Ke.map(e=>{const a=il(e.id,l),t=((e,a)=>!!a?.find(a=>a===e))(e.id,r);return a?sa(i,{label:e.value,disabled:s||!a||o&&t,value:t,onChange:a=>((e,a)=>{const t=e,l=a?[...r,t]:r.filter(e=>e!==t);n(l),d(1===l.length)})(e.id,a)},e.id):null})}),sa(Fe,{errorMessage:t})]})},ol=({minSupportedVersion:a,currentVersion:t})=>sa(e,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>sa(We,{scale:2.4,icon:()=>sa("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:sa("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${a} or later.\nCurrent version: ${t}.`}),dl=Ga.div`
105
105
  display: flex;
106
106
  flex-direction: column;
107
107
  justify-content: flex-end;
@@ -119,13 +119,13 @@ import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as
119
119
  flex-direction: column;
120
120
  gap: ${({$gap:e})=>e}px;
121
121
  padding: 12px 12px 0 12px;
122
- width: calc(100% - 24px);
122
+ width: 100%;
123
123
  height: ${({$heightOffset:e,$columnHasHeader:a})=>`calc(100vh - 180px - ${e}px ${a?"- 48px":""})`};
124
124
  border-radius: ${({$columnHasHeader:e,$isLeft:a,$isRight:t})=>e?a?"0 0 0 16px":t?"0 16px 0 0":"0":a?"16px 0 0 16px":t?"0 16px 16px 0":"16px"};
125
125
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
126
126
  overflow-y: auto;
127
127
  overflow-x: hidden;
128
- `,pl=({isLeft:e,isRight:a,heightOffset:t=0,width:l,header:r,list:n})=>oa(dl,{$width:l,$columnHasHeader:!!r,children:[r&&sa(cl,{children:r}),sa(ul,{$gap:8,$isLeft:e,$isRight:a,$heightOffset:t,$columnHasHeader:!!r,children:n.length?n.length>1?sa(We,{gap:8,elements:n}):sa(da,{children:n[0]}):sa(Ye,{$height:"100%",children:sa(Ze,{})})})]}),hl="75vw",gl=Ga.div`
128
+ `,pl=({isLeft:e,isRight:a,heightOffset:t=0,width:l,header:r,list:n})=>oa(dl,{$width:l,$columnHasHeader:!!r,children:[r&&sa(cl,{children:r}),sa(ul,{$gap:8,$isLeft:e,$isRight:a,$heightOffset:t,$columnHasHeader:!!r,children:n.length?n.length>1?sa(Ye,{gap:8,elements:n}):sa(da,{children:n[0]}):sa(Ze,{$height:"100%",children:sa(Qe,{})})})]}),hl="75vw",gl=Ga.div`
129
129
  display: flex;
130
130
  flex-direction: column;
131
131
  border-radius: 16px;
@@ -148,8 +148,8 @@ import{ap as e,a4 as a,H as t,Z as l,_ as r,dP as n,V as i,aC as s,ag as o,X as
148
148
  padding: 5vh 10vw;
149
149
  border-radius: 12px;
150
150
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
151
- `,yl=qa(({isOpen:t,withOverlay:l,disableAnimation:r,onClose:n,onBack:i,onNext:s,nextIsSkip:o,onSave:d,disableSave:c,connectionIds:u,header:p,subHeader:h,leftColumn:g,rightColumn:m,search:v,filters:f,errorMessage:b,isFormDirty:y,hideDirtyNote:x,isFetching:C,progress:S},$)=>{const[k,T]=Ba(!1),[w,A]=Ba(!1),[P,M]=Ba(void 0);ja($,()=>({clearErrors:()=>M(void 0)}));const L=w,O=Ha(()=>{y&&!k?T(!0):(T(!1),n?.())},[y,k,n]),I=c||w||"boolean"==typeof y&&!y,D=Ha(async()=>{A(!0);const e=await d();A(!1),!1!==e&&(e?.error?M(e.error):(u?.setValue([]),n?.()))},[d,u,n]),z=!!v||!!u||!!f,X=!!h,R=(z?48:0)+(X?50:0),N=Na(()=>C?{status:Me.Info,message:"Fetching Data..."}:w&&!S?{status:Me.Info,message:"Saving Changes..."}:P||b?{status:Me.Error,message:P||b}:"boolean"==typeof y&&y&&!x?{status:Me.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:"boolean"!=typeof y||y||x?void 0:{status:Me.Success,message:"The values reflect the current configuration of the selected cluster."},[C,w,S,P,b,y,x]),H=Na(()=>i?{label:"Back",leftIcon:La,variant:a.Secondary,onClick:i}:{label:"Cancel",variant:a.Secondary,onClick:O,disabled:L},[i,O,L]),[E,V]=Ba(!1),q=Na(()=>s?o?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:Oa,variant:a.Secondary,onClick:()=>V(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:Oa,variant:a.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:a.Primary,onClick:D,disabled:I},[s,o,D,I]);return oa(Qe,{width:hl,isOpen:t,disableAnimation:r,hideOverlay:!w&&!l,header:{...p,onClose:n?O:void 0,onCloseDisabled:L},footer:{note:N,actions:[H,q]},children:[w?sa(Ye,{$height:"calc(100vh - 136px)",children:sa(bl,{children:sa(_e,{titleSize:B.S,subTitleSize:B.XXXS,withGradient:!0,withSpinner:!0,...S})})}):oa(gl,{children:[z&&oa(ml,{children:[u&&sa(ea,{icon:Ia,title:"Selected Clusters",badge:{label:u.value.length}}),v&&sa(aa,{width:"100%",...v}),f]}),X&&sa(vl,{children:sa(ea,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),oa(fl,{children:[sa(pl,{isLeft:!0,heightOffset:R,...g}),sa(pl,{isRight:!0,heightOffset:R,...m})]})]}),sa(Ua,{isOpen:k,onClose:()=>T(!1),onApprove:O}),sa(e,{title:"Skip setup?",description:"Without completing setup, Odigos won't be able to collect and send your telemetry data. This may interrupt your data flow and limit the platform's ability to provide value.",isOpen:E,onClose:()=>V(!1),denyButton:{label:"Go Back",variant:a.Secondary,onClick:()=>V(!1)},approveButton:{label:"Skip",variant:a.Primary,onClick:()=>{s?.(),V(!1)}}})]})});yl.displayName=yl.name;const xl=Ga.div`
151
+ `,yl=qa(({isOpen:t,withOverlay:l,disableAnimation:r,onClose:n,onBack:i,onNext:s,nextIsSkip:o,onSave:d,disableSave:c,connectionIds:u,header:p,subHeader:h,leftColumn:g,rightColumn:m,search:v,filters:f,errorMessage:b,isFormDirty:y,hideDirtyNote:x,isFetching:C,progress:S},$)=>{const[T,k]=Ba(!1),[w,A]=Ba(!1),[P,M]=Ba(void 0);ja($,()=>({clearErrors:()=>M(void 0)}));const L=w,O=Ha(()=>{y&&!T?k(!0):(k(!1),n?.())},[y,T,n]),I=c||w||"boolean"==typeof y&&!y,D=Ha(async()=>{A(!0);const e=await d();A(!1),!1!==e&&(e?.error?M(e.error):(u?.setValue([]),n?.()))},[d,u,n]),z=!!v||!!u||!!f,X=!!h,R=(z?48:0)+(X?50:0),N=Na(()=>C?{status:Le.Info,message:"Fetching Data..."}:w&&!S?{status:Le.Info,message:"Saving Changes..."}:P||b?{status:Le.Error,message:P||b}:"boolean"==typeof y&&y&&!x?{status:Le.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:"boolean"!=typeof y||y||x?void 0:{status:Le.Success,message:"The values reflect the current configuration of the selected cluster."},[C,w,S,P,b,y,x]),H=Na(()=>i?{label:"Back",leftIcon:La,variant:a.Secondary,onClick:i}:{label:"Cancel",variant:a.Secondary,onClick:O,disabled:L},[i,O,L]),[E,V]=Ba(!1),q=Na(()=>s?o?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:Oa,variant:a.Secondary,onClick:()=>V(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:Oa,variant:a.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:a.Primary,onClick:D,disabled:I},[s,o,D,I]);return oa(_e,{width:hl,isOpen:t,disableAnimation:r,hideOverlay:!w&&!l,header:{...p,onClose:n?O:void 0,onCloseDisabled:L},footer:{note:N,actions:[H,q]},children:[w?sa(Ze,{$height:"calc(100vh - 136px)",children:sa(bl,{children:sa(ea,{titleSize:B.S,subTitleSize:B.XXXS,withGradient:!0,withSpinner:!0,...S})})}):oa(gl,{children:[z&&oa(ml,{children:[u&&sa(aa,{icon:Ia,title:"Selected Clusters",badge:{label:u.value.length}}),v&&sa(ta,{width:"100%",...v}),f]}),X&&sa(vl,{children:sa(aa,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),oa(fl,{children:[sa(pl,{isLeft:!0,heightOffset:R,...g}),sa(pl,{isRight:!0,heightOffset:R,...m})]})]}),sa(Ua,{isOpen:T,onClose:()=>k(!1),onApprove:O}),sa(e,{title:"Skip setup?",description:"Without completing setup, Odigos won't be able to collect and send your telemetry data. This may interrupt your data flow and limit the platform's ability to provide value.",isOpen:E,onClose:()=>V(!1),denyButton:{label:"Go Back",variant:a.Secondary,onClick:()=>V(!1)},approveButton:{label:"Skip",variant:a.Primary,onClick:()=>{s?.(),V(!1)}}})]})});yl.displayName=yl.name;const xl=Ga.div`
152
152
  padding: 0 24px;
153
153
  border-radius: 12px;
154
154
  background-color: ${({$codeBgColor:e})=>e||"transparent"};
155
- `,Cl=({title:e="YAML",yaml:t,defaultOpen:l,fullHeight:r,bgTint:n="1000",codeBgColor:i})=>{const{clickCopy:s,isCopied:o}=ta(),d=Na(()=>t?[{id:ra(),type:la.Button,buttonProps:{variant:a.Text,size:m.S,leftIcon:o?Da:za,onClick:()=>s(t||""),disabled:o}}]:[],[t,o]);return sa(na,{bgTint:n,richTitle:{icon:Xa,title:e},actions:d,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:r,children:sa(xl,{$codeBgColor:i,children:t?sa(ia,{code:t,language:"yaml",theme:"duotoneDark"}):sa(Ye,{children:sa(Ze,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{Za as A,Ua as C,Fa as D,tt as I,nt as N,Tt as O,st as P,Nt as R,sl as S,ol as U,yl as W,Cl as Y,al as a,rt as b,qt as c,Vt as d,dt as e,Lt as f,Ka as g,lt as h,hl as i,it as j};
155
+ `,Cl=({title:e="YAML",yaml:t,defaultOpen:l,fullHeight:r,bgTint:n="1000",codeBgColor:i})=>{const{clickCopy:s,isCopied:o}=la(),d=Na(()=>t?[{id:na(),type:ra.Button,buttonProps:{variant:a.Text,size:m.S,leftIcon:o?Da:za,onClick:()=>s(t||""),disabled:o}}]:[],[t,o]);return sa(Ae,{bgTint:n,richTitle:{icon:Xa,title:e},actions:d,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:r,children:sa(xl,{$codeBgColor:i,children:t?sa(ia,{code:t,language:"yaml",theme:"duotoneDark"}):sa(Ze,{children:sa(Qe,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{Za as A,Ua as C,Fa as D,tt as I,nt as N,kt as O,st as P,Nt as R,sl as S,ol as U,yl as W,Cl as Y,al as a,rt as b,qt as c,Vt as d,dt as e,Lt as f,Ka as g,lt as h,hl as i,it as j};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as t,useCallback as a,useMemo as r,useContext as n,createContext as s,useRef as o,useEffect as i}from"react";import{o as l,p as d,A as c,q as u,r as m,s as p,v as h,w as f,x as g,j as v,y as b,z as y,B as E,C as D,G as S,H as k,I as C,J as A,K as F,L as I,M as w,O as N,Q as x,T as R,E as P}from"./ui-components-DNrEjxrR.js";import{n as O,m as T,i as L,b as M,a as U,d as j,v as K,g as q,u as G}from"./helpers-BFZzc68M.js";const V={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},_=s(null),H="All row fields are required",z="At least one row is required",J=(e,t)=>!!e&&t.every(t=>{const a=e[t];return Array.isArray(a)?a.length>0:!("string"==typeof(r=a)?!r.trim():p(r));var r}),Q=({children:n})=>{const[s,o]=t(null),i=l(V),f=a(e=>{i.resetFormData(),i.handleErrorChange(void 0,void 0,{}),e?.type&&i.handleFormChange("type",e.type),o(e)},[]),g=a(e=>{var t;i.resetFormData((({type:e,name:t,notes:a,disabled:r,signals:n,fields:s})=>({type:e,name:t||"",notes:a||"",disabled:!!r,signals:n??[],fields:s??{}}))(e)),i.handleErrorChange(void 0,void 0,{}),o((t=e.type,c.find(e=>e.type===t)??null))},[]),v=a(()=>{if(!s)return{errorMessage:"No action type selected",preparedFormData:d(V)};const e=(e=>{const t=d(e),a=t.fields||{},r=a[u.UrlTemplatizationRulesGroups];r?.length&&(a[u.UrlTemplatizationRulesGroups]=r.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const n=a[u.AttributeNamesToDelete];n?.length&&(a[u.AttributeNamesToDelete]=n.filter(e=>!!e?.trim()));const s=a[u.Renames];s&&(a[u.Renames]=Object.fromEntries(Object.entries(s).filter(([e,t])=>!!e?.trim()&&!!t?.trim())));const o=a[u.ExtractAttribute];return o?.extractions?.length&&(a[u.ExtractAttribute]={extractions:o.extractions.map(e=>({targetAttributeName:e.targetAttributeName?.trim()||"",lookupKey:e.lookupKey?.trim()||"",dataFormat:e.dataFormat||"",regex:e.regex?.trim()||""})).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),t.fields=a,t})(i.formData),t={};p(e.signals)&&(t.signals=h.FIELD_IS_REQUIRED),s.type&&Object.assign(t,((e,t,a)=>{const r={},n=t.fields||{},s=a.fields||{};switch(e){case m.K8sAttributes:{const e=!(n[u.CollectContainerAttributes]||n[u.CollectReplicaSetAttributes]||n[u.CollectWorkloadId]||n[u.CollectClusterId]),t=!n[u.LabelsAttributes]?.length,a=!n[u.AnnotationsAttributes]?.length;e&&t&&a&&(r[u.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const s=n[u.LabelsAttributes];s?.some(e=>!J(e,["labelKey","attributeKey","fromSources"]))&&(r[u.LabelsAttributes]=H);const o=n[u.AnnotationsAttributes];o?.some(e=>!J(e,["annotationKey","attributeKey","fromSources"]))&&(r[u.AnnotationsAttributes]=H);break}case m.AddClusterInfo:{const e=n[u.ClusterAttributes];e?.length?e.some(e=>!J(e,["attributeName","attributeStringValue"]))&&(r[u.ClusterAttributes]=H):r[u.ClusterAttributes]=z;break}case m.DeleteAttributes:{const e=s[u.AttributeNamesToDelete]||[],t=n[u.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(r[u.AttributeNamesToDelete]=H):r[u.AttributeNamesToDelete]=e.length?H:z;break}case m.RenameAttributes:{const e=Object.entries(s[u.Renames]||{}),t=Object.entries(n[u.Renames]||{}),a=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?a&&(r[u.Renames]=H):r[u.Renames]=e.length?H:z;break}case m.PiiMasking:{const e=n[u.PiiCategories];e?.length||(r[u.PiiCategories]="Select at least one attribute to mask");break}case m.URLTemplatization:{const e=n[u.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(r[u.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case m.ExtractAttribute:{const e=n[u.ExtractAttribute]?.extractions||[],t=s[u.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),a=!!e.lookupKey?.trim();return a!==!!e.dataFormat||t===a}))r[u.ExtractAttribute]="Each row needs a target attribute name and either a regex or both lookup key and data format";else{const t=new Set;e.some(e=>{const a=e.targetAttributeName?.trim()||"";return!!t.has(a)||(t.add(a),!1)})&&(r[u.ExtractAttribute]="Each new span attribute name must be unique")}else r[u.ExtractAttribute]=t.length?H:z;break}}return r})(s.type,e,i.formData)),i.handleErrorChange(void 0,void 0,t);return{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[i,s]),b=r(()=>({selectedOption:s,onSelectOption:f,loadAction:g,genericForm:i,validateFormData:v}),[s,f,g,i,v]);return e(_.Provider,{value:b,children:n})},W=()=>{const e=n(_);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},$={name:""},B=s(null),X=({children:n,defaultExcludeName:s=""})=>{const{dataStreams:i}=f(),[c,u]=t(void 0),[m,p]=t(s),[v,b]=t(void 0),[y,E]=t(null),D=o(null),S=l($),k=a(e=>{S.resetFormData({name:e}),S.handleErrorChange(void 0,void 0,{}),u(void 0),p(e),b(e),E(null),D.current=null},[]),C=a(()=>{const e=d(S.formData),t=(e=>{const t={};return e.name?g(e.name)||(t.name=h.ILLEGAL_K8S_LABEL):t.name=h.FIELD_IS_REQUIRED,t})(e);S.handleErrorChange(void 0,void 0,t);const a=Object.keys(t).length>0?h.REQUIRED_FIELDS:void 0;return u(a),{errorMessage:a,preparedFormData:e}},[S]),A=a(async e=>{const{errorMessage:t,preparedFormData:a}=C();if(t)return;const r=i.find(e=>e.name===a.name&&e.name!==m);if(r)return D.current=e,void E({preparedFormData:a,existingName:r.name,editingName:v});await e(a)},[C,i,m,v]),F=a(async()=>{const e=D.current,t=y?.preparedFormData;D.current=null,E(null),e&&t&&await e(t)},[y]),I=a(()=>{D.current=null,E(null)},[]),w=r(()=>({genericForm:S,loadDataStream:k,editingName:v,validateFormData:C,requestSubmit:A,pendingMerge:y,confirmMerge:F,cancelMerge:I,errorMessage:c,excludeName:m,setExcludeName:p}),[S,k,v,C,A,y,F,I,c,m]);return e(B.Provider,{value:w,children:n})},Y=()=>{const e=n(B);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Z={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},ee={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:d(Z)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},te=s(ee),ae=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:r,displayName:n,initialValue:s,renderCondition:o}=e,i=a===k.Dropdown,l=D(r,{});return{componentType:a,renderCondition:o,name:t,title:n,value:s,placeholder:l.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(l.values)?l.values.map(e=>({id:e,label:e})):void 0,...l}}),re=({children:n})=>{const{selectedStreamName:s}=f(),o=v(e=>e.destinations),[c,u]=t(null),[m,g]=t(ee.unsavedDestinations),k=r(()=>"number"==typeof c?.unsavedIdx?m[c.unsavedIdx]:void 0,[c,m]),C=a((e,t)=>{c&&(g(t=>[...t,{...e,option:c.option}]),u(t?e=>e?{...e,listType:b.UNSAVED,unsavedIdx:m.length}:null:null))},[c,m.length]),A=a((e,t,a)=>{c&&(g(a=>a.map((a,r)=>r===e?{...a,...t,option:c.option}:a)),u(a?e=>e?{...e,listType:b.UNSAVED}:null:null))},[c]),F=a(e=>{g(t=>t.filter((t,a)=>a!==e)),u(null)},[]),I=l({...Z,currentStreamName:s});i(()=>{if(!c)return;if(k)return void I.resetFormData({...k.formData});if(c.listType===b.EXISTS&&c.option.id){const e=o.find(e=>e.id===c.option.id);if(e)return void I.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:s,disabled:!!e.disabled,exportedSignals:{logs:!!e.exportedSignals?.logs,metrics:!!e.exportedSignals?.metrics,traces:!!e.exportedSignals?.traces,profiles:!!e.exportedSignals?.profiles},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})}const e=y(c.option.supportedSignals);I.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:s,disabled:!1,exportedSignals:{logs:e.includes(E.Logs),metrics:e.includes(E.Metrics),traces:e.includes(E.Traces),profiles:e.includes(E.Profiles)},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})},[c,k]);const w=a(e=>{I.resetFormData(),I.handleErrorChange(void 0,void 0,{}),u(e?{...e,dynamicFields:e.option?.fields?ae(e.option.fields):[]}:null)},[]),N=a((e,t)=>{let a;for(const r of t){const t=r.items.find(t=>t.type===e.destinationType.type);if(t){a=t;break}}const r=D(e.fields,{}),n={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:a?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:a?a.fields.map(e=>({...e,initialValue:r[e.name]??e.initialValue})):[]},s=ae(n.fields);u({listType:b.EXISTS,option:n,dynamicFields:s})},[]),x=a(()=>{const e=d(I.formData),t={};c?.dynamicFields.forEach(({name:a,required:r})=>{if(r){const r=e.fields.find(e=>e.key===a)?.value;p(r)&&(t[a]=h.FIELD_IS_REQUIRED)}});return S(e.exportedSignals).length||(t.exportedSignals=h.FIELD_IS_REQUIRED),I.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[I,c]);return e(te.Provider,{value:{activeForm:c,onChangeActiveForm:w,loadDestination:N,genericForm:I,validateFormData:x,unsavedDestinations:m,thisUnsavedDestination:k,setUnsavedDestinations:g,addUnsavedDestination:C,updateUnsavedDestination:A,deleteUnsavedDestination:F},children:n})},ne=()=>n(te),se={disabled:!1,ruleName:"",notes:"",sourceScopes:T(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},oe=s(null),ie=({children:n,sourceOptions:s=[],namespaceOptions:o=[]})=>{const[i,c]=t(null),u=l(se),m=a(e=>{u.resetFormData(),u.handleErrorChange(void 0,void 0,{}),c(e)},[]),p=a(e=>{var t;u.resetFormData((({ruleName:e,notes:t,disabled:a,sourceScopes:r,instrumentationLibraries:n,payloadCollection:s,codeAttributes:o,headersCollection:i,customInstrumentations:l})=>({ruleName:e||"",notes:t||"",disabled:!!a,sourceScopes:O(r),workloads:null,instrumentationLibraries:n??null,payloadCollection:s??null,codeAttributes:o??null,headersCollection:i??null,customInstrumentations:l??null}))(e)),u.handleErrorChange(void 0,void 0,{}),c((t=e.type,C.find(e=>e.type===t)??null))},[]),h=a(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:d(se)};const e=(e=>{const t=d(e),a={...t,sourceScopes:L(t.sourceScopes)?null:t.sourceScopes,workloads:null};return a.headersCollection?.[A.HeaderKeys]?.length&&(a.headersCollection[A.HeaderKeys]=a.headersCollection[A.HeaderKeys].map(e=>e.trim()).filter(e=>e)),a.customInstrumentations?.[F.Golang]?.length&&(a.customInstrumentations[F.Golang]=a.customInstrumentations[F.Golang].map(e=>new I(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>{return t=e,!!(t.packageName?.trim()||t.functionName?.trim()||t.receiverName?.trim()||t.receiverMethodName?.trim());var t})),a.customInstrumentations?.[F.Java]?.length&&(a.customInstrumentations[F.Java]=a.customInstrumentations[F.Java].map(e=>new w(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),a})(u.formData),t=((e,t)=>{const a={};switch(e){case N.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case N.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case N.HeadersCollection:t.headersCollection?.[A.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case N.CustomInstrumentation:{const e=t.customInstrumentations?.[F.Golang]||[],r=t.customInstrumentations?.[F.Java]||[];if(!e.length&&!r.length){a.customInstrumentations="Custom instrumentation are required";break}const n=e.findIndex(e=>!new I(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==n){a.customInstrumentations=`Golang probe #${n+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=r.findIndex(e=>!new w(e.className,e.methodName).Verify());if(-1!==s){a.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}break}}return a})(i.type,e);return u.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[u,i]),f=r(()=>({selectedOption:i,onSelectOption:m,loadRule:p,genericForm:u,validateFormData:h,sourceOptions:s,namespaceOptions:o}),[i,m,p,u,h,s,o]);return e(oe.Provider,{value:f,children:n})},le=()=>{const e=n(oe);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var de;!function(e){e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"}(de||(de={}));const ce=s(null),ue=["50","25","10","1"];function me(e){const t=String(e);return ue.includes(t)?t:"custom"}const pe=({category:n,sourceOptions:s=[],namespaceOptions:o=[],children:d})=>{const{formData:c,handleFormChange:u,resetFormData:m}=l(q(n)),[p,h]=t(null);i(()=>{m(q(n)),h(null)},[n]);const f=a(e=>{h(null),u(void 0,void 0,{...c,...e})},[c,u]),g=a(()=>{m(q(n)),h(null)},[n,m]),v=r(()=>({formType:de.Create,category:n,formData:c,handleChange:f,resetForm:g,duplicateWarning:p,setDuplicateWarning:h,sourceOptions:s,namespaceOptions:o}),[n,c,f,g,p,s,o]);return e(ce.Provider,{value:v,children:d})},he=({data:n,defaultEditMode:s,sourceOptions:d=[],namespaceOptions:c=[],children:u})=>{const[m,p]=t(!1),{formData:h,handleFormChange:f,resetFormData:g}=l(void 0),v=o(null),[b,y]=t(null);i(()=>{n!==v.current&&(v.current=n,n&&s?(g(K(n)),y(null),p(!0)):(p(!1),y(null)))},[n,s]);const E=a(e=>{y(null),f(void 0,void 0,{...h,...e})},[h,f]),D=a(()=>{n&&(g(K(n)),y(null),p(!0))},[n,g]),S=a(()=>{p(!1),y(null)},[]),k=r(()=>({formType:de.View,data:n,isEditing:m,formData:h,handleChange:E,handleEdit:D,handleCancelEdit:S,duplicateWarning:b,setDuplicateWarning:y,sourceOptions:d,namespaceOptions:c}),[n,m,h,E,D,S,b,d,c]);return e(ce.Provider,{value:k,children:u})};function fe(e){const[a,n]=t(()=>0===e?"all":"sample"),[s,o]=t(()=>me(e)),[l,d]=t(()=>"custom"===me(e)?String(e):"");i(()=>{n(0===e?"all":"sample");const t=me(e);o(t),d("custom"===t?String(e):"")},[e]);const c=r(()=>"all"===a?0:"custom"===s?Number(l)||0:Number(s),[a,s,l]);return{percentageMode:a,setPercentageMode:n,percentagePreset:s,setPercentagePreset:o,customPercentage:l,setCustomPercentage:d,resolvedPercentage:c}}const ge=({enabled:a,keepPercentage:n,children:s})=>{const[o,l]=t(a),d=fe(n);i(()=>{l(a)},[a]);const c=r(()=>j({enabled:o,keepPercentage:d.resolvedPercentage}),[o,d.resolvedPercentage]),u=r(()=>({formType:de.EditAutoNoisy,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},ve=({enabled:a,dropPercentage:n,children:s})=>{const[o,l]=t(a),d=fe(n);i(()=>{l(a)},[a]);const c=r(()=>U(o?{disabled:!1,percentageAtMost:d.resolvedPercentage}:null),[o,d.resolvedPercentage]),u=r(()=>({formType:de.EditAutoCostReduction,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},be=({enabled:a,children:n})=>{const[s,o]=t(a);i(()=>{o(a)},[a]);const l=r(()=>M(s?{disabled:!1}:null),[s]),d=r(()=>({formType:de.EditAutoHighlyRelevant,localEnabled:s,setLocalEnabled:o,summary:l}),[s,l]);return e(ce.Provider,{value:d,children:n})},ye=t=>{switch(t.formType){case de.Create:return e(pe,{...t});case de.View:return e(he,{...t});case de.EditAutoNoisy:return e(ge,{...t});case de.EditAutoCostReduction:return e(ve,{...t});case de.EditAutoHighlyRelevant:return e(be,{...t})}};function Ee(e){const t=n(ce);if(!t)throw new Error("useSamplingRulesFormContext must be used within a SamplingRulesFormProvider");if(e&&t.formType!==e)throw new Error(`Expected formType "${e}" but found "${t.formType}"`);return t}const De={otelServiceName:"",currentStreamName:""},Se=s(null),ke=({children:n})=>{const[s,o]=t(void 0),i=l(De),c=a(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),o(void 0)},[]),u=a(()=>{const e=d(i.formData);return i.handleErrorChange(void 0,void 0,{}),o(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),m=r(()=>({loadSource:c,genericForm:i,validateFormData:u,errorMessage:s}),[c,i,u,s]);return e(Se.Provider,{value:m,children:n})},Ce=()=>{const e=n(Se);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},Ae=new Set([x.StaticPod]),Fe=e=>{const t=e.workloads.filter(({selected:e})=>e).length,a=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===a,isSomeSourced:t>0&&t<a,isFutureApps:e.selected||!1}},Ie=(e,t,a)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(a.showOnlySelected){const{isAllSourced:t,isSomeSourced:a,isFutureApps:r}=Fe(e);return t||a||r}return!0},we=(e,t,a)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!a.showOnlySelected||e.selected),Ne=s({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),xe=({children:n,selectedConnectionIds:s,initialInputs:o})=>{const{tier:l}=G(),c=l===R.Onprem,{selectedStreamName:u}=f(),[m,p]=t(!1),[h,g]=t(null),[v,b]=t([]);i(()=>{h&&b(e=>{const t=((e,t)=>d(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(h,s);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),r=a??t;if(o?.[t.clusterId]){const e=o[t.clusterId],a=d(r);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ae.has(e.kind)&&!c||(e.selected=!0)})}),a}return r})})},[h,s,o]);const{formDiff:y,isFormDirty:E}=r(()=>{const e=((e,t,a)=>{const r={};return e.forEach(e=>{e.namespaces.forEach(n=>{const s=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),o=n.selected||!1;if(o!==s?.selected)r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push({namespace:n.name,selected:o,currentStreamName:a}),o?r[e.clusterId]=r[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)):n.workloads.forEach(t=>{t.selected&&r[e.clusterId].push({namespace:n.name,name:t.name,kind:t.kind,selected:!0,currentStreamName:a})});else{const t=((e,t,a)=>{const r=[];return t.workloads.forEach(n=>{const s=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==s?.selected&&r.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:a})}),r})(s,n,a);t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t))}})}),r})(v,h?.clusters||[],u);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[v,h,u]),D=a(e=>!c&&Ae.has(e),[c]),S=a(({clusterId:e,workloadId:t,selected:a,auto:r})=>{b(n=>{const s=d(n),o=s.findIndex(t=>t.clusterId===e);if(-1===o)return s;const i=s[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return s;if(t.kind&&t.name){const e=s[o].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return s;const r="boolean"==typeof a?a:!s[o].namespaces[i].workloads[e].selected;if(s[o].namespaces[i].workloads[e].selected=r,r){s[o].namespaces[i].workloads.filter(e=>!D(e.kind)).every(e=>e.selected)&&(s[o].namespaces[i].selected=!0)}else s[o].namespaces[i].selected=!1}else{const e="boolean"==typeof r?r:!s[o].namespaces[i].selected;s[o].namespaces[i].selected=e,e?s[o].namespaces[i].workloads.forEach(e=>{D(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||s[o].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return s})},[D]),k=a(({clusterId:e,namespaceName:t,boolean:a,searchText:r="",searchBy:n="",filters:s})=>{b(o=>{const i=d(o),l=n===P.Namespace?r:"",c=n===P.Source?r:"",u=!!l||!!c||!!s?.showOnlySelected;return i.forEach((r,n)=>{e&&r.clusterId!==e||r.namespaces.forEach(({name:e,workloads:r},o)=>{if(!t||e===t)if(u)if(t){r.forEach((e,t)=>{a&&D(e.kind)||we(e,c,s||{showOnlySelected:!1})&&(i[n].namespaces[o].workloads[t].selected=a)});const e=i[n].namespaces[o].workloads.filter(e=>!D(e.kind)).every(e=>e.selected);i[n].namespaces[o].selected=e}else{if(!Ie(i[n].namespaces[o],l,s||{showOnlySelected:!1}))return;i[n].namespaces[o].selected=a,r.forEach((e,t)=>{a&&D(e.kind)||(i[n].namespaces[o].workloads[t].selected=a)})}else i[n].namespaces[o].selected=a,r.forEach((e,t)=>{a&&D(e.kind)||(i[n].namespaces[o].workloads[t].selected=a)})})}),i})},[D]);return e(Ne.Provider,{value:{snapshots:h,setSnapshots:g,isFetching:m,setIsFetching:p,formData:v,handleSourceChange:S,handleSelectAll:k,formDiff:y,isFormDirty:E},children:n})},Re=()=>n(Ne);export{Q as A,X as D,Ae as E,ie as R,de as S,re as a,ye as b,ke as c,xe as d,Y as e,ne as f,le as g,Ee as h,Ce as i,Re as j,we as k,Ie as l,Fe as m,W as u};
1
+ import{jsx as e}from"react/jsx-runtime";import{useState as t,useCallback as a,useMemo as r,useContext as n,createContext as s,useRef as o,useEffect as i}from"react";import{o as l,p as d,A as c,q as u,r as m,s as p,v as h,w as f,x as g,j as v,y as b,z as y,B as E,C as D,G as S,H as k,I as C,J as A,K as F,L as I,M as w,O as N,Q as x,T as R,E as P}from"./ui-components-DNIrc4p5.js";import{n as O,m as T,i as L,b as M,a as U,d as j,v as K,g as q,u as G}from"./helpers-LpbP8L0p.js";const V={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},_=s(null),H="All row fields are required",z="At least one row is required",J=(e,t)=>!!e&&t.every(t=>{const a=e[t];return Array.isArray(a)?a.length>0:!("string"==typeof(r=a)?!r.trim():p(r));var r}),Q=({children:n})=>{const[s,o]=t(null),i=l(V),f=a(e=>{i.resetFormData(),i.handleErrorChange(void 0,void 0,{}),e?.type&&i.handleFormChange("type",e.type),o(e)},[]),g=a(e=>{var t;i.resetFormData((({type:e,name:t,notes:a,disabled:r,signals:n,fields:s})=>({type:e,name:t||"",notes:a||"",disabled:!!r,signals:n??[],fields:s??{}}))(e)),i.handleErrorChange(void 0,void 0,{}),o((t=e.type,c.find(e=>e.type===t)??null))},[]),v=a(()=>{if(!s)return{errorMessage:"No action type selected",preparedFormData:d(V)};const e=(e=>{const t=d(e),a=t.fields||{},r=a[u.UrlTemplatizationRulesGroups];r?.length&&(a[u.UrlTemplatizationRulesGroups]=r.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const n=a[u.AttributeNamesToDelete];n?.length&&(a[u.AttributeNamesToDelete]=n.filter(e=>!!e?.trim()));const s=a[u.Renames];s&&(a[u.Renames]=Object.fromEntries(Object.entries(s).filter(([e,t])=>!!e?.trim()&&!!t?.trim())));const o=a[u.ExtractAttribute];return o?.extractions?.length&&(a[u.ExtractAttribute]={extractions:o.extractions.map(e=>({targetAttributeName:e.targetAttributeName?.trim()||"",lookupKey:e.lookupKey?.trim()||"",dataFormat:e.dataFormat||"",regex:e.regex?.trim()||""})).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),t.fields=a,t})(i.formData),t={};p(e.signals)&&(t.signals=h.FIELD_IS_REQUIRED),s.type&&Object.assign(t,((e,t,a)=>{const r={},n=t.fields||{},s=a.fields||{};switch(e){case m.K8sAttributes:{const e=!(n[u.CollectContainerAttributes]||n[u.CollectReplicaSetAttributes]||n[u.CollectWorkloadId]||n[u.CollectClusterId]),t=!n[u.LabelsAttributes]?.length,a=!n[u.AnnotationsAttributes]?.length;e&&t&&a&&(r[u.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const s=n[u.LabelsAttributes];s?.some(e=>!J(e,["labelKey","attributeKey","fromSources"]))&&(r[u.LabelsAttributes]=H);const o=n[u.AnnotationsAttributes];o?.some(e=>!J(e,["annotationKey","attributeKey","fromSources"]))&&(r[u.AnnotationsAttributes]=H);break}case m.AddClusterInfo:{const e=n[u.ClusterAttributes];e?.length?e.some(e=>!J(e,["attributeName","attributeStringValue"]))&&(r[u.ClusterAttributes]=H):r[u.ClusterAttributes]=z;break}case m.DeleteAttributes:{const e=s[u.AttributeNamesToDelete]||[],t=n[u.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(r[u.AttributeNamesToDelete]=H):r[u.AttributeNamesToDelete]=e.length?H:z;break}case m.RenameAttributes:{const e=Object.entries(s[u.Renames]||{}),t=Object.entries(n[u.Renames]||{}),a=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?a&&(r[u.Renames]=H):r[u.Renames]=e.length?H:z;break}case m.PiiMasking:{const e=n[u.PiiCategories];e?.length||(r[u.PiiCategories]="Select at least one attribute to mask");break}case m.URLTemplatization:{const e=n[u.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(r[u.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case m.ExtractAttribute:{const e=n[u.ExtractAttribute]?.extractions||[],t=s[u.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),a=!!e.lookupKey?.trim();return a!==!!e.dataFormat||t===a}))r[u.ExtractAttribute]="Each row needs a target attribute name and either a regex or both lookup key and data format";else{const t=new Set;e.some(e=>{const a=e.targetAttributeName?.trim()||"";return!!t.has(a)||(t.add(a),!1)})&&(r[u.ExtractAttribute]="Each new span attribute name must be unique")}else r[u.ExtractAttribute]=t.length?H:z;break}}return r})(s.type,e,i.formData)),i.handleErrorChange(void 0,void 0,t);return{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[i,s]),b=r(()=>({selectedOption:s,onSelectOption:f,loadAction:g,genericForm:i,validateFormData:v}),[s,f,g,i,v]);return e(_.Provider,{value:b,children:n})},W=()=>{const e=n(_);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},$={name:""},B=s(null),X=({children:n,defaultExcludeName:s=""})=>{const{dataStreams:i}=f(),[c,u]=t(void 0),[m,p]=t(s),[v,b]=t(void 0),[y,E]=t(null),D=o(null),S=l($),k=a(e=>{S.resetFormData({name:e}),S.handleErrorChange(void 0,void 0,{}),u(void 0),p(e),b(e),E(null),D.current=null},[]),C=a(()=>{const e=d(S.formData),t=(e=>{const t={};return e.name?g(e.name)||(t.name=h.ILLEGAL_K8S_LABEL):t.name=h.FIELD_IS_REQUIRED,t})(e);S.handleErrorChange(void 0,void 0,t);const a=Object.keys(t).length>0?h.REQUIRED_FIELDS:void 0;return u(a),{errorMessage:a,preparedFormData:e}},[S]),A=a(async e=>{const{errorMessage:t,preparedFormData:a}=C();if(t)return;const r=i.find(e=>e.name===a.name&&e.name!==m);if(r)return D.current=e,void E({preparedFormData:a,existingName:r.name,editingName:v});await e(a)},[C,i,m,v]),F=a(async()=>{const e=D.current,t=y?.preparedFormData;D.current=null,E(null),e&&t&&await e(t)},[y]),I=a(()=>{D.current=null,E(null)},[]),w=r(()=>({genericForm:S,loadDataStream:k,editingName:v,validateFormData:C,requestSubmit:A,pendingMerge:y,confirmMerge:F,cancelMerge:I,errorMessage:c,excludeName:m,setExcludeName:p}),[S,k,v,C,A,y,F,I,c,m]);return e(B.Provider,{value:w,children:n})},Y=()=>{const e=n(B);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Z={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},ee={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:d(Z)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},te=s(ee),ae=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:r,displayName:n,initialValue:s,renderCondition:o}=e,i=a===k.Dropdown,l=D(r,{});return{componentType:a,renderCondition:o,name:t,title:n,value:s,placeholder:l.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(l.values)?l.values.map(e=>({id:e,label:e})):void 0,...l}}),re=({children:n})=>{const{selectedStreamName:s}=f(),o=v(e=>e.destinations),[c,u]=t(null),[m,g]=t(ee.unsavedDestinations),k=r(()=>"number"==typeof c?.unsavedIdx?m[c.unsavedIdx]:void 0,[c,m]),C=a((e,t)=>{c&&(g(t=>[...t,{...e,option:c.option}]),u(t?e=>e?{...e,listType:b.UNSAVED,unsavedIdx:m.length}:null:null))},[c,m.length]),A=a((e,t,a)=>{c&&(g(a=>a.map((a,r)=>r===e?{...a,...t,option:c.option}:a)),u(a?e=>e?{...e,listType:b.UNSAVED}:null:null))},[c]),F=a(e=>{g(t=>t.filter((t,a)=>a!==e)),u(null)},[]),I=l({...Z,currentStreamName:s});i(()=>{if(!c)return;if(k)return void I.resetFormData({...k.formData});if(c.listType===b.EXISTS&&c.option.id){const e=o.find(e=>e.id===c.option.id);if(e)return void I.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:s,disabled:!!e.disabled,exportedSignals:{logs:!!e.exportedSignals?.logs,metrics:!!e.exportedSignals?.metrics,traces:!!e.exportedSignals?.traces,profiles:!!e.exportedSignals?.profiles},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})}const e=y(c.option.supportedSignals);I.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:s,disabled:!1,exportedSignals:{logs:e.includes(E.Logs),metrics:e.includes(E.Metrics),traces:e.includes(E.Traces),profiles:e.includes(E.Profiles)},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})},[c,k]);const w=a(e=>{I.resetFormData(),I.handleErrorChange(void 0,void 0,{}),u(e?{...e,dynamicFields:e.option?.fields?ae(e.option.fields):[]}:null)},[]),N=a((e,t)=>{let a;for(const r of t){const t=r.items.find(t=>t.type===e.destinationType.type);if(t){a=t;break}}const r=D(e.fields,{}),n={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:a?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:a?a.fields.map(e=>({...e,initialValue:r[e.name]??e.initialValue})):[]},s=ae(n.fields);u({listType:b.EXISTS,option:n,dynamicFields:s})},[]),x=a(()=>{const e=d(I.formData),t={};c?.dynamicFields.forEach(({name:a,required:r})=>{if(r){const r=e.fields.find(e=>e.key===a)?.value;p(r)&&(t[a]=h.FIELD_IS_REQUIRED)}});return S(e.exportedSignals).length||(t.exportedSignals=h.FIELD_IS_REQUIRED),I.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[I,c]);return e(te.Provider,{value:{activeForm:c,onChangeActiveForm:w,loadDestination:N,genericForm:I,validateFormData:x,unsavedDestinations:m,thisUnsavedDestination:k,setUnsavedDestinations:g,addUnsavedDestination:C,updateUnsavedDestination:A,deleteUnsavedDestination:F},children:n})},ne=()=>n(te),se={disabled:!1,ruleName:"",notes:"",sourceScopes:T(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},oe=s(null),ie=({children:n,sourceOptions:s=[],namespaceOptions:o=[]})=>{const[i,c]=t(null),u=l(se),m=a(e=>{u.resetFormData(),u.handleErrorChange(void 0,void 0,{}),c(e)},[]),p=a(e=>{var t;u.resetFormData((({ruleName:e,notes:t,disabled:a,sourceScopes:r,instrumentationLibraries:n,payloadCollection:s,codeAttributes:o,headersCollection:i,customInstrumentations:l})=>({ruleName:e||"",notes:t||"",disabled:!!a,sourceScopes:O(r),workloads:null,instrumentationLibraries:n??null,payloadCollection:s??null,codeAttributes:o??null,headersCollection:i??null,customInstrumentations:l??null}))(e)),u.handleErrorChange(void 0,void 0,{}),c((t=e.type,C.find(e=>e.type===t)??null))},[]),h=a(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:d(se)};const e=(e=>{const t=d(e),a={...t,sourceScopes:L(t.sourceScopes)?null:t.sourceScopes,workloads:null};return a.headersCollection?.[A.HeaderKeys]?.length&&(a.headersCollection[A.HeaderKeys]=a.headersCollection[A.HeaderKeys].map(e=>e.trim()).filter(e=>e)),a.customInstrumentations?.[F.Golang]?.length&&(a.customInstrumentations[F.Golang]=a.customInstrumentations[F.Golang].map(e=>new I(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>{return t=e,!!(t.packageName?.trim()||t.functionName?.trim()||t.receiverName?.trim()||t.receiverMethodName?.trim());var t})),a.customInstrumentations?.[F.Java]?.length&&(a.customInstrumentations[F.Java]=a.customInstrumentations[F.Java].map(e=>new w(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),a})(u.formData),t=((e,t)=>{const a={};switch(e){case N.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case N.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case N.HeadersCollection:t.headersCollection?.[A.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case N.CustomInstrumentation:{const e=t.customInstrumentations?.[F.Golang]||[],r=t.customInstrumentations?.[F.Java]||[];if(!e.length&&!r.length){a.customInstrumentations="Custom instrumentation are required";break}const n=e.findIndex(e=>!new I(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==n){a.customInstrumentations=`Golang probe #${n+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=r.findIndex(e=>!new w(e.className,e.methodName).Verify());if(-1!==s){a.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}break}}return a})(i.type,e);return u.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[u,i]),f=r(()=>({selectedOption:i,onSelectOption:m,loadRule:p,genericForm:u,validateFormData:h,sourceOptions:s,namespaceOptions:o}),[i,m,p,u,h,s,o]);return e(oe.Provider,{value:f,children:n})},le=()=>{const e=n(oe);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var de;!function(e){e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"}(de||(de={}));const ce=s(null),ue=["50","25","10","1"];function me(e){const t=String(e);return ue.includes(t)?t:"custom"}const pe=({category:n,sourceOptions:s=[],namespaceOptions:o=[],children:d})=>{const{formData:c,handleFormChange:u,resetFormData:m}=l(q(n)),[p,h]=t(null);i(()=>{m(q(n)),h(null)},[n]);const f=a(e=>{h(null),u(void 0,void 0,{...c,...e})},[c,u]),g=a(()=>{m(q(n)),h(null)},[n,m]),v=r(()=>({formType:de.Create,category:n,formData:c,handleChange:f,resetForm:g,duplicateWarning:p,setDuplicateWarning:h,sourceOptions:s,namespaceOptions:o}),[n,c,f,g,p,s,o]);return e(ce.Provider,{value:v,children:d})},he=({data:n,defaultEditMode:s,sourceOptions:d=[],namespaceOptions:c=[],children:u})=>{const[m,p]=t(!1),{formData:h,handleFormChange:f,resetFormData:g}=l(void 0),v=o(null),[b,y]=t(null);i(()=>{n!==v.current&&(v.current=n,n&&s?(g(K(n)),y(null),p(!0)):(p(!1),y(null)))},[n,s]);const E=a(e=>{y(null),f(void 0,void 0,{...h,...e})},[h,f]),D=a(()=>{n&&(g(K(n)),y(null),p(!0))},[n,g]),S=a(()=>{p(!1),y(null)},[]),k=r(()=>({formType:de.View,data:n,isEditing:m,formData:h,handleChange:E,handleEdit:D,handleCancelEdit:S,duplicateWarning:b,setDuplicateWarning:y,sourceOptions:d,namespaceOptions:c}),[n,m,h,E,D,S,b,d,c]);return e(ce.Provider,{value:k,children:u})};function fe(e){const[a,n]=t(()=>0===e?"all":"sample"),[s,o]=t(()=>me(e)),[l,d]=t(()=>"custom"===me(e)?String(e):"");i(()=>{n(0===e?"all":"sample");const t=me(e);o(t),d("custom"===t?String(e):"")},[e]);const c=r(()=>"all"===a?0:"custom"===s?Number(l)||0:Number(s),[a,s,l]);return{percentageMode:a,setPercentageMode:n,percentagePreset:s,setPercentagePreset:o,customPercentage:l,setCustomPercentage:d,resolvedPercentage:c}}const ge=({enabled:a,keepPercentage:n,children:s})=>{const[o,l]=t(a),d=fe(n);i(()=>{l(a)},[a]);const c=r(()=>j({enabled:o,keepPercentage:d.resolvedPercentage}),[o,d.resolvedPercentage]),u=r(()=>({formType:de.EditAutoNoisy,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},ve=({enabled:a,dropPercentage:n,children:s})=>{const[o,l]=t(a),d=fe(n);i(()=>{l(a)},[a]);const c=r(()=>U(o?{disabled:!1,percentageAtMost:d.resolvedPercentage}:null),[o,d.resolvedPercentage]),u=r(()=>({formType:de.EditAutoCostReduction,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},be=({enabled:a,children:n})=>{const[s,o]=t(a);i(()=>{o(a)},[a]);const l=r(()=>M(s?{disabled:!1}:null),[s]),d=r(()=>({formType:de.EditAutoHighlyRelevant,localEnabled:s,setLocalEnabled:o,summary:l}),[s,l]);return e(ce.Provider,{value:d,children:n})},ye=t=>{switch(t.formType){case de.Create:return e(pe,{...t});case de.View:return e(he,{...t});case de.EditAutoNoisy:return e(ge,{...t});case de.EditAutoCostReduction:return e(ve,{...t});case de.EditAutoHighlyRelevant:return e(be,{...t})}};function Ee(e){const t=n(ce);if(!t)throw new Error("useSamplingRulesFormContext must be used within a SamplingRulesFormProvider");if(e&&t.formType!==e)throw new Error(`Expected formType "${e}" but found "${t.formType}"`);return t}const De={otelServiceName:"",currentStreamName:""},Se=s(null),ke=({children:n})=>{const[s,o]=t(void 0),i=l(De),c=a(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),o(void 0)},[]),u=a(()=>{const e=d(i.formData);return i.handleErrorChange(void 0,void 0,{}),o(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),m=r(()=>({loadSource:c,genericForm:i,validateFormData:u,errorMessage:s}),[c,i,u,s]);return e(Se.Provider,{value:m,children:n})},Ce=()=>{const e=n(Se);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},Ae=new Set([x.StaticPod]),Fe=e=>{const t=e.workloads.filter(({selected:e})=>e).length,a=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===a,isSomeSourced:t>0&&t<a,isFutureApps:e.selected||!1}},Ie=(e,t,a)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(a.showOnlySelected){const{isAllSourced:t,isSomeSourced:a,isFutureApps:r}=Fe(e);return t||a||r}return!0},we=(e,t,a)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!a.showOnlySelected||e.selected),Ne=s({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),xe=({children:n,selectedConnectionIds:s,initialInputs:o})=>{const{tier:l}=G(),c=l===R.Onprem,{selectedStreamName:u}=f(),[m,p]=t(!1),[h,g]=t(null),[v,b]=t([]);i(()=>{h&&b(e=>{const t=((e,t)=>d(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(h,s);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),r=a??t;if(o?.[t.clusterId]){const e=o[t.clusterId],a=d(r);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ae.has(e.kind)&&!c||(e.selected=!0)})}),a}return r})})},[h,s,o]);const{formDiff:y,isFormDirty:E}=r(()=>{const e=((e,t,a)=>{const r={};return e.forEach(e=>{e.namespaces.forEach(n=>{const s=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),o=n.selected||!1;if(o!==s?.selected)r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push({namespace:n.name,selected:o,currentStreamName:a}),o?r[e.clusterId]=r[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)):n.workloads.forEach(t=>{t.selected&&r[e.clusterId].push({namespace:n.name,name:t.name,kind:t.kind,selected:!0,currentStreamName:a})});else{const t=((e,t,a)=>{const r=[];return t.workloads.forEach(n=>{const s=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==s?.selected&&r.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:a})}),r})(s,n,a);t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t))}})}),r})(v,h?.clusters||[],u);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[v,h,u]),D=a(e=>!c&&Ae.has(e),[c]),S=a(({clusterId:e,workloadId:t,selected:a,auto:r})=>{b(n=>{const s=d(n),o=s.findIndex(t=>t.clusterId===e);if(-1===o)return s;const i=s[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return s;if(t.kind&&t.name){const e=s[o].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return s;const r="boolean"==typeof a?a:!s[o].namespaces[i].workloads[e].selected;if(s[o].namespaces[i].workloads[e].selected=r,r){s[o].namespaces[i].workloads.filter(e=>!D(e.kind)).every(e=>e.selected)&&(s[o].namespaces[i].selected=!0)}else s[o].namespaces[i].selected=!1}else{const e="boolean"==typeof r?r:!s[o].namespaces[i].selected;s[o].namespaces[i].selected=e,e?s[o].namespaces[i].workloads.forEach(e=>{D(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||s[o].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return s})},[D]),k=a(({clusterId:e,namespaceName:t,boolean:a,searchText:r="",searchBy:n="",filters:s})=>{b(o=>{const i=d(o),l=n===P.Namespace?r:"",c=n===P.Source?r:"",u=!!l||!!c||!!s?.showOnlySelected;return i.forEach((r,n)=>{e&&r.clusterId!==e||r.namespaces.forEach(({name:e,workloads:r},o)=>{if(!t||e===t)if(u)if(t){r.forEach((e,t)=>{a&&D(e.kind)||we(e,c,s||{showOnlySelected:!1})&&(i[n].namespaces[o].workloads[t].selected=a)});const e=i[n].namespaces[o].workloads.filter(e=>!D(e.kind)).every(e=>e.selected);i[n].namespaces[o].selected=e}else{if(!Ie(i[n].namespaces[o],l,s||{showOnlySelected:!1}))return;i[n].namespaces[o].selected=a,r.forEach((e,t)=>{a&&D(e.kind)||(i[n].namespaces[o].workloads[t].selected=a)})}else i[n].namespaces[o].selected=a,r.forEach((e,t)=>{a&&D(e.kind)||(i[n].namespaces[o].workloads[t].selected=a)})})}),i})},[D]);return e(Ne.Provider,{value:{snapshots:h,setSnapshots:g,isFetching:m,setIsFetching:p,formData:v,handleSourceChange:S,handleSelectAll:k,formDiff:y,isFormDirty:E},children:n})},Re=()=>n(Ne);export{Q as A,X as D,Ae as E,ie as R,de as S,re as a,ye as b,ke as c,xe as d,Y as e,ne as f,le as g,Ee as h,Ce as i,Re as j,we as k,Ie as l,Fe as m,W as u};