import { __decorate, __metadata, __assign } from 'tslib';
import { Injectable, ɵɵdefineInjectable, EventEmitter, Component, Input, ViewChild, Output, Pipe, NgModule } from '@angular/core';
import { GeoJSON, FeatureGroup, TileLayer, Map, LatLng, Control } from 'leaflet';
import { faShareSquare, faEye, faEyeSlash, faSearch, faMapPin, faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons';
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
import { CommonModule } from '@angular/common';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { FormsModule } from '@angular/forms';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

/**
 * @fileoverview added by tsickle
 * Generated from: lib/dependencs/AgromaxCamada.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * @template T
 */
var  /**
 * @template T
 */
AgromaxCamada = /** @class */ (function () {
    function AgromaxCamada(id, color, featureGroup, name, map) {
        this.id = id;
        this.color = color;
        this.name = name;
        this.map = map;
        this.isEnable = false;
        this.ft = true;
        this.featureGroup = featureGroup;
    }
    Object.defineProperty(AgromaxCamada.prototype, "featureGroup", {
        get: /**
         * @return {?}
         */
        function () {
            return this._featureGroup;
        },
        set: /**
         * @param {?} v
         * @return {?}
         */
        function (v) {
            if (this._featureGroup) {
                this.disable();
            }
            this._featureGroup = v;
            this.enable();
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @return {?}
     */
    AgromaxCamada.prototype.disable = /**
     * @return {?}
     */
    function () {
        this._featureGroup.removeFrom(this.map);
        this.isEnable = false;
    };
    /**
     * @return {?}
     */
    AgromaxCamada.prototype.enable = /**
     * @return {?}
     */
    function () {
        this._featureGroup.addTo(this.map);
        this.isEnable = true;
    };
    /**
     * @return {?}
     */
    AgromaxCamada.prototype.zoom = /**
     * @return {?}
     */
    function () {
        this.map.fitBounds(this._featureGroup.getBounds());
    };
    /**
     * @param {?} index
     * @return {?}
     */
    AgromaxCamada.prototype.updexOfsetIndex = /**
     * @param {?} index
     * @return {?}
     */
    function (index) {
        this.featureGroup.setZIndex(index);
    };
    return AgromaxCamada;
}());
if (false) {
    /**
     * @type {?}
     * @private
     */
    AgromaxCamada.prototype._featureGroup;
    /** @type {?} */
    AgromaxCamada.prototype.isEnable;
    /** @type {?} */
    AgromaxCamada.prototype.ft;
    /** @type {?} */
    AgromaxCamada.prototype.id;
    /** @type {?} */
    AgromaxCamada.prototype.color;
    /** @type {?} */
    AgromaxCamada.prototype.name;
    /**
     * @type {?}
     * @private
     */
    AgromaxCamada.prototype.map;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/dependencs/getCamada.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * @return {?}
 */
function getCamada() {
    return (/**
     * @param {?} target
     * @param {?} propertyKey
     * @param {?} descriptor
     * @return {?}
     */
    function (target, propertyKey, descriptor) {
        /** @type {?} */
        var originalMethod = descriptor.value;
        descriptor.value = (/**
         * @return {?}
         */
        function () {
            /** @type {?} */
            var args;
            /** @type {?} */
            var context = this;
            args = Array.from(arguments);
            if (!args[0]) {
                args[1] = this.grupoDeCamadas;
            }
            if (!args[1]) {
                args[1] = [this.getCamada(args[0])];
            }
            originalMethod.apply(context, args);
        });
        return descriptor;
    });
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/dependencs/AgromaxLeafletController.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
// @dynamic
/**
 * @template T
 */
var AgromaxLeafletController = /** @class */ (function () {
    function AgromaxLeafletController(map) {
        this.map = map;
        this.couter = 100;
        this.grupoDeCamadas = [];
    }
    /**
     * @private
     * @param {?} color
     * @param {?} feature
     * @param {?} name
     * @return {?}
     */
    AgromaxLeafletController.prototype.CreateCamada = /**
     * @private
     * @param {?} color
     * @param {?} feature
     * @param {?} name
     * @return {?}
     */
    function (color, feature, name) {
        return new AgromaxCamada(this.couter++, color, feature, name, this.map);
    };
    /**
     * @return {?}
     */
    AgromaxLeafletController.prototype.refreshMap = /**
     * @return {?}
     */
    function () {
        try {
            // @ts-ignore
            ((/** @type {?} */ (this.map)))._onResize();
        }
        catch (error) {
            this.map.invalidateSize();
        }
    };
    /**
     * @example
     * ```typescript
     * agromaxLeafletController.enableCamada() // enables all
     * agromaxLeafletController.enableCamada("argila") // enables camada argila
     * ```
     */
    /**
     * \@example
     * ```typescript
     * agromaxLeafletController.enableCamada() // enables all
     * agromaxLeafletController.enableCamada("argila") // enables camada argila
     * ```
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    AgromaxLeafletController.prototype.enableCamada = /**
     * \@example
     * ```typescript
     * agromaxLeafletController.enableCamada() // enables all
     * agromaxLeafletController.enableCamada("argila") // enables camada argila
     * ```
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    function (camada, args) {
        args.forEach((/**
         * @param {?} i
         * @return {?}
         */
        function (i) { return i.enable(); }));
    };
    /**
     * @example
     * ```typescript
     * agromaxLeafletController.disableCamada() // disable all
     * agromaxLeafletController.disableCamada("argila") // disable camada argila
     * ```
     */
    /**
     * \@example
     * ```typescript
     * agromaxLeafletController.disableCamada() // disable all
     * agromaxLeafletController.disableCamada("argila") // disable camada argila
     * ```
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    AgromaxLeafletController.prototype.disableCamada = /**
     * \@example
     * ```typescript
     * agromaxLeafletController.disableCamada() // disable all
     * agromaxLeafletController.disableCamada("argila") // disable camada argila
     * ```
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    function (camada, args) {
        args.forEach((/**
         * @param {?} i
         * @return {?}
         */
        function (i) { return i.disable(); }));
    };
    /**
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    AgromaxLeafletController.prototype.zoonInCamada = /**
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    function (camada, args) {
        args[0].zoom();
    };
    /**
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    AgromaxLeafletController.prototype.removeCamada = /**
     * @param {?=} camada
     * @param {?=} args
     * @return {?}
     */
    function (camada, args) {
        this.grupoDeCamadas = this.grupoDeCamadas.filter((/**
         * @param {?} i
         * @return {?}
         */
        function (i) {
            if (args.find((/**
             * @param {?} j
             * @return {?}
             */
            function (j) { return j.name; }))) {
                i.disable();
                return false;
            }
            else {
                return true;
            }
        }));
    };
    /**
     * @param {?} feature
     * @param {?} name
     * @param {?} options
     * @param {?} color
     * @return {?}
     */
    AgromaxLeafletController.prototype.addFeature = /**
     * @param {?} feature
     * @param {?} name
     * @param {?} options
     * @param {?} color
     * @return {?}
     */
    function (feature, name, options, color) {
        if (this.getCamada(name)) {
            throw new Error('Nome Ja utilizado');
        }
        /** @type {?} */
        var layer = new GeoJSON(feature, options);
        this.grupoDeCamadas.push(this.CreateCamada(color, new FeatureGroup([layer]), name));
    };
    /**
     * @param {?} featureCollection
     * @param {?} name
     * @return {?}
     */
    AgromaxLeafletController.prototype.addGeoJson = /**
     * @param {?} featureCollection
     * @param {?} name
     * @return {?}
     */
    function (featureCollection, name) {
        if (this.getCamada(name)) {
            throw new Error('Nome Ja utilizado');
        }
        this.grupoDeCamadas.push(this.CreateCamada("red", new FeatureGroup(featureCollection.getLayers()), name));
    };
    /**
     * @param {?} featureCollection
     * @param {?} name
     * @param {?} element
     * @return {?}
     */
    AgromaxLeafletController.prototype.addCamada = /**
     * @param {?} featureCollection
     * @param {?} name
     * @param {?} element
     * @return {?}
     */
    function (featureCollection, name, element) {
        var _this = this;
        if (this.getCamada(name)) {
            throw new Error('Nome Ja utilizado');
        }
        /** @type {?} */
        var baseColor = featureCollection.features[0].properties._color;
        /** @type {?} */
        var options = {
            style: {
                color: baseColor,
                fillColor: baseColor,
                fillOpacity: 0.5,
            }
        };
        if (featureCollection.features[0] && featureCollection.features[0].properties[element] &&
            Number.isFinite(+(featureCollection.features[0].properties[element]))) {
            /** @type {?} */
            var maxValue_1 = featureCollection.features.reduce((/**
             * @param {?} i
             * @param {?} k
             * @return {?}
             */
            function (i, k) {
                if (i.properties[element] > k.properties[element]) {
                    return i;
                }
                return k;
            })).properties[element];
            /** @type {?} */
            var minValue_1 = featureCollection.features.reduce((/**
             * @param {?} i
             * @param {?} k
             * @return {?}
             */
            function (i, k) {
                if (i.properties[element] < k.properties[element]) {
                    return i;
                }
                return k;
            })).properties[element];
            options.onEachFeature = (/**
             * @param {?} feature
             * @param {?} thisLayer
             * @return {?}
             */
            function (feature, thisLayer) {
                /** @type {?} */
                var camadavalue = feature.properties[element];
                /** @type {?} */
                var color = _this.getColor(baseColor, camadavalue, Number(minValue_1), Number(maxValue_1));
                thisLayer.options.color = color;
                thisLayer.options.fillColor = color;
                thisLayer.bindPopup("<p>Valor: " + (+camadavalue).toFixed(2) + "</p>");
            });
        }
        /** @type {?} */
        var layer = new GeoJSON(featureCollection, options);
        this.grupoDeCamadas.push(this.CreateCamada(baseColor, new FeatureGroup(layer.getLayers()), name));
    };
    /**
     * @private
     * @param {?} baseColor
     * @param {?} value
     * @param {?} min
     * @param {?} max
     * @return {?}
     */
    AgromaxLeafletController.prototype.getColor = /**
     * @private
     * @param {?} baseColor
     * @param {?} value
     * @param {?} min
     * @param {?} max
     * @return {?}
     */
    function (baseColor, value, min, max) {
        /** @type {?} */
        var totalPercent = -(((value - min) / (max - min)) * 100);
        return this.shadeColor(baseColor, totalPercent);
    };
    /**
     * @private
     * @param {?} color
     * @param {?} percent
     * @return {?}
     */
    AgromaxLeafletController.prototype.shadeColor = /**
     * @private
     * @param {?} color
     * @param {?} percent
     * @return {?}
     */
    function (color, percent) {
        /** @type {?} */
        var R = parseInt(color.substring(1, 3), 16);
        /** @type {?} */
        var G = parseInt(color.substring(3, 5), 16);
        /** @type {?} */
        var B = parseInt(color.substring(5, 7), 16);
        R = parseInt('' + (R * (100 + percent) / 100));
        G = parseInt('' + (G * (100 + percent) / 100));
        B = parseInt('' + (B * (100 + percent) / 100));
        R = (R < 255) ? R : 255;
        G = (G < 255) ? G : 255;
        B = (B < 255) ? B : 255;
        /** @type {?} */
        var RR = ((R.toString(16).length === 1) ? '0' + R.toString(16) : R.toString(16));
        /** @type {?} */
        var GG = ((G.toString(16).length === 1) ? '0' + G.toString(16) : G.toString(16));
        /** @type {?} */
        var BB = ((B.toString(16).length === 1) ? '0' + B.toString(16) : B.toString(16));
        return '#' + RR + GG + BB;
    };
    /**
     * @param {?} camadas
     * @return {?}
     */
    AgromaxLeafletController.prototype.addCamadas = /**
     * @param {?} camadas
     * @return {?}
     */
    function (camadas) {
        var _this = this;
        /** @type {?} */
        var allNames = this.grupoDeCamadas.map((/**
         * @param {?} i
         * @return {?}
         */
        function (i) { return i.name; }));
        /** @type {?} */
        var equalNames = camadas.find((/**
         * @param {?} i
         * @return {?}
         */
        function (i) {
            return !!allNames.find((/**
             * @param {?} k
             * @return {?}
             */
            function (k) { return k === i.name; }));
        }));
        if (!!equalNames) {
            throw new Error(equalNames.name + " ja existe");
        }
        camadas.forEach((/**
         * @param {?} i
         * @return {?}
         */
        function (i) {
            try {
                _this.addCamada(i.geojson, i.name, i.element);
            }
            catch (e) {
                console.error(e);
            }
        }));
        return this.grupoDeCamadas;
    };
    /**
     * @param {?} name
     * @return {?}
     */
    AgromaxLeafletController.prototype.getCamada = /**
     * @param {?} name
     * @return {?}
     */
    function (name) {
        /** @type {?} */
        var featureGroup = this.grupoDeCamadas.find((/**
         * @param {?} i
         * @return {?}
         */
        function (i) { return i.name === name; }));
        if (!featureGroup) {
            console.warn('Camada não encontrada');
        }
        return featureGroup;
    };
    __decorate([
        getCamada(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [String, Array]),
        __metadata("design:returntype", void 0)
    ], AgromaxLeafletController.prototype, "enableCamada", null);
    __decorate([
        getCamada(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [String, Array]),
        __metadata("design:returntype", void 0)
    ], AgromaxLeafletController.prototype, "disableCamada", null);
    __decorate([
        getCamada(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [String, Array]),
        __metadata("design:returntype", void 0)
    ], AgromaxLeafletController.prototype, "zoonInCamada", null);
    __decorate([
        getCamada(),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [String, Array]),
        __metadata("design:returntype", void 0)
    ], AgromaxLeafletController.prototype, "removeCamada", null);
    return AgromaxLeafletController;
}());
if (false) {
    /**
     * @type {?}
     * @private
     */
    AgromaxLeafletController.prototype.couter;
    /** @type {?} */
    AgromaxLeafletController.prototype.grupoDeCamadas;
    /** @type {?} */
    AgromaxLeafletController.prototype.map;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/leaflet-map.constants.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/** @type {?} */
var UMD_VERSION = 2;
/** @type {?} */
var MAP_LINK = '<a href="https://www.esri.com/">Esri</a>';
/** @type {?} */
var WHO_LINK = 'i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community';
/** @type {?} */
var SATELITE = (/**
 * @return {?}
 */
function () { return new TileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
    attribution: '&copy; ' + MAP_LINK + ', ' + WHO_LINK,
    subdomains: ['otile1', 'otile2', 'otile3', 'otile4']
}); });
/** @type {?} */
var STREET = (/**
 * @return {?}
 */
function () { return new TileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a target="_blank" href="https://www.ciag.org.br">CIAg</a>'
}); });

