/*! @preserve * Leaflet Panel Layers v1.3.1 - 2022-11-18 * * Copyright 2022 Stefano Cudini * stefano.cudini@gmail.com * https://opengeo.tech/ * * Licensed under the MIT license. * * Demos: * https://opengeo.tech/maps/leaflet-panel-layers/ * * Source: * git@github.com:stefanocudini/leaflet-panel-layers.git */ !function(e){if("function"==typeof define&&define.amd)define(["leaflet"],e);else if("undefined"!=typeof module)module.exports=e(require("leaflet"));else{if(void 0===window.L)throw"Leaflet must be loaded first";e(window.L)}}(function(l){return l.Control.PanelLayers=l.Control.Layers.extend({includes:"1"===l.version[0]?l.Evented.prototype:l.Mixin.Events,options:{compact:!1,compactOffset:0,collapsed:!1,autoZIndex:!0,collapsibleGroups:!1,selectorGroup:!1,buildItem:null,title:"",className:"",position:"topright"},initialize:function(e,t,a){var i,s,r;for(i in l.setOptions(this,a),this._layers=[],this._groups={},this._items={},this._layersActives=[],this._lastZIndex=0,this._handlingClick=!1,this.className="leaflet-panel-layers",e)if(e[i].group&&e[i].layers)for(s in r=e[i].collapsed||!1,e[i].layers)this._addLayer(e[i].layers[s],!1,e[i].group,r);else this._addLayer(e[i],!1);for(i in t)if(t[i].group&&t[i].layers)for(s in r=t[i].collapsed||!1,t[i].layers)this._addLayer(t[i].layers[s],!0,t[i].group,r);else this._addLayer(t[i],!0)},onAdd:function(e){var t,a=this;for(t in this._layersActives)e.addLayer(this._layersActives[t]);return l.Control.Layers.prototype.onAdd.call(this,e),this._map.on("resize",function(e){a._updateHeight(e.newSize.y)}),this._onInputClick(),this._container},addBaseLayer:function(e,t,a){return e.name=t||e.name||"",this._addLayer(e,!1,a),this._update(),this},addOverlay:function(e,t,a){return e.name=t||e.name||"",this._addLayer(e,!0,a),this._update(),this},removeLayer:function(e){e=e.hasOwnProperty("layer")?this._layerFromDef(e):e;return this._map.removeLayer(e),l.Control.Layers.prototype.removeLayer.call(this,e),this},clearLayers:function(){for(var e=0;e"+this.options.title+"",t.appendChild(e)),t.appendChild(this._form)},_updateHeight:function(e){e=e||this._map.getSize().y,this.options.compact?this._form.style.maxHeight=e-this.options.compactOffset+"px":this._form.style.height=e+"px"},_expand:function(){l.DomUtil.addClass(this._container,"expanded")},_collapse:function(){this._container.className=this._container.className.replace("expanded","")},_getPath:function(e,t){var a=t.split("."),t=a.pop(),i=a.length,s=a[0],r=1;if(0