{"ast":null,"code":"import { __awaiter } from 'tslib';\nimport { Injectable, NgZone, ɵɵdefineInjectable, ɵɵinject, InjectionToken, Optional, Inject, LOCALE_ID, Directive, Input, EventEmitter, Output, Self, Component, ElementRef, PLATFORM_ID, ContentChildren, QueryList, forwardRef, NgModule } from '@angular/core';\nimport { Observable, BehaviorSubject, from, timer, ReplaySubject, bindCallback, of, throwError, fromEventPattern, merge, Subject } from 'rxjs';\nimport { flatMap, sample, switchMap, map, shareReplay, multicast, startWith, skip, distinctUntilChanged, takeUntil } from 'rxjs/operators';\nimport { isPlatformServer } from '@angular/common';\nclass MapsAPILoader {}\nMapsAPILoader.decorators = [{\n type: Injectable\n}];\n\n/**\n * Wrapper class that handles the communication with the Google Maps Javascript\n * API v3\n */\nclass GoogleMapsAPIWrapper {\n constructor(_loader, _zone) {\n this._loader = _loader;\n this._zone = _zone;\n this._map = new Promise(resolve => {\n this._mapResolver = resolve;\n });\n }\n createMap(el, mapOptions) {\n return this._zone.runOutsideAngular(() => {\n return this._loader.load().then(() => {\n const map = new google.maps.Map(el, mapOptions);\n this._mapResolver(map);\n return;\n });\n });\n }\n setMapOptions(options) {\n return this._zone.runOutsideAngular(() => {\n this._map.then(m => {\n m.setOptions(options);\n });\n });\n }\n /**\n * Creates a google map marker with the map context\n */\n createMarker(options = {}, addToMap = true) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n if (addToMap) {\n options.map = map;\n }\n return new google.maps.Marker(options);\n });\n });\n }\n createInfoWindow(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(() => new google.maps.InfoWindow(options));\n });\n }\n /**\n * Creates a google.map.Circle for the current map.\n */\n createCircle(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n options.map = map;\n return new google.maps.Circle(options);\n });\n });\n }\n /**\n * Creates a google.map.Rectangle for the current map.\n */\n createRectangle(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n options.map = map;\n return new google.maps.Rectangle(options);\n });\n });\n }\n createPolyline(options) {\n return this._zone.runOutsideAngular(() => {\n return this.getNativeMap().then(map => {\n const line = new google.maps.Polyline(options);\n line.setMap(map);\n return line;\n });\n });\n }\n createPolygon(options) {\n return this._zone.runOutsideAngular(() => {\n return this.getNativeMap().then(map => {\n const polygon = new google.maps.Polygon(options);\n polygon.setMap(map);\n return polygon;\n });\n });\n }\n /**\n * Creates a new google.map.Data layer for the current map\n */\n createDataLayer(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(m => {\n const data = new google.maps.Data(options);\n data.setMap(m);\n return data;\n });\n });\n }\n /**\n * Creates a TransitLayer instance for a map\n * @returns a new transit layer object\n */\n createTransitLayer() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n const newLayer = new google.maps.TransitLayer();\n newLayer.setMap(map);\n return newLayer;\n });\n });\n }\n /**\n * Creates a BicyclingLayer instance for a map\n * @returns a new bicycling layer object\n */\n createBicyclingLayer() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n const newLayer = new google.maps.BicyclingLayer();\n newLayer.setMap(map);\n return newLayer;\n });\n });\n }\n /**\n * Determines if given coordinates are insite a Polygon path.\n */\n containsLocation(latLng, polygon) {\n return this._map.then(() => google.maps.geometry.poly.containsLocation(latLng, polygon));\n }\n subscribeToMapEvent(eventName) {\n return new Observable(observer => {\n this._map.then(m => m.addListener(eventName, () => this._zone.run(() => observer.next(arguments[0]))));\n });\n }\n clearInstanceListeners() {\n return this._zone.runOutsideAngular(() => {\n this._map.then(map => {\n google.maps.event.clearInstanceListeners(map);\n });\n });\n }\n setCenter(latLng) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.setCenter(latLng));\n });\n }\n getZoom() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.getZoom());\n });\n }\n getBounds() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.getBounds());\n });\n }\n getMapTypeId() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.getMapTypeId());\n });\n }\n setZoom(zoom) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.setZoom(zoom));\n });\n }\n getCenter() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.getCenter());\n });\n }\n panTo(latLng) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.panTo(latLng));\n });\n }\n panBy(x, y) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.panBy(x, y));\n });\n }\n fitBounds(latLng, padding) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.fitBounds(latLng, padding));\n });\n }\n panToBounds(latLng, padding) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => map.panToBounds(latLng, padding));\n });\n }\n /**\n * Returns the native Google Maps Map instance. Be careful when using this instance directly.\n */\n getNativeMap() {\n return this._map;\n }\n /**\n * Triggers the given event name on the map instance.\n */\n triggerMapEvent(eventName) {\n return this._map.then(m => google.maps.event.trigger(m, eventName));\n }\n}\nGoogleMapsAPIWrapper.decorators = [{\n type: Injectable\n}];\nGoogleMapsAPIWrapper.ctorParameters = () => [{\n type: MapsAPILoader\n}, {\n type: NgZone\n}];\nclass CircleManager {\n constructor(_apiWrapper, _zone) {\n this._apiWrapper = _apiWrapper;\n this._zone = _zone;\n this._circles = new Map();\n }\n addCircle(circle) {\n this._apiWrapper.getNativeMap().then(() => this._circles.set(circle, this._apiWrapper.createCircle({\n center: {\n lat: circle.latitude,\n lng: circle.longitude\n },\n clickable: circle.clickable,\n draggable: circle.draggable,\n editable: circle.editable,\n fillColor: circle.fillColor,\n fillOpacity: circle.fillOpacity,\n radius: circle.radius,\n strokeColor: circle.strokeColor,\n strokeOpacity: circle.strokeOpacity,\n strokePosition: google.maps.StrokePosition[circle.strokePosition],\n strokeWeight: circle.strokeWeight,\n visible: circle.visible,\n zIndex: circle.zIndex\n })));\n }\n /**\n * Removes the given circle from the map.\n */\n removeCircle(circle) {\n return this._circles.get(circle).then(c => {\n c.setMap(null);\n this._circles.delete(circle);\n });\n }\n setOptions(circle, options) {\n return __awaiter(this, void 0, void 0, function* () {\n return this._circles.get(circle).then(c => {\n const actualParam = options.strokePosition;\n options.strokePosition = google.maps.StrokePosition[actualParam];\n c.setOptions(options);\n });\n });\n }\n getBounds(circle) {\n return this._circles.get(circle).then(c => c.getBounds());\n }\n getCenter(circle) {\n return this._circles.get(circle).then(c => c.getCenter());\n }\n getRadius(circle) {\n return this._circles.get(circle).then(c => c.getRadius());\n }\n setCenter(circle) {\n return this._circles.get(circle).then(c => c.setCenter({\n lat: circle.latitude,\n lng: circle.longitude\n }));\n }\n setEditable(circle) {\n return this._circles.get(circle).then(c => c.setEditable(circle.editable));\n }\n setDraggable(circle) {\n return this._circles.get(circle).then(c => c.setDraggable(circle.draggable));\n }\n setVisible(circle) {\n return this._circles.get(circle).then(c => c.setVisible(circle.visible));\n }\n setRadius(circle) {\n return this._circles.get(circle).then(c => c.setRadius(circle.radius));\n }\n getNativeCircle(circle) {\n return this._circles.get(circle);\n }\n createEventObservable(eventName, circle) {\n return new Observable(observer => {\n let listener = null;\n this._circles.get(circle).then(c => {\n listener = c.addListener(eventName, e => this._zone.run(() => observer.next(e)));\n });\n return () => {\n if (listener !== null) {\n listener.remove();\n }\n };\n });\n }\n}\nCircleManager.decorators = [{\n type: Injectable\n}];\nCircleManager.ctorParameters = () => [{\n type: GoogleMapsAPIWrapper\n}, {\n type: NgZone\n}];\n\n/**\n * Manages all Data Layers for a Google Map instance.\n */\nclass DataLayerManager {\n constructor(_wrapper, _zone) {\n this._wrapper = _wrapper;\n this._zone = _zone;\n this._layers = new Map();\n }\n /**\n * Adds a new Data Layer to the map.\n */\n addDataLayer(layer) {\n const newLayer = this._wrapper.createDataLayer({\n style: layer.style\n }).then(d => {\n if (layer.geoJson) {\n // NOTE: accessing \"features\" on google.maps.Data is undocumented\n this.getDataFeatures(d, layer.geoJson).then(features => d.features = features);\n }\n return d;\n });\n this._layers.set(layer, newLayer);\n }\n deleteDataLayer(layer) {\n this._layers.get(layer).then(l => {\n l.setMap(null);\n this._layers.delete(layer);\n });\n }\n updateGeoJson(layer, geoJson) {\n this._layers.get(layer).then(l => {\n l.forEach(feature => {\n l.remove(feature);\n // NOTE: accessing \"features\" on google.maps.Data is undocumented\n const index = l.features.indexOf(feature, 0);\n if (index > -1) {\n l.features.splice(index, 1);\n }\n });\n this.getDataFeatures(l, geoJson).then(features => l.features = features);\n });\n }\n setDataOptions(layer, options) {\n this._layers.get(layer).then(l => {\n l.setControlPosition(options.controlPosition);\n l.setControls(options.controls);\n l.setDrawingMode(options.drawingMode);\n l.setStyle(options.style);\n });\n }\n /**\n * Creates a Google Maps event listener for the given DataLayer as an Observable\n */\n createEventObservable(eventName, layer) {\n return new Observable(observer => {\n this._layers.get(layer).then(d => {\n d.addListener(eventName, e => this._zone.run(() => observer.next(e)));\n });\n });\n }\n /**\n * Extract features from a geoJson using google.maps Data Class\n * @param d : google.maps.Data class instance\n * @param geoJson : url or geojson object\n */\n getDataFeatures(d, geoJson) {\n return new Promise((resolve, reject) => {\n if (typeof geoJson === 'object') {\n try {\n const features = d.addGeoJson(geoJson);\n resolve(features);\n } catch (e) {\n reject(e);\n }\n } else if (typeof geoJson === 'string') {\n d.loadGeoJson(geoJson, null, resolve);\n } else {\n reject(`Impossible to extract features from geoJson: wrong argument type`);\n }\n });\n }\n}\nDataLayerManager.decorators = [{\n type: Injectable\n}];\nDataLayerManager.ctorParameters = () => [{\n type: GoogleMapsAPIWrapper\n}, {\n type: NgZone\n}];\n\n/**\n * Class to implement when you what to be able to make it work with the auto fit bounds feature\n * of AGM.\n */\nclass FitBoundsAccessor {}\n/**\n * The FitBoundsService is responsible for computing the bounds of the a single map.\n */\nclass FitBoundsService {\n constructor(loader) {\n this._boundsChangeSampleTime$ = new BehaviorSubject(200);\n this._includeInBounds$ = new BehaviorSubject(new Map());\n this.bounds$ = from(loader.load()).pipe(flatMap(() => this._includeInBounds$), sample(this._boundsChangeSampleTime$.pipe(switchMap(time => timer(0, time)))), map(includeInBounds => this._generateBounds(includeInBounds)), shareReplay(1));\n }\n _generateBounds(includeInBounds) {\n const bounds = new google.maps.LatLngBounds();\n includeInBounds.forEach(b => bounds.extend(b));\n return bounds;\n }\n addToBounds(latLng) {\n const id = this._createIdentifier(latLng);\n if (this._includeInBounds$.value.has(id)) {\n return;\n }\n const boundsMap = this._includeInBounds$.value;\n boundsMap.set(id, latLng);\n this._includeInBounds$.next(boundsMap);\n }\n removeFromBounds(latLng) {\n const boundsMap = this._includeInBounds$.value;\n boundsMap.delete(this._createIdentifier(latLng));\n this._includeInBounds$.next(boundsMap);\n }\n changeFitBoundsChangeSampleTime(timeMs) {\n this._boundsChangeSampleTime$.next(timeMs);\n }\n getBounds$() {\n return this.bounds$;\n }\n _createIdentifier(latLng) {\n return `${latLng.lat}+${latLng.lng}`;\n }\n}\nFitBoundsService.decorators = [{\n type: Injectable\n}];\nFitBoundsService.ctorParameters = () => [{\n type: MapsAPILoader\n}];\nclass AgmGeocoder {\n constructor(loader) {\n const connectableGeocoder$ = new Observable(subscriber => {\n loader.load().then(() => subscriber.next());\n }).pipe(map(() => this._createGeocoder()), multicast(new ReplaySubject(1)));\n connectableGeocoder$.connect(); // ignore the subscription\n // since we will remain subscribed till application exits\n this.geocoder$ = connectableGeocoder$;\n }\n geocode(request) {\n return this.geocoder$.pipe(switchMap(geocoder => this._getGoogleResults(geocoder, request)));\n }\n _getGoogleResults(geocoder, request) {\n const geocodeObservable = bindCallback(geocoder.geocode);\n return geocodeObservable(request).pipe(switchMap(([results, status]) => {\n if (status === google.maps.GeocoderStatus.OK) {\n return of(results);\n }\n return throwError(status);\n }));\n }\n _createGeocoder() {\n return new google.maps.Geocoder();\n }\n}\nAgmGeocoder.ɵprov = ɵɵdefineInjectable({\n factory: function AgmGeocoder_Factory() {\n return new AgmGeocoder(ɵɵinject(MapsAPILoader));\n },\n token: AgmGeocoder,\n providedIn: \"root\"\n});\nAgmGeocoder.decorators = [{\n type: Injectable,\n args: [{\n providedIn: 'root'\n }]\n}];\nAgmGeocoder.ctorParameters = () => [{\n type: MapsAPILoader\n}];\nclass WindowRef {\n getNativeWindow() {\n return window;\n }\n}\nclass DocumentRef {\n getNativeDocument() {\n return document;\n }\n}\nconst BROWSER_GLOBALS_PROVIDERS = [WindowRef, DocumentRef];\nvar GoogleMapsScriptProtocol;\n(function (GoogleMapsScriptProtocol) {\n GoogleMapsScriptProtocol[GoogleMapsScriptProtocol[\"HTTP\"] = 1] = \"HTTP\";\n GoogleMapsScriptProtocol[GoogleMapsScriptProtocol[\"HTTPS\"] = 2] = \"HTTPS\";\n GoogleMapsScriptProtocol[GoogleMapsScriptProtocol[\"AUTO\"] = 3] = \"AUTO\";\n})(GoogleMapsScriptProtocol || (GoogleMapsScriptProtocol = {}));\n/**\n * Token for the config of the LazyMapsAPILoader. Please provide an object of type {@link\n * LazyMapsAPILoaderConfig}.\n */\nconst LAZY_MAPS_API_CONFIG = new InjectionToken('angular-google-maps LAZY_MAPS_API_CONFIG');\nclass LazyMapsAPILoader extends MapsAPILoader {\n constructor(config = null, w, d, localeId) {\n super();\n this.localeId = localeId;\n this._SCRIPT_ID = 'agmGoogleMapsApiScript';\n this.callbackName = `agmLazyMapsAPILoader`;\n this._config = config || {};\n this._windowRef = w;\n this._documentRef = d;\n }\n load() {\n const window = this._windowRef.getNativeWindow();\n if (window.google && window.google.maps) {\n // Google maps already loaded on the page.\n return Promise.resolve();\n }\n if (this._scriptLoadingPromise) {\n return this._scriptLoadingPromise;\n }\n // this can happen in HMR situations or Stackblitz.io editors.\n const scriptOnPage = this._documentRef.getNativeDocument().getElementById(this._SCRIPT_ID);\n if (scriptOnPage) {\n this._assignScriptLoadingPromise(scriptOnPage);\n return this._scriptLoadingPromise;\n }\n const script = this._documentRef.getNativeDocument().createElement('script');\n script.type = 'text/javascript';\n script.async = true;\n script.defer = true;\n script.id = this._SCRIPT_ID;\n script.src = this._getScriptSrc(this.callbackName);\n this._assignScriptLoadingPromise(script);\n this._documentRef.getNativeDocument().body.appendChild(script);\n return this._scriptLoadingPromise;\n }\n _assignScriptLoadingPromise(scriptElem) {\n this._scriptLoadingPromise = new Promise((resolve, reject) => {\n this._windowRef.getNativeWindow()[this.callbackName] = () => {\n resolve();\n };\n scriptElem.onerror = error => {\n reject(error);\n };\n });\n }\n _getScriptSrc(callbackName) {\n const protocolType = this._config && this._config.protocol || GoogleMapsScriptProtocol.HTTPS;\n let protocol;\n switch (protocolType) {\n case GoogleMapsScriptProtocol.AUTO:\n protocol = '';\n break;\n case GoogleMapsScriptProtocol.HTTP:\n protocol = 'http:';\n break;\n case GoogleMapsScriptProtocol.HTTPS:\n protocol = 'https:';\n break;\n }\n const hostAndPath = this._config.hostAndPath || 'maps.googleapis.com/maps/api/js';\n const queryParams = {\n v: this._config.apiVersion || 'quarterly',\n callback: callbackName,\n key: this._config.apiKey,\n client: this._config.clientId,\n channel: this._config.channel,\n libraries: this._config.libraries,\n region: this._config.region,\n language: this._config.language || (this.localeId !== 'en-US' ? this.localeId : null)\n };\n const params = Object.keys(queryParams).filter(k => queryParams[k] != null).filter(k => {\n // remove empty arrays\n return !Array.isArray(queryParams[k]) || Array.isArray(queryParams[k]) && queryParams[k].length > 0;\n }).map(k => {\n // join arrays as comma seperated strings\n const i = queryParams[k];\n if (Array.isArray(i)) {\n return {\n key: k,\n value: i.join(',')\n };\n }\n return {\n key: k,\n value: queryParams[k]\n };\n }).map(entry => {\n return `${entry.key}=${entry.value}`;\n }).join('&');\n return `${protocol}//${hostAndPath}?${params}`;\n }\n}\nLazyMapsAPILoader.decorators = [{\n type: Injectable\n}];\nLazyMapsAPILoader.ctorParameters = () => [{\n type: undefined,\n decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [LAZY_MAPS_API_CONFIG]\n }]\n}, {\n type: WindowRef\n}, {\n type: DocumentRef\n}, {\n type: String,\n decorators: [{\n type: Inject,\n args: [LOCALE_ID]\n }]\n}];\nclass MarkerManager {\n constructor(_mapsWrapper, _zone) {\n this._mapsWrapper = _mapsWrapper;\n this._zone = _zone;\n this._markers = new Map();\n }\n convertAnimation(uiAnim) {\n return __awaiter(this, void 0, void 0, function* () {\n if (uiAnim === null) {\n return null;\n } else {\n return this._mapsWrapper.getNativeMap().then(() => google.maps.Animation[uiAnim]);\n }\n });\n }\n deleteMarker(markerDirective) {\n const markerPromise = this._markers.get(markerDirective);\n if (markerPromise == null) {\n // marker already deleted\n return Promise.resolve();\n }\n return markerPromise.then(marker => {\n return this._zone.run(() => {\n marker.setMap(null);\n this._markers.delete(markerDirective);\n });\n });\n }\n updateMarkerPosition(marker) {\n return this._markers.get(marker).then(m => m.setPosition({\n lat: marker.latitude,\n lng: marker.longitude\n }));\n }\n updateTitle(marker) {\n return this._markers.get(marker).then(m => m.setTitle(marker.title));\n }\n updateLabel(marker) {\n return this._markers.get(marker).then(m => {\n m.setLabel(marker.label);\n });\n }\n updateDraggable(marker) {\n return this._markers.get(marker).then(m => m.setDraggable(marker.draggable));\n }\n updateIcon(marker) {\n return this._markers.get(marker).then(m => m.setIcon(marker.iconUrl));\n }\n updateOpacity(marker) {\n return this._markers.get(marker).then(m => m.setOpacity(marker.opacity));\n }\n updateVisible(marker) {\n return this._markers.get(marker).then(m => m.setVisible(marker.visible));\n }\n updateZIndex(marker) {\n return this._markers.get(marker).then(m => m.setZIndex(marker.zIndex));\n }\n updateClickable(marker) {\n return this._markers.get(marker).then(m => m.setClickable(marker.clickable));\n }\n updateAnimation(marker) {\n return __awaiter(this, void 0, void 0, function* () {\n const m = yield this._markers.get(marker);\n m.setAnimation(yield this.convertAnimation(marker.animation));\n });\n }\n addMarker(marker) {\n const markerPromise = new Promise(resolve => __awaiter(this, void 0, void 0, function* () {\n return this._mapsWrapper.createMarker({\n position: {\n lat: marker.latitude,\n lng: marker.longitude\n },\n label: marker.label,\n draggable: marker.draggable,\n icon: marker.iconUrl,\n opacity: marker.opacity,\n visible: marker.visible,\n zIndex: marker.zIndex,\n title: marker.title,\n clickable: marker.clickable,\n animation: yield this.convertAnimation(marker.animation)\n }).then(resolve);\n }));\n this._markers.set(marker, markerPromise);\n }\n getNativeMarker(marker) {\n return this._markers.get(marker);\n }\n createEventObservable(eventName, marker) {\n return new Observable(observer => {\n this._markers.get(marker).then(m => m.addListener(eventName, e => this._zone.run(() => observer.next(e))));\n });\n }\n}\nMarkerManager.decorators = [{\n type: Injectable\n}];\nMarkerManager.ctorParameters = () => [{\n type: GoogleMapsAPIWrapper\n}, {\n type: NgZone\n}];\nclass InfoWindowManager {\n constructor(_mapsWrapper, _zone, _markerManager) {\n this._mapsWrapper = _mapsWrapper;\n this._zone = _zone;\n this._markerManager = _markerManager;\n this._infoWindows = new Map();\n }\n deleteInfoWindow(infoWindow) {\n const iWindow = this._infoWindows.get(infoWindow);\n if (iWindow == null) {\n // info window already deleted\n return Promise.resolve();\n }\n return iWindow.then(i => {\n return this._zone.run(() => {\n i.close();\n this._infoWindows.delete(infoWindow);\n });\n });\n }\n setPosition(infoWindow) {\n return this._infoWindows.get(infoWindow).then(i => i.setPosition({\n lat: infoWindow.latitude,\n lng: infoWindow.longitude\n }));\n }\n setZIndex(infoWindow) {\n return this._infoWindows.get(infoWindow).then(i => i.setZIndex(infoWindow.zIndex));\n }\n open(infoWindow) {\n return this._infoWindows.get(infoWindow).then(w => {\n if (infoWindow.hostMarker != null) {\n return this._markerManager.getNativeMarker(infoWindow.hostMarker).then(marker => {\n return this._mapsWrapper.getNativeMap().then(map => w.open(map, marker));\n });\n }\n return this._mapsWrapper.getNativeMap().then(map => w.open(map));\n });\n }\n close(infoWindow) {\n return this._infoWindows.get(infoWindow).then(w => w.close());\n }\n setOptions(infoWindow, options) {\n return this._infoWindows.get(infoWindow).then(i => i.setOptions(options));\n }\n addInfoWindow(infoWindow) {\n const options = {\n content: infoWindow.content,\n maxWidth: infoWindow.maxWidth,\n zIndex: infoWindow.zIndex,\n disableAutoPan: infoWindow.disableAutoPan\n };\n if (typeof infoWindow.latitude === 'number' && typeof infoWindow.longitude === 'number') {\n options.position = {\n lat: infoWindow.latitude,\n lng: infoWindow.longitude\n };\n }\n const infoWindowPromise = this._mapsWrapper.createInfoWindow(options);\n this._infoWindows.set(infoWindow, infoWindowPromise);\n }\n /**\n * Creates a Google Maps event listener for the given InfoWindow as an Observable\n */\n createEventObservable(eventName, infoWindow) {\n return new Observable(observer => {\n this._infoWindows.get(infoWindow).then(i => {\n i.addListener(eventName, e => this._zone.run(() => observer.next(e)));\n });\n });\n }\n}\nInfoWindowManager.decorators = [{\n type: Injectable\n}];\nInfoWindowManager.ctorParameters = () => [{\n type: GoogleMapsAPIWrapper\n}, {\n type: NgZone\n}, {\n type: MarkerManager\n}];\n\n/**\n * Manages all KML Layers for a Google Map instance.\n */\nclass KmlLayerManager {\n constructor(_wrapper, _zone) {\n this._wrapper = _wrapper;\n this._zone = _zone;\n this._layers = new Map();\n }\n /**\n * Adds a new KML Layer to the map.\n */\n addKmlLayer(layer) {\n const newLayer = this._wrapper.getNativeMap().then(m => {\n return new google.maps.KmlLayer({\n clickable: layer.clickable,\n map: m,\n preserveViewport: layer.preserveViewport,\n screenOverlays: layer.screenOverlays,\n suppressInfoWindows: layer.suppressInfoWindows,\n url: layer.url,\n zIndex: layer.zIndex\n });\n });\n this._layers.set(layer, newLayer);\n }\n setOptions(layer, options) {\n this._layers.get(layer).then(l => l.setOptions(options));\n }\n deleteKmlLayer(layer) {\n this._layers.get(layer).then(l => {\n l.setMap(null);\n this._layers.delete(layer);\n });\n }\n /**\n * Creates a Google Maps event listener for the given KmlLayer as an Observable\n */\n createEventObservable(eventName, layer) {\n return new Observable(observer => {\n this._layers.get(layer).then(m => {\n m.addListener(eventName, e => this._zone.run(() => observer.next(e)));\n });\n });\n }\n}\nKmlLayerManager.decorators = [{\n type: Injectable\n}];\nKmlLayerManager.ctorParameters = () => [{\n type: GoogleMapsAPIWrapper\n}, {\n type: NgZone\n}];\n\n/**\n * This class manages Transit and Bicycling Layers for a Google Map instance.\n */\nclass LayerManager {\n constructor(_wrapper) {\n this._wrapper = _wrapper;\n this._layers = new Map();\n }\n /**\n * Adds a transit layer to a map instance.\n * @param layer - a TransitLayer object\n * @param _options - TransitLayerOptions options\n * @returns void\n */\n addTransitLayer(layer) {\n const newLayer = this._wrapper.createTransitLayer();\n this._layers.set(layer, newLayer);\n }\n /**\n * Adds a bicycling layer to a map instance.\n * @param layer - a bicycling layer object\n * @param _options - BicyclingLayer options\n * @returns void\n */\n addBicyclingLayer(layer) {\n const newLayer = this._wrapper.createBicyclingLayer();\n this._layers.set(layer, newLayer);\n }\n /**\n * Deletes a map layer\n * @param layer - the layer to delete\n */\n deleteLayer(layer) {\n return this._layers.get(layer).then(currentLayer => {\n currentLayer.setMap(null);\n this._layers.delete(layer);\n });\n }\n}\nLayerManager.decorators = [{\n type: Injectable\n}];\nLayerManager.ctorParameters = () => [{\n type: GoogleMapsAPIWrapper\n}];\n\n/**\n * When using the NoOpMapsAPILoader, the Google Maps API must be added to the page via a `