@kylincloud/flamegraph 0.35.26 → 0.35.27

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.
@@ -14,5 +14,5 @@ function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a<t;a
14
14
  Copyright (c) 2018 Jed Watson.
15
15
  Licensed under the MIT License (MIT), see
16
16
  http://jedwatson.github.io/classnames
17
- */var cs,fs=(ss||(ss=1,function(e){!function(){var t={}.hasOwnProperty;function a(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=r(e,n(a)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var o in e)t.call(e,o)&&e[o]&&(n=r(n,o));return n}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(a.default=a,e.exports=a):window.classNames=a}()}(ls)),ls.exports),us=h(fs),ds={};function hs(){return cs||(cs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="crosshairs",a=[],n="f05b",r="M288-16c17.7 0 32 14.3 32 32l0 18.3c98.1 14 175.7 91.6 189.7 189.7l18.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-18.3 0c-14 98.1-91.6 175.7-189.7 189.7l0 18.3c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-18.3C157.9 463.7 80.3 386.1 66.3 288L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l18.3 0C80.3 125.9 157.9 48.3 256 34.3L256 16c0-17.7 14.3-32 32-32zM131.2 288c12.7 62.7 62.1 112.1 124.8 124.8l0-12.8c0-17.7 14.3-32 32-32s32 14.3 32 32l0 12.8c62.7-12.7 112.1-62.1 124.8-124.8L432 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l12.8 0C432.1 161.3 382.7 111.9 320 99.2l0 12.8c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-12.8C193.3 111.9 143.9 161.3 131.2 224l12.8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-12.8 0zM288 208a48 48 0 1 1 0 96 48 48 0 1 1 0-96z";e.definition={prefix:"fas",iconName:t,icon:[576,512,a,n,r]},e.faCrosshairs=e.definition,e.prefix="fas",e.iconName=t,e.width=576,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(ds)),ds}var ms,ps=hs(),gs={};function vs(){return ms||(ms=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-left",a=[9001],n="f053",r="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,a,n,r]},e.faChevronLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(gs)),gs}var bs,ys=vs(),xs={};function ws(){return bs||(bs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-right",a=[9002],n="f054",r="M311.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L243.2 256 73.9 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,a,n,r]},e.faChevronRight=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(xs)),xs}var js=ws(),ks={table:"Table-module_table__6A8SM",sortable:"Table-module_sortable__J6kyp",sortArrow:"Table-module_sortArrow__Nrncn",asc:"Table-module_asc__tJDI9",desc:"Table-module_desc__fjVRY",isRowSelected:"Table-module_isRowSelected__UhIAJ",isRowDisabled:"Table-module_isRowDisabled__sz3NJ",loadingSpinner:"Table-module_loadingSpinner__SSjMK",pagination:"Table-module_pagination__VXgcO"},Ns="Button-module_button__Ed1ge",Ss="Button-module_noIcon__Uzjvv",Cs="Button-module_noBox__mLreC",Ts="Button-module_customIcon__-slpC",_s="Button-module_iconWithText__DQRkr",Ms="Button-module_default__HhXlQ",Fs="Button-module_outline__Flf4r",Rs="Button-module_float__4marx",Ps="Button-module_primary__xByv0",Es="Button-module_secondary__D0K-F",Is="Button-module_danger__5-vIq",Ds="Button-module_grouped__j8KwB";const As=t.forwardRef(function({disabled:t=!1,kind:a="default",type:n="button",icon:r,iconNode:o,children:i,grouped:s,onClick:l,id:c,className:f,form:u,noBox:d,autoFocus:h,...m},p){return e.jsxs("button",{...m,id:c,ref:p,type:n,"data-testid":m["data-testid"],disabled:t,onClick:l,form:u,autoFocus:h,"aria-label":m["aria-label"],className:us(Ns,s?Ds:"",Os(a),f,d&&Cs,o&&Ts,!r&&!o&&Ss),children:[r?e.jsx(Qn,{icon:r,className:i?_s:""}):null,o,i]})});function Os(e){switch(e){case"default":return Ms;case"primary":return Ps;case"secondary":return Es;case"danger":return Is;case"outline":return Fs;case"float":return Rs;default:throw Error(`Unsupported kind ${e}`)}}function Ls({row:a}){const{cells:n,isRowSelected:r,isRowDisabled:o,className:i,onClick:s,onDoubleClick:l,onContextMenu:c,...f}=a,u=t.useRef(Math.random()).current;return e.jsx("tr",{...f,onClick:s,onDoubleClick:l,onContextMenu:c,className:Br(i,{[ks.isRowSelected]:r,[ks.isRowDisabled]:o}),children:n&&n.map(({style:t,value:a,...n},r)=>e.jsx("td",{style:t,...n,children:a},u+r))})}function Bs({sortByDirection:a,sortBy:n,updateSortParams:r,table:o,tableBodyRef:i,className:s,isLoading:l,itemsPerPage:c}){const f=a&&n&&r,[u,d]=t.useState(0);return l?e.jsx("div",{className:ks.loadingSpinner}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:Br(ks.table,{[s||""]:s}),"data-testid":"table-ui",children:[e.jsx("thead",{children:e.jsx("tr",{children:o.headRow.map(({sortable:i,label:s,name:l,...c},u)=>i&&"not-filled"!==o.type&&f?t.createElement("th",{...c,key:u,className:ks.sortable,onClick:()=>r(l)},s,e.jsx("span",{className:Br(ks.sortArrow,{[ks[a]]:n===l})})):e.jsx("th",{...c,children:s},u))})}),e.jsx("tbody",{ref:i,children:"not-filled"===o.type?e.jsx("tr",{className:null==o?void 0:o.bodyClassName,children:e.jsx("td",{colSpan:o.headRow.length,children:o.value})}):zs(o.bodyRows,u,c).map((t,a)=>{var n;return e.jsx(Ls,{row:t},null!==(n=t["data-row"])&&void 0!==n?n:`row-${a}`)})})]}),e.jsx($s,{bodyRows:"filled"===o.type?o.bodyRows:void 0,itemsPerPage:c,currPage:u,setCurrPage:d})]})}function zs(e,t,a){return a?e.slice(t*a,a*(t+1)):e}function $s({itemsPerPage:t,currPage:a,setCurrPage:n,bodyRows:r}){if(!t)return null;const o=!!r&&zs(r,a+1,t).length>0,i=!!r&&zs(r,a-1,t).length>0;return e.jsxs("nav",{className:ks.pagination,children:[e.jsx(As,{"aria-label":"Previous Page",disabled:!i,kind:"float",icon:ys.faChevronLeft,onClick:()=>n(a-1)}),e.jsx(As,{disabled:!o,"aria-label":"Next Page",kind:"float",icon:js.faChevronRight,onClick:()=>n(a+1)})]})}function Vs({numTicks:a,sampleRate:n,units:r,tableBodyRef:o,palette:i}){const s=vr(a,n,r),l=s.format(a,n),c=ki(),f=t.useCallback((e,t,a)=>{var o;const f=null===(o=a.target.closest("tr"))||void 0===o?void 0:o.dataset.row;if(!f)return void t();const[u,d,...h]=f.split(";");switch(u){case"single":{const[t,a]=h,o=s.format(parseInt(t,10),n),i=s.format(parseInt(a,10),n),c=l.split(" "),f="<"===c[0]?c[1]:c[0],u=o.split(" "),m="<"===u[0]?u[1]:u[0],p=i.split(" "),g="<"===p[0]?p[1]:p[0];e({title:{text:d,diff:{text:"",color:""}},tooltipData:[{units:r,self:`${o}(${(parseFloat(m)/parseFloat(f)*100).toFixed(2)}%)`,total:`${i}(${(parseFloat(g)/parseFloat(f)*100).toFixed(2)}%)`,tooltipType:"table"}]});break}case"double":{const[t,a,o,l]=h,f=Pi({formatter:s,sampleRate:n,totalLeft:parseInt(t,10),leftTicks:parseInt(a,10),totalRight:parseInt(o,10),rightTicks:parseInt(l,10),title:d,units:r},i,c);e({title:f.title,tooltipData:f.tooltipData});break}}},[s,n,r,l,i,c]);return e.jsx(_i,{dataSourceRef:o,shouldShowTitle:!1,clickInfoSide:"left",setTooltipContent:f,palette:i})}var Hs="ProfilerTable-module_tableContextMenu__7Svm8",Ws="ProfilerTable-module_sandwichItem__b9Ipy";const Us=e=>e||0;function Js(e,t,a,n){const r=t;return r.type="single",r.self=Us(r.self)+e.getBarSelf(a,n),r.total=Us(r.total)+e.getBarTotal(a,n),r}function Qs(e,t,a,n,r,o){const i=t;return i.type="double",i.self=Us(i.self)+e.getBarSelf(a,n),i.total=Us(i.total)+e.getBarTotal(a,n),i.selfLeft=Us(i.selfLeft)+e.getBarSelfLeft(a,n),i.selfRght=Us(i.selfRght)+e.getBarSelfRght(a,n),i.selfDiff=Us(i.selfDiff)+e.getBarSelfDiff(a,n),i.totalLeft=Us(i.totalLeft)+e.getBarTotalLeft(a,n),i.totalRght=Us(i.totalRght)+e.getBarTotalRght(a,n),i.totalDiff=Us(i.totalDiff)+e.getBarTotalDiff(a,n),i.leftTicks=r,i.rightTicks=o,i}function Xs(e,t){if(!e||!e.levels)return null;const{names:a,levels:n,format:r}=e,o=nr(r);let i=null;for(let e=0;e<n.length;e++){const r=n[e];for(let n=0;n<r.length;n+=o.jStep){if(a[o.getBarName(r,n)]===t){const t=o.getBarTotal(r,n);(!i||t>i.total)&&(i={i:e,j:n,total:t})}}}return i?{i:i.i,j:i.j}:null}function Ys(e,t,a){const n=148-e/t*148,r=a.alpha(1);return{backgroundImage:`linear-gradient(${r}, ${r})`,backgroundPosition:`-${n}px 0px`,backgroundRepeat:"no-repeat"}}const Zs=({flamebearer:t,sortBy:a,sortByDirection:n,fitMode:r,handleTableItemClick:o,highlightQuery:i,palette:s,selectedItem:l,messages:c,onRowContextMenu:f,onRowDoubleClick:u})=>{const{numTicks:d,maxSelf:h,sampleRate:m,spyName:p,units:g}=t,v=function(e){if(!e)return[];const{names:t,levels:a,format:n}=e,r="double"!==n?tr:ar,o=new Map;for(let i=0;i<a.length;i++){const s=a[i];for(let a=0;a<s.length;a+=r.jStep){const i=t[r.getBarName(s,a)];o.has(i)||o.set(i,{name:i||"<empty>",self:0,total:0});const l=o.get(i);if(!l)break;"single"===n?Js(tr,l,s,a):Qs(ar,l,s,a,e.leftTicks,e.rightTicks)}}return Array.from(o.values())}(t).sort((e,t)=>t.total-e.total),b="asc"===n?1:-1;let y;if("name"===a)y=v.sort((e,t)=>b*e[a].localeCompare(t[a]));else switch(a){case"total":case"self":y=v.sort((e,t)=>b*(e[a]-t[a]));break;case"baseline":y=v.sort((e,t)=>b*(e.totalLeft/e.leftTicks-t.totalLeft/t.leftTicks));break;case"comparison":y=v.sort((e,t)=>b*(e.totalRght/e.rightTicks-t.totalRght/t.rightTicks));break;case"diff":y=v.sort((e,t)=>{const a=gr(pr(e.totalLeft/e.leftTicks),pr(e.totalRght/e.rightTicks)),n=gr(pr(t.totalLeft/t.leftTicks),pr(t.totalRght/t.rightTicks));return b*(a-n)});break;default:y=v}const x=vr(d,m,g),w=e=>!!l.isJust&&e===l.value,j=t=>{return e.jsx("button",{className:"table-item-button",children:e.jsx("div",{className:"symbol-name",style:(a=r,a===jr?{direction:"rtl",overflow:"hidden",textOverflow:"ellipsis"}:{overflow:"hidden",textOverflow:"ellipsis"}),children:t.name})});var a},k=y.filter(e=>{return!i||(t=i,e.name.toLowerCase().includes(t.toLowerCase()));var t}).map(e=>{if("double"===e.type)return(e=>{const t=pr(e.leftTicks>0?e.totalLeft/e.leftTicks:0),a=pr(e.rightTicks>0?e.totalRght/e.rightTicks:0);let n=gr(t,a);Number.isFinite(n)||(n=0);let r="";n>0?r=s.badColor.rgb().string():n<0&&(r=s.goodColor.rgb().string());let i="";return 0===e.totalLeft&&e.totalRght>0?i=c.diffNew:0===e.totalRght&&e.totalLeft>0?i=c.diffRemoved:0===n?i="0%":n>0?i=`+${n.toFixed(2)}%`:n<0&&(i=`${n.toFixed(2)}%`),{"data-row":`${e.type};${e.name};${e.totalLeft};${e.leftTicks};${e.totalRght};${e.rightTicks}`,isRowSelected:w(e.name),onClick:()=>o(e),onContextMenu:t=>f(t,e.name),onDoubleClick:()=>u(e.name),cells:[{value:j(e)},{value:`${t} %`},{value:`${a} %`},{value:i,style:{color:r}}]}})(e);const t=Tr(p,e.name);return((e,t)=>({"data-row":`${e.type};${e.name};${e.self};${e.total}`,isRowSelected:w(e.name),onClick:()=>o(e),onContextMenu:t=>f(t,e.name),onDoubleClick:()=>u(e.name),cells:[{value:j(e)},{value:x.format(e.self,m),style:Ys(e.self,h,t)},{value:x.format(e.total,m),style:Ys(e.total,d,t)}]}))(e,_r(s,t))});return k.length>0?{bodyRows:k,type:"filled"}:{value:e.jsx("div",{className:"unsupported-format",children:c.noItemsFound}),type:"not-filled"}};function qs({tableBodyRef:a,flamebearer:n,isDoubles:r,fitMode:o,handleTableItemClick:i,highlightQuery:s,selectedItem:l,palette:c,onFocusOnNode:f,updateView:u,enableSandwichView:d=!0}){const h=ki(),[m,p]=ei({transition:!0}),[g,v]=t.useState({x:0,y:0}),[b,y]=t.useState(null),x=t.useCallback(e=>{if(l.isJust&&l.value===e||i({name:e}),!f)return;const t=Xs(n,e);t&&f(t.i,t.j)},[n,f,l,i]),w=t.useCallback((e,t)=>{e.preventDefault(),v({x:e.clientX,y:e.clientY}),y(t),p(!0)},[p]),j=t.useCallback(()=>{p(!1),y(null)},[p]),k=t.useCallback(()=>{if(!b||!f)return;const e=Xs(n,b);e&&f(e.i,e.j),j()},[b,n,f,j]),N=t.useCallback(()=>{b&&navigator.clipboard&&(navigator.clipboard.writeText(b),j())},[b,j]),S=t.useCallback(()=>{b&&(i({name:b}),j())},[b,i,j]),C=t.useCallback(()=>{b&&u&&(u("sandwich"),i({name:b}),j())},[b,u,i,j]),T=t.useMemo(()=>r?[{sortable:1,name:"name",label:h.location},{sortable:1,name:"baseline",label:h.baseline,default:!0},{sortable:1,name:"comparison",label:h.comparison},{sortable:1,name:"diff",label:h.diff}]:[{sortable:1,name:"name",label:h.location},{sortable:1,name:"self",label:h.self,default:!0},{sortable:1,name:"total",label:h.total}],[h,r]),_=(e=>{const a=e.filter(e=>null==e?void 0:e.default)[0]||e[0],[n,r]=t.useState(a.name),[o,i]=t.useState("desc");return{sortBy:n,sortByDirection:o,updateSortParams:e=>{let t=o;t=n===e?"asc"===t?"desc":"asc":"desc",r(e),i(t)}}})(T),M={headRow:T,...Zs({flamebearer:n,sortBy:_.sortBy,sortByDirection:_.sortByDirection,fitMode:o,handleTableItemClick:i,highlightQuery:s,palette:c,selectedItem:l,messages:h,onRowContextMenu:w,onRowDoubleClick:x})},F=l.isJust&&l.value===b;return e.jsxs(e.Fragment,{children:[e.jsx(Bs,{..._,tableBodyRef:a,table:M,className:us("flamegraph-table",{"flamegraph-table-doubles":r})}),e.jsxs(Xo,{...m,anchorPoint:g,onClose:j,className:Hs,children:[f&&e.jsxs(ri,{onClick:k,children:[e.jsx(Qn,{icon:ps.faCrosshairs}),h.focusOnThisFunction]}),e.jsxs(ri,{onClick:N,children:[e.jsx(Qn,{icon:Gr.faCopy}),h.copyFunctionName]}),e.jsxs(ri,{onClick:S,children:[e.jsx(Qn,{icon:ro.faHighlighter}),F?h.clearHighlight:h.highlightSimilarNodes]}),u&&d&&e.jsxs(ri,{onClick:C,className:Ws,children:[e.jsx(zi,{fill:"currentColor"}),h.openInSandwichView]})]})]})}const Ks=t.memo(function({flamebearer:a,fitMode:n,handleTableItemClick:r,highlightQuery:o,palette:i,selectedItem:s,onFocusOnNode:l,updateView:c,enableSandwichView:f}){const u=t.useRef(null),d=t.useRef(null),[h,m]=t.useState(0),p="double"===a.format;return t.useEffect(()=>{const e=u.current;if(!e)return;const t=e.offsetWidth-e.clientWidth;Number.isFinite(t)&&t!==h&&m(t)},[u.current,p,h]),e.jsxs("div",{"data-testid":"table-view",ref:d,style:{"--kylin-flamegraph-scrollbar-size":`${h}px`},className:p?"flamegraph-table-wrapper flamegraph-table-wrapper--double":"flamegraph-table-wrapper",children:[e.jsx("div",{className:"flamegraph-table-scroll",children:e.jsx(qs,{tableBodyRef:u,flamebearer:a,isDoubles:p,fitMode:n,highlightQuery:o,handleTableItemClick:r,palette:i,selectedItem:s,onFocusOnNode:l,updateView:c,enableSandwichView:f})}),e.jsx(Vs,{tableBodyRef:u,numTicks:a.numTicks,sampleRate:a.sampleRate,units:a.units,palette:i})]})});var Gs,el,tl={},al={};function nl(){return Gs||(Gs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="arrow-rotate-left",a=[8634,"arrow-left-rotate","arrow-rotate-back","arrow-rotate-backward","undo"],n="f0e2",r="M256 64c-56.8 0-107.9 24.7-143.1 64l47.1 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 192c-17.7 0-32-14.3-32-32L0 32C0 14.3 14.3 0 32 0S64 14.3 64 32l0 54.7C110.9 33.6 179.5 0 256 0 397.4 0 512 114.6 512 256S397.4 512 256 512c-87 0-163.9-43.4-210.1-109.7-10.1-14.5-6.6-34.4 7.9-44.6s34.4-6.6 44.6 7.9c34.8 49.8 92.4 82.3 157.6 82.3 106 0 192-86 192-192S362 64 256 64z";e.definition={prefix:"fas",iconName:t,icon:[512,512,a,n,r]},e.faArrowRotateLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(al)),al}function rl(){return el||(el=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=nl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faUndo=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(tl)),tl}var ol,il,sl=rl(),ll={},cl={};function fl(){return ol||(ol=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="diagram-project",a=["project-diagram"],n="f542",r="M0 80C0 53.5 21.5 32 48 32l96 0c26.5 0 48 21.5 48 48l0 16 128 0 0-16c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-16-128 0 0 16c0 7.3-1.7 14.3-4.6 20.5l68.6 91.5 80 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96c0-7.3 1.7-14.3 4.6-20.5L128 224 48 224c-26.5 0-48-21.5-48-48L0 80z";e.definition={prefix:"fas",iconName:t,icon:[512,512,a,n,r]},e.faDiagramProject=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(cl)),cl}function ul(){return il||(il=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=fl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faProjectDiagram=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(ll)),ll}var dl,hl,ml=ul(),pl={},gl={};function vl(){return dl||(dl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="ellipsis-vertical",a=["ellipsis-v"],n="f142",r="M64 144a56 56 0 1 1 0-112 56 56 0 1 1 0 112zm0 224c30.9 0 56 25.1 56 56s-25.1 56-56 56-56-25.1-56-56 25.1-56 56-56zm56-112c0 30.9-25.1 56-56 56s-56-25.1-56-56 25.1-56 56-56 56 25.1 56 56z";e.definition={prefix:"fas",iconName:t,icon:[128,512,a,n,r]},e.faEllipsisVertical=e.definition,e.prefix="fas",e.iconName=t,e.width=128,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(gl)),gl}function bl(){return hl||(hl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=vl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faEllipsisV=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(pl)),pl}var yl=bl();function xl(e){if(null!=e&&!1!==e){if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e)){const t=e.map(e=>xl(e)).filter(e=>!!e);return t.length?t.join(" "):void 0}return t.isValidElement(e)?xl(e.props.children):void 0}}const wl=({placement:t,title:a,content:n,children:r})=>{const o=xl(null!=a?a:n);return o?e.jsx("span",{title:o,children:r}):e.jsx(e.Fragment,{children:r})};var jl,kl={};function Nl(){return jl||(jl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="link",a=[128279,"chain"],n="f0c1",r="M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z";e.definition={prefix:"fas",iconName:t,icon:[576,512,a,n,r]},e.faLink=e.definition,e.prefix="fas",e.iconName=t,e.width=576,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(kl)),kl}var Sl=Nl(),Cl="Input-module_input__ulQdV";const Tl=t.forwardRef(({testId:t,className:a,type:n,name:r,placeholder:o,minLength:i=0,debounceTimeout:s=100,onChange:l,value:f,htmlId:u},d)=>e.jsx(c.DebounceInput,{inputRef:d,"data-testid":t,className:`${Cl} ${a||""}`,type:n,name:r,placeholder:o,minLength:i,debounceTimeout:s,onChange:l,value:f,id:u}));var _l="SharedQueryInput-module_wrapper__XRxrd",Ml="SharedQueryInput-module_search__XlzRv",Fl="SharedQueryInput-module_search-synced__J4T4b",Rl="SharedQueryInput-module_searchWithSync__ryuQa",Pl="SharedQueryInput-module_icon__Aq0Hv",El="SharedQueryInput-module_checked__oRvod",Il="SharedQueryInput-module_sync__0IO2N",Dl="SharedQueryInput-module_syncSelected__hstBI";const Al=({onHighlightChange:a,highlightQuery:n,sharedQuery:r,width:o})=>{const i=ki(),s=(e=>{const a=t.useRef();return t.useEffect(()=>{a.current=e},[e]),a.current})(null==r?void 0:r.syncEnabled);t.useEffect(()=>{"string"==typeof(null==r?void 0:r.searchQuery)&&(r.syncEnabled&&a(r.searchQuery),!r.syncEnabled&&s&&s!==(null==r?void 0:r.id)&&a(""))},[null==r?void 0:r.searchQuery,null==r?void 0:r.syncEnabled]);const l=t.useMemo(()=>r&&r.syncEnabled?r.searchQuery||"":n,[r,n]),c=t.useMemo(()=>`${r?Rl:Ml} ${(null==r?void 0:r.syncEnabled)?Fl:""}`,[r]),f=(null==r?void 0:r.syncEnabled)?i.unsyncSearchBars:i.syncSearchBars;return e.jsxs("div",{className:_l,style:{width:o},children:[e.jsx(Tl,{testId:"flamegraph-search",className:c,type:"search",name:"flamegraph-search",placeholder:i.searchPlaceholder,minLength:1,debounceTimeout:100,onChange:e=>{a(e.target.value),r&&r.syncEnabled&&r.onQueryChange(e.target.value)},value:l}),r?e.jsx(wl,{placement:"top",title:f,children:e.jsx("button",{className:r.syncEnabled?Dl:Il,onClick:()=>{const e=!(null==r?void 0:r.syncEnabled)&&(null==r?void 0:r.id);null==r||r.toggleSync(e),e?null==r||r.onQueryChange(n):(a(n),null==r||r.onQueryChange(""))},children:e.jsx(Qn,{className:`${r.syncEnabled?El:Pl}`,icon:Sl.faLink})})}):null]})};var Ol="DiffLegend-module_flamegraph-legend__Cywr1",Ll="DiffLegend-module_flamegraph-legend-list__swdXj",Bl="DiffLegend-module_flamegraph-legend-item__0P-6g";function zl(t){const{palette:a,showMode:n}=t,r=function(e){switch(e){case"large":return[-100,-80,-60,-40,-20,-10,0,10,20,40,60,80,100];case"small":return[-100,-40,-20,0,20,40,100];default:throw new Error(`Unsupported ${e}`)}}(n),o=Mr(a);return e.jsx("div",{"data-testid":"flamegraph-legend",className:`${Ol} ${Ll}`,children:r.map(t=>e.jsxs("div",{className:Bl,style:{backgroundColor:o(t).rgb().toString()},children:[t>0?"+":"",t,"%"]},t))})}function $l(){return e.jsx("svg",{version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"12px",height:"12px",viewBox:"0 0 405.272 405.272",children:e.jsx("g",{children:e.jsx("path",{d:"M393.401,124.425L179.603,338.208c-15.832,15.835-41.514,15.835-57.361,0L11.878,227.836\n\n\t\tc-15.838-15.835-15.838-41.52,0-57.358c15.841-15.841,41.521-15.841,57.355-0.006l81.698,81.699L336.037,67.064\n\n\t\tc15.841-15.841,41.523-15.829,57.358,0C409.23,82.902,409.23,108.578,393.401,124.425z"})})})}var Vl="Dropdown-module_dropdownMenu__tbN8r",Hl="Dropdown-module_dropdownMenuButton__Xy8M4";function Wl({id:t,children:a,className:n,disabled:r,value:o,label:i,onItemClick:s,overflow:l,position:c,direction:f,align:u,viewScroll:d,arrow:h,menuButtonClassName:m="",ariaLabel:p,portal:g,...v}){const b=v.menuButton||e.jsx(Jl,{"aria-label":p,className:`${Hl} ${m}`,disabled:r,type:"button",children:o||i});return e.jsxs(ai,{id:t,"aria-label":p,className:us(n,Vl),"data-testid":v["data-testid"],onItemClick:s,overflow:l,position:c,direction:f,align:u,viewScroll:d,arrow:h,menuButton:b,portal:g,children:[e.jsx(oi,{children:i}),a]})}const Ul=ri,Jl=Oo;var Ql="DiffLegendPaletteDropdown-module_container__h8Tts",Xl="DiffLegendPaletteDropdown-module_triggerButton__oezA6",Yl="DiffLegendPaletteDropdown-module_dropdownArrow__-Lu0w",Zl="DiffLegendPaletteDropdown-module_menuItem__5iWry",ql="DiffLegendPaletteDropdown-module_menuItemText__a-tt0";const Kl=[hi,mi],Gl=t=>{const{palette:a=hi,onChange:n}=t,r=ki(),o=e=>"Default"===e.name?r.paletteDefaultName:"Color Blind"===e.name?r.paletteColorBlindName:e.name,i=e=>"Default"===e.name?r.paletteDefaultDesc:"Color Blind"===e.name?r.paletteColorBlindDesc:"";return e.jsx("div",{className:Ql,children:e.jsx(Wl,{label:r.diffLegendSelectPalette,align:"end",menuButton:e.jsxs(Jl,{className:us(Hl,Xl),children:[e.jsx(zl,{palette:a,showMode:"small"}),e.jsx("span",{className:Yl})]}),onItemClick:e=>{e.value&&n(e.value)},children:Kl.map(t=>e.jsx(Ul,{value:t,children:e.jsxs("div",{className:Zl,children:[e.jsxs("span",{className:ql,children:[o(t)," ",i(t)]}),t.name===a.name&&e.jsx($l,{})]})},t.name))})})};var ec={navbar:"Toolbar-module_navbar__XN6xZ",searchWrapper:"Toolbar-module_searchWrapper__k--ua",rightSection:"Toolbar-module_rightSection__if7LO",viewType:"Toolbar-module_viewType__AKARg",toggleViewButton:"Toolbar-module_toggleViewButton__OQ9-U",fitModeButton:"Toolbar-module_fitModeButton__jOxve",selected:"Toolbar-module_selected__vwBQt",collapseNodeButton:"Toolbar-module_collapseNodeButton__bLdiw",resetViewButton:"Toolbar-module_resetViewButton__y2ebV",divider:"Toolbar-module_divider__dG6pE",itemsContainer:"Toolbar-module_itemsContainer__gSTMF",item:"Toolbar-module_item__o-hKc",moreButton:"Toolbar-module_moreButton__rhOdT",active:"Toolbar-module_active__36Kt-",navbarCollapsedItems:"Toolbar-module_navbarCollapsedItems__vojhw"};const tc=b.bind(ec),ac=(e,t,a)=>{const n=0===t?e-360-5:e-360-16-5;let r=0,o=0;return a.reverse().forEach(e=>{o+=e,n<=o&&(r+=1)}),r},nc=()=>e.jsx("div",{className:ec.divider}),rc=t.memo(({view:a,handleSearchChange:n,highlightQuery:r,isFlamegraphDirty:o,reset:s,updateFitMode:l,fitMode:c,updateView:f,selectedNode:u,onFocusOnSubtree:d,flamegraphType:h,enableChangingDisplay:m=!0,sharedQuery:p,ExportData:g,palette:v,setPalette:b})=>{const y=t.useRef(null),x=ki(),w="double"===h&&v&&b,j=[{el:e.jsxs(e.Fragment,{children:[e.jsx(sc,{fitMode:c,updateFitMode:l}),e.jsx(nc,{})]}),width:93},{el:e.jsx(ic,{isFlamegraphDirty:o,reset:s}),width:44},{el:e.jsxs(e.Fragment,{children:[e.jsx(oc,{selectedNode:u,onFocusOnSubtree:d}),e.jsx(nc,{})]}),width:49},m?{el:e.jsx(cc,{flamegraphType:h,view:a,updateView:f}),width:44*("single"===h?5:3)}:null,t.isValidElement(g)?{el:e.jsxs(e.Fragment,{children:[e.jsx(nc,{}),g]}),width:49}:null].filter(e=>null!==e),k=j.reduce((e,t)=>[...e,t.width],[]),{isCollapsed:N,collapsedItemsNumber:S,handleMoreClick:C}=((e,a)=>{const[n,r]=t.useState(!0),[o,s]=t.useState(0);return t.useLayoutEffect(()=>{if(e.current){const{width:t}=e.current.getBoundingClientRect(),n=ac(t,o,a);s(n)}},[e.current,a]),i(e,e=>{const{width:t}=e.target.getBoundingClientRect(),n=ac(t,o,a);s(n),r(!0)}),{isCollapsed:n,handleMoreClick:()=>{r(e=>!e)},collapsedItemsNumber:o}})(y,k),T=j.reduce((e,t,a)=>(a<S?e.hidden.push(t):e.visible.push(t),e),{visible:[],hidden:[]});return e.jsx("div",{role:"toolbar",ref:y,children:e.jsxs("div",{className:ec.navbar,children:[e.jsx("div",{className:ec.searchWrapper,children:e.jsx(Al,{width:360,onHighlightChange:n,highlightQuery:r,sharedQuery:p})}),e.jsxs("div",{className:ec.rightSection,children:[w&&e.jsxs(e.Fragment,{children:[e.jsx(Gl,{palette:v,onChange:b}),e.jsx(nc,{})]}),e.jsxs("div",{className:ec.itemsContainer,children:[T.visible.map((t,a)=>e.jsx("div",{className:ec.item,style:{width:t.width},children:t.el},a)),0!==S&&e.jsx(wl,{placement:"top",title:x.more,children:e.jsx("button",{onClick:C,className:tc({[ec.moreButton]:!0,[ec.active]:!N}),children:e.jsx(Qn,{icon:yl.faEllipsisV})})})]})]}),!N&&e.jsx("div",{className:ec.navbarCollapsedItems,children:T.hidden.map((t,a)=>e.jsx("div",{className:ec.item,style:{width:t.width},children:t.el},a))})]})})});function oc({onFocusOnSubtree:t,selectedNode:a}){const n=ki(),r=a.mapOr(()=>{},e=>()=>t(e.i,e.j));return e.jsx(wl,{placement:"top",title:n.collapseNodesAbove,children:e.jsx("div",{children:e.jsx(As,{disabled:!a.isJust,onClick:r,className:ec.collapseNodeButton,"aria-label":n.collapseNodesAbove,children:e.jsx(Qn,{icon:co.faCompressAlt})})})})}function ic({isFlamegraphDirty:t,reset:a}){const n=ki();return e.jsx(wl,{placement:"top",title:n.resetView,children:e.jsx("span",{children:e.jsx(As,{id:"reset",disabled:!t,onClick:a,className:ec.resetViewButton,"aria-label":n.resetView,children:e.jsx(Qn,{icon:sl.faUndo})})})})}function sc({fitMode:t,updateFitMode:a}){const n=ki(),r=e=>t===e;return e.jsxs(e.Fragment,{children:[e.jsx(wl,{placement:"top",title:n.headFirst,children:e.jsx(As,{onClick:()=>a("HEAD"),className:tc({[ec.fitModeButton]:!0,[ec.selected]:r("HEAD")}),children:e.jsx($i,{})})}),e.jsx(wl,{placement:"top",title:n.tailFirst,children:e.jsx(As,{onClick:()=>a("TAIL"),className:tc({[ec.fitModeButton]:!0,[ec.selected]:r("TAIL")}),children:e.jsx(Vi,{})})})]})}const lc=(t,a)=>"single"===t?[{label:a.viewTable,value:"table",Icon:Oi},{label:a.viewTableAndFlamegraph,value:"both",Icon:Li},{label:a.viewFlamegraph,value:"flamegraph",Icon:Bi},{label:a.viewSandwich,value:"sandwich",Icon:zi},{label:a.viewGraphviz,value:"graphviz",Icon:()=>e.jsx(Qn,{icon:ml.faProjectDiagram})}]:[{label:a.viewTable,value:"table",Icon:Oi},{label:a.viewTableAndFlamegraph,value:"both",Icon:Li},{label:a.viewFlamegraph,value:"flamegraph",Icon:Bi}];function cc({view:t,updateView:a,flamegraphType:n}){const r=ki(),o=lc(n,r);return e.jsx("div",{className:ec.viewType,children:o.map(({label:n,value:r,Icon:o})=>e.jsx(wl,{placement:"top",title:n,children:e.jsx(As,{"data-testid":r,onClick:()=>a(r),className:tc({[ec.toggleViewButton]:!0,selected:t===r}),children:e.jsx(o,{})})},r))})}function fc(e,t){const a={},n={};let r={name:"total",children:[],self:[],total:[],key:"/total"};return(t?[e,t]:[e]).forEach((e,t)=>{var o,i;for(let s=0;s<e.levels.length;s+=1)for(let l=0;l<e.levels[s].length;l+=4){const c=[t,s,l].join("/"),f=e.names[e.levels[s][l+3]],u=e.levels[s][l+0],d=e.levels[s][l+1],h=e.levels[s][l+2];let m="";if(0!==s){const a=s-1,r=e.levels[a];for(let e=0;e<r.length;e+=4){const o=r[e+0],i=r[e+1];if(u>=o&&u<o+i){const r=[t,a,e].join("/");m=n[r].key;break}}}const p=[m||"",f].join("/"),g=!a[p];a[p]||(a[p]={name:f,children:[],self:[],total:[],key:p});const v=a[p];(o=v.total)[t]||(o[t]=0),v.total[t]+=d,(i=v.self)[t]||(i[t]=0),v.self[t]+=h,n[c]=v,m&&g&&a[m].children.push(v),0===s&&(r=v)}}),r}const uc=e=>{const t={maxSelf:100,names:[],levels:[]},a=(e,n,r)=>{var o;const{name:i,children:s,self:l,total:c,offset:f}=e;t.names.push(i),(o=t.levels)[n]||(o[n]=[]),t.maxSelf=Math.max(t.maxSelf,l[0]||0),t.levels[n]=t.levels[n].concat([r,c[0]||0,l[0]||0,t.names.length-1]);for(let e=0;e<s.length;e+=1){r+=a(s[e],n+1,r)}return f||c[0]||0};return a(e,0,0),t};function dc(e){const t=new Map;for(let a=0;a<e.children.length;a+=1)t.has(e.children[a].name)||t.set(e.children[a].name,e.children[a]);for(let a=0;a<e.children.length;a+=1){const n=e.children[a],r=t.get(e.children[a].name);r&&r!==n&&(r.total[0]+=n.total[0],r.self[0]+=n.self[0],r.children=r.children.concat(n.children))}e.children=Array.from(t.values());for(let t=0;t<e.children.length;t+=1)dc(e.children[t])}function hc(e,t){const a=function(e,t){const a=fc(e),n={format:"single",numTicks:0,maxSelf:100,sampleRate:100,names:[],levels:[],units:e.units,spyName:e.spyName},r={name:t,total:[],self:[0],children:[]},o=e=>{e.name===t&&(n.numTicks+=e.total[0],r.total=[n.numTicks],r.children=r.children.concat(e.children));for(let t=0;t<e.children.length;t+=1)o(e.children[t])};return o(a),dc(r),{...n,...uc(r)}}(JSON.parse(JSON.stringify(e)),t);return a}function mc(e,t){const a=function(e,t){const a=fc(e),n={format:"single",maxSelf:100,sampleRate:100,numTicks:0,names:[],levels:[],units:e.units,spyName:e.spyName},r=[],o=[],i={name:t,total:[0],self:[0],children:[]},s=(e,a=[])=>{const i=a.concat([{...e,children:[]}]);e.name===t&&(o.push(i),r.push(e.total[0]),n.numTicks+=e.total[0]);for(let t=0;t<e.children.length;t+=1)s(e.children[t],i)};s(a),o.forEach((e,t)=>{i.children.push(((e,t)=>{const a={};let n=a;return e.forEach(({name:e,...a})=>{const r={name:e,...a,total:[t]};n.children=[r],n=r}),a.children[0]})(e.reverse(),r[t]))}),dc(i);const l=uc(i);return l.levels=l.levels.reverse().slice(0,-1),{...n,...l}}(JSON.parse(JSON.stringify(e)),t);return a}var pc={flamegraphContainer:"FlamegraphRenderer-module_flamegraphContainer__-7FRV",createdBy:"FlamegraphRenderer-module_createdBy__rHAOT",horizontal:"FlamegraphRenderer-module_horizontal__zs7--",vertical:"FlamegraphRenderer-module_vertical__fRcHg",panesWrapper:"FlamegraphRenderer-module_panesWrapper__L-mlA",tablePane:"FlamegraphRenderer-module_tablePane__Gin7Y",sandwichPane:"FlamegraphRenderer-module_sandwichPane__IEOyR",sandwichPaneInfo:"FlamegraphRenderer-module_sandwichPaneInfo__5hT4a",arrow:"FlamegraphRenderer-module_arrow__dPzpE",sandwichTop:"FlamegraphRenderer-module_sandwichTop__7N0ZY",sandwichBottom:"FlamegraphRenderer-module_sandwichBottom__Dc64g",name:"FlamegraphRenderer-module_name__XRbN9"};function gc(e){const t=[];return Object.keys(e).forEach(a=>{var n;t.push(`${a}="${n=String(e[a]||""),n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`)}),`[${t.join(" ")}]`}function vc(e,t){return`${(100*e/t).toFixed(2)}%`}function bc(e,t){let a,n,r,o;t?(a=.1,n=.93):(a=1,n=.7),e=Math.max(-1,Math.min(1,e)),Math.abs(e)<.2&&(a*=Math.abs(e)/.2),e>0&&(e**=1-.7),e<0&&(e=-((-e)**(1-.7))),e<0?(o=n,r=n*(1+a*e)):(r=n,o=n*(1-a*e));const i=n*(1-a);return`#${Math.floor(255*r).toString(16).padStart(2,"0")}${Math.floor(255*o).toString(16).padStart(2,"0")}${Math.floor(255*i).toString(16).padStart(2,"0")}`}function yc(e,t,a,n){const{self:r}=t,{total:o}=t,i=t.name.replace(/"/g,'\\"'),s=e(r),l=8+Math.ceil(16*Math.sqrt(r/a)),c=bc(o/n,!1),f=bc(o/n,!0),u=function(e,t,a,n,r){let o="";o=`${function(e){return e.replace(/.*\//,"")}(t)}\n`;const i=e(a);0!==a?o=`${o+i} (${vc(a,r)})`:o+="0";let s=i;n!==a&&(o+=0!==a?"\n":" ",s=e(n),o=`${o}of ${s} (${vc(n,r)})`);return o}(e,i,r,o,n),d={label:u,id:`node${t.index}`,fontsize:l,shape:"box",tooltip:`${i} (${s})`,color:c,fontcolor:"#000000",style:"filled",fontname:"",fillcolor:f};return`N${t.index} ${gc(d)}`}function xc(e){if("double"===e.metadata.format)return"diff flamegraphs are not supported";const t=fc(e.flamebearer),a=[],n=[];const[r,o,,i]=function e(t,a,n,r,o){return t.children.forEach(t=>{const[i,s]=e(t,a,n,r,o);a=Math.max(a,i),n=Math.max(n,s)}),a=Math.max(a,t.self[0]),n=Math.max(n,t.total[0]),r+=t.self[0],o+=t.total[0],[a,n,r,o]}(t,0,0,0,0),{sampleRate:s,units:l}=e.metadata,c=vr(o,s,l),f=e=>c.format(e,s,!0);let u={};const d={};let h=0;function m(e,t){return-1===t.indexOf(e.name)&&(u[e.name]?(u[e.name].self+=e.self[0],u[e.name].total+=e.total[0]):(h+=1,u[e.name]={index:h,name:e.name,self:e.self[0],total:e.total[0],parents:[],children:[]})),e.children.forEach(a=>{const n=m(a,t.concat([e.name])),r=`${e.name}/${a.name}`;a.name!==e.name&&(d[r]?d[r].weight+=a.total[0]:d[r]={from:u[e.name],to:n,weight:a.total[0],residual:!1},n.parents.push(d[r]),u[e.name].children.push(d[r]))}),u[e.name]}t.children.forEach(e=>{m(e,[])});const p=.005*i,g=.001*i;function v(e,t){let a=0,n=t;if(e.forEach(e=>{e.weight>0&&(n+=Math.abs(e.weight))}),0!==n&&(e.forEach(e=>{const t=Math.abs(e.weight)/n;a+=-t*Math.log2(t)}),t>0)){const e=Math.abs(t)/n;a+=-e*Math.log2(e)}return a}Object.keys(u).forEach(e=>{u[e].total<p&&delete u[e]});const b={};Object.keys(u).forEach(e=>{b[u[e].name]=function(e){let t=0;return 0===e.parents.length?t+=1:t+=v(e.parents,0),0===e.children.length?t+=1:t+=v(e.children,e.self),t*e.total+e.self}(u[e])});const y=Object.values(u).sort((e,t)=>{const a=b[e.name],n=b[t.name];return a!==n?n-a:e.name!==t.name?e.name<t.name?-1:1:e.self!==t.self?n-a:e.name<t.name?-1:1}),x={};function w(e){const[t,a]=[e.from,e.to],n={},r=[a];for(;r.length>0;){const a=r.shift();for(let o=0;o<a.parents.length;o+=1){const i=a.parents[o];if(e!==i&&!n[i.from.name]){if(i.from===t)return!0;n[i.from.name]=!0,r.push(i.from)}}}return!1}return y.forEach(e=>{x[e.name]=e}),y.slice(80).forEach(e=>{delete x[e.name]}),function e(t,a){const n=!x[t.name];t.children.forEach(r=>{const o=!x[r.name];if(e(r,n?a:t),!o&&a&&n){const e=`${a.name}/${r.name}`;d[e]||(d[e]={from:u[a.name],to:u[r.name],weight:0,residual:!0}),d[e].weight+=r.total[0],d[e].residual=!0}})}(t,null),u=x,y.reverse().forEach(e=>{const t=e.parents.sort((e,t)=>t.weight-e.weight),a=[];for(let e=0;e<t.length;e+=1){const n=t[e];if(!n.residual)break;w(n)&&(a.push(n),delete d[`${n.from.name}/${n.to.name}`])}a.forEach(e=>{e.from.children=e.from.children.filter(t=>t.to!==e.to),e.to.parents=e.to.parents.filter(t=>t.from!==e.from)})}),Object.keys(d).forEach(e=>{const t=d[e];u[t.from.name]||delete d[e],u[t.to.name]||delete d[e],t.weight<g&&delete d[e]}),Object.keys(u).forEach(e=>{a.push(yc(f,u[e],r,o))}),Object.keys(d).forEach(e=>{n.push(function(e,t,a){const n=t.from.name.replace(/"/g,'\\"'),r=t.to.name.replace(/"/g,'\\"'),o=t.weight,i=e(t.weight),s=`${n} -> ${r} (${i})`,l={label:i,weight:1+100*o/a,penwidth:1+5*o/a,tooltip:s,labeltooltip:s,fontname:"",color:bc(o/a,!1),style:t.residual?"dotted":""};return`N${t.from.index} -> N${t.to.index} ${gc(l)}`}(f,d[e],o))}),`digraph "unnamed" {\n fontname= ""\n ${a.join("\n")}\n ${n.join("\n")}\n }`}var wc="GraphVizPanel-module_graphVizPane__B18cQ";const jc=()=>null;function kc({flamebearer:a}){var n,r;const o=a,i=(null===(n=o.metadata)||void 0===n?void 0:n.format)&&(null===(r=o.flamebearer)||void 0===r?void 0:r.levels),s=`graphviz-pane-${(null==o?void 0:o.appName)||String((new Date).valueOf())}`,l=t.useMemo(()=>xc(o),[JSON.stringify(o)]);return e.jsx("div",{className:wc,children:i?e.jsx(jc,{options:{zoom:!0,width:"150%",height:"100%",scale:1,useWorker:!1},dot:l}):e.jsx("div",{children:"NO DATA"})},s)}function Nc(e,t){const a=[...t];function n(e,t,a){for(const n of e){let e=0;for(let r=t;r<n.length;r+=a)n[r]-=e,e+=n[r]+n[r+1]}}return"double"===e?(n(a,0,7),n(a,3,7)):n(a,0,4),a}function Sc(e,t){const a=[...t];function n(e,t,a){for(const n of e){let e=0;for(let r=t;r<n.length;r+=a)n[r]+=e,e=n[r]+n[r+1]}}return"double"===e?(n(a,0,7),n(a,3,7)):n(a,0,4),a}function Cc(e){if(e.profile&&e.flamebearer&&console.warn("'profile' and 'flamebearer' properties are mutually exclusive. Please use profile if possible."),e.profile){const a={...e.profile,flamebearer:{...e.profile.flamebearer}};a.flamebearer.levels=JSON.parse(JSON.stringify(a.flamebearer.levels)),(t=a).flamebearer.levels=Sc(t.metadata.format,t.flamebearer.levels);const n={...a,...a.metadata,...a.flamebearer,flamebearer:void 0,metadata:void 0};return delete n.flamebearer,delete n.metadata,n}var t;if(e.flamebearer)return e.flamebearer;return{format:"single",names:[],units:"unknown",levels:[[]],spyName:"unknown",numTicks:0,sampleRate:0,maxSelf:0}}class Tc extends t.Component{constructor(t){super(t),this.resetFlamegraphState={focusedNode:a.Maybe.nothing(),zoom:a.Maybe.nothing()},this.initialFlamegraphState=this.resetFlamegraphState,this.calcNewConfigs=(e,t)=>{const a=this.state.flamegraphConfigs,n=(e,t,a)=>{const n=(e,t,a)=>e.names[nr(e.format).getBarName(e.levels[t],a)];if(a.isNothing)return!0;try{const r=a,o=n(e,r.value.i,r.value.j);return o===n(t,r.value.i,r.value.j)}catch{return!1}};n(e,t,this.state.flamegraphConfigs.zoom)||(a.zoom=this.resetFlamegraphState.zoom);return n(e,t,this.state.flamegraphConfigs.focusedNode)||(a.focusedNode=this.resetFlamegraphState.focusedNode),a},this.onSearchChange=e=>{this.setState({searchQuery:e})},this.isSameFlamebearer=(e,t)=>function(e,t){var a;return e.format===t.format&&e.numTicks===t.numTicks&&e.sampleRate===t.sampleRate&&e.units===t.units&&(null===(a=e.names)||void 0===a?void 0:a.length)===(null==t?void 0:t.names.length)&&e.levels.length===t.levels.length&&!!e.names.every((e,a)=>e===t.names[a])&&!!function(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++){if(e[a].length!==t[a].length)return!1;for(let n=0;n<e[a].length;n++)if(e[a][n]!==t[a][n])return!1}return!0}(e.levels,t.levels)&&JSON.stringify({...e,levels:void 0,names:void 0})===JSON.stringify({...t,levels:void 0,names:void 0})}(e,t),this.onReset=()=>{this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,...this.initialFlamegraphState},selectedItem:a.Maybe.nothing()})},this.onFlamegraphZoom=e=>{e.isJust&&0===e.value.i&&0===e.value.j?this.onReset():this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,zoom:e}})},this.onFocusOnNode=(e,t)=>{if(0===e&&0===t)return void this.onReset();let n={...this.state.flamegraphConfigs};const{zoom:r}=this.state.flamegraphConfigs;r.isJust&&r.value.i<=e&&(n={...n,zoom:this.initialFlamegraphState.zoom}),this.setState({...this.state,flamegraphConfigs:{...n,focusedNode:a.Maybe.just({i:e,j:t})}})},this.isNameInFocusedSubtree=e=>{const{focusedNode:t}=this.state.flamegraphConfigs;if(t.isNothing)return!0;const{flamebearer:a}=this.state;if(!a||!a.levels)return!0;const{names:n,levels:r,format:o}=a,i=nr(o),s=t.value.i,l=t.value.j,c=r[s];if(!c)return!0;const f=i.getBarOffset(c,l),u=f+i.getBarTotal(c,l);for(let t=s;t<r.length;t++){const a=r[t];for(let t=0;t<a.length;t+=i.jStep){const r=i.getBarOffset(a,t),o=i.getBarTotal(a,t);if(r>=f&&r+o<=u){if(n[i.getBarName(a,t)]===e)return!0}}}return!1},this.setActiveItem=e=>{const{name:t}=e;if(this.state.selectedItem.isJust&&t===this.state.selectedItem.value)return void this.setState({selectedItem:a.Maybe.nothing()});this.isNameInFocusedSubtree(t)?this.setState({selectedItem:a.Maybe.just(t)}):this.setState({selectedItem:a.Maybe.just(t),flamegraphConfigs:{...this.state.flamegraphConfigs,focusedNode:this.resetFlamegraphState.focusedNode}})},this.getHighlightQuery=()=>this.state.selectedItem.isJust?this.state.selectedItem.value:this.state.searchQuery,this.updateView=e=>{"sandwich"===e&&this.setState({searchQuery:"",flamegraphConfigs:this.resetFlamegraphState}),this.setState({view:e})},this.updateFlamegraphDirtiness=()=>{const e=this.isDirty();this.setState({isFlamegraphDirty:e})},this.updateFitMode=e=>{this.setState({fitMode:e})},this.clearFocus=()=>{this.setState(e=>({...e,flamegraphConfigs:{...e.flamegraphConfigs,...this.resetFlamegraphState}}))},this.getActiveRange=()=>{const{flamebearer:e}=this.state,{zoom:t,focusedNode:a}=this.state.flamegraphConfigs,n=e.numTicks;if(!n)return{rangeMin:0,rangeMax:1};const r=nr(e.format),o=t=>{const a=e.levels[t.i];if(!a)return{rangeMin:0,rangeMax:1};const o=r.getBarOffset(a,t.j),i=r.getBarTotal(a,t.j);return{rangeMin:o/n,rangeMax:(o+i)/n}};return t.match({Just:e=>a.match({Just:t=>{const a=o(t),n=o(e);return a.rangeMax-a.rangeMin<n.rangeMax-n.rangeMin?a:n},Nothing:()=>o(e)}),Nothing:()=>a.match({Just:e=>o(e),Nothing:()=>({rangeMin:0,rangeMax:1})})})},this.isDirty=()=>this.state.selectedItem.isJust||JSON.stringify(this.initialFlamegraphState)!==JSON.stringify(this.state.flamegraphConfigs),this.handleSetPalette=e=>{this.setState({palette:e})},this.render=()=>{var t;const a=e.jsx("div",{className:Br(pc.tablePane,"vertical"===this.state.panesOrientation?pc.vertical:pc.horizontal),children:e.jsx(Ks,{"data-testid":"table-view",flamebearer:this.state.flamebearer,fitMode:this.state.fitMode,highlightQuery:this.state.searchQuery,selectedItem:this.state.selectedItem,handleTableItemClick:this.setActiveItem,palette:this.state.palette,onFocusOnNode:this.onFocusOnNode,updateView:this.props.onlyDisplay?void 0:this.updateView,enableSandwichView:this.props.enableSandwichView})},"table-pane"),n=this.shouldShowToolbar(),r=!this.state.flamebearer||this.state.flamebearer.names.length<=1,o=this.context,i="Location"!==o.location,s=this.state.flamebearer.numTicks,l=vr(s,this.state.flamebearer.sampleRate,this.state.flamebearer.units).format(s,this.state.flamebearer.sampleRate),c=hr(l,i)||l,u=function(e,t=mr){const a=Math.abs(e);for(const{value:n,label:r}of t)if(a>=n)return`${(e/n).toFixed(2).replace(/\.?0+$/,"")} ${r}`;return ur(e)}(s,o.sampleCountFormat),d=o.tooltipSamples.replace(/[::]\s*$/,""),h=(null===(t=o.tooltipUnitTitles[this.state.flamebearer.units])||void 0===t?void 0:t.formattedValue)||o.tooltipUnitTitles.unknown.formattedValue,m=this.getActiveRange(),p=m.rangeMin>0||m.rangeMax<1,g=Math.max(0,Math.min(s,(m.rangeMax-m.rangeMin)*s)),v=s>0?g/s*100:0,b=(()=>{const e=nr(this.state.flamebearer.format),t=this.state.flamegraphConfigs.focusedNode.mapOrElse(()=>this.state.flamegraphConfigs.zoom.mapOrElse(()=>null,e=>e),e=>e);if(!t)return"";const a=this.state.flamebearer.levels[t.i];if(!a)return"";const n=e.getBarName(a,t.j);return this.state.flamebearer.names[n]||""})(),y=e.jsx(is,{showCredit:this.props.showCredit,flamebearer:this.state.flamebearer,highlightQuery:this.getHighlightQuery(),setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,updateView:this.props.onlyDisplay?void 0:this.updateView,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:n,setPalette:this.handleSetPalette,enableSandwichView:this.props.enableSandwichView,breadcrumb:r?void 0:{totalValueText:c,totalSamplesText:u,samplesLabel:d,unitLabel:h,hasFocus:p,focusPercent:v,focusLabel:b,ofTotalPlacement:i?"before":"after",ofTotalLabel:o.ofTotal,clearFocusLabel:o.clearFocus,onClearFocus:this.clearFocus}},"flamegraph-pane"),x=(()=>{if("sandwich"!==this.state.view)return e.jsx("div",{className:pc.sandwichPane},"sandwich-pane");if(this.state.selectedItem.isNothing)return e.jsx("div",{className:pc.sandwichPane,children:e.jsxs("div",{className:Br(pc.sandwichPaneInfo,"vertical"===this.state.panesOrientation?pc.vertical:pc.horizontal),children:[e.jsx("div",{className:pc.arrow}),"Select a function to view callers/callees sandwich view"]})},"sandwich-pane");const t=mc(this.state.flamebearer,this.state.selectedItem.value),a=hc(this.state.flamebearer,this.state.selectedItem.value),r=t=>e.jsx(is,{disableClick:!0,showCredit:this.props.showCredit,highlightQuery:"",setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:n,setPalette:this.handleSetPalette,...t});return e.jsxs("div",{className:pc.sandwichPane,children:[e.jsxs("div",{className:pc.sandwichTop,children:[e.jsx("span",{className:pc.name,children:"Callers"}),r({flamebearer:t})]}),e.jsxs("div",{className:pc.sandwichBottom,children:[e.jsx("span",{className:pc.name,children:"Callees"}),r({flamebearer:a,headerVisible:!1,showSingleLevel:!0})]})]},"sandwich-pane")})(),w=function(e,t,a,n,r){switch(e){case"table":return[a];case"flamegraph":return[t];case"sandwich":return[a,n];case"both":return[a,t];case"graphviz":return[r];default:throw new Error(`Invalid view '${e}'`)}}(this.state.view,y,a,x,e.jsx(kc,{flamebearer:this.state.flamebearer}));return e.jsxs("div",{children:[e.jsxs("div",{children:[n&&e.jsx(rc,{sharedQuery:this.props.sharedQuery,enableChangingDisplay:!this.props.onlyDisplay,flamegraphType:this.state.flamebearer.format,view:this.state.view,handleSearchChange:this.onSearchChange,reset:this.onReset,updateView:this.updateView,updateFitMode:this.updateFitMode,fitMode:this.state.fitMode,isFlamegraphDirty:this.isDirty(),selectedNode:this.state.flamegraphConfigs.zoom,highlightQuery:this.state.searchQuery,onFocusOnSubtree:this.onFocusOnNode,ExportData:this.props.ExportData,palette:this.state.palette,setPalette:this.handleSetPalette}),this.props.children,e.jsx("div",{className:`${pc.flamegraphContainer} ${Br("vertical"===this.state.panesOrientation?pc.vertical:pc.horizontal,pc[this.state.panesOrientation],pc.panesWrapper)}`,children:r?e.jsx($r,{}):w.map(e=>e)})]}),this.props.showPyroscopeLogo&&e.jsxs("div",{className:pc.createdBy,children:["Created by",e.jsxs("a",{href:"https://twitter.com/PyroscopeIO",rel:"noreferrer",target:"_blank",children:[e.jsx(f,{width:"30",height:"30"}),"@PyroscopeIO"]})]})]})},this.state={isFlamegraphDirty:!1,view:this.props.onlyDisplay?this.props.onlyDisplay:"both",fitMode:"HEAD",flamebearer:Cc(t),panesOrientation:t.panesOrientation?t.panesOrientation:"horizontal",searchQuery:"",selectedItem:a.Maybe.nothing(),flamegraphConfigs:this.initialFlamegraphState,palette:hi}}componentDidUpdate(e,t){if(e.profile!==this.props.profile||e.flamebearer!==this.props.flamebearer){const e=t.flamebearer,n=Cc(this.props);if(!this.isSameFlamebearer(e,n)){const t=this.calcNewConfigs(e,n);return void this.setState({flamebearer:n,flamegraphConfigs:{...this.state.flamegraphConfigs,...t},selectedItem:a.Maybe.nothing()})}}t.flamegraphConfigs!==this.state.flamegraphConfigs&&this.updateFlamegraphDirtiness()}shouldShowToolbar(){return void 0===this.props.showToolbar||this.props.showToolbar}}Tc.contextType=wi,Tc.defaultProps={showCredit:!1};const _c={showPyroscopeLogo:!1},Mc=(e,t)=>{if(t)return t;const a=null!=e?e:"auto";return"zh-CN"===("auto"===a?"undefined"!=typeof navigator&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh-CN":"en":a)?yi:bi};exports.Box=function(t){const{children:a,noPadding:n,className:r="",theme:o="dark"}=t,i=n?"":Xn.padding;return e.jsx("div",{className:`${Xn.box} ${i} ${r}`,"data-theme":o,children:a})},exports.DefaultPalette=hi,exports.Flamegraph=Or,exports.FlamegraphI18nProvider=ji,exports.FlamegraphRenderer=a=>{const{i18n:n,locale:r,colorMode:o="light",sandwich:i=!0,...s}=a,l=t.useMemo(()=>Mc(r,n),[r,n]),c=t.useMemo(()=>(e=>{switch(e){case"dark":return"ps-theme-dark";case"kylin":return"ps-theme-kylin";default:return"ps-theme-light"}})(o),[o]);return e.jsx("pyro-flamegraph",{className:c,children:e.jsx(ji,{messages:l,children:e.jsx(Tc,{..._c,enableSandwichView:i,...s})})})},exports.convertJaegerTraceToProfile=function(e){const t={numTicks:0,maxSelf:0,names:[],levels:[]},a={},n={children:[]};return e.spans.forEach(e=>{e.children=[],a[e.spanID]=e}),e.spans.forEach(e=>{let t=n;e.references&&e.references.length>0&&(t=a[e.references[0].spanID]||n),t.children.push(e)}),function e(t,a){(t.children||[]).forEach(t=>e(t));let n=0;const r=u(t.children||[],e=>e.operationName);t.children=d(r,e=>{const t=e[0];for(let a=1;a<e.length;a+=1)t.duration+=e[a].duration;return n+=t.duration,t}),t.total=t.duration||n,t.self=Math.max(0,t.total-n)}(n),function a(n,r,o){var i;return t.numTicks||(t.numTicks=n.total),(i=t.levels)[r]||(i[r]=[]),t.levels[r].push(o),t.levels[r].push(n.total),t.levels[r].push(n.self),t.names.push((n.processID?`${e.processes[n.processID].serviceName}: `:"")+(n.operationName||"total")),t.levels[r].push(t.names.length-1),(n.children||[]).forEach(e=>{o+=a(e,r+1,o)}),n.total}(n,0,0),t.levels=Nc("single",t.levels),{version:1,flamebearer:t,metadata:{format:"single",units:"trace_samples",spyName:"tracing",sampleRate:1e6}}},exports.diffTwoProfiles=function(e,t){e.flamebearer.levels=Sc("single",e.flamebearer.levels),t.flamebearer.levels=Sc("single",t.flamebearer.levels);const a=function(e,t){const a={format:"double",numTicks:e.numTicks+t.numTicks,leftTicks:e.numTicks,rightTicks:t.numTicks,maxSelf:100,sampleRate:e.sampleRate,names:[],levels:[],units:e.units,spyName:e.spyName},n=fc(e,t),r=(e,t,n,o)=>{var i;const{name:s,children:l,self:c,total:f}=e;a.names.push(s),(i=a.levels)[t]||(i[t]=[]),a.maxSelf=Math.max(a.maxSelf,c[0]||0,c[1]||0),a.levels[t]=a.levels[t].concat([n,f[0]||0,c[0]||0,o,f[1]||0,c[1]||0,a.names.length-1]);for(let e=0;e<l.length;e+=1){const[a,i]=r(l[e],t+1,n,o);n+=a,o+=i}return[f[0]||0,f[1]||0]};return r(n,0,0,0),a}(e.flamebearer,t.flamebearer);a.levels=Nc("double",a.levels);const n={...e.metadata};return n.format="double",{version:1,flamebearer:a,metadata:n,leftTicks:e.flamebearer.numTicks,rightTicks:t.flamebearer.numTicks}},exports.flamegraphDefaultMessages=bi,exports.flamegraphZhCNMessages=yi;
17
+ */var cs,fs=(ss||(ss=1,function(e){!function(){var t={}.hasOwnProperty;function a(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=r(e,n(a)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var o in e)t.call(e,o)&&e[o]&&(n=r(n,o));return n}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(a.default=a,e.exports=a):window.classNames=a}()}(ls)),ls.exports),us=h(fs),ds={};function hs(){return cs||(cs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="crosshairs",a=[],n="f05b",r="M288-16c17.7 0 32 14.3 32 32l0 18.3c98.1 14 175.7 91.6 189.7 189.7l18.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-18.3 0c-14 98.1-91.6 175.7-189.7 189.7l0 18.3c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-18.3C157.9 463.7 80.3 386.1 66.3 288L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l18.3 0C80.3 125.9 157.9 48.3 256 34.3L256 16c0-17.7 14.3-32 32-32zM131.2 288c12.7 62.7 62.1 112.1 124.8 124.8l0-12.8c0-17.7 14.3-32 32-32s32 14.3 32 32l0 12.8c62.7-12.7 112.1-62.1 124.8-124.8L432 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l12.8 0C432.1 161.3 382.7 111.9 320 99.2l0 12.8c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-12.8C193.3 111.9 143.9 161.3 131.2 224l12.8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-12.8 0zM288 208a48 48 0 1 1 0 96 48 48 0 1 1 0-96z";e.definition={prefix:"fas",iconName:t,icon:[576,512,a,n,r]},e.faCrosshairs=e.definition,e.prefix="fas",e.iconName=t,e.width=576,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(ds)),ds}var ms,ps=hs(),gs={};function vs(){return ms||(ms=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-left",a=[9001],n="f053",r="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,a,n,r]},e.faChevronLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(gs)),gs}var bs,ys=vs(),xs={};function ws(){return bs||(bs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-right",a=[9002],n="f054",r="M311.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L243.2 256 73.9 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,a,n,r]},e.faChevronRight=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(xs)),xs}var js=ws(),ks={table:"Table-module_table__6A8SM",sortable:"Table-module_sortable__J6kyp",sortArrow:"Table-module_sortArrow__Nrncn",asc:"Table-module_asc__tJDI9",desc:"Table-module_desc__fjVRY",isRowSelected:"Table-module_isRowSelected__UhIAJ",isRowDisabled:"Table-module_isRowDisabled__sz3NJ",loadingSpinner:"Table-module_loadingSpinner__SSjMK",pagination:"Table-module_pagination__VXgcO"},Ns="Button-module_button__Ed1ge",Ss="Button-module_noIcon__Uzjvv",Cs="Button-module_noBox__mLreC",Ts="Button-module_customIcon__-slpC",_s="Button-module_iconWithText__DQRkr",Ms="Button-module_default__HhXlQ",Fs="Button-module_outline__Flf4r",Rs="Button-module_float__4marx",Ps="Button-module_primary__xByv0",Es="Button-module_secondary__D0K-F",Is="Button-module_danger__5-vIq",Ds="Button-module_grouped__j8KwB";const As=t.forwardRef(function({disabled:t=!1,kind:a="default",type:n="button",icon:r,iconNode:o,children:i,grouped:s,onClick:l,id:c,className:f,form:u,noBox:d,autoFocus:h,...m},p){return e.jsxs("button",{...m,id:c,ref:p,type:n,"data-testid":m["data-testid"],disabled:t,onClick:l,form:u,autoFocus:h,"aria-label":m["aria-label"],className:us(Ns,s?Ds:"",Os(a),f,d&&Cs,o&&Ts,!r&&!o&&Ss),children:[r?e.jsx(Qn,{icon:r,className:i?_s:""}):null,o,i]})});function Os(e){switch(e){case"default":return Ms;case"primary":return Ps;case"secondary":return Es;case"danger":return Is;case"outline":return Fs;case"float":return Rs;default:throw Error(`Unsupported kind ${e}`)}}function Ls({row:a}){const{cells:n,isRowSelected:r,isRowDisabled:o,className:i,onClick:s,onDoubleClick:l,onContextMenu:c,...f}=a,u=t.useRef(Math.random()).current;return e.jsx("tr",{...f,onClick:s,onDoubleClick:l,onContextMenu:c,className:Br(i,{[ks.isRowSelected]:r,[ks.isRowDisabled]:o}),children:n&&n.map(({style:t,value:a,...n},r)=>e.jsx("td",{style:t,...n,children:a},u+r))})}function Bs({sortByDirection:a,sortBy:n,updateSortParams:r,table:o,tableBodyRef:i,className:s,isLoading:l,itemsPerPage:c}){const f=a&&n&&r,[u,d]=t.useState(0);return l?e.jsx("div",{className:ks.loadingSpinner}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:Br(ks.table,{[s||""]:s}),"data-testid":"table-ui",children:[e.jsx("thead",{children:e.jsx("tr",{children:o.headRow.map(({sortable:i,label:s,name:l,...c},u)=>i&&"not-filled"!==o.type&&f?t.createElement("th",{...c,key:u,className:ks.sortable,onClick:()=>r(l)},s,e.jsx("span",{className:Br(ks.sortArrow,{[ks[a]]:n===l})})):e.jsx("th",{...c,children:s},u))})}),e.jsx("tbody",{ref:i,children:"not-filled"===o.type?e.jsx("tr",{className:null==o?void 0:o.bodyClassName,children:e.jsx("td",{colSpan:o.headRow.length,children:o.value})}):zs(o.bodyRows,u,c).map((t,a)=>{var n;return e.jsx(Ls,{row:t},null!==(n=t["data-row"])&&void 0!==n?n:`row-${a}`)})})]}),e.jsx($s,{bodyRows:"filled"===o.type?o.bodyRows:void 0,itemsPerPage:c,currPage:u,setCurrPage:d})]})}function zs(e,t,a){return a?e.slice(t*a,a*(t+1)):e}function $s({itemsPerPage:t,currPage:a,setCurrPage:n,bodyRows:r}){if(!t)return null;const o=!!r&&zs(r,a+1,t).length>0,i=!!r&&zs(r,a-1,t).length>0;return e.jsxs("nav",{className:ks.pagination,children:[e.jsx(As,{"aria-label":"Previous Page",disabled:!i,kind:"float",icon:ys.faChevronLeft,onClick:()=>n(a-1)}),e.jsx(As,{disabled:!o,"aria-label":"Next Page",kind:"float",icon:js.faChevronRight,onClick:()=>n(a+1)})]})}function Vs({numTicks:a,sampleRate:n,units:r,tableBodyRef:o,palette:i}){const s=vr(a,n,r),l=s.format(a,n),c=ki(),f=t.useCallback((e,t,a)=>{var o;const f=null===(o=a.target.closest("tr"))||void 0===o?void 0:o.dataset.row;if(!f)return void t();const[u,d,...h]=f.split(";");switch(u){case"single":{const[t,a]=h,o=s.format(parseInt(t,10),n),i=s.format(parseInt(a,10),n),c=l.split(" "),f="<"===c[0]?c[1]:c[0],u=o.split(" "),m="<"===u[0]?u[1]:u[0],p=i.split(" "),g="<"===p[0]?p[1]:p[0];e({title:{text:d,diff:{text:"",color:""}},tooltipData:[{units:r,self:`${o}(${(parseFloat(m)/parseFloat(f)*100).toFixed(2)}%)`,total:`${i}(${(parseFloat(g)/parseFloat(f)*100).toFixed(2)}%)`,tooltipType:"table"}]});break}case"double":{const[t,a,o,l]=h,f=Pi({formatter:s,sampleRate:n,totalLeft:parseInt(t,10),leftTicks:parseInt(a,10),totalRight:parseInt(o,10),rightTicks:parseInt(l,10),title:d,units:r},i,c);e({title:f.title,tooltipData:f.tooltipData});break}}},[s,n,r,l,i,c]);return e.jsx(_i,{dataSourceRef:o,shouldShowTitle:!1,clickInfoSide:"left",setTooltipContent:f,palette:i})}var Hs="ProfilerTable-module_tableContextMenu__7Svm8",Ws="ProfilerTable-module_sandwichItem__b9Ipy";const Us=e=>e||0;function Js(e,t,a,n){const r=t;return r.type="single",r.self=Us(r.self)+e.getBarSelf(a,n),r.total=Us(r.total)+e.getBarTotal(a,n),r}function Qs(e,t,a,n,r,o){const i=t;return i.type="double",i.self=Us(i.self)+e.getBarSelf(a,n),i.total=Us(i.total)+e.getBarTotal(a,n),i.selfLeft=Us(i.selfLeft)+e.getBarSelfLeft(a,n),i.selfRght=Us(i.selfRght)+e.getBarSelfRght(a,n),i.selfDiff=Us(i.selfDiff)+e.getBarSelfDiff(a,n),i.totalLeft=Us(i.totalLeft)+e.getBarTotalLeft(a,n),i.totalRght=Us(i.totalRght)+e.getBarTotalRght(a,n),i.totalDiff=Us(i.totalDiff)+e.getBarTotalDiff(a,n),i.leftTicks=r,i.rightTicks=o,i}function Xs(e,t){if(!e||!e.levels)return null;const{names:a,levels:n,format:r}=e,o=nr(r);let i=null;for(let e=0;e<n.length;e++){const r=n[e];for(let n=0;n<r.length;n+=o.jStep){if(a[o.getBarName(r,n)]===t){const t=o.getBarTotal(r,n);(!i||t>i.total)&&(i={i:e,j:n,total:t})}}}return i?{i:i.i,j:i.j}:null}function Ys(e,t,a){const n=148-e/t*148,r=a.alpha(1);return{backgroundImage:`linear-gradient(${r}, ${r})`,backgroundPosition:`-${n}px 0px`,backgroundRepeat:"no-repeat"}}const Zs=({flamebearer:t,sortBy:a,sortByDirection:n,fitMode:r,handleTableItemClick:o,highlightQuery:i,palette:s,selectedItem:l,messages:c,onRowContextMenu:f,onRowDoubleClick:u})=>{const{numTicks:d,maxSelf:h,sampleRate:m,spyName:p,units:g}=t,v=function(e){if(!e)return[];const{names:t,levels:a,format:n}=e,r="double"!==n?tr:ar,o=new Map;for(let i=0;i<a.length;i++){const s=a[i];for(let a=0;a<s.length;a+=r.jStep){const i=t[r.getBarName(s,a)];o.has(i)||o.set(i,{name:i||"<empty>",self:0,total:0});const l=o.get(i);if(!l)break;"single"===n?Js(tr,l,s,a):Qs(ar,l,s,a,e.leftTicks,e.rightTicks)}}return Array.from(o.values())}(t).sort((e,t)=>t.total-e.total),b="asc"===n?1:-1;let y;if("name"===a)y=v.sort((e,t)=>b*e[a].localeCompare(t[a]));else switch(a){case"total":case"self":y=v.sort((e,t)=>b*(e[a]-t[a]));break;case"baseline":y=v.sort((e,t)=>b*(e.totalLeft/e.leftTicks-t.totalLeft/t.leftTicks));break;case"comparison":y=v.sort((e,t)=>b*(e.totalRght/e.rightTicks-t.totalRght/t.rightTicks));break;case"diff":y=v.sort((e,t)=>{const a=gr(pr(e.totalLeft/e.leftTicks),pr(e.totalRght/e.rightTicks)),n=gr(pr(t.totalLeft/t.leftTicks),pr(t.totalRght/t.rightTicks));return b*(a-n)});break;default:y=v}const x=vr(d,m,g),w=e=>!!l.isJust&&e===l.value,j=t=>{return e.jsx("button",{className:"table-item-button",children:e.jsx("div",{className:"symbol-name",style:(a=r,a===jr?{direction:"rtl",overflow:"hidden",textOverflow:"ellipsis"}:{overflow:"hidden",textOverflow:"ellipsis"}),children:e.jsx("bdi",{dir:"ltr",children:t.name})})});var a},k=y.filter(e=>{return!i||(t=i,e.name.toLowerCase().includes(t.toLowerCase()));var t}).map(e=>{if("double"===e.type)return(e=>{const t=pr(e.leftTicks>0?e.totalLeft/e.leftTicks:0),a=pr(e.rightTicks>0?e.totalRght/e.rightTicks:0);let n=gr(t,a);Number.isFinite(n)||(n=0);let r="";n>0?r=s.badColor.rgb().string():n<0&&(r=s.goodColor.rgb().string());let i="";return 0===e.totalLeft&&e.totalRght>0?i=c.diffNew:0===e.totalRght&&e.totalLeft>0?i=c.diffRemoved:0===n?i="0%":n>0?i=`+${n.toFixed(2)}%`:n<0&&(i=`${n.toFixed(2)}%`),{"data-row":`${e.type};${e.name};${e.totalLeft};${e.leftTicks};${e.totalRght};${e.rightTicks}`,isRowSelected:w(e.name),onClick:()=>o(e),onContextMenu:t=>f(t,e.name),onDoubleClick:()=>u(e.name),cells:[{value:j(e)},{value:`${t} %`},{value:`${a} %`},{value:i,style:{color:r}}]}})(e);const t=Tr(p,e.name);return((e,t)=>({"data-row":`${e.type};${e.name};${e.self};${e.total}`,isRowSelected:w(e.name),onClick:()=>o(e),onContextMenu:t=>f(t,e.name),onDoubleClick:()=>u(e.name),cells:[{value:j(e)},{value:x.format(e.self,m),style:Ys(e.self,h,t)},{value:x.format(e.total,m),style:Ys(e.total,d,t)}]}))(e,_r(s,t))});return k.length>0?{bodyRows:k,type:"filled"}:{value:e.jsx("div",{className:"unsupported-format",children:c.noItemsFound}),type:"not-filled"}};function qs({tableBodyRef:a,flamebearer:n,isDoubles:r,fitMode:o,handleTableItemClick:i,highlightQuery:s,selectedItem:l,palette:c,onFocusOnNode:f,updateView:u,enableSandwichView:d=!0}){const h=ki(),[m,p]=ei({transition:!0}),[g,v]=t.useState({x:0,y:0}),[b,y]=t.useState(null),x=t.useCallback(e=>{if(l.isJust&&l.value===e||i({name:e}),!f)return;const t=Xs(n,e);t&&f(t.i,t.j)},[n,f,l,i]),w=t.useCallback((e,t)=>{e.preventDefault(),v({x:e.clientX,y:e.clientY}),y(t),p(!0)},[p]),j=t.useCallback(()=>{p(!1),y(null)},[p]),k=t.useCallback(()=>{if(!b||!f)return;const e=Xs(n,b);e&&f(e.i,e.j),j()},[b,n,f,j]),N=t.useCallback(()=>{b&&navigator.clipboard&&(navigator.clipboard.writeText(b),j())},[b,j]),S=t.useCallback(()=>{b&&(i({name:b}),j())},[b,i,j]),C=t.useCallback(()=>{b&&u&&(u("sandwich"),i({name:b}),j())},[b,u,i,j]),T=t.useMemo(()=>r?[{sortable:1,name:"name",label:h.location},{sortable:1,name:"baseline",label:h.baseline,default:!0},{sortable:1,name:"comparison",label:h.comparison},{sortable:1,name:"diff",label:h.diff}]:[{sortable:1,name:"name",label:h.location},{sortable:1,name:"self",label:h.self,default:!0},{sortable:1,name:"total",label:h.total}],[h,r]),_=(e=>{const a=e.filter(e=>null==e?void 0:e.default)[0]||e[0],[n,r]=t.useState(a.name),[o,i]=t.useState("desc");return{sortBy:n,sortByDirection:o,updateSortParams:e=>{let t=o;t=n===e?"asc"===t?"desc":"asc":"desc",r(e),i(t)}}})(T),M={headRow:T,...Zs({flamebearer:n,sortBy:_.sortBy,sortByDirection:_.sortByDirection,fitMode:o,handleTableItemClick:i,highlightQuery:s,palette:c,selectedItem:l,messages:h,onRowContextMenu:w,onRowDoubleClick:x})},F=l.isJust&&l.value===b;return e.jsxs(e.Fragment,{children:[e.jsx(Bs,{..._,tableBodyRef:a,table:M,className:us("flamegraph-table",{"flamegraph-table-doubles":r})}),e.jsxs(Xo,{...m,anchorPoint:g,onClose:j,className:Hs,children:[f&&e.jsxs(ri,{onClick:k,children:[e.jsx(Qn,{icon:ps.faCrosshairs}),h.focusOnThisFunction]}),e.jsxs(ri,{onClick:N,children:[e.jsx(Qn,{icon:Gr.faCopy}),h.copyFunctionName]}),e.jsxs(ri,{onClick:S,children:[e.jsx(Qn,{icon:ro.faHighlighter}),F?h.clearHighlight:h.highlightSimilarNodes]}),u&&d&&e.jsxs(ri,{onClick:C,className:Ws,children:[e.jsx(zi,{fill:"currentColor"}),h.openInSandwichView]})]})]})}const Ks=t.memo(function({flamebearer:a,fitMode:n,handleTableItemClick:r,highlightQuery:o,palette:i,selectedItem:s,onFocusOnNode:l,updateView:c,enableSandwichView:f}){const u=t.useRef(null),d=t.useRef(null),[h,m]=t.useState(0),p="double"===a.format;return t.useEffect(()=>{const e=u.current;if(!e)return;const t=e.offsetWidth-e.clientWidth;Number.isFinite(t)&&t!==h&&m(t)},[u.current,p,h]),e.jsxs("div",{"data-testid":"table-view",ref:d,style:{"--kylin-flamegraph-scrollbar-size":`${h}px`},className:p?"flamegraph-table-wrapper flamegraph-table-wrapper--double":"flamegraph-table-wrapper",children:[e.jsx("div",{className:"flamegraph-table-scroll",children:e.jsx(qs,{tableBodyRef:u,flamebearer:a,isDoubles:p,fitMode:n,highlightQuery:o,handleTableItemClick:r,palette:i,selectedItem:s,onFocusOnNode:l,updateView:c,enableSandwichView:f})}),e.jsx(Vs,{tableBodyRef:u,numTicks:a.numTicks,sampleRate:a.sampleRate,units:a.units,palette:i})]})});var Gs,el,tl={},al={};function nl(){return Gs||(Gs=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="arrow-rotate-left",a=[8634,"arrow-left-rotate","arrow-rotate-back","arrow-rotate-backward","undo"],n="f0e2",r="M256 64c-56.8 0-107.9 24.7-143.1 64l47.1 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 192c-17.7 0-32-14.3-32-32L0 32C0 14.3 14.3 0 32 0S64 14.3 64 32l0 54.7C110.9 33.6 179.5 0 256 0 397.4 0 512 114.6 512 256S397.4 512 256 512c-87 0-163.9-43.4-210.1-109.7-10.1-14.5-6.6-34.4 7.9-44.6s34.4-6.6 44.6 7.9c34.8 49.8 92.4 82.3 157.6 82.3 106 0 192-86 192-192S362 64 256 64z";e.definition={prefix:"fas",iconName:t,icon:[512,512,a,n,r]},e.faArrowRotateLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(al)),al}function rl(){return el||(el=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=nl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faUndo=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(tl)),tl}var ol,il,sl=rl(),ll={},cl={};function fl(){return ol||(ol=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="diagram-project",a=["project-diagram"],n="f542",r="M0 80C0 53.5 21.5 32 48 32l96 0c26.5 0 48 21.5 48 48l0 16 128 0 0-16c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-16-128 0 0 16c0 7.3-1.7 14.3-4.6 20.5l68.6 91.5 80 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96c0-7.3 1.7-14.3 4.6-20.5L128 224 48 224c-26.5 0-48-21.5-48-48L0 80z";e.definition={prefix:"fas",iconName:t,icon:[512,512,a,n,r]},e.faDiagramProject=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(cl)),cl}function ul(){return il||(il=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=fl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faProjectDiagram=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(ll)),ll}var dl,hl,ml=ul(),pl={},gl={};function vl(){return dl||(dl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="ellipsis-vertical",a=["ellipsis-v"],n="f142",r="M64 144a56 56 0 1 1 0-112 56 56 0 1 1 0 112zm0 224c30.9 0 56 25.1 56 56s-25.1 56-56 56-56-25.1-56-56 25.1-56 56-56zm56-112c0 30.9-25.1 56-56 56s-56-25.1-56-56 25.1-56 56-56 56 25.1 56 56z";e.definition={prefix:"fas",iconName:t,icon:[128,512,a,n,r]},e.faEllipsisVertical=e.definition,e.prefix="fas",e.iconName=t,e.width=128,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(gl)),gl}function bl(){return hl||(hl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=vl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faEllipsisV=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(pl)),pl}var yl=bl();function xl(e){if(null!=e&&!1!==e){if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e)){const t=e.map(e=>xl(e)).filter(e=>!!e);return t.length?t.join(" "):void 0}return t.isValidElement(e)?xl(e.props.children):void 0}}const wl=({placement:t,title:a,content:n,children:r})=>{const o=xl(null!=a?a:n);return o?e.jsx("span",{title:o,children:r}):e.jsx(e.Fragment,{children:r})};var jl,kl={};function Nl(){return jl||(jl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="link",a=[128279,"chain"],n="f0c1",r="M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z";e.definition={prefix:"fas",iconName:t,icon:[576,512,a,n,r]},e.faLink=e.definition,e.prefix="fas",e.iconName=t,e.width=576,e.height=512,e.ligatures=a,e.unicode=n,e.svgPathData=r,e.aliases=a}(kl)),kl}var Sl=Nl(),Cl="Input-module_input__ulQdV";const Tl=t.forwardRef(({testId:t,className:a,type:n,name:r,placeholder:o,minLength:i=0,debounceTimeout:s=100,onChange:l,value:f,htmlId:u},d)=>e.jsx(c.DebounceInput,{inputRef:d,"data-testid":t,className:`${Cl} ${a||""}`,type:n,name:r,placeholder:o,minLength:i,debounceTimeout:s,onChange:l,value:f,id:u}));var _l="SharedQueryInput-module_wrapper__XRxrd",Ml="SharedQueryInput-module_search__XlzRv",Fl="SharedQueryInput-module_search-synced__J4T4b",Rl="SharedQueryInput-module_searchWithSync__ryuQa",Pl="SharedQueryInput-module_icon__Aq0Hv",El="SharedQueryInput-module_checked__oRvod",Il="SharedQueryInput-module_sync__0IO2N",Dl="SharedQueryInput-module_syncSelected__hstBI";const Al=({onHighlightChange:a,highlightQuery:n,sharedQuery:r,width:o})=>{const i=ki(),s=(e=>{const a=t.useRef();return t.useEffect(()=>{a.current=e},[e]),a.current})(null==r?void 0:r.syncEnabled);t.useEffect(()=>{"string"==typeof(null==r?void 0:r.searchQuery)&&(r.syncEnabled&&a(r.searchQuery),!r.syncEnabled&&s&&s!==(null==r?void 0:r.id)&&a(""))},[null==r?void 0:r.searchQuery,null==r?void 0:r.syncEnabled]);const l=t.useMemo(()=>r&&r.syncEnabled?r.searchQuery||"":n,[r,n]),c=t.useMemo(()=>`${r?Rl:Ml} ${(null==r?void 0:r.syncEnabled)?Fl:""}`,[r]),f=(null==r?void 0:r.syncEnabled)?i.unsyncSearchBars:i.syncSearchBars;return e.jsxs("div",{className:_l,style:{width:o},children:[e.jsx(Tl,{testId:"flamegraph-search",className:c,type:"search",name:"flamegraph-search",placeholder:i.searchPlaceholder,minLength:1,debounceTimeout:100,onChange:e=>{a(e.target.value),r&&r.syncEnabled&&r.onQueryChange(e.target.value)},value:l}),r?e.jsx(wl,{placement:"top",title:f,children:e.jsx("button",{className:r.syncEnabled?Dl:Il,onClick:()=>{const e=!(null==r?void 0:r.syncEnabled)&&(null==r?void 0:r.id);null==r||r.toggleSync(e),e?null==r||r.onQueryChange(n):(a(n),null==r||r.onQueryChange(""))},children:e.jsx(Qn,{className:`${r.syncEnabled?El:Pl}`,icon:Sl.faLink})})}):null]})};var Ol="DiffLegend-module_flamegraph-legend__Cywr1",Ll="DiffLegend-module_flamegraph-legend-list__swdXj",Bl="DiffLegend-module_flamegraph-legend-item__0P-6g";function zl(t){const{palette:a,showMode:n}=t,r=function(e){switch(e){case"large":return[-100,-80,-60,-40,-20,-10,0,10,20,40,60,80,100];case"small":return[-100,-40,-20,0,20,40,100];default:throw new Error(`Unsupported ${e}`)}}(n),o=Mr(a);return e.jsx("div",{"data-testid":"flamegraph-legend",className:`${Ol} ${Ll}`,children:r.map(t=>e.jsxs("div",{className:Bl,style:{backgroundColor:o(t).rgb().toString()},children:[t>0?"+":"",t,"%"]},t))})}function $l(){return e.jsx("svg",{version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"12px",height:"12px",viewBox:"0 0 405.272 405.272",children:e.jsx("g",{children:e.jsx("path",{d:"M393.401,124.425L179.603,338.208c-15.832,15.835-41.514,15.835-57.361,0L11.878,227.836\n\n\t\tc-15.838-15.835-15.838-41.52,0-57.358c15.841-15.841,41.521-15.841,57.355-0.006l81.698,81.699L336.037,67.064\n\n\t\tc15.841-15.841,41.523-15.829,57.358,0C409.23,82.902,409.23,108.578,393.401,124.425z"})})})}var Vl="Dropdown-module_dropdownMenu__tbN8r",Hl="Dropdown-module_dropdownMenuButton__Xy8M4";function Wl({id:t,children:a,className:n,disabled:r,value:o,label:i,onItemClick:s,overflow:l,position:c,direction:f,align:u,viewScroll:d,arrow:h,menuButtonClassName:m="",ariaLabel:p,portal:g,...v}){const b=v.menuButton||e.jsx(Jl,{"aria-label":p,className:`${Hl} ${m}`,disabled:r,type:"button",children:o||i});return e.jsxs(ai,{id:t,"aria-label":p,className:us(n,Vl),"data-testid":v["data-testid"],onItemClick:s,overflow:l,position:c,direction:f,align:u,viewScroll:d,arrow:h,menuButton:b,portal:g,children:[e.jsx(oi,{children:i}),a]})}const Ul=ri,Jl=Oo;var Ql="DiffLegendPaletteDropdown-module_container__h8Tts",Xl="DiffLegendPaletteDropdown-module_triggerButton__oezA6",Yl="DiffLegendPaletteDropdown-module_dropdownArrow__-Lu0w",Zl="DiffLegendPaletteDropdown-module_menuItem__5iWry",ql="DiffLegendPaletteDropdown-module_menuItemText__a-tt0";const Kl=[hi,mi],Gl=t=>{const{palette:a=hi,onChange:n}=t,r=ki(),o=e=>"Default"===e.name?r.paletteDefaultName:"Color Blind"===e.name?r.paletteColorBlindName:e.name,i=e=>"Default"===e.name?r.paletteDefaultDesc:"Color Blind"===e.name?r.paletteColorBlindDesc:"";return e.jsx("div",{className:Ql,children:e.jsx(Wl,{label:r.diffLegendSelectPalette,align:"end",menuButton:e.jsxs(Jl,{className:us(Hl,Xl),children:[e.jsx(zl,{palette:a,showMode:"small"}),e.jsx("span",{className:Yl})]}),onItemClick:e=>{e.value&&n(e.value)},children:Kl.map(t=>e.jsx(Ul,{value:t,children:e.jsxs("div",{className:Zl,children:[e.jsxs("span",{className:ql,children:[o(t)," ",i(t)]}),t.name===a.name&&e.jsx($l,{})]})},t.name))})})};var ec={navbar:"Toolbar-module_navbar__XN6xZ",searchWrapper:"Toolbar-module_searchWrapper__k--ua",rightSection:"Toolbar-module_rightSection__if7LO",viewType:"Toolbar-module_viewType__AKARg",toggleViewButton:"Toolbar-module_toggleViewButton__OQ9-U",fitModeButton:"Toolbar-module_fitModeButton__jOxve",selected:"Toolbar-module_selected__vwBQt",collapseNodeButton:"Toolbar-module_collapseNodeButton__bLdiw",resetViewButton:"Toolbar-module_resetViewButton__y2ebV",divider:"Toolbar-module_divider__dG6pE",itemsContainer:"Toolbar-module_itemsContainer__gSTMF",item:"Toolbar-module_item__o-hKc",moreButton:"Toolbar-module_moreButton__rhOdT",active:"Toolbar-module_active__36Kt-",navbarCollapsedItems:"Toolbar-module_navbarCollapsedItems__vojhw"};const tc=b.bind(ec),ac=(e,t,a)=>{const n=0===t?e-360-5:e-360-16-5;let r=0,o=0;return a.reverse().forEach(e=>{o+=e,n<=o&&(r+=1)}),r},nc=()=>e.jsx("div",{className:ec.divider}),rc=t.memo(({view:a,handleSearchChange:n,highlightQuery:r,isFlamegraphDirty:o,reset:s,updateFitMode:l,fitMode:c,updateView:f,selectedNode:u,onFocusOnSubtree:d,flamegraphType:h,enableChangingDisplay:m=!0,sharedQuery:p,ExportData:g,palette:v,setPalette:b})=>{const y=t.useRef(null),x=ki(),w="double"===h&&v&&b,j=[{el:e.jsxs(e.Fragment,{children:[e.jsx(sc,{fitMode:c,updateFitMode:l}),e.jsx(nc,{})]}),width:93},{el:e.jsx(ic,{isFlamegraphDirty:o,reset:s}),width:44},{el:e.jsxs(e.Fragment,{children:[e.jsx(oc,{selectedNode:u,onFocusOnSubtree:d}),e.jsx(nc,{})]}),width:49},m?{el:e.jsx(cc,{flamegraphType:h,view:a,updateView:f}),width:44*("single"===h?5:3)}:null,t.isValidElement(g)?{el:e.jsxs(e.Fragment,{children:[e.jsx(nc,{}),g]}),width:49}:null].filter(e=>null!==e),k=j.reduce((e,t)=>[...e,t.width],[]),{isCollapsed:N,collapsedItemsNumber:S,handleMoreClick:C}=((e,a)=>{const[n,r]=t.useState(!0),[o,s]=t.useState(0);return t.useLayoutEffect(()=>{if(e.current){const{width:t}=e.current.getBoundingClientRect(),n=ac(t,o,a);s(n)}},[e.current,a]),i(e,e=>{const{width:t}=e.target.getBoundingClientRect(),n=ac(t,o,a);s(n),r(!0)}),{isCollapsed:n,handleMoreClick:()=>{r(e=>!e)},collapsedItemsNumber:o}})(y,k),T=j.reduce((e,t,a)=>(a<S?e.hidden.push(t):e.visible.push(t),e),{visible:[],hidden:[]});return e.jsx("div",{role:"toolbar",ref:y,children:e.jsxs("div",{className:ec.navbar,children:[e.jsx("div",{className:ec.searchWrapper,children:e.jsx(Al,{width:360,onHighlightChange:n,highlightQuery:r,sharedQuery:p})}),e.jsxs("div",{className:ec.rightSection,children:[w&&e.jsxs(e.Fragment,{children:[e.jsx(Gl,{palette:v,onChange:b}),e.jsx(nc,{})]}),e.jsxs("div",{className:ec.itemsContainer,children:[T.visible.map((t,a)=>e.jsx("div",{className:ec.item,style:{width:t.width},children:t.el},a)),0!==S&&e.jsx(wl,{placement:"top",title:x.more,children:e.jsx("button",{onClick:C,className:tc({[ec.moreButton]:!0,[ec.active]:!N}),children:e.jsx(Qn,{icon:yl.faEllipsisV})})})]})]}),!N&&e.jsx("div",{className:ec.navbarCollapsedItems,children:T.hidden.map((t,a)=>e.jsx("div",{className:ec.item,style:{width:t.width},children:t.el},a))})]})})});function oc({onFocusOnSubtree:t,selectedNode:a}){const n=ki(),r=a.mapOr(()=>{},e=>()=>t(e.i,e.j));return e.jsx(wl,{placement:"top",title:n.collapseNodesAbove,children:e.jsx("div",{children:e.jsx(As,{disabled:!a.isJust,onClick:r,className:ec.collapseNodeButton,"aria-label":n.collapseNodesAbove,children:e.jsx(Qn,{icon:co.faCompressAlt})})})})}function ic({isFlamegraphDirty:t,reset:a}){const n=ki();return e.jsx(wl,{placement:"top",title:n.resetView,children:e.jsx("span",{children:e.jsx(As,{id:"reset",disabled:!t,onClick:a,className:ec.resetViewButton,"aria-label":n.resetView,children:e.jsx(Qn,{icon:sl.faUndo})})})})}function sc({fitMode:t,updateFitMode:a}){const n=ki(),r=e=>t===e;return e.jsxs(e.Fragment,{children:[e.jsx(wl,{placement:"top",title:n.headFirst,children:e.jsx(As,{onClick:()=>a("HEAD"),className:tc({[ec.fitModeButton]:!0,[ec.selected]:r("HEAD")}),children:e.jsx($i,{})})}),e.jsx(wl,{placement:"top",title:n.tailFirst,children:e.jsx(As,{onClick:()=>a("TAIL"),className:tc({[ec.fitModeButton]:!0,[ec.selected]:r("TAIL")}),children:e.jsx(Vi,{})})})]})}const lc=(t,a)=>"single"===t?[{label:a.viewTable,value:"table",Icon:Oi},{label:a.viewTableAndFlamegraph,value:"both",Icon:Li},{label:a.viewFlamegraph,value:"flamegraph",Icon:Bi},{label:a.viewSandwich,value:"sandwich",Icon:zi},{label:a.viewGraphviz,value:"graphviz",Icon:()=>e.jsx(Qn,{icon:ml.faProjectDiagram})}]:[{label:a.viewTable,value:"table",Icon:Oi},{label:a.viewTableAndFlamegraph,value:"both",Icon:Li},{label:a.viewFlamegraph,value:"flamegraph",Icon:Bi}];function cc({view:t,updateView:a,flamegraphType:n}){const r=ki(),o=lc(n,r);return e.jsx("div",{className:ec.viewType,children:o.map(({label:n,value:r,Icon:o})=>e.jsx(wl,{placement:"top",title:n,children:e.jsx(As,{"data-testid":r,onClick:()=>a(r),className:tc({[ec.toggleViewButton]:!0,selected:t===r}),children:e.jsx(o,{})})},r))})}function fc(e,t){const a={},n={};let r={name:"total",children:[],self:[],total:[],key:"/total"};return(t?[e,t]:[e]).forEach((e,t)=>{var o,i;for(let s=0;s<e.levels.length;s+=1)for(let l=0;l<e.levels[s].length;l+=4){const c=[t,s,l].join("/"),f=e.names[e.levels[s][l+3]],u=e.levels[s][l+0],d=e.levels[s][l+1],h=e.levels[s][l+2];let m="";if(0!==s){const a=s-1,r=e.levels[a];for(let e=0;e<r.length;e+=4){const o=r[e+0],i=r[e+1];if(u>=o&&u<o+i){const r=[t,a,e].join("/");m=n[r].key;break}}}const p=[m||"",f].join("/"),g=!a[p];a[p]||(a[p]={name:f,children:[],self:[],total:[],key:p});const v=a[p];(o=v.total)[t]||(o[t]=0),v.total[t]+=d,(i=v.self)[t]||(i[t]=0),v.self[t]+=h,n[c]=v,m&&g&&a[m].children.push(v),0===s&&(r=v)}}),r}const uc=e=>{const t={maxSelf:100,names:[],levels:[]},a=(e,n,r)=>{var o;const{name:i,children:s,self:l,total:c,offset:f}=e;t.names.push(i),(o=t.levels)[n]||(o[n]=[]),t.maxSelf=Math.max(t.maxSelf,l[0]||0),t.levels[n]=t.levels[n].concat([r,c[0]||0,l[0]||0,t.names.length-1]);for(let e=0;e<s.length;e+=1){r+=a(s[e],n+1,r)}return f||c[0]||0};return a(e,0,0),t};function dc(e){const t=new Map;for(let a=0;a<e.children.length;a+=1)t.has(e.children[a].name)||t.set(e.children[a].name,e.children[a]);for(let a=0;a<e.children.length;a+=1){const n=e.children[a],r=t.get(e.children[a].name);r&&r!==n&&(r.total[0]+=n.total[0],r.self[0]+=n.self[0],r.children=r.children.concat(n.children))}e.children=Array.from(t.values());for(let t=0;t<e.children.length;t+=1)dc(e.children[t])}function hc(e,t){const a=function(e,t){const a=fc(e),n={format:"single",numTicks:0,maxSelf:100,sampleRate:100,names:[],levels:[],units:e.units,spyName:e.spyName},r={name:t,total:[],self:[0],children:[]},o=e=>{e.name===t&&(n.numTicks+=e.total[0],r.total=[n.numTicks],r.children=r.children.concat(e.children));for(let t=0;t<e.children.length;t+=1)o(e.children[t])};return o(a),dc(r),{...n,...uc(r)}}(JSON.parse(JSON.stringify(e)),t);return a}function mc(e,t){const a=function(e,t){const a=fc(e),n={format:"single",maxSelf:100,sampleRate:100,numTicks:0,names:[],levels:[],units:e.units,spyName:e.spyName},r=[],o=[],i={name:t,total:[0],self:[0],children:[]},s=(e,a=[])=>{const i=a.concat([{...e,children:[]}]);e.name===t&&(o.push(i),r.push(e.total[0]),n.numTicks+=e.total[0]);for(let t=0;t<e.children.length;t+=1)s(e.children[t],i)};s(a),o.forEach((e,t)=>{i.children.push(((e,t)=>{const a={};let n=a;return e.forEach(({name:e,...a})=>{const r={name:e,...a,total:[t]};n.children=[r],n=r}),a.children[0]})(e.reverse(),r[t]))}),dc(i);const l=uc(i);return l.levels=l.levels.reverse().slice(0,-1),{...n,...l}}(JSON.parse(JSON.stringify(e)),t);return a}var pc={flamegraphContainer:"FlamegraphRenderer-module_flamegraphContainer__-7FRV",createdBy:"FlamegraphRenderer-module_createdBy__rHAOT",horizontal:"FlamegraphRenderer-module_horizontal__zs7--",vertical:"FlamegraphRenderer-module_vertical__fRcHg",panesWrapper:"FlamegraphRenderer-module_panesWrapper__L-mlA",tablePane:"FlamegraphRenderer-module_tablePane__Gin7Y",sandwichPane:"FlamegraphRenderer-module_sandwichPane__IEOyR",sandwichPaneInfo:"FlamegraphRenderer-module_sandwichPaneInfo__5hT4a",arrow:"FlamegraphRenderer-module_arrow__dPzpE",sandwichTop:"FlamegraphRenderer-module_sandwichTop__7N0ZY",sandwichBottom:"FlamegraphRenderer-module_sandwichBottom__Dc64g",name:"FlamegraphRenderer-module_name__XRbN9"};function gc(e){const t=[];return Object.keys(e).forEach(a=>{var n;t.push(`${a}="${n=String(e[a]||""),n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`)}),`[${t.join(" ")}]`}function vc(e,t){return`${(100*e/t).toFixed(2)}%`}function bc(e,t){let a,n,r,o;t?(a=.1,n=.93):(a=1,n=.7),e=Math.max(-1,Math.min(1,e)),Math.abs(e)<.2&&(a*=Math.abs(e)/.2),e>0&&(e**=1-.7),e<0&&(e=-((-e)**(1-.7))),e<0?(o=n,r=n*(1+a*e)):(r=n,o=n*(1-a*e));const i=n*(1-a);return`#${Math.floor(255*r).toString(16).padStart(2,"0")}${Math.floor(255*o).toString(16).padStart(2,"0")}${Math.floor(255*i).toString(16).padStart(2,"0")}`}function yc(e,t,a,n){const{self:r}=t,{total:o}=t,i=t.name.replace(/"/g,'\\"'),s=e(r),l=8+Math.ceil(16*Math.sqrt(r/a)),c=bc(o/n,!1),f=bc(o/n,!0),u=function(e,t,a,n,r){let o="";o=`${function(e){return e.replace(/.*\//,"")}(t)}\n`;const i=e(a);0!==a?o=`${o+i} (${vc(a,r)})`:o+="0";let s=i;n!==a&&(o+=0!==a?"\n":" ",s=e(n),o=`${o}of ${s} (${vc(n,r)})`);return o}(e,i,r,o,n),d={label:u,id:`node${t.index}`,fontsize:l,shape:"box",tooltip:`${i} (${s})`,color:c,fontcolor:"#000000",style:"filled",fontname:"",fillcolor:f};return`N${t.index} ${gc(d)}`}function xc(e){if("double"===e.metadata.format)return"diff flamegraphs are not supported";const t=fc(e.flamebearer),a=[],n=[];const[r,o,,i]=function e(t,a,n,r,o){return t.children.forEach(t=>{const[i,s]=e(t,a,n,r,o);a=Math.max(a,i),n=Math.max(n,s)}),a=Math.max(a,t.self[0]),n=Math.max(n,t.total[0]),r+=t.self[0],o+=t.total[0],[a,n,r,o]}(t,0,0,0,0),{sampleRate:s,units:l}=e.metadata,c=vr(o,s,l),f=e=>c.format(e,s,!0);let u={};const d={};let h=0;function m(e,t){return-1===t.indexOf(e.name)&&(u[e.name]?(u[e.name].self+=e.self[0],u[e.name].total+=e.total[0]):(h+=1,u[e.name]={index:h,name:e.name,self:e.self[0],total:e.total[0],parents:[],children:[]})),e.children.forEach(a=>{const n=m(a,t.concat([e.name])),r=`${e.name}/${a.name}`;a.name!==e.name&&(d[r]?d[r].weight+=a.total[0]:d[r]={from:u[e.name],to:n,weight:a.total[0],residual:!1},n.parents.push(d[r]),u[e.name].children.push(d[r]))}),u[e.name]}t.children.forEach(e=>{m(e,[])});const p=.005*i,g=.001*i;function v(e,t){let a=0,n=t;if(e.forEach(e=>{e.weight>0&&(n+=Math.abs(e.weight))}),0!==n&&(e.forEach(e=>{const t=Math.abs(e.weight)/n;a+=-t*Math.log2(t)}),t>0)){const e=Math.abs(t)/n;a+=-e*Math.log2(e)}return a}Object.keys(u).forEach(e=>{u[e].total<p&&delete u[e]});const b={};Object.keys(u).forEach(e=>{b[u[e].name]=function(e){let t=0;return 0===e.parents.length?t+=1:t+=v(e.parents,0),0===e.children.length?t+=1:t+=v(e.children,e.self),t*e.total+e.self}(u[e])});const y=Object.values(u).sort((e,t)=>{const a=b[e.name],n=b[t.name];return a!==n?n-a:e.name!==t.name?e.name<t.name?-1:1:e.self!==t.self?n-a:e.name<t.name?-1:1}),x={};function w(e){const[t,a]=[e.from,e.to],n={},r=[a];for(;r.length>0;){const a=r.shift();for(let o=0;o<a.parents.length;o+=1){const i=a.parents[o];if(e!==i&&!n[i.from.name]){if(i.from===t)return!0;n[i.from.name]=!0,r.push(i.from)}}}return!1}return y.forEach(e=>{x[e.name]=e}),y.slice(80).forEach(e=>{delete x[e.name]}),function e(t,a){const n=!x[t.name];t.children.forEach(r=>{const o=!x[r.name];if(e(r,n?a:t),!o&&a&&n){const e=`${a.name}/${r.name}`;d[e]||(d[e]={from:u[a.name],to:u[r.name],weight:0,residual:!0}),d[e].weight+=r.total[0],d[e].residual=!0}})}(t,null),u=x,y.reverse().forEach(e=>{const t=e.parents.sort((e,t)=>t.weight-e.weight),a=[];for(let e=0;e<t.length;e+=1){const n=t[e];if(!n.residual)break;w(n)&&(a.push(n),delete d[`${n.from.name}/${n.to.name}`])}a.forEach(e=>{e.from.children=e.from.children.filter(t=>t.to!==e.to),e.to.parents=e.to.parents.filter(t=>t.from!==e.from)})}),Object.keys(d).forEach(e=>{const t=d[e];u[t.from.name]||delete d[e],u[t.to.name]||delete d[e],t.weight<g&&delete d[e]}),Object.keys(u).forEach(e=>{a.push(yc(f,u[e],r,o))}),Object.keys(d).forEach(e=>{n.push(function(e,t,a){const n=t.from.name.replace(/"/g,'\\"'),r=t.to.name.replace(/"/g,'\\"'),o=t.weight,i=e(t.weight),s=`${n} -> ${r} (${i})`,l={label:i,weight:1+100*o/a,penwidth:1+5*o/a,tooltip:s,labeltooltip:s,fontname:"",color:bc(o/a,!1),style:t.residual?"dotted":""};return`N${t.from.index} -> N${t.to.index} ${gc(l)}`}(f,d[e],o))}),`digraph "unnamed" {\n fontname= ""\n ${a.join("\n")}\n ${n.join("\n")}\n }`}var wc="GraphVizPanel-module_graphVizPane__B18cQ";const jc=()=>null;function kc({flamebearer:a}){var n,r;const o=a,i=(null===(n=o.metadata)||void 0===n?void 0:n.format)&&(null===(r=o.flamebearer)||void 0===r?void 0:r.levels),s=`graphviz-pane-${(null==o?void 0:o.appName)||String((new Date).valueOf())}`,l=t.useMemo(()=>xc(o),[JSON.stringify(o)]);return e.jsx("div",{className:wc,children:i?e.jsx(jc,{options:{zoom:!0,width:"150%",height:"100%",scale:1,useWorker:!1},dot:l}):e.jsx("div",{children:"NO DATA"})},s)}function Nc(e,t){const a=[...t];function n(e,t,a){for(const n of e){let e=0;for(let r=t;r<n.length;r+=a)n[r]-=e,e+=n[r]+n[r+1]}}return"double"===e?(n(a,0,7),n(a,3,7)):n(a,0,4),a}function Sc(e,t){const a=[...t];function n(e,t,a){for(const n of e){let e=0;for(let r=t;r<n.length;r+=a)n[r]+=e,e=n[r]+n[r+1]}}return"double"===e?(n(a,0,7),n(a,3,7)):n(a,0,4),a}function Cc(e){if(e.profile&&e.flamebearer&&console.warn("'profile' and 'flamebearer' properties are mutually exclusive. Please use profile if possible."),e.profile){const a={...e.profile,flamebearer:{...e.profile.flamebearer}};a.flamebearer.levels=JSON.parse(JSON.stringify(a.flamebearer.levels)),(t=a).flamebearer.levels=Sc(t.metadata.format,t.flamebearer.levels);const n={...a,...a.metadata,...a.flamebearer,flamebearer:void 0,metadata:void 0};return delete n.flamebearer,delete n.metadata,n}var t;if(e.flamebearer)return e.flamebearer;return{format:"single",names:[],units:"unknown",levels:[[]],spyName:"unknown",numTicks:0,sampleRate:0,maxSelf:0}}class Tc extends t.Component{constructor(t){super(t),this.resetFlamegraphState={focusedNode:a.Maybe.nothing(),zoom:a.Maybe.nothing()},this.initialFlamegraphState=this.resetFlamegraphState,this.calcNewConfigs=(e,t)=>{const a=this.state.flamegraphConfigs,n=(e,t,a)=>{const n=(e,t,a)=>e.names[nr(e.format).getBarName(e.levels[t],a)];if(a.isNothing)return!0;try{const r=a,o=n(e,r.value.i,r.value.j);return o===n(t,r.value.i,r.value.j)}catch{return!1}};n(e,t,this.state.flamegraphConfigs.zoom)||(a.zoom=this.resetFlamegraphState.zoom);return n(e,t,this.state.flamegraphConfigs.focusedNode)||(a.focusedNode=this.resetFlamegraphState.focusedNode),a},this.onSearchChange=e=>{this.setState({searchQuery:e})},this.isSameFlamebearer=(e,t)=>function(e,t){var a;return e.format===t.format&&e.numTicks===t.numTicks&&e.sampleRate===t.sampleRate&&e.units===t.units&&(null===(a=e.names)||void 0===a?void 0:a.length)===(null==t?void 0:t.names.length)&&e.levels.length===t.levels.length&&!!e.names.every((e,a)=>e===t.names[a])&&!!function(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++){if(e[a].length!==t[a].length)return!1;for(let n=0;n<e[a].length;n++)if(e[a][n]!==t[a][n])return!1}return!0}(e.levels,t.levels)&&JSON.stringify({...e,levels:void 0,names:void 0})===JSON.stringify({...t,levels:void 0,names:void 0})}(e,t),this.onReset=()=>{this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,...this.initialFlamegraphState},selectedItem:a.Maybe.nothing()})},this.onFlamegraphZoom=e=>{e.isJust&&0===e.value.i&&0===e.value.j?this.onReset():this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,zoom:e}})},this.onFocusOnNode=(e,t)=>{if(0===e&&0===t)return void this.onReset();let n={...this.state.flamegraphConfigs};const{zoom:r}=this.state.flamegraphConfigs;r.isJust&&r.value.i<=e&&(n={...n,zoom:this.initialFlamegraphState.zoom}),this.setState({...this.state,flamegraphConfigs:{...n,focusedNode:a.Maybe.just({i:e,j:t})}})},this.isNameInFocusedSubtree=e=>{const{focusedNode:t}=this.state.flamegraphConfigs;if(t.isNothing)return!0;const{flamebearer:a}=this.state;if(!a||!a.levels)return!0;const{names:n,levels:r,format:o}=a,i=nr(o),s=t.value.i,l=t.value.j,c=r[s];if(!c)return!0;const f=i.getBarOffset(c,l),u=f+i.getBarTotal(c,l);for(let t=s;t<r.length;t++){const a=r[t];for(let t=0;t<a.length;t+=i.jStep){const r=i.getBarOffset(a,t),o=i.getBarTotal(a,t);if(r>=f&&r+o<=u){if(n[i.getBarName(a,t)]===e)return!0}}}return!1},this.setActiveItem=e=>{const{name:t}=e;if(this.state.selectedItem.isJust&&t===this.state.selectedItem.value)return void this.setState({selectedItem:a.Maybe.nothing()});this.isNameInFocusedSubtree(t)?this.setState({selectedItem:a.Maybe.just(t)}):this.setState({selectedItem:a.Maybe.just(t),flamegraphConfigs:{...this.state.flamegraphConfigs,focusedNode:this.resetFlamegraphState.focusedNode}})},this.getHighlightQuery=()=>this.state.selectedItem.isJust?this.state.selectedItem.value:this.state.searchQuery,this.updateView=e=>{"sandwich"===e&&this.setState({searchQuery:"",flamegraphConfigs:this.resetFlamegraphState}),this.setState({view:e})},this.updateFlamegraphDirtiness=()=>{const e=this.isDirty();this.setState({isFlamegraphDirty:e})},this.updateFitMode=e=>{this.setState({fitMode:e})},this.clearFocus=()=>{this.setState(e=>({...e,flamegraphConfigs:{...e.flamegraphConfigs,...this.resetFlamegraphState}}))},this.getActiveRange=()=>{const{flamebearer:e}=this.state,{zoom:t,focusedNode:a}=this.state.flamegraphConfigs,n=e.numTicks;if(!n)return{rangeMin:0,rangeMax:1};const r=nr(e.format),o=t=>{const a=e.levels[t.i];if(!a)return{rangeMin:0,rangeMax:1};const o=r.getBarOffset(a,t.j),i=r.getBarTotal(a,t.j);return{rangeMin:o/n,rangeMax:(o+i)/n}};return t.match({Just:e=>a.match({Just:t=>{const a=o(t),n=o(e);return a.rangeMax-a.rangeMin<n.rangeMax-n.rangeMin?a:n},Nothing:()=>o(e)}),Nothing:()=>a.match({Just:e=>o(e),Nothing:()=>({rangeMin:0,rangeMax:1})})})},this.isDirty=()=>this.state.selectedItem.isJust||JSON.stringify(this.initialFlamegraphState)!==JSON.stringify(this.state.flamegraphConfigs),this.handleSetPalette=e=>{this.setState({palette:e})},this.render=()=>{var t;const a=e.jsx("div",{className:Br(pc.tablePane,"vertical"===this.state.panesOrientation?pc.vertical:pc.horizontal),children:e.jsx(Ks,{"data-testid":"table-view",flamebearer:this.state.flamebearer,fitMode:this.state.fitMode,highlightQuery:this.state.searchQuery,selectedItem:this.state.selectedItem,handleTableItemClick:this.setActiveItem,palette:this.state.palette,onFocusOnNode:this.onFocusOnNode,updateView:this.props.onlyDisplay?void 0:this.updateView,enableSandwichView:this.props.enableSandwichView})},"table-pane"),n=this.shouldShowToolbar(),r=!this.state.flamebearer||this.state.flamebearer.names.length<=1,o=this.context,i="Location"!==o.location,s=this.state.flamebearer.numTicks,l=vr(s,this.state.flamebearer.sampleRate,this.state.flamebearer.units).format(s,this.state.flamebearer.sampleRate),c=hr(l,i)||l,u=function(e,t=mr){const a=Math.abs(e);for(const{value:n,label:r}of t)if(a>=n)return`${(e/n).toFixed(2).replace(/\.?0+$/,"")} ${r}`;return ur(e)}(s,o.sampleCountFormat),d=o.tooltipSamples.replace(/[::]\s*$/,""),h=(null===(t=o.tooltipUnitTitles[this.state.flamebearer.units])||void 0===t?void 0:t.formattedValue)||o.tooltipUnitTitles.unknown.formattedValue,m=this.getActiveRange(),p=m.rangeMin>0||m.rangeMax<1,g=Math.max(0,Math.min(s,(m.rangeMax-m.rangeMin)*s)),v=s>0?g/s*100:0,b=(()=>{const e=nr(this.state.flamebearer.format),t=this.state.flamegraphConfigs.focusedNode.mapOrElse(()=>this.state.flamegraphConfigs.zoom.mapOrElse(()=>null,e=>e),e=>e);if(!t)return"";const a=this.state.flamebearer.levels[t.i];if(!a)return"";const n=e.getBarName(a,t.j);return this.state.flamebearer.names[n]||""})(),y=e.jsx(is,{showCredit:this.props.showCredit,flamebearer:this.state.flamebearer,highlightQuery:this.getHighlightQuery(),setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,updateView:this.props.onlyDisplay?void 0:this.updateView,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:n,setPalette:this.handleSetPalette,enableSandwichView:this.props.enableSandwichView,breadcrumb:r?void 0:{totalValueText:c,totalSamplesText:u,samplesLabel:d,unitLabel:h,hasFocus:p,focusPercent:v,focusLabel:b,ofTotalPlacement:i?"before":"after",ofTotalLabel:o.ofTotal,clearFocusLabel:o.clearFocus,onClearFocus:this.clearFocus}},"flamegraph-pane"),x=(()=>{if("sandwich"!==this.state.view)return e.jsx("div",{className:pc.sandwichPane},"sandwich-pane");if(this.state.selectedItem.isNothing)return e.jsx("div",{className:pc.sandwichPane,children:e.jsxs("div",{className:Br(pc.sandwichPaneInfo,"vertical"===this.state.panesOrientation?pc.vertical:pc.horizontal),children:[e.jsx("div",{className:pc.arrow}),"Select a function to view callers/callees sandwich view"]})},"sandwich-pane");const t=mc(this.state.flamebearer,this.state.selectedItem.value),a=hc(this.state.flamebearer,this.state.selectedItem.value),r=t=>e.jsx(is,{disableClick:!0,showCredit:this.props.showCredit,highlightQuery:"",setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:n,setPalette:this.handleSetPalette,...t});return e.jsxs("div",{className:pc.sandwichPane,children:[e.jsxs("div",{className:pc.sandwichTop,children:[e.jsx("span",{className:pc.name,children:"Callers"}),r({flamebearer:t})]}),e.jsxs("div",{className:pc.sandwichBottom,children:[e.jsx("span",{className:pc.name,children:"Callees"}),r({flamebearer:a,headerVisible:!1,showSingleLevel:!0})]})]},"sandwich-pane")})(),w=function(e,t,a,n,r){switch(e){case"table":return[a];case"flamegraph":return[t];case"sandwich":return[a,n];case"both":return[a,t];case"graphviz":return[r];default:throw new Error(`Invalid view '${e}'`)}}(this.state.view,y,a,x,e.jsx(kc,{flamebearer:this.state.flamebearer}));return e.jsxs("div",{children:[e.jsxs("div",{children:[n&&e.jsx(rc,{sharedQuery:this.props.sharedQuery,enableChangingDisplay:!this.props.onlyDisplay,flamegraphType:this.state.flamebearer.format,view:this.state.view,handleSearchChange:this.onSearchChange,reset:this.onReset,updateView:this.updateView,updateFitMode:this.updateFitMode,fitMode:this.state.fitMode,isFlamegraphDirty:this.isDirty(),selectedNode:this.state.flamegraphConfigs.zoom,highlightQuery:this.state.searchQuery,onFocusOnSubtree:this.onFocusOnNode,ExportData:this.props.ExportData,palette:this.state.palette,setPalette:this.handleSetPalette}),this.props.children,e.jsx("div",{className:`${pc.flamegraphContainer} ${Br("vertical"===this.state.panesOrientation?pc.vertical:pc.horizontal,pc[this.state.panesOrientation],pc.panesWrapper)}`,children:r?e.jsx($r,{}):w.map(e=>e)})]}),this.props.showPyroscopeLogo&&e.jsxs("div",{className:pc.createdBy,children:["Created by",e.jsxs("a",{href:"https://twitter.com/PyroscopeIO",rel:"noreferrer",target:"_blank",children:[e.jsx(f,{width:"30",height:"30"}),"@PyroscopeIO"]})]})]})},this.state={isFlamegraphDirty:!1,view:this.props.onlyDisplay?this.props.onlyDisplay:"both",fitMode:"HEAD",flamebearer:Cc(t),panesOrientation:t.panesOrientation?t.panesOrientation:"horizontal",searchQuery:"",selectedItem:a.Maybe.nothing(),flamegraphConfigs:this.initialFlamegraphState,palette:hi}}componentDidUpdate(e,t){if(e.profile!==this.props.profile||e.flamebearer!==this.props.flamebearer){const e=t.flamebearer,n=Cc(this.props);if(!this.isSameFlamebearer(e,n)){const t=this.calcNewConfigs(e,n);return void this.setState({flamebearer:n,flamegraphConfigs:{...this.state.flamegraphConfigs,...t},selectedItem:a.Maybe.nothing()})}}t.flamegraphConfigs!==this.state.flamegraphConfigs&&this.updateFlamegraphDirtiness()}shouldShowToolbar(){return void 0===this.props.showToolbar||this.props.showToolbar}}Tc.contextType=wi,Tc.defaultProps={showCredit:!1};const _c={showPyroscopeLogo:!1},Mc=(e,t)=>{if(t)return t;const a=null!=e?e:"auto";return"zh-CN"===("auto"===a?"undefined"!=typeof navigator&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh-CN":"en":a)?yi:bi};exports.Box=function(t){const{children:a,noPadding:n,className:r="",theme:o="dark"}=t,i=n?"":Xn.padding;return e.jsx("div",{className:`${Xn.box} ${i} ${r}`,"data-theme":o,children:a})},exports.DefaultPalette=hi,exports.Flamegraph=Or,exports.FlamegraphI18nProvider=ji,exports.FlamegraphRenderer=a=>{const{i18n:n,locale:r,colorMode:o="light",sandwich:i=!0,...s}=a,l=t.useMemo(()=>Mc(r,n),[r,n]),c=t.useMemo(()=>(e=>{switch(e){case"dark":return"ps-theme-dark";case"kylin":return"ps-theme-kylin";default:return"ps-theme-light"}})(o),[o]);return e.jsx("pyro-flamegraph",{className:c,children:e.jsx(ji,{messages:l,children:e.jsx(Tc,{..._c,enableSandwichView:i,...s})})})},exports.convertJaegerTraceToProfile=function(e){const t={numTicks:0,maxSelf:0,names:[],levels:[]},a={},n={children:[]};return e.spans.forEach(e=>{e.children=[],a[e.spanID]=e}),e.spans.forEach(e=>{let t=n;e.references&&e.references.length>0&&(t=a[e.references[0].spanID]||n),t.children.push(e)}),function e(t,a){(t.children||[]).forEach(t=>e(t));let n=0;const r=u(t.children||[],e=>e.operationName);t.children=d(r,e=>{const t=e[0];for(let a=1;a<e.length;a+=1)t.duration+=e[a].duration;return n+=t.duration,t}),t.total=t.duration||n,t.self=Math.max(0,t.total-n)}(n),function a(n,r,o){var i;return t.numTicks||(t.numTicks=n.total),(i=t.levels)[r]||(i[r]=[]),t.levels[r].push(o),t.levels[r].push(n.total),t.levels[r].push(n.self),t.names.push((n.processID?`${e.processes[n.processID].serviceName}: `:"")+(n.operationName||"total")),t.levels[r].push(t.names.length-1),(n.children||[]).forEach(e=>{o+=a(e,r+1,o)}),n.total}(n,0,0),t.levels=Nc("single",t.levels),{version:1,flamebearer:t,metadata:{format:"single",units:"trace_samples",spyName:"tracing",sampleRate:1e6}}},exports.diffTwoProfiles=function(e,t){e.flamebearer.levels=Sc("single",e.flamebearer.levels),t.flamebearer.levels=Sc("single",t.flamebearer.levels);const a=function(e,t){const a={format:"double",numTicks:e.numTicks+t.numTicks,leftTicks:e.numTicks,rightTicks:t.numTicks,maxSelf:100,sampleRate:e.sampleRate,names:[],levels:[],units:e.units,spyName:e.spyName},n=fc(e,t),r=(e,t,n,o)=>{var i;const{name:s,children:l,self:c,total:f}=e;a.names.push(s),(i=a.levels)[t]||(i[t]=[]),a.maxSelf=Math.max(a.maxSelf,c[0]||0,c[1]||0),a.levels[t]=a.levels[t].concat([n,f[0]||0,c[0]||0,o,f[1]||0,c[1]||0,a.names.length-1]);for(let e=0;e<l.length;e+=1){const[a,i]=r(l[e],t+1,n,o);n+=a,o+=i}return[f[0]||0,f[1]||0]};return r(n,0,0,0),a}(e.flamebearer,t.flamebearer);a.levels=Nc("double",a.levels);const n={...e.metadata};return n.format="double",{version:1,flamebearer:a,metadata:n,leftTicks:e.flamebearer.numTicks,rightTicks:t.flamebearer.numTicks}},exports.flamegraphDefaultMessages=bi,exports.flamegraphZhCNMessages=yi;
18
18
  //# sourceMappingURL=index.node.cjs.js.map