agm-direction
Version:
directive for agm (not official)
1 lines • 113 kB
JavaScript
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("agm-direction",["exports","@angular/core","rxjs","rxjs/operators","@angular/common"],factory):factory(((global=global||self).ng=global.ng||{},global.ng.agmDirection={}),global.ng.core,global.rxjs,global.rxjs.operators,global.ng.common)}(this,function(exports,core,rxjs,operators,common){"use strict";var extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};function __decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;0<=i;i--)(d=decorators[i])&&(r=(c<3?d(r):3<c?d(target,key,r):d(target,key))||r);return 3<c&&r&&Object.defineProperty(target,key,r),r}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __metadata(metadataKey,metadataValue){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(thisArg,_arguments,P,generator){return new(P=P||Promise)(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=0<(t=_.trys).length&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function __read(o,n){var m="function"==typeof Symbol&&o[Symbol.iterator];if(!m)return o;var r,e,i=m.call(o),ar=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error:error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar}function __spread(){for(var ar=[],i=0;i<arguments.length;i++)ar=ar.concat(__read(arguments[i]));return ar}function FitBoundsAccessor(){}var MapsAPILoader=function(){function MapsAPILoader(){}return MapsAPILoader=__decorate([core.Injectable()],MapsAPILoader)}(),GoogleMapsAPIWrapper=function(){function GoogleMapsAPIWrapper(_loader,_zone){var _this=this;this._loader=_loader,this._zone=_zone,this._map=new Promise(function(resolve){_this._mapResolver=resolve})}return GoogleMapsAPIWrapper.prototype.createMap=function(el,mapOptions){var _this=this;return this._zone.runOutsideAngular(function(){return _this._loader.load().then(function(){var map=new google.maps.Map(el,mapOptions);_this._mapResolver(map)})})},GoogleMapsAPIWrapper.prototype.setMapOptions=function(options){var _this=this;return this._zone.runOutsideAngular(function(){_this._map.then(function(m){m.setOptions(options)})})},GoogleMapsAPIWrapper.prototype.createMarker=function(options,addToMap){var _this=this;return void 0===options&&(options={}),void 0===addToMap&&(addToMap=!0),this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return addToMap&&(options.map=map),new google.maps.Marker(options)})})},GoogleMapsAPIWrapper.prototype.createInfoWindow=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(){return new google.maps.InfoWindow(options)})})},GoogleMapsAPIWrapper.prototype.createCircle=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return"string"==typeof options.strokePosition&&(options.strokePosition=google.maps.StrokePosition[options.strokePosition]),options.map=map,new google.maps.Circle(options)})})},GoogleMapsAPIWrapper.prototype.createRectangle=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return options.map=map,new google.maps.Rectangle(options)})})},GoogleMapsAPIWrapper.prototype.createPolyline=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this.getNativeMap().then(function(map){var line=new google.maps.Polyline(options);return line.setMap(map),line})})},GoogleMapsAPIWrapper.prototype.createPolygon=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this.getNativeMap().then(function(map){var polygon=new google.maps.Polygon(options);return polygon.setMap(map),polygon})})},GoogleMapsAPIWrapper.prototype.createDataLayer=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(m){var data=new google.maps.Data(options);return data.setMap(m),data})})},GoogleMapsAPIWrapper.prototype.createTransitLayer=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){var newLayer=new google.maps.TransitLayer;return newLayer.setMap(options.visible?map:null),newLayer})})},GoogleMapsAPIWrapper.prototype.createBicyclingLayer=function(options){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){var newLayer=new google.maps.BicyclingLayer;return newLayer.setMap(options.visible?map:null),newLayer})})},GoogleMapsAPIWrapper.prototype.containsLocation=function(latLng,polygon){return google.maps.geometry.poly.containsLocation(latLng,polygon)},GoogleMapsAPIWrapper.prototype.subscribeToMapEvent=function(eventName){var _this=this;return new rxjs.Observable(function(observer){_this._map.then(function(m){m.addListener(eventName,function(arg){_this._zone.run(function(){return observer.next(arg)})})})})},GoogleMapsAPIWrapper.prototype.clearInstanceListeners=function(){var _this=this;return this._zone.runOutsideAngular(function(){_this._map.then(function(map){google.maps.event.clearInstanceListeners(map)})})},GoogleMapsAPIWrapper.prototype.setCenter=function(latLng){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.setCenter(latLng)})})},GoogleMapsAPIWrapper.prototype.getZoom=function(){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.getZoom()})})},GoogleMapsAPIWrapper.prototype.getBounds=function(){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.getBounds()})})},GoogleMapsAPIWrapper.prototype.getMapTypeId=function(){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.getMapTypeId()})})},GoogleMapsAPIWrapper.prototype.setZoom=function(zoom){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.setZoom(zoom)})})},GoogleMapsAPIWrapper.prototype.getCenter=function(){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.getCenter()})})},GoogleMapsAPIWrapper.prototype.panTo=function(latLng){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.panTo(latLng)})})},GoogleMapsAPIWrapper.prototype.panBy=function(x,y){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.panBy(x,y)})})},GoogleMapsAPIWrapper.prototype.fitBounds=function(latLng,padding){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.fitBounds(latLng,padding)})})},GoogleMapsAPIWrapper.prototype.panToBounds=function(latLng,padding){var _this=this;return this._zone.runOutsideAngular(function(){return _this._map.then(function(map){return map.panToBounds(latLng,padding)})})},GoogleMapsAPIWrapper.prototype.getNativeMap=function(){return this._map},GoogleMapsAPIWrapper.prototype.triggerMapEvent=function(eventName){return this._map.then(function(m){return google.maps.event.trigger(m,eventName)})},GoogleMapsAPIWrapper.ctorParameters=function(){return[{type:MapsAPILoader},{type:core.NgZone}]},GoogleMapsAPIWrapper=__decorate([core.Injectable(),__metadata("design:paramtypes",[MapsAPILoader,core.NgZone])],GoogleMapsAPIWrapper)}(),LayerManager=function(){function LayerManager(_wrapper){this._wrapper=_wrapper,this._layers=new Map}return LayerManager.prototype.addTransitLayer=function(layer,options){var newLayer=this._wrapper.createTransitLayer(options);this._layers.set(layer,newLayer)},LayerManager.prototype.addBicyclingLayer=function(layer,options){var newLayer=this._wrapper.createBicyclingLayer(options);this._layers.set(layer,newLayer)},LayerManager.prototype.deleteLayer=function(layer){var _this=this;return this._layers.get(layer).then(function(currentLayer){currentLayer.setMap(null),_this._layers.delete(layer)})},LayerManager.prototype.toggleLayerVisibility=function(layer,options){var _this=this;return this._layers.get(layer).then(function(currentLayer){return options.visible?_this._wrapper.getNativeMap().then(function(map){currentLayer.setMap(map)}):void currentLayer.setMap(null)})},LayerManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper}]},LayerManager=__decorate([core.Injectable(),__metadata("design:paramtypes",[GoogleMapsAPIWrapper])],LayerManager)}(),layerId=0,AgmBicyclingLayer=function(){function AgmBicyclingLayer(_manager){this._manager=_manager,this._addedToManager=!1,this._id=(layerId++).toString(),this.visible=!0}return AgmBicyclingLayer.prototype.ngOnInit=function(){this._addedToManager||(this._manager.addBicyclingLayer(this,{visible:this.visible}),this._addedToManager=!0)},AgmBicyclingLayer.prototype.ngOnChanges=function(changes){this._addedToManager&&null!=changes.visible&&this._manager.toggleLayerVisibility(this,{visible:changes.visible.currentValue})},AgmBicyclingLayer.prototype.id=function(){return this._id},AgmBicyclingLayer.prototype.toString=function(){return"AgmBicyclingLayer-"+this._id.toString()},AgmBicyclingLayer.prototype.ngOnDestroy=function(){this._manager.deleteLayer(this)},AgmBicyclingLayer.ctorParameters=function(){return[{type:LayerManager}]},__decorate([core.Input(),__metadata("design:type",Object)],AgmBicyclingLayer.prototype,"visible",void 0),AgmBicyclingLayer=__decorate([core.Directive({selector:"agm-bicycling-layer"}),__metadata("design:paramtypes",[LayerManager])],AgmBicyclingLayer)}(),CircleManager=function(){function CircleManager(_apiWrapper,_zone){this._apiWrapper=_apiWrapper,this._zone=_zone,this._circles=new Map}return CircleManager.prototype.addCircle=function(circle){this._circles.set(circle,this._apiWrapper.createCircle({center:{lat:circle.latitude,lng:circle.longitude},clickable:circle.clickable,draggable:circle.draggable,editable:circle.editable,fillColor:circle.fillColor,fillOpacity:circle.fillOpacity,radius:circle.radius,strokeColor:circle.strokeColor,strokeOpacity:circle.strokeOpacity,strokePosition:circle.strokePosition,strokeWeight:circle.strokeWeight,visible:circle.visible,zIndex:circle.zIndex}))},CircleManager.prototype.removeCircle=function(circle){var _this=this;return this._circles.get(circle).then(function(c){c.setMap(null),_this._circles.delete(circle)})},CircleManager.prototype.setOptions=function(circle,options){return this._circles.get(circle).then(function(c){"string"==typeof options.strokePosition&&(options.strokePosition=google.maps.StrokePosition[options.strokePosition]),c.setOptions(options)})},CircleManager.prototype.getBounds=function(circle){return this._circles.get(circle).then(function(c){return c.getBounds()})},CircleManager.prototype.getCenter=function(circle){return this._circles.get(circle).then(function(c){return c.getCenter()})},CircleManager.prototype.getRadius=function(circle){return this._circles.get(circle).then(function(c){return c.getRadius()})},CircleManager.prototype.setCenter=function(circle){return this._circles.get(circle).then(function(c){return c.setCenter({lat:circle.latitude,lng:circle.longitude})})},CircleManager.prototype.setEditable=function(circle){return this._circles.get(circle).then(function(c){return c.setEditable(circle.editable)})},CircleManager.prototype.setDraggable=function(circle){return this._circles.get(circle).then(function(c){return c.setDraggable(circle.draggable)})},CircleManager.prototype.setVisible=function(circle){return this._circles.get(circle).then(function(c){return c.setVisible(circle.visible)})},CircleManager.prototype.setRadius=function(circle){return this._circles.get(circle).then(function(c){return c.setRadius(circle.radius)})},CircleManager.prototype.getNativeCircle=function(circle){return this._circles.get(circle)},CircleManager.prototype.createEventObservable=function(eventName,circle){var _this=this;return new rxjs.Observable(function(observer){var listener=null;return _this._circles.get(circle).then(function(c){listener=c.addListener(eventName,function(e){return _this._zone.run(function(){return observer.next(e)})})}),function(){null!==listener&&listener.remove()}})},CircleManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper},{type:core.NgZone}]},CircleManager=__decorate([core.Injectable(),__metadata("design:paramtypes",[GoogleMapsAPIWrapper,core.NgZone])],CircleManager)}(),AgmCircle=function(){function AgmCircle(_manager){this._manager=_manager,this.clickable=!0,this.draggable=!1,this.editable=!1,this.radius=0,this.strokePosition="CENTER",this.strokeWeight=0,this.visible=!0,this.centerChange=new core.EventEmitter,this.circleClick=new core.EventEmitter,this.circleDblClick=new core.EventEmitter,this.drag=new core.EventEmitter,this.dragEnd=new core.EventEmitter,this.dragStart=new core.EventEmitter,this.mouseDown=new core.EventEmitter,this.mouseMove=new core.EventEmitter,this.mouseOut=new core.EventEmitter,this.mouseOver=new core.EventEmitter,this.mouseUp=new core.EventEmitter,this.radiusChange=new core.EventEmitter,this.rightClick=new core.EventEmitter,this._circleAddedToManager=!1,this._eventSubscriptions=[]}var AgmCircle_1;return(AgmCircle_1=AgmCircle).prototype.ngOnInit=function(){this._manager.addCircle(this),this._circleAddedToManager=!0,this._registerEventListeners()},AgmCircle.prototype.ngOnChanges=function(changes){this._circleAddedToManager&&((changes.latitude||changes.longitude)&&this._manager.setCenter(this),changes.editable&&this._manager.setEditable(this),changes.draggable&&this._manager.setDraggable(this),changes.visible&&this._manager.setVisible(this),changes.radius&&this._manager.setRadius(this),this._updateCircleOptionsChanges(changes))},AgmCircle.prototype._updateCircleOptionsChanges=function(changes){var options={},optionKeys=Object.keys(changes).filter(function(k){return-1!==AgmCircle_1._mapOptions.indexOf(k)});optionKeys.forEach(function(k){options[k]=changes[k].currentValue}),0<optionKeys.length&&this._manager.setOptions(this,options)},AgmCircle.prototype._registerEventListeners=function(){var _this=this,events=new Map;events.set("center_changed",this.centerChange),events.set("click",this.circleClick),events.set("dblclick",this.circleDblClick),events.set("drag",this.drag),events.set("dragend",this.dragEnd),events.set("dragstart",this.dragStart),events.set("mousedown",this.mouseDown),events.set("mousemove",this.mouseMove),events.set("mouseout",this.mouseOut),events.set("mouseover",this.mouseOver),events.set("mouseup",this.mouseUp),events.set("radius_changed",this.radiusChange),events.set("rightclick",this.rightClick),events.forEach(function(eventEmitter,eventName){_this._eventSubscriptions.push(_this._manager.createEventObservable(eventName,_this).subscribe(function(value){switch(eventName){case"radius_changed":_this._manager.getRadius(_this).then(function(radius){return eventEmitter.emit(radius)});break;case"center_changed":_this._manager.getCenter(_this).then(function(center){return eventEmitter.emit({lat:center.lat(),lng:center.lng()})});break;default:eventEmitter.emit({coords:{lat:value.latLng.lat(),lng:value.latLng.lng()}})}}))})},AgmCircle.prototype.ngOnDestroy=function(){this._eventSubscriptions.forEach(function(s){s.unsubscribe()}),this._eventSubscriptions=null,this._manager.removeCircle(this)},AgmCircle.prototype.getBounds=function(){return this._manager.getBounds(this)},AgmCircle.prototype.getCenter=function(){return this._manager.getCenter(this)},AgmCircle._mapOptions=["fillColor","fillOpacity","strokeColor","strokeOpacity","strokePosition","strokeWeight","visible","zIndex","clickable"],AgmCircle.ctorParameters=function(){return[{type:CircleManager}]},__decorate([core.Input(),__metadata("design:type",Number)],AgmCircle.prototype,"latitude",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmCircle.prototype,"longitude",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmCircle.prototype,"clickable",void 0),__decorate([core.Input("circleDraggable"),__metadata("design:type",Object)],AgmCircle.prototype,"draggable",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmCircle.prototype,"editable",void 0),__decorate([core.Input(),__metadata("design:type",String)],AgmCircle.prototype,"fillColor",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmCircle.prototype,"fillOpacity",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmCircle.prototype,"radius",void 0),__decorate([core.Input(),__metadata("design:type",String)],AgmCircle.prototype,"strokeColor",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmCircle.prototype,"strokeOpacity",void 0),__decorate([core.Input(),__metadata("design:type",String)],AgmCircle.prototype,"strokePosition",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmCircle.prototype,"strokeWeight",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmCircle.prototype,"visible",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmCircle.prototype,"zIndex",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"centerChange",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"circleClick",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"circleDblClick",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"drag",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"dragEnd",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"dragStart",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"mouseDown",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"mouseMove",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"mouseOut",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"mouseOver",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"mouseUp",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"radiusChange",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmCircle.prototype,"rightClick",void 0),AgmCircle=AgmCircle_1=__decorate([core.Directive({selector:"agm-circle"}),__metadata("design:paramtypes",[CircleManager])],AgmCircle)}(),DataLayerManager=function(){function DataLayerManager(_wrapper,_zone){this._wrapper=_wrapper,this._zone=_zone,this._layers=new Map}return DataLayerManager.prototype.addDataLayer=function(layer){var _this=this,newLayer=this._wrapper.createDataLayer({style:layer.style}).then(function(d){return layer.geoJson&&_this.getDataFeatures(d,layer.geoJson).then(function(features){return d.features=features}),d});this._layers.set(layer,newLayer)},DataLayerManager.prototype.deleteDataLayer=function(layer){var _this=this;this._layers.get(layer).then(function(l){l.setMap(null),_this._layers.delete(layer)})},DataLayerManager.prototype.updateGeoJson=function(layer,geoJson){var _this=this;this._layers.get(layer).then(function(l){l.forEach(function(feature){l.remove(feature);var index=l.features.indexOf(feature,0);-1<index&&l.features.splice(index,1)}),_this.getDataFeatures(l,geoJson).then(function(features){return l.features=features})})},DataLayerManager.prototype.setDataOptions=function(layer,options){this._layers.get(layer).then(function(l){l.setControlPosition(options.controlPosition),l.setControls(options.controls),l.setDrawingMode(options.drawingMode),l.setStyle(options.style)})},DataLayerManager.prototype.createEventObservable=function(eventName,layer){var _this=this;return new rxjs.Observable(function(observer){_this._layers.get(layer).then(function(d){d.addListener(eventName,function(e){return _this._zone.run(function(){return observer.next(e)})})})})},DataLayerManager.prototype.getDataFeatures=function(d,geoJson){return new Promise(function(resolve,reject){if("object"==typeof geoJson)try{resolve(d.addGeoJson(geoJson))}catch(e){reject(e)}else"string"==typeof geoJson?d.loadGeoJson(geoJson,null,resolve):reject("Impossible to extract features from geoJson: wrong argument type")})},DataLayerManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper},{type:core.NgZone}]},DataLayerManager=__decorate([core.Injectable(),__metadata("design:paramtypes",[GoogleMapsAPIWrapper,core.NgZone])],DataLayerManager)}(),layerId$1=0,AgmDataLayer=function(){function AgmDataLayer(_manager){this._manager=_manager,this._addedToManager=!1,this._id=(layerId$1++).toString(),this._subscriptions=[],this.layerClick=new core.EventEmitter,this.geoJson=null}var AgmDataLayer_1;return(AgmDataLayer_1=AgmDataLayer).prototype.ngOnInit=function(){this._addedToManager||(this._manager.addDataLayer(this),this._addedToManager=!0,this._addEventListeners())},AgmDataLayer.prototype._addEventListeners=function(){var _this=this;[{name:"click",handler:function(ev){return _this.layerClick.emit(ev)}}].forEach(function(obj){var os=_this._manager.createEventObservable(obj.name,_this).subscribe(obj.handler);_this._subscriptions.push(os)})},AgmDataLayer.prototype.id=function(){return this._id},AgmDataLayer.prototype.toString=function(){return"AgmDataLayer-"+this._id.toString()},AgmDataLayer.prototype.ngOnDestroy=function(){this._manager.deleteDataLayer(this),this._subscriptions.forEach(function(s){return s.unsubscribe()})},AgmDataLayer.prototype.ngOnChanges=function(changes){var _this=this;if(this._addedToManager){var geoJsonChange=changes.geoJson;geoJsonChange&&this._manager.updateGeoJson(this,geoJsonChange.currentValue);var dataOptions={};AgmDataLayer_1._dataOptionsAttributes.forEach(function(k){return dataOptions[k]=changes.hasOwnProperty(k)?changes[k].currentValue:_this[k]}),this._manager.setDataOptions(this,dataOptions)}},AgmDataLayer._dataOptionsAttributes=["style"],AgmDataLayer.ctorParameters=function(){return[{type:DataLayerManager}]},__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmDataLayer.prototype,"layerClick",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmDataLayer.prototype,"geoJson",void 0),__decorate([core.Input(),__metadata("design:type",Function)],AgmDataLayer.prototype,"style",void 0),AgmDataLayer=AgmDataLayer_1=__decorate([core.Directive({selector:"agm-data-layer"}),__metadata("design:paramtypes",[DataLayerManager])],AgmDataLayer)}(),FitBoundsService=function(){function FitBoundsService(loader){var _this=this;this._boundsChangeSampleTime$=new rxjs.BehaviorSubject(200),this._includeInBounds$=new rxjs.BehaviorSubject(new Map),this.bounds$=rxjs.from(loader.load()).pipe(operators.flatMap(function(){return _this._includeInBounds$}),operators.sample(this._boundsChangeSampleTime$.pipe(operators.switchMap(function(time){return rxjs.timer(0,time)}))),operators.map(function(includeInBounds){return _this._generateBounds(includeInBounds)}),operators.shareReplay(1))}return FitBoundsService.prototype._generateBounds=function(includeInBounds){var bounds=new google.maps.LatLngBounds;return includeInBounds.forEach(function(b){return bounds.extend(b)}),bounds},FitBoundsService.prototype.addToBounds=function(latLng){var id=this._createIdentifier(latLng);if(!this._includeInBounds$.value.has(id)){var map=this._includeInBounds$.value;map.set(id,latLng),this._includeInBounds$.next(map)}},FitBoundsService.prototype.removeFromBounds=function(latLng){var map=this._includeInBounds$.value;map.delete(this._createIdentifier(latLng)),this._includeInBounds$.next(map)},FitBoundsService.prototype.changeFitBoundsChangeSampleTime=function(timeMs){this._boundsChangeSampleTime$.next(timeMs)},FitBoundsService.prototype.getBounds$=function(){return this.bounds$},FitBoundsService.prototype._createIdentifier=function(latLng){return latLng.lat+"+"+latLng.lng},FitBoundsService.ctorParameters=function(){return[{type:MapsAPILoader}]},FitBoundsService=__decorate([core.Injectable(),__metadata("design:paramtypes",[MapsAPILoader])],FitBoundsService)}(),AgmFitBounds=function(){function AgmFitBounds(_fitBoundsAccessor,_fitBoundsService){this._fitBoundsAccessor=_fitBoundsAccessor,this._fitBoundsService=_fitBoundsService,this.agmFitBounds=!0,this._destroyed$=new rxjs.Subject,this._latestFitBoundsDetails=null}return AgmFitBounds.prototype.ngOnChanges=function(){this._updateBounds()},AgmFitBounds.prototype.ngOnInit=function(){var _this=this;this._fitBoundsAccessor.getFitBoundsDetails$().pipe(operators.distinctUntilChanged(function(x,y){return x.latLng.lat===y.latLng.lat&&x.latLng.lng===y.latLng.lng}),operators.takeUntil(this._destroyed$)).subscribe(function(details){return _this._updateBounds(details)})},AgmFitBounds.prototype._updateBounds=function(newFitBoundsDetails){this._latestFitBoundsDetails&&this._fitBoundsService.removeFromBounds(this._latestFitBoundsDetails.latLng),newFitBoundsDetails&&(this._latestFitBoundsDetails=newFitBoundsDetails),this._latestFitBoundsDetails&&!0===this.agmFitBounds&&this._fitBoundsService.addToBounds(this._latestFitBoundsDetails.latLng)},AgmFitBounds.prototype.ngOnDestroy=function(){this._destroyed$.next(),this._destroyed$.complete(),null!==this._latestFitBoundsDetails&&this._fitBoundsService.removeFromBounds(this._latestFitBoundsDetails.latLng)},AgmFitBounds.ctorParameters=function(){return[{type:FitBoundsAccessor,decorators:[{type:core.Self}]},{type:FitBoundsService}]},__decorate([core.Input(),__metadata("design:type",Object)],AgmFitBounds.prototype,"agmFitBounds",void 0),AgmFitBounds=__decorate([core.Directive({selector:"[agmFitBounds]"}),__param(0,core.Self()),__metadata("design:paramtypes",[FitBoundsAccessor,FitBoundsService])],AgmFitBounds)}(),MarkerManager=function(){function MarkerManager(_mapsWrapper,_zone){this._mapsWrapper=_mapsWrapper,this._zone=_zone,this._markers=new Map}return MarkerManager.prototype.convertAnimation=function(uiAnim){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return null===uiAnim?[2,null]:[2,this._mapsWrapper.getNativeMap().then(function(){return google.maps.Animation[uiAnim]})]})})},MarkerManager.prototype.deleteMarker=function(marker){var _this=this,m=this._markers.get(marker);return null==m?Promise.resolve():m.then(function(m){return _this._zone.run(function(){m.setMap(null),_this._markers.delete(marker)})})},MarkerManager.prototype.updateMarkerPosition=function(marker){return this._markers.get(marker).then(function(m){return m.setPosition({lat:marker.latitude,lng:marker.longitude})})},MarkerManager.prototype.updateTitle=function(marker){return this._markers.get(marker).then(function(m){return m.setTitle(marker.title)})},MarkerManager.prototype.updateLabel=function(marker){return this._markers.get(marker).then(function(m){m.setLabel(marker.label)})},MarkerManager.prototype.updateDraggable=function(marker){return this._markers.get(marker).then(function(m){return m.setDraggable(marker.draggable)})},MarkerManager.prototype.updateIcon=function(marker){return this._markers.get(marker).then(function(m){return m.setIcon(marker.iconUrl)})},MarkerManager.prototype.updateOpacity=function(marker){return this._markers.get(marker).then(function(m){return m.setOpacity(marker.opacity)})},MarkerManager.prototype.updateVisible=function(marker){return this._markers.get(marker).then(function(m){return m.setVisible(marker.visible)})},MarkerManager.prototype.updateZIndex=function(marker){return this._markers.get(marker).then(function(m){return m.setZIndex(marker.zIndex)})},MarkerManager.prototype.updateClickable=function(marker){return this._markers.get(marker).then(function(m){return m.setClickable(marker.clickable)})},MarkerManager.prototype.updateAnimation=function(marker){return __awaiter(this,void 0,void 0,function(){var m,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return[4,this._markers.get(marker)];case 1:return m=_c.sent(),_b=(_a=m).setAnimation,[4,this.convertAnimation(marker.animation)];case 2:return _b.apply(_a,[_c.sent()]),[2]}})})},MarkerManager.prototype.addMarker=function(marker){var _this=this,markerPromise=new Promise(function(resolve){return __awaiter(_this,void 0,void 0,function(){var _a,_b,_c;return __generator(this,function(_d){switch(_d.label){case 0:return _b=(_a=this._mapsWrapper).createMarker,_c={position:{lat:marker.latitude,lng:marker.longitude},label:marker.label,draggable:marker.draggable,icon:marker.iconUrl,opacity:marker.opacity,visible:marker.visible,zIndex:marker.zIndex,title:marker.title,clickable:marker.clickable},[4,this.convertAnimation(marker.animation)];case 1:return[2,_b.apply(_a,[(_c.animation=_d.sent(),_c)]).then(resolve)]}})})});this._markers.set(marker,markerPromise)},MarkerManager.prototype.getNativeMarker=function(marker){return this._markers.get(marker)},MarkerManager.prototype.createEventObservable=function(eventName,marker){var _this=this;return new rxjs.Observable(function(observer){_this._markers.get(marker).then(function(m){m.addListener(eventName,function(e){return _this._zone.run(function(){return observer.next(e)})})})})},MarkerManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper},{type:core.NgZone}]},MarkerManager=__decorate([core.Injectable(),__metadata("design:paramtypes",[GoogleMapsAPIWrapper,core.NgZone])],MarkerManager)}(),InfoWindowManager=function(){function InfoWindowManager(_mapsWrapper,_zone,_markerManager){this._mapsWrapper=_mapsWrapper,this._zone=_zone,this._markerManager=_markerManager,this._infoWindows=new Map}return InfoWindowManager.prototype.deleteInfoWindow=function(infoWindow){var _this=this,iWindow=this._infoWindows.get(infoWindow);return null==iWindow?Promise.resolve():iWindow.then(function(i){return _this._zone.run(function(){i.close(),_this._infoWindows.delete(infoWindow)})})},InfoWindowManager.prototype.setPosition=function(infoWindow){return this._infoWindows.get(infoWindow).then(function(i){return i.setPosition({lat:infoWindow.latitude,lng:infoWindow.longitude})})},InfoWindowManager.prototype.setZIndex=function(infoWindow){return this._infoWindows.get(infoWindow).then(function(i){return i.setZIndex(infoWindow.zIndex)})},InfoWindowManager.prototype.open=function(infoWindow){var _this=this;return this._infoWindows.get(infoWindow).then(function(w){return null!=infoWindow.hostMarker?_this._markerManager.getNativeMarker(infoWindow.hostMarker).then(function(marker){return _this._mapsWrapper.getNativeMap().then(function(map){return w.open(map,marker)})}):_this._mapsWrapper.getNativeMap().then(function(map){return w.open(map)})})},InfoWindowManager.prototype.close=function(infoWindow){return this._infoWindows.get(infoWindow).then(function(w){return w.close()})},InfoWindowManager.prototype.setOptions=function(infoWindow,options){return this._infoWindows.get(infoWindow).then(function(i){return i.setOptions(options)})},InfoWindowManager.prototype.addInfoWindow=function(infoWindow){var options={content:infoWindow.content,maxWidth:infoWindow.maxWidth,zIndex:infoWindow.zIndex,disableAutoPan:infoWindow.disableAutoPan};"number"==typeof infoWindow.latitude&&"number"==typeof infoWindow.longitude&&(options.position={lat:infoWindow.latitude,lng:infoWindow.longitude});var infoWindowPromise=this._mapsWrapper.createInfoWindow(options);this._infoWindows.set(infoWindow,infoWindowPromise)},InfoWindowManager.prototype.createEventObservable=function(eventName,infoWindow){var _this=this;return new rxjs.Observable(function(observer){_this._infoWindows.get(infoWindow).then(function(i){i.addListener(eventName,function(e){return _this._zone.run(function(){return observer.next(e)})})})})},InfoWindowManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper},{type:core.NgZone},{type:MarkerManager}]},InfoWindowManager=__decorate([core.Injectable(),__metadata("design:paramtypes",[GoogleMapsAPIWrapper,core.NgZone,MarkerManager])],InfoWindowManager)}(),infoWindowId=0,AgmInfoWindow=function(){function AgmInfoWindow(_infoWindowManager,_el){this._infoWindowManager=_infoWindowManager,this._el=_el,this.isOpen=!1,this.infoWindowClose=new core.EventEmitter,this._infoWindowAddedToManager=!1,this._id=(infoWindowId++).toString()}var AgmInfoWindow_1;return(AgmInfoWindow_1=AgmInfoWindow).prototype.ngOnInit=function(){this.content=this._el.nativeElement.querySelector(".agm-info-window-content"),this._infoWindowManager.addInfoWindow(this),this._infoWindowAddedToManager=!0,this._updateOpenState(),this._registerEventListeners()},AgmInfoWindow.prototype.ngOnChanges=function(changes){this._infoWindowAddedToManager&&((changes.latitude||changes.longitude)&&"number"==typeof this.latitude&&"number"==typeof this.longitude&&this._infoWindowManager.setPosition(this),changes.zIndex&&this._infoWindowManager.setZIndex(this),changes.isOpen&&this._updateOpenState(),this._setInfoWindowOptions(changes))},AgmInfoWindow.prototype._registerEventListeners=function(){var _this=this;this._infoWindowManager.createEventObservable("closeclick",this).subscribe(function(){_this.isOpen=!1,_this.infoWindowClose.emit()})},AgmInfoWindow.prototype._updateOpenState=function(){this.isOpen?this.open():this.close()},AgmInfoWindow.prototype._setInfoWindowOptions=function(changes){var options={};Object.keys(changes).filter(function(k){return-1!==AgmInfoWindow_1._infoWindowOptionsInputs.indexOf(k)}).forEach(function(k){options[k]=changes[k].currentValue}),this._infoWindowManager.setOptions(this,options)},AgmInfoWindow.prototype.open=function(){return this._infoWindowManager.open(this)},AgmInfoWindow.prototype.close=function(){var _this=this;return this._infoWindowManager.close(this).then(function(){_this.infoWindowClose.emit()})},AgmInfoWindow.prototype.id=function(){return this._id},AgmInfoWindow.prototype.toString=function(){return"AgmInfoWindow-"+this._id.toString()},AgmInfoWindow.prototype.ngOnDestroy=function(){this._infoWindowManager.deleteInfoWindow(this)},AgmInfoWindow._infoWindowOptionsInputs=["disableAutoPan","maxWidth"],AgmInfoWindow.ctorParameters=function(){return[{type:InfoWindowManager},{type:core.ElementRef}]},__decorate([core.Input(),__metadata("design:type",Number)],AgmInfoWindow.prototype,"latitude",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmInfoWindow.prototype,"longitude",void 0),__decorate([core.Input(),__metadata("design:type",Boolean)],AgmInfoWindow.prototype,"disableAutoPan",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmInfoWindow.prototype,"zIndex",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmInfoWindow.prototype,"maxWidth",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmInfoWindow.prototype,"isOpen",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmInfoWindow.prototype,"infoWindowClose",void 0),AgmInfoWindow=AgmInfoWindow_1=__decorate([core.Component({selector:"agm-info-window",template:"<div class='agm-info-window-content'>\n <ng-content></ng-content>\n </div>\n "}),__metadata("design:paramtypes",[InfoWindowManager,core.ElementRef])],AgmInfoWindow)}(),KmlLayerManager=function(){function KmlLayerManager(_wrapper,_zone){this._wrapper=_wrapper,this._zone=_zone,this._layers=new Map}return KmlLayerManager.prototype.addKmlLayer=function(layer){var newLayer=this._wrapper.getNativeMap().then(function(m){return new google.maps.KmlLayer({clickable:layer.clickable,map:m,preserveViewport:layer.preserveViewport,screenOverlays:layer.screenOverlays,suppressInfoWindows:layer.suppressInfoWindows,url:layer.url,zIndex:layer.zIndex})});this._layers.set(layer,newLayer)},KmlLayerManager.prototype.setOptions=function(layer,options){this._layers.get(layer).then(function(l){return l.setOptions(options)})},KmlLayerManager.prototype.deleteKmlLayer=function(layer){var _this=this;this._layers.get(layer).then(function(l){l.setMap(null),_this._layers.delete(layer)})},KmlLayerManager.prototype.createEventObservable=function(eventName,layer){var _this=this;return new rxjs.Observable(function(observer){_this._layers.get(layer).then(function(m){m.addListener(eventName,function(e){return _this._zone.run(function(){return observer.next(e)})})})})},KmlLayerManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper},{type:core.NgZone}]},KmlLayerManager=__decorate([core.Injectable(),__metadata("design:paramtypes",[GoogleMapsAPIWrapper,core.NgZone])],KmlLayerManager)}(),layerId$2=0,AgmKmlLayer=function(){function AgmKmlLayer(_manager){this._manager=_manager,this._addedToManager=!1,this._id=(layerId$2++).toString(),this._subscriptions=[],this.clickable=!0,this.preserveViewport=!1,this.screenOverlays=!0,this.suppressInfoWindows=!1,this.url=null,this.zIndex=null,this.layerClick=new core.EventEmitter,this.defaultViewportChange=new core.EventEmitter,this.statusChange=new core.EventEmitter}var AgmKmlLayer_1;return(AgmKmlLayer_1=AgmKmlLayer).prototype.ngOnInit=function(){this._addedToManager||(this._manager.addKmlLayer(this),this._addedToManager=!0,this._addEventListeners())},AgmKmlLayer.prototype.ngOnChanges=function(changes){this._addedToManager&&this._updatePolygonOptions(changes)},AgmKmlLayer.prototype._updatePolygonOptions=function(changes){var options=Object.keys(changes).filter(function(k){return-1!==AgmKmlLayer_1._kmlLayerOptions.indexOf(k)}).reduce(function(obj,k){return obj[k]=changes[k].currentValue,obj},{});0<Object.keys(options).length&&this._manager.setOptions(this,options)},AgmKmlLayer.prototype._addEventListeners=function(){var _this=this;[{name:"click",handler:function(ev){return _this.layerClick.emit(ev)}},{name:"defaultviewport_changed",handler:function(){return _this.defaultViewportChange.emit()}},{name:"status_changed",handler:function(){return _this.statusChange.emit()}}].forEach(function(obj){var os=_this._manager.createEventObservable(obj.name,_this).subscribe(obj.handler);_this._subscriptions.push(os)})},AgmKmlLayer.prototype.id=function(){return this._id},AgmKmlLayer.prototype.toString=function(){return"AgmKmlLayer-"+this._id.toString()},AgmKmlLayer.prototype.ngOnDestroy=function(){this._manager.deleteKmlLayer(this),this._subscriptions.forEach(function(s){return s.unsubscribe()})},AgmKmlLayer._kmlLayerOptions=["clickable","preserveViewport","screenOverlays","suppressInfoWindows","url","zIndex"],AgmKmlLayer.ctorParameters=function(){return[{type:KmlLayerManager}]},__decorate([core.Input(),__metadata("design:type",Object)],AgmKmlLayer.prototype,"clickable",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmKmlLayer.prototype,"preserveViewport",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmKmlLayer.prototype,"screenOverlays",void 0),__decorate([core.Input(),__metadata("design:type",Object)],AgmKmlLayer.prototype,"suppressInfoWindows",void 0),__decorate([core.Input(),__metadata("design:type",String)],AgmKmlLayer.prototype,"url",void 0),__decorate([core.Input(),__metadata("design:type",Number)],AgmKmlLayer.prototype,"zIndex",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmKmlLayer.prototype,"layerClick",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmKmlLayer.prototype,"defaultViewportChange",void 0),__decorate([core.Output(),__metadata("design:type",core.EventEmitter)],AgmKmlLayer.prototype,"statusChange",void 0),AgmKmlLayer=AgmKmlLayer_1=__decorate([core.Directive({selector:"agm-kml-layer"}),__metadata("design:paramtypes",[KmlLayerManager])],AgmKmlLayer)}();function createMVCEventObservable(array){var eventNames=["insert_at","remove_at","set_at"];return rxjs.fromEventPattern(function(handler){return eventNames.map(function(evName){return array.addListener(evName,function(index,previous){return handler.apply(array,[{newArr:array.getArray(),evName:evName,index:index,previous:previous}])})})},function(_handler,evListeners){return evListeners.forEach(function(evListener){return evListener.remove()})})}var SymbolPath,ControlPosition,MapTypeId,MapTypeControlStyle,ScaleControlStyle,ZoomControlStyle,GeocoderLocationType,GeocoderStatus,PolygonManager=function(){function PolygonManager(_mapsWrapper,_zone){this._mapsWrapper=_mapsWrapper,this._zone=_zone,this._polygons=new Map}return PolygonManager.prototype.addPolygon=function(path){var polygonPromise=this._mapsWrapper.createPolygon({clickable:path.clickable,draggable:path.draggable,editable:path.editable,fillColor:path.fillColor,fillOpacity:path.fillOpacity,geodesic:path.geodesic,paths:path.paths,strokeColor:path.strokeColor,strokeOpacity:path.strokeOpacity,strokeWeight:path.strokeWeight,visible:path.visible,zIndex:path.zIndex});this._polygons.set(path,polygonPromise)},PolygonManager.prototype.updatePolygon=function(polygon){var _this=this,m=this._polygons.get(polygon);return null==m?Promise.resolve():m.then(function(l){return _this._zone.run(function(){l.setPaths(polygon.paths)})})},PolygonManager.prototype.setPolygonOptions=function(path,options){return this._polygons.get(path).then(function(l){l.setOptions(options)})},PolygonManager.prototype.deletePolygon=function(paths){var _this=this,m=this._polygons.get(paths);return null==m?Promise.resolve():m.then(function(l){return _this._zone.run(function(){l.setMap(null),_this._polygons.delete(paths)})})},PolygonManager.prototype.getPath=function(polygon){return this._polygons.get(polygon).then(function(polygon){return polygon.getPath().getArray()})},PolygonManager.prototype.getPaths=function(polygon){return this._polygons.get(polygon).then(function(polygon){return polygon.getPaths().getArray().map(function(p){return p.getArray()})})},PolygonManager.prototype.createEventObservable=function(eventName,path){var _this=this;return new rxjs.Observable(function(observer){_this._polygons.get(path).then(function(l){l.addListener(eventName,function(e){return _this._zone.run(function(){return observer.next(e)})})})})},PolygonManager.prototype.createPathEventObservable=function(agmPolygon){return __awaiter(this,void 0,void 0,function(){var polygon,paths;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this._polygons.get(agmPolygon)];case 1:return polygon=_a.sent(),paths=polygon.getPaths(),[2,createMVCEventObservable(paths).pipe(operators.startWith({newArr:paths.getArray()}),operators.switchMap(function(parentMVEvent){return rxjs.merge.apply(void 0,__spread(parentMVEvent.newArr.map(function(chMVC,index){return createMVCEventObservable(chMVC).pipe(operators.map(function(chMVCEvent){return{parentMVEvent:parentMVEvent,chMVCEvent:chMVCEvent,pathIndex:index}}))}))).pipe(operators.startWith({parentMVEvent:parentMVEvent,chMVCEvent:null,pathIndex:null}))}),operators.skip(1),operators.map(function(_a){var retVal,parentMVEvent=_a.parentMVEvent,chMVCEvent=_a.chMVCEvent,pathIndex=_a.pathIndex;return chMVCEvent?(retVal={newArr:parentMVEvent.newArr.map(function(subArr){return subArr.getArray().map(function(latLng){return latLng.toJSON()})}),pathIndex:pathIndex,eventName:chMVCEvent.evName,index:chMVCEvent.index},chMVCEvent.previous&&(retVal.previous=chMVCEvent.previous)):(retVal={newArr:parentMVEvent.newArr.map(function(subArr){return subArr.getArray().map(function(latLng){return latLng.toJSON()})}),eventName:parentMVEvent.evName,index:parentMVEvent.index},parentMVEvent.previous&&(retVal.previous=parentMVEvent.previous.getArray())),retVal}))]}})})},PolygonManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper},{type:core.NgZone}]},PolygonManager=__decorate([core.Injectable(),__metadata("design:paramtypes",[GoogleMapsAPIWrapper,core.NgZone])],PolygonManager)}(),PolylineManager=function(){function PolylineManager(_mapsWrapper,_zone){this._mapsWrapper=_mapsWrapper,this._zone=_zone,this._polylines=new Map}var PolylineManager_1;return(PolylineManager_1=PolylineManager)._convertPoints=function(line){return line._getPoints().map(function(point){return{lat:point.latitude,lng:point.longitude}})},PolylineManager._convertPath=function(path){var symbolPath=google.maps.SymbolPath[path];return"number"==typeof symbolPath?symbolPath:path},PolylineManager._convertIcons=function(line){var icons=line._getIcons().map(function(agmIcon){return{fixedRotation:agmIcon.fixedRotation,offset:agmIcon.offset,repeat:agmIcon.repeat,icon:{anchor:new google.maps.Point(agmIcon.anchorX,agmIcon.anchorY),fillColor:agmIcon.fillColor,fillOpacity:agmIcon.fillOpacity,path:PolylineManager_1._convertPath(agmIcon.path),rotation:agmIcon.rotation,scale:agmIcon.scale,strokeColor:agmIcon.strokeColor,strokeOpacity:agmIcon.strokeOpacity,strokeWeight:agmIcon.strokeWeight}}});return icons.forEach(function(icon){Object.entries(icon).forEach(function(_a){var _b=__read(_a,2),key=_b[0];void 0===_b[1]&&delete icon[key]}),void 0!==icon.icon.anchor.x&&void 0!==icon.icon.anchor.y||delete icon.icon.anchor}),icons},PolylineManager.prototype.addPolyline=function(line){var _this=this,polylinePromise=this._mapsWrapper.getNativeMap().then(function(){return[PolylineManager_1._convertPoints(line),PolylineManager_1._convertIcons(line)]}).then(function(_a){var _b=__read(_a,2),path=_b[0],icons=_b[1];return _this._mapsWrapper.createPolyline({clickable:line.clickable,draggable:line.draggable,editable:line.editable,geodesic:line.geodesic,strokeColor:line.strokeColor,strokeOpacity:line.strokeOpacity,strokeWeight:line.strokeWeight,visible:line.visible,zIndex:line.zIndex,path:path,icons:icons})});this._polylines.set(line,polylinePromise)},PolylineManager.prototype.updatePolylinePoints=function(line){var _this=this,path=PolylineManager_1._convertPoints(line),m=this._polylines.get(line);return null==m?Promise.resolve():m.then(function(l){return _this._zone.run(function(){l.setPath(path)})})},PolylineManager.prototype.updateIconSequences=function(line){return __awaiter(this,void 0,void 0,function(){var icons,m,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this._mapsWrapper.getNativeMap()];case 1:return _a.sent(),icons=PolylineManager_1._convertIcons(line),null==(m=this._polylines.get(line))?[2]:[2,m.then(function(l){return _this._zone.run(function(){return l.setOptions({icons:icons})})})]}})})},PolylineManager.prototype.setPolylineOptions=function(line,options){return this._polylines.get(line).then(function(l){l.setOptions(options)})},PolylineManager.prototype.deletePolyline=function(line){var _this=this,m=this._polylines.get(line);return null==m?Promise.resolve():m.then(function(l){return _this._zone.run(function(){l.setMap(null),_this._polylines.delete(line)})})},PolylineManager.prototype.getMVCPath=function(agmPolyline){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this._polylines.get(agmPolyline)];case 1:return[2,_a.sent().getPath()]}})})},PolylineManager.prototype.getPath=function(agmPolyline){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getMVCPath(agmPolyline)];case 1:return[2,_a.sent().getArray()]}})})},PolylineManager.prototype.createEventObservable=function(eventName,line){var _this=this;return new rxjs.Observable(function(observer){_this._polylines.get(line).then(function(l){l.addListener(eventName,function(e){return _this._zone.run(function(){return observer.next(e)})})})})},PolylineManager.prototype.createPathEventObservable=function(line){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getMVCPath(line)];case 1:return[2,createMVCEventObservable(_a.sent())]}})})},PolylineManager.ctorParameters=function(){return[{type:GoogleMapsAPIWrapper},{type:core.NgZone}]},PolylineManager=PolylineManager