text: /* */ 
  "format cjs";
  import { Injectable, Inject, Optional } from '@angular/core';
  import { isBlank } from '../../src/facade/lang';
  import { BaseException } from '../../src/facade/exceptions';
  import { PlatformLocation } from './platform_location';
  import { LocationStrategy, APP_BASE_HREF } from './location_strategy';
  import { Location } from './location';
  export class PathLocationStrategy extends LocationStrategy {
      constructor(_platformLocation, href) {
          super();
          this._platformLocation = _platformLocation;
          if (isBlank(href)) {
              href = this._platformLocation.getBaseHrefFromDOM();
          }
          if (isBlank(href)) {
              throw new BaseException(`No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.`);
          }
          this._baseHref = href;
      }
      onPopState(fn) {
          this._platformLocation.onPopState(fn);
          this._platformLocation.onHashChange(fn);
      }
      getBaseHref() { return this._baseHref; }
      prepareExternalUrl(internal) {
          return Location.joinWithSlash(this._baseHref, internal);
      }
      path() {
          return this._platformLocation.pathname +
              Location.normalizeQueryParams(this._platformLocation.search);
      }
      pushState(state, title, url, queryParams) {
          var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
          this._platformLocation.pushState(state, title, externalUrl);
      }
      replaceState(state, title, url, queryParams) {
          var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
          this._platformLocation.replaceState(state, title, externalUrl);
      }
      forward() { this._platformLocation.forward(); }
      back() { this._platformLocation.back(); }
  }
  PathLocationStrategy.decorators = [
      { type: Injectable },
  ];
  PathLocationStrategy.ctorParameters = [
      { type: PlatformLocation, },
      { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [APP_BASE_HREF,] },] },
  ];
  //# sourceMappingURL=path_location_strategy.js.map