@odigos/ui-kit 0.0.233 → 0.0.235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/chunks/{index-D65aqUr3.js → index-BmuiyBxZ.js} +1 -1
- package/lib/chunks/index-D6lL097V.js +145 -0
- package/lib/chunks/{index-BaKzgedB.js → index-pkD-mO1h.js} +1 -1
- package/lib/chunks/ui-components-B4It5sfa.js +2696 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants/sampling/index.d.ts +1 -0
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/sampling-rules/converters.d.ts +3 -1
- package/lib/containers/_v2/sampling-rules/helpers.d.ts +2 -2
- package/lib/containers/v2.js +5 -5
- package/lib/containers.js +4 -4
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/icons/destinations/index.d.ts +1 -0
- package/lib/icons/destinations/pyroscope-logo/index.d.ts +2 -0
- package/lib/icons.js +1 -1
- package/lib/snippets/_v2/sampling-rule-form-sections/source-scope.d.ts +2 -2
- package/lib/snippets/v2.js +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/destinations/index.d.ts +6 -1
- package/lib/types/sampling.d.ts +24 -26
- package/lib/types/signals/index.d.ts +4 -2
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-Di5tcvgi.js +0 -145
- package/lib/chunks/ui-components-DD1EWBzE.js +0 -2696
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.235](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.234...ui-kit-v0.0.235) (2026-05-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* new source scope api PLAT-1070 ([#890](https://github.com/odigos-io/ui-kit/issues/890)) ([c30d20a](https://github.com/odigos-io/ui-kit/commit/c30d20ab7c184ff23098faf02fd1628ae6288a7a))
|
|
9
|
+
|
|
10
|
+
## [0.0.234](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.233...ui-kit-v0.0.234) (2026-05-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add support for Profiles signal and update destination form to include Pyroscope integration ([#876](https://github.com/odigos-io/ui-kit/issues/876)) ([6289b64](https://github.com/odigos-io/ui-kit/commit/6289b64aa823b9488ae710551121056c462170b6))
|
|
16
|
+
|
|
3
17
|
## [0.0.233](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.232...ui-kit-v0.0.233) (2026-05-10)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{useMemo as e}from"react";import i from"styled-components";import{u as o,B as s,a,A as n,g as l,D as r,C as c,b as p,N as m}from"./ui-components-
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{useMemo as e}from"react";import i from"styled-components";import{u as o,B as s,a,A as n,g as l,D as r,C as c,b as p,N as m}from"./ui-components-B4It5sfa.js";import{VIcon as d,CopyIcon as u,YamlIcon as f}from"../icons.js";const h=i.div`
|
|
2
2
|
padding: 0 12px;
|
|
3
3
|
`,g=({title:i="YAML",yaml:g,defaultOpen:b,fullHeight:T,bgTint:y="1000"})=>{const{clickCopy:C,isCopied:x}=o(),A=e(()=>g?[{id:l(),type:n.Button,buttonProps:{variant:a.Text,size:s.S,leftIcon:x?d:u,onClick:()=>C(g||""),disabled:x}}]:[],[g,x]);return t(r,{bgTint:y,richTitle:{icon:f,title:i},actions:A,withCollapse:!0,collapseIsDefaultOpen:b,fullHeight:T,children:t(h,{children:g?t(c,{code:g,language:"yaml",theme:"duotoneDark"}):t(p,{children:t(m,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{g as Y};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import{cA as e,a,as as t,j as l,l as r,fs as i,cn as s,cP as n,cu as o,cq as d,bC as c,cr as u,cp as p,ak as h,a4 as g,b_ as m,F as v,y as f,cm as b,S as y,s as x,cL as S,ft as C,fu as k,k as w,fv as T,n as $,fw as P,o as A,p as M,fx as L,fy as O,fz as z,fA as X,fB as R,fC as D,fD as I,e5 as N,fE as E,fF as H,fG as B,fH as V,fI as j,di as q,B as U,fJ as G,fK as J,fL as K,fM as W,fN as F,fO as Z,fP as Y,fQ as _,fR as Q,fS as ee,cF as ae,fT as te,fU as le,cM as re,fV as ie,fW as se,fX as ne,fY as oe,fZ as de,d7 as ce,f_ as ue,f$ as pe,g0 as he,g1 as ge,g2 as me,g3 as ve,g4 as fe,g5 as be,g6 as ye,dm as xe,m as Se,g7 as Ce,g8 as ke,g9 as we,ga as Te,gb as $e,gc as Pe,gd as Ae,ge as Me,gf as Le,gg as Oe,gh as ze,cw as Xe,gi as Re,R as De,gj as Ie,gk as Ne,gl as Ee,gm as He,gn as Be,eL as Ve,bW as je,P as qe,$ as Ue,br as Ge,co as Je,go as Ke,b6 as We,b as Fe,N as Ze,c4 as Ye,L as _e,eO as Qe,w as ea}from"./ui-components-B4It5sfa.js";import{jsx as aa,jsxs as ta,Fragment as la}from"react/jsx-runtime";import{OdigosLogoTextEnterprise as ra,OdigosLogoTextCommunity as ia,EditIcon as sa,ArrowLeftIcon as na,ArrowRightIcon as oa,VSquareIcon as da}from"../icons.js";import{useCallback as ca,useMemo as ua,useState as pa,useRef as ha,useEffect as ga,forwardRef as ma,useImperativeHandle as va}from"react";import fa from"styled-components";import"./index-BmuiyBxZ.js";const ba=({isOpen:t,onClose:l,onDeny:r,onApprove:i})=>aa(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:l,denyButton:{label:"Keep editing",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:"Discard changes",variant:a.Primary,onClick:()=>{i?.(),l()}}}),ya=({isOpen:t,onClose:l,onDeny:r,onApprove:i,action:s="delete",target:n})=>{const o=s.charAt(0).toUpperCase()+s.substring(1),d=n?.endsWith("s")?"these":"this";return aa(e,{title:`${o}${n?` ${n}`:""}?`,description:`Are you sure you want to ${s}${n?` ${d} ${n}`:""}?`,isOpen:t,onClose:l,denyButton:{label:"Go back",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:o,variant:a.Primary,onClick:()=>{i?.(),l()}}})},xa=({componentType:e,inputType:a,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S,setValue:C,errorMessage:k,warnMessage:w,helpMessage:T,dropdownOptions:$,dropdownNoSearch:P,dropdownNoCheckbox:A,timeUnits:M,timeDefaultUnit:L})=>{switch(e){case t.Input:return aa(p,{name:g,type:a,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S??"",onChange:e=>{const t=e.target.value;C(a===h.Number?""===t?null:Number(t):t)},errorMessage:k,warnMessage:w,helpMessage:T},g);case t.MultiInput:return aa(u,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(S)?S:c(S,[]),setValues:e=>C(e),errorMessage:k,warnMessage:w,helpMessage:T},g);case t.KeyValuePair:return aa(d,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:Array.isArray(S)?S:c(S,[]),setValues:e=>C(e),errorMessage:k,warnMessage:w,helpMessage:T},g);case t.TextArea:return aa(o,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:S??"",onChange:e=>C(e.target.value),errorMessage:k,warnMessage:w,helpMessage:T},g);case t.Dropdown:return aa(n,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!P,options:$?.map(e=>({id:e.id||"",label:e.value||"",withCheckbox:!A}))||[],values:S?[String(S)]:[],setValues:e=>C(e[0]),errorMessage:k,warnMessage:w,helpMessage:T},g);case t.Checkbox:return aa(s,{name:g,label:m,tooltip:v,badge:f,value:!0===S||"true"===S,onChange:e=>C(e),disabled:x,errorMessage:k,warnMessage:w,helpMessage:T},g);case t.Time:return aa(i,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S??"",setValue:e=>C(e),units:M,defaultUnit:L,errorMessage:k,warnMessage:w,helpMessage:T},g);case t.Toggle:return aa(l,{name:g,labelAlign:r.Right,label:m,tooltip:v,badge:f,value:!0===S||"true"===S,onChange:e=>C(e),disabled:x,errorMessage:k,warnMessage:w,helpMessage:T},g);default:return null}},Sa=({size:e=200})=>{const{tier:a}=g();return a===m.Onprem?aa(ra,{size:e}):aa(ia,{size:e})},Ca=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],ka=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],wa=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],Ta=({description:e,options:a,selected:t,onSelect:l,customName:r,customLabel:i,customPlaceholder:s,customValue:n,onCustomChange:o})=>ta(v,{$gap:16,$alignItems:"flex-end",children:[ta(f,{$gap:6,children:[aa(b,{label:e}),aa(y,{size:x.S,options:a,selected:t,setSelected:l})]}),"custom"===t&&aa(p,{name:r,label:i,placeholder:s,type:h.Number,value:n,onChange:o,width:160})]}),$a=()=>{},Pa=e=>e.readOnly?aa(Aa,{rule:e.rule}):aa(Ma,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),Aa=({rule:e})=>{const a=null!=e.durationAtLeastMs;return e.error?aa(S,{richTitle:{title:C},children:aa(l,{name:"sampling-view-toggle-keep-errors",onChange:$a,value:!0,size:w.S,label:k,labelAlign:r.Right})}):a?aa(S,{richTitle:{title:T},children:ta("div",{children:[aa($,{size:M.XXXS,color:A.Secondary,children:P}),aa($,{size:M.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},Ma=({ruleType:e,formState:a,onChange:t})=>{const i=ca(e=>t({durationPreset:e}),[t]),s=ca(e=>t({customDurationMs:e.target.value}),[t]);return"Error"===e?aa(S,{richTitle:{title:C,subTitle:L},children:aa(l,{name:"sampling-toggle-keep-errors",value:!0,onChange:$a,size:w.S,label:k,labelAlign:r.Right})}):"Duration"===e?aa(S,{richTitle:{title:T,subTitle:O},children:aa(Ta,{description:P,options:wa,selected:a.durationPreset,onSelect:i,customName:"sampling-input-custom-duration",customLabel:z,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:s})}):null},La=fa.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: 32px;
|
|
4
|
+
`,Oa=fa.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 4px;
|
|
8
|
+
`,za=fa.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
align-items: flex-end;
|
|
12
|
+
gap: 16px;
|
|
13
|
+
`,Xa=fa.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-end;
|
|
16
|
+
gap: 16px;
|
|
17
|
+
padding: 12px 16px;
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
20
|
+
`,Ra=fa.div`
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: flex-end;
|
|
23
|
+
gap: 10px;
|
|
24
|
+
flex: 1;
|
|
25
|
+
`,Da=fa.div`
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
height: 32px;
|
|
29
|
+
`,Ia=fa.div`
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: flex-end;
|
|
32
|
+
gap: 16px;
|
|
33
|
+
margin-bottom: 12px;
|
|
34
|
+
`,Na="Any",Ea="Kafka topic",Ha=()=>aa("div",{style:{marginBottom:"8px"},children:aa($,{size:M.XS,weight:500,children:"And"})}),Ba=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Va=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],ja=[{id:"",label:Na},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}];const qa=e=>e.readOnly?aa(Ua,{data:e.data}):aa(Ga,{category:e.category,formState:e.formState,onChange:e.onChange}),Ua=({data:e})=>{const a=ua(()=>function(e){if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:W,value:K},{id:"route",title:B,value:a.httpServer.route||a.httpServer.routePrefix||F},{id:"method",title:G,value:a.httpServer.method||Na}];if(a?.httpClient){const e=[{id:"type",title:W,value:Z}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:B,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||F}),e.push({id:"method",title:G,value:a.httpClient.method||Na}),e}return[{id:"type",title:W,value:Y}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:W,value:K},{id:"route",title:B,value:a.httpServer.route||a.httpServer.routePrefix||F},{id:"method",title:G,value:a.httpServer.method||Na}]:a?.kafkaConsumer?[{id:"type",title:W,value:_},{id:"topic",title:Ea,value:a.kafkaConsumer.kafkaTopic||F}]:a?.kafkaProducer?[{id:"type",title:W,value:Q},{id:"topic",title:Ea,value:a.kafkaProducer.kafkaTopic||F}]:[{id:"type",title:W,value:Y}]}(e),[e]);return aa(S,{richTitle:{title:X},children:aa(La,{children:a.map(({id:e,title:a,value:t})=>ta(Oa,{children:[aa($,{size:M.XXXS,color:A.Secondary,nowrap:!0,children:a}),aa($,{size:M.XS,nowrap:!0,children:t})]},e))})})},Ga=({category:e,formState:t,onChange:l})=>{const r=ua(()=>"noisy"===e?Ba:Va,[e]),i=ca(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),s=ca(e=>a=>{a&&l({routeType:e,route:""})},[l]),n=ca(e=>l({route:e.target.value}),[l]),o=ca(e=>l({serverAddress:e.target.value}),[l]),d=ca(e=>l({method:e[0]||""}),[l]),c=ca(e=>l({kafkaTopic:e.target.value}),[l]),u="httpServer"===t.operationType||"httpClient"===t.operationType,h="kafkaConsumer"===t.operationType||"kafkaProducer"===t.operationType,g="httpClient"===t.operationType?H:B,m="httpClient"===t.operationType?V:j;return ta(S,{richTitle:{title:`2. ${X}`,subTitle:R},children:[aa(f,{$alignItems:"flex-start",children:aa(y,{size:x.S,options:r,selected:t.operationType,setSelected:i})}),u&&ta(za,{children:["httpClient"===t.operationType&&ta(Ia,{children:[aa(p,{name:"sampling-input-server-address",label:I,placeholder:D,value:t.serverAddress,onChange:o}),aa(Ha,{})]}),ta(Xa,{children:[ta(Ra,{children:[aa(Da,{children:aa(N,{"data-id":"sampling-radio-route",value:"route"===t.routeType,onChange:s("route")})}),aa(p,{name:"sampling-input-route",label:g,placeholder:E,value:"route"===t.routeType?t.route:"",onChange:n,disabled:"route"!==t.routeType})]}),ta(Ra,{children:[aa(Da,{children:aa(N,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===t.routeType,onChange:s("routePrefix")})}),aa(p,{name:"sampling-input-route-prefix",label:m,placeholder:E,value:"routePrefix"===t.routeType?t.route:"",onChange:n,disabled:"routePrefix"!==t.routeType})]})]}),ta(Ia,{children:[aa(Ha,{}),aa(q,{label:G,items:ja,selectedIds:[t.method||""],setSelectedIds:e=>d(e),buttonProps:{"data-id":"sampling-btn-method",label:ja.find(e=>e.id===t.method)?.label||Na,size:U.S,variant:a.Secondary}})]})]}),h&&aa(p,{name:"sampling-input-kafka-topic",label:J,placeholder:"Type kafka topic",value:t.kafkaTopic,onChange:c,width:"320px"})]})},Ja=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Ka=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}];const Wa=e=>e.readOnly?aa(Fa,{data:e.data}):aa(Za,{category:e.category,formState:e.formState,onChange:e.onChange}),Fa=({data:e})=>{const a=ua(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:te,method:ne,description:ie,value:`${e.rule.percentageAtLeast}%`}:{title:te,method:de,description:null,value:null};case"noisy":return null!=e.rule.percentageAtMost?{title:le,method:ne,description:se,value:`${e.rule.percentageAtMost}%`}:{title:le,method:oe,description:null,value:null};case"costReduction":return{title:le,method:ne,description:se,value:`${e.rule.percentageAtMost}%`}}}(e),[e]),t=[{id:"method",title:G,value:a.method},...null!=a.description?[{id:"value",title:a.description,value:a.value}]:[]];return aa(S,{richTitle:{title:a.title},children:aa(La,{children:t.map(({id:e,title:a,value:t})=>ta(Oa,{children:[aa($,{size:M.XXXS,color:A.Secondary,nowrap:!0,children:a}),aa($,{size:M.XS,nowrap:!0,children:t})]},e))})})},Za=({category:e,formState:a,onChange:t})=>{const l="highlyRelevant"===e,r=l?Ka:Ja,i=`${l?4:3}. ${l?te:le}`,s=l?ee:ae,n=l?ie:se,o="noisy"===e?ka:Ca,d=ca(e=>t({percentageMode:e}),[t]),c=ca(e=>t({percentagePreset:e}),[t]),u=ca(e=>t({customPercentage:e.target.value}),[t]);return ta(S,{richTitle:{title:i,subTitle:s},children:["costReduction"!==e&&aa(f,{$alignItems:"flex-start",children:aa(y,{size:x.S,options:r,selected:a.percentageMode,setSelected:d})}),("costReduction"===e||"sample"===a.percentageMode)&&aa(Ta,{description:n,options:o,selected:a.percentagePreset,onSelect:c,customName:"sampling-input-custom-percentage",customLabel:re,customPlaceholder:"5%",customValue:a.customPercentage,onCustomChange:u})]})},Ya=fa.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: flex-end;
|
|
37
|
+
gap: 16px;
|
|
38
|
+
`,_a=fa.div`
|
|
39
|
+
width: 280px;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
`,Qa=fa.div`
|
|
42
|
+
flex: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
`;function et(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":fe[e.category]}const at=e=>e.readOnly?aa(tt,{data:e.data}):aa(lt,{formState:e.formState,onChange:e.onChange}),tt=({data:e})=>{const a=ua(()=>[{id:"name",title:ue,value:e.rule.name||ce},{id:"type",title:pe,value:et(e)}],[e]),t=e.rule.notes||F;return ta(S,{children:[aa(La,{children:a.map(({id:e,title:a,value:t})=>ta(Oa,{children:[aa($,{size:M.XXXS,color:A.Secondary,nowrap:!0,children:a}),aa($,{size:M.XS,nowrap:!0,children:t})]},e))}),ta(Oa,{children:[aa($,{size:M.XXXS,color:A.Secondary,children:he}),aa($,{size:M.XS,children:t})]})]})},lt=({formState:e,onChange:a})=>{const t=ca(e=>a({name:e.target.value}),[a]),l=ca(e=>a({notes:e.target.value}),[a]);return aa(S,{children:ta(Ya,{children:[aa(_a,{children:aa(p,{name:"sampling-input-rule-name",label:ue,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:ge,value:e.name,onChange:t})}),aa(Qa,{children:aa(p,{name:"sampling-input-note",label:he,tooltip:ve,placeholder:me,value:e.notes,onChange:l})})]})})},rt=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],it=({formState:e,onChange:a})=>{const t=ca(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return aa(S,{richTitle:{title:`3. ${pe}`,subTitle:be},children:aa(f,{$alignItems:"flex-start",children:aa(y,{size:x.S,options:rt,selected:e.ruleType,setSelected:t})})})},st=fa.div`
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 24px;
|
|
48
|
+
padding: 8px 16px;
|
|
49
|
+
border-radius: 12px;
|
|
50
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
51
|
+
`,nt=fa.div`
|
|
52
|
+
flex: 1;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
white-space: pre;
|
|
55
|
+
overflow-x: auto;
|
|
56
|
+
`,ot=({title:e,summary:t,onEdit:l,renderAction:r})=>{const i=ua(()=>{const a=[];return e&&(a.push({text:e,variant:ye.Default}),a.push({text:" - ",variant:ye.Default})),a.push(...t),a},[e,t]);return ta(st,{children:[aa(nt,{children:aa(xe,{parts:i})}),r&&r(),l&&aa(Se,{"data-id":"sampling-btn-edit-auto-rule",label:Ce,rightIcon:sa,variant:a.Text,size:U.S,onClick:l})]})},dt=e=>{const a=ua(()=>{if(e.readOnly)return e.summary;switch(e.category){case"noisy":return Te(Le(e.formState));case"highlyRelevant":return we(Me(e.formState));case"costReduction":return ke(Ae(e.formState))}},[e]);if(e.readOnly)return aa(ot,{title:$e,summary:a,renderAction:e.renderAction});const t=1===a.length&&"default"===a[0].variant;return aa(ot,{title:t?Pe:$e,summary:t?[]:a,renderAction:e.renderAction})},ct=fa.div`
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
gap: 8px;
|
|
60
|
+
`,ut=fa.div`
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
padding: 8px 12px;
|
|
65
|
+
border-radius: 8px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
background: ${({theme:e,$selected:a})=>a?e.v2.colors.silver[700]:e.v2.colors.silver[900]};
|
|
68
|
+
border: 1px solid ${({theme:e,$selected:a})=>a?e.v2.colors.silver[500]:e.v2.colors.silver[800]};
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
72
|
+
}
|
|
73
|
+
`,pt=fa.div`
|
|
74
|
+
display: flex;
|
|
75
|
+
width: 32px;
|
|
76
|
+
height: 32px;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: center;
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
`,ht=fa.div`
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
gap: 4px;
|
|
84
|
+
`,gt=fa.div`
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: 8px;
|
|
88
|
+
padding: 8px;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
91
|
+
`,mt=fa.div`
|
|
92
|
+
display: flex;
|
|
93
|
+
width: 24px;
|
|
94
|
+
height: 24px;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
`,vt={[qe.JavaScript]:"Node.js",[qe.DotNet]:".NET",[qe.Php]:"PHP",[qe.Java]:"Java",[qe.Go]:"Go",[qe.Python]:"Python",[qe.Ruby]:"Ruby",[qe.Rust]:"Rust"},ft=[qe.Python,qe.Java,qe.JavaScript,qe.DotNet,qe.Php,qe.Ruby,qe.Go].map(e=>({id:e,label:vt[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:je(e)})),bt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function yt(e){const a=vt[e];return a||e.charAt(0).toUpperCase()+e.slice(1)}const xt=e=>e.readOnly?aa(St,{scopes:e.scopes}):aa(Ct,{formState:e.formState,onChange:e.onChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions}),St=({scopes:e})=>{if(Oe(e))return aa(S,{richTitle:{title:ze},children:aa(Xe,{status:De.Default,message:Re,fullWidth:!0})});const a=e.sources??[],t=e.namespaces??[],l=e.languages??[];return aa(S,{richTitle:{title:ze},children:ta(ht,{children:[a.map((e,a)=>{const t=[e.namespace,e.kind,e.name].filter(Boolean),l=t.length?t.join(" / "):Ie;return aa(gt,{children:aa($,{size:M.XS,color:A.Primary,children:l})},`src-${a}`)}),t.map((e,a)=>aa(gt,{children:aa($,{size:M.XS,color:A.Primary,children:e})},`ns-${a}`)),l.map((e,a)=>{const t=je(e);return ta(gt,{children:[t&&aa(mt,{children:aa(t,{size:18})}),aa($,{size:M.XS,color:A.Primary,children:yt(e)})]},`lang-${a}`)})]})})},Ct=({formState:e,onChange:a,sourceOptions:t=[],namespaceOptions:l=[]})=>{const[r,i]=pa("all"),{sources:n,namespaces:o,languages:d}=e.sourceScopes,c=n.length>0||o.length>0||d.length>0,u=ua(()=>bt.map(e=>({...e,disabled:"all"===e.value&&c})),[c]),p=ua(()=>n.map(e=>{return a=e.namespace,t=e.kind,l=e.name,`${a}/${t}/${l}`;var a,t,l}),[n]),h=ua(()=>[...o],[o]),g=ua(()=>new Set(d),[d]),m=ca(e=>{i(e)},[]),v=ca(t=>{const l=t.map(e=>function(e){const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}}(e)).filter(e=>null!==e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));a({sourceScopes:{...e.sourceScopes,sources:l}})},[e.sourceScopes,a]),b=ca(t=>{a({sourceScopes:{...e.sourceScopes,namespaces:t}})},[e.sourceScopes,a]),C=ca(t=>{const l=e.sourceScopes.languages,r=l.includes(t)?l.filter(e=>e!==t):[...l,t];a({sourceScopes:{...e.sourceScopes,languages:r}})},[e.sourceScopes,a]);return ta(S,{richTitle:{title:`1. ${ze}`,subTitle:Ne},children:[aa(Xe,!c&&"all"===r?{status:De.Default,message:Re,fullWidth:!0,smallIcon:!0}:{status:De.Info,message:Ee,fullWidth:!0,smallIcon:!0}),aa(f,{$alignItems:"flex-start",children:aa(y,{size:x.S,options:u,selected:r,setSelected:m})}),"source"===r&&aa(He,{multiple:!0,"data-id":"sampling-autocomplete-source",options:t,value:p,onSelect:v,placeholder:Be}),"namespace"===r&&aa(He,{multiple:!0,"data-id":"sampling-autocomplete-namespace",options:l,value:h,onSelect:b,placeholder:"Search namespace"}),"language"===r&&aa(ct,{children:ft.map(({id:e,label:a,Icon:t})=>{const l=g.has(e);return ta(ut,{$selected:l,onClick:()=>C(e),children:[aa(s,{name:`sampling-scope-lang-${e}`,size:Ve.S,value:l,onChange:()=>C(e)}),aa(pt,{children:aa(t,{size:20})}),aa($,{size:M.XS,nowrap:!0,children:a})]},e)})})]})},kt=(e,a)=>!a?.length||!!a?.find(a=>a===e),wt=({title:e="Signals",required:a,errorMessage:t,allowedSignals:l,selectedSignals:r,setSelectedSignals:i,disabled:n})=>{const[o,d]=pa(1===r.length),c=ha(JSON.stringify(r));ga(()=>{let e=Ue(r).filter(e=>kt(e,l));e.length||(e=Ge.filter(({id:e})=>kt(e,l)).map(({id:e})=>e));const a=JSON.stringify(e);c.current!==a&&(c.current=a,i(e),d(1===e.length))},[l,r]);return ta(f,{$gap:12,children:[aa(b,{label:e,required:a}),aa(v,{$gap:12,children:Ge.map(e=>{const a=kt(e.id,l),t=((e,a)=>!!a?.find(a=>a===e))(e.id,r);return a?aa(s,{label:e.value,disabled:n||!a||o&&t,value:t,onChange:a=>((e,a)=>{const t=e,l=a?[...r,t]:r.filter(e=>e!==t);i(l),d(1===l.length)})(e.id,a)},e.id):null})}),aa(Je,{errorMessage:t})]})},Tt=({minSupportedVersion:a,currentVersion:t})=>aa(e,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>aa(Ke,{scale:2.4,icon:()=>aa("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:aa("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${a} or later.\nCurrent version: ${t}.`}),$t=fa.div`
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
justify-content: flex-end;
|
|
102
|
+
width: ${({$width:e})=>e};
|
|
103
|
+
gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
|
|
104
|
+
`,Pt=fa.div`
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
min-height: 24px;
|
|
108
|
+
padding: 12px;
|
|
109
|
+
border-radius: 16px 16px 0 0;
|
|
110
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
111
|
+
`,At=fa.div`
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
gap: ${({$gap:e})=>e}px;
|
|
115
|
+
padding: 12px 12px 0 12px;
|
|
116
|
+
width: calc(100% - 24px);
|
|
117
|
+
height: ${({$heightOffset:e,$columnHasHeader:a})=>`calc(100vh - 180px - ${e}px ${a?"- 48px":""})`};
|
|
118
|
+
border-radius: ${({$columnHasHeader:e,$isLeft:a,$isRight:t})=>e?a?"0 0 0 16px":t?"0 16px 0 0":"0":a?"16px 0 0 16px":t?"0 16px 16px 0":"16px"};
|
|
119
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
120
|
+
overflow-y: auto;
|
|
121
|
+
overflow-x: hidden;
|
|
122
|
+
`,Mt=({isLeft:e,isRight:a,heightOffset:t=0,width:l,header:r,list:i})=>ta($t,{$width:l,$columnHasHeader:!!r,children:[r&&aa(Pt,{children:r}),aa(At,{$gap:8,$isLeft:e,$isRight:a,$heightOffset:t,$columnHasHeader:!!r,children:i.length?i.length>1?aa(We,{gap:8,elements:i}):aa(la,{children:i[0]}):aa(Fe,{$height:"100%",children:aa(Ze,{})})})]}),Lt="75vw",Ot=fa.div`
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
border-radius: 16px;
|
|
126
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
`,zt=fa.div`
|
|
129
|
+
display: flex;
|
|
130
|
+
gap: 12px;
|
|
131
|
+
padding: 16px 16px 0 16px;
|
|
132
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
133
|
+
position: sticky;
|
|
134
|
+
top: 0;
|
|
135
|
+
`,Xt=fa.div`
|
|
136
|
+
padding: 12px 12px 0 12px;
|
|
137
|
+
`,Rt=fa.div`
|
|
138
|
+
display: flex;
|
|
139
|
+
gap: 12px;
|
|
140
|
+
padding: 16px;
|
|
141
|
+
`,Dt=fa.div`
|
|
142
|
+
padding: 5vh 10vw;
|
|
143
|
+
border-radius: 12px;
|
|
144
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
145
|
+
`,It=ma(({isOpen:t,withOverlay:l,disableAnimation:r,onClose:i,onBack:s,onNext:n,nextIsSkip:o,onSave:d,disableSave:c,connectionIds:u,header:p,subHeader:h,leftColumn:g,rightColumn:m,search:v,filters:f,errorMessage:b,isFormDirty:y,hideDirtyNote:x,isFetching:S,progress:C},k)=>{const[w,T]=pa(!1),[$,P]=pa(!1),[A,L]=pa(void 0);va(k,()=>({clearErrors:()=>L(void 0)}));const O=$,z=ca(()=>{y&&!w?T(!0):(T(!1),i?.())},[y,w,i]),X=c||$||"boolean"==typeof y&&!y,R=ca(async()=>{P(!0);const e=await d();P(!1),e?.error?L(e.error):(u?.setValue([]),i?.())},[d,u,i]),D=!!v||!!u||!!f,I=!!h,N=(D?48:0)+(I?50:0),E=ua(()=>S?{status:De.Info,message:"Fetching Data..."}:$&&!C?{status:De.Info,message:"Saving Changes..."}:A||b?{status:De.Error,message:A||b}:"boolean"==typeof y&&y&&!x?{status:De.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:"boolean"!=typeof y||y||x?void 0:{status:De.Success,message:"The values reflect the current configuration of the selected cluster."},[S,$,C,A,b,y,x]),H=ua(()=>s?{label:"Back",leftIcon:na,variant:a.Secondary,onClick:s}:{label:"Cancel",variant:a.Secondary,onClick:z,disabled:O},[s,z,O]),[B,V]=pa(!1),j=ua(()=>n?o?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:oa,variant:a.Secondary,onClick:()=>V(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:oa,variant:a.Primary,onClick:n}:{"data-id":"wide-drawer-save",label:"Save",variant:a.Primary,onClick:R,disabled:X},[n,o,R,X]);return ta(Ye,{width:Lt,isOpen:t,disableAnimation:r,hideOverlay:!$&&!l,header:{...p,onClose:i?z:void 0,onCloseDisabled:O},footer:{note:E,actions:[H,j]},children:[$?aa(Fe,{$height:"calc(100vh - 136px)",children:aa(Dt,{children:aa(_e,{titleSize:M.S,subTitleSize:M.XXXS,withGradient:!0,withSpinner:!0,...C})})}):ta(Ot,{children:[D&&ta(zt,{children:[u&&aa(Qe,{icon:da,title:"Selected Clusters",badge:{label:u.value.length}}),v&&aa(ea,{width:"100%",...v}),f]}),I&&aa(Xt,{children:aa(Qe,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),ta(Rt,{children:[aa(Mt,{isLeft:!0,heightOffset:N,...g}),aa(Mt,{isRight:!0,heightOffset:N,...m})]})]}),aa(ba,{isOpen:w,onClose:()=>T(!1),onApprove:z}),aa(e,{title:"Skip setup?",description:"Without completing setup, Odigos won't be able to collect and send your telemetry data. This may interrupt your data flow and limit the platform's ability to provide value.",isOpen:B,onClose:()=>V(!1),denyButton:{label:"Go Back",variant:a.Secondary,onClick:()=>V(!1)},approveButton:{label:"Skip",variant:a.Primary,onClick:()=>{n?.(),V(!1)}}})]})});It.displayName=It.name;export{ot as A,ba as C,xa as D,ka as N,qa as O,Ta as P,at as R,wt as S,Tt as U,It as W,Ca as a,dt as b,xt as c,it as d,Pa as e,Wa as f,ya as g,Lt as h,Sa as i,wa as j};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{forwardRef as i,useState as o,useRef as l,useImperativeHandle as r,useEffect as a,useLayoutEffect as s,useMemo as c,useCallback as d,Fragment as u,Children as h}from"react";import f,{useTheme as m}from"styled-components";import{c as p,d as g,T as v,e as y,f as b,h as x,i as w,E as S,I as k,F as $,j as C,k as T,l as z,m as I,B as N,a as F,n as P,o as E,p as O,q as R,S as L,r as D,s as M,P as A,t as B,v as W,b as X,L as V,w as Y,N as j,x as H,y as _,z as U,G as J,H as K,J as Z,O as G,K as q,M as Q,Q as ee,R as te,U as ne,V as ie,W as oe,X as le,Y as re,Z as ae,_ as se,g as ce,$ as de,a0 as ue,a1 as he,a2 as fe,a3 as me,a4 as pe,a5 as ge,a6 as ve,a7 as ye,a8 as be,a9 as xe,aa as we,ab as Se,ac as ke,ad as $e}from"./ui-components-DD1EWBzE.js";import{EditIcon as Ce,TrashIcon as Te,SearchIcon as ze,MinusIcon as Ie,PlusIcon as Ne,XIcon as Fe,ExpandIcon as Pe,CopyIcon as Ee,DotIcon as Oe,DownloadIcon as Re,RefreshIcon as Le,RefreshLeftArrowIcon as De}from"../icons.js";import{Y as Me}from"./index-D65aqUr3.js";const Ae=i(({children:i,width:a=640,title:s,titleTooltip:c,hideEditTitleFromEdit:d,icons:u,iconSrcs:h,isEdit:f=!1,isFormDirty:k=!1,isLastItem:$=!1,onClose:C,onEdit:T,onSave:z,onDelete:I,onCancel:N,tabs:F,headerActionButtons:P},E)=>{const O=m(),{drawerType:R,setDrawerType:L,setDrawerEntityId:D}=p();g({key:"Enter",active:f},()=>J());const[M,A]=o(!1),[B,W]=o(!1),X=l(null),V=R===S.Source,Y=()=>{A(!1),W(!1)},j=()=>{Y(),T&&T(!1),L(null),D(null),C?.()};r(E,()=>({closeDrawer:j}));const H=()=>{X.current?.clearTitle(),N&&N(),Y()},_=()=>{const e=X.current?.isTitleDirty();k||e?W(!0):H()},U=()=>{A(!0)},J=()=>{z&&z(X.current?.getTitle()||"")},K=P||[];return T&&!f&&K.push({"data-id":"drawer-edit",variant:"tertiary",onClick:()=>T(!0),children:e(t,{children:[n(Ce,{}),n(v,{size:14,family:"secondary",decoration:"underline",children:"Edit"})]})}),I&&!f&&K.push({"data-id":"drawer-delete",variant:"tertiary",onClick:U,children:e(t,{children:[n(Te,{}),n(v,{color:O.text.error,size:14,family:"secondary",decoration:"underline",children:V?y.UNINSTRUMENT:y.DELETE})]})}),e(t,{children:[n(b,{isOpen:!0,onClose:f?_:j,closeOnEscape:!M&&!B,width:"number"==typeof a?`${a+64}px`:a,header:{icons:u,iconSrcs:h,title:s,titleTooltip:c,replaceTitleWith:!d&&f?n(Be,{ref:X,title:s}):void 0,actionButtons:K,tabs:F},footer:{isOpen:f,leftButtons:[{"data-id":"drawer-save",variant:"primary",onClick:J,children:y.SAVE},{"data-id":"drawer-cancel",variant:"secondary",onClick:_,children:y.CANCEL}],rightButtons:I?[{"data-id":"drawer-delete",variant:"tertiary",onClick:U,children:e(t,{children:[n(Te,{}),n(v,{size:14,color:O.text.error,family:"secondary",decoration:"underline",children:y.DELETE})]})}]:[]},children:i}),n(x,{isOpen:M,noOverlay:!0,name:`${R}${s?` (${s})`:""}`,type:R,isLastItem:$,onApprove:()=>{I&&I(),Y()},onDeny:Y}),n(w,{isOpen:B,noOverlay:!0,name:"edit mode",onApprove:H,onDeny:Y})]})}),Be=i(({title:e},t)=>{const[i,l]=o(e);return a(()=>{l(e)},[e]),r(t,()=>({getTitle:()=>i||e,isTitleDirty:()=>i!==e,clearTitle:()=>l(e)})),n(k,{"data-id":"title",value:i,onChange:e=>l(e.target.value)})});function We(e,t){const n=e.names[t];if(null==n)return"";if("string"==typeof n)return n;if("object"==typeof n&&"name"in n){const e=n.name;if("string"==typeof e)return e}return"number"==typeof n||"boolean"==typeof n?String(n):""}function Xe(e){const t=Math.abs(e);return t>=1e9?`${Ve(e/1e9)}s`:t>=1e6?`${Ve(e/1e6)}ms`:t>=1e3?`${Ve(e/1e3)}μs`:String(Math.round(e))}function Ve(e){return e.toFixed(2).replace(/\.?0+$/,"")}function Ye(e){const t=[];for(let n=0;n<e.levels.length;n++){const i=e.levels[n];let o=0;for(let e=0;e+3<i.length;e+=4){const l=i[e],r=i[e+1],a=i[e+2],s=i[e+3],c=o+l;t.push({level:n,offset:c,size:r,self:a,nameIndex:s}),o=c+r}}return t}function je(e){return`${e.level}:${e.offset}:${e.size}:${e.nameIndex}`}function He(e,t){const n=t.trim().toLowerCase();return!n||e.toLowerCase().includes(n)}function _e(e,t,n,i,o,l={}){if(0===e.levels.length||t<2||n<2)return null;const{zoomRoot:r=null,shouldKeepName:a,collapseRecursive:s=!1}=l,c=Ye(e);let d=r?function(e,t){const n=e.reduce((e,t)=>Math.max(e,t.level),t.level),i=new Map;for(const t of e){const e=i.get(t.level);e?e.push(t):i.set(t.level,[t])}const o=[t];for(let e=t.level+1;e<=n;e++){const t=o.filter(t=>t.level===e-1);if(0===t.length)break;const n=i.get(e);if(n?.length)for(const e of n)for(const n of t)if(e.offset>=n.offset&&e.offset+e.size<=n.offset+n.size){o.push(e);break}}return o}(c,r):c;if(0===d.length)return null;if(a&&(d=d.filter(t=>a(We(e,t.nameIndex))),0===d.length))return null;if(s&&(d=function(e,t){if(0===t.length)return t;const n=[...t].sort((e,t)=>e.level-t.level||e.offset-t.offset),i=new Map;for(const e of n){const t=i.get(e.level);t?t.push(e):i.set(e.level,[e])}const o=new Set;for(const t of n){const n=i.get(t.level+1);if(!n)continue;const l=n.filter(e=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);if(1!==l.length)continue;const r=l[0];r.size===t.size&&We(e,r.nameIndex)===We(e,t.nameIndex)&&o.add(je(r))}if(0===o.size)return n;const l=[];for(const e of n){if(o.has(je(e)))continue;let t=0;for(let n=0;n<e.level;n++){const l=i.get(n);if(!l)continue;const r=l.find(t=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);r&&o.has(je(r))&&t++}l.push({...e,level:e.level-t})}return l}(e,d),0===d.length))return null;const u=r?.level??0,h=r?.offset??0,f=r?.size??e.numTicks;if(f<=0)return null;const m=d.reduce((e,t)=>Math.max(e,t.level-u),0)+1,p=i??Number.POSITIVE_INFINITY,g=Math.max(1,Math.min(n/m,p)),v=o.trim(),y=g>8?1:0;return d.map(n=>{const i=n.level-u,o=(n.offset-h)/f*t,l=Math.max(n.size/f*t,1),r=i*g,a=Math.max(g-y,1),s=We(e,n.nameIndex);return{...n,x:o,y:r,w:l,h:a,name:s,matchesSearch:He(s,v)}})}function Ue(e,t){let n=0;for(let t=0;t<e.length;t++)n=31*n+e.charCodeAt(t)>>>0;const i=t.v2.colors.black[500],o=[{fill:t.v2.colors.purple[300],text:i},{fill:t.v2.colors.green[300],text:i},{fill:t.v2.colors.red[300],text:i},{fill:t.v2.colors.blue[300],text:i},{fill:t.v2.colors.yellow[300],text:i}];return o[n%o.length]}Be.displayName=Be.name,Ae.displayName=Ae.name;var Je,Ke;!function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(Je||(Je={})),function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(Ke||(Ke={}));function Ze(e,t){return t<=0?"0":(100*e/t).toFixed(e/t<.001?2:1)}function Ge(e,t,n){for(const i of n)if(e>=i.x&&e<i.x+i.w&&t>=i.y&&t<i.y+i.h)return i;return null}function qe(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}const Qe=({flamebearer:t,maxRowPx:i,searchQuery:r="",shouldKeepName:u,minHostHeight:h=200,onFullscreenChange:f,profilingSlots:p})=>{const g=m(),v=l(null),y=l(null),b=l({x:0,y:0}),x=l(t.numTicks),[w,S]=o({w:0,h:0}),[k,A]=o(""),[B,W]=o(null),[X,V]=o([]),[Y,j]=o(!1),[H,_]=o(Je.Fit),[U,J]=o(Ke.Fit),[K,Z]=o(!1),G=Math.max(1,Math.min(Math.floor(w.w*H),8192)),q=Math.max(1,Math.min(Math.floor(w.h*U),8192)),Q=X.length>0?X[X.length-1]:null,ee=Q?.size??t.numTicks;a(()=>{x.current!==t.numTicks&&(x.current=t.numTicks,V([]))},[t.numTicks]),s(()=>{const e=v.current;if(!e)return;const t=new ResizeObserver(()=>{const t=e.getBoundingClientRect();S({w:Math.floor(t.width),h:Math.floor(t.height)})});return t.observe(e),()=>t.disconnect()},[]),a(()=>{if(!Y)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Y]),a(()=>(f?.(Y),()=>{Y&&f?.(!1)}),[Y,f]);const te=c(()=>_e(t,G,q,i,r,{zoomRoot:Q,shouldKeepName:u,collapseRecursive:K}),[t,i,r,q,G,Q,u,K]),ne=c(()=>function(e){return[...e].sort((e,t)=>t.level-e.level)}(te?.length?r.trim()?te.filter(e=>e.matchesSearch):te:[]),[te,r]),ie=d(e=>{if(G<2||q<2)return;const n=e.currentTarget.getBoundingClientRect();if(n.width<1||n.height<1)return;const i=Ge((e.clientX-n.left)/n.width*G,(e.clientY-n.top)/n.height*q,ne);if(i){const e=je(i);W(e);const n=ee>0?(100*i.size/ee).toFixed(1):"0",o=t.numTicks>0?(100*i.size/t.numTicks).toFixed(1):"0";A(`${i.name}\ntotal ${Xe(i.size)} (${n}% of view, ${o}% of profile) · self ${Xe(i.self)}`)}else W(null),A("")},[ne,t.numTicks,q,G,ee]),oe=d(e=>{ie(e)},[ie]),le=d(()=>{W(null),A("")},[]),re=d(e=>{b.current={x:e.clientX,y:e.clientY}},[]),ae=d(e=>{const{x:t,y:n}=b.current;if(Math.abs(e.clientX-t)>3||Math.abs(e.clientY-n)>3)return;if(G<2||q<2)return;const i=e.currentTarget.getBoundingClientRect();if(i.width<1||i.height<1)return;const o=Ge((e.clientX-i.left)/i.width*G,(e.clientY-i.top)/i.height*q,ne);if(!o)return;const l=function(e){return{level:e.level,offset:e.offset,size:e.size,self:e.self,nameIndex:e.nameIndex}}(o);V(e=>{const t=e.length>0?e[e.length-1]:null;return t&&function(e,t){return e.level===t.level&&e.offset===t.offset&&e.size===t.size&&e.nameIndex===t.nameIndex}(l,t)?e.slice(0,-1):[...e,l]})},[ne,q,G]);s(()=>{const e=y.current;if(!e||G<2||q<2)return;const n="undefined"!=typeof window&&window.devicePixelRatio||1,i=Math.max(G,q),o=Math.min(n,16384/i);e.width=Math.floor(G*o),e.height=Math.floor(q*o),e.style.width=`${G}px`,e.style.height=`${q}px`;const l=e.getContext("2d");l&&(l.setTransform(o,0,0,o,0,0),l.clearRect(0,0,G,q),te?.length?function(e,t,n,i,o,l,r,a){const s=l.v2.colors.silver[900];e.fillStyle=s,e.fillRect(0,0,t,n);const c=o.trim().length>0;e.textRendering="optimizeLegibility";for(const t of i){const{x:n,y:i,w:o,h:r,name:s,size:d,matchesSearch:u}=t;if(c&&!u)continue;const{fill:h,text:f}=Ue(s,l);e.fillStyle=h,e.fillRect(n,i,o,r),e.strokeStyle="rgba(255,255,255,0.14)",e.lineWidth=1,e.beginPath(),e.moveTo(n+.5,i+.5),e.lineTo(n+o-.5,i+.5),e.stroke(),e.strokeStyle="rgba(0,0,0,0.45)",e.lineWidth=1,e.strokeRect(n+.5,i+.5,Math.max(o-1,0),Math.max(r-1,0));const m=Ze(d,a),p=`${s} (${Xe(d)}, ${m}%)`,g=l.v2.text.size.xs,v=8,y=5,b=26,x=Math.min(g,Math.floor(r-2));if(o>=b&&x>=v){e.font=`${x}px ${l.font_family.primary}, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,e.textBaseline="middle",e.textAlign="left";let t=p;for(;t.length>2&&e.measureText(t).width>o-2*y;)t=`${t.slice(0,-2)}…`;e.measureText(t).width<=o-2*y&&(e.lineWidth=1,e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineJoin="round",e.miterLimit=1,e.strokeText(t,n+y,i+r/2),e.fillStyle=f,e.fillText(t,n+y,i+r/2))}}if(r)for(const t of i){if(je(t)!==r)continue;if(c&&!t.matchesSearch)continue;const{x:n,y:i,w:o,h:l}=t;e.strokeStyle="rgba(255,255,255,0.88)",e.lineWidth=2,e.strokeRect(n+1,i+1,Math.max(o-2,0),Math.max(l-2,0));break}}(l,G,q,te,r,g,B,t.numTicks):(l.fillStyle=g.v2.colors.silver[900],l.fillRect(0,0,G,q)))},[te,t.numTicks,B,r,q,G,g]);const se=d(()=>j(e=>!e),[]),ce=t.numTicks>0?Math.max(0,Math.min(100,Math.round(ee/t.numTicks*100))):100,de=c(()=>function(e,t){const n=Ye(e),i=t?.offset??0,o=i+(t?.size??e.numTicks),l=(t?.level??-1)+1,r=t?.size??e.numTicks;let a=null;for(const e of n)e.level<l||e.offset<i||e.offset+e.size>o||e.size>=r||(!a||e.size>a.size||e.size===a.size&&e.level<a.level)&&(a=e);return a}(t,Q),[t,Q]),ue=null!==de,he=X.length>0,fe=Q?We(t,Q.nameIndex):"",me=d(()=>V([]),[]),pe=d(()=>V(e=>e.slice(0,-1)),[]),ge=d(()=>{de&&V(e=>[...e,de])},[de]);return e("div",{style:Y?{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",gap:8,padding:16,background:g.v2.colors.silver[900]}:{flex:1,minHeight:h,minWidth:0,width:"100%",display:"flex",flexDirection:"column",gap:8,position:"relative"},children:[e($,{$gap:8,$wrap:"nowrap",$justifyContent:"space-between",children:[n(C,{label:"Collapse recursive",tooltip:"Collapse straight-line recursion (parent → single same-name child of equal width) into a single bar. Helps deep recursive call chains fit on screen.",labelAlign:z.Left,size:T.S,value:K,onChange:Z}),e($,{$gap:8,children:[e($,{children:[n(I,{variant:F.Secondary,size:N.S,label:"Reset zoom",leftIcon:ze,onClick:me,disabled:!X.length}),n(I,{variant:F.Secondary,size:N.S,iconSize:20,leftIcon:Ie,tooltip:"Zoom out",hideTooltipIcon:!0,disabled:!he,onClick:pe}),n("div",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:n(P,{size:O.XXS,color:E.Secondary,nowrap:!0,align:"center",children:`${ce}%`})}),n(I,{variant:F.Secondary,size:N.S,iconSize:20,leftIcon:Ne,tooltip:"Zoom in",hideTooltipIcon:!0,disabled:!ue,onClick:ge})]}),e($,{children:[n(R,{text:"Horizontal width: stretch the canvas wider than the viewport so narrow stacks become hoverable / readable.",children:n(L,{size:M.S,variant:D.Filled,options:[{value:Je.Fit,label:"W: Fit"},{value:Je.X10,label:"10x"}],selected:H,setSelected:_})}),n(R,{text:"Vertical height: scale rows taller than the viewport for deep call stacks. Scroll vertically to navigate.",children:n(L,{size:M.S,variant:D.Filled,options:[{value:Ke.Fit,label:"H: Fit"},{value:Ke.X10,label:"10x"}],selected:U,setSelected:J})})]}),n(I,{variant:F.Secondary,size:N.S,iconSize:24,leftIcon:Y?Fe:Pe,tooltip:Y?"Exit fullscreen (Esc)":"Fullscreen",hideTooltipIcon:!0,onClick:se})]})]}),n(R,{fullWidth:!0,keepAlive:!0,text:k,children:n("div",{ref:v,style:{flex:1,minWidth:0,width:"100%",height:Y?"calc(100vh - 80px)":"calc(100vh - 370px)",position:"relative",overflowX:H>1?"auto":"hidden",overflowY:U>1?"auto":"hidden"},children:n("div",{style:{width:G||"100%",height:q||"100%",position:"relative"},children:n("canvas",{ref:y,style:{display:"block",position:"absolute",left:0,top:0,width:"100%",height:"100%",borderRadius:8,cursor:B?"pointer":"default"},onPointerDown:re,onPointerMove:oe,onPointerLeave:le,onClick:ae})})})}),e($,{$justifyContent:"space-between",children:[n(P,Q?{size:O.XXXS,color:g.v2.colors.silver[300],children:`Zoomed: ${fe} • ${Xe(ee)} samples in view`}:{size:O.XXXS,color:g.v2.colors.silver[300],children:"Click a frame to zoom into its subtree (pprof-style)."}),p&&n(P,{size:O.XXXS,color:g.v2.colors.silver[300],children:`${p.activeKeys.length} / ${p.maxSlots} profiling slots · ${qe(p.totalBytesUsed)} / ${qe(p.maxTotalBytesBudget)} budget · TTL ${p.slotTtlSeconds}s`})]})]})};var et,tt;!function(e){e.Symbol="symbol",e.Self="self",e.Total="total"}(et||(et={})),function(e){e.FilterOutVoid="filter-out-void",e.OnlyWithReturnValues="only-with-return-values"}(tt||(tt={}));const nt=/^[A-Za-z_$][A-Za-z0-9_$]*(\[\])*$/;function it(e,t){const n=function(e){return e.split(" ")[0]??""}(e);if(t.includes(tt.FilterOutVoid)&&"void"===n)return!1;if(t.includes(tt.OnlyWithReturnValues)){if(!(e.includes(" ")&&"void"!==n&&nt.test(n)))return!1}return!0}const ot={options:[{id:tt.FilterOutVoid,label:"Filter out void symbols"},{id:tt.OnlyWithReturnValues,label:"Only show functions with return values"}],filterRow:(e,t)=>it(e.cells.find(e=>e.key===et.Symbol)?.rawValue?.toString()??"",t)},lt=({rows:e,languages:t,filters:i,onFiltersChange:o})=>{const l=c(()=>[{key:et.Symbol,label:"Symbol",flex:"0 0 160px",filterOverride:t?.includes(A.Java)?ot:void 0,noFilter:!t?.includes(A.Java)},{key:et.Self,label:"Self",tooltip:"Time spent in this function itself, excluding time in functions it calls.",textAlign:"right",noFilter:!0},{key:et.Total,label:"Total",tooltip:"Time spent in this function and all functions it calls (inclusive).",textAlign:"right",noFilter:!0}],[t]),r=c(()=>e.map(e=>({cells:[{key:et.Symbol,rawValue:e.name},{key:et.Self,rawValue:Xe(e.self)},{key:et.Total,rawValue:Xe(e.total)}]})),[e]);return n(B,{variant:W.Data,maxHeight:"calc(100vh - 306px)",columns:l,rows:r,filters:i,onFiltersChange:o,rowActionsPushLeftPosition:"12px",getRowActions:e=>[{id:`copy-${e.cells[0].rawValue}`,label:"",rightIcon:Ee,onClick:()=>{navigator.clipboard.writeText(e.cells[0].rawValue)}}]})};var rt;!function(e){e.Table="table",e.Flame="flame",e.Both="both"}(rt||(rt={}));const at=f(_)`
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{forwardRef as i,useState as o,useRef as l,useImperativeHandle as r,useEffect as a,useLayoutEffect as s,useMemo as c,useCallback as d,Fragment as u,Children as h}from"react";import f,{useTheme as m}from"styled-components";import{c as p,d as g,T as v,e as y,f as b,h as x,i as w,E as S,I as k,F as $,j as C,k as T,l as z,m as I,B as N,a as F,n as P,o as E,p as O,q as R,S as L,r as D,s as M,P as A,t as B,v as W,b as X,L as V,w as Y,N as j,x as H,y as _,z as U,G as J,H as K,J as Z,O as G,K as q,M as Q,Q as ee,R as te,U as ne,V as ie,W as oe,X as le,Y as re,Z as ae,_ as se,g as ce,$ as de,a0 as ue,a1 as he,a2 as fe,a3 as me,a4 as pe,a5 as ge,a6 as ve,a7 as ye,a8 as be,a9 as xe,aa as we,ab as Se,ac as ke,ad as $e}from"./ui-components-B4It5sfa.js";import{EditIcon as Ce,TrashIcon as Te,SearchIcon as ze,MinusIcon as Ie,PlusIcon as Ne,XIcon as Fe,ExpandIcon as Pe,CopyIcon as Ee,DotIcon as Oe,DownloadIcon as Re,RefreshIcon as Le,RefreshLeftArrowIcon as De}from"../icons.js";import{Y as Me}from"./index-BmuiyBxZ.js";const Ae=i(({children:i,width:a=640,title:s,titleTooltip:c,hideEditTitleFromEdit:d,icons:u,iconSrcs:h,isEdit:f=!1,isFormDirty:k=!1,isLastItem:$=!1,onClose:C,onEdit:T,onSave:z,onDelete:I,onCancel:N,tabs:F,headerActionButtons:P},E)=>{const O=m(),{drawerType:R,setDrawerType:L,setDrawerEntityId:D}=p();g({key:"Enter",active:f},()=>J());const[M,A]=o(!1),[B,W]=o(!1),X=l(null),V=R===S.Source,Y=()=>{A(!1),W(!1)},j=()=>{Y(),T&&T(!1),L(null),D(null),C?.()};r(E,()=>({closeDrawer:j}));const H=()=>{X.current?.clearTitle(),N&&N(),Y()},_=()=>{const e=X.current?.isTitleDirty();k||e?W(!0):H()},U=()=>{A(!0)},J=()=>{z&&z(X.current?.getTitle()||"")},K=P||[];return T&&!f&&K.push({"data-id":"drawer-edit",variant:"tertiary",onClick:()=>T(!0),children:e(t,{children:[n(Ce,{}),n(v,{size:14,family:"secondary",decoration:"underline",children:"Edit"})]})}),I&&!f&&K.push({"data-id":"drawer-delete",variant:"tertiary",onClick:U,children:e(t,{children:[n(Te,{}),n(v,{color:O.text.error,size:14,family:"secondary",decoration:"underline",children:V?y.UNINSTRUMENT:y.DELETE})]})}),e(t,{children:[n(b,{isOpen:!0,onClose:f?_:j,closeOnEscape:!M&&!B,width:"number"==typeof a?`${a+64}px`:a,header:{icons:u,iconSrcs:h,title:s,titleTooltip:c,replaceTitleWith:!d&&f?n(Be,{ref:X,title:s}):void 0,actionButtons:K,tabs:F},footer:{isOpen:f,leftButtons:[{"data-id":"drawer-save",variant:"primary",onClick:J,children:y.SAVE},{"data-id":"drawer-cancel",variant:"secondary",onClick:_,children:y.CANCEL}],rightButtons:I?[{"data-id":"drawer-delete",variant:"tertiary",onClick:U,children:e(t,{children:[n(Te,{}),n(v,{size:14,color:O.text.error,family:"secondary",decoration:"underline",children:y.DELETE})]})}]:[]},children:i}),n(x,{isOpen:M,noOverlay:!0,name:`${R}${s?` (${s})`:""}`,type:R,isLastItem:$,onApprove:()=>{I&&I(),Y()},onDeny:Y}),n(w,{isOpen:B,noOverlay:!0,name:"edit mode",onApprove:H,onDeny:Y})]})}),Be=i(({title:e},t)=>{const[i,l]=o(e);return a(()=>{l(e)},[e]),r(t,()=>({getTitle:()=>i||e,isTitleDirty:()=>i!==e,clearTitle:()=>l(e)})),n(k,{"data-id":"title",value:i,onChange:e=>l(e.target.value)})});function We(e,t){const n=e.names[t];if(null==n)return"";if("string"==typeof n)return n;if("object"==typeof n&&"name"in n){const e=n.name;if("string"==typeof e)return e}return"number"==typeof n||"boolean"==typeof n?String(n):""}function Xe(e){const t=Math.abs(e);return t>=1e9?`${Ve(e/1e9)}s`:t>=1e6?`${Ve(e/1e6)}ms`:t>=1e3?`${Ve(e/1e3)}μs`:String(Math.round(e))}function Ve(e){return e.toFixed(2).replace(/\.?0+$/,"")}function Ye(e){const t=[];for(let n=0;n<e.levels.length;n++){const i=e.levels[n];let o=0;for(let e=0;e+3<i.length;e+=4){const l=i[e],r=i[e+1],a=i[e+2],s=i[e+3],c=o+l;t.push({level:n,offset:c,size:r,self:a,nameIndex:s}),o=c+r}}return t}function je(e){return`${e.level}:${e.offset}:${e.size}:${e.nameIndex}`}function He(e,t){const n=t.trim().toLowerCase();return!n||e.toLowerCase().includes(n)}function _e(e,t,n,i,o,l={}){if(0===e.levels.length||t<2||n<2)return null;const{zoomRoot:r=null,shouldKeepName:a,collapseRecursive:s=!1}=l,c=Ye(e);let d=r?function(e,t){const n=e.reduce((e,t)=>Math.max(e,t.level),t.level),i=new Map;for(const t of e){const e=i.get(t.level);e?e.push(t):i.set(t.level,[t])}const o=[t];for(let e=t.level+1;e<=n;e++){const t=o.filter(t=>t.level===e-1);if(0===t.length)break;const n=i.get(e);if(n?.length)for(const e of n)for(const n of t)if(e.offset>=n.offset&&e.offset+e.size<=n.offset+n.size){o.push(e);break}}return o}(c,r):c;if(0===d.length)return null;if(a&&(d=d.filter(t=>a(We(e,t.nameIndex))),0===d.length))return null;if(s&&(d=function(e,t){if(0===t.length)return t;const n=[...t].sort((e,t)=>e.level-t.level||e.offset-t.offset),i=new Map;for(const e of n){const t=i.get(e.level);t?t.push(e):i.set(e.level,[e])}const o=new Set;for(const t of n){const n=i.get(t.level+1);if(!n)continue;const l=n.filter(e=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);if(1!==l.length)continue;const r=l[0];r.size===t.size&&We(e,r.nameIndex)===We(e,t.nameIndex)&&o.add(je(r))}if(0===o.size)return n;const l=[];for(const e of n){if(o.has(je(e)))continue;let t=0;for(let n=0;n<e.level;n++){const l=i.get(n);if(!l)continue;const r=l.find(t=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);r&&o.has(je(r))&&t++}l.push({...e,level:e.level-t})}return l}(e,d),0===d.length))return null;const u=r?.level??0,h=r?.offset??0,f=r?.size??e.numTicks;if(f<=0)return null;const m=d.reduce((e,t)=>Math.max(e,t.level-u),0)+1,p=i??Number.POSITIVE_INFINITY,g=Math.max(1,Math.min(n/m,p)),v=o.trim(),y=g>8?1:0;return d.map(n=>{const i=n.level-u,o=(n.offset-h)/f*t,l=Math.max(n.size/f*t,1),r=i*g,a=Math.max(g-y,1),s=We(e,n.nameIndex);return{...n,x:o,y:r,w:l,h:a,name:s,matchesSearch:He(s,v)}})}function Ue(e,t){let n=0;for(let t=0;t<e.length;t++)n=31*n+e.charCodeAt(t)>>>0;const i=t.v2.colors.black[500],o=[{fill:t.v2.colors.purple[300],text:i},{fill:t.v2.colors.green[300],text:i},{fill:t.v2.colors.red[300],text:i},{fill:t.v2.colors.blue[300],text:i},{fill:t.v2.colors.yellow[300],text:i}];return o[n%o.length]}Be.displayName=Be.name,Ae.displayName=Ae.name;var Je,Ke;!function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(Je||(Je={})),function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(Ke||(Ke={}));function Ze(e,t){return t<=0?"0":(100*e/t).toFixed(e/t<.001?2:1)}function Ge(e,t,n){for(const i of n)if(e>=i.x&&e<i.x+i.w&&t>=i.y&&t<i.y+i.h)return i;return null}function qe(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}const Qe=({flamebearer:t,maxRowPx:i,searchQuery:r="",shouldKeepName:u,minHostHeight:h=200,onFullscreenChange:f,profilingSlots:p})=>{const g=m(),v=l(null),y=l(null),b=l({x:0,y:0}),x=l(t.numTicks),[w,S]=o({w:0,h:0}),[k,A]=o(""),[B,W]=o(null),[X,V]=o([]),[Y,j]=o(!1),[H,_]=o(Je.Fit),[U,J]=o(Ke.Fit),[K,Z]=o(!1),G=Math.max(1,Math.min(Math.floor(w.w*H),8192)),q=Math.max(1,Math.min(Math.floor(w.h*U),8192)),Q=X.length>0?X[X.length-1]:null,ee=Q?.size??t.numTicks;a(()=>{x.current!==t.numTicks&&(x.current=t.numTicks,V([]))},[t.numTicks]),s(()=>{const e=v.current;if(!e)return;const t=new ResizeObserver(()=>{const t=e.getBoundingClientRect();S({w:Math.floor(t.width),h:Math.floor(t.height)})});return t.observe(e),()=>t.disconnect()},[]),a(()=>{if(!Y)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Y]),a(()=>(f?.(Y),()=>{Y&&f?.(!1)}),[Y,f]);const te=c(()=>_e(t,G,q,i,r,{zoomRoot:Q,shouldKeepName:u,collapseRecursive:K}),[t,i,r,q,G,Q,u,K]),ne=c(()=>function(e){return[...e].sort((e,t)=>t.level-e.level)}(te?.length?r.trim()?te.filter(e=>e.matchesSearch):te:[]),[te,r]),ie=d(e=>{if(G<2||q<2)return;const n=e.currentTarget.getBoundingClientRect();if(n.width<1||n.height<1)return;const i=Ge((e.clientX-n.left)/n.width*G,(e.clientY-n.top)/n.height*q,ne);if(i){const e=je(i);W(e);const n=ee>0?(100*i.size/ee).toFixed(1):"0",o=t.numTicks>0?(100*i.size/t.numTicks).toFixed(1):"0";A(`${i.name}\ntotal ${Xe(i.size)} (${n}% of view, ${o}% of profile) · self ${Xe(i.self)}`)}else W(null),A("")},[ne,t.numTicks,q,G,ee]),oe=d(e=>{ie(e)},[ie]),le=d(()=>{W(null),A("")},[]),re=d(e=>{b.current={x:e.clientX,y:e.clientY}},[]),ae=d(e=>{const{x:t,y:n}=b.current;if(Math.abs(e.clientX-t)>3||Math.abs(e.clientY-n)>3)return;if(G<2||q<2)return;const i=e.currentTarget.getBoundingClientRect();if(i.width<1||i.height<1)return;const o=Ge((e.clientX-i.left)/i.width*G,(e.clientY-i.top)/i.height*q,ne);if(!o)return;const l=function(e){return{level:e.level,offset:e.offset,size:e.size,self:e.self,nameIndex:e.nameIndex}}(o);V(e=>{const t=e.length>0?e[e.length-1]:null;return t&&function(e,t){return e.level===t.level&&e.offset===t.offset&&e.size===t.size&&e.nameIndex===t.nameIndex}(l,t)?e.slice(0,-1):[...e,l]})},[ne,q,G]);s(()=>{const e=y.current;if(!e||G<2||q<2)return;const n="undefined"!=typeof window&&window.devicePixelRatio||1,i=Math.max(G,q),o=Math.min(n,16384/i);e.width=Math.floor(G*o),e.height=Math.floor(q*o),e.style.width=`${G}px`,e.style.height=`${q}px`;const l=e.getContext("2d");l&&(l.setTransform(o,0,0,o,0,0),l.clearRect(0,0,G,q),te?.length?function(e,t,n,i,o,l,r,a){const s=l.v2.colors.silver[900];e.fillStyle=s,e.fillRect(0,0,t,n);const c=o.trim().length>0;e.textRendering="optimizeLegibility";for(const t of i){const{x:n,y:i,w:o,h:r,name:s,size:d,matchesSearch:u}=t;if(c&&!u)continue;const{fill:h,text:f}=Ue(s,l);e.fillStyle=h,e.fillRect(n,i,o,r),e.strokeStyle="rgba(255,255,255,0.14)",e.lineWidth=1,e.beginPath(),e.moveTo(n+.5,i+.5),e.lineTo(n+o-.5,i+.5),e.stroke(),e.strokeStyle="rgba(0,0,0,0.45)",e.lineWidth=1,e.strokeRect(n+.5,i+.5,Math.max(o-1,0),Math.max(r-1,0));const m=Ze(d,a),p=`${s} (${Xe(d)}, ${m}%)`,g=l.v2.text.size.xs,v=8,y=5,b=26,x=Math.min(g,Math.floor(r-2));if(o>=b&&x>=v){e.font=`${x}px ${l.font_family.primary}, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,e.textBaseline="middle",e.textAlign="left";let t=p;for(;t.length>2&&e.measureText(t).width>o-2*y;)t=`${t.slice(0,-2)}…`;e.measureText(t).width<=o-2*y&&(e.lineWidth=1,e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineJoin="round",e.miterLimit=1,e.strokeText(t,n+y,i+r/2),e.fillStyle=f,e.fillText(t,n+y,i+r/2))}}if(r)for(const t of i){if(je(t)!==r)continue;if(c&&!t.matchesSearch)continue;const{x:n,y:i,w:o,h:l}=t;e.strokeStyle="rgba(255,255,255,0.88)",e.lineWidth=2,e.strokeRect(n+1,i+1,Math.max(o-2,0),Math.max(l-2,0));break}}(l,G,q,te,r,g,B,t.numTicks):(l.fillStyle=g.v2.colors.silver[900],l.fillRect(0,0,G,q)))},[te,t.numTicks,B,r,q,G,g]);const se=d(()=>j(e=>!e),[]),ce=t.numTicks>0?Math.max(0,Math.min(100,Math.round(ee/t.numTicks*100))):100,de=c(()=>function(e,t){const n=Ye(e),i=t?.offset??0,o=i+(t?.size??e.numTicks),l=(t?.level??-1)+1,r=t?.size??e.numTicks;let a=null;for(const e of n)e.level<l||e.offset<i||e.offset+e.size>o||e.size>=r||(!a||e.size>a.size||e.size===a.size&&e.level<a.level)&&(a=e);return a}(t,Q),[t,Q]),ue=null!==de,he=X.length>0,fe=Q?We(t,Q.nameIndex):"",me=d(()=>V([]),[]),pe=d(()=>V(e=>e.slice(0,-1)),[]),ge=d(()=>{de&&V(e=>[...e,de])},[de]);return e("div",{style:Y?{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",gap:8,padding:16,background:g.v2.colors.silver[900]}:{flex:1,minHeight:h,minWidth:0,width:"100%",display:"flex",flexDirection:"column",gap:8,position:"relative"},children:[e($,{$gap:8,$wrap:"nowrap",$justifyContent:"space-between",children:[n(C,{label:"Collapse recursive",tooltip:"Collapse straight-line recursion (parent → single same-name child of equal width) into a single bar. Helps deep recursive call chains fit on screen.",labelAlign:z.Left,size:T.S,value:K,onChange:Z}),e($,{$gap:8,children:[e($,{children:[n(I,{variant:F.Secondary,size:N.S,label:"Reset zoom",leftIcon:ze,onClick:me,disabled:!X.length}),n(I,{variant:F.Secondary,size:N.S,iconSize:20,leftIcon:Ie,tooltip:"Zoom out",hideTooltipIcon:!0,disabled:!he,onClick:pe}),n("div",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:n(P,{size:O.XXS,color:E.Secondary,nowrap:!0,align:"center",children:`${ce}%`})}),n(I,{variant:F.Secondary,size:N.S,iconSize:20,leftIcon:Ne,tooltip:"Zoom in",hideTooltipIcon:!0,disabled:!ue,onClick:ge})]}),e($,{children:[n(R,{text:"Horizontal width: stretch the canvas wider than the viewport so narrow stacks become hoverable / readable.",children:n(L,{size:M.S,variant:D.Filled,options:[{value:Je.Fit,label:"W: Fit"},{value:Je.X10,label:"10x"}],selected:H,setSelected:_})}),n(R,{text:"Vertical height: scale rows taller than the viewport for deep call stacks. Scroll vertically to navigate.",children:n(L,{size:M.S,variant:D.Filled,options:[{value:Ke.Fit,label:"H: Fit"},{value:Ke.X10,label:"10x"}],selected:U,setSelected:J})})]}),n(I,{variant:F.Secondary,size:N.S,iconSize:24,leftIcon:Y?Fe:Pe,tooltip:Y?"Exit fullscreen (Esc)":"Fullscreen",hideTooltipIcon:!0,onClick:se})]})]}),n(R,{fullWidth:!0,keepAlive:!0,text:k,children:n("div",{ref:v,style:{flex:1,minWidth:0,width:"100%",height:Y?"calc(100vh - 80px)":"calc(100vh - 370px)",position:"relative",overflowX:H>1?"auto":"hidden",overflowY:U>1?"auto":"hidden"},children:n("div",{style:{width:G||"100%",height:q||"100%",position:"relative"},children:n("canvas",{ref:y,style:{display:"block",position:"absolute",left:0,top:0,width:"100%",height:"100%",borderRadius:8,cursor:B?"pointer":"default"},onPointerDown:re,onPointerMove:oe,onPointerLeave:le,onClick:ae})})})}),e($,{$justifyContent:"space-between",children:[n(P,Q?{size:O.XXXS,color:g.v2.colors.silver[300],children:`Zoomed: ${fe} • ${Xe(ee)} samples in view`}:{size:O.XXXS,color:g.v2.colors.silver[300],children:"Click a frame to zoom into its subtree (pprof-style)."}),p&&n(P,{size:O.XXXS,color:g.v2.colors.silver[300],children:`${p.activeKeys.length} / ${p.maxSlots} profiling slots · ${qe(p.totalBytesUsed)} / ${qe(p.maxTotalBytesBudget)} budget · TTL ${p.slotTtlSeconds}s`})]})]})};var et,tt;!function(e){e.Symbol="symbol",e.Self="self",e.Total="total"}(et||(et={})),function(e){e.FilterOutVoid="filter-out-void",e.OnlyWithReturnValues="only-with-return-values"}(tt||(tt={}));const nt=/^[A-Za-z_$][A-Za-z0-9_$]*(\[\])*$/;function it(e,t){const n=function(e){return e.split(" ")[0]??""}(e);if(t.includes(tt.FilterOutVoid)&&"void"===n)return!1;if(t.includes(tt.OnlyWithReturnValues)){if(!(e.includes(" ")&&"void"!==n&&nt.test(n)))return!1}return!0}const ot={options:[{id:tt.FilterOutVoid,label:"Filter out void symbols"},{id:tt.OnlyWithReturnValues,label:"Only show functions with return values"}],filterRow:(e,t)=>it(e.cells.find(e=>e.key===et.Symbol)?.rawValue?.toString()??"",t)},lt=({rows:e,languages:t,filters:i,onFiltersChange:o})=>{const l=c(()=>[{key:et.Symbol,label:"Symbol",flex:"0 0 160px",filterOverride:t?.includes(A.Java)?ot:void 0,noFilter:!t?.includes(A.Java)},{key:et.Self,label:"Self",tooltip:"Time spent in this function itself, excluding time in functions it calls.",textAlign:"right",noFilter:!0},{key:et.Total,label:"Total",tooltip:"Time spent in this function and all functions it calls (inclusive).",textAlign:"right",noFilter:!0}],[t]),r=c(()=>e.map(e=>({cells:[{key:et.Symbol,rawValue:e.name},{key:et.Self,rawValue:Xe(e.self)},{key:et.Total,rawValue:Xe(e.total)}]})),[e]);return n(B,{variant:W.Data,maxHeight:"calc(100vh - 306px)",columns:l,rows:r,filters:i,onFiltersChange:o,rowActionsPushLeftPosition:"12px",getRowActions:e=>[{id:`copy-${e.cells[0].rawValue}`,label:"",rightIcon:Ee,onClick:()=>{navigator.clipboard.writeText(e.cells[0].rawValue)}}]})};var rt;!function(e){e.Table="table",e.Flame="flame",e.Both="both"}(rt||(rt={}));const at=f(_)`
|
|
2
2
|
width: 100%;
|
|
3
3
|
min-height: 0;
|
|
4
4
|
flex: 1;
|