/**
 * @fileoverview added by tsickle
 * Generated from: lib/leaflet-map.service.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LeafletMapService = /** @class */ (function () {
    function LeafletMapService() {
        this.defaultOptions = { center: [43.0, -79.0], zoom: 13, maxZoom: 17, layers: [SATELITE()] };
    }
    /**
     * @template T
     * @param {?} divId
     * @param {?=} options
     * @param {?=} mapOptions
     * @return {?}
     */
    LeafletMapService.prototype.createMap = /**
     * @template T
     * @param {?} divId
     * @param {?=} options
     * @param {?=} mapOptions
     * @return {?}
     */
    function (divId, options, mapOptions) {
        if (options === void 0) { options = { showLayerControl: false, layersControl: { Satélite: SATELITE(), Mapa: STREET() } }; }
        if (mapOptions === void 0) { mapOptions = {}; }
        /** @type {?} */
        var map = new Map(divId, __assign({}, Object.assign(this.defaultOptions, mapOptions)));
        this.defaultOptions = { center: [43.0, -79.0], zoom: 13, maxZoom: 17, layers: [SATELITE()] };
        map.setView(new LatLng(-12.7553139, -44.4046542), 4);
        if (options.showLayerControl) {
            new Control.Layers(options.layersControl).addTo(map);
        }
        if (options.updateOnResize) {
            window.addEventListener('resize', (/**
             * @return {?}
             */
            function () {
                map.invalidateSize();
            }));
        }
        return new AgromaxLeafletController(map);
    };
    LeafletMapService.decorators = [
        { type: Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    /** @nocollapse */
    LeafletMapService.ctorParameters = function () { return []; };
    /** @nocollapse */ LeafletMapService.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeafletMapService_Factory() { return new LeafletMapService(); }, token: LeafletMapService, providedIn: "root" });
    return LeafletMapService;
}());
if (false) {
    /** @type {?} */
    LeafletMapService.prototype.defaultOptions;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/AlertControllerComponent.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var AlertControllerComponent = /** @class */ (function () {
    function AlertControllerComponent() {
        this._newError = new EventEmitter();
    }
    /**
     * @param {?} error
     * @return {?}
     */
    AlertControllerComponent.prototype.addError = /**
     * @param {?} error
     * @return {?}
     */
    function (error) {
        var _this = this;
        this._newError.emit(error);
        setTimeout((/**
         * @param {?} i
         * @return {?}
         */
        function (i) {
            _this._newError.emit(null);
        }), 4000);
    };
    /**
     * @return {?}
     */
    AlertControllerComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        var _this = this;
        this._newError.subscribe((/**
         * @param {?} i
         * @return {?}
         */
        function (i) {
            _this.message = i;
        }));
    };
    AlertControllerComponent.decorators = [
        { type: Component, args: [{
                    selector: 'lib-leaflet-map-alert',
                    template: "<div *ngIf=\"message\" class=\"alert alert-danger alert-dismissible\" role=\"alert\">\n              {{message}}\n              <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">\n                <span aria-hidden=\"true\">&times;</span>\n              </button>\n            </div>"
                }] }
    ];
    /** @nocollapse */
    AlertControllerComponent.ctorParameters = function () { return []; };
    return AlertControllerComponent;
}());
if (false) {
    /** @type {?} */
    AlertControllerComponent.prototype.message;
    /** @type {?} */
    AlertControllerComponent.prototype._newError;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/leaflet-map.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LeafletMapComponent = /** @class */ (function () {
    function LeafletMapComponent(leafletMapService) {
        this.leafletMapService = leafletMapService;
        this.searchText = '';
        this.isCollapsed = true;
        this.geojson = [];
        this.shareIntent = new EventEmitter();
        this.icons = { faShareSquare: faShareSquare, faEye: faEye, faEyeSlash: faEyeSlash, faSearch: faSearch, faMapPin: faMapPin, faChevronLeft: faChevronLeft, faChevronRight: faChevronRight };
        this.allCamadasEnable = true;
        this.featureCollection = [];
    }
    /**
     * @return {?}
     */
    LeafletMapComponent.prototype.ngAfterViewInit = /**
     * @return {?}
     */
    function () {
        this.mapController = this.leafletMapService.createMap(this.divMap.nativeElement, { updateOnResize: true, showLayerControl: this.showLayersControll });
        if (this.geojson && this.geojson.length) {
            this.addGeoJsons(this.geojson);
        }
    };
    /**
     * @param {?} state
     * @return {?}
     */
    LeafletMapComponent.prototype.alterShowMenu = /**
     * @param {?} state
     * @return {?}
     */
    function (state) {
        this.showMenu = state;
        this.mapController.refreshMap();
    };
    /**
     * @param {?} geojson
     * @return {?}
     */
    LeafletMapComponent.prototype.addGeoJson = /**
     * @param {?} geojson
     * @return {?}
     */
    function (geojson) {
        this.featureCollection = this.mapController.addCamadas([geojson]);
    };
    /**
     * @param {?} geojson
     * @return {?}
     */
    LeafletMapComponent.prototype.addGeoJsons = /**
     * @param {?} geojson
     * @return {?}
     */
    function (geojson) {
        this.featureCollection = this.mapController.addCamadas(geojson);
    };
    /**
     * @private
     * @return {?}
     */
    LeafletMapComponent.prototype.checkAllCamadasEnable = /**
     * @private
     * @return {?}
     */
    function () {
        this.allCamadasEnable = !this.featureCollection.find((/**
         * @param {?} i
         * @return {?}
         */
        function (i) { return !i.isEnable; }));
    };
    /**
     * @param {?} event
     * @param {?} camada
     * @return {?}
     */
    LeafletMapComponent.prototype.updateCamadaStatus = /**
     * @param {?} event
     * @param {?} camada
     * @return {?}
     */
    function (event, camada) {
        /** @type {?} */
        var checked = event.checked;
        checked ? this.mapController.enableCamada(camada) : this.mapController.disableCamada(camada);
        this.checkAllCamadasEnable();
    };
    /**
     * @param {?} camada
     * @return {?}
     */
    LeafletMapComponent.prototype.selectCamada = /**
     * @param {?} camada
     * @return {?}
     */
    function (camada) {
        this.mapController.zoonInCamada(camada);
    };
    /**
     * @return {?}
     */
    LeafletMapComponent.prototype.share = /**
     * @return {?}
     */
    function () {
        /** @type {?} */
        var camadasEnabledInJson = this.mapController.grupoDeCamadas
            .filter((/**
         * @param {?} i
         * @return {?}
         */
        function (i) { return i.isEnable; }))
            .map((/**
         * @param {?} i
         * @return {?}
         */
        function (i) { return (/** @type {?} */ (i.featureGroup.toGeoJSON())); }));
        if (!camadasEnabledInJson.length) {
            this.errorAlert.addError('nenhuma camada selecionada');
            console.error('nenhuma camada selecionada');
        }
        else {
            this.shareIntent.emit(camadasEnabledInJson);
        }
    };
    /**
     * @param {?} event
     * @return {?}
     */
    LeafletMapComponent.prototype.listCamadasChengeOrder = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        moveItemInArray(this.featureCollection, event.previousIndex, event.currentIndex);
    };
    LeafletMapComponent.decorators = [
        { type: Component, args: [{
                    selector: 'lib-leaflet-map',
                    template: "<link href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\" rel=\"stylesheet\">\r\n<link href=\"https://fonts.googleapis.com/icon?family=Material+Icons\" rel=\"stylesheet\">\r\n<lib-leaflet-map-alert #errorAlert></lib-leaflet-map-alert>\r\n<div class=\"conteiner h-100\">\r\n    <div class=\"mapDiv w-75\" [ngClass]=\"{'w-75':showMenu,'w-100':!showMenu}\">\r\n        <div #divMap>\r\n            <div *ngIf=\"canShowMenu && !showMenu\" class=\"btn-group float-right h-100 showMenu\" style=\"z-index: 1001\">\r\n                <button type=\"buttons\" id=\"others\" (click)=\"alterShowMenu(true)\"\r\n                    class=\"btn-showMenu btn-showMenu-show btn-warning\">\r\n                    <fa-icon [icon]=\"icons.faChevronLeft\"></fa-icon>\r\n                </button>\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <div *ngIf=\"showMenu\" class=\"camadasDiv\">\r\n        <div class=\"card h-100\" style=\"width: 18rem;\">\r\n            <div class=\"card-header h-10 text-center\">\r\n                <button *ngIf=\"canShowMenu\" type=\"buttons\" id=\"others\" (click)=\"alterShowMenu(false)\"\r\n                    class=\"leaflet-control-layers-toggle btn-showMenu btn-showMenu btn-showMenu-hide\">\r\n                    <fa-icon [icon]=\"icons.faChevronRight\"></fa-icon>\r\n                </button>\r\n                <div>\r\n                    <div class=\"float-left\">\r\n                        <small id=\"emailHelp\" class=\"form-text text-muted\">\r\n                            <fa-icon [icon]=\"icons.faEye\"></fa-icon>\r\n                        </small>\r\n                        <mat-slide-toggle [checked]=\"allCamadasEnable\" (change)=\"updateCamadaStatus($event,null)\">\r\n                        </mat-slide-toggle>\r\n                    </div>\r\n                    <button type=\"button\" class=\"btn btn-outline\" (click)=\"isCollapsed = !isCollapsed\"\r\n                        [attr.aria-expanded]=\"!isCollapsed\" aria-controls=\"collapseExample\">\r\n                        <fa-icon [icon]=\"icons.faSearch\"></fa-icon>\r\n                    </button>Camadas\r\n                    <fa-icon class=\"float-right\" (click)=\"share()\" [icon]=\"icons.faShareSquare\"></fa-icon>\r\n                </div>\r\n                <div id=\"collapseExample\" [ngbCollapse]=\"isCollapsed\">\r\n                    <input [(ngModel)]=\"searchText\" #ctrl=\"ngModel\" class=\"form-control\" placeholder=\"Procurar...\">\r\n\r\n                </div>\r\n            </div>\r\n            <ul class=\"list-group listaCamadas h-100\" cdkDropList (cdkDropListDropped)=\"listCamadasChengeOrder($event)\">\r\n                <li *ngFor=\"let item of featureCollection | filter : searchText\" cdkDrag\r\n                    class=\"list-group-item list-group-item-action text-center\">\r\n                    <div class=\"itemSelect\">\r\n                        <div class=\"float-left\">\r\n                            <small id=\"emailHelp\" class=\"form-text text-muted\">\r\n                                <fa-icon *ngIf=\"!item.isEnable\" [icon]=\"icons.faEyeSlash\"></fa-icon>\r\n                            </small>\r\n                            <mat-slide-toggle id=\"{{this.id+''+item.name}}\" [checked]=\"item.isEnable\"\r\n                                (change)=\"updateCamadaStatus($event,item.name)\"></mat-slide-toggle>\r\n                        </div>\r\n                        <label class=\"form-check-label text-center\">{{item.name}}</label>\r\n                        <button class=\"btn btn-outline-warning float-right\" (click)=\"selectCamada(item.name)\">\r\n                            <fa-icon [icon]=\"icons.faMapPin\">\r\n                            </fa-icon>\r\n                        </button>\r\n                    </div>\r\n                    <div class=\"cardDivider\" [ngStyle]=\"{'background-color':item.color}\"></div>\r\n                </li>\r\n            </ul>\r\n        </div>\r\n    </div>",
                    styles: ["body{margin:0;font-family:Roboto,\"Helvetica Neue\",sans-serif}.mapDiv div{height:100%}.container{max-width:unset}.col-3,.col-4,.col-8,.col-9{padding:0}.itemSelect{position:relative}.btn-showMenu{width:36px;height:36px;border-radius:5px 0 0 5px;border:unset}.btn-showMenu-show{margin-top:22vh;box-shadow:-3px 3px rgba(0,0,0,.288)}.btn-showMenu-hide{position:absolute;top:0;left:0;background:0 0}.listaCamadas{overflow:scroll}.conteiner{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center}lib-leaflet-map-alert{position:absolute;top:0;z-index:10000;width:100%}::-webkit-scrollbar{width:10px}::-webkit-scrollbar-track{background:#f1f1f1}::-webkit-scrollbar-thumb{background:#888}::-webkit-scrollbar-thumb:hover{background:#555}.cardDivider{height:1vh;width:100%;position:absolute;top:0;left:0}"]
                }] }
    ];
    /** @nocollapse */
    LeafletMapComponent.ctorParameters = function () { return [
        { type: LeafletMapService }
    ]; };
    LeafletMapComponent.propDecorators = {
        geojson: [{ type: Input }],
        id: [{ type: Input }],
        canShowMenu: [{ type: Input }],
        showMenu: [{ type: Input }],
        showLayersControll: [{ type: Input }],
        divMap: [{ type: ViewChild, args: ['divMap', { static: false },] }],
        errorAlert: [{ type: ViewChild, args: ['errorAlert', { static: false },] }],
        shareIntent: [{ type: Output }]
    };
    return LeafletMapComponent;
}());
if (false) {
    /** @type {?} */
    LeafletMapComponent.prototype.searchText;
    /** @type {?} */
    LeafletMapComponent.prototype.isCollapsed;
    /** @type {?} */
    LeafletMapComponent.prototype.geojson;
    /** @type {?} */
    LeafletMapComponent.prototype.id;
    /** @type {?} */
    LeafletMapComponent.prototype.canShowMenu;
    /** @type {?} */
    LeafletMapComponent.prototype.showMenu;
    /** @type {?} */
    LeafletMapComponent.prototype.showLayersControll;
    /** @type {?} */
    LeafletMapComponent.prototype.divMap;
    /** @type {?} */
    LeafletMapComponent.prototype.errorAlert;
    /** @type {?} */
    LeafletMapComponent.prototype.shareIntent;
    /** @type {?} */
    LeafletMapComponent.prototype.icons;
    /** @type {?} */
    LeafletMapComponent.prototype.allCamadasEnable;
    /** @type {?} */
    LeafletMapComponent.prototype.mapController;
    /** @type {?} */
    LeafletMapComponent.prototype.featureCollection;
    /** @type {?} */
    LeafletMapComponent.prototype.leafletMapService;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/leaflet-map-camadas-filert.pipe.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LeafletMapCamadasFilterPipe = /** @class */ (function () {
    function LeafletMapCamadasFilterPipe() {
    }
    /**
     * @param {?} items
     * @param {?} searchText
     * @return {?}
     */
    LeafletMapCamadasFilterPipe.prototype.transform = /**
     * @param {?} items
     * @param {?} searchText
     * @return {?}
     */
    function (items, searchText) {
        if (!items)
            return [];
        if (!searchText)
            return items;
        searchText = searchText.toLowerCase();
        return items.filter((/**
         * @param {?} it
         * @return {?}
         */
        function (it) { return it.name.toLowerCase().includes(searchText); }));
    };
    LeafletMapCamadasFilterPipe.decorators = [
        { type: Pipe, args: [{
                    name: 'filter'
                },] }
    ];
    return LeafletMapCamadasFilterPipe;
}());

/**
 * @fileoverview added by tsickle
 * Generated from: lib/leaflet-map.module.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
var LeafletMapModule = /** @class */ (function () {
    function LeafletMapModule() {
    }
    LeafletMapModule.decorators = [
        { type: NgModule, args: [{
                    declarations: [LeafletMapComponent, AlertControllerComponent, LeafletMapCamadasFilterPipe],
                    imports: [
                        NgbModule,
                        CommonModule,
                        FontAwesomeModule,
                        MatSlideToggleModule,
                        DragDropModule,
                        FormsModule,
                        MatExpansionModule,
                        MatFormFieldModule
                    ],
                    exports: [LeafletMapComponent, AlertControllerComponent]
                },] }
    ];
    /** @nocollapse */
    LeafletMapModule.ctorParameters = function () { return []; };
    return LeafletMapModule;
}());

/**
 * @fileoverview added by tsickle
 * Generated from: lib/dependencs/index.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */

/**
 * @fileoverview added by tsickle
 * Generated from: public-api.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */

/**
 * @fileoverview added by tsickle
 * Generated from: ciag-leaflet-map.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */

export { AgromaxCamada, AgromaxLeafletController, AlertControllerComponent, LeafletMapCamadasFilterPipe, LeafletMapComponent, LeafletMapModule, LeafletMapService, getCamada };
//# sourceMappingURL=ciag-leaflet-map.js.map
