Socket
Socket
Sign inDemoInstall

@nextgis/webmap

Package Overview
Dependencies
Maintainers
3
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/webmap - npm Package Compare versions

Comparing version 1.12.0 to 1.12.1

15

lib/index.d.ts

@@ -589,2 +589,17 @@ /**

moveend: MapAdapter;
/**
* Fired while the mouse moves over the map.
* @eventProperty
*/
mousemove: MapAdapter;
/**
* Fired when the mouse leaves the map.
* @eventProperty
*/
mouseout: MapAdapter;
/**
* Fired when the mouse enters the map.
* @eventProperty
*/
mouseover: MapAdapter;
}

@@ -591,0 +606,0 @@

2

lib/webmap.cjs.prod.js

@@ -15,3 +15,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@nextgis/utils"),e=require("@nextgis/paint"),r=require("@nextgis/properties-filter"),n=require("events");function o(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var i=o(require("@nextgis/cancelable-promise")),s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var u=function(){return(u=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function p(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(e){i(e)}}function a(t){try{u(n.throw(t))}catch(e){i(e)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function c(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(a){i=[6,a],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function l(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=l(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function h(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var o in r){r[o]>((void 0!==e?r[e]:0)||0)&&(e=o)}return e}function y(t){var e;if("FeatureCollection"===t.type)e=h(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=h(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var f={polygon:"path",line:"path",point:"circle"},m={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function v(t){if(t.data){var r=m[y(t.data)],n=t.paint;n&&e.isPaint(n)&&(n.type=n.type?n.type:"polygon"===r||"line"===r?"path":"html"in n||"className"in n?"icon":f[r]),t.type=t.type||r}return t}var g=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},L=function(){function t(){this.keyCodeAlias=new g,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),_=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),b=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return a(e,t),e.prototype.getValue=function(){return this.webMap.getCenter()},e.prototype.setValue=function(t){this.webMap.setCenter(t)},e.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},e.prototype.parse=function(t){return t.split("_").map(Number)},e}(_),w=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return a(e,t),e.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},e.prototype.setValue=function(t){this.webMap.setZoom(t)},e.prototype.toString=function(t){return String(t)},e.prototype.parse=function(t){return Number(t)},e}(_);var C=0,A={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},P=function(){function e(r){this.options=A,this.emitter=new n.EventEmitter,this.keys=e.keys,this.runtimeParams=[],this.getPaintFunctions=e.getPaintFunctions,this.mapState=[b,w],this.id=C++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=r.mapAdapter,this._starterKits=r.starterKits||[],r&&(this.options=t.deepmerge(A||{},r)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return e.prototype.getId=function(){return this.id},e.prototype.create=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},e.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},e.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},e.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},e.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,o=t.runtimeParams;n<o.length;n++){var i=o[n].get(r.name);if(void 0!==i){e[r.name]=r.parse(i);break}}})),e},e.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},e.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},e.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},e.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},e.prototype.getCenter=function(){return this.mapAdapter.getCenter()},e.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},e.prototype.getBoundsPolygon=function(){var e=this.getBounds();if(e)return t.getBoundsFeature(e)},e.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},e.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},e.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},e.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},e.prototype.setView=function(e,r){if(Array.isArray(e)){var n=e;this.mapAdapter.setView&&n&&t.defined(r)?this.mapAdapter.setView(n,r):(n&&this.mapAdapter.setCenter(n),t.defined(r)&&this.mapAdapter.setZoom(r))}else{this.mapAdapter.setView&&this.mapAdapter.setView(e)}},e.prototype.fitBounds=function(e,r){return e.every((function(e){return t.defined(e)}))&&(e[1]<-85.06&&(e[1]=-85.06),e[3]>85.06&&(e[3]=85.06),this.mapAdapter.fitBounds(e,r)),this},e.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},e.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},e.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,o=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},i=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&i?o():e.mapAdapter.emitter.once("create",(function(){o()}))}))},e.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},e.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},e.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},e.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},e.prototype.getCoordFromMapClick=function(){var e=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new i((function(r,n,o){var i=e.getCursor()||"grab";e._removeEventListeners({include:["click"]}),e.setCursor("crosshair");var s=function(){e.setCursor(i),e._addEventsListeners({include:["click"]}),e.mapAdapter.emitter.off("click",a),e._coordFromMapClickPromise=void 0},a=function(e){s(),t.deprecatedMapClick(e),r(e.lngLat)};e.mapAdapter.emitter.once("click",a),o(s)})),this._coordFromMapClickPromise)},e.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},e.prototype._addLayerProviders=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){return[2]}))}))},e.prototype._onLoadSync=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){return[2]}))}))},e.prototype._setupMap=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},e.prototype._setTileJsonOptions=function(e){e.center&&(this.options.center=e.center),e.bounds&&(this.options.bounds=e.bounds),t.defined(e.maxzoom)&&(this.options.maxZoom=e.maxzoom,this.options.zoom=e.maxzoom),t.defined(e.minzoom)&&(this.options.minZoom=e.minzoom,this.options.zoom=e.minzoom),t.defined(e.maxzoom)&&t.defined(e.minzoom)&&(this.options.zoom=(e.maxzoom+e.minzoom)/2)},e.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},e.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var o=0,i=this.runtimeParams;o<i.length;o++){var s=i[o].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},e.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var o=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,o)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},e.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},e.keys=new L,e}(),k=function(n){function o(t){var e=n.call(this,t)||this;e._layersIdCounter=1,e._layersOrderCounter=1,e._baselayers=[],e._layers={},e._selectedLayers=[];var r=e.options.tileJson;return r&&e.emitter.once("build-map",(function(){return e.addTileJsonLayer(r)})),e}return a(o,n),o.prototype.fitLayer=function(t,e){return p(this,void 0,void 0,(function(){var r,n,o;return c(this,(function(i){switch(i.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(o=i.sent())&&this.fitBounds(o,e),i.label=2;case 2:return[2]}}))}))},o.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},o.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},o.prototype.getBaseLayersIds=function(){return this._baselayers},o.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},o.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},o.prototype.getLayers=function(){return Object.keys(this._layers)},o.prototype.allLayers=function(){return this._layers},o.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},o.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},o.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},o.prototype.addBaseLayer=function(t,e){return p(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return[4,this.addLayer(t,u(u({},e),{baselayer:!0}),void 0)];case 1:return[2,r.sent()]}}))}))},o.prototype.addLayer=function(e,r,n){var o,i;return void 0===r&&(r={}),p(this,void 0,void 0,(function(){var s,a,p,l,d,h,y,f,m,v,g,L;return c(this,(function(c){switch(c.label){case 0:return s=this._layersIdCounter++,a=t.defined(n)?n:void 0!==r.order?r.order:this.reserveOrder(),"string"!=typeof e?[3,1]:(p=this.getLayerAdapter(e),[3,4]);case 1:return"function"!=typeof e?[3,2]:(p=e,[3,4]);case 2:return"then"in e?[4,e]:[3,4];case 3:p=c.sent(),c.label=4;case 4:return this._updateGeoJsonOptions(l=r),r=u({id:String(s),order:a},r),d=null===(o=r.visibility)||void 0===o||o,r.visibility=!1,r.baselayer&&(r.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:r,adapter:p}))&&(h.options&&(r=h.options),h.adapter&&(p=h.adapter)),void 0===p?[3,12]:((y=new p(this.mapAdapter.map,r)).options=u(u({},r),y.options),y.options.baselayer&&(r.baselayer=!0,r.order=0,y.options.order=0),f=void 0,y.options.id&&(f=String(y.options.id),this._layers[f]=y),this._emitLayerEvent("layer:preadd",f||"",y),[4,this.onMapLoad()]);case 5:return c.sent(),y.map=this.mapAdapter.map,[4,y.addLayer(y.options)];case 6:if(m=c.sent(),y.layer=m,y.id=y.options.id||String(s),y.options.id=y.id,r.baselayer&&(y.options.order=0),y.order=null!==(i=y.options.order)&&void 0!==i?i:a,f&&delete this._layers[f],f=String(y.id),this._layers[f])throw Error("layer with id '".concat(f,"' already exist"));return f?(this._layers[f]=y,l.filter&&this.filterLayer(y,l.filter),r.baselayer&&this._baselayers.push(f),d?[4,this.showLayer(f)]:[3,8]):[3,8];case 7:c.sent(),c.label=8;case 8:return void 0!==(v=r.opacity)&&v<=1&&this.setLayerOpacity(y,v),g=m&&(y.getBounds||y.getExtent),r.fit&&g?[4,g.call(y)]:[3,11];case 9:return(L=c.sent())?[4,this.fitBounds(L)]:[3,11];case 10:c.sent(),c.label=11;case 11:return r.onAdded&&r.onAdded(y),this._emitLayerEvent("layer:add",f,y),[2,y];case 12:return[2,Promise.reject("No adapter")]}}))}))},o.prototype.addLayerFromAsyncAdapter=function(t,e,r){return p(this,void 0,void 0,(function(){var n,o;return c(this,(function(i){switch(i.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(o=i.sent())?[2,this.addLayer(o,e,n)]:[2,Promise.reject("No adapter")]}}))}))},o.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},o.prototype.reserveOrder=function(){return this._layersOrderCounter++},o.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},o.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},o.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=v(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},o.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},o.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",u(u({},e),{url:t}))},o.prototype.addImageLayer=function(t,e){var r;return"string"==typeof t?r=t:(r=t.url,e=t),this.addLayer("IMAGE",u(u({},e),{url:r}))},o.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},o.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},o.prototype.toggleLayer=function(t,e,r){var n=this;void 0===r&&(r={});var o=this.getLayer(t),i=void 0!==e?e:!(o&&o.options.visibility),s=void 0!==r.silent&&r.silent;return o&&o.options.visibility!==i?this.onMapLoad().then((function(){return t=o,p(n,void 0,void 0,(function(){var e,r,n,o,a,u,p,l=this;return c(this,(function(c){switch(c.label){case 0:if(e=String(t.id),r=i?"layer:preshow":"layer:prehide",n=i?"layer:show":"layer:hide",s||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!i||!this.mapAdapter)return[3,9];if(o=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];a=this._baselayers.filter((function(e){return e!==t.id&&l.isLayerVisible(e)})),u=0,p=a,c.label=1;case 1:return u<p.length?[4,this.hideLayer(p[u])]:[3,4];case 2:c.sent(),c.label=3;case 3:return u++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return c.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:c.sent(),c.label=8;case 8:return void 0!==o&&this.mapAdapter.setLayerOrder(t.layer,o,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return c.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:c.sent(),c.label=13;case 13:return t.options.visibility=i,s||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},o.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},o.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},o.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},o.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var o=this.getLayerId(r);if(o){var i=this._selectedLayers.indexOf(o);-1!==i&&this._selectedLayers.splice(i,1)}}},o.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},o.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},o.prototype.propertiesFilter=function(t,e,n){var o=this.getLayer(t);if(o){var i=o;i.propertiesFilter?i.propertiesFilter(e,n):i.filter&&this.filterLayer(i,(function(t){return!t.feature||!t.feature.properties||r.propertiesFilter(t.feature.properties,e)}))}},o.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},o.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},o.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},o.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},o.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},o.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},o.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},o.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},o.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],o=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(o&&t.onlyBaselayer&&(o=this._baselayers.includes(r)),o){var i=n.options&&n.options.attribution;i&&e.push(i)}}return e},o.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},o.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},o.prototype._emitLayerEvent=function(e,r,n){var o=String(e);if(t.defined(r)&&o.startsWith("layer:")){var i=o.replace("layer:","layer-"+r+":");this.emitter.emit(i,n)}this.emitter.emit(e,n)},o.prototype._onLayerClick=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},o.prototype._onLayerSelect=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},o.prototype._updateGeoJsonOptions=function(r){var n=this,o=r.onSelect,i=r.onLayerSelect,s=r.onMouseOut,a=r.onMouseOver,u=r.onClick||r.onLayerClick;r.onClick=function(t){return u&&u(t),n._onLayerClick(t)},r.onMouseOut=function(e){var r=e.layer.id;s&&s(e),t.defined(r)&&n._emitLayerEvent("layer:mouseout",r,e)},r.onMouseOver=function(e){var r=e.layer.id;a&&a(e),t.defined(r)&&n._emitLayerEvent("layer:mouseover",r,e)};var p=o||i;r.onSelect=function(t){return p&&p(t),n._onLayerSelect(t)},r.nativePaint||(this.options.paint&&(r.paint=e.preparePaint(r.paint||{},this.options.paint,this.getPaintFunctions)),r.selectedPaint&&this.options.selectedPaint&&(r.selectedPaint=e.preparePaint(r.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},o}(P);function O(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var o=e.title||"",i=e.html;function s(){o&&(r.title="string"==typeof o?o:n?o.on:o.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){i&&("string"==typeof i||i instanceof HTMLElement?a(i):a(n?i.on:i.off),r.setAttribute("aria-label",r.title))}function p(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function c(){e.addClassOn&&p(e.addClassOn,n),e.addClassOff&&p(e.addClassOff,!n)}s(),u(),e.addClass&&p(e.addClass,!0),c();var l=function(t){void 0!==t&&(n=t),u(),s(),c()},d=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},h=t({html:r,onClick:d});return h.onClick=d,h.changeStatus=l,h}var S=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return a(e,t),e.prototype.addControl=function(t,e,r){return p(this,void 0,void 0,(function(){var n,o=this;return c(this,(function(i){return e=null!=e?e:"top-left",(n="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){o._setControlQueue(e,(function(){return p(o,void 0,void 0,(function(){var r,o;return c(this,(function(i){switch(i.label){case 0:return[4,n];case 1:return r=i.sent(),o=this.mapAdapter.addControl(r,e),t(o),[2]}}))}))}))}))]:[2]}))}))},e.prototype.createControl=function(t,e){return p(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},e.prototype.createButtonControl=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},e.prototype.createToggleControl=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,O(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},e.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},e.prototype.getControl=function(t,r){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(r);var o=e.controls[t];return o?o(this,r):void 0},e.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},e.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},e.prototype._applyControls=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},e.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},e}(k),E={};function x(t){return E[t]}var M=function(t){function e(e){var r=t.call(this,e)||this;return r._addControls(),E[r.id]=r,r}return a(e,t),e.get=function(t){return x(t)},e.prototype._addLayerProviders=function(){var t,e,r,n;return p(this,void 0,void 0,(function(){var o,i,s,a,u,p,l,h,y,f;return c(this,(function(c){switch(c.label){case 0:c.trys.push([0,18,19,24]),o=d(this._starterKits),c.label=1;case 1:return[4,o.next()];case 2:return(i=c.sent()).done?[3,17]:(s=i.value).getLayerAdapters?[4,s.getLayerAdapters.call(s)]:[3,16];case 3:if(!(a=c.sent()))return[3,16];c.label=4;case 4:c.trys.push([4,10,11,16]),r=void 0,u=d(a),c.label=5;case 5:return[4,u.next()];case 6:return(p=c.sent()).done?[3,9]:[4,(l=p.value).createAdapter(this)];case 7:(h=c.sent())&&(this.mapAdapter.layerAdapters[l.name]=h),c.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return y=c.sent(),r={error:y},[3,16];case 11:return c.trys.push([11,,14,15]),p&&!p.done&&(n=u.return)?[4,n.call(u)]:[3,13];case 12:c.sent(),c.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return f=c.sent(),t={error:f},[3,24];case 19:return c.trys.push([19,,22,23]),i&&!i.done&&(e=o.return)?[4,e.call(o)]:[3,21];case 20:c.sent(),c.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},e.prototype._onLoadSync=function(){var t,e;return p(this,void 0,void 0,(function(){var r,n,o,i,s;return c(this,(function(a){switch(a.label){case 0:a.trys.push([0,8,9,14]),r=d(this._starterKits),a.label=1;case 1:return[4,r.next()];case 2:if((n=a.sent()).done)return[3,7];if(!(o=n.value).onLoadSync)return[3,6];a.label=3;case 3:return a.trys.push([3,5,,6]),[4,o.onLoadSync.call(o,this)];case 4:return a.sent(),[3,6];case 5:return i=a.sent(),console.error(i),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return s=a.sent(),t={error:s},[3,14];case 9:return a.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:a.sent(),a.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},e.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var o=n.position,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["position"]);t.addControl(r,o||"top-left",i)})),this._emitStatusEvent("controls:create")},e}(S);exports.WebMap=M,exports.WebMapControls=S,exports.WebMapLayers=k,exports.WebMapMain=P,exports.createToggleControl=O,exports.createWebMap=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new M(t).onLoad()]}))}))},exports.detectGeometryType=y,exports.findMostFrequentGeomType=h,exports.getWebMap=x,exports.updateGeoJsonAdapterOptions=v;
***************************************************************************** */function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var u=function(){return(u=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function p(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(e){i(e)}}function a(t){try{u(n.throw(t))}catch(e){i(e)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function c(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(a){i=[6,a],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function l(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=l(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function h(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var o in r){r[o]>((void 0!==e?r[e]:0)||0)&&(e=o)}return e}function y(t){var e;if("FeatureCollection"===t.type)e=h(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=h(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var f={polygon:"path",line:"path",point:"circle"},m={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function v(t){if(t.data){var r=m[y(t.data)],n=t.paint;n&&e.isPaint(n)&&(n.type=n.type?n.type:"polygon"===r||"line"===r?"path":"html"in n||"className"in n?"icon":f[r]),t.type=t.type||r}return t}var g=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},L=function(){function t(){this.keyCodeAlias=new g,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),_=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),b=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return a(e,t),e.prototype.getValue=function(){return this.webMap.getCenter()},e.prototype.setValue=function(t){this.webMap.setCenter(t)},e.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},e.prototype.parse=function(t){return t.split("_").map(Number)},e}(_),w=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return a(e,t),e.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},e.prototype.setValue=function(t){this.webMap.setZoom(t)},e.prototype.toString=function(t){return String(t)},e.prototype.parse=function(t){return Number(t)},e}(_);var C=0,A={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},P=function(){function e(r){this.options=A,this.emitter=new n.EventEmitter,this.keys=e.keys,this.runtimeParams=[],this.getPaintFunctions=e.getPaintFunctions,this.mapState=[b,w],this.id=C++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=r.mapAdapter,this._starterKits=r.starterKits||[],r&&(this.options=t.deepmerge(A||{},r)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return e.prototype.getId=function(){return this.id},e.prototype.create=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},e.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},e.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},e.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},e.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,o=t.runtimeParams;n<o.length;n++){var i=o[n].get(r.name);if(void 0!==i){e[r.name]=r.parse(i);break}}})),e},e.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},e.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},e.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},e.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},e.prototype.getCenter=function(){return this.mapAdapter.getCenter()},e.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},e.prototype.getBoundsPolygon=function(){var e=this.getBounds();if(e)return t.getBoundsFeature(e)},e.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},e.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},e.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},e.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},e.prototype.setView=function(e,r){if(Array.isArray(e)){var n=e;this.mapAdapter.setView&&n&&t.defined(r)?this.mapAdapter.setView(n,r):(n&&this.mapAdapter.setCenter(n),t.defined(r)&&this.mapAdapter.setZoom(r))}else{this.mapAdapter.setView&&this.mapAdapter.setView(e)}},e.prototype.fitBounds=function(e,r){return e.every((function(e){return t.defined(e)}))&&(e[1]<-85.06&&(e[1]=-85.06),e[3]>85.06&&(e[3]=85.06),this.mapAdapter.fitBounds(e,r)),this},e.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},e.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},e.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,o=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},i=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&i?o():e.mapAdapter.emitter.once("create",(function(){o()}))}))},e.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},e.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},e.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},e.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},e.prototype.getCoordFromMapClick=function(){var e=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new i((function(r,n,o){var i=e.getCursor()||"grab";e._removeEventListeners({include:["click"]}),e.setCursor("crosshair");var s=function(){e.setCursor(i),e._addEventsListeners({include:["click"]}),e.mapAdapter.emitter.off("click",a),e._coordFromMapClickPromise=void 0},a=function(e){s(),t.deprecatedMapClick(e),r(e.lngLat)};e.mapAdapter.emitter.once("click",a),o(s)})),this._coordFromMapClickPromise)},e.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},e.prototype._addLayerProviders=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){return[2]}))}))},e.prototype._onLoadSync=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){return[2]}))}))},e.prototype._setupMap=function(){return p(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},e.prototype._setTileJsonOptions=function(e){e.center&&(this.options.center=e.center),e.bounds&&(this.options.bounds=e.bounds),t.defined(e.maxzoom)&&(this.options.maxZoom=e.maxzoom,this.options.zoom=e.maxzoom),t.defined(e.minzoom)&&(this.options.minZoom=e.minzoom,this.options.zoom=e.minzoom),t.defined(e.maxzoom)&&t.defined(e.minzoom)&&(this.options.zoom=(e.maxzoom+e.minzoom)/2)},e.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},e.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var o=0,i=this.runtimeParams;o<i.length;o++){var s=i[o].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},e.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend","mousemove","mouseout","mouseover"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var o=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,o)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},e.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},e.keys=new L,e}(),k=function(n){function o(t){var e=n.call(this,t)||this;e._layersIdCounter=1,e._layersOrderCounter=1,e._baselayers=[],e._layers={},e._selectedLayers=[];var r=e.options.tileJson;return r&&e.emitter.once("build-map",(function(){return e.addTileJsonLayer(r)})),e}return a(o,n),o.prototype.fitLayer=function(t,e){return p(this,void 0,void 0,(function(){var r,n,o;return c(this,(function(i){switch(i.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(o=i.sent())&&this.fitBounds(o,e),i.label=2;case 2:return[2]}}))}))},o.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},o.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},o.prototype.getBaseLayersIds=function(){return this._baselayers},o.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},o.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},o.prototype.getLayers=function(){return Object.keys(this._layers)},o.prototype.allLayers=function(){return this._layers},o.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},o.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},o.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},o.prototype.addBaseLayer=function(t,e){return p(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return[4,this.addLayer(t,u(u({},e),{baselayer:!0}),void 0)];case 1:return[2,r.sent()]}}))}))},o.prototype.addLayer=function(e,r,n){var o,i;return void 0===r&&(r={}),p(this,void 0,void 0,(function(){var s,a,p,l,d,h,y,f,m,v,g,L;return c(this,(function(c){switch(c.label){case 0:return s=this._layersIdCounter++,a=t.defined(n)?n:void 0!==r.order?r.order:this.reserveOrder(),"string"!=typeof e?[3,1]:(p=this.getLayerAdapter(e),[3,4]);case 1:return"function"!=typeof e?[3,2]:(p=e,[3,4]);case 2:return"then"in e?[4,e]:[3,4];case 3:p=c.sent(),c.label=4;case 4:return this._updateGeoJsonOptions(l=r),r=u({id:String(s),order:a},r),d=null===(o=r.visibility)||void 0===o||o,r.visibility=!1,r.baselayer&&(r.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:r,adapter:p}))&&(h.options&&(r=h.options),h.adapter&&(p=h.adapter)),void 0===p?[3,12]:((y=new p(this.mapAdapter.map,r)).options=u(u({},r),y.options),y.options.baselayer&&(r.baselayer=!0,r.order=0,y.options.order=0),f=void 0,y.options.id&&(f=String(y.options.id),this._layers[f]=y),this._emitLayerEvent("layer:preadd",f||"",y),[4,this.onMapLoad()]);case 5:return c.sent(),y.map=this.mapAdapter.map,[4,y.addLayer(y.options)];case 6:if(m=c.sent(),y.layer=m,y.id=y.options.id||String(s),y.options.id=y.id,r.baselayer&&(y.options.order=0),y.order=null!==(i=y.options.order)&&void 0!==i?i:a,f&&delete this._layers[f],f=String(y.id),this._layers[f])throw Error("layer with id '".concat(f,"' already exist"));return f?(this._layers[f]=y,l.filter&&this.filterLayer(y,l.filter),r.baselayer&&this._baselayers.push(f),d?[4,this.showLayer(f)]:[3,8]):[3,8];case 7:c.sent(),c.label=8;case 8:return void 0!==(v=r.opacity)&&v<=1&&this.setLayerOpacity(y,v),g=m&&(y.getBounds||y.getExtent),r.fit&&g?[4,g.call(y)]:[3,11];case 9:return(L=c.sent())?[4,this.fitBounds(L)]:[3,11];case 10:c.sent(),c.label=11;case 11:return r.onAdded&&r.onAdded(y),this._emitLayerEvent("layer:add",f,y),[2,y];case 12:return[2,Promise.reject("No adapter")]}}))}))},o.prototype.addLayerFromAsyncAdapter=function(t,e,r){return p(this,void 0,void 0,(function(){var n,o;return c(this,(function(i){switch(i.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(o=i.sent())?[2,this.addLayer(o,e,n)]:[2,Promise.reject("No adapter")]}}))}))},o.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},o.prototype.reserveOrder=function(){return this._layersOrderCounter++},o.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},o.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},o.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=v(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},o.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},o.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",u(u({},e),{url:t}))},o.prototype.addImageLayer=function(t,e){var r;return"string"==typeof t?r=t:(r=t.url,e=t),this.addLayer("IMAGE",u(u({},e),{url:r}))},o.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},o.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},o.prototype.toggleLayer=function(t,e,r){var n=this;void 0===r&&(r={});var o=this.getLayer(t),i=void 0!==e?e:!(o&&o.options.visibility),s=void 0!==r.silent&&r.silent;return o&&o.options.visibility!==i?this.onMapLoad().then((function(){return t=o,p(n,void 0,void 0,(function(){var e,r,n,o,a,u,p,l=this;return c(this,(function(c){switch(c.label){case 0:if(e=String(t.id),r=i?"layer:preshow":"layer:prehide",n=i?"layer:show":"layer:hide",s||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!i||!this.mapAdapter)return[3,9];if(o=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];a=this._baselayers.filter((function(e){return e!==t.id&&l.isLayerVisible(e)})),u=0,p=a,c.label=1;case 1:return u<p.length?[4,this.hideLayer(p[u])]:[3,4];case 2:c.sent(),c.label=3;case 3:return u++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return c.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:c.sent(),c.label=8;case 8:return void 0!==o&&this.mapAdapter.setLayerOrder(t.layer,o,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return c.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:c.sent(),c.label=13;case 13:return t.options.visibility=i,s||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},o.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},o.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},o.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},o.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var o=this.getLayerId(r);if(o){var i=this._selectedLayers.indexOf(o);-1!==i&&this._selectedLayers.splice(i,1)}}},o.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},o.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},o.prototype.propertiesFilter=function(t,e,n){var o=this.getLayer(t);if(o){var i=o;i.propertiesFilter?i.propertiesFilter(e,n):i.filter&&this.filterLayer(i,(function(t){return!t.feature||!t.feature.properties||r.propertiesFilter(t.feature.properties,e)}))}},o.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},o.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},o.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},o.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},o.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},o.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},o.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},o.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},o.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],o=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(o&&t.onlyBaselayer&&(o=this._baselayers.includes(r)),o){var i=n.options&&n.options.attribution;i&&e.push(i)}}return e},o.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},o.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},o.prototype._emitLayerEvent=function(e,r,n){var o=String(e);if(t.defined(r)&&o.startsWith("layer:")){var i=o.replace("layer:","layer-"+r+":");this.emitter.emit(i,n)}this.emitter.emit(e,n)},o.prototype._onLayerClick=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},o.prototype._onLayerSelect=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},o.prototype._updateGeoJsonOptions=function(r){var n=this,o=r.onSelect,i=r.onLayerSelect,s=r.onMouseOut,a=r.onMouseOver,u=r.onClick||r.onLayerClick;r.onClick=function(t){return u&&u(t),n._onLayerClick(t)},r.onMouseOut=function(e){var r=e.layer.id;s&&s(e),t.defined(r)&&n._emitLayerEvent("layer:mouseout",r,e)},r.onMouseOver=function(e){var r=e.layer.id;a&&a(e),t.defined(r)&&n._emitLayerEvent("layer:mouseover",r,e)};var p=o||i;r.onSelect=function(t){return p&&p(t),n._onLayerSelect(t)},r.nativePaint||(this.options.paint&&(r.paint=e.preparePaint(r.paint||{},this.options.paint,this.getPaintFunctions)),r.selectedPaint&&this.options.selectedPaint&&(r.selectedPaint=e.preparePaint(r.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},o}(P);function O(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var o=e.title||"",i=e.html;function s(){o&&(r.title="string"==typeof o?o:n?o.on:o.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){i&&("string"==typeof i||i instanceof HTMLElement?a(i):a(n?i.on:i.off),r.setAttribute("aria-label",r.title))}function p(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function c(){e.addClassOn&&p(e.addClassOn,n),e.addClassOff&&p(e.addClassOff,!n)}s(),u(),e.addClass&&p(e.addClass,!0),c();var l=function(t){void 0!==t&&(n=t),u(),s(),c()},d=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},h=t({html:r,onClick:d});return h.onClick=d,h.changeStatus=l,h}var S=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return a(e,t),e.prototype.addControl=function(t,e,r){return p(this,void 0,void 0,(function(){var n,o=this;return c(this,(function(i){return e=null!=e?e:"top-left",(n="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){o._setControlQueue(e,(function(){return p(o,void 0,void 0,(function(){var r,o;return c(this,(function(i){switch(i.label){case 0:return[4,n];case 1:return r=i.sent(),o=this.mapAdapter.addControl(r,e),t(o),[2]}}))}))}))}))]:[2]}))}))},e.prototype.createControl=function(t,e){return p(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},e.prototype.createButtonControl=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},e.prototype.createToggleControl=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,O(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},e.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},e.prototype.getControl=function(t,r){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(r);var o=e.controls[t];return o?o(this,r):void 0},e.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},e.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},e.prototype._applyControls=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},e.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},e}(k),E={};function x(t){return E[t]}var M=function(t){function e(e){var r=t.call(this,e)||this;return r._addControls(),E[r.id]=r,r}return a(e,t),e.get=function(t){return x(t)},e.prototype._addLayerProviders=function(){var t,e,r,n;return p(this,void 0,void 0,(function(){var o,i,s,a,u,p,l,h,y,f;return c(this,(function(c){switch(c.label){case 0:c.trys.push([0,18,19,24]),o=d(this._starterKits),c.label=1;case 1:return[4,o.next()];case 2:return(i=c.sent()).done?[3,17]:(s=i.value).getLayerAdapters?[4,s.getLayerAdapters.call(s)]:[3,16];case 3:if(!(a=c.sent()))return[3,16];c.label=4;case 4:c.trys.push([4,10,11,16]),r=void 0,u=d(a),c.label=5;case 5:return[4,u.next()];case 6:return(p=c.sent()).done?[3,9]:[4,(l=p.value).createAdapter(this)];case 7:(h=c.sent())&&(this.mapAdapter.layerAdapters[l.name]=h),c.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return y=c.sent(),r={error:y},[3,16];case 11:return c.trys.push([11,,14,15]),p&&!p.done&&(n=u.return)?[4,n.call(u)]:[3,13];case 12:c.sent(),c.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return f=c.sent(),t={error:f},[3,24];case 19:return c.trys.push([19,,22,23]),i&&!i.done&&(e=o.return)?[4,e.call(o)]:[3,21];case 20:c.sent(),c.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},e.prototype._onLoadSync=function(){var t,e;return p(this,void 0,void 0,(function(){var r,n,o,i,s;return c(this,(function(a){switch(a.label){case 0:a.trys.push([0,8,9,14]),r=d(this._starterKits),a.label=1;case 1:return[4,r.next()];case 2:if((n=a.sent()).done)return[3,7];if(!(o=n.value).onLoadSync)return[3,6];a.label=3;case 3:return a.trys.push([3,5,,6]),[4,o.onLoadSync.call(o,this)];case 4:return a.sent(),[3,6];case 5:return i=a.sent(),console.error(i),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return s=a.sent(),t={error:s},[3,14];case 9:return a.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:a.sent(),a.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},e.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var o=n.position,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["position"]);t.addControl(r,o||"top-left",i)})),this._emitStatusEvent("controls:create")},e}(S);exports.WebMap=M,exports.WebMapControls=S,exports.WebMapLayers=k,exports.WebMapMain=P,exports.createToggleControl=O,exports.createWebMap=function(t){return p(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new M(t).onLoad()]}))}))},exports.detectGeometryType=y,exports.findMostFrequentGeomType=h,exports.getWebMap=x,exports.updateGeoJsonAdapterOptions=v;
//# sourceMappingURL=webmap.cjs.prod.js.map

@@ -15,3 +15,3 @@ /*! *****************************************************************************

***************************************************************************** */
var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};function e(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(e){o(e)}}function a(t){try{u(n.throw(t))}catch(e){o(e)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(a){o=[6,a],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function o(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=o(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,i){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,i,(e=t[r](e)).done,e.value)}))}}}function a(t){return null!=t}function u(t,e,r){void 0===r&&(r=!1);var n=t,i=e,o=Array.isArray(i),s=o&&[]||{};return o&&Array.isArray(i)?r?(s=s.concat(n=n||[]),i.forEach((function(t,e){void 0===s[e]?s[e]=t:"object"==typeof t?s[e]=u(n[e],t,r):-1===n.indexOf(t)&&s.push(t)}))):s=i:(n&&"object"==typeof n&&Object.keys(n).forEach((function(t){s[t]=n[t]})),Object.keys(i).forEach((function(t){s[t]="object"==typeof i[t]&&i[t]&&"object"==typeof n[t]&&"object"==typeof i[t]?u(n[t],i[t],r):i[t]}))),s}function c(t){return{type:"Polygon",coordinates:[p(t)]}}function p(t){var e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function l(t){return"function"==typeof t}var f={get:function(t,e){return t.properties&&t.properties[e[0]]},match:function(t,e){var r=e[0],n=e.slice(1),i=r;Array.isArray(r)&&(i=h(t,r));for(var o=n.splice(-1,n.length%2)[0],s=0;s<n.length-1;s+=2){if(n[s]===i)return n[s+1]}return o}};function h(t,e){var r=e[0],n=e.slice(1),i=f[r];if(i)return i(t,n)}function d(t){return function(e){return h(e,t)}}var y=["iconSize","iconAnchor"];function v(t,e,r){if((e=String(e))===(t=String(t)))return!0;if(r&&e.toUpperCase()===t.toUpperCase())return!0;var n,i="^".concat((n=e,n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(i,r?"i":"").exec(t)}var m={gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},eq:function(t,e){return t===e},ne:function(t,e){return t!==e},in:function(t,e){return-1!==e.indexOf(t)},notin:function(t,e){return-1===e.indexOf(t)},like:function(t,e){return v(t,e)},ilike:function(t,e){return v(t,e,!0)}};function g(t,e){var r="string"==typeof e[0]?e[0]:"all",n=function(e){if(3===(u=e).length&&"string"==typeof u[0]&&"string"==typeof u[1]){var r=e[0],n=e[1],i=e[2],o=m[n];if(o){if(("like"===n||"ilike"===n)&&"string"==typeof r){var s="",a=r.replace(/^%?(\w+)%?$/,(function(e,n){return s=t[n],r.replace(n,i)}));return o(s,a)}return o(t[r],i)}return!1}return g(t,e);var u},i=e.filter((function(t){return Array.isArray(t)}));return"any"===r?i.some(n):i.every(n)}function _(t){var e={},n=[];return t.forEach((function(t){t&&(Array.isArray(t)?n.push(t):e=t)})),function(t){var i=n.find((function(e){return function(t,e){var n=r({},t.properties);return!!n&&(n.$id=t.id,g(n,e))}(t,e[0])}));return i?r(r({},e),i[1]):e}}function L(t,e,n){if(!t)throw new Error("paint is empty");var i=r({},e);if(l(t)){var o=function(r){var i=L(t(r),e,n);return i.type=t.type,i};return o.type=t.type,o}if(function(t){return!!Array.isArray(t)}(t))return function(r){return L(_(t)(r),e,n)};if("get-paint"===t.type){var s=function(t,e){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&e){var r=e[t.from];if(r)return r(t.options)}}(t,n);s&&(i=L(s,e,n))}else{if("icon"===t.type)return t;var a=function(t){var e=!1,n={};for(var i in t)if(-1===y.indexOf(i)){var o=i,s=t[o];Array.isArray(s)&&(e=!0,n[o]=d(s))}if(e)return function(e){var i={};for(var o in n)i[o]=n[o](e);return r(r({},t),i)}}(t);if(a)return function(t){return L(a(t),e,n)};(i=r(r({},i),t)).fill=void 0===i.fill||i.fill,i.stroke=void 0!==i.stroke?i.stroke:!i.fill||!(!i.strokeColor&&!i.strokeOpacity)}return l(i)||("color"in i&&(i.strokeColor||(i.strokeColor=i.color),i.fillColor||(i.fillColor=i.color)),"opacity"in i&&(void 0===i.strokeOpacity&&(i.strokeOpacity=i.opacity),void 0===i.fillOpacity&&(i.fillOpacity=i.opacity))),i}function b(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var i in r){r[i]>((void 0!==e?r[e]:0)||0)&&(e=i)}return e}function w(t){var e;if("FeatureCollection"===t.type)e=b(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=b(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var C={polygon:"path",line:"path",point:"circle"},P={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function A(t){if(t.data){var e=P[w(t.data)],r=t.paint;r&&"[object Object]"===Object.prototype.toString.call(r)&&(r.type=r.type?r.type:"polygon"===e||"line"===e?"path":"html"in r||"className"in r?"icon":C[e]),t.type=t.type||e}return t}var O,E={exports:{}},k="object"==typeof Reflect?Reflect:null,S=k&&"function"==typeof k.apply?k.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};O=k&&"function"==typeof k.ownKeys?k.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var x=Number.isNaN||function(t){return t!=t};function M(){M.init.call(this)}E.exports=M,E.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}N(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&N(t,"error",e,r)}(t,i,{once:!0})}))},M.EventEmitter=M,M.prototype._events=void 0,M.prototype._eventsCount=0,M.prototype._maxListeners=void 0;var j=10;function F(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function T(t){return void 0===t._maxListeners?M.defaultMaxListeners:t._maxListeners}function z(t,e,r,n){var i,o,s,a;if(F(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=T(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function B(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function I(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=B.bind(n);return i.listener=r,n.wrapFn=i,i}function V(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):Z(i,i.length)}function R(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function Z(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function N(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(M,"defaultMaxListeners",{enumerable:!0,get:function(){return j},set:function(t){if("number"!=typeof t||t<0||x(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");j=t}}),M.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},M.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||x(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},M.prototype.getMaxListeners=function(){return T(this)},M.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[t];if(void 0===a)return!1;if("function"==typeof a)S(a,this,e);else{var u=a.length,c=Z(a,u);for(r=0;r<u;++r)S(c[r],this,e)}return!0},M.prototype.on=M.prototype.addListener=function(t,e){return z(this,t,e,!1)},M.prototype.prependListener=function(t,e){return z(this,t,e,!0)},M.prototype.once=function(t,e){return F(e),this.on(t,I(this,t,e)),this},M.prototype.prependOnceListener=function(t,e){return F(e),this.prependListener(t,I(this,t,e)),this},M.prototype.off=M.prototype.removeListener=function(t,e){var r,n,i,o,s;if(F(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},M.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},M.prototype.listeners=function(t){return V(this,t,!0)},M.prototype.rawListeners=function(t){return V(this,t,!1)},M.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):R.call(t,e)},M.prototype.listenerCount=R,M.prototype.eventNames=function(){return this._eventsCount>0?O(this._events):[]};var G=function(t){function r(){var e=t.call(this)||this;return e.name="CancelError",Object.setPrototypeOf(e,r.prototype),e}return e(r,t),r}(Error),J=function(){function t(t){void 0===t&&(t={}),this.options=t,this._promises=new Map}return Object.defineProperty(t.prototype,"isLoaded",{get:function(){return this._promises.size>0},enumerable:!1,configurable:!0}),t.prototype.remove=function(t){this._promises.has(t)&&(this._promises.delete(t),this._onStop())},t.prototype.get=function(t){return this._promises.get(t)},t.prototype.add=function(t,e){var r=this,n=e||t,i=this._promises.get(n);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),i||(this._promises.set(n,t),t.finally((function(){r.remove(n)})),t)},t.prototype.abort=function(){this.isLoaded&&(this._promises.forEach((function(t){t.cancel&&t.cancel()})),this._promises.clear(),this._onStop())},t.prototype.waitFunc=function(t,e){void 0===e&&(e="");var r=this.get(e=e||t.name);return r||this.add(t(),e)},t.prototype.WaitForMe=function(t){void 0===t&&(t="");var e=this.get.bind(this),r=this.add.bind(this);return function(n,i,o){var s=o.value;return t=t||i,o.value=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e(t);if(o)return o;var a=r(s.apply(this,n),t);return a},o}},t.prototype.GetOrCreateDecorator=function(t){return void 0===t&&(t=""),this.WaitForMe(t)},t.prototype._onStop=function(){this.options.onStop&&!this.isLoaded&&this.options.onStop()},t}(),D=function(t){function r(){var e=t.call(this)||this;return e.name="TimeoutError",Object.setPrototypeOf(e,r.prototype),e}return e(r,t),r}(Error),H=function(t,e,r,n){try{t(r(n))}catch(i){e(i)}},K=0,Q=function(){function t(e,r){var n=this;this.id=K++,this._isCanceled=!1,this._isPending=!0,this._cancelHandlers=[],this._children=[],this._cancelPromise=new Promise((function(t,e){n._setCanceledCallback=function(e){return t(e||new G)}}));var i=[this._cancelPromise,new Promise((function(r,i){return e((function(e){e instanceof t?n.attach(e):n._isPending=!1,r(e)}),(function(t){n._isPending=!1,i(t)}),(function(t){if(!n._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");n._cancelHandlers.push(t)}))}))];r&&i.push(new Promise((function(t,e){setTimeout((function(){if(n._isPending)try{n.cancel()}finally{e(new D)}}),r)}))),this._promise=Promise.race(i)}return t.createControl=function(t){return new J(t)},t.resolve=function(e){return new t((function(t){return t(e)}))},t.reject=function(e){return new t((function(t,r){return r(e)}))},t.all=function(e){var r=this;return new t((function(t,r){Promise.all(e).then(t).catch(r)})).catch((function(t){if(t instanceof r.CancelError)for(var n=0,i=e;n<i.length;n++){var o=i[n];"cancel"in o&&o.cancel()}throw t}))},t.prototype.attach=function(t){this._isCanceled?t.cancel():this._children.push(t)},t.prototype.then=function(e,r){var n=this,i=new t((function(t,i){if(n._promise){var o=function(e){r?H(t,i,r,e):i(e)};n._promise.then((function(r){n._isCanceled?o(r):e?H(t,i,e,r):t(r)}),o)}}));return i._parentPromise=this,this._children.push(i),i},t.prototype.catch=function(t){return this._isCanceled&&t&&t(new G),this.then(void 0,t)},t.prototype.finally=function(t){return this._promise?this._promise.finally(t):Promise.reject(this._isCanceled?new G:t)},t.prototype.cancel=function(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;var t=this._getTopParent();if(t&&t.cancel(),this._children&&this._children.forEach((function(t){return t.cancel()})),this._isPending){if(this._cancelHandlers.length)try{for(var e=0,r=this._cancelHandlers;e<r.length;e++){(0,r[e])()}}catch(n){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this},t.prototype._getTopParent=function(){for(var t=this._parentPromise,e=!!t;e;)e=!(!t||!t._parentPromise)&&!!(t=t._parentPromise);return t},t.prototype._destroy=function(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0},t.CancelError=G,t.TimeoutError=D,t.PromiseControl=J,t}();Object.setPrototypeOf(Q.prototype,Promise.prototype);var U=Q,W=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},$=function(){function t(){this.keyCodeAlias=new W,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),q=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),X=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return e(r,t),r.prototype.getValue=function(){return this.webMap.getCenter()},r.prototype.setValue=function(t){this.webMap.setCenter(t)},r.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},r.prototype.parse=function(t){return t.split("_").map(Number)},r}(q),Y=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return e(r,t),r.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},r.prototype.setValue=function(t){this.webMap.setZoom(t)},r.prototype.toString=function(t){return String(t)},r.prototype.parse=function(t){return Number(t)},r}(q);var tt=0,et={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},rt=function(){function t(e){this.options=et,this.emitter=new E.exports.EventEmitter,this.keys=t.keys,this.runtimeParams=[],this.getPaintFunctions=t.getPaintFunctions,this.mapState=[X,Y],this.id=tt++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=e.mapAdapter,this._starterKits=e.starterKits||[],e&&(this.options=u(et||{},e)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return t.prototype.getId=function(){return this.id},t.prototype.create=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},t.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},t.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},t.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},t.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,i=t.runtimeParams;n<i.length;n++){var o=i[n].get(r.name);if(void 0!==o){e[r.name]=r.parse(o);break}}})),e},t.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},t.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},t.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},t.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},t.prototype.getCenter=function(){return this.mapAdapter.getCenter()},t.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},t.prototype.getBoundsPolygon=function(){var t=this.getBounds();if(t)return{type:"Feature",properties:{},geometry:c(t)}},t.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},t.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},t.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},t.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},t.prototype.setView=function(t,e){if(Array.isArray(t)){var r=t;this.mapAdapter.setView&&r&&a(e)?this.mapAdapter.setView(r,e):(r&&this.mapAdapter.setCenter(r),a(e)&&this.mapAdapter.setZoom(e))}else{this.mapAdapter.setView&&this.mapAdapter.setView(t)}},t.prototype.fitBounds=function(t,e){return t.every((function(t){return a(t)}))&&(t[1]<-85.06&&(t[1]=-85.06),t[3]>85.06&&(t[3]=85.06),this.mapAdapter.fitBounds(t,e)),this},t.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},t.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},t.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,i=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},o=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&o?i():e.mapAdapter.emitter.once("create",(function(){i()}))}))},t.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},t.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},t.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},t.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},t.prototype.getCoordFromMapClick=function(){var t=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new U((function(e,r,n){var i=t.getCursor()||"grab";t._removeEventListeners({include:["click"]}),t.setCursor("crosshair");var o=function(){t.setCursor(i),t._addEventsListeners({include:["click"]}),t.mapAdapter.emitter.off("click",s),t._coordFromMapClickPromise=void 0},s=function(t){var r;o(),!(r=t).lngLat&&r.latLng&&(r.lngLat=[r.latLng.lng,r.latLng.lat]),e(t.lngLat)};t.mapAdapter.emitter.once("click",s),n(o)})),this._coordFromMapClickPromise)},t.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},t.prototype._addLayerProviders=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2]}))}))},t.prototype._onLoadSync=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2]}))}))},t.prototype._setupMap=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},t.prototype._setTileJsonOptions=function(t){t.center&&(this.options.center=t.center),t.bounds&&(this.options.bounds=t.bounds),a(t.maxzoom)&&(this.options.maxZoom=t.maxzoom,this.options.zoom=t.maxzoom),a(t.minzoom)&&(this.options.minZoom=t.minzoom,this.options.zoom=t.minzoom),a(t.maxzoom)&&a(t.minzoom)&&(this.options.zoom=(t.maxzoom+t.minzoom)/2)},t.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},t.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var i=0,o=this.runtimeParams;i<o.length;i++){var s=o[i].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},t.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var i=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,i)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},t.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},t.keys=new $,t}(),nt=function(t){function o(e){var r=t.call(this,e)||this;r._layersIdCounter=1,r._layersOrderCounter=1,r._baselayers=[],r._layers={},r._selectedLayers=[];var n=r.options.tileJson;return n&&r.emitter.once("build-map",(function(){return r.addTileJsonLayer(n)})),r}return e(o,t),o.prototype.fitLayer=function(t,e){return n(this,void 0,void 0,(function(){var r,n,o;return i(this,(function(i){switch(i.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(o=i.sent())&&this.fitBounds(o,e),i.label=2;case 2:return[2]}}))}))},o.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},o.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},o.prototype.getBaseLayersIds=function(){return this._baselayers},o.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},o.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},o.prototype.getLayers=function(){return Object.keys(this._layers)},o.prototype.allLayers=function(){return this._layers},o.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},o.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},o.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},o.prototype.addBaseLayer=function(t,e){return n(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.addLayer(t,r(r({},e),{baselayer:!0}),void 0)];case 1:return[2,n.sent()]}}))}))},o.prototype.addLayer=function(t,e,o){var s,u;return void 0===e&&(e={}),n(this,void 0,void 0,(function(){var n,c,p,l,f,h,d,y,v,m,g,_;return i(this,(function(i){switch(i.label){case 0:return n=this._layersIdCounter++,c=a(o)?o:void 0!==e.order?e.order:this.reserveOrder(),"string"!=typeof t?[3,1]:(p=this.getLayerAdapter(t),[3,4]);case 1:return"function"!=typeof t?[3,2]:(p=t,[3,4]);case 2:return"then"in t?[4,t]:[3,4];case 3:p=i.sent(),i.label=4;case 4:return this._updateGeoJsonOptions(l=e),e=r({id:String(n),order:c},e),f=null===(s=e.visibility)||void 0===s||s,e.visibility=!1,e.baselayer&&(e.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:e,adapter:p}))&&(h.options&&(e=h.options),h.adapter&&(p=h.adapter)),void 0===p?[3,12]:((d=new p(this.mapAdapter.map,e)).options=r(r({},e),d.options),d.options.baselayer&&(e.baselayer=!0,e.order=0,d.options.order=0),y=void 0,d.options.id&&(y=String(d.options.id),this._layers[y]=d),this._emitLayerEvent("layer:preadd",y||"",d),[4,this.onMapLoad()]);case 5:return i.sent(),d.map=this.mapAdapter.map,[4,d.addLayer(d.options)];case 6:if(v=i.sent(),d.layer=v,d.id=d.options.id||String(n),d.options.id=d.id,e.baselayer&&(d.options.order=0),d.order=null!==(u=d.options.order)&&void 0!==u?u:c,y&&delete this._layers[y],y=String(d.id),this._layers[y])throw Error("layer with id '".concat(y,"' already exist"));return y?(this._layers[y]=d,l.filter&&this.filterLayer(d,l.filter),e.baselayer&&this._baselayers.push(y),f?[4,this.showLayer(y)]:[3,8]):[3,8];case 7:i.sent(),i.label=8;case 8:return void 0!==(m=e.opacity)&&m<=1&&this.setLayerOpacity(d,m),g=v&&(d.getBounds||d.getExtent),e.fit&&g?[4,g.call(d)]:[3,11];case 9:return(_=i.sent())?[4,this.fitBounds(_)]:[3,11];case 10:i.sent(),i.label=11;case 11:return e.onAdded&&e.onAdded(d),this._emitLayerEvent("layer:add",y,d),[2,d];case 12:return[2,Promise.reject("No adapter")]}}))}))},o.prototype.addLayerFromAsyncAdapter=function(t,e,r){return n(this,void 0,void 0,(function(){var n,o;return i(this,(function(i){switch(i.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(o=i.sent())?[2,this.addLayer(o,e,n)]:[2,Promise.reject("No adapter")]}}))}))},o.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},o.prototype.reserveOrder=function(){return this._layersOrderCounter++},o.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},o.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},o.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=A(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},o.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},o.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",r(r({},e),{url:t}))},o.prototype.addImageLayer=function(t,e){var n;return"string"==typeof t?n=t:(n=t.url,e=t),this.addLayer("IMAGE",r(r({},e),{url:n}))},o.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},o.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},o.prototype.toggleLayer=function(t,e,r){var o=this;void 0===r&&(r={});var s=this.getLayer(t),a=void 0!==e?e:!(s&&s.options.visibility),u=void 0!==r.silent&&r.silent;return s&&s.options.visibility!==a?this.onMapLoad().then((function(){return t=s,n(o,void 0,void 0,(function(){var e,r,n,o,s,c,p,l=this;return i(this,(function(i){switch(i.label){case 0:if(e=String(t.id),r=a?"layer:preshow":"layer:prehide",n=a?"layer:show":"layer:hide",u||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!a||!this.mapAdapter)return[3,9];if(o=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];s=this._baselayers.filter((function(e){return e!==t.id&&l.isLayerVisible(e)})),c=0,p=s,i.label=1;case 1:return c<p.length?[4,this.hideLayer(p[c])]:[3,4];case 2:i.sent(),i.label=3;case 3:return c++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return i.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:i.sent(),i.label=8;case 8:return void 0!==o&&this.mapAdapter.setLayerOrder(t.layer,o,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return i.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:i.sent(),i.label=13;case 13:return t.options.visibility=a,u||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},o.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},o.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},o.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},o.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var i=this.getLayerId(r);if(i){var o=this._selectedLayers.indexOf(i);-1!==o&&this._selectedLayers.splice(o,1)}}},o.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},o.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},o.prototype.propertiesFilter=function(t,e,r){var n=this.getLayer(t);if(n){var i=n;i.propertiesFilter?i.propertiesFilter(e,r):i.filter&&this.filterLayer(i,(function(t){return!t.feature||!t.feature.properties||g(t.feature.properties,e)}))}},o.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},o.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},o.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},o.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},o.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},o.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},o.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},o.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},o.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],i=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(i&&t.onlyBaselayer&&(i=this._baselayers.includes(r)),i){var o=n.options&&n.options.attribution;o&&e.push(o)}}return e},o.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},o.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},o.prototype._emitLayerEvent=function(t,e,r){var n=String(t);if(a(e)&&n.startsWith("layer:")){var i=n.replace("layer:","layer-"+e+":");this.emitter.emit(i,r)}this.emitter.emit(t,r)},o.prototype._onLayerClick=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},o.prototype._onLayerSelect=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},o.prototype._updateGeoJsonOptions=function(t){var e=this,r=t.onSelect,n=t.onLayerSelect,i=t.onMouseOut,o=t.onMouseOver,s=t.onClick||t.onLayerClick;t.onClick=function(t){return s&&s(t),e._onLayerClick(t)},t.onMouseOut=function(t){var r=t.layer.id;i&&i(t),a(r)&&e._emitLayerEvent("layer:mouseout",r,t)},t.onMouseOver=function(t){var r=t.layer.id;o&&o(t),a(r)&&e._emitLayerEvent("layer:mouseover",r,t)};var u=r||n;t.onSelect=function(t){return u&&u(t),e._onLayerSelect(t)},t.nativePaint||(this.options.paint&&(t.paint=L(t.paint||{},this.options.paint,this.getPaintFunctions)),t.selectedPaint&&this.options.selectedPaint&&(t.selectedPaint=L(t.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},o}(rt);function it(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var i=e.title||"",o=e.html;function s(){i&&(r.title="string"==typeof i?i:n?i.on:i.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){o&&("string"==typeof o||o instanceof HTMLElement?a(o):a(n?o.on:o.off),r.setAttribute("aria-label",r.title))}function c(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function p(){e.addClassOn&&c(e.addClassOn,n),e.addClassOff&&c(e.addClassOff,!n)}s(),u(),e.addClass&&c(e.addClass,!0),p();var l=function(t){void 0!==t&&(n=t),u(),s(),p()},f=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},h=t({html:r,onClick:f});return h.onClick=f,h.changeStatus=l,h}var ot=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return e(r,t),r.prototype.addControl=function(t,e,r){return n(this,void 0,void 0,(function(){var o,s=this;return i(this,(function(a){return e=null!=e?e:"top-left",(o="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){s._setControlQueue(e,(function(){return n(s,void 0,void 0,(function(){var r,n;return i(this,(function(i){switch(i.label){case 0:return[4,o];case 1:return r=i.sent(),n=this.mapAdapter.addControl(r,e),t(n),[2]}}))}))}))}))]:[2]}))}))},r.prototype.createControl=function(t,e){return n(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},r.prototype.createButtonControl=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},r.prototype.createToggleControl=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,it(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},r.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},r.prototype.getControl=function(t,e){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(e);var i=r.controls[t];return i?i(this,e):void 0},r.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},r.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},r.prototype._applyControls=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},r.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},r}(nt),st={};function at(t){return st[t]}var ut=function(t){function r(e){var r=t.call(this,e)||this;return r._addControls(),st[r.id]=r,r}return e(r,t),r.get=function(t){return at(t)},r.prototype._addLayerProviders=function(){var t,e,r,o;return n(this,void 0,void 0,(function(){var n,a,u,c,p,l,f,h,d,y;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,18,19,24]),n=s(this._starterKits),i.label=1;case 1:return[4,n.next()];case 2:return(a=i.sent()).done?[3,17]:(u=a.value).getLayerAdapters?[4,u.getLayerAdapters.call(u)]:[3,16];case 3:if(!(c=i.sent()))return[3,16];i.label=4;case 4:i.trys.push([4,10,11,16]),r=void 0,p=s(c),i.label=5;case 5:return[4,p.next()];case 6:return(l=i.sent()).done?[3,9]:[4,(f=l.value).createAdapter(this)];case 7:(h=i.sent())&&(this.mapAdapter.layerAdapters[f.name]=h),i.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return d=i.sent(),r={error:d},[3,16];case 11:return i.trys.push([11,,14,15]),l&&!l.done&&(o=p.return)?[4,o.call(p)]:[3,13];case 12:i.sent(),i.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return y=i.sent(),t={error:y},[3,24];case 19:return i.trys.push([19,,22,23]),a&&!a.done&&(e=n.return)?[4,e.call(n)]:[3,21];case 20:i.sent(),i.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},r.prototype._onLoadSync=function(){var t,e;return n(this,void 0,void 0,(function(){var r,n,o,a,u;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,8,9,14]),r=s(this._starterKits),i.label=1;case 1:return[4,r.next()];case 2:if((n=i.sent()).done)return[3,7];if(!(o=n.value).onLoadSync)return[3,6];i.label=3;case 3:return i.trys.push([3,5,,6]),[4,o.onLoadSync.call(o,this)];case 4:return i.sent(),[3,6];case 5:return a=i.sent(),console.error(a),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return u=i.sent(),t={error:u},[3,14];case 9:return i.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:i.sent(),i.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},r.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var i=n.position,o=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(n,["position"]);t.addControl(r,i||"top-left",o)})),this._emitStatusEvent("controls:create")},r}(ot);function ct(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new ut(t).onLoad()]}))}))}export{ut as WebMap,ot as WebMapControls,nt as WebMapLayers,rt as WebMapMain,it as createToggleControl,ct as createWebMap,w as detectGeometryType,b as findMostFrequentGeomType,at as getWebMap,A as updateGeoJsonAdapterOptions};
var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};function e(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function n(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(e){i(e)}}function a(t){try{u(n.throw(t))}catch(e){i(e)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(a){i=[6,a],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function i(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=i(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function a(t){return null!=t}function u(t,e,r){void 0===r&&(r=!1);var n=t,o=e,i=Array.isArray(o),s=i&&[]||{};return i&&Array.isArray(o)?r?(s=s.concat(n=n||[]),o.forEach((function(t,e){void 0===s[e]?s[e]=t:"object"==typeof t?s[e]=u(n[e],t,r):-1===n.indexOf(t)&&s.push(t)}))):s=o:(n&&"object"==typeof n&&Object.keys(n).forEach((function(t){s[t]=n[t]})),Object.keys(o).forEach((function(t){s[t]="object"==typeof o[t]&&o[t]&&"object"==typeof n[t]&&"object"==typeof o[t]?u(n[t],o[t],r):o[t]}))),s}function c(t){return{type:"Polygon",coordinates:[p(t)]}}function p(t){var e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function l(t){return"function"==typeof t}var f={get:function(t,e){return t.properties&&t.properties[e[0]]},match:function(t,e){var r=e[0],n=e.slice(1),o=r;Array.isArray(r)&&(o=h(t,r));for(var i=n.splice(-1,n.length%2)[0],s=0;s<n.length-1;s+=2){if(n[s]===o)return n[s+1]}return i}};function h(t,e){var r=e[0],n=e.slice(1),o=f[r];if(o)return o(t,n)}function d(t){return function(e){return h(e,t)}}var y=["iconSize","iconAnchor"];function v(t,e,r){if((e=String(e))===(t=String(t)))return!0;if(r&&e.toUpperCase()===t.toUpperCase())return!0;var n,o="^".concat((n=e,n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(o,r?"i":"").exec(t)}var m={gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},eq:function(t,e){return t===e},ne:function(t,e){return t!==e},in:function(t,e){return-1!==e.indexOf(t)},notin:function(t,e){return-1===e.indexOf(t)},like:function(t,e){return v(t,e)},ilike:function(t,e){return v(t,e,!0)}};function g(t,e){var r="string"==typeof e[0]?e[0]:"all",n=function(e){if(3===(u=e).length&&"string"==typeof u[0]&&"string"==typeof u[1]){var r=e[0],n=e[1],o=e[2],i=m[n];if(i){if(("like"===n||"ilike"===n)&&"string"==typeof r){var s="",a=r.replace(/^%?(\w+)%?$/,(function(e,n){return s=t[n],r.replace(n,o)}));return i(s,a)}return i(t[r],o)}return!1}return g(t,e);var u},o=e.filter((function(t){return Array.isArray(t)}));return"any"===r?o.some(n):o.every(n)}function _(t){var e={},n=[];return t.forEach((function(t){t&&(Array.isArray(t)?n.push(t):e=t)})),function(t){var o=n.find((function(e){return function(t,e){var n=r({},t.properties);return!!n&&(n.$id=t.id,g(n,e))}(t,e[0])}));return o?r(r({},e),o[1]):e}}function L(t,e,n){if(!t)throw new Error("paint is empty");var o=r({},e);if(l(t)){var i=function(r){var o=L(t(r),e,n);return o.type=t.type,o};return i.type=t.type,i}if(function(t){return!!Array.isArray(t)}(t))return function(r){return L(_(t)(r),e,n)};if("get-paint"===t.type){var s=function(t,e){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&e){var r=e[t.from];if(r)return r(t.options)}}(t,n);s&&(o=L(s,e,n))}else{if("icon"===t.type)return t;var a=function(t){var e=!1,n={};for(var o in t)if(-1===y.indexOf(o)){var i=o,s=t[i];Array.isArray(s)&&(e=!0,n[i]=d(s))}if(e)return function(e){var o={};for(var i in n)o[i]=n[i](e);return r(r({},t),o)}}(t);if(a)return function(t){return L(a(t),e,n)};(o=r(r({},o),t)).fill=void 0===o.fill||o.fill,o.stroke=void 0!==o.stroke?o.stroke:!o.fill||!(!o.strokeColor&&!o.strokeOpacity)}return l(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}function b(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var o in r){r[o]>((void 0!==e?r[e]:0)||0)&&(e=o)}return e}function w(t){var e;if("FeatureCollection"===t.type)e=b(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=b(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var C={polygon:"path",line:"path",point:"circle"},P={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function A(t){if(t.data){var e=P[w(t.data)],r=t.paint;r&&"[object Object]"===Object.prototype.toString.call(r)&&(r.type=r.type?r.type:"polygon"===e||"line"===e?"path":"html"in r||"className"in r?"icon":C[e]),t.type=t.type||e}return t}var O,E={exports:{}},k="object"==typeof Reflect?Reflect:null,S=k&&"function"==typeof k.apply?k.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};O=k&&"function"==typeof k.ownKeys?k.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var x=Number.isNaN||function(t){return t!=t};function M(){M.init.call(this)}E.exports=M,E.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}N(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&N(t,"error",e,r)}(t,o,{once:!0})}))},M.EventEmitter=M,M.prototype._events=void 0,M.prototype._eventsCount=0,M.prototype._maxListeners=void 0;var j=10;function F(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function T(t){return void 0===t._maxListeners?M.defaultMaxListeners:t._maxListeners}function z(t,e,r,n){var o,i,s,a;if(F(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=T(t))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function B(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function I(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=B.bind(n);return o.listener=r,n.wrapFn=o,o}function V(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):Z(o,o.length)}function R(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function Z(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function N(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(M,"defaultMaxListeners",{enumerable:!0,get:function(){return j},set:function(t){if("number"!=typeof t||t<0||x(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");j=t}}),M.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},M.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||x(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},M.prototype.getMaxListeners=function(){return T(this)},M.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var a=o[t];if(void 0===a)return!1;if("function"==typeof a)S(a,this,e);else{var u=a.length,c=Z(a,u);for(r=0;r<u;++r)S(c[r],this,e)}return!0},M.prototype.on=M.prototype.addListener=function(t,e){return z(this,t,e,!1)},M.prototype.prependListener=function(t,e){return z(this,t,e,!0)},M.prototype.once=function(t,e){return F(e),this.on(t,I(this,t,e)),this},M.prototype.prependOnceListener=function(t,e){return F(e),this.prependListener(t,I(this,t,e)),this},M.prototype.off=M.prototype.removeListener=function(t,e){var r,n,o,i,s;if(F(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},M.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},M.prototype.listeners=function(t){return V(this,t,!0)},M.prototype.rawListeners=function(t){return V(this,t,!1)},M.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):R.call(t,e)},M.prototype.listenerCount=R,M.prototype.eventNames=function(){return this._eventsCount>0?O(this._events):[]};var G=function(t){function r(){var e=t.call(this)||this;return e.name="CancelError",Object.setPrototypeOf(e,r.prototype),e}return e(r,t),r}(Error),J=function(){function t(t){void 0===t&&(t={}),this.options=t,this._promises=new Map}return Object.defineProperty(t.prototype,"isLoaded",{get:function(){return this._promises.size>0},enumerable:!1,configurable:!0}),t.prototype.remove=function(t){this._promises.has(t)&&(this._promises.delete(t),this._onStop())},t.prototype.get=function(t){return this._promises.get(t)},t.prototype.add=function(t,e){var r=this,n=e||t,o=this._promises.get(n);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),o||(this._promises.set(n,t),t.finally((function(){r.remove(n)})),t)},t.prototype.abort=function(){this.isLoaded&&(this._promises.forEach((function(t){t.cancel&&t.cancel()})),this._promises.clear(),this._onStop())},t.prototype.waitFunc=function(t,e){void 0===e&&(e="");var r=this.get(e=e||t.name);return r||this.add(t(),e)},t.prototype.WaitForMe=function(t){void 0===t&&(t="");var e=this.get.bind(this),r=this.add.bind(this);return function(n,o,i){var s=i.value;return t=t||o,i.value=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e(t);if(i)return i;var a=r(s.apply(this,n),t);return a},i}},t.prototype.GetOrCreateDecorator=function(t){return void 0===t&&(t=""),this.WaitForMe(t)},t.prototype._onStop=function(){this.options.onStop&&!this.isLoaded&&this.options.onStop()},t}(),D=function(t){function r(){var e=t.call(this)||this;return e.name="TimeoutError",Object.setPrototypeOf(e,r.prototype),e}return e(r,t),r}(Error),H=function(t,e,r,n){try{t(r(n))}catch(o){e(o)}},K=0,Q=function(){function t(e,r){var n=this;this.id=K++,this._isCanceled=!1,this._isPending=!0,this._cancelHandlers=[],this._children=[],this._cancelPromise=new Promise((function(t,e){n._setCanceledCallback=function(e){return t(e||new G)}}));var o=[this._cancelPromise,new Promise((function(r,o){return e((function(e){e instanceof t?n.attach(e):n._isPending=!1,r(e)}),(function(t){n._isPending=!1,o(t)}),(function(t){if(!n._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");n._cancelHandlers.push(t)}))}))];r&&o.push(new Promise((function(t,e){setTimeout((function(){if(n._isPending)try{n.cancel()}finally{e(new D)}}),r)}))),this._promise=Promise.race(o)}return t.createControl=function(t){return new J(t)},t.resolve=function(e){return new t((function(t){return t(e)}))},t.reject=function(e){return new t((function(t,r){return r(e)}))},t.all=function(e){var r=this;return new t((function(t,r){Promise.all(e).then(t).catch(r)})).catch((function(t){if(t instanceof r.CancelError)for(var n=0,o=e;n<o.length;n++){var i=o[n];"cancel"in i&&i.cancel()}throw t}))},t.prototype.attach=function(t){this._isCanceled?t.cancel():this._children.push(t)},t.prototype.then=function(e,r){var n=this,o=new t((function(t,o){if(n._promise){var i=function(e){r?H(t,o,r,e):o(e)};n._promise.then((function(r){n._isCanceled?i(r):e?H(t,o,e,r):t(r)}),i)}}));return o._parentPromise=this,this._children.push(o),o},t.prototype.catch=function(t){return this._isCanceled&&t&&t(new G),this.then(void 0,t)},t.prototype.finally=function(t){return this._promise?this._promise.finally(t):Promise.reject(this._isCanceled?new G:t)},t.prototype.cancel=function(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;var t=this._getTopParent();if(t&&t.cancel(),this._children&&this._children.forEach((function(t){return t.cancel()})),this._isPending){if(this._cancelHandlers.length)try{for(var e=0,r=this._cancelHandlers;e<r.length;e++){(0,r[e])()}}catch(n){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this},t.prototype._getTopParent=function(){for(var t=this._parentPromise,e=!!t;e;)e=!(!t||!t._parentPromise)&&!!(t=t._parentPromise);return t},t.prototype._destroy=function(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0},t.CancelError=G,t.TimeoutError=D,t.PromiseControl=J,t}();Object.setPrototypeOf(Q.prototype,Promise.prototype);var U=Q,W=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},$=function(){function t(){this.keyCodeAlias=new W,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),q=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),X=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return e(r,t),r.prototype.getValue=function(){return this.webMap.getCenter()},r.prototype.setValue=function(t){this.webMap.setCenter(t)},r.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},r.prototype.parse=function(t){return t.split("_").map(Number)},r}(q),Y=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return e(r,t),r.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},r.prototype.setValue=function(t){this.webMap.setZoom(t)},r.prototype.toString=function(t){return String(t)},r.prototype.parse=function(t){return Number(t)},r}(q);var tt=0,et={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},rt=function(){function t(e){this.options=et,this.emitter=new E.exports.EventEmitter,this.keys=t.keys,this.runtimeParams=[],this.getPaintFunctions=t.getPaintFunctions,this.mapState=[X,Y],this.id=tt++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=e.mapAdapter,this._starterKits=e.starterKits||[],e&&(this.options=u(et||{},e)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return t.prototype.getId=function(){return this.id},t.prototype.create=function(){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},t.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},t.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},t.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},t.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,o=t.runtimeParams;n<o.length;n++){var i=o[n].get(r.name);if(void 0!==i){e[r.name]=r.parse(i);break}}})),e},t.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},t.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},t.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},t.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},t.prototype.getCenter=function(){return this.mapAdapter.getCenter()},t.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},t.prototype.getBoundsPolygon=function(){var t=this.getBounds();if(t)return{type:"Feature",properties:{},geometry:c(t)}},t.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},t.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},t.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},t.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},t.prototype.setView=function(t,e){if(Array.isArray(t)){var r=t;this.mapAdapter.setView&&r&&a(e)?this.mapAdapter.setView(r,e):(r&&this.mapAdapter.setCenter(r),a(e)&&this.mapAdapter.setZoom(e))}else{this.mapAdapter.setView&&this.mapAdapter.setView(t)}},t.prototype.fitBounds=function(t,e){return t.every((function(t){return a(t)}))&&(t[1]<-85.06&&(t[1]=-85.06),t[3]>85.06&&(t[3]=85.06),this.mapAdapter.fitBounds(t,e)),this},t.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},t.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},t.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,o=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},i=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&i?o():e.mapAdapter.emitter.once("create",(function(){o()}))}))},t.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},t.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},t.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},t.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},t.prototype.getCoordFromMapClick=function(){var t=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new U((function(e,r,n){var o=t.getCursor()||"grab";t._removeEventListeners({include:["click"]}),t.setCursor("crosshair");var i=function(){t.setCursor(o),t._addEventsListeners({include:["click"]}),t.mapAdapter.emitter.off("click",s),t._coordFromMapClickPromise=void 0},s=function(t){var r;i(),!(r=t).lngLat&&r.latLng&&(r.lngLat=[r.latLng.lng,r.latLng.lat]),e(t.lngLat)};t.mapAdapter.emitter.once("click",s),n(i)})),this._coordFromMapClickPromise)},t.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},t.prototype._addLayerProviders=function(){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2]}))}))},t.prototype._onLoadSync=function(){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2]}))}))},t.prototype._setupMap=function(){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},t.prototype._setTileJsonOptions=function(t){t.center&&(this.options.center=t.center),t.bounds&&(this.options.bounds=t.bounds),a(t.maxzoom)&&(this.options.maxZoom=t.maxzoom,this.options.zoom=t.maxzoom),a(t.minzoom)&&(this.options.minZoom=t.minzoom,this.options.zoom=t.minzoom),a(t.maxzoom)&&a(t.minzoom)&&(this.options.zoom=(t.maxzoom+t.minzoom)/2)},t.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},t.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var o=0,i=this.runtimeParams;o<i.length;o++){var s=i[o].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},t.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend","mousemove","mouseout","mouseover"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var o=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,o)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},t.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},t.keys=new $,t}(),nt=function(t){function i(e){var r=t.call(this,e)||this;r._layersIdCounter=1,r._layersOrderCounter=1,r._baselayers=[],r._layers={},r._selectedLayers=[];var n=r.options.tileJson;return n&&r.emitter.once("build-map",(function(){return r.addTileJsonLayer(n)})),r}return e(i,t),i.prototype.fitLayer=function(t,e){return n(this,void 0,void 0,(function(){var r,n,i;return o(this,(function(o){switch(o.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(i=o.sent())&&this.fitBounds(i,e),o.label=2;case 2:return[2]}}))}))},i.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},i.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},i.prototype.getBaseLayersIds=function(){return this._baselayers},i.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},i.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},i.prototype.getLayers=function(){return Object.keys(this._layers)},i.prototype.allLayers=function(){return this._layers},i.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},i.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},i.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},i.prototype.addBaseLayer=function(t,e){return n(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,this.addLayer(t,r(r({},e),{baselayer:!0}),void 0)];case 1:return[2,n.sent()]}}))}))},i.prototype.addLayer=function(t,e,i){var s,u;return void 0===e&&(e={}),n(this,void 0,void 0,(function(){var n,c,p,l,f,h,d,y,v,m,g,_;return o(this,(function(o){switch(o.label){case 0:return n=this._layersIdCounter++,c=a(i)?i:void 0!==e.order?e.order:this.reserveOrder(),"string"!=typeof t?[3,1]:(p=this.getLayerAdapter(t),[3,4]);case 1:return"function"!=typeof t?[3,2]:(p=t,[3,4]);case 2:return"then"in t?[4,t]:[3,4];case 3:p=o.sent(),o.label=4;case 4:return this._updateGeoJsonOptions(l=e),e=r({id:String(n),order:c},e),f=null===(s=e.visibility)||void 0===s||s,e.visibility=!1,e.baselayer&&(e.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:e,adapter:p}))&&(h.options&&(e=h.options),h.adapter&&(p=h.adapter)),void 0===p?[3,12]:((d=new p(this.mapAdapter.map,e)).options=r(r({},e),d.options),d.options.baselayer&&(e.baselayer=!0,e.order=0,d.options.order=0),y=void 0,d.options.id&&(y=String(d.options.id),this._layers[y]=d),this._emitLayerEvent("layer:preadd",y||"",d),[4,this.onMapLoad()]);case 5:return o.sent(),d.map=this.mapAdapter.map,[4,d.addLayer(d.options)];case 6:if(v=o.sent(),d.layer=v,d.id=d.options.id||String(n),d.options.id=d.id,e.baselayer&&(d.options.order=0),d.order=null!==(u=d.options.order)&&void 0!==u?u:c,y&&delete this._layers[y],y=String(d.id),this._layers[y])throw Error("layer with id '".concat(y,"' already exist"));return y?(this._layers[y]=d,l.filter&&this.filterLayer(d,l.filter),e.baselayer&&this._baselayers.push(y),f?[4,this.showLayer(y)]:[3,8]):[3,8];case 7:o.sent(),o.label=8;case 8:return void 0!==(m=e.opacity)&&m<=1&&this.setLayerOpacity(d,m),g=v&&(d.getBounds||d.getExtent),e.fit&&g?[4,g.call(d)]:[3,11];case 9:return(_=o.sent())?[4,this.fitBounds(_)]:[3,11];case 10:o.sent(),o.label=11;case 11:return e.onAdded&&e.onAdded(d),this._emitLayerEvent("layer:add",y,d),[2,d];case 12:return[2,Promise.reject("No adapter")]}}))}))},i.prototype.addLayerFromAsyncAdapter=function(t,e,r){return n(this,void 0,void 0,(function(){var n,i;return o(this,(function(o){switch(o.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(i=o.sent())?[2,this.addLayer(i,e,n)]:[2,Promise.reject("No adapter")]}}))}))},i.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},i.prototype.reserveOrder=function(){return this._layersOrderCounter++},i.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},i.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},i.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=A(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},i.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},i.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",r(r({},e),{url:t}))},i.prototype.addImageLayer=function(t,e){var n;return"string"==typeof t?n=t:(n=t.url,e=t),this.addLayer("IMAGE",r(r({},e),{url:n}))},i.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},i.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},i.prototype.toggleLayer=function(t,e,r){var i=this;void 0===r&&(r={});var s=this.getLayer(t),a=void 0!==e?e:!(s&&s.options.visibility),u=void 0!==r.silent&&r.silent;return s&&s.options.visibility!==a?this.onMapLoad().then((function(){return t=s,n(i,void 0,void 0,(function(){var e,r,n,i,s,c,p,l=this;return o(this,(function(o){switch(o.label){case 0:if(e=String(t.id),r=a?"layer:preshow":"layer:prehide",n=a?"layer:show":"layer:hide",u||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!a||!this.mapAdapter)return[3,9];if(i=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];s=this._baselayers.filter((function(e){return e!==t.id&&l.isLayerVisible(e)})),c=0,p=s,o.label=1;case 1:return c<p.length?[4,this.hideLayer(p[c])]:[3,4];case 2:o.sent(),o.label=3;case 3:return c++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return o.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:o.sent(),o.label=8;case 8:return void 0!==i&&this.mapAdapter.setLayerOrder(t.layer,i,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return o.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:o.sent(),o.label=13;case 13:return t.options.visibility=a,u||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},i.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},i.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},i.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},i.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var o=this.getLayerId(r);if(o){var i=this._selectedLayers.indexOf(o);-1!==i&&this._selectedLayers.splice(i,1)}}},i.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},i.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},i.prototype.propertiesFilter=function(t,e,r){var n=this.getLayer(t);if(n){var o=n;o.propertiesFilter?o.propertiesFilter(e,r):o.filter&&this.filterLayer(o,(function(t){return!t.feature||!t.feature.properties||g(t.feature.properties,e)}))}},i.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},i.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},i.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},i.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},i.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},i.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},i.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},i.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},i.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],o=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(o&&t.onlyBaselayer&&(o=this._baselayers.includes(r)),o){var i=n.options&&n.options.attribution;i&&e.push(i)}}return e},i.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},i.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},i.prototype._emitLayerEvent=function(t,e,r){var n=String(t);if(a(e)&&n.startsWith("layer:")){var o=n.replace("layer:","layer-"+e+":");this.emitter.emit(o,r)}this.emitter.emit(t,r)},i.prototype._onLayerClick=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},i.prototype._onLayerSelect=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},i.prototype._updateGeoJsonOptions=function(t){var e=this,r=t.onSelect,n=t.onLayerSelect,o=t.onMouseOut,i=t.onMouseOver,s=t.onClick||t.onLayerClick;t.onClick=function(t){return s&&s(t),e._onLayerClick(t)},t.onMouseOut=function(t){var r=t.layer.id;o&&o(t),a(r)&&e._emitLayerEvent("layer:mouseout",r,t)},t.onMouseOver=function(t){var r=t.layer.id;i&&i(t),a(r)&&e._emitLayerEvent("layer:mouseover",r,t)};var u=r||n;t.onSelect=function(t){return u&&u(t),e._onLayerSelect(t)},t.nativePaint||(this.options.paint&&(t.paint=L(t.paint||{},this.options.paint,this.getPaintFunctions)),t.selectedPaint&&this.options.selectedPaint&&(t.selectedPaint=L(t.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},i}(rt);function ot(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var o=e.title||"",i=e.html;function s(){o&&(r.title="string"==typeof o?o:n?o.on:o.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){i&&("string"==typeof i||i instanceof HTMLElement?a(i):a(n?i.on:i.off),r.setAttribute("aria-label",r.title))}function c(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function p(){e.addClassOn&&c(e.addClassOn,n),e.addClassOff&&c(e.addClassOff,!n)}s(),u(),e.addClass&&c(e.addClass,!0),p();var l=function(t){void 0!==t&&(n=t),u(),s(),p()},f=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},h=t({html:r,onClick:f});return h.onClick=f,h.changeStatus=l,h}var it=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return e(r,t),r.prototype.addControl=function(t,e,r){return n(this,void 0,void 0,(function(){var i,s=this;return o(this,(function(a){return e=null!=e?e:"top-left",(i="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){s._setControlQueue(e,(function(){return n(s,void 0,void 0,(function(){var r,n;return o(this,(function(o){switch(o.label){case 0:return[4,i];case 1:return r=o.sent(),n=this.mapAdapter.addControl(r,e),t(n),[2]}}))}))}))}))]:[2]}))}))},r.prototype.createControl=function(t,e){return n(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},r.prototype.createButtonControl=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},r.prototype.createToggleControl=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,ot(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},r.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},r.prototype.getControl=function(t,e){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(e);var o=r.controls[t];return o?o(this,e):void 0},r.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},r.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},r.prototype._applyControls=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},r.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},r}(nt),st={};function at(t){return st[t]}var ut=function(t){function r(e){var r=t.call(this,e)||this;return r._addControls(),st[r.id]=r,r}return e(r,t),r.get=function(t){return at(t)},r.prototype._addLayerProviders=function(){var t,e,r,i;return n(this,void 0,void 0,(function(){var n,a,u,c,p,l,f,h,d,y;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,18,19,24]),n=s(this._starterKits),o.label=1;case 1:return[4,n.next()];case 2:return(a=o.sent()).done?[3,17]:(u=a.value).getLayerAdapters?[4,u.getLayerAdapters.call(u)]:[3,16];case 3:if(!(c=o.sent()))return[3,16];o.label=4;case 4:o.trys.push([4,10,11,16]),r=void 0,p=s(c),o.label=5;case 5:return[4,p.next()];case 6:return(l=o.sent()).done?[3,9]:[4,(f=l.value).createAdapter(this)];case 7:(h=o.sent())&&(this.mapAdapter.layerAdapters[f.name]=h),o.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return d=o.sent(),r={error:d},[3,16];case 11:return o.trys.push([11,,14,15]),l&&!l.done&&(i=p.return)?[4,i.call(p)]:[3,13];case 12:o.sent(),o.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return y=o.sent(),t={error:y},[3,24];case 19:return o.trys.push([19,,22,23]),a&&!a.done&&(e=n.return)?[4,e.call(n)]:[3,21];case 20:o.sent(),o.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},r.prototype._onLoadSync=function(){var t,e;return n(this,void 0,void 0,(function(){var r,n,i,a,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,8,9,14]),r=s(this._starterKits),o.label=1;case 1:return[4,r.next()];case 2:if((n=o.sent()).done)return[3,7];if(!(i=n.value).onLoadSync)return[3,6];o.label=3;case 3:return o.trys.push([3,5,,6]),[4,i.onLoadSync.call(i,this)];case 4:return o.sent(),[3,6];case 5:return a=o.sent(),console.error(a),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return u=o.sent(),t={error:u},[3,14];case 9:return o.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:o.sent(),o.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},r.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var o=n.position,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["position"]);t.addControl(r,o||"top-left",i)})),this._emitStatusEvent("controls:create")},r}(it);function ct(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new ut(t).onLoad()]}))}))}export{ut as WebMap,it as WebMapControls,nt as WebMapLayers,rt as WebMapMain,ot as createToggleControl,ct as createWebMap,w as detectGeometryType,b as findMostFrequentGeomType,at as getWebMap,A as updateGeoJsonAdapterOptions};
//# sourceMappingURL=webmap.esm-browser.prod.js.map

@@ -15,3 +15,3 @@ import{getBoundsFeature as t,defined as e,deepmerge as r,deprecatedMapClick as n}from"@nextgis/utils";import{isPaint as o,preparePaint as i}from"@nextgis/paint";import{propertiesFilter as s}from"@nextgis/properties-filter";import{EventEmitter as a}from"events";import u from"@nextgis/cancelable-promise";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var l=function(){return(l=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function h(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(e){i(e)}}function a(t){try{u(n.throw(t))}catch(e){i(e)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function d(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(a){i=[6,a],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function y(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=y(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function m(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var o in r){r[o]>((void 0!==e?r[e]:0)||0)&&(e=o)}return e}function v(t){var e;if("FeatureCollection"===t.type)e=m(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=m(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var g={polygon:"path",line:"path",point:"circle"},L={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function _(t){if(t.data){var e=L[v(t.data)],r=t.paint;r&&o(r)&&(r.type=r.type?r.type:"polygon"===e||"line"===e?"path":"html"in r||"className"in r?"icon":g[e]),t.type=t.type||e}return t}var b=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},w=function(){function t(){this.keyCodeAlias=new b,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),C=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),A=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return c(e,t),e.prototype.getValue=function(){return this.webMap.getCenter()},e.prototype.setValue=function(t){this.webMap.setCenter(t)},e.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},e.prototype.parse=function(t){return t.split("_").map(Number)},e}(C),P=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return c(e,t),e.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},e.prototype.setValue=function(t){this.webMap.setZoom(t)},e.prototype.toString=function(t){return String(t)},e.prototype.parse=function(t){return Number(t)},e}(C);var k=0,O={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},S=function(){function o(t){this.options=O,this.emitter=new a,this.keys=o.keys,this.runtimeParams=[],this.getPaintFunctions=o.getPaintFunctions,this.mapState=[A,P],this.id=k++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=t.mapAdapter,this._starterKits=t.starterKits||[],t&&(this.options=r(O||{},t)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return o.prototype.getId=function(){return this.id},o.prototype.create=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},o.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},o.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},o.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},o.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,o=t.runtimeParams;n<o.length;n++){var i=o[n].get(r.name);if(void 0!==i){e[r.name]=r.parse(i);break}}})),e},o.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},o.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},o.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},o.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},o.prototype.getCenter=function(){return this.mapAdapter.getCenter()},o.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},o.prototype.getBoundsPolygon=function(){var e=this.getBounds();if(e)return t(e)},o.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},o.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},o.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},o.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},o.prototype.setView=function(t,r){if(Array.isArray(t)){var n=t;this.mapAdapter.setView&&n&&e(r)?this.mapAdapter.setView(n,r):(n&&this.mapAdapter.setCenter(n),e(r)&&this.mapAdapter.setZoom(r))}else{this.mapAdapter.setView&&this.mapAdapter.setView(t)}},o.prototype.fitBounds=function(t,r){return t.every((function(t){return e(t)}))&&(t[1]<-85.06&&(t[1]=-85.06),t[3]>85.06&&(t[3]=85.06),this.mapAdapter.fitBounds(t,r)),this},o.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},o.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},o.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,o=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},i=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&i?o():e.mapAdapter.emitter.once("create",(function(){o()}))}))},o.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},o.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},o.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},o.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},o.prototype.getCoordFromMapClick=function(){var t=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new u((function(e,r,o){var i=t.getCursor()||"grab";t._removeEventListeners({include:["click"]}),t.setCursor("crosshair");var s=function(){t.setCursor(i),t._addEventsListeners({include:["click"]}),t.mapAdapter.emitter.off("click",a),t._coordFromMapClickPromise=void 0},a=function(t){s(),n(t),e(t.lngLat)};t.mapAdapter.emitter.once("click",a),o(s)})),this._coordFromMapClickPromise)},o.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},o.prototype._addLayerProviders=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){return[2]}))}))},o.prototype._onLoadSync=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){return[2]}))}))},o.prototype._setupMap=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},o.prototype._setTileJsonOptions=function(t){t.center&&(this.options.center=t.center),t.bounds&&(this.options.bounds=t.bounds),e(t.maxzoom)&&(this.options.maxZoom=t.maxzoom,this.options.zoom=t.maxzoom),e(t.minzoom)&&(this.options.minZoom=t.minzoom,this.options.zoom=t.minzoom),e(t.maxzoom)&&e(t.minzoom)&&(this.options.zoom=(t.maxzoom+t.minzoom)/2)},o.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},o.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var o=0,i=this.runtimeParams;o<i.length;o++){var s=i[o].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},o.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var o=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,o)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},o.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},o.keys=new w,o}(),E=function(t){function r(e){var r=t.call(this,e)||this;r._layersIdCounter=1,r._layersOrderCounter=1,r._baselayers=[],r._layers={},r._selectedLayers=[];var n=r.options.tileJson;return n&&r.emitter.once("build-map",(function(){return r.addTileJsonLayer(n)})),r}return c(r,t),r.prototype.fitLayer=function(t,e){return h(this,void 0,void 0,(function(){var r,n,o;return d(this,(function(i){switch(i.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(o=i.sent())&&this.fitBounds(o,e),i.label=2;case 2:return[2]}}))}))},r.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},r.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},r.prototype.getBaseLayersIds=function(){return this._baselayers},r.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},r.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},r.prototype.getLayers=function(){return Object.keys(this._layers)},r.prototype.allLayers=function(){return this._layers},r.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},r.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},r.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},r.prototype.addBaseLayer=function(t,e){return h(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,this.addLayer(t,l(l({},e),{baselayer:!0}),void 0)];case 1:return[2,r.sent()]}}))}))},r.prototype.addLayer=function(t,r,n){var o,i;return void 0===r&&(r={}),h(this,void 0,void 0,(function(){var s,a,u,p,c,h,y,f,m,v,g,L;return d(this,(function(d){switch(d.label){case 0:return s=this._layersIdCounter++,a=e(n)?n:void 0!==r.order?r.order:this.reserveOrder(),"string"!=typeof t?[3,1]:(u=this.getLayerAdapter(t),[3,4]);case 1:return"function"!=typeof t?[3,2]:(u=t,[3,4]);case 2:return"then"in t?[4,t]:[3,4];case 3:u=d.sent(),d.label=4;case 4:return this._updateGeoJsonOptions(p=r),r=l({id:String(s),order:a},r),c=null===(o=r.visibility)||void 0===o||o,r.visibility=!1,r.baselayer&&(r.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:r,adapter:u}))&&(h.options&&(r=h.options),h.adapter&&(u=h.adapter)),void 0===u?[3,12]:((y=new u(this.mapAdapter.map,r)).options=l(l({},r),y.options),y.options.baselayer&&(r.baselayer=!0,r.order=0,y.options.order=0),f=void 0,y.options.id&&(f=String(y.options.id),this._layers[f]=y),this._emitLayerEvent("layer:preadd",f||"",y),[4,this.onMapLoad()]);case 5:return d.sent(),y.map=this.mapAdapter.map,[4,y.addLayer(y.options)];case 6:if(m=d.sent(),y.layer=m,y.id=y.options.id||String(s),y.options.id=y.id,r.baselayer&&(y.options.order=0),y.order=null!==(i=y.options.order)&&void 0!==i?i:a,f&&delete this._layers[f],f=String(y.id),this._layers[f])throw Error("layer with id '".concat(f,"' already exist"));return f?(this._layers[f]=y,p.filter&&this.filterLayer(y,p.filter),r.baselayer&&this._baselayers.push(f),c?[4,this.showLayer(f)]:[3,8]):[3,8];case 7:d.sent(),d.label=8;case 8:return void 0!==(v=r.opacity)&&v<=1&&this.setLayerOpacity(y,v),g=m&&(y.getBounds||y.getExtent),r.fit&&g?[4,g.call(y)]:[3,11];case 9:return(L=d.sent())?[4,this.fitBounds(L)]:[3,11];case 10:d.sent(),d.label=11;case 11:return r.onAdded&&r.onAdded(y),this._emitLayerEvent("layer:add",f,y),[2,y];case 12:return[2,Promise.reject("No adapter")]}}))}))},r.prototype.addLayerFromAsyncAdapter=function(t,e,r){return h(this,void 0,void 0,(function(){var n,o;return d(this,(function(i){switch(i.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(o=i.sent())?[2,this.addLayer(o,e,n)]:[2,Promise.reject("No adapter")]}}))}))},r.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},r.prototype.reserveOrder=function(){return this._layersOrderCounter++},r.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},r.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},r.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=_(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},r.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},r.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",l(l({},e),{url:t}))},r.prototype.addImageLayer=function(t,e){var r;return"string"==typeof t?r=t:(r=t.url,e=t),this.addLayer("IMAGE",l(l({},e),{url:r}))},r.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},r.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},r.prototype.toggleLayer=function(t,e,r){var n=this;void 0===r&&(r={});var o=this.getLayer(t),i=void 0!==e?e:!(o&&o.options.visibility),s=void 0!==r.silent&&r.silent;return o&&o.options.visibility!==i?this.onMapLoad().then((function(){return t=o,h(n,void 0,void 0,(function(){var e,r,n,o,a,u,p,c=this;return d(this,(function(l){switch(l.label){case 0:if(e=String(t.id),r=i?"layer:preshow":"layer:prehide",n=i?"layer:show":"layer:hide",s||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!i||!this.mapAdapter)return[3,9];if(o=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];a=this._baselayers.filter((function(e){return e!==t.id&&c.isLayerVisible(e)})),u=0,p=a,l.label=1;case 1:return u<p.length?[4,this.hideLayer(p[u])]:[3,4];case 2:l.sent(),l.label=3;case 3:return u++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return l.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:l.sent(),l.label=8;case 8:return void 0!==o&&this.mapAdapter.setLayerOrder(t.layer,o,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return l.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:l.sent(),l.label=13;case 13:return t.options.visibility=i,s||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},r.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},r.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},r.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},r.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var o=this.getLayerId(r);if(o){var i=this._selectedLayers.indexOf(o);-1!==i&&this._selectedLayers.splice(i,1)}}},r.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},r.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},r.prototype.propertiesFilter=function(t,e,r){var n=this.getLayer(t);if(n){var o=n;o.propertiesFilter?o.propertiesFilter(e,r):o.filter&&this.filterLayer(o,(function(t){return!t.feature||!t.feature.properties||s(t.feature.properties,e)}))}},r.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},r.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},r.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},r.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},r.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},r.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},r.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},r.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},r.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],o=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(o&&t.onlyBaselayer&&(o=this._baselayers.includes(r)),o){var i=n.options&&n.options.attribution;i&&e.push(i)}}return e},r.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},r.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},r.prototype._emitLayerEvent=function(t,r,n){var o=String(t);if(e(r)&&o.startsWith("layer:")){var i=o.replace("layer:","layer-"+r+":");this.emitter.emit(i,n)}this.emitter.emit(t,n)},r.prototype._onLayerClick=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},r.prototype._onLayerSelect=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},r.prototype._updateGeoJsonOptions=function(t){var r=this,n=t.onSelect,o=t.onLayerSelect,s=t.onMouseOut,a=t.onMouseOver,u=t.onClick||t.onLayerClick;t.onClick=function(t){return u&&u(t),r._onLayerClick(t)},t.onMouseOut=function(t){var n=t.layer.id;s&&s(t),e(n)&&r._emitLayerEvent("layer:mouseout",n,t)},t.onMouseOver=function(t){var n=t.layer.id;a&&a(t),e(n)&&r._emitLayerEvent("layer:mouseover",n,t)};var p=n||o;t.onSelect=function(t){return p&&p(t),r._onLayerSelect(t)},t.nativePaint||(this.options.paint&&(t.paint=i(t.paint||{},this.options.paint,this.getPaintFunctions)),t.selectedPaint&&this.options.selectedPaint&&(t.selectedPaint=i(t.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},r}(S);function x(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var o=e.title||"",i=e.html;function s(){o&&(r.title="string"==typeof o?o:n?o.on:o.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){i&&("string"==typeof i||i instanceof HTMLElement?a(i):a(n?i.on:i.off),r.setAttribute("aria-label",r.title))}function p(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function c(){e.addClassOn&&p(e.addClassOn,n),e.addClassOff&&p(e.addClassOff,!n)}s(),u(),e.addClass&&p(e.addClass,!0),c();var l=function(t){void 0!==t&&(n=t),u(),s(),c()},h=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},d=t({html:r,onClick:h});return d.onClick=h,d.changeStatus=l,d}var M=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return c(e,t),e.prototype.addControl=function(t,e,r){return h(this,void 0,void 0,(function(){var n,o=this;return d(this,(function(i){return e=null!=e?e:"top-left",(n="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){o._setControlQueue(e,(function(){return h(o,void 0,void 0,(function(){var r,o;return d(this,(function(i){switch(i.label){case 0:return[4,n];case 1:return r=i.sent(),o=this.mapAdapter.addControl(r,e),t(o),[2]}}))}))}))}))]:[2]}))}))},e.prototype.createControl=function(t,e){return h(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},e.prototype.createButtonControl=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},e.prototype.createToggleControl=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,x(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},e.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},e.prototype.getControl=function(t,r){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(r);var o=e.controls[t];return o?o(this,r):void 0},e.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},e.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},e.prototype._applyControls=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},e.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},e}(E),B={};function z(t){return B[t]}var F=function(t){function e(e){var r=t.call(this,e)||this;return r._addControls(),B[r.id]=r,r}return c(e,t),e.get=function(t){return z(t)},e.prototype._addLayerProviders=function(){var t,e,r,n;return h(this,void 0,void 0,(function(){var o,i,s,a,u,p,c,l,h,y;return d(this,(function(d){switch(d.label){case 0:d.trys.push([0,18,19,24]),o=f(this._starterKits),d.label=1;case 1:return[4,o.next()];case 2:return(i=d.sent()).done?[3,17]:(s=i.value).getLayerAdapters?[4,s.getLayerAdapters.call(s)]:[3,16];case 3:if(!(a=d.sent()))return[3,16];d.label=4;case 4:d.trys.push([4,10,11,16]),r=void 0,u=f(a),d.label=5;case 5:return[4,u.next()];case 6:return(p=d.sent()).done?[3,9]:[4,(c=p.value).createAdapter(this)];case 7:(l=d.sent())&&(this.mapAdapter.layerAdapters[c.name]=l),d.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return h=d.sent(),r={error:h},[3,16];case 11:return d.trys.push([11,,14,15]),p&&!p.done&&(n=u.return)?[4,n.call(u)]:[3,13];case 12:d.sent(),d.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return y=d.sent(),t={error:y},[3,24];case 19:return d.trys.push([19,,22,23]),i&&!i.done&&(e=o.return)?[4,e.call(o)]:[3,21];case 20:d.sent(),d.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},e.prototype._onLoadSync=function(){var t,e;return h(this,void 0,void 0,(function(){var r,n,o,i,s;return d(this,(function(a){switch(a.label){case 0:a.trys.push([0,8,9,14]),r=f(this._starterKits),a.label=1;case 1:return[4,r.next()];case 2:if((n=a.sent()).done)return[3,7];if(!(o=n.value).onLoadSync)return[3,6];a.label=3;case 3:return a.trys.push([3,5,,6]),[4,o.onLoadSync.call(o,this)];case 4:return a.sent(),[3,6];case 5:return i=a.sent(),console.error(i),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return s=a.sent(),t={error:s},[3,14];case 9:return a.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:a.sent(),a.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},e.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var o=n.position,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["position"]);t.addControl(r,o||"top-left",i)})),this._emitStatusEvent("controls:create")},e}(M);function T(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){return[2,new F(t).onLoad()]}))}))}export{F as WebMap,M as WebMapControls,E as WebMapLayers,S as WebMapMain,x as createToggleControl,T as createWebMap,v as detectGeometryType,m as findMostFrequentGeomType,z as getWebMap,_ as updateGeoJsonAdapterOptions};
***************************************************************************** */var p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var l=function(){return(l=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function h(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(e){i(e)}}function a(t){try{u(n.throw(t))}catch(e){i(e)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function d(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(a){i=[6,a],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function y(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=y(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function m(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var o in r){r[o]>((void 0!==e?r[e]:0)||0)&&(e=o)}return e}function v(t){var e;if("FeatureCollection"===t.type)e=m(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=m(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var g={polygon:"path",line:"path",point:"circle"},L={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function _(t){if(t.data){var e=L[v(t.data)],r=t.paint;r&&o(r)&&(r.type=r.type?r.type:"polygon"===e||"line"===e?"path":"html"in r||"className"in r?"icon":g[e]),t.type=t.type||e}return t}var b=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},w=function(){function t(){this.keyCodeAlias=new b,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),C=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),A=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return c(e,t),e.prototype.getValue=function(){return this.webMap.getCenter()},e.prototype.setValue=function(t){this.webMap.setCenter(t)},e.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},e.prototype.parse=function(t){return t.split("_").map(Number)},e}(C),P=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return c(e,t),e.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},e.prototype.setValue=function(t){this.webMap.setZoom(t)},e.prototype.toString=function(t){return String(t)},e.prototype.parse=function(t){return Number(t)},e}(C);var k=0,O={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},S=function(){function o(t){this.options=O,this.emitter=new a,this.keys=o.keys,this.runtimeParams=[],this.getPaintFunctions=o.getPaintFunctions,this.mapState=[A,P],this.id=k++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=t.mapAdapter,this._starterKits=t.starterKits||[],t&&(this.options=r(O||{},t)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return o.prototype.getId=function(){return this.id},o.prototype.create=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},o.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},o.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},o.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},o.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,o=t.runtimeParams;n<o.length;n++){var i=o[n].get(r.name);if(void 0!==i){e[r.name]=r.parse(i);break}}})),e},o.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},o.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},o.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},o.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},o.prototype.getCenter=function(){return this.mapAdapter.getCenter()},o.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},o.prototype.getBoundsPolygon=function(){var e=this.getBounds();if(e)return t(e)},o.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},o.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},o.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},o.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},o.prototype.setView=function(t,r){if(Array.isArray(t)){var n=t;this.mapAdapter.setView&&n&&e(r)?this.mapAdapter.setView(n,r):(n&&this.mapAdapter.setCenter(n),e(r)&&this.mapAdapter.setZoom(r))}else{this.mapAdapter.setView&&this.mapAdapter.setView(t)}},o.prototype.fitBounds=function(t,r){return t.every((function(t){return e(t)}))&&(t[1]<-85.06&&(t[1]=-85.06),t[3]>85.06&&(t[3]=85.06),this.mapAdapter.fitBounds(t,r)),this},o.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},o.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},o.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,o=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},i=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&i?o():e.mapAdapter.emitter.once("create",(function(){o()}))}))},o.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},o.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},o.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},o.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},o.prototype.getCoordFromMapClick=function(){var t=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new u((function(e,r,o){var i=t.getCursor()||"grab";t._removeEventListeners({include:["click"]}),t.setCursor("crosshair");var s=function(){t.setCursor(i),t._addEventsListeners({include:["click"]}),t.mapAdapter.emitter.off("click",a),t._coordFromMapClickPromise=void 0},a=function(t){s(),n(t),e(t.lngLat)};t.mapAdapter.emitter.once("click",a),o(s)})),this._coordFromMapClickPromise)},o.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},o.prototype._addLayerProviders=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){return[2]}))}))},o.prototype._onLoadSync=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){return[2]}))}))},o.prototype._setupMap=function(){return h(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},o.prototype._setTileJsonOptions=function(t){t.center&&(this.options.center=t.center),t.bounds&&(this.options.bounds=t.bounds),e(t.maxzoom)&&(this.options.maxZoom=t.maxzoom,this.options.zoom=t.maxzoom),e(t.minzoom)&&(this.options.minZoom=t.minzoom,this.options.zoom=t.minzoom),e(t.maxzoom)&&e(t.minzoom)&&(this.options.zoom=(t.maxzoom+t.minzoom)/2)},o.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},o.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var o=0,i=this.runtimeParams;o<i.length;o++){var s=i[o].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},o.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend","mousemove","mouseout","mouseover"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var o=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,o)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},o.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},o.keys=new w,o}(),E=function(t){function r(e){var r=t.call(this,e)||this;r._layersIdCounter=1,r._layersOrderCounter=1,r._baselayers=[],r._layers={},r._selectedLayers=[];var n=r.options.tileJson;return n&&r.emitter.once("build-map",(function(){return r.addTileJsonLayer(n)})),r}return c(r,t),r.prototype.fitLayer=function(t,e){return h(this,void 0,void 0,(function(){var r,n,o;return d(this,(function(i){switch(i.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(o=i.sent())&&this.fitBounds(o,e),i.label=2;case 2:return[2]}}))}))},r.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},r.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},r.prototype.getBaseLayersIds=function(){return this._baselayers},r.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},r.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},r.prototype.getLayers=function(){return Object.keys(this._layers)},r.prototype.allLayers=function(){return this._layers},r.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},r.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},r.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},r.prototype.addBaseLayer=function(t,e){return h(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,this.addLayer(t,l(l({},e),{baselayer:!0}),void 0)];case 1:return[2,r.sent()]}}))}))},r.prototype.addLayer=function(t,r,n){var o,i;return void 0===r&&(r={}),h(this,void 0,void 0,(function(){var s,a,u,p,c,h,y,f,m,v,g,L;return d(this,(function(d){switch(d.label){case 0:return s=this._layersIdCounter++,a=e(n)?n:void 0!==r.order?r.order:this.reserveOrder(),"string"!=typeof t?[3,1]:(u=this.getLayerAdapter(t),[3,4]);case 1:return"function"!=typeof t?[3,2]:(u=t,[3,4]);case 2:return"then"in t?[4,t]:[3,4];case 3:u=d.sent(),d.label=4;case 4:return this._updateGeoJsonOptions(p=r),r=l({id:String(s),order:a},r),c=null===(o=r.visibility)||void 0===o||o,r.visibility=!1,r.baselayer&&(r.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:r,adapter:u}))&&(h.options&&(r=h.options),h.adapter&&(u=h.adapter)),void 0===u?[3,12]:((y=new u(this.mapAdapter.map,r)).options=l(l({},r),y.options),y.options.baselayer&&(r.baselayer=!0,r.order=0,y.options.order=0),f=void 0,y.options.id&&(f=String(y.options.id),this._layers[f]=y),this._emitLayerEvent("layer:preadd",f||"",y),[4,this.onMapLoad()]);case 5:return d.sent(),y.map=this.mapAdapter.map,[4,y.addLayer(y.options)];case 6:if(m=d.sent(),y.layer=m,y.id=y.options.id||String(s),y.options.id=y.id,r.baselayer&&(y.options.order=0),y.order=null!==(i=y.options.order)&&void 0!==i?i:a,f&&delete this._layers[f],f=String(y.id),this._layers[f])throw Error("layer with id '".concat(f,"' already exist"));return f?(this._layers[f]=y,p.filter&&this.filterLayer(y,p.filter),r.baselayer&&this._baselayers.push(f),c?[4,this.showLayer(f)]:[3,8]):[3,8];case 7:d.sent(),d.label=8;case 8:return void 0!==(v=r.opacity)&&v<=1&&this.setLayerOpacity(y,v),g=m&&(y.getBounds||y.getExtent),r.fit&&g?[4,g.call(y)]:[3,11];case 9:return(L=d.sent())?[4,this.fitBounds(L)]:[3,11];case 10:d.sent(),d.label=11;case 11:return r.onAdded&&r.onAdded(y),this._emitLayerEvent("layer:add",f,y),[2,y];case 12:return[2,Promise.reject("No adapter")]}}))}))},r.prototype.addLayerFromAsyncAdapter=function(t,e,r){return h(this,void 0,void 0,(function(){var n,o;return d(this,(function(i){switch(i.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(o=i.sent())?[2,this.addLayer(o,e,n)]:[2,Promise.reject("No adapter")]}}))}))},r.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},r.prototype.reserveOrder=function(){return this._layersOrderCounter++},r.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},r.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},r.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=_(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},r.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},r.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",l(l({},e),{url:t}))},r.prototype.addImageLayer=function(t,e){var r;return"string"==typeof t?r=t:(r=t.url,e=t),this.addLayer("IMAGE",l(l({},e),{url:r}))},r.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},r.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},r.prototype.toggleLayer=function(t,e,r){var n=this;void 0===r&&(r={});var o=this.getLayer(t),i=void 0!==e?e:!(o&&o.options.visibility),s=void 0!==r.silent&&r.silent;return o&&o.options.visibility!==i?this.onMapLoad().then((function(){return t=o,h(n,void 0,void 0,(function(){var e,r,n,o,a,u,p,c=this;return d(this,(function(l){switch(l.label){case 0:if(e=String(t.id),r=i?"layer:preshow":"layer:prehide",n=i?"layer:show":"layer:hide",s||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!i||!this.mapAdapter)return[3,9];if(o=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];a=this._baselayers.filter((function(e){return e!==t.id&&c.isLayerVisible(e)})),u=0,p=a,l.label=1;case 1:return u<p.length?[4,this.hideLayer(p[u])]:[3,4];case 2:l.sent(),l.label=3;case 3:return u++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return l.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:l.sent(),l.label=8;case 8:return void 0!==o&&this.mapAdapter.setLayerOrder(t.layer,o,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return l.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:l.sent(),l.label=13;case 13:return t.options.visibility=i,s||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},r.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},r.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},r.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},r.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var o=this.getLayerId(r);if(o){var i=this._selectedLayers.indexOf(o);-1!==i&&this._selectedLayers.splice(i,1)}}},r.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},r.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},r.prototype.propertiesFilter=function(t,e,r){var n=this.getLayer(t);if(n){var o=n;o.propertiesFilter?o.propertiesFilter(e,r):o.filter&&this.filterLayer(o,(function(t){return!t.feature||!t.feature.properties||s(t.feature.properties,e)}))}},r.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},r.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},r.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},r.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},r.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},r.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},r.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},r.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},r.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],o=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(o&&t.onlyBaselayer&&(o=this._baselayers.includes(r)),o){var i=n.options&&n.options.attribution;i&&e.push(i)}}return e},r.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},r.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},r.prototype._emitLayerEvent=function(t,r,n){var o=String(t);if(e(r)&&o.startsWith("layer:")){var i=o.replace("layer:","layer-"+r+":");this.emitter.emit(i,n)}this.emitter.emit(t,n)},r.prototype._onLayerClick=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},r.prototype._onLayerSelect=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},r.prototype._updateGeoJsonOptions=function(t){var r=this,n=t.onSelect,o=t.onLayerSelect,s=t.onMouseOut,a=t.onMouseOver,u=t.onClick||t.onLayerClick;t.onClick=function(t){return u&&u(t),r._onLayerClick(t)},t.onMouseOut=function(t){var n=t.layer.id;s&&s(t),e(n)&&r._emitLayerEvent("layer:mouseout",n,t)},t.onMouseOver=function(t){var n=t.layer.id;a&&a(t),e(n)&&r._emitLayerEvent("layer:mouseover",n,t)};var p=n||o;t.onSelect=function(t){return p&&p(t),r._onLayerSelect(t)},t.nativePaint||(this.options.paint&&(t.paint=i(t.paint||{},this.options.paint,this.getPaintFunctions)),t.selectedPaint&&this.options.selectedPaint&&(t.selectedPaint=i(t.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},r}(S);function x(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var o=e.title||"",i=e.html;function s(){o&&(r.title="string"==typeof o?o:n?o.on:o.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){i&&("string"==typeof i||i instanceof HTMLElement?a(i):a(n?i.on:i.off),r.setAttribute("aria-label",r.title))}function p(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function c(){e.addClassOn&&p(e.addClassOn,n),e.addClassOff&&p(e.addClassOff,!n)}s(),u(),e.addClass&&p(e.addClass,!0),c();var l=function(t){void 0!==t&&(n=t),u(),s(),c()},h=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},d=t({html:r,onClick:h});return d.onClick=h,d.changeStatus=l,d}var M=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return c(e,t),e.prototype.addControl=function(t,e,r){return h(this,void 0,void 0,(function(){var n,o=this;return d(this,(function(i){return e=null!=e?e:"top-left",(n="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){o._setControlQueue(e,(function(){return h(o,void 0,void 0,(function(){var r,o;return d(this,(function(i){switch(i.label){case 0:return[4,n];case 1:return r=i.sent(),o=this.mapAdapter.addControl(r,e),t(o),[2]}}))}))}))}))]:[2]}))}))},e.prototype.createControl=function(t,e){return h(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},e.prototype.createButtonControl=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},e.prototype.createToggleControl=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,x(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},e.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},e.prototype.getControl=function(t,r){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(r);var o=e.controls[t];return o?o(this,r):void 0},e.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},e.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},e.prototype._applyControls=function(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},e.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},e}(E),B={};function z(t){return B[t]}var F=function(t){function e(e){var r=t.call(this,e)||this;return r._addControls(),B[r.id]=r,r}return c(e,t),e.get=function(t){return z(t)},e.prototype._addLayerProviders=function(){var t,e,r,n;return h(this,void 0,void 0,(function(){var o,i,s,a,u,p,c,l,h,y;return d(this,(function(d){switch(d.label){case 0:d.trys.push([0,18,19,24]),o=f(this._starterKits),d.label=1;case 1:return[4,o.next()];case 2:return(i=d.sent()).done?[3,17]:(s=i.value).getLayerAdapters?[4,s.getLayerAdapters.call(s)]:[3,16];case 3:if(!(a=d.sent()))return[3,16];d.label=4;case 4:d.trys.push([4,10,11,16]),r=void 0,u=f(a),d.label=5;case 5:return[4,u.next()];case 6:return(p=d.sent()).done?[3,9]:[4,(c=p.value).createAdapter(this)];case 7:(l=d.sent())&&(this.mapAdapter.layerAdapters[c.name]=l),d.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return h=d.sent(),r={error:h},[3,16];case 11:return d.trys.push([11,,14,15]),p&&!p.done&&(n=u.return)?[4,n.call(u)]:[3,13];case 12:d.sent(),d.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return y=d.sent(),t={error:y},[3,24];case 19:return d.trys.push([19,,22,23]),i&&!i.done&&(e=o.return)?[4,e.call(o)]:[3,21];case 20:d.sent(),d.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},e.prototype._onLoadSync=function(){var t,e;return h(this,void 0,void 0,(function(){var r,n,o,i,s;return d(this,(function(a){switch(a.label){case 0:a.trys.push([0,8,9,14]),r=f(this._starterKits),a.label=1;case 1:return[4,r.next()];case 2:if((n=a.sent()).done)return[3,7];if(!(o=n.value).onLoadSync)return[3,6];a.label=3;case 3:return a.trys.push([3,5,,6]),[4,o.onLoadSync.call(o,this)];case 4:return a.sent(),[3,6];case 5:return i=a.sent(),console.error(i),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return s=a.sent(),t={error:s},[3,14];case 9:return a.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:a.sent(),a.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},e.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var o=n.position,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["position"]);t.addControl(r,o||"top-left",i)})),this._emitStatusEvent("controls:create")},e}(M);function T(t){return h(this,void 0,void 0,(function(){return d(this,(function(e){return[2,new F(t).onLoad()]}))}))}export{F as WebMap,M as WebMapControls,E as WebMapLayers,S as WebMapMain,x as createToggleControl,T as createWebMap,v as detectGeometryType,m as findMostFrequentGeomType,z as getWebMap,_ as updateGeoJsonAdapterOptions};
//# sourceMappingURL=webmap.esm-bundler.prod.js.map

@@ -15,3 +15,3 @@ var WebMap=function(t){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function o(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(e){i(e)}}function a(t){try{u(n.throw(t))}catch(e){i(e)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(a){i=[6,a],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function s(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=s(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function u(t){return null!=t}function c(t,e,r){void 0===r&&(r=!1);var n=t,o=e,i=Array.isArray(o),s=i&&[]||{};return i&&Array.isArray(o)?r?(s=s.concat(n=n||[]),o.forEach((function(t,e){void 0===s[e]?s[e]=t:"object"==typeof t?s[e]=c(n[e],t,r):-1===n.indexOf(t)&&s.push(t)}))):s=o:(n&&"object"==typeof n&&Object.keys(n).forEach((function(t){s[t]=n[t]})),Object.keys(o).forEach((function(t){s[t]="object"==typeof o[t]&&o[t]&&"object"==typeof n[t]&&"object"==typeof o[t]?c(n[t],o[t],r):o[t]}))),s}function p(t){return{type:"Polygon",coordinates:[l(t)]}}function l(t){var e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function f(t){return"function"==typeof t}var h={get:function(t,e){return t.properties&&t.properties[e[0]]},match:function(t,e){var r=e[0],n=e.slice(1),o=r;Array.isArray(r)&&(o=d(t,r));for(var i=n.splice(-1,n.length%2)[0],s=0;s<n.length-1;s+=2){if(n[s]===o)return n[s+1]}return i}};function d(t,e){var r=e[0],n=e.slice(1),o=h[r];if(o)return o(t,n)}function y(t){return function(e){return d(e,t)}}var v=["iconSize","iconAnchor"];function m(t,e,r){if((e=String(e))===(t=String(t)))return!0;if(r&&e.toUpperCase()===t.toUpperCase())return!0;var n,o="^".concat((n=e,n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(o,r?"i":"").exec(t)}var g={gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},eq:function(t,e){return t===e},ne:function(t,e){return t!==e},in:function(t,e){return-1!==e.indexOf(t)},notin:function(t,e){return-1===e.indexOf(t)},like:function(t,e){return m(t,e)},ilike:function(t,e){return m(t,e,!0)}};function _(t,e){var r="string"==typeof e[0]?e[0]:"all",n=function(e){if(3===(u=e).length&&"string"==typeof u[0]&&"string"==typeof u[1]){var r=e[0],n=e[1],o=e[2],i=g[n];if(i){if(("like"===n||"ilike"===n)&&"string"==typeof r){var s="",a=r.replace(/^%?(\w+)%?$/,(function(e,n){return s=t[n],r.replace(n,o)}));return i(s,a)}return i(t[r],o)}return!1}return _(t,e);var u},o=e.filter((function(t){return Array.isArray(t)}));return"any"===r?o.some(n):o.every(n)}function L(t){var e={},r=[];return t.forEach((function(t){t&&(Array.isArray(t)?r.push(t):e=t)})),function(t){var o=r.find((function(e){return function(t,e){var r=n({},t.properties);return!!r&&(r.$id=t.id,_(r,e))}(t,e[0])}));return o?n(n({},e),o[1]):e}}function b(t,e,r){if(!t)throw new Error("paint is empty");var o=n({},e);if(f(t)){var i=function(n){var o=b(t(n),e,r);return o.type=t.type,o};return i.type=t.type,i}if(function(t){return!!Array.isArray(t)}(t))return function(n){return b(L(t)(n),e,r)};if("get-paint"===t.type){var s=function(t,e){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&e){var r=e[t.from];if(r)return r(t.options)}}(t,r);s&&(o=b(s,e,r))}else{if("icon"===t.type)return t;var a=function(t){var e=!1,r={};for(var o in t)if(-1===v.indexOf(o)){var i=o,s=t[i];Array.isArray(s)&&(e=!0,r[i]=y(s))}if(e)return function(e){var o={};for(var i in r)o[i]=r[i](e);return n(n({},t),o)}}(t);if(a)return function(t){return b(a(t),e,r)};(o=n(n({},o),t)).fill=void 0===o.fill||o.fill,o.stroke=void 0!==o.stroke?o.stroke:!o.fill||!(!o.strokeColor&&!o.strokeOpacity)}return f(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}function w(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var o in r){r[o]>((void 0!==e?r[e]:0)||0)&&(e=o)}return e}function C(t){var e;if("FeatureCollection"===t.type)e=w(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=w(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var P={polygon:"path",line:"path",point:"circle"},A={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function O(t){if(t.data){var e=A[C(t.data)],r=t.paint;r&&"[object Object]"===Object.prototype.toString.call(r)&&(r.type=r.type?r.type:"polygon"===e||"line"===e?"path":"html"in r||"className"in r?"icon":P[e]),t.type=t.type||e}return t}var E,k={exports:{}},S="object"==typeof Reflect?Reflect:null,x=S&&"function"==typeof S.apply?S.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};E=S&&"function"==typeof S.ownKeys?S.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var M=Number.isNaN||function(t){return t!=t};function j(){j.init.call(this)}k.exports=j,k.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}N(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&N(t,"error",e,r)}(t,o,{once:!0})}))},j.EventEmitter=j,j.prototype._events=void 0,j.prototype._eventsCount=0,j.prototype._maxListeners=void 0;var T=10;function F(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function z(t){return void 0===t._maxListeners?j.defaultMaxListeners:t._maxListeners}function B(t,e,r,n){var o,i,s,a;if(F(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=z(t))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function I(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function V(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=I.bind(n);return o.listener=r,n.wrapFn=o,o}function R(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):G(o,o.length)}function Z(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function G(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function N(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(j,"defaultMaxListeners",{enumerable:!0,get:function(){return T},set:function(t){if("number"!=typeof t||t<0||M(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");T=t}}),j.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},j.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||M(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},j.prototype.getMaxListeners=function(){return z(this)},j.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var a=o[t];if(void 0===a)return!1;if("function"==typeof a)x(a,this,e);else{var u=a.length,c=G(a,u);for(r=0;r<u;++r)x(c[r],this,e)}return!0},j.prototype.on=j.prototype.addListener=function(t,e){return B(this,t,e,!1)},j.prototype.prependListener=function(t,e){return B(this,t,e,!0)},j.prototype.once=function(t,e){return F(e),this.on(t,V(this,t,e)),this},j.prototype.prependOnceListener=function(t,e){return F(e),this.prependListener(t,V(this,t,e)),this},j.prototype.off=j.prototype.removeListener=function(t,e){var r,n,o,i,s;if(F(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},j.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},j.prototype.listeners=function(t){return R(this,t,!0)},j.prototype.rawListeners=function(t){return R(this,t,!1)},j.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):Z.call(t,e)},j.prototype.listenerCount=Z,j.prototype.eventNames=function(){return this._eventsCount>0?E(this._events):[]};var J=function(t){function e(){var r=t.call(this)||this;return r.name="CancelError",Object.setPrototypeOf(r,e.prototype),r}return r(e,t),e}(Error),W=function(){function t(t){void 0===t&&(t={}),this.options=t,this._promises=new Map}return Object.defineProperty(t.prototype,"isLoaded",{get:function(){return this._promises.size>0},enumerable:!1,configurable:!0}),t.prototype.remove=function(t){this._promises.has(t)&&(this._promises.delete(t),this._onStop())},t.prototype.get=function(t){return this._promises.get(t)},t.prototype.add=function(t,e){var r=this,n=e||t,o=this._promises.get(n);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),o||(this._promises.set(n,t),t.finally((function(){r.remove(n)})),t)},t.prototype.abort=function(){this.isLoaded&&(this._promises.forEach((function(t){t.cancel&&t.cancel()})),this._promises.clear(),this._onStop())},t.prototype.waitFunc=function(t,e){void 0===e&&(e="");var r=this.get(e=e||t.name);return r||this.add(t(),e)},t.prototype.WaitForMe=function(t){void 0===t&&(t="");var e=this.get.bind(this),r=this.add.bind(this);return function(n,o,i){var s=i.value;return t=t||o,i.value=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e(t);if(i)return i;var a=r(s.apply(this,n),t);return a},i}},t.prototype.GetOrCreateDecorator=function(t){return void 0===t&&(t=""),this.WaitForMe(t)},t.prototype._onStop=function(){this.options.onStop&&!this.isLoaded&&this.options.onStop()},t}(),D=function(t){function e(){var r=t.call(this)||this;return r.name="TimeoutError",Object.setPrototypeOf(r,e.prototype),r}return r(e,t),e}(Error),H=function(t,e,r,n){try{t(r(n))}catch(o){e(o)}},K=0,Q=function(){function t(e,r){var n=this;this.id=K++,this._isCanceled=!1,this._isPending=!0,this._cancelHandlers=[],this._children=[],this._cancelPromise=new Promise((function(t,e){n._setCanceledCallback=function(e){return t(e||new J)}}));var o=[this._cancelPromise,new Promise((function(r,o){return e((function(e){e instanceof t?n.attach(e):n._isPending=!1,r(e)}),(function(t){n._isPending=!1,o(t)}),(function(t){if(!n._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");n._cancelHandlers.push(t)}))}))];r&&o.push(new Promise((function(t,e){setTimeout((function(){if(n._isPending)try{n.cancel()}finally{e(new D)}}),r)}))),this._promise=Promise.race(o)}return t.createControl=function(t){return new W(t)},t.resolve=function(e){return new t((function(t){return t(e)}))},t.reject=function(e){return new t((function(t,r){return r(e)}))},t.all=function(e){var r=this;return new t((function(t,r){Promise.all(e).then(t).catch(r)})).catch((function(t){if(t instanceof r.CancelError)for(var n=0,o=e;n<o.length;n++){var i=o[n];"cancel"in i&&i.cancel()}throw t}))},t.prototype.attach=function(t){this._isCanceled?t.cancel():this._children.push(t)},t.prototype.then=function(e,r){var n=this,o=new t((function(t,o){if(n._promise){var i=function(e){r?H(t,o,r,e):o(e)};n._promise.then((function(r){n._isCanceled?i(r):e?H(t,o,e,r):t(r)}),i)}}));return o._parentPromise=this,this._children.push(o),o},t.prototype.catch=function(t){return this._isCanceled&&t&&t(new J),this.then(void 0,t)},t.prototype.finally=function(t){return this._promise?this._promise.finally(t):Promise.reject(this._isCanceled?new J:t)},t.prototype.cancel=function(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;var t=this._getTopParent();if(t&&t.cancel(),this._children&&this._children.forEach((function(t){return t.cancel()})),this._isPending){if(this._cancelHandlers.length)try{for(var e=0,r=this._cancelHandlers;e<r.length;e++){(0,r[e])()}}catch(n){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this},t.prototype._getTopParent=function(){for(var t=this._parentPromise,e=!!t;e;)e=!(!t||!t._parentPromise)&&!!(t=t._parentPromise);return t},t.prototype._destroy=function(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0},t.CancelError=J,t.TimeoutError=D,t.PromiseControl=W,t}();Object.setPrototypeOf(Q.prototype,Promise.prototype);var U=Q,$=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},q=function(){function t(){this.keyCodeAlias=new $,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),X=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),Y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return r(e,t),e.prototype.getValue=function(){return this.webMap.getCenter()},e.prototype.setValue=function(t){this.webMap.setCenter(t)},e.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},e.prototype.parse=function(t){return t.split("_").map(Number)},e}(X),tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return r(e,t),e.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},e.prototype.setValue=function(t){this.webMap.setZoom(t)},e.prototype.toString=function(t){return String(t)},e.prototype.parse=function(t){return Number(t)},e}(X);var et=0,rt={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},nt=function(){function t(e){this.options=rt,this.emitter=new k.exports.EventEmitter,this.keys=t.keys,this.runtimeParams=[],this.getPaintFunctions=t.getPaintFunctions,this.mapState=[Y,tt],this.id=et++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=e.mapAdapter,this._starterKits=e.starterKits||[],e&&(this.options=c(rt||{},e)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return t.prototype.getId=function(){return this.id},t.prototype.create=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},t.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},t.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},t.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},t.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,o=t.runtimeParams;n<o.length;n++){var i=o[n].get(r.name);if(void 0!==i){e[r.name]=r.parse(i);break}}})),e},t.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},t.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},t.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},t.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},t.prototype.getCenter=function(){return this.mapAdapter.getCenter()},t.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},t.prototype.getBoundsPolygon=function(){var t=this.getBounds();if(t)return{type:"Feature",properties:{},geometry:p(t)}},t.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},t.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},t.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},t.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},t.prototype.setView=function(t,e){if(Array.isArray(t)){var r=t;this.mapAdapter.setView&&r&&u(e)?this.mapAdapter.setView(r,e):(r&&this.mapAdapter.setCenter(r),u(e)&&this.mapAdapter.setZoom(e))}else{this.mapAdapter.setView&&this.mapAdapter.setView(t)}},t.prototype.fitBounds=function(t,e){return t.every((function(t){return u(t)}))&&(t[1]<-85.06&&(t[1]=-85.06),t[3]>85.06&&(t[3]=85.06),this.mapAdapter.fitBounds(t,e)),this},t.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},t.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},t.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,o=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},i=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&i?o():e.mapAdapter.emitter.once("create",(function(){o()}))}))},t.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},t.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},t.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},t.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},t.prototype.getCoordFromMapClick=function(){var t=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new U((function(e,r,n){var o=t.getCursor()||"grab";t._removeEventListeners({include:["click"]}),t.setCursor("crosshair");var i=function(){t.setCursor(o),t._addEventsListeners({include:["click"]}),t.mapAdapter.emitter.off("click",s),t._coordFromMapClickPromise=void 0},s=function(t){var r;i(),!(r=t).lngLat&&r.latLng&&(r.lngLat=[r.latLng.lng,r.latLng.lat]),e(t.lngLat)};t.mapAdapter.emitter.once("click",s),n(i)})),this._coordFromMapClickPromise)},t.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},t.prototype._addLayerProviders=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2]}))}))},t.prototype._onLoadSync=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2]}))}))},t.prototype._setupMap=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},t.prototype._setTileJsonOptions=function(t){t.center&&(this.options.center=t.center),t.bounds&&(this.options.bounds=t.bounds),u(t.maxzoom)&&(this.options.maxZoom=t.maxzoom,this.options.zoom=t.maxzoom),u(t.minzoom)&&(this.options.minZoom=t.minzoom,this.options.zoom=t.minzoom),u(t.maxzoom)&&u(t.minzoom)&&(this.options.zoom=(t.maxzoom+t.minzoom)/2)},t.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},t.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var o=0,i=this.runtimeParams;o<i.length;o++){var s=i[o].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},t.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var o=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,o)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},t.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},t.keys=new q,t}(),ot=function(t){function e(e){var r=t.call(this,e)||this;r._layersIdCounter=1,r._layersOrderCounter=1,r._baselayers=[],r._layers={},r._selectedLayers=[];var n=r.options.tileJson;return n&&r.emitter.once("build-map",(function(){return r.addTileJsonLayer(n)})),r}return r(e,t),e.prototype.fitLayer=function(t,e){return o(this,void 0,void 0,(function(){var r,n,o;return i(this,(function(i){switch(i.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(o=i.sent())&&this.fitBounds(o,e),i.label=2;case 2:return[2]}}))}))},e.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},e.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},e.prototype.getBaseLayersIds=function(){return this._baselayers},e.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},e.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},e.prototype.getLayers=function(){return Object.keys(this._layers)},e.prototype.allLayers=function(){return this._layers},e.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},e.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},e.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},e.prototype.addBaseLayer=function(t,e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,this.addLayer(t,n(n({},e),{baselayer:!0}),void 0)];case 1:return[2,r.sent()]}}))}))},e.prototype.addLayer=function(t,e,r){var s,a;return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var o,c,p,l,f,h,d,y,v,m,g,_;return i(this,(function(i){switch(i.label){case 0:return o=this._layersIdCounter++,c=u(r)?r:void 0!==e.order?e.order:this.reserveOrder(),"string"!=typeof t?[3,1]:(p=this.getLayerAdapter(t),[3,4]);case 1:return"function"!=typeof t?[3,2]:(p=t,[3,4]);case 2:return"then"in t?[4,t]:[3,4];case 3:p=i.sent(),i.label=4;case 4:return this._updateGeoJsonOptions(l=e),e=n({id:String(o),order:c},e),f=null===(s=e.visibility)||void 0===s||s,e.visibility=!1,e.baselayer&&(e.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:e,adapter:p}))&&(h.options&&(e=h.options),h.adapter&&(p=h.adapter)),void 0===p?[3,12]:((d=new p(this.mapAdapter.map,e)).options=n(n({},e),d.options),d.options.baselayer&&(e.baselayer=!0,e.order=0,d.options.order=0),y=void 0,d.options.id&&(y=String(d.options.id),this._layers[y]=d),this._emitLayerEvent("layer:preadd",y||"",d),[4,this.onMapLoad()]);case 5:return i.sent(),d.map=this.mapAdapter.map,[4,d.addLayer(d.options)];case 6:if(v=i.sent(),d.layer=v,d.id=d.options.id||String(o),d.options.id=d.id,e.baselayer&&(d.options.order=0),d.order=null!==(a=d.options.order)&&void 0!==a?a:c,y&&delete this._layers[y],y=String(d.id),this._layers[y])throw Error("layer with id '".concat(y,"' already exist"));return y?(this._layers[y]=d,l.filter&&this.filterLayer(d,l.filter),e.baselayer&&this._baselayers.push(y),f?[4,this.showLayer(y)]:[3,8]):[3,8];case 7:i.sent(),i.label=8;case 8:return void 0!==(m=e.opacity)&&m<=1&&this.setLayerOpacity(d,m),g=v&&(d.getBounds||d.getExtent),e.fit&&g?[4,g.call(d)]:[3,11];case 9:return(_=i.sent())?[4,this.fitBounds(_)]:[3,11];case 10:i.sent(),i.label=11;case 11:return e.onAdded&&e.onAdded(d),this._emitLayerEvent("layer:add",y,d),[2,d];case 12:return[2,Promise.reject("No adapter")]}}))}))},e.prototype.addLayerFromAsyncAdapter=function(t,e,r){return o(this,void 0,void 0,(function(){var n,o;return i(this,(function(i){switch(i.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(o=i.sent())?[2,this.addLayer(o,e,n)]:[2,Promise.reject("No adapter")]}}))}))},e.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},e.prototype.reserveOrder=function(){return this._layersOrderCounter++},e.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},e.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},e.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=O(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},e.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},e.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",n(n({},e),{url:t}))},e.prototype.addImageLayer=function(t,e){var r;return"string"==typeof t?r=t:(r=t.url,e=t),this.addLayer("IMAGE",n(n({},e),{url:r}))},e.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},e.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},e.prototype.toggleLayer=function(t,e,r){var n=this;void 0===r&&(r={});var s=this.getLayer(t),a=void 0!==e?e:!(s&&s.options.visibility),u=void 0!==r.silent&&r.silent;return s&&s.options.visibility!==a?this.onMapLoad().then((function(){return t=s,o(n,void 0,void 0,(function(){var e,r,n,o,s,c,p,l=this;return i(this,(function(i){switch(i.label){case 0:if(e=String(t.id),r=a?"layer:preshow":"layer:prehide",n=a?"layer:show":"layer:hide",u||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!a||!this.mapAdapter)return[3,9];if(o=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];s=this._baselayers.filter((function(e){return e!==t.id&&l.isLayerVisible(e)})),c=0,p=s,i.label=1;case 1:return c<p.length?[4,this.hideLayer(p[c])]:[3,4];case 2:i.sent(),i.label=3;case 3:return c++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return i.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:i.sent(),i.label=8;case 8:return void 0!==o&&this.mapAdapter.setLayerOrder(t.layer,o,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return i.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:i.sent(),i.label=13;case 13:return t.options.visibility=a,u||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},e.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},e.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},e.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},e.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var o=this.getLayerId(r);if(o){var i=this._selectedLayers.indexOf(o);-1!==i&&this._selectedLayers.splice(i,1)}}},e.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},e.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},e.prototype.propertiesFilter=function(t,e,r){var n=this.getLayer(t);if(n){var o=n;o.propertiesFilter?o.propertiesFilter(e,r):o.filter&&this.filterLayer(o,(function(t){return!t.feature||!t.feature.properties||_(t.feature.properties,e)}))}},e.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},e.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},e.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},e.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},e.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},e.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},e.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},e.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},e.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],o=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(o&&t.onlyBaselayer&&(o=this._baselayers.includes(r)),o){var i=n.options&&n.options.attribution;i&&e.push(i)}}return e},e.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},e.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},e.prototype._emitLayerEvent=function(t,e,r){var n=String(t);if(u(e)&&n.startsWith("layer:")){var o=n.replace("layer:","layer-"+e+":");this.emitter.emit(o,r)}this.emitter.emit(t,r)},e.prototype._onLayerClick=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},e.prototype._onLayerSelect=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},e.prototype._updateGeoJsonOptions=function(t){var e=this,r=t.onSelect,n=t.onLayerSelect,o=t.onMouseOut,i=t.onMouseOver,s=t.onClick||t.onLayerClick;t.onClick=function(t){return s&&s(t),e._onLayerClick(t)},t.onMouseOut=function(t){var r=t.layer.id;o&&o(t),u(r)&&e._emitLayerEvent("layer:mouseout",r,t)},t.onMouseOver=function(t){var r=t.layer.id;i&&i(t),u(r)&&e._emitLayerEvent("layer:mouseover",r,t)};var a=r||n;t.onSelect=function(t){return a&&a(t),e._onLayerSelect(t)},t.nativePaint||(this.options.paint&&(t.paint=b(t.paint||{},this.options.paint,this.getPaintFunctions)),t.selectedPaint&&this.options.selectedPaint&&(t.selectedPaint=b(t.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},e}(nt);function it(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var o=e.title||"",i=e.html;function s(){o&&(r.title="string"==typeof o?o:n?o.on:o.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){i&&("string"==typeof i||i instanceof HTMLElement?a(i):a(n?i.on:i.off),r.setAttribute("aria-label",r.title))}function c(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function p(){e.addClassOn&&c(e.addClassOn,n),e.addClassOff&&c(e.addClassOff,!n)}s(),u(),e.addClass&&c(e.addClass,!0),p();var l=function(t){void 0!==t&&(n=t),u(),s(),p()},f=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},h=t({html:r,onClick:f});return h.onClick=f,h.changeStatus=l,h}var st=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return r(e,t),e.prototype.addControl=function(t,e,r){return o(this,void 0,void 0,(function(){var n,s=this;return i(this,(function(a){return e=null!=e?e:"top-left",(n="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){s._setControlQueue(e,(function(){return o(s,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return[4,n];case 1:return r=i.sent(),o=this.mapAdapter.addControl(r,e),t(o),[2]}}))}))}))}))]:[2]}))}))},e.prototype.createControl=function(t,e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},e.prototype.createButtonControl=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},e.prototype.createToggleControl=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,it(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},e.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},e.prototype.getControl=function(t,r){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(r);var o=e.controls[t];return o?o(this,r):void 0},e.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},e.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},e.prototype._applyControls=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},e.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},e}(ot),at={};function ut(t){return at[t]}var ct=function(t){function e(e){var r=t.call(this,e)||this;return r._addControls(),at[r.id]=r,r}return r(e,t),e.get=function(t){return ut(t)},e.prototype._addLayerProviders=function(){var t,e,r,n;return o(this,void 0,void 0,(function(){var o,s,u,c,p,l,f,h,d,y;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,18,19,24]),o=a(this._starterKits),i.label=1;case 1:return[4,o.next()];case 2:return(s=i.sent()).done?[3,17]:(u=s.value).getLayerAdapters?[4,u.getLayerAdapters.call(u)]:[3,16];case 3:if(!(c=i.sent()))return[3,16];i.label=4;case 4:i.trys.push([4,10,11,16]),r=void 0,p=a(c),i.label=5;case 5:return[4,p.next()];case 6:return(l=i.sent()).done?[3,9]:[4,(f=l.value).createAdapter(this)];case 7:(h=i.sent())&&(this.mapAdapter.layerAdapters[f.name]=h),i.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return d=i.sent(),r={error:d},[3,16];case 11:return i.trys.push([11,,14,15]),l&&!l.done&&(n=p.return)?[4,n.call(p)]:[3,13];case 12:i.sent(),i.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return y=i.sent(),t={error:y},[3,24];case 19:return i.trys.push([19,,22,23]),s&&!s.done&&(e=o.return)?[4,e.call(o)]:[3,21];case 20:i.sent(),i.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},e.prototype._onLoadSync=function(){var t,e;return o(this,void 0,void 0,(function(){var r,n,o,s,u;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,8,9,14]),r=a(this._starterKits),i.label=1;case 1:return[4,r.next()];case 2:if((n=i.sent()).done)return[3,7];if(!(o=n.value).onLoadSync)return[3,6];i.label=3;case 3:return i.trys.push([3,5,,6]),[4,o.onLoadSync.call(o,this)];case 4:return i.sent(),[3,6];case 5:return s=i.sent(),console.error(s),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return u=i.sent(),t={error:u},[3,14];case 9:return i.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:i.sent(),i.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},e.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var o=n.position,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["position"]);t.addControl(r,o||"top-left",i)})),this._emitStatusEvent("controls:create")},e}(st);return t.WebMap=ct,t.WebMapControls=st,t.WebMapLayers=ot,t.WebMapMain=nt,t.createToggleControl=it,t.createWebMap=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new ct(t).onLoad()]}))}))},t.detectGeometryType=C,t.findMostFrequentGeomType=w,t.getWebMap=ut,t.updateGeoJsonAdapterOptions=O,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
***************************************************************************** */var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function o(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(e){i(e)}}function a(t){try{u(n.throw(t))}catch(e){i(e)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(a){i=[6,a],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function s(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=s(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function u(t){return null!=t}function c(t,e,r){void 0===r&&(r=!1);var n=t,o=e,i=Array.isArray(o),s=i&&[]||{};return i&&Array.isArray(o)?r?(s=s.concat(n=n||[]),o.forEach((function(t,e){void 0===s[e]?s[e]=t:"object"==typeof t?s[e]=c(n[e],t,r):-1===n.indexOf(t)&&s.push(t)}))):s=o:(n&&"object"==typeof n&&Object.keys(n).forEach((function(t){s[t]=n[t]})),Object.keys(o).forEach((function(t){s[t]="object"==typeof o[t]&&o[t]&&"object"==typeof n[t]&&"object"==typeof o[t]?c(n[t],o[t],r):o[t]}))),s}function p(t){return{type:"Polygon",coordinates:[l(t)]}}function l(t){var e=[t[0],t[1]];return[e,[t[2],t[1]],[t[2],t[3]],[t[0],t[3]],e]}function f(t){return"function"==typeof t}var h={get:function(t,e){return t.properties&&t.properties[e[0]]},match:function(t,e){var r=e[0],n=e.slice(1),o=r;Array.isArray(r)&&(o=d(t,r));for(var i=n.splice(-1,n.length%2)[0],s=0;s<n.length-1;s+=2){if(n[s]===o)return n[s+1]}return i}};function d(t,e){var r=e[0],n=e.slice(1),o=h[r];if(o)return o(t,n)}function y(t){return function(e){return d(e,t)}}var v=["iconSize","iconAnchor"];function m(t,e,r){if((e=String(e))===(t=String(t)))return!0;if(r&&e.toUpperCase()===t.toUpperCase())return!0;var n,o="^".concat((n=e,n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")),"$").replace(/%/g,".*").replace("_",".");return null!==new RegExp(o,r?"i":"").exec(t)}var g={gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},eq:function(t,e){return t===e},ne:function(t,e){return t!==e},in:function(t,e){return-1!==e.indexOf(t)},notin:function(t,e){return-1===e.indexOf(t)},like:function(t,e){return m(t,e)},ilike:function(t,e){return m(t,e,!0)}};function _(t,e){var r="string"==typeof e[0]?e[0]:"all",n=function(e){if(3===(u=e).length&&"string"==typeof u[0]&&"string"==typeof u[1]){var r=e[0],n=e[1],o=e[2],i=g[n];if(i){if(("like"===n||"ilike"===n)&&"string"==typeof r){var s="",a=r.replace(/^%?(\w+)%?$/,(function(e,n){return s=t[n],r.replace(n,o)}));return i(s,a)}return i(t[r],o)}return!1}return _(t,e);var u},o=e.filter((function(t){return Array.isArray(t)}));return"any"===r?o.some(n):o.every(n)}function L(t){var e={},r=[];return t.forEach((function(t){t&&(Array.isArray(t)?r.push(t):e=t)})),function(t){var o=r.find((function(e){return function(t,e){var r=n({},t.properties);return!!r&&(r.$id=t.id,_(r,e))}(t,e[0])}));return o?n(n({},e),o[1]):e}}function b(t,e,r){if(!t)throw new Error("paint is empty");var o=n({},e);if(f(t)){var i=function(n){var o=b(t(n),e,r);return o.type=t.type,o};return i.type=t.type,i}if(function(t){return!!Array.isArray(t)}(t))return function(n){return b(L(t)(n),e,r)};if("get-paint"===t.type){var s=function(t,e){if("function"==typeof t.from)return t.from(t.options);if("string"==typeof t.from&&e){var r=e[t.from];if(r)return r(t.options)}}(t,r);s&&(o=b(s,e,r))}else{if("icon"===t.type)return t;var a=function(t){var e=!1,r={};for(var o in t)if(-1===v.indexOf(o)){var i=o,s=t[i];Array.isArray(s)&&(e=!0,r[i]=y(s))}if(e)return function(e){var o={};for(var i in r)o[i]=r[i](e);return n(n({},t),o)}}(t);if(a)return function(t){return b(a(t),e,r)};(o=n(n({},o),t)).fill=void 0===o.fill||o.fill,o.stroke=void 0!==o.stroke?o.stroke:!o.fill||!(!o.strokeColor&&!o.strokeOpacity)}return f(o)||("color"in o&&(o.strokeColor||(o.strokeColor=o.color),o.fillColor||(o.fillColor=o.color)),"opacity"in o&&(void 0===o.strokeOpacity&&(o.strokeOpacity=o.opacity),void 0===o.fillOpacity&&(o.fillOpacity=o.opacity))),o}function w(t){for(var e,r={},n=0;n<t.length;n++)r[t[n]]=1+(r[t[n]]||0);for(var o in r){r[o]>((void 0!==e?r[e]:0)||0)&&(e=o)}return e}function C(t){var e;if("FeatureCollection"===t.type)e=w(t.features.map((function(t){return t.geometry.type})));else if("GeometryCollection"===t.type){e=w(t.geometries.map((function(t){return t.type})))}else e="Feature"===t.type?t.geometry.type:t.type;return e}var P={polygon:"path",line:"path",point:"circle"},A={Point:"point",LineString:"line",MultiPoint:"point",Polygon:"polygon",MultiLineString:"line",MultiPolygon:"polygon"};function O(t){if(t.data){var e=A[C(t.data)],r=t.paint;r&&"[object Object]"===Object.prototype.toString.call(r)&&(r.type=r.type?r.type:"polygon"===e||"line"===e?"path":"html"in r||"className"in r?"icon":P[e]),t.type=t.type||e}return t}var E,k={exports:{}},S="object"==typeof Reflect?Reflect:null,x=S&&"function"==typeof S.apply?S.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};E=S&&"function"==typeof S.ownKeys?S.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var M=Number.isNaN||function(t){return t!=t};function j(){j.init.call(this)}k.exports=j,k.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}N(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&N(t,"error",e,r)}(t,o,{once:!0})}))},j.EventEmitter=j,j.prototype._events=void 0,j.prototype._eventsCount=0,j.prototype._maxListeners=void 0;var T=10;function F(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function z(t){return void 0===t._maxListeners?j.defaultMaxListeners:t._maxListeners}function B(t,e,r,n){var o,i,s,a;if(F(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=z(t))>0&&s.length>o&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function I(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function V(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=I.bind(n);return o.listener=r,n.wrapFn=o,o}function R(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):G(o,o.length)}function Z(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function G(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function N(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(j,"defaultMaxListeners",{enumerable:!0,get:function(){return T},set:function(t){if("number"!=typeof t||t<0||M(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");T=t}}),j.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},j.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||M(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},j.prototype.getMaxListeners=function(){return z(this)},j.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var a=o[t];if(void 0===a)return!1;if("function"==typeof a)x(a,this,e);else{var u=a.length,c=G(a,u);for(r=0;r<u;++r)x(c[r],this,e)}return!0},j.prototype.on=j.prototype.addListener=function(t,e){return B(this,t,e,!1)},j.prototype.prependListener=function(t,e){return B(this,t,e,!0)},j.prototype.once=function(t,e){return F(e),this.on(t,V(this,t,e)),this},j.prototype.prependOnceListener=function(t,e){return F(e),this.prependListener(t,V(this,t,e)),this},j.prototype.off=j.prototype.removeListener=function(t,e){var r,n,o,i,s;if(F(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},j.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},j.prototype.listeners=function(t){return R(this,t,!0)},j.prototype.rawListeners=function(t){return R(this,t,!1)},j.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):Z.call(t,e)},j.prototype.listenerCount=Z,j.prototype.eventNames=function(){return this._eventsCount>0?E(this._events):[]};var J=function(t){function e(){var r=t.call(this)||this;return r.name="CancelError",Object.setPrototypeOf(r,e.prototype),r}return r(e,t),e}(Error),W=function(){function t(t){void 0===t&&(t={}),this.options=t,this._promises=new Map}return Object.defineProperty(t.prototype,"isLoaded",{get:function(){return this._promises.size>0},enumerable:!1,configurable:!0}),t.prototype.remove=function(t){this._promises.has(t)&&(this._promises.delete(t),this._onStop())},t.prototype.get=function(t){return this._promises.get(t)},t.prototype.add=function(t,e){var r=this,n=e||t,o=this._promises.get(n);return this.options.onStart&&!this.isLoaded&&this.options.onStart(),o||(this._promises.set(n,t),t.finally((function(){r.remove(n)})),t)},t.prototype.abort=function(){this.isLoaded&&(this._promises.forEach((function(t){t.cancel&&t.cancel()})),this._promises.clear(),this._onStop())},t.prototype.waitFunc=function(t,e){void 0===e&&(e="");var r=this.get(e=e||t.name);return r||this.add(t(),e)},t.prototype.WaitForMe=function(t){void 0===t&&(t="");var e=this.get.bind(this),r=this.add.bind(this);return function(n,o,i){var s=i.value;return t=t||o,i.value=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e(t);if(i)return i;var a=r(s.apply(this,n),t);return a},i}},t.prototype.GetOrCreateDecorator=function(t){return void 0===t&&(t=""),this.WaitForMe(t)},t.prototype._onStop=function(){this.options.onStop&&!this.isLoaded&&this.options.onStop()},t}(),D=function(t){function e(){var r=t.call(this)||this;return r.name="TimeoutError",Object.setPrototypeOf(r,e.prototype),r}return r(e,t),e}(Error),H=function(t,e,r,n){try{t(r(n))}catch(o){e(o)}},K=0,Q=function(){function t(e,r){var n=this;this.id=K++,this._isCanceled=!1,this._isPending=!0,this._cancelHandlers=[],this._children=[],this._cancelPromise=new Promise((function(t,e){n._setCanceledCallback=function(e){return t(e||new J)}}));var o=[this._cancelPromise,new Promise((function(r,o){return e((function(e){e instanceof t?n.attach(e):n._isPending=!1,r(e)}),(function(t){n._isPending=!1,o(t)}),(function(t){if(!n._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");n._cancelHandlers.push(t)}))}))];r&&o.push(new Promise((function(t,e){setTimeout((function(){if(n._isPending)try{n.cancel()}finally{e(new D)}}),r)}))),this._promise=Promise.race(o)}return t.createControl=function(t){return new W(t)},t.resolve=function(e){return new t((function(t){return t(e)}))},t.reject=function(e){return new t((function(t,r){return r(e)}))},t.all=function(e){var r=this;return new t((function(t,r){Promise.all(e).then(t).catch(r)})).catch((function(t){if(t instanceof r.CancelError)for(var n=0,o=e;n<o.length;n++){var i=o[n];"cancel"in i&&i.cancel()}throw t}))},t.prototype.attach=function(t){this._isCanceled?t.cancel():this._children.push(t)},t.prototype.then=function(e,r){var n=this,o=new t((function(t,o){if(n._promise){var i=function(e){r?H(t,o,r,e):o(e)};n._promise.then((function(r){n._isCanceled?i(r):e?H(t,o,e,r):t(r)}),i)}}));return o._parentPromise=this,this._children.push(o),o},t.prototype.catch=function(t){return this._isCanceled&&t&&t(new J),this.then(void 0,t)},t.prototype.finally=function(t){return this._promise?this._promise.finally(t):Promise.reject(this._isCanceled?new J:t)},t.prototype.cancel=function(){if(this._isCanceled||!this._isPending)return this;this._isCanceled=!0;var t=this._getTopParent();if(t&&t.cancel(),this._children&&this._children.forEach((function(t){return t.cancel()})),this._isPending){if(this._cancelHandlers.length)try{for(var e=0,r=this._cancelHandlers;e<r.length;e++){(0,r[e])()}}catch(n){}this._setCanceledCallback&&this._setCanceledCallback()}return this._destroy(),this},t.prototype._getTopParent=function(){for(var t=this._parentPromise,e=!!t;e;)e=!(!t||!t._parentPromise)&&!!(t=t._parentPromise);return t},t.prototype._destroy=function(){this._setCanceledCallback=void 0,this._cancelPromise=void 0,this._promise=void 0},t.CancelError=J,t.TimeoutError=D,t.PromiseControl=W,t}();Object.setPrototypeOf(Q.prototype,Promise.prototype);var U=Q,$=function(){this.backspace=8,this.tab=9,this.enter=13,this.shift=16,this.ctrl=17,this.alt=18,this["pause/break"]=19,this.caps_lock=20,this.escape=27,this.page_up=33,this.page_down=34,this.end=35,this.home=36,this.left_arrow=37,this.up_arrow=38,this.right_arrow=39,this.down_arrow=40,this.insert=45,this.delete=46,this.left_window_key=91,this.right_window_key=92,this.select_key=93,this.numpad_0=96,this.numpad_1=97,this.numpad_2=98,this.numpad_3=99,this.numpad_4=100,this.numpad_5=101,this.numpad_6=102,this.numpad_7=103,this.numpad_8=104,this.numpad_9=105,this.multiply=106,this.add=107,this.subtract=109,this.decimal_point=110,this.divide=111,this.f1=112,this.f2=113,this.f3=114,this.f4=115,this.f5=116,this.f6=117,this.f7=118,this.f8=119,this.f9=120,this.f10=121,this.f11=122,this.f12=123,this.num_lock=144,this.scroll_lock=145,this["semi-colon"]=186,this.equal_sign=187,this[","]=188,this["-"]=189,this["."]=190,this["/"]=191,this["`"]=192,this["["]=219,this["\\"]=220,this["]"]=221,this["'"]=222},q=function(){function t(){this.keyCodeAlias=new $,this.keys={},this._windowOnFocus=this.windowOnFocus.bind(this),this._keysPressed=this.keysPressed.bind(this),this._keysReleased=this.keysReleased.bind(this),this.addKeyboardEventsListener()}return t.prototype.pressed=function(t){var e=this.keyCodeAlias[t];return!!e&&this.keys[e]},t.prototype.addKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1))},t.prototype.removeKeyboardEventsListener=function(){"undefined"!=typeof window&&(window.removeEventListener("focus",this._windowOnFocus,!1),window.removeEventListener("keydown",this._keysPressed,!1),window.removeEventListener("keyup",this._keysReleased,!1))},t.prototype.keysPressed=function(t){t.stopPropagation(),this.keys[t.keyCode]||(this.keys[t.keyCode]=!0)},t.prototype.keysReleased=function(t){t.stopPropagation(),this.keys[t.keyCode]=!1},t.prototype.windowOnFocus=function(){this.keys={}},t}(),X=function(){function t(t,e){this.webMap=t,e&&(e.value&&this.setValue(e.value),e.name&&(this.name=e.name),e.event&&(this.event=e.event))}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t},t}(),Y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="center",e.event="moveend",e}return r(e,t),e.prototype.getValue=function(){return this.webMap.getCenter()},e.prototype.setValue=function(t){this.webMap.setCenter(t)},e.prototype.toString=function(t){var e=t.map((function(t){return t.toFixed(5)}));return e[0]+"_"+e[1]},e.prototype.parse=function(t){return t.split("_").map(Number)},e}(X),tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="zoom",e.event="zoomend",e}return r(e,t),e.prototype.getValue=function(){var t=this.webMap.getZoom();return void 0!==t?Math.round(t):void 0},e.prototype.setValue=function(t){this.webMap.setZoom(t)},e.prototype.toString=function(t){return String(t)},e.prototype.parse=function(t){return Number(t)},e}(X);var et=0,rt={minZoom:0,maxZoom:20,paint:{color:"#0000ff",opacity:.4,strokeOpacity:1,stroke:!0,radius:8,weight:1},selectedPaint:{color:"#00008b",opacity:.4,strokeOpacity:1,stroke:!0,radius:12,weight:1},create:!0},nt=function(){function t(e){this.options=rt,this.emitter=new k.exports.EventEmitter,this.keys=t.keys,this.runtimeParams=[],this.getPaintFunctions=t.getPaintFunctions,this.mapState=[Y,tt],this.id=et++,this._initMapState={},this._mapState=[],this._eventsStatus={},this._mapEvents={},this.mapAdapter=e.mapAdapter,this._starterKits=e.starterKits||[],e&&(this.options=c(rt||{},e)),this.options.runtimeParams&&(this.runtimeParams=this.options.runtimeParams),this._addEventsListeners(),this.options.tileJson&&this._setTileJsonOptions(this.options.tileJson),this.options.create&&this.create()}return t.prototype.getId=function(){return this.id},t.prototype.create=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this.getEventStatus("create")?[3,3]:[4,this._setInitMapState(this.mapState)];case 1:return t.sent(),[4,this._setupMap()];case 2:t.sent(),this._emitStatusEvent("create",this),t.label=3;case 3:return[2,this]}}))}))},t.prototype.setRuntimeParams=function(t){this.runtimeParams.push(t)},t.prototype.destroy=function(){this._removeEventListeners(),function(t){for(var e in t)delete t[e]}(this._emitStatusEvent),this.mapAdapter.destroy&&this.mapAdapter.destroy()},t.prototype.getState=function(){var t={};return this._mapState.forEach((function(e){t[e.name]=e.getValue()})),t},t.prototype.getRuntimeParams=function(){var t=this,e={};return this._mapState.forEach((function(r){for(var n=0,o=t.runtimeParams;n<o.length;n++){var i=o[n].get(r.name);if(void 0!==i){e[r.name]=r.parse(i);break}}})),e},t.prototype.getContainer=function(){if(this.mapAdapter.getContainer)return this.mapAdapter.getContainer();if(this.options.target){if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){var t=document.getElementById(this.options.target);if(t)return t}}},t.prototype.setCursor=function(t){this.mapAdapter.setCursor&&this.mapAdapter.setCursor(t)},t.prototype.getCursor=function(){if(this.mapAdapter.getCursor)return this.mapAdapter.getCursor();var t=this.getContainer();return t?t.style.cursor:void 0},t.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},t.prototype.getCenter=function(){return this.mapAdapter.getCenter()},t.prototype.getBounds=function(){if(this.mapAdapter.getBounds)return this.mapAdapter.getBounds()},t.prototype.getBoundsPolygon=function(){var t=this.getBounds();if(t)return{type:"Feature",properties:{},geometry:p(t)}},t.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},t.prototype.getZoom=function(){var t=this.mapAdapter.getZoom();if("number"==typeof t)return t},t.prototype.zoomIn=function(){if(this.mapAdapter.zoomIn)this.mapAdapter.zoomIn();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t+1)}},t.prototype.zoomOut=function(){if(this.mapAdapter.zoomOut)this.mapAdapter.zoomOut();else{var t=this.getZoom();if(void 0!==t)this.setZoom(t-1)}},t.prototype.setView=function(t,e){if(Array.isArray(t)){var r=t;this.mapAdapter.setView&&r&&u(e)?this.mapAdapter.setView(r,e):(r&&this.mapAdapter.setCenter(r),u(e)&&this.mapAdapter.setZoom(e))}else{this.mapAdapter.setView&&this.mapAdapter.setView(t)}},t.prototype.fitBounds=function(t,e){return t.every((function(t){return u(t)}))&&(t[1]<-85.06&&(t[1]=-85.06),t[3]>85.06&&(t[3]=85.06),this.mapAdapter.fitBounds(t,e)),this},t.prototype.getEventStatus=function(t){var e=this._eventsStatus[t];return null!=e&&e},t.prototype.onLoad=function(t){var e=this;return void 0===t&&(t="create"),new Promise((function(r){e.getEventStatus(t)?r(e):e.emitter.once(t,(function(){r(e)}))}))},t.prototype.onMapLoad=function(t){var e=this;return new Promise((function(r){var n,o=function(){var n=e.mapAdapter;t&&t(n),n&&r(n)},i=null===(n=e.mapAdapter.isLoaded)||void 0===n||n;e.mapAdapter.map&&i?o():e.mapAdapter.emitter.once("create",(function(){o()}))}))},t.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},t.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},t.prototype.locate=function(t,e){if(this.mapAdapter&&this.mapAdapter.locate)return this.mapAdapter.locate(t,e);return{stop:function(){return{}}}},t.prototype.stopGetCoordFromMapClick=function(){this._coordFromMapClickPromise&&this._coordFromMapClickPromise.cancel()},t.prototype.getCoordFromMapClick=function(){var t=this;return this._coordFromMapClickPromise?this.getCoordFromMapClick():(this._coordFromMapClickPromise=new U((function(e,r,n){var o=t.getCursor()||"grab";t._removeEventListeners({include:["click"]}),t.setCursor("crosshair");var i=function(){t.setCursor(o),t._addEventsListeners({include:["click"]}),t.mapAdapter.emitter.off("click",s),t._coordFromMapClickPromise=void 0},s=function(t){var r;i(),!(r=t).lngLat&&r.latLng&&(r.lngLat=[r.latLng.lng,r.latLng.lat]),e(t.lngLat)};t.mapAdapter.emitter.once("click",s),n(i)})),this._coordFromMapClickPromise)},t.prototype._emitStatusEvent=function(t,e){var r=t;this._eventsStatus[r]=!0,this.emitter.emit(r,e)},t.prototype._addLayerProviders=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2]}))}))},t.prototype._onLoadSync=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2]}))}))},t.prototype._setupMap=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:if(!this.mapAdapter)throw new Error("WebMap `mapAdapter` option is not set");return[4,this.mapAdapter.create(this.options)];case 1:return t.sent(),this._zoomToInitialExtent(),[4,this._addLayerProviders()];case 2:return t.sent(),[4,this._onLoadSync()];case 3:return t.sent(),this._emitStatusEvent("build-map",this.mapAdapter),[2,this]}}))}))},t.prototype._setTileJsonOptions=function(t){t.center&&(this.options.center=t.center),t.bounds&&(this.options.bounds=t.bounds),u(t.maxzoom)&&(this.options.maxZoom=t.maxzoom,this.options.zoom=t.maxzoom),u(t.minzoom)&&(this.options.minZoom=t.minzoom,this.options.zoom=t.minzoom),u(t.maxzoom)&&u(t.minzoom)&&(this.options.zoom=(t.maxzoom+t.minzoom)/2)},t.prototype._zoomToInitialExtent=function(){var t=this.options,e=t.center,r=t.zoom,n=t.bounds;this._extent?this.fitBounds(this._extent):e&&r?this.setView(e,r):n&&this.fitBounds(n)},t.prototype._setInitMapState=function(t){for(var e=0,r=t;e<r.length;e++){var n=new(0,r[e])(this);this._mapState.push(n);for(var o=0,i=this.runtimeParams;o<i.length;o++){var s=i[o].get(n.name);if(void 0!==s){var a=n.parse(s);this._initMapState[n.name]=a,Object.defineProperty(this.options,n.name,{value:a,configurable:!0,enumerable:!0});break}}}},t.prototype._addEventsListeners=function(t){var e=this,r=["preclick","click","zoomstart","zoom","zoomend","movestart","move","moveend","mousemove","mouseout","mouseover"];t&&t.include&&(r=r.filter((function(e){return t.include.includes(e)}))),r.forEach((function(t){e._mapEvents[t]=function(r){if(e.runtimeParams.length){var n=e._mapState.find((function(e){return e.event===t}));if(n){var o=n.toString(n.getValue());e.runtimeParams.forEach((function(t){t.set(n.name,o)}))}}e._eventsStatus&&e.emitter.emit(t,r)};var r=e._mapEvents[t];r&&e.mapAdapter.emitter.on(t,r)}))},t.prototype._removeEventListeners=function(t){var e=this,r=Object.entries(this._mapEvents);t&&t.include&&(r=r.filter((function(e){return t.include.includes(e[0])}))),r.forEach((function(t){var r=t[1];r&&e.mapAdapter.emitter.removeListener(t[0],r)}))},t.keys=new q,t}(),ot=function(t){function e(e){var r=t.call(this,e)||this;r._layersIdCounter=1,r._layersOrderCounter=1,r._baselayers=[],r._layers={},r._selectedLayers=[];var n=r.options.tileJson;return n&&r.emitter.once("build-map",(function(){return r.addTileJsonLayer(n)})),r}return r(e,t),e.prototype.fitLayer=function(t,e){return o(this,void 0,void 0,(function(){var r,n,o;return i(this,(function(i){switch(i.label){case 0:return r=this.getLayer(t),(n=r&&(r.getBounds||r.getExtent))?[4,n.call(r)]:[3,2];case 1:(o=i.sent())&&this.fitBounds(o,e),i.label=2;case 2:return[2]}}))}))},e.prototype.isBaseLayer=function(t){var e=this.getLayer(t);if(e&&e.id)return-1!==this._baselayers.indexOf(e.id)},e.prototype.getBaseLayers=function(){var t=this,e=[];return this._baselayers.forEach((function(r){var n=t._layers[r];n&&e.push(n)})),e},e.prototype.getBaseLayersIds=function(){return this._baselayers},e.prototype.getLayer=function(t){return"string"==typeof t?this._layers[t]:t},e.prototype.getLayerId=function(t){var e=this.getLayer(t);if(e){if(e.id)return null==e?void 0:e.id;if(e&&e.options)return e.options.id}throw new Error("No id for layer")},e.prototype.getLayers=function(){return Object.keys(this._layers)},e.prototype.allLayers=function(){return this._layers},e.prototype.orderedLayers=function(){return Object.values(this._layers).sort((function(t,e){return t.order&&e.order?t.order-e.order:0}))},e.prototype.findLayer=function(t){for(var e in this._layers){var r=this._layers[e];if(t(r))return r}},e.prototype.isLayerVisible=function(t){var e=this.getLayer(t);return!(!e||void 0===e.options.visibility)&&e.options.visibility},e.prototype.addBaseLayer=function(t,e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,this.addLayer(t,n(n({},e),{baselayer:!0}),void 0)];case 1:return[2,r.sent()]}}))}))},e.prototype.addLayer=function(t,e,r){var s,a;return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var o,c,p,l,f,h,d,y,v,m,g,_;return i(this,(function(i){switch(i.label){case 0:return o=this._layersIdCounter++,c=u(r)?r:void 0!==e.order?e.order:this.reserveOrder(),"string"!=typeof t?[3,1]:(p=this.getLayerAdapter(t),[3,4]);case 1:return"function"!=typeof t?[3,2]:(p=t,[3,4]);case 2:return"then"in t?[4,t]:[3,4];case 3:p=i.sent(),i.label=4;case 4:return this._updateGeoJsonOptions(l=e),e=n({id:String(o),order:c},e),f=null===(s=e.visibility)||void 0===s||s,e.visibility=!1,e.baselayer&&(e.order=0),this.options.onBeforeAddLayer&&(h=this.options.onBeforeAddLayer({options:e,adapter:p}))&&(h.options&&(e=h.options),h.adapter&&(p=h.adapter)),void 0===p?[3,12]:((d=new p(this.mapAdapter.map,e)).options=n(n({},e),d.options),d.options.baselayer&&(e.baselayer=!0,e.order=0,d.options.order=0),y=void 0,d.options.id&&(y=String(d.options.id),this._layers[y]=d),this._emitLayerEvent("layer:preadd",y||"",d),[4,this.onMapLoad()]);case 5:return i.sent(),d.map=this.mapAdapter.map,[4,d.addLayer(d.options)];case 6:if(v=i.sent(),d.layer=v,d.id=d.options.id||String(o),d.options.id=d.id,e.baselayer&&(d.options.order=0),d.order=null!==(a=d.options.order)&&void 0!==a?a:c,y&&delete this._layers[y],y=String(d.id),this._layers[y])throw Error("layer with id '".concat(y,"' already exist"));return y?(this._layers[y]=d,l.filter&&this.filterLayer(d,l.filter),e.baselayer&&this._baselayers.push(y),f?[4,this.showLayer(y)]:[3,8]):[3,8];case 7:i.sent(),i.label=8;case 8:return void 0!==(m=e.opacity)&&m<=1&&this.setLayerOpacity(d,m),g=v&&(d.getBounds||d.getExtent),e.fit&&g?[4,g.call(d)]:[3,11];case 9:return(_=i.sent())?[4,this.fitBounds(_)]:[3,11];case 10:i.sent(),i.label=11;case 11:return e.onAdded&&e.onAdded(d),this._emitLayerEvent("layer:add",y,d),[2,d];case 12:return[2,Promise.reject("No adapter")]}}))}))},e.prototype.addLayerFromAsyncAdapter=function(t,e,r){return o(this,void 0,void 0,(function(){var n,o;return i(this,(function(i){switch(i.label){case 0:return n=r||void 0!==e.order?e.order:this.reserveOrder(),[4,t()];case 1:return(o=i.sent())?[2,this.addLayer(o,e,n)]:[2,Promise.reject("No adapter")]}}))}))},e.prototype.removeLayers=function(t){for(var e in this._layers){var r=!0;t&&(r=t(e,this._layers[e])),r&&(this.removeLayer(e),delete this._layers[e])}},e.prototype.reserveOrder=function(){return this._layersOrderCounter++},e.prototype.removeOverlays=function(){this.removeLayers((function(t,e){return!(e&&e.options&&e.options.baselayer)}))},e.prototype.removeLayer=function(t){var e=this.getLayer(t),r=e&&this.getLayerId(e);if(e&&r){if(this.emitter.emit("layer:preremove",e),e.beforeRemove&&e.beforeRemove(),e.removeLayer?e.removeLayer():this.mapAdapter.removeLayer(e.layer),e.options&&e.options.baselayer){var n=this._baselayers.indexOf(r);n&&this._baselayers.splice(n,1)}delete this._layers[r],this.emitter.emit("layer:remove",e)}},e.prototype.addGeoJsonLayer=function(t,e){return void 0===t&&(t={}),(t=t||{}).multiselect=void 0!==t.multiselect&&t.multiselect,t.unselectOnSecondClick=void 0===t.unselectOnSecondClick||t.unselectOnSecondClick,e||(t=O(t)),t.paint=t.paint||{},this.addLayer(e||"GEOJSON",t)},e.prototype.addFeatureLayer=function(t){return void 0===t&&(t={}),this.addGeoJsonLayer(t)},e.prototype.addTileLayer=function(t,e){return this.addLayer("TILE",n(n({},e),{url:t}))},e.prototype.addImageLayer=function(t,e){var r;return"string"==typeof t?r=t:(r=t.url,e=t),this.addLayer("IMAGE",n(n({},e),{url:r}))},e.prototype.showLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!0,e)},e.prototype.hideLayer=function(t,e){return void 0===e&&(e={}),this.toggleLayer(t,!1,e)},e.prototype.toggleLayer=function(t,e,r){var n=this;void 0===r&&(r={});var s=this.getLayer(t),a=void 0!==e?e:!(s&&s.options.visibility),u=void 0!==r.silent&&r.silent;return s&&s.options.visibility!==a?this.onMapLoad().then((function(){return t=s,o(n,void 0,void 0,(function(){var e,r,n,o,s,c,p,l=this;return i(this,(function(i){switch(i.label){case 0:if(e=String(t.id),r=a?"layer:preshow":"layer:prehide",n=a?"layer:show":"layer:hide",u||(this._emitLayerEvent(r,e,t),this._emitLayerEvent("layer:pretoggle",e,t)),!a||!this.mapAdapter)return[3,9];if(o=t.options.baselayer?0:t.options.order,!t.options.baselayer||!this._baselayers.length)return[3,4];s=this._baselayers.filter((function(e){return e!==t.id&&l.isLayerVisible(e)})),c=0,p=s,i.label=1;case 1:return c<p.length?[4,this.hideLayer(p[c])]:[3,4];case 2:i.sent(),i.label=3;case 3:return c++,[3,1];case 4:return t.showLayer?[4,t.showLayer.call(t,t.layer)]:[3,6];case 5:return i.sent(),[3,8];case 6:return void 0===t.layer?[3,8]:[4,this.mapAdapter.showLayer(t.layer)];case 7:i.sent(),i.label=8;case 8:return void 0!==o&&this.mapAdapter.setLayerOrder(t.layer,o,this._layers),[3,13];case 9:return t.hideLayer?[4,t.hideLayer.call(t,t.layer)]:[3,11];case 10:return i.sent(),[3,13];case 11:return void 0===t.layer?[3,13]:[4,this.mapAdapter.hideLayer(t.layer)];case 12:i.sent(),i.label=13;case 13:return t.options.visibility=a,u||(this._emitLayerEvent(n,e,t),this._emitLayerEvent("layer:toggle",e,t)),[2]}}))}));var t})):Promise.resolve()},e.prototype.updateLayer=function(t){var e=this,r=this.getLayer(t);if(r){if(r.updateLayer)return Promise.resolve(r.updateLayer());if(this.isLayerVisible(r))return this.hideLayer(r,{silent:!0}).then((function(){return e.showLayer(r,{silent:!0})}))}return Promise.resolve()},e.prototype.setLayerOpacity=function(t,e){var r=this.getLayer(t);r&&(r.setOpacity?r.setOpacity(e):this.mapAdapter.setLayerOpacity&&this.mapAdapter.setLayerOpacity(r.layer,e))},e.prototype.selectLayer=function(t,e){var r=this.getLayer(t);if(r){r&&r.select&&r.select(e);var n=this.getLayerId(r);n&&this._selectedLayers.push(n)}},e.prototype.unSelectLayer=function(t,e){var r=this.getLayer(t);if(r){var n=r&&r;n.unselect&&n.unselect(e);var o=this.getLayerId(r);if(o){var i=this._selectedLayers.indexOf(o);-1!==i&&this._selectedLayers.splice(i,1)}}},e.prototype.unSelectLayers=function(){for(var t,e=0,r=Object.values(this.allLayers());e<r.length;e++)(t=r[e]).unselect&&t.unselect()},e.prototype.filterLayer=function(t,e){var r=this.getLayer(t);return r.filter?r.filter(e):[]},e.prototype.propertiesFilter=function(t,e,r){var n=this.getLayer(t);if(n){var o=n;o.propertiesFilter?o.propertiesFilter(e,r):o.filter&&this.filterLayer(o,(function(t){return!t.feature||!t.feature.properties||_(t.feature.properties,e)}))}},e.prototype.removeLayerFilter=function(t){var e=this.getLayer(t);e.removeFilter?e.removeFilter():e.filter&&e.filter((function(){return!0}))},e.prototype.setLayerData=function(t,e){var r=this.getLayer(t);if(r){if(r.setData)return r.setData(e);if(r.clearLayer&&r.addData)return r.clearLayer(),r.addData(e)}return Promise.resolve()},e.prototype.addLayerData=function(t,e){var r=this.getLayer(t);r.addData&&r.addData(e)},e.prototype.clearLayerData=function(t,e){var r=this.getLayer(t);r&&r.clearLayer&&r.clearLayer(e)},e.prototype.setLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setPaint&&r.setPaint(e)},e.prototype.setLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.setSelectedPaint&&r.setSelectedPaint(e)},e.prototype.updateLayerPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updatePaint&&r.updatePaint(e)},e.prototype.updateLayerSelectedPaint=function(t,e){var r=this.getLayer(t);e&&r&&r.updateSelectedPaint&&r.updateSelectedPaint(e)},e.prototype.getAttributions=function(t){var e=[];for(var r in this._layers){var n=this._layers[r],o=!(void 0===t.onlyVisible||t.onlyVisible)||n.options.visibility;if(o&&t.onlyBaselayer&&(o=this._baselayers.includes(r)),o){var i=n.options&&n.options.attribution;i&&e.push(i)}}return e},e.prototype.getActiveBaseLayer=function(){var t=this,e=this.getBaseLayers().find((function(e){return t.isLayerVisible(e)}));if(e)return this.getLayer(e)},e.prototype.addTileJsonLayer=function(t){return this.addLayer("TILE",{url:t.tiles[0],maxZoom:t.maxzoom,minZoom:t.minzoom,subdomains:t.scheme,attribution:t.attribution})},e.prototype._emitLayerEvent=function(t,e,r){var n=String(t);if(u(e)&&n.startsWith("layer:")){var o=n.replace("layer:","layer-"+e+":");this.emitter.emit(o,r)}this.emitter.emit(t,r)},e.prototype._onLayerClick=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return this._emitLayerEvent("layer:click",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},e.prototype._onLayerSelect=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return this._emitLayerEvent("layer:select",t.layer.id||"",t),[2,Promise.resolve(t)]}))}))},e.prototype._updateGeoJsonOptions=function(t){var e=this,r=t.onSelect,n=t.onLayerSelect,o=t.onMouseOut,i=t.onMouseOver,s=t.onClick||t.onLayerClick;t.onClick=function(t){return s&&s(t),e._onLayerClick(t)},t.onMouseOut=function(t){var r=t.layer.id;o&&o(t),u(r)&&e._emitLayerEvent("layer:mouseout",r,t)},t.onMouseOver=function(t){var r=t.layer.id;i&&i(t),u(r)&&e._emitLayerEvent("layer:mouseover",r,t)};var a=r||n;t.onSelect=function(t){return a&&a(t),e._onLayerSelect(t)},t.nativePaint||(this.options.paint&&(t.paint=b(t.paint||{},this.options.paint,this.getPaintFunctions)),t.selectedPaint&&this.options.selectedPaint&&(t.selectedPaint=b(t.selectedPaint,this.options.selectedPaint,this.getPaintFunctions)))},e}(nt);function it(t,e){var r=document.createElement("div"),n=!1;e.getStatus?n=e.getStatus():e.status&&(n=e.status);var o=e.title||"",i=e.html;function s(){o&&(r.title="string"==typeof o?o:n?o.on:o.off,r.setAttribute("aria-label",r.title))}function a(t){t instanceof HTMLElement?(r.innerHTML="",r.appendChild(t)):"string"==typeof t&&(r.innerHTML=t)}function u(){i&&("string"==typeof i||i instanceof HTMLElement?a(i):a(n?i.on:i.off),r.setAttribute("aria-label",r.title))}function c(t,e){t.split(" ").forEach((function(t){e?r.classList.add(t):r.classList.remove(t)}))}function p(){e.addClassOn&&c(e.addClassOn,n),e.addClassOff&&c(e.addClassOff,!n)}s(),u(),e.addClass&&c(e.addClass,!0),p();var l=function(t){void 0!==t&&(n=t),u(),s(),p()},f=function(t){if(n=void 0!==t?t:!n,e.onClick){var r=e.onClick(n);Promise.resolve(r).then((function(){return l()})).catch((function(){return n=!n}))}else l()},h=t({html:r,onClick:f});return h.onClick=f,h.changeStatus=l,h}var st=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._loadControlQueue={"top-right":[],"bottom-right":[],"top-left":[],"bottom-left":[]},e._isControlLoading={"top-right":!1,"bottom-right":!1,"top-left":!1,"bottom-left":!1},e}return r(e,t),e.prototype.addControl=function(t,e,r){return o(this,void 0,void 0,(function(){var n,s=this;return i(this,(function(a){return e=null!=e?e:"top-left",(n="string"==typeof t?this.getControl(t,r):t)?[2,new Promise((function(t){s._setControlQueue(e,(function(){return o(s,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return[4,n];case 1:return r=i.sent(),o=this.mapAdapter.addControl(r,e),t(o),[2]}}))}))}))}))]:[2]}))}))},e.prototype.createControl=function(t,e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,this.onLoad("build-map")];case 1:return r.sent(),this.mapAdapter.createControl?[2,this.mapAdapter.createControl(t,e)]:[2]}}))}))},e.prototype.createButtonControl=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createButtonControl?[2,this.mapAdapter.createButtonControl(t)]:[2]}}))}))},e.prototype.createToggleControl=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.onLoad("build-map")];case 1:return e.sent(),this.mapAdapter.createToggleControl?[2,this.mapAdapter.createToggleControl(t)]:this.mapAdapter.createButtonControl?[2,it(this.mapAdapter.createButtonControl,t)]:[2]}}))}))},e.prototype.removeControl=function(t){var e=this;"remove"in t?t.remove():this.mapAdapter.removeControl&&Promise.resolve(t).then((function(t){e.mapAdapter.removeControl(t)}))},e.prototype.getControl=function(t,r){var n=this.mapAdapter.controlAdapters[t];if(n)return new n(r);var o=e.controls[t];return o?o(this,r):void 0},e.prototype.getControlContainer=function(){if(this.mapAdapter.getControlContainer)return this.mapAdapter.getControlContainer()},e.prototype._setControlQueue=function(t,e){this._loadControlQueue[t].push(e),this._isControlLoading[t]||this._applyControls(t)},e.prototype._applyControls=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this._loadControlQueue[t].length?(this._isControlLoading[t]=!0,[4,(0,this._loadControlQueue[t][0])()]):[3,2];case 1:return e.sent(),this._loadControlQueue[t].splice(0,1),this._applyControls(t),[3,3];case 2:this._isControlLoading[t]=!1,e.label=3;case 3:return[2]}}))}))},e.controls={CONTROL:function(t,e){return t.createControl(e.control,e.options)},BUTTON:function(t,e){return t.createButtonControl(e)},TOGGLE:function(t,e){return t.createToggleControl(e)}},e}(ot),at={};function ut(t){return at[t]}var ct=function(t){function e(e){var r=t.call(this,e)||this;return r._addControls(),at[r.id]=r,r}return r(e,t),e.get=function(t){return ut(t)},e.prototype._addLayerProviders=function(){var t,e,r,n;return o(this,void 0,void 0,(function(){var o,s,u,c,p,l,f,h,d,y;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,18,19,24]),o=a(this._starterKits),i.label=1;case 1:return[4,o.next()];case 2:return(s=i.sent()).done?[3,17]:(u=s.value).getLayerAdapters?[4,u.getLayerAdapters.call(u)]:[3,16];case 3:if(!(c=i.sent()))return[3,16];i.label=4;case 4:i.trys.push([4,10,11,16]),r=void 0,p=a(c),i.label=5;case 5:return[4,p.next()];case 6:return(l=i.sent()).done?[3,9]:[4,(f=l.value).createAdapter(this)];case 7:(h=i.sent())&&(this.mapAdapter.layerAdapters[f.name]=h),i.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return d=i.sent(),r={error:d},[3,16];case 11:return i.trys.push([11,,14,15]),l&&!l.done&&(n=p.return)?[4,n.call(p)]:[3,13];case 12:i.sent(),i.label=13;case 13:return[3,15];case 14:if(r)throw r.error;return[7];case 15:return[7];case 16:return[3,1];case 17:return[3,24];case 18:return y=i.sent(),t={error:y},[3,24];case 19:return i.trys.push([19,,22,23]),s&&!s.done&&(e=o.return)?[4,e.call(o)]:[3,21];case 20:i.sent(),i.label=21;case 21:return[3,23];case 22:if(t)throw t.error;return[7];case 23:return[7];case 24:return[2]}}))}))},e.prototype._onLoadSync=function(){var t,e;return o(this,void 0,void 0,(function(){var r,n,o,s,u;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,8,9,14]),r=a(this._starterKits),i.label=1;case 1:return[4,r.next()];case 2:if((n=i.sent()).done)return[3,7];if(!(o=n.value).onLoadSync)return[3,6];i.label=3;case 3:return i.trys.push([3,5,,6]),[4,o.onLoadSync.call(o,this)];case 4:return i.sent(),[3,6];case 5:return s=i.sent(),console.error(s),[3,6];case 6:return[3,1];case 7:return[3,14];case 8:return u=i.sent(),t={error:u},[3,14];case 9:return i.trys.push([9,,12,13]),n&&!n.done&&(e=r.return)?[4,e.call(r)]:[3,11];case 10:i.sent(),i.label=11;case 11:return[3,13];case 12:if(t)throw t.error;return[7];case 13:return[7];case 14:return[2]}}))}))},e.prototype._addControls=function(){var t=this;this.options.controls&&this.options.controls.forEach((function(e){var r=e,n={};"string"==typeof e&&t.options.controlsOptions&&t.options.controlsOptions[e]&&void 0!==(n=t.options.controlsOptions[e]).control&&(r=n.control);var o=n.position,i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["position"]);t.addControl(r,o||"top-left",i)})),this._emitStatusEvent("controls:create")},e}(st);return t.WebMap=ct,t.WebMapControls=st,t.WebMapLayers=ot,t.WebMapMain=nt,t.createToggleControl=it,t.createWebMap=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new ct(t).onLoad()]}))}))},t.detectGeometryType=C,t.findMostFrequentGeomType=w,t.getWebMap=ut,t.updateGeoJsonAdapterOptions=O,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
//# sourceMappingURL=webmap.global.prod.js.map
{
"name": "@nextgis/webmap",
"version": "1.12.0",
"version": "1.12.1",
"_priority": 14,

@@ -58,3 +58,3 @@ "description": "Universal map constructor",

},
"gitHead": "cc0e45b49ec7cfcbd3c5ce00a5e0d6682cf8f21c"
"gitHead": "0c6f276fd74c321635160e0aeaa31861ada05390"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc