text: ﻿/*!
  *  filename: ej.map.min.js
  *  version : 15.1.0.33
  *  Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
  *  Use of this code is subject to the terms of our license.
  *  A copy of the current license can be obtained at any time by e-mailing
  *  licensing@syncfusion.com. Any infringement will be prosecuted under
  *  applicable laws. 
  */
  (function(n){typeof define=="function"&&define.amd?define(["./../common/ej.core.min","./../common/ej.data.min","./../web/ej.slider.min"],n):n()})(function(){(function(t,r,u){r.widget({ejMap:"ej.datavisualization.Map"},{validTags:["div"],_initPrivateProperties:function(){this._rootgroup=null;this._bubblegroup=null;this._scale=1;this._prevDistance=0;this._tileTranslatePoint={x:0,y:0};this._translatePoint={x:0,y:0};this._prevPoint=null;this._Tiles=[];this._prevScale=0;this._tileDiv=null;this._containerWidth=500;this._containerHeight=400;this._baseTranslatePoint={x:0,y:0};this._isDragging=!1;this._prevLevel=1;this._startPoint={x:0,y:0};this._stopPoint={x:0,y:0};this.mouseClickable=!1;this._browser=null;this._baseScale=0;this._mapBounds=null;this._svgns="http://www.w3.org/2000/svg";this._ispanning=!1;this._dragStartX=0;this._isNavigationPressed=!1;this._iskeyboardKeysPressed=!1;this._isPolygonSelected=!1;this._dragStartY=0;this._width=350;this._height=350;this._isMapCoordinates=!0;this._margintop=0;this._marginleft=0;this._svgDocument=null;this._tooltipElement=null;this._templateDiv=null;this._scrollLegendDiv=null;this._legendContainer=null;this._legendDiv=null;this._legendDivHeight=0;this._legendDivWidth=0;this._mapContainer=null;this._isSVG=!0;this._VMLPathFractionCount=0;this._sliderControl=null;this._isTileMap=!1;this._isRendered=!1;this._urlTemplate=null;this._polylineCount=0;this._pointscount=0;this._isPinching=!1;this._groupSize=null;this._groupBorder={x:0,y:0}},defaults:{locale:null,enableGroupSeparator:!1,background:"transparent",zoomSettings:{minValue:1,maxValue:100,factor:1,level:1,enableZoomOnSelection:!1,enableZoom:!0},centerPosition:null,enableResize:!0,isResponsive:!0,enableAnimation:!1,draggingOnSelection:!1,navigationControl:{enableNavigation:!1,content:null,orientation:"vertical",absolutePosition:{x:0,y:0},dockPosition:"centerleft"},enableLayerChangeAnimation:!1,enablePan:!0,zoomLevel:1,minZoom:1,maxZoom:100,zoomFactor:1,baseMapIndex:0,shapeSelected:"",markerSelected:"",zoomedIn:"",onRenderComplete:"",refreshed:"",panned:"",zoomedOut:"",mouseover:"",mouseleave:"",layers:[]},observables:["baseMapIndex","enablePan","enableResize","enableAnimation","zoomLevel","minZoom","maxZoom","zoomFactor",],_zoomLevel:r.util.valueFunction("zoomLevel"),_minZoom:r.util.valueFunction("minZoom"),_maxZoom:r.util.valueFunction("maxZoom"),_zoomFactor:r.util.valueFunction("zoomFactor"),baseMapIndex:r.util.valueFunction("baseMapIndex"),enablePan:r.util.valueFunction("enablePan"),enableResize:r.util.valueFunction("enableResize"),enableAnimation:r.util.valueFunction("enableAnimation"),_tags:[{tag:"layers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","labelSettings.showLables","labelSettings.labelPath","labelSettings.enableSmartLabel","legendSettings.leftLabel","legendSettings.rightLabel","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.maxValue","bubbleSettings.color","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient","shapeSettings.colorPalette","shapeSettings.customPalette",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","gradientColors"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"},{tag:"subLayers",attr:["legendSettings.showLegend","legendSettings.positionX","legendSettings.positionY","legendSettings.type","legendSettings.labelOrientation","legendSettings.title","legendSettings.mode","legendSettings.position","legendSettings.dockOnMap","legendSettings.dockPosition","legendSettings.leftLabel","legendSettings.rightLabel","bubbleSettings.showBubble","bubbleSettings.valuePath","bubbleSettings.minValue","bubbleSettings.maxValue","bubbleSettings.color","enableSelection","enableMouseHover","showTooltip","showMapItems","mapItemsTemplate","shapeData","dataSource","shapePropertyPath","shapeDataPath","layerType","bingMapType","key","urltemplate","shapeSettings.highlightColor","shapeSettings.highlightBorderWidth","shapeSettings.selectionColor","shapeSettings.fill","shapeSettings.strokeThickness","shapeSettings.selectionStrokeWidth","shapeSettings.stroke","shapeSettings.selectionStroke","shapeSettings.highlightStroke","shapeSettings.colorValuePath","shapeSettings.valuePath","shapeSettings.autoFill","shapeSettings.enableGradient",[{tag:"markers",attr:["label","latitude","longitude"],singular:"marker"},{tag:"bubbleSettings.colorMappings.rangeColorMapping",attr:["from","to","color"],singular:"bubblerangeColorMap"},{tag:"bubbleSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"bubbleequalColorMap"},{tag:"shapeSettings.colorMappings.rangeColorMapping",attr:["from","to","color","highlightcolor"],singular:"shaperangeColorMap"},{tag:"shapeSettings.colorMappings.equalColorMapping",attr:["value","color"],singular:"shapeequalColorMap"}],],singular:"subLayer"}]],singular:"layer"}],dataTypes:{layers:"array"},_destroy:function(){this._unWireEvents();_isSVG?t(this.element).removeClass("e-datavisualization-map e-js").find("#svgDocument").remove():t(this.element).removeClass("e-datavisualization-map e-js").find("#rootGroup").remove()},_setModel:function(n){var i,r;for(i in n)switch(i){case"zoomSettings":this.model.zoomSettings.enableZoom&&(this._zoomLevel(this.model.zoomSettings.level),this._zoomFactor(this.model.zoomSettings.factor),this._maxZoom(this.model.zoomSettings.maxValue),this._minZoom(this.model.zoomSettings.minValue),this.zoom(this._zoomLevel()));break;case"zoomLevel":this.model.zoomSettings.level=this._zoomLevel();this.zoom(this._zoomLevel());break;case"zoomFactor":this.model.zoomSettings.factor=this._zoomFactor();this.zoom(this._zoomLevel());break;case"minZoom":this.model.zoomSettings.minValue=this._minZoom();this.zoom(this._zoomLevel());break;case"maxZoom":this.model.zoomSettings.maxValue=this._maxZoom();this.zoom(this._zoomLevel());break;case"baseMapIndex":this.baseMapIndex(n[i]);r=this;this._groupSize=null;this.enableAnimation()?(this.model.enableLayerChangeAnimation=!0,t(this._mapContainer).animate({opacity:0},500,function(){r.refresh()})):this.refresh();break;case"background":baseLayer.layerType=="geometry"&&t(this._svgDocument).css("background",this.model.background)}},_layers:function(n,t){t=="shapeSettings.fill"||t=="shapeSettings.strokeThickness"||t=="shapeSettings.selectionColor"||t=="shapeSettings.highlightColor"?this.clearShapeSelection():t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh()},_layers_markers:function(){this.refreshMarkers()},_layers_subLayers:function(n,t){t=="showMapItems"||t=="dataSource"?this.refreshLayers():this.refresh()},_init:function(){var n=this;this._navigationStyle=null;this.navigationControlData=null;this._initPrivateProperties();this._setZoomProperties();this._localizedLabels=this._getLocalizedLabels();t.each(this.model.layers,function(t){n._layerInitialize(t)});this._mapContainer=this.element;t(this._mapContainer).css({overflow:"hidden"});document.documentMode==8&&t(this._mapContainer).css({overflow:"hidden",position:"relative"});this.refresh();this._trigger("onRenderComplete");this._isRendered=!0;_isSVG&&t(this._svgDocument).pinchZoom(this._rootgroup,this)},_setZoomProperties:function(){typeof this.model.zoomSettings.factor!="function"&&(this._zoomFactor(this.model.zoomSettings.factor),this._zoomLevel(this.model.zoomSettings.level),this._minZoom(this.model.zoomSettings.minValue),this._maxZoom(this.model.zoomSettings.maxValue))},_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},_layerInitialize:function(n){var i=this;this.model.layers[n]!=null?t.each(this.model.layers,function(n,r){r=i._checkArrayObject(r,n);var u=new f;t.extend(u,r);t.extend(r,u);t.each(r.subLayers,function(n,r){r=i._checkArrayObject(r,n);var u=new f;t.extend(u,r);t.extend(r,u)})}):this.layers[0]=new f},_checkArrayObject:function(n,i){var u=["background","zoomSettings","bubbleSettings","minValue","maxValue","factor","level","enableZoomOnSelection","enableZoom","centerPosition","enableResize","isResponsive","enableAnimation","draggingOnSelection","navigationControl","enableNavigation","orientation","absolutePosition","dockPosition","enablePan","baseMapIndex","enableSelection","selectionMode","enableMouseHover","shapeData","dataSource","showTooltip","legendSettings","showLegend","showLabels","position","height","width","type","mode","dockOnMap","dockPosition","labelSettings","labelPath","enableSmartLabel","smartLabelSize","layerType","showMapItems","shapeSettings","highlightColor","highlightBorderWidth","selectionColor","fill","strokeThickness","stroke","highlightStroke","selectionStroke","selectionStrokeWidth","colorValuePath","valuePath","enableGradient","autoFill",""],r=this;return t.each(n,function(n,t){if(u.indexOf(n)>-1)if(t instanceof Array)r._checkArrayObject(t,n);else if(t!=null&&typeof t=="object"){var e=new f;r._loadIndividualDefaultValues(t,e,typeof n=="number"?i:n)}}),n},_loadIndividualDefaultValues:function(n,i,r){var u=null,f=this;return t.each(i,function(n,t){if(r==n){u=t;return}}),u instanceof Array&&(u=u[0]),t.each(n,function(n,t){t instanceof Array?f._checkArrayObject(t,r):t!=null&&typeof t=="object"&&f._loadIndividualDefaultValues(t,t,typeof n=="number"?r:n)}),t.extend(u,n),t.extend(n,u),n},_refreshWithAnimation:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPositionWithAnimation(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPositionWithAnimation(this)},_resizeShape:function(){this.model.layers[this.baseMapIndex()]._resizeShapes(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._resizeShapes(this)},_refrshLayers:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPosition(this);for(var n=0;n<this.model.layers[this.baseMapIndex()].subLayers.length;n++)this.model.layers[this.baseMapIndex()].subLayers[n]._setMapItemsPosition(this)},_panTileMap:function(n,t,i){var u=Math.pow(2,this._zoomLevel())*256,r;this._tileTranslatePoint.x=n/2-u/2;this._tileTranslatePoint.y=t/2-u/2;r=this._convertTileLatLongtoPoint(i[0],i[1]);this._tileTranslatePoint.x-=r.x-n/2;this._tileTranslatePoint.y-=r.y-t/2},_generateTiles:function(n){var w=navigator.language||navigator.userLanguage,b,k,f,o,s,h,i,p,c,u,l,a,v;this.Tiles=[];b=k=Math.pow(2,n);var y=this.model.layers[this.baseMapIndex()],d=Math.min(k,(-this._tileTranslatePoint.y+this._height)/256+1),g=Math.min(b,(-this._tileTranslatePoint.x+this._width)/256+1),nt=-(this._tileTranslatePoint.x+256)/256,tt=-(this._tileTranslatePoint.y+256)/256;for(f=Math.round(nt);f<Math.round(g);f++)for(o=Math.round(tt);o<Math.round(d);o++)s=256*f+this._tileTranslatePoint.x,h=256*o+this._tileTranslatePoint.y,s>-256&&s<=this._width&&h>-256&&h<this._height&&f>=0&&o>=0&&(i=new e(f,o),i.left=s,i.top=h,i.src=y.layerType==r.datavisualization.Map.LayerType.Bing?this._getBingMap(i,y.key,y.bingMapType,w):this._urlTemplate.replace("level",this._zoomLevel()).replace("tileX",i.X).replace("tileY",i.Y),this.Tiles.push(i));for(p=t.extend(!0,[],this.Tiles),c=0;c<this.model.layers[this.baseMapIndex()].subLayers.length;c++)if(u=this.model.layers[this.baseMapIndex()].subLayers[c],u.layerType==r.datavisualization.Map.LayerType.OSM||u.layerType==r.datavisualization.Map.LayerType.Bing)for(l=0;l<p.length;l++)a=p[l],v=t.extend(!0,{},a),v.src=u.layerType==r.datavisualization.Map.LayerType.Bing?this._getBingMap(v,u.key,u.bingMapType,w):u.urlTemplate.replace("level",this._zoomLevel()).replace("tileX",a.X).replace("tileY",a.Y),this.Tiles.push(v);this._arrangeTiles()},_getBingMap:function(n,t,i,u){for(var f,s,h,e="",o=this._zoomLevel();o>0;o--)f=0,s=1<<o-1,(n.X&s)!=0&&f++,(n.Y&s)!=0&&(f+=2),e=e+""+f;return h=i==r.datavisualization.Map.BingMapType.Aerial?"A,G":i==r.datavisualization.Map.BingMapType.AerialWithLabel?"A,G,L":"G,VE,BX,L,LA","http://ak.dynamic.t2.tiles.virtualearth.net/comp/ch/"+e+"?mkt="+u+"&ur=IN&it="+h+"&shading=hill&og=45&n=z&Key="+t},_arrangeTiles:function(){var n=t.templates("<div><div style='position:absolute;left:{{:left}}px;top:{{:top}}px;height:{{:height}}px;width:{{:width}}px;'><img src={{:src}}><\/img><\/div><\/div>"),i=n.render(this.Tiles),r=this._mapContainer[0].children[0];this._tileDiv.html(i)},_generatePath:function(){var n=this.model.layers[this.baseMapIndex()],f="",i,e,o;for(this._polylineCount=0,this._pointscount=0,_isSVG=window.SVGSVGElement?!0:!1,n.layerType==r.datavisualization.Map.LayerType.Geometry?n!=u&&n.shapeData!=null&&(n._isBaseLayer=!0,this._isTileMap=!1,this._scale=this._zoomLevel(),f=this._readShapeData(n)):(this._isTileMap=!0,this._scale=Math.pow(2,this._zoomLevel()-this._zoomFactor())),i=0;i<n.subLayers.length;i++)n.subLayers[i].layerType==r.datavisualization.Map.LayerType.Geometry&&n.subLayers[i].shapeData!=null&&(n.subLayers[i]._isBaseLayer=!1,f+=this._readShapeData(n.subLayers[i]));_isSVG?(e='<div style="position:relative;" id="tileDiv"/><svg xmlns="http://www.w3.org/2000/svg" style= "overflow:hidden;z-index:0;float:left;left:0,top:0"id="svgDocument"> <g id="rootGroup">'+f+"<\/g><\/svg>",this._mapContainer.html(e),this._svgDocument=this.element.find("#svgDocument")[0],this._tileDiv=this.element.find("#tileDiv")):(document.createStyleSheet().addRule(".vml","behavior:url(#default#VML);display:inline-block"),document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML"),o='<div id="tileDiv"/><v:group   id = "rootGroup" style="position:absolute; width:'+this._width+"px;height:"+this._height+'px;" coordorigin = "0 0" coordsize="'+this._width+" "+this._height+'">'+f+"<\/v:group>",this._mapContainer.html(o),this._tileDiv=this.element.find("#tileDiv"),this._bubblegroup=this._createGroup(!1,"bubbleGroup"),this._bubblegroup.style.position="absolute",this.element.append(this._bubblegroup));(n.layerType==r.datavisualization.Map.LayerType.OSM||n.layerType==r.datavisualization.Map.LayerType.Bing)&&(this._urlTemplate=n.urlTemplate,this.model.centerPosition!=null?this._panTileMap(this._width,this._height,this.model.centerPosition):this._panTileMap(this._width,this._height,[0,0]),this._generateTiles(this._zoomLevel()),_isSVG&&t(this._svgDocument).css("position","relative"));_isSVG&&t(this._mapContainer).css("position","relative");this._rootgroup=this.element.find("#rootGroup")[0];this._on(t(this.element),r.eventType.mouseDown,{map:this},this.dragDown);this._on(t(this.element),r.eventType.mouseMove,{map:this},this.dragMove);this._on(t(this.element),r.eventType.mouseUp,{map:this},this.dragUp)},_calculateBBox:function(n,t,i){var f=maxLatitude=minLongitude=maxLongitude=0,o=!1,l,c,r,h,e,s,u;if(n!=null&&n.length>0)for(e=0;e<n.length;e++)for(h=n[e],coords=h.geometry!=null?h.geometry.coordinates:h.coordinates,l=coords.length,c=0;c<l;c++)if(r="",l>1?(r=coords[c][0],r.length<=2&&(r=coords[c])):r=coords[c],r.length>2)for(u=0;u<r.length;u++)r[u][1]!=null&&r[u][0]!=null&&(o?(f=Math.min(f,r[u][1]),maxLatitude=Math.max(maxLatitude,r[u][1]),minLongitude=Math.min(minLongitude,r[u][0]),maxLongitude=Math.max(maxLongitude,r[u][0])):(f=maxLatitude=r[u][1],minLongitude=maxLongitude=r[u][0],o=!0));else r[u][1]!=null&&r[u][0]!=null&&(o?(f=Math.min(f,r[1]),maxLatitude=Math.max(maxLatitude,r[1]),minLongitude=Math.min(minLongitude,r[0]),maxLongitude=Math.max(maxLongitude,r[0])):(f=maxLatitude=r[1],minLongitude=maxLongitude=r[0],o=!0));if(i!=null&&i.length>0)for(e=0;e<i.length;e++)h=i[e],r=h.geometry.coordinates,o?(f=Math.min(f,r[1]),maxLatitude=Math.max(maxLatitude,r[1]),minLongitude=Math.min(minLongitude,r[0]),maxLongitude=Math.max(maxLongitude,r[0])):(f=maxLatitude=r[1],minLongitude=maxLongitude=r[0],o=!0);if(t!=null&&t.length>0)for(e=0;e<t.length;e++)for(s=t[e].geometry==null?t[e].coordinates:t[e].geometry.coordinates,u=0;u<s.length;u++)o?(f=Math.min(f,s[u][1]),maxLatitude=Math.max(maxLatitude,s[u][1]),minLongitude=Math.min(minLongitude,s[u][0]),maxLongitude=Math.max(maxLongitude,s[u][0])):(f=maxLatitude=s[u][1],minLongitude=maxLongitude=s[u][0],o=!0);return this._groupSize!=null||this._isMapCoordinates||(this._groupSize={minX:minLongitude,maxX:maxLongitude,minY:f,maxY:maxLatitude}),[[minLongitude,f],[maxLongitude,maxLatitude]]},_readShapeData:function(n){var u=this,t,i;if(n.shapeData!=null)if(typeof n.shapeData=="string")t=new r.DataManager(n.shapeData),i=r.Query().from(n),t.executeQuery(i).done(function(t){if(t.result!=null)return u._getPathCollection(t.result,n)});else return this._getPathCollection(n.shapeData,n)},_getFactor:function(){var n,t,i,r;if(this._mapBounds!=null){var u=this._convertTileLatLongtoPointForShapes(this._mapBounds[0][1],this._mapBounds[0][0],this._mapBounds),f=this._convertTileLatLongtoPointForShapes(this._mapBounds[1][1],this._mapBounds[1][0],this._mapBounds),r=i=1;n=f.y-u.y;t=f.x-u.x}else n=500,t=500;return i=n<this._height?parseFloat(Math.abs(this._height/n+"e+1").toString().split(".")[0]/10):this._height/n,r=t<this._width?parseFloat(Math.abs(this._width/t+"e+1").toString().split(".")[0]/10):this._width/t,Math.min(r,i)},_getPathCollection:function(n,i){var vt="",it="",rt="",ct,h,c,l,a,g,ii,wt,ut,yt,pt,nt,lt,at,et,y,tt,s,n,u,ft,o,v,f,e,st,ht,p,ot,w,bt;if(n.features!=null?(rt=new r.DataManager(n.features),it="geometry.type",i._isBaseLayer&&(this._mapBounds=n.bbox)):n.geometries!=null&&(rt=new r.DataManager(n.geometries),it="type",i._isBaseLayer&&n.bbox!=null&&(this._mapBounds=[[n.bbox[0],n.bbox[1]],[n.bbox[2],n.bbox[3]]])),n.geometries!=null||n.features!=null){var kt=r.Query().from(i).where(it,r.FilterOperators.equal,"LineString"),dt=r.Query().from(i).where(it,r.FilterOperators.equal,"Polygon"),gt=r.Query().from(i).where(it,r.FilterOperators.equal,"MultiPolygon"),b=rt.executeLocal(kt),k=rt.executeLocal(dt),ni=r.Query().from(i).where(it,r.FilterOperators.equal,"Point"),d=rt.executeLocal(ni),ti=rt.executeLocal(gt);if(this._polylineCount=this._polylineCount+b.length,this._pointscount=this._pointscount+d.length,t.merge(k,ti),i._isBaseLayer&&i.geometryType==r.datavisualization.Map.GeometryType.Normal&&(this._isMapCoordinates=!1),this._mapBounds==null&&i._isBaseLayer?this._mapBounds=this._calculateBBox(k,b,d):this._mapBounds==null&&(this._mapBounds=[[-180,-85],[180,85]]),ot=this._getFactor(),i._newBounds=[],ct="",this._groupSize!=null&&(h=this._groupSize.minX,c=this._groupSize.maxX,l=this._groupSize.minY,a=this._groupSize.maxY),g=!0,d.length>0)for(e=0;e<d.length;e++)ut=d[e],ii="",s=ut.geometry.coordinates,n=[],u=[],n.push({lat:parseFloat(s[1]),lng:parseFloat(s[0])}),ft=0,o=n[0],latitude=o.lat,longitude=o.lng,f=this._convertTileLatLongtoPointForShapes(latitude,longitude,this._mapBounds,ot),v=this._mapBounds,longitude>=v[0][0]&&longitude<=v[1][0]&&latitude>=v[0][1]&&latitude<=v[1][1]?(g&&this._groupSize==null?(h=c=f.x,l=a=f.y,g=!1):(h=Math.min(h,f.x),c=Math.max(c,f.x),l=Math.min(l,f.y),a=Math.max(a,f.y)),_isSVG?u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}):u.push({x:f.x-5/this._scale,y:f.y-5/this._scale,lat:o.lat,lng:o.lng}),_isSVG?ct+='<circle cx="'+u[0].x+'" cy="'+u[0].y+'" r="'+i.shapeSettings.radius/this._scale+'" stroke="'+i.shapeSettings.stroke+'" stroke-width="'+i.shapeSettings.strokeThickness+'" fill="'+i.shapeSettings.fill+'" />':(wt='<v:oval display="block" fill="'+i.shapeSettings.fill+'" style="position:absolute;top: '+u[0].y+"px;left:"+u[0].x+"px;width:"+10/this._scale+"px;height:"+10/this._scale+"px;stroke-width:"+i.shapeSettings.strokeThickness+'px;"><\/v:oval>',ct+=wt)):(d.splice(e,1),e--);if(k.length>0)for(e=0;e<k.length;e++){if(ut=k[e],yt=0,nt=ut.geometry!=null?ut.geometry.coordinates:ut.coordinates,pt=nt[0][0].length,lt=nt.length,lt>1)for(at=nt,et=0;et<at.length;et++)pt<at[et][0].length&&(pt=at[et][0].length,yt=et);for(y="",tt=0;tt<lt;tt++){if(s="",lt>1?(s=nt[tt][0],s.length<=2&&(s=nt[tt])):s=nt[tt],n=[],u=[],s.length>2)for(p=0;p<s.length;p++)n.push({lat:parseFloat(s[p][1]),lng:parseFloat(s[p][0])});else n.push({lat:parseFloat(s[1]),lng:parseFloat(s[0])});for(ft=0;ft<n.length-1||n.length==1&&ft==0;ft++)o=n[ft],latitude=o.lat,longitude=o.lng,v=this._mapBounds,(this._isTileMap||longitude>=v[0][0]&&longitude<=v[1][0]&&latitude>=v[0][1]&&latitude<=v[1][1])&&(f=this._convertTileLatLongtoPointForShapes(latitude,longitude,v,ot),g&&this._groupSize==null?(h=c=f.x,l=a=f.y,g=!1):(h=Math.min(h,f.x),c=Math.max(c,f.x),l=Math.min(l,f.y),a=Math.max(a,f.y)),_isSVG?u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}):u.push({x:f.x,y:f.y,lat:o.lat,lng:o.lng}));if(tt==yt&&i._newBounds.push(this._findMidPointofPoylgon(u)),u.length>0)if(_isSVG){for(y+="M"+u[0].x+","+u[0].y,m=1;m<u.length;m++)y+=","+u[m].x+","+u[m].y;y+="Z"}else{for(y+="m"+parseInt(u[0].x)+","+parseInt(u[0].y),y+=" l"+parseInt(u[0].x)+","+parseInt(u[0].y),m=1;m<u.length;m++)y+=","+parseInt(u[m].x)+","+parseInt(u[m].y);y+=" e"}}y!=""?vt+=_isSVG?'<path class="mapShape" stroke='+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+" fill= "+i.shapeSettings.fill+' d="'+y+'"  stroke-linejoin= round stroke-linecap= square><\/path>':'<v:shape  style="width:'+this._width+"px;height:"+this._height+'px;"  coordsize="'+this._width+" "+this._height+'" coordorigin="0 0" strokecolor='+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+'px" fillcolor= '+i.shapeSettings.fill+' path="'+y+'"><\/v:shape>':(k.splice(e,1),e--)}if(b.length>0)for(e=0;e<b.length;e++){for(st=b[e].geometry==null?b[e].coordinates:b[e].geometry.coordinates,ht="",p=0;p<st.length;p++)ot=this._getFactor(),w=this._convertTileLatLongtoPointForShapes(st[p][1],st[p][0],this._mapBounds,ot),g&&this._groupSize==null?(h=c=w.x,l=a=w.y,g=!1):(h=Math.min(h,w.x),c=Math.max(c,w.x),l=Math.min(l,w.y),a=Math.max(a,w.y)),ht+=w.x+","+w.y,p!=st.length-1&&(ht+=",");vt+=_isSVG?"<polyline stroke="+i.shapeSettings.stroke+" stroke-width="+i.shapeSettings.strokeThickness/this._scale+' fill="transparent" stroke-width="1" points="'+ht+'" ><\/polyline>':'<v:polyline coordsize="'+this._width+","+this._height+'" coordorigin="0 0" strokecolor='+i.shapeSettings.stroke+" strokeweight="+i.shapeSettings.strokeThickness/this._scale+'px" fillcolor='+i.shapeSettings.fill+'  points="'+ht+'"/>'}return this._isMapCoordinates&&(this._groupSize={minX:h,maxX:c,minY:l,maxY:a}),bt=[].concat(k,b),i._polygonData=t.merge(bt,d),vt+ct}return i._polygonData=[],null},_createGroup:function(n,t){var i;return i=document.createElement("<v:group class="+t+">"),i.style.width=this._width+"px",i.style.height=this._height+"px",i.coordorigin="0 0",i.coordsize=this._width+" "+this._height,n&&(this._rootgroup=i,i.style.left="20px",i.style.top="20px"),i},_generatePaletteColorsForShape:function(n,t,i,r){r!=null&&(t.shapeSettings.highlightColor=r.highlightColor,t.shapeSettings.highlightStroke=r.highlightStroke,t.shapeSettings.selectionColor=r.SelectionColor,t.shapeSettings.selectionStroke=r.SelectionStroke);_isSVG?n.setAttribute("fill",i[t._prevPaletteIndex]):n.fillcolor=i[t._prevPaletteIndex];t._prevPaletteIndex=t._prevPaletteIndex+1;t._prevPaletteIndex>i.length-1&&(t._prevPaletteIndex=0)},_renderLayers:function(n,i){var k,w,rt,kt,d,y,lt,g,at,e,l,p,vt,yt,b,ii,pt,s,a,ot,st,ri,ui,h,wt,fi,ht,nt,bt,c,ct,v;n._prevPaletteIndex=0;n._initializeLocalValues();n.selectedItems==null&&(n.selectedItems=[]);var oi=this._rootgroup,ei=this._svgDocument,o=this,f=n;f.legendSettings!=null&&f.shapeSettings.colorMappings!=null&&(f.legendSettings.type==u||f.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&f._generateLegends(this);f.legendSettings!=null&&f.bubbleSettings.colorMappings!=null&&f.legendSettings.type==r.datavisualization.Map.LegendType.Bubbles&&f._generateBubbleLegends(this);f.shapeSettings.colorMappings!=null&&f.shapeSettings.colorMappings.rangeColorMapping!=null&&f.shapeSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);f.bubbleSettings.colorMappings!=null&&f.bubbleSettings.colorMappings.rangeColorMapping!=null&&f.bubbleSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);var tt=0,it=0;if(f.dataSource!=null&&f.bubbleSettings!=null)for(f.bubbleSettings.colorValuePath==null&&(f.bubbleSettings.colorValuePath=f.bubbleSettings.valuePath),k=0;k<f.dataSource.length;k++)w=parseFloat(this._reflection(f.dataSource[k],f.bubbleSettings.valuePath)),k!=0?w>it?it=w:w<tt&&(tt=w):tt=it=w;if(this._generateTooltipForLayers(f),f.shapeData!=null){if(rt=[],f.dataSource!=null)for(a=0;a<f.dataSource.length;a++)kt=f.dataSource[a],d=o._reflection(kt,f.shapeDataPath),d!=null&&(d=d.toLowerCase()),rt.push(d);var dt=r.browserInfo(),si=this.model,ut=dt.isMSPointerEnabled,ft=dt.pointerEnabled,et=ut?ft?"pointerup":"MSPointerUp":"touchend mouseup",gt=ut?ft?"pointermove":"MSPointerMove":"touchmove mousemove",ni=ut?ft?"pointerdown":"MSPointerDown":"touchstart mousedown",ti=ut?ft?"pointerleave":"MSPointerOut":"touchend mouseleave";for(y=0;y<f._polygonData.length;y++){if(lt=f._polygonData[y].properties,g=o._reflection(lt,f.shapePropertyPath),g!=null&&typeof g=="string"&&(at=g.toLowerCase()),e=this._rootgroup.childNodes[y+i],_isSVG?e.setAttribute("fill",f.shapeSettings.fill):(e.fillcolor=f.shapeSettings.fill,e.strokecolor=f.shapeSettings.stroke),s={},l=f._newBounds[y],f.shapeSettings.autoFill)switch(f.shapeSettings.colorPalette){case r.datavisualization.Map.ColorPalette.Palette1:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette1,f._colorPaletteSettings.Palette1);break;case r.datavisualization.Map.ColorPalette.Palette2:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette2,f._colorPaletteSettings.Palette2);break;case r.datavisualization.Map.ColorPalette.Palette3:this._generatePaletteColorsForShape(e,f,f.colorPalettes.Palette3,f._colorPaletteSettings.Palette3);break;case r.datavisualization.Map.ColorPalette.CustomPalette:this._generatePaletteColorsForShape(e,f,f.shapeSettings.customPalette,null)}if(rt.indexOf(at)!=-1&&(p=f.dataSource[rt.indexOf(at)],vt=g,p!=null)){if(e!=null&&(yt=vt),n._bounds.push(l),f.showMapItems){if(b=t("<div class='mapItems' style='display:block;position:absolute;pointer-events: none;'><\/div>"),b[0].className=vt,o._templateDiv.append(b),t(b).css({left:l.x,top:l.y}),pt=this.model.locale,s=t.extend({},p),pt&&this.model.enableGroupSeparator)for(a in s)s[a]=isNaN(parseFloat(s[a]))?s[a]:parseFloat(s[a]).toLocaleString(pt);ii=f.mapItemsTemplate==null?t(" <div><label>{{:"+f.shapeSettings.valuePath+"}}<\/label><\/div>").render(s):t("#"+f.mapItemsTemplate).render(s);t(b).html(ii);n._mapItems.push(b)}f.shapeSettings.colorMappings!=null?(f.shapeSettings.colorValuePath==null&&(f.shapeSettings.colorValuePath=f.shapeSettings.valuePath),ot=o._reflection(p,f.shapeSettings.colorValuePath),ot==null||f.shapeSettings.autoFill||((f.legendSettings!=null&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive||f.shapeSettings.enableGradient)&&f.shapeSettings.colorMappings.rangeColorMapping!=null?(s.legendrect=f._updateLegendRange(ot,f,e),st=f.shapeSettings.fill,s.legendrect!=u&&(st=s.legendrect.color),_isSVG?e.setAttribute("fill",st):e.fillcolor=st):f._fillColors(ot,f.shapeSettings.colorMappings,e))):f.shapeSettings.autoFill||(_isSVG?e.setAttribute("fill",f.shapeSettings.fill):(e.fillcolor=f.shapeSettings.fill,e.strokecolor=f.shapeSettings.stroke));f.bubbleSettings.showBubble&&f.bubbleSettings!=null&&f.bubbleSettings.valuePath!=null&&(_isSVG?h=document.createElementNS(o._svgns,"circle"):(ri="bubble_"+yt,ui='<v:oval class="mapBubble" id='+ri+' display="block" style="position:absolute;top: 0px;left:0px;width:100px;height:100px;stroke-width:0px;"><v:fill opacity="0.9"/><\/v:oval>',this._bubblegroup.innerHTML=this._bubblegroup.innerHTML+ui,h=document.getElementById("bubble_"+yt)),wt=o._reflection(p,f.bubbleSettings.valuePath),fi=o._reflection(p,f.bubbleSettings.colorValuePath),f.bubbleSettings.colorMappings!=null?f._fillColors(fi,f.bubbleSettings.colorMappings,h):_isSVG?h.setAttribute("fill",f.bubbleSettings.color):(h.strokecolor=f.bubbleSettings.color,h.fillcolor=f.bubbleSettings.color),ht=o._getRatioOfBubble(f.bubbleSettings.minValue,f.bubbleSettings.maxValue,wt,tt,it),_isSVG?(t(h).attr({cx:l.x,cy:l.y,"fill-opacity":f.bubbleSettings.bubbleOpacity,r:ht,"class":"mapBubble"}),o.enableAnimation()&&!this._isTileMap&&t(h).css("display","none")):t(h).css({height:2*ht+"px",width:2*ht+"px"}),f.bubbleSettings.showTooltip==!0?(nt=t("<div class='bubbleToolTip'  style='position:absolute;display:none;z-index:9999'/>"),bt=null,f.bubbleSettings.tooltipTemplate!=null?bt=f.bubbleSettings.tooltipTemplate:t(nt).append('<div class="bubbleToolTip"  style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label  style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">'+wt+"<\/label><\/p><\/div><\/div>"),t(h).mouseenter({htmlobj:nt,templateID:bt,itemsrc:p},o._bubbleEnterFunction),t(h).mousemove({htmlobj:nt},o._bubbleOverFunction),t(h).mouseleave({htmlobj:nt},o._bubbleleaveFunction)):t(h).css("pointer-events","none"),_isSVG?(ei.appendChild(h),n._bubbles.push(h)):n._bubbles.push(h));s.data=p}n.labelSettings!=null&&n.labelSettings.showLabels&&n.labelSettings.labelPath!=null&&f.geometryType!=r.datavisualization.Map.GeometryType.Normal&&(ct=o._reflection(lt,n.labelSettings.labelPath),ct!=null&&(l==null,c=t("<div class='labelStyle'><\/div>"),t(c).css({"pointer-events":"none",position:"absolute"}),c[0].innerHTML=ct,this._templateDiv.append(c),n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="top"?t(this._templateDiv).css({"margin-top":n.legendSettings.height}):n.legendSettings.showLegend&&n.legendSettings.dockOnMap&&n.legendSettings.dockPosition=="left"&&t(this._templateDiv).css({"margin-left":n.legendSettings.width}),t(c).css({left:l.x,top:l.y}),o._off(t(c),r.eventType.mouseUp,o._polyClickFunction),o._on(t(c),r.eventType.mouseUp,{Param1:null,Param2:n,Param3:e},o._polyClickFunction),o._off(t(c),r.eventType.mouseLeave,o._polyLeaveFunction),o._on(t(c),r.eventType.mouseLeave,{Param1:n,Param2:s,map:this},o._polyLeaveFunction),c[0].setAttribute("nodeValue",e.getAttribute("fill")),n._labelCollection.push(c),n._labelBounds.push(l),n._labelData.push(ct)));s.shapeIndex=y;s.shape=e;s.shapeData=n._polygonData[y];o._off(t(c),r.eventType.mouseMove,o._polyMoveFunction);o._on(t(c),r.eventType.mouseMove,{Param1:f,Param2:s},o._polyMoveFunction);e!=null&&(v=null,_isSVG?(v=e.getAttribute("fill"),v=="undefined"&&(v=n.shapeSettings.fill),e.setAttribute("nodeValue",v)):(v=e.fillcolor.value,v=="undefined"&&(v=n.shapeSettings.fill),e.style.behavior=v));o.model.zoomSettings.enableZoomOnSelection&&t(e).hover(function(){t(this).css("cursor","pointer")},function(){t(this).css("cursor","auto")});n._mapShapes.push(s);this._off(t(e),"mouseenter touchmove",o._polyEnterFunction);this._on(t(e),"mouseenter touchmove",{Param1:f,Param2:s,map:o},o._polyEnterFunction);this._off(t(e),ni,o._polyMouseDown);this._on(t(e),ni,{Param1:s,Param2:f},o._polyMouseDown);this._off(t(e),et,o._polyClickFunction);this._on(t(e),et,{Param1:s,Param2:f,Param3:e},o._polyClickFunction);this._off(t(e),gt,o._polyMoveFunction);this._on(t(e),gt,{Param1:f,Param2:s,Param3:e},o._polyMoveFunction);this._off(t(e),ti,o._polyLeaveFunction);this._on(t(e),ti,{Param1:f,Param2:s,map:this},o._polyLeaveFunction);this._off(t(e),et,o._polyUpFunction);this._on(t(e),et,{Param1:s,Param2:f,Param3:e},o._polyUpFunction)}}f._isBaseLayer&&f.geometryType==r.datavisualization.Map.GeometryType.Normal&&f.labelSettings.showLabels&&(f._generateLabels(this),f._labelSizeCalculation(this),this._applyTransform(this._scale,this._translatePoint))},isTouch:function(n){var t=n.originalEvent?n.originalEvent:n;return t.pointerType=="touch"||t.pointerType==2||t.type.indexOf("touch")>-1?!0:!1},validateBubblePosition:function(n,t,i){var e=[],o=[],f,u,r;if(n==null&&(n=[],n.push(t)),!this.isPointInPolygon(n,t,!0)){for(f=0,r=0;r<n.length;r++)u={x:(n[r].x+this._translatePoint.x)*this._scale,y:(n[r].y+this._translatePoint.y)*this._scale},(u.y<t.y&&f.y>=t.y||f.y<t.y&&u.y>=t.y)&&(u.x<t.x?e.push(u.x):o.push(u.x)),f=u;if(!e.length>0||!o.length>0){if(e.length>0){for(r=t.x+i;!this.isPointInPolygon(n,{x:r-2,y:t.y},!0);)r=r-2;t.x=parseFloat(r-2-i)}if(o.length>0){for(r=t.x-i;!this.isPointInPolygon(n,{x:r+2,y:t.y},!0);)r=r+2;t.x=parseFloat(r+2+i)}}}return t},isPointInPolygon:function(n,t,i){for(var r,f,o=!1,e=0,u=0;u<n.length;u++){r={x:n[u].x,y:n[u].y};f={x:n[e].x,y:n[e].y};i&&(r={x:(n[u].x+this._translatePoint.x)*this._scale,y:(n[u].y+this._translatePoint.y)*this._scale},f={x:(n[e].x+this._translatePoint.x)*this._scale,y:(n[e].y+this._translatePoint.y)*this._scale});var s=t.y-r.y,h=f.y-r.y,c=f.x-r.x;(r.y<t.y&&f.y>=t.y||f.y<t.y&&r.y>=t.y)&&r.x+s/h*c<t.x&&(o=!0);e=u}return o},dragDown:function(n){var r=n.data.map,t=r.model.layers[0],i=this._mapContainer,u;if(n.type=="mousedown"?(r._startPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop},r._stopPoint={x:n.pageX-i[0].offsetLeft,y:n.pageY-i[0].offsetTop}):n.type=="touchstart"?(r._startPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.changedTouches[0].pageX-i[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-i[0].offsetTop}):n.type=="MSPointerDown"&&(r._startPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop},r._stopPoint={x:n.originalEvent.pageX-i[0].offsetLeft,y:n.originalEvent.pageY-i[0].offsetTop}),r.mouseClickable=!0,r.model.draggingOnSelection&&t._prevSelectedShapes.length>0){for(u=0;u<t._prevSelectedShapes.length;u++)t._prevSelectedShapes[u].setAttribute("class","mapShape"),_isSVG?(t._prevSelectedShapes[u].setAttribute("fill",t._prevSelectedShapes[u].getAttribute("nodeValue")),t._prevSelectedShapes[u].setAttribute("stroke",t.shapeSettings.stroke),t._prevSelectedShapes[u].setAttribute("stroke-width",t.shapeSettings.strokeThickness/this._scale)):(t.fillcolor=t._prevSelectedShapes[u].getAttribute("nodeValue"),t.strokecolor=t.shapeSettings.stroke,t.strokeweight=t.shapeSettings.strokeThickness/this._scale);t._prevSelectedShapes=[]}},dragMove:function(n){var i=n.data.map,o=i.model.layers[0],f,e,r=this._mapContainer,u;i.model.draggingOnSelection&&i.mouseClickable&&(i.ispanning=!1,n.type=="mousemove"?i._stopPoint={x:n.pageX-r[0].offsetLeft,y:n.pageY-r[0].offsetTop}:n.type=="touchmove"?i._stopPoint={x:n.originalEvent.changedTouches[0].pageX-r[0].offsetLeft,y:n.originalEvent.changedTouches[0].pageY-r[0].offsetTop}:n.type=="MSPointerMove"&&(i._stopPoint={x:n.originalEvent.pageX-r[0].offsetLeft,y:n.originalEvent.pageY-r[0].offsetTop}),t(".e-mapDragSelection").remove(),u=t('<div class = "e-mapDragSelection"><\/div>'),f=Math.abs(i._stopPoint.x-i._startPoint.x),e=Math.abs(i._stopPoint.y-i._startPoint.y),t(u).css({top:Math.min(i._startPoint.y,i._stopPoint.y),left:Math.min(i._startPoint.x,i._stopPoint.x),width:f,height:e,position:"absolute","z-index":100}),t(u).appendTo("#maps"))},dragUp:function(n){var i=n.data.map,s=Math.abs(i._stopPoint.x-i._startPoint.x),h=Math.abs(i._stopPoint.y-i._startPoint.y),e=i.model.layers[0],o=this._mapContainer,u,r,f;if(i.model.draggingOnSelection){for(t(".e-mapDragSelection").remove(),t(".e-mapDragSelection").css({display:"none"}),i.mouseClickable=!1,u=0;u<i.model.layers[0]._mapShapes.length;u++)r=i.model.layers[0]._mapShapes[u].shape,f=r.getBoundingClientRect(),f.left-o[0].offsetLeft+f.width<Math.min(i._startPoint.x,i._stopPoint.x)||Math.min(i._startPoint.x,i._stopPoint.x)+s<f.left-o[0].offsetLeft||f.top-o[0].offsetTop+f.height<Math.min(i._startPoint.y,i._stopPoint.y)||Math.min(i._startPoint.y,i._stopPoint.y)+h<f.top-o[0].offsetTop||i.model.layers[0]._contains(e._prevSelectedShapes,r)||e._prevSelectedShapes.push(r);for(u=0;u<e._prevSelectedShapes.length;u++)r=e._prevSelectedShapes[u],f=r.getBoundingClientRect(),r.setAttribute("class","e-mapSelectedShape mapShape"),_isSVG&&(r.setAttribute("fill",e.shapeSettings.selectionColor),r.setAttribute("stroke",e.shapeSettings.selectionStroke),r.setAttribute("stroke-width",e.shapeSettings.selectionStrokeWidth/i._scale))}},isIntersectBubbles:function(){for(var r,n,i,t=[],u=0;u<this.model.layers.length;u++)for(r=this.model.layers[u],Array.prototype.push.apply(t,r._bubbleCollection),n=0;n<r.subLayers.length;n++)Array.prototype.push.apply(t,r.subLayers[n]._bubbleCollection);for(n=0;n<t.length;n++){var f=t[n].getAttribute("cx"),e=t[n].getAttribute("cy"),h=t[n].getAttribute("r");for(i=n+1;i<t.length;i++){var o=t[i].getAttribute("cx"),s=t[i].getAttribute("cy"),c=t[i].getAttribute("r"),l=Math.sqrt((f-o)*(f-o)+(e-s)*(e-s)),a=parseFloat(h)+parseFloat(c);if(l<=a)return!0}}return!1},_zooming:function(n,t){var i=this._getCurrentPoint(t);n>=120?this._zoomingIn(i.x,i.y,t):this._zoomingOut(i.x,i.y,t)},_zoomingIn:function(n,t,i){var r=this,f,e,u;r.model.zoomSettings.enableZoom&&r._zoomLevel()>=r._minZoom()&&r._zoomLevel()<=r._maxZoom()&&(f=r._scale,e={x:n,y:t},r._prevScale=f,this._isTileMap?(this._tileZoom(r._zoomLevel()-r._zoomFactor(),r._zoomLevel(),e),u=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor()),this._generateTiles(this._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,u))/Math.pow(2,u),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,u))/Math.pow(2,u),r._scale=Math.pow(2,u)):(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale+r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale+r._zoomFactor()))/(r._height/t),r._scale=f+r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()+r._zoomFactor(),r._zoomLevel(r._zoomLevel()+r._zoomFactor())),r._trigger("zoomedIn",{originalEvent:i,zoomLevel:r._zoomLevel()}),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue())},_zoomingOut:function(n,t,i){var r=this,u,f,e;r.model.zoomSettings.enableZoom&&(r._zoomLevel()>this._minZoom()?(u=r._scale,f={x:n,y:t},r._prevScale=u,r._isTileMap?(r._tileZoom(r._zoomLevel()+r._zoomFactor(),r._zoomLevel(),f),e=r._zoomLevel(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._generateTiles(r._zoomLevel()),r._translatePoint.x=(r._tileTranslatePoint.x-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._translatePoint.y=(r._tileTranslatePoint.y-.5*Math.pow(2,r._zoomLevel()-r._zoomFactor()))/Math.pow(2,r._zoomLevel()-r._zoomFactor()),r._scale=Math.pow(2,r._zoomLevel()-r._zoomFactor())):r._scale>1&&(r._prevPoint={x:r._translatePoint.x,y:r._translatePoint.y},r._translatePoint.x-=(r._width/r._scale-r._width/(r._scale-r._zoomFactor()))/(r._width/n),r._translatePoint.y-=(r._height/r._scale-r._height/(r._scale-r._zoomFactor()))/(r._height/t),r._scale=r._scale-r._zoomFactor(),r.model.zoomSettings.level=r._zoomLevel()-r._zoomFactor(),r._zoomLevel(r._zoomLevel()-r._zoomFactor()),r._scale=r._zoomLevel()),r._zoomLevel()<r._minZoom()&&(r.model.zoomSettings.level=r._minZoom(),r._zoomLevel(r._minZoom()),r.zoom(r._zoomLevel())),r._applyTransform(r._scale,r._translatePoint),r._refrshLayers(),r._resizeShape(),r._updateSliderValue()):r.zoom(r._minZoom(),!1),r._trigger("zoomedOut",{originalEvent:i,zoomLevel:r._zoomLevel()}))},_getRatioOfBubble:function(n,t,i,r,u){var e=100/(u-r)*(i-r),f=(parseFloat(t)-parseFloat(n))/100*e+parseFloat(n);return u==r&&(f=(parseFloat(t)-parseFloat(n))/100+parseFloat(n)),f},_reflection:function(n,i){var r=n,f,e,o;if(i!=null&&n!=null){for(f=i.split("."),e=0,f.push(i);e<f.length;e++)n!=u&&r!=null&&(o=r.hasOwnProperty(f[e]),o&&t.each(r,function(n,t){if(n==f[e])return r=t,!1}));return r}return null},clearShapeSelection:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._clearShapeWidth(this._scale),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._clearShapeWidth(this._scale)},shapeSelectionOnResize:function(){var t=this.baseMapIndex(),n;for(this.model.layers[t]._shapeSelection(),n=0;n<this.model.layers[t].subLayers.length;n++)this.model.layers[t].subLayers[n]._shapeSelection()},refreshMarkers:function(){for(var t,i=document.getElementsByClassName("mapMarker"),n=i.length-1;n>=0;n--)i[n].parentNode.removeChild(i[n]);for(n=this.baseMapIndex(),this.model.layers[n]._generateMarkerForLayers(this),t=0;t<this.model.layers[n].subLayers.length;t++)this.model.layers[n].subLayers[t]._generateMarkerForLayers(this);this._refrshLayers()},_generateTooltipForLayers:function(n){var i,r,u;n.showTooltip&&(i=document.documentMode==8?document.querySelectorAll("shapeToolTip"):document.getElementsByClassName("shapeToolTip"),i!=null&&i.length==0?(r=t("<div class='shapeToolTip' style='display:none;position:absolute;z-index:1000;pointer-events:none;'><\/div>"),t(document.body).append(r),n._tooltipElement=r):n._tooltipElement=i[0],n.tooltipTemplate==null&&(u=n.shapeSettings.valuePath,u!=null&&(n.tooltipTemplate="defaultTooltip",this._mapContainer.append(t('<div  id="defaultTooltip" style="display:none;"><div style="margin-left:10px;margin-top:-25px;"><div class="defaultToolTip"><p style="margin-top:-4px"><label  style="color:rgb(27, 20, 20);font-size:14px;font-weight:normal;font-family:Segoe UI">{{:#data["'+u+'"]}}<\/label><\/p><\/div><\/div><\/div>')))))},_orderByNameAscending:function(n,t){return n.Range==t.Range?0:n.Range>t.Range?1:-1},_resizingContainer:function(){this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-1):1;this._isTileMap?(this._translatePoint.x=(this._tileTranslatePoint.x-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor()),this._translatePoint.y=(this._tileTranslatePoint.y-.5*Math.pow(2,this._zoomLevel()-this._zoomFactor()))/Math.pow(2,this._zoomLevel()-this._zoomFactor())):(this._translatePoint.x=this._tileTranslatePoint.x/this._scale,this._translatePoint.y=this._tileTranslatePoint.y/this._scale);this._applyTransform(this._scale,this._translatePoint);this._zoomLevel()>1&&(this._scale=this._isTileMap?Math.pow(2,this._zoomLevel()-this._zoomFactor()):this._zoomLevel(),this._applyTransform(this._scale,this._translatePoint));this._baseScale=1;this._baseTranslatePoint={x:this._translatePoint.x*2,y:this._translatePoint.y*2}},_calculateMarginConditions:function(){var n=this._calculateMinMax();this._translatePoint.y>n.maxY?this._translatePoint.y=n.maxY:this._translatePoint.y<n.minY&&(this._translatePoint.y=n.minY);this._translatePoint.x>n.maxX?this._translatePoint.x=n.maxX:this._translatePoint.x<n.minX&&(this._translatePoint.x=n.minX)},_calculateMinMax:function(){var n=this._groupBorder,t,i,r,u;return this._containerHeight*this._scale<=this._height?(i=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y,u=(this._height-this._containerHeight*this._scale)/(2*this._scale)-n.y):(i=-n.y+1,u=(this._height-this._containerHeight*this._scale)/this._scale-n.y-1),this._containerWidth*this._scale<=this._width?(t=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x,r=(this._width-this._containerWidth*this._scale)/(2*this._scale)-n.x):(t=-n.x+1,r=(this._width-this._containerWidth*this._scale)/this._scale-n.x-1),{minX:r,maxX:t,minY:u,maxY:i}},_findMidPointofPoylgon:function(n){var y,p,r,t;if(n.length>0){var k=0,v=n.length,u=n[0],d=u.x,g=u.x,nt=u.y,tt=u.y,h,c,f,e,o=0,s=0,i=0;for(r=k;r<=v-1;r++)y=n[r],h=y.x,c=y.y,r==v-1?(f=u.x,e=u.y):(p=n[r+1],f=p.x,e=p.y),o=o+Math.abs(h*e-f*c),s=s+Math.abs((h+f)*(h*e-f*c)),i=i+Math.abs((c+e)*(h*e-f*c));o=.5*o;s=1/(4*o)*s;i=1/(4*o)*i;var w={x:0,y:0},l={x:0,y:0},b={x:0,y:0},a={x:0,y:0};for(r=k;r<=v-1;r++)t=n[r],t.x>s?t.y<i&&i-t.y<i-w.y?w={x:t.x,y:t.y}:t.y>i&&(l.y==0||t.y-i<l.y-i)&&(l={x:t.x,y:t.y}):t.y<i&&i-t.y<i-b.y?b={x:t.x,y:t.y}:t.y>i&&(a.y==0||t.y-i<a.y-i)&&(a={x:t.x,y:t.y});return{x:s,y:i,rightMin:w,rightMax:l,leftMin:b,leftMax:a,points:n}}},_convertPointToLatLong:function(n,t,i,r){var u,f,e;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,f=Math.min(n,0,u-1)/u-.5,e=.5-Math.min(t,0,u-1)/u,latitude=90-360*Math.atan(Math.exp(-e*2*Math.PI))/Math.PI,longitude=360*f,{x:latitude,y:longitude}},_convertTileLatLongtoPointForShapes:function(n,t,i,r){var u,s,f,h,e,o;return i==null&&(i=[[-180,-85],[180,85]]),u=this._isTileMap?Math.pow(2,1)*256:r==null?Math.min(this._height,this._width):Math.min(this._height,this._width)*r,s=(t+180)/360,f=Math.sin(n*Math.PI/180),f==-1&&(f=-.5),h=.5-Math.log((1+f)/(1-f))/(4*Math.PI),this._isMapCoordinates?(e=Math.min(Math.max(s*u+.5,0),u-1),o=Math.min(Math.max(h*u+.5,0),u-1)):r!=null?(e=Math.abs((t-this._mapBounds[0][0])*r),o=Math.abs((this._mapBounds[1][1]-n)*r)):(e=t,o=n),{x:e,y:o}},_convertTileLatLongtoPoint:function(n,t){var u=Math.pow(2,this._zoomLevel())*256,e=(t+180)/360,f=Math.sin(n*Math.PI/180),o=.5-Math.log((1+f)/(1-f))/(4*Math.PI),i,r;return this._isMapCoordinates?(i=e*u+.5+this._tileTranslatePoint.x,r=o*u+.5+this._tileTranslatePoint.y):factor!=null?(i=Math.abs((t-this._mapBounds[0][0])*factor),r=Math.abs((this._mapBounds[1][1]-n)*factor)):(i=t,r=n),{x:i,y:r}},_convertLatLongtoPointforMarker:function(n,t){var r=this._getFactor(),i=this._convertTileLatLongtoPointForShapes(n,t,this._mapBounds,r);return{x:(i.x+this._translatePoint.x)*this._scale,y:(i.y+this._translatePoint.y)*this._scale}},_animate:function(n){function s(n,t){return n[0]==t[0]?null:(t[1]-n[1])/(t[0]-n[0])}function h(n,t){return t===null?n[0]:n[1]-t*n[0]}this._calculateMarginConditions();t(this._rootgroup).stop(!0,!1);this._sliderControl!=null&&t(this._sliderControl).stop(!0,!1);var i=this,e={x:this._translatePoint.x,y:this._translatePoint.y},r=[this._prevPoint.x,this._prevPoint.y],u=[this._translatePoint.x,this._translatePoint.y];var f=s(r,u),c=h(r,f),l=u[0]-r[0],a=u[1]-r[1],v=this._scale-this._prevScale,o=this._scale;this._updateSliderValue();t(this._rootgroup).animate({count:10},{duration:n,step:function(n,t){var u=i._prevScale+n*(v/t.end),e=r[0]+n*(l/t.end)/(u/o),s;s=f==null?r[1]+n*(a/t.end):f*e+c;_isSVG?i._rootgroup.setAttribute("transform","scale("+u+") translate("+e+", "+s+")"):(i._rootgroup.coordorigin=-e+","+-s,i._rootgroup.coordsize=i._width/u+","+i._height/u);i._translatePoint.x=e;i._translatePoint.y=s;i._scale=u;i._refrshLayers();i._resizeShape()},complete:function(){i._translatePoint.x=e.x;i._translatePoint.y=e.y;i._scale=o;this.count=0}})},_applyTransform:function(n,t){this._scale=n;this._translatePoint=t;this._isTileMap||this._calculateMarginConditions();this._translatePoint.x!=Number.POSITIVE_INFINITY&&this._translatePoint.y!=Number.POSITIVE_INFINITY&&(_isSVG?this._rootgroup.setAttribute("transform","scale("+this._scale+") translate("+this._translatePoint.x+", "+this._translatePoint.y+")"):(this._rootgroup.coordorigin=-this._translatePoint.x+","+-this._translatePoint.y,this._rootgroup.coordsize=this._width/n+","+this._height/n))},_mouseMove:function(n){var t,i,f,e,r,u;n.type=="touchmove"&&n.originalEvent.touches.length>1?this._isPinching=!0:(t=this,t.ispanning&&t.enablePan()&&(n.preventDefault(),n.type=="mousemove"||n.type=="pointermove"?i={x:n.pageX,y:n.pageY}:n.type=="touchmove"?i={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerMove"&&(i={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),this._isTileMap&&(f=this._tileTranslatePoint.x-(this._dragStartX-i.x),e=this._tileTranslatePoint.y-(this._dragStartY-i.y),this._tileTranslatePoint.x=f,this._tileTranslatePoint.y=e,this._generateTiles(this._zoomLevel())),r=t._translatePoint.x-(t._dragStartX-i.x)/t._scale,u=t._translatePoint.y-(t._dragStartY-i.y)/t._scale,(r!=t._translatePoint.x||u!=t._translatePoint.y)&&(t._isDragging=!0),this._translatePoint.x=r,this._translatePoint.y=u,t._applyTransform(t._scale,t._translatePoint),t._dragStartX=i.x,t._dragStartY=i.y,t._refrshLayers()))},_svgMouseLeave:function(){var n=this;n.ispanning=!1},_mouseWheel:function(n){if(this.model.zoomSettings.enableZoom){this.enableAnimation()&&t(this._rootgroup).stop(!0,!1);var i=n.originalEvent,r=n;_isSVG||(i=n);n.target.className!="LegendDiv"&&n.target.className!="e-defaultLegendLabel"&&(i.preventDefault?i.preventDefault():r.preventDefault(),_isSVG?this._zooming(n.originalEvent.wheelDelta,n.originalEvent):this._zooming(n.originalEvent.wheelDelta,i))}},_mouseButtonUp:function(n){var t=this;t.ispanning&&t._trigger("panned",{originalEvent:n});t.ispanning=!1},_mouseUp:function(){this.ispanning=!1;this._isDragging=!1},_mouseButtonDown:function(n){var i,r;this._isPinching=!1;n.target.className!="e-vhandle"&&(this._isNavigationPressed=!1,this.enableAnimation()&&(t(this._rootgroup).stop(!0,!1),this._sliderControl!=null&&t(this._sliderControl).stop(!0,!1)),n.type=="touchstart"&&n.originalEvent.touches.length>1||(n.preventDefault(),n.type=="mousedown"||n.type=="pointerdown"?i={x:n.pageX,y:n.pageY}:n.type=="touchstart"?i={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerDown"&&(i={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),r=this,r.ispanning=!0,r._dragStartX=i.x,r._dragStartY=i.y))},_getCurrentPoint:function(n){var t=this._mapContainer,i=n.pageX-t.offset().left,r=n.pageY-t.offset().top;return{x:i,y:r}},_legendDoubleClick:function(n){for(var t=n.target;t.parentNode!=null&&t.parentNode.className!="ScrollLegendDiv e-scroller e-js e-widget";)t=t.parentNode;t.parentNode!=null&&t.parentNode.className=="ScrollLegendDiv e-scroller e-js e-widget"&&(this._isNavigationPressed=!0)},_doubleClick:function(n){var t=this,f=t._zoomLevel(),r,u,i;t._legendDoubleClick(n);this._isNavigationPressed||n.target.className.toString().indexOf("e-icon1")!=-1||(r=this._getCurrentPoint(n),t.model.zoomSettings.enableZoom&&t._zoomLevel()+t._zoomFactor()>=t._minZoom()&&t._zoomLevel()+t._zoomFactor()<=t._maxZoom()&&(u=t._scale,t._prevScale=u,this._isTileMap?(this._tileZoom(t._zoomLevel()-t._zoomFactor(),t._zoomLevel(),r),i=t._zoomLevel(),t.model.zoomSettings.level=t._zoomLevel()+t._zoomFactor(),t._zoomLevel(t._zoomLevel()+t._zoomFactor()),this._generateTiles(this._zoomLevel()),t._translatePoint.x=(t._tileTranslatePoint.x-.5*Math.pow(2,i))/Math.pow(2,i),t._translatePoint.y=(t._tileTranslatePoint.y-.5*Math.pow(2,i))/Math.pow(2,i),t._scale=Math.pow(2,i)):(t._prevPoint={x:t._translatePoint.x,y:t._translatePoint.y},t._translatePoint.x-=(t._width/t._scale-t._width/(t._scale+t._zoomFactor()))/(t._width/r.x),t._translatePoint.y-=(t._height/t._scale-t._height/(t._scale+t._zoomFactor()))/(t._height/r.y),t._scale=u+t._zoomFactor(),t.model.zoomSettings.level=t._zoomLevel()+t._zoomFactor(),t._zoomLevel(t._zoomLevel()+t._zoomFactor())),f<t._zoomLevel()&&t._trigger("zoomedIn",{originalEvent:null,zoomLevel:t._zoomLevel()}),t.enableAnimation()&&!this._isTileMap?t._animate(600):(t._applyTransform(t._scale,t._translatePoint),t._refrshLayers(),t._resizeShape()),t._updateSliderValue()))},_tileZoom:function(n,t,i){var c=this,r;if(t>0&&t<20){this._tileDiv.html("");r=Math.pow(2,n)*256;i==u&&(i={x:this._width/2,y:this._height/2});var f=Math.pow(2,t)*256,e=(i.x-this._tileTranslatePoint.x)/r*100,o=(i.y-this._tileTranslatePoint.y)/r*100,s=e*f/100,h=o*f/100;this._tileTranslatePoint.x=i.x-s;this._tileTranslatePoint.y=i.y-h}},_bubbleEnterFunction:function(n){if(n.data.templateID!=null){var i=t("#"+n.data.templateID).render(n.data.itemsrc);t(n.data.htmlobj).html(i)}return t(document.body).append(n.data.htmlobj),t(n.data.htmlobj).css("display","block").css({left:n.pageX+8+"px",top:n.pageY+6+"px"})},_bubbleleaveFunction:function(n){return t(n.data.htmlobj).remove(),t(n.data.htmlobj).css("display","none")},_bubbleOverFunction:function(n){return t(n.data.htmlobj).css("display","block").css({left:n.pageX+8+"px",top:n.pageY+6+"px"})},_polyEnterFunction:function(n){var p=jQuery.uaMatch(navigator.userAgent),i=n.data.Param1,f,w=this.isTouch?this.isTouch(n):!1,h,e,o,s,a,c,l,v,y;if(w&&p.browser=="chrome"?(h=n.originalEvent.changedTouches[0],f=document.elementFromPoint(h.clientX,h.clientY)):f=n.data.Param2.shape,e=n.data.map,o=jQuery.grep(i._smartLabels,function(n){return n.shape==f}),i.enableMouseHover){if(i._clearShapeWidth(e._scale),i._prevHoverdLegend==null||i._contains(i._prevSelectedLegends,i._prevHoverdLegend)||i._prevHoverdLegend.css("background-color",_isSVG?i._prevHoveredShape.getAttribute("fill"):i._prevHoveredShape.fillcolor.value),_isSVG?(f.setAttribute("stroke-width",i.shapeSettings.highlightBorderWidth/e._scale),f.setAttribute("stroke",i.shapeSettings.highlightStroke)):(f.strokeweight=i.shapeSettings.highlightBorderWidth,f.strokecolor=i.shapeSettings.highlightStroke/e._scale),i.shapeSettings.highlightColor!=null&&(i.shapeSettings.highlightColor=="transparent"||i._contains(i._prevSelectedShapes,f)||(f.setAttribute("class","e-mapHighlightedShape mapShape"),_isSVG?(i.shapeSettings.highlightColor!="none"&&f.highlightcolor==null?f.setAttribute("fill",i.shapeSettings.highlightColor):f.setAttribute("fill",f.highlightcolor),f.setAttribute("stroke-width",i.shapeSettings.highlightBorderWidth/e._scale),f.setAttribute("stroke",i.shapeSettings.highlightStroke)):f.fillcolor=i.shapeSettings.highlightColor),o.length>0&&!i._contains(i._prevSelectedLegends,o[0].legend)&&(o[0].legend[0].setAttribute("class","e-mapHighlightedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.highlightColor),i._prevHoverdLegend=o[0].legend),i._prevHoveredShape=f),i.legendSettings!=null&&i.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&i.shapeSettings.colorMappings!=null&&i.shapeSettings.colorMappings.rangeColorMapping!=null&&!i.shapeSettings.autoFill&&(i.legendSettings.showLegend==u||i.legendSettings.showLegend))for(s=0;s<i._mapShapes.length;s++)if(a=i._mapShapes[s].shape,a==f&&(c=null,i.shapeSettings.colorMappings.rangeColorMapping!=u&&(c=i.shapeSettings.colorMappings.rangeColorMapping),l=i.legendSettings.width,i.legendSettings.width==u&&(l=150),v=l/c.length/10,i._mapShapes[s].legendrect!=null)){y=i._mapShapes[s].legendrect.marginLeft;t(i._interactiveArrow).css({"margin-left":y+Math.ceil(v)-i._interactiveArrow.width()/2,display:"block"});break}e._trigger("mouseover",{originalEvent:n.data.Param2})}},_updateShapeRect:function(n){for(var i,t=0;t<n._mapShapes.length;t++)i=n._mapShapes[t],i.left==null&&(i.left=n._mapShapes[t].shape.getBoundingClientRect().left,i.right=n._mapShapes[t].shape.getBoundingClientRect().right,i.top=n._mapShapes[t].shape.getBoundingClientRect().top,i.bottom=n._mapShapes[t].shape.getBoundingClientRect().bottom,n._mapShapes[t]=i)},_polyUpFunction:function(n){var i=n.data.Param2,o=n.data.Param3,s=this.isTouch(n),h,u,f,e;if(s&&n.stopImmediatePropagation(),this.model.zoomSettings.enableZoomOnSelection&&!this._isDragging&&!this._isTileMap&&!this._isPinching){if(_isSVG)h=o.getBBox(),this._zoomOnSelection(h);else for(this._updateShapeRect(i),u=0;u<i._mapShapes.length;u++)if(o==i._mapShapes[u].shape){var c=i._mapShapes[u].left,l=i._mapShapes[u].top,b=i._mapShapes[u].right,k=i._mapShapes[u].bottom,d={x:c,y:l,width:b-c,height:k-l};this._zoomOnSelection(d);break}this.ispanning=!1}if(f=i._tooltipElement,f!=null&&t(f).delay(200).queue(function(n){t(this).css("display","none");n()}),s&&i.showTooltip){var a=this.getEventXY(n),r=this,v=r.model.cachedXY,y=10,p,w;p=Math.abs(v.x-a.X);w=Math.abs(v.y-a.Y);p<y&&w<y&&(this.touchEnd=!0,e=n.data.Param1,n.data.Param1=i,n.data.Param2=e,r._polyMoveFunction(n),n.data.Param1=e,n.data.Param2=i,r.tooltipElement=i._tooltipElement[0],t(r.tooltipElement).stop(!0,!0),r._timeOut=r._timeOut.bind(r),r.touchTimeOut=window.setTimeout(r._timeOut,1e3))}},_timeOut:function(){t(this.tooltipElement).fadeOut()},_markerPressed:function(n){this._trigger("markerSelected",{originalEvent:n.data})},_polyMouseDown:function(n){var e=n.data.Param2,u,y,p,w;if(n.type=="mousedown"||n.type=="pointerdown"?u={x:n.pageX,y:n.pageY}:n.type=="touchstart"?u={x:n.originalEvent.changedTouches[0].pageX,y:n.originalEvent.changedTouches[0].pageY}:n.type=="MSPointerDown"&&(u={x:n.originalEvent.pageX,y:n.originalEvent.pageY}),this.model.cachedXY=u,!this.isTouch(n)&&n.data.Param1.hasOwnProperty("data")&&e.showTooltip){var i=e._tooltipElement,v=e.tooltipTemplate,f=t(this._mapContainer).offset();f==null&&(f={left:0,width:0,height:0});var r=e._tooltipSize,o=this._height,s=this._width;if(i!=null&&v!=null){t(i).css({display:"block"});y=t("#"+v).render(n.data.Param1.data);t(i).html(y);p=i[0]!=null?i[0].clientHeight:i.clientHeight;w=i[0]!=null?i[0].clientWidth:i.clientWidth;r={height:p,width:w};var c=u.x-t(this._mapContainer).offset().left,l=u.y-t(this._mapContainer).offset().top,h=u.x,a=u.y;r.width+c>=s&&(h-r.width>f.left?h=f.left+s-(s-c)-r.width:h-=r.width+c-s);r.height>o?o+r.height>this._height+l&&(a-=f.top+10):r.height+l>=o&&(a-=r.height+l-o);t(i).css({left:h+10,top:a+10})}}},getEventXY:function(n){var t,i;return t=n.pageX||n.originalEvent.pageX||n.originalEvent.changedTouches[0].pageX,i=n.pageY||n.originalEvent.pageY||n.originalEvent.changedTouches[0].pageY,{X:t,Y:i}},_polyClickFunction:function(n){var k=n.ctrlKey,i=n.data.Param2,h=this,a=10,v=h.model.cachedXY,y,p,w=h.getEventXY(n),f,s,o,b,c,l,e;if(y=Math.abs(v.x-w.X),p=Math.abs(v.y-w.Y),y<a&&p<a){if(f=n.data.Param3,n.data.param4!=u&&(s=n.data.param4),o=jQuery.grep(i._smartLabels,function(n){return n.shape==f}),h._isPolygonSelected=!0,i.enableSelection)if(k&&i.selectionMode==r.datavisualization.Map.SelectionMode.Multiple)o!=null&&o.length>0&&(t.inArray(o[0].legend,i._prevSelectedLegends)==-1?(o[0].legend[0].setAttribute("class","e-mapSelectedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.selectionColor),i._prevSelectedLegends.push(o[0].legend)):(c=i._prevSelectedLegends.indexOf(o[0].legend),o[0].legend[0].setAttribute("class","mapShape"),o[0].legend.css("background-color",o[0].legend[0].getAttribute("nodeValue")),i._prevSelectedLegends.splice(c,1))),s!=null&&(l=document.getElementsByClassName("e-map-labelContainer"),t.inArray(s,i._prevSelectedTemp)==-1?(t(s).css("background-color",i.shapeSettings.selectionColor),t(s).css("width",l[0].clientWidth),i._prevSelectedTemp.push(s)):(t(s).css("background-color",""),b=i._prevSelectedTemp.indexOf(s),i._prevSelectedTemp.splice(b,1))),t.inArray(f,i._prevSelectedShapes)==-1?(f.setAttribute("class","e-mapSelectedShape mapShape"),_isSVG?(f.setAttribute("fill",i.shapeSettings.selectionColor),f.setAttribute("stroke",i.shapeSettings.selectionStroke),f.setAttribute("stroke-width",i.shapeSettings.selectionStrokeWidth/h._scale)):(f.fillcolor=i.shapeSettings.selectionColor,f.strokecolor=i.shapeSettings.selectionStroke,f.strokeweight=i.shapeSettings.selectionStrokeWidth/h._scale),i._prevSelectedShapes.push(f),i.selectedItems.push(n.data.Param1)):(f.setAttribute("class","mapShape"),f.setAttribute("fill",f.getAttribute("nodeValue")),f.setAttribute("stroke",i.shapeSettings.stroke),f.setAttribute("stroke-width",i.shapeSettings.strokeThickness/this._scale),c=i._prevSelectedShapes.indexOf(f),i._prevSelectedShapes.splice(c,1),i.selectedItems.splice(c,1));else{for(e=0;e<i._prevSelectedLegends.length;e++)i._prevSelectedLegends[e][0].setAttribute("class","mapShape"),i._prevSelectedLegends[e].css("background-color",i._prevSelectedLegends[e][0].getAttribute("nodeValue"));for(o!=null&&o.length>0&&(o[0].legend[0].setAttribute("class","e-mapSelectedShape mapShape"),o[0].legend.css("background-color",i.shapeSettings.selectionColor),i._prevSelectedLegends.push(o[0].legend)),e=0;e<i._prevSelectedShapes.length;e++)i._prevSelectedShapes[e].setAttribute("class","mapShape"),_isSVG?(i._prevSelectedShapes[e].setAttribute("fill",i._prevSelectedShapes[e].getAttribute("nodeValue")),i._prevSelectedShapes[e].setAttribute("stroke",i.shapeSettings.stroke),i._prevSelectedShapes[e].setAttribute("stroke-width",i.shapeSettings.strokeThickness/this._scale)):(i.fillcolor=i._prevSelectedShapes[e].getAttribute("nodeValue"),i.strokecolor=i.shapeSettings.stroke,i.strokeweight=i.shapeSettings.strokeThickness/this._scale);if(s!=null)if(l=document.getElementsByClassName("e-map-labelContainer"),t.inArray(s,i._prevSelectedTemp)==-1){for(e=0;e<i._prevSelectedTemp.length;e++)t(i._prevSelectedTemp[e]).css("background-color","");i._prevSelectedTemp=[];t(s).css("background-color",i.shapeSettings.selectionColor);t(s).css("width",l[0].clientWidth);i._prevSelectedTemp.push(s)}else{for(e=0;e<i._prevSelectedTemp.length;e++)t(i._prevSelectedTemp[e]).css("background-color","");i._prevSelectedTemp=[]}this._isPinching||t.inArray(f,i._prevSelectedShapes)!=-1?(i._prevSelectedShapes=[],i.selectedItems=[]):(f.setAttribute("class","e-mapSelectedShape mapShape"),i._prevSelectedShapes=[],i.selectedItems=[],_isSVG?(f.setAttribute("fill",i.shapeSettings.selectionColor),f.setAttribute("stroke",i.shapeSettings.selectionStroke),f.setAttribute("stroke-width",i.shapeSettings.selectionStrokeWidth/h._scale)):(f.fillcolor=i.shapeSettings.selectionColor,f.strokecolor=i.shapeSettings.selectionStroke,f.strokeweight=i.shapeSettings.selectionStrokeWidth/h._scale),i._prevSelectedShapes.push(f),i.selectedItems.push(n.data.Param1))}h._trigger("shapeSelected",{originalEvent:i.selectedItems})}},_updateSelection:function(n,t,i){n.enableSelection&&(n.selectionMode!=r.datavisualization.Map.SelectionMode.Multiple&&(n._prevSelectedShapes.pop(),n.selectedItems.pop()),n._prevSelectedShapes.push(t),n.selectedItems.push(i))},_zoomOnSelection:function(n){var u,t,i,r;_isSVG||(n.x=n.x-this._baseTranslatePoint.x/2-n.width/2,n.y=n.y-this._baseTranslatePoint.y/2-n.height/2);t=n.width;i=n.height;u=(this._width-100)/(this._height-100)>t/i?(this._height-100)/i:(this._width-100)/t;this._prevScale=this._scale;this._scale=u;this._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y};this.model.zoomSettings.level=this._scale-this._baseScale+1;this._zoomLevel(this._scale-this._baseScale+1);r=this._zoomLevel();r>this._minZoom()&&r<this._maxZoom()||(this.model.zoomSettings.level=r>(this._maxZoom()-this._minZoom())/2+this._minZoom()?this._maxZoom():this._minZoom(),this._zoomLevel(this.model.zoomSettings.level),this._scale=this._zoomLevel()+this._baseScale-1);var f=this._width/2-t*this._scale/2,e=f/this._scale,o=this._height/2-i*this._scale/2,s=o/this._scale;this._translatePoint.x=-n.x+e;this._translatePoint.y=-n.y+s;this.enableAnimation()&&!this._isTileMap?this._animate(1200):(this._applyTransform(this._scale,this._translatePoint),this._updateSliderValue())},_polyMoveFunction:function(n){var y=n.data.Param1,it=this.isTouch?this.isTouch(n):!1,k,e,s,nt,tt,v;if((!it&&n.type.toString().indexOf("move")>-1||this.touchEnd)&&(this.touchEnd=!1,this.model!=null)){var o=this.model.layers[this.baseMapIndex()],i=y._tooltipElement,d=y.tooltipTemplate,g=n.data.Param2,u=y._tooltipSize,f=t(this._mapContainer).offset();f==null&&(f={left:0,top:0,width:0,height:0});v=o.legendSettings.dockOnMap&&o.legendSettings.dockPosition=="right"?this._width+o.legendSettings.width+20+o.legendSettings.leftLabel.length*10+o.legendSettings.rightLabel.length*10:this._width;var h=this._height,c=v,l=this.getEventXY(n),p=l.X-f.left,w=l.Y-f.top,a=l.X,b=l.Y;if(i!=null&&d!=null&&g.hasOwnProperty("data")&&n.data.Param1.showTooltip){if(t(i).css({display:"block"}),k=this.model.locale,e=t.extend({},g.data),k&&this.model.enableGroupSeparator)for(s in e)e[s]=isNaN(parseFloat(e[s]))?e[s]:parseFloat(e[s]).toLocaleString(k);nt=t("#"+d).render(e);t(i).html(nt);tt=i[0]!=null?i[0].clientHeight:i.clientHeight;v=i[0]!=null?i[0].clientWidth:i.clientWidth;u={height:tt,width:v};r.util.isNullOrUndefined(this.touchTimeOut)||window.clearTimeout(this.touchTimeOut);u.width+p>=c&&(a-u.width>f.left?a=f.left+c-(c-p)-u.width:a-=u.width+p-c);u.height>h?h+u.height>this._height+w&&(b-=f.top+10):u.height+w>=h&&(b-=u.height+w-h);t(i).css({left:a+10,top:b+10})}}},_polyLeaveFunction:function(n){var u=n.data.Param1,h=this.isTouch(n),e=n.data.map,o=n.data.Param2.shape,s=u._tooltipElement,f=u._prevSelectedShapes;if(f.length>0)for(o.setAttribute("class","mapShape"),i=0;i<f.length;i++)f[i].setAttribute("class","e-mapSelectedShape mapShape");else o.setAttribute("class","mapShape");s==null||h||t(s).css("display","none");u.legendSettings!=null&&u.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&u._interactiveArrow!=null&&t(u._interactiveArrow).css("display","none");u._clearShapeWidth(e._scale);e._trigger("mouseleave",{originalEvent:n.data.Param2})},_wireEvents:function(){function o(i){n.enableAnimation()&&t(n._rootgroup).stop(!0,!1);i.preventDefault(i);n._zooming(-40*i.detail,i)}var e=jQuery.uaMatch(navigator.userAgent),i=e.browser.toLowerCase(),f,n,u;this._on(t(this._mapContainer),r.eventType.mouseDown,this._mouseButtonDown);t(document).keydown({className:"home",map:this},this._keyboardKeysPressed);this._on(t(this._mapContainer),r.eventType.mouseMove,this._mouseMove);this._on(t(document),r.eventType.mouseUp,this._mouseUp);f=!!navigator.userAgent.match(/Trident\/7\./);f&&(i="msie");window.navigator.msPointerEnabled?(this._on(t(this._mapContainer),"MSPointerUp",this._mouseButtonUp),t(this._mapContainer).css("-ms-touch-action","none")):this._on(t(this._mapContainer),"mouseup",this._mouseButtonUp);n=this;this._browser=i;i!="mozilla"?this._on(t(this._mapContainer),"mousewheel",this._mouseWheel):(u=this._svgDocument,u.addEventListener&&u.addEventListener("DOMMouseScroll",o,!1));this._on(t(this._mapContainer),"dblclick",this._doubleClick);(this.model.enableResize||this.model.isResponsive)&&(r.isTouchDevice()?this._on(t(window),"orientationchange",this._mapResize):this._on(t(window),"resize",this._mapResize))},clip:function(n,t,i){return Math.min(Math.max(n,t),i)},pointToLatLong:function(n,t){var i=this,u=i._getFactor(),f=n/i._scale-i._translatePoint.x,e=t/i._scale-i._translatePoint.y,r=Math.min(i._height,i._width)*u,o=i.clip(f,0,r-1)/r-.5,s=.5-i.clip(e,0,r-1)/r;return latitude=90-360*Math.atan(Math.exp(-s*2*Math.PI))/Math.PI,longitude=360*o,{latitude:latitude,longitude:longitude}},_mapResize:function(n){n.preventDefault();n.stopPropagation();var i={width:this._width,height:this._height},r=this._translatePoint,t=this;this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){var n=t.pointToLatLong(t._width/2,t._height/2);t.refresh();t._isTileMap||t.navigateTo(n.latitude,n.longitude,t._zoomLevel(),!1)},500)},_isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},_unWireEvents:function(){var u=jQuery.uaMatch(navigator.userAgent),n=u.browser.toLowerCase(),i;this._on(t(document),r.eventType.mouseUp,this._mouseUp);i=!!navigator.userAgent.match(/Trident\/7\./);i&&(n="msie");n!="mozilla"&&this._off(t(this._mapContainer),"mousewheel",this._mouseWheel);window.navigator.msPointerEnabled?(this._off(t(this._mapContainer),"MSPointerDown",this._mouseButtonDown),this._off(t(this._mapContainer),"MSPointerMove",this._mouseMove),this._off(t(this._mapContainer),"MSPointerUp",this._mouseButtonUp),t(this._mapContainer).css("-ms-touch-action","none")):n=="webkit"||n=="chrome"||n=="mozilla"?(this._off(t(this._mapContainer),"mousedown",this._mouseButtonDown),this._off(t(this._mapContainer),"mousemove",this._mouseMove),this._off(t(this._mapContainer),"mouseup",this._mouseButtonUp)):(this._off(t(this._mapContainer),"mousedown",this._mouseButtonDown),this._off(t(this._mapContainer),"mousemove",this._mouseMove),this._off(t(this._mapContainer),"mouseup",this._mouseButtonUp));this._off(t(this._mapContainer),"dblclick",this._doubleClick)},navigateTo:function(n,t,i,r){var e,f,o,s;r==u&&(r=this.enableAnimation());i=parseFloat(i);i==u&&(i=this._zoomLevel());i>this._minZoom()&&i<this._maxZoom()?(this.model.zoomSettings.level=i,this._zoomLevel(i)):(this.model.zoomSettings.level=i>(this._maxZoom()-this._minZoom())/2+this._minZoom()?this._maxZoom():this._minZoom(),this._zoomLevel(this.model.zoomSettings.level));e=this._getFactor();f=this._convertTileLatLongtoPointForShapes(n,t,this._mapBounds,e);this._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y};this._prevScale=this._scale;this._scale=this._baseScale+(i-1)*this._zoomFactor();o=(this._containerWidth+this._baseTranslatePoint.x)/2/this._scale;s=(this._containerHeight+this._baseTranslatePoint.y)/2/this._scale;this._translatePoint.x=-f.x+o;this._translatePoint.y=-f.y+s;r&&!this._isTileMap?this._animate(1200):this._applyTransform(this._scale,this._translatePoint);this._updateSliderValue();this._refrshLayers()},selectShape:function(n,t,i){var e,f,u;if(n!=null)for(t==null&&(t=this.model.layers[this.baseMapIndex()]),u=0;u<t._mapShapes.length;u++)if(e=t._mapShapes[u].data,f=t._mapShapes[u].shape,e!=null&&n==this._reflection(e,t.shapeSettings.valuePath)){if(t._prevSelectedShapes.length!=0&&t.selectionMode!=r.datavisualization.Map.SelectionMode.Multiple)for(u=0;u<t._prevSelectedShapes.length;u++)_isSVG?(t._prevSelectedShapes[u].setAttribute("fill",t._prevSelectedShapes[u].getAttribute("nodeValue")),t._prevSelectedShapes[u].setAttribute("stroke",t.shapeSettings.stroke),t._prevSelectedShapes[u].setAttribute("stroke-width",t.shapeSettings.strokeThickness/this._scale)):(t._prevSelectedShapes[u].fillcolor=t._prevSelectedShapes[u].style.behavior,t._prevSelectedShapes[u].strokecolor=t.shapeSettings.stroke,t._prevSelectedShapes[u].strokeweight=t.shapeSettings.strokeThickness/this._scale);t.enableSelection&&(_isSVG?(t.shapeSettings.selectionColor!="none"&&f.setAttribute("fill",t.shapeSettings.selectionColor),f.setAttribute("stroke",t.shapeSettings.selectionStroke),f.setAttribute("stroke-width",t.shapeSettings.selectionStrokeWidth/this._scale)):(t.shapeSettings.selectionColor!="none"&&(f.fillcolor=t.shapeSettings.selectionColor),f.strokecolor=t.shapeSettings.selectionStroke,f.strokeweight=t.shapeSettings.selectionStrokeWidth/this._scale),this._updateSelection(t,f,n),t._contains(t.selectedItems,t._mapShapes[u])||t.selectedItems.push(t._mapShapes[u]),this._trigger("shapeSelected",{originalEvent:t.selectedItems}));i&&this.model.zoomSettings.enableZoomOnSelection&&this._zoomOnSelection(f.getBBox());u=t._mapShapes.length}},_getIntersectedElements:function(n,i){var r,u;if(n.width+=5,n.height+=5,_isSVG&&this._browser!="mozilla"&&this._browser!="webkit")return r=this._svgDocument.createSVGRect(),r.x=n.left,r.y=n.top,r.width=n.width,r.height=n.height,this._svgDocument.getIntersectionList(r,null);var o=[],s=t(this._mapContainer).offset(),h=s.left,c=s.top;for(u=0;u<i.length;u++){var f=i[u].shape,e=f.getBoundingClientRect(),l=t(f).offset().left-h,a=t(f).offset().top-c;if(this._isIntersect(n,{left:l,top:a,height:e.bottom-e.top,width:e.right-e.left}))return o.push(f),o}return o},_isIntersect:function(n,t){return n.left>=t.left+t.width||n.left+n.width<=t.left||n.top>=t.top+t.height||n.top+n.height<=t.top?!1:!0},pan:function(t){var i=this,r=0,u=0,f,e,o,s;if(this._zoomLevel()!=1){switch(t){case"right":r=this._width/7;u=0;break;case"top":r=0;u=-(this._height/7);break;case"left":r=-(this._width/7);u=0;break;case"bottom":r=0;u=this._height/7}i.enablePan()&&(this._isTileMap&&(f=this._tileTranslatePoint.x-r/i._scale,e=this._tileTranslatePoint.y-u/i._scale,this._tileTranslatePoint.x=f,this._tileTranslatePoint.y=e,this._generateTiles(this._zoomLevel())),o=i._translatePoint.x-r/i._scale,i._prevScale=i._scale,s=i._translatePoint.y-u/i._scale,i._prevPoint={x:this._translatePoint.x,y:this._translatePoint.y},this._translatePoint.x=o,this._translatePoint.y=s,i.enableAnimation()&&!this._isTileMap?i._animate(600):i._applyTransform(i._scale,i._translatePoint),i._refrshLayers())}},zoom:function(n,t){var i=this,r=i._zoomLevel(),f;n<=this._maxZoom()&&n>=this._minZoom()?(this._isTileMap?(this._tileZoom(i._zoomLevel(),n,{x:this._width/2,y:this._height/2}),r=i._zoomLevel(),i.model.zoomSettings.level=n,i._zoomLevel(n),this._generateTiles(this._zoomLevel()),i._translatePoint.x=(i._tileTranslatePoint.x-.5*Math.pow(2,r))/Math.pow(2,r),i._translatePoint.y=(i._tileTranslatePoint.y-.5*Math.pow(2,r))/Math.pow(2,r),i._scale=Math.pow(2,r)):(f=i._baseScale+(n-1)*i._zoomFactor(),i._prevPoint={x:i._translatePoint.x,y:i._translatePoint.y},i._prevScale=i._scale,i._translatePoint.x-=(i._width/i._scale-i._width/f)/2,i._translatePoint.y-=(i._height/i._scale-i._height/f)/2,i._scale=f,i.model.zoomSettings.level=n,i._zoomLevel(n),(i.enableAnimation()&&t||t==u)&&i._animate(600)),i.enableAnimation()&&t||(i._applyTransform(i._scale,i._translatePoint),i._refrshLayers(),i._resizeShape()),i._updateSliderValue()):n<=this._minZoom()?(this.model.zoomSettings.level=this._minZoom(),this._zoomLevel(this._minZoom()),this.zoom(this._zoomLevel())):n>=this._maxZoom()&&(this.model.zoomSettings.level=this._maxZoom(),this._zoomLevel(this._maxZoom()),this.zoom(this._zoomLevel()));r<n?i._trigger("zoomedIn",{originalEvent:null,zoomLevel:i._zoomLevel()}):r>n&&i._trigger("zoomedOut",{originalEvent:null,zoomLevel:i._zoomLevel()})},refresh:function(){var n,i;this._unWireEvents();t(this._svgDocument).empty();this._svgDocument!=null&&(this._svgDocument=null);t(this._mapContainer).empty();this._scale=1;this._margintop=0;this._marginleft=0;this._translatePoint={x:0,y:0};this._height=this._mapContainer.height();this._width=this._mapContainer.width();this._height==0&&(this._height=this._mapContainer[0].parentElement.clientHeight!=0?this._mapContainer[0].parentElement.clientHeight:t(document).height());this._width==0&&(this._width=this._mapContainer[0].parentElement.clientWidth!=0?this._mapContainer[0].parentElement.clientWidth:t(document).width());this.baseMapIndex()>=this.model.layers.length&&this.baseMapIndex(0);n=this.model.layers[this.baseMapIndex()];n.legendSettings!=null&&n.legendSettings.showLegend&&n.shapeSettings.colorMappings!=null&&n._sizeCalculation(this);this._generatePath();this._groupSize!=null&&(this._isMapCoordinates?(this._containerHeight=this._groupSize.maxY-this._groupSize.minY,this._containerWidth=this._groupSize.maxX-this._groupSize.minX,this._groupBorder={x:this._groupSize.minX,y:this._groupSize.minY}):(i=this._getFactor(),this._containerHeight=Math.abs((this._groupSize.maxY-this._groupSize.minY)*i),this._containerWidth=Math.abs((this._groupSize.maxX-this._groupSize.minX)*i)));n.layerType=="geometry"&&t(this._svgDocument).css("background",this.model.background);this._resizingContainer();this._renderMapElements();n.legendSettings!=null&&n.legendSettings.showLegend&&n.shapeSettings.colorMappings!=null&&this._renderLegend();_isSVG&&t(this._svgDocument).css({height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft});this.model.enableLayerChangeAnimation&&t(this._mapContainer).animate({opacity:1},500);this.model.centerPosition==null||this._isTileMap||this.navigateTo(this.model.centerPosition[0],this.model.centerPosition[1],this._zoomLevel(),!1);this._legendContainer!=null&&this._legendContainer.css({height:this._legendSize.height});this._trigger("refreshed")},_updateSliderValue:function(n){var t=this._sliderControl,i;n==u&&(n=this.enableAnimation());t!=null&&(i=t.data("ejSlider"),i.option("value",this._zoomLevel()))},_createDivElement:function(n,t,i,u){var f=n,e=t;e.appendTo(f);f.appendTo(i);this._on(e,r.eventType.mouseDown,{className:u,map:this},this._navigationControlPressed)},_navigationControlPressed:function(n){n.stopPropagation();this._isNavigationPressed=!0;var t=n.data.map,i=t.enableAnimation();n.data.className=="zoomIn"?(t.zoom(t._zoomLevel()+1,!0),i||t._updateSliderValue(),t._refrshLayers()):n.data.className=="zoomOut"?(t.zoom(t._zoomLevel()-1,!0),i||t._updateSliderValue()):n.data.className=="panLeft"?t.pan("left"):n.data.className=="panRight"?t.pan("right"):n.data.className=="panTop"?t.pan("top"):n.data.className=="panBottom"?t.pan("bottom"):n.data.className=="home"&&(t.zoom(1,!0),i||t._updateSliderValue())},_keyboardKeysPressed:function(n){this._iskeyboardKeysPressed=!0;var t=n.data.map,i=t.enableAnimation();n.ctrlKey&&n.keyCode==38?t._zoomingIn(t._width/2,t._height/2,n,i):n.ctrlKey&&n.keyCode==40?t._zoomingOut(t._width/2,t._height/2,n,i):n.keyCode==37?t.pan("left"):n.keyCode==39?t.pan("right"):n.keyCode==38?t.pan("top"):n.keyCode==40&&t.pan("bottom")},refreshNavigationControl:function(n){function g(n){o!=null&&o._isRendered&&o._zoomLevel()!=n.value&&o.zoom(n.value,!1)}function nt(n){o!=null&&o._isRendered&&o._zoomLevel()!=n.value&&o.zoom(n.value,!1)}var f=this.model.layers[this.baseMapIndex()],b=this._mapContainer.find("#ejNavigation"),e,l,s,a,h,v,o,p,w,i;if(b.length>0&&this._mapContainer[0].removeChild(b[0]),this.model.navigationControl!=null&&this.model.navigationControl.enableNavigation){n==u&&(n=this.model.navigationControl);var y=r.datavisualization.Map.LabelOrientation.Vertical,c,k=120,d=12;c={width:90,height:320};e=t("<div id='ejNavigation' class='e-map-navigation e-orientation-vert'/>");(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(l=t("<div style='height:120px;width:10px;margin-top:-197px;margin-left: 34px;' />"));n.orientation=="horizontal"&&(y=r.datavisualization.Map.LabelOrientation.Horizontal,k=12,d=120,c={width:320,height:90},e=t("<div id='ejNavigation' class='e-map-navigation e-orientation-horz' />"),(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(l=t("<div style='height:10px;width:120px;margin-top:-18px' />")));(this.model.navigationControl.content==null||this.model.navigationControl.content=="")&&(s=t("<div class='e-panContainer'/>"),a=y=="horizontal"?"Horz":"Vert",n.orientation=="horizontal"?(h=t("<div style='margin-left: 94px;' />"),v=t("<div style='margin-left: 137px;'/>")):(h=t("<div />"),v=t("<div style='margin-top: 34px;'/>")),s.appendTo(e),h.appendTo(e),l.appendTo(v),v.appendTo(e),this._sliderControl=l,i={x:0,y:0},n.dockPosition==null||n.dockPosition==r.datavisualization.Map.Position.None?(i.x=this._width*n.absolutePosition.x/100,i.y=this._height*n.absolutePosition.y/100):i=this._getPosition(n.dockPosition,c),e.css({"margin-left":i.x+"px","margin-top":i.y+"px"}));o=this;p=this._height*.0025;navigationStyle=this.model.navigationControl.content==null||this.model.navigationControl.content==""?this._browser!="chrome"&&this._browser!="msie"?t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;zoom:"+p+";}<\/style>"):t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;-moz-transform: scale("+p+");}<\/style>"):this._browser!="mozilla"&&this._browser!="chrome"?t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;}<\/style>"):t("<style> .e-map-navigation {width: 90px;height: 320px;position:absolute;z-index:2;}<\/style>");this._browser!="mozilla"&&this._browser!="chrome"?(navigationStyle.remove(),t("html > head").append(navigationStyle)):t("html > head").append(navigationStyle);this.model.navigationControl.content==null||this.model.navigationControl.content==""?(t(l).ejSlider({orientation:y,sliderType:r.SliderType.MinRange,value:1,animationSpeed:1200,minValue:this._minZoom(),showTooltip:!0,enableAnimation:!1,maxValue:this._maxZoom(),incrementStep:this._zoomFactor(),slide:nt,change:g,height:k,width:d}),e.appendTo(this._mapContainer),n.orientation=="horizontal"?(this._createDivElement(t("<div title='"+this._localizedLabels.zoomIn+"' class='e-icon1 e-incrementButton  icon_margin1' />"),t("<div class='e-icon1 nav-inc-"+a+"  e-innerIncrement'/>"),h,"zoomIn"),this._createDivElement(t("<div title='"+this._localizedLabels.zoomOut+"' class='e-icon1 e-incrementButton icon_margin2'/>"),t("<div class='e-icon1 nav-dec-"+a+" e-innerDecrement'/>"),h,"zoomOut")):(this._createDivElement(t("<div title='"+this._localizedLabels.zoomIn+"' class='e-icon1 e-incrementButton  icon_margin1' />"),t("<div class='e-icon1 nav-inc-"+a+"  e-innerIncrement'/>"),h,"zoomIn"),this._createDivElement(t("<div title='"+this._localizedLabels.zoomOut+"' class='e-icon1 e-incrementButton icon_margin2'/>"),t("<div class='e-icon1 nav-dec-"+a+" e-innerDecrement'/>"),h,"zoomOut")),this._createDivElement(t("<div title='"+this._localizedLabels.panTop+"' class='e-icon1 e-radialTop'/>"),t("<div class='e-icon1 e-arrowUp'/>"),s,"panTop"),this._createDivElement(t("<div title='"+this._localizedLabels.panLeft+"' class='e-icon1 e-radialLeft'/>"),t("<div class='e-icon1 e-arrowLeft'/>"),s,"panLeft"),this._createDivElement(t("<div title='"+this._localizedLabels.panRight+"' class='e-icon1 e-radialRight'/>"),t("<div class='e-icon1 e-arrowRight'/>"),s,"panRight"),this._createDivElement(t("<div title='"+this._localizedLabels.panBottom+"' class='e-icon1 e-radialBottom'/>"),t("<div class='e-icon1 e-arrowDown'/>"),s,"panBottom"),w=t("<div title='"+this._localizedLabels.home+"' class='e-icon1 e-home-bg'><div class='e-icon1 e-map-home'><\/div>"),w.appendTo(s),w.mousedown({className:"home",map:this},this._navigationControlPressed)):(this.navigationControlData==null?(this.navigationControlData=t("#"+this.model.navigationControl.content),this.navigationControlData.css({display:"block"}),this.navigationControlData.appendTo(e)):this.navigationControlData.appendTo(e),e.appendTo(this._mapContainer),c={width:this.navigationControlData[0].getBoundingClientRect().right-this.navigationControlData[0].getBoundingClientRect().left,height:this.navigationControlData[0].getBoundingClientRect().bottom-this.navigationControlData[0].getBoundingClientRect().top},i={x:0,y:0},n.dockPosition==null||n.dockPosition==r.datavisualization.Map.Position.None?(i.x=this._width*n.absolutePosition.x/100,i.y=this._height*n.absolutePosition.y/100):i=this._getPosition(n.dockPosition,c),f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?e.css({"margin-left":i.x+"px","margin-top":i.y+f.legendSettings.height+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?e.css({"margin-left":i.x+f.legendSettings.width+20+f.legendSettings.leftLabel.length*10+f.legendSettings.rightLabel.length*10+"px","margin-top":i.y+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Default?e.css({"margin-left":i.x+"px","margin-top":i.y+f.legendSettings.height+"px"}):f.legendSettings.dockOnMap&&f.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&f.legendSettings.mode==r.datavisualization.Map.LegendMode.Default?e.css({"margin-left":i.x+f.legendSettings.width+"px","margin-top":i.y+"px"}):e.css({"margin-left":i.x+"px","margin-top":i.y+"px"}))}},_getPosition:function(n,t){var i={x:0,y:0};switch(n){case r.datavisualization.Map.Position.TopCenter:i.x=this._width/2-t.width/2;break;case r.datavisualization.Map.Position.TopRight:i.x=this._width-t.width;break;case r.datavisualization.Map.Position.CenterLeft:i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.Center:i.x=this._width/2-t.width/2;i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.CenterRight:i.x=this._width-t.width;i.y=this._height/2-t.height/2;break;case r.datavisualization.Map.Position.BottomLeft:i.y=this._height-t.height;break;case r.datavisualization.Map.Position.BottomCenter:i.x=this._width/2-t.width/2;i.y=this._height-t.height;break;case r.datavisualization.Map.Position.BottomRight:i.x=this._width-t.width;i.y=this._height-t.height}return i},_renderMapElements:function(){this._templateDiv=t("<div class='TemplateDiv'/>");this._templateDiv.appendTo(this._mapContainer);this._templateDiv.css({"pointer-events":"none",overflow:"hidden",position:"absolute","z-index":"1",height:this._height,width:this._width});this._wireEvents();this.refreshLayers();this.refreshNavigationControl(this.model.navigationControl)},_renderLegend:function(){var n=this.model.layers[this.baseMapIndex()],f,i;this._scrollLegendDiv=t("<div class='ScrollLegendDiv'/>");this._scrollLegendDiv.appendTo(this._mapContainer);this._legendContainer=t("<div id='LegendcontainerDiv'/>");this._legendContainer.appendTo(this._scrollLegendDiv);this._legendDiv=t("<div class='LegendDiv'/>");this._legendDiv.css({height:this._legendDivHeight+"px",width:this._legendDivWidth+"px"});this._isNavigationPressed=!0;this._legendDiv.appendTo(this._legendContainer);this._legendDiv[0].getBoundingClientRect();this._legendContainer.css({position:"relative"});this._scrollLegendDiv.ejScroller({height:Math.round(this._legendSize.height),width:Math.round(this._legendSize.width)});n.legendSettings.labelOrientation==u&&n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Vertical;n.legendSettings.dockOnMap?(n.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?(pos="none",height=n.legendSettings.height+50,width=n.legendSettings.width+20+n.legendSettings.leftLabel.length*10+n.legendSettings.rightLabel.length*10):(pos="auto",height=n.legendSettings.height,width=n.legendSettings.width),this._scrollLegendDiv.css({position:"absolute","z-index":"2",height:this._legendSize.height,width:this._legendSize.width}),(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Center?this._scrollLegendDiv.css({"margin-left":this._width/2-this._legendSize.width/2}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Far?this._scrollLegendDiv.css({"margin-left":this._width-this._legendSize.width}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Center?this._scrollLegendDiv.css({"margin-top":this._height/2-this._legendSize.height/2}):(n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left||n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right)&&n.legendSettings.alignment==r.datavisualization.Map.Alignment.Far&&this._scrollLegendDiv.css({"margin-top":this._height-this._legendSize.height}),n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom?this._scrollLegendDiv.css({"margin-top":this._height}):n.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right&&this._scrollLegendDiv.css({"margin-left":this._width})):(n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Horizontal||n.legendSettings.labelOrientation==r.datavisualization.Map.LabelOrientation.Vertical)&&(f=n.legendSettings.position==u?"topleft":n.legendSettings.position,i=this._getPosition(f,this._legendSize),this._scrollLegendDiv.css({position:"absolute","z-index":"2","margin-left":i.x+"px","margin-top":i.y}));this.refreshLayers();this.refreshNavigationControl(this.model.navigationControl)},_renderMapLayers:function(){var u,i,o,e,n,s;for(t(this._templateDiv).empty(),u=0,i=this.model.layers[this.baseMapIndex()],i.layerType==r.datavisualization.Map.LayerType.Geometry?(this._renderLayers(i,u),i.shapeData!=null&&(u=i._polygonData.length)):(i._initializeLocalValues(),o=t("<div class='map-contribution'>"),o[0].innerHTML=i.contribution,this._mapContainer.append(o)),e=0;e<this.model.layers[this.baseMapIndex()].subLayers.length;e++)n=this.model.layers[this.baseMapIndex()].subLayers[e],n._isBaseLayer=!1,n.layerType==r.datavisualization.Map.LayerType.Geometry&&n.shapeData!=null?(r.util.isNullOrUndefined(n._initializeLocalValues)&&(s=new f,t.extend(s,n),t.extend(n,s)),this._renderLayers(n,u),u+=n._polygonData.length):n._initializeLocalValues();this.refreshMarkers();_isSVG&&this.enableAnimation()&&!this._isTileMap?this._refreshWithAnimation():this._refrshLayers()},refreshLayers:function(){var n=this.model.layers[this.baseMapIndex()];this._processOData(n,this);this.shapeSelectionOnResize()},_processOData:function(n,t){if(n.dataSource!=null)if(n.dataSource instanceof r.DataManager){var i=n.dataSource.executeQuery(n.query);i.done(function(i){i.result!=null&&(n.dataSource=i.result,t._renderMapLayers())})}else t._renderMapLayers();else t._renderMapLayers()}});var e=function(n,t){this.X=n;this.Y=t;this.left=0;this.top=0;this.height=256;this.width=256;this.src=null},f=function(){this.enableSelection=!0;this.selectionMode="default";this.bingMapType="aerial";this.key="";this.selectedItems=[];this.enableMouseHover=!1;this.shapeData=null;this.markers=[];this.dataSource=null;this.urlTemplate="http://a.tile.openstreetmap.org/level/tileX/tileY.png";this.showTooltip=!1;this.tooltipTemplate=null;this.mapItemsTemplate=null;this.enableAnimation=!1;this.legendSettings={showLegend:!1,showLabels:!1,rowSpacing:10,columnSpacing:10,position:"topleft",positionX:0,positionY:0,height:0,width:0,iconHeight:20,iconWidth:20,type:"layers",mode:"default",title:null,leftLabel:null,rightLabel:null,icon:"rectangle",dockOnMap:!1,dockPosition:"top",labelOrientation:"vertical",alignment:"bottom",columnCount:0};this.labelSettings={showLabels:!1,labelPath:"",enableSmartLabel:!1,smartLabelSize:"fixed",labelLength:2};this.markerTemplate=null;this.showMapItems=!1;this.layerType="geometry";this.geometryType="geographic";this._colorPaletteSettings={Palette1:{highlightColor:"#F7CD1C",highlightStroke:"white",SelectionColor:"#F96C0D",SelectionStroke:"white"},Palette2:{highlightColor:"#68A3EA",highlightStroke:"White",SelectionColor:"#116EF4",SelectionStroke:"White"},Palette3:{highlightColor:"#CCCCCC",highlightStroke:"white",SelectionColor:"#4D4D4D",SelectionStroke:"white"}};this.colorPalettes={Palette1:["#4A3825","#736F3D","#F2DABD","#BF9D7E","#7F6039","#7F715F","#70845D","#CC995C","#736F3D","#89541B"],Palette2:["#E51400","#730202","#EF6535","#C63477","#BF004D","#F0A30B","#CE1B1B","#97993D","#D6BF38","#835A2C"],Palette3:["#A4C400","#008B00","#1BA0E2","#0050EF","#AA00FF","#D90073","#E51400","#F96800","#E3C800","#A20026"]};this._prevPaletteIndex=0;this._newBounds=[];this.subLayers=[];this.shapeSettings={highlightColor:"gray",highlightBorderWidth:1,selectionColor:"gray",fill:"#E5E5E5",radius:5,strokeThickness:"0.2",stroke:"#C1C1C1",colorPalette:"palette1",highlightStroke:"#C1C1C1",selectionStroke:"#C1C1C1",selectionStrokeWidth:1,colorValuePath:null,valuePath:null,enableGradient:!1,colorMappings:null,autoFill:!1};this.bubbleSettings={showBubble:!0,bubbleOpacity:"0.9",minValue:10,maxValue:20,color:"gray",colorValuePath:null,valuePath:null,colorMappings:null,showTooltip:!1,tooltipTemplate:null}};f.prototype={dataTypes:{dataSource:"data",markers:"array",subLayers:"array",shapeSettings:{colorMappings:"array"},bubbleSettings:{colorMappings:"array"}},_initializeLocalValues:function(){this._svgns="http://www.w3.org/2000/svg";this._bounds=[];this._bubbleCollection=[];this._prevSelectedShapes=[];this._prevSelectedTemp=[];this._prevSelectedLegends=[];this._isBaseLayer=!0;this._prevHoverdLegend=null;this._prevHoveredShape=null;this._labelCollection=[];this._scrollBar=null;this._mapShapes=[];this._bubbles=[];this._labelBounds=[];this._bubbleCount=0;this._mapItems=[];this._mapMarkers=[];this.selectedItems;this._tooltipSize={height:0,width:0};this._smartLabels=[];this._labelData=[];this._interactiveArrow=null;this._legendRects=[]},_generateMarkerForLayers:function(n){var h,c,e,f,i,o,u,s;for(this._mapMarkers=[],h=n._rootgroup.getBoundingClientRect().top,c=n._rootgroup.getBoundingClientRect().left,e=0;e<this.markers.length;e++)f=this.markers[e],this.markerTemplate!=null?(i=t(".markerTemplateDiv"),i=t("<div class='mapMarker' style='display:block;position:absolute;pointer-events: stroke;'><\/div>"),n._templateDiv.append(i),t(i).css({height:this._height,width:this._width,"margin-top":this._margintop,"margin-left":this._marginleft}),o=t("#"+this.markerTemplate).render(f),n.model.markerSelected==null&&t(i).css({"pointer-events":"none"}),t(i).html(o),n._on(t(i),r.eventType.mouseDown,{marker:t(i),data:f},n._markerPressed),this._mapMarkers.push(i)):(u=t(' <div class="mapMarker" style="display:block;position:absolute;pointer-events: stroke;"><label>'+f.label+"<\/label><\/div>"),_isSVG?n._templateDiv.append(u):u.appendTo(n._templateDiv),n.model.markerSelected==null&&t(u).css({"pointer-events":"none"}),n._on(t(u),r.eventType.mouseDown,{marker:t(u),data:f},n._markerPressed),this._mapMarkers.push(u)),s=this,s.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left&&(this._height=this._height,this._width=this._width-parseFloat(width),this._marginleft=parseFloat(width))},_contains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i]===t)return!0;return!1},_shapeContains:function(n,t){var i=n.length;if(i>0)while(i--)if(n[i].shapeIndex===t)return{isContains:!0,index:n.length-i};return{isContains:!1}},_labelSizeCalculation:function(n){var t=document.getElementsByClassName("e-map-labelContainer"),r=t[0].offsetHeight,i=t[0].offsetWidth;n._width=n._width-i;n._marginleft=i},_sizeCalculation:function(n){var u=this.shapeSettings.colorMappings,v=!1,i;if(this.shapeSettings.colorMappings!=null){u.rangeColorMapping!=null&&(u=u.rangeColorMapping,v=!0);u.equalColorMapping!=null&&(u=u.equalColorMapping);var o=0,c=0,h=this.legendSettings.rowSpacing,y=this.legendSettings.columnSpacing,p=this.legendSettings.iconWidth+5,a=this.legendSettings.iconHeight+5,k=a+h,f=this.legendSettings.iconHeight+h,e=0,t=this.legendSettings,l=this.legendSettings.columnCount;if(t.height==0&&t.width==0&&l==0){for(i=0;i<u.length;i++){var w=u[i].legendLabel!=null?u[i].legendLabel:v?u[i].from:u[i].value,b=this._calcWidth(w),s=p+b+y;t.dockOnMap&&(t.dockPosition==r.datavisualization.Map.DockPosition.Top||t.dockPosition==r.datavisualization.Map.DockPosition.Bottom)||!t.dockOnMap?n._width<o+s?(f=a+h+f,e=Math.max(e,o),o=s):o+=s+5:n._height<c+a+h?(e+=o,f=Math.max(f,c),o=s,c=0):(c+=a+h,o=Math.max(s,o))}t.dockOnMap&&(t.dockPosition==r.datavisualization.Map.DockPosition.Top||t.dockPosition==r.datavisualization.Map.DockPosition.Bottom)||!t.dockOnMap?(e=Math.max(e,o),f+=5):(e+=o+y,f=Math.max(f,c))}else l==0&&(f=t.height.toString().indexOf("%")!=-1?n._height/100*parseInt(t.height.toString().replace("%","")):t.height,e=t.width.toString().indexOf("%")!=-1?n._width/100*parseInt(t.width.replace("%","")):t.width);if(t.height==0&&t.width==0&&l!=0)for(i=0;i<u.length;i++){var w=u[i].legendLabel!=null?u[i].legendLabel:v?u[i].from:u[i].value,b=this._calcWidth(w),s=p+b+y;i%l!=0?(o+=s,i==l-1&&(e=Math.max(e,o))):(i!=0&&(f=p+h+f),e=Math.max(e,o),o=s)}}t.height!=0&&t.width!=0&&(f=t.height,e=t.width);n._legendSize={height:f,width:e};t.dockOnMap&&(t.mode==r.datavisualization.Map.LegendMode.Interactive&&(f=55),this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Bottom?(n._height=n._height-parseFloat(f),this.legendSettings.tempWidth=o):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Top?(n._height=n._height-parseFloat(f),n._margintop=parseFloat(f)):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Left?(n._width=n._width-e,n._marginleft=e):this.legendSettings.dockPosition==r.datavisualization.Map.DockPosition.Right&&(n._height=n._height,n._width=n._width-e))},_clearShapeWidth:function(n){var i,t;for(n==null&&(n=1),i=0;i<this._mapShapes.length;i++)t=this._mapShapes[i],this._contains(this._prevSelectedShapes,t.shape)||(_isSVG?(this.shapeSettings.colorMappings!=null||this.shapeSettings.autoFill?t.shape.setAttribute("fill",t.shape.getAttribute("nodeValue")):(t.shape.setAttribute("nodeValue",this.shapeSettings.fill),t.shape.setAttribute("fill",this.shapeSettings.fill)),t.shape.setAttribute("stroke-width",this.shapeSettings.strokeThickness/n),t.shape.setAttribute("stroke",this.shapeSettings.stroke)):(t.shape.fillcolor=t.shape.style.behavior,t.shape.strokeweight=this.shapeSettings.strokeThickness,t.shape.strokecolor=this.shapeSettings.stroke))},_shapeSelection:function(){for(var n,i,t=0;t<this._mapShapes.length;t++)n=this._mapShapes[t],i=this._shapeContains(this.selectedItems,n.shapeIndex),i.isContains&&(this._contains(this._prevSelectedShapes,n.shape)||this._prevSelectedShapes.push(n.shape),_isSVG?(n.shape.setAttribute("fill",this.shapeSettings.selectionColor),n.shape.setAttribute("stroke-width",this.shapeSettings.selectionStrokeWidth),n.shape.setAttribute("stroke",this.shapeSettings.selectionStroke)):(n.shape.fillcolor=this.shapeSettings.selectionColor,n.shape.strokeweight=this.shapeSettings.selectionStrokeWidth,n.shape.strokecolor=this.shapeSettings.selectionStroke))},_rgbToHex:function(n,t,i){return"#"+this._toHex(n)+this._toHex(t)+this._toHex(i)},_toHex:function(n){var t="0123456789ABCDEF";return(n=parseInt(n,10),isNaN(n))?"00":(n=Math.max(0,Math.min(n,255)),t.charAt((n-n%16)/16)+t.charAt(n%16))},_hexToR:function(n){return parseInt(this._cropHex(n).substring(0,2),16)},_hexToG:function(n){return parseInt(this._cropHex(n).substring(2,4),16)},_hexToB:function(n){return parseInt(this._cropHex(n).substring(4,6),16)},_cropHex:function(n){return n.charAt(0)=="#"?n.substring(1,7):n},_getRangeColorValues:function(n,t,i){var u=[],f,r;if(u.push(t),t>i)for(f=(t-i)/(n-1),r=n;r>2;r--)t=t-f,u.push(t);else for(f=(i-t)/(n-1),r=2;r<n;r++)t=t+f,u.push(t+f);return u.push(i),u},_generateGradientCollection:function(n){for(var f=[],r=n[0],u=n[n.length-1],e=this._hexToR(r),o=this._hexToG(r),s=this._hexToB(r),h=this._hexToR(u),c=this._hexToG(u),l=this._hexToB(u),i=10,a=this._getRangeColorValues(i,e,h),v=this._getRangeColorValues(i,o,c),y=this._getRangeColorValues(i,s,l),t=0;t<i;t++)f.push(this._rgbToHex(a[t],v[t],y[t]));return f},_calculateTextWidth:function(n){var i=t("<span>"+n+"<\/span>"),r;return t("body").append(i),r=i.width(),i.remove(),r},_trimFunction:function(n,i){for(var u=t("#spantag").text(n),r=n;u.width()>i;)r=r.slice(0,-2),u.text(r+"...");return r},_createLabel:function(n,i,r,u){var f=t("<div class="+u+"><\/div>");return f[0].innerHTML=n,f.css({"margin-left":i+"px","margin-top":r+"px",position:"absolute"}),f},_createInteractiveArrow:function(n,i){var r=t("<div class='e-icon1 e-interactiveArrow'><\/div>");return r[0].innerHTML="&#9650",r.css({"margin-left":n+"px","margin-top":i+"px",position:"absolute"}),r},_getEllipseLegend:function(n,i){var r=t("<div class='e-mapLegend'/>");return r.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","border-radius":this.legendSettings.iconHeight/2+"px",left:n+"px",top:i+"px",position:"absolute"}),r},_getRectLegend:function(n,i){var r=t("<div />");return r.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px",left:n+"px",top:i+"px",position:"absolute"}),r},_generateLegend:function(n){var l=!0,f=null,i;this.shapeSettings.colorMappings.rangeColorMapping!=u?f=this.shapeSettings.colorMappings.rangeColorMapping:this.shapeSettings.colorMappings.equalColorMapping!=u&&(f=this.shapeSettings.colorMappings.equalColorMapping,l=!1);var t=0,e=0,o=this.legendSettings,c=0,a,v,h=o.rowSpacing,y=o.columnSpacing,d=o.iconWidth+5,g=o.iconHeight+h,p=o.columnCount;for(i=0;i<f.length;i++){var w=f[i].legendLabel=f[i].legendLabel!=null?f[i].legendLabel:l?f[i].from:f[i].value,b=this._calcWidth(w),s=o.iconWidth+y+b,k=o.iconHeight;p!=0?i%p!=0?(this._drawLegend(f[i],t,e,n),t+=s+5):(i!=0&&(e+=o.iconHeight+h),t=0,this._drawLegend(f[i],t,e,n),t+=s+5):o.dockPosition==r.datavisualization.Map.DockPosition.Top||o.dockPosition==r.datavisualization.Map.DockPosition.Bottom?n._legendSize.width<t+s?(e+=o.iconHeight+h,t=0,this._drawLegend(f[i],t,e,n),t+=s):(this._drawLegend(f[i],t,e,n),t+=s):n._legendSize.height<e+o.iconHeight?(e=0,t+=c+y,this._drawLegend(f[i],t,e,n),c=0,e+=o.iconHeight+h):(this._drawLegend(f[i],t,e,n),c=Math.max(c,s),e+=o.iconHeight+h);a=n._legendDivHeight>e?n._legendDivHeight:e+k;v=n._legendDivWidth>t+s?n._legendDivWidth:t+s;n._legendDivWidth=v;n._legendDivHeight=a}},_drawLegend:function(n,i,u,f){var o,e;o=this.legendSettings.icon==r.datavisualization.Map.LegendIcons.Circle?this._getEllipseLegend(i,u):this._getRectLegend(i,u);i+=this.legendSettings.iconWidth+5;t(o).css("background-color",n.color);o.appendTo(f._legendDiv);e=t("<div class='e-defaultLegendLabel'/>");e.css({left:i+"px",top:u+"px",position:"absolute","text-overflow":"ellipsis","white-space":"nowrap",overflow:"hidden"});e[0].title=n.legendLabel;e[0].innerHTML=n.legendLabel;e.appendTo(f._legendDiv)},_generateLegends:function(n){var it=this.shapeSettings.colorMappings,rt,lt,ut,ft,a,c,k,o,v,d,st,at,ht,g,e,tt,s,yt,pt;if(it.rangeColorMapping!=null||it.equalColorMapping!=null){var gt=this.legendSettings,ni=this.legendSettings.iconWidth+5,bt=this.legendSettings.iconHeight+5,ti=this.legendSettings.rowSpacing,ii=this.legendSettings.columnSpacing,ri=this.legendSettings.iconHeight+this.legendSettings.rowSpacing,ui=bt+this.legendSettings.rowSpacing;if((this.legendSettings.showLegend==u||this.legendSettings.showLegend)&&!this.shapeSettings.autoFill){t(n._mapContainer).append(t('<div  id="labelTooltip" style="display:none;background-color:grey;padding-left:5px; padding-right:5px;position:absolute;z-index:1000;pointer-events:none;"/>'));var w=this,f=10,h=0,ui=this.iconHeight+this.legendSettings.rowSpacing,b=this.legendSettings.height,l=this.legendSettings.width,i=t("<div/>");if(w.legendSettings.dockOnMap?i=t(n._legendDiv):w.legendSettings.dockOnMap||w.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive?_isSVG?i.appendTo(n._templateDiv):n._templateDiv.append(i):i=t(n._legendDiv),(this.legendSettings.type==u||this.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&this.shapeSettings.colorMappings!=null&&(this.legendSettings.mode==u||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Default||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.shapeSettings.colorMappings.equalColorMapping!=null))this._generateLegend(n);else if((this.legendSettings.type==u||this.legendSettings.type==r.datavisualization.Map.LegendType.Layers)&&this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.shapeSettings.colorMappings!=null){if(s="",this.legendSettings.height==0&&(b=18),this.legendSettings.width==0&&(l=150),this.legendSettings.leftLabel==null&&(this.legendSettings.leftLabel=""),this.legendSettings.rightLabel==null&&(this.legendSettings.rightLabel=""),this.legendSettings.title!=null){if(rt=f,this.legendSettings.showLabels||(rt=f+this.legendSettings.leftLabel.length*10),lt=this.legendSettings.title.length*10,ut=titleText=this.legendSettings.title,lt>l)for(e=1;e<titleText.toString().length;e++)ut=titleText.toString().substring(0,e-1)+"...";s=this._createLabel(ut,rt,h,"e-interactivelegend-title");s[0].title=titleText;s.css({width:l+"px"});_isSVG?s.appendTo(i):i.append(s);h+=25}for(this.legendSettings.showLabels&&(h+=25),this.legendSettings.leftLabel==null||this.legendSettings.showLabels||(s=this._createLabel(this.legendSettings.leftLabel,f,h-3,"e-interactivelegend-leftlabel"),_isSVG?s.appendTo(i):i.append(s),f=f+this.legendSettings.leftLabel.length*10),ft=this._createInteractiveArrow(f,h+b),ft.appendTo(i),this._interactiveArrow=ft,a=null,!_isSVG&&this.shapeSettings.enableGradient&&(a=n._createGroup(!1,"legendGroup"),a.style.left="0px",a.style.top="0px",a.style.position="relative",i.append(a)),c=it.rangeColorMapping,k=0;k<c.length;k++)if(o=c[k],!o.hideLegend){if(v=[],this.shapeSettings.enableGradient&&(v=this._generateGradientCollection(o.gradientColors)),d={},this.shapeSettings.enableGradient)if(_isSVG){var et=t("<canvas/>"),ot=et[0].getContext("2d"),y=ot.createLinearGradient(0,0,300,0),p=0;for(e=0;e<10;e++)p=p+1/10,e==0?(y.addColorStop(0,o.gradientColors[0]),y.addColorStop(p,v[e])):e==v.length-1?(y.addColorStop(p-1/10,v[e]),y.addColorStop(p,o.gradientColors[1])):(y.addColorStop(p-1/10,v[e]),y.addColorStop(p,v[e+1]));ot.fillStyle=y;ot.fillRect(0,0,300,300);et.css({height:b+"px",width:l/c.length+"px","margin-left":f+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"});et.appendTo(i)}else st="legend"+k,at="<v:rect id="+st+' display="block" style="position:absolute;top: '+(h-2)+"px;left:"+f+"px;width:"+l/c.length+"px;height:"+b+'px;"><v:fill opacity="0.9px" type="gradient" method="linear sigma" angle="270"/><v:stroke opacity="0px"/><\/v:rect>',a.innerHTML=a.innerHTML+at,ht=document.getElementById(st),ht.fillcolor=o.gradientColors[0],ht.fill.color2=o.gradientColors[1];else g=t("<div/>"),g.css({height:b+"px",width:l/this.shapeSettings.colorMappings.rangeColorMapping.length+"px","background-color":o.color,"margin-left":f+"px","margin-top":h+"px",opacity:"0.9",filter:"alpha(opacity=90)",position:"absolute"}),_isSVG?g.appendTo(i):i.append(g);for(e=0;e<10;e++)d={},d.marginLeft=f,this._legendRects.push(d),f=f+l/c.length/10;if(this.legendSettings.showLabels){var nt=f-l/c.length,ct=h-25,vt=this._createLabel(o.from,nt,ct,"e-legend-rangestartlabel");nt=f;tt=this._createLabel(o.to,nt,ct);o.legendLabel!=u&&(tt=this._createLabel(o.legendLabel,nt-o.legendLabel.length*5,ct,"e-legend-rangeendlabel"));_isSVG?(o==c[0]&&vt.appendTo(i),tt.appendTo(i)):(o==c[0]&&i.append(vt),i.append(tt))}}this.legendSettings.rightLabel==null||this.legendSettings.showLabels||(s=this._createLabel(this.legendSettings.rightLabel,f+10,h-3,"e-interactivelegend-rightlabel"),_isSVG?s.appendTo(i):i.append(s),f=f+this.legendSettings.rightLabel.length*10);totalwidth=f+10;totalheight=h+b+10;n._legendSize={width:totalwidth,height:totalheight};w.legendSettings.dockOnMap&&(this.legendSettings.dockPosition=="left"?n._marginleft=totalwidth:this.legendSettings.dockPosition=="top"&&(n._margintop=totalheight))}if(w.legendSettings.dockOnMap||this.legendSettings.position!="none"){if(!w.legendSettings.dockOnMap&&this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive){var kt=this.legendSettings.position==u?"topleft":this.legendSettings.position,dt={width:totalwidth,height:totalheight},wt=n._getPosition(kt,dt);i.css({"margin-left":wt.x+"px","margin-top":wt.y})}}else yt=n._width*this.legendSettings.positionX/100,pt=n._height*this.legendSettings.positionY/100,i.css({"margin-left":yt+"px","margin-top":pt+"px"})}}},_generateLabels:function(n){var f=t("<div class='e-map-labelContainer'><\/div>"),i;for(t(f).css({position:"absolute",overflow:"scroll"}),i=0;i<this._polygonData.length;i++){var e=this._polygonData[i].properties,o=n._reflection(e,this.labelSettings.labelPath),u=t("<div class='e-map-label'><\/div>");t(u).css({"margin-top":i*20,position:"absolute"});u[0].innerHTML=o;f.append(u);n._mapContainer.append(f);u.mouseenter({Param1:this,Param2:this._mapShapes[i],map:n},n._polyEnterFunction);n._off(t(u),r.eventType.mouseUp,n._polyClickFunction);n._on(t(u),r.eventType.mouseUp,{Param1:this._mapShapes[i],Param2:this,Param3:this._mapShapes[i].shape,param4:u},n._polyClickFunction)}},_calcWidth:function(n){var i=t('<span  class="e-defaultLegendLabel">'+n+"<\/span>"),r;return t("body").append(i),r=i.width()+5,i.remove(),r},_generateBubbleLegends:function(n){var c,i,o,e,y,p,k,d;if(this.legendSettings.showLegend==u||this.legendSettings.showLegend){var l=10,s=10,it=this.legendSettings.iconHeight,a=this.legendSettings.iconWidth,f=t("<div/>");_isSVG?f.appendTo(n._templateDiv):n._templateDiv.append(f);var v=0,w=0,b=!0,h=null;if(this.bubbleSettings.colorMappings.rangeColorMapping!=u?h=this.bubbleSettings.colorMappings.rangeColorMapping:this.bubbleSettings.colorMappings.equalColorMapping!=u&&(h=this.bubbleSettings.colorMappings.equalColorMapping,b=!1),this.legendSettings.type==r.datavisualization.Map.LegendType.Bubbles&&this.bubbleSettings.colorMappings!=null&&(this.legendSettings.mode==u||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Default||this.legendSettings.mode==r.datavisualization.Map.LegendMode.Interactive&&this.bubbleSettings.colorMappings.equalColorMapping!=null)){for(this.legendSettings.iconHeight==u&&(this.legendSettings.iconHeight=20),this.legendSettings.iconWidth==u&&(this.legendSettings.iconWidth=20),c=0;c<h.length;c++)i=h[c],i.hideLegend||(o=t("<div class='e-mapBubbleLegend'/>"),this.legendSettings.icon==r.datavisualization.Map.LegendIcons.Circle?o.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","border-radius":this.legendSettings.iconHeight/2+"px","background-color":i.color,"margin-left":l+"px","margin-top":s+"px",position:"absolute"}):o.css({height:this.legendSettings.iconHeight+"px",width:this.legendSettings.iconWidth+"px","background-color":i.color,"margin-left":l+"px","margin-top":s+"px",position:"absolute"}),e=this._createLabel(i.legendLabel,l+a+5,s,"e-legendlabeltext"),i.legendLabel!=null?e[0].innerText=i.legendLabel:i.legendLabel=e[0].innerText=b?i.from:i.value,_isSVG?(o.appendTo(f),e.appendTo(f)):(f.append(o),f.append(e)),v<e[0].innerText.length*10+a&&(v=e[0].innerText.length*10+a),y=e.height(),p=o.height(),s+=y>p?y+5:p+5);w=s}if(this.legendSettings.position=="none")k=n._width*this.legendSettings.positionX/100,d=n._height*this.legendSettings.positionY/100,f.css({"margin-left":k+"px","margin-top":d+"px"});else{var nt=this.legendSettings.position==u?"topleft":this.legendSettings.position,tt={width:v,height:w},g=n._getPosition(nt,tt);f.css({"margin-left":g.x+"px","margin-top":g.y+"px"})}}},_animateBubble:function(n,i){var u={fx:n.getAttribute("r")/2},e=u.fx*2,f=t(n),r=this;t(u).delay(i).each(function(){}).animate({fx:e},{duration:700,step:function(n){_isSVG&&(f.attr("style","display:block;pointer-events:stroke;"),f.attr("r",n))},complete:function(){r._bubbleCount++;r._bubbleCount==r._bubbles.length&&r._setMapElements()}})},_setMapElements:function(){for(var i,n=0;n<this._mapItems.length;n++)i=this._mapItems[n],t(i).css({display:"block"})},_setMapItemsPositionWithAnimation:function(n){var s,o,e,i,r,u;for(this._bubbleCollection=[],i=0;i<this._bubbles.length;i++){var h=this._bubbles[i],a=this._bubbles[i].getAttribute("r"),u=this._bounds[i],o=(u.x+n._translatePoint.x)*n._scale,e=(u.y+n._translatePoint.y)*n._scale,c=n.validateBubblePosition(u.points,{x:o,y:e},a),l=0,v=Math.floor(Math.random()*(20-l)+l),y=parseInt(v*50);_isSVG&&t(h).attr({cx:c.x,cy:c.y});this._animateBubble(h,y);this._bubbleCollection.push(h)}for(i=0;i<this._mapMarkers.length;i++)r=this._mapMarkers[i],this.markers.length>0&&(s=this.markers[i]),u=n._isTileMap?n._convertTileLatLongtoPoint(s.latitude,s.longitude):n._convertLatLongtoPointforMarker(s.latitude,s.longitude),o=_isSVG?u.x:(u.x+n._transformX)*n._scale,e=u.y,t(r).css({display:"block",left:o,top:e-100}),t(r).delay(500).each(function(){}).animate({top:e},500);for(i=0;i<this._mapItems.length;i++){var r=this._mapItems[i],u=this._bounds[i],f=r[0].getBoundingClientRect(),p=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cx")):0,w=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cy")):0,o=this._bubbleCollection[i]?p-f.width/2:(u.x+n._translatePoint.x)*n._scale-f.width/2,e=this._bubbleCollection[i]?w-f.height/4:(u.y+n._translatePoint.y)*n._scale-f.height/4;this._bubbles.length>0?t(r).css({left:o,top:e,display:"none"}):t(r).css({left:o,top:e,display:"block"})}for(i=0;i<this._labelCollection.length;i++){r=this._labelCollection[i];u=this._labelBounds[i];t(r).css("display","block");var f=r[0].getBoundingClientRect(),b=_isSVG?f.width:f.right-f.left,k=_isSVG?f.height:f.bottom-f.top,o=(u.x+n._translatePoint.x)*n._scale-b/2,e=(u.y+n._translatePoint.y)*n._scale-k/2;(r[0].className="smartLabelStyle")&&(r[0].className="labelStyle",t(r[0]).css({"pointer-events":"none",position:"absolute"}));r[0].innerHTML=this._labelData[i];t(r).css({left:o,top:e})}this.labelSettings!=null&&this.labelSettings.showLabels&&this._validateSmartLabel(n)},_resizeShapes:function(n){var r=this.shapeSettings.strokeThickness/n._scale,i,t;if(this._mapShapes!=u)for(i=0;i<this._mapShapes.length;i++)t=this._mapShapes[i].shape,_isSVG?t.localName=="circle"?t.setAttribute("r",this.shapeSettings.radius/n._scale):this._contains(this._prevSelectedShapes,t)?t.setAttribute("stroke-width",this.shapeSettings.selectionStrokeWidth/n._scale):t.setAttribute("stroke-width",r):t.nodeName=="oval"||(t.strokeweight=this._contains(this._prevSelectedShapes,t)?this.shapeSettings.selectionStrokeWidth/n._scale:r)},_setMapItemsPosition:function(n){var c,s,h,i,e,f;if(this._bubbleCollection=[],this._bubbles!=u)for(i=0;i<this._bubbles.length;i++){var o=this._bubbles[i],a=this._bubbles[i].getAttribute("r"),f=this._bounds[i];if(_isSVG){var s=(f.x+n._translatePoint.x)*n._scale,h=(f.y+n._translatePoint.y)*n._scale,l=n.validateBubblePosition(f.points,{x:s,y:h},a);t(o).attr({cx:l.x,cy:l.y})}else{o=document.getElementById(o.id);var s=(f.x+n._translatePoint.x)*n._scale,h=(f.y+n._translatePoint.y)*n._scale,l=n.validateBubblePosition(f.points,{x:s,y:h},a),v=l.y-(o.getBoundingClientRect().bottom-o.getBoundingClientRect().top)/2,y=l.x-(o.getBoundingClientRect().right-o.getBoundingClientRect().left)/2;t(o).css({left:y,top:v})}this._bubbleCollection.push(o)}if(this._mapItems!=u)for(i=0;i<this._mapItems.length;i++){e=this._mapItems[i];f=this._bounds[i];t(e).css({display:"block"});var r=e[0].getBoundingClientRect(),p=_isSVG?r.width:r.right-r.left,w=_isSVG?r.height:r.bottom-r.top,b=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cx")):0,k=this._bubbleCollection[i]?parseFloat(this._bubbleCollection[i].getAttribute("cy")):0,s=this._bubbleCollection[i]?b-r.width/2:(f.x+n._translatePoint.x)*n._scale-r.width/2,h=this._bubbleCollection[i]?k-r.height/4:(f.y+n._translatePoint.y)*n._scale-r.height/4;t(e).css({left:s,top:h})}if(this._mapMarkers!=u)for(i=0;i<this._mapMarkers.length;i++)e=this._mapMarkers[i],this.markers.length>0&&(c=this.markers[i]),f=n._isTileMap?n._convertTileLatLongtoPoint(c.latitude,c.longitude):n._convertLatLongtoPointforMarker(c.latitude,c.longitude),s=f.x,h=f.y,t(e).css({left:s,top:h});if(this._labelCollection!=u)for(i=0;i<this._labelCollection.length;i++){e=this._labelCollection[i];f=this._labelBounds[i];t(e).css("display","block");var r=e[0].getBoundingClientRect(),p=_isSVG?r.width:r.right-r.left,w=_isSVG?r.height:r.bottom-r.top,s=(f.x+n._translatePoint.x)*n._scale-p/2,h=(f.y+n._translatePoint.y)*n._scale-w/2;(e[0].className="smartLabelStyle")&&(e[0].className="labelStyle",t(e[0]).css("background-color","transparent"),t(e[0]).css({"pointer-events":"none",position:"absolute"}));e[0].innerHTML=this._labelData[i];t(e).css({left:s,top:h})}this.labelSettings!=null&&this.labelSettings.showLabels&&this._validateSmartLabel(n)},_validateSmartLabel:function(n){function fi(n){var i=[],t;for(i.push(0),t=10;t<=n;t+=20)i.push(-t),i.push(t);return i}function ei(n){for(var t=0;t<ht.length;t++)if(oi(n,ht[t]))return!1;return!0}function oi(n,t){return n.left-2>=t.left+t.width||n.left-2+n.width<=t.left-2||n.top-2>=t.top+t.height||n.top+n.height<=t.top-2?!1:!0}var ht,p,yt,pt,it,rt,lt,bt,at,ui,tt,v,et,c,e,st,f;if(this._smartLabels=[],ht=[],this._labelCollection.length>0)for(p=0;p<this._mapShapes.length;p++){var o=this._labelBounds[p],i={x:(o.x+n._translatePoint.x)*n._scale,y:(o.y+n._translatePoint.y)*n._scale},dt={x:(o.rightMin.x+n._translatePoint.x)*n._scale,y:(o.rightMin.y+n._translatePoint.y)*n._scale},gt={x:(o.rightMax.x+n._translatePoint.x)*n._scale,y:(o.rightMax.y+n._translatePoint.y)*n._scale},ni={x:(o.leftMin.x+n._translatePoint.x)*n._scale,y:(o.leftMin.y+n._translatePoint.y)*n._scale},ti={x:(o.leftMax.x+n._translatePoint.x)*n._scale,y:(o.leftMax.y+n._translatePoint.y)*n._scale},l=this._labelCollection[p];if(i.x>0&&i.x<n._width&&i.y>0&&i.y<n._height){var ct=this._mapShapes[p].shape,a=ct.getBoundingClientRect(),w=!1,nt=l[0].getBoundingClientRect(),s=nt.height,h=nt.width;_isSVG||(a={width:a.right*n._scale-a.left*n._scale,height:a.bottom*n._scale-a.top*n._scale},s=nt.bottom-nt.top,h=nt.right-nt.left);yt=!1;pt=!1;(h/2>dt.x-i.x||h/2>gt.x-i.x)&&(s/2>i.y-dt.y||s/2>gt.y-i.y)?yt=!0:(h/2>i.x-ni.x||h/2>i.x-ti.x)&&(s/2>i.y-ni.y||s/2>ti.y-i.y)&&(pt=!0);var b=0,k=0,wt=20,d=[],ii=[];if(s>a.height||h>a.width||yt||pt)if(this.labelSettings.enableSmartLabel)for(this.labelSettings.smartLabelSize==r.datavisualization.Map.LabelSize.Fixed?(s=25,h=15*this.labelSettings.labelLength):(h*=1.3,s=25);!w;){for(wt>400&&(w=!0),d=fi(wt),ii=d,it=0;it<d.length;it++)for(rt=0;rt<d.length;rt++)b=ii[rt],k=d[it],i.x+b+h>n._width&&i.x<n._width&&(b-=i.x+b+h-n._width),i.x+b<0&&(b=0),i.y+k<0&&(k=0),i.y+k+s>n._height&&i.y<n._height&&(k-=i.y+k+s-n._height),lt={left:i.x+b,top:i.y+k,height:s,width:h},ei(lt)&&(bt=n._getIntersectedElements(lt,this._mapShapes),bt!=null&&bt.length==0&&(w=!0,it=d.length,rt=d.length,l[0].className="smartLabelStyle",t(l).css({"pointer-events":"stroke",position:"absolute"}),this.labelSettings.smartLabelSize==r.datavisualization.Map.LabelSize.Fixed&&(l[0].innerHTML=l[0].innerHTML.substring(0,this.labelSettings.labelLength)),l.mouseenter({Param1:this,Param2:this._mapShapes[p],map:n},n._polyEnterFunction),l.mousemove({Param1:this,Param2:this._mapShapes[p]},n._polyMoveFunction),t(l).css({left:i.x+b,top:i.y+k,"background-color":_isSVG?ct.getAttribute("fill"):ct.fillcolor.value}),ht.push(lt),at={},at.shape=ct,at.legend=l,this._smartLabels.push(at)));wt+=10}else{var ri=!0,ut=0,ft=0,w=!0;for(c=0;c<o.points.length;c++)v={x:(o.points[c].x+n._translatePoint.x)*n._scale,y:(o.points[c].y+n._translatePoint.y)*n._scale},w?(ut=v.y,ft=v.y,w=!1):(ut=Math.min(ut,v.y),ft=Math.max(ft,v.y));for(ui=Math.floor((ft-ut)/s),tt=[],f=0;f<ui;f++)e=[],tt.push(e);for(c=0;c<o.points.length;c++)v={x:(o.points[c].x+n._translatePoint.x)*n._scale,y:(o.points[c].y+n._translatePoint.y)*n._scale},et=Math.floor((v.y-ut)/s),et>0&&(et-=1),e=tt[et],e==u&&(e=[]),e.push({x:v.x,y:v.y}),tt[et]=e;for(c=0;c<tt.length;c++){e=tt[c];w=!0;var y=0,g=0,ot=0,vt=[],kt=[];for(f=0;f<e.length;f++)w?(y=e[f].x,g=e[f].x,ot=e[f].y,w=!1):(y=Math.min(y,e[f].x),g=Math.max(g,e[f].x),e[f].x==g&&(ot=e[f].y)),e[f].x<i.x&&vt.push(e[f].x),e[f].x>i.x&&kt.push(e[f].x);for(a.left<n._mapContainer[0].getBoundingClientRect().left+1&&(y=n._mapContainer[0].getBoundingClientRect().left+1-a.left,vt.push(y)),st=!1,f=0;f<vt.length;f++)if(g-vt[f]<h+1){st=!0;break}if(!st)for(f=0;f<kt.length;f++)if(kt[f]-y<h+1){st=!0;break}if(g-y>h+1&&!st){l.css("left",a.left*n._scale+(y-a.left*n._scale)+(g-y)/2-h/2+"px");l.css("top",ot+"px");ft-ot<s&&l.css("top",ot-s+"px");ri=!1;break}}ri&&l.css("display","none")}}}},_fillColors:function(n,t,i){t.rangeColorMapping!=null?this._fillRangeColors(n,t.rangeColorMapping,i):t.equalColorMapping!=null&&this._fillEqualColors(n,t,i)},_fillEqualColors:function(n,i,r){t.each(i.equalColorMapping,function(t,i){i.value==n&&(_isSVG?r.setAttribute("fill",i.color):r.fillcolor=i.color,r.highlightcolor=i.highlightcolor)})},_updateLegendRange:function(n,i,r){for(var h,f,c,a,s,o,l,y,v=i.shapeSettings.colorMappings.rangeColorMapping,e=0;e<v.length;e++)if(h=null,f=v[e],i.shapeSettings.enableGradient&&(h=this._generateGradientCollection(f.gradientColors)),n>=f.from&&n<=f.to)for(c=e,e!=0&&(c=e*10),a=f.from,s=f.from+(f.to-f.from)/10,o=c;o<c+10;o++){if(n>=a&&n<=s)return l={},y=this._getColorRatio(.7,1,n,f.from,f.to),i._legendRects[o]!=u&&(l=i._legendRects[o]),l.color=i.shapeSettings.enableGradient?e!=0?h[o-e*10]:h[o]:f.color,t(r).css({opacity:y}),l;a=s;s=s+(f.to-f.from)/10}},_fillRangeColors:function(n,i,r){for(var u,e,f=0;f<i.length;f++)u=i[f],n>=u.from&&n<=u.to&&(e=this._getColorRatio(.7,1,n,u.from,u.to),_isSVG?r.setAttribute("fill",u.color):r.fillcolor=u.color,r.highlightcolor=u.highlightcolor,t(r).css({opacity:e}))},_getColorRatio:function(n,t,i,r,u){var f=100/(u-r)*(i-r);return(parseFloat(t)-parseFloat(n))/100*f+parseFloat(n)}};t.fn.pinchZoom=function(n,i){var f,u,e=this[0],r=[],o=function(n){var t=e.createSVGPoint(),r=n.targetTouches,u,f,i;return r.length&&(i=r[0],u=i.pageX,f=i.pageY),t.x=u,t.y=f,t};handleTouchStart=function(i){var y=n,e,s,c,l,h,a,v;if(u=y.getCTM().inverse(),f=o(i).matrixTransform(u),e=i.touches,e.length>=2)for(s=0;s<e.length;s++){for(c=e[s],l=!1,h=0;h<r.length;h++)if(a=r[h],c.identifier===a.identifier){l=!0;break}l||(v=t.extend({},c),r.push(v))}i.preventDefault()};getDistance=function(n,t){var i=t.pageX-n.pageX,r=t.pageY-n.pageY;return Math.sqrt(i*i+r*r)};setCTM=function(n,t){var r=null,u="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";t.a>i._baseScale&&i.model.zoomSettings.enableZoom&&i.enablePan()&&(t.a>i._scale?r=!0:t.a<i._scale&&(r=!1),i._scale=t.a,i._translatePoint.x=t.e/t.a,i._translatePoint.y=t.f/t.a,i._applyTransform(i._scale,i._translatePoint),i.model.zoomSettings.level=i._scale-i._baseScale+1,i._zoomLevel(i._scale-i._baseScale+1),r!=null&&r?(i._trigger("zoomedIn",{originalEvent:null,zoomLevel:i._zoomLevel()}),i._updateSliderValue(!1),i._resizeShape()):r!=null&&(i._trigger("zoomedOut",{originalEvent:null,zoomLevel:i._zoomLevel()}),i._updateSliderValue(!1),i._resizeShape()),i._isDragging=!0,i._refrshLayers())};handleTouchEnd=function(n){for(var e,t,u,o,f=n.changedTouches,i=0;i<f.length;i++)for(e=f[i],t=0;t<r.length;t++)u=r[t],u.identifier===e.identifier&&(o=r.indexOf(u),r.splice(o,1));n.preventDefault()};updateTouch=function(n,t){n.pageX=t.pageX;n.pageY=t.pageY};handleTouchMove=function(t){var s,h,v,i,a;if(t.preventDefault(),s=n,h=t.touches,h.length>=2){var c=h[0],l=h[1],y=r[0],p=r[1];v=getDistance(c,l)/getDistance(y,p);i=e.createSVGPoint();i.x=(c.pageX+l.pageX)/2;i.y=(c.pageY+l.pageY)/2;i=i.matrixTransform(s.getCTM().inverse());a=e.createSVGMatrix().translate(i.x,i.y).scale(v).translate(-i.x,-i.y);setCTM(s,s.getCTM().multiply(a));typeof u=="undefined"&&(u=s.getCTM().inverse());u=u.multiply(a.inverse());updateTouch(y,c);updateTouch(p,l)}else r.length||(i=o(t).matrixTransform(u),setCTM(s,u.inverse().translate(i.x-f.x,i.y-f.y)))};this[0].addEventListener("touchstart",handleTouchStart,!1);this[0].addEventListener("touchend",handleTouchEnd,!1);this[0].addEventListener("touchmove",handleTouchMove,!1)};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}};r.datavisualization.Map.Locale=r.datavisualization.Map.Locale||{};r.datavisualization.Map.Locale["default"]=r.datavisualization.Map.Locale["en-US"]={zoomIn:"Zoom In",zoomOut:"Zoom Out",panTop:"Pan Top",panBottom:"Pan Bottom",panLeft:"Pan Left",panRight:"Pan Right",home:"Home"};r.datavisualization.Map.LayerType={Geometry:"geometry",OSM:"osm",Bing:"bing"};r.datavisualization.Map.LegendIcons={Rectangle:"rectangle",Circle:"circle"};r.datavisualization.Map.LabelSize={Fixed:"fixed",Default:"default"};r.datavisualization.Map.LegendMode={Default:"default",Interactive:"interactive"};r.datavisualization.Map.BingMapType={Aerial:"aerial",AerialWithLabel:"aerialwithlabel",Road:"road"};r.datavisualization.Map.GeometryType={Normal:"normal",Geographic:"geographic"};r.datavisualization.Map.SelectionMode={Default:"default",Multiple:"multiple"};r.datavisualization.Map.ColorPalette={Palette1:"palette1",Palette2:"palette2",Palette3:"palette3",CustomPalette:"custompalette"};r.datavisualization.Map.LegendType={Layers:"layers",Bubbles:"bubbles"};r.datavisualization.Map.Position={None:"none",TopLeft:"topleft",TopCenter:"topcenter",TopRight:"topright",CenterLeft:"centerleft",Center:"center",CenterRight:"centerright",BottomLeft:"bottomleft",BottomCenter:"bottomcenter",BottomRight:"bottomright"};r.datavisualization.Map.DockPosition={Top:"top",Bottom:"bottom",Right:"right",Left:"left"};r.datavisualization.Map.Alignment={Near:"near",Center:"center",Far:"far"};r.datavisualization.Map.LabelOrientation={Horizontal:"horizontal",Vertical:"vertical"}})(jQuery,Syncfusion)});
  