/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265 /// import { Directive, EventEmitter, NgZone, Output, inject } from '@angular/core'; import { GoogleMap } from '../google-map/google-map'; import * as i0 from "@angular/core"; /** * Angular component that renders a Google Maps Bicycling Layer via the Google Maps JavaScript API. * * See developers.google.com/maps/documentation/javascript/reference/map#BicyclingLayer */ export class MapBicyclingLayer { constructor() { this._map = inject(GoogleMap); this._zone = inject(NgZone); /** Event emitted when the bicycling layer is initialized. */ this.bicyclingLayerInitialized = new EventEmitter(); } ngOnInit() { if (this._map._isBrowser) { if (google.maps.BicyclingLayer && this._map.googleMap) { this._initialize(this._map.googleMap, google.maps.BicyclingLayer); } else { this._zone.runOutsideAngular(() => { Promise.all([this._map._resolveMap(), google.maps.importLibrary('maps')]).then(([map, lib]) => { this._initialize(map, lib.BicyclingLayer); }); }); } } } _initialize(map, layerConstructor) { this._zone.runOutsideAngular(() => { this.bicyclingLayer = new layerConstructor(); this.bicyclingLayerInitialized.emit(this.bicyclingLayer); this._assertLayerInitialized(); this.bicyclingLayer.setMap(map); }); } ngOnDestroy() { this.bicyclingLayer?.setMap(null); } _assertLayerInitialized() { if (!this.bicyclingLayer) { throw Error('Cannot interact with a Google Map Bicycling Layer before it has been initialized. ' + 'Please wait for the Transit Layer to load before trying to interact with it.'); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0-next.2", ngImport: i0, type: MapBicyclingLayer, deps: [], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.0-next.2", type: MapBicyclingLayer, isStandalone: true, selector: "map-bicycling-layer", outputs: { bicyclingLayerInitialized: "bicyclingLayerInitialized" }, exportAs: ["mapBicyclingLayer"], ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0-next.2", ngImport: i0, type: MapBicyclingLayer, decorators: [{ type: Directive, args: [{ selector: 'map-bicycling-layer', exportAs: 'mapBicyclingLayer', standalone: true, }] }], propDecorators: { bicyclingLayerInitialized: [{ type: Output }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFwLWJpY3ljbGluZy1sYXllci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9nb29nbGUtbWFwcy9tYXAtYmljeWNsaW5nLWxheWVyL21hcC1iaWN5Y2xpbmctbGF5ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgseUVBQXlFO0FBQ3pFLHFEQUFxRDtBQUVyRCxPQUFPLEVBQUMsU0FBUyxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQXFCLE1BQU0sRUFBRSxNQUFNLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFFakcsT0FBTyxFQUFDLFNBQVMsRUFBQyxNQUFNLDBCQUEwQixDQUFDOztBQUVuRDs7OztHQUlHO0FBTUgsTUFBTSxPQUFPLGlCQUFpQjtJQUw5QjtRQU1VLFNBQUksR0FBRyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDekIsVUFBSyxHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQztRQVMvQiw2REFBNkQ7UUFDMUMsOEJBQXlCLEdBQzFDLElBQUksWUFBWSxFQUE4QixDQUFDO0tBdUNsRDtJQXJDQyxRQUFRO1FBQ04sSUFBSSxJQUFJLENBQUMsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDO1lBQ3pCLElBQUksTUFBTSxDQUFDLElBQUksQ0FBQyxjQUFjLElBQUksSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsQ0FBQztnQkFDdEQsSUFBSSxDQUFDLFdBQ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