/*!
*  angular-mapboxgl-directive 0.46.0 2018-04-22
*  An AngularJS directive for Mapbox GL
*  git: git+https://github.com/Naimikan/angular-mapboxgl-directive.git
*/

!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){!function(a,b){"use strict";a.module("mapboxgl-directive",[]).directive("mapboxgl",["$q","Utils","mapboxglConstants","mapboxglEventsUtils","mapboxglMapsData","AnimationsManager","PopupsManager",function(c,d,e,f,g,h,i){function j(b){var d=c.defer();a.extend(this,{_mapboxGlMap:d,_elementDOM:null,_animationManager:new h(d),_popupManager:new i(d),_isPersistent:!1,getMap:function(){return this._mapboxGlMap.promise},getMapboxGlScope:function(){return b},getDOMElement:function(){return this._elementDOM},getAnimationManager:function(){return this._animationManager},getPopupManager:function(){return this._popupManager},setDOMElement:function(a){this._elementDOM=a},setIsPersistent:function(a){this._isPersistent=a},isPersistent:function(){return this._isPersistent},changeLoadingMap:function(b){for(var c=b?"addClass":"removeClass",d=this._elementDOM.find("div"),e=0;e<d.length;e++){var f=a.element(d[e]);f.hasClass("angular-mapboxgl-map-loader")&&f[c]("angular-mapboxgl-map-loading")}}})}function k(c,h,i,j){if(!b)throw new Error("Mapbox GL doesn`t included");if(!b.accessToken){if(!(a.isDefined(i.accessToken)&&i.accessToken.length>0))throw new Error("Mapbox access token doesn`t defined");b.accessToken=i.accessToken}if(!b.supported())throw new Error("Your browser doesn`t support Mapbox GL");if(a.isDefined(i.rtlEnabled)&&d.stringToBoolean(i.rtlEnabled)){if(!b.setRTLTextPlugin)throw new Error('Your version of Mapbox GL doesn`t support "setRTLTextPlugin" function.');b.setRTLTextPlugin(e.plugins.rtlPluginUrl)}a.isDefined(i.persistent)&&d.stringToBoolean(i.persistent)&&j.setIsPersistent(d.stringToBoolean(i.persistent)),j.setDOMElement(h),j.changeLoadingMap(!0),c.mapboxglMapId=i.id?i.id:d.generateMapId(),h.attr("id",c.mapboxglMapId);var k=function(b){isNaN(i.width)?h.css("width",i.width):h.css("width",i.width+"px"),a.isDefined(b)&&null!==b&&b.resize()},l=function(b){var c=i.height;(a.isUndefined(c)||null===c)&&(c=e.map.defaultHeight),isNaN(c)?h.css("height",c):h.css("height",c+"px"),a.isDefined(b)&&null!==b&&b.resize()};k(),l();var m=function(b){a.isDefined(i.language)&&b.setLayoutProperty("country-label-lg","text-field","{name_"+i.language+"}")},n={container:c.mapboxglMapId,style:c.glStyle||e.map.defaultStyle,center:e.map.defaultCenter,zoom:a.isDefined(c.glZoom)&&null!==c.glZoom&&a.isDefined(c.glZoom.value)&&null!==c.glZoom.value?c.glZoom.value:e.map.defaultZoom,hash:a.isDefined(i.hash)?d.stringToBoolean(i.hash):e.map.defaultHash,bearingSnap:a.isDefined(i.bearingSnap)?d.stringToNumber(i.bearingSnap):e.map.defaultBearingSnap,pitchWithRotate:a.isDefined(i.pitchWithRotate)?d.stringToBoolean(i.pitchWithRotate):e.map.defaultPitchWithRotate,logoPosition:a.isDefined(i.logoPosition)?i.logoPosition:e.map.defaultLogoPosition,failIfMajorPerformanceCaveat:a.isDefined(i.failIfMajorPerformanceCaveat)?d.stringToBoolean(i.failIfMajorPerformanceCaveat):e.map.defaultFailIfMajorPerformanceCaveat,preserveDrawingBuffer:a.isDefined(i.preserveDrawingBuffer)?d.stringToBoolean(i.preserveDrawingBuffer):e.map.defaultPreserveDrawingBuffer,refreshExpiredTiles:a.isDefined(i.refreshExpiredTiles)?d.stringToBoolean(i.refreshExpiredTiles):e.map.defaultRefreshExpiredTiles,trackResize:a.isDefined(i.trackResize)?d.stringToBoolean(i.trackResize):e.map.defaultTrackResize,renderWorldCopies:a.isDefined(i.renderWorldCopies)?d.stringToBoolean(i.renderWorldCopies):e.map.defaultRenderWorldCopies,maxTileCacheSize:a.isDefined(i.maxTileCacheSize)?d.stringToNumber(i.maxTileCacheSize):e.map.defaultMaxTileCacheSize,localIdeographFontFamily:a.isDefined(i.localIdeographFontFamily)?i.localIdeographFontFamily:e.map.defaultLocalIdeographFontFamily,collectResourceTiming:a.isDefined(i.collectResourceTiming)?d.stringToBoolean(i.collectResourceTiming):e.map.defaultCollectResourceTiming,attributionControl:!1};d.validateAndFormatCenter(c.glCenter).then(function(d){d&&(n.center=d);var o=new b.Map(n);g.addMap(c.mapboxglMapId,o),f.exposeMapEvents(o),j.getAnimationManager().initAnimationSystem(),o.on("load",function(b){var d=b.target;j._mapboxGlMap.resolve(d),j.changeLoadingMap(!1),c.$watch(function(){return i.language},function(){m(d)}),c.$watch(function(){return i.showCollisionBoxes},function(){"boolean"==typeof i.showCollisionBoxes&&(d.showCollisionBoxes=i.showCollisionBoxes)}),c.$watch(function(){return i.showTileBoundaries},function(){"boolean"==typeof i.showTileBoundaries&&(d.showTileBoundaries=i.showTileBoundaries)}),c.$watch(function(){return i.repaint},function(){"boolean"==typeof i.repaint&&(d.repaint=i.repaint)}),a.isDefined(i.width)&&(k(d),c.$watch(function(){return h[0].getAttribute("width")},function(){k(d)})),a.isDefined(i.height)?(l(d),c.$watch(function(){return h[0].getAttribute("height")},function(){l(d)})):(h.css("height",e.map.defaultHeight),d.resize())}),c.$on("mapboxglMap:styleChanged",function(){j.getMap().then(function(a){m(a)})}),c.$on("$destroy",function(){a.isDefined(j.getAnimationManager())&&j.getAnimationManager().destroy(),a.isDefined(j.getPopupManager())&&j.getPopupManager().removeAllPopupsCreated(),g.removeMapById(c.mapboxglMapId),o.remove()})}).catch(function(a){console.error(a)})}var l={restrict:"EA",replace:!0,scope:{glBearing:"=",glCenter:"=",glClasses:"=",glControls:"=",glFilter:"=",glHandlers:"=",glImage:"=",glInteractive:"=",glLayers:"=",glLights:"=",glMarkers:"=",glMaxBounds:"=",glMaxZoom:"=",glMinZoom:"=",glPitch:"=",glPopups:"=",glSources:"=",glStyle:"=",glVideo:"=",glZoom:"="},template:'<div class="angular-mapboxgl-map"><div class="angular-mapboxgl-map-loader"><div class="spinner"><div class="double-bounce"></div><div class="double-bounce delayed"></div></div></div></div>',controller:j,link:k};return j.$inject=["$scope"],l}]),a.module("mapboxgl-directive").directive("mapboxglCompare",["mapboxglMapsData",function(c){function d(d,e,f){if(!b)throw new Error("Mapbox GL does not included");if(!b.accessToken){if(!(a.isDefined(f.accessToken)&&f.accessToken.length>0))throw new Error("Mapbox access token does not defined");b.accessToken=f.accessToken}if(!b.Compare)throw new Error("mapboxgl.Compare plugin does not included");if(!b.supported())throw new Error("Your browser does not support Mapbox GL");if(a.isDefined(d.compareSettings)&&Object.prototype.toString.call(d.compareSettings)!==Object.prototype.toString.call({}))throw new Error("Invalid mapboxgl.Compare parameters");e.ready(function(){var f=e.children();if(2!==f.length)throw new Error("Only two maps can be compared");var g=a.element(f[0]);g.addClass("compare-map"),a.element(f[1]).addClass("compare-map"),d.mapIds=[f[0].id,f[1].id];var h=c.getMapById(f[0].id),i=c.getMapById(f[1].id);new b.Compare(h,i,d.compareSettings);e.css("height",g.css("height")),d.$watch(function(){return g[0].getAttribute("height")},function(){e.css("height",g.css("height"))}),d.$on("$destroy",function(){d.mapIds.map(function(a){c.getMapById(a).remove(),c.removeMapById(a)})})})}return{restrict:"EA",replace:!0,scope:{compareSettings:"="},transclude:!0,template:'<div class="angular-mapboxgl-compare" ng-transclude></div>',link:d}}]),a.module("mapboxgl-directive").factory("AnimationsManager",["$window","$q","Utils",function(b,c,d){function e(){this.animationFunctionStack=[],this.animationId=null}return e.prototype.executeFunctionStack=function(a){var b={};return this.animationFunctionStack.forEach(function(c){c.animationParameters.deltaTime=a,c.animationFunction(c.animationParameters),b[c.animationParameters.sourceId]||(b[c.animationParameters.sourceId]={map:c.animationParameters.map,features:[]}),b[c.animationParameters.sourceId].features.push(c.animationParameters.feature)}),b},e.prototype.updateSourcesData=function(b){for(var c in b)if(b.hasOwnProperty(c)){var d=b[c].map,e=d.getSource(c)._data;"FeatureCollection"===e.type?a.extend(e.features,b[c].features):"Feature"===e.type&&(e={type:"FeatureCollection",features:b[c].features}),d.getSource(c).setData(e)}},e.prototype.addAnimationFunction=function(b,c,d,e){a.isDefined(d)&&a.isFunction(d)&&this.animationFunctionStack.push({sourceId:b,featureId:c,animationFunction:d,animationParameters:e})},e.prototype.updateAnimationFunction=function(b,c,e){if(a.isDefined(c)&&a.isFunction(c)){var f=d.arrayObjectIndexOf(this.animationFunctionStack,b,"featureId");if(-1===f)throw new Error("Feature ID doesn't exist");a.extend(this.animationFunctionStack[f].animationParameters,{animationFunction:c,animationData:e})}},e.prototype.existAnimationByFeatureId=function(a){return-1!==d.arrayObjectIndexOf(this.animationFunctionStack,a,"featureId")},e.prototype.removeAnimationStack=function(){this.animationFunctionStack=[]},e.prototype.removeAnimationBySourceId=function(a){this.animationFunctionStack=this.animationFunctionStack.filter(function(b){return b.sourceId!==a})},e.prototype.removeAnimationByFeatureId=function(a){this.animationFunctionStack=this.animationFunctionStack.filter(function(b){return b.featureId!==a})},e.prototype.initAnimationSystem=function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(b,c){var d=(new Date).getTime(),e=Math.max(0,16-(d-a)),f=window.setTimeout(function(){b(d+e)},e);return a=d+e,f}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});var d=0,e=0,f=this,g=function(a){d+=a-e,e=a;var b=f.executeFunctionStack(d);f.updateSourcesData(b),f.animationId=window.requestAnimationFrame(g)};f.animationId=window.requestAnimationFrame(g)},e.prototype.stopAnimationLoop=function(){window.cancelAnimationFrame(this.animationId)},e.prototype.destroy=function(){this.stopAnimationLoop(),this.removeAnimationStack()},e}]),a.module("mapboxgl-directive").factory("LayersManager",["Utils","mapboxglConstants",function(b,c){function d(b,c){this.layersCreated=[],this.mapInstance=b,this.relationLayersPopups=[],this.relationLayersEvents=[],a.isDefined(c)&&null!==c&&(this.popupManager=c)}return d.prototype.recreateLayers=function(){var a=this;a.layersCreated.map(function(b){a.createLayerByObject(b.layerObject)})},d.prototype.removePopupRelationByLayerId=function(a){this.relationLayersPopups=this.relationLayersPopups.filter(function(b){return b.layerId!==a})},d.prototype.removeAllPopupRelations=function(){this.relationLayersPopups=[]},d.prototype.getPopupRelationByLayerId=function(a){var b=this.relationLayersPopups.filter(function(b){return b.layerId===a});return b.length>0&&b[0].popup},d.prototype.removeEventRelationByLayerId=function(a){this.relationLayersEvents=this.relationLayersEvents.filter(function(b){return b.layerId!==a})},d.prototype.removeAllEventRelations=function(){this.relationLayersEvents=[]},d.prototype.getEventRelationByLayerId=function(a){var b=this.relationLayersEvents.filter(function(b){return b.layerId===a});return b.length>0&&b[0].events},d.prototype.createLayerByObject=function(c){b.checkObjects([{name:"Map",object:this.mapInstance},{name:"Layer object",object:c,attributes:["id","type"]}]);var d={type:"mapboxgl:"+c.type,popup:!!(a.isDefined(c.popup)&&a.isDefined(c.popup.enabled)&&c.popup.enabled)&&c.popup.enabled},e={};for(var f in c)"before"!==f&&"popup"!==f&&"animation"!==f&&"events"!==f&&(e[f]=c[f]);e.metadata=a.isDefined(c.metadata)?c.metadata:{},a.extend(e.metadata,d);var g=a.isDefined(c.before)?c.before:void 0;this.mapInstance.addLayer(e,g),this.layersCreated.push({layerId:c.id,layerObject:c}),this.relationLayersPopups.push({layerId:c.id,popup:c.popup}),this.relationLayersEvents.push({layerId:c.id,events:c.events})},d.prototype.existLayerById=function(b){return a.isDefined(b)&&null!==b&&this.layersCreated.filter(function(a){return a.layerId===b}).length>0},d.prototype.removeLayerById=function(a){if(b.checkObjects([{name:"Map",object:this.mapInstance}]),!this.existLayerById(a))throw new Error("Invalid layer ID");this.mapInstance.getLayer(a)&&this.mapInstance.removeLayer(a),this.layersCreated=this.layersCreated.filter(function(b){return b.layerId!==a}),this.popupManager.removePopupByLayerId(a),this.removePopupRelationByLayerId(a),this.removeEventRelationByLayerId(a)},d.prototype.updateLayerByObject=function(c){b.checkObjects([{name:"Map",object:this.mapInstance},{name:"Layer object",object:c,attributes:["id"]}]),a.isDefined(c.before)&&null!==c.before&&this.mapInstance.moveLayer(c.id,c.before),a.isDefined(c.filter)&&null!==c.filter&&a.isArray(c.filter)&&this.mapInstance.setFilter(c.id,c.filter);var d=this.mapInstance.getLayer(c.id);if(this.mapInstance.setLayerZoomRange(c.id,c.minzoom||d.minzoom,c.maxzoom||d.maxzoom),a.isDefined(c.popup)&&null!==c.popup&&(this.popupManager.removePopupByLayerId(c.id),this.removePopupRelationByLayerId(c.id),this.relationLayersPopups.push({layerId:c.id,popup:c.popup})),a.isDefined(c.events)&&null!==c.events&&(this.removeEventRelationByLayerId(c.id),this.relationLayersEvents.push({layerId:c.id,events:c.events})),a.isDefined(c.paint)&&null!==c.paint)for(var e in c.paint)if(c.paint.hasOwnProperty(e)){var f=this.mapInstance.getPaintProperty(c.id,e);f!==c.paint[e]&&this.mapInstance.setPaintProperty(c.id,e,c.paint[e])}if(a.isDefined(c.layout)&&null!==c.layout)for(var g in c.layout)if(c.layout.hasOwnProperty(g)){var h=this.mapInstance.getLayoutProperty(c.id,g);h!==c.layout[g]&&this.mapInstance.setLayoutProperty(c.id,g,c.layout[g])}},d.prototype.getCreatedLayers=function(){return this.layersCreated},d.prototype.removeAllCreatedLayers=function(){var a=this;a.layersCreated.map(function(b){a.removeLayerById(b.layerId)})},d}]),a.module("mapboxgl-directive").factory("mapboxglEventsUtils",["$rootScope",function(a){function b(b){c.map(function(c){b.on(c,function(b){a.$applyAsync(a.$broadcast("mapboxglMap:"+c,b))})})}var c=["resize","webglcontextlost","webglcontextrestored","remove","contextmenu","styledata","data","error","moveend","move","touchmove","touchend","movestart","touchcancel","load","sourcedataloading","dblclick","click","touchstart","mousemove","mouseup","mousedown","styledataloading","dataloading","mouseout","render","sourcedata","zoom","zoomend","zoomstart","boxzoomstart","boxzoomend","boxzoomcancel","rotate","rotatestart","rotateend","drag","dragstart","dragend","pitch","pitchstart","pitchend"];return{exposeMapEvents:b}}]),a.module("mapboxgl-directive").factory("mapboxglImageUtils",["Utils","mapboxglConstants",function(b,c){function d(c,d){b.checkObjects([{name:"Map",object:c},{name:"Layer object",object:d,attributes:["url","coordinates"]}]),d.id="image_"+Date.now(),c.addSource(d.id,{type:"image",url:d.url,coordinates:d.coordinates}),c.addLayer({id:d.id,source:d.id,type:"raster",layout:a.isDefined(d.layer)&&a.isDefined(d.layer.layout)?d.layer.layout:{},paint:a.isDefined(d.layer)&&a.isDefined(d.layer.paint)?d.layer.paint:{}})}return{createImageByObject:d}}]),a.module("mapboxgl-directive").factory("mapboxglMapsData",["Utils",function(a){function b(a,b){g.push({id:a,mapInstance:b})}function c(a){g=g.filter(function(b){return b.id!==a})}function d(){g.map(function(a){a.mapInstance.remove()}),g=[]}function e(){return g}function f(b){var c=a.arrayObjectIndexOf(g,b,"id");return-1!==c?g[c].mapInstance:null}var g=[];return{addMap:b,removeMapById:c,removeAllMaps:d,getMaps:e,getMapById:f}}]),a.module("mapboxgl-directive").factory("mapboxglVideoUtils",["Utils","mapboxglConstants",function(b,c){function d(c,d){b.checkObjects([{name:"Map",object:c},{name:"Layer object",object:d,attributes:["urls","coordinates"]}]),d.id="video_"+Date.now(),c.addSource(d.id,{type:"video",urls:d.url,coordinates:d.coordinates}),c.addLayer({id:d.id,source:d.id,type:"raster",layout:a.isDefined(d.layer)&&a.isDefined(d.layer.layout)?d.layer.layout:{},paint:a.isDefined(d.layer)&&a.isDefined(d.layer.paint)?d.layer.paint:{}})}return{createVideoByObject:d}}]),a.module("mapboxgl-directive").factory("MarkersManager",["Utils","mapboxglConstants","$rootScope","$compile",function(c,d,e,f){function g(b,c){this.markersCreated=[],this.mapInstance=b,a.isDefined(c)&&null!==c&&(this.popupManger=c)}return g.prototype.createMarkerByObject=function(d){c.checkObjects([{name:"Map",object:this.mapInstance},{name:"Object",object:d,attributes:["coordinates","element"]}]);var e=d.element.getAttribute("id");e=a.isDefined(e)&&null!==e?e:c.generateGUID(),d.element.setAttribute("id",e);var f=d.options||{},g=new b.Marker(d.element,f).setLngLat(d.coordinates);if(a.isDefined(d.popup)&&a.isDefined(d.popup.enabled)&&d.popup.enabled){var h=this.popupManger.createPopupByObject({coordinates:d.popup.coordinates,options:d.popup.options,message:d.popup.message,getScope:d.popup.getScope,onClose:d.popup.onClose});g.setPopup(h)}g.addTo(this.mapInstance),this.markersCreated.push({markerId:e,markerInstance:g})},g.prototype.removeAllMarkersCreated=function(){this.markersCreated.map(function(a){a.markerInstance.remove()}),this.markersCreated=[]},g}]),a.module("mapboxgl-directive").factory("PopupsManager",["Utils","mapboxglConstants","$rootScope","$compile",function(c,d,e,f){function g(a){this.popupsCreated=[],this.mapInstance=a}var h=new RegExp(/\$\{(.+?)\}/g),i=new RegExp(/[^\$\{](.+)[^\}]/g);return g.prototype.getAllPopupsCreated=function(){return this.popupsCreated},g.prototype.getPopupByLayerId=function(b){if(a.isDefined(b)&&null!==b){var c=this.popupsCreated.filter(function(a){return a.layerId===b});return c.length>0&&c[0].popupInstance}return this.popupsCreated.length>0&&this.popupsCreated.map(function(a){return a.popupInstance})},g.prototype.removeAllPopupsCreated=function(){this.popupsCreated.map(function(a){a.popupInstance.remove()}),this.popupsCreated=[]},g.prototype.removePopupByLayerId=function(a){this.popupsCreated.filter(function(b){return b.layerId===a}).map(function(a){a.popupInstance.remove()}),this.popupsCreated=this.popupsCreated.filter(function(b){return b.layerId!==a})},g.prototype.generatePopupMessage=function(b,c){var d=a.copy(b.message);if(d instanceof HTMLElement)return d;if(a.isDefined(c)&&null!==c&&h.test(b.message)){var g=b.message.match(h);g.length>0&&g.forEach(function(a){var b=a.match(i);if(b.length>0){var e=b[0];if(!c.properties.hasOwnProperty(e))throw new Error('Property "'+e+'" isn\'t exist in source "'+c.layer.source+'"');d=d.replace(a,c.properties[e])}})}var j=a.isDefined(b.getScope)&&a.isFunction(b.getScope)?b.getScope():e;try{return f(d)(j)[0]}catch(a){return d}},g.prototype.createPopupByObject=function(d,e){var f=this;c.checkObjects([{name:"Map",object:this.mapInstance},{name:"Object",object:d,attributes:["message"]}]);var g=new b.Popup(d.options||{});if(a.isDefined(d.coordinates)&&null!==d.coordinates){var h=d.coordinates;a.isDefined(e)&&null!==e&&(h="center"===h?e.geometry.coordinates:h),"center"!==h&&g.setLngLat(h)}a.isDefined(d.onClose)&&null!==d.onClose&&a.isFunction(d.onClose)&&g.on("close",function(a){d.onClose(a,a.target)});var i=f.generatePopupMessage(d,e);i instanceof HTMLElement?g.setDOMContent(i):g.setHTML(i);var j={popupInstance:g,isOnClick:!!d.isOnClick&&d.isOnClick,isOnMouseover:!!d.isOnMouseover&&d.isOnMouseover};return a.isDefined(e)&&null!==e&&(j.layerId=e.layer.id),f.popupsCreated.push(j),g},g}]),a.module("mapboxgl-directive").factory("SourcesManager",["Utils","mapboxglConstants","$q","$rootScope",function(b,c,d,e){function f(b,c){this.sourcesCreated=[],this.mapInstance=b,a.isDefined(c)&&null!==c&&(this.animationManager=c)}return f.prototype.recreateSources=function(){var a=this;a.sourcesCreated.map(function(b){a.createSourceByObject(b.sourceObject)})},f.prototype.checkAndCreateFeatureId=function(c){a.isDefined(c)&&(b.isUrl(c)||(a.isDefined(c.features)&&a.isArray(c.features)?c.features=c.features.map(function(c){return a.isUndefined(c.properties)&&(c.properties={}),a.isUndefined(c.properties.featureId)&&(c.properties.featureId=b.generateGUID()),c}):(a.isUndefined(c.properties)&&(c.properties={}),a.isUndefined(c.properties.featureId)&&(c.properties.featureId=b.generateGUID()))))},f.prototype.createAnimationFunction=function(a,b,c){var d=this,e=function(a){a.animationFunction(this.mapInstance,a.sourceId,a.featureId,a.feature,a.animationData,a.deltaTime,a.end)};d.animationManager.addAnimationFunction(a,b,e,{map:this.mapInstance,sourceId:a,featureId:b,feature:c,animationData:c.properties.animation.animationData,deltaTime:0,animationFunction:c.properties.animation.animationFunction,end:function(){d.animationManager.removeAnimationByFeatureId(b)}})},f.prototype.createSourceByObject=function(c){var d=this;b.checkObjects([{name:"Map",object:this.mapInstance},{name:"Source object",object:c,attributes:["id","type","data"]}]);var e={};for(var f in c)"id"!==f&&(e[f]=c[f]);d.checkAndCreateFeatureId(e.data),this.mapInstance.addSource(c.id,e),e.id=c.id,d.sourcesCreated.push({sourceId:c.id,sourceObject:e});var g=this.mapInstance.getSource(c.id);a.isDefined(g._data)&&a.isDefined(g._data.features)&&a.isArray(g._data.features)?g._data.features.map(function(b,e){a.isDefined(b.properties)&&a.isDefined(b.properties.animation)&&a.isDefined(b.properties.animation.enabled)&&b.properties.animation.enabled&&a.isDefined(b.properties.animation.animationFunction)&&a.isFunction(b.properties.animation.animationFunction)&&d.createAnimationFunction(c.id,b.properties.featureId,b)}):a.isDefined(g._data)&&a.isDefined(g._data.properties)&&a.isDefined(g._data.properties.animation)&&a.isDefined(g._data.properties.animation.enabled)&&g._data.properties.animation.enabled&&a.isDefined(g._data.properties.animation.animationFunction)&&a.isFunction(g._data.properties.animation.animationFunction)&&d.createAnimationFunction(c.id,g._data.properties.featureId,g._data)},f.prototype.existSourceById=function(b){var c=!1;return a.isDefined(b)&&null!==b&&(c=this.sourcesCreated.filter(function(a){return a.sourceId===b}).length>0),c},f.prototype.removeSourceById=function(a){if(b.checkObjects([{name:"Map",object:this.mapInstance}]),!this.existSourceById(a))throw new Error("Invalid source ID");this.mapInstance.getSource(a)&&this.mapInstance.removeSource(a),this.animationManager.removeAnimationBySourceId(a),this.sourcesCreated=this.sourcesCreated.filter(function(b){return b.sourceId!==a})},f.prototype.updateSourceByObject=function(c){var d=this;b.checkObjects([{name:"Map",object:this.mapInstance},{name:"Source object",object:c,attributes:["id","data"]}]),d.checkAndCreateFeatureId(c.data);var e=this.mapInstance.getSource(c.id);b.checkObjects([{name:"Source "+c.id,object:e}]);var f=!1;a.isDefined(e._data)&&a.isDefined(e._data.features)&&a.isArray(e._data.features)&&e._data.features.length>0?e._data.features.map(function(b,e){a.isDefined(b.properties)&&a.isDefined(b.properties.animation)&&a.isDefined(b.properties.animation.enabled)&&b.properties.animation.enabled&&a.isDefined(b.properties.animation.animationFunction)&&a.isFunction(b.properties.animation.animationFunction)?d.animationManager.existAnimationByFeatureId(b.properties.featureId)?d.animationManager.updateAnimationFunction(b.properties.featureId,b.properties.animation.animationFunction,b.properties.animation.animationData):d.createAnimationFunction(c.id,b.properties.featureId,b):f=!0}):a.isDefined(e._data)&&a.isDefined(e._data.properties)&&a.isDefined(e._data.properties.animation)&&a.isDefined(e._data.properties.animation.enabled)&&e._data.properties.animation.enabled&&a.isDefined(e._data.properties.animation.animationFunction)&&a.isFunction(e._data.properties.animation.animationFunction)?d.animationManager.existAnimationByFeatureId(e._data.properties.featureId)?d.animationManager.updateAnimationFunction(e._data.properties.featureId,e._data.properties.animation.animationFunction,e._data.properties.animation.animationData):d.createAnimationFunction(c.id,e._data.properties.featureId,e._data):f=!0,f&&a.isDefined(c.data)&&e.setData(c.data)},f.prototype.getCreatedSources=function(){return this.sourcesCreated},f.prototype.removeAllCreatedSources=function(){var a=this;a.sourcesCreated.map(function(b){a.removeSourceById(b.sourceId)})},f}]),a.module("mapboxgl-directive").factory("Utils",["$window","$q",function(b,c){function d(){return"mapbox-gl-map-"+Date.now()}function e(d){var e=c.defer();return a.isDefined(d)?a.isDefined(d.autodiscover)&&d.autodiscover?b.navigator.geolocation.getCurrentPosition(function(a){var b=a.coords;e.resolve([b.longitude,b.latitude])},function(a){e.resolve(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0}):a.isNumber(d.lat)&&a.isNumber(d.lng)&&(d.lng>-180||d.lng<180)&&(d.lat>-90||d.lat<90)?e.resolve([d.lng,d.lat]):a.isArray(d)&&2===d.length&&a.isNumber(d[0])&&a.isNumber(d[1])&&(d[0]>-180||d[0]<180)&&(d[1]>-90||d[1]<90)?e.resolve(d):e.resolve(!1):e.resolve(!1),e.promise}function f(a,b,c){for(var d=0,e=a.length;d<e;d++)if(a[d][c]===b)return d;return-1}function g(b){var c=!1;return a.isDefined(b)&&null!==b&&(c="true"===b.toLowerCase()),c}function h(b){if(a.isDefined(b)&&null!==b){var c=+b;if(isNaN(c))throw new Error("Utils.stringToNumber --\x3e Invalid stringValue");return c}}function i(b){a.isDefined(b)&&a.isArray(b)&&b.map(function(b){if(a.isUndefined(b.object)||null===b.object)throw new Error(b.name+" is undefined");a.isDefined(b.attributes)&&a.isArray(b.attributes)&&b.attributes.map(function(c){if(a.isUndefined(b.object[c]||null===b.object[c]))throw new Error(b.name+" "+c+" is undefined")})})}function j(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}function k(a){return/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&amp;:\/~+#-]*[\w@?^=%&amp;\/~+#-])?/.test(a)||/^[^\/]+\/[^\/].*$|^\/[^\/].*$/.test(a)}return{generateMapId:d,validateAndFormatCenter:e,arrayObjectIndexOf:f,stringToBoolean:g,stringToNumber:h,checkObjects:i,generateGUID:j,isUrl:k}}]),a.module("mapboxgl-directive").constant("version",{full:"0.46.0",major:0,minor:46,patch:0}),a.module("mapboxgl-directive").constant("mapboxglConstants",{map:{defaultHeight:"450px",defaultStyle:"mapbox://styles/mapbox/streets-v9",defaultCenter:[0,0],defaultZoom:0,defaultHash:!1,defaultBearingSnap:7,defaultPitchWithRotate:!0,defaultFailIfMajorPerformanceCaveat:!1,defaultPreserveDrawingBuffer:!1,defaultTrackResize:!0,defaultRefreshExpiredTiles:!0,defaultRenderWorldCopies:!0,defaultMaxTileCacheSize:null,defaultLocalIdeographFontFamily:null,defaultCollectResourceTiming:!1,defaultLogoPosition:"bottom-left"},source:{defaultMaxZoom:18,defaultBuffer:128,defaultTolerance:.375,defaultCluster:!1,defaultClusterRadius:50},plugins:{rtlPluginUrl:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.0/mapbox-gl-rtl-text.js"}}),a.module("mapboxgl-directive").constant("mapboxglControlsAvailables",[{name:"navigation",constructor:b.Navigation||b.NavigationControl,pluginName:"mapboxgl."+(b.Navigation?b.Navigation.name:b.NavigationControl.name)},{name:"scale",constructor:b.Scale||b.ScaleControl,pluginName:"mapboxgl."+(b.Scale?b.Scale.name:b.ScaleControl.name)},{name:"attribution",constructor:b.Attribution||b.AttributionControl,pluginName:"mapboxgl."+(b.Attribution?b.Attribution.name:b.AttributionControl.name)},{name:"geolocate",constructor:b.Geolocate||b.GeolocateControl,pluginName:"mapboxgl."+(b.Geolocate?b.Geolocate.name:b.GeolocateControl.name),eventsExposedName:"mapboxglGeolocate",eventsAvailables:["geolocate","error","trackuserlocationstart","trackuserlocationend"]},{name:"geocoder",constructor:b.Geocoder||window.MapboxGeocoder,pluginName:b.Geocoder?"mapboxgl.Geocoder":"MapboxGeocoder",eventsExposedName:"mapboxglGeocoder",eventsAvailables:["clear","loading","results","result","error"]},{name:"language",constructor:window.MapboxLanguage||void 0,pluginName:"MapboxLanguage"},{name:"fullscreen",constructor:b.FullscreenControl||void 0,pluginName:b.FullscreenControl?"mapboxgl."+b.FullscreenControl.name:"mapboxgl.FullscreenControl"},{name:"directions",constructor:b.Directions||window.MapboxDirections,pluginName:b.Directions?"mapboxgl.Directions":"MapboxDirections",eventsExposedName:"mapboxglDirections",eventsAvailables:["clear","loading","profile","origin","destination","route","error"]},{name:"draw",constructor:b.Draw||window.MapboxDraw,pluginName:b.Draw?"mapboxgl.Draw":"MapboxDraw",eventsExposedName:"mapboxglDraw",listenInMap:!0,eventsAvailables:["draw.create","draw.delete","draw.combine","draw.uncombine","draw.update","draw.selectionchange","draw.modechange","draw.render","draw.actionable"]}]),a.module("mapboxgl-directive").directive("glBearing",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glBearing",function(c){if(a.isDefined(c)){if(!a.isNumber(c.value))throw new Error("Invalid bearing");b.setBearing(c.value,c.eventData)}},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glCenter",["Utils","mapboxglConstants",function(b,c){function d(d,e,f,g){if(!g)throw new Error("Invalid angular-mapboxgl-directive controller");var h=g.getMapboxGlScope();g.getMap().then(function(d){h.$watch("glCenter",function(e,f){b.validateAndFormatCenter(e).then(function(b){if(!b)throw new Error("Invalid center");a.isDefined(f)&&e!==f?d.flyTo({center:b}):d.setCenter(b)}).catch(function(a){throw d.setCenter(c.map.defaultCenter),new Error(a.code+" / "+a.message)})},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:d}}]),a.module("mapboxgl-directive").directive("glClasses",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glClasses",function(c){if(a.isDefined(c))b.setClasses(c.classes,c.options);else{b.getClasses().map(function(a){b.removeClass(a)})}},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glControls",["$rootScope","Utils","mapboxglControlsAvailables","$timeout",function(b,c,d,e){function f(f,g,h,i){if(!i)throw new Error("Invalid angular-mapboxgl-directive controller");var j=i.getMapboxGlScope(),k={custom:[]},l=function(b,d,e,f,g){var h=!!a.isDefined(g)&&g,i=a.isDefined(f)&&a.isArray(f)?f:[];e?k.custom.push({name:b||"customControl_"+c.generateGUID(),control:d,isEventsListenedByMap:h,events:i}):k[b]={control:d,isEventsListenedByMap:h,events:i}},m=function(a,b,c,d){var e=c?d:a;b.map(function(a){e.off(a)})},n=function(b){if(a.isDefined(b)&&null!==b)for(var c in k)if("custom"!==c){var d=k[c];m(d.control,d.events,d.isEventsListenedByMap,b),b.removeControl(d.control)}else for(var e=k[c],f=0,g=e.length;f<g;f++){var h=e[f];m(h.control,h.events,h.isEventsListenedByMap,b),b.removeControl(h.control)}k={custom:[]}};i.getMap().then(function(c){j.$watch("glControls",function(f){a.isDefined(f)&&(n(c),d.map(function(d){if(a.isDefined(f[d.name])&&a.isDefined(f[d.name].enabled)&&f[d.name].enabled)if(a.isDefined(d.constructor)&&a.isFunction(d.constructor)){var g=d.constructor.bind.apply(d.constructor,f[d.name].options),h=new g(f[d.name].options);if(l(d.name,h,!1,d.eventsAvailables,d.listenInMap),a.isDefined(d.eventsAvailables)&&a.isDefined(d.eventsExposedName)){var i=d.listenInMap?c:h;d.eventsAvailables.map(function(a){i.on(a,function(c){var e=d.eventsExposedName+":"+a;b.$broadcast(e,c)})})}var j=f[d.name].options&&f[d.name].options.position?f[d.name].options.position:void 0;if(c.addControl(h,j),
"draw"===d.name&&f[d.name].features&&Array.isArray(f[d.name].features)&&f[d.name].features.length>0){var k=[];f[d.name].features.map(function(a){var b=h.add(a);k=k.concat(b)}),h.changeMode(h.modes.SIMPLE_SELECT,{featureIds:k}),e(function(){h.changeMode(h.modes.SIMPLE_SELECT)},400,!0)}}else console.warn(d.pluginName+" plugin is not included.")}),a.isDefined(f.custom)&&(a.isArray(f.custom)?f.custom.map(function(d){if(a.isDefined(d.constructor)){var e=d.constructor.bind.apply(d.constructor,d.options),f=new e(d.options),g=a.isArray(d.events)?d.events:[];l(d.name,f,!0,g,d.listenInMap);var h=d.listenInMap?c:f;g.map(function(a){h.on(a,function(c){var e="mapboxgl:"+d.name+":"+a;b.$broadcast(e,c)})});var i=d.options&&d.options.position?d.options.position:void 0;c.addControl(f,i)}}):console.error("'custom' must be an array")),b.$broadcast("mapboxglMap:controlsRendered",k))})}),f.$on("$destroy",function(){n()})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:f}}]),a.module("mapboxgl-directive").directive("glFilter",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glFilter",function(c){if(a.isDefined(c))if(Object.prototype.toString.call(c)===Object.prototype.toString.call({})){if(!(a.isDefined(c.layerId)&&a.isDefined(c.filter)&&a.isArray(c.filter)))throw new Error("Invalid filter parameter");b.setFilter(c.layerId,c.filter)}else{if(Object.prototype.toString.call(c)!==Object.prototype.toString.call([]))throw new Error("Invalid filter parameter");c.map(function(c){if(!(a.isDefined(c.layerId)&&a.isDefined(c.filter)&&a.isArray(c.filter)))throw new Error("Invalid filter parameter");b.setFilter(c.layerId,c.filter)})}},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glHandlers",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glHandlers",function(c){if(a.isDefined(c)&&Object.prototype.toString.call(c)===Object.prototype.toString.call({}))for(var d in c)if(c.hasOwnProperty(d)){var e=c[d]?"enable":"disable";b[d][e]()}},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glImage",["mapboxglImageUtils",function(b){function c(c,d,e,f){if(!f)throw new Error("Invalid angular-mapboxgl-directive controller");var g=f.getMapboxGlScope(),h=function(c,d,e){if(a.isDefined(e))if(Object.prototype.toString.call(e)===Object.prototype.toString.call({}))b.createImageByObject(c,e),d.addImageObject(e);else{if(Object.prototype.toString.call(e)!==Object.prototype.toString.call([]))throw new Error("Invalid image parameter");e.map(function(a){b.createImageByObject(c,a),d.addImageObject(a)})}};c.$on("mapboxglMap:styleChanged",function(){}),f.getMap().then(function(a){g.$watchCollection("glImage",function(b){a.style.loaded()?h(a,f,b):a.once("style.load",function(){h(a,f,b)})})})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:c}}]),a.module("mapboxgl-directive").directive("glInteractive",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=["touchZoomRotate","scrollZoom","boxZoom","dragRotate","dragPan","doubleClickZoom","keyboard"],g=e.getMapboxGlScope();e.getMap().then(function(b){g.$watch("glInteractive",function(c){if(a.isDefined(c)&&null!==c&&"boolean"==typeof c){var d=c?"enable":"disable";f.map(function(a){b[a][d]()});var e=c?"auto":"default";b.on("mousemove",function(a){b.getCanvas().style.cursor=e})}})})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glLayers",["interactiveLayers","LayersManager","$timeout","$q",function(b,c,d,e){function f(d,f,g,h){function i(a){o.removeAllPopupsCreated(a),a.off("click"),a.off("mousemove")}function j(c){c.on("click",function(e){e.originalEvent.preventDefault(),e.originalEvent.stopPropagation();var f=d.layersManager.getCreatedLayers().map(function(a){return a.layerId}),g=b.layers.concat(f).filter(function(a,b,c){return c.indexOf(a)===b}),h=c.queryRenderedFeatures(e.point,{layers:g});if(h.length>0){var i=h[0],j=d.layersManager.getPopupRelationByLayerId(i.layer.id);if(a.isDefined(j)&&null!==j&&a.isDefined(j.onClick)){o.createPopupByObject({coordinates:j.onClick.coordinates||e.lngLat,options:j.onClick.options,message:j.onClick.message,getScope:j.onClick.getScope,onClose:j.onClick.onClose},i).addTo(c)}var k=d.layersManager.getEventRelationByLayerId(i.layer.id);a.isDefined(k)&&null!==k&&a.isDefined(k.onClick)&&a.isFunction(k.onClick)&&k.onClick(c,i,h)}}),c.on("mousemove",function(b){var e=d.layersManager.getCreatedLayers().map(function(a){return a.layerId}),f=c.queryRenderedFeatures(b.point,{layers:e});if(c.getCanvas().style.cursor=f.length?"pointer":"",f.length>0){var g=f[0],h=d.layersManager.getEventRelationByLayerId(g.layer.id);a.isDefined(h)&&null!==h&&a.isDefined(h.onMouseover)&&a.isFunction(h.onMouseover)&&h.onMouseover(c,g,f)}})}function k(b,c){if(d.layersManager.existLayerById(c.id)?d.layersManager.updateLayerByObject(c):d.layersManager.createLayerByObject(c),a.isDefined(c.animation)&&a.isDefined(c.animation.enabled)&&c.animation.enabled){var e=function(a){setTimeout(function(){requestAnimationFrame(e),c.animation.animationFunction(b,c.id,c.animation.animationData,a)},c.animation.timeoutMilliseconds||1e3)};e(0)}}function l(b){var c=e.defer(),f=[];Object.prototype.toString.call(b)===Object.prototype.toString.call([])?f=b.map(function(a){return a.id}):Object.prototype.toString.call(b)===Object.prototype.toString.call({})?f.push(b.id):c.reject(new Error("Invalid layers parameter")),f=f.filter(function(b){return a.isDefined(b)});var g=d.layersManager.getCreatedLayers();return f.map(function(a){g=g.filter(function(b){return b.layerId!==a})}),g.map(function(a){d.layersManager.removeLayerById(a.layerId)}),c.resolve(),c.promise}function m(b,c){a.isDefined(c)&&null!==c&&(i(b),l(c).then(function(){if(Object.prototype.toString.call(c)===Object.prototype.toString.call([]))c.map(function(a){k(b,a)});else{if(Object.prototype.toString.call(c)!==Object.prototype.toString.call({}))throw new Error("Invalid layers parameter");k(b,c)}j(b)}).catch(function(a){throw a}))}if(!h)throw new Error("Invalid angular-mapboxgl-directive controller");var n=h.getMapboxGlScope(),o=h.getPopupManager();h.getMap().then(function(a){d.layersManager=new c(a,o),n.$watch("glLayers",function(b){m(a,b)},!0)}),d.$on("mapboxglMap:styleChanged",function(){h.isPersistent()?d.layersManager.recreateLayers():d.layersManager.removeAllCreatedLayers()}),d.$on("$destroy",function(){a.isDefined(d.layersManager)&&d.layersManager.removeAllCreatedLayers()})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:f}}]),a.module("mapboxgl-directive").directive("glLights",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glLights",function(c){a.isDefined(c)&&b.setLight(c.options,c.lightOptions)},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glMarkers",["MarkersManager",function(b){function c(c,d,e,f){if(!f)throw new Error("Invalid angular-mapboxgl-directive controller");var g=f.getMapboxGlScope(),h=f.getPopupManager(),i=function(b){if(a.isDefined(b))if(c.markerManager.removeAllMarkersCreated(),Object.prototype.toString.call(b)===Object.prototype.toString.call({}))c.markerManager.createMarkerByObject(b);else{if(Object.prototype.toString.call(b)!==Object.prototype.toString.call([]))throw new Error("Invalid marker parameter");b.map(function(a){c.markerManager.createMarkerByObject(a)})}};f.getMap().then(function(a){c.markerManager=new b(a,h),g.$watchCollection("glMarkers",function(a){i(a)})}),c.$on("$destroy",function(){a.isDefined(c.markerManager)&&c.markerManager.removeAllMarkersCreated()})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:c}}]),a.module("mapboxgl-directive").directive("glMaxBounds",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glMaxBounds",function(c){if(!a.isArray(c)||2!==c.length)throw new Error("Invalid max bounds");b.setMaxBounds(c)},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glMaxZoom",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glMaxZoom",function(c){if(!a.isNumber(c)||!(c>=0||c<=22))throw new Error("Invalid max zoom");b.setMaxZoom(c)},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glMinZoom",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glMinZoom",function(c){if(!a.isNumber(c)||!(c>=0||c<=20))throw new Error("Invalid min zoom");b.setMinZoom(c)},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glPitch",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glPitch",function(c){if(a.isDefined(c)){if(!a.isNumber(c.value)||!(c.value>=0||c.value<=60))throw new Error("Invalid pitch");b.setPitch(c.value,c.eventData)}},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glPopups",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope(),g=e.getPopupManager(),h=function(b,c){if(a.isDefined(c))if(g.removeAllPopupsCreated(),Object.prototype.toString.call(c)===Object.prototype.toString.call({})){var d=g.createPopupByObject(c);d.addTo(b)}else{if(Object.prototype.toString.call(c)!==Object.prototype.toString.call([]))throw new Error("Invalid popup parameter");c.map(function(a){g.createPopupByObject(a).addTo(b)})}};e.getMap().then(function(a){f.$watchCollection("glPopups",function(b){h(a,b)})}),b.$on("$destroy",function(){g.removeAllPopupsCreated()})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").directive("glSources",["SourcesManager","$timeout","$q",function(b,c,d){function e(c,e,f,g){function h(a){c.sourceManager.existSourceById(a.id)?c.sourceManager.updateSourceByObject(a):c.sourceManager.createSourceByObject(a)}function i(b){var e=d.defer(),f=[];Object.prototype.toString.call(b)===Object.prototype.toString.call([])?f=b.map(function(a){return a.id}):Object.prototype.toString.call(b)===Object.prototype.toString.call({})?f.push(b.id):e.reject(new Error("Invalid sources parameter")),f=f.filter(function(b){return a.isDefined(b)});var g=c.sourceManager.getCreatedSources();return f.map(function(a){g=g.filter(function(b){return b.sourceId!==a})}),g.map(function(a){c.sourceManager.removeSourceById(a.sourceId)}),e.resolve(),e.promise}function j(b){a.isDefined(b)&&i(b).then(function(){if(Object.prototype.toString.call(b)===Object.prototype.toString.call([]))b.map(function(a){h(a)});else{if(Object.prototype.toString.call(b)!==Object.prototype.toString.call({}))throw new Error("Invalid sources parameter");h(b)}}).catch(function(a){throw a})}if(!g)throw new Error("Invalid angular-mapboxgl-directive controller");var k=g.getMapboxGlScope();g.getMap().then(function(a){c.sourceManager=new b(a,g.getAnimationManager()),k.$watch("glSources",function(a){j(a)},!0)}),c.$on("mapboxglMap:styleChanged",function(){g.isPersistent()?c.sourceManager.recreateSources():c.sourceManager.removeAllCreatedSources()}),c.$on("$destroy",function(){a.isDefined(c.sourceManager)&&c.sourceManager.removeAllCreatedSources()})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:e}}]),a.module("mapboxgl-directive").directive("glStyle",["$rootScope",function(b){function c(c,d,e,f){if(!f)throw new Error("Invalid angular-mapboxgl-directive controller");var g=f.getMapboxGlScope();f.getMap().then(function(c){g.$watch("glStyle",function(d,e){if(a.isDefined(d)&&null!==d&&d!==e){var f=!1;c.setStyle(d),c.on("styledata",function(a){f||(b.$broadcast("mapboxglMap:styleChanged",{map:c,newStyle:d,oldStyle:e}),f=!0)})}},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:c}}]),a.module("mapboxgl-directive").directive("glVideo",["mapboxglVideoUtils",function(b){function c(c,d,e,f){if(!f)throw new Error("Invalid angular-mapboxgl-directive controller");var g=f.getMapboxGlScope(),h=function(c,d,e){if(a.isDefined(e))if(Object.prototype.toString.call(e)===Object.prototype.toString.call({}))b.createVideoByObject(c,e),d.addVideoObject(e);else{if(Object.prototype.toString.call(e)!==Object.prototype.toString.call([]))throw new Error("Invalid video parameter");e.map(function(a){b.createVideoByObject(c,a),d.addVideoObject(a)})}};c.$on("mapboxglMap:styleChanged",function(){}),f.getMap().then(function(a){g.$watchCollection("glVideo",function(b){a.loaded()?h(a,f,b):a.on("load",function(){h(a,f,b)})})})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:c}}]),a.module("mapboxgl-directive").directive("glZoom",[function(){function b(b,c,d,e){if(!e)throw new Error("Invalid angular-mapboxgl-directive controller");var f=e.getMapboxGlScope();e.getMap().then(function(b){f.$watch("glZoom",function(c){if(a.isDefined(c)){if(!a.isNumber(c.value)||!(c.value>=0||c.value<=20))throw new Error("Invalid zoom");b.setZoom(c.value,c.eventData)}},!0)})}return{restrict:"A",scope:!1,replace:!1,require:"?^mapboxgl",link:b}}]),a.module("mapboxgl-directive").provider("interactiveLayers",[function(){var a=[];return{setLayers:function(b){a=b},addLayer:function(b){a.push(b)},$get:function(){return{layers:a}}}}])}(angular,mapboxgl)},{}]},{},[1]);