/**
 * @fileoverview added by tsickle
 * Generated from: lib/routing/services/prev-route.service.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Injectable } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/operators';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
var PrevRouteService = /** @class */ (function () {
    function PrevRouteService(router) {
        this.router = router;
        this.history = [];
    }
    /**
     * @return {?}
     */
    PrevRouteService.prototype.loadRouting = /**
     * @return {?}
     */
    function () {
        var _this = this;
        this.router.events
            .pipe(filter((/**
         * @param {?} event
         * @return {?}
         */
        function (event) { return event instanceof NavigationEnd; })))
            .subscribe((/**
         * @param {?} __0
         * @return {?}
         */
        function (_a) {
            var urlAfterRedirects = _a.urlAfterRedirects;
            _this.history = tslib_1.__spread(_this.history, [urlAfterRedirects]);
        }));
    };
    /**
     * @return {?}
     */
    PrevRouteService.prototype.getHistory = /**
     * @return {?}
     */
    function () {
        return this.history;
    };
    /**
     * @return {?}
     */
    PrevRouteService.prototype.getPreviousUrl = /**
     * @return {?}
     */
    function () {
        return this.history[this.history.length - 2] || '/';
    };
    PrevRouteService.decorators = [
        { type: Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    /** @nocollapse */
    PrevRouteService.ctorParameters = function () { return [
        { type: Router }
    ]; };
    /** @nocollapse */ PrevRouteService.ngInjectableDef = i0.defineInjectable({ factory: function PrevRouteService_Factory() { return new PrevRouteService(i0.inject(i1.Router)); }, token: PrevRouteService, providedIn: "root" });
    return PrevRouteService;
}());
export { PrevRouteService };
if (false) {
    /**
     * @type {?}
     * @private
     */
    PrevRouteService.prototype.history;
    /**
     * @type {?}
     * @private
     */
    PrevRouteService.prototype.router;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJldi1yb3V0ZS5zZXJ2aWNlLmpzIiwic291cmNlUm9v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