text: import { Directive, EventEmitter, ContentChildren, QueryList, Input, Output } from '@angular/core';
  import { MarkerManager } from '../services/managers/marker-manager';
  import { AgmInfoWindow } from './info-window';
  var markerId = 0;
  /**
   * AgmMarker renders a map marker inside a {@link AgmMap}.
   *
   * ### Example
   * ```typescript
   * import { Component } from '@angular/core';
   *
   * @Component({
   *  selector: 'my-map-cmp',
   *  styles: [`
   *    .agm-map-container {
   *      height: 300px;
   *    }
   * `],
   *  template: `
   *    <agm-map [latitude]="lat" [longitude]="lng" [zoom]="zoom">
   *      <agm-marker [latitude]="lat" [longitude]="lng" [label]="'M'">
   *      </agm-marker>
   *    </agm-map>
   *  `
   * })
   * ```
   */
  var AgmMarker = (function () {
      function AgmMarker(_markerManager) {
          this._markerManager = _markerManager;
          /**
           * If true, the marker can be dragged. Default value is false.
           */
          // tslint:disable-next-line:no-input-rename
          this.draggable = false;
          /**
           * If true, the marker is visible
           */
          this.visible = true;
          /**
           * Whether to automatically open the child info window when the marker is clicked.
           */
          this.openInfoWindow = true;
          /**
           * The marker's opacity between 0.0 and 1.0.
           */
          this.opacity = 1;
          /**
           * All markers are displayed on the map in order of their zIndex, with higher values displaying in
           * front of markers with lower values. By default, markers are displayed according to their
           * vertical position on screen, with lower markers appearing in front of markers further up the
           * screen.
           */
          this.zIndex = 1;
          /**
           * If true, the marker can be clicked. Default value is true.
           */
          // tslint:disable-next-line:no-input-rename
          this.clickable = true;
          /**
           * This event emitter gets emitted when the user clicks on the marker.
           */
          this.markerClick = new EventEmitter();
          /**
           * This event is fired when the user stops dragging the marker.
           */
          this.dragEnd = new EventEmitter();
          /**
           * This event is fired when the user mouses over the marker.
           */
          this.mouseOver = new EventEmitter();
          /**
           * This event is fired when the user mouses outside the marker.
           */
          this.mouseOut = new EventEmitter();
          /**
           * @internal
           */
          this.infoWindow = new QueryList();
          this._markerAddedToManger = false;
          this._observableSubscriptions = [];
          this._id = (markerId++).toString();
      }
      /* @internal */
      AgmMarker.prototype.ngAfterContentInit = function () {
          var _this = this;
          this.handleInfoWindowUpdate();
          this.infoWindow.changes.subscribe(function () { return _this.handleInfoWindowUpdate(); });
      };
      AgmMarker.prototype.handleInfoWindowUpdate = function () {
          var _this = this;
          if (this.infoWindow.length > 1) {
              throw new Error('Expected no more than one info window.');
          }
          this.infoWindow.forEach(function (marker) {
              marker.hostMarker = _this;
          });
      };
      /** @internal */
      AgmMarker.prototype.ngOnChanges = function (changes) {
          if (typeof this.latitude !== 'number' || typeof this.longitude !== 'number') {
              return;
          }
          if (!this._markerAddedToManger) {
              this._markerManager.addMarker(this);
              this._markerAddedToManger = true;
              this._addEventListeners();
              return;
          }
          if (changes['latitude'] || changes['longitude']) {
              this._markerManager.updateMarkerPosition(this);
          }
          if (changes['title']) {
              this._markerManager.updateTitle(this);
          }
          if (changes['label']) {
              this._markerManager.updateLabel(this);
          }
          if (changes['draggable']) {
              this._markerManager.updateDraggable(this);
          }
          if (changes['iconUrl']) {
              this._markerManager.updateIcon(this);
          }
          if (changes['opacity']) {
              this._markerManager.updateOpacity(this);
          }
          if (changes['visible']) {
              this._markerManager.updateVisible(this);
          }
          if (changes['zIndex']) {
              this._markerManager.updateZIndex(this);
          }
          if (changes['clickable']) {
              this._markerManager.updateClickable(this);
          }
          if (changes['animation']) {
              this._markerManager.updateAnimation(this);
          }
          // if (changes['infoLabel']) {
          //   // this._markerManager.updateInfoLabel(this);
          // }
      };
      AgmMarker.prototype._addEventListeners = function () {
          var _this = this;
          var cs = this._markerManager.createEventObservable('click', this).subscribe(function () {
              if (_this.openInfoWindow) {
                  _this.infoWindow.forEach(function (infoWindow) { return infoWindow.open(); });
              }
              _this.markerClick.emit(null);
          });
          this._observableSubscriptions.push(cs);
          var ds = this._markerManager.createEventObservable('dragend', this)
              .subscribe(function (e) {
              _this.dragEnd.emit({ coords: { lat: e.latLng.lat(), lng: e.latLng.lng() } });
          });
          this._observableSubscriptions.push(ds);
          var mover = this._markerManager.createEventObservable('mouseover', this)
              .subscribe(function (e) {
              _this.mouseOver.emit({ coords: { lat: e.latLng.lat(), lng: e.latLng.lng() } });
          });
          this._observableSubscriptions.push(mover);
          var mout = this._markerManager.createEventObservable('mouseout', this)
              .subscribe(function (e) {
              _this.mouseOut.emit({ coords: { lat: e.latLng.lat(), lng: e.latLng.lng() } });
          });
          this._observableSubscriptions.push(mout);
      };
      /** @internal */
      AgmMarker.prototype.id = function () { return this._id; };
      /** @internal */
      AgmMarker.prototype.toString = function () { return 'AgmMarker-' + this._id.toString(); };
      /** @internal */
      AgmMarker.prototype.ngOnDestroy = function () {
          this._markerManager.deleteMarker(this);
          // unsubscribe all registered observable subscriptions
          this._observableSubscriptions.forEach(function (s) { return s.unsubscribe(); });
      };
      return AgmMarker;
  }());
  export { AgmMarker };
  AgmMarker.decorators = [
      { type: Directive, args: [{
                  selector: 'agm-marker',
                  inputs: [
                      'latitude', 'longitude', 'title', 'label', 'draggable: markerDraggable', 'iconUrl',
                      'openInfoWindow', 'opacity', 'visible', 'zIndex', 'animation', 'infoLabel'
                  ],
                  outputs: ['markerClick', 'dragEnd', 'mouseOver', 'mouseOut']
              },] },
  ];
  /** @nocollapse */
  AgmMarker.ctorParameters = function () { return [
      { type: MarkerManager, },
  ]; };
  AgmMarker.propDecorators = {
      'latitude': [{ type: Input },],
      'longitude': [{ type: Input },],
      'title': [{ type: Input },],
      'label': [{ type: Input },],
      'draggable': [{ type: Input, args: ['markerDraggable',] },],
      'iconUrl': [{ type: Input },],
      'visible': [{ type: Input },],
      'openInfoWindow': [{ type: Input },],
      'opacity': [{ type: Input },],
      'zIndex': [{ type: Input },],
      'clickable': [{ type: Input, args: ['markerClickable',] },],
      'infoLabel': [{ type: Input },],
      'markerClick': [{ type: Output },],
      'dragEnd': [{ type: Output },],
      'mouseOver': [{ type: Output },],
      'mouseOut': [{ type: Output },],
      'infoWindow': [{ type: ContentChildren, args: [AgmInfoWindow,] },],
  };
  //# sourceMappingURL=marker.js.map