/*! 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.exploratoryView_bundle_jsonpfunction=window.exploratoryView_bundle_jsonpfunction||[]).push([[7],{97:function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return E}));var a=i(1),n=i.n(a),s=i(7),l=i(55),o=i(8),r=i(14),c=i.n(r),p=i(75),d=i(65),u=i(32),b=i(64),g=i(71),y=i(77),m=i(80),v=i(0),h=i(18),x=i(59),w=i(11);const f=({callback:e})=>({id:"expViewOpenInLens",getDisplayName:e=>v.i18n.translate("xpack.exploratoryView.expView.openInLens",{defaultMessage:"Open in Lens"}),getIconType:e=>"visArea",type:"link",isCompatible:async e=>!0,async execute(t){e()}}),T=({href:e,callback:t})=>({id:"expViewExplore",getDisplayName:e=>v.i18n.translate("xpack.exploratoryView.expView.explore",{defaultMessage:"Explore"}),getIconType:e=>"visArea",type:"link",isCompatible:async e=>!0,getHref:async t=>e,async execute(e){t()},order:50}),S=({callback:e})=>({id:"expViewSave",getDisplayName:e=>v.i18n.translate("xpack.exploratoryView.expView.save",{defaultMessage:"Save visualization"}),getIconType:e=>"save",type:"actionButton",isCompatible:async e=>!0,async execute(t){e()},order:49}),V=({callback:e})=>({id:"expViewAddToCase",getDisplayName:e=>v.i18n.translate("xpack.exploratoryView.expView.addToCase",{defaultMessage:"Add to case"}),getIconType:e=>"link",type:"actionButton",isCompatible:async e=>!0,async execute(t){e()},order:48});var O=i(82);function E({appendTitle:e,attributes:t=[],axisTitlesVisibility:i,gridlinesVisibilitySettings:r,customHeight:c,customLensAttrs:v,customTimeRange:E,dataViewState:j,legendIsVisible:C,legendPosition:k,lens:A,onBrushEnd:L,caseOwner:M=o.observabilityFeatureId,reportConfigMap:H={},reportType:z,showCalculationMethod:N=!1,title:R,withActions:_=!0,lensFormulaHelper:$,hideTicks:B,align:D,noLabel:F,fontSize:P=27,lineHeight:J=32,searchSessionId:K,onLoad:W}){var G,q;const Q=null==A?void 0:A.EmbeddableComponent,U=null==A?void 0:A.SaveModalComponent,[X,Y]=Object(a.useState)(!1),[Z,ee]=Object(a.useState)(!1),te=Object(o.useKibanaSpace)(),ie=null===(G=Object.entries(t)[0])||void 0===G?void 0:G[1],[ae,ne]=Object(a.useState)(null==ie?void 0:ie.operationType),se=Object(o.useTheme)(),le=Object(g.b)(t,z,se,j,{...H,...m.b},null===(q=te.space)||void 0===q?void 0:q.id);let oe,re=v;if(!v)try{var ce;if(z===u.ReportTypes.SINGLE_METRIC)oe=new d.a(le,z,$),re=null===(ce=oe)||void 0===ce?void 0:ce.getJSON("lnsLegacyMetric");else if(z===u.ReportTypes.HEATMAP){var pe;oe=new p.a(le,z,$),re=null===(pe=oe)||void 0===pe?void 0:pe.getJSON("lnsHeatmap")}else{var de;oe=new b.a(le,z,$),re=null===(de=oe)||void 0===de?void 0:de.getJSON()}}catch(e){}const ue=null!=E?E:null==ie?void 0:ie.time,be=function({withActions:e,attributes:t,reportType:i,setIsSaveOpen:n,setAddToCaseOpen:s,timeRange:l,lensAttributes:o}){const r=Object(h.useKibana)().services,{lens:c}=r,[p,d]=Object(a.useState)(["explore","save","addToCase"]);Object(a.useEffect)((()=>{!1===e&&d([]),Array.isArray(e)&&d(e)}),[e]);const{http:u,application:b}=Object(h.useKibana)().services,g=Object(w.b)({reportType:i,allSeries:t},null==u?void 0:u.basePath.get()),y=Object(x.d)({reportType:i,allSeries:t}),m=Object(a.useCallback)((()=>{o&&c.navigateToPrefilledEditor({id:"",timeRange:l,attributes:o},{openInNewTab:!0})}),[c,o,l]),v=Object(a.useCallback)((()=>{null==b||b.navigateToApp("exploratory-view",{path:y})}),[b,y]),O=Object(a.useCallback)((()=>{n(!0)}),[n]),E=Object(a.useCallback)((()=>{s(!0)}),[s]);return p.map((e=>"save"===e?S({callback:O}):"addToCase"===e?V({callback:E}):"openInLens"===e?f({callback:m}):T({href:g,callback:v})))}({withActions:_,attributes:t,reportType:z,setIsSaveOpen:Y,setAddToCaseOpen:ee,lensAttributes:re,timeRange:ue});return re?(void 0!==i&&(re.state.visualization.axisTitlesVisibilitySettings=i),void 0!==r&&(re.state.visualization.gridlinesVisibilitySettings=r),void 0!==C&&(re.state.visualization.legend.isVisible=C),void 0!==k&&(re.state.visualization.legend.position=k),B&&(re.state.visualization.tickLabelsVisibilitySettings={x:!1,yRight:!1,yLeft:!1}),!re&&le.length<1?null:Q?(re.state.searchSessionId=K,re.searchSessionId=K,n.a.createElement(I,{$customHeight:c,align:D,noLabel:F,fontSize:P,lineHeight:J},(R||N||e)&&n.a.createElement(s.EuiFlexGroup,{alignItems:"center",gutterSize:"none"},R&&n.a.createElement(s.EuiFlexItem,{"data-test-subj":"exploratoryView-title"},n.a.createElement(s.EuiTitle,{size:"xs"},n.a.createElement("h3",null,R))),N&&n.a.createElement(s.EuiFlexItem,{grow:!1,style:{minWidth:150}},n.a.createElement(y.a,{operationType:ae,onChange:e=>{ne(e)}})),e&&e),n.a.createElement(Q,{id:"exploratoryView","data-test-subj":"exploratoryView",style:{height:"100%"},timeRange:ue,attributes:{...re,title:void 0,hidePanelTitles:!0,description:""},onBrushEnd:L,withDefaultActions:Boolean(_),extraActions:be,viewMode:l.ViewMode.VIEW,searchSessionId:K,onLoad:W}),X&&re&&n.a.createElement(U,{initialInput:re,onClose:()=>Y(!1),onSave:()=>{}}),n.a.createElement(O.a,{lensAttributes:re,timeRange:null!=E?E:null==ie?void 0:ie.time,autoOpen:Z,setAutoOpen:ee,owner:M}))):n.a.createElement(s.EuiText,null,"No lens component")):null}const I=c.a.div.withConfig({displayName:"Wrapper",componentId:"sc-1tewl4n-0"})(["height:",";position:relative;&&&{> :nth-child(2){height:",";}.expExpressionRenderer__expression{padding:0 !important;}.legacyMtrVis{> :first-child{justify-content:",";}justify-content:flex-end;.legacyMtrVis__container{padding:0;> :nth-child(2){","}}.legacyMtrVis__value{line-height:","px !important;font-size:","px !important;}> :first-child{transform:none !important;}}.euiLoadingChart{position:absolute;top:50%;right:50%;transform:translate(50%,-50%);}}"],(e=>e.$customHeight?`${e.$customHeight};`:"100%;"),(e=>e.$customHeight?`${e.$customHeight};`:"calc(100% - 32px);"),(e=>"left"===e.align?"flex-start;":"right"===e.align?"flex-end;":"center;"),(({noLabel:e})=>e&&" display: none;\n "),(({lineHeight:e})=>e),(({fontSize:e})=>e))}}]);