/*! 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. */ (window.infra_bundle_jsonpfunction=window.infra_bundle_jsonpfunction||[]).push([[3],{542:function(e,t,n){"use strict";n.r(t),n.d(t,"createNodeLogsQuery",(function(){return u})),n.d(t,"createSearchString",(function(){return l})),n.d(t,"getLocationToDiscover",(function(){return d}));var o=n(8),i=n(7),r=n(27),a=n(108),c=n(129);const u=e=>{const{nodeType:t,nodeId:n,filter:o}=e,i=`${Object(a.a)(t).id}: ${n}`;return o?`(${i}) and (${o})`:i},l=({time:e,timeRange:t,filter:n="",logView:r=o.DEFAULT_LOG_VIEW})=>Object(i.flowRight)(Object(c.c)({language:"kuery",query:n},e,t),Object(c.d)(e),Object(c.e)(r))(""),d=async({core:e,timeRange:t,filter:n,logView:i=o.DEFAULT_LOG_VIEW})=>{const[,r]=await e.getStartServices(),{discover:a,logsShared:c}=r,{logViews:u}=c,l=await u.client.getResolvedLogView(i),d={...t?{from:t.startTime,to:t.endTime}:{},...n?{query:{language:"kuery",query:n}}:{}},f=await s(a,d,l);if(!f)throw new Error("Discover location not found");return f},s=async(e,t,n)=>{var o,i;if(!n)return await(null===(i=e.locator)||void 0===i?void 0:i.getLocation(t));const r=f(n.columns),a=n.dataViewReference.toSpec();return await(null===(o=e.locator)||void 0===o?void 0:o.getLocation({...t,columns:r,dataViewId:a.id,dataViewSpec:a}))},f=e=>e.map(g).filter(Boolean),g=e=>"messageColumn"in e?r.f:"timestampColumn"in e?r.j:"fieldColumn"in e?e.fieldColumn.field:null}}]);