/*! 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([[4],{111:function(t,e,n){"use strict";n.d(e,"C",(function(){return i})),n.d(e,"J",(function(){return r})),n.d(e,"a",(function(){return o})),n.d(e,"u",(function(){return s})),n.d(e,"b",(function(){return a})),n.d(e,"d",(function(){return l})),n.d(e,"f",(function(){return u})),n.d(e,"m",(function(){return c})),n.d(e,"w",(function(){return h})),n.d(e,"k",(function(){return d})),n.d(e,"l",(function(){return p})),n.d(e,"j",(function(){return f})),n.d(e,"i",(function(){return g})),n.d(e,"g",(function(){return m})),n.d(e,"h",(function(){return _})),n.d(e,"N",(function(){return y})),n.d(e,"t",(function(){return v})),n.d(e,"B",(function(){return b})),n.d(e,"I",(function(){return x})),n.d(e,"K",(function(){return E})),n.d(e,"L",(function(){return S})),n.d(e,"v",(function(){return C})),n.d(e,"O",(function(){return I})),n.d(e,"z",(function(){return O})),n.d(e,"e",(function(){return w})),n.d(e,"q",(function(){return L})),n.d(e,"s",(function(){return T})),n.d(e,"c",(function(){return N})),n.d(e,"E",(function(){return j})),n.d(e,"p",(function(){return M})),n.d(e,"n",(function(){return P})),n.d(e,"A",(function(){return F})),n.d(e,"G",(function(){return R})),n.d(e,"H",(function(){return A})),n.d(e,"r",(function(){return D})),n.d(e,"x",(function(){return k})),n.d(e,"D",(function(){return B})),n.d(e,"y",(function(){return G})),n.d(e,"o",(function(){return z})),n.d(e,"F",(function(){return V})),n.d(e,"M",(function(){return U}));const i="SET_SELECTED_LAYER",r="UPDATE_LAYER_ORDER",o="ADD_LAYER",s="SET_LAYER_ERROR_STATUS",a="ADD_WAITING_FOR_MAP_READY_LAYER",l="CLEAR_LAYER_PROP",u="CLEAR_WAITING_FOR_MAP_READY_LAYER_LIST",c="REMOVE_LAYER",h="SET_LAYER_VISIBILITY",d="MAP_EXTENT_CHANGED",p="MAP_READY",f="MAP_DESTROYED",g="LAYER_DATA_LOAD_STARTED",m="LAYER_DATA_LOAD_ENDED",_="LAYER_DATA_LOAD_ERROR",y="UPDATE_SOURCE_DATA_REQUEST",v="SET_JOINS",b="SET_QUERY",x="UPDATE_LAYER",E="UPDATE_LAYER_PROP",S="UPDATE_LAYER_STYLE",C="SET_LAYER_STYLE_META",I="UPDATE_SOURCE_PROP",O="SET_MOUSE_COORDINATES",w="CLEAR_MOUSE_COORDINATES",L="SET_EMBEDDABLE_SEARCH_CONTEXT",T="SET_GOTO",N="CLEAR_GOTO",j="TRACK_CURRENT_LAYER_STATE",M="ROLLBACK_TO_TRACKED_LAYER_STATE",P="REMOVE_TRACKED_LAYER_STATE",F="SET_OPEN_TOOLTIPS",R="UPDATE_DRAW_STATE",A="UPDATE_EDIT_STATE",D="SET_EXECUTION_CONTEXT",k="SET_MAP_INIT_ERROR",B="SET_WAITING_FOR_READY_HIDDEN_LAYERS",G="SET_MAP_SETTINGS",z="ROLLBACK_MAP_SETTINGS",V="TRACK_MAP_SETTINGS",U="UPDATE_MAP_SETTING"},114:function(t,e,n){"use strict";n.d(e,"f",(function(){return f})),n.d(e,"d",(function(){return g})),n.d(e,"c",(function(){return m})),n.d(e,"b",(function(){return _})),n.d(e,"e",(function(){return y})),n.d(e,"g",(function(){return v})),n.d(e,"k",(function(){return b})),n.d(e,"a",(function(){return x})),n.d(e,"i",(function(){return E})),n.d(e,"h",(function(){return S})),n.d(e,"j",(function(){return C}));var i=n(57),r=n(2),o=n.n(r),s=n(125);class map_adapter_MapAdapter extends s.EventEmitter{constructor(...t){super(...t),o()(this,"stats",void 0),o()(this,"style",void 0)}setMapState({stats:t,style:e}){this.stats=t,this.style=e,this._onChange()}getMapState(){return{stats:this.stats,style:this.style}}_onChange(){this.emit("change")}}n(28);class vector_tile_adapter_VectorTileAdapter extends s.EventEmitter{constructor(...t){super(...t),o()(this,"_layers",{}),o()(this,"_tiles",[])}addLayer(t,e,n){this._layers[t]={label:e,tileUrl:n},this._onChange()}removeLayer(t){delete this._layers[t],this._onChange()}setTiles(t){this._tiles=t,this._onChange()}getLayerOptions(){return Object.keys(this._layers).map((t=>({value:t,label:this._layers[t].label})))}getTileRequests(t){if(!this._layers[t])return[];const{tileUrl:e}=this._layers[t];return this._tiles.map((n=>({layerId:t,tileUrl:e,...n})))}_onChange(){this.emit("change")}}n(29);var a=n(5);const l="REGISTER_CANCEL_CALLBACK",u="UNREGISTER_CANCEL_CALLBACK",c="SET_EVENT_HANDLERS",h="SET_CHARTS_PALETTE_SERVICE_GET_COLOR",d="SET_ON_MAP_MOVE";function p(){const t={requests:new i.RequestAdapter,vectorTiles:new vector_tile_adapter_VectorTileAdapter};return Object(a.M)()&&(t.map=new map_adapter_MapAdapter),t}function f(t,e={}){if(!t)return{inspectorAdapters:p(),cancelRequestCallbacks:new Map,eventHandlers:{},chartsPaletteServiceGetColor:null};switch(e.type){case l:return t.cancelRequestCallbacks.set(e.requestToken,e.callback),{...t};case u:return t.cancelRequestCallbacks.delete(e.requestToken),{...t};case c:return{...t,eventHandlers:e.eventHandlers};case h:return{...t,chartsPaletteServiceGetColor:e.chartsPaletteServiceGetColor};case d:return{...t,onMapMove:e.onMapMove};default:return t}}const g=({nonSerializableInstances:t})=>t.inspectorAdapters,m=({nonSerializableInstances:t})=>t.eventHandlers;function _({nonSerializableInstances:t}){return t.chartsPaletteServiceGetColor}function y({nonSerializableInstances:t}){return t.onMapMove}const v=(t,e)=>({type:l,requestToken:t,callback:e}),b=t=>({type:u,requestToken:t}),x=t=>(e,n)=>{if(!t)return;const i=(({nonSerializableInstances:t})=>t.cancelRequestCallbacks)(n()).get(t);i&&(i(),e(b(t)))},E=(t={})=>({type:c,eventHandlers:t});function S(t){return{type:h,chartsPaletteServiceGetColor:t}}function C(t){return{type:d,onMapMove:t}}},118:function(t,e,n){"use strict";n.d(e,"c",(function(){return p})),n.d(e,"b",(function(){return f})),n.d(e,"j",(function(){return g})),n.d(e,"g",(function(){return _})),n.d(e,"h",(function(){return y})),n.d(e,"i",(function(){return b})),n.d(e,"f",(function(){return x})),n.d(e,"e",(function(){return E})),n.d(e,"d",(function(){return S})),n.d(e,"a",(function(){return I}));var i=n(41),r=n(0),o=n(70),s=n(114),a=n(111),l=n(87),u=n(76),c=n(166),h=n(97);const d=.1;function p(t){return e=>{t.getInFlightRequestTokens().forEach((t=>{e(Object(s.a)(t))})),e({type:a.K,id:t.getId(),propName:"__dataRequests",newValue:[]})}}function f(){return(t,e)=>{Object(o.p)(e()).forEach((e=>{t(p(e))}))}}function g(t){return async(e,n)=>{const i=Object(o.n)(t,n());if(!i||Object(h.c)(i))return;const r=await i.getStyleMetaDescriptorFromLocalFeatures();r&&e({type:a.v,layerId:t,styleMeta:r})}}function m(t,e,n,i,u){var c;return{dataFilters:Object(o.c)(e()),startLoading:(e,i,r)=>t(function(t,e,n,i){return(r,l)=>{const u=Object(o.n)(t,l());u&&r(Object(s.a)(u.getPrevRequestToken(e)));const c=Object(s.c)(l());c&&c.onDataLoad&&c.onDataLoad({layerId:t,dataId:e}),r({meta:i,type:a.i,layerId:t,dataId:e,requestToken:n})}}(n,e,i,r)),stopLoading:(e,i,u,c)=>t(function(t,e,n,i,u){return(c,h)=>{c(Object(s.k)(n));const d=Object(o.d)(h(),t,e);if(d&&d.dataRequestToken!==n)throw new l.b;const p=i&&"features"in i?i.features:[],f=Object(o.n)(t,h()),m=Object(s.c)(h());if(m&&m.onDataLoadEnd){const n={};if(f&&f.getType()===r.Z.GEOJSON_VECTOR){const t=p.filter((t=>!t.properties||!t.properties[r.U]));n.featuresCount=t.length}m.onDataLoadEnd({layerId:t,dataId:e,resultMeta:n})}c({type:a.g,layerId:t,dataId:e,data:i,meta:u,requestToken:n}),c(x(t,null)),c(g(t))}}(n,e,i,u,c)),onLoadError:(e,i,r)=>t(function(t,e,n,i){return async(r,o)=>{r(Object(s.k)(n));const l=Object(s.c)(o());l&&l.onDataLoadError&&l.onDataLoadError({layerId:t,dataId:e,errorMessage:i}),r({type:a.h,layerId:t,dataId:e,requestToken:n}),r(x(t,i))}}(n,e,i,r)),onJoinError:e=>t(x(n,e)),updateSourceData:e=>{t(function(t,e){return(n,i)=>{n({type:a.N,dataId:r.xb,layerId:t,newData:e}),n(g(t))}}(n,e))},isRequestStillActive:(t,i)=>{const r=Object(o.d)(e(),n,t);return!!r&&r.dataRequestToken===i},registerCancelCallback:(e,n)=>t(Object(s.g)(e,n)),forceRefreshDueToDrawing:i,isForceRefresh:u,isFeatureEditorOpenForLayer:(null===(c=Object(o.f)(e()))||void 0===c?void 0:c.layerId)===n,inspectorAdapters:Object(s.d)(e())}}function _(t){return async(e,n)=>{const i=Object(o.p)(n()).map((n=>e(v(n,t))));await Promise.all(i)}}function y(t){return async(e,n)=>{const i=m(e,n,t.getId(),!0,!1);t.isVisible()&&t.showAtZoomLevel(i.dataFilters.zoom)&&await t.syncData(i)}}function v(t,e){return async(n,i)=>{const r=m(n,i,t.getId(),!1,e);t.isVisible()&&t.showAtZoomLevel(r.dataFilters.zoom)&&await t.syncData(r)}}function b(t,e){return async(n,i)=>{const r=Object(o.n)(t,i());r&&n(v(r,e))}}function x(t,e){return{type:a.u,isInErrorState:null!==e,layerId:t,errorMessage:e}}function E(t){return async(e,n)=>{const i=Object(o.n)(t,n());if(i)try{const t=await i.getBounds((t=>m(e,n,t,!1,!1)));t&&await e(O(Object(u.q)(t,d)))}catch(t){return void(t instanceof l.b||console.warn("Unhandled getBounds error for layer. Only DataRequestAbortError should be surfaced",t))}}}function S(t){return async(e,n)=>{const i=Object(o.p)(n()).filter((t=>void 0===t.getParent())),r=await Object(c.a)(i,(t=>m(e,n,t,!1,!1)));null!==r?e(O(Object(u.q)(r,d))):t&&t()}}let C="";function I(){return async t=>{const e=Object(i.v4)();if(C=e,await t((async(t,e)=>{const n=Object(o.p)(e()).filter((t=>"hasJoins"in t&&t.hasJoins())).map((e=>t(v(e,!1))));await Promise.all(n)})),e===C){function n(){e===C&&t(_(!1))}t(S(n))}}}function O(t){return{type:a.s,bounds:t}}},119:function(t,e,n){"use strict";var i=n(96).default;e.__esModule=!0,e.default=e.ReactReduxContext=void 0;var r=i(n(4)).default.createContext(null);e.ReactReduxContext=r;var o=r;e.default=o},142:function(t,e,n){"use strict";n.d(e,"l",(function(){return u})),n.d(e,"g",(function(){return c})),n.d(e,"h",(function(){return h})),n.d(e,"f",(function(){return d})),n.d(e,"j",(function(){return p})),n.d(e,"i",(function(){return f})),n.d(e,"k",(function(){return g})),n.d(e,"b",(function(){return m})),n.d(e,"e",(function(){return _})),n.d(e,"d",(function(){return y})),n.d(e,"c",(function(){return v})),n.d(e,"a",(function(){return b})),n.d(e,"p",(function(){return x})),n.d(e,"A",(function(){return E})),n.d(e,"r",(function(){return S})),n.d(e,"w",(function(){return C})),n.d(e,"o",(function(){return I})),n.d(e,"y",(function(){return O})),n.d(e,"x",(function(){return w})),n.d(e,"z",(function(){return L})),n.d(e,"q",(function(){return T})),n.d(e,"v",(function(){return N})),n.d(e,"s",(function(){return j})),n.d(e,"n",(function(){return M})),n.d(e,"u",(function(){return P})),n.d(e,"t",(function(){return F})),n.d(e,"m",(function(){return R}));var i=n(77),r=n(90),o=n(185),s=n(167),a=n(0),l=n(111);const u="UPDATE_FLYOUT",c="SET_IS_LAYER_TOC_OPEN",h="SET_IS_TIME_SLIDER_OPEN",d="SET_FULL_SCREEN",p="SET_READ_ONLY",f="SET_OPEN_TOC_DETAILS",g="SHOW_TOC_DETAILS",m="HIDE_TOC_DETAILS",_="SET_DRAW_MODE",y="SET_AUTO_OPEN_WIZARD_ID",v="PUSH_DELETED_FEATURE_ID",b="CLEAR_DELETED_FEATURE_IDS";function x(){return{type:d,isFullScreen:!1}}function E(t){return{type:u,display:t}}function S(){return(t,e)=>{Object(i.d)(e())!==r.c.MAP_SETTINGS_PANEL&&(t(Object(s.w)(null)),t(Object(o.r)()),t(E(r.c.MAP_SETTINGS_PANEL)))}}function C(t){return{type:c,isLayerTOCOpen:t}}function I(){return{type:d,isFullScreen:!0}}function O(t){return{type:p,isReadOnly:t}}function w(t){return{type:f,layerIds:t}}function L(t){return(e,n)=>{Object(i.i)(n()).includes(t)||e({type:g,layerId:t})}}function T(t){return{type:m,layerId:t}}function N(t){return e=>{t===a.x.NONE&&e({type:l.H,editState:void 0}),e({type:_,drawMode:t})}}function j(){return{type:h,isTimesliderOpen:!0}}function M(){return t=>{t({type:h,isTimesliderOpen:!1}),t(Object(o.q)({clearTimeslice:!0}))}}function P(t){return e=>{e(Object(s.w)(null)),e(E(r.c.ADD_LAYER_WIZARD)),e(N(a.x.NONE)),e({type:y,autoOpenLayerWizardId:t})}}function F(t){return{type:v,featureId:t}}function R(){return{type:b}}},167:function(t,e,n){"use strict";n.d(e,"n",(function(){return f})),n.d(e,"o",(function(){return g})),n.d(e,"F",(function(){return m})),n.d(e,"e",(function(){return _})),n.d(e,"a",(function(){return y})),n.d(e,"b",(function(){return v})),n.d(e,"c",(function(){return b})),n.d(e,"l",(function(){return x})),n.d(e,"j",(function(){return E})),n.d(e,"z",(function(){return C})),n.d(e,"g",(function(){return I})),n.d(e,"x",(function(){return O})),n.d(e,"y",(function(){return w})),n.d(e,"w",(function(){return L})),n.d(e,"q",(function(){return T})),n.d(e,"M",(function(){return M})),n.d(e,"N",(function(){return P})),n.d(e,"G",(function(){return F})),n.d(e,"H",(function(){return R})),n.d(e,"t",(function(){return A})),n.d(e,"d",(function(){return D})),n.d(e,"J",(function(){return k})),n.d(e,"I",(function(){return B})),n.d(e,"E",(function(){return G})),n.d(e,"D",(function(){return z})),n.d(e,"C",(function(){return V})),n.d(e,"B",(function(){return U})),n.d(e,"v",(function(){return q})),n.d(e,"u",(function(){return Y})),n.d(e,"m",(function(){return W})),n.d(e,"k",(function(){return H})),n.d(e,"K",(function(){return K})),n.d(e,"s",(function(){return Q})),n.d(e,"r",(function(){return $})),n.d(e,"p",(function(){return tt})),n.d(e,"L",(function(){return et})),n.d(e,"f",(function(){return rt})),n.d(e,"A",(function(){return ot})),n.d(e,"i",(function(){return st})),n.d(e,"h",(function(){return at}));var i=n(70),r=n(90),o=n(114),s=n(142),a=n(111),l=n(118),u=n(0),c=n(19),h=n(77),d=n(97),p=n(163);function f(){return(t,e)=>{const n=Object(i.H)(e());t({type:a.n,layerId:n})}}function g(t){return(e,n)=>{Object(i.x)(n())?Object(i.r)(n()).forEach((({id:t})=>{e(X(t))})):e({type:a.f}),t.forEach((t=>{e(y(t))}))}}function m(t){return async(e,n)=>{e({type:a.I,layer:t}),await e(Object(l.i)(t.id,!1)),Object(i.y)(n()).autoFitToDataBounds&&e(Object(l.a)())}}function _(t){return async(e,n)=>{const r=Object(i.n)(t,n());r&&(await r.cloneDescriptor()).forEach((n=>{e(y(n)),r.getParent()&&e(st(n.id,t))}))}}function y(t){return async(e,n)=>{if(!Object(i.x)(n()))return void e({type:a.b,layer:t});e({type:a.a,layer:t}),e(Object(l.i)(t.id,!1));const r=Object(i.a)(t,[]);(await r.getLicensedFeatures()).forEach(c.d)}}function v(t){return{type:a.a,layer:t}}function b(t){return e=>{e(x()),t.forEach((t=>{e(y({...t,__isPreviewLayer:!0})),t.style&&(it(t.style)||t.style.type===u.Y.HEATMAP)&&e(Object(s.z)(t.id))}))}}function x(){return(t,e)=>{Object(i.p)(e()).forEach((e=>{e.isPreviewLayer()&&(Object(d.c)(e)&&t(ot(e.getId())),t(H(e.getId())))}))}}function E(){return(t,e)=>{Object(i.p)(e()).forEach((e=>{e.isPreviewLayer()&&t({type:a.K,id:e.getId(),propName:"__isPreviewLayer",newValue:!1})}))}}function S(t,e){return(n,r)=>{const o=Object(i.n)(t,r());o&&(Object(d.c)(o)&&o.getChildren().forEach((t=>{n(S(t.getId(),e))})),o.isVisible()!==e&&(n({type:a.w,layerId:t,visibility:e}),e&&n(Object(l.i)(t,!1))))}}function C(t){return(e,n)=>{const r=Object(i.n)(t,n());if(!r)return;const o=!r.isVisible();e(S(t,o))}}function I(){return(t,e)=>{Object(i.p)(e()).forEach(((e,n)=>{e.isBasemap(n)||t(S(e.getId(),!1))}))}}function O(){return(t,e)=>{Object(i.p)(e()).forEach(((e,n)=>{t(S(e.getId(),!0))}))}}function w(t){return(e,n)=>{Object(i.p)(n()).forEach(((n,i)=>{n.isBasemap(i)||n.getId()===t||e(S(n.getId(),!1))})),Object(i.n)(t,n())&&e(S(t,!0))}}function L(t){return async(e,n)=>{Object(i.H)(n())&&await e((async(t,e)=>{const n=Object(i.H)(e());await t({type:a.p,layerId:n}),t(Object(l.j)(n)),t(Object(l.i)(n,!1))})),t&&(e(function(t){return{type:a.E,layerId:t}}(t)),Object(h.c)(n())!==u.x.NONE&&e(Object(s.v)(u.x.NONE))),e({type:a.C,selectedLayerId:t})}}function T(){return async(t,e)=>{const n=Object(i.p)(e()).find((t=>t.isPreviewLayer()));n&&t(L(n.getId()))}}function N(t){return{type:a.J,newLayerOrder:t}}function j(t,e,n,r){return async(s,c)=>{if("metrics"===e){if(r)throw new Error("May not change layer-type when modifying metrics source-property");return await s(function(t,e){return async(n,r)=>{const o=Object(i.n)(t,r()),s=await o.getFields();n({type:a.O,layerId:t,propName:"metrics",value:e}),await n(J(t,s))}}(t,n))}if(s({type:a.O,layerId:t,propName:e,value:n}),r&&s(function(t,e){return(n,r)=>{const s=Object(i.n)(t,r());s&&s.getType()!==e&&(n(Object(l.c)(s)),nt(s,Object(o.d)(r())),n({type:a.K,id:t,propName:"type",newValue:e}))}}(t,r)),"scalingType"===e){const e=Object(i.o)(c(),t),r=e.joins?e.joins:[];if(n===u.vb.CLUSTERS&&r.length)s({type:a.t,layerId:t,joins:[]}),await s(J(t));else if(n===u.vb.MVT){const e=r.filter((t=>!Object(p.a)(t)));s({type:a.t,layerId:t,joins:e.length?[e[0]]:[]}),await s(J(t))}}}}function M(t,e,n,i){return async r=>{await r(j(t,e,n,i)),r(Object(l.i)(t,!1))}}function P(t,e){return async n=>{for(let i=0;i{n({type:a.K,id:t,propName:"query",newValue:e}),n(Object(l.i)(t,!1))}}function Y(t,e){return(n,i)=>{n({type:a.K,id:t,propName:"parent",newValue:e}),e&&n(Object(s.z)(e))}}function W(){return(t,e)=>{const n=e(),r=Object(i.H)(n);r&&t(H(r))}}function H(t){return async(e,n)=>{const o=n(),a=Object(i.H)(o);t===a&&(e(Object(s.A)(r.c.NONE)),await e(L(null))),e(X(t))}}function X(t){return(e,n)=>{const r=Object(i.n)(t,n());if(!r)return;r.getInFlightRequestTokens().forEach((t=>{e(Object(o.a)(t))})),nt(r,Object(o.d)(n())),e({type:a.m,id:t});const l=Object(i.f)(n());t===(null==l?void 0:l.layerId)&&e(Object(s.v)(u.x.NONE)),Object(h.i)(n()).includes(t)&&e(Object(s.q)(t)),Object(d.c)(r)&&r.getChildren().forEach((t=>{e(X(t.getId()))}))}}function J(t,e){return async(n,r)=>{const o=Object(i.n)(t,r());if(!o)return;const s=o.getCurrentStyle();if(!s||s.getType()!==u.Y.VECTOR)return;if(!("getFields"in o))return;const a=await o.getFields(),{hasChanges:l,nextStyleDescriptor:c}=await s.getDescriptorWithUpdatedStyleProps(a,Object(i.u)(r()),e);l&&c&&n(Z(t,c))}}function Z(t,e){return n=>{n({type:a.L,layerId:t,style:{...e}}),it(e)&&n(Object(s.z)(t)),n(Object(l.j)(t)),n(Object(l.i)(t,!1))}}function K(t){return(e,n)=>{const r=Object(i.H)(n());r&&e(Z(r,t))}}function Q(t,e){return async n=>{const i=await t.getFields();n({type:a.t,layerId:t.getId(),joins:e}),await n(J(t.getId(),i)),n(Object(l.i)(t.getId(),!1))}}function $(t){return(e,n)=>{Object(i.x)(n())?Object(i.r)(n()).forEach((n=>e(S(n.id,!t.includes(n.id))))):e({type:a.D,hiddenLayerIds:t})}}function tt(t,e){return{type:a.K,id:t,propName:"__areTilesLoaded",newValue:e}}function et(t,e){return async(n,r)=>{Object(i.n)(t,r())&&(n({type:a.K,id:t,propName:"__metaFromTiles",newValue:e}),await n(Object(l.j)(t)))}}function nt(t,e){if(!Object(d.c)(t)&&t.getSource().isESSource()&&(e.vectorTiles&&e.vectorTiles.removeLayer(t.getId()),e.requests&&"getValidJoins"in t)){const n=t;e.requests.resetRequest(t.getSource().getId()),n.getValidJoins().forEach((t=>{e.requests.resetRequest(t.getRightJoinSource().getId())}))}}function it(t){return t.type===u.Y.VECTOR&&Object.values(t.properties).some((t=>(null==t?void 0:t.type)===u.Cb.DYNAMIC))}function rt(t,e){return(n,r)=>{const o=d.b.createDescriptor({}),l=Object(i.o)(r(),e);null!=l&&l.parent&&(o.parent=l.parent),n({type:a.a,layer:o}),n(st(o.id,e)),n(Object(s.z)(o.id)),n(Y(t,o.id)),n(Y(e,o.id)),n(st(t,e))}}function ot(t){return(e,n)=>{const r=Object(i.p)(n()).find((e=>e.getId()===t));r&&Object(d.c)(r)&&r.getChildren().forEach((t=>{e(Y(t.getId(),r.getParent()))}))}}function st(t,e){return(n,r)=>{const o=Object(i.p)(r()),s=o.findIndex((e=>e.getId()===t)),a=o.findIndex((t=>t.getId()===e));if(-1===s||-1===a)return;const l=o[s],u=s>a?a+1:a,c=[];for(let t=0;t{n(st(t.getId(),e))}))}}function at(t){return(e,n)=>{const r=Object(i.p)(n()),o=r.findIndex((e=>e.getId()===t));if(-1===o)return;const s=r[o],a=[];for(let t=0;t{e(at(t.getId()))}))}}},168:function(t,e,n){"use strict";n.d(e,"c",(function(){return s})),n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return l}));var i=n(1),r=n(5),o=n(0);const s=i.i18n.translate("xpack.maps.breadCrumbs.unsavedChangesWarning",{defaultMessage:"Leave Maps with unsaved work?"}),a=i.i18n.translate("xpack.maps.breadCrumbs.unsavedChangesTitle",{defaultMessage:"Unsaved changes"});function l({pageTitle:t,isByValue:e,getHasUnsavedChanges:n,originatingApp:i,getAppNameFromId:l,history:u}){const c=[];return i&&l&&c.push({onClick:()=>{Object(r.B)()(i)},text:l(i)}),e||c.push({text:o.f,onClick:async()=>{n()?await Object(r.h)().openConfirm(s,{title:a,"data-test-subj":"appLeaveConfirmModal"})&&u.push("/"):u.push("/")}}),c.push({text:t}),c}},170:function(t,e,n){"use strict";n.d(e,"b",(function(){return i.a})),n.d(e,"a",(function(){return map_page_MapPage}));var i=n(244),r=n(49),o=n.n(r),s=n(1),a=n(5),l=n(0);function u(){const t=window.location.href.split("?");if(t.length<=1)return[];let e=new URLSearchParams(t[1]).get(l.R);if(!e)return[];try{return e.endsWith("#")&&(e=e.slice(0,-1)),function(t){return o.a.decodeArray(t).flatMap(((t,e)=>{return"object"==typeof(n=t)&&null!==n&&"string"==typeof t.id?t:(console.error(`item ${e} in mapInitLayers is not a valid LayerDescriptor and was ignored`),[]);var n}))}(e)}catch(t){return Object(a.Q)().addWarning({title:s.i18n.translate("xpack.maps.initialLayers.unableToParseTitle",{defaultMessage:"Initial layers not added to map"}),text:s.i18n.translate("xpack.maps.initialLayers.unableToParseMessage",{defaultMessage:"Unable to parse contents of 'initialLayers' parameter. Error: {errorMsg}",values:{errorMsg:t.message}})}),[]}}var c=n(24),h=n(168);function d(){const t=window.location.href.split(/[?#]+/);if(t.length<=1)return"";const e=new URLSearchParams(t[1]);return e.has(l.qb)&&e.has(l.qb)?e.get(l.qb):""}var p=n(2),f=n.n(p),g=n(4),m=n.n(g),_=n(71),y=n(39),v=n.n(y),b=n(25),x=n(44),E=n(53),S=n(47);class app_state_manager_AppStateManager{constructor(){f()(this,"_query",null),f()(this,"_savedQueryId",""),f()(this,"_filters",[]),f()(this,"_updated$",new S.Subject)}setQueryAndFilters({query:t,savedQueryId:e,filters:n}){t&&this._query!==t&&(this._query=t),e&&this._savedQueryId!==e&&(this._savedQueryId=e),n&&this._filters!==n&&(this._filters=n),this._updated$.next()}getQuery(){return this._query}getFilters(){return this._filters}getAppState(){return{query:this._query,savedQueryId:this._savedQueryId,filters:this._filters}}}var C=n(297),I=n(81),O=n(23),w=n.n(O),L=n(63),T=n(64),N=n(172),j=n(3);const M=Object(T.withSuspense)(T.LazySavedObjectSaveModalDashboard);var P=n(295);class map_app_MapApp extends m.a.Component{constructor(t){super(t),f()(this,"_autoRefreshSubscription",null),f()(this,"_globalSyncUnsubscribe",null),f()(this,"_globalSyncChangeMonitorSubscription",null),f()(this,"_appSyncUnsubscribe",null),f()(this,"_appStateManager",new app_state_manager_AppStateManager),f()(this,"_prevIndexPatternIds",null),f()(this,"_isMounted",!1),f()(this,"_kbnUrlStateStorage",void 0),f()(this,"_initialTimeFromUrl",void 0),f()(this,"_updateFromGlobalState",(({changes:t,state:e})=>{this.state.initialized&&t&&e&&this._onQueryChange({time:e.time})})),f()(this,"_onQueryChange",(({filters:t,query:e,time:n})=>{const{filterManager:i}=Object(a.i)().query;t&&i.setFilters(t),this.props.setQuery({forceRefresh:!1,filters:i.getFilters(),query:e,timeFilters:n}),this._appStateManager.setQueryAndFilters({filters:i.getAppFilters(),query:e});const r={filters:i.getGlobalFilters()};n&&(r.time=n),this._updateGlobalState(r)})),f()(this,"_onFiltersChange",(t=>{this._onQueryChange({filters:t})})),f()(this,"_updateStateFromSavedQuery",(t=>{this.setState({savedQuery:{...t}}),this._appStateManager.setQueryAndFilters({savedQueryId:t.id});const{filterManager:e}=Object(a.i)().query,n=[...t.attributes.filters||[],...e.getGlobalFilters()],i=v.a.get(t,"attributes.timefilter.refreshInterval");i&&this._onRefreshConfigChange({isPaused:i.pause,interval:i.value}),this._onQueryChange({filters:n,query:t.attributes.query,time:t.attributes.timefilter})})),f()(this,"_addFilter",(async t=>{t.forEach((t=>{t.$state={store:x.FilterStateStore.APP_STATE}})),this._onFiltersChange([...this.props.filters,...t])})),this.state={indexPatterns:[],initialized:!1,isRefreshPaused:!0,refreshInterval:0},this._kbnUrlStateStorage=Object(E.createKbnUrlStateStorage)({useHash:!1,history:t.history,...Object(E.withNotifyOnErrors)(Object(a.Q)())})}componentDidMount(){var t;this._isMounted=!0;const e={type:"application",name:l.e,url:window.location.pathname,id:this.props.savedMap.getSavedObjectId()||"new",page:"editor"};Object(a.o)().set(e),this.props.setExecutionContext(e),this._autoRefreshSubscription=Object(a.P)().getAutoRefreshFetch$().pipe(Object(b.tap)((()=>{this.props.setQuery({forceRefresh:!0})})),Object(b.switchMap)((t=>Object(P.a)(this.props.savedMap.getStore()).pipe(Object(b.finalize)(t))))).subscribe(),this._initialTimeFromUrl=null===(t=this._getGlobalState())||void 0===t?void 0:t.time;const{stop:n}=Object(c.syncGlobalQueryStateWithUrl)(Object(a.i)().query,this._kbnUrlStateStorage);this._globalSyncUnsubscribe=n,this._appSyncUnsubscribe=function(t,e){const{query:n}=Object(a.i)();n.filterManager.setAppFilters([]);const i={get:()=>({query:t.getQuery(),filters:t.getFilters()}),set:e=>e&&t.setQueryAndFilters({query:e.query,filters:e.filters}),state$:t._updated$.pipe(Object(b.map)((()=>({query:t.getQuery(),filters:t.getFilters()}))))},r=Object(c.connectToQueryState)(n,i,{filters:x.FilterStateStore.APP_STATE,query:!0}),{start:o,stop:s}=Object(E.syncState)({storageKey:"_a",stateStorage:e,stateContainer:i}),l={...i.get(),...e.get("_a")};return i.set(l),e.set("_a",l,{replace:!0}),o(),()=>{r(),s()}}(this._appStateManager,this._kbnUrlStateStorage),this._globalSyncChangeMonitorSubscription=Object(a.i)().query.state$.subscribe(this._updateFromGlobalState),this._initMap(),this.props.onAppLeave((t=>this.props.savedMap.hasUnsavedChanges()?t.confirm(h.c,h.b):t.default()))}componentDidUpdate(){this._updateIndexPatterns()}componentWillUnmount(){this._isMounted=!1,this._autoRefreshSubscription&&this._autoRefreshSubscription.unsubscribe(),this._globalSyncUnsubscribe&&this._globalSyncUnsubscribe(),this._appSyncUnsubscribe&&this._appSyncUnsubscribe(),this._globalSyncChangeMonitorSubscription&&this._globalSyncChangeMonitorSubscription.unsubscribe(),this.props.onAppLeave((t=>t.default()))}_getGlobalState(){var t;return null!==(t=this._kbnUrlStateStorage.get("_g"))&&void 0!==t?t:{}}_updateGlobalState(t){this._kbnUrlStateStorage.set("_g",{...this._getGlobalState(),...t}),this.state.initialized||this._kbnUrlStateStorage.kbnUrlControls.flush(!0)}async _updateIndexPatterns(){const{nextIndexPatternIds:t}=this.props;if(v.a.isEqual(t,this._prevIndexPatternIds))return;this._prevIndexPatternIds=t;let e=[];if(0===t.length){const t=await Object(a.u)().getDefaultDataView();t&&(e=[t])}else e=await Object(I.e)(t);this._isMounted&&v.a.isEqual(t,this._prevIndexPatternIds)&&this.setState({indexPatterns:e})}_getInitialTime(t){return this._initialTimeFromUrl?this._initialTimeFromUrl:!this.props.savedMap.hasSaveAndReturnConfig()&&null!=t&&t.timeFilters?t.timeFilters:Object(a.P)().getTime()}_initMapAndLayerSettings(t){const e=this._getGlobalState(),n=null!=t&&t.filters?t.filters:[],i=this._appStateManager.getFilters()||[],r=function({serializedMapState:t,appState:e={}}){return e.query?e.query:null!=t&&t.query?t.query:Object(a.i)().query.queryString.getDefaultQuery()}({serializedMapState:t,appState:this._appStateManager.getAppState()});r&&Object(a.i)().query.queryString.setQuery(r),this._onQueryChange({filters:[...v.a.get(e,"filters",[]),...i,...n],query:r,time:this._getInitialTime(t)}),this._onRefreshConfigChange(function({serializedMapState:t,globalState:e={}}){const n=Object(a.S)();if(null!=t&&t.refreshConfig)return t.refreshConfig;const i={...n.get(c.UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS),...e.refreshInterval};return{isPaused:i.pause,interval:i.value}}({serializedMapState:t,globalState:e}))}_onRefreshConfigChange({isPaused:t,interval:e}){this.setState({isRefreshPaused:t,refreshInterval:e}),this._updateGlobalState({refreshInterval:{pause:t,value:e}})}async _initMap(){var t,e;const n=null===(t=this.props.history.location)||void 0===t?void 0:t.state;if(null!=n&&null!==(e=n.dataViewSpec)&&void 0!==e&&e.id){const t=Object(a.u)();try{(await t.get(n.dataViewSpec.id)).isPersisted()||await t.create(n.dataViewSpec)}catch(t){}}try{await this.props.savedMap.whenReady()}catch(t){return void(this._isMounted&&(Object(a.Q)().addWarning({title:s.i18n.translate("xpack.maps.loadMap.errorAttemptingToLoadSavedMap",{defaultMessage:"Unable to load map"}),text:`${t.message}`}),this.props.history.push("/")))}if(!this._isMounted)return;const i=this.props.savedMap.getSharingSavedObjectProps(),r=Object(a.N)();if(r&&"aliasMatch"===(null==i?void 0:i.outcome)){const t=i.aliasTargetId,e=`${Object(l.Kb)(t)}${this.props.history.location.hash}`;return void await r.ui.redirectLegacyUrl({path:e,aliasPurpose:i.aliasPurpose,objectNoun:l.db})}this.props.savedMap.setBreadcrumbs(this.props.history),Object(a.f)().docTitle.change(this.props.savedMap.getTitle());const o=this.props.savedMap.getSavedObjectId();let u;o&&Object(a.f)().recentlyAccessed.add(Object(l.Lb)(o),this.props.savedMap.getTitle(),o);try{const t=this.props.savedMap.getAttributes();t.mapStateJSON&&(u=JSON.parse(t.mapStateJSON))}catch(t){}this._initMapAndLayerSettings(u),this.setState({initialized:!0})}_renderTopNav(){if(this.props.isFullScreen)return null;const t=function({savedMap:t,isOpenSettingsDisabled:e,isSaveDisabled:n,enableFullScreen:i,openMapSettings:r,inspectorAdapters:o,history:u}){const c=[];if(c.push({id:"mapSettings",label:s.i18n.translate("xpack.maps.topNav.openSettingsButtonLabel",{defaultMessage:"Settings"}),description:s.i18n.translate("xpack.maps.topNav.openSettingsDescription",{defaultMessage:"Open map settings"}),testId:"openSettingsButton",disableButton:()=>e,run(){r()}},{id:"inspect",label:s.i18n.translate("xpack.maps.topNav.openInspectorButtonLabel",{defaultMessage:"inspect"}),description:s.i18n.translate("xpack.maps.topNav.openInspectorDescription",{defaultMessage:"Open Inspector"}),testId:"openInspectorButton",run(){Object(a.v)().open(o,{})}},{id:"full-screen",label:s.i18n.translate("xpack.maps.topNav.fullScreenButtonLabel",{defaultMessage:"full screen"}),description:s.i18n.translate("xpack.maps.topNav.fullScreenDescription",{defaultMessage:"full screen"}),testId:"mapsFullScreenMode",run(){i()}}),t.hasOriginatingApp()&&c.push({label:s.i18n.translate("xpack.maps.topNav.cancel",{defaultMessage:"Cancel"}),run:()=>{Object(a.B)()(t.getOriginatingApp(),{path:t.getOriginatingPath()})},testId:"mapsCancelButton",description:s.i18n.translate("xpack.maps.topNav.cancelButtonAriaLabel",{defaultMessage:"Return to the last app without saving changes"})}),Object(a.z)().save){const e=t.hasSaveAndReturnConfig(),i=t.getAttributes().description?t.getAttributes().description:"",r=t.isByValue()?s.i18n.translate("xpack.maps.topNav.saveToMapsButtonLabel",{defaultMessage:"Save to maps"}):s.i18n.translate("xpack.maps.topNav.saveAsButtonLabel",{defaultMessage:"Save as"});c.push({id:"save",iconType:e?void 0:"save",label:e?r:s.i18n.translate("xpack.maps.topNav.saveMapButtonLabel",{defaultMessage:"save"}),description:s.i18n.translate("xpack.maps.topNav.saveMapDescription",{defaultMessage:"Save map"}),emphasize:!e,testId:"mapSaveButton",disableButton:()=>n,tooltip(){if(n)return s.i18n.translate("xpack.maps.topNav.saveMapDisabledButtonTooltip",{defaultMessage:"Confirm or Cancel your layer changes before saving"})},run:()=>{let e=t.getTags();const n=Object(a.G)(),r=n?Object(j.jsx)(n.ui.components.SavedObjectSaveModalTagSelector,{initialSelection:e,onTagsSelected:function(t){e=t},markOptional:!0}):void 0,o={onSave:async n=>{try{await Object(N.a)({id:n.newCopyOnSave?void 0:t.getSavedObjectId(),title:n.newTitle,copyOnSave:n.newCopyOnSave,lastSavedTitle:t.getSavedObjectId()?t.getTitle():"",isTitleDuplicateConfirmed:n.isTitleDuplicateConfirmed,getDisplayName:()=>l.db,onTitleDuplicate:n.onTitleDuplicate},{overlays:Object(a.h)()})}catch(t){return{}}return await t.save({...n,newTags:e,saveByReference:n.addToLibrary,history:u}),{id:"id"}},onClose:()=>{},documentInfo:{description:i,id:t.getSavedObjectId(),title:t.getTitle()},objectType:s.i18n.translate("xpack.maps.topNav.saveModalType",{defaultMessage:"map"})},c=Object(a.E)();let h;h=t.hasOriginatingApp()||!Object(a.w)()?Object(j.jsx)(L.SavedObjectSaveModalOrigin,w()({},o,{onSave:async t=>o.onSave({...t,addToLibrary:!0}),originatingApp:t.getOriginatingApp(),getAppNameFromId:t.getAppNameFromId,returnToOriginSwitchLabel:t.isByValue()?s.i18n.translate("xpack.maps.topNav.updatePanel",{defaultMessage:"Update panel on {originatingAppName}",values:{originatingAppName:t.getOriginatingAppName()}}):void 0,options:r})):Object(j.jsx)(M,w()({},o,{canSaveByReference:!0,tagOptions:r})),Object(L.showSaveModal)(h,c)}}),e&&c.push({id:"saveAndReturn",label:s.i18n.translate("xpack.maps.topNav.saveAndReturnButtonLabel",{defaultMessage:"Save and return"}),emphasize:!0,iconType:"checkInCircleFilled",run:()=>{t.save({newTitle:t.getTitle(),newDescription:i,newCopyOnSave:!1,isTitleDuplicateConfirmed:!1,returnToOrigin:!0,onTitleDuplicate:()=>{},saveByReference:!t.isByValue(),history:u})},testId:"mapSaveAndReturnButton"})}return c}({savedMap:this.props.savedMap,isOpenSettingsDisabled:this.props.isOpenSettingsDisabled,isSaveDisabled:this.props.isSaveDisabled,enableFullScreen:this.props.enableFullScreen,openMapSettings:this.props.openMapSettings,inspectorAdapters:this.props.inspectorAdapters,history:this.props.history}),{TopNavMenu:e}=Object(a.D)().ui;return Object(j.jsx)(e,{setMenuMountPoint:this.props.setHeaderActionMenu,appName:l.e,config:t,indexPatterns:this.state.indexPatterns,filters:this.props.filters,query:this.props.query,onQuerySubmit:({dateRange:t,query:e})=>{v.a.isEqual(t,this.props.timeFilters)&&v.a.isEqual(e,this.props.query)?this.props.setQuery({forceRefresh:!0}):this._onQueryChange({query:e,time:t})},onFiltersUpdated:this._onFiltersChange,dateRangeFrom:this.props.timeFilters.from,dateRangeTo:this.props.timeFilters.to,isRefreshPaused:this.state.isRefreshPaused,refreshInterval:this.state.refreshInterval,onRefreshChange:({isPaused:t,refreshInterval:e})=>{this._onRefreshConfigChange({isPaused:t,interval:e})},showSearchBar:!0,showFilterBar:!0,showDatePicker:!0,showSaveQuery:!!Object(a.z)().saveQuery,savedQuery:this.state.savedQuery,onSaved:this._updateStateFromSavedQuery,onSavedQueryUpdated:this._updateStateFromSavedQuery,onClearSavedQuery:()=>{const{filterManager:t,queryString:e}=Object(a.i)().query;this.setState({savedQuery:void 0}),this._appStateManager.setQueryAndFilters({savedQueryId:""}),this._onQueryChange({filters:t.getGlobalFilters(),query:e.getDefaultQuery()})}})}_renderLegacyUrlConflict(){const t=this.props.savedMap.getSharingSavedObjectProps(),e=Object(a.N)();return e&&"conflict"===(null==t?void 0:t.outcome)?e.ui.components.getLegacyUrlConflict({objectNoun:l.db,currentObjectId:this.props.savedMap.getSavedObjectId(),otherObjectId:t.aliasTargetId,otherObjectPath:`${Object(l.Kb)(t.aliasTargetId)}${this.props.history.location.hash}`}):null}render(){return this.state.initialized?Object(j.jsx)("div",{id:"maps-plugin",className:this.props.isFullScreen?"mapFullScreen":""},this._renderTopNav(),Object(j.jsx)("h1",{className:"euiScreenReaderOnly"},"screenTitle placeholder"),Object(j.jsx)("div",{id:"react-maps-root"},this._renderLegacyUrlConflict(),Object(j.jsx)(C.a,{addFilters:this._addFilter,title:this.props.savedMap.getAttributes().title,description:this.props.savedMap.getAttributes().description,waitUntilTimeLayersLoad$:Object(P.a)(this.props.savedMap.getStore()),isSharable:!0}))):null}}var F=n(77),R=n(70),A=n(73),D=n(90),k=n(114);const B=Object(_.connect)((function(t){return{isFullScreen:Object(F.e)(t),isOpenSettingsDisabled:Object(F.d)(t)!==D.c.NONE,isSaveDisabled:Object(R.N)(t),inspectorAdapters:Object(k.d)(t),nextIndexPatternIds:Object(R.D)(t),flyoutDisplay:Object(F.d)(t),filters:Object(R.i)(t),query:Object(R.C)(t),timeFilters:Object(R.K)(t)}}),(function(t){return{setQuery:({forceRefresh:e,filters:n,query:i,timeFilters:r,searchSessionId:o})=>{t(Object(A.ob)({filters:n,query:i,timeFilters:r,forceRefresh:e,searchSessionId:o}))},enableFullScreen:()=>t(Object(A.z)()),openMapSettings:()=>t(Object(A.K)()),setExecutionContext:e=>t(Object(A.ab)(e))}}))(map_app_MapApp);class map_page_MapPage extends g.Component{constructor(t){super(t),f()(this,"_isMounted",!1),f()(this,"updateSaveCounter",(()=>{this._isMounted&&this.setState((t=>({saveCounter:t.saveCounter+1})))})),this.state={savedMap:new i.a({defaultLayers:u(),mapEmbeddableInput:t.mapEmbeddableInput,embeddableId:t.embeddableId,originatingApp:t.originatingApp,originatingPath:t.originatingPath,stateTransfer:t.stateTransfer,onSaveCallback:this.updateSaveCounter,defaultLayerWizard:d()||""}),saveCounter:0}}componentDidMount(){this._isMounted=!0}componentWillUnmount(){this._isMounted=!1}render(){return Object(j.jsx)(_.Provider,{store:this.state.savedMap.getStore()},Object(j.jsx)(B,{history:this.props.history,savedMap:this.state.savedMap,onAppLeave:this.props.onAppLeave,setHeaderActionMenu:this.props.setHeaderActionMenu,saveCounter:this.state.saveCounter}))}}},172:function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a}));var i=n(21),r=n(5);const o={get:async t=>Object(r.d)().client.get({contentTypeId:i.a,id:t}),create:async({data:t,options:e})=>await Object(r.d)().client.create({contentTypeId:i.a,data:t,options:e}),update:async({id:t,data:e,options:n})=>await Object(r.d)().client.update({contentTypeId:i.a,id:t,data:e,options:n}),delete:async t=>{await Object(r.d)().client.delete({contentTypeId:i.a,id:t})},search:async(t={},e)=>Object(r.d)().client.search({contentTypeId:i.a,query:t,options:e})},s=n(1).i18n.translate("xpack.maps.saveDuplicateRejectedDescription",{defaultMessage:"Save with duplicate title confirmation was rejected"}),a=async({id:t,title:e,lastSavedTitle:n,copyOnSave:i,isTitleDuplicateConfirmed:r,getDisplayName:a,onTitleDuplicate:l},{overlays:u})=>{if(r)return!0;if(e===n&&!i)return!0;const{hits:c}=await o.search({text:`"${e}"`,limit:10},{onlyTitle:!0}),h=c.find((t=>t.attributes.title.toLowerCase()===e.toLowerCase()));return!h||h.id===t||(l(),Promise.reject(new Error(s)))}},185:function(t,e,n){"use strict";n.d(e,"n",(function(){return E})),n.d(e,"o",(function(){return S})),n.d(e,"i",(function(){return C})),n.d(e,"r",(function(){return I})),n.d(e,"w",(function(){return O})),n.d(e,"s",(function(){return w})),n.d(e,"d",(function(){return L})),n.d(e,"h",(function(){return T})),n.d(e,"f",(function(){return N})),n.d(e,"g",(function(){return j})),n.d(e,"p",(function(){return M})),n.d(e,"c",(function(){return P})),n.d(e,"m",(function(){return F})),n.d(e,"b",(function(){return R})),n.d(e,"q",(function(){return A})),n.d(e,"k",(function(){return D})),n.d(e,"l",(function(){return k})),n.d(e,"t",(function(){return B})),n.d(e,"v",(function(){return G})),n.d(e,"j",(function(){return z})),n.d(e,"u",(function(){return V})),n.d(e,"a",(function(){return U})),n.d(e,"e",(function(){return q}));var i=n(39),r=n.n(i),o=n(1),s=n(245),a=n.n(s),l=n(246),u=n.n(l),c=n(52),h=n(0),d=n(114),p=n(70),f=n(111),g=n(118),m=n(167),_=n(72),y=n(142),v=n(164),b=n(5),x=n(77);function E(t){return{type:f.x,errorMessage:t}}function S(t){return{type:f.y,settings:t}}function C(){return{type:f.o}}function I(){return{type:f.F}}function O(t,e){return n=>{n({type:f.M,settingKey:t,settingValue:e}),"autoFitToDataBounds"===t&&!0===e&&n(Object(g.a)())}}function w(t){return{type:f.M,settingKey:"customIcons",settingValue:t}}function L(t){return async(e,n)=>{const i=Object(p.p)(n()).filter((e=>{const n=e.getCurrentStyle();return!(!n||n.getType()!==h.Y.VECTOR)&&n.isUsingCustomIcon(t)}));if(i.length>0){const t=await Object(c.asyncMap)(i,(async t=>await t.getDisplayName()));Object(b.Q)().addWarning(o.i18n.translate("xpack.maps.mapActions.deleteCustomIconWarning",{defaultMessage:"Unable to delete icon. The icon is in use by the {count, plural, one {layer} other {layers}}: {layerNames}",values:{count:t.length,layerNames:t.join(", ")}}))}else e(O("customIcons",n().map.settings.customIcons.filter((({symbolId:e})=>e!==t))))}}function T(){return(t,e)=>{t({type:f.l});const n=Object(p.M)(e());Object(p.y)(e()).initialLocation===h.S.AUTO_FIT_TO_BOUNDS?(n.forEach((e=>{t(Object(m.b)(e))})),t(Object(g.a)())):n.forEach((e=>{t(Object(m.a)(e))})),t({type:f.f})}}function N(){return{type:f.j}}function j(t){return(e,n)=>{const{extent:i,zoom:r}=t,{buffer:o,zoom:s}=Object(p.c)(n());let l=!0;if(o){const t=a()([o.minLon,o.minLat,o.maxLon,o.maxLat]),e=a()([i.minLon,i.minLat,i.maxLon,i.maxLat]);l=u()(t,e)}const c=!o||!l||s!==r;c&&Object(d.d)(n()).vectorTiles.setTiles(Object(v.d)(r,i)),e({type:f.k,mapViewContext:{...t,buffer:c?Object(v.a)(i,Math.ceil(r)):o}}),e(Object(g.g)(!1))}}function M({lat:t,lon:e}){let n=e;return e>180?n=e-180-180:e<-180&&(n=180-(Math.abs(e)-180)),{type:f.z,lat:t,lon:n}}function P(){return{type:f.e}}function F({lat:t,lon:e,zoom:n}){return{type:f.s,center:{lat:t,lon:e,zoom:n}}}function R(){return{type:f.c}}function A({query:t,timeFilters:e,timeslice:n,filters:i,forceRefresh:o=!1,searchSessionId:s,searchSessionMapBuffer:a,clearTimeslice:l}){return async(u,c)=>{const h=Object(p.C)(c()),d=Object(p.K)(c()),m={timeFilters:e||d,timeslice:function(){if(!l&&(void 0===e||r.a.isEqual(e,d)))return n||Object(p.L)(c())}(),query:t||h,filters:i||Object(p.i)(c()),searchSessionId:s||Object(p.E)(c()),searchSessionMapBuffer:a},_={timeFilters:d,timeslice:Object(p.L)(c()),query:h,filters:Object(p.i)(c()),searchSessionId:Object(p.E)(c()),searchSessionMapBuffer:Object(p.F)(c())};!o&&r.a.isEqual(m,_)||(u({type:f.B,...m}),Object(p.y)(c()).autoFitToDataBounds?u(Object(g.a)()):await u(Object(g.g)(o)))}}function D({query:t,filters:e}){return{type:f.q,embeddableSearchContext:{filters:e,query:t}}}function k(t){return{type:f.r,executionContext:t}}function B(t){return e=>{null!==t&&e({type:f.A,openTooltips:[]}),e({type:f.G,drawState:t})}}function G(t){return(e,n)=>{const i=Object(p.f)(n());i&&(e({type:f.H,editState:{...i,drawShape:t}}),t!==h.y.DELETE&&e(Object(y.m)()))}}function z(){return async(t,e)=>{const n=Object(p.H)(e());n&&t(V(n))}}function V(t){return e=>{null!==t&&e({type:f.A,openTooltips:[]}),e({type:y.e,drawMode:h.x.NONE}),e({type:f.H,editState:t?{layerId:t}:void 0}),e(Object(g.i)(t,!1))}}function U(t){return async(e,n)=>{const i=Object(p.f)(n()),r=i?i.layerId:void 0;if(!r)return;const s=Object(p.n)(r,n());if(s&&Object(_.e)(s)){try{e(G(h.y.WAIT)),await Object(c.asyncForEach)(t,(async t=>{await s.addFeature(t)})),await e(Object(g.h)(s))}catch(t){Object(b.Q)().addError(t,{title:o.i18n.translate("xpack.maps.mapActions.addFeatureError",{defaultMessage:"Unable to add feature to index."})})}e(G(h.y.SIMPLE_SELECT))}}}function q(t){return async(e,n)=>{if(Object(x.b)(n()).includes(t))return;const i=Object(p.f)(n()),r=i?i.layerId:void 0;if(!r)return;const s=Object(p.n)(r,n());if(s&&Object(_.e)(s)){try{e(G(h.y.WAIT)),await s.deleteFeature(t),e(Object(y.t)(t)),await e(Object(g.h)(s))}catch(t){Object(b.Q)().addError(t,{title:o.i18n.translate("xpack.maps.mapActions.removeFeatureError",{defaultMessage:"Unable to remove feature from index."})})}e(G(h.y.DELETE))}}}},220:function(t,e,n){"use strict";n.d(e,"b",(function(){return c})),n.d(e,"a",(function(){return WMSSource}));var i=n(2),r=n.n(i),o=n(1),s=n(110),a=n(74),l=n(283),u=n(0);const c=o.i18n.translate("xpack.maps.source.wmsTitle",{defaultMessage:"Web Map Service"});class WMSSource extends s.a{static createDescriptor({serviceUrl:t,layers:e,styles:n}){return{type:WMSSource.type,serviceUrl:t,layers:e,styles:n}}constructor(t){super(t),r()(this,"_descriptor",void 0),this._descriptor=t}async hasLegendDetails(){return!1}renderLegendDetails(){return null}isSourceStale(t,e){var n;return!!e.url&&(null===(n=t.tiles)||void 0===n?void 0:n[0])!==e.url}async canSkipSourceUpdate(){return!1}async getImmutableProperties(){return[{label:Object(a.a)(),value:c},{label:Object(a.f)(),value:this._descriptor.serviceUrl},{label:o.i18n.translate("xpack.maps.source.wms.layersLabel",{defaultMessage:"Layers"}),value:this._descriptor.layers},{label:o.i18n.translate("xpack.maps.source.wms.stylesLabel",{defaultMessage:"Styles"}),value:this._descriptor.styles}]}async getDisplayName(){return this._descriptor.serviceUrl}async getUrlTemplate(){return new l.a({serviceUrl:this._descriptor.serviceUrl}).getUrlTemplate(this._descriptor.layers,this._descriptor.styles||"")}}r()(WMSSource,"type",u.Ab.WMS)},221:function(t,e,n){"use strict";e.__esModule=!0,e.createSubscription=function(t,e){var n,o=r;function s(){l.onStateChange&&l.onStateChange()}function a(){var r,a,l;n||(n=e?e.addNestedSub(s):t.subscribe(s),r=(0,i.getBatch)(),a=null,l=null,o={clear:function(){a=null,l=null},notify:function(){r((function(){for(var t=a;t;)t.callback(),t=t.next}))},get:function(){for(var t=[],e=a;e;)t.push(e),e=e.next;return t},subscribe:function(t){var e=!0,n=l={callback:t,next:null,prev:l};return n.prev?n.prev.next=n:a=n,function(){e&&null!==a&&(e=!1,n.next?n.next.prev=n.prev:l=n.prev,n.prev?n.prev.next=n.next:a=n.next)}}})}var l={addNestedSub:function(t){return a(),o.subscribe(t)},notifyNestedSubs:function(){o.notify()},handleChangeWrapper:s,isSubscribed:function(){return Boolean(n)},trySubscribe:a,tryUnsubscribe:function(){n&&(n(),n=void 0,o.clear(),o=r)},getListeners:function(){return o}};return l};var i=n(287),r={notify:function(){},get:function(){return[]}}},222:function(t,e,n){"use strict";e.__esModule=!0,e.useIsomorphicLayoutEffect=void 0;var i=n(4),r="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?i.useLayoutEffect:i.useEffect;e.useIsomorphicLayoutEffect=r},223:function(t,e,n){t.exports=n(22)(1467)},235:function(t,e,n){"use strict";n.d(e,"a",(function(){return y}));var i=n(4),r=n(1),o=n(2),s=n.n(o),a=n(40),l=n(14),u=n(283),c=n(39),h=n.n(c),d=n(3);const p=r.i18n.translate("xpack.maps.source.wms.layersLabel",{defaultMessage:"Layers"}),f=r.i18n.translate("xpack.maps.source.wms.stylesLabel",{defaultMessage:"Styles"});class wms_create_source_editor_WMSCreateSourceEditor extends i.Component{constructor(...t){super(...t),s()(this,"state",{serviceUrl:"",layers:"",styles:"",isLoadingCapabilities:!1,getCapabilitiesError:null,hasAttemptedToLoadCapabilities:!1,layerOptions:[],styleOptions:[],selectedLayerOptions:[],selectedStyleOptions:[]}),s()(this,"_previewIfPossible",h.a.debounce((()=>{const{serviceUrl:t,layers:e,styles:n}=this.state,i=t&&e?{serviceUrl:t,layers:e,styles:n}:null;this.props.onSourceConfigChange(i)}),2e3)),s()(this,"_loadCapabilities",(async()=>{if(!this.state.serviceUrl)return;this.setState({hasAttemptedToLoadCapabilities:!0,isLoadingCapabilities:!0,getCapabilitiesError:null});const t=new u.a({serviceUrl:this.state.serviceUrl});let e;try{e=await t.getCapabilities()}catch(t){return void(this._isMounted&&this.setState({isLoadingCapabilities:!1,getCapabilitiesError:t.message}))}this._isMounted&&this.setState({isLoadingCapabilities:!1,layerOptions:e.layers,styleOptions:e.styles})})),s()(this,"_handleServiceUrlChange",(t=>{this.setState({serviceUrl:t.target.value,hasAttemptedToLoadCapabilities:!1,layerOptions:[],styleOptions:[],selectedLayerOptions:[],selectedStyleOptions:[],layers:"",styles:""},this._previewIfPossible)})),s()(this,"_handleLayersChange",(t=>{this.setState({layers:t.target.value},this._previewIfPossible)})),s()(this,"_handleLayerOptionsChange",(t=>{this.setState({selectedLayerOptions:t,layers:t.map((t=>t.value)).join(",")},this._previewIfPossible)})),s()(this,"_handleStylesChange",(t=>{this.setState({styles:t.target.value},this._previewIfPossible)})),s()(this,"_handleStyleOptionsChange",(t=>{this.setState({selectedStyleOptions:t,styles:t.map((t=>t.value)).join(",")},this._previewIfPossible)}))}componentDidMount(){this._isMounted=!0}componentWillUnmount(){this._isMounted=!1}_renderLayerAndStyleInputs(){return!this.state.hasAttemptedToLoadCapabilities||this.state.isLoadingCapabilities?null:this.state.getCapabilitiesError||0===this.state.layerOptions.length?Object(d.jsx)(i.Fragment,null,Object(d.jsx)(l.EuiSpacer,null),Object(d.jsx)(l.EuiCallOut,{title:r.i18n.translate("xpack.maps.source.wms.getCapabilitiesErrorCalloutTitle",{defaultMessage:"Unable to load service metadata"}),color:"warning"},Object(d.jsx)("p",null,this.state.getCapabilitiesError)),Object(d.jsx)(l.EuiSpacer,null),Object(d.jsx)(l.EuiFormRow,{label:p,helpText:r.i18n.translate("xpack.maps.source.wms.layersHelpText",{defaultMessage:"Use comma separated list of layer names"})},Object(d.jsx)(l.EuiFieldText,{onChange:this._handleLayersChange})),Object(d.jsx)(l.EuiFormRow,{label:f,helpText:r.i18n.translate("xpack.maps.source.wms.stylesHelpText",{defaultMessage:"Use comma separated list of style names"})},Object(d.jsx)(l.EuiFieldText,{onChange:this._handleStylesChange}))):Object(d.jsx)(i.Fragment,null,Object(d.jsx)(l.EuiFormRow,{label:p},Object(d.jsx)(l.EuiComboBox,{options:this.state.layerOptions,selectedOptions:this.state.selectedLayerOptions,onChange:this._handleLayerOptionsChange})),Object(d.jsx)(l.EuiFormRow,{label:f},Object(d.jsx)(l.EuiComboBox,{options:this.state.styleOptions,selectedOptions:this.state.selectedStyleOptions,onChange:this._handleStyleOptionsChange})))}_renderGetCapabilitiesButton(){return!this.state.isLoadingCapabilities&&this.state.hasAttemptedToLoadCapabilities?null:Object(d.jsx)(i.Fragment,null,Object(d.jsx)(l.EuiButton,{onClick:this._loadCapabilities,isDisabled:!this.state.serviceUrl,isLoading:this.state.isLoadingCapabilities},Object(d.jsx)(a.FormattedMessage,{id:"xpack.maps.source.wms.getCapabilitiesButtonText",defaultMessage:"Load capabilities"})))}render(){return Object(d.jsx)(l.EuiPanel,null,Object(d.jsx)(l.EuiFormRow,{label:r.i18n.translate("xpack.maps.source.wms.urlLabel",{defaultMessage:"Url"})},Object(d.jsx)(l.EuiFieldText,{value:this.state.serviceUrl,onChange:this._handleServiceUrlChange})),this._renderGetCapabilitiesButton(),this._renderLayerAndStyleInputs())}}var g=n(220),m=n(150),_=n(0);const y={id:_.Hb.WMS_LAYER,order:10,categories:[_.ab.REFERENCE],description:r.i18n.translate("xpack.maps.source.wmsDescription",{defaultMessage:"Maps from OGC Standard WMS"}),icon:()=>Object(d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"49",height:"25",fill:"none",viewBox:"0 0 49 25",className:"mapLayersWizardIcon"},Object(d.jsx)("path",{className:"mapLayersWizardIcon__highlight",d:"M30.766 14.01l1.602-12.954-1.389.237c-.744.253-1.768.38-2.702.45a43.28 43.28 0 01-1.259.07l-.092.004c-.312.014-.57.026-.72.042a1.895 1.895 0 00-.558.168c-.156.07-.316.156-.47.238l-.057.03c-.356.191-.687.358-1.025.4l-1.308.339v5.863c0 .698.142 2.17 0 3.443l-.204 1.67h8.182zM20.871 2.748c-.656.039-1.247.282-2.06.4l-.702.102c-.583.086-1.16.172-1.693.238-.75.093-1.389.145-1.82.113-.592-.044-1.124.341-1.61.843-.453.467-.926 1.1-1.429 1.777l-.144.193c-1.132 1.517-2.452 3.218-4.22 4.101-.214.108-.346.313-.432.528-.087.22-.14.489-.172.78-.064.587-.047 1.325.007 2.083.071 1.01.211 2.102.32 2.956.054.42.1.783.128 1.05.08.78-.128 1.769-.37 2.653-.088.319-.178.616-.258.882-.03.1-.06.195-.086.285a9.67 9.67 0 00-.12.434 1.518 1.518 0 00-.054.334c0 .279.11.577.283.842.175.268.426.52.735.708l.067.04.079-.001c4.133-.068 10.22-.554 10.972-.638a.582.582 0 00.334-.17c.083-.08.157-.182.224-.293.134-.223.264-.524.388-.867.249-.69.495-1.6.72-2.52.162-.654.545-1.41.683-2.01l.784-2.796c.066-.379.198-1.13.272-1.705.146-1.148-.01-2.54.097-3.999.107-1.458.171-2.917.146-4.052a10.13 10.13 0 00-.112-1.438 2.469 2.469 0 00-.131-.495c-.053-.128-.276-.358-.276-.358h-.55zm10.931 12.621s-1.169-.652-1.548-.642c-.757.019-1.298-.026-2.352 0h-5.489l-2.863 8.915c.2.066 1.938.444 2.242.447.62.005 1.478-.08 2.393-.197.88-.113 1.824-.258 2.678-.389l.113-.017a49.753 49.753 0 012.166-.305c.347-.034.996-.024 1.858-.007l.127.003c.827.017 1.819.037 2.869.023 2.198-.029 4.694-.204 6.5-.887 1.42-.538 2.099-.87 2.513-1.34.414-.468.575-1.576.575-1.576s-2.907.868-4.807.784c-.927-.04-1.508.045-2.352-.34-1.429-.652-1.206-2.221-2.43-3.205-.77-.62-2.193-1.267-2.193-1.267z"}),Object(d.jsx)("path",{className:"mapLayersWizardIcon__highlight",d:"M33.322 1.125S31.277 14.3 31.72 14.522c.786.393 2.012.665 3.137 1.67 1.23 1.1 1.172 2.5 2.318 3.24.835.538 6.525-.704 6.525-.704l.228-7.956s-.174-4.5-.89-5.216c-.715-.716-2.488-1.125-3-2.08-1.115-2.08-3.068-2.351-3.068-2.351h-3.648z"})),renderWizard:({previewLayers:t})=>Object(d.jsx)(wms_create_source_editor_WMSCreateSourceEditor,{onSourceConfigChange:e=>{if(!e)return void t([]);const n=m.a.createDescriptor({sourceDescriptor:g.a.createDescriptor(e)});t([n])}}),title:g.b}},238:function(t,e,n){"use strict";n.d(e,"a",(function(){return geojson_file_source_GeoJsonFileSource}));var i=n(151),r=n(0),o=n(277),s=n(216);class geojson_file_source_GeoJsonFileSource extends i.a{static createDescriptor(t){return{type:r.Ab.GEOJSON_FILE,__featureCollection:(e=t.__featureCollection,e?"FeatureCollection"===e.type?e:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:r.z:r.z),__fields:t.__fields||[],areResultsTrimmed:void 0!==t.areResultsTrimmed&&t.areResultsTrimmed,tooltipContent:t.tooltipContent?t.tooltipContent:null,name:t.name||"Features"};var e}constructor(t){super(geojson_file_source_GeoJsonFileSource.createDescriptor(t))}_getFields(){return this._descriptor.__fields||[]}createField({fieldName:t}){const e=this._getFields().find((e=>e.name===t));if(!e)throw new Error(`Cannot find corresponding field ${t} in __fields array ${JSON.stringify(this._getFields())} `);return new s.a({fieldName:e.name,source:this,origin:r.D.SOURCE,dataType:e.type})}async getFields(){return this._getFields().map((t=>new s.a({fieldName:t.name,source:this,origin:r.D.SOURCE,dataType:t.type})))}isBoundsAware(){return!0}async getBoundsForFilters(t,e){const n=this.getFeatureCollection();return Object(o.a)(n,!1)}async getGeoJsonWithMeta(){return{data:this.getFeatureCollection(),meta:{}}}async getDisplayName(){return this._descriptor.name}hasTooltipProperties(){return!0}getSourceStatus(){return{tooltipContent:this._descriptor.tooltipContent,areResultsTrimmed:this._descriptor.areResultsTrimmed}}getFeatureCollection(){return this._descriptor.__featureCollection}}},240:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(50),r=n(4),o=i.__importDefault(n(318));e.default=function(t,e){var n=r.useState(e),i=n[0],s=n[1];return o.default((function(){var e=t.subscribe(s);return function(){return e.unsubscribe()}}),[t]),i}},243:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(50),r=n(4),o=i.__importDefault(n(339));e.default=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=[]);var i=o.default(t,e),s=i[0],a=i[1],l=i[2];return r.useEffect(l,n),[s,a]}},244:function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return SavedMap}));var i=n(2),r=n.n(i),o=n(39),s=n.n(o),a=n(15),l=n(1),u=n(0),c=n(521),h=n(70),d=n(73),p=n(77),f=n(285),g=n(5),m=n(88),_=n(168),y=n(90),v=n(169),b=n(19),x=n(142),E=n(523),S=n(81);function C(e){const n=e.customIcons?e.customIcons.map((e=>({...e,svg:t.from(e.svg,"base64").toString("utf-8")}))):[];return Object(d.lb)({...e,customIcons:n})}class SavedMap{constructor({defaultLayers:t=[],mapEmbeddableInput:e,embeddableId:n,onSaveCallback:i,originatingApp:o,stateTransfer:a,originatingPath:l,defaultLayerWizard:u}){r()(this,"_attributes",null),r()(this,"_sharingSavedObjectProps",null),r()(this,"_defaultLayers",void 0),r()(this,"_embeddableId",void 0),r()(this,"_initialLayerListConfig",[]),r()(this,"_mapEmbeddableInput",void 0),r()(this,"_onSaveCallback",void 0),r()(this,"_originatingApp",void 0),r()(this,"_originatingPath",void 0),r()(this,"_stateTransfer",void 0),r()(this,"_store",void 0),r()(this,"_tags",[]),r()(this,"_defaultLayerWizard",void 0),r()(this,"hasUnsavedChanges",(()=>{if(!this._attributes)throw new Error("Invalid usage, must await whenReady before calling hasUnsavedChanges");const t=this._attributes.layerListJSON?JSON.parse(this._attributes.layerListJSON):null,e=Object(h.q)(this._store.getState());return t?!s.a.isEqual(JSON.parse(JSON.stringify(e)),t):!s.a.isEqual(e,this._initialLayerListConfig)})),r()(this,"getAppNameFromId",(t=>this._getStateTransfer().getAppNameFromId(t))),this._defaultLayers=t,this._mapEmbeddableInput=e,this._embeddableId=n,this._onSaveCallback=i,this._originatingApp=o,this._originatingPath=l,this._stateTransfer=a,this._store=Object(c.a)(),this._defaultLayerWizard=u||""}getStore(){return this._store}async whenReady(){var t,e,n,i,r;if(await Object(b.g)(),this._mapEmbeddableInput){const{attributes:t,metaInfo:e}=await Object(f.a)().unwrapAttributes(this._mapEmbeddableInput),{references:n,...i}=t;this._attributes=i,null!=e&&e.sharingSavedObjectProps&&(this._sharingSavedObjectProps=e.sharingSavedObjectProps);const r=Object(g.G)();r&&n&&n.length&&(this._tags=r.ui.getTagIdsFromReferences(n))}else this._attributes={title:"",description:""};if(this._reportUsage(),null!==(t=this._attributes)&&void 0!==t&&t.mapStateJSON)try{const t=JSON.parse(this._attributes.mapStateJSON);if(t.adHocDataViews&&t.adHocDataViews.length>0){const e=Object(g.u)(),n=t.adHocDataViews.map((t=>e.create(t)));await Promise.all(n)}}catch(t){}if(this._mapEmbeddableInput&&void 0!==this._mapEmbeddableInput.mapSettings)this._store.dispatch(C(this._mapEmbeddableInput.mapSettings));else if(null!==(e=this._attributes)&&void 0!==e&&e.mapStateJSON)try{const t=JSON.parse(this._attributes.mapStateJSON);t.settings&&this._store.dispatch(C(t.settings))}catch(t){}let o=y.a;if(this._mapEmbeddableInput&&void 0!==this._mapEmbeddableInput.isLayerTOCOpen)o=this._mapEmbeddableInput.isLayerTOCOpen;else if(null!==(n=this._attributes)&&void 0!==n&&n.uiStateJSON)try{const t=JSON.parse(this._attributes.uiStateJSON);"isLayerTOCOpen"in t&&(o=t.isLayerTOCOpen)}catch(t){}this._store.dispatch(Object(d.eb)(o));let s=[];if(this._mapEmbeddableInput&&void 0!==this._mapEmbeddableInput.openTOCDetails)s=this._mapEmbeddableInput.openTOCDetails;else if(null!==(i=this._attributes)&&void 0!==i&&i.uiStateJSON)try{const t=JSON.parse(this._attributes.uiStateJSON);"openTOCDetails"in t&&(s=t.openTOCDetails)}catch(t){}if(this._store.dispatch(Object(d.nb)(s)),this._mapEmbeddableInput&&void 0!==this._mapEmbeddableInput.mapCenter)this._store.dispatch(Object(d.cb)({lat:this._mapEmbeddableInput.mapCenter.lat,lon:this._mapEmbeddableInput.mapCenter.lon,zoom:this._mapEmbeddableInput.mapCenter.zoom}));else if(null!==(r=this._attributes)&&void 0!==r&&r.mapStateJSON)try{const t=JSON.parse(this._attributes.mapStateJSON);this._store.dispatch(Object(d.cb)({lat:t.center.lat,lon:t.center.lon,zoom:t.zoom}))}catch(t){}let a=[];if(this._attributes.layerListJSON)try{a=JSON.parse(this._attributes.layerListJSON)}catch(t){throw new Error("Malformed saved object: unable to parse layerListJSON")}else{const t=Object(v.createBasemapLayerDescriptor)();t&&a.push(t),this._defaultLayers.length&&a.push(...this._defaultLayers)}this._store.dispatch(Object(d.T)(a)),this._mapEmbeddableInput&&void 0!==this._mapEmbeddableInput.hiddenLayers&&this._store.dispatch(Object(d.db)(this._mapEmbeddableInput.hiddenLayers)),this._initialLayerListConfig=Object(m.b)(a),this._defaultLayerWizard&&this._store.dispatch(Object(x.u)(this._defaultLayerWizard))}_getStateTransfer(){if(!this._stateTransfer)throw new Error("stateTransfer not provided in constructor");return this._stateTransfer}_getPageTitle(){return this._mapEmbeddableInput?this.isByValue()?l.i18n.translate("xpack.maps.breadcrumbsEditByValue",{defaultMessage:"Edit map"}):this._attributes.title:l.i18n.translate("xpack.maps.breadcrumbsCreate",{defaultMessage:"Create"})}_reportUsage(){const t=Object(g.T)();if(!t||!this._attributes)return;const e=new E.b(this._attributes),n=new E.a(this._attributes),i={layer:n.getLayerCounts(),scaling:n.getScalingCounts(),resolution:n.getResolutionCounts(),join:n.getJoinCounts(),ems_basemap:n.getBasemapCounts(),settings:{custom_icons_count:e.getCustomIconsCount()}};for(const[e,n]of Object.entries(i))for(const[i,r]of Object.entries(n))t.reportUiCounter(u.e,a.METRIC_TYPE.LOADED,`${e}_${i}`,r)}setBreadcrumbs(t){if(!this._attributes)throw new Error("Invalid usage, must await whenReady before calling hasUnsavedChanges");if(Object(g.K)())Object(g.K)().setBreadcrumbs({text:this._getPageTitle()});else{const e=Object(_.a)({pageTitle:this._getPageTitle(),isByValue:this.isByValue(),getHasUnsavedChanges:this.hasUnsavedChanges,originatingApp:this._originatingApp,getAppNameFromId:this._getStateTransfer().getAppNameFromId,history:t});Object(g.f)().setBreadcrumbs(e)}}getSavedObjectId(){return this._mapEmbeddableInput&&"savedObjectId"in this._mapEmbeddableInput?this._mapEmbeddableInput.savedObjectId:void 0}getOriginatingApp(){return this._originatingApp}getOriginatingAppName(){return this._originatingApp?this.getAppNameFromId(this._originatingApp):void 0}hasOriginatingApp(){return!!this._originatingApp}getOriginatingPath(){return this._originatingPath}getTags(){return this._tags}hasSaveAndReturnConfig(){const t=this.hasOriginatingApp(),e=!this.getSavedObjectId();return(Object(g.w)()||!e)&&t}getTitle(){if(!this._attributes)throw new Error("Invalid usage, must await getTitle before calling getAttributes");return void 0!==this._attributes.title?this._attributes.title:""}getAttributes(){if(!this._attributes)throw new Error("Invalid usage, must await whenReady before calling getAttributes");return this._attributes}getAutoFitToBounds(){var t,e;if(this._mapEmbeddableInput&&void 0!==(null===(t=this._mapEmbeddableInput)||void 0===t||null===(e=t.mapSettings)||void 0===e?void 0:e.autoFitToDataBounds))return this._mapEmbeddableInput.mapSettings.autoFitToDataBounds;if(!this._attributes||!this._attributes.mapStateJSON)return!1;try{const t=JSON.parse(this._attributes.mapStateJSON);if(void 0!==(null==t?void 0:t.settings.autoFitToDataBounds))return t.settings.autoFitToDataBounds}catch(t){}return!1}getSharingSavedObjectProps(){return this._sharingSavedObjectProps}isByValue(){const t=!!this.getSavedObjectId();return Object(g.w)()&&!!this._originatingApp&&!t}async save({newDescription:t,newTitle:e,newCopyOnSave:n,returnToOrigin:i,newTags:r,saveByReference:o,dashboardId:s,history:a}){if(!this._attributes)throw new Error("Invalid usage, must await whenReady before calling save");const c=this._attributes.title,h=this._attributes.description,d=this._tags;let p;this._attributes.title=e,this._attributes.description=t,r&&(this._tags=r),await this._syncAttributesWithStore();try{const t=Object(g.G)(),e=t&&r?{...this._attributes,references:t.ui.updateTagsReferences([],r)}:this._attributes;p=await Object(f.a)().wrapAttributes(e,o,n?void 0:this._mapEmbeddableInput)}catch(t){return this._attributes.title=c,this._attributes.description=h,void(this._tags=d)}if(i)return this._originatingApp?void await this._getStateTransfer().navigateToWithEmbeddablePackage(this._originatingApp,{state:{embeddableId:n?void 0:this._embeddableId,type:u.fb,input:p},path:this._originatingPath}):void Object(g.Q)().addDanger({title:l.i18n.translate("xpack.maps.topNav.saveErrorTitle",{defaultMessage:"Error saving '{title}'",values:{title:e}}),text:l.i18n.translate("xpack.maps.topNav.saveErrorText",{defaultMessage:"Unable to return to app without an originating app"})});s?await this._getStateTransfer().navigateToWithEmbeddablePackage("dashboards",{state:{type:u.fb,input:p},path:"new"===s?"#/create":`#/view/${s}`}):(this._mapEmbeddableInput=p,this._originatingApp=void 0,this._getStateTransfer().clearEditorState(u.e),Object(g.Q)().addSuccess({title:l.i18n.translate("xpack.maps.topNav.saveSuccessMessage",{defaultMessage:"Saved '{title}'",values:{title:e}})}),Object(g.f)().docTitle.change(e),this.setBreadcrumbs(a),a.push(`/${u.eb}/${this.getSavedObjectId()}${window.location.hash}`),this._onSaveCallback&&this._onSaveCallback())}async _syncAttributesWithStore(){const e=this._store.getState(),n=Object(h.r)(e),i=Object(m.b)(n);this._attributes.layerListJSON=JSON.stringify(i);const r=Object(h.y)(e);this._attributes.mapStateJSON=JSON.stringify({adHocDataViews:await this._getAdHocDataViews(),zoom:Object(h.z)(e),center:Object(h.t)(e),timeFilters:Object(h.K)(e),refreshConfig:{isPaused:Object(g.P)().getRefreshInterval().pause,interval:Object(g.P)().getRefreshInterval().value},query:Object(h.C)(e),filters:Object(h.i)(e),settings:{...r,customIcons:r.customIcons.map((e=>({...e,svg:t.from(e.svg).toString("base64")})))}}),this._attributes.uiStateJSON=JSON.stringify({isLayerTOCOpen:Object(p.f)(e),openTOCDetails:Object(p.i)(e)})}async _getAdHocDataViews(){const t=[];return Object(h.p)(this._store.getState()).forEach((e=>{t.push(...e.getIndexPatternIds())})),(await Object(S.e)(s.a.uniq(t))).filter((t=>!t.isPersisted())).map((t=>t.toSpec(!1)))}}}).call(this,n(141).Buffer)},283:function(t,e,n){"use strict";n.d(e,"a",(function(){return WmsClient}));var i=n(39),r=n.n(i),o=n(265),s=n(284),a=n.n(s),l=n(186);class WmsClient{constructor({serviceUrl:t}){this._serviceUrl=t}async _fetch(t){return a()(t)}_createUrl(t){const e=Object(l.parse)(this._serviceUrl,!0),n={...e.query,...t};return Object(l.format)({protocol:e.protocol,hostname:e.hostname,port:e.port,pathname:e.pathname,query:n})}getUrlTemplate(t,e){return`${this._createUrl({format:"image/png",service:"WMS",version:"1.1.1",request:"GetMap",srs:"EPSG:3857",transparent:"true",width:"256",height:"256",layers:t,styles:e})}&bbox={bbox-epsg-3857}`}async _fetchCapabilities(){const t=Object(l.parse)(this._serviceUrl,!0),e={...t.query,version:"1.1.1",request:"GetCapabilities",service:"WMS"},n=await this._fetch(Object(l.format)({protocol:t.protocol,hostname:t.hostname,port:t.port,pathname:t.pathname,query:e}));if(n.status>=400)throw new Error(`Unable to access ${this.state.serviceUrl}`);const i=await n.text();return await Object(o.a)(i)}async getCapabilities(){const t=await this._fetchCapabilities(),{layers:e,styles:n}=u([],r.a.get(t,"WMT_MS_Capabilities.Capability[0].Layer",[]));return{layers:c(e),styles:c(n)}}}function u(t,e){function n(t,e,n){return{path:[...t,e],value:n}}return e.reduce(((e,i)=>{if(i.Layer){const n=u([...t,i.Title[0]],i.Layer);return{layers:[...e.layers,...n.layers],styles:[...e.styles,...n.styles]}}const o=[...e.styles];return r.a.has(i,"Style[0]")&&o.push(n(t,r.a.get(i,"Style[0].Title[0]",""),r.a.get(i,"Style[0].Name[0]",""))),{layers:[...e.layers,n(t,r.a.get(i,"Title[0]",""),r.a.get(i,"Name[0]",""))],styles:o}}),{layers:[],styles:[]})}function c(t){if(0===t.length)return[];let e=0;t.forEach((({path:t})=>{t.length>e&&(e=t.length)}));let n=t[0].path;for(let e=1;e{const r=t[t.length-1],o=n.length===t.length?r:t.splice(n.length).join(" - "),s=r===e?o:`${o} (${e})`;let a;if(i.has(s)){const t=i.get(s)+1;i.set(s,t),a=`${s}:${t}`}else i.set(s,0),a=s;return{label:a,value:e}}));return 0===n.length||n.length===e?r:[{label:n.join(" - "),options:r}]}},284:function(t,e,n){"use strict";(function(n){var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();t.exports=e=i.fetch,i.fetch&&(e.default=i.fetch.bind(n)),e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response}).call(this,n(93))},285:function(t,e,n){"use strict";n.d(e,"a",(function(){return l}));var i=n(0),r=n(5),o=n(13),s=n(172);let a=null;function l(){return a||(a=Object(r.m)().getAttributeService(i.fb,{saveMethod:async(t,e)=>{const n=t.references,i={...t};delete i.references;const{attributes:r,references:a}=Object(o.a)({attributes:i,references:n}),{item:{id:l}}=await(e?s.b.update({id:e,data:r,options:{references:a}}):s.b.create({data:r,options:{references:a}}));return{id:l}},unwrapMethod:async t=>{const{item:e,meta:{outcome:n,aliasPurpose:i,aliasTargetId:r}}=await s.b.get(t);if(e.error)throw e.error;const{attributes:a}=Object(o.b)(e);return{attributes:{...a,references:e.references},metaInfo:{sharingSavedObjectProps:{aliasTargetId:r,outcome:n,aliasPurpose:i,sourceId:t}}}},checkForDuplicateTitle:t=>Object(s.a)({title:t.newTitle,copyOnSave:!1,lastSavedTitle:"",isTitleDuplicateConfirmed:t.isTitleDuplicateConfirmed,getDisplayName:()=>i.db,onTitleDuplicate:t.onTitleDuplicate},{overlays:Object(r.h)()})}),a)}},286:function(t,e,n){t.exports=n(22)(2965)},287:function(t,e,n){"use strict";e.__esModule=!0,e.setBatch=e.getBatch=void 0;var i=function(t){t()};e.setBatch=function(t){return i=t},e.getBatch=function(){return i}},288:function(t,e,n){"use strict";var i=n(96).default,r=n(286).default;e.__esModule=!0,e.default=function(t,e){void 0===e&&(e={});var n=e,i=n.getDisplayName,r=void 0===i?function(t){return"ConnectAdvanced("+t+")"}:i,h=n.methodName,E=void 0===h?"connectAdvanced":h,S=n.renderCountProp,C=void 0===S?void 0:S,I=n.shouldHandleStateChanges,O=void 0===I||I,w=n.storeKey,L=void 0===w?"store":w,T=(n.withRef,n.forwardRef),N=void 0!==T&&T,j=n.context,M=void 0===j?d.ReactReduxContext:j,P=(0,s.default)(n,p),F=M;return function(e){var n=e.displayName||e.name||"Component",i=r(n),h=(0,o.default)({},P,{getDisplayName:r,methodName:E,renderCountProp:C,shouldHandleStateChanges:O,storeKey:L,displayName:i,wrappedComponentName:n,WrappedComponent:e}),d=P.pure,p=d?l.useMemo:function(t){return t()};function S(n){var i=(0,l.useMemo)((function(){var t=n.reactReduxForwardedRef,e=(0,s.default)(n,f);return[n.context,t,e]}),[n]),r=i[0],a=i[1],d=i[2],E=(0,l.useMemo)((function(){return r&&r.Consumer&&(0,u.isContextConsumer)(l.default.createElement(r.Consumer,null))?r:F}),[r,F]),S=(0,l.useContext)(E),C=Boolean(n.store)&&Boolean(n.store.getState)&&Boolean(n.store.dispatch);Boolean(S)&&Boolean(S.store);var I=C?n.store:S.store,w=(0,l.useMemo)((function(){return function(e){return t(e.dispatch,h)}(I)}),[I]),L=(0,l.useMemo)((function(){if(!O)return m;var t=(0,c.createSubscription)(I,C?null:S.subscription),e=t.notifyNestedSubs.bind(t);return[t,e]}),[I,C,S]),T=L[0],N=L[1],j=(0,l.useMemo)((function(){return C?S:(0,o.default)({},S,{subscription:T})}),[C,S,T]),M=(0,l.useReducer)(_,g,x),P=M[0][0],R=M[1];if(P&&P.error)throw P.error;var A=(0,l.useRef)(),D=(0,l.useRef)(d),k=(0,l.useRef)(),B=(0,l.useRef)(!1),G=p((function(){return k.current&&d===D.current?k.current:w(I.getState(),d)}),[I,P,d]);y(v,[D,A,B,d,G,k,N]),y(b,[O,I,T,w,D,A,B,k,N,R],[I,T,w]);var z=(0,l.useMemo)((function(){return l.default.createElement(e,(0,o.default)({},G,{ref:a}))}),[a,e,G]);return(0,l.useMemo)((function(){return O?l.default.createElement(E.Provider,{value:j},z):z}),[E,z,j])}var I=d?l.default.memo(S):S;if(I.WrappedComponent=e,I.displayName=S.displayName=i,N){var w=l.default.forwardRef((function(t,e){return l.default.createElement(I,(0,o.default)({},t,{reactReduxForwardedRef:e}))}));return w.displayName=i,w.WrappedComponent=e,(0,a.default)(w,e)}return(0,a.default)(I,e)}};var o=i(n(23)),s=i(n(223)),a=i(n(488)),l=r(n(4)),u=n(489),c=n(221),h=n(222),d=n(119),p=["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"],f=["reactReduxForwardedRef"],g=[],m=[null,null];function _(t,e){var n=t[1];return[e.payload,n+1]}function y(t,e,n){(0,h.useIsomorphicLayoutEffect)((function(){return t.apply(void 0,e)}),n)}function v(t,e,n,i,r,o,s){t.current=i,e.current=r,n.current=!1,o.current&&(o.current=null,s())}function b(t,e,n,i,r,o,s,a,l,u){if(t){var c=!1,h=null,d=function(){if(!c){var t,n,d=e.getState();try{t=i(d,r.current)}catch(t){n=t,h=t}n||(h=null),t===o.current?s.current||l():(o.current=t,a.current=t,s.current=!0,u({type:"STORE_UPDATED",payload:{error:n}}))}};return n.onStateChange=d,n.trySubscribe(),d(),function(){if(c=!0,n.tryUnsubscribe(),n.onStateChange=null,h)throw h}}}var x=function(){return[null,0]}},289:function(t,e,n){"use strict";function i(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}e.__esModule=!0,e.default=function(t,e){if(i(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0;o{const e=Object(o.z)(t),n=Object(o.p)(t).map((async t=>({isFilteredByGlobalTime:await t.isFilteredByGlobalTime(),layer:t,zoom:e})));return await Promise.all(n)})),Object(r.first)((t=>!t.filter((({isFilteredByGlobalTime:t})=>t)).some((({layer:t,zoom:e})=>t.isLayerLoading(e))))),Object(r.map)((()=>{})))}},297:function(t,e,n){"use strict";n.d(e,"a",(function(){return _n}));var i=n(71),r=n(23),o=n.n(r),s=n(2),a=n.n(s),l=(n(501),n(4)),u=n.n(l),c=n(42),h=n.n(c),d=n(14),p=n(1),f=n(41),g=n(303),m=n(39),_=n.n(m),y=n(506),v=n(268),b=n(15),x=n(0),E=n(76),S=n(5),C=n(507),I=n.n(C),O=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}],w=n(508),L=n.n(w),T=n(218),N=n.n(T),j=n(272),M=n.n(j);const P="draw-circle-radius",F={id:"gl-draw-radius-label",type:"symbol",filter:["==","meta",P],layout:{"text-anchor":"right","text-field":"{radiusLabel}","text-size":16,"text-offset":[-1,0],"text-ignore-placement":!0,"text-allow-overlap":!0},paint:{"text-color":"#fbb03b","text-halo-color":"rgba(0, 0, 0, 1)","text-halo-width":2}},R={onSetup(){const t=this.newFeature({type:"Feature",properties:{center:null,edge:null,radiusKm:0},geometry:{type:"Polygon",coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{circle:t}},onKeyUp(t,e){27===e.keyCode&&(t.circle.properties.center=null,t.circle.properties.radiusKm=0,t.circle.incomingCoords([[]]))},onClick(t,e){t.circle.properties.center?(this.updateUIClasses({mouse:"pointer"}),t.circle.properties.radiusKm=N()(t.circle.properties.center,[e.lngLat.lng,e.lngLat.lat]),this.changeMode("simple_select",{featuresId:t.circle.id})):t.circle.properties.center=[e.lngLat.lng,e.lngLat.lat]},onMouseMove(t,e){if(!t.circle.properties.center)return;const n=[e.lngLat.lng,e.lngLat.lat];t.circle.properties.edge=n,t.circle.properties.radiusKm=N()(t.circle.properties.center,n);const i=M()(t.circle.properties.center,t.circle.properties.radiusKm);t.circle.incomingCoords(i.geometry.coordinates)},onStop(t){this.updateUIClasses({mouse:"none"}),this.activateUIButton(),void 0!==this.getFeature(t.circle.id)&&(t.circle.properties.center&&t.circle.properties.radiusKm>0?this.map.fire("draw.create",{features:[t.circle.toGeoJSON()]}):(this.deleteFeature([t.circle.id],{silent:!0}),this.changeMode("simple_select",{},{silent:!0})))},toDisplayFeatures(t,e,n){if(!t.circle.properties.center||!t.circle.properties.edge)return null;e.properties.active="true";let i="";i=t.circle.properties.radiusKm<=1?`${Math.round(1e3*t.circle.properties.radiusKm)} m`:t.circle.properties.radiusKm<=10?`${t.circle.properties.radiusKm.toFixed(1)} km`:`${Math.round(t.circle.properties.radiusKm)} km`,n({type:"Feature",properties:{meta:P,parent:t.circle.id,radiusLabel:i,active:"false"},geometry:{type:"Point",coordinates:t.circle.properties.edge}}),n({type:"Feature",properties:{meta:"draw-circle-radius-line",parent:t.circle.id,active:"true"},geometry:{type:"LineString",coordinates:[t.circle.properties.center,t.circle.properties.edge]}}),n(e)},onTrash(t){this.deleteFeature([t.circle.id],{silent:!0}),this.changeMode("simple_select")}};var A=n(3);const D=()=>{};class draw_tooltip_DrawTooltip extends l.Component{constructor(...t){super(...t),a()(this,"_popoverRef",u.a.createRef()),a()(this,"_isMounted",!1),a()(this,"state",{x:void 0,y:void 0,isOpen:!1}),a()(this,"_hideTooltip",(()=>{this._updateTooltipLocation.cancel(),this.setState({isOpen:!1})})),a()(this,"_updateTooltipLocation",_.a.throttle((({lngLat:t})=>{const e=this.props.mbMap.project(t);this._isMounted&&this.setState({isOpen:!0,x:e.x,y:e.y})}),100))}componentDidMount(){this._isMounted=!0,this.props.mbMap.on("mousemove",this._updateTooltipLocation),this.props.mbMap.on("mouseout",this._hideTooltip)}componentDidUpdate(){this._popoverRef.current&&this._popoverRef.current.positionPopoverFluid()}componentWillUnmount(){this._isMounted=!1,this.props.mbMap.off("mousemove",this._updateTooltipLocation),this.props.mbMap.off("mouseout",this._hideTooltip),this._updateTooltipLocation.cancel()}render(){if(void 0===this.state.x||void 0===this.state.y)return null;let t;if(this.props.drawShape===x.y.BOUNDS)t=p.i18n.translate("xpack.maps.drawTooltip.boundsInstructions",{defaultMessage:"Click to start rectangle. Move mouse to adjust rectangle size. Click again to finish."});else if(this.props.drawShape===x.y.DISTANCE)t=p.i18n.translate("xpack.maps.drawTooltip.distanceInstructions",{defaultMessage:"Click to set point. Move mouse to adjust distance. Click to finish."});else if(this.props.drawShape===x.y.POLYGON)t=p.i18n.translate("xpack.maps.drawTooltip.polygonInstructions",{defaultMessage:"Click to start shape. Click to add vertex. Double click to finish."});else if(this.props.drawShape===x.y.LINE)t=p.i18n.translate("xpack.maps.drawTooltip.lineInstructions",{defaultMessage:"Click to start line. Click to add vertex. Double click to finish."});else if(this.props.drawShape===x.y.POINT)t=p.i18n.translate("xpack.maps.drawTooltip.pointInstructions",{defaultMessage:"Click to create point."});else{if(this.props.drawShape!==x.y.DELETE)return null;t=p.i18n.translate("xpack.maps.drawTooltip.deleteInstructions",{defaultMessage:"Click feature to delete."})}const e=Object(A.jsx)("div",{style:{height:"26px",width:"26px",background:"transparent"}});return Object(A.jsx)(d.EuiPopover,{id:"drawInstructionsTooltip",button:e,anchorPosition:"rightCenter",isOpen:this.state.isOpen,closePopover:D,ref:this._popoverRef,style:{pointerEvents:"none",transform:`translate(${this.state.x-13}px, ${this.state.y-13}px)`}},Object(A.jsx)(d.EuiText,{color:"subdued",size:"xs"},t))}}const k="draw_rectangle",B="draw_circle",G=I.a.modes;G[k]=L.a,G[B]=R;class draw_control_DrawControl extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"_isMapRemoved",!1),a()(this,"_mbDrawControlAdded",!1),a()(this,"_mbDrawControl",new I.a({displayControlsDefault:!1,modes:G,styles:[...O,F]})),a()(this,"_setIsMapRemoved",(()=>{this._isMapRemoved=!0})),a()(this,"_onDraw",(t=>{this.props.onDraw(t,this._mbDrawControl)})),a()(this,"_onClick",(t=>{this.props.onClick&&this.props.onClick(t,this._mbDrawControl)})),a()(this,"_syncDrawControl",_.a.debounce((()=>{this._isMounted&&(this.props.enable?this._updateDrawControl():this._removeDrawControl())}),0))}componentDidUpdate(){this._syncDrawControl()}componentDidMount(){this._isMounted=!0,this.props.mbMap.on("remove",this._setIsMapRemoved),this._syncDrawControl()}componentWillUnmount(){this._isMounted=!1,this.props.mbMap.off("remove",this._setIsMapRemoved),this._removeDrawControl()}_removeDrawControl(){this._mbDrawControlAdded&&!this._isMapRemoved&&(this.props.mbMap.getCanvas().style.cursor="",this.props.mbMap.off("draw.create",this._onDraw),this.props.onClick&&this.props.mbMap.off("click",this._onClick),this.props.mbMap.removeControl(this._mbDrawControl),this._mbDrawControlAdded=!1)}_updateDrawControl(){this._mbDrawControlAdded||(this.props.mbMap.addControl(this._mbDrawControl),this._mbDrawControlAdded=!0,this.props.mbMap.on("draw.create",this._onDraw),this.props.onClick&&this.props.mbMap.on("click",this._onClick)),this.props.mbMap.getCanvas().style.cursor=this.props.drawShape&&this.props.drawShape!==x.y.SIMPLE_SELECT?"crosshair":"";const{DRAW_LINE_STRING:t,DRAW_POLYGON:e,DRAW_POINT:n,SIMPLE_SELECT:i}=this._mbDrawControl.modes,r=this._mbDrawControl.getMode();r!==k&&this.props.drawShape===x.y.BOUNDS?this._mbDrawControl.changeMode(k):r!==B&&this.props.drawShape===x.y.DISTANCE?this._mbDrawControl.changeMode(B):r!==e&&this.props.drawShape===x.y.POLYGON?this._mbDrawControl.changeMode(e):r!==t&&this.props.drawShape===x.y.LINE?this._mbDrawControl.changeMode(t):r!==n&&this.props.drawShape===x.y.POINT?this._mbDrawControl.changeMode(n):this.props.drawShape===x.y.DELETE?this._mbDrawControl.changeMode(i):this.props.drawShape===x.y.WAIT?(this.props.mbMap.getCanvas().style.cursor="wait",this._mbDrawControl.changeMode(i)):(r!==i&&!this.props.drawShape||this.props.drawShape===x.y.SIMPLE_SELECT)&&this._mbDrawControl.changeMode(i)}render(){return this.props.drawShape?Object(A.jsx)(draw_tooltip_DrawTooltip,{mbMap:this.props.mbMap,drawShape:this.props.drawShape}):null}}class draw_filter_control_DrawFilterControl extends l.Component{constructor(...t){super(...t),a()(this,"_onDraw",(async t=>{if(!t.features.length||!this.props.drawState||!this.props.geoFieldNames.length)return;let e;if(this.props.drawState.drawShape===x.y.DISTANCE){const n=t.features[0],i=_.a.round(n.properties.radiusKm,n.properties.radiusKm>10?0:2);let r=2;i<=1?r=5:i<=10?r=4:i<=100&&(r=3),e=Object(E.g)({alias:this.props.drawState.filterLabel?this.props.drawState.filterLabel:"",distanceKm:i,geoFieldNames:this.props.geoFieldNames,point:[_.a.round(n.properties.center[0],r),_.a.round(n.properties.center[1],r)]})}else{const n=t.features[0].geometry;Object(E.p)(n.coordinates),e=Object(E.c)({geometry:this.props.drawState.drawShape===x.y.BOUNDS?Object(E.k)(n):n,geoFieldNames:this.props.geoFieldNames,geometryLabel:this.props.drawState.geometryLabel?this.props.drawState.geometryLabel:"",relation:this.props.drawState.relation?this.props.drawState.relation:"intersects"})}try{await this.props.addFilters([e],this.props.drawState.actionId)}catch(t){Object(S.Q)().addWarning(p.i18n.translate("xpack.maps.drawFilterControl.unableToCreatFilter",{defaultMessage:"Unable to create filter, error: '{errorMsg}'.",values:{errorMsg:t.message}}))}finally{this.props.disableDrawState()}}))}render(){return Object(A.jsx)(draw_control_DrawControl,{drawShape:this.props.filterModeActive&&this.props.drawState?this.props.drawState.drawShape:void 0,onDraw:this._onDraw,mbMap:this.props.mbMap,enable:this.props.filterModeActive})}}var z=n(73),V=n(70),U=n(77);const q=Object(i.connect)((function(t){return{drawState:Object(V.e)(t),filterModeActive:Object(U.c)(t)===x.x.DRAW_FILTERS,geoFieldNames:Object(V.j)(t)}}),(function(t){return{disableDrawState(){t(Object(z.yb)(null)),t(Object(z.X)(x.x.NONE))}}}))(draw_filter_control_DrawFilterControl);class scale_control_ScaleControl extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"state",{label:"",width:0}),a()(this,"_onUpdate",(()=>{if(!this._isMounted)return;const t=this.props.mbMap.getContainer().clientHeight/2,e=this.props.mbMap.unproject([0,t]),n=this.props.mbMap.unproject([110,t]),i=e.distanceTo(n);i>=1e3?this._setScale(i/1e3,p.i18n.translate("xpack.maps.kilometersAbbr",{defaultMessage:"km"})):this._setScale(i,p.i18n.translate("xpack.maps.metersAbbr",{defaultMessage:"m"}))}))}componentDidMount(){this._isMounted=!0,this.props.mbMap.on("move",this._onUpdate),this._onUpdate()}componentWillUnmount(){this._isMounted=!1,this.props.mbMap.off("move",this._onUpdate)}_setScale(t,e){const n=function(t){const e=Math.floor(Math.log10(t)),n=Math.pow(10,e),i=t/n;return i<1?n*(Math.round(10*i)/10):i>=10?10*n:i>=5?5*n:i>=3?3*n:Math.floor(i)*n}(t),i=this.props.mbMap.getZoom(),r=this.props.mbMap.getBounds();let o=`${n} ${e}`;(i<=4||i<=6&&(r.getNorth()>23.5||r.getSouth()<-23.5)||i<=8&&(r.getNorth()>45||r.getSouth()<-45))&&(o="~"+o),this.setState({width:n/t*110,label:o})}render(){return Object(A.jsx)("div",{className:h()("mapScaleControl",{mapScaleControlFullScreen:this.props.isFullScreen}),style:{width:`${this.state.width}px`}},this.state.label)}}var Y=n(232);const W=()=>{};class tooltip_popover_TooltipPopover extends l.Component{constructor(...t){super(...t),a()(this,"_popoverRef",u.a.createRef()),a()(this,"state",{}),a()(this,"_updatePopoverPosition",(()=>{const t=this.props.mbMap.project(this.props.location),e=this.props.location[x.X],n=this.props.location[x.bb],i=this.props.mbMap.getBounds();ei.getSouth()&&n>i.getWest()&&n{const n=this.props.findLayerById(t);return n?await n.getPropertiesForTooltip(e,this.props.executionContext):[]})),a()(this,"_getLayerName",(async t=>{const e=this.props.findLayerById(t);return e?e.getDisplayName():null})),a()(this,"_renderTooltipContent",(()=>{const t={addFilters:this.props.addFilters,getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,onSingleValueTrigger:this.props.onSingleValueTrigger,closeTooltip:this.props.closeTooltip,features:this.props.features,isLocked:this.props.isLocked,loadFeatureProperties:this._loadFeatureProperties,loadFeatureGeometry:this.props.loadFeatureGeometry,getLayerName:this._getLayerName};return this.props.renderTooltipContent?this.props.renderTooltipContent(t):Object(A.jsx)(d.EuiText,{size:"xs",style:{maxWidth:"425px"}},Object(A.jsx)(Y.b,o()({},t,{findLayerById:this.props.findLayerById})))}))}componentDidMount(){this._updatePopoverPosition(),this.props.mbMap.on("move",this._updatePopoverPosition)}componentDidUpdate(){this._popoverRef.current&&this._popoverRef.current.positionPopoverFluid()}componentWillUnmount(){this.props.mbMap.off("move",this._updatePopoverPosition)}render(){if(void 0===this.state.x||void 0===this.state.y)return null;const t=Object(A.jsx)("div",{style:{height:"26px",width:"26px",background:"none"}}),e=26*this.props.index;return Object(A.jsx)(d.EuiPopover,{id:"mapTooltip",button:t,anchorPosition:"upCenter",isOpen:!0,closePopover:W,ref:this._popoverRef,style:{pointerEvents:"none",transform:`translate(${this.state.x-13-e}px, ${this.state.y-13}px)`},repositionOnScroll:!0},this._renderTooltipContent())}}var H=n(72);function X(t,e){let n=[t.lng,t.lat];if("Point"===e.geometry.type){const i=e.geometry.coordinates.slice();for(;Math.abs(t.lng-i[x.bb])>180;)i[0]+=t.lng>i[x.bb]?360:-360;n=i}return n}class tooltip_control_TooltipControl extends l.Component{constructor(...t){super(...t),a()(this,"_isMapRemoved",!1),a()(this,"_setIsMapRemoved",(()=>{this._isMapRemoved=!0})),a()(this,"_onSourceData",(t=>{!t.sourceId||t.sourceId===x.Bb||"source"!==t.dataType||"vector"!==t.source.type&&"geojson"!==t.source.type||this._updateOpentooltips()})),a()(this,"_updateOpentooltips",_.a.debounce((()=>{if(0===this.props.openTooltips.length)return;const t=this.props.openTooltips.map((t=>{const e=this._getMbFeaturesUnderPointer(this.props.mbMap.project(t.location));return{...t,features:this._getTooltipFeatures(e,t.isLocked,t.id)}})).filter((t=>t.features.length>0));this.props.updateOpenTooltips(t)}),300)),a()(this,"_onMouseout",(()=>{this._updateHoverTooltipState.cancel(),this.props.hasLockedTooltips||this.props.closeOnHoverTooltip()})),a()(this,"_findLayerById",(t=>this.props.layerList.find((e=>e.getId()===t&&Object(H.e)(e))))),a()(this,"_getFeatureGeometry",(({layerId:t,featureId:e})=>{const n=this._findLayerById(t);if(!n||void 0===e)return null;const i=n.getFeatureById(e);return i?i.geometry:null})),a()(this,"_lockTooltip",(t=>{if(this.props.filterModeActive||this.props.drawModeActive)return;this._updateHoverTooltipState.cancel();const e=this._getMbFeaturesUnderPointer(t.point);if(!e.length)return;const n=e[0],i=X(t.lngLat,n),r=Object(f.v4)(),o=this._getTooltipFeatures(e,!0,r);0!==o.length&&this.props.openOnClickTooltip({features:o,location:i,isLocked:!0,id:r})})),a()(this,"_updateHoverTooltipState",_.a.debounce((t=>{if(this._isMapRemoved)return;if(this.props.filterModeActive||this.props.hasLockedTooltips||this.props.drawModeActive)return;const e=this._getMbFeaturesUnderPointer(t.point);if(!e.length)return void this.props.closeOnHoverTooltip();const n=e[0],i=this._getLayerByMbLayerId(n.layer.id);if(i&&this.props.openTooltips[0]&&this.props.openTooltips[0].features.length){const t=this.props.openTooltips[0].features[0];if(i.getFeatureId(n)===t.id)return}const r=X(t.lngLat,n),o=Object(f.v4)(),s=this._getTooltipFeatures(e,!1,o);0!==s.length&&this.props.openOnHoverTooltip({features:s,location:r,isLocked:!1,id:o})}),100))}componentDidMount(){this.props.mbMap.on("mouseout",this._onMouseout),this.props.mbMap.on("mousemove",this._updateHoverTooltipState),this.props.mbMap.on("click",this._lockTooltip),this.props.mbMap.on("remove",this._setIsMapRemoved),this.props.mbMap.on("sourcedata",this._onSourceData)}componentWillUnmount(){this.props.mbMap.off("mouseout",this._onMouseout),this.props.mbMap.off("mousemove",this._updateHoverTooltipState),this.props.mbMap.off("click",this._lockTooltip),this.props.mbMap.off("remove",this._setIsMapRemoved),this.props.mbMap.off("sourcedata",this._onSourceData)}_getLayerByMbLayerId(t){return this.props.layerList.find((e=>{const n=e.getMbLayerIds();return Object(H.e)(e)&&n.indexOf(t)>-1}))}_getTooltipFeatures(t,e,n){const i=[];for(let r=0;rt.isFeatureMasked(o))))continue;const a=s.getFeatureId(o);if(void 0===a)continue;const l=s.getId();let u=!1;for(let t=0;t{const t=s.getFeatureById(a);return t?t.geometry:null},mbFeature:o,onClose:()=>{this.props.closeOnClickTooltip(n)}}):[];(e&&r.length||s.canShowTooltip())&&i.push({id:a,layerId:l,mbProperties:t,actions:r})}}return i}_getMbLayerIdsForTooltips(){return this.props.layerList.reduce(((t,e)=>e.isVisible()&&Object(H.e)(e)?t.concat(e.getMbTooltipLayerIds()):t),[]).filter((t=>!!this.props.mbMap.getLayer(t)))}_getMbFeaturesUnderPointer(t){if(!this.props.mbMap)return[];const e=this._getMbLayerIdsForTooltips(),n=[{x:t.x-2,y:t.y-2},{x:t.x+2,y:t.y+2}];return this.props.mbMap.queryRenderedFeatures(n,{layers:e})}render(){return 0===this.props.openTooltips.length?null:this.props.openTooltips.map((({features:t,location:e,id:n,isLocked:i},r)=>{const o=i?()=>{this.props.closeOnClickTooltip(n)}:this.props.closeOnHoverTooltip;return Object(A.jsx)(tooltip_popover_TooltipPopover,{key:n,mbMap:this.props.mbMap,findLayerById:this._findLayerById,addFilters:this.props.addFilters,getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,onSingleValueTrigger:this.props.onSingleValueTrigger,renderTooltipContent:this.props.renderTooltipContent,features:t,location:e,closeTooltip:o,isLocked:i,index:r,loadFeatureGeometry:this._getFeatureGeometry,executionContext:this.props.executionContext})}))}}const J=Object(i.connect)((function(t){return{layerList:Object(V.p)(t),hasLockedTooltips:Object(V.l)(t),filterModeActive:Object(U.c)(t)===x.x.DRAW_FILTERS,drawModeActive:Object(U.c)(t)===x.x.DRAW_SHAPES||Object(U.c)(t)===x.x.DRAW_POINTS,openTooltips:Object(V.B)(t),geoFieldNames:Object(V.j)(t),executionContext:Object(V.h)(t)}}),(function(t){return{closeOnClickTooltip(e){t(Object(z.t)(e))},openOnClickTooltip(e){t(Object(z.L)(e))},closeOnHoverTooltip(){t(Object(z.u)())},openOnHoverTooltip(e){t(Object(z.M)(e))},updateOpenTooltips(e){t(Object(z.Nb)(e))}}}))(tooltip_control_TooltipControl);var Z=n(284),K=n.n(Z);let Q,$=null;function tt(){return Object(S.r)().basePath.prepend(`${x.E}/{fontstack}/{range}`)}function et(t){return t.startsWith("gl-draw")}function nt(t,e,n){if(!t.ownsMbLayerId(e.id))return!1;if(n===it.ANY)return!0;const i=function(t){if("symbol"!==t.type)return!1;const e=[];return t.paint&&e.push(...Object.keys(t.paint)),t.layout&&e.push(...Object.keys(t.layout)),e.some((t=>t.startsWith("text-")))}(e);return n===it.LABEL?i:!i}var it;function rt(t,e,n,i,r){e.filter((t=>nt(n,t,i))).forEach((e=>{t.moveLayer(e.id,r)}))}function ot(t,e,n){const i=t.find((t=>nt(e,t,n)));return i?i.id:void 0}function st(t,e,n,i){const r=t.getStyle().layers;if(!i)return nt(e,r[r.length-1],n);let o=!1,s=null;for(let t=0;t{if(t.sourceId&&t.sourceId!==x.Bb&&"source"===t.dataType&&t.tile&&("vector"===t.source.type||"raster"===t.source.type)){const e=this.props.layerList.find((e=>e.ownsMbSourceId(t.sourceId))),n=e?e.getId():void 0;n&&!this._layerCache.has(n)&&this._layerCache.set(n,!0),this._tileCache.find((e=>e.mbKey===t.tile.tileID.key&&e.mbSourceId===t.sourceId))||(this._tileCache.push({mbKey:t.tile.tileID.key,mbSourceId:t.sourceId,mbTile:t.tile}),this._updateTileStatusForAllLayers())}})),a()(this,"_onError",(t=>{if(t.sourceId&&t.sourceId!==x.Bb&&t.tile&&("vector"===t.source.type||"raster"===t.source.type)){const e=this.props.layerList.find((e=>e.ownsMbSourceId(t.sourceId))),n=e?e.getId():void 0;if(n){const e=this._tileErrorCache[n]?this._tileErrorCache[n]:[];e.push({...t.error,tileZXYKey:`${t.tile.tileID.canonical.z}/${t.tile.tileID.canonical.x}/${t.tile.tileID.canonical.y}`}),this._tileErrorCache[n]=e}this._removeTileFromCache(t.sourceId,t.tile.tileID.key)}})),a()(this,"_onSourceData",(t=>{t.sourceId&&t.sourceId!==x.Bb&&"source"===t.dataType&&t.tile&&("vector"===t.source.type||"raster"===t.source.type)&&this._removeTileFromCache(t.sourceId,t.tile.tileID.key)})),a()(this,"_onMove",(()=>{const t=this.props.mbMap.getCenter(),e=Object(at.c)(t.lat,t.lng,Math.floor(this.props.mbMap.getZoom()));this._prevCenterTileKey!==e&&(this._prevCenterTileKey=e,this._tileErrorCache={})})),a()(this,"_updateTileStatusForAllLayers",_.a.debounce((()=>{if(!this._isMounted)return;this._tileCache=this._tileCache.filter((t=>"boolean"!=typeof t.mbTile.aborted||!t.mbTile.aborted));const t=this.props.layerList;for(let e=0;ep.i18n.translate("xpack.maps.tileStatusTracker.tileErrorMsg",{defaultMessage:"tile '{tileZXYKey}' failed to load: '{status} {message}'",values:{tileZXYKey:t.tileZXYKey,status:t.status,message:t.message}}))):[];this._updateTileStatusForLayer(n,!i,r.length?p.i18n.translate("xpack.maps.tileStatusTracker.layerErrorMsg",{defaultMessage:"Unable to load {count} tiles: {tileErrors}",values:{count:r.length,tileErrors:r.join(", ")}}):void 0)}}),100)),a()(this,"_updateTileStatusForLayer",((t,e,n)=>{this.props.setAreTilesLoaded(t.getId(),e),n?this.props.setTileLoadError(t.getId(),n):this.props.clearTileLoadError(t.getId());const i=t.getSource();if(t.isVisible()&&i.isESSource()&&"function"==typeof i.isMvt&&i.isMvt()){const e=this.props.mbMap.querySourceFeatures(t.getMbSourceId(),{sourceLayer:lt.c}).map((t=>{try{return{type:"Feature",id:null==t?void 0:t.id,geometry:null==t?void 0:t.geometry,properties:null==t?void 0:t.properties}}catch(t){return null}})).filter((t=>null!==t));this.props.updateMetaFromTiles(t.getId(),e)}})),a()(this,"_removeTileFromCache",((t,e)=>{const n=this._tileCache.findIndex((n=>n.mbKey===e&&n.mbSourceId===t));n>=0&&(this._tileCache.splice(n,1),this._updateTileStatusForAllLayers())}))}componentDidMount(){this._isMounted=!0,this.props.mbMap.on("sourcedataloading",this._onSourceDataLoading),this.props.mbMap.on("error",this._onError),this.props.mbMap.on("sourcedata",this._onSourceData),this.props.mbMap.on("move",this._onMove)}componentWillUnmount(){this._isMounted=!1,this.props.mbMap.off("error",this._onError),this.props.mbMap.off("sourcedata",this._onSourceData),this.props.mbMap.off("sourcedataloading",this._onSourceDataLoading),this.props.mbMap.off("move",this._onMove),this._tileCache.length=0}render(){return null}}const ut=Object(i.connect)((function(t){return{layerList:Object(V.p)(t)}}),(function(t){return{setAreTilesLoaded(e,n){t(Object(z.V)(e,n))},updateMetaFromTiles(e,n){t(Object(z.Mb)(e,n))},clearTileLoadError(e){t(Object(z.hb)(e,null))},setTileLoadError(e,n){t(Object(z.hb)(e,n))}}}))(tile_status_tracker_TileStatusTracker);var ct=n(509),ht=n(270);const dt=new ct.io.GeoJSONReader;class draw_feature_control_DrawFeatureControl extends l.Component{constructor(...t){super(...t),a()(this,"_onDraw",(async(t,e)=>{try{const e=[];t.features.forEach((t=>{const{geometry:n}=dt.read(t);if(!n.isSimple()||!n.isValid())throw new Error(p.i18n.translate("xpack.maps.drawFeatureControl.invalidGeometry",{defaultMessage:"Invalid geometry detected"}));if("coordinates"in t.geometry){const n=this.props.drawMode===x.x.DRAW_POINTS?t.geometry.coordinates:t.geometry;e.push(n)}})),e.length&&this.props.addNewFeatureToIndex(e)}catch(t){Object(S.Q)().addWarning(p.i18n.translate("xpack.maps.drawFeatureControl.unableToCreateFeature",{defaultMessage:"Unable to create feature, error: '{errorMsg}'.",values:{errorMsg:t.message}}))}finally{try{e.deleteAll()}catch(t){}}})),a()(this,"_onClick",(async(t,e)=>{const n=t.point;if(!this.props.editLayer||this.props.drawShape!==x.y.DELETE)return;const i=this.props.editLayer.getMbLayerIds().filter((t=>!!this.props.mbMap.getLayer(t))),r=[{x:n.x-2,y:n.y-2},{x:n.x+2,y:n.y+2}],o=this.props.mbMap.queryRenderedFeatures(r,{layers:i,filter:["all",ht.a]});if(!o.length)return;const s=o[0];try{if(!s.properties||!s.properties._id)throw Error("Associated Elasticsearch document id not found");const t=s.properties._id;this.props.deleteFeatureFromIndex(t)}catch(t){Object(S.Q)().addWarning(p.i18n.translate("xpack.maps.drawFeatureControl.unableToDeleteFeature",{defaultMessage:"Unable to delete feature, error: '{errorMsg}'.",values:{errorMsg:t.message}}))}}))}render(){return Object(A.jsx)(draw_control_DrawControl,{drawShape:this.props.drawShape,onDraw:this._onDraw,onClick:this._onClick,mbMap:this.props.mbMap,enable:!0})}}const pt=Object(i.connect)((function(t){const e=Object(V.f)(t),n=e?Object(V.n)(e.layerId,t):void 0;return{drawShape:e?e.drawShape:void 0,drawMode:Object(U.c)(t),editLayer:n}}),(function(t){return{addNewFeatureToIndex(e){t(Object(z.m)(e))},deleteFeatureFromIndex(e){t(Object(z.y)(e))}}}))(draw_feature_control_DrawFeatureControl);var ft=n(99),gt=n(266);const mt=navigator.platform.toLowerCase().indexOf("mac")>=0;class keydown_scroll_zoom_KeydownScrollZoom extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"_hideTimeout",void 0),a()(this,"state",{show:!1}),a()(this,"_onWheel",(t=>{this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=void 0),mt&&t.originalEvent.metaKey||!mt&&t.originalEvent.ctrlKey?this.setState({show:!1}):(this.setState({show:!0}),this._hideTimeout=setTimeout((()=>{this._isMounted&&this.setState({show:!1})}),1500),t.preventDefault())}))}componentDidMount(){this._isMounted=!0,this.props.mbMap.on("wheel",this._onWheel)}componentWillUnmount(){this._isMounted=!1,this.props.mbMap.off("wheel",this._onWheel)}render(){return Object(A.jsx)("aside",{className:h()("mapKeydownScrollZoom",{"mapKeydownScrollZoom--show":this.state.show})},Object(A.jsx)(d.EuiText,{textAlign:"center",size:"s",color:"ghost"},Object(A.jsx)("h3",null,p.i18n.translate("xpack.maps.keydownScrollZoom.keydownToZoomInstructions",{defaultMessage:"Use {key} + scroll to zoom the map",values:{key:mt?"⌘":"control"}})),Object(A.jsx)("p",null,p.i18n.translate("xpack.maps.keydownScrollZoom.keydownClickAndDragZoomInstructions",{defaultMessage:"Use shift + click and drag to zoom the map to fit within a bounding box"}))))}}const _t="elastic-api-version",yt="x-elastic-internal-origin",vt=Object(S.r)().basePath.prepend(x.E),bt=Object(S.r)().basePath.prepend(x.ob),xt=Object(S.r)().basePath.prepend(x.nb);function Et(t,e){return"Glyphs"===e&&t.startsWith(vt)?{url:t,method:"GET",headers:{[_t]:"1",[yt]:"kibana"}}:"Tile"===e&&t.startsWith(bt)?{url:t,method:"GET",headers:{[_t]:"1",[yt]:"kibana"}}:"Tile"===e&&t.startsWith(xt)?{url:t,method:"GET",headers:{[_t]:"1",[yt]:"kibana"}}:{url:t}}class mb_map_MbMap extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"_containerRef",null),a()(this,"_prevCustomIcons",void 0),a()(this,"_prevDisableInteractive",void 0),a()(this,"_prevLayerList",void 0),a()(this,"_prevTimeslice",void 0),a()(this,"_navigationControl",new v.a.NavigationControl({showCompass:!1})),a()(this,"state",{mbMap:void 0}),a()(this,"_debouncedSync",_.a.debounce((()=>{if(this._isMounted&&this.props.isMapReady&&this.state.mbMap){const t=this._prevLayerList!==this.props.layerList,e=!_.a.isEqual(this._prevTimeslice,this.props.timeslice);(t||e)&&(this._prevLayerList=this.props.layerList,this._prevTimeslice=this.props.timeslice,this._syncMbMapWithLayerList(),this._syncMbMapWithInspector()),this.props.spatialFiltersLayer.syncLayerWithMB(this.state.mbMap),this._syncSettings()}}),256)),a()(this,"_syncMbMapWithMapState",(()=>{const{isMapReady:t,goto:e,clearGoto:n}=this.props;if(t&&e&&this.state.mbMap)if(n(),e.bounds){const t=new v.a.LngLatBounds(new v.a.LngLat(Object(E.f)(e.bounds.minLon),Object(E.e)(e.bounds.minLat)),new v.a.LngLat(Object(E.f)(e.bounds.maxLon),Object(E.e)(e.bounds.maxLat)));this.state.mbMap.fitBounds(t,{maxZoom:17,padding:16})}else e.center&&(this.state.mbMap.setZoom(e.center.zoom),this.state.mbMap.setCenter({lng:e.center.lon,lat:e.center.lat}))})),a()(this,"_syncMbMapWithLayerList",(()=>{this.state.mbMap&&(function(t,e,n){const i=t.getStyle();if(i.layers){i.layers.forEach((i=>{n.ownsMbLayerId(i.id)||et(i.id)||e.find((t=>t.ownsMbLayerId(i.id)))||t.removeLayer(i.id)}));for(const r in i.sources)if(i.sources.hasOwnProperty(r)){if(n.ownsMbSourceId(r))continue;e.find((t=>t.ownsMbSourceId(r)))||t.removeSource(r)}}}(this.state.mbMap,this.props.layerList,this.props.spatialFiltersLayer),this.props.layerList.forEach((t=>t.syncLayerWithMB(this.state.mbMap,this.props.timeslice))),function(t,e,n){const i=t.getStyle().layers;if(!i||0===i.length)return;st(t,e,it.ANY)||rt(t,i,e,it.ANY);let r=ot(i,e,it.ANY);const o={ownsMbLayerId:t=>et(t)};rt(t,i,o,it.ANY,r);const s=ot(i,o,it.ANY);s&&(r=s),[...n].reverse().filter((t=>t.areLabelsOnTop())).forEach((e=>{st(t,e,it.LABEL,r)||rt(t,i,e,it.LABEL,r);const n=ot(i,e,it.LABEL);n&&(r=n)})),[...n].reverse().forEach((e=>{const n=e.areLabelsOnTop()?it.NON_LABEL:it.ANY;st(t,e,n,r)||rt(t,i,e,n,r);const o=ot(i,e,n);o&&(r=o)}))}(this.state.mbMap,this.props.spatialFiltersLayer,this.props.layerList))})),a()(this,"_syncMbMapWithInspector",(()=>{if(!this.props.inspectorAdapters.map||!this.state.mbMap)return;const t={center:this.state.mbMap.getCenter().toArray(),zoom:this.state.mbMap.getZoom()};this.props.inspectorAdapters.map.setMapState({stats:t,style:this.state.mbMap.getStyle()})})),a()(this,"_setContainerRef",(t=>{this._containerRef=t}))}componentDidMount(){this._initializeMap(),this._isMounted=!0}componentDidUpdate(){this._syncMbMapWithMapState(),this._debouncedSync()}componentWillUnmount(){this._isMounted=!1,this.state.mbMap&&(this.state.mbMap.remove(),this.state.mbMap=void 0),this.props.onMapDestroyed()}_getMapExtentState(){const t=this.state.mbMap.getZoom(),e=this.state.mbMap.getCenter(),n=this.state.mbMap.getBounds();return{zoom:_.a.round(t,x.Ib),center:{lon:_.a.round(e.lng,x.o),lat:_.a.round(e.lat,x.o)},extent:{minLon:_.a.round(n.getWest(),x.o),minLat:_.a.round(n.getSouth(),x.o),maxLon:_.a.round(n.getEast(),x.o),maxLat:_.a.round(n.getNorth(),x.o)}}}async _createMbMapInstance(t){return this._reportUsage(),new Promise((e=>{const n=function(){const t=Object(S.l)();return t&&t.isEMSEnabled()&&("boolean"!=typeof Q||Q)?{glyphUrlTemplate:t.getEMSFontLibraryUrl(),isEmsFont:!0}:{glyphUrlTemplate:tt(),isEmsFont:!1}}(),i={version:8,sources:{},layers:[],glyphs:n.glyphUrlTemplate},r={attributionControl:!1,container:this._containerRef,style:i,preserveDrawingBuffer:Object(S.F)(),maxZoom:this.props.settings.maxZoom,minZoom:this.props.settings.minZoom,transformRequest:Et};t?(r.zoom=t.zoom,r.center={lng:t.lon,lat:t.lat}):r.bounds=[-170,-60,170,75];const o=new v.a.Map(r);let s;o.dragRotate.disable(),o.touchZoomRotate.disableRotation(),o.on("styleimagemissing",(t=>{s&&o.addImage(t.id,s)})),o.on("load",(()=>{o.resize(),s=new Image,s.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",s.crossOrigin="anonymous",e(o)})),n.isEmsFont&&async function(){return $||($=new Promise((async t=>{try{Q=void 0;const e=Object(S.l)();e&&e.isEMSEnabled()||t(!1);const n=e.getEMSFontLibraryUrl().replace("{fontstack}","Open Sans").replace("{range}","0-255"),i=await K()(n,{method:"HEAD"});if(i.status>=400)throw new Error(`status: ${i.status}`);Q=!0,t(!0)}catch(e){console.warn(`Unable to access fonts from Elastic Maps Service (EMS). To avoid unnecessary EMS requests, set 'map.includeElasticMapsService: false' in 'kibana.yml'. For more details please visit: ${Object(S.k)().links.maps.connectToEms}`),Q=!1,t(!1)}}))),$}().then((t=>{this._isMounted&&!t&&o.setStyle({...o.getStyle(),glyphs:tt()})}))}))}async _initializeMap(){const t=await async function(t,e){return e.initialLocation===x.S.FIXED_LOCATION?{lat:e.fixedLocation.lat,lon:e.fixedLocation.lon,zoom:e.fixedLocation.zoom}:e.initialLocation===x.S.BROWSER_LOCATION?await new Promise(((t,n)=>{navigator.geolocation.getCurrentPosition((n=>{t({lat:n.coords.latitude,lon:n.coords.longitude,zoom:e.browserLocation.zoom})}),(()=>{console.warn("Unable to fetch browser location for initial map location"),t(null)}))})):e.initialLocation===x.S.AUTO_FIT_TO_BOUNDS?null:t&&t.center?t.center:null}(this.props.goto,this.props.settings);if(!this._isMounted)return;let e;try{e=await this._createMbMapInstance(t)}catch(t){return void this.props.setMapInitError(t.message)}this._isMounted&&this.setState({mbMap:e},(()=>{this._loadMakiSprites(e),this._registerMapEventListeners(e),this.props.onMapReady(this._getMapExtentState())}))}_registerMapEventListeners(t){if(t.on("moveend",_.a.debounce((()=>{this._isMounted&&this.props.extentChanged(this._getMapExtentState())}),100)),t.on("move",(()=>{if(this.props.onMapMove){const{zoom:t,center:e}=this._getMapExtentState();this.props.onMapMove(e.lat,e.lon,t)}})),!this.props.settings.hideViewControl){const e=_.a.throttle((t=>{this.props.setMouseCoordinates({lat:t.lngLat.lat,lon:t.lngLat.lng})}),100);t.on("mousemove",e),t.on("mouseout",(()=>{e.cancel(),this.props.clearMouseCoordinates()}))}}_reportUsage(){const t=Object(S.T)();if(!t)return;const e=Object(y.supported)();t.reportUiCounter(x.e,b.METRIC_TYPE.LOADED,e?"gl_webglSupported":"gl_webglNotSupported"),e&&!Object(y.supported)({failIfMajorPerformanceCaveat:!0})&&t.reportUiCounter(x.e,b.METRIC_TYPE.LOADED,"gl_majorPerformanceCaveat")}async _loadMakiSprites(t){if(this._isMounted){const e=Math.max(Math.floor(window.devicePixelRatio),1);for(const[n,{svg:i}]of Object.entries(gt.a))if(!t.hasImage(n)){const r=await Object(ft.e)({renderSize:x.cb,svg:i});r&&t.addImage(n,r,{pixelRatio:e,sdf:!0})}}}_syncSettings(){if(!this.state.mbMap)return;if(!Object(S.V)()&&(void 0===this._prevDisableInteractive||this._prevDisableInteractive!==this.props.settings.disableInteractive))if(this._prevDisableInteractive=this.props.settings.disableInteractive,this.props.settings.disableInteractive){this.state.mbMap.boxZoom.disable(),this.state.mbMap.doubleClickZoom.disable(),this.state.mbMap.dragPan.disable();try{this.state.mbMap.removeControl(this._navigationControl)}catch(t){}}else this.state.mbMap.boxZoom.enable(),this.state.mbMap.doubleClickZoom.enable(),this.state.mbMap.dragPan.enable(),this.state.mbMap.addControl(this._navigationControl,"top-left");if(void 0===this._prevCustomIcons||!_.a.isEqual(this._prevCustomIcons,this.props.customIcons)){this._prevCustomIcons=this.props.customIcons;const t=this.state.mbMap;for(const{symbolId:e,svg:n,cutoff:i,radius:r}of this.props.customIcons)Object(ft.e)({svg:n,renderSize:x.m,cutoff:i,radius:r}).then((n=>{n&&(t.hasImage(e)?t.updateImage(e,n):t.addImage(e,n,{sdf:!0,pixelRatio:ft.a}))}))}let t=!1;this.props.settings.minZoom!==this.state.mbMap.getMinZoom()&&(this.state.mbMap.setMinZoom(this.props.settings.minZoom),t=!0),this.props.settings.maxZoom!==this.state.mbMap.getMaxZoom()&&(this.state.mbMap.setMaxZoom(this.props.settings.maxZoom),t=!0),t&&setTimeout((()=>{this._isMounted&&this.props.extentChanged(this._getMapExtentState())}),300)}render(){let t,e,n,i,r,o;return this.state.mbMap&&(t=this.props.addFilters&&this.props.filterModeActive?Object(A.jsx)(q,{mbMap:this.state.mbMap,addFilters:this.props.addFilters}):null,e=this.props.featureModeActive?Object(A.jsx)(pt,{mbMap:this.state.mbMap}):null,n=this.props.settings.disableTooltipControl?null:Object(A.jsx)(J,{mbMap:this.state.mbMap,addFilters:this.props.addFilters,getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,onSingleValueTrigger:this.props.onSingleValueTrigger,renderTooltipContent:this.props.renderTooltipContent}),i=this.props.settings.showScaleControl?Object(A.jsx)(scale_control_ScaleControl,{mbMap:this.state.mbMap,isFullScreen:this.props.isFullScreen}):null,r=this.props.settings.keydownScrollZoom?Object(A.jsx)(keydown_scroll_zoom_KeydownScrollZoom,{mbMap:this.state.mbMap}):null,o=Object(A.jsx)(ut,{mbMap:this.state.mbMap})),Object(A.jsx)("div",{id:"mapContainer",className:"mapContainer",ref:this._setContainerRef,"data-test-subj":"mapContainer"},t,e,r,i,n,o)}}var St=n(114);const Ct=Object(i.connect)((function(t){return{isMapReady:Object(V.x)(t),settings:Object(V.y)(t),customIcons:Object(V.b)(t),layerList:Object(V.p)(t),spatialFiltersLayer:Object(V.J)(t),goto:Object(V.k)(t),inspectorAdapters:Object(St.d)(t),isFullScreen:Object(U.e)(t),timeslice:Object(V.L)(t),featureModeActive:Object(U.c)(t)===x.x.DRAW_SHAPES||Object(U.c)(t)===x.x.DRAW_POINTS,filterModeActive:Object(U.c)(t)===x.x.DRAW_FILTERS,onMapMove:Object(St.e)(t)}}),(function(t){return{extentChanged:e=>{t(Object(z.G)(e))},onMapReady:e=>{t(Object(z.p)()),t(Object(z.G)(e)),t(Object(z.H)())},onMapDestroyed:()=>{t(Object(z.F)())},setMouseCoordinates:({lat:e,lon:n})=>{t(Object(z.mb)({lat:e,lon:n}))},clearMouseCoordinates:()=>{t(Object(z.r)())},clearGoto:()=>{t(Object(z.p)())},setMapInitError(e){t(Object(z.kb)(e))}}}))(mb_map_MbMap);var It=n(40),Ot=n(97);class toc_entry_button_TOCEntryButton extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"state",{isFilteredByGlobalTime:!1})}componentDidMount(){this._isMounted=!0,this._loadIsFilteredByGlobalTime()}componentDidUpdate(){this._loadIsFilteredByGlobalTime()}componentWillUnmount(){this._isMounted=!1}async _loadIsFilteredByGlobalTime(){const t=await this.props.layer.isFilteredByGlobalTime();this._isMounted&&t!==this.state.isFilteredByGlobalTime&&this.setState({isFilteredByGlobalTime:t})}getIconAndTooltipContent(){if(this.props.layer.hasErrors())return{icon:Object(A.jsx)(d.EuiIcon,{"aria-label":p.i18n.translate("xpack.maps.layer.loadWarningAriaLabel",{defaultMessage:"Load warning"}),size:"m",type:"warning",color:"warning"}),tooltipContent:this.props.layer.getErrors(),footnotes:[]};if(!this.props.layer.isVisible())return{icon:Object(A.jsx)(d.EuiIcon,{size:"m",type:"eyeClosed"}),tooltipContent:p.i18n.translate("xpack.maps.layer.layerHiddenTooltip",{defaultMessage:"Layer is hidden."}),footnotes:[]};if(!this.props.layer.showAtZoomLevel(this.props.zoom)){const t=this.props.layer.getMinZoom(),e=this.props.layer.getMaxZoom();return{icon:Object(A.jsx)(d.EuiIcon,{size:"m",type:"expand"}),tooltipContent:p.i18n.translate("xpack.maps.layer.zoomFeedbackTooltip",{defaultMessage:"Layer is visible between zoom levels {minZoom} and {maxZoom}.",values:{minZoom:t,maxZoom:e}}),footnotes:[]}}if(this.props.layer.isLayerLoading(this.props.zoom))return{icon:Object(A.jsx)(d.EuiLoadingSpinner,{size:"m"}),tooltipContent:"",footnotes:[]};const{icon:t,tooltipContent:e}=this.props.layer.getLayerIcon(!0);if(Object(Ot.c)(this.props.layer))return{icon:t,tooltipContent:e,footnotes:[]};const n=[];this.props.isUsingSearch&&this.props.layer.getQueryableIndexPatternIds().length&&n.push({icon:Object(A.jsx)(d.EuiIcon,{color:"subdued",type:"filter",size:"s"}),message:p.i18n.translate("xpack.maps.layer.isUsingSearchMsg",{defaultMessage:"Results narrowed by global search"})}),this.state.isFilteredByGlobalTime&&n.push({icon:Object(A.jsx)(d.EuiIcon,{color:"subdued",type:"clock",size:"s"}),message:p.i18n.translate("xpack.maps.layer.isUsingTimeFilter",{defaultMessage:"Results narrowed by global time"})});const i=this.props.layer.getSource();return"function"==typeof i.isFilterByMapBounds&&i.isFilterByMapBounds()&&n.push({icon:Object(A.jsx)(d.EuiIcon,{color:"subdued",type:"stop",size:"s"}),message:p.i18n.translate("xpack.maps.layer.isUsingBoundsFilter",{defaultMessage:"Results narrowed by visible map area"})}),{icon:t,tooltipContent:e,footnotes:n}}render(){const{icon:t,tooltipContent:e,footnotes:n}=this.getIconAndTooltipContent(),i=n.map(((t,e)=>Object(A.jsx)(l.Fragment,{key:e},"",t.icon))),r=n.map(((t,e)=>Object(A.jsx)("div",{key:e},t.icon," ",t.message)));return Object(A.jsx)(d.EuiToolTip,{anchorClassName:"mapLayTocActions__tooltipAnchor",position:"top",title:this.props.displayName,content:Object(A.jsx)(l.Fragment,null,e,r),"data-test-subj":"layerTocTooltip"},Object(A.jsx)(d.EuiButtonEmpty,{className:"mapTocEntry__layerName eui-textLeft",size:"xs",flush:"left",color:"text",onClick:this.props.onClick,"data-test-subj":`layerTocActionsPanelToggleButton${this.props.escapedDisplayName}`},Object(A.jsx)("span",{className:"mapTocEntry__layerNameIcon"},t),this.props.displayName," ",i))}}const wt=Object(i.connect)((function(t,e){return{isUsingSearch:Object(V.R)(t),zoom:Object(V.z)(t)}}))(toc_entry_button_TOCEntryButton);function Lt(t){return t?"eyeClosed":"eye"}function Tt(t){return t?p.i18n.translate("xpack.maps.layerTocActions.hideLayerTitle",{defaultMessage:"Hide layer"}):p.i18n.translate("xpack.maps.layerTocActions.showLayerTitle",{defaultMessage:"Show layer"})}const Nt=p.i18n.translate("xpack.maps.layerControl.layerTocActions.layerSettingsButtonLabel",{defaultMessage:"Edit layer settings"}),jt=p.i18n.translate("xpack.maps.layerControl.layerTocActions.editFeaturesButtonLabel",{defaultMessage:"Edit features"}),Mt=p.i18n.translate("xpack.maps.layerTocActions.fitToDataTitle",{defaultMessage:"Fit to data"});var Pt=n(112);function Ft(t){function e(t){let n=0;return t.getChildren().forEach((t=>{n++,Object(Ot.c)(t)&&(n+=e(t))})),n}return Object(A.jsx)(d.EuiConfirmModal,{title:p.i18n.translate("xpack.maps.deleteLayerConfirmModal.title",{defaultMessage:"Remove layer?"}),onCancel:t.onCancel,onConfirm:t.onConfirm,cancelButtonText:p.i18n.translate("xpack.maps.deleteLayerConfirmModal.cancelButtonText",{defaultMessage:"Cancel"}),confirmButtonText:p.i18n.translate("xpack.maps.deleteLayerConfirmModal.confirmButtonText",{defaultMessage:"Remove layer"}),buttonColor:"danger",defaultFocusedButton:"cancel"},Object(A.jsx)(d.EuiText,null,function(){if(!Object(Ot.c)(t.layer))return null;const n=e(t.layer);return n>0?Object(A.jsx)("p",null,p.i18n.translate("xpack.maps.deleteLayerConfirmModal.multiLayerWarning",{defaultMessage:"Removing this layer also removes {numChildren} nested {numChildren, plural, one {layer} other {layers}}.",values:{numChildren:n}})):null}(),Object(A.jsx)("p",null,p.i18n.translate("xpack.maps.deleteLayerConfirmModal.unrecoverableWarning",{defaultMessage:"You can't recover removed layers."}))))}class toc_entry_actions_popover_TOCEntryActionsPopover extends l.Component{constructor(...t){super(...t),a()(this,"state",{isPopoverOpen:!1,showRemoveModal:!1,supportsFeatureEditing:!1,isFeatureEditingEnabled:!1}),a()(this,"_isMounted",!1),a()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_closePopover",(()=>{this.setState((()=>({isPopoverOpen:!1})))}))}componentDidMount(){this._isMounted=!0}componentWillUnmount(){this._isMounted=!1}componentDidUpdate(){this._loadFeatureEditing()}async _loadFeatureEditing(){if(!Object(H.e)(this.props.layer))return;const t=this.props.layer.supportsFeatureEditing(),e=await this._getIsFeatureEditingEnabled();!this._isMounted||t===this.state.supportsFeatureEditing&&e===this.state.isFeatureEditingEnabled||this.setState({supportsFeatureEditing:t,isFeatureEditingEnabled:e})}async _getIsFeatureEditingEnabled(){const t=this.props.layer,e=this.props.layer.getSource();return e instanceof Pt.ESSearchSource&&!(e.getSyncMeta().scalingType===x.vb.CLUSTERS||t.isPreviewLayer()||!t.isVisible()||t.hasJoins())}_getActionsPanel(){const t=[{name:Mt,icon:Object(A.jsx)(d.EuiIcon,{type:"expand",size:"m"}),"data-test-subj":"fitToBoundsButton",toolTipContent:this.props.supportsFitToBounds?null:p.i18n.translate("xpack.maps.layerTocActions.noFitSupportTooltip",{defaultMessage:"Layer does not support fit to data"}),disabled:!this.props.supportsFitToBounds,onClick:()=>{this._closePopover(),this.props.fitToBounds(this.props.layer.getId())}},{name:Tt(this.props.layer.isVisible()),icon:Object(A.jsx)(d.EuiIcon,{type:Lt(this.props.layer.isVisible()),size:"m"}),"data-test-subj":"layerVisibilityToggleButton",toolTipContent:null,onClick:()=>{this._closePopover(),this.props.toggleVisible(this.props.layer.getId())}}];return this.props.numLayers>2&&t.push({name:p.i18n.translate("xpack.maps.layerTocActions.showThisLayerOnlyTitle",{defaultMessage:"Show this layer only"}),icon:Object(A.jsx)(d.EuiIcon,{type:"eye",size:"m"}),"data-test-subj":"showThisLayerOnlyButton",toolTipContent:null,onClick:()=>{this._closePopover(),this.props.showThisLayerOnly(this.props.layer.getId())}}),this.props.isReadOnly||(t.push({disabled:this.props.isEditButtonDisabled,name:Nt,icon:Object(A.jsx)(d.EuiIcon,{type:"pencil",size:"m"}),"data-test-subj":"layerSettingsButton",toolTipContent:null,onClick:()=>{this._closePopover(),this.props.openLayerSettings()}}),this.state.supportsFeatureEditing&&t.push({name:jt,icon:Object(A.jsx)(d.EuiIcon,{type:"vector",size:"m"}),"data-test-subj":"editLayerButton",toolTipContent:this.state.isFeatureEditingEnabled?null:p.i18n.translate("xpack.maps.layerTocActions.editFeaturesTooltip.disabledMessage",{defaultMessage:"Edit features is only supported for layers without clustering and term joins"}),disabled:!this.state.isFeatureEditingEnabled,onClick:async()=>{this._closePopover();const t=await this.props.layer.getSource().getSupportedShapeTypes();t.includes(x.Fb.POLYGON)&&t.includes(x.Fb.LINE)?this.props.enableShapeEditing(this.props.layer.getId()):this.props.enablePointEditing(this.props.layer.getId())}}),t.push({name:p.i18n.translate("xpack.maps.layerTocActions.cloneLayerTitle",{defaultMessage:"Clone layer"}),icon:Object(A.jsx)(d.EuiIcon,{type:"copy",size:"m"}),toolTipContent:null,"data-test-subj":"cloneLayerButton",onClick:()=>{this._closePopover(),this.props.cloneLayer(this.props.layer.getId())}}),Object(Ot.c)(this.props.layer)&&this.props.layer.getChildren().length>0&&t.push({name:p.i18n.translate("xpack.maps.layerTocActions.ungroupLayerTitle",{defaultMessage:"Ungroup layers"}),icon:Object(A.jsx)(d.EuiIcon,{type:"layers",size:"m"}),toolTipContent:null,"data-test-subj":"removeLayerButton",onClick:()=>{this._closePopover(),this.props.ungroupLayer(this.props.layer.getId()),this.props.removeLayer(this.props.layer.getId())}}),t.push({name:p.i18n.translate("xpack.maps.layerTocActions.removeLayerTitle",{defaultMessage:"Remove layer"}),icon:Object(A.jsx)(d.EuiIcon,{type:"trash",size:"m"}),toolTipContent:null,"data-test-subj":"removeLayerButton",onClick:()=>{this.setState({showRemoveModal:!0})}})),{id:0,title:p.i18n.translate("xpack.maps.layerTocActions.layerActionsTitle",{defaultMessage:"Layer actions"}),items:t}}render(){const t=this.state.showRemoveModal?Object(A.jsx)(Ft,{layer:this.props.layer,onCancel:()=>{this.setState({showRemoveModal:!1})},onConfirm:()=>{this.setState({showRemoveModal:!1}),this._closePopover(),this.props.removeLayer(this.props.layer.getId())}}):null;return Object(A.jsx)(u.a.Fragment,null,t,Object(A.jsx)(d.EuiPopover,{id:this.props.layer.getId(),className:"mapLayTocActions",button:Object(A.jsx)(wt,{layer:this.props.layer,displayName:this.props.displayName,escapedDisplayName:this.props.escapedDisplayName,onClick:this._togglePopover}),isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,panelPaddingSize:"none",anchorPosition:"leftUp",anchorClassName:"mapLayTocActions__popoverAnchor"},Object(A.jsx)(d.EuiContextMenu,{initialPanelId:0,panels:[this._getActionsPanel()],"data-test-subj":`layerTocActionsPanel${this.props.escapedDisplayName}`})))}}const Rt=Object(i.connect)((function(t){return{isReadOnly:Object(U.g)(t),numLayers:Object(V.r)(t).length}}),(function(t){return{cloneLayer:e=>{t(Object(z.s)(e))},fitToBounds:e=>{t(Object(z.C)(e))},removeLayer:e=>{t(Object(z.P)(e))},toggleVisible:e=>{t(Object(z.ub)(e))},enableShapeEditing:e=>{t(Object(z.zb)(e)),t(Object(z.X)(x.x.DRAW_SHAPES))},enablePointEditing:e=>{t(Object(z.zb)(e)),t(Object(z.X)(x.x.DRAW_POINTS))},showThisLayerOnly:e=>{t(Object(z.tb)(e))},ungroupLayer:e=>{t(Object(z.vb)(e))}}}))(toc_entry_actions_popover_TOCEntryActionsPopover);function At(t){return t.split(" ").join("_")}class toc_entry_TOCEntry extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"state",{displayName:"",hasLegendDetails:!1,shouldShowModal:!1,supportsFitToBounds:!1}),a()(this,"_toggleLayerDetailsVisibility",(()=>{this.props.isLegendDetailsOpen?this.props.hideTOCDetails(this.props.layer.getId()):this.props.showTOCDetails(this.props.layer.getId())})),a()(this,"_openLayerPanelWithCheck",(()=>{const{selectedLayer:t,hasDirtyStateSelector:e}=this.props;t&&t.getId()===this.props.layer.getId()||(e?this.setState({shouldShowModal:!0}):this.props.openLayerPanel(this.props.layer.getId()))})),a()(this,"_fitToBounds",(()=>{this.props.fitToBounds(this.props.layer.getId())})),a()(this,"_toggleVisible",(()=>{this.props.toggleVisible(this.props.layer.getId())})),a()(this,"_renderLegendDetails",(()=>{if(!this.props.isLegendDetailsOpen||!this.state.hasLegendDetails)return null;const t=this.props.layer.renderLegendDetails();return t?Object(A.jsx)("div",{className:"mapTocEntry__layerDetails","data-test-subj":`mapLayerTOCDetails${At(this.state.displayName)}`},t):null}))}componentDidMount(){this._isMounted=!0,this._updateDisplayName(),this._loadHasLegendDetails(),this._loadSupportsFitToBounds()}componentWillUnmount(){this._isMounted=!1}componentDidUpdate(){this._updateDisplayName(),this._loadHasLegendDetails()}async _loadSupportsFitToBounds(){const t=await this.props.layer.supportsFitToBounds();this._isMounted&&this.setState({supportsFitToBounds:t})}async _loadHasLegendDetails(){const t=await this.props.layer.hasLegendDetails()&&this.props.layer.isVisible()&&this.props.layer.showAtZoomLevel(this.props.zoom);this._isMounted&&t!==this.state.hasLegendDetails&&this.setState({hasLegendDetails:t})}async _updateDisplayName(){const t=await this.props.layer.getDisplayName();this._isMounted&&t!==this.state.displayName&&this.setState({displayName:t})}_renderCancelModal(){if(!this.state.shouldShowModal)return null;const t=()=>{this.setState({shouldShowModal:!1})};return Object(A.jsx)(d.EuiConfirmModal,{title:"Discard changes",onCancel:t,onConfirm:()=>{t(),this.props.openLayerPanel(this.props.layer.getId())},cancelButtonText:"Do not proceed",confirmButtonText:"Proceed and discard changes",buttonColor:"danger",defaultFocusedButton:"cancel"},Object(A.jsx)("p",null,"There are unsaved changes to your layer."),Object(A.jsx)("p",null,"Are you sure you want to proceed?"))}_renderQuickActions(){const t=[Object(A.jsx)(d.EuiButtonIcon,{key:"toggleVisiblity",iconType:Lt(this.props.layer.isVisible()),title:Tt(this.props.layer.isVisible()),"aria-label":Tt(this.props.layer.isVisible()),onClick:this._toggleVisible})];return this.state.supportsFitToBounds&&t.push(Object(A.jsx)(d.EuiButtonIcon,{key:"fitToBounds",iconType:"expand",title:Mt,"aria-label":Mt,onClick:this._fitToBounds})),this.props.isReadOnly||(t.push(Object(A.jsx)(d.EuiButtonIcon,{key:"settings",isDisabled:this.props.isEditButtonDisabled,iconType:"pencil","aria-label":Nt,title:Nt,onClick:this._openLayerPanelWithCheck})),t.push(Object(A.jsx)(d.EuiButtonIcon,o()({key:"reorder",iconType:"grab",title:p.i18n.translate("xpack.maps.layerControl.tocEntry.grabButtonTitle",{defaultMessage:"Reorder layer"}),"aria-label":p.i18n.translate("xpack.maps.layerControl.tocEntry.grabButtonAriaLabel",{defaultMessage:"Reorder layer"}),className:"mapTocEntry__grab"},this.props.dragHandleProps)))),Object(A.jsx)("div",{className:"mapTocEntry__layerIcons"},t)}_renderDetailsToggle(){if(this.props.isDragging||!this.state.hasLegendDetails)return null;const{isLegendDetailsOpen:t}=this.props;return Object(A.jsx)("span",{className:"mapTocEntry__detailsToggle"},Object(A.jsx)("button",{className:"mapTocEntry__detailsToggleButton","aria-label":t?p.i18n.translate("xpack.maps.layerControl.tocEntry.hideDetailsButtonAriaLabel",{defaultMessage:"Hide layer details"}):p.i18n.translate("xpack.maps.layerControl.tocEntry.showDetailsButtonAriaLabel",{defaultMessage:"Show layer details"}),title:t?p.i18n.translate("xpack.maps.layerControl.tocEntry.hideDetailsButtonTitle",{defaultMessage:"Hide layer details"}):p.i18n.translate("xpack.maps.layerControl.tocEntry.showDetailsButtonTitle",{defaultMessage:"Show layer details"}),onClick:this._toggleLayerDetailsVisibility},Object(A.jsx)(d.EuiIcon,{className:"eui-alignBaseline",type:t?"arrowUp":"arrowDown",size:"s"})))}_renderLayerHeader(){const{layer:t,zoom:e}=this.props;return Object(A.jsx)("div",{className:t.isVisible()&&t.showAtZoomLevel(e)&&!t.hasErrors()?"mapTocEntry-visible":"mapTocEntry-notVisible"},Object(A.jsx)(Rt,{layer:t,displayName:this.state.displayName,escapedDisplayName:At(this.state.displayName),openLayerSettings:this._openLayerPanelWithCheck,isEditButtonDisabled:this.props.isEditButtonDisabled,supportsFitToBounds:this.state.supportsFitToBounds}),this._renderQuickActions())}_hightlightAsSelectedLayer(){return!this.props.isCombineLayer&&(!!this.props.layer.isPreviewLayer()||this.props.selectedLayer&&this.props.selectedLayer.getId()===this.props.layer.getId())}render(){const t=h()("mapTocEntry",{"mapTocEntry-isDragging":this.props.isDragging,"mapTocEntry-isDraggingOver":this.props.isDraggingOver,"mapTocEntry-isCombineLayer":this.props.isCombineLayer,"mapTocEntry-isSelected":this._hightlightAsSelectedLayer(),"mapTocEntry-isInEditingMode":this.props.isFeatureEditorOpenForLayer}),e=this.props.depth>0?{paddingLeft:8+24*this.props.depth+"px"}:{};return Object(A.jsx)("div",{style:e,className:t,id:this.props.layer.getId(),"data-layerid":this.props.layer.getId()},this._renderLayerHeader(),this._renderLegendDetails(),this._renderDetailsToggle(),this._renderCancelModal(),this.props.isFeatureEditorOpenForLayer&&Object(A.jsx)("div",{className:"mapTocEntry-isInEditingMode__row"},Object(A.jsx)(d.EuiIcon,{type:"vector",size:"s"}),Object(A.jsx)("span",{className:"mapTocEntry-isInEditingMode__editFeatureText"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerControl.tocEntry.EditFeatures",defaultMessage:"Edit features"})),Object(A.jsx)(d.EuiButtonEmpty,{size:"xs",flush:"both",onClick:this.props.cancelEditing},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerControl.tocEntry.exitEditModeAriaLabel",defaultMessage:"Exit"}))))}}var Dt=n(90);const kt=Object(i.connect)((function(t,e){var n;const i=Object(U.d)(t);return{isReadOnly:Object(U.g)(t),zoom:Object(V.z)(t),selectedLayer:Object(V.G)(t),hasDirtyStateSelector:Object(V.N)(t),isLegendDetailsOpen:Object(U.i)(t).includes(e.layer.getId()),isEditButtonDisabled:i!==Dt.c.NONE&&i!==Dt.c.LAYER_PANEL,isFeatureEditorOpenForLayer:(null===(n=Object(V.f)(t))||void 0===n?void 0:n.layerId)===e.layer.getId()}}),(function(t){return{fitToBounds:e=>{t(Object(z.C)(e))},openLayerPanel:async e=>{await t(Object(z.qb)(e)),t(Object(z.Cb)(Dt.c.LAYER_PANEL))},hideTOCDetails:e=>{t(Object(z.E)(e))},showTOCDetails:e=>{t(Object(z.sb)(e))},toggleVisible:e=>{t(Object(z.ub)(e))},cancelEditing:()=>{t(Object(z.yb)(null)),t(Object(z.X)(x.x.NONE))}}}))(toc_entry_TOCEntry),Bt={combineLayer:null,isOwnAncestor:!1,newRightSiblingLayer:null,sourceLayer:null};class layer_toc_LayerTOC extends l.Component{constructor(...t){super(...t),a()(this,"state",{...Bt}),a()(this,"_updateDebounced",_.a.debounce(this.forceUpdate,100)),a()(this,"_onDragStart",(({source:t})=>{const e=this._reverseIndex(t.index),n=this.props.layerList[e];this.setState({...Bt,sourceLayer:n})})),a()(this,"_onDragUpdate",(({combine:t,destination:e,source:n})=>{const i=this._reverseIndex(n.index),r=this.props.layerList[i];if(t){const e=this.props.layerList.findIndex((e=>e.getId()===t.draggableId)),n=-1!==e?this.props.layerList[e]:null,i=e-1,o=i<0?null:this.props.layerList[i],s=n?this._getForebearers(n):[];return void this.setState({combineLayer:n,newRightSiblingLayer:o,sourceLayer:r,isOwnAncestor:s.includes(r.getId())})}if(!e||n.index===e.index)return void this.setState({...Bt});const o=this._reverseIndex(e.index),s=i>o?o-1:o,a=s<0?null:this.props.layerList[s],l=a?this._getForebearers(a):[];this.setState({combineLayer:null,newRightSiblingLayer:a,sourceLayer:r,isOwnAncestor:l.includes(r.getId())})})),a()(this,"_onDragEnd",(()=>{const{combineLayer:t,isOwnAncestor:e,sourceLayer:n,newRightSiblingLayer:i}=this.state;if(this.setState({...Bt}),!e&&n)return t?Object(Ot.c)(t)&&i?(this.props.setLayerParent(n.getId(),t.getId()),void this.props.moveLayerToLeftOfTarget(n.getId(),i.getId())):void this.props.createLayerGroup(n.getId(),t.getId()):i?(this.props.setLayerParent(n.getId(),i.getParent()),void this.props.moveLayerToLeftOfTarget(n.getId(),i.getId())):void this.props.moveLayerToBottom(n.getId())}))}componentWillUnmount(){this._updateDebounced.cancel()}shouldComponentUpdate(){return this._updateDebounced(),!1}_reverseIndex(t){return this.props.layerList.length-t-1}_getForebearers(t){const e=t.getParent();if(!e)return[];const n=this.props.layerList.find((t=>t.getId()===e));return n?[...this._getForebearers(n),e]:[]}_getDepth(t,e){if(void 0===t.getParent())return{depth:e,showInTOC:!0};const n=this.props.layerList.find((e=>t.getParent()===e.getId()));return n&&this.props.openTOCDetails.includes(n.getId())?this._getDepth(n,e+1):{depth:e,showInTOC:!1}}_getDroppableClass(){return this.state.sourceLayer?this.state.isOwnAncestor?"mapLayerToc-droppable-dropNotAllowed":this.state.combineLayer?"mapLayerToc-droppable-isCombining":"mapLayerToc-droppable-isDragging":""}_renderLayers(){const t=this.props.layerList.map(((t,e)=>({...this._getDepth(t,0),draggableIndex:this._reverseIndex(e),layer:t}))).filter((({showInTOC:t})=>t)).reverse();return this.props.isReadOnly?t.map((({depth:t,layer:e})=>Object(A.jsx)(kt,{key:e.getId(),depth:t,layer:e}))):Object(A.jsx)(d.EuiDragDropContext,{onDragStart:this._onDragStart,onDragUpdate:this._onDragUpdate,onDragEnd:this._onDragEnd},Object(A.jsx)(d.EuiDroppable,{droppableId:"mapLayerTOC",spacing:"none",isCombineEnabled:!this.state.isOwnAncestor,className:this._getDroppableClass()},((e,n)=>{const i=t.map((({draggableIndex:t,depth:e,layer:i})=>Object(A.jsx)(d.EuiDraggable,{spacing:"none",key:i.getId(),index:t,draggableId:i.getId(),customDragHandle:!0,disableInteractiveElementBlocking:!0},((t,r)=>Object(A.jsx)(kt,{depth:e,layer:i,dragHandleProps:t.dragHandleProps,isDragging:r.isDragging,isDraggingOver:n.isDraggingOver,isCombineLayer:null!==this.state.combineLayer&&this.state.combineLayer.getId()===i.getId()})))));return Object(A.jsx)("div",null,i)})))}render(){return Object(A.jsx)("div",{"data-test-subj":"mapLayerTOC"},this._renderLayers())}}const Gt=Object(i.connect)((function(t){return{isReadOnly:Object(U.g)(t),layerList:Object(V.p)(t),openTOCDetails:Object(U.i)(t)}}),(function(t){return{createLayerGroup:(e,n)=>t(Object(z.w)(e,n)),moveLayerToBottom:e=>t(Object(z.I)(e)),moveLayerToLeftOfTarget:(e,n)=>t(Object(z.J)(e,n)),setLayerParent:(e,n)=>t(Object(z.ib)(e,n))}}))(layer_toc_LayerTOC),zt=Object(i.connect)((function(t){return{isReadOnly:Object(U.g)(t),isLayerTOCOpen:Object(U.f)(t),layerList:Object(V.p)(t),isFlyoutOpen:Object(U.d)(t)!==Dt.c.NONE,zoom:Object(V.z)(t)}}),(function(t){return{showAddLayerWizard:async()=>{await t(Object(z.qb)(null)),t(Object(z.Cb)(Dt.c.ADD_LAYER_WIZARD)),t(Object(z.X)(x.x.NONE))},closeLayerTOC:()=>{t(Object(z.eb)(!1))},openLayerTOC:()=>{t(Object(z.eb)(!0))},hideAllLayers:()=>{t(Object(z.D)())},showAllLayers:()=>{t(Object(z.rb)())}}}))((function({isReadOnly:t,isLayerTOCOpen:e,showAddLayerWizard:n,closeLayerTOC:i,openLayerTOC:r,layerList:o,isFlyoutOpen:s,hideAllLayers:a,showAllLayers:u,zoom:c}){if(!e){if(Object(S.V)())return null;const t=o.some((t=>t.hasErrors())),e=o.some((t=>t.isLayerLoading(c)));return Object(A.jsx)(d.EuiToolTip,{delay:"long",content:p.i18n.translate("xpack.maps.layerControl.openLayerTOCButtonAriaLabel",{defaultMessage:"Expand layers panel"}),position:"left"},function({hasErrors:t,isLoading:e,onClick:n}){const i=p.i18n.translate("xpack.maps.layerControl.openLayerTOCButtonAriaLabel",{defaultMessage:"Expand layers panel"});return Object(A.jsx)(d.EuiButtonIcon,{className:"mapLayerControl__openLayerTOCButton",color:"text",isLoading:e,onClick:n,iconType:t?"warning":"menuLeft","aria-label":i,"data-test-subj":"mapExpandLayerControlButton"})}({hasErrors:t,isLoading:e,onClick:r}))}let h;return t||(h=Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiSpacer,{size:"s"}),Object(A.jsx)(d.EuiButton,{isDisabled:s,className:"mapLayerControl__addLayerButton",fill:!0,fullWidth:!0,onClick:n,"data-test-subj":"addLayerButton"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerControl.addLayerButtonLabel",defaultMessage:"Add layer"})))),Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiPanel,{className:"mapWidgetControl mapWidgetControl-hasShadow",paddingSize:"none",grow:!1},Object(A.jsx)(d.EuiFlexItem,{className:"mapWidgetControl__headerFlexItem",grow:!1},Object(A.jsx)(d.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"center",responsive:!1,gutterSize:"none"},Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(d.EuiTitle,{size:"xxxs",className:"mapWidgetControl__header"},Object(A.jsx)("h2",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerControl.layersTitle",defaultMessage:"Layers"})))),Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiToolTip,{delay:"long",content:p.i18n.translate("xpack.maps.layerControl.hideAllLayersButton",{defaultMessage:"Hide all layers"})},Object(A.jsx)(d.EuiButtonIcon,{onClick:a,iconType:"eyeClosed",color:"text","aria-label":p.i18n.translate("xpack.maps.layerControl.hideAllLayersButton",{defaultMessage:"Hide all layers"})}))),Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiToolTip,{delay:"long",content:p.i18n.translate("xpack.maps.layerControl.showAllLayersButton",{defaultMessage:"Show all layers"})},Object(A.jsx)(d.EuiButtonIcon,{onClick:u,iconType:"eye",color:"text","aria-label":p.i18n.translate("xpack.maps.layerControl.showAllLayersButton",{defaultMessage:"Show all layers"})}))),Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiToolTip,{delay:"long",content:p.i18n.translate("xpack.maps.layerControl.closeLayerTOCButtonAriaLabel",{defaultMessage:"Collapse layers panel"})},Object(A.jsx)(d.EuiButtonIcon,{className:"mapLayerControl__closeLayerTOCButton",onClick:i,iconType:"menuRight",color:"text","aria-label":p.i18n.translate("xpack.maps.layerControl.closeLayerTOCButtonAriaLabel",{defaultMessage:"Collapse layers panel"}),"data-test-subj":"mapToggleLegendButton"}))))),Object(A.jsx)(d.EuiFlexItem,{className:"mapLayerControl"},Object(A.jsx)(Gt,null))),h)})),Vt=Object(i.connect)((function(t){return{mouseCoordinates:Object(V.A)(t),zoom:Object(V.z)(t)}}),{})((function({mouseCoordinates:t,zoom:e}){let n;return t&&(n=Object(A.jsx)(l.Fragment,null,Object(A.jsx)("strong",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.viewControl.latLabel",defaultMessage:"lat:"}))," ",_.a.round(t.lat,x.o),","," ",Object(A.jsx)("strong",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.viewControl.lonLabel",defaultMessage:"lon:"}))," ",_.a.round(t.lon,x.o),","," ")),Object(A.jsx)("div",{className:"mapViewControl__coordinates"},Object(A.jsx)(d.EuiText,{size:"xs"},Object(A.jsx)("small",null,n,Object(A.jsx)("strong",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.viewControl.zoomLabel",defaultMessage:"zoom:"}))," ",e)))}));class attribution_control_AttributionControl extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"state",{uniqueAttributions:[]}),a()(this,"_loadAttributions",(async()=>{const t=this.props.layerList.map((async t=>{try{return await t.getAttributions()}catch(t){return[]}})),e=await Promise.all(t);if(!this._isMounted)return;const n=[];for(let t=0;tt.url===r.url&&t.label===r.label))||n.push(r)}n.reverse(),_.a.isEqual(this.state.uniqueAttributions,n)||this.setState({uniqueAttributions:n})}))}componentDidMount(){this._isMounted=!0,this._loadAttributions()}componentWillUnmount(){this._isMounted=!1}componentDidUpdate(){this._loadAttributions()}_renderAttribution({url:t,label:e}){return!t||Object(S.V)()?e:Object(A.jsx)(d.EuiLink,{color:"text",href:t,target:"_blank"},e)}_renderAttributions(){return this.state.uniqueAttributions.map(((t,e)=>Object(A.jsx)(l.Fragment,{key:e},this._renderAttribution(t),e(e.addTimeSliderControl(t),{initialInput:{...t,viewMode:Ht.ViewMode.VIEW,timeRange:this.props.timeRange}}))),a()(this,"_onLoadComplete",(t=>{this._isMounted&&t&&this._subscriptions.add(t.getOutput$().pipe(Object(Wt.distinctUntilChanged)((({timeslice:t},{timeslice:e})=>_.a.isEqual(t,e)))).subscribe((({timeslice:e})=>{this.props.waitForTimesliceToLoad$.pipe(Object(Wt.first)()).subscribe((()=>{t.anyControlOutputConsumerLoading$.next(!1)})),this.props.setTimeslice(void 0===e?void 0:{from:e[0],to:e[1]})})))}))}componentWillUnmount(){this._isMounted=!1,this._subscriptions.unsubscribe()}componentDidMount(){this._isMounted=!0}render(){return Object(A.jsx)("div",{className:"mapTimeslider mapTimeslider--animation"},Object(A.jsx)(Xt.ControlGroupRenderer,{ref:this._onLoadComplete,getCreationOptions:this._getCreationOptions,timeRange:this.props.timeRange}))}}const Jt=Object(i.connect)((function(t){return{timeRange:Object(V.K)(t)}}),(function(t){return{setTimeslice:e=>{t(Object(z.ob)({forceRefresh:!1,timeslice:e}))}}}))(timeslider_Timeslider);var Zt=n(61);const{mgrsToDD:Kt,mgrstoUSNG:Qt,utmToDD:$t,withinRange:te,ddToMGRS:ee,ddToUTM:ne,converter:ie}=Zt.geoUtils;class decimal_degrees_form_DecimalDegreesForm extends l.Component{constructor(...t){super(...t),a()(this,"state",{lat:this.props.center.lat,lon:this.props.center.lon,zoom:this.props.zoom}),a()(this,"_onLatChange",(t=>{const e=parseFloat(t.target.value);this.setState({lat:isNaN(e)?"":e})})),a()(this,"_onLonChange",(t=>{const e=parseFloat(t.target.value);this.setState({lon:isNaN(e)?"":e})})),a()(this,"_onZoomChange",(t=>{const e=parseFloat(t.target.value);this.setState({zoom:isNaN(e)?"":e})})),a()(this,"_onSubmit",(()=>{const{lat:t,lon:e,zoom:n}=this.state;this.props.onSubmit(t,e,n)}))}render(){const{isInvalid:t,error:e}=te(this.state.lat,-90,90),{isInvalid:n,error:i}=te(this.state.lon,-180,180),{isInvalid:r,error:o}=te(this.state.zoom,this.props.settings.minZoom,this.props.settings.maxZoom);return Object(A.jsx)(d.EuiForm,null,Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.latitudeLabel",{defaultMessage:"Latitude"}),isInvalid:t,error:e,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{compressed:!0,value:this.state.lat,onChange:this._onLatChange,isInvalid:t,"data-test-subj":"latitudeInput"})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.longitudeLabel",{defaultMessage:"Longitude"}),isInvalid:n,error:i,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{compressed:!0,value:this.state.lon,onChange:this._onLonChange,isInvalid:n,"data-test-subj":"longitudeInput"})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.zoomLabel",{defaultMessage:"Zoom"}),isInvalid:r,error:o,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{compressed:!0,value:this.state.zoom,onChange:this._onZoomChange,isInvalid:r,"data-test-subj":"zoomInput"})),Object(A.jsx)(d.EuiSpacer,{size:"s"}),Object(A.jsx)(d.EuiTextAlign,{textAlign:"right"},Object(A.jsx)(d.EuiButton,{size:"s",fill:!0,disabled:t||n||r,onClick:this._onSubmit,"data-test-subj":"submitViewButton"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.setViewControl.submitButtonLabel",defaultMessage:"Go"}))))}}class mgrs_form_MgrsForm extends l.Component{constructor(...t){super(...t),a()(this,"state",{mgrs:ee(this.props.center.lat,this.props.center.lon),zoom:this.props.zoom}),a()(this,"_onMGRSChange",(t=>{this.setState({mgrs:_.a.isNull(t.target.value)?"":t.target.value})})),a()(this,"_onZoomChange",(t=>{const e=parseFloat(t.target.value);this.setState({zoom:isNaN(e)?"":e})})),a()(this,"_onSubmit",(()=>{const t=this._toPoint();t&&this.props.onSubmit(t.north,t.east,this.state.zoom)}))}_toPoint(){return""===this.state.mgrs?void 0:Kt(this.state.mgrs)}_isMgrsInvalid(){const t=this._toPoint();return void 0===t||!t.north||_.a.isNaN(t.north)||!t.south||_.a.isNaN(t.south)||!t.east||_.a.isNaN(t.east)||!t.west||_.a.isNaN(t.west)}render(){const t=this._isMgrsInvalid(),e=t?p.i18n.translate("xpack.maps.setViewControl.mgrsInvalid",{defaultMessage:"MGRS is invalid"}):null,{isInvalid:n,error:i}=te(this.state.zoom,this.props.settings.minZoom,this.props.settings.maxZoom);return Object(A.jsx)(d.EuiForm,null,Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.mgrsLabel",{defaultMessage:"MGRS"}),isInvalid:t,error:e,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldText,{compressed:!0,value:this.state.mgrs,onChange:this._onMGRSChange,isInvalid:t,"data-test-subj":"mgrsInput"})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.zoomLabel",{defaultMessage:"Zoom"}),isInvalid:n,error:i,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{compressed:!0,value:this.state.zoom,onChange:this._onZoomChange,isInvalid:n,"data-test-subj":"zoomInput"})),Object(A.jsx)(d.EuiSpacer,{size:"s"}),Object(A.jsx)(d.EuiTextAlign,{textAlign:"right"},Object(A.jsx)(d.EuiButton,{size:"s",fill:!0,disabled:t||n,onClick:this._onSubmit,"data-test-subj":"submitViewButton"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.setViewControl.submitButtonLabel",defaultMessage:"Go"}))))}}class utm_form_UtmForm extends l.Component{constructor(t){super(t),a()(this,"_onZoneChange",(t=>{this.setState({zone:_.a.isNull(t.target.value)?"":t.target.value})})),a()(this,"_onEastingChange",(t=>{this.setState({easting:_.a.isNull(t.target.value)?"":t.target.value})})),a()(this,"_onNorthingChange",(t=>{this.setState({northing:_.a.isNull(t.target.value)?"":t.target.value})})),a()(this,"_onZoomChange",(t=>{const e=parseFloat(t.target.value);this.setState({zoom:isNaN(e)?"":e})})),a()(this,"_onSubmit",(()=>{const t=this._toPoint();t&&this.props.onSubmit(t.lat,t.lon,this.state.zoom)}));const e=ne(this.props.center.lat,this.props.center.lon);this.state={northing:e.northing,easting:e.easting,zone:e.zone,zoom:this.props.zoom}}_toPoint(){const{northing:t,easting:e,zone:n}=this.state;return""===t||""===e||n.length<2?void 0:$t(t,e,n.substring(0,n.length-1))}_isUtmInvalid(){return void 0===this._toPoint()}render(){const t=this._isUtmInvalid(),e=t||""===this.state.northing?p.i18n.translate("xpack.maps.setViewControl.utmInvalidNorthing",{defaultMessage:"UTM Northing is invalid"}):null,n=t||""===this.state.northing?p.i18n.translate("xpack.maps.setViewControl.utmInvalidEasting",{defaultMessage:"UTM Easting is invalid"}):null,i=t||""===this.state.northing?p.i18n.translate("xpack.maps.setViewControl.utmInvalidZone",{defaultMessage:"UTM Zone is invalid"}):null,{isInvalid:r,error:o}=te(this.state.zoom,this.props.settings.minZoom,this.props.settings.maxZoom);return Object(A.jsx)(d.EuiForm,null,Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.utmZoneLabel",{defaultMessage:"UTM Zone"}),isInvalid:t,error:i,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldText,{compressed:!0,value:this.state.zone,onChange:this._onZoneChange,isInvalid:t,"data-test-subj":"utmZoneInput"})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.utmEastingLabel",{defaultMessage:"UTM Easting"}),isInvalid:t,error:n,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{compressed:!0,value:this.state.easting,onChange:this._onEastingChange,isInvalid:t,"data-test-subj":"utmEastingInput"})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.utmNorthingLabel",{defaultMessage:"UTM Northing"}),isInvalid:t,error:e,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{compressed:!0,value:this.state.northing,onChange:this._onNorthingChange,isInvalid:t,"data-test-subj":"utmNorthingInput"})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.setViewControl.zoomLabel",{defaultMessage:"Zoom"}),isInvalid:r,error:o,display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{compressed:!0,value:this.state.zoom,onChange:this._onZoomChange,isInvalid:r,"data-test-subj":"zoomInput"})),Object(A.jsx)(d.EuiSpacer,{size:"s"}),Object(A.jsx)(d.EuiTextAlign,{textAlign:"right"},Object(A.jsx)(d.EuiButton,{size:"s",fill:!0,disabled:t||r,onClick:this._onSubmit,"data-test-subj":"submitViewButton"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.setViewControl.submitButtonLabel",defaultMessage:"Go"}))))}}const re="mgrs",oe=[{id:"dd",label:p.i18n.translate("xpack.maps.setViewControl.decimalDegreesLabel",{defaultMessage:"Decimal degrees"})},{id:"utm",label:"UTM"},{id:re,label:"MGRS"}];class set_view_form_SetViewForm extends l.Component{constructor(...t){super(...t),a()(this,"state",{coordinateSystem:"dd",isPopoverOpen:!1}),a()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})})),a()(this,"_onCoordinateSystemChange",(t=>{this._closePopover(),this.setState({coordinateSystem:t})}))}_renderForm(){return this.state.coordinateSystem===re?Object(A.jsx)(mgrs_form_MgrsForm,{settings:this.props.settings,zoom:this.props.zoom,center:this.props.center,onSubmit:this.props.onSubmit}):"utm"===this.state.coordinateSystem?Object(A.jsx)(utm_form_UtmForm,{settings:this.props.settings,zoom:this.props.zoom,center:this.props.center,onSubmit:this.props.onSubmit}):Object(A.jsx)(decimal_degrees_form_DecimalDegreesForm,{settings:this.props.settings,zoom:this.props.zoom,center:this.props.center,onSubmit:this.props.onSubmit})}render(){return Object(A.jsx)("div",{"data-test-subj":"mapSetViewForm",style:{width:240}},Object(A.jsx)(d.EuiPopover,{panelPaddingSize:"s",isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,button:Object(A.jsx)(d.EuiButtonEmpty,{iconType:"controlsHorizontal",size:"xs",onClick:this._togglePopover},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.setViewControl.changeCoordinateSystemButtonLabel",defaultMessage:"Coordinate system"}))},Object(A.jsx)(d.EuiRadioGroup,{options:oe,idSelected:this.state.coordinateSystem,onChange:this._onCoordinateSystemChange})),this._renderForm())}}class set_view_control_SetViewControl extends l.Component{constructor(...t){super(...t),a()(this,"state",{isPopoverOpen:!1}),a()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})})),a()(this,"_onSubmit",((t,e,n)=>{this._closePopover(),this.props.onSubmit({lat:t,lon:e,zoom:n})}))}render(){return Object(A.jsx)(d.EuiPopover,{anchorPosition:"leftUp",panelPaddingSize:"s",button:Object(A.jsx)(d.EuiPanel,{paddingSize:"none",className:"mapToolbarOverlay__button"},Object(A.jsx)(d.EuiButtonIcon,{className:"mapToolbarOverlay__buttonIcon-empty",size:"s",onClick:this._togglePopover,"data-test-subj":"toggleSetViewVisibilityButton",iconType:"crosshairs",color:"text","aria-label":p.i18n.translate("xpack.maps.setViewControl.goToButtonLabel",{defaultMessage:"Go to"}),title:p.i18n.translate("xpack.maps.setViewControl.goToButtonLabel",{defaultMessage:"Go to"})})),isOpen:this.state.isPopoverOpen,closePopover:this._closePopover},Object(A.jsx)(set_view_form_SetViewForm,{settings:this.props.settings,zoom:this.props.zoom,center:this.props.center,onSubmit:this._onSubmit}))}}const se=Object(i.connect)((function(t){return{settings:Object(V.y)(t),zoom:Object(V.z)(t),center:Object(V.t)(t)}}),(function(t){return{onSubmit:({lat:e,lon:n,zoom:i})=>{t(Object(z.cb)({lat:e,lon:n,zoom:i}))}}}))(set_view_control_SetViewControl);var ae=n(274),le=n(48),ue=n(275);class distance_filter_form_DistanceFilterForm extends l.Component{constructor(...t){super(...t),a()(this,"state",{actionId:le.ACTION_GLOBAL_APPLY_FILTER,filterLabel:""}),a()(this,"_onFilterLabelChange",(t=>{this.setState({filterLabel:t.target.value})})),a()(this,"_onActionIdChange",(t=>{this.setState({actionId:t})})),a()(this,"_onSubmit",(()=>{this.props.onSubmit({actionId:this.state.actionId,filterLabel:this.state.filterLabel})}))}render(){return Object(A.jsx)(d.EuiForm,{className:this.props.className},Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.distanceFilterForm.filterLabelLabel",{defaultMessage:"Filter label"}),display:"rowCompressed"},Object(A.jsx)(d.EuiFieldText,{compressed:!0,value:this.state.filterLabel,onChange:this._onFilterLabelChange})),Object(A.jsx)(ue.a,{getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,value:this.state.actionId,onChange:this._onActionIdChange}),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(d.EuiTextAlign,{textAlign:"right"},Object(A.jsx)(d.EuiButton,{size:"s",fill:!0,onClick:this._onSubmit},this.props.buttonLabel)))}}const ce=p.i18n.translate("xpack.maps.toolbarOverlay.drawShapeLabel",{defaultMessage:"Draw shape to filter data"}),he=p.i18n.translate("xpack.maps.toolbarOverlay.drawBoundsLabel",{defaultMessage:"Draw bounds to filter data"}),de=p.i18n.translate("xpack.maps.toolbarOverlay.drawDistanceLabel",{defaultMessage:"Draw distance to filter data"}),pe=p.i18n.translate("xpack.maps.toolbarOverlay.drawShapeLabelShort",{defaultMessage:"Draw shape"}),fe=p.i18n.translate("xpack.maps.toolbarOverlay.drawBoundsLabelShort",{defaultMessage:"Draw bounds"}),ge=p.i18n.translate("xpack.maps.toolbarOverlay.drawDistanceLabelShort",{defaultMessage:"Draw distance"});class tools_control_ToolsControl extends l.Component{constructor(...t){super(...t),a()(this,"state",{isPopoverOpen:!1}),a()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1}),this.props.filterModeActive&&this.props.cancelDraw()})),a()(this,"_initiateShapeDraw",(t=>{this.props.initiateDraw({drawShape:x.y.POLYGON,...t}),this._closePopover()})),a()(this,"_initiateBoundsDraw",(t=>{this.props.initiateDraw({drawShape:x.y.BOUNDS,...t}),this._closePopover()})),a()(this,"_initiateDistanceDraw",(t=>{this.props.initiateDraw({drawShape:x.y.DISTANCE,...t}),this._closePopover()}))}_getDrawPanels(){const t=[{name:ce,panel:1},{name:he,panel:2},{name:de,panel:3}];return[{id:0,title:p.i18n.translate("xpack.maps.toolbarOverlay.tools.toolbarTitle",{defaultMessage:"Tools"}),items:t},{id:1,title:pe,content:Object(A.jsx)(ae.a,{className:"mapDrawControl__geometryFilterForm",buttonLabel:pe,getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,intitialGeometryLabel:p.i18n.translate("xpack.maps.toolbarOverlay.drawShape.initialGeometryLabel",{defaultMessage:"shape"}),onSubmit:this._initiateShapeDraw})},{id:2,title:fe,content:Object(A.jsx)(ae.a,{className:"mapDrawControl__geometryFilterForm",buttonLabel:fe,getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,intitialGeometryLabel:p.i18n.translate("xpack.maps.toolbarOverlay.drawBounds.initialGeometryLabel",{defaultMessage:"bounds"}),onSubmit:this._initiateBoundsDraw})},{id:3,title:ge,content:Object(A.jsx)(distance_filter_form_DistanceFilterForm,{className:"mapDrawControl__geometryFilterForm",buttonLabel:ge,getFilterActions:this.props.getFilterActions,getActionContext:this.props.getActionContext,onSubmit:this._initiateDistanceDraw})}]}_renderToolsButton(){return Object(A.jsx)(d.EuiPanel,{paddingSize:"none",className:"mapToolbarOverlay__button"},Object(A.jsx)(d.EuiButtonIcon,{className:"mapToolbarOverlay__buttonIcon-empty",size:"s",color:"text",iconType:"wrench",onClick:this._togglePopover,"aria-label":p.i18n.translate("xpack.maps.toolbarOverlay.toolsControlTitle",{defaultMessage:"Tools"}),title:p.i18n.translate("xpack.maps.toolbarOverlay.toolsControlTitle",{defaultMessage:"Tools"}),isDisabled:this.props.disableToolsControl}))}render(){const t=Object(A.jsx)(d.EuiPopover,{id:"toolsControlPopover",button:this._renderToolsButton(),isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,panelPaddingSize:"none",anchorPosition:"leftUp","data-test-subj":"mapToolsControlPopover"},Object(A.jsx)(d.EuiContextMenu,{initialPanelId:0,panels:this._getDrawPanels()}));return this.props.filterModeActive?Object(A.jsx)(d.EuiFlexGroup,{gutterSize:"s"},Object(A.jsx)(d.EuiFlexItem,null,t),Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(d.EuiButton,{size:"s",fill:!0,onClick:this.props.cancelDraw},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.tooltip.toolsControl.cancelDrawButtonLabel",defaultMessage:"Cancel"})))):t}}const me=Object(i.connect)((function(t){return{filterModeActive:Object(U.c)(t)===x.x.DRAW_FILTERS}}),(function(t){return{cancelDraw:()=>{t(Object(z.yb)(null)),t(Object(z.X)(x.x.NONE))},initiateDraw:e=>{t(Object(z.X)(x.x.DRAW_FILTERS)),t(Object(z.yb)(e))}}}))(tools_control_ToolsControl);var _e=n(62);const ye=t=>Object(A.jsx)("svg",o()({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),Object(A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z"})),ve=t=>Object(A.jsx)("svg",o()({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 16 16"},t),Object(A.jsx)("path",{d:"M11.506 3.881l.707.707-7.594 7.594-.707-.707z"}),Object(A.jsx)("path",{fillRule:"evenodd",d:"M5 11H1v4h4v-4zm-1 1H2v2h2v-2zM15 1h-4v4h4V1zm-1 1h-2v2h2V2z",clipRule:"evenodd"})),be=t=>Object(A.jsx)("svg",o()({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 16 16"},t),Object(A.jsx)("path",{fillRule:"evenodd",d:"M1.5 2a.5.5 0 01.5-.5h12a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H2a.5.5 0 01-.5-.5V2zm1 .5v11h11v-11h-11z",clipRule:"evenodd"})),xe=Object(i.connect)((function(t){const e=Object(V.f)(t);return{drawShape:e?e.drawShape:void 0}}),(function(t){return{setDrawShape:e=>{t(Object(z.Ab)(e))}}}))((function(t){const e=t.drawShape===x.y.LINE,n=t.drawShape===x.y.POLYGON,i=t.drawShape===x.y.DISTANCE,r=t.drawShape===x.y.BOUNDS,o=t.drawShape===x.y.POINT,s=t.drawShape===x.y.DELETE,a=t.drawShape===x.y.WAIT;function l(e){e&&t.drawShape===e?t.setDrawShape(null):t.setDrawShape(e)}return Object(A.jsx)(_e.TrackApplicationView,{viewId:"featureEditTools"},Object(A.jsx)(d.EuiPanel,{paddingSize:"none",className:"mapToolbarOverlay__buttonGroup mapToolbarOverlay__buttonGroupAnimated"},t.pointsOnly?null:Object(A.jsx)(u.a.Fragment,null,Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!e}),key:"line",size:"s",onClick:()=>l(x.y.LINE),iconType:ve,"aria-label":p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawLineLabel",{defaultMessage:"Draw line"}),title:p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawLineTitle",{defaultMessage:"Draw line"}),"aria-pressed":e,isSelected:e,display:e?"fill":"empty",isDisabled:a}),Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!n}),key:"polygon",size:"s",onClick:()=>l(x.y.POLYGON),iconType:"node","aria-label":p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawPolygonLabel",{defaultMessage:"Draw polygon"}),title:p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawPolygonTitle",{defaultMessage:"Draw polygon"}),"aria-pressed":n,isSelected:n,display:n?"fill":"empty",isDisabled:a}),Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!i}),key:"circle",size:"s",onClick:()=>l(x.y.DISTANCE),iconType:ye,"aria-label":p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawCircleLabel",{defaultMessage:"Draw circle"}),title:p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawCircleTitle",{defaultMessage:"Draw circle"}),"aria-pressed":i,isSelected:i,display:i?"fill":"empty",isDisabled:a}),Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!r}),key:"boundingBox",size:"s",onClick:()=>l(x.y.BOUNDS),iconType:be,"aria-label":p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawBBoxLabel",{defaultMessage:"Draw bounding box"}),title:p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawBBoxTitle",{defaultMessage:"Draw bounding box"}),"aria-pressed":r,isSelected:r,display:r?"fill":"empty",isDisabled:a})),Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!o}),key:"point",size:"s",onClick:()=>l(x.y.POINT),iconType:"dot","aria-label":p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawPointLabel",{defaultMessage:"Draw point"}),title:p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.drawPointTitle",{defaultMessage:"Draw point"}),"aria-pressed":o,isSelected:o,display:o?"fill":"empty",isDisabled:a}),Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!s}),key:"delete",size:"s",onClick:()=>l(x.y.DELETE),iconType:"trash","aria-label":p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.deletePointOrShapeLabel",{defaultMessage:"Delete point or shape"}),title:p.i18n.translate("xpack.maps.toolbarOverlay.featureDraw.deletePointOrShapeTitle",{defaultMessage:"Delete point or shape"}),"aria-pressed":s,isSelected:s,display:s?"fill":"empty",isDisabled:a})))})),Ee=Object(i.connect)((function(t){return{autoFitToDataBounds:Object(V.y)(t).autoFitToDataBounds}}),(function(t){return{fitToBounds:()=>{t(Object(z.B)())}}}))((function(t){const e=p.i18n.translate("xpack.maps.fitToData.label",{defaultMessage:"Fit to data bounds"});let n=e;return t.autoFitToDataBounds&&(n=`${n}. `+p.i18n.translate("xpack.maps.fitToData.autoFitToDataBounds",{defaultMessage:'Map setting "auto fit map to data bounds" enabled, map will automatically pan and zoom to show the data bounds.'})),Object(A.jsx)(d.EuiPanel,{paddingSize:"none",className:"mapToolbarOverlay__button"},Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!t.autoFitToDataBounds}),size:"s",onClick:t.fitToBounds,"data-test-subj":"fitToData",iconType:"expand","aria-label":e,title:n,display:t.autoFitToDataBounds?"fill":"empty"}))})),Se=Object(i.connect)((function(t){return{isTimesliderOpen:Object(U.h)(t)}}),(function(t){return{closeTimeslider:()=>{t(Object(z.v)())},openTimeslider:()=>{t(Object(z.N)())}}}))((function(t){const e=t.isTimesliderOpen?p.i18n.translate("xpack.maps.timesliderToggleButton.closeLabel",{defaultMessage:"Close timeslider"}):p.i18n.translate("xpack.maps.timesliderToggleButton.openLabel",{defaultMessage:"Open timeslider"});return Object(A.jsx)(d.EuiPanel,{paddingSize:"none",className:"mapToolbarOverlay__button"},Object(A.jsx)(d.EuiButtonIcon,{className:h()({"mapToolbarOverlay__buttonIcon-empty":!t.isTimesliderOpen}),size:"s",onClick:function(){t.isTimesliderOpen?t.closeTimeslider():t.openTimeslider()},"data-test-subj":"timesliderToggleButton",iconType:"timeslider","aria-label":e,title:e,isSelected:t.isTimesliderOpen,display:t.isTimesliderOpen?"fill":"empty"}))})),Ce=Object(i.connect)((function(t){return{showToolsControl:0!==Object(V.j)(t).length,shapeDrawModeActive:Object(U.c)(t)===x.x.DRAW_SHAPES,pointDrawModeActive:Object(U.c)(t)===x.x.DRAW_POINTS}}))((function(t){const e=t.addFilters&&t.showToolsControl?Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(me,{getFilterActions:t.getFilterActions,getActionContext:t.getActionContext,disableToolsControl:t.pointDrawModeActive||t.shapeDrawModeActive})):null,n=t.showFitToBoundsButton?Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(Ee,null)):null,i=t.showTimesliderButton?Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(Se,null)):null,r=t.shapeDrawModeActive||t.pointDrawModeActive?Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(xe,{pointsOnly:t.pointDrawModeActive})):null;return Object(A.jsx)(d.EuiFlexGroup,{className:"mapToolbarOverlay",responsive:!1,direction:"column",alignItems:"flexStart",gutterSize:"s"},Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(se,null)),n,e,i,r)}));var Ie=n(43),Oe=n(53);function we({applyGlobalQuery:t,label:e,setApplyGlobalQuery:n,isFeatureEditorOpenForLayer:i}){const r=i?p.i18n.translate("xpack.maps.filterEditor.isGlobalSearchNotApplied",{defaultMessage:"Global search is not applied to the layer while editing features"}):p.i18n.translate("xpack.maps.filterEditor.applyGlobalFilterHelp",{defaultMessage:"When enabled, results narrowed by global search"});return Object(A.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(A.jsx)(d.EuiToolTip,{position:"top",content:r},Object(A.jsx)(d.EuiSwitch,{label:e,checked:!i&&t,onChange:t=>{n(t.target.checked)},"data-test-subj":"mapLayerPanelApplyGlobalQueryCheckbox",compressed:!0,disabled:i})))}function Le({applyGlobalTime:t,label:e,setApplyGlobalTime:n,isFeatureEditorOpenForLayer:i}){const r=i?p.i18n.translate("xpack.maps.filterEditor.isGlobalTimeNotApplied",{defaultMessage:"Global time is not applied to the layer while editing features"}):p.i18n.translate("xpack.maps.filterEditor.applyGlobalTimeHelp",{defaultMessage:"When enabled, results narrowed by global time"});return Object(A.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(A.jsx)(d.EuiToolTip,{position:"top",content:r},Object(A.jsx)(d.EuiSwitch,{label:e,checked:!i&&t,onChange:t=>{n(t.target.checked)},"data-test-subj":"mapLayerPanelApplyGlobalTimeCheckbox",compressed:!0,disabled:i})))}function Te({applyForceRefresh:t,setApplyForceRefresh:e}){return Object(A.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(A.jsx)(d.EuiToolTip,{position:"top",content:p.i18n.translate("xpack.maps.filterEditor.applyForceRefreshTooltip",{defaultMessage:'When enabled, layer re-fetches data when automatic refresh fires and when "Refresh" is clicked.'})},Object(A.jsx)(d.EuiSwitch,{label:p.i18n.translate("xpack.maps.filterEditor.applyForceRefreshLabel",{defaultMessage:"Apply global refresh to layer data"}),checked:t,onChange:t=>{e(t.target.checked)},"data-test-subj":"mapLayerPanelRespondToForceRefreshCheckbox",compressed:!0})))}class filter_editor_FilterEditor extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"state",{isPopoverOpen:!1,indexPatterns:[],isSourceTimeAware:!1}),a()(this,"_toggle",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_close",(()=>{this.setState({isPopoverOpen:!1})})),a()(this,"_onQueryChange",(({query:t})=>{t&&(this.props.setLayerQuery(this.props.layer.getId(),t),this._close())})),a()(this,"_onApplyGlobalQueryChange",(t=>{this.props.updateSourceProp(this.props.layer.getId(),"applyGlobalQuery",t)})),a()(this,"_onApplyGlobalTimeChange",(t=>{this.props.updateSourceProp(this.props.layer.getId(),"applyGlobalTime",t)})),a()(this,"_onRespondToForceRefreshChange",(t=>{this.props.updateSourceProp(this.props.layer.getId(),"applyForceRefresh",t)}))}componentDidMount(){this._isMounted=!0,this._loadIndexPatterns(),this._loadSourceTimeAware()}componentWillUnmount(){this._isMounted=!1}async _loadIndexPatterns(){const t=this.props.layer.getSource().getIndexPatternIds(),e=[],n=t.map((async t=>{try{const n=await Object(S.u)().get(t);e.push(n)}catch(t){}}));await Promise.all(n),this._isMounted&&this.setState({indexPatterns:e})}async _loadSourceTimeAware(){const t=await this.props.layer.getSource().isTimeAware();this._isMounted&&this.setState({isSourceTimeAware:t})}_renderQueryPopover(){const t=this.props.layer.getQuery(),e=Object(S.H)();return Object(A.jsx)(d.EuiPopover,{id:"layerQueryPopover",button:this._renderOpenButton(),isOpen:this.state.isPopoverOpen,closePopover:this._close,anchorPosition:"leftCenter",ownFocus:!0},Object(A.jsx)("div",{className:"mapFilterEditor","data-test-subj":"mapFilterEditor"},Object(A.jsx)(e,{appName:x.e,showFilterBar:!1,showDatePicker:!1,showQueryInput:!0,query:t||Object(S.i)().query.queryString.getDefaultQuery(),onQuerySubmit:this._onQueryChange,indexPatterns:this.state.indexPatterns,customSubmitButton:Object(A.jsx)(d.EuiButton,{fill:!0,"data-test-subj":"mapFilterEditorSubmitButton"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.filterEditor.queryBarSubmitButtonLabel",defaultMessage:"Set filter"}))})))}_renderQuery(){if(this.props.isFeatureEditorOpenForLayer)return Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.filterEditor.isLayerFilterNotApplied",defaultMessage:"Layer filter is not applied while editing features"});const t=this.props.layer.getQuery();return t&&t.query?Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiCodeBlock,{paddingSize:"s"},t.query),Object(A.jsx)(d.EuiSpacer,{size:"m"})):Object(A.jsx)(d.EuiText,{size:"s"},Object(A.jsx)("p",null,Object(A.jsx)(d.EuiTextColor,{color:"subdued"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.filterEditor.emptyState.description",defaultMessage:"Add a filter to narrow the layer data."}))))}_renderOpenButton(){const t=this.props.layer.getQuery(),e=t&&t.query?p.i18n.translate("xpack.maps.layerPanel.filterEditor.editFilterButtonLabel",{defaultMessage:"Edit filter"}):p.i18n.translate("xpack.maps.layerPanel.filterEditor.addFilterButtonLabel",{defaultMessage:"Set filter"}),n=t&&t.query?"pencil":"plusInCircleFilled";return Object(A.jsx)(d.EuiButtonEmpty,{size:"xs",onClick:this._toggle,"data-test-subj":"mapLayerPanelOpenFilterEditorButton",iconType:n,disabled:this.props.isFeatureEditorOpenForLayer},e)}render(){const t=this.state.isSourceTimeAware?Object(A.jsx)(Le,{label:p.i18n.translate("xpack.maps.filterEditor.applyGlobalTimeCheckboxLabel",{defaultMessage:"Apply global time to layer data"}),applyGlobalTime:this.props.layer.getSource().getApplyGlobalTime(),setApplyGlobalTime:this._onApplyGlobalTimeChange,isFeatureEditorOpenForLayer:this.props.isFeatureEditorOpenForLayer}):null;return Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.filterEditor.title",defaultMessage:"Filtering"}))),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(d.EuiFlexGroup,{direction:"row",wrap:!1,component:"span"},Object(A.jsx)(d.EuiFlexItem,{grow:1},this._renderQueryPopover()),Object(A.jsx)(d.EuiFlexItem,{grow:6},this._renderQuery())),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(d.EuiHorizontalRule,{size:"full",margin:"s"}),Object(A.jsx)(we,{label:p.i18n.translate("xpack.maps.filterEditor.applyGlobalQueryCheckboxLabel",{defaultMessage:"Apply global search to layer data"}),applyGlobalQuery:this.props.layer.getSource().getApplyGlobalQuery(),setApplyGlobalQuery:this._onApplyGlobalQueryChange,isFeatureEditorOpenForLayer:this.props.isFeatureEditorOpenForLayer}),t,Object(A.jsx)(Te,{applyForceRefresh:this.props.layer.getSource().getApplyForceRefresh(),setApplyForceRefresh:this._onRespondToForceRefreshChange}))}}const Ne=Object(i.connect)((function(t){var e;const n=Object(V.G)(t);return{layer:n,isFeatureEditorOpenForLayer:(null===(e=Object(V.f)(t))||void 0===e?void 0:e.layerId)===n.getId()}}),(function(t){return{setLayerQuery:(e,n)=>{t(Object(z.jb)(e,n))},updateSourceProp:(e,n,i)=>t(Object(z.Ob)(e,n,i))}}))(filter_editor_FilterEditor);var je=n(24),Me=n(81),Pe=n(101),Fe=n(148),Re=n(147),Ae=n(299),De=n(136);function ke(t){const[e,n]=Object(l.useState)(void 0),[i,r]=Object(l.useState)([]),[o,s]=Object(l.useState)(!1),[a,c]=Object(l.useState)(!1);Object(l.useEffect)((()=>{if(void 0===t.sourceDescriptor.indexPatternId)return;let e=!1;return s(!0),Object(S.u)().get(t.sourceDescriptor.indexPatternId).then((t=>{e||(s(!1),n(t),r(Object(Me.b)(t.fields)))})).catch((t=>{e||(s(!1),c(!0))})),()=>{e=!0}}),[]);const h=a?Object(A.jsx)(u.a.Fragment,null,Object(A.jsx)(d.EuiCallOut,{color:"warning"},Object(A.jsx)("p",null,p.i18n.translate("xpack.maps.spatialJoinExpression.noDataViewTitle",{defaultMessage:"Unable to load data view {dataViewId}.",values:{dataViewId:t.sourceDescriptor.indexPatternId}}))),Object(A.jsx)(d.EuiSpacer,{size:"s"})):null,f=e?Object(A.jsx)(Fe.a,{value:t.sourceDescriptor.geoField?t.sourceDescriptor.geoField:"",onChange:e=>{e&&t.onSourceDescriptorChange({...t.sourceDescriptor,geoField:e})},geoFields:i,isClearable:!1}):null;return Object(A.jsx)("div",{style:{width:300}},Object(A.jsx)(d.EuiPopoverTitle,null,p.i18n.translate("xpack.maps.spatialJoinExpression.popoverTitle",{defaultMessage:"Configure spatial join"})),Object(A.jsx)(d.EuiSkeletonText,{lines:3,isLoading:o},Object(A.jsx)(d.EuiFormRow,{label:Re.a.relationshipLabel},Object(A.jsx)(Ae.a,{distance:"number"==typeof t.sourceDescriptor.distance?t.sourceDescriptor.distance:De.a,onDistanceChange:e=>{t.onSourceDescriptorChange({...t.sourceDescriptor,distance:e})}})),h,Object(A.jsx)(Pe.a,{dataView:e,onChange:e=>{c(!1),n(e);const i=Object(Me.b)(e.fields);r(i),t.onSourceDescriptorChange({...t.sourceDescriptor,indexPatternId:e.id,geoField:i.length?i[0].name:void 0})}}),f))}function Be(t){const[e,n]=Object(l.useState)(!1),{geoField:i}=t.sourceDescriptor,r=void 0!==i?p.i18n.translate("xpack.maps.spatialJoinExpression.value",{defaultMessage:"features from {geoField}",values:{geoField:i}}):p.i18n.translate("xpack.maps.spatialJoinExpression.emptyValue",{defaultMessage:"-- configure spatial join --"});return Object(A.jsx)(d.EuiPopover,{id:t.sourceDescriptor.id,isOpen:e,closePopover:()=>{n(!1)},ownFocus:!0,initialFocus:"body",anchorPosition:"leftCenter",button:Object(A.jsx)(d.EuiExpression,{onClick:()=>{n(!e)},description:p.i18n.translate("xpack.maps.spatialJoinExpression.description",{defaultMessage:"Join with"}),uppercase:!1,value:r}),repositionOnScroll:!0},Object(A.jsx)(ke,{sourceDescriptor:t.sourceDescriptor,onSourceDescriptorChange:t.onSourceDescriptorChange}))}var Ge=n(74),ze=n(95),Ve=n(278);function Ue(t){function e(e){if(!e||0===e.length)return;const{term:n,...i}=t.sourceDescriptor;t.onSourceDescriptorChange({...i,indexPatternId:e})}function n(e){var n,i;const r=null==e||null===(n=e[0])||void 0===n||null===(i=n.value)||void 0===i?void 0:i.name;r&&t.onLeftFieldChange(r)}const{leftSourceName:i}=t;return Object(A.jsx)("div",{style:{width:300}},Object(A.jsx)(d.EuiPopoverTitle,null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.termJoinExpression.popoverTitle",defaultMessage:"Configure term join"})),Object(A.jsx)(d.EuiFormHelpText,{className:"mapJoinExpressionHelpText"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.termJoinExpression.helpText",defaultMessage:"Configure the shared key that combines layer features, the left source, with the results of an Elasticsearch aggregation, the right source."})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.termJoinExpression.leftSourceLabel",{defaultMessage:"Left source"})},Object(A.jsx)(d.EuiComboBox,{selectedOptions:i?[{value:i,label:i}]:[],isDisabled:!0})),function(){const{leftValue:e,leftFields:i}=t;if(!i)return null;const r=i.map((t=>({value:t,label:t.label})));let o;e&&(o=r.find((t=>t.value.name===e)));const s=o?[o]:[];return Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.termJoinExpression.leftFieldLabel",{defaultMessage:"Left field"}),helpText:p.i18n.translate("xpack.maps.termJoinExpression.leftSourceLabelHelpText",{defaultMessage:"Left source field that contains the shared key."})},Object(A.jsx)(d.EuiComboBox,{placeholder:Re.a.fieldSelectPlaceholder,singleSelection:!0,isClearable:!1,options:r,selectedOptions:s,onChange:n}))}(),function(){var n;if(!t.leftValue)return null;const i=Object(S.t)();return Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.termJoinExpression.rightSourceLabel",{defaultMessage:"Right source"})},Object(A.jsx)(i,{placeholder:Object(Ge.d)(),indexPatternId:null!==(n=t.sourceDescriptor.indexPatternId)&&void 0!==n?n:"",onChange:e,isClearable:!1}))}(),t.rightFields&&t.leftValue?Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.termJoinExpression.rightFieldLabel",{defaultMessage:"Right field"}),helpText:p.i18n.translate("xpack.maps.termJoinExpression.rightSourceLabelHelpText",{defaultMessage:"Right source field that contains the shared key."})},Object(A.jsx)(ze.a,{placeholder:Re.a.fieldSelectPlaceholder,value:null!==(r=t.sourceDescriptor.term)&&void 0!==r?r:null,onChange:function(e){e&&0!==e.length&&t.onSourceDescriptorChange({...t.sourceDescriptor,term:e})},fields:Object(Me.i)(t.rightFields),isClearable:!1})):null,t.leftValue?Object(A.jsx)(Ve.a,{initialValue:void 0!==t.sourceDescriptor.size?t.sourceDescriptor.size:x.s,min:1,max:x.s,onChange:e=>{t.onSourceDescriptorChange({...t.sourceDescriptor,size:e})},label:p.i18n.translate("xpack.maps.termJoinExpression.rightSizeLabel",{defaultMessage:"Right size"}),helpText:p.i18n.translate("xpack.maps.termJoinExpression.rightSizeHelpText",{defaultMessage:"Right field term limit."})}):null);var r}function qe(t){const[e,n]=Object(l.useState)(!1),{size:i,term:r}=t.sourceDescriptor,o=void 0!==r?p.i18n.translate("xpack.maps.termJoinExpression.value",{defaultMessage:"{topTerms} terms from {term}",values:{topTerms:void 0!==i?p.i18n.translate("xpack.maps.termJoinExpression.topTerms",{defaultMessage:"top {size}",values:{size:i}}):"",term:r}}):p.i18n.translate("xpack.maps.termJoinExpression.placeholder",{defaultMessage:"-- configure term join --"});return Object(A.jsx)(d.EuiPopover,{id:t.sourceDescriptor.id,isOpen:e,closePopover:()=>{n(!1)},ownFocus:!0,initialFocus:"body",anchorPosition:"leftCenter",button:Object(A.jsx)(d.EuiExpression,{onClick:()=>{n(!e)},description:p.i18n.translate("xpack.maps.termJoinExpression.description",{defaultMessage:"Join with"}),uppercase:!1,value:o}),repositionOnScroll:!0},Object(A.jsx)(Ue,{leftSourceName:t.leftSourceName,leftValue:t.leftValue,leftFields:t.leftFields,onLeftFieldChange:t.onLeftFieldChange,sourceDescriptor:t.sourceDescriptor,onSourceDescriptorChange:t.onSourceDescriptorChange,rightFields:t.rightFields}))}var Ye=n(171);class metrics_expression_MetricsExpression extends l.Component{constructor(...t){super(...t),a()(this,"state",{isPopoverOpen:!1}),a()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})})),a()(this,"_renderMetricsEditor",(()=>this.props.rightFields?Object(A.jsx)(Ye.a,{fields:this.props.rightFields,metrics:this.props.metrics,onChange:this.props.onChange,allowMultipleMetrics:!0,isJoin:!0}):Object(A.jsx)(d.EuiFormErrorText,null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.metricsExpression.joinMustBeSetErrorMessage",defaultMessage:"JOIN must be set"}))))}render(){const t=this.props.metrics.filter((t=>t.type===x.b.COUNT||!!t.field)).map((t=>t.type===x.b.COUNT?x.b.COUNT:`${t.type} ${t.field}`)),e=p.i18n.translate("xpack.maps.layerPanel.metricsExpression.useMetricsDescription",{defaultMessage:"{metricsLength, plural, one {and use metric} other {and use metrics}}",values:{metricsLength:t.length}});return Object(A.jsx)(d.EuiPopover,{id:"metricsPopover",isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,ownFocus:!0,initialFocus:"body",anchorPosition:"leftCenter",button:Object(A.jsx)(d.EuiExpression,{onClick:this._togglePopover,description:e,uppercase:!1,value:t.length>0?t.join(", "):x.b.COUNT}),repositionOnScroll:!0},Object(A.jsx)("div",{style:{width:400}},Object(A.jsx)(d.EuiPopoverTitle,null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.metricsExpression.metricsPopoverTitle",defaultMessage:"Configure join metrics"})),Object(A.jsx)(d.EuiFormHelpText,{className:"mapJoinExpressionHelpText"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.metricsExpression.helpText",defaultMessage:"Metrics are added to layer features and used for data driven styling and tooltip content."})),this._renderMetricsEditor()))}}class where_expression_WhereExpression extends l.Component{constructor(...t){super(...t),a()(this,"state",{isPopoverOpen:!1}),a()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})})),a()(this,"_onQueryChange",(({query:t})=>{this.props.onChange(t),this._closePopover()}))}render(){const t=Object(S.H)(),{whereQuery:e,indexPattern:n}=this.props,i=e&&e.query?e.query:p.i18n.translate("xpack.maps.layerPanel.whereExpression.expressionValuePlaceholder",{defaultMessage:"-- add filter --"});return Object(A.jsx)(d.EuiPopover,{id:"whereClausePopover",isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,ownFocus:!0,anchorPosition:"leftCenter",button:Object(A.jsx)(d.EuiExpression,{onClick:this._togglePopover,description:p.i18n.translate("xpack.maps.layerPanel.whereExpression.expressionDescription",{defaultMessage:"where"}),uppercase:!1,value:i,"data-test-subj":"mapJoinWhereExpressionButton"}),repositionOnScroll:!0},Object(A.jsx)("div",{className:"mapFilterEditor","data-test-subj":"mapJoinWhereFilterEditor"},Object(A.jsx)(d.EuiFormHelpText,{className:"mapJoinExpressionHelpText"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.whereExpression.helpText",defaultMessage:"Use a query to narrow right source."})),Object(A.jsx)(t,{appName:x.e,showFilterBar:!1,showDatePicker:!1,showQueryInput:!0,query:e||Object(S.i)().query.queryString.getDefaultQuery(),onQuerySubmit:this._onQueryChange,indexPatterns:[n],customSubmitButton:Object(A.jsx)(d.EuiButton,{fill:!0,"data-test-subj":"mapWhereFilterEditorSubmitButton"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.whereExpression.queryBarSubmitButtonLabel",defaultMessage:"Set filter"}))})))}}var We=n(163);class join_Join extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"_nextIndexPatternId",void 0),a()(this,"state",{rightFields:[],indexPattern:void 0,loadError:void 0}),a()(this,"_onLeftFieldChange",(t=>{this.props.onChange({leftField:t,right:this.props.join.right})})),a()(this,"_onRightSourceDescriptorChange",(t=>{var e;const n=t.indexPatternId;(null===(e=this.state.indexPattern)||void 0===e?void 0:e.id)!==n&&(this.setState({indexPattern:void 0,rightFields:[],loadError:void 0}),n&&this._loadRightFields(n)),this.props.onChange({leftField:this.props.join.leftField,right:{...t}})})),a()(this,"_onMetricsChange",(t=>{this.props.onChange({leftField:this.props.join.leftField,right:{...this.props.join.right,metrics:t}})})),a()(this,"_onWhereQueryChange",(t=>{this.props.onChange({leftField:this.props.join.leftField,right:{...this.props.join.right,whereQuery:t}})})),a()(this,"_onApplyGlobalQueryChange",(t=>{this.props.onChange({leftField:this.props.join.leftField,right:{...this.props.join.right,applyGlobalQuery:t}})})),a()(this,"_onApplyGlobalTimeChange",(t=>{this.props.onChange({leftField:this.props.join.leftField,right:{...this.props.join.right,applyGlobalTime:t}})}))}componentDidMount(){this._isMounted=!0,this._loadRightFields(_.a.get(this.props.join,"right.indexPatternId"))}componentWillUnmount(){this._isMounted=!1}async _loadRightFields(t){if(!t)return;let e;this._nextIndexPatternId=t;try{e=await Object(S.u)().get(t)}catch(e){return void(this._isMounted&&this.setState({loadError:Object(Ge.c)(t)}))}this._isMounted&&this._nextIndexPatternId===t&&this.setState({rightFields:e.fields.filter((t=>!je.indexPatterns.isNestedField(t))),indexPattern:e})}render(){var t;const{join:e,onRemove:n,leftFields:i,leftSourceName:r}=this.props,{rightFields:o,indexPattern:s}=this.state,a=null!==(t=null==e?void 0:e.right)&&void 0!==t?t:{};let l,u,c,h,f,g=!1;return a.type===x.Ab.ES_TERM_SOURCE?(g=void 0!==e.leftField&&Object(De.g)(a),l=Object(A.jsx)(qe,{leftSourceName:r,leftValue:e.leftField,leftFields:i,onLeftFieldChange:this._onLeftFieldChange,sourceDescriptor:a,onSourceDescriptorChange:this._onRightSourceDescriptorChange,rightFields:o})):Object(We.a)(this.props.join)?(g=void 0!==e.leftField&&Object(De.e)(a),l=Object(A.jsx)(Be,{sourceDescriptor:a,onSourceDescriptorChange:this._onRightSourceDescriptorChange})):l=Object(A.jsx)(d.EuiText,{size:"s"},Object(A.jsx)("p",null,Object(A.jsx)(d.EuiTextColor,{color:"warning"},p.i18n.translate("xpack.maps.layerPanel.join.joinExpression.noEditorMsg",{defaultMessage:"Unable to edit {type} join.",values:{type:a.type}})))),g&&(u=Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(metrics_expression_MetricsExpression,{metrics:a.metrics?a.metrics:[{type:x.b.COUNT}],rightFields:o,onChange:this._onMetricsChange})),c=Object(A.jsx)(we,{applyGlobalQuery:void 0===a.applyGlobalQuery||a.applyGlobalQuery,setApplyGlobalQuery:this._onApplyGlobalQueryChange,label:p.i18n.translate("xpack.maps.layerPanel.join.applyGlobalQueryCheckboxLabel",{defaultMessage:"Apply global search to join"})}),this.state.indexPattern&&this.state.indexPattern.timeFieldName&&(h=Object(A.jsx)(Le,{applyGlobalTime:void 0===a.applyGlobalTime||a.applyGlobalTime,setApplyGlobalTime:this._onApplyGlobalTimeChange,label:p.i18n.translate("xpack.maps.layerPanel.join.applyGlobalTimeCheckboxLabel",{defaultMessage:"Apply global time to join"})}))),s&&g&&(f=Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(where_expression_WhereExpression,{indexPattern:s,whereQuery:a.whereQuery,onChange:this._onWhereQueryChange}))),Object(A.jsx)("div",{className:"mapJoinItem"},Object(A.jsx)(d.EuiFlexGroup,{className:"mapJoinItem__inner",responsive:!1,wrap:!0,gutterSize:"s"},Object(A.jsx)(d.EuiFlexItem,{grow:!1},l),u,f),c,h,Object(A.jsx)(d.EuiButtonIcon,{className:"mapJoinItem__delete",iconType:"trash",color:"danger","aria-label":p.i18n.translate("xpack.maps.layerPanel.join.deleteJoinAriaLabel",{defaultMessage:"Delete join"}),title:p.i18n.translate("xpack.maps.layerPanel.join.deleteJoinTitle",{defaultMessage:"Delete join"}),onClick:n}))}}function He(){const[t,e]=Object(l.useState)(!1);return Object(A.jsx)(d.EuiPopover,{id:"joinHelpPopover",anchorPosition:"leftCenter",button:Object(A.jsx)(d.EuiButtonIcon,{onClick:()=>{e(!t)},iconType:"documentation","aria-label":"Join documentation"}),isOpen:t,closePopover:()=>{e(!1)},repositionOnScroll:!0,ownFocus:!0},Object(A.jsx)(d.EuiPopoverTitle,null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.joinEditor.title",defaultMessage:"Joins"})),Object(A.jsx)("div",null,Object(A.jsx)(d.EuiText,{size:"s",style:{maxWidth:"36em"}},Object(A.jsx)("p",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.joinDocs.intro",defaultMessage:"Joins add metrics to layer features for data driven styling and tooltip content."})," ",Object(A.jsx)("i",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.joinDocs.noMatches",defaultMessage:"Layer features that do have a matches are not visible on the map."}))),Object(A.jsx)("dl",null,Object(A.jsx)("dt",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.joinDocs.termJoinTitle",defaultMessage:"Term join"})),Object(A.jsx)("dd",null,Object(A.jsx)("p",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.joinDocs.termsJoinIntro",defaultMessage:"A term join uses a shared key to combine layer features with metrics from an Elasticsearch terms aggregation."})),Object(A.jsx)(d.EuiLink,{href:Object(S.k)().links.maps.termJoinsExample,target:"_blank",external:!0},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.joinDocs.linkLabel",defaultMessage:"Term join example"}))),Object(A.jsx)("dt",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.joinDocs.spatialJoinTitle",defaultMessage:"Spatial join"})),Object(A.jsx)("dd",null,Object(A.jsx)("p",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.joinDocs.spatialJoinIntro",defaultMessage:"A spatial join uses a geospatial relationship to combine layer features with metrics from an Elasticsearch geo query filters aggregation."})))))))}function Xe(t){const e=Object(A.jsx)(d.EuiButtonEmpty,{onClick:t.onClick,size:"xs",iconType:"plusInCircleFilled","aria-label":t.label,isDisabled:t.isDisabled},t.label);return t.isDisabled?Object(A.jsx)(d.EuiToolTip,{content:t.disabledReason},e):e}const Je=Object(i.connect)((function(t){return{joins:Object(V.I)(t)}}),(function(t){return{onChange:(e,n)=>{t(Object(z.fb)(e,n))}}}))((function({joins:t,layer:e,onChange:n,leftJoinFields:i,layerDisplayName:r}){const[o,s]=Object(l.useState)(!1),[a,u]=Object(l.useState)(""),[c,h]=Object(l.useState)(!1);Object(l.useEffect)((()=>{let t=!1;const n=e.getSource();return n.isESSource()?n.isMvt()?(u(p.i18n.translate("xpack.maps.layerPanel.joinEditor.spatialJoin.disabled.geoJsonOnly",{defaultMessage:"Spatial joins are not supported with vector tiles."})),void s(!1)):(h(!0),n.getSupportedShapeTypes().then((e=>{if(!t){const t=1===e.length&&e[0]===x.Fb.POINT;if(!t)return u(p.i18n.translate("xpack.maps.layerPanel.joinEditor.spatialJoin.disabled.pointsOnly",{defaultMessage:"Spatial joins are not supported with geo_shape geometry."})),s(t),void h(!1);u(""),s(!0),h(!1)}})).catch((t=>{})),()=>{t=!0}):(u(p.i18n.translate("xpack.maps.layerPanel.joinEditor.spatialJoin.disabled.esSourceOnly",{defaultMessage:"Spatial joins are not supported for {sourceType}.",values:{sourceType:n.getType()}})),void s(!1))}),[e]);const g=i=>{var r;n(e,[...t,{...i,right:{...null!==(r=null==i?void 0:i.right)&&void 0!==r?r:{}}}])};return Object(A.jsx)("div",null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.joinEditor.title",defaultMessage:"Joins"})," ",Object(A.jsx)(He,null))),t.map(((o,s)=>{var a,l;return Object(A.jsx)(join_Join,{key:null!==(a=null==o||null===(l=o.right)||void 0===l?void 0:l.id)&&void 0!==a?a:s,join:o,onChange:i=>{n(e,[...t.slice(0,s),i,...t.slice(s+1)])},onRemove:()=>{n(e,[...t.slice(0,s),...t.slice(s+1)])},leftFields:i,leftSourceName:r})})),Object(A.jsx)(d.EuiSkeletonText,{lines:1,isLoading:c},Object(A.jsx)(d.EuiTextAlign,{textAlign:"center"},Object(A.jsx)(Xe,{disabledReason:a,isDisabled:!o,label:p.i18n.translate("xpack.maps.layerPanel.joinEditor.spatialJoin.addButtonLabel",{defaultMessage:"Add spatial join"}),onClick:()=>{g({leftField:"_id",right:{type:x.Ab.ES_DISTANCE_SOURCE,id:Object(f.v4)(),applyGlobalQuery:!0,applyGlobalTime:!0}})}}),Object(A.jsx)(Xe,{disabledReason:p.i18n.translate("xpack.maps.layerPanel.joinEditor.termJoin.mvtSingleJoinMsg",{defaultMessage:"Vector tiles can only support a single join."}),isDisabled:e.getSource().isMvt()&&t.length>=1,label:p.i18n.translate("xpack.maps.layerPanel.joinEditor.termJoin.addButtonLabel",{defaultMessage:"Add term join"}),onClick:()=>{g({right:{type:x.Ab.ES_TERM_SOURCE,id:Object(f.v4)(),applyGlobalQuery:!0,applyGlobalTime:!0}})}}))))}));var Ze=n(133);class flyout_footer_FlyoutFooter extends l.Component{constructor(...t){super(...t),a()(this,"state",{showRemoveModal:!1}),a()(this,"_showRemoveModal",(()=>{this.setState({showRemoveModal:!0})}))}render(){const t=this.props.selectedLayer&&this.state.showRemoveModal?Object(A.jsx)(Ft,{layer:this.props.selectedLayer,onCancel:()=>{this.setState({showRemoveModal:!1})},onConfirm:()=>{this.setState({showRemoveModal:!1}),this.props.removeLayer()}}):null;return Object(A.jsx)(u.a.Fragment,null,t,Object(A.jsx)(d.EuiFlexGroup,{responsive:!1},Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiButtonEmpty,{onClick:this.props.cancelLayerPanel,flush:"left","data-test-subj":"layerPanelCancelButton"},this.props.hasStateChanged?Ze.a.discardChanges:Ze.a.close)),Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(d.EuiSpacer,null)),Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiButtonEmpty,{color:"danger",onClick:this._showRemoveModal,flush:"right","data-test-subj":"mapRemoveLayerButton"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.footer.removeLayerButtonLabel",defaultMessage:"Remove layer"}))),Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiButton,{disabled:!this.props.hasStateChanged,iconType:"check",onClick:this.props.saveLayerEdits,fill:!0},Ze.a.keepChanges))))}}const Ke=Object(i.connect)((function(t){return{hasStateChanged:Object(V.N)(t),selectedLayer:Object(V.G)(t)}}),(t=>({cancelLayerPanel:()=>{t(Object(z.Cb)(Dt.c.NONE)),t(Object(z.qb)(null))},saveLayerEdits:()=>{t(Object(z.Cb)(Dt.c.NONE)),t(Object(z.S)()),t(Object(z.qb)(null))},removeLayer:()=>{t(Object(z.R)())}})))(flyout_footer_FlyoutFooter);var Qe=n(127);function $e({alpha:t,onChange:e}){return Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.layerTransparencyLabel",{defaultMessage:"Opacity"}),display:"columnCompressed"},Object(A.jsx)(Qe.a,{min:0,max:100,step:1,value:Math.round(100*t),onChange:t=>{e(t/100)},showInput:!0,showRange:!0,compressed:!0,append:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.percentageLabel",{defaultMessage:"%",description:"Percentage"})}))}class attribution_popover_AttributionPopover extends l.Component{constructor(...t){super(...t),a()(this,"state",{isPopoverOpen:!1,label:this.props.label,url:this.props.url}),a()(this,"_togglePopover",(()=>{this.setState((t=>({isPopoverOpen:!t.isPopoverOpen})))})),a()(this,"_closePopover",(()=>{this.setState({isPopoverOpen:!1})})),a()(this,"_onApply",(()=>{this.props.onChange({label:this.state.label,url:this.state.url}),this._closePopover()})),a()(this,"_onLabelChange",(t=>{this.setState({label:t.target.value})})),a()(this,"_onUrlChange",(t=>{this.setState({url:t.target.value})}))}_renderPopoverButton(){return Object(A.jsx)(d.EuiButtonEmpty,{className:this.props.popoverButtonClassName,"aria-label":this.props.popoverButtonAriaLabel,onClick:this._togglePopover,size:"xs",iconType:this.props.popoverButtonIcon,flush:"left"},this.props.popoverButtonLabel)}_renderContent(){const t=0!==this.state.label.length&&0!==this.state.url.length,e=this.state.label!==this.props.label||this.state.url!==this.props.url;return Object(A.jsx)("div",{className:"mapAttributionPopover"},Object(A.jsx)(d.EuiPopoverTitle,null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.attribution.attributionFormLabel",defaultMessage:"Attribution"})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.attribution.labelFieldLabel",{defaultMessage:"Label"}),fullWidth:!0},Object(A.jsx)(d.EuiFieldText,{compressed:!0,fullWidth:!0,value:this.state.label,onChange:this._onLabelChange})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.attribution.urlLabel",{defaultMessage:"Link"}),fullWidth:!0},Object(A.jsx)(d.EuiFieldText,{compressed:!0,fullWidth:!0,value:this.state.url,onChange:this._onUrlChange})),Object(A.jsx)(d.EuiSpacer,{size:"xs"}),Object(A.jsx)(d.EuiPopoverFooter,null,Object(A.jsx)(d.EuiTextAlign,{textAlign:"right"},Object(A.jsx)(d.EuiButton,{fill:!0,isDisabled:!t||!e,onClick:this._onApply,size:"s"},Ze.a.apply))))}render(){return Object(A.jsx)(d.EuiPopover,{id:"attributionPopover",panelPaddingSize:"s",anchorPosition:"leftCenter",button:this._renderPopoverButton(),isOpen:this.state.isPopoverOpen,closePopover:this._closePopover,ownFocus:!0},this._renderContent())}}function tn(t){return t.layer.getSource().getAttributionProvider()?null:function(){const e=t.layer.getDescriptor();return Object(A.jsx)("fieldset",{"aria-labelledby":"mapsLayerSettingsAttributionLegend"},Object(A.jsx)("div",{className:"mapAttributionFormRow"},Object(A.jsx)("legend",{id:"mapsLayerSettingsAttributionLegend",className:"mapAttributionFormRow__legend"},p.i18n.translate("xpack.maps.layerSettings.attributionLegend",{defaultMessage:"Attribution"})),void 0===e.attribution?Object(A.jsx)("div",{className:"mapAttributionFormRow__field"},Object(A.jsx)(attribution_popover_AttributionPopover,{onChange:t.onChange,popoverButtonIcon:"plusInCircleFilled",popoverButtonLabel:p.i18n.translate("xpack.maps.attribution.addBtnLabel",{defaultMessage:"Add attribution"}),popoverButtonAriaLabel:p.i18n.translate("xpack.maps.attribution.addBtnAriaLabel",{defaultMessage:"Add attribution"}),popoverButtonClassName:"mapAttributionFormRow__addButton",label:"",url:""})):Object(A.jsx)("div",{className:"mapAttributionFormRow__field"},Object(A.jsx)(d.EuiPanel,{color:"subdued",paddingSize:"s"},Object(A.jsx)(d.EuiLink,{color:"text",href:e.attribution.url,target:"_blank"},e.attribution.label)),Object(A.jsx)("div",{className:"mapAttributionFormRow__buttons"},Object(A.jsx)(attribution_popover_AttributionPopover,{onChange:t.onChange,popoverButtonIcon:"pencil",popoverButtonAriaLabel:p.i18n.translate("xpack.maps.attribution.editBtnAriaLabel",{defaultMessage:"Edit attribution"}),popoverButtonLabel:Ze.a.edit,label:e.attribution.label,url:e.attribution.url}),Object(A.jsx)(d.EuiButtonEmpty,{onClick:()=>{t.onChange()},size:"xs",iconType:"trash",color:"danger","aria-label":p.i18n.translate("xpack.maps.attribution.clearBtnAriaLabel",{defaultMessage:"Clear attribution"})},Ze.a.clear)))))}()}const en=Object(i.connect)(null,(function(t){return{clearLayerAttribution:e=>t(Object(z.q)(e)),setLayerAttribution:(e,n)=>t(Object(z.gb)(e,n)),updateLabel:(e,n)=>t(Object(z.Gb)(e,n)),updateLocale:(e,n)=>t(Object(z.Hb)(e,n)),updateMinZoom:(e,n)=>t(Object(z.Jb)(e,n)),updateMaxZoom:(e,n)=>t(Object(z.Ib)(e,n)),updateAlpha:(e,n)=>t(Object(z.Eb)(e,n)),updateLabelsOnTop:(e,n)=>t(Object(z.Db)(e,n)),updateIncludeInFitToBounds:(e,n)=>t(Object(z.Bb)(e,n)),updateDisableTooltips:(e,n)=>t(Object(z.xb)(e,n))}}))((function(t){const e=t.layer.getMinSourceZoom(),n=x.hb,i=t.layer.getId(),r=e=>{const{value:n}=e.target;n&&t.updateLocale(i,n)},o=e=>{t.updateDisableTooltips(i,!e.target.checked)};return Object(A.jsx)(l.Fragment,null,Object(Ot.c)(t.layer)?Object(A.jsx)(u.a.Fragment,null,Object(A.jsx)(d.EuiCallOut,{title:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.layerGroupCalloutTitle",{defaultMessage:"Drag layers in and out of the group"}),iconType:"layers"},Object(A.jsx)(d.EuiText,null,Object(A.jsx)("ul",null,Object(A.jsx)("li",null,p.i18n.translate("xpack.maps.layerPanel.settingsPanel.layerGroupAddToFront",{defaultMessage:"To add your first layer, drag it onto the group name."})),Object(A.jsx)("li",null,p.i18n.translate("xpack.maps.layerPanel.settingsPanel.layerGroupAddToPosition",{defaultMessage:"To add another layer, drag it anywhere above the last layer in the group."})),Object(A.jsx)("li",null,p.i18n.translate("xpack.maps.layerPanel.settingsPanel.layerGroupRemove",{defaultMessage:"To remove a layer, drag it above or below the group."}))))),Object(A.jsx)(d.EuiSpacer,{size:"m"})):null,Object(A.jsx)(d.EuiPanel,null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.layerSettingsTitle",defaultMessage:"Layer settings"}))),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.layerNameLabel",{defaultMessage:"Name"}),display:"columnCompressed"},Object(A.jsx)(d.EuiFieldText,{value:t.layer.getLabel(),onChange:e=>{const n=e.target.value;t.updateLabel(i,n)},compressed:!0})),Object(Ot.c)(t.layer)?null:Object(A.jsx)(Ie.ValidatedDualRange,{label:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.visibleZoomLabel",{defaultMessage:"Visibility"}),formRowDisplay:"columnCompressed",min:e,max:n,value:[t.layer.getMinZoom(),t.layer.getMaxZoom()],showInput:"inputWithPopover",showRange:!0,showLabels:!0,onChange:r=>{t.updateMinZoom(i,Math.max(e,parseInt(r[0],10))),t.updateMaxZoom(i,Math.min(n,parseInt(r[1],10)))},allowEmptyRange:!1,compressed:!0,prepend:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.visibleZoom",{defaultMessage:"Zoom levels"})}),Object(Ot.c)(t.layer)?null:Object(A.jsx)($e,{alpha:t.layer.getAlpha(),onChange:e=>{t.updateAlpha(i,e)}}),t.layer.supportsLabelsOnTop()?Object(A.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(A.jsx)(d.EuiSwitch,{label:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.labelsOnTop",{defaultMessage:"Show labels on top"}),checked:t.layer.areLabelsOnTop(),onChange:e=>{t.updateLabelsOnTop(i,e.target.checked)},"data-test-subj":"mapLayerPanelApplyGlobalQueryCheckbox",compressed:!0})):null,(()=>{var e;if(!t.layer.supportsLabelLocales())return null;const n=[{text:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.labelLanguageAutoselectDropDown",{defaultMessage:"Autoselect based on Kibana locale"}),value:x.g},{value:"ar",text:"العربية"},{value:"de",text:"Deutsch"},{value:"en",text:"English"},{value:"es",text:"Español"},{value:"fr-fr",text:"Français"},{value:"hi-in",text:"हिन्दी"},{value:"it",text:"Italiano"},{value:"ja-jp",text:"日本語"},{value:"ko",text:"한국어"},{value:"pt-pt",text:"Português"},{value:"ru-ru",text:"русский"},{value:"zh-cn",text:"简体中文"},{text:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.labelLanguageNoneDropDown",{defaultMessage:"None"}),value:x.pb}];return Object(A.jsx)(d.EuiFormRow,{display:"columnCompressed",label:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.labelLanguageLabel",{defaultMessage:"Label language"})},Object(A.jsx)(d.EuiSelect,{options:n,value:null!==(e=t.layer.getLocale())&&void 0!==e?e:x.pb,onChange:r,compressed:!0}))})(),Object(Ot.c)(t.layer)?null:Object(A.jsx)(tn,{layer:t.layer,onChange:e=>{e?t.setLayerAttribution(i,e):t.clearLayerAttribution(i)}}),!t.supportsFitToBounds||Object(Ot.c)(t.layer)?null:Object(A.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(A.jsx)(d.EuiToolTip,{position:"top",content:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.fittableFlagTooltip",{defaultMessage:"Fit to data bounds adjusts your map extent to show all of your data. Layers may provide reference data and should not be included in the fit to data bounds computation. Use this option to exclude a layer from fit to data bounds computation."})},Object(A.jsx)(d.EuiSwitch,{label:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.fittableFlagLabel",{defaultMessage:"Include layer in fit to data bounds computation"}),checked:t.layer.isIncludeInFitToBounds(),onChange:e=>{t.updateIncludeInFitToBounds(i,e.target.checked)},"data-test-subj":"mapLayerPanelFittableFlagCheckbox",compressed:!0}))),(()=>{if(Object(H.e)(t.layer)){const e=t.layer;return Object(A.jsx)(d.EuiFormRow,{display:"columnCompressedSwitch"},Object(A.jsx)(d.EuiSwitch,{label:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.DisableTooltips",{defaultMessage:"Show tooltips"}),disabled:!e.canShowTooltip(),checked:!e.areTooltipsDisabled(),onChange:o,compressed:!0}))}return null})()),Object(A.jsx)(d.EuiSpacer,{size:"s"}))})),nn=Object(i.connect)((function(t){return{layer:Object(V.G)(t)}}),(function(t){return{updateStyleDescriptor:e=>{t(Object(z.Kb)(e))},updateCustomIcons:e=>{t(Object(z.wb)(e))}}}))((function({layer:t,updateStyleDescriptor:e,updateCustomIcons:n}){const i=t.renderStyleEditor(e,n);return i?Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiPanel,{className:"mapStyleSettings"},Object(A.jsx)(d.EuiFlexGroup,null,Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.layerPanel.styleSettingsTitle",defaultMessage:"Layer style"}))))),Object(A.jsx)(d.EuiSpacer,{size:"m"}),i),Object(A.jsx)(d.EuiSpacer,{size:"s"})):null})),rn=Object(i.connect)((function(t){return{dataFilters:Object(V.c)(t)}}),{})((function(t){const[e,n]=Object(l.useState)(!1),[i,r]=Object(l.useState)([]);return Object(l.useEffect)((()=>{let e=!1;return n(!0),t.source.getImmutableProperties(t.dataFilters).then((t=>{e||(r(t),n(!1))})),()=>{e=!0}}),[t.dataFilters,t.source]),Object(A.jsx)("div",{className:"mapLayerPanel__sourceDetails"},Object(A.jsx)(d.EuiAccordion,{id:"accordion1",buttonContent:p.i18n.translate("xpack.maps.layerPanel.sourceDetailsLabel",{defaultMessage:"Source details"})},Object(A.jsx)(d.EuiSpacer,{size:"xs"}),Object(A.jsx)(d.EuiSkeletonText,{lines:3,size:"s",isLoading:e},Object(A.jsx)(d.EuiText,{color:"subdued",size:"s"},i.map((({label:t,value:e,link:n})=>Object(A.jsx)("p",{key:t,className:"mapLayerPanel__sourceDetail"},Object(A.jsx)("strong",null,t)," ",n?Object(A.jsx)(d.EuiLink,{href:n,target:"_blank"},e):Object(A.jsx)("span",null,e))))))))})),on=new Oe.Storage(window.localStorage);class edit_layer_panel_EditLayerPanel extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"state",{displayName:"",leftJoinFields:[],supportsFitToBounds:!1}),a()(this,"_loadSupportsFitToBounds",(async()=>{if(!this.props.selectedLayer)return;const t=await this.props.selectedLayer.supportsFitToBounds();this._isMounted&&this.setState({supportsFitToBounds:t})})),a()(this,"_loadDisplayName",(async()=>{if(!this.props.selectedLayer)return;const t=await this.props.selectedLayer.getDisplayName();this._isMounted&&this.setState({displayName:t})})),a()(this,"_onSourceChange",((...t)=>this.props.updateSourceProps(this.props.selectedLayer.getId(),t)))}componentDidMount(){this._isMounted=!0,this._loadDisplayName(),this._loadLeftJoinFields(),this._loadSupportsFitToBounds()}componentWillUnmount(){this._isMounted=!1}async _loadLeftJoinFields(){if(!this.props.selectedLayer||!Object(H.e)(this.props.selectedLayer))return;const t=this.props.selectedLayer;if(!t.getSource().supportsJoins()||void 0===t.getLeftJoinFields)return;let e=[];try{const t=(await this.props.selectedLayer.getLeftJoinFields()).map((async t=>({name:t.getName(),label:await t.getLabel()})));e=await Promise.all(t)}catch(t){}this._isMounted&&this.setState({leftJoinFields:e})}_renderLayerErrors(){return this.props.selectedLayer&&this.props.selectedLayer.hasErrors()?Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiCallOut,{color:"warning",title:p.i18n.translate("xpack.maps.layerPanel.settingsPanel.unableToLoadTitle",{defaultMessage:"Unable to load layer"})},Object(A.jsx)("p",{"data-test-subj":"layerErrorMessage"},this.props.selectedLayer.getErrors())),Object(A.jsx)(d.EuiSpacer,{size:"m"})):null}_renderFilterSection(){return this.props.selectedLayer&&!Object(Ot.c)(this.props.selectedLayer)&&this.props.selectedLayer.supportsElasticsearchFilters()?Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiPanel,null,Object(A.jsx)(Ne,null)),Object(A.jsx)(d.EuiSpacer,{size:"s"})):null}_renderJoinSection(){if(!this.props.selectedLayer||!Object(H.e)(this.props.selectedLayer))return;const t=this.props.selectedLayer;return t.getSource().supportsJoins()?Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiPanel,null,Object(A.jsx)(Je,{layer:t,leftJoinFields:this.state.leftJoinFields,layerDisplayName:this.state.displayName})),Object(A.jsx)(d.EuiSpacer,{size:"s"})):null}_renderSourceDetails(){return!this.props.selectedLayer||Object(Ot.c)(this.props.selectedLayer)?null:Object(A.jsx)(rn,{source:this.props.selectedLayer.getSource()})}_renderSourceEditor(){var t;if(!this.props.selectedLayer)return null;const e=this.props.selectedLayer.getDescriptor();return Object(Ot.c)(this.props.selectedLayer)?null:this.props.selectedLayer.renderSourceSettingsEditor({currentLayerType:this.props.selectedLayer.getType(),hasSpatialJoins:(null!==(t=e.joins)&&void 0!==t?t:[]).some(We.a),numberOfJoins:e.joins?e.joins.length:0,onChange:this._onSourceChange,onStyleDescriptorChange:this.props.updateStyleDescriptor,style:this.props.selectedLayer.getStyleForEditing()})}_renderStyleEditor(){return!this.props.selectedLayer||Object(Ot.c)(this.props.selectedLayer)?null:Object(A.jsx)(nn,null)}render(){return this.props.selectedLayer?Object(A.jsx)(Ie.KibanaContextProvider,{services:{appName:"maps",storage:on,data:Object(S.i)(),...Object(S.e)()}},Object(A.jsx)(d.EuiFlexGroup,{direction:"column",gutterSize:"none"},Object(A.jsx)(d.EuiFlyoutHeader,{hasBorder:!0,className:"mapLayerPanel__header"},Object(A.jsx)(d.EuiFlexGroup,{responsive:!1,alignItems:"center",gutterSize:"s"},Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiIcon,{type:this.props.selectedLayer.getLayerTypeIconName()})),Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(d.EuiTitle,{size:"s"},Object(A.jsx)("h2",null,this.state.displayName)))),Object(A.jsx)(d.EuiSpacer,{size:"xs"}),this._renderSourceDetails()),Object(A.jsx)("div",{className:"mapLayerPanel__body"},Object(A.jsx)("div",{className:"mapLayerPanel__bodyOverflow"},this._renderLayerErrors(),Object(A.jsx)(en,{layer:this.props.selectedLayer,supportsFitToBounds:this.state.supportsFitToBounds}),this._renderSourceEditor(),this._renderFilterSection(),this._renderJoinSection(),this._renderStyleEditor())),Object(A.jsx)(d.EuiFlyoutFooter,{className:"mapLayerPanel__footer"},Object(A.jsx)(Ke,null)))):null}}const sn=Object(i.connect)((function(t){const e=Object(V.G)(t);let n="none";return e&&(n=Object(H.e)(e)?`${e.getId()}${e.getSource().supportsJoins()}`:e.getId()),{key:n,selectedLayer:e}}),(function(t){return{updateSourceProps:async(e,n)=>await t(Object(z.Pb)(e,n)),updateStyleDescriptor:e=>{t(Object(z.Kb)(e))}}}))(edit_layer_panel_EditLayerPanel);var an=n(302);const ln=Object(i.connect)((function(t){return{hasPreviewLayers:Object(V.P)(t),autoOpenLayerWizardId:Object(U.a)(t)}}),(function(t){return{addPreviewLayers:e=>{t(Object(z.n)(e))},addLayersAndClose:()=>{t(Object(z.Cb)(Dt.c.NONE)),t(Object(z.O)())},addLayersAndContinue:()=>{t(Object(z.bb)()),t(Object(z.Cb)(Dt.c.LAYER_PANEL)),t(Object(z.O)())},closeFlyout:()=>{t(Object(z.Cb)(Dt.c.NONE)),t(Object(z.Q)())},enableEditMode:()=>{t(Object(z.Y)()),t(Object(z.X)(x.x.DRAW_SHAPES))},clearAutoOpenLayerWizardId:()=>{t(Object(z.W)(""))}}}),null,{forwardRef:!0})(an.b),un=[{id:x.S.LAST_SAVED_LOCATION,label:p.i18n.translate("xpack.maps.mapSettingsPanel.lastSavedLocationLabel",{defaultMessage:"Map location at save"})},{id:x.S.AUTO_FIT_TO_BOUNDS,label:p.i18n.translate("xpack.maps.mapSettingsPanel.autoFitToBoundsLocationLabel",{defaultMessage:"Auto fit map to data bounds"})},{id:x.S.FIXED_LOCATION,label:p.i18n.translate("xpack.maps.mapSettingsPanel.fixedLocationLabel",{defaultMessage:"Fixed location"})},{id:x.S.BROWSER_LOCATION,label:p.i18n.translate("xpack.maps.mapSettingsPanel.browserLocationLabel",{defaultMessage:"Browser location"})}];function cn({center:t,settings:e,updateMapSetting:n,zoom:i}){const r=t=>{let i=parseFloat(t.target.value);isNaN(i)?i=0:i<-90?i=-90:i>90&&(i=90),n("fixedLocation",{...e.fixedLocation,lat:i})},o=t=>{let i=parseFloat(t.target.value);isNaN(i)?i=0:i<-180?i=-180:i>180&&(i=180),n("fixedLocation",{...e.fixedLocation,lon:i})},s=t=>{n("fixedLocation",{...e.fixedLocation,zoom:t})},a=t=>{n("browserLocation",{zoom:t})},l=()=>{n("fixedLocation",{lat:t.lat,lon:t.lon,zoom:Math.round(i)})};return Object(A.jsx)(d.EuiPanel,null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.navigationTitle",defaultMessage:"Navigation"}))),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(d.EuiFormRow,null,Object(A.jsx)(d.EuiSwitch,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.autoFitToDataBoundsLabel",{defaultMessage:"Auto fit map to data bounds"}),checked:e.autoFitToDataBounds,onChange:t=>{n("autoFitToDataBounds",t.target.checked)},compressed:!0,"data-test-subj":"autoFitToDataBoundsSwitch"})),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(Ie.ValidatedDualRange,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.zoomRangeLabel",{defaultMessage:"Zoom range"}),formRowDisplay:"columnCompressed",min:x.lb,max:x.hb,value:[e.minZoom,e.maxZoom],showInput:"inputWithPopover",showRange:!0,showLabels:!0,onChange:t=>{const i=Math.max(x.lb,parseInt(t[0],10)),r=Math.min(x.hb,parseInt(t[1],10));n("minZoom",i),n("maxZoom",r),e.fixedLocation.zoomr&&s(r),e.browserLocation.zoomr&&a(r)},allowEmptyRange:!1,compressed:!0}),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.source.mapSettingsPanel.initialLocationLabel",{defaultMessage:"Initial map location"})},Object(A.jsx)(d.EuiRadioGroup,{options:un,idSelected:e.initialLocation,onChange:t=>{n("initialLocation",t)}})),function(){if(e.initialLocation===x.S.LAST_SAVED_LOCATION||e.initialLocation===x.S.AUTO_FIT_TO_BOUNDS)return null;const t=Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.initialZoomLabel",{defaultMessage:"Initial zoom"}),display:"columnCompressed"},Object(A.jsx)(Qe.a,{min:e.minZoom,max:e.maxZoom,step:1,value:e.initialLocation===x.S.BROWSER_LOCATION?e.browserLocation.zoom:e.fixedLocation.zoom,onChange:e.initialLocation===x.S.BROWSER_LOCATION?a:s,showInput:!0,showRange:!0,compressed:!0}));return e.initialLocation===x.S.BROWSER_LOCATION?t:Object(A.jsx)(u.a.Fragment,null,Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.initialLatLabel",{defaultMessage:"Initial latitude"}),display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{value:e.fixedLocation.lat,onChange:r,compressed:!0})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.initialLonLabel",{defaultMessage:"Initial longitude"}),display:"columnCompressed"},Object(A.jsx)(d.EuiFieldNumber,{value:e.fixedLocation.lon,onChange:o,compressed:!0})),t,Object(A.jsx)(d.EuiFlexGroup,{justifyContent:"flexEnd"},Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiButtonEmpty,{onClick:l},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.useCurrentViewBtnLabel",defaultMessage:"Set to current view"})))))}())}var hn=n(144);function dn({settings:t,updateMapSetting:e}){return Object(A.jsx)(d.EuiPanel,null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.spatialFiltersTitle",defaultMessage:"Spatial filters"}))),Object(A.jsx)(d.EuiSpacer,{size:"m"}),Object(A.jsx)(d.EuiFormRow,null,Object(A.jsx)(d.EuiSwitch,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.showSpatialFiltersLabel",{defaultMessage:"Show spatial filters on map"}),checked:t.showSpatialFilters,onChange:t=>{e("showSpatialFilters",t.target.checked)},compressed:!0})),t.showSpatialFilters?Object(A.jsx)(u.a.Fragment,null,Object(A.jsx)($e,{alpha:t.spatialFiltersAlpa,onChange:t=>{e("spatialFiltersAlpa",t)}}),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.spatialFiltersFillColorLabel",{defaultMessage:"Fill color"}),display:"columnCompressed"},Object(A.jsx)(hn.a,{color:t.spatialFiltersFillColor,onChange:t=>{e("spatialFiltersFillColor",t)}})),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.spatialFiltersLineColorLabel",{defaultMessage:"Border color"}),display:"columnCompressed"},Object(A.jsx)(hn.a,{color:t.spatialFiltersLineColor,onChange:t=>{e("spatialFiltersLineColor",t)}}))):null)}function pn({settings:t,updateMapSetting:e}){return Object(A.jsx)(d.EuiPanel,null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.displayTitle",defaultMessage:"Display"}))),Object(A.jsx)(d.EuiFormRow,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.backgroundColorLabel",{defaultMessage:"Background color"}),display:"columnCompressed"},Object(A.jsx)(hn.a,{color:t.backgroundColor,onChange:t=>{e("backgroundColor",t)}})),Object(A.jsx)(d.EuiFormRow,null,Object(A.jsx)(d.EuiSwitch,{label:p.i18n.translate("xpack.maps.mapSettingsPanel.showScaleLabel",{defaultMessage:"Show scale"}),checked:t.showScaleControl,onChange:t=>{e("showScaleControl",t.target.checked)},compressed:!0})))}var fn=n(159),gn=n(307);class custom_icons_panel_CustomIconsPanel extends l.Component{constructor(...t){super(...t),a()(this,"state",{isModalVisible:!1,selectedIcon:void 0}),a()(this,"_handleIconEdit",(t=>{this.setState({selectedIcon:t,isModalVisible:!0})})),a()(this,"_handleNewIcon",(()=>{this.setState({isModalVisible:!0})})),a()(this,"_renderModal",(()=>{if(!this.state.isModalVisible)return null;if(this.state.selectedIcon){const{symbolId:t,label:e,svg:n,cutoff:i,radius:r}=this.state.selectedIcon;return Object(A.jsx)(gn.a,{title:p.i18n.translate("xpack.maps.mapSettingsPanel.editCustomIcon",{defaultMessage:"Edit custom icon"}),symbolId:t,label:e,svg:n,cutoff:i||x.p,radius:r||x.q,onSave:this._handleSave,onCancel:this._hideModal,onDelete:this._handleDelete})}return Object(A.jsx)(gn.a,{title:p.i18n.translate("xpack.maps.mapSettingsPanel.addCustomIcon",{defaultMessage:"Add custom icon"}),cutoff:x.p,radius:x.q,onSave:this._handleSave,onCancel:this._hideModal})})),a()(this,"_hideModal",(()=>{this.setState({isModalVisible:!1,selectedIcon:void 0})})),a()(this,"_handleSave",(t=>{const{symbolId:e,label:n,svg:i,cutoff:r,radius:o}=t,s=[...this.props.customIcons.filter((t=>t.symbolId!==e)),{symbolId:e,svg:i,label:n,cutoff:r,radius:o}];this.props.updateCustomIcons(s),this._hideModal()})),a()(this,"_handleDelete",(t=>{this.props.deleteCustomIcon(t),this._hideModal()})),a()(this,"_renderCustomIconsList",(()=>{const t=Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiTextAlign,{textAlign:"center"},Object(A.jsx)(d.EuiButtonEmpty,{size:"xs",iconType:"plusInCircleFilled",onClick:()=>this._handleNewIcon(),"data-test-subj":"mapsCustomIconPanel-add"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.customIconsAddIconButton",defaultMessage:"Add"}))));if(!this.props.customIcons.length)return Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiText,{size:"s",textAlign:"center"},Object(A.jsx)("p",null,Object(A.jsx)(d.EuiTextColor,{color:"subdued"},Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.customIcons.emptyState.description",defaultMessage:"Add a custom icon that can be used in layers in this map."})))),t);const e=this.props.customIcons.map((t=>{const{symbolId:e,label:n,svg:i}=t;return{label:n,key:e,icon:Object(A.jsx)(fn.a,{symbolId:n,svg:i,fill:Object(S.y)()?"rgb(223, 229, 239)":"rgb(52, 55, 65)"}),extraAction:{iconType:"gear",alwaysShow:!0,onClick:()=>{this._handleIconEdit(t)}}}}));return Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiListGroup,{listItems:e}),t)}))}render(){return Object(A.jsx)(l.Fragment,null,Object(A.jsx)(d.EuiPanel,null,Object(A.jsx)(d.EuiTitle,{size:"xs"},Object(A.jsx)("h5",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.customIconsTitle",defaultMessage:"Custom icons"}))),Object(A.jsx)(d.EuiSpacer,{size:"m"}),this._renderCustomIconsList()),this._renderModal())}}const mn=Object(i.connect)((function(t){return{center:Object(V.t)(t),customIcons:Object(V.b)(t),hasMapSettingsChanges:Object(V.O)(t),settings:Object(V.y)(t),zoom:Object(V.z)(t)}}),(function(t){return{cancelChanges:()=>{t(Object(z.U)()),t(Object(z.Cb)(Dt.c.NONE))},keepChanges:()=>{t(Object(z.Cb)(Dt.c.NONE))},updateMapSetting:(e,n)=>{t(Object(z.Lb)(e,n))},updateCustomIcons:e=>{t(Object(z.wb)(e))},deleteCustomIcon:e=>{t(Object(z.x)(e))}}}))((function({cancelChanges:t,center:e,hasMapSettingsChanges:n,keepChanges:i,settings:r,customIcons:o,updateMapSetting:s,updateCustomIcons:a,deleteCustomIcon:l,zoom:u}){return Object(A.jsx)(d.EuiFlexGroup,{direction:"column",gutterSize:"none"},Object(A.jsx)(d.EuiFlyoutHeader,{hasBorder:!0,className:"mapLayerPanel__header"},Object(A.jsx)(d.EuiTitle,{size:"s"},Object(A.jsx)("h2",null,Object(A.jsx)(It.FormattedMessage,{id:"xpack.maps.mapSettingsPanel.title",defaultMessage:"Settings"})))),Object(A.jsx)("div",{className:"mapLayerPanel__body"},Object(A.jsx)("div",{className:"mapLayerPanel__bodyOverflow"},Object(A.jsx)(custom_icons_panel_CustomIconsPanel,{customIcons:o,updateCustomIcons:a,deleteCustomIcon:l}),Object(A.jsx)(d.EuiSpacer,{size:"s"}),Object(A.jsx)(pn,{settings:r,updateMapSetting:s}),Object(A.jsx)(d.EuiSpacer,{size:"s"}),Object(A.jsx)(cn,{center:e,settings:r,updateMapSetting:s,zoom:u}),Object(A.jsx)(d.EuiSpacer,{size:"s"}),Object(A.jsx)(dn,{settings:r,updateMapSetting:s}))),Object(A.jsx)(d.EuiFlyoutFooter,{className:"mapLayerPanel__footer"},Object(A.jsx)(d.EuiFlexGroup,{responsive:!1},Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiButtonEmpty,{onClick:t,flush:"left","data-test-subj":"layerPanelCancelButton"},n?Ze.a.discardChanges:Ze.a.close)),Object(A.jsx)(d.EuiFlexItem,null,Object(A.jsx)(d.EuiSpacer,null)),Object(A.jsx)(d.EuiFlexItem,{grow:!1},Object(A.jsx)(d.EuiButton,{disabled:!n,iconType:"check",onClick:i,fill:!0,"data-test-subj":"mapSettingSubmitButton"},Ze.a.keepChanges)))))}));class map_container_MapContainer extends l.Component{constructor(...t){super(...t),a()(this,"_isMounted",!1),a()(this,"_isInitalLoadRenderTimerStarted",!1),a()(this,"state",{isInitialLoadRenderTimeoutComplete:!1,domId:Object(f.v4)(),showFitToBoundsButton:!1,showTimesliderButton:!1}),a()(this,"_onInitialLoadRenderComplete",(()=>{const t=document.querySelector(`[data-dom-id="${this.state.domId}"]`);t&&t.dispatchEvent(new CustomEvent("renderComplete",{bubbles:!0}))})),a()(this,"_startInitialLoadRenderTimer",(()=>{window.setTimeout((()=>{this._isMounted&&(this.setState({isInitialLoadRenderTimeoutComplete:!0}),this._onInitialLoadRenderComplete())}),x.ub)}))}componentDidMount(){this._isMounted=!0,this._loadShowFitToBoundsButton(),this._loadShowTimesliderButton()}componentDidUpdate(){this._loadShowFitToBoundsButton(),this._loadShowTimesliderButton(),!this.props.isSharable||this.props.isMapLoading||this._isInitalLoadRenderTimerStarted||(this._isInitalLoadRenderTimerStarted=!0,this._startInitialLoadRenderTimer())}componentWillUnmount(){this._isMounted=!1,this.props.cancelAllInFlightRequests()}async _loadShowFitToBoundsButton(){const t=this.props.layerList.map((async t=>await t.isFittable())),e=(await Promise.all(t)).some((t=>t));this._isMounted&&this.state.showFitToBoundsButton!==e&&this.setState({showFitToBoundsButton:e})}async _loadShowTimesliderButton(){if(!this.props.settings.showTimesliderToggleButton)return void(this.state.showTimesliderButton&&this.setState({showTimesliderButton:!1}));const t=this.props.layerList.map((async t=>await t.isFilteredByGlobalTime())),e=(await Promise.all(t)).some((t=>t));this._isMounted&&this.state.showTimesliderButton!==e&&this.setState({showTimesliderButton:e})}render(){const{addFilters:t,getFilterActions:e,getActionContext:n,onSingleValueTrigger:i,flyoutDisplay:r,isFullScreen:s,exitFullScreen:a,mapInitError:l,renderTooltipContent:u}=this.props;if(l)return Object(A.jsx)("div",{"data-render-complete":!0,"data-shared-item":!0,"data-title":this.props.title,"data-description":this.props.description},Object(A.jsx)(d.EuiCallOut,{title:p.i18n.translate("xpack.maps.map.initializeErrorTitle",{defaultMessage:"Unable to initialize map"}),color:"danger",iconType:"cross"},Object(A.jsx)("p",null,l)));let c,f=null;r===Dt.c.ADD_LAYER_WIZARD?f=Object(A.jsx)(ln,null):r===Dt.c.LAYER_PANEL?f=Object(A.jsx)(sn,null):r===Dt.c.MAP_SETTINGS_PANEL&&(f=Object(A.jsx)(mn,null)),s&&(c=Object(A.jsx)(g.a,{onExit:a}));const m=this.props.isSharable?{"data-dom-id":this.state.domId,"data-render-complete":this.state.isInitialLoadRenderTimeoutComplete,"data-shared-item":!0,"data-title":this.props.title,"data-description":this.props.description}:{};return Object(A.jsx)(d.EuiFlexGroup,o()({gutterSize:"none",responsive:!1},m),Object(A.jsx)(d.EuiFlexItem,{className:"mapMapWrapper",style:{backgroundColor:this.props.settings.backgroundColor}},Object(A.jsx)(Ct,{addFilters:t,getFilterActions:e,getActionContext:n,onSingleValueTrigger:i,renderTooltipContent:u}),!this.props.settings.hideToolbarOverlay&&!Object(S.V)()&&Object(A.jsx)(Ce,{addFilters:t,getFilterActions:e,getActionContext:n,showFitToBoundsButton:this.state.showFitToBoundsButton,showTimesliderButton:this.state.showTimesliderButton}),Object(A.jsx)(qt,null),this.props.isTimesliderOpen&&Object(A.jsx)(Jt,{waitForTimesliceToLoad$:this.props.waitUntilTimeLayersLoad$})),Object(A.jsx)(d.EuiFlexItem,{className:h()("mapMapLayerPanel",{"mapMapLayerPanel-isVisible":!!f}),grow:!1},f),c)}}const _n=Object(i.connect)((function(t){return{isTimesliderOpen:Object(U.h)(t),isMapLoading:Object(V.Q)(t),flyoutDisplay:Object(U.d)(t),isFullScreen:Object(U.e)(t),mapInitError:Object(V.w)(t),indexPatternIds:Object(V.D)(t),settings:Object(V.y)(t),layerList:Object(V.p)(t)}}),(function(t){return{exitFullScreen:()=>t(Object(z.A)()),cancelAllInFlightRequests:()=>t(Object(z.o)())}}))(map_container_MapContainer)},298:function(t,e,n){"use strict";n.d(e,"b",(function(){return W})),n.d(e,"a",(function(){return es_geo_line_source_ESGeoLineSource}));var i=n(1),r=n(4),o=n.n(r),s=n(2),a=n.n(s),l=n(14),u=n(101),c=n(148),h=n(81),d=n(135),p=n(24),f=n(95),g=n(280),m=n(40);const _=250,y="_tsid";var v=n(3);function b(){return Object(v.jsx)(l.EuiToolTip,{content:Object(v.jsx)(l.EuiText,{size:"s"},Object(v.jsx)("dl",null,Object(v.jsx)("dt",null,d.d),Object(v.jsx)("dd",null,Object(v.jsx)("p",null,Object(v.jsx)(m.FormattedMessage,{id:"xpack.maps.source.esGeoLine.groupBy.timeseriesDescription",defaultMessage:"Create a track for each unique time series. Track is simplifed when number of points exceeds limit."}))),Object(v.jsx)("dt",null,d.c),Object(v.jsx)("dd",null,Object(v.jsx)("p",null,Object(v.jsx)(m.FormattedMessage,{id:"xpack.maps.source.esGeoGrid.groupBy.termsDescription",defaultMessage:"Create a track for top {maxTermsTracks} terms. Track is truncated when number of points exceeds limit.",values:{maxTermsTracks:_}})))))},Object(v.jsx)("span",null,Object(v.jsx)(m.FormattedMessage,{id:"xpack.maps.source.esGeoGrid.groupByLabel",defaultMessage:"Group by"})," ",Object(v.jsx)(l.EuiIcon,{type:"questionInCircle",color:"subdued"})))}var x=n(243),E=n.n(x);function S({onChange:t,value:e}){const[n,i]=Object(r.useState)(e),[,o]=E()((()=>{t(n)}),150,[n]);return Object(r.useEffect)((()=>()=>{o()}),[o]),Object(v.jsx)(l.EuiRange,{value:n,onChange:t=>{i(parseInt(t.currentTarget.value,10))},min:100,max:1e4,showLabels:!0,showValue:!0,step:100})}function C(t){const e=Object(r.useMemo)((()=>Object(h.f)(t.indexPattern)),[t.indexPattern]);return Object(v.jsx)(o.a.Fragment,null,e&&Object(v.jsx)(l.EuiFormRow,{label:Object(v.jsx)(b,null),display:t.isColumnCompressed?"columnCompressed":"row"},Object(v.jsx)(g.a,{groupByTimeseries:t.groupByTimeseries,onGroupByTimeseriesChange:t.onGroupByTimeseriesChange})),t.groupByTimeseries?Object(v.jsx)(l.EuiFormRow,{label:i.i18n.translate("xpack.maps.esGeoLine.lineSImplificationSizeLabel",{defaultMessage:"Simplification threshold"}),helpText:i.i18n.translate("xpack.maps.esGeoLine.lineSImplificationSizeHelpText",{defaultMessage:"The maximum number of points for each track. Track is simplifed when threshold is exceeded. Use smaller values for better performance."}),display:t.isColumnCompressed?"columnCompressed":"row"},Object(v.jsx)(S,{value:t.lineSimplificationSize,onChange:t.onLineSimplificationSizeChange})):Object(v.jsx)(o.a.Fragment,null,Object(v.jsx)(l.EuiFormRow,{label:d.a,display:t.isColumnCompressed?"columnCompressed":"row"},Object(v.jsx)(f.a,{placeholder:i.i18n.translate("xpack.maps.source.esGeoLine.splitFieldPlaceholder",{defaultMessage:"Select entity field"}),value:t.splitField,onChange:function(e){void 0!==e&&t.onSplitFieldChange(e)},fields:Object(h.i)(t.indexPattern.fields),isClearable:!1,compressed:t.isColumnCompressed})),Object(v.jsx)(l.EuiFormRow,{label:d.b,display:t.isColumnCompressed?"columnCompressed":"row"},Object(v.jsx)(f.a,{placeholder:i.i18n.translate("xpack.maps.source.esGeoLine.sortFieldPlaceholder",{defaultMessage:"Select sort field"}),value:t.sortField,onChange:function(e){void 0!==e&&t.onSortFieldChange(e)},fields:t.indexPattern.fields.filter((e=>!(t.splitField&&e.name===t.splitField)&&e.sortable&&!p.indexPatterns.isNestedField(e)&&["number","date"].includes(e.type))),isClearable:!1,compressed:t.isColumnCompressed}))))}class create_source_editor_CreateSourceEditor extends r.Component{constructor(...t){super(...t),a()(this,"state",{indexPattern:null,pointFields:[],geoField:"",groupByTimeseries:!1,splitField:"",sortField:"",lineSimplificationSize:500}),a()(this,"_onIndexPatternSelect",(t=>{const e=Object(h.c)(t.fields);this.setState({indexPattern:t,pointFields:e,groupByTimeseries:Object(h.f)(t),geoField:e.length?e[0].name:"",sortField:t.timeFieldName?t.timeFieldName:""},this.previewLayer)})),a()(this,"_onGeoFieldSelect",(t=>{void 0!==t&&this.setState({geoField:t},this.previewLayer)})),a()(this,"_onGroupByTimeseriesChange",(t=>{this.setState({groupByTimeseries:t},this.previewLayer)})),a()(this,"_onLineSimplificationSizeChange",(t=>{this.setState({lineSimplificationSize:t},this.previewLayer)})),a()(this,"_onSplitFieldSelect",(t=>{this.setState({splitField:t},this.previewLayer)})),a()(this,"_onSortFieldSelect",(t=>{this.setState({sortField:t},this.previewLayer)})),a()(this,"previewLayer",(()=>{const{indexPattern:t,geoField:e,groupByTimeseries:n,splitField:i,sortField:r,lineSimplificationSize:o}=this.state,s=t&&t.id&&e&&(n||i&&r)?{indexPatternId:t.id,geoField:e,groupByTimeseries:n,lineSimplificationSize:o,splitField:i,sortField:r}:null;this.props.onSourceConfigChange(s)}))}_renderGeoSelect(){return this.state.indexPattern?Object(v.jsx)(c.a,{value:this.state.geoField,onChange:this._onGeoFieldSelect,geoFields:this.state.pointFields,isClearable:!1}):null}_renderGeoLineForm(){return this.state.indexPattern&&this.state.geoField?Object(v.jsx)(C,{isColumnCompressed:!1,indexPattern:this.state.indexPattern,onGroupByTimeseriesChange:this._onGroupByTimeseriesChange,onLineSimplificationSizeChange:this._onLineSimplificationSizeChange,onSortFieldChange:this._onSortFieldSelect,onSplitFieldChange:this._onSplitFieldSelect,groupByTimeseries:this.state.groupByTimeseries,lineSimplificationSize:this.state.lineSimplificationSize,sortField:this.state.sortField,splitField:this.state.splitField}):null}render(){return Object(v.jsx)(l.EuiPanel,null,Object(v.jsx)(u.a,{dataView:this.state.indexPattern,onChange:this._onIndexPatternSelect,isGeoPointsOnly:!0}),this._renderGeoSelect(),this._renderGeoLineForm())}}var I=n(39),O=n.n(I),w=n(44),L=n(0),T=n(76),N=n(74),j=n(113);const M=["key","path"];function P(t,e){const n=[];let i=0;const r=O.a.get(t,"aggregations.tracks.buckets",{}),o=Object.keys(r);for(let t=0;t{this.props.onChange({propName:"metrics",value:t})})),a()(this,"_onGroupByTimeseriesChange",(t=>{this.props.onChange({propName:"groupByTimeseries",value:t})})),a()(this,"_onLineSimplificationSizeChange",(t=>{this.props.onChange({propName:"lineSimplificationSize",value:t})})),a()(this,"_onSplitFieldChange",(t=>{this.props.onChange({propName:"splitField",value:t})})),a()(this,"_onSortFieldChange",(t=>{this.props.onChange({propName:"sortField",value:t})}))}componentDidMount(){this._isMounted=!0,this._loadFields()}componentWillUnmount(){this._isMounted=!1}async _loadFields(){let t;try{t=await Object(D.u)().get(this.props.indexPatternId)}catch(t){return}this._isMounted&&this.setState({indexPattern:t,fields:t.fields.filter((t=>!p.indexPatterns.isNestedField(t)))})}render(){return this.state.indexPattern?Object(v.jsx)(r.Fragment,null,Object(v.jsx)(l.EuiPanel,null,Object(v.jsx)(l.EuiTitle,{size:"xs"},Object(v.jsx)("h6",null,Object(v.jsx)(m.FormattedMessage,{id:"xpack.maps.source.esGeoLine.metricsLabel",defaultMessage:"Track metrics"}))),Object(v.jsx)(l.EuiSpacer,{size:"m"}),Object(v.jsx)(A.a,{allowMultipleMetrics:!0,bucketsName:this.props.bucketsName,isJoin:!1,fields:this.state.fields,metrics:this.props.metrics,onChange:this._onMetricsChange})),Object(v.jsx)(l.EuiSpacer,{size:"s"}),Object(v.jsx)(l.EuiPanel,null,Object(v.jsx)(l.EuiTitle,{size:"xs"},Object(v.jsx)("h6",null,Object(v.jsx)(m.FormattedMessage,{id:"xpack.maps.source.esGeoLine.trackSettingsLabel",defaultMessage:"Tracks"}))),Object(v.jsx)(l.EuiSpacer,{size:"m"}),Object(v.jsx)(C,{isColumnCompressed:!0,indexPattern:this.state.indexPattern,onGroupByTimeseriesChange:this._onGroupByTimeseriesChange,onLineSimplificationSizeChange:this._onLineSimplificationSizeChange,onSortFieldChange:this._onSortFieldChange,onSplitFieldChange:this._onSplitFieldChange,groupByTimeseries:this.props.groupByTimeseries,lineSimplificationSize:this.props.lineSimplificationSize,sortField:this.props.sortField,splitField:this.props.splitField})),Object(v.jsx)(l.EuiSpacer,{size:"s"})):null}}var k=n(116),B=n(109),G=n(19),z=n(117);const V=i.i18n.translate("xpack.maps.source.esGeoLineTitle",{defaultMessage:"Tracks"}),U=i.i18n.translate("xpack.maps.source.esGeoLineDisabledReason",{defaultMessage:"{title} requires a Gold license.",values:{title:V}});class es_geo_line_source_ESGeoLineSource extends j.a{static createDescriptor(t){const e=j.a.createDescriptor(t);if(!Object(k.a)(e.geoField))throw new Error("Cannot create an ESGeoLineSource without a geoField");const n="boolean"==typeof e.groupByTimeseries&&e.groupByTimeseries;return{...e,type:L.Ab.ES_GEO_LINE,groupByTimeseries:n,lineSimplificationSize:"number"==typeof e.lineSimplificationSize?e.lineSimplificationSize:500,geoField:e.geoField,splitField:e.splitField,sortField:e.sortField}}constructor(t){const e=es_geo_line_source_ESGeoLineSource.createDescriptor(t);super(e),a()(this,"_descriptor",void 0),this._descriptor=e}getBucketsName(){return i.i18n.translate("xpack.maps.source.esGeoLine.bucketsName",{defaultMessage:"tracks"})}renderSourceSettingsEditor({onChange:t}){var e,n;return Object(v.jsx)(update_source_editor_UpdateSourceEditor,{bucketsName:this.getBucketsName(),indexPatternId:this.getIndexPatternId(),onChange:t,metrics:this._descriptor.metrics,groupByTimeseries:this._descriptor.groupByTimeseries,lineSimplificationSize:this._descriptor.lineSimplificationSize,splitField:null!==(e=this._descriptor.splitField)&&void 0!==e?e:"",sortField:null!==(n=this._descriptor.sortField)&&void 0!==n?n:""})}getSyncMeta(t){return{...super.getSyncMeta(t),groupByTimeseries:this._descriptor.groupByTimeseries,lineSimplificationSize:this._descriptor.lineSimplificationSize,splitField:this._descriptor.splitField,sortField:this._descriptor.sortField}}async getImmutableProperties(){return[{label:Object(N.a)(),value:V},{label:Object(N.b)(),value:await this.getDisplayName()},{label:i.i18n.translate("xpack.maps.source.esGeoLine.geospatialFieldLabel",{defaultMessage:"Geospatial field"}),value:this._descriptor.geoField}]}_createSplitField(){return this._descriptor.splitField?new F.a({fieldName:this._descriptor.splitField,source:this,origin:L.D.SOURCE}):null}_createTsidField(){return new R.a({fieldName:y,label:y,source:this,origin:L.D.SOURCE,dataType:"string"})}async getFields(){const t=this._descriptor.groupByTimeseries?this._createTsidField():this._createSplitField();return t?[...this.getMetricFields(),t]:this.getMetricFields()}getFieldByName(t){return t===this._descriptor.splitField?this._createSplitField():t===y?this._createTsidField():this.getMetricFieldForName(t)}isGeoGridPrecisionAware(){return!1}supportsJoins(){return!1}async getGeoJsonWithMeta(t,e,n,i,r){if(!Object(G.b)())throw new Error(U);return this._descriptor.groupByTimeseries?this._getGeoLineByTimeseries(t,e,n,i,r):this._getGeoLineByTerms(t,e,n,i,r)}async _getGeoLineByTimeseries(t,e,n,r,o){var s,a,l;const u=await this.getIndexPattern(),c=await this.makeSearchSource(e,0);c.setField("trackTotalHits",!1),c.setField("aggs",{totalEntities:{cardinality:{field:"_tsid"}},tracks:{time_series:{},aggs:{path:{geo_line:{point:{field:this._descriptor.geoField},size:this._descriptor.lineSimplificationSize}},...this.getValueAggsDsl(u)}}});const h=await this._runEsQuery({requestId:`${this.getId()}_tracks`,requestName:i.i18n.translate("xpack.maps.source.esGeoLine.timeSeriesTrackRequestName",{defaultMessage:"'{layerName}' tracks request (time series)",values:{layerName:t}}),searchSource:c,registerCancelCallback:n,requestDescription:i.i18n.translate("xpack.maps.source.esGeoLine.timeSeriesTrackRequestDescription",{defaultMessage:"Get tracks from data view: {dataViewName}, geospatial field: {geoFieldName}",values:{dataViewName:u.getName(),geoFieldName:this._descriptor.geoField}}),searchSessionId:e.searchSessionId,executionContext:Object(z.b)({description:"es_geo_line:time_series_tracks"},e.executionContext),requestsAdapter:o.requests}),{featureCollection:d}=P(h,y),p=d.features.length,f=p>=1e4;return{data:d,meta:{areResultsTrimmed:f,areEntitiesTrimmed:f,entityCount:p,numTrimmedTracks:0,totalEntities:null!==(s=null==h||null===(a=h.aggregations)||void 0===a||null===(l=a.totalEntities)||void 0===l?void 0:l.value)&&void 0!==s?s:0}}}async _getGeoLineByTerms(t,e,n,r,o){if(!this._descriptor.splitField)throw new Error(i.i18n.translate("xpack.maps.source.esGeoLine.missingConfigurationError",{defaultMessage:"Unable to create tracks. Provide a value for required configuration '{inputLabel}'",values:{inputLabel:d.a}}));if(!this._descriptor.sortField)throw new Error(i.i18n.translate("xpack.maps.source.esGeoLine.missingConfigurationError",{defaultMessage:"Unable to create tracks. Provide a value for required configuration '{inputLabel}'",values:{inputLabel:d.b}}));const s=await this.getIndexPattern(),a=await this.makeSearchSource(e,0);a.setField("trackTotalHits",!1);const l=Object(T.l)(s,this._descriptor.splitField),u={precision_threshold:_},c={size:_};if(a.setField("aggs",{totalEntities:{cardinality:Object(T.a)(u,l)},entitySplit:{terms:Object(T.a)(c,l)}}),"string"===l.type){const t=Object(w.buildPhraseFilter)(l,"",s);t.meta.negate=!0,a.setField("filter",[...a.getField("filter"),t])}const h=await this._runEsQuery({requestId:`${this.getId()}_entities`,requestName:i.i18n.translate("xpack.maps.source.esGeoLine.entityRequestName",{defaultMessage:"'{layerName}' entities request",values:{layerName:t}}),searchSource:a,registerCancelCallback:n,requestDescription:i.i18n.translate("xpack.maps.source.esGeoLine.entityRequestDescription",{defaultMessage:"Get entities within map buffer from data view: {dataViewName}, entities: {splitFieldName}",values:{dataViewName:s.getName(),splitFieldName:this._descriptor.splitField}}),searchSessionId:e.searchSessionId,executionContext:Object(z.b)({description:"es_geo_line:entities"},e.executionContext),requestsAdapter:o.requests}),p=O.a.get(h,"aggregations.entitySplit.buckets",[]),f=O.a.get(h,"aggregations.totalEntities.value",0),g=p.length>=_;if(0===f)return{data:L.z,meta:{areResultsTrimmed:!1,areEntitiesTrimmed:!1,entityCount:0,numTrimmedTracks:0,totalEntities:0}};const m={};for(let t=0;t0?i.i18n.translate("xpack.maps.esGeoLine.tracksTrimmedMsg",{defaultMessage:"{numTrimmedTracks} of {entityCount} tracks are incomplete.",values:{entityCount:n.entityCount.toLocaleString(),numTrimmedTracks:n.numTrimmedTracks.toLocaleString()}}):void 0;return{tooltipContent:o?`${r} ${o}`:r,areResultsTrimmed:n.areEntitiesTrimmed||n.numTrimmedTracks>0}}isFilterByMapBounds(){return!0}hasTooltipProperties(){return!0}async getSupportedShapeTypes(){return[L.Fb.LINE]}async getTooltipProperties(t){const e=await super.getTooltipProperties(t);return t&&"boolean"==typeof t.complete&&e.push(new B.a("__kbn__track__complete",this._descriptor.groupByTimeseries?i.i18n.translate("xpack.maps.source.esGeoLine.isTrackSimplifiedLabel",{defaultMessage:"track is simplified"}):i.i18n.translate("xpack.maps.source.esGeoLine.isTrackTruncatedLabel",{defaultMessage:"track is truncated"}),(!t.complete).toString())),e}async getLicensedFeatures(){return[G.a.GEO_LINE_AGG]}}var q=n(82),Y=n(72);const W={id:L.Hb.GEO_LINE,order:10,categories:[L.ab.ELASTICSEARCH],description:i.i18n.translate("xpack.maps.source.esGeoLineDescription",{defaultMessage:"Create lines from points"}),disabledReason:U,icon:()=>Object(v.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"49",height:"25",fill:"none",viewBox:"0 0 49 25"},Object(v.jsx)("path",{className:"mapLayersWizardIcon__highlight",d:"M12.733 12.136h32.283v.545H12.935L4.452 19.98l-.356-.413 8.637-7.43z"}),Object(v.jsx)("circle",{cx:"24.939",cy:"12.409",r:"2.182",className:"mapLayersWizardIcon__highlight"}),Object(v.jsx)("circle",{cx:"35.849",cy:"12.409",r:"2.182",className:"mapLayersWizardIcon__highlight"}),Object(v.jsx)("circle",{cx:"45.561",cy:"12.409",r:"3.273",className:"mapLayersWizardIcon__highlight"}),Object(v.jsx)("circle",{cx:"5.197",cy:"18.954",r:"2.182",className:"mapLayersWizardIcon__highlight"}),Object(v.jsx)("circle",{cx:"13.485",cy:"12.409",r:"2.182",className:"mapLayersWizardIcon__highlight"})),getIsDisabled:()=>!Object(G.b)(),renderWizard:({previewLayers:t})=>Object(v.jsx)(create_source_editor_CreateSourceEditor,{onSourceConfigChange:e=>{if(!e)return void t([]);const n=Y.b.createDescriptor({sourceDescriptor:es_geo_line_source_ESGeoLineSource.createDescriptor(e),style:q.a.createDescriptor({[L.Gb.LINE_WIDTH]:{type:L.Cb.STATIC,options:{size:2}}})});n.alpha=1,t([n])}}),title:V}},299:function(t,e,n){"use strict";n.d(e,"b",(function(){return N})),n.d(e,"a",(function(){return p}));var i=n(4),r=n.n(i),o=n(1),s=n(0),a=n(14),l=n(133),u=n(3);const c=o.i18n.translate("xpack.maps.spatialJoin.wizardForm.kilometersAbbreviation",{defaultMessage:"km"});function h(t){return"string"==typeof t?parseFloat(t):t}function d(t){const[e,n]=Object(i.useState)(t.initialDistance),s=h(e),d=isNaN(s)||s<=0;return Object(u.jsx)(r.a.Fragment,null,Object(u.jsx)(a.EuiFormRow,{label:o.i18n.translate("xpack.maps.spatialJoin.wizardForm.distanceLabel",{defaultMessage:"Distance"}),isInvalid:d,error:d?[o.i18n.translate("xpack.maps.spatialJoin.wizardForm.invalidDistanceMessage",{defaultMessage:"Value must be a number greater than 0"})]:[]},Object(u.jsx)(a.EuiFieldNumber,{append:c,"aria-label":o.i18n.translate("xpack.maps.spatialJoin.wizardForm.distanceInputAriaLabel",{defaultMessage:"distance input"}),isInvalid:d,min:0,onChange:t=>{n(t.target.value)},value:e})),Object(u.jsx)(a.EuiPopoverFooter,{paddingSize:"s"},Object(u.jsx)(a.EuiFlexGroup,null,Object(u.jsx)(a.EuiFlexItem,null,Object(u.jsx)(a.EuiButtonEmpty,{onClick:t.onClose,size:"s"},l.a.close)),Object(u.jsx)(a.EuiFlexItem,null,Object(u.jsx)(a.EuiButton,{fill:!0,isDisabled:d||t.initialDistance.toString()===e.toString(),onClick:()=>{t.onDistanceChange(h(e)),t.onClose()},size:"s"},l.a.apply)))))}function p(t){const[e,n]=Object(i.useState)(!1);function r(){n(!1)}return Object(u.jsx)(a.EuiPopover,{id:"spatialJoinRelationship",button:Object(u.jsx)(a.EuiExpression,{color:"subdued",description:o.i18n.translate("xpack.maps.spatialJoin.wizardForm.withinExpressionDescription",{defaultMessage:"within"}),value:o.i18n.translate("xpack.maps.spatialJoin.wizardForm.withinExpressionValue",{defaultMessage:"{distance} {units} of layer features",values:{distance:t.distance,units:c}}),onClick:()=>{n(!e)},uppercase:!1}),isOpen:e,closePopover:r,panelPaddingSize:"s",anchorPosition:"downCenter",repositionOnScroll:!0},Object(u.jsx)(d,{initialDistance:t.distance,onDistanceChange:t.onDistanceChange,onClose:r}))}var f=n(81),g=n(101),m=n(148);function _(t){const e=t.geoFields.length?Object(u.jsx)(m.a,{value:t.geoField?t.geoField:"",onChange:t.onGeoFieldSelect,geoFields:t.geoFields,isClearable:!1}):null;return Object(u.jsx)(a.EuiPanel,null,Object(u.jsx)(a.EuiTitle,{size:"xs"},Object(u.jsx)("h5",null,o.i18n.translate("xpack.maps.spatialJoin.wizard.leftSourceTitle",{defaultMessage:"Layer features source"}))),Object(u.jsx)(a.EuiSpacer,{size:"m"}),Object(u.jsx)(g.a,{dataView:t.dataView,onChange:t.onDataViewSelect,isGeoPointsOnly:!0}),e)}var y=n(147);function v(t){const e=t.dataView?Object(u.jsx)(m.a,{value:t.geoField?t.geoField:"",onChange:t.onGeoFieldSelect,geoFields:t.geoFields,isClearable:!1}):null;return Object(u.jsx)(a.EuiPanel,null,Object(u.jsx)(a.EuiTitle,{size:"xs"},Object(u.jsx)("h5",null,o.i18n.translate("xpack.maps.spatialJoin.wizardForm.rightSourceTitle",{defaultMessage:"Join source"}))),Object(u.jsx)(a.EuiSpacer,{size:"m"}),Object(u.jsx)(a.EuiFormRow,{label:y.a.relationshipLabel},Object(u.jsx)(p,{distance:t.distance,onDistanceChange:t.onDistanceChange})),Object(u.jsx)(g.a,{dataView:t.dataView,onChange:t.onDataViewSelect}),e)}var b=n(41),x=n(94),E=n(82),S=n(72),C=n(112),I=n(79);const O=Object(I.i)();var w=n(136);function L(t,e){return void 0!==t&&t.id&&void 0!==e}function T({previewLayers:t}){const[e,n]=Object(i.useState)(w.a),[o,l]=Object(i.useState)(),[c,h]=Object(i.useState)([]),[d,p]=Object(i.useState)(),[g,m]=Object(i.useState)(),[y,I]=Object(i.useState)([]),[T,N]=Object(i.useState)();Object(i.useEffect)((()=>{if(!L(o,d)||!function(t,e){return void 0!==t&&t.id&&void 0!==e}(g,T))return void t([]);const n=function({distance:t,leftDataViewId:e,leftGeoField:n,rightDataViewId:i,rightGeoField:r}){const o={type:s.b.COUNT},a=Object(b.v4)(),l=Object(x.a)({aggType:o.type,rightSourceId:a}),u={[s.Gb.LABEL_TEXT]:{type:s.Cb.DYNAMIC,options:{...O[s.Gb.LABEL_TEXT].options,field:{name:l,origin:s.D.JOIN}}}},c=[{leftField:"_id",right:{type:s.Ab.ES_DISTANCE_SOURCE,id:a,indexPatternId:i,metrics:[o],distance:t,geoField:r,applyGlobalQuery:!0,applyGlobalTime:!0,applyForceRefresh:!0}}];return S.b.createDescriptor({joins:c,sourceDescriptor:C.ESSearchSource.createDescriptor({indexPatternId:e,geoField:n,scalingType:s.vb.LIMIT,applyGlobalQuery:!0,applyGlobalTime:!0,applyForceRefresh:!0}),style:E.a.createDescriptor(u)})}({distance:e,leftDataViewId:o.id,leftGeoField:d,rightDataViewId:g.id,rightGeoField:T});t([n])}),[e,o,d,g,T,t]);const j=L(o,d)?Object(u.jsx)(v,{dataView:g,distance:e,geoField:T,geoFields:y,onDataViewSelect:t=>{m(t);const e=Object(f.b)(t.fields);I(e),N(e.length?e[0].name:void 0)},onDistanceChange:n,onGeoFieldSelect:N}):null;return Object(u.jsx)(r.a.Fragment,null,Object(u.jsx)(_,{dataView:o,geoField:d,geoFields:c,onDataViewSelect:t=>{l(t);const e=Object(f.c)(t.fields);h(e),p(e.length?e[0].name:void 0)},onGeoFieldSelect:p}),Object(u.jsx)(a.EuiSpacer,{size:"s"}),j)}const N={id:s.Hb.SPATIAL_JOIN,order:10,categories:[s.ab.ELASTICSEARCH],description:o.i18n.translate("xpack.maps.spatialJoinWizard.description",{defaultMessage:"Group documents by geospatial relationships"}),icon:()=>Object(u.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"49",height:"25",fill:"none",viewBox:"0 0 49 25",className:"mapLayersWizardIcon"},Object(u.jsx)("path",{className:"mapLayersWizardIcon__background",d:"M32.206 15.364V1.588l-1.492.204c-.743.254-1.768.38-2.702.45a41.39 41.39 0 01-1.258.07l-.093.005c-.312.014-.57.025-.72.042a1.895 1.895 0 00-.558.167c-.156.07-.316.156-.47.238l-.057.031c-.356.19-.687.357-1.025.4l-2.262.474v5.864c0 .698-.677 2.578-.818 3.852l.34 1.807 11.114.17z"}),Object(u.jsx)("path",{fill:"#69707D",d:"M22.36 3.558c-.178-.104-.416-.15-.664-.172a6.333 6.333 0 00-.885 0c-.657.04-1.452.144-2.264.261l-.703.103c-.583.087-1.16.172-1.692.238-.751.093-1.39.145-1.82.113-.593-.044-1.125.341-1.611.843-.453.467-.925 1.101-1.429 1.777l-.144.193c-1.132 1.517-2.452 3.218-4.22 4.102-.213.107-.346.312-.431.528a3.065 3.065 0 00-.173.78c-.064.586-.046 1.324.007 2.083.072 1.01.211 2.102.32 2.955.055.42.101.784.128 1.05.08.78-.128 1.77-.37 2.653-.088.319-.178.616-.258.882l-.086.285a9.67 9.67 0 00-.12.434 1.518 1.518 0 00-.053.334c0 .28.11.577.283.842a2.3 2.3 0 00.735.708l.067.04h.078c4.133-.069 11.445-.366 12.196-.45a.58.58 0 00.334-.17 1.41 1.41 0 00.224-.293c.134-.223.264-.524.388-.867.249-.69.495-1.6.72-2.52.162-.654.314-1.32.452-1.92l.16-.695c.088-.378.167-.707.235-.963.07-.267.123-.43.156-.494a1.57 1.57 0 00.1-.314c.03-.129.063-.291.096-.48.067-.38.14-.876.213-1.45.146-1.149.296-2.614.403-4.073.107-1.458.171-2.917.146-4.052a10.13 10.13 0 00-.112-1.438 2.469 2.469 0 00-.131-.495c-.053-.128-.135-.275-.276-.358z"}),Object(u.jsx)("path",{className:"mapLayersWizardIcon__background",d:"M31.435 15.227c-.218.006-1.066-.01-1.445 0-.758.02-1.298-.026-2.353 0H22.15l-2.864 8.915c.2.067 1.938.445 2.242.447.62.005 1.478-.08 2.393-.197.88-.112 1.824-.257 2.679-.389l.112-.017c.888-.136 1.664-.254 2.166-.304.348-.035.996-.025 1.858-.007l.128.002c.827.017 1.818.037 2.868.023 2.199-.028 4.695-.203 6.5-.887 1.42-.538 2.1-.87 2.513-1.339.414-.469.558-.468.643-1.44.086-.972.086-2.063.086-2.063l-8.131-2.744h-3.907z"}),Object(u.jsx)("path",{className:"mapLayersWizardIcon__background",d:"M32.206 1.588s-2.046 13.417-1.603 13.639c.787.393 2.66.63 3.785 1.636 1.23 1.1 1.171 2.5 2.318 3.239.834.538 6.73-.874 6.73-.874l.228-7.956s-.174-4.5-.89-5.216c-.716-.715-2.489-1.125-3-2.08-1.115-2.08-3.068-2.351-3.068-2.351l-4.5-.037z"}),Object(u.jsx)("circle",{cx:"14.761",cy:"9.754",r:"1.091",className:"mapLayersWizardIcon__highlight"}),Object(u.jsx)("circle",{cx:"36.63",cy:"10.706",r:"1.091",className:"mapLayersWizardIcon__backgroundDarker"}),Object(u.jsx)("circle",{cx:"24.842",cy:"19.181",r:"1.091",className:"mapLayersWizardIcon__backgroundDarker"}),Object(u.jsx)("circle",{cx:"39.024",cy:"15.363",r:"1.091",className:"mapLayersWizardIcon__backgroundDarker"}),Object(u.jsx)("circle",{cx:"27.569",cy:"6.091",r:"1.091",className:"mapLayersWizardIcon__backgroundDarker"}),Object(u.jsx)("circle",{cx:"28.66",cy:"11",r:"1.091",className:"mapLayersWizardIcon__backgroundDarker"}),Object(u.jsx)("circle",{cx:"35.206",cy:"4.454",r:"1.091",className:"mapLayersWizardIcon__backgroundDarker"}),Object(u.jsx)("circle",{cx:"18.842",cy:"6.091",r:"1.091",className:"mapLayersWizardIcon__highlight"}),Object(u.jsx)("circle",{cx:"10.115",cy:"13.727",r:"1.091",className:"mapLayersWizardIcon__highlight"}),Object(u.jsx)("circle",{cx:"16.66",cy:"14.818",r:"1.091",className:"mapLayersWizardIcon__highlight"}),Object(u.jsx)("circle",{cx:"11.206",cy:"20.272",r:"1.091",className:"mapLayersWizardIcon__highlight"}),Object(u.jsx)("circle",{cx:"17.751",cy:"20.818",r:"1.091",className:"mapLayersWizardIcon__highlight"}),Object(u.jsx)("circle",{cx:"30.842",cy:"20.818",r:"1.091",className:"mapLayersWizardIcon__backgroundDarker"})),renderWizard:t=>Object(u.jsx)(T,t),title:o.i18n.translate("xpack.maps.spatialJoinWizard.title",{defaultMessage:"Spatial join"})}},300:function(t,e,n){"use strict";n.d(e,"a",(function(){return mvt_single_layer_vector_source_MVTSingleLayerVectorSource})),n.d(e,"b",(function(){return I}));var i=n(2),r=n.n(i),o=n(1),s=n(41),a=n(4),l=n.n(a),u=n(110),c=n(0),h=n(74),d=n(146);class mvt_field_MVTField extends d.a{constructor({fieldName:t,type:e,source:n,origin:i}){super({fieldName:t,origin:i}),r()(this,"_source",void 0),r()(this,"_type",void 0),this._source=n,this._type=e}supportsFieldMetaFromEs(){return!1}supportsFieldMetaFromLocalData(){return!1}getMVTFieldDescriptor(){return{type:this._type,name:this.getName()}}getSource(){return this._source}async getDataType(){if(this._type===c.mb.STRING)return"string";if(this._type===c.mb.NUMBER)return"number";throw new Error(`Unrecognized MVT field-type ${this._type}`)}async getLabel(){return this.getName()}}var p=n(39),f=n.n(p),g=n(14),m=n(40),_=n(138),y=n(43),v=n(149),b=n(3);const x=[{value:c.mb.STRING,icon:"string",message:o.i18n.translate("xpack.maps.mvtSource.stringFieldLabel",{defaultMessage:"string"})},{value:c.mb.NUMBER,icon:"number",message:o.i18n.translate("xpack.maps.mvtSource.numberFieldLabel",{defaultMessage:"number"})}].map((function({value:t,icon:e,message:n}){return{value:t,inputDisplay:Object(b.jsx)(g.EuiFlexGroup,{gutterSize:"s",alignItems:"center"},Object(b.jsx)(g.EuiFlexItem,{grow:null},Object(b.jsx)(v.a,{type:e,fill:"none"})),Object(b.jsx)(g.EuiFlexItem,null,n))}}));class mvt_field_config_editor_MVTFieldConfigEditor extends a.Component{constructor(...t){super(...t),r()(this,"state",{currentFields:f.a.cloneDeep(this.props.fields)}),r()(this,"_notifyChange",f.a.debounce((()=>{this.state.currentFields.some((t=>""===t.name))||this.props.onChange(this.state.currentFields)}))),r()(this,"_addField",(()=>{const t=this.state.currentFields.slice();t.push({type:c.mb.STRING,name:""}),this._fieldChange(t)}))}_fieldChange(t){this.setState({currentFields:t},this._notifyChange)}_removeField(t){const e=this.state.currentFields.slice();e.splice(t,1),this._fieldChange(e)}_renderFieldTypeDropDown(t,e){const n=t=>{const n=this.state.currentFields.slice();n[e]={type:t,name:n[e].name},this._fieldChange(n)};return Object(b.jsx)(g.EuiSuperSelect,{options:x,valueOfSelected:t.type,onChange:t=>n(t),compressed:!0})}_renderFieldButtonDelete(t){return Object(b.jsx)(g.EuiButtonIcon,{iconType:"trash",color:"danger",onClick:()=>{this._removeField(t)},title:o.i18n.translate("xpack.maps.mvtSource.trashButtonTitle",{defaultMessage:"Remove field"}),"aria-label":o.i18n.translate("xpack.maps.mvtSource.trashButtonAriaLabel",{defaultMessage:"Remove field"})})}_renderFieldNameInput(t,e){const n=""===t.name,i=this.state.currentFields.filter((e=>e.name===t.name)).length>1;return Object(b.jsx)(g.EuiFieldText,{value:t.name,onChange:t=>{const n=t.target.value,i=this.state.currentFields.slice();i[e]={name:n,type:i[e].type},this._fieldChange(i)},"aria-label":"Fieldname",placeholder:o.i18n.translate("xpack.maps.mvtSource.fieldPlaceholderText",{defaultMessage:"Field name"}),isInvalid:n||i,compressed:!0})}_renderFieldConfig(){return this.state.currentFields.map(((t,e)=>Object(b.jsx)(a.Fragment,{key:e},Object(b.jsx)(g.EuiFlexGroup,{gutterSize:"xs",alignItems:"center"},Object(b.jsx)(g.EuiFlexItem,null,this._renderFieldNameInput(t,e)),Object(b.jsx)(g.EuiFlexItem,null,this._renderFieldTypeDropDown(t,e)),Object(b.jsx)(g.EuiFlexItem,{grow:!1},this._renderFieldButtonDelete(e))),Object(b.jsx)(g.EuiSpacer,{size:"xs"}))))}render(){return Object(b.jsx)(a.Fragment,null,this._renderFieldConfig(),Object(b.jsx)(g.EuiSpacer,{size:"s"}),Object(b.jsx)(g.EuiFlexGroup,{justifyContent:"spaceAround",alignItems:"center",gutterSize:"xs"},Object(b.jsx)(g.EuiFlexItem,{grow:!1},Object(b.jsx)(g.EuiButtonEmpty,{onClick:this._addField,size:"xs",iconType:"plusInCircleFilled"},o.i18n.translate("xpack.maps.mvtSource.addFieldLabel",{defaultMessage:"Add"})))))}}class mvt_single_layer_source_settings_MVTSingleLayerSourceSettings extends a.Component{constructor(...t){super(...t),r()(this,"state",{currentLayerName:this.props.layerName,currentMinSourceZoom:this.props.minSourceZoom,currentMaxSourceZoom:this.props.maxSourceZoom,currentFields:f.a.cloneDeep(this.props.fields)}),r()(this,"_handleChange",f.a.debounce((()=>{this.props.handleChange({layerName:this.state.currentLayerName,minSourceZoom:this.state.currentMinSourceZoom,maxSourceZoom:this.state.currentMaxSourceZoom,fields:this.state.currentFields})}),200)),r()(this,"_handleLayerNameInputChange",(t=>{this.setState({currentLayerName:t.target.value},this._handleChange)})),r()(this,"_handleFieldChange",(t=>{this.setState({currentFields:t},this._handleChange)})),r()(this,"_handleZoomRangeChange",(t=>{this.setState({currentMinSourceZoom:parseInt(t[0],10),currentMaxSourceZoom:parseInt(t[1],10)},this._handleChange)}))}render(){const t=o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.fieldsPreHelpMessage",{defaultMessage:"Fields which are available in "}),e=Object(b.jsx)(l.a.Fragment,null,Object(b.jsx)("b",null,this.state.currentLayerName),"."," "),n=o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.fieldsPostHelpMessage",{defaultMessage:"These can be used for tooltips and dynamic styling."}),i=this.props.showFields&&""!==this.state.currentLayerName?Object(b.jsx)(g.EuiFormRow,{label:Object(b.jsx)(g.EuiToolTip,{anchorClassName:"eui-alignMiddle",content:Object(b.jsx)(l.a.Fragment,null,t,e,n)},Object(b.jsx)("span",null,o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.fieldsMessage",{defaultMessage:"Fields"})," ",Object(b.jsx)(g.EuiIcon,{type:"questionInCircle",color:"subdued"})))},Object(b.jsx)(mvt_field_config_editor_MVTFieldConfigEditor,{fields:this.state.currentFields.slice(),onChange:this._handleFieldChange})):null;return Object(b.jsx)(a.Fragment,null,Object(b.jsx)(g.EuiFormRow,{display:"columnCompressed",label:o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.layerNameMessage",{defaultMessage:"Source layer"})},Object(b.jsx)(g.EuiFieldText,{value:this.state.currentLayerName,onChange:this._handleLayerNameInputChange,isInvalid:""===this.state.currentLayerName,compressed:!0})),Object(b.jsx)(y.ValidatedDualRange,{label:Object(b.jsx)(g.EuiToolTip,{anchorClassName:"eui-alignMiddle",content:o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.zoomRangeHelpMessage",{defaultMessage:"Zoom levels where the layer is present in the tiles. This does not correspond directly to visibility. Layer data from lower levels can always be displayed at higher zoom levels (but not vice versa)."})},Object(b.jsx)("span",null,o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.zoomRangeTopMessage",{defaultMessage:"Available levels"})," ",Object(b.jsx)(g.EuiIcon,{type:"questionInCircle",color:"subdued"}))),formRowDisplay:"columnCompressed",value:[this.state.currentMinSourceZoom,this.state.currentMaxSourceZoom],min:c.lb,max:c.hb,onChange:this._handleZoomRangeChange,allowEmptyRange:!1,showInput:"inputWithPopover",compressed:!0,showLabels:!0,prepend:o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.dataZoomRangeMessage",{defaultMessage:"Zoom"})}),i)}}class update_source_editor_UpdateSourceEditor extends a.Component{constructor(...t){super(...t),r()(this,"_onTooltipPropertiesSelect",(t=>{this.props.onChange({propName:"tooltipProperties",value:t})})),r()(this,"_handleChange",(t=>{const e=[];if(t.layerName!==this.props.source.getTileSourceLayer()&&e.push({propName:"layerName",value:t.layerName}),t.minSourceZoom!==this.props.source.getMinZoom()&&e.push({propName:"minSourceZoom",value:t.minSourceZoom}),t.maxSourceZoom!==this.props.source.getMaxZoom()&&e.push({propName:"maxSourceZoom",value:t.maxSourceZoom}),!f.a.isEqual(t.fields,this._getFieldDescriptors())){e.push({propName:"fields",value:t.fields});const n=[];for(let e=0;et.getMVTFieldDescriptor()))}_renderSourceSettingsCard(){const t=this._getFieldDescriptors();return Object(b.jsx)(a.Fragment,null,Object(b.jsx)(g.EuiPanel,null,Object(b.jsx)(g.EuiTitle,{size:"xs"},Object(b.jsx)("h5",null,Object(b.jsx)(m.FormattedMessage,{id:"xpack.maps.mvtSource.sourceSettings",defaultMessage:"Source settings"}))),Object(b.jsx)(g.EuiSpacer,{size:"m"}),Object(b.jsx)(mvt_single_layer_source_settings_MVTSingleLayerSourceSettings,{handleChange:this._handleChange,layerName:this.props.source.getTileSourceLayer()||"",fields:t,minSourceZoom:this.props.source.getMinZoom(),maxSourceZoom:this.props.source.getMaxZoom(),showFields:!0})),Object(b.jsx)(g.EuiSpacer,{size:"s"}))}_renderTooltipSelectionCard(){return Object(b.jsx)(a.Fragment,null,Object(b.jsx)(g.EuiPanel,null,Object(b.jsx)(g.EuiTitle,{size:"xs"},Object(b.jsx)("h5",null,Object(b.jsx)(m.FormattedMessage,{id:"xpack.maps.mvtSource.tooltipsTitle",defaultMessage:"Tooltip fields"}))),Object(b.jsx)(g.EuiSpacer,{size:"m"}),Object(b.jsx)(_.a,{tooltipFields:this.props.tooltipFields,onChange:this._onTooltipPropertiesSelect,fields:this.props.source.getMVTFields()})),Object(b.jsx)(g.EuiSpacer,{size:"s"}))}render(){return Object(b.jsx)(a.Fragment,null,this._renderSourceSettingsCard(),this._renderTooltipSelectionCard())}}var E=n(109);const S=o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSource.sourceTitle",{defaultMessage:"Vector tiles"});class mvt_single_layer_vector_source_MVTSingleLayerVectorSource extends u.a{static createDescriptor({urlTemplate:t,layerName:e,minSourceZoom:n,maxSourceZoom:i,fields:r,tooltipProperties:o}){return{type:c.Ab.MVT_SINGLE_LAYER,id:Object(s.v4)(),urlTemplate:t||"",layerName:e||"",minSourceZoom:"number"==typeof n?Math.max(c.lb,n):c.lb,maxSourceZoom:"number"==typeof i?Math.min(c.hb,i):c.hb,fields:r||[],tooltipProperties:o||[]}}constructor(t){super(t),r()(this,"_descriptor",void 0),r()(this,"_tooltipFields",void 0),this._descriptor=mvt_single_layer_vector_source_MVTSingleLayerVectorSource.createDescriptor(t),this._tooltipFields=this._descriptor.tooltipProperties.map((t=>this.getFieldByName(t))).filter((t=>null!==t))}isMvt(){return!0}async supportsFitToBounds(){return!1}renderSourceSettingsEditor({onChange:t}){return Object(b.jsx)(update_source_editor_UpdateSourceEditor,{onChange:t,tooltipFields:this._tooltipFields,source:this})}addFeature(t){throw new Error("Does not implement addFeature")}deleteFeature(t){throw new Error("Does not implement deleteFeature")}getMVTFields(){return this._descriptor.fields.map((t=>new mvt_field_MVTField({fieldName:t.name,type:t.type,source:this,origin:c.D.SOURCE})))}getFieldByName(t){try{return this.createField({fieldName:t})}catch(t){return null}}createField({fieldName:t}){const e=this._descriptor.fields.find((e=>e.name===t));if(!e)throw new Error(`Cannot create field for fieldName ${t}`);return new mvt_field_MVTField({fieldName:e.name,type:e.type,source:this,origin:c.D.SOURCE})}getGeoJsonWithMeta(){throw new Error("Does not implement getGeoJsonWithMeta")}async getFields(){return this.getMVTFields()}getTileSourceLayer(){return this._descriptor.layerName}async getImmutableProperties(){return[{label:Object(h.a)(),value:S},{label:Object(h.f)(),value:this._descriptor.urlTemplate}]}async getDisplayName(){return this.getTileSourceLayer()}async getTileUrl(){return this._descriptor.urlTemplate}async getSupportedShapeTypes(){return[c.Fb.POINT,c.Fb.LINE,c.Fb.POLYGON]}hasTooltipProperties(){return!!this._tooltipFields.length}getMinZoom(){return this._descriptor.minSourceZoom}getMaxZoom(){return this._descriptor.maxSourceZoom}async getBoundsForFilters(t,e){return null}getSyncMeta(){return{mvtFields:this._descriptor.fields.map((t=>t.name))}}isBoundsAware(){return!1}getSourceStatus(){return{tooltipContent:null,areResultsTrimmed:!1}}async getLeftJoinFields(){return[]}async getTooltipProperties(t){const e=[];for(const n in t)if(t.hasOwnProperty(n))for(let i=0;i{this.state.urlTemplate.indexOf("{x}")>=0&&this.state.urlTemplate.indexOf("{y}")>=0&&this.state.urlTemplate.indexOf("{z}")>=0&&this.state.layerName&&this.props.onSourceConfigChange({urlTemplate:this.state.urlTemplate,layerName:this.state.layerName,minSourceZoom:this.state.minSourceZoom,maxSourceZoom:this.state.maxSourceZoom,fields:this.state.fields})}),200)),r()(this,"_handleUrlTemplateChange",(t=>{const e=t.target.value;this.setState({urlTemplate:e},(()=>this._sourceConfigChange()))})),r()(this,"_handleChange",(t=>{this.setState(t,(()=>this._sourceConfigChange()))}))}render(){return Object(b.jsx)(g.EuiPanel,null,Object(b.jsx)(g.EuiFormRow,{label:o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.urlMessage",{defaultMessage:"Url"}),helpText:o.i18n.translate("xpack.maps.source.MVTSingleLayerVectorSourceEditor.urlHelpMessage",{defaultMessage:"URL of the .mvt vector tile service. e.g. {url}",values:{url:"http://company.com/{z}/{x}/{y}.pbf"}})},Object(b.jsx)(g.EuiFieldText,{value:this.state.urlTemplate,onChange:this._handleUrlTemplateChange,compressed:!0})),Object(b.jsx)(mvt_single_layer_source_settings_MVTSingleLayerSourceSettings,{handleChange:this._handleChange,layerName:this.state.layerName,fields:this.state.fields,minSourceZoom:this.state.minSourceZoom,maxSourceZoom:this.state.maxSourceZoom,showFields:!1}))}}var C=n(72);const I={id:c.Hb.MVT_VECTOR,order:10,categories:[c.ab.REFERENCE],description:o.i18n.translate("xpack.maps.source.mvtVectorSourceWizard",{defaultMessage:"Data service implementing the Mapbox vector tile specification"}),icon:()=>Object(b.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"49",height:"25",fill:"none",viewBox:"0 0 49 25"},Object(b.jsx)("g",{clipPath:"url(#clip0)"},Object(b.jsx)("path",{className:"mapLayersWizardIcon__background",d:"M33.547 14.847l2.439-19.72-2.114.36c-1.133.385-2.692.577-4.114.684-.706.052-1.368.083-1.916.108l-.14.006c-.475.02-.868.038-1.097.064a2.885 2.885 0 00-.85.255c-.237.106-.48.237-.714.362l-.088.047c-.541.29-1.045.543-1.56.608l-1.99.515v8.926c0 1.062.215 3.302 0 5.242l-.311 2.543h12.455zM18.485-2.298c-1 .058-1.9.429-3.135.607-.356.051-.714.104-1.07.157-.888.131-1.765.26-2.577.362-1.143.142-2.115.22-2.77.172C8.031-1.067 7.22-.48 6.48.283c-.69.711-1.408 1.676-2.174 2.704l-.22.295C2.363 5.591.354 8.18-2.337 9.526c-.326.163-.528.475-.658.803-.132.334-.214.743-.263 1.188-.097.893-.07 2.016.011 3.17.109 1.539.322 3.2.488 4.5.082.64.153 1.192.194 1.598.122 1.188-.195 2.693-.564 4.038-.134.486-.27.939-.392 1.343l-.13.434a14.78 14.78 0 00-.184.661c-.044.178-.081.36-.081.508 0 .425.168.879.43 1.282.267.408.65.793 1.12 1.078l.102.061.12-.002c6.291-.103 15.558-.843 16.703-.97a.886.886 0 00.507-.259 2.15 2.15 0 00.342-.447c.204-.34.401-.797.59-1.32.38-1.05.753-2.434 1.098-3.834.244-.997.828-2.148 1.037-3.062l1.194-4.256c.101-.576.302-1.721.414-2.595.223-1.748-.015-3.866.148-6.088.162-2.22.26-4.44.223-6.168-.019-.862-.072-1.615-.172-2.19a3.756 3.756 0 00-.199-.752c-.08-.196-.42-.545-.42-.545h-.837zm16.639 19.212s-1.78-.992-2.356-.978c-1.153.03-1.976-.038-3.58 0h-8.356l-4.36 13.571c.305.102 2.95.677 3.414.681.943.008 2.25-.12 3.643-.3 1.338-.17 2.776-.392 4.077-.591l.171-.027c1.352-.207 2.532-.387 3.297-.463.53-.053 1.517-.037 2.829-.011l.194.004c1.259.025 2.768.056 4.367.035 3.347-.043 7.146-.31 9.894-1.35 2.162-.82 3.196-1.325 3.826-2.039.63-.714.876-2.4.876-2.4s-4.425 1.321-7.318 1.194c-1.411-.062-2.295.067-3.58-.52-2.175-.991-1.835-3.38-3.698-4.877-1.174-.944-3.34-1.929-3.34-1.929z"}),Object(b.jsx)("path",{className:"mapLayersWizardIcon__background",d:"M37.439-4.77s-3.114 20.058-2.44 20.395c1.197.598 3.063 1.012 4.775 2.543 1.872 1.673 1.784 3.805 3.53 4.93 1.27.82 9.932-1.07 9.932-1.07l.348-12.112s-.265-6.85-1.355-7.94C51.14.886 48.441.264 47.662-1.189c-1.697-3.169-4.67-3.581-4.67-3.581h-5.553z"}),Object(b.jsx)("circle",{cx:"9.487",cy:"7.606",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"42.779",cy:"9.055",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"24.834",cy:"21.957",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"46.423",cy:"16.145",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"28.986",cy:"2.029",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"30.646",cy:"9.502",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"40.61",cy:"-0.462",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"15.7",cy:"2.029",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"2.415",cy:"13.654",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"12.379",cy:"15.315",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"4.075",cy:"23.618",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"14.039",cy:"24.448",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("circle",{cx:"33.968",cy:"24.448",r:"1.661",className:"mapLayersWizardIcon__highlight"}),Object(b.jsx)("path",{className:"mapLayersWizardIcon__highlight",d:"M.834 23.863h48v.545h-48zm0-11.727h48v.545h-48zm0-11.727h48v.545h-48z"}),Object(b.jsx)("path",{className:"mapLayersWizardIcon__highlight",d:"M.834.409h.545v24H.834zm15.818 0h.545v24h-.545zm16.091 0h.545v24h-.545zm15.545 0h.545v24h-.545z"})),Object(b.jsx)("defs",null,Object(b.jsx)("clipPath",{id:"clip0"},Object(b.jsx)("path",{fill:"#fff",d:"M0 0h48v24H0z",transform:"translate(.834 .409)"})))),renderWizard:({previewLayers:t,mapColors:e})=>Object(b.jsx)(mvt_single_layer_vector_source_editor_MVTSingleLayerVectorSourceEditor,{onSourceConfigChange:n=>{const i=mvt_single_layer_vector_source_MVTSingleLayerVectorSource.createDescriptor(n),r=C.c.createDescriptor({sourceDescriptor:i},e);t([r])}}),title:S}},302:function(t,e,n){"use strict";n.d(e,"a",(function(){return y})),n.d(e,"b",(function(){return view_AddLayerPanel}));var i=n(2),r=n.n(i),o=n(4),s=n.n(o),a=n(14),l=n(1),u=n(40),c=n(71),h=n(39),d=n.n(h),p=n(26),f=n(0),g=(n(510),n(3));class layer_wizard_select_LayerWizardSelect extends o.Component{constructor(...t){super(...t),r()(this,"_isMounted",!1),r()(this,"state",{activeCategories:[],hasLoadedWizards:!1,layerWizards:[],selectedCategory:null})}componentDidMount(){this._isMounted=!0,this._loadLayerWizards()}componentWillUnmount(){this._isMounted=!1}async _loadLayerWizards(){const t=await Object(p.a)(),e=[];t.forEach((t=>{t.categories.forEach((t=>{e.includes(t)||e.push(t)}))})),this._isMounted&&this.setState({activeCategories:e,layerWizards:t,hasLoadedWizards:!0})}_filterByCategory(t){this.setState({selectedCategory:t})}_renderCategoryFacets(){if(0===this.state.activeCategories.length)return null;const t=this.state.activeCategories.map((t=>Object(g.jsx)(a.EuiFacetButton,{key:t,isSelected:t===this.state.selectedCategory,onClick:()=>this._filterByCategory(t),minWidth:!1},function(t){if(t===f.ab.ELASTICSEARCH)return l.i18n.translate("xpack.maps.layerWizardSelect.elasticsearchCategoryLabel",{defaultMessage:"Elasticsearch"});if(t===f.ab.REFERENCE)return l.i18n.translate("xpack.maps.layerWizardSelect.referenceCategoryLabel",{defaultMessage:"Reference"});if(t===f.ab.SOLUTIONS)return l.i18n.translate("xpack.maps.layerWizardSelect.solutionsCategoryLabel",{defaultMessage:"Solutions"});throw new Error(`Unexpected category: ${t}`)}(t))));return Object(g.jsx)(a.EuiFacetGroup,{layout:"horizontal",gutterSize:"s"},Object(g.jsx)(a.EuiFacetButton,{key:"all",isSelected:!this.state.selectedCategory,onClick:()=>this._filterByCategory(null),minWidth:!1},Object(g.jsx)(u.FormattedMessage,{id:"xpack.maps.layerWizardSelect.allCategories",defaultMessage:"All"})),t)}render(){if(!this.state.hasLoadedWizards)return Object(g.jsx)(a.EuiPanel,null,Object(g.jsx)(a.EuiSkeletonText,{lines:2}));const t=this.state.layerWizards.filter((t=>!this.state.selectedCategory||t.categories.includes(this.state.selectedCategory))).map((t=>{const e=t.icon?Object(g.jsx)(a.EuiIcon,{type:t.icon,size:"l"}):void 0,n=Object(g.jsx)(a.EuiCard,{title:t.title,titleSize:"xs",betaBadgeProps:{label:t.isBeta?"beta":""},icon:e,onClick:()=>{this.props.onSelect(t)},description:t.description,isDisabled:t.isDisabled,"data-test-subj":d.a.camelCase(t.title)});return Object(g.jsx)(a.EuiFlexItem,{key:t.title},t.isDisabled&&t.disabledReason?Object(g.jsx)(a.EuiToolTip,{position:"top",anchorClassName:"mapMapLayerWizardSelect__tooltip",content:t.disabledReason},n):n)}));return Object(g.jsx)(s.a.Fragment,null,this._renderCategoryFacets(),Object(g.jsx)(a.EuiSpacer,{size:"s"}),Object(g.jsx)(a.EuiFlexGrid,{columns:2,gutterSize:"m"},t))}}var m=n(70);const _=Object(c.connect)((function(t){return{mapColors:Object(m.u)(t)}}),{})((t=>Object(g.jsx)("div",{className:"mapLayerPanel__body","data-test-subj":"layerAddForm"},Object(g.jsx)("div",{className:"mapLayerPanel__bodyOverflow"},function(){if(!t.layerWizard||!t.currentStepId)return Object(g.jsx)(layer_wizard_select_LayerWizardSelect,{onSelect:t.onWizardSelect});const e={previewLayers:t.previewLayers,mapColors:t.mapColors,currentStepId:t.currentStepId,isOnFinalStep:t.isOnFinalStep,enableNextBtn:t.enableNextBtn,disableNextBtn:t.disableNextBtn,startStepLoading:t.startStepLoading,stopStepLoading:t.stopStepLoading,advanceToNextStep:t.advanceToNextStep},n=t.showBackButton?Object(g.jsx)(o.Fragment,null,Object(g.jsx)(a.EuiButtonEmpty,{size:"xs",flush:"left",onClick:t.onClear,iconType:"arrowLeft"},Object(g.jsx)(u.FormattedMessage,{id:"xpack.maps.addLayerPanel.changeDataSourceButtonLabel",defaultMessage:"Change layer"})),Object(g.jsx)(a.EuiSpacer,{size:"s"})):null;return Object(g.jsx)(o.Fragment,null,n,t.layerWizard.renderWizard(e))}())))),y="ADD_LAYER_STEP_ID",v=l.i18n.translate("xpack.maps.addLayerPanel.addLayer",{defaultMessage:"Add layer"}),b=l.i18n.translate("xpack.maps.addLayerPanel.addLayerNextButtonLabel",{defaultMessage:"Add and continue"}),x=l.i18n.translate("xpack.maps.addLayerPanel.addLayerSecondaryActionButtonLabel",{defaultMessage:"Add and close"}),E={currentStepIndex:0,currentStep:null,layerSteps:null,layerWizard:null,isNextStepBtnEnabled:!1,isStepLoading:!1};class view_AddLayerPanel extends o.Component{constructor(...t){super(...t),r()(this,"state",{...E}),r()(this,"_previewLayers",(t=>{this.props.addPreviewLayers(t)})),r()(this,"_clearLayerWizard",(()=>{this.setState(E),this.props.addPreviewLayers([])})),r()(this,"_onWizardSelect",(t=>{const e=[...t.prerequisiteSteps?t.prerequisiteSteps:[],{id:y,label:v,nextButtonLabel:b,renderSecondaryActionButton:({isDisabled:t,isLoading:e,addLayersAndClose:n})=>Object(g.jsx)(a.EuiButton,{disabled:t||e,isLoading:e,onClick:n,iconSide:"right"},x)}];this.setState({...E,layerWizard:t,layerSteps:e,currentStep:e[0]})})),r()(this,"_onNext",(()=>{var t;this.state.layerSteps&&(this.state.layerSteps.length-1===this.state.currentStepIndex?(this.props.addLayersAndContinue(),null!==(t=this.state.layerWizard)&&void 0!==t&&t.showFeatureEditTools&&this.props.enableEditMode()):this.setState((t=>{const e=t.currentStepIndex+1;return{currentStepIndex:e,currentStep:t.layerSteps[e],isNextStepBtnEnabled:!1,isStepLoading:!1}})))})),r()(this,"_enableNextBtn",(()=>{this.setState({isNextStepBtnEnabled:!0})})),r()(this,"_disableNextBtn",(()=>{this.setState({isNextStepBtnEnabled:!1})})),r()(this,"_startStepLoading",(()=>{this.setState({isStepLoading:!0})})),r()(this,"_stopStepLoading",(()=>{this.setState({isStepLoading:!1})}))}componentDidMount(){this.props.autoOpenLayerWizardId&&this._openWizard()}_openWizard(){const t=Object(p.b)(this.props.autoOpenLayerWizardId);t&&this._onWizardSelect(t),this.props.clearAutoOpenLayerWizardId()}_renderNextButton(){if(!this.state.currentStep)return null;const t=this.state.currentStep.id===y?!this.props.hasPreviewLayers:!this.state.isNextStepBtnEnabled,e=Object(g.jsx)(a.EuiFlexItem,{grow:!1},Object(g.jsx)(a.EuiButton,{"data-test-subj":"importFileButton",disabled:t||this.state.isStepLoading,isLoading:this.state.isStepLoading,iconSide:"right",iconType:"arrowRight",onClick:this._onNext,fill:!0},this.state.currentStep.nextButtonLabel?this.state.currentStep.nextButtonLabel:this.state.currentStep.label));return this.state.currentStep.renderSecondaryActionButton?Object(g.jsx)(a.EuiFlexItem,{grow:!1},Object(g.jsx)(a.EuiFlexGroup,{responsive:!1,gutterSize:"s"},Object(g.jsx)(a.EuiFlexItem,{grow:!1},this.state.currentStep.renderSecondaryActionButton({isDisabled:t,isLoading:this.state.isStepLoading,addLayersAndClose:this.props.addLayersAndClose})),e)):e}render(){return Object(g.jsx)(s.a.Fragment,null,Object(g.jsx)(a.EuiFlyoutHeader,{hasBorder:!0,className:"mapLayerPanel__header"},Object(g.jsx)(a.EuiTitle,{size:"s"},Object(g.jsx)("h2",null,this.state.currentStep?this.state.currentStep.label:v))),Object(g.jsx)(_,{layerWizard:this.state.layerWizard,onClear:this._clearLayerWizard,onWizardSelect:this._onWizardSelect,previewLayers:this._previewLayers,showBackButton:!this.state.isStepLoading,currentStepId:this.state.currentStep?this.state.currentStep.id:null,isOnFinalStep:!!this.state.currentStep&&this.state.currentStep.id===y,enableNextBtn:this._enableNextBtn,disableNextBtn:this._disableNextBtn,startStepLoading:this._startStepLoading,stopStepLoading:this._stopStepLoading,advanceToNextStep:this._onNext}),Object(g.jsx)(a.EuiFlyoutFooter,{className:"mapLayerPanel__footer"},Object(g.jsx)(a.EuiFlexGroup,{justifyContent:"spaceBetween",responsive:!1,gutterSize:"none"},Object(g.jsx)(a.EuiFlexItem,{grow:!1},Object(g.jsx)(a.EuiButtonEmpty,{onClick:this.props.closeFlyout,flush:"left","data-test-subj":"layerAddCancelButton"},Object(g.jsx)(u.FormattedMessage,{id:"xpack.maps.addLayerPanel.footer.cancelButtonLabel",defaultMessage:"Cancel"}))),this._renderNextButton())))}}},303:function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return v}));var i=n(4),r=n.n(i),o=n(3);const s=r.a.createContext(null),a=({children:t,...e})=>Object(o.jsx)(s.Provider,{value:{setIsFullscreen:t=>{e.coreStart.chrome.setIsVisible(!t)},customBranding$:e.coreStart.customBranding.customBranding$}},t);var l=n(14),u=n(1),c=n(42),h=n.n(c);n(313);const d=u.i18n.translate("sharedUXPackages.exitFullScreenButton.exitFullScreenModeButtonText",{defaultMessage:"Exit full screen"}),p=u.i18n.translate("sharedUXPackages.exitFullScreenButton.fullScreenModeDescription",{defaultMessage:"In full screen mode, press ESC to exit."}),f=({onClick:t,className:e,customLogo:n})=>{const{euiTheme:i}=Object(l.useEuiTheme)(),{colors:r,size:s,border:a}=i,u=Object(o.css)("padding:",s.xs," ",s.s,";background:",r.fullShade,";border-radius:",a.radius.small,";height:",s.xl,";color:",Object(l.makeHighContrastColor)(r.emptyShade)(r.fullShade),";outline-color:",r.emptyShade,";","");return Object(o.jsx)("div",null,Object(o.jsx)(l.EuiScreenReaderOnly,null,Object(o.jsx)("p",{"aria-live":"polite"},p)),Object(o.jsx)("button",{css:u,className:h()("exitFullScreenButton",e),onClick:t,"data-test-subj":"exitFullScreenModeButton"},Object(o.jsx)(l.EuiFlexGroup,{component:"span",responsive:!1,alignItems:"center",gutterSize:"s"},Object(o.jsx)(l.EuiFlexItem,{component:"span",grow:!1},n?Object(o.jsx)(l.EuiImage,{src:n,size:16,alt:"customLogo"}):Object(o.jsx)(l.EuiIcon,{type:"logoElastic",size:"m"})),Object(o.jsx)(l.EuiFlexItem,{component:"span",grow:!1,"data-test-subj":"exitFullScreenModeText"},d),Object(o.jsx)(l.EuiFlexItem,{component:"span",grow:!1},Object(o.jsx)(l.EuiIcon,{type:"fullScreenExit",size:"s"})))))};var g=n(152),m=n.n(g),_=n(240),y=n.n(_);const v=({onExit:t=(()=>{}),toggleChrome:e=!0})=>{const{euiTheme:n}=Object(l.useEuiTheme)(),{setIsFullscreen:r,customBranding$:a}=function(){const t=Object(i.useContext)(s);if(!t)throw new Error("ExitFullScreenButtonContext is missing. Ensure your component or React root is wrapped with ExitFullScreenButtonProvider.");return t}(),u=m()(),c=y()(a),h=null==c?void 0:c.logo,d=Object(i.useCallback)((()=>{e&&r(!1),t()}),[t,r,e]),p=Object(i.useCallback)((t=>{t.key===l.keys.ESCAPE&&d()}),[d]);Object(i.useEffect)((()=>(document.addEventListener("keydown",p,!1),e&&r(!0),()=>{d(),document.removeEventListener("keydown",p,!1)})),[p,e,r,d]),Object(i.useEffect)((()=>{!u()&&e&&r(!1)}),[u,r,e]);const g=Object(o.css)("bottom:",n.size.s,";left:",n.size.s,";position:fixed;z-index:5;","");return Object(o.jsx)(f,{css:g,customLogo:h,onClick:d})}},304:function(t,e,n){"use strict";n.d(e,"a",(function(){return xyz_tms_source_XYZTMSSource})),n.d(e,"b",(function(){return y}));var i=n(2),r=n.n(i),o=n(1),s=n(74),a=n(0),l=n(110),u=n(130);const c=o.i18n.translate("xpack.maps.source.ems_xyzTitle",{defaultMessage:"Tile Map Service"});class xyz_tms_source_XYZTMSSource extends l.a{static createDescriptor({urlTemplate:t}){return{type:xyz_tms_source_XYZTMSSource.type,urlTemplate:t}}constructor(t){super(t),r()(this,"_descriptor",void 0),this._descriptor=t}async getImmutableProperties(){return[{label:Object(s.a)(),value:c},{label:Object(s.f)(),value:this._descriptor.urlTemplate}]}async getDisplayName(){return this._descriptor.urlTemplate}async getUrlTemplate(){return this._descriptor.urlTemplate}async hasLegendDetails(){return!1}renderLegendDetails(){return null}isSourceStale(t,e){var n;return!!e.url&&(null===(n=t.tiles)||void 0===n?void 0:n[0])!==e.url}async canSkipSourceUpdate(t,e){const n=null==t?void 0:t.getMeta();return await Object(u.b)({extentAware:!1,source:this,prevDataRequest:t,nextRequestMeta:e,getUpdateDueToTimeslice:t=>!n||this.getUpdateDueToTimeslice(n,t)})}}r()(xyz_tms_source_XYZTMSSource,"type",a.Ab.EMS_XYZ);var h=n(4),d=n(39),p=n.n(d),f=n(14),g=n(3);class xyz_tms_editor_XYZTMSEditor extends h.Component{constructor(...t){super(...t),r()(this,"state",{url:""}),r()(this,"_previewLayer",p.a.debounce((()=>{const{url:t}=this.state,e=t.indexOf("{x}")>=0&&t.indexOf("{y}")>=0&&t.indexOf("{z}")>=0?{urlTemplate:t}:null;this.props.onSourceConfigChange(e)}),500)),r()(this,"_onUrlChange",(t=>{this.setState({url:t.target.value},this._previewLayer)}))}render(){return Object(g.jsx)(f.EuiPanel,null,Object(g.jsx)(f.EuiFormRow,{label:"Url"},Object(g.jsx)(f.EuiFieldText,{placeholder:"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",onChange:this._onUrlChange})))}}var m=n(150),_=n(279);const y={id:a.Hb.TMS_LAYER,order:10,categories:[a.ab.REFERENCE],description:o.i18n.translate("xpack.maps.source.ems_xyzDescription",{defaultMessage:"Raster image tile map service using {z}/{x}/{y} url pattern.",values:{z:"{z}",x:"{x}",y:"{y}"}}),icon:_.a,renderWizard:({previewLayers:t})=>Object(g.jsx)(xyz_tms_editor_XYZTMSEditor,{onSourceConfigChange:e=>{if(!e)return void t([]);const n=m.a.createDescriptor({sourceDescriptor:xyz_tms_source_XYZTMSSource.createDescriptor(e)});t([n])}}),title:c}},313:function(t,e,n){switch(window.__kbnThemeTag__){case"v8dark":return n(314);case"v8light":return n(316)}},314:function(t,e,n){var i=n(83),r=n(315);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.i,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},315:function(t,e,n){(e=n(84)(!1)).push([t.i,".exitFullScreenButton{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-appearance:none;appearance:none;box-shadow:0 1px 5px #00000040,0 3.6px 13px rgba(0,0,0,.175),0 8.4px 23px #00000026,0 23px 35px rgba(0,0,0,.125);cursor:pointer;display:inline-block;font-family:Inter UI,-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-kerning:normal;font-size:14px;font-size:1rem;font-weight:400;font-weight:500;height:40px;letter-spacing:normal;line-height:40px;line-height:1.71429rem;max-width:100%;outline-offset:-1px;text-align:center;text-decoration:none;vertical-align:middle;white-space:nowrap}@media screen and (prefers-reduced-motion:no-preference){.exitFullScreenButton{transition:transform .25s ease-in-out,background-color .25s ease-in-out}.exitFullScreenButton:hover:not(:disabled){transform:translateY(-1px)}.exitFullScreenButton:focus{animation:euiButtonActive .25s cubic-bezier(.34,1.61,.7,1)}.exitFullScreenButton:active:not(:disabled){transform:translateY(1px)}}.exitFullScreenButton:focus,.exitFullScreenButton:hover:not(:disabled){text-decoration:underline}",""]),t.exports=e},316:function(t,e,n){var i=n(83),r=n(317);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.i,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},317:function(t,e,n){(e=n(84)(!1)).push([t.i,".exitFullScreenButton{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-appearance:none;appearance:none;box-shadow:0 1px 5px #0000001a,0 3.6px 13px #00000012,0 8.4px 23px #0000000f,0 23px 35px #0000000d;cursor:pointer;display:inline-block;font-family:Inter UI,-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-kerning:normal;font-size:14px;font-size:1rem;font-weight:400;font-weight:500;height:40px;letter-spacing:normal;line-height:40px;line-height:1.71429rem;max-width:100%;outline-offset:-1px;text-align:center;text-decoration:none;vertical-align:middle;white-space:nowrap}@media screen and (prefers-reduced-motion:no-preference){.exitFullScreenButton{transition:transform .25s ease-in-out,background-color .25s ease-in-out}.exitFullScreenButton:hover:not(:disabled){transform:translateY(-1px)}.exitFullScreenButton:focus{animation:euiButtonActive .25s cubic-bezier(.34,1.61,.7,1)}.exitFullScreenButton:active:not(:disabled){transform:translateY(1px)}}.exitFullScreenButton:focus,.exitFullScreenButton:hover:not(:disabled){text-decoration:underline}",""]),t.exports=e},318:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),r="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;e.default=r},339:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(4);e.default=function(t,e){void 0===e&&(e=0);var n=i.useRef(!1),r=i.useRef(),o=i.useRef(t),s=i.useCallback((function(){return n.current}),[]),a=i.useCallback((function(){n.current=!1,r.current&&clearTimeout(r.current),r.current=setTimeout((function(){n.current=!0,o.current()}),e)}),[e]),l=i.useCallback((function(){n.current=null,r.current&&clearTimeout(r.current)}),[]);return i.useEffect((function(){o.current=t}),[t]),i.useEffect((function(){return a(),l}),[e]),[s,l,a]}},480:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createSelector=void 0,e.createSelectorCreator=r,e.createStructuredSelector=void 0,Object.defineProperty(e,"defaultEqualityCheck",{enumerable:!0,get:function(){return i.defaultEqualityCheck}}),Object.defineProperty(e,"defaultMemoize",{enumerable:!0,get:function(){return i.defaultMemoize}});var i=n(481);function r(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i-1){var o=n[r];return r>0&&(n.splice(r,1),n.unshift(o)),o.value}return i}return{get:r,put:function(e,o){r(e)===i&&(n.unshift({key:e,value:o}),n.length>t&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(h,p);function g(){var e=f.get(arguments);if(e===i){if(e=t.apply(null,arguments),d){var n=f.getEntries().find((function(t){return d(t.value,e)}));n&&(e=n.value)}f.put(arguments,e)}return e}return g.clearCache=function(){return f.clear()},g};var i="NOT_FOUND",r=function(t,e){return t===e};function o(t){return function(e,n){if(null===e||null===n||e.length!==n.length)return!1;for(var i=e.length,r=0;r=0;i--){var r=e[i](t);if(r)return r}return function(e,i){throw new Error("Invalid value of type "+typeof t+" for "+n+" argument when connecting component "+i.wrappedComponentName+".")}}function f(t,e){return t===e}function g(t){var e=void 0===t?{}:t,n=e.connectHOC,i=void 0===n?s.default:n,g=e.mapStateToPropsFactories,m=void 0===g?u.default:g,_=e.mapDispatchToPropsFactories,y=void 0===_?l.default:_,v=e.mergePropsFactories,b=void 0===v?c.default:v,x=e.selectorFactory,E=void 0===x?h.default:x;return function(t,e,n,s){void 0===s&&(s={});var l=s,u=l.pure,c=void 0===u||u,h=l.areStatesEqual,g=void 0===h?f:h,_=l.areOwnPropsEqual,v=void 0===_?a.default:_,x=l.areStatePropsEqual,S=void 0===x?a.default:x,C=l.areMergedPropsEqual,I=void 0===C?a.default:C,O=(0,o.default)(l,d),w=p(t,m,"mapStateToProps"),L=p(e,y,"mapDispatchToProps"),T=p(n,b,"mergeProps");return i(E,(0,r.default)({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:Boolean(t),initMapStateToProps:w,initMapDispatchToProps:L,initMergeProps:T,pure:c,areStatesEqual:g,areOwnPropsEqual:v,areStatePropsEqual:S,areMergedPropsEqual:I},O))}}var m=g();e.default=m},491:function(t,e,n){"use strict";var i=n(96).default;e.__esModule=!0,e.default=void 0,e.whenMapDispatchToPropsIsFunction=s,e.whenMapDispatchToPropsIsMissing=a,e.whenMapDispatchToPropsIsObject=l;var r=i(n(492)),o=n(290);function s(t){return"function"==typeof t?(0,o.wrapMapToPropsFunc)(t,"mapDispatchToProps"):void 0}function a(t){return t?void 0:(0,o.wrapMapToPropsConstant)((function(t){return{dispatch:t}}))}function l(t){return t&&"object"==typeof t?(0,o.wrapMapToPropsConstant)((function(e){return(0,r.default)(t,e)})):void 0}var u=[s,a,l];e.default=u},492:function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){var n={},i=function(i){var r=t[i];"function"==typeof r&&(n[i]=function(){return e(r.apply(void 0,arguments))})};for(var r in t)i(r);return n}},493:function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n}},494:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0,e.whenMapStateToPropsIsFunction=r,e.whenMapStateToPropsIsMissing=o;var i=n(290);function r(t){return"function"==typeof t?(0,i.wrapMapToPropsFunc)(t,"mapStateToProps"):void 0}function o(t){return t?void 0:(0,i.wrapMapToPropsConstant)((function(){return{}}))}var s=[r,o];e.default=s},495:function(t,e,n){"use strict";var i=n(96).default;e.__esModule=!0,e.default=void 0,e.defaultMergeProps=o,e.whenMergePropsIsFunction=a,e.whenMergePropsIsOmitted=l,e.wrapMergePropsFunc=s;var r=i(n(23));function o(t,e,n){return(0,r.default)({},n,t,e)}function s(t){return function(e,n){n.displayName;var i,r=n.pure,o=n.areMergedPropsEqual,s=!1;return function(e,n,a){var l=t(e,n,a);return s?r&&o(l,i)||(i=l):(s=!0,i=l),i}}}function a(t){return"function"==typeof t?s(t):void 0}function l(t){return t?void 0:function(){return o}}i(n(291));var u=[a,l];e.default=u},496:function(t,e,n){"use strict";var i=n(96).default;e.__esModule=!0,e.default=function(t,e){var n=e.initMapStateToProps,i=e.initMapDispatchToProps,l=e.initMergeProps,u=(0,r.default)(e,o),c=n(t,u),h=i(t,u),d=l(t,u);return(u.pure?a:s)(c,h,d,t,u)},e.impureFinalPropsSelectorFactory=s,e.pureFinalPropsSelectorFactory=a;var r=i(n(223)),o=(i(n(497)),["initMapStateToProps","initMapDispatchToProps","initMergeProps"]);function s(t,e,n,i){return function(r,o){return n(t(r,o),e(i,o),o)}}function a(t,e,n,i,r){var o,s,a,l,u,c=r.areStatesEqual,h=r.areOwnPropsEqual,d=r.areStatePropsEqual,p=!1;return function(r,f){return p?function(r,p){var f,g,m=!h(p,s),_=!c(r,o);return o=r,s=p,m&&_?(a=t(o,s),e.dependsOnOwnProps&&(l=e(i,s)),u=n(a,l,s)):m?(t.dependsOnOwnProps&&(a=t(o,s)),e.dependsOnOwnProps&&(l=e(i,s)),u=n(a,l,s)):_?(f=t(o,s),g=!d(f,a),a=f,g&&(u=n(a,l,s)),u):u}(r,f):(a=t(o=r,s=f),l=e(i,s),u=n(a,l,s),p=!0,u)}}},497:function(t,e,n){"use strict";var i=n(96).default;e.__esModule=!0,e.default=function(t,e,n,i){o(t,"mapStateToProps",i),o(e,"mapDispatchToProps",i),o(n,"mergeProps",i)};var r=i(n(292));function o(t,e,n){if(!t)throw new Error("Unexpected value for "+e+" in "+n+".");"mapStateToProps"!==e&&"mapDispatchToProps"!==e||Object.prototype.hasOwnProperty.call(t,"dependsOnOwnProps")||(0,r.default)("The selector for "+e+" of "+n+" did not specify a value for dependsOnOwnProps.")}},498:function(t,e,n){"use strict";e.__esModule=!0,e.createDispatchHook=o,e.useDispatch=void 0;var i=n(119),r=n(293);function o(t){void 0===t&&(t=i.ReactReduxContext);var e=t===i.ReactReduxContext?r.useStore:(0,r.createStoreHook)(t);return function(){return e().dispatch}}var s=o();e.useDispatch=s},499:function(t,e,n){"use strict";e.__esModule=!0,e.createSelectorHook=u,e.useSelector=void 0;var i=n(4),r=n(294),o=n(221),s=n(222),a=n(119),l=function(t,e){return t===e};function u(t){void 0===t&&(t=a.ReactReduxContext);var e=t===a.ReactReduxContext?r.useReduxContext:function(){return(0,i.useContext)(t)};return function(t,n){void 0===n&&(n=l);var r=e(),a=function(t,e,n,r){var a,l=(0,i.useReducer)((function(t){return t+1}),0)[1],u=(0,i.useMemo)((function(){return(0,o.createSubscription)(n,r)}),[n,r]),c=(0,i.useRef)(),h=(0,i.useRef)(),d=(0,i.useRef)(),p=(0,i.useRef)(),f=n.getState();try{if(t!==h.current||f!==d.current||c.current){var g=t(f);a=void 0!==p.current&&e(g,p.current)?p.current:g}else a=p.current}catch(t){throw c.current&&(t.message+="\nThe error may be correlated with this previous error:\n"+c.current.stack+"\n\n"),t}return(0,s.useIsomorphicLayoutEffect)((function(){h.current=t,d.current=f,p.current=a,c.current=void 0})),(0,s.useIsomorphicLayoutEffect)((function(){function t(){try{var t=n.getState();if(t===d.current)return;var i=h.current(t);if(e(i,p.current))return;p.current=i,d.current=t}catch(t){c.current=t}l()}return u.onStateChange=t,u.trySubscribe(),t(),function(){return u.tryUnsubscribe()}}),[n,u]),a}(t,n,r.store,r.subscription);return(0,i.useDebugValue)(a),a}}var c=u();e.useSelector=c},500:function(t,e,n){"use strict";e.__esModule=!0,e.unstable_batchedUpdates=void 0;var i=n(8);e.unstable_batchedUpdates=i.unstable_batchedUpdates},501:function(t,e,n){switch(window.__kbnThemeTag__){case"v8dark":return n(502);case"v8light":return n(504)}},502:function(t,e,n){var i=n(83),r=n(503);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.i,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},503:function(t,e,n){(e=n(84)(!1)).push([t.i,"#maps-plugin{display:flex;flex-direction:column;height:calc(100vh - 96px);overflow:hidden;width:100%}.kbnBody--chromeHidden #maps-plugin{height:100vh}.kbnBody--hasHeaderBanner #maps-plugin{height:calc(100vh - 128px)}.kbnBody--chromeHidden.kbnBody--hasHeaderBanner #maps-plugin{height:calc(100vh - 32px)}#react-maps-root{display:flex;flex-direction:column;flex-grow:1}.euiColorPicker__emptySwatch{position:relative}.mapContainer{flex-grow:1}.mapContainer .maplibregl-ctrl-top-left .maplibregl-ctrl{margin-left:12px;margin-top:12px}.mapContainer .maplibregl-ctrl-group:not(:empty){background-color:#1d1e24;border-radius:4px;box-shadow:0 2.7px 9px rgba(0,0,0,.325),0 9.4px 24px rgba(0,0,0,.225),0 21.8px 43px #0003;overflow:hidden;transition:transform .25s ease-in-out}.mapContainer .maplibregl-ctrl-group:not(:empty):hover{transform:translateY(-1px)}.mapContainer .maplibregl-ctrl-group:not(:empty)>button{height:32px;width:32px}.mapContainer .maplibregl-ctrl-group:not(:empty)>button+button{border:none}.mapContainer .maplibregl-ctrl button:not(:disabled){transition:background .25s ease-in-out}.mapContainer .maplibregl-ctrl button:not(:disabled):hover{background-color:#98a2b31a}.mapContainer .maplibregl-ctrl-group button:focus:focus-visible{box-shadow:none}.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='15' height='15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23DFE5EF' d='M8 7V3.5a.5.5 0 0 0-1 0V7H3.5a.5.5 0 0 0 0 1H7v3.5a.5.5 0 1 0 1 0V8h3.5a.5.5 0 1 0 0-1H8Zm-.5 8a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z'/%3E%3C/svg%3E\")!important;background-position:50%!important;background-repeat:no-repeat!important}.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='15' height='15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23DFE5EF' d='M7.5 0C11.636 0 15 3.364 15 7.5S11.636 15 7.5 15 0 11.636 0 7.5 3.364 0 7.5 0Zm-4 7a.5.5 0 0 0 0 1h8a.5.5 0 1 0 0-1h-8Z'/%3E%3C/svg%3E\")!important;background-position:50%!important;background-repeat:no-repeat!important}.mapMapWrapper{position:relative}.mapMapLayerPanel{background-color:#141519;overflow:hidden;width:0}.mapMapLayerPanel>*{width:480px}.mapMapLayerPanel-isVisible{transition:width .25s cubic-bezier(.694,.0482,.335,1);width:480px}.mapTimeslider{bottom:16px;left:calc(50% - 400px);position:absolute;z-index:99999}.mapTimeslider .controlFrame__formControlLayout{box-shadow:0 2.7px 9px rgba(0,0,0,.325),0 9.4px 24px rgba(0,0,0,.225),0 21.8px 43px #0003}.mapTimeslider--animation{animation:mapAnimationPulse .6s ease-in-out}.mapLayerPanel__footer,.mapLayerPanel__header{padding:16px}.mapLayerPanel__body{flex-basis:1px;flex-grow:1;overflow-y:auto;padding-bottom:0;scrollbar-color:#98a2b380 #0000;scrollbar-width:thin}.mapLayerPanel__body::-webkit-scrollbar{height:16px;width:16px}.mapLayerPanel__body::-webkit-scrollbar-thumb{background-clip:content-box;background-color:#98a2b380;border:6px solid #0000;border-radius:16px}.mapLayerPanel__body::-webkit-scrollbar-corner,.mapLayerPanel__body::-webkit-scrollbar-track{background-color:#0000}.mapLayerPanel__body .mapLayerPanel__bodyOverflow{padding:16px}.mapLayerPanel__body .mapLayerPanel__bodyOverflow>:last-child{margin-bottom:16px}.mapLayerPanel__sourceDetails{margin-left:32px}.mapLayerPanel__sourceDetail{margin-bottom:0!important}.mapLayerPanel__footer{border-top:1px solid #343741}.mapAttributionFormRow{display:flex;margin:8px 0}.mapAttributionFormRow__legend{align-items:center;color:#dfe5ef;display:inline-flex;font-size:12px;font-size:.85714rem;font-weight:600;height:32px;line-height:1.14286rem;margin-right:8px;overflow-wrap:break-word!important;width:calc(33% - 8px);word-break:break-word}.mapAttributionFormRow__field{width:67%}.mapAttributionFormRow__addButton{margin-top:4px}.mapAttributionFormRow__buttons{display:flex;justify-content:flex-end;margin-top:4px}.mapAttributionPopover{width:480px}.mapFilterEditor{overflow-y:visible;width:calc(95vw - 440px)}.mapJoinItem{background:#343741;border-radius:6px;margin-bottom:12px;padding:8px 4px;position:relative}.mapJoinItem .mapJoinItem__inner{overflow-x:auto;scrollbar-color:#98a2b380 #0000;scrollbar-width:thin}.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar{height:16px;width:16px}.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar-thumb{background-clip:content-box;background-color:#98a2b380;border:6px solid #0000;border-radius:16px}.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar-corner,.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar-track{background-color:#0000}.mapJoinItem:focus .mapJoinItem__delete,.mapJoinItem:hover .mapJoinItem__delete{opacity:1;visibility:visible}.mapJoinItem__delete{background:#1d1e24;box-shadow:0 .7px 1.4px rgba(0,0,0,.175),0 1.9px 4px rgba(0,0,0,.125),0 4.5px 10px rgba(0,0,0,.125);margin-right:-8px;margin-top:-12px;opacity:0;padding:4px;position:absolute;right:0;top:50%;visibility:hidden}.mapJoinExpressionHelpText{padding-bottom:8px;padding-top:0}.mapStyleSettings__fixedBox{width:120px}.mapWidgetOverlay{bottom:12px;left:0;pointer-events:none;position:absolute;right:12px;top:12px;z-index:1000}.mapWidgetOverlay__layerWrapper{align-items:flex-end;min-height:0;width:320px}.mapWidgetControl__headerFlexItem{flex-shrink:0}.mapWidgetControl{border-color:#0000!important;display:flex;flex-direction:column;max-height:100%;overflow:hidden;padding-bottom:8px;pointer-events:all;width:100%}.mapWidgetControl.mapWidgetControl-hasShadow{box-shadow:0 2.7px 9px rgba(0,0,0,.325),0 9.4px 24px rgba(0,0,0,.225),0 21.8px 43px #0003}.mapWidgetControl__header{flex-shrink:0;padding:0 16px;text-transform:uppercase}.mapAttributionControl{overflow-wrap:break-word!important;padding-left:12px;pointer-events:all;text-shadow:0 0 2px #1d1e24,0 0 1px #1d1e24,0 0 1px #1d1e24,0 0 1px #1d1e24,0 0 1px #1d1e24 0 0 1px #1d1e24 0 0 1px #1d1e24;word-break:break-word}.mapAttributionControl__fullScreen{margin-left:160px}.mapLayerControl{border-top:1px solid #25262e;flex-basis:auto!important;overflow-y:auto;padding-bottom:9px;scrollbar-color:#98a2b380 #0000;scrollbar-width:thin}.mapLayerControl::-webkit-scrollbar{height:16px;width:16px}.mapLayerControl::-webkit-scrollbar-thumb{background-clip:content-box;background-color:#98a2b380;border:6px solid #0000;border-radius:16px}.mapLayerControl::-webkit-scrollbar-corner,.mapLayerControl::-webkit-scrollbar-track{background-color:#0000}.mapLayerControl__addLayerButton{flex-shrink:0}.mapLayerControl__addLayerButton.euiButton-isDisabled{background-color:#343741!important}.mapLayerControl__addLayerButton,.mapLayerControl__openLayerTOCButton{pointer-events:all}.mapLayerControl__addLayerButton:enabled,.mapLayerControl__addLayerButton:enabled:focus,.mapLayerControl__addLayerButton:enabled:hover,.mapLayerControl__openLayerTOCButton:enabled,.mapLayerControl__openLayerTOCButton:enabled:focus,.mapLayerControl__openLayerTOCButton:enabled:hover{box-shadow:0 2.7px 9px rgba(0,0,0,.325),0 9.4px 24px rgba(0,0,0,.225),0 21.8px 43px #0003}.mapLayerControl__closeLayerTOCButton,.mapLayerControl__openLayerTOCButton{background-color:#1d1e24!important;height:32px;width:32px}.mapLayerToc-droppable-dropNotAllowed *{cursor:not-allowed!important}.mapLayerToc-droppable-isCombining *{cursor:alias!important}.mapLayerToc-droppable-isCombining{background-color:#1d1e24!important}.mapLayerToc-droppable-isDragging *{cursor:ns-resize!important}.mapTocEntry{border-bottom:1px solid #25262e;padding:8px;position:relative}.mapTocEntry:focus,.mapTocEntry:focus-within,.mapTocEntry:hover{z-index:2}.mapTocEntry .mapTocEntry__detailsToggle:focus,.mapTocEntry .mapTocEntry__detailsToggle:hover,.mapTocEntry .mapTocEntry__layerIcons:focus,.mapTocEntry .mapTocEntry__layerIcons:hover,.mapTocEntry:focus .mapTocEntry__detailsToggle,.mapTocEntry:focus .mapTocEntry__layerIcons,.mapTocEntry:focus-within .mapTocEntry__detailsToggle,.mapTocEntry:focus-within .mapTocEntry__layerIcons,.mapTocEntry:hover .mapTocEntry__detailsToggle,.mapTocEntry:hover .mapTocEntry__layerIcons{animation:mapTocEntryBecomeVisible .15s cubic-bezier(.694,.0482,.335,1);display:block}.mapTocEntry-isInEditingMode{background-color:#103148!important;font-size:12px;font-weight:500}.mapTocEntry-isInEditingMode__row{align-items:center;display:inline-flex;margin-left:24px}.mapTocEntry-isInEditingMode__row>*{margin-right:4px}.mapTocEntry-isInEditingMode__editFeatureText{line-height:1;padding-right:4px}.mapTocEntry-isDragging{box-shadow:0 .9px 4px -1px #0003,0 2.6px 8px -1px #00000026,0 5.7px 12px -1px rgba(0,0,0,.125),0 15px 15px -1px #0000001a}.mapTocEntry-isDraggingOver{background-color:#1d1e24;pointer-events:none!important}.mapTocEntry-isCombineLayer{background-color:#7dded840;transition:background-color .5s ease}.mapTocEntry-isSelected{background-color:#2a2c34}.mapTocEntry-notVisible,.mapTocEntry-visible{display:flex}.mapLayTocActions{flex-grow:1;overflow:hidden}.mapLayTocActions__popoverAnchor,.mapLayTocActions__tooltipAnchor{max-width:100%}.mapTocEntry-notVisible .mapTocEntry__layerName{opacity:.5}.mapTocEntry__grab:hover{cursor:grab}.mapTocEntry__layerName{font-weight:500}.mapTocEntry__layerNameText{align-items:center;display:flex}.mapTocEntry__layerNameIcon{flex-shrink:0;margin-right:8px}.mapTocEntry__layerNameIcon>*{vertical-align:sub}.mapTocEntry__layerIcons{display:none;flex-shrink:0}.mapTocEntry__detailsToggle{display:none;left:50%;position:absolute;top:32px;transform:translateX(-50%)}.mapTocEntry__detailsToggleButton{background-color:#1d1e24;border:1px solid #343741;border-radius:3px;color:#dfe5ef;height:16px;line-height:16px;text-align:center;width:32px}.mapTocEntry__detailsToggleButton:focus{outline:2px solid currentColor}.mapTocEntry__detailsToggleButton:focus:focus-visible{outline-style:auto}.mapTocEntry__detailsToggleButton:focus:not(:focus-visible){outline:none}.mapTocEntry__layerDetails{background-color:#141519;margin:8px -8px -8px;-webkit-mask-image:linear-gradient(180deg,#ff00001a 0,red 7.5px,red calc(100% - 7.5px),#ff00001a);mask-image:linear-gradient(180deg,#ff00001a 0,red 7.5px,red calc(100% - 7.5px),#ff00001a);padding:16px 8px 8px}@keyframes mapTocEntryBecomeVisible{0%{opacity:0}to{opacity:1}}.mapViewControl__coordinates{justify-content:center;pointer-events:none;text-shadow:0 0 2px #1d1e24,0 0 1px #1d1e24,0 0 1px #1d1e24,0 0 1px #1d1e24,0 0 1px #1d1e24 0 0 1px #1d1e24 0 0 1px #1d1e24}.mapDrawControl__geometryFilterForm{padding:8px}.mapToolbarOverlay{left:12px;position:absolute;top:84px;z-index:2}.mapToolbarOverlay__button,.mapToolbarOverlay__buttonGroup{position:relative;transition:transform .25s ease-in-out,background .25s ease-in-out}.mapToolbarOverlay__button .mapToolbarOverlay__buttonIcon-empty,.mapToolbarOverlay__buttonGroup .mapToolbarOverlay__buttonIcon-empty{color:#dfe5ef!important}.mapToolbarOverlay__button:hover,.mapToolbarOverlay__buttonGroup:hover{transform:translateY(-1px)}.mapToolbarOverlay__button .euiButtonIcon:hover,.mapToolbarOverlay__buttonGroup .euiButtonIcon:hover{transform:translateY(0)}.mapToolbarOverlay__button .mapToolbarOverlay__buttonIcon-empty:focus:not(:hover),.mapToolbarOverlay__buttonGroup .mapToolbarOverlay__buttonIcon-empty:focus:not(:hover){background:none}.mapToolbarOverlay__buttonGroup{border-radius:4px;display:flex;flex-direction:column;overflow:hidden}.mapToolbarOverlay__buttonGroup .euiButtonIcon{border-radius:0}.mapToolbarOverlay__buttonGroupAnimated{animation:mapAnimationHeadShake 1.2s ease-in-out}.mapToolbarOverlay__button__exit .euiButtonIcon{color:#f86b63!important}.mapKeydownScrollZoom{align-content:center;background:#00000080;bottom:0;display:flex;flex-direction:column;justify-content:center;left:0;opacity:0;padding:16px;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .25s ease .25s;z-index:2000}.mapKeydownScrollZoom--show{opacity:1;transition-duration:.15s}.mapFeatureTooltip_table{width:100%}.mapFeatureTooltip_table td{padding:4px}.mapFeatureTooltip_tableWrapper{max-height:calc(49vh - 64px);overflow:auto}.mapFeatureTooltip_row{border-bottom:1px solid #25262e}.mapFeatureTooltip_actionLinks{padding:4px}.mapFeatureTooltip_backButton{padding-left:0}.mapFeatureTooltip__propertyLabel{font-weight:600;max-width:128px;min-width:80px}.mapFeatureTooltip_actionsRow>span{display:flex;justify-content:flex-end}.mapFeatureTooltip_layerIcon img{margin-bottom:0}.mapScaleControl{border-bottom:2px solid #dfe5ef;border-left:2px solid #dfe5ef;bottom:12px;color:#dfe5ef;left:12px;pointer-events:none;position:absolute;text-align:right;z-index:1000}.mapScaleControlFullScreen{bottom:48px}.mapActionSelectIcon{margin-right:8px}.mapMetricEditorPanel{margin-bottom:8px}.mapMetricEditorPanel__metricEditor{border-top:1px solid #343741;padding:12px 0}.mapMetricEditorPanel__metricEditor:first-child{border-top:none;padding-top:0}.mapMetricEditorPanel__metricEditor:last-child{border-bottom:1px solid #343741;margin-bottom:12px}.mapMetricEditorPanel__metricRemoveButton{padding-top:12px;text-align:right}.mapGeometryFilter__geoFieldSuperSelect{height:48px}.mapGeometryFilter__geoFieldSuperSelectWrapper{height:72px}.mapGeometryFilter__geoFieldItem{padding:4px}.mapTooltipSelector__propertyRow{background-color:#1d1e24;border-bottom:1px solid #343741;display:flex;padding:4px 0}.mapTooltipSelector__propertyRow .mapTooltipSelector__propertyIcons:focus,.mapTooltipSelector__propertyRow .mapTooltipSelector__propertyIcons:hover,.mapTooltipSelector__propertyRow:focus .mapTooltipSelector__propertyIcons,.mapTooltipSelector__propertyRow:focus-within .mapTooltipSelector__propertyIcons,.mapTooltipSelector__propertyRow:hover .mapTooltipSelector__propertyIcons{animation:mapPropertyIconsBecomeVisible .15s cubic-bezier(.694,.0482,.335,1);display:block}.mapTooltipSelector__propertyRow-isDragging{box-shadow:0 .9px 4px -1px #0003,0 2.6px 8px -1px #00000026,0 5.7px 12px -1px rgba(0,0,0,.125),0 15px 15px -1px #0000001a}.mapTooltipSelector__propertyRow-isDraggingOver{pointer-events:none!important}.mapTooltipSelector__propertyContent{flex-grow:1;min-height:24px;overflow:hidden}.mapTooltipSelector__propertyIcons{display:none;flex-shrink:0}.mapTooltipSelector__grab:hover{cursor:grab}@keyframes mapPropertyIconsBecomeVisible{0%{opacity:0}to{opacity:1}}.mapColorGradient{bottom:0;height:4px;left:0;position:relative;right:0;top:0;width:100%}.mapFillableCircle{overflow:visible}.mapStyleFormDisabledTooltip{width:100%}.mapColorStop{position:relative}.mapColorStop+.mapColorStop{margin-top:8px}.mapIconSelectSymbol__inputButton{margin:0 4px}.mapsCustomIconPreview__mapContainer{height:150px}.mapsCustomIconForm{min-width:400px}.mapsCustomIconForm__preview{max-width:210px;min-height:210px}.mapLegendIconPreview{width:24px}.vectorStyleLegendSpacer:not(:last-child){margin-bottom:8px}.mapLayersWizardIcon{margin-top:8px}.mapLayersWizardIcon__highlight{fill:#fff}.mapLayersWizardIcon__background{fill:#535966}.mapLayersWizardIcon__backgroundDarker{fill:#98a2b3}@keyframes mapAnimationHeadShake{0%{transform:translateX(0)}6.5%{transform:translateX(-6px) rotateY(-9deg)}18.5%{transform:translateX(5px) rotateY(7deg)}31.5%{transform:translateX(-3px) rotateY(-5deg)}43.5%{transform:translateX(2px) rotateY(3deg)}50%{transform:translateX(0)}}@keyframes mapAnimationPulse{0%{transform:scaleX(1)}50%{transform:scale3d(1.005,1.005,1.005)}to{transform:scaleX(1)}}.mapEmbeddableContainer{display:flex;flex:1 1 100%;height:100%;min-height:0;width:100%;z-index:1}.mapEmbeddedError{align-items:center;display:flex;flex-grow:1;justify-content:center;overflow:auto}",""]),t.exports=e},504:function(t,e,n){var i=n(83),r=n(505);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.i,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},505:function(t,e,n){(e=n(84)(!1)).push([t.i,"#maps-plugin{display:flex;flex-direction:column;height:calc(100vh - 96px);overflow:hidden;width:100%}.kbnBody--chromeHidden #maps-plugin{height:100vh}.kbnBody--hasHeaderBanner #maps-plugin{height:calc(100vh - 128px)}.kbnBody--chromeHidden.kbnBody--hasHeaderBanner #maps-plugin{height:calc(100vh - 32px)}#react-maps-root{display:flex;flex-direction:column;flex-grow:1}.euiColorPicker__emptySwatch{position:relative}.mapContainer{flex-grow:1}.mapContainer .maplibregl-ctrl-top-left .maplibregl-ctrl{margin-left:12px;margin-top:12px}.mapContainer .maplibregl-ctrl-group:not(:empty){background-color:#fff;border-radius:4px;box-shadow:0 2.7px 9px #00000021,0 9.4px 24px #00000017,0 21.8px 43px #00000014;overflow:hidden;transition:transform .25s ease-in-out}.mapContainer .maplibregl-ctrl-group:not(:empty):hover{transform:translateY(-1px)}.mapContainer .maplibregl-ctrl-group:not(:empty)>button{height:32px;width:32px}.mapContainer .maplibregl-ctrl-group:not(:empty)>button+button{border:none}.mapContainer .maplibregl-ctrl button:not(:disabled){transition:background .25s ease-in-out}.mapContainer .maplibregl-ctrl button:not(:disabled):hover{background-color:#69707d1a}.mapContainer .maplibregl-ctrl-group button:focus:focus-visible{box-shadow:none}.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='15' height='15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23343741' d='M8 7V3.5a.5.5 0 0 0-1 0V7H3.5a.5.5 0 0 0 0 1H7v3.5a.5.5 0 1 0 1 0V8h3.5a.5.5 0 1 0 0-1H8Zm-.5 8a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z'/%3E%3C/svg%3E\")!important;background-position:50%!important;background-repeat:no-repeat!important}.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='15' height='15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23343741' d='M7.5 0C11.636 0 15 3.364 15 7.5S11.636 15 7.5 15 0 11.636 0 7.5 3.364 0 7.5 0Zm-4 7a.5.5 0 0 0 0 1h8a.5.5 0 1 0 0-1h-8Z'/%3E%3C/svg%3E\")!important;background-position:50%!important;background-repeat:no-repeat!important}.mapMapWrapper{position:relative}.mapMapLayerPanel{background-color:#fafbfd;overflow:hidden;width:0}.mapMapLayerPanel>*{width:480px}.mapMapLayerPanel-isVisible{transition:width .25s cubic-bezier(.694,.0482,.335,1);width:480px}.mapTimeslider{bottom:16px;left:calc(50% - 400px);position:absolute;z-index:99999}.mapTimeslider .controlFrame__formControlLayout{box-shadow:0 2.7px 9px #00000021,0 9.4px 24px #00000017,0 21.8px 43px #00000014}.mapTimeslider--animation{animation:mapAnimationPulse .6s ease-in-out}.mapLayerPanel__footer,.mapLayerPanel__header{padding:16px}.mapLayerPanel__body{flex-basis:1px;flex-grow:1;overflow-y:auto;padding-bottom:0;scrollbar-color:#69707d80 #0000;scrollbar-width:thin}.mapLayerPanel__body::-webkit-scrollbar{height:16px;width:16px}.mapLayerPanel__body::-webkit-scrollbar-thumb{background-clip:content-box;background-color:#69707d80;border:6px solid #0000;border-radius:16px}.mapLayerPanel__body::-webkit-scrollbar-corner,.mapLayerPanel__body::-webkit-scrollbar-track{background-color:#0000}.mapLayerPanel__body .mapLayerPanel__bodyOverflow{padding:16px}.mapLayerPanel__body .mapLayerPanel__bodyOverflow>:last-child{margin-bottom:16px}.mapLayerPanel__sourceDetails{margin-left:32px}.mapLayerPanel__sourceDetail{margin-bottom:0!important}.mapLayerPanel__footer{border-top:1px solid #d3dae6}.mapAttributionFormRow{display:flex;margin:8px 0}.mapAttributionFormRow__legend{align-items:center;color:#1a1c21;display:inline-flex;font-size:12px;font-size:.85714rem;font-weight:600;height:32px;line-height:1.14286rem;margin-right:8px;overflow-wrap:break-word!important;width:calc(33% - 8px);word-break:break-word}.mapAttributionFormRow__field{width:67%}.mapAttributionFormRow__addButton{margin-top:4px}.mapAttributionFormRow__buttons{display:flex;justify-content:flex-end;margin-top:4px}.mapAttributionPopover{width:480px}.mapFilterEditor{overflow-y:visible;width:calc(95vw - 440px)}.mapJoinItem{background:#f8f9fb;border-radius:6px;margin-bottom:12px;padding:8px 4px;position:relative}.mapJoinItem .mapJoinItem__inner{overflow-x:auto;scrollbar-color:#69707d80 #0000;scrollbar-width:thin}.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar{height:16px;width:16px}.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar-thumb{background-clip:content-box;background-color:#69707d80;border:6px solid #0000;border-radius:16px}.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar-corner,.mapJoinItem .mapJoinItem__inner::-webkit-scrollbar-track{background-color:#0000}.mapJoinItem:focus .mapJoinItem__delete,.mapJoinItem:hover .mapJoinItem__delete{opacity:1;visibility:visible}.mapJoinItem__delete{background:#fff;box-shadow:0 .7px 1.4px #00000012,0 1.9px 4px #0000000d,0 4.5px 10px #0000000d;margin-right:-8px;margin-top:-12px;opacity:0;padding:4px;position:absolute;right:0;top:50%;visibility:hidden}.mapJoinExpressionHelpText{padding-bottom:8px;padding-top:0}.mapStyleSettings__fixedBox{width:120px}.mapWidgetOverlay{bottom:12px;left:0;pointer-events:none;position:absolute;right:12px;top:12px;z-index:1000}.mapWidgetOverlay__layerWrapper{align-items:flex-end;min-height:0;width:320px}.mapWidgetControl__headerFlexItem{flex-shrink:0}.mapWidgetControl{border-color:#0000!important;display:flex;flex-direction:column;max-height:100%;overflow:hidden;padding-bottom:8px;pointer-events:all;width:100%}.mapWidgetControl.mapWidgetControl-hasShadow{box-shadow:0 2.7px 9px #00000021,0 9.4px 24px #00000017,0 21.8px 43px #00000014}.mapWidgetControl__header{flex-shrink:0;padding:0 16px;text-transform:uppercase}.mapAttributionControl{overflow-wrap:break-word!important;padding-left:12px;pointer-events:all;text-shadow:0 0 2px #fff,0 0 1px #fff,0 0 1px #fff,0 0 1px #fff,0 0 1px #fff 0 0 1px #fff 0 0 1px #fff;word-break:break-word}.mapAttributionControl__fullScreen{margin-left:160px}.mapLayerControl{border-top:1px solid #f5f7fa;flex-basis:auto!important;overflow-y:auto;padding-bottom:9px;scrollbar-color:#69707d80 #0000;scrollbar-width:thin}.mapLayerControl::-webkit-scrollbar{height:16px;width:16px}.mapLayerControl::-webkit-scrollbar-thumb{background-clip:content-box;background-color:#69707d80;border:6px solid #0000;border-radius:16px}.mapLayerControl::-webkit-scrollbar-corner,.mapLayerControl::-webkit-scrollbar-track{background-color:#0000}.mapLayerControl__addLayerButton{flex-shrink:0}.mapLayerControl__addLayerButton.euiButton-isDisabled{background-color:#d3dae6!important}.mapLayerControl__addLayerButton,.mapLayerControl__openLayerTOCButton{pointer-events:all}.mapLayerControl__addLayerButton:enabled,.mapLayerControl__addLayerButton:enabled:focus,.mapLayerControl__addLayerButton:enabled:hover,.mapLayerControl__openLayerTOCButton:enabled,.mapLayerControl__openLayerTOCButton:enabled:focus,.mapLayerControl__openLayerTOCButton:enabled:hover{box-shadow:0 2.7px 9px #00000021,0 9.4px 24px #00000017,0 21.8px 43px #00000014}.mapLayerControl__closeLayerTOCButton,.mapLayerControl__openLayerTOCButton{background-color:#fff!important;height:32px;width:32px}.mapLayerToc-droppable-dropNotAllowed *{cursor:not-allowed!important}.mapLayerToc-droppable-isCombining *{cursor:alias!important}.mapLayerToc-droppable-isCombining{background-color:#fff!important}.mapLayerToc-droppable-isDragging *{cursor:ns-resize!important}.mapTocEntry{border-bottom:1px solid #f5f7fa;padding:8px;position:relative}.mapTocEntry:focus,.mapTocEntry:focus-within,.mapTocEntry:hover{z-index:2}.mapTocEntry .mapTocEntry__detailsToggle:focus,.mapTocEntry .mapTocEntry__detailsToggle:hover,.mapTocEntry .mapTocEntry__layerIcons:focus,.mapTocEntry .mapTocEntry__layerIcons:hover,.mapTocEntry:focus .mapTocEntry__detailsToggle,.mapTocEntry:focus .mapTocEntry__layerIcons,.mapTocEntry:focus-within .mapTocEntry__detailsToggle,.mapTocEntry:focus-within .mapTocEntry__layerIcons,.mapTocEntry:hover .mapTocEntry__detailsToggle,.mapTocEntry:hover .mapTocEntry__layerIcons{animation:mapTocEntryBecomeVisible .15s cubic-bezier(.694,.0482,.335,1);display:block}.mapTocEntry-isInEditingMode{background-color:#e6f1fa!important;font-size:12px;font-weight:500}.mapTocEntry-isInEditingMode__row{align-items:center;display:inline-flex;margin-left:24px}.mapTocEntry-isInEditingMode__row>*{margin-right:4px}.mapTocEntry-isInEditingMode__editFeatureText{line-height:1;padding-right:4px}.mapTocEntry-isDragging{box-shadow:0 .9px 4px -1px #00000014,0 2.6px 8px -1px #0000000f,0 5.7px 12px -1px #0000000d,0 15px 15px -1px #0000000a}.mapTocEntry-isDraggingOver{background-color:#fff;pointer-events:none!important}.mapTocEntry-isCombineLayer{background-color:#00bfb340;transition:background-color .5s ease}.mapTocEntry-isSelected{background-color:#edf0f5}.mapTocEntry-notVisible,.mapTocEntry-visible{display:flex}.mapLayTocActions{flex-grow:1;overflow:hidden}.mapLayTocActions__popoverAnchor,.mapLayTocActions__tooltipAnchor{max-width:100%}.mapTocEntry-notVisible .mapTocEntry__layerName{opacity:.5}.mapTocEntry__grab:hover{cursor:grab}.mapTocEntry__layerName{font-weight:500}.mapTocEntry__layerNameText{align-items:center;display:flex}.mapTocEntry__layerNameIcon{flex-shrink:0;margin-right:8px}.mapTocEntry__layerNameIcon>*{vertical-align:sub}.mapTocEntry__layerIcons{display:none;flex-shrink:0}.mapTocEntry__detailsToggle{display:none;left:50%;position:absolute;top:32px;transform:translateX(-50%)}.mapTocEntry__detailsToggleButton{background-color:#fff;border:1px solid #d3dae6;border-radius:3px;color:#343741;height:16px;line-height:16px;text-align:center;width:32px}.mapTocEntry__detailsToggleButton:focus{outline:2px solid currentColor}.mapTocEntry__detailsToggleButton:focus:focus-visible{outline-style:auto}.mapTocEntry__detailsToggleButton:focus:not(:focus-visible){outline:none}.mapTocEntry__layerDetails{background-color:#fafbfd;margin:8px -8px -8px;-webkit-mask-image:linear-gradient(180deg,#ff00001a 0,red 7.5px,red calc(100% - 7.5px),#ff00001a);mask-image:linear-gradient(180deg,#ff00001a 0,red 7.5px,red calc(100% - 7.5px),#ff00001a);padding:16px 8px 8px}@keyframes mapTocEntryBecomeVisible{0%{opacity:0}to{opacity:1}}.mapViewControl__coordinates{justify-content:center;pointer-events:none;text-shadow:0 0 2px #fff,0 0 1px #fff,0 0 1px #fff,0 0 1px #fff,0 0 1px #fff 0 0 1px #fff 0 0 1px #fff}.mapDrawControl__geometryFilterForm{padding:8px}.mapToolbarOverlay{left:12px;position:absolute;top:84px;z-index:2}.mapToolbarOverlay__button,.mapToolbarOverlay__buttonGroup{position:relative;transition:transform .25s ease-in-out,background .25s ease-in-out}.mapToolbarOverlay__button .mapToolbarOverlay__buttonIcon-empty,.mapToolbarOverlay__buttonGroup .mapToolbarOverlay__buttonIcon-empty{color:#343741!important}.mapToolbarOverlay__button:hover,.mapToolbarOverlay__buttonGroup:hover{transform:translateY(-1px)}.mapToolbarOverlay__button .euiButtonIcon:hover,.mapToolbarOverlay__buttonGroup .euiButtonIcon:hover{transform:translateY(0)}.mapToolbarOverlay__button .mapToolbarOverlay__buttonIcon-empty:focus:not(:hover),.mapToolbarOverlay__buttonGroup .mapToolbarOverlay__buttonIcon-empty:focus:not(:hover){background:none}.mapToolbarOverlay__buttonGroup{border-radius:4px;display:flex;flex-direction:column;overflow:hidden}.mapToolbarOverlay__buttonGroup .euiButtonIcon{border-radius:0}.mapToolbarOverlay__buttonGroupAnimated{animation:mapAnimationHeadShake 1.2s ease-in-out}.mapToolbarOverlay__button__exit .euiButtonIcon{color:#bd271e!important}.mapKeydownScrollZoom{align-content:center;background:#00000080;bottom:0;display:flex;flex-direction:column;justify-content:center;left:0;opacity:0;padding:16px;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .25s ease .25s;z-index:2000}.mapKeydownScrollZoom--show{opacity:1;transition-duration:.15s}.mapFeatureTooltip_table{width:100%}.mapFeatureTooltip_table td{padding:4px}.mapFeatureTooltip_tableWrapper{max-height:calc(49vh - 64px);overflow:auto}.mapFeatureTooltip_row{border-bottom:1px solid #f5f7fa}.mapFeatureTooltip_actionLinks{padding:4px}.mapFeatureTooltip_backButton{padding-left:0}.mapFeatureTooltip__propertyLabel{font-weight:600;max-width:128px;min-width:80px}.mapFeatureTooltip_actionsRow>span{display:flex;justify-content:flex-end}.mapFeatureTooltip_layerIcon img{margin-bottom:0}.mapScaleControl{border-bottom:2px solid #343741;border-left:2px solid #343741;bottom:12px;color:#343741;left:12px;pointer-events:none;position:absolute;text-align:right;z-index:1000}.mapScaleControlFullScreen{bottom:48px}.mapActionSelectIcon{margin-right:8px}.mapMetricEditorPanel{margin-bottom:8px}.mapMetricEditorPanel__metricEditor{border-top:1px solid #d3dae6;padding:12px 0}.mapMetricEditorPanel__metricEditor:first-child{border-top:none;padding-top:0}.mapMetricEditorPanel__metricEditor:last-child{border-bottom:1px solid #d3dae6;margin-bottom:12px}.mapMetricEditorPanel__metricRemoveButton{padding-top:12px;text-align:right}.mapGeometryFilter__geoFieldSuperSelect{height:48px}.mapGeometryFilter__geoFieldSuperSelectWrapper{height:72px}.mapGeometryFilter__geoFieldItem{padding:4px}.mapTooltipSelector__propertyRow{background-color:#fff;border-bottom:1px solid #d3dae6;display:flex;padding:4px 0}.mapTooltipSelector__propertyRow .mapTooltipSelector__propertyIcons:focus,.mapTooltipSelector__propertyRow .mapTooltipSelector__propertyIcons:hover,.mapTooltipSelector__propertyRow:focus .mapTooltipSelector__propertyIcons,.mapTooltipSelector__propertyRow:focus-within .mapTooltipSelector__propertyIcons,.mapTooltipSelector__propertyRow:hover .mapTooltipSelector__propertyIcons{animation:mapPropertyIconsBecomeVisible .15s cubic-bezier(.694,.0482,.335,1);display:block}.mapTooltipSelector__propertyRow-isDragging{box-shadow:0 .9px 4px -1px #00000014,0 2.6px 8px -1px #0000000f,0 5.7px 12px -1px #0000000d,0 15px 15px -1px #0000000a}.mapTooltipSelector__propertyRow-isDraggingOver{pointer-events:none!important}.mapTooltipSelector__propertyContent{flex-grow:1;min-height:24px;overflow:hidden}.mapTooltipSelector__propertyIcons{display:none;flex-shrink:0}.mapTooltipSelector__grab:hover{cursor:grab}@keyframes mapPropertyIconsBecomeVisible{0%{opacity:0}to{opacity:1}}.mapColorGradient{bottom:0;height:4px;left:0;position:relative;right:0;top:0;width:100%}.mapFillableCircle{overflow:visible}.mapStyleFormDisabledTooltip{width:100%}.mapColorStop{position:relative}.mapColorStop+.mapColorStop{margin-top:8px}.mapIconSelectSymbol__inputButton{margin:0 4px}.mapsCustomIconPreview__mapContainer{height:150px}.mapsCustomIconForm{min-width:400px}.mapsCustomIconForm__preview{max-width:210px;min-height:210px}.mapLegendIconPreview{width:24px}.vectorStyleLegendSpacer:not(:last-child){margin-bottom:8px}.mapLayersWizardIcon{margin-top:8px}.mapLayersWizardIcon__highlight{fill:#000}.mapLayersWizardIcon__background{fill:#d3dae6}.mapLayersWizardIcon__backgroundDarker{fill:#98a2b3}@keyframes mapAnimationHeadShake{0%{transform:translateX(0)}6.5%{transform:translateX(-6px) rotateY(-9deg)}18.5%{transform:translateX(5px) rotateY(7deg)}31.5%{transform:translateX(-3px) rotateY(-5deg)}43.5%{transform:translateX(2px) rotateY(3deg)}50%{transform:translateX(0)}}@keyframes mapAnimationPulse{0%{transform:scaleX(1)}50%{transform:scale3d(1.005,1.005,1.005)}to{transform:scaleX(1)}}.mapEmbeddableContainer{display:flex;flex:1 1 100%;height:100%;min-height:0;width:100%;z-index:1}.mapEmbeddedError{align-items:center;display:flex;flex-grow:1;justify-content:center;overflow:auto}",""]),t.exports=e},506:function(t,e,n){"use strict";function i(t){return!r(t)}function r(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,n=new Blob([""],{type:"text/javascript"}),i=URL.createObjectURL(n);try{e=new Worker(i),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(i),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var n=e.getImageData(0,0,1,1);return n&&n.width===t.width}()?(e=t&&t.failIfMajorPerformanceCaveat,void 0===o[e]&&(o[e]=function(t){var e,n=function(t){var e=document.createElement("canvas"),n=Object.create(i.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,e.getContext("webgl",n)||e.getContext("experimental-webgl",n)}(t);if(!n)return!1;try{e=n.createShader(n.VERTEX_SHADER)}catch(t){return!1}return!(!e||n.isContextLost())&&(n.shaderSource(e,"void main() {}"),n.compileShader(e),!0===n.getShaderParameter(e,n.COMPILE_STATUS))}(e)),o[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}e.supported=i,e.notSupportedReason=r;var o={};i.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},507:function(t,e,n){(function(e){t.exports=function(){"use strict";var t=function(t,e){var n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},i={on:function(t,e,i){if(void 0===n[t])throw new Error("Invalid event type: "+t);n[t].push({selector:e,fn:i})},render:function(t){e.store.featureChanged(t)}},r=function(t,r){for(var o=n[t],s=o.length;s--;){var a=o[s];if(a.selector(r)){a.fn.call(i,r)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(i),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){r("drag",t)},click:function(t){r("click",t)},mousemove:function(t){r("mousemove",t)},mousedown:function(t){r("mousedown",t)},mouseup:function(t){r("mouseup",t)},mouseout:function(t){r("mouseout",t)},keydown:function(t){r("keydown",t)},keyup:function(t){r("keyup",t)},touchstart:function(t){r("touchstart",t)},touchmove:function(t){r("touchmove",t)},touchend:function(t){r("touchend",t)},tap:function(t){r("tap",t)}}},n=6378137;function i(t){var e=0;if(t&&t.length>0){e+=Math.abs(r(t[0]));for(var n=1;n2){for(l=0;l=Math.pow(2,t)?e(t,n):s};e.rack=function(t,n,i){var r=function(r){var s=0;do{if(s++>10){if(!i)throw new Error("too many ID collisions, use more bits");t+=i}var a=e(t,n)}while(Object.hasOwnProperty.call(o,a));return o[a]=r,a},o=r.hats={};return r.get=function(t){return r.hats[t]},r.set=function(t,e){return r.hats[t]=e,r},r.bits=t||128,r.base=n||16,r}})),st=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||ot(),this.type=e.geometry.type};st.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},st.prototype.incomingCoords=function(t){this.setCoordinates(t)},st.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},st.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},st.prototype.setProperty=function(t,e){this.properties[t]=e},st.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:I,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},st.prototype.internal=function(t){var e={id:this.id,meta:V,"meta:type":this.type,active:W,mode:t};if(this.ctx.options.userProperties)for(var n in this.properties)e["user_"+n]=this.properties[n];return{type:I,properties:e,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var at=function(t,e){st.call(this,t,e)};(at.prototype=Object.create(st.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},at.prototype.updateCoordinate=function(t,e,n){this.coordinates=3===arguments.length?[e,n]:[t,e],this.changed()},at.prototype.getCoordinate=function(){return this.getCoordinates()};var lt=function(t,e){st.call(this,t,e)};(lt.prototype=Object.create(st.prototype)).isValid=function(){return this.coordinates.length>1},lt.prototype.addCoordinate=function(t,e,n){this.changed();var i=parseInt(t,10);this.coordinates.splice(i,0,[e,n])},lt.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},lt.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},lt.prototype.updateCoordinate=function(t,e,n){var i=parseInt(t,10);this.coordinates[i]=[e,n],this.changed()};var ut=function(t,e){st.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(ut.prototype=Object.create(st.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},ut.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},ut.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},ut.prototype.addCoordinate=function(t,e,n){this.changed();var i=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[i[0]].splice(i[1],0,[e,n])},ut.prototype.removeCoordinate=function(t){this.changed();var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];n&&(n.splice(e[1],1),n.length<3&&this.coordinates.splice(e[0],1))},ut.prototype.getCoordinate=function(t){var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];return JSON.parse(JSON.stringify(n[e[1]]))},ut.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},ut.prototype.updateCoordinate=function(t,e,n){this.changed();var i=t.split("."),r=parseInt(i[0],10),o=parseInt(i[1],10);void 0===this.coordinates[r]&&(this.coordinates[r]=[]),this.coordinates[r][o]=[e,n]};var ct={MultiPoint:at,MultiLineString:lt,MultiPolygon:ut},ht=function(t,e,n,i,r){var o=n.split("."),s=parseInt(o[0],10),a=o[1]?o.slice(1).join("."):null;return t[s][e](a,i,r)},dt=function(t,e){if(st.call(this,t,e),delete this.coordinates,this.model=ct[e.geometry.type],void 0===this.model)throw new TypeError(e.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(e.geometry.coordinates)};function pt(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(dt.prototype=Object.create(st.prototype))._coordinatesToFeatures=function(t){var e=this,n=this.model.bind(this);return t.map((function(t){return new n(e.ctx,{id:ot(),type:I,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},dt.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},dt.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},dt.prototype.getCoordinate=function(t){return ht(this.features,"getCoordinate",t)},dt.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===O?t.getCoordinates():t.coordinates}))))},dt.prototype.updateCoordinate=function(t,e,n){ht(this.features,"updateCoordinate",t,e,n),this.changed()},dt.prototype.addCoordinate=function(t,e,n){ht(this.features,"addCoordinate",t,e,n),this.changed()},dt.prototype.removeCoordinate=function(t){ht(this.features,"removeCoordinate",t),this.changed()},dt.prototype.getFeatures=function(){return this.features},pt.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},pt.prototype.setSelectedCoordinates=function(t){var e=this;this._ctx.store.setSelectedCoordinates(t),t.reduce((function(t,n){return void 0===t[n.feature_id]&&(t[n.feature_id]=!0,e._ctx.store.get(n.feature_id).changed()),t}),{})},pt.prototype.getSelected=function(){return this._ctx.store.getSelected()},pt.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},pt.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},pt.prototype.getFeature=function(t){return this._ctx.store.get(t)},pt.prototype.select=function(t){return this._ctx.store.select(t)},pt.prototype.deselect=function(t){return this._ctx.store.deselect(t)},pt.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},pt.prototype.addFeature=function(t){return this._ctx.store.add(t)},pt.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},pt.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},pt.prototype.setActionableState=function(t){void 0===t&&(t={});var e={trash:t.trash||!1,combineFeatures:t.combineFeatures||!1,uncombineFeatures:t.uncombineFeatures||!1};return this._ctx.events.actionable(e)},pt.prototype.changeMode=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._ctx.events.changeMode(t,e,n)},pt.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},pt.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},pt.prototype.featuresAt=function(t,e,n){if(void 0===n&&(n="click"),"click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return Q[n](t,e,this._ctx)},pt.prototype.newFeature=function(t){var e=t.geometry.type;return e===L?new at(this._ctx,t):e===w?new lt(this._ctx,t):e===O?new ut(this._ctx,t):new dt(this._ctx,t)},pt.prototype.isInstanceOf=function(t,e){if(t===L)return e instanceof at;if(t===w)return e instanceof lt;if(t===O)return e instanceof ut;if("MultiFeature"===t)return e instanceof dt;throw new Error("Unknown feature class: "+t)},pt.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},pt.prototype.onSetup=function(){},pt.prototype.onDrag=function(){},pt.prototype.onClick=function(){},pt.prototype.onMouseMove=function(){},pt.prototype.onMouseDown=function(){},pt.prototype.onMouseUp=function(){},pt.prototype.onMouseOut=function(){},pt.prototype.onKeyUp=function(){},pt.prototype.onKeyDown=function(){},pt.prototype.onTouchStart=function(){},pt.prototype.onTouchMove=function(){},pt.prototype.onTouchEnd=function(){},pt.prototype.onTap=function(){},pt.prototype.onStop=function(){},pt.prototype.onTrash=function(){},pt.prototype.onCombineFeature=function(){},pt.prototype.onUncombineFeature=function(){},pt.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var ft={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},gt=Object.keys(ft);function mt(t){return[].concat(t).filter((function(t){return void 0!==t}))}function _t(){var t=this;if(!t.ctx.map||void 0===t.ctx.map.getSource(_))return l();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var n=[],i=[];t.isDirty?i=t.getAllIds():(n=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),i=t.sources.hot.filter((function(e){return e.properties.id&&-1===n.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var r=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===n.indexOf(e)}));var o=r!==t.sources.cold.length||i.length>0;function s(n,i){var r=t.get(n).internal(e);t.ctx.events.currentModeRender(r,(function(e){t.sources[i].push(e)}))}if(n.forEach((function(t){return s(t,"hot")})),i.forEach((function(t){return s(t,"cold")})),o&&t.ctx.map.getSource(y).setData({type:T,features:t.sources.cold}),t.ctx.map.getSource(_).setData({type:T,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(k,{features:t.getSelected().map((function(t){return t.toGeoJSON()})),points:t.getSelectedCoordinates().map((function(t){return{type:I,properties:{},geometry:{type:L,coordinates:t.coordinates}}}))}),t._emitSelectionChange=!1),t._deletedFeaturesToEmit.length){var a=t._deletedFeaturesToEmit.map((function(t){return t.toGeoJSON()}));t._deletedFeaturesToEmit=[],t.ctx.map.fire(A,{features:a})}function l(){t.isDirty=!1,t.clearChangedIds()}l(),t.ctx.map.fire(z,{})}function yt(t){var e,n=this;this._features={},this._featureIds=new Z,this._selectedFeatureIds=new Z,this._selectedCoordinates=[],this._changedFeatureIds=new Z,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,_t.call(n)})))},this.isDirty=!1}function vt(t,e){var n=t._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));t._selectedCoordinates.length===n.length||e.silent||(t._emitSelectionChange=!0),t._selectedCoordinates=n}yt.prototype.createRenderBatch=function(){var t=this,e=this.render,n=0;return this.render=function(){n++},function(){t.render=e,n>0&&t.render()}},yt.prototype.setDirty=function(){return this.isDirty=!0,this},yt.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},yt.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},yt.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},yt.prototype.getAllIds=function(){return this._featureIds.values()},yt.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},yt.prototype.delete=function(t,e){var n=this;return void 0===e&&(e={}),mt(t).forEach((function(t){n._featureIds.has(t)&&(n._featureIds.delete(t),n._selectedFeatureIds.delete(t),e.silent||-1===n._deletedFeaturesToEmit.indexOf(n._features[t])&&n._deletedFeaturesToEmit.push(n._features[t]),delete n._features[t],n.isDirty=!0)})),vt(this,e),this},yt.prototype.get=function(t){return this._features[t]},yt.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},yt.prototype.select=function(t,e){var n=this;return void 0===e&&(e={}),mt(t).forEach((function(t){n._selectedFeatureIds.has(t)||(n._selectedFeatureIds.add(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),this},yt.prototype.deselect=function(t,e){var n=this;return void 0===e&&(e={}),mt(t).forEach((function(t){n._selectedFeatureIds.has(t)&&(n._selectedFeatureIds.delete(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),vt(this,e),this},yt.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},yt.prototype.setSelected=function(t,e){var n=this;return void 0===e&&(e={}),t=mt(t),this.deselect(this._selectedFeatureIds.values().filter((function(e){return-1===t.indexOf(e)})),{silent:e.silent}),this.select(t.filter((function(t){return!n._selectedFeatureIds.has(t)})),{silent:e.silent}),this},yt.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},yt.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},yt.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},yt.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},yt.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},yt.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},yt.prototype.setFeatureProperty=function(t,e,n){this.get(t).setProperty(e,n),this.featureChanged(t)},yt.prototype.storeMapConfig=function(){var t=this;H.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},yt.prototype.restoreMapConfig=function(){var t=this;Object.keys(this._mapInitialConfig).forEach((function(e){t._mapInitialConfig[e]?t.ctx.map[e].enable():t.ctx.map[e].disable()}))},yt.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var bt=function(){for(var t=arguments,e={},n=0;n=48&&t<=57)};function u(i,r,o){void 0===o&&(o={}),a.stop();var l=n[i];if(void 0===l)throw new Error(i+" is not valid");s=i;var u=l(e,r);a=t(u,e),o.silent||e.map.fire(B,{mode:i}),e.store.setDirty(),e.store.render()}o.keydown=function(t){"mapboxgl-canvas"===(t.srcElement||t.target).classList[0]&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?l(t.keyCode)?a.keydown(t):49===t.keyCode&&e.options.controls.point?u(F.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?u(F.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&u(F.DRAW_POLYGON):(t.preventDefault(),a.trash()))},o.keyup=function(t){l(t.keyCode)&&a.keyup(t)},o.zoomend=function(){e.store.changeZoom()},o.data=function(t){if("style"===t.dataType){var n=e.setup,i=e.map,r=e.options,o=e.store;r.styles.some((function(t){return i.getLayer(t.id)}))||(n.addLayers(),o.setDirty(),o.render())}};var c={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){s=e.options.defaultMode,a=t(n[s](e),e)},changeMode:u,actionable:function(t){var n=!1;Object.keys(t).forEach((function(e){if(void 0===c[e])throw new Error("Invalid action type");c[e]!==t[e]&&(n=!0),c[e]=t[e]})),n&&e.map.fire(G,{actions:c})},currentModeName:function(){return s},currentModeRender:function(t,e){return a.render(t,e)},fire:function(t,e){o[t]&&o[t](e)},addEventListeners:function(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners:function(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash:function(t){a.trash(t)},combineFeatures:function(){a.combineFeatures()},uncombineFeatures:function(){a.uncombineFeatures()},getMode:function(){return s}}}(e),e.ui=function(t){var e={},n=null,i={mode:null,feature:null,mouse:null},r={mode:null,feature:null,mouse:null};function o(t){r=bt(r,t)}function s(){var e,n;if(t.container){var o=[],s=[];Et.forEach((function(t){r[t]!==i[t]&&(o.push(t+"-"+i[t]),null!==r[t]&&s.push(t+"-"+r[t]))})),o.length>0&&(e=t.container.classList).remove.apply(e,o),s.length>0&&(n=t.container.classList).add.apply(n,s),i=bt(i,r)}}function _(t,e){void 0===e&&(e={});var i=document.createElement("button");return i.className=l+" "+e.className,i.setAttribute("title",e.title),e.container.appendChild(i),i.addEventListener("click",(function(i){if(i.preventDefault(),i.stopPropagation(),i.target===n)return y(),void e.onDeactivate();v(t),e.onActivate()}),!0),i}function y(){n&&(n.classList.remove(m),n=null)}function v(t){y();var i=e[t];i&&i&&"trash"!==t&&(i.classList.add(m),n=i)}return{setActiveButton:v,queueMapClasses:o,updateMapClasses:s,clearMapClasses:function(){o({mode:null,feature:null,mouse:null}),s()},addButtons:function(){var n=t.options.controls,i=document.createElement("div");return i.className=g+" "+a,n?(n[C.LINE]&&(e[C.LINE]=_(C.LINE,{container:i,className:u,title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(F.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),n[C.POLYGON]&&(e[C.POLYGON]=_(C.POLYGON,{container:i,className:c,title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(F.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),n[C.POINT]&&(e[C.POINT]=_(C.POINT,{container:i,className:h,title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(F.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),n.trash&&(e.trash=_("trash",{container:i,className:d,title:"Delete",onActivate:function(){t.events.trash()}})),n.combine_features&&(e.combine_features=_("combineFeatures",{container:i,className:p,title:"Combine",onActivate:function(){t.events.combineFeatures()}})),n.uncombine_features&&(e.uncombine_features=_("uncombineFeatures",{container:i,className:f,title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),i):i},removeButtons:function(){Object.keys(e).forEach((function(t){var n=e[t];n.parentNode&&n.parentNode.removeChild(n),delete e[t]}))}}}(e),e.container=o.getContainer(),e.store=new yt(e),n=e.ui.addButtons(),e.options.boxSelect&&(o.boxZoom.disable(),o.dragPan.disable(),o.dragPan.enable()),o.loaded()?r.connect():(o.on("load",r.connect),i=setInterval((function(){o.loaded()&&r.connect()}),16)),e.events.start(),n},addLayers:function(){e.map.addSource(y,{data:{type:T,features:[]},type:"geojson"}),e.map.addSource(_,{data:{type:T,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(y)&&e.map.removeSource(y),e.map.getSource(_)&&e.map.removeSource(_)}};return e.setup=r,r}function Ct(t){return function(e){var n=e.featureTarget;return!!n&&!!n.properties&&n.properties.meta===t}}function It(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===Y&&t.featureTarget.properties.meta===V}function Ot(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===W&&t.featureTarget.properties.meta===V}function wt(t){return void 0===t.featureTarget}function Lt(t){var e=t.featureTarget;return!!e&&!!e.properties&&e.properties.meta===q}function Tt(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function Nt(t){return 27===t.keyCode}function jt(t){return 13===t.keyCode}var Mt=Pt;function Pt(t,e){this.x=t,this.y=e}function Ft(t,e){var n=e.getBoundingClientRect();return new Mt(t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0))}function Rt(t,e,n,i){return{type:I,properties:{meta:q,parent:t,coord_path:n,active:i?Y:W},geometry:{type:L,coordinates:e}}}function At(t,e,n){void 0===e&&(e={}),void 0===n&&(n=null);var i,r=t.geometry,o=r.type,s=r.coordinates,a=t.properties&&t.properties.id,l=[];function u(t,n){var i="",r=null;t.forEach((function(t,o){var s=null!=n?n+"."+o:String(o),u=Rt(a,t,s,c(s));if(e.midpoints&&r){var h=function(t,e,n){var i=e.geometry.coordinates,r=n.geometry.coordinates;if(i[1]>85||i[1]<-85||r[1]>85||r[1]<-85)return null;var o={lng:(i[0]+r[0])/2,lat:(i[1]+r[1])/2};return{type:I,properties:{meta:U,parent:t,lng:o.lng,lat:o.lat,coord_path:n.properties.coord_path},geometry:{type:L,coordinates:[o.lng,o.lat]}}}(a,r,u);h&&l.push(h)}r=u;var d=JSON.stringify(t);i!==d&&l.push(u),0===o&&(i=d)}))}function c(t){return!!e.selectedPaths&&-1!==e.selectedPaths.indexOf(t)}return o===L?l.push(Rt(a,s,n,c(n))):o===O?s.forEach((function(t,e){u(t,null!==n?n+"."+e:String(e))})):o===w?u(s,n):0===o.indexOf(N)&&(i=o.replace(N,""),s.forEach((function(n,r){var o={type:I,properties:t.properties,geometry:{type:i,coordinates:n}};l=l.concat(At(o,e,r))}))),l}Pt.prototype={clone:function(){return new Pt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),i=e*this.x-n*this.y,r=n*this.x+e*this.y;return this.x=i,this.y=r,this},_rotateAround:function(t,e){var n=Math.cos(t),i=Math.sin(t),r=e.x+n*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+n*(this.y-e.y);return this.x=r,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Pt.convert=function(t){return t instanceof Pt?t:Array.isArray(t)?new Pt(t[0],t[1]):t};var Dt=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t._ctx&&t._ctx.store&&t._ctx.store.getInitialConfigValue&&t._ctx.store.getInitialConfigValue("doubleClickZoom")&&t.map.doubleClickZoom.enable()}),0)},kt=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t.map.doubleClickZoom.disable()}),0)},Bt=function(t){if(!t||!t.type)return null;var e=Gt[t.type];return e?"geometry"===e?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===e?{type:"FeatureCollection",features:[t]}:"featurecollection"===e?t:void 0:null},Gt={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function zt(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,e){return t.concat(zt(e))}),[]),t;case"Feature":return t.geometry?zt(t.geometry).map((function(e){var n={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(n.id=t.id),n})):[t];case"MultiPoint":return t.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return t.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return t.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return t.geometries.map(zt).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}var Vt=function(t){if(!t)return[];var e=zt(Bt(t)),n=[];return e.features.forEach((function(t){t.geometry&&(n=n.concat(function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce((function(e,n){return Array.isArray(n)&&Array.isArray(n[0])?e.concat(t(n)):(e.push(n),e)}),[])}(t.geometry.coordinates)))})),n},Ut=rt((function(t){var e=t.exports=function(t){return new n(t)};function n(t){this.value=t}function i(t,e,n){var i=[],s=[],c=!0;return function t(h){var d=n?r(h):h,p={},f=!0,g={node:d,node_:h,path:[].concat(i),parent:s[s.length-1],parents:s,key:i.slice(-1)[0],isRoot:0===i.length,level:i.length,circular:null,update:function(t,e){g.isRoot||(g.parent.node[g.key]=t),g.node=t,e&&(f=!1)},delete:function(t){delete g.parent.node[g.key],t&&(f=!1)},remove:function(t){a(g.parent.node)?g.parent.node.splice(g.key,1):delete g.parent.node[g.key],t&&(f=!1)},keys:null,before:function(t){p.before=t},after:function(t){p.after=t},pre:function(t){p.pre=t},post:function(t){p.post=t},stop:function(){c=!1},block:function(){f=!1}};if(!c)return g;function m(){if("object"==typeof g.node&&null!==g.node){g.keys&&g.node_===g.node||(g.keys=o(g.node)),g.isLeaf=0==g.keys.length;for(var t=0;t=e&&this._bbox[3]>=n},Yt.prototype.intersect=function(t){return this._valid?(e=t instanceof Yt?t.bbox():t,!(this._bbox[0]>e[2]||this._bbox[2]e[3])):null;var e},Yt.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},Yt.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Wt={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Ht=Object.keys(Wt),Xt=function(t){return Jt(t).bbox()};function Jt(t){for(var e=qt(),n=Vt(t),i=0;in&&(n=l),ur&&(r=u),la&&(a=h)}));var l=e;return n+l.lat>85&&(l.lat=85-n),r+l.lat>90&&(l.lat=90-r),i+l.lat<-85&&(l.lat=-85-i),o+l.lat<-90&&(l.lat=-90-o),s+l.lng<=-270&&(l.lng+=360*Math.ceil(Math.abs(l.lng)/360)),a+l.lng>=270&&(l.lng-=360*Math.ceil(Math.abs(l.lng)/360)),l}function Kt(t,e){var n=Zt(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,i=t.getCoordinates(),r=function(t){var e={lng:t[0]+n.lng,lat:t[1]+n.lat};return[e.lng,e.lat]},o=function(t){return t.map((function(t){return r(t)}))};t.type===L?e=r(i):t.type===w||t.type===j?e=i.map(r):t.type===O||t.type===M?e=i.map(o):t.type===P&&(e=i.map((function(t){return t.map((function(t){return o(t)}))}))),t.incomingCoords(e)}))}Xt.polygon=function(t){return Jt(t).polygon()},Xt.bboxify=function(t){return Ut(t).map((function(t){t&&Ht.some((function(e){return!!t[e]&&-1!==Wt[e].indexOf(t.type)}))&&(t.bbox=Jt(t).bbox(),this.update(t))}))};var Qt={onSetup:function(t){var e=this,n={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:t.featureIds||[]};return this.setSelected(n.initiallySelectedFeatureIds.filter((function(t){return void 0!==e.getFeature(t)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),n},fireUpdate:function(){this.map.fire(D,{action:"move",features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(){var t=this,e=this.getSelected(),n=e.filter((function(e){return t.isInstanceOf("MultiFeature",e)})),i=!1;if(e.length>1){i=!0;var r=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==r&&(i=!1)}))}var o=n.length>0,s=e.length>0;this.setActionableState({combineFeatures:i,uncombineFeatures:o,trash:s})},getUniqueIds:function(t){return t.length?t.map((function(t){return t.properties.id})).filter((function(t){return void 0!==t})).reduce((function(t,e){return t.add(e),t}),new Z).values():[]},stopExtendedInteractions:function(t){t.boxSelectElement&&(t.boxSelectElement.parentNode&&t.boxSelectElement.parentNode.removeChild(t.boxSelectElement),t.boxSelectElement=null),this.map.dragPan.enable(),t.boxSelecting=!1,t.canBoxSelect=!1,t.dragMoving=!1,t.canDragMove=!1},onStop:function(){Dt(this)},onMouseMove:function(t){return this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};Qt.onTap=Qt.onClick=function(t,e){return wt(e)?this.clickAnywhere(t,e):Ct(q)(e)?this.clickOnVertex(t,e):function(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.meta===V}(e)?this.clickOnFeature(t,e):void 0},Qt.clickAnywhere=function(t){var e=this,n=this.getSelectedIds();n.length&&(this.clearSelectedFeatures(),n.forEach((function(t){return e.doRender(t)}))),Dt(this),this.stopExtendedInteractions(t)},Qt.clickOnVertex=function(t,e){this.changeMode(F.DIRECT_SELECT,{featureId:e.featureTarget.properties.parent,coordPath:e.featureTarget.properties.coord_path,startPos:e.lngLat}),this.updateUIClasses({mouse:b})},Qt.startOnActiveFeature=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),this.doRender(e.featureTarget.properties.id),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},Qt.clickOnFeature=function(t,e){var n=this;kt(this),this.stopExtendedInteractions(t);var i=Tt(e),r=this.getSelectedIds(),o=e.featureTarget.properties.id,s=this.isSelected(o);if(!i&&s&&this.getFeature(o).type!==L)return this.changeMode(F.DIRECT_SELECT,{featureId:o});s&&i?(this.deselect(o),this.updateUIClasses({mouse:E}),1===r.length&&Dt(this)):!s&&i?(this.select(o),this.updateUIClasses({mouse:b})):s||i||(r.forEach((function(t){return n.doRender(t)})),this.setSelected(o),this.updateUIClasses({mouse:b})),this.doRender(o)},Qt.onMouseDown=function(t,e){return It(e)?this.startOnActiveFeature(t,e):this.drawConfig.boxSelect&&function(t){return!!t.originalEvent&&!!t.originalEvent.shiftKey&&0===t.originalEvent.button}(e)?this.startBoxSelect(t,e):void 0},Qt.startBoxSelect=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),t.boxSelectStartLocation=Ft(e.originalEvent,this.map.getContainer()),t.canBoxSelect=!0},Qt.onTouchStart=function(t,e){if(It(e))return this.startOnActiveFeature(t,e)},Qt.onDrag=function(t,e){return t.canDragMove?this.dragMove(t,e):this.drawConfig.boxSelect&&t.canBoxSelect?this.whileBoxSelect(t,e):void 0},Qt.whileBoxSelect=function(t,e){t.boxSelecting=!0,this.updateUIClasses({mouse:v}),t.boxSelectElement||(t.boxSelectElement=document.createElement("div"),t.boxSelectElement.classList.add("mapbox-gl-draw_boxselect"),this.map.getContainer().appendChild(t.boxSelectElement));var n=Ft(e.originalEvent,this.map.getContainer()),i=Math.min(t.boxSelectStartLocation.x,n.x),r=Math.max(t.boxSelectStartLocation.x,n.x),o=Math.min(t.boxSelectStartLocation.y,n.y),s=Math.max(t.boxSelectStartLocation.y,n.y),a="translate("+i+"px, "+o+"px)";t.boxSelectElement.style.transform=a,t.boxSelectElement.style.WebkitTransform=a,t.boxSelectElement.style.width=r-i+"px",t.boxSelectElement.style.height=s-o+"px"},Qt.dragMove=function(t,e){t.dragMoving=!0,e.originalEvent.stopPropagation();var n={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};Kt(this.getSelected(),n),t.dragMoveLocation=e.lngLat},Qt.onMouseUp=function(t,e){var n=this;if(t.dragMoving)this.fireUpdate();else if(t.boxSelecting){var i=[t.boxSelectStartLocation,Ft(e.originalEvent,this.map.getContainer())],r=this.featuresAt(null,i,"click"),o=this.getUniqueIds(r).filter((function(t){return!n.isSelected(t)}));o.length&&(this.select(o),o.forEach((function(t){return n.doRender(t)})),this.updateUIClasses({mouse:b}))}this.stopExtendedInteractions(t)},Qt.toDisplayFeatures=function(t,e,n){e.properties.active=this.isSelected(e.properties.id)?Y:W,n(e),this.fireActionable(),e.properties.active===Y&&e.geometry.type!==L&&At(e).forEach(n)},Qt.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},Qt.onCombineFeatures=function(){var t=this.getSelected();if(!(0===t.length||t.length<2)){for(var e=[],n=[],i=t[0].type.replace("Multi",""),r=0;r1){var s=this.newFeature({type:I,properties:n[0].properties,geometry:{type:"Multi"+i,coordinates:e}});this.addFeature(s),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([s.id]),this.map.fire("draw.combine",{createdFeatures:[s.toGeoJSON()],deletedFeatures:n})}this.fireActionable()}},Qt.onUncombineFeatures=function(){var t=this,e=this.getSelected();if(0!==e.length){for(var n=[],i=[],r=function(r){var o=e[r];t.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach((function(e){t.addFeature(e),e.properties=o.properties,n.push(e.toGeoJSON()),t.select([e.id])})),t.deleteFeature(o.id,{silent:!0}),i.push(o.toGeoJSON()))},o=0;o1&&this.map.fire("draw.uncombine",{createdFeatures:n,deletedFeatures:i}),this.fireActionable()}};var $t=Ct(q),te=Ct(U),ee={fireUpdate:function(){this.map.fire(D,{action:"change_coordinates",features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(t){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:t.selectedCoordPaths.length>0})},startDragging:function(t,e){this.map.dragPan.disable(),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},stopDragging:function(t){this.map.dragPan.enable(),t.dragMoving=!1,t.canDragMove=!1,t.dragMoveLocation=null},onVertex:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties,i=t.selectedCoordPaths.indexOf(n.coord_path);Tt(e)||-1!==i?Tt(e)&&-1===i&&t.selectedCoordPaths.push(n.coord_path):t.selectedCoordPaths=[n.coord_path];var r=this.pathsToCoordinates(t.featureId,t.selectedCoordPaths);this.setSelectedCoordinates(r)},onMidpoint:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties;t.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),t.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(t,e){return e.map((function(e){return{feature_id:t,coord_path:e}}))},onFeature:function(t,e){0===t.selectedCoordPaths.length?this.startDragging(t,e):this.stopDragging(t)},dragFeature:function(t,e,n){Kt(this.getSelected(),n),t.dragMoveLocation=e.lngLat},dragVertex:function(t,e,n){for(var i=t.selectedCoordPaths.map((function(e){return t.feature.getCoordinate(e)})),r=Zt(i.map((function(t){return{type:I,properties:{},geometry:{type:L,coordinates:t}}})),n),o=0;o0?this.dragVertex(t,e,n):this.dragFeature(t,e,n),t.dragMoveLocation=e.lngLat}},ee.onClick=function(t,e){return wt(e)?this.clickNoTarget(t,e):It(e)?this.clickActiveFeature(t,e):Ot(e)?this.clickInactive(t,e):void this.stopDragging(t)},ee.onTap=function(t,e){return wt(e)?this.clickNoTarget(t,e):It(e)?this.clickActiveFeature(t,e):Ot(e)?this.clickInactive(t,e):void 0},ee.onTouchEnd=ee.onMouseUp=function(t){t.dragMoving&&this.fireUpdate(),this.stopDragging(t)};var ne={};function ie(t,e){return!!t.lngLat&&t.lngLat.lng===e[0]&&t.lngLat.lat===e[1]}ne.onSetup=function(){var t=this.newFeature({type:I,properties:{},geometry:{type:L,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:v}),this.activateUIButton(C.POINT),this.setActionableState({trash:!0}),{point:t}},ne.stopDrawingAndRemove=function(t){this.deleteFeature([t.point.id],{silent:!0}),this.changeMode(F.SIMPLE_SELECT)},ne.onTap=ne.onClick=function(t,e){this.updateUIClasses({mouse:b}),t.point.updateCoordinate("",e.lngLat.lng,e.lngLat.lat),this.map.fire(R,{features:[t.point.toGeoJSON()]}),this.changeMode(F.SIMPLE_SELECT,{featureIds:[t.point.id]})},ne.onStop=function(t){this.activateUIButton(),t.point.getCoordinate().length||this.deleteFeature([t.point.id],{silent:!0})},ne.toDisplayFeatures=function(t,e,n){var i=e.properties.id===t.point.id;if(e.properties.active=i?Y:W,!i)return n(e)},ne.onTrash=ne.stopDrawingAndRemove,ne.onKeyUp=function(t,e){if(Nt(e)||jt(e))return this.stopDrawingAndRemove(t,e)};var re={onSetup:function(){var t=this.newFeature({type:I,properties:{},geometry:{type:O,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),kt(this),this.updateUIClasses({mouse:v}),this.activateUIButton(C.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&ie(e,t.polygon.coordinates[0][t.currentVertexPosition-1]))return this.changeMode(F.SIMPLE_SELECT,{featureIds:[t.polygon.id]});this.updateUIClasses({mouse:v}),t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),t.currentVertexPosition++,t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(F.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},onMouseMove:function(t,e){t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),Lt(e)&&this.updateUIClasses({mouse:E})}};re.onTap=re.onClick=function(t,e){return Lt(e)?this.clickOnVertex(t,e):this.clickAnywhere(t,e)},re.onKeyUp=function(t,e){Nt(e)?(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(F.SIMPLE_SELECT)):jt(e)&&this.changeMode(F.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},re.onStop=function(t){this.updateUIClasses({mouse:S}),Dt(this),this.activateUIButton(),void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+t.currentVertexPosition),t.polygon.isValid()?this.map.fire(R,{features:[t.polygon.toGeoJSON()]}):(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(F.SIMPLE_SELECT,{},{silent:!0})))},re.toDisplayFeatures=function(t,e,n){var i=e.properties.id===t.polygon.id;if(e.properties.active=i?Y:W,!i)return n(e);if(0!==e.geometry.coordinates.length){var r=e.geometry.coordinates[0].length;if(!(r<3)){if(e.properties.meta=V,n(Rt(t.polygon.id,e.geometry.coordinates[0][0],"0.0",!1)),r>3){var o=e.geometry.coordinates[0].length-3;n(Rt(t.polygon.id,e.geometry.coordinates[0][o],"0."+o,!1))}if(r<=4){var s=[[e.geometry.coordinates[0][0][0],e.geometry.coordinates[0][0][1]],[e.geometry.coordinates[0][1][0],e.geometry.coordinates[0][1][1]]];if(n({type:I,properties:e.properties,geometry:{coordinates:s,type:w}}),3===r)return}return n(e)}}},re.onTrash=function(t){this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(F.SIMPLE_SELECT)};var oe={onSetup:function(t){var e,n,i=(t=t||{}).featureId,r="forward";if(i){if(!(e=this.getFeature(i)))throw new Error("Could not find a feature with the provided featureId");var o=t.from;if(o&&"Feature"===o.type&&o.geometry&&"Point"===o.geometry.type&&(o=o.geometry),o&&"Point"===o.type&&o.coordinates&&2===o.coordinates.length&&(o=o.coordinates),!o||!Array.isArray(o))throw new Error("Please use the `from` property to indicate which point to continue the line from");var s=e.coordinates.length-1;if(e.coordinates[s][0]===o[0]&&e.coordinates[s][1]===o[1])n=s+1,e.addCoordinate.apply(e,[n].concat(e.coordinates[s]));else{if(e.coordinates[0][0]!==o[0]||e.coordinates[0][1]!==o[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");r="backwards",n=0,e.addCoordinate.apply(e,[n].concat(e.coordinates[0]))}}else e=this.newFeature({type:I,properties:{},geometry:{type:w,coordinates:[]}}),n=0,this.addFeature(e);return this.clearSelectedFeatures(),kt(this),this.updateUIClasses({mouse:v}),this.activateUIButton(C.LINE),this.setActionableState({trash:!0}),{line:e,currentVertexPosition:n,direction:r}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&ie(e,t.line.coordinates[t.currentVertexPosition-1])||"backwards"===t.direction&&ie(e,t.line.coordinates[t.currentVertexPosition+1]))return this.changeMode(F.SIMPLE_SELECT,{featureIds:[t.line.id]});this.updateUIClasses({mouse:v}),t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),"forward"===t.direction?(t.currentVertexPosition++,t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)):t.line.addCoordinate(0,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(F.SIMPLE_SELECT,{featureIds:[t.line.id]})},onMouseMove:function(t,e){t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),Lt(e)&&this.updateUIClasses({mouse:E})}};oe.onTap=oe.onClick=function(t,e){if(Lt(e))return this.clickOnVertex(t,e);this.clickAnywhere(t,e)},oe.onKeyUp=function(t,e){jt(e)?this.changeMode(F.SIMPLE_SELECT,{featureIds:[t.line.id]}):Nt(e)&&(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(F.SIMPLE_SELECT))},oe.onStop=function(t){Dt(this),this.activateUIButton(),void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(""+t.currentVertexPosition),t.line.isValid()?this.map.fire(R,{features:[t.line.toGeoJSON()]}):(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(F.SIMPLE_SELECT,{},{silent:!0})))},oe.onTrash=function(t){this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(F.SIMPLE_SELECT)},oe.toDisplayFeatures=function(t,e,n){var i=e.properties.id===t.line.id;if(e.properties.active=i?Y:W,!i)return n(e);e.geometry.coordinates.length<2||(e.properties.meta=V,n(Rt(t.line.id,e.geometry.coordinates["forward"===t.direction?e.geometry.coordinates.length-2:1],""+("forward"===t.direction?e.geometry.coordinates.length-2:1),!1)),n(e))};var se={simple_select:Qt,direct_select:ee,draw_point:ne,draw_polygon:re,draw_line_string:oe},ae={defaultMode:F.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}],modes:se,controls:{},userProperties:!1},le={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},ue={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function ce(t,e){return t.map((function(t){return t.source?t:bt(t,{id:t.id+"."+e,source:"hot"===e?_:y})}))}var he=rt((function(t,n){var i="[object Arguments]",r="[object Map]",o="[object Object]",s="[object Set]",a=/^\[object .+?Constructor\]$/,l=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[i]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u[r]=u["[object Number]"]=u[o]=u["[object RegExp]"]=u[s]=u["[object String]"]=u["[object WeakMap]"]=!1;var c="object"==typeof e&&e&&e.Object===Object&&e,h="object"==typeof self&&self&&self.Object===Object&&self,d=c||h||Function("return this")(),p=n&&!n.nodeType&&n,f=p&&t&&!t.nodeType&&t,g=f&&f.exports===p,m=g&&c.process,_=function(){try{return m&&m.binding&&m.binding("util")}catch(t){}}(),y=_&&_.isTypedArray;function v(t,e){for(var n=-1,i=null==t?0:t.length;++na))return!1;var u=o.get(t);if(u&&o.get(e))return u==e;var c=-1,h=!0,d=2&n?new ot:void 0;for(o.set(t,e),o.set(e,t);++c-1},it.prototype.set=function(t,e){var n=this.__data__,i=at(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this},rt.prototype.clear=function(){this.size=0,this.__data__={hash:new nt,map:new(q||it),string:new nt}},rt.prototype.delete=function(t){var e=pt(this,t).delete(t);return this.size-=e?1:0,e},rt.prototype.get=function(t){return pt(this,t).get(t)},rt.prototype.has=function(t){return pt(this,t).has(t)},rt.prototype.set=function(t,e){var n=pt(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this},ot.prototype.add=ot.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ot.prototype.has=function(t){return this.__data__.has(t)},st.prototype.clear=function(){this.__data__=new it,this.size=0},st.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},st.prototype.get=function(t){return this.__data__.get(t)},st.prototype.has=function(t){return this.__data__.has(t)},st.prototype.set=function(t,e){var n=this.__data__;if(n instanceof it){var i=n.__data__;if(!q||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new rt(i)}return n.set(t,e),this.size=n.size,this};var gt=G?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,i=null==t?0:t.length,r=0,o=[];++n-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}function It(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ot(t){return null!=t&&"object"==typeof t}var wt=y?function(t){return function(e){return t(e)}}(y):function(t){return Ot(t)&&Ct(t.length)&&!!u[lt(t)]};function Lt(t){return null!=(e=t)&&Ct(e.length)&&!St(e)?function(t,e){var n=xt(t),i=!n&&bt(t),r=!n&&!i&&Et(t),o=!n&&!i&&!r&&wt(t),s=n||i||r||o,a=s?function(t,e){for(var n=-1,i=Array(t);++n>>=1)e+=(t.high&n)===n?"1":"0";for(n=2147483648;0>>=1)e+=(t.low&n)===n?"1":"0";return e},o.isNaN=function(t){return Number.isNaN(t)},o.isInfinite=function(t){return!Number.isFinite(t)},o.MAX_VALUE=Number.MAX_VALUE,o.longBitsToDouble="function"==typeof Float64Array&&"function"==typeof Int32Array?(c=2146435072,h=new Float64Array(1),d=new Int32Array(h.buffer),o.doubleToLongBits=function(t){h[0]=t;var e=0|d[0],n=0|d[1];return(n&c)===c&&0!=(1048575&n)&&0!==e&&(e=0,n=2146959360),new r(n,e)},function(t){return d[0]=t.low,d[1]=t.high,h[0]}):(s=Math.log2,a=Math.floor,l=Math.pow,u=function(){for(var t=53;0>>=1,f|=(1&p)<<31,p>>>=1,n!==i&&(p|=524288);if(d=o+1023,c=0===e,e=t-e,o<52&&0!==e)for(i=0;;){if(1<=(n=2*e)?(e=n-1,c?(d--,c=!1):(i<<=1,i|=1,o++)):(e=n,c?0==--d&&(o++,c=!1):(i<<=1,o++)),20===o)p|=i,i=0;else if(52===o){f|=i;break}if(1===n){o<20?p|=i<<20-o:o<52&&(f|=i<<52-o);break}}return p|=d<<20,new r(p|=h,f)},function(t){var e,n,i,r,o=t.high,s=t.low;n=o&1<<31?-1:1,i=((2146435072&o)>>20)-1023,r=0,e=1<<19;for(var a=1;a<=20;a++)o&e&&(r+=l(2,-a)),e>>>=1;for(e=1<<31,a=21;a<=52;a++)s&e&&(r+=l(2,-a)),e>>>=1;if(-1023===i){if(0===r)return 0*n;i=-1022}else{if(1024===i)return 0===r?n/0:NaN;r+=1}return n*r*l(2,i)}),(_.prototype=Object.create(Error.prototype)).constructor=Error,y(v,_),e(v.prototype,{interfaces_:function(){return[]},getClass:function(){return v}}),e(b.prototype,{interfaces_:function(){return[]},getClass:function(){return b}}),b.shouldNeverReachHere=function(){if(0===arguments.length)b.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new v("Should never reach here"+(null!==t?": "+t:""))}},b.isTrue=function(){if(1===arguments.length){var t=arguments[0];b.isTrue(t,null)}else if(2===arguments.length){var e=arguments[1];if(!arguments[0])throw null===e?new v:new v(e)}},b.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];b.equals(t,e,null)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(!i.equals(n))throw new v("Expected "+n+" but encountered "+i+(null!==r?": "+r:""))}},e(x.prototype,{setOrdinate:function(t,e){switch(t){case x.X:this.x=e;break;case x.Y:this.y=e;break;case x.Z:this.z=e;break;default:throw new i("Invalid ordinate index: "+t)}},equals2D:function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],i=arguments[1];return!!n.equalsWithTolerance(this.x,e.x,i)&&!!n.equalsWithTolerance(this.y,e.y,i)}},getOrdinate:function(t){switch(t){case x.X:return this.x;case x.Y:return this.y;case x.Z:return this.z}throw new i("Invalid ordinate index: "+t)},equals3D:function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||o.isNaN(this.z)&&o.isNaN(t.z))},equals:function(t){return t instanceof x&&this.equals2D(t)},equalInZ:function(t,e){return n.equalsWithTolerance(this.z,t.z,e)},compareTo:function(t){var e=t;return this.xe.x?1:this.ye.y?1:0},clone:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return b.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}},copy:function(){return new x(this)},toString:function(){return"("+this.x+", "+this.y+", "+this.z+")"},distance3D:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)},distance:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},hashCode:function(){var t=17;return 37*(t=37*t+x.hashCode(this.x))+x.hashCode(this.y)},setCoordinate:function(t){this.x=t.x,this.y=t.y,this.z=t.z},interfaces_:function(){return[p,f,m]},getClass:function(){return x}}),x.hashCode=function(){if(1===arguments.length&&"number"==typeof arguments[0]){var t=arguments[0],e=o.doubleToLongBits(t);return Math.trunc(e^e>>>32)}},e(E.prototype,{compare:function(t,e){var n=t,i=e,r=E.compare(n.x,i.x);if(0!==r)return r;var o=E.compare(n.y,i.y);return 0!==o?o:this._dimensionsToTest<=2?0:E.compare(n.z,i.z)},interfaces_:function(){return[g]},getClass:function(){return E}}),E.compare=function(t,e){return t=this.size())throw new O;return this.array_[t]},N.prototype.isEmpty=function(){return 0===this.array_.length},N.prototype.size=function(){return this.array_.length},N.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;et._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny;return new P(e,this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}},intersects:function(){if(1===arguments.length){if(arguments[0]instanceof P){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||(n.x>i.x?n.x:i.x)this._maxy||(n.y>i.y?n.y:i.y)this._maxx||rthis._maxy||othis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}},minExtent:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0},translate:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},toString:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},setToNull:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},getHeight:function(){return this.isNull()?0:this._maxy-this._miny},maxExtent:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return ethis._maxx||this._miny>this._maxy)&&this.setToNull()}},contains:function(){if(1===arguments.length){if(arguments[0]instanceof P){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof x){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return this.covers(n,i)}},centre:function(){return this.isNull()?null:new x((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},init:function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof x){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof P){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._maxx=rt._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},hashCode:function(){var t=17;return 37*(t=37*(t=37*(t=37*t+x.hashCode(this._minx))+x.hashCode(this._maxx))+x.hashCode(this._miny))+x.hashCode(this._maxy)},interfaces_:function(){return[p,m]},getClass:function(){return P}}),P.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),l=Math.max(o.x,s.x),u=Math.min(i.x,r.x),c=Math.max(i.x,r.x);return!(lt?1:0},D.isNaN=function(t){return Number.isNaN(t)},k.isWhitespace=function(t){return t<=32&&0<=t||127==t},k.toUpperCase=function(t){return t.toUpperCase()},e(B.prototype,{le:function(t){return this._hi=a-l&&(d=!1),!d)break}return e[0]=i,s.toString()},sqr:function(){return this.multiply(this)},doubleValue:function(){return this._hi+this._lo},subtract:function(){if(arguments[0]instanceof B){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},equals:function(){if(1===arguments.length&&arguments[0]instanceof B){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},isZero:function(){return 0===this._hi&&0===this._lo},selfSubtract:function(){if(arguments[0]instanceof B){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},getSpecialNumberString:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},min:function(t){return this.le(t)?this:t},selfDivide:function(){if(1===arguments.length){if(arguments[0]instanceof B){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n,i,r,o,s=arguments[0],a=arguments[1],l=null,u=null,c=null,h=null;return r=this._hi/s,h=(l=(c=B.SPLIT*r)-(l=c-r))*(u=(h=B.SPLIT*s)-(u=h-s))-(o=r*s)+l*(i=s-u)+(n=r-l)*u+n*i,h=r+(c=(this._hi-o-h+this._lo-r*a)/s),this._hi=h,this._lo=r-h+c,this}},dump:function(){return"DD<"+this._hi+", "+this._lo+">"},divide:function(){if(arguments[0]instanceof B){var t,e,n,i,r=arguments[0],s=null,a=null,l=null,u=null;return t=(n=this._hi/r._hi)-(s=(l=B.SPLIT*n)-(s=l-n)),u=s*(a=(u=B.SPLIT*r._hi)-(a=u-r._hi))-(i=n*r._hi)+s*(e=r._hi-a)+t*a+t*e,new B(u=n+(l=(this._hi-i-u+this._lo-n*r._lo)/r._hi),n-u+l)}if("number"==typeof arguments[0]){var c=arguments[0];return o.isNaN(c)?B.createNaN():B.copy(this).selfDivide(c,0)}},ge:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo},pow:function(t){if(0===t)return B.valueOf(1);var e=new B(this),n=B.valueOf(1),i=Math.abs(t);if(1e._hi?1:this._loe._lo?1:0},rint:function(){return this.isNaN()?this:this.add(.5).floor()},setValue:function(){if(arguments[0]instanceof B){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},max:function(t){return this.ge(t)?this:t},sqrt:function(){if(this.isZero())return B.valueOf(0);if(this.isNegative())return B.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=B.valueOf(e),i=this.subtract(n.sqr())._hi*(.5*t);return n.add(i)},selfAdd:function(){if(1===arguments.length){if(arguments[0]instanceof B){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0],n=null,i=null,r=null,o=null,s=null,a=null;return o=(r=this._hi+e)-(s=r-this._hi),i=(a=(o=e-s+(this._hi-o))+this._lo)+(r-(n=r+a)),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(2===arguments.length){var l,u=arguments[0],c=arguments[1],h=(n=null,i=null,null);r=null,o=null,s=null,a=null,r=this._hi+u,l=this._lo+c,o=r-(s=r-this._hi),h=l-(a=l-this._lo);var d=(n=r+(s=(o=u-s+(this._hi-o))+l))+(s=(h=c-a+(this._lo-h))+(i=s+(r-n))),p=s+(n-d);return this._hi=d,this._lo=p,this}},selfMultiply:function(){if(1===arguments.length){if(arguments[0]instanceof B){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n,i,r=arguments[0],o=arguments[1],s=null,a=null,l=null,u=null;s=(l=B.SPLIT*this._hi)-this._hi,u=B.SPLIT*r,s=l-s,n=this._hi-s,a=u-r;var c=(l=this._hi*r)+(u=s*(a=u-a)-l+s*(i=r-a)+n*a+n*i+(this._hi*o+this._lo*r)),h=u+(s=l-c);return this._hi=c,this._lo=h,this}},selfSqr:function(){return this.selfMultiply(this)},floor:function(){if(this.isNaN())return B.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new B(t,e)},negate:function(){return this.isNaN()?this:new B(-this._hi,-this._lo)},clone:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}},multiply:function(){if(arguments[0]instanceof B){var t=arguments[0];return t.isNaN()?B.createNaN():B.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return o.isNaN(e)?B.createNaN():B.copy(this).selfMultiply(e,0)}},isNaN:function(){return o.isNaN(this._hi)},intValue:function(){return Math.trunc(this._hi)},toString:function(){var t=B.magnitude(this._hi);return-3<=t&&t<=20?this.toStandardNotation():this.toSciNotation()},toStandardNotation:function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,r=n;if("."===n.charAt(0))r="0"+n;else if(i<0)r="0."+B.stringOfChar("0",-i)+n;else if(-1===n.indexOf(".")){var o=i-n.length;r=n+B.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+r:r},reciprocal:function(){var t,e,n,i,r=null,o=null,s=null,a=null;t=(n=1/this._hi)-(r=(s=B.SPLIT*n)-(r=s-n)),o=(a=B.SPLIT*this._hi)-this._hi;var l=n+(s=(1-(i=n*this._hi)-(a=r*(o=a-o)-i+r*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new B(l,n-l+s)},toSciNotation:function(){if(this.isZero())return B.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=B.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new IllegalStateException("Found leading zero: "+n);var r="";1t._hi||this._hi===t._hi&&this._lo>t._lo},isNegative:function(){return this._hi<0||0===this._hi&&this._lo<0},trunc:function(){return this.isNaN()?B.NaN:this.isPositive()?this.floor():this.ceil()},signum:function(){return 0n.y&&(n=s,r=o)}for(var a=r;(a-=1)<0&&(a=e),t[a].equals2D(n)&&a!==r;);for(var l=r;t[l=(l+1)%e].equals2D(n)&&l!==r;);var u=t[a],c=t[l];if(u.equals2D(n)||c.equals2D(n)||u.equals2D(c))return!1;var h=z.index(u,n,c);return 0===h?u.x>c.x:0=t?e:[]},nt.indexOf=function(t,e){for(var n=0;n=t.length&&(i=0),ni.length)return 1;if(0===n.length)return 0;var r=nt.compare(n,i);return nt.isEqualReversed(n,i)?0:r},OLDcompare:function(t,e){var n=t,i=e;if(n.lengthi.length)return 1;if(0===n.length)return 0;for(var r=nt.increasingDirection(n),o=nt.increasingDirection(i),s=0= 2)");this._points=t},isCoordinate:function(t){for(var e=0;e= 4)")},getGeometryType:function(){return J.TYPENAME_LINEARRING},copy:function(){return new Wt(this._points.copy(),this._factory)},interfaces_:function(){return[]},getClass:function(){return Wt}}),Wt.MINIMUM_VALID_SIZE=4,Wt.serialVersionUID=-0x3b229e262367a600,y(Ht,Ot),e(Ht.prototype,{equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof J){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&Ot.prototype.equalsExact.call(this,t,e)}return Ot.prototype.equalsExact.apply(this,arguments)},getBoundaryDimension:function(){return 1},getTypeCode:function(){return J.TYPECODE_MULTIPOLYGON},getDimension:function(){return 2},reverse:function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n>32),n=java.lang.Double.doubleToLongBits(this.p1.x);return n^=31*java.lang.Double.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},interfaces_:function(){return[p,m]},getClass:function(){return _e}}),_e.midPoint=function(t,e){return new x((t.x+e.x)/2,(t.y+e.y)/2)},_e.serialVersionUID=0x2d2172135f411c00,e(ye.prototype,{interfaces_:function(){return[]},getClass:function(){return ye}}),ye.toLocationSymbol=function(t){switch(t){case ye.EXTERIOR:return"e";case ye.BOUNDARY:return"b";case ye.INTERIOR:return"i";case ye.NONE:return"-"}throw new i("Unknown location value: "+t)},ye.INTERIOR=0,ye.BOUNDARY=1,ye.EXTERIOR=2,ye.NONE=-1,e(ve.prototype,{isIntersects:function(){return!this.isDisjoint()},isCovers:function(){return(ve.isTrue(this._matrix[ye.INTERIOR][ye.INTERIOR])||ve.isTrue(this._matrix[ye.INTERIOR][ye.BOUNDARY])||ve.isTrue(this._matrix[ye.BOUNDARY][ye.INTERIOR])||ve.isTrue(this._matrix[ye.BOUNDARY][ye.BOUNDARY]))&&this._matrix[ye.EXTERIOR][ye.INTERIOR]===St.FALSE&&this._matrix[ye.EXTERIOR][ye.BOUNDARY]===St.FALSE},isCoveredBy:function(){return(ve.isTrue(this._matrix[ye.INTERIOR][ye.INTERIOR])||ve.isTrue(this._matrix[ye.INTERIOR][ye.BOUNDARY])||ve.isTrue(this._matrix[ye.BOUNDARY][ye.INTERIOR])||ve.isTrue(this._matrix[ye.BOUNDARY][ye.BOUNDARY]))&&this._matrix[ye.INTERIOR][ye.EXTERIOR]===St.FALSE&&this._matrix[ye.BOUNDARY][ye.EXTERIOR]===St.FALSE},set:function(){if(1===arguments.length)for(var t=arguments[0],e=0;eMath.PI;)t-=be.PI_TIMES_2;for(;t<=-Math.PI;)t+=be.PI_TIMES_2;return t},be.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=n.x-e.x,r=n.y-e.y;return Math.atan2(r,i)}},be.isAcute=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return 0Math.PI&&(n=2*Math.PI-n),n},be.toRadians=function(t){return t*Math.PI/180},be.getTurn=function(t,e){var n=Math.sin(e-t);return 0Math.PI?r-be.PI_TIMES_2:r},be.PI_TIMES_2=2*Math.PI,be.PI_OVER_2=Math.PI/2,be.PI_OVER_4=Math.PI/4,be.COUNTERCLOCKWISE=z.COUNTERCLOCKWISE,be.CLOCKWISE=z.CLOCKWISE,be.NONE=z.COLLINEAR,e(xe.prototype,{area:function(){return xe.area(this.p0,this.p1,this.p2)},signedArea:function(){return xe.signedArea(this.p0,this.p1,this.p2)},interpolateZ:function(t){if(null===t)throw new i("Supplied point is null.");return xe.interpolateZ(t,this.p0,this.p1,this.p2)},longestSideLength:function(){return xe.longestSideLength(this.p0,this.p1,this.p2)},isAcute:function(){return xe.isAcute(this.p0,this.p1,this.p2)},circumcentre:function(){return xe.circumcentre(this.p0,this.p1,this.p2)},area3D:function(){return xe.area3D(this.p0,this.p1,this.p2)},centroid:function(){return xe.centroid(this.p0,this.p1,this.p2)},inCentre:function(){return xe.inCentre(this.p0,this.p1,this.p2)},interfaces_:function(){return[]},getClass:function(){return xe}}),xe.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},xe.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},xe.det=function(t,e,n,i){return t*i-e*n},xe.interpolateZ=function(t,e,n,i){var r=e.x,o=e.y,s=n.x-r,a=i.x-r,l=n.y-o,u=i.y-o,c=s*u-a*l,h=t.x-r,d=t.y-o,p=(u*h-a*d)/c,f=(-l*h+s*d)/c;return e.z+p*(n.z-e.z)+f*(i.z-e.z)},xe.longestSideLength=function(t,e,n){var i=t.distance(e),r=e.distance(n),o=n.distance(t),s=i;return sthis._distance&&this.initialize(e,n,i)}},interfaces_:function(){return[]},getClass:function(){return Se}}),e(Ce.prototype,{interfaces_:function(){return[]},getClass:function(){return Ce}}),Ce.computeDistance=function(){if(arguments[2]instanceof Se&&arguments[0]instanceof Bt&&arguments[1]instanceof x)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new _e,r=t.getCoordinates(),o=0;oe||this._max=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var r=z.index(t,e,this._p);if(r===z.COLLINEAR)return this._isPointOnSegment=!0,null;e.y=this._max)throw new L;var t=this._parent.getGeometryN(this._index++);return t instanceof Ot?(this._subcollectionIterator=new qe(t),this._subcollectionIterator.next()):t},remove:function(){throw new UnsupportedOperationException(this.getClass().getName())},hasNext:function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},interfaces_:function(){return[C]},getClass:function(){return qe}}),qe.isAtomic=function(t){return!(t instanceof Ot)},e(Ye.prototype,{locate:function(t){return Ye.locate(t,this._geom)},interfaces_:function(){return[Ne]},getClass:function(){return Ye}}),Ye.locatePointInPolygon=function(t,e){if(e.isEmpty())return ye.EXTERIOR;var n=e.getExteriorRing(),i=Ye.locatePointInRing(t,n);if(i!==ye.INTERIOR)return i;for(var r=0;rn.y&&(n=s,r=o)}for(var a=r;(a-=1)<0&&(a=e),t[a].equals2D(n)&&a!==r;);for(var l=r;t[l=(l+1)%e].equals2D(n)&&l!==r;);var u=t[a],c=t[l];if(u.equals2D(n)||c.equals2D(n)||u.equals2D(c))return!1;var h=$e.computeOrientation(u,n,c);return 0===h?u.x>c.x:0=this.size())throw new IndexOutOfBoundsException;return this.array_[t]},en.prototype.push=function(t){return this.array_.push(t),t},en.prototype.pop=function(t){if(0===this.array_.length)throw new tn;return this.array_.pop()},en.prototype.peek=function(){if(0===this.array_.length)throw new tn;return this.array_[this.array_.length-1]},en.prototype.empty=function(){return 0===this.array_.length},en.prototype.isEmpty=function(){return this.empty()},en.prototype.search=function(t){return this.array_.indexOf(t)},en.prototype.size=function(){return this.array_.length},en.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;ee[2].y&&(e[2]=t[i]),t[i].x+t[i].y>e[3].x+e[3].y&&(e[3]=t[i]),t[i].x>e[4].x&&(e[4]=t[i]),t[i].x-t[i].y>e[5].x-e[5].y&&(e[5]=t[i]),t[i].ythis._maxWidth)&&(this._interiorPoint=e,this._maxWidth=n)},getInteriorPoint:function(){return this._interiorPoint},widestGeometry:function(){if(arguments[0]instanceof Ot){var t=arguments[0];if(t.isEmpty())return t;for(var e=t.getGeometryN(0),n=1;ne.getEnvelopeInternal().getWidth()&&(e=t.getGeometryN(n));return e}if(arguments[0]instanceof J){var i=arguments[0];return i instanceof Ot?this.widestGeometry(i):i}},horizontalBisector:function(t){var e=t.getEnvelopeInternal(),n=an.getBisectorY(t);return this._factory.createLineString([new x(e.getMinX(),n),new x(e.getMaxX(),n)])},add:function(t){if(t instanceof qt)this.addPolygon(t);else if(t instanceof Ot)for(var e=t,n=0;nthis._loY&&(this._loY=t):t>this._centreY&&t=e&&(n=1),t.max<=e&&(n=0),n},e(dn.prototype,{expandToInclude:function(t){t.max>this.max&&(this.max=t.max),t.minn||this.max=this.min&&e<=this.max}}else if(2===arguments.length){var n=arguments[1];return arguments[0]>=this.min&&n<=this.max}},init:function(t,e){this.min=t,(this.max=e)=n.x?r.y>=n.y?bn.NE:bn.SE:r.y>=n.y?bn.NW:bn.SW}},bn.NE=0,bn.NW=1,bn.SW=2,bn.SE=3,e(xn.prototype,{interfaces_:function(){return[]},getClass:function(){return xn}}),xn.getChainStartIndices=function(t){var e=0,n=new N;n.add(new D(e));do{var i=xn.findChainEnd(t,e);n.add(new D(i)),e=i}while(e=t.length-1)return t.length-1;for(var i=bn.quadrant(t[n],t[n+1]),r=e+1;r=t.length&&(e=0),e},wn.computeC=function(t,e,n){return t*n.y-e*n.x},wn.getMinimumDiameter=function(t){return new wn(t).getDiameter()},wn.getMinimumRectangle=function(t){return new wn(t).getMinimumRectangle()},wn.computeSegmentForLine=function(t,e,n){var i=null;return new _e(i,Math.abs(e)>Math.abs(t)?(i=new x(0,n/e),new x(1,n/e-t/e)):(i=new x(n/t,0),new x(n/t-e/t,1)))};var Ln=Object.freeze({distance:Le,locate:We,match:Ke,Angle:be,Centroid:Qe,CGAlgorithms:$e,ConvexHull:rn,Distance:Y,InteriorPointArea:sn,InteriorPointLine:ln,InteriorPointPoint:un,RobustLineIntersector:me,MCPointInRing:Cn,MinimumBoundingCircle:On,MinimumDiameter:wn});function Tn(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1}function Nn(){this._inputGeom=null,this._distanceTolerance=null;var t=arguments[0];this._inputGeom=t}function jn(){Tn.apply(this),this.distanceTolerance=null;var t=arguments[0];this.distanceTolerance=t}e(Tn.prototype,{transformPoint:function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},transformPolygon:function(t,e){var n=!0,i=this.transformLinearRing(t.getExteriorRing(),t);null!==i&&i instanceof Wt&&!i.isEmpty()||(n=!1);for(var r=new N,o=0;oe._xValue?1:this._eventTypee._eventType?1:0},getInsertEvent:function(){return this._insertEvent},isInsert:function(){return this._eventType===Un.INSERT},isSameLabel:function(t){return null!==this._label&&this._label===t._label},getDeleteEventIndex:function(){return this._deleteEventIndex},interfaces_:function(){return[p]},getClass:function(){return Un}}),Un.INSERT=1,Un.DELETE=2,e(qn.prototype,{interfaces_:function(){return[]},getClass:function(){return qn}}),e(Yn.prototype,{isTrivialIntersection:function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(Yn.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var r=t.getNumPoints()-1;if(0===e&&i===r||0===i&&e===r)return!0}}return!1},getProperIntersectionPoint:function(){return this._properIntersectionPoint},setIsDoneIfProperInt:function(t){this._isDoneWhenProperInt=t},hasProperInteriorIntersection:function(){return this._hasProperInterior},isBoundaryPointInternal:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next().getCoordinate();if(t.isIntersection(i))return!0}return!1},hasProperIntersection:function(){return this._hasProper},hasIntersection:function(){return this._hasIntersection},isDone:function(){return this._isDone},isBoundaryPoint:function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},setBoundaryNodes:function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},addIntersections:function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},interfaces_:function(){return[]},getClass:function(){return Yn}}),Yn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},y(Wn,qn),e(Wn.prototype,{prepareEvents:function(){Fe.sort(this.events);for(var t=0;tthis.location.length){var e=new Array(3).fill(null);e[zn.ON]=this.location[zn.ON],e[zn.LEFT]=ye.NONE,e[zn.RIGHT]=ye.NONE,this.location=e}for(var n=0;ne&&(i=1),this._depth[t][n]=i}}},getDelta:function(t){return this._depth[t][zn.RIGHT]-this._depth[t][zn.LEFT]},getLocation:function(t,e){return this._depth[t][e]<=0?ye.EXTERIOR:ye.INTERIOR},toString:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},add:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var i=t.getLocation(e,n);i!==ye.EXTERIOR&&i!==ye.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=$n.depthAtLocation(i):this._depth[e][n]+=$n.depthAtLocation(i))}else if(3===arguments.length){var r=arguments[0],o=arguments[1];arguments[2]===ye.INTERIOR&&this._depth[r][o]++}},interfaces_:function(){return[]},getClass:function(){return $n}}),$n.depthAtLocation=function(t){return t===ye.EXTERIOR?0:t===ye.INTERIOR?1:$n.NULL_VALUE},$n.NULL_VALUE=-1,e(ti.prototype,{setVisited:function(t){this._isVisited=t},setInResult:function(t){this._isInResult=t},isCovered:function(){return this._isCovered},isCoveredSet:function(){return this._isCoveredSet},setLabel:function(t){this._label=t},getLabel:function(){return this._label},setCovered:function(t){this._isCovered=t,this._isCoveredSet=!0},updateIM:function(t){b.isTrue(2<=this._label.getGeometryCount(),"found partial label"),this.computeIM(t)},isInResult:function(){return this._isInResult},isVisited:function(){return this._isVisited},interfaces_:function(){return[]},getClass:function(){return ti}}),y(ei,ti),e(ei.prototype,{getDepth:function(){return this._depth},getCollapsedEdge:function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new ei(t,Xn.toLineLabel(this._label))},isIsolated:function(){return this._isIsolated},getCoordinates:function(){return this.pts},setIsolated:function(t){this._isIsolated=t},setName:function(t){this._name=t},equals:function(t){if(!(t instanceof ei))return!1;var e=t;if(this.pts.length!==e.pts.length)return!1;for(var n=!0,i=!0,r=this.pts.length,o=0;ot._quadrant?1:this._quadrant=e&&(t.getMinY()>=n&&(i=3),t.getMaxY()<=n&&(i=1)),t.getMaxX()<=e&&(t.getMinY()>=n&&(i=2),t.getMaxY()<=n&&(i=0)),i},e(_i.prototype,{getLevel:function(){return this._level},computeKey:function(){if(1===arguments.length){var t=arguments[0];for(this._level=_i.computeQuadLevel(t),this._env=new P,this.computeKey(this._level,t);!this._env.contains(t);)this._level+=1,this.computeKey(this._level,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=pn.powerOf2(e);this._pt.x=Math.floor(n.getMinX()/i)*i,this._pt.y=Math.floor(n.getMinY()/i)*i,this._env.init(this._pt.x,this._pt.x+i,this._pt.y,this._pt.y+i)}},getEnvelope:function(){return this._env},getCentre:function(){return new x((this._env.getMinX()+this._env.getMaxX())/2,(this._env.getMinY()+this._env.getMaxY())/2)},getPoint:function(){return this._pt},interfaces_:function(){return[]},getClass:function(){return _i}}),_i.computeQuadLevel=function(t){var e=t.getWidth(),n=t.getHeight();return pn.exponent(nwi.area(this._boundable2)?this.expand(this._boundable1,this._boundable2,t,e):this.expand(this._boundable2,this._boundable1,t,e),null;if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new i("neither boundable is composite")},isLeaves:function(){return!(wi.isComposite(this._boundable1)||wi.isComposite(this._boundable2))},compareTo:function(t){var e=t;return this._distancee._distance?1:0},expand:function(t,e,n,i){for(var r=t.getChildBoundables().iterator();r.hasNext();){var o=new wi(r.next(),e,this._itemDistance);o.getDistance()y&&(m.poll(),m.add(_)),a=m.peek().getDistance()):_.expandToQueue(p,a)}return Ni.getItems(m)}}else if(4===arguments.length){var v=arguments[2],b=arguments[3];return d=new Ci(arguments[0],arguments[1]),e=new wi(this.getRoot(),d,v),this.nearestNeighbour(e,b)}},interfaces_:function(){return[bi,m]},getClass:function(){return Ni}}),Ni.centreX=function(t){return Ni.avg(t.getMinX(),t.getMaxX())},Ni.avg=function(t,e){return(t+e)/2},Ni.getItems=function(t){for(var e=new Array(t.size()).fill(null),n=0;!t.isEmpty();){var i=t.poll();e[n]=i.getBoundable(0).getItem(),n++}return e},Ni.centreY=function(t){return Ni.avg(t.getMinY(),t.getMaxY())},y(ji,Oi),e(ji.prototype,{computeBounds:function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new P(n.getBounds()):t.expandToInclude(n.getBounds())}return t},interfaces_:function(){return[]},getClass:function(){return ji}}),Ni.STRtreeNode=ji,Ni.serialVersionUID=0x39920f7d5f261e0,Ni.xComparator={interfaces_:function(){return[g]},compare:function(t,e){return Li.compareDoubles(Ni.centreX(t.getBounds()),Ni.centreX(e.getBounds()))}},Ni.yComparator={interfaces_:function(){return[g]},compare:function(t,e){return Li.compareDoubles(Ni.centreY(t.getBounds()),Ni.centreY(e.getBounds()))}},Ni.intersectsOp={interfaces_:function(){return[IntersectsOp]},intersects:function(t,e){return t.intersects(e)}},Ni.DEFAULT_NODE_CAPACITY=10;var Mi=Object.freeze({STRtree:Ni}),Pi=Object.freeze({kdtree:gi,quadtree:Ei,strtree:Mi}),Fi=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];function Ri(t){this.geometryFactory=t||new ue}e(Ri.prototype,{read:function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!Ai[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Fi.indexOf(n)?Ai[n].call(this,e.coordinates):"GeometryCollection"===n?Ai[n].call(this,e.geometries):Ai[n].call(this,e)},write:function(t){var e=t.getGeometryType();if(!Di[e])throw new Error("Geometry is not supported");return Di[e].call(this,t)}});var Ai={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var i=t.geometry.type;if(!Ai[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Ai.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;nn.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}},interfaces_:function(){return[]},getClass:function(){return er}}),y(nr,Qi),e(nr.prototype,{overlap:function(){if(4!==arguments.length)return Qi.prototype.overlap.apply(this,arguments);var t=arguments[1],e=arguments[2],n=arguments[3],i=arguments[0].getContext(),r=e.getContext();this._si.processIntersections(i,t,r,n)},interfaces_:function(){return[]},getClass:function(){return nr}}),er.SegmentOverlapAction=nr,e(ir.prototype,{rescale:function(){if(S(arguments[0],I))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){var n=arguments[0];for(2===n.length&&(new x(n[0]),new x(n[1])),t=0;tthis._minCoord.y&&n.y>this._minCoord.y&&i===z.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)},getRightmostSideOfSegment:function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var i=zn.LEFT;return n[e].ythis._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},findRightmostEdgeAtNode:function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},findEdge:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}b.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===zn.LEFT&&(this._orientedDe=this._minDe.getSym())},interfaces_:function(){return[]},getClass:function(){return lr}}),ur.prototype.addLast=function(t){this.array_.push(t)},ur.prototype.removeFirst=function(){return this.array_.shift()},ur.prototype.isEmpty=function(){return 0===this.array_.length},e(cr.prototype,{clearVisitedEdges:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},getRightmostCoordinate:function(){return this._rightMostCoord},computeNodeDepth:function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();)if((i=n.next()).isVisited()||i.getSym().isVisited()){e=i;break}if(null===e)throw new oi("unable to find edge to compute depths at "+t.getCoordinate());for(t.getEdges().computeDepths(e),n=t.getEdges().iterator();n.hasNext();){var i;(i=n.next()).setVisited(!0),this.copySymDepths(i)}},computeDepth:function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.getNode(),e.getLabel(),e.setEdgeDepths(zn.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},create:function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},findResultEdges:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();1<=e.getDepth(zn.RIGHT)&&e.getDepth(zn.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},computeDepths:function(t){var e=new lt,n=new ur,i=t.getNode();for(n.addLast(i),e.add(i),t.setVisited(!0);!n.isEmpty();){var r=n.removeFirst();e.add(r),this.computeNodeDepth(r);for(var o=r.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},compareTo:function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0},getEnvelope:function(){if(null===this._env){for(var t=new P,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),i=0;ithis._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},addPoints:function(t,e,n){var i=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var o=r;othis._bufParams.getMitreLimit()&&(r=!1)}catch(t){if(!(t instanceof R))throw t;o=new x(0,0),r=!1}r?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())},addOutsideTurn:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)r.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(S(arguments[2],w)&&arguments[0]instanceof x&&arguments[1]instanceof si){var o=arguments[0],s=arguments[1],a=arguments[2],l=s.getEdge().getCoordinates();for(n=0;nthis._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y||z.index(this._seg.p0,this._seg.p1,o)===z.RIGHT)){var u=s.getDepth(zn.LEFT);this._seg.p0.equals(l[n])||(u=s.getDepth(zn.RIGHT));var c=new br(this._seg,u);a.add(c)}}else if(S(arguments[2],w)&&arguments[0]instanceof x&&S(arguments[1],w)){var h=arguments[0],d=arguments[2];for(n=arguments[1].iterator();n.hasNext();){var p=n.next();p.isForward()&&this.findStabbedSegments(h,p,d)}}},getDepth:function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Fe.min(e)._leftDepth},interfaces_:function(){return[]},getClass:function(){return vr}}),e(br.prototype,{compareTo:function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!=(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},compareX:function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},toString:function(){return this._upwardSeg.toString()},interfaces_:function(){return[p]},getClass:function(){return br}}),vr.DepthSegment=br,e(xr.prototype,{addPoint:function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,ye.EXTERIOR,ye.INTERIOR)},addPolygon:function(t){var e=this._distance,n=zn.LEFT;this._distance<0&&(e=-this._distance,n=zn.RIGHT);var i=t.getExteriorRing(),r=nt.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&r.length<3)return null;this.addPolygonRing(r,e,n,ye.EXTERIOR,ye.INTERIOR);for(var o=0;o=Wt.MINIMUM_VALID_SIZE&&z.isCCW(t)&&(o=r,s=i,n=zn.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},add:function(t){if(t.isEmpty())return null;if(t instanceof qt)this.addPolygon(t);else if(t instanceof Bt)this.addLineString(t);else if(t instanceof zt)this.addPoint(t);else if(t instanceof Yt)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof Ht)this.addCollection(t);else{if(!(t instanceof Ot))throw new UnsupportedOperationException(t.getClass().getName());this.addCollection(t)}},isErodedCompletely:function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>r},addCollection:function(t){for(var e=0;ei||this._maxyo;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return b.isTrue(!(s&&a),"Found bad envelope test"),a},initCorners:function(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new x(this._maxx,this._maxy),this._corner[1]=new x(this._minx,this._maxy),this._corner[2]=new x(this._minx,this._miny),this._corner[3]=new x(this._maxx,this._miny)},intersects:function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},scale:function(t){return Math.round(t*this._scaleFactor)},getCoordinate:function(){return this._originalPt},copyScaled:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},getSafeEnvelope:function(){if(null===this._safeEnv){var t=jr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new P(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},intersectsPixelClosure:function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))},intersectsToleranceSquare:function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||n&&i||t.equals(this._pt)||e.equals(this._pt)))))},addSnappedNode:function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return!!this.intersects(n,i)&&(t.addIntersection(this.getCoordinate(),e),!0)},interfaces_:function(){return[]},getClass:function(){return jr}}),jr.SAFE_ENV_EXPANSION_FACTOR=.75,e(Mr.prototype,{snap:function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2],r=e.getSafeEnvelope(),o=new Pr(e,n,i);return this._index.query(r,{interfaces_:function(){return[Te]},visitItem:function(t){t.select(r,o)}}),o.isNodeAdded()}},interfaces_:function(){return[]},getClass:function(){return Mr}}),y(Pr,cn),e(Pr.prototype,{isNodeAdded:function(){return this._isNodeAdded},select:function(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof vn))return cn.prototype.select.apply(this,arguments);var t=arguments[1],e=arguments[0].getContext();if(null!==this._parentEdge&&e===this._parentEdge&&t===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(e,t)},interfaces_:function(){return[]},getClass:function(){return Pr}}),Mr.HotPixelSnapAction=Pr,e(Fr.prototype,{processIntersections:function(t,e,n,i){if(t===n&&e===i)return null;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];if(this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var l=0;lthis._minDistance)return null;for(var i=t.getCoordinates(),r=e.getCoordinate(),o=0;othis._minDistance)return null;i=a.getCoordinates();var c=l.getCoordinates();for(o=0;ot._quadrant?1:this._quadrant=t.size()-2},hasIntersection:function(){return null!==this._interiorIntersection},isDone:function(){return!this._findAllIntersections&&null!==this._interiorIntersection},interfaces_:function(){return[wr]},getClass:function(){return ro}}),ro.createAllIntersectionsFinder=function(t){var e=new ro(t);return e.setFindAllIntersections(!0),e},ro.createAnyIntersectionFinder=function(t){return new ro(t)},ro.createIntersectionCounter=function(t){var e=new ro(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e},e(oo.prototype,{execute:function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},getIntersections:function(){return this._segInt.getIntersections()},isValid:function(){return this.execute(),this._isValid},setFindAllIntersections:function(t){this._findAllIntersections=t},checkInteriorIntersections:function(){this._isValid=!0,this._segInt=new ro(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new er;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},checkValid:function(){if(this.execute(),!this._isValid)throw new oi(this.getErrorMessage(),this._segInt.getInteriorIntersection())},getErrorMessage:function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fe.toLineString(t[0],t[1])+" and "+fe.toLineString(t[2],t[3])},interfaces_:function(){return[]},getClass:function(){return oo}}),oo.computeIntersections=function(t){var e=new oo(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()},e(so.prototype,{checkValid:function(){this._nv.checkValid()},interfaces_:function(){return[]},getClass:function(){return so}}),so.toSegmentStrings=function(t){for(var e=new N,n=t.iterator();n.hasNext();){var i=n.next();e.add(new io(i.getCoordinates(),i))}return e},so.checkValid=function(t){new so(t).checkValid()},e(ao.prototype,{map:function(t){for(var e=new N,n=0;n>>20},fo.zeroLowerBits=function(t,e){var n="low";if(32=t.getNumPoints()&&null===i)return null;var o=t.getCoordinate(r);null!==i&&i.segmentIndex===n.segmentIndex&&(o=i.coord);var s=new ri(t,n.coord,o,new Xn(t.getLabel()));e.add(s)},createEdgeEndForPrev:function(t,e,n,i){var r=n.segmentIndex;if(0===n.dist){if(0===r)return null;r--}var o=t.getCoordinate(r);null!==i&&i.segmentIndex>=r&&(o=i.coord);var s=new Xn(t.getLabel());s.flip();var a=new ri(t,n.coord,o,s);e.add(a)},computeEdgeEnds:function(){if(1===arguments.length){for(var t=arguments[0],e=new N,n=t;n.hasNext();){var i=n.next();this.computeEdgeEnds(i,e)}return e}if(2===arguments.length){var r=arguments[0],o=arguments[1],s=r.getEdgeIntersectionList();s.addEndpoints();var a=s.iterator(),l=null,u=null;if(!a.hasNext())return null;for(var c=a.next();l=u,u=c,c=null,a.hasNext()&&(c=a.next()),null!==u&&(this.createEdgeEndForPrev(r,o,u,l),this.createEdgeEndForNext(r,o,u,c)),null!==u;);}},interfaces_:function(){return[]},getClass:function(){return jo}}),y(Mo,ri),e(Mo.prototype,{insert:function(t){this._edgeEnds.add(t)},print:function(t){t.println("EdgeEndBundle--\x3e Label: "+this._label);for(var e=this.iterator();e.hasNext();)e.next().print(t),t.println()},iterator:function(){return this._edgeEnds.iterator()},getEdgeEnds:function(){return this._edgeEnds},computeLabelOn:function(t,e){for(var n=0,i=!1,r=this.iterator();r.hasNext();)(o=r.next().getLabel().getLocation(t))===ye.BOUNDARY&&n++,o===ye.INTERIOR&&(i=!0);var o=ye.NONE;i&&(o=ye.INTERIOR),0t.y&&(r=!0),r?this._li.computeIntersection(t,e,this._diagDown0,this._diagDown1):this._li.computeIntersection(t,e,this._diagUp0,this._diagUp1),!!this._li.hasIntersection()},interfaces_:function(){return[]},getClass:function(){return ko}}),e(Bo.prototype,{applyTo:function(t){for(var e=0;e=this._rectEnv.getMinX()&&e.getMaxX()<=this._rectEnv.getMaxX()||e.getMinY()>=this._rectEnv.getMinY()&&e.getMaxY()<=this._rectEnv.getMaxY()?(this._intersects=!0,null):void 0:null},intersects:function(){return this._intersects},interfaces_:function(){return[]},getClass:function(){return zo}}),y(Vo,Bo),e(Vo.prototype,{isDone:function(){return!0===this._containsPoint},visit:function(t){if(!(t instanceof qt))return null;var e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;for(var n=new x,i=0;i<4;i++)if(this._rectSeq.getCoordinate(i,n),e.contains(n)&&Ye.containsPointInPolygon(n,t))return this._containsPoint=!0,null},containsPoint:function(){return this._containsPoint},interfaces_:function(){return[]},getClass:function(){return Vo}}),y(Uo,Bo),e(Uo.prototype,{intersects:function(){return this._hasIntersection},isDone:function(){return!0===this._hasIntersection},visit:function(t){var e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;var n=De.getLines(t);this.checkIntersectionWithLineStrings(n)},checkIntersectionWithLineStrings:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();if(this.checkIntersectionWithSegments(n),this._hasIntersection)return null}},checkIntersectionWithSegments:function(t){for(var e=t.getCoordinateSequence(),n=1;n=t.size()?null:t.get(e)},Jo.union=function(t){return new Jo(t).union()},Jo.STRTREE_NODE_CAPACITY=4,e(Zo.prototype,{unionNoOpt:function(t){var e=this._geomFact.createPoint();return vo.overlayOp(t,e,xo.UNION)},unionWithNull:function(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)},extract:function(){if(S(arguments[0],I))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.extract(e)}else if(arguments[0]instanceof J){var n=arguments[0];null===this._geomFact&&(this._geomFact=n.getFactory()),Xo.extract(n,J.TYPENAME_POLYGON,this._polygons),Xo.extract(n,J.TYPENAME_LINESTRING,this._lines),Xo.extract(n,J.TYPENAME_POINT,this._points)}},union:function(){if(null===this._geomFact)return null;var t=null;if(0this._distanceTolerance&&(o=!1);var l=new _e;if(l.p0=this._linePts[t],l.p1=this._linePts[e],i[0]=t,i[1]=e,this.hasBadIntersection(this._line,i,l)&&(o=!1),o)return r=this.flatten(t,e),this._line.addToResult(r),null;this.simplifySection(t,a,n),this.simplifySection(a,e,n)},hasBadOutputIntersection:function(t){for(var e=this._outputIndex.query(t).iterator();e.hasNext();){var n=e.next();if(this.hasInteriorIntersection(n,t))return!0}return!1},findFurthestPoint:function(t,e,n,i){var r=new _e;r.p0=t[e],r.p1=t[n];for(var o=-1,s=e,a=e+1;a=e[0]&&i=e||this._segmentIndex===e&&1<=this._segmentFraction},isValid:function(t){if(this._componentIndex<0||this._componentIndex>=t.getNumGeometries())return!1;var e=t.getGeometryN(this._componentIndex);return!(this._segmentIndex<0||this._segmentIndex>e.getNumPoints()||this._segmentIndex===e.getNumPoints()&&0!==this._segmentFraction||this._segmentFraction<0||1=e.getNumPoints()-1)return n;var i=e.getCoordinateN(this._segmentIndex+1);return Ws.pointAlongSegmentByFraction(n,i,this._segmentFraction)},getSegmentFraction:function(){return this._segmentFraction},getSegment:function(t){var e=t.getGeometryN(this._componentIndex),n=e.getCoordinateN(this._segmentIndex);return this._segmentIndex>=e.getNumPoints()-1?new _e(e.getCoordinateN(e.getNumPoints()-2),n):new _e(n,e.getCoordinateN(this._segmentIndex+1))},clamp:function(t){if(this._componentIndex>=t.getNumGeometries())return this.setToEnd(t),null;if(this._segmentIndex>=t.getNumPoints()){var e=t.getGeometryN(this._componentIndex);this._segmentIndex=e.getNumPoints()-1,this._segmentFraction=1}},setToEnd:function(t){this._componentIndex=t.getNumGeometries()-1;var e=t.getGeometryN(this._componentIndex);this._segmentIndex=e.getNumPoints()-1,this._segmentFraction=1},compareTo:function(t){var e=t;return this._componentIndexe._componentIndex?1:this._segmentIndexe._segmentIndex?1:this._segmentFractione._segmentFraction?1:0},copy:function(){return new Ws(this._componentIndex,this._segmentIndex,this._segmentFraction)},toString:function(){return"LinearLoc["+this._componentIndex+", "+this._segmentIndex+", "+this._segmentFraction+"]"},isOnSameSegment:function(t){return this._componentIndex===t._componentIndex&&(this._segmentIndex===t._segmentIndex||t._segmentIndex-this._segmentIndex==1&&0===t._segmentFraction||this._segmentIndex-t._segmentIndex==1&&0===this._segmentFraction)},snapToVertex:function(t,e){if(this._segmentFraction<=0||1<=this._segmentFraction)return null;var n=this.getSegmentLength(t),i=this._segmentFraction*n,r=n-i;i<=r&&it?1:this._segmentIndexe?1:this._segmentFractionn?1:0},getSegmentLength:function(t){var e=t.getGeometryN(this._componentIndex),n=this._segmentIndex;this._segmentIndex>=e.getNumPoints()-1&&(n=e.getNumPoints()-2);var i=e.getCoordinateN(n),r=e.getCoordinateN(n+1);return i.distance(r)},isVertex:function(){return this._segmentFraction<=0||1<=this._segmentFraction},interfaces_:function(){return[p]},getClass:function(){return Ws}}),Ws.getEndLocation=function(t){var e=new Ws;return e.setToEnd(t),e},Ws.pointAlongSegmentByFraction=function(t,e,n){return n<=0?t:1<=n?e:new x((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y,(e.z-t.z)*n+t.z)},Ws.compareLocationValues=function(t,e,n,i,r,o){return t=this._currentLine.getNumPoints()&&(this._componentIndex++,this.loadCurrentLine(),this._vertexIndex=0)},loadCurrentLine:function(){if(this._componentIndex>=this._numLines)return this._currentLine=null;this._currentLine=this._linearGeom.getGeometryN(this._componentIndex)},getSegmentStart:function(){return this._currentLine.getCoordinateN(this._vertexIndex)},isEndOfLine:function(){return!(this._componentIndex>=this._numLines||this._vertexIndex=this._numLines||this._componentIndex===this._numLines-1&&this._vertexIndex>=this._currentLine.getNumPoints())},interfaces_:function(){return[]},getClass:function(){return Hs}}),Hs.segmentEndVertexIndex=function(t){return 0=n.length&&(o=n.length-1),t.isVertex()||i.add(t.getCoordinate(this._line));for(var s=r;s<=o;s++)i.add(n[s]);e.isVertex()||i.add(e.getCoordinate(this._line)),i.size()<=0&&i.add(t.getCoordinate(this._line));var a=i.toCoordinateArray();return a.length<=1&&(a=[a[0],a[0]]),this._line.getFactory().createLineString(a)},extract:function(t,e){return e.compareTo(t)<0?this.reverse(this.computeLinear(e,t)):this.computeLinear(t,e)},reverse:function(t){return t instanceof Bt||t instanceof wt?t.reverse():(b.shouldNeverReachHere("non-linear geometry encountered"),null)},interfaces_:function(){return[]},getClass:function(){return Ks}}),Ks.extract=function(t,e,n){return new Ks(t).extract(e,n)},e(Qs.prototype,{clampIndex:function(t){var e=t.copy();return e.clamp(this._linearGeom),e},project:function(t){return Xs.indexOf(this._linearGeom,t)},checkGeometryType:function(){if(!(this._linearGeom instanceof Bt||this._linearGeom instanceof wt))throw new i("Input geometry must be linear")},extractPoint:function(){if(1===arguments.length)return arguments[0].getCoordinate(this._linearGeom);if(2===arguments.length){var t=arguments[1],e=arguments[0].toLowest(this._linearGeom);return e.getSegment(this._linearGeom).pointAlongOffset(e.getSegmentFraction(),t)}},isValidIndex:function(t){return t.isValid(this._linearGeom)},getEndIndex:function(){return Ws.getEndLocation(this._linearGeom)},getStartIndex:function(){return new Ws},indexOfAfter:function(t,e){return Xs.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){return Ks.extract(this._linearGeom,t,e)},indexOf:function(t){return Xs.indexOf(this._linearGeom,t)},indicesOf:function(t){return Js.indicesOf(this._linearGeom,t)},interfaces_:function(){return[]},getClass:function(){return Qs}}),e($s.prototype,{indexOf:function(t){return this.indexOfFromStart(t,-1)},indexOfFromStart:function(t,e){for(var n=o.MAX_VALUE,i=e,r=0,s=new _e,a=new Hs(this._linearGeom);a.hasNext();){if(!a.isEndOfLine()){s.p0=a.getSegmentStart(),s.p1=a.getSegmentEnd();var l=s.distance(t),u=this.segmentNearestMeasure(s,t,r);l=this._linearGeom.getNumGeometries()-1)return t;for(;++e=this.getStartIndex()&&t<=this.getEndIndex()},getEndIndex:function(){return this._linearGeom.getLength()},getStartIndex:function(){return 0},indexOfAfter:function(t,e){return $s.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){new Qs(this._linearGeom);var n=this.clampIndex(t),i=this.clampIndex(e),r=n===i,o=this.locationOf(n,r),s=this.locationOf(i);return Ks.extract(this._linearGeom,o,s)},indexOf:function(t){return $s.indexOf(this._linearGeom,t)},indicesOf:function(t){var e=Js.indicesOf(this._linearGeom,t);return[ta.getLength(this._linearGeom,e[0]),ta.getLength(this._linearGeom,e[1])]},interfaces_:function(){return[]},getClass:function(){return ea}});var na=Object.freeze({LengthIndexedLine:ea,LengthLocationMap:ta,LinearGeometryBuilder:Zs,LinearIterator:Hs,LinearLocation:Ws,LocationIndexedLine:Qs});function ia(){}e(ia.prototype,{interfaces_:function(){return[]},getClass:function(){return ia}}),ia.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return xo.createEmptyResult(xo.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),vo.overlayOp(t,e,xo.UNION)},e(J.prototype,{equalsTopo:function(t){return!!this.getEnvelopeInternal().equals(t.getEnvelopeInternal())&&qo.relate(this,t).isEquals(this.getDimension(),t.getDimension())},union:function(){if(0===arguments.length)return Zo.union(this);if(1===arguments.length){var t=arguments[0];return ia.union(this,t)}},isValid:function(){return is.isValid(this)},intersection:function(t){if(this.isEmpty()||t.isEmpty())return xo.createEmptyResult(xo.INTERSECTION,this,t,this._factory);if(this.isGeometryCollection()){var e=t;return ao.map(this,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(e)}})}return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),vo.overlayOp(this,t,xo.INTERSECTION)},covers:function(t){return qo.covers(this,t)},coveredBy:function(t){return qo.covers(t,this)},touches:function(t){return qo.touches(this,t)},intersects:function(t){return qo.intersects(this,t)},within:function(t){return qo.contains(t,this)},overlaps:function(t){return qo.overlaps(this,t)},disjoint:function(t){return qo.disjoint(this,t)},crosses:function(t){return qo.crosses(this,t)},buffer:function(){if(1===arguments.length){var t=arguments[0];return Ar.bufferOp(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return Ar.bufferOp(this,e,n)}if(3===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2];return Ar.bufferOp(this,i,r,o)}},convexHull:function(){return new rn(this).getConvexHull()},relate:function(){for(var t=arguments.length,e=new Array(t),n=0;ne===t))}function d(t,e){return t.layerList.find((({id:t})=>e===t))}function p(t,e,n,i){if(!e)return t;const{layerList:r}=t,o=h(r,e);if(-1===o)return t;const s={...r[o],[n]:i},a=[...r.slice(0,o),s,...r.slice(o+1)];return{...t,layerList:a}}function f(t,e){const n=h(t,e.id);if(-1===n)return t;const i=[...t];return i[n]=e,i}function g(t,e,n,i,r,o){const s=_(t,e,n,i);return s?m(t,e,{...s,data:o,dataRequestMeta:{...s.dataRequestMetaAtStart?s.dataRequestMetaAtStart:{},...r||{},requestStopTime:Date.now()},dataRequestMetaAtStart:void 0,dataRequestToken:void 0}):t}function m(t,e,n){const i=d(t,e);if(!i)return t;const r={...i,__dataRequests:i.__dataRequests?[...i.__dataRequests]:[]},o=r.__dataRequests.findIndex((({dataId:t})=>n.dataId===t));return-1===o?r.__dataRequests.push(n):r.__dataRequests[o]=n,{...t,layerList:f(t.layerList,r)}}function _(t,e,n,i){const r=d(t,e);if(r&&r.__dataRequests)return r.__dataRequests.find((t=>i?t.dataRequestToken===i&&t.dataId===n:t.dataId===n))}const y={executionContext:{name:a.e},ready:!1,mapInitError:null,goto:null,openTooltips:[],mapState:{zoom:void 0,center:void 0,extent:void 0,mouseCoordinates:void 0,timeFilters:void 0,timeslice:void 0,query:void 0,filters:[],drawState:void 0,editState:void 0},selectedLayerId:null,layerList:[],waitingForMapReadyLayerList:[],settings:{autoFitToDataBounds:!1,backgroundColor:u.euiThemeVars.euiColorEmptyShade,customIcons:[],disableInteractive:!1,disableTooltipControl:!1,hideToolbarOverlay:!1,hideLayerControl:!1,hideViewControl:!1,initialLocation:a.S.LAST_SAVED_LOCATION,fixedLocation:{lat:0,lon:0,zoom:2},browserLocation:{zoom:2},keydownScrollZoom:!1,maxZoom:a.hb,minZoom:a.lb,showScaleControl:!1,showSpatialFilters:!0,showTimesliderToggleButton:!0,spatialFiltersAlpa:.3,spatialFiltersFillColor:"#DA8B45",spatialFiltersLineColor:"#DA8B45"},__rollbackSettings:null};function v(t=y,e){switch(e.type){case l.G:return{...t,mapState:{...t.mapState,drawState:e.drawState}};case l.H:return{...t,mapState:{...t.mapState,editState:e.editState}};case l.n:return function(t,e){const n=d(t,e);if(!n)return t;const i={...n};return delete i[c.a],{...t,layerList:f(t.layerList,i)}}(t,e.layerId);case l.E:return function(t,e){const n=d(t,e),i=Object(c.b)(n);return p(t,e,c.a,i)}(t,e.layerId);case l.p:return function(t,e){const n=d(t,e);if(!n)return t;const i=n[c.a],r={...n,...i};return delete r[c.a],{...t,layerList:f(t.layerList,r)}}(t,e.layerId);case l.A:return{...t,openTooltips:e.openTooltips};case l.z:return{...t,mapState:{...t.mapState,mouseCoordinates:{lat:e.lat,lon:e.lon}}};case l.e:return{...t,mapState:{...t.mapState,mouseCoordinates:void 0}};case l.s:return{...t,goto:{center:e.center,bounds:e.bounds}};case l.c:return{...t,goto:null};case l.y:return{...t,settings:{...t.settings,...e.settings}};case l.o:return t.__rollbackSettings?{...t,settings:{...t.__rollbackSettings},__rollbackSettings:null}:t;case l.F:return{...t,__rollbackSettings:t.settings};case l.M:return{...t,settings:{...t.settings?t.settings:{},[e.settingKey]:e.settingValue}};case l.u:const{layerList:n}=t,i=h(n,e.layerId);return-1===i?t:{...t,layerList:[...n.slice(0,i),{...n[i],__isInErrorState:e.isInErrorState,__errorMessage:e.errorMessage},...n.slice(i+1)]};case l.N:return function(t,e,n){const i=_(t,e,a.xb);return i?m(t,e,{...i,data:n}):t}(t,e.layerId,e.newData);case l.i:return function(t,e,n,i,r){if(!d(t,e))return t;const o=_(t,e,n),s=o?{...o}:{dataId:n};return s.dataRequestMetaAtStart=r,s.dataRequestToken=i,m(t,e,s)}(t,e.layerId,e.dataId,e.requestToken,e.meta);case l.h:return g(t,e.layerId,e.dataId,e.requestToken);case l.g:return g(t,e.layerId,e.dataId,e.requestToken,e.meta,e.data);case l.l:return{...t,ready:!0};case l.j:return{...t,ready:!1};case l.k:return{...t,mapState:{...t.mapState,...e.mapViewContext}};case l.B:const{query:r,timeFilters:o,timeslice:s,filters:u,searchSessionId:y,searchSessionMapBuffer:v}=e;return{...t,mapState:{...t.mapState,query:r,timeFilters:o,timeslice:s,filters:u,searchSessionId:y,searchSessionMapBuffer:v}};case l.C:const b=t.layerList.find((t=>t.id===e.selectedLayerId));return{...t,selectedLayerId:b?e.selectedLayerId:null};case l.J:return{...t,layerList:e.newLayerOrder.map((e=>t.layerList[e]))};case l.K:return p(t,e.id,e.propName,e.newValue);case l.d:return function(t,e,n){if(!e)return t;const{layerList:i}=t,r=h(i,e);if(-1===r)return t;const o={...i[r]};delete o[n];const s=[...i.slice(0,r),o,...i.slice(r+1)];return{...t,layerList:s}}(t,e.id,e.propName);case l.O:return function(t,e,n,i){const{layerList:r}=t,o=h(r,e),s={...r[o],sourceDescriptor:{...r[o].sourceDescriptor,[n]:i}},a=[...r.slice(0,o),s,...r.slice(o+1)];return{...t,layerList:a}}(t,e.layerId,e.propName,e.value);case l.t:const x=t.layerList.find((t=>t.id===e.layerId));if(x){const n={...x,joins:e.joins.slice()},i=t.layerList.findIndex((t=>t.id===e.layerId)),r=t.layerList.slice();return r[i]=n,{...t,layerList:r}}return t;case l.a:return{...t,layerList:[...t.layerList,e.layer]};case l.m:return{...t,layerList:[...t.layerList.filter((({id:t})=>t!==e.id))]};case l.I:return{...t,layerList:f(t.layerList,e.layer)};case l.b:return{...t,waitingForMapReadyLayerList:[...t.waitingForMapReadyLayerList,e.layer]};case l.f:return{...t,waitingForMapReadyLayerList:[]};case l.w:return p(t,e.layerId,"visible",e.visibility);case l.L:const E=e.layerId;return p(t,E,"style",{...e.style});case l.v:const{layerId:S,styleMeta:C}=e,I=h(t.layerList,S);return-1===I?t:p(t,S,"style",{...t.layerList[I].style,__styleMeta:C});case l.x:return{...t,mapInitError:e.errorMessage};case l.D:return{...t,waitingForMapReadyLayerList:t.waitingForMapReadyLayerList.map((t=>({...t,visible:!e.hiddenLayerIds.includes(t.id)})))};case l.q:return{...t,mapState:{...t.mapState,embeddableSearchContext:e.embeddableSearchContext}};case l.r:return{...t,executionContext:e.executionContext};default:return t}}var b=n(114);function x(){const t=[Object(i.applyMiddleware)(o.a)],e=Object(i.combineReducers)({map:v,ui:s.d,nonSerializableInstances:b.f}),n=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||i.compose;return Object(i.createStore)(e,{},n(...t))}s.b},523:function(t,e,n){"use strict";n.d(e,"a",(function(){return layer_stats_collector_LayerStatsCollector})),n.d(e,"b",(function(){return map_settings_collector_MapSettingsCollector}));var i=n(2),r=n.n(i),o=n(59),s=n(0);let a,l,u,c,h;!function(t){t.ROADMAP_DESATURATED="roadmap_desaturated",t.ROADMAP="roadmap",t.AUTO="auto",t.DARK="dark"}(a||(a={})),function(t){t.DISTANCE="distance",t.TERM="term"}(l||(l={})),function(t){t.ES_DOCS="es_docs",t.ES_TOP_HITS="es_top_hits",t.ES_TRACKS="es_tracks",t.ES_POINT_TO_POINT="es_point_to_point",t.ES_AGG_CLUSTERS="es_agg_clusters",t.ES_AGG_GRIDS="es_agg_grids",t.ES_AGG_HEXAGONS="es_agg_hexagons",t.ES_AGG_HEATMAP="es_agg_heatmap",t.ES_ML_ANOMALIES="es_ml_anomalies",t.EMS_REGION="ems_region",t.EMS_BASEMAP="ems_basemap",t.KBN_TMS_RASTER="kbn_tms_raster",t.LAYER_GROUP="layer_group",t.UX_TMS_RASTER="ux_tms_raster",t.UX_TMS_MVT="ux_tms_mvt",t.UX_WMS="ux_wms"}(u||(u={})),function(t){t.COARSE="coarse",t.FINE="fine",t.MOST_FINE="most_fine",t.SUPER_FINE="super_fine"}(c||(c={})),function(t){t.LIMIT="limit",t.MVT="mvt",t.CLUSTERS="clusters"}(h||(h={}));class layer_stats_collector_LayerStatsCollector{constructor(t){if(r()(this,"_layerCount",0),r()(this,"_basemapCounts",{}),r()(this,"_joinCounts",{}),r()(this,"_layerCounts",{}),r()(this,"_resolutionCounts",{}),r()(this,"_scalingCounts",{}),r()(this,"_emsFileCounts",{}),r()(this,"_layerTypeCounts",{}),r()(this,"_sourceIds",new Set),!t||!t.layerListJSON)return;let e=[];try{e=JSON.parse(t.layerListJSON)}catch(t){return}this._layerCount=e.length,e.forEach((t=>{var e;this._updateCounts(function(t){if(!t.sourceDescriptor||t.sourceDescriptor.type!==s.Ab.EMS_TMS)return null;const e=t.sourceDescriptor;return e.isAutoSelect?a.AUTO:e.id===o.DEFAULT_EMS_ROADMAP_ID?a.ROADMAP:e.id===o.DEFAULT_EMS_ROADMAP_DESATURATED_ID?a.ROADMAP_DESATURATED:e.id===o.DEFAULT_EMS_DARKMAP_ID?a.DARK:null}(t),this._basemapCounts);const n=null==t?void 0:t.joins;n&&n.length&&n.forEach((t=>{this._updateCounts(function(t){var e,n;return(null==t||null===(e=t.right)||void 0===e?void 0:e.type)===s.Ab.ES_TERM_SOURCE?l.TERM:(null==t||null===(n=t.right)||void 0===n?void 0:n.type)===s.Ab.ES_DISTANCE_SOURCE?l.DISTANCE:null}(t),this._joinCounts)})),this._updateCounts(function(t){if(t.type===s.Z.HEATMAP)return u.ES_AGG_HEATMAP;if(t.type===s.Z.LAYER_GROUP)return u.LAYER_GROUP;if(!t.sourceDescriptor)return null;if(t.sourceDescriptor.type===s.Ab.EMS_FILE)return u.EMS_REGION;if(t.sourceDescriptor.type===s.Ab.EMS_TMS)return u.EMS_BASEMAP;if(t.sourceDescriptor.type===s.Ab.KIBANA_TILEMAP)return u.KBN_TMS_RASTER;if(t.sourceDescriptor.type===s.Ab.EMS_XYZ)return u.UX_TMS_RASTER;if(t.sourceDescriptor.type===s.Ab.WMS)return u.UX_WMS;if(t.sourceDescriptor.type===s.Ab.MVT_SINGLE_LAYER)return u.UX_TMS_MVT;if(t.sourceDescriptor.type===s.Ab.ES_GEO_LINE)return u.ES_TRACKS;if(t.sourceDescriptor.type===s.Ab.ES_PEW_PEW)return u.ES_POINT_TO_POINT;if(t.sourceDescriptor.type===s.Ab.ES_ML_ANOMALIES)return u.ES_ML_ANOMALIES;if(t.sourceDescriptor.type===s.Ab.ES_SEARCH)return t.sourceDescriptor.scalingType===s.vb.TOP_HITS?u.ES_TOP_HITS:u.ES_DOCS;if(t.sourceDescriptor.type===s.Ab.ES_GEO_GRID){const e=t.sourceDescriptor;if(e.requestType===s.tb.POINT)return u.ES_AGG_CLUSTERS;if(e.requestType===s.tb.GRID)return u.ES_AGG_GRIDS;if(e.requestType===s.tb.HEX)return u.ES_AGG_HEXAGONS}return null}(t),this._layerCounts),this._updateCounts(function(t){if(!t.sourceDescriptor||t.sourceDescriptor.type!==s.Ab.ES_GEO_GRID||!t.sourceDescriptor.resolution)return null;const e=t.sourceDescriptor;return e.resolution===s.L.COARSE?c.COARSE:e.resolution===s.L.FINE?c.FINE:e.resolution===s.L.MOST_FINE?c.MOST_FINE:e.resolution===s.L.SUPER_FINE?c.SUPER_FINE:null}(t),this._resolutionCounts),this._updateCounts(function(t){if(!t.sourceDescriptor||t.sourceDescriptor.type!==s.Ab.ES_SEARCH||!t.sourceDescriptor.scalingType)return null;const e=t.sourceDescriptor;return e.scalingType===s.vb.CLUSTERS?h.CLUSTERS:e.scalingType===s.vb.MVT?h.MVT:e.scalingType===s.vb.LIMIT?h.LIMIT:null}(t),this._scalingCounts),this._updateCounts(function(t){return null!==t.sourceDescriptor&&t.sourceDescriptor.type===s.Ab.EMS_FILE&&"id"in t.sourceDescriptor?t.sourceDescriptor.id:null}(t),this._emsFileCounts),t.type&&this._updateCounts(t.type,this._layerTypeCounts),null!==(e=t.sourceDescriptor)&&void 0!==e&&e.id&&this._sourceIds.add(t.sourceDescriptor.id)}))}getLayerCount(){return this._layerCount}getBasemapCounts(){return this._basemapCounts}getJoinCounts(){return this._joinCounts}getLayerCounts(){return this._layerCounts}getResolutionCounts(){return this._resolutionCounts}getScalingCounts(){return this._scalingCounts}getEmsFileCounts(){return this._emsFileCounts}getLayerTypeCounts(){return this._layerTypeCounts}getSourceCount(){return this._sourceIds.size}_updateCounts(t,e){t&&(t in e?e[t]+=1:e[t]=1)}}class map_settings_collector_MapSettingsCollector{constructor(t){if(r()(this,"_customIconsCount",0),!t||!t.mapStateJSON)return;let e;try{e=JSON.parse(t.mapStateJSON).settings}catch(t){return}e&&e.customIcons&&(this._customIconsCount=e.customIcons.length)}getCustomIconsCount(){return this._customIconsCount}}},70:function(t,e,n){"use strict";n.d(e,"a",(function(){return A})),n.d(e,"y",(function(){return D})),n.d(e,"O",(function(){return k})),n.d(e,"B",(function(){return B})),n.d(e,"l",(function(){return G})),n.d(e,"x",(function(){return z})),n.d(e,"w",(function(){return V})),n.d(e,"k",(function(){return U})),n.d(e,"H",(function(){return q})),n.d(e,"r",(function(){return Y})),n.d(e,"M",(function(){return W})),n.d(e,"v",(function(){return H})),n.d(e,"s",(function(){return X})),n.d(e,"z",(function(){return J})),n.d(e,"t",(function(){return Z})),n.d(e,"A",(function(){return K})),n.d(e,"K",(function(){return Q})),n.d(e,"L",(function(){return $})),n.d(e,"b",(function(){return tt})),n.d(e,"C",(function(){return et})),n.d(e,"i",(function(){return nt})),n.d(e,"g",(function(){return it})),n.d(e,"E",(function(){return rt})),n.d(e,"F",(function(){return ot})),n.d(e,"R",(function(){return st})),n.d(e,"e",(function(){return at})),n.d(e,"f",(function(){return lt})),n.d(e,"o",(function(){return ut})),n.d(e,"d",(function(){return ct})),n.d(e,"h",(function(){return ht})),n.d(e,"c",(function(){return dt})),n.d(e,"J",(function(){return pt})),n.d(e,"p",(function(){return ft})),n.d(e,"q",(function(){return gt})),n.d(e,"n",(function(){return mt})),n.d(e,"m",(function(){return _t})),n.d(e,"G",(function(){return yt})),n.d(e,"P",(function(){return vt})),n.d(e,"u",(function(){return bt})),n.d(e,"I",(function(){return xt})),n.d(e,"D",(function(){return Et})),n.d(e,"j",(function(){return St})),n.d(e,"N",(function(){return Ct})),n.d(e,"Q",(function(){return It}));var i=n(480),r=n(39),o=n.n(r),s=n(150),a=n(230),l=n(72),u=n(82),c=n(97),h=n(122),d=n(5),p=n(114),f=n(88),g=n(2),m=n.n(g),_=n(98),y=n(0),v=n(136);class inner_join_InnerJoin{constructor(t,e){m()(this,"_descriptor",void 0),m()(this,"_rightSource",void 0),m()(this,"_leftField",void 0),this._descriptor=t,this._rightSource=function(t){if(t)return t.type===y.Ab.ES_DISTANCE_SOURCE&&Object(v.e)(t)?new v.b(t):t.type===y.Ab.ES_TERM_SOURCE&&Object(v.g)(t)?new v.c(t):t.type===y.Ab.TABLE_SOURCE?new v.d(t):void 0}(this._descriptor.right),this._leftField=t.leftField?e.createField({fieldName:t.leftField}):void 0}hasCompleteConfig(){return!(!this._leftField||!this._rightSource)&&this._rightSource.hasCompleteConfig()}getJoinFields(){return this._rightSource?this._rightSource.getRightFields():[]}getSourceDataRequestId(){return`join_source_${this._rightSource.getId()}`}getSourceMetaDataRequestId(){return`${this.getSourceDataRequestId()}_${y.kb}`}getSourceFormattersDataRequestId(){return`${this.getSourceDataRequestId()}_${y.F}`}getLeftField(){if(!this._leftField)throw new Error("Cannot get leftField from InnerJoin with incomplete config");return this._leftField}joinPropertiesToFeature(t,e){if(!t.properties||!this._leftField||!this._rightSource)return!1;const n=this._rightSource.getRightFields();for(let e=0;e{e.length>=r.length&&e.substring(0,r.length)===r&&delete t.properties[e]}))}const i=this.getJoinKey(t);return!(null===i||!e.has(i)||(Object.assign(t.properties,e.get(i)),0))}getJoinKey(t){const e=t.properties&&this._leftField?t.properties[this._leftField.getName()]:void 0;return null==e?null:e.toString()}getRightJoinSource(){if(!this._rightSource)throw new Error("Cannot get rightSource from InnerJoin with incomplete config");return this._rightSource}toDescriptor(){return this._descriptor}async getTooltipProperties(t,e){return await this.getRightJoinSource().getTooltipProperties(t,e)}getIndexPatternIds(){return this.getRightJoinSource().getIndexPatternIds()}getQueryableIndexPatternIds(){return this.getRightJoinSource().getQueryableIndexPatternIds()}getWhereQuery(){return this.getRightJoinSource().getWhereQuery()}}var b=n(27),x=n(121),E=n(231),S=n(137),C=n(298),I=n(281),O=n(112),w=n(238),L=n(282),T=n(300),N=(n(235),n(220)),j=n(304);let M=!1;M||(Object(b.b)({ConstructorFunction:x.a,type:y.Ab.EMS_FILE}),Object(b.b)({ConstructorFunction:E.a,type:y.Ab.EMS_TMS}),Object(b.b)({ConstructorFunction:S.a,type:y.Ab.ES_GEO_GRID}),Object(b.b)({ConstructorFunction:C.a,type:y.Ab.ES_GEO_LINE}),Object(b.b)({ConstructorFunction:I.a,type:y.Ab.ES_PEW_PEW}),Object(b.b)({ConstructorFunction:O.ESSearchSource,type:y.Ab.ES_SEARCH}),Object(b.b)({ConstructorFunction:w.a,type:y.Ab.GEOJSON_FILE}),Object(b.b)({ConstructorFunction:L.a,type:y.Ab.KIBANA_TILEMAP}),Object(b.b)({ConstructorFunction:T.a,type:y.Ab.MVT_SINGLE_LAYER}),Object(b.b)({ConstructorFunction:N.a,type:y.Ab.WMS}),Object(b.b)({ConstructorFunction:j.a,type:y.Ab.EMS_XYZ}),M=!0);var P=n(76),F=n(77);function R(t,e){return t.joins?t.joins.map((t=>new inner_join_InnerJoin(t,e))):[]}function A(t,e,n){if(t.type===y.Z.LAYER_GROUP)return new c.b({layerDescriptor:t});const i=function(t){if(null===t)throw new Error("Source-descriptor should be initialized");const e=Object(b.a)(t.type);if(!e)throw new Error(`Unrecognized sourceType ${t.type}`);return new e.ConstructorFunction(t)}(t.sourceDescriptor);switch(t.type){case y.Z.RASTER_TILE:return new s.a({layerDescriptor:t,source:i});case y.Z.EMS_VECTOR_TILE:return new a.a({layerDescriptor:t,source:i});case y.Z.HEATMAP:return new h.a({layerDescriptor:t,source:i});case y.Z.GEOJSON_VECTOR:return new l.b({layerDescriptor:t,source:i,joins:R(t,i),customIcons:e,chartsPaletteServiceGetColor:n});case y.Z.BLENDED_VECTOR:return new l.a({layerDescriptor:t,source:i,customIcons:e,chartsPaletteServiceGetColor:n});case y.Z.MVT_VECTOR:return new l.c({layerDescriptor:t,source:i,joins:R(t,i),customIcons:e});default:throw new Error(`Unrecognized layerType ${t.type}`)}}const D=({map:t})=>t.settings,k=Object(i.createSelector)(D,(({map:t})=>t.__rollbackSettings),((t,e)=>!!e&&!o.a.isEqual(t,e))),B=({map:t})=>t&&t.openTooltips?t.openTooltips:[],G=t=>B(t).some((({isLocked:t})=>t)),z=({map:t})=>t&&t.ready,V=({map:t})=>t.mapInitError,U=({map:t})=>t&&t.goto,q=({map:t})=>t.selectedLayerId&&t.layerList?t.selectedLayerId:null,Y=({map:t})=>t.layerList?t.layerList:[],W=({map:t})=>t.waitingForMapReadyLayerList?t.waitingForMapReadyLayerList:[],H=({map:t})=>t.mapState.extent,X=({map:t})=>t.mapState.buffer,J=({map:t})=>t.mapState.zoom?t.mapState.zoom:0,Z=({map:t})=>t.mapState.center?t.mapState.center:{lat:0,lon:0},K=({map:t})=>t.mapState.mouseCoordinates,Q=({map:t})=>t.mapState.timeFilters?t.mapState.timeFilters:Object(d.P)().getTime(),$=({map:t})=>t.mapState.timeslice,tt=({map:t})=>t.settings.customIcons,et=({map:t})=>t.mapState.query,nt=({map:t})=>t.mapState.filters,it=({map:t})=>t.mapState.embeddableSearchContext,rt=({map:t})=>t.mapState.searchSessionId,ot=({map:t})=>t.mapState.searchSessionMapBuffer,st=t=>{const e=nt(t).filter((t=>!t.meta.disabled)),n=o.a.get(et(t),"query","");return!!e.length||!!n.length},at=({map:t})=>t.mapState.drawState,lt=({map:t})=>t.mapState.editState;function ut(t,e){return Y(t).find((t=>t.id===e))}function ct(t,e,n){const i=ut(t,e);if(i&&i.__dataRequests)return i.__dataRequests.find((t=>t.dataId===n))}function ht(t){return t.map.executionContext}const dt=Object(i.createSelector)(H,X,J,Q,$,et,nt,it,rt,ot,F.g,ht,((t,e,n,i,r,o,s,a,l,u,c,h)=>({extent:t,buffer:l&&u?u:e,zoom:n,timeFilters:i,timeslice:r,query:o,filters:s,embeddableSearchContext:a,searchSessionId:l,isReadOnly:c,executionContext:h}))),pt=Object(i.createSelector)(nt,it,D,((t,e,n)=>{var i;const r={type:"FeatureCollection",features:Object(P.i)([...t,...null!==(i=null==e?void 0:e.filters)&&void 0!==i?i:[]])},o=w.a.createDescriptor({__featureCollection:r,name:"spatialFilters"});return new l.b({layerDescriptor:l.b.createDescriptor({id:y.Bb,visible:n.showSpatialFilters,alpha:n.spatialFiltersAlpa,__dataRequests:[{dataId:y.xb,data:r}],style:u.a.createDescriptor({[y.Gb.FILL_COLOR]:{type:y.Cb.STATIC,options:{color:n.spatialFiltersFillColor}},[y.Gb.LINE_COLOR]:{type:y.Cb.STATIC,options:{color:n.spatialFiltersLineColor}}})}),source:new w.a(o),customIcons:[]})})),ft=Object(i.createSelector)(Y,p.b,tt,((t,e,n)=>{const i=t.map((t=>A(t,n,e))),r=new Map;return i.forEach((t=>{const e=t.getParent();if(!e)return;const n=r.has(e)?r.get(e):[];r.set(e,[...n,t])})),r.forEach(((t,e)=>{const n=i.find((t=>t.getId()===e));n&&Object(c.c)(n)&&n.setChildren(t)})),i})),gt=Object(i.createSelector)(Y,(t=>Object(f.b)(t)));function mt(t,e){return ft(e).find((e=>t===e.getId()))}const _t=Object(i.createSelector)(Y,(t=>t.filter((t=>!t.visible)).map((t=>t.id)))),yt=Object(i.createSelector)(q,ft,((t,e)=>e.find((e=>e.getId()===t)))),vt=Object(i.createSelector)(ft,(t=>t.some((t=>t.isPreviewLayer())))),bt=Object(i.createSelector)(Y,(t=>t.filter((t=>!t.__isPreviewLayer)).reduce(((t,e)=>{const n=o.a.get(e,"style.properties.fillColor.options.color");return n&&t.push(n),t}),[]))),xt=Object(i.createSelector)(yt,(t=>t&&"getJoins"in t?t.getJoins().map((t=>t.toDescriptor())):[])),Et=Object(i.createSelector)(ft,W,((t,e)=>{const n=[];return e.length?e.forEach((t=>{const e=A(t,[]);e.isVisible()&&n.push(...e.getQueryableIndexPatternIds())})):t.forEach((t=>{t.isVisible()&&n.push(...t.getQueryableIndexPatternIds())})),o.a.uniq(n)})),St=Object(i.createSelector)(ft,W,((t,e)=>{const n=[];return e.length?e.forEach((t=>{const e=A(t,[]);n.push(...e.getGeoFieldNames())})):t.forEach((t=>{n.push(...t.getGeoFieldNames())})),o.a.uniq(n)})),Ct=Object(i.createSelector)(Y,(t=>t.some((t=>{if(t.__isPreviewLayer)return!0;const e=t[f.a];if(!e)return!1;const n=Object(f.b)(t);return!o.a.isEqual(n,e)})))),It=Object(i.createSelector)(ft,W,J,((t,e,n)=>{if(e.length)return!0;for(let e=0;e{e({type:o.A,openTooltips:Object(c.B)(n()).filter((({id:e})=>t!==e))})}}function d(t){return(e,n)=>{const i=Object(c.B)(n()).filter((({features:e,location:n,isLocked:i})=>i&&!u.a.isEqual(n,t.location)&&!u.a.isEqual(e.map((({id:t,layerId:e})=>({id:t,layerId:e}))),t.features.map((({id:t,layerId:e})=>({id:t,layerId:e}))))));i.push(t),e({type:o.A,openTooltips:i})}}function p(){return(t,e)=>{Object(c.B)(e()).length&&t({type:o.A,openTooltips:[]})}}function f(t){return{type:o.A,openTooltips:[t]}}function g(t){return{type:o.A,openTooltips:t}}n(166)},77:function(t,e,n){"use strict";n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return r})),n.d(e,"f",(function(){return o})),n.d(e,"h",(function(){return s})),n.d(e,"i",(function(){return a})),n.d(e,"e",(function(){return l})),n.d(e,"g",(function(){return u})),n.d(e,"a",(function(){return c})),n.d(e,"b",(function(){return h}));const i=({ui:t})=>t.flyoutDisplay,r=({ui:t})=>t.drawMode,o=({ui:t})=>t.isLayerTOCOpen,s=({ui:t})=>t.isTimesliderOpen,a=({ui:t})=>t.openTOCDetails,l=({ui:t})=>t.isFullScreen,u=({ui:t})=>t.isReadOnly,c=({ui:t})=>t.autoOpenLayerWizardId,h=({ui:t})=>t.deletedFeatureIds},90:function(t,e,n){"use strict";n.d(e,"c",(function(){return s})),n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return l})),n.d(e,"d",(function(){return u}));var i=n(5),r=n(73),o=n(0);let s;!function(t){t.NONE="NONE",t.LAYER_PANEL="LAYER_PANEL",t.ADD_LAYER_WIZARD="ADD_LAYER_WIZARD",t.MAP_SETTINGS_PANEL="MAP_SETTINGS_PANEL"}(s||(s={}));const a=!0,l={flyoutDisplay:s.NONE,drawMode:o.x.NONE,isFullScreen:!1,isReadOnly:!Object(i.z)().save,isLayerTOCOpen:a,isTimesliderOpen:!1,openTOCDetails:[],autoOpenLayerWizardId:"",deletedFeatureIds:[]};function u(t=l,e){switch(e.type){case r.l:return{...t,flyoutDisplay:e.display};case r.e:return{...t,drawMode:e.drawMode};case r.g:return{...t,isLayerTOCOpen:e.isLayerTOCOpen};case r.h:return{...t,isTimesliderOpen:e.isTimesliderOpen};case r.f:return{...t,isFullScreen:e.isFullScreen};case r.j:return{...t,isReadOnly:e.isReadOnly};case r.i:return{...t,openTOCDetails:e.layerIds};case r.k:return{...t,openTOCDetails:[...t.openTOCDetails,e.layerId]};case r.b:return{...t,openTOCDetails:t.openTOCDetails.filter((t=>t!==e.layerId))};case r.d:return{...t,autoOpenLayerWizardId:e.autoOpenLayerWizardId};case r.c:return{...t,deletedFeatureIds:[...t.deletedFeatureIds,e.featureId]};case r.a:return{...t,deletedFeatureIds:[]};default:return t}}},96:function(t,e,n){t.exports=n(22)(2964)}}]);