Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextgis/webmap

Package Overview
Dependencies
Maintainers
2
Versions
217
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 0.8.11 to 0.8.14

2

lib/index.d.ts
import { WebMap } from './WebMap';
export { LayerMem } from './WebMap';
export * from './WebMap';
export * from './WebLayerEntry';

@@ -4,0 +4,0 @@ export * from './interfaces/WebMapApp';

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("events")):"function"==typeof define&&define.amd?define(["events"],e):"object"==typeof exports?exports.WebMap=e(require("events")):t.WebMap=e(t.events)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(e,r){e.exports=t},function(t,e,r){"use strict";r.r(e);var n=r(0);function i(t,e,r,n){var o;if(void 0===e&&(e=function(t){return t}),void 0===n&&(n=[]),Array.isArray(t))o=t;else{e(t)&&n.push(t);var s=r(t);s&&(o=[].concat(s))}if(o)for(var a=0;a<o.length;a++)o[a]&&i(o[a],e,r,n);return n}var o,s=function(){function t(t){this._children=[],this.entry=t}return t.prototype.setParent=function(t){this._parent=t},t.prototype.addChildren=function(t){this._children.push(t)},t.prototype.getParent=function(){return this._parent},t.prototype.getParents=function(t){return this.getParent()?i(this._parent,t,function(t){return t.tree.getParent()}):[]},t.prototype.getDescendants=function(t){return i(this._children,t,function(t){return t.tree.getChildren()})},t.prototype.getChildren=function(){return this._children},t}(),a=function(){function t(t,e,r){this.emitter=new n.EventEmitter,this.entry=e,this.options=Object.assign({},r),this.name=t,this._value=this.getProperty()}return t.prototype.getProperty=function(){return"function"==typeof this.options.getProperty?this.options.getProperty.call(this):this.options.value},t.prototype.getParents=function(){return this.entry.tree.getParents()||[]},t.prototype.getParent=function(){return this.entry.tree.getParent()},t.prototype.isGroup=function(){return this.entry.tree.getDescendants().length},t.prototype.isBlocked=function(){var t=this;if(void 0===this._blocked){var e=this.entry.tree.getParents();if(e){var r=e.find(function(e){var r=e.properties.get(t.name);if(r)return!r.value()});this._blocked=!!r}else this._blocked=!1}return this._blocked},t.prototype.set=function(t,e){this._value=this._prepareValue(t),this.update(this._value,e),this._fireChangeEvent(this._value,e)},t.prototype.value=function(){return this.getValue()},t.prototype.update=function(t,e){this._callOnSet(t,e)},t.prototype.getContainer=function(){return this._container},t.prototype.destroy=function(){this._container&&this._container.parentNode.removeChild(this._container),this._removeEventsListener&&this._removeEventsListener()},t.prototype.getValue=function(){return void 0!==this._value?this._value:this.getProperty()},t.prototype._prepareValue=function(t){return t},t.prototype._callOnSet=function(t,e){this.options.onSet&&this.options.onSet.call(this,t,e)},t.prototype._fireChangeEvent=function(t,e){var r=this;t=void 0!==t?t:this.getValue(),this.emitter.emit("change",{value:t,options:e}),this.entry.tree.getParents().forEach(function(n){var i=n.properties.get(r.name);i&&i.emitter.emit("change-tree",{value:t,options:e,entry:r.entry})})},t}(),p=(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=function(){return(u=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)},c=function(t){function e(r,n,i){var o=t.call(this,r,n,Object.assign({},e.options,i))||this;return o.set(o.value()),o}return p(e,t),e.prototype.update=function(t,e){if(t){if(e&&e.bubble||this.options.bubble){this.unBlock(e);var r=this.getParent(),n=r&&r.properties.get(this.name);n&&n.set(t,Object.assign({},e,{bubble:!0,propagation:!1}))}this.isBlocked()||this._turnOn(e)}else this._turnOff(e);(e&&e.propagation||this.options.propagation)&&this._propagation(t,e)},e.prototype.getHierarchyValue=function(){var t=this;return this.value()&&this.getParents().every(function(e){var r=e.properties[t.name];return r&&r.get()})},e.prototype._prepareValue=function(t){return!!t},e.prototype._turnOff=function(t){this.options.turnOff&&this.options.turnOff.call(this,t),this._callOnSet(!1,t),this.options.hierarchy&&this.isGroup()&&this.blockChilds(t)},e.prototype._turnOn=function(t){this.options.turnOn&&this.options.turnOn.call(this,t),this._callOnSet(!0,t),this.options.hierarchy&&this.isGroup()&&this.unblockChilds(t)},e.prototype.block=function(t){this._blocked=!0,this._block(t)},e.prototype._block=function(t){this._turnOff(t)},e.prototype.unBlock=function(t){this._blocked=!1,this.getValue()&&this._unBlock(t)},e.prototype._unBlock=function(t){this._turnOn(t)},e.prototype.blockChilds=function(t){this.entry.tree.getDescendants().forEach(this._blockChild.bind(this,t))},e.prototype.unblockChilds=function(t){this.entry.tree.getChildren().forEach(this._unBlockChild.bind(this,t))},e.prototype._blockChild=function(t,e){var r=e.properties.get(this.name);r.block&&r.block(t)},e.prototype._unBlockChild=function(t,e){var r=e.properties.get(this.name);r.unBlock&&r.unBlock(t)},e.prototype._propagation=function(t,e){if(this.isGroup())for(var r=this.entry.tree.getChildren(),n=0;n<r.length;n++){var i=r[n].properties.get(this.name);i&&i.set(t,u({},e,{propagation:!0,bubble:!1}))}},e.options={hierarchy:!0,bubble:!1,propagation:!1,label:"Toggle"},e}(a),h=function(){return(h=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)},l=function(){function t(t,e){this.options={},this.entry=t,this._properties={},this._propertiesList=[],e&&e.forEach(this._setPropertyHandler.bind(this))}return t.prototype.add=function(t){this._setPropertyHandler(t)},t.prototype._setPropertyHandler=function(e){var r=t.handlers,n=e.handler;if(!n&&e.type)switch(e.type){case"boolean":n=r.CheckProperty;break;case"string":n=r.BaseProperty;break;default:n=r.BaseProperty}if(n){var i=h({},e||{});this._properties[e.name]=new n(e.name,this.entry,i),this._propertiesList.push(e.name)}},t.prototype.update=function(){this.list().forEach(function(t){t.update()})},t.prototype.value=function(t){var e=this.get(t);if(e)return e.value},t.prototype.set=function(t,e,r){var n=this.get(t);if(n)return n.set(e,r)},t.prototype.get=function(t){return this._properties[t]},t.prototype.list=function(){var t=this;return this._propertiesList.map(function(e){return t._properties[e]})},t.prototype.destroy=function(){for(var t in this._properties)if(this._properties.hasOwnProperty(t)){var e=this.get(t);e&&e.destroy&&e.destroy()}this._properties=null,this._propertiesList=[]},t.handlers={CheckProperty:c},t}(),f=0,y=function(){function t(t){this.emitter=new n.EventEmitter,this.options=Object.assign({},this.options,t),this.id=String(f++),this.tree=new s(this)}return t.prototype.initProperties=function(){this.properties=new l(this,this.options.properties)},t}(),d=function(){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)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_=function(){return(_=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)},v=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{p(n.next(t))}catch(t){o(t)}}function a(t){try{p(n.throw(t))}catch(t){o(t)}}function p(t){t.done?i(t.value):new r(function(e){e(t.value)}).then(s,a)}p((n=n.apply(t,e||[])).next())})},b=function(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=(i=s.trys).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(t){o=[6,t],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])}}},m=function(t){function e(r,n,i,o){var s=t.call(this,Object.assign({},e.options,i))||this;return s.webMap=r,s.item=n,o&&s.tree.setParent(o),s.initProperties(),s.initItem(n),s}return d(e,t),e.prototype.initItem=function(t){return v(this,void 0,void 0,function(){var r,n,i,o=this;return b(this,function(s){switch(s.label){case 0:return r=t._layer,"group"!==t.item_type&&"root"!==t.item_type?[3,1]:(t.children&&t.children.length&&t.children.reverse().forEach(function(t){var r=new e(o.webMap,t,o.options,o);o.tree.addChildren(r)}),[3,3]);case 1:return"layer"!==t.item_type?[3,3]:(n=t.layer_adapter.toUpperCase(),t.id=Number(this.id),i=_({},t,{id:t.id}),[4,this.webMap.addLayer(n,i)]);case 2:r=s.sent(),s.label=3;case 3:return r&&(t._layer=r,"layer"===t.item_type&&t.layer_enabled&&this.properties.get("visibility").set(!0)),[2]}})})},e.prototype.fit=function(){"layer"===this.item.item_type&&console.log(this.item)},e.options={properties:[{type:"boolean",name:"visibility",getProperty:function(){var t=this.entry;return"group"===t.item.item_type||("layer"===t.item.item_type?t.item.layer_enabled:"root"===t.item.item_type)},onSet:function(t){var e=this.entry;"layer"===e.item.item_type&&(t?e.webMap.showLayer(e.id):e.webMap.hideLayer(e.id),e.item.layer_enabled=t)}}]},e}(y),g=function(){return 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 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];if(e)return this.keys[e]},t.prototype.addKeyboardEventsListener=function(){window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1)},t.prototype.removeKeyboardEventsListener=function(){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}();Object.prototype.toString;var k=function(){return(k=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)},L=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{p(n.next(t))}catch(t){o(t)}}function a(t){try{p(n.throw(t))}catch(t){o(t)}}function p(t){t.done?i(t.value):new r(function(e){e(t.value)}).then(s,a)}p((n=n.apply(t,e||[])).next())})},P=function(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=(i=s.trys).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(t){o=[6,t],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])}}},O=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),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)})}}},A=function(){function t(t){this.displayProjection="EPSG:3857",this.lonlatProjection="EPSG:4326",this.emitter=new n.EventEmitter,this.keys=new w,this.DPI=1e3/39.37/.28,this.IPM=39.37,this.settingsIsLoading=!1,this._baseLayers=[],this._layers={},this._layersIds=0,this._selectedLayers=[],this.mapAdapter=t.mapAdapter,this._starterKits=t.starterKits||[],this._addEventsListeners()}return t.prototype.create=function(t){return L(this,void 0,void 0,function(){var e;return P(this,function(r){switch(r.label){case 0:if(this.options=function t(e,r,n){void 0===n&&(n=!1);var i=Array.isArray(r),o=i&&[]||{};return i?n?(e=e||[],o=o.concat(e),r.forEach(function(r,i){void 0===o[i]?o[i]=r:"object"==typeof r?o[i]=t(e[i],r,n):-1===e.indexOf(r)&&o.push(r)})):o=r:(e&&"object"==typeof e&&Object.keys(e).forEach(function(t){o[t]=e[t]}),Object.keys(r).forEach(function(i){"object"==typeof r[i]&&r[i]&&e[i]?o[i]=t(e[i],r[i],n):o[i]=r[i]})),o}(this.options||{},t),this.settings||!this._starterKits.length)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.getSettings()];case 2:return r.sent(),[3,4];case 3:return e=r.sent(),console.error(e),[3,4];case 4:return[4,this._setupMap()];case 5:return r.sent(),[2,this]}})})},t.prototype.getSettings=function(){return L(this,void 0,void 0,function(){var t,e,r,n,i,o,s=this;return P(this,function(a){switch(a.label){case 0:return this.settings?[2,Promise.resolve(this.settings)]:this.settingsIsLoading?[2,new Promise(function(t){var e=function(r){t(r),s.emitter.removeListener("load-settings",e)};s.emitter.on("load-settings",e)})]:[3,1];case 1:this.settingsIsLoading=!0,t=void 0,a.label=2;case 2:a.trys.push([2,7,,8]),t={},e=0,r=this._starterKits.filter(function(t){return t.getSettings}),a.label=3;case 3:return e<r.length?[4,(n=r[e]).getSettings.call(n,this)]:[3,6];case 4:(i=a.sent())&&Object.assign(t,i),a.label=5;case 5:return e++,[3,3];case 6:return[3,8];case 7:throw o=a.sent(),this.settingsIsLoading=!1,new Error(o);case 8:if(t)return this.settings=t,this.settingsIsLoading=!1,this.emitter.emit("load-settings",t),[2,t];a.label=9;case 9:return[2]}})})},t.prototype.onMapLoad=function(t){var e=this.mapAdapter.onMapLoad;return e?e.call(this.mapAdapter,t):Promise.resolve(t)},t.prototype.addBaseLayer=function(t,e){return L(this,void 0,void 0,function(){var r;return P(this,function(n){switch(n.label){case 0:return[4,this.addLayer(t,k({},e),!0)];case 1:return(r=n.sent())&&this._baseLayers.push(r.name),[2,r]}})})},t.prototype.isBaseLayer=function(t){return-1!==this._baseLayers.indexOf(t)},t.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},t.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},t.prototype.fit=function(t){return this.mapAdapter.fit(t),this},t.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},t.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},t.prototype.getLayer=function(t){return this._layers[t]},t.prototype.getLayers=function(){return Object.keys(this._layers)},t.prototype.isLayerOnTheMap=function(t){return this._layers[t].onMap},t.prototype.addControl=function(t,e,r){return this.mapAdapter.addControl(t,e,r)},t.prototype.addLayer=function(t,e,r){return L(this,void 0,void 0,function(){var n,i,o,s,a,p,u=this;return P(this,function(c){switch(c.label){case 0:return(n="string"==typeof t?this.getLayerAdapter(t):t)?(e.onLayerClick=function(t){return u._onLayerClick(t)},i=new n(this.mapAdapter.map,e),o=this._layersIds++,[4,this.onMapLoad()]):[3,3];case 1:return c.sent(),[4,i.addLayer(e)];case 2:return s=c.sent(),a=i.name,p={id:a,layer:s,adapter:i,onMap:!1},r?(p.baseLayer=!0,p.order=0,this._baseLayers.push(a)):p.order=e.order||o,this._layers[a]=p,[2,i];case 3:return[2,Promise.reject("No adapter")]}})})},t.prototype.removeLayer=function(t){var e=this._layers[t];if(e){if(this.mapAdapter.removeLayer(e.layer),e.baseLayer){var r=this._baseLayers.indexOf(t);r&&this._baseLayers.splice(r,1)}delete this._layers[t]}},t.prototype.showLayer=function(t){this.toggleLayer(t,!0)},t.prototype.hideLayer=function(t){this.toggleLayer(t,!1)},t.prototype.setLayerOpacity=function(t,e){},t.prototype.getScaleForResolution=function(t,e){return parseFloat(t)*(e*this.IPM*this.DPI)},t.prototype.getResolutionForScale=function(t,e){return parseFloat(t)/(e*this.IPM*this.DPI)},t.prototype.toggleLayer=function(t,e){var r=this,n=function(t,n){if(n.onMap=e,e&&t){var i=n.baseLayer?0:n.order;r.mapAdapter.setLayerOrder(n.layer,i,r._layers),r.mapAdapter.showLayer(n.layer)}else r.mapAdapter.hideLayer(n.layer)},i=this._layers[t];i&&i.onMap!==e&&(this.mapAdapter.map?n(this.mapAdapter,i):this.mapAdapter.emitter.once("create",function(t){n(t.map,i)}))},t.prototype.requestGeomString=function(t,e){return this.mapAdapter.requestGeomString(t,e)},t.prototype.onMapClick=function(t){var e=t.containerPoint,r=t.latlng;this.emitter.emit("click",{latLng:r,pixel:{left:e.x,top:e.y},source:t})},t.prototype.selectLayer=function(t){var e=this.getLayer(t);e&&e.adapter.select&&e.adapter.select(),this._selectedLayers.push(t)},t.prototype.unSelectLayer=function(t){var e=this.getLayer(t);e&&e.adapter.unselect&&e.adapter.unselect();var r=this._selectedLayers.indexOf(t);-1!==r&&this._selectedLayers.splice(r,1)},t.prototype.filterLayer=function(t,e){var r=this.getLayer(t);r&&r.adapter.filter&&r.adapter.filter(e)},t.prototype._setupMap=function(){return L(this,void 0,void 0,function(){var t,e,r,n,i,o;return P(this,function(s){switch(s.label){case 0:return this.settings&&(t=this.settings,e=t.extent_bottom,r=t.extent_left,n=t.extent_top,i=t.extent_right,e&&r&&n&&i&&(this._extent=[r,e,i,n],(o=this._extent)[3]>82&&(o[3]=82),o[1]<-82&&(o[1]=-82))),this.mapAdapter.displayProjection=this.displayProjection,this.mapAdapter.lonlatProjection=this.lonlatProjection,this.mapAdapter.create(this.options),this._addTreeLayers(),[4,this._addLayerProviders()];case 1:return s.sent(),this._zoomToInitialExtent(),this.emitter.emit("build-map",this.mapAdapter),[2,this]}})})},t.prototype._addTreeLayers=function(){return L(this,void 0,void 0,function(){var t,e,r;return P(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getSettings()];case 1:return(t=n.sent())&&(e=t.root_item)&&(this.layers=new m(this,e),this.emitter.emit("add-layers",this.layers)),[3,3];case 2:return r=n.sent(),console.error(r),[3,3];case 3:return[2]}})})},t.prototype._zoomToInitialExtent=function(){if(this._extent)this.mapAdapter.fit(this._extent);else{var t=this.options,e=t.center,r=t.zoom;e&&this.mapAdapter.setCenter(e),r&&this.mapAdapter.setZoom(r)}},t.prototype._addLayerProviders=function(){return L(this,void 0,void 0,function(){var t,e,r,n,i,o,s,a,p,u,c,h,l,f,y;return P(this,function(d){switch(d.label){case 0:d.trys.push([0,26,,27]),d.label=1;case 1:d.trys.push([1,19,20,25]),i=O(this._starterKits.filter(function(t){return t.getLayerAdapters})),d.label=2;case 2:return[4,i.next()];case 3:return(o=d.sent()).done?[3,18]:[4,(s=o.value).getLayerAdapters.call(s)];case 4:if(!(a=d.sent()))return[3,17];d.label=5;case 5:d.trys.push([5,11,12,17]),p=O(a),d.label=6;case 6:return[4,p.next()];case 7:return(u=d.sent()).done?[3,10]:[4,(c=u.value).createAdapter(this.mapAdapter)];case 8:(h=d.sent())&&(this.mapAdapter.layerAdapters[c.name]=h),d.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return l=d.sent(),r={error:l},[3,17];case 12:return d.trys.push([12,,15,16]),u&&!u.done&&(n=p.return)?[4,n.call(p)]:[3,14];case 13:d.sent(),d.label=14;case 14:return[3,16];case 15:if(r)throw r.error;return[7];case 16:return[7];case 17:return[3,2];case 18:return[3,25];case 19:return f=d.sent(),t={error:f},[3,25];case 20:return d.trys.push([20,,23,24]),o&&!o.done&&(e=i.return)?[4,e.call(i)]:[3,22];case 21:d.sent(),d.label=22;case 22:return[3,24];case 23:if(t)throw t.error;return[7];case 24:return[7];case 25:return[3,27];case 26:throw y=d.sent(),new Error(y);case 27:return[2]}})})},t.prototype._onLayerClick=function(t){return L(this,void 0,void 0,function(){return P(this,function(e){return this.emitter.emit("layer:click",t),[2,Promise.resolve(t)]})})},t.prototype._addEventsListeners=function(){var t=this;this.mapAdapter.emitter.on("click",function(e){return t._onMapClick(e)})},t.prototype._onMapClick=function(t){var e=this;this.emitter.emit("click",t),this._starterKits.forEach(function(r){r.onMapClick&&r.onMapClick(t,e)})},t}();r.d(e,"WebLayerEntry",function(){return m});e.default=A}]).default});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("events")):"function"==typeof define&&define.amd?define(["events"],e):"object"==typeof exports?exports.WebMap=e(require("events")):t.WebMap=e(t.events)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(e,r){e.exports=t},function(t,e,r){"use strict";r.r(e);var n=r(0);function i(t,e,r,n){var o;if(void 0===e&&(e=function(t){return t}),void 0===n&&(n=[]),Array.isArray(t))o=t;else{e(t)&&n.push(t);var s=r(t);s&&(o=[].concat(s))}if(o)for(var a=0;a<o.length;a++)o[a]&&i(o[a],e,r,n);return n}var o,s=function(){function t(t){this._children=[],this.entry=t}return t.prototype.setParent=function(t){this._parent=t},t.prototype.addChildren=function(t){this._children.push(t)},t.prototype.getParent=function(){return this._parent},t.prototype.getParents=function(t){return this.getParent()?i(this._parent,t,function(t){return t.tree.getParent()}):[]},t.prototype.getDescendants=function(t){return i(this._children,t,function(t){return t.tree.getChildren()})},t.prototype.getChildren=function(){return this._children},t}(),a=function(){function t(t,e,r){this.emitter=new n.EventEmitter,this.entry=e,this.options=Object.assign({},r),this.name=t,this._value=this.getProperty()}return t.prototype.getProperty=function(){return"function"==typeof this.options.getProperty?this.options.getProperty.call(this):this.options.value},t.prototype.getParents=function(){return this.entry.tree.getParents()||[]},t.prototype.getParent=function(){return this.entry.tree.getParent()},t.prototype.isGroup=function(){return this.entry.tree.getDescendants().length},t.prototype.isBlocked=function(){var t=this;if(void 0===this._blocked){var e=this.entry.tree.getParents();if(e){var r=e.find(function(e){var r=e.properties.get(t.name);if(r)return!r.value()});this._blocked=!!r}else this._blocked=!1}return this._blocked},t.prototype.set=function(t,e){this._value=this._prepareValue(t),this.update(this._value,e),this._fireChangeEvent(this._value,e)},t.prototype.value=function(){return this.getValue()},t.prototype.update=function(t,e){this._callOnSet(t,e)},t.prototype.getContainer=function(){return this._container},t.prototype.destroy=function(){this._container&&this._container.parentNode.removeChild(this._container),this._removeEventsListener&&this._removeEventsListener()},t.prototype.getValue=function(){return void 0!==this._value?this._value:this.getProperty()},t.prototype._prepareValue=function(t){return t},t.prototype._callOnSet=function(t,e){this.options.onSet&&this.options.onSet.call(this,t,e)},t.prototype._fireChangeEvent=function(t,e){var r=this;t=void 0!==t?t:this.getValue(),this.emitter.emit("change",{value:t,options:e}),this.entry.tree.getParents().forEach(function(n){var i=n.properties.get(r.name);i&&i.emitter.emit("change-tree",{value:t,options:e,entry:r.entry})})},t}(),p=(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=function(){return(u=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)},c=function(t){function e(r,n,i){var o=t.call(this,r,n,Object.assign({},e.options,i))||this;return o.set(o.value()),o}return p(e,t),e.prototype.update=function(t,e){if(t){if(e&&e.bubble||this.options.bubble){this.unBlock(e);var r=this.getParent(),n=r&&r.properties.get(this.name);n&&n.set(t,Object.assign({},e,{bubble:!0,propagation:!1}))}this.isBlocked()||this._turnOn(e)}else this._turnOff(e);(e&&e.propagation||this.options.propagation)&&this._propagation(t,e)},e.prototype.getHierarchyValue=function(){var t=this;return this.value()&&this.getParents().every(function(e){var r=e.properties[t.name];return r&&r.get()})},e.prototype._prepareValue=function(t){return!!t},e.prototype._turnOff=function(t){this.options.turnOff&&this.options.turnOff.call(this,t),this._callOnSet(!1,t),this.options.hierarchy&&this.isGroup()&&this.blockChilds(t)},e.prototype._turnOn=function(t){this.options.turnOn&&this.options.turnOn.call(this,t),this._callOnSet(!0,t),this.options.hierarchy&&this.isGroup()&&this.unblockChilds(t)},e.prototype.block=function(t){this._blocked=!0,this._block(t)},e.prototype._block=function(t){this._turnOff(t)},e.prototype.unBlock=function(t){this._blocked=!1,this.getValue()&&this._unBlock(t)},e.prototype._unBlock=function(t){this._turnOn(t)},e.prototype.blockChilds=function(t){this.entry.tree.getDescendants().forEach(this._blockChild.bind(this,t))},e.prototype.unblockChilds=function(t){this.entry.tree.getChildren().forEach(this._unBlockChild.bind(this,t))},e.prototype._blockChild=function(t,e){var r=e.properties.get(this.name);r.block&&r.block(t)},e.prototype._unBlockChild=function(t,e){var r=e.properties.get(this.name);r.unBlock&&r.unBlock(t)},e.prototype._propagation=function(t,e){if(this.isGroup())for(var r=this.entry.tree.getChildren(),n=0;n<r.length;n++){var i=r[n].properties.get(this.name);i&&i.set(t,u({},e,{propagation:!0,bubble:!1}))}},e.options={hierarchy:!0,bubble:!1,propagation:!1,label:"Toggle"},e}(a),h=function(){return(h=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)},l=function(){function t(t,e){this.options={},this.entry=t,this._properties={},this._propertiesList=[],e&&e.forEach(this._setPropertyHandler.bind(this))}return t.prototype.add=function(t){this._setPropertyHandler(t)},t.prototype._setPropertyHandler=function(e){var r=t.handlers,n=e.handler;if(!n&&e.type)switch(e.type){case"boolean":n=r.CheckProperty;break;case"string":n=r.BaseProperty;break;default:n=r.BaseProperty}if(n){var i=h({},e||{});this._properties[e.name]=new n(e.name,this.entry,i),this._propertiesList.push(e.name)}},t.prototype.update=function(){this.list().forEach(function(t){t.update()})},t.prototype.value=function(t){var e=this.get(t);if(e)return e.value},t.prototype.set=function(t,e,r){var n=this.get(t);if(n)return n.set(e,r)},t.prototype.get=function(t){return this._properties[t]},t.prototype.list=function(){var t=this;return this._propertiesList.map(function(e){return t._properties[e]})},t.prototype.destroy=function(){for(var t in this._properties)if(this._properties.hasOwnProperty(t)){var e=this.get(t);e&&e.destroy&&e.destroy()}this._properties=null,this._propertiesList=[]},t.handlers={CheckProperty:c},t}(),f=0,y=function(){function t(t){this.emitter=new n.EventEmitter,this.options=Object.assign({},this.options,t),this.id=String(f++),this.tree=new s(this)}return t.prototype.initProperties=function(){this.properties=new l(this,this.options.properties)},t}(),d=function(){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)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_=function(){return(_=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)},v=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{p(n.next(t))}catch(t){o(t)}}function a(t){try{p(n.throw(t))}catch(t){o(t)}}function p(t){t.done?i(t.value):new r(function(e){e(t.value)}).then(s,a)}p((n=n.apply(t,e||[])).next())})},b=function(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=(i=s.trys).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(t){o=[6,t],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])}}},m=function(t){function e(r,n,i,o){var s=t.call(this,Object.assign({},e.options,i))||this;return s.webMap=r,s.item=n,o&&s.tree.setParent(o),s.initProperties(),s.initItem(n),s}return d(e,t),e.prototype.initItem=function(t){return v(this,void 0,void 0,function(){var r,n,i,o=this;return b(this,function(s){switch(s.label){case 0:return r=t._layer,"group"!==t.item_type&&"root"!==t.item_type?[3,1]:(t.children&&t.children.length&&t.children.reverse().forEach(function(t){var r=new e(o.webMap,t,o.options,o);o.tree.addChildren(r)}),[3,3]);case 1:return"layer"!==t.item_type?[3,3]:(n=t.layer_adapter.toUpperCase(),t.id=Number(this.id),i=_({},t,{id:t.id}),[4,this.webMap.addLayer(n,i)]);case 2:r=s.sent(),s.label=3;case 3:return r&&(t._layer=r,"layer"===t.item_type&&t.layer_enabled&&this.properties.get("visibility").set(!0)),[2]}})})},e.prototype.fit=function(){"layer"===this.item.item_type&&console.log(this.item)},e.options={properties:[{type:"boolean",name:"visibility",getProperty:function(){var t=this.entry;return"group"===t.item.item_type||("layer"===t.item.item_type?t.item.layer_enabled:"root"===t.item.item_type)},onSet:function(t){var e=this.entry;"layer"===e.item.item_type&&(t?e.webMap.showLayer(e.id):e.webMap.hideLayer(e.id),e.item.layer_enabled=t)}}]},e}(y),g=function(){return 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 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];if(e)return this.keys[e]},t.prototype.addKeyboardEventsListener=function(){window.addEventListener("focus",this._windowOnFocus,!1),window.addEventListener("keydown",this._keysPressed,!1),window.addEventListener("keyup",this._keysReleased,!1)},t.prototype.removeKeyboardEventsListener=function(){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}();Object.prototype.toString;var k=function(){return(k=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)},L=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{p(n.next(t))}catch(t){o(t)}}function a(t){try{p(n.throw(t))}catch(t){o(t)}}function p(t){t.done?i(t.value):new r(function(e){e(t.value)}).then(s,a)}p((n=n.apply(t,e||[])).next())})},P=function(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=(i=s.trys).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(t){o=[6,t],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])}}},O=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),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)})}}},A=function(){function t(t){this.displayProjection="EPSG:3857",this.lonlatProjection="EPSG:4326",this.emitter=new n.EventEmitter,this.keys=new w,this.DPI=1e3/39.37/.28,this.IPM=39.37,this.settingsIsLoading=!1,this._baseLayers=[],this._layers={},this._layersIds=1,this._selectedLayers=[],this.mapAdapter=t.mapAdapter,this._starterKits=t.starterKits||[],this._addEventsListeners()}return t.prototype.create=function(t){return L(this,void 0,void 0,function(){var e;return P(this,function(r){switch(r.label){case 0:if(this.options=function t(e,r,n){void 0===n&&(n=!1);var i=Array.isArray(r),o=i&&[]||{};return i?n?(e=e||[],o=o.concat(e),r.forEach(function(r,i){void 0===o[i]?o[i]=r:"object"==typeof r?o[i]=t(e[i],r,n):-1===e.indexOf(r)&&o.push(r)})):o=r:(e&&"object"==typeof e&&Object.keys(e).forEach(function(t){o[t]=e[t]}),Object.keys(r).forEach(function(i){"object"==typeof r[i]&&r[i]&&e[i]?o[i]=t(e[i],r[i],n):o[i]=r[i]})),o}(this.options||{},t),this.settings||!this._starterKits.length)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.getSettings()];case 2:return r.sent(),[3,4];case 3:return e=r.sent(),console.error(e),[3,4];case 4:return[4,this._setupMap()];case 5:return r.sent(),[2,this]}})})},t.prototype.getSettings=function(){return L(this,void 0,void 0,function(){var t,e,r,n,i,o,s=this;return P(this,function(a){switch(a.label){case 0:return this.settings?[2,Promise.resolve(this.settings)]:this.settingsIsLoading?[2,new Promise(function(t){var e=function(r){t(r),s.emitter.removeListener("load-settings",e)};s.emitter.on("load-settings",e)})]:[3,1];case 1:this.settingsIsLoading=!0,t=void 0,a.label=2;case 2:a.trys.push([2,7,,8]),t={},e=0,r=this._starterKits.filter(function(t){return t.getSettings}),a.label=3;case 3:return e<r.length?[4,(n=r[e]).getSettings.call(n,this)]:[3,6];case 4:(i=a.sent())&&Object.assign(t,i),a.label=5;case 5:return e++,[3,3];case 6:return[3,8];case 7:throw o=a.sent(),this.settingsIsLoading=!1,new Error(o);case 8:if(t)return this.settings=t,this.settingsIsLoading=!1,this.emitter.emit("load-settings",t),[2,t];a.label=9;case 9:return[2]}})})},t.prototype.onMapLoad=function(t){var e=this.mapAdapter.onMapLoad;return e?e.call(this.mapAdapter,t):Promise.resolve(t)},t.prototype.addBaseLayer=function(t,e){return L(this,void 0,void 0,function(){var r;return P(this,function(n){switch(n.label){case 0:return[4,this.addLayer(t,k({},e),!0)];case 1:return(r=n.sent())&&this._baseLayers.push(r.name),[2,r]}})})},t.prototype.isBaseLayer=function(t){return-1!==this._baseLayers.indexOf(t)},t.prototype.setCenter=function(t){return this.mapAdapter.setCenter(t),this},t.prototype.setZoom=function(t){return this.mapAdapter.setZoom(t),this},t.prototype.fit=function(t){return this.mapAdapter.fit(t),this},t.prototype.getLayerAdapters=function(){return this.mapAdapter.layerAdapters},t.prototype.getLayerAdapter=function(t){return this.mapAdapter.layerAdapters[t]},t.prototype.getLayer=function(t){return this._layers[t]},t.prototype.getLayers=function(){return Object.keys(this._layers)},t.prototype.isLayerOnTheMap=function(t){var e=this._layers[t];return e&&e.onMap},t.prototype.addControl=function(t,e,r){return this.mapAdapter.addControl(t,e,r)},t.prototype.addLayer=function(t,e,r){return L(this,void 0,void 0,function(){var n,i,o,s,a,p,u=this;return P(this,function(c){switch(c.label){case 0:return(n="string"==typeof t?this.getLayerAdapter(t):t)?(e.onLayerClick=function(t){return u._onLayerClick(t)},i=new n(this.mapAdapter.map,e),o=this._layersIds++,[4,this.onMapLoad()]):[3,3];case 1:return c.sent(),[4,i.addLayer(e)];case 2:return s=c.sent(),a=i.name,p={id:a,layer:s,adapter:i,onMap:!1},r?(p.baseLayer=!0,p.order=0,this._baseLayers.push(a)):p.order=e.order||o,this._layers[a]=p,[2,i];case 3:return[2,Promise.reject("No adapter")]}})})},t.prototype.removeLayer=function(t){var e=this._layers[t];if(e){if(this.mapAdapter.removeLayer(e.layer),e.baseLayer){var r=this._baseLayers.indexOf(t);r&&this._baseLayers.splice(r,1)}delete this._layers[t]}},t.prototype.showLayer=function(t){this.toggleLayer(t,!0)},t.prototype.hideLayer=function(t){this.toggleLayer(t,!1)},t.prototype.setLayerOpacity=function(t,e){if(this.mapAdapter.setLayerOpacity){var r=this.getLayer(t);r&&this.mapAdapter.setLayerOpacity(r.layer,e)}},t.prototype.getScaleForResolution=function(t,e){return parseFloat(t)*(e*this.IPM*this.DPI)},t.prototype.getResolutionForScale=function(t,e){return parseFloat(t)/(e*this.IPM*this.DPI)},t.prototype.toggleLayer=function(t,e){var r=this,n=function(t,n){if(n.onMap=e,e&&t){var i=n.baseLayer?0:n.order;r.mapAdapter.setLayerOrder(n.layer,i,r._layers),r.mapAdapter.showLayer(n.layer)}else r.mapAdapter.hideLayer(n.layer)},i=this._layers[t];i&&i.onMap!==e&&(this.mapAdapter.map?n(this.mapAdapter,i):this.mapAdapter.emitter.once("create",function(t){n(t.map,i)}))},t.prototype.requestGeomString=function(t,e){return this.mapAdapter.requestGeomString(t,e)},t.prototype.onMapClick=function(t){var e=t.containerPoint,r=t.latlng;this.emitter.emit("click",{latLng:r,pixel:{left:e.x,top:e.y},source:t})},t.prototype.selectLayer=function(t){var e=this.getLayer(t);e&&e.adapter.select&&e.adapter.select(),this._selectedLayers.push(t)},t.prototype.unSelectLayer=function(t){var e=this.getLayer(t);e&&e.adapter.unselect&&e.adapter.unselect();var r=this._selectedLayers.indexOf(t);-1!==r&&this._selectedLayers.splice(r,1)},t.prototype.filterLayer=function(t,e){var r=this.getLayer(t);r&&r.adapter.filter&&r.adapter.filter(e)},t.prototype._setupMap=function(){return L(this,void 0,void 0,function(){var t,e,r,n,i,o;return P(this,function(s){switch(s.label){case 0:return this.settings&&(t=this.settings,e=t.extent_bottom,r=t.extent_left,n=t.extent_top,i=t.extent_right,e&&r&&n&&i&&(this._extent=[r,e,i,n],(o=this._extent)[3]>82&&(o[3]=82),o[1]<-82&&(o[1]=-82))),this.mapAdapter.displayProjection=this.displayProjection,this.mapAdapter.lonlatProjection=this.lonlatProjection,this.mapAdapter.create(this.options),this._addTreeLayers(),[4,this._addLayerProviders()];case 1:return s.sent(),this._zoomToInitialExtent(),this.emitter.emit("build-map",this.mapAdapter),[2,this]}})})},t.prototype._addTreeLayers=function(){return L(this,void 0,void 0,function(){var t,e,r;return P(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getSettings()];case 1:return(t=n.sent())&&(e=t.root_item)&&(this.layers=new m(this,e),this.emitter.emit("add-layers",this.layers)),[3,3];case 2:return r=n.sent(),console.error(r),[3,3];case 3:return[2]}})})},t.prototype._zoomToInitialExtent=function(){if(this._extent)this.mapAdapter.fit(this._extent);else{var t=this.options,e=t.center,r=t.zoom;e&&this.mapAdapter.setCenter(e),r&&this.mapAdapter.setZoom(r)}},t.prototype._addLayerProviders=function(){return L(this,void 0,void 0,function(){var t,e,r,n,i,o,s,a,p,u,c,h,l,f,y;return P(this,function(d){switch(d.label){case 0:d.trys.push([0,26,,27]),d.label=1;case 1:d.trys.push([1,19,20,25]),i=O(this._starterKits.filter(function(t){return t.getLayerAdapters})),d.label=2;case 2:return[4,i.next()];case 3:return(o=d.sent()).done?[3,18]:[4,(s=o.value).getLayerAdapters.call(s)];case 4:if(!(a=d.sent()))return[3,17];d.label=5;case 5:d.trys.push([5,11,12,17]),p=O(a),d.label=6;case 6:return[4,p.next()];case 7:return(u=d.sent()).done?[3,10]:[4,(c=u.value).createAdapter(this.mapAdapter)];case 8:(h=d.sent())&&(this.mapAdapter.layerAdapters[c.name]=h),d.label=9;case 9:return[3,6];case 10:return[3,17];case 11:return l=d.sent(),r={error:l},[3,17];case 12:return d.trys.push([12,,15,16]),u&&!u.done&&(n=p.return)?[4,n.call(p)]:[3,14];case 13:d.sent(),d.label=14;case 14:return[3,16];case 15:if(r)throw r.error;return[7];case 16:return[7];case 17:return[3,2];case 18:return[3,25];case 19:return f=d.sent(),t={error:f},[3,25];case 20:return d.trys.push([20,,23,24]),o&&!o.done&&(e=i.return)?[4,e.call(i)]:[3,22];case 21:d.sent(),d.label=22;case 22:return[3,24];case 23:if(t)throw t.error;return[7];case 24:return[7];case 25:return[3,27];case 26:throw y=d.sent(),new Error(y);case 27:return[2]}})})},t.prototype._onLayerClick=function(t){return L(this,void 0,void 0,function(){return P(this,function(e){return this.emitter.emit("layer:click",t),[2,Promise.resolve(t)]})})},t.prototype._addEventsListeners=function(){var t=this;this.mapAdapter.emitter.on("click",function(e){return t._onMapClick(e)})},t.prototype._onMapClick=function(t){var e=this;this.emitter.emit("click",t),this._starterKits.forEach(function(r){r.onMapClick&&r.onMapClick(t,e)})},t}();r.d(e,"WebMap",function(){return A}),r.d(e,"WebLayerEntry",function(){return m});e.default=A}]).default});
//# sourceMappingURL=webmap.js.map
{
"name": "@nextgis/webmap",
"version": "0.8.11",
"version": "0.8.14",
"description": "",

@@ -46,4 +46,4 @@ "main": "lib/webmap.js",

],
"license": "GPL-3.0",
"gitHead": "d6d7023fd831dcafe14aaaaaa7f298c2977b15f9"
"license": "LGPL 3.0",
"gitHead": "72144a923f2647767adf0542605a24328e57742d"
}

@@ -33,4 +33,4 @@ # WebMap

Need to fix a bug or add a feature to NextGIS Web? We provide custom development and support for this software. [Contact us](http://nextgis.com/contact/) to discuss options!
Need to fix a bug or add a feature to `@nextgis/ol-map-adapter`? We provide custom development and support for this software. [Contact us](http://nextgis.com/contact/) to discuss options!
[![http://nextgis.com](http://nextgis.ru/img/nextgis.png)](http://nextgis.com)

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