/*! 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,a,s=t[0],r=t[1],o=0,c=[];o{const{filters:t,query:i,savedObjectId:a,resolvedDateRange:s,searchSessionId:o}=e,c=function(e){if(e.savedObjectId)return{};if(!(e.activeDatasourceId&&e.datasourceStates&&e.visualization&&e.references))return{};const t={activeDatasourceId:e.activeDatasourceId,visualization:e.visualization,datasourceStates:Object.fromEntries(Object.entries(e.datasourceStates).map((([e,{state:t}])=>[e,t]))),references:e.references};return e.dataViewSpecs&&(t.dataViewSpecs=e.dataViewSpecs),t}(e),u={},{isFilterPinned:p}=await Promise.resolve().then(n.t.bind(null,21,7));i&&(c.query=i),s&&(c.resolvedDateRange=s,u.time={from:s.fromDate,to:s.toDate}),null!=t&&t.length&&(c.filters=t,u.filters=null==t?void 0:t.filter((e=>!p(e))));const d=a?`/edit/${encodeURIComponent(a)}`:"",b=`${window.location.origin}${window.location.pathname}`,g=new URL(b);return g.hash=d,g.searchParams.append("_g",r.a.encodeUnknown(u)||""),o&&(c.searchSessionId=o),{app:"lens",path:g.href.replace(b,""),state:{type:l,payload:c}}}))}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));const i={DATA:"data",REFERENCELINE:"referenceLine",ANNOTATIONS:"annotations",METRIC_TRENDLINE:"metricTrendline"}},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/share/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.KbnEsQuery},function(e,t,n){"use strict";n.r(t),n.d(t,"layerTypes",(function(){return Z.a})),n.d(t,"LENS_EMBEDDABLE_TYPE",(function(){return p.LENS_EMBEDDABLE_TYPE})),n.d(t,"plugin",(function(){return K}));var i=n(1),a=n.n(i),s=n(11),r=n(8),o=n(4),l=n(10),c=n(5),u=n(0),p=n(3);const d="ACTION_OPEN_IN_DISCOVER",b=async()=>await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));var g=n(17);const h="ACTION_CONFIGURE_IN_LENS",_=async()=>await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));class action_ConfigureInLensPanelAction{constructor(e,t,n){a()(this,"type",h),a()(this,"id",h),a()(this,"order",50),this.startDependencies=e,this.overlays=t,this.theme=n}getDisplayName({embeddable:e}){const t=Object(g.a)(e)?e.getTextBasedLanguage():void 0;return u.i18n.translate("xpack.lens.app.editVisualizationLabel",{defaultMessage:"Edit {lang} visualization",values:{lang:t}})}getIconType(){return"pencil"}async isCompatible({embeddable:e}){const{isActionCompatible:t}=await _();return t(e)}async execute({embeddable:e}){const{executeAction:t}=await _();return t({embeddable:e,startDependencies:this.startDependencies,overlays:this.overlays,theme:this.theme})}}const f=(e,t)=>{const n=e;if("attributes"in n&&void 0!==n.attributes){const e=[];Array.isArray(n.attributes.references)&&n.attributes.references.forEach((n=>{const i=n,a=t.find((e=>e.name===i.name));a&&e.push(a)})),n.attributes.references=e}return n},m=e=>{let t=[];const n=e;return"attributes"in n&&void 0!==n.attributes&&(t=n.attributes.references),{state:e,references:t}};class embeddable_factory_EmbeddableFactory{constructor(e){a()(this,"type",p.DOC_TYPE),a()(this,"savedObjectMetaData",{name:u.i18n.translate("xpack.lens.lensSavedObjectLabel",{defaultMessage:"Lens Visualization"}),type:p.DOC_TYPE,getIconForSavedObject:()=>"lensApp"}),a()(this,"isEditable",(async()=>{var e;const{capabilities:t}=await this.getStartServices();return Boolean(t.visualize.save||(null===(e=t.dashboard)||void 0===e?void 0:e.showWriteControls))})),a()(this,"createFromSavedObject",(async(e,t,n)=>(t.savedObjectId||(t.savedObjectId=e),this.create(t,n)))),a()(this,"extract",m),a()(this,"inject",f),this.getStartServices=e}canCreateNew(){return!1}getDisplayName(){return u.i18n.translate("xpack.lens.embeddableDisplayName",{defaultMessage:"Lens"})}async create(e,t){try{var i;const{data:a,timefilter:s,expressionRenderer:r,documentToExpression:o,injectFilterReferences:l,visualizationMap:c,datasourceMap:u,uiActions:p,coreHttp:d,coreStart:b,attributeService:g,dataViews:h,capabilities:_,usageCollection:f,theme:m,inspector:v,spaces:y,uiSettings:O}=await this.getStartServices(),{Embeddable:w}=await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));return new w({attributeService:g,data:a,dataViews:h,timefilter:s,inspector:v,expressionRenderer:r,basePath:d.basePath,getTrigger:null==p?void 0:p.getTrigger,getTriggerCompatibleActions:null==p?void 0:p.getTriggerCompatibleActions,documentToExpression:o,injectFilterReferences:l,visualizationMap:c,datasourceMap:u,capabilities:{canSaveDashboards:Boolean(null===(i=_.dashboard)||void 0===i?void 0:i.showWriteControls),canSaveVisualizations:Boolean(_.visualize.save),canOpenVisualizations:Boolean(_.visualize.show),navLinks:_.navLinks,discover:_.discover},coreStart:b,usageCollection:f,theme:m,spaces:y,uiSettings:O},e,t)}catch(n){return new r.ErrorEmbeddable(n,e,t)}}}var v=n(7),y=n.n(v),O=n(6),w=n(2);function A(e,t){const{embeddable:n,uiActions:i}=t,a=n.getEmbeddableFactory("lens");return e=>{var t;const n={...e},s=Boolean(n.withDefaultActions)||n.extraActions&&(null===(t=n.extraActions)||void 0===t?void 0:t.length)>0;return s?Object(w.jsx)(E,{factory:a,uiActions:i,actionPredicate:()=>s,input:n,extraActions:n.extraActions,showInspector:n.showInspector,withDefaultActions:n.withDefaultActions}):Object(w.jsx)(D,{factory:a,input:n})}}function D({factory:e,input:t}){const[n,i,a]=Object(r.useEmbeddableFactory)({factory:e,input:t});return i?Object(w.jsx)(O.EuiLoadingChart,null):Object(w.jsx)(r.EmbeddableRoot,{embeddable:n,loading:i,error:a,input:t})}const E=({factory:e,uiActions:t,actionPredicate:n,input:i,extraActions:a,showInspector:s=!0,withDefaultActions:o})=>{const[l,c]=Object(r.useEmbeddableFactory)({factory:e,input:i});return Object(v.useEffect)((()=>{l&&l.updateInput(i)}),[l,i]),c||!l?Object(w.jsx)(O.EuiLoadingChart,null):Object(w.jsx)(r.EmbeddablePanel,{hideHeader:!1,embeddable:l,getActions:async(e,n)=>{const i=o?await t.getTriggerCompatibleActions(e,n):[];return[...null!=a?a:[],...i]},hideInspector:!s,actionPredicate:n,showNotifications:!1,showShadow:!1,showBadges:!1})};var S=n(14),T=n.n(S);const j=y.a.lazy((()=>n.e(0).then(n.bind(null,105))));function x(){return Object(w.jsx)(O.EuiOverlayMask,null,Object(w.jsx)(O.EuiLoadingSpinner,null))}const P=e=>Object(w.jsx)(v.Suspense,{fallback:Object(w.jsx)(x,null)},Object(w.jsx)(j,e));function C(e,t){return i=>{const[a,s]=Object(v.useState)();if(Object(v.useEffect)((()=>{!async function(){const{getLensServices:i,getLensAttributeService:a}=await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579)),r=await i(e,t,a(e,t));s(r)}()}),[]),!a)return Object(w.jsx)(x,null);const{ContextProvider:r}=a.presentationUtil;return Object(w.jsx)(O.EuiOverlayMask,null,Object(w.jsx)(r,null,Object(w.jsx)(P,T()({},i,{lensServices:a}))))}}const I={name:"lens_datatable_column",aliases:[],type:"lens_datatable_column",help:"",inputTypes:["null"],args:{columnId:{types:["string"],help:""},alignment:{types:["string"],help:""},sortingHint:{types:["string"],help:""},hidden:{types:["boolean"],help:""},oneClickFilter:{types:["boolean"],help:""},width:{types:["number"],help:""},isTransposed:{types:["boolean"],help:""},transposable:{types:["boolean"],help:""},colorMode:{types:["string"],help:""},palette:{types:["palette"],help:""},summaryRow:{types:["string"],help:""},summaryLabel:{types:["string"],help:""}},fn:function(e,t){return{type:"lens_datatable_column",...t}}},L={name:"lens_map_to_columns",type:"datatable",help:u.i18n.translate("xpack.lens.functions.mapToColumns.help",{defaultMessage:"A helper to transform a datatable to match Lens column definitions"}),args:{idMap:{types:["string"],help:u.i18n.translate("xpack.lens.functions.mapToColumns.idMap.help",{defaultMessage:"A JSON encoded object in which keys are the datatable column ids and values are the Lens column definitions. Any datatable columns not mentioned within the ID map will be kept unmapped."})}},inputTypes:["datatable"],async fn(...e){const{mapToOriginalColumns:t}=await n.e(20).then(n.bind(null,571));return t(...e)}},N={name:"lens_format_column",type:"datatable",help:"",args:{format:{types:["string"],help:"",required:!0},columnId:{types:["string"],help:"",required:!0},decimals:{types:["number"],help:""},suffix:{types:["string"],help:""},parentFormat:{types:["string"],help:""},compact:{types:["boolean"],help:""},pattern:{types:["string"],help:""},fromUnit:{types:["string"],help:""},toUnit:{types:["string"],help:""}},inputTypes:["datatable"],async fn(...e){const{formatColumnFn:t}=await n.e(14).then(n.bind(null,572));return t(...e)}},V={name:"lens_counter_rate",type:"datatable",inputTypes:["datatable"],help:u.i18n.translate("xpack.lens.functions.counterRate.help",{defaultMessage:"Calculates the counter rate of a column in a data table"}),args:{by:{help:u.i18n.translate("xpack.lens.functions.counterRate.args.byHelpText",{defaultMessage:"Column to split the counter rate calculation by"}),multi:!0,types:["string"],required:!1},inputColumnId:{help:u.i18n.translate("xpack.lens.functions.counterRate.args.inputColumnIdHelpText",{defaultMessage:"Column to calculate the counter rate of"}),types:["string"],required:!0},outputColumnId:{help:u.i18n.translate("xpack.lens.functions.counterRate.args.outputColumnIdHelpText",{defaultMessage:"Column to store the resulting counter rate in"}),types:["string"],required:!0},outputColumnName:{help:u.i18n.translate("xpack.lens.functions.counterRate.args.outputColumnNameHelpText",{defaultMessage:"Name of the column to store the resulting counter rate in"}),types:["string"],required:!1}},async fn(...e){const{counterRateFn:t}=await n.e(19).then(n.bind(null,573));return t(...e)}},k=(...e)=>({name:"lens_time_scale",type:"datatable",help:"",args:{dateColumnId:{types:["string"],help:""},inputColumnId:{types:["string"],help:"",required:!0},outputColumnId:{types:["string"],help:"",required:!0},outputColumnName:{types:["string"],help:""},targetUnit:{types:["string"],options:["s","m","h","d"],help:"",required:!0},reducedTimeRange:{types:["string"],help:""}},inputTypes:["datatable"],async fn(...t){const{timeScaleFn:i}=await n.e(21).then(n.bind(null,574));return i(...e)(...t)}}),z={name:"lens_collapse",type:"datatable",inputTypes:["datatable"],help:u.i18n.translate("xpack.lens.functions.collapse.help",{defaultMessage:"Collapses multiple rows into a single row using the specified aggregate function."}),args:{by:{help:u.i18n.translate("xpack.lens.functions.collapse.args.byHelpText",{defaultMessage:"Columns to group by - these columns are kept as-is"}),multi:!0,types:["string"],required:!1},metric:{help:u.i18n.translate("xpack.lens.functions.collapse.args.metricHelpText",{defaultMessage:"Column to calculate the specified aggregate function of"}),types:["string"],multi:!0,required:!1},fn:{help:u.i18n.translate("xpack.lens.functions.collapse.args.fnHelpText",{defaultMessage:"The aggregate function to apply"}),types:["string"],multi:!0,required:!0}},async fn(...e){const{collapseFn:t}=await n.e(18).then(n.bind(null,575));return t(...e)}};var R=n(13),F=n(9);const M=async()=>await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));class open_in_discover_drilldown_OpenInDiscoverDrilldown{constructor(e){a()(this,"id","OPEN_IN_DISCOVER_DRILLDOWN"),a()(this,"order",8),a()(this,"getDisplayName",(()=>u.i18n.translate("xpack.lens.app.exploreDataInDiscoverDrilldown",{defaultMessage:"Open in Discover"}))),a()(this,"euiIcon","discoverApp"),a()(this,"ReactCollectConfig",(({config:e,onConfig:t})=>Object(w.jsx)(O.EuiFormRow,{hasChildLabel:!1},Object(w.jsx)(O.EuiSwitch,{id:"openInNewTab",name:"openInNewTab",label:u.i18n.translate("xpack.lens.app.exploreDataInDiscoverDrilldown.newTabConfig",{defaultMessage:"Open in new tab"}),checked:e.openInNewTab,onChange:()=>t({...e,openInNewTab:!e.openInNewTab}),"data-test-subj":"openInDiscoverDrilldownOpenInNewTab"})))),a()(this,"CollectConfig",this.ReactCollectConfig),a()(this,"createConfig",(()=>({openInNewTab:!0}))),a()(this,"isConfigValid",(e=>!0)),a()(this,"isCompatible",(async(e,t)=>{const{isCompatible:n}=await M();return n({locator:this.deps.locator(),dataViews:this.deps.dataViews(),hasDiscoverAccess:this.deps.hasDiscoverAccess(),...t,embeddable:t.embeddable,...e})})),a()(this,"isConfigurable",(e=>{var t;return this.deps.hasDiscoverAccess()&&(null===(t=e.embeddable)||void 0===t?void 0:t.type)===p.DOC_TYPE})),a()(this,"getHref",(async(e,t)=>{const{getHref:n}=await M();return n({locator:this.deps.locator(),dataViews:this.deps.dataViews(),hasDiscoverAccess:this.deps.hasDiscoverAccess(),...t,embeddable:t.embeddable})})),a()(this,"execute",(async(e,t)=>{if(e.openInNewTab)window.open(await this.getHref(e,t),"_blank");else{const{getLocation:e}=await M(),{app:n,path:i,state:a}=await e({locator:this.deps.locator(),dataViews:this.deps.dataViews(),hasDiscoverAccess:this.deps.hasDiscoverAccess(),...t,embeddable:t.embeddable});await this.deps.application().navigateToApp(n,{path:i,state:a})}})),this.deps=e}supportedTriggers(){return[F.APPLY_FILTER_TRIGGER]}}var B=n(18),U=n(16),G=n(20);const H=Object(v.lazy)((()=>n.e(22).then(n.bind(null,576)).then((({DownloadPanelContent:e})=>({default:e}))))),q=e=>Object(w.jsx)(v.Fragment,null,Object(w.jsx)(O.EuiSpacer,null),Object(w.jsx)(O.EuiFlexGroup,{justifyContent:"spaceAround"},Object(w.jsx)(O.EuiFlexItem,{grow:!1},Object(w.jsx)(O.EuiLoadingSpinner,{size:"l"}))),Object(w.jsx)(O.EuiSpacer,null)),$=e=>Object(w.jsx)(v.Suspense,{fallback:Object(w.jsx)(q,null)},Object(w.jsx)(H,e));function Y(e){const t=[];return e&&Object.values(e).some((e=>Object(U.tableHasFormulas)(e.columns,e.rows)))&&t.push(u.i18n.translate("xpack.lens.app.downloadButtonFormulasWarning",{defaultMessage:"Your CSV contains characters that spreadsheet applications might interpret as formulas."})),t}class plugin_LensPlugin{constructor(){a()(this,"datatableVisualization",void 0),a()(this,"editorFrameService",void 0),a()(this,"editorFrameSetup",void 0),a()(this,"queuedVisualizations",[]),a()(this,"FormBasedDatasource",void 0),a()(this,"TextBasedDatasource",void 0),a()(this,"xyVisualization",void 0),a()(this,"legacyMetricVisualization",void 0),a()(this,"metricVisualization",void 0),a()(this,"pieVisualization",void 0),a()(this,"heatmapVisualization",void 0),a()(this,"gaugeVisualization",void 0),a()(this,"tagcloudVisualization",void 0),a()(this,"topNavMenuEntries",[]),a()(this,"hasDiscoverAccess",!1),a()(this,"dataViewsService",void 0),a()(this,"initDependenciesForApi",(()=>{})),a()(this,"locator",void 0)}setup(e,{urlForwarding:t,expressions:i,data:a,fieldFormats:r,embeddable:o,visualizations:c,charts:d,globalSearch:b,usageCollection:g,uiActionsEnhanced:h,share:_,contentManagement:f}){const m=Object(s.createStartServicesGetter)(e.getStartServices);o&&o.registerEmbeddableFactory("lens",new embeddable_factory_EmbeddableFactory((async()=>{const{getLensAttributeService:t,setUsageCollectionStart:o,initMemoizedErrorNotification:l}=await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579)),{core:c,plugins:u}=m();await this.initParts(e,a,d,i,r,u.fieldFormats.deserialize);const[p,b]=await Promise.all([this.editorFrameService.loadVisualizations(),this.editorFrameService.loadDatasources()]),h=await u.eventAnnotation.getService();return u.usageCollection&&o(u.usageCollection),l(c),{attributeService:t(c,u),capabilities:c.application.capabilities,coreHttp:c.http,coreStart:c,data:u.data,timefilter:u.data.query.timefilter.timefilter,expressionRenderer:u.expressions.ReactExpressionRenderer,documentToExpression:t=>this.editorFrameService.documentToExpression(t,{dataViews:u.dataViews,storage:new s.Storage(localStorage),uiSettings:e.uiSettings,timefilter:u.data.query.timefilter.timefilter,nowProvider:u.data.nowProvider,eventAnnotationService:h}),injectFilterReferences:a.query.filterManager.inject.bind(a.query.filterManager),visualizationMap:p,datasourceMap:b,dataViews:u.dataViews,uiActions:u.uiActions,usageCollection:g,inspector:u.inspector,spaces:u.spaces,theme:e.theme,uiSettings:e.uiSettings}}))),_&&(this.locator=_.url.locators.create(new B.c),_.register((({uiSettings:e,formatFactoryFn:t})=>({id:"csvDownload",getShareMenuItems:({objectType:n,sharingData:i,onClose:a})=>{if("lens"!==n)return[];const{title:s,activeData:r,csvEnabled:o}=i,l=u.i18n.translate("xpack.lens.reporting.shareContextMenu.csvReportsButtonLabel",{defaultMessage:"CSV Download"});return[{shareMenuItem:{name:l,icon:"document",disabled:!o,sortOrder:1},panel:{id:"csvDownloadPanel",title:l,content:Object(w.jsx)($,{isDisabled:!o,warnings:Y(r),onClick:async()=>{await async function({activeData:e,title:t,formatFactory:n,uiSettings:i}){if(!e)return void(window.ELASTIC_LENS_CSV_DOWNLOAD_DEBUG&&(window.ELASTIC_LENS_CSV_CONTENT=void 0));const a=Object.values(e),s=a.reduce(((e,s,r)=>{if(s){const o=a.length>1?`-${r+1}`:"";e[`${t}${o}.csv`]={content:F.exporters.datatableToCSV(s,{csvSeparator:i.get("csv:separator",","),quoteValues:i.get("csv:quoteValues",!0),formatFactory:n,escapeFormulaValues:!1}),type:F.exporters.CSV_MIME_TYPE}}return e}),{});window.ELASTIC_LENS_CSV_DOWNLOAD_DEBUG&&(window.ELASTIC_LENS_CSV_CONTENT=s),s&&Object(G.downloadMultipleAs)(s)}({title:s,formatFactory:t(),activeData:r,uiSettings:e}),null==a||a()}})}}]}}))({uiSettings:e.uiSettings,formatFactoryFn:()=>m().plugins.fieldFormats.deserialize}))),c.registerAlias({aliasPath:Object(p.getBasePath)(),aliasApp:"lens",name:"lens",promotion:!0,title:u.i18n.translate("xpack.lens.visTypeAlias.title",{defaultMessage:"Lens"}),description:u.i18n.translate("xpack.lens.visTypeAlias.description",{defaultMessage:"Create visualizations with our drag and drop editor. Switch between visualization types at any time."}),note:u.i18n.translate("xpack.lens.visTypeAlias.note",{defaultMessage:"Recommended for most users."}),icon:"lensApp",stage:"production",appExtensions:{visualizations:{docTypes:["lens"],searchFields:["title^3"],toListItem(e){const{id:t,type:n,updatedAt:i,attributes:a}=e,{title:s,description:r}=a;return{id:t,title:s,description:r,updatedAt:i,editUrl:Object(p.getEditPath)(t),editApp:"lens",icon:"lensApp",stage:"production",savedObjectType:n,type:"lens",typeTitle:u.i18n.translate("xpack.lens.visTypeAlias.type",{defaultMessage:"Lens"})}}}}}),h.registerDrilldown(new open_in_discover_drilldown_OpenInDiscoverDrilldown({dataViews:()=>this.dataViewsService,locator:()=>null==_?void 0:_.url.locators.get("DISCOVER_APP_LOCATOR"),hasDiscoverAccess:()=>this.hasDiscoverAccess,application:()=>m().core.application})),f.registry.register({id:"lens",version:{latest:1},name:u.i18n.translate("xpack.lens.content.name",{defaultMessage:"Lens Visualization"})}),((t,i,a,s,r)=>{var o;[z,V,N,L,I,(o=()=>m().plugins.fieldFormats.deserialize,{name:"lens_datatable",type:"render",inputTypes:["datatable"],help:u.i18n.translate("xpack.lens.datatable.expressionHelpLabel",{defaultMessage:"Datatable renderer"}),args:{title:{types:["string"],help:u.i18n.translate("xpack.lens.datatable.titleLabel",{defaultMessage:"Title"})},description:{types:["string"],help:""},columns:{types:["lens_datatable_column"],help:"",multi:!0},sortingColumnId:{types:["string"],help:""},sortingDirection:{types:["string"],help:""},fitRowToContent:{types:["boolean"],help:""},rowHeightLines:{types:["number"],help:""},headerRowHeight:{types:["string"],help:""},headerRowHeightLines:{types:["number"],help:""},pageSize:{types:["number"],help:""}},async fn(...e){const{datatableFn:t}=await n.e(4).then(n.bind(null,585));return t(o)(...e)}}),k((()=>m().plugins.data.datatableUtilities),(async()=>{const{getTimeZone:t}=await n.e(10).then(n.bind(null,65));return t(e.uiSettings)}),(()=>m().plugins.data.nowProvider.get()))].forEach((e=>t.registerFunction(e)))})(i);const v=()=>m().plugins.presentationUtil.ContextProvider;var y;return e.application.register({id:p.APP_ID,title:p.NOT_INTERNATIONALIZED_PRODUCT_NAME,navLinkStatus:l.AppNavLinkStatus.hidden,mount:async t=>{const{core:s,plugins:o}=m();await this.initParts(e,a,d,i,r,o.fieldFormats.deserialize);const{mountApp:l,getLensAttributeService:c,setUsageCollectionStart:u,initMemoizedErrorNotification:p}=await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));o.usageCollection&&u(o.usageCollection),p(s);const b=this.editorFrameService.start(s,o);return l(e,t,{createEditorFrame:b.createInstance,attributeService:c(s,o),getPresentationUtilContext:v,topNavMenuEntryGenerators:this.topNavMenuEntries,locator:this.locator})}}),b&&b.registerResultProvider((y=e.getStartServices().then((([{application:{capabilities:e}}])=>e)),{id:"lens",find:({term:e="",types:t,tags:n})=>n||t&&!t.includes("application")?Object(R.of)([]):Object(R.from)(y.then((({navLinks:{visualize:t}})=>{if(!t)return[];const n=u.i18n.translate("xpack.lens.searchTitle",{defaultMessage:"Lens: create visualizations",description:"Lens is a product name and should not be translated"}),i=n.toLowerCase();let a=0;return i===(e=e.toLowerCase())?a=100:i.startsWith(e)?a=90:i.includes(e)&&(a=75),0===a?[]:[{id:"lens",title:n,type:"application",icon:"logoKibana",meta:{categoryId:l.DEFAULT_APP_CATEGORIES.kibana.id,categoryLabel:l.DEFAULT_APP_CATEGORIES.kibana.label},score:a,url:Object(p.getFullPath)()}]}))),getSearchableTypes:()=>["application"]})),t.forwardApp("lens","lens"),this.initDependenciesForApi=async()=>{const{plugins:t}=m();await this.initParts(e,a,d,i,r,t.fieldFormats.deserialize)},{registerVisualization:e=>{this.editorFrameSetup?this.editorFrameSetup.registerVisualization(e):this.queuedVisualizations.push(e)},registerTopNavMenuEntryGenerator:e=>{this.topNavMenuEntries.push(e)}}}async initParts(e,t,i,a,s,r){const{DatatableVisualization:o,EditorFrameService:l,FormBasedDatasource:c,XyVisualization:u,LegacyMetricVisualization:p,MetricVisualization:d,PieVisualization:b,HeatmapVisualization:g,GaugeVisualization:h,TagcloudVisualization:_,TextBasedDatasource:f}=await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));this.datatableVisualization=new o,this.editorFrameService=new l,this.FormBasedDatasource=new c,this.TextBasedDatasource=new f,this.xyVisualization=new u,this.legacyMetricVisualization=new p,this.metricVisualization=new d,this.pieVisualization=new b,this.heatmapVisualization=new g,this.gaugeVisualization=new h,this.tagcloudVisualization=new _;const m=this.editorFrameService.setup(),v={expressions:a,data:t,fieldFormats:s,charts:i,editorFrame:m,formatFactory:r};this.FormBasedDatasource.setup(e,v),this.TextBasedDatasource.setup(e,v),this.xyVisualization.setup(e,v),this.datatableVisualization.setup(e,v),this.legacyMetricVisualization.setup(e,v),this.metricVisualization.setup(e,v),this.pieVisualization.setup(e,v),this.heatmapVisualization.setup(e,v),this.gaugeVisualization.setup(e,v),this.tagcloudVisualization.setup(e,v),this.queuedVisualizations.forEach((e=>{m.registerVisualization(e)})),this.editorFrameSetup=m}start(e,t){var i,a;this.hasDiscoverAccess=e.application.capabilities.discover.show,this.dataViewsService=t.dataViews,t.uiActions.hasAction(c.ACTION_VISUALIZE_FIELD)&&t.uiActions.unregisterAction(c.ACTION_VISUALIZE_FIELD),t.uiActions.addTriggerAction(c.VISUALIZE_FIELD_TRIGGER,(a=e.application,Object(c.createAction)({type:c.ACTION_VISUALIZE_LENS_FIELD,id:c.ACTION_VISUALIZE_LENS_FIELD,getDisplayName:()=>u.i18n.translate("xpack.lens.discover.visualizeFieldLegend",{defaultMessage:"Visualize field"}),isCompatible:async()=>!!a.capabilities.visualize.show,execute:async e=>{a.navigateToApp("lens",{state:{type:c.ACTION_VISUALIZE_LENS_FIELD,payload:e}})}}))),t.uiActions.addTriggerAction(o.VISUALIZE_EDITOR_TRIGGER,(e=>Object(c.createAction)({type:o.ACTION_CONVERT_TO_LENS,id:o.ACTION_CONVERT_TO_LENS,getDisplayName:()=>u.i18n.translate("xpack.lens.visualizeTSVBLegend",{defaultMessage:"Visualize TSVB chart"}),isCompatible:async()=>!!e.capabilities.visualize.show,execute:async t=>{const n=Object.values(t.layers),i={...t,layers:n,isVisualizeAction:!0};e.navigateToApp("lens",{state:{type:o.ACTION_CONVERT_TO_LENS,payload:i,originatingApp:u.i18n.translate("xpack.lens.TSVBLabel",{defaultMessage:"TSVB"})}})}}))(e.application)),t.uiActions.addTriggerAction(o.DASHBOARD_VISUALIZATION_PANEL_TRIGGER,(e=>Object(c.createAction)({type:o.ACTION_CONVERT_TO_LENS,id:o.ACTION_CONVERT_DASHBOARD_PANEL_TO_LENS,getDisplayName:()=>u.i18n.translate("xpack.lens.visualizeLegacyVisualizationChart",{defaultMessage:"Visualize legacy visualization chart"}),isCompatible:async()=>!!e.capabilities.visualize.show,execute:async t=>{const n=Object.values(t.layers),i={...t,layers:n,isVisualizeAction:!0};e.navigateToApp("lens",{state:{type:o.ACTION_CONVERT_TO_LENS,payload:i,originatingApp:u.i18n.translate("xpack.lens.dashboardLabel",{defaultMessage:"Dashboard"})}})}}))(e.application)),t.uiActions.addTriggerAction(o.AGG_BASED_VISUALIZATION_TRIGGER,(e=>Object(c.createAction)({type:o.ACTION_CONVERT_TO_LENS,id:o.ACTION_CONVERT_AGG_BASED_TO_LENS,getDisplayName:()=>u.i18n.translate("xpack.lens.visualizeAggBasedLegend",{defaultMessage:"Visualize agg based chart"}),isCompatible:async()=>!!e.capabilities.visualize.show,execute:async t=>{const n=Object.values(t.layers),i={...t,layers:n,isVisualizeAction:!0};e.navigateToApp("lens",{state:{type:o.ACTION_CONVERT_TO_LENS,payload:i,originatingApp:u.i18n.translate("xpack.lens.AggBasedLabel",{defaultMessage:"aggregation based visualization"})}})}}))(e.application));const s=new action_ConfigureInLensPanelAction(t,e.overlays,e.theme);t.uiActions.addTriggerAction("CONTEXT_MENU_TRIGGER",s);const l=null===(i=t.share)||void 0===i?void 0:i.url.locators.get("DISCOVER_APP_LOCATOR");var g,h,_;return l&&t.uiActions.addTriggerAction(r.CONTEXT_MENU_TRIGGER,(g=l,h=t.dataViews,_=this.hasDiscoverAccess,Object(c.createAction)({type:d,id:d,order:19,getIconType:()=>"popout",getDisplayName:()=>u.i18n.translate("xpack.lens.app.exploreDataInDiscover",{defaultMessage:"Explore data in Discover"}),getHref:async e=>{const{getHref:t}=await b();return t({locator:g,dataViews:h,hasDiscoverAccess:_,...e})},isCompatible:async e=>{const{isCompatible:t}=await b();return t({hasDiscoverAccess:_,locator:g,dataViews:h,embeddable:e.embeddable})},execute:async e=>{const{execute:t}=await b();return t({...e,locator:g,dataViews:h,hasDiscoverAccess:_})}}))),{EmbeddableComponent:A(0,t),SaveModalComponent:C(e,t),navigateToPrefilledEditor:(n,{openInNewTab:i=!1,originatingApp:a="",originatingPath:s,skipAppLeave:o=!1}={})=>{null!=n&&n.timeRange&&!i&&t.data.query.timefilter.timefilter.setTime(n.timeRange),new r.EmbeddableStateTransfer(e.application.navigateToApp,e.application.currentAppId$).navigateToEditor(p.APP_ID,{openInNewTab:i,path:Object(p.getEditPath)(void 0,i&&(null==n?void 0:n.timeRange)||void 0),state:{originatingApp:a,originatingPath:s,valueInput:n},skipAppLeave:o})},canUseEditor:()=>{var t;return Boolean(null===(t=e.application.capabilities.visualize)||void 0===t?void 0:t.show)},getXyVisTypes:async()=>{const{visualizationTypes:e}=await n.e(1).then(n.bind(null,85));return e},stateHelperApi:async()=>{const{createFormulaPublicApi:e,createChartInfoApi:i,suggestionsApi:a}=await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));this.editorFrameService||await this.initDependenciesForApi();const[s,r]=await Promise.all([this.editorFrameService.loadVisualizations(),this.editorFrameService.loadDatasources()]);return{formula:e(),chartInfo:i(t.dataViews,this.editorFrameService),suggestions:(e,t,n)=>a({datasourceMap:r,visualizationMap:s,context:e,dataView:t,excludedVisualizations:n})}},EditLensConfigPanelApi:async()=>{const{getEditLensConfiguration:i}=await Promise.all([n.e(0),n.e(1),n.e(2)]).then(n.bind(null,579));this.editorFrameService||this.initDependenciesForApi();const[a,s]=await Promise.all([this.editorFrameService.loadVisualizations(),this.editorFrameService.loadDatasources()]);return await i(e,t,a,s)}}}stop(){}}var Z=n(19);const K=()=>new plugin_LensPlugin},function(e,t,n){n(24),__kbnBundles__.define("plugin/lens/public",n,22),__kbnBundles__.define("plugin/lens/common/constants",n,3)},function(e,t,n){n.p=window.__kbnPublicPath__.lens},function(e,t){e.exports=__kbnSharedDeps__.Lodash},function(e,t){e.exports=__kbnSharedDeps__.KbnI18nReact},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/kibanaReact/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.Classnames},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/expressionXY/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.KbnUiTheme},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/expressions/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.ElasticCharts},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/expressions/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.Moment},function(e,t){e.exports=__kbnSharedDeps__.ReactDom},function(e,t){e.exports=__kbnSharedDeps__.TsLib},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/unifiedSearch/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/fieldFormats/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/dataViews/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.KbnAnalytics},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/charts/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.MomentTimezone},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/expressionGauge/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.RxjsOperators},function(e,t){e.exports=__kbnSharedDeps__.KbnMonaco},function(e,t){e.exports=__kbnSharedDeps__.ReactRouterDom},function(e,t){e.exports=__kbnSharedDeps__.KbnDatemath},function(e,t){e.exports=__kbnSharedDeps__.EmotionCache},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/visualizations/common/utils");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.Uuid},function(e,t){e.exports=__kbnSharedDeps__.SaferLodashSet},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/savedObjects/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/expressionGauge/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/expressionTagcloud/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t){e.exports=__kbnSharedDeps__.ReactRouterDomV5Compat},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/charts/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/expressionMetricVis/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/visualizations/common/constants");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/eventAnnotation/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/kibanaUtils/common");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))},function(e,t,n){n.r(t);var i=__kbnBundles__.get("plugin/presentationUtil/public");Object.defineProperties(t,Object.getOwnPropertyDescriptors(i))}]);