@odigos/ui-kit 0.0.289 → 0.0.290

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/chunks/{helpers-Ds7r-EIJ.js → helpers-esDVvrTt.js} +1 -1
  3. package/lib/chunks/{index-DiYN36pr.js → index-lV6RFSE-.js} +14 -14
  4. package/lib/chunks/{source-instrument-form-context-CBP9xXNN.js → source-instrument-form-context-B9BHhgvw.js} +1 -1
  5. package/lib/chunks/ui-components-DvoeDBMI.js +1958 -0
  6. package/lib/components/badge/index.d.ts +1 -1
  7. package/lib/components/input/index.d.ts +2 -0
  8. package/lib/components/input-list/index.d.ts +1 -0
  9. package/lib/components/radio-card/index.d.ts +4 -0
  10. package/lib/components.js +1 -1
  11. package/lib/constants/strings/index.d.ts +2 -0
  12. package/lib/constants/url-templatization/index.d.ts +176 -31
  13. package/lib/constants.js +1 -1
  14. package/lib/containers/_drawers/create-cloud-connector-drawer/steps/setup-credentials/methods.d.ts +7 -1
  15. package/lib/containers/_drawers/url-templatization-custom-template-drawer/destination-step.d.ts +7 -4
  16. package/lib/containers/_drawers/url-templatization-custom-template-drawer/index.d.ts +5 -1
  17. package/lib/containers/_drawers/url-templatization-custom-template-drawer/templates-step-summary.d.ts +10 -0
  18. package/lib/containers/_drawers/url-templatization-default-rule-drawer/index.d.ts +2 -0
  19. package/lib/containers/_drawers/url-templatization-template-view-drawer/index.d.ts +5 -0
  20. package/lib/containers/url-templatization/advanced-config-section.d.ts +12 -0
  21. package/lib/containers/url-templatization/automatic-templatization-enable-card.d.ts +6 -0
  22. package/lib/containers/url-templatization/converters.d.ts +15 -0
  23. package/lib/containers/url-templatization/custom-templates-empty-card.d.ts +5 -0
  24. package/lib/containers/url-templatization/custom-templates-list.d.ts +0 -1
  25. package/lib/containers/url-templatization/default-normalization-card.d.ts +11 -0
  26. package/lib/containers/url-templatization/default-rules-list.d.ts +8 -5
  27. package/lib/containers/url-templatization/disabled-scopes-table.d.ts +8 -0
  28. package/lib/containers/url-templatization/helpers.d.ts +30 -1
  29. package/lib/containers/url-templatization/managed-action-badge.d.ts +11 -0
  30. package/lib/containers/url-templatization/onboarding-empty.d.ts +7 -0
  31. package/lib/containers/url-templatization/skip-policies-table.d.ts +8 -0
  32. package/lib/containers/url-templatization/template-path.d.ts +2 -0
  33. package/lib/containers.js +975 -696
  34. package/lib/contexts.js +1 -1
  35. package/lib/functions.js +1 -1
  36. package/lib/hooks.js +1 -1
  37. package/lib/snippets/sampling-rule-form-sections/source-scope.d.ts +16 -1
  38. package/lib/snippets.js +1 -1
  39. package/lib/store.js +1 -1
  40. package/lib/theme.js +1 -1
  41. package/lib/types/cloud-connectors/index.d.ts +1 -0
  42. package/lib/types.js +1 -1
  43. package/lib/visuals.js +1 -1
  44. package/package.json +1 -1
  45. package/lib/chunks/ui-components-Dvmqmy3G.js +0 -1952
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.290](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.289...ui-kit-v0.0.290) (2026-08-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Update setup-credentials drawer to correctly display the required fields ([#1256](https://github.com/odigos-io/ui-kit/issues/1256)) ([c210279](https://github.com/odigos-io/ui-kit/commit/c210279465501634159b897cd11d7dacf1d9080e))
9
+
3
10
  ## [0.0.289](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.288...ui-kit-v0.0.289) (2026-08-26)
4
11
 
5
12
 
@@ -1,4 +1,4 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{Fragment as n,useMemo as o,useContext as a,createContext as s}from"react";import{T as i,t as u,b as l,P as c}from"./ui-components-Dvmqmy3G.js";import p from"styled-components";var d;(e=>{e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"})(d||(d={}));const f=[d.Action,d.Endpoint,d.Scope,d.Duration],h=p.span`
1
+ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{Fragment as n,useMemo as o,useContext as a,createContext as s}from"react";import{T as i,t as u,b as l,P as c}from"./ui-components-DvoeDBMI.js";import p from"styled-components";var d;(e=>{e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"})(d||(d={}));const f=[d.Action,d.Endpoint,d.Scope,d.Duration],h=p.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{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as l,useTheme as n}from"styled-components";import i,{useMemo as o,useRef as s,useCallback as c,useState as d,memo as p,useEffect as u,Fragment as h,forwardRef as g,useImperativeHandle as m}from"react";import"@xyflow/react/dist/style.css";import{Handle as v,Position as f,getSmoothStepPath as b,BaseEdge as y,EdgeLabelRenderer as x,MarkerType as $,ReactFlowProvider as C,useNodesState as k,useEdgesState as w,ReactFlow as S,Background as T,useReactFlow as M}from"@xyflow/react";import{D as A,c as P,F as O,d as L,e as E,f as I,g as N,h as R,B as V,i as z,j as D,k as X,C as _,N as H,W as B,u as j,M as q,I as U,l as G,m as K,n as F,o as W,p as Y,V as J,q as Z,r as Q,s as ee,v as te,w as ae,x as re,y as le,z as ne,E as ie,G as oe,H as se,J as ce,K as de,L as pe,O as ue,S as he,Q as ge,U as me,X as ve,Y as fe,Z as be,_ as ye,$ as xe,a0 as $e,a1 as Ce,a2 as ke,a3 as we,a4 as Se,a5 as Te,a6 as Me,a7 as Ae,a8 as Pe,a9 as Oe,aa as Le,ab as Ee,T as Ie,ac as Ne,ad as Re,ae as Ve,af as ze,ag as De,ah as Xe,ai as _e,aj as He,ak as Be,al as je,am as qe,an as Ue,ao as Ge,b as Ke,ap as Fe,aq as We,ar as Ye,as as Je,at as Ze,au as Qe,av as et,aw as tt,ax as at,ay as rt,az as lt,aA as nt,aB as it,aC as ot,aD as st,aE as ct,aF as dt,aG as pt,aH as ut,aI as ht,aJ as gt,aK as mt,aL as vt,aM as ft,aN as bt,aO as yt,aP as xt,aQ as $t,aR as Ct,aS as kt,aT as wt,aU as St,aV as Tt,aW as Mt,aX as At,aY as Pt,aZ as Ot,a_ as Lt,a$ as Et,b0 as It,b1 as Nt,b2 as Rt,b3 as Vt,b4 as zt,b5 as Dt,b6 as Xt,b7 as _t,R as Ht,b8 as Bt,A as jt,b9 as qt}from"./ui-components-Dvmqmy3G.js";import{UserIcon as Ut,DestinationIcon as Gt,HomeIcon as Kt,XIcon as Ft,VIcon as Wt,TrashIcon as Yt,PlusIcon as Jt,VSquareIcon as Zt,XSquareIcon as Qt,EditIcon as ea,OdigosLogoTextCentral as ta,OdigosLogoTextEnterprise as aa,OdigosLogoTextCommunity as ra,OdigosLogoTextColoredCentral as la,OdigosLogoTextColoredEnterprise as na,OdigosLogoTextColoredCommunity as ia,ArrowLeftIcon as oa,ArrowRightIcon as sa,CopyIcon as ca,YamlIcon as da}from"../icons.js";import{i as pa,m as ua,u as ha,n as ga,a as ma,C as va,b as fa,d as ba,e as ya,f as xa,g as $a,h as Ca,j as ka,k as wa}from"./helpers-Ds7r-EIJ.js";const Sa=/^[a-zA-Z]$/,Ta=new Set(["*","+","?"]),Ma=new Set(["^","$"]),Aa={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},Pa=r.div`
1
+ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as l,useTheme as n}from"styled-components";import i,{useMemo as o,useRef as s,useCallback as c,useState as d,memo as u,useEffect as p,Fragment as h,forwardRef as g,useImperativeHandle as m}from"react";import"@xyflow/react/dist/style.css";import{Handle as v,Position as f,getSmoothStepPath as b,BaseEdge as y,EdgeLabelRenderer as x,MarkerType as $,ReactFlowProvider as C,useNodesState as k,useEdgesState as w,ReactFlow as S,Background as T,useReactFlow as M}from"@xyflow/react";import{D as A,c as P,F as O,d as L,e as E,f as I,g as N,h as R,B as V,i as z,j as D,k as X,C as _,N as H,W as B,u as j,M as q,I as U,l as G,m as K,n as W,o as F,p as Y,V as J,q as Z,r as Q,s as ee,v as te,w as ae,x as re,y as le,z as ne,E as ie,G as oe,H as se,J as ce,K as de,L as ue,O as pe,S as he,Q as ge,U as me,X as ve,Y as fe,Z as be,_ as ye,$ as xe,a0 as $e,a1 as Ce,a2 as ke,a3 as we,a4 as Se,a5 as Te,a6 as Me,a7 as Ae,a8 as Pe,a9 as Oe,aa as Le,ab as Ee,T as Ie,ac as Ne,ad as Re,ae as Ve,af as ze,ag as De,ah as Xe,ai as _e,aj as He,ak as Be,al as je,am as qe,an as Ue,ao as Ge,b as Ke,ap as We,aq as Fe,ar as Ye,as as Je,at as Ze,au as Qe,av as et,aw as tt,ax as at,ay as rt,az as lt,aA as nt,aB as it,aC as ot,aD as st,aE as ct,aF as dt,aG as ut,aH as pt,aI as ht,aJ as gt,aK as mt,aL as vt,aM as ft,aN as bt,aO as yt,aP as xt,aQ as $t,aR as Ct,aS as kt,aT as wt,aU as St,aV as Tt,aW as Mt,aX as At,aY as Pt,aZ as Ot,a_ as Lt,a$ as Et,b0 as It,b1 as Nt,b2 as Rt,b3 as Vt,b4 as zt,b5 as Dt,b6 as Xt,b7 as _t,R as Ht,b8 as Bt,A as jt,b9 as qt}from"./ui-components-DvoeDBMI.js";import{UserIcon as Ut,DestinationIcon as Gt,HomeIcon as Kt,XIcon as Wt,VIcon as Ft,TrashIcon as Yt,PlusIcon as Jt,VSquareIcon as Zt,XSquareIcon as Qt,EditIcon as ea,OdigosLogoTextCentral as ta,OdigosLogoTextEnterprise as aa,OdigosLogoTextCommunity as ra,OdigosLogoTextColoredCentral as la,OdigosLogoTextColoredEnterprise as na,OdigosLogoTextColoredCommunity as ia,ArrowLeftIcon as oa,ArrowRightIcon as sa,CopyIcon as ca,YamlIcon as da}from"../icons.js";import{i as ua,m as pa,u as ha,n as ga,a as ma,C as va,b as fa,d as ba,e as ya,f as xa,g as $a,h as Ca,j as ka,k as wa}from"./helpers-esDVvrTt.js";const Sa=/^[a-zA-Z]$/,Ta=new Set(["*","+","?"]),Ma=new Set(["^","$"]),Aa={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},Pa=r.div`
2
2
  padding: 8px 16px;
3
3
  border-radius: 6px;
4
4
  border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
@@ -78,7 +78,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
78
78
  &::placeholder {
79
79
  color: ${({theme:e})=>e.v2.colors.silver[600]};
80
80
  }
81
- `,za=e=>({before:e,matchPre:"",capture:"",matchPost:"",after:""}),Da=({regex:a,value:r,onChange:l,minHeight:n=240,...i})=>{const d=s(null),p=s(null),u=o(()=>((e,t)=>{if(!e||!t)return za(t);let a;try{a=new RegExp(e)}catch{return za(t)}const r=a.exec(t);if(!r)return za(t);const l=r.index,n=r.index+r[0].length;if(r.length<2||null==r[1])return{before:t.slice(0,l),matchPre:"",capture:t.slice(l,n),matchPost:"",after:t.slice(n)};const i=r[0].indexOf(r[1]),o=i>=0?l+i:l,s=o+r[1].length;return{before:t.slice(0,l),matchPre:t.slice(l,o),capture:t.slice(o,s),matchPost:t.slice(s,n),after:t.slice(n)}})(a,r),[a,r]),h=c(()=>{d.current&&p.current&&(d.current.scrollTop=p.current.scrollTop,d.current.scrollLeft=p.current.scrollLeft)},[]);return t(Na,{$minHeight:n,children:[t(Ra,{ref:d,"aria-hidden":!0,children:[u.before,e("span",{style:{background:Ea},children:u.matchPre}),e("span",{style:{background:"rgba(102, 242, 102, 0.5)"},children:u.capture}),e("span",{style:{background:Ea},children:u.matchPost}),u.after,r.endsWith("\n")?" ":""]}),e(Va,{ref:p,$minHeight:n,value:r,onChange:e=>l(e.target.value),onScroll:h,spellCheck:!1,...i})]})},Xa=r.div`
81
+ `,za=e=>({before:e,matchPre:"",capture:"",matchPost:"",after:""}),Da=({regex:a,value:r,onChange:l,minHeight:n=240,...i})=>{const d=s(null),u=s(null),p=o(()=>((e,t)=>{if(!e||!t)return za(t);let a;try{a=new RegExp(e)}catch{return za(t)}const r=a.exec(t);if(!r)return za(t);const l=r.index,n=r.index+r[0].length;if(r.length<2||null==r[1])return{before:t.slice(0,l),matchPre:"",capture:t.slice(l,n),matchPost:"",after:t.slice(n)};const i=r[0].indexOf(r[1]),o=i>=0?l+i:l,s=o+r[1].length;return{before:t.slice(0,l),matchPre:t.slice(l,o),capture:t.slice(o,s),matchPost:t.slice(s,n),after:t.slice(n)}})(a,r),[a,r]),h=c(()=>{d.current&&u.current&&(d.current.scrollTop=u.current.scrollTop,d.current.scrollLeft=u.current.scrollLeft)},[]);return t(Na,{$minHeight:n,children:[t(Ra,{ref:d,"aria-hidden":!0,children:[p.before,e("span",{style:{background:Ea},children:p.matchPre}),e("span",{style:{background:"rgba(102, 242, 102, 0.5)"},children:p.capture}),e("span",{style:{background:Ea},children:p.matchPost}),p.after,r.endsWith("\n")?" ":""]}),e(Va,{ref:u,$minHeight:n,value:r,onChange:e=>l(e.target.value),onScroll:h,spellCheck:!1,...i})]})},Xa=r.div`
82
82
  flex: 1;
83
83
  min-height: 0;
84
84
  overflow-y: auto;
@@ -100,7 +100,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
100
100
  word-break: break-all;
101
101
  white-space: pre-wrap;
102
102
  user-select: text;
103
- `,Ba=({isOpen:a,regex:r,onClose:l,initialTestString:n=""})=>{const[i,s]=d(n),c=o(()=>((e,t)=>{if(!e)return{ok:!0,isMatch:!1,message:P.RESULT_EMPTY_REGEX};if(!t)return{ok:!0,isMatch:!1,message:P.RESULT_EMPTY_INPUT};let a;try{a=new RegExp(e)}catch(e){return{ok:!1,message:e instanceof Error?e.message:P.RESULT_INVALID_REGEX_FALLBACK}}const r=a.exec(t);return r?{ok:!0,isMatch:!0,message:r.length>1?r[1]:r[0]}:{ok:!0,isMatch:!1,message:P.RESULT_NO_MATCH}})(r,i),[r,i]),p=c.ok?c.isMatch?"match":"neutral":"error";return e(A,{isOpen:a,header:{title:P.TITLE,onClose:()=>{s(""),l()}},children:e(Xa,{children:t(_a,{children:[t(O,{$gap:6,children:[e(L,{label:P.REGEX_LABEL}),e(La,{pattern:r,"data-id":"regex-tester-regex"}),!r&&e(E,{size:N.XXS,color:I.Secondary,children:P.REGEX_EMPTY_HINT})]}),t(O,{$gap:6,children:[t(R,{$width:"100%",$justifyContent:"space-between",$alignItems:"center",children:[e(L,{label:P.TEST_STRING_LABEL}),e(V,{"data-id":"regex-tester-unescape",label:P.UNESCAPE_LABEL,tooltip:P.UNESCAPE_TOOLTIP,variant:D.Secondary,size:z.S,onClick:()=>s(e=>(e=>{let t="";for(let a=0;a<e.length;a++){if("\\"===e[a]&&a+1<e.length){const r=e[a+1],l="n"===r?"\n":"t"===r?"\t":"r"===r?"\r":'"'===r?'"':"'"===r?"'":"\\"===r?"\\":null;if(null!=l){t+=l,a++;continue}}t+=e[a]}return t})(e)),disabled:(u=i,!/\\["'\\nrt]/.test(u))})]}),e(Da,{name:"regex-tester-test-string","data-id":"regex-tester-test-string",placeholder:P.TEST_STRING_PLACEHOLDER,regex:r,value:i,onChange:s,minHeight:240}),e(X,{helpMessage:P.TEST_STRING_HELP})]}),t(O,{$gap:8,children:[e(L,{label:P.RESULT_LABEL}),e(Ha,{$tone:p,"data-id":"regex-tester-result",children:c.message}),c.ok&&c.isMatch&&e(E,{size:N.XXS,color:I.Secondary,children:P.RESULT_CAPTURE_HINT})]})]})})});var u},ja=r.div`
103
+ `,Ba=({isOpen:a,regex:r,onClose:l,initialTestString:n=""})=>{const[i,s]=d(n),c=o(()=>((e,t)=>{if(!e)return{ok:!0,isMatch:!1,message:P.RESULT_EMPTY_REGEX};if(!t)return{ok:!0,isMatch:!1,message:P.RESULT_EMPTY_INPUT};let a;try{a=new RegExp(e)}catch(e){return{ok:!1,message:e instanceof Error?e.message:P.RESULT_INVALID_REGEX_FALLBACK}}const r=a.exec(t);return r?{ok:!0,isMatch:!0,message:r.length>1?r[1]:r[0]}:{ok:!0,isMatch:!1,message:P.RESULT_NO_MATCH}})(r,i),[r,i]),u=c.ok?c.isMatch?"match":"neutral":"error";return e(A,{isOpen:a,header:{title:P.TITLE,onClose:()=>{s(""),l()}},children:e(Xa,{children:t(_a,{children:[t(O,{$gap:6,children:[e(L,{label:P.REGEX_LABEL}),e(La,{pattern:r,"data-id":"regex-tester-regex"}),!r&&e(E,{size:N.XXS,color:I.Secondary,children:P.REGEX_EMPTY_HINT})]}),t(O,{$gap:6,children:[t(R,{$width:"100%",$justifyContent:"space-between",$alignItems:"center",children:[e(L,{label:P.TEST_STRING_LABEL}),e(V,{"data-id":"regex-tester-unescape",label:P.UNESCAPE_LABEL,tooltip:P.UNESCAPE_TOOLTIP,variant:D.Secondary,size:z.S,onClick:()=>s(e=>(e=>{let t="";for(let a=0;a<e.length;a++){if("\\"===e[a]&&a+1<e.length){const r=e[a+1],l="n"===r?"\n":"t"===r?"\t":"r"===r?"\r":'"'===r?'"':"'"===r?"'":"\\"===r?"\\":null;if(null!=l){t+=l,a++;continue}}t+=e[a]}return t})(e)),disabled:(p=i,!/\\["'\\nrt]/.test(p))})]}),e(Da,{name:"regex-tester-test-string","data-id":"regex-tester-test-string",placeholder:P.TEST_STRING_PLACEHOLDER,regex:r,value:i,onChange:s,minHeight:240}),e(X,{helpMessage:P.TEST_STRING_HELP})]}),t(O,{$gap:8,children:[e(L,{label:P.RESULT_LABEL}),e(Ha,{$tone:u,"data-id":"regex-tester-result",children:c.message}),c.ok&&c.isMatch&&e(E,{size:N.XXS,color:I.Secondary,children:P.RESULT_CAPTURE_HINT})]})]})})});var p},ja=r.div`
104
104
  display: grid;
105
105
  grid-template-rows: ${({$open:e})=>e?"1fr":"0fr"};
106
106
  opacity: ${({$open:e})=>e?1:0};
@@ -140,7 +140,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
140
140
  display: flex;
141
141
  align-items: center;
142
142
  justify-content: center;
143
- `,Fa={visibility:"hidden"},Wa=p(({data:r})=>{const l=n(),{service:i,namespace:o,isVirtual:s,isRoot:c,isAttacker:d,isUser:p}=r,u=((e,t)=>"user"===e?Ut:t?Gt:Kt)(i,s),h=c?l.v2.colors.purple[400]:l.v2.colors.silver[200],g=c?I.Link:I.Secondary,m=o?`${o}/${i}`:i,b=s?"virtual":"-";return t(a,{children:[e(v,d||p?{type:"source",position:f.Bottom,style:Fa}:{type:"source",position:f.Top,style:Fa}),e(v,d||p?{type:"target",position:f.Right,style:Fa}:{type:"target",position:f.Left,style:Fa}),t(Ua,{$isRoot:c,$isVirtual:s,children:[t(Ga,{children:[e(Ka,{children:e(u,{size:16,fill:h})}),e(E,{size:N.XXXS,color:g,nowrap:!0,children:m})]}),e(E,{size:N.XXXS,color:g,nowrap:!0,children:b})]})]})});Wa.displayName=Wa.name;const Ya="0;0.5;1",Ja=p(({id:r,sourceX:l,sourceY:i,targetX:s,targetY:c,sourcePosition:d,targetPosition:p,markerEnd:u,style:h,data:g})=>{const m=n(),[v]=b({sourceX:l,sourceY:i,targetX:s,targetY:c,sourcePosition:d,targetPosition:p}),f=`${r}__blast-radius-motion`,$=!!g?.isAttacker,C="string"==typeof h?.stroke?h.stroke:$?m.v2.colors.red[500]:m.v2.colors.silver[400],k=$?m.v2.colors.red[700]:m.v2.colors.silver[600],w=$?m.v2.colors.red[400]:m.v2.colors.silver[200],{travelDuration:S,ballCount:T}=o(()=>{const e=Math.hypot(s-l,c-i),t=((e,t)=>{if("undefined"==typeof document)return t;const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",e),a.getTotalLength()||t})(v,e);return{travelDuration:Math.max(1.2,t/100),ballCount:Math.min(10,Math.max(3,Math.round(t/72)))}},[v,l,i,s,c]),M=`${S.toFixed(3)}s`;return t(a,{children:[e(y,{id:r,path:v,markerEnd:u,style:{...h,stroke:C,strokeWidth:1}}),e(x,{children:t("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[e("path",{id:f,d:v,fill:"none",stroke:"none"}),Array.from({length:T}).map((a,r)=>{const l=`-${(S/T*r).toFixed(3)}s`;return t("circle",{r:0,fill:k,children:[e("animateMotion",{dur:M,begin:l,repeatCount:"indefinite",children:e("mpath",{href:`#${f}`})}),e("animate",{attributeName:"r",dur:M,begin:l,repeatCount:"indefinite",keyTimes:Ya,values:"0;3.5;3.5"}),e("animate",{attributeName:"fill",dur:M,begin:l,repeatCount:"indefinite",keyTimes:Ya,values:`${k};${w};${w}`})]},r)})]})})]})});var Za,Qa;Ja.displayName=Ja.name,(e=>{e.Service="blast-radius-service"})(Za||(Za={})),(e=>{e.Animated="blast-radius-animated"})(Qa||(Qa={}));const er=(e,t)=>{const a=(e||"").trim();return a?`${a}/${t}`:t},tr=e=>er(e.namespace,e.service),ar="user",rr=(e,t,a)=>{const r=new Set(e),l=[...e];for(;l.length;){const e=l.shift();for(const n of a.get(e)??[])n===t||r.has(n)||(r.add(n),l.push(n))}return r},lr=(e,t,a)=>{const r=new Map;if(!e.length)return r;const l=[];for(let t=0;t<e.length;t+=6)l.push(e.slice(t,t+6));const n=-72*(l.length-1)/2;return l.forEach((e,l)=>{const i=n+72*l;e.forEach((e,l)=>{const n=t+a*(l+1)*160;r.set(e,{x:n,y:i})})}),r},nr=(e,t,a)=>{const r=t.map(e=>a.get(e)).filter(e=>!!e);if(!r.length)return{x:0,y:72};const l={x:r.reduce((e,t)=>e+t.x,0)/r.length,y:r.reduce((e,t)=>e+t.y,0)/r.length+72},n=new Set([...a.entries()].filter(([t])=>t!==e).map(([,e])=>`${e.x},${e.y}`));let i=l;for(;n.has(`${i.x},${i.y}`);)i={x:i.x,y:i.y+72};return i},ir=r.div`
143
+ `,Wa={visibility:"hidden"},Fa=u(({data:r})=>{const l=n(),{service:i,namespace:o,isVirtual:s,isRoot:c,isAttacker:d,isUser:u}=r,p=((e,t)=>"user"===e?Ut:t?Gt:Kt)(i,s),h=c?l.v2.colors.purple[400]:l.v2.colors.silver[200],g=c?I.Link:I.Secondary,m=o?`${o}/${i}`:i,b=s?"virtual":"-";return t(a,{children:[e(v,d||u?{type:"source",position:f.Bottom,style:Wa}:{type:"source",position:f.Top,style:Wa}),e(v,d||u?{type:"target",position:f.Right,style:Wa}:{type:"target",position:f.Left,style:Wa}),t(Ua,{$isRoot:c,$isVirtual:s,children:[t(Ga,{children:[e(Ka,{children:e(p,{size:16,fill:h})}),e(E,{size:N.XXXS,color:g,nowrap:!0,children:m})]}),e(E,{size:N.XXXS,color:g,nowrap:!0,children:b})]})]})});Fa.displayName=Fa.name;const Ya="0;0.5;1",Ja=u(({id:r,sourceX:l,sourceY:i,targetX:s,targetY:c,sourcePosition:d,targetPosition:u,markerEnd:p,style:h,data:g})=>{const m=n(),[v]=b({sourceX:l,sourceY:i,targetX:s,targetY:c,sourcePosition:d,targetPosition:u}),f=`${r}__blast-radius-motion`,$=!!g?.isAttacker,C="string"==typeof h?.stroke?h.stroke:$?m.v2.colors.red[500]:m.v2.colors.silver[400],k=$?m.v2.colors.red[700]:m.v2.colors.silver[600],w=$?m.v2.colors.red[400]:m.v2.colors.silver[200],{travelDuration:S,ballCount:T}=o(()=>{const e=Math.hypot(s-l,c-i),t=((e,t)=>{if("undefined"==typeof document)return t;const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",e),a.getTotalLength()||t})(v,e);return{travelDuration:Math.max(1.2,t/100),ballCount:Math.min(10,Math.max(3,Math.round(t/72)))}},[v,l,i,s,c]),M=`${S.toFixed(3)}s`;return t(a,{children:[e(y,{id:r,path:v,markerEnd:p,style:{...h,stroke:C,strokeWidth:1}}),e(x,{children:t("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[e("path",{id:f,d:v,fill:"none",stroke:"none"}),Array.from({length:T}).map((a,r)=>{const l=`-${(S/T*r).toFixed(3)}s`;return t("circle",{r:0,fill:k,children:[e("animateMotion",{dur:M,begin:l,repeatCount:"indefinite",children:e("mpath",{href:`#${f}`})}),e("animate",{attributeName:"r",dur:M,begin:l,repeatCount:"indefinite",keyTimes:Ya,values:"0;3.5;3.5"}),e("animate",{attributeName:"fill",dur:M,begin:l,repeatCount:"indefinite",keyTimes:Ya,values:`${k};${w};${w}`})]},r)})]})})]})});var Za,Qa;Ja.displayName=Ja.name,(e=>{e.Service="blast-radius-service"})(Za||(Za={})),(e=>{e.Animated="blast-radius-animated"})(Qa||(Qa={}));const er=(e,t)=>{const a=(e||"").trim();return a?`${a}/${t}`:t},tr=e=>er(e.namespace,e.service),ar="user",rr=(e,t,a)=>{const r=new Set(e),l=[...e];for(;l.length;){const e=l.shift();for(const n of a.get(e)??[])n===t||r.has(n)||(r.add(n),l.push(n))}return r},lr=(e,t,a)=>{const r=new Map;if(!e.length)return r;const l=[];for(let t=0;t<e.length;t+=6)l.push(e.slice(t,t+6));const n=-72*(l.length-1)/2;return l.forEach((e,l)=>{const i=n+72*l;e.forEach((e,l)=>{const n=t+a*(l+1)*160;r.set(e,{x:n,y:i})})}),r},nr=(e,t,a)=>{const r=t.map(e=>a.get(e)).filter(e=>!!e);if(!r.length)return{x:0,y:72};const l={x:r.reduce((e,t)=>e+t.x,0)/r.length,y:r.reduce((e,t)=>e+t.y,0)/r.length+72},n=new Set([...a.entries()].filter(([t])=>t!==e).map(([,e])=>`${e.x},${e.y}`));let i=l;for(;n.has(`${i.x},${i.y}`);)i={x:i.x,y:i.y+72};return i},ir=r.div`
144
144
  position: relative;
145
145
  width: 100%;
146
146
  height: 286px;
@@ -155,7 +155,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
155
155
  * {
156
156
  transition: none;
157
157
  }
158
- `,or={[Za.Service]:Wa},sr={[Qa.Animated]:Ja},cr={duration:300,padding:.2,includeHiddenNodes:!0,maxZoom:1},dr=({trigger:e})=>{const{fitView:t}=M(),a=s(!0);return u(()=>{a.current?a.current=!1:e>0&&requestAnimationFrame(()=>t(cr))},[e,t]),null},pr=({subgraph:a})=>{const r=n(),[l,i,s]=k([]),[c,p,h]=w([]),[g,m]=d(0),[v,f]=d(null),b=o(()=>{const e=a.nodes.map(e=>`${e.namespace||""}/${e.service}:${e.isVirtual?1:0}`).join("|"),t=a.edges.map(e=>`${e.clientNamespace||""}/${e.clientService}->${e.serverNamespace||""}/${e.serverService}`).join("|");return`${(e=>`${e.root.namespace||""}/${e.root.service}`)(a)}::${e}::${t}`},[a]);u(()=>{const e=((e,t)=>{const a=t.find(t=>t.service===ar&&t.id!==e);return a?.id??null})(tr(a.root),a.nodes.map(e=>({id:tr(e),service:e.service}))),t=((e,t)=>{const a=tr(e.root);return e.nodes.map(e=>{const r=tr(e);return{id:r,type:Za.Service,position:{x:0,y:0},data:{service:e.service,namespace:e.namespace||"",isVirtual:e.isVirtual,isRoot:r===a,isAttacker:r===t,isUser:e.service===ar},measured:{width:120,height:58}}})})(a,e),l=new Set(t.map(e=>e.id)),n=((e,t,a,r)=>{const l=t.v2.colors.silver[400],n=t.v2.colors.red[500],i=tr(e.root);return e.edges.flatMap(e=>{const t=(e=>er(e.clientNamespace,e.clientService))(e),o=(e=>er(e.serverNamespace,e.serverService))(e);if(!a.has(t)||!a.has(o))return[];const s=!!r&&(t===r&&o===i||t===i&&o===r),c=s?n:l;return[{id:`${t}->${o}`,type:"smoothstep",source:t,target:o,data:{isAttacker:s},markerEnd:{type:$.ArrowClosed,color:c,width:16,height:16},style:{stroke:c,strokeWidth:1}}]})})(a,r,l,e),o=((e,t)=>{if(!e.length)return{nodes:e,edges:t};const a=(e.find(e=>e.data.isRoot)??e[0]).id,r=e.find(e=>e.data.isAttacker)?.id??null,l=new Map,n=new Map,i=new Map;for(const t of e)l.set(t.id,[]),n.set(t.id,[]),i.set(t.id,[]);for(const e of t)l.get(e.source)?.push(e.target),n.get(e.target)?.push(e.source),i.get(e.source)?.push(e.target),i.get(e.target)?.push(e.source);const o=rr((n.get(a)??[]).filter(e=>e!==r),a,i),s=rr((l.get(a)??[]).filter(e=>e!==r&&!o.has(e)),a,i);r&&(o.delete(r),s.delete(r));const c=((e,t)=>{const a=new Map([[e,0]]),r=[e];for(;r.length;){const e=r.shift(),l=(a.get(e)??0)+1;for(const n of t.get(e)??[])a.has(n)||(a.set(n,l),r.push(n))}return a})(a,i),d=[...o].sort((e,t)=>{const a=(c.get(t)??0)-(c.get(e)??0);return 0!==a?a:e.localeCompare(t)}),p=[...s].filter(e=>!o.has(e)).sort((e,t)=>{const a=(c.get(e)??0)-(c.get(t)??0);return 0!==a?a:e.localeCompare(t)});for(const t of e)t.id===a||t.id===r||o.has(t.id)||s.has(t.id)||d.push(t.id);const u=new Map([[a,{x:0,y:0}]]);for(const[e,t]of lr(d,0,-1))u.set(e,t);for(const[e,t]of lr(p,0,1))u.set(e,t);return r&&u.set(r,nr(r,i.get(r)??[],u)),{nodes:e.map(e=>({...e,position:u.get(e.id)??e.position})),edges:t}})(t,n);i(o.nodes),p(o.edges),f(null),m(e=>e+1)},[b,a,r,i,p]);const y=o(()=>v?c.map(e=>{if(e.source===v||e.target===v)return{...e,type:Qa.Animated};const t={opacity:.3};return{...e,style:{...e.style,...t},labelStyle:{...e.labelStyle,...t},labelBgStyle:{...e.labelBgStyle,...t}}}):c,[c,v]);return e(ir,{children:t(S,{nodes:l,edges:y,nodeTypes:or,edgeTypes:sr,onNodesChange:s,onEdgesChange:h,onNodeMouseEnter:(e,t)=>f(t.id),onNodeMouseLeave:()=>f(null),nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,zoomOnScroll:!0,minZoom:.4,maxZoom:1.5,proOptions:{hideAttribution:!0},children:[e(T,{color:r.v2.colors.silver[600],gap:17,size:1}),e(dr,{trigger:g})]})})},ur=({blastRadius:t})=>t?.nodes?.length?e(C,{children:e(pr,{subgraph:t})}):e(_,{children:e(H,{subTitle:"No blast-radius neighborhood for this service yet."})}),hr=({isOpen:t,onClose:a,onDeny:r,onApprove:l})=>e(B,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:a,denyButton:{label:"Keep editing",variant:D.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:"Discard changes",variant:D.Primary,onClick:()=>{l?.(),a()}}}),gr=r.div`
158
+ `,or={[Za.Service]:Fa},sr={[Qa.Animated]:Ja},cr={duration:300,padding:.2,includeHiddenNodes:!0,maxZoom:1},dr=({trigger:e})=>{const{fitView:t}=M(),a=s(!0);return p(()=>{a.current?a.current=!1:e>0&&requestAnimationFrame(()=>t(cr))},[e,t]),null},ur=({subgraph:a})=>{const r=n(),[l,i,s]=k([]),[c,u,h]=w([]),[g,m]=d(0),[v,f]=d(null),b=o(()=>{const e=a.nodes.map(e=>`${e.namespace||""}/${e.service}:${e.isVirtual?1:0}`).join("|"),t=a.edges.map(e=>`${e.clientNamespace||""}/${e.clientService}->${e.serverNamespace||""}/${e.serverService}`).join("|");return`${(e=>`${e.root.namespace||""}/${e.root.service}`)(a)}::${e}::${t}`},[a]);p(()=>{const e=((e,t)=>{const a=t.find(t=>t.service===ar&&t.id!==e);return a?.id??null})(tr(a.root),a.nodes.map(e=>({id:tr(e),service:e.service}))),t=((e,t)=>{const a=tr(e.root);return e.nodes.map(e=>{const r=tr(e);return{id:r,type:Za.Service,position:{x:0,y:0},data:{service:e.service,namespace:e.namespace||"",isVirtual:e.isVirtual,isRoot:r===a,isAttacker:r===t,isUser:e.service===ar},measured:{width:120,height:58}}})})(a,e),l=new Set(t.map(e=>e.id)),n=((e,t,a,r)=>{const l=t.v2.colors.silver[400],n=t.v2.colors.red[500],i=tr(e.root);return e.edges.flatMap(e=>{const t=(e=>er(e.clientNamespace,e.clientService))(e),o=(e=>er(e.serverNamespace,e.serverService))(e);if(!a.has(t)||!a.has(o))return[];const s=!!r&&(t===r&&o===i||t===i&&o===r),c=s?n:l;return[{id:`${t}->${o}`,type:"smoothstep",source:t,target:o,data:{isAttacker:s},markerEnd:{type:$.ArrowClosed,color:c,width:16,height:16},style:{stroke:c,strokeWidth:1}}]})})(a,r,l,e),o=((e,t)=>{if(!e.length)return{nodes:e,edges:t};const a=(e.find(e=>e.data.isRoot)??e[0]).id,r=e.find(e=>e.data.isAttacker)?.id??null,l=new Map,n=new Map,i=new Map;for(const t of e)l.set(t.id,[]),n.set(t.id,[]),i.set(t.id,[]);for(const e of t)l.get(e.source)?.push(e.target),n.get(e.target)?.push(e.source),i.get(e.source)?.push(e.target),i.get(e.target)?.push(e.source);const o=rr((n.get(a)??[]).filter(e=>e!==r),a,i),s=rr((l.get(a)??[]).filter(e=>e!==r&&!o.has(e)),a,i);r&&(o.delete(r),s.delete(r));const c=((e,t)=>{const a=new Map([[e,0]]),r=[e];for(;r.length;){const e=r.shift(),l=(a.get(e)??0)+1;for(const n of t.get(e)??[])a.has(n)||(a.set(n,l),r.push(n))}return a})(a,i),d=[...o].sort((e,t)=>{const a=(c.get(t)??0)-(c.get(e)??0);return 0!==a?a:e.localeCompare(t)}),u=[...s].filter(e=>!o.has(e)).sort((e,t)=>{const a=(c.get(e)??0)-(c.get(t)??0);return 0!==a?a:e.localeCompare(t)});for(const t of e)t.id===a||t.id===r||o.has(t.id)||s.has(t.id)||d.push(t.id);const p=new Map([[a,{x:0,y:0}]]);for(const[e,t]of lr(d,0,-1))p.set(e,t);for(const[e,t]of lr(u,0,1))p.set(e,t);return r&&p.set(r,nr(r,i.get(r)??[],p)),{nodes:e.map(e=>({...e,position:p.get(e.id)??e.position})),edges:t}})(t,n);i(o.nodes),u(o.edges),f(null),m(e=>e+1)},[b,a,r,i,u]);const y=o(()=>v?c.map(e=>{if(e.source===v||e.target===v)return{...e,type:Qa.Animated};const t={opacity:.3};return{...e,style:{...e.style,...t},labelStyle:{...e.labelStyle,...t},labelBgStyle:{...e.labelBgStyle,...t}}}):c,[c,v]);return e(ir,{children:t(S,{nodes:l,edges:y,nodeTypes:or,edgeTypes:sr,onNodesChange:s,onEdgesChange:h,onNodeMouseEnter:(e,t)=>f(t.id),onNodeMouseLeave:()=>f(null),nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,zoomOnScroll:!0,minZoom:.4,maxZoom:1.5,proOptions:{hideAttribution:!0},children:[e(T,{color:r.v2.colors.silver[600],gap:17,size:1}),e(dr,{trigger:g})]})})},pr=({blastRadius:t})=>t?.nodes?.length?e(C,{children:e(ur,{subgraph:t})}):e(_,{children:e(H,{subTitle:"No blast-radius neighborhood for this service yet."})}),hr=({isOpen:t,onClose:a,onDeny:r,onApprove:l})=>e(B,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:a,denyButton:{label:"Keep editing",variant:D.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:"Discard changes",variant:D.Primary,onClick:()=>{l?.(),a()}}}),gr=r.div`
159
159
  display: flex;
160
160
  flex-direction: column;
161
161
  gap: 12px;
@@ -168,7 +168,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
168
168
  align-items: center;
169
169
  justify-content: space-between;
170
170
  width: 100%;
171
- `,vr=({isOpen:a,onClose:r,language:l,code:n,...i})=>{const{CopyButton:o}=j();return e(q,{isOpen:a,onClose:r,children:t(gr,{children:[t(mr,{children:[e(E,{size:N.XS,children:"JSON view"}),e(U,{icon:t=>e(Ft,{...t}),size:G.L,onClick:r})]}),l&&n?e(K,{fullHeight:!0,overflow:"auto",children:t(R,{$width:"100%",$alignItems:"flex-start",$justifyContent:"space-between",children:[e(F,{language:l,code:n,...i}),e(o,{value:n})]})}):e(H,{})]})})},fr=({isOpen:t,onClose:a,onViewConnector:r})=>e(B,{isOpen:t,onClose:a,visual:()=>e(J,{scale:1.2,icon:Wt}),title:Y.CLOUD_CONNECTOR_CREATED_MODAL_TITLE,description:Y.CLOUD_CONNECTOR_CREATED_MODAL_DESC,denyButton:{label:W.STAY_ON_CONNECTIONS,variant:D.Secondary,onClick:a},approveButton:{label:W.GO_TO_CONNECTOR_OVERVIEW,variant:D.Primary,onClick:r??a}}),br=({isOpen:t,onClose:a,onDeny:r,onApprove:l,action:n="delete",target:i,description:o,overrideApproveButtonLabel:s,overrideDenyButtonLabel:c})=>{const d=n.charAt(0).toUpperCase()+n.substring(1),p=i?.endsWith("s")?"these":"this";return e(B,{title:`${d}${i?` ${i}`:""}?`,description:o??`Are you sure you want to ${n}${i?` ${p} ${i}`:""}?`,isOpen:t,onClose:a,denyButton:{label:c??"Go back",variant:D.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:s??d,variant:D.Primary,onClick:()=>{l?.(),a()}}})},yr=({componentType:t,inputType:a,name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d,setValue:p,errorMessage:u,warnMessage:h,helpMessage:g,dropdownOptions:m,dropdownNoSearch:v,dropdownNoCheckbox:f,timeUnits:b,timeDefaultUnit:y,toggleSize:x=te.L,keyLabel:$,valueLabel:C})=>{switch(t){case Z.Input:return e(ce,{name:r,type:a,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",onChange:e=>{const t=e.target.value;p(a===de.Number?""===t?null:Number(t):t)},errorMessage:u,warnMessage:h,helpMessage:g},r);case Z.MultiInput:return e(se,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,values:Array.isArray(d)?d:oe(d,[]),setValues:e=>p(e),errorMessage:u,warnMessage:h,helpMessage:g,plain:!0},r);case Z.KeyValuePair:return e(ie,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:c,limitFieldsPerRow:2,columns:[{keyName:"key",label:$||"Key",placeholder:$||"Key"},{keyName:"value",label:C||"Value",placeholder:C||"Value"}],values:Array.isArray(d)?d:oe(d,[]),setValues:e=>p(e),errorMessage:u,warnMessage:h,helpMessage:g},r);case Z.TextArea:return e(ne,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:c,placeholder:o,value:d??"",onChange:e=>p(e.target.value),errorMessage:u,warnMessage:h,helpMessage:g},r);case Z.Dropdown:return e(le,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,withSearch:!v,options:m?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!f}))||[],values:d?[String(d)]:[],setValues:e=>p(e[0]),errorMessage:u,warnMessage:h,helpMessage:g},r);case Z.Checkbox:return e(re,{name:r,label:l,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>p(e),disabled:c,errorMessage:u,warnMessage:h,helpMessage:g},r);case Z.Time:return e(ae,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",setValue:e=>p(e),units:b,defaultUnit:y,errorMessage:u,warnMessage:h,helpMessage:g},r);case Z.Toggle:return e(Q,{name:r,size:x,labelAlign:ee.Right,label:l,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>p(e),disabled:c,errorMessage:u,warnMessage:h,helpMessage:g},r);default:return null}},xr=r.div`
171
+ `,vr=({isOpen:a,onClose:r,language:l,code:n,...i})=>{const{CopyButton:o}=j();return e(q,{isOpen:a,onClose:r,children:t(gr,{children:[t(mr,{children:[e(E,{size:N.XS,children:"JSON view"}),e(U,{icon:t=>e(Wt,{...t}),size:G.L,onClick:r})]}),l&&n?e(K,{fullHeight:!0,overflow:"auto",children:t(R,{$width:"100%",$alignItems:"flex-start",$justifyContent:"space-between",children:[e(W,{language:l,code:n,...i}),e(o,{value:n})]})}):e(H,{})]})})},fr=({isOpen:t,onClose:a,onViewConnector:r})=>e(B,{isOpen:t,onClose:a,visual:()=>e(J,{scale:1.2,icon:Ft}),title:Y.CLOUD_CONNECTOR_CREATED_MODAL_TITLE,description:Y.CLOUD_CONNECTOR_CREATED_MODAL_DESC,denyButton:{label:F.STAY_ON_CONNECTIONS,variant:D.Secondary,onClick:a},approveButton:{label:F.GO_TO_CONNECTOR_OVERVIEW,variant:D.Primary,onClick:r??a}}),br=({isOpen:t,onClose:a,onDeny:r,onApprove:l,action:n="delete",target:i,description:o,overrideApproveButtonLabel:s,overrideDenyButtonLabel:c})=>{const d=n.charAt(0).toUpperCase()+n.substring(1),u=i?.endsWith("s")?"these":"this";return e(B,{title:`${d}${i?` ${i}`:""}?`,description:o??`Are you sure you want to ${n}${i?` ${u} ${i}`:""}?`,isOpen:t,onClose:a,denyButton:{label:c??"Go back",variant:D.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:s??d,variant:D.Primary,onClick:()=>{l?.(),a()}}})},yr=({componentType:t,inputType:a,name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d,setValue:u,errorMessage:p,warnMessage:h,helpMessage:g,dropdownOptions:m,dropdownNoSearch:v,dropdownNoCheckbox:f,timeUnits:b,timeDefaultUnit:y,toggleSize:x=te.L,keyLabel:$,valueLabel:C})=>{switch(t){case Z.Input:return e(ce,{name:r,type:a,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",onChange:e=>{const t=e.target.value;u(a===de.Number?""===t?null:Number(t):t)},errorMessage:p,warnMessage:h,helpMessage:g},r);case Z.MultiInput:return e(se,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,values:Array.isArray(d)?d:oe(d,[]),setValues:e=>u(e),errorMessage:p,warnMessage:h,helpMessage:g,plain:!0},r);case Z.KeyValuePair:return e(ie,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:c,limitFieldsPerRow:2,columns:[{keyName:"key",label:$||"Key",placeholder:$||"Key"},{keyName:"value",label:C||"Value",placeholder:C||"Value"}],values:Array.isArray(d)?d:oe(d,[]),setValues:e=>u(e),errorMessage:p,warnMessage:h,helpMessage:g},r);case Z.TextArea:return e(ne,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:c,placeholder:o,value:d??"",onChange:e=>u(e.target.value),errorMessage:p,warnMessage:h,helpMessage:g},r);case Z.Dropdown:return e(le,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,withSearch:!v,options:m?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!f}))||[],values:d?[String(d)]:[],setValues:e=>u(e[0]),errorMessage:p,warnMessage:h,helpMessage:g},r);case Z.Checkbox:return e(re,{name:r,label:l,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>u(e),disabled:c,errorMessage:p,warnMessage:h,helpMessage:g},r);case Z.Time:return e(ae,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",setValue:e=>u(e),units:b,defaultUnit:y,errorMessage:p,warnMessage:h,helpMessage:g},r);case Z.Toggle:return e(Q,{name:r,size:x,labelAlign:ee.Right,label:l,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>u(e),disabled:c,errorMessage:p,warnMessage:h,helpMessage:g},r);default:return null}},xr=r.div`
172
172
  display: flex;
173
173
  flex-wrap: wrap;
174
174
  gap: 8px;
@@ -216,7 +216,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
216
216
  border-radius: 999px;
217
217
  background-color: ${({theme:e})=>e.v2.colors.silver[700]};
218
218
  border: 1px solid ${({theme:e})=>e.v2.colors.silver[600]};
219
- `,Mr={[xe.JavaScript]:"Node.js",[xe.DotNet]:".NET",[xe.Php]:"PHP",[xe.Java]:"Java",[xe.Go]:"Go",[xe.Python]:"Python",[xe.Ruby]:"Ruby",[xe.Rust]:"Rust"},Ar=[xe.Python,xe.Java,xe.JavaScript,xe.DotNet,xe.Php,xe.Ruby,xe.Go],Pr=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Or(e){return Mr[e]||e.charAt(0).toUpperCase()+e.slice(1)}function Lr(e){return null!=e?`${e}. ${Oe}`:Oe}const Er=({readOnly:t,...a})=>e(t?Rr:zr,{...a}),Ir=({title:a,count:r,children:l})=>t(O,{$gap:6,children:[t(R,{$gap:8,$alignItems:"center",children:[e(E,{size:N.XS,color:I.Primary,nowrap:!0,children:a}),r>1&&e(E,{size:N.XXS,color:I.Secondary,nowrap:!0,children:`(${Ae})`})]}),e(wr,{children:l})]}),Nr=()=>{const t=n();return e(Sr,{children:e(Tr,{children:e(E,{size:N.XXS,color:t.v2.colors.white[500],nowrap:!0,children:Pe})})})},Rr=({scopes:a,titleNumber:r})=>{const l=Lr(r);if(pa(a))return e(K,{bgTint:"900",richTitle:{title:l},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(pe,{status:he.Default,message:ue,fullWidth:!0})});const n=a.sources??[],o=a.namespaces??[],s=a.languages??[],c=[];return n.length&&c.push({kind:"sources",node:e(Ir,{title:ge,count:n.length,children:n.map((t,a)=>{const r=[t.namespace,t.kind,t.name].filter(Boolean),l=r.length?r.join(" / "):ve;return e(me,{label:l},`src-${a}-${l}`)})})}),o.length&&c.push({kind:"namespaces",node:e(Ir,{title:fe,count:o.length,children:o.map((t,a)=>e(me,{label:t},`ns-${a}-${t}`))})}),s.length&&c.push({kind:"languages",node:e(Ir,{title:be,count:s.length,children:s.map((t,a)=>{const r=$e(t);return e(me,{label:Or(t),leftIcon:r},`lang-${a}-${t}`)})})}),e(K,{bgTint:"900",richTitle:{title:l,subTitle:c.length>1?ye:void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(K,{bgTint:"800",children:e(kr,{children:c.map((a,r)=>t(i.Fragment,{children:[r>0&&e(Nr,{}),a.node]},a.kind))})})})},Vr=e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all",zr=({scopes:a,onChange:r,sourceOptions:l=[],namespaceOptions:n=[],supportedLanguages:i,titleNumber:s,dataIdPrefix:p="source-scope",slim:h,disabled:g})=>{const m=a??ua(),[v,f]=d(()=>Vr(m)),{sources:b,namespaces:y,languages:x}=m,$=b.length>0||y.length>0||x.length>0;u(()=>{$&&"all"===v&&f(Vr(m))},[$,v]);const C=o(()=>Pr.map(e=>"language"===e.value&&0===i?.length?null:{...e,disabled:"all"===e.value&&$}).filter(Boolean),[$]),k=o(()=>b.map(e=>`${e.namespace}/${e.kind}/${e.name}`),[b]),w=o(()=>[...y],[y]),S=o(()=>new Set(x),[x]),T=c(e=>{f(e)},[]),M=c(e=>{const t=e.map(e=>(e=>{const t=e.split("/");return 3!==t.length?null:{namespace:t[0],kind:t[1],name:t[2]}})(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));r({...m,sources:t})},[m,r]),A=c(e=>{r({...m,namespaces:e})},[m,r]),P=c(e=>{const t=m.languages,a=t.includes(e)?t.filter(t=>t!==e):[...t,e];r({...m,languages:a})},[m,r]),L=!$&&"all"===v,R=(i||Ar).map(e=>({id:e,label:Mr[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:$e(e)}));return t(Ce,{richTitle:h?{title:Lr(s),titleSize:N.XS,titleColor:I.Secondary,tooltip:ke}:{title:Lr(s),subTitle:ke,subTitleWrap:!0},backgroundColor:h?"transparent":void 0,padding:h?0:void 0,children:[e(pe,L?{status:he.Default,message:ue,fullWidth:!0,smallIcon:!0}:{status:he.Info,message:ye,fullWidth:!0,smallIcon:!0}),e(O,{$alignItems:"flex-start",children:e(we,{options:C,selected:v,setSelected:T,disabled:g})}),"source"===v&&e(Se,{multiple:!0,"data-id":`${p}-autocomplete-source`,options:l,value:k,onSelect:M,placeholder:Te,disabled:g}),"namespace"===v&&e(Se,{multiple:!0,"data-id":`${p}-autocomplete-namespace`,options:n,value:w,onSelect:A,placeholder:"Search namespace",disabled:g}),"language"===v&&R.length>0&&e(xr,{children:R.map(({id:a,label:r,Icon:l})=>{const n=S.has(a);return t($r,{$selected:n,onClick:()=>P(a),children:[e(re,{name:`${p}-lang-${a}`,size:Me.S,value:n,onChange:()=>P(a),disabled:g}),e(Cr,{children:e(l,{size:20})}),e(E,{size:N.XS,nowrap:!0,children:r})]},a)})})]})},Dr=e=>{if(null!=e){if(!Array.isArray(e)&&"object"==typeof e)return Object.entries(e).map(([e,t])=>({id:e,label:null==t?e:String(t)}));if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)}},Xr=e=>{if(!Array.isArray(e)||e.length<3)return;const[t,a,r]=e;return e=>{const l=null==e?.[t]?"":String(e[t]);switch(a){case"=":case"==":case"===":return l===r;case"!=":case"!==":return l!==r;default:return!0}}},_r=e=>{if(Array.isArray(e))return e.map(e=>{const t=e;return{keyName:String(t.keyName??t.name??""),label:t.label??t.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,componentType:t.componentType,options:Dr(t.options??t.values),fullRow:t.fullRow,defaultValue:t.defaultValue,withRegexTester:t.withRegexTester,separator:t.separator,copyByColumn:t.copyByColumn,renderCondition:Xr(t.renderCondition)}})},Hr=e=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return{id:e,label:e};const t=e;return{id:String(t.id??t.keyName??t.name??""),label:t.label??t.displayName??String(t.id??""),tooltip:t.tooltip,fields:Array.isArray(t.fields)?t.fields.map(Br):void 0}})},Br=e=>{const t="string"==typeof e.componentProperties?oe(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,inputType:e.inputType??t.inputType??t.type,title:e.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,required:t.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:Dr(t.options??t.values),itemWrapperKey:t.itemWrapperKey,columns:_r(t.columns),limitFieldsPerRow:t.limitFieldsPerRow,variant:t.variant,wrapKey:t.wrapKey,checkboxOptions:Hr(t.options??t.values),checkedValue:t.checkedValue??"true",valueMode:t.valueMode??"object",fields:Array.isArray(t.fields)?t.fields.map(Br):void 0,addLabel:t.addLabel,itemLabel:t.itemLabel,keyLabel:t.titleKey??t.keyLabel,valueLabel:t.titleValue??t.valueLabel,persistAs:t.persistAs}},jr=e=>{const t=e.initialValue;if(void 0!==t&&""!==t)return e.componentType===Z.CheckboxList?"array"===e.valueMode?oe(t,[]):oe(t,{}):e.componentType!==Z.MultiInput&&e.componentType!==Z.MultiTabledInput||!e.wrapKey?e.componentType===Z.MultiInput||e.componentType===Z.MultiTabledInput?oe(t,[]):e.componentType===Z.SourceScopes?"null"===t||"{}"===t?ua():ga(oe(t,null)):e.componentType===Z.Toggle||e.componentType===Z.Checkbox?"true"===t:t:{[e.wrapKey]:oe(t,[])}},qr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Ur=e=>Array.isArray(e)?e:[],Gr=e=>{const t={};return e.forEach(e=>{t[String(e.key??"")]=String(e.value??"")}),t},Kr=e=>qr(e)?Object.entries(e).map(([e,t])=>({key:e,value:String(t??"")})):[],Fr=({field:t,value:a,setValue:r,errorMessage:l,disabled:n})=>{const[i,o]=d(()=>Kr(a));return u(()=>{const e=qr(a)?a:{};((e,t)=>{const a=Object.keys(e),r=Object.keys(t);return a.length===r.length&&a.every(a=>Object.prototype.hasOwnProperty.call(t,a)&&t[a]===e[a])})(Gr(i),e)||o(Kr(a))},[a]),e(ie,{name:t.name,label:t.title,tooltip:t.tooltip,helpMessage:t.helpMessage,required:t.required,disabled:n,limitFieldsPerRow:2,columns:[{keyName:"key",label:t.keyLabel||"Key",placeholder:t.keyLabel||"Key"},{keyName:"value",label:t.valueLabel||"Value",placeholder:t.valueLabel||"Value"}],values:i,setValues:e=>{o(e),r(Gr(e))},errorMessage:l})},Wr=({field:r,value:l,setValue:n,errorMessage:i,disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:p})=>{const{name:u,componentType:h,inputType:g,title:m,tooltip:v,placeholder:f,helpMessage:b,required:y,initialValue:x,options:$,itemWrapperKey:C,columns:k,limitFieldsPerRow:w,variant:S,wrapKey:T,checkboxOptions:M}=r,[A,P]=d({open:!1,value:""});if(h===Z.SourceScopes)return e(Er,{scopes:ga(l),onChange:e=>n(e),sourceOptions:c,namespaceOptions:p,dataIdPrefix:`dynamic-field-${u}`,slim:!0});if(h===Z.CheckboxList&&"array"===r.valueMode){const a=Ur(l),r=(e,t)=>n(t?[...a.filter(t=>t!==e),e]:a.filter(t=>t!==e));return t(O,{$gap:12,children:[m&&e(L,{label:m,tooltip:v,required:y}),e(O,{$gap:8,children:(M||[]).map(t=>{const l=e(re,{name:t.id,label:t.label,value:a.includes(t.id),disabled:o,onChange:e=>r(t.id,e)},t.id);return t.tooltip?e(Ie,{text:t.tooltip,withIcon:!0,children:l},t.id):l})}),e(X,{errorMessage:i,helpMessage:b})]})}if(h===Z.CheckboxList){const a=qr(l)?l:{},c=(e=>"emptyObject"!==e.checkedValue||{})(r),d=e=>"emptyObject"===r.checkedValue?qr(e):!!e;return t(O,{$gap:12,children:[m&&e(E,{size:N.XS,color:I.Secondary,nowrap:!0,children:m}),e(O,{$gap:12,children:(M||[]).map(r=>{const l=a[r.id],i=d(l),p=qr(l)?l:{},h=e(re,{label:r.label,value:i,disabled:o,onChange:e=>n({...a,[r.id]:e?qr(l)?l:c:null})}),g=r.tooltip?e(Ie,{text:r.tooltip,withIcon:!0,children:h}):h,m=i&&r.fields?.length?e(O,{$gap:12,$padding:"0 0 0 24px",children:r.fields.map(t=>e(Wr,{field:t,value:p[t.name],setValue:e=>n({...a,[r.id]:{...p,[t.name]:e}}),disabled:o,keyValuePersistAs:s},`${u}-${r.id}-${t.name}`))}):null;return t(O,{$gap:12,children:[g,m]},r.id)})}),e(X,{errorMessage:i,helpMessage:b})]})}if(h===Z.MultiTabledInput){const r=Ur(T?l?.[T]:l),s=e=>n(T?{...qr(l)?l:{},[T]:e}:e),c=(k||[]).some(e=>e.withRegexTester);return t(a,{children:[e("cards"===S?Ne:ie,{name:u,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,columns:k||[],limitFieldsPerRow:w,values:r,setValues:s,errorMessage:i,onTestRegex:c?e=>P({open:!0,value:e}):void 0}),c&&e(Ba,{isOpen:A.open,regex:A.value,onClose:()=>P({open:!1,value:""})})]})}if(h===Z.MultiInput&&T){const t=Ur(l?.[T]);return e(se,{name:u,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n({...qr(l)?l:{},[T]:e}),errorMessage:i})}if(h===Z.MultiInput&&C){const t=Ur(l).map(e=>String(e?.[C]??""));return e(se,{name:u,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n(e.map(e=>({[C]:e}))),errorMessage:i})}return h===Z.KeyValuePair?"map"===(r.persistAs??s)?e(Fr,{field:r,value:l,setValue:n,errorMessage:i,disabled:o}):e(yr,{componentType:h,name:u,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,errorMessage:i,keyLabel:r.keyLabel,valueLabel:r.valueLabel,value:l??[],setValue:n}):e(yr,{componentType:h,inputType:g,name:u,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,placeholder:f,errorMessage:i,dropdownOptions:$,value:(null==l?x:l)??"",setValue:n})},Yr=({field:r,value:l,setValue:i,disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:d})=>{const p=n(),u=Ur(l),g=u.length?u:[{}],m=r.fields||[],v=e=>i(e);return t(a,{children:[g.map((a,l)=>t(h,{children:[e(Ee,{}),t(O,{$gap:12,children:[t(R,{$justifyContent:"space-between",$alignItems:"center",children:[e(L,{label:`${r.itemLabel||r.title||"Item"} ${l+1}`}),e(V,{leftIcon:()=>e(Yt,{fill:p.v2.colors.red[500]}),variant:D.Secondary,size:z.S,onClick:()=>(e=>{const t=g.filter((t,a)=>a!==e);v(t)})(l),disabled:o||1===g.length})]}),m.map(t=>e(Wr,{field:t,value:a[t.name],setValue:e=>((e,t,a)=>v(g.map((r,l)=>l===e?{...r,[t]:a}:r)))(l,t.name,e),disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:d},`${r.name}-group-${l}-${t.name}`))]})]},`${r.name}-group-${l}`)),e(V,{variant:D.Secondary,label:r.addLabel||"Add",leftIcon:Jt,onClick:()=>v([...g,{}]),disabled:o}),e(Ee,{})]})},Jr=({field:a,value:r,setValue:l,errorMessage:n,disabled:i})=>t(O,{$gap:12,children:[a.title&&e(L,{label:a.title,tooltip:a.tooltip,required:a.required}),e(O,{$gap:8,children:(a.checkboxOptions||[]).map(t=>{const a=e(re,{name:t.id,label:t.label,value:!0===r?.[t.id],disabled:i,onChange:e=>l(t.id,e)},t.id);return t.tooltip?e(Ie,{text:t.tooltip,withIcon:!0,children:a},t.id):a})}),e(X,{errorMessage:n,helpMessage:a.helpMessage})]}),Zr=({signals:t,fields:r,value:l,setValue:n,formErrors:i,disabled:o,seedInitialValues:s,keyValuePersistAs:c="map",sourceOptions:d,namespaceOptions:p})=>{const{isK8s:h}=ha(),g=(r||[]).filter(e=>!!e).map(e=>Br(e));return u(()=>{if(!s)return;const e=l||{},t={};g.forEach(a=>{if(a.componentType===Z.SourceScopes&&!h)return;const r=a.componentType===Z.SourceScopes?jr(a)??ua():jr(a);if(void 0===r)return;if(a.componentType===Z.CheckboxList&&"flatFields"===a.valueMode&&qr(r))return void Object.entries(r).forEach(([a,r])=>{void 0!==e[a]&&null!==e[a]||(t[a]=r)});const l=e[a.name];if(a.componentType===Z.SourceScopes){if(void 0!==l)return}else if(null!=l)return;t[a.name]=qr(r)&&qr(t[a.name])?{...t[a.name],...r}:r}),Object.entries(t).forEach(([e,t])=>n(e,t))},[]),e(a,{children:g.map((a,r)=>{const s=Object.entries(l||{}).map(([e,t])=>({name:e,key:e,value:t}));if(a.renderCondition&&!Le(a.renderCondition,t,s))return null;if(a.componentType===Z.SourceScopes&&!h)return null;const u=l?.[a.name],g=`${a.name}-${r}`;if(a.componentType===Z.FieldGroup)return e(Yr,{field:a,value:u,setValue:e=>n(a.name,e),disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:p},g);if(a.componentType===Z.CheckboxList&&"flatFields"===a.valueMode){const t=a.checkboxOptions?.map(e=>i[e.id]).find(Boolean);return e(Jr,{field:a,value:l||{},setValue:n,errorMessage:t,disabled:o},g)}return e(Wr,{field:a,value:u,setValue:e=>n(a.name,e),errorMessage:i[a.name],disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:p},g)})})},Qr=Zr,el=({isEnabled:t,setIsEnabled:a,fieldDisabled:r})=>{const l=n();return e(we,{options:[{icon:Zt,label:"Enable",value:!0,selectedBgColor:l.v2.colors.green[1e3],selectedBorderColor:l.v2.colors.green[400],selectedTextColor:l.v2.colors.green[400]},{icon:Qt,label:"Disable",value:!1,selectedBgColor:l.v2.colors.red[1e3],selectedBorderColor:l.v2.colors.red[500],selectedTextColor:l.v2.colors.red[400]}],size:Re.S,selected:t,setSelected:a,disabled:r})},tl=r.div`
219
+ `,Mr={[xe.JavaScript]:"Node.js",[xe.DotNet]:".NET",[xe.Php]:"PHP",[xe.Java]:"Java",[xe.Go]:"Go",[xe.Python]:"Python",[xe.Ruby]:"Ruby",[xe.Rust]:"Rust"},Ar=[xe.Python,xe.Java,xe.JavaScript,xe.DotNet,xe.Php,xe.Ruby,xe.Go],Pr=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Or(e){return Mr[e]||e.charAt(0).toUpperCase()+e.slice(1)}function Lr(e){return null!=e?`${e}. ${Oe}`:Oe}const Er=({readOnly:t,...a})=>e(t?Rr:zr,{...a}),Ir=({title:a,count:r,children:l})=>t(O,{$gap:6,children:[t(R,{$gap:8,$alignItems:"center",children:[e(E,{size:N.XS,color:I.Primary,nowrap:!0,children:a}),r>1&&e(E,{size:N.XXS,color:I.Secondary,nowrap:!0,children:`(${Ae})`})]}),e(wr,{children:l})]}),Nr=()=>{const t=n();return e(Sr,{children:e(Tr,{children:e(E,{size:N.XXS,color:t.v2.colors.white[500],nowrap:!0,children:Pe})})})},Rr=({scopes:a,titleNumber:r,title:l,subTitle:n,icon:o,bgTint:s="900",entireClusterWarningMessage:c})=>{const d=l??Lr(r),u={icon:o,title:d,subTitle:n,alignItems:n||o?"flex-start":void 0};if(ua(a))return e(K,{bgTint:s,richTitle:u,withCollapse:!0,collapseIsDefaultOpen:!0,children:t(O,{$gap:8,children:[e(ue,{status:he.Default,message:pe,fullWidth:!0}),c&&e(ue,{status:he.Warning,message:c,fullWidth:!0,smallIcon:!0})]})});const p=a.sources??[],h=a.namespaces??[],g=a.languages??[],m=[];p.length&&m.push({kind:"sources",node:e(Ir,{title:ge,count:p.length,children:p.map((t,a)=>{const r=[t.namespace,t.kind,t.name].filter(Boolean),l=r.length?r.join(" / "):ve;return e(me,{label:l},`src-${a}-${l}`)})})}),h.length&&m.push({kind:"namespaces",node:e(Ir,{title:fe,count:h.length,children:h.map((t,a)=>e(me,{label:t},`ns-${a}-${t}`))})}),g.length&&m.push({kind:"languages",node:e(Ir,{title:be,count:g.length,children:g.map((t,a)=>{const r=$e(t);return e(me,{label:Or(t),leftIcon:r},`lang-${a}-${t}`)})})});const v=n??(m.length>1?ye:void 0);return e(K,{bgTint:s,richTitle:{icon:o,title:d,subTitle:v,alignItems:v||o?"flex-start":void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(K,{bgTint:"800",children:e(kr,{children:m.map((a,r)=>t(i.Fragment,{children:[r>0&&e(Nr,{}),a.node]},a.kind))})})})},Vr=(e,t="all")=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":t,zr=({scopes:r,onChange:l,sourceOptions:n=[],namespaceOptions:i=[],supportedLanguages:s,titleNumber:u,title:h,subTitle:g,icon:m,dataIdPrefix:v="source-scope",slim:f,disabled:b,hideLogicNote:y,hideEntireClusterNote:x,entireClusterWarningMessage:$,defaultScopeTab:C="all"})=>{const k=r??pa(),[w,S]=d(()=>Vr(k,C)),{sources:T,namespaces:M,languages:A}=k,P=T.length>0||M.length>0||A.length>0;p(()=>{P&&"all"===w&&S(Vr(k,C))},[C,P,w,k]);const L=o(()=>Pr.map(e=>"language"===e.value&&0===s?.length?null:{...e,disabled:"all"===e.value&&P}).filter(Boolean),[P]),R=o(()=>T.map(e=>`${e.namespace}/${e.kind}/${e.name}`),[T]),V=o(()=>[...M],[M]),z=o(()=>new Set(A),[A]),D=c(e=>{S(e)},[]),X=c(e=>{const t=e.map(e=>(e=>{const t=e.split("/");return 3!==t.length?null:{namespace:t[0],kind:t[1],name:t[2]}})(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));l({...k,sources:t})},[k,l]),_=c(e=>{l({...k,namespaces:e})},[k,l]),H=c(e=>{const t=k.languages,a=t.includes(e)?t.filter(t=>t!==e):[...t,e];l({...k,languages:a})},[k,l]),B=!P&&"all"===w,j=(s||Ar).map(e=>({id:e,label:Mr[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:$e(e)})),q=h??Lr(u),U=g??ke;return e(Ce,{richTitle:f?{icon:m,title:q,titleSize:N.XS,titleColor:I.Secondary,tooltip:U,alignItems:m?"flex-start":void 0}:{icon:m,title:q,subTitle:U,subTitleWrap:!0,alignItems:m||U?"flex-start":void 0},backgroundColor:f?"transparent":void 0,padding:f?0:void 0,children:t(O,{$gap:16,children:[B?t(a,{children:[!x&&e(ue,{status:he.Default,message:pe,fullWidth:!0,smallIcon:!0}),$&&e(ue,{status:he.Warning,message:$,fullWidth:!0,smallIcon:!0})]}):!y&&e(ue,{status:he.Info,message:ye,fullWidth:!0,smallIcon:!0}),e(O,{$alignItems:"flex-start",children:e(we,{options:L,selected:w,setSelected:D,disabled:b})}),"source"===w&&e(Se,{multiple:!0,"data-id":`${v}-autocomplete-source`,options:n,value:R,onSelect:X,placeholder:Te,disabled:b}),"namespace"===w&&e(Se,{multiple:!0,"data-id":`${v}-autocomplete-namespace`,options:i,value:V,onSelect:_,placeholder:"Search namespace",disabled:b}),"language"===w&&j.length>0&&e(xr,{children:j.map(({id:a,label:r,Icon:l})=>{const n=z.has(a);return t($r,{$selected:n,onClick:()=>H(a),children:[e(re,{name:`${v}-lang-${a}`,size:Me.S,value:n,onChange:()=>H(a),disabled:b}),e(Cr,{children:e(l,{size:20})}),e(E,{size:N.XS,nowrap:!0,children:r})]},a)})})]})})},Dr=e=>{if(null!=e){if(!Array.isArray(e)&&"object"==typeof e)return Object.entries(e).map(([e,t])=>({id:e,label:null==t?e:String(t)}));if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)}},Xr=e=>{if(!Array.isArray(e)||e.length<3)return;const[t,a,r]=e;return e=>{const l=null==e?.[t]?"":String(e[t]);switch(a){case"=":case"==":case"===":return l===r;case"!=":case"!==":return l!==r;default:return!0}}},_r=e=>{if(Array.isArray(e))return e.map(e=>{const t=e;return{keyName:String(t.keyName??t.name??""),label:t.label??t.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,componentType:t.componentType,options:Dr(t.options??t.values),fullRow:t.fullRow,defaultValue:t.defaultValue,withRegexTester:t.withRegexTester,separator:t.separator,copyByColumn:t.copyByColumn,renderCondition:Xr(t.renderCondition)}})},Hr=e=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return{id:e,label:e};const t=e;return{id:String(t.id??t.keyName??t.name??""),label:t.label??t.displayName??String(t.id??""),tooltip:t.tooltip,fields:Array.isArray(t.fields)?t.fields.map(Br):void 0}})},Br=e=>{const t="string"==typeof e.componentProperties?oe(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,inputType:e.inputType??t.inputType??t.type,title:e.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,required:t.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:Dr(t.options??t.values),itemWrapperKey:t.itemWrapperKey,columns:_r(t.columns),limitFieldsPerRow:t.limitFieldsPerRow,variant:t.variant,wrapKey:t.wrapKey,checkboxOptions:Hr(t.options??t.values),checkedValue:t.checkedValue??"true",valueMode:t.valueMode??"object",fields:Array.isArray(t.fields)?t.fields.map(Br):void 0,addLabel:t.addLabel,itemLabel:t.itemLabel,keyLabel:t.titleKey??t.keyLabel,valueLabel:t.titleValue??t.valueLabel,persistAs:t.persistAs}},jr=e=>{const t=e.initialValue;if(void 0!==t&&""!==t)return e.componentType===Z.CheckboxList?"array"===e.valueMode?oe(t,[]):oe(t,{}):e.componentType!==Z.MultiInput&&e.componentType!==Z.MultiTabledInput||!e.wrapKey?e.componentType===Z.MultiInput||e.componentType===Z.MultiTabledInput?oe(t,[]):e.componentType===Z.SourceScopes?"null"===t||"{}"===t?pa():ga(oe(t,null)):e.componentType===Z.Toggle||e.componentType===Z.Checkbox?"true"===t:t:{[e.wrapKey]:oe(t,[])}},qr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Ur=e=>Array.isArray(e)?e:[],Gr=e=>{const t={};return e.forEach(e=>{t[String(e.key??"")]=String(e.value??"")}),t},Kr=e=>qr(e)?Object.entries(e).map(([e,t])=>({key:e,value:String(t??"")})):[],Wr=({field:t,value:a,setValue:r,errorMessage:l,disabled:n})=>{const[i,o]=d(()=>Kr(a));return p(()=>{const e=qr(a)?a:{};((e,t)=>{const a=Object.keys(e),r=Object.keys(t);return a.length===r.length&&a.every(a=>Object.prototype.hasOwnProperty.call(t,a)&&t[a]===e[a])})(Gr(i),e)||o(Kr(a))},[a]),e(ie,{name:t.name,label:t.title,tooltip:t.tooltip,helpMessage:t.helpMessage,required:t.required,disabled:n,limitFieldsPerRow:2,columns:[{keyName:"key",label:t.keyLabel||"Key",placeholder:t.keyLabel||"Key"},{keyName:"value",label:t.valueLabel||"Value",placeholder:t.valueLabel||"Value"}],values:i,setValues:e=>{o(e),r(Gr(e))},errorMessage:l})},Fr=({field:r,value:l,setValue:n,errorMessage:i,disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:u})=>{const{name:p,componentType:h,inputType:g,title:m,tooltip:v,placeholder:f,helpMessage:b,required:y,initialValue:x,options:$,itemWrapperKey:C,columns:k,limitFieldsPerRow:w,variant:S,wrapKey:T,checkboxOptions:M}=r,[A,P]=d({open:!1,value:""});if(h===Z.SourceScopes)return e(Er,{scopes:ga(l),onChange:e=>n(e),sourceOptions:c,namespaceOptions:u,dataIdPrefix:`dynamic-field-${p}`,slim:!0});if(h===Z.CheckboxList&&"array"===r.valueMode){const a=Ur(l),r=(e,t)=>n(t?[...a.filter(t=>t!==e),e]:a.filter(t=>t!==e));return t(O,{$gap:12,children:[m&&e(L,{label:m,tooltip:v,required:y}),e(O,{$gap:8,children:(M||[]).map(t=>{const l=e(re,{name:t.id,label:t.label,value:a.includes(t.id),disabled:o,onChange:e=>r(t.id,e)},t.id);return t.tooltip?e(Ie,{text:t.tooltip,withIcon:!0,children:l},t.id):l})}),e(X,{errorMessage:i,helpMessage:b})]})}if(h===Z.CheckboxList){const a=qr(l)?l:{},c=(e=>"emptyObject"!==e.checkedValue||{})(r),d=e=>"emptyObject"===r.checkedValue?qr(e):!!e;return t(O,{$gap:12,children:[m&&e(E,{size:N.XS,color:I.Secondary,nowrap:!0,children:m}),e(O,{$gap:12,children:(M||[]).map(r=>{const l=a[r.id],i=d(l),u=qr(l)?l:{},h=e(re,{label:r.label,value:i,disabled:o,onChange:e=>n({...a,[r.id]:e?qr(l)?l:c:null})}),g=r.tooltip?e(Ie,{text:r.tooltip,withIcon:!0,children:h}):h,m=i&&r.fields?.length?e(O,{$gap:12,$padding:"0 0 0 24px",children:r.fields.map(t=>e(Fr,{field:t,value:u[t.name],setValue:e=>n({...a,[r.id]:{...u,[t.name]:e}}),disabled:o,keyValuePersistAs:s},`${p}-${r.id}-${t.name}`))}):null;return t(O,{$gap:12,children:[g,m]},r.id)})}),e(X,{errorMessage:i,helpMessage:b})]})}if(h===Z.MultiTabledInput){const r=Ur(T?l?.[T]:l),s=e=>n(T?{...qr(l)?l:{},[T]:e}:e),c=(k||[]).some(e=>e.withRegexTester);return t(a,{children:[e("cards"===S?Ne:ie,{name:p,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,columns:k||[],limitFieldsPerRow:w,values:r,setValues:s,errorMessage:i,onTestRegex:c?e=>P({open:!0,value:e}):void 0}),c&&e(Ba,{isOpen:A.open,regex:A.value,onClose:()=>P({open:!1,value:""})})]})}if(h===Z.MultiInput&&T){const t=Ur(l?.[T]);return e(se,{name:p,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n({...qr(l)?l:{},[T]:e}),errorMessage:i})}if(h===Z.MultiInput&&C){const t=Ur(l).map(e=>String(e?.[C]??""));return e(se,{name:p,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n(e.map(e=>({[C]:e}))),errorMessage:i})}return h===Z.KeyValuePair?"map"===(r.persistAs??s)?e(Wr,{field:r,value:l,setValue:n,errorMessage:i,disabled:o}):e(yr,{componentType:h,name:p,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,errorMessage:i,keyLabel:r.keyLabel,valueLabel:r.valueLabel,value:l??[],setValue:n}):e(yr,{componentType:h,inputType:g,name:p,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,placeholder:f,errorMessage:i,dropdownOptions:$,value:(null==l?x:l)??"",setValue:n})},Yr=({field:r,value:l,setValue:i,disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:d})=>{const u=n(),p=Ur(l),g=p.length?p:[{}],m=r.fields||[],v=e=>i(e);return t(a,{children:[g.map((a,l)=>t(h,{children:[e(Ee,{}),t(O,{$gap:12,children:[t(R,{$justifyContent:"space-between",$alignItems:"center",children:[e(L,{label:`${r.itemLabel||r.title||"Item"} ${l+1}`}),e(V,{leftIcon:()=>e(Yt,{fill:u.v2.colors.red[500]}),variant:D.Secondary,size:z.S,onClick:()=>(e=>{const t=g.filter((t,a)=>a!==e);v(t)})(l),disabled:o||1===g.length})]}),m.map(t=>e(Fr,{field:t,value:a[t.name],setValue:e=>((e,t,a)=>v(g.map((r,l)=>l===e?{...r,[t]:a}:r)))(l,t.name,e),disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:d},`${r.name}-group-${l}-${t.name}`))]})]},`${r.name}-group-${l}`)),e(V,{variant:D.Secondary,label:r.addLabel||"Add",leftIcon:Jt,onClick:()=>v([...g,{}]),disabled:o}),e(Ee,{})]})},Jr=({field:a,value:r,setValue:l,errorMessage:n,disabled:i})=>t(O,{$gap:12,children:[a.title&&e(L,{label:a.title,tooltip:a.tooltip,required:a.required}),e(O,{$gap:8,children:(a.checkboxOptions||[]).map(t=>{const a=e(re,{name:t.id,label:t.label,value:!0===r?.[t.id],disabled:i,onChange:e=>l(t.id,e)},t.id);return t.tooltip?e(Ie,{text:t.tooltip,withIcon:!0,children:a},t.id):a})}),e(X,{errorMessage:n,helpMessage:a.helpMessage})]}),Zr=({signals:t,fields:r,value:l,setValue:n,formErrors:i,disabled:o,seedInitialValues:s,keyValuePersistAs:c="map",sourceOptions:d,namespaceOptions:u})=>{const{isK8s:h}=ha(),g=(r||[]).filter(e=>!!e).map(e=>Br(e));return p(()=>{if(!s)return;const e=l||{},t={};g.forEach(a=>{if(a.componentType===Z.SourceScopes&&!h)return;const r=a.componentType===Z.SourceScopes?jr(a)??pa():jr(a);if(void 0===r)return;if(a.componentType===Z.CheckboxList&&"flatFields"===a.valueMode&&qr(r))return void Object.entries(r).forEach(([a,r])=>{void 0!==e[a]&&null!==e[a]||(t[a]=r)});const l=e[a.name];if(a.componentType===Z.SourceScopes){if(void 0!==l)return}else if(null!=l)return;t[a.name]=qr(r)&&qr(t[a.name])?{...t[a.name],...r}:r}),Object.entries(t).forEach(([e,t])=>n(e,t))},[]),e(a,{children:g.map((a,r)=>{const s=Object.entries(l||{}).map(([e,t])=>({name:e,key:e,value:t}));if(a.renderCondition&&!Le(a.renderCondition,t,s))return null;if(a.componentType===Z.SourceScopes&&!h)return null;const p=l?.[a.name],g=`${a.name}-${r}`;if(a.componentType===Z.FieldGroup)return e(Yr,{field:a,value:p,setValue:e=>n(a.name,e),disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},g);if(a.componentType===Z.CheckboxList&&"flatFields"===a.valueMode){const t=a.checkboxOptions?.map(e=>i[e.id]).find(Boolean);return e(Jr,{field:a,value:l||{},setValue:n,errorMessage:t,disabled:o},g)}return e(Fr,{field:a,value:p,setValue:e=>n(a.name,e),errorMessage:i[a.name],disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},g)})})},Qr=Zr,el=({isEnabled:t,setIsEnabled:a,fieldDisabled:r})=>{const l=n();return e(we,{options:[{icon:Zt,label:"Enable",value:!0,selectedBgColor:l.v2.colors.green[1e3],selectedBorderColor:l.v2.colors.green[400],selectedTextColor:l.v2.colors.green[400]},{icon:Qt,label:"Disable",value:!1,selectedBgColor:l.v2.colors.red[1e3],selectedBorderColor:l.v2.colors.red[500],selectedTextColor:l.v2.colors.red[400]}],size:Re.S,selected:t,setSelected:a,disabled:r})},tl=r.div`
220
220
  display: flex;
221
221
  align-items: center;
222
222
  gap: 24px;
@@ -228,7 +228,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
228
228
  min-width: 0;
229
229
  white-space: pre;
230
230
  overflow-x: auto;
231
- `,rl=({title:a,summary:r,onEdit:l,renderAction:n})=>{const i=o(()=>{const e=[];return a&&(e.push({text:a,variant:ma.Default}),e.push({text:" - ",variant:ma.Default})),e.push(...r),e},[a,r]);return t(tl,{children:[e(al,{children:e(va,{parts:i})}),n&&n(),l&&e(V,{"data-id":"sampling-btn-edit-auto-rule",label:Ve,rightIcon:ea,variant:D.Text,size:z.S,onClick:l})]})},ll={[qe.HttpRequest]:"HTTP request",[qe.HttpResponse]:"HTTP response",[qe.DbQuery]:"DB query",[qe.Messaging]:"messaging"};function nl(e,t,a){return 1===e?t:a??`${t}s`}function il(e,t){const a=[],r=e.slice(0,3),l=e.slice(3);return r.forEach((e,r)=>{r>0&&a.push({text:", ",variant:ma.Default}),a.push({text:e,variant:t})}),l.length>0&&a.push({text:` + ${l.length} more`,variant:ma.Default,tooltipItems:l}),a}const ol=({option:t,formState:a,renderAction:r})=>{const l=o(()=>{const e=function(e,t){switch(e){case De.CodeAttributes:return(e=>{const t=Object.values(Ue).filter(t=>!!e.codeAttributes?.[t]).map(e=>Ge(e).toLowerCase());return t.length?[{text:"Collect",variant:ma.Action},{text:" ",variant:ma.Default},...il(t,ma.Endpoint)]:null})(t);case De.PayloadCollection:return(e=>{const t=Object.values(qe).filter(t=>null!=e.payloadCollection?.[t]).map(e=>ll[e]);return t.length?[{text:"Collect",variant:ma.Action},{text:" ",variant:ma.Default},...il(t,ma.Endpoint)]:null})(t);case De.HeadersCollection:return(e=>{const t=(e.headersCollection?.[je.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!t.length)return null;const a=nl(t.length,"HTTP header");return[{text:`Collect ${t.length} ${a}`,variant:ma.Action},{text:"",variant:ma.Default,tooltipItems:t}]})(t);case De.CustomInstrumentation:return(e=>{const t=(e.customInstrumentations?.[Xe.Java]??[]).map(e=>new _e(e.className,e.methodName)).filter(e=>e.Verify()),a=(e.customInstrumentations?.[Xe.Golang]??[]).map(e=>new He(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify()),r=(e.customInstrumentations?.[Xe.Php]??[]).map(e=>new Be(e.className,e.functionName)).filter(e=>e.Verify());if(!(t.length+a.length+r.length))return null;const l=[];t.length&&l.push(`${t.length} Java ${nl(t.length,"probe")}`),a.length&&l.push(`${a.length} Go ${nl(a.length,"probe")}`),r.length&&l.push(`${r.length} PHP ${nl(r.length,"probe")}`);const n=[...t.map(e=>`Java: ${e.toString()}`),...a.map(e=>`Go: ${e.toString()}`),...r.map(e=>`PHP: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:ma.Action},{text:"",variant:ma.Default,tooltipItems:n}]})(t);case De.NetworkMetrics:return[{text:"Collect",variant:ma.Action},{text:" ",variant:ma.Default},{text:"network flow and TCP stats metrics",variant:ma.Endpoint}];default:return null}}(t?.type,a);return e?[...e,...fa(a.sourceScopes)]:[]},[t?.type,a]),n=0===l.length;return e(rl,{title:n?ze:"Instrumentation Rule Preview",summary:l,renderAction:r})},sl=({size:t=200,central:a=!1,useInline:r=!1})=>{const{tier:l}=ha();if(r){if(a)return e(ta,{size:t});switch(l){case Ke.Community:return e(ra,{size:t});case Ke.Onprem:return e(aa,{size:t});default:return null}}if(a)return e(la,{size:t});switch(l){case Ke.Community:return e(ia,{size:t});case Ke.Onprem:return e(na,{size:t});default:return null}},cl=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],dl=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],pl=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],ul=({description:a,options:r,selected:l,onSelect:n,customName:i,customLabel:o,customPlaceholder:s,customValue:c,onCustomChange:d,customInputType:p=de.Number,customMin:u,customMax:h})=>t(O,{$gap:6,children:[e(L,{label:a}),t(R,{$gap:8,$alignItems:"flex-end",children:[e(we,{options:r,selected:l,setSelected:n}),"custom"===l&&e(ce,{name:i,label:o,placeholder:s,type:p,value:c,onChange:d,width:160,min:u,max:h})]})]}),hl=()=>{},gl=t=>t.readOnly?e(ml,{rule:t.rule}):e(vl,{ruleType:t.ruleType,formState:t.formState,onChange:t.onChange}),ml=({rule:a})=>{const r=null!=a.durationAtLeastMs;return a.error?e(Ce,{richTitle:{title:Fe},children:e(Q,{name:"sampling-view-toggle-keep-errors",onChange:hl,value:!0,size:te.S,label:We,labelAlign:ee.Right})}):r?e(Ce,{richTitle:{title:Ye},children:t("div",{children:[e(E,{size:N.XXXS,color:I.Secondary,children:Je}),e(E,{size:N.XS,children:`${a.durationAtLeastMs}ms`})]})}):null},vl=({ruleType:t,formState:a,onChange:r})=>{const l=c(e=>r({durationPreset:e}),[r]),n=c(e=>r({customDurationMs:e.target.value}),[r]);return"Duration"===t?e(Ce,{richTitle:{title:Ye,subTitle:Ze},children:e(ul,{description:Je,options:pl,selected:a.durationPreset,onSelect:l,customName:"sampling-input-custom-duration",customLabel:Qe,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:n})}):null},fl=r.div`
231
+ `,rl=({title:a,summary:r,onEdit:l,renderAction:n})=>{const i=o(()=>{const e=[];return a&&(e.push({text:a,variant:ma.Default}),e.push({text:" - ",variant:ma.Default})),e.push(...r),e},[a,r]);return t(tl,{children:[e(al,{children:e(va,{parts:i})}),n&&n(),l&&e(V,{"data-id":"sampling-btn-edit-auto-rule",label:Ve,rightIcon:ea,variant:D.Text,size:z.S,onClick:l})]})},ll={[qe.HttpRequest]:"HTTP request",[qe.HttpResponse]:"HTTP response",[qe.DbQuery]:"DB query",[qe.Messaging]:"messaging"};function nl(e,t,a){return 1===e?t:a??`${t}s`}function il(e,t){const a=[],r=e.slice(0,3),l=e.slice(3);return r.forEach((e,r)=>{r>0&&a.push({text:", ",variant:ma.Default}),a.push({text:e,variant:t})}),l.length>0&&a.push({text:` + ${l.length} more`,variant:ma.Default,tooltipItems:l}),a}const ol=({option:t,formState:a,renderAction:r})=>{const l=o(()=>{const e=function(e,t){switch(e){case De.CodeAttributes:return(e=>{const t=Object.values(Ue).filter(t=>!!e.codeAttributes?.[t]).map(e=>Ge(e).toLowerCase());return t.length?[{text:"Collect",variant:ma.Action},{text:" ",variant:ma.Default},...il(t,ma.Endpoint)]:null})(t);case De.PayloadCollection:return(e=>{const t=Object.values(qe).filter(t=>null!=e.payloadCollection?.[t]).map(e=>ll[e]);return t.length?[{text:"Collect",variant:ma.Action},{text:" ",variant:ma.Default},...il(t,ma.Endpoint)]:null})(t);case De.HeadersCollection:return(e=>{const t=(e.headersCollection?.[je.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!t.length)return null;const a=nl(t.length,"HTTP header");return[{text:`Collect ${t.length} ${a}`,variant:ma.Action},{text:"",variant:ma.Default,tooltipItems:t}]})(t);case De.CustomInstrumentation:return(e=>{const t=(e.customInstrumentations?.[Xe.Java]??[]).map(e=>new _e(e.className,e.methodName)).filter(e=>e.Verify()),a=(e.customInstrumentations?.[Xe.Golang]??[]).map(e=>new He(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify()),r=(e.customInstrumentations?.[Xe.Php]??[]).map(e=>new Be(e.className,e.functionName)).filter(e=>e.Verify());if(!(t.length+a.length+r.length))return null;const l=[];t.length&&l.push(`${t.length} Java ${nl(t.length,"probe")}`),a.length&&l.push(`${a.length} Go ${nl(a.length,"probe")}`),r.length&&l.push(`${r.length} PHP ${nl(r.length,"probe")}`);const n=[...t.map(e=>`Java: ${e.toString()}`),...a.map(e=>`Go: ${e.toString()}`),...r.map(e=>`PHP: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:ma.Action},{text:"",variant:ma.Default,tooltipItems:n}]})(t);case De.NetworkMetrics:return[{text:"Collect",variant:ma.Action},{text:" ",variant:ma.Default},{text:"network flow and TCP stats metrics",variant:ma.Endpoint}];default:return null}}(t?.type,a);return e?[...e,...fa(a.sourceScopes)]:[]},[t?.type,a]),n=0===l.length;return e(rl,{title:n?ze:"Instrumentation Rule Preview",summary:l,renderAction:r})},sl=({size:t=200,central:a=!1,useInline:r=!1})=>{const{tier:l}=ha();if(r){if(a)return e(ta,{size:t});switch(l){case Ke.Community:return e(ra,{size:t});case Ke.Onprem:return e(aa,{size:t});default:return null}}if(a)return e(la,{size:t});switch(l){case Ke.Community:return e(ia,{size:t});case Ke.Onprem:return e(na,{size:t});default:return null}},cl=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],dl=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],ul=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],pl=({description:a,options:r,selected:l,onSelect:n,customName:i,customLabel:o,customPlaceholder:s,customValue:c,onCustomChange:d,customInputType:u=de.Number,customMin:p,customMax:h})=>t(O,{$gap:6,children:[e(L,{label:a}),t(R,{$gap:8,$alignItems:"flex-end",children:[e(we,{options:r,selected:l,setSelected:n}),"custom"===l&&e(ce,{name:i,label:o,placeholder:s,type:u,value:c,onChange:d,width:160,min:p,max:h})]})]}),hl=()=>{},gl=t=>t.readOnly?e(ml,{rule:t.rule}):e(vl,{ruleType:t.ruleType,formState:t.formState,onChange:t.onChange}),ml=({rule:a})=>{const r=null!=a.durationAtLeastMs;return a.error?e(Ce,{richTitle:{title:We},children:e(Q,{name:"sampling-view-toggle-keep-errors",onChange:hl,value:!0,size:te.S,label:Fe,labelAlign:ee.Right})}):r?e(Ce,{richTitle:{title:Ye},children:t("div",{children:[e(E,{size:N.XXXS,color:I.Secondary,children:Je}),e(E,{size:N.XS,children:`${a.durationAtLeastMs}ms`})]})}):null},vl=({ruleType:t,formState:a,onChange:r})=>{const l=c(e=>r({durationPreset:e}),[r]),n=c(e=>r({customDurationMs:e.target.value}),[r]);return"Duration"===t?e(Ce,{richTitle:{title:Ye,subTitle:Ze},children:e(pl,{description:Je,options:ul,selected:a.durationPreset,onSelect:l,customName:"sampling-input-custom-duration",customLabel:Qe,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:n})}):null},fl=r.div`
232
232
  display: flex;
233
233
  gap: 32px;
234
234
  `,bl=r.div`
@@ -261,7 +261,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
261
261
  align-items: flex-end;
262
262
  gap: 16px;
263
263
  margin-bottom: 12px;
264
- `,wl="Any",Sl="Kafka topic",Tl=()=>e("div",{style:{marginBottom:"8px"},children:e(E,{size:N.XS,weight:500,children:"And"})}),Ml=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Al=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],Pl=[{id:"",label:wl},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Ol=t=>t.readOnly?e(Ll,{data:t.data}):e(El,{category:t.category,formState:t.formState,onChange:t.onChange}),Ll=({data:a})=>{const r=o(()=>(e=>{if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:gt,value:ht},{id:"route",title:ot,value:t.httpServer.route||t.httpServer.routePrefix||mt},{id:"method",title:pt,value:t.httpServer.method||wl}];if(t?.httpClient){const e=[{id:"type",title:gt,value:vt}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:ot,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||mt}),e.push({id:"method",title:pt,value:t.httpClient.method||wl}),e}return[{id:"type",title:gt,value:ft}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:gt,value:ht},{id:"route",title:ot,value:t.httpServer.route||t.httpServer.routePrefix||mt},{id:"method",title:pt,value:t.httpServer.method||wl}]:t?.kafkaConsumer?[{id:"type",title:gt,value:bt},{id:"topic",title:Sl,value:t.kafkaConsumer.kafkaTopic||mt}]:t?.kafkaProducer?[{id:"type",title:gt,value:yt},{id:"topic",title:Sl,value:t.kafkaProducer.kafkaTopic||mt}]:[{id:"type",title:gt,value:ft}]})(a),[a]);return e(Ce,{richTitle:{title:et},children:e(fl,{children:r.map(({id:a,title:r,value:l})=>t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))})})},El=({category:a,formState:r,onChange:l})=>{const n=o(()=>"noisy"===a?Ml:Al,[a]),i=c(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),s=c(e=>t=>{t&&l({routeType:e,route:""})},[l]),d=c(e=>l({route:e.target.value}),[l]),p=c(e=>l({serverAddress:e.target.value}),[l]),u=c(e=>l({method:e[0]||""}),[l]),h=c(e=>l({kafkaTopic:e.target.value}),[l]),g="httpServer"===r.operationType||"httpClient"===r.operationType,m="kafkaConsumer"===r.operationType||"kafkaProducer"===r.operationType,v="httpClient"===r.operationType?it:ot,f="httpClient"===r.operationType?st:ct;return t(Ce,{richTitle:{title:`2. ${et}`,subTitle:tt},children:[e(O,{$alignItems:"flex-start",children:e(we,{options:n,selected:r.operationType,setSelected:i})}),g&&t(yl,{children:["httpClient"===r.operationType&&t(kl,{children:[e(ce,{name:"sampling-input-server-address",label:rt,placeholder:at,value:r.serverAddress,onChange:p}),e(Tl,{})]}),t(xl,{children:[t($l,{children:[e(Cl,{children:e(lt,{"data-id":"sampling-radio-route",value:"route"===r.routeType,onChange:s("route")})}),e(ce,{name:"sampling-input-route",label:v,placeholder:nt,value:"route"===r.routeType?r.route:"",onChange:d,disabled:"route"!==r.routeType})]}),t($l,{children:[e(Cl,{children:e(lt,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===r.routeType,onChange:s("routePrefix")})}),e(ce,{name:"sampling-input-route-prefix",label:f,placeholder:nt,value:"routePrefix"===r.routeType?r.route:"",onChange:d,disabled:"routePrefix"!==r.routeType})]})]}),t(kl,{children:[e(Tl,{}),e(dt,{label:pt,items:Pl,selectedIds:[r.method||""],setSelectedIds:e=>u(e),buttonProps:{"data-id":"sampling-btn-method",label:Pl.find(e=>e.id===r.method)?.label||wl,size:z.S,variant:D.Secondary}})]})]}),m&&e(ce,{name:"sampling-input-kafka-topic",label:ut,placeholder:"Type kafka topic",value:r.kafkaTopic,onChange:h,width:"320px"})]})},Il=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Nl=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}],Rl=t=>t.readOnly?e(Vl,{data:t.data}):e(zl,{category:t.category,formState:t.formState,onChange:t.onChange}),Vl=({data:a})=>{const r=o(()=>(e=>{switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:$t,method:wt,description:Ct,value:`${e.rule.percentageAtLeast}%`}:{title:$t,method:Tt,description:null,value:null};case"noisy":return ba(e.rule.percentageAtMost)?{title:$t,method:St,description:null,value:null}:{title:$t,method:wt,description:kt,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:$t,method:wt,description:kt,value:`${e.rule.percentageAtMost}%`}}})(a),[a]),l=[{id:"method",title:pt,value:r.method},...null!=r.description?[{id:"value",title:r.description,value:r.value}]:[]];return e(Ce,{richTitle:{title:r.title},children:e(fl,{children:l.map(({id:a,title:r,value:l})=>t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))})})},zl=({category:a,formState:r,onChange:l})=>{const n="highlyRelevant"===a,i=n?Nl:Il,o=`${n?4:3}. ${$t}`,s=xt[a],d=n?Ct:kt,p="noisy"===a?dl:cl,u=c(e=>l({percentageMode:e}),[l]),h=c(e=>l({percentagePreset:e}),[l]),g=c(e=>l({customPercentage:e.target.value}),[l]);return t(Ce,{richTitle:{title:o,subTitle:s},children:["costReduction"!==a&&e(O,{$alignItems:"flex-start",children:e(we,{options:i,selected:r.percentageMode,setSelected:u})}),("costReduction"===a||"sample"===r.percentageMode)&&e(ul,{description:d,options:p,selected:r.percentagePreset,onSelect:h,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:r.customPercentage,onCustomChange:g,customInputType:de.Decimal,customMin:0,customMax:100})]})},Dl=r.div`
264
+ `,wl="Any",Sl="Kafka topic",Tl=()=>e("div",{style:{marginBottom:"8px"},children:e(E,{size:N.XS,weight:500,children:"And"})}),Ml=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Al=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],Pl=[{id:"",label:wl},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Ol=t=>t.readOnly?e(Ll,{data:t.data}):e(El,{category:t.category,formState:t.formState,onChange:t.onChange}),Ll=({data:a})=>{const r=o(()=>(e=>{if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:gt,value:ht},{id:"route",title:ot,value:t.httpServer.route||t.httpServer.routePrefix||mt},{id:"method",title:ut,value:t.httpServer.method||wl}];if(t?.httpClient){const e=[{id:"type",title:gt,value:vt}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:ot,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||mt}),e.push({id:"method",title:ut,value:t.httpClient.method||wl}),e}return[{id:"type",title:gt,value:ft}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:gt,value:ht},{id:"route",title:ot,value:t.httpServer.route||t.httpServer.routePrefix||mt},{id:"method",title:ut,value:t.httpServer.method||wl}]:t?.kafkaConsumer?[{id:"type",title:gt,value:bt},{id:"topic",title:Sl,value:t.kafkaConsumer.kafkaTopic||mt}]:t?.kafkaProducer?[{id:"type",title:gt,value:yt},{id:"topic",title:Sl,value:t.kafkaProducer.kafkaTopic||mt}]:[{id:"type",title:gt,value:ft}]})(a),[a]);return e(Ce,{richTitle:{title:et},children:e(fl,{children:r.map(({id:a,title:r,value:l})=>t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))})})},El=({category:a,formState:r,onChange:l})=>{const n=o(()=>"noisy"===a?Ml:Al,[a]),i=c(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),s=c(e=>t=>{t&&l({routeType:e,route:""})},[l]),d=c(e=>l({route:e.target.value}),[l]),u=c(e=>l({serverAddress:e.target.value}),[l]),p=c(e=>l({method:e[0]||""}),[l]),h=c(e=>l({kafkaTopic:e.target.value}),[l]),g="httpServer"===r.operationType||"httpClient"===r.operationType,m="kafkaConsumer"===r.operationType||"kafkaProducer"===r.operationType,v="httpClient"===r.operationType?it:ot,f="httpClient"===r.operationType?st:ct;return t(Ce,{richTitle:{title:`2. ${et}`,subTitle:tt},children:[e(O,{$alignItems:"flex-start",children:e(we,{options:n,selected:r.operationType,setSelected:i})}),g&&t(yl,{children:["httpClient"===r.operationType&&t(kl,{children:[e(ce,{name:"sampling-input-server-address",label:rt,placeholder:at,value:r.serverAddress,onChange:u}),e(Tl,{})]}),t(xl,{children:[t($l,{children:[e(Cl,{children:e(lt,{"data-id":"sampling-radio-route",value:"route"===r.routeType,onChange:s("route")})}),e(ce,{name:"sampling-input-route",label:v,placeholder:nt,value:"route"===r.routeType?r.route:"",onChange:d,disabled:"route"!==r.routeType})]}),t($l,{children:[e(Cl,{children:e(lt,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===r.routeType,onChange:s("routePrefix")})}),e(ce,{name:"sampling-input-route-prefix",label:f,placeholder:nt,value:"routePrefix"===r.routeType?r.route:"",onChange:d,disabled:"routePrefix"!==r.routeType})]})]}),t(kl,{children:[e(Tl,{}),e(dt,{label:ut,items:Pl,selectedIds:[r.method||""],setSelectedIds:e=>p(e),buttonProps:{"data-id":"sampling-btn-method",label:Pl.find(e=>e.id===r.method)?.label||wl,size:z.S,variant:D.Secondary}})]})]}),m&&e(ce,{name:"sampling-input-kafka-topic",label:pt,placeholder:"Type kafka topic",value:r.kafkaTopic,onChange:h,width:"320px"})]})},Il=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Nl=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}],Rl=t=>t.readOnly?e(Vl,{data:t.data}):e(zl,{category:t.category,formState:t.formState,onChange:t.onChange}),Vl=({data:a})=>{const r=o(()=>(e=>{switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:$t,method:wt,description:Ct,value:`${e.rule.percentageAtLeast}%`}:{title:$t,method:Tt,description:null,value:null};case"noisy":return ba(e.rule.percentageAtMost)?{title:$t,method:St,description:null,value:null}:{title:$t,method:wt,description:kt,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:$t,method:wt,description:kt,value:`${e.rule.percentageAtMost}%`}}})(a),[a]),l=[{id:"method",title:ut,value:r.method},...null!=r.description?[{id:"value",title:r.description,value:r.value}]:[]];return e(Ce,{richTitle:{title:r.title},children:e(fl,{children:l.map(({id:a,title:r,value:l})=>t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))})})},zl=({category:a,formState:r,onChange:l})=>{const n="highlyRelevant"===a,i=n?Nl:Il,o=`${n?4:3}. ${$t}`,s=xt[a],d=n?Ct:kt,u="noisy"===a?dl:cl,p=c(e=>l({percentageMode:e}),[l]),h=c(e=>l({percentagePreset:e}),[l]),g=c(e=>l({customPercentage:e.target.value}),[l]);return t(Ce,{richTitle:{title:o,subTitle:s},children:["costReduction"!==a&&e(O,{$alignItems:"flex-start",children:e(we,{options:i,selected:r.percentageMode,setSelected:p})}),("costReduction"===a||"sample"===r.percentageMode)&&e(pl,{description:d,options:u,selected:r.percentagePreset,onSelect:h,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:r.customPercentage,onCustomChange:g,customInputType:de.Decimal,customMin:0,customMax:100})]})},Dl=r.div`
265
265
  display: flex;
266
266
  align-items: flex-end;
267
267
  gap: 16px;
@@ -271,7 +271,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
271
271
  `,_l=r.div`
272
272
  flex: 1;
273
273
  min-width: 0;
274
- `;function Hl(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Nt[e.category]}const Bl=t=>t.readOnly?e(jl,{data:t.data}):e(ql,{formState:t.formState,onChange:t.onChange}),jl=({data:a})=>{const r=o(()=>[{id:"name",title:At,value:a.rule.name||Mt},{id:"type",title:Pt,value:Hl(a)}],[a]),l=a.rule.notes||mt;return t(Ce,{children:[e(fl,{children:r.map(({id:a,title:r,value:l})=>t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))}),t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,children:Ot}),e(E,{size:N.XS,children:l})]})]})},ql=({formState:a,onChange:r})=>{const l=c(e=>r({name:e.target.value}),[r]),n=c(e=>r({notes:e.target.value}),[r]);return e(Ce,{children:t(Dl,{children:[e(Xl,{children:e(ce,{name:"sampling-input-rule-name",label:At,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:Lt,value:a.name,onChange:l})}),e(_l,{children:e(ce,{name:"sampling-input-note",label:Ot,tooltip:It,placeholder:Et,value:a.notes,onChange:n})})]})})},Ul=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Gl=({formState:t,onChange:a})=>{const r=c(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return e(Ce,{richTitle:{title:`3. ${Pt}`,subTitle:Rt},children:e(O,{$alignItems:"flex-start",children:e(we,{options:Ul,selected:t.ruleType,setSelected:r})})})},Kl=t=>{const a=o(()=>{if(t.readOnly)return t.summary;switch(t.category){case"noisy":return $a(wa(t.formState));case"highlyRelevant":return xa(ka(t.formState));case"costReduction":return ya(Ca(t.formState))}},[t]);if(t.readOnly)return e(rl,{title:Vt,summary:a,renderAction:t.renderAction});const r=1===a.length&&"default"===a[0].variant;return e(rl,{title:r?ze:Vt,summary:r?[]:a,renderAction:t.renderAction})},Fl=(e,t)=>!t?.length||!!t?.find(t=>t===e),Wl=({title:a="Signals",required:r,errorMessage:l,allowedSignals:n,selectedSignals:i,setSelectedSignals:o,disabled:c})=>{const[p,h]=d(1===i.length),g=s(JSON.stringify(i));return u(()=>{let e=zt(i).filter(e=>Fl(e,n));e.length||(e=Dt.filter(({id:e})=>Fl(e,n)).map(({id:e})=>e));const t=JSON.stringify(e);g.current!==t&&(g.current=t,o(e),h(1===e.length))},[n,i]),t(O,{$gap:12,children:[e(L,{label:a,required:r}),e(R,{$gap:12,children:Dt.map(t=>{const a=Fl(t.id,n),r=((e,t)=>!!t?.find(t=>t===e))(t.id,i);return a?e(re,{label:t.value,disabled:c||!a||p&&r,value:r,onChange:e=>((e,t)=>{const a=e,r=t?[...i,a]:i.filter(e=>e!==a);o(r),h(1===r.length)})(t.id,e)},t.id):null})}),e(X,{errorMessage:l})]})},Yl=({minSupportedVersion:t,currentVersion:a})=>e(B,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>e(J,{scale:2.4,icon:()=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:e("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:Y.UPGRADE_REQUIRED,description:`${Y.UPGRADE_TO_USE_FEATURE(t)}\n${Y.CURRENT_VERSION(a)}`}),Jl=r.div`
274
+ `;function Hl(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Nt[e.category]}const Bl=t=>t.readOnly?e(jl,{data:t.data}):e(ql,{formState:t.formState,onChange:t.onChange}),jl=({data:a})=>{const r=o(()=>[{id:"name",title:At,value:a.rule.name||Mt},{id:"type",title:Pt,value:Hl(a)}],[a]),l=a.rule.notes||mt;return t(Ce,{children:[e(fl,{children:r.map(({id:a,title:r,value:l})=>t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))}),t(bl,{children:[e(E,{size:N.XXXS,color:I.Secondary,children:Ot}),e(E,{size:N.XS,children:l})]})]})},ql=({formState:a,onChange:r})=>{const l=c(e=>r({name:e.target.value}),[r]),n=c(e=>r({notes:e.target.value}),[r]);return e(Ce,{children:t(Dl,{children:[e(Xl,{children:e(ce,{name:"sampling-input-rule-name",label:At,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:Lt,value:a.name,onChange:l})}),e(_l,{children:e(ce,{name:"sampling-input-note",label:Ot,tooltip:It,placeholder:Et,value:a.notes,onChange:n})})]})})},Ul=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Gl=({formState:t,onChange:a})=>{const r=c(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return e(Ce,{richTitle:{title:`3. ${Pt}`,subTitle:Rt},children:e(O,{$alignItems:"flex-start",children:e(we,{options:Ul,selected:t.ruleType,setSelected:r})})})},Kl=t=>{const a=o(()=>{if(t.readOnly)return t.summary;switch(t.category){case"noisy":return $a(wa(t.formState));case"highlyRelevant":return xa(ka(t.formState));case"costReduction":return ya(Ca(t.formState))}},[t]);if(t.readOnly)return e(rl,{title:Vt,summary:a,renderAction:t.renderAction});const r=1===a.length&&"default"===a[0].variant;return e(rl,{title:r?ze:Vt,summary:r?[]:a,renderAction:t.renderAction})},Wl=(e,t)=>!t?.length||!!t?.find(t=>t===e),Fl=({title:a="Signals",required:r,errorMessage:l,allowedSignals:n,selectedSignals:i,setSelectedSignals:o,disabled:c})=>{const[u,h]=d(1===i.length),g=s(JSON.stringify(i));return p(()=>{let e=zt(i).filter(e=>Wl(e,n));e.length||(e=Dt.filter(({id:e})=>Wl(e,n)).map(({id:e})=>e));const t=JSON.stringify(e);g.current!==t&&(g.current=t,o(e),h(1===e.length))},[n,i]),t(O,{$gap:12,children:[e(L,{label:a,required:r}),e(R,{$gap:12,children:Dt.map(t=>{const a=Wl(t.id,n),r=((e,t)=>!!t?.find(t=>t===e))(t.id,i);return a?e(re,{label:t.value,disabled:c||!a||u&&r,value:r,onChange:e=>((e,t)=>{const a=e,r=t?[...i,a]:i.filter(e=>e!==a);o(r),h(1===r.length)})(t.id,e)},t.id):null})}),e(X,{errorMessage:l})]})},Yl=({minSupportedVersion:t,currentVersion:a})=>e(B,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>e(J,{scale:2.4,icon:()=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:e("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:Y.UPGRADE_REQUIRED,description:`${Y.UPGRADE_TO_USE_FEATURE(t)}\n${Y.CURRENT_VERSION(a)}`}),Jl=r.div`
275
275
  display: flex;
276
276
  flex-direction: column;
277
277
  justify-content: flex-end;
@@ -318,7 +318,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
318
318
  padding: 5vh 10vw;
319
319
  border-radius: 12px;
320
320
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
321
- `,sn=g(({isOpen:a,withOverlay:r,disableAnimation:l,onClose:n,onBack:i,onNext:s,nextIsSkip:p,onSave:u,disableSave:h,connectionIds:g,header:v,subHeader:f,leftColumn:b,rightColumn:y,search:x,filters:$,errorMessage:C,isFormDirty:k,allowSaveWhenPristine:w,hideDirtyNote:S,forcedNote:T,isFetching:M,progress:P},O)=>{const[L,E]=d(!1),[I,R]=d(!1),[V,z]=d(void 0);m(O,()=>({clearErrors:()=>z(void 0)}));const X=I,H=c(()=>{k&&!L?E(!0):(E(!1),n?.())},[k,L,n]),j=h||I||!w&&"boolean"==typeof k&&!k,q=c(async()=>{R(!0);const e=await u();R(!1),!1!==e&&(e?.error?z(e.error):(g?.setValue([]),n?.()))},[u,g,n]),U=!!x||!!g||!!$,G=!!f,K=(U?48:0)+(G?50:0),F=o(()=>T||(M?{status:he.Info,message:"Fetching Data..."}:I&&!P?{status:he.Info,message:"Saving Changes..."}:V||C?{status:he.Error,message:V||C}:"boolean"!=typeof k||S?void 0:k?{status:he.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:{status:he.Success,message:"The values reflect the current configuration of the selected cluster."}),[M,I,P,V,C,k,S,T]),W=o(()=>i?{label:"Back",leftIcon:oa,variant:D.Secondary,onClick:i}:{label:"Cancel",variant:D.Secondary,onClick:H,disabled:X},[i,H,X]),[Y,J]=d(!1),Z=o(()=>s?p?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:sa,variant:D.Secondary,onClick:()=>J(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:sa,variant:D.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:D.Primary,onClick:q,disabled:j},[s,p,q,j]);return t(A,{width:tn,isOpen:a,disableAnimation:l,hideOverlay:!I&&!r,header:{...v,onClose:n?H:void 0,onCloseDisabled:X},footer:{note:F,actions:[W,Z]},children:[I?e(_,{$height:"calc(100vh - 136px)",children:e(on,{children:e(_t,{titleSize:N.S,subTitleSize:N.XXXS,withGradient:!0,withSpinner:!0,...P})})}):t(an,{children:[U&&t(rn,{children:[g&&e(Ht,{icon:Zt,title:"Selected Clusters",badge:{label:g.value.length}}),x&&e(Bt,{...x,width:x.width??"100%"}),$]}),G&&e(ln,{children:e(Ht,{icon:f.icon,title:f.title,subTitle:f.description,badge:f.badge})}),t(nn,{children:[e(en,{isLeft:!0,heightOffset:K,...b}),e(en,{isRight:!0,heightOffset:K,...y})]})]}),e(hr,{isOpen:L,onClose:()=>E(!1),onApprove:H}),e(B,{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:Y,onClose:()=>J(!1),denyButton:{label:"Go Back",variant:D.Secondary,onClick:()=>J(!1)},approveButton:{label:"Skip",variant:D.Primary,onClick:()=>{s?.(),J(!1)}}})]})});sn.displayName=sn.name;const cn=r.div`
321
+ `,sn=g(({isOpen:a,withOverlay:r,disableAnimation:l,onClose:n,onBack:i,onNext:s,nextIsSkip:u,onSave:p,disableSave:h,connectionIds:g,header:v,subHeader:f,leftColumn:b,rightColumn:y,search:x,filters:$,errorMessage:C,isFormDirty:k,allowSaveWhenPristine:w,hideDirtyNote:S,forcedNote:T,isFetching:M,progress:P},O)=>{const[L,E]=d(!1),[I,R]=d(!1),[V,z]=d(void 0);m(O,()=>({clearErrors:()=>z(void 0)}));const X=I,H=c(()=>{k&&!L?E(!0):(E(!1),n?.())},[k,L,n]),j=h||I||!w&&"boolean"==typeof k&&!k,q=c(async()=>{R(!0);const e=await p();R(!1),!1!==e&&(e?.error?z(e.error):(g?.setValue([]),n?.()))},[p,g,n]),U=!!x||!!g||!!$,G=!!f,K=(U?48:0)+(G?50:0),W=o(()=>T||(M?{status:he.Info,message:"Fetching Data..."}:I&&!P?{status:he.Info,message:"Saving Changes..."}:V||C?{status:he.Error,message:V||C}:"boolean"!=typeof k||S?void 0:k?{status:he.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:{status:he.Success,message:"The values reflect the current configuration of the selected cluster."}),[M,I,P,V,C,k,S,T]),F=o(()=>i?{label:"Back",leftIcon:oa,variant:D.Secondary,onClick:i}:{label:"Cancel",variant:D.Secondary,onClick:H,disabled:X},[i,H,X]),[Y,J]=d(!1),Z=o(()=>s?u?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:sa,variant:D.Secondary,onClick:()=>J(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:sa,variant:D.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:D.Primary,onClick:q,disabled:j},[s,u,q,j]);return t(A,{width:tn,isOpen:a,disableAnimation:l,hideOverlay:!I&&!r,header:{...v,onClose:n?H:void 0,onCloseDisabled:X},footer:{note:W,actions:[F,Z]},children:[I?e(_,{$height:"calc(100vh - 136px)",children:e(on,{children:e(_t,{titleSize:N.S,subTitleSize:N.XXXS,withGradient:!0,withSpinner:!0,...P})})}):t(an,{children:[U&&t(rn,{children:[g&&e(Ht,{icon:Zt,title:"Selected Clusters",badge:{label:g.value.length}}),x&&e(Bt,{...x,width:x.width??"100%"}),$]}),G&&e(ln,{children:e(Ht,{icon:f.icon,title:f.title,subTitle:f.description,badge:f.badge})}),t(nn,{children:[e(en,{isLeft:!0,heightOffset:K,...b}),e(en,{isRight:!0,heightOffset:K,...y})]})]}),e(hr,{isOpen:L,onClose:()=>E(!1),onApprove:H}),e(B,{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:Y,onClose:()=>J(!1),denyButton:{label:"Go Back",variant:D.Secondary,onClick:()=>J(!1)},approveButton:{label:"Skip",variant:D.Primary,onClick:()=>{s?.(),J(!1)}}})]})});sn.displayName=sn.name;const cn=r.div`
322
322
  padding: 0 24px;
323
323
  border-radius: 12px;
324
324
  background-color: ${({$codeBgColor:e})=>e||"transparent"};
@@ -331,12 +331,12 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
331
331
  border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
332
332
  border-radius: 12px;
333
333
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
334
- `,pn=r.div`
334
+ `,un=r.div`
335
335
  display: flex;
336
336
  align-items: center;
337
337
  gap: 4px;
338
338
  width: 100%;
339
- `,un=r.div`
339
+ `,pn=r.div`
340
340
  flex: 1;
341
341
  min-width: 0;
342
342
  `,hn=r.div`
@@ -348,4 +348,4 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as
348
348
  pre {
349
349
  margin: 0;
350
350
  }
351
- `,gn=({title:a="YAML",yaml:r,defaultOpen:l,fullHeight:n,bgTint:i="1000",codeBgColor:s,compact:c})=>{const{clickCopy:d,isCopied:p,CopyButton:u}=j(),h=o(()=>r?[{id:qt(),type:jt.Button,buttonProps:{variant:D.Text,size:z.S,leftIcon:p?Wt:ca,onClick:()=>d(r||""),disabled:p}}]:[],[r,p]);return c?t(dn,{children:[t(pn,{children:[e(da,{size:16}),e(un,{children:e(E,{size:N.XXS,color:I.Primary,children:a})}),r&&e(u,{value:r})]}),r?e(hn,{children:e(F,{code:r,language:"yaml",theme:"duotoneDark"})}):e(H,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})]}):e(K,{bgTint:i,richTitle:{icon:da,title:a},actions:h,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:n,children:e(cn,{$codeBgColor:s,children:r?e(F,{code:r,language:"yaml",theme:"duotoneDark"}):e(_,{children:e(H,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{qa as A,ur as B,hr as C,pl as D,el as E,ol as I,dl as N,sl as O,cl as P,Bl as R,Kl as S,Yl as U,tn as W,gn as Y,vr as a,fr as b,br as c,gl as d,Qr as e,yr as f,Zr as g,Ol as h,Rl as i,ul as j,Gl as k,Wl as l,Er as m,sn as n,Ba as o,rl as p};
351
+ `,gn=({title:a="YAML",yaml:r,defaultOpen:l,fullHeight:n,bgTint:i="1000",codeBgColor:s,compact:c})=>{const{clickCopy:d,isCopied:u,CopyButton:p}=j(),h=o(()=>r?[{id:qt(),type:jt.Button,buttonProps:{variant:D.Text,size:z.S,leftIcon:u?Ft:ca,onClick:()=>d(r||""),disabled:u}}]:[],[r,u]);return c?t(dn,{children:[t(un,{children:[e(da,{size:16}),e(pn,{children:e(E,{size:N.XXS,color:I.Primary,children:a})}),r&&e(p,{value:r})]}),r?e(hn,{children:e(W,{code:r,language:"yaml",theme:"duotoneDark"})}):e(H,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})]}):e(K,{bgTint:i,richTitle:{icon:da,title:a},actions:h,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:n,children:e(cn,{$codeBgColor:s,children:r?e(W,{code:r,language:"yaml",theme:"duotoneDark"}):e(_,{children:e(H,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{qa as A,pr as B,hr as C,ul as D,el as E,ol as I,dl as N,sl as O,cl as P,Bl as R,Kl as S,Yl as U,tn as W,gn as Y,vr as a,fr as b,br as c,gl as d,Qr as e,yr as f,Zr as g,Ol as h,Rl as i,pl as j,Gl as k,Fl as l,Er as m,sn as n,Ba as o,rl as p};
@@ -1,4 +1,4 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{t as c,ba as l,bb as d,p as u,S,bc as m,bd as E,be as I,P as T,bf as p,bg as _,bh as f,bi as N,bj as y,bk as A,bl as R,bm as O,bn as g,bo as G,bp as h,bq as v,br as C,bs as L,bt as D,bu as P,bv as w,b4 as U,bw as b,bx as F,q as k,by as H,bz as M,bA as x,bB as V,bC as Y,bD as K,G as B,bE as $,bF as W,al as j,ah as q,aj as Q,ai as z,ak as J,ag as X,bG as Z,b as ee}from"./ui-components-Dvmqmy3G.js";import{i as te,n as re,m as ae,l as ne,o as oe,p as se,v as ie,q as ce,u as le}from"./helpers-Ds7r-EIJ.js";import{ApolloProvider as de,useLazyQuery as ue,useApolloClient as Se,useQuery as me}from"@apollo/client/react";import{ErrorLink as Ee}from"@apollo/client/link/error";import{SetContextLink as Ie}from"@apollo/client/link/context";import{getMainDefinition as Te}from"@apollo/client/utilities";import{CombinedGraphQLErrors as pe,ServerError as _e}from"@apollo/client/errors";import{HttpLink as fe,ApolloLink as Ne,ApolloClient as ye,InMemoryCache as Ae,gql as Re}from"@apollo/client";const Oe=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},ge=a(null),Ge=()=>{const e=r(ge);if(!e)throw new Error("[ui-kit] useOdigosApi() / useXxxApi() called outside of <OdigosApiProvider>. Make sure the host app mounts the provider at its layout level.");return e},he=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new fe({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new Ee(({error:t})=>{pe.is(t)?t.errors.some(e=>Oe(e.message))&&e.onAuthError?.():(_e.is(t)&&401===t.statusCode||Oe(t.message))&&e.onAuthError?.()}),a=new Ie(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=Ne.from(n);e.wsLink&&(o=Ne.split(({query:e})=>{const t=Te(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new ye({link:o,cache:new Ae({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials,r.clientKey]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(de,{client:s,children:e(ge.Provider,{value:i,children:o})})},ve=ge,Ce=e=>e.map(e=>`${e.id}:${e.odigosVersion}:${e.type}`).join(","),Le=(e,t,r)=>{const a=t.length?t.map(e=>e.id):r??[],n={...e,connectionIds:a};if(!t.length||c(e.version)>0)return n;const o=t[0];return{...n,version:o.odigosVersion||e.version,platformType:o.type??e.platformType}},De=({connections:r,connectionIds:a,children:n})=>{const o=Ge(),s=t(()=>({operations:o.operations,context:Le(o.context,r,a),apolloConfig:o.apolloConfig}),[o.operations,o.context,o.apolloConfig,Ce(r),a?.join(",")]);return e(ve.Provider,{value:s,children:n})},Pe=(e,t)=>{if(e)return"string"==typeof e?e:m(e,t)},we=e=>{const{addNotification:t}=l(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:Pe(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(S.Error,e,t,a),notifySuccess:(e,t,a)=>r(S.Success,e,t,a),notifyPending:(e,t)=>r(S.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:S.Warning,title:u.READONLY,message:d.READONLY_WARNING,hideFromHistory:!0})}}},Ue=e=>{e({type:S.Warning,title:u.READONLY,message:d.READONLY_WARNING,hideFromHistory:!0})},be=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Fe=(e,t)=>{if(e)return"function"==typeof e?e(t):e},ke=e=>{if(!e)return"Unknown error";if(e instanceof Error)return e.cause instanceof Error?e.cause.message:e.message;if("object"==typeof e){const t=e;return t.cause?.message||t.message||String(e)}return String(e)},He=(e,t)=>e.client??t,Me=async(e,t,r,a,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(He(t,e),r,a)}catch(e){return{error:ke(e)}}const o=Fe(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=He(t,e);try{const e=await i.query({query:o,variables:s,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?ke(e.error):void 0}}catch(e){return{error:ke(e)}}},xe=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{error:"Mutation operation not supported in this context"};if(t.run)try{return await t.run(He(t,e),r,a)}catch(e){return{error:ke(e)}}const n=Fe(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=He(t,e);try{const e=await s.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:ke(e)}}},Ve=async(e,t,r,a,n)=>{if(!t)return be("Multi fetch operation not configured");if(!r.length)return be("No proxy ids supplied for multi fetch");const o=He(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),s=[];for(const r of e)try{const e=await o.query({query:r.document,variables:r.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>s.push(e)):r.proxyIDs.forEach(t=>{s.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=ke(e);r.proxyIDs.forEach(e=>s.push({proxyID:e,success:!1,error:t}))}const i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await Me(e,t,a,o);return{proxyID:r,success:!s.error,data:s.data,error:s.error}})),i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}},Ye=Re`
1
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{t as c,ba as l,bb as d,p as u,S,bc as m,bd as E,be as I,P as T,bf as p,bg as _,bh as f,bi as N,bj as y,bk as A,bl as R,bm as O,bn as g,bo as G,bp as h,bq as v,br as C,bs as L,bt as D,bu as P,bv as w,b4 as U,bw as b,bx as F,q as k,by as H,bz as M,bA as x,bB as V,bC as Y,bD as K,G as B,bE as $,bF as W,al as j,ah as q,aj as Q,ai as z,ak as J,ag as X,bG as Z,b as ee}from"./ui-components-DvoeDBMI.js";import{i as te,n as re,m as ae,l as ne,o as oe,p as se,v as ie,q as ce,u as le}from"./helpers-esDVvrTt.js";import{ApolloProvider as de,useLazyQuery as ue,useApolloClient as Se,useQuery as me}from"@apollo/client/react";import{ErrorLink as Ee}from"@apollo/client/link/error";import{SetContextLink as Ie}from"@apollo/client/link/context";import{getMainDefinition as Te}from"@apollo/client/utilities";import{CombinedGraphQLErrors as pe,ServerError as _e}from"@apollo/client/errors";import{HttpLink as fe,ApolloLink as Ne,ApolloClient as ye,InMemoryCache as Ae,gql as Re}from"@apollo/client";const Oe=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},ge=a(null),Ge=()=>{const e=r(ge);if(!e)throw new Error("[ui-kit] useOdigosApi() / useXxxApi() called outside of <OdigosApiProvider>. Make sure the host app mounts the provider at its layout level.");return e},he=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new fe({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new Ee(({error:t})=>{pe.is(t)?t.errors.some(e=>Oe(e.message))&&e.onAuthError?.():(_e.is(t)&&401===t.statusCode||Oe(t.message))&&e.onAuthError?.()}),a=new Ie(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=Ne.from(n);e.wsLink&&(o=Ne.split(({query:e})=>{const t=Te(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new ye({link:o,cache:new Ae({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials,r.clientKey]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(de,{client:s,children:e(ge.Provider,{value:i,children:o})})},ve=ge,Ce=e=>e.map(e=>`${e.id}:${e.odigosVersion}:${e.type}`).join(","),Le=(e,t,r)=>{const a=t.length?t.map(e=>e.id):r??[],n={...e,connectionIds:a};if(!t.length||c(e.version)>0)return n;const o=t[0];return{...n,version:o.odigosVersion||e.version,platformType:o.type??e.platformType}},De=({connections:r,connectionIds:a,children:n})=>{const o=Ge(),s=t(()=>({operations:o.operations,context:Le(o.context,r,a),apolloConfig:o.apolloConfig}),[o.operations,o.context,o.apolloConfig,Ce(r),a?.join(",")]);return e(ve.Provider,{value:s,children:n})},Pe=(e,t)=>{if(e)return"string"==typeof e?e:m(e,t)},we=e=>{const{addNotification:t}=l(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:Pe(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(S.Error,e,t,a),notifySuccess:(e,t,a)=>r(S.Success,e,t,a),notifyPending:(e,t)=>r(S.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:S.Warning,title:u.READONLY,message:d.READONLY_WARNING,hideFromHistory:!0})}}},Ue=e=>{e({type:S.Warning,title:u.READONLY,message:d.READONLY_WARNING,hideFromHistory:!0})},be=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Fe=(e,t)=>{if(e)return"function"==typeof e?e(t):e},ke=e=>{if(!e)return"Unknown error";if(e instanceof Error)return e.cause instanceof Error?e.cause.message:e.message;if("object"==typeof e){const t=e;return t.cause?.message||t.message||String(e)}return String(e)},He=(e,t)=>e.client??t,Me=async(e,t,r,a,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(He(t,e),r,a)}catch(e){return{error:ke(e)}}const o=Fe(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=He(t,e);try{const e=await i.query({query:o,variables:s,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?ke(e.error):void 0}}catch(e){return{error:ke(e)}}},xe=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{error:"Mutation operation not supported in this context"};if(t.run)try{return await t.run(He(t,e),r,a)}catch(e){return{error:ke(e)}}const n=Fe(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=He(t,e);try{const e=await s.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:ke(e)}}},Ve=async(e,t,r,a,n)=>{if(!t)return be("Multi fetch operation not configured");if(!r.length)return be("No proxy ids supplied for multi fetch");const o=He(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),s=[];for(const r of e)try{const e=await o.query({query:r.document,variables:r.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>s.push(e)):r.proxyIDs.forEach(t=>{s.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=ke(e);r.proxyIDs.forEach(e=>s.push({proxyID:e,success:!1,error:t}))}const i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await Me(e,t,a,o);return{proxyID:r,success:!s.error,data:s.data,error:s.error}})),i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}},Ye=Re`
2
2
  query OdigosApiNoop {
3
3
  __typename
4
4
  }