(window.eventAnnotationListing_bundle_jsonpfunction=window.eventAnnotationListing_bundle_jsonpfunction||[]).push([[5],{122:function(e,t,i){"use strict";i.r(t),i.d(t,"loadFieldExisting",(function(){return d}));var n=i(41),a=i(21);function r(e,t,i,n){return{bool:{filter:e&&t&&i?[{range:{[e]:{format:"strict_date_optional_time",gte:t,lte:i}}},n]:[n]}}}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:o,dataViewsService:l,uiSettingsClient:c,dataView:m})=>{const u=c.get(n.a.SEARCH_INCLUDE_FROZEN),F=c.get(n.a.META_FIELDS);return await async function({search:e,dataViewsService:t,dataView:i,dslQuery:n={match_all:{}},fromDate:a,toDate:d,timeFieldName:o,includeFrozen:l,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(o,a,d,n)});return{indexPatternTitle:i.title,existingFieldNames:s(u,m)}}({dslQuery:t,fromDate:i,toDate:d,timeFieldName:o,dataViewsService:l,includeFrozen:u,metaFields:F,dataView:m,search:async t=>(await Object(a.lastValueFrom)(e.search.search({params:t}))).rawResponse})}}}]);