text: import Guid from './Guid';
  import Validate from './Validate';
  import Log from './log/Log';
  /**
   * Provides access to the application's browser session and active page.
   *
   * @public
   */
  var Session = /** @class */ (function () {
      function Session() {
      }
      /**
       * This is called once by the system during startup to initialize the Session object.
       * @internal
       */
      Session._initialize = function (data) {
          Validate.isNotNullOrUndefined(data, 'data');
          Session._applicationId = Guid.tryParse(data.applicationId) || Guid.empty;
          var pageIdGuid = Guid.tryParse(data.pageId);
          if (!pageIdGuid) {
              Log.warn('Session', 'The pageId parameter was undefined or invalid. Generating a new Guid');
              pageIdGuid = Guid.newGuid();
          }
          Session._pageId = pageIdGuid;
          this._clientSideApplicationId = data.clientSideApplicationId;
      };
      /**
       * This is called by the framework to indicate that the current page has changed.
       * @internal
       */
      Session._changePage = function () {
          Session._pageId = Guid.newGuid();
      };
      Object.defineProperty(Session, "applicationId", {
          /**
           * A unique identifier for the current instance of the client-side application.
           *
           * @remarks
           * A unique identifier used to correlate logging and other diagnostic information. Its lifetime
           * persists for the duration of the client-side application instance, i.e. it begins with the
           * server request that renders the page, and ends e.g. when the browser tab is closed or F5 is
           * pressed to reload the page.  Note that if the application's router supports in-place navigation
           * (via the history.pushState() API), the application session persists across these transitions.
           */
          get: function () {
              return this._applicationId;
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(Session, "clientSideApplicationId", {
          /**
           * The id of the currently running application
           */
          get: function () {
              return this._clientSideApplicationId;
          },
          enumerable: false,
          configurable: true
      });
      /**
       * This is called by the framework to set the current application if it may have changed.
       * @internal
       */
      Session._setClientSideApplicationId = function (clientSideApplicationId) {
          this._clientSideApplicationId = clientSideApplicationId;
      };
      Object.defineProperty(Session, "pageId", {
          /**
           * A unique identifier for the current page within the client-side application.
           *
           * @remarks
           * A unique identifier used to correlate logging and other diagnostic information.  Whereas the
           * {@link Session.applicationId} tracks the entire lifetime of the client-side application instance,
           * the pageId tracks an individual "page" that is rendered.
           *
           * For example, suppose that the application initially loads PageA, then the user does in-place
           * navigation (via the history.pushState() API) to PageB, then navigates back to PageA, and finally
           * they close the browser tab. During this sequence, the applicationId will remain the same, however
           * the pageId will change on each navigation.  The 3 different pageId values are used by the diagnostics
           * e.g. to track success/failure statistics for PageA independently of PageB.
           *
           * The concept of a page is subjective and defined by the router for a particular application.
           */
          get: function () {
              return this._pageId;
          },
          enumerable: false,
          configurable: true
      });
      return Session;
  }());
  export default Session;
  //# sourceMappingURL=Session.js.map