/*! 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.maps_bundle_jsonpfunction=window.maps_bundle_jsonpfunction||[]).push([[15],{101:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var r=a(4),s=a.n(r),i=a(152),n=a.n(i),o=a(14),c=a(1),l=a(40),d=a(24),u=a(5),p=a(74),h=a(0),m=a(3);function g(e){var t;const[a,i]=Object(r.useState)(!1),g=Object(r.useMemo)((()=>!!e.dataView&&e.dataView.fields.some((t=>!d.indexPatterns.isNestedField(t)&&null!=e&&e.isGeoPointsOnly?h.A.GEO_POINT===t.type:h.B.includes(t.type)))),[e.dataView,null==e?void 0:e.isGeoPointsOnly]),b=n()(),y=Object(r.useRef)(),j=Object(u.t)(),f=!!e.dataView&&!g,O=f?c.i18n.translate("xpack.maps.noGeoFieldInIndexPattern.message",{defaultMessage:"Data view does not contain any geospatial fields"}):"";return Object(m.jsx)(s.a.Fragment,null,a?Object(m.jsx)(s.a.Fragment,null,Object(m.jsx)(o.EuiCallOut,{title:c.i18n.translate("xpack.maps.noIndexPattern.messageTitle",{defaultMessage:"Couldn't find any data views"}),color:"warning"},Object(m.jsx)("p",null,Object(m.jsx)(l.FormattedMessage,{id:"xpack.maps.noIndexPattern.doThisPrefixDescription",defaultMessage:"You'll need to "}),Object(m.jsx)(o.EuiLink,{href:Object(u.r)().basePath.prepend("/app/management/kibana/dataViews")},Object(m.jsx)(l.FormattedMessage,{id:"xpack.maps.noIndexPattern.doThisLinkTextDescription",defaultMessage:"Create a data view."}))),Object(m.jsx)("p",null,Object(m.jsx)(l.FormattedMessage,{id:"xpack.maps.noIndexPattern.hintDescription",defaultMessage:"Don't have any data? "}),Object(m.jsx)(o.EuiLink,{href:Object(u.r)().basePath.prepend("/app/home#/tutorial_directory/sampleData")},Object(m.jsx)(l.FormattedMessage,{id:"xpack.maps.noIndexPattern.getStartedLinkText",defaultMessage:"Get started with some sample data sets."})))),Object(m.jsx)(o.EuiSpacer,{size:"s"})):null,Object(m.jsx)(o.EuiFormRow,{label:Object(p.b)(),isInvalid:f,error:O},Object(m.jsx)(j,{isInvalid:f,isDisabled:a,indexPatternId:null!==(t=e.dataView)&&void 0!==t&&t.id?e.dataView.id:"",onChange:async function(t){if(!t||0===t.length)return;let a;y.current=t;try{a=await Object(u.u)().get(t)}catch(e){return}b()&&a.id===y.current&&e.onChange(a)},placeholder:Object(p.d)(),onNoIndexPatterns:()=>{i(!0)},isClearable:!1,"data-test-subj":"mapGeoIndexPatternSelect"})))}},122:function(e,t,a){"use strict";a.d(t,"a",(function(){return heatmap_layer_HeatmapLayer}));var r=a(2),s=a.n(r),i=a(106),n=a(4),o=a.n(n),c=a(14),l=a(80),d=a(1);const u=d.i18n.translate("xpack.maps.heatmap.colorRampLabel",{defaultMessage:"Color range"});var p=a(3);function h({colorRampName:e,onHeatmapColorChange:t}){return Object(p.jsx)(c.EuiFormRow,{label:u,display:"rowCompressed"},Object(p.jsx)(c.EuiColorPalettePicker,{palettes:l.e,onChange:e=>{t({colorRampName:e})},valueOfSelected:e,compressed:!0}))}const m=({colorPaletteId:e})=>{const t=Object(l.f)(e);return t.length?Object(p.jsx)("div",{className:"mapColorGradient",style:{background:Object(l.h)(t)}}):null};var g=a(213),b=a(212);class heatmap_legend_HeatmapLegend extends n.Component{constructor(...e){super(...e),s()(this,"_isMounted",!1),s()(this,"state",{label:""})}componentDidUpdate(){this._loadLabel()}componentDidMount(){this._isMounted=!0,this._loadLabel()}componentWillUnmount(){this._isMounted=!1}async _loadLabel(){const e=await this.props.field.getLabel();this._isMounted&&this.state.label!==e&&this.setState({label:e})}render(){const e=Object(p.jsx)(g.a,{header:Object(p.jsx)(m,{colorPaletteId:this.props.colorRampName}),minLabel:d.i18n.translate("xpack.maps.heatmapLegend.coldLabel",{defaultMessage:"cold"}),maxLabel:d.i18n.translate("xpack.maps.heatmapLegend.hotLabel",{defaultMessage:"hot"}),propertyLabel:u,fieldLabel:this.state.label,invert:!1});let t;if("getMask"in this.props.field){const e=this.props.field.getMask();e&&(t=Object(p.jsx)(b.a,{esAggField:this.props.field,operator:e.operator,value:e.value}))}return t?Object(p.jsx)(o.a.Fragment,null,t,e):e}}var y=a(0);class heatmap_style_HeatmapStyle{constructor(e={colorRampName:l.c}){s()(this,"_descriptor",void 0),this._descriptor=heatmap_style_HeatmapStyle.createDescriptor(e.colorRampName)}static createDescriptor(e){return{type:y.Y.HEATMAP,colorRampName:e||l.c}}getType(){return y.Y.HEATMAP}renderEditor(e){return Object(p.jsx)(h,{colorRampName:this._descriptor.colorRampName,onHeatmapColorChange:({colorRampName:t})=>{const a=heatmap_style_HeatmapStyle.createDescriptor(t);e(a)}})}renderLegendDetails(e){return Object(p.jsx)(heatmap_legend_HeatmapLegend,{colorRampName:this._descriptor.colorRampName,field:e})}getIcon(){return Object(p.jsx)(c.EuiIcon,{size:"m",type:"heatmap"})}setMBPaintProperties({mbMap:e,layerId:t,propertyName:a,max:r,resolution:s}){let i;i=s===y.L.COARSE?128:s===y.L.FINE?64:s===y.L.MOST_FINE?32:8,e.setPaintProperty(t,"heatmap-radius",i),r<=0?e.setPaintProperty(t,"heatmap-weight",0):e.setPaintProperty(t,"heatmap-weight",["/",["get",a],r]);const n=Object(l.i)(this._descriptor.colorRampName,.1,1,!1);n&&e.setPaintProperty(t,"heatmap-color",["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",...n])}}var j=a(72),f=a(217),O=a(132),L=a(108);class heatmap_layer_HeatmapLayer extends i.a{static createDescriptor(e){const t=super.createDescriptor(e);return t.type=y.Z.HEATMAP,t.style=heatmap_style_HeatmapStyle.createDescriptor(),t}constructor({layerDescriptor:e,source:t}){if(super({layerDescriptor:e,source:t}),s()(this,"_style",void 0),e.style)this._style=new heatmap_style_HeatmapStyle(e.style);else{const e=heatmap_style_HeatmapStyle.createDescriptor();this._style=new heatmap_style_HeatmapStyle(e)}}_isTiled(){return!0}getLayerIcon(e){const{docCount:t}=Object(O.e)(this._getMetaFromTiles());return 0===t?j.d:super.getLayerIcon(e)}getSource(){return super.getSource()}getStyleForEditing(){return this._style}getStyle(){return this._style}getCurrentStyle(){return this._style}_getHeatmapLayerId(){return this.makeMbLayerId("heatmap")}getMbLayerIds(){return[this._getHeatmapLayerId()]}ownsMbLayerId(e){return this._getHeatmapLayerId()===e}ownsMbSourceId(e){return this.getId()===e}async syncData(e){await Object(j.g)({buffer:0,hasLabels:!1,layerId:this.getId(),layerName:await this.getDisplayName(),prevDataRequest:this.getSourceDataRequest(),requestMeta:Object(f.a)(this.getSource(),[],e.dataFilters,this.getQuery(),e.isForceRefresh,e.isFeatureEditorOpenForLayer),source:this.getSource(),syncContext:e})}_requiresPrevSourceCleanup(e){var t;const a=e.getSource(this.getMbSourceId());if(!a)return!1;const r=this.getSourceDataRequest();if(!r)return!1;const s=r.getData();return!!s&&(null===(t=a.tiles)||void 0===t?void 0:t[0])!==s.tileUrl}syncLayerWithMB(e){this._removeStaleMbSourcesAndLayers(e);const t=this.getSourceDataRequest(),a=t?t.getData():void 0;if(!a)return;const r=this.getMbSourceId();e.getSource(r)||e.addSource(r,{type:"vector",tiles:[a.tileUrl],minzoom:a.tileMinZoom,maxzoom:a.tileMaxZoom});const s=this._getHeatmapLayerId();e.getLayer(s)||e.addLayer({id:s,type:"heatmap",source:r,"source-layer":a.tileSourceLayer,paint:{}});const i=this.getSource().getMetricFields();if(!i.length)return;const n=i[0],o=this._requiresPrevSourceCleanup(e)?[]:this._getMetaFromTiles();let c=0;for(let e=0;e{this.setState({indexPattern:e},(()=>{const t=Object(d.a)(e.fields);t[0]&&this._onGeoFieldSelect(t[0].name)}))})),n()(this,"_onGeoFieldSelect",(e=>{this.setState({geoField:e},this.previewLayer)})),n()(this,"_onRequestTypeSelect",(e=>{this.setState({requestType:e},this.previewLayer)})),n()(this,"previewLayer",(()=>{const{indexPattern:e,geoField:t,requestType:a}=this.state,r=e&&t?{indexPatternId:e.id,geoField:t,requestType:a}:null;this.props.onSourceConfigChange(r)}))}_renderGeoSelect(){return this.state.indexPattern?Object(p.jsx)(l.EuiFormRow,{label:r.i18n.translate("xpack.maps.source.esGeoGrid.geofieldLabel",{defaultMessage:"Cluster field"})},Object(p.jsx)(o.a,{placeholder:r.i18n.translate("xpack.maps.source.esGeoGrid.geofieldPlaceholder",{defaultMessage:"Select geo field"}),value:this.state.geoField,onChange:this._onGeoFieldSelect,fields:this.state.indexPattern?Object(d.b)(this.state.indexPattern.fields):void 0,isFieldDisabled:h,getFieldDisabledReason:d.d})):null}_renderRenderAsSelect(){return this.state.indexPattern?Object(p.jsx)(u.a,{renderAs:this.state.requestType,onChange:this._onRequestTypeSelect}):null}render(){return Object(p.jsx)(l.EuiPanel,null,Object(p.jsx)(c.a,{dataView:this.state.indexPattern,onChange:this.onIndexPatternSelect}),this._renderGeoSelect(),this._renderRenderAsSelect())}}var m=a(104),g=a(72),b=a(79),y=a(82),j=a(0),f=a(80),O=a(219);const L=j.L.FINE,x={id:j.Hb.CLUSTERS,order:10,categories:[j.ab.ELASTICSEARCH],description:r.i18n.translate("xpack.maps.source.esGridClustersDescription",{defaultMessage:"Group documents into grids and hexagons"}),icon:()=>Object(p.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"49",height:"25",viewBox:"0 0 49 25",className:"mapLayersWizardIcon"},Object(p.jsx)("path",{fill:"#69707D",d:"M37.864 5.114v2.84l2.227 1.137 2.227-1.136V5.114l-2.227-1.137-2.227 1.137zM22.273 5.682h4.454v4.545h-4.454V5.682zM22.273 10.227v4.546h-4.455v-4.546h4.455zM31.182 14.773h-4.455v4.545h4.455v-4.545zM44.545 17.045v2.841l2.228 1.137L49 19.886v-2.84l-2.227-1.137-2.228 1.136zM37.864 15.91v-2.842l2.227-1.136 2.227 1.136v2.841l-2.227 1.136-2.227-1.136z"}),Object(p.jsx)("path",{className:"mapLayersWizardIcon__highlight",d:"M11.693 3.41c.923 0 1.67-.764 1.67-1.705 0-.942-.747-1.705-1.67-1.705-.922 0-1.67.763-1.67 1.705 0 .94.748 1.704 1.67 1.704zM3.898 6.818c1.537 0 2.784-1.272 2.784-2.84 0-1.57-1.247-2.842-2.784-2.842-1.538 0-2.784 1.272-2.784 2.841 0 1.57 1.246 2.841 2.784 2.841zM9.466 13.068c1.23 0 2.227-1.017 2.227-2.272 0-1.256-.997-2.273-2.227-2.273S7.239 9.54 7.239 10.796c0 1.255.997 2.272 2.227 2.272zM2.227 18.182c1.23 0 2.228-1.018 2.228-2.273 0-1.255-.998-2.273-2.228-2.273C.997 13.636 0 14.654 0 15.91c0 1.255.997 2.273 2.227 2.273zM10.023 25c1.845 0 3.34-1.526 3.34-3.41 0-1.882-1.495-3.408-3.34-3.408-1.845 0-3.341 1.526-3.341 3.409 0 1.883 1.496 3.409 3.34 3.409zM17.818 5.682h4.455v4.545h-4.455V5.682zM26.727 10.227h4.455v4.546h-4.455v-4.546zM26.727 14.773v4.545h-4.454v-4.545h4.454zM40.09 17.046v2.84l2.228 1.137 2.227-1.137v-2.84l-2.227-1.137-2.227 1.136zM35.636 11.932V9.09l2.228-1.136L40.09 9.09v2.84l-2.227 1.137-2.228-1.136zM42.318 5.114v2.84l2.227 1.137 2.228-1.136V5.114l-2.228-1.137-2.227 1.137z"}),Object(p.jsx)("path",{fill:"#98A2B3",d:"M40.09 1.136v2.841l2.228 1.137 2.227-1.137v-2.84L42.318 0l-2.227 1.136zM26.727 1.136h-4.454v4.546h4.454v4.545h-4.454v4.546h-4.455v4.545h4.455v-4.545h4.454v-4.546h4.455V5.682h-4.455V1.136zM40.09 9.09v2.842l2.228 1.136 2.227-1.136V9.09l-2.227-1.136-2.227 1.136zM37.864 23.864v-2.841l2.227-1.137 2.227 1.137v2.84L40.091 25l-2.227-1.136z"}),Object(p.jsx)("path",{fill:"#D3DAE6",d:"M44.545 3.977v-2.84L46.773 0 49 1.136v2.841l-2.227 1.137-2.228-1.137zM42.318 13.068v2.841l2.227 1.136 2.228-1.136v-2.84l-2.228-1.137-2.227 1.136zM26.727 19.318h-4.454v4.546h4.454v-4.546zM42.318 21.023v2.84L44.545 25l2.228-1.136v-2.841l-2.228-1.137-2.227 1.137z"})),renderWizard:({previewLayers:e})=>Object(p.jsx)(create_source_editor_CreateSourceEditor,{requestType:j.tb.POINT,onSourceConfigChange:t=>{if(!t)return void e([]);const a=m.a.createDescriptor({...t,resolution:L}),r=Object(b.i)(),s=y.a.createDescriptor({[j.Gb.FILL_COLOR]:{type:j.Cb.DYNAMIC,options:{...r[j.Gb.FILL_COLOR].options,field:{name:j.k,origin:j.D.SOURCE},color:f.e[0].value,type:j.j.ORDINAL}},[j.Gb.LINE_COLOR]:{type:j.Cb.STATIC,options:{color:"#FFF"}},[j.Gb.LINE_WIDTH]:{type:j.Cb.STATIC,options:{size:0}},[j.Gb.ICON_SIZE]:{type:j.Cb.DYNAMIC,options:{...r[j.Gb.ICON_SIZE].options,...Object(O.a)(L),field:{name:j.k,origin:j.D.SOURCE}}},[j.Gb.LABEL_TEXT]:{type:j.Cb.DYNAMIC,options:{...r[j.Gb.LABEL_TEXT].options,field:{name:j.k,origin:j.D.SOURCE}}}}),i=a.requestType===j.tb.HEX?g.c.createDescriptor({sourceDescriptor:a,style:s}):g.b.createDescriptor({sourceDescriptor:a,style:s});e([i])}}),title:m.b};var v=a(122);const _={id:j.Hb.HEATMAP,order:10,categories:[j.ab.ELASTICSEARCH],description:r.i18n.translate("xpack.maps.source.esGridHeatmapDescription",{defaultMessage:"Group documents in grids to show density"}),icon:()=>Object(p.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"49",height:"25",fill:"none",viewBox:"0 0 49 25",className:"mapLayersWizardIcon"},Object(p.jsx)("path",{className:"mapLayersWizardIcon__background",fillRule:"evenodd",d:"M29.012 20.309a10.393 10.393 0 01-6.608 2.359c-1.134 0-2.225-.181-3.247-.515a8.322 8.322 0 11-6.005-14.747A10.433 10.433 0 0122.404 1.8c3.973 0 7.428 2.222 9.19 5.49a8.322 8.322 0 11-2.582 13.019z",clipRule:"evenodd",opacity:"0.8"}),Object(p.jsx)("circle",{cx:"35.741",cy:"14.778",r:"3.989",className:"mapLayersWizardIcon__highlight"}),Object(p.jsx)("path",{className:"mapLayersWizardIcon__highlight",fillRule:"evenodd",d:"M20.021 16.957c-1.199-.773-2.221-.518-3.224.826-.896 1.2-2.587 1.272-3.963.482-1.332-.764-1.843-2.084-1.403-3.62.447-1.558 1.517-2.379 3.084-2.365 1.676.015 1.886-.16 2.496-1.863.8-2.235 2.274-3.8 4.704-4.07 2.266-.252 4.174.556 5.41 2.574 1.323 2.158 1.17 4.623-.348 6.462-1.65 1.998-3.962 2.574-6.756 1.574z",clipRule:"evenodd"})),renderWizard:({previewLayers:e})=>Object(p.jsx)(create_source_editor_CreateSourceEditor,{requestType:j.tb.HEATMAP,onSourceConfigChange:t=>{if(!t)return void e([]);const a=v.a.createDescriptor({sourceDescriptor:m.a.createDescriptor({...t,resolution:j.L.SUPER_FINE})});e([a])}}),title:m.c}},152:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(4);t.default=function(){var e=r.useRef(!1),t=r.useCallback((function(){return e.current}),[]);return r.useEffect((function(){return e.current=!0,function(){e.current=!1}})),t}},226:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var r=a(0),s=a(82),i=a(137),n=a(72),o=a(122),c=a(79),l=a(80),d=a(94),u=a(165);const p=Object(c.i)();function h(e){return"heatmap"===e.toLowerCase()}function m(e){return h(e)?r.tb.HEATMAP:"shaded geohash grid"===e.toLowerCase()?r.tb.GRID:r.tb.POINT}function g({label:e,mapType:t,colorSchema:a,indexPatternId:c,geoFieldName:g,metricAgg:b,metricFieldName:y}){if(!c||!g)return null;const j=function(e,t,a){const s=Object.keys(r.b).find((e=>r.b[e]===t)),i=s?r.b[s]:void 0;return!i||i===r.b.COUNT||!a||h(e)&&!Object(u.a)(i)?{type:r.b.COUNT}:i===r.b.PERCENTILE?{type:i,field:a,percentile:r.v}:{type:i,field:a}}(t,b,y),f=i.a.createDescriptor({indexPatternId:c,geoField:g,metrics:[j],requestType:m(t),resolution:r.L.MOST_FINE});if(h(t))return o.a.createDescriptor({label:e,sourceDescriptor:f});const O={name:Object(d.b)({aggType:j.type,aggFieldName:"field"in j?j.field:""}),origin:r.D.SOURCE},L=l.e.find((e=>e.value.toLowerCase()===a.toLowerCase())),x={[r.Gb.FILL_COLOR]:{type:r.Cb.DYNAMIC,options:{...p[r.Gb.FILL_COLOR].options,field:O,color:L?L.value:"Yellow to Red",type:r.j.ORDINAL,fieldMetaOptions:{...p[r.Gb.FILL_COLOR].options.fieldMetaOptions,isEnabled:!1}}},[r.Gb.LINE_COLOR]:{type:r.Cb.STATIC,options:{color:"#3d3d3d"}}};return"scaled circle markers"===t.toLowerCase()&&(x[r.Gb.ICON_SIZE]={type:r.Cb.DYNAMIC,options:{...p[r.Gb.ICON_SIZE].options,maxSize:18,field:O,fieldMetaOptions:{...p[r.Gb.ICON_SIZE].options.fieldMetaOptions,isEnabled:!1}}}),n.b.createDescriptor({label:e,sourceDescriptor:f,style:s.a.createDescriptor(x)})}},528:function(e,t,a){"use strict";a.r(t),a.d(t,"getLocation",(function(){return s}));var r=a(226);async function s(e,t){const{label:a,mapType:s,colorSchema:i,indexPatternId:n,geoFieldName:o,metricAgg:c,metricFieldName:l,filters:d,query:u,timeRange:p,hash:h=!0}=e,m=[],g=Object(r.a)({label:a,mapType:s,colorSchema:i,indexPatternId:n,geoFieldName:o,metricAgg:c,metricFieldName:l});return g&&m.push(g),await t.locator.getLocation({initialLayers:m,filters:d,query:u,timeRange:p,hash:h})}}}]);