/*! 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.lens_bundle_jsonpfunction=window.lens_bundle_jsonpfunction||[]).push([[17],{589:function(e,t,i){"use strict";i.r(t),i.d(t,"loadFieldExisting",(function(){return d}));var a=i(180),n=i(13);function r(e,t,i,a){return{bool:{filter:e&&t&&i?[{range:{[e]:{format:"strict_date_optional_time",gte:t,lte:i}}},a]:[a]}}}function s(e,t){const i=new Set(e.map((e=>e.name)));return t.filter((e=>e.isScript||e.runtimeField||i.has(e.name))).map((e=>e.name))}const d=async({data:e,dslQuery:t,fromDate:i,toDate:d,timeFieldName:l,dataViewsService:o,uiSettingsClient:c,dataView:m})=>{const u=c.get(a.a.SEARCH_INCLUDE_FROZEN),F=c.get(a.a.META_FIELDS);return await async function({search:e,dataViewsService:t,dataView:i,dslQuery:a={match_all:{}},fromDate:n,toDate:d,timeFieldName:l,includeFrozen:o,metaFields:c}){const m=function(e,t){return e.fields.map((e=>({name:e.name,isScript:!!e.scripted,lang:e.lang,script:e.script,isMeta:(null==t?void 0:t.includes(e.name))||"_id"===e.name,runtimeField:e.isMapped?void 0:e.runtimeField})))}(i,c),u=await t.getFieldsForIndexPattern(i,{pattern:"",indexFilter:r(l,n,d,a)});return{indexPatternTitle:i.title,existingFieldNames:s(u,m)}}({dslQuery:t,fromDate:i,toDate:d,timeFieldName:l,dataViewsService:o,includeFrozen:u,metaFields:F,dataView:m,search:async t=>(await Object(n.lastValueFrom)(e.search.search({params:t}))).rawResponse})}}}]);