/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */!function(e){function t(t){for(var n,o,i=t[0],a=t[1],c=0,u=[];cNumber(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function p(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function d(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const o="string"==typeof n&&n.split("").indexOf(e.arrayFormatSeparator)>-1?n.split(e.arrayFormatSeparator).map((t=>s(t,e))):null===n?n:s(n,e);r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,a]=i(t.decode?o.replace(/\+/g," "):o,"=");a=void 0===a?null:["comma","separator"].includes(t.arrayFormat)?a:s(a,t),n(s(e,t),a,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=f(n[e],t);else r[e]=f(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e}),Object.create(null))}t.extract=p,t.parse=d,t.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const o=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[",o,"]"].join("")]:[...n,[c(t,e),"[",c(o,e),"]=",c(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[]"].join("")]:[...n,[c(t,e),"[]=",c(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[c(t,e),"=",c(r,e)].join("")]:[[n,c(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,c(t,e)]:[...n,[c(t,e),"=",c(r,e)].join("")]}}(t),o={};for(const t of Object.keys(e))n(t)||(o[t]=e[t]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map((n=>{const o=e[n];return void 0===o?"":null===o?c(n,t):Array.isArray(o)?o.reduce(r(n),[]).join("&"):c(n,t)+"="+c(o,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=i(e,"#");return Object.assign({url:n.split("?")[0]||"",query:d(p(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:s(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=l(e.url).split("?")[0]||"",o=t.extract(e.url),i=t.parse(o,{sort:!1}),a=Object.assign(i,e.query);let s=t.stringify(a,n);s&&(s=`?${s}`);let u=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(u=`#${c(e.fragmentIdentifier,n)}`),`${r}${s}${u}`}},function(e,t){e.exports=__kbnSharedDeps__.Rxjs},function(e,t,n){"use strict";(function(e){let r;n.d(t,"b",(function(){return r})),n.d(t,"d",(function(){return i})),n.d(t,"g",(function(){return a})),n.d(t,"f",(function(){return c})),n.d(t,"e",(function(){return s})),n.d(t,"c",(function(){return u})),n.d(t,"i",(function(){return p})),n.d(t,"h",(function(){return f})),n.d(t,"a",(function(){return d})),n.d(t,"k",(function(){return m})),n.d(t,"l",(function(){return b})),n.d(t,"j",(function(){return y})),n(0),function(e){e[e.Unsymbolized=0]="Unsymbolized",e[e.Python=1]="Python",e[e.PHP=2]="PHP",e[e.Native=3]="Native",e[e.Kernel=4]="Kernel",e[e.JVM=5]="JVM",e[e.Ruby=6]="Ruby",e[e.Perl=7]="Perl",e[e.JavaScript=8]="JavaScript",e[e.PHPJIT=9]="PHPJIT"}(r||(r={}));const o={[r.Unsymbolized]:"",[r.Python]:"Python",[r.PHP]:"PHP",[r.Native]:"Native",[r.Kernel]:"Kernel",[r.JVM]:"JVM/Hotspot",[r.Ruby]:"Ruby",[r.Perl]:"Perl",[r.JavaScript]:"JavaScript",[r.PHPJIT]:"PHP JIT"};function i(e){return o[e]}const a={FrameIDs:[],FileIDs:[],AddressOrLines:[],Types:[]},c={FileName:"",FunctionName:"",FunctionOffset:0,LineNumber:0,Inline:!1},s={FileName:""};function u(e={}){var t,n,r,o,i,a,c,s,u,l,p,f,d,m,g,b;const y={};return y.FrameID=null!==(t=e.FrameID)&&void 0!==t?t:"",y.FileID=null!==(n=e.FileID)&&void 0!==n?n:"",y.FrameType=null!==(r=e.FrameType)&&void 0!==r?r:0,y.Inline=null!==(o=e.Inline)&&void 0!==o&&o,y.AddressOrLine=null!==(i=e.AddressOrLine)&&void 0!==i?i:0,y.FunctionName=null!==(a=e.FunctionName)&&void 0!==a?a:"",y.FunctionOffset=null!==(c=e.FunctionOffset)&&void 0!==c?c:0,y.SourceID=null!==(s=e.SourceID)&&void 0!==s?s:"",y.SourceLine=null!==(u=e.SourceLine)&&void 0!==u?u:0,y.ExeFileName=null!==(l=e.ExeFileName)&&void 0!==l?l:"",y.CommitHash=null!==(p=e.CommitHash)&&void 0!==p?p:"",y.SourceCodeURL=null!==(f=e.SourceCodeURL)&&void 0!==f?f:"",y.SourceFilename=null!==(d=e.SourceFilename)&&void 0!==d?d:"",y.SourcePackageHash=null!==(m=e.SourcePackageHash)&&void 0!==m?m:"",y.SourcePackageURL=null!==(g=e.SourcePackageURL)&&void 0!==g?g:"",y.SamplingRate=null!==(b=e.SamplingRate)&&void 0!==b?b:1,y.FunctionOffset>0?y.FunctionSourceLine=y.SourceLine-y.FunctionOffset:y.FunctionSourceLine=0,y}function l(e){return void 0===(null==e?void 0:e.ExeFileName)?"":""!==e.ExeFileName?e.ExeFileName:i(e.FrameType)}function p(e){if(""!==e.FunctionName){const t=e.SourceFilename,n=t?t.split("/").pop():"";return`${l(e)}: ${function(e){return""===e.FunctionName||(t=e.FunctionName,/\(|\)/.test(t))?e.FunctionName:`${e.FunctionName}()`;var t}(e)} in ${n}#${e.SourceLine}`}return l(e)}function f(e){const t=e.ExeFileName?e.ExeFileName:i(e.FrameType);return e.FunctionName?t+": "+e.FunctionName:t}let d;function m({sourceFilename:e,sourceLine:t,exeFileName:n}){return""===e&&0===t?n?d.PARTIALLY_SYMBOLYZED:d.NOT_SYMBOLIZED:d.SYMBOLIZED}!function(e){e.PARTIALLY_SYMBOLYZED="PARTIALLY_SYMBOLYZED",e.NOT_SYMBOLIZED="NOT_SYMBOLIZED",e.SYMBOLIZED="SYMBOLIZED"}(d||(d={}));const g=[r.Native,r.Kernel];function b({frameType:e}){return g.includes(e)?"NATIVE":"INTERPRETED"}function y(e){switch(m({sourceFilename:e.SourceFilename,sourceLine:e.SourceLine,exeFileName:e.ExeFileName})){case d.NOT_SYMBOLIZED:return"";case d.PARTIALLY_SYMBOLYZED:return e.ExeFileName+"+0x"+e.AddressOrLine.toString(16);case d.SYMBOLIZED:return e.SourceFilename+(0!==e.SourceLine?`#${e.SourceLine}`:"")}}}).call(this,n(16).Buffer)},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(7);function o(e,t,n,o,i){return""===i?`empty;${e};${t}`:""===o?`elf;${n};${i}`:`full;${n};${i};${a=o||"",Object(r.takeRight)(a.split("/"),2).join("/")}`;var a}},function(e,t){e.exports=__kbnSharedDeps__.Lodash},function(e,t){e.exports=__kbnSharedDeps_npm__},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return a})),n.d(t,"b",(function(){return c}));var r=n(2);const o="profiling-events-all",i="/internal/profiling";function a(){return{TopN:`${i}/topn`,TopNContainers:`${i}/topn/containers`,TopNDeployments:`${i}/topn/deployments`,TopNFunctions:`${i}/topn/functions`,TopNHosts:`${i}/topn/hosts`,TopNThreads:`${i}/topn/threads`,TopNTraces:`${i}/topn/traces`,Flamechart:`${i}/flamechart`,HasSetupESResources:`${i}/setup/es_resources`,SetupDataCollectionInstructions:`${i}/setup/instructions`,StorageExplorerSummary:`${i}/storage_explorer/summary`,StorageExplorerHostStorageDetails:`${i}/storage_explorer/host_storage_details`,StorageExplorerIndicesStorageDetails:`${i}/storage_explorer/indices_storage_details`}}const c=r.i18n.translate("xpack.profiling.notAvailableLabel",{defaultMessage:"N/A"})},function(e,t,n){n.r(t);var r=__kbnBundles__.get("entry/core/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t,n){n(12),__kbnBundles__.define("plugin/profiling/public",n,17)},function(e,t,n){n.p=window.__kbnPublicPath__.profiling},function(e,t,n){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},function(e,t,n){"use strict";var r="%[a-f0-9]{2}",o=new RegExp("("+r+")|([^%]+?)","gi"),i=new RegExp("("+r+")+","gi");function a(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],a(n),a(r))}function c(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(o)||[],n=1;n{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},function(e,t,n){e.exports=n(8)(2943)},function(e,t,n){"use strict";n.r(t),n.d(t,"plugin",(function(){return g}));var r=n(10),o=n(2),i=n(4),a=n(1),c=n.n(a),s=n(3),u=n.n(s);class flamegraph_locator_FlamegraphLocatorDefinition{constructor(){c()(this,"id","flamegraphLocator"),c()(this,"getLocation",(async({rangeFrom:e,rangeTo:t,kuery:n})=>{const r={rangeFrom:e,rangeTo:t,kuery:n};return{app:"profiling",path:`/flamegraphs/flamegraph?${u.a.stringify(r)}`,state:{}}}))}}class stacktraces_locator_StacktracesLocatorDefinition{constructor(){c()(this,"id","stacktracesLocator"),c()(this,"getLocation",(async({rangeFrom:e,rangeTo:t,kuery:n})=>{const r={rangeFrom:e,rangeTo:t,kuery:n};return{app:"profiling",path:`/stacktraces/threads?${u.a.stringify(r)}`,state:{}}}))}}class topn_functions_locator_TopNFunctionsLocatorDefinition{constructor(){c()(this,"id","topNFunctionsLocator"),c()(this,"getLocation",(async({rangeFrom:e,rangeTo:t,kuery:n})=>{const r={rangeFrom:e,rangeTo:t,kuery:n};return{app:"profiling",path:`/functions/topn?${u.a.stringify(r)}`,state:{}}}))}}var l=n(9),p=n(6);const f=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function d(e){const t=e.length;let[n,r,o,i]=[8997,33826,40164,52210],[a,c,s,u]=[0,0,0,0];for(let l=0;l>16,s+=c>>16,s+=256*n,u+=256*r,n=65535&a,r=65535&c,o=65535&s,i=u+(s>>16)&65535;return f[i>>8]+f[255&i]+f[o>>8]+f[255&o]+f[r>>8]+f[255&r]+f[n>>8]+f[255&n]}var m=n(5);class plugin_ProfilingPlugin{setup(e,t){const a=[{id:"stacktraces",title:o.i18n.translate("xpack.profiling.navigation.stacktracesLinkLabel",{defaultMessage:"Stacktraces"}),path:"/stacktraces"},{id:"flamegraphs",title:o.i18n.translate("xpack.profiling.navigation.flameGraphsLinkLabel",{defaultMessage:"Flamegraphs"}),path:"/flamegraphs"},{id:"functions",title:o.i18n.translate("xpack.profiling.navigation.functionsLinkLabel",{defaultMessage:"Functions"}),path:"/functions"}],c=new i.BehaviorSubject(""),s=Object(i.combineLatest)([Object(i.from)(e.getStartServices()),c]).pipe(Object(i.map)((([[e],t])=>e.application.capabilities.profiling.show?[{label:o.i18n.translate("xpack.profiling.navigation.sectionLabel",{defaultMessage:"Universal Profiling"}),entries:a.map((e=>({app:"profiling",label:e.title,path:`${e.path}?kuery=${null!=t?t:""}`,matchPath:t=>t.startsWith(e.path)}))),sortKey:700}]:[])));return t.observabilityShared.navigation.registerSections(s),e.application.register({id:"profiling",title:"Universal Profiling",euiIconType:"logoObservability",appRoute:"/app/profiling",category:r.DEFAULT_APP_CATEGORIES.observability,deepLinks:a,async mount({element:r,history:o,theme$:i,setHeaderActionMenu:a}){const[s,u]=await e.getStartServices(),f=function(){const e=Object(l.c)();return{fetchTopN:async({http:t,type:n,timeFrom:r,timeTo:o,kuery:i})=>{const a={timeFrom:r,timeTo:o,kuery:i};return await t.get(`${e.TopN}/${n}`,{query:a})},fetchTopNFunctions:async({http:t,timeFrom:n,timeTo:r,startIndex:o,endIndex:i,kuery:a})=>{const c={timeFrom:n,timeTo:r,startIndex:o,endIndex:i,kuery:a};return await t.get(e.TopNFunctions,{query:c})},fetchElasticFlamechart:async({http:t,timeFrom:n,timeTo:r,kuery:o})=>{const i={timeFrom:n,timeTo:r,kuery:o};return function(e){const t={Size:e.Size,SamplingRate:e.SamplingRate,Edges:e.Edges,FileID:e.FileID,FrameType:e.FrameType,Inline:e.Inline,ExeFilename:e.ExeFilename,AddressOrLine:e.AddressOrLine,FunctionName:e.FunctionName,FunctionOffset:e.FunctionOffset,SourceFilename:e.SourceFilename,SourceLine:e.SourceLine,CountInclusive:e.CountInclusive,CountExclusive:e.CountExclusive,ID:new Array(e.Size),Label:new Array(e.Size),TotalSeconds:e.TotalSeconds},n=Object(p.a)(t.FileID[0],t.AddressOrLine[0],t.ExeFilename[0],t.SourceFilename[0],t.FunctionName[0]);t.ID[0]=d((new TextEncoder).encode(n));const r=[0];for(;r.length>0;){const e=r.pop();for(const n of t.Edges[e]){const o=Object(p.a)(t.FileID[n],t.AddressOrLine[n],t.ExeFilename[n],t.SourceFilename[n],t.FunctionName[n]),i=(new TextEncoder).encode(t.ID[e]+o);t.ID[n]=d(i),r.push(n)}}t.Label[0]="root: Represents 100% of CPU time.";for(let e=1;eawait t.get(e.HasSetupESResources,{}),postSetupResources:async({http:t})=>{await t.post(e.HasSetupESResources,{})},setupDataCollectionInstructions:async({http:t})=>await t.get(e.SetupDataCollectionInstructions,{}),fetchStorageExplorerSummary:async({http:t,timeFrom:n,timeTo:r,kuery:o,indexLifecyclePhase:i})=>{const a={timeFrom:n,timeTo:r,kuery:o,indexLifecyclePhase:i};return await t.get(e.StorageExplorerSummary,{query:a})},fetchStorageExplorerHostStorageDetails:async({http:t,timeFrom:n,timeTo:r,kuery:o,indexLifecyclePhase:i})=>{const a={timeFrom:n,timeTo:r,kuery:o,indexLifecyclePhase:i};return await t.get(e.StorageExplorerHostStorageDetails,{query:a})},fetchStorageExplorerIndicesStorageDetails:async({http:t,indexLifecyclePhase:n})=>{const r={indexLifecyclePhase:n};return await t.get(e.StorageExplorerIndicesStorageDetails,{query:r})}}}(),{renderApp:g}=await n.e(1).then(n.bind(null,72));function b(e){var t;const n=new URLSearchParams(e.search);c.next(null!==(t=n.get("kuery"))&&void 0!==t?t:"")}b(o.location),o.listen(b);const y=g({profilingFetchServices:f,coreStart:s,coreSetup:e,pluginsStart:u,pluginsSetup:t,history:o,theme$:i,setHeaderActionMenu:a},r);return()=>{y(),c.next("")}}}),{locators:{flamegraphLocator:t.share.url.locators.create(new flamegraph_locator_FlamegraphLocatorDefinition),topNFunctionsLocator:t.share.url.locators.create(new topn_functions_locator_TopNFunctionsLocatorDefinition),stacktracesLocator:t.share.url.locators.create(new stacktraces_locator_StacktracesLocatorDefinition)},hasSetup:async()=>(await e.http.get("/internal/profiling/setup/es_resources")).has_setup}}start(e){return{}}stop(){}}function g(){return new plugin_ProfilingPlugin}},function(e,t){e.exports=__kbnSharedDeps__.React},function(e,t){e.exports=__kbnSharedDeps__.EmotionReact},function(e,t){e.exports=__kbnSharedDeps__.ElasticEui},function(e,t){e.exports=__kbnSharedDeps__.IoTs},function(e,t){e.exports=__kbnSharedDeps__.ReactRouterDom},function(e,t){e.exports=__kbnSharedDeps__.ElasticCharts},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/observability/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/observabilityShared/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/kibanaReact/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t){e.exports=__kbnSharedDeps__.TsLib},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/observabilityAIAssistant/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t){e.exports=__kbnSharedDeps__.KbnI18nReact},function(e,t){e.exports=__kbnSharedDeps__.Moment},function(e,t){e.exports=__kbnSharedDeps__.ReactRouterDomV5Compat},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/data/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/kibanaUtils/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t){e.exports=__kbnSharedDeps__.KbnDatemath},function(e,t){e.exports=__kbnSharedDeps__.ReactRouter},function(e,t){e.exports=__kbnSharedDeps__.ReactDom},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/kibanaUtils/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))},function(e,t,n){n.r(t);var r=__kbnBundles__.get("plugin/unifiedSearch/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(r))}]);